This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't add -fPIC if already present.
[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#
a774dfe6 29# Generated on Wed Feb 15 09:59:58 CET 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
a0d0e21e
LW
68: compute my invocation name
69me=$0
70case "$0" in
71*/*)
72 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73 test "$me" || me=$0
74 ;;
75esac
76
dfe9444c 77: Proper separator for the PATH environment variable
8e07c86e
AD
78p_=:
79: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 80if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
81 if test -n "$OS2_SHELL"; then
82 p_=\;
83 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 85 is_os2=yes
c4f23d77 86 elif test -n "$DJGPP"; then
495e2cbe
MB
87 case "X${MACHTYPE:-nonesuchmach}" in
88 *cygwin) ;;
89 *) p_=\; ;;
90 esac
dfe9444c 91 fi
39e571d4 92fi
a0d0e21e
LW
93
94: Proper PATH setting
95paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 96paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 97paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 98paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 99paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 100paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
101paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 103paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
104
105for p in $paths
106do
8e07c86e
AD
107 case "$p_$PATH$p_" in
108 *$p_$p$p_*) ;;
109 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
110 esac
111done
112
8e07c86e 113PATH=.$p_$PATH
2304df62
AD
114export PATH
115
dfe9444c
AD
116: shall we be using ksh?
117inksh=''
118needksh=''
119avoidksh=''
120newsh=/bin/ksh
121changesh=''
ff0cee69 122if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
123 inksh=true
124fi
125if test -f /hp-ux -a -f /bin/ksh; then
126 needksh='to avoid sh bug in "here document" expansion'
127fi
128if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129 if test X`/usr/bin/uname -v` = X4; then
130 avoidksh="to avoid AIX 4's /bin/sh"
131 newsh=/usr/bin/bsh
2304df62 132 fi
dfe9444c 133fi
cf04f91f
JH
134if test -f /osf_boot -a -f /usr/sbin/setld; then
135 if test X`/usr/bin/uname -s` = XOSF1; then
136 avoidksh="to avoid Digital UNIX' ksh"
137 newsh=/bin/sh
138 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139 fi
140fi
dfe9444c
AD
141case "$inksh/$needksh" in
142/[a-z]*)
c4f23d77 143 ENV=''
dfe9444c
AD
144 changesh=true
145 reason="$needksh"
146 ;;
147esac
148case "$inksh/$avoidksh" in
149true/[a-z]*)
150 changesh=true
151 reason="$avoidksh"
152 ;;
153esac
154case "$inksh/$needksh-$avoidksh-" in
155true/--)
a0d0e21e
LW
156 cat <<EOM
157(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 158mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 159EOM
dfe9444c
AD
160 ;;
161esac
162case "$changesh" in
163true)
2e2a97a6 164 export newsh
dfe9444c
AD
165 echo "(Feeding myself to $newsh $reason.)"
166 case "$0" in
167 Configure|*/Configure) exec $newsh $0 "$@";;
168 *) exec $newsh Configure "$@";;
169 esac
170 ;;
171esac
2304df62 172
bfb7748a
AD
173: if needed set CDPATH to a harmless value that is not chatty
174: avoid bash 2.02 problems with empty CDPATH.
175case "$CDPATH" in
176'') ;;
177*) case "$SHELL" in
178 *bash*) CDPATH='.' ;;
179 *) CDPATH='' ;;
180 esac
181 ;;
182esac
2304df62
AD
183: Configure runs within the UU subdirectory
184test -d UU || mkdir UU
8e07c86e 185cd UU && rm -f ./*
2304df62 186
6b356c8e
JH
187ccname=''
188ccversion=''
b4eb6b3d
JH
189ccsymbols=''
190cppccsymbols=''
191cppsymbols=''
5440bc8e
JH
192from=''
193run=''
194targetarch=''
195to=''
196usecrosscompile=''
6b34ded5 197mistrustnm=''
9c839522 198perllibs=''
b4eb6b3d
JH
199dynamic_ext=''
200extensions=''
201known_extensions=''
202nonxs_ext=''
203static_ext=''
204useopcode=''
205useposix=''
6fcddf3b 206extras=''
ecfc5424 207d_bsd=''
40a7a20a 208d_eunice=''
2304df62
AD
209d_xenix=''
210eunicefix=''
211Mcc=''
dfe9444c 212ar=''
2304df62
AD
213awk=''
214bash=''
215bison=''
216byacc=''
217cat=''
218chgrp=''
219chmod=''
220chown=''
ecfc5424 221comm=''
2304df62
AD
222compress=''
223cp=''
224cpio=''
225cpp=''
226csh=''
227date=''
228echo=''
229egrep=''
230emacs=''
231expr=''
232find=''
233flex=''
3c728e00 234gmake=''
2304df62 235grep=''
8ff267be 236gzip=''
2304df62
AD
237inews=''
238ksh=''
239less=''
240line=''
241lint=''
242ln=''
243lp=''
244lpr=''
245ls=''
246mail=''
247mailx=''
dfe9444c 248make=''
2304df62
AD
249mkdir=''
250more=''
251mv=''
693762b4 252nm=''
2304df62
AD
253nroff=''
254perl=''
255pg=''
256pmake=''
257pr=''
258rm=''
259rmail=''
260sed=''
261sendmail=''
2304df62
AD
262shar=''
263sleep=''
264smail=''
265sort=''
266submit=''
267tail=''
268tar=''
269tbl=''
693762b4 270tee=''
2304df62
AD
271test=''
272touch=''
273tr=''
274troff=''
275uname=''
276uniq=''
277uuname=''
278vi=''
279zcat=''
8ff267be 280zip=''
b4eb6b3d
JH
281full_ar=''
282full_sed=''
a0d0e21e 283libswanted=''
2304df62
AD
284hint=''
285myuname=''
85e6fe83
LW
286osname=''
287osvers=''
2304df62
AD
288Author=''
289Date=''
290Header=''
291Id=''
292Locker=''
293Log=''
294RCSfile=''
295Revision=''
296Source=''
297State=''
dfe9444c
AD
298_a=''
299_exe=''
300_o=''
4633a7c4
LW
301archobjs=''
302exe_ext=''
303firstmakefile=''
304lib_ext=''
305obj_ext=''
306path_sep=''
b4eb6b3d 307afs=''
a6d26a0d 308afsroot=''
b4eb6b3d
JH
309alignbytes=''
310ansi2knr=''
311archlib=''
312archlibexp=''
313d_archlib=''
314installarchlib=''
315archname=''
316myarchname=''
317d_atolf=''
318d_atoll=''
319baserev=''
320bin=''
321binexp=''
322installbin=''
b4eb6b3d 323byteorder=''
2304df62 324cc=''
2304df62
AD
325ccflags=''
326cppflags=''
327ldflags=''
328lkflags=''
8e07c86e 329locincpth=''
2304df62 330optimize=''
b4eb6b3d 331cf_email=''
2304df62
AD
332cf_by=''
333cf_time=''
b4eb6b3d 334charsize=''
2304df62 335contains=''
b4eb6b3d 336cpp_stuff=''
2304df62
AD
337cpplast=''
338cppminus=''
339cpprun=''
340cppstdin=''
74cac757 341d__fwalk=''
b4eb6b3d
JH
342d_access=''
343d_accessx=''
55954f19 344d_aintl=''
b4eb6b3d 345d_alarm=''
10bc17b6
JH
346asctime_r_proto=''
347d_asctime_r=''
0dbb1585
AL
348d_attribute_format=''
349d_attribute_malloc=''
350d_attribute_nonnull=''
351d_attribute_noreturn=''
352d_attribute_pure=''
353d_attribute_unused=''
354d_attribute_warn_unused_result=''
b4eb6b3d
JH
355d_bcmp=''
356d_bcopy=''
357d_bzero=''
358d_casti32=''
359castflags=''
360d_castneg=''
361d_chown=''
362d_chroot=''
363d_chsize=''
758a5d79 364d_class=''
b0a2e8e6 365d_clearenv=''
b4eb6b3d
JH
366d_closedir=''
367d_void_closedir=''
4e0554ec 368d_cmsghdr_s=''
b4eb6b3d 369d_const=''
36adc09b 370d_copysignl=''
b4eb6b3d
JH
371cryptlib=''
372d_crypt=''
10bc17b6
JH
373crypt_r_proto=''
374d_crypt_r=''
b4eb6b3d
JH
375d_csh=''
376full_csh=''
10bc17b6
JH
377ctermid_r_proto=''
378d_ctermid_r=''
379ctime_r_proto=''
380d_ctime_r=''
b4eb6b3d
JH
381d_cuserid=''
382d_dbl_dig=''
2ef53570 383d_dbminitproto=''
b4eb6b3d 384d_difftime=''
ae0e3d3b 385d_dirfd=''
b4eb6b3d 386d_dlerror=''
a0d0e21e 387d_dlopen=''
b4eb6b3d
JH
388d_dlsymun=''
389d_dosuid=''
390d_suidsafe=''
10bc17b6
JH
391d_drand48_r=''
392drand48_r_proto=''
b4eb6b3d
JH
393d_drand48proto=''
394d_dup2=''
395d_eaccess=''
396d_endgrent=''
10bc17b6
JH
397d_endgrent_r=''
398endgrent_r_proto=''
b4eb6b3d 399d_endhent=''
10bc17b6
JH
400d_endhostent_r=''
401endhostent_r_proto=''
b4eb6b3d 402d_endnent=''
10bc17b6
JH
403d_endnetent_r=''
404endnetent_r_proto=''
b4eb6b3d 405d_endpent=''
10bc17b6
JH
406d_endprotoent_r=''
407endprotoent_r_proto=''
b4eb6b3d 408d_endpwent=''
10bc17b6
JH
409d_endpwent_r=''
410endpwent_r_proto=''
b4eb6b3d 411d_endsent=''
10bc17b6
JH
412d_endservent_r=''
413endservent_r_proto=''
15b61c98 414d_faststdio=''
b363b713 415d_fchdir=''
b4eb6b3d
JH
416d_fchmod=''
417d_fchown=''
418d_fcntl=''
9d9004a9 419d_fcntl_can_lock=''
b4eb6b3d
JH
420d_fd_macros=''
421d_fd_set=''
422d_fds_bits=''
423d_fgetpos=''
758a5d79
JH
424d_finite=''
425d_finitel=''
b4eb6b3d
JH
426d_flexfnam=''
427d_flock=''
2ef53570 428d_flockproto=''
b4eb6b3d 429d_fork=''
758a5d79
JH
430d_fp_class=''
431d_fpclass=''
432d_fpclassify=''
433d_fpclassl=''
b4eb6b3d
JH
434d_fpos64_t=''
435d_frexpl=''
436d_fs_data_s=''
437d_fseeko=''
438d_fsetpos=''
439d_fstatfs=''
411ab01c 440d_fsync=''
b4eb6b3d
JH
441d_ftello=''
442d_ftime=''
443d_gettimeod=''
dc814df1 444d_futimes=''
b4eb6b3d
JH
445d_Gconvert=''
446d_getcwd=''
447d_getespwnam=''
448d_getfsstat=''
449d_getgrent=''
10bc17b6
JH
450d_getgrent_r=''
451getgrent_r_proto=''
452d_getgrgid_r=''
453getgrgid_r_proto=''
454d_getgrnam_r=''
455getgrnam_r_proto=''
b4eb6b3d
JH
456d_getgrps=''
457d_gethbyaddr=''
458d_gethbyname=''
459d_gethent=''
460aphostname=''
461d_gethname=''
462d_phostname=''
463d_uname=''
10bc17b6
JH
464d_gethostbyaddr_r=''
465gethostbyaddr_r_proto=''
466d_gethostbyname_r=''
467gethostbyname_r_proto=''
468d_gethostent_r=''
469gethostent_r_proto=''
b4eb6b3d 470d_gethostprotos=''
4e0554ec 471d_getitimer=''
b4eb6b3d 472d_getlogin=''
10bc17b6
JH
473d_getlogin_r=''
474getlogin_r_proto=''
b4eb6b3d
JH
475d_getmnt=''
476d_getmntent=''
477d_getnbyaddr=''
478d_getnbyname=''
479d_getnent=''
10bc17b6
JH
480d_getnetbyaddr_r=''
481getnetbyaddr_r_proto=''
482d_getnetbyname_r=''
483getnetbyname_r_proto=''
484d_getnetent_r=''
485getnetent_r_proto=''
b4eb6b3d 486d_getnetprotos=''
0c0643d0 487d_getpagsz=''
b4eb6b3d
JH
488d_getpent=''
489d_getpgid=''
490d_getpgrp2=''
491d_bsdgetpgrp=''
492d_getpgrp=''
493d_getppid=''
494d_getprior=''
495d_getpbyname=''
496d_getpbynumber=''
10bc17b6
JH
497d_getprotobyname_r=''
498getprotobyname_r_proto=''
499d_getprotobynumber_r=''
500getprotobynumber_r_proto=''
501d_getprotoent_r=''
502getprotoent_r_proto=''
b4eb6b3d
JH
503d_getprotoprotos=''
504d_getprpwnam=''
505d_getpwent=''
10bc17b6
JH
506d_getpwent_r=''
507getpwent_r_proto=''
508d_getpwnam_r=''
509getpwnam_r_proto=''
510d_getpwuid_r=''
511getpwuid_r_proto=''
b4eb6b3d 512d_getsent=''
10bc17b6
JH
513d_getservbyname_r=''
514getservbyname_r_proto=''
515d_getservbyport_r=''
516getservbyport_r_proto=''
517d_getservent_r=''
518getservent_r_proto=''
b4eb6b3d
JH
519d_getservprotos=''
520d_getspnam=''
10bc17b6
JH
521d_getspnam_r=''
522getspnam_r_proto=''
b4eb6b3d
JH
523d_getsbyname=''
524d_getsbyport=''
10bc17b6
JH
525d_gmtime_r=''
526gmtime_r_proto=''
a4f3eea9 527d_gnulibc=''
5f6e0ee4 528gnulibc_version=''
b4eb6b3d
JH
529d_hasmntopt=''
530d_htonl=''
55954f19 531d_ilogbl=''
b4eb6b3d
JH
532d_inetaton=''
533d_int64_t=''
534d_isascii=''
758a5d79
JH
535d_isfinite=''
536d_isinf=''
b4eb6b3d
JH
537d_isnan=''
538d_isnanl=''
539d_killpg=''
540d_lchown=''
541d_ldbl_dig=''
0a0abfba 542d_libm_lib_version=''
b4eb6b3d 543d_link=''
10bc17b6
JH
544d_localtime_r=''
545localtime_r_proto=''
b4eb6b3d
JH
546d_locconv=''
547d_lockf=''
548d_longdbl=''
549longdblsize=''
550d_longlong=''
551longlongsize=''
552d_lseekproto=''
553d_lstat=''
554d_madvise=''
7dd121ae
MB
555d_malloc_good_size=''
556d_malloc_size=''
b4eb6b3d
JH
557d_mblen=''
558d_mbstowcs=''
559d_mbtowc=''
560d_memchr=''
561d_memcmp=''
562d_memcpy=''
563d_memmove=''
564d_memset=''
565d_mkdir=''
566d_mkdtemp=''
567d_mkfifo=''
568d_mkstemp=''
569d_mkstemps=''
570d_mktime=''
571d_mmap=''
572mmaptype=''
573d_modfl=''
e67aeab1 574d_modfl_pow32_bug=''
bc9a1b2c 575d_modflproto=''
b4eb6b3d
JH
576d_mprotect=''
577d_msg=''
578d_msgctl=''
579d_msgget=''
4e0554ec 580d_msghdr_s=''
b4eb6b3d
JH
581d_msgrcv=''
582d_msgsnd=''
583d_msync=''
584d_munmap=''
585d_nice=''
2765b840 586d_nl_langinfo=''
b4eb6b3d
JH
587d_off64_t=''
588d_open3=''
589d_fpathconf=''
590d_pathconf=''
591d_pause=''
592d_pipe=''
593d_poll=''
2304df62 594d_portable=''
a33c94aa 595d_procselfexe=''
f24dbf84 596procselfexe=''
b4eb6b3d
JH
597d_old_pthread_create_joinable=''
598old_pthread_create_joinable=''
d6483fcc 599d_pthread_atfork=''
58d975c3 600d_pthread_attr_setscope=''
b4eb6b3d
JH
601d_pthread_yield=''
602d_sched_yield=''
603sched_yield=''
604d_qgcvt=''
10bc17b6
JH
605d_random_r=''
606random_r_proto=''
607d_readdir64_r=''
608readdir64_r_proto=''
b4eb6b3d
JH
609d_readdir=''
610d_rewinddir=''
611d_seekdir=''
612d_telldir=''
10bc17b6
JH
613d_readdir_r=''
614readdir_r_proto=''
b4eb6b3d 615d_readlink=''
4e0554ec
JH
616d_readv=''
617d_recvmsg=''
b4eb6b3d
JH
618d_rename=''
619d_rmdir=''
620d_safebcpy=''
621d_safemcpy=''
622d_sanemcmp=''
ef9f17be 623d_sbrkproto=''
55954f19 624d_scalbnl=''
b4eb6b3d
JH
625d_select=''
626d_sem=''
627d_semctl=''
628d_semget=''
629d_semop=''
4e0554ec 630d_sendmsg=''
b4eb6b3d
JH
631d_setegid=''
632d_seteuid=''
633d_setgrent=''
10bc17b6
JH
634d_setgrent_r=''
635setgrent_r_proto=''
b4eb6b3d
JH
636d_setgrps=''
637d_sethent=''
10bc17b6
JH
638d_sethostent_r=''
639sethostent_r_proto=''
4e0554ec 640d_setitimer=''
b4eb6b3d
JH
641d_setlinebuf=''
642d_setlocale=''
10bc17b6
JH
643d_setlocale_r=''
644setlocale_r_proto=''
b4eb6b3d 645d_setnent=''
10bc17b6
JH
646d_setnetent_r=''
647setnetent_r_proto=''
b4eb6b3d
JH
648d_setpent=''
649d_setpgid=''
650d_setpgrp2=''
651d_bsdsetpgrp=''
652d_setpgrp=''
653d_setprior=''
654d_setproctitle=''
10bc17b6
JH
655d_setprotoent_r=''
656setprotoent_r_proto=''
b4eb6b3d 657d_setpwent=''
10bc17b6
JH
658d_setpwent_r=''
659setpwent_r_proto=''
b4eb6b3d
JH
660d_setregid=''
661d_setresgid=''
662d_setresuid=''
663d_setreuid=''
664d_setrgid=''
665d_setruid=''
666d_setsent=''
10bc17b6
JH
667d_setservent_r=''
668setservent_r_proto=''
b4eb6b3d
JH
669d_setsid=''
670d_setvbuf=''
671d_sfio=''
672usesfio=''
673d_shm=''
674d_shmat=''
675d_shmatprototype=''
676shmattype=''
677d_shmctl=''
678d_shmdt=''
679d_shmget=''
680d_sigaction=''
983dbef6 681d_sigprocmask=''
b4eb6b3d 682d_sigsetjmp=''
5f106f9c 683usesitecustomize=''
4f5da3e9
SP
684d_snprintf=''
685d_vsnprintf=''
49a78c82 686d_sockatmark=''
2ef53570 687d_sockatmarkproto=''
b4eb6b3d
JH
688d_msg_ctrunc=''
689d_msg_dontroute=''
690d_msg_oob=''
691d_msg_peek=''
692d_msg_proxy=''
693d_oldsock=''
694d_scm_rights=''
695d_socket=''
696d_sockpair=''
697sockethdr=''
698socketlib=''
699d_socklen_t=''
700d_socks5_init=''
360321b3 701d_sprintf_returns_strlen=''
b4eb6b3d 702d_sqrtl=''
10bc17b6
JH
703d_srand48_r=''
704srand48_r_proto=''
705d_srandom_r=''
706srandom_r_proto=''
eef837ea 707d_sresgproto=''
640374d0 708d_sresuproto=''
b4eb6b3d
JH
709d_statblks=''
710d_statfs_f_flags=''
711d_statfs_s=''
712d_fstatvfs=''
713d_statvfs=''
714d_stdio_cnt_lval=''
715d_stdio_ptr_lval=''
a7ffa9b9
NC
716d_stdio_ptr_lval_nochange_cnt=''
717d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
718d_stdiobase=''
719d_stdstdio=''
720stdio_base=''
721stdio_bufsiz=''
722stdio_cnt=''
723stdio_filbuf=''
724stdio_ptr=''
725d_index=''
726d_strchr=''
727d_strcoll=''
728d_strctcpy=''
729d_strerrm=''
730d_strerror=''
731d_sysernlst=''
732d_syserrlst=''
10bc17b6
JH
733d_strerror_r=''
734strerror_r_proto=''
b3c85772 735d_strftime=''
08c92000
MB
736d_strlcat=''
737d_strlcpy=''
b4eb6b3d
JH
738d_strtod=''
739d_strtol=''
740d_strtold=''
741d_strtoll=''
28e5dec8 742d_strtoq=''
b4eb6b3d
JH
743d_strtoul=''
744d_strtoull=''
745d_strtouq=''
746d_strxfrm=''
747d_symlink=''
748d_syscall=''
2ef53570 749d_syscallproto=''
b4eb6b3d
JH
750d_sysconf=''
751d_system=''
752d_tcgetpgrp=''
753d_tcsetpgrp=''
754d_telldirproto=''
755d_time=''
756timetype=''
757clocktype=''
758d_times=''
10bc17b6
JH
759d_tmpnam_r=''
760tmpnam_r_proto=''
b4eb6b3d 761d_truncate=''
10bc17b6
JH
762d_ttyname_r=''
763ttyname_r_proto=''
b4eb6b3d 764d_tzname=''
4e0554ec
JH
765d_u32align=''
766d_ualarm=''
b4eb6b3d
JH
767d_umask=''
768d_semctl_semid_ds=''
769d_semctl_semun=''
770d_union_semun=''
758a5d79 771d_unordered=''
bdf33aa7 772d_unsetenv=''
4e0554ec 773d_usleep=''
2ef53570 774d_usleepproto=''
b4eb6b3d
JH
775d_ustat=''
776d_vfork=''
777usevfork=''
778d_voidsig=''
779signal_t=''
780d_volatile=''
781d_charvspr=''
782d_vprintf=''
783d_wait4=''
784d_waitpid=''
785d_wcstombs=''
786d_wctomb=''
4e0554ec 787d_writev=''
b4eb6b3d 788dlext=''
85e6fe83
LW
789cccdlflags=''
790ccdlflags=''
2304df62 791dlsrc=''
232e078e 792ld=''
85e6fe83 793lddlflags=''
2304df62 794usedl=''
b4eb6b3d
JH
795doublesize=''
796ebcdic=''
797fflushNULL=''
798fflushall=''
799fpossize=''
800fpostype=''
2d736872 801gccansipedantic=''
5b463ca7 802gccosandvers=''
8a27cf78 803gccversion=''
b4eb6b3d
JH
804gidformat=''
805gidsign=''
806gidsize=''
807gidtype=''
808groupstype=''
809h_fcntl=''
810h_sysfile=''
6e1038e0
MB
811html1dir=''
812html1direxp=''
813installhtml1dir=''
814html3dir=''
815html3direxp=''
816installhtml3dir=''
b4eb6b3d 817i_arpainet=''
10bc17b6 818i_crypt=''
b4eb6b3d
JH
819db_hashtype=''
820db_prefixtype=''
640374d0
JH
821db_version_major=''
822db_version_minor=''
823db_version_patch=''
b4eb6b3d
JH
824i_db=''
825i_dbm=''
826i_rpcsvcdbm=''
827d_dirnamlen=''
828direntrytype=''
829i_dirent=''
a0d0e21e 830i_dld=''
b4eb6b3d
JH
831i_dlfcn=''
832i_fcntl=''
833i_float=''
758a5d79
JH
834i_fp=''
835i_fp_class=''
b4eb6b3d
JH
836i_gdbm=''
837d_grpasswd=''
838i_grp=''
b4eb6b3d
JH
839i_ieeefp=''
840i_inttypes=''
2765b840 841i_langinfo=''
b4eb6b3d
JH
842i_libutil=''
843i_limits=''
844i_locale=''
845i_machcthr=''
846i_malloc=''
847i_math=''
848i_memory=''
849i_mntent=''
850i_ndbm=''
851i_netdb=''
852i_neterrno=''
853i_netinettcp=''
854i_niin=''
855i_sysin=''
856i_poll=''
857i_prot=''
858i_pthread=''
859d_pwage=''
860d_pwchange=''
861d_pwclass=''
862d_pwcomment=''
863d_pwexpire=''
864d_pwgecos=''
865d_pwpasswd=''
866d_pwquota=''
867i_pwd=''
868i_sfio=''
869i_shadow=''
870i_socks=''
871i_stddef=''
872i_stdlib=''
873i_string=''
874strings=''
875i_sunmath=''
876i_sysaccess=''
877i_sysdir=''
878i_sysfile=''
879d_voidtty=''
880i_bsdioctl=''
881i_sysfilio=''
882i_sysioctl=''
883i_syssockio=''
884i_syslog=''
885i_sysmman=''
886i_sysmode=''
887i_sysmount=''
888i_sysndir=''
889i_sysparam=''
890i_sysresrc=''
891i_syssecrt=''
892i_sysselct=''
893i_sysstat=''
894i_sysstatfs=''
895i_sysstatvfs=''
896i_systimes=''
897i_systypes=''
898i_sysuio=''
899i_sysun=''
900i_sysutsname=''
901i_sysvfs=''
902i_syswait=''
903i_sgtty=''
904i_termio=''
905i_termios=''
14b90194
JH
906d_tm_tm_gmtoff=''
907d_tm_tm_zone=''
b4eb6b3d
JH
908i_systime=''
909i_systimek=''
910i_time=''
911timeincl=''
912i_unistd=''
913i_ustat=''
914i_utime=''
915i_values=''
916i_stdarg=''
917i_varargs=''
918i_varhdr=''
919i_vfork=''
920inc_version_list=''
921inc_version_list_init=''
922installprefix=''
923installprefixexp=''
924installstyle=''
925installusrbinperl=''
926intsize=''
927longsize=''
928shortsize=''
4b661809 929issymlink=''
2304df62 930libc=''
b4eb6b3d
JH
931ldlibpthname=''
932libperl=''
933shrpenv=''
934useshrplib=''
a0d0e21e 935glibpth=''
2304df62 936libpth=''
8e07c86e 937loclibpth=''
2304df62
AD
938plibpth=''
939xlibpth=''
1cfa4ec7 940ignore_versioned_solibs=''
2304df62 941libs=''
43999f95
JH
942libsdirs=''
943libsfiles=''
944libsfound=''
13b3f787 945libspath=''
85e6fe83 946lns=''
b4eb6b3d
JH
947d_PRIEUldbl=''
948d_PRIFUldbl=''
949d_PRIGUldbl=''
950d_PRIeldbl=''
951d_PRIfldbl=''
952d_PRIgldbl=''
953d_SCNfldbl=''
954sPRIEUldbl=''
955sPRIFUldbl=''
956sPRIGUldbl=''
957sPRIeldbl=''
958sPRIfldbl=''
959sPRIgldbl=''
960sSCNfldbl=''
961lseeksize=''
962lseektype=''
8ff267be 963make_set_make=''
b4eb6b3d
JH
964d_mymalloc=''
965freetype=''
966mallocobj=''
967mallocsrc=''
968malloctype=''
9df442c2 969usemallocwrap=''
b4eb6b3d
JH
970usemymalloc=''
971installman1dir=''
972man1dir=''
973man1direxp=''
974man1ext=''
975installman3dir=''
976man3dir=''
977man3direxp=''
978man3ext=''
979modetype=''
980multiarch=''
981mydomain=''
982myhostname=''
983phostname=''
2304df62
AD
984c=''
985n=''
b4eb6b3d
JH
986d_eofnblk=''
987eagain=''
988o_nonblock=''
989rd_nodata=''
2cc61e15 990need_va_copy=''
b4eb6b3d
JH
991netdb_hlen_type=''
992netdb_host_type=''
993netdb_name_type=''
994netdb_net_type=''
995groupcat=''
996hostcat=''
997passcat=''
998orderlib=''
999ranlib=''
1000d_perl_otherlibdirs=''
1001otherlibdirs=''
2304df62
AD
1002package=''
1003spackage=''
b4eb6b3d
JH
1004pager=''
1005api_revision=''
1006api_subversion=''
1007api_version=''
1008api_versionstring=''
1009patchlevel=''
151e6568 1010perl_patchlevel=''
b4eb6b3d
JH
1011revision=''
1012subversion=''
1013version=''
861eb78d 1014version_patchlevel_string=''
b4eb6b3d
JH
1015perl5=''
1016perladmin=''
1017perlpath=''
1018d_nv_preserves_uv=''
f607920a 1019d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1020i16size=''
1021i16type=''
1022i32size=''
1023i32type=''
1024i64size=''
1025i64type=''
1026i8size=''
1027i8type=''
1028ivsize=''
1029ivtype=''
53133ed1 1030nv_preserves_uv_bits=''
b4eb6b3d
JH
1031nvsize=''
1032nvtype=''
1033u16size=''
1034u16type=''
1035u32size=''
1036u32type=''
1037u64size=''
1038u64type=''
1039u8size=''
1040u8type=''
1041uvsize=''
1042uvtype=''
1043ivdformat=''
1044nvEUformat=''
1045nvFUformat=''
1046nvGUformat=''
1047nveformat=''
1048nvfformat=''
1049nvgformat=''
1050uvXUformat=''
1051uvoformat=''
1052uvuformat=''
1053uvxformat=''
1054pidtype=''
1055prefix=''
1056prefixexp=''
1057installprivlib=''
1058privlib=''
1059privlibexp=''
1060prototype=''
1061ptrsize=''
1062d_PRIXU64=''
1063d_PRId64=''
1064d_PRIi64=''
1065d_PRIo64=''
1066d_PRIu64=''
1067d_PRIx64=''
1068sPRIXU64=''
1069sPRId64=''
1070sPRIi64=''
1071sPRIo64=''
1072sPRIu64=''
1073sPRIx64=''
1074d_quad=''
1075quadkind=''
1076quadtype=''
1077uquadtype=''
1078drand01=''
1079randbits=''
1080randfunc=''
1081randseedtype=''
1082seedfunc=''
1083installscript=''
1084scriptdir=''
1085scriptdirexp=''
1086selectminbits=''
1087selecttype=''
8ff267be 1088sh=''
b4eb6b3d
JH
1089sig_count=''
1090sig_name=''
1091sig_name_init=''
1092sig_num=''
1093sig_num_init=''
76d3c696 1094sig_size=''
b4eb6b3d
JH
1095installsitearch=''
1096sitearch=''
1097sitearchexp=''
1098installsitebin=''
1099sitebin=''
1100sitebinexp=''
8d2cbf27
JH
1101installsitehtml1dir=''
1102sitehtml1dir=''
1103sitehtml1direxp=''
1104installsitehtml3dir=''
1105sitehtml3dir=''
1106sitehtml3direxp=''
b4eb6b3d
JH
1107installsitelib=''
1108sitelib=''
1109sitelib_stem=''
1110sitelibexp=''
91e123a8
JH
1111installsiteman1dir=''
1112siteman1dir=''
1113siteman1direxp=''
1114installsiteman3dir=''
1115siteman3dir=''
1116siteman3direxp=''
b4eb6b3d
JH
1117siteprefix=''
1118siteprefixexp=''
6e1038e0
MB
1119installsitescript=''
1120sitescript=''
1121sitescriptexp=''
b4eb6b3d
JH
1122sizesize=''
1123sizetype=''
a0d0e21e 1124so=''
b4eb6b3d 1125socksizetype=''
2304df62
AD
1126sharpbang=''
1127shsharp=''
1128spitshell=''
dfe9444c 1129src=''
b4eb6b3d
JH
1130ssizetype=''
1131startperl=''
2304df62 1132startsh=''
b4eb6b3d
JH
1133stdchar=''
1134d_stdio_stream_array=''
1135stdio_stream_array=''
1136sysman=''
5ff3f7a4 1137trnl=''
b4eb6b3d
JH
1138uidformat=''
1139uidsign=''
1140uidsize=''
1141uidtype=''
1142archname64=''
1143use64bitall=''
1144use64bitint=''
15b61c98 1145usefaststdio=''
b4eb6b3d
JH
1146ccflags_uselargefiles=''
1147ldflags_uselargefiles=''
1148libswanted_uselargefiles=''
1149uselargefiles=''
1150uselongdouble=''
1151usemorebits=''
1152usemultiplicity=''
2304df62 1153nm_opt=''
40a7a20a 1154nm_so_opt=''
2304df62
AD
1155runnm=''
1156usenm=''
b4eb6b3d 1157useperlio=''
db0f2be4 1158userelocatableinc=''
29209bc5 1159usesocks=''
b4eb6b3d
JH
1160d_oldpthreads=''
1161use5005threads=''
1162useithreads=''
9514c62b 1163usereentrant=''
b4eb6b3d 1164usethreads=''
2304df62 1165incpath=''
2304df62
AD
1166mips_type=''
1167usrinc=''
b4eb6b3d
JH
1168d_vendorarch=''
1169installvendorarch=''
1170vendorarch=''
1171vendorarchexp=''
1172d_vendorbin=''
1173installvendorbin=''
1174vendorbin=''
1175vendorbinexp=''
8d2cbf27
JH
1176installvendorhtml1dir=''
1177vendorhtml1dir=''
1178vendorhtml1direxp=''
1179installvendorhtml3dir=''
1180vendorhtml3dir=''
1181vendorhtml3direxp=''
b4eb6b3d
JH
1182d_vendorlib=''
1183installvendorlib=''
1184vendorlib=''
1185vendorlib_stem=''
1186vendorlibexp=''
91e123a8
JH
1187installvendorman1dir=''
1188vendorman1dir=''
1189vendorman1direxp=''
1190installvendorman3dir=''
1191vendorman3dir=''
1192vendorman3direxp=''
b4eb6b3d
JH
1193usevendorprefix=''
1194vendorprefix=''
1195vendorprefixexp=''
6e1038e0
MB
1196d_vendorscript=''
1197installvendorscript=''
1198vendorscript=''
1199vendorscriptexp=''
d56c5707 1200versiononly=''
b4eb6b3d
JH
1201defvoidused=''
1202voidflags=''
3659ebf1
JH
1203yacc=''
1204yaccflags=''
2304df62
AD
1205CONFIG=''
1206
ecfc5424
AD
1207define='define'
1208undef='undef'
1209smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1210rmlist=''
1211
1212: We must find out about Eunice early
1213eunicefix=':'
1214if test -f /etc/unixtovms; then
1215 eunicefix=/etc/unixtovms
1216fi
1217if test -f /etc/unixtovms.exe; then
1218 eunicefix=/etc/unixtovms.exe
1219fi
1220
cfb04860 1221: Set executable suffix now -- needed before hints available
6153ba32
PG
1222if test -f "/libs/version.library"; then
1223: Amiga OS
1224 _exe=""
1225elif test -f "/system/gnu_library/bin/ar.pm"; then
1226: Stratus VOS
cfb04860 1227 _exe=".pm"
6153ba32
PG
1228elif test -n "$DJGPP"; then
1229: DOS DJGPP
cfb04860 1230 _exe=".exe"
5c728af0 1231elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1232: OS/2 or cygwin
ba863942
JH
1233 _exe=".exe"
1234fi
868439a2 1235
b4eb6b3d 1236i_whoami=''
9da7673b
MB
1237ccname=''
1238ccversion=''
1239perllibs=''
1240: set useposix=false in your hint file to disable the POSIX extension.
1241useposix=true
1242: set useopcode=false in your hint file to disable the Opcode extension.
1243useopcode=true
1244: Trailing extension. Override this in a hint file, if needed.
1245: Extra object files, if any, needed on this platform.
1246archobjs=''
1247archname=''
ff935051
JH
1248: Possible local include directories to search.
1249: Set locincpth to "" in a hint file to defeat local include searches.
1250locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1251locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1252:
1253: no include file wanted by default
1254inclwanted=''
1255
b4eb6b3d 1256groupstype=''
64615a5e 1257libnames=''
732c9516
JH
1258: change the next line if compiling for Xenix/286 on Xenix/386
1259xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1260: Possible local library directories to search.
1261loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1262loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1263
1264: general looking path for locating libraries
5869b1f1 1265glibpth="/lib /usr/lib $xlibpth"
732c9516 1266glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1267test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1268test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1269
1270: Private path used by Configure to find libraries. Its value
1271: is prepended to libpth. This variable takes care of special
1272: machines, like the mips. Usually, it should be empty.
1273plibpth=''
1274
1cfa4ec7
GS
1275: default library list
1276libswanted=''
921b2963 1277: some systems want to use only the non-versioned libso:s
1cfa4ec7 1278ignore_versioned_solibs=''
9da7673b
MB
1279siteman1dir=''
1280siteman3dir=''
1281sitescript=''
b4eb6b3d
JH
1282archname64=''
1283ccflags_uselargefiles=''
1284ldflags_uselargefiles=''
1285libswanted_uselargefiles=''
1286: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1287: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1288: set usethreads on the Configure command line to enable threads.
cd040c5e 1289usereentrant='undef'
9da7673b
MB
1290: full support for void wanted by default
1291defvoidused=15
1292
ecfc5424 1293: List of libraries we want.
15431986 1294: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1295libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1296libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1297: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1298: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1299glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1300glibpth="/usr/shlib $glibpth"
1301: Do not use vfork unless overridden by a hint file.
1302usevfork=false
1303
8ff267be 1304: Find the basic shell for Bourne shell scripts
1305case "$sh" in
1306'')
8ff267be 1307 case "$SYSTYPE" in
1308 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1309 *) xxx='/bin/sh';;
1310 esac
1311 if test -f "$xxx"; then
1312 sh="$xxx"
1313 else
1314 : Build up a list and do a single loop so we can 'break' out.
1315 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1316 for xxx in sh bash ksh pdksh ash; do
1317 for p in $pth; do
1318 try="$try ${p}/${xxx}"
1319 done
1320 done
1321 for xxx in $try; do
1322 if test -f "$xxx"; then
1323 sh="$xxx";
8ff267be 1324 break
a5a94ea5
JH
1325 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1326 sh="$xxx";
1327 break
8ff267be 1328 elif test -f "$xxx.exe"; then
1329 sh="$xxx";
8ff267be 1330 break
1331 fi
1332 done
1333 fi
1334 ;;
1335esac
1336
1337case "$sh" in
a33c94aa 1338'') cat >&2 <<EOM
8ff267be 1339$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1340
8ff267be 1341Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1342Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1343we'll try to straighten this all out.
8ff267be 1344EOM
1345 exit 1
1346 ;;
1347esac
1348
760ac839 1349: see if sh knows # comments
73614538 1350if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1351 shsharp=true
1352 spitshell=cat
760ac839 1353 xcat=/bin/cat
a931254c
JH
1354 test -f $xcat$_exe || xcat=/usr/bin/cat
1355 if test ! -f $xcat$_exe; then
4bdb8fb5 1356 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1357 if test -f $p/cat$_exe; then
1deb0a86 1358 xcat=$p/cat
3c728e00
JH
1359 break
1360 fi
1361 done
1deb0a86
JH
1362 if test ! -f $xcat$_exe; then
1363 echo "Can't find cat anywhere!"
3c728e00
JH
1364 exit 1
1365 fi
1366 fi
5440bc8e
JH
1367 echo "#!$xcat" >sharp
1368 $eunicefix sharp
1369 chmod +x sharp
1370 ./sharp > today
760ac839 1371 if test -s today; then
760ac839
LW
1372 sharpbang='#!'
1373 else
5440bc8e
JH
1374 echo "#! $xcat" > sharp
1375 $eunicefix sharp
1376 chmod +x sharp
1377 ./sharp > today
760ac839 1378 if test -s today; then
760ac839
LW
1379 sharpbang='#! '
1380 else
760ac839
LW
1381 sharpbang=': use '
1382 fi
1383 fi
1384else
dfe9444c 1385 echo " "
8ff267be 1386 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1387 shsharp=false
1388 cd ..
1389 echo "exec grep -v '^[ ]*#'" >spitshell
1390 chmod +x spitshell
1391 $eunicefix spitshell
1392 spitshell=`pwd`/spitshell
1393 cd UU
1394 echo "I presume that if # doesn't work, #! won't work either!"
1395 sharpbang=': use '
1396fi
5440bc8e 1397rm -f sharp today
760ac839
LW
1398
1399: figure out how to guarantee sh startup
8ff267be 1400case "$startsh" in
1401'') startsh=${sharpbang}${sh} ;;
1402*)
760ac839 1403esac
5440bc8e 1404cat >sharp <<EOSS
760ac839
LW
1405$startsh
1406set abc
1407test "$?abc" != 1
1408EOSS
1409
5440bc8e
JH
1410chmod +x sharp
1411$eunicefix sharp
1412if ./sharp; then
8ff267be 1413 : echo "Yup, it does."
760ac839 1414else
dfe9444c
AD
1415 echo "Hmm... '$startsh' does not guarantee sh startup..."
1416 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1417fi
5440bc8e 1418rm -f sharp
760ac839 1419
aebf16e7
AD
1420
1421: Save command line options in file UU/cmdline.opt for later use in
1422: generating config.sh.
1423cat > cmdline.opt <<EOSH
1424# Configure command line arguments.
1425config_arg0='$0'
1426config_args='$*'
1427config_argc=$#
1428EOSH
1429argn=1
ee45ea83
IZ
1430args_exp=''
1431args_sep=''
aebf16e7
AD
1432for arg in "$@"; do
1433 cat >>cmdline.opt <<EOSH
1434config_arg$argn='$arg'
1435EOSH
ee45ea83
IZ
1436 # Extreme backslashitis: replace each ' by '"'"'
1437 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1438$arg
1439EOC
1440 arg_exp=`cat cmdl.opt`
1441 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1442 argn=`expr $argn + 1`
ee45ea83 1443 args_sep=' '
aebf16e7 1444done
ee45ea83
IZ
1445# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1446# used by ./hints/os2.sh
1447rm -f cmdl.opt
aebf16e7 1448
2304df62
AD
1449: produce awk script to parse command line options
1450cat >options.awk <<'EOF'
1451BEGIN {
02e93a22 1452 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1453
1454 len = length(optstr);
1455 for (i = 1; i <= len; i++) {
1456 c = substr(optstr, i, 1);
1457 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1458 if (a == ":") {
1459 arg[c] = 1;
1460 i++;
1461 }
1462 opt[c] = 1;
1463 }
1464}
1465{
1466 expect = 0;
1467 str = $0;
1468 if (substr(str, 1, 1) != "-") {
1469 printf("'%s'\n", str);
1470 next;
1471 }
1472 len = length($0);
1473 for (i = 2; i <= len; i++) {
1474 c = substr(str, i, 1);
1475 if (!opt[c]) {
1476 printf("-%s\n", substr(str, i));
1477 next;
1478 }
1479 printf("-%s\n", c);
1480 if (arg[c]) {
1481 if (i < len)
1482 printf("'%s'\n", substr(str, i + 1));
1483 else
1484 expect = 1;
1485 next;
1486 }
1487 }
1488}
1489END {
1490 if (expect)
1491 print "?";
1492}
1493EOF
1494
1495: process the command line options
4633a7c4
LW
1496set X `for arg in "$@"; do echo "X$arg"; done |
1497 sed -e s/X// | awk -f options.awk`
2304df62
AD
1498eval "set $*"
1499shift
1500rm -f options.awk
1501
1502: set up default values
1503fastread=''
1504reuseval=false
1505config_sh=''
1506alldone=''
1507error=''
1508silent=''
1509extractsh=''
ecfc5424 1510override=''
16d20bd9 1511knowitall=''
02e93a22 1512rm -f optdef.sh posthint.sh
28757baa 1513cat >optdef.sh <<EOS
1514$startsh
1515EOS
2304df62 1516
dfe9444c 1517
2304df62
AD
1518: option parsing
1519while test $# -gt 0; do
1520 case "$1" in
1521 -d) shift; fastread=yes;;
1522 -e) shift; alldone=cont;;
1523 -f)
1524 shift
1525 cd ..
1526 if test -r "$1"; then
1527 config_sh="$1"
1528 else
a0d0e21e 1529 echo "$me: cannot read config file $1." >&2
2304df62
AD
1530 error=true
1531 fi
1532 cd UU
1533 shift;;
1534 -h) shift; error=true;;
1535 -r) shift; reuseval=true;;
dfe9444c 1536 -s) shift; silent=true; realsilent=true;;
2304df62 1537 -E) shift; alldone=exit;;
16d20bd9 1538 -K) shift; knowitall=true;;
ecfc5424 1539 -O) shift; override=true;;
dfe9444c 1540 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1541 -D)
1542 shift
1543 case "$1" in
1544 *=)
1545 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1546 echo "$me: ignoring -D $1" >&2
1547 ;;
ecfc5424 1548 *=*) echo "$1" | \
1aef975c
AD
1549 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1550 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1551 esac
1552 shift
1553 ;;
1554 -U)
1555 shift
1556 case "$1" in
1aef975c 1557 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1558 *=*)
1559 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1560 echo "$me: ignoring -U $1" >&2
1561 ;;
1aef975c 1562 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1563 esac
1564 shift
1565 ;;
02e93a22
JH
1566 -A)
1567 shift
1568 xxx=''
1569 yyy="$1"
02e93a22 1570 zzz=''
5f83a3e9 1571 uuu=undef
02e93a22 1572 case "$yyy" in
f7c31117 1573 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1574 case "$zzz" in
1575 *:*) zzz='' ;;
1576 *) xxx=append
f7c31117
JH
1577 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1578 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1579 esac
1580 ;;
1581 esac
1582 case "$xxx" in
1583 '') case "$yyy" in
f7c31117
JH
1584 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1585 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1586 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1587 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1588 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1589 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1590 esac
1591 ;;
1592 esac
02e93a22
JH
1593 case "$xxx" in
1594 append)
5f83a3e9 1595 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1596 clear)
5f83a3e9 1597 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1598 define)
1599 case "$zzz" in
1600 '') zzz=define ;;
1601 esac
5f83a3e9 1602 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1603 eval)
5f83a3e9 1604 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1605 prepend)
5f83a3e9 1606 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1607 undef)
1608 case "$zzz" in
1609 '') zzz="$uuu" ;;
1610 esac
5f83a3e9
JH
1611 echo "$yyy=$zzz" >> posthint.sh ;;
1612 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1613 esac
bde6b06b 1614 shift
02e93a22 1615 ;;
dfe9444c 1616 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1617 exit 0;;
2304df62 1618 --) break;;
a0d0e21e 1619 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1620 *) break;;
1621 esac
1622done
1623
1624case "$error" in
1625true)
1626 cat >&2 <<EOM
2afac517 1627Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1628 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1629 -d : use defaults for all answers.
1630 -e : go on without questioning past the production of config.sh.
1631 -f : specify an alternate default configuration file.
1632 -h : print this help message and exit (with an error status).
1633 -r : reuse C symbols value if possible (skips costly nm extraction).
1634 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1635 -D : define symbol to have some value:
1636 -D symbol symbol gets the value 'define'
1637 -D symbol=value symbol gets the value 'value'
2304df62 1638 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1639 -K : do not use unless you know what you are doing.
ecfc5424 1640 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1641 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1642 -U : undefine symbol:
1643 -U symbol symbol gets the value 'undef'
1644 -U symbol= symbol gets completely empty
02e93a22 1645 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1646 -A symbol=value append " "value to symbol
02e93a22
JH
1647 -A append:symbol=value append value to symbol
1648 -A define:symbol=value define symbol to have value
02e93a22
JH
1649 -A clear:symbol define symbol to be ''
1650 -A define:symbol define symbol to be 'define'
1651 -A eval:symbol=value define symbol to be eval of value
1652 -A prepend:symbol=value prepend value to symbol
1653 -A undef:symbol define symbol to be 'undef'
1654 -A undef:symbol= define symbol to be ''
2304df62
AD
1655 -V : print version number and exit (with a zero status).
1656EOM
1657 exit 1
1658 ;;
1659esac
1660
dfe9444c
AD
1661: Sanity checks
1662case "$fastread$alldone" in
1663yescont|yesexit) ;;
1664*)
aaeb8e51
GS
1665 case "$extractsh" in
1666 true) ;;
1667 *)
1668 if test ! -t 0; then
1669 echo "Say 'sh Configure', not 'sh <Configure'"
1670 exit 1
1671 fi
1672 ;;
1673 esac
dfe9444c
AD
1674 ;;
1675esac
1676
2304df62
AD
1677exec 4>&1
1678case "$silent" in
1679true) exec 1>/dev/null;;
1680esac
1681
ecfc5424 1682: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1683touch optdef.sh
1684. ./optdef.sh
02e93a22
JH
1685: create the posthint manipulation script and leave the file out there...
1686touch posthint.sh
a0d0e21e 1687
2304df62 1688: set package name
85e6fe83 1689package=perl5
b4eb6b3d
JH
1690first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1691last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1692case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1693ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1694*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1695esac
2304df62 1696
2304df62
AD
1697: Some greps do not return status, grrr.
1698echo "grimblepritz" >grimble
1699if grep blurfldyick grimble >/dev/null 2>&1 ; then
1700 contains=contains
1701elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1702 contains=grep
1703else
1704 contains=contains
1705fi
1706rm -f grimble
1707: the following should work in any shell
1708case "$contains" in
1709contains*)
1710 echo " "
1711 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1712 cat >contains <<'EOSS'
1713grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1714EOSS
1715chmod +x contains
1716esac
1717
dfe9444c
AD
1718: Find the path to the source tree
1719case "$src" in
1720'') case "$0" in
b233458b
JH
1721 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1722 case "$src" in
1723 /*) ;;
8504afb7 1724 .) ;;
b233458b
JH
1725 *) src=`cd ../$src && pwd` ;;
1726 esac
1727 ;;
dfe9444c
AD
1728 *) src='.';;
1729 esac;;
1730esac
1731case "$src" in
1732'') src=/
1733 rsrc=/
1734 ;;
1735/*) rsrc="$src";;
1736*) rsrc="../$src";;
1737esac
1738if test -f $rsrc/Configure && \
1739 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1740then
1741 : found it, so we are ok.
1742else
1743 rsrc=''
1744 for src in . .. ../.. ../../.. ../../../..; do
1745 if test -f ../$src/Configure && \
1746 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1747 then
1748 rsrc=../$src
1749 break
1750 fi
1751 done
1752fi
1753case "$rsrc" in
1754'')
1755 cat <<EOM >&4
1756
1757Sorry, I can't seem to locate the source dir for $package. Please start
1758Configure with an explicit path -- i.e. /some/path/Configure.
1759
1760EOM
1761 exit 1
1762 ;;
1763../.) rsrc='..';;
1764*)
1765 echo " "
1766 echo "Sources for $package found in \"$src\"." >&4
1767 ;;
1768esac
1769
1770: script used to extract .SH files with variable substitutions
1771cat >extract <<'EOS'
a02608de 1772PERL_CONFIG_SH=true
dfe9444c 1773echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1774if test -f MANIFEST; then
1775 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1776else
1777 echo "(Looking for .SH files under the source directory.)"
6904989c 1778 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1779fi
1780shift
1781case $# in
6904989c 17820) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1783esac
6904989c 1784if test ! -f "$src/$1"; then
dfe9444c
AD
1785 shift
1786fi
1787mkdir_p='
1788name=$1;
1789create="";
1790while test $name; do
1791 if test ! -d "$name"; then
1792 create="$name $create";
1793 name=`echo $name | sed -e "s|^[^/]*$||"`;
1794 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1795 else
1796 name="";
1797 fi;
1798done;
1799for file in $create; do
1800 mkdir $file;
1801done
1802'
1803for file in $*; do
1804 case "$src" in
1805 ".")
1806 case "$file" in
1807 */*)
1808 dir=`expr X$file : 'X\(.*\)/'`
1809 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1810 (cd "$dir" && . ./$file)
dfe9444c
AD
1811 ;;
1812 *)
1813 . ./$file
1814 ;;
1815 esac
1816 ;;
1817 *)
1818 case "$file" in
1819 */*)
1820 dir=`expr X$file : 'X\(.*\)/'`
1821 file=`expr X$file : 'X.*/\(.*\)'`
1822 (set x $dir; shift; eval $mkdir_p)
6904989c 1823 sh <"$src/$dir/$file"
dfe9444c
AD
1824 ;;
1825 *)
6904989c 1826 sh <"$src/$file"
dfe9444c
AD
1827 ;;
1828 esac
1829 ;;
1830 esac
1831done
6904989c 1832if test -f "$src/config_h.SH"; then
dfe9444c
AD
1833 if test ! -f config.h; then
1834 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1835 . "$src/config_h.SH"
dfe9444c
AD
1836 fi
1837fi
1838EOS
1839
1840: extract files and exit if asked to do so
1841case "$extractsh" in
1842true)
1843 case "$realsilent" in
1844 true) ;;
1845 *) exec 1>&4;;
1846 esac
1847 case "$config_sh" in
1848 '') config_sh='config.sh';;
1849 esac
1850 echo " "
1851 echo "Fetching answers from $config_sh..."
1852 cd ..
1853 . $config_sh
1854 test "$override" && . ./optdef.sh
1855 echo " "
1856 . UU/extract
1857 rm -rf UU
24ccb310 1858 echo "Extraction done."
dfe9444c
AD
1859 exit 0
1860 ;;
1861esac
1862
1863: Eunice requires " " instead of "", can you believe it
1864echo " "
1865: Here we go...
1866echo "Beginning of configuration questions for $package."
1867
1868trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1869
2304df62
AD
1870: first determine how to suppress newline on echo command
1871echo " "
1872echo "Checking echo to see how to suppress newlines..."
1873(echo "hi there\c" ; echo " ") >.echotmp
1874if $contains c .echotmp >/dev/null 2>&1 ; then
1875 echo "...using -n."
1876 n='-n'
1877 c=''
1878else
1879 cat <<'EOM'
1880...using \c
1881EOM
1882 n=''
1883 c='\c'
1884fi
1885echo $n "The star should be here-->$c"
1886echo '*'
1887rm -f .echotmp
1888
1889: Now test for existence of everything in MANIFEST
1890echo " "
6904989c 1891if test -f "$rsrc/MANIFEST"; then
2304df62 1892 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1893 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1894 rm -f missing
dfe9444c 1895 tmppwd=`pwd`
2304df62 1896 for filelist in x??; do
6904989c 1897 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1898 done
1899 if test -s missing; then
1900 cat missing >&4
1901 cat >&4 <<'EOM'
1902
1903THIS PACKAGE SEEMS TO BE INCOMPLETE.
1904
1905You have the option of continuing the configuration process, despite the
1906distinct possibility that your kit is damaged, by typing 'y'es. If you
1907do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1908and contact the author (perlbug@perl.org).
2304df62
AD
1909
1910EOM
1911 echo $n "Continue? [n] $c" >&4
1912 read ans
1913 case "$ans" in
1914 y*)
1915 echo "Continuing..." >&4
1916 rm -f missing
1917 ;;
1918 *)
1919 echo "ABORTING..." >&4
1920 kill $$
1921 ;;
1922 esac
1923 else
dfe9444c 1924 echo "Looks good..."
2304df62
AD
1925 fi
1926else
1927 echo "There is no MANIFEST file. I hope your kit is complete !"
1928fi
1929rm -f missing x??
1930
5ff3f7a4
GS
1931echo " "
1932: Find the appropriate value for a newline for tr
1933if test -n "$DJGPP"; then
1934 trnl='\012'
1935fi
1936if test X"$trnl" = X; then
1937 case "`echo foo|tr '\n' x 2>/dev/null`" in
1938 foox) trnl='\n' ;;
1939 esac
1940fi
1941if test X"$trnl" = X; then
1942 case "`echo foo|tr '\012' x 2>/dev/null`" in
1943 foox) trnl='\012' ;;
1944 esac
1945fi
1946if test X"$trnl" = X; then
8be2c24c
JH
1947 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1948 fooxy) trnl='\n\r' ;;
1949 esac
1950fi
1951if test X"$trnl" = X; then
5ff3f7a4
GS
1952 cat <<EOM >&2
1953
1954$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1955
1956EOM
1957 exit 1
1958fi
1959
2304df62
AD
1960: compute the number of columns on the terminal for proper question formatting
1961case "$COLUMNS" in
1962'') COLUMNS='80';;
1963esac
1964
1965: set up the echo used in my read
1966myecho="case \"\$xxxm\" in
1967'') echo $n \"\$rp $c\" >&4;;
1968*) case \"\$rp\" in
1969 '') echo $n \"[\$xxxm] $c\";;
1970 *)
1971 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1972 echo \"\$rp\" >&4
1973 echo $n \"[\$xxxm] $c\" >&4
1974 else
1975 echo $n \"\$rp [\$xxxm] $c\" >&4
1976 fi
1977 ;;
1978 esac;;
1979esac"
1980
1981: now set up to do reads with possible shell escape and default assignment
1982cat <<EOSC >myread
28757baa 1983$startsh
2304df62
AD
1984xxxm=\$dflt
1985$myecho
1986ans='!'
1987case "\$fastread" in
1988yes) case "\$dflt" in
1989 '') ;;
1990 *) ans='';
1991 case "\$silent-\$rp" in
1992 true-) ;;
1993 *) echo " " >&4;;
1994 esac;;
1995 esac;;
1996*) case "\$silent" in
1997 true) case "\$rp" in
1998 '') ans='';;
1999 esac;;
2000 esac;;
2001esac
2002while expr "X\$ans" : "X!" >/dev/null; do
2003 read answ
2004 set x \$xxxm
2005 shift
dfe9444c 2006 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2007 case "\$answ" in
dfe9444c
AD
2008 "!")
2009 sh 1>&4
2010 echo " "
2011 $myecho
2012 ;;
2013 !*)
2014 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2015 shift
2016 sh 1>&4 -c "\$*"
2017 echo " "
2018 $myecho
2019 ;;
2304df62
AD
2020 "\$ans")
2021 case "\$ans" in
ecfc5424
AD
2022 \\&*)
2023 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2024 shift
2025 case "\$1" in
2026 -d)
2027 fastread=yes
40a7a20a 2028 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2029 ;;
2030 -*)
40a7a20a 2031 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2032 ;;
2033 esac
2034 $myecho
2035 ans=!
2036 ;;
2304df62
AD
2037 esac;;
2038 *)
2039 case "\$aok" in
2040 y)
2041 echo "*** Substitution done -- please confirm."
2042 xxxm="\$ans"
c9795ab7 2043 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2044 xxxm="\$ans"
2045 ans=!
2046 ;;
2047 *)
2048 echo "*** Error -- try again."
2049 ans=!
2050 ;;
2051 esac
2052 $myecho
2053 ;;
2054 esac
2055 case "\$ans\$xxxm\$nostick" in
2056 '')
2057 ans=!
2058 $myecho
2059 ;;
2060 esac
2061done
2062case "\$ans" in
2063'') ans="\$xxxm";;
2064esac
2065EOSC
2066
2067: create .config dir to save info across Configure sessions
2068test -d ../.config || mkdir ../.config
2069cat >../.config/README <<EOF
2070This directory created by Configure to save information that should
dfe9444c 2071persist across sessions for $package.
2304df62
AD
2072
2073You may safely delete it if you wish.
2074EOF
2075
9507cadf 2076xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2077case "$usedevel" in
0107c034 2078$define|true|[yY]*) ;;
9507cadf 2079*) case "$xversion" in
0107c034
JH
2080 *[13579])
2081 cat >&4 <<EOH
2082*** WHOA THERE!!! ***
2083
2084 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2085 The version of this $package distribution is $xversion, that is, odd,
2086 (as opposed to even) and that signifies a development release.
3d5d58b1 2087 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2088
2089 Do ***NOT*** install this into production use.
2090 Data corruption and crashes are possible.
2091
2092 It is most seriously suggested that you do not continue any further
2093 unless you want to help in developing and debugging Perl.
2094
6adc6a45
JH
2095 If you *still* want to build perl, you can answer 'y' now,
2096 or pass -Dusedevel to Configure.
2097
0107c034
JH
2098EOH
2099 rp='Do you really want to continue?'
2100 dflt='n'
2101 . ./myread
2102 case "$ans" in
8feeef0e
JH
2103 [yY]) echo >&4 "Okay, continuing."
2104 usedevel="$define" ;;
0107c034
JH
2105 *) echo >&4 "Okay, bye."
2106 exit 1
2107 ;;
2108 esac
2109 ;;
2110 esac
2111 ;;
2112esac
8feeef0e
JH
2113case "$usedevel" in
2114$define|true|[yY]*)
2115 case "$versiononly" in
2116 '') versiononly="$define" ;;
2117 esac
2118 case "$installusrbinperl" in
2119 '') installusrbinperl="$undef" ;;
2120 esac
2121 ;;
2122esac
0107c034 2123
2304df62
AD
2124: general instructions
2125needman=true
2126firsttime=true
760ac839 2127user=`(logname) 2>/dev/null`
dfe9444c
AD
2128case "$user" in
2129'') user=`whoami 2>&1`;;
760ac839 2130esac
2304df62
AD
2131if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2132 firsttime=false
2133 echo " "
2134 rp='Would you like to see the instructions?'
2135 dflt=n
2136 . ./myread
2137 case "$ans" in
2138 [yY]*) ;;
2139 *) needman=false;;
2140 esac
2141fi
2142if $needman; then
2143 cat <<EOH
4e2a5f63 2144
2304df62 2145This installation shell script will examine your system and ask you questions
a0d0e21e 2146to determine how the perl5 package should be installed. If you get
2304df62
AD
2147stuck on a question, you may use a ! shell escape to start a subshell or
2148execute a command. Many of the questions will have default answers in square
2149brackets; typing carriage return will give you the default.
2150
2151On some of the questions which ask for file or directory names you are allowed
2152to use the ~name construct to specify the login directory belonging to "name",
2153even if you don't have a shell which knows about that. Questions where this is
2154allowed will be marked "(~name ok)".
2155
2156EOH
2157 rp=''
2158 dflt='Type carriage return to continue'
2159 . ./myread
2160 cat <<'EOH'
2161
2162The prompter used in this script allows you to use shell variables and
2163backticks in your answers. You may use $1, $2, etc... to refer to the words
2164in the default answer, as if the default line was a set of arguments given to a
2165script shell. This means you may also use $* to repeat the whole default line,
2166so you do not have to re-type everything to add something to the default.
2167
2168Everytime there is a substitution, you will have to confirm. If there is an
2169error (e.g. an unmatched backtick), the default answer will remain unchanged
2170and you will be prompted again.
2171
2172If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2173the questions and use the computed defaults (or the previous answers if there
2174was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2175You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2176on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2177
2178EOH
2179 . ./myread
2180 cat <<EOH
2181
2182Much effort has been expended to ensure that this shell script will run on any
2183Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2184Configure and run it again. If you can't run Configure for some reason,
2185you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2186have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2187
2188This installation script affects things in two ways:
2189
21901) it may do direct variable substitutions on some of the files included
2191 in this kit.
21922) it builds a config.h file for inclusion in C programs. You may edit
2193 any of these files as the need arises after running this script.
2194
2195If you make a mistake on a question, there is no easy way to back up to it
2196currently. The easiest thing to do is to edit config.sh and rerun all the SH
2197files. Configure will offer to let you do this before it runs the SH files.
2198
2199EOH
2200 dflt='Type carriage return to continue'
2201 . ./myread
2202 case "$firsttime" in
2203 true) echo $user >>../.config/instruct;;
2204 esac
2205fi
2206
2304df62
AD
2207: find out where common programs are
2208echo " "
2209echo "Locating common programs..." >&4
2210cat <<EOSC >loc
2211$startsh
2212case \$# in
22130) exit 1;;
2214esac
2215thing=\$1
2216shift
2217dflt=\$1
2218shift
2219for dir in \$*; do
2220 case "\$thing" in
2221 .)
2222 if test -d \$dir/\$thing; then
2223 echo \$dir
2224 exit 0
2225 fi
2226 ;;
2227 *)
a0d0e21e 2228 for thisthing in \$dir/\$thing; do
ecfc5424 2229 : just loop through to pick last item
a0d0e21e 2230 done
25f94b33 2231 if test -f \$thisthing; then
a0d0e21e 2232 echo \$thisthing
2304df62 2233 exit 0
a5a94ea5
JH
2234 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2235 echo \$thisthing
2236 exit 0
2304df62 2237 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2238 if test -n "$DJGPP"; then
2239 echo \$dir/\$thing.exe
b921d661 2240 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2241 : on Eunice apparently
2242 echo \$dir/\$thing
b921d661 2243 exit 0
c4f23d77 2244 fi
2d736872 2245 exit 0
2304df62
AD
2246 fi
2247 ;;
2248 esac
2249done
2250echo \$dflt
2251exit 1
2252EOSC
2253chmod +x loc
2254$eunicefix loc
2255loclist="
2256awk
2257cat
f8006fac 2258chmod
b4eb6b3d
JH
2259comm
2260cp
2304df62
AD
2261echo
2262expr
2263grep
a0d0e21e 2264ls
b4eb6b3d 2265mkdir
2304df62
AD
2266rm
2267sed
b4eb6b3d 2268sort
85e6fe83 2269touch
2304df62 2270tr
b4eb6b3d 2271uniq
2304df62
AD
2272"
2273trylist="
2274Mcc
dfe9444c 2275ar
3659ebf1 2276bison
b4eb6b3d 2277byacc
2304df62 2278cpp
b4eb6b3d 2279csh
2304df62
AD
2280date
2281egrep
1fef16b3 2282gmake
8ff267be 2283gzip
b4eb6b3d 2284less
8ff267be 2285ln
3c728e00 2286make
b4eb6b3d 2287more
693762b4 2288nm
b4eb6b3d
JH
2289nroff
2290pg
2304df62
AD
2291test
2292uname
8ff267be 2293zip
2304df62 2294"
8e07c86e 2295pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2296pth="$pth /lib /usr/lib"
2297for file in $loclist; do
dfe9444c
AD
2298 eval xxx=\$$file
2299 case "$xxx" in
2300 /*|?:[\\/]*)
2301 if test -f "$xxx"; then
2302 : ok
2303 else
2304 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2305 xxx=`./loc $file $file $pth`
2306 fi
2307 ;;
2308 '') xxx=`./loc $file $file $pth`;;
2309 *) xxx=`./loc $xxx $xxx $pth`;;
2310 esac
a5a94ea5 2311 eval $file=$xxx$_exe
2304df62
AD
2312 eval _$file=$xxx
2313 case "$xxx" in
2314 /*)
2315 echo $file is in $xxx.
2316 ;;
8e07c86e
AD
2317 ?:[\\/]*)
2318 echo $file is in $xxx.
2319 ;;
2304df62 2320 *)
25f94b33
AD
2321 echo "I don't know where '$file' is, and my life depends on it." >&4
2322 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2323 exit 1
2304df62
AD
2324 ;;
2325 esac
2326done
2327echo " "
2328echo "Don't worry if any of the following aren't found..."
2329say=offhand
2330for file in $trylist; do
dfe9444c
AD
2331 eval xxx=\$$file
2332 case "$xxx" in
2333 /*|?:[\\/]*)
2334 if test -f "$xxx"; then
2335 : ok
2336 else
2337 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2338 xxx=`./loc $file $file $pth`
2339 fi
2340 ;;
2341 '') xxx=`./loc $file $file $pth`;;
2342 *) xxx=`./loc $xxx $xxx $pth`;;
2343 esac
306a8474 2344 eval $file=$xxx$_exe
2304df62
AD
2345 eval _$file=$xxx
2346 case "$xxx" in
2347 /*)
2348 echo $file is in $xxx.
2349 ;;
8e07c86e
AD
2350 ?:[\\/]*)
2351 echo $file is in $xxx.
2352 ;;
2304df62
AD
2353 *)
2354 echo "I don't see $file out there, $say."
2355 say=either
2356 ;;
2357 esac
2358done
2359case "$egrep" in
1fef16b3 2360egrep)
2304df62
AD
2361 echo "Substituting grep for egrep."
2362 egrep=$grep
868439a2 2363 _egrep=$grep
2304df62
AD
2364 ;;
2365esac
8ff267be 2366case "$ln" in
1fef16b3 2367ln)
8ff267be 2368 echo "Substituting cp for ln."
2369 ln=$cp
868439a2 2370 _ln=$cp
8ff267be 2371 ;;
2372esac
2e26f1d5
JH
2373case "$make" in
2374make)
2375 case "$gmake" in
2376 gmake)
2377 echo "I can't find make or gmake, and my life depends on it." >&4
2378 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2379 exit 1
2380 ;;
2381 esac
2382 ;;
2383esac
2384case "$gmake" in
2385gmake) ;;
2386*) # We can't have osname yet.
1fef16b3
JH
2387 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2388 # Assume that gmake, if found, is definitely GNU make
2389 # and prefer it over the system make.
2390 echo "Substituting gmake for make."
2391 make=$gmake
868439a2 2392 _make=$gmake
1fef16b3
JH
2393 fi
2394 ;;
a5a94ea5 2395esac
2304df62
AD
2396case "$test" in
2397test)
2398 echo "Hopefully test is built into your sh."
2399 ;;
2400*)
73614538 2401 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2402 echo "Using the test built into your sh."
2304df62
AD
2403 test=test
2404 _test=test
2405 fi
2406 ;;
2407esac
2408case "$echo" in
2409echo)
2410 echo "Hopefully echo is built into your sh."
2411 ;;
2412'') ;;
2413*)
2414 echo " "
2415echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2416 $echo $n "hi there$c" >foo1
2417 echo $n "hi there$c" >foo2
2418 if cmp foo1 foo2 >/dev/null 2>&1; then
2419 echo "They are compatible. In fact, they may be identical."
2420 else
2421 case "$n" in
2422 '-n') n='' c='\c';;
2423 *) n='-n' c='';;
2424 esac
2425 cat <<FOO
2426They are not compatible! You are probably running ksh on a non-USG system.
2427I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2428have echo built in and we may have to run some Bourne shell scripts. That
2429means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2430
2431FOO
2432 $echo $n "The star should be here-->$c"
2433 $echo "*"
2434 fi
2435 $rm -f foo1 foo2
2436 ;;
2437esac
2438
6b769f8f 2439cat <<EOS >trygcc
2573c5f9
JH
2440$startsh
2441EOS
6b769f8f 2442cat <<'EOSC' >>trygcc
2573c5f9
JH
2443case "$cc" in
2444'') ;;
2445*) $rm -f try try.*
2446 $cat >try.c <<EOM
2447int main(int argc, char *argv[]) {
2448 return 0;
2449}
2450EOM
e4778687 2451 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2452 :
2453 else
2454 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2455 despair=yes
2456 trygcc=yes
2457 case "$cc" in
2458 *gcc*) trygcc=no ;;
2459 esac
2460 case "`$cc -v -c try.c 2>&1`" in
2461 *gcc*) trygcc=no ;;
2462 esac
2463 if $test X"$trygcc" = Xyes; then
2464 if gcc -o try -c try.c; then
2465 echo " "
2466 echo "You seem to have a working gcc, though." >&4
2467 rp="Would you like to use it?"
2468 dflt=y
2469 if $test -f myread; then
2470 . ./myread
2471 else
2472 if $test -f UU/myread; then
2473 . ./UU/myread
2474 else
2475 echo "Cannot find myread, sorry. Aborting." >&2
2476 exit 1
2477 fi
2478 fi
2479 case "$ans" in
6371411c
RB
2480 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2481 if $test -f usethreads.cbu; then
2482 $cat >&4 <<EOM
2483
2484*** However, any setting of the C compiler flags (e.g. for thread support)
2485*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2486*** (together with e.g. -Dusethreads).
2487
2488EOM
2489 fi;;
2573c5f9
JH
2490 esac
2491 fi
2492 fi
6b769f8f
RB
2493 fi
2494 $rm -f try try.*
2495 ;;
2496esac
2497EOSC
2498
2499cat <<EOS >checkcc
2500$startsh
2501EOS
2502cat <<'EOSC' >>checkcc
2503case "$cc" in
2504'') ;;
2505*) $rm -f try try.*
2506 $cat >try.c <<EOM
2507int main(int argc, char *argv[]) {
2508 return 0;
2509}
2510EOM
2511 if $cc -o try $ccflags $ldflags try.c; then
2512 :
2513 else
2573c5f9 2514 if $test X"$despair" = Xyes; then
6b769f8f
RB
2515 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516 fi
2517 $cat >&4 <<EOM
5dd4fbdf
MB
2518You need to find a working C compiler.
2519Either (purchase and) install the C compiler supplied by your OS vendor,
2520or for a free C compiler try http://gcc.gnu.org/
2521I cannot continue any further, aborting.
2522EOM
6b769f8f 2523 exit 1
2573c5f9
JH
2524 fi
2525 $rm -f try try.*
2526 ;;
2527esac
2528EOSC
2529
a0d0e21e
LW
2530: determine whether symbolic links are supported
2531echo " "
2532$touch blurfl
2533if $ln -s blurfl sym > /dev/null 2>&1 ; then
2534 echo "Symbolic links are supported." >&4
818f00be 2535 lns="$ln -s"
a0d0e21e
LW
2536else
2537 echo "Symbolic links are NOT supported." >&4
2538 lns="$ln"
2539fi
2540$rm -f blurfl sym
2541
dafca956
JH
2542: determine whether symbolic links are supported
2543echo " "
2544case "$lns" in
18ea2752 2545*"ln"*" -s")
dafca956
JH
2546 echo "Checking how to test for symbolic links..." >&4
2547 $lns blurfl sym
4b661809 2548 if $test "X$issymlink" = X; then
2e2a97a6
JH
2549 case "$newsh" in
2550 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2551 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2552 esac
5d644a95
MB
2553 if test $? = 0; then
2554 issymlink="test -h"
2e2a97a6
JH
2555 else
2556 echo "Your builtin 'test -h' may be broken." >&4
2557 case "$test" in
2558 /*) ;;
2559 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2560 for p in $pth
2561 do
2562 if test -f "$p/$test"; then
2563 test="$p/$test"
2564 break
2565 fi
2566 done
2567 ;;
2568 esac
2569 case "$test" in
2570 /*)
2571 echo "Trying external '$test -h'." >&4
2572 issymlink="$test -h"
2573 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2574 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2575 issymlink=''
2576 fi
2577 ;;
2578 *) issymlink='' ;;
2579 esac
5d644a95
MB
2580 fi
2581 fi
4b661809 2582 if $test "X$issymlink" = X; then
dafca956 2583 if $test -L sym 2>/dev/null; then
5d644a95 2584 issymlink="$test -L"
2e2a97a6 2585 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2586 fi
2587 fi
4b661809 2588 if $test "X$issymlink" != X; then
5d644a95 2589 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2590 else
2591 echo "I do not know how you can test for symbolic links." >&4
2592 fi
2593 $rm -f blurfl sym
2594 ;;
2595*) echo "No symbolic links, so not testing for their testing..." >&4
2596 ;;
2597esac
2598echo " "
2599
2600
2601case "$mksymlinks" in
2602$define|true|[yY]*)
2603 case "$src" in
2604 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2605 exit 1
2606 ;;
4b661809 2607 *) case "$lns:$issymlink" in
f314eb9f 2608 *"ln"*" -s:"*"test -"?)
dafca956
JH
2609 echo "Creating the symbolic links..." >&4
2610 echo "(First creating the subdirectories...)" >&4
2611 cd ..
2612 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2613 read directory
2614 test -z "$directory" && break
2615 mkdir -p $directory
2616 done
2617 # Sanity check 1.
2618 if test ! -d t/base; then
2619 echo "Failed to create the subdirectories. Aborting." >&4
2620 exit 1
2621 fi
2622 echo "(Then creating the symlinks...)" >&4
2623 awk '{print $1}' $src/MANIFEST | while true; do
2624 read filename
2625 test -z "$filename" && break
2626 if test -f $filename; then
5d644a95 2627 if $issymlink $filename; then
dafca956
JH
2628 rm -f $filename
2629 fi
2630 fi
2631 if test -f $filename; then
2632 echo "$filename already exists, not symlinking."
2633 else
2634 ln -s $src/$filename $filename
2635 fi
2636 done
2637 # Sanity check 2.
a0d24b8a
JH
2638 if test ! -f t/base/lex.t; then
2639 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2640 exit 1
2641 fi
2642 cd UU
2643 ;;
2644 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2645 ;;
2646 esac
2647 ;;
2648 esac
2649 ;;
2650esac
2651
5440bc8e
JH
2652
2653case "$usecrosscompile" in
2654$define|true|[yY]*)
93bc48fa 2655 $echo "Cross-compiling..."
5440bc8e
JH
2656 croak=''
2657 case "$cc" in
2658 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2659 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2660 ar=$targetarch-ar
2661 # leave out ld, choosing it is more complex
2662 nm=$targetarch-nm
2663 ranlib=$targetarch-ranlib
93bc48fa 2664 $echo 'extern int foo;' > try.c
f8006fac 2665 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2666 shift
2667 if $test $# -gt 0; then
2668 incpth="$incpth $*"
f8006fac
JH
2669 incpth="`$echo $incpth|$sed 's/^ //'`"
2670 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2671 for i in $*; do
f8006fac 2672 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2673 if $test -d $j; then
2674 libpth="$libpth $j"
2675 fi
2676 done
f8006fac
JH
2677 libpth="`$echo $libpth|$sed 's/^ //'`"
2678 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2679 fi
2680 $rm -f try.c
5440bc8e
JH
2681 ;;
2682 esac
2683 case "$targetarch" in
93bc48fa
JH
2684 '') echo "Targetarch not defined." >&4; croak=y ;;
2685 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2686 esac
2687 case "$incpth" in
93bc48fa 2688 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2689 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2690 esac
2691 case "$libpth" in
93bc48fa 2692 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2693 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2694 esac
93bc48fa
JH
2695 case "$usrinc" in
2696 '') for i in $incpth; do
2697 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2698 usrinc=$i
2699 echo "Guessing usrinc $usrinc." >&4
2700 break
2701 fi
2702 done
2703 case "$usrinc" in
2704 '') echo "Usrinc not defined." >&4; croak=y ;;
2705 esac
2706 ;;
2707 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2708 esac
93bc48fa
JH
2709 case "$targethost" in
2710 '') echo "Targethost not defined." >&4; croak=y ;;
2711 *) echo "Using targethost $targethost." >&4
5440bc8e 2712 esac
93bc48fa
JH
2713 locincpth=' '
2714 loclibpth=' '
5440bc8e 2715 case "$croak" in
93bc48fa 2716 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2717 esac
2718 case "$src" in
2719 /*) run=$src/Cross/run
93c0359c 2720 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2721 to=$src/Cross/to
2722 from=$src/Cross/from
2723 ;;
93bc48fa 2724 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2725 run=$pwd/Cross/run
f8006fac 2726 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2727 to=$pwd/Cross/to
2728 from=$pwd/Cross/from
2729 ;;
2730 esac
2731 case "$targetrun" in
2732 '') targetrun=ssh ;;
2733 esac
2734 case "$targetto" in
2735 '') targetto=scp ;;
2736 esac
2737 case "$targetfrom" in
2738 '') targetfrom=scp ;;
2739 esac
2740 run=$run-$targetrun
2741 to=$to-$targetto
2742 from=$from-$targetfrom
93bc48fa
JH
2743 case "$targetdir" in
2744 '') targetdir=/tmp
2745 echo "Guessing targetdir $targetdir." >&4
2746 ;;
2747 esac
5440bc8e 2748 case "$targetuser" in
93bc48fa
JH
2749 '') targetuser=root
2750 echo "Guessing targetuser $targetuser." >&4
2751 ;;
5440bc8e
JH
2752 esac
2753 case "$targetfrom" in
2754 scp) q=-q ;;
2755 *) q='' ;;
2756 esac
2757 case "$targetrun" in
2758 ssh|rsh)
2759 cat >$run <<EOF
2760#!/bin/sh
93c0359c
JH
2761case "\$1" in
2762-cwd)
2763 shift
2764 cwd=\$1
2765 shift
2766 ;;
2767esac
2768case "\$cwd" in
2769'') cwd=$targetdir ;;
2770esac
5440bc8e
JH
2771exe=\$1
2772shift
93c0359c
JH
2773if $test ! -f \$exe.xok; then
2774 $to \$exe
2775 $touch \$exe.xok
2776fi
2777$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2778EOF
2779 ;;
93bc48fa 2780 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2781 exit 1
2782 ;;
2783 esac
93c0359c
JH
2784 case "$targetmkdir" in
2785 */Cross/mkdir)
2786 cat >$targetmkdir <<EOF
2787#!/bin/sh
2788$targetrun -l $targetuser $targethost "mkdir -p \$@"
2789EOF
f8006fac 2790 $chmod a+rx $targetmkdir
93c0359c
JH
2791 ;;
2792 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2793 exit 1
2794 ;;
2795 esac
5440bc8e
JH
2796 case "$targetto" in
2797 scp|rcp)
2798 cat >$to <<EOF
2799#!/bin/sh
2800for f in \$@
2801do
93c0359c
JH
2802 case "\$f" in
2803 /*)
2804 $targetmkdir \`dirname \$f\`
2805 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2806 ;;
2807 *)
2808 $targetmkdir $targetdir/\`dirname \$f\`
2809 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2810 ;;
2811 esac
5440bc8e
JH
2812done
2813exit 0
2814EOF
2815 ;;
2816 cp) cat >$to <<EOF
2817#!/bin/sh
93c0359c
JH
2818for f in \$@
2819do
2820 case "\$f" in
2821 /*)
2822 $mkdir -p $targetdir/\`dirname \$f\`
2823 $cp \$f $targetdir/\$f || exit 1
2824 ;;
2825 *)
2826 $targetmkdir $targetdir/\`dirname \$f\`
2827 $cp \$f $targetdir/\$f || exit 1
2828 ;;
2829 esac
2830done
2831exit 0
5440bc8e
JH
2832EOF
2833 ;;
93bc48fa 2834 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2835 exit 1
2836 ;;
2837 esac
2838 case "$targetfrom" in
2839 scp|rcp)
2840 cat >$from <<EOF
2841#!/bin/sh
2842for f in \$@
2843do
93c0359c 2844 $rm -f \$f
5440bc8e
JH
2845 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2846done
2847exit 0
2848EOF
2849 ;;
2850 cp) cat >$from <<EOF
2851#!/bin/sh
2852for f in \$@
2853do
93c0359c 2854 $rm -f \$f
5440bc8e
JH
2855 cp $targetdir/\$f . || exit 1
2856done
2857exit 0
2858EOF
2859 ;;
93bc48fa 2860 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2861 exit 1
2862 ;;
2863 esac
93bc48fa
JH
2864 if $test ! -f $run; then
2865 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2866 else
f8006fac 2867 $chmod a+rx $run
5440bc8e 2868 fi
93bc48fa
JH
2869 if $test ! -f $to; then
2870 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2871 else
f8006fac 2872 $chmod a+rx $to
5440bc8e 2873 fi
93bc48fa
JH
2874 if $test ! -f $from; then
2875 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2876 else
f8006fac 2877 $chmod a+rx $from
5440bc8e 2878 fi
93bc48fa 2879 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2880 exit 1
2881 fi
2882 cat >&4 <<EOF
f8006fac
JH
2883Using '$run' for remote execution,
2884and '$from' and '$to'
93bc48fa 2885for remote file transfer.
5440bc8e
JH
2886EOF
2887 ;;
2888*) run=''
2889 to=:
2890 from=:
2891 usecrosscompile='undef'
2892 targetarch=''
2893 ;;
2894esac
2895
ecfc5424
AD
2896: see whether [:lower:] and [:upper:] are supported character classes
2897echo " "
ecfc5424
AD
2898case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2899ABYZ)
2900 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2901 up='[:upper:]'
2902 low='[:lower:]'
2903 ;;
416d0bea
MB
2904*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2905 # (0xd9 and 0xe2), therefore that is a nice testing point.
2906 if test "X$up" = X -o "X$low" = X; then
2907 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2908 rs) up='[A-Z]'
2909 low='[a-z]'
28e8609d
JH
2910 ;;
2911 esac
416d0bea 2912 fi
28e8609d 2913 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2914 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2915 rs) up='A-Z'
28e8609d
JH
2916 low='a-z'
2917 ;;
2918 esac
416d0bea 2919 fi
28e8609d 2920 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2921 case "`echo RS | od -x 2>/dev/null`" in
2922 *D9E2*|*d9e2*)
28e8609d
JH
2923 echo "Hey, this might be EBCDIC." >&4
2924 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2925 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2926 rs) up='[A-IJ-RS-Z]'
2927 low='[a-ij-rs-z]'
28e8609d
JH
2928 ;;
2929 esac
2930 fi
2931 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2932 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2933 rs) up='A-IJ-RS-Z'
2934 low='a-ij-rs-z'
28e8609d
JH
2935 ;;
2936 esac
2937 fi
2938 ;;
2939 esac
2940 fi
2941esac
416d0bea
MB
2942case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2943rs)
28e8609d
JH
2944 echo "Using $up and $low to convert case." >&4
2945 ;;
ecfc5424 2946*)
28e8609d
JH
2947 echo "I don't know how to translate letters from upper to lower case." >&4
2948 echo "Your tr is not acting any way I know of." >&4
2949 exit 1
2950 ;;
ecfc5424
AD
2951esac
2952: set up the translation script tr, must be called with ./tr of course
2953cat >tr <<EOSC
2954$startsh
2955case "\$1\$2" in
2956'[A-Z][a-z]') exec $tr '$up' '$low';;
2957'[a-z][A-Z]') exec $tr '$low' '$up';;
2958esac
2959exec $tr "\$@"
2960EOSC
2961chmod +x tr
2962$eunicefix tr
2963
2304df62
AD
2964: Try to determine whether config.sh was made on this system
2965case "$config_sh" in
2966'')
43999f95
JH
2967myuname=`$uname -a 2>/dev/null`
2968$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2969# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2970# because the A-Z/a-z are not consecutive.
a0d0e21e 2971myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2972 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2973newmyuname="$myuname"
2304df62 2974dflt=n
16d20bd9
AD
2975case "$knowitall" in
2976'')
2977 if test -f ../config.sh; then
2978 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2979 eval "`grep myuname= ../config.sh`"
2980 fi
2981 if test "X$myuname" = "X$newmyuname"; then
2982 dflt=y
2983 fi
2304df62 2984 fi
16d20bd9
AD
2985 ;;
2986*) dflt=y;;
2987esac
2304df62
AD
2988
2989: Get old answers from old config file if Configure was run on the
2990: same system, otherwise use the hints.
2991hint=default
2992cd ..
2993if test -f config.sh; then
16d20bd9
AD
2994 echo " "
2995 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2996 . UU/myread
2997 case "$ans" in
f83701cd
AD
2998 n*|N*) echo "OK, I'll ignore it."
2999 mv config.sh config.sh.old
3000 myuname="$newmyuname"
3001 ;;
2304df62 3002 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3003 tmp_n="$n"
3004 tmp_c="$c"
85cad39c 3005 tmp_sh="$sh"
2304df62
AD
3006 . ./config.sh
3007 cp config.sh UU
ecfc5424
AD
3008 n="$tmp_n"
3009 c="$tmp_c"
85cad39c 3010 : Older versions did not always set $sh. Catch re-use of such
3011 : an old config.sh.
3012 case "$sh" in
3013 '') sh="$tmp_sh" ;;
3014 esac
2304df62
AD
3015 hint=previous
3016 ;;
3017 esac
3018fi
2573c5f9 3019. ./UU/checkcc
2304df62
AD
3020if test ! -f config.sh; then
3021 $cat <<EOM
3022
4e2a5f63
AD
3023First time through, eh? I have some defaults handy for some systems
3024that need some extra help getting the Configure answers right:
2304df62
AD
3025
3026EOM
dfe9444c 3027 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3028 dflt=''
3029 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3030 : tests or hints, please send them to perlbug@perl.org
2304df62 3031 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3032 $test -f /irix && osname=irix
85e6fe83
LW
3033 $test -f /xenix && osname=sco_xenix
3034 $test -f /dynix && osname=dynix
3035 $test -f /dnix && osname=dnix
5f05dabc 3036 $test -f /lynx.os && osname=lynxos
3037 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3038 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3039 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3040 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3041 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3042 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3043 $test -d /usr/apollo/bin && osname=apollo
3044 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3045 $test -d /usr/include/minix && osname=minix
d54344fc 3046 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3047 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3048 osname=machten
4633a7c4 3049 if $test -x /sbin/version; then
dfe9444c 3050 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3051 $sed -e 's/[A-Za-z]$//'`
3052 elif $test -x /usr/etc/version; then
dfe9444c 3053 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3054 $sed -e 's/[A-Za-z]$//'`
3055 else
3056 osvers="$2.$3"
3057 fi
3058 fi
aaacdc8b
GS
3059
3060 $test -f /sys/posix.dll &&
3061 $test -f /usr/bin/what &&
3062 set X `/usr/bin/what /sys/posix.dll` &&
3063 $test "$3" = UWIN &&
3064 osname=uwin &&
3065 osvers="$5"
3066
2304df62
AD
3067 if $test -f $uname; then
3068 set X $myuname
3069 shift
3070
2304df62 3071 case "$5" in
85e6fe83 3072 fps*) osname=fps ;;
2304df62
AD
3073 mips*)
3074 case "$4" in
85e6fe83
LW
3075 umips) osname=umips ;;
3076 *) osname=mips ;;
2304df62 3077 esac;;
85e6fe83
LW
3078 [23]100) osname=mips ;;
3079 next*) osname=next ;;
ecfc5424 3080 i386*)
c6912327
JH
3081 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3082 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3083 osname='sco'
3084 osvers=$tmp
3085 elif $test -f /etc/kconfig; then
ecfc5424 3086 osname=isc
bd628c73 3087 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3088 osvers=4
3089 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3090 osvers=3
2304df62 3091 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3092 osvers=2
ecfc5424
AD
3093 fi
3094 fi
2000072c 3095 tmp=''
ecfc5424 3096 ;;
c4f23d77
AD
3097 pc*)
3098 if test -n "$DJGPP"; then
3099 osname=dos
3100 osvers=djgpp
3101 fi
3102 ;;
2304df62
AD
3103 esac
3104
3105 case "$1" in
a0d0e21e
LW
3106 aix) osname=aix
3107 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3108 case "$tmp" in
e81c5c2a
NC
3109 # oslevel can fail with:
3110 # oslevel: Unable to acquire lock.
3111 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3112 '<3240'|'<>3240') osvers=3.2.0 ;;
3113 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3114 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3115 *) osvers=$tmp;;
a0d0e21e
LW
3116 esac
3117 ;;
aaacdc8b
GS
3118 bsd386) osname=bsd386
3119 osvers=`$uname -r`
3120 ;;
3121 cygwin*) osname=cygwin
3122 osvers="$3"
3123 ;;
23f87696
SZ
3124 *dc.osx) osname=dcosx
3125 osvers="$3"
3126 ;;
a0d0e21e
LW
3127 dnix) osname=dnix
3128 osvers="$3"
3129 ;;
3130 domainos) osname=apollo
3131 osvers="$3"
3132 ;;
a774dfe6
RSG
3133 dgux) osname=dgux
3134 osvers="$3"
3135 ;;
3136 dragonfly) osname=dragonfly
a0d0e21e
LW
3137 osvers="$3"
3138 ;;
760ac839 3139 dynixptx*) osname=dynixptx
e58e581d 3140 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3141 ;;
a774dfe6 3142 freebsd) osname=freebsd
a0d0e21e 3143 osvers="$3" ;;
761ee4e8
BD
3144 genix) osname=genix ;;
3145 gnu) osname=gnu
3146 osvers="$3" ;;
a774dfe6 3147 hp*) osname=hpux
bfb7748a 3148 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3149 ;;
761ee4e8 3150 irix*) osname=irix
a0d0e21e
LW
3151 case "$3" in
3152 4*) osvers=4 ;;
3153 5*) osvers=5 ;;
ecfc5424 3154 *) osvers="$3" ;;
a0d0e21e
LW
3155 esac
3156 ;;
761ee4e8 3157 linux) osname=linux
a0d0e21e 3158 case "$3" in
a0d0e21e
LW
3159 *) osvers="$3" ;;
3160 esac
3161 ;;
761ee4e8 3162 MiNT) osname=mint
28e8609d
JH
3163 ;;
3164 netbsd*) osname=netbsd
ecfc5424
AD
3165 osvers="$3"
3166 ;;
4e81affe
MM
3167 news-os) osvers="$3"
3168 case "$3" in
3169 4*) osname=newsos4 ;;
3170 *) osname=newsos ;;
3171 esac
3172 ;;
aaacdc8b 3173 next*) osname=next ;;
28bb1e2c 3174 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3175 openbsd) osname=openbsd
3176 osvers="$3"
3177 ;;
5c728af0
IZ
3178 os2) osname=os2
3179 osvers="$4"
3180 ;;
aaacdc8b
GS
3181 POSIX-BC | posix-bc ) osname=posix-bc
3182 osvers="$3"
a0d0e21e 3183 ;;
ae3afa4e
TH
3184 powerux | power_ux | powermax_os | powermaxos | \
3185 powerunix | power_unix) osname=powerux
3186 osvers="$3"
3187 ;;
aaacdc8b
GS
3188 qnx) osname=qnx
3189 osvers="$4"
3190 ;;
a0d0e21e
LW
3191 solaris) osname=solaris
3192 case "$3" in
3193 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3194 *) osvers="$3" ;;
a0d0e21e
LW
3195 esac
3196 ;;
85e6fe83
LW
3197 sunos) osname=sunos
3198 case "$3" in
85e6fe83
LW
3199 5*) osname=solaris
3200 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3201 *) osvers="$3" ;;
2304df62
AD
3202 esac
3203 ;;
a0d0e21e 3204 titanos) osname=titanos
85e6fe83 3205 case "$3" in
a0d0e21e
LW
3206 1*) osvers=1 ;;
3207 2*) osvers=2 ;;
3208 3*) osvers=3 ;;
3209 4*) osvers=4 ;;
ecfc5424 3210 *) osvers="$3" ;;
2304df62
AD
3211 esac
3212 ;;
85e6fe83 3213 ultrix) osname=ultrix
ecfc5424 3214 osvers="$3"
2304df62 3215 ;;
28757baa 3216 osf1|mls+) case "$5" in
fed7345c
AD
3217 alpha)
3218 osname=dec_osf
fdd85a03 3219 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3220 case "$osvers" in
3221 [1-9].[0-9]*) ;;
3222 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3223 esac
ecfc5424
AD
3224 ;;
3225 hp*) osname=hp_osf1 ;;
3226 mips) osname=mips_osf1 ;;
85e6fe83
LW
3227 esac
3228 ;;
af1ff193 3229 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3230 openunix|unixware) osname=svr5
0337d152
BG
3231 osvers="$4"
3232 ;;
3c728e00 3233 uts) osname=uts
a0d0e21e
LW
3234 osvers="$3"
3235 ;;
3c728e00
JH
3236 vos) osvers="$3"
3237 ;;
85e6fe83 3238 $2) case "$osname" in
2304df62 3239 *isc*) ;;
a0d0e21e 3240 *freebsd*) ;;
5f05dabc 3241 svr*)
a0d0e21e 3242 : svr4.x or possibly later
a774dfe6 3243 case "svr$3" in
a0d0e21e
LW
3244 ${osname}*)
3245 osname=svr$3
3246 osvers=$4
3247 ;;
3248 esac
3249 case "$osname" in
3250 svr4.0)
3251 : Check for ESIX
3252 if test -f /stand/boot ; then
3253 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3254 if test -n "$INITPROG" -a -f "$INITPROG"; then
3255 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3256 if test -n "$isesix"; then
a0d0e21e
LW
3257 osname=esix4
3258 fi
3259 fi
3260 fi
3261 ;;
3262 esac
3263 ;;
2304df62 3264 *) if test -f /etc/systemid; then
a0d0e21e
LW
3265 osname=sco
3266 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3267 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3268 osvers=$1.$2.$3
c4f23d77 3269 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3270 osvers=$1.$2
c4f23d77 3271 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3272 osvers=$1
2304df62 3273 fi
a0d0e21e
LW
3274 else
3275 case "$osname" in
3276 '') : Still unknown. Probably a generic Sys V.
3277 osname="sysv"
3278 osvers="$3"
3279 ;;
3280 esac
2304df62
AD
3281 fi
3282 ;;
3283 esac
3284 ;;
a0d0e21e
LW
3285 *) case "$osname" in
3286 '') : Still unknown. Probably a generic BSD.
3287 osname="$1"
3288 osvers="$3"
3289 ;;
3290 esac
3291 ;;
2304df62
AD
3292 esac
3293 else
dfe9444c
AD
3294 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3295 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3296 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3297 osname=news_os
2304df62 3298 fi
dfe9444c 3299 $rm -f UU/kernel.what
5c728af0 3300 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3301 set X $myuname
3302 osname=os2
3303 osvers="$5"
2304df62
AD
3304 fi
3305 fi
a774dfe6 3306
5440bc8e
JH
3307 case "$targetarch" in
3308 '') ;;
3309 *) hostarch=$osname
3310 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3311 osvers=''
3312 ;;
3313 esac
3314
a0d0e21e
LW
3315 : Now look for a hint file osname_osvers, unless one has been
3316 : specified already.
3317 case "$hintfile" in
3318 ''|' ')
1e127011 3319 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3320 : Also try without trailing minor version numbers.
1e127011
DD
3321 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3322 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3323 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3324 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3325 case "$file" in
3326 '') dflt=none ;;
3327 *) case "$osvers" in
3328 '') dflt=$file
3329 ;;
dfe9444c 3330 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3331 dflt=$file
dfe9444c 3332 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3333 dflt=$xfile
dfe9444c 3334 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3335 dflt=$xxfile
dfe9444c 3336 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3337 dflt=$xxxfile
dfe9444c 3338 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3339 dflt=$xxxxfile
dfe9444c 3340 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3341 dflt="${osname}"
3342 else
3343 dflt=none
3344 fi
3345 ;;
3346 esac
85e6fe83
LW
3347 ;;
3348 esac
4e2a5f63
AD
3349 if $test -f Policy.sh ; then
3350 case "$dflt" in
3351 *Policy*) ;;
3352 none) dflt="Policy" ;;
3353 *) dflt="Policy $dflt" ;;
3354 esac
3355 fi
85e6fe83 3356 ;;
a0d0e21e 3357 *)
ecfc5424 3358 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3359 ;;
2304df62 3360 esac
1aef975c 3361
4e2a5f63
AD
3362 if $test -f Policy.sh ; then
3363 $cat <<EOM
3364
3365There's also a Policy hint file available, which should make the
3366site-specific (policy) questions easier to answer.
3367EOM
3368
3369 fi
3370
2304df62
AD
3371 $cat <<EOM
3372
3373You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3374A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3375is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3376
3377EOM
4e2a5f63 3378
2304df62 3379 rp="Which of these apply, if any?"
dfe9444c 3380 . UU/myread
85e6fe83
LW
3381 tans=$ans
3382 for file in $tans; do
4e2a5f63
AD
3383 if $test X$file = XPolicy -a -f Policy.sh; then
3384 . Policy.sh
3385 $cat Policy.sh >> UU/config.sh
3386 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3387 . $src/hints/$file.sh
3388 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3389 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3390 : nothing
3391 else
85e6fe83
LW
3392 : Give one chance to correct a possible typo.
3393 echo "$file.sh does not exist"
3394 dflt=$file
3395 rp="hint to use instead?"
dfe9444c 3396 . UU/myread
85e6fe83 3397 for file in $ans; do
dfe9444c
AD
3398 if $test -f "$src/hints/$file.sh"; then
3399 . $src/hints/$file.sh
3400 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3401 elif $test X$ans = X -o X$ans = Xnone ; then
3402 : nothing
3403 else
3404 echo "$file.sh does not exist -- ignored."
3405 fi
3406 done
2304df62
AD
3407 fi
3408 done
85e6fe83 3409
2304df62 3410 hint=recommended
85e6fe83 3411 : Remember our hint file for later.
dfe9444c 3412 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3413 hintfile="$file"
85e6fe83 3414 else
a0d0e21e 3415 hintfile=''
85e6fe83 3416 fi
2304df62
AD
3417fi
3418cd UU
3419;;
3420*)
3421 echo " "
3422 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3423 tmp_n="$n"
3424 tmp_c="$c"
2304df62
AD
3425 cd ..
3426 cp $config_sh config.sh 2>/dev/null
a78b0d02 3427 chmod +w config.sh
2304df62
AD
3428 . ./config.sh
3429 cd UU
3430 cp ../config.sh .
ecfc5424
AD
3431 n="$tmp_n"
3432 c="$tmp_c"
2304df62
AD
3433 hint=previous
3434 ;;
3435esac
1aef975c 3436test "$override" && . ./optdef.sh
2304df62
AD
3437
3438: Restore computed paths
3439for file in $loclist $trylist; do
3440 eval $file="\$_$file"
3441done
3442
85e6fe83 3443cat << EOM
a0d0e21e 3444
85e6fe83 3445Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3446The default value is probably right if the name rings a bell. Otherwise,
3447since spelling matters for me, either accept the default or answer "none"
3448to leave it blank.
a0d0e21e 3449
85e6fe83 3450EOM
85e6fe83 3451case "$osname" in
a0d0e21e 3452 ''|' ')
85e6fe83 3453 case "$hintfile" in
a0d0e21e 3454 ''|' '|none) dflt=none ;;
ecfc5424 3455 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3456 esac
3457 ;;
3458 *) dflt="$osname" ;;
3459esac
3460rp="Operating system name?"
3461. ./myread
3462case "$ans" in
ecfc5424
AD
3463none) osname='' ;;
3464*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3465esac
8ff267be 3466echo " "
3467case "$osvers" in
3468 ''|' ')
3469 case "$hintfile" in
3470 ''|' '|none) dflt=none ;;
3471 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3472 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3473 case "$dflt" in
3474 ''|' ') dflt=none ;;
3475 esac
3476 ;;
3477 esac
3478 ;;
3479 *) dflt="$osvers" ;;
3480esac
3481rp="Operating system version?"
3482. ./myread
3483case "$ans" in
3484none) osvers='' ;;
3485*) osvers="$ans" ;;
3486esac
3487
02e93a22
JH
3488
3489. ./posthint.sh
3490
2304df62 3491: who configured the system
59b83a6f 3492cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3493case "$cf_by" in
3494"")
7c04078e 3495 cf_by=`(logname) 2>/dev/null`
dfe9444c 3496 case "$cf_by" in
7c04078e
GA
3497 "")
3498 cf_by=`(whoami) 2>/dev/null`
3499 case "$cf_by" in
3500 "") cf_by=unknown ;;
3501 esac ;;
8ff267be 3502 esac ;;
3503esac
2304df62 3504
b4eb6b3d
JH
3505: set up the script used to warn in case of inconsistency
3506cat <<EOS >whoa
3507$startsh
3508EOS
3509cat <<'EOSC' >>whoa
3510dflt=y
3511echo " "
3512echo "*** WHOA THERE!!! ***" >&4
3513echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3514rp=" Keep the $hint value?"
3515. ./myread
3516case "$ans" in
3517y) td=$was; tu=$was;;
3518esac
3519EOSC
3520
3521: function used to set $1 to $val
3522setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3523case "$val$was" in
3524$define$undef) . ./whoa; eval "$var=\$td";;
3525$undef$define) . ./whoa; eval "$var=\$tu";;
3526*) eval "$var=$val";;
3527esac'
3528
b29b105d
JH
3529case "$usesocks" in
3530$define|true|[yY]*) dflt='y';;
3531*) dflt='n';;
3532esac
3533cat <<EOM
3534
3535Perl can be built to use the SOCKS proxy protocol library. To do so,
3536Configure must be run with -Dusesocks. If you use SOCKS you also need
3537to use the PerlIO abstraction layer, this will be implicitly selected.
3538
3539If this doesn't make any sense to you, just accept the default '$dflt'.
3540EOM
3541rp='Build Perl for SOCKS?'
3542. ./myread
3543case "$ans" in
3544y|Y) val="$define" ;;
3545*) val="$undef" ;;
3546esac
3547set usesocks
3548eval $setvar
3549
3550case "$usesocks" in
3551$define|true|[yY]*) useperlio="$define";;
3552esac
3553
3554case "$useperlio" in
3555$define|true|[yY]*|'') dflt='y';;
3556*) dflt='n';;
3557esac
3558cat <<EOM
3559
3560Previous version of $package used the standard IO mechanisms as
3561defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3562alternate IO mechanisms via the PerlIO abstraction layer, but the
3563stdio mechanism is still available if needed. The abstraction layer
3564can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3565Using PerlIO with sfio may cause problems with some extension modules.
3566
3567If this doesn't make any sense to you, just accept the default '$dflt'.
3568EOM
3569rp='Use the PerlIO abstraction layer?'
3570. ./myread
3571case "$ans" in
3572y|Y)
3573 val="$define"
3574 ;;
3575*)
3576 echo "Ok, doing things the stdio way."
3577 val="$undef"
3578 ;;
3579esac
3580set useperlio
3581eval $setvar
3582
3583case "$usesocks" in
3584$define|true|[yY]*)
3585 case "$useperlio" in
3586 $define|true|[yY]*) ;;
3587 *) cat >&4 <<EOM
3588
3589You are using the SOCKS proxy protocol library which means that you
3590should also use the PerlIO layer. You may be headed for trouble.
3591
3592EOM
3593 ;;
3594 esac
3595 ;;
3596esac
3597
3598
b4eb6b3d
JH
3599case "$usethreads" in
3600$define|true|[yY]*) dflt='y';;
8e285145
AD
3601*) # Catch case where user specified ithreads or 5005threads but
3602 # forgot -Dusethreads (A.D. 4/2002)
3603 case "$useithreads$use5005threads" in
b29b105d
JH
3604 *$define*)
3605 case "$useperlio" in
3606 "$define") dflt='y' ;;
3607 *) dflt='n' ;;
3608 esac
3609 ;;
3610 *) dflt='n';;
8e285145
AD
3611 esac
3612 ;;
b4eb6b3d
JH
3613esac
3614cat <<EOM
3615
3616Perl can be built to take advantage of threads on some systems.
3617To do so, Configure can be run with -Dusethreads.
3618
bfce6503
DM
3619Note that Perl built with threading support runs slightly slower
3620and uses more memory than plain Perl. The current implementation
3621is believed to be stable, but it is fairly new, and so should be
3622treated with caution.
b4eb6b3d
JH
3623
3624If this doesn't make any sense to you, just accept the default '$dflt'.
3625EOM
3626rp='Build a threading Perl?'
3627. ./myread
3628case "$ans" in
3629y|Y) val="$define" ;;
3630*) val="$undef" ;;
3631esac
3632set usethreads
3633eval $setvar
3634
3635case "$usethreads" in
3636$define)
3637 $cat <<EOM
3638
bfce6503
DM
3639Since release 5.6, Perl has had two different threading implementations,
3640the newer interpreter-based version (ithreads) with one interpreter per
3641thread, and the older 5.005 version (5005threads).
3642The 5005threads version is effectively unmaintained and will probably be
3643removed in Perl 5.10, so there should be no need to build a Perl using it
3644unless needed for backwards compatibility with some existing 5.005threads
3645code.
b4eb6b3d 3646
b4eb6b3d
JH
3647EOM
3648 : Default to ithreads unless overridden on command line or with
3649 : old config.sh
3650 dflt='y'
3651 case "$use5005threads" in
3652 $define|true|[yY]*) dflt='n';;
3653 esac
3654 case "$useithreads" in
3655 $undef|false|[nN]*) dflt='n';;
3656 esac
bfce6503 3657 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3658 . ./myread
3659 case "$ans" in
3660 y|Y) val="$define" ;;
3661 *) val="$undef" ;;
3662 esac
3663 set useithreads
3664 eval $setvar
3665 : Now set use5005threads to the opposite value.
3666 case "$useithreads" in
3667 $define) val="$undef" ;;
3668 *) val="$define" ;;
3669 esac
3670 set use5005threads
3671 eval $setvar
3672 ;;
3673*)
3674 useithreads="$undef"
3675 use5005threads="$undef"
3676 ;;
3677esac
3678
c915ce7f
JH
3679case "$useithreads$use5005threads" in
3680"$define$define")
3681 $cat >&4 <<EOM
3682
3683You cannot have both the ithreads and the 5.005 threads enabled
3684at the same time. Disabling the 5.005 threads since they are
3685much less stable than the ithreads.
3686
3687EOM
3688 use5005threads="$undef"
3689 ;;
3690esac
3691
b29b105d
JH
3692if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3693 cat >&4 <<EOF
3694***
3695*** To build with ithreads you must also use the PerlIO layer.
3696*** Cannot continue, aborting.
3697***
3698EOF
3699 exit 1
3700fi
3701
b4eb6b3d
JH
3702case "$d_oldpthreads" in
3703'') : Configure tests would be welcome here. For now, assume undef.
3704 val="$undef" ;;
3705*) val="$d_oldpthreads" ;;
3706esac
3707set d_oldpthreads
3708eval $setvar
3709
3710
b4eb6b3d
JH
3711: Look for a hint-file generated 'call-back-unit'. If the
3712: user has specified that a threading perl is to be built,
3713: we may need to set or change some other defaults.
9da7673b
MB
3714if $test -f usethreads.cbu; then
3715 echo "Your platform has some specific hints regarding threaded builds, using them..."
3716 . ./usethreads.cbu
3717else
3718 case "$usethreads" in
3719 "$define"|true|[yY]*)
b4eb6b3d 3720 $cat <<EOM
9da7673b 3721(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3722 Assuming POSIX threads, then.)
3723EOM
b4eb6b3d 3724 ;;
9da7673b
MB
3725 esac
3726fi
b4eb6b3d
JH
3727
3728cat <<EOM
3729
3730Perl can be built so that multiple Perl interpreters can coexist
3731within the same Perl executable.
3732EOM
3733
3734case "$useithreads" in
3735$define)
3736 cat <<EOM
3737This multiple interpreter support is required for interpreter-based threads.
3738EOM
3739 val="$define"
3740 ;;
3741*) case "$usemultiplicity" in
3742 $define|true|[yY]*) dflt='y';;
3743 *) dflt='n';;
3744 esac
3745 echo " "
3746 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3747 rp='Build Perl for multiplicity?'
3748 . ./myread
3749 case "$ans" in
3750 y|Y) val="$define" ;;
3751 *) val="$undef" ;;
3752 esac
3753 ;;
3754esac
3755set usemultiplicity
3756eval $setvar
3757
96056487
JH
3758
3759case "$usemorebits" in
3760"$define"|true|[yY]*)
3761 use64bitint="$define"
3762 uselongdouble="$define"
3763 usemorebits="$define"
3764 ;;
3765*) usemorebits="$undef"
3766 ;;
3767esac
3768
e5e20432
JH
3769: make some quick guesses about what we are up against
3770echo " "
3771$echo $n "Hmm... $c"
3772echo exit 1 >bsd
3773echo exit 1 >usg
3774echo exit 1 >v7
3775echo exit 1 >osf1
3776echo exit 1 >eunice
3777echo exit 1 >xenix
3778echo exit 1 >venix
3779echo exit 1 >os2
3780d_bsd="$undef"
3781$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3782if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3783then
3784 echo "Looks kind of like an OSF/1 system, but we'll see..."
3785 echo exit 0 >osf1
381aa1ff 3786elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3787 xxx=`./loc addbib blurfl $pth`
3788 if $test -f $xxx; then
3789 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3790 echo exit 0 >bsd
3791 echo exit 0 >usg
3792 else
3793 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3794 echo "Looks kind of like an extended USG system, but we'll see..."
3795 else
3796 echo "Looks kind of like a USG system, but we'll see..."
3797 fi
3798 echo exit 0 >usg
3799 fi
3800elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3801 echo "Looks kind of like a BSD system, but we'll see..."
3802 d_bsd="$define"
3803 echo exit 0 >bsd
3804else
3805 echo "Looks kind of like a Version 7 system, but we'll see..."
3806 echo exit 0 >v7
3807fi
3808case "$eunicefix" in
3809*unixtovms*)
3810 $cat <<'EOI'
3811There is, however, a strange, musty smell in the air that reminds me of
3812something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3813EOI
3814 echo exit 0 >eunice
3815 d_eunice="$define"
3816: it so happens the Eunice I know will not run shell scripts in Unix format
3817 ;;
3818*)
3819 echo " "
3820 echo "Congratulations. You aren't running Eunice."
3821 d_eunice="$undef"
3822 ;;
3823esac
3824: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3825: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3826: semicolon as a patch separator
e5e20432
JH
3827case "$p_" in
3828:) ;;
3829*)
3830 $cat <<'EOI'
3831I have the feeling something is not exactly right, however...don't tell me...
3832lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3833(Or you may be running DOS with DJGPP.)
e5e20432
JH
3834EOI
3835 echo exit 0 >os2
3836 ;;
3837esac
3838if test -f /xenix; then
3839 echo "Actually, this looks more like a XENIX system..."
3840 echo exit 0 >xenix
3841 d_xenix="$define"
3842else
3843 echo " "
3844 echo "It's not Xenix..."
3845 d_xenix="$undef"
3846fi
3847chmod +x xenix
3848$eunicefix xenix
3849if test -f /venix; then
3850 echo "Actually, this looks more like a VENIX system..."
3851 echo exit 0 >venix
3852else
3853 echo " "
3854 if ./xenix; then
3855 : null
3856 else
3857 echo "Nor is it Venix..."
3858 fi
3859fi
3860chmod +x bsd usg v7 osf1 eunice xenix venix os2
3861$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3862$rm -f foo
3863
5869b1f1
JH
3864case "$cc" in
3865'') dflt=cc;;
3866*) dflt="$cc";;
3867esac
3868rp="Use which C compiler?"
3869. ./myread
3870cc="$ans"
6b769f8f
RB
3871
3872: See if they have not cc but they do have gcc
3873. ./trygcc
e5e20432
JH
3874: Look for a hint-file generated 'call-back-unit'. Now that the
3875: user has specified the compiler, we may need to set or change some
3876: other defaults.
3877if $test -f cc.cbu; then
3878 . ./cc.cbu
3879fi
2573c5f9 3880. ./checkcc
8a27cf78 3881
e5e20432
JH
3882echo " "
3883echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3884$cat >try.c <<EOM
e5e20432
JH
3885#include <stdio.h>
3886int main() {
3887#ifdef __GNUC__
3888#ifdef __VERSION__
3889 printf("%s\n", __VERSION__);
3890#else
3891 printf("%s\n", "1");
3892#endif
3893#endif
073b6de5 3894 return(0);
e5e20432
JH
3895}
3896EOM
5440bc8e
JH
3897if $cc -o try $ccflags $ldflags try.c; then
3898 gccversion=`$run ./try`
e5e20432
JH
3899 case "$gccversion" in
3900 '') echo "You are not using GNU cc." ;;
fc68435e 3901 *) echo "You are using GNU cc $gccversion."
48fe685d 3902 ccname=gcc
fc68435e 3903 ;;
e5e20432
JH
3904 esac
3905else
3906 echo " "
3907 echo "*** WHOA THERE!!! ***" >&4
3908 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3909 case "$knowitall" in
3910 '')
3911 echo " You'd better start hunting for one and let me know about it." >&4
3912 exit 1
3913 ;;
3914 esac
3915fi
5440bc8e 3916$rm -f try try.*
e5e20432
JH
3917case "$gccversion" in
39181*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3919esac
5b463ca7
KS
3920case "$gccversion" in
3921'') gccosandvers='' ;;
10b4ebb5
JH
3922*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3923 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3924 gccshortvers=''
5b463ca7 3925 case "$gccosandvers" in
02903077
JH
3926 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3927 $osname$osvers) ;; # looking good
5b463ca7
KS
3928 $osname*) cat <<EOM >&4
3929
3930*** WHOA THERE!!! ***
3931
3932 Your gcc has not been compiled for the exact release of
3933 your operating system ($gccosandvers versus $osname$osvers).
3934
3935 In general it is a good idea to keep gcc synchronized with
3936 the operating system because otherwise serious problems
3937 may ensue when trying to compile software, like Perl.
3938
3939 I'm trying to be optimistic here, though, and will continue.
3940 If later during the configuration and build icky compilation
02903077
JH
3941 problems appear (headerfile conflicts being the most common
3942 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3943 your operating system release.
3944
3945EOM
3946 ;;
81575342 3947 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3948 esac
3949 ;;
3950esac
e723fc21
JH
3951case "$ccname" in
3952'') ccname="$cc" ;;
3953esac
e5e20432 3954
224cb7cb 3955# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3956# so we will take those off from locincpth.
3957case "$gccversion" in
39583*)
3959 echo "main(){}">try.c
224cb7cb
JH
3960 for incdir in $locincpth; do
3961 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3962 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3963 if test "X$warn" != X; then
44b94491 3964 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3965 fi
76589481
JH
3966 done
3967 $rm -f try try.*
3968esac
640374d0 3969
bd9b35c9
JH
3970: decide how portable to be. Allow command line overrides.
3971case "$d_portable" in
3972"$undef") ;;
3973*) d_portable="$define" ;;
104d25b7 3974esac
85ab1d1d 3975
bd9b35c9
JH
3976: set up shell script to do ~ expansion
3977cat >filexp <<EOSS
3978$startsh
3979: expand filename
3980case "\$1" in
3981 ~/*|~)
3982 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3983 ;;
3984 ~*)
3985 if $test -f /bin/csh; then
3986 /bin/csh -f -c "glob \$1"
3987 failed=\$?
3988 echo ""
3989 exit \$failed
e5e20432 3990 else
bd9b35c9
JH
3991 name=\`$expr x\$1 : '..\([^/]*\)'\`
3992 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3993 if $test ! -d "\$dir"; then
3994 me=\`basename \$0\`
3995 echo "\$me: can't locate home directory for: \$name" >&2
3996 exit 1
3997 fi
3998 case "\$1" in
3999 */*)
4000 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4001 ;;
4002 *)
4003 echo \$dir
e5e20432
JH
4004 ;;
4005 esac
4006 fi
b691c02f 4007 ;;
4633a7c4 4008*)
bd9b35c9 4009 echo \$1
2304df62
AD
4010 ;;
4011esac
4633a7c4
LW
4012EOSS
4013chmod +x filexp
4014$eunicefix filexp
2304df62
AD
4015
4016: now set up to get a file name
28757baa 4017cat <<EOS >getfile
4018$startsh
4019EOS
4020cat <<'EOSC' >>getfile
2304df62
AD
4021tilde=''
4022fullpath=''
4023already=''
4024skip=''
4025none_ok=''
4026exp_file=''
a0d0e21e 4027nopath_ok=''
2304df62
AD
4028orig_rp="$rp"
4029orig_dflt="$dflt"
b233458b
JH
4030case "$gfpth" in
4031'') gfpth='.' ;;
4032esac
2304df62
AD
4033
4034case "$fn" in
ecfc5424 4035*\(*)
d604bb53
JH
4036 : getfile will accept an answer from the comma-separated list
4037 : enclosed in parentheses even if it does not meet other criteria.
4038 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4039 fn=`echo $fn | sed 's/(.*)//'`
4040 ;;
4041esac
4042
4043case "$fn" in
a0d0e21e
LW
4044*:*)
4045 loc_file=`expr $fn : '.*:\(.*\)'`
4046 fn=`expr $fn : '\(.*\):.*'`
4047 ;;
4048esac
4049
4050case "$fn" in
2304df62
AD
4051*~*) tilde=true;;
4052esac
4053case "$fn" in
4054*/*) fullpath=true;;
4055esac
4056case "$fn" in
4057*+*) skip=true;;
4058esac
4059case "$fn" in
4060*n*) none_ok=true;;
4061esac
4062case "$fn" in
4063*e*) exp_file=true;;
4064esac
a0d0e21e
LW
4065case "$fn" in
4066*p*) nopath_ok=true;;
4067esac
2304df62
AD
4068
4069case "$fn" in
4070*f*) type='File';;
4071*d*) type='Directory';;
a0d0e21e 4072*l*) type='Locate';;
2304df62
AD
4073esac
4074
4075what="$type"
4076case "$what" in
4077Locate) what='File';;
4078esac
4079
4080case "$exp_file" in
4081'')
4082 case "$d_portable" in
4083 "$define") ;;
4084 *) exp_file=true;;
4085 esac
4086 ;;
4087esac
4088
4089cd ..
4090while test "$type"; do
4091 redo=''
4092 rp="$orig_rp"
4093 dflt="$orig_dflt"
4094 case "$tilde" in
4095 true) rp="$rp (~name ok)";;
4096 esac
4097 . UU/myread
ecfc5424
AD
4098 if test -f UU/getfile.ok && \
4099 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4100 then
4101 value="$ans"
4102 ansexp="$ans"
4103 break
4104 fi
2304df62
AD
4105 case "$ans" in
4106 none)
4107 value=''
4108 ansexp=''
4109 case "$none_ok" in
4110 true) type='';;
4111 esac
4112 ;;
4113 *)
4114 case "$tilde" in
4115 '') value="$ans"
4116 ansexp="$ans";;
4117 *)
4118 value=`UU/filexp $ans`
4119 case $? in
4120 0)
4121 if test "$ans" != "$value"; then
ecfc5424 4122 echo "(That expands to $value on this system.)"
2304df62
AD
4123 fi
4124 ;;
4125 *) value="$ans";;
4126 esac
4127 ansexp="$value"
4128 case "$exp_file" in
4129 '') value="$ans";;
4130 esac
4131 ;;
4132 esac
4133 case "$fullpath" in
4134 true)
4135 case "$ansexp" in
4136 /*) value="$ansexp" ;;
23da6c43 4137 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4138 *)
4139 redo=true
4140 case "$already" in
4141 true)
4142 echo "I shall only accept a full path name, as in /bin/ls." >&4
4143 echo "Use a ! shell escape if you wish to check pathnames." >&4
4144 ;;
4145 *)
4146 echo "Please give a full path name, starting with slash." >&4
4147 case "$tilde" in
4148 true)
4149 echo "Note that using ~name is ok provided it expands well." >&4
4150 already=true
4151 ;;
4152 esac
4153 esac
4154 ;;
4155 esac
4156 ;;
4157 esac
4158 case "$redo" in
4159 '')
4160 case "$type" in
4161 File)
b233458b
JH
4162 for fp in $gfpth; do
4163 if test "X$fp" = X.; then
4164 pf="$ansexp"
4165 else
4166 pf="$fp/$ansexp"
4167 fi
4168 if test -f "$pf"; then
4169 type=''
4170 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4171 then
4172 echo "($value is not a plain file, but that's ok.)"
4173 type=''
4174 fi
4175 if test X"$type" = X; then
4176 value="$pf"
4177 break
4178 fi
4179 done
2304df62
AD
4180 ;;
4181 Directory)
b233458b
JH
4182 for fp in $gfpth; do
4183 if test "X$fp" = X.; then
f78bfc9c
JH
4184 dir="$ans"
4185 direxp="$ansexp"
b233458b 4186 else
dd858076 4187 dir="$fp/$ansexp"
f78bfc9c 4188 direxp="$fp/$ansexp"
b233458b 4189 fi
f78bfc9c 4190 if test -d "$direxp"; then
b233458b 4191 type=''
f78bfc9c 4192 value="$dir"
b233458b
JH
4193 break
4194 fi
4195 done
2304df62
AD
4196 ;;
4197 Locate)
40000a8c 4198 if test -d "$ansexp"; then
a0d0e21e
LW
4199 echo "(Looking for $loc_file in directory $value.)"
4200 value="$value/$loc_file"
40000a8c 4201 ansexp="$ansexp/$loc_file"
2304df62 4202 fi
40000a8c 4203 if test -f "$ansexp"; then
2304df62
AD
4204 type=''
4205 fi
a0d0e21e
LW
4206 case "$nopath_ok" in
4207 true) case "$value" in
4208 */*) ;;
4209 *) echo "Assuming $value will be in people's path."
4210 type=''
4211 ;;
4212 esac
4213 ;;
4214 esac
2304df62
AD
4215 ;;
4216 esac
4217
4218 case "$skip" in
4219 true) type='';
4220 esac
4221
4222 case "$type" in
4223 '') ;;
4224 *)
4225 if test "$fastread" = yes; then
4226 dflt=y
4227 else
4228 dflt=n
4229 fi
4230 rp="$what $value doesn't exist. Use that name anyway?"
4231 . UU/myread
4232 dflt=''
4233 case "$ans" in
4234 y*) type='';;
4235 *) echo " ";;
4236 esac
4237 ;;
4238 esac
4239 ;;
4240 esac
4241 ;;
4242 esac
4243done
4244cd UU
4245ans="$value"
4246rp="$orig_rp"
4247dflt="$orig_dflt"
ecfc5424 4248rm -f getfile.ok
b233458b 4249test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4250EOSC
4251
bd9b35c9
JH
4252: What should the include directory be ?
4253echo " "
4254$echo $n "Hmm... $c"
4255dflt='/usr/include'
4256incpath=''
4257mips_type=''
4258if $test -f /bin/mips && /bin/mips; then
4259 echo "Looks like a MIPS system..."
4260 $cat >usr.c <<'EOCP'
4261#ifdef SYSTYPE_BSD43
4262/bsd43
4263#endif
4264EOCP
8a27cf78 4265 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4266 dflt='/bsd43/usr/include'
4267 incpath='/bsd43'
4268 mips_type='BSD 4.3'
4269 else
4270 mips_type='System V'
4271 fi
4272 $rm -f usr.c usr.out
4273 echo "and you're compiling with the $mips_type compiler and libraries."
4274 xxx_prompt=y
4275 echo "exit 0" >mips
4276else
4277 echo "Doesn't look like a MIPS system."
4278 xxx_prompt=n
4279 echo "exit 1" >mips
4280fi
4281chmod +x mips
4282$eunicefix mips
4283case "$usrinc" in
4284'') ;;
4285*) dflt="$usrinc";;
4286esac
4287case "$xxx_prompt" in
4288y) fn=d/
4289 echo " "
4290 rp='Where are the include files you want to use?'
4291 . ./getfile
4292 usrinc="$ans"
8e07c86e 4293 ;;
bd9b35c9 4294*) usrinc="$dflt"
8e07c86e
AD
4295 ;;
4296esac
2304df62 4297
96056487
JH
4298: see how we invoke the C preprocessor
4299echo " "
4300echo "Now, how can we feed standard input to your C preprocessor..." >&4
4301cat <<'EOT' >testcpp.c
4302#define ABC abc
4303#define XYZ xyz
4304ABC.XYZ
4305EOT
4306cd ..
4307if test ! -f cppstdin; then
4308 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4309 # AIX cc -E doesn't show the absolute headerfile
4310 # locations but we'll cheat by using the -M flag.
4311 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
4312 else
4313 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4314 fi
4315else
4316 echo "Keeping your $hint cppstdin wrapper."
4317fi
4318chmod 755 cppstdin
4319wrapper=`pwd`/cppstdin
4320ok='false'
4321cd UU
4322
4323if $test "X$cppstdin" != "X" && \
4324 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4325 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4326then
4327 echo "You used to use $cppstdin $cppminus so we'll use that again."
4328 case "$cpprun" in
4329 '') echo "But let's see if we can live without a wrapper..." ;;
4330 *)
4331 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4332 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4333 then
4334 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4335 ok='true'
4336 else
4337 echo "(However, $cpprun $cpplast does not work, let's see...)"
4338 fi
4339 ;;
4340 esac
4341else
4342 case "$cppstdin" in
4343 '') ;;
4344 *)
4345 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4346 ;;
4347 esac
4348fi
4349
4350if $ok; then
4351 : nothing
4352elif echo 'Maybe "'"$cc"' -E" will work...'; \
4353 $cc -E <testcpp.c >testcpp.out 2>&1; \
4354 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4355 echo "Yup, it does."
4356 x_cpp="$cc -E"
4357 x_minus='';
4358elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4359 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4360 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361 echo "Yup, it does."
4362 x_cpp="$cc -E"
4363 x_minus='-';
4364elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4365 $cc -P <testcpp.c >testcpp.out 2>&1; \
4366 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367 echo "Yipee, that works!"
4368 x_cpp="$cc -P"
4369 x_minus='';
4370elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4371 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4372 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373 echo "At long last!"
4374 x_cpp="$cc -P"
4375 x_minus='-';
4376elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4377 $cpp <testcpp.c >testcpp.out 2>&1; \
4378 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379 echo "It works!"
4380 x_cpp="$cpp"
4381 x_minus='';
4382elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4383 $cpp - <testcpp.c >testcpp.out 2>&1; \
4384 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385 echo "Hooray, it works! I was beginning to wonder."
4386 x_cpp="$cpp"
4387 x_minus='-';
4388elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4389 $wrapper <testcpp.c >testcpp.out 2>&1; \
4390 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391 x_cpp="$wrapper"
4392 x_minus=''
4393 echo "Eureka!"
4394else
4395 dflt=''
4396 rp="No dice. I can't find a C preprocessor. Name one:"
4397 . ./myread
4398 x_cpp="$ans"
4399 x_minus=''
4400 $x_cpp <testcpp.c >testcpp.out 2>&1
4401 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4402 echo "OK, that will do." >&4
4403 else
4404echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4405 exit 1
4406 fi
4407fi
4408
4409case "$ok" in
4410false)
4411 cppstdin="$x_cpp"
4412 cppminus="$x_minus"
4413 cpprun="$x_cpp"
4414 cpplast="$x_minus"
4415 set X $x_cpp
4416 shift
4417 case "$1" in
4418 "$cpp")
4419 echo "Perhaps can we force $cc -E using a wrapper..."
4420 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4421 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4422 then
4423 echo "Yup, we can."
4424 cppstdin="$wrapper"
4425 cppminus='';
4426 else
4427 echo "Nope, we'll have to live without it..."
4428 fi
4429 ;;
4430 esac
4431 case "$cpprun" in
4432 "$wrapper")
4433 cpprun=''
4434 cpplast=''
4435 ;;
4436 esac
4437 ;;
4438esac
4439
4440case "$cppstdin" in
4441"$wrapper"|'cppstdin') ;;
4442*) $rm -f $wrapper;;
4443esac
4444$rm -f testcpp.c testcpp.out
4445
bd9b35c9
JH
4446: Set private lib path
4447case "$plibpth" in
4448'') if ./mips; then
4449 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4450 fi;;
4451esac
4452case "$libpth" in
4453' ') dlist='';;
4454'') dlist="$loclibpth $plibpth $glibpth";;
4455*) dlist="$libpth";;
4456esac
4457
4458: Now check and see which directories actually exist, avoiding duplicates
4459libpth=''
4460for xxx in $dlist
4461do
4462 if $test -d $xxx; then
4463 case " $libpth " in
4464 *" $xxx "*) ;;
4465 *) libpth="$libpth $xxx";;
4466 esac
4467 fi
4468done
4469$cat <<'EOM'
4470
4471Some systems have incompatible or broken versions of libraries. Among
4472the directories listed in the question below, please remove any you
4473know not to be holding relevant libraries, and add any that are needed.
4474Say "none" for none.
8e07c86e
AD
4475
4476EOM
bd9b35c9
JH
4477case "$libpth" in
4478'') dflt='none';;
8e07c86e 4479*)
bd9b35c9
JH
4480 set X $libpth
4481 shift
4482 dflt=${1+"$@"}
8e07c86e 4483 ;;
a0d0e21e 4484esac
bd9b35c9
JH
4485rp="Directories to use for library searches?"
4486. ./myread
4487case "$ans" in
4488none) libpth=' ';;
4489*) libpth="$ans";;
4490esac
a0d0e21e 4491
bd9b35c9
JH
4492: compute shared library extension
4493case "$so" in
4494'')
4495 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4496 dflt='sl'
dd4e71fd 4497 else
bd9b35c9 4498 dflt='so'
dd4e71fd
JH
4499 fi
4500 ;;
bd9b35c9 4501*) dflt="$so";;
dd4e71fd 4502esac
dd4e71fd
JH
4503$cat <<EOM
4504
bd9b35c9 4505On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4506you want to suppress searching of shared libraries for the remainder
bd9b35c9 4507of this configuration.
dd4e71fd
JH
4508
4509EOM
bd9b35c9
JH
4510rp='What is the file extension used for shared libraries?'
4511. ./myread
4512so="$ans"
dd4e71fd 4513
bd9b35c9
JH
4514: Define several unixisms.
4515: Hints files or command line option can be used to override them.
4516: The convoluted testing is in case hints files set either the old
4517: or the new name.
4518case "$_exe" in
4519'') case "$exe_ext" in
1fef16b3 4520 '') ;;
bd9b35c9 4521 *) _exe="$exe_ext" ;;
dd4e71fd 4522 esac
bd9b35c9 4523 ;;
bfb7748a 4524esac
bd9b35c9
JH
4525case "$_a" in
4526'') case "$lib_ext" in
4527 '') _a='.a';;
4528 *) _a="$lib_ext" ;;
dd4e71fd
JH
4529 esac
4530 ;;
dd4e71fd 4531esac
bd9b35c9
JH
4532case "$_o" in
4533'') case "$obj_ext" in
4534 '') _o='.o';;
4535 *) _o="$obj_ext";;
4536 esac
4537 ;;
4538esac
4539case "$p_" in
4540'') case "$path_sep" in
4541 '') p_=':';;
4542 *) p_="$path_sep";;
4543 esac
4544 ;;
4545esac
4546exe_ext=$_exe
4547lib_ext=$_a
4548obj_ext=$_o
4549path_sep=$p_
dd4e71fd 4550
b4eb6b3d
JH
4551: Which makefile gets called first. This is used by make depend.
4552case "$firstmakefile" in
4553'') firstmakefile='makefile';;
4633a7c4 4554esac
4633a7c4 4555
1f603089
JH
4556case "$ccflags" in
4557*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4558esac
4559
4560case "$uselongdouble" in
4561$define|true|[yY]*) dflt='y';;
4562*) dflt='n';;
4563esac
4564cat <<EOM
4565
4566Perl can be built to take advantage of long doubles which
4567(if available) may give more accuracy and range for floating point numbers.
4568
4569If this doesn't make any sense to you, just accept the default '$dflt'.
4570EOM
4571rp='Try to use long doubles if available?'
4572. ./myread
4573case "$ans" in
4574y|Y) val="$define" ;;
4575*) val="$undef" ;;
4576esac
4577set uselongdouble
4578eval $setvar
4579
4580case "$uselongdouble" in
4581true|[yY]*) uselongdouble="$define" ;;
4582esac
4583
1f603089
JH
4584: Look for a hint-file generated 'call-back-unit'. If the
4585: user has specified that long doubles should be used,
4586: we may need to set or change some other defaults.
9da7673b
MB
4587if $test -f uselongdouble.cbu; then
4588 echo "Your platform has some specific hints regarding long doubles, using them..."
4589 . ./uselongdouble.cbu
4590else
4591 case "$uselongdouble" in
4592 $define)
1f603089 4593 $cat <<EOM
9da7673b 4594(Your platform does not have any specific hints for long doubles.)
1f603089 4595EOM
1f603089 4596 ;;
9da7673b
MB
4597 esac
4598fi
1f603089 4599
bd9b35c9
JH
4600: Looking for optional libraries
4601echo " "
4602echo "Checking for optional libraries..." >&4
4603case "$libs" in
4604' '|'') dflt='';;
4605*) dflt="$libs";;
4606esac
4607case "$libswanted" in
4608'') libswanted='c_s';;
4609esac
4610case "$usesocks" in
923fc586 4611"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4612esac
68435ea7
JH
4613libsfound=''
4614libsfiles=''
4615libsdirs=''
13b3f787
JH
4616libspath=''
4617for thisdir in $libpth $xlibpth; do
4618 test -d $thisdir && libspath="$libspath $thisdir"
4619done
bd9b35c9 4620for thislib in $libswanted; do
13b3f787 4621 for thisdir in $libspath; do
f7dd4e7f
JH
4622 xxx=''
4623 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4624 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4625 $test -f "$xxx" && eval $libscheck
4626 $test -f "$xxx" && libstyle=shared
4627 fi
4628 if test ! -f "$xxx"; then
4629 xxx=$thisdir/lib$thislib.$so
4630 $test -f "$xxx" && eval $libscheck
4631 $test -f "$xxx" && libstyle=shared
4632 fi
4633 if test ! -f "$xxx"; then
4634 xxx=$thisdir/lib$thislib$_a
4635 $test -f "$xxx" && eval $libscheck
4636 $test -f "$xxx" && libstyle=static
4637 fi
4638 if test ! -f "$xxx"; then
4639 xxx=$thisdir/$thislib$_a
4640 $test -f "$xxx" && eval $libscheck
4641 $test -f "$xxx" && libstyle=static
4642 fi
4643 if test ! -f "$xxx"; then
4644 xxx=$thisdir/lib${thislib}_s$_a
4645 $test -f "$xxx" && eval $libscheck
4646 $test -f "$xxx" && libstyle=static
09ea5ba9 4647 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4648 fi
4649 if test ! -f "$xxx"; then
4650 xxx=$thisdir/Slib$thislib$_a
4651 $test -f "$xxx" && eval $libscheck
4652 $test -f "$xxx" && libstyle=static
4653 fi
4654 if $test -f "$xxx"; then
43999f95 4655 case "$libstyle" in
f7dd4e7f
JH
4656 shared) echo "Found -l$thislib (shared)." ;;
4657 static) echo "Found -l$thislib." ;;
4658 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4659 esac
bd9b35c9
JH
4660 case " $dflt " in
4661 *"-l$thislib "*);;
f7dd4e7f 4662 *) dflt="$dflt -l$thislib"
43999f95
JH
4663 libsfound="$libsfound $xxx"
4664 yyy=`basename $xxx`
4665 libsfiles="$libsfiles $yyy"
1e127011 4666 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4667 case " $libsdirs " in
4668 *" $yyy "*) ;;
4669 *) libsdirs="$libsdirs $yyy" ;;
4670 esac
4671 ;;
bd9b35c9 4672 esac
f7dd4e7f
JH
4673 break
4674 fi
4675 done
4676 if $test ! -f "$xxx"; then
4677 echo "No -l$thislib."
bd9b35c9
JH
4678 fi
4679done
4680set X $dflt
4681shift
4682dflt="$*"
4683case "$libs" in
4684'') dflt="$dflt";;
4685*) dflt="$libs";;
4686esac
4687case "$dflt" in
4688' '|'') dflt='none';;
4689esac
4633a7c4 4690
bd9b35c9 4691$cat <<EOM
4633a7c4 4692
bd9b35c9
JH
4693In order to compile $package on your machine, a number of libraries
4694are usually needed. Include any other special libraries here as well.
4695Say "none" for none. The default list is almost always right.
8e07c86e 4696EOM
8e07c86e 4697
bd9b35c9
JH
4698echo " "
4699rp="What libraries to use?"
4700. ./myread
4701case "$ans" in
4702none) libs=' ';;
4703*) libs="$ans";;
4704esac
d71b2b6b 4705
bd9b35c9
JH
4706: determine optimization, if desired, or use for debug flag also
4707case "$optimize" in
4708' '|$undef) dflt='none';;
4709'') dflt='-O';;
4710*) dflt="$optimize";;
4711esac
4712$cat <<EOH
d71b2b6b 4713
bd9b35c9
JH
4714By default, $package compiles with the -O flag to use the optimizer.
4715Alternately, you might want to use the symbolic debugger, which uses
4716the -g flag (on traditional Unix systems). Either flag can be
4717specified here. To use neither flag, specify the word "none".
d71b2b6b 4718
bd9b35c9
JH
4719EOH
4720rp="What optimizer/debugger flag should be used?"
4721. ./myread
4722optimize="$ans"
4723case "$optimize" in
4724'none') optimize=" ";;
4725esac
4726
4727dflt=''
4728: We will not override a previous value, but we might want to
4729: augment a hint file
4730case "$hint" in
4731default|recommended)
4732 case "$gccversion" in
4733 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4734 esac
bd9b35c9
JH
4735 case "$optimize" in
4736 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4737 esac
bd9b35c9
JH
4738 case "$gccversion" in
4739 2*) if test -d /etc/conf/kconfig.d &&
4740 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4741 then
00e89ad4 4742 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4743 dflt="$dflt -posix"
4744 fi
f0d04425 4745 ;;
bd9b35c9
JH
4746 esac
4747 case "$gccversion" in
4748 1*) ;;
4749 2.[0-8]*) ;;
4750 ?*) echo " "
4751 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4752 echo 'int main(void) { return 0; }' > gcctest.c
4753 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4754 echo "Yes, it does." 2>&1
4755 case "$ccflags" in
00e89ad4 4756 *strict-aliasing*)
bd9b35c9
JH
4757 echo "Leaving current flags $ccflags alone." 2>&1
4758 ;;
4759 *) dflt="$dflt -fno-strict-aliasing" ;;
4760 esac
4761 else
4762 echo "Nope, it doesn't, but that's ok." 2>&1
4763 fi
f0d04425 4764 ;;
e5e20432 4765 esac
00e89ad4
AD
4766 # For gcc, adding -pipe speeds up compilations for some, but apparently
4767 # some assemblers can't read from stdin. (It also slows down compilations
4768 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4769 case "$gccversion" in
4770 ?*) echo " "
4771 echo "Checking if your compiler accepts -pipe" 2>&1
4772 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4773 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4774 echo "Yes, it does." 2>&1
4775 case "$ccflags" in
4776 *-pipe*)
4777 echo "Leaving current flags $ccflags alone." 2>&1
4778 ;;
4779 *) dflt="$dflt -pipe" ;;
4780 esac
4781 else
4782 echo "Nope, it doesn't, but that's ok." 2>&1
4783 fi
6347b5be
SP
4784
4785 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4786 echo 'int main(void) { return 0; }' > gcctest.c
4787 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4788 echo "Yes, it does." 2>&1
4789 case "$ccflags" in
4790 *-Wdeclaration-after-statement*)
4791 echo "Leaving current flags $ccflags alone." 2>&1
4792 ;;
4793 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4794 esac
4795 else
4796 echo "Nope, it doesn't, but that's ok." 2>&1
4797 fi
00e89ad4
AD
4798 ;;
4799 esac
e5e20432
JH
4800 ;;
4801esac
4802
bd9b35c9
JH
4803case "$mips_type" in
4804*BSD*|'') inclwanted="$locincpth $usrinc";;
4805*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4806esac
4807for thisincl in $inclwanted; do
4808 if $test -d $thisincl; then
4809 if $test x$thisincl != x$usrinc; then
4810 case "$dflt" in
00e89ad4
AD
4811 *" -I$thisincl "*);;
4812 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4813 esac
4814 fi
4815 fi
4816done
40a7a20a 4817
bd9b35c9
JH
4818inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4819 xxx=true;
4820elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4821 xxx=true;
4822else
4823 xxx=false;
4824fi;
4825if $xxx; then
4826 case "$dflt" in
4827 *$2*);;
4828 *) dflt="$dflt -D$2";;
4829 esac;
4830fi'
40a7a20a 4831
bd9b35c9 4832set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4833
bd9b35c9
JH
4834case "$usesocks" in
4835$define)
4836 ccflags="$ccflags -DSOCKS"
4837 ;;
4838esac
40a7a20a 4839
bd9b35c9
JH
4840case "$hint" in
4841default|recommended) dflt="$ccflags $dflt" ;;
4842*) dflt="$ccflags";;
4843esac
40a7a20a 4844
bd9b35c9
JH
4845case "$dflt" in
4846''|' ') dflt=none;;
4847esac
422af00a 4848
bd9b35c9 4849$cat <<EOH
40a7a20a 4850
bd9b35c9
JH
4851Your C compiler may want other flags. For this question you should include
4852-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4853but you should NOT include libraries or ld flags like -lwhatever. If you
4854want $package to honor its debug switch, you should include -DDEBUGGING here.
4855Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4856
bd9b35c9 4857To use no flags, specify the word "none".
40a7a20a 4858
bd9b35c9
JH
4859EOH
4860set X $dflt
4861shift
4862dflt=${1+"$@"}
4863rp="Any additional cc flags?"
4864. ./myread
4865case "$ans" in
4866none) ccflags='';;
4867*) ccflags="$ans";;
4868esac
8e07c86e 4869
bd9b35c9 4870: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4871case "$cppflags" in
4872'') cppflags="$ccflags" ;;
4873*) cppflags="$cppflags $ccflags" ;;
4874esac
bd9b35c9
JH
4875case "$gccversion" in
48761*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4877esac
bd9b35c9
JH
4878case "$mips_type" in
4879'');;
4880*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4881esac
4882case "$cppflags" in
4883'');;
4884*)
4885 echo " "
4886 echo "Let me guess what the preprocessor flags are..." >&4
4887 set X $cppflags
4888 shift
4889 cppflags=''
4890 $cat >cpp.c <<'EOM'
4891#define BLURFL foo
8e07c86e 4892
bd9b35c9
JH
4893BLURFL xx LFRULB
4894EOM
4895 previous=''
4896 for flag in $*
4897 do
4898 case "$flag" in
4899 -*) ftry="$flag";;
4900 *) ftry="$previous $flag";;
4901 esac
4902 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4903 >cpp1.out 2>/dev/null && \
4904 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4905 >cpp2.out 2>/dev/null && \
4906 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4907 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4908 then
4909 cppflags="$cppflags $ftry"
4910 previous=''
4911 else
4912 previous="$flag"
4913 fi
4914 done
4915 set X $cppflags
4916 shift
4917 cppflags=${1+"$@"}
4918 case "$cppflags" in
4919 *-*) echo "They appear to be: $cppflags";;
4920 esac
4921 $rm -f cpp.c cpp?.out
2afac517 4922 ;;
4923esac
8e07c86e 4924
bd9b35c9
JH
4925: flags used in final linking phase
4926case "$ldflags" in
4927'') if ./venix; then
4928 dflt='-i -z'
10a23457 4929 else
bd9b35c9 4930 dflt=''
10a23457 4931 fi
bd9b35c9
JH
4932 case "$ccflags" in
4933 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4934 esac
bd9b35c9
JH
4935 ;;
4936*) dflt="$ldflags";;
4937esac
4938
4939: Try to guess additional flags to pick up local libraries.
4940for thislibdir in $libpth; do
4941 case " $loclibpth " in
4942 *" $thislibdir "*)
00e89ad4 4943 case "$dflt " in
bd9b35c9
JH
4944 *"-L$thislibdir "*) ;;
4945 *) dflt="$dflt -L$thislibdir" ;;
4946 esac
c4f23d77
AD
4947 ;;
4948 esac
bd9b35c9 4949done
c4f23d77 4950
bd9b35c9
JH
4951case "$dflt" in
4952'') dflt='none' ;;
4953esac
c4f23d77 4954
bd9b35c9
JH
4955$cat <<EOH
4956
4957Your C linker may need flags. For this question you should
4958include -L/whatever and any other flags used by the C linker, but you
4959should NOT include libraries like -lwhatever.
4960
4961Make sure you include the appropriate -L/path flags if your C linker
4962does not normally search all of the directories you specified above,
4963namely
4964 $libpth
4965To use no flags, specify the word "none".
4966
4967EOH
4968
4969rp="Any additional ld flags (NOT including libraries)?"
4970. ./myread
4971case "$ans" in
4972none) ldflags='';;
4973*) ldflags="$ans";;
4974esac
4975rmlist="$rmlist pdp11"
4976
4977: coherency check
4978echo " "
4979echo "Checking your choice of C compiler and flags for coherency..." >&4
4980$cat > try.c <<'EOF'
4981#include <stdio.h>
55954f19 4982int main() { printf("Ok\n"); return(0); }
bd9b35c9 4983EOF
7a282f6d 4984set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4985shift
4986$cat >try.msg <<'EOM'
4987I've tried to compile and run the following simple program:
4988
4989EOM
4990$cat try.c >> try.msg
4991
4992$cat >> try.msg <<EOM
4993
4994I used the command:
4995
4996 $*
5440bc8e 4997 $run ./try
bd9b35c9
JH
4998
4999and I got the following output:
5000
5001EOM
5002dflt=y
73614538 5003if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5004 if $sh -c "$run ./try" >>try.msg 2>&1; then
5005 xxx=`$run ./try`
bd9b35c9
JH
5006 case "$xxx" in
5007 "Ok") dflt=n ;;
5008 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5009 case " $libs " in
5010 *" -lsfio "*)
5011 cat >> try.msg <<'EOQS'
5012If $libs contains -lsfio, and sfio is mis-configured, then it
5013sometimes (apparently) runs and exits with a 0 status, but with no
5014output! It may have to do with sfio's use of _exit vs. exit.
5015
5016EOQS
5017 rp="You have a big problem. Shall I abort Configure"
5018 dflt=y
5019 ;;
5020 esac
5021 ;;
5022 esac
5023 else
5024 echo "The program compiled OK, but exited with status $?." >>try.msg
5025 rp="You have a problem. Shall I abort Configure"
5026 dflt=y
5027 fi
5028else
5029 echo "I can't compile the test program." >>try.msg
5030 rp="You have a BIG problem. Shall I abort Configure"
5031 dflt=y
5032fi
5033case "$dflt" in
5034y)
5035 $cat try.msg >&4
5036 case "$knowitall" in
5037 '')
5038 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5039 ;;
bd9b35c9 5040 *) dflt=n;;
c4f23d77 5041 esac
bd9b35c9
JH
5042 echo " "
5043 . ./myread
5044 case "$ans" in
5045 n*|N*) ;;
5046 *) echo "Ok. Stopping Configure." >&4
5047 exit 1
c4f23d77
AD
5048 ;;
5049 esac
5050 ;;
bd9b35c9 5051n) echo "OK, that should do.";;
c4f23d77 5052esac
bd9b35c9 5053$rm -f try try.* core
c4f23d77 5054
bd9b35c9
JH
5055: define a shorthand compile call
5056compile='
5057mc_file=$1;
5058shift;
08413ebc 5059$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5060: define a shorthand compile call for compilations that should be ok.
5061compile_ok='
5062mc_file=$1;
5063shift;
7a282f6d 5064$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5065
8dfa8df9
JH
5066: determine filename position in cpp output
5067echo " "
5068echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5069case "$osname" in
5070vos) testaccess=-e ;;
5071*) testaccess=-r ;;
5072esac
8dfa8df9
JH
5073echo '#include <stdio.h>' > foo.c
5074$cat >fieldn <<EOF
5075$startsh
5076$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5077$grep '^[ ]*#.*stdio\.h' | \
5078while read cline; do
5079 pos=1
5080 set \$cline
5081 while $test \$# -gt 0; do
a5a94ea5 5082 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5083 echo "\$pos"
5084 exit 0
5085 fi
5086 shift
5087 pos=\`expr \$pos + 1\`
5088 done
5089done
5090EOF
5091chmod +x fieldn
5092fieldn=`./fieldn`
5093$rm -f foo.c fieldn
5094case $fieldn in
5095'') pos='???';;
50961) pos=first;;
50972) pos=second;;
50983) pos=third;;
5099*) pos="${fieldn}th";;
5100esac
5101echo "Your cpp writes the filename in the $pos field of the line."
5102
3c728e00
JH
5103case "$osname" in
5104vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5105os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5106*) cppfilter='' ;;
5107esac
8dfa8df9
JH
5108: locate header file
5109$cat >findhdr <<EOF
5110$startsh
5111wanted=\$1
5112name=''
5113for usrincdir in $usrinc
5114do
5115 if test -f \$usrincdir/\$wanted; then
5116 echo "\$usrincdir/\$wanted"
5117 exit 0
5118 fi
5119done
5120awkprg='{ print \$$fieldn }'
5121echo "#include <\$wanted>" > foo\$\$.c
5122$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5123$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5124while read cline; do
5125 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5126 case "\$name" in
5127 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5128 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5129 *) exit 2;;
5130 esac;
5131done;
5132#
5133# status = 0: grep returned 0 lines, case statement not executed
5134# status = 1: headerfile found
5135# status = 2: while loop executed, no headerfile found
5136#
5137status=\$?
5138$rm -f foo\$\$.c;
5139if test \$status -eq 1; then
5140 exit 0;
5141fi
5142exit 1
5143EOF
5144chmod +x findhdr
5145
5146: define an alternate in-header-list? function
5147inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5148cont=true; xxf="echo \"<\$1> found.\" >&4";
5149case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5150*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5151esac;
5152case $# in 4) instead=instead;; *) instead="at last";; esac;
5153while $test "$cont"; do
5154 xxx=`./findhdr $1`
5155 var=$2; eval "was=\$$2";
5156 if $test "$xxx" && $test -r "$xxx";
5157 then eval $xxf;
5158 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5159 cont="";
5160 else eval $xxnf;
5161 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5162 set $yyy; shift; shift; yyy=$@;
5163 case $# in 0) cont="";;
5164 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5165 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5166 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5167 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5168 esac;
5169done;
5170while $test "$yyy";
5171do set $yyy; var=$2; eval "was=\$$2";
5172 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5173 set $yyy; shift; shift; yyy=$@;
5174done'
5175
d1daaddf
JH
5176: see if stdlib is available
5177set stdlib.h i_stdlib
5178eval $inhdr
5179
5180: check for lengths of integral types
5181echo " "
5182case "$intsize" in
5183'')
5184 echo "Checking to see how big your integers are..." >&4
c63dfae1 5185 $cat >try.c <<EOCP
d1daaddf
JH
5186#include <stdio.h>
5187#$i_stdlib I_STDLIB
5188#ifdef I_STDLIB
5189#include <stdlib.h>
5190#endif
5191int main()
5192{
5193 printf("intsize=%d;\n", (int)sizeof(int));
5194 printf("longsize=%d;\n", (int)sizeof(long));
5195 printf("shortsize=%d;\n", (int)sizeof(short));
5196 exit(0);
5197}
5198EOCP
5199 set try
5200 if eval $compile_ok && $run ./try > /dev/null; then
5201 eval `$run ./try`
5202 echo "Your integers are $intsize bytes long."
5203 echo "Your long integers are $longsize bytes long."
5204 echo "Your short integers are $shortsize bytes long."
5205 else
5206 $cat >&4 <<EOM
5207!
5208Help! I can't compile and run the intsize test program: please enlighten me!
5209(This is probably a misconfiguration in your system or libraries, and
5210you really ought to fix it. Still, I'll try anyway.)
5211!
5212EOM
5213 dflt=4
5214 rp="What is the size of an integer (in bytes)?"
5215 . ./myread
5216 intsize="$ans"
5217 dflt=$intsize
5218 rp="What is the size of a long integer (in bytes)?"
5219 . ./myread
5220 longsize="$ans"
5221 dflt=2
5222 rp="What is the size of a short integer (in bytes)?"
5223 . ./myread
5224 shortsize="$ans"
5225 fi
5226 ;;
5227esac
5228$rm -f try try.*
5229
5230: check for long long
5231echo " "
5232echo "Checking to see if you have long long..." >&4
5233echo 'int main() { long long x = 7; return 0; }' > try.c
5234set try
5235if eval $compile; then
5236 val="$define"
5237 echo "You have long long."
5238else
5239 val="$undef"
5240 echo "You do not have long long."
5241fi
5242$rm try.*
5243set d_longlong
5244eval $setvar
5245
5246: check for length of long long
5247case "${d_longlong}${longlongsize}" in
5248$define)
5249 echo " "
5250 echo "Checking to see how big your long longs are..." >&4
5251 $cat >try.c <<'EOCP'
5252#include <stdio.h>
5253int main()
5254{
5255 printf("%d\n", (int)sizeof(long long));
5256 return(0);
5257}
5258EOCP
5259 set try
5260 if eval $compile_ok; then
5261 longlongsize=`$run ./try`
5262 echo "Your long longs are $longlongsize bytes long."
5263 else
5264 dflt='8'
5265 echo " "
5266 echo "(I can't seem to compile the test program. Guessing...)"
5267 rp="What is the size of a long long (in bytes)?"
5268 . ./myread
5269 longlongsize="$ans"
5270 fi
5271 if $test "X$longsize" = "X$longlongsize"; then
5272 echo "(That isn't any different from an ordinary long.)"
5273 fi
5274 ;;
5275esac
5276$rm -f try.* try
5277
8dfa8df9
JH
5278: see if inttypes.h is available
5279: we want a real compile instead of Inhdr because some systems
5280: have an inttypes.h which includes non-existent headers
5281echo " "
5282$cat >try.c <<EOCP
5283#include <inttypes.h>
5284int main() {
5285 static int32_t foo32 = 0x12345678;
5286}
5287EOCP
5288set try
5289if eval $compile; then
5290 echo "<inttypes.h> found." >&4
5291 val="$define"
5292else
5293 echo "<inttypes.h> NOT found." >&4
5294 val="$undef"
5295fi
5296$rm -f try.c try
5297set i_inttypes
5298eval $setvar
5299
5300: check for int64_t
5301echo " "
5302echo "Checking to see if you have int64_t..." >&4
5303$cat >try.c <<EOCP
5304#include <sys/types.h>
5305#$i_inttypes I_INTTYPES
5306#ifdef I_INTTYPES
5307#include <inttypes.h>
5308#endif
5309int main() { int64_t x = 7; }
5310EOCP
5311set try
5312if eval $compile; then
5313 val="$define"
5314 echo "You have int64_t."
5315else
5316 val="$undef"
5317 echo "You do not have int64_t."
5318fi
5319$rm -f try try.*
5320set d_int64_t
5321eval $setvar
5322
5323
5324echo " "
5325echo "Checking which 64-bit integer type we could use..." >&4
5326
5327case "$intsize" in
53288) val=int
5329 set quadtype
5330 eval $setvar
5331 val='"unsigned int"'
5332 set uquadtype
5333 eval $setvar
5334 quadkind=1
5335 ;;
5336*) case "$longsize" in
5337 8) val=long
5338 set quadtype
5339 eval $setvar
5340 val='"unsigned long"'
5341 set uquadtype
5342 eval $setvar
5343 quadkind=2
5344 ;;
5345 *) case "$d_longlong:$longlongsize" in
5346 define:8)
5347 val='"long long"'
5348 set quadtype
5349 eval $setvar
5350 val='"unsigned long long"'
5351 set uquadtype
5352 eval $setvar
5353 quadkind=3
5354 ;;
5355 *) case "$d_int64_t" in
5356 define)
5357 val=int64_t
5358 set quadtype
5359 eval $setvar
5360 val=uint64_t
5361 set uquadtype
5362 eval $setvar
5363 quadkind=4
5364 ;;
5365 esac
5366 ;;
5367 esac
5368 ;;
5369 esac
5370 ;;
5371esac
5372
5373case "$quadtype" in
5374'') echo "Alas, no 64-bit integer types in sight." >&4
5375 d_quad="$undef"
5376 ;;
5377*) echo "We could use '$quadtype' for 64-bit integers." >&4
5378 d_quad="$define"
5379 ;;
5380esac
5381
b4eb6b3d
JH
5382
5383case "$uselonglong" in
5384"$define"|true|[yY]*)
5385 cat <<EOM >&4
5386
5387*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5388EOM
5389 use64bitint="$define"
5390 ;;
5391esac
5392case "$use64bits" in
5393"$define"|true|[yY]*)
5394 cat <<EOM >&4
5395
5396*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5397EOM
5398 use64bitint="$define"
5399 ;;
5400esac
5401case "$use64bitints" in
5402"$define"|true|[yY]*)
5403 cat <<EOM >&4
5404
5405*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5406EOM
5407 use64bitint="$define"
5408 ;;
5409esac
5410case "$use64bitsint" in
5411"$define"|true|[yY]*)
5412 cat <<EOM >&4
5413
5414*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5415EOM
5416 use64bitint="$define"
5417 ;;
5418esac
5419case "$uselonglongs" in
5420"$define"|true|[yY]*)
5421 cat <<EOM >&4
5422
5423*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5424EOM
5425 use64bitint="$define"
5426 ;;
5427esac
5428case "$use64bitsall" in
5429"$define"|true|[yY]*)
5430 cat <<EOM >&4
5431
5432*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5433EOM
5434 use64bitall="$define"
5435 ;;
5436esac
5437
5438case "$ccflags" in
5439*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5440esac
5441case "$use64bitall" in
5442"$define"|true|[yY]*) use64bitint="$define" ;;
5443esac
5444
5445case "$longsize" in
54468) cat <<EOM
5447
5448You have natively 64-bit long integers.
5449EOM
5450 val="$define"
5451 ;;
5452*) case "$use64bitint" in
5453 "$define"|true|[yY]*) dflt='y';;
5454 *) dflt='n';;
5455 esac
8dfa8df9
JH
5456 case "$d_quad" in
5457 "$define") ;;
5458 *) dflt='n' ;;
5459 esac
b4eb6b3d
JH
5460 cat <<EOM
5461
5462Perl can be built to take advantage of 64-bit integer types
5463on some systems. To do so, Configure can be run with -Duse64bitint.
5464Choosing this option will most probably introduce binary incompatibilities.
5465
5466If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5467(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5468EOM
5469 rp='Try to use 64-bit integers, if available?'
5470 . ./myread
5471 case "$ans" in
5472 [yY]*) val="$define" ;;
5473 *) val="$undef" ;;
5474 esac
5475 ;;
5476esac
5477set use64bitint
5478eval $setvar
5479
5480case "$use64bitall" in
5481"$define"|true|[yY]*) dflt='y' ;;
5482*) case "$longsize" in
5483 8) dflt='y' ;;
5484 *) dflt='n' ;;
5485 esac
5486 ;;
5487esac
5488cat <<EOM
5489
5490You may also choose to try maximal 64-bitness. It means using as much
549164-bitness as possible on the platform. This in turn means even more
5492binary incompatibilities. On the other hand, your platform may not
5493have any more 64-bitness available than what you already have chosen.
5494
5495If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5496(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5497EOM
5498rp='Try to use maximal 64-bit support, if available?'
5499. ./myread
5500case "$ans" in
5501[yY]*) val="$define" ;;
5502*) val="$undef" ;;
5503esac
5504set use64bitall
5505eval $setvar
5506case "$use64bitall" in
5507"$define")
5508 case "$use64bitint" in
5509 "$undef")
5510 cat <<EOM
5511
5512Since you have chosen a maximally 64-bit build, I'm also turning on
5513the use of 64-bit integers.
5514EOM
5515 use64bitint="$define" ;;
5516 esac
5517 ;;
5518esac
5519
b4eb6b3d
JH
5520: Look for a hint-file generated 'call-back-unit'. If the
5521: user has specified that a 64-bit perl is to be built,
5522: we may need to set or change some other defaults.
19a100ff 5523if $test -f use64bitint.cbu; then
9da7673b 5524 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5525 . ./use64bitint.cbu
5526fi
9da7673b
MB
5527case "$use64bitint" in
5528"$define"|true|[yY]*)
b4eb6b3d
JH
5529 case "$longsize" in
5530 4) case "$archname64" in
5531 '') archname64=64int ;;
5532 esac
5533 ;;
5534 esac
5535 ;;
5536esac
5537
b4eb6b3d
JH
5538: Look for a hint-file generated 'call-back-unit'. If the
5539: user has specified that a maximally 64-bit perl is to be built,
5540: we may need to set or change some other defaults.
19a100ff 5541if $test -f use64bitall.cbu; then
9da7673b 5542 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5543 . ./use64bitall.cbu
5544fi
9da7673b
MB
5545case "$use64bitall" in
5546"$define"|true|[yY]*)
b4eb6b3d
JH
5547 case "$longsize" in
5548 4) case "$archname64" in
5549 ''|64int) archname64=64all ;;
5550 esac
5551 ;;
5552 esac
5553 ;;
5554esac
5555
1911a026
JH
5556case "$d_quad:$use64bitint" in
5557$undef:$define)
5558 cat >&4 <<EOF
5559
5560*** You have chosen to use 64-bit integers,
19a100ff 5561*** but none can be found.
09b58c7b 5562*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5563*** Cannot continue, aborting.
5564
5565EOF
5566 exit 1
5567 ;;
5568esac
5569
36adc09b
JH
5570: check for length of double
5571echo " "
5572case "$doublesize" in
5573'')
5574 echo "Checking to see how big your double precision numbers are..." >&4
5575 $cat >try.c <<EOCP
5576#include <stdio.h>
1911a026
JH
5577#$i_stdlib I_STDLIB
5578#ifdef I_STDLIB
5579#include <stdlib.h>
5580#endif
36adc09b
JH
5581int main()
5582{
5583 printf("%d\n", (int)sizeof(double));
1911a026 5584 exit(0);
36adc09b
JH
5585}
5586EOCP
5587 set try
5588 if eval $compile_ok; then
5589 doublesize=`$run ./try`
5590 echo "Your double is $doublesize bytes long."
5591 else
5592 dflt='8'
5593 echo "(I can't seem to compile the test program. Guessing...)"
5594 rp="What is the size of a double precision number (in bytes)?"
5595 . ./myread
5596 doublesize="$ans"
5597 fi
5598 ;;
5599esac
5600$rm -f try.c try
5601
5602: check for long doubles
5603echo " "
5604echo "Checking to see if you have long double..." >&4
5605echo 'int main() { long double x = 7.0; }' > try.c
5606set try
5607if eval $compile; then
5608 val="$define"
5609 echo "You have long double."
5610else
5611 val="$undef"
5612 echo "You do not have long double."
5613fi
5614$rm try.*
5615set d_longdbl
5616eval $setvar
5617
5618: check for length of long double
5619case "${d_longdbl}${longdblsize}" in
5620$define)
5621 echo " "
5622 echo "Checking to see how big your long doubles are..." >&4
5623 $cat >try.c <<'EOCP'
5624#include <stdio.h>
5625int main()
5626{
5627 printf("%d\n", sizeof(long double));
5628}
5629EOCP
5630 set try
5631 set try
5632 if eval $compile; then
5633 longdblsize=`$run ./try`
5634 echo "Your long doubles are $longdblsize bytes long."
5635 else
5636 dflt='8'
5637 echo " "
5638 echo "(I can't seem to compile the test program. Guessing...)" >&4
5639 rp="What is the size of a long double (in bytes)?"
5640 . ./myread
5641 longdblsize="$ans"
5642 fi
5643 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5644 echo "That isn't any different from an ordinary double."
5645 echo "I'll keep your setting anyway, but you may see some"
5646 echo "harmless compilation warnings."
36adc09b
JH
5647 fi
5648 ;;
5649esac
5650$rm -f try.* try
5651
89ce900e 5652: determine the architecture name
b4eb6b3d 5653echo " "
89ce900e
JH
5654if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5655 tarch=`arch`"-$osname"
5656elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5657 if uname -m > tmparch 2>&1 ; then
5658 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5659 -e 's/$/'"-$osname/" tmparch`
5660 else
5661 tarch="$osname"
5662 fi
5663 $rm -f tmparch
b4eb6b3d 5664else
89ce900e 5665 tarch="$osname"
b4eb6b3d 5666fi
89ce900e
JH
5667case "$myarchname" in
5668''|"$tarch") ;;
5669*)
5670 echo "(Your architecture name used to be $myarchname.)"
5671 archname=''
5672 ;;
5673esac
5674case "$targetarch" in
5675'') ;;
5676*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5677esac
5678myarchname="$tarch"
5679case "$archname" in
5680'') dflt="$tarch";;
5681*) dflt="$archname";;
5682esac
5683rp='What is your architecture name'
5684. ./myread
5685archname="$ans"
5686case "$usethreads" in
5687$define)
5688 echo "Threads selected." >&4
5689 case "$archname" in
5690 *-thread*) echo "...and architecture name already has -thread." >&4
5691 ;;
5692 *) archname="$archname-thread"
5693 echo "...setting architecture name to $archname." >&4
5694 ;;
5695 esac
5696 ;;
5697esac
5698case "$usemultiplicity" in
5699$define)
5700 echo "Multiplicity selected." >&4
5701 case "$archname" in
5702 *-multi*) echo "...and architecture name already has -multi." >&4
5703 ;;
5704 *) archname="$archname-multi"
5705 echo "...setting architecture name to $archname." >&4
5706 ;;
5707 esac
5708 ;;
5709esac
5710case "$use64bitint$use64bitall" in
5711*"$define"*)
5712 case "$archname64" in
5713 '')
5714 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5715 ;;
89ce900e
JH
5716 *)
5717 case "$use64bitint" in
5718 "$define") echo "64 bit integers selected." >&4 ;;
5719 esac
5720 case "$use64bitall" in
5721 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5722 esac
5723 case "$archname" in
5724 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5725 ;;
5726 *) archname="$archname-$archname64"
5727 echo "...setting architecture name to $archname." >&4
5728 ;;
5729 esac
c1a7f87b
JH
5730 ;;
5731 esac
89ce900e
JH
5732esac
5733case "$uselongdouble" in
5734$define)
5735 echo "Long doubles selected." >&4
5736 case "$longdblsize" in
5737 $doublesize)
5738 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5739 ;;
5740 *)
5741 case "$archname" in
5742 *-ld*) echo "...and architecture name already has -ld." >&4
5743 ;;
5744 *) archname="$archname-ld"
5745 echo "...setting architecture name to $archname." >&4
5746 ;;
5747 esac
bd9b35c9
JH
5748 ;;
5749 esac
bd9b35c9 5750 ;;
89ce900e
JH
5751esac
5752case "$useperlio" in
5753$define)
5754 echo "Perlio selected." >&4
5755 ;;
bd9b35c9 5756*)
89ce900e
JH
5757 echo "Perlio not selected, using stdio." >&4
5758 case "$archname" in
5759 *-stdio*) echo "...and architecture name already has -stdio." >&4
5760 ;;
5761 *) archname="$archname-stdio"
5762 echo "...setting architecture name to $archname." >&4
5763 ;;
5764 esac
bd9b35c9
JH
5765 ;;
5766esac
d2e0c6f7
JH
5767if $test -f archname.cbu; then
5768 echo "Your platform has some specific hints for architecture name, using them..."
5769 . ./archname.cbu
5770fi
bd9b35c9 5771
89ce900e
JH
5772: determine root of directory hierarchy where package will be installed.
5773case "$prefix" in
5774'')
5775 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5776 ;;
5777*?/)
5778 dflt=`echo "$prefix" | sed 's/.$//'`
5779 ;;
5780*)
5781 dflt="$prefix"
5782 ;;
5783esac
5784$cat <<EOM
c1a7f87b 5785
89ce900e
JH
5786By default, $package will be installed in $dflt/bin, manual pages
5787under $dflt/man, etc..., i.e. with $dflt as prefix for all
5788installation directories. Typically this is something like /usr/local.
5789If you wish to have binaries under /usr/bin but other parts of the
5790installation under /usr/local, that's ok: you will be prompted
5791separately for each of the installation directories, the prefix being
5792only used to set the defaults.
bd9b35c9
JH
5793
5794EOM
89ce900e
JH
5795fn=d~
5796rp='Installation prefix to use?'
5797. ./getfile
5798oldprefix=''
5799case "$prefix" in
5800'') ;;
5801*)
5802 case "$ans" in
5803 "$prefix") ;;
5804 *) oldprefix="$prefix";;
5805 esac
5806 ;;
bd9b35c9 5807esac
89ce900e
JH
5808prefix="$ans"
5809prefixexp="$ansexp"
bd9b35c9 5810
89ce900e
JH
5811case "$afsroot" in
5812'') afsroot=/afs ;;
5813*) afsroot=$afsroot ;;
8e07c86e 5814esac
29209bc5 5815
89ce900e
JH
5816: is AFS running?
5817echo " "
5818case "$afs" in
5819$define|true) afs=true ;;
5820$undef|false) afs=false ;;
5821*) if test -d $afsroot; then
5822 afs=true
c1a7f87b 5823 else
89ce900e
JH
5824 afs=false
5825 fi
5826 ;;
c1a7f87b 5827esac
89ce900e
JH
5828if $afs; then
5829 echo "AFS may be running... I'll be extra cautious then..." >&4
5830else
5831 echo "AFS does not seem to be running..." >&4
5832fi
b4eb6b3d
JH
5833
5834: determine installation prefix for where package is to be installed.
5835if $afs; then
5836$cat <<EOM
5837
5838Since you are running AFS, I need to distinguish the directory in which
5839files will reside from the directory in which they are installed (and from
5840which they are presumably copied to the former directory by occult means).
5841
5842EOM
5843 case "$installprefix" in
5844 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5845 *) dflt="$installprefix";;
5846 esac
5847else
5848$cat <<EOM
5849
5850In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5851it is convenient to distinguish the directory in which files should be
5852installed from the directory ($prefix) in which they will
5853eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5854
5855EOM
5856 case "$installprefix" in
5857 '') dflt=$prefix ;;
5858 *) dflt=$installprefix;;
5859 esac
5860fi
5861fn=d~
5862rp='What installation prefix should I use for installing files?'
5863. ./getfile
5864installprefix="$ans"
5865installprefixexp="$ansexp"
5866
5867: set the prefixit variable, to compute a suitable default value
5868prefixit='case "$3" in
5869""|none)
5870 case "$oldprefix" in
5871 "") eval "$1=\"\$$2\"";;
5872 *)
5873 case "$3" in
5874 "") eval "$1=";;
5875 none)
5876 eval "tp=\"\$$2\"";
5877 case "$tp" in
5878 ""|" ") eval "$1=\"\$$2\"";;
5879 *) eval "$1=";;
5880 esac;;
5881 esac;;
5882 esac;;
5883*)
5884 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5885 case "$tp" in
5886 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5887 /*-$oldprefix/*|\~*-$oldprefix/*)
5888 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5889 *) eval "$1=\"\$$2\"";;
5890 esac;;
5891esac'
5892
b4eb6b3d
JH
5893: get the patchlevel
5894echo " "
5895echo "Getting the current patchlevel..." >&4
5896if $test -r $rsrc/patchlevel.h;then
5897 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5898 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5899 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5900 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5901 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5902 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
35918792 5903 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
5904else
5905 revision=0
5906 patchlevel=0
5907 subversion=0
5908 api_revision=0
5909 api_version=0
5910 api_subversion=0
151e6568
MB
5911 perl_patchlevel=0
5912 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5913fi
35918792
YST
5914if $test -r $rsrc/.patch ; then
5915 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5916 perl_patchlevel=`cat $rsrc/.patch`
5917 fi
5918fi
861eb78d
AD
5919: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5920version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5921case "$perl_patchlevel" in
861eb78d
AD
59220|'') ;;
5923*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5924esac
861eb78d
AD
5925
5926$echo "(You have $package $version_patchlevel_string.)"
5927
b4eb6b3d
JH
5928case "$osname" in
5929dos|vms)
5930 : XXX Should be a Configure test for double-dots in filenames.
5931 version=`echo $revision $patchlevel $subversion | \
5932 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5933 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5934 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5935 ;;
5936*)
5937 version=`echo $revision $patchlevel $subversion | \
5938 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5939 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5940 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5941 ;;
5942esac
5943: Special case the 5.005_xx maintenance series, which used 5.005
5944: without any subversion label as a subdirectory in $sitelib
5945if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5946 api_versionstring='5.005'
5947fi
5948
5949: determine installation style
5950: For now, try to deduce it from prefix unless it is already set.
5951: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5952case "$installstyle" in
5953'') case "$prefix" in
5954 *perl*) dflt='lib';;
5955 *) dflt='lib/perl5' ;;
5956 esac
5957 ;;
5958*) dflt="$installstyle" ;;
5959esac
5960: Probably not worth prompting for this since we prompt for all
5961: the directories individually, and the prompt would be too long and
5962: confusing anyway.
5963installstyle=$dflt
5964
5965: determine where private library files go
5966: Usual default is /usr/local/lib/perl5/$version.
5967: Also allow things like /opt/perl/lib/$version, since
5968: /opt/perl/lib/perl5... would be redundant.
5969: The default "style" setting is made in installstyle.U
5970case "$installstyle" in
5971*lib/perl5*) set dflt privlib lib/$package/$version ;;
5972*) set dflt privlib lib/$version ;;
5973esac
5974eval $prefixit
5975$cat <<EOM
5976
5977There are some auxiliary files for $package that need to be put into a
5978private library directory that is accessible by everyone.
5979
5980EOM
5981fn=d~+
5982rp='Pathname where the private library files will reside?'
5983. ./getfile
5984privlib="$ans"
5985privlibexp="$ansexp"
5986: Change installation prefix, if necessary.
5987if $test X"$prefix" != X"$installprefix"; then
5988 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5989else
5990 installprivlib="$privlibexp"
5991fi
5992
5993: set the prefixup variable, to restore leading tilda escape
5994prefixup='case "$prefixexp" in
5995"$prefix") ;;
5996*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5997esac'
5998
5999: determine where public architecture dependent libraries go
6000set archlib archlib
6001eval $prefixit
6002: privlib default is /usr/local/lib/$package/$version
6003: archlib default is /usr/local/lib/$package/$version/$archname
6004: privlib may have an optional trailing /share.
6005tdflt=`echo $privlib | $sed 's,/share$,,'`
6006tdflt=$tdflt/$archname
6007case "$archlib" in
6008'') dflt=$tdflt
6009 ;;
6010*) dflt="$archlib"
6011 ;;
6012esac
6013$cat <<EOM
6014
6015$spackage contains architecture-dependent library files. If you are
6016sharing libraries in a heterogeneous environment, you might store
6017these files in a separate location. Otherwise, you can just include
6018them with the rest of the public library files.
6019
6020EOM
6021fn=d+~
6022rp='Where do you want to put the public architecture-dependent libraries?'
6023. ./getfile
6024archlib="$ans"
6025archlibexp="$ansexp"
6026if $test X"$archlib" = X"$privlib"; then
6027 d_archlib="$undef"
6028else
6029 d_archlib="$define"
6030fi
6031: Change installation prefix, if necessary.
6032if $test X"$prefix" != X"$installprefix"; then
6033 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6034else
6035 installarchlib="$archlibexp"
6036fi
6037
b4eb6b3d
JH
6038: see if setuid scripts can be secure
6039$cat <<EOM
6040
6041Some kernels have a bug that prevents setuid #! scripts from being
6042secure. Some sites have disabled setuid #! scripts because of this.
6043
6044First let's decide if your kernel supports secure setuid #! scripts.
6045(If setuid #! scripts would be secure but have been disabled anyway,
6046don't say that they are secure if asked.)
6047
6048EOM
6049
6050val="$undef"
6051if $test -d /dev/fd; then
6052 echo "#!$ls" >reflect
6053 chmod +x,u+s reflect
6054 ./reflect >flect 2>&1
6055 if $contains "/dev/fd" flect >/dev/null; then
6056 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6057 val="$define"
6058 else
6059 $cat <<EOM
6060If you are not sure if they are secure, I can check but I'll need a
6061username and password different from the one you are using right now.
6062If you don't have such a username or don't want me to test, simply
6063enter 'none'.
6064
6065EOM
6066 rp='Other username to test security of setuid scripts with?'
6067 dflt='none'
6068 . ./myread
6069 case "$ans" in
6070 n|none)
6071 case "$d_suidsafe" in
6072 '') echo "I'll assume setuid scripts are *not* secure." >&4
6073 dflt=n;;
6074 "$undef")
6075 echo "Well, the $hint value is *not* secure." >&4
6076 dflt=n;;
6077 *) echo "Well, the $hint value *is* secure." >&4
6078 dflt=y;;
6079 esac
c1a7f87b 6080 ;;
b4eb6b3d
JH
6081 *)
6082 $rm -f reflect flect
6083 echo "#!$ls" >reflect
6084 chmod +x,u+s reflect
6085 echo >flect
6086 chmod a+w flect
6087 echo '"su" will (probably) prompt you for '"$ans's password."
6088 su $ans -c './reflect >flect'
6089 if $contains "/dev/fd" flect >/dev/null; then
6090 echo "Okay, it looks like setuid scripts are secure." >&4
6091 dflt=y
6092 else
6093 echo "I don't think setuid scripts are secure." >&4
6094 dflt=n
6095 fi
6096 ;;
6097 esac
6098 rp='Does your kernel have *secure* setuid scripts?'
6099 . ./myread
6100 case "$ans" in
6101 [yY]*) val="$define";;
6102 *) val="$undef";;
6103 esac
6104 fi
6105else
6106 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6107 echo "(That's for file descriptors, not floppy disks.)"
6108 val="$undef"
6109fi
6110set d_suidsafe
6111eval $setvar
6112
6113$rm -f reflect flect
6114
6115: now see if they want to do setuid emulation
6116echo " "
6117val="$undef"
6118case "$d_suidsafe" in
6119"$define")
6120 val="$undef"
3c728e00 6121 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6122 ;;
6123*)
6124 $cat <<EOM
6125Some systems have disabled setuid scripts, especially systems where
6126setuid scripts cannot be secure. On systems where setuid scripts have
6127been disabled, the setuid/setgid bits on scripts are currently
6128useless. It is possible for $package to detect those bits and emulate
6129setuid/setgid in a secure fashion. This emulation will only work if
6130setuid scripts have been disabled in your kernel.
6131
6132EOM
6133 case "$d_dosuid" in
6134 "$define") dflt=y ;;
6135 *) dflt=n ;;
6136 esac
6137 rp="Do you want to do setuid/setgid emulation?"
6138 . ./myread
6139 case "$ans" in
6140 [yY]*) val="$define";;
6141 *) val="$undef";;
6142 esac
6143 ;;
6144esac
6145set d_dosuid
6146eval $setvar
6147
b4eb6b3d 6148: see if this is a malloc.h system
01d07975
YST
6149: we want a real compile instead of Inhdr because some systems have a
6150: malloc.h that just gives a compile error saying to use stdlib.h instead
6151echo " "
6152$cat >try.c <<EOCP
6153#include <stdlib.h>
6154#include <malloc.h>
6155int main () { return 0; }
6156EOCP
6157set try
6158if eval $compile; then
6159 echo "<malloc.h> found." >&4
6160 val="$define"
6161else
6162 echo "<malloc.h> NOT found." >&4
6163 val="$undef"
6164fi
6165$rm -f try.c try
6166set i_malloc
6167eval $setvar
b4eb6b3d 6168
c8b93cf9
JH
6169: check for void type
6170echo " "
6171echo "Checking to see how well your C compiler groks the void type..." >&4
6172case "$voidflags" in
6173'')
c727eafa 6174 $cat >try.c <<EOCP
d1daaddf
JH
6175#$i_stdlib I_STDLIB
6176#ifdef I_STDLIB
6177#include <stdlib.h>
6178#endif
c8b93cf9
JH
6179#if TRY & 1
6180void sub() {
6181#else
6182sub() {
6183#endif
6184 extern void moo(); /* function returning void */
6185 void (*goo)(); /* ptr to func returning void */
6186#if TRY & 8
6187 void *hue; /* generic ptr */
6188#endif
6189#if TRY & 2
6190 void (*foo[10])();
6191#endif
6192
6193#if TRY & 4
6194 if(goo == moo) {
6195 exit(0);
6196 }
6197#endif
6198 exit(0);
6199}
6200int main() { sub(); }
6201EOCP
6202 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6203 voidflags=$defvoidused
6204 echo "Good. It appears to support void to the level $package wants.">&4
6205 if $contains warning .out >/dev/null 2>&1; then
6206 echo "However, you might get some warnings that look like this:"
6207 $cat .out
6208 fi
6209 else
6210echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6211 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6212 echo "It supports 1..."
6213 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6214 echo "It also supports 2..."
6215 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6216 voidflags=7
6217 echo "And it supports 4 but not 8 definitely."
6218 else
6219 echo "It doesn't support 4..."
6220 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6221 voidflags=11
6222 echo "But it supports 8."
6223 else
6224 voidflags=3
6225 echo "Neither does it support 8."
6226 fi
6227 fi
6228 else
6229 echo "It does not support 2..."
6230 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6231 voidflags=13
6232 echo "But it supports 4 and 8."
6233 else
6234 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6235 voidflags=5
6236 echo "And it supports 4 but has not heard about 8."
6237 else
6238 echo "However it supports 8 but not 4."
6239 fi
6240 fi
6241 fi
6242 else
6243 echo "There is no support at all for void."
6244 voidflags=0
6245 fi
6246 fi
6247esac
6248case "$voidflags" in
6249"$defvoidused") ;;
6250*) $cat >&4 <<'EOM'
6251 Support flag bits are:
6252 1: basic void declarations.
6253 2: arrays of pointers to functions returning void.
6254 4: operations between pointers to and addresses of void functions.
6255 8: generic void pointers.
6256EOM
6257 dflt="$voidflags";
6258 rp="Your void support flags add up to what?"
6259 . ./myread
6260 voidflags="$ans"
6261 ;;
6262esac
6263$rm -f try.* .out
6264
6265: check for length of pointer
6266echo " "
6267case "$ptrsize" in
6268'')
6269 echo "Checking to see how big your pointers are..." >&4
6270 if test "$voidflags" -gt 7; then
6271 echo '#define VOID_PTR char *' > try.c
6272 else
6273 echo '#define VOID_PTR void *' > try.c
6274 fi
74d00865 6275 $cat >>try.c <<EOCP
c8b93cf9 6276#include <stdio.h>
d1daaddf
JH
6277#$i_stdlib I_STDLIB
6278#ifdef I_STDLIB
6279#include <stdlib.h>
6280#endif
c8b93cf9
JH
6281int main()
6282{
6283 printf("%d\n", (int)sizeof(VOID_PTR));
6284 exit(0);
6285}
6286EOCP
6287 set try
6288 if eval $compile_ok; then
6289 ptrsize=`$run ./try`
6290 echo "Your pointers are $ptrsize bytes long."
6291 else
6292 dflt='4'
6293 echo "(I can't seem to compile the test program. Guessing...)" >&4
6294 rp="What is the size of a pointer (in bytes)?"
6295 . ./myread
6296 ptrsize="$ans"
6297 fi
6298 ;;
6299esac
6300$rm -f try.c try
6301case "$use64bitall" in
6302"$define"|true|[yY]*)
6303 case "$ptrsize" in
6304 4) cat <<EOM >&4
6305
1911a026
JH
6306*** You have chosen a maximally 64-bit build,
6307*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6308*** Please rerun Configure without -Duse64bitall.
6309EOM
6310 case "$d_quad" in
6311 define)
6312 cat <<EOM >&4
6313*** Since you have quads, you could possibly try with -Duse64bitint.
6314EOM
6315 ;;
6316 esac
6317 cat <<EOM >&4
1911a026 6318*** Cannot continue, aborting.
c8b93cf9
JH
6319
6320EOM
09b58c7b 6321
1911a026 6322 exit 1
c8b93cf9
JH
6323 ;;
6324 esac
6325 ;;
6326esac
6327
19a100ff 6328
9df442c2
NC
6329: determine whether to use malloc wrapping
6330echo " "
6331case "$usemallocwrap" in
6332[yY]*|true|$define) dflt='y' ;;
6333[nN]*|false|$undef) dflt='n' ;;
6334*) case "$usedevel" in
6335 [yY]*|true|$define) dflt='y' ;;
6336 *) dflt='n' ;;
6337 esac
6338 ;;
6339esac
6340rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6341. ./myread
6342usemallocwrap="$ans"
6343case "$ans" in
6344y*|true)
6345 usemallocwrap="$define" ;;
6346*)
6347 usemallocwrap="$undef" ;;
6348esac
c8b93cf9 6349
b4eb6b3d
JH
6350: determine which malloc to compile in
6351echo " "
6352case "$usemymalloc" in
c4163172
JH
6353[yY]*|true|$define) dflt='y' ;;
6354[nN]*|false|$undef) dflt='n' ;;
6355*) case "$ptrsize" in
6356 4) dflt='y' ;;
6357 *) dflt='n' ;;
6358 esac
6359 ;;
8dfa8df9 6360esac
b4eb6b3d
JH
6361rp="Do you wish to attempt to use the malloc that comes with $package?"
6362. ./myread
6363usemymalloc="$ans"
6364case "$ans" in
6365y*|true)
6366 usemymalloc='y'
6367 mallocsrc='malloc.c'
6368 mallocobj="malloc$_o"
6369 d_mymalloc="$define"
6370 case "$libs" in
6371 *-lmalloc*)
6372 : Remove malloc from list of libraries to use
6373 echo "Removing unneeded -lmalloc from library list" >&4
6374 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6375 shift
6376 libs="$*"
6377 echo "libs = $libs" >&4
6378 ;;
6379 esac
6380 ;;
6381*)
6382 usemymalloc='n'
6383 mallocsrc=''
6384 mallocobj=''
6385 d_mymalloc="$undef"
6386 ;;
6387esac
6388
6389: compute the return types of malloc and free
6390echo " "
6391$cat >malloc.c <<END
6392#$i_malloc I_MALLOC
6393#$i_stdlib I_STDLIB
6394#include <stdio.h>
6395#include <sys/types.h>
6396#ifdef I_MALLOC
6397#include <malloc.h>
6398#endif
6399#ifdef I_STDLIB
6400#include <stdlib.h>
6401#endif
6402#ifdef TRY_MALLOC
6403void *malloc();
6404#endif
6405#ifdef TRY_FREE
6406void free();
6407#endif
6408END
6409case "$malloctype" in
6410'')
6411 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6412 malloctype='void *'
6413 else
6414 malloctype='char *'
6415 fi
6416 ;;
6417esac
6418echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6419
6420case "$freetype" in
6421'')
6422 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6423 freetype='void'
6424 else
6425 freetype='int'
6426 fi
6427 ;;
6428esac
6429echo "Your system uses $freetype free(), it would seem." >&4
6430$rm -f malloc.[co]
6431$cat <<EOM
6432
6433After $package is installed, you may wish to install various
6434add-on modules and utilities. Typically, these add-ons will
6435be installed under $prefix with the rest
6436of this package. However, you may wish to install such add-ons
6437elsewhere under a different prefix.
6438
6439If you do not wish to put everything under a single prefix, that's
6440ok. You will be prompted for the individual locations; this siteprefix
6441is only used to suggest the defaults.
6442
6443The default should be fine for most people.
6444
6445EOM
6446fn=d~+
6447rp='Installation prefix to use for add-on modules and utilities?'
6448: XXX Here might be another good place for an installstyle setting.
6449case "$siteprefix" in
6450'') dflt=$prefix ;;
6451*) dflt=$siteprefix ;;
6452esac
6453. ./getfile
6454: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6455oldsiteprefix=''
6456case "$siteprefix" in
6457'') ;;
6458*) case "$ans" in
6459 "$prefix") ;;
6460 *) oldsiteprefix="$prefix";;
6461 esac
6462 ;;
6463esac
6464siteprefix="$ans"
6465siteprefixexp="$ansexp"
6466
6467: determine where site specific libraries go.
6468: Usual default is /usr/local/lib/perl5/site_perl/$version
6469: The default "style" setting is made in installstyle.U
6470: XXX No longer works with Prefixit stuff.
6471prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6472case "$sitelib" in
6473'') case "$installstyle" in
6474 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6475 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6476 esac
6477 ;;
6478*) dflt="$sitelib"
6479 ;;
6480esac
6481$cat <<EOM
6482
6483The installation process will create a directory for
6484site-specific extensions and modules. Most users find it convenient
6485to place all site-specific files in this directory rather than in the
6486main distribution directory.
6487
6488EOM
6489fn=d~+
6490rp='Pathname for the site-specific library files?'
6491. ./getfile
6492sitelib="$ans"
6493sitelibexp="$ansexp"
6494sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6495: Change installation prefix, if necessary.
6496if $test X"$prefix" != X"$installprefix"; then
6497 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6498else
6499 installsitelib="$sitelibexp"
6500fi
6501
6502: determine where site specific architecture-dependent libraries go.
6503: sitelib default is /usr/local/lib/perl5/site_perl/$version
6504: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6505: sitelib may have an optional trailing /share.
6506case "$sitearch" in
6507'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6508 dflt="$dflt/$archname"
6509 ;;
6510*) dflt="$sitearch"
6511 ;;
6512esac
6513set sitearch sitearch none
6514eval $prefixit
6515$cat <<EOM
6516
6517The installation process will also create a directory for
6518architecture-dependent site-specific extensions and modules.
6519
6520EOM
6521fn=d~+
6522rp='Pathname for the site-specific architecture-dependent library files?'
6523. ./getfile
6524sitearch="$ans"
6525sitearchexp="$ansexp"
6526: Change installation prefix, if necessary.
6527if $test X"$prefix" != X"$installprefix"; then
6528 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6529else
6530 installsitearch="$sitearchexp"
6531fi
6532
6533$cat <<EOM
6534
6535The installation process will also create a directory for
6536vendor-supplied add-ons. Vendors who supply perl with their system
6537may find it convenient to place all vendor-supplied files in this
6538directory rather than in the main distribution directory. This will
6539ease upgrades between binary-compatible maintenance versions of perl.
6540
6541Of course you may also use these directories in whatever way you see
6542fit. For example, you might use them to access modules shared over a
6543company-wide network.
6544
6545The default answer should be fine for most people.
6546This causes further questions about vendor add-ons to be skipped
6547and no vendor-specific directories will be configured for perl.
6548
6549EOM
6550rp='Do you want to configure vendor-specific add-on directories?'
6551case "$usevendorprefix" in
6552define|true|[yY]*) dflt=y ;;
6553*) : User may have set vendorprefix directly on Configure command line.
6554 case "$vendorprefix" in
6555 ''|' ') dflt=n ;;
6556 *) dflt=y ;;
6557 esac
6558 ;;
6559esac
6560. ./myread
6561case "$ans" in
6562[yY]*) fn=d~+
6563 rp='Installation prefix to use for vendor-supplied add-ons?'
6564 case "$vendorprefix" in
6565 '') dflt='' ;;
6566 *) dflt=$vendorprefix ;;
6567 esac
6568 . ./getfile
6569 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6570 oldvendorprefix=''
6571 case "$vendorprefix" in
6572 '') ;;
6573 *) case "$ans" in
6574 "$prefix") ;;
6575 *) oldvendorprefix="$prefix";;
6576 esac
6577 ;;
6578 esac
6579 usevendorprefix="$define"
6580 vendorprefix="$ans"
6581 vendorprefixexp="$ansexp"
6582 ;;
6583*) usevendorprefix="$undef"
6584 vendorprefix=''
6585 vendorprefixexp=''
6586 ;;
6587esac
6588
6589case "$vendorprefix" in
6590'') d_vendorlib="$undef"
6591 vendorlib=''
6592 vendorlibexp=''
6593 ;;
6594*) d_vendorlib="$define"
6595 : determine where vendor-supplied modules go.
6596 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6597 case "$vendorlib" in
6598 '')
6599 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6600 case "$installstyle" in
6601 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6602 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6603 esac
6604 ;;
6605 *) dflt="$vendorlib"
6606 ;;
6607 esac
6608 fn=d~+
6609 rp='Pathname for the vendor-supplied library files?'
6610 . ./getfile
6611 vendorlib="$ans"
6612 vendorlibexp="$ansexp"
6613 ;;
6614esac
6615vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6616: Change installation prefix, if necessary.
6617if $test X"$prefix" != X"$installprefix"; then
6618 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6619else
6620 installvendorlib="$vendorlibexp"
6621fi
6622
6623case "$vendorprefix" in
6624'') d_vendorarch="$undef"
6625 vendorarch=''
6626 vendorarchexp=''
6627 ;;
6628*) d_vendorarch="$define"
6629 : determine where vendor-supplied architecture-dependent libraries go.
6630 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6631 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6632 : vendorlib may have an optional trailing /share.
6633 case "$vendorarch" in
6634 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6635 dflt="$dflt/$archname"
6636 ;;
6637 *) dflt="$vendorarch" ;;
6638 esac
6639 fn=d~+
6640 rp='Pathname for vendor-supplied architecture-dependent files?'
6641 . ./getfile
6642 vendorarch="$ans"
6643 vendorarchexp="$ansexp"
6644 ;;
6645esac
6646: Change installation prefix, if necessary.
6647if $test X"$prefix" != X"$installprefix"; then
6648 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6649else
6650 installvendorarch="$vendorarchexp"
6651fi
6652
6653: Final catch-all directories to search
6654$cat <<EOM
6655
6656Lastly, you can have perl look in other directories for extensions and
6657modules in addition to those already specified.
6658These directories will be searched after
6659 $sitearch
6660 $sitelib
6661EOM
6662test X"$vendorlib" != "X" && echo ' ' $vendorlib
6663test X"$vendorarch" != "X" && echo ' ' $vendorarch
6664echo ' '
6665case "$otherlibdirs" in
6666''|' ') dflt='none' ;;
6667*) dflt="$otherlibdirs" ;;
6668esac
6669$cat <<EOM
6670Enter a colon-separated set of extra paths to include in perl's @INC
6671search path, or enter 'none' for no extra paths.
6672
6673EOM
6674
6675rp='Colon-separated list of additional directories for perl to search?'
6676. ./myread
6677case "$ans" in
6678' '|''|none) otherlibdirs=' ' ;;
6679*) otherlibdirs="$ans" ;;
6680esac
6681case "$otherlibdirs" in
6682' ') val=$undef ;;
6683*) val=$define ;;
6684esac
6685set d_perl_otherlibdirs
6686eval $setvar
6687
6688: Cruising for prototypes
6689echo " "
6690echo "Checking out function prototypes..." >&4
55954f19
JH
6691$cat >prototype.c <<EOCP
6692#$i_stdlib I_STDLIB
6693#ifdef I_STDLIB
6694#include <stdlib.h>
6695#endif
b4eb6b3d
JH
6696int main(int argc, char *argv[]) {
6697 exit(0);}
6698EOCP
6699if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6700 echo "Your C compiler appears to support function prototypes."
6701 val="$define"
6702else
6703 echo "Your C compiler doesn't seem to understand function prototypes."
6704 val="$undef"
6705fi
6706set prototype
6707eval $setvar
6708$rm -f prototype*
6709
6710case "$prototype" in
6711"$define") ;;
6712*) ansi2knr='ansi2knr'
6713 echo " "
6714 cat <<EOM >&4
6715
6716$me: FATAL ERROR:
6717This version of $package can only be compiled by a compiler that
6718understands function prototypes. Unfortunately, your C compiler
6719 $cc $ccflags
6720doesn't seem to understand them. Sorry about that.
6721
6722If GNU cc is available for your system, perhaps you could try that instead.
6723
6724Eventually, we hope to support building Perl with pre-ANSI compilers.
6725If you would like to help in that effort, please contact <perlbug@perl.org>.
6726
6727Aborting Configure now.
6728EOM
6729 exit 2
6730 ;;
6731esac
6732
6733: determine where public executables go
6734echo " "
6735set dflt bin bin
6736eval $prefixit
6737fn=d~
6738rp='Pathname where the public executables will reside?'
6739. ./getfile
6740if $test "X$ansexp" != "X$binexp"; then
6741 installbin=''
6742fi
6743bin="$ans"
6744binexp="$ansexp"
6745: Change installation prefix, if necessary.
6746: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6747if $test X"$prefix" != X"$installprefix"; then
6748 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6749else
6750 installbin="$binexp"
6751fi
6752
6fcddf3b 6753echo " "
6fcddf3b 6754case "$extras" in
bf35c3f6
JH
6755'') dflt='n';;
6756*) dflt='y';;
6fcddf3b
JH
6757esac
6758cat <<EOM
6759Perl can be built with extra modules or bundles of modules which
6760will be fetched from the CPAN and installed alongside Perl.
6761
6762Notice that you will need access to the CPAN; either via the Internet,
6763or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6764be asked later to configure the CPAN.pm module which will in turn do
6765the installation of the rest of the extra modules or bundles.)
6766
6767Notice also that if the modules require any external software such as
dd2de242
JH
6768libraries and headers (the libz library and the zlib.h header for the
6769Compress::Zlib module, for example) you MUST have any such software
6770already installed, this configuration process will NOT install such
6771things for you.
6fcddf3b
JH
6772
6773If this doesn't make any sense to you, just accept the default '$dflt'.
6774EOM
dd2de242 6775rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6776. ./myread
6777case "$ans" in
6778y|Y)
6779 cat <<EOM
6780
6781Please list any extra modules or bundles to be installed from CPAN,
6782with spaces between the names. The names can be in any format the
dd2de242
JH
6783'install' command of CPAN.pm will understand. (Answer 'none',
6784without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6785EOM
6786 rp='Extras?'
6787 dflt="$extras"
6788 . ./myread
6789 extras="$ans"
6790esac
6791case "$extras" in
6792''|'none')
6793 val=''
6794 $rm -f ../extras.lst
6795 ;;
6796*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6797 echo "$extras" > ../extras.lst
6798 val="'$extras'"
6fcddf3b
JH
6799 ;;
6800esac
6801set extras
6802eval $setvar
6803echo " "
6804
6e1038e0
MB
6805: determine where html pages for programs go
6806set html1dir html1dir none
6807eval $prefixit
6808$cat <<EOM
6809
6810If you wish to install html files for programs in $spackage, indicate
6811the appropriate directory here. To skip installing html files,
6812answer "none".
6813EOM
6814case "$html1dir" in
6815''|none|$undef|' ') dflt=none ;;
6816*) dflt=$html1dir ;;
6817esac
6818fn=dn+~
6819rp="Directory for the main $spackage html pages?"
6820. ./getfile
6821html1dir="$ans"
6822html1direxp="$ansexp"
6823: Use ' ' for none so value is preserved next time through Configure
6824$test X"$html1dir" = "X" && html1dir=' '
6825: Change installation prefix, if necessary.
6826if $test X"$prefix" != X"$installprefix"; then
6827 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6828else
6829 installhtml1dir="$html1direxp"
6830fi
6831
6832: determine where html pages for libraries and modules go
6833set html3dir html3dir none
6834eval $prefixit
6835$cat <<EOM
6836
6837If you wish to install html files for modules associated with $spackage,
6838indicate the appropriate directory here. To skip installing html files,
6839answer "none".
6840EOM
6841: There is no obvious default. If they have specified html1dir, then
6842: try to key off that, possibly changing .../html1 into .../html3.
6843case "$html3dir" in
6844'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6845*) dflt=$html3dir ;;
6846esac
6847fn=dn+~
6848rp="Directory for the $spackage module html pages?"
6849. ./getfile
6850html3dir="$ans"
6851html3direxp="$ansexp"
6852: Use ' ' for none so value is preserved next time through Configure
6853$test X"$html3dir" = "X" && html3dir=' '
6854: Change installation prefix, if necessary.
6855if $test X"$prefix" != X"$installprefix"; then
6856 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6857else
6858 installhtml3dir="$html3direxp"
6859fi
6860
b4eb6b3d
JH
6861: Find perl5.005 or later.
6862echo "Looking for a previously installed perl5.005 or later... "
6863case "$perl5" in
a938a3bb 6864'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6865 : Check if this perl is recent and can load a simple module
a938a3bb 6866 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6867 perl5=$tdir/perl
6868 break;
a938a3bb
IZ
6869 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6870 perl5=$tdir/perl5
b4eb6b3d
JH
6871 break;
6872 fi
89ce900e
JH
6873 done
6874 ;;
6875*) perl5="$perl5"
6876 ;;
6877esac
6878case "$perl5" in
6879'') echo "None found. That's ok.";;
6880*) echo "Using $perl5." ;;
6881esac
6882
6883: Determine list of previous versions to include in @INC
6884$cat > getverlist <<EOPL
6885#!$perl5 -w
6886use File::Basename;
6887\$api_versionstring = "$api_versionstring";
6888\$version = "$version";
6889\$stem = "$sitelib_stem";
6890\$archname = "$archname";
6891EOPL
6892 $cat >> getverlist <<'EOPL'
6893# Can't have leading @ because metaconfig interprets it as a command!
6894;@inc_version_list=();
6895# XXX Redo to do opendir/readdir?
6896if (-d $stem) {
6897 chdir($stem);
6898 ;@candidates = glob("5.*");
6899}
6900else {
6901 ;@candidates = ();
6902}
6903
6904# XXX ToDo: These comparisons must be reworked when two-digit
6905# subversions come along, so that 5.7.10 compares as greater than
6906# 5.7.3! By that time, hope that 5.6.x is sufficiently
6907# widespread that we can use the built-in version vectors rather
6908# than reinventing them here. For 5.6.0, however, we must
6909# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6910foreach $d (@candidates) {
6911 if ($d lt $version) {
6912 if ($d ge $api_versionstring) {
6913 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6914 }
6915 elsif ($d ge "5.005") {
6916 unshift(@inc_version_list, grep { -d } $d);
6917 }
6918 }
6919 else {
6920 # Skip newer version. I.e. don't look in
6921 # 5.7.0 if we're installing 5.6.1.
6922 }
6923}
6924
6925if (@inc_version_list) {
6926 print join(' ', @inc_version_list);
6927}
6928else {
6929 # Blank space to preserve value for next Configure run.
6930 print " ";
6931}
6932EOPL
6933chmod +x getverlist
6934case "$inc_version_list" in
6935'') if test -x "$perl5$exe_ext"; then
6936 dflt=`$perl5 getverlist`
6937 else
6938 dflt='none'
6939 fi
6940 ;;
6941$undef) dflt='none' ;;
6942*) eval dflt=\"$inc_version_list\" ;;
6943esac
6944case "$dflt" in
6945''|' ') dflt=none ;;
6946esac
6947case "$dflt" in
69485.005) dflt=none ;;
6949esac
6950$cat <<EOM
6951
6952In order to ease the process of upgrading, this version of perl
6953can be configured to use modules built and installed with earlier
6954versions of perl that were installed under $prefix. Specify here
6955the list of earlier versions that this version of perl should check.
6956If Configure detected no earlier versions of perl installed under
6957$prefix, then the list will be empty. Answer 'none' to tell perl
6958to not search earlier versions.
6959
6960The default should almost always be sensible, so if you're not sure,
6961just accept the default.
6962EOM
6963
6964rp='List of earlier versions to include in @INC?'
6965. ./myread
6966case "$ans" in
d2556f21 6967[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
89ce900e
JH
6968*) inc_version_list="$ans" ;;
6969esac
6970case "$inc_version_list" in
6971''|' ')
6972 inc_version_list_init='0';;
6973*) inc_version_list_init=`echo $inc_version_list |
6974 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6975 ;;
6976esac
6977$rm -f getverlist
6978
6979: determine whether to install perl also as /usr/bin/perl
6980
6981echo " "
6982if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6983 $cat <<EOM
6984Many scripts expect perl to be installed as /usr/bin/perl.
6985
6986If you want to, I can install the perl you are about to compile
6987as /usr/bin/perl (in addition to $bin/perl).
6988EOM
6989 if test -f /usr/bin/perl; then
6990 $cat <<EOM
6991
6992However, please note that because you already have a /usr/bin/perl,
6993overwriting that with a new Perl would very probably cause problems.
6994Therefore I'm assuming you don't want to do that (unless you insist).
6995
6996EOM
6997 case "$installusrbinperl" in
6998 "$define"|[yY]*) dflt='y';;
6999 *) dflt='n';;
7000 esac
7001 else
7002 $cat <<EOM
7003
7004Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7005
7006EOM
7007 case "$installusrbinperl" in
7008 "$undef"|[nN]*) dflt='n';;
7009 *) dflt='y';;
7010 esac
7011 fi
7012 rp="Do you want to install perl as /usr/bin/perl?"
7013 . ./myread
7014 case "$ans" in
7015 [yY]*) val="$define";;
7016 *) val="$undef" ;;
7017 esac
7018else
7019 val="$undef"
7020fi
7021set installusrbinperl
7022eval $setvar
7023
7024echo " "
7025echo "Checking for GNU C Library..." >&4
7026cat >try.c <<'EOCP'
7027/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7028 alone are insufficient to distinguish different versions, such as
7029 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7030 libc version 2.1.0. A. Dougherty, June 3, 2002.
7031*/
7032#include <stdio.h>
7033int main(void)
7034{
7035#ifdef __GLIBC__
7036# ifdef __GLIBC_MINOR__
7037# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7038# include <gnu/libc-version.h>
7039 printf("%s\n", gnu_get_libc_version());
7040# else
7041 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7042# endif
7043# else
7044 printf("%d\n", __GLIBC__);
7045# endif
7046 return 0;
7047#else
7048 return 1;
7049#endif
7050}
7051EOCP
7052set try
7053if eval $compile_ok && $run ./try > glibc.ver; then
7054 val="$define"
7055 gnulibc_version=`$cat glibc.ver`
7056 echo "You are using the GNU C Library version $gnulibc_version"
7057else
7058 val="$undef"
7059 gnulibc_version=''
7060 echo "You are not using the GNU C Library"
7061fi
7062$rm -f try try.* glibc.ver
7063set d_gnulibc
7064eval $setvar
7065
7066: see if nm is to be used to determine whether a symbol is defined or not
7067case "$usenm" in
7068'')
7069 dflt=''
7070 case "$d_gnulibc" in
7071 "$define")
7072 echo " "
7073 echo "nm probably won't work on the GNU C Library." >&4
7074 dflt=n
7075 ;;
7076 esac
7077 case "$dflt" in
7078 '')
7079 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7080 echo " "
7081 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7082 echo "'nm' won't be sufficient on this sytem." >&4
7083 dflt=n
7084 fi
7085 ;;
7086 esac
7087 case "$dflt" in
7088 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7089 if $test $dflt -gt 20; then
7090 dflt=y
7091 else
7092 dflt=n
7093 fi
7094 ;;
7095 esac
b4eb6b3d 7096 ;;
89ce900e
JH
7097*)
7098 case "$usenm" in
7099 true|$define) dflt=y;;
7100 *) dflt=n;;
7101 esac
b4eb6b3d
JH
7102 ;;
7103esac
89ce900e 7104$cat <<EOM
b4eb6b3d 7105
89ce900e
JH
7106I can use $nm to extract the symbols from your C libraries. This
7107is a time consuming task which may generate huge output on the disk (up
7108to 3 megabytes) but that should make the symbols extraction faster. The
7109alternative is to skip the 'nm' extraction part and to compile a small
7110test program instead to determine whether each symbol is present. If
7111you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7112this may be the best solution.
b4eb6b3d 7113
89ce900e 7114You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7115
89ce900e
JH
7116EOM
7117rp="Shall I use $nm to extract C symbols from the libraries?"
7118. ./myread
7119case "$ans" in
7120[Nn]*) usenm=false;;
7121*) usenm=true;;
b4eb6b3d 7122esac
89ce900e
JH
7123
7124runnm=$usenm
7125case "$reuseval" in
7126true) runnm=false;;
b4eb6b3d 7127esac
b4eb6b3d 7128
89ce900e
JH
7129: nm options which may be necessary
7130case "$nm_opt" in
7131'') if $test -f /mach_boot; then
7132 nm_opt='' # Mach
7133 elif $test -d /usr/ccs/lib; then
7134 nm_opt='-p' # Solaris (and SunOS?)
7135 elif $test -f /dgux; then
7136 nm_opt='-p' # DG-UX
7137 elif $test -f /lib64/rld; then
7138 nm_opt='-p' # 64-bit Irix
7139 else
7140 nm_opt=''
7141 fi;;
7142esac
b4eb6b3d 7143
89ce900e
JH
7144: nm options which may be necessary for shared libraries but illegal
7145: for archive libraries. Thank you, Linux.
7146case "$nm_so_opt" in
7147'') case "$myuname" in
fb2e1bc0 7148 *linux*|gnu*)
89ce900e
JH
7149 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7150 nm_so_opt='--dynamic'
7151 fi
7152 ;;
7153 esac
7154 ;;
7155esac
b4eb6b3d 7156
89ce900e
JH
7157case "$runnm" in
7158true)
7159: get list of predefined functions in a handy place
7160echo " "
7161case "$libc" in
7162'') libc=unknown
7163 case "$libs" in
7164 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7165 esac
7166 ;;
b4eb6b3d 7167esac
89ce900e
JH
7168case "$libs" in
7169'') ;;
7170*) for thislib in $libs; do
7171 case "$thislib" in
7172 -lc|-lc_s)
7173 : Handle C library specially below.
7174 ;;
7175 -l*)
7176 thislib=`echo $thislib | $sed -e 's/^-l//'`
7177 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7178 :
7179 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7180 :
7181 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7182 :
7183 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7184 :
7185 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7186 :
7187 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7188 :
7189 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7190 :
7191 else
7192 try=''
7193 fi
7194 libnames="$libnames $try"
7195 ;;
7196 *) libnames="$libnames $thislib" ;;
7197 esac
7198 done
b4eb6b3d
JH
7199 ;;
7200esac
89ce900e
JH
7201xxx=normal
7202case "$libc" in
7203unknown)
7204 set /lib/libc.$so
7205 for xxx in $libpth; do
7206 $test -r $1 || set $xxx/libc.$so
7207 : The messy sed command sorts on library version numbers.
7208 $test -r $1 || \
7209 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7210 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7211 h
7212 s/[0-9][0-9]*/0000&/g
7213 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7214 G
7215 s/\n/ /' | \
7216 $sort | $sed -e 's/^.* //'`
7217 eval set \$$#
7218 done
7219 $test -r $1 || set /usr/ccs/lib/libc.$so
7220 $test -r $1 || set /lib/libsys_s$_a
7221 ;;
7222*)
7223 set blurfl
7224 ;;
7225esac
7226if $test -r "$1"; then
7227 echo "Your (shared) C library seems to be in $1."
7228 libc="$1"
7229elif $test -r /lib/libc && $test -r /lib/clib; then
7230 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7231 xxx=apollo
7232 libc='/lib/clib /lib/libc'
7233 if $test -r /lib/syslib; then
7234 echo "(Your math library is in /lib/syslib.)"
7235 libc="$libc /lib/syslib"
7236 fi
7237elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7238 echo "Your C library seems to be in $libc, as you said before."
7239elif $test -r $incpath/usr/lib/libc$_a; then
7240 libc=$incpath/usr/lib/libc$_a;
7241 echo "Your C library seems to be in $libc. That's fine."
7242elif $test -r /lib/libc$_a; then
7243 libc=/lib/libc$_a;
7244 echo "Your C library seems to be in $libc. You're normal."
7245else
7246 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7247 :
7248 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7249 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7250 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7251 :
7252 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7253 :
7254 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7255 :
7256 else
7257 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7258 fi
7259 if $test -r "$tans"; then
7260 echo "Your C library seems to be in $tans, of all places."
7261 libc=$tans
7262 else
7263 libc='blurfl'
7264 fi
7265fi
7266if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7267 dflt="$libc"
7268 cat <<EOM
b4eb6b3d 7269
89ce900e
JH
7270If the guess above is wrong (which it might be if you're using a strange
7271compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7272
89ce900e
JH
7273EOM
7274else
7275 dflt=''
7276 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7277 cat >&4 <<EOM
7278I can't seem to find your C library. I've looked in the following places:
5e366f65 7279
b4eb6b3d 7280EOM
89ce900e
JH
7281 $sed 's/^/ /' libpath
7282 cat <<EOM
5e366f65 7283
89ce900e 7284None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7285
7286EOM
89ce900e
JH
7287fi
7288fn=f
7289rp='Where is your C library?'
7290. ./getfile
7291libc="$ans"
5e366f65 7292
89ce900e
JH
7293echo " "
7294echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7295set X `cat libnames`
7296shift
7297xxx=files
7298case $# in 1) xxx=file; esac
7299echo "Extracting names from the following $xxx for later perusal:" >&4
7300echo " "
7301$sed 's/^/ /' libnames >&4
7302echo " "
7303$echo $n "This may take a while...$c" >&4
5e366f65 7304
89ce900e
JH
7305for file in $*; do
7306 case $file in
7307 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7308 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7309 esac
89ce900e
JH
7310done >libc.tmp
7311
7312$echo $n ".$c"
7313$grep fprintf libc.tmp > libc.ptf
7314xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7315xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7316xxx='[ADTSIW]'
ab900c53 7317if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7318 eval $xscan;\
7319 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7320 eval $xrun
7321elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7322 eval $xscan;\
7323 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7324 eval $xrun
7325elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7326 eval $xscan;\
7327 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328 eval $xrun
7329elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7330 eval $xscan;\
7331 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332 eval $xrun
7333elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7334 eval $xscan;\
7335 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336 eval $xrun
7337elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7338 eval $xscan;\
7339 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340 eval $xrun
7341elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7342 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7343 eval $xscan;\
7344 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7345 eval $xrun
7346elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7347 eval $xscan;\
7348 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7349 eval $xrun
7350elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7351 eval $xscan;\
7352 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7353 eval $xrun
7354elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7355 eval $xscan;\
7356 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7357 eval $xrun
7358elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7359 eval $xscan;\
7360 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7361 eval $xrun
7362elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7363 eval $xscan;\
7364 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7365 eval $xrun
7366elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7367 eval $xscan;\
7368 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7369 eval $xrun
7370elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7371 eval $xscan;\
7372 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7373 eval $xrun
b4eb6b3d 7374else
89ce900e
JH
7375 $nm -p $* 2>/dev/null >libc.tmp
7376 $grep fprintf libc.tmp > libc.ptf
7377 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7378 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7379 then
7380 nm_opt='-p'
7381 eval $xrun
7382 else
7383 echo " "
7384 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7385 com=''
7386 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7387 for thisname in $libnames $libc; do
7388 $ar t $thisname >>libc.tmp
7389 done
7390 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7391 echo "Ok." >&4
7392 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7393 # Repeat libc to extract forwarders to DLL entries too
7394 for thisname in $libnames $libc; do
7395 $ar tv $thisname >>libc.tmp
7396 # Revision 50 of EMX has bug in $ar.
7397 # it will not extract forwarders to DLL entries
7398 # Use emximp which will extract exactly them.
7399 emximp -o tmp.imp $thisname \
7400 2>/dev/null && \
7401 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7402 < tmp.imp >>libc.tmp
7403 $rm tmp.imp
7404 done
7405 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7406 echo "Ok." >&4
7407 else
7408 echo "$ar didn't seem to work right." >&4
7409 echo "Maybe this is a Cray...trying bld instead..." >&4
7410 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7411 then
7412 for thisname in $libnames; do
7413 bld t $libnames | \
7414 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7415 $ar t $thisname >>libc.tmp
7416 done
7417 echo "Ok." >&4
7418 else
7419 echo "That didn't work either. Giving up." >&4
7420 exit 1
7421 fi
7422 fi
7423 fi
b4eb6b3d 7424fi
89ce900e
JH
7425nm_extract="$com"
7426case "$PASE" in
7427define)
7428 echo " "
7429 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7430 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7431 ;;
7432*) if $test -f /lib/syscalls.exp; then
7433 echo " "
7434 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7435 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7436 fi
7437 ;;
7438esac
7439;;
7440esac
7441$rm -f libnames libpath
b4eb6b3d
JH
7442
7443: see if dld is available
7444set dld.h i_dld
7445eval $inhdr
7446
89ce900e
JH
7447: is a C symbol defined?
7448csym='tlook=$1;
7449case "$3" in
373dfab3
JH
7450-v) tf=libc.tmp; tdc="";;
7451-a) tf=libc.tmp; tdc="[]";;
7452*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7453esac;
7454tx=yes;
7455case "$reuseval-$4" in
7456true-) ;;
7457true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7458esac;
7459case "$tx" in
7460yes)
ab900c53 7461 tval=false;
5129fff4
JH
7462 if $test "$runnm" = true; then
7463 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7464 tval=true;
5129fff4 7465 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7466 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7467 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7468 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7469 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7470 fi;
5129fff4 7471 else
373dfab3 7472 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7473 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7474 $rm -f try$_exe try.c;
ab900c53
AB
7475 fi;
7476 ;;
89ce900e
JH
7477*)
7478 case "$tval" in
7479 $define) tval=true;;
7480 *) tval=false;;
ab900c53
AB
7481 esac;
7482 ;;
89ce900e
JH
7483esac;
7484eval "$2=$tval"'
7485
7486: define an is-in-libc? function
7487inlibc='echo " "; td=$define; tu=$undef;
7488sym=$1; var=$2; eval "was=\$$2";
7489tx=yes;
7490case "$reuseval$was" in
7491true) ;;
7492true*) tx=no;;
7493esac;
7494case "$tx" in
7495yes)
7496 set $sym tres -f;
7497 eval $csym;
7498 case "$tres" in
7499 true)
7500 echo "$sym() found." >&4;
7501 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7502 *)
7503 echo "$sym() NOT found." >&4;
7504 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7505 esac;;
7506*)
7507 case "$was" in
7508 $define) echo "$sym() found." >&4;;
7509 *) echo "$sym() NOT found." >&4;;
7510 esac;;
7511esac'
7512
b4eb6b3d
JH
7513: see if dlopen exists
7514xxx_runnm="$runnm"
7515runnm=false
7516set dlopen d_dlopen
7517eval $inlibc
7518runnm="$xxx_runnm"
7519
7520: determine which dynamic loading, if any, to compile in
7521echo " "
7522dldir="ext/DynaLoader"
7523case "$usedl" in
7524$define|y|true)
7525 dflt='y'
7526 usedl="$define"
7527 ;;
7528$undef|n|false)
7529 dflt='n'
7530 usedl="$undef"
7531 ;;
7532*)
7533 dflt='n'
7534 case "$d_dlopen" in
7535 $define) dflt='y' ;;
7536 esac
7537 case "$i_dld" in
7538 $define) dflt='y' ;;
7539 esac
7540 : Does a dl_xxx.xs file exist for this operating system
7541 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7542 ;;
7543esac
7544rp="Do you wish to use dynamic loading?"
7545. ./myread
7546usedl="$ans"
7547case "$ans" in
7548y*) usedl="$define"
7549 case "$dlsrc" in
7550 '')
7551 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7552 dflt="$dldir/dl_${osname}.xs"
7553 elif $test "$d_dlopen" = "$define" ; then
7554 dflt="$dldir/dl_dlopen.xs"
7555 elif $test "$i_dld" = "$define" ; then
7556 dflt="$dldir/dl_dld.xs"
7557 else
7558 dflt=''
7559 fi
7560 ;;
7561 *) dflt="$dldir/$dlsrc"
7562 ;;
7563 esac
7564 echo "The following dynamic loading files are available:"
7565 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7566 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7567 rp="Source file to use for dynamic loading"
7568 fn="fne"
7569 gfpth="$src"
7570 . ./getfile
7571 usedl="$define"
7572 : emulate basename
7573 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7574
7575 $cat << EOM
7576
7577Some systems may require passing special flags to $cc -c to
7578compile modules that will be used to create a shared library.
7579To use no flags, say "none".
7580
7581EOM
7582 case "$cccdlflags" in
7583 '') case "$gccversion" in
7584 '') case "$osname" in
7585 hpux) dflt='+z' ;;
7586 next) dflt='none' ;;
7587 irix*) dflt='-KPIC' ;;
48bcfe03 7588 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7589 sunos) dflt='-pic' ;;
7590 *) dflt='none' ;;
7591 esac
7592 ;;
7593 *) case "$osname" in
b6cc0f4c 7594 darwin) dflt='none' ;;
48bcfe03 7595 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7596 *) dflt='-fpic' ;;
7597 esac ;;
7598 esac ;;
7599 ' ') dflt='none' ;;
7600 *) dflt="$cccdlflags" ;;
7601 esac
7602 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7603 . ./myread
7604 case "$ans" in
7605 none) cccdlflags=' ' ;;
7606 *) cccdlflags="$ans" ;;
7607 esac
7608
7609 cat << EOM
7610
7611Some systems use ld to create libraries that can be dynamically loaded,
7612while other systems (such as those using ELF) use $cc.
7613
7614EOM
7615 case "$ld" in
55954f19 7616 '') $cat >try.c <<EOM
b4eb6b3d
JH
7617/* Test for whether ELF binaries are produced */
7618#include <fcntl.h>
55954f19
JH
7619#$i_stdlib I_STDLIB
7620#ifdef I_STDLIB
b4eb6b3d 7621#include <stdlib.h>
55954f19 7622#endif
b4eb6b3d
JH
7623int main() {
7624 char b[4];
7625 int i = open("a.out",O_RDONLY);
7626 if(i == -1)
7627 exit(1); /* fail */
7628 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7629 exit(0); /* succeed (yes, it's ELF) */
7630 else
7631 exit(1); /* fail */
7632}
7633EOM
5440bc8e 7634 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7635 cat <<EOM
7636You appear to have ELF support. I'll use $cc to build dynamic libraries.
7637EOM
7638 dflt="$cc"
7639 else
7640 echo "I'll use ld to build dynamic libraries."
7641 dflt='ld'
7642 fi
7643 rm -f try.c a.out
7644 ;;
7645 *) dflt="$ld"
7646 ;;
7647 esac
7648
7649 rp="What command should be used to create dynamic libraries?"
7650 . ./myread
7651 ld="$ans"
7652
7653 cat << EOM
7654
7655Some systems may require passing special flags to $ld to create a
7656library that can be dynamically loaded. If your ld flags include
7657-L/other/path options to locate libraries outside your loader's normal
7658search path, you may need to specify those -L options here as well. To
7659use no flags, say "none".
7660
7661EOM
7662 case "$lddlflags" in
7663 '') case "$osname" in
7664 beos) dflt='-nostart' ;;
7665 hpux) dflt='-b';
7666 case "$gccversion" in
7667 '') dflt="$dflt +vnocompatwarnings" ;;
7668 esac
7669 ;;
fb2e1bc0 7670 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7671 next) dflt='none' ;;
7672 solaris) dflt='-G' ;;
7673 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7674 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7675 *) dflt='none' ;;
7676 esac
7677 ;;
7678 *) dflt="$lddlflags" ;;
7679 esac
7680
7681 : Try to guess additional flags to pick up local libraries.
7682 : Be careful not to append to a plain 'none'
7683 case "$dflt" in
7684 none) dflt='' ;;
7685 esac
7686 for thisflag in $ldflags; do
7687 case "$thisflag" in
b5b9f165 7688 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7689 case " $dflt " in
7690 *" $thisflag "*) ;;
7691 *) dflt="$dflt $thisflag" ;;
7692 esac
7693 ;;
7694 esac
7695 done
7696
7697 case "$dflt" in
7698 ''|' ') dflt='none' ;;
7699 esac
7700
7701 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7702 . ./myread
7703 case "$ans" in
7704 none) lddlflags=' ' ;;
7705 *) lddlflags="$ans" ;;
7706 esac
7707
7708 cat <<EOM
7709
7710Some systems may require passing special flags to $cc to indicate that
7711the resulting executable will use dynamic linking. To use no flags,
7712say "none".
7713
7714EOM
7715 case "$ccdlflags" in
7716 '') case "$osname" in
fb2e1bc0 7717 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7718 next|sunos) dflt='none' ;;
7719 *) dflt='none' ;;
b4eb6b3d
JH
7720 esac ;;
7721 ' ') dflt='none' ;;
7722 *) dflt="$ccdlflags" ;;
7723 esac
7724 rp="Any special flags to pass to $cc to use dynamic linking?"
7725 . ./myread
7726 case "$ans" in
7727 none) ccdlflags=' ' ;;
7728 *) ccdlflags="$ans" ;;
7729 esac
7730 ;;
7731*) usedl="$undef"
7732 ld='ld'
7733 dlsrc='dl_none.xs'
7734 lddlflags=''
7735 ccdlflags=''
7736 ;;
7737esac
7738
7739also=''
7740case "$usedl" in
7741$undef)
7742 # No dynamic loading being used, so don't bother even to prompt.
7743 useshrplib='false'
7744 ;;
7745*) case "$useshrplib" in
7746 '') case "$osname" in
48bcfe03 7747 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7748 dflt=y
7749 also='Building a shared libperl is required for dynamic loading to work on your system.'
7750 ;;
7751 next*)
7752 case "$osvers" in
7753 4*) dflt=y
7754 also='Building a shared libperl is needed for MAB support.'
7755 ;;
7756 *) dflt=n
7757 ;;
7758 esac
7759 ;;
7760 *) dflt=n
7761 ;;
7762 esac
7763 ;;
7764 $define|true|[Yy]*)
7765 dflt=y
7766 ;;
7767 *) dflt=n
7768 ;;
7769 esac
7770 $cat << EOM
7771
7772The perl executable is normally obtained by linking perlmain.c with
7773libperl${_a}, any static extensions (usually just DynaLoader), and
7774any other libraries needed on this system (such as -lm, etc.). Since
7775your system supports dynamic loading, it is probably possible to build
7776a shared libperl.$so. If you will have more than one executable linked
7777to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7778executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7779default is probably sensible for your system.
7780$also
7781
7782EOM
7783 rp="Build a shared libperl.$so (y/n)"
7784 . ./myread
7785 case "$ans" in
7786 true|$define|[Yy]*)
7787 useshrplib='true' ;;
7788 *) useshrplib='false' ;;
7789 esac
7790 ;;
7791esac
7792
7793case "$useshrplib" in
7794true)
7795 case "$libperl" in
7796 '')
7797 # Figure out a good name for libperl.so. Since it gets stored in
7798 # a version-specific architecture-dependent library, the version
7799 # number isn't really that important, except for making cc/ld happy.
7800 #
7801 # A name such as libperl.so.3.1
7802 majmin="libperl.$so.$patchlevel.$subversion"
7803 # A name such as libperl.so.301
7804 majonly=`echo $patchlevel $subversion |
7805 $awk '{printf "%d%02d", $1, $2}'`
7806 majonly=libperl.$so.$majonly
7807 # I'd prefer to keep the os-specific stuff here to a minimum, and
7808 # rely on figuring it out from the naming of libc.
7809 case "${osname}${osvers}" in
7810 next4*)
7811 dflt=libperl.5.$so
7812 # XXX How handle the --version stuff for MAB?
7813 ;;
fb2e1bc0 7814 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7815 dflt=libperl.$so
7816 ;;
b53432e4
GH
7817 cygwin*) # ld links against an importlib
7818 dflt=libperl$lib_ext
b4eb6b3d
JH
7819 ;;
7820 *) # Try to guess based on whether libc has major.minor.
7821 case "$libc" in
7822 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7823 *libc.$so.[0-9]*) dflt=$majonly ;;
7824 *) dflt=libperl.$so ;;
7825 esac
7826 ;;
7827 esac
7828 ;;
7829 *) dflt=$libperl
7830 ;;
7831 esac
7832 cat << EOM
7833
7834I need to select a good name for the shared libperl. If your system uses
7835library names with major and minor numbers, then you might want something
7836like $majmin. Alternatively, if your system uses a single version
7837number for shared libraries, then you might want to use $majonly.
7838Or, your system might be quite happy with a simple libperl.$so.
7839
7840Since the shared libperl will get installed into a version-specific
7841architecture-dependent directory, the version number of the shared perl
7842library probably isn't important, so the default should be o.k.
7843
7844EOM
7845 rp='What name do you want to give to the shared libperl?'
7846 . ./myread
7847 libperl=$ans
7848 echo "Ok, I'll use $libperl"
7849 ;;
7850*)
7851 libperl="libperl${_a}"
7852 ;;
7853esac
7854
7855# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7856case "$shrpdir" in
7857'') ;;
7858*) $cat >&4 <<EOM
7859WARNING: Use of the shrpdir variable for the installation location of
7860the shared $libperl is not supported. It was never documented and
7861will not work in this version. Let me (perlbug@perl.org)
7862know of any problems this may cause.
7863
7864EOM
7865 case "$shrpdir" in
7866 "$archlibexp/CORE")
7867 $cat >&4 <<EOM
7868But your current setting of $shrpdir is
7869the default anyway, so it's harmless.
7870EOM
7871 ;;
7872 *)
7873 $cat >&4 <<EOM
7874Further, your current attempted setting of $shrpdir
7875conflicts with the value of $archlibexp/CORE
7876that installperl will use.
7877EOM
7878 ;;
7879 esac
7880 ;;
7881esac
7882
7883# How will the perl executable find the installed shared $libperl?
7884# Add $xxx to ccdlflags.
7885# If we can't figure out a command-line option, use $shrpenv to
7886# set env LD_RUN_PATH. The main perl makefile uses this.
7887shrpdir=$archlibexp/CORE
7888xxx=''
7889tmp_shrpenv=''
7890if "$useshrplib"; then
7891 case "$osname" in
7892 aix)
7893 # We'll set it in Makefile.SH...
7894 ;;
b5b9f165 7895 solaris)
b4eb6b3d
JH
7896 xxx="-R $shrpdir"
7897 ;;
a774dfe6 7898 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
7899 xxx="-Wl,-R$shrpdir"
7900 ;;
fb2e1bc0 7901 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7902 xxx="-Wl,-rpath,$shrpdir"
7903 ;;
7904 next)
7905 # next doesn't like the default...
7906 ;;
7907 beos)
7908 # beos doesn't like the default, either.
7909 ;;
7910 hpux*)
7911 # hpux doesn't like the default, either.
7912 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7913 ;;
7914 *)
7915 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7916 ;;
7917 esac
7918 case "$xxx" in
7919 '') ;;
7920 *)
7921 # Only add $xxx if it isn't already in ccdlflags.
7922 case " $ccdlflags " in
7923 *" $xxx "*) ;;
7924 *) ccdlflags="$ccdlflags $xxx"
7925 cat <<EOM >&4
7926
7927Adding $xxx to the flags
7928passed to $ld so that the perl executable will find the
7929installed shared $libperl.
7930
7931EOM
7932 ;;
7933 esac
7934 ;;
7935 esac
7936fi
7937# Fix ccdlflags in AIX for building external extensions.
7938# (For building Perl itself bare -bE:perl.exp is needed,
7939# Makefile.SH takes care of this.)
7940case "$osname" in
7941aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7942esac
7943# Respect a hint or command-line value.
7944case "$shrpenv" in
7945'') shrpenv="$tmp_shrpenv" ;;
7946esac
7947case "$ldlibpthname" in
7948'') ldlibpthname=LD_LIBRARY_PATH ;;
7949none) ldlibpthname='' ;;
7950esac
7951
7952: determine where manual pages are on this system
7953echo " "
7954case "$sysman" in
7955'')
4a0a3829
SD
7956 syspath='/usr/share/man/man1 /usr/man/man1'
7957 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7958 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7959 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7960 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7961 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7962 sysman=`./loc . /usr/man/man1 $syspath`
7963 ;;
7964esac
7965if $test -d "$sysman"; then
7966 echo "System manual is in $sysman." >&4
7967else
7968 echo "Could not find manual pages in source form." >&4
7969fi
7970
7971: determine where manual pages go
7972set man1dir man1dir none
7973eval $prefixit
7974$cat <<EOM
7975
7976$spackage has manual pages available in source form.
7977EOM
7978case "$nroff" in
7979nroff)
7980 echo "However, you don't have nroff, so they're probably useless to you."
7981 case "$man1dir" in
7982 '') man1dir="none";;
7983 esac;;
7984esac
7985echo "If you don't want the manual sources installed, answer 'none'."
7986case "$man1dir" in
7987' ') dflt=none
7988 ;;
7989'')
4a0a3829
SD
7990 lookpath="$prefixexp/share/man/man1"
7991 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7992 lookpath="$lookpath $prefixexp/man/p_man/man1"
7993 lookpath="$lookpath $prefixexp/man/u_man/man1"
7994 lookpath="$lookpath $prefixexp/man/man.1"
7995 case "$sysman" in
7996 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7997 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7998 esac
7999 set dflt
8000 eval $prefixup
8001 ;;
8002*) dflt="$man1dir"
8003 ;;
8004esac
8005echo " "
8006fn=dn+~
8007rp="Where do the main $spackage manual pages (source) go?"
8008. ./getfile
8009if $test "X$man1direxp" != "X$ansexp"; then
8010 installman1dir=''
8011fi
8012man1dir="$ans"
8013man1direxp="$ansexp"
8014case "$man1dir" in
8015'') man1dir=' '
8016 installman1dir='';;
8017esac
8018
8019: Change installation prefix, if necessary.
8020if $test X"$prefix" != X"$installprefix"; then
8021 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8022else
8023 installman1dir="$man1direxp"
8024fi
8025
8026: What suffix to use on installed man pages
8027
8028case "$man1dir" in
8029' ')
8030 man1ext='0'
8031 ;;
8032*)
8033 rp="What suffix should be used for the main $spackage man pages?"
8034 case "$man1ext" in
8035 '') case "$man1dir" in
8036 *1) dflt=1 ;;
8037 *1p) dflt=1p ;;
8038 *1pm) dflt=1pm ;;
8039 *l) dflt=l;;
8040 *n) dflt=n;;
8041 *o) dflt=o;;
8042 *p) dflt=p;;
8043 *C) dflt=C;;
8044 *L) dflt=L;;
8045 *L1) dflt=L1;;
8046 *) dflt=1;;
8047 esac
8048 ;;
8049 *) dflt="$man1ext";;
8050 esac
8051 . ./myread
8052 man1ext="$ans"
8053 ;;
8054esac
8055
8056: see if we can have long filenames
8057echo " "
8058first=123456789abcdef
8059$rm -f $first
8060if (echo hi >$first) 2>/dev/null; then
8061 if $test -f 123456789abcde; then
8062 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8063 val="$undef"
8064 else
8065 echo 'You can have filenames longer than 14 characters.'>&4
8066 val="$define"
8067 fi
8068else
8069 $cat <<'EOM'
8070You can't have filenames longer than 14 chars.
8071You can't even think about them!
8072EOM
8073 val="$undef"
8074fi
8075set d_flexfnam
8076eval $setvar
8077$rm -rf 123456789abcde*
8078
8079: determine where library module manual pages go
8080set man3dir man3dir none
8081eval $prefixit
8082$cat <<EOM
8083
8084$spackage has manual pages for many of the library modules.
8085EOM
8086
8087case "$nroff" in
8088nroff)
8089 $cat <<'EOM'
8090However, you don't have nroff, so they're probably useless to you.
8091EOM
8092 case "$man3dir" in
8093 '') man3dir="none";;
8094 esac;;
8095esac
8096
8097case "$d_flexfnam" in
8098undef)
8099 $cat <<'EOM'
8100However, your system can't handle the long file names like File::Basename.3.
8101EOM
8102 case "$man3dir" in
8103 '') man3dir="none";;
8104 esac;;
8105esac
8106
8107echo "If you don't want the manual sources installed, answer 'none'."
8108prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8109case "$man3dir" in
8110'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8111 if $test -d "$privlib/man/man3"; then
8112 cat <<EOM >&4
8113
8114WARNING: Previous versions of perl installed man3 pages into
8115$privlib/man/man3. This version will suggest a
8116new default of $dflt.
8117EOM
8118 tdflt=$dflt
8119 dflt='n'
8120 rp='Do you wish to preserve the old behavior?(y/n)'
8121 . ./myread
8122 case "$ans" in
8123 y*) dflt="$privlib/man/man3" ;;
8124 *) dflt=$tdflt ;;
8125 esac
8126 fi
8127 ;;
8128*) dflt="$man3dir" ;;
8129esac
8130case "$dflt" in
8131' ') dflt=none ;;
8132esac
8133echo " "
8134fn=dn+~
8135rp="Where do the $package library man pages (source) go?"
8136. ./getfile
8137man3dir="$ans"
8138man3direxp="$ansexp"
8139case "$man3dir" in
8140'') man3dir=' '
8141 installman3dir='';;
8142esac
8143
8144: Change installation prefix, if necessary.
8145if $test X"$prefix" != X"$installprefix"; then
8146 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8147else
8148 installman3dir="$man3direxp"
8149fi
8150
8151: What suffix to use on installed man pages
8152case "$man3dir" in
8153' ')
8154 man3ext='0'
8155 ;;
8156*)
8157 rp="What suffix should be used for the $package library man pages?"
8158 case "$man3ext" in
8159 '') case "$man3dir" in
8160 *3) dflt=3 ;;
8161 *3p) dflt=3p ;;
8162 *3pm) dflt=3pm ;;
8163 *l) dflt=l;;
8164 *n) dflt=n;;
8165 *o) dflt=o;;
8166 *p) dflt=p;;
8167 *C) dflt=C;;
8168 *L) dflt=L;;
8169 *L3) dflt=L3;;
8170 *) dflt=3;;
8171 esac
8172 ;;
8173 *) dflt="$man3ext";;
8174 esac
8175 . ./myread
8176 man3ext="$ans"
8177 ;;
8178esac
8179
8180: see if we have to deal with yellow pages, now NIS.
0384a54a 8181if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8182 if $test -f /usr/etc/nibindd; then
8183 echo " "
8184 echo "I'm fairly confident you're on a NeXT."
8185 echo " "
8186 rp='Do you get the hosts file via NetInfo?'
8187 dflt=y
8188 case "$hostcat" in
8189 nidump*) ;;
8190 '') ;;
8191 *) dflt=n;;
8192 esac
8193 . ./myread
8194 case "$ans" in
8195 y*) hostcat='nidump hosts .';;
8196 *) case "$hostcat" in
8197 nidump*) hostcat='';;
8198 esac
8199 ;;
8200 esac
8201 fi
8202 case "$hostcat" in
8203 nidump*) ;;
8204 *)
8205 case "$hostcat" in
8206 *ypcat*) dflt=y;;
8207 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8208 dflt=y
8209 else
8210 dflt=n
8211 fi;;
8212 *) dflt=n;;
8213 esac
8214 echo " "
8215 rp='Are you getting the hosts file via yellow pages?'
8216 . ./myread
8217 case "$ans" in
8218 y*) hostcat='ypcat hosts';;
8219 *) hostcat='cat /etc/hosts';;
8220 esac
8221 ;;
8222 esac
8223fi
8224case "$hostcat" in
8225'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8226esac
8227case "$groupcat" in
8228'') test -f /etc/group && groupcat='cat /etc/group';;
8229esac
8230case "$passcat" in
8231'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8232esac
8233
8234: now get the host name
8235echo " "
8236echo "Figuring out host name..." >&4
8237case "$myhostname" in
8238'') cont=true
8239 echo 'Maybe "hostname" will work...'
73614538 8240 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8241 myhostname=$tans
8242 phostname=hostname
8243 cont=''
8244 fi
8245 ;;
8246*) cont='';;
8247esac
8248if $test "$cont"; then
8249 if ./xenix; then
8250 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8251 if tans=`cat /etc/systemid 2>&1` ; then
8252 myhostname=$tans
8253 phostname='cat /etc/systemid'
8254 echo "Whadyaknow. Xenix always was a bit strange..."
8255 cont=''
8256 fi
8257 elif $test -r /etc/systemid; then
8258 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8259 fi
8260fi
8261if $test "$cont"; then
8262 echo 'No, maybe "uuname -l" will work...'
73614538 8263 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8264 myhostname=$tans
8265 phostname='uuname -l'
8266 else
8267 echo 'Strange. Maybe "uname -n" will work...'
73614538 8268 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8269 myhostname=$tans
8270 phostname='uname -n'
8271 else
8272 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8273 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8274 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8275 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8276 else
8277 case "$myhostname" in
8278 '') echo "Does this machine have an identity crisis or something?"
8279 phostname='';;
8280 *)
8281 echo "Well, you said $myhostname before..."
8282 phostname='echo $myhostname';;
8283 esac
8284 fi
8285 fi
8286 fi
8287fi
52a549d0
JH
8288case "$myhostname" in
8289'') myhostname=noname ;;
8290esac
b4eb6b3d
JH
8291: you do not want to know about this
8292set $myhostname
8293myhostname=$1
8294
8295: verify guess
8296if $test "$myhostname" ; then
8297 dflt=y
8298 rp='Your host name appears to be "'$myhostname'".'" Right?"
8299 . ./myread
8300 case "$ans" in
8301 y*) ;;
8302 *) myhostname='';;
8303 esac
8304fi
8305
8306: bad guess or no guess
8307while $test "X$myhostname" = X ; do
8308 dflt=''
8309 rp="Please type the (one word) name of your host:"
8310 . ./myread
8311 myhostname="$ans"
8312done
8313
8314: translate upper to lower if necessary
8315case "$myhostname" in
8316*[A-Z]*)
8317 echo "(Normalizing case in your host name)"
8318 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8319 ;;
8320esac
8321
8322case "$myhostname" in
8323*.*)
8324 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8325 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8326 echo "(Trimming domain name from host name--host name is now $myhostname)"
8327 ;;
8328*) case "$mydomain" in
8329 '')
8330 {
8331 test "X$hostcat" = "Xypcat hosts" &&
8332 ypmatch "$myhostname" hosts 2>/dev/null |\
8333 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8334 $test -s hosts
8335 } || {
8336 test "X$hostcat" != "X" &&
8337 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8338 /[ ]$myhostname[ . ]/p" > hosts
8339 }
8340 tmp_re="[ . ]"
f08cbdd1
PP
8341 if $test -f hosts; then
8342 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8343 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8344 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8345 hosts | $sort | $uniq | \
8346 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8347 case `$echo X$dflt` in
8348 X*\ *) echo "(Several hosts in the database matched hostname)"
8349 dflt=.
8350 ;;
8351 X.) echo "(You do not have fully-qualified names in the hosts database)"
8352 ;;
8353 esac
8354 else
8355 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8356 dflt=.
f08cbdd1 8357 fi
b4eb6b3d
JH
8358 case "$dflt" in
8359 .)
8360 tans=`./loc resolv.conf X /etc /usr/etc`
8361 if $test -f "$tans"; then
8362 echo "(Attempting domain name extraction from $tans)"
8363 dflt=.`$sed -n -e 's/ / /g' \
8364 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8365 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8366 case "$dflt" in
8367 .) dflt=.`$sed -n -e 's/ / /g' \
8368 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8369 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8370 ;;
8371 esac
8372 fi
8373 ;;
8374 esac
8375 case "$dflt" in
8376 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8377 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8378 case "$dflt" in
8379 '') dflt='.';;
8380 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8381 esac
8382 ;;
8383 esac
59c9e5d6
PP
8384 case "$dflt$osname" in
8385 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8386 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8387 ;;
8388 esac
b4eb6b3d
JH
8389 case "$dflt" in
8390 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8391 dflt='.nonet'
b4eb6b3d
JH
8392 ;;
8393 esac
8394 $rm -f hosts
8395 ;;
8396 *) dflt="$mydomain";;
8397 esac;;
8398esac
8399echo " "
8400rp="What is your domain name?"
8401. ./myread
8402tans="$ans"
8403case "$ans" in
8404'') ;;
8405.*) ;;
8406*) tans=".$tans";;
8407esac
8408mydomain="$tans"
8409
8410: translate upper to lower if necessary
8411case "$mydomain" in
8412*[A-Z]*)
8413 echo "(Normalizing case in your domain name)"
8414 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8415 ;;
8416esac
8417
8418: a little sanity check here
8419case "$phostname" in
8420'') ;;
8421*)
8422 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8423 $myhostname$mydomain|$myhostname) ;;
8424 *)
8425 case "$phostname" in
8426 sed*)
8427 echo "(That doesn't agree with your whoami.h file, by the way.)"
8428 ;;
8429 *)
8430 echo "(That doesn't agree with your $phostname command, by the way.)"
8431 ;;
8432 esac
8433 ;;
8434 esac
8435 ;;
8436esac
8437
8438$cat <<EOM
8439
8440I need to get your e-mail address in Internet format if possible, i.e.
8441something like user@host.domain. Please answer accurately since I have
8442no easy means to double check it. The default value provided below
8443is most probably close to reality but may not be valid from outside
8444your organization...
8445
8446EOM
8447cont=x
8448while test "$cont"; do
8449 case "$cf_email" in
8450 '') dflt="$cf_by@$myhostname$mydomain";;
8451 *) dflt="$cf_email";;
8452 esac
8453 rp='What is your e-mail address?'
8454 . ./myread
8455 cf_email="$ans"
8456 case "$cf_email" in
8457 *@*.*) cont='' ;;
8458 *)
8459 rp='Address does not look like an Internet one. Use it anyway?'
8460 case "$fastread" in
8461 yes) dflt=y ;;
8462 *) dflt=n ;;
8463 esac
8464 . ./myread
8465 case "$ans" in
8466 y*) cont='' ;;
8467 *) echo " " ;;
8468 esac
8469 ;;
8470 esac
8471done
8472
8473$cat <<EOM
8474
8475If you or somebody else will be maintaining perl at your site, please
8476fill in the correct e-mail address here so that they may be contacted
8477if necessary. Currently, the "perlbug" program included with perl
8478will send mail to this address in addition to perlbug@perl.org. You may
8479enter "none" for no administrator.
8480
8481EOM
8482case "$perladmin" in
8483'') dflt="$cf_email";;
8484*) dflt="$perladmin";;
8485esac
8486rp='Perl administrator e-mail address'
8487. ./myread
8488perladmin="$ans"
8489
674912d7
RB
8490: determine whether to only install version-specific parts.
8491echo " "
8492$cat <<EOM
8493Do you want to install only the version-specific parts of the perl
8494distribution? Usually you do *not* want to do this.
8495EOM
8496case "$versiononly" in
8497"$define"|[Yy]*|true) dflt='y' ;;
8498*) dflt='n';
8499esac
8500rp="Do you want to install only the version-specific parts of perl?"
8501. ./myread
8502case "$ans" in
8503[yY]*) val="$define";;
8504*) val="$undef" ;;
8505esac
8506set versiononly
8507eval $setvar
8508
ad493445
MB
8509case "$versiononly" in
8510"$define") inc_version_list=''
8511 inc_version_list_init=0
8512 ;;
8513esac
8514
b4eb6b3d
JH
8515: figure out how to guarantee perl startup
8516case "$startperl" in
8517'')
8518 case "$sharpbang" in
8519 *!)
8520 $cat <<EOH
8521
8522I can use the #! construct to start perl on your system. This will
8523make startup of perl scripts faster, but may cause problems if you
8524want to share those scripts and perl is not in a standard place
8525($binexp/perl) on all your platforms. The alternative is to force
8526a shell by starting the script with a single ':' character.
8527
8528EOH
674912d7
RB
8529 case "$versiononly" in
8530 "$define") dflt="$binexp/perl$version";;
8531 *) dflt="$binexp/perl";;
8532 esac
b4eb6b3d
JH
8533 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8534 . ./myread
8535 case "$ans" in
8536 none) startperl=": # use perl";;
8537 *) startperl="#!$ans"
8538 if $test 30 -lt `echo "$ans" | wc -c`; then
8539 $cat >&4 <<EOM
8540
8541WARNING: Some systems limit the #! command to 32 characters.
8542If you experience difficulty running Perl scripts with #!, try
8543installing Perl in a directory with a shorter pathname.
8544
8545EOM
8546 fi ;;
8547 esac
8548 ;;
8549 *) startperl=": # use perl"
8550 ;;
8551 esac
8552 ;;
8553esac
8554echo "I'll use $startperl to start perl scripts."
8555
8556: figure best path for perl in scripts
8557case "$perlpath" in
8558'')
5e20a8ca
RGS
8559 case "$versiononly" in
8560 "$define") perlpath="$binexp/perl$version";;
8561 *) perlpath="$binexp/perl";;
8562 esac
b4eb6b3d
JH
8563 case "$startperl" in
8564 *!*) ;;
8565 *)
8566 $cat <<EOH
8567
8568I will use the "eval 'exec'" idiom to start Perl on your system.
8569I can use the full path of your Perl binary for this purpose, but
8570doing so may cause problems if you want to share those scripts and
8571Perl is not always in a standard place ($binexp/perl).
8572
8573EOH
8574 dflt="$binexp/perl"
8575 rp="What path shall I use in \"eval 'exec'\"?"
8576 . ./myread
8577 perlpath="$ans"
8578 ;;
8579 esac
8580 ;;
8581esac
8582case "$startperl" in
8583*!*) ;;
8584*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8585esac
8586
8587: determine where public executable scripts go
8588set scriptdir scriptdir
8589eval $prefixit
8590case "$scriptdir" in
8591'')
8592 dflt="$bin"
8593 : guess some guesses
8594 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8595 $test -d /usr/share/bin && dflt=/usr/share/bin
8596 $test -d /usr/local/script && dflt=/usr/local/script
8597 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8598 $test -d $prefixexp/script && dflt=$prefixexp/script
8599 set dflt
8600 eval $prefixup
8601 ;;
8602*) dflt="$scriptdir"
8603 ;;
8604esac
8605$cat <<EOM
8606
8607Some installations have a separate directory just for executable scripts so
8608that they can mount it across multiple architectures but keep the scripts in
8609one spot. You might, for example, have a subdirectory of /usr/share for this.
8610Or you might just lump your scripts in with all your other executables.
8611
8612EOM
8613fn=d~
8614rp='Where do you keep publicly executable scripts?'
8615. ./getfile
8616if $test "X$ansexp" != "X$scriptdirexp"; then
8617 installscript=''
8618fi
8619scriptdir="$ans"
8620scriptdirexp="$ansexp"
8621: Change installation prefix, if necessary.
8622if $test X"$prefix" != X"$installprefix"; then
8623 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8624else
8625 installscript="$scriptdirexp"
8626fi
8627
8628: determine where add-on public executables go
8629case "$sitebin" in
8630'') dflt=$siteprefix/bin ;;
8631*) dflt=$sitebin ;;
8632esac
8633fn=d~
8634rp='Pathname where the add-on public executables should be installed?'
8635. ./getfile
8636sitebin="$ans"
8637sitebinexp="$ansexp"
8638: Change installation prefix, if necessary.
8639if $test X"$prefix" != X"$installprefix"; then
8640 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8641else
8642 installsitebin="$sitebinexp"
8643fi
8644
6e1038e0 8645: determine where add-on html pages go
8d2cbf27 8646: There is no standard location, so try to copy the previously-selected
6e1038e0 8647: directory structure for the core html pages.
8d2cbf27
JH
8648case "$sitehtml1dir" in
8649'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8650*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8651esac
8652case "$dflt" in
8653''|' ') dflt=none ;;
8654esac
8655fn=dn+~
8656rp='Pathname where the site-specific html pages should be installed?'
8657. ./getfile
8d2cbf27
JH
8658sitehtml1dir="$ans"
8659sitehtml1direxp="$ansexp"
6e1038e0
MB
8660: Change installation prefix, if necessary.
8661if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8662 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8663else
8d2cbf27 8664 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8665fi
8666
8667: determine where add-on library html pages go
8668: There is no standard location, so try to copy the previously-selected
8669: directory structure for the core html pages.
8d2cbf27
JH
8670case "$sitehtml3dir" in
8671'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8672*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8673esac
8674case "$dflt" in
8675''|' ') dflt=none ;;
8676esac
8677fn=dn+~
8678rp='Pathname where the site-specific library html pages should be installed?'
8679. ./getfile
8d2cbf27
JH
8680sitehtml3dir="$ans"
8681sitehtml3direxp="$ansexp"
6e1038e0
MB
8682: Change installation prefix, if necessary.
8683if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8684 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8685else
8d2cbf27 8686 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8687fi
8688
8689: determine where add-on manual pages go
91e123a8
JH
8690case "$siteman1dir" in
8691'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8692*) dflt=$siteman1dir ;;
6e1038e0 8693esac
257059b5
JH
8694case "$dflt" in
8695''|' ') dflt=none ;;
8696esac
6e1038e0
MB
8697fn=dn+~
8698rp='Pathname where the site-specific manual pages should be installed?'
8699. ./getfile
91e123a8
JH
8700siteman1dir="$ans"
8701siteman1direxp="$ansexp"
6e1038e0
MB
8702: Change installation prefix, if necessary.
8703if $test X"$prefix" != X"$installprefix"; then
91e123a8 8704 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8705else
91e123a8 8706 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8707fi
8708
8709: determine where add-on library man pages go
91e123a8
JH
8710case "$siteman3dir" in
8711'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8712*) dflt=$siteman3dir ;;
6e1038e0 8713esac
257059b5
JH
8714case "$dflt" in
8715''|' ') dflt=none ;;
8716esac
6e1038e0
MB
8717fn=dn+~
8718rp='Pathname where the site-specific library manual pages should be installed?'
8719. ./getfile
91e123a8
JH
8720siteman3dir="$ans"
8721siteman3direxp="$ansexp"
6e1038e0
MB
8722: Change installation prefix, if necessary.
8723if $test X"$prefix" != X"$installprefix"; then
91e123a8 8724 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8725else
91e123a8 8726 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8727fi
8728
8729: determine where add-on public executable scripts go
8730case "$sitescript" in
8731'') dflt=$siteprefix/script
8732 $test -d $dflt || dflt=$sitebin ;;
8733*) dflt="$sitescript" ;;
8734esac
8735fn=d~+
8736rp='Pathname where add-on public executable scripts should be installed?'
8737. ./getfile
8738sitescript="$ans"
8739sitescriptexp="$ansexp"
8740: Change installation prefix, if necessary.
8741if $test X"$prefix" != X"$installprefix"; then
8742 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8743else
8744 installsitescript="$sitescriptexp"
8745fi
8746
15b61c98
JH
8747case "$usefaststdio" in
8748$define|true|[yY]*|'')
8749 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8750 case "$xversion" in
8751 [68]) dflt='y' ;;
8752 *) dflt='n' ;;
8753 esac
8754 ;;
8755*) dflt='n';;
8756esac
8757cat <<EOM
8758
8759Perl can be built to use 'fast stdio', which means using the stdio
8760library but also directly manipulating the stdio buffers to enable
8761faster I/O. Using stdio is better for backward compatibility (especially
8762for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8763interface has been preferred instead of stdio.
8764
8765If this doesn't make any sense to you, just accept the default '$dflt'.
8766EOM
8767rp='Use the "fast stdio" if available?'
8768. ./myread
8769case "$ans" in
8770y|Y) val="$define" ;;
8771*) val="$undef" ;;
8772esac
8773set usefaststdio
8774eval $setvar
8775
8776
96056487
JH
8777: define an is-a-typedef? function
8778typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8779case "$inclist" in
8780"") inclist="sys/types.h";;
8781esac;
8782eval "varval=\$$var";
8783case "$varval" in
8784"")
8785 $rm -f temp.c;
8786 for inc in $inclist; do
8787 echo "#include <$inc>" >>temp.c;
8788 done;
8789 echo "#ifdef $type" >> temp.c;
8790 echo "printf(\"We have $type\");" >> temp.c;
8791 echo "#endif" >> temp.c;
8792 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8793 if $contains $type temp.E >/dev/null 2>&1; then
8794 eval "$var=\$type";
8795 else
8796 eval "$var=\$def";
8797 fi;
8798 $rm -f temp.?;;
8799*) eval "$var=\$varval";;
8800esac'
8801
8802: define an is-a-typedef? function that prompts if the type is not available.
8803typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8804case "$inclist" in
8805"") inclist="sys/types.h";;
8806esac;
8807eval "varval=\$$var";
8808case "$varval" in
8809"")
8810 $rm -f temp.c;
8811 for inc in $inclist; do
8812 echo "#include <$inc>" >>temp.c;
8813 done;
8814 echo "#ifdef $type" >> temp.c;
8815 echo "printf(\"We have $type\");" >> temp.c;
8816 echo "#endif" >> temp.c;
8817 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8818 echo " " ;
8819 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8820 if $contains $type temp.E >/dev/null 2>&1; then
8821 echo "$type found." >&4;
8822 eval "$var=\$type";
8823 else
8824 echo "$type NOT found." >&4;
8825 dflt="$def";
8826 . ./myread ;
8827 eval "$var=\$ans";
8828 fi;
8829 $rm -f temp.?;;
8830*) eval "$var=\$varval";;
8831esac'
8832
8833: see what type lseek is declared as in the kernel
8834rp="What is the type used for lseek's offset on this system?"
8835set off_t lseektype long stdio.h sys/types.h
8836eval $typedef_ask
8837
8838echo " "
8839echo "Checking to see how big your file offsets are..." >&4
8840$cat >try.c <<EOCP
8841#include <sys/types.h>
8842#include <stdio.h>
8843int main()
8844{
8845 printf("%d\n", (int)sizeof($lseektype));
8846 return(0);
8847}
8848EOCP
8849set try
8850if eval $compile_ok; then
8851 lseeksize=`$run ./try`
8852 echo "Your file offsets are $lseeksize bytes long."
8853else
8854 dflt=$longsize
8855 echo " "
8856 echo "(I can't seem to compile the test program. Guessing...)"
8857 rp="What is the size of your file offsets (in bytes)?"
8858 . ./myread
8859 lseeksize="$ans"
8860fi
8861$rm -f try.c try
8862
8863: see what type file positions are declared as in the library
8864rp="What is the type for file position used by fsetpos()?"
8865set fpos_t fpostype long stdio.h sys/types.h
8866eval $typedef_ask
8867
8868echo " "
8869case "$fpostype" in
8870*_t) zzz="$fpostype" ;;
8871*) zzz="fpos_t" ;;
8872esac
8873echo "Checking the size of $zzz..." >&4
8874cat > try.c <<EOCP
8875#include <sys/types.h>
8876#include <stdio.h>
d1daaddf
JH
8877#$i_stdlib I_STDLIB
8878#ifdef I_STDLIB
8879#include <stdlib.h>
8880#endif
96056487
JH
8881int main() {
8882 printf("%d\n", (int)sizeof($fpostype));
8883 exit(0);
8884}
8885EOCP
8886set try
8887if eval $compile_ok; then
8888 yyy=`$run ./try`
8889 case "$yyy" in
8890 '') fpossize=4
8891 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8892 ;;
8893 *) fpossize=$yyy
8894 echo "Your $zzz is $fpossize bytes long."
8895 ;;
8896 esac
8897else
8898 dflt="$longsize"
8899 echo " " >&4
8900 echo "(I can't compile the test program. Guessing...)" >&4
8901 rp="What is the size of your file positions (in bytes)?"
8902 . ./myread
8903 fpossize="$ans"
8904fi
8905
96056487
JH
8906# Backward compatibility (uselfs is deprecated).
8907case "$uselfs" in
8908"$define"|true|[yY]*)
8909 cat <<EOM >&4
8910
8911*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8912EOM
8913 uselargefiles="$define"
8914 ;;
8915esac
8916
8917case "$lseeksize:$fpossize" in
89188:8) cat <<EOM
8919
8920You can have files larger than 2 gigabytes.
8921EOM
8922 val="$define" ;;
8923*) case "$uselargefiles" in
8924 "$undef"|false|[nN]*) dflt='n' ;;
8925 *) dflt='y' ;;
8926 esac
8927 cat <<EOM
8928
8929Perl can be built to understand large files (files larger than 2 gigabytes)
8930on some systems. To do so, Configure can be run with -Duselargefiles.
8931
8932If this doesn't make any sense to you, just accept the default '$dflt'.
8933EOM
8934 rp='Try to understand large files, if available?'
8935 . ./myread
8936 case "$ans" in
8937 y|Y) val="$define" ;;
8938 *) val="$undef" ;;
8939 esac
8940 ;;
8941esac
8942set uselargefiles
8943eval $setvar
96056487
JH
8944: Look for a hint-file generated 'call-back-unit'. If the
8945: user has specified that a large files perl is to be built,
8946: we may need to set or change some other defaults.
9da7673b
MB
8947if $test -f uselargefiles.cbu; then
8948 echo "Your platform has some specific hints regarding large file builds, using them..."
8949 . ./uselargefiles.cbu
8950fi
8951case "$uselargefiles" in
8952"$define")
96056487 8953 if $test -f uselargefiles.cbu; then
96056487
JH
8954 echo " "
8955 echo "Rechecking to see how big your file offsets are..." >&4
8956 $cat >try.c <<EOCP
8957#include <sys/types.h>
8958#include <stdio.h>
8959int main()
8960{
8961 printf("%d\n", (int)sizeof($lseektype));
8962 return(0);
8963}
8964EOCP
8965 set try
8966 if eval $compile_ok; then
8967 lseeksize=`$run ./try`
8968 $echo "Your file offsets are now $lseeksize bytes long."
8969 else
8970 dflt="$lseeksize"
8971 echo " "
8972 echo "(I can't seem to compile the test program. Guessing...)"
8973 rp="What is the size of your file offsets (in bytes)?"
8974 . ./myread
8975 lseeksize="$ans"
8976 fi
8977 case "$fpostype" in
8978 *_t) zzz="$fpostype" ;;
8979 *) zzz="fpos_t" ;;
8980 esac
8981 $echo $n "Rechecking the size of $zzz...$c" >&4
8982 $cat > try.c <<EOCP
8983#include <sys/types.h>
8984#include <stdio.h>
55954f19
JH
8985#$i_stdlib I_STDLIB
8986#ifdef I_STDLIB
8987#include <stdlib.h>
8988#endif
96056487
JH
8989int main() {
8990 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8991 return(0);
96056487
JH
8992}
8993EOCP
8994 set try
8995 if eval $compile_ok; then
8996 yyy=`$run ./try`
8997 dflt="$lseeksize"
8998 case "$yyy" in
8999 '') echo " "
9000 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9001 ;;
9002 *) fpossize=$yyy
9003 echo " $fpossize bytes." >&4
9004 ;;
9005 esac
9006 else
9007 dflt="$fpossize"
9008 echo " "
9009 echo "(I can't compile the test program. Guessing...)" >&4
9010 rp="What is the size of your file positions (in bytes)?"
9011 . ./myread
9012 fpossize="$ans"
9013 fi
9014 $rm -f try.c try
9015 fi
9016 ;;
9017esac
9018
db0f2be4
MB
9019# probably will refer to
9020# $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9021need_relocation=0
9022userelocatableinc=undef
9023
b4eb6b3d
JH
9024case "$vendorprefix" in
9025'') d_vendorbin="$undef"
9026 vendorbin=''
9027 vendorbinexp=''
9028 ;;
9029*) d_vendorbin="$define"
9030 : determine where vendor-supplied executables go.
9031 case "$vendorbin" in
9032 '') dflt=$vendorprefix/bin ;;
9033 *) dflt="$vendorbin" ;;
9034 esac
9035 fn=d~+
9036 rp='Pathname for the vendor-supplied executables directory?'
9037 . ./getfile
9038 vendorbin="$ans"
9039 vendorbinexp="$ansexp"
9040 ;;
9041esac
9042: Change installation prefix, if necessary.
9043if $test X"$prefix" != X"$installprefix"; then
9044 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9045else
9046 installvendorbin="$vendorbinexp"
9047fi
9048
6e1038e0 9049case "$vendorprefix" in
8d2cbf27
JH
9050'') vendorhtml1dir=''
9051 vendorhtml1direxp=''
6e1038e0
MB
9052 ;;
9053*) : determine where vendor-supplied html pages go.
9054 : There is no standard location, so try to copy the previously-selected
9055 : directory structure for the core html pages.
9056 : XXX Better default suggestions would be welcome.
8d2cbf27 9057 case "$vendorhtml1dir" in
6e1038e0 9058 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9059 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9060 esac
9061 case "$dflt" in
9062 ''|' ') dflt=none ;;
9063 esac
9064 fn=dn+~
9065 rp='Pathname for the vendor-supplied html pages?'
9066 . ./getfile
8d2cbf27
JH
9067 vendorhtml1dir="$ans"
9068 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9069 ;;
9070esac
9071: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9072$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9073: Change installation prefix, if necessary.
9074if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9075 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9076else
8d2cbf27 9077 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9078fi
9079
9080case "$vendorprefix" in
8d2cbf27
JH
9081'') vendorhtml3dir=''
9082 vendorhtml3direxp=''
6e1038e0
MB
9083 ;;
9084*) : determine where vendor-supplied module html pages go.
9085 : There is no standard location, so try to copy the previously-selected
9086 : directory structure for the core html pages.
9087 : XXX Better default suggestions would be welcome.
8d2cbf27 9088 case "$vendorhtml3dir" in
6e1038e0 9089 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9090 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9091 esac
9092 case "$dflt" in
9093 ''|' ') dflt=none ;;
9094 esac
9095 fn=dn+~
9096 rp='Pathname for the vendor-supplied html pages?'
9097 . ./getfile
8d2cbf27
JH
9098 vendorhtml3dir="$ans"
9099 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9100 ;;
9101esac
9102: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9103$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9104: Change installation prefix, if necessary.
9105if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9106 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9107else
8d2cbf27 9108 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9109fi
9110
9111case "$vendorprefix" in
91e123a8
JH
9112'') vendorman1dir=''
9113 vendorman1direxp=''
6e1038e0
MB
9114 ;;
9115*) : determine where vendor-supplied manual pages go.
91e123a8 9116 case "$vendorman1dir" in
6e1038e0 9117 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9118 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9119 esac
9120 case "$dflt" in
9121 ''|' ') dflt=none ;;
9122 esac
9123 fn=nd~+
9124 rp='Pathname for the vendor-supplied manual section 1 pages?'
9125 . ./getfile
91e123a8
JH
9126 vendorman1dir="$ans"
9127 vendorman1direxp="$ansexp"
6e1038e0
MB
9128 ;;
9129esac
9130: Use ' ' for none so value is preserved next time through Configure
91e123a8 9131$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9132: Change installation prefix, if necessary.
9133if $test X"$prefix" != X"$installprefix"; then
91e123a8 9134 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9135else
91e123a8 9136 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9137fi
9138
9139case "$vendorprefix" in
91e123a8
JH
9140'') vendorman3dir=''
9141 vendorman3direxp=''
6e1038e0
MB
9142 ;;
9143*) : determine where vendor-supplied module manual pages go.
91e123a8 9144 case "$vendorman3dir" in
6e1038e0 9145 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9146 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9147 esac
9148 case "$dflt" in
9149 ''|' ') dflt=none ;;
9150 esac
9151 fn=nd~+
9152 rp='Pathname for the vendor-supplied manual section 3 pages?'
9153 . ./getfile
91e123a8
JH
9154 vendorman3dir="$ans"
9155 vendorman3direxp="$ansexp"
6e1038e0
MB
9156 ;;
9157esac
9158: Use ' ' for none so value is preserved next time through Configure
91e123a8 9159$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9160: Change installation prefix, if necessary.
9161if $test X"$prefix" != X"$installprefix"; then
91e123a8 9162 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9163else
91e123a8 9164 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9165fi
9166
9167case "$vendorprefix" in
9168'') d_vendorscript="$undef"
9169 vendorscript=''
9170 vendorscriptexp=''
9171 ;;
9172*) d_vendorscript="$define"
9173 : determine where vendor-supplied scripts go.
9174 case "$vendorscript" in
9175 '') dflt=$vendorprefix/script
9176 $test -d $dflt || dflt=$vendorbin ;;
9177 *) dflt="$vendorscript" ;;
9178 esac
9179 $cat <<EOM
9180
9181The installation process will create a directory for
9182vendor-supplied scripts.
9183
9184EOM
9185 fn=d~+
9186 rp='Pathname for the vendor-supplied scripts directory?'
9187 . ./getfile
9188 vendorscript="$ans"
9189 vendorscriptexp="$ansexp"
9190 ;;
9191esac
9192: Change installation prefix, if necessary.
9193if $test X"$prefix" != X"$installprefix"; then
9194 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9195else
9196 installvendorscript="$vendorscriptexp"
9197fi
9198
b4eb6b3d
JH
9199: see if qgcvt exists
9200set qgcvt d_qgcvt
9201eval $inlibc
9202
89ce900e
JH
9203echo " "
9204
9205if $test X"$d_longdbl" = X"$define"; then
9206
9207echo "Checking how to print long doubles..." >&4
9208
9209if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9210 $cat >try.c <<'EOCP'
9211#include <sys/types.h>
9212#include <stdio.h>
9213int main() {
9214 double d = 123.456;
9215 printf("%.3f\n", d);
9216}
9217EOCP
9218 set try
9219 if eval $compile; then
9220 yyy=`$run ./try`
9221 case "$yyy" in
9222 123.456)
9223 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9224 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9225 echo "We will use %f."
9226 ;;
9227 esac
9228 fi
9229fi
9230
9231if $test X"$sPRIfldbl" = X; then
9232 $cat >try.c <<'EOCP'
9233#include <sys/types.h>
9234#include <stdio.h>
9235int main() {
9236 long double d = 123.456;
9237 printf("%.3Lf\n", d);
9238}
9239EOCP
9240 set try
9241 if eval $compile; then
9242 yyy=`$run ./try`
9243 case "$yyy" in
9244 123.456)
9245 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9246 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9247 echo "We will use %Lf."
9248 ;;
9249 esac
9250 fi
9251fi
9252
9253if $test X"$sPRIfldbl" = X; then
9254 $cat >try.c <<'EOCP'
9255#include <sys/types.h>
9256#include <stdio.h>
9257int main() {
9258 long double d = 123.456;
9259 printf("%.3llf\n", d);
9260}
9261EOCP
9262 set try
9263 if eval $compile; then
9264 yyy=`$run ./try`
9265 case "$yyy" in
9266 123.456)
9267 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9268 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9269 echo "We will use %llf."
9270 ;;
9271 esac
9272 fi
9273fi
9274
9275if $test X"$sPRIfldbl" = X; then
9276 $cat >try.c <<'EOCP'
9277#include <sys/types.h>
9278#include <stdio.h>
9279int main() {
9280 long double d = 123.456;
9281 printf("%.3lf\n", d);
9282}
9283EOCP
9284 set try
9285 if eval $compile; then
9286 yyy=`$run ./try`
9287 case "$yyy" in
9288 123.456)
9289 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9290 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9291 echo "We will use %lf."
9292 ;;
9293 esac
9294 fi
9295fi
9296
9297if $test X"$sPRIfldbl" = X; then
9298 echo "Cannot figure out how to print long doubles." >&4
9299else
9300 sSCNfldbl=$sPRIfldbl # expect consistency
9301fi
9302
9303$rm -f try try.*
9304
9305fi # d_longdbl
9306
9307case "$sPRIfldbl" in
9308'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9309 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9310 d_SCNfldbl="$undef";
9311 ;;
9312*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9313 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9314 d_SCNfldbl="$define";
9315 ;;
9316esac
9317
b4eb6b3d 9318: Check how to convert floats to strings.
a5b10d80
YST
9319
9320if test "X$d_Gconvert" = X; then
9321
b4eb6b3d
JH
9322echo " "
9323echo "Checking for an efficient way to convert floats to strings."
9324echo " " > try.c
9325case "$uselongdouble" in
9326"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9327esac
9328case "$d_longdbl" in
9329"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9330esac
9331case "$d_PRIgldbl" in
9332"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9333esac
9334$cat >>try.c <<EOP
9335#ifdef TRY_gconvert
9336#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9337char *myname = "gconvert";
9338#endif
9339#ifdef TRY_gcvt
9340#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9341char *myname = "gcvt";
9342#endif
9343#ifdef TRY_qgcvt
9344#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9345char *myname = "qgcvt";
9346#define DOUBLETYPE long double
9347#endif
9348#ifdef TRY_sprintf
a5b10d80
YST
9349#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9350#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9351#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9352#else
a5b10d80
YST
9353#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9354#endif
9355#else
b4eb6b3d
JH
9356#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9357#endif
9358char *myname = "sprintf";
9359#endif
9360
9361#ifndef DOUBLETYPE
9362#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9363#define DOUBLETYPE long double
9364#else
9365#define DOUBLETYPE double
9366#endif
9367#endif
9368
9369#include <stdio.h>
9370
9371#define I_STDLIB $i_stdlib
9372#ifdef I_STDLIB
9373#include <stdlib.h>
9374#endif
9375
9376int
9377checkit(expect, got)
9378char *expect;
9379char *got;
9380{
9381 if (strcmp(expect, got)) {
9382 printf("%s oddity: Expected %s, got %s\n",
9383 myname, expect, got);
9384 exit(1);
9385 }
9386}
9387
9388int main()
9389{
9390 char buf[64];
9391 buf[63] = '\0';
9392
9393 /* This must be 1st test on (which?) platform */
9394 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9395 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9396 checkit("0.1", buf);
9397
a5b10d80
YST
9398 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9399 checkit("0.01", buf);
9400
9401 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9402 checkit("0.001", buf);
9403
9404 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9405 checkit("0.0001", buf);
9406
9407 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9408 if (strlen(buf) > 5)
9409 checkit("9e-005", buf); /* for Microsoft ?? */
9410 else
9411 checkit("9e-05", buf);
9412
b4eb6b3d
JH
9413 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9414 checkit("1", buf);
9415
9416 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9417 checkit("1.1", buf);
9418
9419 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9420 checkit("1.01", buf);
9421
9422 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9423 checkit("1.001", buf);
9424
9425 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9426 checkit("1.0001", buf);
9427
9428 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9429 checkit("1.00001", buf);
9430
9431 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9432 checkit("1.000001", buf);
9433
9434 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9435 checkit("0", buf);
9436
9437 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9438 checkit("-1", buf);
9439
9440 /* Some Linux gcvt's give 1.e+5 here. */
9441 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9442 checkit("100000", buf);
9443
9444 /* Some Linux gcvt's give -1.e+5 here. */
9445 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9446 checkit("-100000", buf);
9447
9448 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9449 checkit("123.456", buf);
9450
ab6ca9f4 9451 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9452 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9453 /* 34 should be enough to scare even long double
9454 * places into using the e notation. */
ab6ca9f4 9455 if (strlen(buf) > 5)
94b339ad 9456 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9457 else
94b339ad 9458 checkit("1e+34", buf);
8e2a5ede 9459
d1eb8299
YST
9460 /* For Perl, if you add additional tests here, also add them to
9461 * t/base/num.t for benefit of platforms not using Configure or
9462 * overriding d_Gconvert */
9463
b4eb6b3d
JH
9464 exit(0);
9465}
9466EOP
ab6ca9f4 9467: first add preferred functions to our list
a5b10d80 9468xxx_list=""
ab6ca9f4 9469for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9470 case $xxx_convert in
9471 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9472 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9473 esac
9474done
9475: then add any others
9476for xxx_convert in gconvert gcvt sprintf; do
9477 case "$xxx_list" in
9478 *$xxx_convert*) ;;
9479 *) xxx_list="$xxx_list $xxx_convert" ;;
9480 esac
9481done
9482
9483case "$d_longdbl$uselongdouble" in
9484"$define$define")
9485 : again, add prefered functions to our list first
9486 xxx_ld_list=""
ab6ca9f4 9487 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9488 case $xxx_convert in
9489 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9490 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9491 esac
9492 done
9493 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9494 for xxx_convert in qgcvt sprintf $xxx_list; do
9495 case "$xxx_ld_list" in
9496 $xxx_convert*|*" $xxx_convert"*) ;;
9497 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9498 esac
9499 done
9500 : if sprintf cannot do long doubles, move it to the end
9501 if test "$d_PRIgldbl" != "$define"; then
9502 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9503 fi
9504 : if no qgcvt, remove it
9505 if test "$d_qgcvt" != "$define"; then
9506 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9507 fi
9508 : use the ld_list
9509 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9510 ;;
9511esac
9512
9513for xxx_convert in $xxx_list; do
9514 echo "Trying $xxx_convert..."
9515 $rm -f try try$_o
9516 set try -DTRY_$xxx_convert
9517 if eval $compile; then
9518 echo "$xxx_convert() found." >&4
5440bc8e 9519 if $run ./try; then
b4eb6b3d
JH
9520 echo "I'll use $xxx_convert to convert floats into a string." >&4
9521 break;
9522 else
9523 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9524 xxx_convert=''
b4eb6b3d
JH
9525 fi
9526 else
9527 echo "$xxx_convert NOT found." >&4
9528 fi
9529done
ab6ca9f4 9530
a5b10d80
YST
9531if test X$xxx_convert = X; then
9532 echo "*** WHOA THERE!!! ***" >&4
9533 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9534 xxx_convert=sprintf
9535fi
9536
b4eb6b3d
JH
9537case "$xxx_convert" in
9538gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9539gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9540qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9541*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9542 "$define$define$define")
9543 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9544 "$define$define$undef")
9545 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9546 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9547 esac
9548 ;;
9549esac
9550
a5b10d80
YST
9551fi
9552
74cac757
JH
9553: see if _fwalk exists
9554set fwalk d__fwalk
9555eval $inlibc
9556
b4eb6b3d
JH
9557: Initialize h_fcntl
9558h_fcntl=false
9559
9560: Initialize h_sysfile
9561h_sysfile=false
9562
9563: access call always available on UNIX
9564set access d_access
9565eval $inlibc
9566
9567: locate the flags for 'access()'
9568case "$d_access" in
9569"$define")
9570 echo " "
55954f19 9571 $cat >access.c <<EOCP
b4eb6b3d
JH
9572#include <sys/types.h>
9573#ifdef I_FCNTL
9574#include <fcntl.h>
9575#endif
9576#ifdef I_SYS_FILE
9577#include <sys/file.h>
9578#endif
9579#ifdef I_UNISTD
9580#include <unistd.h>
9581#endif
55954f19
JH
9582#$i_stdlib I_STDLIB
9583#ifdef I_STDLIB
9584#include <stdlib.h>
9585#endif
b4eb6b3d
JH
9586int main() {
9587 exit(R_OK);
9588}
9589EOCP
9590 : check sys/file.h first, no particular reason here
9591 if $test `./findhdr sys/file.h` && \
7a282f6d 9592 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9593 h_sysfile=true;
9594 echo "<sys/file.h> defines the *_OK access constants." >&4
9595 elif $test `./findhdr fcntl.h` && \
7a282f6d 9596 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9597 h_fcntl=true;
9598 echo "<fcntl.h> defines the *_OK access constants." >&4
9599 elif $test `./findhdr unistd.h` && \
7a282f6d 9600 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9601 echo "<unistd.h> defines the *_OK access constants." >&4
9602 else
9603 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9604 fi
9605 ;;
9606esac
9607$rm -f access*
9608
9609: see if accessx exists
9610set accessx d_accessx
9611eval $inlibc
9612
89ce900e
JH
9613: see if aintl exists
9614set aintl d_aintl
9615eval $inlibc
9616
b4eb6b3d
JH
9617: see if alarm exists
9618set alarm d_alarm
9619eval $inlibc
9620
a9dade78
JH
9621: see if POSIX threads are available
9622set pthread.h i_pthread
9623eval $inhdr
9624
10bc17b6
JH
9625: define a fucntion to check prototypes
9626$cat > protochk <<EOSH
9627$startsh
9628cc="$cc"
9629optimize="$optimize"
9630ccflags="$ccflags"
9631prototype="$prototype"
9632define="$define"
9633rm=$rm
a9dade78
JH
9634usethreads=$usethreads
9635i_pthread=$i_pthread
9636pthread_h_first=$pthread_h_first
10bc17b6
JH
9637EOSH
9638
9639$cat >> protochk <<'EOSH'
9640
9641$rm -f try.c
9642foo="$1"
9643shift
9644while test $# -ge 2; do
9645 case "$1" in
9646 $define) echo "#include <$2>" >> try.c ;;
9647 literal) echo "$2" >> try.c ;;
9648 esac
cce6a207
MB
9649 # Extra magic for the benefit of systems that need pthread.h
9650 # to be included early to correctly detect threadsafe functions.
9651 # Such functions must guarantee themselves, though, that the usethreads
9652 # and i_pthread have been defined, before calling protochk.
9653 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9654 echo "#include <pthread.h>" >> try.c
9655 pthread_h_done=yes
9656 fi
10bc17b6
JH
9657 shift 2
9658done
9659test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9660cat >> try.c <<'EOCP'
9661#ifdef CAN_PROTOTYPE
9662#define _(args) args
9663#else
9664#define _(args) ()
9665#endif
9666EOCP
9667echo "$foo" >> try.c
9668echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9669$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9670status=$?
9671$rm -f try.[co]
9672exit $status
9673EOSH
9674chmod +x protochk
9675$eunicefix protochk
9676
89ce900e
JH
9677hasproto='varname=$1; func=$2; shift; shift;
9678while $test $# -ge 2; do
9679 case "$1" in
9680 $define) echo "#include <$2>";;
9681 esac ;
9682 shift 2;
9683done > try.c;
9684$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9685if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9686 echo "$func() prototype found.";
9687 val="$define";
9688else
9689 echo "$func() prototype NOT found.";
9690 val="$undef";
9691fi;
9692set $varname;
9693eval $setvar;
9694$rm -f try.c tryout.c'
9695
10bc17b6
JH
9696: see if sys/types.h has to be included
9697set sys/types.h i_systypes
9698eval $inhdr
9699
9700: see if sys/select.h has to be included
9701set sys/select.h i_sysselct
9702eval $inhdr
9703
9704hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9705while $test $# -ge 2; do
9706 case "$1" in
9707 $define) echo "#include <$2>";;
9708 esac ;
9709 shift 2;
9710done > try.c;
9711echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9712set try;
9713if eval $compile; then
9714 val="$define";
9715else
9716 val="$undef";
9717fi;
9718set $varname;
9719eval $setvar;
9720$rm -f try.c try.o'
9721
9722: see if we should include time.h, sys/time.h, or both
9723echo " "
9724if test "X$timeincl" = X; then
9725 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9726 $echo $n "I'm now running the test program...$c"
55954f19 9727 $cat >try.c <<EOCP
10bc17b6
JH
9728#include <sys/types.h>
9729#ifdef I_TIME
9730#include <time.h>
9731#endif
9732#ifdef I_SYSTIME
9733#ifdef SYSTIMEKERNEL
9734#define KERNEL
9735#endif
9736#include <sys/time.h>
9737#endif
9738#ifdef I_SYSSELECT
9739#include <sys/select.h>
9740#endif
55954f19
JH
9741#$i_stdlib I_STDLIB
9742#ifdef I_STDLIB
9743#include <stdlib.h>
9744#endif
10bc17b6
JH
9745int main()
9746{
9747 struct tm foo;
9748#ifdef S_TIMEVAL
9749 struct timeval bar;
9750#endif
9751#ifdef S_TIMEZONE
9752 struct timezone tzp;
9753#endif
9754 if (foo.tm_sec == foo.tm_sec)
9755 exit(0);
9756#ifdef S_TIMEVAL
9757 if (bar.tv_sec == bar.tv_sec)
9758 exit(0);
9759#endif
9760 exit(1);
9761}
9762EOCP
9763 flags=''
9764 for s_timezone in '-DS_TIMEZONE' ''; do
9765 sysselect=''
9766 for s_timeval in '-DS_TIMEVAL' ''; do
9767 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9768 for i_time in '' '-DI_TIME'; do
9769 for i_systime in '-DI_SYSTIME' ''; do
9770 case "$flags" in
9771 '') $echo $n ".$c"
9772 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9773 if eval $compile; then
9774 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9775 shift
9776 flags="$*"
9777 echo " "
9778 $echo $n "Succeeded with $flags$c"
9779 fi
9780 ;;
9781 esac
9782 done
9783 done
9784 done
9785 done
9786 done
9787 timeincl=''
9788 echo " "
9789 case "$flags" in
9790 *SYSTIMEKERNEL*) i_systimek="$define"
9791 timeincl=`./findhdr sys/time.h`
9792 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9793 *) i_systimek="$undef";;
9794 esac
9795 case "$flags" in
9796 *I_TIME*) i_time="$define"
9797 timeincl=`./findhdr time.h`" $timeincl"
9798 echo "We'll include <time.h>." >&4;;
9799 *) i_time="$undef";;
9800 esac
9801 case "$flags" in
9802 *I_SYSTIME*) i_systime="$define"
9803 timeincl=`./findhdr sys/time.h`" $timeincl"
9804 echo "We'll include <sys/time.h>." >&4;;
9805 *) i_systime="$undef";;
9806 esac
9807 $rm -f try.c try
9808fi
9809: see if struct tm knows about tm_zone
9810case "$i_systime$i_time" in
9811*$define*)
9812 echo " "
9813 echo "Checking to see if your struct tm has tm_zone field..." >&4
9814 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9815 eval $hasfield
9816 ;;
9817*) val="$undef"
9818 set d_tm_tm_zone
9819 eval $setvar
9820 ;;
9821esac
9822case "$d_tm_tm_zone" in
9823"$define") echo "Yes, it does." ;;
9824*) echo "No, it doesn't." ;;
9825esac
9826: see if struct tm knows about tm_gmtoff
9827case "$i_systime$i_time" in
9828*$define*)
9829 echo " "
9830 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9831 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9832 eval $hasfield
9833 ;;
9834*) val="$undef"
9835 set d_tm_tm_gmtoff
9836 eval $setvar
9837 ;;
9838esac
9839case "$d_tm_tm_gmtoff" in
9840"$define") echo "Yes, it does." ;;
9841*) echo "No, it doesn't." ;;
9842esac
9843
9844: see if asctime_r exists
9845set asctime_r d_asctime_r
9846eval $inlibc
9847case "$d_asctime_r" in
9848"$define")
d63eadf0 9849 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9850 case "$d_asctime_r_proto:$usethreads" in
9851 ":define") d_asctime_r_proto=define
a48ec845
JH
9852 set d_asctime_r_proto asctime_r $hdrs
9853 eval $hasproto ;;
9854 *) ;;
9855 esac
9856 case "$d_asctime_r_proto" in
9857 define)
10bc17b6
JH
9858 case "$asctime_r_proto" in
9859 ''|0) try='char* asctime_r(const struct tm*, char*);'
9860 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9861 esac
9862 case "$asctime_r_proto" in
9863 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9864 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9865 esac
9866 case "$asctime_r_proto" in
9867 ''|0) try='int asctime_r(const struct tm*, char*);'
9868 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9869 esac
9870 case "$asctime_r_proto" in
9871 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9872 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9873 esac
9874 case "$asctime_r_proto" in
90e831dc 9875 ''|0) d_asctime_r=undef
10bc17b6 9876 asctime_r_proto=0
a48ec845 9877 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9878 * ) case "$asctime_r_proto" in
9879 REENTRANT_PROTO*) ;;
9880 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9881 esac
9882 echo "Prototype: $try" ;;
9883 esac
9884 ;;
c18e646a
JH
9885 *) case "$usethreads" in
9886 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9887 esac
90e831dc
SB
9888 d_asctime_r=undef
9889 asctime_r_proto=0
c18e646a 9890 ;;
a48ec845
JH
9891 esac
9892 ;;
10bc17b6
JH
9893*) asctime_r_proto=0
9894 ;;
9895esac
9896
b4eb6b3d
JH
9897: see if atolf exists
9898set atolf d_atolf
9899eval $inlibc
9900
9901: see if atoll exists
9902set atoll d_atoll
9903eval $inlibc
9904
0dbb1585
AL
9905: Look for GCC-style attribute format
9906case "$d_attribute_format" in
bde30f85 9907'')
b4eb6b3d 9908echo " "
0dbb1585 9909echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9910$cat >attrib.c <<'EOCP'
9911#include <stdio.h>
0dbb1585 9912void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9913EOCP
9914if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9915 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9916 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9917 val="$undef"
9918 else
0dbb1585 9919 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9920 val="$define"
9921 fi
9922else
9923 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9924 val="$undef"
9925fi
bde30f85 9926;;
0dbb1585 9927*) val="$d_attribute_format" ;;
bde30f85 9928esac
0dbb1585
AL
9929set d_attribute_format
9930eval $setvar
9931$rm -f attrib*
9932
9933: Look for GCC-style attribute malloc
9934case "$d_attribute_malloc" in
9935'')
9936echo " "
9937echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9938$cat >attrib.c <<'EOCP'
9939#include <stdio.h>
9940char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9941EOCP
9942if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9943 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9944 echo "Your C compiler doesn't support __attribute__((malloc))."
9945 val="$undef"
9946 else
9947 echo "Your C compiler supports __attribute__((malloc))."
9948 val="$define"
9949 fi
9950else
9951 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9952 val="$undef"
9953fi
9954;;
9955*) val="$d_attribute_malloc" ;;
9956esac
9957set d_attribute_malloc
9958eval $setvar
9959$rm -f attrib*
9960
9961: Look for GCC-style attribute nonnull
9962case "$d_attribute_nonnull" in
9963'')
9964echo " "
9965echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9966$cat >attrib.c <<'EOCP'
9967#include <stdio.h>
9968void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9969EOCP
9970if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9971 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9972 echo "Your C compiler doesn't support __attribute__((nonnull))."
9973 val="$undef"
9974 else
9975 echo "Your C compiler supports __attribute__((nonnull))."
9976 val="$define"
9977 fi
9978else
9979 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9980 val="$undef"
9981fi
9982;;
9983*) val="$d_attribute_nonnull" ;;
9984esac
9985set d_attribute_nonnull
9986eval $setvar
9987$rm -f attrib*
9988
9989: Look for GCC-style attribute noreturn
9990case "$d_attribute_noreturn" in
9991'')
9992echo " "
9993echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9994$cat >attrib.c <<'EOCP'
9995#include <stdio.h>
9996void fall_over_dead( void ) __attribute__((noreturn));
9997EOCP
9998if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9999 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10000 echo "Your C compiler doesn't support __attribute__((noreturn))."
10001 val="$undef"
10002 else
10003 echo "Your C compiler supports __attribute__((noreturn))."
10004 val="$define"
10005 fi
10006else
10007 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10008 val="$undef"
10009fi
10010;;
10011*) val="$d_attribute_noreturn" ;;
10012esac
10013set d_attribute_noreturn
10014eval $setvar
10015$rm -f attrib*
10016
10017: Look for GCC-style attribute pure
10018case "$d_attribute_pure" in
10019'')
10020echo " "
10021echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10022$cat >attrib.c <<'EOCP'
10023#include <stdio.h>
10024int square( int n ) __attribute__((pure));
10025EOCP
10026if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10027 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10028 echo "Your C compiler doesn't support __attribute__((pure))."
10029 val="$undef"
10030 else
10031 echo "Your C compiler supports __attribute__((pure))."
10032 val="$define"
10033 fi
10034else
10035 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10036 val="$undef"
10037fi
10038;;
10039*) val="$d_attribute_pure" ;;
10040esac
10041set d_attribute_pure
10042eval $setvar
10043$rm -f attrib*
10044
10045: Look for GCC-style attribute unused
10046case "$d_attribute_unused" in
10047'')
10048echo " "
10049echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10050$cat >attrib.c <<'EOCP'
10051#include <stdio.h>
10052int do_something( int dummy __attribute__((unused)), int n );
10053EOCP
10054if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10055 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10056 echo "Your C compiler doesn't support __attribute__((unused))."
10057 val="$undef"
10058 else
10059 echo "Your C compiler supports __attribute__((unused))."
10060 val="$define"
10061 fi
10062else
10063 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10064 val="$undef"
10065fi
10066;;
10067*) val="$d_attribute_unused" ;;
10068esac
10069set d_attribute_unused
10070eval $setvar
10071$rm -f attrib*
10072
10073: Look for GCC-style attribute warn_unused_result
10074case "$d_attribute_warn_unused_result" in
10075'')
10076echo " "
10077echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10078$cat >attrib.c <<'EOCP'
10079#include <stdio.h>
10080int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10081EOCP
10082if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10083 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10084 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10085 val="$undef"
10086 else
10087 echo "Your C compiler supports __attribute__((warn_unused_result))."
10088 val="$define"
10089 fi
10090else
10091 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10092 val="$undef"
10093fi
10094;;
10095*) val="$d_attribute_warn_unused_result" ;;
10096esac
10097set d_attribute_warn_unused_result
b4eb6b3d
JH
10098eval $setvar
10099$rm -f attrib*
10100
10101: see if bcmp exists
10102set bcmp d_bcmp
10103eval $inlibc
10104
10105: see if bcopy exists
10106set bcopy d_bcopy
10107eval $inlibc
10108
10109: see if this is a unistd.h system
10110set unistd.h i_unistd
10111eval $inhdr
10112
10113: see if getpgrp exists
10114set getpgrp d_getpgrp
10115eval $inlibc
10116
10117case "$d_getpgrp" in
10118"$define")
10119 echo " "
10120 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10121 $cat >try.c <<EOP
b4eb6b3d
JH
10122#$i_unistd I_UNISTD
10123#include <sys/types.h>
10124#ifdef I_UNISTD
10125# include <unistd.h>
10126#endif
55954f19
JH
10127#$i_stdlib I_STDLIB
10128#ifdef I_STDLIB
10129#include <stdlib.h>
10130#endif
b4eb6b3d
JH
10131int main()
10132{
10133 if (getuid() == 0) {
10134 printf("(I see you are running Configure as super-user...)\n");
10135 setuid(1);
10136 }
10137#ifdef TRY_BSD_PGRP
10138 if (getpgrp(1) == 0)
10139 exit(0);
10140#else
10141 if (getpgrp() > 0)
10142 exit(0);
10143#endif
10144 exit(1);
10145}
10146EOP
5440bc8e 10147 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10148 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10149 val="$define"
5440bc8e 10150 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10151 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10152 val="$undef"
10153 else
10154 echo "I can't seem to compile and run the test program."
10155 if ./usg; then
10156 xxx="a USG one, i.e. you use getpgrp()."
10157 else
10158 # SVR4 systems can appear rather BSD-ish.
10159 case "$i_unistd" in
10160 $undef)
10161 xxx="a BSD one, i.e. you use getpgrp(pid)."
10162 val="$define"
10163 ;;
10164 $define)
10165 xxx="probably a USG one, i.e. you use getpgrp()."
10166 val="$undef"
10167 ;;
10168 esac
10169 fi
10170 echo "Assuming your getpgrp is $xxx" >&4
10171 fi
10172 ;;
10173*) val="$undef";;
10174esac
10175set d_bsdgetpgrp
10176eval $setvar
5440bc8e 10177$rm -f try try.*
b4eb6b3d
JH
10178
10179: see if setpgrp exists
10180set setpgrp d_setpgrp
10181eval $inlibc
10182
10183case "$d_setpgrp" in
10184"$define")
10185 echo " "
10186 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10187 $cat >try.c <<EOP
b4eb6b3d
JH
10188#$i_unistd I_UNISTD
10189#include <sys/types.h>
10190#ifdef I_UNISTD
10191# include <unistd.h>
10192#endif
55954f19
JH
10193#$i_stdlib I_STDLIB
10194#ifdef I_STDLIB
10195#include <stdlib.h>
10196#endif
b4eb6b3d
JH
10197int main()
10198{
10199 if (getuid() == 0) {
10200 printf("(I see you are running Configure as super-user...)\n");
10201 setuid(1);
10202 }
10203#ifdef TRY_BSD_PGRP
10204 if (-1 == setpgrp(1, 1))
10205 exit(0);
10206#else
10207 if (setpgrp() != -1)
10208 exit(0);
10209#endif
10210 exit(1);
10211}
10212EOP
5440bc8e 10213 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10214 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10215 val="$define"
5440bc8e 10216 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10217 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10218 val="$undef"
10219 else
10220 echo "(I can't seem to compile and run the test program.)"
10221 if ./usg; then
10222 xxx="a USG one, i.e. you use setpgrp()."
10223 else
10224 # SVR4 systems can appear rather BSD-ish.
10225 case "$i_unistd" in
10226 $undef)
10227 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10228 val="$define"
10229 ;;
10230 $define)
10231 xxx="probably a USG one, i.e. you use setpgrp()."
10232 val="$undef"
10233 ;;
10234 esac
10235 fi
10236 echo "Assuming your setpgrp is $xxx" >&4
10237 fi
10238 ;;
10239*) val="$undef";;
10240esac
10241set d_bsdsetpgrp
10242eval $setvar
5440bc8e 10243$rm -f try try.*
b4eb6b3d
JH
10244: see if bzero exists
10245set bzero d_bzero
10246eval $inlibc
10247
10248: see if signal is declared as pointer to function returning int or void
10249echo " "
10250xxx=`./findhdr signal.h`
10251$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10252if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10253 echo "You have int (*signal())() instead of void." >&4
10254 val="$undef"
10255elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10256 echo "You have void (*signal())()." >&4
10257 val="$define"
10258elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10259 echo "You have int (*signal())() instead of void." >&4
10260 val="$undef"
10261elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10262 echo "You have void (*signal())()." >&4
10263 val="$define"
10264else
10265 case "$d_voidsig" in
10266 '')
10267 echo "I can't determine whether signal handler returns void or int..." >&4
10268 dflt=void
10269 rp="What type does your signal handler return?"
10270 . ./myread
10271 case "$ans" in
10272 v*) val="$define";;
10273 *) val="$undef";;
10274 esac;;
10275 "$define")
10276 echo "As you already told me, signal handler returns void." >&4
10277 val="$define"
10278 ;;
10279 *) echo "As you already told me, signal handler returns int." >&4
10280 val="$undef"
10281 ;;
10282 esac
10283fi
10284set d_voidsig
10285eval $setvar
10286case "$d_voidsig" in
10287"$define") signal_t="void";;
10288*) signal_t="int";;
10289esac
10290$rm -f $$.tmp
10291
10292: check for ability to cast large floats to 32-bit ints.
10293echo " "
10294echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10295if $test "$intsize" -ge 4; then
10296 xxx=int
10297else
10298 xxx=long
10299fi
10300$cat >try.c <<EOCP
10301#include <stdio.h>
d1daaddf
JH
10302#$i_stdlib I_STDLIB
10303#ifdef I_STDLIB
10304#include <stdlib.h>
10305#endif
b4eb6b3d
JH
10306#include <sys/types.h>
10307#include <signal.h>
10308$signal_t blech(s) int s; { exit(3); }
10309int main()
10310{
10311 $xxx i32;
10312 double f, g;
10313 int result = 0;
10314 char str[16];
10315 signal(SIGFPE, blech);
10316
10317 /* Don't let compiler optimize the test away. Store the number
10318 in a writable string for gcc to pass to sscanf under HP/UX.
10319 */
10320 sprintf(str, "2147483647");
10321 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10322 g = 10 * f;
10323 i32 = ($xxx) g;
10324
10325 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10326 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10327 behavior here, which is to preserve the sign and give
10328 back 0x7fff ffff.
10329 */
10330 if (i32 != ($xxx) f)
10331 result |= 1;
10332 exit(result);
10333}
10334EOCP
10335set try
10336if eval $compile_ok; then
5440bc8e 10337 $run ./try
b4eb6b3d
JH
10338 yyy=$?
10339else
10340 echo "(I can't seem to compile the test program--assuming it can't)"
10341 yyy=1
10342fi
10343case "$yyy" in
103440) val="$define"
10345 echo "Yup, it can."
10346 ;;
10347*) val="$undef"
10348 echo "Nope, it can't."
10349 ;;
10350esac
10351set d_casti32
10352eval $setvar
10353$rm -f try try.*
10354
10355: check for ability to cast negative floats to unsigned
10356echo " "
10357echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10358$cat >try.c <<EOCP
10359#include <stdio.h>
d1daaddf
JH
10360#$i_stdlib I_STDLIB
10361#ifdef I_STDLIB
10362#include <stdlib.h>
10363#endif
b4eb6b3d
JH
10364#include <sys/types.h>
10365#include <signal.h>
10366$signal_t blech(s) int s; { exit(7); }
10367$signal_t blech_in_list(s) int s; { exit(4); }
10368unsigned long dummy_long(p) unsigned long p; { return p; }
10369unsigned int dummy_int(p) unsigned int p; { return p; }
10370unsigned short dummy_short(p) unsigned short p; { return p; }
10371int main()
10372{
10373 double f;
10374 unsigned long along;
10375 unsigned int aint;
10376 unsigned short ashort;
10377 int result = 0;
10378 char str[16];
10379
10380 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10381 a direct f = -123. assignment. gcc-2.8.0 reportedly
10382 optimized the whole file away
10383 */
10384 /* Store the number in a writable string for gcc to pass to
10385 sscanf under HP/UX.
10386 */
10387 sprintf(str, "-123");
10388 sscanf(str, "%lf", &f); /* f = -123.; */
10389
10390 signal(SIGFPE, blech);
10391 along = (unsigned long)f;
10392 aint = (unsigned int)f;
10393 ashort = (unsigned short)f;
10394 if (along != (unsigned long)-123)
10395 result |= 1;
10396 if (aint != (unsigned int)-123)
10397 result |= 1;
10398 if (ashort != (unsigned short)-123)
10399 result |= 1;
10400 sprintf(str, "1073741824.");
10401 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10402 f = f + f;
10403 along = 0;
10404 along = (unsigned long)f;
10405 if (along != 0x80000000)
10406 result |= 2;
10407 f -= 1.;
10408 along = 0;
10409 along = (unsigned long)f;
10410 if (along != 0x7fffffff)
10411 result |= 1;
10412 f += 2.;
10413 along = 0;
10414 along = (unsigned long)f;
10415 if (along != 0x80000001)
10416 result |= 2;
10417 if (result)
10418 exit(result);
10419 signal(SIGFPE, blech_in_list);
10420 sprintf(str, "123.");
10421 sscanf(str, "%lf", &f); /* f = 123.; */
10422 along = dummy_long((unsigned long)f);
10423 aint = dummy_int((unsigned int)f);
10424 ashort = dummy_short((unsigned short)f);
10425 if (along != (unsigned long)123)
10426 result |= 4;
10427 if (aint != (unsigned int)123)
10428 result |= 4;
10429 if (ashort != (unsigned short)123)
10430 result |= 4;
10431 exit(result);
10432
10433}
10434EOCP
10435set try
10436if eval $compile_ok; then
5440bc8e 10437 $run ./try
b4eb6b3d
JH
10438 castflags=$?
10439else
10440 echo "(I can't seem to compile the test program--assuming it can't)"
10441 castflags=7
10442fi
10443case "$castflags" in
104440) val="$define"
10445 echo "Yup, it can."
10446 ;;
10447*) val="$undef"
10448 echo "Nope, it can't."
10449 ;;
10450esac
10451set d_castneg
10452eval $setvar
10453$rm -f try.*
10454
10455: see if vprintf exists
10456echo " "
10457if set vprintf val -f d_vprintf; eval $csym; $val; then
10458 echo 'vprintf() found.' >&4
10459 val="$define"
55954f19 10460 $cat >try.c <<EOF
b4eb6b3d 10461#include <varargs.h>
55954f19
JH
10462#$i_stdlib I_STDLIB
10463#ifdef I_STDLIB
10464#include <stdlib.h>
10465#endif
b4eb6b3d
JH
10466
10467int main() { xxx("foo"); }
10468
10469xxx(va_alist)
10470va_dcl
10471{
10472 va_list args;
10473 char buf[10];
10474
10475 va_start(args);
10476 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10477}
10478EOF
5440bc8e
JH
10479 set try
10480 if eval $compile && $run ./try; then
b4eb6b3d
JH
10481 echo "Your vsprintf() returns (int)." >&4
10482 val2="$undef"
10483 else
10484 echo "Your vsprintf() returns (char*)." >&4
10485 val2="$define"
10486 fi
10487else
10488 echo 'vprintf() NOT found.' >&4
10489 val="$undef"
10490 val2="$undef"
10491fi
5440bc8e 10492$rm -f try try.*
b4eb6b3d
JH
10493set d_vprintf
10494eval $setvar
10495val=$val2
10496set d_charvspr
10497eval $setvar
10498
10499: see if chown exists
10500set chown d_chown
10501eval $inlibc
10502
10503: see if chroot exists
10504set chroot d_chroot
10505eval $inlibc
10506
10507: see if chsize exists
10508set chsize d_chsize
10509eval $inlibc
10510
758a5d79
JH
10511: see if class exists
10512set class d_class
10513eval $inlibc
10514
b0a2e8e6
MB
10515: see if clearenv exists
10516set clearenv d_clearenv
10517eval $inlibc
10518
4e0554ec
JH
10519hasstruct='varname=$1; struct=$2; shift; shift;
10520while $test $# -ge 2; do
10521 case "$1" in
10522 $define) echo "#include <$2>";;
10523 esac ;
10524 shift 2;
10525done > try.c;
10526echo "int main () { struct $struct foo; }" >> try.c;
10527set try;
10528if eval $compile; then
10529 val="$define";
10530else
10531 val="$undef";
10532fi;
10533set $varname;
10534eval $setvar;
10535$rm -f try.c try.o'
10536
4e0554ec
JH
10537socketlib=''
10538sockethdr=''
10539: see whether socket exists
10540echo " "
10541$echo $n "Hmm... $c" >&4
10542if set socket val -f d_socket; eval $csym; $val; then
10543 echo "Looks like you have Berkeley networking support." >&4
10544 d_socket="$define"
10545 if set setsockopt val -f; eval $csym; $val; then
10546 d_oldsock="$undef"
10547 else
10548 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10549 d_oldsock="$define"
10550 fi
10551else
10552 if $contains socklib libc.list >/dev/null 2>&1; then
10553 echo "Looks like you have Berkeley networking support." >&4
10554 d_socket="$define"
10555 : we will have to assume that it supports the 4.2 BSD interface
10556 d_oldsock="$undef"
10557 else
10558 echo "You don't have Berkeley networking in libc$_a..." >&4
10559 if test "X$d_socket" = "X$define"; then
10560 echo "...but you seem to believe that you have sockets." >&4
10561 else
10562 for net in net socket
10563 do
10564 if test -f /usr/lib/lib$net$_a; then
10565 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10566 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10567 if $contains socket libc.list >/dev/null 2>&1; then
10568 d_socket="$define"
10569 socketlib="-l$net"
10570 case "$net" in
10571 net)
10572 echo "...but the Wollongong group seems to have hacked it in." >&4
10573 sockethdr="-I/usr/netinclude"
10574 ;;
10575 esac
3c728e00 10576 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10577 if $contains setsockopt libc.list >/dev/null 2>&1; then
10578 d_oldsock="$undef"
10579 else
10580 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10581 d_oldsock="$define"
10582 fi
10583 break
10584 fi
10585 fi
10586 done
10587 if test "X$d_socket" != "X$define"; then
10588 echo "or anywhere else I see." >&4
10589 d_socket="$undef"
10590 d_oldsock="$undef"
10591 fi
10592 fi
10593 fi
10594fi
10595
10596: see if socketpair exists
10597set socketpair d_sockpair
10598eval $inlibc
10599
10600
10601echo " "
3c728e00 10602echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10603for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10604 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10605 $cat >try.c <<EOF
10606#include <sys/types.h>
10607#include <sys/socket.h>
10608int main() {
10609 int i = $ENUM;
10610}
10611EOF
10612 val="$undef"
10613 set try; if eval $compile; then
10614 val="$define"
10615 fi
10616 set d_${enum}; eval $setvar
10617 $rm -f try.c try
10618done
10619
10620: see if this is a sys/uio.h system
10621set sys/uio.h i_sysuio
10622eval $inhdr
10623
10624
10625echo " "
10626echo "Checking to see if your system supports struct cmsghdr..." >&4
10627set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10628eval $hasstruct
10629case "$d_cmsghdr_s" in
10630"$define") echo "Yes, it does." ;;
10631*) echo "No, it doesn't." ;;
10632esac
10633
10634
b4eb6b3d
JH
10635: check for const keyword
10636echo " "
10637echo 'Checking to see if your C compiler knows about "const"...' >&4
10638$cat >const.c <<'EOCP'
10639typedef struct spug { int drokk; } spug;
76f47787 10640int main()
b4eb6b3d
JH
10641{
10642 const char *foo;
10643 const spug y;
10644}
10645EOCP
10646if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10647 val="$define"
10648 echo "Yup, it does."
10649else
10650 val="$undef"
10651 echo "Nope, it doesn't."
10652fi
10653set d_const
10654eval $setvar
10655
89ce900e
JH
10656: see if copysignl exists
10657set copysignl d_copysignl
10658eval $inlibc
10659
b4eb6b3d
JH
10660: see if crypt exists
10661echo " "
a5a94ea5
JH
10662set crypt d_crypt
10663eval $inlibc
10664case "$d_crypt" in
10665$define) cryptlib='' ;;
10666*) if set crypt val -f d_crypt; eval $csym; $val; then
10667 echo 'crypt() found.' >&4
b4eb6b3d 10668 val="$define"
a5a94ea5
JH
10669 cryptlib=''
10670 else
10671 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10672 if $test -z "$cryptlib"; then
10673 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10674 else
10675 cryptlib=-lcrypt
10676 fi
10677 if $test -z "$cryptlib"; then
10678 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10679 else
10680 cryptlib=-lcrypt
10681 fi
10682 if $test -z "$cryptlib"; then
10683 cryptlib=`./loc libcrypt$_a "" $libpth`
10684 else
10685 cryptlib=-lcrypt
10686 fi
10687 if $test -z "$cryptlib"; then
10688 echo 'crypt() NOT found.' >&4
10689 val="$undef"
10690 else
10691 val="$define"
10692 fi
b4eb6b3d 10693 fi
a5a94ea5
JH
10694 set d_crypt
10695 eval $setvar
10696 ;;
10697esac
b4eb6b3d 10698
10bc17b6
JH
10699: see if this is a crypt.h system
10700set crypt.h i_crypt
10701eval $inhdr
10702
10703: see if crypt_r exists
10704set crypt_r d_crypt_r
10705eval $inlibc
10706case "$d_crypt_r" in
10707"$define")
10708 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10709 case "$d_crypt_r_proto:$usethreads" in
10710 ":define") d_crypt_r_proto=define
a48ec845
JH
10711 set d_crypt_r_proto crypt_r $hdrs
10712 eval $hasproto ;;
10713 *) ;;
10714 esac
10715 case "$d_crypt_r_proto" in
10716 define)
10bc17b6
JH
10717 case "$crypt_r_proto" in
10718 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10719 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10720 esac
10721 case "$crypt_r_proto" in
b430fd04
JH
10722 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10723 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10724 esac
10725 case "$crypt_r_proto" in
90e831dc 10726 ''|0) d_crypt_r=undef
10bc17b6 10727 crypt_r_proto=0
a48ec845 10728 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10729 * ) case "$crypt_r_proto" in
10730 REENTRANT_PROTO*) ;;
10731 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10732 esac
10733 echo "Prototype: $try" ;;
10734 esac
10735 ;;
c18e646a
JH
10736 *) case "$usethreads" in
10737 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10738 esac
90e831dc
SB
10739 d_crypt_r=undef
10740 crypt_r_proto=0
c18e646a 10741 ;;
a48ec845
JH
10742 esac
10743 ;;
10bc17b6
JH
10744*) crypt_r_proto=0
10745 ;;
10746esac
10747
b4eb6b3d
JH
10748: get csh whereabouts
10749case "$csh" in
10750'csh') val="$undef" ;;
10751*) val="$define" ;;
10752esac
10753set d_csh
10754eval $setvar
10755: Respect a hint or command line value for full_csh.
10756case "$full_csh" in
10757'') full_csh=$csh ;;
10758esac
10759
10bc17b6
JH
10760: see if ctermid_r exists
10761set ctermid_r d_ctermid_r
10762eval $inlibc
10763case "$d_ctermid_r" in
10764"$define")
31ee0cb7 10765 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10766 case "$d_ctermid_r_proto:$usethreads" in
10767 ":define") d_ctermid_r_proto=define
a48ec845
JH
10768 set d_ctermid_r_proto ctermid_r $hdrs
10769 eval $hasproto ;;
10770 *) ;;
10771 esac
10772 case "$d_ctermid_r_proto" in
10773 define)
10bc17b6
JH
10774 case "$ctermid_r_proto" in
10775 ''|0) try='char* ctermid_r(char*);'
10776 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10777 esac
10778 case "$ctermid_r_proto" in
90e831dc 10779 ''|0) d_ctermid_r=undef
10bc17b6 10780 ctermid_r_proto=0
a48ec845 10781 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10782 * ) case "$ctermid_r_proto" in
10783 REENTRANT_PROTO*) ;;
10784 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10785 esac
10786 echo "Prototype: $try" ;;
10787 esac
10788 ;;
c18e646a
JH
10789 *) case "$usethreads" in
10790 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10791 esac
90e831dc
SB
10792 d_ctermid_r=undef
10793 ctermid_r_proto=0
c18e646a 10794 ;;
a48ec845
JH
10795 esac
10796 ;;
10bc17b6
JH
10797*) ctermid_r_proto=0
10798 ;;
10799esac
10800
10801: see if ctime_r exists
10802set ctime_r d_ctime_r
10803eval $inlibc
10804case "$d_ctime_r" in
10805"$define")
d63eadf0 10806 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10807 case "$d_ctime_r_proto:$usethreads" in
10808 ":define") d_ctime_r_proto=define
a48ec845
JH
10809 set d_ctime_r_proto ctime_r $hdrs
10810 eval $hasproto ;;
10811 *) ;;
10812 esac
10813 case "$d_ctime_r_proto" in
10814 define)
10bc17b6
JH
10815 case "$ctime_r_proto" in
10816 ''|0) try='char* ctime_r(const time_t*, char*);'
10817 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10818 esac
10819 case "$ctime_r_proto" in
10820 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10821 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10822 esac
10823 case "$ctime_r_proto" in
10824 ''|0) try='int ctime_r(const time_t*, char*);'
10825 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10826 esac
10827 case "$ctime_r_proto" in
10828 ''|0) try='int ctime_r(const time_t*, char*, int);'
10829 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10830 esac
10831 case "$ctime_r_proto" in
90e831dc 10832 ''|0) d_ctime_r=undef
10bc17b6 10833 ctime_r_proto=0
a48ec845 10834 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10835 * ) case "$ctime_r_proto" in
10836 REENTRANT_PROTO*) ;;
10837 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10838 esac
10839 echo "Prototype: $try" ;;
10840 esac
10841 ;;
c18e646a
JH
10842 *) case "$usethreads" in
10843 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10844 esac
90e831dc
SB
10845 d_ctime_r=undef
10846 ctime_r_proto=0
c18e646a 10847 ;;
a48ec845
JH
10848 esac
10849 ;;
10bc17b6
JH
10850*) ctime_r_proto=0
10851 ;;
10852esac
10853
b4eb6b3d
JH
10854: see if cuserid exists
10855set cuserid d_cuserid
10856eval $inlibc
10857
10858: see if this is a limits.h system
10859set limits.h i_limits
10860eval $inhdr
10861
10862: see if this is a float.h system
10863set float.h i_float
10864eval $inhdr
10865
10866: See if number of significant digits in a double precision number is known
10867echo " "
10868$cat >dbl_dig.c <<EOM
10869#$i_limits I_LIMITS
10870#$i_float I_FLOAT
10871#ifdef I_LIMITS
10872#include <limits.h>
10873#endif
10874#ifdef I_FLOAT
10875#include <float.h>
10876#endif
10877#ifdef DBL_DIG
10878printf("Contains DBL_DIG");
10879#endif
10880EOM
10881$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10882if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10883 echo "DBL_DIG found." >&4
10884 val="$define"
10885else
10886 echo "DBL_DIG NOT found." >&4
10887 val="$undef"
10888fi
10889$rm -f dbl_dig.?
10890set d_dbl_dig
10891eval $setvar
10892
2ef53570
JH
10893: see if dbm.h is available
10894: see if dbmclose exists
10895set dbmclose d_dbmclose
10896eval $inlibc
10897
10898case "$d_dbmclose" in
10899$define)
10900 set dbm.h i_dbm
10901 eval $inhdr
10902 case "$i_dbm" in
10903 $define)
10904 val="$undef"
10905 set i_rpcsvcdbm
10906 eval $setvar
10907 ;;
10908 *) set rpcsvc/dbm.h i_rpcsvcdbm
10909 eval $inhdr
10910 ;;
10911 esac
10912 ;;
10913*) echo "We won't be including <dbm.h>"
10914 val="$undef"
10915 set i_dbm
10916 eval $setvar
10917 val="$undef"
10918 set i_rpcsvcdbm
10919 eval $setvar
10920 ;;
10921esac
10922
10923: see if prototype for dbminit is available
10924echo " "
10925set d_dbminitproto dbminit $i_dbm dbm.h
10926eval $hasproto
10927
b4eb6b3d
JH
10928: see if difftime exists
10929set difftime d_difftime
10930eval $inlibc
10931
10932: see if this is a dirent system
10933echo " "
10934if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10935 val="$define"
10936 echo "<dirent.h> found." >&4
10937else
10938 val="$undef"
10939 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10940 echo "<sys/dir.h> found." >&4
10941 echo " "
10942 else
10943 xinc=`./findhdr sys/ndir.h`
10944 fi
10945 echo "<dirent.h> NOT found." >&4
10946fi
10947set i_dirent
10948eval $setvar
10949
10950: Look for type of directory structure.
10951echo " "
10952$cppstdin $cppflags $cppminus < "$xinc" > try.c
10953
10954case "$direntrytype" in
10955''|' ')
10956 case "$i_dirent" in
10957 $define) guess1='struct dirent' ;;
10958 *) guess1='struct direct' ;;
10959 esac
10960 ;;
10961*) guess1="$direntrytype"
10962 ;;
10963esac
10964
10965case "$guess1" in
10966'struct dirent') guess2='struct direct' ;;
10967*) guess2='struct dirent' ;;
10968esac
10969
10970if $contains "$guess1" try.c >/dev/null 2>&1; then
10971 direntrytype="$guess1"
10972 echo "Your directory entries are $direntrytype." >&4
10973elif $contains "$guess2" try.c >/dev/null 2>&1; then
10974 direntrytype="$guess2"
10975 echo "Your directory entries seem to be $direntrytype." >&4
10976else
10977 echo "I don't recognize your system's directory entries." >&4
10978 rp="What type is used for directory entries on this system?"
10979 dflt="$guess1"
10980 . ./myread
10981 direntrytype="$ans"
10982fi
10983$rm -f try.c
10984
10985
10986: see if the directory entry stores field length
10987echo " "
10988$cppstdin $cppflags $cppminus < "$xinc" > try.c
10989if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10990 echo "Good, your directory entry keeps length information in d_namlen." >&4
10991 val="$define"
10992else
10993 echo "Your directory entry does not know about the d_namlen field." >&4
10994 val="$undef"
10995fi
10996set d_dirnamlen
10997eval $setvar
10998$rm -f try.c
10999
ae0e3d3b
JH
11000: see if this is an sysdir system
11001set sys/dir.h i_sysdir
11002eval $inhdr
11003
11004: see if this is an sysndir system
11005set sys/ndir.h i_sysndir
11006eval $inhdr
11007
11008: Look for dirfd
11009echo " "
11010$cat >dirfd.c <<EOM
11011#include <stdio.h>
55954f19
JH
11012#$i_stdlib I_STDLIB
11013#ifdef I_STDLIB
11014#include <stdlib.h>
11015#endif
ae0e3d3b
JH
11016#$i_dirent I_DIRENT /**/
11017#$i_sysdir I_SYS_DIR /**/
11018#$i_sysndir I_SYS_NDIR /**/
11019#$i_systypes I_SYS_TYPES /**/
11020#if defined(I_SYS_TYPES)
11021#include <sys/types.h>
11022#endif
11023#if defined(I_DIRENT)
11024#include <dirent.h>
11025#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11026#include <sys/dir.h>
11027#endif
11028#else
11029#ifdef I_SYS_NDIR
11030#include <sys/ndir.h>
11031#else
11032#ifdef I_SYS_DIR
11033#ifdef hp9000s500
11034#include <ndir.h> /* may be wrong in the future */
11035#else
11036#include <sys/dir.h>
11037#endif
11038#endif
11039#endif
11040#endif
11041int main() {
11042 DIR *dirp = opendir(".");
11043 if (dirfd(dirp) >= 0)
11044 exit(0);
11045 else
11046 exit(1);
11047}
11048EOM
5cadb3f3 11049val=$undef
ae0e3d3b
JH
11050set dirfd
11051if eval $compile; then
11052 val="$define"
11053fi
11054case "$val" in
11055$define) echo "dirfd() found." >&4 ;;
11056*) echo "dirfd() NOT found." >&4 ;;
11057esac
11058set d_dirfd
11059eval $setvar
11060$rm -f dirfd*
11061
b4eb6b3d
JH
11062: see if dlerror exists
11063xxx_runnm="$runnm"
11064runnm=false
11065set dlerror d_dlerror
11066eval $inlibc
11067runnm="$xxx_runnm"
11068
11069: see if dlfcn is available
11070set dlfcn.h i_dlfcn
11071eval $inhdr
11072
11073case "$usedl" in
11074$define|y|true)
11075 $cat << EOM
11076
11077On a few systems, the dynamically loaded modules that perl generates and uses
11078will need a different extension than shared libs. The default will probably
11079be appropriate.
11080
11081EOM
11082 case "$dlext" in
11083 '') dflt="$so" ;;
11084 *) dflt="$dlext" ;;
11085 esac
11086 rp='What is the extension of dynamically loaded modules'
11087 . ./myread
11088 dlext="$ans"
11089 ;;
11090*)
11091 dlext="none"
11092 ;;
11093esac
11094
11095: Check if dlsym need a leading underscore
11096echo " "
11097val="$undef"
11098
11099case "$dlsrc" in
11100dl_dlopen.xs)
11101 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11102 $cat >dyna.c <<'EOM'
11103fred () { }
11104EOM
11105
11106$cat >fred.c<<EOM
11107
11108#include <stdio.h>
55954f19
JH
11109#$i_stdlib I_STDLIB
11110#ifdef I_STDLIB
11111#include <stdlib.h>
11112#endif
b4eb6b3d
JH
11113#$i_dlfcn I_DLFCN
11114#ifdef I_DLFCN
5440bc8e 11115#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11116#else
11117#include <sys/types.h>
11118#include <nlist.h>
11119#include <link.h>
11120#endif
11121
11122extern int fred() ;
11123
11124int main()
11125{
11126 void * handle ;
11127 void * symbol ;
11128#ifndef RTLD_LAZY
11129 int mode = 1 ;
11130#else
11131 int mode = RTLD_LAZY ;
11132#endif
11133 handle = dlopen("./dyna.$dlext", mode) ;
11134 if (handle == NULL) {
11135 printf ("1\n") ;
11136 fflush (stdout) ;
11137 exit(0);
11138 }
11139 symbol = dlsym(handle, "fred") ;
11140 if (symbol == NULL) {
11141 /* try putting a leading underscore */
11142 symbol = dlsym(handle, "_fred") ;
11143 if (symbol == NULL) {
11144 printf ("2\n") ;
11145 fflush (stdout) ;
11146 exit(0);
11147 }
11148 printf ("3\n") ;
11149 }
11150 else
11151 printf ("4\n") ;
11152 fflush (stdout) ;
11153 exit(0);
11154}
11155EOM
11156 : Call the object file tmp-dyna.o in case dlext=o.
11157 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11158 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11159 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11160 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11161 xxx=`$run ./fred`
b4eb6b3d
JH
11162 case $xxx in
11163 1) echo "Test program failed using dlopen." >&4
11164 echo "Perhaps you should not use dynamic loading." >&4;;
11165 2) echo "Test program failed using dlsym." >&4
11166 echo "Perhaps you should not use dynamic loading." >&4;;
11167 3) echo "dlsym needs a leading underscore" >&4
11168 val="$define" ;;
11169 4) echo "dlsym doesn't need a leading underscore." >&4;;
11170 esac
11171 else
11172 echo "I can't compile and run the test program." >&4
11173 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11174 fi
11175 ;;
11176esac
11177
3c728e00 11178$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11179
11180set d_dlsymun
11181eval $setvar
11182
10bc17b6
JH
11183: see if drand48_r exists
11184set drand48_r d_drand48_r
11185eval $inlibc
11186case "$d_drand48_r" in
11187"$define")
11188 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11189 case "$d_drand48_r_proto:$usethreads" in
11190 ":define") d_drand48_r_proto=define
a48ec845
JH
11191 set d_drand48_r_proto drand48_r $hdrs
11192 eval $hasproto ;;
11193 *) ;;
11194 esac
11195 case "$d_drand48_r_proto" in
11196 define)
10bc17b6
JH
11197 case "$drand48_r_proto" in
11198 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11199 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11200 esac
11201 case "$drand48_r_proto" in
90e831dc 11202 ''|0) d_drand48_r=undef
10bc17b6 11203 drand48_r_proto=0
a48ec845 11204 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11205 * ) case "$drand48_r_proto" in
11206 REENTRANT_PROTO*) ;;
11207 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11208 esac
11209 echo "Prototype: $try" ;;
11210 esac
11211 ;;
c18e646a
JH
11212 *) case "$usethreads" in
11213 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11214 esac
90e831dc
SB
11215 d_drand48_r=undef
11216 drand48_r_proto=0
c18e646a 11217 ;;
a48ec845
JH
11218 esac
11219 ;;
10bc17b6
JH
11220*) drand48_r_proto=0
11221 ;;
11222esac
11223
11224: see if prototype for drand48 is available
11225echo " "
11226set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11227eval $hasproto
11228
b4eb6b3d
JH
11229: see if dup2 exists
11230set dup2 d_dup2
11231eval $inlibc
11232
11233: see if eaccess exists
11234set eaccess d_eaccess
11235eval $inlibc
11236
11237: see if endgrent exists
11238set endgrent d_endgrent
11239eval $inlibc
11240
10bc17b6
JH
11241: see if this is an grp system
11242set grp.h i_grp
11243eval $inhdr
11244
11245case "$i_grp" in
11246$define)
11247 xxx=`./findhdr grp.h`
11248 $cppstdin $cppflags $cppminus < $xxx >$$.h
11249
11250 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11251 val="$define"
11252 else
11253 val="$undef"
11254 fi
11255 set d_grpasswd
11256 eval $setvar
11257
11258 $rm -f $$.h
11259 ;;
11260*)
11261 val="$undef";
11262 set d_grpasswd; eval $setvar
11263 ;;
11264esac
11265
11266: see if endgrent_r exists
11267set endgrent_r d_endgrent_r
11268eval $inlibc
11269case "$d_endgrent_r" in
11270"$define")
11271 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11272 case "$d_endgrent_r_proto:$usethreads" in
11273 ":define") d_endgrent_r_proto=define
a48ec845
JH
11274 set d_endgrent_r_proto endgrent_r $hdrs
11275 eval $hasproto ;;
11276 *) ;;
11277 esac
11278 case "$d_endgrent_r_proto" in
11279 define)
10bc17b6
JH
11280 case "$endgrent_r_proto" in
11281 ''|0) try='int endgrent_r(FILE**);'
11282 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11283 esac
11284 case "$endgrent_r_proto" in
11285 ''|0) try='void endgrent_r(FILE**);'
11286 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11287 esac
11288 case "$endgrent_r_proto" in
90e831dc 11289 ''|0) d_endgrent_r=undef
10bc17b6 11290 endgrent_r_proto=0
a48ec845 11291 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11292 * ) case "$endgrent_r_proto" in
11293 REENTRANT_PROTO*) ;;
11294 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11295 esac
11296 echo "Prototype: $try" ;;
11297 esac
11298 ;;
c18e646a
JH
11299 *) case "$usethreads" in
11300 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11301 esac
90e831dc
SB
11302 d_endgrent_r=undef
11303 endgrent_r_proto=0
c18e646a 11304 ;;
a48ec845
JH
11305 esac
11306 ;;
10bc17b6
JH
11307*) endgrent_r_proto=0
11308 ;;
11309esac
11310
b4eb6b3d
JH
11311: see if endhostent exists
11312set endhostent d_endhent
11313eval $inlibc
11314
10bc17b6
JH
11315: see if this is a netdb.h system
11316set netdb.h i_netdb
11317eval $inhdr
11318
11319: see if endhostent_r exists
11320set endhostent_r d_endhostent_r
11321eval $inlibc
11322case "$d_endhostent_r" in
11323"$define")
11324 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11325 case "$d_endhostent_r_proto:$usethreads" in
11326 ":define") d_endhostent_r_proto=define
a48ec845
JH
11327 set d_endhostent_r_proto endhostent_r $hdrs
11328 eval $hasproto ;;
11329 *) ;;
11330 esac
11331 case "$d_endhostent_r_proto" in
11332 define)
10bc17b6
JH
11333 case "$endhostent_r_proto" in
11334 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11335 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11336 esac
11337 case "$endhostent_r_proto" in
11338 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11339 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11340 esac
11341 case "$endhostent_r_proto" in
90e831dc 11342 ''|0) d_endhostent_r=undef
10bc17b6 11343 endhostent_r_proto=0
a48ec845 11344 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11345 * ) case "$endhostent_r_proto" in
11346 REENTRANT_PROTO*) ;;
11347 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11348 esac
11349 echo "Prototype: $try" ;;
11350 esac
11351 ;;
c18e646a
JH
11352 *) case "$usethreads" in
11353 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11354 esac
90e831dc
SB
11355 d_endhostent_r=undef
11356 endhostent_r_proto=0
c18e646a 11357 ;;
a48ec845
JH
11358 esac
11359 ;;
10bc17b6
JH
11360*) endhostent_r_proto=0
11361 ;;
11362esac
11363
b4eb6b3d
JH
11364: see if endnetent exists
11365set endnetent d_endnent
11366eval $inlibc
11367
10bc17b6
JH
11368: see if endnetent_r exists
11369set endnetent_r d_endnetent_r
11370eval $inlibc
11371case "$d_endnetent_r" in
11372"$define")
11373 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11374 case "$d_endnetent_r_proto:$usethreads" in
11375 ":define") d_endnetent_r_proto=define
a48ec845
JH
11376 set d_endnetent_r_proto endnetent_r $hdrs
11377 eval $hasproto ;;
11378 *) ;;
11379 esac
11380 case "$d_endnetent_r_proto" in
11381 define)
10bc17b6
JH
11382 case "$endnetent_r_proto" in
11383 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11384 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11385 esac
11386 case "$endnetent_r_proto" in
11387 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11388 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11389 esac
11390 case "$endnetent_r_proto" in
90e831dc 11391 ''|0) d_endnetent_r=undef
10bc17b6 11392 endnetent_r_proto=0
a48ec845 11393 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11394 * ) case "$endnetent_r_proto" in
11395 REENTRANT_PROTO*) ;;
11396 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11397 esac
11398 echo "Prototype: $try" ;;
11399 esac
11400 ;;
c18e646a
JH
11401 *) case "$usethreads" in
11402 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11403 esac
90e831dc
SB
11404 d_endnetent_r=undef
11405 endnetent_r_proto=0
c18e646a 11406 ;;
a48ec845
JH
11407 esac
11408 ;;
10bc17b6
JH
11409*) endnetent_r_proto=0
11410 ;;
11411esac
11412
b4eb6b3d
JH
11413: see if endprotoent exists
11414set endprotoent d_endpent
11415eval $inlibc
11416
10bc17b6
JH
11417: see if endprotoent_r exists
11418set endprotoent_r d_endprotoent_r
11419eval $inlibc
11420case "$d_endprotoent_r" in
11421"$define")
11422 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11423 case "$d_endprotoent_r_proto:$usethreads" in
11424 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11425 set d_endprotoent_r_proto endprotoent_r $hdrs
11426 eval $hasproto ;;
11427 *) ;;
11428 esac
11429 case "$d_endprotoent_r_proto" in
11430 define)
10bc17b6
JH
11431 case "$endprotoent_r_proto" in
11432 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11433 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11434 esac
11435 case "$endprotoent_r_proto" in
11436 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11437 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11438 esac
11439 case "$endprotoent_r_proto" in
90e831dc 11440 ''|0) d_endprotoent_r=undef
10bc17b6 11441 endprotoent_r_proto=0
a48ec845 11442 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11443 * ) case "$endprotoent_r_proto" in
11444 REENTRANT_PROTO*) ;;
11445 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11446 esac
11447 echo "Prototype: $try" ;;
11448 esac
11449 ;;
c18e646a
JH
11450 *) case "$usethreads" in
11451 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11452 esac
90e831dc
SB
11453 d_endprotoent_r=undef
11454 endprotoent_r_proto=0
c18e646a 11455 ;;
a48ec845
JH
11456 esac
11457 ;;
10bc17b6
JH
11458*) endprotoent_r_proto=0
11459 ;;
11460esac
11461
b4eb6b3d
JH
11462: see if endpwent exists
11463set endpwent d_endpwent
11464eval $inlibc
11465
10bc17b6
JH
11466: see if this is a pwd.h system
11467set pwd.h i_pwd
11468eval $inhdr
11469
11470case "$i_pwd" in
11471$define)
11472 xxx=`./findhdr pwd.h`
11473 $cppstdin $cppflags $cppminus < $xxx >$$.h
11474
11475 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11476 val="$define"
11477 else
11478 val="$undef"
11479 fi
11480 set d_pwquota
11481 eval $setvar
11482
11483 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11484 val="$define"
11485 else
11486 val="$undef"
11487 fi
11488 set d_pwage
11489 eval $setvar
11490
11491 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11492 val="$define"
11493 else
11494 val="$undef"
11495 fi
11496 set d_pwchange
11497 eval $setvar
11498
11499 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11500 val="$define"
11501 else
11502 val="$undef"
11503 fi
11504 set d_pwclass
11505 eval $setvar
11506
11507 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11508 val="$define"
11509 else
11510 val="$undef"
11511 fi
11512 set d_pwexpire
11513 eval $setvar
11514
11515 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11516 val="$define"
11517 else
11518 val="$undef"
11519 fi
11520 set d_pwcomment
11521 eval $setvar
11522
11523 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11524 val="$define"
11525 else
11526 val="$undef"
11527 fi
11528 set d_pwgecos
11529 eval $setvar
11530
11531 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11532 val="$define"
11533 else
11534 val="$undef"
11535 fi
11536 set d_pwpasswd
11537 eval $setvar
11538
11539 $rm -f $$.h
11540 ;;
11541*)
11542 val="$undef";
11543 set d_pwquota; eval $setvar
11544 set d_pwage; eval $setvar
11545 set d_pwchange; eval $setvar
11546 set d_pwclass; eval $setvar
11547 set d_pwexpire; eval $setvar
11548 set d_pwcomment; eval $setvar
11549 set d_pwgecos; eval $setvar
11550 set d_pwpasswd; eval $setvar
11551 ;;
11552esac
11553
11554: see if endpwent_r exists
11555set endpwent_r d_endpwent_r
11556eval $inlibc
11557case "$d_endpwent_r" in
11558"$define")
11559 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11560 case "$d_endpwent_r_proto:$usethreads" in
11561 ":define") d_endpwent_r_proto=define
a48ec845
JH
11562 set d_endpwent_r_proto endpwent_r $hdrs
11563 eval $hasproto ;;
11564 *) ;;
11565 esac
11566 case "$d_endpwent_r_proto" in
11567 define)
10bc17b6
JH
11568 case "$endpwent_r_proto" in
11569 ''|0) try='int endpwent_r(FILE**);'
11570 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11571 esac
11572 case "$endpwent_r_proto" in
11573 ''|0) try='void endpwent_r(FILE**);'
11574 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11575 esac
11576 case "$endpwent_r_proto" in
90e831dc 11577 ''|0) d_endpwent_r=undef
10bc17b6 11578 endpwent_r_proto=0
a48ec845 11579 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11580 * ) case "$endpwent_r_proto" in
11581 REENTRANT_PROTO*) ;;
11582 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11583 esac
11584 echo "Prototype: $try" ;;
11585 esac
11586 ;;
c18e646a
JH
11587 *) case "$usethreads" in
11588 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11589 esac
90e831dc
SB
11590 d_endpwent_r=undef
11591 endpwent_r_proto=0
c18e646a 11592 ;;
a48ec845
JH
11593 esac
11594 ;;
10bc17b6
JH
11595*) endpwent_r_proto=0
11596 ;;
11597esac
11598
b4eb6b3d
JH
11599: see if endservent exists
11600set endservent d_endsent
11601eval $inlibc
11602
10bc17b6
JH
11603: see if endservent_r exists
11604set endservent_r d_endservent_r
11605eval $inlibc
11606case "$d_endservent_r" in
11607"$define")
11608 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11609 case "$d_endservent_r_proto:$usethreads" in
11610 ":define") d_endservent_r_proto=define
a48ec845
JH
11611 set d_endservent_r_proto endservent_r $hdrs
11612 eval $hasproto ;;
11613 *) ;;
11614 esac
11615 case "$d_endservent_r_proto" in
11616 define)
10bc17b6
JH
11617 case "$endservent_r_proto" in
11618 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11619 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11620 esac
11621 case "$endservent_r_proto" in
11622 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11623 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11624 esac
11625 case "$endservent_r_proto" in
90e831dc 11626 ''|0) d_endservent_r=undef
10bc17b6 11627 endservent_r_proto=0
a48ec845 11628 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11629 * ) case "$endservent_r_proto" in
11630 REENTRANT_PROTO*) ;;
11631 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11632 esac
11633 echo "Prototype: $try" ;;
11634 esac
11635 ;;
c18e646a
JH
11636 *) case "$usethreads" in
11637 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11638 esac
90e831dc
SB
11639 d_endservent_r=undef
11640 endservent_r_proto=0
c18e646a 11641 ;;
a48ec845
JH
11642 esac
11643 ;;
10bc17b6
JH
11644*) endservent_r_proto=0
11645 ;;
11646esac
11647
b4eb6b3d
JH
11648: Locate the flags for 'open()'
11649echo " "
55954f19 11650$cat >try.c <<EOCP
b4eb6b3d
JH
11651#include <sys/types.h>
11652#ifdef I_FCNTL
11653#include <fcntl.h>
11654#endif
11655#ifdef I_SYS_FILE
11656#include <sys/file.h>
11657#endif
55954f19
JH
11658#$i_stdlib I_STDLIB
11659#ifdef I_STDLIB
11660#include <stdlib.h>
11661#endif
b4eb6b3d
JH
11662int main() {
11663 if(O_RDONLY);
11664#ifdef O_TRUNC
11665 exit(0);
11666#else
11667 exit(1);
11668#endif
11669}
11670EOCP
11671: check sys/file.h first to get FREAD on Sun
11672if $test `./findhdr sys/file.h` && \
5440bc8e 11673 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11674 h_sysfile=true;
11675 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11676 if $run ./try; then
b4eb6b3d
JH
11677 echo "and you have the 3 argument form of open()." >&4
11678 val="$define"
11679 else
11680 echo "but not the 3 argument form of open(). Oh, well." >&4
11681 val="$undef"
11682 fi
11683elif $test `./findhdr fcntl.h` && \
5440bc8e 11684 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11685 h_fcntl=true;
11686 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11687 if $run ./try; then
b4eb6b3d
JH
11688 echo "and you have the 3 argument form of open()." >&4
11689 val="$define"
11690 else
11691 echo "but not the 3 argument form of open(). Oh, well." >&4
11692 val="$undef"
11693 fi
11694else
11695 val="$undef"
11696 echo "I can't find the O_* constant definitions! You got problems." >&4
11697fi
11698set d_open3
11699eval $setvar
5440bc8e 11700$rm -f try try.*
b4eb6b3d
JH
11701
11702: see which of string.h or strings.h is needed
11703echo " "
11704strings=`./findhdr string.h`
11705if $test "$strings" && $test -r "$strings"; then
11706 echo "Using <string.h> instead of <strings.h>." >&4
11707 val="$define"
11708else
11709 val="$undef"
11710 strings=`./findhdr strings.h`
11711 if $test "$strings" && $test -r "$strings"; then
11712 echo "Using <strings.h> instead of <string.h>." >&4
11713 else
11714 echo "No string header found -- You'll surely have problems." >&4
11715 fi
11716fi
11717set i_string
11718eval $setvar
11719case "$i_string" in
11720"$undef") strings=`./findhdr strings.h`;;
11721*) strings=`./findhdr string.h`;;
11722esac
11723
3c728e00
JH
11724: see if this is a sys/file.h system
11725val=''
11726set sys/file.h val
11727eval $inhdr
11728
11729: do we need to include sys/file.h ?
11730case "$val" in
11731"$define")
11732 echo " "
11733 if $h_sysfile; then
11734 val="$define"
11735 echo "We'll be including <sys/file.h>." >&4
11736 else
11737 val="$undef"
11738 echo "We won't be including <sys/file.h>." >&4
11739 fi
11740 ;;
11741*)
11742 h_sysfile=false
11743 ;;
11744esac
11745set i_sysfile
11746eval $setvar
11747
11748: see if fcntl.h is there
11749val=''
11750set fcntl.h val
11751eval $inhdr
11752
11753: see if we can include fcntl.h
11754case "$val" in
11755"$define")
11756 echo " "
11757 if $h_fcntl; then
11758 val="$define"
11759 echo "We'll be including <fcntl.h>." >&4
11760 else
11761 val="$undef"
11762 if $h_sysfile; then
11763 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11764 else
11765 echo "We won't be including <fcntl.h>." >&4
11766 fi
11767 fi
11768 ;;
11769*)
11770 h_fcntl=false
11771 val="$undef"
11772 ;;
11773esac
11774set i_fcntl
11775eval $setvar
11776
b4eb6b3d
JH
11777: check for non-blocking I/O stuff
11778case "$h_sysfile" in
a0acbdc3
JH
11779true) echo "#include <sys/file.h>" > head.c;;
11780*)
11781 case "$h_fcntl" in
11782 true) echo "#include <fcntl.h>" > head.c;;
11783 *) echo "#include <sys/fcntl.h>" > head.c;;
11784 esac
11785 ;;
b4eb6b3d
JH
11786esac
11787echo " "
11788echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11789case "$o_nonblock" in
11790'')
11791 $cat head.c > try.c
3c728e00 11792 $cat >>try.c <<EOCP
b4eb6b3d 11793#include <stdio.h>
55954f19
JH
11794#$i_stdlib I_STDLIB
11795#ifdef I_STDLIB
80b3ef99 11796#include <stdlib.h>
55954f19 11797#endif
3c728e00
JH
11798#$i_fcntl I_FCNTL
11799#ifdef I_FCNTL
11800#include <fcntl.h>
11801#endif
b4eb6b3d
JH
11802int main() {
11803#ifdef O_NONBLOCK
11804 printf("O_NONBLOCK\n");
11805 exit(0);
11806#endif
11807#ifdef O_NDELAY
11808 printf("O_NDELAY\n");
11809 exit(0);
11810#endif
11811#ifdef FNDELAY
11812 printf("FNDELAY\n");
11813 exit(0);
11814#endif
11815 exit(0);
11816}
11817EOCP
11818 set try
11819 if eval $compile_ok; then
5440bc8e 11820 o_nonblock=`$run ./try`
b4eb6b3d
JH
11821 case "$o_nonblock" in
11822 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11823 *) echo "Seems like we can use $o_nonblock.";;
11824 esac
11825 else
11826 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11827 fi
11828 ;;
11829*) echo "Using $hint value $o_nonblock.";;
11830esac
11831$rm -f try try.* .out core
11832
11833echo " "
11834echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11835case "$eagain" in
11836'')
11837 $cat head.c > try.c
11838 $cat >>try.c <<EOCP
11839#include <errno.h>
11840#include <sys/types.h>
11841#include <signal.h>
11842#include <stdio.h>
55954f19
JH
11843#$i_stdlib I_STDLIB
11844#ifdef I_STDLIB
11845#include <stdlib.h>
11846#endif
1deb0a86
JH
11847#$i_fcntl I_FCNTL
11848#ifdef I_FCNTL
11849#include <fcntl.h>
11850#endif
b4eb6b3d
JH
11851#define MY_O_NONBLOCK $o_nonblock
11852#ifndef errno /* XXX need better Configure test */
11853extern int errno;
11854#endif
11855#$i_unistd I_UNISTD
11856#ifdef I_UNISTD
11857#include <unistd.h>
11858#endif
11859#$i_string I_STRING
11860#ifdef I_STRING
11861#include <string.h>
11862#else
11863#include <strings.h>
11864#endif
11865$signal_t blech(x) int x; { exit(3); }
11866EOCP
11867 $cat >> try.c <<'EOCP'
11868int main()
11869{
11870 int pd[2];
11871 int pu[2];
11872 char buf[1];
11873 char string[100];
11874
11875 pipe(pd); /* Down: child -> parent */
11876 pipe(pu); /* Up: parent -> child */
11877 if (0 != fork()) {
11878 int ret;
11879 close(pd[1]); /* Parent reads from pd[0] */
11880 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11881#ifdef F_SETFL
b4eb6b3d
JH
11882 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11883 exit(1);
a0acbdc3
JH
11884#else
11885 exit(4);
11886#endif
b4eb6b3d
JH
11887 signal(SIGALRM, blech);
11888 alarm(5);
11889 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11890 exit(2);
11891 sprintf(string, "%d\n", ret);
11892 write(2, string, strlen(string));
11893 alarm(0);
11894#ifdef EAGAIN
11895 if (errno == EAGAIN) {
11896 printf("EAGAIN\n");
11897 goto ok;
11898 }
11899#endif
11900#ifdef EWOULDBLOCK
11901 if (errno == EWOULDBLOCK)
11902 printf("EWOULDBLOCK\n");
11903#endif
11904 ok:
11905 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11906 sleep(2); /* Give it time to close our pipe */
11907 alarm(5);
11908 ret = read(pd[0], buf, 1); /* Should read EOF */
11909 alarm(0);
11910 sprintf(string, "%d\n", ret);
868439a2 11911 write(4, string, strlen(string));
b4eb6b3d
JH
11912 exit(0);
11913 }
11914
11915 close(pd[0]); /* We write to pd[1] */
11916 close(pu[1]); /* We read from pu[0] */
11917 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11918 close(pd[1]); /* Pipe pd is now fully closed! */
11919 exit(0); /* Bye bye, thank you for playing! */
11920}
11921EOCP
11922 set try
11923 if eval $compile_ok; then
11924 echo "$startsh" >mtry
868439a2 11925 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11926 chmod +x mtry
11927 ./mtry >/dev/null 2>&1
11928 case $? in
11929 0) eagain=`$cat try.out`;;
11930 1) echo "Could not perform non-blocking setting!";;
11931 2) echo "I did a successful read() for something that was not there!";;
11932 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11933 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11934 *) echo "Something terribly wrong happened during testing.";;
11935 esac
11936 rd_nodata=`$cat try.ret`
11937 echo "A read() system call with no data present returns $rd_nodata."
11938 case "$rd_nodata" in
11939 0|-1) ;;
11940 *)
11941 echo "(That's peculiar, fixing that to be -1.)"
11942 rd_nodata=-1
11943 ;;
11944 esac
11945 case "$eagain" in
11946 '')
11947 echo "Forcing errno EAGAIN on read() with no data available."
11948 eagain=EAGAIN
11949 ;;
11950 *)
11951 echo "Your read() sets errno to $eagain when no data is available."
11952 ;;
11953 esac
11954 status=`$cat try.err`
11955 case "$status" in
11956 0) echo "And it correctly returns 0 to signal EOF.";;
11957 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11958 *) echo "However, your read() returns '$status' on EOF??";;
11959 esac
11960 val="$define"
11961 if test "$status" = "$rd_nodata"; then
11962 echo "WARNING: you can't distinguish between EOF and no data!"
11963 val="$undef"
11964 fi
11965 else
11966 echo "I can't compile the test program--assuming errno EAGAIN will do."
11967 eagain=EAGAIN
11968 fi
11969 set d_eofnblk
11970 eval $setvar
11971 ;;
11972*)
11973 echo "Using $hint value $eagain."
11974 echo "Your read() returns $rd_nodata when no data is present."
11975 case "$d_eofnblk" in
11976 "$define") echo "And you can see EOF because read() returns 0.";;
11977 "$undef") echo "But you can't see EOF status from read() returned value.";;
11978 *)
11979 echo "(Assuming you can't see EOF status from read anyway.)"
11980 d_eofnblk=$undef
11981 ;;
11982 esac
11983 ;;
11984esac
11985$rm -f try try.* .out core head.c mtry
11986
15b61c98
JH
11987: see if _ptr and _cnt from stdio act std
11988echo " "
b4eb6b3d 11989
15b61c98
JH
11990if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11991 echo "(Looks like you have stdio.h from BSD.)"
11992 case "$stdio_ptr" in
11993 '') stdio_ptr='((fp)->_p)'
11994 ptr_lval=$define
11995 ;;
11996 *) ptr_lval=$d_stdio_ptr_lval;;
11997 esac
11998 case "$stdio_cnt" in
11999 '') stdio_cnt='((fp)->_r)'
12000 cnt_lval=$define
12001 ;;
12002 *) cnt_lval=$d_stdio_cnt_lval;;
12003 esac
12004 case "$stdio_base" in
12005 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12006 esac
12007 case "$stdio_bufsiz" in
12008 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12009 esac
12010elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12011 echo "(Looks like you have stdio.h from Linux.)"
12012 case "$stdio_ptr" in
12013 '') stdio_ptr='((fp)->_IO_read_ptr)'
12014 ptr_lval=$define
12015 ;;
12016 *) ptr_lval=$d_stdio_ptr_lval;;
12017 esac
12018 case "$stdio_cnt" in
12019 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12020 cnt_lval=$undef
12021 ;;
12022 *) cnt_lval=$d_stdio_cnt_lval;;
12023 esac
12024 case "$stdio_base" in
12025 '') stdio_base='((fp)->_IO_read_base)';;
12026 esac
12027 case "$stdio_bufsiz" in
12028 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12029 esac
12030else
12031 case "$stdio_ptr" in
12032 '') stdio_ptr='((fp)->_ptr)'
12033 ptr_lval=$define
12034 ;;
12035 *) ptr_lval=$d_stdio_ptr_lval;;
12036 esac
12037 case "$stdio_cnt" in
12038 '') stdio_cnt='((fp)->_cnt)'
12039 cnt_lval=$define
12040 ;;
12041 *) cnt_lval=$d_stdio_cnt_lval;;
12042 esac
12043 case "$stdio_base" in
12044 '') stdio_base='((fp)->_base)';;
12045 esac
12046 case "$stdio_bufsiz" in
12047 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12048 esac
12049fi
b4eb6b3d 12050
15b61c98
JH
12051: test whether _ptr and _cnt really work
12052echo "Checking how std your stdio is..." >&4
12053$cat >try.c <<EOP
12054#include <stdio.h>
55954f19
JH
12055#$i_stdlib I_STDLIB
12056#ifdef I_STDLIB
9d9004a9 12057#include <stdlib.h>
55954f19 12058#endif
15b61c98
JH
12059#define FILE_ptr(fp) $stdio_ptr
12060#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12061int main() {
15b61c98
JH
12062 FILE *fp = fopen("try.c", "r");
12063 char c = getc(fp);
12064 if (
12065 18 <= FILE_cnt(fp) &&
12066 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12067 )
12068 exit(0);
12069 exit(1);
9d9004a9 12070}
15b61c98
JH
12071EOP
12072val="$undef"
12073set try
12074if eval $compile && $to try.c; then
12075 if $run ./try; then
12076 echo "Your stdio acts pretty std."
12077 val="$define"
9d9004a9 12078 else
15b61c98 12079 echo "Your stdio isn't very std."
9d9004a9 12080 fi
15b61c98
JH
12081else
12082 echo "Your stdio doesn't appear very std."
12083fi
12084$rm -f try.c try
12085
12086# glibc 2.2.90 and above apparently change stdio streams so Perl's
12087# direct buffer manipulation no longer works. The Configure tests
12088# should be changed to correctly detect this, but until then,
12089# the following check should at least let perl compile and run.
12090# (This quick fix should be updated before 5.8.1.)
12091# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12092# A. Dougherty, June 3, 2002.
12093case "$d_gnulibc" in
12094$define)
12095 case "$gnulibc_version" in
12096 2.[01]*) ;;
12097 2.2) ;;
12098 2.2.[0-9]) ;;
12099 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12100 val="$undef"
12101 ;;
12102 esac
9d9004a9
AD
12103 ;;
12104esac
15b61c98 12105set d_stdstdio
9d9004a9 12106eval $setvar
9d9004a9 12107
15b61c98
JH
12108: Can _ptr be used as an lvalue?
12109case "$d_stdstdio$ptr_lval" in
12110$define$define) val=$define ;;
12111*) val=$undef ;;
12112esac
12113set d_stdio_ptr_lval
12114eval $setvar
9d9004a9 12115
15b61c98
JH
12116: Can _cnt be used as an lvalue?
12117case "$d_stdstdio$cnt_lval" in
12118$define$define) val=$define ;;
12119*) val=$undef ;;
12120esac
12121set d_stdio_cnt_lval
12122eval $setvar
b4eb6b3d 12123
15b61c98
JH
12124
12125: test whether setting _ptr sets _cnt as a side effect
12126d_stdio_ptr_lval_sets_cnt="$undef"
12127d_stdio_ptr_lval_nochange_cnt="$undef"
12128case "$d_stdio_ptr_lval$d_stdstdio" in
12129$define$define)
12130 echo "Checking to see what happens if we set the stdio ptr..." >&4
12131$cat >try.c <<EOP
12132#include <stdio.h>
12133/* Can we scream? */
12134/* Eat dust sed :-) */
12135/* In the buffer space, no one can hear you scream. */
55954f19
JH
12136#$i_stdlib I_STDLIB
12137#ifdef I_STDLIB
12138#include <stdlib.h>
12139#endif
15b61c98
JH
12140#define FILE_ptr(fp) $stdio_ptr
12141#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12142#include <sys/types.h>
b4eb6b3d 12143int main() {
15b61c98
JH
12144 FILE *fp = fopen("try.c", "r");
12145 int c;
12146 char *ptr;
12147 size_t cnt;
12148 if (!fp) {
12149 puts("Fail even to read");
12150 exit(1);
12151 }
12152 c = getc(fp); /* Read away the first # */
12153 if (c == EOF) {
12154 puts("Fail even to read");
12155 exit(1);
12156 }
12157 if (!(
12158 18 <= FILE_cnt(fp) &&
12159 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12160 )) {
12161 puts("Fail even to read");
12162 exit (1);
12163 }
12164 ptr = (char*) FILE_ptr(fp);
12165 cnt = (size_t)FILE_cnt(fp);
12166
12167 FILE_ptr(fp) += 42;
12168
12169 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12170 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12171 exit (1);
12172 }
12173 if (FILE_cnt(fp) <= 20) {
12174 printf ("Fail (<20 chars to test)");
12175 exit (1);
12176 }
12177 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12178 puts("Fail compare");
12179 exit (1);
12180 }
12181 if (cnt == FILE_cnt(fp)) {
12182 puts("Pass_unchanged");
12183 exit (0);
12184 }
12185 if (FILE_cnt(fp) == (cnt - 42)) {
12186 puts("Pass_changed");
12187 exit (0);
12188 }
12189 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12190 return 1;
12191
12192}
12193EOP
12194 set try
12195 if eval $compile && $to try.c; then
12196 case `$run ./try` in
12197 Pass_changed)
12198 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12199 d_stdio_ptr_lval_sets_cnt="$define" ;;
12200 Pass_unchanged)
12201 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12202 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12203 Fail*)
12204 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12205 *)
12206 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12207 esac
12208 else
12209 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12210 fi
12211 $rm -f try.c try
12212 ;;
12213esac
12214
12215: see if _base is also standard
12216val="$undef"
12217case "$d_stdstdio" in
12218$define)
12219 $cat >try.c <<EOP
12220#include <stdio.h>
12221#$i_stdlib I_STDLIB
12222#ifdef I_STDLIB
12223#include <stdlib.h>
12224#endif
12225#define FILE_base(fp) $stdio_base
12226#define FILE_bufsiz(fp) $stdio_bufsiz
12227int main() {
12228 FILE *fp = fopen("try.c", "r");
12229 char c = getc(fp);
12230 if (
12231 19 <= FILE_bufsiz(fp) &&
12232 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12233 )
12234 exit(0);
12235 exit(1);
12236}
12237EOP
12238 set try
12239 if eval $compile && $to try.c; then
12240 if $run ./try; then
12241 echo "And its _base field acts std."
12242 val="$define"
12243 else
12244 echo "But its _base field isn't std."
12245 fi
12246 else
12247 echo "However, it seems to be lacking the _base field."
12248 fi
12249 $rm -f try.c try
12250 ;;
12251esac
12252set d_stdiobase
12253eval $setvar
12254
12255: see if fast_stdio exists
12256val="$undef"
12257case "$d_stdstdio:$d_stdio_ptr_lval" in
12258"$define:$define")
12259 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12260 *$define*)
12261 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12262 val="$define"
12263 ;;
12264 esac
12265 ;;
12266esac
12267set d_faststdio
12268eval $setvar
12269
12270
12271
12272: see if fchdir exists
12273set fchdir d_fchdir
12274eval $inlibc
12275
12276: see if fchmod exists
12277set fchmod d_fchmod
12278eval $inlibc
12279
12280: see if fchown exists
12281set fchown d_fchown
12282eval $inlibc
12283
12284: see if this is an fcntl system
12285set fcntl d_fcntl
12286eval $inlibc
12287
12288echo " "
12289: See if fcntl-based locking works.
12290$cat >try.c <<EOCP
12291#$i_stdlib I_STDLIB
12292#ifdef I_STDLIB
12293#include <stdlib.h>
12294#endif
12295#include <unistd.h>
12296#include <fcntl.h>
12297#include <signal.h>
12298$signal_t blech(x) int x; { exit(3); }
12299int main() {
12300#if defined(F_SETLK) && defined(F_SETLKW)
12301 struct flock flock;
12302 int retval, fd;
12303 fd = open("try.c", O_RDONLY);
12304 flock.l_type = F_RDLCK;
12305 flock.l_whence = SEEK_SET;
12306 flock.l_start = flock.l_len = 0;
12307 signal(SIGALRM, blech);
12308 alarm(10);
12309 retval = fcntl(fd, F_SETLK, &flock);
12310 close(fd);
12311 (retval < 0 ? exit(2) : exit(0));
12312#else
12313 exit(2);
12314#endif
12315}
12316EOCP
12317echo "Checking if fcntl-based file locking works... "
12318case "$d_fcntl" in
12319"$define")
12320 set try
12321 if eval $compile_ok; then
12322 if $run ./try; then
12323 echo "Yes, it seems to work."
12324 val="$define"
12325 else
12326 echo "Nope, it didn't work."
12327 val="$undef"
12328 case "$?" in
12329 3) $cat >&4 <<EOM
12330***
12331*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12332*** This is (almost) impossible.
12333*** If your NFS lock daemons are not feeling well, something like
12334*** this may happen, please investigate. Cannot continue, aborting.
12335***
12336EOM
12337 exit 1
12338 ;;
12339 esac
12340 fi
12341 else
12342 echo "I'm unable to compile the test program, so I'll assume not."
12343 val="$undef"
12344 fi
12345 ;;
12346*) val="$undef";
12347 echo "Nope, since you don't even have fcntl()."
12348 ;;
12349esac
12350set d_fcntl_can_lock
12351eval $setvar
12352$rm -f try*
12353
12354
12355: check for fd_set items
12356$cat <<EOM
12357
12358Checking to see how well your C compiler handles fd_set and friends ...
12359EOM
12360$cat >try.c <<EOCP
12361#$i_stdlib I_STDLIB
12362#ifdef I_STDLIB
12363#include <stdlib.h>
12364#endif
12365#$i_systime I_SYS_TIME
12366#$i_sysselct I_SYS_SELECT
12367#$d_socket HAS_SOCKET
12368#include <sys/types.h>
12369#ifdef HAS_SOCKET
12370#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12371#endif
12372#ifdef I_SYS_TIME
12373#include <sys/time.h>
12374#endif
12375#ifdef I_SYS_SELECT
12376#include <sys/select.h>
12377#endif
12378int main() {
12379 fd_set fds;
12380
12381#ifdef TRYBITS
12382 if(fds.fds_bits);
12383#endif
12384
12385#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12386 exit(0);
12387#else
12388 exit(1);
12389#endif
12390}
12391EOCP
12392set try -DTRYBITS
12393if eval $compile; then
12394 d_fds_bits="$define"
12395 d_fd_set="$define"
12396 echo "Well, your system knows about the normal fd_set typedef..." >&4
12397 if $run ./try; then
b4eb6b3d
JH
12398 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12399 d_fd_macros="$define"
12400 else
12401 $cat >&4 <<'EOM'
12402but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12403EOM
12404 d_fd_macros="$undef"
12405 fi
12406else
12407 $cat <<'EOM'
12408Hmm, your compiler has some difficulty with fd_set. Checking further...
12409EOM
5440bc8e 12410 set try
b4eb6b3d
JH
12411 if eval $compile; then
12412 d_fds_bits="$undef"
12413 d_fd_set="$define"
12414 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12415 if $run ./try; then
b4eb6b3d
JH
12416 echo "and you have the normal fd_set macros." >&4
12417 d_fd_macros="$define"
12418 else
12419 $cat <<'EOM'
12420but not the normal fd_set macros! Gross! More work for me...
12421EOM
12422 d_fd_macros="$undef"
12423 fi
12424 else
12425 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12426 d_fd_set="$undef"
12427 d_fds_bits="$undef"
12428 d_fd_macros="$undef"
12429 fi
12430fi
5440bc8e 12431$rm -f try try.*
b4eb6b3d
JH
12432
12433: see if fgetpos exists
12434set fgetpos d_fgetpos
12435eval $inlibc
12436
758a5d79
JH
12437: see if finite exists
12438set finite d_finite
12439eval $inlibc
12440
12441: see if finitel exists
12442set finitel d_finitel
12443eval $inlibc
12444
b4eb6b3d
JH
12445: see if flock exists
12446set flock d_flock
12447eval $inlibc
12448
2ef53570
JH
12449: see if prototype for flock is available
12450echo " "
12451set d_flockproto flock $i_sysfile sys/file.h
12452eval $hasproto
12453
b4eb6b3d
JH
12454: see if fork exists
12455set fork d_fork
12456eval $inlibc
12457
758a5d79
JH
12458: see if fp_class exists
12459set fp_class d_fp_class
12460eval $inlibc
12461
b4eb6b3d
JH
12462: see if pathconf exists
12463set pathconf d_pathconf
12464eval $inlibc
12465
12466: see if fpathconf exists
12467set fpathconf d_fpathconf
12468eval $inlibc
12469
758a5d79
JH
12470: see if fpclass exists
12471set fpclass d_fpclass
12472eval $inlibc
12473
12474: see if fpclassify exists
12475set fpclassify d_fpclassify
12476eval $inlibc
12477
12478: see if fpclassl exists
12479set fpclassl d_fpclassl
12480eval $inlibc
12481
b4eb6b3d
JH
12482
12483: check for fpos64_t
12484echo " "
12485echo "Checking to see if you have fpos64_t..." >&4
12486$cat >try.c <<EOCP
12487#include <stdio.h>
12488int main() { fpos64_t x = 7; }
12489EOCP
12490set try
12491if eval $compile; then
12492 val="$define"
12493 echo "You have fpos64_t."
12494else
12495 val="$undef"
12496 echo "You do not have fpos64_t."
12497 case "$fpossize" in
12498 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12499 esac
12500fi
12501$rm -f try.* try
12502set d_fpos64_t
12503eval $setvar
12504
12505: see if frexpl exists
12506set frexpl d_frexpl
12507eval $inlibc
12508
b4eb6b3d
JH
12509: see if this is a sys/param system
12510set sys/param.h i_sysparam
12511eval $inhdr
12512
12513: see if this is a sys/mount.h system
12514set sys/mount.h i_sysmount
12515eval $inhdr
12516
b4eb6b3d
JH
12517
12518echo " "
12519echo "Checking to see if your system supports struct fs_data..." >&4
12520set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12521eval $hasstruct
12522case "$d_fs_data_s" in
12523"$define") echo "Yes, it does." ;;
12524*) echo "No, it doesn't." ;;
12525esac
12526
12527: see if fseeko exists
12528set fseeko d_fseeko
12529eval $inlibc
12530case "$longsize" in
125318) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12532esac
12533
12534: see if fsetpos exists
12535set fsetpos d_fsetpos
12536eval $inlibc
12537
12538
12539: see if fstatfs exists
12540set fstatfs d_fstatfs
12541eval $inlibc
12542
12543
12544: see if statvfs exists
12545set statvfs d_statvfs
12546eval $inlibc
12547
12548: see if fstatvfs exists
12549set fstatvfs d_fstatvfs
12550eval $inlibc
12551
12552
411ab01c
JH
12553: see if fsync exists
12554set fsync d_fsync
12555eval $inlibc
12556
b4eb6b3d
JH
12557: see if ftello exists
12558set ftello d_ftello
12559eval $inlibc
12560case "$longsize" in
125618) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12562esac
12563
bff98e24
SP
12564d_futimes="$undef"
12565: check for a working futimes
12566echo " "
12567echo "Checking for a working futimes()" >&4
12568$cat >try.c <<EOCP
12569#include <stdio.h>
12570#include <sys/time.h>
12571#include <errno.h>
12572#include <fcntl.h>
12573
12574int main ()
12575{
12576 int fd, rv;
12577 fd = open ("try.c", O_RDWR);
12578 if (-1 == fd) exit (1);
12579 rv = futimes (fd, NULL);
12580 exit (rv == -1 ? errno : 0);
12581}
12582EOCP
12583set try
12584if eval $compile; then
12585 `$run ./try`
12586 rc=$?
12587 case "$rc" in
12588 0) echo "Yes, it does" >&4
12589 d_futimes="$define"
12590 ;;
12591 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12592 ;;
12593 esac
12594else
12595 echo "No, it does not (probably harmless)\n" >&4
12596fi
12597$rm -f try.* try core core.try.*
dc814df1 12598
b4eb6b3d
JH
12599: see if getcwd exists
12600set getcwd d_getcwd
12601eval $inlibc
12602
12603: see if getespwnam exists
12604set getespwnam d_getespwnam
12605eval $inlibc
12606
12607
12608: see if getfsstat exists
12609set getfsstat d_getfsstat
12610eval $inlibc
12611
12612: see if getgrent exists
12613set getgrent d_getgrent
12614eval $inlibc
12615
10bc17b6
JH
12616: see if getgrent_r exists
12617set getgrent_r d_getgrent_r
12618eval $inlibc
12619case "$d_getgrent_r" in
12620"$define")
12621 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12622 case "$d_getgrent_r_proto:$usethreads" in
12623 ":define") d_getgrent_r_proto=define
a48ec845
JH
12624 set d_getgrent_r_proto getgrent_r $hdrs
12625 eval $hasproto ;;
12626 *) ;;
12627 esac
12628 case "$d_getgrent_r_proto" in
12629 define)
10bc17b6
JH
12630 case "$getgrent_r_proto" in
12631 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12632 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12633 esac
12634 case "$getgrent_r_proto" in
12635 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12636 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12637 esac
12638 case "$getgrent_r_proto" in
12639 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12640 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12641 esac
12642 case "$getgrent_r_proto" in
12643 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12644 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12645 esac
12646 case "$getgrent_r_proto" in
12647 ''|0) try='int getgrent_r(struct group*, char*, int);'
12648 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12649 esac
12650 case "$getgrent_r_proto" in
12651 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12652 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12653 esac
12654 case "$getgrent_r_proto" in
90e831dc 12655 ''|0) d_getgrent_r=undef
10bc17b6 12656 getgrent_r_proto=0
a48ec845 12657 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12658 * ) case "$getgrent_r_proto" in
12659 REENTRANT_PROTO*) ;;
12660 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12661 esac
12662 echo "Prototype: $try" ;;
12663 esac
12664 ;;
c18e646a
JH
12665 *) case "$usethreads" in
12666 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12667 esac
90e831dc
SB
12668 d_getgrent_r=undef
12669 getgrent_r_proto=0
c18e646a 12670 ;;
a48ec845
JH
12671 esac
12672 ;;
10bc17b6
JH
12673*) getgrent_r_proto=0
12674 ;;
12675esac
12676
12677: see if getgrgid_r exists
12678set getgrgid_r d_getgrgid_r
12679eval $inlibc
12680case "$d_getgrgid_r" in
12681"$define")
12682 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12683 case "$d_getgrgid_r_proto:$usethreads" in
12684 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12685 set d_getgrgid_r_proto getgrgid_r $hdrs
12686 eval $hasproto ;;
12687 *) ;;
12688 esac
12689 case "$d_getgrgid_r_proto" in
12690 define)
10bc17b6
JH
12691 case "$getgrgid_r_proto" in
12692 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12693 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12694 esac
12695 case "$getgrgid_r_proto" in
12696 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12697 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12698 esac
12699 case "$getgrgid_r_proto" in
12700 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12701 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12702 esac
12703 case "$getgrgid_r_proto" in
12704 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12705 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12706 esac
12707 case "$getgrgid_r_proto" in
90e831dc 12708 ''|0) d_getgrgid_r=undef
10bc17b6 12709 getgrgid_r_proto=0
a48ec845 12710 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12711 * ) case "$getgrgid_r_proto" in
12712 REENTRANT_PROTO*) ;;
12713 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12714 esac
12715 echo "Prototype: $try" ;;
12716 esac
12717 ;;
c18e646a
JH
12718 *) case "$usethreads" in
12719 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12720 esac
90e831dc
SB
12721 d_getgrgid_r=undef
12722 getgrgid_r_proto=0
c18e646a 12723 ;;
a48ec845
JH
12724 esac
12725 ;;
10bc17b6
JH
12726*) getgrgid_r_proto=0
12727 ;;
12728esac
12729
12730: see if getgrnam_r exists
12731set getgrnam_r d_getgrnam_r
12732eval $inlibc
12733case "$d_getgrnam_r" in
12734"$define")
12735 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12736 case "$d_getgrnam_r_proto:$usethreads" in
12737 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12738 set d_getgrnam_r_proto getgrnam_r $hdrs
12739 eval $hasproto ;;
12740 *) ;;
12741 esac
12742 case "$d_getgrnam_r_proto" in
12743 define)
10bc17b6
JH
12744 case "$getgrnam_r_proto" in
12745 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12746 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12747 esac
12748 case "$getgrnam_r_proto" in
12749 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12750 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12751 esac
12752 case "$getgrnam_r_proto" in
12753 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12754 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12755 esac
12756 case "$getgrnam_r_proto" in
12757 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12758 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12759 esac
12760 case "$getgrnam_r_proto" in
12761 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12762 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12763 esac
12764 case "$getgrnam_r_proto" in
90e831dc 12765 ''|0) d_getgrnam_r=undef
10bc17b6 12766 getgrnam_r_proto=0
a48ec845 12767 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12768 * ) case "$getgrnam_r_proto" in
12769 REENTRANT_PROTO*) ;;
12770 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12771 esac
12772 echo "Prototype: $try" ;;
12773 esac
12774 ;;
c18e646a
JH
12775 *) case "$usethreads" in
12776 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12777 esac
90e831dc
SB
12778 d_getgrnam_r=undef
12779 getgrnam_r_proto=0
c18e646a 12780 ;;
a48ec845
JH
12781 esac
12782 ;;
10bc17b6
JH
12783*) getgrnam_r_proto=0
12784 ;;
12785esac
12786
b4eb6b3d
JH
12787: see if gethostbyaddr exists
12788set gethostbyaddr d_gethbyaddr
12789eval $inlibc
12790
12791: see if gethostbyname exists
12792set gethostbyname d_gethbyname
12793eval $inlibc
12794
12795: see if gethostent exists
12796set gethostent d_gethent
12797eval $inlibc
12798
12799: see how we will look up host name
12800echo " "
12801call=''
12802if set gethostname val -f d_gethname; eval $csym; $val; then
12803 echo 'gethostname() found.' >&4
12804 d_gethname="$define"
12805 call=gethostname
12806fi
12807if set uname val -f d_uname; eval $csym; $val; then
12808 if ./xenix; then
12809 $cat <<'EOM'
12810uname() was found, but you're running xenix, and older versions of xenix
12811have a broken uname(). If you don't really know whether your xenix is old
12812enough to have a broken system call, use the default answer.
12813
12814EOM
12815 dflt=y
12816 case "$d_uname" in
12817 "$define") dflt=n;;
12818 esac
12819 rp='Is your uname() broken?'
12820 . ./myread
12821 case "$ans" in
12822 n*) d_uname="$define"; call=uname;;
12823 esac
12824 else
12825 echo 'uname() found.' >&4
12826 d_uname="$define"
12827 case "$call" in
12828 '') call=uname ;;
12829 esac
12830 fi
12831fi
12832case "$d_gethname" in
12833'') d_gethname="$undef";;
12834esac
12835case "$d_uname" in
12836'') d_uname="$undef";;
12837esac
12838case "$d_uname$d_gethname" in
12839*define*)
12840 dflt=n
12841 cat <<EOM
12842
12843Every now and then someone has a $call() that lies about the hostname
12844but can't be fixed for political or economic reasons. If you wish, I can
12845pretend $call() isn't there and maybe compute hostname at run-time
12846thanks to the '$phostname' command.
12847
12848EOM
12849 rp="Shall I ignore $call() from now on?"
12850 . ./myread
12851 case "$ans" in
12852 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12853 esac;;
12854esac
12855case "$phostname" in
12856'') aphostname='';;
12857*) case "$aphostname" in
12858 /*) ;;
12859 *) set X $phostname
12860 shift
12861 file=$1
12862 shift
12863 file=`./loc $file $file $pth`
12864 aphostname=`echo $file $*`
12865 ;;
12866 esac
12867 ;;
12868esac
12869case "$d_uname$d_gethname" in
12870*define*) ;;
12871*)
12872 case "$phostname" in
12873 '')
12874 echo "There will be no way for $package to get your hostname." >&4;;
12875 *)
12876 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12877 ;;
12878 esac;;
12879esac
12880case "$d_phostname" in
12881'') d_phostname="$undef";;
12882esac
12883
10bc17b6
JH
12884: see if gethostbyaddr_r exists
12885set gethostbyaddr_r d_gethostbyaddr_r
12886eval $inlibc
12887case "$d_gethostbyaddr_r" in
12888"$define")
12889 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12890 case "$d_gethostbyaddr_r_proto:$usethreads" in
12891 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12892 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12893 eval $hasproto ;;
12894 *) ;;
12895 esac
12896 case "$d_gethostbyaddr_r_proto" in
12897 define)
10bc17b6
JH
12898 case "$gethostbyaddr_r_proto" in
12899 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12900 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12901 esac
12902 case "$gethostbyaddr_r_proto" in
12903 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12904 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12905 esac
12906 case "$gethostbyaddr_r_proto" in
12907 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12908 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12909 esac
12910 case "$gethostbyaddr_r_proto" in
12911 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12912 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12913 esac
12914 case "$gethostbyaddr_r_proto" in
12915 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12916 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12917 esac
12918 case "$gethostbyaddr_r_proto" in
12919 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12920 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12921 esac
12922 case "$gethostbyaddr_r_proto" in
12923 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12924 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12925 esac
12926 case "$gethostbyaddr_r_proto" in
12927 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12928 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12929 esac
12930 case "$gethostbyaddr_r_proto" in
12931 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12932 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12933 esac
12934 case "$gethostbyaddr_r_proto" in
12935 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12936 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12937 esac
12938 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12939 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12940 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12941 esac
12942 case "$gethostbyaddr_r_proto" in
90e831dc 12943 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12944 gethostbyaddr_r_proto=0
a48ec845 12945 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12946 * ) case "$gethostbyaddr_r_proto" in
12947 REENTRANT_PROTO*) ;;
12948 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12949 esac
12950 echo "Prototype: $try" ;;
12951 esac
12952 ;;
c18e646a
JH
12953 *) case "$usethreads" in
12954 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12955 esac
90e831dc
SB
12956 d_gethostbyaddr_r=undef
12957 gethostbyaddr_r_proto=0
c18e646a 12958 ;;
a48ec845
JH
12959 esac
12960 ;;
10bc17b6
JH
12961*) gethostbyaddr_r_proto=0
12962 ;;
12963esac
12964
12965: see if gethostbyname_r exists
12966set gethostbyname_r d_gethostbyname_r
12967eval $inlibc
12968case "$d_gethostbyname_r" in
12969"$define")
12970 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12971 case "$d_gethostbyname_r_proto:$usethreads" in
12972 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12973 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12974 eval $hasproto ;;
12975 *) ;;
12976 esac
12977 case "$d_gethostbyname_r_proto" in
12978 define)
10bc17b6
JH
12979 case "$gethostbyname_r_proto" in
12980 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12981 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12982 esac
12983 case "$gethostbyname_r_proto" in
12984 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12985 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12986 esac
12987 case "$gethostbyname_r_proto" in
12988 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12989 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12990 esac
12991 case "$gethostbyname_r_proto" in
90e831dc 12992 ''|0) d_gethostbyname_r=undef
10bc17b6 12993 gethostbyname_r_proto=0
a48ec845 12994 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12995 * ) case "$gethostbyname_r_proto" in
12996 REENTRANT_PROTO*) ;;
12997 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12998 esac
12999 echo "Prototype: $try" ;;
13000 esac
13001 ;;
c18e646a
JH
13002 *) case "$usethreads" in
13003 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13004 esac
90e831dc
SB
13005 d_gethostbyname_r=undef
13006 gethostbyname_r_proto=0
c18e646a 13007 ;;
a48ec845
JH
13008 esac
13009 ;;
10bc17b6
JH
13010*) gethostbyname_r_proto=0
13011 ;;
13012esac
13013
13014: see if gethostent_r exists
13015set gethostent_r d_gethostent_r
13016eval $inlibc
13017case "$d_gethostent_r" in
13018"$define")
13019 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13020 case "$d_gethostent_r_proto:$usethreads" in
13021 ":define") d_gethostent_r_proto=define
a48ec845
JH
13022 set d_gethostent_r_proto gethostent_r $hdrs
13023 eval $hasproto ;;
13024 *) ;;
13025 esac
13026 case "$d_gethostent_r_proto" in
13027 define)
10bc17b6
JH
13028 case "$gethostent_r_proto" in
13029 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13030 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13031 esac
13032 case "$gethostent_r_proto" in
13033 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13034 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13035 esac
13036 case "$gethostent_r_proto" in
13037 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13038 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13039 esac
13040 case "$gethostent_r_proto" in
13041 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13042 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13043 esac
13044 case "$gethostent_r_proto" in
13045 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13046 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13047 esac
13048 case "$gethostent_r_proto" in
13049 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13050 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13051 esac
13052 case "$gethostent_r_proto" in
90e831dc 13053 ''|0) d_gethostent_r=undef
10bc17b6 13054 gethostent_r_proto=0
a48ec845 13055 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13056 * ) case "$gethostent_r_proto" in
13057 REENTRANT_PROTO*) ;;
13058 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13059 esac
13060 echo "Prototype: $try" ;;
13061 esac
13062 ;;
c18e646a
JH
13063 *) case "$usethreads" in
13064 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13065 esac
90e831dc
SB
13066 d_gethostent_r=undef
13067 gethostent_r_proto=0
c18e646a 13068 ;;
a48ec845
JH
13069 esac
13070 ;;
10bc17b6
JH
13071*) gethostent_r_proto=0
13072 ;;
13073esac
b4eb6b3d
JH
13074
13075: see if prototypes for various gethostxxx netdb.h functions are available
13076echo " "
13077set d_gethostprotos gethostent $i_netdb netdb.h
13078eval $hasproto
13079
4e0554ec
JH
13080: see if getitimer exists
13081set getitimer d_getitimer
13082eval $inlibc
13083
b4eb6b3d
JH
13084: see if getlogin exists
13085set getlogin d_getlogin
13086eval $inlibc
13087
10bc17b6
JH
13088: see if getlogin_r exists
13089set getlogin_r d_getlogin_r
13090eval $inlibc
13091case "$d_getlogin_r" in
13092"$define")
13093 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13094 case "$d_getlogin_r_proto:$usethreads" in
13095 ":define") d_getlogin_r_proto=define
a48ec845
JH
13096 set d_getlogin_r_proto getlogin_r $hdrs
13097 eval $hasproto ;;
13098 *) ;;
13099 esac
13100 case "$d_getlogin_r_proto" in
13101 define)
10bc17b6
JH
13102 case "$getlogin_r_proto" in
13103 ''|0) try='int getlogin_r(char*, size_t);'
13104 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13105 esac
13106 case "$getlogin_r_proto" in
13107 ''|0) try='int getlogin_r(char*, int);'
13108 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13109 esac
13110 case "$getlogin_r_proto" in
13111 ''|0) try='char* getlogin_r(char*, size_t);'
13112 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13113 esac
13114 case "$getlogin_r_proto" in
13115 ''|0) try='char* getlogin_r(char*, int);'
13116 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13117 esac
13118 case "$getlogin_r_proto" in
90e831dc 13119 ''|0) d_getlogin_r=undef
10bc17b6 13120 getlogin_r_proto=0
a48ec845 13121 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13122 * ) case "$getlogin_r_proto" in
13123 REENTRANT_PROTO*) ;;
13124 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13125 esac
13126 echo "Prototype: $try" ;;
13127 esac
13128 ;;
c18e646a
JH
13129 *) case "$usethreads" in
13130 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13131 esac
90e831dc
SB
13132 d_getlogin_r=undef
13133 getlogin_r_proto=0
c18e646a 13134 ;;
a48ec845
JH
13135 esac
13136 ;;
10bc17b6
JH
13137*) getlogin_r_proto=0
13138 ;;
13139esac
13140
b4eb6b3d
JH
13141: see if getmnt exists
13142set getmnt d_getmnt
13143eval $inlibc
13144
13145: see if getmntent exists
13146set getmntent d_getmntent
13147eval $inlibc
13148
13149: see if getnetbyaddr exists
13150set getnetbyaddr d_getnbyaddr
13151eval $inlibc
13152
13153: see if getnetbyname exists
13154set getnetbyname d_getnbyname
13155eval $inlibc
13156
13157: see if getnetent exists
13158set getnetent d_getnent
13159eval $inlibc
13160
10bc17b6
JH
13161: see if getnetbyaddr_r exists
13162set getnetbyaddr_r d_getnetbyaddr_r
13163eval $inlibc
13164case "$d_getnetbyaddr_r" in
13165"$define")
13166 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13167 case "$d_getnetbyaddr_r_proto:$usethreads" in
13168 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13169 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13170 eval $hasproto ;;
13171 *) ;;
13172 esac
13173 case "$d_getnetbyaddr_r_proto" in
13174 define)
10bc17b6
JH
13175 case "$getnetbyaddr_r_proto" in
13176 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13177 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13178 esac
13179 case "$getnetbyaddr_r_proto" in
13180 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13181 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13182 esac
13183 case "$getnetbyaddr_r_proto" in
13184 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13185 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13186 esac
13187 case "$getnetbyaddr_r_proto" in
13188 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13189 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13190 esac
13191 case "$getnetbyaddr_r_proto" in
13192 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13193 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13194 esac
13195 case "$getnetbyaddr_r_proto" in
13196 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13197 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13198 esac
13199 case "$getnetbyaddr_r_proto" in
13200 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13201 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13202 esac
13203 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13204 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13205 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13206 esac
13207 case "$getnetbyaddr_r_proto" in
90e831dc 13208 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13209 getnetbyaddr_r_proto=0
a48ec845 13210 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13211 * ) case "$getnetbyaddr_r_proto" in
13212 REENTRANT_PROTO*) ;;
13213 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13214 esac
13215 echo "Prototype: $try" ;;
13216 esac
13217 ;;
c18e646a
JH
13218 *) case "$usethreads" in
13219 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13220 esac
90e831dc
SB
13221 d_getnetbyaddr_r=undef
13222 getnetbyaddr_r_proto=0
c18e646a 13223 ;;
a48ec845
JH
13224 esac
13225 ;;
10bc17b6
JH
13226*) getnetbyaddr_r_proto=0
13227 ;;
13228esac
13229
13230: see if getnetbyname_r exists
13231set getnetbyname_r d_getnetbyname_r
13232eval $inlibc
13233case "$d_getnetbyname_r" in
13234"$define")
13235 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13236 case "$d_getnetbyname_r_proto:$usethreads" in
13237 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13238 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13239 eval $hasproto ;;
13240 *) ;;
13241 esac
13242 case "$d_getnetbyname_r_proto" in
13243 define)
10bc17b6
JH
13244 case "$getnetbyname_r_proto" in
13245 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13246 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13247 esac
13248 case "$getnetbyname_r_proto" in
13249 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13250 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13251 esac
13252 case "$getnetbyname_r_proto" in
13253 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13254 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13255 esac
13256 case "$getnetbyname_r_proto" in
13257 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13258 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13259 esac
13260 case "$getnetbyname_r_proto" in
90e831dc 13261 ''|0) d_getnetbyname_r=undef
10bc17b6 13262 getnetbyname_r_proto=0
a48ec845 13263 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13264 * ) case "$getnetbyname_r_proto" in
13265 REENTRANT_PROTO*) ;;
13266 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13267 esac
13268 echo "Prototype: $try" ;;
13269 esac
13270 ;;
c18e646a
JH
13271 *) case "$usethreads" in
13272 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13273 esac
90e831dc
SB
13274 d_getnetbyname_r=undef
13275 getnetbyname_r_proto=0
c18e646a 13276 ;;
a48ec845
JH
13277 esac
13278 ;;
10bc17b6
JH
13279*) getnetbyname_r_proto=0
13280 ;;
13281esac
13282
13283: see if getnetent_r exists
13284set getnetent_r d_getnetent_r
13285eval $inlibc
13286case "$d_getnetent_r" in
13287"$define")
13288 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13289 case "$d_getnetent_r_proto:$usethreads" in
13290 ":define") d_getnetent_r_proto=define
a48ec845
JH
13291 set d_getnetent_r_proto getnetent_r $hdrs
13292 eval $hasproto ;;
13293 *) ;;
13294 esac
13295 case "$d_getnetent_r_proto" in
13296 define)
10bc17b6
JH
13297 case "$getnetent_r_proto" in
13298 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13299 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13300 esac
13301 case "$getnetent_r_proto" in
13302 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13303 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13304 esac
13305 case "$getnetent_r_proto" in
13306 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13307 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13308 esac
13309 case "$getnetent_r_proto" in
13310 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13311 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13312 esac
13313 case "$getnetent_r_proto" in
13314 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13315 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13316 esac
13317 case "$getnetent_r_proto" in
13318 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13319 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13320 esac
13321 case "$getnetent_r_proto" in
90e831dc 13322 ''|0) d_getnetent_r=undef
10bc17b6 13323 getnetent_r_proto=0
a48ec845 13324 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13325 * ) case "$getnetent_r_proto" in
13326 REENTRANT_PROTO*) ;;
13327 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13328 esac
13329 echo "Prototype: $try" ;;
13330 esac
13331 ;;
c18e646a
JH
13332 *) case "$usethreads" in
13333 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13334 esac
90e831dc
SB
13335 d_getnetent_r=undef
13336 getnetent_r_proto=0
c18e646a 13337 ;;
a48ec845
JH
13338 esac
13339 ;;
10bc17b6
JH
13340*) getnetent_r_proto=0
13341 ;;
13342esac
13343
b4eb6b3d
JH
13344: see if prototypes for various getnetxxx netdb.h functions are available
13345echo " "
13346set d_getnetprotos getnetent $i_netdb netdb.h
13347eval $hasproto
13348
0c0643d0
JH
13349: see if getpagesize exists
13350set getpagesize d_getpagsz
13351eval $inlibc
13352
b4eb6b3d
JH
13353
13354: see if getprotobyname exists
13355set getprotobyname d_getpbyname
13356eval $inlibc
13357
13358: see if getprotobynumber exists
13359set getprotobynumber d_getpbynumber
13360eval $inlibc
13361
13362: see if getprotoent exists
13363set getprotoent d_getpent
13364eval $inlibc
13365
13366: see if getpgid exists
13367set getpgid d_getpgid
13368eval $inlibc
13369
13370: see if getpgrp2 exists
13371set getpgrp2 d_getpgrp2
13372eval $inlibc
13373
13374: see if getppid exists
13375set getppid d_getppid
13376eval $inlibc
13377
13378: see if getpriority exists
13379set getpriority d_getprior
13380eval $inlibc
13381
10bc17b6
JH
13382: see if getprotobyname_r exists
13383set getprotobyname_r d_getprotobyname_r
13384eval $inlibc
13385case "$d_getprotobyname_r" in
13386"$define")
13387 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13388 case "$d_getprotobyname_r_proto:$usethreads" in
13389 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13390 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13391 eval $hasproto ;;
13392 *) ;;
13393 esac
13394 case "$d_getprotobyname_r_proto" in
13395 define)
10bc17b6
JH
13396 case "$getprotobyname_r_proto" in
13397 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13398 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13399 esac
13400 case "$getprotobyname_r_proto" in
13401 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13402 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13403 esac
13404 case "$getprotobyname_r_proto" in
13405 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13406 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13407 esac
13408 case "$getprotobyname_r_proto" in
90e831dc 13409 ''|0) d_getprotobyname_r=undef
10bc17b6 13410 getprotobyname_r_proto=0
a48ec845 13411 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13412 * ) case "$getprotobyname_r_proto" in
13413 REENTRANT_PROTO*) ;;
13414 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13415 esac
13416 echo "Prototype: $try" ;;
13417 esac
13418 ;;
c18e646a
JH
13419 *) case "$usethreads" in
13420 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13421 esac
90e831dc
SB
13422 d_getprotobyname_r=undef
13423 getprotobyname_r_proto=0
c18e646a 13424 ;;
a48ec845
JH
13425 esac
13426 ;;
10bc17b6
JH
13427*) getprotobyname_r_proto=0
13428 ;;
13429esac
13430
13431: see if getprotobynumber_r exists
13432set getprotobynumber_r d_getprotobynumber_r
13433eval $inlibc
13434case "$d_getprotobynumber_r" in
13435"$define")
13436 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13437 case "$d_getprotobynumber_r_proto:$usethreads" in
13438 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13439 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13440 eval $hasproto ;;
13441 *) ;;
13442 esac
13443 case "$d_getprotobynumber_r_proto" in
13444 define)
10bc17b6
JH
13445 case "$getprotobynumber_r_proto" in
13446 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13447 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13448 esac
13449 case "$getprotobynumber_r_proto" in
13450 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13451 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13452 esac
13453 case "$getprotobynumber_r_proto" in
13454 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13455 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13456 esac
13457 case "$getprotobynumber_r_proto" in
90e831dc 13458 ''|0) d_getprotobynumber_r=undef
10bc17b6 13459 getprotobynumber_r_proto=0
a48ec845 13460 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13461 * ) case "$getprotobynumber_r_proto" in
13462 REENTRANT_PROTO*) ;;
13463 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13464 esac
13465 echo "Prototype: $try" ;;
13466 esac
13467 ;;
c18e646a
JH
13468 *) case "$usethreads" in
13469 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13470 esac
90e831dc
SB
13471 d_getprotobynumber_r=undef
13472 getprotobynumber_r_proto=0
c18e646a 13473 ;;
a48ec845
JH
13474 esac
13475 ;;
10bc17b6
JH
13476*) getprotobynumber_r_proto=0
13477 ;;
13478esac
13479
13480: see if getprotoent_r exists
13481set getprotoent_r d_getprotoent_r
13482eval $inlibc
13483case "$d_getprotoent_r" in
13484"$define")
13485 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13486 case "$d_getprotoent_r_proto:$usethreads" in
13487 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13488 set d_getprotoent_r_proto getprotoent_r $hdrs
13489 eval $hasproto ;;
13490 *) ;;
13491 esac
13492 case "$d_getprotoent_r_proto" in
13493 define)
10bc17b6
JH
13494 case "$getprotoent_r_proto" in
13495 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13496 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13497 esac
13498 case "$getprotoent_r_proto" in
13499 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13500 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13501 esac
13502 case "$getprotoent_r_proto" in
13503 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13504 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13505 esac
13506 case "$getprotoent_r_proto" in
13507 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13508 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13509 esac
13510 case "$getprotoent_r_proto" in
90e831dc 13511 ''|0) d_getprotoent_r=undef
10bc17b6 13512 getprotoent_r_proto=0
a48ec845 13513 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13514 * ) case "$getprotoent_r_proto" in
13515 REENTRANT_PROTO*) ;;
13516 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13517 esac
13518 echo "Prototype: $try" ;;
13519 esac
13520 ;;
c18e646a
JH
13521 *) case "$usethreads" in
13522 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13523 esac
90e831dc
SB
13524 d_getprotoent_r=undef
13525 getprotoent_r_proto=0
c18e646a 13526 ;;
a48ec845
JH
13527 esac
13528 ;;
10bc17b6
JH
13529*) getprotoent_r_proto=0
13530 ;;
13531esac
13532
b4eb6b3d
JH
13533: see if prototypes for various getprotoxxx netdb.h functions are available
13534echo " "
13535set d_getprotoprotos getprotoent $i_netdb netdb.h
13536eval $hasproto
13537
13538: see if getprpwnam exists
13539set getprpwnam d_getprpwnam
13540eval $inlibc
13541
13542: see if getpwent exists
13543set getpwent d_getpwent
13544eval $inlibc
13545
10bc17b6
JH
13546: see if getpwent_r exists
13547set getpwent_r d_getpwent_r
13548eval $inlibc
13549case "$d_getpwent_r" in
13550"$define")
13551 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13552 case "$d_getpwent_r_proto:$usethreads" in
13553 ":define") d_getpwent_r_proto=define
a48ec845
JH
13554 set d_getpwent_r_proto getpwent_r $hdrs
13555 eval $hasproto ;;
13556 *) ;;
13557 esac
13558 case "$d_getpwent_r_proto" in
13559 define)
10bc17b6
JH
13560 case "$getpwent_r_proto" in
13561 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13562 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13563 esac
13564 case "$getpwent_r_proto" in
13565 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13566 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13567 esac
13568 case "$getpwent_r_proto" in
13569 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13570 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13571 esac
13572 case "$getpwent_r_proto" in
13573 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13574 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13575 esac
13576 case "$getpwent_r_proto" in
13577 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13578 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13579 esac
13580 case "$getpwent_r_proto" in
13581 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13582 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13583 esac
13584 case "$getpwent_r_proto" in
90e831dc 13585 ''|0) d_getpwent_r=undef
10bc17b6 13586 getpwent_r_proto=0
a48ec845 13587 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13588 * ) case "$getpwent_r_proto" in
13589 REENTRANT_PROTO*) ;;
13590 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13591 esac
13592 echo "Prototype: $try" ;;
13593 esac
13594 ;;
c18e646a
JH
13595 *) case "$usethreads" in
13596 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13597 esac
90e831dc
SB
13598 d_getpwent_r=undef
13599 getpwent_r_proto=0
c18e646a 13600 ;;
a48ec845
JH
13601 esac
13602 ;;
10bc17b6
JH
13603*) getpwent_r_proto=0
13604 ;;
13605esac
13606
13607: see if getpwnam_r exists
13608set getpwnam_r d_getpwnam_r
13609eval $inlibc
13610case "$d_getpwnam_r" in
13611"$define")
13612 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13613 case "$d_getpwnam_r_proto:$usethreads" in
13614 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13615 set d_getpwnam_r_proto getpwnam_r $hdrs
13616 eval $hasproto ;;
13617 *) ;;
13618 esac
13619 case "$d_getpwnam_r_proto" in
13620 define)
10bc17b6
JH
13621 case "$getpwnam_r_proto" in
13622 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13623 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13624 esac
13625 case "$getpwnam_r_proto" in
13626 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13627 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13628 esac
13629 case "$getpwnam_r_proto" in
13630 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13631 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13632 esac
13633 case "$getpwnam_r_proto" in
13634 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13635 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13636 esac
13637 case "$getpwnam_r_proto" in
90e831dc 13638 ''|0) d_getpwnam_r=undef
10bc17b6 13639 getpwnam_r_proto=0
a48ec845 13640 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13641 * ) case "$getpwnam_r_proto" in
13642 REENTRANT_PROTO*) ;;
13643 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13644 esac
13645 echo "Prototype: $try" ;;
13646 esac
13647 ;;
c18e646a
JH
13648 *) case "$usethreads" in
13649 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13650 esac
90e831dc
SB
13651 d_getpwnam_r=undef
13652 getpwnam_r_proto=0
c18e646a 13653 ;;
a48ec845
JH
13654 esac
13655 ;;
10bc17b6
JH
13656*) getpwnam_r_proto=0
13657 ;;
13658esac
13659
13660: see if getpwuid_r exists
13661set getpwuid_r d_getpwuid_r
13662eval $inlibc
13663case "$d_getpwuid_r" in
13664"$define")
13665 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13666 case "$d_getpwuid_r_proto:$usethreads" in
13667 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13668 set d_getpwuid_r_proto getpwuid_r $hdrs
13669 eval $hasproto ;;
13670 *) ;;
13671 esac
13672 case "$d_getpwuid_r_proto" in
13673 define)
10bc17b6
JH
13674 case "$getpwuid_r_proto" in
13675 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13676 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13677 esac
13678 case "$getpwuid_r_proto" in
13679 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13680 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13681 esac
13682 case "$getpwuid_r_proto" in
13683 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13684 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13685 esac
13686 case "$getpwuid_r_proto" in
13687 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13688 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13689 esac
13690 case "$getpwuid_r_proto" in
90e831dc 13691 ''|0) d_getpwuid_r=undef
10bc17b6 13692 getpwuid_r_proto=0
a48ec845 13693 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13694 * ) case "$getpwuid_r_proto" in
13695 REENTRANT_PROTO*) ;;
13696 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13697 esac
13698 echo "Prototype: $try" ;;
13699 esac
13700 ;;
c18e646a
JH
13701 *) case "$usethreads" in
13702 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13703 esac
90e831dc
SB
13704 d_getpwuid_r=undef
13705 getpwuid_r_proto=0
c18e646a 13706 ;;
a48ec845
JH
13707 esac
13708 ;;
10bc17b6
JH
13709*) getpwuid_r_proto=0
13710 ;;
13711esac
13712
b4eb6b3d
JH
13713
13714: see if getservbyname exists
13715set getservbyname d_getsbyname
13716eval $inlibc
13717
13718: see if getservbyport exists
13719set getservbyport d_getsbyport
13720eval $inlibc
13721
13722: see if getservent exists
13723set getservent d_getsent
13724eval $inlibc
13725
10bc17b6
JH
13726: see if getservbyname_r exists
13727set getservbyname_r d_getservbyname_r
13728eval $inlibc
13729case "$d_getservbyname_r" in
13730"$define")
13731 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13732 case "$d_getservbyname_r_proto:$usethreads" in
13733 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13734 set d_getservbyname_r_proto getservbyname_r $hdrs
13735 eval $hasproto ;;
13736 *) ;;
13737 esac
13738 case "$d_getservbyname_r_proto" in
13739 define)
10bc17b6
JH
13740 case "$getservbyname_r_proto" in
13741 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13742 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13743 esac
13744 case "$getservbyname_r_proto" in
13745 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13746 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13747 esac
13748 case "$getservbyname_r_proto" in
13749 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13750 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13751 esac
13752 case "$getservbyname_r_proto" in
90e831dc 13753 ''|0) d_getservbyname_r=undef
10bc17b6 13754 getservbyname_r_proto=0
a48ec845 13755 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13756 * ) case "$getservbyname_r_proto" in
13757 REENTRANT_PROTO*) ;;
13758 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13759 esac
13760 echo "Prototype: $try" ;;
13761 esac
13762 ;;
c18e646a
JH
13763 *) case "$usethreads" in
13764 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13765 esac
90e831dc
SB
13766 d_getservbyname_r=undef
13767 getservbyname_r_proto=0
c18e646a 13768 ;;
a48ec845
JH
13769 esac
13770 ;;
10bc17b6
JH
13771*) getservbyname_r_proto=0
13772 ;;
13773esac
13774
13775: see if getservbyport_r exists
13776set getservbyport_r d_getservbyport_r
13777eval $inlibc
13778case "$d_getservbyport_r" in
13779"$define")
13780 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13781 case "$d_getservbyport_r_proto:$usethreads" in
13782 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13783 set d_getservbyport_r_proto getservbyport_r $hdrs
13784 eval $hasproto ;;
13785 *) ;;
13786 esac
13787 case "$d_getservbyport_r_proto" in
13788 define)
10bc17b6
JH
13789 case "$getservbyport_r_proto" in
13790 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13791 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13792 esac
13793 case "$getservbyport_r_proto" in
13794 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13795 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13796 esac
13797 case "$getservbyport_r_proto" in
13798 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13799 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13800 esac
13801 case "$getservbyport_r_proto" in
90e831dc 13802 ''|0) d_getservbyport_r=undef
10bc17b6 13803 getservbyport_r_proto=0
a48ec845 13804 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13805 * ) case "$getservbyport_r_proto" in
13806 REENTRANT_PROTO*) ;;
13807 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13808 esac
13809 echo "Prototype: $try" ;;
13810 esac
13811 ;;
c18e646a
JH
13812 *) case "$usethreads" in
13813 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13814 esac
90e831dc
SB
13815 d_getservbyport_r=undef
13816 getservbyport_r_proto=0
c18e646a 13817 ;;
a48ec845
JH
13818 esac
13819 ;;
10bc17b6
JH
13820*) getservbyport_r_proto=0
13821 ;;
13822esac
13823
13824: see if getservent_r exists
13825set getservent_r d_getservent_r
13826eval $inlibc
13827case "$d_getservent_r" in
13828"$define")
13829 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13830 case "$d_getservent_r_proto:$usethreads" in
13831 ":define") d_getservent_r_proto=define
a48ec845
JH
13832 set d_getservent_r_proto getservent_r $hdrs
13833 eval $hasproto ;;
13834 *) ;;
13835 esac
13836 case "$d_getservent_r_proto" in
13837 define)
10bc17b6
JH
13838 case "$getservent_r_proto" in
13839 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13840 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13841 esac
13842 case "$getservent_r_proto" in
13843 ''|0) try='int getservent_r(struct servent*, char*, int);'
13844 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13845 esac
13846 case "$getservent_r_proto" in
13847 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13848 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13849 esac
13850 case "$getservent_r_proto" in
13851 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13852 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13853 esac
13854 case "$getservent_r_proto" in
90e831dc 13855 ''|0) d_getservent_r=undef
10bc17b6 13856 getservent_r_proto=0
a48ec845 13857 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13858 * ) case "$getservent_r_proto" in
13859 REENTRANT_PROTO*) ;;
13860 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13861 esac
13862 echo "Prototype: $try" ;;
13863 esac
13864 ;;
c18e646a
JH
13865 *) case "$usethreads" in
13866 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13867 esac
90e831dc
SB
13868 d_getservent_r=undef
13869 getservent_r_proto=0
c18e646a 13870 ;;
a48ec845
JH
13871 esac
13872 ;;
10bc17b6
JH
13873*) getservent_r_proto=0
13874 ;;
13875esac
13876
b4eb6b3d
JH
13877: see if prototypes for various getservxxx netdb.h functions are available
13878echo " "
13879set d_getservprotos getservent $i_netdb netdb.h
13880eval $hasproto
13881
13882: see if getspnam exists
13883set getspnam d_getspnam
13884eval $inlibc
13885
10bc17b6
JH
13886: see if this is a shadow.h system
13887set shadow.h i_shadow
13888eval $inhdr
13889
13890: see if getspnam_r exists
13891set getspnam_r d_getspnam_r
13892eval $inlibc
13893case "$d_getspnam_r" in
13894"$define")
13895 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13896 case "$d_getspnam_r_proto:$usethreads" in
13897 ":define") d_getspnam_r_proto=define
a48ec845
JH
13898 set d_getspnam_r_proto getspnam_r $hdrs
13899 eval $hasproto ;;
13900 *) ;;
13901 esac
13902 case "$d_getspnam_r_proto" in
13903 define)
10bc17b6
JH
13904 case "$getspnam_r_proto" in
13905 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13906 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13907 esac
13908 case "$getspnam_r_proto" in
13909 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13910 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13911 esac
13912 case "$getspnam_r_proto" in
90e831dc 13913 ''|0) d_getspnam_r=undef
10bc17b6 13914 getspnam_r_proto=0
a48ec845 13915 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13916 * ) case "$getspnam_r_proto" in
13917 REENTRANT_PROTO*) ;;
13918 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13919 esac
13920 echo "Prototype: $try" ;;
13921 esac
13922 ;;
c18e646a
JH
13923 *) case "$usethreads" in
13924 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13925 esac
90e831dc
SB
13926 d_getspnam_r=undef
13927 getspnam_r_proto=0
c18e646a 13928 ;;
a48ec845
JH
13929 esac
13930 ;;
10bc17b6
JH
13931*) getspnam_r_proto=0
13932 ;;
13933esac
13934
b4eb6b3d
JH
13935: see if gettimeofday or ftime exists
13936set gettimeofday d_gettimeod
13937eval $inlibc
13938case "$d_gettimeod" in
13939"$undef")
13940 set ftime d_ftime
13941 eval $inlibc
13942 ;;
13943*)
13944 val="$undef"; set d_ftime; eval $setvar
13945 ;;
13946esac
13947case "$d_gettimeod$d_ftime" in
13948"$undef$undef")
13949 echo " "
13950 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13951 ;;
13952esac
13953
10bc17b6
JH
13954: see if gmtime_r exists
13955set gmtime_r d_gmtime_r
13956eval $inlibc
13957case "$d_gmtime_r" in
13958"$define")
d63eadf0 13959 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13960 case "$d_gmtime_r_proto:$usethreads" in
13961 ":define") d_gmtime_r_proto=define
a48ec845
JH
13962 set d_gmtime_r_proto gmtime_r $hdrs
13963 eval $hasproto ;;
13964 *) ;;
13965 esac
13966 case "$d_gmtime_r_proto" in
13967 define)
10bc17b6
JH
13968 case "$gmtime_r_proto" in
13969 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13970 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13971 esac
13972 case "$gmtime_r_proto" in
13973 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13974 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13975 esac
13976 case "$gmtime_r_proto" in
90e831dc 13977 ''|0) d_gmtime_r=undef
10bc17b6 13978 gmtime_r_proto=0
a48ec845 13979 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13980 * ) case "$gmtime_r_proto" in
13981 REENTRANT_PROTO*) ;;
13982 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13983 esac
13984 echo "Prototype: $try" ;;
13985 esac
b4eb6b3d 13986 ;;
c18e646a
JH
13987 *) case "$usethreads" in
13988 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13989 esac
90e831dc
SB
13990 d_gmtime_r=undef
13991 gmtime_r_proto=0
c18e646a 13992 ;;
a48ec845
JH
13993 esac
13994 ;;
10bc17b6 13995*) gmtime_r_proto=0
b4eb6b3d
JH
13996 ;;
13997esac
13998
13999: see if hasmntopt exists
14000set hasmntopt d_hasmntopt
14001eval $inlibc
14002
14003: see if this is a netinet/in.h or sys/in.h system
14004set netinet/in.h i_niin sys/in.h i_sysin
14005eval $inhdr
14006
14007: see if arpa/inet.h has to be included
14008set arpa/inet.h i_arpainet
14009eval $inhdr
14010
14011: see if htonl --and friends-- exists
14012val=''
14013set htonl val
14014eval $inlibc
14015
14016: Maybe they are macros.
14017case "$val" in
14018$undef)
14019 $cat >htonl.c <<EOM
14020#include <stdio.h>
14021#include <sys/types.h>
14022#$i_niin I_NETINET_IN
14023#$i_sysin I_SYS_IN
14024#$i_arpainet I_ARPA_INET
14025#ifdef I_NETINET_IN
14026#include <netinet/in.h>
14027#endif
14028#ifdef I_SYS_IN
14029#include <sys/in.h>
14030#endif
14031#ifdef I_ARPA_INET
14032#include <arpa/inet.h>
14033#endif
14034#ifdef htonl
14035printf("Defined as a macro.");
14036#endif
14037EOM
14038 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14039 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14040 val="$define"
14041 echo "But it seems to be defined as a macro." >&4
14042 fi
14043 $rm -f htonl.?
14044 ;;
14045esac
14046set d_htonl
14047eval $setvar
14048
36adc09b
JH
14049: see if ilogbl exists
14050set ilogbl d_ilogbl
14051eval $inlibc
14052
b4eb6b3d
JH
14053: index or strchr
14054echo " "
14055if set index val -f; eval $csym; $val; then
14056 if set strchr val -f d_strchr; eval $csym; $val; then
14057 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14058 val="$define"
14059 vali="$undef"
14060 echo "strchr() found." >&4
14061 else
14062 val="$undef"
14063 vali="$define"
14064 echo "index() found." >&4
14065 fi
14066 else
14067 val="$undef"
14068 vali="$define"
8dfa8df9
JH
14069 echo "index() found." >&4
14070 fi
b4eb6b3d 14071else
8dfa8df9
JH
14072 if set strchr val -f d_strchr; eval $csym; $val; then
14073 val="$define"
14074 vali="$undef"
14075 echo "strchr() found." >&4
14076 else
14077 echo "No index() or strchr() found!" >&4
14078 val="$undef"
14079 vali="$undef"
14080 fi
b4eb6b3d 14081fi
8dfa8df9
JH
14082set d_strchr; eval $setvar
14083val="$vali"
14084set d_index; eval $setvar
14085
14086: check whether inet_aton exists
14087set inet_aton d_inetaton
14088eval $inlibc
b4eb6b3d
JH
14089
14090: Look for isascii
14091echo " "
36adc09b 14092$cat >isascii.c <<EOCP
b4eb6b3d
JH
14093#include <stdio.h>
14094#include <ctype.h>
55954f19
JH
14095#$i_stdlib I_STDLIB
14096#ifdef I_STDLIB
14097#include <stdlib.h>
14098#endif
b4eb6b3d
JH
14099int main() {
14100 int c = 'A';
14101 if (isascii(c))
14102 exit(0);
14103 else
14104 exit(1);
14105}
14106EOCP
14107set isascii
14108if eval $compile; then
14109 echo "isascii() found." >&4
14110 val="$define"
14111else
14112 echo "isascii() NOT found." >&4
14113 val="$undef"
14114fi
14115set d_isascii
14116eval $setvar
14117$rm -f isascii*
14118
758a5d79
JH
14119: see if isfinite exists
14120set isfinite d_isfinite
14121eval $inlibc
14122
14123: see if isinf exists
14124set isinf d_isinf
14125eval $inlibc
14126
b4eb6b3d
JH
14127: see if isnan exists
14128set isnan d_isnan
14129eval $inlibc
14130
14131: see if isnanl exists
14132set isnanl d_isnanl
14133eval $inlibc
14134
14135: see if killpg exists
14136set killpg d_killpg
14137eval $inlibc
14138
14139: see if lchown exists
14140echo " "
14141$cat > try.c <<'EOCP'
14142/* System header to define __stub macros and hopefully few prototypes,
14143 which can conflict with char lchown(); below. */
14144#include <assert.h>
14145/* Override any gcc2 internal prototype to avoid an error. */
14146/* We use char because int might match the return type of a gcc2
14147 builtin and then its argument prototype would still apply. */
14148char lchown();
14149int main() {
14150 /* The GNU C library defines this for functions which it implements
14151 to always fail with ENOSYS. Some functions are actually named
14152 something starting with __ and the normal name is an alias. */
14153#if defined (__stub_lchown) || defined (__stub___lchown)
14154choke me
14155#else
14156lchown();
14157#endif
14158; return 0; }
14159EOCP
14160set try
14161if eval $compile; then
14162 $echo "lchown() found." >&4
14163 val="$define"
14164else
14165 $echo "lchown() NOT found." >&4
14166 val="$undef"
14167fi
14168set d_lchown
14169eval $setvar
14170
14171: See if number of significant digits in a double precision number is known
14172echo " "
14173$cat >ldbl_dig.c <<EOM
14174#$i_limits I_LIMITS
14175#$i_float I_FLOAT
14176#ifdef I_LIMITS
14177#include <limits.h>
14178#endif
14179#ifdef I_FLOAT
14180#include <float.h>
14181#endif
14182#ifdef LDBL_DIG
14183printf("Contains LDBL_DIG");
14184#endif
14185EOM
14186$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14187if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14188 echo "LDBL_DIG found." >&4
14189 val="$define"
14190else
14191 echo "LDBL_DIG NOT found." >&4
14192 val="$undef"
14193fi
14194$rm -f ldbl_dig.?
14195set d_ldbl_dig
14196eval $setvar
14197
0a0abfba
MB
14198: see if this is a math.h system
14199set math.h i_math
14200eval $inhdr
14201
14202d_libm_lib_version="$undef"
14203case $i_math in
14204 $define)
14205 : check to see if math.h defines _LIB_VERSION
14206 echo " "
14207 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14208 $cat >try.c <<EOCP
14209#include <unistd.h>
14210#include <math.h>
14211int main (int argc, char *argv[])
14212{
14213 printf ("%d\n", _LIB_VERSION);
14214 return (0);
14215 } /* main */
14216EOCP
14217 set try
14218 if eval $compile; then
14219 foo=`$run ./try`
14220 echo "Yes, it does ($foo)" >&4
14221 d_libm_lib_version="$define"
14222 else
14223 echo "No, it does not (probably harmless)\n" >&4
14224 fi
14225 $rm -f try.* try core core.try.*
14226 ;;
14227
14228 esac
14229
b4eb6b3d
JH
14230: see if link exists
14231set link d_link
14232eval $inlibc
14233
10bc17b6
JH
14234: see if localtime_r exists
14235set localtime_r d_localtime_r
14236eval $inlibc
14237case "$d_localtime_r" in
14238"$define")
d63eadf0 14239 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14240 case "$d_localtime_r_proto:$usethreads" in
14241 ":define") d_localtime_r_proto=define
a48ec845
JH
14242 set d_localtime_r_proto localtime_r $hdrs
14243 eval $hasproto ;;
14244 *) ;;
14245 esac
14246 case "$d_localtime_r_proto" in
14247 define)
10bc17b6
JH
14248 case "$localtime_r_proto" in
14249 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14250 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14251 esac
14252 case "$localtime_r_proto" in
14253 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14254 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14255 esac
14256 case "$localtime_r_proto" in
90e831dc 14257 ''|0) d_localtime_r=undef
10bc17b6 14258 localtime_r_proto=0
a48ec845 14259 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14260 * ) case "$localtime_r_proto" in
14261 REENTRANT_PROTO*) ;;
14262 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14263 esac
14264 echo "Prototype: $try" ;;
14265 esac
14266 ;;
c18e646a
JH
14267 *) case "$usethreads" in
14268 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14269 esac
90e831dc
SB
14270 d_localtime_r=undef
14271 localtime_r_proto=0
c18e646a 14272 ;;
a48ec845
JH
14273 esac
14274 ;;
10bc17b6
JH
14275*) localtime_r_proto=0
14276 ;;
14277esac
14278
b4eb6b3d
JH
14279: see if localeconv exists
14280set localeconv d_locconv
14281eval $inlibc
14282
14283: see if lockf exists
14284set lockf d_lockf
14285eval $inlibc
14286
b4eb6b3d
JH
14287: see if prototype for lseek is available
14288echo " "
4786929f 14289set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14290eval $hasproto
14291
14292: see if lstat exists
14293set lstat d_lstat
14294eval $inlibc
14295
14296: see if madvise exists
14297set madvise d_madvise
14298eval $inlibc
14299
7dd121ae
MB
14300: see if malloc_size exists
14301set malloc_size d_malloc_size
14302eval $inlibc
14303
14304: see if malloc_size_good exists
14305set malloc_good_size d_malloc_good_size
14306eval $inlibc
14307
b4eb6b3d
JH
14308: see if mblen exists
14309set mblen d_mblen
14310eval $inlibc
14311
14312: see if mbstowcs exists
14313set mbstowcs d_mbstowcs
14314eval $inlibc
14315
14316: see if mbtowc exists
14317set mbtowc d_mbtowc
14318eval $inlibc
14319
14320: see if memchr exists
14321set memchr d_memchr
14322eval $inlibc
14323
14324: see if memcmp exists
14325set memcmp d_memcmp
14326eval $inlibc
14327
14328: see if memcpy exists
14329set memcpy d_memcpy
14330eval $inlibc
14331
14332: see if memmove exists
14333set memmove d_memmove
14334eval $inlibc
14335
14336: see if memset exists
14337set memset d_memset
14338eval $inlibc
14339
14340: see if mkdir exists
14341set mkdir d_mkdir
14342eval $inlibc
14343
14344: see if mkdtemp exists
14345set mkdtemp d_mkdtemp
14346eval $inlibc
14347
14348: see if mkfifo exists
14349set mkfifo d_mkfifo
14350eval $inlibc
14351
14352: see if mkstemp exists
14353set mkstemp d_mkstemp
14354eval $inlibc
14355
14356: see if mkstemps exists
14357set mkstemps d_mkstemps
14358eval $inlibc
14359
14360: see if mktime exists
14361set mktime d_mktime
14362eval $inlibc
14363
14364: see if this is a sys/mman.h system
14365set sys/mman.h i_sysmman
14366eval $inhdr
14367
14368: see if mmap exists
14369set mmap d_mmap
14370eval $inlibc
14371: see what shmat returns
14372: default to something harmless
14373mmaptype='void *'
14374case "$i_sysmman$d_mmap" in
14375"$define$define")
14376 $cat >mmap.c <<'END'
14377#include <sys/mman.h>
14378void *mmap();
14379END
14380 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14381 mmaptype='void *'
14382 else
14383 mmaptype='caddr_t'
14384 fi
14385 echo "and it returns ($mmaptype)." >&4
14386 ;;
14387esac
14388
14389
14390
89ce900e
JH
14391: see if sqrtl exists
14392set sqrtl d_sqrtl
14393eval $inlibc
14394
af1ff193
JH
14395: see if scalbnl exists
14396set scalbnl d_scalbnl
14397eval $inlibc
14398
89ce900e
JH
14399: see if modfl exists
14400set modfl d_modfl
14401eval $inlibc
14402
14403: see if prototype for modfl is available
14404echo " "
3a794506 14405set d_modflproto modfl $i_math math.h
89ce900e
JH
14406eval $hasproto
14407
14408d_modfl_pow32_bug="$undef"
14409
14410case "$d_longdbl$d_modfl" in
14411$define$define)
14412 $cat <<EOM
14413Checking to see whether your modfl() is okay for large values...
14414EOM
14415$cat >try.c <<EOCP
14416#include <math.h>
14417#include <stdio.h>
14418EOCP
14419if $test "X$d_modflproto" != "X$define"; then
14420 $cat >>try.c <<EOCP
14421/* Sigh. many current glibcs provide the function, but do not prototype it. */
14422long double modfl (long double, long double *);
14423EOCP
14424fi
14425$cat >>try.c <<EOCP
14426int main() {
14427 long double nv = 4294967303.15;
14428 long double v, w;
14429 v = modfl(nv, &w);
14430#ifdef __GLIBC__
14431 printf("glibc");
14432#endif
14433 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14434 return 0;
14435}
14436EOCP
14437 case "$osname:$gccversion" in
14438 aix:) saveccflags="$ccflags"
14439 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14440 esac
14441 set try
14442 if eval $compile; then
14443 foo=`$run ./try`
14444 case "$foo" in
14445 *" 4294967303.150000 1.150000 4294967302.000000")
14446 echo >&4 "Your modfl() is broken for large values."
14447 d_modfl_pow32_bug="$define"
14448 case "$foo" in
14449 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14450 ;;
14451 esac
14452 ;;
14453 *" 4294967303.150000 0.150000 4294967303.000000")
14454 echo >&4 "Your modfl() seems okay for large values."
14455 ;;
14456 *) echo >&4 "I don't understand your modfl() at all."
14457 d_modfl="$undef"
14458 ;;
14459 esac
14460 $rm -f try.* try core core.try.*
14461 else
14462 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14463 d_modfl="$undef"
14464 fi
14465 case "$osname:$gccversion" in
14466 aix:) ccflags="$saveccflags" ;; # restore
14467 esac
14468 ;;
14469esac
14470
14471if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14472 message=""
14473 if $test "$d_sqrtl" != "$define"; then
14474 message="$message sqrtl"
14475 fi
14476 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14477 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14478 echo "You have both aintl and copysignl, so I can emulate modfl."
14479 else
af1ff193 14480 message="$message modfl"
89ce900e 14481 fi
af1ff193
JH
14482 fi
14483 if $test "$d_frexpl" != "$define"; then
14484 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14485 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14486 else
14487 message="$message frexpl"
14488 fi
14489 fi
89ce900e 14490
af1ff193 14491 if $test "$message" != ""; then
89ce900e
JH
14492 $cat <<EOM >&4
14493
14494*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14495*** the following mathematical functions needed for long double support:
14496*** $message
fe63a0b4
JH
14497*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14498*** Cannot continue, aborting.
89ce900e
JH
14499
14500EOM
14501
fe63a0b4 14502 exit 1
89ce900e
JH
14503 fi
14504fi
14505
b4eb6b3d
JH
14506: see if mprotect exists
14507set mprotect d_mprotect
14508eval $inlibc
14509
14510: see if msgctl exists
14511set msgctl d_msgctl
14512eval $inlibc
14513
14514: see if msgget exists
14515set msgget d_msgget
14516eval $inlibc
14517
14518: see if msgsnd exists
14519set msgsnd d_msgsnd
14520eval $inlibc
14521
14522: see if msgrcv exists
14523set msgrcv d_msgrcv
14524eval $inlibc
14525
14526: see how much of the 'msg*(2)' library is present.
14527h_msg=true
14528echo " "
14529case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14530*"$undef"*) h_msg=false;;
14531esac
14532case "$osname" in
14533freebsd)
14534 case "`ipcs 2>&1`" in
14535 "SVID messages"*"not configured"*)
14536 echo "Your $osname does not have the msg*(2) configured." >&4
14537 h_msg=false
14538 val="$undef"
14539 set msgctl d_msgctl
14540 eval $setvar
14541 set msgget d_msgget
14542 eval $setvar
14543 set msgsnd d_msgsnd
14544 eval $setvar
14545 set msgrcv d_msgrcv
14546 eval $setvar
14547 ;;
14548 esac
14549 ;;
14550esac
14551: we could also check for sys/ipc.h ...
14552if $h_msg && $test `./findhdr sys/msg.h`; then
14553 echo "You have the full msg*(2) library." >&4
14554 val="$define"
14555else
14556 echo "You don't have the full msg*(2) library." >&4
14557 val="$undef"
14558fi
14559set d_msg
14560eval $setvar
14561
4e0554ec
JH
14562
14563echo " "
14564echo "Checking to see if your system supports struct msghdr..." >&4
14565set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14566eval $hasstruct
14567case "$d_msghdr_s" in
14568"$define") echo "Yes, it does." ;;
14569*) echo "No, it doesn't." ;;
14570esac
14571
14572
b4eb6b3d
JH
14573: see if msync exists
14574set msync d_msync
14575eval $inlibc
14576
14577: see if munmap exists
14578set munmap d_munmap
14579eval $inlibc
14580
14581: see if nice exists
14582set nice d_nice
14583eval $inlibc
14584
2765b840
JH
14585: see if this is a langinfo.h system
14586set langinfo.h i_langinfo
14587eval $inhdr
14588
14589: see if nl_langinfo exists
14590set nl_langinfo d_nl_langinfo
14591eval $inlibc
14592
b4eb6b3d
JH
14593: check for length of character
14594echo " "
14595case "$charsize" in
14596'')
14597 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14598 $cat >try.c <<EOCP
b4eb6b3d 14599#include <stdio.h>
d1daaddf
JH
14600#$i_stdlib I_STDLIB
14601#ifdef I_STDLIB
14602#include <stdlib.h>
14603#endif
b4eb6b3d
JH
14604int main()
14605{
14606 printf("%d\n", (int)sizeof(char));
14607 exit(0);
14608}
14609EOCP
14610 set try
14611 if eval $compile_ok; then
5440bc8e 14612 dflt=`$run ./try`
b4eb6b3d
JH
14613 else
14614 dflt='1'
14615 echo "(I can't seem to compile the test program. Guessing...)"
14616 fi
14617 ;;
14618*)
14619 dflt="$charsize"
14620 ;;
14621esac
14622rp="What is the size of a character (in bytes)?"
14623. ./myread
14624charsize="$ans"
14625$rm -f try.c try
14626
1d1be0dc
NC
14627: check for volatile keyword
14628echo " "
14629echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14630$cat >try.c <<'EOCP'
76f47787 14631int main()
1d1be0dc
NC
14632{
14633 typedef struct _goo_struct goo_struct;
14634 goo_struct * volatile goo = ((goo_struct *)0);
14635 struct _goo_struct {
14636 long long_int;
14637 int reg_int;
14638 char char_var;
14639 };
14640 typedef unsigned short foo_t;
14641 char *volatile foo;
14642 volatile int bar;
14643 volatile foo_t blech;
14644 foo = foo;
14645}
14646EOCP
14647if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14648 val="$define"
14649 echo "Yup, it does."
14650else
14651 val="$undef"
14652 echo "Nope, it doesn't."
14653fi
14654set d_volatile
14655eval $setvar
14656$rm -f try.*
14657
b4eb6b3d
JH
14658
14659echo " "
14660$echo "Choosing the C types to be used for Perl's internal types..." >&4
14661
14662case "$use64bitint:$d_quad:$quadtype" in
14663define:define:?*)
14664 ivtype="$quadtype"
14665 uvtype="$uquadtype"
14666 ivsize=8
14667 uvsize=8
14668 ;;
14669*) ivtype="long"
14670 uvtype="unsigned long"
14671 ivsize=$longsize
14672 uvsize=$longsize
14673 ;;
14674esac
14675
14676case "$uselongdouble:$d_longdbl" in
14677define:define)
14678 nvtype="long double"
14679 nvsize=$longdblsize
14680 ;;
14681*) nvtype=double
14682 nvsize=$doublesize
14683 ;;
14684esac
14685
14686$echo "(IV will be "$ivtype", $ivsize bytes)"
14687$echo "(UV will be "$uvtype", $uvsize bytes)"
14688$echo "(NV will be "$nvtype", $nvsize bytes)"
14689
14690$cat >try.c <<EOCP
14691#$i_inttypes I_INTTYPES
14692#ifdef I_INTTYPES
14693#include <inttypes.h>
14694#endif
14695#include <stdio.h>
14696int main() {
14697#ifdef INT8
14698 int8_t i = INT8_MAX;
14699 uint8_t u = UINT8_MAX;
14700 printf("int8_t\n");
14701#endif
14702#ifdef INT16
14703 int16_t i = INT16_MAX;
14704 uint16_t i = UINT16_MAX;
14705 printf("int16_t\n");
14706#endif
14707#ifdef INT32
14708 int32_t i = INT32_MAX;
14709 uint32_t u = UINT32_MAX;
14710 printf("int32_t\n");
14711#endif
14712}
14713EOCP
14714
14715case "$i8type" in
14716'') case "$charsize" in
14717 1) i8type=char
14718 u8type="unsigned char"
14719 i8size=$charsize
14720 u8size=$charsize
14721 ;;
14722 esac
14723 ;;
14724esac
14725case "$i8type" in
14726'') set try -DINT8
14727 if eval $compile; then
5440bc8e 14728 case "`$run ./try`" in
b4eb6b3d
JH
14729 int8_t) i8type=int8_t
14730 u8type=uint8_t
14731 i8size=1
14732 u8size=1
14733 ;;
14734 esac
14735 fi
14736 ;;
14737esac
14738case "$i8type" in
14739'') if $test $charsize -ge 1; then
14740 i8type=char
14741 u8type="unsigned char"
14742 i8size=$charsize
14743 u8size=$charsize
14744 fi
14745 ;;
14746esac
14747
14748case "$i16type" in
14749'') case "$shortsize" in
14750 2) i16type=short
14751 u16type="unsigned short"
14752 i16size=$shortsize
14753 u16size=$shortsize
14754 ;;
14755 esac
14756 ;;
14757esac
14758case "$i16type" in
14759'') set try -DINT16
14760 if eval $compile; then
5440bc8e 14761 case "`$run ./try`" in
b4eb6b3d
JH
14762 int16_t)
14763 i16type=int16_t
14764 u16type=uint16_t
14765 i16size=2
14766 u16size=2
14767 ;;
14768 esac
14769 fi
14770 ;;
14771esac
14772case "$i16type" in
14773'') if $test $shortsize -ge 2; then
14774 i16type=short
14775 u16type="unsigned short"
14776 i16size=$shortsize
14777 u16size=$shortsize
14778 fi
14779 ;;
14780esac
14781
14782case "$i32type" in
14783'') case "$longsize" in
14784 4) i32type=long
14785 u32type="unsigned long"
14786 i32size=$longsize
14787 u32size=$longsize
14788 ;;
14789 *) case "$intsize" in
14790 4) i32type=int
14791 u32type="unsigned int"
14792 i32size=$intsize
14793 u32size=$intsize
14794 ;;
14795 esac
14796 ;;
14797 esac
14798 ;;
14799esac
14800case "$i32type" in
14801'') set try -DINT32
14802 if eval $compile; then
5440bc8e 14803 case "`$run ./try`" in
b4eb6b3d
JH
14804 int32_t)
14805 i32type=int32_t
14806 u32type=uint32_t
14807 i32size=4
14808 u32size=4
14809 ;;
14810 esac
14811 fi
14812 ;;
14813esac
14814case "$i32type" in
14815'') if $test $intsize -ge 4; then
14816 i32type=int
14817 u32type="unsigned int"
14818 i32size=$intsize
14819 u32size=$intsize
14820 fi
14821 ;;
14822esac
14823
14824case "$i64type" in
14825'') case "$d_quad:$quadtype" in
14826 define:?*)
14827 i64type="$quadtype"
14828 u64type="$uquadtype"
14829 i64size=8
14830 u64size=8
14831 ;;
14832 esac
14833 ;;
14834esac
14835
1d1be0dc
NC
14836$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14837: volatile so that the compiler has to store it out to memory.
14838if test X"$d_volatile" = X"$define"; then
14839 volatile=volatile
14840fi
b4eb6b3d
JH
14841$cat <<EOP >try.c
14842#include <stdio.h>
55954f19
JH
14843#$i_stdlib I_STDLIB
14844#ifdef I_STDLIB
14845#include <stdlib.h>
14846#endif
1d1be0dc
NC
14847#include <sys/types.h>
14848#include <signal.h>
14849#ifdef SIGFPE
14850$volatile int bletched = 0;
14851$signal_t blech(s) int s; { bletched = 1; }
14852#endif
b4eb6b3d
JH
14853int main() {
14854 $uvtype u = 0;
1d1be0dc 14855 $nvtype d;
b4eb6b3d
JH
14856 int n = 8 * $uvsize;
14857 int i;
1d1be0dc
NC
14858#ifdef SIGFPE
14859 signal(SIGFPE, blech);
14860#endif
14861
b4eb6b3d
JH
14862 for (i = 0; i < n; i++) {
14863 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14864 d = ($nvtype)u;
14865 if (($uvtype)d != u)
b4eb6b3d 14866 break;
1d1be0dc
NC
14867 if (d <= 0)
14868 break;
14869 d = ($nvtype)(u - 1);
14870 if (($uvtype)d != (u - 1))
14871 break;
14872#ifdef SIGFPE
14873 if (bletched) {
14874 break;
14875#endif
14876 }
b4eb6b3d 14877 }
efd1522b 14878 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14879 exit(0);
14880}
14881EOP
1d1be0dc
NC
14882set try
14883
14884d_nv_preserves_uv="$undef"
14885if eval $compile; then
53133ed1 14886 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14887fi
53133ed1 14888case "$nv_preserves_uv_bits" in
1d1be0dc 14889\-[1-9]*)
53133ed1
NC
14890 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14891 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14892 d_nv_preserves_uv="$define"
b4eb6b3d 14893 ;;
53133ed1 14894[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14895 d_nv_preserves_uv="$undef" ;;
14896*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14897 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14898esac
14899
1d1be0dc
NC
14900$rm -f try.* try
14901
f607920a
CB
14902$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14903: volatile so that the compiler has to store it out to memory.
14904if test X"$d_volatile" = X"$define"; then
14905 volatile=volatile
14906fi
14907$cat <<EOP >try.c
14908#include <stdio.h>
14909#$i_stdlib I_STDLIB
14910#ifdef I_STDLIB
14911#include <stdlib.h>
14912#endif
14913#$i_string I_STRING
14914#ifdef I_STRING
14915# include <string.h>
14916#else
14917# include <strings.h>
14918#endif
14919#include <sys/types.h>
14920#include <signal.h>
14921#ifdef SIGFPE
14922$volatile int bletched = 0;
14923$signal_t blech(s) int s; { bletched = 1; }
14924#endif
14925
14926int checkit($nvtype d, char *where) {
14927 unsigned char *p = (char *)&d;
14928 unsigned char *end = p + sizeof(d);
14929 int fail = 0;
14930
14931 while (p < end)
14932 fail += *p++;
14933
14934 if (!fail)
17f6277d 14935 return 0;
f607920a
CB
14936
14937 p = (char *)&d;
14938 printf("No - %s: 0x", where);
14939 while (p < end)
14940 printf ("%02X", *p++);
14941 printf("\n");
14942 return 1;
14943}
14944
14945int main(int argc, char **argv) {
14946 $nvtype d = 0.0;
14947 int fail = 0;
14948 fail += checkit(d, "0.0");
14949
14950 /* The compiler shouldn't be assuming that bletched is 0 */
14951 d = bletched;
14952
14953 fail += checkit(d, "bleched");
14954
14955#ifdef SIGFPE
14956 signal(SIGFPE, blech);
14957#endif
14958
14959 /* Paranoia - the compiler should have no way of knowing that ANSI says
14960 that argv[argc] will always be NULL. Actually, if it did assume this it
14961 would be buggy, as this is C and main() can be called from elsewhere in
14962 the program. */
14963 d = argv[argc] ? 1 : 0;
14964
14965 if (d) {
14966 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14967 }
14968
14969 fail += checkit(d, "ternary");
14970
14971 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14972
14973 if (d != 0.0) {
14974 printf("No - memset doesn't give 0.0\n");
14975 /* This might just blow up: */
14976 printf("(gives %g)\n", d);
14977 return 1;
14978 }
14979
14980#ifdef SIGFPE
14981 if (bletched) {
14982 printf("No - something bleched\n");
14983 return 1;
14984 }
14985#endif
14986 if (fail) {
14987 printf("No - %d fail(s)\n", fail);
14988 return 1;
14989 }
14990 printf("Yes\n");
14991 return 0;
14992}
14993EOP
14994set try
14995
14996d_nv_zero_is_allbits_zero="$undef"
14997if eval $compile; then
14998 xxx="`$run ./try`"
14999 case "$?" in
15000 0)
15001 case "$xxx" in
15002 Yes) cat >&4 <<EOM
150030.0 is represented as all bits zero in memory
15004EOM
15005 d_nv_zero_is_allbits_zero="$define"
15006 ;;
15007 *) cat >&4 <<EOM
150080.0 is not represented as all bits zero in memory
15009EOM
15010 d_nv_zero_is_allbits_zero="$undef"
15011 ;;
15012 esac
15013 ;;
15014 *) cat >&4 <<EOM
150150.0 is not represented as all bits zero in memory
15016EOM
15017 d_nv_zero_is_allbits_zero="$undef"
15018 ;;
15019 esac
15020fi
15021
15022$rm -f try.* try
15023
b4eb6b3d
JH
15024
15025: check for off64_t
15026echo " "
15027echo "Checking to see if you have off64_t..." >&4
15028$cat >try.c <<EOCP
15029#include <sys/types.h>
15030#include <unistd.h>
15031int main() { off64_t x = 7; }
15032EOCP
15033set try
15034if eval $compile; then
15035 val="$define"
15036 echo "You have off64_t."
15037else
15038 val="$undef"
15039 echo "You do not have off64_t."
15040 case "$lseeksize" in
15041 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15042 esac
15043fi
15044$rm -f try.* try
15045set d_off64_t
15046eval $setvar
15047
b4eb6b3d
JH
15048: how to create joinable pthreads
15049if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15050 echo " "
15051 echo "Checking what constant to use for creating joinable pthreads..." >&4
15052 $cat >try.c <<'EOCP'
15053#include <pthread.h>
15054int main() {
15055 int detachstate = JOINABLE;
15056}
15057EOCP
15058 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15059 if eval $compile; then
15060 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15061 val="$undef" # Yes, undef.
15062 set d_old_pthread_create_joinable
15063 eval $setvar
15064 val=""
15065 set old_pthread_create_joinable
15066 eval $setvar
15067 else
15068 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15069 if eval $compile; then
15070 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15071 val="$define"
15072 set d_old_pthread_create_joinable
15073 eval $setvar
15074 val=PTHREAD_CREATE_UNDETACHED
15075 set old_pthread_create_joinable
15076 eval $setvar
15077 else
15078 set try -DJOINABLE=__UNDETACHED
15079 if eval $compile; then
15080 echo "You seem to use __UNDETACHED." >&4
15081 val="$define"
15082 set d_old_pthread_create_joinable
15083 eval $setvar
15084 val=__UNDETACHED
15085 set old_pthread_create_joinable
15086 eval $setvar
15087 else
15088 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15089 val="$define"
15090 set d_old_pthread_create_joinable
15091 eval $setvar
15092 val=0
15093 set old_pthread_create_joinable
15094 eval $setvar
15095 fi
15096 fi
15097 fi
15098 $rm -f try try.*
15099else
15100 d_old_pthread_create_joinable="$undef"
15101 old_pthread_create_joinable=""
15102fi
15103
15104: see if pause exists
15105set pause d_pause
15106eval $inlibc
15107
15108: see if pipe exists
15109set pipe d_pipe
15110eval $inlibc
15111
15112: see if poll exists
15113set poll d_poll
15114eval $inlibc
15115
c7aff470
NIS
15116: see if readlink exists
15117set readlink d_readlink
15118eval $inlibc
15119
15120echo " "
f24dbf84 15121procselfexe=''
c7aff470 15122val="$undef"
a33c94aa
JH
15123case "$d_readlink" in
15124"$define")
c7aff470
NIS
15125 if $issymlink /proc/self/exe ; then
15126 $ls -l /proc/self/exe > reflect
51660ed5 15127 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15128 echo "You have Linux-like /proc/self/exe."
92236451 15129 procselfexe='"/proc/self/exe"'
f24dbf84 15130 val="$define"
f24dbf84
JH
15131 fi
15132 fi
15133 if $issymlink /proc/curproc/file ; then
15134 $ls -l /proc/curproc/file > reflect
15135 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15136 echo "You have BSD-like /proc/curproc/file."
92236451 15137 procselfexe='"/proc/curproc/file"'
f24dbf84 15138 val="$define"
c7aff470 15139 fi
c7aff470 15140 fi
a33c94aa
JH
15141 ;;
15142esac
428dc699 15143$rm -f reflect
c7aff470
NIS
15144set d_procselfexe
15145eval $setvar
15146
263fee3f
JH
15147: see whether the pthread_atfork exists
15148$cat >try.c <<EOP
15149#include <pthread.h>
15150#include <stdio.h>
15151int main() {
15152#ifdef PTHREAD_ATFORK
15153 pthread_atfork(NULL,NULL,NULL);
15154#endif
15155}
15156EOP
15157
d6483fcc 15158: see if pthread_atfork exists
263fee3f
JH
15159set try -DPTHREAD_ATFORK
15160if eval $compile; then
15161 val="$define"
15162else
15163 val="$undef"
15164fi
15165case "$usethreads" in
15166$define)
15167 case "$val" in
15168 $define) echo 'pthread_atfork found.' >&4 ;;
15169 *) echo 'pthread_atfork NOT found.' >&4 ;;
15170 esac
15171esac
15172set d_pthread_atfork
15173eval $setvar
d6483fcc 15174
58d975c3
JH
15175: see if pthread_attr_setscope exists
15176set pthread_attr_setscope d_pthread_attr_setscope
15177eval $inlibc
15178
b4eb6b3d
JH
15179
15180: see whether the various POSIXish _yields exist
15181$cat >try.c <<EOP
15182#include <pthread.h>
15183#include <stdio.h>
15184int main() {
15185#ifdef SCHED_YIELD
15186 sched_yield();
15187#else
15188#ifdef PTHREAD_YIELD
15189 pthread_yield();
15190#else
15191#ifdef PTHREAD_YIELD_NULL
15192 pthread_yield(NULL);
15193#endif
15194#endif
15195#endif
15196}
15197EOP
15198: see if sched_yield exists
15199set try -DSCHED_YIELD
15200if eval $compile; then
15201 val="$define"
15202 sched_yield='sched_yield()'
15203else
15204 val="$undef"
15205fi
15206case "$usethreads" in
15207$define)
15208 case "$val" in
15209 $define) echo 'sched_yield() found.' >&4 ;;
15210 *) echo 'sched_yield() NOT found.' >&4 ;;
15211 esac
15212esac
10bc17b6
JH
15213set d_sched_yield
15214eval $setvar
b4eb6b3d 15215
10bc17b6
JH
15216: see if pthread_yield exists
15217set try -DPTHREAD_YIELD
15218if eval $compile; then
15219 val="$define"
15220 case "$sched_yield" in
15221 '') sched_yield='pthread_yield()' ;;
15222 esac
15223else
15224 set try -DPTHREAD_YIELD_NULL
15225 if eval $compile; then
15226 val="$define"
15227 case "$sched_yield" in
15228 '') sched_yield='pthread_yield(NULL)' ;;
15229 esac
15230 else
15231 val="$undef"
15232 fi
15233fi
15234case "$usethreads" in
15235$define)
15236 case "$val" in
15237 $define) echo 'pthread_yield() found.' >&4 ;;
15238 *) echo 'pthread_yield() NOT found.' >&4 ;;
15239 esac
15240 ;;
15241esac
15242set d_pthread_yield
15243eval $setvar
b4eb6b3d 15244
10bc17b6
JH
15245case "$sched_yield" in
15246'') sched_yield=undef ;;
15247esac
b4eb6b3d 15248
10bc17b6
JH
15249$rm -f try try.*
15250
15251: see if random_r exists
15252set random_r d_random_r
15253eval $inlibc
15254case "$d_random_r" in
15255"$define")
15256 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15257 case "$d_random_r_proto:$usethreads" in
15258 ":define") d_random_r_proto=define
a48ec845
JH
15259 set d_random_r_proto random_r $hdrs
15260 eval $hasproto ;;
15261 *) ;;
15262 esac
15263 case "$d_random_r_proto" in
15264 define)
10bc17b6
JH
15265 case "$random_r_proto" in
15266 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15267 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15268 esac
15269 case "$random_r_proto" in
15270 ''|0) try='int random_r(long*, struct random_data*);'
15271 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15272 esac
15273 case "$random_r_proto" in
15274 ''|0) try='int random_r(struct random_data*, int32_t*);'
15275 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15276 esac
15277 case "$random_r_proto" in
90e831dc 15278 ''|0) d_random_r=undef
10bc17b6 15279 random_r_proto=0
a48ec845 15280 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15281 * ) case "$random_r_proto" in
15282 REENTRANT_PROTO*) ;;
15283 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15284 esac
15285 echo "Prototype: $try" ;;
15286 esac
b4eb6b3d 15287 ;;
c18e646a
JH
15288 *) case "$usethreads" in
15289 define) echo "random_r has no prototype, not using it." >&4 ;;
15290 esac
90e831dc
SB
15291 d_random_r=undef
15292 random_r_proto=0
c18e646a 15293 ;;
a48ec845
JH
15294 esac
15295 ;;
10bc17b6 15296*) random_r_proto=0
b4eb6b3d
JH
15297 ;;
15298esac
15299
15300: see if readdir and friends exist
15301set readdir d_readdir
15302eval $inlibc
15303set seekdir d_seekdir
15304eval $inlibc
15305set telldir d_telldir
15306eval $inlibc
15307set rewinddir d_rewinddir
15308eval $inlibc
15309
10bc17b6
JH
15310: see if readdir64_r exists
15311set readdir64_r d_readdir64_r
15312eval $inlibc
15313case "$d_readdir64_r" in
15314"$define")
15315 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15316 case "$d_readdir64_r_proto:$usethreads" in
15317 ":define") d_readdir64_r_proto=define
a48ec845
JH
15318 set d_readdir64_r_proto readdir64_r $hdrs
15319 eval $hasproto ;;
15320 *) ;;
15321 esac
15322 case "$d_readdir64_r_proto" in
15323 define)
10bc17b6
JH
15324 case "$readdir64_r_proto" in
15325 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15326 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15327 esac
15328 case "$readdir64_r_proto" in
15329 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15330 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15331 esac
15332 case "$readdir64_r_proto" in
90e831dc 15333 ''|0) d_readdir64_r=undef
10bc17b6 15334 readdir64_r_proto=0
a48ec845 15335 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15336 * ) case "$readdir64_r_proto" in
15337 REENTRANT_PROTO*) ;;
15338 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15339 esac
15340 echo "Prototype: $try" ;;
15341 esac
15342 ;;
c18e646a
JH
15343 *) case "$usethreads" in
15344 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15345 esac
90e831dc
SB
15346 d_readdir64_r=undef
15347 readdir64_r_proto=0
c18e646a 15348 ;;
a48ec845
JH
15349 esac
15350 ;;
10bc17b6
JH
15351*) readdir64_r_proto=0
15352 ;;
15353esac
15354
15355: see if readdir_r exists
15356set readdir_r d_readdir_r
15357eval $inlibc
15358case "$d_readdir_r" in
15359"$define")
15360 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15361 case "$d_readdir_r_proto:$usethreads" in
15362 ":define") d_readdir_r_proto=define
a48ec845
JH
15363 set d_readdir_r_proto readdir_r $hdrs
15364 eval $hasproto ;;
15365 *) ;;
15366 esac
15367 case "$d_readdir_r_proto" in
15368 define)
10bc17b6
JH
15369 case "$readdir_r_proto" in
15370 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15371 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15372 esac
15373 case "$readdir_r_proto" in
15374 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15375 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15376 esac
15377 case "$readdir_r_proto" in
90e831dc 15378 ''|0) d_readdir_r=undef
10bc17b6 15379 readdir_r_proto=0
a48ec845 15380 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15381 * ) case "$readdir_r_proto" in
15382 REENTRANT_PROTO*) ;;
15383 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15384 esac
15385 echo "Prototype: $try" ;;
15386 esac
15387 ;;
c18e646a
JH
15388 *) case "$usethreads" in
15389 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15390 esac
90e831dc
SB
15391 d_readdir_r=undef
15392 readdir_r_proto=0
c18e646a 15393 ;;
a48ec845
JH
15394 esac
15395 ;;
10bc17b6
JH
15396*) readdir_r_proto=0
15397 ;;
15398esac
15399
4e0554ec
JH
15400: see if readv exists
15401set readv d_readv
15402eval $inlibc
15403
15404: see if recvmsg exists
15405set recvmsg d_recvmsg
15406eval $inlibc
15407
b4eb6b3d
JH
15408: see if rename exists
15409set rename d_rename
15410eval $inlibc
15411
15412: see if rmdir exists
15413set rmdir d_rmdir
15414eval $inlibc
15415
15416: see if memory.h is available.
15417val=''
15418set memory.h val
15419eval $inhdr
15420
15421: See if it conflicts with string.h
15422case "$val" in
15423$define)
15424 case "$strings" in
15425 '') ;;
15426 *)
15427 $cppstdin $cppflags $cppminus < $strings > mem.h
15428 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15429 echo " "
15430 echo "We won't be including <memory.h>."
15431 val="$undef"
15432 fi
15433 $rm -f mem.h
15434 ;;
15435 esac
15436esac
15437set i_memory
15438eval $setvar
15439
15440: can bcopy handle overlapping blocks?
b6cc3bc4 15441echo " "
b4eb6b3d 15442val="$undef"
b6cc3bc4
AD
15443case "$d_memmove" in
15444"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15445*) case "$d_bcopy" in
15446 "$define")
15447 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15448 $cat >try.c <<EOCP
b4eb6b3d
JH
15449#$i_memory I_MEMORY
15450#$i_stdlib I_STDLIB
15451#$i_string I_STRING
15452#$i_unistd I_UNISTD
15453EOCP
15454 $cat >>try.c <<'EOCP'
15455#include <stdio.h>
15456#ifdef I_MEMORY
15457# include <memory.h>
15458#endif
15459#ifdef I_STDLIB
15460# include <stdlib.h>
15461#endif
15462#ifdef I_STRING
15463# include <string.h>
15464#else
15465# include <strings.h>
15466#endif
15467#ifdef I_UNISTD
15468# include <unistd.h> /* Needed for NetBSD */
15469#endif
15470int main()
15471{
15472char buf[128], abc[128];
15473char *b;
15474int len;
15475int off;
15476int align;
15477
b6cc3bc4
AD
15478/* Copy "abcde..." string to char abc[] so that gcc doesn't
15479 try to store the string in read-only memory. */
b4eb6b3d
JH
15480bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15481
15482for (align = 7; align >= 0; align--) {
15483 for (len = 36; len; len--) {
15484 b = buf+align;
15485 bcopy(abc, b, len);
15486 for (off = 1; off <= len; off++) {
15487 bcopy(b, b+off, len);
15488 bcopy(b+off, b, len);
15489 if (bcmp(b, abc, len))
15490 exit(1);
15491 }
15492 }
15493}
15494exit(0);
15495}
15496EOCP
b6cc3bc4
AD
15497 set try
15498 if eval $compile_ok; then
15499 if ./try 2>/dev/null; then
15500 echo "Yes, it can."
15501 val="$define"
15502 else
15503 echo "It can't, sorry."
15504 fi
b4eb6b3d 15505 else
b6cc3bc4 15506 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15507 fi
b6cc3bc4
AD
15508 ;;
15509 esac
15510 $rm -f try.* try core
b4eb6b3d
JH
15511 ;;
15512esac
b4eb6b3d
JH
15513set d_safebcpy
15514eval $setvar
15515
15516: can memcpy handle overlapping blocks?
b6cc3bc4 15517echo " "
b4eb6b3d 15518val="$undef"
b6cc3bc4
AD
15519case "$d_memmove" in
15520"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15521*) case "$d_memcpy" in
15522 "$define")
15523 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15524 $cat >try.c <<EOCP
b4eb6b3d
JH
15525#$i_memory I_MEMORY
15526#$i_stdlib I_STDLIB
15527#$i_string I_STRING
15528#$i_unistd I_UNISTD
15529EOCP
15530 $cat >>try.c <<'EOCP'
15531#include <stdio.h>
15532#ifdef I_MEMORY
15533# include <memory.h>
15534#endif
15535#ifdef I_STDLIB
15536# include <stdlib.h>
15537#endif
15538#ifdef I_STRING
15539# include <string.h>
15540#else
15541# include <strings.h>
15542#endif
15543#ifdef I_UNISTD
15544# include <unistd.h> /* Needed for NetBSD */
15545#endif
15546int main()
15547{
15548char buf[128], abc[128];
15549char *b;
15550int len;
15551int off;
15552int align;
15553
15554/* Copy "abcde..." string to char abc[] so that gcc doesn't
15555 try to store the string in read-only memory. */
15556memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15557
15558for (align = 7; align >= 0; align--) {
15559 for (len = 36; len; len--) {
15560 b = buf+align;
15561 memcpy(b, abc, len);
15562 for (off = 1; off <= len; off++) {
15563 memcpy(b+off, b, len);
15564 memcpy(b, b+off, len);
15565 if (memcmp(b, abc, len))
15566 exit(1);
15567 }
15568 }
15569}
15570exit(0);
15571}
15572EOCP
b6cc3bc4
AD
15573 set try
15574 if eval $compile_ok; then
15575 if ./try 2>/dev/null; then
15576 echo "Yes, it can."
15577 val="$define"
15578 else
15579 echo "It can't, sorry."
15580 fi
b4eb6b3d 15581 else
b6cc3bc4 15582 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15583 fi
b6cc3bc4
AD
15584 ;;
15585 esac
15586 $rm -f try.* try core
b4eb6b3d
JH
15587 ;;
15588esac
b4eb6b3d
JH
15589set d_safemcpy
15590eval $setvar
15591
15592: can memcmp be trusted to compare relative magnitude?
15593val="$undef"
15594case "$d_memcmp" in
15595"$define")
15596 echo " "
15597 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15598 $cat >try.c <<EOCP
15599#$i_memory I_MEMORY
15600#$i_stdlib I_STDLIB
15601#$i_string I_STRING
15602#$i_unistd I_UNISTD
15603EOCP
15604 $cat >>try.c <<'EOCP'
15605#include <stdio.h>
15606#ifdef I_MEMORY
15607# include <memory.h>
15608#endif
15609#ifdef I_STDLIB
36adc09b 15610# include <stdlib.h>
b4eb6b3d
JH
15611#endif
15612#ifdef I_STRING
15613# include <string.h>
15614#else
15615# include <strings.h>
15616#endif
15617#ifdef I_UNISTD
15618# include <unistd.h> /* Needed for NetBSD */
15619#endif
15620int main()
15621{
15622char a = -1;
15623char b = 0;
15624if ((a < b) && memcmp(&a, &b, 1) < 0)
15625 exit(1);
15626exit(0);
15627}
15628EOCP
15629 set try
15630 if eval $compile_ok; then
5440bc8e 15631 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15632 echo "Yes, it can."
15633 val="$define"
15634 else
15635 echo "No, it can't (it uses signed chars)."
15636 fi
15637 else
15638 echo "(I can't compile the test program, so we'll assume not...)"
15639 fi
15640 ;;
15641esac
15642$rm -f try.* try core
15643set d_sanemcmp
15644eval $setvar
15645
ef9f17be
JH
15646: see if prototype for sbrk is available
15647echo " "
15648set d_sbrkproto sbrk $i_unistd unistd.h
15649eval $hasproto
15650
b4eb6b3d
JH
15651: see if select exists
15652set select d_select
15653eval $inlibc
15654
15655: see if semctl exists
15656set semctl d_semctl
15657eval $inlibc
15658
15659: see if semget exists
15660set semget d_semget
15661eval $inlibc
15662
15663: see if semop exists
15664set semop d_semop
15665eval $inlibc
15666
15667: see how much of the 'sem*(2)' library is present.
15668h_sem=true
15669echo " "
15670case "$d_semctl$d_semget$d_semop" in
15671*"$undef"*) h_sem=false;;
15672esac
15673case "$osname" in
15674freebsd)
15675 case "`ipcs 2>&1`" in
15676 "SVID messages"*"not configured"*)
15677 echo "Your $osname does not have the sem*(2) configured." >&4
15678 h_sem=false
15679 val="$undef"
15680 set semctl d_semctl
15681 eval $setvar
15682 set semget d_semget
15683 eval $setvar
15684 set semop d_semop
15685 eval $setvar
15686 ;;
15687 esac
15688 ;;
15689esac
15690: we could also check for sys/ipc.h ...
15691if $h_sem && $test `./findhdr sys/sem.h`; then
15692 echo "You have the full sem*(2) library." >&4
15693 val="$define"
15694else
15695 echo "You don't have the full sem*(2) library." >&4
15696 val="$undef"
15697fi
15698set d_sem
15699eval $setvar
15700
15701: see whether sys/sem.h defines union semun
15702echo " "
15703$cat > try.c <<'END'
15704#include <sys/types.h>
15705#include <sys/ipc.h>
15706#include <sys/sem.h>
15707int main () { union semun semun; semun.buf = 0; }
15708END
15709set try
15710if eval $compile; then
15711 echo "You have union semun in <sys/sem.h>." >&4
15712 val="$define"
15713else
15714 echo "You do not have union semun in <sys/sem.h>." >&4
15715 val="$undef"
15716fi
2fad75a1 15717$rm -f try try.c
b4eb6b3d
JH
15718set d_union_semun
15719eval $setvar
15720
15721: see how to do semctl IPC_STAT
15722case "$d_sem" in
15723$define)
b4eb6b3d
JH
15724 echo " "
15725 $cat > try.h <<END
15726#ifndef S_IRUSR
15727# ifdef S_IREAD
15728# define S_IRUSR S_IREAD
15729# define S_IWUSR S_IWRITE
15730# define S_IXUSR S_IEXEC
15731# else
15732# define S_IRUSR 0400
15733# define S_IWUSR 0200
15734# define S_IXUSR 0100
15735# endif
15736# define S_IRGRP (S_IRUSR>>3)
15737# define S_IWGRP (S_IWUSR>>3)
15738# define S_IXGRP (S_IXUSR>>3)
15739# define S_IROTH (S_IRUSR>>6)
15740# define S_IWOTH (S_IWUSR>>6)
15741# define S_IXOTH (S_IXUSR>>6)
15742#endif
15743#ifndef S_IRWXU
15744# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15745# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15746# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15747#endif
15748END
2fad75a1 15749 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
15750 case "$d_semctl_semun" in
15751 '')
35918792 15752 val="$undef"
2fad75a1 15753 $cat > try.c <<END
b4eb6b3d
JH
15754#include <sys/types.h>
15755#include <sys/ipc.h>
15756#include <sys/sem.h>
15757#include <sys/stat.h>
15758#include <stdio.h>
15759#include <errno.h>
15760#include "try.h"
15761#ifndef errno
15762extern int errno;
15763#endif
15764#$d_union_semun HAS_UNION_SEMUN
15765int main() {
15766 union semun
15767#ifndef HAS_UNION_SEMUN
15768 {
15769 int val;
15770 struct semid_ds *buf;
15771 unsigned short *array;
15772 }
15773#endif
15774 arg;
15775 int sem, st;
15776
15777#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15778 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15779 if (sem > -1) {
15780 struct semid_ds argbuf;
15781 arg.buf = &argbuf;
15782# ifdef IPC_STAT
15783 st = semctl(sem, 0, IPC_STAT, arg);
15784 if (st == 0)
15785 printf("semun\n");
15786 else
15787# endif /* IPC_STAT */
15788 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15789# ifdef IPC_RMID
15790 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 15791# endif /* IPC_RMID */
b4eb6b3d
JH
15792 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15793 } else
15794#endif /* IPC_PRIVATE && ... */
15795 printf("semget failed: errno = %d\n", errno);
15796 return 0;
15797}
15798END
2fad75a1
JH
15799 set try
15800 if eval $compile; then
15801 xxx=`$run ./try`
15802 case "$xxx" in
15803 semun) val="$define" ;;
15804 esac
15805 fi
15806 $rm -f try try.c
35918792
YST
15807 set d_semctl_semun
15808 eval $setvar
2fad75a1
JH
15809 ;;
15810 esac
b4eb6b3d
JH
15811 case "$d_semctl_semun" in
15812 $define)
15813 echo "You can use union semun for semctl IPC_STAT." >&4
15814 also='also'
15815 ;;
15816 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15817 also=''
15818 ;;
15819 esac
15820
15821 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15822 case "$d_semctl_semid_ds" in
15823 '')
35918792 15824 val="$undef"
2fad75a1 15825 $cat > try.c <<'END'
b4eb6b3d
JH
15826#include <sys/types.h>
15827#include <sys/ipc.h>
15828#include <sys/sem.h>
15829#include <sys/stat.h>
15830#include "try.h"
15831#include <stdio.h>
15832#include <errno.h>
15833#ifndef errno
15834extern int errno;
15835#endif
15836int main() {
15837 struct semid_ds arg;
15838 int sem, st;
15839
15840#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15841 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15842 if (sem > -1) {
15843# ifdef IPC_STAT
15844 st = semctl(sem, 0, IPC_STAT, &arg);
15845 if (st == 0)
15846 printf("semid_ds\n");
15847 else
15848# endif /* IPC_STAT */
15849 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15850# ifdef IPC_RMID
15851 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15852# endif /* IPC_RMID */
15853 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15854 } else
15855#endif /* IPC_PRIVATE && ... */
15856 printf("semget failed: errno = %d\n", errno);
15857
15858 return 0;
15859}
15860END
2fad75a1
JH
15861 set try
15862 if eval $compile; then
15863 xxx=`$run ./try`
15864 case "$xxx" in
15865 semid_ds) val="$define" ;;
15866 esac
15867 fi
15868 $rm -f try try.c
35918792
YST
15869 set d_semctl_semid_ds
15870 eval $setvar
2fad75a1
JH
15871 ;;
15872 esac
b4eb6b3d
JH
15873 case "$d_semctl_semid_ds" in
15874 $define)
15875 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15876 ;;
15877 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15878 ;;
15879 esac
15880 $rm -f try.h
15881 ;;
15882*) val="$undef"
15883
15884 # We do not have the full sem*(2) library, so assume we can not
15885 # use either.
15886
15887 set d_semctl_semun
15888 eval $setvar
15889
15890 set d_semctl_semid_ds
15891 eval $setvar
15892 ;;
15893esac
15894
4e0554ec
JH
15895: see if sendmsg exists
15896set sendmsg d_sendmsg
15897eval $inlibc
15898
b4eb6b3d
JH
15899: see if setegid exists
15900set setegid d_setegid
15901eval $inlibc
15902
15903: see if seteuid exists
15904set seteuid d_seteuid
15905eval $inlibc
15906
15907: see if setgrent exists
15908set setgrent d_setgrent
15909eval $inlibc
15910
10bc17b6
JH
15911: see if setgrent_r exists
15912set setgrent_r d_setgrent_r
15913eval $inlibc
15914case "$d_setgrent_r" in
15915"$define")
15916 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15917 case "$d_setgrent_r_proto:$usethreads" in
15918 ":define") d_setgrent_r_proto=define
a48ec845
JH
15919 set d_setgrent_r_proto setgrent_r $hdrs
15920 eval $hasproto ;;
15921 *) ;;
15922 esac
15923 case "$d_setgrent_r_proto" in
15924 define)
10bc17b6
JH
15925 case "$setgrent_r_proto" in
15926 ''|0) try='int setgrent_r(FILE**);'
15927 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15928 esac
15929 case "$setgrent_r_proto" in
15930 ''|0) try='void setgrent_r(FILE**);'
15931 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15932 esac
15933 case "$setgrent_r_proto" in
90e831dc 15934 ''|0) d_setgrent_r=undef
10bc17b6 15935 setgrent_r_proto=0
a48ec845 15936 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15937 * ) case "$setgrent_r_proto" in
15938 REENTRANT_PROTO*) ;;
15939 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15940 esac
15941 echo "Prototype: $try" ;;
15942 esac
15943 ;;
c18e646a
JH
15944 *) case "$usethreads" in
15945 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15946 esac
90e831dc
SB
15947 d_setgrent_r=undef
15948 setgrent_r_proto=0
c18e646a 15949 ;;
a48ec845
JH
15950 esac
15951 ;;
10bc17b6
JH
15952*) setgrent_r_proto=0
15953 ;;
15954esac
15955
b4eb6b3d
JH
15956: see if sethostent exists
15957set sethostent d_sethent
15958eval $inlibc
15959
10bc17b6
JH
15960: see if sethostent_r exists
15961set sethostent_r d_sethostent_r
15962eval $inlibc
15963case "$d_sethostent_r" in
15964"$define")
15965 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15966 case "$d_sethostent_r_proto:$usethreads" in
15967 ":define") d_sethostent_r_proto=define
a48ec845
JH
15968 set d_sethostent_r_proto sethostent_r $hdrs
15969 eval $hasproto ;;
15970 *) ;;
15971 esac
15972 case "$d_sethostent_r_proto" in
15973 define)
10bc17b6
JH
15974 case "$sethostent_r_proto" in
15975 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15976 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15977 esac
15978 case "$sethostent_r_proto" in
15979 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15980 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15981 esac
15982 case "$sethostent_r_proto" in
90e831dc 15983 ''|0) d_sethostent_r=undef
10bc17b6 15984 sethostent_r_proto=0
a48ec845 15985 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15986 * ) case "$sethostent_r_proto" in
15987 REENTRANT_PROTO*) ;;
15988 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15989 esac
15990 echo "Prototype: $try" ;;
15991 esac
15992 ;;
c18e646a
JH
15993 *) case "$usethreads" in
15994 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15995 esac
90e831dc
SB
15996 d_sethostent_r=undef
15997 sethostent_r_proto=0
c18e646a 15998 ;;
a48ec845
JH
15999 esac
16000 ;;
10bc17b6
JH
16001*) sethostent_r_proto=0
16002 ;;
16003esac
16004
4e0554ec
JH
16005: see if setitimer exists
16006set setitimer d_setitimer
16007eval $inlibc
16008
b4eb6b3d
JH
16009: see if setlinebuf exists
16010set setlinebuf d_setlinebuf
16011eval $inlibc
16012
16013: see if setlocale exists
16014set setlocale d_setlocale
16015eval $inlibc
16016
10bc17b6
JH
16017: see if locale.h is available
16018set locale.h i_locale
16019eval $inhdr
16020
16021: see if setlocale_r exists
16022set setlocale_r d_setlocale_r
16023eval $inlibc
16024case "$d_setlocale_r" in
16025"$define")
16026 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16027 case "$d_setlocale_r_proto:$usethreads" in
16028 ":define") d_setlocale_r_proto=define
a48ec845
JH
16029 set d_setlocale_r_proto setlocale_r $hdrs
16030 eval $hasproto ;;
16031 *) ;;
16032 esac
16033 case "$d_setlocale_r_proto" in
16034 define)
10bc17b6
JH
16035 case "$setlocale_r_proto" in
16036 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16037 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16038 esac
16039 case "$setlocale_r_proto" in
90e831dc 16040 ''|0) d_setlocale_r=undef
10bc17b6 16041 setlocale_r_proto=0
a48ec845 16042 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16043 * ) case "$setlocale_r_proto" in
16044 REENTRANT_PROTO*) ;;
16045 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16046 esac
16047 echo "Prototype: $try" ;;
16048 esac
16049 ;;
c18e646a
JH
16050 *) case "$usethreads" in
16051 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16052 esac
90e831dc
SB
16053 d_setlocale_r=undef
16054 setlocale_r_proto=0
c18e646a 16055 ;;
a48ec845
JH
16056 esac
16057 ;;
10bc17b6
JH
16058*) setlocale_r_proto=0
16059 ;;
16060esac
16061
b4eb6b3d
JH
16062: see if setnetent exists
16063set setnetent d_setnent
16064eval $inlibc
16065
10bc17b6
JH
16066: see if setnetent_r exists
16067set setnetent_r d_setnetent_r
16068eval $inlibc
16069case "$d_setnetent_r" in
16070"$define")
16071 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16072 case "$d_setnetent_r_proto:$usethreads" in
16073 ":define") d_setnetent_r_proto=define
a48ec845
JH
16074 set d_setnetent_r_proto setnetent_r $hdrs
16075 eval $hasproto ;;
16076 *) ;;
16077 esac
16078 case "$d_setnetent_r_proto" in
16079 define)
10bc17b6
JH
16080 case "$setnetent_r_proto" in
16081 ''|0) try='int setnetent_r(int, struct netent_data*);'
16082 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16083 esac
16084 case "$setnetent_r_proto" in
16085 ''|0) try='void setnetent_r(int, struct netent_data*);'
16086 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16087 esac
16088 case "$setnetent_r_proto" in
90e831dc 16089 ''|0) d_setnetent_r=undef
10bc17b6 16090 setnetent_r_proto=0
a48ec845 16091 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16092 * ) case "$setnetent_r_proto" in
16093 REENTRANT_PROTO*) ;;
16094 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16095 esac
16096 echo "Prototype: $try" ;;
16097 esac
16098 ;;
c18e646a
JH
16099 *) case "$usethreads" in
16100 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16101 esac
90e831dc
SB
16102 d_setnetent_r=undef
16103 setnetent_r_proto=0
c18e646a 16104 ;;
a48ec845
JH
16105 esac
16106 ;;
10bc17b6
JH
16107*) setnetent_r_proto=0
16108 ;;
16109esac
16110
b4eb6b3d
JH
16111: see if setprotoent exists
16112set setprotoent d_setpent
16113eval $inlibc
16114
16115: see if setpgid exists
16116set setpgid d_setpgid
16117eval $inlibc
16118
16119: see if setpgrp2 exists
16120set setpgrp2 d_setpgrp2
16121eval $inlibc
16122
16123: see if setpriority exists
16124set setpriority d_setprior
16125eval $inlibc
16126
16127: see if setproctitle exists
16128set setproctitle d_setproctitle
16129eval $inlibc
16130
10bc17b6
JH
16131: see if setprotoent_r exists
16132set setprotoent_r d_setprotoent_r
16133eval $inlibc
16134case "$d_setprotoent_r" in
16135"$define")
16136 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16137 case "$d_setprotoent_r_proto:$usethreads" in
16138 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16139 set d_setprotoent_r_proto setprotoent_r $hdrs
16140 eval $hasproto ;;
16141 *) ;;
16142 esac
16143 case "$d_setprotoent_r_proto" in
16144 define)
10bc17b6
JH
16145 case "$setprotoent_r_proto" in
16146 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16147 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16148 esac
16149 case "$setprotoent_r_proto" in
16150 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16151 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16152 esac
16153 case "$setprotoent_r_proto" in
90e831dc 16154 ''|0) d_setprotoent_r=undef
10bc17b6 16155 setprotoent_r_proto=0
a48ec845 16156 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16157 * ) case "$setprotoent_r_proto" in
16158 REENTRANT_PROTO*) ;;
16159 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16160 esac
16161 echo "Prototype: $try" ;;
16162 esac
16163 ;;
c18e646a
JH
16164 *) case "$usethreads" in
16165 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16166 esac
90e831dc
SB
16167 d_setprotoent_r=undef
16168 setprotoent_r_proto=0
c18e646a 16169 ;;
a48ec845
JH
16170 esac
16171 ;;
10bc17b6
JH
16172*) setprotoent_r_proto=0
16173 ;;
16174esac
16175
b4eb6b3d
JH
16176: see if setpwent exists
16177set setpwent d_setpwent
16178eval $inlibc
16179
10bc17b6
JH
16180: see if setpwent_r exists
16181set setpwent_r d_setpwent_r
16182eval $inlibc
16183case "$d_setpwent_r" in
16184"$define")
16185 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16186 case "$d_setpwent_r_proto:$usethreads" in
16187 ":define") d_setpwent_r_proto=define
a48ec845
JH
16188 set d_setpwent_r_proto setpwent_r $hdrs
16189 eval $hasproto ;;
16190 *) ;;
16191 esac
16192 case "$d_setpwent_r_proto" in
16193 define)
10bc17b6
JH
16194 case "$setpwent_r_proto" in
16195 ''|0) try='int setpwent_r(FILE**);'
16196 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16197 esac
16198 case "$setpwent_r_proto" in
16199 ''|0) try='void setpwent_r(FILE**);'
16200 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16201 esac
16202 case "$setpwent_r_proto" in
90e831dc 16203 ''|0) d_setpwent_r=undef
10bc17b6 16204 setpwent_r_proto=0
a48ec845 16205 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16206 * ) case "$setpwent_r_proto" in
16207 REENTRANT_PROTO*) ;;
16208 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16209 esac
16210 echo "Prototype: $try" ;;
16211 esac
16212 ;;
c18e646a
JH
16213 *) case "$usethreads" in
16214 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16215 esac
90e831dc
SB
16216 d_setpwent_r=undef
16217 setpwent_r_proto=0
c18e646a 16218 ;;
a48ec845
JH
16219 esac
16220 ;;
10bc17b6
JH
16221*) setpwent_r_proto=0
16222 ;;
16223esac
16224
b4eb6b3d
JH
16225: see if setregid exists
16226set setregid d_setregid
16227eval $inlibc
16228set setresgid d_setresgid
16229eval $inlibc
16230
16231: see if setreuid exists
16232set setreuid d_setreuid
16233eval $inlibc
16234set setresuid d_setresuid
16235eval $inlibc
16236
16237: see if setrgid exists
16238set setrgid d_setrgid
16239eval $inlibc
16240
16241: see if setruid exists
16242set setruid d_setruid
16243eval $inlibc
16244
16245: see if setservent exists
16246set setservent d_setsent
16247eval $inlibc
16248
10bc17b6
JH
16249: see if setservent_r exists
16250set setservent_r d_setservent_r
16251eval $inlibc
16252case "$d_setservent_r" in
16253"$define")
16254 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16255 case "$d_setservent_r_proto:$usethreads" in
16256 ":define") d_setservent_r_proto=define
a48ec845
JH
16257 set d_setservent_r_proto setservent_r $hdrs
16258 eval $hasproto ;;
16259 *) ;;
16260 esac
16261 case "$d_setservent_r_proto" in
16262 define)
10bc17b6
JH
16263 case "$setservent_r_proto" in
16264 ''|0) try='int setservent_r(int, struct servent_data*);'
16265 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16266 esac
16267 case "$setservent_r_proto" in
16268 ''|0) try='void setservent_r(int, struct servent_data*);'
16269 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16270 esac
16271 case "$setservent_r_proto" in
90e831dc 16272 ''|0) d_setservent_r=undef
10bc17b6 16273 setservent_r_proto=0
a48ec845 16274 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16275 * ) case "$setservent_r_proto" in
16276 REENTRANT_PROTO*) ;;
16277 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16278 esac
16279 echo "Prototype: $try" ;;
16280 esac
16281 ;;
c18e646a
JH
16282 *) case "$usethreads" in
16283 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16284 esac
90e831dc
SB
16285 d_setservent_r=undef
16286 setservent_r_proto=0
c18e646a 16287 ;;
a48ec845
JH
16288 esac
16289 ;;
10bc17b6
JH
16290*) setservent_r_proto=0
16291 ;;
16292esac
16293
b4eb6b3d
JH
16294: see if setsid exists
16295set setsid d_setsid
16296eval $inlibc
16297
16298: see if setvbuf exists
16299set setvbuf d_setvbuf
16300eval $inlibc
16301
16302: see if sfio.h is available
16303set sfio.h i_sfio
16304eval $inhdr
16305
16306
16307: see if sfio library is available
16308case "$i_sfio" in
16309$define)
16310 val=''
16311 set sfreserve val
16312 eval $inlibc
16313 ;;
16314*)
16315 val="$undef"
16316 ;;
16317esac
16318: Ok, but do we want to use it.
16319case "$val" in
16320$define)
16321 case "$usesfio" in
16322 true|$define|[yY]*) dflt='y';;
16323 *) dflt='n';;
16324 esac
16325 echo "$package can use the sfio library, but it is experimental."
16326 case "$useperlio" in
16327 "$undef")
16328 echo "For sfio also the PerlIO abstraction layer is needed."
16329 echo "Earlier you said you wouldn't want that."
16330 ;;
16331 esac
16332 rp="You seem to have sfio available, do you want to try using it?"
16333 . ./myread
16334 case "$ans" in
16335 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16336 useperlio="$define"
16337 val="$define"
16338 ;;
16339 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16340 val="$undef"
b4eb6b3d
JH
16341 ;;
16342 esac
16343 ;;
16344*) case "$usesfio" in
16345 true|$define|[yY]*)
16346 echo "Sorry, cannot find sfio on this machine." >&4
16347 echo "Ignoring your setting of usesfio=$usesfio." >&4
16348 val="$undef"
16349 ;;
16350 esac
16351 ;;
16352esac
16353set d_sfio
16354eval $setvar
16355case "$d_sfio" in
16356$define) usesfio='true';;
16357*) usesfio='false';;
16358esac
3659ebf1
JH
16359case "$d_sfio" in
16360$define) ;;
16361*) : Remove sfio from list of libraries to use
7483f793
JH
16362 case "$libs" in
16363 *-lsfio*)
16364 echo "Removing unneeded -lsfio from library list" >&4
16365 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16366 shift
16367 libs="$*"
16368 echo "libs = $libs" >&4
16369 ;;
16370 esac
3659ebf1
JH
16371;;
16372esac
16373
b4eb6b3d
JH
16374
16375: see if shmctl exists
16376set shmctl d_shmctl
16377eval $inlibc
16378
16379: see if shmget exists
16380set shmget d_shmget
16381eval $inlibc
16382
16383: see if shmat exists
16384set shmat d_shmat
16385eval $inlibc
16386: see what shmat returns
16387case "$d_shmat" in
16388"$define")
16389 $cat >shmat.c <<'END'
16390#include <sys/shm.h>
16391void *shmat();
16392END
16393 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16394 shmattype='void *'
16395 else
16396 shmattype='char *'
16397 fi
16398 echo "and it returns ($shmattype)." >&4
16399 : see if a prototype for shmat is available
16400 xxx=`./findhdr sys/shm.h`
16401 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16402 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16403 val="$define"
16404 else
16405 val="$undef"
16406 fi
16407 $rm -f shmat.[co]
16408 ;;
16409*)
16410 val="$undef"
16411 ;;
16412esac
16413set d_shmatprototype
16414eval $setvar
16415
16416: see if shmdt exists
16417set shmdt d_shmdt
16418eval $inlibc
16419
16420: see how much of the 'shm*(2)' library is present.
16421h_shm=true
16422echo " "
16423case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16424*"$undef"*) h_shm=false;;
16425esac
16426case "$osname" in
16427freebsd)
16428 case "`ipcs 2>&1`" in
16429 "SVID shared memory"*"not configured"*)
16430 echo "Your $osname does not have the shm*(2) configured." >&4
16431 h_shm=false
16432 val="$undef"
16433 set shmctl d_shmctl
16434 evat $setvar
16435 set shmget d_shmget
16436 evat $setvar
16437 set shmat d_shmat
16438 evat $setvar
16439 set shmdt d_shmdt
16440 evat $setvar
16441 ;;
16442 esac
16443 ;;
16444esac
16445: we could also check for sys/ipc.h ...
16446if $h_shm && $test `./findhdr sys/shm.h`; then
16447 echo "You have the full shm*(2) library." >&4
16448 val="$define"
16449else
16450 echo "You don't have the full shm*(2) library." >&4
16451 val="$undef"
16452fi
16453set d_shm
16454eval $setvar
16455
16456echo " "
16457: see if we have sigaction
16458if set sigaction val -f d_sigaction; eval $csym; $val; then
16459 echo 'sigaction() found.' >&4
073b6de5 16460 $cat > try.c <<EOP
b4eb6b3d
JH
16461#include <stdio.h>
16462#include <sys/types.h>
16463#include <signal.h>
073b6de5
JH
16464#$i_stdlib I_STDLIB
16465#ifdef I_STDLIB
16466#include <stdlib.h>
16467#endif
b4eb6b3d
JH
16468int main()
16469{
16470 struct sigaction act, oact;
16471 act.sa_flags = 0;
16472 oact.sa_handler = 0;
16473 /* so that act and oact are used */
16474 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16475}
16476EOP
16477 set try
16478 if eval $compile_ok; then
16479 val="$define"
16480 else
16481 echo "But you don't seem to have a useable struct sigaction." >&4
16482 val="$undef"
16483 fi
16484else
16485 echo 'sigaction NOT found.' >&4
16486 val="$undef"
16487fi
16488set d_sigaction; eval $setvar
16489$rm -f try try$_o try.c
16490
983dbef6
JH
16491: see if sigprocmask exists
16492set sigprocmask d_sigprocmask
16493eval $inlibc
16494
b4eb6b3d
JH
16495: see if sigsetjmp exists
16496echo " "
16497case "$d_sigsetjmp" in
16498'')
c727eafa 16499 $cat >try.c <<EOP
b4eb6b3d 16500#include <setjmp.h>
d1daaddf
JH
16501#$i_stdlib I_STDLIB
16502#ifdef I_STDLIB
16503#include <stdlib.h>
16504#endif
b4eb6b3d
JH
16505sigjmp_buf env;
16506int set = 1;
16507int main()
16508{
16509 if (sigsetjmp(env,1))
16510 exit(set);
16511 set = 0;
16512 siglongjmp(env, 1);
16513 exit(1);
16514}
16515EOP
16516 set try
16517 if eval $compile; then
5440bc8e 16518 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16519 echo "POSIX sigsetjmp found." >&4
16520 val="$define"
16521 else
16522 $cat >&4 <<EOM
16523Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16524I'll ignore them.
16525EOM
16526 val="$undef"
16527 fi
16528 else
16529 echo "sigsetjmp not found." >&4
16530 val="$undef"
16531 fi
16532 ;;
16533*) val="$d_sigsetjmp"
16534 case "$d_sigsetjmp" in
16535 $define) echo "POSIX sigsetjmp found." >&4;;
16536 $undef) echo "sigsetjmp not found." >&4;;
16537 esac
16538 ;;
16539esac
16540set d_sigsetjmp
16541eval $setvar
16542$rm -f try.c try
16543
4f5da3e9
SP
16544: see if snprintf exists
16545set snprintf d_snprintf
16546eval $inlibc
16547
16548: see if vsnprintf exists
16549set vsnprintf d_vsnprintf
16550eval $inlibc
16551
2478f7a0
MB
16552case "$d_snprintf-$d_vsnprintf" in
16553"$define-$define")
16554 $cat <<EOM
16555Checking whether your snprintf() and vsnprintf() work okay...
16556EOM
16557 $cat >try.c <<'EOCP'
16558/* v?snprintf testing logic courtesy of Russ Allbery.
16559 * According to C99:
16560 * - if the buffer is too short it still must be \0-terminated
16561 * - if the buffer is too short the potentially required length
16562 * must be returned and not -1
16563 * - if the buffer is NULL the potentially required length
16564 * must be returned and not -1 or core dump
16565 */
16566#include <stdio.h>
16567#include <stdarg.h>
16568
16569char buf[2];
16570
16571int test (char *format, ...)
16572{
16573 va_list args;
16574 int count;
16575
16576 va_start (args, format);
16577 count = vsnprintf (buf, sizeof buf, format, args);
16578 va_end (args);
16579 return count;
16580}
16581
16582int main ()
16583{
16584 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16585 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16586}
16587EOCP
16588 set try
16589 if eval $compile; then
16590 `$run ./try`
16591 case "$?" in
16592 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16593 *) cat <<EOM >&4
16594Your snprintf() and snprintf() don't seem to be working okay.
16595EOM
16596 d_snprintf="$undef"
16597 d_vsnprintf="$undef"
16598 ;;
16599 esac
16600 else
16601 echo "(I can't seem to compile the test program--assuming they don't)"
16602 d_snprintf="$undef"
16603 d_vsnprintf="$undef"
16604 fi
16605 $rm -f try.* try core core.try.*
16606 ;;
16607esac
16608
49a78c82
JH
16609: see if sockatmark exists
16610set sockatmark d_sockatmark
16611eval $inlibc
16612
2ef53570
JH
16613: see if prototype for sockatmark is available
16614echo " "
16615set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16616eval $hasproto
16617
b4eb6b3d
JH
16618: see if socks5_init exists
16619set socks5_init d_socks5_init
16620eval $inlibc
16621
360321b3
YST
16622: see if sprintf returns the length of the string in the buffer as per ANSI
16623$echo "Checking whether sprintf returns the length of the string..." >&4
16624$cat <<EOP >try.c
16625#include <stdio.h>
16626#$i_stdlib I_STDLIB
16627#ifdef I_STDLIB
16628#include <stdlib.h>
16629#endif
16630#$i_string I_STRING
16631#ifdef I_STRING
16632# include <string.h>
16633#else
16634# include <strings.h>
16635#endif
16636#$i_math I_MATH
16637#ifdef I_MATH
16638#include <math.h>
16639#endif
16640
16641char buffer[256];
16642
16643int check (size_t expect, int test) {
16644 size_t got = strlen(buffer);
16645 if (expect == got)
16646 return 0;
16647
16648 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16649 test, buffer);
16650 exit (test);
16651}
16652
16653int main(int argc, char **argv) {
16654 int test = 0;
16655
16656 check(sprintf(buffer, ""), ++test);
16657 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16658 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16659
16660 return 0;
16661}
16662EOP
16663set try
16664
16665d_sprintf_returns_strlen="$undef"
16666if eval $compile; then
16667 xxx="`$run ./try`"
16668 case "$?" in
16669 0) cat >&4 <<EOM
16670sprintf returns the length of the string (as ANSI says it should)
16671EOM
16672 d_sprintf_returns_strlen="$define"
16673 ;;
16674 *) cat >&4 <<EOM
16675sprintf does not return the length of the string (how old is this system?)
16676EOM
16677 d_sprintf_returns_strlen="$undef"
16678 ;;
16679 esac
16680fi
16681
16682$rm -f try.* try
16683
10bc17b6
JH
16684: see if srand48_r exists
16685set srand48_r d_srand48_r
16686eval $inlibc
16687case "$d_srand48_r" in
16688"$define")
16689 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16690 case "$d_srand48_r_proto:$usethreads" in
16691 ":define") d_srand48_r_proto=define
a48ec845
JH
16692 set d_srand48_r_proto srand48_r $hdrs
16693 eval $hasproto ;;
16694 *) ;;
16695 esac
16696 case "$d_srand48_r_proto" in
16697 define)
10bc17b6
JH
16698 case "$srand48_r_proto" in
16699 ''|0) try='int srand48_r(long, struct drand48_data*);'
16700 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16701 esac
16702 case "$srand48_r_proto" in
90e831dc 16703 ''|0) d_srand48_r=undef
10bc17b6 16704 srand48_r_proto=0
a48ec845 16705 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16706 * ) case "$srand48_r_proto" in
16707 REENTRANT_PROTO*) ;;
16708 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16709 esac
16710 echo "Prototype: $try" ;;
16711 esac
16712 ;;
c18e646a
JH
16713 *) case "$usethreads" in
16714 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16715 esac
90e831dc
SB
16716 d_srand48_r=undef
16717 srand48_r_proto=0
c18e646a 16718 ;;
a48ec845
JH
16719 esac
16720 ;;
10bc17b6
JH
16721*) srand48_r_proto=0
16722 ;;
16723esac
16724
16725: see if srandom_r exists
16726set srandom_r d_srandom_r
16727eval $inlibc
16728case "$d_srandom_r" in
16729"$define")
16730 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16731 case "$d_srandom_r_proto:$usethreads" in
16732 ":define") d_srandom_r_proto=define
a48ec845
JH
16733 set d_srandom_r_proto srandom_r $hdrs
16734 eval $hasproto ;;
16735 *) ;;
16736 esac
16737 case "$d_srandom_r_proto" in
16738 define)
10bc17b6
JH
16739 case "$srandom_r_proto" in
16740 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16741 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16742 esac
16743 case "$srandom_r_proto" in
90e831dc 16744 ''|0) d_srandom_r=undef
10bc17b6 16745 srandom_r_proto=0
a48ec845 16746 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16747 * ) case "$srandom_r_proto" in
16748 REENTRANT_PROTO*) ;;
16749 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16750 esac
16751 echo "Prototype: $try" ;;
16752 esac
16753 ;;
c18e646a
JH
16754 *) case "$usethreads" in
16755 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16756 esac
90e831dc
SB
16757 d_srandom_r=undef
16758 srandom_r_proto=0
c18e646a 16759 ;;
a48ec845
JH
16760 esac
16761 ;;
10bc17b6
JH
16762*) srandom_r_proto=0
16763 ;;
16764esac
16765
eef837ea
JH
16766: see if prototype for setresgid is available
16767echo " "
16768set d_sresgproto setresgid $i_unistd unistd.h
16769eval $hasproto
16770
640374d0
JH
16771: see if prototype for setresuid is available
16772echo " "
16773set d_sresuproto setresuid $i_unistd unistd.h
16774eval $hasproto
16775
b4eb6b3d
JH
16776: see if sys/stat.h is available
16777set sys/stat.h i_sysstat
16778eval $inhdr
16779
16780
16781: see if stat knows about block sizes
16782echo " "
16783echo "Checking to see if your struct stat has st_blocks field..." >&4
16784set d_statblks stat st_blocks $i_sysstat sys/stat.h
16785eval $hasfield
16786
16787
16788: see if this is a sys/vfs.h system
16789set sys/vfs.h i_sysvfs
16790eval $inhdr
16791
16792
16793: see if this is a sys/statfs.h system
16794set sys/statfs.h i_sysstatfs
16795eval $inhdr
16796
16797
16798echo " "
16799echo "Checking to see if your system supports struct statfs..." >&4
16800set 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
16801eval $hasstruct
16802case "$d_statfs_s" in
16803"$define") echo "Yes, it does." ;;
16804*) echo "No, it doesn't." ;;
16805esac
16806
16807
16808
16809: see if struct statfs knows about f_flags
16810case "$d_statfs_s" in
16811define)
16812 echo " "
16813 echo "Checking to see if your struct statfs has f_flags field..." >&4
16814 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
16815 eval $hasfield
16816 ;;
16817*) val="$undef"
16818 set d_statfs_f_flags
16819 eval $setvar
16820 ;;
16821esac
16822case "$d_statfs_f_flags" in
16823"$define") echo "Yes, it does." ;;
16824*) echo "No, it doesn't." ;;
16825esac
16826
b4eb6b3d
JH
16827$cat >&4 <<EOM
16828Checking how to access stdio streams by file descriptor number...
16829EOM
16830case "$stdio_stream_array" in
16831'') $cat >try.c <<EOCP
16832#include <stdio.h>
16833int main() {
16834 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16835 printf("yes\n");
16836}
16837EOCP
16838 for s in _iob __iob __sF
16839 do
16840 set try -DSTDIO_STREAM_ARRAY=$s
16841 if eval $compile; then
5440bc8e 16842 case "`$run ./try`" in
b4eb6b3d
JH
16843 yes) stdio_stream_array=$s; break ;;
16844 esac
16845 fi
16846 done
16847 $rm -f try.* try$exe_ext
16848esac
16849case "$stdio_stream_array" in
16850'') $cat >&4 <<EOM
16851I can't figure out how to access stdio streams by file descriptor number.
16852EOM
16853 d_stdio_stream_array="$undef"
16854 ;;
16855*) $cat >&4 <<EOM
16856You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16857EOM
16858 d_stdio_stream_array="$define"
16859 ;;
16860esac
16861
16862: see if strcoll exists
16863set strcoll d_strcoll
16864eval $inlibc
16865
16866: check for structure copying
16867echo " "
16868echo "Checking to see if your C compiler can copy structs..." >&4
16869$cat >try.c <<'EOCP'
76f47787 16870int main()
b4eb6b3d
JH
16871{
16872 struct blurfl {
16873 int dyick;
16874 } foo, bar;
16875
16876 foo = bar;
16877}
16878EOCP
16879if $cc -c try.c >/dev/null 2>&1 ; then
16880 val="$define"
16881 echo "Yup, it can."
16882else
16883 val="$undef"
16884 echo "Nope, it can't."
16885fi
16886set d_strctcpy
16887eval $setvar
16888$rm -f try.*
16889
16890: see if strerror and/or sys_errlist[] exist
16891echo " "
16892if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16893 if set strerror val -f d_strerror; eval $csym; $val; then
16894 echo 'strerror() found.' >&4
16895 d_strerror="$define"
16896 d_strerrm='strerror(e)'
16897 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16898 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16899 d_syserrlst="$define"
16900 else
16901 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16902 d_syserrlst="$undef"
16903 fi
16904 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16905 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16906 echo 'strerror() found in string header.' >&4
16907 d_strerror="$define"
16908 d_strerrm='strerror(e)'
16909 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16910 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16911 d_syserrlst="$define"
16912 else
16913 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16914 d_syserrlst="$undef"
16915 fi
16916 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16917 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16918 d_strerror="$undef"
16919 d_syserrlst="$define"
16920 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16921 else
16922 echo 'strerror() and sys_errlist[] NOT found.' >&4
16923 d_strerror="$undef"
16924 d_syserrlst="$undef"
16925 d_strerrm='"unknown"'
16926 fi
16927fi
16928
10bc17b6
JH
16929: see if strerror_r exists
16930set strerror_r d_strerror_r
16931eval $inlibc
16932case "$d_strerror_r" in
16933"$define")
16934 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16935 case "$d_strerror_r_proto:$usethreads" in
16936 ":define") d_strerror_r_proto=define
a48ec845
JH
16937 set d_strerror_r_proto strerror_r $hdrs
16938 eval $hasproto ;;
16939 *) ;;
16940 esac
16941 case "$d_strerror_r_proto" in
16942 define)
10bc17b6
JH
16943 case "$strerror_r_proto" in
16944 ''|0) try='int strerror_r(int, char*, size_t);'
16945 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16946 esac
16947 case "$strerror_r_proto" in
16948 ''|0) try='int strerror_r(int, char*, int);'
16949 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16950 esac
16951 case "$strerror_r_proto" in
16952 ''|0) try='char* strerror_r(int, char*, size_t);'
16953 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16954 esac
16955 case "$strerror_r_proto" in
90e831dc 16956 ''|0) d_strerror_r=undef
10bc17b6 16957 strerror_r_proto=0
a48ec845 16958 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16959 * ) case "$strerror_r_proto" in
16960 REENTRANT_PROTO*) ;;
16961 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16962 esac
16963 echo "Prototype: $try" ;;
16964 esac
16965 ;;
c18e646a
JH
16966 *) case "$usethreads" in
16967 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16968 esac
90e831dc
SB
16969 d_strerror_r=undef
16970 strerror_r_proto=0
c18e646a 16971 ;;
a48ec845
JH
16972 esac
16973 ;;
10bc17b6
JH
16974*) strerror_r_proto=0
16975 ;;
16976esac
16977
b3c85772
JH
16978: see if strftime exists
16979set strftime d_strftime
16980eval $inlibc
16981
08c92000
MB
16982: see if strlcat exists
16983set strlcat d_strlcat
16984eval $inlibc
16985
16986: see if strlcpy exists
16987set strlcpy d_strlcpy
16988eval $inlibc
16989
b4eb6b3d
JH
16990: see if strtod exists
16991set strtod d_strtod
16992eval $inlibc
16993
16994: see if strtol exists
16995set strtol d_strtol
16996eval $inlibc
16997
16998: see if strtold exists
16999set strtold d_strtold
17000eval $inlibc
17001
17002: see if strtoll exists
17003set strtoll d_strtoll
17004eval $inlibc
17005
17006case "$d_longlong-$d_strtoll" in
17007"$define-$define")
17008 $cat <<EOM
17009Checking whether your strtoll() works okay...
17010EOM
17011 $cat >try.c <<'EOCP'
17012#include <errno.h>
17013#ifdef __hpux
17014#define strtoll __strtoll
17015#endif
e75931a7
YST
17016#ifdef __EMX__
17017#define strtoll _strtoll
17018#endif
b4eb6b3d
JH
17019#include <stdio.h>
17020extern long long int strtoll(char *s, char **, int);
17021static int bad = 0;
17022int check(char *s, long long ell, int een) {
17023 long long gll;
17024 errno = 0;
17025 gll = strtoll(s, 0, 10);
17026 if (!((gll == ell) && (errno == een)))
17027 bad++;
17028}
17029int main() {
17030 check(" 1", 1LL, 0);
17031 check(" 0", 0LL, 0);
17032 check("-1", -1LL, 0);
17033 check("-9223372036854775808", -9223372036854775808LL, 0);
17034 check("-9223372036854775808", -9223372036854775808LL, 0);
17035 check(" 9223372036854775807", 9223372036854775807LL, 0);
17036 check("-9223372036854775808", -9223372036854775808LL, 0);
17037 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17038 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17039 if (!bad)
17040 printf("ok\n");
17041}
17042EOCP
17043 set try
17044 if eval $compile; then
5440bc8e 17045 yyy=`$run ./try`
e75931a7 17046 case "$yyy" in
b4eb6b3d
JH
17047 ok) echo "Your strtoll() seems to be working okay." ;;
17048 *) cat <<EOM >&4
17049Your strtoll() doesn't seem to be working okay.
17050EOM
17051 d_strtoll="$undef"
17052 ;;
69eadf66 17053 esac
e75931a7
YST
17054 else
17055 echo "(I can't seem to compile the test program--assuming it doesn't)"
17056 d_strtoll="$undef"
b4eb6b3d
JH
17057 fi
17058 ;;
17059esac
17060
28e5dec8
JH
17061: see if strtoq exists
17062set strtoq d_strtoq
17063eval $inlibc
17064
b4eb6b3d
JH
17065: see if strtoul exists
17066set strtoul d_strtoul
17067eval $inlibc
17068
d0e6d399
NC
17069case "$d_strtoul" in
17070"$define")
17071 $cat <<EOM
17072Checking whether your strtoul() works okay...
17073EOM
17074 $cat >try.c <<'EOCP'
17075#include <errno.h>
17076#include <stdio.h>
17077extern unsigned long int strtoul(char *s, char **, int);
17078static int bad = 0;
17079void check(char *s, unsigned long eul, int een) {
17080 unsigned long gul;
17081 errno = 0;
17082 gul = strtoul(s, 0, 10);
17083 if (!((gul == eul) && (errno == een)))
17084 bad++;
17085}
17086int main() {
17087 check(" 1", 1L, 0);
17088 check(" 0", 0L, 0);
17089EOCP
17090 case "$longsize" in
17091 8)
17092 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17093 check("18446744073709551615", 18446744073709551615UL, 0);
17094 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17095#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17096 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17097 check("-18446744073709551614", 2, 0);
17098 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17099 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17100 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17101#endif
d0e6d399
NC
17102EOCP
17103 ;;
17104 4)
17105 $cat >>try.c <<'EOCP'
17106 check("4294967295", 4294967295UL, 0);
17107 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17108#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17109 check("-1", 4294967295UL, 0);
17110 check("-4294967294", 2, 0);
17111 check("-4294967295", 1, 0);
17112 check("-4294967296", 4294967295UL, ERANGE);
17113 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17114#endif
d0e6d399
NC
17115EOCP
17116 ;;
17117 *)
17118: Should we write these tests to be more portable by sprintf-ing
17119: ~0 and then manipulating that char string as input for strtol?
17120 ;;
17121 esac
17122 $cat >>try.c <<'EOCP'
17123 if (!bad)
17124 printf("ok\n");
17125 return 0;
17126}
17127EOCP
17128 set try
17129 if eval $compile; then
5440bc8e 17130 case "`$run ./try`" in
d0e6d399
NC
17131 ok) echo "Your strtoul() seems to be working okay." ;;
17132 *) cat <<EOM >&4
17133Your strtoul() doesn't seem to be working okay.
17134EOM
17135 d_strtoul="$undef"
17136 ;;
17137 esac
17138 fi
17139 ;;
17140esac
17141
b4eb6b3d
JH
17142: see if strtoull exists
17143set strtoull d_strtoull
17144eval $inlibc
17145
17146case "$d_longlong-$d_strtoull" in
17147"$define-$define")
17148 $cat <<EOM
17149Checking whether your strtoull() works okay...
17150EOM
17151 $cat >try.c <<'EOCP'
17152#include <errno.h>
17153#ifdef __hpux
17154#define strtoull __strtoull
17155#endif
17156#include <stdio.h>
17157extern unsigned long long int strtoull(char *s, char **, int);
17158static int bad = 0;
17159int check(char *s, long long eull, int een) {
17160 long long gull;
17161 errno = 0;
17162 gull = strtoull(s, 0, 10);
17163 if (!((gull == eull) && (errno == een)))
17164 bad++;
17165}
17166int main() {
d0e6d399
NC
17167 check(" 1", 1LL, 0);
17168 check(" 0", 0LL, 0);
17169 check("18446744073709551615", 18446744073709551615ULL, 0);
17170 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17171#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17172 check("-1", 18446744073709551615ULL, 0);
17173 check("-18446744073709551614", 2LL, 0);
17174 check("-18446744073709551615", 1LL, 0);
17175 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17176 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17177#endif
b4eb6b3d
JH
17178 if (!bad)
17179 printf("ok\n");
17180}
17181EOCP
17182 set try
17183 if eval $compile; then
5440bc8e 17184 case "`$run ./try`" in
b4eb6b3d
JH
17185 ok) echo "Your strtoull() seems to be working okay." ;;
17186 *) cat <<EOM >&4
17187Your strtoull() doesn't seem to be working okay.
17188EOM
17189 d_strtoull="$undef"
17190 ;;
17191 esac
17192 fi
17193 ;;
17194esac
17195
17196: see if strtouq exists
17197set strtouq d_strtouq
17198eval $inlibc
17199
d0e6d399
NC
17200case "$d_strtouq" in
17201"$define")
17202 $cat <<EOM
17203Checking whether your strtouq() works okay...
17204EOM
17205 $cat >try.c <<'EOCP'
17206#include <errno.h>
17207#include <stdio.h>
17208extern unsigned long long int strtouq(char *s, char **, int);
17209static int bad = 0;
17210void check(char *s, unsigned long long eull, int een) {
17211 unsigned long long gull;
17212 errno = 0;
17213 gull = strtouq(s, 0, 10);
17214 if (!((gull == eull) && (errno == een)))
17215 bad++;
17216}
17217int main() {
17218 check(" 1", 1LL, 0);
17219 check(" 0", 0LL, 0);
17220 check("18446744073709551615", 18446744073709551615ULL, 0);
17221 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17222#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17223 check("-1", 18446744073709551615ULL, 0);
17224 check("-18446744073709551614", 2LL, 0);
17225 check("-18446744073709551615", 1LL, 0);
17226 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17227 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17228#endif
d0e6d399
NC
17229 if (!bad)
17230 printf("ok\n");
17231 return 0;
17232}
17233EOCP
17234 set try
17235 if eval $compile; then
5440bc8e 17236 case "`$run ./try`" in
d0e6d399
NC
17237 ok) echo "Your strtouq() seems to be working okay." ;;
17238 *) cat <<EOM >&4
17239Your strtouq() doesn't seem to be working okay.
17240EOM
17241 d_strtouq="$undef"
17242 ;;
17243 esac
17244 fi
17245 ;;
17246esac
17247
b4eb6b3d
JH
17248: see if strxfrm exists
17249set strxfrm d_strxfrm
17250eval $inlibc
17251
17252: see if symlink exists
17253set symlink d_symlink
17254eval $inlibc
17255
17256: see if syscall exists
17257set syscall d_syscall
17258eval $inlibc
17259
2ef53570
JH
17260: see if prototype for syscall is available
17261echo " "
17262set d_syscallproto syscall $i_unistd unistd.h
17263eval $hasproto
17264
b4eb6b3d
JH
17265: see if sysconf exists
17266set sysconf d_sysconf
17267eval $inlibc
17268
17269: see if system exists
17270set system d_system
17271eval $inlibc
17272
17273: see if tcgetpgrp exists
17274set tcgetpgrp d_tcgetpgrp
17275eval $inlibc
17276
17277: see if tcsetpgrp exists
17278set tcsetpgrp d_tcsetpgrp
17279eval $inlibc
17280
17281: see if prototype for telldir is available
17282echo " "
17283set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17284eval $hasproto
17285
ad493445
MB
17286: see if time exists
17287echo " "
17288if test "X$d_time" = X -o X"$timetype" = X; then
17289 if set time val -f d_time; eval $csym; $val; then
17290 echo 'time() found.' >&4
17291 val="$define"
17292 rp="What is the type returned by time() on this system?"
17293 set time_t timetype long stdio.h sys/types.h
17294 eval $typedef_ask
17295 else
17296 echo 'time() not found, hope that will do.' >&4
17297 val="$undef"
17298 timetype='int';
17299 fi
17300 set d_time
17301 eval $setvar
17302fi
17303
b4eb6b3d
JH
17304: see if this is a sys/times.h system
17305set sys/times.h i_systimes
17306eval $inhdr
17307
17308: see if times exists
17309echo " "
17310if set times val -f d_times; eval $csym; $val; then
17311 echo 'times() found.' >&4
17312 d_times="$define"
17313 inc=''
17314 case "$i_systimes" in
17315 "$define") inc='sys/times.h';;
17316 esac
17317 rp="What is the type returned by times() on this system?"
17318 set clock_t clocktype long stdio.h sys/types.h $inc
17319 eval $typedef_ask
17320else
17321 echo 'times() NOT found, hope that will do.' >&4
17322 d_times="$undef"
17323 clocktype='int'
17324fi
17325
10bc17b6
JH
17326: see if tmpnam_r exists
17327set tmpnam_r d_tmpnam_r
17328eval $inlibc
17329case "$d_tmpnam_r" in
17330"$define")
31ee0cb7 17331 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17332 case "$d_tmpnam_r_proto:$usethreads" in
17333 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17334 set d_tmpnam_r_proto tmpnam_r $hdrs
17335 eval $hasproto ;;
17336 *) ;;
17337 esac
17338 case "$d_tmpnam_r_proto" in
17339 define)
10bc17b6
JH
17340 case "$tmpnam_r_proto" in
17341 ''|0) try='char* tmpnam_r(char*);'
17342 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17343 esac
17344 case "$tmpnam_r_proto" in
90e831dc 17345 ''|0) d_tmpnam_r=undef
10bc17b6 17346 tmpnam_r_proto=0
a48ec845 17347 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17348 * ) case "$tmpnam_r_proto" in
17349 REENTRANT_PROTO*) ;;
17350 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17351 esac
17352 echo "Prototype: $try" ;;
17353 esac
17354 ;;
c18e646a
JH
17355 *) case "$usethreads" in
17356 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17357 esac
90e831dc
SB
17358 d_tmpnam_r=undef
17359 tmpnam_r_proto=0
c18e646a 17360 ;;
a48ec845
JH
17361 esac
17362 ;;
10bc17b6
JH
17363*) tmpnam_r_proto=0
17364 ;;
17365esac
17366
b4eb6b3d
JH
17367: see if truncate exists
17368set truncate d_truncate
17369eval $inlibc
17370
10bc17b6
JH
17371: see if ttyname_r exists
17372set ttyname_r d_ttyname_r
17373eval $inlibc
17374case "$d_ttyname_r" in
17375"$define")
17376 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17377 case "$d_ttyname_r_proto:$usethreads" in
17378 ":define") d_ttyname_r_proto=define
a48ec845
JH
17379 set d_ttyname_r_proto ttyname_r $hdrs
17380 eval $hasproto ;;
17381 *) ;;
17382 esac
17383 case "$d_ttyname_r_proto" in
17384 define)
10bc17b6
JH
17385 case "$ttyname_r_proto" in
17386 ''|0) try='int ttyname_r(int, char*, size_t);'
17387 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17388 esac
17389 case "$ttyname_r_proto" in
17390 ''|0) try='int ttyname_r(int, char*, int);'
17391 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17392 esac
17393 case "$ttyname_r_proto" in
17394 ''|0) try='char* ttyname_r(int, char*, int);'
17395 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17396 esac
17397 case "$ttyname_r_proto" in
90e831dc 17398 ''|0) d_ttyname_r=undef
10bc17b6 17399 ttyname_r_proto=0
a48ec845 17400 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17401 * ) case "$ttyname_r_proto" in
17402 REENTRANT_PROTO*) ;;
17403 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17404 esac
17405 echo "Prototype: $try" ;;
17406 esac
17407 ;;
c18e646a
JH
17408 *) case "$usethreads" in
17409 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17410 esac
90e831dc
SB
17411 d_ttyname_r=undef
17412 ttyname_r_proto=0
c18e646a 17413 ;;
a48ec845
JH
17414 esac
17415 ;;
10bc17b6
JH
17416*) ttyname_r_proto=0
17417 ;;
17418esac
17419
b4eb6b3d
JH
17420: see if tzname[] exists
17421echo " "
17422if set tzname val -a d_tzname; eval $csym; $val; then
17423 val="$define"
17424 echo 'tzname[] found.' >&4
17425else
17426 val="$undef"
17427 echo 'tzname[] NOT found.' >&4
17428fi
17429set d_tzname
17430eval $setvar
17431
4e0554ec
JH
17432case "$osname" in
17433next|rhapsody|darwin) multiarch="$define" ;;
17434esac
17435case "$multiarch" in
17436''|[nN]*) multiarch="$undef" ;;
17437esac
17438
24412007 17439: check for ordering of bytes in a UV
4e0554ec 17440echo " "
5440bc8e 17441case "$usecrosscompile$multiarch" in
4e0554ec
JH
17442*$define*)
17443 $cat <<EOM
17444You seem to be either cross-compiling or doing a multiarchitecture build,
17445skipping the byteorder check.
17446
17447EOM
5440bc8e 17448 byteorder='ffff'
4e0554ec
JH
17449 ;;
17450*)
17451 case "$byteorder" in
17452 '')
17453 $cat <<'EOM'
17454In the following, larger digits indicate more significance. A big-endian
17455machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17456little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17457machines may have weird orders like 3412. A Cray will report 87654321,
17458an Alpha will report 12345678. If the test program works the default is
17459probably right.
17460I'm now running the test program...
17461EOM
24412007 17462 $cat >try.c <<EOCP
4e0554ec 17463#include <stdio.h>
55954f19
JH
17464#$i_stdlib I_STDLIB
17465#ifdef I_STDLIB
17466#include <stdlib.h>
17467#endif
24412007
JH
17468#include <sys/types.h>
17469typedef $uvtype UV;
4e0554ec
JH
17470int main()
17471{
17472 int i;
17473 union {
24412007
JH
17474 UV l;
17475 char c[$uvsize];
4e0554ec
JH
17476 } u;
17477
24412007 17478 if ($uvsize > 4)
b5ded3e5 17479 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17480 else
a4c53327 17481 u.l = (UV)0x04030201;
24412007 17482 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17483 printf("%c", u.c[i]+'0');
17484 printf("\n");
17485 exit(0);
17486}
17487EOCP
17488 xxx_prompt=y
17489 set try
17490 if eval $compile && ./try > /dev/null; then
5440bc8e 17491 dflt=`$run ./try`
4e0554ec
JH
17492 case "$dflt" in
17493 [1-4][1-4][1-4][1-4]|12345678|87654321)
17494 echo "(The test program ran ok.)"
17495 echo "byteorder=$dflt"
17496 xxx_prompt=n
17497 ;;
17498 ????|????????) echo "(The test program ran ok.)" ;;
17499 *) echo "(The test program didn't run right for some reason.)" ;;
17500 esac
17501 else
17502 dflt='4321'
17503 cat <<'EOM'
17504(I can't seem to compile the test program. Guessing big-endian...)
17505EOM
17506 fi
17507 case "$xxx_prompt" in
17508 y)
24412007 17509 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17510 . ./myread
17511 byteorder="$ans"
17512 ;;
17513 *) byteorder=$dflt
17514 ;;
17515 esac
17516 ;;
17517 esac
17518 $rm -f try.c try
17519 ;;
17520esac
17521
17522
17523$cat <<EOM
17524
17525Checking to see whether you can access character data unalignedly...
17526EOM
dc7b0a4f
JH
17527case "$d_u32align" in
17528'') $cat >try.c <<EOCP
4e0554ec 17529#include <stdio.h>
d1daaddf
JH
17530#$i_stdlib I_STDLIB
17531#ifdef I_STDLIB
17532#include <stdlib.h>
17533#endif
4e0554ec 17534#define U32 $u32type
d308175a
JH
17535#define BYTEORDER 0x$byteorder
17536#define U8 $u8type
9958dc3c
JH
17537#include <signal.h>
17538#ifdef SIGBUS
17539$signal_t bletch(s) int s; { exit(4); }
17540#endif
4e0554ec
JH
17541int main() {
17542#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17543 U8 buf[8];
4e0554ec
JH
17544 U32 *up;
17545 int i;
17546
17547 if (sizeof(U32) != 4) {
17548 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17549 exit(1);
17550 }
17551
17552 fflush(stdout);
17553
9958dc3c
JH
17554#ifdef SIGBUS
17555 signal(SIGBUS, bletch);
17556#endif
17557
8906a23e
JH
17558 buf[0] = 0;
17559 buf[1] = 0;
17560 buf[2] = 0;
17561 buf[3] = 1;
7eac3fd6 17562 buf[4] = 0;
8906a23e
JH
17563 buf[5] = 0;
17564 buf[6] = 0;
7eac3fd6 17565 buf[7] = 1;
8906a23e 17566
4e0554ec
JH
17567 for (i = 0; i < 4; i++) {
17568 up = (U32*)(buf + i);
17569 if (! ((*up == 1 << (8*i)) || /* big-endian */
17570 (*up == 1 << (8*(3-i))) /* little-endian */
17571 )
17572 )
17573 {
17574 printf("read failed (%x)\n", *up);
17575 exit(2);
17576 }
17577 }
17578
17579 /* write test */
17580 for (i = 0; i < 4; i++) {
17581 up = (U32*)(buf + i);
17582 *up = 0xBeef;
17583 if (*up != 0xBeef) {
17584 printf("write failed (%x)\n", *up);
17585 exit(3);
17586 }
17587 }
17588
17589 exit(0);
17590#else
17591 printf("1\n");
17592 exit(1);
17593#endif
17594 return 0;
17595}
17596EOCP
17597set try
17598if eval $compile_ok; then
d308175a 17599 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17600 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17601 case "$?" in
17602 0) cat >&4 <<EOM
17603You can access character data pretty unalignedly.
17604EOM
17605 d_u32align="$undef"
17606 ;;
17607 *) cat >&4 <<EOM
17608It seems that you must access character data in an aligned manner.
17609EOM
17610 d_u32align="$define"
17611 ;;
17612 esac
4e0554ec
JH
17613else
17614 rp='Can you access character data at unaligned addresses?'
17615 dflt='n'
17616 . ./myread
17617 case "$ans" in
17618 [yY]*) d_u32align="$undef" ;;
17619 *) d_u32align="$define" ;;
17620 esac
17621fi
e36b5403 17622$rm -f core core.try.* try.core
dc7b0a4f
JH
17623;;
17624esac
4e0554ec
JH
17625
17626: see if ualarm exists
17627set ualarm d_ualarm
17628eval $inlibc
17629
b4eb6b3d
JH
17630: see if umask exists
17631set umask d_umask
17632eval $inlibc
17633
758a5d79
JH
17634: see if unordered exists
17635set unordered d_unordered
17636eval $inlibc
17637
bdf33aa7
SP
17638: see if unsetenv exists
17639set unsetenv d_unsetenv
17640eval $inlibc
17641
4e0554ec
JH
17642: see if usleep exists
17643set usleep d_usleep
17644eval $inlibc
17645
2ef53570
JH
17646: see if prototype for usleep is available
17647echo " "
17648set d_usleepproto usleep $i_unistd unistd.h
17649eval $hasproto
17650
b4eb6b3d
JH
17651: see if ustat exists
17652set ustat d_ustat
17653eval $inlibc
17654
17655: backward compatibility for d_hvfork
17656if test X$d_hvfork != X; then
17657 d_vfork="$d_hvfork"
17658 d_hvfork=''
17659fi
17660: see if there is a vfork
17661val=''
17662set vfork val
17663eval $inlibc
17664
17665: Ok, but do we want to use it. vfork is reportedly unreliable in
17666: perl on Solaris 2.x, and probably elsewhere.
17667case "$val" in
17668$define)
17669 echo " "
17670 case "$usevfork" in
17671 false) dflt='n';;
17672 *) dflt='y';;
17673 esac
17674 cat <<'EOM'
17675
17676Perl can only use a vfork() that doesn't suffer from strict
17677restrictions on calling functions or modifying global data in
17678the child. For example, glibc-2.1 contains such a vfork()
17679that is unsuitable. If your system provides a proper fork()
17680call, chances are that you do NOT want perl to use vfork().
17681
17682EOM
17683 rp="Do you still want to use vfork()?"
17684 . ./myread
17685 case "$ans" in
17686 y|Y) ;;
17687 *)
17688 echo "Ok, we won't use vfork()."
17689 val="$undef"
17690 ;;
17691 esac
17692 ;;
17693esac
17694set d_vfork
17695eval $setvar
17696case "$d_vfork" in
17697$define) usevfork='true';;
17698*) usevfork='false';;
17699esac
17700
b4eb6b3d
JH
17701: see if closedir exists
17702set closedir d_closedir
17703eval $inlibc
17704
17705case "$d_closedir" in
17706"$define")
17707 echo " "
17708 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17709 cat > try.c <<EOM
b4eb6b3d
JH
17710#$i_dirent I_DIRENT /**/
17711#$i_sysdir I_SYS_DIR /**/
17712#$i_sysndir I_SYS_NDIR /**/
17713#$i_systypes I_SYS_TYPES /**/
17714
17715#if defined(I_SYS_TYPES)
17716#include <sys/types.h>
17717#endif
17718#if defined(I_DIRENT)
17719#include <dirent.h>
17720#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17721#include <sys/dir.h>
17722#endif
17723#else
17724#ifdef I_SYS_NDIR
17725#include <sys/ndir.h>
17726#else
17727#ifdef I_SYS_DIR
17728#ifdef hp9000s500
17729#include <ndir.h> /* may be wrong in the future */
17730#else
17731#include <sys/dir.h>
17732#endif
17733#endif
17734#endif
17735#endif
17736int main() { return closedir(opendir(".")); }
17737EOM
5440bc8e 17738 set try
b4eb6b3d 17739 if eval $compile_ok; then
5440bc8e 17740 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17741 echo "Yes, it does."
17742 val="$undef"
17743 else
17744 echo "No, it doesn't."
17745 val="$define"
17746 fi
17747 else
17748 echo "(I can't seem to compile the test program--assuming it doesn't)"
17749 val="$define"
17750 fi
17751 ;;
17752*)
17753 val="$undef";
17754 ;;
17755esac
17756set d_void_closedir
17757eval $setvar
5440bc8e 17758$rm -f try try.*
b4eb6b3d
JH
17759: see if there is a wait4
17760set wait4 d_wait4
17761eval $inlibc
17762
17763: see if waitpid exists
17764set waitpid d_waitpid
17765eval $inlibc
17766
17767: see if wcstombs exists
17768set wcstombs d_wcstombs
17769eval $inlibc
17770
17771: see if wctomb exists
17772set wctomb d_wctomb
17773eval $inlibc
17774
4e0554ec
JH
17775: see if writev exists
17776set writev d_writev
17777eval $inlibc
17778
b4eb6b3d
JH
17779: preserve RCS keywords in files with variable substitution, grrr
17780Date='$Date'
17781Id='$Id'
17782Log='$Log'
17783RCSfile='$RCSfile'
17784Revision='$Revision'
17785
b4eb6b3d
JH
17786: check for alignment requirements
17787echo " "
5440bc8e 17788case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17789*$define*)
17790 $cat <<EOM
17791You seem to be either cross-compiling or doing a multiarchitecture build,
17792skipping the memory alignment check.
17793
17794EOM
17795 case "$alignbytes" in
17796 '') alignbytes=8 ;;
17797 esac
17798 ;;
17799*)
17800 case "$alignbytes" in
17801 '') echo "Checking alignment constraints..." >&4
17802 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17803 $cat >try.c <<'EOCP'
17804typedef long double NV;
17805EOCP
17806 else
17807 $cat >try.c <<'EOCP'
17808typedef double NV;
17809EOCP
17810 fi
17811 $cat >>try.c <<'EOCP'
17812#include <stdio.h>
17813struct foobar {
17814 char foo;
17815 NV bar;
17816} try_algn;
17817int main()
17818{
17819 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17820 return(0);
17821}
17822EOCP
17823 set try
17824 if eval $compile_ok; then
5440bc8e 17825 dflt=`$run ./try`
b4eb6b3d
JH
17826 else
17827 dflt='8'
17828 echo "(I can't seem to compile the test program...)"
17829 fi
17830 ;;
17831 *) dflt="$alignbytes"
17832 ;;
17833 esac
17834 rp="Doubles must be aligned on a how-many-byte boundary?"
17835 . ./myread
17836 alignbytes="$ans"
17837 $rm -f try.c try
17838 ;;
17839esac
17840
17841
17842: set the base revision
17843baserev=5.0
17844
3099fc99 17845: how do we concatenate cpp tokens here?
b4eb6b3d 17846echo " "
3099fc99 17847echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17848$cat >cpp_stuff.c <<'EOCP'
17849#define RCAT(a,b)a/**/b
17850#define ACAT(a,b)a ## b
17851RCAT(Rei,ser)
17852ACAT(Cir,cus)
17853EOCP
17854$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17855if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17856 echo "Oh! Smells like ANSI's been here." >&4
17857 echo "We can catify or stringify, separately or together!"
17858 cpp_stuff=42
17859elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17860 echo "Ah, yes! The good old days!" >&4
17861 echo "However, in the good old days we don't know how to stringify and"
17862 echo "catify at the same time."
17863 cpp_stuff=1
17864else
17865 $cat >&4 <<EOM
3099fc99
CW
17866Hmm, I don't seem to be able to concatenate tokens with your cpp.
17867You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17868EOM
17869 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17870fi
17871$rm -f cpp_stuff.*
17872
17873: see if this is a db.h system
17874set db.h i_db
17875eval $inhdr
17876
17877case "$i_db" in
17878$define)
17879 : Check db version.
17880 echo " "
17881 echo "Checking Berkeley DB version ..." >&4
17882 $cat >try.c <<EOCP
17883#$d_const HASCONST
17884#ifndef HASCONST
17885#define const
17886#endif
17887#include <sys/types.h>
17888#include <stdio.h>
55954f19
JH
17889#$i_stdlib I_STDLIB
17890#ifdef I_STDLIB
17891#include <stdlib.h>
17892#endif
b4eb6b3d 17893#include <db.h>
640374d0 17894int main(int argc, char *argv[])
b4eb6b3d
JH
17895{
17896#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17897 int Major, Minor, Patch ;
17898 unsigned long Version ;
17899 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17900 if (argc == 2) {
17901 printf("%d %d %d %d %d %d\n",
17902 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17903 Major, Minor, Patch);
17904 exit(0);
17905 }
17906 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17907
17908 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17909 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17910 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17911 Major, Minor, Patch) ;
17912
17913 /* check that db.h & libdb are compatible */
17914 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17915 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17916 exit(3);
17917 }
17918
640374d0 17919 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17920
17921 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17922 + DB_VERSION_PATCH ;
17923
17924 /* needs to be >= 2.3.4 */
17925 if (Version < 2003004) {
17926 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17927 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17928 exit(2);
17929 }
17930
17931 exit(0);
17932#else
17933#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17934 if (argc == 2) {
17935 printf("1 0 0\n");
17936 exit(0);
17937 }
17938 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17939 exit(0); /* DB version < 2: the coast is clear. */
17940#else
17941 exit(1); /* <db.h> not Berkeley DB? */
17942#endif
17943#endif
17944}
17945EOCP
17946 set try
5440bc8e 17947 if eval $compile_ok && $run ./try; then
b4eb6b3d 17948 echo 'Looks OK.' >&4
5440bc8e 17949 set `$run ./try 1`
640374d0
JH
17950 db_version_major=$1
17951 db_version_minor=$2
17952 db_version_patch=$3
b4eb6b3d
JH
17953 else
17954 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17955 i_db=$undef
17956 case " $libs " in
17957 *"-ldb "*)
17958 : Remove db from list of libraries to use
17959 echo "Removing unusable -ldb from library list" >&4
17960 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17961 shift
17962 libs="$*"
17963 echo "libs = $libs" >&4
17964 ;;
17965 esac
17966 fi
17967 $rm -f try.*
17968 ;;
17969esac
17970
17971case "$i_db" in
17972define)
17973 : Check the return type needed for hash
17974 echo " "
17975 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17976 $cat >try.c <<EOCP
17977#$d_const HASCONST
17978#ifndef HASCONST
17979#define const
17980#endif
17981#include <sys/types.h>
17982#include <db.h>
17983
17984#ifndef DB_VERSION_MAJOR
17985u_int32_t hash_cb (ptr, size)
17986const void *ptr;
17987size_t size;
17988{
17989}
17990HASHINFO info;
17991int main()
17992{
17993 info.hash = hash_cb;
17994}
17995#endif
17996EOCP
17997 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17998 if $contains warning try.out >>/dev/null 2>&1 ; then
17999 db_hashtype='int'
18000 else
18001 db_hashtype='u_int32_t'
18002 fi
18003 else
18004 : XXX Maybe we should just give up here.
18005 db_hashtype=u_int32_t
18006 $cat try.out >&4
18007 echo "Help: I can't seem to compile the db test program." >&4
18008 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18009 fi
18010 $rm -f try.*
18011 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18012 ;;
18013*) db_hashtype=u_int32_t
18014 ;;
18015esac
18016case "$i_db" in
18017define)
18018 : Check the return type needed for prefix
18019 echo " "
18020 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18021 cat >try.c <<EOCP
18022#$d_const HASCONST
18023#ifndef HASCONST
18024#define const
18025#endif
18026#include <sys/types.h>
18027#include <db.h>
18028
18029#ifndef DB_VERSION_MAJOR
18030size_t prefix_cb (key1, key2)
18031const DBT *key1;
18032const DBT *key2;
18033{
18034}
18035BTREEINFO info;
18036int main()
18037{
18038 info.prefix = prefix_cb;
18039}
18040#endif
18041EOCP
18042 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18043 if $contains warning try.out >>/dev/null 2>&1 ; then
18044 db_prefixtype='int'
18045 else
18046 db_prefixtype='size_t'
18047 fi
18048 else
18049 db_prefixtype='size_t'
18050 : XXX Maybe we should just give up here.
18051 $cat try.out >&4
18052 echo "Help: I can't seem to compile the db test program." >&4
18053 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18054 fi
18055 $rm -f try.*
18056 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18057 ;;
18058*) db_prefixtype='size_t'
18059 ;;
18060esac
18061
b4eb6b3d
JH
18062
18063: How can we generate normalized random numbers ?
18064echo " "
18065echo "Looking for a random number function..." >&4
18066case "$randfunc" in
18067'')
18068 if set drand48 val -f; eval $csym; $val; then
18069 dflt="drand48"
18070 echo "Good, found drand48()." >&4
18071 elif set random val -f; eval $csym; $val; then
18072 dflt="random"
18073 echo "OK, found random()." >&4
18074 else
18075 dflt="rand"
18076 echo "Yick, looks like I have to use rand()." >&4
18077 fi
18078 echo " "
18079 ;;
18080*)
18081 dflt="$randfunc"
18082 ;;
18083esac
18084cont=true
18085
18086case "$ccflags" in
18087*-Dmy_rand=*|*-Dmy_srand=*)
18088 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18089 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18090 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18091 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18092 ;;
18093esac
18094
18095while $test "$cont"; do
18096 rp="Use which function to generate random numbers?"
18097 . ./myread
18098 if $test "$ans" = "$dflt"; then
18099 : null
18100 else
18101 randbits=''
18102 fi
18103 randfunc="$ans"
18104 if set $ans val -f; eval $csym; $val; then
18105 cont=''
18106 else
18107 dflt=y
18108 rp="I cannot find function $ans. Use that name anyway?"
18109 . ./myread
18110 dflt=rand
18111 case "$ans" in
18112 [yY]*) cont='';;
18113 esac
18114 fi
18115 case "$cont" in
18116 '')
18117 case "$randfunc" in
18118 drand48)
18119 drand01="drand48()"
18120 seedfunc="srand48"
18121 randbits=48
18122 randseedtype=long
18123 ;;
18124 rand|random)
18125 case "$randbits" in
18126 '')
18127echo "Checking to see how many bits your $randfunc() function produces..." >&4
18128 $cat >try.c <<EOCP
18129#$i_unistd I_UNISTD
18130#$i_stdlib I_STDLIB
18131#include <stdio.h>
18132#ifdef I_UNISTD
18133# include <unistd.h>
18134#endif
18135#ifdef I_STDLIB
18136# include <stdlib.h>
18137#endif
18138int main()
18139{
18140 register int i;
18141 register unsigned long tmp;
18142 register unsigned long max = 0L;
18143
18144 for (i = 1000; i; i--) {
18145 tmp = (unsigned long) $randfunc();
18146 if (tmp > max) max = tmp;
18147 }
18148 for (i = 0; max; i++)
18149 max /= 2;
18150 printf("%d\n",i);
18151}
18152EOCP
18153 set try
18154 if eval $compile_ok; then
18155 dflt=`try`
18156 else
18157 dflt='?'
18158 echo "(I can't seem to compile the test program...)"
18159 fi
18160 ;;
18161 *)
18162 dflt="$randbits"
18163 ;;
18164 esac
18165 rp="How many bits does your $randfunc() function produce?"
18166 . ./myread
18167 randbits="$ans"
18168 $rm -f try.c try
18169 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18170 seedfunc="s$randfunc"
18171 randseedtype=unsigned
18172 ;;
18173 *)
18174 dflt="31"
18175 rp="How many bits does your $randfunc() function produce?"
18176 . ./myread
18177 randbits="$ans"
18178 seedfunc="s$randfunc"
18179 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18180 if set $seedfunc val -f; eval $csym; $val; then
18181 echo "(Using $seedfunc() to seed random generator)"
18182 else
18183 echo "(Warning: no $seedfunc() to seed random generator)"
18184 seedfunc=rand
18185 fi
18186 randseedtype=unsigned
18187 ;;
18188 esac
18189 ;;
18190 esac
18191done
18192
18193echo " "
18194echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18195$cat >try.c <<'EOM'
b4eb6b3d
JH
18196int main()
18197{
18198 if ('M'==0xd4) return 0;
18199 return 1;
18200}
18201EOM
18202
18203val=$undef
5440bc8e 18204set try
b4eb6b3d 18205if eval $compile_ok; then
5440bc8e 18206 if $run ./try; then
b4eb6b3d
JH
18207 echo "You seem to speak EBCDIC." >&4
18208 val="$define"
18209 else
5440bc8e 18210 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18211 fi
18212else
18213 echo "I'm unable to compile the test program." >&4
18214 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18215fi
5440bc8e 18216$rm -f try try.*
b4eb6b3d
JH
18217set ebcdic
18218eval $setvar
18219
18220echo " "
18221$cat >&4 <<EOM
18222Checking how to flush all pending stdio output...
18223EOM
18224# I only know how to find the first 32 possibly open files on SunOS.
18225# See also hints/sunos_4_1.sh and util.c --AD
18226case "$osname" in
18227sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18228esac
18229$cat >>try.c <<EOCP
18230#include <stdio.h>
55954f19
JH
18231#$i_stdlib I_STDLIB
18232#ifdef I_STDLIB
18233#include <stdlib.h>
18234#endif
b4eb6b3d
JH
18235#$i_unistd I_UNISTD
18236#ifdef I_UNISTD
18237# include <unistd.h>
18238#endif
18239#$d_sysconf HAS_SYSCONF
18240#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18241#ifdef HAS_STDIO_STREAM_ARRAY
18242# define STDIO_STREAM_ARRAY $stdio_stream_array
18243#endif
18244int main() {
5440bc8e
JH
18245 FILE* p;
18246 unlink("try.out");
18247 p = fopen("try.out", "w");
b4eb6b3d
JH
18248#ifdef TRY_FPUTC
18249 fputc('x', p);
18250#else
18251# ifdef TRY_FPRINTF
18252 fprintf(p, "x");
18253# endif
18254#endif
18255#ifdef TRY_FFLUSH_NULL
18256 fflush(NULL);
18257#endif
18258#ifdef TRY_FFLUSH_ALL
18259 {
18260 long open_max = -1;
18261# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18262 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18263# else
18264# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18265 open_max = sysconf(_SC_OPEN_MAX);
18266# else
18267# ifdef FOPEN_MAX
18268 open_max = FOPEN_MAX;
18269# else
18270# ifdef OPEN_MAX
18271 open_max = OPEN_MAX;
18272# else
18273# ifdef _NFILE
18274 open_max = _NFILE;
18275# endif
18276# endif
18277# endif
18278# endif
18279# endif
18280# ifdef HAS_STDIO_STREAM_ARRAY
18281 if (open_max > 0) {
18282 long i;
18283 for (i = 0; i < open_max; i++)
18284 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18285 STDIO_STREAM_ARRAY[i]._file < open_max &&
18286 STDIO_STREAM_ARRAY[i]._flag)
18287 fflush(&STDIO_STREAM_ARRAY[i]);
18288 }
18289 }
18290# endif
18291#endif
18292 _exit(42);
18293}
18294EOCP
18295: first we have to find out how _not_ to flush
5440bc8e 18296$to try.c
b4eb6b3d
JH
18297if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18298 output=''
18299 set try -DTRY_FPUTC
18300 if eval $compile; then
fbe73d74 18301 $run ./try 2>/dev/null
28f5ac64 18302 code="$?"
5440bc8e 18303 $from try.out
28f5ac64 18304 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18305 output=-DTRY_FPUTC
18306 fi
18307 fi
18308 case "$output" in
18309 '')
18310 set try -DTRY_FPRINTF
b4eb6b3d 18311 if eval $compile; then
fbe73d74 18312 $run ./try 2>/dev/null
28f5ac64 18313 code="$?"
5440bc8e 18314 $from try.out
28f5ac64 18315 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18316 output=-DTRY_FPRINTF
18317 fi
18318 fi
18319 ;;
18320 esac
18321fi
18322: check for fflush NULL behaviour
18323case "$fflushNULL" in
18324'') set try -DTRY_FFLUSH_NULL $output
18325 if eval $compile; then
5440bc8e 18326 $run ./try 2>/dev/null
b4eb6b3d 18327 code="$?"
5440bc8e 18328 $from try.out
b4eb6b3d
JH
18329 if $test -s try.out -a "X$code" = X42; then
18330 fflushNULL="`$cat try.out`"
18331 else
18332 if $test "X$code" != X42; then
18333 $cat >&4 <<EOM
18334(If this test failed, don't worry, we'll try another method shortly.)
18335EOM
18336 fi
18337 fi
18338 fi
18339 $rm -f core try.core core.try.*
18340 case "$fflushNULL" in
18341 x) $cat >&4 <<EOM
18342Your fflush(NULL) works okay for output streams.
18343Let's see if it clobbers input pipes...
18344EOM
18345# As of mid-March 2000 all versions of Solaris appear to have a stdio
18346# bug that improperly flushes the input end of pipes. So we avoid the
18347# autoflush on fork/system/exec support for now. :-(
18348$cat >tryp.c <<EOCP
18349#include <stdio.h>
18350int
18351main(int argc, char **argv)
18352{
18353 char buf[1024];
18354 int i;
18355 char *bp = buf;
18356 while (1) {
18357 while ((i = getc(stdin)) != -1
18358 && (*bp++ = i) != '\n'
18359 && bp < &buf[1024])
18360 /* DO NOTHING */ ;
18361 *bp = '\0';
18362 fprintf(stdout, "%s", buf);
18363 fflush(NULL);
18364 if (i == -1)
18365 return 0;
18366 bp = buf;
18367 }
18368}
18369EOCP
18370 fflushNULL="$define"
18371 set tryp
18372 if eval $compile; then
18373 $rm -f tryp.out
5440bc8e 18374 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18375 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18376 $cat >&4 <<EOM
18377fflush(NULL) seems to behave okay with input streams.
18378EOM
18379 fflushNULL="$define"
18380 else
18381 $cat >&4 <<EOM
18382Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18383EOM
18384 fflushNULL="$undef"
18385 fi
18386 fi
18387 $rm -f core tryp.c tryp.core core.tryp.*
18388 ;;
18389 '') $cat >&4 <<EOM
18390Your fflush(NULL) isn't working (contrary to ANSI C).
18391EOM
18392 fflushNULL="$undef"
18393 ;;
18394 *) $cat >&4 <<EOM
18395Cannot figure out whether your fflush(NULL) works or not.
18396I'm assuming it doesn't (contrary to ANSI C).
18397EOM
18398 fflushNULL="$undef"
18399 ;;
18400 esac
18401 ;;
18402$define|true|[yY]*)
18403 fflushNULL="$define"
18404 ;;
18405*)
18406 fflushNULL="$undef"
18407 ;;
18408esac
18409: check explicit looping only if NULL did not work, and if the pipe
18410: bug does not show up on an explicit flush too
18411case "$fflushNULL" in
18412"$undef")
18413 $cat >tryp.c <<EOCP
18414#include <stdio.h>
18415int
18416main(int argc, char **argv)
18417{
18418 char buf[1024];
18419 int i;
18420 char *bp = buf;
18421 while (1) {
18422 while ((i = getc(stdin)) != -1
18423 && (*bp++ = i) != '\n'
18424 && bp < &buf[1024])
18425 /* DO NOTHING */ ;
18426 *bp = '\0';
18427 fprintf(stdout, "%s", buf);
18428 fflush(stdin);
18429 if (i == -1)
18430 return 0;
18431 bp = buf;
18432 }
18433}
18434EOCP
18435 set tryp
18436 if eval $compile; then
18437 $rm -f tryp.out
5440bc8e 18438 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18439 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18440 $cat >&4 <<EOM
18441Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18442EOM
18443 : now check for fflushall behaviour
18444 case "$fflushall" in
18445 '') set try -DTRY_FFLUSH_ALL $output
18446 if eval $compile; then
18447 $cat >&4 <<EOM
18448(Now testing the other method--but note that this also may fail.)
18449EOM
5440bc8e 18450 $run ./try 2>/dev/null
28f5ac64 18451 code=$?
fbe73d74 18452 $from try.out
28f5ac64 18453 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18454 fflushall="`$cat try.out`"
18455 fi
18456 fi
18457 $rm -f core try.core core.try.*
18458 case "$fflushall" in
18459 x) $cat >&4 <<EOM
18460Whew. Flushing explicitly all the stdio streams works.
18461EOM
18462 fflushall="$define"
18463 ;;
18464 '') $cat >&4 <<EOM
18465Sigh. Flushing explicitly all the stdio streams doesn't work.
18466EOM
18467 fflushall="$undef"
18468 ;;
18469 *) $cat >&4 <<EOM
18470Cannot figure out whether flushing stdio streams explicitly works or not.
18471I'm assuming it doesn't.
18472EOM
18473 fflushall="$undef"
18474 ;;
18475 esac
18476 ;;
18477 "$define"|true|[yY]*)
18478 fflushall="$define"
18479 ;;
18480 *)
18481 fflushall="$undef"
18482 ;;
18483 esac
18484 else
18485 $cat >&4 <<EOM
18486All is futile. Even fflush(stdin) clobbers input pipes!
18487EOM
18488 fflushall="$undef"
18489 fi
18490 else
18491 fflushall="$undef"
18492 fi
18493 $rm -f core tryp.c tryp.core core.tryp.*
18494 ;;
18495*) fflushall="$undef"
18496 ;;
18497esac
18498
18499case "$fflushNULL$fflushall" in
18500undefundef)
18501 $cat <<EOM
18502OK, I give up. I cannot figure out how to flush pending stdio output.
18503We won't be flushing handles at all before fork/exec/popen.
18504EOM
18505 ;;
18506esac
18507$rm -f try.* try$exe_ext
18508
18509: Store the full pathname to the ar program for use in the C program
18510: Respect a hint or command line value for full_ar.
18511case "$full_ar" in
18512'') full_ar=$ar ;;
18513esac
18514
18515: Store the full pathname to the sed program for use in the C program
18516full_sed=$sed
18517
18518: see what type gids are declared as in the kernel
18519echo " "
18520echo "Looking for the type for group ids returned by getgid()."
18521set gid_t gidtype xxx stdio.h sys/types.h
18522eval $typedef
18523case "$gidtype" in
18524xxx)
18525 xxx=`./findhdr sys/user.h`
18526 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18527 case $1 in
18528 unsigned) dflt="$1 $2" ;;
18529 *) dflt="$1" ;;
18530 esac
18531 ;;
18532*) dflt="$gidtype";;
18533esac
18534case "$gidtype" in
18535gid_t) echo "gid_t found." ;;
18536*) rp="What is the type for group ids returned by getgid()?"
18537 . ./myread
18538 gidtype="$ans"
18539 ;;
18540esac
18541
18542echo " "
18543case "$gidtype" in
18544*_t) zzz="$gidtype" ;;
18545*) zzz="gid" ;;
18546esac
18547echo "Checking the size of $zzz..." >&4
18548cat > try.c <<EOCP
18549#include <sys/types.h>
18550#include <stdio.h>
d1daaddf
JH
18551#$i_stdlib I_STDLIB
18552#ifdef I_STDLIB
18553#include <stdlib.h>
18554#endif
b4eb6b3d
JH
18555int main() {
18556 printf("%d\n", (int)sizeof($gidtype));
18557 exit(0);
18558}
18559EOCP
18560set try
18561if eval $compile_ok; then
5440bc8e 18562 yyy=`$run ./try`
b4eb6b3d
JH
18563 case "$yyy" in
18564 '') gidsize=4
18565 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18566 ;;
18567 *) gidsize=$yyy
18568 echo "Your $zzz is $gidsize bytes long."
18569 ;;
18570 esac
18571else
18572 gidsize=4
18573 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18574fi
18575
18576
18577echo " "
18578case "$gidtype" in
18579*_t) zzz="$gidtype" ;;
18580*) zzz="gid" ;;
18581esac
18582echo "Checking the sign of $zzz..." >&4
18583cat > try.c <<EOCP
18584#include <sys/types.h>
18585#include <stdio.h>
18586int main() {
18587 $gidtype foo = -1;
18588 if (foo < 0)
18589 printf("-1\n");
18590 else
18591 printf("1\n");
18592}
18593EOCP
18594set try
18595if eval $compile; then
5440bc8e 18596 yyy=`$run ./try`
b4eb6b3d
JH
18597 case "$yyy" in
18598 '') gidsign=1
18599 echo "(I can't execute the test program--guessing unsigned.)" >&4
18600 ;;
18601 *) gidsign=$yyy
18602 case "$gidsign" in
18603 1) echo "Your $zzz is unsigned." ;;
18604 -1) echo "Your $zzz is signed." ;;
18605 esac
18606 ;;
18607 esac
18608else
18609 gidsign=1
18610 echo "(I can't compile the test program--guessing unsigned.)" >&4
18611fi
18612
18613
18614echo " "
18615
18616if $test X"$quadtype" != X; then
18617
18618echo "Checking how to print 64-bit integers..." >&4
18619
18620if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18621 $cat >try.c <<'EOCP'
18622#include <sys/types.h>
18623#include <stdio.h>
18624int main() {
18625 int q = 12345678901;
18626 printf("%ld\n", q);
18627}
18628EOCP
18629 set try
18630 if eval $compile; then
5440bc8e 18631 yyy=`$run ./try`
b4eb6b3d
JH
18632 case "$yyy" in
18633 12345678901)
18634 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18635 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18636 echo "We will use %d."
18637 ;;
18638 esac
18639 fi
18640fi
18641
18642if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18643 $cat >try.c <<'EOCP'
18644#include <sys/types.h>
18645#include <stdio.h>
18646int main() {
18647 long q = 12345678901;
18648 printf("%ld\n", q);
18649}
18650EOCP
18651 set try
18652 if eval $compile; then
5440bc8e 18653 yyy=`$run ./try`
b4eb6b3d
JH
18654 case "$yyy" in
18655 12345678901)
18656 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18657 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18658 echo "We will use %ld."
18659 ;;
18660 esac
18661 fi
18662fi
18663
18664if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18665 $cat >try.c <<'EOCP'
18666#include <sys/types.h>
18667#include <inttypes.h>
18668#include <stdio.h>
18669int main() {
18670 int64_t q = 12345678901;
18671 printf("%" PRId64 "\n", q);
18672}
18673EOCP
18674 set try
18675 if eval $compile; then
5440bc8e 18676 yyy=`$run ./try`
b4eb6b3d
JH
18677 case "$yyy" in
18678 12345678901)
18679 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18680 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18681 echo "We will use the C9X style."
18682 ;;
18683 esac
18684 fi
18685fi
18686
2ef53570
JH
18687if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18688 $cat >try.c <<EOCP
b4eb6b3d
JH
18689#include <sys/types.h>
18690#include <stdio.h>
18691int main() {
2ef53570
JH
18692 $quadtype q = 12345678901;
18693 printf("%Ld\n", q);
b4eb6b3d
JH
18694}
18695EOCP
18696 set try
18697 if eval $compile; then
5440bc8e 18698 yyy=`$run ./try`
b4eb6b3d
JH
18699 case "$yyy" in
18700 12345678901)
2ef53570
JH
18701 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18702 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18703 echo "We will use %Ld."
b4eb6b3d
JH
18704 ;;
18705 esac
18706 fi
18707fi
18708
2ef53570
JH
18709if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18710 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18711#include <sys/types.h>
18712#include <stdio.h>
18713int main() {
2ef53570
JH
18714 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18715 printf("%lld\n", q);
b4eb6b3d
JH
18716}
18717EOCP
18718 set try
18719 if eval $compile; then
5440bc8e 18720 yyy=`$run ./try`
b4eb6b3d
JH
18721 case "$yyy" in
18722 12345678901)
2ef53570
JH
18723 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18724 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18725 echo "We will use the %lld style."
b4eb6b3d
JH
18726 ;;
18727 esac
18728 fi
18729fi
18730
18731if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18732 $cat >try.c <<EOCP
18733#include <sys/types.h>
18734#include <stdio.h>
18735int main() {
18736 $quadtype q = 12345678901;
18737 printf("%qd\n", q);
18738}
18739EOCP
18740 set try
18741 if eval $compile; then
5440bc8e 18742 yyy=`$run ./try`
b4eb6b3d
JH
18743 case "$yyy" in
18744 12345678901)
18745 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18746 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18747 echo "We will use %qd."
18748 ;;
18749 esac
18750 fi
18751fi
18752
18753if $test X"$sPRId64" = X; then
18754 echo "Cannot figure out how to print 64-bit integers." >&4
18755fi
18756
18757$rm -f try try.*
18758
18759fi
18760
18761case "$sPRId64" in
18762'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18763 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18764 ;;
18765*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18766 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18767 ;;
18768esac
18769
18770
18771echo " "
18772$echo "Checking the format strings to be used for Perl's internal types..." >&4
18773
18774if $test X"$ivsize" = X8; then
18775 ivdformat="$sPRId64"
18776 uvuformat="$sPRIu64"
18777 uvoformat="$sPRIo64"
18778 uvxformat="$sPRIx64"
18779 uvXUformat="$sPRIXU64"
18780else
18781 if $test X"$ivsize" = X"$longsize"; then
18782 ivdformat='"ld"'
18783 uvuformat='"lu"'
18784 uvoformat='"lo"'
18785 uvxformat='"lx"'
18786 uvXUformat='"lX"'
18787 else
18788 if $test X"$ivsize" = X"$intsize"; then
18789 ivdformat='"d"'
18790 uvuformat='"u"'
18791 uvoformat='"o"'
18792 uvxformat='"x"'
18793 uvXUformat='"X"'
18794 else
18795 : far out
18796 if $test X"$ivsize" = X"$shortsize"; then
18797 ivdformat='"hd"'
18798 uvuformat='"hu"'
18799 uvoformat='"ho"'
18800 uvxformat='"hx"'
18801 uvXUformat='"hX"'
18802 fi
18803 fi
18804 fi
18805fi
18806
18807if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18808 nveformat="$sPRIeldbl"
18809 nvfformat="$sPRIfldbl"
18810 nvgformat="$sPRIgldbl"
18811 nvEUformat="$sPRIEUldbl"
18812 nvFUformat="$sPRIFUldbl"
18813 nvGUformat="$sPRIGUldbl"
18814else
18815 nveformat='"e"'
18816 nvfformat='"f"'
18817 nvgformat='"g"'
18818 nvEUformat='"E"'
18819 nvFUformat='"F"'
18820 nvGUformat='"G"'
18821fi
18822
18823case "$ivdformat" in
3c728e00 18824'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18825 exit 1
18826 ;;
18827esac
18828
18829
18830echo " "
18831$echo "Checking the format string to be used for gids..." >&4
18832
18833case "$gidsign" in
18834-1) if $test X"$gidsize" = X"$ivsize"; then
18835 gidformat="$ivdformat"
18836 else
18837 if $test X"$gidsize" = X"$longsize"; then
18838 gidformat='"ld"'
18839 else
18840 if $test X"$gidsize" = X"$intsize"; then
18841 gidformat='"d"'
18842 else
18843 if $test X"$gidsize" = X"$shortsize"; then
18844 gidformat='"hd"'
18845 fi
18846 fi
18847 fi
18848 fi
18849 ;;
18850*) if $test X"$gidsize" = X"$uvsize"; then
18851 gidformat="$uvuformat"
18852 else
18853 if $test X"$gidsize" = X"$longsize"; then
18854 gidformat='"lu"'
18855 else
18856 if $test X"$gidsize" = X"$intsize"; then
18857 gidformat='"u"'
18858 else
18859 if $test X"$gidsize" = X"$shortsize"; then
18860 gidformat='"hu"'
18861 fi
18862 fi
18863 fi
18864 fi
18865 ;;
18866esac
18867
18868: see if getgroups exists
18869set getgroups d_getgrps
18870eval $inlibc
18871
18872: see if setgroups exists
18873set setgroups d_setgrps
18874eval $inlibc
18875
18876
18877: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18878echo " "
18879case "$d_getgrps$d_setgrps" in
18880*define*)
18881 case "$groupstype" in
18882 '') dflt="$gidtype" ;;
18883 *) dflt="$groupstype" ;;
18884 esac
18885 $cat <<EOM
18886What type of pointer is the second argument to getgroups() and setgroups()?
18887Usually this is the same as group ids, $gidtype, but not always.
18888
18889EOM
18890 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18891 . ./myread
18892 groupstype="$ans"
18893 ;;
18894*) groupstype="$gidtype";;
18895esac
18896
18897echo " "
18898echo "Checking if your $make program sets \$(MAKE)..." >&4
18899case "$make_set_make" in
18900'')
18901 $sed 's/^X //' > testmake.mak << 'EOF'
18902Xall:
18903X @echo 'maketemp="$(MAKE)"'
18904EOF
18905 case "`$make -f testmake.mak 2>/dev/null`" in
18906 *maketemp=*) make_set_make='#' ;;
18907 *) make_set_make="MAKE=$make" ;;
18908 esac
18909 $rm -f testmake.mak
18910 ;;
18911esac
18912case "$make_set_make" in
18913'#') echo "Yup, it does.";;
18914*) echo "Nope, it doesn't.";;
18915esac
18916
18917: see what type is used for mode_t
18918rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18919set mode_t modetype int stdio.h sys/types.h
18920eval $typedef_ask
18921
2cc61e15
DD
18922: see if stdarg is available
18923echo " "
18924if $test `./findhdr stdarg.h`; then
18925 echo "<stdarg.h> found." >&4
18926 valstd="$define"
18927else
18928 echo "<stdarg.h> NOT found." >&4
18929 valstd="$undef"
18930fi
18931
18932: see if varags is available
18933echo " "
18934if $test `./findhdr varargs.h`; then
18935 echo "<varargs.h> found." >&4
18936else
18937 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18938fi
18939
18940: set up the varargs testing programs
18941$cat > varargs.c <<EOP
18942#ifdef I_STDARG
18943#include <stdarg.h>
18944#endif
18945#ifdef I_VARARGS
18946#include <varargs.h>
18947#endif
18948
18949#ifdef I_STDARG
18950int f(char *p, ...)
18951#else
18952int f(va_alist)
18953va_dcl
18954#endif
18955{
18956 va_list ap;
18957#ifndef I_STDARG
18958 char *p;
18959#endif
18960#ifdef I_STDARG
18961 va_start(ap,p);
18962#else
18963 va_start(ap);
18964 p = va_arg(ap, char *);
18965#endif
18966 va_end(ap);
18967}
18968EOP
18969$cat > varargs <<EOP
18970$startsh
18971if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18972 echo "true"
18973else
18974 echo "false"
18975fi
18976$rm -f varargs$_o
18977EOP
18978chmod +x varargs
18979
18980: now check which varargs header should be included
18981echo " "
18982i_varhdr=''
18983case "$valstd" in
18984"$define")
18985 if `./varargs I_STDARG`; then
18986 val='stdarg.h'
18987 elif `./varargs I_VARARGS`; then
18988 val='varargs.h'
18989 fi
18990 ;;
18991*)
18992 if `./varargs I_VARARGS`; then
18993 val='varargs.h'
18994 fi
18995 ;;
18996esac
18997case "$val" in
18998'')
18999echo "I could not find the definition for va_dcl... You have problems..." >&4
19000 val="$undef"; set i_stdarg; eval $setvar
19001 val="$undef"; set i_varargs; eval $setvar
19002 ;;
19003*)
19004 set i_varhdr
19005 eval $setvar
19006 case "$i_varhdr" in
19007 stdarg.h)
19008 val="$define"; set i_stdarg; eval $setvar
19009 val="$undef"; set i_varargs; eval $setvar
19010 ;;
19011 varargs.h)
19012 val="$undef"; set i_stdarg; eval $setvar
19013 val="$define"; set i_varargs; eval $setvar
19014 ;;
19015 esac
19016 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19017esac
19018$rm -f varargs*
19019
19020: see if we need va_copy
19021echo " "
19022case "$i_stdarg" in
19023"$define")
19024 $cat >try.c <<EOCP
19025#include <stdarg.h>
19026#include <stdio.h>
85c8a686
DD
19027#$i_stdlib I_STDLIB
19028#ifdef I_STDLIB
19029#include <stdlib.h>
19030#endif
19031#include <signal.h>
2cc61e15
DD
19032
19033int
19034ivfprintf(FILE *f, const char *fmt, va_list *valp)
19035{
19036 return vfprintf(f, fmt, *valp);
19037}
19038
19039int
19040myvfprintf(FILE *f, const char *fmt, va_list val)
19041{
19042 return ivfprintf(f, fmt, &val);
19043}
19044
19045int
19046myprintf(char *fmt, ...)
19047{
19048 va_list val;
19049 va_start(val, fmt);
19050 return myvfprintf(stdout, fmt, val);
19051}
19052
19053int
19054main(int ac, char **av)
19055{
85c8a686
DD
19056 signal(SIGSEGV, exit);
19057
2cc61e15
DD
19058 myprintf("%s%cs all right, then\n", "that", '\'');
19059 exit(0);
19060}
19061EOCP
19062 set try
5440bc8e
JH
19063 if eval $compile && $run ./try 2>&1 >/dev/null; then
19064 case "`$run ./try`" in
2cc61e15
DD
19065 "that's all right, then")
19066 okay=yes
19067 ;;
19068 esac
19069 fi
19070 case "$okay" in
19071 yes) echo "It seems that you don't need va_copy()." >&4
19072 need_va_copy="$undef"
19073 ;;
19074 *) echo "It seems that va_copy() or similar will be needed." >&4
19075 need_va_copy="$define"
19076 ;;
19077 esac
19078 $rm -f try.* core core.* *.core *.core.*
19079 ;;
19080*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19081 ;;
19082esac
19083
b4eb6b3d
JH
19084: see what type is used for size_t
19085rp="What is the type used for the length parameter for string functions?"
19086set size_t sizetype 'unsigned int' stdio.h sys/types.h
19087eval $typedef_ask
19088
19089: check for type of arguments to gethostbyaddr.
19090if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19091 case "$d_gethbyaddr" in
19092 $define)
19093 $cat <<EOM
19094
19095Checking to see what type of arguments are accepted by gethostbyaddr().
19096EOM
19097 hdrs="$define sys/types.h
19098 $d_socket sys/socket.h
19099 $i_niin netinet/in.h
19100 $i_netdb netdb.h
19101 $i_unistd unistd.h"
19102 : The first arg can 'char *' or 'void *'
19103 : The second arg is some of integral type
19104 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19105 for yyy in size_t long int; do
19106 case "$netdb_host_type" in
19107 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19108 if ./protochk "$try" $hdrs; then
19109 echo "Your system accepts $xxx for the first arg."
19110 echo "...and $yyy for the second arg."
19111 netdb_host_type="$xxx"
19112 netdb_hlen_type="$yyy"
19113 fi
19114 ;;
19115 esac
19116 done
19117 done
19118 : In case none of those worked, prompt the user.
19119 case "$netdb_host_type" in
19120 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19121 dflt='char *'
19122 . ./myread
19123 netdb_host_type=$ans
19124 rp='What is the type for the 2nd argument to gethostbyaddr?'
19125 dflt="$sizetype"
19126 . ./myread
19127 netdb_hlen_type=$ans
19128 ;;
19129 esac
19130 ;;
19131 *) : no gethostbyaddr, so pick harmless defaults
19132 netdb_host_type='char *'
19133 netdb_hlen_type="$sizetype"
19134 ;;
19135 esac
19136 # Remove the "const" if needed. -- but then we'll have a
19137 # prototype clash!
19138 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19139fi
19140
19141: check for type of argument to gethostbyname.
19142if test "X$netdb_name_type" = X ; then
19143 case "$d_gethbyname" in
19144 $define)
19145 $cat <<EOM
19146
19147Checking to see what type of argument is accepted by gethostbyname().
19148EOM
19149 hdrs="$define sys/types.h
19150 $d_socket sys/socket.h
19151 $i_niin netinet/in.h
19152 $i_netdb netdb.h
19153 $i_unistd unistd.h"
19154 for xxx in "const char *" "char *"; do
19155 case "$netdb_name_type" in
19156 '') try="extern struct hostent *gethostbyname($xxx);"
19157 if ./protochk "$try" $hdrs; then
19158 echo "Your system accepts $xxx."
19159 netdb_name_type="$xxx"
19160 fi
19161 ;;
19162 esac
19163 done
19164 : In case none of those worked, prompt the user.
19165 case "$netdb_name_type" in
19166 '') rp='What is the type for the 1st argument to gethostbyname?'
19167 dflt='char *'
19168 . ./myread
19169 netdb_name_type=$ans
19170 ;;
19171 esac
19172 ;;
19173 *) : no gethostbyname, so pick harmless default
19174 netdb_name_type='char *'
19175 ;;
19176 esac
19177fi
19178
19179: check for type of 1st argument to getnetbyaddr.
19180if test "X$netdb_net_type" = X ; then
19181 case "$d_getnbyaddr" in
19182 $define)
19183 $cat <<EOM
19184
19185Checking to see what type of 1st argument is accepted by getnetbyaddr().
19186EOM
19187 hdrs="$define sys/types.h
19188 $d_socket sys/socket.h
19189 $i_niin netinet/in.h
19190 $i_netdb netdb.h
19191 $i_unistd unistd.h"
19192 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19193 case "$netdb_net_type" in
19194 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19195 if ./protochk "$try" $hdrs; then
19196 echo "Your system accepts $xxx."
19197 netdb_net_type="$xxx"
19198 fi
19199 ;;
19200 esac
19201 done
19202 : In case none of those worked, prompt the user.
19203 case "$netdb_net_type" in
19204 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19205 dflt='long'
19206 . ./myread
19207 netdb_net_type=$ans
19208 ;;
19209 esac
19210 ;;
19211 *) : no getnetbyaddr, so pick harmless default
19212 netdb_net_type='long'
19213 ;;
19214 esac
19215fi
19216: locate the preferred pager for this system
d604bb53 19217fn=f/
b4eb6b3d
JH
19218case "$pager" in
19219'')
19220 dflt=''
19221 case "$pg" in
19222 /*) dflt=$pg;;
19223 [a-zA-Z]:/*) dflt=$pg;;
19224 esac
19225 case "$more" in
19226 /*) dflt=$more;;
19227 [a-zA-Z]:/*) dflt=$more;;
19228 esac
19229 case "$less" in
19230 /*) dflt=$less;;
19231 [a-zA-Z]:/*) dflt=$less;;
19232 esac
19233 case "$dflt" in
19234 '') dflt=/usr/ucb/more;;
19235 esac
19236 ;;
d604bb53
JH
19237*) dflt="$pager"
19238 : Instruct ./getfile to trust the hinted or previous pager value,
19239 : even if it does not begin with a slash. For example, on os2,
19240 : pager might be cmd /c more. See comments in UU/getfile.
19241 fn="f/($pager)"
19242 ;;
b4eb6b3d
JH
19243esac
19244echo " "
b4eb6b3d
JH
19245rp='What pager is used on your system?'
19246. ./getfile
19247pager="$ans"
19248
19249: see what type pids are declared as in the kernel
19250rp="What is the type of process ids on this system?"
19251set pid_t pidtype int stdio.h sys/types.h
19252eval $typedef_ask
19253
b4eb6b3d
JH
19254: see if ar generates random libraries by itself
19255echo " "
19256echo "Checking how to generate random libraries on your machine..." >&4
19257echo 'int bar1() { return bar2(); }' > bar1.c
19258echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19259$cat > foo.c <<EOP
19260#$i_stdlib I_STDLIB
19261#ifdef I_STDLIB
19262#include <stdlib.h>
19263#endif
b4eb6b3d
JH
19264int main() { printf("%d\n", bar1()); exit(0); }
19265EOP
19266$cc $ccflags -c bar1.c >/dev/null 2>&1
19267$cc $ccflags -c bar2.c >/dev/null 2>&1
19268$cc $ccflags -c foo.c >/dev/null 2>&1
19269$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19270if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19271 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19272 echo "$ar appears to generate random libraries itself."
19273 orderlib=false
e39a9d84
LC
19274 if [ "X$ranlib" = "X" ]; then
19275 ranlib=":"
19276 fi
88d4d47b
PC
19277elif $ar s bar$_a >/dev/null 2>&1 &&
19278 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19279 $run ./foobar >/dev/null 2>&1; then
19280 echo "a table of contents needs to be added with '$ar s'."
19281 orderlib=false
19282 ranlib="$ar s"
b4eb6b3d 19283elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19284 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19285 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19286 echo "a table of contents needs to be added with '$ar ts'."
19287 orderlib=false
19288 ranlib="$ar ts"
19289else
19290 case "$ranlib" in
19291 :) ranlib='';;
19292 '')
19293 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19294 $test -f $ranlib || ranlib=''
19295 ;;
19296 esac
19297 if $test -n "$ranlib"; then
19298 echo "your system has '$ranlib'; we'll use that."
19299 orderlib=false
19300 else
19301 echo "your system doesn't seem to support random libraries"
19302 echo "so we'll use lorder and tsort to order the libraries."
19303 orderlib=true
19304 ranlib=":"
19305 fi
19306fi
88d4d47b 19307$rm -f foo* bar*
b4eb6b3d
JH
19308
19309: check for type of arguments to select.
19310case "$selecttype" in
19311'') case "$d_select" in
19312 $define)
19313 echo " "
19314 $cat <<EOM
19315Checking to see what type of arguments are accepted by select().
19316EOM
19317 hdrs="$define sys/types.h
19318 $i_systime sys/time.h
19319 $i_sysselct sys/select.h
19320 $d_socket sys/socket.h"
19321 : The first arg can be int, unsigned, or size_t
19322 : The last arg may or may not be 'const'
19323 val=''
19324 : void pointer has been seen but using that
19325 : breaks the selectminbits test
19326 for xxx in 'fd_set *' 'int *'; do
19327 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19328 for tmo in 'struct timeval *' 'const struct timeval *'; do
19329 case "$val" in
19330 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19331 if ./protochk "$try" $hdrs; then
19332 echo "Your system accepts $xxx."
19333 val="$xxx"
19334 fi
19335 ;;
19336 esac
19337 done
19338 done
19339 done
19340 case "$val" in
19341 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19342 case "$d_fd_set" in
19343 $define) dflt="fd_set *" ;;
19344 *) dflt="int *" ;;
19345 esac
19346 . ./myread
19347 val=$ans
19348 ;;
19349 esac
19350 selecttype="$val"
19351 ;;
19352 *) : no select, so pick a harmless default
19353 selecttype='int *'
19354 ;;
19355 esac
19356 ;;
19357esac
19358
19359: check for the select 'width'
19360case "$selectminbits" in
e6e7e605
JH
19361'') safebits=`expr $ptrsize \* 8`
19362 case "$d_select" in
b4eb6b3d
JH
19363 $define)
19364 $cat <<EOM
19365
19366Checking to see on how many bits at a time your select() operates...
19367EOM
19368 $cat >try.c <<EOCP
19369#include <sys/types.h>
19370#$i_time I_TIME
19371#$i_systime I_SYS_TIME
19372#$i_systimek I_SYS_TIME_KERNEL
19373#ifdef I_TIME
19374# include <time.h>
19375#endif
19376#ifdef I_SYS_TIME
19377# ifdef I_SYS_TIME_KERNEL
19378# define KERNEL
19379# endif
19380# include <sys/time.h>
19381# ifdef I_SYS_TIME_KERNEL
19382# undef KERNEL
19383# endif
19384#endif
19385#$i_sysselct I_SYS_SELECT
19386#ifdef I_SYS_SELECT
19387#include <sys/select.h>
19388#endif
19389#$d_socket HAS_SOCKET
19390#ifdef HAS_SOCKET
19391# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19392#endif
19393#include <stdio.h>
d1daaddf
JH
19394#$i_stdlib I_STDLIB
19395#ifdef I_STDLIB
19396#include <stdlib.h>
19397#endif
b4eb6b3d
JH
19398$selecttype b;
19399#define S sizeof(*(b))
19400#define MINBITS 64
19401#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19402#define NBITS (NBYTES * 8)
19403int main() {
e6e7e605 19404 char *s = malloc(NBYTES);
b4eb6b3d
JH
19405 struct timeval t;
19406 int i;
19407 FILE* fp;
19408 int fd;
19409
e6e7e605
JH
19410 if (!s)
19411 exit(1);
b4eb6b3d
JH
19412 fclose(stdin);
19413 fp = fopen("try.c", "r");
19414 if (fp == 0)
e6e7e605 19415 exit(2);
b4eb6b3d
JH
19416 fd = fileno(fp);
19417 if (fd < 0)
e6e7e605 19418 exit(3);
b4eb6b3d
JH
19419 b = ($selecttype)s;
19420 for (i = 0; i < NBITS; i++)
19421 FD_SET(i, b);
19422 t.tv_sec = 0;
19423 t.tv_usec = 0;
19424 select(fd + 1, b, 0, 0, &t);
19425 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19426 free(s);
b4eb6b3d
JH
19427 printf("%d\n", i + 1);
19428 return 0;
19429}
19430EOCP
19431 set try
19432 if eval $compile_ok; then
5440bc8e 19433 selectminbits=`$run ./try`
b4eb6b3d
JH
19434 case "$selectminbits" in
19435 '') cat >&4 <<EOM
19436Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19437I'll play safe and guess it is $safebits bits.
b4eb6b3d 19438EOM
e6e7e605
JH
19439 selectminbits=$safebits
19440 bits="$safebits bits"
b4eb6b3d
JH
19441 ;;
19442 1) bits="1 bit" ;;
19443 *) bits="$selectminbits bits" ;;
19444 esac
19445 echo "Your select() operates on $bits at a time." >&4
19446 else
19447 rp='What is the minimum number of bits your select() operates on?'
19448 case "$byteorder" in
e6e7e605
JH
19449 12345678) dflt=64 ;;
19450 1234) dflt=32 ;;
b4eb6b3d
JH
19451 *) dflt=1 ;;
19452 esac
19453 . ./myread
19454 val=$ans
19455 selectminbits="$val"
19456 fi
19457 $rm -f try.* try
19458 ;;
19459 *) : no select, so pick a harmless default
e6e7e605 19460 selectminbits=$safebits
b4eb6b3d
JH
19461 ;;
19462 esac
19463 ;;
19464esac
19465
19466: Trace out the files included by signal.h, then look for SIGxxx names.
19467: Remove SIGARRAYSIZE used by HPUX.
19468: Remove SIGSTKSIZE used by Linux.
19469: Remove SIGSTKSZ used by Posix.
19470: Remove SIGTYP void lines used by OS2.
19471: Some cpps, like os390, dont give the file name anywhere
19472if [ "X$fieldn" = X ]; then
19473 : Just make some guesses. We check them later.
19474 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19475else
19476 xxx=`echo '#include <signal.h>' |
19477 $cppstdin $cppminus $cppflags 2>/dev/null |
19478 $grep '^[ ]*#.*include' |
a938a3bb 19479 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19480fi
19481: Check this list of files to be sure we have parsed the cpp output ok.
19482: This will also avoid potentially non-existent files, such
19483: as ../foo/bar.h
19484xxxfiles=''
19485for xx in $xxx /dev/null ; do
19486 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19487done
19488: If we have found no files, at least try signal.h
19489case "$xxxfiles" in
19490'') xxxfiles=`./findhdr signal.h` ;;
19491esac
19492xxx=`awk '
19493$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19494 print substr($2, 4, 20)
19495}
19496$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19497 print substr($3, 4, 20)
19498}' $xxxfiles`
19499: Append some common names just in case the awk scan failed.
19500xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19501xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19502xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19503xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19504xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19505
19506: generate a few handy files for later
55954f19 19507$cat > signal.c <<EOCP
b4eb6b3d
JH
19508#include <sys/types.h>
19509#include <signal.h>
55954f19
JH
19510#$i_stdlib I_STDLIB
19511#ifdef I_STDLIB
19512#include <stdlib.h>
19513#endif
b4eb6b3d
JH
19514#include <stdio.h>
19515int main() {
19516
19517/* Strange style to avoid deeply-nested #if/#else/#endif */
19518#ifndef NSIG
19519# ifdef _NSIG
19520# define NSIG (_NSIG)
19521# endif
19522#endif
19523
19524#ifndef NSIG
19525# ifdef SIGMAX
19526# define NSIG (SIGMAX+1)
19527# endif
19528#endif
19529
19530#ifndef NSIG
19531# ifdef SIG_MAX
19532# define NSIG (SIG_MAX+1)
19533# endif
19534#endif
19535
19536#ifndef NSIG
3609ea0d
JH
19537# ifdef _SIG_MAX
19538# define NSIG (_SIG_MAX+1)
19539# endif
19540#endif
19541
19542#ifndef NSIG
b4eb6b3d
JH
19543# ifdef MAXSIG
19544# define NSIG (MAXSIG+1)
19545# endif
19546#endif
19547
19548#ifndef NSIG
19549# ifdef MAX_SIG
19550# define NSIG (MAX_SIG+1)
19551# endif
19552#endif
19553
19554#ifndef NSIG
19555# ifdef SIGARRAYSIZE
3609ea0d 19556# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19557# endif
19558#endif
19559
19560#ifndef NSIG
19561# ifdef _sys_nsig
19562# define NSIG (_sys_nsig) /* Solaris 2.5 */
19563# endif
19564#endif
19565
19566/* Default to some arbitrary number that's big enough to get most
19567 of the common signals.
19568*/
19569#ifndef NSIG
19570# define NSIG 50
19571#endif
19572
19573printf("NSIG %d\n", NSIG);
19574
19575#ifndef JUST_NSIG
19576
19577EOCP
19578
19579echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19580{
19581 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19582 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19583 printf $1; printf ");\n"
19584 printf "#endif\n"
19585}
19586END {
19587 printf "#endif /* JUST_NSIG */\n";
19588 printf "exit(0);\n}\n";
19589}
19590' >>signal.c
19591$cat >signal.awk <<'EOP'
19592BEGIN { ndups = 0 }
65197d93 19593$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19594($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19595 if ($2 > maxsig) { maxsig = $2 }
19596 if (sig_name[$2]) {
19597 dup_name[ndups] = $1
19598 dup_num[ndups] = $2
b4eb6b3d
JH
19599 ndups++
19600 }
1ebe1ffb 19601 else {
65197d93
JH
19602 sig_name[$2] = $1
19603 sig_num[$2] = $2
b4eb6b3d
JH
19604 }
19605}
19606END {
19607 if (nsig == 0) {
19608 nsig = maxsig + 1
19609 }
19610 printf("NSIG %d\n", nsig);
19611 for (n = 1; n < nsig; n++) {
19612 if (sig_name[n]) {
19613 printf("%s %d\n", sig_name[n], sig_num[n])
19614 }
19615 else {
19616 printf("NUM%d %d\n", n, n)
19617 }
19618 }
19619 for (n = 0; n < ndups; n++) {
19620 printf("%s %d\n", dup_name[n], dup_num[n])
19621 }
19622}
19623EOP
19624$cat >signal_cmd <<EOS
19625$startsh
19626if $test -s signal.lst; then
19627 echo "Using your existing signal.lst file"
19628 exit 0
19629fi
19630xxx="$xxx"
19631EOS
19632$cat >>signal_cmd <<'EOS'
19633
19634set signal
19635if eval $compile_ok; then
1eb9ad5b 19636 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19637else
19638 echo "(I can't seem be able to compile the whole test program)" >&4
19639 echo "(I'll try it in little pieces.)" >&4
19640 set signal -DJUST_NSIG
19641 if eval $compile_ok; then
5440bc8e 19642 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19643 $cat signal.nsg
19644 else
19645 echo "I can't seem to figure out how many signals you have." >&4
19646 echo "Guessing 50." >&4
19647 echo 'NSIG 50' > signal.nsg
19648 fi
19649 : Now look at all the signal names, one at a time.
19650 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19651 $cat > signal.c <<EOCP
19652#include <sys/types.h>
19653#include <signal.h>
19654#include <stdio.h>
19655int main() {
19656printf("$xx %d\n", SIG${xx});
19657return 0;
19658}
19659EOCP
19660 set signal
19661 if eval $compile; then
19662 echo "SIG${xx} found."
5440bc8e 19663 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19664 else
19665 echo "SIG${xx} NOT found."
19666 fi
19667 done
19668 if $test -s signal.ls1; then
19669 $cat signal.nsg signal.ls1 |
65197d93 19670 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19671 fi
19672
19673fi
19674if $test -s signal.lst; then
19675 :
19676else
19677 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19678 echo 'kill -l' >signal
19679 set X `csh -f <signal`
19680 $rm -f signal
19681 shift
19682 case $# in
19683 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19684 esac
19685 echo $@ | $tr ' ' $trnl | \
19686 $awk '{ printf "%s %d\n", $1, ++s; }
19687 END { printf "NSIG %d\n", ++s }' >signal.lst
19688fi
19689$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19690EOS
19691chmod a+x signal_cmd
19692$eunicefix signal_cmd
19693
19694: generate list of signal names
19695echo " "
19696case "$sig_name_init" in
19697'') doinit=yes ;;
19698*) case "$sig_num_init" in
19699 ''|*,*) doinit=yes ;;
19700 esac ;;
19701esac
19702case "$doinit" in
19703yes)
19704 echo "Generating a list of signal names and numbers..." >&4
19705 . ./signal_cmd
19706 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19707 sig_name=`$awk 'BEGIN { printf "ZERO " }
19708 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19709 sig_num=`$awk 'BEGIN { printf "0 " }
19710 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19711 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19712 !/^NSIG/ { printf "\"%s\", ", $1 }
19713 END { printf "0\n" }' signal.lst`
19714 sig_num_init=`$awk 'BEGIN { printf "0, " }
19715 !/^NSIG/ { printf "%d, ", $2}
19716 END { printf "0\n"}' signal.lst`
19717 ;;
19718esac
19719echo "The following $sig_count signals are available:"
19720echo " "
19721echo $sig_name | $awk \
19722'BEGIN { linelen = 0 }
19723{
19724 for (i = 1; i <= NF; i++) {
19725 name = "SIG" $i " "
19726 linelen = linelen + length(name)
19727 if (linelen > 70) {
19728 printf "\n"
19729 linelen = length(name)
19730 }
19731 printf "%s", name
19732 }
19733 printf "\n"
19734}'
76d3c696 19735sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19736$rm -f signal signal.c signal.awk signal.lst signal_cmd
19737
19738echo " "
19739case "$sizetype" in
19740*_t) zzz="$sizetype" ;;
19741*) zzz="filesize" ;;
19742esac
19743echo "Checking the size of $zzz..." >&4
19744cat > try.c <<EOCP
19745#include <sys/types.h>
19746#include <stdio.h>
d1daaddf
JH
19747#$i_stdlib I_STDLIB
19748#ifdef I_STDLIB
19749#include <stdlib.h>
19750#endif
b4eb6b3d
JH
19751int main() {
19752 printf("%d\n", (int)sizeof($sizetype));
19753 exit(0);
19754}
19755EOCP
19756set try
19757if eval $compile_ok; then
5440bc8e 19758 yyy=`$run ./try`
b4eb6b3d
JH
19759 case "$yyy" in
19760 '') sizesize=4
19761 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19762 ;;
19763 *) sizesize=$yyy
19764 echo "Your $zzz size is $sizesize bytes."
19765 ;;
19766 esac
19767else
19768 sizesize=4
19769 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19770fi
19771
19772
19773: check for socklen_t
19774echo " "
19775echo "Checking to see if you have socklen_t..." >&4
19776$cat >try.c <<EOCP
19777#include <sys/types.h>
19778#$d_socket HAS_SOCKET
19779#ifdef HAS_SOCKET
19780#include <sys/socket.h>
19781#endif
19782int main() { socklen_t x = 16; }
19783EOCP
19784set try
19785if eval $compile; then
19786 val="$define"
19787 echo "You have socklen_t."
19788else
19789 val="$undef"
19790 echo "You do not have socklen_t."
19791 case "$sizetype" in
19792 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19793 esac
19794fi
19795$rm -f try try.*
19796set d_socklen_t
19797eval $setvar
19798
a7710f8d
JH
19799: see if this is a socks.h system
19800set socks.h i_socks
19801eval $inhdr
19802
b4eb6b3d
JH
19803: check for type of the size argument to socket calls
19804case "$d_socket" in
19805"$define")
19806 $cat <<EOM
19807
19808Checking to see what type is the last argument of accept().
19809EOM
b4eb6b3d
JH
19810 yyy=''
19811 case "$d_socklen_t" in
19812 "$define") yyy="$yyy socklen_t"
19813 esac
19814 yyy="$yyy $sizetype int long unsigned"
19815 for xxx in $yyy; do
19816 case "$socksizetype" in
19817 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19818 case "$usesocks" in
19819 "$define")
19820 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19821 echo "Your system accepts '$xxx *' for the last argument of accept()."
19822 socksizetype="$xxx"
19823 fi
19824 ;;
19825 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19826 echo "Your system accepts '$xxx *' for the last argument of accept()."
19827 socksizetype="$xxx"
19828 fi
19829 ;;
19830 esac
b4eb6b3d
JH
19831 ;;
19832 esac
19833 done
19834: In case none of those worked, prompt the user.
19835 case "$socksizetype" in
19836 '') rp='What is the type for socket address structure sizes?'
19837 dflt='int'
19838 . ./myread
19839 socksizetype=$ans
19840 ;;
19841 esac
19842 ;;
19843*) : no sockets, so pick relatively harmless default
19844 socksizetype='int'
19845 ;;
19846esac
19847
19848: see what type is used for signed size_t
19849set ssize_t ssizetype int stdio.h sys/types.h
19850eval $typedef
19851dflt="$ssizetype"
5440bc8e 19852$cat > try.c <<EOM
b4eb6b3d 19853#include <stdio.h>
d1daaddf
JH
19854#$i_stdlib I_STDLIB
19855#ifdef I_STDLIB
19856#include <stdlib.h>
19857#endif
b4eb6b3d
JH
19858#include <sys/types.h>
19859#define Size_t $sizetype
19860#define SSize_t $dflt
19861int main()
19862{
19863 if (sizeof(Size_t) == sizeof(SSize_t))
19864 printf("$dflt\n");
19865 else if (sizeof(Size_t) == sizeof(int))
19866 printf("int\n");
19867 else
19868 printf("long\n");
19869 exit(0);
19870}
19871EOM
19872echo " "
5440bc8e
JH
19873set try
19874if eval $compile_ok && $run ./try > /dev/null; then
19875 ssizetype=`$run ./try`
b4eb6b3d
JH
19876 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19877else
19878 $cat >&4 <<EOM
19879Help! I can't compile and run the ssize_t test program: please enlighten me!
19880(This is probably a misconfiguration in your system or libraries, and
19881you really ought to fix it. Still, I'll try anyway.)
19882
19883I need a type that is the same size as $sizetype, but is guaranteed to
19884be signed. Common values are ssize_t, int and long.
19885
19886EOM
19887 rp="What signed type is the same size as $sizetype?"
19888 . ./myread
19889 ssizetype="$ans"
19890fi
5440bc8e 19891$rm -f try try.*
b4eb6b3d
JH
19892
19893: see what type of char stdio uses.
19894echo " "
359842a5
JH
19895echo '#include <stdio.h>' > stdio.c
19896$cppstdin $cppminus < stdio.c > stdioh
aa517f50 19897if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19898 echo "Your stdio uses unsigned chars." >&4
19899 stdchar="unsigned char"
19900else
aa517f50
JH
19901 echo "Your stdio uses signed chars." >&4
19902 stdchar="char"
b4eb6b3d 19903fi
359842a5 19904$rm -f stdio.* stdioh
b4eb6b3d 19905
b4eb6b3d
JH
19906: see what type uids are declared as in the kernel
19907echo " "
19908echo "Looking for the type for user ids returned by getuid()."
19909set uid_t uidtype xxx stdio.h sys/types.h
19910eval $typedef
19911case "$uidtype" in
19912xxx)
19913 xxx=`./findhdr sys/user.h`
19914 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19915 case $1 in
19916 unsigned) dflt="$1 $2" ;;
19917 *) dflt="$1" ;;
19918 esac
19919 ;;
19920*) dflt="$uidtype";;
19921esac
19922case "$uidtype" in
19923uid_t) echo "uid_t found." ;;
19924*) rp="What is the type for user ids returned by getuid()?"
19925 . ./myread
19926 uidtype="$ans"
19927 ;;
19928esac
19929
19930echo " "
19931case "$uidtype" in
19932*_t) zzz="$uidtype" ;;
19933*) zzz="uid" ;;
19934esac
19935echo "Checking the size of $zzz..." >&4
19936cat > try.c <<EOCP
19937#include <sys/types.h>
19938#include <stdio.h>
d1daaddf
JH
19939#$i_stdlib I_STDLIB
19940#ifdef I_STDLIB
19941#include <stdlib.h>
19942#endif
b4eb6b3d
JH
19943int main() {
19944 printf("%d\n", (int)sizeof($uidtype));
19945 exit(0);
19946}
19947EOCP
19948set try
19949if eval $compile_ok; then
5440bc8e 19950 yyy=`$run ./try`
b4eb6b3d
JH
19951 case "$yyy" in
19952 '') uidsize=4
19953 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19954 ;;
19955 *) uidsize=$yyy
19956 echo "Your $zzz is $uidsize bytes long."
19957 ;;
19958 esac
19959else
19960 uidsize=4
19961 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19962fi
19963
19964echo " "
19965case "$uidtype" in
19966*_t) zzz="$uidtype" ;;
19967*) zzz="uid" ;;
19968esac
19969echo "Checking the sign of $zzz..." >&4
19970cat > try.c <<EOCP
19971#include <sys/types.h>
19972#include <stdio.h>
19973int main() {
19974 $uidtype foo = -1;
19975 if (foo < 0)
19976 printf("-1\n");
19977 else
19978 printf("1\n");
19979}
19980EOCP
19981set try
19982if eval $compile; then
5440bc8e 19983 yyy=`$run ./try`
b4eb6b3d
JH
19984 case "$yyy" in
19985 '') uidsign=1
19986 echo "(I can't execute the test program--guessing unsigned.)" >&4
19987 ;;
19988 *) uidsign=$yyy
19989 case "$uidsign" in
19990 1) echo "Your $zzz is unsigned." ;;
19991 -1) echo "Your $zzz is signed." ;;
19992 esac
19993 ;;
19994 esac
19995else
19996 uidsign=1
19997 echo "(I can't compile the test program--guessing unsigned.)" >&4
19998fi
19999
20000
20001
20002echo " "
20003$echo "Checking the format string to be used for uids..." >&4
20004
20005case "$uidsign" in
20006-1) if $test X"$uidsize" = X"$ivsize"; then
20007 uidformat="$ivdformat"
20008 else
20009 if $test X"$uidsize" = X"$longsize"; then
20010 uidformat='"ld"'
20011 else
20012 if $test X"$uidsize" = X"$intsize"; then
20013 uidformat='"d"'
20014 else
20015 if $test X"$uidsize" = X"$shortsize"; then
20016 uidformat='"hd"'
20017 fi
20018 fi
20019 fi
20020 fi
20021 ;;
20022*) if $test X"$uidsize" = X"$uvsize"; then
20023 uidformat="$uvuformat"
20024 else
20025 if $test X"$uidsize" = X"$longsize"; then
20026 uidformat='"lu"'
20027 else
20028 if $test X"$uidsize" = X"$intsize"; then
20029 uidformat='"u"'
20030 else
20031 if $test X"$uidsize" = X"$shortsize"; then
20032 uidformat='"hu"'
20033 fi
20034 fi
20035 fi
20036 fi
20037 ;;
20038esac
20039
4afd418c
MB
20040
20041case "$usesitecustomize" in
20042 $define|true|[Yy]*)
20043 usesitecustomize="$define"
20044 ;;
20045 *)
20046 usesitecustomize="$undef"
20047 ;;
20048 esac
20049
3659ebf1
JH
20050: determine compiler compiler
20051case "$yacc" in
20052'')
20053 dflt=yacc;;
20054*)
20055 dflt="$yacc";;
20056esac
20057echo " "
20058comp='yacc'
3c728e00 20059if $test -f "$byacc$_exe"; then
3659ebf1
JH
20060 dflt="$byacc"
20061 comp="byacc or $comp"
20062fi
3c728e00 20063if $test -f "$bison$_exe"; then
3659ebf1
JH
20064 comp="$comp or bison -y"
20065fi
20066rp="Which compiler compiler ($comp) shall I use?"
20067. ./myread
20068yacc="$ans"
20069case "$yacc" in
20070*bis*)
20071 case "$yacc" in
20072 *-y*) ;;
20073 *)
20074 yacc="$yacc -y"
20075 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20076 ;;
20077 esac
20078 ;;
20079esac
20080
758a5d79
JH
20081: see if this is a fp.h system
20082set fp.h i_fp
20083eval $inhdr
20084
20085: see if this is a fp_class.h system
20086set fp_class.h i_fp_class
20087eval $inhdr
20088
b4eb6b3d 20089: see if this is a ieeefp.h system
b5b9f165
JH
20090case "$i_ieeefp" in
20091'' ) set ieeefp.h i_ieeefp
20092 eval $inhdr
20093 ;;
20094esac
b4eb6b3d
JH
20095
20096: see if this is a libutil.h system
20097set libutil.h i_libutil
20098eval $inhdr
20099
b4eb6b3d
JH
20100: see if mach cthreads are available
20101if test "X$usethreads" = "X$define"; then
20102 set mach/cthreads.h i_machcthr
20103 eval $inhdr
20104else
20105 i_machcthr="$undef"
20106fi
20107
20108
20109
b4eb6b3d
JH
20110: see if this is a mntent.h system
20111set mntent.h i_mntent
20112eval $inhdr
20113
20114: see if ndbm.h is available
20115set ndbm.h t_ndbm
20116eval $inhdr
1c6861ad
JS
20117
20118case "$t_ndbm" in
20119$undef)
20120 # Some Linux distributions such as RedHat 7.1 put the
20121 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20122 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20123 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20124 ccflags="$ccflags -I/usr/include/gdbm"
20125 cppflags="$cppflags -I/usr/include/gdbm"
20126 t_ndbm=$define
20127 fi
20128 ;;
20129esac
20130
b4eb6b3d
JH
20131case "$t_ndbm" in
20132$define)
20133 : see if dbm_open exists
20134 set dbm_open d_dbm_open
20135 eval $inlibc
20136 case "$d_dbm_open" in
20137 $undef)
20138 t_ndbm="$undef"
20139 echo "We won't be including <ndbm.h>"
20140 ;;
20141 esac
20142 ;;
20143esac
20144val="$t_ndbm"
20145set i_ndbm
20146eval $setvar
20147
20148: see if net/errno.h is available
20149val=''
20150set net/errno.h val
20151eval $inhdr
20152
20153: Unfortunately, it causes problems on some systems. Arrgh.
20154case "$val" in
20155$define)
20156 cat > try.c <<'EOM'
20157#include <stdio.h>
20158#include <errno.h>
20159#include <net/errno.h>
20160int func()
20161{
20162 return ENOTSOCK;
20163}
20164EOM
20165 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20166 echo "We'll be including <net/errno.h>." >&4
20167 else
20168 echo "We won't be including <net/errno.h>." >&4
20169 val="$undef"
20170 fi
20171 $rm -f try.* try
20172 ;;
20173esac
20174set i_neterrno
20175eval $setvar
20176
20177: see if netinet/tcp.h is available
20178set netinet/tcp.h i_netinettcp
20179eval $inhdr
20180
20181: see if this is a poll.h system
20182set poll.h i_poll
20183eval $inhdr
20184
20185: see if this is a prot.h system
20186set prot.h i_prot
20187eval $inhdr
20188
20189echo " "
20190$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20191$cat <<'EOSH' > Cppsym.know
20192a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20193AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20194alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20195ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20196BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20197BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20198bull c cadmus clipper CMU COFF COMPILER_VERSION
20199concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20200CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20201Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20202FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20203GLIBC GLIBC_MINOR
20204GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20205H3050R H3050RX hbullx20 hcx host_mips
20206hp200 hp300 hp700 HP700 hp800 hp9000
20207hp9000s200 hp9000s300 hp9000s400 hp9000s500
20208hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20209i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20210IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20211INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20212LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20213LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20214Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20215LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20216M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20217M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20218M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20219MATH_HAS_NO_SIDE_EFFECTS
20220mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20221mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20222mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20223MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20224mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20225NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20226news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20227ns32016 ns32332 ns32k nsc32000
20228OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20229pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20230pc532 pdp11 PGC PIC plexus PORTAR posix
20231POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20232POSIX_C_SOURCE POSIX_SOURCE POWER
20233PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20234riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20235SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20236sony sony_news sonyrisc sparc sparclite spectrum
20237stardent stdc STDC_EXT stratos sun sun3 sun386
20238Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20239SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20240SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20241sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20242TM3200 TM5400 TM5600
b4eb6b3d
JH
20243tower tower32 tower32_200 tower32_600 tower32_700
20244tower32_800 tower32_850 tss
20245u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20246ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20247unix UNIX95 UNIX99 unixpc unos
20248USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20249USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20250USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20251USGr4 USGr4_2
44c87379 20252Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20253XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20254XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20255z8000
20256EOSH
20257# Maybe put other stuff here too.
20258cat <<EOSH >>Cppsym.know
20259$osname
20260EOSH
20261./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20262./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20263$cat Cppsym.know > Cppsym.c
381aa1ff 20264$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20265$rm -f Cppsym.a Cppsym.b Cppsym.c
20266cat <<EOSH > Cppsym
20267$startsh
20268if $test \$# -gt 0; then
20269 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20270 if $test -s Cppsym.got; then
20271 $rm -f Cppsym.got
20272 exit 0
20273 fi
20274 $rm -f Cppsym.got
20275 exit 1
20276else
20277 $tr " " "$trnl" | ./Cppsym.try
20278 exit 0
20279fi
20280EOSH
20281chmod +x Cppsym
20282$eunicefix Cppsym
20283cat <<EOSH > Cppsym.try
20284$startsh
20285cat <<'EOCP' > try.c
20286#include <stdio.h>
360321b3
YST
20287#if cpp_stuff == 1
20288#define STRINGIFY(a) "a"
20289#endif
20290#if cpp_stuff == 42
20291#define StGiFy(a) #a
20292#define STRINGIFY(a) StGiFy(a)
20293#endif
20294#if $cpp_stuff != 1 && $cpp_stuff != 42
20295# include "Bletch: How does this C preprocessor stringify macros?"
20296#endif
b4eb6b3d
JH
20297int main() {
20298EOCP
20299$awk \\
20300EOSH
20301cat <<'EOSH' >> Cppsym.try
20302'length($1) > 0 {
360321b3
YST
20303 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20304 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20305 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20306 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20307}' >> try.c
2ef53570 20308echo 'return 0;}' >> try.c
b4eb6b3d
JH
20309EOSH
20310cat <<EOSH >> Cppsym.try
20311ccflags="$ccflags"
20312case "$osname-$gccversion" in
20313irix-) ccflags="\$ccflags -woff 1178" ;;
20314os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20315esac
360321b3 20316$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20317EOSH
20318chmod +x Cppsym.try
20319$eunicefix Cppsym.try
20320./Cppsym < Cppsym.know > Cppsym.true
20321: now check the C compiler for additional symbols
20322postprocess_cc_v=''
20323case "$osname" in
20324aix) postprocess_cc_v="|$tr , ' '" ;;
20325esac
20326$cat >ccsym <<EOS
20327$startsh
20328$cat >tmp.c <<EOF
20329extern int foo;
20330EOF
20331for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20332do
20333 case "\$i" in
20334 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20335 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20336 esac
20337done
20338$rm -f try.c
20339EOS
20340postprocess_cc_v=''
20341chmod +x ccsym
20342$eunicefix ccsym
20343./ccsym > ccsym1.raw
20344if $test -s ccsym1.raw; then
20345 $sort ccsym1.raw | $uniq >ccsym.raw
20346else
20347 mv ccsym1.raw ccsym.raw
20348fi
20349
20350$awk '/\=/ { print $0; next }
20351 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20352$comm -13 Cppsym.true ccsym.list >ccsym.own
20353$comm -12 Cppsym.true ccsym.list >ccsym.com
20354$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20355also=''
20356if $test -z ccsym.raw; then
20357 echo "Your C compiler doesn't seem to define any symbols!" >&4
20358 echo " "
20359 echo "However, your C preprocessor defines the following symbols:"
20360 $cat Cppsym.true
20361 ccsymbols=''
20362 cppsymbols=`$cat Cppsym.true`
20363 cppsymbols=`echo $cppsymbols`
20364 cppccsymbols="$cppsymbols"
20365else
20366 if $test -s ccsym.com; then
20367 echo "Your C compiler and pre-processor define these symbols:"
20368 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20369 also='also '
20370 symbols='ones'
20371 cppccsymbols=`$cat ccsym.com`
20372 cppccsymbols=`echo $cppccsymbols`
20373 $test "$silent" || sleep 1
20374 fi
20375 if $test -s ccsym.cpp; then
20376 $test "$also" && echo " "
20377 echo "Your C pre-processor ${also}defines the following symbols:"
20378 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20379 also='further '
20380 cppsymbols=`$cat ccsym.cpp`
20381 cppsymbols=`echo $cppsymbols`
20382 $test "$silent" || sleep 1
20383 fi
20384 if $test -s ccsym.own; then
20385 $test "$also" && echo " "
20386 echo "Your C compiler ${also}defines the following cpp symbols:"
20387 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20388 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20389 ccsymbols=`$cat ccsym.own`
20390 ccsymbols=`echo $ccsymbols`
20391 $test "$silent" || sleep 1
20392 fi
20393fi
b4eb6b3d
JH
20394
20395: see if this is a termio system
20396val="$undef"
20397val2="$undef"
20398val3="$undef"
20399if $test `./findhdr termios.h`; then
20400 set tcsetattr i_termios
20401 eval $inlibc
20402 val3="$i_termios"
20403fi
20404echo " "
20405case "$val3" in
20406"$define") echo "You have POSIX termios.h... good!" >&4;;
20407*) if ./Cppsym pyr; then
20408 case "`/bin/universe`" in
20409 ucb) if $test `./findhdr sgtty.h`; then
20410 val2="$define"
20411 echo "<sgtty.h> found." >&4
20412 else
20413 echo "System is pyramid with BSD universe."
20414 echo "<sgtty.h> not found--you could have problems." >&4
20415 fi;;
20416 *) if $test `./findhdr termio.h`; then
20417 val="$define"
20418 echo "<termio.h> found." >&4
20419 else
20420 echo "System is pyramid with USG universe."
20421 echo "<termio.h> not found--you could have problems." >&4
20422 fi;;
20423 esac
20424 elif ./usg; then
20425 if $test `./findhdr termio.h`; then
20426 echo "<termio.h> found." >&4
20427 val="$define"
20428 elif $test `./findhdr sgtty.h`; then
20429 echo "<sgtty.h> found." >&4
20430 val2="$define"
20431 else
20432echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20433 fi
20434 else
20435 if $test `./findhdr sgtty.h`; then
20436 echo "<sgtty.h> found." >&4
20437 val2="$define"
20438 elif $test `./findhdr termio.h`; then
20439 echo "<termio.h> found." >&4
20440 val="$define"
20441 else
20442echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20443 fi
20444 fi;;
20445esac
20446set i_termio; eval $setvar
20447val=$val2; set i_sgtty; eval $setvar
20448val=$val3; set i_termios; eval $setvar
20449
b4eb6b3d
JH
20450: see if stddef is available
20451set stddef.h i_stddef
20452eval $inhdr
923fc586 20453
b4eb6b3d
JH
20454: see if this is a sunmath.h system
20455set sunmath.h i_sunmath
20456eval $inhdr
5f80c64f 20457
b4eb6b3d
JH
20458: see if sys/access.h is available
20459set sys/access.h i_sysaccess
20460eval $inhdr
20461
20462: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20463set sys/filio.h i_sysfilio
20464eval $inhdr
20465echo " "
20466if $test `./findhdr sys/ioctl.h`; then
20467 val="$define"
20468 echo '<sys/ioctl.h> found.' >&4
20469else
20470 val="$undef"
20471 if $test $i_sysfilio = "$define"; then
20472 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20473 else
b4eb6b3d
JH
20474 $test $i_sgtty = "$define" && xxx="sgtty.h"
20475 $test $i_termio = "$define" && xxx="termio.h"
20476 $test $i_termios = "$define" && xxx="termios.h"
20477echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20478 fi
20479fi
20480set i_sysioctl
20481eval $setvar
20482
49a78c82
JH
20483: see if socket ioctl defs are in sys/sockio.h
20484echo " "
20485xxx=`./findhdr sys/sockio.h`
20486if $test "$xxx"; then
20487 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20488 val="$define"
20489 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20490 else
20491 val="$undef"
20492 echo "No socket ioctls found in <sys/sockio.h>." >&4
20493 fi
20494else
20495 val="$undef"
20496 $cat <<EOM
20497<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20498EOM
20499fi
20500set i_syssockio
20501eval $setvar
20502
b4eb6b3d
JH
20503
20504: see if this is a syslog.h system
20505set syslog.h i_syslog
20506eval $inhdr
20507
20508
20509: see if this is a sys/mode.h system
20510set sys/mode.h i_sysmode
20511eval $inhdr
20512
20513: see if sys/resource.h has to be included
20514set sys/resource.h i_sysresrc
20515eval $inhdr
20516
20517: see if sys/security.h is available
20518set sys/security.h i_syssecrt
20519eval $inhdr
20520
20521: see if this is a sys/statvfs.h system
20522set sys/statvfs.h i_sysstatvfs
20523eval $inhdr
20524
b4eb6b3d
JH
20525: see if this is a sys/un.h system
20526set sys/un.h i_sysun
20527eval $inhdr
20528
20529
20530: see if this is a sys/utsname.h system
20531set sys/utsname.h i_sysutsname
20532eval $inhdr
20533
20534: see if this is a syswait system
20535set sys/wait.h i_syswait
20536eval $inhdr
20537
20538: see if this is a ustat.h system
20539set ustat.h i_ustat
20540eval $inhdr
20541
20542: see if this is an utime system
20543set utime.h i_utime
20544eval $inhdr
20545
20546: see if this is a values.h system
20547set values.h i_values
20548eval $inhdr
20549
20550: see if this is a vfork system
20551case "$d_vfork" in
20552"$define")
20553 set vfork.h i_vfork
20554 eval $inhdr
20555 ;;
20556*)
20557 i_vfork="$undef"
20558 ;;
20559esac
20560
20561: see if gdbm.h is available
20562set gdbm.h t_gdbm
20563eval $inhdr
20564case "$t_gdbm" in
20565$define)
20566 : see if gdbm_open exists
20567 set gdbm_open d_gdbm_open
20568 eval $inlibc
20569 case "$d_gdbm_open" in
20570 $undef)
20571 t_gdbm="$undef"
20572 echo "We won't be including <gdbm.h>"
5f80c64f 20573 ;;
b4eb6b3d
JH
20574 esac
20575 ;;
20576esac
20577val="$t_gdbm"
20578set i_gdbm
20579eval $setvar
20580
20581echo " "
20582echo "Looking for extensions..." >&4
20583: If we are using the old config.sh, known_extensions may contain
20584: old or inaccurate or duplicate values.
20585known_extensions=''
20586nonxs_extensions=''
20587: We do not use find because it might not be available.
20588: We do not just use MANIFEST because the user may have dropped
20589: some additional extensions into the source tree and expect them
20590: to be built.
20591
20592: Function to recursively find available extensions, ignoring DynaLoader
20593: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20594find_extensions='
20595 for xxx in *; do
20596 case "$xxx" in
20597 DynaLoader|dynaload) ;;
20598 *)
20599 if $test -f $xxx/$xxx.xs; then
20600 known_extensions="$known_extensions $1$xxx";
20601 elif $test -f $xxx/Makefile.PL; then
20602 nonxs_extensions="$nonxs_extensions $1$xxx";
20603 else
20604 if $test -d $xxx -a $# -lt 10; then
20605 set $1$xxx/ $*;
6904989c 20606 cd "$xxx";
b4eb6b3d
JH
20607 eval $find_extensions;
20608 cd ..;
20609 shift;
20610 fi;
20611 fi
20612 ;;
20613 esac;
20614 done'
20615tdir=`pwd`
6904989c 20616cd "$rsrc/ext"
b4eb6b3d
JH
20617set X
20618shift
20619eval $find_extensions
4e1a6d26
AD
20620# Special case: Add in threads/shared since it is not picked up by the
20621# recursive find above (and adding in general recursive finding breaks
20622# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20623known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20624set X $nonxs_extensions
20625shift
20626nonxs_extensions="$*"
20627set X $known_extensions
20628shift
20629known_extensions="$*"
6904989c 20630cd "$tdir"
b4eb6b3d
JH
20631
20632: Now see which are supported on this system.
20633avail_ext=''
20634for xxx in $known_extensions ; do
20635 case "$xxx" in
20636 DB_File|db_file)
20637 case "$i_db" in
20638 $define) avail_ext="$avail_ext $xxx" ;;
20639 esac
20640 ;;
20641 GDBM_File|gdbm_fil)
20642 case "$i_gdbm" in
20643 $define) avail_ext="$avail_ext $xxx" ;;
20644 esac
20645 ;;
1d59c593 20646 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20647 case "$i_langinfo$d_nl_langinfo" in
20648 $define$define) avail_ext="$avail_ext $xxx" ;;
20649 esac
20650 ;;
b4eb6b3d
JH
20651 NDBM_File|ndbm_fil)
20652 case "$i_ndbm" in
20653 $define)
20654 case "$osname-$use64bitint" in
0be9fa5d 20655 hpux-define)
b4eb6b3d
JH
20656 case "$libs" in
20657 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20658 esac
20659 ;;
20660 *) avail_ext="$avail_ext $xxx" ;;
20661 esac
20662 ;;
20663 esac
20664 ;;
20665 ODBM_File|odbm_fil)
20666 case "${i_dbm}${i_rpcsvcdbm}" in
20667 *"${define}"*)
20668 case "$osname-$use64bitint" in
0be9fa5d 20669 hpux-define)
b4eb6b3d
JH
20670 case "$libs" in
20671 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20672 esac
20673 ;;
20674 *) avail_ext="$avail_ext $xxx" ;;
20675 esac
20676 ;;
20677 esac
20678 ;;
20679 POSIX|posix)
20680 case "$useposix" in
20681 true|define|y) avail_ext="$avail_ext $xxx" ;;
20682 esac
20683 ;;
20684 Opcode|opcode)
20685 case "$useopcode" in
20686 true|define|y) avail_ext="$avail_ext $xxx" ;;
20687 esac
20688 ;;
20689 Socket|socket)
20690 case "$d_socket" in
4a9f028c
JH
20691 true|$define|y)
20692 case "$osname" in
20693 beos) ;; # not unless BONE
20694 *) avail_ext="$avail_ext $xxx" ;;
20695 esac
20696 ;;
b4eb6b3d
JH
20697 esac
20698 ;;
20699 Sys/Syslog|sys/syslog)
20700 : XXX syslog requires socket
20701 case "$d_socket" in
20702 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20703 esac
20704 ;;
20705 Thread|thread)
b00ec89b
AB
20706 case "$usethreads" in
20707 true|$define|y)
20708 case "$useithreads" in
20709 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20710 esac
b4eb6b3d
JH
20711 esac
20712 ;;
f9b6ed1c
AD
20713 XS/APItest|xs/apitest)
20714 # This is just for testing. Skip it unless we have dynamic loading.
20715
20716 case "$usedl" in
20717 $define) avail_ext="$avail_ext $xxx" ;;
20718 esac
20719 ;;
20720 XS/Typemap|xs/typemap)
20721 # This is just for testing. Skip it unless we have dynamic loading.
20722 case "$usedl" in
20723 $define) avail_ext="$avail_ext $xxx" ;;
20724 esac
20725 ;;
7deadc5f 20726 threads|threads/shared)
73e09c8f
JH
20727 # threads and threads::shared are special cases.
20728 # To stop people from asking "Perl 5.8.0 was supposed
20729 # to have this new fancy threads implementation but my
20730 # perl doesn't have it" and from people trying to
20731 # (re)install the threads module using CPAN.pm and
20732 # CPAN.pm then offering to reinstall Perl 5.8.0,
20733 # the threads.pm and threads/shared.pm will always be
20734 # there, croaking informatively ("you need to rebuild
20735 # all of Perl with threads, sorry") when threads haven't
20736 # been compiled in.
20737 # --jhi
20738 avail_ext="$avail_ext $xxx"
1dca008a 20739 ;;
b4eb6b3d
JH
20740 IPC/SysV|ipc/sysv)
20741 : XXX Do we need a useipcsysv variable here
20742 case "${d_msg}${d_sem}${d_shm}" in
20743 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20744 esac
20745 ;;
20746 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20747 ;;
20748 esac
b4eb6b3d 20749done
5f80c64f 20750
b4eb6b3d
JH
20751set X $avail_ext
20752shift
20753avail_ext="$*"
5f80c64f 20754
ef0c5be8
JH
20755case "$onlyextensions" in
20756'') ;;
20757*) keepextensions=''
20758 echo "You have requested that only certains extensions be included..." >&4
20759 for i in $onlyextensions; do
20760 case " $avail_ext " in
20761 *" $i "*)
20762 echo "Keeping extension $i."
20763 keepextensions="$keepextensions $i"
20764 ;;
20765 *) echo "Ignoring extension $i." ;;
20766 esac
20767 done
20768 avail_ext="$keepextensions"
20769 ;;
20770esac
20771
20772case "$noextensions" in
20773'') ;;
20774*) keepextensions=''
20775 echo "You have requested that certain extensions be ignored..." >&4
20776 for i in $avail_ext; do
c3dadc13
AD
20777 case " $noextensions " in
20778 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20779 *) echo "Keeping extension $i.";
20780 keepextensions="$keepextensions $i"
20781 ;;
20782 esac
20783 done
20784 avail_ext="$keepextensions"
20785 ;;
20786esac
20787
b4eb6b3d
JH
20788: Now see which nonxs extensions are supported on this system.
20789: For now assume all are.
20790nonxs_ext=''
20791for xxx in $nonxs_extensions ; do
20792 case "$xxx" in
20793 *) nonxs_ext="$nonxs_ext $xxx"
20794 ;;
20795 esac
20796done
5f80c64f 20797
b4eb6b3d
JH
20798set X $nonxs_ext
20799shift
20800nonxs_ext="$*"
20801
20802case $usedl in
20803$define)
20804 $cat <<EOM
20805A number of extensions are supplied with $package. You may choose to
20806compile these extensions for dynamic loading (the default), compile
20807them into the $package executable (static loading), or not include
20808them at all. Answer "none" to include no extensions.
20809Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20810
20811EOM
b4eb6b3d 20812 case "$dynamic_ext" in
736accd3
YST
20813 '')
20814 : Exclude those listed in static_ext
20815 dflt=''
20816 for xxx in $avail_ext; do
20817 case " $static_ext " in
20818 *" $xxx "*) ;;
20819 *) dflt="$dflt $xxx" ;;
20820 esac
20821 done
20822 set X $dflt
20823 shift
20824 dflt="$*"
20825 ;;
b4eb6b3d
JH
20826 *) dflt="$dynamic_ext"
20827 # Perhaps we are reusing an old out-of-date config.sh.
20828 case "$hint" in
20829 previous)
20830 if test X"$dynamic_ext" != X"$avail_ext"; then
20831 $cat <<EOM
20832NOTICE: Your previous config.sh list may be incorrect.
20833The extensions now available to you are
20834 ${avail_ext}
20835but the default list from your previous config.sh is
20836 ${dynamic_ext}
9c839522 20837
b4eb6b3d
JH
20838EOM
20839 fi
9c839522
PM
20840 ;;
20841 esac
b4eb6b3d
JH
20842 ;;
20843 esac
5f80c64f 20844 case "$dflt" in
b4eb6b3d
JH
20845 '') dflt=none;;
20846 esac
20847 rp="What extensions do you wish to load dynamically?"
20848 . ./myread
20849 case "$ans" in
20850 none) dynamic_ext=' ' ;;
20851 *) dynamic_ext="$ans" ;;
5f80c64f 20852 esac
5f80c64f 20853
b4eb6b3d
JH
20854 case "$static_ext" in
20855 '')
20856 : Exclude those already listed in dynamic linking
20857 dflt=''
20858 for xxx in $avail_ext; do
20859 case " $dynamic_ext " in
20860 *" $xxx "*) ;;
20861 *) dflt="$dflt $xxx" ;;
20862 esac
20863 done
20864 set X $dflt
20865 shift
20866 dflt="$*"
20867 ;;
20868 *) dflt="$static_ext"
20869 ;;
20870 esac
9c839522 20871
b4eb6b3d
JH
20872 case "$dflt" in
20873 '') dflt=none;;
20874 esac
20875 rp="What extensions do you wish to load statically?"
20876 . ./myread
20877 case "$ans" in
20878 none) static_ext=' ' ;;
20879 *) static_ext="$ans" ;;
20880 esac
20881 ;;
20882*)
20883 $cat <<EOM
20884A number of extensions are supplied with $package. Answer "none"
20885to include no extensions.
20886Note that DynaLoader is always built and need not be mentioned here.
9c839522 20887
b4eb6b3d
JH
20888EOM
20889 case "$static_ext" in
20890 '') dflt="$avail_ext" ;;
20891 *) dflt="$static_ext"
20892 # Perhaps we are reusing an old out-of-date config.sh.
20893 case "$hint" in
20894 previous)
20895 if test X"$static_ext" != X"$avail_ext"; then
20896 $cat <<EOM
20897NOTICE: Your previous config.sh list may be incorrect.
20898The extensions now available to you are
20899 ${avail_ext}
20900but the default list from your previous config.sh is
20901 ${static_ext}
5f80c64f
JH
20902
20903EOM
b4eb6b3d
JH
20904 fi
20905 ;;
20906 esac
20907 ;;
20908 esac
20909 : Exclude those that are not xs extensions
20910 case "$dflt" in
20911 '') dflt=none;;
20912 esac
20913 rp="What extensions do you wish to include?"
20914 . ./myread
20915 case "$ans" in
20916 none) static_ext=' ' ;;
20917 *) static_ext="$ans" ;;
20918 esac
20919 ;;
5f80c64f 20920esac
f1f6834f
AD
20921#
20922# Encode is a special case. If we are building Encode as a static
20923# extension, we need to explicitly list its subextensions as well.
20924# For other nested extensions, this is handled automatically by
20925# the appropriate Makefile.PL.
20926case " $static_ext " in
20927 *" Encode "*) # Add the subextensions of Encode
20928 cd "$rsrc/ext"
20929 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20930 static_ext="$static_ext Encode/$xxx"
20931 done
20932 cd "$tdir"
20933 ;;
20934esac
5f80c64f 20935
b4eb6b3d
JH
20936set X $dynamic_ext $static_ext $nonxs_ext
20937shift
20938extensions="$*"
20939
93a2cd18
AD
20940# Sanity check: We require an extension suitable for use with
20941# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20942# should show up as failures in the test suite, but it's helpful to
20943# catch them now.) The 'extensions' list is normally sorted
20944# alphabetically, so we need to accept either
20945# DB_File ... Fcntl ... IO ....
20946# or something like
20947# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
20948case " $extensions" in
20949*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20950*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20951*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
20952*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20953 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20954 ;;
20955esac
20956
9c839522
PM
20957: Remove libraries needed only for extensions
20958: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20959: The exception is SunOS 4.x, which needs them.
20960case "${osname}X${osvers}" in
20961sunos*X4*)
20962 perllibs="$libs"
20963 ;;
20964*) case "$usedl" in
20965 $define|true|[yY]*)
20966 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20967 shift
20968 perllibs="$*"
20969 ;;
20970 *) perllibs="$libs"
20971 ;;
20972 esac
20973 ;;
9c839522 20974esac
5f80c64f
JH
20975
20976: Remove build directory name from cppstdin so it can be used from
20977: either the present location or the final installed location.
20978echo " "
20979: Get out of the UU directory to get correct path name.
20980cd ..
20981case "$cppstdin" in
20982`pwd`/cppstdin)
20983 echo "Stripping down cppstdin path name"
20984 cppstdin=cppstdin
20985 ;;
20986esac
20987cd UU
20988
20989: end of configuration questions
20990echo " "
20991echo "End of configuration questions."
20992echo " "
20993
20994: back to where it started
20995if test -d ../UU; then
20996 cd ..
20997fi
20998
48370efc
JH
20999: configuration may be patched via a 'config.arch' file
21000if $test -f config.arch; then
21001 echo "I see a config.arch file, loading it."
21002 . ./config.arch
21003fi
21004
5f80c64f
JH
21005: configuration may be patched via a 'config.over' file
21006if $test -f config.over; then
21007 echo " "
21008 dflt=y
21009 rp='I see a config.over file. Do you wish to load it?'
21010 . UU/myread
21011 case "$ans" in
21012 n*) echo "OK, I'll ignore it.";;
21013 *) . ./config.over
21014 echo "Configuration override changes have been loaded."
21015 ;;
21016 esac
21017fi
21018
21019: in case they want portability, strip down executable paths
21020case "$d_portable" in
21021"$define")
21022 echo " "
21023 echo "Stripping down executable paths..." >&4
21024 for file in $loclist $trylist; do
534ac15a
JH
21025 eval temp=\$$file
21026 eval $file=`basename $temp`
5f80c64f
JH
21027 done
21028 ;;
21029esac
21030
21031: create config.sh file
21032echo " "
21033echo "Creating config.sh..." >&4
21034$spitshell <<EOT >config.sh
21035$startsh
21036#
21037# This file was produced by running the Configure script. It holds all the
21038# definitions figured out by Configure. Should you modify one of these values,
21039# do not forget to propagate your changes by running "Configure -der". You may
21040# instead choose to run each of the .SH files by yourself, or "Configure -S".
21041#
21042
21043# Package name : $package
21044# Source directory : $src
21045# Configuration time: $cf_time
21046# Configured by : $cf_by
21047# Target system : $myuname
21048
21049Author='$Author'
21050Date='$Date'
21051Header='$Header'
21052Id='$Id'
21053Locker='$Locker'
21054Log='$Log'
21055Mcc='$Mcc'
21056RCSfile='$RCSfile'
21057Revision='$Revision'
21058Source='$Source'
21059State='$State'
21060_a='$_a'
21061_exe='$_exe'
21062_o='$_o'
b4eb6b3d 21063afs='$afs'
a6d26a0d 21064afsroot='$afsroot'
b4eb6b3d
JH
21065alignbytes='$alignbytes'
21066ansi2knr='$ansi2knr'
21067aphostname='$aphostname'
21068api_revision='$api_revision'
21069api_subversion='$api_subversion'
21070api_version='$api_version'
21071api_versionstring='$api_versionstring'
5f80c64f 21072ar='$ar'
b4eb6b3d
JH
21073archlib='$archlib'
21074archlibexp='$archlibexp'
21075archname64='$archname64'
21076archname='$archname'
5f80c64f 21077archobjs='$archobjs'
10bc17b6 21078asctime_r_proto='$asctime_r_proto'
5f80c64f 21079awk='$awk'
b4eb6b3d 21080baserev='$baserev'
5f80c64f 21081bash='$bash'
b4eb6b3d 21082bin='$bin'
b4eb6b3d 21083binexp='$binexp'
5f80c64f
JH
21084bison='$bison'
21085byacc='$byacc'
b4eb6b3d 21086byteorder='$byteorder'
5f80c64f 21087c='$c'
b4eb6b3d 21088castflags='$castflags'
5f80c64f
JH
21089cat='$cat'
21090cc='$cc'
21091cccdlflags='$cccdlflags'
21092ccdlflags='$ccdlflags'
21093ccflags='$ccflags'
b4eb6b3d 21094ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21095ccname='$ccname'
b4eb6b3d 21096ccsymbols='$ccsymbols'
6b356c8e 21097ccversion='$ccversion'
5f80c64f 21098cf_by='$cf_by'
b4eb6b3d 21099cf_email='$cf_email'
5f80c64f 21100cf_time='$cf_time'
b4eb6b3d 21101charsize='$charsize'
5f80c64f
JH
21102chgrp='$chgrp'
21103chmod='$chmod'
21104chown='$chown'
b4eb6b3d 21105clocktype='$clocktype'
5f80c64f
JH
21106comm='$comm'
21107compress='$compress'
21108contains='$contains'
21109cp='$cp'
21110cpio='$cpio'
21111cpp='$cpp'
b4eb6b3d
JH
21112cpp_stuff='$cpp_stuff'
21113cppccsymbols='$cppccsymbols'
5f80c64f
JH
21114cppflags='$cppflags'
21115cpplast='$cpplast'
21116cppminus='$cppminus'
21117cpprun='$cpprun'
21118cppstdin='$cppstdin'
b4eb6b3d 21119cppsymbols='$cppsymbols'
10bc17b6 21120crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21121cryptlib='$cryptlib'
5f80c64f 21122csh='$csh'
10bc17b6
JH
21123ctermid_r_proto='$ctermid_r_proto'
21124ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21125d_Gconvert='$d_Gconvert'
21126d_PRIEUldbl='$d_PRIEUldbl'
21127d_PRIFUldbl='$d_PRIFUldbl'
21128d_PRIGUldbl='$d_PRIGUldbl'
21129d_PRIXU64='$d_PRIXU64'
21130d_PRId64='$d_PRId64'
21131d_PRIeldbl='$d_PRIeldbl'
21132d_PRIfldbl='$d_PRIfldbl'
21133d_PRIgldbl='$d_PRIgldbl'
21134d_PRIi64='$d_PRIi64'
21135d_PRIo64='$d_PRIo64'
21136d_PRIu64='$d_PRIu64'
21137d_PRIx64='$d_PRIx64'
21138d_SCNfldbl='$d_SCNfldbl'
74cac757 21139d__fwalk='$d__fwalk'
b4eb6b3d
JH
21140d_access='$d_access'
21141d_accessx='$d_accessx'
55954f19 21142d_aintl='$d_aintl'
b4eb6b3d
JH
21143d_alarm='$d_alarm'
21144d_archlib='$d_archlib'
10bc17b6 21145d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21146d_atolf='$d_atolf'
21147d_atoll='$d_atoll'
0dbb1585
AL
21148d_attribute_format='$d_attribute_format'
21149d_attribute_malloc='$d_attribute_malloc'
21150d_attribute_nonnull='$d_attribute_nonnull'
21151d_attribute_noreturn='$d_attribute_noreturn'
21152d_attribute_pure='$d_attribute_pure'
21153d_attribute_unused='$d_attribute_unused'
21154d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21155d_bcmp='$d_bcmp'
21156d_bcopy='$d_bcopy'
5f80c64f 21157d_bsd='$d_bsd'
b4eb6b3d
JH
21158d_bsdgetpgrp='$d_bsdgetpgrp'
21159d_bsdsetpgrp='$d_bsdsetpgrp'
21160d_bzero='$d_bzero'
21161d_casti32='$d_casti32'
21162d_castneg='$d_castneg'
21163d_charvspr='$d_charvspr'
21164d_chown='$d_chown'
21165d_chroot='$d_chroot'
21166d_chsize='$d_chsize'
758a5d79 21167d_class='$d_class'
b0a2e8e6 21168d_clearenv='$d_clearenv'
b4eb6b3d 21169d_closedir='$d_closedir'
4e0554ec 21170d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21171d_const='$d_const'
55954f19 21172d_copysignl='$d_copysignl'
b4eb6b3d 21173d_crypt='$d_crypt'
10bc17b6 21174d_crypt_r='$d_crypt_r'
b4eb6b3d 21175d_csh='$d_csh'
10bc17b6
JH
21176d_ctermid_r='$d_ctermid_r'
21177d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21178d_cuserid='$d_cuserid'
21179d_dbl_dig='$d_dbl_dig'
2ef53570 21180d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21181d_difftime='$d_difftime'
ae0e3d3b 21182d_dirfd='$d_dirfd'
b4eb6b3d
JH
21183d_dirnamlen='$d_dirnamlen'
21184d_dlerror='$d_dlerror'
5f80c64f 21185d_dlopen='$d_dlopen'
b4eb6b3d
JH
21186d_dlsymun='$d_dlsymun'
21187d_dosuid='$d_dosuid'
10bc17b6 21188d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21189d_drand48proto='$d_drand48proto'
21190d_dup2='$d_dup2'
21191d_eaccess='$d_eaccess'
21192d_endgrent='$d_endgrent'
10bc17b6 21193d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21194d_endhent='$d_endhent'
10bc17b6 21195d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21196d_endnent='$d_endnent'
10bc17b6 21197d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21198d_endpent='$d_endpent'
10bc17b6 21199d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21200d_endpwent='$d_endpwent'
10bc17b6 21201d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21202d_endsent='$d_endsent'
10bc17b6 21203d_endservent_r='$d_endservent_r'
b4eb6b3d 21204d_eofnblk='$d_eofnblk'
5f80c64f 21205d_eunice='$d_eunice'
15b61c98 21206d_faststdio='$d_faststdio'
b363b713 21207d_fchdir='$d_fchdir'
b4eb6b3d
JH
21208d_fchmod='$d_fchmod'
21209d_fchown='$d_fchown'
21210d_fcntl='$d_fcntl'
9d9004a9 21211d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21212d_fd_macros='$d_fd_macros'
21213d_fd_set='$d_fd_set'
21214d_fds_bits='$d_fds_bits'
21215d_fgetpos='$d_fgetpos'
758a5d79
JH
21216d_finite='$d_finite'
21217d_finitel='$d_finitel'
b4eb6b3d
JH
21218d_flexfnam='$d_flexfnam'
21219d_flock='$d_flock'
2ef53570 21220d_flockproto='$d_flockproto'
b4eb6b3d 21221d_fork='$d_fork'
758a5d79 21222d_fp_class='$d_fp_class'
b4eb6b3d 21223d_fpathconf='$d_fpathconf'
758a5d79
JH
21224d_fpclass='$d_fpclass'
21225d_fpclassify='$d_fpclassify'
21226d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21227d_fpos64_t='$d_fpos64_t'
21228d_frexpl='$d_frexpl'
21229d_fs_data_s='$d_fs_data_s'
21230d_fseeko='$d_fseeko'
21231d_fsetpos='$d_fsetpos'
21232d_fstatfs='$d_fstatfs'
21233d_fstatvfs='$d_fstatvfs'
411ab01c 21234d_fsync='$d_fsync'
b4eb6b3d
JH
21235d_ftello='$d_ftello'
21236d_ftime='$d_ftime'
dc814df1 21237d_futimes='$d_futimes'
b4eb6b3d
JH
21238d_getcwd='$d_getcwd'
21239d_getespwnam='$d_getespwnam'
21240d_getfsstat='$d_getfsstat'
21241d_getgrent='$d_getgrent'
10bc17b6
JH
21242d_getgrent_r='$d_getgrent_r'
21243d_getgrgid_r='$d_getgrgid_r'
21244d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21245d_getgrps='$d_getgrps'
21246d_gethbyaddr='$d_gethbyaddr'
21247d_gethbyname='$d_gethbyname'
21248d_gethent='$d_gethent'
21249d_gethname='$d_gethname'
10bc17b6
JH
21250d_gethostbyaddr_r='$d_gethostbyaddr_r'
21251d_gethostbyname_r='$d_gethostbyname_r'
21252d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21253d_gethostprotos='$d_gethostprotos'
4e0554ec 21254d_getitimer='$d_getitimer'
b4eb6b3d 21255d_getlogin='$d_getlogin'
10bc17b6 21256d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21257d_getmnt='$d_getmnt'
21258d_getmntent='$d_getmntent'
21259d_getnbyaddr='$d_getnbyaddr'
21260d_getnbyname='$d_getnbyname'
21261d_getnent='$d_getnent'
10bc17b6
JH
21262d_getnetbyaddr_r='$d_getnetbyaddr_r'
21263d_getnetbyname_r='$d_getnetbyname_r'
21264d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21265d_getnetprotos='$d_getnetprotos'
0c0643d0 21266d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21267d_getpbyname='$d_getpbyname'
21268d_getpbynumber='$d_getpbynumber'
21269d_getpent='$d_getpent'
21270d_getpgid='$d_getpgid'
21271d_getpgrp2='$d_getpgrp2'
21272d_getpgrp='$d_getpgrp'
21273d_getppid='$d_getppid'
21274d_getprior='$d_getprior'
10bc17b6
JH
21275d_getprotobyname_r='$d_getprotobyname_r'
21276d_getprotobynumber_r='$d_getprotobynumber_r'
21277d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21278d_getprotoprotos='$d_getprotoprotos'
21279d_getprpwnam='$d_getprpwnam'
21280d_getpwent='$d_getpwent'
10bc17b6
JH
21281d_getpwent_r='$d_getpwent_r'
21282d_getpwnam_r='$d_getpwnam_r'
21283d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21284d_getsbyname='$d_getsbyname'
21285d_getsbyport='$d_getsbyport'
21286d_getsent='$d_getsent'
10bc17b6
JH
21287d_getservbyname_r='$d_getservbyname_r'
21288d_getservbyport_r='$d_getservbyport_r'
21289d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21290d_getservprotos='$d_getservprotos'
21291d_getspnam='$d_getspnam'
10bc17b6 21292d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21293d_gettimeod='$d_gettimeod'
10bc17b6 21294d_gmtime_r='$d_gmtime_r'
5f80c64f 21295d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21296d_grpasswd='$d_grpasswd'
21297d_hasmntopt='$d_hasmntopt'
21298d_htonl='$d_htonl'
55954f19 21299d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
21300d_index='$d_index'
21301d_inetaton='$d_inetaton'
21302d_int64_t='$d_int64_t'
21303d_isascii='$d_isascii'
758a5d79
JH
21304d_isfinite='$d_isfinite'
21305d_isinf='$d_isinf'
b4eb6b3d
JH
21306d_isnan='$d_isnan'
21307d_isnanl='$d_isnanl'
21308d_killpg='$d_killpg'
21309d_lchown='$d_lchown'
21310d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21311d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21312d_link='$d_link'
10bc17b6 21313d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21314d_locconv='$d_locconv'
21315d_lockf='$d_lockf'
21316d_longdbl='$d_longdbl'
21317d_longlong='$d_longlong'
21318d_lseekproto='$d_lseekproto'
21319d_lstat='$d_lstat'
21320d_madvise='$d_madvise'
7dd121ae
MB
21321d_malloc_good_size='$d_malloc_good_size'
21322d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21323d_mblen='$d_mblen'
21324d_mbstowcs='$d_mbstowcs'
21325d_mbtowc='$d_mbtowc'
21326d_memchr='$d_memchr'
21327d_memcmp='$d_memcmp'
21328d_memcpy='$d_memcpy'
21329d_memmove='$d_memmove'
21330d_memset='$d_memset'
21331d_mkdir='$d_mkdir'
21332d_mkdtemp='$d_mkdtemp'
21333d_mkfifo='$d_mkfifo'
21334d_mkstemp='$d_mkstemp'
21335d_mkstemps='$d_mkstemps'
21336d_mktime='$d_mktime'
21337d_mmap='$d_mmap'
21338d_modfl='$d_modfl'
e67aeab1 21339d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21340d_modflproto='$d_modflproto'
b4eb6b3d
JH
21341d_mprotect='$d_mprotect'
21342d_msg='$d_msg'
21343d_msg_ctrunc='$d_msg_ctrunc'
21344d_msg_dontroute='$d_msg_dontroute'
21345d_msg_oob='$d_msg_oob'
21346d_msg_peek='$d_msg_peek'
21347d_msg_proxy='$d_msg_proxy'
21348d_msgctl='$d_msgctl'
21349d_msgget='$d_msgget'
4e0554ec 21350d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21351d_msgrcv='$d_msgrcv'
21352d_msgsnd='$d_msgsnd'
21353d_msync='$d_msync'
21354d_munmap='$d_munmap'
21355d_mymalloc='$d_mymalloc'
21356d_nice='$d_nice'
2765b840 21357d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21358d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21359d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21360d_off64_t='$d_off64_t'
21361d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21362d_oldpthreads='$d_oldpthreads'
21363d_oldsock='$d_oldsock'
21364d_open3='$d_open3'
21365d_pathconf='$d_pathconf'
21366d_pause='$d_pause'
21367d_perl_otherlibdirs='$d_perl_otherlibdirs'
21368d_phostname='$d_phostname'
21369d_pipe='$d_pipe'
21370d_poll='$d_poll'
5f80c64f 21371d_portable='$d_portable'
c7aff470 21372d_procselfexe='$d_procselfexe'
d6483fcc 21373d_pthread_atfork='$d_pthread_atfork'
58d975c3 21374d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21375d_pthread_yield='$d_pthread_yield'
21376d_pwage='$d_pwage'
21377d_pwchange='$d_pwchange'
21378d_pwclass='$d_pwclass'
21379d_pwcomment='$d_pwcomment'
21380d_pwexpire='$d_pwexpire'
21381d_pwgecos='$d_pwgecos'
21382d_pwpasswd='$d_pwpasswd'
21383d_pwquota='$d_pwquota'
21384d_qgcvt='$d_qgcvt'
21385d_quad='$d_quad'
10bc17b6
JH
21386d_random_r='$d_random_r'
21387d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21388d_readdir='$d_readdir'
10bc17b6 21389d_readdir_r='$d_readdir_r'
b4eb6b3d 21390d_readlink='$d_readlink'
4e0554ec
JH
21391d_readv='$d_readv'
21392d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21393d_rename='$d_rename'
21394d_rewinddir='$d_rewinddir'
21395d_rmdir='$d_rmdir'
21396d_safebcpy='$d_safebcpy'
21397d_safemcpy='$d_safemcpy'
21398d_sanemcmp='$d_sanemcmp'
ef9f17be 21399d_sbrkproto='$d_sbrkproto'
55954f19 21400d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21401d_sched_yield='$d_sched_yield'
21402d_scm_rights='$d_scm_rights'
21403d_seekdir='$d_seekdir'
21404d_select='$d_select'
21405d_sem='$d_sem'
21406d_semctl='$d_semctl'
21407d_semctl_semid_ds='$d_semctl_semid_ds'
21408d_semctl_semun='$d_semctl_semun'
21409d_semget='$d_semget'
21410d_semop='$d_semop'
4e0554ec 21411d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21412d_setegid='$d_setegid'
21413d_seteuid='$d_seteuid'
21414d_setgrent='$d_setgrent'
10bc17b6 21415d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21416d_setgrps='$d_setgrps'
21417d_sethent='$d_sethent'
10bc17b6 21418d_sethostent_r='$d_sethostent_r'
4e0554ec 21419d_setitimer='$d_setitimer'
b4eb6b3d
JH
21420d_setlinebuf='$d_setlinebuf'
21421d_setlocale='$d_setlocale'
10bc17b6 21422d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21423d_setnent='$d_setnent'
10bc17b6 21424d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21425d_setpent='$d_setpent'
21426d_setpgid='$d_setpgid'
21427d_setpgrp2='$d_setpgrp2'
21428d_setpgrp='$d_setpgrp'
21429d_setprior='$d_setprior'
21430d_setproctitle='$d_setproctitle'
10bc17b6 21431d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21432d_setpwent='$d_setpwent'
10bc17b6 21433d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21434d_setregid='$d_setregid'
21435d_setresgid='$d_setresgid'
21436d_setresuid='$d_setresuid'
21437d_setreuid='$d_setreuid'
21438d_setrgid='$d_setrgid'
21439d_setruid='$d_setruid'
21440d_setsent='$d_setsent'
10bc17b6 21441d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21442d_setsid='$d_setsid'
21443d_setvbuf='$d_setvbuf'
21444d_sfio='$d_sfio'
21445d_shm='$d_shm'
21446d_shmat='$d_shmat'
21447d_shmatprototype='$d_shmatprototype'
21448d_shmctl='$d_shmctl'
21449d_shmdt='$d_shmdt'
21450d_shmget='$d_shmget'
21451d_sigaction='$d_sigaction'
983dbef6 21452d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21453d_sigsetjmp='$d_sigsetjmp'
4f5da3e9 21454d_snprintf='$d_snprintf'
49a78c82 21455d_sockatmark='$d_sockatmark'
2ef53570 21456d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21457d_socket='$d_socket'
21458d_socklen_t='$d_socklen_t'
21459d_sockpair='$d_sockpair'
21460d_socks5_init='$d_socks5_init'
360321b3 21461d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21462d_sqrtl='$d_sqrtl'
10bc17b6
JH
21463d_srand48_r='$d_srand48_r'
21464d_srandom_r='$d_srandom_r'
eef837ea 21465d_sresgproto='$d_sresgproto'
640374d0 21466d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21467d_statblks='$d_statblks'
21468d_statfs_f_flags='$d_statfs_f_flags'
21469d_statfs_s='$d_statfs_s'
21470d_statvfs='$d_statvfs'
21471d_stdio_cnt_lval='$d_stdio_cnt_lval'
21472d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21473d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21474d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21475d_stdio_stream_array='$d_stdio_stream_array'
21476d_stdiobase='$d_stdiobase'
21477d_stdstdio='$d_stdstdio'
21478d_strchr='$d_strchr'
21479d_strcoll='$d_strcoll'
21480d_strctcpy='$d_strctcpy'
21481d_strerrm='$d_strerrm'
21482d_strerror='$d_strerror'
10bc17b6 21483d_strerror_r='$d_strerror_r'
b3c85772 21484d_strftime='$d_strftime'
08c92000
MB
21485d_strlcat='$d_strlcat'
21486d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21487d_strtod='$d_strtod'
21488d_strtol='$d_strtol'
21489d_strtold='$d_strtold'
21490d_strtoll='$d_strtoll'
28e5dec8 21491d_strtoq='$d_strtoq'
b4eb6b3d
JH
21492d_strtoul='$d_strtoul'
21493d_strtoull='$d_strtoull'
21494d_strtouq='$d_strtouq'
21495d_strxfrm='$d_strxfrm'
21496d_suidsafe='$d_suidsafe'
21497d_symlink='$d_symlink'
21498d_syscall='$d_syscall'
2ef53570 21499d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21500d_sysconf='$d_sysconf'
21501d_sysernlst='$d_sysernlst'
21502d_syserrlst='$d_syserrlst'
21503d_system='$d_system'
21504d_tcgetpgrp='$d_tcgetpgrp'
21505d_tcsetpgrp='$d_tcsetpgrp'
21506d_telldir='$d_telldir'
21507d_telldirproto='$d_telldirproto'
21508d_time='$d_time'
21509d_times='$d_times'
14b90194
JH
21510d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21511d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21512d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21513d_truncate='$d_truncate'
10bc17b6 21514d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21515d_tzname='$d_tzname'
4e0554ec
JH
21516d_u32align='$d_u32align'
21517d_ualarm='$d_ualarm'
b4eb6b3d
JH
21518d_umask='$d_umask'
21519d_uname='$d_uname'
21520d_union_semun='$d_union_semun'
758a5d79 21521d_unordered='$d_unordered'
bdf33aa7 21522d_unsetenv='$d_unsetenv'
4e0554ec 21523d_usleep='$d_usleep'
2ef53570 21524d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21525d_ustat='$d_ustat'
21526d_vendorarch='$d_vendorarch'
21527d_vendorbin='$d_vendorbin'
21528d_vendorlib='$d_vendorlib'
6e1038e0 21529d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21530d_vfork='$d_vfork'
21531d_void_closedir='$d_void_closedir'
21532d_voidsig='$d_voidsig'
21533d_voidtty='$d_voidtty'
21534d_volatile='$d_volatile'
21535d_vprintf='$d_vprintf'
4f5da3e9 21536d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21537d_wait4='$d_wait4'
21538d_waitpid='$d_waitpid'
21539d_wcstombs='$d_wcstombs'
21540d_wctomb='$d_wctomb'
4e0554ec 21541d_writev='$d_writev'
5f80c64f
JH
21542d_xenix='$d_xenix'
21543date='$date'
b4eb6b3d
JH
21544db_hashtype='$db_hashtype'
21545db_prefixtype='$db_prefixtype'
640374d0
JH
21546db_version_major='$db_version_major'
21547db_version_minor='$db_version_minor'
21548db_version_patch='$db_version_patch'
b4eb6b3d
JH
21549defvoidused='$defvoidused'
21550direntrytype='$direntrytype'
21551dlext='$dlext'
5f80c64f 21552dlsrc='$dlsrc'
b4eb6b3d
JH
21553doublesize='$doublesize'
21554drand01='$drand01'
10bc17b6 21555drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21556dynamic_ext='$dynamic_ext'
21557eagain='$eagain'
21558ebcdic='$ebcdic'
5f80c64f
JH
21559echo='$echo'
21560egrep='$egrep'
21561emacs='$emacs'
10bc17b6
JH
21562endgrent_r_proto='$endgrent_r_proto'
21563endhostent_r_proto='$endhostent_r_proto'
21564endnetent_r_proto='$endnetent_r_proto'
21565endprotoent_r_proto='$endprotoent_r_proto'
21566endpwent_r_proto='$endpwent_r_proto'
21567endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21568eunicefix='$eunicefix'
21569exe_ext='$exe_ext'
21570expr='$expr'
b4eb6b3d 21571extensions='$extensions'
6fcddf3b 21572extras='$extras'
b4eb6b3d
JH
21573fflushNULL='$fflushNULL'
21574fflushall='$fflushall'
5f80c64f
JH
21575find='$find'
21576firstmakefile='$firstmakefile'
21577flex='$flex'
b4eb6b3d
JH
21578fpossize='$fpossize'
21579fpostype='$fpostype'
21580freetype='$freetype'
5440bc8e 21581from='$from'
b4eb6b3d
JH
21582full_ar='$full_ar'
21583full_csh='$full_csh'
21584full_sed='$full_sed'
2d736872 21585gccansipedantic='$gccansipedantic'
5b463ca7 21586gccosandvers='$gccosandvers'
5f80c64f 21587gccversion='$gccversion'
10bc17b6
JH
21588getgrent_r_proto='$getgrent_r_proto'
21589getgrgid_r_proto='$getgrgid_r_proto'
21590getgrnam_r_proto='$getgrnam_r_proto'
21591gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21592gethostbyname_r_proto='$gethostbyname_r_proto'
21593gethostent_r_proto='$gethostent_r_proto'
21594getlogin_r_proto='$getlogin_r_proto'
21595getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21596getnetbyname_r_proto='$getnetbyname_r_proto'
21597getnetent_r_proto='$getnetent_r_proto'
21598getprotobyname_r_proto='$getprotobyname_r_proto'
21599getprotobynumber_r_proto='$getprotobynumber_r_proto'
21600getprotoent_r_proto='$getprotoent_r_proto'
21601getpwent_r_proto='$getpwent_r_proto'
21602getpwnam_r_proto='$getpwnam_r_proto'
21603getpwuid_r_proto='$getpwuid_r_proto'
21604getservbyname_r_proto='$getservbyname_r_proto'
21605getservbyport_r_proto='$getservbyport_r_proto'
21606getservent_r_proto='$getservent_r_proto'
21607getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21608gidformat='$gidformat'
21609gidsign='$gidsign'
21610gidsize='$gidsize'
21611gidtype='$gidtype'
5f80c64f 21612glibpth='$glibpth'
3c728e00 21613gmake='$gmake'
10bc17b6 21614gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21615gnulibc_version='$gnulibc_version'
5f80c64f 21616grep='$grep'
b4eb6b3d
JH
21617groupcat='$groupcat'
21618groupstype='$groupstype'
5f80c64f 21619gzip='$gzip'
b4eb6b3d
JH
21620h_fcntl='$h_fcntl'
21621h_sysfile='$h_sysfile'
5f80c64f 21622hint='$hint'
b4eb6b3d 21623hostcat='$hostcat'
6e1038e0
MB
21624html1dir='$html1dir'
21625html1direxp='$html1direxp'
21626html3dir='$html3dir'
21627html3direxp='$html3direxp'
b4eb6b3d
JH
21628i16size='$i16size'
21629i16type='$i16type'
21630i32size='$i32size'
21631i32type='$i32type'
21632i64size='$i64size'
21633i64type='$i64type'
21634i8size='$i8size'
21635i8type='$i8type'
21636i_arpainet='$i_arpainet'
21637i_bsdioctl='$i_bsdioctl'
10bc17b6 21638i_crypt='$i_crypt'
b4eb6b3d
JH
21639i_db='$i_db'
21640i_dbm='$i_dbm'
21641i_dirent='$i_dirent'
5f80c64f 21642i_dld='$i_dld'
b4eb6b3d
JH
21643i_dlfcn='$i_dlfcn'
21644i_fcntl='$i_fcntl'
21645i_float='$i_float'
758a5d79
JH
21646i_fp='$i_fp'
21647i_fp_class='$i_fp_class'
b4eb6b3d
JH
21648i_gdbm='$i_gdbm'
21649i_grp='$i_grp'
b4eb6b3d
JH
21650i_ieeefp='$i_ieeefp'
21651i_inttypes='$i_inttypes'
2765b840 21652i_langinfo='$i_langinfo'
b4eb6b3d
JH
21653i_libutil='$i_libutil'
21654i_limits='$i_limits'
21655i_locale='$i_locale'
21656i_machcthr='$i_machcthr'
21657i_malloc='$i_malloc'
21658i_math='$i_math'
21659i_memory='$i_memory'
21660i_mntent='$i_mntent'
21661i_ndbm='$i_ndbm'
21662i_netdb='$i_netdb'
21663i_neterrno='$i_neterrno'
21664i_netinettcp='$i_netinettcp'
21665i_niin='$i_niin'
21666i_poll='$i_poll'
21667i_prot='$i_prot'
21668i_pthread='$i_pthread'
21669i_pwd='$i_pwd'
21670i_rpcsvcdbm='$i_rpcsvcdbm'
21671i_sfio='$i_sfio'
21672i_sgtty='$i_sgtty'
21673i_shadow='$i_shadow'
21674i_socks='$i_socks'
21675i_stdarg='$i_stdarg'
21676i_stddef='$i_stddef'
21677i_stdlib='$i_stdlib'
21678i_string='$i_string'
21679i_sunmath='$i_sunmath'
21680i_sysaccess='$i_sysaccess'
21681i_sysdir='$i_sysdir'
21682i_sysfile='$i_sysfile'
21683i_sysfilio='$i_sysfilio'
21684i_sysin='$i_sysin'
21685i_sysioctl='$i_sysioctl'
21686i_syslog='$i_syslog'
21687i_sysmman='$i_sysmman'
21688i_sysmode='$i_sysmode'
21689i_sysmount='$i_sysmount'
21690i_sysndir='$i_sysndir'
21691i_sysparam='$i_sysparam'
21692i_sysresrc='$i_sysresrc'
21693i_syssecrt='$i_syssecrt'
21694i_sysselct='$i_sysselct'
21695i_syssockio='$i_syssockio'
21696i_sysstat='$i_sysstat'
21697i_sysstatfs='$i_sysstatfs'
21698i_sysstatvfs='$i_sysstatvfs'
21699i_systime='$i_systime'
21700i_systimek='$i_systimek'
21701i_systimes='$i_systimes'
21702i_systypes='$i_systypes'
21703i_sysuio='$i_sysuio'
21704i_sysun='$i_sysun'
21705i_sysutsname='$i_sysutsname'
21706i_sysvfs='$i_sysvfs'
21707i_syswait='$i_syswait'
21708i_termio='$i_termio'
21709i_termios='$i_termios'
21710i_time='$i_time'
21711i_unistd='$i_unistd'
21712i_ustat='$i_ustat'
21713i_utime='$i_utime'
21714i_values='$i_values'
21715i_varargs='$i_varargs'
21716i_varhdr='$i_varhdr'
21717i_vfork='$i_vfork'
5f80c64f 21718ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21719inc_version_list='$inc_version_list'
21720inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21721incpath='$incpath'
21722inews='$inews'
b4eb6b3d
JH
21723installarchlib='$installarchlib'
21724installbin='$installbin'
6e1038e0
MB
21725installhtml1dir='$installhtml1dir'
21726installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21727installman1dir='$installman1dir'
21728installman3dir='$installman3dir'
21729installprefix='$installprefix'
21730installprefixexp='$installprefixexp'
21731installprivlib='$installprivlib'
21732installscript='$installscript'
21733installsitearch='$installsitearch'
21734installsitebin='$installsitebin'
8d2cbf27
JH
21735installsitehtml1dir='$installsitehtml1dir'
21736installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21737installsitelib='$installsitelib'
91e123a8
JH
21738installsiteman1dir='$installsiteman1dir'
21739installsiteman3dir='$installsiteman3dir'
6e1038e0 21740installsitescript='$installsitescript'
b4eb6b3d
JH
21741installstyle='$installstyle'
21742installusrbinperl='$installusrbinperl'
21743installvendorarch='$installvendorarch'
21744installvendorbin='$installvendorbin'
8d2cbf27
JH
21745installvendorhtml1dir='$installvendorhtml1dir'
21746installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21747installvendorlib='$installvendorlib'
91e123a8
JH
21748installvendorman1dir='$installvendorman1dir'
21749installvendorman3dir='$installvendorman3dir'
6e1038e0 21750installvendorscript='$installvendorscript'
b4eb6b3d 21751intsize='$intsize'
4b661809 21752issymlink='$issymlink'
b4eb6b3d
JH
21753ivdformat='$ivdformat'
21754ivsize='$ivsize'
21755ivtype='$ivtype'
21756known_extensions='$known_extensions'
5f80c64f 21757ksh='$ksh'
5f80c64f
JH
21758ld='$ld'
21759lddlflags='$lddlflags'
21760ldflags='$ldflags'
b4eb6b3d
JH
21761ldflags_uselargefiles='$ldflags_uselargefiles'
21762ldlibpthname='$ldlibpthname'
5f80c64f
JH
21763less='$less'
21764lib_ext='$lib_ext'
21765libc='$libc'
b4eb6b3d 21766libperl='$libperl'
5f80c64f
JH
21767libpth='$libpth'
21768libs='$libs'
43999f95
JH
21769libsdirs='$libsdirs'
21770libsfiles='$libsfiles'
21771libsfound='$libsfound'
13b3f787 21772libspath='$libspath'
5f80c64f 21773libswanted='$libswanted'
b4eb6b3d 21774libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21775line='$line'
21776lint='$lint'
21777lkflags='$lkflags'
21778ln='$ln'
21779lns='$lns'
10bc17b6 21780localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21781locincpth='$locincpth'
21782loclibpth='$loclibpth'
b4eb6b3d
JH
21783longdblsize='$longdblsize'
21784longlongsize='$longlongsize'
21785longsize='$longsize'
5f80c64f
JH
21786lp='$lp'
21787lpr='$lpr'
21788ls='$ls'
b4eb6b3d
JH
21789lseeksize='$lseeksize'
21790lseektype='$lseektype'
5f80c64f
JH
21791mail='$mail'
21792mailx='$mailx'
21793make='$make'
21794make_set_make='$make_set_make'
b4eb6b3d
JH
21795mallocobj='$mallocobj'
21796mallocsrc='$mallocsrc'
21797malloctype='$malloctype'
21798man1dir='$man1dir'
21799man1direxp='$man1direxp'
21800man1ext='$man1ext'
21801man3dir='$man3dir'
21802man3direxp='$man3direxp'
21803man3ext='$man3ext'
5f80c64f 21804mips_type='$mips_type'
5129fff4 21805mistrustnm='$mistrustnm'
5f80c64f 21806mkdir='$mkdir'
b4eb6b3d
JH
21807mmaptype='$mmaptype'
21808modetype='$modetype'
5f80c64f 21809more='$more'
b4eb6b3d 21810multiarch='$multiarch'
5f80c64f 21811mv='$mv'
b4eb6b3d
JH
21812myarchname='$myarchname'
21813mydomain='$mydomain'
21814myhostname='$myhostname'
5f80c64f
JH
21815myuname='$myuname'
21816n='$n'
2cc61e15 21817need_va_copy='$need_va_copy'
b4eb6b3d
JH
21818netdb_hlen_type='$netdb_hlen_type'
21819netdb_host_type='$netdb_host_type'
21820netdb_name_type='$netdb_name_type'
21821netdb_net_type='$netdb_net_type'
5f80c64f
JH
21822nm='$nm'
21823nm_opt='$nm_opt'
21824nm_so_opt='$nm_so_opt'
b4eb6b3d 21825nonxs_ext='$nonxs_ext'
5f80c64f 21826nroff='$nroff'
b4eb6b3d
JH
21827nvEUformat='$nvEUformat'
21828nvFUformat='$nvFUformat'
21829nvGUformat='$nvGUformat'
53133ed1 21830nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21831nveformat='$nveformat'
21832nvfformat='$nvfformat'
21833nvgformat='$nvgformat'
21834nvsize='$nvsize'
21835nvtype='$nvtype'
21836o_nonblock='$o_nonblock'
5f80c64f 21837obj_ext='$obj_ext'
b4eb6b3d 21838old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21839optimize='$optimize'
b4eb6b3d 21840orderlib='$orderlib'
5f80c64f
JH
21841osname='$osname'
21842osvers='$osvers'
b4eb6b3d 21843otherlibdirs='$otherlibdirs'
5f80c64f 21844package='$package'
b4eb6b3d
JH
21845pager='$pager'
21846passcat='$passcat'
21847patchlevel='$patchlevel'
5f80c64f 21848path_sep='$path_sep'
b4eb6b3d 21849perl5='$perl5'
5f80c64f 21850perl='$perl'
151e6568 21851perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21852perladmin='$perladmin'
9c839522 21853perllibs='$perllibs'
b4eb6b3d 21854perlpath='$perlpath'
5f80c64f 21855pg='$pg'
b4eb6b3d
JH
21856phostname='$phostname'
21857pidtype='$pidtype'
5f80c64f
JH
21858plibpth='$plibpth'
21859pmake='$pmake'
21860pr='$pr'
b4eb6b3d
JH
21861prefix='$prefix'
21862prefixexp='$prefixexp'
21863privlib='$privlib'
21864privlibexp='$privlibexp'
f24dbf84 21865procselfexe='$procselfexe'
b4eb6b3d
JH
21866prototype='$prototype'
21867ptrsize='$ptrsize'
21868quadkind='$quadkind'
21869quadtype='$quadtype'
21870randbits='$randbits'
21871randfunc='$randfunc'
10bc17b6 21872random_r_proto='$random_r_proto'
b4eb6b3d
JH
21873randseedtype='$randseedtype'
21874ranlib='$ranlib'
21875rd_nodata='$rd_nodata'
10bc17b6
JH
21876readdir64_r_proto='$readdir64_r_proto'
21877readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21878revision='$revision'
5f80c64f
JH
21879rm='$rm'
21880rmail='$rmail'
5440bc8e 21881run='$run'
5f80c64f 21882runnm='$runnm'
b4eb6b3d
JH
21883sPRIEUldbl='$sPRIEUldbl'
21884sPRIFUldbl='$sPRIFUldbl'
21885sPRIGUldbl='$sPRIGUldbl'
21886sPRIXU64='$sPRIXU64'
21887sPRId64='$sPRId64'
21888sPRIeldbl='$sPRIeldbl'
21889sPRIfldbl='$sPRIfldbl'
21890sPRIgldbl='$sPRIgldbl'
21891sPRIi64='$sPRIi64'
21892sPRIo64='$sPRIo64'
21893sPRIu64='$sPRIu64'
21894sPRIx64='$sPRIx64'
21895sSCNfldbl='$sSCNfldbl'
21896sched_yield='$sched_yield'
21897scriptdir='$scriptdir'
21898scriptdirexp='$scriptdirexp'
5f80c64f 21899sed='$sed'
b4eb6b3d
JH
21900seedfunc='$seedfunc'
21901selectminbits='$selectminbits'
21902selecttype='$selecttype'
5f80c64f 21903sendmail='$sendmail'
10bc17b6
JH
21904setgrent_r_proto='$setgrent_r_proto'
21905sethostent_r_proto='$sethostent_r_proto'
21906setlocale_r_proto='$setlocale_r_proto'
21907setnetent_r_proto='$setnetent_r_proto'
21908setprotoent_r_proto='$setprotoent_r_proto'
21909setpwent_r_proto='$setpwent_r_proto'
21910setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21911sh='$sh'
21912shar='$shar'
21913sharpbang='$sharpbang'
b4eb6b3d
JH
21914shmattype='$shmattype'
21915shortsize='$shortsize'
21916shrpenv='$shrpenv'
5f80c64f 21917shsharp='$shsharp'
b4eb6b3d
JH
21918sig_count='$sig_count'
21919sig_name='$sig_name'
21920sig_name_init='$sig_name_init'
21921sig_num='$sig_num'
21922sig_num_init='$sig_num_init'
76d3c696 21923sig_size='$sig_size'
b4eb6b3d
JH
21924signal_t='$signal_t'
21925sitearch='$sitearch'
21926sitearchexp='$sitearchexp'
21927sitebin='$sitebin'
21928sitebinexp='$sitebinexp'
8d2cbf27
JH
21929sitehtml1dir='$sitehtml1dir'
21930sitehtml1direxp='$sitehtml1direxp'
21931sitehtml3dir='$sitehtml3dir'
21932sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
21933sitelib='$sitelib'
21934sitelib_stem='$sitelib_stem'
21935sitelibexp='$sitelibexp'
91e123a8
JH
21936siteman1dir='$siteman1dir'
21937siteman1direxp='$siteman1direxp'
21938siteman3dir='$siteman3dir'
21939siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
21940siteprefix='$siteprefix'
21941siteprefixexp='$siteprefixexp'
6e1038e0
MB
21942sitescript='$sitescript'
21943sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21944sizesize='$sizesize'
21945sizetype='$sizetype'
5f80c64f
JH
21946sleep='$sleep'
21947smail='$smail'
5f80c64f 21948so='$so'
b4eb6b3d
JH
21949sockethdr='$sockethdr'
21950socketlib='$socketlib'
21951socksizetype='$socksizetype'
5f80c64f
JH
21952sort='$sort'
21953spackage='$spackage'
21954spitshell='$spitshell'
10bc17b6
JH
21955srand48_r_proto='$srand48_r_proto'
21956srandom_r_proto='$srandom_r_proto'
5f80c64f 21957src='$src'
b4eb6b3d
JH
21958ssizetype='$ssizetype'
21959startperl='$startperl'
5f80c64f 21960startsh='$startsh'
b4eb6b3d
JH
21961static_ext='$static_ext'
21962stdchar='$stdchar'
21963stdio_base='$stdio_base'
21964stdio_bufsiz='$stdio_bufsiz'
21965stdio_cnt='$stdio_cnt'
21966stdio_filbuf='$stdio_filbuf'
21967stdio_ptr='$stdio_ptr'
21968stdio_stream_array='$stdio_stream_array'
10bc17b6 21969strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21970strings='$strings'
5f80c64f 21971submit='$submit'
b4eb6b3d
JH
21972subversion='$subversion'
21973sysman='$sysman'
5f80c64f
JH
21974tail='$tail'
21975tar='$tar'
5440bc8e 21976targetarch='$targetarch'
5f80c64f
JH
21977tbl='$tbl'
21978tee='$tee'
21979test='$test'
b4eb6b3d
JH
21980timeincl='$timeincl'
21981timetype='$timetype'
10bc17b6 21982tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21983to='$to'
5f80c64f
JH
21984touch='$touch'
21985tr='$tr'
21986trnl='$trnl'
21987troff='$troff'
10bc17b6 21988ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21989u16size='$u16size'
21990u16type='$u16type'
21991u32size='$u32size'
21992u32type='$u32type'
21993u64size='$u64size'
21994u64type='$u64type'
21995u8size='$u8size'
21996u8type='$u8type'
21997uidformat='$uidformat'
21998uidsign='$uidsign'
21999uidsize='$uidsize'
22000uidtype='$uidtype'
5f80c64f
JH
22001uname='$uname'
22002uniq='$uniq'
b4eb6b3d
JH
22003uquadtype='$uquadtype'
22004use5005threads='$use5005threads'
22005use64bitall='$use64bitall'
22006use64bitint='$use64bitint'
5440bc8e 22007usecrosscompile='$usecrosscompile'
5f80c64f 22008usedl='$usedl'
15b61c98 22009usefaststdio='$usefaststdio'
b4eb6b3d
JH
22010useithreads='$useithreads'
22011uselargefiles='$uselargefiles'
22012uselongdouble='$uselongdouble'
19a100ff 22013usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22014usemorebits='$usemorebits'
22015usemultiplicity='$usemultiplicity'
22016usemymalloc='$usemymalloc'
5f80c64f 22017usenm='$usenm'
b4eb6b3d
JH
22018useopcode='$useopcode'
22019useperlio='$useperlio'
22020useposix='$useposix'
9514c62b 22021usereentrant='$usereentrant'
d51aaa9d 22022userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22023usesfio='$usesfio'
22024useshrplib='$useshrplib'
5f106f9c 22025usesitecustomize='$usesitecustomize'
29209bc5 22026usesocks='$usesocks'
b4eb6b3d
JH
22027usethreads='$usethreads'
22028usevendorprefix='$usevendorprefix'
22029usevfork='$usevfork'
5f80c64f
JH
22030usrinc='$usrinc'
22031uuname='$uuname'
b4eb6b3d
JH
22032uvXUformat='$uvXUformat'
22033uvoformat='$uvoformat'
22034uvsize='$uvsize'
22035uvtype='$uvtype'
22036uvuformat='$uvuformat'
22037uvxformat='$uvxformat'
22038vendorarch='$vendorarch'
22039vendorarchexp='$vendorarchexp'
22040vendorbin='$vendorbin'
22041vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22042vendorhtml1dir='$vendorhtml1dir'
22043vendorhtml1direxp='$vendorhtml1direxp'
22044vendorhtml3dir='$vendorhtml3dir'
22045vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22046vendorlib='$vendorlib'
22047vendorlib_stem='$vendorlib_stem'
22048vendorlibexp='$vendorlibexp'
91e123a8
JH
22049vendorman1dir='$vendorman1dir'
22050vendorman1direxp='$vendorman1direxp'
22051vendorman3dir='$vendorman3dir'
22052vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22053vendorprefix='$vendorprefix'
22054vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22055vendorscript='$vendorscript'
22056vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22057version='$version'
861eb78d 22058version_patchlevel_string='$version_patchlevel_string'
d56c5707 22059versiononly='$versiononly'
5f80c64f 22060vi='$vi'
b4eb6b3d 22061voidflags='$voidflags'
5f80c64f 22062xlibpth='$xlibpth'
3659ebf1
JH
22063yacc='$yacc'
22064yaccflags='$yaccflags'
5f80c64f
JH
22065zcat='$zcat'
22066zip='$zip'
22067EOT
22068
22069: Add in command line options if available
22070$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22071
22072: add special variables
22073$test -f $src/patchlevel.h && \
d00b958f 22074awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22075echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22076echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22077
22078: propagate old symbols
22079if $test -f UU/config.sh; then
381aa1ff 22080 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22081 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22082 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22083 set X `cat UU/oldsyms`
22084 shift
22085 case $# in
22086 0) ;;
22087 *)
22088 cat <<EOM
22089Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22090EOM
22091 echo "# Variables propagated from previous config.sh file." >>config.sh
22092 for sym in `cat UU/oldsyms`; do
22093 echo " Propagating $hint variable "'$'"$sym..."
22094 eval 'tmp="$'"${sym}"'"'
22095 echo "$tmp" | \
22096 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22097 done
22098 ;;
22099 esac
22100fi
22101
22102: Finish up by extracting the .SH files
22103case "$alldone" in
22104exit)
22105 $rm -rf UU
24ccb310 22106 echo "Extraction done."
5f80c64f
JH
22107 exit 0
22108 ;;
22109cont)
22110 ;;
22111'')
22112 dflt=''
22113 nostick=true
22114 $cat <<EOM
22115
22116If you'd like to make any changes to the config.sh file before I begin
22117to configure things, do it as a shell escape now (e.g. !vi config.sh).
22118
22119EOM
22120 rp="Press return or use a shell escape to edit config.sh:"
22121 . UU/myread
22122 nostick=''
22123 case "$ans" in
22124 '') ;;
22125 *) : in case they cannot read
22126 sh 1>&4 -c "$ans";;
22127 esac
22128 ;;
22129esac
22130
22131: if this fails, just run all the .SH files by hand
22132. ./config.sh
22133
22134echo " "
22135exec 1>&4
a43e8593 22136pwd=`pwd`
5f80c64f 22137. ./UU/extract
6904989c 22138cd "$pwd"
5f80c64f
JH
22139
22140if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22141 dflt=y
22142 case "$silent" in
22143 true) ;;
22144 *)
22145 $cat <<EOM
22146
22147Now you need to generate make dependencies by running "$make depend".
22148You might prefer to run it in background: "$make depend > makedepend.out &"
22149It can take a while, so you might not want to run it right now.
22150
22151EOM
22152 ;;
22153 esac
22154 rp="Run $make depend now?"
22155 . UU/myread
22156 case "$ans" in
22157 y*)
3d5d58b1 22158 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22159 ;;
22160 *)
22161 echo "You must run '$make depend' then '$make'."
22162 ;;
22163 esac
22164elif test -f [Mm]akefile; then
22165 echo " "
22166 echo "Now you must run a $make."
22167else
24ccb310 22168 echo "Configure done."
5f80c64f
JH
22169fi
22170
22171if $test -f Policy.sh; then
22172 $cat <<EOM
22173
22174If you compile $package on a different machine or from a different object
22175directory, copy the Policy.sh file from this object directory to the
22176new one before you run Configure -- this will help you with most of
22177the policy defaults.
22178
22179EOM
22180fi
22181if $test -f config.msg; then
22182 echo "Hmm. I also noted the following information while running:"
22183 echo " "
22184 $cat config.msg >&4
22185 $rm -f config.msg
22186fi
22187$rm -f kit*isdone ark*isdone
22188$rm -rf UU
22189
22190: End of Configure
22191