This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unvoid SvUPGRADE
[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
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
8b7d8421 23# Generated on Tue May 31 08:06:05 CEST 2005 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
f6538904 50if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
51 cat >&4 <<EOF
52***
53*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
55*** Please read the README.plan9 for further instructions.
56*** Cannot continue, aborting.
57***
58EOF
59 exit 1
60fi
61
a0d0e21e
LW
62: compute my invocation name
63me=$0
64case "$0" in
65*/*)
66 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67 test "$me" || me=$0
68 ;;
69esac
70
dfe9444c 71: Proper separator for the PATH environment variable
8e07c86e
AD
72p_=:
73: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 74if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
75 if test -n "$OS2_SHELL"; then
76 p_=\;
77 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 79 is_os2=yes
c4f23d77 80 elif test -n "$DJGPP"; then
495e2cbe
MB
81 case "X${MACHTYPE:-nonesuchmach}" in
82 *cygwin) ;;
83 *) p_=\; ;;
84 esac
dfe9444c 85 fi
39e571d4 86fi
a0d0e21e
LW
87
88: Proper PATH setting
89paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 90paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 91paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 92paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 93paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 94paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
95paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 97paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
98
99for p in $paths
100do
8e07c86e
AD
101 case "$p_$PATH$p_" in
102 *$p_$p$p_*) ;;
103 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
104 esac
105done
106
8e07c86e 107PATH=.$p_$PATH
2304df62
AD
108export PATH
109
dfe9444c
AD
110: shall we be using ksh?
111inksh=''
112needksh=''
113avoidksh=''
114newsh=/bin/ksh
115changesh=''
ff0cee69 116if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
117 inksh=true
118fi
119if test -f /hp-ux -a -f /bin/ksh; then
120 needksh='to avoid sh bug in "here document" expansion'
121fi
122if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123 if test X`/usr/bin/uname -v` = X4; then
124 avoidksh="to avoid AIX 4's /bin/sh"
125 newsh=/usr/bin/bsh
2304df62 126 fi
dfe9444c 127fi
cf04f91f
JH
128if test -f /osf_boot -a -f /usr/sbin/setld; then
129 if test X`/usr/bin/uname -s` = XOSF1; then
130 avoidksh="to avoid Digital UNIX' ksh"
131 newsh=/bin/sh
132 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133 fi
134fi
dfe9444c
AD
135case "$inksh/$needksh" in
136/[a-z]*)
c4f23d77 137 ENV=''
dfe9444c
AD
138 changesh=true
139 reason="$needksh"
140 ;;
141esac
142case "$inksh/$avoidksh" in
143true/[a-z]*)
144 changesh=true
145 reason="$avoidksh"
146 ;;
147esac
148case "$inksh/$needksh-$avoidksh-" in
149true/--)
a0d0e21e
LW
150 cat <<EOM
151(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 152mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 153EOM
dfe9444c
AD
154 ;;
155esac
156case "$changesh" in
157true)
2e2a97a6 158 export newsh
dfe9444c
AD
159 echo "(Feeding myself to $newsh $reason.)"
160 case "$0" in
161 Configure|*/Configure) exec $newsh $0 "$@";;
162 *) exec $newsh Configure "$@";;
163 esac
164 ;;
165esac
2304df62 166
bfb7748a
AD
167: if needed set CDPATH to a harmless value that is not chatty
168: avoid bash 2.02 problems with empty CDPATH.
169case "$CDPATH" in
170'') ;;
171*) case "$SHELL" in
172 *bash*) CDPATH='.' ;;
173 *) CDPATH='' ;;
174 esac
175 ;;
176esac
2304df62
AD
177: Configure runs within the UU subdirectory
178test -d UU || mkdir UU
8e07c86e 179cd UU && rm -f ./*
2304df62 180
6b356c8e
JH
181ccname=''
182ccversion=''
b4eb6b3d
JH
183ccsymbols=''
184cppccsymbols=''
185cppsymbols=''
5440bc8e
JH
186from=''
187run=''
188targetarch=''
189to=''
190usecrosscompile=''
6b34ded5 191mistrustnm=''
9c839522 192perllibs=''
b4eb6b3d
JH
193dynamic_ext=''
194extensions=''
195known_extensions=''
196nonxs_ext=''
197static_ext=''
198useopcode=''
199useposix=''
6fcddf3b 200extras=''
ecfc5424 201d_bsd=''
40a7a20a 202d_eunice=''
2304df62
AD
203d_xenix=''
204eunicefix=''
205Mcc=''
dfe9444c 206ar=''
2304df62
AD
207awk=''
208bash=''
209bison=''
210byacc=''
211cat=''
212chgrp=''
213chmod=''
214chown=''
ecfc5424 215comm=''
2304df62
AD
216compress=''
217cp=''
218cpio=''
219cpp=''
220csh=''
221date=''
222echo=''
223egrep=''
224emacs=''
225expr=''
226find=''
227flex=''
3c728e00 228gmake=''
2304df62 229grep=''
8ff267be 230gzip=''
2304df62
AD
231inews=''
232ksh=''
233less=''
234line=''
235lint=''
236ln=''
237lp=''
238lpr=''
239ls=''
240mail=''
241mailx=''
dfe9444c 242make=''
2304df62
AD
243mkdir=''
244more=''
245mv=''
693762b4 246nm=''
2304df62
AD
247nroff=''
248perl=''
249pg=''
250pmake=''
251pr=''
252rm=''
253rmail=''
254sed=''
255sendmail=''
2304df62
AD
256shar=''
257sleep=''
258smail=''
259sort=''
260submit=''
261tail=''
262tar=''
263tbl=''
693762b4 264tee=''
2304df62
AD
265test=''
266touch=''
267tr=''
268troff=''
269uname=''
270uniq=''
271uuname=''
272vi=''
273zcat=''
8ff267be 274zip=''
b4eb6b3d
JH
275full_ar=''
276full_sed=''
a0d0e21e 277libswanted=''
2304df62
AD
278hint=''
279myuname=''
85e6fe83
LW
280osname=''
281osvers=''
2304df62
AD
282Author=''
283Date=''
284Header=''
285Id=''
286Locker=''
287Log=''
288RCSfile=''
289Revision=''
290Source=''
291State=''
dfe9444c
AD
292_a=''
293_exe=''
294_o=''
4633a7c4
LW
295archobjs=''
296exe_ext=''
297firstmakefile=''
298lib_ext=''
299obj_ext=''
300path_sep=''
b4eb6b3d 301afs=''
a6d26a0d 302afsroot=''
b4eb6b3d
JH
303alignbytes=''
304ansi2knr=''
305archlib=''
306archlibexp=''
307d_archlib=''
308installarchlib=''
309archname=''
310myarchname=''
311d_atolf=''
312d_atoll=''
313baserev=''
314bin=''
315binexp=''
316installbin=''
b4eb6b3d 317byteorder=''
2304df62 318cc=''
2304df62
AD
319ccflags=''
320cppflags=''
321ldflags=''
322lkflags=''
8e07c86e 323locincpth=''
2304df62 324optimize=''
b4eb6b3d 325cf_email=''
2304df62
AD
326cf_by=''
327cf_time=''
b4eb6b3d 328charsize=''
2304df62 329contains=''
b4eb6b3d 330cpp_stuff=''
2304df62
AD
331cpplast=''
332cppminus=''
333cpprun=''
334cppstdin=''
74cac757 335d__fwalk=''
b4eb6b3d
JH
336d_access=''
337d_accessx=''
55954f19 338d_aintl=''
b4eb6b3d 339d_alarm=''
10bc17b6
JH
340asctime_r_proto=''
341d_asctime_r=''
0dbb1585
AL
342d_attribute_format=''
343d_attribute_malloc=''
344d_attribute_nonnull=''
345d_attribute_noreturn=''
346d_attribute_pure=''
347d_attribute_unused=''
348d_attribute_warn_unused_result=''
b4eb6b3d
JH
349d_bcmp=''
350d_bcopy=''
351d_bzero=''
352d_casti32=''
353castflags=''
354d_castneg=''
355d_chown=''
356d_chroot=''
357d_chsize=''
758a5d79 358d_class=''
b4eb6b3d
JH
359d_closedir=''
360d_void_closedir=''
4e0554ec 361d_cmsghdr_s=''
b4eb6b3d 362d_const=''
36adc09b 363d_copysignl=''
b4eb6b3d
JH
364cryptlib=''
365d_crypt=''
10bc17b6
JH
366crypt_r_proto=''
367d_crypt_r=''
b4eb6b3d
JH
368d_csh=''
369full_csh=''
10bc17b6
JH
370ctermid_r_proto=''
371d_ctermid_r=''
372ctime_r_proto=''
373d_ctime_r=''
b4eb6b3d
JH
374d_cuserid=''
375d_dbl_dig=''
2ef53570 376d_dbminitproto=''
b4eb6b3d 377d_difftime=''
ae0e3d3b 378d_dirfd=''
b4eb6b3d 379d_dlerror=''
a0d0e21e 380d_dlopen=''
b4eb6b3d
JH
381d_dlsymun=''
382d_dosuid=''
383d_suidsafe=''
10bc17b6
JH
384d_drand48_r=''
385drand48_r_proto=''
b4eb6b3d
JH
386d_drand48proto=''
387d_dup2=''
388d_eaccess=''
389d_endgrent=''
10bc17b6
JH
390d_endgrent_r=''
391endgrent_r_proto=''
b4eb6b3d 392d_endhent=''
10bc17b6
JH
393d_endhostent_r=''
394endhostent_r_proto=''
b4eb6b3d 395d_endnent=''
10bc17b6
JH
396d_endnetent_r=''
397endnetent_r_proto=''
b4eb6b3d 398d_endpent=''
10bc17b6
JH
399d_endprotoent_r=''
400endprotoent_r_proto=''
b4eb6b3d 401d_endpwent=''
10bc17b6
JH
402d_endpwent_r=''
403endpwent_r_proto=''
b4eb6b3d 404d_endsent=''
10bc17b6
JH
405d_endservent_r=''
406endservent_r_proto=''
15b61c98 407d_faststdio=''
b363b713 408d_fchdir=''
b4eb6b3d
JH
409d_fchmod=''
410d_fchown=''
411d_fcntl=''
9d9004a9 412d_fcntl_can_lock=''
b4eb6b3d
JH
413d_fd_macros=''
414d_fd_set=''
415d_fds_bits=''
416d_fgetpos=''
758a5d79
JH
417d_finite=''
418d_finitel=''
b4eb6b3d
JH
419d_flexfnam=''
420d_flock=''
2ef53570 421d_flockproto=''
b4eb6b3d 422d_fork=''
758a5d79
JH
423d_fp_class=''
424d_fpclass=''
425d_fpclassify=''
426d_fpclassl=''
b4eb6b3d
JH
427d_fpos64_t=''
428d_frexpl=''
429d_fs_data_s=''
430d_fseeko=''
431d_fsetpos=''
432d_fstatfs=''
411ab01c 433d_fsync=''
b4eb6b3d
JH
434d_ftello=''
435d_ftime=''
436d_gettimeod=''
437d_Gconvert=''
438d_getcwd=''
439d_getespwnam=''
440d_getfsstat=''
441d_getgrent=''
10bc17b6
JH
442d_getgrent_r=''
443getgrent_r_proto=''
444d_getgrgid_r=''
445getgrgid_r_proto=''
446d_getgrnam_r=''
447getgrnam_r_proto=''
b4eb6b3d
JH
448d_getgrps=''
449d_gethbyaddr=''
450d_gethbyname=''
451d_gethent=''
452aphostname=''
453d_gethname=''
454d_phostname=''
455d_uname=''
10bc17b6
JH
456d_gethostbyaddr_r=''
457gethostbyaddr_r_proto=''
458d_gethostbyname_r=''
459gethostbyname_r_proto=''
460d_gethostent_r=''
461gethostent_r_proto=''
b4eb6b3d 462d_gethostprotos=''
4e0554ec 463d_getitimer=''
b4eb6b3d 464d_getlogin=''
10bc17b6
JH
465d_getlogin_r=''
466getlogin_r_proto=''
b4eb6b3d
JH
467d_getmnt=''
468d_getmntent=''
469d_getnbyaddr=''
470d_getnbyname=''
471d_getnent=''
10bc17b6
JH
472d_getnetbyaddr_r=''
473getnetbyaddr_r_proto=''
474d_getnetbyname_r=''
475getnetbyname_r_proto=''
476d_getnetent_r=''
477getnetent_r_proto=''
b4eb6b3d 478d_getnetprotos=''
0c0643d0 479d_getpagsz=''
b4eb6b3d
JH
480d_getpent=''
481d_getpgid=''
482d_getpgrp2=''
483d_bsdgetpgrp=''
484d_getpgrp=''
485d_getppid=''
486d_getprior=''
487d_getpbyname=''
488d_getpbynumber=''
10bc17b6
JH
489d_getprotobyname_r=''
490getprotobyname_r_proto=''
491d_getprotobynumber_r=''
492getprotobynumber_r_proto=''
493d_getprotoent_r=''
494getprotoent_r_proto=''
b4eb6b3d
JH
495d_getprotoprotos=''
496d_getprpwnam=''
497d_getpwent=''
10bc17b6
JH
498d_getpwent_r=''
499getpwent_r_proto=''
500d_getpwnam_r=''
501getpwnam_r_proto=''
502d_getpwuid_r=''
503getpwuid_r_proto=''
b4eb6b3d 504d_getsent=''
10bc17b6
JH
505d_getservbyname_r=''
506getservbyname_r_proto=''
507d_getservbyport_r=''
508getservbyport_r_proto=''
509d_getservent_r=''
510getservent_r_proto=''
b4eb6b3d
JH
511d_getservprotos=''
512d_getspnam=''
10bc17b6
JH
513d_getspnam_r=''
514getspnam_r_proto=''
b4eb6b3d
JH
515d_getsbyname=''
516d_getsbyport=''
10bc17b6
JH
517d_gmtime_r=''
518gmtime_r_proto=''
a4f3eea9 519d_gnulibc=''
5f6e0ee4 520gnulibc_version=''
b4eb6b3d
JH
521d_hasmntopt=''
522d_htonl=''
55954f19 523d_ilogbl=''
b4eb6b3d
JH
524d_inetaton=''
525d_int64_t=''
526d_isascii=''
758a5d79
JH
527d_isfinite=''
528d_isinf=''
b4eb6b3d
JH
529d_isnan=''
530d_isnanl=''
531d_killpg=''
532d_lchown=''
533d_ldbl_dig=''
0a0abfba 534d_libm_lib_version=''
b4eb6b3d 535d_link=''
10bc17b6
JH
536d_localtime_r=''
537localtime_r_proto=''
b4eb6b3d
JH
538d_locconv=''
539d_lockf=''
540d_longdbl=''
541longdblsize=''
542d_longlong=''
543longlongsize=''
544d_lseekproto=''
545d_lstat=''
546d_madvise=''
547d_mblen=''
548d_mbstowcs=''
549d_mbtowc=''
550d_memchr=''
551d_memcmp=''
552d_memcpy=''
553d_memmove=''
554d_memset=''
555d_mkdir=''
556d_mkdtemp=''
557d_mkfifo=''
558d_mkstemp=''
559d_mkstemps=''
560d_mktime=''
561d_mmap=''
562mmaptype=''
563d_modfl=''
e67aeab1 564d_modfl_pow32_bug=''
bc9a1b2c 565d_modflproto=''
b4eb6b3d
JH
566d_mprotect=''
567d_msg=''
568d_msgctl=''
569d_msgget=''
4e0554ec 570d_msghdr_s=''
b4eb6b3d
JH
571d_msgrcv=''
572d_msgsnd=''
573d_msync=''
574d_munmap=''
575d_nice=''
2765b840 576d_nl_langinfo=''
b4eb6b3d
JH
577d_off64_t=''
578d_open3=''
579d_fpathconf=''
580d_pathconf=''
581d_pause=''
582d_pipe=''
583d_poll=''
2304df62 584d_portable=''
a33c94aa 585d_procselfexe=''
f24dbf84 586procselfexe=''
b4eb6b3d
JH
587d_old_pthread_create_joinable=''
588old_pthread_create_joinable=''
d6483fcc 589d_pthread_atfork=''
58d975c3 590d_pthread_attr_setscope=''
b4eb6b3d
JH
591d_pthread_yield=''
592d_sched_yield=''
593sched_yield=''
594d_qgcvt=''
10bc17b6
JH
595d_random_r=''
596random_r_proto=''
597d_readdir64_r=''
598readdir64_r_proto=''
b4eb6b3d
JH
599d_readdir=''
600d_rewinddir=''
601d_seekdir=''
602d_telldir=''
10bc17b6
JH
603d_readdir_r=''
604readdir_r_proto=''
b4eb6b3d 605d_readlink=''
4e0554ec
JH
606d_readv=''
607d_recvmsg=''
b4eb6b3d
JH
608d_rename=''
609d_rmdir=''
610d_safebcpy=''
611d_safemcpy=''
612d_sanemcmp=''
ef9f17be 613d_sbrkproto=''
55954f19 614d_scalbnl=''
b4eb6b3d
JH
615d_select=''
616d_sem=''
617d_semctl=''
618d_semget=''
619d_semop=''
4e0554ec 620d_sendmsg=''
b4eb6b3d
JH
621d_setegid=''
622d_seteuid=''
623d_setgrent=''
10bc17b6
JH
624d_setgrent_r=''
625setgrent_r_proto=''
b4eb6b3d
JH
626d_setgrps=''
627d_sethent=''
10bc17b6
JH
628d_sethostent_r=''
629sethostent_r_proto=''
4e0554ec 630d_setitimer=''
b4eb6b3d
JH
631d_setlinebuf=''
632d_setlocale=''
10bc17b6
JH
633d_setlocale_r=''
634setlocale_r_proto=''
b4eb6b3d 635d_setnent=''
10bc17b6
JH
636d_setnetent_r=''
637setnetent_r_proto=''
b4eb6b3d
JH
638d_setpent=''
639d_setpgid=''
640d_setpgrp2=''
641d_bsdsetpgrp=''
642d_setpgrp=''
643d_setprior=''
644d_setproctitle=''
10bc17b6
JH
645d_setprotoent_r=''
646setprotoent_r_proto=''
b4eb6b3d 647d_setpwent=''
10bc17b6
JH
648d_setpwent_r=''
649setpwent_r_proto=''
b4eb6b3d
JH
650d_setregid=''
651d_setresgid=''
652d_setresuid=''
653d_setreuid=''
654d_setrgid=''
655d_setruid=''
656d_setsent=''
10bc17b6
JH
657d_setservent_r=''
658setservent_r_proto=''
b4eb6b3d
JH
659d_setsid=''
660d_setvbuf=''
661d_sfio=''
662usesfio=''
663d_shm=''
664d_shmat=''
665d_shmatprototype=''
666shmattype=''
667d_shmctl=''
668d_shmdt=''
669d_shmget=''
670d_sigaction=''
983dbef6 671d_sigprocmask=''
b4eb6b3d 672d_sigsetjmp=''
5f106f9c 673usesitecustomize=''
49a78c82 674d_sockatmark=''
2ef53570 675d_sockatmarkproto=''
b4eb6b3d
JH
676d_msg_ctrunc=''
677d_msg_dontroute=''
678d_msg_oob=''
679d_msg_peek=''
680d_msg_proxy=''
681d_oldsock=''
682d_scm_rights=''
683d_socket=''
684d_sockpair=''
685sockethdr=''
686socketlib=''
687d_socklen_t=''
688d_socks5_init=''
689d_sqrtl=''
10bc17b6
JH
690d_srand48_r=''
691srand48_r_proto=''
692d_srandom_r=''
693srandom_r_proto=''
eef837ea 694d_sresgproto=''
640374d0 695d_sresuproto=''
b4eb6b3d
JH
696d_statblks=''
697d_statfs_f_flags=''
698d_statfs_s=''
699d_fstatvfs=''
700d_statvfs=''
701d_stdio_cnt_lval=''
702d_stdio_ptr_lval=''
a7ffa9b9
NC
703d_stdio_ptr_lval_nochange_cnt=''
704d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
705d_stdiobase=''
706d_stdstdio=''
707stdio_base=''
708stdio_bufsiz=''
709stdio_cnt=''
710stdio_filbuf=''
711stdio_ptr=''
712d_index=''
713d_strchr=''
714d_strcoll=''
715d_strctcpy=''
716d_strerrm=''
717d_strerror=''
718d_sysernlst=''
719d_syserrlst=''
10bc17b6
JH
720d_strerror_r=''
721strerror_r_proto=''
b3c85772 722d_strftime=''
08c92000
MB
723d_strlcat=''
724d_strlcpy=''
b4eb6b3d
JH
725d_strtod=''
726d_strtol=''
727d_strtold=''
728d_strtoll=''
28e5dec8 729d_strtoq=''
b4eb6b3d
JH
730d_strtoul=''
731d_strtoull=''
732d_strtouq=''
733d_strxfrm=''
734d_symlink=''
735d_syscall=''
2ef53570 736d_syscallproto=''
b4eb6b3d
JH
737d_sysconf=''
738d_system=''
739d_tcgetpgrp=''
740d_tcsetpgrp=''
741d_telldirproto=''
742d_time=''
743timetype=''
744clocktype=''
745d_times=''
10bc17b6
JH
746d_tmpnam_r=''
747tmpnam_r_proto=''
b4eb6b3d 748d_truncate=''
10bc17b6
JH
749d_ttyname_r=''
750ttyname_r_proto=''
b4eb6b3d 751d_tzname=''
4e0554ec
JH
752d_u32align=''
753d_ualarm=''
b4eb6b3d
JH
754d_umask=''
755d_semctl_semid_ds=''
756d_semctl_semun=''
757d_union_semun=''
758a5d79 758d_unordered=''
4e0554ec 759d_usleep=''
2ef53570 760d_usleepproto=''
b4eb6b3d
JH
761d_ustat=''
762d_vfork=''
763usevfork=''
764d_voidsig=''
765signal_t=''
766d_volatile=''
767d_charvspr=''
768d_vprintf=''
769d_wait4=''
770d_waitpid=''
771d_wcstombs=''
772d_wctomb=''
4e0554ec 773d_writev=''
b4eb6b3d 774dlext=''
85e6fe83
LW
775cccdlflags=''
776ccdlflags=''
2304df62 777dlsrc=''
232e078e 778ld=''
85e6fe83 779lddlflags=''
2304df62 780usedl=''
b4eb6b3d
JH
781doublesize=''
782ebcdic=''
783fflushNULL=''
784fflushall=''
785fpossize=''
786fpostype=''
2d736872 787gccansipedantic=''
5b463ca7 788gccosandvers=''
8a27cf78 789gccversion=''
b4eb6b3d
JH
790gidformat=''
791gidsign=''
792gidsize=''
793gidtype=''
794groupstype=''
795h_fcntl=''
796h_sysfile=''
6e1038e0
MB
797html1dir=''
798html1direxp=''
799installhtml1dir=''
800html3dir=''
801html3direxp=''
802installhtml3dir=''
b4eb6b3d 803i_arpainet=''
10bc17b6 804i_crypt=''
b4eb6b3d
JH
805db_hashtype=''
806db_prefixtype=''
640374d0
JH
807db_version_major=''
808db_version_minor=''
809db_version_patch=''
b4eb6b3d
JH
810i_db=''
811i_dbm=''
812i_rpcsvcdbm=''
813d_dirnamlen=''
814direntrytype=''
815i_dirent=''
a0d0e21e 816i_dld=''
b4eb6b3d
JH
817i_dlfcn=''
818i_fcntl=''
819i_float=''
758a5d79
JH
820i_fp=''
821i_fp_class=''
b4eb6b3d
JH
822i_gdbm=''
823d_grpasswd=''
824i_grp=''
b4eb6b3d
JH
825i_ieeefp=''
826i_inttypes=''
2765b840 827i_langinfo=''
b4eb6b3d
JH
828i_libutil=''
829i_limits=''
830i_locale=''
831i_machcthr=''
832i_malloc=''
833i_math=''
834i_memory=''
835i_mntent=''
836i_ndbm=''
837i_netdb=''
838i_neterrno=''
839i_netinettcp=''
840i_niin=''
841i_sysin=''
842i_poll=''
843i_prot=''
844i_pthread=''
845d_pwage=''
846d_pwchange=''
847d_pwclass=''
848d_pwcomment=''
849d_pwexpire=''
850d_pwgecos=''
851d_pwpasswd=''
852d_pwquota=''
853i_pwd=''
854i_sfio=''
855i_shadow=''
856i_socks=''
857i_stddef=''
858i_stdlib=''
859i_string=''
860strings=''
861i_sunmath=''
862i_sysaccess=''
863i_sysdir=''
864i_sysfile=''
865d_voidtty=''
866i_bsdioctl=''
867i_sysfilio=''
868i_sysioctl=''
869i_syssockio=''
870i_syslog=''
871i_sysmman=''
872i_sysmode=''
873i_sysmount=''
874i_sysndir=''
875i_sysparam=''
876i_sysresrc=''
877i_syssecrt=''
878i_sysselct=''
879i_sysstat=''
880i_sysstatfs=''
881i_sysstatvfs=''
882i_systimes=''
883i_systypes=''
884i_sysuio=''
885i_sysun=''
886i_sysutsname=''
887i_sysvfs=''
888i_syswait=''
889i_sgtty=''
890i_termio=''
891i_termios=''
14b90194
JH
892d_tm_tm_gmtoff=''
893d_tm_tm_zone=''
b4eb6b3d
JH
894i_systime=''
895i_systimek=''
896i_time=''
897timeincl=''
898i_unistd=''
899i_ustat=''
900i_utime=''
901i_values=''
902i_stdarg=''
903i_varargs=''
904i_varhdr=''
905i_vfork=''
906inc_version_list=''
907inc_version_list_init=''
908installprefix=''
909installprefixexp=''
910installstyle=''
911installusrbinperl=''
912intsize=''
913longsize=''
914shortsize=''
4b661809 915issymlink=''
2304df62 916libc=''
b4eb6b3d
JH
917ldlibpthname=''
918libperl=''
919shrpenv=''
920useshrplib=''
a0d0e21e 921glibpth=''
2304df62 922libpth=''
8e07c86e 923loclibpth=''
2304df62
AD
924plibpth=''
925xlibpth=''
1cfa4ec7 926ignore_versioned_solibs=''
2304df62 927libs=''
43999f95
JH
928libsdirs=''
929libsfiles=''
930libsfound=''
13b3f787 931libspath=''
85e6fe83 932lns=''
b4eb6b3d
JH
933d_PRIEUldbl=''
934d_PRIFUldbl=''
935d_PRIGUldbl=''
936d_PRIeldbl=''
937d_PRIfldbl=''
938d_PRIgldbl=''
939d_SCNfldbl=''
940sPRIEUldbl=''
941sPRIFUldbl=''
942sPRIGUldbl=''
943sPRIeldbl=''
944sPRIfldbl=''
945sPRIgldbl=''
946sSCNfldbl=''
947lseeksize=''
948lseektype=''
8ff267be 949make_set_make=''
b4eb6b3d
JH
950d_mymalloc=''
951freetype=''
952mallocobj=''
953mallocsrc=''
954malloctype=''
9df442c2 955usemallocwrap=''
b4eb6b3d
JH
956usemymalloc=''
957installman1dir=''
958man1dir=''
959man1direxp=''
960man1ext=''
961installman3dir=''
962man3dir=''
963man3direxp=''
964man3ext=''
965modetype=''
966multiarch=''
967mydomain=''
968myhostname=''
969phostname=''
2304df62
AD
970c=''
971n=''
b4eb6b3d
JH
972d_eofnblk=''
973eagain=''
974o_nonblock=''
975rd_nodata=''
2cc61e15 976need_va_copy=''
b4eb6b3d
JH
977netdb_hlen_type=''
978netdb_host_type=''
979netdb_name_type=''
980netdb_net_type=''
981groupcat=''
982hostcat=''
983passcat=''
984orderlib=''
985ranlib=''
986d_perl_otherlibdirs=''
987otherlibdirs=''
2304df62
AD
988package=''
989spackage=''
b4eb6b3d
JH
990pager=''
991api_revision=''
992api_subversion=''
993api_version=''
994api_versionstring=''
995patchlevel=''
151e6568 996perl_patchlevel=''
b4eb6b3d
JH
997revision=''
998subversion=''
999version=''
861eb78d 1000version_patchlevel_string=''
b4eb6b3d
JH
1001perl5=''
1002perladmin=''
1003perlpath=''
1004d_nv_preserves_uv=''
b4eb6b3d
JH
1005i16size=''
1006i16type=''
1007i32size=''
1008i32type=''
1009i64size=''
1010i64type=''
1011i8size=''
1012i8type=''
1013ivsize=''
1014ivtype=''
53133ed1 1015nv_preserves_uv_bits=''
b4eb6b3d
JH
1016nvsize=''
1017nvtype=''
1018u16size=''
1019u16type=''
1020u32size=''
1021u32type=''
1022u64size=''
1023u64type=''
1024u8size=''
1025u8type=''
1026uvsize=''
1027uvtype=''
1028ivdformat=''
1029nvEUformat=''
1030nvFUformat=''
1031nvGUformat=''
1032nveformat=''
1033nvfformat=''
1034nvgformat=''
1035uvXUformat=''
1036uvoformat=''
1037uvuformat=''
1038uvxformat=''
1039pidtype=''
1040prefix=''
1041prefixexp=''
1042installprivlib=''
1043privlib=''
1044privlibexp=''
1045prototype=''
1046ptrsize=''
1047d_PRIXU64=''
1048d_PRId64=''
1049d_PRIi64=''
1050d_PRIo64=''
1051d_PRIu64=''
1052d_PRIx64=''
1053sPRIXU64=''
1054sPRId64=''
1055sPRIi64=''
1056sPRIo64=''
1057sPRIu64=''
1058sPRIx64=''
1059d_quad=''
1060quadkind=''
1061quadtype=''
1062uquadtype=''
1063drand01=''
1064randbits=''
1065randfunc=''
1066randseedtype=''
1067seedfunc=''
1068installscript=''
1069scriptdir=''
1070scriptdirexp=''
1071selectminbits=''
1072selecttype=''
8ff267be 1073sh=''
b4eb6b3d
JH
1074sig_count=''
1075sig_name=''
1076sig_name_init=''
1077sig_num=''
1078sig_num_init=''
76d3c696 1079sig_size=''
b4eb6b3d
JH
1080installsitearch=''
1081sitearch=''
1082sitearchexp=''
1083installsitebin=''
1084sitebin=''
1085sitebinexp=''
8d2cbf27
JH
1086installsitehtml1dir=''
1087sitehtml1dir=''
1088sitehtml1direxp=''
1089installsitehtml3dir=''
1090sitehtml3dir=''
1091sitehtml3direxp=''
b4eb6b3d
JH
1092installsitelib=''
1093sitelib=''
1094sitelib_stem=''
1095sitelibexp=''
91e123a8
JH
1096installsiteman1dir=''
1097siteman1dir=''
1098siteman1direxp=''
1099installsiteman3dir=''
1100siteman3dir=''
1101siteman3direxp=''
b4eb6b3d
JH
1102siteprefix=''
1103siteprefixexp=''
6e1038e0
MB
1104installsitescript=''
1105sitescript=''
1106sitescriptexp=''
b4eb6b3d
JH
1107sizesize=''
1108sizetype=''
a0d0e21e 1109so=''
b4eb6b3d 1110socksizetype=''
2304df62
AD
1111sharpbang=''
1112shsharp=''
1113spitshell=''
dfe9444c 1114src=''
b4eb6b3d
JH
1115ssizetype=''
1116startperl=''
2304df62 1117startsh=''
b4eb6b3d
JH
1118stdchar=''
1119d_stdio_stream_array=''
1120stdio_stream_array=''
1121sysman=''
5ff3f7a4 1122trnl=''
b4eb6b3d
JH
1123uidformat=''
1124uidsign=''
1125uidsize=''
1126uidtype=''
1127archname64=''
1128use64bitall=''
1129use64bitint=''
15b61c98 1130usefaststdio=''
b4eb6b3d
JH
1131ccflags_uselargefiles=''
1132ldflags_uselargefiles=''
1133libswanted_uselargefiles=''
1134uselargefiles=''
1135uselongdouble=''
1136usemorebits=''
1137usemultiplicity=''
2304df62 1138nm_opt=''
40a7a20a 1139nm_so_opt=''
2304df62
AD
1140runnm=''
1141usenm=''
b4eb6b3d 1142useperlio=''
db0f2be4 1143userelocatableinc=''
29209bc5 1144usesocks=''
b4eb6b3d
JH
1145d_oldpthreads=''
1146use5005threads=''
1147useithreads=''
9514c62b 1148usereentrant=''
b4eb6b3d 1149usethreads=''
2304df62 1150incpath=''
2304df62
AD
1151mips_type=''
1152usrinc=''
b4eb6b3d
JH
1153d_vendorarch=''
1154installvendorarch=''
1155vendorarch=''
1156vendorarchexp=''
1157d_vendorbin=''
1158installvendorbin=''
1159vendorbin=''
1160vendorbinexp=''
8d2cbf27
JH
1161installvendorhtml1dir=''
1162vendorhtml1dir=''
1163vendorhtml1direxp=''
1164installvendorhtml3dir=''
1165vendorhtml3dir=''
1166vendorhtml3direxp=''
b4eb6b3d
JH
1167d_vendorlib=''
1168installvendorlib=''
1169vendorlib=''
1170vendorlib_stem=''
1171vendorlibexp=''
91e123a8
JH
1172installvendorman1dir=''
1173vendorman1dir=''
1174vendorman1direxp=''
1175installvendorman3dir=''
1176vendorman3dir=''
1177vendorman3direxp=''
b4eb6b3d
JH
1178usevendorprefix=''
1179vendorprefix=''
1180vendorprefixexp=''
6e1038e0
MB
1181d_vendorscript=''
1182installvendorscript=''
1183vendorscript=''
1184vendorscriptexp=''
d56c5707 1185versiononly=''
b4eb6b3d
JH
1186defvoidused=''
1187voidflags=''
3659ebf1
JH
1188yacc=''
1189yaccflags=''
2304df62
AD
1190CONFIG=''
1191
ecfc5424
AD
1192define='define'
1193undef='undef'
1194smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1195rmlist=''
1196
1197: We must find out about Eunice early
1198eunicefix=':'
1199if test -f /etc/unixtovms; then
1200 eunicefix=/etc/unixtovms
1201fi
1202if test -f /etc/unixtovms.exe; then
1203 eunicefix=/etc/unixtovms.exe
1204fi
1205
cfb04860 1206: Set executable suffix now -- needed before hints available
6153ba32
PG
1207if test -f "/libs/version.library"; then
1208: Amiga OS
1209 _exe=""
1210elif test -f "/system/gnu_library/bin/ar.pm"; then
1211: Stratus VOS
cfb04860 1212 _exe=".pm"
6153ba32
PG
1213elif test -n "$DJGPP"; then
1214: DOS DJGPP
cfb04860 1215 _exe=".exe"
5c728af0 1216elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1217: OS/2 or cygwin
ba863942
JH
1218 _exe=".exe"
1219fi
868439a2 1220
b4eb6b3d 1221i_whoami=''
9da7673b
MB
1222ccname=''
1223ccversion=''
1224perllibs=''
1225: set useposix=false in your hint file to disable the POSIX extension.
1226useposix=true
1227: set useopcode=false in your hint file to disable the Opcode extension.
1228useopcode=true
1229: Trailing extension. Override this in a hint file, if needed.
1230: Extra object files, if any, needed on this platform.
1231archobjs=''
1232archname=''
ff935051
JH
1233: Possible local include directories to search.
1234: Set locincpth to "" in a hint file to defeat local include searches.
1235locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1236locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1237:
1238: no include file wanted by default
1239inclwanted=''
1240
b4eb6b3d 1241groupstype=''
64615a5e 1242libnames=''
732c9516
JH
1243: change the next line if compiling for Xenix/286 on Xenix/386
1244xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1245: Possible local library directories to search.
1246loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1247loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1248
1249: general looking path for locating libraries
5869b1f1 1250glibpth="/lib /usr/lib $xlibpth"
732c9516 1251glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1252test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1253test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1254
1255: Private path used by Configure to find libraries. Its value
1256: is prepended to libpth. This variable takes care of special
1257: machines, like the mips. Usually, it should be empty.
1258plibpth=''
1259
1cfa4ec7
GS
1260: default library list
1261libswanted=''
921b2963 1262: some systems want to use only the non-versioned libso:s
1cfa4ec7 1263ignore_versioned_solibs=''
9da7673b
MB
1264siteman1dir=''
1265siteman3dir=''
1266sitescript=''
b4eb6b3d
JH
1267archname64=''
1268ccflags_uselargefiles=''
1269ldflags_uselargefiles=''
1270libswanted_uselargefiles=''
1271: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1272: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1273: set usethreads on the Configure command line to enable threads.
cd040c5e 1274usereentrant='undef'
9da7673b
MB
1275: full support for void wanted by default
1276defvoidused=15
1277
ecfc5424 1278: List of libraries we want.
15431986 1279: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1280libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1281libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1282: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1283: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1284glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1285glibpth="/usr/shlib $glibpth"
1286: Do not use vfork unless overridden by a hint file.
1287usevfork=false
1288
8ff267be 1289: Find the basic shell for Bourne shell scripts
1290case "$sh" in
1291'')
8ff267be 1292 case "$SYSTYPE" in
1293 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1294 *) xxx='/bin/sh';;
1295 esac
1296 if test -f "$xxx"; then
1297 sh="$xxx"
1298 else
1299 : Build up a list and do a single loop so we can 'break' out.
1300 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1301 for xxx in sh bash ksh pdksh ash; do
1302 for p in $pth; do
1303 try="$try ${p}/${xxx}"
1304 done
1305 done
1306 for xxx in $try; do
1307 if test -f "$xxx"; then
1308 sh="$xxx";
8ff267be 1309 break
a5a94ea5
JH
1310 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1311 sh="$xxx";
1312 break
8ff267be 1313 elif test -f "$xxx.exe"; then
1314 sh="$xxx";
8ff267be 1315 break
1316 fi
1317 done
1318 fi
1319 ;;
1320esac
1321
1322case "$sh" in
a33c94aa 1323'') cat >&2 <<EOM
8ff267be 1324$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1325
8ff267be 1326Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1327Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1328we'll try to straighten this all out.
8ff267be 1329EOM
1330 exit 1
1331 ;;
1332esac
1333
760ac839 1334: see if sh knows # comments
73614538 1335if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1336 shsharp=true
1337 spitshell=cat
760ac839 1338 xcat=/bin/cat
a931254c
JH
1339 test -f $xcat$_exe || xcat=/usr/bin/cat
1340 if test ! -f $xcat$_exe; then
4bdb8fb5 1341 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1342 if test -f $p/cat$_exe; then
1deb0a86 1343 xcat=$p/cat
3c728e00
JH
1344 break
1345 fi
1346 done
1deb0a86
JH
1347 if test ! -f $xcat$_exe; then
1348 echo "Can't find cat anywhere!"
3c728e00
JH
1349 exit 1
1350 fi
1351 fi
5440bc8e
JH
1352 echo "#!$xcat" >sharp
1353 $eunicefix sharp
1354 chmod +x sharp
1355 ./sharp > today
760ac839 1356 if test -s today; then
760ac839
LW
1357 sharpbang='#!'
1358 else
5440bc8e
JH
1359 echo "#! $xcat" > sharp
1360 $eunicefix sharp
1361 chmod +x sharp
1362 ./sharp > today
760ac839 1363 if test -s today; then
760ac839
LW
1364 sharpbang='#! '
1365 else
760ac839
LW
1366 sharpbang=': use '
1367 fi
1368 fi
1369else
dfe9444c 1370 echo " "
8ff267be 1371 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1372 shsharp=false
1373 cd ..
1374 echo "exec grep -v '^[ ]*#'" >spitshell
1375 chmod +x spitshell
1376 $eunicefix spitshell
1377 spitshell=`pwd`/spitshell
1378 cd UU
1379 echo "I presume that if # doesn't work, #! won't work either!"
1380 sharpbang=': use '
1381fi
5440bc8e 1382rm -f sharp today
760ac839
LW
1383
1384: figure out how to guarantee sh startup
8ff267be 1385case "$startsh" in
1386'') startsh=${sharpbang}${sh} ;;
1387*)
760ac839 1388esac
5440bc8e 1389cat >sharp <<EOSS
760ac839
LW
1390$startsh
1391set abc
1392test "$?abc" != 1
1393EOSS
1394
5440bc8e
JH
1395chmod +x sharp
1396$eunicefix sharp
1397if ./sharp; then
8ff267be 1398 : echo "Yup, it does."
760ac839 1399else
dfe9444c
AD
1400 echo "Hmm... '$startsh' does not guarantee sh startup..."
1401 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1402fi
5440bc8e 1403rm -f sharp
760ac839 1404
aebf16e7
AD
1405
1406: Save command line options in file UU/cmdline.opt for later use in
1407: generating config.sh.
1408cat > cmdline.opt <<EOSH
1409# Configure command line arguments.
1410config_arg0='$0'
1411config_args='$*'
1412config_argc=$#
1413EOSH
1414argn=1
ee45ea83
IZ
1415args_exp=''
1416args_sep=''
aebf16e7
AD
1417for arg in "$@"; do
1418 cat >>cmdline.opt <<EOSH
1419config_arg$argn='$arg'
1420EOSH
ee45ea83
IZ
1421 # Extreme backslashitis: replace each ' by '"'"'
1422 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1423$arg
1424EOC
1425 arg_exp=`cat cmdl.opt`
1426 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1427 argn=`expr $argn + 1`
ee45ea83 1428 args_sep=' '
aebf16e7 1429done
ee45ea83
IZ
1430# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1431# used by ./hints/os2.sh
1432rm -f cmdl.opt
aebf16e7 1433
2304df62
AD
1434: produce awk script to parse command line options
1435cat >options.awk <<'EOF'
1436BEGIN {
02e93a22 1437 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1438
1439 len = length(optstr);
1440 for (i = 1; i <= len; i++) {
1441 c = substr(optstr, i, 1);
1442 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1443 if (a == ":") {
1444 arg[c] = 1;
1445 i++;
1446 }
1447 opt[c] = 1;
1448 }
1449}
1450{
1451 expect = 0;
1452 str = $0;
1453 if (substr(str, 1, 1) != "-") {
1454 printf("'%s'\n", str);
1455 next;
1456 }
1457 len = length($0);
1458 for (i = 2; i <= len; i++) {
1459 c = substr(str, i, 1);
1460 if (!opt[c]) {
1461 printf("-%s\n", substr(str, i));
1462 next;
1463 }
1464 printf("-%s\n", c);
1465 if (arg[c]) {
1466 if (i < len)
1467 printf("'%s'\n", substr(str, i + 1));
1468 else
1469 expect = 1;
1470 next;
1471 }
1472 }
1473}
1474END {
1475 if (expect)
1476 print "?";
1477}
1478EOF
1479
1480: process the command line options
4633a7c4
LW
1481set X `for arg in "$@"; do echo "X$arg"; done |
1482 sed -e s/X// | awk -f options.awk`
2304df62
AD
1483eval "set $*"
1484shift
1485rm -f options.awk
1486
1487: set up default values
1488fastread=''
1489reuseval=false
1490config_sh=''
1491alldone=''
1492error=''
1493silent=''
1494extractsh=''
ecfc5424 1495override=''
16d20bd9 1496knowitall=''
02e93a22 1497rm -f optdef.sh posthint.sh
28757baa 1498cat >optdef.sh <<EOS
1499$startsh
1500EOS
2304df62 1501
dfe9444c 1502
2304df62
AD
1503: option parsing
1504while test $# -gt 0; do
1505 case "$1" in
1506 -d) shift; fastread=yes;;
1507 -e) shift; alldone=cont;;
1508 -f)
1509 shift
1510 cd ..
1511 if test -r "$1"; then
1512 config_sh="$1"
1513 else
a0d0e21e 1514 echo "$me: cannot read config file $1." >&2
2304df62
AD
1515 error=true
1516 fi
1517 cd UU
1518 shift;;
1519 -h) shift; error=true;;
1520 -r) shift; reuseval=true;;
dfe9444c 1521 -s) shift; silent=true; realsilent=true;;
2304df62 1522 -E) shift; alldone=exit;;
16d20bd9 1523 -K) shift; knowitall=true;;
ecfc5424 1524 -O) shift; override=true;;
dfe9444c 1525 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1526 -D)
1527 shift
1528 case "$1" in
1529 *=)
1530 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1531 echo "$me: ignoring -D $1" >&2
1532 ;;
ecfc5424 1533 *=*) echo "$1" | \
1aef975c
AD
1534 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1535 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1536 esac
1537 shift
1538 ;;
1539 -U)
1540 shift
1541 case "$1" in
1aef975c 1542 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1543 *=*)
1544 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1545 echo "$me: ignoring -U $1" >&2
1546 ;;
1aef975c 1547 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1548 esac
1549 shift
1550 ;;
02e93a22
JH
1551 -A)
1552 shift
1553 xxx=''
1554 yyy="$1"
02e93a22 1555 zzz=''
5f83a3e9 1556 uuu=undef
02e93a22 1557 case "$yyy" in
f7c31117 1558 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1559 case "$zzz" in
1560 *:*) zzz='' ;;
1561 *) xxx=append
f7c31117
JH
1562 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1563 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1564 esac
1565 ;;
1566 esac
1567 case "$xxx" in
1568 '') case "$yyy" in
f7c31117
JH
1569 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1570 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1571 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1572 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1573 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1574 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1575 esac
1576 ;;
1577 esac
02e93a22
JH
1578 case "$xxx" in
1579 append)
5f83a3e9 1580 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1581 clear)
5f83a3e9 1582 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1583 define)
1584 case "$zzz" in
1585 '') zzz=define ;;
1586 esac
5f83a3e9 1587 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1588 eval)
5f83a3e9 1589 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1590 prepend)
5f83a3e9 1591 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1592 undef)
1593 case "$zzz" in
1594 '') zzz="$uuu" ;;
1595 esac
5f83a3e9
JH
1596 echo "$yyy=$zzz" >> posthint.sh ;;
1597 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1598 esac
bde6b06b 1599 shift
02e93a22 1600 ;;
dfe9444c 1601 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1602 exit 0;;
2304df62 1603 --) break;;
a0d0e21e 1604 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1605 *) break;;
1606 esac
1607done
1608
1609case "$error" in
1610true)
1611 cat >&2 <<EOM
2afac517 1612Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1613 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1614 -d : use defaults for all answers.
1615 -e : go on without questioning past the production of config.sh.
1616 -f : specify an alternate default configuration file.
1617 -h : print this help message and exit (with an error status).
1618 -r : reuse C symbols value if possible (skips costly nm extraction).
1619 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1620 -D : define symbol to have some value:
1621 -D symbol symbol gets the value 'define'
1622 -D symbol=value symbol gets the value 'value'
2304df62 1623 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1624 -K : do not use unless you know what you are doing.
ecfc5424 1625 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1626 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1627 -U : undefine symbol:
1628 -U symbol symbol gets the value 'undef'
1629 -U symbol= symbol gets completely empty
02e93a22 1630 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1631 -A symbol=value append " "value to symbol
02e93a22
JH
1632 -A append:symbol=value append value to symbol
1633 -A define:symbol=value define symbol to have value
02e93a22
JH
1634 -A clear:symbol define symbol to be ''
1635 -A define:symbol define symbol to be 'define'
1636 -A eval:symbol=value define symbol to be eval of value
1637 -A prepend:symbol=value prepend value to symbol
1638 -A undef:symbol define symbol to be 'undef'
1639 -A undef:symbol= define symbol to be ''
2304df62
AD
1640 -V : print version number and exit (with a zero status).
1641EOM
1642 exit 1
1643 ;;
1644esac
1645
dfe9444c
AD
1646: Sanity checks
1647case "$fastread$alldone" in
1648yescont|yesexit) ;;
1649*)
aaeb8e51
GS
1650 case "$extractsh" in
1651 true) ;;
1652 *)
1653 if test ! -t 0; then
1654 echo "Say 'sh Configure', not 'sh <Configure'"
1655 exit 1
1656 fi
1657 ;;
1658 esac
dfe9444c
AD
1659 ;;
1660esac
1661
2304df62
AD
1662exec 4>&1
1663case "$silent" in
1664true) exec 1>/dev/null;;
1665esac
1666
ecfc5424 1667: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1668touch optdef.sh
1669. ./optdef.sh
02e93a22
JH
1670: create the posthint manipulation script and leave the file out there...
1671touch posthint.sh
a0d0e21e 1672
2304df62 1673: set package name
85e6fe83 1674package=perl5
b4eb6b3d
JH
1675first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1676last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1677case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1678ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1679*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1680esac
2304df62 1681
2304df62
AD
1682: Some greps do not return status, grrr.
1683echo "grimblepritz" >grimble
1684if grep blurfldyick grimble >/dev/null 2>&1 ; then
1685 contains=contains
1686elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1687 contains=grep
1688else
1689 contains=contains
1690fi
1691rm -f grimble
1692: the following should work in any shell
1693case "$contains" in
1694contains*)
1695 echo " "
1696 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1697 cat >contains <<'EOSS'
1698grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1699EOSS
1700chmod +x contains
1701esac
1702
dfe9444c
AD
1703: Find the path to the source tree
1704case "$src" in
1705'') case "$0" in
b233458b
JH
1706 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1707 case "$src" in
1708 /*) ;;
8504afb7 1709 .) ;;
b233458b
JH
1710 *) src=`cd ../$src && pwd` ;;
1711 esac
1712 ;;
dfe9444c
AD
1713 *) src='.';;
1714 esac;;
1715esac
1716case "$src" in
1717'') src=/
1718 rsrc=/
1719 ;;
1720/*) rsrc="$src";;
1721*) rsrc="../$src";;
1722esac
1723if test -f $rsrc/Configure && \
1724 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1725then
1726 : found it, so we are ok.
1727else
1728 rsrc=''
1729 for src in . .. ../.. ../../.. ../../../..; do
1730 if test -f ../$src/Configure && \
1731 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1732 then
1733 rsrc=../$src
1734 break
1735 fi
1736 done
1737fi
1738case "$rsrc" in
1739'')
1740 cat <<EOM >&4
1741
1742Sorry, I can't seem to locate the source dir for $package. Please start
1743Configure with an explicit path -- i.e. /some/path/Configure.
1744
1745EOM
1746 exit 1
1747 ;;
1748../.) rsrc='..';;
1749*)
1750 echo " "
1751 echo "Sources for $package found in \"$src\"." >&4
1752 ;;
1753esac
1754
1755: script used to extract .SH files with variable substitutions
1756cat >extract <<'EOS'
a02608de 1757PERL_CONFIG_SH=true
dfe9444c 1758echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1759if test -f MANIFEST; then
1760 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1761else
1762 echo "(Looking for .SH files under the source directory.)"
6904989c 1763 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1764fi
1765shift
1766case $# in
6904989c 17670) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1768esac
6904989c 1769if test ! -f "$src/$1"; then
dfe9444c
AD
1770 shift
1771fi
1772mkdir_p='
1773name=$1;
1774create="";
1775while test $name; do
1776 if test ! -d "$name"; then
1777 create="$name $create";
1778 name=`echo $name | sed -e "s|^[^/]*$||"`;
1779 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1780 else
1781 name="";
1782 fi;
1783done;
1784for file in $create; do
1785 mkdir $file;
1786done
1787'
1788for file in $*; do
1789 case "$src" in
1790 ".")
1791 case "$file" in
1792 */*)
1793 dir=`expr X$file : 'X\(.*\)/'`
1794 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1795 (cd "$dir" && . ./$file)
dfe9444c
AD
1796 ;;
1797 *)
1798 . ./$file
1799 ;;
1800 esac
1801 ;;
1802 *)
1803 case "$file" in
1804 */*)
1805 dir=`expr X$file : 'X\(.*\)/'`
1806 file=`expr X$file : 'X.*/\(.*\)'`
1807 (set x $dir; shift; eval $mkdir_p)
6904989c 1808 sh <"$src/$dir/$file"
dfe9444c
AD
1809 ;;
1810 *)
6904989c 1811 sh <"$src/$file"
dfe9444c
AD
1812 ;;
1813 esac
1814 ;;
1815 esac
1816done
6904989c 1817if test -f "$src/config_h.SH"; then
dfe9444c
AD
1818 if test ! -f config.h; then
1819 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1820 . "$src/config_h.SH"
dfe9444c
AD
1821 fi
1822fi
1823EOS
1824
1825: extract files and exit if asked to do so
1826case "$extractsh" in
1827true)
1828 case "$realsilent" in
1829 true) ;;
1830 *) exec 1>&4;;
1831 esac
1832 case "$config_sh" in
1833 '') config_sh='config.sh';;
1834 esac
1835 echo " "
1836 echo "Fetching answers from $config_sh..."
1837 cd ..
1838 . $config_sh
1839 test "$override" && . ./optdef.sh
1840 echo " "
1841 . UU/extract
1842 rm -rf UU
24ccb310 1843 echo "Extraction done."
dfe9444c
AD
1844 exit 0
1845 ;;
1846esac
1847
1848: Eunice requires " " instead of "", can you believe it
1849echo " "
1850: Here we go...
1851echo "Beginning of configuration questions for $package."
1852
1853trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1854
2304df62
AD
1855: first determine how to suppress newline on echo command
1856echo " "
1857echo "Checking echo to see how to suppress newlines..."
1858(echo "hi there\c" ; echo " ") >.echotmp
1859if $contains c .echotmp >/dev/null 2>&1 ; then
1860 echo "...using -n."
1861 n='-n'
1862 c=''
1863else
1864 cat <<'EOM'
1865...using \c
1866EOM
1867 n=''
1868 c='\c'
1869fi
1870echo $n "The star should be here-->$c"
1871echo '*'
1872rm -f .echotmp
1873
1874: Now test for existence of everything in MANIFEST
1875echo " "
6904989c 1876if test -f "$rsrc/MANIFEST"; then
2304df62 1877 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1878 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1879 rm -f missing
dfe9444c 1880 tmppwd=`pwd`
2304df62 1881 for filelist in x??; do
6904989c 1882 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1883 done
1884 if test -s missing; then
1885 cat missing >&4
1886 cat >&4 <<'EOM'
1887
1888THIS PACKAGE SEEMS TO BE INCOMPLETE.
1889
1890You have the option of continuing the configuration process, despite the
1891distinct possibility that your kit is damaged, by typing 'y'es. If you
1892do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1893and contact the author (perlbug@perl.org).
2304df62
AD
1894
1895EOM
1896 echo $n "Continue? [n] $c" >&4
1897 read ans
1898 case "$ans" in
1899 y*)
1900 echo "Continuing..." >&4
1901 rm -f missing
1902 ;;
1903 *)
1904 echo "ABORTING..." >&4
1905 kill $$
1906 ;;
1907 esac
1908 else
dfe9444c 1909 echo "Looks good..."
2304df62
AD
1910 fi
1911else
1912 echo "There is no MANIFEST file. I hope your kit is complete !"
1913fi
1914rm -f missing x??
1915
5ff3f7a4
GS
1916echo " "
1917: Find the appropriate value for a newline for tr
1918if test -n "$DJGPP"; then
1919 trnl='\012'
1920fi
1921if test X"$trnl" = X; then
1922 case "`echo foo|tr '\n' x 2>/dev/null`" in
1923 foox) trnl='\n' ;;
1924 esac
1925fi
1926if test X"$trnl" = X; then
1927 case "`echo foo|tr '\012' x 2>/dev/null`" in
1928 foox) trnl='\012' ;;
1929 esac
1930fi
1931if test X"$trnl" = X; then
8be2c24c
JH
1932 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1933 fooxy) trnl='\n\r' ;;
1934 esac
1935fi
1936if test X"$trnl" = X; then
5ff3f7a4
GS
1937 cat <<EOM >&2
1938
1939$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1940
1941EOM
1942 exit 1
1943fi
1944
2304df62
AD
1945: compute the number of columns on the terminal for proper question formatting
1946case "$COLUMNS" in
1947'') COLUMNS='80';;
1948esac
1949
1950: set up the echo used in my read
1951myecho="case \"\$xxxm\" in
1952'') echo $n \"\$rp $c\" >&4;;
1953*) case \"\$rp\" in
1954 '') echo $n \"[\$xxxm] $c\";;
1955 *)
1956 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1957 echo \"\$rp\" >&4
1958 echo $n \"[\$xxxm] $c\" >&4
1959 else
1960 echo $n \"\$rp [\$xxxm] $c\" >&4
1961 fi
1962 ;;
1963 esac;;
1964esac"
1965
1966: now set up to do reads with possible shell escape and default assignment
1967cat <<EOSC >myread
28757baa 1968$startsh
2304df62
AD
1969xxxm=\$dflt
1970$myecho
1971ans='!'
1972case "\$fastread" in
1973yes) case "\$dflt" in
1974 '') ;;
1975 *) ans='';
1976 case "\$silent-\$rp" in
1977 true-) ;;
1978 *) echo " " >&4;;
1979 esac;;
1980 esac;;
1981*) case "\$silent" in
1982 true) case "\$rp" in
1983 '') ans='';;
1984 esac;;
1985 esac;;
1986esac
1987while expr "X\$ans" : "X!" >/dev/null; do
1988 read answ
1989 set x \$xxxm
1990 shift
dfe9444c 1991 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1992 case "\$answ" in
dfe9444c
AD
1993 "!")
1994 sh 1>&4
1995 echo " "
1996 $myecho
1997 ;;
1998 !*)
1999 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2000 shift
2001 sh 1>&4 -c "\$*"
2002 echo " "
2003 $myecho
2004 ;;
2304df62
AD
2005 "\$ans")
2006 case "\$ans" in
ecfc5424
AD
2007 \\&*)
2008 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2009 shift
2010 case "\$1" in
2011 -d)
2012 fastread=yes
40a7a20a 2013 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2014 ;;
2015 -*)
40a7a20a 2016 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2017 ;;
2018 esac
2019 $myecho
2020 ans=!
2021 ;;
2304df62
AD
2022 esac;;
2023 *)
2024 case "\$aok" in
2025 y)
2026 echo "*** Substitution done -- please confirm."
2027 xxxm="\$ans"
c9795ab7 2028 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2029 xxxm="\$ans"
2030 ans=!
2031 ;;
2032 *)
2033 echo "*** Error -- try again."
2034 ans=!
2035 ;;
2036 esac
2037 $myecho
2038 ;;
2039 esac
2040 case "\$ans\$xxxm\$nostick" in
2041 '')
2042 ans=!
2043 $myecho
2044 ;;
2045 esac
2046done
2047case "\$ans" in
2048'') ans="\$xxxm";;
2049esac
2050EOSC
2051
2052: create .config dir to save info across Configure sessions
2053test -d ../.config || mkdir ../.config
2054cat >../.config/README <<EOF
2055This directory created by Configure to save information that should
dfe9444c 2056persist across sessions for $package.
2304df62
AD
2057
2058You may safely delete it if you wish.
2059EOF
2060
9507cadf 2061xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2062case "$usedevel" in
0107c034 2063$define|true|[yY]*) ;;
9507cadf 2064*) case "$xversion" in
0107c034
JH
2065 *[13579])
2066 cat >&4 <<EOH
2067*** WHOA THERE!!! ***
2068
2069 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2070 The version of this $package distribution is $xversion, that is, odd,
2071 (as opposed to even) and that signifies a development release.
3d5d58b1 2072 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2073
2074 Do ***NOT*** install this into production use.
2075 Data corruption and crashes are possible.
2076
2077 It is most seriously suggested that you do not continue any further
2078 unless you want to help in developing and debugging Perl.
2079
6adc6a45
JH
2080 If you *still* want to build perl, you can answer 'y' now,
2081 or pass -Dusedevel to Configure.
2082
0107c034
JH
2083EOH
2084 rp='Do you really want to continue?'
2085 dflt='n'
2086 . ./myread
2087 case "$ans" in
8feeef0e
JH
2088 [yY]) echo >&4 "Okay, continuing."
2089 usedevel="$define" ;;
0107c034
JH
2090 *) echo >&4 "Okay, bye."
2091 exit 1
2092 ;;
2093 esac
2094 ;;
2095 esac
2096 ;;
2097esac
8feeef0e
JH
2098case "$usedevel" in
2099$define|true|[yY]*)
2100 case "$versiononly" in
2101 '') versiononly="$define" ;;
2102 esac
2103 case "$installusrbinperl" in
2104 '') installusrbinperl="$undef" ;;
2105 esac
2106 ;;
2107esac
0107c034 2108
2304df62
AD
2109: general instructions
2110needman=true
2111firsttime=true
760ac839 2112user=`(logname) 2>/dev/null`
dfe9444c
AD
2113case "$user" in
2114'') user=`whoami 2>&1`;;
760ac839 2115esac
2304df62
AD
2116if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2117 firsttime=false
2118 echo " "
2119 rp='Would you like to see the instructions?'
2120 dflt=n
2121 . ./myread
2122 case "$ans" in
2123 [yY]*) ;;
2124 *) needman=false;;
2125 esac
2126fi
2127if $needman; then
2128 cat <<EOH
4e2a5f63 2129
2304df62 2130This installation shell script will examine your system and ask you questions
a0d0e21e 2131to determine how the perl5 package should be installed. If you get
2304df62
AD
2132stuck on a question, you may use a ! shell escape to start a subshell or
2133execute a command. Many of the questions will have default answers in square
2134brackets; typing carriage return will give you the default.
2135
2136On some of the questions which ask for file or directory names you are allowed
2137to use the ~name construct to specify the login directory belonging to "name",
2138even if you don't have a shell which knows about that. Questions where this is
2139allowed will be marked "(~name ok)".
2140
2141EOH
2142 rp=''
2143 dflt='Type carriage return to continue'
2144 . ./myread
2145 cat <<'EOH'
2146
2147The prompter used in this script allows you to use shell variables and
2148backticks in your answers. You may use $1, $2, etc... to refer to the words
2149in the default answer, as if the default line was a set of arguments given to a
2150script shell. This means you may also use $* to repeat the whole default line,
2151so you do not have to re-type everything to add something to the default.
2152
2153Everytime there is a substitution, you will have to confirm. If there is an
2154error (e.g. an unmatched backtick), the default answer will remain unchanged
2155and you will be prompted again.
2156
2157If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2158the questions and use the computed defaults (or the previous answers if there
2159was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2160You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2161on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2162
2163EOH
2164 . ./myread
2165 cat <<EOH
2166
2167Much effort has been expended to ensure that this shell script will run on any
2168Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2169Configure and run it again. If you can't run Configure for some reason,
2170you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2171have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2172
2173This installation script affects things in two ways:
2174
21751) it may do direct variable substitutions on some of the files included
2176 in this kit.
21772) it builds a config.h file for inclusion in C programs. You may edit
2178 any of these files as the need arises after running this script.
2179
2180If you make a mistake on a question, there is no easy way to back up to it
2181currently. The easiest thing to do is to edit config.sh and rerun all the SH
2182files. Configure will offer to let you do this before it runs the SH files.
2183
2184EOH
2185 dflt='Type carriage return to continue'
2186 . ./myread
2187 case "$firsttime" in
2188 true) echo $user >>../.config/instruct;;
2189 esac
2190fi
2191
2304df62
AD
2192: find out where common programs are
2193echo " "
2194echo "Locating common programs..." >&4
2195cat <<EOSC >loc
2196$startsh
2197case \$# in
21980) exit 1;;
2199esac
2200thing=\$1
2201shift
2202dflt=\$1
2203shift
2204for dir in \$*; do
2205 case "\$thing" in
2206 .)
2207 if test -d \$dir/\$thing; then
2208 echo \$dir
2209 exit 0
2210 fi
2211 ;;
2212 *)
a0d0e21e 2213 for thisthing in \$dir/\$thing; do
ecfc5424 2214 : just loop through to pick last item
a0d0e21e 2215 done
25f94b33 2216 if test -f \$thisthing; then
a0d0e21e 2217 echo \$thisthing
2304df62 2218 exit 0
a5a94ea5
JH
2219 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2220 echo \$thisthing
2221 exit 0
2304df62 2222 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2223 if test -n "$DJGPP"; then
2224 echo \$dir/\$thing.exe
b921d661 2225 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2226 : on Eunice apparently
2227 echo \$dir/\$thing
b921d661 2228 exit 0
c4f23d77 2229 fi
2d736872 2230 exit 0
2304df62
AD
2231 fi
2232 ;;
2233 esac
2234done
2235echo \$dflt
2236exit 1
2237EOSC
2238chmod +x loc
2239$eunicefix loc
2240loclist="
2241awk
2242cat
f8006fac 2243chmod
b4eb6b3d
JH
2244comm
2245cp
2304df62
AD
2246echo
2247expr
2248grep
a0d0e21e 2249ls
b4eb6b3d 2250mkdir
2304df62
AD
2251rm
2252sed
b4eb6b3d 2253sort
85e6fe83 2254touch
2304df62 2255tr
b4eb6b3d 2256uniq
2304df62
AD
2257"
2258trylist="
2259Mcc
dfe9444c 2260ar
3659ebf1 2261bison
b4eb6b3d 2262byacc
2304df62 2263cpp
b4eb6b3d 2264csh
2304df62
AD
2265date
2266egrep
1fef16b3 2267gmake
8ff267be 2268gzip
b4eb6b3d 2269less
8ff267be 2270ln
3c728e00 2271make
b4eb6b3d 2272more
693762b4 2273nm
b4eb6b3d
JH
2274nroff
2275pg
2304df62
AD
2276test
2277uname
8ff267be 2278zip
2304df62 2279"
8e07c86e 2280pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2281pth="$pth /lib /usr/lib"
2282for file in $loclist; do
dfe9444c
AD
2283 eval xxx=\$$file
2284 case "$xxx" in
2285 /*|?:[\\/]*)
2286 if test -f "$xxx"; then
2287 : ok
2288 else
2289 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2290 xxx=`./loc $file $file $pth`
2291 fi
2292 ;;
2293 '') xxx=`./loc $file $file $pth`;;
2294 *) xxx=`./loc $xxx $xxx $pth`;;
2295 esac
a5a94ea5 2296 eval $file=$xxx$_exe
2304df62
AD
2297 eval _$file=$xxx
2298 case "$xxx" in
2299 /*)
2300 echo $file is in $xxx.
2301 ;;
8e07c86e
AD
2302 ?:[\\/]*)
2303 echo $file is in $xxx.
2304 ;;
2304df62 2305 *)
25f94b33
AD
2306 echo "I don't know where '$file' is, and my life depends on it." >&4
2307 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2308 exit 1
2304df62
AD
2309 ;;
2310 esac
2311done
2312echo " "
2313echo "Don't worry if any of the following aren't found..."
2314say=offhand
2315for file in $trylist; do
dfe9444c
AD
2316 eval xxx=\$$file
2317 case "$xxx" in
2318 /*|?:[\\/]*)
2319 if test -f "$xxx"; then
2320 : ok
2321 else
2322 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2323 xxx=`./loc $file $file $pth`
2324 fi
2325 ;;
2326 '') xxx=`./loc $file $file $pth`;;
2327 *) xxx=`./loc $xxx $xxx $pth`;;
2328 esac
306a8474 2329 eval $file=$xxx$_exe
2304df62
AD
2330 eval _$file=$xxx
2331 case "$xxx" in
2332 /*)
2333 echo $file is in $xxx.
2334 ;;
8e07c86e
AD
2335 ?:[\\/]*)
2336 echo $file is in $xxx.
2337 ;;
2304df62
AD
2338 *)
2339 echo "I don't see $file out there, $say."
2340 say=either
2341 ;;
2342 esac
2343done
2344case "$egrep" in
1fef16b3 2345egrep)
2304df62
AD
2346 echo "Substituting grep for egrep."
2347 egrep=$grep
868439a2 2348 _egrep=$grep
2304df62
AD
2349 ;;
2350esac
8ff267be 2351case "$ln" in
1fef16b3 2352ln)
8ff267be 2353 echo "Substituting cp for ln."
2354 ln=$cp
868439a2 2355 _ln=$cp
8ff267be 2356 ;;
2357esac
2e26f1d5
JH
2358case "$make" in
2359make)
2360 case "$gmake" in
2361 gmake)
2362 echo "I can't find make or gmake, and my life depends on it." >&4
2363 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2364 exit 1
2365 ;;
2366 esac
2367 ;;
2368esac
2369case "$gmake" in
2370gmake) ;;
2371*) # We can't have osname yet.
1fef16b3
JH
2372 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2373 # Assume that gmake, if found, is definitely GNU make
2374 # and prefer it over the system make.
2375 echo "Substituting gmake for make."
2376 make=$gmake
868439a2 2377 _make=$gmake
1fef16b3
JH
2378 fi
2379 ;;
a5a94ea5 2380esac
2304df62
AD
2381case "$test" in
2382test)
2383 echo "Hopefully test is built into your sh."
2384 ;;
2385*)
73614538 2386 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2387 echo "Using the test built into your sh."
2304df62
AD
2388 test=test
2389 _test=test
2390 fi
2391 ;;
2392esac
2393case "$echo" in
2394echo)
2395 echo "Hopefully echo is built into your sh."
2396 ;;
2397'') ;;
2398*)
2399 echo " "
2400echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2401 $echo $n "hi there$c" >foo1
2402 echo $n "hi there$c" >foo2
2403 if cmp foo1 foo2 >/dev/null 2>&1; then
2404 echo "They are compatible. In fact, they may be identical."
2405 else
2406 case "$n" in
2407 '-n') n='' c='\c';;
2408 *) n='-n' c='';;
2409 esac
2410 cat <<FOO
2411They are not compatible! You are probably running ksh on a non-USG system.
2412I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2413have echo built in and we may have to run some Bourne shell scripts. That
2414means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2415
2416FOO
2417 $echo $n "The star should be here-->$c"
2418 $echo "*"
2419 fi
2420 $rm -f foo1 foo2
2421 ;;
2422esac
2423
6b769f8f 2424cat <<EOS >trygcc
2573c5f9
JH
2425$startsh
2426EOS
6b769f8f 2427cat <<'EOSC' >>trygcc
2573c5f9
JH
2428case "$cc" in
2429'') ;;
2430*) $rm -f try try.*
2431 $cat >try.c <<EOM
2432int main(int argc, char *argv[]) {
2433 return 0;
2434}
2435EOM
e4778687 2436 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2437 :
2438 else
2439 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2440 despair=yes
2441 trygcc=yes
2442 case "$cc" in
2443 *gcc*) trygcc=no ;;
2444 esac
2445 case "`$cc -v -c try.c 2>&1`" in
2446 *gcc*) trygcc=no ;;
2447 esac
2448 if $test X"$trygcc" = Xyes; then
2449 if gcc -o try -c try.c; then
2450 echo " "
2451 echo "You seem to have a working gcc, though." >&4
2452 rp="Would you like to use it?"
2453 dflt=y
2454 if $test -f myread; then
2455 . ./myread
2456 else
2457 if $test -f UU/myread; then
2458 . ./UU/myread
2459 else
2460 echo "Cannot find myread, sorry. Aborting." >&2
2461 exit 1
2462 fi
2463 fi
2464 case "$ans" in
6371411c
RB
2465 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2466 if $test -f usethreads.cbu; then
2467 $cat >&4 <<EOM
2468
2469*** However, any setting of the C compiler flags (e.g. for thread support)
2470*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2471*** (together with e.g. -Dusethreads).
2472
2473EOM
2474 fi;;
2573c5f9
JH
2475 esac
2476 fi
2477 fi
6b769f8f
RB
2478 fi
2479 $rm -f try try.*
2480 ;;
2481esac
2482EOSC
2483
2484cat <<EOS >checkcc
2485$startsh
2486EOS
2487cat <<'EOSC' >>checkcc
2488case "$cc" in
2489'') ;;
2490*) $rm -f try try.*
2491 $cat >try.c <<EOM
2492int main(int argc, char *argv[]) {
2493 return 0;
2494}
2495EOM
2496 if $cc -o try $ccflags $ldflags try.c; then
2497 :
2498 else
2573c5f9 2499 if $test X"$despair" = Xyes; then
6b769f8f
RB
2500 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2501 fi
2502 $cat >&4 <<EOM
5dd4fbdf
MB
2503You need to find a working C compiler.
2504Either (purchase and) install the C compiler supplied by your OS vendor,
2505or for a free C compiler try http://gcc.gnu.org/
2506I cannot continue any further, aborting.
2507EOM
6b769f8f 2508 exit 1
2573c5f9
JH
2509 fi
2510 $rm -f try try.*
2511 ;;
2512esac
2513EOSC
2514
a0d0e21e
LW
2515: determine whether symbolic links are supported
2516echo " "
2517$touch blurfl
2518if $ln -s blurfl sym > /dev/null 2>&1 ; then
2519 echo "Symbolic links are supported." >&4
818f00be 2520 lns="$ln -s"
a0d0e21e
LW
2521else
2522 echo "Symbolic links are NOT supported." >&4
2523 lns="$ln"
2524fi
2525$rm -f blurfl sym
2526
dafca956
JH
2527: determine whether symbolic links are supported
2528echo " "
2529case "$lns" in
18ea2752 2530*"ln"*" -s")
dafca956
JH
2531 echo "Checking how to test for symbolic links..." >&4
2532 $lns blurfl sym
4b661809 2533 if $test "X$issymlink" = X; then
2e2a97a6
JH
2534 case "$newsh" in
2535 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2536 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2537 esac
5d644a95
MB
2538 if test $? = 0; then
2539 issymlink="test -h"
2e2a97a6
JH
2540 else
2541 echo "Your builtin 'test -h' may be broken." >&4
2542 case "$test" in
2543 /*) ;;
2544 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2545 for p in $pth
2546 do
2547 if test -f "$p/$test"; then
2548 test="$p/$test"
2549 break
2550 fi
2551 done
2552 ;;
2553 esac
2554 case "$test" in
2555 /*)
2556 echo "Trying external '$test -h'." >&4
2557 issymlink="$test -h"
2558 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2559 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2560 issymlink=''
2561 fi
2562 ;;
2563 *) issymlink='' ;;
2564 esac
5d644a95
MB
2565 fi
2566 fi
4b661809 2567 if $test "X$issymlink" = X; then
dafca956 2568 if $test -L sym 2>/dev/null; then
5d644a95 2569 issymlink="$test -L"
2e2a97a6 2570 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2571 fi
2572 fi
4b661809 2573 if $test "X$issymlink" != X; then
5d644a95 2574 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2575 else
2576 echo "I do not know how you can test for symbolic links." >&4
2577 fi
2578 $rm -f blurfl sym
2579 ;;
2580*) echo "No symbolic links, so not testing for their testing..." >&4
2581 ;;
2582esac
2583echo " "
2584
2585
2586case "$mksymlinks" in
2587$define|true|[yY]*)
2588 case "$src" in
2589 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2590 exit 1
2591 ;;
4b661809 2592 *) case "$lns:$issymlink" in
f314eb9f 2593 *"ln"*" -s:"*"test -"?)
dafca956
JH
2594 echo "Creating the symbolic links..." >&4
2595 echo "(First creating the subdirectories...)" >&4
2596 cd ..
2597 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2598 read directory
2599 test -z "$directory" && break
2600 mkdir -p $directory
2601 done
2602 # Sanity check 1.
2603 if test ! -d t/base; then
2604 echo "Failed to create the subdirectories. Aborting." >&4
2605 exit 1
2606 fi
2607 echo "(Then creating the symlinks...)" >&4
2608 awk '{print $1}' $src/MANIFEST | while true; do
2609 read filename
2610 test -z "$filename" && break
2611 if test -f $filename; then
5d644a95 2612 if $issymlink $filename; then
dafca956
JH
2613 rm -f $filename
2614 fi
2615 fi
2616 if test -f $filename; then
2617 echo "$filename already exists, not symlinking."
2618 else
2619 ln -s $src/$filename $filename
2620 fi
2621 done
2622 # Sanity check 2.
a0d24b8a
JH
2623 if test ! -f t/base/lex.t; then
2624 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2625 exit 1
2626 fi
2627 cd UU
2628 ;;
2629 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2630 ;;
2631 esac
2632 ;;
2633 esac
2634 ;;
2635esac
2636
5440bc8e
JH
2637
2638case "$usecrosscompile" in
2639$define|true|[yY]*)
93bc48fa 2640 $echo "Cross-compiling..."
5440bc8e
JH
2641 croak=''
2642 case "$cc" in
2643 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2644 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2645 ar=$targetarch-ar
2646 # leave out ld, choosing it is more complex
2647 nm=$targetarch-nm
2648 ranlib=$targetarch-ranlib
93bc48fa 2649 $echo 'extern int foo;' > try.c
f8006fac 2650 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2651 shift
2652 if $test $# -gt 0; then
2653 incpth="$incpth $*"
f8006fac
JH
2654 incpth="`$echo $incpth|$sed 's/^ //'`"
2655 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2656 for i in $*; do
f8006fac 2657 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2658 if $test -d $j; then
2659 libpth="$libpth $j"
2660 fi
2661 done
f8006fac
JH
2662 libpth="`$echo $libpth|$sed 's/^ //'`"
2663 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2664 fi
2665 $rm -f try.c
5440bc8e
JH
2666 ;;
2667 esac
2668 case "$targetarch" in
93bc48fa
JH
2669 '') echo "Targetarch not defined." >&4; croak=y ;;
2670 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2671 esac
2672 case "$incpth" in
93bc48fa 2673 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2674 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2675 esac
2676 case "$libpth" in
93bc48fa 2677 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2678 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2679 esac
93bc48fa
JH
2680 case "$usrinc" in
2681 '') for i in $incpth; do
2682 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2683 usrinc=$i
2684 echo "Guessing usrinc $usrinc." >&4
2685 break
2686 fi
2687 done
2688 case "$usrinc" in
2689 '') echo "Usrinc not defined." >&4; croak=y ;;
2690 esac
2691 ;;
2692 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2693 esac
93bc48fa
JH
2694 case "$targethost" in
2695 '') echo "Targethost not defined." >&4; croak=y ;;
2696 *) echo "Using targethost $targethost." >&4
5440bc8e 2697 esac
93bc48fa
JH
2698 locincpth=' '
2699 loclibpth=' '
5440bc8e 2700 case "$croak" in
93bc48fa 2701 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2702 esac
2703 case "$src" in
2704 /*) run=$src/Cross/run
93c0359c 2705 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2706 to=$src/Cross/to
2707 from=$src/Cross/from
2708 ;;
93bc48fa 2709 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2710 run=$pwd/Cross/run
f8006fac 2711 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2712 to=$pwd/Cross/to
2713 from=$pwd/Cross/from
2714 ;;
2715 esac
2716 case "$targetrun" in
2717 '') targetrun=ssh ;;
2718 esac
2719 case "$targetto" in
2720 '') targetto=scp ;;
2721 esac
2722 case "$targetfrom" in
2723 '') targetfrom=scp ;;
2724 esac
2725 run=$run-$targetrun
2726 to=$to-$targetto
2727 from=$from-$targetfrom
93bc48fa
JH
2728 case "$targetdir" in
2729 '') targetdir=/tmp
2730 echo "Guessing targetdir $targetdir." >&4
2731 ;;
2732 esac
5440bc8e 2733 case "$targetuser" in
93bc48fa
JH
2734 '') targetuser=root
2735 echo "Guessing targetuser $targetuser." >&4
2736 ;;
5440bc8e
JH
2737 esac
2738 case "$targetfrom" in
2739 scp) q=-q ;;
2740 *) q='' ;;
2741 esac
2742 case "$targetrun" in
2743 ssh|rsh)
2744 cat >$run <<EOF
2745#!/bin/sh
93c0359c
JH
2746case "\$1" in
2747-cwd)
2748 shift
2749 cwd=\$1
2750 shift
2751 ;;
2752esac
2753case "\$cwd" in
2754'') cwd=$targetdir ;;
2755esac
5440bc8e
JH
2756exe=\$1
2757shift
93c0359c
JH
2758if $test ! -f \$exe.xok; then
2759 $to \$exe
2760 $touch \$exe.xok
2761fi
2762$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2763EOF
2764 ;;
93bc48fa 2765 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2766 exit 1
2767 ;;
2768 esac
93c0359c
JH
2769 case "$targetmkdir" in
2770 */Cross/mkdir)
2771 cat >$targetmkdir <<EOF
2772#!/bin/sh
2773$targetrun -l $targetuser $targethost "mkdir -p \$@"
2774EOF
f8006fac 2775 $chmod a+rx $targetmkdir
93c0359c
JH
2776 ;;
2777 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2778 exit 1
2779 ;;
2780 esac
5440bc8e
JH
2781 case "$targetto" in
2782 scp|rcp)
2783 cat >$to <<EOF
2784#!/bin/sh
2785for f in \$@
2786do
93c0359c
JH
2787 case "\$f" in
2788 /*)
2789 $targetmkdir \`dirname \$f\`
2790 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2791 ;;
2792 *)
2793 $targetmkdir $targetdir/\`dirname \$f\`
2794 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2795 ;;
2796 esac
5440bc8e
JH
2797done
2798exit 0
2799EOF
2800 ;;
2801 cp) cat >$to <<EOF
2802#!/bin/sh
93c0359c
JH
2803for f in \$@
2804do
2805 case "\$f" in
2806 /*)
2807 $mkdir -p $targetdir/\`dirname \$f\`
2808 $cp \$f $targetdir/\$f || exit 1
2809 ;;
2810 *)
2811 $targetmkdir $targetdir/\`dirname \$f\`
2812 $cp \$f $targetdir/\$f || exit 1
2813 ;;
2814 esac
2815done
2816exit 0
5440bc8e
JH
2817EOF
2818 ;;
93bc48fa 2819 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2820 exit 1
2821 ;;
2822 esac
2823 case "$targetfrom" in
2824 scp|rcp)
2825 cat >$from <<EOF
2826#!/bin/sh
2827for f in \$@
2828do
93c0359c 2829 $rm -f \$f
5440bc8e
JH
2830 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2831done
2832exit 0
2833EOF
2834 ;;
2835 cp) cat >$from <<EOF
2836#!/bin/sh
2837for f in \$@
2838do
93c0359c 2839 $rm -f \$f
5440bc8e
JH
2840 cp $targetdir/\$f . || exit 1
2841done
2842exit 0
2843EOF
2844 ;;
93bc48fa 2845 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2846 exit 1
2847 ;;
2848 esac
93bc48fa
JH
2849 if $test ! -f $run; then
2850 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2851 else
f8006fac 2852 $chmod a+rx $run
5440bc8e 2853 fi
93bc48fa
JH
2854 if $test ! -f $to; then
2855 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2856 else
f8006fac 2857 $chmod a+rx $to
5440bc8e 2858 fi
93bc48fa
JH
2859 if $test ! -f $from; then
2860 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2861 else
f8006fac 2862 $chmod a+rx $from
5440bc8e 2863 fi
93bc48fa 2864 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2865 exit 1
2866 fi
2867 cat >&4 <<EOF
f8006fac
JH
2868Using '$run' for remote execution,
2869and '$from' and '$to'
93bc48fa 2870for remote file transfer.
5440bc8e
JH
2871EOF
2872 ;;
2873*) run=''
2874 to=:
2875 from=:
2876 usecrosscompile='undef'
2877 targetarch=''
2878 ;;
2879esac
2880
ecfc5424
AD
2881: see whether [:lower:] and [:upper:] are supported character classes
2882echo " "
ecfc5424
AD
2883case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2884ABYZ)
2885 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2886 up='[:upper:]'
2887 low='[:lower:]'
2888 ;;
416d0bea
MB
2889*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2890 # (0xd9 and 0xe2), therefore that is a nice testing point.
2891 if test "X$up" = X -o "X$low" = X; then
2892 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2893 rs) up='[A-Z]'
2894 low='[a-z]'
28e8609d
JH
2895 ;;
2896 esac
416d0bea 2897 fi
28e8609d 2898 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2899 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2900 rs) up='A-Z'
28e8609d
JH
2901 low='a-z'
2902 ;;
2903 esac
416d0bea 2904 fi
28e8609d 2905 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2906 case "`echo RS | od -x 2>/dev/null`" in
2907 *D9E2*|*d9e2*)
28e8609d
JH
2908 echo "Hey, this might be EBCDIC." >&4
2909 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2910 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2911 rs) up='[A-IJ-RS-Z]'
2912 low='[a-ij-rs-z]'
28e8609d
JH
2913 ;;
2914 esac
2915 fi
2916 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2917 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2918 rs) up='A-IJ-RS-Z'
2919 low='a-ij-rs-z'
28e8609d
JH
2920 ;;
2921 esac
2922 fi
2923 ;;
2924 esac
2925 fi
2926esac
416d0bea
MB
2927case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2928rs)
28e8609d
JH
2929 echo "Using $up and $low to convert case." >&4
2930 ;;
ecfc5424 2931*)
28e8609d
JH
2932 echo "I don't know how to translate letters from upper to lower case." >&4
2933 echo "Your tr is not acting any way I know of." >&4
2934 exit 1
2935 ;;
ecfc5424
AD
2936esac
2937: set up the translation script tr, must be called with ./tr of course
2938cat >tr <<EOSC
2939$startsh
2940case "\$1\$2" in
2941'[A-Z][a-z]') exec $tr '$up' '$low';;
2942'[a-z][A-Z]') exec $tr '$low' '$up';;
2943esac
2944exec $tr "\$@"
2945EOSC
2946chmod +x tr
2947$eunicefix tr
2948
2304df62
AD
2949: Try to determine whether config.sh was made on this system
2950case "$config_sh" in
2951'')
43999f95
JH
2952myuname=`$uname -a 2>/dev/null`
2953$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2954# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2955# because the A-Z/a-z are not consecutive.
a0d0e21e 2956myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2957 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2958newmyuname="$myuname"
2304df62 2959dflt=n
16d20bd9
AD
2960case "$knowitall" in
2961'')
2962 if test -f ../config.sh; then
2963 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2964 eval "`grep myuname= ../config.sh`"
2965 fi
2966 if test "X$myuname" = "X$newmyuname"; then
2967 dflt=y
2968 fi
2304df62 2969 fi
16d20bd9
AD
2970 ;;
2971*) dflt=y;;
2972esac
2304df62
AD
2973
2974: Get old answers from old config file if Configure was run on the
2975: same system, otherwise use the hints.
2976hint=default
2977cd ..
2978if test -f config.sh; then
16d20bd9
AD
2979 echo " "
2980 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2981 . UU/myread
2982 case "$ans" in
f83701cd
AD
2983 n*|N*) echo "OK, I'll ignore it."
2984 mv config.sh config.sh.old
2985 myuname="$newmyuname"
2986 ;;
2304df62 2987 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2988 tmp_n="$n"
2989 tmp_c="$c"
85cad39c 2990 tmp_sh="$sh"
2304df62
AD
2991 . ./config.sh
2992 cp config.sh UU
ecfc5424
AD
2993 n="$tmp_n"
2994 c="$tmp_c"
85cad39c 2995 : Older versions did not always set $sh. Catch re-use of such
2996 : an old config.sh.
2997 case "$sh" in
2998 '') sh="$tmp_sh" ;;
2999 esac
2304df62
AD
3000 hint=previous
3001 ;;
3002 esac
3003fi
2573c5f9 3004. ./UU/checkcc
2304df62
AD
3005if test ! -f config.sh; then
3006 $cat <<EOM
3007
4e2a5f63
AD
3008First time through, eh? I have some defaults handy for some systems
3009that need some extra help getting the Configure answers right:
2304df62
AD
3010
3011EOM
dfe9444c 3012 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3013 dflt=''
3014 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3015 : tests or hints, please send them to perlbug@perl.org
2304df62 3016 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3017 $test -f /irix && osname=irix
85e6fe83
LW
3018 $test -f /xenix && osname=sco_xenix
3019 $test -f /dynix && osname=dynix
3020 $test -f /dnix && osname=dnix
5f05dabc 3021 $test -f /lynx.os && osname=lynxos
3022 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3023 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3024 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3025 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3026 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3027 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3028 $test -d /usr/apollo/bin && osname=apollo
3029 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3030 $test -d /usr/include/minix && osname=minix
d54344fc 3031 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3032 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3033 osname=machten
4633a7c4 3034 if $test -x /sbin/version; then
dfe9444c 3035 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3036 $sed -e 's/[A-Za-z]$//'`
3037 elif $test -x /usr/etc/version; then
dfe9444c 3038 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3039 $sed -e 's/[A-Za-z]$//'`
3040 else
3041 osvers="$2.$3"
3042 fi
3043 fi
aaacdc8b
GS
3044
3045 $test -f /sys/posix.dll &&
3046 $test -f /usr/bin/what &&
3047 set X `/usr/bin/what /sys/posix.dll` &&
3048 $test "$3" = UWIN &&
3049 osname=uwin &&
3050 osvers="$5"
3051
2304df62
AD
3052 if $test -f $uname; then
3053 set X $myuname
3054 shift
3055
2304df62 3056 case "$5" in
85e6fe83 3057 fps*) osname=fps ;;
2304df62
AD
3058 mips*)
3059 case "$4" in
85e6fe83
LW
3060 umips) osname=umips ;;
3061 *) osname=mips ;;
2304df62 3062 esac;;
85e6fe83
LW
3063 [23]100) osname=mips ;;
3064 next*) osname=next ;;
ecfc5424 3065 i386*)
c6912327
JH
3066 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3067 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3068 osname='sco'
3069 osvers=$tmp
3070 elif $test -f /etc/kconfig; then
ecfc5424 3071 osname=isc
bd628c73 3072 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3073 osvers=4
3074 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3075 osvers=3
2304df62 3076 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3077 osvers=2
ecfc5424
AD
3078 fi
3079 fi
2000072c 3080 tmp=''
ecfc5424 3081 ;;
c4f23d77
AD
3082 pc*)
3083 if test -n "$DJGPP"; then
3084 osname=dos
3085 osvers=djgpp
3086 fi
3087 ;;
2304df62
AD
3088 esac
3089
3090 case "$1" in
a0d0e21e
LW
3091 aix) osname=aix
3092 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3093 case "$tmp" in
e81c5c2a
NC
3094 # oslevel can fail with:
3095 # oslevel: Unable to acquire lock.
3096 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3097 '<3240'|'<>3240') osvers=3.2.0 ;;
3098 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3099 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3100 *) osvers=$tmp;;
a0d0e21e
LW
3101 esac
3102 ;;
aaacdc8b
GS
3103 bsd386) osname=bsd386
3104 osvers=`$uname -r`
3105 ;;
3106 cygwin*) osname=cygwin
3107 osvers="$3"
3108 ;;
23f87696
SZ
3109 *dc.osx) osname=dcosx
3110 osvers="$3"
3111 ;;
a0d0e21e
LW
3112 dnix) osname=dnix
3113 osvers="$3"
3114 ;;
3115 domainos) osname=apollo
3116 osvers="$3"
3117 ;;
761ee4e8 3118 dgux) osname=dgux
a0d0e21e
LW
3119 osvers="$3"
3120 ;;
760ac839 3121 dynixptx*) osname=dynixptx
e58e581d 3122 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3123 ;;
a0d0e21e
LW
3124 freebsd) osname=freebsd
3125 osvers="$3" ;;
761ee4e8
BD
3126 genix) osname=genix ;;
3127 gnu) osname=gnu
3128 osvers="$3" ;;
3129 hp*) osname=hpux
bfb7748a 3130 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3131 ;;
761ee4e8 3132 irix*) osname=irix
a0d0e21e
LW
3133 case "$3" in
3134 4*) osvers=4 ;;
3135 5*) osvers=5 ;;
ecfc5424 3136 *) osvers="$3" ;;
a0d0e21e
LW
3137 esac
3138 ;;
761ee4e8 3139 linux) osname=linux
a0d0e21e 3140 case "$3" in
a0d0e21e
LW
3141 *) osvers="$3" ;;
3142 esac
3143 ;;
761ee4e8 3144 MiNT) osname=mint
28e8609d
JH
3145 ;;
3146 netbsd*) osname=netbsd
ecfc5424
AD
3147 osvers="$3"
3148 ;;
4e81affe
MM
3149 news-os) osvers="$3"
3150 case "$3" in
3151 4*) osname=newsos4 ;;
3152 *) osname=newsos ;;
3153 esac
3154 ;;
aaacdc8b 3155 next*) osname=next ;;
28bb1e2c 3156 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3157 openbsd) osname=openbsd
3158 osvers="$3"
3159 ;;
5c728af0
IZ
3160 os2) osname=os2
3161 osvers="$4"
3162 ;;
aaacdc8b
GS
3163 POSIX-BC | posix-bc ) osname=posix-bc
3164 osvers="$3"
a0d0e21e 3165 ;;
ae3afa4e
TH
3166 powerux | power_ux | powermax_os | powermaxos | \
3167 powerunix | power_unix) osname=powerux
3168 osvers="$3"
3169 ;;
aaacdc8b
GS
3170 qnx) osname=qnx
3171 osvers="$4"
3172 ;;
a0d0e21e
LW
3173 solaris) osname=solaris
3174 case "$3" in
3175 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3176 *) osvers="$3" ;;
a0d0e21e
LW
3177 esac
3178 ;;
85e6fe83
LW
3179 sunos) osname=sunos
3180 case "$3" in
85e6fe83
LW
3181 5*) osname=solaris
3182 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3183 *) osvers="$3" ;;
2304df62
AD
3184 esac
3185 ;;
a0d0e21e 3186 titanos) osname=titanos
85e6fe83 3187 case "$3" in
a0d0e21e
LW
3188 1*) osvers=1 ;;
3189 2*) osvers=2 ;;
3190 3*) osvers=3 ;;
3191 4*) osvers=4 ;;
ecfc5424 3192 *) osvers="$3" ;;
2304df62
AD
3193 esac
3194 ;;
85e6fe83 3195 ultrix) osname=ultrix
ecfc5424 3196 osvers="$3"
2304df62 3197 ;;
28757baa 3198 osf1|mls+) case "$5" in
fed7345c
AD
3199 alpha)
3200 osname=dec_osf
fdd85a03 3201 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3202 case "$osvers" in
3203 [1-9].[0-9]*) ;;
3204 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3205 esac
ecfc5424
AD
3206 ;;
3207 hp*) osname=hp_osf1 ;;
3208 mips) osname=mips_osf1 ;;
85e6fe83
LW
3209 esac
3210 ;;
af1ff193 3211 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3212 openunix|unixware) osname=svr5
0337d152
BG
3213 osvers="$4"
3214 ;;
3c728e00 3215 uts) osname=uts
a0d0e21e
LW
3216 osvers="$3"
3217 ;;
3c728e00
JH
3218 vos) osvers="$3"
3219 ;;
85e6fe83 3220 $2) case "$osname" in
2304df62 3221 *isc*) ;;
a0d0e21e 3222 *freebsd*) ;;
5f05dabc 3223 svr*)
a0d0e21e
LW
3224 : svr4.x or possibly later
3225 case "svr$3" in
3226 ${osname}*)
3227 osname=svr$3
3228 osvers=$4
3229 ;;
3230 esac
3231 case "$osname" in
3232 svr4.0)
3233 : Check for ESIX
3234 if test -f /stand/boot ; then
3235 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3236 if test -n "$INITPROG" -a -f "$INITPROG"; then
3237 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3238 if test -n "$isesix"; then
a0d0e21e
LW
3239 osname=esix4
3240 fi
3241 fi
3242 fi
3243 ;;
3244 esac
3245 ;;
2304df62 3246 *) if test -f /etc/systemid; then
a0d0e21e
LW
3247 osname=sco
3248 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3249 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3250 osvers=$1.$2.$3
c4f23d77 3251 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3252 osvers=$1.$2
c4f23d77 3253 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3254 osvers=$1
2304df62 3255 fi
a0d0e21e
LW
3256 else
3257 case "$osname" in
3258 '') : Still unknown. Probably a generic Sys V.
3259 osname="sysv"
3260 osvers="$3"
3261 ;;
3262 esac
2304df62
AD
3263 fi
3264 ;;
3265 esac
3266 ;;
a0d0e21e
LW
3267 *) case "$osname" in
3268 '') : Still unknown. Probably a generic BSD.
3269 osname="$1"
3270 osvers="$3"
3271 ;;
3272 esac
3273 ;;
2304df62
AD
3274 esac
3275 else
dfe9444c
AD
3276 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3277 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3278 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3279 osname=news_os
2304df62 3280 fi
dfe9444c 3281 $rm -f UU/kernel.what
5c728af0 3282 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3283 set X $myuname
3284 osname=os2
3285 osvers="$5"
2304df62
AD
3286 fi
3287 fi
85e6fe83 3288
5440bc8e
JH
3289 case "$targetarch" in
3290 '') ;;
3291 *) hostarch=$osname
3292 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3293 osvers=''
3294 ;;
3295 esac
3296
a0d0e21e
LW
3297 : Now look for a hint file osname_osvers, unless one has been
3298 : specified already.
3299 case "$hintfile" in
3300 ''|' ')
1e127011 3301 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3302 : Also try without trailing minor version numbers.
1e127011
DD
3303 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3304 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3305 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3306 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3307 case "$file" in
3308 '') dflt=none ;;
3309 *) case "$osvers" in
3310 '') dflt=$file
3311 ;;
dfe9444c 3312 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3313 dflt=$file
dfe9444c 3314 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3315 dflt=$xfile
dfe9444c 3316 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3317 dflt=$xxfile
dfe9444c 3318 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3319 dflt=$xxxfile
dfe9444c 3320 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3321 dflt=$xxxxfile
dfe9444c 3322 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3323 dflt="${osname}"
3324 else
3325 dflt=none
3326 fi
3327 ;;
3328 esac
85e6fe83
LW
3329 ;;
3330 esac
4e2a5f63
AD
3331 if $test -f Policy.sh ; then
3332 case "$dflt" in
3333 *Policy*) ;;
3334 none) dflt="Policy" ;;
3335 *) dflt="Policy $dflt" ;;
3336 esac
3337 fi
85e6fe83 3338 ;;
a0d0e21e 3339 *)
ecfc5424 3340 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3341 ;;
2304df62 3342 esac
1aef975c 3343
4e2a5f63
AD
3344 if $test -f Policy.sh ; then
3345 $cat <<EOM
3346
3347There's also a Policy hint file available, which should make the
3348site-specific (policy) questions easier to answer.
3349EOM
3350
3351 fi
3352
2304df62
AD
3353 $cat <<EOM
3354
3355You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3356A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3357is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3358
3359EOM
4e2a5f63 3360
2304df62 3361 rp="Which of these apply, if any?"
dfe9444c 3362 . UU/myread
85e6fe83
LW
3363 tans=$ans
3364 for file in $tans; do
4e2a5f63
AD
3365 if $test X$file = XPolicy -a -f Policy.sh; then
3366 . Policy.sh
3367 $cat Policy.sh >> UU/config.sh
3368 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3369 . $src/hints/$file.sh
3370 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3371 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3372 : nothing
3373 else
85e6fe83
LW
3374 : Give one chance to correct a possible typo.
3375 echo "$file.sh does not exist"
3376 dflt=$file
3377 rp="hint to use instead?"
dfe9444c 3378 . UU/myread
85e6fe83 3379 for file in $ans; do
dfe9444c
AD
3380 if $test -f "$src/hints/$file.sh"; then
3381 . $src/hints/$file.sh
3382 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3383 elif $test X$ans = X -o X$ans = Xnone ; then
3384 : nothing
3385 else
3386 echo "$file.sh does not exist -- ignored."
3387 fi
3388 done
2304df62
AD
3389 fi
3390 done
85e6fe83 3391
2304df62 3392 hint=recommended
85e6fe83 3393 : Remember our hint file for later.
dfe9444c 3394 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3395 hintfile="$file"
85e6fe83 3396 else
a0d0e21e 3397 hintfile=''
85e6fe83 3398 fi
2304df62
AD
3399fi
3400cd UU
3401;;
3402*)
3403 echo " "
3404 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3405 tmp_n="$n"
3406 tmp_c="$c"
2304df62
AD
3407 cd ..
3408 cp $config_sh config.sh 2>/dev/null
a78b0d02 3409 chmod +w config.sh
2304df62
AD
3410 . ./config.sh
3411 cd UU
3412 cp ../config.sh .
ecfc5424
AD
3413 n="$tmp_n"
3414 c="$tmp_c"
2304df62
AD
3415 hint=previous
3416 ;;
3417esac
1aef975c 3418test "$override" && . ./optdef.sh
2304df62
AD
3419
3420: Restore computed paths
3421for file in $loclist $trylist; do
3422 eval $file="\$_$file"
3423done
3424
85e6fe83 3425cat << EOM
a0d0e21e 3426
85e6fe83 3427Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3428The default value is probably right if the name rings a bell. Otherwise,
3429since spelling matters for me, either accept the default or answer "none"
3430to leave it blank.
a0d0e21e 3431
85e6fe83 3432EOM
85e6fe83 3433case "$osname" in
a0d0e21e 3434 ''|' ')
85e6fe83 3435 case "$hintfile" in
a0d0e21e 3436 ''|' '|none) dflt=none ;;
ecfc5424 3437 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3438 esac
3439 ;;
3440 *) dflt="$osname" ;;
3441esac
3442rp="Operating system name?"
3443. ./myread
3444case "$ans" in
ecfc5424
AD
3445none) osname='' ;;
3446*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3447esac
8ff267be 3448echo " "
3449case "$osvers" in
3450 ''|' ')
3451 case "$hintfile" in
3452 ''|' '|none) dflt=none ;;
3453 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3454 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3455 case "$dflt" in
3456 ''|' ') dflt=none ;;
3457 esac
3458 ;;
3459 esac
3460 ;;
3461 *) dflt="$osvers" ;;
3462esac
3463rp="Operating system version?"
3464. ./myread
3465case "$ans" in
3466none) osvers='' ;;
3467*) osvers="$ans" ;;
3468esac
3469
02e93a22
JH
3470
3471. ./posthint.sh
3472
2304df62 3473: who configured the system
59b83a6f 3474cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3475case "$cf_by" in
3476"")
7c04078e 3477 cf_by=`(logname) 2>/dev/null`
dfe9444c 3478 case "$cf_by" in
7c04078e
GA
3479 "")
3480 cf_by=`(whoami) 2>/dev/null`
3481 case "$cf_by" in
3482 "") cf_by=unknown ;;
3483 esac ;;
8ff267be 3484 esac ;;
3485esac
2304df62 3486
b4eb6b3d
JH
3487: set up the script used to warn in case of inconsistency
3488cat <<EOS >whoa
3489$startsh
3490EOS
3491cat <<'EOSC' >>whoa
3492dflt=y
3493echo " "
3494echo "*** WHOA THERE!!! ***" >&4
3495echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3496rp=" Keep the $hint value?"
3497. ./myread
3498case "$ans" in
3499y) td=$was; tu=$was;;
3500esac
3501EOSC
3502
3503: function used to set $1 to $val
3504setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3505case "$val$was" in
3506$define$undef) . ./whoa; eval "$var=\$td";;
3507$undef$define) . ./whoa; eval "$var=\$tu";;
3508*) eval "$var=$val";;
3509esac'
3510
b29b105d
JH
3511case "$usesocks" in
3512$define|true|[yY]*) dflt='y';;
3513*) dflt='n';;
3514esac
3515cat <<EOM
3516
3517Perl can be built to use the SOCKS proxy protocol library. To do so,
3518Configure must be run with -Dusesocks. If you use SOCKS you also need
3519to use the PerlIO abstraction layer, this will be implicitly selected.
3520
3521If this doesn't make any sense to you, just accept the default '$dflt'.
3522EOM
3523rp='Build Perl for SOCKS?'
3524. ./myread
3525case "$ans" in
3526y|Y) val="$define" ;;
3527*) val="$undef" ;;
3528esac
3529set usesocks
3530eval $setvar
3531
3532case "$usesocks" in
3533$define|true|[yY]*) useperlio="$define";;
3534esac
3535
3536case "$useperlio" in
3537$define|true|[yY]*|'') dflt='y';;
3538*) dflt='n';;
3539esac
3540cat <<EOM
3541
3542Previous version of $package used the standard IO mechanisms as
3543defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3544alternate IO mechanisms via the PerlIO abstraction layer, but the
3545stdio mechanism is still available if needed. The abstraction layer
3546can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3547Using PerlIO with sfio may cause problems with some extension modules.
3548
3549If this doesn't make any sense to you, just accept the default '$dflt'.
3550EOM
3551rp='Use the PerlIO abstraction layer?'
3552. ./myread
3553case "$ans" in
3554y|Y)
3555 val="$define"
3556 ;;
3557*)
3558 echo "Ok, doing things the stdio way."
3559 val="$undef"
3560 ;;
3561esac
3562set useperlio
3563eval $setvar
3564
3565case "$usesocks" in
3566$define|true|[yY]*)
3567 case "$useperlio" in
3568 $define|true|[yY]*) ;;
3569 *) cat >&4 <<EOM
3570
3571You are using the SOCKS proxy protocol library which means that you
3572should also use the PerlIO layer. You may be headed for trouble.
3573
3574EOM
3575 ;;
3576 esac
3577 ;;
3578esac
3579
3580
b4eb6b3d
JH
3581case "$usethreads" in
3582$define|true|[yY]*) dflt='y';;
8e285145
AD
3583*) # Catch case where user specified ithreads or 5005threads but
3584 # forgot -Dusethreads (A.D. 4/2002)
3585 case "$useithreads$use5005threads" in
b29b105d
JH
3586 *$define*)
3587 case "$useperlio" in
3588 "$define") dflt='y' ;;
3589 *) dflt='n' ;;
3590 esac
3591 ;;
3592 *) dflt='n';;
8e285145
AD
3593 esac
3594 ;;
b4eb6b3d
JH
3595esac
3596cat <<EOM
3597
3598Perl can be built to take advantage of threads on some systems.
3599To do so, Configure can be run with -Dusethreads.
3600
bfce6503
DM
3601Note that Perl built with threading support runs slightly slower
3602and uses more memory than plain Perl. The current implementation
3603is believed to be stable, but it is fairly new, and so should be
3604treated with caution.
b4eb6b3d
JH
3605
3606If this doesn't make any sense to you, just accept the default '$dflt'.
3607EOM
3608rp='Build a threading Perl?'
3609. ./myread
3610case "$ans" in
3611y|Y) val="$define" ;;
3612*) val="$undef" ;;
3613esac
3614set usethreads
3615eval $setvar
3616
3617case "$usethreads" in
3618$define)
3619 $cat <<EOM
3620
bfce6503
DM
3621Since release 5.6, Perl has had two different threading implementations,
3622the newer interpreter-based version (ithreads) with one interpreter per
3623thread, and the older 5.005 version (5005threads).
3624The 5005threads version is effectively unmaintained and will probably be
3625removed in Perl 5.10, so there should be no need to build a Perl using it
3626unless needed for backwards compatibility with some existing 5.005threads
3627code.
b4eb6b3d 3628
b4eb6b3d
JH
3629EOM
3630 : Default to ithreads unless overridden on command line or with
3631 : old config.sh
3632 dflt='y'
3633 case "$use5005threads" in
3634 $define|true|[yY]*) dflt='n';;
3635 esac
3636 case "$useithreads" in
3637 $undef|false|[nN]*) dflt='n';;
3638 esac
bfce6503 3639 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3640 . ./myread
3641 case "$ans" in
3642 y|Y) val="$define" ;;
3643 *) val="$undef" ;;
3644 esac
3645 set useithreads
3646 eval $setvar
3647 : Now set use5005threads to the opposite value.
3648 case "$useithreads" in
3649 $define) val="$undef" ;;
3650 *) val="$define" ;;
3651 esac
3652 set use5005threads
3653 eval $setvar
3654 ;;
3655*)
3656 useithreads="$undef"
3657 use5005threads="$undef"
3658 ;;
3659esac
3660
c915ce7f
JH
3661case "$useithreads$use5005threads" in
3662"$define$define")
3663 $cat >&4 <<EOM
3664
3665You cannot have both the ithreads and the 5.005 threads enabled
3666at the same time. Disabling the 5.005 threads since they are
3667much less stable than the ithreads.
3668
3669EOM
3670 use5005threads="$undef"
3671 ;;
3672esac
3673
b29b105d
JH
3674if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3675 cat >&4 <<EOF
3676***
3677*** To build with ithreads you must also use the PerlIO layer.
3678*** Cannot continue, aborting.
3679***
3680EOF
3681 exit 1
3682fi
3683
b4eb6b3d
JH
3684case "$d_oldpthreads" in
3685'') : Configure tests would be welcome here. For now, assume undef.
3686 val="$undef" ;;
3687*) val="$d_oldpthreads" ;;
3688esac
3689set d_oldpthreads
3690eval $setvar
3691
3692
b4eb6b3d
JH
3693: Look for a hint-file generated 'call-back-unit'. If the
3694: user has specified that a threading perl is to be built,
3695: we may need to set or change some other defaults.
9da7673b
MB
3696if $test -f usethreads.cbu; then
3697 echo "Your platform has some specific hints regarding threaded builds, using them..."
3698 . ./usethreads.cbu
3699else
3700 case "$usethreads" in
3701 "$define"|true|[yY]*)
b4eb6b3d 3702 $cat <<EOM
9da7673b 3703(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3704 Assuming POSIX threads, then.)
3705EOM
b4eb6b3d 3706 ;;
9da7673b
MB
3707 esac
3708fi
b4eb6b3d
JH
3709
3710cat <<EOM
3711
3712Perl can be built so that multiple Perl interpreters can coexist
3713within the same Perl executable.
3714EOM
3715
3716case "$useithreads" in
3717$define)
3718 cat <<EOM
3719This multiple interpreter support is required for interpreter-based threads.
3720EOM
3721 val="$define"
3722 ;;
3723*) case "$usemultiplicity" in
3724 $define|true|[yY]*) dflt='y';;
3725 *) dflt='n';;
3726 esac
3727 echo " "
3728 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3729 rp='Build Perl for multiplicity?'
3730 . ./myread
3731 case "$ans" in
3732 y|Y) val="$define" ;;
3733 *) val="$undef" ;;
3734 esac
3735 ;;
3736esac
3737set usemultiplicity
3738eval $setvar
3739
96056487
JH
3740
3741case "$usemorebits" in
3742"$define"|true|[yY]*)
3743 use64bitint="$define"
3744 uselongdouble="$define"
3745 usemorebits="$define"
3746 ;;
3747*) usemorebits="$undef"
3748 ;;
3749esac
3750
e5e20432
JH
3751: make some quick guesses about what we are up against
3752echo " "
3753$echo $n "Hmm... $c"
3754echo exit 1 >bsd
3755echo exit 1 >usg
3756echo exit 1 >v7
3757echo exit 1 >osf1
3758echo exit 1 >eunice
3759echo exit 1 >xenix
3760echo exit 1 >venix
3761echo exit 1 >os2
3762d_bsd="$undef"
3763$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3764if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3765then
3766 echo "Looks kind of like an OSF/1 system, but we'll see..."
3767 echo exit 0 >osf1
381aa1ff 3768elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3769 xxx=`./loc addbib blurfl $pth`
3770 if $test -f $xxx; then
3771 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3772 echo exit 0 >bsd
3773 echo exit 0 >usg
3774 else
3775 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3776 echo "Looks kind of like an extended USG system, but we'll see..."
3777 else
3778 echo "Looks kind of like a USG system, but we'll see..."
3779 fi
3780 echo exit 0 >usg
3781 fi
3782elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3783 echo "Looks kind of like a BSD system, but we'll see..."
3784 d_bsd="$define"
3785 echo exit 0 >bsd
3786else
3787 echo "Looks kind of like a Version 7 system, but we'll see..."
3788 echo exit 0 >v7
3789fi
3790case "$eunicefix" in
3791*unixtovms*)
3792 $cat <<'EOI'
3793There is, however, a strange, musty smell in the air that reminds me of
3794something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3795EOI
3796 echo exit 0 >eunice
3797 d_eunice="$define"
3798: it so happens the Eunice I know will not run shell scripts in Unix format
3799 ;;
3800*)
3801 echo " "
3802 echo "Congratulations. You aren't running Eunice."
3803 d_eunice="$undef"
3804 ;;
3805esac
3806: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3807: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3808: semicolon as a patch separator
e5e20432
JH
3809case "$p_" in
3810:) ;;
3811*)
3812 $cat <<'EOI'
3813I have the feeling something is not exactly right, however...don't tell me...
3814lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3815(Or you may be running DOS with DJGPP.)
e5e20432
JH
3816EOI
3817 echo exit 0 >os2
3818 ;;
3819esac
3820if test -f /xenix; then
3821 echo "Actually, this looks more like a XENIX system..."
3822 echo exit 0 >xenix
3823 d_xenix="$define"
3824else
3825 echo " "
3826 echo "It's not Xenix..."
3827 d_xenix="$undef"
3828fi
3829chmod +x xenix
3830$eunicefix xenix
3831if test -f /venix; then
3832 echo "Actually, this looks more like a VENIX system..."
3833 echo exit 0 >venix
3834else
3835 echo " "
3836 if ./xenix; then
3837 : null
3838 else
3839 echo "Nor is it Venix..."
3840 fi
3841fi
3842chmod +x bsd usg v7 osf1 eunice xenix venix os2
3843$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3844$rm -f foo
3845
5869b1f1
JH
3846case "$cc" in
3847'') dflt=cc;;
3848*) dflt="$cc";;
3849esac
3850rp="Use which C compiler?"
3851. ./myread
3852cc="$ans"
6b769f8f
RB
3853
3854: See if they have not cc but they do have gcc
3855. ./trygcc
e5e20432
JH
3856: Look for a hint-file generated 'call-back-unit'. Now that the
3857: user has specified the compiler, we may need to set or change some
3858: other defaults.
3859if $test -f cc.cbu; then
3860 . ./cc.cbu
3861fi
2573c5f9 3862. ./checkcc
8a27cf78 3863
e5e20432
JH
3864echo " "
3865echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3866$cat >try.c <<EOM
e5e20432
JH
3867#include <stdio.h>
3868int main() {
3869#ifdef __GNUC__
3870#ifdef __VERSION__
3871 printf("%s\n", __VERSION__);
3872#else
3873 printf("%s\n", "1");
3874#endif
3875#endif
073b6de5 3876 return(0);
e5e20432
JH
3877}
3878EOM
5440bc8e
JH
3879if $cc -o try $ccflags $ldflags try.c; then
3880 gccversion=`$run ./try`
e5e20432
JH
3881 case "$gccversion" in
3882 '') echo "You are not using GNU cc." ;;
fc68435e 3883 *) echo "You are using GNU cc $gccversion."
48fe685d 3884 ccname=gcc
fc68435e 3885 ;;
e5e20432
JH
3886 esac
3887else
3888 echo " "
3889 echo "*** WHOA THERE!!! ***" >&4
3890 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3891 case "$knowitall" in
3892 '')
3893 echo " You'd better start hunting for one and let me know about it." >&4
3894 exit 1
3895 ;;
3896 esac
3897fi
5440bc8e 3898$rm -f try try.*
e5e20432
JH
3899case "$gccversion" in
39001*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3901esac
5b463ca7
KS
3902case "$gccversion" in
3903'') gccosandvers='' ;;
10b4ebb5
JH
3904*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3905 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3906 gccshortvers=''
5b463ca7 3907 case "$gccosandvers" in
02903077
JH
3908 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3909 $osname$osvers) ;; # looking good
5b463ca7
KS
3910 $osname*) cat <<EOM >&4
3911
3912*** WHOA THERE!!! ***
3913
3914 Your gcc has not been compiled for the exact release of
3915 your operating system ($gccosandvers versus $osname$osvers).
3916
3917 In general it is a good idea to keep gcc synchronized with
3918 the operating system because otherwise serious problems
3919 may ensue when trying to compile software, like Perl.
3920
3921 I'm trying to be optimistic here, though, and will continue.
3922 If later during the configuration and build icky compilation
02903077
JH
3923 problems appear (headerfile conflicts being the most common
3924 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3925 your operating system release.
3926
3927EOM
3928 ;;
81575342 3929 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3930 esac
3931 ;;
3932esac
e723fc21
JH
3933case "$ccname" in
3934'') ccname="$cc" ;;
3935esac
e5e20432 3936
224cb7cb 3937# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3938# so we will take those off from locincpth.
3939case "$gccversion" in
39403*)
3941 echo "main(){}">try.c
224cb7cb
JH
3942 for incdir in $locincpth; do
3943 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3944 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3945 if test "X$warn" != X; then
44b94491 3946 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3947 fi
76589481
JH
3948 done
3949 $rm -f try try.*
3950esac
640374d0 3951
bd9b35c9
JH
3952: decide how portable to be. Allow command line overrides.
3953case "$d_portable" in
3954"$undef") ;;
3955*) d_portable="$define" ;;
104d25b7 3956esac
85ab1d1d 3957
bd9b35c9
JH
3958: set up shell script to do ~ expansion
3959cat >filexp <<EOSS
3960$startsh
3961: expand filename
3962case "\$1" in
3963 ~/*|~)
3964 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3965 ;;
3966 ~*)
3967 if $test -f /bin/csh; then
3968 /bin/csh -f -c "glob \$1"
3969 failed=\$?
3970 echo ""
3971 exit \$failed
e5e20432 3972 else
bd9b35c9
JH
3973 name=\`$expr x\$1 : '..\([^/]*\)'\`
3974 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3975 if $test ! -d "\$dir"; then
3976 me=\`basename \$0\`
3977 echo "\$me: can't locate home directory for: \$name" >&2
3978 exit 1
3979 fi
3980 case "\$1" in
3981 */*)
3982 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3983 ;;
3984 *)
3985 echo \$dir
e5e20432
JH
3986 ;;
3987 esac
3988 fi
b691c02f 3989 ;;
4633a7c4 3990*)
bd9b35c9 3991 echo \$1
2304df62
AD
3992 ;;
3993esac
4633a7c4
LW
3994EOSS
3995chmod +x filexp
3996$eunicefix filexp
2304df62
AD
3997
3998: now set up to get a file name
28757baa 3999cat <<EOS >getfile
4000$startsh
4001EOS
4002cat <<'EOSC' >>getfile
2304df62
AD
4003tilde=''
4004fullpath=''
4005already=''
4006skip=''
4007none_ok=''
4008exp_file=''
a0d0e21e 4009nopath_ok=''
2304df62
AD
4010orig_rp="$rp"
4011orig_dflt="$dflt"
b233458b
JH
4012case "$gfpth" in
4013'') gfpth='.' ;;
4014esac
2304df62
AD
4015
4016case "$fn" in
ecfc5424 4017*\(*)
d604bb53
JH
4018 : getfile will accept an answer from the comma-separated list
4019 : enclosed in parentheses even if it does not meet other criteria.
4020 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4021 fn=`echo $fn | sed 's/(.*)//'`
4022 ;;
4023esac
4024
4025case "$fn" in
a0d0e21e
LW
4026*:*)
4027 loc_file=`expr $fn : '.*:\(.*\)'`
4028 fn=`expr $fn : '\(.*\):.*'`
4029 ;;
4030esac
4031
4032case "$fn" in
2304df62
AD
4033*~*) tilde=true;;
4034esac
4035case "$fn" in
4036*/*) fullpath=true;;
4037esac
4038case "$fn" in
4039*+*) skip=true;;
4040esac
4041case "$fn" in
4042*n*) none_ok=true;;
4043esac
4044case "$fn" in
4045*e*) exp_file=true;;
4046esac
a0d0e21e
LW
4047case "$fn" in
4048*p*) nopath_ok=true;;
4049esac
2304df62
AD
4050
4051case "$fn" in
4052*f*) type='File';;
4053*d*) type='Directory';;
a0d0e21e 4054*l*) type='Locate';;
2304df62
AD
4055esac
4056
4057what="$type"
4058case "$what" in
4059Locate) what='File';;
4060esac
4061
4062case "$exp_file" in
4063'')
4064 case "$d_portable" in
4065 "$define") ;;
4066 *) exp_file=true;;
4067 esac
4068 ;;
4069esac
4070
4071cd ..
4072while test "$type"; do
4073 redo=''
4074 rp="$orig_rp"
4075 dflt="$orig_dflt"
4076 case "$tilde" in
4077 true) rp="$rp (~name ok)";;
4078 esac
4079 . UU/myread
ecfc5424
AD
4080 if test -f UU/getfile.ok && \
4081 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4082 then
4083 value="$ans"
4084 ansexp="$ans"
4085 break
4086 fi
2304df62
AD
4087 case "$ans" in
4088 none)
4089 value=''
4090 ansexp=''
4091 case "$none_ok" in
4092 true) type='';;
4093 esac
4094 ;;
4095 *)
4096 case "$tilde" in
4097 '') value="$ans"
4098 ansexp="$ans";;
4099 *)
4100 value=`UU/filexp $ans`
4101 case $? in
4102 0)
4103 if test "$ans" != "$value"; then
ecfc5424 4104 echo "(That expands to $value on this system.)"
2304df62
AD
4105 fi
4106 ;;
4107 *) value="$ans";;
4108 esac
4109 ansexp="$value"
4110 case "$exp_file" in
4111 '') value="$ans";;
4112 esac
4113 ;;
4114 esac
4115 case "$fullpath" in
4116 true)
4117 case "$ansexp" in
4118 /*) value="$ansexp" ;;
23da6c43 4119 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4120 *)
4121 redo=true
4122 case "$already" in
4123 true)
4124 echo "I shall only accept a full path name, as in /bin/ls." >&4
4125 echo "Use a ! shell escape if you wish to check pathnames." >&4
4126 ;;
4127 *)
4128 echo "Please give a full path name, starting with slash." >&4
4129 case "$tilde" in
4130 true)
4131 echo "Note that using ~name is ok provided it expands well." >&4
4132 already=true
4133 ;;
4134 esac
4135 esac
4136 ;;
4137 esac
4138 ;;
4139 esac
4140 case "$redo" in
4141 '')
4142 case "$type" in
4143 File)
b233458b
JH
4144 for fp in $gfpth; do
4145 if test "X$fp" = X.; then
4146 pf="$ansexp"
4147 else
4148 pf="$fp/$ansexp"
4149 fi
4150 if test -f "$pf"; then
4151 type=''
4152 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4153 then
4154 echo "($value is not a plain file, but that's ok.)"
4155 type=''
4156 fi
4157 if test X"$type" = X; then
4158 value="$pf"
4159 break
4160 fi
4161 done
2304df62
AD
4162 ;;
4163 Directory)
b233458b
JH
4164 for fp in $gfpth; do
4165 if test "X$fp" = X.; then
f78bfc9c
JH
4166 dir="$ans"
4167 direxp="$ansexp"
b233458b 4168 else
dd858076 4169 dir="$fp/$ansexp"
f78bfc9c 4170 direxp="$fp/$ansexp"
b233458b 4171 fi
f78bfc9c 4172 if test -d "$direxp"; then
b233458b 4173 type=''
f78bfc9c 4174 value="$dir"
b233458b
JH
4175 break
4176 fi
4177 done
2304df62
AD
4178 ;;
4179 Locate)
40000a8c 4180 if test -d "$ansexp"; then
a0d0e21e
LW
4181 echo "(Looking for $loc_file in directory $value.)"
4182 value="$value/$loc_file"
40000a8c 4183 ansexp="$ansexp/$loc_file"
2304df62 4184 fi
40000a8c 4185 if test -f "$ansexp"; then
2304df62
AD
4186 type=''
4187 fi
a0d0e21e
LW
4188 case "$nopath_ok" in
4189 true) case "$value" in
4190 */*) ;;
4191 *) echo "Assuming $value will be in people's path."
4192 type=''
4193 ;;
4194 esac
4195 ;;
4196 esac
2304df62
AD
4197 ;;
4198 esac
4199
4200 case "$skip" in
4201 true) type='';
4202 esac
4203
4204 case "$type" in
4205 '') ;;
4206 *)
4207 if test "$fastread" = yes; then
4208 dflt=y
4209 else
4210 dflt=n
4211 fi
4212 rp="$what $value doesn't exist. Use that name anyway?"
4213 . UU/myread
4214 dflt=''
4215 case "$ans" in
4216 y*) type='';;
4217 *) echo " ";;
4218 esac
4219 ;;
4220 esac
4221 ;;
4222 esac
4223 ;;
4224 esac
4225done
4226cd UU
4227ans="$value"
4228rp="$orig_rp"
4229dflt="$orig_dflt"
ecfc5424 4230rm -f getfile.ok
b233458b 4231test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4232EOSC
4233
bd9b35c9
JH
4234: What should the include directory be ?
4235echo " "
4236$echo $n "Hmm... $c"
4237dflt='/usr/include'
4238incpath=''
4239mips_type=''
4240if $test -f /bin/mips && /bin/mips; then
4241 echo "Looks like a MIPS system..."
4242 $cat >usr.c <<'EOCP'
4243#ifdef SYSTYPE_BSD43
4244/bsd43
4245#endif
4246EOCP
8a27cf78 4247 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4248 dflt='/bsd43/usr/include'
4249 incpath='/bsd43'
4250 mips_type='BSD 4.3'
4251 else
4252 mips_type='System V'
4253 fi
4254 $rm -f usr.c usr.out
4255 echo "and you're compiling with the $mips_type compiler and libraries."
4256 xxx_prompt=y
4257 echo "exit 0" >mips
4258else
4259 echo "Doesn't look like a MIPS system."
4260 xxx_prompt=n
4261 echo "exit 1" >mips
4262fi
4263chmod +x mips
4264$eunicefix mips
4265case "$usrinc" in
4266'') ;;
4267*) dflt="$usrinc";;
4268esac
4269case "$xxx_prompt" in
4270y) fn=d/
4271 echo " "
4272 rp='Where are the include files you want to use?'
4273 . ./getfile
4274 usrinc="$ans"
8e07c86e 4275 ;;
bd9b35c9 4276*) usrinc="$dflt"
8e07c86e
AD
4277 ;;
4278esac
2304df62 4279
96056487
JH
4280: see how we invoke the C preprocessor
4281echo " "
4282echo "Now, how can we feed standard input to your C preprocessor..." >&4
4283cat <<'EOT' >testcpp.c
4284#define ABC abc
4285#define XYZ xyz
4286ABC.XYZ
4287EOT
4288cd ..
4289if test ! -f cppstdin; then
4290 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4291 # AIX cc -E doesn't show the absolute headerfile
4292 # locations but we'll cheat by using the -M flag.
4293 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
4294 else
4295 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4296 fi
4297else
4298 echo "Keeping your $hint cppstdin wrapper."
4299fi
4300chmod 755 cppstdin
4301wrapper=`pwd`/cppstdin
4302ok='false'
4303cd UU
4304
4305if $test "X$cppstdin" != "X" && \
4306 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4307 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4308then
4309 echo "You used to use $cppstdin $cppminus so we'll use that again."
4310 case "$cpprun" in
4311 '') echo "But let's see if we can live without a wrapper..." ;;
4312 *)
4313 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4314 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4315 then
4316 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4317 ok='true'
4318 else
4319 echo "(However, $cpprun $cpplast does not work, let's see...)"
4320 fi
4321 ;;
4322 esac
4323else
4324 case "$cppstdin" in
4325 '') ;;
4326 *)
4327 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4328 ;;
4329 esac
4330fi
4331
4332if $ok; then
4333 : nothing
4334elif echo 'Maybe "'"$cc"' -E" will work...'; \
4335 $cc -E <testcpp.c >testcpp.out 2>&1; \
4336 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4337 echo "Yup, it does."
4338 x_cpp="$cc -E"
4339 x_minus='';
4340elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4341 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4342 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4343 echo "Yup, it does."
4344 x_cpp="$cc -E"
4345 x_minus='-';
4346elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4347 $cc -P <testcpp.c >testcpp.out 2>&1; \
4348 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4349 echo "Yipee, that works!"
4350 x_cpp="$cc -P"
4351 x_minus='';
4352elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4353 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4354 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4355 echo "At long last!"
4356 x_cpp="$cc -P"
4357 x_minus='-';
4358elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4359 $cpp <testcpp.c >testcpp.out 2>&1; \
4360 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361 echo "It works!"
4362 x_cpp="$cpp"
4363 x_minus='';
4364elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4365 $cpp - <testcpp.c >testcpp.out 2>&1; \
4366 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367 echo "Hooray, it works! I was beginning to wonder."
4368 x_cpp="$cpp"
4369 x_minus='-';
4370elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4371 $wrapper <testcpp.c >testcpp.out 2>&1; \
4372 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373 x_cpp="$wrapper"
4374 x_minus=''
4375 echo "Eureka!"
4376else
4377 dflt=''
4378 rp="No dice. I can't find a C preprocessor. Name one:"
4379 . ./myread
4380 x_cpp="$ans"
4381 x_minus=''
4382 $x_cpp <testcpp.c >testcpp.out 2>&1
4383 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4384 echo "OK, that will do." >&4
4385 else
4386echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4387 exit 1
4388 fi
4389fi
4390
4391case "$ok" in
4392false)
4393 cppstdin="$x_cpp"
4394 cppminus="$x_minus"
4395 cpprun="$x_cpp"
4396 cpplast="$x_minus"
4397 set X $x_cpp
4398 shift
4399 case "$1" in
4400 "$cpp")
4401 echo "Perhaps can we force $cc -E using a wrapper..."
4402 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4403 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4404 then
4405 echo "Yup, we can."
4406 cppstdin="$wrapper"
4407 cppminus='';
4408 else
4409 echo "Nope, we'll have to live without it..."
4410 fi
4411 ;;
4412 esac
4413 case "$cpprun" in
4414 "$wrapper")
4415 cpprun=''
4416 cpplast=''
4417 ;;
4418 esac
4419 ;;
4420esac
4421
4422case "$cppstdin" in
4423"$wrapper"|'cppstdin') ;;
4424*) $rm -f $wrapper;;
4425esac
4426$rm -f testcpp.c testcpp.out
4427
bd9b35c9
JH
4428: Set private lib path
4429case "$plibpth" in
4430'') if ./mips; then
4431 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4432 fi;;
4433esac
4434case "$libpth" in
4435' ') dlist='';;
4436'') dlist="$loclibpth $plibpth $glibpth";;
4437*) dlist="$libpth";;
4438esac
4439
4440: Now check and see which directories actually exist, avoiding duplicates
4441libpth=''
4442for xxx in $dlist
4443do
4444 if $test -d $xxx; then
4445 case " $libpth " in
4446 *" $xxx "*) ;;
4447 *) libpth="$libpth $xxx";;
4448 esac
4449 fi
4450done
4451$cat <<'EOM'
4452
4453Some systems have incompatible or broken versions of libraries. Among
4454the directories listed in the question below, please remove any you
4455know not to be holding relevant libraries, and add any that are needed.
4456Say "none" for none.
8e07c86e
AD
4457
4458EOM
bd9b35c9
JH
4459case "$libpth" in
4460'') dflt='none';;
8e07c86e 4461*)
bd9b35c9
JH
4462 set X $libpth
4463 shift
4464 dflt=${1+"$@"}
8e07c86e 4465 ;;
a0d0e21e 4466esac
bd9b35c9
JH
4467rp="Directories to use for library searches?"
4468. ./myread
4469case "$ans" in
4470none) libpth=' ';;
4471*) libpth="$ans";;
4472esac
a0d0e21e 4473
bd9b35c9
JH
4474: compute shared library extension
4475case "$so" in
4476'')
4477 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4478 dflt='sl'
dd4e71fd 4479 else
bd9b35c9 4480 dflt='so'
dd4e71fd
JH
4481 fi
4482 ;;
bd9b35c9 4483*) dflt="$so";;
dd4e71fd 4484esac
dd4e71fd
JH
4485$cat <<EOM
4486
bd9b35c9 4487On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4488you want to suppress searching of shared libraries for the remainder
bd9b35c9 4489of this configuration.
dd4e71fd
JH
4490
4491EOM
bd9b35c9
JH
4492rp='What is the file extension used for shared libraries?'
4493. ./myread
4494so="$ans"
dd4e71fd 4495
bd9b35c9
JH
4496: Define several unixisms.
4497: Hints files or command line option can be used to override them.
4498: The convoluted testing is in case hints files set either the old
4499: or the new name.
4500case "$_exe" in
4501'') case "$exe_ext" in
1fef16b3 4502 '') ;;
bd9b35c9 4503 *) _exe="$exe_ext" ;;
dd4e71fd 4504 esac
bd9b35c9 4505 ;;
bfb7748a 4506esac
bd9b35c9
JH
4507case "$_a" in
4508'') case "$lib_ext" in
4509 '') _a='.a';;
4510 *) _a="$lib_ext" ;;
dd4e71fd
JH
4511 esac
4512 ;;
dd4e71fd 4513esac
bd9b35c9
JH
4514case "$_o" in
4515'') case "$obj_ext" in
4516 '') _o='.o';;
4517 *) _o="$obj_ext";;
4518 esac
4519 ;;
4520esac
4521case "$p_" in
4522'') case "$path_sep" in
4523 '') p_=':';;
4524 *) p_="$path_sep";;
4525 esac
4526 ;;
4527esac
4528exe_ext=$_exe
4529lib_ext=$_a
4530obj_ext=$_o
4531path_sep=$p_
dd4e71fd 4532
b4eb6b3d
JH
4533: Which makefile gets called first. This is used by make depend.
4534case "$firstmakefile" in
4535'') firstmakefile='makefile';;
4633a7c4 4536esac
4633a7c4 4537
1f603089
JH
4538case "$ccflags" in
4539*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4540esac
4541
4542case "$uselongdouble" in
4543$define|true|[yY]*) dflt='y';;
4544*) dflt='n';;
4545esac
4546cat <<EOM
4547
4548Perl can be built to take advantage of long doubles which
4549(if available) may give more accuracy and range for floating point numbers.
4550
4551If this doesn't make any sense to you, just accept the default '$dflt'.
4552EOM
4553rp='Try to use long doubles if available?'
4554. ./myread
4555case "$ans" in
4556y|Y) val="$define" ;;
4557*) val="$undef" ;;
4558esac
4559set uselongdouble
4560eval $setvar
4561
4562case "$uselongdouble" in
4563true|[yY]*) uselongdouble="$define" ;;
4564esac
4565
1f603089
JH
4566: Look for a hint-file generated 'call-back-unit'. If the
4567: user has specified that long doubles should be used,
4568: we may need to set or change some other defaults.
9da7673b
MB
4569if $test -f uselongdouble.cbu; then
4570 echo "Your platform has some specific hints regarding long doubles, using them..."
4571 . ./uselongdouble.cbu
4572else
4573 case "$uselongdouble" in
4574 $define)
1f603089 4575 $cat <<EOM
9da7673b 4576(Your platform does not have any specific hints for long doubles.)
1f603089 4577EOM
1f603089 4578 ;;
9da7673b
MB
4579 esac
4580fi
1f603089 4581
bd9b35c9
JH
4582: Looking for optional libraries
4583echo " "
4584echo "Checking for optional libraries..." >&4
4585case "$libs" in
4586' '|'') dflt='';;
4587*) dflt="$libs";;
4588esac
4589case "$libswanted" in
4590'') libswanted='c_s';;
4591esac
4592case "$usesocks" in
923fc586 4593"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4594esac
68435ea7
JH
4595libsfound=''
4596libsfiles=''
4597libsdirs=''
13b3f787
JH
4598libspath=''
4599for thisdir in $libpth $xlibpth; do
4600 test -d $thisdir && libspath="$libspath $thisdir"
4601done
bd9b35c9 4602for thislib in $libswanted; do
13b3f787 4603 for thisdir in $libspath; do
f7dd4e7f
JH
4604 xxx=''
4605 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4606 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4607 $test -f "$xxx" && eval $libscheck
4608 $test -f "$xxx" && libstyle=shared
4609 fi
4610 if test ! -f "$xxx"; then
4611 xxx=$thisdir/lib$thislib.$so
4612 $test -f "$xxx" && eval $libscheck
4613 $test -f "$xxx" && libstyle=shared
4614 fi
4615 if test ! -f "$xxx"; then
4616 xxx=$thisdir/lib$thislib$_a
4617 $test -f "$xxx" && eval $libscheck
4618 $test -f "$xxx" && libstyle=static
4619 fi
4620 if test ! -f "$xxx"; then
4621 xxx=$thisdir/$thislib$_a
4622 $test -f "$xxx" && eval $libscheck
4623 $test -f "$xxx" && libstyle=static
4624 fi
4625 if test ! -f "$xxx"; then
4626 xxx=$thisdir/lib${thislib}_s$_a
4627 $test -f "$xxx" && eval $libscheck
4628 $test -f "$xxx" && libstyle=static
09ea5ba9 4629 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4630 fi
4631 if test ! -f "$xxx"; then
4632 xxx=$thisdir/Slib$thislib$_a
4633 $test -f "$xxx" && eval $libscheck
4634 $test -f "$xxx" && libstyle=static
4635 fi
4636 if $test -f "$xxx"; then
43999f95 4637 case "$libstyle" in
f7dd4e7f
JH
4638 shared) echo "Found -l$thislib (shared)." ;;
4639 static) echo "Found -l$thislib." ;;
4640 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4641 esac
bd9b35c9
JH
4642 case " $dflt " in
4643 *"-l$thislib "*);;
f7dd4e7f 4644 *) dflt="$dflt -l$thislib"
43999f95
JH
4645 libsfound="$libsfound $xxx"
4646 yyy=`basename $xxx`
4647 libsfiles="$libsfiles $yyy"
1e127011 4648 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4649 case " $libsdirs " in
4650 *" $yyy "*) ;;
4651 *) libsdirs="$libsdirs $yyy" ;;
4652 esac
4653 ;;
bd9b35c9 4654 esac
f7dd4e7f
JH
4655 break
4656 fi
4657 done
4658 if $test ! -f "$xxx"; then
4659 echo "No -l$thislib."
bd9b35c9
JH
4660 fi
4661done
4662set X $dflt
4663shift
4664dflt="$*"
4665case "$libs" in
4666'') dflt="$dflt";;
4667*) dflt="$libs";;
4668esac
4669case "$dflt" in
4670' '|'') dflt='none';;
4671esac
4633a7c4 4672
bd9b35c9 4673$cat <<EOM
4633a7c4 4674
bd9b35c9
JH
4675In order to compile $package on your machine, a number of libraries
4676are usually needed. Include any other special libraries here as well.
4677Say "none" for none. The default list is almost always right.
8e07c86e 4678EOM
8e07c86e 4679
bd9b35c9
JH
4680echo " "
4681rp="What libraries to use?"
4682. ./myread
4683case "$ans" in
4684none) libs=' ';;
4685*) libs="$ans";;
4686esac
d71b2b6b 4687
bd9b35c9
JH
4688: determine optimization, if desired, or use for debug flag also
4689case "$optimize" in
4690' '|$undef) dflt='none';;
4691'') dflt='-O';;
4692*) dflt="$optimize";;
4693esac
4694$cat <<EOH
d71b2b6b 4695
bd9b35c9
JH
4696By default, $package compiles with the -O flag to use the optimizer.
4697Alternately, you might want to use the symbolic debugger, which uses
4698the -g flag (on traditional Unix systems). Either flag can be
4699specified here. To use neither flag, specify the word "none".
d71b2b6b 4700
bd9b35c9
JH
4701EOH
4702rp="What optimizer/debugger flag should be used?"
4703. ./myread
4704optimize="$ans"
4705case "$optimize" in
4706'none') optimize=" ";;
4707esac
4708
4709dflt=''
4710: We will not override a previous value, but we might want to
4711: augment a hint file
4712case "$hint" in
4713default|recommended)
4714 case "$gccversion" in
4715 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4716 esac
bd9b35c9
JH
4717 case "$optimize" in
4718 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4719 esac
bd9b35c9
JH
4720 case "$gccversion" in
4721 2*) if test -d /etc/conf/kconfig.d &&
4722 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4723 then
00e89ad4 4724 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4725 dflt="$dflt -posix"
4726 fi
f0d04425 4727 ;;
bd9b35c9
JH
4728 esac
4729 case "$gccversion" in
4730 1*) ;;
4731 2.[0-8]*) ;;
4732 ?*) echo " "
4733 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4734 echo 'int main(void) { return 0; }' > gcctest.c
4735 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4736 echo "Yes, it does." 2>&1
4737 case "$ccflags" in
00e89ad4 4738 *strict-aliasing*)
bd9b35c9
JH
4739 echo "Leaving current flags $ccflags alone." 2>&1
4740 ;;
4741 *) dflt="$dflt -fno-strict-aliasing" ;;
4742 esac
4743 else
4744 echo "Nope, it doesn't, but that's ok." 2>&1
4745 fi
f0d04425 4746 ;;
e5e20432 4747 esac
00e89ad4
AD
4748 # For gcc, adding -pipe speeds up compilations for some, but apparently
4749 # some assemblers can't read from stdin. (It also slows down compilations
4750 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4751 case "$gccversion" in
4752 ?*) echo " "
4753 echo "Checking if your compiler accepts -pipe" 2>&1
4754 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4755 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4756 echo "Yes, it does." 2>&1
4757 case "$ccflags" in
4758 *-pipe*)
4759 echo "Leaving current flags $ccflags alone." 2>&1
4760 ;;
4761 *) dflt="$dflt -pipe" ;;
4762 esac
4763 else
4764 echo "Nope, it doesn't, but that's ok." 2>&1
4765 fi
6347b5be
SP
4766
4767 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4768 echo 'int main(void) { return 0; }' > gcctest.c
4769 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4770 echo "Yes, it does." 2>&1
4771 case "$ccflags" in
4772 *-Wdeclaration-after-statement*)
4773 echo "Leaving current flags $ccflags alone." 2>&1
4774 ;;
4775 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4776 esac
4777 else
4778 echo "Nope, it doesn't, but that's ok." 2>&1
4779 fi
00e89ad4
AD
4780 ;;
4781 esac
e5e20432
JH
4782 ;;
4783esac
4784
bd9b35c9
JH
4785case "$mips_type" in
4786*BSD*|'') inclwanted="$locincpth $usrinc";;
4787*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4788esac
4789for thisincl in $inclwanted; do
4790 if $test -d $thisincl; then
4791 if $test x$thisincl != x$usrinc; then
4792 case "$dflt" in
00e89ad4
AD
4793 *" -I$thisincl "*);;
4794 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4795 esac
4796 fi
4797 fi
4798done
40a7a20a 4799
bd9b35c9
JH
4800inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4801 xxx=true;
4802elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4803 xxx=true;
4804else
4805 xxx=false;
4806fi;
4807if $xxx; then
4808 case "$dflt" in
4809 *$2*);;
4810 *) dflt="$dflt -D$2";;
4811 esac;
4812fi'
40a7a20a 4813
bd9b35c9 4814set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4815
bd9b35c9
JH
4816case "$usesocks" in
4817$define)
4818 ccflags="$ccflags -DSOCKS"
4819 ;;
4820esac
40a7a20a 4821
bd9b35c9
JH
4822case "$hint" in
4823default|recommended) dflt="$ccflags $dflt" ;;
4824*) dflt="$ccflags";;
4825esac
40a7a20a 4826
bd9b35c9
JH
4827case "$dflt" in
4828''|' ') dflt=none;;
4829esac
422af00a 4830
bd9b35c9 4831$cat <<EOH
40a7a20a 4832
bd9b35c9
JH
4833Your C compiler may want other flags. For this question you should include
4834-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4835but you should NOT include libraries or ld flags like -lwhatever. If you
4836want $package to honor its debug switch, you should include -DDEBUGGING here.
4837Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4838
bd9b35c9 4839To use no flags, specify the word "none".
40a7a20a 4840
bd9b35c9
JH
4841EOH
4842set X $dflt
4843shift
4844dflt=${1+"$@"}
4845rp="Any additional cc flags?"
4846. ./myread
4847case "$ans" in
4848none) ccflags='';;
4849*) ccflags="$ans";;
4850esac
8e07c86e 4851
bd9b35c9 4852: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4853case "$cppflags" in
4854'') cppflags="$ccflags" ;;
4855*) cppflags="$cppflags $ccflags" ;;
4856esac
bd9b35c9
JH
4857case "$gccversion" in
48581*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4859esac
bd9b35c9
JH
4860case "$mips_type" in
4861'');;
4862*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4863esac
4864case "$cppflags" in
4865'');;
4866*)
4867 echo " "
4868 echo "Let me guess what the preprocessor flags are..." >&4
4869 set X $cppflags
4870 shift
4871 cppflags=''
4872 $cat >cpp.c <<'EOM'
4873#define BLURFL foo
8e07c86e 4874
bd9b35c9
JH
4875BLURFL xx LFRULB
4876EOM
4877 previous=''
4878 for flag in $*
4879 do
4880 case "$flag" in
4881 -*) ftry="$flag";;
4882 *) ftry="$previous $flag";;
4883 esac
4884 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4885 >cpp1.out 2>/dev/null && \
4886 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4887 >cpp2.out 2>/dev/null && \
4888 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4889 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4890 then
4891 cppflags="$cppflags $ftry"
4892 previous=''
4893 else
4894 previous="$flag"
4895 fi
4896 done
4897 set X $cppflags
4898 shift
4899 cppflags=${1+"$@"}
4900 case "$cppflags" in
4901 *-*) echo "They appear to be: $cppflags";;
4902 esac
4903 $rm -f cpp.c cpp?.out
2afac517 4904 ;;
4905esac
8e07c86e 4906
bd9b35c9
JH
4907: flags used in final linking phase
4908case "$ldflags" in
4909'') if ./venix; then
4910 dflt='-i -z'
10a23457 4911 else
bd9b35c9 4912 dflt=''
10a23457 4913 fi
bd9b35c9
JH
4914 case "$ccflags" in
4915 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4916 esac
bd9b35c9
JH
4917 ;;
4918*) dflt="$ldflags";;
4919esac
4920
4921: Try to guess additional flags to pick up local libraries.
4922for thislibdir in $libpth; do
4923 case " $loclibpth " in
4924 *" $thislibdir "*)
00e89ad4 4925 case "$dflt " in
bd9b35c9
JH
4926 *"-L$thislibdir "*) ;;
4927 *) dflt="$dflt -L$thislibdir" ;;
4928 esac
c4f23d77
AD
4929 ;;
4930 esac
bd9b35c9 4931done
c4f23d77 4932
bd9b35c9
JH
4933case "$dflt" in
4934'') dflt='none' ;;
4935esac
c4f23d77 4936
bd9b35c9
JH
4937$cat <<EOH
4938
4939Your C linker may need flags. For this question you should
4940include -L/whatever and any other flags used by the C linker, but you
4941should NOT include libraries like -lwhatever.
4942
4943Make sure you include the appropriate -L/path flags if your C linker
4944does not normally search all of the directories you specified above,
4945namely
4946 $libpth
4947To use no flags, specify the word "none".
4948
4949EOH
4950
4951rp="Any additional ld flags (NOT including libraries)?"
4952. ./myread
4953case "$ans" in
4954none) ldflags='';;
4955*) ldflags="$ans";;
4956esac
4957rmlist="$rmlist pdp11"
4958
4959: coherency check
4960echo " "
4961echo "Checking your choice of C compiler and flags for coherency..." >&4
4962$cat > try.c <<'EOF'
4963#include <stdio.h>
55954f19 4964int main() { printf("Ok\n"); return(0); }
bd9b35c9 4965EOF
7a282f6d 4966set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4967shift
4968$cat >try.msg <<'EOM'
4969I've tried to compile and run the following simple program:
4970
4971EOM
4972$cat try.c >> try.msg
4973
4974$cat >> try.msg <<EOM
4975
4976I used the command:
4977
4978 $*
5440bc8e 4979 $run ./try
bd9b35c9
JH
4980
4981and I got the following output:
4982
4983EOM
4984dflt=y
73614538 4985if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4986 if $sh -c "$run ./try" >>try.msg 2>&1; then
4987 xxx=`$run ./try`
bd9b35c9
JH
4988 case "$xxx" in
4989 "Ok") dflt=n ;;
4990 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4991 case " $libs " in
4992 *" -lsfio "*)
4993 cat >> try.msg <<'EOQS'
4994If $libs contains -lsfio, and sfio is mis-configured, then it
4995sometimes (apparently) runs and exits with a 0 status, but with no
4996output! It may have to do with sfio's use of _exit vs. exit.
4997
4998EOQS
4999 rp="You have a big problem. Shall I abort Configure"
5000 dflt=y
5001 ;;
5002 esac
5003 ;;
5004 esac
5005 else
5006 echo "The program compiled OK, but exited with status $?." >>try.msg
5007 rp="You have a problem. Shall I abort Configure"
5008 dflt=y
5009 fi
5010else
5011 echo "I can't compile the test program." >>try.msg
5012 rp="You have a BIG problem. Shall I abort Configure"
5013 dflt=y
5014fi
5015case "$dflt" in
5016y)
5017 $cat try.msg >&4
5018 case "$knowitall" in
5019 '')
5020 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5021 ;;
bd9b35c9 5022 *) dflt=n;;
c4f23d77 5023 esac
bd9b35c9
JH
5024 echo " "
5025 . ./myread
5026 case "$ans" in
5027 n*|N*) ;;
5028 *) echo "Ok. Stopping Configure." >&4
5029 exit 1
c4f23d77
AD
5030 ;;
5031 esac
5032 ;;
bd9b35c9 5033n) echo "OK, that should do.";;
c4f23d77 5034esac
bd9b35c9 5035$rm -f try try.* core
c4f23d77 5036
bd9b35c9
JH
5037: define a shorthand compile call
5038compile='
5039mc_file=$1;
5040shift;
08413ebc 5041$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5042: define a shorthand compile call for compilations that should be ok.
5043compile_ok='
5044mc_file=$1;
5045shift;
7a282f6d 5046$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5047
8dfa8df9
JH
5048: determine filename position in cpp output
5049echo " "
5050echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5051case "$osname" in
5052vos) testaccess=-e ;;
5053*) testaccess=-r ;;
5054esac
8dfa8df9
JH
5055echo '#include <stdio.h>' > foo.c
5056$cat >fieldn <<EOF
5057$startsh
5058$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5059$grep '^[ ]*#.*stdio\.h' | \
5060while read cline; do
5061 pos=1
5062 set \$cline
5063 while $test \$# -gt 0; do
a5a94ea5 5064 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5065 echo "\$pos"
5066 exit 0
5067 fi
5068 shift
5069 pos=\`expr \$pos + 1\`
5070 done
5071done
5072EOF
5073chmod +x fieldn
5074fieldn=`./fieldn`
5075$rm -f foo.c fieldn
5076case $fieldn in
5077'') pos='???';;
50781) pos=first;;
50792) pos=second;;
50803) pos=third;;
5081*) pos="${fieldn}th";;
5082esac
5083echo "Your cpp writes the filename in the $pos field of the line."
5084
3c728e00
JH
5085case "$osname" in
5086vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5087os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5088*) cppfilter='' ;;
5089esac
8dfa8df9
JH
5090: locate header file
5091$cat >findhdr <<EOF
5092$startsh
5093wanted=\$1
5094name=''
5095for usrincdir in $usrinc
5096do
5097 if test -f \$usrincdir/\$wanted; then
5098 echo "\$usrincdir/\$wanted"
5099 exit 0
5100 fi
5101done
5102awkprg='{ print \$$fieldn }'
5103echo "#include <\$wanted>" > foo\$\$.c
5104$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5105$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5106while read cline; do
5107 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5108 case "\$name" in
5109 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5110 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5111 *) exit 2;;
5112 esac;
5113done;
5114#
5115# status = 0: grep returned 0 lines, case statement not executed
5116# status = 1: headerfile found
5117# status = 2: while loop executed, no headerfile found
5118#
5119status=\$?
5120$rm -f foo\$\$.c;
5121if test \$status -eq 1; then
5122 exit 0;
5123fi
5124exit 1
5125EOF
5126chmod +x findhdr
5127
5128: define an alternate in-header-list? function
5129inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5130cont=true; xxf="echo \"<\$1> found.\" >&4";
5131case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5132*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5133esac;
5134case $# in 4) instead=instead;; *) instead="at last";; esac;
5135while $test "$cont"; do
5136 xxx=`./findhdr $1`
5137 var=$2; eval "was=\$$2";
5138 if $test "$xxx" && $test -r "$xxx";
5139 then eval $xxf;
5140 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5141 cont="";
5142 else eval $xxnf;
5143 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5144 set $yyy; shift; shift; yyy=$@;
5145 case $# in 0) cont="";;
5146 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5147 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5148 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5149 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5150 esac;
5151done;
5152while $test "$yyy";
5153do set $yyy; var=$2; eval "was=\$$2";
5154 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5155 set $yyy; shift; shift; yyy=$@;
5156done'
5157
d1daaddf
JH
5158: see if stdlib is available
5159set stdlib.h i_stdlib
5160eval $inhdr
5161
5162: check for lengths of integral types
5163echo " "
5164case "$intsize" in
5165'')
5166 echo "Checking to see how big your integers are..." >&4
c63dfae1 5167 $cat >try.c <<EOCP
d1daaddf
JH
5168#include <stdio.h>
5169#$i_stdlib I_STDLIB
5170#ifdef I_STDLIB
5171#include <stdlib.h>
5172#endif
5173int main()
5174{
5175 printf("intsize=%d;\n", (int)sizeof(int));
5176 printf("longsize=%d;\n", (int)sizeof(long));
5177 printf("shortsize=%d;\n", (int)sizeof(short));
5178 exit(0);
5179}
5180EOCP
5181 set try
5182 if eval $compile_ok && $run ./try > /dev/null; then
5183 eval `$run ./try`
5184 echo "Your integers are $intsize bytes long."
5185 echo "Your long integers are $longsize bytes long."
5186 echo "Your short integers are $shortsize bytes long."
5187 else
5188 $cat >&4 <<EOM
5189!
5190Help! I can't compile and run the intsize test program: please enlighten me!
5191(This is probably a misconfiguration in your system or libraries, and
5192you really ought to fix it. Still, I'll try anyway.)
5193!
5194EOM
5195 dflt=4
5196 rp="What is the size of an integer (in bytes)?"
5197 . ./myread
5198 intsize="$ans"
5199 dflt=$intsize
5200 rp="What is the size of a long integer (in bytes)?"
5201 . ./myread
5202 longsize="$ans"
5203 dflt=2
5204 rp="What is the size of a short integer (in bytes)?"
5205 . ./myread
5206 shortsize="$ans"
5207 fi
5208 ;;
5209esac
5210$rm -f try try.*
5211
5212: check for long long
5213echo " "
5214echo "Checking to see if you have long long..." >&4
5215echo 'int main() { long long x = 7; return 0; }' > try.c
5216set try
5217if eval $compile; then
5218 val="$define"
5219 echo "You have long long."
5220else
5221 val="$undef"
5222 echo "You do not have long long."
5223fi
5224$rm try.*
5225set d_longlong
5226eval $setvar
5227
5228: check for length of long long
5229case "${d_longlong}${longlongsize}" in
5230$define)
5231 echo " "
5232 echo "Checking to see how big your long longs are..." >&4
5233 $cat >try.c <<'EOCP'
5234#include <stdio.h>
5235int main()
5236{
5237 printf("%d\n", (int)sizeof(long long));
5238 return(0);
5239}
5240EOCP
5241 set try
5242 if eval $compile_ok; then
5243 longlongsize=`$run ./try`
5244 echo "Your long longs are $longlongsize bytes long."
5245 else
5246 dflt='8'
5247 echo " "
5248 echo "(I can't seem to compile the test program. Guessing...)"
5249 rp="What is the size of a long long (in bytes)?"
5250 . ./myread
5251 longlongsize="$ans"
5252 fi
5253 if $test "X$longsize" = "X$longlongsize"; then
5254 echo "(That isn't any different from an ordinary long.)"
5255 fi
5256 ;;
5257esac
5258$rm -f try.* try
5259
8dfa8df9
JH
5260: see if inttypes.h is available
5261: we want a real compile instead of Inhdr because some systems
5262: have an inttypes.h which includes non-existent headers
5263echo " "
5264$cat >try.c <<EOCP
5265#include <inttypes.h>
5266int main() {
5267 static int32_t foo32 = 0x12345678;
5268}
5269EOCP
5270set try
5271if eval $compile; then
5272 echo "<inttypes.h> found." >&4
5273 val="$define"
5274else
5275 echo "<inttypes.h> NOT found." >&4
5276 val="$undef"
5277fi
5278$rm -f try.c try
5279set i_inttypes
5280eval $setvar
5281
5282: check for int64_t
5283echo " "
5284echo "Checking to see if you have int64_t..." >&4
5285$cat >try.c <<EOCP
5286#include <sys/types.h>
5287#$i_inttypes I_INTTYPES
5288#ifdef I_INTTYPES
5289#include <inttypes.h>
5290#endif
5291int main() { int64_t x = 7; }
5292EOCP
5293set try
5294if eval $compile; then
5295 val="$define"
5296 echo "You have int64_t."
5297else
5298 val="$undef"
5299 echo "You do not have int64_t."
5300fi
5301$rm -f try try.*
5302set d_int64_t
5303eval $setvar
5304
5305
5306echo " "
5307echo "Checking which 64-bit integer type we could use..." >&4
5308
5309case "$intsize" in
53108) val=int
5311 set quadtype
5312 eval $setvar
5313 val='"unsigned int"'
5314 set uquadtype
5315 eval $setvar
5316 quadkind=1
5317 ;;
5318*) case "$longsize" in
5319 8) val=long
5320 set quadtype
5321 eval $setvar
5322 val='"unsigned long"'
5323 set uquadtype
5324 eval $setvar
5325 quadkind=2
5326 ;;
5327 *) case "$d_longlong:$longlongsize" in
5328 define:8)
5329 val='"long long"'
5330 set quadtype
5331 eval $setvar
5332 val='"unsigned long long"'
5333 set uquadtype
5334 eval $setvar
5335 quadkind=3
5336 ;;
5337 *) case "$d_int64_t" in
5338 define)
5339 val=int64_t
5340 set quadtype
5341 eval $setvar
5342 val=uint64_t
5343 set uquadtype
5344 eval $setvar
5345 quadkind=4
5346 ;;
5347 esac
5348 ;;
5349 esac
5350 ;;
5351 esac
5352 ;;
5353esac
5354
5355case "$quadtype" in
5356'') echo "Alas, no 64-bit integer types in sight." >&4
5357 d_quad="$undef"
5358 ;;
5359*) echo "We could use '$quadtype' for 64-bit integers." >&4
5360 d_quad="$define"
5361 ;;
5362esac
5363
b4eb6b3d
JH
5364
5365case "$uselonglong" in
5366"$define"|true|[yY]*)
5367 cat <<EOM >&4
5368
5369*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5370EOM
5371 use64bitint="$define"
5372 ;;
5373esac
5374case "$use64bits" in
5375"$define"|true|[yY]*)
5376 cat <<EOM >&4
5377
5378*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5379EOM
5380 use64bitint="$define"
5381 ;;
5382esac
5383case "$use64bitints" in
5384"$define"|true|[yY]*)
5385 cat <<EOM >&4
5386
5387*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5388EOM
5389 use64bitint="$define"
5390 ;;
5391esac
5392case "$use64bitsint" in
5393"$define"|true|[yY]*)
5394 cat <<EOM >&4
5395
5396*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5397EOM
5398 use64bitint="$define"
5399 ;;
5400esac
5401case "$uselonglongs" in
5402"$define"|true|[yY]*)
5403 cat <<EOM >&4
5404
5405*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5406EOM
5407 use64bitint="$define"
5408 ;;
5409esac
5410case "$use64bitsall" in
5411"$define"|true|[yY]*)
5412 cat <<EOM >&4
5413
5414*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5415EOM
5416 use64bitall="$define"
5417 ;;
5418esac
5419
5420case "$ccflags" in
5421*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5422esac
5423case "$use64bitall" in
5424"$define"|true|[yY]*) use64bitint="$define" ;;
5425esac
5426
5427case "$longsize" in
54288) cat <<EOM
5429
5430You have natively 64-bit long integers.
5431EOM
5432 val="$define"
5433 ;;
5434*) case "$use64bitint" in
5435 "$define"|true|[yY]*) dflt='y';;
5436 *) dflt='n';;
5437 esac
8dfa8df9
JH
5438 case "$d_quad" in
5439 "$define") ;;
5440 *) dflt='n' ;;
5441 esac
b4eb6b3d
JH
5442 cat <<EOM
5443
5444Perl can be built to take advantage of 64-bit integer types
5445on some systems. To do so, Configure can be run with -Duse64bitint.
5446Choosing this option will most probably introduce binary incompatibilities.
5447
5448If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5449(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5450EOM
5451 rp='Try to use 64-bit integers, if available?'
5452 . ./myread
5453 case "$ans" in
5454 [yY]*) val="$define" ;;
5455 *) val="$undef" ;;
5456 esac
5457 ;;
5458esac
5459set use64bitint
5460eval $setvar
5461
5462case "$use64bitall" in
5463"$define"|true|[yY]*) dflt='y' ;;
5464*) case "$longsize" in
5465 8) dflt='y' ;;
5466 *) dflt='n' ;;
5467 esac
5468 ;;
5469esac
5470cat <<EOM
5471
5472You may also choose to try maximal 64-bitness. It means using as much
547364-bitness as possible on the platform. This in turn means even more
5474binary incompatibilities. On the other hand, your platform may not
5475have any more 64-bitness available than what you already have chosen.
5476
5477If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5478(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5479EOM
5480rp='Try to use maximal 64-bit support, if available?'
5481. ./myread
5482case "$ans" in
5483[yY]*) val="$define" ;;
5484*) val="$undef" ;;
5485esac
5486set use64bitall
5487eval $setvar
5488case "$use64bitall" in
5489"$define")
5490 case "$use64bitint" in
5491 "$undef")
5492 cat <<EOM
5493
5494Since you have chosen a maximally 64-bit build, I'm also turning on
5495the use of 64-bit integers.
5496EOM
5497 use64bitint="$define" ;;
5498 esac
5499 ;;
5500esac
5501
b4eb6b3d
JH
5502: Look for a hint-file generated 'call-back-unit'. If the
5503: user has specified that a 64-bit perl is to be built,
5504: we may need to set or change some other defaults.
19a100ff 5505if $test -f use64bitint.cbu; then
9da7673b 5506 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5507 . ./use64bitint.cbu
5508fi
9da7673b
MB
5509case "$use64bitint" in
5510"$define"|true|[yY]*)
b4eb6b3d
JH
5511 case "$longsize" in
5512 4) case "$archname64" in
5513 '') archname64=64int ;;
5514 esac
5515 ;;
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 maximally 64-bit perl is to be built,
5522: we may need to set or change some other defaults.
19a100ff 5523if $test -f use64bitall.cbu; then
9da7673b 5524 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5525 . ./use64bitall.cbu
5526fi
9da7673b
MB
5527case "$use64bitall" in
5528"$define"|true|[yY]*)
b4eb6b3d
JH
5529 case "$longsize" in
5530 4) case "$archname64" in
5531 ''|64int) archname64=64all ;;
5532 esac
5533 ;;
5534 esac
5535 ;;
5536esac
5537
1911a026
JH
5538case "$d_quad:$use64bitint" in
5539$undef:$define)
5540 cat >&4 <<EOF
5541
5542*** You have chosen to use 64-bit integers,
19a100ff 5543*** but none can be found.
09b58c7b 5544*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5545*** Cannot continue, aborting.
5546
5547EOF
5548 exit 1
5549 ;;
5550esac
5551
36adc09b
JH
5552: check for length of double
5553echo " "
5554case "$doublesize" in
5555'')
5556 echo "Checking to see how big your double precision numbers are..." >&4
5557 $cat >try.c <<EOCP
5558#include <stdio.h>
1911a026
JH
5559#$i_stdlib I_STDLIB
5560#ifdef I_STDLIB
5561#include <stdlib.h>
5562#endif
36adc09b
JH
5563int main()
5564{
5565 printf("%d\n", (int)sizeof(double));
1911a026 5566 exit(0);
36adc09b
JH
5567}
5568EOCP
5569 set try
5570 if eval $compile_ok; then
5571 doublesize=`$run ./try`
5572 echo "Your double is $doublesize bytes long."
5573 else
5574 dflt='8'
5575 echo "(I can't seem to compile the test program. Guessing...)"
5576 rp="What is the size of a double precision number (in bytes)?"
5577 . ./myread
5578 doublesize="$ans"
5579 fi
5580 ;;
5581esac
5582$rm -f try.c try
5583
5584: check for long doubles
5585echo " "
5586echo "Checking to see if you have long double..." >&4
5587echo 'int main() { long double x = 7.0; }' > try.c
5588set try
5589if eval $compile; then
5590 val="$define"
5591 echo "You have long double."
5592else
5593 val="$undef"
5594 echo "You do not have long double."
5595fi
5596$rm try.*
5597set d_longdbl
5598eval $setvar
5599
5600: check for length of long double
5601case "${d_longdbl}${longdblsize}" in
5602$define)
5603 echo " "
5604 echo "Checking to see how big your long doubles are..." >&4
5605 $cat >try.c <<'EOCP'
5606#include <stdio.h>
5607int main()
5608{
5609 printf("%d\n", sizeof(long double));
5610}
5611EOCP
5612 set try
5613 set try
5614 if eval $compile; then
5615 longdblsize=`$run ./try`
5616 echo "Your long doubles are $longdblsize bytes long."
5617 else
5618 dflt='8'
5619 echo " "
5620 echo "(I can't seem to compile the test program. Guessing...)" >&4
5621 rp="What is the size of a long double (in bytes)?"
5622 . ./myread
5623 longdblsize="$ans"
5624 fi
5625 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5626 echo "That isn't any different from an ordinary double."
5627 echo "I'll keep your setting anyway, but you may see some"
5628 echo "harmless compilation warnings."
36adc09b
JH
5629 fi
5630 ;;
5631esac
5632$rm -f try.* try
5633
89ce900e 5634: determine the architecture name
b4eb6b3d 5635echo " "
89ce900e
JH
5636if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5637 tarch=`arch`"-$osname"
5638elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5639 if uname -m > tmparch 2>&1 ; then
5640 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5641 -e 's/$/'"-$osname/" tmparch`
5642 else
5643 tarch="$osname"
5644 fi
5645 $rm -f tmparch
b4eb6b3d 5646else
89ce900e 5647 tarch="$osname"
b4eb6b3d 5648fi
89ce900e
JH
5649case "$myarchname" in
5650''|"$tarch") ;;
5651*)
5652 echo "(Your architecture name used to be $myarchname.)"
5653 archname=''
5654 ;;
5655esac
5656case "$targetarch" in
5657'') ;;
5658*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5659esac
5660myarchname="$tarch"
5661case "$archname" in
5662'') dflt="$tarch";;
5663*) dflt="$archname";;
5664esac
5665rp='What is your architecture name'
5666. ./myread
5667archname="$ans"
5668case "$usethreads" in
5669$define)
5670 echo "Threads selected." >&4
5671 case "$archname" in
5672 *-thread*) echo "...and architecture name already has -thread." >&4
5673 ;;
5674 *) archname="$archname-thread"
5675 echo "...setting architecture name to $archname." >&4
5676 ;;
5677 esac
5678 ;;
5679esac
5680case "$usemultiplicity" in
5681$define)
5682 echo "Multiplicity selected." >&4
5683 case "$archname" in
5684 *-multi*) echo "...and architecture name already has -multi." >&4
5685 ;;
5686 *) archname="$archname-multi"
5687 echo "...setting architecture name to $archname." >&4
5688 ;;
5689 esac
5690 ;;
5691esac
5692case "$use64bitint$use64bitall" in
5693*"$define"*)
5694 case "$archname64" in
5695 '')
5696 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5697 ;;
89ce900e
JH
5698 *)
5699 case "$use64bitint" in
5700 "$define") echo "64 bit integers selected." >&4 ;;
5701 esac
5702 case "$use64bitall" in
5703 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5704 esac
5705 case "$archname" in
5706 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5707 ;;
5708 *) archname="$archname-$archname64"
5709 echo "...setting architecture name to $archname." >&4
5710 ;;
5711 esac
c1a7f87b
JH
5712 ;;
5713 esac
89ce900e
JH
5714esac
5715case "$uselongdouble" in
5716$define)
5717 echo "Long doubles selected." >&4
5718 case "$longdblsize" in
5719 $doublesize)
5720 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5721 ;;
5722 *)
5723 case "$archname" in
5724 *-ld*) echo "...and architecture name already has -ld." >&4
5725 ;;
5726 *) archname="$archname-ld"
5727 echo "...setting architecture name to $archname." >&4
5728 ;;
5729 esac
bd9b35c9
JH
5730 ;;
5731 esac
bd9b35c9 5732 ;;
89ce900e
JH
5733esac
5734case "$useperlio" in
5735$define)
5736 echo "Perlio selected." >&4
5737 ;;
bd9b35c9 5738*)
89ce900e
JH
5739 echo "Perlio not selected, using stdio." >&4
5740 case "$archname" in
5741 *-stdio*) echo "...and architecture name already has -stdio." >&4
5742 ;;
5743 *) archname="$archname-stdio"
5744 echo "...setting architecture name to $archname." >&4
5745 ;;
5746 esac
bd9b35c9
JH
5747 ;;
5748esac
d2e0c6f7
JH
5749if $test -f archname.cbu; then
5750 echo "Your platform has some specific hints for architecture name, using them..."
5751 . ./archname.cbu
5752fi
bd9b35c9 5753
89ce900e
JH
5754: determine root of directory hierarchy where package will be installed.
5755case "$prefix" in
5756'')
5757 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5758 ;;
5759*?/)
5760 dflt=`echo "$prefix" | sed 's/.$//'`
5761 ;;
5762*)
5763 dflt="$prefix"
5764 ;;
5765esac
5766$cat <<EOM
c1a7f87b 5767
89ce900e
JH
5768By default, $package will be installed in $dflt/bin, manual pages
5769under $dflt/man, etc..., i.e. with $dflt as prefix for all
5770installation directories. Typically this is something like /usr/local.
5771If you wish to have binaries under /usr/bin but other parts of the
5772installation under /usr/local, that's ok: you will be prompted
5773separately for each of the installation directories, the prefix being
5774only used to set the defaults.
bd9b35c9
JH
5775
5776EOM
89ce900e
JH
5777fn=d~
5778rp='Installation prefix to use?'
5779. ./getfile
5780oldprefix=''
5781case "$prefix" in
5782'') ;;
5783*)
5784 case "$ans" in
5785 "$prefix") ;;
5786 *) oldprefix="$prefix";;
5787 esac
5788 ;;
bd9b35c9 5789esac
89ce900e
JH
5790prefix="$ans"
5791prefixexp="$ansexp"
bd9b35c9 5792
89ce900e
JH
5793case "$afsroot" in
5794'') afsroot=/afs ;;
5795*) afsroot=$afsroot ;;
8e07c86e 5796esac
29209bc5 5797
89ce900e
JH
5798: is AFS running?
5799echo " "
5800case "$afs" in
5801$define|true) afs=true ;;
5802$undef|false) afs=false ;;
5803*) if test -d $afsroot; then
5804 afs=true
c1a7f87b 5805 else
89ce900e
JH
5806 afs=false
5807 fi
5808 ;;
c1a7f87b 5809esac
89ce900e
JH
5810if $afs; then
5811 echo "AFS may be running... I'll be extra cautious then..." >&4
5812else
5813 echo "AFS does not seem to be running..." >&4
5814fi
b4eb6b3d
JH
5815
5816: determine installation prefix for where package is to be installed.
5817if $afs; then
5818$cat <<EOM
5819
5820Since you are running AFS, I need to distinguish the directory in which
5821files will reside from the directory in which they are installed (and from
5822which they are presumably copied to the former directory by occult means).
5823
5824EOM
5825 case "$installprefix" in
5826 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5827 *) dflt="$installprefix";;
5828 esac
5829else
5830$cat <<EOM
5831
5832In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5833it is convenient to distinguish the directory in which files should be
5834installed from the directory ($prefix) in which they will
5835eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5836
5837EOM
5838 case "$installprefix" in
5839 '') dflt=$prefix ;;
5840 *) dflt=$installprefix;;
5841 esac
5842fi
5843fn=d~
5844rp='What installation prefix should I use for installing files?'
5845. ./getfile
5846installprefix="$ans"
5847installprefixexp="$ansexp"
5848
5849: set the prefixit variable, to compute a suitable default value
5850prefixit='case "$3" in
5851""|none)
5852 case "$oldprefix" in
5853 "") eval "$1=\"\$$2\"";;
5854 *)
5855 case "$3" in
5856 "") eval "$1=";;
5857 none)
5858 eval "tp=\"\$$2\"";
5859 case "$tp" in
5860 ""|" ") eval "$1=\"\$$2\"";;
5861 *) eval "$1=";;
5862 esac;;
5863 esac;;
5864 esac;;
5865*)
5866 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5867 case "$tp" in
5868 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5869 /*-$oldprefix/*|\~*-$oldprefix/*)
5870 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5871 *) eval "$1=\"\$$2\"";;
5872 esac;;
5873esac'
5874
b4eb6b3d
JH
5875: get the patchlevel
5876echo " "
5877echo "Getting the current patchlevel..." >&4
5878if $test -r $rsrc/patchlevel.h;then
5879 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5880 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5881 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5882 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5883 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5884 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 5885 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5886else
5887 revision=0
5888 patchlevel=0
5889 subversion=0
5890 api_revision=0
5891 api_version=0
5892 api_subversion=0
151e6568
MB
5893 perl_patchlevel=0
5894 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5895fi
151e6568
MB
5896if $test -r $rsrc/.patch ; then
5897 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5898 perl_patchlevel=`cat $rsrc/.patch`
5899 fi
5900fi
861eb78d
AD
5901: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5902version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5903case "$perl_patchlevel" in
861eb78d
AD
59040|'') ;;
5905*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5906esac
861eb78d
AD
5907
5908$echo "(You have $package $version_patchlevel_string.)"
5909
b4eb6b3d
JH
5910case "$osname" in
5911dos|vms)
5912 : XXX Should be a Configure test for double-dots in filenames.
5913 version=`echo $revision $patchlevel $subversion | \
5914 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5915 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5916 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5917 ;;
5918*)
5919 version=`echo $revision $patchlevel $subversion | \
5920 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5921 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5922 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5923 ;;
5924esac
5925: Special case the 5.005_xx maintenance series, which used 5.005
5926: without any subversion label as a subdirectory in $sitelib
5927if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5928 api_versionstring='5.005'
5929fi
5930
5931: determine installation style
5932: For now, try to deduce it from prefix unless it is already set.
5933: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5934case "$installstyle" in
5935'') case "$prefix" in
5936 *perl*) dflt='lib';;
5937 *) dflt='lib/perl5' ;;
5938 esac
5939 ;;
5940*) dflt="$installstyle" ;;
5941esac
5942: Probably not worth prompting for this since we prompt for all
5943: the directories individually, and the prompt would be too long and
5944: confusing anyway.
5945installstyle=$dflt
5946
5947: determine where private library files go
5948: Usual default is /usr/local/lib/perl5/$version.
5949: Also allow things like /opt/perl/lib/$version, since
5950: /opt/perl/lib/perl5... would be redundant.
5951: The default "style" setting is made in installstyle.U
5952case "$installstyle" in
5953*lib/perl5*) set dflt privlib lib/$package/$version ;;
5954*) set dflt privlib lib/$version ;;
5955esac
5956eval $prefixit
5957$cat <<EOM
5958
5959There are some auxiliary files for $package that need to be put into a
5960private library directory that is accessible by everyone.
5961
5962EOM
5963fn=d~+
5964rp='Pathname where the private library files will reside?'
5965. ./getfile
5966privlib="$ans"
5967privlibexp="$ansexp"
5968: Change installation prefix, if necessary.
5969if $test X"$prefix" != X"$installprefix"; then
5970 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5971else
5972 installprivlib="$privlibexp"
5973fi
5974
5975: set the prefixup variable, to restore leading tilda escape
5976prefixup='case "$prefixexp" in
5977"$prefix") ;;
5978*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5979esac'
5980
5981: determine where public architecture dependent libraries go
5982set archlib archlib
5983eval $prefixit
5984: privlib default is /usr/local/lib/$package/$version
5985: archlib default is /usr/local/lib/$package/$version/$archname
5986: privlib may have an optional trailing /share.
5987tdflt=`echo $privlib | $sed 's,/share$,,'`
5988tdflt=$tdflt/$archname
5989case "$archlib" in
5990'') dflt=$tdflt
5991 ;;
5992*) dflt="$archlib"
5993 ;;
5994esac
5995$cat <<EOM
5996
5997$spackage contains architecture-dependent library files. If you are
5998sharing libraries in a heterogeneous environment, you might store
5999these files in a separate location. Otherwise, you can just include
6000them with the rest of the public library files.
6001
6002EOM
6003fn=d+~
6004rp='Where do you want to put the public architecture-dependent libraries?'
6005. ./getfile
6006archlib="$ans"
6007archlibexp="$ansexp"
6008if $test X"$archlib" = X"$privlib"; then
6009 d_archlib="$undef"
6010else
6011 d_archlib="$define"
6012fi
6013: Change installation prefix, if necessary.
6014if $test X"$prefix" != X"$installprefix"; then
6015 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6016else
6017 installarchlib="$archlibexp"
6018fi
6019
b4eb6b3d
JH
6020: see if setuid scripts can be secure
6021$cat <<EOM
6022
6023Some kernels have a bug that prevents setuid #! scripts from being
6024secure. Some sites have disabled setuid #! scripts because of this.
6025
6026First let's decide if your kernel supports secure setuid #! scripts.
6027(If setuid #! scripts would be secure but have been disabled anyway,
6028don't say that they are secure if asked.)
6029
6030EOM
6031
6032val="$undef"
6033if $test -d /dev/fd; then
6034 echo "#!$ls" >reflect
6035 chmod +x,u+s reflect
6036 ./reflect >flect 2>&1
6037 if $contains "/dev/fd" flect >/dev/null; then
6038 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6039 val="$define"
6040 else
6041 $cat <<EOM
6042If you are not sure if they are secure, I can check but I'll need a
6043username and password different from the one you are using right now.
6044If you don't have such a username or don't want me to test, simply
6045enter 'none'.
6046
6047EOM
6048 rp='Other username to test security of setuid scripts with?'
6049 dflt='none'
6050 . ./myread
6051 case "$ans" in
6052 n|none)
6053 case "$d_suidsafe" in
6054 '') echo "I'll assume setuid scripts are *not* secure." >&4
6055 dflt=n;;
6056 "$undef")
6057 echo "Well, the $hint value is *not* secure." >&4
6058 dflt=n;;
6059 *) echo "Well, the $hint value *is* secure." >&4
6060 dflt=y;;
6061 esac
c1a7f87b 6062 ;;
b4eb6b3d
JH
6063 *)
6064 $rm -f reflect flect
6065 echo "#!$ls" >reflect
6066 chmod +x,u+s reflect
6067 echo >flect
6068 chmod a+w flect
6069 echo '"su" will (probably) prompt you for '"$ans's password."
6070 su $ans -c './reflect >flect'
6071 if $contains "/dev/fd" flect >/dev/null; then
6072 echo "Okay, it looks like setuid scripts are secure." >&4
6073 dflt=y
6074 else
6075 echo "I don't think setuid scripts are secure." >&4
6076 dflt=n
6077 fi
6078 ;;
6079 esac
6080 rp='Does your kernel have *secure* setuid scripts?'
6081 . ./myread
6082 case "$ans" in
6083 [yY]*) val="$define";;
6084 *) val="$undef";;
6085 esac
6086 fi
6087else
6088 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6089 echo "(That's for file descriptors, not floppy disks.)"
6090 val="$undef"
6091fi
6092set d_suidsafe
6093eval $setvar
6094
6095$rm -f reflect flect
6096
6097: now see if they want to do setuid emulation
6098echo " "
6099val="$undef"
6100case "$d_suidsafe" in
6101"$define")
6102 val="$undef"
3c728e00 6103 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6104 ;;
6105*)
6106 $cat <<EOM
6107Some systems have disabled setuid scripts, especially systems where
6108setuid scripts cannot be secure. On systems where setuid scripts have
6109been disabled, the setuid/setgid bits on scripts are currently
6110useless. It is possible for $package to detect those bits and emulate
6111setuid/setgid in a secure fashion. This emulation will only work if
6112setuid scripts have been disabled in your kernel.
6113
6114EOM
6115 case "$d_dosuid" in
6116 "$define") dflt=y ;;
6117 *) dflt=n ;;
6118 esac
6119 rp="Do you want to do setuid/setgid emulation?"
6120 . ./myread
6121 case "$ans" in
6122 [yY]*) val="$define";;
6123 *) val="$undef";;
6124 esac
6125 ;;
6126esac
6127set d_dosuid
6128eval $setvar
6129
b4eb6b3d 6130: see if this is a malloc.h system
01d07975
YST
6131: we want a real compile instead of Inhdr because some systems have a
6132: malloc.h that just gives a compile error saying to use stdlib.h instead
6133echo " "
6134$cat >try.c <<EOCP
6135#include <stdlib.h>
6136#include <malloc.h>
6137int main () { return 0; }
6138EOCP
6139set try
6140if eval $compile; then
6141 echo "<malloc.h> found." >&4
6142 val="$define"
6143else
6144 echo "<malloc.h> NOT found." >&4
6145 val="$undef"
6146fi
6147$rm -f try.c try
6148set i_malloc
6149eval $setvar
b4eb6b3d 6150
c8b93cf9
JH
6151: check for void type
6152echo " "
6153echo "Checking to see how well your C compiler groks the void type..." >&4
6154case "$voidflags" in
6155'')
c727eafa 6156 $cat >try.c <<EOCP
d1daaddf
JH
6157#$i_stdlib I_STDLIB
6158#ifdef I_STDLIB
6159#include <stdlib.h>
6160#endif
c8b93cf9
JH
6161#if TRY & 1
6162void sub() {
6163#else
6164sub() {
6165#endif
6166 extern void moo(); /* function returning void */
6167 void (*goo)(); /* ptr to func returning void */
6168#if TRY & 8
6169 void *hue; /* generic ptr */
6170#endif
6171#if TRY & 2
6172 void (*foo[10])();
6173#endif
6174
6175#if TRY & 4
6176 if(goo == moo) {
6177 exit(0);
6178 }
6179#endif
6180 exit(0);
6181}
6182int main() { sub(); }
6183EOCP
6184 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6185 voidflags=$defvoidused
6186 echo "Good. It appears to support void to the level $package wants.">&4
6187 if $contains warning .out >/dev/null 2>&1; then
6188 echo "However, you might get some warnings that look like this:"
6189 $cat .out
6190 fi
6191 else
6192echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6193 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6194 echo "It supports 1..."
6195 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6196 echo "It also supports 2..."
6197 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6198 voidflags=7
6199 echo "And it supports 4 but not 8 definitely."
6200 else
6201 echo "It doesn't support 4..."
6202 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6203 voidflags=11
6204 echo "But it supports 8."
6205 else
6206 voidflags=3
6207 echo "Neither does it support 8."
6208 fi
6209 fi
6210 else
6211 echo "It does not support 2..."
6212 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6213 voidflags=13
6214 echo "But it supports 4 and 8."
6215 else
6216 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6217 voidflags=5
6218 echo "And it supports 4 but has not heard about 8."
6219 else
6220 echo "However it supports 8 but not 4."
6221 fi
6222 fi
6223 fi
6224 else
6225 echo "There is no support at all for void."
6226 voidflags=0
6227 fi
6228 fi
6229esac
6230case "$voidflags" in
6231"$defvoidused") ;;
6232*) $cat >&4 <<'EOM'
6233 Support flag bits are:
6234 1: basic void declarations.
6235 2: arrays of pointers to functions returning void.
6236 4: operations between pointers to and addresses of void functions.
6237 8: generic void pointers.
6238EOM
6239 dflt="$voidflags";
6240 rp="Your void support flags add up to what?"
6241 . ./myread
6242 voidflags="$ans"
6243 ;;
6244esac
6245$rm -f try.* .out
6246
6247: check for length of pointer
6248echo " "
6249case "$ptrsize" in
6250'')
6251 echo "Checking to see how big your pointers are..." >&4
6252 if test "$voidflags" -gt 7; then
6253 echo '#define VOID_PTR char *' > try.c
6254 else
6255 echo '#define VOID_PTR void *' > try.c
6256 fi
74d00865 6257 $cat >>try.c <<EOCP
c8b93cf9 6258#include <stdio.h>
d1daaddf
JH
6259#$i_stdlib I_STDLIB
6260#ifdef I_STDLIB
6261#include <stdlib.h>
6262#endif
c8b93cf9
JH
6263int main()
6264{
6265 printf("%d\n", (int)sizeof(VOID_PTR));
6266 exit(0);
6267}
6268EOCP
6269 set try
6270 if eval $compile_ok; then
6271 ptrsize=`$run ./try`
6272 echo "Your pointers are $ptrsize bytes long."
6273 else
6274 dflt='4'
6275 echo "(I can't seem to compile the test program. Guessing...)" >&4
6276 rp="What is the size of a pointer (in bytes)?"
6277 . ./myread
6278 ptrsize="$ans"
6279 fi
6280 ;;
6281esac
6282$rm -f try.c try
6283case "$use64bitall" in
6284"$define"|true|[yY]*)
6285 case "$ptrsize" in
6286 4) cat <<EOM >&4
6287
1911a026
JH
6288*** You have chosen a maximally 64-bit build,
6289*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6290*** Please rerun Configure without -Duse64bitall.
6291EOM
6292 case "$d_quad" in
6293 define)
6294 cat <<EOM >&4
6295*** Since you have quads, you could possibly try with -Duse64bitint.
6296EOM
6297 ;;
6298 esac
6299 cat <<EOM >&4
1911a026 6300*** Cannot continue, aborting.
c8b93cf9
JH
6301
6302EOM
09b58c7b 6303
1911a026 6304 exit 1
c8b93cf9
JH
6305 ;;
6306 esac
6307 ;;
6308esac
6309
19a100ff 6310
9df442c2
NC
6311: determine whether to use malloc wrapping
6312echo " "
6313case "$usemallocwrap" in
6314[yY]*|true|$define) dflt='y' ;;
6315[nN]*|false|$undef) dflt='n' ;;
6316*) case "$usedevel" in
6317 [yY]*|true|$define) dflt='y' ;;
6318 *) dflt='n' ;;
6319 esac
6320 ;;
6321esac
6322rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6323. ./myread
6324usemallocwrap="$ans"
6325case "$ans" in
6326y*|true)
6327 usemallocwrap="$define" ;;
6328*)
6329 usemallocwrap="$undef" ;;
6330esac
c8b93cf9 6331
b4eb6b3d
JH
6332: determine which malloc to compile in
6333echo " "
6334case "$usemymalloc" in
c4163172
JH
6335[yY]*|true|$define) dflt='y' ;;
6336[nN]*|false|$undef) dflt='n' ;;
6337*) case "$ptrsize" in
6338 4) dflt='y' ;;
6339 *) dflt='n' ;;
6340 esac
6341 ;;
8dfa8df9 6342esac
b4eb6b3d
JH
6343rp="Do you wish to attempt to use the malloc that comes with $package?"
6344. ./myread
6345usemymalloc="$ans"
6346case "$ans" in
6347y*|true)
6348 usemymalloc='y'
6349 mallocsrc='malloc.c'
6350 mallocobj="malloc$_o"
6351 d_mymalloc="$define"
6352 case "$libs" in
6353 *-lmalloc*)
6354 : Remove malloc from list of libraries to use
6355 echo "Removing unneeded -lmalloc from library list" >&4
6356 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6357 shift
6358 libs="$*"
6359 echo "libs = $libs" >&4
6360 ;;
6361 esac
6362 ;;
6363*)
6364 usemymalloc='n'
6365 mallocsrc=''
6366 mallocobj=''
6367 d_mymalloc="$undef"
6368 ;;
6369esac
6370
6371: compute the return types of malloc and free
6372echo " "
6373$cat >malloc.c <<END
6374#$i_malloc I_MALLOC
6375#$i_stdlib I_STDLIB
6376#include <stdio.h>
6377#include <sys/types.h>
6378#ifdef I_MALLOC
6379#include <malloc.h>
6380#endif
6381#ifdef I_STDLIB
6382#include <stdlib.h>
6383#endif
6384#ifdef TRY_MALLOC
6385void *malloc();
6386#endif
6387#ifdef TRY_FREE
6388void free();
6389#endif
6390END
6391case "$malloctype" in
6392'')
6393 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6394 malloctype='void *'
6395 else
6396 malloctype='char *'
6397 fi
6398 ;;
6399esac
6400echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6401
6402case "$freetype" in
6403'')
6404 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6405 freetype='void'
6406 else
6407 freetype='int'
6408 fi
6409 ;;
6410esac
6411echo "Your system uses $freetype free(), it would seem." >&4
6412$rm -f malloc.[co]
6413$cat <<EOM
6414
6415After $package is installed, you may wish to install various
6416add-on modules and utilities. Typically, these add-ons will
6417be installed under $prefix with the rest
6418of this package. However, you may wish to install such add-ons
6419elsewhere under a different prefix.
6420
6421If you do not wish to put everything under a single prefix, that's
6422ok. You will be prompted for the individual locations; this siteprefix
6423is only used to suggest the defaults.
6424
6425The default should be fine for most people.
6426
6427EOM
6428fn=d~+
6429rp='Installation prefix to use for add-on modules and utilities?'
6430: XXX Here might be another good place for an installstyle setting.
6431case "$siteprefix" in
6432'') dflt=$prefix ;;
6433*) dflt=$siteprefix ;;
6434esac
6435. ./getfile
6436: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6437oldsiteprefix=''
6438case "$siteprefix" in
6439'') ;;
6440*) case "$ans" in
6441 "$prefix") ;;
6442 *) oldsiteprefix="$prefix";;
6443 esac
6444 ;;
6445esac
6446siteprefix="$ans"
6447siteprefixexp="$ansexp"
6448
6449: determine where site specific libraries go.
6450: Usual default is /usr/local/lib/perl5/site_perl/$version
6451: The default "style" setting is made in installstyle.U
6452: XXX No longer works with Prefixit stuff.
6453prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6454case "$sitelib" in
6455'') case "$installstyle" in
6456 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6457 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6458 esac
6459 ;;
6460*) dflt="$sitelib"
6461 ;;
6462esac
6463$cat <<EOM
6464
6465The installation process will create a directory for
6466site-specific extensions and modules. Most users find it convenient
6467to place all site-specific files in this directory rather than in the
6468main distribution directory.
6469
6470EOM
6471fn=d~+
6472rp='Pathname for the site-specific library files?'
6473. ./getfile
6474sitelib="$ans"
6475sitelibexp="$ansexp"
6476sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6477: Change installation prefix, if necessary.
6478if $test X"$prefix" != X"$installprefix"; then
6479 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6480else
6481 installsitelib="$sitelibexp"
6482fi
6483
6484: determine where site specific architecture-dependent libraries go.
6485: sitelib default is /usr/local/lib/perl5/site_perl/$version
6486: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6487: sitelib may have an optional trailing /share.
6488case "$sitearch" in
6489'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6490 dflt="$dflt/$archname"
6491 ;;
6492*) dflt="$sitearch"
6493 ;;
6494esac
6495set sitearch sitearch none
6496eval $prefixit
6497$cat <<EOM
6498
6499The installation process will also create a directory for
6500architecture-dependent site-specific extensions and modules.
6501
6502EOM
6503fn=d~+
6504rp='Pathname for the site-specific architecture-dependent library files?'
6505. ./getfile
6506sitearch="$ans"
6507sitearchexp="$ansexp"
6508: Change installation prefix, if necessary.
6509if $test X"$prefix" != X"$installprefix"; then
6510 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6511else
6512 installsitearch="$sitearchexp"
6513fi
6514
6515$cat <<EOM
6516
6517The installation process will also create a directory for
6518vendor-supplied add-ons. Vendors who supply perl with their system
6519may find it convenient to place all vendor-supplied files in this
6520directory rather than in the main distribution directory. This will
6521ease upgrades between binary-compatible maintenance versions of perl.
6522
6523Of course you may also use these directories in whatever way you see
6524fit. For example, you might use them to access modules shared over a
6525company-wide network.
6526
6527The default answer should be fine for most people.
6528This causes further questions about vendor add-ons to be skipped
6529and no vendor-specific directories will be configured for perl.
6530
6531EOM
6532rp='Do you want to configure vendor-specific add-on directories?'
6533case "$usevendorprefix" in
6534define|true|[yY]*) dflt=y ;;
6535*) : User may have set vendorprefix directly on Configure command line.
6536 case "$vendorprefix" in
6537 ''|' ') dflt=n ;;
6538 *) dflt=y ;;
6539 esac
6540 ;;
6541esac
6542. ./myread
6543case "$ans" in
6544[yY]*) fn=d~+
6545 rp='Installation prefix to use for vendor-supplied add-ons?'
6546 case "$vendorprefix" in
6547 '') dflt='' ;;
6548 *) dflt=$vendorprefix ;;
6549 esac
6550 . ./getfile
6551 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6552 oldvendorprefix=''
6553 case "$vendorprefix" in
6554 '') ;;
6555 *) case "$ans" in
6556 "$prefix") ;;
6557 *) oldvendorprefix="$prefix";;
6558 esac
6559 ;;
6560 esac
6561 usevendorprefix="$define"
6562 vendorprefix="$ans"
6563 vendorprefixexp="$ansexp"
6564 ;;
6565*) usevendorprefix="$undef"
6566 vendorprefix=''
6567 vendorprefixexp=''
6568 ;;
6569esac
6570
6571case "$vendorprefix" in
6572'') d_vendorlib="$undef"
6573 vendorlib=''
6574 vendorlibexp=''
6575 ;;
6576*) d_vendorlib="$define"
6577 : determine where vendor-supplied modules go.
6578 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6579 case "$vendorlib" in
6580 '')
6581 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6582 case "$installstyle" in
6583 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6584 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6585 esac
6586 ;;
6587 *) dflt="$vendorlib"
6588 ;;
6589 esac
6590 fn=d~+
6591 rp='Pathname for the vendor-supplied library files?'
6592 . ./getfile
6593 vendorlib="$ans"
6594 vendorlibexp="$ansexp"
6595 ;;
6596esac
6597vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6598: Change installation prefix, if necessary.
6599if $test X"$prefix" != X"$installprefix"; then
6600 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6601else
6602 installvendorlib="$vendorlibexp"
6603fi
6604
6605case "$vendorprefix" in
6606'') d_vendorarch="$undef"
6607 vendorarch=''
6608 vendorarchexp=''
6609 ;;
6610*) d_vendorarch="$define"
6611 : determine where vendor-supplied architecture-dependent libraries go.
6612 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6613 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6614 : vendorlib may have an optional trailing /share.
6615 case "$vendorarch" in
6616 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6617 dflt="$dflt/$archname"
6618 ;;
6619 *) dflt="$vendorarch" ;;
6620 esac
6621 fn=d~+
6622 rp='Pathname for vendor-supplied architecture-dependent files?'
6623 . ./getfile
6624 vendorarch="$ans"
6625 vendorarchexp="$ansexp"
6626 ;;
6627esac
6628: Change installation prefix, if necessary.
6629if $test X"$prefix" != X"$installprefix"; then
6630 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6631else
6632 installvendorarch="$vendorarchexp"
6633fi
6634
6635: Final catch-all directories to search
6636$cat <<EOM
6637
6638Lastly, you can have perl look in other directories for extensions and
6639modules in addition to those already specified.
6640These directories will be searched after
6641 $sitearch
6642 $sitelib
6643EOM
6644test X"$vendorlib" != "X" && echo ' ' $vendorlib
6645test X"$vendorarch" != "X" && echo ' ' $vendorarch
6646echo ' '
6647case "$otherlibdirs" in
6648''|' ') dflt='none' ;;
6649*) dflt="$otherlibdirs" ;;
6650esac
6651$cat <<EOM
6652Enter a colon-separated set of extra paths to include in perl's @INC
6653search path, or enter 'none' for no extra paths.
6654
6655EOM
6656
6657rp='Colon-separated list of additional directories for perl to search?'
6658. ./myread
6659case "$ans" in
6660' '|''|none) otherlibdirs=' ' ;;
6661*) otherlibdirs="$ans" ;;
6662esac
6663case "$otherlibdirs" in
6664' ') val=$undef ;;
6665*) val=$define ;;
6666esac
6667set d_perl_otherlibdirs
6668eval $setvar
6669
6670: Cruising for prototypes
6671echo " "
6672echo "Checking out function prototypes..." >&4
55954f19
JH
6673$cat >prototype.c <<EOCP
6674#$i_stdlib I_STDLIB
6675#ifdef I_STDLIB
6676#include <stdlib.h>
6677#endif
b4eb6b3d
JH
6678int main(int argc, char *argv[]) {
6679 exit(0);}
6680EOCP
6681if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6682 echo "Your C compiler appears to support function prototypes."
6683 val="$define"
6684else
6685 echo "Your C compiler doesn't seem to understand function prototypes."
6686 val="$undef"
6687fi
6688set prototype
6689eval $setvar
6690$rm -f prototype*
6691
6692case "$prototype" in
6693"$define") ;;
6694*) ansi2knr='ansi2knr'
6695 echo " "
6696 cat <<EOM >&4
6697
6698$me: FATAL ERROR:
6699This version of $package can only be compiled by a compiler that
6700understands function prototypes. Unfortunately, your C compiler
6701 $cc $ccflags
6702doesn't seem to understand them. Sorry about that.
6703
6704If GNU cc is available for your system, perhaps you could try that instead.
6705
6706Eventually, we hope to support building Perl with pre-ANSI compilers.
6707If you would like to help in that effort, please contact <perlbug@perl.org>.
6708
6709Aborting Configure now.
6710EOM
6711 exit 2
6712 ;;
6713esac
6714
6715: determine where public executables go
6716echo " "
6717set dflt bin bin
6718eval $prefixit
6719fn=d~
6720rp='Pathname where the public executables will reside?'
6721. ./getfile
6722if $test "X$ansexp" != "X$binexp"; then
6723 installbin=''
6724fi
6725bin="$ans"
6726binexp="$ansexp"
6727: Change installation prefix, if necessary.
6728: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6729if $test X"$prefix" != X"$installprefix"; then
6730 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6731else
6732 installbin="$binexp"
6733fi
6734
6fcddf3b 6735echo " "
6fcddf3b 6736case "$extras" in
bf35c3f6
JH
6737'') dflt='n';;
6738*) dflt='y';;
6fcddf3b
JH
6739esac
6740cat <<EOM
6741Perl can be built with extra modules or bundles of modules which
6742will be fetched from the CPAN and installed alongside Perl.
6743
6744Notice that you will need access to the CPAN; either via the Internet,
6745or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6746be asked later to configure the CPAN.pm module which will in turn do
6747the installation of the rest of the extra modules or bundles.)
6748
6749Notice also that if the modules require any external software such as
dd2de242
JH
6750libraries and headers (the libz library and the zlib.h header for the
6751Compress::Zlib module, for example) you MUST have any such software
6752already installed, this configuration process will NOT install such
6753things for you.
6fcddf3b
JH
6754
6755If this doesn't make any sense to you, just accept the default '$dflt'.
6756EOM
dd2de242 6757rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6758. ./myread
6759case "$ans" in
6760y|Y)
6761 cat <<EOM
6762
6763Please list any extra modules or bundles to be installed from CPAN,
6764with spaces between the names. The names can be in any format the
dd2de242
JH
6765'install' command of CPAN.pm will understand. (Answer 'none',
6766without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6767EOM
6768 rp='Extras?'
6769 dflt="$extras"
6770 . ./myread
6771 extras="$ans"
6772esac
6773case "$extras" in
6774''|'none')
6775 val=''
6776 $rm -f ../extras.lst
6777 ;;
6778*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6779 echo "$extras" > ../extras.lst
6780 val="'$extras'"
6fcddf3b
JH
6781 ;;
6782esac
6783set extras
6784eval $setvar
6785echo " "
6786
6e1038e0
MB
6787: determine where html pages for programs go
6788set html1dir html1dir none
6789eval $prefixit
6790$cat <<EOM
6791
6792If you wish to install html files for programs in $spackage, indicate
6793the appropriate directory here. To skip installing html files,
6794answer "none".
6795EOM
6796case "$html1dir" in
6797''|none|$undef|' ') dflt=none ;;
6798*) dflt=$html1dir ;;
6799esac
6800fn=dn+~
6801rp="Directory for the main $spackage html pages?"
6802. ./getfile
6803html1dir="$ans"
6804html1direxp="$ansexp"
6805: Use ' ' for none so value is preserved next time through Configure
6806$test X"$html1dir" = "X" && html1dir=' '
6807: Change installation prefix, if necessary.
6808if $test X"$prefix" != X"$installprefix"; then
6809 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6810else
6811 installhtml1dir="$html1direxp"
6812fi
6813
6814: determine where html pages for libraries and modules go
6815set html3dir html3dir none
6816eval $prefixit
6817$cat <<EOM
6818
6819If you wish to install html files for modules associated with $spackage,
6820indicate the appropriate directory here. To skip installing html files,
6821answer "none".
6822EOM
6823: There is no obvious default. If they have specified html1dir, then
6824: try to key off that, possibly changing .../html1 into .../html3.
6825case "$html3dir" in
6826'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6827*) dflt=$html3dir ;;
6828esac
6829fn=dn+~
6830rp="Directory for the $spackage module html pages?"
6831. ./getfile
6832html3dir="$ans"
6833html3direxp="$ansexp"
6834: Use ' ' for none so value is preserved next time through Configure
6835$test X"$html3dir" = "X" && html3dir=' '
6836: Change installation prefix, if necessary.
6837if $test X"$prefix" != X"$installprefix"; then
6838 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6839else
6840 installhtml3dir="$html3direxp"
6841fi
6842
b4eb6b3d
JH
6843: Find perl5.005 or later.
6844echo "Looking for a previously installed perl5.005 or later... "
6845case "$perl5" in
a938a3bb 6846'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6847 : Check if this perl is recent and can load a simple module
a938a3bb 6848 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6849 perl5=$tdir/perl
6850 break;
a938a3bb
IZ
6851 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6852 perl5=$tdir/perl5
b4eb6b3d
JH
6853 break;
6854 fi
89ce900e
JH
6855 done
6856 ;;
6857*) perl5="$perl5"
6858 ;;
6859esac
6860case "$perl5" in
6861'') echo "None found. That's ok.";;
6862*) echo "Using $perl5." ;;
6863esac
6864
6865: Determine list of previous versions to include in @INC
6866$cat > getverlist <<EOPL
6867#!$perl5 -w
6868use File::Basename;
6869\$api_versionstring = "$api_versionstring";
6870\$version = "$version";
6871\$stem = "$sitelib_stem";
6872\$archname = "$archname";
6873EOPL
6874 $cat >> getverlist <<'EOPL'
6875# Can't have leading @ because metaconfig interprets it as a command!
6876;@inc_version_list=();
6877# XXX Redo to do opendir/readdir?
6878if (-d $stem) {
6879 chdir($stem);
6880 ;@candidates = glob("5.*");
6881}
6882else {
6883 ;@candidates = ();
6884}
6885
6886# XXX ToDo: These comparisons must be reworked when two-digit
6887# subversions come along, so that 5.7.10 compares as greater than
6888# 5.7.3! By that time, hope that 5.6.x is sufficiently
6889# widespread that we can use the built-in version vectors rather
6890# than reinventing them here. For 5.6.0, however, we must
6891# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6892foreach $d (@candidates) {
6893 if ($d lt $version) {
6894 if ($d ge $api_versionstring) {
6895 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6896 }
6897 elsif ($d ge "5.005") {
6898 unshift(@inc_version_list, grep { -d } $d);
6899 }
6900 }
6901 else {
6902 # Skip newer version. I.e. don't look in
6903 # 5.7.0 if we're installing 5.6.1.
6904 }
6905}
6906
6907if (@inc_version_list) {
6908 print join(' ', @inc_version_list);
6909}
6910else {
6911 # Blank space to preserve value for next Configure run.
6912 print " ";
6913}
6914EOPL
6915chmod +x getverlist
6916case "$inc_version_list" in
6917'') if test -x "$perl5$exe_ext"; then
6918 dflt=`$perl5 getverlist`
6919 else
6920 dflt='none'
6921 fi
6922 ;;
6923$undef) dflt='none' ;;
6924*) eval dflt=\"$inc_version_list\" ;;
6925esac
6926case "$dflt" in
6927''|' ') dflt=none ;;
6928esac
6929case "$dflt" in
69305.005) dflt=none ;;
6931esac
6932$cat <<EOM
6933
6934In order to ease the process of upgrading, this version of perl
6935can be configured to use modules built and installed with earlier
6936versions of perl that were installed under $prefix. Specify here
6937the list of earlier versions that this version of perl should check.
6938If Configure detected no earlier versions of perl installed under
6939$prefix, then the list will be empty. Answer 'none' to tell perl
6940to not search earlier versions.
6941
6942The default should almost always be sensible, so if you're not sure,
6943just accept the default.
6944EOM
6945
6946rp='List of earlier versions to include in @INC?'
6947. ./myread
6948case "$ans" in
d2556f21 6949[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
89ce900e
JH
6950*) inc_version_list="$ans" ;;
6951esac
6952case "$inc_version_list" in
6953''|' ')
6954 inc_version_list_init='0';;
6955*) inc_version_list_init=`echo $inc_version_list |
6956 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6957 ;;
6958esac
6959$rm -f getverlist
6960
6961: determine whether to install perl also as /usr/bin/perl
6962
6963echo " "
6964if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6965 $cat <<EOM
6966Many scripts expect perl to be installed as /usr/bin/perl.
6967
6968If you want to, I can install the perl you are about to compile
6969as /usr/bin/perl (in addition to $bin/perl).
6970EOM
6971 if test -f /usr/bin/perl; then
6972 $cat <<EOM
6973
6974However, please note that because you already have a /usr/bin/perl,
6975overwriting that with a new Perl would very probably cause problems.
6976Therefore I'm assuming you don't want to do that (unless you insist).
6977
6978EOM
6979 case "$installusrbinperl" in
6980 "$define"|[yY]*) dflt='y';;
6981 *) dflt='n';;
6982 esac
6983 else
6984 $cat <<EOM
6985
6986Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6987
6988EOM
6989 case "$installusrbinperl" in
6990 "$undef"|[nN]*) dflt='n';;
6991 *) dflt='y';;
6992 esac
6993 fi
6994 rp="Do you want to install perl as /usr/bin/perl?"
6995 . ./myread
6996 case "$ans" in
6997 [yY]*) val="$define";;
6998 *) val="$undef" ;;
6999 esac
7000else
7001 val="$undef"
7002fi
7003set installusrbinperl
7004eval $setvar
7005
7006echo " "
7007echo "Checking for GNU C Library..." >&4
7008cat >try.c <<'EOCP'
7009/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7010 alone are insufficient to distinguish different versions, such as
7011 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7012 libc version 2.1.0. A. Dougherty, June 3, 2002.
7013*/
7014#include <stdio.h>
7015int main(void)
7016{
7017#ifdef __GLIBC__
7018# ifdef __GLIBC_MINOR__
7019# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7020# include <gnu/libc-version.h>
7021 printf("%s\n", gnu_get_libc_version());
7022# else
7023 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7024# endif
7025# else
7026 printf("%d\n", __GLIBC__);
7027# endif
7028 return 0;
7029#else
7030 return 1;
7031#endif
7032}
7033EOCP
7034set try
7035if eval $compile_ok && $run ./try > glibc.ver; then
7036 val="$define"
7037 gnulibc_version=`$cat glibc.ver`
7038 echo "You are using the GNU C Library version $gnulibc_version"
7039else
7040 val="$undef"
7041 gnulibc_version=''
7042 echo "You are not using the GNU C Library"
7043fi
7044$rm -f try try.* glibc.ver
7045set d_gnulibc
7046eval $setvar
7047
7048: see if nm is to be used to determine whether a symbol is defined or not
7049case "$usenm" in
7050'')
7051 dflt=''
7052 case "$d_gnulibc" in
7053 "$define")
7054 echo " "
7055 echo "nm probably won't work on the GNU C Library." >&4
7056 dflt=n
7057 ;;
7058 esac
7059 case "$dflt" in
7060 '')
7061 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7062 echo " "
7063 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7064 echo "'nm' won't be sufficient on this sytem." >&4
7065 dflt=n
7066 fi
7067 ;;
7068 esac
7069 case "$dflt" in
7070 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7071 if $test $dflt -gt 20; then
7072 dflt=y
7073 else
7074 dflt=n
7075 fi
7076 ;;
7077 esac
b4eb6b3d 7078 ;;
89ce900e
JH
7079*)
7080 case "$usenm" in
7081 true|$define) dflt=y;;
7082 *) dflt=n;;
7083 esac
b4eb6b3d
JH
7084 ;;
7085esac
89ce900e 7086$cat <<EOM
b4eb6b3d 7087
89ce900e
JH
7088I can use $nm to extract the symbols from your C libraries. This
7089is a time consuming task which may generate huge output on the disk (up
7090to 3 megabytes) but that should make the symbols extraction faster. The
7091alternative is to skip the 'nm' extraction part and to compile a small
7092test program instead to determine whether each symbol is present. If
7093you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7094this may be the best solution.
b4eb6b3d 7095
89ce900e 7096You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7097
89ce900e
JH
7098EOM
7099rp="Shall I use $nm to extract C symbols from the libraries?"
7100. ./myread
7101case "$ans" in
7102[Nn]*) usenm=false;;
7103*) usenm=true;;
b4eb6b3d 7104esac
89ce900e
JH
7105
7106runnm=$usenm
7107case "$reuseval" in
7108true) runnm=false;;
b4eb6b3d 7109esac
b4eb6b3d 7110
89ce900e
JH
7111: nm options which may be necessary
7112case "$nm_opt" in
7113'') if $test -f /mach_boot; then
7114 nm_opt='' # Mach
7115 elif $test -d /usr/ccs/lib; then
7116 nm_opt='-p' # Solaris (and SunOS?)
7117 elif $test -f /dgux; then
7118 nm_opt='-p' # DG-UX
7119 elif $test -f /lib64/rld; then
7120 nm_opt='-p' # 64-bit Irix
7121 else
7122 nm_opt=''
7123 fi;;
7124esac
b4eb6b3d 7125
89ce900e
JH
7126: nm options which may be necessary for shared libraries but illegal
7127: for archive libraries. Thank you, Linux.
7128case "$nm_so_opt" in
7129'') case "$myuname" in
fb2e1bc0 7130 *linux*|gnu*)
89ce900e
JH
7131 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7132 nm_so_opt='--dynamic'
7133 fi
7134 ;;
7135 esac
7136 ;;
7137esac
b4eb6b3d 7138
89ce900e
JH
7139case "$runnm" in
7140true)
7141: get list of predefined functions in a handy place
7142echo " "
7143case "$libc" in
7144'') libc=unknown
7145 case "$libs" in
7146 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7147 esac
7148 ;;
b4eb6b3d 7149esac
89ce900e
JH
7150case "$libs" in
7151'') ;;
7152*) for thislib in $libs; do
7153 case "$thislib" in
7154 -lc|-lc_s)
7155 : Handle C library specially below.
7156 ;;
7157 -l*)
7158 thislib=`echo $thislib | $sed -e 's/^-l//'`
7159 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7160 :
7161 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7162 :
7163 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7164 :
7165 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7166 :
7167 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7168 :
7169 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7170 :
7171 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7172 :
7173 else
7174 try=''
7175 fi
7176 libnames="$libnames $try"
7177 ;;
7178 *) libnames="$libnames $thislib" ;;
7179 esac
7180 done
b4eb6b3d
JH
7181 ;;
7182esac
89ce900e
JH
7183xxx=normal
7184case "$libc" in
7185unknown)
7186 set /lib/libc.$so
7187 for xxx in $libpth; do
7188 $test -r $1 || set $xxx/libc.$so
7189 : The messy sed command sorts on library version numbers.
7190 $test -r $1 || \
7191 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7192 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7193 h
7194 s/[0-9][0-9]*/0000&/g
7195 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7196 G
7197 s/\n/ /' | \
7198 $sort | $sed -e 's/^.* //'`
7199 eval set \$$#
7200 done
7201 $test -r $1 || set /usr/ccs/lib/libc.$so
7202 $test -r $1 || set /lib/libsys_s$_a
7203 ;;
7204*)
7205 set blurfl
7206 ;;
7207esac
7208if $test -r "$1"; then
7209 echo "Your (shared) C library seems to be in $1."
7210 libc="$1"
7211elif $test -r /lib/libc && $test -r /lib/clib; then
7212 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7213 xxx=apollo
7214 libc='/lib/clib /lib/libc'
7215 if $test -r /lib/syslib; then
7216 echo "(Your math library is in /lib/syslib.)"
7217 libc="$libc /lib/syslib"
7218 fi
7219elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7220 echo "Your C library seems to be in $libc, as you said before."
7221elif $test -r $incpath/usr/lib/libc$_a; then
7222 libc=$incpath/usr/lib/libc$_a;
7223 echo "Your C library seems to be in $libc. That's fine."
7224elif $test -r /lib/libc$_a; then
7225 libc=/lib/libc$_a;
7226 echo "Your C library seems to be in $libc. You're normal."
7227else
7228 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7229 :
7230 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7231 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7232 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7233 :
7234 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7235 :
7236 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7237 :
7238 else
7239 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7240 fi
7241 if $test -r "$tans"; then
7242 echo "Your C library seems to be in $tans, of all places."
7243 libc=$tans
7244 else
7245 libc='blurfl'
7246 fi
7247fi
7248if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7249 dflt="$libc"
7250 cat <<EOM
b4eb6b3d 7251
89ce900e
JH
7252If the guess above is wrong (which it might be if you're using a strange
7253compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7254
89ce900e
JH
7255EOM
7256else
7257 dflt=''
7258 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7259 cat >&4 <<EOM
7260I can't seem to find your C library. I've looked in the following places:
5e366f65 7261
b4eb6b3d 7262EOM
89ce900e
JH
7263 $sed 's/^/ /' libpath
7264 cat <<EOM
5e366f65 7265
89ce900e 7266None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7267
7268EOM
89ce900e
JH
7269fi
7270fn=f
7271rp='Where is your C library?'
7272. ./getfile
7273libc="$ans"
5e366f65 7274
89ce900e
JH
7275echo " "
7276echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7277set X `cat libnames`
7278shift
7279xxx=files
7280case $# in 1) xxx=file; esac
7281echo "Extracting names from the following $xxx for later perusal:" >&4
7282echo " "
7283$sed 's/^/ /' libnames >&4
7284echo " "
7285$echo $n "This may take a while...$c" >&4
5e366f65 7286
89ce900e
JH
7287for file in $*; do
7288 case $file in
7289 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7290 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7291 esac
89ce900e
JH
7292done >libc.tmp
7293
7294$echo $n ".$c"
7295$grep fprintf libc.tmp > libc.ptf
7296xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7297xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7298xxx='[ADTSIW]'
ab900c53 7299if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7300 eval $xscan;\
7301 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7302 eval $xrun
7303elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7304 eval $xscan;\
7305 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7306 eval $xrun
7307elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7308 eval $xscan;\
7309 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7310 eval $xrun
7311elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7312 eval $xscan;\
7313 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7314 eval $xrun
7315elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7316 eval $xscan;\
7317 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7318 eval $xrun
7319elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7320 eval $xscan;\
7321 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322 eval $xrun
7323elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7324 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7325 eval $xscan;\
7326 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327 eval $xrun
7328elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7329 eval $xscan;\
7330 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331 eval $xrun
7332elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7333 eval $xscan;\
7334 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335 eval $xrun
7336elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7337 eval $xscan;\
7338 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7339 eval $xrun
7340elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7341 eval $xscan;\
7342 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7343 eval $xrun
7344elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7345 eval $xscan;\
7346 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347 eval $xrun
7348elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7349 eval $xscan;\
7350 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351 eval $xrun
7352elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7353 eval $xscan;\
7354 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355 eval $xrun
b4eb6b3d 7356else
89ce900e
JH
7357 $nm -p $* 2>/dev/null >libc.tmp
7358 $grep fprintf libc.tmp > libc.ptf
7359 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7360 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7361 then
7362 nm_opt='-p'
7363 eval $xrun
7364 else
7365 echo " "
7366 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7367 com=''
7368 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7369 for thisname in $libnames $libc; do
7370 $ar t $thisname >>libc.tmp
7371 done
7372 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7373 echo "Ok." >&4
7374 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7375 # Repeat libc to extract forwarders to DLL entries too
7376 for thisname in $libnames $libc; do
7377 $ar tv $thisname >>libc.tmp
7378 # Revision 50 of EMX has bug in $ar.
7379 # it will not extract forwarders to DLL entries
7380 # Use emximp which will extract exactly them.
7381 emximp -o tmp.imp $thisname \
7382 2>/dev/null && \
7383 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7384 < tmp.imp >>libc.tmp
7385 $rm tmp.imp
7386 done
7387 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7388 echo "Ok." >&4
7389 else
7390 echo "$ar didn't seem to work right." >&4
7391 echo "Maybe this is a Cray...trying bld instead..." >&4
7392 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7393 then
7394 for thisname in $libnames; do
7395 bld t $libnames | \
7396 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7397 $ar t $thisname >>libc.tmp
7398 done
7399 echo "Ok." >&4
7400 else
7401 echo "That didn't work either. Giving up." >&4
7402 exit 1
7403 fi
7404 fi
7405 fi
b4eb6b3d 7406fi
89ce900e
JH
7407nm_extract="$com"
7408case "$PASE" in
7409define)
7410 echo " "
7411 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7412 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7413 ;;
7414*) if $test -f /lib/syscalls.exp; then
7415 echo " "
7416 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7417 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7418 fi
7419 ;;
7420esac
7421;;
7422esac
7423$rm -f libnames libpath
b4eb6b3d
JH
7424
7425: see if dld is available
7426set dld.h i_dld
7427eval $inhdr
7428
89ce900e
JH
7429: is a C symbol defined?
7430csym='tlook=$1;
7431case "$3" in
373dfab3
JH
7432-v) tf=libc.tmp; tdc="";;
7433-a) tf=libc.tmp; tdc="[]";;
7434*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7435esac;
7436tx=yes;
7437case "$reuseval-$4" in
7438true-) ;;
7439true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7440esac;
7441case "$tx" in
7442yes)
ab900c53 7443 tval=false;
5129fff4
JH
7444 if $test "$runnm" = true; then
7445 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7446 tval=true;
5129fff4 7447 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7448 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7449 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7450 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7451 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7452 fi;
5129fff4 7453 else
373dfab3 7454 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7455 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7456 $rm -f try$_exe try.c;
ab900c53
AB
7457 fi;
7458 ;;
89ce900e
JH
7459*)
7460 case "$tval" in
7461 $define) tval=true;;
7462 *) tval=false;;
ab900c53
AB
7463 esac;
7464 ;;
89ce900e
JH
7465esac;
7466eval "$2=$tval"'
7467
7468: define an is-in-libc? function
7469inlibc='echo " "; td=$define; tu=$undef;
7470sym=$1; var=$2; eval "was=\$$2";
7471tx=yes;
7472case "$reuseval$was" in
7473true) ;;
7474true*) tx=no;;
7475esac;
7476case "$tx" in
7477yes)
7478 set $sym tres -f;
7479 eval $csym;
7480 case "$tres" in
7481 true)
7482 echo "$sym() found." >&4;
7483 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7484 *)
7485 echo "$sym() NOT found." >&4;
7486 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7487 esac;;
7488*)
7489 case "$was" in
7490 $define) echo "$sym() found." >&4;;
7491 *) echo "$sym() NOT found." >&4;;
7492 esac;;
7493esac'
7494
b4eb6b3d
JH
7495: see if dlopen exists
7496xxx_runnm="$runnm"
7497runnm=false
7498set dlopen d_dlopen
7499eval $inlibc
7500runnm="$xxx_runnm"
7501
7502: determine which dynamic loading, if any, to compile in
7503echo " "
7504dldir="ext/DynaLoader"
7505case "$usedl" in
7506$define|y|true)
7507 dflt='y'
7508 usedl="$define"
7509 ;;
7510$undef|n|false)
7511 dflt='n'
7512 usedl="$undef"
7513 ;;
7514*)
7515 dflt='n'
7516 case "$d_dlopen" in
7517 $define) dflt='y' ;;
7518 esac
7519 case "$i_dld" in
7520 $define) dflt='y' ;;
7521 esac
7522 : Does a dl_xxx.xs file exist for this operating system
7523 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7524 ;;
7525esac
7526rp="Do you wish to use dynamic loading?"
7527. ./myread
7528usedl="$ans"
7529case "$ans" in
7530y*) usedl="$define"
7531 case "$dlsrc" in
7532 '')
7533 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7534 dflt="$dldir/dl_${osname}.xs"
7535 elif $test "$d_dlopen" = "$define" ; then
7536 dflt="$dldir/dl_dlopen.xs"
7537 elif $test "$i_dld" = "$define" ; then
7538 dflt="$dldir/dl_dld.xs"
7539 else
7540 dflt=''
7541 fi
7542 ;;
7543 *) dflt="$dldir/$dlsrc"
7544 ;;
7545 esac
7546 echo "The following dynamic loading files are available:"
7547 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7548 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7549 rp="Source file to use for dynamic loading"
7550 fn="fne"
7551 gfpth="$src"
7552 . ./getfile
7553 usedl="$define"
7554 : emulate basename
7555 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7556
7557 $cat << EOM
7558
7559Some systems may require passing special flags to $cc -c to
7560compile modules that will be used to create a shared library.
7561To use no flags, say "none".
7562
7563EOM
7564 case "$cccdlflags" in
7565 '') case "$gccversion" in
7566 '') case "$osname" in
7567 hpux) dflt='+z' ;;
7568 next) dflt='none' ;;
7569 irix*) dflt='-KPIC' ;;
48bcfe03 7570 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7571 sunos) dflt='-pic' ;;
7572 *) dflt='none' ;;
7573 esac
7574 ;;
7575 *) case "$osname" in
b6cc0f4c 7576 darwin) dflt='none' ;;
48bcfe03 7577 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7578 *) dflt='-fpic' ;;
7579 esac ;;
7580 esac ;;
7581 ' ') dflt='none' ;;
7582 *) dflt="$cccdlflags" ;;
7583 esac
7584 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7585 . ./myread
7586 case "$ans" in
7587 none) cccdlflags=' ' ;;
7588 *) cccdlflags="$ans" ;;
7589 esac
7590
7591 cat << EOM
7592
7593Some systems use ld to create libraries that can be dynamically loaded,
7594while other systems (such as those using ELF) use $cc.
7595
7596EOM
7597 case "$ld" in
55954f19 7598 '') $cat >try.c <<EOM
b4eb6b3d
JH
7599/* Test for whether ELF binaries are produced */
7600#include <fcntl.h>
55954f19
JH
7601#$i_stdlib I_STDLIB
7602#ifdef I_STDLIB
b4eb6b3d 7603#include <stdlib.h>
55954f19 7604#endif
b4eb6b3d
JH
7605int main() {
7606 char b[4];
7607 int i = open("a.out",O_RDONLY);
7608 if(i == -1)
7609 exit(1); /* fail */
7610 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7611 exit(0); /* succeed (yes, it's ELF) */
7612 else
7613 exit(1); /* fail */
7614}
7615EOM
5440bc8e 7616 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7617 cat <<EOM
7618You appear to have ELF support. I'll use $cc to build dynamic libraries.
7619EOM
7620 dflt="$cc"
7621 else
7622 echo "I'll use ld to build dynamic libraries."
7623 dflt='ld'
7624 fi
7625 rm -f try.c a.out
7626 ;;
7627 *) dflt="$ld"
7628 ;;
7629 esac
7630
7631 rp="What command should be used to create dynamic libraries?"
7632 . ./myread
7633 ld="$ans"
7634
7635 cat << EOM
7636
7637Some systems may require passing special flags to $ld to create a
7638library that can be dynamically loaded. If your ld flags include
7639-L/other/path options to locate libraries outside your loader's normal
7640search path, you may need to specify those -L options here as well. To
7641use no flags, say "none".
7642
7643EOM
7644 case "$lddlflags" in
7645 '') case "$osname" in
7646 beos) dflt='-nostart' ;;
7647 hpux) dflt='-b';
7648 case "$gccversion" in
7649 '') dflt="$dflt +vnocompatwarnings" ;;
7650 esac
7651 ;;
fb2e1bc0 7652 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7653 next) dflt='none' ;;
7654 solaris) dflt='-G' ;;
7655 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7656 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7657 *) dflt='none' ;;
7658 esac
7659 ;;
7660 *) dflt="$lddlflags" ;;
7661 esac
7662
7663 : Try to guess additional flags to pick up local libraries.
7664 : Be careful not to append to a plain 'none'
7665 case "$dflt" in
7666 none) dflt='' ;;
7667 esac
7668 for thisflag in $ldflags; do
7669 case "$thisflag" in
b5b9f165 7670 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7671 case " $dflt " in
7672 *" $thisflag "*) ;;
7673 *) dflt="$dflt $thisflag" ;;
7674 esac
7675 ;;
7676 esac
7677 done
7678
7679 case "$dflt" in
7680 ''|' ') dflt='none' ;;
7681 esac
7682
7683 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7684 . ./myread
7685 case "$ans" in
7686 none) lddlflags=' ' ;;
7687 *) lddlflags="$ans" ;;
7688 esac
7689
7690 cat <<EOM
7691
7692Some systems may require passing special flags to $cc to indicate that
7693the resulting executable will use dynamic linking. To use no flags,
7694say "none".
7695
7696EOM
7697 case "$ccdlflags" in
7698 '') case "$osname" in
fb2e1bc0 7699 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7700 next|sunos) dflt='none' ;;
7701 *) dflt='none' ;;
b4eb6b3d
JH
7702 esac ;;
7703 ' ') dflt='none' ;;
7704 *) dflt="$ccdlflags" ;;
7705 esac
7706 rp="Any special flags to pass to $cc to use dynamic linking?"
7707 . ./myread
7708 case "$ans" in
7709 none) ccdlflags=' ' ;;
7710 *) ccdlflags="$ans" ;;
7711 esac
7712 ;;
7713*) usedl="$undef"
7714 ld='ld'
7715 dlsrc='dl_none.xs'
7716 lddlflags=''
7717 ccdlflags=''
7718 ;;
7719esac
7720
7721also=''
7722case "$usedl" in
7723$undef)
7724 # No dynamic loading being used, so don't bother even to prompt.
7725 useshrplib='false'
7726 ;;
7727*) case "$useshrplib" in
7728 '') case "$osname" in
48bcfe03 7729 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7730 dflt=y
7731 also='Building a shared libperl is required for dynamic loading to work on your system.'
7732 ;;
7733 next*)
7734 case "$osvers" in
7735 4*) dflt=y
7736 also='Building a shared libperl is needed for MAB support.'
7737 ;;
7738 *) dflt=n
7739 ;;
7740 esac
7741 ;;
7742 *) dflt=n
7743 ;;
7744 esac
7745 ;;
7746 $define|true|[Yy]*)
7747 dflt=y
7748 ;;
7749 *) dflt=n
7750 ;;
7751 esac
7752 $cat << EOM
7753
7754The perl executable is normally obtained by linking perlmain.c with
7755libperl${_a}, any static extensions (usually just DynaLoader), and
7756any other libraries needed on this system (such as -lm, etc.). Since
7757your system supports dynamic loading, it is probably possible to build
7758a shared libperl.$so. If you will have more than one executable linked
7759to libperl.$so, this will significantly reduce the size of each
7760executable, but it may have a noticeable affect on performance. The
7761default is probably sensible for your system.
7762$also
7763
7764EOM
7765 rp="Build a shared libperl.$so (y/n)"
7766 . ./myread
7767 case "$ans" in
7768 true|$define|[Yy]*)
7769 useshrplib='true' ;;
7770 *) useshrplib='false' ;;
7771 esac
7772 ;;
7773esac
7774
7775case "$useshrplib" in
7776true)
7777 case "$libperl" in
7778 '')
7779 # Figure out a good name for libperl.so. Since it gets stored in
7780 # a version-specific architecture-dependent library, the version
7781 # number isn't really that important, except for making cc/ld happy.
7782 #
7783 # A name such as libperl.so.3.1
7784 majmin="libperl.$so.$patchlevel.$subversion"
7785 # A name such as libperl.so.301
7786 majonly=`echo $patchlevel $subversion |
7787 $awk '{printf "%d%02d", $1, $2}'`
7788 majonly=libperl.$so.$majonly
7789 # I'd prefer to keep the os-specific stuff here to a minimum, and
7790 # rely on figuring it out from the naming of libc.
7791 case "${osname}${osvers}" in
7792 next4*)
7793 dflt=libperl.5.$so
7794 # XXX How handle the --version stuff for MAB?
7795 ;;
fb2e1bc0 7796 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7797 dflt=libperl.$so
7798 ;;
b53432e4
GH
7799 cygwin*) # ld links against an importlib
7800 dflt=libperl$lib_ext
b4eb6b3d
JH
7801 ;;
7802 *) # Try to guess based on whether libc has major.minor.
7803 case "$libc" in
7804 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7805 *libc.$so.[0-9]*) dflt=$majonly ;;
7806 *) dflt=libperl.$so ;;
7807 esac
7808 ;;
7809 esac
7810 ;;
7811 *) dflt=$libperl
7812 ;;
7813 esac
7814 cat << EOM
7815
7816I need to select a good name for the shared libperl. If your system uses
7817library names with major and minor numbers, then you might want something
7818like $majmin. Alternatively, if your system uses a single version
7819number for shared libraries, then you might want to use $majonly.
7820Or, your system might be quite happy with a simple libperl.$so.
7821
7822Since the shared libperl will get installed into a version-specific
7823architecture-dependent directory, the version number of the shared perl
7824library probably isn't important, so the default should be o.k.
7825
7826EOM
7827 rp='What name do you want to give to the shared libperl?'
7828 . ./myread
7829 libperl=$ans
7830 echo "Ok, I'll use $libperl"
7831 ;;
7832*)
7833 libperl="libperl${_a}"
7834 ;;
7835esac
7836
7837# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7838case "$shrpdir" in
7839'') ;;
7840*) $cat >&4 <<EOM
7841WARNING: Use of the shrpdir variable for the installation location of
7842the shared $libperl is not supported. It was never documented and
7843will not work in this version. Let me (perlbug@perl.org)
7844know of any problems this may cause.
7845
7846EOM
7847 case "$shrpdir" in
7848 "$archlibexp/CORE")
7849 $cat >&4 <<EOM
7850But your current setting of $shrpdir is
7851the default anyway, so it's harmless.
7852EOM
7853 ;;
7854 *)
7855 $cat >&4 <<EOM
7856Further, your current attempted setting of $shrpdir
7857conflicts with the value of $archlibexp/CORE
7858that installperl will use.
7859EOM
7860 ;;
7861 esac
7862 ;;
7863esac
7864
7865# How will the perl executable find the installed shared $libperl?
7866# Add $xxx to ccdlflags.
7867# If we can't figure out a command-line option, use $shrpenv to
7868# set env LD_RUN_PATH. The main perl makefile uses this.
7869shrpdir=$archlibexp/CORE
7870xxx=''
7871tmp_shrpenv=''
7872if "$useshrplib"; then
7873 case "$osname" in
7874 aix)
7875 # We'll set it in Makefile.SH...
7876 ;;
b5b9f165 7877 solaris)
b4eb6b3d
JH
7878 xxx="-R $shrpdir"
7879 ;;
46fcf6af 7880 freebsd|netbsd|openbsd|interix)
b4eb6b3d
JH
7881 xxx="-Wl,-R$shrpdir"
7882 ;;
fb2e1bc0 7883 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7884 xxx="-Wl,-rpath,$shrpdir"
7885 ;;
7886 next)
7887 # next doesn't like the default...
7888 ;;
7889 beos)
7890 # beos doesn't like the default, either.
7891 ;;
7892 hpux*)
7893 # hpux doesn't like the default, either.
7894 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7895 ;;
7896 *)
7897 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7898 ;;
7899 esac
7900 case "$xxx" in
7901 '') ;;
7902 *)
7903 # Only add $xxx if it isn't already in ccdlflags.
7904 case " $ccdlflags " in
7905 *" $xxx "*) ;;
7906 *) ccdlflags="$ccdlflags $xxx"
7907 cat <<EOM >&4
7908
7909Adding $xxx to the flags
7910passed to $ld so that the perl executable will find the
7911installed shared $libperl.
7912
7913EOM
7914 ;;
7915 esac
7916 ;;
7917 esac
7918fi
7919# Fix ccdlflags in AIX for building external extensions.
7920# (For building Perl itself bare -bE:perl.exp is needed,
7921# Makefile.SH takes care of this.)
7922case "$osname" in
7923aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7924esac
7925# Respect a hint or command-line value.
7926case "$shrpenv" in
7927'') shrpenv="$tmp_shrpenv" ;;
7928esac
7929case "$ldlibpthname" in
7930'') ldlibpthname=LD_LIBRARY_PATH ;;
7931none) ldlibpthname='' ;;
7932esac
7933
7934: determine where manual pages are on this system
7935echo " "
7936case "$sysman" in
7937'')
4a0a3829
SD
7938 syspath='/usr/share/man/man1 /usr/man/man1'
7939 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7940 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7941 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7942 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7943 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7944 sysman=`./loc . /usr/man/man1 $syspath`
7945 ;;
7946esac
7947if $test -d "$sysman"; then
7948 echo "System manual is in $sysman." >&4
7949else
7950 echo "Could not find manual pages in source form." >&4
7951fi
7952
7953: determine where manual pages go
7954set man1dir man1dir none
7955eval $prefixit
7956$cat <<EOM
7957
7958$spackage has manual pages available in source form.
7959EOM
7960case "$nroff" in
7961nroff)
7962 echo "However, you don't have nroff, so they're probably useless to you."
7963 case "$man1dir" in
7964 '') man1dir="none";;
7965 esac;;
7966esac
7967echo "If you don't want the manual sources installed, answer 'none'."
7968case "$man1dir" in
7969' ') dflt=none
7970 ;;
7971'')
4a0a3829
SD
7972 lookpath="$prefixexp/share/man/man1"
7973 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7974 lookpath="$lookpath $prefixexp/man/p_man/man1"
7975 lookpath="$lookpath $prefixexp/man/u_man/man1"
7976 lookpath="$lookpath $prefixexp/man/man.1"
7977 case "$sysman" in
7978 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7979 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7980 esac
7981 set dflt
7982 eval $prefixup
7983 ;;
7984*) dflt="$man1dir"
7985 ;;
7986esac
7987echo " "
7988fn=dn+~
7989rp="Where do the main $spackage manual pages (source) go?"
7990. ./getfile
7991if $test "X$man1direxp" != "X$ansexp"; then
7992 installman1dir=''
7993fi
7994man1dir="$ans"
7995man1direxp="$ansexp"
7996case "$man1dir" in
7997'') man1dir=' '
7998 installman1dir='';;
7999esac
8000
8001: Change installation prefix, if necessary.
8002if $test X"$prefix" != X"$installprefix"; then
8003 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8004else
8005 installman1dir="$man1direxp"
8006fi
8007
8008: What suffix to use on installed man pages
8009
8010case "$man1dir" in
8011' ')
8012 man1ext='0'
8013 ;;
8014*)
8015 rp="What suffix should be used for the main $spackage man pages?"
8016 case "$man1ext" in
8017 '') case "$man1dir" in
8018 *1) dflt=1 ;;
8019 *1p) dflt=1p ;;
8020 *1pm) dflt=1pm ;;
8021 *l) dflt=l;;
8022 *n) dflt=n;;
8023 *o) dflt=o;;
8024 *p) dflt=p;;
8025 *C) dflt=C;;
8026 *L) dflt=L;;
8027 *L1) dflt=L1;;
8028 *) dflt=1;;
8029 esac
8030 ;;
8031 *) dflt="$man1ext";;
8032 esac
8033 . ./myread
8034 man1ext="$ans"
8035 ;;
8036esac
8037
8038: see if we can have long filenames
8039echo " "
8040first=123456789abcdef
8041$rm -f $first
8042if (echo hi >$first) 2>/dev/null; then
8043 if $test -f 123456789abcde; then
8044 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8045 val="$undef"
8046 else
8047 echo 'You can have filenames longer than 14 characters.'>&4
8048 val="$define"
8049 fi
8050else
8051 $cat <<'EOM'
8052You can't have filenames longer than 14 chars.
8053You can't even think about them!
8054EOM
8055 val="$undef"
8056fi
8057set d_flexfnam
8058eval $setvar
8059$rm -rf 123456789abcde*
8060
8061: determine where library module manual pages go
8062set man3dir man3dir none
8063eval $prefixit
8064$cat <<EOM
8065
8066$spackage has manual pages for many of the library modules.
8067EOM
8068
8069case "$nroff" in
8070nroff)
8071 $cat <<'EOM'
8072However, you don't have nroff, so they're probably useless to you.
8073EOM
8074 case "$man3dir" in
8075 '') man3dir="none";;
8076 esac;;
8077esac
8078
8079case "$d_flexfnam" in
8080undef)
8081 $cat <<'EOM'
8082However, your system can't handle the long file names like File::Basename.3.
8083EOM
8084 case "$man3dir" in
8085 '') man3dir="none";;
8086 esac;;
8087esac
8088
8089echo "If you don't want the manual sources installed, answer 'none'."
8090prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8091case "$man3dir" in
8092'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8093 if $test -d "$privlib/man/man3"; then
8094 cat <<EOM >&4
8095
8096WARNING: Previous versions of perl installed man3 pages into
8097$privlib/man/man3. This version will suggest a
8098new default of $dflt.
8099EOM
8100 tdflt=$dflt
8101 dflt='n'
8102 rp='Do you wish to preserve the old behavior?(y/n)'
8103 . ./myread
8104 case "$ans" in
8105 y*) dflt="$privlib/man/man3" ;;
8106 *) dflt=$tdflt ;;
8107 esac
8108 fi
8109 ;;
8110*) dflt="$man3dir" ;;
8111esac
8112case "$dflt" in
8113' ') dflt=none ;;
8114esac
8115echo " "
8116fn=dn+~
8117rp="Where do the $package library man pages (source) go?"
8118. ./getfile
8119man3dir="$ans"
8120man3direxp="$ansexp"
8121case "$man3dir" in
8122'') man3dir=' '
8123 installman3dir='';;
8124esac
8125
8126: Change installation prefix, if necessary.
8127if $test X"$prefix" != X"$installprefix"; then
8128 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8129else
8130 installman3dir="$man3direxp"
8131fi
8132
8133: What suffix to use on installed man pages
8134case "$man3dir" in
8135' ')
8136 man3ext='0'
8137 ;;
8138*)
8139 rp="What suffix should be used for the $package library man pages?"
8140 case "$man3ext" in
8141 '') case "$man3dir" in
8142 *3) dflt=3 ;;
8143 *3p) dflt=3p ;;
8144 *3pm) dflt=3pm ;;
8145 *l) dflt=l;;
8146 *n) dflt=n;;
8147 *o) dflt=o;;
8148 *p) dflt=p;;
8149 *C) dflt=C;;
8150 *L) dflt=L;;
8151 *L3) dflt=L3;;
8152 *) dflt=3;;
8153 esac
8154 ;;
8155 *) dflt="$man3ext";;
8156 esac
8157 . ./myread
8158 man3ext="$ans"
8159 ;;
8160esac
8161
8162: see if we have to deal with yellow pages, now NIS.
0384a54a 8163if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8164 if $test -f /usr/etc/nibindd; then
8165 echo " "
8166 echo "I'm fairly confident you're on a NeXT."
8167 echo " "
8168 rp='Do you get the hosts file via NetInfo?'
8169 dflt=y
8170 case "$hostcat" in
8171 nidump*) ;;
8172 '') ;;
8173 *) dflt=n;;
8174 esac
8175 . ./myread
8176 case "$ans" in
8177 y*) hostcat='nidump hosts .';;
8178 *) case "$hostcat" in
8179 nidump*) hostcat='';;
8180 esac
8181 ;;
8182 esac
8183 fi
8184 case "$hostcat" in
8185 nidump*) ;;
8186 *)
8187 case "$hostcat" in
8188 *ypcat*) dflt=y;;
8189 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8190 dflt=y
8191 else
8192 dflt=n
8193 fi;;
8194 *) dflt=n;;
8195 esac
8196 echo " "
8197 rp='Are you getting the hosts file via yellow pages?'
8198 . ./myread
8199 case "$ans" in
8200 y*) hostcat='ypcat hosts';;
8201 *) hostcat='cat /etc/hosts';;
8202 esac
8203 ;;
8204 esac
8205fi
8206case "$hostcat" in
8207'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8208esac
8209case "$groupcat" in
8210'') test -f /etc/group && groupcat='cat /etc/group';;
8211esac
8212case "$passcat" in
8213'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8214esac
8215
8216: now get the host name
8217echo " "
8218echo "Figuring out host name..." >&4
8219case "$myhostname" in
8220'') cont=true
8221 echo 'Maybe "hostname" will work...'
73614538 8222 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8223 myhostname=$tans
8224 phostname=hostname
8225 cont=''
8226 fi
8227 ;;
8228*) cont='';;
8229esac
8230if $test "$cont"; then
8231 if ./xenix; then
8232 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8233 if tans=`cat /etc/systemid 2>&1` ; then
8234 myhostname=$tans
8235 phostname='cat /etc/systemid'
8236 echo "Whadyaknow. Xenix always was a bit strange..."
8237 cont=''
8238 fi
8239 elif $test -r /etc/systemid; then
8240 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8241 fi
8242fi
8243if $test "$cont"; then
8244 echo 'No, maybe "uuname -l" will work...'
73614538 8245 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8246 myhostname=$tans
8247 phostname='uuname -l'
8248 else
8249 echo 'Strange. Maybe "uname -n" will work...'
73614538 8250 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8251 myhostname=$tans
8252 phostname='uname -n'
8253 else
8254 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8255 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8256 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8257 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8258 else
8259 case "$myhostname" in
8260 '') echo "Does this machine have an identity crisis or something?"
8261 phostname='';;
8262 *)
8263 echo "Well, you said $myhostname before..."
8264 phostname='echo $myhostname';;
8265 esac
8266 fi
8267 fi
8268 fi
8269fi
52a549d0
JH
8270case "$myhostname" in
8271'') myhostname=noname ;;
8272esac
b4eb6b3d
JH
8273: you do not want to know about this
8274set $myhostname
8275myhostname=$1
8276
8277: verify guess
8278if $test "$myhostname" ; then
8279 dflt=y
8280 rp='Your host name appears to be "'$myhostname'".'" Right?"
8281 . ./myread
8282 case "$ans" in
8283 y*) ;;
8284 *) myhostname='';;
8285 esac
8286fi
8287
8288: bad guess or no guess
8289while $test "X$myhostname" = X ; do
8290 dflt=''
8291 rp="Please type the (one word) name of your host:"
8292 . ./myread
8293 myhostname="$ans"
8294done
8295
8296: translate upper to lower if necessary
8297case "$myhostname" in
8298*[A-Z]*)
8299 echo "(Normalizing case in your host name)"
8300 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8301 ;;
8302esac
8303
8304case "$myhostname" in
8305*.*)
8306 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8307 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8308 echo "(Trimming domain name from host name--host name is now $myhostname)"
8309 ;;
8310*) case "$mydomain" in
8311 '')
8312 {
8313 test "X$hostcat" = "Xypcat hosts" &&
8314 ypmatch "$myhostname" hosts 2>/dev/null |\
8315 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8316 $test -s hosts
8317 } || {
8318 test "X$hostcat" != "X" &&
8319 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8320 /[ ]$myhostname[ . ]/p" > hosts
8321 }
8322 tmp_re="[ . ]"
f08cbdd1
PP
8323 if $test -f hosts; then
8324 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8325 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8326 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8327 hosts | $sort | $uniq | \
8328 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8329 case `$echo X$dflt` in
8330 X*\ *) echo "(Several hosts in the database matched hostname)"
8331 dflt=.
8332 ;;
8333 X.) echo "(You do not have fully-qualified names in the hosts database)"
8334 ;;
8335 esac
8336 else
8337 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8338 dflt=.
f08cbdd1 8339 fi
b4eb6b3d
JH
8340 case "$dflt" in
8341 .)
8342 tans=`./loc resolv.conf X /etc /usr/etc`
8343 if $test -f "$tans"; then
8344 echo "(Attempting domain name extraction from $tans)"
8345 dflt=.`$sed -n -e 's/ / /g' \
8346 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8347 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8348 case "$dflt" in
8349 .) dflt=.`$sed -n -e 's/ / /g' \
8350 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8351 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8352 ;;
8353 esac
8354 fi
8355 ;;
8356 esac
8357 case "$dflt" in
8358 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8359 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8360 case "$dflt" in
8361 '') dflt='.';;
8362 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8363 esac
8364 ;;
8365 esac
59c9e5d6
PP
8366 case "$dflt$osname" in
8367 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8368 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8369 ;;
8370 esac
b4eb6b3d
JH
8371 case "$dflt" in
8372 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8373 dflt='.nonet'
b4eb6b3d
JH
8374 ;;
8375 esac
8376 $rm -f hosts
8377 ;;
8378 *) dflt="$mydomain";;
8379 esac;;
8380esac
8381echo " "
8382rp="What is your domain name?"
8383. ./myread
8384tans="$ans"
8385case "$ans" in
8386'') ;;
8387.*) ;;
8388*) tans=".$tans";;
8389esac
8390mydomain="$tans"
8391
8392: translate upper to lower if necessary
8393case "$mydomain" in
8394*[A-Z]*)
8395 echo "(Normalizing case in your domain name)"
8396 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8397 ;;
8398esac
8399
8400: a little sanity check here
8401case "$phostname" in
8402'') ;;
8403*)
8404 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8405 $myhostname$mydomain|$myhostname) ;;
8406 *)
8407 case "$phostname" in
8408 sed*)
8409 echo "(That doesn't agree with your whoami.h file, by the way.)"
8410 ;;
8411 *)
8412 echo "(That doesn't agree with your $phostname command, by the way.)"
8413 ;;
8414 esac
8415 ;;
8416 esac
8417 ;;
8418esac
8419
8420$cat <<EOM
8421
8422I need to get your e-mail address in Internet format if possible, i.e.
8423something like user@host.domain. Please answer accurately since I have
8424no easy means to double check it. The default value provided below
8425is most probably close to reality but may not be valid from outside
8426your organization...
8427
8428EOM
8429cont=x
8430while test "$cont"; do
8431 case "$cf_email" in
8432 '') dflt="$cf_by@$myhostname$mydomain";;
8433 *) dflt="$cf_email";;
8434 esac
8435 rp='What is your e-mail address?'
8436 . ./myread
8437 cf_email="$ans"
8438 case "$cf_email" in
8439 *@*.*) cont='' ;;
8440 *)
8441 rp='Address does not look like an Internet one. Use it anyway?'
8442 case "$fastread" in
8443 yes) dflt=y ;;
8444 *) dflt=n ;;
8445 esac
8446 . ./myread
8447 case "$ans" in
8448 y*) cont='' ;;
8449 *) echo " " ;;
8450 esac
8451 ;;
8452 esac
8453done
8454
8455$cat <<EOM
8456
8457If you or somebody else will be maintaining perl at your site, please
8458fill in the correct e-mail address here so that they may be contacted
8459if necessary. Currently, the "perlbug" program included with perl
8460will send mail to this address in addition to perlbug@perl.org. You may
8461enter "none" for no administrator.
8462
8463EOM
8464case "$perladmin" in
8465'') dflt="$cf_email";;
8466*) dflt="$perladmin";;
8467esac
8468rp='Perl administrator e-mail address'
8469. ./myread
8470perladmin="$ans"
8471
674912d7
RB
8472: determine whether to only install version-specific parts.
8473echo " "
8474$cat <<EOM
8475Do you want to install only the version-specific parts of the perl
8476distribution? Usually you do *not* want to do this.
8477EOM
8478case "$versiononly" in
8479"$define"|[Yy]*|true) dflt='y' ;;
8480*) dflt='n';
8481esac
8482rp="Do you want to install only the version-specific parts of perl?"
8483. ./myread
8484case "$ans" in
8485[yY]*) val="$define";;
8486*) val="$undef" ;;
8487esac
8488set versiononly
8489eval $setvar
8490
ad493445
MB
8491case "$versiononly" in
8492"$define") inc_version_list=''
8493 inc_version_list_init=0
8494 ;;
8495esac
8496
b4eb6b3d
JH
8497: figure out how to guarantee perl startup
8498case "$startperl" in
8499'')
8500 case "$sharpbang" in
8501 *!)
8502 $cat <<EOH
8503
8504I can use the #! construct to start perl on your system. This will
8505make startup of perl scripts faster, but may cause problems if you
8506want to share those scripts and perl is not in a standard place
8507($binexp/perl) on all your platforms. The alternative is to force
8508a shell by starting the script with a single ':' character.
8509
8510EOH
674912d7
RB
8511 case "$versiononly" in
8512 "$define") dflt="$binexp/perl$version";;
8513 *) dflt="$binexp/perl";;
8514 esac
b4eb6b3d
JH
8515 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8516 . ./myread
8517 case "$ans" in
8518 none) startperl=": # use perl";;
8519 *) startperl="#!$ans"
8520 if $test 30 -lt `echo "$ans" | wc -c`; then
8521 $cat >&4 <<EOM
8522
8523WARNING: Some systems limit the #! command to 32 characters.
8524If you experience difficulty running Perl scripts with #!, try
8525installing Perl in a directory with a shorter pathname.
8526
8527EOM
8528 fi ;;
8529 esac
8530 ;;
8531 *) startperl=": # use perl"
8532 ;;
8533 esac
8534 ;;
8535esac
8536echo "I'll use $startperl to start perl scripts."
8537
8538: figure best path for perl in scripts
8539case "$perlpath" in
8540'')
5e20a8ca
RGS
8541 case "$versiononly" in
8542 "$define") perlpath="$binexp/perl$version";;
8543 *) perlpath="$binexp/perl";;
8544 esac
b4eb6b3d
JH
8545 case "$startperl" in
8546 *!*) ;;
8547 *)
8548 $cat <<EOH
8549
8550I will use the "eval 'exec'" idiom to start Perl on your system.
8551I can use the full path of your Perl binary for this purpose, but
8552doing so may cause problems if you want to share those scripts and
8553Perl is not always in a standard place ($binexp/perl).
8554
8555EOH
8556 dflt="$binexp/perl"
8557 rp="What path shall I use in \"eval 'exec'\"?"
8558 . ./myread
8559 perlpath="$ans"
8560 ;;
8561 esac
8562 ;;
8563esac
8564case "$startperl" in
8565*!*) ;;
8566*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8567esac
8568
8569: determine where public executable scripts go
8570set scriptdir scriptdir
8571eval $prefixit
8572case "$scriptdir" in
8573'')
8574 dflt="$bin"
8575 : guess some guesses
8576 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8577 $test -d /usr/share/bin && dflt=/usr/share/bin
8578 $test -d /usr/local/script && dflt=/usr/local/script
8579 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8580 $test -d $prefixexp/script && dflt=$prefixexp/script
8581 set dflt
8582 eval $prefixup
8583 ;;
8584*) dflt="$scriptdir"
8585 ;;
8586esac
8587$cat <<EOM
8588
8589Some installations have a separate directory just for executable scripts so
8590that they can mount it across multiple architectures but keep the scripts in
8591one spot. You might, for example, have a subdirectory of /usr/share for this.
8592Or you might just lump your scripts in with all your other executables.
8593
8594EOM
8595fn=d~
8596rp='Where do you keep publicly executable scripts?'
8597. ./getfile
8598if $test "X$ansexp" != "X$scriptdirexp"; then
8599 installscript=''
8600fi
8601scriptdir="$ans"
8602scriptdirexp="$ansexp"
8603: Change installation prefix, if necessary.
8604if $test X"$prefix" != X"$installprefix"; then
8605 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8606else
8607 installscript="$scriptdirexp"
8608fi
8609
8610: determine where add-on public executables go
8611case "$sitebin" in
8612'') dflt=$siteprefix/bin ;;
8613*) dflt=$sitebin ;;
8614esac
8615fn=d~
8616rp='Pathname where the add-on public executables should be installed?'
8617. ./getfile
8618sitebin="$ans"
8619sitebinexp="$ansexp"
8620: Change installation prefix, if necessary.
8621if $test X"$prefix" != X"$installprefix"; then
8622 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8623else
8624 installsitebin="$sitebinexp"
8625fi
8626
6e1038e0 8627: determine where add-on html pages go
8d2cbf27 8628: There is no standard location, so try to copy the previously-selected
6e1038e0 8629: directory structure for the core html pages.
8d2cbf27
JH
8630case "$sitehtml1dir" in
8631'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8632*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8633esac
8634case "$dflt" in
8635''|' ') dflt=none ;;
8636esac
8637fn=dn+~
8638rp='Pathname where the site-specific html pages should be installed?'
8639. ./getfile
8d2cbf27
JH
8640sitehtml1dir="$ans"
8641sitehtml1direxp="$ansexp"
6e1038e0
MB
8642: Change installation prefix, if necessary.
8643if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8644 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8645else
8d2cbf27 8646 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8647fi
8648
8649: determine where add-on library html pages go
8650: There is no standard location, so try to copy the previously-selected
8651: directory structure for the core html pages.
8d2cbf27
JH
8652case "$sitehtml3dir" in
8653'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8654*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8655esac
8656case "$dflt" in
8657''|' ') dflt=none ;;
8658esac
8659fn=dn+~
8660rp='Pathname where the site-specific library html pages should be installed?'
8661. ./getfile
8d2cbf27
JH
8662sitehtml3dir="$ans"
8663sitehtml3direxp="$ansexp"
6e1038e0
MB
8664: Change installation prefix, if necessary.
8665if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8666 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8667else
8d2cbf27 8668 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8669fi
8670
8671: determine where add-on manual pages go
91e123a8
JH
8672case "$siteman1dir" in
8673'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8674*) dflt=$siteman1dir ;;
6e1038e0 8675esac
257059b5
JH
8676case "$dflt" in
8677''|' ') dflt=none ;;
8678esac
6e1038e0
MB
8679fn=dn+~
8680rp='Pathname where the site-specific manual pages should be installed?'
8681. ./getfile
91e123a8
JH
8682siteman1dir="$ans"
8683siteman1direxp="$ansexp"
6e1038e0
MB
8684: Change installation prefix, if necessary.
8685if $test X"$prefix" != X"$installprefix"; then
91e123a8 8686 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8687else
91e123a8 8688 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8689fi
8690
8691: determine where add-on library man pages go
91e123a8
JH
8692case "$siteman3dir" in
8693'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8694*) dflt=$siteman3dir ;;
6e1038e0 8695esac
257059b5
JH
8696case "$dflt" in
8697''|' ') dflt=none ;;
8698esac
6e1038e0
MB
8699fn=dn+~
8700rp='Pathname where the site-specific library manual pages should be installed?'
8701. ./getfile
91e123a8
JH
8702siteman3dir="$ans"
8703siteman3direxp="$ansexp"
6e1038e0
MB
8704: Change installation prefix, if necessary.
8705if $test X"$prefix" != X"$installprefix"; then
91e123a8 8706 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8707else
91e123a8 8708 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8709fi
8710
8711: determine where add-on public executable scripts go
8712case "$sitescript" in
8713'') dflt=$siteprefix/script
8714 $test -d $dflt || dflt=$sitebin ;;
8715*) dflt="$sitescript" ;;
8716esac
8717fn=d~+
8718rp='Pathname where add-on public executable scripts should be installed?'
8719. ./getfile
8720sitescript="$ans"
8721sitescriptexp="$ansexp"
8722: Change installation prefix, if necessary.
8723if $test X"$prefix" != X"$installprefix"; then
8724 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8725else
8726 installsitescript="$sitescriptexp"
8727fi
8728
15b61c98
JH
8729case "$usefaststdio" in
8730$define|true|[yY]*|'')
8731 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8732 case "$xversion" in
8733 [68]) dflt='y' ;;
8734 *) dflt='n' ;;
8735 esac
8736 ;;
8737*) dflt='n';;
8738esac
8739cat <<EOM
8740
8741Perl can be built to use 'fast stdio', which means using the stdio
8742library but also directly manipulating the stdio buffers to enable
8743faster I/O. Using stdio is better for backward compatibility (especially
8744for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8745interface has been preferred instead of stdio.
8746
8747If this doesn't make any sense to you, just accept the default '$dflt'.
8748EOM
8749rp='Use the "fast stdio" if available?'
8750. ./myread
8751case "$ans" in
8752y|Y) val="$define" ;;
8753*) val="$undef" ;;
8754esac
8755set usefaststdio
8756eval $setvar
8757
8758
96056487
JH
8759: define an is-a-typedef? function
8760typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8761case "$inclist" in
8762"") inclist="sys/types.h";;
8763esac;
8764eval "varval=\$$var";
8765case "$varval" in
8766"")
8767 $rm -f temp.c;
8768 for inc in $inclist; do
8769 echo "#include <$inc>" >>temp.c;
8770 done;
8771 echo "#ifdef $type" >> temp.c;
8772 echo "printf(\"We have $type\");" >> temp.c;
8773 echo "#endif" >> temp.c;
8774 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8775 if $contains $type temp.E >/dev/null 2>&1; then
8776 eval "$var=\$type";
8777 else
8778 eval "$var=\$def";
8779 fi;
8780 $rm -f temp.?;;
8781*) eval "$var=\$varval";;
8782esac'
8783
8784: define an is-a-typedef? function that prompts if the type is not available.
8785typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8786case "$inclist" in
8787"") inclist="sys/types.h";;
8788esac;
8789eval "varval=\$$var";
8790case "$varval" in
8791"")
8792 $rm -f temp.c;
8793 for inc in $inclist; do
8794 echo "#include <$inc>" >>temp.c;
8795 done;
8796 echo "#ifdef $type" >> temp.c;
8797 echo "printf(\"We have $type\");" >> temp.c;
8798 echo "#endif" >> temp.c;
8799 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8800 echo " " ;
8801 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8802 if $contains $type temp.E >/dev/null 2>&1; then
8803 echo "$type found." >&4;
8804 eval "$var=\$type";
8805 else
8806 echo "$type NOT found." >&4;
8807 dflt="$def";
8808 . ./myread ;
8809 eval "$var=\$ans";
8810 fi;
8811 $rm -f temp.?;;
8812*) eval "$var=\$varval";;
8813esac'
8814
8815: see what type lseek is declared as in the kernel
8816rp="What is the type used for lseek's offset on this system?"
8817set off_t lseektype long stdio.h sys/types.h
8818eval $typedef_ask
8819
8820echo " "
8821echo "Checking to see how big your file offsets are..." >&4
8822$cat >try.c <<EOCP
8823#include <sys/types.h>
8824#include <stdio.h>
8825int main()
8826{
8827 printf("%d\n", (int)sizeof($lseektype));
8828 return(0);
8829}
8830EOCP
8831set try
8832if eval $compile_ok; then
8833 lseeksize=`$run ./try`
8834 echo "Your file offsets are $lseeksize bytes long."
8835else
8836 dflt=$longsize
8837 echo " "
8838 echo "(I can't seem to compile the test program. Guessing...)"
8839 rp="What is the size of your file offsets (in bytes)?"
8840 . ./myread
8841 lseeksize="$ans"
8842fi
8843$rm -f try.c try
8844
8845: see what type file positions are declared as in the library
8846rp="What is the type for file position used by fsetpos()?"
8847set fpos_t fpostype long stdio.h sys/types.h
8848eval $typedef_ask
8849
8850echo " "
8851case "$fpostype" in
8852*_t) zzz="$fpostype" ;;
8853*) zzz="fpos_t" ;;
8854esac
8855echo "Checking the size of $zzz..." >&4
8856cat > try.c <<EOCP
8857#include <sys/types.h>
8858#include <stdio.h>
d1daaddf
JH
8859#$i_stdlib I_STDLIB
8860#ifdef I_STDLIB
8861#include <stdlib.h>
8862#endif
96056487
JH
8863int main() {
8864 printf("%d\n", (int)sizeof($fpostype));
8865 exit(0);
8866}
8867EOCP
8868set try
8869if eval $compile_ok; then
8870 yyy=`$run ./try`
8871 case "$yyy" in
8872 '') fpossize=4
8873 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8874 ;;
8875 *) fpossize=$yyy
8876 echo "Your $zzz is $fpossize bytes long."
8877 ;;
8878 esac
8879else
8880 dflt="$longsize"
8881 echo " " >&4
8882 echo "(I can't compile the test program. Guessing...)" >&4
8883 rp="What is the size of your file positions (in bytes)?"
8884 . ./myread
8885 fpossize="$ans"
8886fi
8887
96056487
JH
8888# Backward compatibility (uselfs is deprecated).
8889case "$uselfs" in
8890"$define"|true|[yY]*)
8891 cat <<EOM >&4
8892
8893*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8894EOM
8895 uselargefiles="$define"
8896 ;;
8897esac
8898
8899case "$lseeksize:$fpossize" in
89008:8) cat <<EOM
8901
8902You can have files larger than 2 gigabytes.
8903EOM
8904 val="$define" ;;
8905*) case "$uselargefiles" in
8906 "$undef"|false|[nN]*) dflt='n' ;;
8907 *) dflt='y' ;;
8908 esac
8909 cat <<EOM
8910
8911Perl can be built to understand large files (files larger than 2 gigabytes)
8912on some systems. To do so, Configure can be run with -Duselargefiles.
8913
8914If this doesn't make any sense to you, just accept the default '$dflt'.
8915EOM
8916 rp='Try to understand large files, if available?'
8917 . ./myread
8918 case "$ans" in
8919 y|Y) val="$define" ;;
8920 *) val="$undef" ;;
8921 esac
8922 ;;
8923esac
8924set uselargefiles
8925eval $setvar
96056487
JH
8926: Look for a hint-file generated 'call-back-unit'. If the
8927: user has specified that a large files perl is to be built,
8928: we may need to set or change some other defaults.
9da7673b
MB
8929if $test -f uselargefiles.cbu; then
8930 echo "Your platform has some specific hints regarding large file builds, using them..."
8931 . ./uselargefiles.cbu
8932fi
8933case "$uselargefiles" in
8934"$define")
96056487 8935 if $test -f uselargefiles.cbu; then
96056487
JH
8936 echo " "
8937 echo "Rechecking to see how big your file offsets are..." >&4
8938 $cat >try.c <<EOCP
8939#include <sys/types.h>
8940#include <stdio.h>
8941int main()
8942{
8943 printf("%d\n", (int)sizeof($lseektype));
8944 return(0);
8945}
8946EOCP
8947 set try
8948 if eval $compile_ok; then
8949 lseeksize=`$run ./try`
8950 $echo "Your file offsets are now $lseeksize bytes long."
8951 else
8952 dflt="$lseeksize"
8953 echo " "
8954 echo "(I can't seem to compile the test program. Guessing...)"
8955 rp="What is the size of your file offsets (in bytes)?"
8956 . ./myread
8957 lseeksize="$ans"
8958 fi
8959 case "$fpostype" in
8960 *_t) zzz="$fpostype" ;;
8961 *) zzz="fpos_t" ;;
8962 esac
8963 $echo $n "Rechecking the size of $zzz...$c" >&4
8964 $cat > try.c <<EOCP
8965#include <sys/types.h>
8966#include <stdio.h>
55954f19
JH
8967#$i_stdlib I_STDLIB
8968#ifdef I_STDLIB
8969#include <stdlib.h>
8970#endif
96056487
JH
8971int main() {
8972 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8973 return(0);
96056487
JH
8974}
8975EOCP
8976 set try
8977 if eval $compile_ok; then
8978 yyy=`$run ./try`
8979 dflt="$lseeksize"
8980 case "$yyy" in
8981 '') echo " "
8982 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8983 ;;
8984 *) fpossize=$yyy
8985 echo " $fpossize bytes." >&4
8986 ;;
8987 esac
8988 else
8989 dflt="$fpossize"
8990 echo " "
8991 echo "(I can't compile the test program. Guessing...)" >&4
8992 rp="What is the size of your file positions (in bytes)?"
8993 . ./myread
8994 fpossize="$ans"
8995 fi
8996 $rm -f try.c try
8997 fi
8998 ;;
8999esac
9000
db0f2be4
MB
9001# probably will refer to
9002# $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9003need_relocation=0
9004userelocatableinc=undef
9005
b4eb6b3d
JH
9006case "$vendorprefix" in
9007'') d_vendorbin="$undef"
9008 vendorbin=''
9009 vendorbinexp=''
9010 ;;
9011*) d_vendorbin="$define"
9012 : determine where vendor-supplied executables go.
9013 case "$vendorbin" in
9014 '') dflt=$vendorprefix/bin ;;
9015 *) dflt="$vendorbin" ;;
9016 esac
9017 fn=d~+
9018 rp='Pathname for the vendor-supplied executables directory?'
9019 . ./getfile
9020 vendorbin="$ans"
9021 vendorbinexp="$ansexp"
9022 ;;
9023esac
9024: Change installation prefix, if necessary.
9025if $test X"$prefix" != X"$installprefix"; then
9026 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9027else
9028 installvendorbin="$vendorbinexp"
9029fi
9030
6e1038e0 9031case "$vendorprefix" in
8d2cbf27
JH
9032'') vendorhtml1dir=''
9033 vendorhtml1direxp=''
6e1038e0
MB
9034 ;;
9035*) : determine where vendor-supplied html pages go.
9036 : There is no standard location, so try to copy the previously-selected
9037 : directory structure for the core html pages.
9038 : XXX Better default suggestions would be welcome.
8d2cbf27 9039 case "$vendorhtml1dir" in
6e1038e0 9040 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9041 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9042 esac
9043 case "$dflt" in
9044 ''|' ') dflt=none ;;
9045 esac
9046 fn=dn+~
9047 rp='Pathname for the vendor-supplied html pages?'
9048 . ./getfile
8d2cbf27
JH
9049 vendorhtml1dir="$ans"
9050 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9051 ;;
9052esac
9053: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9054$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9055: Change installation prefix, if necessary.
9056if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9057 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9058else
8d2cbf27 9059 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9060fi
9061
9062case "$vendorprefix" in
8d2cbf27
JH
9063'') vendorhtml3dir=''
9064 vendorhtml3direxp=''
6e1038e0
MB
9065 ;;
9066*) : determine where vendor-supplied module html pages go.
9067 : There is no standard location, so try to copy the previously-selected
9068 : directory structure for the core html pages.
9069 : XXX Better default suggestions would be welcome.
8d2cbf27 9070 case "$vendorhtml3dir" in
6e1038e0 9071 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9072 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9073 esac
9074 case "$dflt" in
9075 ''|' ') dflt=none ;;
9076 esac
9077 fn=dn+~
9078 rp='Pathname for the vendor-supplied html pages?'
9079 . ./getfile
8d2cbf27
JH
9080 vendorhtml3dir="$ans"
9081 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9082 ;;
9083esac
9084: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9085$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9086: Change installation prefix, if necessary.
9087if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9088 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9089else
8d2cbf27 9090 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9091fi
9092
9093case "$vendorprefix" in
91e123a8
JH
9094'') vendorman1dir=''
9095 vendorman1direxp=''
6e1038e0
MB
9096 ;;
9097*) : determine where vendor-supplied manual pages go.
91e123a8 9098 case "$vendorman1dir" in
6e1038e0 9099 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9100 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9101 esac
9102 case "$dflt" in
9103 ''|' ') dflt=none ;;
9104 esac
9105 fn=nd~+
9106 rp='Pathname for the vendor-supplied manual section 1 pages?'
9107 . ./getfile
91e123a8
JH
9108 vendorman1dir="$ans"
9109 vendorman1direxp="$ansexp"
6e1038e0
MB
9110 ;;
9111esac
9112: Use ' ' for none so value is preserved next time through Configure
91e123a8 9113$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9114: Change installation prefix, if necessary.
9115if $test X"$prefix" != X"$installprefix"; then
91e123a8 9116 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9117else
91e123a8 9118 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9119fi
9120
9121case "$vendorprefix" in
91e123a8
JH
9122'') vendorman3dir=''
9123 vendorman3direxp=''
6e1038e0
MB
9124 ;;
9125*) : determine where vendor-supplied module manual pages go.
91e123a8 9126 case "$vendorman3dir" in
6e1038e0 9127 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9128 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9129 esac
9130 case "$dflt" in
9131 ''|' ') dflt=none ;;
9132 esac
9133 fn=nd~+
9134 rp='Pathname for the vendor-supplied manual section 3 pages?'
9135 . ./getfile
91e123a8
JH
9136 vendorman3dir="$ans"
9137 vendorman3direxp="$ansexp"
6e1038e0
MB
9138 ;;
9139esac
9140: Use ' ' for none so value is preserved next time through Configure
91e123a8 9141$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9142: Change installation prefix, if necessary.
9143if $test X"$prefix" != X"$installprefix"; then
91e123a8 9144 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9145else
91e123a8 9146 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9147fi
9148
9149case "$vendorprefix" in
9150'') d_vendorscript="$undef"
9151 vendorscript=''
9152 vendorscriptexp=''
9153 ;;
9154*) d_vendorscript="$define"
9155 : determine where vendor-supplied scripts go.
9156 case "$vendorscript" in
9157 '') dflt=$vendorprefix/script
9158 $test -d $dflt || dflt=$vendorbin ;;
9159 *) dflt="$vendorscript" ;;
9160 esac
9161 $cat <<EOM
9162
9163The installation process will create a directory for
9164vendor-supplied scripts.
9165
9166EOM
9167 fn=d~+
9168 rp='Pathname for the vendor-supplied scripts directory?'
9169 . ./getfile
9170 vendorscript="$ans"
9171 vendorscriptexp="$ansexp"
9172 ;;
9173esac
9174: Change installation prefix, if necessary.
9175if $test X"$prefix" != X"$installprefix"; then
9176 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9177else
9178 installvendorscript="$vendorscriptexp"
9179fi
9180
b4eb6b3d
JH
9181: see if qgcvt exists
9182set qgcvt d_qgcvt
9183eval $inlibc
9184
89ce900e
JH
9185echo " "
9186
9187if $test X"$d_longdbl" = X"$define"; then
9188
9189echo "Checking how to print long doubles..." >&4
9190
9191if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9192 $cat >try.c <<'EOCP'
9193#include <sys/types.h>
9194#include <stdio.h>
9195int main() {
9196 double d = 123.456;
9197 printf("%.3f\n", d);
9198}
9199EOCP
9200 set try
9201 if eval $compile; then
9202 yyy=`$run ./try`
9203 case "$yyy" in
9204 123.456)
9205 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9206 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9207 echo "We will use %f."
9208 ;;
9209 esac
9210 fi
9211fi
9212
9213if $test X"$sPRIfldbl" = X; then
9214 $cat >try.c <<'EOCP'
9215#include <sys/types.h>
9216#include <stdio.h>
9217int main() {
9218 long double d = 123.456;
9219 printf("%.3Lf\n", d);
9220}
9221EOCP
9222 set try
9223 if eval $compile; then
9224 yyy=`$run ./try`
9225 case "$yyy" in
9226 123.456)
9227 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9228 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9229 echo "We will use %Lf."
9230 ;;
9231 esac
9232 fi
9233fi
9234
9235if $test X"$sPRIfldbl" = X; then
9236 $cat >try.c <<'EOCP'
9237#include <sys/types.h>
9238#include <stdio.h>
9239int main() {
9240 long double d = 123.456;
9241 printf("%.3llf\n", d);
9242}
9243EOCP
9244 set try
9245 if eval $compile; then
9246 yyy=`$run ./try`
9247 case "$yyy" in
9248 123.456)
9249 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9250 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9251 echo "We will use %llf."
9252 ;;
9253 esac
9254 fi
9255fi
9256
9257if $test X"$sPRIfldbl" = X; then
9258 $cat >try.c <<'EOCP'
9259#include <sys/types.h>
9260#include <stdio.h>
9261int main() {
9262 long double d = 123.456;
9263 printf("%.3lf\n", d);
9264}
9265EOCP
9266 set try
9267 if eval $compile; then
9268 yyy=`$run ./try`
9269 case "$yyy" in
9270 123.456)
9271 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9272 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9273 echo "We will use %lf."
9274 ;;
9275 esac
9276 fi
9277fi
9278
9279if $test X"$sPRIfldbl" = X; then
9280 echo "Cannot figure out how to print long doubles." >&4
9281else
9282 sSCNfldbl=$sPRIfldbl # expect consistency
9283fi
9284
9285$rm -f try try.*
9286
9287fi # d_longdbl
9288
9289case "$sPRIfldbl" in
9290'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9291 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9292 d_SCNfldbl="$undef";
9293 ;;
9294*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9295 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9296 d_SCNfldbl="$define";
9297 ;;
9298esac
9299
b4eb6b3d 9300: Check how to convert floats to strings.
a5b10d80
YST
9301
9302if test "X$d_Gconvert" = X; then
9303
b4eb6b3d
JH
9304echo " "
9305echo "Checking for an efficient way to convert floats to strings."
9306echo " " > try.c
9307case "$uselongdouble" in
9308"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9309esac
9310case "$d_longdbl" in
9311"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9312esac
9313case "$d_PRIgldbl" in
9314"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9315esac
9316$cat >>try.c <<EOP
9317#ifdef TRY_gconvert
9318#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9319char *myname = "gconvert";
9320#endif
9321#ifdef TRY_gcvt
9322#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9323char *myname = "gcvt";
9324#endif
9325#ifdef TRY_qgcvt
9326#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9327char *myname = "qgcvt";
9328#define DOUBLETYPE long double
9329#endif
9330#ifdef TRY_sprintf
a5b10d80
YST
9331#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9332#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9333#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9334#else
a5b10d80
YST
9335#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9336#endif
9337#else
b4eb6b3d
JH
9338#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9339#endif
9340char *myname = "sprintf";
9341#endif
9342
9343#ifndef DOUBLETYPE
9344#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9345#define DOUBLETYPE long double
9346#else
9347#define DOUBLETYPE double
9348#endif
9349#endif
9350
9351#include <stdio.h>
9352
9353#define I_STDLIB $i_stdlib
9354#ifdef I_STDLIB
9355#include <stdlib.h>
9356#endif
9357
9358int
9359checkit(expect, got)
9360char *expect;
9361char *got;
9362{
9363 if (strcmp(expect, got)) {
9364 printf("%s oddity: Expected %s, got %s\n",
9365 myname, expect, got);
9366 exit(1);
9367 }
9368}
9369
9370int main()
9371{
9372 char buf[64];
9373 buf[63] = '\0';
9374
9375 /* This must be 1st test on (which?) platform */
9376 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9377 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9378 checkit("0.1", buf);
9379
a5b10d80
YST
9380 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9381 checkit("0.01", buf);
9382
9383 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9384 checkit("0.001", buf);
9385
9386 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9387 checkit("0.0001", buf);
9388
9389 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9390 if (strlen(buf) > 5)
9391 checkit("9e-005", buf); /* for Microsoft ?? */
9392 else
9393 checkit("9e-05", buf);
9394
b4eb6b3d
JH
9395 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9396 checkit("1", buf);
9397
9398 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9399 checkit("1.1", buf);
9400
9401 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9402 checkit("1.01", buf);
9403
9404 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9405 checkit("1.001", buf);
9406
9407 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9408 checkit("1.0001", buf);
9409
9410 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9411 checkit("1.00001", buf);
9412
9413 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9414 checkit("1.000001", buf);
9415
9416 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9417 checkit("0", buf);
9418
9419 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9420 checkit("-1", buf);
9421
9422 /* Some Linux gcvt's give 1.e+5 here. */
9423 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9424 checkit("100000", buf);
9425
9426 /* Some Linux gcvt's give -1.e+5 here. */
9427 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9428 checkit("-100000", buf);
9429
9430 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9431 checkit("123.456", buf);
9432
ab6ca9f4 9433 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9434 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9435 /* 34 should be enough to scare even long double
9436 * places into using the e notation. */
ab6ca9f4 9437 if (strlen(buf) > 5)
94b339ad 9438 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9439 else
94b339ad 9440 checkit("1e+34", buf);
8e2a5ede 9441
d1eb8299
YST
9442 /* For Perl, if you add additional tests here, also add them to
9443 * t/base/num.t for benefit of platforms not using Configure or
9444 * overriding d_Gconvert */
9445
b4eb6b3d
JH
9446 exit(0);
9447}
9448EOP
ab6ca9f4 9449: first add preferred functions to our list
a5b10d80 9450xxx_list=""
ab6ca9f4 9451for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9452 case $xxx_convert in
9453 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9454 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9455 esac
9456done
9457: then add any others
9458for xxx_convert in gconvert gcvt sprintf; do
9459 case "$xxx_list" in
9460 *$xxx_convert*) ;;
9461 *) xxx_list="$xxx_list $xxx_convert" ;;
9462 esac
9463done
9464
9465case "$d_longdbl$uselongdouble" in
9466"$define$define")
9467 : again, add prefered functions to our list first
9468 xxx_ld_list=""
ab6ca9f4 9469 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9470 case $xxx_convert in
9471 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9472 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9473 esac
9474 done
9475 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9476 for xxx_convert in qgcvt sprintf $xxx_list; do
9477 case "$xxx_ld_list" in
9478 $xxx_convert*|*" $xxx_convert"*) ;;
9479 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9480 esac
9481 done
9482 : if sprintf cannot do long doubles, move it to the end
9483 if test "$d_PRIgldbl" != "$define"; then
9484 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9485 fi
9486 : if no qgcvt, remove it
9487 if test "$d_qgcvt" != "$define"; then
9488 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9489 fi
9490 : use the ld_list
9491 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9492 ;;
9493esac
9494
9495for xxx_convert in $xxx_list; do
9496 echo "Trying $xxx_convert..."
9497 $rm -f try try$_o
9498 set try -DTRY_$xxx_convert
9499 if eval $compile; then
9500 echo "$xxx_convert() found." >&4
5440bc8e 9501 if $run ./try; then
b4eb6b3d
JH
9502 echo "I'll use $xxx_convert to convert floats into a string." >&4
9503 break;
9504 else
9505 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9506 xxx_convert=''
b4eb6b3d
JH
9507 fi
9508 else
9509 echo "$xxx_convert NOT found." >&4
9510 fi
9511done
ab6ca9f4 9512
a5b10d80
YST
9513if test X$xxx_convert = X; then
9514 echo "*** WHOA THERE!!! ***" >&4
9515 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9516 xxx_convert=sprintf
9517fi
9518
b4eb6b3d
JH
9519case "$xxx_convert" in
9520gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9521gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9522qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9523*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9524 "$define$define$define")
9525 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9526 "$define$define$undef")
9527 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9528 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9529 esac
9530 ;;
9531esac
9532
a5b10d80
YST
9533fi
9534
74cac757
JH
9535: see if _fwalk exists
9536set fwalk d__fwalk
9537eval $inlibc
9538
b4eb6b3d
JH
9539: Initialize h_fcntl
9540h_fcntl=false
9541
9542: Initialize h_sysfile
9543h_sysfile=false
9544
9545: access call always available on UNIX
9546set access d_access
9547eval $inlibc
9548
9549: locate the flags for 'access()'
9550case "$d_access" in
9551"$define")
9552 echo " "
55954f19 9553 $cat >access.c <<EOCP
b4eb6b3d
JH
9554#include <sys/types.h>
9555#ifdef I_FCNTL
9556#include <fcntl.h>
9557#endif
9558#ifdef I_SYS_FILE
9559#include <sys/file.h>
9560#endif
9561#ifdef I_UNISTD
9562#include <unistd.h>
9563#endif
55954f19
JH
9564#$i_stdlib I_STDLIB
9565#ifdef I_STDLIB
9566#include <stdlib.h>
9567#endif
b4eb6b3d
JH
9568int main() {
9569 exit(R_OK);
9570}
9571EOCP
9572 : check sys/file.h first, no particular reason here
9573 if $test `./findhdr sys/file.h` && \
7a282f6d 9574 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9575 h_sysfile=true;
9576 echo "<sys/file.h> defines the *_OK access constants." >&4
9577 elif $test `./findhdr fcntl.h` && \
7a282f6d 9578 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9579 h_fcntl=true;
9580 echo "<fcntl.h> defines the *_OK access constants." >&4
9581 elif $test `./findhdr unistd.h` && \
7a282f6d 9582 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9583 echo "<unistd.h> defines the *_OK access constants." >&4
9584 else
9585 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9586 fi
9587 ;;
9588esac
9589$rm -f access*
9590
9591: see if accessx exists
9592set accessx d_accessx
9593eval $inlibc
9594
89ce900e
JH
9595: see if aintl exists
9596set aintl d_aintl
9597eval $inlibc
9598
b4eb6b3d
JH
9599: see if alarm exists
9600set alarm d_alarm
9601eval $inlibc
9602
a9dade78
JH
9603: see if POSIX threads are available
9604set pthread.h i_pthread
9605eval $inhdr
9606
10bc17b6
JH
9607: define a fucntion to check prototypes
9608$cat > protochk <<EOSH
9609$startsh
9610cc="$cc"
9611optimize="$optimize"
9612ccflags="$ccflags"
9613prototype="$prototype"
9614define="$define"
9615rm=$rm
a9dade78
JH
9616usethreads=$usethreads
9617i_pthread=$i_pthread
9618pthread_h_first=$pthread_h_first
10bc17b6
JH
9619EOSH
9620
9621$cat >> protochk <<'EOSH'
9622
9623$rm -f try.c
9624foo="$1"
9625shift
9626while test $# -ge 2; do
9627 case "$1" in
9628 $define) echo "#include <$2>" >> try.c ;;
9629 literal) echo "$2" >> try.c ;;
9630 esac
cce6a207
MB
9631 # Extra magic for the benefit of systems that need pthread.h
9632 # to be included early to correctly detect threadsafe functions.
9633 # Such functions must guarantee themselves, though, that the usethreads
9634 # and i_pthread have been defined, before calling protochk.
9635 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9636 echo "#include <pthread.h>" >> try.c
9637 pthread_h_done=yes
9638 fi
10bc17b6
JH
9639 shift 2
9640done
9641test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9642cat >> try.c <<'EOCP'
9643#ifdef CAN_PROTOTYPE
9644#define _(args) args
9645#else
9646#define _(args) ()
9647#endif
9648EOCP
9649echo "$foo" >> try.c
9650echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9651$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9652status=$?
9653$rm -f try.[co]
9654exit $status
9655EOSH
9656chmod +x protochk
9657$eunicefix protochk
9658
89ce900e
JH
9659hasproto='varname=$1; func=$2; shift; shift;
9660while $test $# -ge 2; do
9661 case "$1" in
9662 $define) echo "#include <$2>";;
9663 esac ;
9664 shift 2;
9665done > try.c;
9666$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9667if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9668 echo "$func() prototype found.";
9669 val="$define";
9670else
9671 echo "$func() prototype NOT found.";
9672 val="$undef";
9673fi;
9674set $varname;
9675eval $setvar;
9676$rm -f try.c tryout.c'
9677
10bc17b6
JH
9678: see if sys/types.h has to be included
9679set sys/types.h i_systypes
9680eval $inhdr
9681
9682: see if sys/select.h has to be included
9683set sys/select.h i_sysselct
9684eval $inhdr
9685
9686hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9687while $test $# -ge 2; do
9688 case "$1" in
9689 $define) echo "#include <$2>";;
9690 esac ;
9691 shift 2;
9692done > try.c;
9693echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9694set try;
9695if eval $compile; then
9696 val="$define";
9697else
9698 val="$undef";
9699fi;
9700set $varname;
9701eval $setvar;
9702$rm -f try.c try.o'
9703
9704: see if we should include time.h, sys/time.h, or both
9705echo " "
9706if test "X$timeincl" = X; then
9707 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9708 $echo $n "I'm now running the test program...$c"
55954f19 9709 $cat >try.c <<EOCP
10bc17b6
JH
9710#include <sys/types.h>
9711#ifdef I_TIME
9712#include <time.h>
9713#endif
9714#ifdef I_SYSTIME
9715#ifdef SYSTIMEKERNEL
9716#define KERNEL
9717#endif
9718#include <sys/time.h>
9719#endif
9720#ifdef I_SYSSELECT
9721#include <sys/select.h>
9722#endif
55954f19
JH
9723#$i_stdlib I_STDLIB
9724#ifdef I_STDLIB
9725#include <stdlib.h>
9726#endif
10bc17b6
JH
9727int main()
9728{
9729 struct tm foo;
9730#ifdef S_TIMEVAL
9731 struct timeval bar;
9732#endif
9733#ifdef S_TIMEZONE
9734 struct timezone tzp;
9735#endif
9736 if (foo.tm_sec == foo.tm_sec)
9737 exit(0);
9738#ifdef S_TIMEVAL
9739 if (bar.tv_sec == bar.tv_sec)
9740 exit(0);
9741#endif
9742 exit(1);
9743}
9744EOCP
9745 flags=''
9746 for s_timezone in '-DS_TIMEZONE' ''; do
9747 sysselect=''
9748 for s_timeval in '-DS_TIMEVAL' ''; do
9749 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9750 for i_time in '' '-DI_TIME'; do
9751 for i_systime in '-DI_SYSTIME' ''; do
9752 case "$flags" in
9753 '') $echo $n ".$c"
9754 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9755 if eval $compile; then
9756 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9757 shift
9758 flags="$*"
9759 echo " "
9760 $echo $n "Succeeded with $flags$c"
9761 fi
9762 ;;
9763 esac
9764 done
9765 done
9766 done
9767 done
9768 done
9769 timeincl=''
9770 echo " "
9771 case "$flags" in
9772 *SYSTIMEKERNEL*) i_systimek="$define"
9773 timeincl=`./findhdr sys/time.h`
9774 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9775 *) i_systimek="$undef";;
9776 esac
9777 case "$flags" in
9778 *I_TIME*) i_time="$define"
9779 timeincl=`./findhdr time.h`" $timeincl"
9780 echo "We'll include <time.h>." >&4;;
9781 *) i_time="$undef";;
9782 esac
9783 case "$flags" in
9784 *I_SYSTIME*) i_systime="$define"
9785 timeincl=`./findhdr sys/time.h`" $timeincl"
9786 echo "We'll include <sys/time.h>." >&4;;
9787 *) i_systime="$undef";;
9788 esac
9789 $rm -f try.c try
9790fi
9791: see if struct tm knows about tm_zone
9792case "$i_systime$i_time" in
9793*$define*)
9794 echo " "
9795 echo "Checking to see if your struct tm has tm_zone field..." >&4
9796 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9797 eval $hasfield
9798 ;;
9799*) val="$undef"
9800 set d_tm_tm_zone
9801 eval $setvar
9802 ;;
9803esac
9804case "$d_tm_tm_zone" in
9805"$define") echo "Yes, it does." ;;
9806*) echo "No, it doesn't." ;;
9807esac
9808: see if struct tm knows about tm_gmtoff
9809case "$i_systime$i_time" in
9810*$define*)
9811 echo " "
9812 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9813 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9814 eval $hasfield
9815 ;;
9816*) val="$undef"
9817 set d_tm_tm_gmtoff
9818 eval $setvar
9819 ;;
9820esac
9821case "$d_tm_tm_gmtoff" in
9822"$define") echo "Yes, it does." ;;
9823*) echo "No, it doesn't." ;;
9824esac
9825
9826: see if asctime_r exists
9827set asctime_r d_asctime_r
9828eval $inlibc
9829case "$d_asctime_r" in
9830"$define")
d63eadf0 9831 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9832 case "$d_asctime_r_proto:$usethreads" in
9833 ":define") d_asctime_r_proto=define
a48ec845
JH
9834 set d_asctime_r_proto asctime_r $hdrs
9835 eval $hasproto ;;
9836 *) ;;
9837 esac
9838 case "$d_asctime_r_proto" in
9839 define)
10bc17b6
JH
9840 case "$asctime_r_proto" in
9841 ''|0) try='char* asctime_r(const struct tm*, char*);'
9842 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9843 esac
9844 case "$asctime_r_proto" in
9845 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9846 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9847 esac
9848 case "$asctime_r_proto" in
9849 ''|0) try='int asctime_r(const struct tm*, char*);'
9850 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9851 esac
9852 case "$asctime_r_proto" in
9853 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9854 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9855 esac
9856 case "$asctime_r_proto" in
90e831dc 9857 ''|0) d_asctime_r=undef
10bc17b6 9858 asctime_r_proto=0
a48ec845 9859 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9860 * ) case "$asctime_r_proto" in
9861 REENTRANT_PROTO*) ;;
9862 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9863 esac
9864 echo "Prototype: $try" ;;
9865 esac
9866 ;;
c18e646a
JH
9867 *) case "$usethreads" in
9868 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9869 esac
90e831dc
SB
9870 d_asctime_r=undef
9871 asctime_r_proto=0
c18e646a 9872 ;;
a48ec845
JH
9873 esac
9874 ;;
10bc17b6
JH
9875*) asctime_r_proto=0
9876 ;;
9877esac
9878
b4eb6b3d
JH
9879: see if atolf exists
9880set atolf d_atolf
9881eval $inlibc
9882
9883: see if atoll exists
9884set atoll d_atoll
9885eval $inlibc
9886
0dbb1585
AL
9887: Look for GCC-style attribute format
9888case "$d_attribute_format" in
bde30f85 9889'')
b4eb6b3d 9890echo " "
0dbb1585 9891echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9892$cat >attrib.c <<'EOCP'
9893#include <stdio.h>
0dbb1585 9894void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9895EOCP
9896if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9897 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9898 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9899 val="$undef"
9900 else
0dbb1585 9901 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9902 val="$define"
9903 fi
9904else
9905 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9906 val="$undef"
9907fi
bde30f85 9908;;
0dbb1585 9909*) val="$d_attribute_format" ;;
bde30f85 9910esac
0dbb1585
AL
9911set d_attribute_format
9912eval $setvar
9913$rm -f attrib*
9914
9915: Look for GCC-style attribute malloc
9916case "$d_attribute_malloc" in
9917'')
9918echo " "
9919echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9920$cat >attrib.c <<'EOCP'
9921#include <stdio.h>
9922char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9923EOCP
9924if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9925 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9926 echo "Your C compiler doesn't support __attribute__((malloc))."
9927 val="$undef"
9928 else
9929 echo "Your C compiler supports __attribute__((malloc))."
9930 val="$define"
9931 fi
9932else
9933 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9934 val="$undef"
9935fi
9936;;
9937*) val="$d_attribute_malloc" ;;
9938esac
9939set d_attribute_malloc
9940eval $setvar
9941$rm -f attrib*
9942
9943: Look for GCC-style attribute nonnull
9944case "$d_attribute_nonnull" in
9945'')
9946echo " "
9947echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9948$cat >attrib.c <<'EOCP'
9949#include <stdio.h>
9950void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9951EOCP
9952if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9953 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9954 echo "Your C compiler doesn't support __attribute__((nonnull))."
9955 val="$undef"
9956 else
9957 echo "Your C compiler supports __attribute__((nonnull))."
9958 val="$define"
9959 fi
9960else
9961 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9962 val="$undef"
9963fi
9964;;
9965*) val="$d_attribute_nonnull" ;;
9966esac
9967set d_attribute_nonnull
9968eval $setvar
9969$rm -f attrib*
9970
9971: Look for GCC-style attribute noreturn
9972case "$d_attribute_noreturn" in
9973'')
9974echo " "
9975echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9976$cat >attrib.c <<'EOCP'
9977#include <stdio.h>
9978void fall_over_dead( void ) __attribute__((noreturn));
9979EOCP
9980if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9981 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9982 echo "Your C compiler doesn't support __attribute__((noreturn))."
9983 val="$undef"
9984 else
9985 echo "Your C compiler supports __attribute__((noreturn))."
9986 val="$define"
9987 fi
9988else
9989 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9990 val="$undef"
9991fi
9992;;
9993*) val="$d_attribute_noreturn" ;;
9994esac
9995set d_attribute_noreturn
9996eval $setvar
9997$rm -f attrib*
9998
9999: Look for GCC-style attribute pure
10000case "$d_attribute_pure" in
10001'')
10002echo " "
10003echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10004$cat >attrib.c <<'EOCP'
10005#include <stdio.h>
10006int square( int n ) __attribute__((pure));
10007EOCP
10008if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10009 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10010 echo "Your C compiler doesn't support __attribute__((pure))."
10011 val="$undef"
10012 else
10013 echo "Your C compiler supports __attribute__((pure))."
10014 val="$define"
10015 fi
10016else
10017 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10018 val="$undef"
10019fi
10020;;
10021*) val="$d_attribute_pure" ;;
10022esac
10023set d_attribute_pure
10024eval $setvar
10025$rm -f attrib*
10026
10027: Look for GCC-style attribute unused
10028case "$d_attribute_unused" in
10029'')
10030echo " "
10031echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10032$cat >attrib.c <<'EOCP'
10033#include <stdio.h>
10034int do_something( int dummy __attribute__((unused)), int n );
10035EOCP
10036if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10037 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10038 echo "Your C compiler doesn't support __attribute__((unused))."
10039 val="$undef"
10040 else
10041 echo "Your C compiler supports __attribute__((unused))."
10042 val="$define"
10043 fi
10044else
10045 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10046 val="$undef"
10047fi
10048;;
10049*) val="$d_attribute_unused" ;;
10050esac
10051set d_attribute_unused
10052eval $setvar
10053$rm -f attrib*
10054
10055: Look for GCC-style attribute warn_unused_result
10056case "$d_attribute_warn_unused_result" in
10057'')
10058echo " "
10059echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10060$cat >attrib.c <<'EOCP'
10061#include <stdio.h>
10062int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10063EOCP
10064if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10065 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10066 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10067 val="$undef"
10068 else
10069 echo "Your C compiler supports __attribute__((warn_unused_result))."
10070 val="$define"
10071 fi
10072else
10073 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10074 val="$undef"
10075fi
10076;;
10077*) val="$d_attribute_warn_unused_result" ;;
10078esac
10079set d_attribute_warn_unused_result
b4eb6b3d
JH
10080eval $setvar
10081$rm -f attrib*
10082
10083: see if bcmp exists
10084set bcmp d_bcmp
10085eval $inlibc
10086
10087: see if bcopy exists
10088set bcopy d_bcopy
10089eval $inlibc
10090
10091: see if this is a unistd.h system
10092set unistd.h i_unistd
10093eval $inhdr
10094
10095: see if getpgrp exists
10096set getpgrp d_getpgrp
10097eval $inlibc
10098
10099case "$d_getpgrp" in
10100"$define")
10101 echo " "
10102 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10103 $cat >try.c <<EOP
b4eb6b3d
JH
10104#$i_unistd I_UNISTD
10105#include <sys/types.h>
10106#ifdef I_UNISTD
10107# include <unistd.h>
10108#endif
55954f19
JH
10109#$i_stdlib I_STDLIB
10110#ifdef I_STDLIB
10111#include <stdlib.h>
10112#endif
b4eb6b3d
JH
10113int main()
10114{
10115 if (getuid() == 0) {
10116 printf("(I see you are running Configure as super-user...)\n");
10117 setuid(1);
10118 }
10119#ifdef TRY_BSD_PGRP
10120 if (getpgrp(1) == 0)
10121 exit(0);
10122#else
10123 if (getpgrp() > 0)
10124 exit(0);
10125#endif
10126 exit(1);
10127}
10128EOP
5440bc8e 10129 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10130 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10131 val="$define"
5440bc8e 10132 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10133 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10134 val="$undef"
10135 else
10136 echo "I can't seem to compile and run the test program."
10137 if ./usg; then
10138 xxx="a USG one, i.e. you use getpgrp()."
10139 else
10140 # SVR4 systems can appear rather BSD-ish.
10141 case "$i_unistd" in
10142 $undef)
10143 xxx="a BSD one, i.e. you use getpgrp(pid)."
10144 val="$define"
10145 ;;
10146 $define)
10147 xxx="probably a USG one, i.e. you use getpgrp()."
10148 val="$undef"
10149 ;;
10150 esac
10151 fi
10152 echo "Assuming your getpgrp is $xxx" >&4
10153 fi
10154 ;;
10155*) val="$undef";;
10156esac
10157set d_bsdgetpgrp
10158eval $setvar
5440bc8e 10159$rm -f try try.*
b4eb6b3d
JH
10160
10161: see if setpgrp exists
10162set setpgrp d_setpgrp
10163eval $inlibc
10164
10165case "$d_setpgrp" in
10166"$define")
10167 echo " "
10168 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10169 $cat >try.c <<EOP
b4eb6b3d
JH
10170#$i_unistd I_UNISTD
10171#include <sys/types.h>
10172#ifdef I_UNISTD
10173# include <unistd.h>
10174#endif
55954f19
JH
10175#$i_stdlib I_STDLIB
10176#ifdef I_STDLIB
10177#include <stdlib.h>
10178#endif
b4eb6b3d
JH
10179int main()
10180{
10181 if (getuid() == 0) {
10182 printf("(I see you are running Configure as super-user...)\n");
10183 setuid(1);
10184 }
10185#ifdef TRY_BSD_PGRP
10186 if (-1 == setpgrp(1, 1))
10187 exit(0);
10188#else
10189 if (setpgrp() != -1)
10190 exit(0);
10191#endif
10192 exit(1);
10193}
10194EOP
5440bc8e 10195 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10196 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10197 val="$define"
5440bc8e 10198 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10199 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10200 val="$undef"
10201 else
10202 echo "(I can't seem to compile and run the test program.)"
10203 if ./usg; then
10204 xxx="a USG one, i.e. you use setpgrp()."
10205 else
10206 # SVR4 systems can appear rather BSD-ish.
10207 case "$i_unistd" in
10208 $undef)
10209 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10210 val="$define"
10211 ;;
10212 $define)
10213 xxx="probably a USG one, i.e. you use setpgrp()."
10214 val="$undef"
10215 ;;
10216 esac
10217 fi
10218 echo "Assuming your setpgrp is $xxx" >&4
10219 fi
10220 ;;
10221*) val="$undef";;
10222esac
10223set d_bsdsetpgrp
10224eval $setvar
5440bc8e 10225$rm -f try try.*
b4eb6b3d
JH
10226: see if bzero exists
10227set bzero d_bzero
10228eval $inlibc
10229
10230: see if signal is declared as pointer to function returning int or void
10231echo " "
10232xxx=`./findhdr signal.h`
10233$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10234if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10235 echo "You have int (*signal())() instead of void." >&4
10236 val="$undef"
10237elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10238 echo "You have void (*signal())()." >&4
10239 val="$define"
10240elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10241 echo "You have int (*signal())() instead of void." >&4
10242 val="$undef"
10243elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10244 echo "You have void (*signal())()." >&4
10245 val="$define"
10246else
10247 case "$d_voidsig" in
10248 '')
10249 echo "I can't determine whether signal handler returns void or int..." >&4
10250 dflt=void
10251 rp="What type does your signal handler return?"
10252 . ./myread
10253 case "$ans" in
10254 v*) val="$define";;
10255 *) val="$undef";;
10256 esac;;
10257 "$define")
10258 echo "As you already told me, signal handler returns void." >&4
10259 val="$define"
10260 ;;
10261 *) echo "As you already told me, signal handler returns int." >&4
10262 val="$undef"
10263 ;;
10264 esac
10265fi
10266set d_voidsig
10267eval $setvar
10268case "$d_voidsig" in
10269"$define") signal_t="void";;
10270*) signal_t="int";;
10271esac
10272$rm -f $$.tmp
10273
10274: check for ability to cast large floats to 32-bit ints.
10275echo " "
10276echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10277if $test "$intsize" -ge 4; then
10278 xxx=int
10279else
10280 xxx=long
10281fi
10282$cat >try.c <<EOCP
10283#include <stdio.h>
d1daaddf
JH
10284#$i_stdlib I_STDLIB
10285#ifdef I_STDLIB
10286#include <stdlib.h>
10287#endif
b4eb6b3d
JH
10288#include <sys/types.h>
10289#include <signal.h>
10290$signal_t blech(s) int s; { exit(3); }
10291int main()
10292{
10293 $xxx i32;
10294 double f, g;
10295 int result = 0;
10296 char str[16];
10297 signal(SIGFPE, blech);
10298
10299 /* Don't let compiler optimize the test away. Store the number
10300 in a writable string for gcc to pass to sscanf under HP/UX.
10301 */
10302 sprintf(str, "2147483647");
10303 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10304 g = 10 * f;
10305 i32 = ($xxx) g;
10306
10307 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10308 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10309 behavior here, which is to preserve the sign and give
10310 back 0x7fff ffff.
10311 */
10312 if (i32 != ($xxx) f)
10313 result |= 1;
10314 exit(result);
10315}
10316EOCP
10317set try
10318if eval $compile_ok; then
5440bc8e 10319 $run ./try
b4eb6b3d
JH
10320 yyy=$?
10321else
10322 echo "(I can't seem to compile the test program--assuming it can't)"
10323 yyy=1
10324fi
10325case "$yyy" in
103260) val="$define"
10327 echo "Yup, it can."
10328 ;;
10329*) val="$undef"
10330 echo "Nope, it can't."
10331 ;;
10332esac
10333set d_casti32
10334eval $setvar
10335$rm -f try try.*
10336
10337: check for ability to cast negative floats to unsigned
10338echo " "
10339echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10340$cat >try.c <<EOCP
10341#include <stdio.h>
d1daaddf
JH
10342#$i_stdlib I_STDLIB
10343#ifdef I_STDLIB
10344#include <stdlib.h>
10345#endif
b4eb6b3d
JH
10346#include <sys/types.h>
10347#include <signal.h>
10348$signal_t blech(s) int s; { exit(7); }
10349$signal_t blech_in_list(s) int s; { exit(4); }
10350unsigned long dummy_long(p) unsigned long p; { return p; }
10351unsigned int dummy_int(p) unsigned int p; { return p; }
10352unsigned short dummy_short(p) unsigned short p; { return p; }
10353int main()
10354{
10355 double f;
10356 unsigned long along;
10357 unsigned int aint;
10358 unsigned short ashort;
10359 int result = 0;
10360 char str[16];
10361
10362 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10363 a direct f = -123. assignment. gcc-2.8.0 reportedly
10364 optimized the whole file away
10365 */
10366 /* Store the number in a writable string for gcc to pass to
10367 sscanf under HP/UX.
10368 */
10369 sprintf(str, "-123");
10370 sscanf(str, "%lf", &f); /* f = -123.; */
10371
10372 signal(SIGFPE, blech);
10373 along = (unsigned long)f;
10374 aint = (unsigned int)f;
10375 ashort = (unsigned short)f;
10376 if (along != (unsigned long)-123)
10377 result |= 1;
10378 if (aint != (unsigned int)-123)
10379 result |= 1;
10380 if (ashort != (unsigned short)-123)
10381 result |= 1;
10382 sprintf(str, "1073741824.");
10383 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10384 f = f + f;
10385 along = 0;
10386 along = (unsigned long)f;
10387 if (along != 0x80000000)
10388 result |= 2;
10389 f -= 1.;
10390 along = 0;
10391 along = (unsigned long)f;
10392 if (along != 0x7fffffff)
10393 result |= 1;
10394 f += 2.;
10395 along = 0;
10396 along = (unsigned long)f;
10397 if (along != 0x80000001)
10398 result |= 2;
10399 if (result)
10400 exit(result);
10401 signal(SIGFPE, blech_in_list);
10402 sprintf(str, "123.");
10403 sscanf(str, "%lf", &f); /* f = 123.; */
10404 along = dummy_long((unsigned long)f);
10405 aint = dummy_int((unsigned int)f);
10406 ashort = dummy_short((unsigned short)f);
10407 if (along != (unsigned long)123)
10408 result |= 4;
10409 if (aint != (unsigned int)123)
10410 result |= 4;
10411 if (ashort != (unsigned short)123)
10412 result |= 4;
10413 exit(result);
10414
10415}
10416EOCP
10417set try
10418if eval $compile_ok; then
5440bc8e 10419 $run ./try
b4eb6b3d
JH
10420 castflags=$?
10421else
10422 echo "(I can't seem to compile the test program--assuming it can't)"
10423 castflags=7
10424fi
10425case "$castflags" in
104260) val="$define"
10427 echo "Yup, it can."
10428 ;;
10429*) val="$undef"
10430 echo "Nope, it can't."
10431 ;;
10432esac
10433set d_castneg
10434eval $setvar
10435$rm -f try.*
10436
10437: see if vprintf exists
10438echo " "
10439if set vprintf val -f d_vprintf; eval $csym; $val; then
10440 echo 'vprintf() found.' >&4
10441 val="$define"
55954f19 10442 $cat >try.c <<EOF
b4eb6b3d 10443#include <varargs.h>
55954f19
JH
10444#$i_stdlib I_STDLIB
10445#ifdef I_STDLIB
10446#include <stdlib.h>
10447#endif
b4eb6b3d
JH
10448
10449int main() { xxx("foo"); }
10450
10451xxx(va_alist)
10452va_dcl
10453{
10454 va_list args;
10455 char buf[10];
10456
10457 va_start(args);
10458 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10459}
10460EOF
5440bc8e
JH
10461 set try
10462 if eval $compile && $run ./try; then
b4eb6b3d
JH
10463 echo "Your vsprintf() returns (int)." >&4
10464 val2="$undef"
10465 else
10466 echo "Your vsprintf() returns (char*)." >&4
10467 val2="$define"
10468 fi
10469else
10470 echo 'vprintf() NOT found.' >&4
10471 val="$undef"
10472 val2="$undef"
10473fi
5440bc8e 10474$rm -f try try.*
b4eb6b3d
JH
10475set d_vprintf
10476eval $setvar
10477val=$val2
10478set d_charvspr
10479eval $setvar
10480
10481: see if chown exists
10482set chown d_chown
10483eval $inlibc
10484
10485: see if chroot exists
10486set chroot d_chroot
10487eval $inlibc
10488
10489: see if chsize exists
10490set chsize d_chsize
10491eval $inlibc
10492
758a5d79
JH
10493: see if class exists
10494set class d_class
10495eval $inlibc
10496
4e0554ec
JH
10497hasstruct='varname=$1; struct=$2; shift; shift;
10498while $test $# -ge 2; do
10499 case "$1" in
10500 $define) echo "#include <$2>";;
10501 esac ;
10502 shift 2;
10503done > try.c;
10504echo "int main () { struct $struct foo; }" >> try.c;
10505set try;
10506if eval $compile; then
10507 val="$define";
10508else
10509 val="$undef";
10510fi;
10511set $varname;
10512eval $setvar;
10513$rm -f try.c try.o'
10514
4e0554ec
JH
10515socketlib=''
10516sockethdr=''
10517: see whether socket exists
10518echo " "
10519$echo $n "Hmm... $c" >&4
10520if set socket val -f d_socket; eval $csym; $val; then
10521 echo "Looks like you have Berkeley networking support." >&4
10522 d_socket="$define"
10523 if set setsockopt val -f; eval $csym; $val; then
10524 d_oldsock="$undef"
10525 else
10526 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10527 d_oldsock="$define"
10528 fi
10529else
10530 if $contains socklib libc.list >/dev/null 2>&1; then
10531 echo "Looks like you have Berkeley networking support." >&4
10532 d_socket="$define"
10533 : we will have to assume that it supports the 4.2 BSD interface
10534 d_oldsock="$undef"
10535 else
10536 echo "You don't have Berkeley networking in libc$_a..." >&4
10537 if test "X$d_socket" = "X$define"; then
10538 echo "...but you seem to believe that you have sockets." >&4
10539 else
10540 for net in net socket
10541 do
10542 if test -f /usr/lib/lib$net$_a; then
10543 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10544 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10545 if $contains socket libc.list >/dev/null 2>&1; then
10546 d_socket="$define"
10547 socketlib="-l$net"
10548 case "$net" in
10549 net)
10550 echo "...but the Wollongong group seems to have hacked it in." >&4
10551 sockethdr="-I/usr/netinclude"
10552 ;;
10553 esac
3c728e00 10554 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10555 if $contains setsockopt libc.list >/dev/null 2>&1; then
10556 d_oldsock="$undef"
10557 else
10558 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10559 d_oldsock="$define"
10560 fi
10561 break
10562 fi
10563 fi
10564 done
10565 if test "X$d_socket" != "X$define"; then
10566 echo "or anywhere else I see." >&4
10567 d_socket="$undef"
10568 d_oldsock="$undef"
10569 fi
10570 fi
10571 fi
10572fi
10573
10574: see if socketpair exists
10575set socketpair d_sockpair
10576eval $inlibc
10577
10578
10579echo " "
3c728e00 10580echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10581for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10582 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10583 $cat >try.c <<EOF
10584#include <sys/types.h>
10585#include <sys/socket.h>
10586int main() {
10587 int i = $ENUM;
10588}
10589EOF
10590 val="$undef"
10591 set try; if eval $compile; then
10592 val="$define"
10593 fi
10594 set d_${enum}; eval $setvar
10595 $rm -f try.c try
10596done
10597
10598: see if this is a sys/uio.h system
10599set sys/uio.h i_sysuio
10600eval $inhdr
10601
10602
10603echo " "
10604echo "Checking to see if your system supports struct cmsghdr..." >&4
10605set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10606eval $hasstruct
10607case "$d_cmsghdr_s" in
10608"$define") echo "Yes, it does." ;;
10609*) echo "No, it doesn't." ;;
10610esac
10611
10612
b4eb6b3d
JH
10613: check for const keyword
10614echo " "
10615echo 'Checking to see if your C compiler knows about "const"...' >&4
10616$cat >const.c <<'EOCP'
10617typedef struct spug { int drokk; } spug;
76f47787 10618int main()
b4eb6b3d
JH
10619{
10620 const char *foo;
10621 const spug y;
10622}
10623EOCP
10624if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10625 val="$define"
10626 echo "Yup, it does."
10627else
10628 val="$undef"
10629 echo "Nope, it doesn't."
10630fi
10631set d_const
10632eval $setvar
10633
89ce900e
JH
10634: see if copysignl exists
10635set copysignl d_copysignl
10636eval $inlibc
10637
b4eb6b3d
JH
10638: see if crypt exists
10639echo " "
a5a94ea5
JH
10640set crypt d_crypt
10641eval $inlibc
10642case "$d_crypt" in
10643$define) cryptlib='' ;;
10644*) if set crypt val -f d_crypt; eval $csym; $val; then
10645 echo 'crypt() found.' >&4
b4eb6b3d 10646 val="$define"
a5a94ea5
JH
10647 cryptlib=''
10648 else
10649 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10650 if $test -z "$cryptlib"; then
10651 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10652 else
10653 cryptlib=-lcrypt
10654 fi
10655 if $test -z "$cryptlib"; then
10656 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10657 else
10658 cryptlib=-lcrypt
10659 fi
10660 if $test -z "$cryptlib"; then
10661 cryptlib=`./loc libcrypt$_a "" $libpth`
10662 else
10663 cryptlib=-lcrypt
10664 fi
10665 if $test -z "$cryptlib"; then
10666 echo 'crypt() NOT found.' >&4
10667 val="$undef"
10668 else
10669 val="$define"
10670 fi
b4eb6b3d 10671 fi
a5a94ea5
JH
10672 set d_crypt
10673 eval $setvar
10674 ;;
10675esac
b4eb6b3d 10676
10bc17b6
JH
10677: see if this is a crypt.h system
10678set crypt.h i_crypt
10679eval $inhdr
10680
10681: see if crypt_r exists
10682set crypt_r d_crypt_r
10683eval $inlibc
10684case "$d_crypt_r" in
10685"$define")
10686 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10687 case "$d_crypt_r_proto:$usethreads" in
10688 ":define") d_crypt_r_proto=define
a48ec845
JH
10689 set d_crypt_r_proto crypt_r $hdrs
10690 eval $hasproto ;;
10691 *) ;;
10692 esac
10693 case "$d_crypt_r_proto" in
10694 define)
10bc17b6
JH
10695 case "$crypt_r_proto" in
10696 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10697 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10698 esac
10699 case "$crypt_r_proto" in
b430fd04
JH
10700 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10701 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10702 esac
10703 case "$crypt_r_proto" in
90e831dc 10704 ''|0) d_crypt_r=undef
10bc17b6 10705 crypt_r_proto=0
a48ec845 10706 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10707 * ) case "$crypt_r_proto" in
10708 REENTRANT_PROTO*) ;;
10709 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10710 esac
10711 echo "Prototype: $try" ;;
10712 esac
10713 ;;
c18e646a
JH
10714 *) case "$usethreads" in
10715 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10716 esac
90e831dc
SB
10717 d_crypt_r=undef
10718 crypt_r_proto=0
c18e646a 10719 ;;
a48ec845
JH
10720 esac
10721 ;;
10bc17b6
JH
10722*) crypt_r_proto=0
10723 ;;
10724esac
10725
b4eb6b3d
JH
10726: get csh whereabouts
10727case "$csh" in
10728'csh') val="$undef" ;;
10729*) val="$define" ;;
10730esac
10731set d_csh
10732eval $setvar
10733: Respect a hint or command line value for full_csh.
10734case "$full_csh" in
10735'') full_csh=$csh ;;
10736esac
10737
10bc17b6
JH
10738: see if ctermid_r exists
10739set ctermid_r d_ctermid_r
10740eval $inlibc
10741case "$d_ctermid_r" in
10742"$define")
31ee0cb7 10743 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10744 case "$d_ctermid_r_proto:$usethreads" in
10745 ":define") d_ctermid_r_proto=define
a48ec845
JH
10746 set d_ctermid_r_proto ctermid_r $hdrs
10747 eval $hasproto ;;
10748 *) ;;
10749 esac
10750 case "$d_ctermid_r_proto" in
10751 define)
10bc17b6
JH
10752 case "$ctermid_r_proto" in
10753 ''|0) try='char* ctermid_r(char*);'
10754 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10755 esac
10756 case "$ctermid_r_proto" in
90e831dc 10757 ''|0) d_ctermid_r=undef
10bc17b6 10758 ctermid_r_proto=0
a48ec845 10759 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10760 * ) case "$ctermid_r_proto" in
10761 REENTRANT_PROTO*) ;;
10762 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10763 esac
10764 echo "Prototype: $try" ;;
10765 esac
10766 ;;
c18e646a
JH
10767 *) case "$usethreads" in
10768 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10769 esac
90e831dc
SB
10770 d_ctermid_r=undef
10771 ctermid_r_proto=0
c18e646a 10772 ;;
a48ec845
JH
10773 esac
10774 ;;
10bc17b6
JH
10775*) ctermid_r_proto=0
10776 ;;
10777esac
10778
10779: see if ctime_r exists
10780set ctime_r d_ctime_r
10781eval $inlibc
10782case "$d_ctime_r" in
10783"$define")
d63eadf0 10784 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10785 case "$d_ctime_r_proto:$usethreads" in
10786 ":define") d_ctime_r_proto=define
a48ec845
JH
10787 set d_ctime_r_proto ctime_r $hdrs
10788 eval $hasproto ;;
10789 *) ;;
10790 esac
10791 case "$d_ctime_r_proto" in
10792 define)
10bc17b6
JH
10793 case "$ctime_r_proto" in
10794 ''|0) try='char* ctime_r(const time_t*, char*);'
10795 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10796 esac
10797 case "$ctime_r_proto" in
10798 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10799 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10800 esac
10801 case "$ctime_r_proto" in
10802 ''|0) try='int ctime_r(const time_t*, char*);'
10803 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10804 esac
10805 case "$ctime_r_proto" in
10806 ''|0) try='int ctime_r(const time_t*, char*, int);'
10807 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10808 esac
10809 case "$ctime_r_proto" in
90e831dc 10810 ''|0) d_ctime_r=undef
10bc17b6 10811 ctime_r_proto=0
a48ec845 10812 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10813 * ) case "$ctime_r_proto" in
10814 REENTRANT_PROTO*) ;;
10815 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10816 esac
10817 echo "Prototype: $try" ;;
10818 esac
10819 ;;
c18e646a
JH
10820 *) case "$usethreads" in
10821 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10822 esac
90e831dc
SB
10823 d_ctime_r=undef
10824 ctime_r_proto=0
c18e646a 10825 ;;
a48ec845
JH
10826 esac
10827 ;;
10bc17b6
JH
10828*) ctime_r_proto=0
10829 ;;
10830esac
10831
b4eb6b3d
JH
10832: see if cuserid exists
10833set cuserid d_cuserid
10834eval $inlibc
10835
10836: see if this is a limits.h system
10837set limits.h i_limits
10838eval $inhdr
10839
10840: see if this is a float.h system
10841set float.h i_float
10842eval $inhdr
10843
10844: See if number of significant digits in a double precision number is known
10845echo " "
10846$cat >dbl_dig.c <<EOM
10847#$i_limits I_LIMITS
10848#$i_float I_FLOAT
10849#ifdef I_LIMITS
10850#include <limits.h>
10851#endif
10852#ifdef I_FLOAT
10853#include <float.h>
10854#endif
10855#ifdef DBL_DIG
10856printf("Contains DBL_DIG");
10857#endif
10858EOM
10859$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10860if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10861 echo "DBL_DIG found." >&4
10862 val="$define"
10863else
10864 echo "DBL_DIG NOT found." >&4
10865 val="$undef"
10866fi
10867$rm -f dbl_dig.?
10868set d_dbl_dig
10869eval $setvar
10870
2ef53570
JH
10871: see if dbm.h is available
10872: see if dbmclose exists
10873set dbmclose d_dbmclose
10874eval $inlibc
10875
10876case "$d_dbmclose" in
10877$define)
10878 set dbm.h i_dbm
10879 eval $inhdr
10880 case "$i_dbm" in
10881 $define)
10882 val="$undef"
10883 set i_rpcsvcdbm
10884 eval $setvar
10885 ;;
10886 *) set rpcsvc/dbm.h i_rpcsvcdbm
10887 eval $inhdr
10888 ;;
10889 esac
10890 ;;
10891*) echo "We won't be including <dbm.h>"
10892 val="$undef"
10893 set i_dbm
10894 eval $setvar
10895 val="$undef"
10896 set i_rpcsvcdbm
10897 eval $setvar
10898 ;;
10899esac
10900
10901: see if prototype for dbminit is available
10902echo " "
10903set d_dbminitproto dbminit $i_dbm dbm.h
10904eval $hasproto
10905
b4eb6b3d
JH
10906: see if difftime exists
10907set difftime d_difftime
10908eval $inlibc
10909
10910: see if this is a dirent system
10911echo " "
10912if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10913 val="$define"
10914 echo "<dirent.h> found." >&4
10915else
10916 val="$undef"
10917 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10918 echo "<sys/dir.h> found." >&4
10919 echo " "
10920 else
10921 xinc=`./findhdr sys/ndir.h`
10922 fi
10923 echo "<dirent.h> NOT found." >&4
10924fi
10925set i_dirent
10926eval $setvar
10927
10928: Look for type of directory structure.
10929echo " "
10930$cppstdin $cppflags $cppminus < "$xinc" > try.c
10931
10932case "$direntrytype" in
10933''|' ')
10934 case "$i_dirent" in
10935 $define) guess1='struct dirent' ;;
10936 *) guess1='struct direct' ;;
10937 esac
10938 ;;
10939*) guess1="$direntrytype"
10940 ;;
10941esac
10942
10943case "$guess1" in
10944'struct dirent') guess2='struct direct' ;;
10945*) guess2='struct dirent' ;;
10946esac
10947
10948if $contains "$guess1" try.c >/dev/null 2>&1; then
10949 direntrytype="$guess1"
10950 echo "Your directory entries are $direntrytype." >&4
10951elif $contains "$guess2" try.c >/dev/null 2>&1; then
10952 direntrytype="$guess2"
10953 echo "Your directory entries seem to be $direntrytype." >&4
10954else
10955 echo "I don't recognize your system's directory entries." >&4
10956 rp="What type is used for directory entries on this system?"
10957 dflt="$guess1"
10958 . ./myread
10959 direntrytype="$ans"
10960fi
10961$rm -f try.c
10962
10963
10964: see if the directory entry stores field length
10965echo " "
10966$cppstdin $cppflags $cppminus < "$xinc" > try.c
10967if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10968 echo "Good, your directory entry keeps length information in d_namlen." >&4
10969 val="$define"
10970else
10971 echo "Your directory entry does not know about the d_namlen field." >&4
10972 val="$undef"
10973fi
10974set d_dirnamlen
10975eval $setvar
10976$rm -f try.c
10977
ae0e3d3b
JH
10978: see if this is an sysdir system
10979set sys/dir.h i_sysdir
10980eval $inhdr
10981
10982: see if this is an sysndir system
10983set sys/ndir.h i_sysndir
10984eval $inhdr
10985
10986: Look for dirfd
10987echo " "
10988$cat >dirfd.c <<EOM
10989#include <stdio.h>
55954f19
JH
10990#$i_stdlib I_STDLIB
10991#ifdef I_STDLIB
10992#include <stdlib.h>
10993#endif
ae0e3d3b
JH
10994#$i_dirent I_DIRENT /**/
10995#$i_sysdir I_SYS_DIR /**/
10996#$i_sysndir I_SYS_NDIR /**/
10997#$i_systypes I_SYS_TYPES /**/
10998#if defined(I_SYS_TYPES)
10999#include <sys/types.h>
11000#endif
11001#if defined(I_DIRENT)
11002#include <dirent.h>
11003#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11004#include <sys/dir.h>
11005#endif
11006#else
11007#ifdef I_SYS_NDIR
11008#include <sys/ndir.h>
11009#else
11010#ifdef I_SYS_DIR
11011#ifdef hp9000s500
11012#include <ndir.h> /* may be wrong in the future */
11013#else
11014#include <sys/dir.h>
11015#endif
11016#endif
11017#endif
11018#endif
11019int main() {
11020 DIR *dirp = opendir(".");
11021 if (dirfd(dirp) >= 0)
11022 exit(0);
11023 else
11024 exit(1);
11025}
11026EOM
11027set dirfd
11028if eval $compile; then
11029 val="$define"
11030fi
11031case "$val" in
11032$define) echo "dirfd() found." >&4 ;;
11033*) echo "dirfd() NOT found." >&4 ;;
11034esac
11035set d_dirfd
11036eval $setvar
11037$rm -f dirfd*
11038
b4eb6b3d
JH
11039: see if dlerror exists
11040xxx_runnm="$runnm"
11041runnm=false
11042set dlerror d_dlerror
11043eval $inlibc
11044runnm="$xxx_runnm"
11045
11046: see if dlfcn is available
11047set dlfcn.h i_dlfcn
11048eval $inhdr
11049
11050case "$usedl" in
11051$define|y|true)
11052 $cat << EOM
11053
11054On a few systems, the dynamically loaded modules that perl generates and uses
11055will need a different extension than shared libs. The default will probably
11056be appropriate.
11057
11058EOM
11059 case "$dlext" in
11060 '') dflt="$so" ;;
11061 *) dflt="$dlext" ;;
11062 esac
11063 rp='What is the extension of dynamically loaded modules'
11064 . ./myread
11065 dlext="$ans"
11066 ;;
11067*)
11068 dlext="none"
11069 ;;
11070esac
11071
11072: Check if dlsym need a leading underscore
11073echo " "
11074val="$undef"
11075
11076case "$dlsrc" in
11077dl_dlopen.xs)
11078 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11079 $cat >dyna.c <<'EOM'
11080fred () { }
11081EOM
11082
11083$cat >fred.c<<EOM
11084
11085#include <stdio.h>
55954f19
JH
11086#$i_stdlib I_STDLIB
11087#ifdef I_STDLIB
11088#include <stdlib.h>
11089#endif
b4eb6b3d
JH
11090#$i_dlfcn I_DLFCN
11091#ifdef I_DLFCN
5440bc8e 11092#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11093#else
11094#include <sys/types.h>
11095#include <nlist.h>
11096#include <link.h>
11097#endif
11098
11099extern int fred() ;
11100
11101int main()
11102{
11103 void * handle ;
11104 void * symbol ;
11105#ifndef RTLD_LAZY
11106 int mode = 1 ;
11107#else
11108 int mode = RTLD_LAZY ;
11109#endif
11110 handle = dlopen("./dyna.$dlext", mode) ;
11111 if (handle == NULL) {
11112 printf ("1\n") ;
11113 fflush (stdout) ;
11114 exit(0);
11115 }
11116 symbol = dlsym(handle, "fred") ;
11117 if (symbol == NULL) {
11118 /* try putting a leading underscore */
11119 symbol = dlsym(handle, "_fred") ;
11120 if (symbol == NULL) {
11121 printf ("2\n") ;
11122 fflush (stdout) ;
11123 exit(0);
11124 }
11125 printf ("3\n") ;
11126 }
11127 else
11128 printf ("4\n") ;
11129 fflush (stdout) ;
11130 exit(0);
11131}
11132EOM
11133 : Call the object file tmp-dyna.o in case dlext=o.
11134 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11135 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11136 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11137 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11138 xxx=`$run ./fred`
b4eb6b3d
JH
11139 case $xxx in
11140 1) echo "Test program failed using dlopen." >&4
11141 echo "Perhaps you should not use dynamic loading." >&4;;
11142 2) echo "Test program failed using dlsym." >&4
11143 echo "Perhaps you should not use dynamic loading." >&4;;
11144 3) echo "dlsym needs a leading underscore" >&4
11145 val="$define" ;;
11146 4) echo "dlsym doesn't need a leading underscore." >&4;;
11147 esac
11148 else
11149 echo "I can't compile and run the test program." >&4
11150 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11151 fi
11152 ;;
11153esac
11154
3c728e00 11155$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11156
11157set d_dlsymun
11158eval $setvar
11159
10bc17b6
JH
11160: see if drand48_r exists
11161set drand48_r d_drand48_r
11162eval $inlibc
11163case "$d_drand48_r" in
11164"$define")
11165 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11166 case "$d_drand48_r_proto:$usethreads" in
11167 ":define") d_drand48_r_proto=define
a48ec845
JH
11168 set d_drand48_r_proto drand48_r $hdrs
11169 eval $hasproto ;;
11170 *) ;;
11171 esac
11172 case "$d_drand48_r_proto" in
11173 define)
10bc17b6
JH
11174 case "$drand48_r_proto" in
11175 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11176 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11177 esac
11178 case "$drand48_r_proto" in
90e831dc 11179 ''|0) d_drand48_r=undef
10bc17b6 11180 drand48_r_proto=0
a48ec845 11181 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11182 * ) case "$drand48_r_proto" in
11183 REENTRANT_PROTO*) ;;
11184 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11185 esac
11186 echo "Prototype: $try" ;;
11187 esac
11188 ;;
c18e646a
JH
11189 *) case "$usethreads" in
11190 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11191 esac
90e831dc
SB
11192 d_drand48_r=undef
11193 drand48_r_proto=0
c18e646a 11194 ;;
a48ec845
JH
11195 esac
11196 ;;
10bc17b6
JH
11197*) drand48_r_proto=0
11198 ;;
11199esac
11200
11201: see if prototype for drand48 is available
11202echo " "
11203set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11204eval $hasproto
11205
b4eb6b3d
JH
11206: see if dup2 exists
11207set dup2 d_dup2
11208eval $inlibc
11209
11210: see if eaccess exists
11211set eaccess d_eaccess
11212eval $inlibc
11213
11214: see if endgrent exists
11215set endgrent d_endgrent
11216eval $inlibc
11217
10bc17b6
JH
11218: see if this is an grp system
11219set grp.h i_grp
11220eval $inhdr
11221
11222case "$i_grp" in
11223$define)
11224 xxx=`./findhdr grp.h`
11225 $cppstdin $cppflags $cppminus < $xxx >$$.h
11226
11227 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11228 val="$define"
11229 else
11230 val="$undef"
11231 fi
11232 set d_grpasswd
11233 eval $setvar
11234
11235 $rm -f $$.h
11236 ;;
11237*)
11238 val="$undef";
11239 set d_grpasswd; eval $setvar
11240 ;;
11241esac
11242
11243: see if endgrent_r exists
11244set endgrent_r d_endgrent_r
11245eval $inlibc
11246case "$d_endgrent_r" in
11247"$define")
11248 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11249 case "$d_endgrent_r_proto:$usethreads" in
11250 ":define") d_endgrent_r_proto=define
a48ec845
JH
11251 set d_endgrent_r_proto endgrent_r $hdrs
11252 eval $hasproto ;;
11253 *) ;;
11254 esac
11255 case "$d_endgrent_r_proto" in
11256 define)
10bc17b6
JH
11257 case "$endgrent_r_proto" in
11258 ''|0) try='int endgrent_r(FILE**);'
11259 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11260 esac
11261 case "$endgrent_r_proto" in
11262 ''|0) try='void endgrent_r(FILE**);'
11263 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11264 esac
11265 case "$endgrent_r_proto" in
90e831dc 11266 ''|0) d_endgrent_r=undef
10bc17b6 11267 endgrent_r_proto=0
a48ec845 11268 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11269 * ) case "$endgrent_r_proto" in
11270 REENTRANT_PROTO*) ;;
11271 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11272 esac
11273 echo "Prototype: $try" ;;
11274 esac
11275 ;;
c18e646a
JH
11276 *) case "$usethreads" in
11277 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11278 esac
90e831dc
SB
11279 d_endgrent_r=undef
11280 endgrent_r_proto=0
c18e646a 11281 ;;
a48ec845
JH
11282 esac
11283 ;;
10bc17b6
JH
11284*) endgrent_r_proto=0
11285 ;;
11286esac
11287
b4eb6b3d
JH
11288: see if endhostent exists
11289set endhostent d_endhent
11290eval $inlibc
11291
10bc17b6
JH
11292: see if this is a netdb.h system
11293set netdb.h i_netdb
11294eval $inhdr
11295
11296: see if endhostent_r exists
11297set endhostent_r d_endhostent_r
11298eval $inlibc
11299case "$d_endhostent_r" in
11300"$define")
11301 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11302 case "$d_endhostent_r_proto:$usethreads" in
11303 ":define") d_endhostent_r_proto=define
a48ec845
JH
11304 set d_endhostent_r_proto endhostent_r $hdrs
11305 eval $hasproto ;;
11306 *) ;;
11307 esac
11308 case "$d_endhostent_r_proto" in
11309 define)
10bc17b6
JH
11310 case "$endhostent_r_proto" in
11311 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11312 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11313 esac
11314 case "$endhostent_r_proto" in
11315 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11316 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11317 esac
11318 case "$endhostent_r_proto" in
90e831dc 11319 ''|0) d_endhostent_r=undef
10bc17b6 11320 endhostent_r_proto=0
a48ec845 11321 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11322 * ) case "$endhostent_r_proto" in
11323 REENTRANT_PROTO*) ;;
11324 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11325 esac
11326 echo "Prototype: $try" ;;
11327 esac
11328 ;;
c18e646a
JH
11329 *) case "$usethreads" in
11330 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11331 esac
90e831dc
SB
11332 d_endhostent_r=undef
11333 endhostent_r_proto=0
c18e646a 11334 ;;
a48ec845
JH
11335 esac
11336 ;;
10bc17b6
JH
11337*) endhostent_r_proto=0
11338 ;;
11339esac
11340
b4eb6b3d
JH
11341: see if endnetent exists
11342set endnetent d_endnent
11343eval $inlibc
11344
10bc17b6
JH
11345: see if endnetent_r exists
11346set endnetent_r d_endnetent_r
11347eval $inlibc
11348case "$d_endnetent_r" in
11349"$define")
11350 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11351 case "$d_endnetent_r_proto:$usethreads" in
11352 ":define") d_endnetent_r_proto=define
a48ec845
JH
11353 set d_endnetent_r_proto endnetent_r $hdrs
11354 eval $hasproto ;;
11355 *) ;;
11356 esac
11357 case "$d_endnetent_r_proto" in
11358 define)
10bc17b6
JH
11359 case "$endnetent_r_proto" in
11360 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11361 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11362 esac
11363 case "$endnetent_r_proto" in
11364 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11365 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11366 esac
11367 case "$endnetent_r_proto" in
90e831dc 11368 ''|0) d_endnetent_r=undef
10bc17b6 11369 endnetent_r_proto=0
a48ec845 11370 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11371 * ) case "$endnetent_r_proto" in
11372 REENTRANT_PROTO*) ;;
11373 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11374 esac
11375 echo "Prototype: $try" ;;
11376 esac
11377 ;;
c18e646a
JH
11378 *) case "$usethreads" in
11379 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11380 esac
90e831dc
SB
11381 d_endnetent_r=undef
11382 endnetent_r_proto=0
c18e646a 11383 ;;
a48ec845
JH
11384 esac
11385 ;;
10bc17b6
JH
11386*) endnetent_r_proto=0
11387 ;;
11388esac
11389
b4eb6b3d
JH
11390: see if endprotoent exists
11391set endprotoent d_endpent
11392eval $inlibc
11393
10bc17b6
JH
11394: see if endprotoent_r exists
11395set endprotoent_r d_endprotoent_r
11396eval $inlibc
11397case "$d_endprotoent_r" in
11398"$define")
11399 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11400 case "$d_endprotoent_r_proto:$usethreads" in
11401 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11402 set d_endprotoent_r_proto endprotoent_r $hdrs
11403 eval $hasproto ;;
11404 *) ;;
11405 esac
11406 case "$d_endprotoent_r_proto" in
11407 define)
10bc17b6
JH
11408 case "$endprotoent_r_proto" in
11409 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11410 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11411 esac
11412 case "$endprotoent_r_proto" in
11413 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11414 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11415 esac
11416 case "$endprotoent_r_proto" in
90e831dc 11417 ''|0) d_endprotoent_r=undef
10bc17b6 11418 endprotoent_r_proto=0
a48ec845 11419 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11420 * ) case "$endprotoent_r_proto" in
11421 REENTRANT_PROTO*) ;;
11422 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11423 esac
11424 echo "Prototype: $try" ;;
11425 esac
11426 ;;
c18e646a
JH
11427 *) case "$usethreads" in
11428 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11429 esac
90e831dc
SB
11430 d_endprotoent_r=undef
11431 endprotoent_r_proto=0
c18e646a 11432 ;;
a48ec845
JH
11433 esac
11434 ;;
10bc17b6
JH
11435*) endprotoent_r_proto=0
11436 ;;
11437esac
11438
b4eb6b3d
JH
11439: see if endpwent exists
11440set endpwent d_endpwent
11441eval $inlibc
11442
10bc17b6
JH
11443: see if this is a pwd.h system
11444set pwd.h i_pwd
11445eval $inhdr
11446
11447case "$i_pwd" in
11448$define)
11449 xxx=`./findhdr pwd.h`
11450 $cppstdin $cppflags $cppminus < $xxx >$$.h
11451
11452 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11453 val="$define"
11454 else
11455 val="$undef"
11456 fi
11457 set d_pwquota
11458 eval $setvar
11459
11460 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11461 val="$define"
11462 else
11463 val="$undef"
11464 fi
11465 set d_pwage
11466 eval $setvar
11467
11468 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11469 val="$define"
11470 else
11471 val="$undef"
11472 fi
11473 set d_pwchange
11474 eval $setvar
11475
11476 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11477 val="$define"
11478 else
11479 val="$undef"
11480 fi
11481 set d_pwclass
11482 eval $setvar
11483
11484 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11485 val="$define"
11486 else
11487 val="$undef"
11488 fi
11489 set d_pwexpire
11490 eval $setvar
11491
11492 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11493 val="$define"
11494 else
11495 val="$undef"
11496 fi
11497 set d_pwcomment
11498 eval $setvar
11499
11500 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11501 val="$define"
11502 else
11503 val="$undef"
11504 fi
11505 set d_pwgecos
11506 eval $setvar
11507
11508 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11509 val="$define"
11510 else
11511 val="$undef"
11512 fi
11513 set d_pwpasswd
11514 eval $setvar
11515
11516 $rm -f $$.h
11517 ;;
11518*)
11519 val="$undef";
11520 set d_pwquota; eval $setvar
11521 set d_pwage; eval $setvar
11522 set d_pwchange; eval $setvar
11523 set d_pwclass; eval $setvar
11524 set d_pwexpire; eval $setvar
11525 set d_pwcomment; eval $setvar
11526 set d_pwgecos; eval $setvar
11527 set d_pwpasswd; eval $setvar
11528 ;;
11529esac
11530
11531: see if endpwent_r exists
11532set endpwent_r d_endpwent_r
11533eval $inlibc
11534case "$d_endpwent_r" in
11535"$define")
11536 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11537 case "$d_endpwent_r_proto:$usethreads" in
11538 ":define") d_endpwent_r_proto=define
a48ec845
JH
11539 set d_endpwent_r_proto endpwent_r $hdrs
11540 eval $hasproto ;;
11541 *) ;;
11542 esac
11543 case "$d_endpwent_r_proto" in
11544 define)
10bc17b6
JH
11545 case "$endpwent_r_proto" in
11546 ''|0) try='int endpwent_r(FILE**);'
11547 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11548 esac
11549 case "$endpwent_r_proto" in
11550 ''|0) try='void endpwent_r(FILE**);'
11551 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11552 esac
11553 case "$endpwent_r_proto" in
90e831dc 11554 ''|0) d_endpwent_r=undef
10bc17b6 11555 endpwent_r_proto=0
a48ec845 11556 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11557 * ) case "$endpwent_r_proto" in
11558 REENTRANT_PROTO*) ;;
11559 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11560 esac
11561 echo "Prototype: $try" ;;
11562 esac
11563 ;;
c18e646a
JH
11564 *) case "$usethreads" in
11565 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11566 esac
90e831dc
SB
11567 d_endpwent_r=undef
11568 endpwent_r_proto=0
c18e646a 11569 ;;
a48ec845
JH
11570 esac
11571 ;;
10bc17b6
JH
11572*) endpwent_r_proto=0
11573 ;;
11574esac
11575
b4eb6b3d
JH
11576: see if endservent exists
11577set endservent d_endsent
11578eval $inlibc
11579
10bc17b6
JH
11580: see if endservent_r exists
11581set endservent_r d_endservent_r
11582eval $inlibc
11583case "$d_endservent_r" in
11584"$define")
11585 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11586 case "$d_endservent_r_proto:$usethreads" in
11587 ":define") d_endservent_r_proto=define
a48ec845
JH
11588 set d_endservent_r_proto endservent_r $hdrs
11589 eval $hasproto ;;
11590 *) ;;
11591 esac
11592 case "$d_endservent_r_proto" in
11593 define)
10bc17b6
JH
11594 case "$endservent_r_proto" in
11595 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11596 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11597 esac
11598 case "$endservent_r_proto" in
11599 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11600 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11601 esac
11602 case "$endservent_r_proto" in
90e831dc 11603 ''|0) d_endservent_r=undef
10bc17b6 11604 endservent_r_proto=0
a48ec845 11605 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11606 * ) case "$endservent_r_proto" in
11607 REENTRANT_PROTO*) ;;
11608 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11609 esac
11610 echo "Prototype: $try" ;;
11611 esac
11612 ;;
c18e646a
JH
11613 *) case "$usethreads" in
11614 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11615 esac
90e831dc
SB
11616 d_endservent_r=undef
11617 endservent_r_proto=0
c18e646a 11618 ;;
a48ec845
JH
11619 esac
11620 ;;
10bc17b6
JH
11621*) endservent_r_proto=0
11622 ;;
11623esac
11624
b4eb6b3d
JH
11625: Locate the flags for 'open()'
11626echo " "
55954f19 11627$cat >try.c <<EOCP
b4eb6b3d
JH
11628#include <sys/types.h>
11629#ifdef I_FCNTL
11630#include <fcntl.h>
11631#endif
11632#ifdef I_SYS_FILE
11633#include <sys/file.h>
11634#endif
55954f19
JH
11635#$i_stdlib I_STDLIB
11636#ifdef I_STDLIB
11637#include <stdlib.h>
11638#endif
b4eb6b3d
JH
11639int main() {
11640 if(O_RDONLY);
11641#ifdef O_TRUNC
11642 exit(0);
11643#else
11644 exit(1);
11645#endif
11646}
11647EOCP
11648: check sys/file.h first to get FREAD on Sun
11649if $test `./findhdr sys/file.h` && \
5440bc8e 11650 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11651 h_sysfile=true;
11652 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11653 if $run ./try; then
b4eb6b3d
JH
11654 echo "and you have the 3 argument form of open()." >&4
11655 val="$define"
11656 else
11657 echo "but not the 3 argument form of open(). Oh, well." >&4
11658 val="$undef"
11659 fi
11660elif $test `./findhdr fcntl.h` && \
5440bc8e 11661 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11662 h_fcntl=true;
11663 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11664 if $run ./try; then
b4eb6b3d
JH
11665 echo "and you have the 3 argument form of open()." >&4
11666 val="$define"
11667 else
11668 echo "but not the 3 argument form of open(). Oh, well." >&4
11669 val="$undef"
11670 fi
11671else
11672 val="$undef"
11673 echo "I can't find the O_* constant definitions! You got problems." >&4
11674fi
11675set d_open3
11676eval $setvar
5440bc8e 11677$rm -f try try.*
b4eb6b3d
JH
11678
11679: see which of string.h or strings.h is needed
11680echo " "
11681strings=`./findhdr string.h`
11682if $test "$strings" && $test -r "$strings"; then
11683 echo "Using <string.h> instead of <strings.h>." >&4
11684 val="$define"
11685else
11686 val="$undef"
11687 strings=`./findhdr strings.h`
11688 if $test "$strings" && $test -r "$strings"; then
11689 echo "Using <strings.h> instead of <string.h>." >&4
11690 else
11691 echo "No string header found -- You'll surely have problems." >&4
11692 fi
11693fi
11694set i_string
11695eval $setvar
11696case "$i_string" in
11697"$undef") strings=`./findhdr strings.h`;;
11698*) strings=`./findhdr string.h`;;
11699esac
11700
3c728e00
JH
11701: see if this is a sys/file.h system
11702val=''
11703set sys/file.h val
11704eval $inhdr
11705
11706: do we need to include sys/file.h ?
11707case "$val" in
11708"$define")
11709 echo " "
11710 if $h_sysfile; then
11711 val="$define"
11712 echo "We'll be including <sys/file.h>." >&4
11713 else
11714 val="$undef"
11715 echo "We won't be including <sys/file.h>." >&4
11716 fi
11717 ;;
11718*)
11719 h_sysfile=false
11720 ;;
11721esac
11722set i_sysfile
11723eval $setvar
11724
11725: see if fcntl.h is there
11726val=''
11727set fcntl.h val
11728eval $inhdr
11729
11730: see if we can include fcntl.h
11731case "$val" in
11732"$define")
11733 echo " "
11734 if $h_fcntl; then
11735 val="$define"
11736 echo "We'll be including <fcntl.h>." >&4
11737 else
11738 val="$undef"
11739 if $h_sysfile; then
11740 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11741 else
11742 echo "We won't be including <fcntl.h>." >&4
11743 fi
11744 fi
11745 ;;
11746*)
11747 h_fcntl=false
11748 val="$undef"
11749 ;;
11750esac
11751set i_fcntl
11752eval $setvar
11753
b4eb6b3d
JH
11754: check for non-blocking I/O stuff
11755case "$h_sysfile" in
a0acbdc3
JH
11756true) echo "#include <sys/file.h>" > head.c;;
11757*)
11758 case "$h_fcntl" in
11759 true) echo "#include <fcntl.h>" > head.c;;
11760 *) echo "#include <sys/fcntl.h>" > head.c;;
11761 esac
11762 ;;
b4eb6b3d
JH
11763esac
11764echo " "
11765echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11766case "$o_nonblock" in
11767'')
11768 $cat head.c > try.c
3c728e00 11769 $cat >>try.c <<EOCP
b4eb6b3d 11770#include <stdio.h>
55954f19
JH
11771#$i_stdlib I_STDLIB
11772#ifdef I_STDLIB
80b3ef99 11773#include <stdlib.h>
55954f19 11774#endif
3c728e00
JH
11775#$i_fcntl I_FCNTL
11776#ifdef I_FCNTL
11777#include <fcntl.h>
11778#endif
b4eb6b3d
JH
11779int main() {
11780#ifdef O_NONBLOCK
11781 printf("O_NONBLOCK\n");
11782 exit(0);
11783#endif
11784#ifdef O_NDELAY
11785 printf("O_NDELAY\n");
11786 exit(0);
11787#endif
11788#ifdef FNDELAY
11789 printf("FNDELAY\n");
11790 exit(0);
11791#endif
11792 exit(0);
11793}
11794EOCP
11795 set try
11796 if eval $compile_ok; then
5440bc8e 11797 o_nonblock=`$run ./try`
b4eb6b3d
JH
11798 case "$o_nonblock" in
11799 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11800 *) echo "Seems like we can use $o_nonblock.";;
11801 esac
11802 else
11803 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11804 fi
11805 ;;
11806*) echo "Using $hint value $o_nonblock.";;
11807esac
11808$rm -f try try.* .out core
11809
11810echo " "
11811echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11812case "$eagain" in
11813'')
11814 $cat head.c > try.c
11815 $cat >>try.c <<EOCP
11816#include <errno.h>
11817#include <sys/types.h>
11818#include <signal.h>
11819#include <stdio.h>
55954f19
JH
11820#$i_stdlib I_STDLIB
11821#ifdef I_STDLIB
11822#include <stdlib.h>
11823#endif
1deb0a86
JH
11824#$i_fcntl I_FCNTL
11825#ifdef I_FCNTL
11826#include <fcntl.h>
11827#endif
b4eb6b3d
JH
11828#define MY_O_NONBLOCK $o_nonblock
11829#ifndef errno /* XXX need better Configure test */
11830extern int errno;
11831#endif
11832#$i_unistd I_UNISTD
11833#ifdef I_UNISTD
11834#include <unistd.h>
11835#endif
11836#$i_string I_STRING
11837#ifdef I_STRING
11838#include <string.h>
11839#else
11840#include <strings.h>
11841#endif
11842$signal_t blech(x) int x; { exit(3); }
11843EOCP
11844 $cat >> try.c <<'EOCP'
11845int main()
11846{
11847 int pd[2];
11848 int pu[2];
11849 char buf[1];
11850 char string[100];
11851
11852 pipe(pd); /* Down: child -> parent */
11853 pipe(pu); /* Up: parent -> child */
11854 if (0 != fork()) {
11855 int ret;
11856 close(pd[1]); /* Parent reads from pd[0] */
11857 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11858#ifdef F_SETFL
b4eb6b3d
JH
11859 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11860 exit(1);
a0acbdc3
JH
11861#else
11862 exit(4);
11863#endif
b4eb6b3d
JH
11864 signal(SIGALRM, blech);
11865 alarm(5);
11866 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11867 exit(2);
11868 sprintf(string, "%d\n", ret);
11869 write(2, string, strlen(string));
11870 alarm(0);
11871#ifdef EAGAIN
11872 if (errno == EAGAIN) {
11873 printf("EAGAIN\n");
11874 goto ok;
11875 }
11876#endif
11877#ifdef EWOULDBLOCK
11878 if (errno == EWOULDBLOCK)
11879 printf("EWOULDBLOCK\n");
11880#endif
11881 ok:
11882 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11883 sleep(2); /* Give it time to close our pipe */
11884 alarm(5);
11885 ret = read(pd[0], buf, 1); /* Should read EOF */
11886 alarm(0);
11887 sprintf(string, "%d\n", ret);
868439a2 11888 write(4, string, strlen(string));
b4eb6b3d
JH
11889 exit(0);
11890 }
11891
11892 close(pd[0]); /* We write to pd[1] */
11893 close(pu[1]); /* We read from pu[0] */
11894 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11895 close(pd[1]); /* Pipe pd is now fully closed! */
11896 exit(0); /* Bye bye, thank you for playing! */
11897}
11898EOCP
11899 set try
11900 if eval $compile_ok; then
11901 echo "$startsh" >mtry
868439a2 11902 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11903 chmod +x mtry
11904 ./mtry >/dev/null 2>&1
11905 case $? in
11906 0) eagain=`$cat try.out`;;
11907 1) echo "Could not perform non-blocking setting!";;
11908 2) echo "I did a successful read() for something that was not there!";;
11909 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11910 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11911 *) echo "Something terribly wrong happened during testing.";;
11912 esac
11913 rd_nodata=`$cat try.ret`
11914 echo "A read() system call with no data present returns $rd_nodata."
11915 case "$rd_nodata" in
11916 0|-1) ;;
11917 *)
11918 echo "(That's peculiar, fixing that to be -1.)"
11919 rd_nodata=-1
11920 ;;
11921 esac
11922 case "$eagain" in
11923 '')
11924 echo "Forcing errno EAGAIN on read() with no data available."
11925 eagain=EAGAIN
11926 ;;
11927 *)
11928 echo "Your read() sets errno to $eagain when no data is available."
11929 ;;
11930 esac
11931 status=`$cat try.err`
11932 case "$status" in
11933 0) echo "And it correctly returns 0 to signal EOF.";;
11934 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11935 *) echo "However, your read() returns '$status' on EOF??";;
11936 esac
11937 val="$define"
11938 if test "$status" = "$rd_nodata"; then
11939 echo "WARNING: you can't distinguish between EOF and no data!"
11940 val="$undef"
11941 fi
11942 else
11943 echo "I can't compile the test program--assuming errno EAGAIN will do."
11944 eagain=EAGAIN
11945 fi
11946 set d_eofnblk
11947 eval $setvar
11948 ;;
11949*)
11950 echo "Using $hint value $eagain."
11951 echo "Your read() returns $rd_nodata when no data is present."
11952 case "$d_eofnblk" in
11953 "$define") echo "And you can see EOF because read() returns 0.";;
11954 "$undef") echo "But you can't see EOF status from read() returned value.";;
11955 *)
11956 echo "(Assuming you can't see EOF status from read anyway.)"
11957 d_eofnblk=$undef
11958 ;;
11959 esac
11960 ;;
11961esac
11962$rm -f try try.* .out core head.c mtry
11963
15b61c98
JH
11964: see if _ptr and _cnt from stdio act std
11965echo " "
b4eb6b3d 11966
15b61c98
JH
11967if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11968 echo "(Looks like you have stdio.h from BSD.)"
11969 case "$stdio_ptr" in
11970 '') stdio_ptr='((fp)->_p)'
11971 ptr_lval=$define
11972 ;;
11973 *) ptr_lval=$d_stdio_ptr_lval;;
11974 esac
11975 case "$stdio_cnt" in
11976 '') stdio_cnt='((fp)->_r)'
11977 cnt_lval=$define
11978 ;;
11979 *) cnt_lval=$d_stdio_cnt_lval;;
11980 esac
11981 case "$stdio_base" in
11982 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11983 esac
11984 case "$stdio_bufsiz" in
11985 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11986 esac
11987elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11988 echo "(Looks like you have stdio.h from Linux.)"
11989 case "$stdio_ptr" in
11990 '') stdio_ptr='((fp)->_IO_read_ptr)'
11991 ptr_lval=$define
11992 ;;
11993 *) ptr_lval=$d_stdio_ptr_lval;;
11994 esac
11995 case "$stdio_cnt" in
11996 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11997 cnt_lval=$undef
11998 ;;
11999 *) cnt_lval=$d_stdio_cnt_lval;;
12000 esac
12001 case "$stdio_base" in
12002 '') stdio_base='((fp)->_IO_read_base)';;
12003 esac
12004 case "$stdio_bufsiz" in
12005 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12006 esac
12007else
12008 case "$stdio_ptr" in
12009 '') stdio_ptr='((fp)->_ptr)'
12010 ptr_lval=$define
12011 ;;
12012 *) ptr_lval=$d_stdio_ptr_lval;;
12013 esac
12014 case "$stdio_cnt" in
12015 '') stdio_cnt='((fp)->_cnt)'
12016 cnt_lval=$define
12017 ;;
12018 *) cnt_lval=$d_stdio_cnt_lval;;
12019 esac
12020 case "$stdio_base" in
12021 '') stdio_base='((fp)->_base)';;
12022 esac
12023 case "$stdio_bufsiz" in
12024 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12025 esac
12026fi
b4eb6b3d 12027
15b61c98
JH
12028: test whether _ptr and _cnt really work
12029echo "Checking how std your stdio is..." >&4
12030$cat >try.c <<EOP
12031#include <stdio.h>
55954f19
JH
12032#$i_stdlib I_STDLIB
12033#ifdef I_STDLIB
9d9004a9 12034#include <stdlib.h>
55954f19 12035#endif
15b61c98
JH
12036#define FILE_ptr(fp) $stdio_ptr
12037#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12038int main() {
15b61c98
JH
12039 FILE *fp = fopen("try.c", "r");
12040 char c = getc(fp);
12041 if (
12042 18 <= FILE_cnt(fp) &&
12043 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12044 )
12045 exit(0);
12046 exit(1);
9d9004a9 12047}
15b61c98
JH
12048EOP
12049val="$undef"
12050set try
12051if eval $compile && $to try.c; then
12052 if $run ./try; then
12053 echo "Your stdio acts pretty std."
12054 val="$define"
9d9004a9 12055 else
15b61c98 12056 echo "Your stdio isn't very std."
9d9004a9 12057 fi
15b61c98
JH
12058else
12059 echo "Your stdio doesn't appear very std."
12060fi
12061$rm -f try.c try
12062
12063# glibc 2.2.90 and above apparently change stdio streams so Perl's
12064# direct buffer manipulation no longer works. The Configure tests
12065# should be changed to correctly detect this, but until then,
12066# the following check should at least let perl compile and run.
12067# (This quick fix should be updated before 5.8.1.)
12068# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12069# A. Dougherty, June 3, 2002.
12070case "$d_gnulibc" in
12071$define)
12072 case "$gnulibc_version" in
12073 2.[01]*) ;;
12074 2.2) ;;
12075 2.2.[0-9]) ;;
12076 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12077 val="$undef"
12078 ;;
12079 esac
9d9004a9
AD
12080 ;;
12081esac
15b61c98 12082set d_stdstdio
9d9004a9 12083eval $setvar
9d9004a9 12084
15b61c98
JH
12085: Can _ptr be used as an lvalue?
12086case "$d_stdstdio$ptr_lval" in
12087$define$define) val=$define ;;
12088*) val=$undef ;;
12089esac
12090set d_stdio_ptr_lval
12091eval $setvar
9d9004a9 12092
15b61c98
JH
12093: Can _cnt be used as an lvalue?
12094case "$d_stdstdio$cnt_lval" in
12095$define$define) val=$define ;;
12096*) val=$undef ;;
12097esac
12098set d_stdio_cnt_lval
12099eval $setvar
b4eb6b3d 12100
15b61c98
JH
12101
12102: test whether setting _ptr sets _cnt as a side effect
12103d_stdio_ptr_lval_sets_cnt="$undef"
12104d_stdio_ptr_lval_nochange_cnt="$undef"
12105case "$d_stdio_ptr_lval$d_stdstdio" in
12106$define$define)
12107 echo "Checking to see what happens if we set the stdio ptr..." >&4
12108$cat >try.c <<EOP
12109#include <stdio.h>
12110/* Can we scream? */
12111/* Eat dust sed :-) */
12112/* In the buffer space, no one can hear you scream. */
55954f19
JH
12113#$i_stdlib I_STDLIB
12114#ifdef I_STDLIB
12115#include <stdlib.h>
12116#endif
15b61c98
JH
12117#define FILE_ptr(fp) $stdio_ptr
12118#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12119#include <sys/types.h>
b4eb6b3d 12120int main() {
15b61c98
JH
12121 FILE *fp = fopen("try.c", "r");
12122 int c;
12123 char *ptr;
12124 size_t cnt;
12125 if (!fp) {
12126 puts("Fail even to read");
12127 exit(1);
12128 }
12129 c = getc(fp); /* Read away the first # */
12130 if (c == EOF) {
12131 puts("Fail even to read");
12132 exit(1);
12133 }
12134 if (!(
12135 18 <= FILE_cnt(fp) &&
12136 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12137 )) {
12138 puts("Fail even to read");
12139 exit (1);
12140 }
12141 ptr = (char*) FILE_ptr(fp);
12142 cnt = (size_t)FILE_cnt(fp);
12143
12144 FILE_ptr(fp) += 42;
12145
12146 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12147 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12148 exit (1);
12149 }
12150 if (FILE_cnt(fp) <= 20) {
12151 printf ("Fail (<20 chars to test)");
12152 exit (1);
12153 }
12154 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12155 puts("Fail compare");
12156 exit (1);
12157 }
12158 if (cnt == FILE_cnt(fp)) {
12159 puts("Pass_unchanged");
12160 exit (0);
12161 }
12162 if (FILE_cnt(fp) == (cnt - 42)) {
12163 puts("Pass_changed");
12164 exit (0);
12165 }
12166 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12167 return 1;
12168
12169}
12170EOP
12171 set try
12172 if eval $compile && $to try.c; then
12173 case `$run ./try` in
12174 Pass_changed)
12175 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12176 d_stdio_ptr_lval_sets_cnt="$define" ;;
12177 Pass_unchanged)
12178 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12179 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12180 Fail*)
12181 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12182 *)
12183 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12184 esac
12185 else
12186 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12187 fi
12188 $rm -f try.c try
12189 ;;
12190esac
12191
12192: see if _base is also standard
12193val="$undef"
12194case "$d_stdstdio" in
12195$define)
12196 $cat >try.c <<EOP
12197#include <stdio.h>
12198#$i_stdlib I_STDLIB
12199#ifdef I_STDLIB
12200#include <stdlib.h>
12201#endif
12202#define FILE_base(fp) $stdio_base
12203#define FILE_bufsiz(fp) $stdio_bufsiz
12204int main() {
12205 FILE *fp = fopen("try.c", "r");
12206 char c = getc(fp);
12207 if (
12208 19 <= FILE_bufsiz(fp) &&
12209 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12210 )
12211 exit(0);
12212 exit(1);
12213}
12214EOP
12215 set try
12216 if eval $compile && $to try.c; then
12217 if $run ./try; then
12218 echo "And its _base field acts std."
12219 val="$define"
12220 else
12221 echo "But its _base field isn't std."
12222 fi
12223 else
12224 echo "However, it seems to be lacking the _base field."
12225 fi
12226 $rm -f try.c try
12227 ;;
12228esac
12229set d_stdiobase
12230eval $setvar
12231
12232: see if fast_stdio exists
12233val="$undef"
12234case "$d_stdstdio:$d_stdio_ptr_lval" in
12235"$define:$define")
12236 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12237 *$define*)
12238 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12239 val="$define"
12240 ;;
12241 esac
12242 ;;
12243esac
12244set d_faststdio
12245eval $setvar
12246
12247
12248
12249: see if fchdir exists
12250set fchdir d_fchdir
12251eval $inlibc
12252
12253: see if fchmod exists
12254set fchmod d_fchmod
12255eval $inlibc
12256
12257: see if fchown exists
12258set fchown d_fchown
12259eval $inlibc
12260
12261: see if this is an fcntl system
12262set fcntl d_fcntl
12263eval $inlibc
12264
12265echo " "
12266: See if fcntl-based locking works.
12267$cat >try.c <<EOCP
12268#$i_stdlib I_STDLIB
12269#ifdef I_STDLIB
12270#include <stdlib.h>
12271#endif
12272#include <unistd.h>
12273#include <fcntl.h>
12274#include <signal.h>
12275$signal_t blech(x) int x; { exit(3); }
12276int main() {
12277#if defined(F_SETLK) && defined(F_SETLKW)
12278 struct flock flock;
12279 int retval, fd;
12280 fd = open("try.c", O_RDONLY);
12281 flock.l_type = F_RDLCK;
12282 flock.l_whence = SEEK_SET;
12283 flock.l_start = flock.l_len = 0;
12284 signal(SIGALRM, blech);
12285 alarm(10);
12286 retval = fcntl(fd, F_SETLK, &flock);
12287 close(fd);
12288 (retval < 0 ? exit(2) : exit(0));
12289#else
12290 exit(2);
12291#endif
12292}
12293EOCP
12294echo "Checking if fcntl-based file locking works... "
12295case "$d_fcntl" in
12296"$define")
12297 set try
12298 if eval $compile_ok; then
12299 if $run ./try; then
12300 echo "Yes, it seems to work."
12301 val="$define"
12302 else
12303 echo "Nope, it didn't work."
12304 val="$undef"
12305 case "$?" in
12306 3) $cat >&4 <<EOM
12307***
12308*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12309*** This is (almost) impossible.
12310*** If your NFS lock daemons are not feeling well, something like
12311*** this may happen, please investigate. Cannot continue, aborting.
12312***
12313EOM
12314 exit 1
12315 ;;
12316 esac
12317 fi
12318 else
12319 echo "I'm unable to compile the test program, so I'll assume not."
12320 val="$undef"
12321 fi
12322 ;;
12323*) val="$undef";
12324 echo "Nope, since you don't even have fcntl()."
12325 ;;
12326esac
12327set d_fcntl_can_lock
12328eval $setvar
12329$rm -f try*
12330
12331
12332: check for fd_set items
12333$cat <<EOM
12334
12335Checking to see how well your C compiler handles fd_set and friends ...
12336EOM
12337$cat >try.c <<EOCP
12338#$i_stdlib I_STDLIB
12339#ifdef I_STDLIB
12340#include <stdlib.h>
12341#endif
12342#$i_systime I_SYS_TIME
12343#$i_sysselct I_SYS_SELECT
12344#$d_socket HAS_SOCKET
12345#include <sys/types.h>
12346#ifdef HAS_SOCKET
12347#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12348#endif
12349#ifdef I_SYS_TIME
12350#include <sys/time.h>
12351#endif
12352#ifdef I_SYS_SELECT
12353#include <sys/select.h>
12354#endif
12355int main() {
12356 fd_set fds;
12357
12358#ifdef TRYBITS
12359 if(fds.fds_bits);
12360#endif
12361
12362#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12363 exit(0);
12364#else
12365 exit(1);
12366#endif
12367}
12368EOCP
12369set try -DTRYBITS
12370if eval $compile; then
12371 d_fds_bits="$define"
12372 d_fd_set="$define"
12373 echo "Well, your system knows about the normal fd_set typedef..." >&4
12374 if $run ./try; then
b4eb6b3d
JH
12375 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12376 d_fd_macros="$define"
12377 else
12378 $cat >&4 <<'EOM'
12379but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12380EOM
12381 d_fd_macros="$undef"
12382 fi
12383else
12384 $cat <<'EOM'
12385Hmm, your compiler has some difficulty with fd_set. Checking further...
12386EOM
5440bc8e 12387 set try
b4eb6b3d
JH
12388 if eval $compile; then
12389 d_fds_bits="$undef"
12390 d_fd_set="$define"
12391 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12392 if $run ./try; then
b4eb6b3d
JH
12393 echo "and you have the normal fd_set macros." >&4
12394 d_fd_macros="$define"
12395 else
12396 $cat <<'EOM'
12397but not the normal fd_set macros! Gross! More work for me...
12398EOM
12399 d_fd_macros="$undef"
12400 fi
12401 else
12402 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12403 d_fd_set="$undef"
12404 d_fds_bits="$undef"
12405 d_fd_macros="$undef"
12406 fi
12407fi
5440bc8e 12408$rm -f try try.*
b4eb6b3d
JH
12409
12410: see if fgetpos exists
12411set fgetpos d_fgetpos
12412eval $inlibc
12413
758a5d79
JH
12414: see if finite exists
12415set finite d_finite
12416eval $inlibc
12417
12418: see if finitel exists
12419set finitel d_finitel
12420eval $inlibc
12421
b4eb6b3d
JH
12422: see if flock exists
12423set flock d_flock
12424eval $inlibc
12425
2ef53570
JH
12426: see if prototype for flock is available
12427echo " "
12428set d_flockproto flock $i_sysfile sys/file.h
12429eval $hasproto
12430
b4eb6b3d
JH
12431: see if fork exists
12432set fork d_fork
12433eval $inlibc
12434
758a5d79
JH
12435: see if fp_class exists
12436set fp_class d_fp_class
12437eval $inlibc
12438
b4eb6b3d
JH
12439: see if pathconf exists
12440set pathconf d_pathconf
12441eval $inlibc
12442
12443: see if fpathconf exists
12444set fpathconf d_fpathconf
12445eval $inlibc
12446
758a5d79
JH
12447: see if fpclass exists
12448set fpclass d_fpclass
12449eval $inlibc
12450
12451: see if fpclassify exists
12452set fpclassify d_fpclassify
12453eval $inlibc
12454
12455: see if fpclassl exists
12456set fpclassl d_fpclassl
12457eval $inlibc
12458
b4eb6b3d
JH
12459
12460: check for fpos64_t
12461echo " "
12462echo "Checking to see if you have fpos64_t..." >&4
12463$cat >try.c <<EOCP
12464#include <stdio.h>
12465int main() { fpos64_t x = 7; }
12466EOCP
12467set try
12468if eval $compile; then
12469 val="$define"
12470 echo "You have fpos64_t."
12471else
12472 val="$undef"
12473 echo "You do not have fpos64_t."
12474 case "$fpossize" in
12475 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12476 esac
12477fi
12478$rm -f try.* try
12479set d_fpos64_t
12480eval $setvar
12481
12482: see if frexpl exists
12483set frexpl d_frexpl
12484eval $inlibc
12485
b4eb6b3d
JH
12486: see if this is a sys/param system
12487set sys/param.h i_sysparam
12488eval $inhdr
12489
12490: see if this is a sys/mount.h system
12491set sys/mount.h i_sysmount
12492eval $inhdr
12493
b4eb6b3d
JH
12494
12495echo " "
12496echo "Checking to see if your system supports struct fs_data..." >&4
12497set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12498eval $hasstruct
12499case "$d_fs_data_s" in
12500"$define") echo "Yes, it does." ;;
12501*) echo "No, it doesn't." ;;
12502esac
12503
12504: see if fseeko exists
12505set fseeko d_fseeko
12506eval $inlibc
12507case "$longsize" in
125088) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12509esac
12510
12511: see if fsetpos exists
12512set fsetpos d_fsetpos
12513eval $inlibc
12514
12515
12516: see if fstatfs exists
12517set fstatfs d_fstatfs
12518eval $inlibc
12519
12520
12521: see if statvfs exists
12522set statvfs d_statvfs
12523eval $inlibc
12524
12525: see if fstatvfs exists
12526set fstatvfs d_fstatvfs
12527eval $inlibc
12528
12529
411ab01c
JH
12530: see if fsync exists
12531set fsync d_fsync
12532eval $inlibc
12533
b4eb6b3d
JH
12534: see if ftello exists
12535set ftello d_ftello
12536eval $inlibc
12537case "$longsize" in
125388) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12539esac
12540
12541: see if getcwd exists
12542set getcwd d_getcwd
12543eval $inlibc
12544
12545: see if getespwnam exists
12546set getespwnam d_getespwnam
12547eval $inlibc
12548
12549
12550: see if getfsstat exists
12551set getfsstat d_getfsstat
12552eval $inlibc
12553
12554: see if getgrent exists
12555set getgrent d_getgrent
12556eval $inlibc
12557
10bc17b6
JH
12558: see if getgrent_r exists
12559set getgrent_r d_getgrent_r
12560eval $inlibc
12561case "$d_getgrent_r" in
12562"$define")
12563 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12564 case "$d_getgrent_r_proto:$usethreads" in
12565 ":define") d_getgrent_r_proto=define
a48ec845
JH
12566 set d_getgrent_r_proto getgrent_r $hdrs
12567 eval $hasproto ;;
12568 *) ;;
12569 esac
12570 case "$d_getgrent_r_proto" in
12571 define)
10bc17b6
JH
12572 case "$getgrent_r_proto" in
12573 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12574 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12575 esac
12576 case "$getgrent_r_proto" in
12577 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12578 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12579 esac
12580 case "$getgrent_r_proto" in
12581 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12582 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12583 esac
12584 case "$getgrent_r_proto" in
12585 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12586 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12587 esac
12588 case "$getgrent_r_proto" in
12589 ''|0) try='int getgrent_r(struct group*, char*, int);'
12590 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12591 esac
12592 case "$getgrent_r_proto" in
12593 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12594 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12595 esac
12596 case "$getgrent_r_proto" in
90e831dc 12597 ''|0) d_getgrent_r=undef
10bc17b6 12598 getgrent_r_proto=0
a48ec845 12599 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12600 * ) case "$getgrent_r_proto" in
12601 REENTRANT_PROTO*) ;;
12602 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12603 esac
12604 echo "Prototype: $try" ;;
12605 esac
12606 ;;
c18e646a
JH
12607 *) case "$usethreads" in
12608 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12609 esac
90e831dc
SB
12610 d_getgrent_r=undef
12611 getgrent_r_proto=0
c18e646a 12612 ;;
a48ec845
JH
12613 esac
12614 ;;
10bc17b6
JH
12615*) getgrent_r_proto=0
12616 ;;
12617esac
12618
12619: see if getgrgid_r exists
12620set getgrgid_r d_getgrgid_r
12621eval $inlibc
12622case "$d_getgrgid_r" in
12623"$define")
12624 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12625 case "$d_getgrgid_r_proto:$usethreads" in
12626 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12627 set d_getgrgid_r_proto getgrgid_r $hdrs
12628 eval $hasproto ;;
12629 *) ;;
12630 esac
12631 case "$d_getgrgid_r_proto" in
12632 define)
10bc17b6
JH
12633 case "$getgrgid_r_proto" in
12634 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12635 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12636 esac
12637 case "$getgrgid_r_proto" in
12638 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12639 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12640 esac
12641 case "$getgrgid_r_proto" in
12642 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12643 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12644 esac
12645 case "$getgrgid_r_proto" in
12646 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12647 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12648 esac
12649 case "$getgrgid_r_proto" in
90e831dc 12650 ''|0) d_getgrgid_r=undef
10bc17b6 12651 getgrgid_r_proto=0
a48ec845 12652 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12653 * ) case "$getgrgid_r_proto" in
12654 REENTRANT_PROTO*) ;;
12655 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12656 esac
12657 echo "Prototype: $try" ;;
12658 esac
12659 ;;
c18e646a
JH
12660 *) case "$usethreads" in
12661 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12662 esac
90e831dc
SB
12663 d_getgrgid_r=undef
12664 getgrgid_r_proto=0
c18e646a 12665 ;;
a48ec845
JH
12666 esac
12667 ;;
10bc17b6
JH
12668*) getgrgid_r_proto=0
12669 ;;
12670esac
12671
12672: see if getgrnam_r exists
12673set getgrnam_r d_getgrnam_r
12674eval $inlibc
12675case "$d_getgrnam_r" in
12676"$define")
12677 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12678 case "$d_getgrnam_r_proto:$usethreads" in
12679 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12680 set d_getgrnam_r_proto getgrnam_r $hdrs
12681 eval $hasproto ;;
12682 *) ;;
12683 esac
12684 case "$d_getgrnam_r_proto" in
12685 define)
10bc17b6
JH
12686 case "$getgrnam_r_proto" in
12687 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12688 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12689 esac
12690 case "$getgrnam_r_proto" in
12691 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12692 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12693 esac
12694 case "$getgrnam_r_proto" in
12695 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12696 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12697 esac
12698 case "$getgrnam_r_proto" in
12699 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12700 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12701 esac
12702 case "$getgrnam_r_proto" in
12703 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12704 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12705 esac
12706 case "$getgrnam_r_proto" in
90e831dc 12707 ''|0) d_getgrnam_r=undef
10bc17b6 12708 getgrnam_r_proto=0
a48ec845 12709 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12710 * ) case "$getgrnam_r_proto" in
12711 REENTRANT_PROTO*) ;;
12712 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12713 esac
12714 echo "Prototype: $try" ;;
12715 esac
12716 ;;
c18e646a
JH
12717 *) case "$usethreads" in
12718 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12719 esac
90e831dc
SB
12720 d_getgrnam_r=undef
12721 getgrnam_r_proto=0
c18e646a 12722 ;;
a48ec845
JH
12723 esac
12724 ;;
10bc17b6
JH
12725*) getgrnam_r_proto=0
12726 ;;
12727esac
12728
b4eb6b3d
JH
12729: see if gethostbyaddr exists
12730set gethostbyaddr d_gethbyaddr
12731eval $inlibc
12732
12733: see if gethostbyname exists
12734set gethostbyname d_gethbyname
12735eval $inlibc
12736
12737: see if gethostent exists
12738set gethostent d_gethent
12739eval $inlibc
12740
12741: see how we will look up host name
12742echo " "
12743call=''
12744if set gethostname val -f d_gethname; eval $csym; $val; then
12745 echo 'gethostname() found.' >&4
12746 d_gethname="$define"
12747 call=gethostname
12748fi
12749if set uname val -f d_uname; eval $csym; $val; then
12750 if ./xenix; then
12751 $cat <<'EOM'
12752uname() was found, but you're running xenix, and older versions of xenix
12753have a broken uname(). If you don't really know whether your xenix is old
12754enough to have a broken system call, use the default answer.
12755
12756EOM
12757 dflt=y
12758 case "$d_uname" in
12759 "$define") dflt=n;;
12760 esac
12761 rp='Is your uname() broken?'
12762 . ./myread
12763 case "$ans" in
12764 n*) d_uname="$define"; call=uname;;
12765 esac
12766 else
12767 echo 'uname() found.' >&4
12768 d_uname="$define"
12769 case "$call" in
12770 '') call=uname ;;
12771 esac
12772 fi
12773fi
12774case "$d_gethname" in
12775'') d_gethname="$undef";;
12776esac
12777case "$d_uname" in
12778'') d_uname="$undef";;
12779esac
12780case "$d_uname$d_gethname" in
12781*define*)
12782 dflt=n
12783 cat <<EOM
12784
12785Every now and then someone has a $call() that lies about the hostname
12786but can't be fixed for political or economic reasons. If you wish, I can
12787pretend $call() isn't there and maybe compute hostname at run-time
12788thanks to the '$phostname' command.
12789
12790EOM
12791 rp="Shall I ignore $call() from now on?"
12792 . ./myread
12793 case "$ans" in
12794 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12795 esac;;
12796esac
12797case "$phostname" in
12798'') aphostname='';;
12799*) case "$aphostname" in
12800 /*) ;;
12801 *) set X $phostname
12802 shift
12803 file=$1
12804 shift
12805 file=`./loc $file $file $pth`
12806 aphostname=`echo $file $*`
12807 ;;
12808 esac
12809 ;;
12810esac
12811case "$d_uname$d_gethname" in
12812*define*) ;;
12813*)
12814 case "$phostname" in
12815 '')
12816 echo "There will be no way for $package to get your hostname." >&4;;
12817 *)
12818 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12819 ;;
12820 esac;;
12821esac
12822case "$d_phostname" in
12823'') d_phostname="$undef";;
12824esac
12825
10bc17b6
JH
12826: see if gethostbyaddr_r exists
12827set gethostbyaddr_r d_gethostbyaddr_r
12828eval $inlibc
12829case "$d_gethostbyaddr_r" in
12830"$define")
12831 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12832 case "$d_gethostbyaddr_r_proto:$usethreads" in
12833 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12834 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12835 eval $hasproto ;;
12836 *) ;;
12837 esac
12838 case "$d_gethostbyaddr_r_proto" in
12839 define)
10bc17b6
JH
12840 case "$gethostbyaddr_r_proto" in
12841 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12842 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12843 esac
12844 case "$gethostbyaddr_r_proto" in
12845 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12846 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12847 esac
12848 case "$gethostbyaddr_r_proto" in
12849 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12850 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12851 esac
12852 case "$gethostbyaddr_r_proto" in
12853 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12854 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12855 esac
12856 case "$gethostbyaddr_r_proto" in
12857 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12858 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12859 esac
12860 case "$gethostbyaddr_r_proto" in
12861 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12862 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12863 esac
12864 case "$gethostbyaddr_r_proto" in
12865 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12866 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12867 esac
12868 case "$gethostbyaddr_r_proto" in
12869 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12870 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12871 esac
12872 case "$gethostbyaddr_r_proto" in
12873 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12874 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12875 esac
12876 case "$gethostbyaddr_r_proto" in
12877 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12878 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12879 esac
12880 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12881 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12882 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12883 esac
12884 case "$gethostbyaddr_r_proto" in
90e831dc 12885 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12886 gethostbyaddr_r_proto=0
a48ec845 12887 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12888 * ) case "$gethostbyaddr_r_proto" in
12889 REENTRANT_PROTO*) ;;
12890 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12891 esac
12892 echo "Prototype: $try" ;;
12893 esac
12894 ;;
c18e646a
JH
12895 *) case "$usethreads" in
12896 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12897 esac
90e831dc
SB
12898 d_gethostbyaddr_r=undef
12899 gethostbyaddr_r_proto=0
c18e646a 12900 ;;
a48ec845
JH
12901 esac
12902 ;;
10bc17b6
JH
12903*) gethostbyaddr_r_proto=0
12904 ;;
12905esac
12906
12907: see if gethostbyname_r exists
12908set gethostbyname_r d_gethostbyname_r
12909eval $inlibc
12910case "$d_gethostbyname_r" in
12911"$define")
12912 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12913 case "$d_gethostbyname_r_proto:$usethreads" in
12914 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12915 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12916 eval $hasproto ;;
12917 *) ;;
12918 esac
12919 case "$d_gethostbyname_r_proto" in
12920 define)
10bc17b6
JH
12921 case "$gethostbyname_r_proto" in
12922 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12923 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12924 esac
12925 case "$gethostbyname_r_proto" in
12926 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12927 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12928 esac
12929 case "$gethostbyname_r_proto" in
12930 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12931 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12932 esac
12933 case "$gethostbyname_r_proto" in
90e831dc 12934 ''|0) d_gethostbyname_r=undef
10bc17b6 12935 gethostbyname_r_proto=0
a48ec845 12936 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12937 * ) case "$gethostbyname_r_proto" in
12938 REENTRANT_PROTO*) ;;
12939 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12940 esac
12941 echo "Prototype: $try" ;;
12942 esac
12943 ;;
c18e646a
JH
12944 *) case "$usethreads" in
12945 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12946 esac
90e831dc
SB
12947 d_gethostbyname_r=undef
12948 gethostbyname_r_proto=0
c18e646a 12949 ;;
a48ec845
JH
12950 esac
12951 ;;
10bc17b6
JH
12952*) gethostbyname_r_proto=0
12953 ;;
12954esac
12955
12956: see if gethostent_r exists
12957set gethostent_r d_gethostent_r
12958eval $inlibc
12959case "$d_gethostent_r" in
12960"$define")
12961 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12962 case "$d_gethostent_r_proto:$usethreads" in
12963 ":define") d_gethostent_r_proto=define
a48ec845
JH
12964 set d_gethostent_r_proto gethostent_r $hdrs
12965 eval $hasproto ;;
12966 *) ;;
12967 esac
12968 case "$d_gethostent_r_proto" in
12969 define)
10bc17b6
JH
12970 case "$gethostent_r_proto" in
12971 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12972 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12973 esac
12974 case "$gethostent_r_proto" in
12975 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12976 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12977 esac
12978 case "$gethostent_r_proto" in
12979 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12980 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12981 esac
12982 case "$gethostent_r_proto" in
12983 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12984 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12985 esac
12986 case "$gethostent_r_proto" in
12987 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12988 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12989 esac
12990 case "$gethostent_r_proto" in
12991 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12992 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12993 esac
12994 case "$gethostent_r_proto" in
90e831dc 12995 ''|0) d_gethostent_r=undef
10bc17b6 12996 gethostent_r_proto=0
a48ec845 12997 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12998 * ) case "$gethostent_r_proto" in
12999 REENTRANT_PROTO*) ;;
13000 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13001 esac
13002 echo "Prototype: $try" ;;
13003 esac
13004 ;;
c18e646a
JH
13005 *) case "$usethreads" in
13006 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13007 esac
90e831dc
SB
13008 d_gethostent_r=undef
13009 gethostent_r_proto=0
c18e646a 13010 ;;
a48ec845
JH
13011 esac
13012 ;;
10bc17b6
JH
13013*) gethostent_r_proto=0
13014 ;;
13015esac
b4eb6b3d
JH
13016
13017: see if prototypes for various gethostxxx netdb.h functions are available
13018echo " "
13019set d_gethostprotos gethostent $i_netdb netdb.h
13020eval $hasproto
13021
4e0554ec
JH
13022: see if getitimer exists
13023set getitimer d_getitimer
13024eval $inlibc
13025
b4eb6b3d
JH
13026: see if getlogin exists
13027set getlogin d_getlogin
13028eval $inlibc
13029
10bc17b6
JH
13030: see if getlogin_r exists
13031set getlogin_r d_getlogin_r
13032eval $inlibc
13033case "$d_getlogin_r" in
13034"$define")
13035 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13036 case "$d_getlogin_r_proto:$usethreads" in
13037 ":define") d_getlogin_r_proto=define
a48ec845
JH
13038 set d_getlogin_r_proto getlogin_r $hdrs
13039 eval $hasproto ;;
13040 *) ;;
13041 esac
13042 case "$d_getlogin_r_proto" in
13043 define)
10bc17b6
JH
13044 case "$getlogin_r_proto" in
13045 ''|0) try='int getlogin_r(char*, size_t);'
13046 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13047 esac
13048 case "$getlogin_r_proto" in
13049 ''|0) try='int getlogin_r(char*, int);'
13050 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13051 esac
13052 case "$getlogin_r_proto" in
13053 ''|0) try='char* getlogin_r(char*, size_t);'
13054 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13055 esac
13056 case "$getlogin_r_proto" in
13057 ''|0) try='char* getlogin_r(char*, int);'
13058 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13059 esac
13060 case "$getlogin_r_proto" in
90e831dc 13061 ''|0) d_getlogin_r=undef
10bc17b6 13062 getlogin_r_proto=0
a48ec845 13063 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13064 * ) case "$getlogin_r_proto" in
13065 REENTRANT_PROTO*) ;;
13066 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13067 esac
13068 echo "Prototype: $try" ;;
13069 esac
13070 ;;
c18e646a
JH
13071 *) case "$usethreads" in
13072 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13073 esac
90e831dc
SB
13074 d_getlogin_r=undef
13075 getlogin_r_proto=0
c18e646a 13076 ;;
a48ec845
JH
13077 esac
13078 ;;
10bc17b6
JH
13079*) getlogin_r_proto=0
13080 ;;
13081esac
13082
b4eb6b3d
JH
13083: see if getmnt exists
13084set getmnt d_getmnt
13085eval $inlibc
13086
13087: see if getmntent exists
13088set getmntent d_getmntent
13089eval $inlibc
13090
13091: see if getnetbyaddr exists
13092set getnetbyaddr d_getnbyaddr
13093eval $inlibc
13094
13095: see if getnetbyname exists
13096set getnetbyname d_getnbyname
13097eval $inlibc
13098
13099: see if getnetent exists
13100set getnetent d_getnent
13101eval $inlibc
13102
10bc17b6
JH
13103: see if getnetbyaddr_r exists
13104set getnetbyaddr_r d_getnetbyaddr_r
13105eval $inlibc
13106case "$d_getnetbyaddr_r" in
13107"$define")
13108 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13109 case "$d_getnetbyaddr_r_proto:$usethreads" in
13110 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13111 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13112 eval $hasproto ;;
13113 *) ;;
13114 esac
13115 case "$d_getnetbyaddr_r_proto" in
13116 define)
10bc17b6
JH
13117 case "$getnetbyaddr_r_proto" in
13118 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13119 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13120 esac
13121 case "$getnetbyaddr_r_proto" in
13122 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13123 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13124 esac
13125 case "$getnetbyaddr_r_proto" in
13126 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13127 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13128 esac
13129 case "$getnetbyaddr_r_proto" in
13130 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13131 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13132 esac
13133 case "$getnetbyaddr_r_proto" in
13134 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13135 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13136 esac
13137 case "$getnetbyaddr_r_proto" in
13138 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13139 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13140 esac
13141 case "$getnetbyaddr_r_proto" in
13142 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13143 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13144 esac
13145 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13146 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13147 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13148 esac
13149 case "$getnetbyaddr_r_proto" in
90e831dc 13150 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13151 getnetbyaddr_r_proto=0
a48ec845 13152 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13153 * ) case "$getnetbyaddr_r_proto" in
13154 REENTRANT_PROTO*) ;;
13155 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13156 esac
13157 echo "Prototype: $try" ;;
13158 esac
13159 ;;
c18e646a
JH
13160 *) case "$usethreads" in
13161 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13162 esac
90e831dc
SB
13163 d_getnetbyaddr_r=undef
13164 getnetbyaddr_r_proto=0
c18e646a 13165 ;;
a48ec845
JH
13166 esac
13167 ;;
10bc17b6
JH
13168*) getnetbyaddr_r_proto=0
13169 ;;
13170esac
13171
13172: see if getnetbyname_r exists
13173set getnetbyname_r d_getnetbyname_r
13174eval $inlibc
13175case "$d_getnetbyname_r" in
13176"$define")
13177 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13178 case "$d_getnetbyname_r_proto:$usethreads" in
13179 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13180 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13181 eval $hasproto ;;
13182 *) ;;
13183 esac
13184 case "$d_getnetbyname_r_proto" in
13185 define)
10bc17b6
JH
13186 case "$getnetbyname_r_proto" in
13187 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13188 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13189 esac
13190 case "$getnetbyname_r_proto" in
13191 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13192 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13193 esac
13194 case "$getnetbyname_r_proto" in
13195 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13196 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13197 esac
13198 case "$getnetbyname_r_proto" in
13199 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13200 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13201 esac
13202 case "$getnetbyname_r_proto" in
90e831dc 13203 ''|0) d_getnetbyname_r=undef
10bc17b6 13204 getnetbyname_r_proto=0
a48ec845 13205 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13206 * ) case "$getnetbyname_r_proto" in
13207 REENTRANT_PROTO*) ;;
13208 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13209 esac
13210 echo "Prototype: $try" ;;
13211 esac
13212 ;;
c18e646a
JH
13213 *) case "$usethreads" in
13214 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13215 esac
90e831dc
SB
13216 d_getnetbyname_r=undef
13217 getnetbyname_r_proto=0
c18e646a 13218 ;;
a48ec845
JH
13219 esac
13220 ;;
10bc17b6
JH
13221*) getnetbyname_r_proto=0
13222 ;;
13223esac
13224
13225: see if getnetent_r exists
13226set getnetent_r d_getnetent_r
13227eval $inlibc
13228case "$d_getnetent_r" in
13229"$define")
13230 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13231 case "$d_getnetent_r_proto:$usethreads" in
13232 ":define") d_getnetent_r_proto=define
a48ec845
JH
13233 set d_getnetent_r_proto getnetent_r $hdrs
13234 eval $hasproto ;;
13235 *) ;;
13236 esac
13237 case "$d_getnetent_r_proto" in
13238 define)
10bc17b6
JH
13239 case "$getnetent_r_proto" in
13240 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13241 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13242 esac
13243 case "$getnetent_r_proto" in
13244 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13245 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13246 esac
13247 case "$getnetent_r_proto" in
13248 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13249 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13250 esac
13251 case "$getnetent_r_proto" in
13252 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13253 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13254 esac
13255 case "$getnetent_r_proto" in
13256 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13257 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13258 esac
13259 case "$getnetent_r_proto" in
13260 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13261 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13262 esac
13263 case "$getnetent_r_proto" in
90e831dc 13264 ''|0) d_getnetent_r=undef
10bc17b6 13265 getnetent_r_proto=0
a48ec845 13266 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13267 * ) case "$getnetent_r_proto" in
13268 REENTRANT_PROTO*) ;;
13269 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13270 esac
13271 echo "Prototype: $try" ;;
13272 esac
13273 ;;
c18e646a
JH
13274 *) case "$usethreads" in
13275 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13276 esac
90e831dc
SB
13277 d_getnetent_r=undef
13278 getnetent_r_proto=0
c18e646a 13279 ;;
a48ec845
JH
13280 esac
13281 ;;
10bc17b6
JH
13282*) getnetent_r_proto=0
13283 ;;
13284esac
13285
b4eb6b3d
JH
13286: see if prototypes for various getnetxxx netdb.h functions are available
13287echo " "
13288set d_getnetprotos getnetent $i_netdb netdb.h
13289eval $hasproto
13290
0c0643d0
JH
13291: see if getpagesize exists
13292set getpagesize d_getpagsz
13293eval $inlibc
13294
b4eb6b3d
JH
13295
13296: see if getprotobyname exists
13297set getprotobyname d_getpbyname
13298eval $inlibc
13299
13300: see if getprotobynumber exists
13301set getprotobynumber d_getpbynumber
13302eval $inlibc
13303
13304: see if getprotoent exists
13305set getprotoent d_getpent
13306eval $inlibc
13307
13308: see if getpgid exists
13309set getpgid d_getpgid
13310eval $inlibc
13311
13312: see if getpgrp2 exists
13313set getpgrp2 d_getpgrp2
13314eval $inlibc
13315
13316: see if getppid exists
13317set getppid d_getppid
13318eval $inlibc
13319
13320: see if getpriority exists
13321set getpriority d_getprior
13322eval $inlibc
13323
10bc17b6
JH
13324: see if getprotobyname_r exists
13325set getprotobyname_r d_getprotobyname_r
13326eval $inlibc
13327case "$d_getprotobyname_r" in
13328"$define")
13329 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13330 case "$d_getprotobyname_r_proto:$usethreads" in
13331 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13332 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13333 eval $hasproto ;;
13334 *) ;;
13335 esac
13336 case "$d_getprotobyname_r_proto" in
13337 define)
10bc17b6
JH
13338 case "$getprotobyname_r_proto" in
13339 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13340 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13341 esac
13342 case "$getprotobyname_r_proto" in
13343 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13344 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13345 esac
13346 case "$getprotobyname_r_proto" in
13347 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13348 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13349 esac
13350 case "$getprotobyname_r_proto" in
90e831dc 13351 ''|0) d_getprotobyname_r=undef
10bc17b6 13352 getprotobyname_r_proto=0
a48ec845 13353 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13354 * ) case "$getprotobyname_r_proto" in
13355 REENTRANT_PROTO*) ;;
13356 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13357 esac
13358 echo "Prototype: $try" ;;
13359 esac
13360 ;;
c18e646a
JH
13361 *) case "$usethreads" in
13362 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13363 esac
90e831dc
SB
13364 d_getprotobyname_r=undef
13365 getprotobyname_r_proto=0
c18e646a 13366 ;;
a48ec845
JH
13367 esac
13368 ;;
10bc17b6
JH
13369*) getprotobyname_r_proto=0
13370 ;;
13371esac
13372
13373: see if getprotobynumber_r exists
13374set getprotobynumber_r d_getprotobynumber_r
13375eval $inlibc
13376case "$d_getprotobynumber_r" in
13377"$define")
13378 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13379 case "$d_getprotobynumber_r_proto:$usethreads" in
13380 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13381 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13382 eval $hasproto ;;
13383 *) ;;
13384 esac
13385 case "$d_getprotobynumber_r_proto" in
13386 define)
10bc17b6
JH
13387 case "$getprotobynumber_r_proto" in
13388 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13389 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13390 esac
13391 case "$getprotobynumber_r_proto" in
13392 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13393 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13394 esac
13395 case "$getprotobynumber_r_proto" in
13396 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13397 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13398 esac
13399 case "$getprotobynumber_r_proto" in
90e831dc 13400 ''|0) d_getprotobynumber_r=undef
10bc17b6 13401 getprotobynumber_r_proto=0
a48ec845 13402 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13403 * ) case "$getprotobynumber_r_proto" in
13404 REENTRANT_PROTO*) ;;
13405 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13406 esac
13407 echo "Prototype: $try" ;;
13408 esac
13409 ;;
c18e646a
JH
13410 *) case "$usethreads" in
13411 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13412 esac
90e831dc
SB
13413 d_getprotobynumber_r=undef
13414 getprotobynumber_r_proto=0
c18e646a 13415 ;;
a48ec845
JH
13416 esac
13417 ;;
10bc17b6
JH
13418*) getprotobynumber_r_proto=0
13419 ;;
13420esac
13421
13422: see if getprotoent_r exists
13423set getprotoent_r d_getprotoent_r
13424eval $inlibc
13425case "$d_getprotoent_r" in
13426"$define")
13427 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13428 case "$d_getprotoent_r_proto:$usethreads" in
13429 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13430 set d_getprotoent_r_proto getprotoent_r $hdrs
13431 eval $hasproto ;;
13432 *) ;;
13433 esac
13434 case "$d_getprotoent_r_proto" in
13435 define)
10bc17b6
JH
13436 case "$getprotoent_r_proto" in
13437 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13438 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13439 esac
13440 case "$getprotoent_r_proto" in
13441 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13442 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13443 esac
13444 case "$getprotoent_r_proto" in
13445 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13446 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13447 esac
13448 case "$getprotoent_r_proto" in
13449 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13450 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13451 esac
13452 case "$getprotoent_r_proto" in
90e831dc 13453 ''|0) d_getprotoent_r=undef
10bc17b6 13454 getprotoent_r_proto=0
a48ec845 13455 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13456 * ) case "$getprotoent_r_proto" in
13457 REENTRANT_PROTO*) ;;
13458 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13459 esac
13460 echo "Prototype: $try" ;;
13461 esac
13462 ;;
c18e646a
JH
13463 *) case "$usethreads" in
13464 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13465 esac
90e831dc
SB
13466 d_getprotoent_r=undef
13467 getprotoent_r_proto=0
c18e646a 13468 ;;
a48ec845
JH
13469 esac
13470 ;;
10bc17b6
JH
13471*) getprotoent_r_proto=0
13472 ;;
13473esac
13474
b4eb6b3d
JH
13475: see if prototypes for various getprotoxxx netdb.h functions are available
13476echo " "
13477set d_getprotoprotos getprotoent $i_netdb netdb.h
13478eval $hasproto
13479
13480: see if getprpwnam exists
13481set getprpwnam d_getprpwnam
13482eval $inlibc
13483
13484: see if getpwent exists
13485set getpwent d_getpwent
13486eval $inlibc
13487
10bc17b6
JH
13488: see if getpwent_r exists
13489set getpwent_r d_getpwent_r
13490eval $inlibc
13491case "$d_getpwent_r" in
13492"$define")
13493 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13494 case "$d_getpwent_r_proto:$usethreads" in
13495 ":define") d_getpwent_r_proto=define
a48ec845
JH
13496 set d_getpwent_r_proto getpwent_r $hdrs
13497 eval $hasproto ;;
13498 *) ;;
13499 esac
13500 case "$d_getpwent_r_proto" in
13501 define)
10bc17b6
JH
13502 case "$getpwent_r_proto" in
13503 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13504 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13505 esac
13506 case "$getpwent_r_proto" in
13507 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13508 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13509 esac
13510 case "$getpwent_r_proto" in
13511 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13512 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13513 esac
13514 case "$getpwent_r_proto" in
13515 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13516 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13517 esac
13518 case "$getpwent_r_proto" in
13519 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13520 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13521 esac
13522 case "$getpwent_r_proto" in
13523 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13524 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13525 esac
13526 case "$getpwent_r_proto" in
90e831dc 13527 ''|0) d_getpwent_r=undef
10bc17b6 13528 getpwent_r_proto=0
a48ec845 13529 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13530 * ) case "$getpwent_r_proto" in
13531 REENTRANT_PROTO*) ;;
13532 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13533 esac
13534 echo "Prototype: $try" ;;
13535 esac
13536 ;;
c18e646a
JH
13537 *) case "$usethreads" in
13538 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13539 esac
90e831dc
SB
13540 d_getpwent_r=undef
13541 getpwent_r_proto=0
c18e646a 13542 ;;
a48ec845
JH
13543 esac
13544 ;;
10bc17b6
JH
13545*) getpwent_r_proto=0
13546 ;;
13547esac
13548
13549: see if getpwnam_r exists
13550set getpwnam_r d_getpwnam_r
13551eval $inlibc
13552case "$d_getpwnam_r" in
13553"$define")
13554 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13555 case "$d_getpwnam_r_proto:$usethreads" in
13556 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13557 set d_getpwnam_r_proto getpwnam_r $hdrs
13558 eval $hasproto ;;
13559 *) ;;
13560 esac
13561 case "$d_getpwnam_r_proto" in
13562 define)
10bc17b6
JH
13563 case "$getpwnam_r_proto" in
13564 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13565 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13566 esac
13567 case "$getpwnam_r_proto" in
13568 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13569 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13570 esac
13571 case "$getpwnam_r_proto" in
13572 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13573 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13574 esac
13575 case "$getpwnam_r_proto" in
13576 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13577 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13578 esac
13579 case "$getpwnam_r_proto" in
90e831dc 13580 ''|0) d_getpwnam_r=undef
10bc17b6 13581 getpwnam_r_proto=0
a48ec845 13582 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13583 * ) case "$getpwnam_r_proto" in
13584 REENTRANT_PROTO*) ;;
13585 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13586 esac
13587 echo "Prototype: $try" ;;
13588 esac
13589 ;;
c18e646a
JH
13590 *) case "$usethreads" in
13591 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13592 esac
90e831dc
SB
13593 d_getpwnam_r=undef
13594 getpwnam_r_proto=0
c18e646a 13595 ;;
a48ec845
JH
13596 esac
13597 ;;
10bc17b6
JH
13598*) getpwnam_r_proto=0
13599 ;;
13600esac
13601
13602: see if getpwuid_r exists
13603set getpwuid_r d_getpwuid_r
13604eval $inlibc
13605case "$d_getpwuid_r" in
13606"$define")
13607 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13608 case "$d_getpwuid_r_proto:$usethreads" in
13609 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13610 set d_getpwuid_r_proto getpwuid_r $hdrs
13611 eval $hasproto ;;
13612 *) ;;
13613 esac
13614 case "$d_getpwuid_r_proto" in
13615 define)
10bc17b6
JH
13616 case "$getpwuid_r_proto" in
13617 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13618 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13619 esac
13620 case "$getpwuid_r_proto" in
13621 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13622 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13623 esac
13624 case "$getpwuid_r_proto" in
13625 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13626 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13627 esac
13628 case "$getpwuid_r_proto" in
13629 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13630 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13631 esac
13632 case "$getpwuid_r_proto" in
90e831dc 13633 ''|0) d_getpwuid_r=undef
10bc17b6 13634 getpwuid_r_proto=0
a48ec845 13635 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13636 * ) case "$getpwuid_r_proto" in
13637 REENTRANT_PROTO*) ;;
13638 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13639 esac
13640 echo "Prototype: $try" ;;
13641 esac
13642 ;;
c18e646a
JH
13643 *) case "$usethreads" in
13644 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13645 esac
90e831dc
SB
13646 d_getpwuid_r=undef
13647 getpwuid_r_proto=0
c18e646a 13648 ;;
a48ec845
JH
13649 esac
13650 ;;
10bc17b6
JH
13651*) getpwuid_r_proto=0
13652 ;;
13653esac
13654
b4eb6b3d
JH
13655
13656: see if getservbyname exists
13657set getservbyname d_getsbyname
13658eval $inlibc
13659
13660: see if getservbyport exists
13661set getservbyport d_getsbyport
13662eval $inlibc
13663
13664: see if getservent exists
13665set getservent d_getsent
13666eval $inlibc
13667
10bc17b6
JH
13668: see if getservbyname_r exists
13669set getservbyname_r d_getservbyname_r
13670eval $inlibc
13671case "$d_getservbyname_r" in
13672"$define")
13673 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13674 case "$d_getservbyname_r_proto:$usethreads" in
13675 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13676 set d_getservbyname_r_proto getservbyname_r $hdrs
13677 eval $hasproto ;;
13678 *) ;;
13679 esac
13680 case "$d_getservbyname_r_proto" in
13681 define)
10bc17b6
JH
13682 case "$getservbyname_r_proto" in
13683 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13684 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13685 esac
13686 case "$getservbyname_r_proto" in
13687 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13688 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13689 esac
13690 case "$getservbyname_r_proto" in
13691 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13692 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13693 esac
13694 case "$getservbyname_r_proto" in
90e831dc 13695 ''|0) d_getservbyname_r=undef
10bc17b6 13696 getservbyname_r_proto=0
a48ec845 13697 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13698 * ) case "$getservbyname_r_proto" in
13699 REENTRANT_PROTO*) ;;
13700 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13701 esac
13702 echo "Prototype: $try" ;;
13703 esac
13704 ;;
c18e646a
JH
13705 *) case "$usethreads" in
13706 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13707 esac
90e831dc
SB
13708 d_getservbyname_r=undef
13709 getservbyname_r_proto=0
c18e646a 13710 ;;
a48ec845
JH
13711 esac
13712 ;;
10bc17b6
JH
13713*) getservbyname_r_proto=0
13714 ;;
13715esac
13716
13717: see if getservbyport_r exists
13718set getservbyport_r d_getservbyport_r
13719eval $inlibc
13720case "$d_getservbyport_r" in
13721"$define")
13722 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13723 case "$d_getservbyport_r_proto:$usethreads" in
13724 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13725 set d_getservbyport_r_proto getservbyport_r $hdrs
13726 eval $hasproto ;;
13727 *) ;;
13728 esac
13729 case "$d_getservbyport_r_proto" in
13730 define)
10bc17b6
JH
13731 case "$getservbyport_r_proto" in
13732 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13733 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13734 esac
13735 case "$getservbyport_r_proto" in
13736 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13737 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13738 esac
13739 case "$getservbyport_r_proto" in
13740 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13741 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13742 esac
13743 case "$getservbyport_r_proto" in
90e831dc 13744 ''|0) d_getservbyport_r=undef
10bc17b6 13745 getservbyport_r_proto=0
a48ec845 13746 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13747 * ) case "$getservbyport_r_proto" in
13748 REENTRANT_PROTO*) ;;
13749 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13750 esac
13751 echo "Prototype: $try" ;;
13752 esac
13753 ;;
c18e646a
JH
13754 *) case "$usethreads" in
13755 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13756 esac
90e831dc
SB
13757 d_getservbyport_r=undef
13758 getservbyport_r_proto=0
c18e646a 13759 ;;
a48ec845
JH
13760 esac
13761 ;;
10bc17b6
JH
13762*) getservbyport_r_proto=0
13763 ;;
13764esac
13765
13766: see if getservent_r exists
13767set getservent_r d_getservent_r
13768eval $inlibc
13769case "$d_getservent_r" in
13770"$define")
13771 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13772 case "$d_getservent_r_proto:$usethreads" in
13773 ":define") d_getservent_r_proto=define
a48ec845
JH
13774 set d_getservent_r_proto getservent_r $hdrs
13775 eval $hasproto ;;
13776 *) ;;
13777 esac
13778 case "$d_getservent_r_proto" in
13779 define)
10bc17b6
JH
13780 case "$getservent_r_proto" in
13781 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13782 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13783 esac
13784 case "$getservent_r_proto" in
13785 ''|0) try='int getservent_r(struct servent*, char*, int);'
13786 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13787 esac
13788 case "$getservent_r_proto" in
13789 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13790 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13791 esac
13792 case "$getservent_r_proto" in
13793 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13794 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13795 esac
13796 case "$getservent_r_proto" in
90e831dc 13797 ''|0) d_getservent_r=undef
10bc17b6 13798 getservent_r_proto=0
a48ec845 13799 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13800 * ) case "$getservent_r_proto" in
13801 REENTRANT_PROTO*) ;;
13802 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13803 esac
13804 echo "Prototype: $try" ;;
13805 esac
13806 ;;
c18e646a
JH
13807 *) case "$usethreads" in
13808 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13809 esac
90e831dc
SB
13810 d_getservent_r=undef
13811 getservent_r_proto=0
c18e646a 13812 ;;
a48ec845
JH
13813 esac
13814 ;;
10bc17b6
JH
13815*) getservent_r_proto=0
13816 ;;
13817esac
13818
b4eb6b3d
JH
13819: see if prototypes for various getservxxx netdb.h functions are available
13820echo " "
13821set d_getservprotos getservent $i_netdb netdb.h
13822eval $hasproto
13823
13824: see if getspnam exists
13825set getspnam d_getspnam
13826eval $inlibc
13827
10bc17b6
JH
13828: see if this is a shadow.h system
13829set shadow.h i_shadow
13830eval $inhdr
13831
13832: see if getspnam_r exists
13833set getspnam_r d_getspnam_r
13834eval $inlibc
13835case "$d_getspnam_r" in
13836"$define")
13837 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13838 case "$d_getspnam_r_proto:$usethreads" in
13839 ":define") d_getspnam_r_proto=define
a48ec845
JH
13840 set d_getspnam_r_proto getspnam_r $hdrs
13841 eval $hasproto ;;
13842 *) ;;
13843 esac
13844 case "$d_getspnam_r_proto" in
13845 define)
10bc17b6
JH
13846 case "$getspnam_r_proto" in
13847 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13848 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13849 esac
13850 case "$getspnam_r_proto" in
13851 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13852 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13853 esac
13854 case "$getspnam_r_proto" in
90e831dc 13855 ''|0) d_getspnam_r=undef
10bc17b6 13856 getspnam_r_proto=0
a48ec845 13857 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13858 * ) case "$getspnam_r_proto" in
13859 REENTRANT_PROTO*) ;;
13860 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13861 esac
13862 echo "Prototype: $try" ;;
13863 esac
13864 ;;
c18e646a
JH
13865 *) case "$usethreads" in
13866 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13867 esac
90e831dc
SB
13868 d_getspnam_r=undef
13869 getspnam_r_proto=0
c18e646a 13870 ;;
a48ec845
JH
13871 esac
13872 ;;
10bc17b6
JH
13873*) getspnam_r_proto=0
13874 ;;
13875esac
13876
b4eb6b3d
JH
13877: see if gettimeofday or ftime exists
13878set gettimeofday d_gettimeod
13879eval $inlibc
13880case "$d_gettimeod" in
13881"$undef")
13882 set ftime d_ftime
13883 eval $inlibc
13884 ;;
13885*)
13886 val="$undef"; set d_ftime; eval $setvar
13887 ;;
13888esac
13889case "$d_gettimeod$d_ftime" in
13890"$undef$undef")
13891 echo " "
13892 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13893 ;;
13894esac
13895
10bc17b6
JH
13896: see if gmtime_r exists
13897set gmtime_r d_gmtime_r
13898eval $inlibc
13899case "$d_gmtime_r" in
13900"$define")
d63eadf0 13901 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13902 case "$d_gmtime_r_proto:$usethreads" in
13903 ":define") d_gmtime_r_proto=define
a48ec845
JH
13904 set d_gmtime_r_proto gmtime_r $hdrs
13905 eval $hasproto ;;
13906 *) ;;
13907 esac
13908 case "$d_gmtime_r_proto" in
13909 define)
10bc17b6
JH
13910 case "$gmtime_r_proto" in
13911 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13912 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13913 esac
13914 case "$gmtime_r_proto" in
13915 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13916 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13917 esac
13918 case "$gmtime_r_proto" in
90e831dc 13919 ''|0) d_gmtime_r=undef
10bc17b6 13920 gmtime_r_proto=0
a48ec845 13921 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13922 * ) case "$gmtime_r_proto" in
13923 REENTRANT_PROTO*) ;;
13924 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13925 esac
13926 echo "Prototype: $try" ;;
13927 esac
b4eb6b3d 13928 ;;
c18e646a
JH
13929 *) case "$usethreads" in
13930 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13931 esac
90e831dc
SB
13932 d_gmtime_r=undef
13933 gmtime_r_proto=0
c18e646a 13934 ;;
a48ec845
JH
13935 esac
13936 ;;
10bc17b6 13937*) gmtime_r_proto=0
b4eb6b3d
JH
13938 ;;
13939esac
13940
13941: see if hasmntopt exists
13942set hasmntopt d_hasmntopt
13943eval $inlibc
13944
13945: see if this is a netinet/in.h or sys/in.h system
13946set netinet/in.h i_niin sys/in.h i_sysin
13947eval $inhdr
13948
13949: see if arpa/inet.h has to be included
13950set arpa/inet.h i_arpainet
13951eval $inhdr
13952
13953: see if htonl --and friends-- exists
13954val=''
13955set htonl val
13956eval $inlibc
13957
13958: Maybe they are macros.
13959case "$val" in
13960$undef)
13961 $cat >htonl.c <<EOM
13962#include <stdio.h>
13963#include <sys/types.h>
13964#$i_niin I_NETINET_IN
13965#$i_sysin I_SYS_IN
13966#$i_arpainet I_ARPA_INET
13967#ifdef I_NETINET_IN
13968#include <netinet/in.h>
13969#endif
13970#ifdef I_SYS_IN
13971#include <sys/in.h>
13972#endif
13973#ifdef I_ARPA_INET
13974#include <arpa/inet.h>
13975#endif
13976#ifdef htonl
13977printf("Defined as a macro.");
13978#endif
13979EOM
13980 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13981 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13982 val="$define"
13983 echo "But it seems to be defined as a macro." >&4
13984 fi
13985 $rm -f htonl.?
13986 ;;
13987esac
13988set d_htonl
13989eval $setvar
13990
36adc09b
JH
13991: see if ilogbl exists
13992set ilogbl d_ilogbl
13993eval $inlibc
13994
b4eb6b3d
JH
13995: index or strchr
13996echo " "
13997if set index val -f; eval $csym; $val; then
13998 if set strchr val -f d_strchr; eval $csym; $val; then
13999 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14000 val="$define"
14001 vali="$undef"
14002 echo "strchr() found." >&4
14003 else
14004 val="$undef"
14005 vali="$define"
14006 echo "index() found." >&4
14007 fi
14008 else
14009 val="$undef"
14010 vali="$define"
8dfa8df9
JH
14011 echo "index() found." >&4
14012 fi
b4eb6b3d 14013else
8dfa8df9
JH
14014 if set strchr val -f d_strchr; eval $csym; $val; then
14015 val="$define"
14016 vali="$undef"
14017 echo "strchr() found." >&4
14018 else
14019 echo "No index() or strchr() found!" >&4
14020 val="$undef"
14021 vali="$undef"
14022 fi
b4eb6b3d 14023fi
8dfa8df9
JH
14024set d_strchr; eval $setvar
14025val="$vali"
14026set d_index; eval $setvar
14027
14028: check whether inet_aton exists
14029set inet_aton d_inetaton
14030eval $inlibc
b4eb6b3d
JH
14031
14032: Look for isascii
14033echo " "
36adc09b 14034$cat >isascii.c <<EOCP
b4eb6b3d
JH
14035#include <stdio.h>
14036#include <ctype.h>
55954f19
JH
14037#$i_stdlib I_STDLIB
14038#ifdef I_STDLIB
14039#include <stdlib.h>
14040#endif
b4eb6b3d
JH
14041int main() {
14042 int c = 'A';
14043 if (isascii(c))
14044 exit(0);
14045 else
14046 exit(1);
14047}
14048EOCP
14049set isascii
14050if eval $compile; then
14051 echo "isascii() found." >&4
14052 val="$define"
14053else
14054 echo "isascii() NOT found." >&4
14055 val="$undef"
14056fi
14057set d_isascii
14058eval $setvar
14059$rm -f isascii*
14060
758a5d79
JH
14061: see if isfinite exists
14062set isfinite d_isfinite
14063eval $inlibc
14064
14065: see if isinf exists
14066set isinf d_isinf
14067eval $inlibc
14068
b4eb6b3d
JH
14069: see if isnan exists
14070set isnan d_isnan
14071eval $inlibc
14072
14073: see if isnanl exists
14074set isnanl d_isnanl
14075eval $inlibc
14076
14077: see if killpg exists
14078set killpg d_killpg
14079eval $inlibc
14080
14081: see if lchown exists
14082echo " "
14083$cat > try.c <<'EOCP'
14084/* System header to define __stub macros and hopefully few prototypes,
14085 which can conflict with char lchown(); below. */
14086#include <assert.h>
14087/* Override any gcc2 internal prototype to avoid an error. */
14088/* We use char because int might match the return type of a gcc2
14089 builtin and then its argument prototype would still apply. */
14090char lchown();
14091int main() {
14092 /* The GNU C library defines this for functions which it implements
14093 to always fail with ENOSYS. Some functions are actually named
14094 something starting with __ and the normal name is an alias. */
14095#if defined (__stub_lchown) || defined (__stub___lchown)
14096choke me
14097#else
14098lchown();
14099#endif
14100; return 0; }
14101EOCP
14102set try
14103if eval $compile; then
14104 $echo "lchown() found." >&4
14105 val="$define"
14106else
14107 $echo "lchown() NOT found." >&4
14108 val="$undef"
14109fi
14110set d_lchown
14111eval $setvar
14112
14113: See if number of significant digits in a double precision number is known
14114echo " "
14115$cat >ldbl_dig.c <<EOM
14116#$i_limits I_LIMITS
14117#$i_float I_FLOAT
14118#ifdef I_LIMITS
14119#include <limits.h>
14120#endif
14121#ifdef I_FLOAT
14122#include <float.h>
14123#endif
14124#ifdef LDBL_DIG
14125printf("Contains LDBL_DIG");
14126#endif
14127EOM
14128$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14129if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14130 echo "LDBL_DIG found." >&4
14131 val="$define"
14132else
14133 echo "LDBL_DIG NOT found." >&4
14134 val="$undef"
14135fi
14136$rm -f ldbl_dig.?
14137set d_ldbl_dig
14138eval $setvar
14139
0a0abfba
MB
14140: see if this is a math.h system
14141set math.h i_math
14142eval $inhdr
14143
14144d_libm_lib_version="$undef"
14145case $i_math in
14146 $define)
14147 : check to see if math.h defines _LIB_VERSION
14148 echo " "
14149 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14150 $cat >try.c <<EOCP
14151#include <unistd.h>
14152#include <math.h>
14153int main (int argc, char *argv[])
14154{
14155 printf ("%d\n", _LIB_VERSION);
14156 return (0);
14157 } /* main */
14158EOCP
14159 set try
14160 if eval $compile; then
14161 foo=`$run ./try`
14162 echo "Yes, it does ($foo)" >&4
14163 d_libm_lib_version="$define"
14164 else
14165 echo "No, it does not (probably harmless)\n" >&4
14166 fi
14167 $rm -f try.* try core core.try.*
14168 ;;
14169
14170 esac
14171
b4eb6b3d
JH
14172: see if link exists
14173set link d_link
14174eval $inlibc
14175
10bc17b6
JH
14176: see if localtime_r exists
14177set localtime_r d_localtime_r
14178eval $inlibc
14179case "$d_localtime_r" in
14180"$define")
d63eadf0 14181 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14182 case "$d_localtime_r_proto:$usethreads" in
14183 ":define") d_localtime_r_proto=define
a48ec845
JH
14184 set d_localtime_r_proto localtime_r $hdrs
14185 eval $hasproto ;;
14186 *) ;;
14187 esac
14188 case "$d_localtime_r_proto" in
14189 define)
10bc17b6
JH
14190 case "$localtime_r_proto" in
14191 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14192 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14193 esac
14194 case "$localtime_r_proto" in
14195 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14196 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14197 esac
14198 case "$localtime_r_proto" in
90e831dc 14199 ''|0) d_localtime_r=undef
10bc17b6 14200 localtime_r_proto=0
a48ec845 14201 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14202 * ) case "$localtime_r_proto" in
14203 REENTRANT_PROTO*) ;;
14204 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14205 esac
14206 echo "Prototype: $try" ;;
14207 esac
14208 ;;
c18e646a
JH
14209 *) case "$usethreads" in
14210 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14211 esac
90e831dc
SB
14212 d_localtime_r=undef
14213 localtime_r_proto=0
c18e646a 14214 ;;
a48ec845
JH
14215 esac
14216 ;;
10bc17b6
JH
14217*) localtime_r_proto=0
14218 ;;
14219esac
14220
b4eb6b3d
JH
14221: see if localeconv exists
14222set localeconv d_locconv
14223eval $inlibc
14224
14225: see if lockf exists
14226set lockf d_lockf
14227eval $inlibc
14228
b4eb6b3d
JH
14229: see if prototype for lseek is available
14230echo " "
4786929f 14231set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14232eval $hasproto
14233
14234: see if lstat exists
14235set lstat d_lstat
14236eval $inlibc
14237
14238: see if madvise exists
14239set madvise d_madvise
14240eval $inlibc
14241
14242: see if mblen exists
14243set mblen d_mblen
14244eval $inlibc
14245
14246: see if mbstowcs exists
14247set mbstowcs d_mbstowcs
14248eval $inlibc
14249
14250: see if mbtowc exists
14251set mbtowc d_mbtowc
14252eval $inlibc
14253
14254: see if memchr exists
14255set memchr d_memchr
14256eval $inlibc
14257
14258: see if memcmp exists
14259set memcmp d_memcmp
14260eval $inlibc
14261
14262: see if memcpy exists
14263set memcpy d_memcpy
14264eval $inlibc
14265
14266: see if memmove exists
14267set memmove d_memmove
14268eval $inlibc
14269
14270: see if memset exists
14271set memset d_memset
14272eval $inlibc
14273
14274: see if mkdir exists
14275set mkdir d_mkdir
14276eval $inlibc
14277
14278: see if mkdtemp exists
14279set mkdtemp d_mkdtemp
14280eval $inlibc
14281
14282: see if mkfifo exists
14283set mkfifo d_mkfifo
14284eval $inlibc
14285
14286: see if mkstemp exists
14287set mkstemp d_mkstemp
14288eval $inlibc
14289
14290: see if mkstemps exists
14291set mkstemps d_mkstemps
14292eval $inlibc
14293
14294: see if mktime exists
14295set mktime d_mktime
14296eval $inlibc
14297
14298: see if this is a sys/mman.h system
14299set sys/mman.h i_sysmman
14300eval $inhdr
14301
14302: see if mmap exists
14303set mmap d_mmap
14304eval $inlibc
14305: see what shmat returns
14306: default to something harmless
14307mmaptype='void *'
14308case "$i_sysmman$d_mmap" in
14309"$define$define")
14310 $cat >mmap.c <<'END'
14311#include <sys/mman.h>
14312void *mmap();
14313END
14314 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14315 mmaptype='void *'
14316 else
14317 mmaptype='caddr_t'
14318 fi
14319 echo "and it returns ($mmaptype)." >&4
14320 ;;
14321esac
14322
14323
14324
89ce900e
JH
14325: see if sqrtl exists
14326set sqrtl d_sqrtl
14327eval $inlibc
14328
af1ff193
JH
14329: see if scalbnl exists
14330set scalbnl d_scalbnl
14331eval $inlibc
14332
89ce900e
JH
14333: see if modfl exists
14334set modfl d_modfl
14335eval $inlibc
14336
14337: see if prototype for modfl is available
14338echo " "
3a794506 14339set d_modflproto modfl $i_math math.h
89ce900e
JH
14340eval $hasproto
14341
14342d_modfl_pow32_bug="$undef"
14343
14344case "$d_longdbl$d_modfl" in
14345$define$define)
14346 $cat <<EOM
14347Checking to see whether your modfl() is okay for large values...
14348EOM
14349$cat >try.c <<EOCP
14350#include <math.h>
14351#include <stdio.h>
14352EOCP
14353if $test "X$d_modflproto" != "X$define"; then
14354 $cat >>try.c <<EOCP
14355/* Sigh. many current glibcs provide the function, but do not prototype it. */
14356long double modfl (long double, long double *);
14357EOCP
14358fi
14359$cat >>try.c <<EOCP
14360int main() {
14361 long double nv = 4294967303.15;
14362 long double v, w;
14363 v = modfl(nv, &w);
14364#ifdef __GLIBC__
14365 printf("glibc");
14366#endif
14367 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14368 return 0;
14369}
14370EOCP
14371 case "$osname:$gccversion" in
14372 aix:) saveccflags="$ccflags"
14373 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14374 esac
14375 set try
14376 if eval $compile; then
14377 foo=`$run ./try`
14378 case "$foo" in
14379 *" 4294967303.150000 1.150000 4294967302.000000")
14380 echo >&4 "Your modfl() is broken for large values."
14381 d_modfl_pow32_bug="$define"
14382 case "$foo" in
14383 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14384 ;;
14385 esac
14386 ;;
14387 *" 4294967303.150000 0.150000 4294967303.000000")
14388 echo >&4 "Your modfl() seems okay for large values."
14389 ;;
14390 *) echo >&4 "I don't understand your modfl() at all."
14391 d_modfl="$undef"
14392 ;;
14393 esac
14394 $rm -f try.* try core core.try.*
14395 else
14396 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14397 d_modfl="$undef"
14398 fi
14399 case "$osname:$gccversion" in
14400 aix:) ccflags="$saveccflags" ;; # restore
14401 esac
14402 ;;
14403esac
14404
14405if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14406 message=""
14407 if $test "$d_sqrtl" != "$define"; then
14408 message="$message sqrtl"
14409 fi
14410 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14411 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14412 echo "You have both aintl and copysignl, so I can emulate modfl."
14413 else
af1ff193 14414 message="$message modfl"
89ce900e 14415 fi
af1ff193
JH
14416 fi
14417 if $test "$d_frexpl" != "$define"; then
14418 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14419 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14420 else
14421 message="$message frexpl"
14422 fi
14423 fi
89ce900e 14424
af1ff193 14425 if $test "$message" != ""; then
89ce900e
JH
14426 $cat <<EOM >&4
14427
14428*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14429*** the following mathematical functions needed for long double support:
14430*** $message
fe63a0b4
JH
14431*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14432*** Cannot continue, aborting.
89ce900e
JH
14433
14434EOM
14435
fe63a0b4 14436 exit 1
89ce900e
JH
14437 fi
14438fi
14439
b4eb6b3d
JH
14440: see if mprotect exists
14441set mprotect d_mprotect
14442eval $inlibc
14443
14444: see if msgctl exists
14445set msgctl d_msgctl
14446eval $inlibc
14447
14448: see if msgget exists
14449set msgget d_msgget
14450eval $inlibc
14451
14452: see if msgsnd exists
14453set msgsnd d_msgsnd
14454eval $inlibc
14455
14456: see if msgrcv exists
14457set msgrcv d_msgrcv
14458eval $inlibc
14459
14460: see how much of the 'msg*(2)' library is present.
14461h_msg=true
14462echo " "
14463case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14464*"$undef"*) h_msg=false;;
14465esac
14466case "$osname" in
14467freebsd)
14468 case "`ipcs 2>&1`" in
14469 "SVID messages"*"not configured"*)
14470 echo "Your $osname does not have the msg*(2) configured." >&4
14471 h_msg=false
14472 val="$undef"
14473 set msgctl d_msgctl
14474 eval $setvar
14475 set msgget d_msgget
14476 eval $setvar
14477 set msgsnd d_msgsnd
14478 eval $setvar
14479 set msgrcv d_msgrcv
14480 eval $setvar
14481 ;;
14482 esac
14483 ;;
14484esac
14485: we could also check for sys/ipc.h ...
14486if $h_msg && $test `./findhdr sys/msg.h`; then
14487 echo "You have the full msg*(2) library." >&4
14488 val="$define"
14489else
14490 echo "You don't have the full msg*(2) library." >&4
14491 val="$undef"
14492fi
14493set d_msg
14494eval $setvar
14495
4e0554ec
JH
14496
14497echo " "
14498echo "Checking to see if your system supports struct msghdr..." >&4
14499set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14500eval $hasstruct
14501case "$d_msghdr_s" in
14502"$define") echo "Yes, it does." ;;
14503*) echo "No, it doesn't." ;;
14504esac
14505
14506
b4eb6b3d
JH
14507: see if msync exists
14508set msync d_msync
14509eval $inlibc
14510
14511: see if munmap exists
14512set munmap d_munmap
14513eval $inlibc
14514
14515: see if nice exists
14516set nice d_nice
14517eval $inlibc
14518
2765b840
JH
14519: see if this is a langinfo.h system
14520set langinfo.h i_langinfo
14521eval $inhdr
14522
14523: see if nl_langinfo exists
14524set nl_langinfo d_nl_langinfo
14525eval $inlibc
14526
b4eb6b3d
JH
14527: check for length of character
14528echo " "
14529case "$charsize" in
14530'')
14531 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14532 $cat >try.c <<EOCP
b4eb6b3d 14533#include <stdio.h>
d1daaddf
JH
14534#$i_stdlib I_STDLIB
14535#ifdef I_STDLIB
14536#include <stdlib.h>
14537#endif
b4eb6b3d
JH
14538int main()
14539{
14540 printf("%d\n", (int)sizeof(char));
14541 exit(0);
14542}
14543EOCP
14544 set try
14545 if eval $compile_ok; then
5440bc8e 14546 dflt=`$run ./try`
b4eb6b3d
JH
14547 else
14548 dflt='1'
14549 echo "(I can't seem to compile the test program. Guessing...)"
14550 fi
14551 ;;
14552*)
14553 dflt="$charsize"
14554 ;;
14555esac
14556rp="What is the size of a character (in bytes)?"
14557. ./myread
14558charsize="$ans"
14559$rm -f try.c try
14560
1d1be0dc
NC
14561: check for volatile keyword
14562echo " "
14563echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14564$cat >try.c <<'EOCP'
76f47787 14565int main()
1d1be0dc
NC
14566{
14567 typedef struct _goo_struct goo_struct;
14568 goo_struct * volatile goo = ((goo_struct *)0);
14569 struct _goo_struct {
14570 long long_int;
14571 int reg_int;
14572 char char_var;
14573 };
14574 typedef unsigned short foo_t;
14575 char *volatile foo;
14576 volatile int bar;
14577 volatile foo_t blech;
14578 foo = foo;
14579}
14580EOCP
14581if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14582 val="$define"
14583 echo "Yup, it does."
14584else
14585 val="$undef"
14586 echo "Nope, it doesn't."
14587fi
14588set d_volatile
14589eval $setvar
14590$rm -f try.*
14591
b4eb6b3d
JH
14592
14593echo " "
14594$echo "Choosing the C types to be used for Perl's internal types..." >&4
14595
14596case "$use64bitint:$d_quad:$quadtype" in
14597define:define:?*)
14598 ivtype="$quadtype"
14599 uvtype="$uquadtype"
14600 ivsize=8
14601 uvsize=8
14602 ;;
14603*) ivtype="long"
14604 uvtype="unsigned long"
14605 ivsize=$longsize
14606 uvsize=$longsize
14607 ;;
14608esac
14609
14610case "$uselongdouble:$d_longdbl" in
14611define:define)
14612 nvtype="long double"
14613 nvsize=$longdblsize
14614 ;;
14615*) nvtype=double
14616 nvsize=$doublesize
14617 ;;
14618esac
14619
14620$echo "(IV will be "$ivtype", $ivsize bytes)"
14621$echo "(UV will be "$uvtype", $uvsize bytes)"
14622$echo "(NV will be "$nvtype", $nvsize bytes)"
14623
14624$cat >try.c <<EOCP
14625#$i_inttypes I_INTTYPES
14626#ifdef I_INTTYPES
14627#include <inttypes.h>
14628#endif
14629#include <stdio.h>
14630int main() {
14631#ifdef INT8
14632 int8_t i = INT8_MAX;
14633 uint8_t u = UINT8_MAX;
14634 printf("int8_t\n");
14635#endif
14636#ifdef INT16
14637 int16_t i = INT16_MAX;
14638 uint16_t i = UINT16_MAX;
14639 printf("int16_t\n");
14640#endif
14641#ifdef INT32
14642 int32_t i = INT32_MAX;
14643 uint32_t u = UINT32_MAX;
14644 printf("int32_t\n");
14645#endif
14646}
14647EOCP
14648
14649case "$i8type" in
14650'') case "$charsize" in
14651 1) i8type=char
14652 u8type="unsigned char"
14653 i8size=$charsize
14654 u8size=$charsize
14655 ;;
14656 esac
14657 ;;
14658esac
14659case "$i8type" in
14660'') set try -DINT8
14661 if eval $compile; then
5440bc8e 14662 case "`$run ./try`" in
b4eb6b3d
JH
14663 int8_t) i8type=int8_t
14664 u8type=uint8_t
14665 i8size=1
14666 u8size=1
14667 ;;
14668 esac
14669 fi
14670 ;;
14671esac
14672case "$i8type" in
14673'') if $test $charsize -ge 1; then
14674 i8type=char
14675 u8type="unsigned char"
14676 i8size=$charsize
14677 u8size=$charsize
14678 fi
14679 ;;
14680esac
14681
14682case "$i16type" in
14683'') case "$shortsize" in
14684 2) i16type=short
14685 u16type="unsigned short"
14686 i16size=$shortsize
14687 u16size=$shortsize
14688 ;;
14689 esac
14690 ;;
14691esac
14692case "$i16type" in
14693'') set try -DINT16
14694 if eval $compile; then
5440bc8e 14695 case "`$run ./try`" in
b4eb6b3d
JH
14696 int16_t)
14697 i16type=int16_t
14698 u16type=uint16_t
14699 i16size=2
14700 u16size=2
14701 ;;
14702 esac
14703 fi
14704 ;;
14705esac
14706case "$i16type" in
14707'') if $test $shortsize -ge 2; then
14708 i16type=short
14709 u16type="unsigned short"
14710 i16size=$shortsize
14711 u16size=$shortsize
14712 fi
14713 ;;
14714esac
14715
14716case "$i32type" in
14717'') case "$longsize" in
14718 4) i32type=long
14719 u32type="unsigned long"
14720 i32size=$longsize
14721 u32size=$longsize
14722 ;;
14723 *) case "$intsize" in
14724 4) i32type=int
14725 u32type="unsigned int"
14726 i32size=$intsize
14727 u32size=$intsize
14728 ;;
14729 esac
14730 ;;
14731 esac
14732 ;;
14733esac
14734case "$i32type" in
14735'') set try -DINT32
14736 if eval $compile; then
5440bc8e 14737 case "`$run ./try`" in
b4eb6b3d
JH
14738 int32_t)
14739 i32type=int32_t
14740 u32type=uint32_t
14741 i32size=4
14742 u32size=4
14743 ;;
14744 esac
14745 fi
14746 ;;
14747esac
14748case "$i32type" in
14749'') if $test $intsize -ge 4; then
14750 i32type=int
14751 u32type="unsigned int"
14752 i32size=$intsize
14753 u32size=$intsize
14754 fi
14755 ;;
14756esac
14757
14758case "$i64type" in
14759'') case "$d_quad:$quadtype" in
14760 define:?*)
14761 i64type="$quadtype"
14762 u64type="$uquadtype"
14763 i64size=8
14764 u64size=8
14765 ;;
14766 esac
14767 ;;
14768esac
14769
1d1be0dc
NC
14770$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14771: volatile so that the compiler has to store it out to memory.
14772if test X"$d_volatile" = X"$define"; then
14773 volatile=volatile
14774fi
b4eb6b3d
JH
14775$cat <<EOP >try.c
14776#include <stdio.h>
55954f19
JH
14777#$i_stdlib I_STDLIB
14778#ifdef I_STDLIB
14779#include <stdlib.h>
14780#endif
1d1be0dc
NC
14781#include <sys/types.h>
14782#include <signal.h>
14783#ifdef SIGFPE
14784$volatile int bletched = 0;
14785$signal_t blech(s) int s; { bletched = 1; }
14786#endif
b4eb6b3d
JH
14787int main() {
14788 $uvtype u = 0;
1d1be0dc 14789 $nvtype d;
b4eb6b3d
JH
14790 int n = 8 * $uvsize;
14791 int i;
1d1be0dc
NC
14792#ifdef SIGFPE
14793 signal(SIGFPE, blech);
14794#endif
14795
b4eb6b3d
JH
14796 for (i = 0; i < n; i++) {
14797 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14798 d = ($nvtype)u;
14799 if (($uvtype)d != u)
b4eb6b3d 14800 break;
1d1be0dc
NC
14801 if (d <= 0)
14802 break;
14803 d = ($nvtype)(u - 1);
14804 if (($uvtype)d != (u - 1))
14805 break;
14806#ifdef SIGFPE
14807 if (bletched) {
14808 break;
14809#endif
14810 }
b4eb6b3d 14811 }
efd1522b 14812 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14813 exit(0);
14814}
14815EOP
1d1be0dc
NC
14816set try
14817
14818d_nv_preserves_uv="$undef"
14819if eval $compile; then
53133ed1 14820 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14821fi
53133ed1 14822case "$nv_preserves_uv_bits" in
1d1be0dc 14823\-[1-9]*)
53133ed1
NC
14824 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14825 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14826 d_nv_preserves_uv="$define"
b4eb6b3d 14827 ;;
53133ed1 14828[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14829 d_nv_preserves_uv="$undef" ;;
14830*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14831 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14832esac
14833
1d1be0dc
NC
14834$rm -f try.* try
14835
b4eb6b3d
JH
14836
14837: check for off64_t
14838echo " "
14839echo "Checking to see if you have off64_t..." >&4
14840$cat >try.c <<EOCP
14841#include <sys/types.h>
14842#include <unistd.h>
14843int main() { off64_t x = 7; }
14844EOCP
14845set try
14846if eval $compile; then
14847 val="$define"
14848 echo "You have off64_t."
14849else
14850 val="$undef"
14851 echo "You do not have off64_t."
14852 case "$lseeksize" in
14853 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14854 esac
14855fi
14856$rm -f try.* try
14857set d_off64_t
14858eval $setvar
14859
b4eb6b3d
JH
14860: how to create joinable pthreads
14861if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14862 echo " "
14863 echo "Checking what constant to use for creating joinable pthreads..." >&4
14864 $cat >try.c <<'EOCP'
14865#include <pthread.h>
14866int main() {
14867 int detachstate = JOINABLE;
14868}
14869EOCP
14870 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14871 if eval $compile; then
14872 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14873 val="$undef" # Yes, undef.
14874 set d_old_pthread_create_joinable
14875 eval $setvar
14876 val=""
14877 set old_pthread_create_joinable
14878 eval $setvar
14879 else
14880 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14881 if eval $compile; then
14882 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14883 val="$define"
14884 set d_old_pthread_create_joinable
14885 eval $setvar
14886 val=PTHREAD_CREATE_UNDETACHED
14887 set old_pthread_create_joinable
14888 eval $setvar
14889 else
14890 set try -DJOINABLE=__UNDETACHED
14891 if eval $compile; then
14892 echo "You seem to use __UNDETACHED." >&4
14893 val="$define"
14894 set d_old_pthread_create_joinable
14895 eval $setvar
14896 val=__UNDETACHED
14897 set old_pthread_create_joinable
14898 eval $setvar
14899 else
14900 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
14901 val="$define"
14902 set d_old_pthread_create_joinable
14903 eval $setvar
14904 val=0
14905 set old_pthread_create_joinable
14906 eval $setvar
14907 fi
14908 fi
14909 fi
14910 $rm -f try try.*
14911else
14912 d_old_pthread_create_joinable="$undef"
14913 old_pthread_create_joinable=""
14914fi
14915
14916: see if pause exists
14917set pause d_pause
14918eval $inlibc
14919
14920: see if pipe exists
14921set pipe d_pipe
14922eval $inlibc
14923
14924: see if poll exists
14925set poll d_poll
14926eval $inlibc
14927
c7aff470
NIS
14928: see if readlink exists
14929set readlink d_readlink
14930eval $inlibc
14931
14932echo " "
f24dbf84 14933procselfexe=''
c7aff470 14934val="$undef"
a33c94aa
JH
14935case "$d_readlink" in
14936"$define")
c7aff470
NIS
14937 if $issymlink /proc/self/exe ; then
14938 $ls -l /proc/self/exe > reflect
51660ed5 14939 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 14940 echo "You have Linux-like /proc/self/exe."
92236451 14941 procselfexe='"/proc/self/exe"'
f24dbf84 14942 val="$define"
f24dbf84
JH
14943 fi
14944 fi
14945 if $issymlink /proc/curproc/file ; then
14946 $ls -l /proc/curproc/file > reflect
14947 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14948 echo "You have BSD-like /proc/curproc/file."
92236451 14949 procselfexe='"/proc/curproc/file"'
f24dbf84 14950 val="$define"
c7aff470 14951 fi
c7aff470 14952 fi
a33c94aa
JH
14953 ;;
14954esac
428dc699 14955$rm -f reflect
c7aff470
NIS
14956set d_procselfexe
14957eval $setvar
14958
263fee3f
JH
14959: see whether the pthread_atfork exists
14960$cat >try.c <<EOP
14961#include <pthread.h>
14962#include <stdio.h>
14963int main() {
14964#ifdef PTHREAD_ATFORK
14965 pthread_atfork(NULL,NULL,NULL);
14966#endif
14967}
14968EOP
14969
d6483fcc 14970: see if pthread_atfork exists
263fee3f
JH
14971set try -DPTHREAD_ATFORK
14972if eval $compile; then
14973 val="$define"
14974else
14975 val="$undef"
14976fi
14977case "$usethreads" in
14978$define)
14979 case "$val" in
14980 $define) echo 'pthread_atfork found.' >&4 ;;
14981 *) echo 'pthread_atfork NOT found.' >&4 ;;
14982 esac
14983esac
14984set d_pthread_atfork
14985eval $setvar
d6483fcc 14986
58d975c3
JH
14987: see if pthread_attr_setscope exists
14988set pthread_attr_setscope d_pthread_attr_setscope
14989eval $inlibc
14990
b4eb6b3d
JH
14991
14992: see whether the various POSIXish _yields exist
14993$cat >try.c <<EOP
14994#include <pthread.h>
14995#include <stdio.h>
14996int main() {
14997#ifdef SCHED_YIELD
14998 sched_yield();
14999#else
15000#ifdef PTHREAD_YIELD
15001 pthread_yield();
15002#else
15003#ifdef PTHREAD_YIELD_NULL
15004 pthread_yield(NULL);
15005#endif
15006#endif
15007#endif
15008}
15009EOP
15010: see if sched_yield exists
15011set try -DSCHED_YIELD
15012if eval $compile; then
15013 val="$define"
15014 sched_yield='sched_yield()'
15015else
15016 val="$undef"
15017fi
15018case "$usethreads" in
15019$define)
15020 case "$val" in
15021 $define) echo 'sched_yield() found.' >&4 ;;
15022 *) echo 'sched_yield() NOT found.' >&4 ;;
15023 esac
15024esac
10bc17b6
JH
15025set d_sched_yield
15026eval $setvar
b4eb6b3d 15027
10bc17b6
JH
15028: see if pthread_yield exists
15029set try -DPTHREAD_YIELD
15030if eval $compile; then
15031 val="$define"
15032 case "$sched_yield" in
15033 '') sched_yield='pthread_yield()' ;;
15034 esac
15035else
15036 set try -DPTHREAD_YIELD_NULL
15037 if eval $compile; then
15038 val="$define"
15039 case "$sched_yield" in
15040 '') sched_yield='pthread_yield(NULL)' ;;
15041 esac
15042 else
15043 val="$undef"
15044 fi
15045fi
15046case "$usethreads" in
15047$define)
15048 case "$val" in
15049 $define) echo 'pthread_yield() found.' >&4 ;;
15050 *) echo 'pthread_yield() NOT found.' >&4 ;;
15051 esac
15052 ;;
15053esac
15054set d_pthread_yield
15055eval $setvar
b4eb6b3d 15056
10bc17b6
JH
15057case "$sched_yield" in
15058'') sched_yield=undef ;;
15059esac
b4eb6b3d 15060
10bc17b6
JH
15061$rm -f try try.*
15062
15063: see if random_r exists
15064set random_r d_random_r
15065eval $inlibc
15066case "$d_random_r" in
15067"$define")
15068 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15069 case "$d_random_r_proto:$usethreads" in
15070 ":define") d_random_r_proto=define
a48ec845
JH
15071 set d_random_r_proto random_r $hdrs
15072 eval $hasproto ;;
15073 *) ;;
15074 esac
15075 case "$d_random_r_proto" in
15076 define)
10bc17b6
JH
15077 case "$random_r_proto" in
15078 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15079 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15080 esac
15081 case "$random_r_proto" in
15082 ''|0) try='int random_r(long*, struct random_data*);'
15083 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15084 esac
15085 case "$random_r_proto" in
15086 ''|0) try='int random_r(struct random_data*, int32_t*);'
15087 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15088 esac
15089 case "$random_r_proto" in
90e831dc 15090 ''|0) d_random_r=undef
10bc17b6 15091 random_r_proto=0
a48ec845 15092 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15093 * ) case "$random_r_proto" in
15094 REENTRANT_PROTO*) ;;
15095 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15096 esac
15097 echo "Prototype: $try" ;;
15098 esac
b4eb6b3d 15099 ;;
c18e646a
JH
15100 *) case "$usethreads" in
15101 define) echo "random_r has no prototype, not using it." >&4 ;;
15102 esac
90e831dc
SB
15103 d_random_r=undef
15104 random_r_proto=0
c18e646a 15105 ;;
a48ec845
JH
15106 esac
15107 ;;
10bc17b6 15108*) random_r_proto=0
b4eb6b3d
JH
15109 ;;
15110esac
15111
15112: see if readdir and friends exist
15113set readdir d_readdir
15114eval $inlibc
15115set seekdir d_seekdir
15116eval $inlibc
15117set telldir d_telldir
15118eval $inlibc
15119set rewinddir d_rewinddir
15120eval $inlibc
15121
10bc17b6
JH
15122: see if readdir64_r exists
15123set readdir64_r d_readdir64_r
15124eval $inlibc
15125case "$d_readdir64_r" in
15126"$define")
15127 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15128 case "$d_readdir64_r_proto:$usethreads" in
15129 ":define") d_readdir64_r_proto=define
a48ec845
JH
15130 set d_readdir64_r_proto readdir64_r $hdrs
15131 eval $hasproto ;;
15132 *) ;;
15133 esac
15134 case "$d_readdir64_r_proto" in
15135 define)
10bc17b6
JH
15136 case "$readdir64_r_proto" in
15137 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15138 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15139 esac
15140 case "$readdir64_r_proto" in
15141 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15142 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15143 esac
15144 case "$readdir64_r_proto" in
90e831dc 15145 ''|0) d_readdir64_r=undef
10bc17b6 15146 readdir64_r_proto=0
a48ec845 15147 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15148 * ) case "$readdir64_r_proto" in
15149 REENTRANT_PROTO*) ;;
15150 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15151 esac
15152 echo "Prototype: $try" ;;
15153 esac
15154 ;;
c18e646a
JH
15155 *) case "$usethreads" in
15156 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15157 esac
90e831dc
SB
15158 d_readdir64_r=undef
15159 readdir64_r_proto=0
c18e646a 15160 ;;
a48ec845
JH
15161 esac
15162 ;;
10bc17b6
JH
15163*) readdir64_r_proto=0
15164 ;;
15165esac
15166
15167: see if readdir_r exists
15168set readdir_r d_readdir_r
15169eval $inlibc
15170case "$d_readdir_r" in
15171"$define")
15172 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15173 case "$d_readdir_r_proto:$usethreads" in
15174 ":define") d_readdir_r_proto=define
a48ec845
JH
15175 set d_readdir_r_proto readdir_r $hdrs
15176 eval $hasproto ;;
15177 *) ;;
15178 esac
15179 case "$d_readdir_r_proto" in
15180 define)
10bc17b6
JH
15181 case "$readdir_r_proto" in
15182 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15183 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15184 esac
15185 case "$readdir_r_proto" in
15186 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15187 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15188 esac
15189 case "$readdir_r_proto" in
90e831dc 15190 ''|0) d_readdir_r=undef
10bc17b6 15191 readdir_r_proto=0
a48ec845 15192 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15193 * ) case "$readdir_r_proto" in
15194 REENTRANT_PROTO*) ;;
15195 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15196 esac
15197 echo "Prototype: $try" ;;
15198 esac
15199 ;;
c18e646a
JH
15200 *) case "$usethreads" in
15201 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15202 esac
90e831dc
SB
15203 d_readdir_r=undef
15204 readdir_r_proto=0
c18e646a 15205 ;;
a48ec845
JH
15206 esac
15207 ;;
10bc17b6
JH
15208*) readdir_r_proto=0
15209 ;;
15210esac
15211
4e0554ec
JH
15212: see if readv exists
15213set readv d_readv
15214eval $inlibc
15215
15216: see if recvmsg exists
15217set recvmsg d_recvmsg
15218eval $inlibc
15219
b4eb6b3d
JH
15220: see if rename exists
15221set rename d_rename
15222eval $inlibc
15223
15224: see if rmdir exists
15225set rmdir d_rmdir
15226eval $inlibc
15227
15228: see if memory.h is available.
15229val=''
15230set memory.h val
15231eval $inhdr
15232
15233: See if it conflicts with string.h
15234case "$val" in
15235$define)
15236 case "$strings" in
15237 '') ;;
15238 *)
15239 $cppstdin $cppflags $cppminus < $strings > mem.h
15240 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15241 echo " "
15242 echo "We won't be including <memory.h>."
15243 val="$undef"
15244 fi
15245 $rm -f mem.h
15246 ;;
15247 esac
15248esac
15249set i_memory
15250eval $setvar
15251
15252: can bcopy handle overlapping blocks?
b6cc3bc4 15253echo " "
b4eb6b3d 15254val="$undef"
b6cc3bc4
AD
15255case "$d_memmove" in
15256"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15257*) case "$d_bcopy" in
15258 "$define")
15259 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15260 $cat >try.c <<EOCP
b4eb6b3d
JH
15261#$i_memory I_MEMORY
15262#$i_stdlib I_STDLIB
15263#$i_string I_STRING
15264#$i_unistd I_UNISTD
15265EOCP
15266 $cat >>try.c <<'EOCP'
15267#include <stdio.h>
15268#ifdef I_MEMORY
15269# include <memory.h>
15270#endif
15271#ifdef I_STDLIB
15272# include <stdlib.h>
15273#endif
15274#ifdef I_STRING
15275# include <string.h>
15276#else
15277# include <strings.h>
15278#endif
15279#ifdef I_UNISTD
15280# include <unistd.h> /* Needed for NetBSD */
15281#endif
15282int main()
15283{
15284char buf[128], abc[128];
15285char *b;
15286int len;
15287int off;
15288int align;
15289
b6cc3bc4
AD
15290/* Copy "abcde..." string to char abc[] so that gcc doesn't
15291 try to store the string in read-only memory. */
b4eb6b3d
JH
15292bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15293
15294for (align = 7; align >= 0; align--) {
15295 for (len = 36; len; len--) {
15296 b = buf+align;
15297 bcopy(abc, b, len);
15298 for (off = 1; off <= len; off++) {
15299 bcopy(b, b+off, len);
15300 bcopy(b+off, b, len);
15301 if (bcmp(b, abc, len))
15302 exit(1);
15303 }
15304 }
15305}
15306exit(0);
15307}
15308EOCP
b6cc3bc4
AD
15309 set try
15310 if eval $compile_ok; then
15311 if ./try 2>/dev/null; then
15312 echo "Yes, it can."
15313 val="$define"
15314 else
15315 echo "It can't, sorry."
15316 fi
b4eb6b3d 15317 else
b6cc3bc4 15318 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15319 fi
b6cc3bc4
AD
15320 ;;
15321 esac
15322 $rm -f try.* try core
b4eb6b3d
JH
15323 ;;
15324esac
b4eb6b3d
JH
15325set d_safebcpy
15326eval $setvar
15327
15328: can memcpy handle overlapping blocks?
b6cc3bc4 15329echo " "
b4eb6b3d 15330val="$undef"
b6cc3bc4
AD
15331case "$d_memmove" in
15332"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15333*) case "$d_memcpy" in
15334 "$define")
15335 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15336 $cat >try.c <<EOCP
b4eb6b3d
JH
15337#$i_memory I_MEMORY
15338#$i_stdlib I_STDLIB
15339#$i_string I_STRING
15340#$i_unistd I_UNISTD
15341EOCP
15342 $cat >>try.c <<'EOCP'
15343#include <stdio.h>
15344#ifdef I_MEMORY
15345# include <memory.h>
15346#endif
15347#ifdef I_STDLIB
15348# include <stdlib.h>
15349#endif
15350#ifdef I_STRING
15351# include <string.h>
15352#else
15353# include <strings.h>
15354#endif
15355#ifdef I_UNISTD
15356# include <unistd.h> /* Needed for NetBSD */
15357#endif
15358int main()
15359{
15360char buf[128], abc[128];
15361char *b;
15362int len;
15363int off;
15364int align;
15365
15366/* Copy "abcde..." string to char abc[] so that gcc doesn't
15367 try to store the string in read-only memory. */
15368memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15369
15370for (align = 7; align >= 0; align--) {
15371 for (len = 36; len; len--) {
15372 b = buf+align;
15373 memcpy(b, abc, len);
15374 for (off = 1; off <= len; off++) {
15375 memcpy(b+off, b, len);
15376 memcpy(b, b+off, len);
15377 if (memcmp(b, abc, len))
15378 exit(1);
15379 }
15380 }
15381}
15382exit(0);
15383}
15384EOCP
b6cc3bc4
AD
15385 set try
15386 if eval $compile_ok; then
15387 if ./try 2>/dev/null; then
15388 echo "Yes, it can."
15389 val="$define"
15390 else
15391 echo "It can't, sorry."
15392 fi
b4eb6b3d 15393 else
b6cc3bc4 15394 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15395 fi
b6cc3bc4
AD
15396 ;;
15397 esac
15398 $rm -f try.* try core
b4eb6b3d
JH
15399 ;;
15400esac
b4eb6b3d
JH
15401set d_safemcpy
15402eval $setvar
15403
15404: can memcmp be trusted to compare relative magnitude?
15405val="$undef"
15406case "$d_memcmp" in
15407"$define")
15408 echo " "
15409 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15410 $cat >try.c <<EOCP
15411#$i_memory I_MEMORY
15412#$i_stdlib I_STDLIB
15413#$i_string I_STRING
15414#$i_unistd I_UNISTD
15415EOCP
15416 $cat >>try.c <<'EOCP'
15417#include <stdio.h>
15418#ifdef I_MEMORY
15419# include <memory.h>
15420#endif
15421#ifdef I_STDLIB
36adc09b 15422# include <stdlib.h>
b4eb6b3d
JH
15423#endif
15424#ifdef I_STRING
15425# include <string.h>
15426#else
15427# include <strings.h>
15428#endif
15429#ifdef I_UNISTD
15430# include <unistd.h> /* Needed for NetBSD */
15431#endif
15432int main()
15433{
15434char a = -1;
15435char b = 0;
15436if ((a < b) && memcmp(&a, &b, 1) < 0)
15437 exit(1);
15438exit(0);
15439}
15440EOCP
15441 set try
15442 if eval $compile_ok; then
5440bc8e 15443 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15444 echo "Yes, it can."
15445 val="$define"
15446 else
15447 echo "No, it can't (it uses signed chars)."
15448 fi
15449 else
15450 echo "(I can't compile the test program, so we'll assume not...)"
15451 fi
15452 ;;
15453esac
15454$rm -f try.* try core
15455set d_sanemcmp
15456eval $setvar
15457
ef9f17be
JH
15458: see if prototype for sbrk is available
15459echo " "
15460set d_sbrkproto sbrk $i_unistd unistd.h
15461eval $hasproto
15462
b4eb6b3d
JH
15463: see if select exists
15464set select d_select
15465eval $inlibc
15466
15467: see if semctl exists
15468set semctl d_semctl
15469eval $inlibc
15470
15471: see if semget exists
15472set semget d_semget
15473eval $inlibc
15474
15475: see if semop exists
15476set semop d_semop
15477eval $inlibc
15478
15479: see how much of the 'sem*(2)' library is present.
15480h_sem=true
15481echo " "
15482case "$d_semctl$d_semget$d_semop" in
15483*"$undef"*) h_sem=false;;
15484esac
15485case "$osname" in
15486freebsd)
15487 case "`ipcs 2>&1`" in
15488 "SVID messages"*"not configured"*)
15489 echo "Your $osname does not have the sem*(2) configured." >&4
15490 h_sem=false
15491 val="$undef"
15492 set semctl d_semctl
15493 eval $setvar
15494 set semget d_semget
15495 eval $setvar
15496 set semop d_semop
15497 eval $setvar
15498 ;;
15499 esac
15500 ;;
15501esac
15502: we could also check for sys/ipc.h ...
15503if $h_sem && $test `./findhdr sys/sem.h`; then
15504 echo "You have the full sem*(2) library." >&4
15505 val="$define"
15506else
15507 echo "You don't have the full sem*(2) library." >&4
15508 val="$undef"
15509fi
15510set d_sem
15511eval $setvar
15512
15513: see whether sys/sem.h defines union semun
15514echo " "
15515$cat > try.c <<'END'
15516#include <sys/types.h>
15517#include <sys/ipc.h>
15518#include <sys/sem.h>
15519int main () { union semun semun; semun.buf = 0; }
15520END
15521set try
15522if eval $compile; then
15523 echo "You have union semun in <sys/sem.h>." >&4
15524 val="$define"
15525else
15526 echo "You do not have union semun in <sys/sem.h>." >&4
15527 val="$undef"
15528fi
2fad75a1 15529$rm -f try try.c
b4eb6b3d
JH
15530set d_union_semun
15531eval $setvar
15532
15533: see how to do semctl IPC_STAT
15534case "$d_sem" in
15535$define)
b4eb6b3d
JH
15536 echo " "
15537 $cat > try.h <<END
15538#ifndef S_IRUSR
15539# ifdef S_IREAD
15540# define S_IRUSR S_IREAD
15541# define S_IWUSR S_IWRITE
15542# define S_IXUSR S_IEXEC
15543# else
15544# define S_IRUSR 0400
15545# define S_IWUSR 0200
15546# define S_IXUSR 0100
15547# endif
15548# define S_IRGRP (S_IRUSR>>3)
15549# define S_IWGRP (S_IWUSR>>3)
15550# define S_IXGRP (S_IXUSR>>3)
15551# define S_IROTH (S_IRUSR>>6)
15552# define S_IWOTH (S_IWUSR>>6)
15553# define S_IXOTH (S_IXUSR>>6)
15554#endif
15555#ifndef S_IRWXU
15556# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15557# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15558# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15559#endif
15560END
2fad75a1
JH
15561 : see whether semctl IPC_STAT can use union semun
15562 val="$undef"
15563 case "$d_semctl_semun" in
15564 '')
15565 $cat > try.c <<END
b4eb6b3d
JH
15566#include <sys/types.h>
15567#include <sys/ipc.h>
15568#include <sys/sem.h>
15569#include <sys/stat.h>
15570#include <stdio.h>
15571#include <errno.h>
15572#include "try.h"
15573#ifndef errno
15574extern int errno;
15575#endif
15576#$d_union_semun HAS_UNION_SEMUN
15577int main() {
15578 union semun
15579#ifndef HAS_UNION_SEMUN
15580 {
15581 int val;
15582 struct semid_ds *buf;
15583 unsigned short *array;
15584 }
15585#endif
15586 arg;
15587 int sem, st;
15588
15589#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15590 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15591 if (sem > -1) {
15592 struct semid_ds argbuf;
15593 arg.buf = &argbuf;
15594# ifdef IPC_STAT
15595 st = semctl(sem, 0, IPC_STAT, arg);
15596 if (st == 0)
15597 printf("semun\n");
15598 else
15599# endif /* IPC_STAT */
15600 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15601# ifdef IPC_RMID
15602 if (semctl(sem, 0, IPC_RMID, arg) != 0)
15603# endif /* IPC_RMID */
15604 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15605 } else
15606#endif /* IPC_PRIVATE && ... */
15607 printf("semget failed: errno = %d\n", errno);
15608 return 0;
15609}
15610END
2fad75a1
JH
15611 set try
15612 if eval $compile; then
15613 xxx=`$run ./try`
15614 case "$xxx" in
15615 semun) val="$define" ;;
15616 esac
15617 fi
15618 $rm -f try try.c
15619 ;;
15620 esac
b4eb6b3d
JH
15621 set d_semctl_semun
15622 eval $setvar
15623 case "$d_semctl_semun" in
15624 $define)
15625 echo "You can use union semun for semctl IPC_STAT." >&4
15626 also='also'
15627 ;;
15628 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15629 also=''
15630 ;;
15631 esac
15632
15633 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15634 val="$undef"
15635 case "$d_semctl_semid_ds" in
15636 '')
15637 $cat > try.c <<'END'
b4eb6b3d
JH
15638#include <sys/types.h>
15639#include <sys/ipc.h>
15640#include <sys/sem.h>
15641#include <sys/stat.h>
15642#include "try.h"
15643#include <stdio.h>
15644#include <errno.h>
15645#ifndef errno
15646extern int errno;
15647#endif
15648int main() {
15649 struct semid_ds arg;
15650 int sem, st;
15651
15652#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15653 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15654 if (sem > -1) {
15655# ifdef IPC_STAT
15656 st = semctl(sem, 0, IPC_STAT, &arg);
15657 if (st == 0)
15658 printf("semid_ds\n");
15659 else
15660# endif /* IPC_STAT */
15661 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15662# ifdef IPC_RMID
15663 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15664# endif /* IPC_RMID */
15665 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15666 } else
15667#endif /* IPC_PRIVATE && ... */
15668 printf("semget failed: errno = %d\n", errno);
15669
15670 return 0;
15671}
15672END
2fad75a1
JH
15673 set try
15674 if eval $compile; then
15675 xxx=`$run ./try`
15676 case "$xxx" in
15677 semid_ds) val="$define" ;;
15678 esac
15679 fi
15680 $rm -f try try.c
15681 ;;
15682 esac
b4eb6b3d
JH
15683 set d_semctl_semid_ds
15684 eval $setvar
15685 case "$d_semctl_semid_ds" in
15686 $define)
15687 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15688 ;;
15689 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15690 ;;
15691 esac
15692 $rm -f try.h
15693 ;;
15694*) val="$undef"
15695
15696 # We do not have the full sem*(2) library, so assume we can not
15697 # use either.
15698
15699 set d_semctl_semun
15700 eval $setvar
15701
15702 set d_semctl_semid_ds
15703 eval $setvar
15704 ;;
15705esac
15706
4e0554ec
JH
15707: see if sendmsg exists
15708set sendmsg d_sendmsg
15709eval $inlibc
15710
b4eb6b3d
JH
15711: see if setegid exists
15712set setegid d_setegid
15713eval $inlibc
15714
15715: see if seteuid exists
15716set seteuid d_seteuid
15717eval $inlibc
15718
15719: see if setgrent exists
15720set setgrent d_setgrent
15721eval $inlibc
15722
10bc17b6
JH
15723: see if setgrent_r exists
15724set setgrent_r d_setgrent_r
15725eval $inlibc
15726case "$d_setgrent_r" in
15727"$define")
15728 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15729 case "$d_setgrent_r_proto:$usethreads" in
15730 ":define") d_setgrent_r_proto=define
a48ec845
JH
15731 set d_setgrent_r_proto setgrent_r $hdrs
15732 eval $hasproto ;;
15733 *) ;;
15734 esac
15735 case "$d_setgrent_r_proto" in
15736 define)
10bc17b6
JH
15737 case "$setgrent_r_proto" in
15738 ''|0) try='int setgrent_r(FILE**);'
15739 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15740 esac
15741 case "$setgrent_r_proto" in
15742 ''|0) try='void setgrent_r(FILE**);'
15743 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15744 esac
15745 case "$setgrent_r_proto" in
90e831dc 15746 ''|0) d_setgrent_r=undef
10bc17b6 15747 setgrent_r_proto=0
a48ec845 15748 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15749 * ) case "$setgrent_r_proto" in
15750 REENTRANT_PROTO*) ;;
15751 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15752 esac
15753 echo "Prototype: $try" ;;
15754 esac
15755 ;;
c18e646a
JH
15756 *) case "$usethreads" in
15757 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15758 esac
90e831dc
SB
15759 d_setgrent_r=undef
15760 setgrent_r_proto=0
c18e646a 15761 ;;
a48ec845
JH
15762 esac
15763 ;;
10bc17b6
JH
15764*) setgrent_r_proto=0
15765 ;;
15766esac
15767
b4eb6b3d
JH
15768: see if sethostent exists
15769set sethostent d_sethent
15770eval $inlibc
15771
10bc17b6
JH
15772: see if sethostent_r exists
15773set sethostent_r d_sethostent_r
15774eval $inlibc
15775case "$d_sethostent_r" in
15776"$define")
15777 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15778 case "$d_sethostent_r_proto:$usethreads" in
15779 ":define") d_sethostent_r_proto=define
a48ec845
JH
15780 set d_sethostent_r_proto sethostent_r $hdrs
15781 eval $hasproto ;;
15782 *) ;;
15783 esac
15784 case "$d_sethostent_r_proto" in
15785 define)
10bc17b6
JH
15786 case "$sethostent_r_proto" in
15787 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15788 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15789 esac
15790 case "$sethostent_r_proto" in
15791 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15792 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15793 esac
15794 case "$sethostent_r_proto" in
90e831dc 15795 ''|0) d_sethostent_r=undef
10bc17b6 15796 sethostent_r_proto=0
a48ec845 15797 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15798 * ) case "$sethostent_r_proto" in
15799 REENTRANT_PROTO*) ;;
15800 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15801 esac
15802 echo "Prototype: $try" ;;
15803 esac
15804 ;;
c18e646a
JH
15805 *) case "$usethreads" in
15806 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15807 esac
90e831dc
SB
15808 d_sethostent_r=undef
15809 sethostent_r_proto=0
c18e646a 15810 ;;
a48ec845
JH
15811 esac
15812 ;;
10bc17b6
JH
15813*) sethostent_r_proto=0
15814 ;;
15815esac
15816
4e0554ec
JH
15817: see if setitimer exists
15818set setitimer d_setitimer
15819eval $inlibc
15820
b4eb6b3d
JH
15821: see if setlinebuf exists
15822set setlinebuf d_setlinebuf
15823eval $inlibc
15824
15825: see if setlocale exists
15826set setlocale d_setlocale
15827eval $inlibc
15828
10bc17b6
JH
15829: see if locale.h is available
15830set locale.h i_locale
15831eval $inhdr
15832
15833: see if setlocale_r exists
15834set setlocale_r d_setlocale_r
15835eval $inlibc
15836case "$d_setlocale_r" in
15837"$define")
15838 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
15839 case "$d_setlocale_r_proto:$usethreads" in
15840 ":define") d_setlocale_r_proto=define
a48ec845
JH
15841 set d_setlocale_r_proto setlocale_r $hdrs
15842 eval $hasproto ;;
15843 *) ;;
15844 esac
15845 case "$d_setlocale_r_proto" in
15846 define)
10bc17b6
JH
15847 case "$setlocale_r_proto" in
15848 ''|0) try='int setlocale_r(int, const char*, char*, int);'
15849 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15850 esac
15851 case "$setlocale_r_proto" in
90e831dc 15852 ''|0) d_setlocale_r=undef
10bc17b6 15853 setlocale_r_proto=0
a48ec845 15854 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15855 * ) case "$setlocale_r_proto" in
15856 REENTRANT_PROTO*) ;;
15857 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15858 esac
15859 echo "Prototype: $try" ;;
15860 esac
15861 ;;
c18e646a
JH
15862 *) case "$usethreads" in
15863 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15864 esac
90e831dc
SB
15865 d_setlocale_r=undef
15866 setlocale_r_proto=0
c18e646a 15867 ;;
a48ec845
JH
15868 esac
15869 ;;
10bc17b6
JH
15870*) setlocale_r_proto=0
15871 ;;
15872esac
15873
b4eb6b3d
JH
15874: see if setnetent exists
15875set setnetent d_setnent
15876eval $inlibc
15877
10bc17b6
JH
15878: see if setnetent_r exists
15879set setnetent_r d_setnetent_r
15880eval $inlibc
15881case "$d_setnetent_r" in
15882"$define")
15883 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15884 case "$d_setnetent_r_proto:$usethreads" in
15885 ":define") d_setnetent_r_proto=define
a48ec845
JH
15886 set d_setnetent_r_proto setnetent_r $hdrs
15887 eval $hasproto ;;
15888 *) ;;
15889 esac
15890 case "$d_setnetent_r_proto" in
15891 define)
10bc17b6
JH
15892 case "$setnetent_r_proto" in
15893 ''|0) try='int setnetent_r(int, struct netent_data*);'
15894 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15895 esac
15896 case "$setnetent_r_proto" in
15897 ''|0) try='void setnetent_r(int, struct netent_data*);'
15898 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15899 esac
15900 case "$setnetent_r_proto" in
90e831dc 15901 ''|0) d_setnetent_r=undef
10bc17b6 15902 setnetent_r_proto=0
a48ec845 15903 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15904 * ) case "$setnetent_r_proto" in
15905 REENTRANT_PROTO*) ;;
15906 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15907 esac
15908 echo "Prototype: $try" ;;
15909 esac
15910 ;;
c18e646a
JH
15911 *) case "$usethreads" in
15912 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15913 esac
90e831dc
SB
15914 d_setnetent_r=undef
15915 setnetent_r_proto=0
c18e646a 15916 ;;
a48ec845
JH
15917 esac
15918 ;;
10bc17b6
JH
15919*) setnetent_r_proto=0
15920 ;;
15921esac
15922
b4eb6b3d
JH
15923: see if setprotoent exists
15924set setprotoent d_setpent
15925eval $inlibc
15926
15927: see if setpgid exists
15928set setpgid d_setpgid
15929eval $inlibc
15930
15931: see if setpgrp2 exists
15932set setpgrp2 d_setpgrp2
15933eval $inlibc
15934
15935: see if setpriority exists
15936set setpriority d_setprior
15937eval $inlibc
15938
15939: see if setproctitle exists
15940set setproctitle d_setproctitle
15941eval $inlibc
15942
10bc17b6
JH
15943: see if setprotoent_r exists
15944set setprotoent_r d_setprotoent_r
15945eval $inlibc
15946case "$d_setprotoent_r" in
15947"$define")
15948 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15949 case "$d_setprotoent_r_proto:$usethreads" in
15950 ":define") d_setprotoent_r_proto=define
a48ec845
JH
15951 set d_setprotoent_r_proto setprotoent_r $hdrs
15952 eval $hasproto ;;
15953 *) ;;
15954 esac
15955 case "$d_setprotoent_r_proto" in
15956 define)
10bc17b6
JH
15957 case "$setprotoent_r_proto" in
15958 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15959 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15960 esac
15961 case "$setprotoent_r_proto" in
15962 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15963 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15964 esac
15965 case "$setprotoent_r_proto" in
90e831dc 15966 ''|0) d_setprotoent_r=undef
10bc17b6 15967 setprotoent_r_proto=0
a48ec845 15968 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15969 * ) case "$setprotoent_r_proto" in
15970 REENTRANT_PROTO*) ;;
15971 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15972 esac
15973 echo "Prototype: $try" ;;
15974 esac
15975 ;;
c18e646a
JH
15976 *) case "$usethreads" in
15977 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15978 esac
90e831dc
SB
15979 d_setprotoent_r=undef
15980 setprotoent_r_proto=0
c18e646a 15981 ;;
a48ec845
JH
15982 esac
15983 ;;
10bc17b6
JH
15984*) setprotoent_r_proto=0
15985 ;;
15986esac
15987
b4eb6b3d
JH
15988: see if setpwent exists
15989set setpwent d_setpwent
15990eval $inlibc
15991
10bc17b6
JH
15992: see if setpwent_r exists
15993set setpwent_r d_setpwent_r
15994eval $inlibc
15995case "$d_setpwent_r" in
15996"$define")
15997 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
15998 case "$d_setpwent_r_proto:$usethreads" in
15999 ":define") d_setpwent_r_proto=define
a48ec845
JH
16000 set d_setpwent_r_proto setpwent_r $hdrs
16001 eval $hasproto ;;
16002 *) ;;
16003 esac
16004 case "$d_setpwent_r_proto" in
16005 define)
10bc17b6
JH
16006 case "$setpwent_r_proto" in
16007 ''|0) try='int setpwent_r(FILE**);'
16008 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16009 esac
16010 case "$setpwent_r_proto" in
16011 ''|0) try='void setpwent_r(FILE**);'
16012 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16013 esac
16014 case "$setpwent_r_proto" in
90e831dc 16015 ''|0) d_setpwent_r=undef
10bc17b6 16016 setpwent_r_proto=0
a48ec845 16017 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16018 * ) case "$setpwent_r_proto" in
16019 REENTRANT_PROTO*) ;;
16020 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16021 esac
16022 echo "Prototype: $try" ;;
16023 esac
16024 ;;
c18e646a
JH
16025 *) case "$usethreads" in
16026 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16027 esac
90e831dc
SB
16028 d_setpwent_r=undef
16029 setpwent_r_proto=0
c18e646a 16030 ;;
a48ec845
JH
16031 esac
16032 ;;
10bc17b6
JH
16033*) setpwent_r_proto=0
16034 ;;
16035esac
16036
b4eb6b3d
JH
16037: see if setregid exists
16038set setregid d_setregid
16039eval $inlibc
16040set setresgid d_setresgid
16041eval $inlibc
16042
16043: see if setreuid exists
16044set setreuid d_setreuid
16045eval $inlibc
16046set setresuid d_setresuid
16047eval $inlibc
16048
16049: see if setrgid exists
16050set setrgid d_setrgid
16051eval $inlibc
16052
16053: see if setruid exists
16054set setruid d_setruid
16055eval $inlibc
16056
16057: see if setservent exists
16058set setservent d_setsent
16059eval $inlibc
16060
10bc17b6
JH
16061: see if setservent_r exists
16062set setservent_r d_setservent_r
16063eval $inlibc
16064case "$d_setservent_r" in
16065"$define")
16066 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16067 case "$d_setservent_r_proto:$usethreads" in
16068 ":define") d_setservent_r_proto=define
a48ec845
JH
16069 set d_setservent_r_proto setservent_r $hdrs
16070 eval $hasproto ;;
16071 *) ;;
16072 esac
16073 case "$d_setservent_r_proto" in
16074 define)
10bc17b6
JH
16075 case "$setservent_r_proto" in
16076 ''|0) try='int setservent_r(int, struct servent_data*);'
16077 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16078 esac
16079 case "$setservent_r_proto" in
16080 ''|0) try='void setservent_r(int, struct servent_data*);'
16081 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16082 esac
16083 case "$setservent_r_proto" in
90e831dc 16084 ''|0) d_setservent_r=undef
10bc17b6 16085 setservent_r_proto=0
a48ec845 16086 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16087 * ) case "$setservent_r_proto" in
16088 REENTRANT_PROTO*) ;;
16089 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16090 esac
16091 echo "Prototype: $try" ;;
16092 esac
16093 ;;
c18e646a
JH
16094 *) case "$usethreads" in
16095 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16096 esac
90e831dc
SB
16097 d_setservent_r=undef
16098 setservent_r_proto=0
c18e646a 16099 ;;
a48ec845
JH
16100 esac
16101 ;;
10bc17b6
JH
16102*) setservent_r_proto=0
16103 ;;
16104esac
16105
b4eb6b3d
JH
16106: see if setsid exists
16107set setsid d_setsid
16108eval $inlibc
16109
16110: see if setvbuf exists
16111set setvbuf d_setvbuf
16112eval $inlibc
16113
16114: see if sfio.h is available
16115set sfio.h i_sfio
16116eval $inhdr
16117
16118
16119: see if sfio library is available
16120case "$i_sfio" in
16121$define)
16122 val=''
16123 set sfreserve val
16124 eval $inlibc
16125 ;;
16126*)
16127 val="$undef"
16128 ;;
16129esac
16130: Ok, but do we want to use it.
16131case "$val" in
16132$define)
16133 case "$usesfio" in
16134 true|$define|[yY]*) dflt='y';;
16135 *) dflt='n';;
16136 esac
16137 echo "$package can use the sfio library, but it is experimental."
16138 case "$useperlio" in
16139 "$undef")
16140 echo "For sfio also the PerlIO abstraction layer is needed."
16141 echo "Earlier you said you wouldn't want that."
16142 ;;
16143 esac
16144 rp="You seem to have sfio available, do you want to try using it?"
16145 . ./myread
16146 case "$ans" in
16147 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16148 useperlio="$define"
16149 val="$define"
16150 ;;
16151 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16152 val="$undef"
b4eb6b3d
JH
16153 ;;
16154 esac
16155 ;;
16156*) case "$usesfio" in
16157 true|$define|[yY]*)
16158 echo "Sorry, cannot find sfio on this machine." >&4
16159 echo "Ignoring your setting of usesfio=$usesfio." >&4
16160 val="$undef"
16161 ;;
16162 esac
16163 ;;
16164esac
16165set d_sfio
16166eval $setvar
16167case "$d_sfio" in
16168$define) usesfio='true';;
16169*) usesfio='false';;
16170esac
3659ebf1
JH
16171case "$d_sfio" in
16172$define) ;;
16173*) : Remove sfio from list of libraries to use
7483f793
JH
16174 case "$libs" in
16175 *-lsfio*)
16176 echo "Removing unneeded -lsfio from library list" >&4
16177 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16178 shift
16179 libs="$*"
16180 echo "libs = $libs" >&4
16181 ;;
16182 esac
3659ebf1
JH
16183;;
16184esac
16185
b4eb6b3d
JH
16186
16187: see if shmctl exists
16188set shmctl d_shmctl
16189eval $inlibc
16190
16191: see if shmget exists
16192set shmget d_shmget
16193eval $inlibc
16194
16195: see if shmat exists
16196set shmat d_shmat
16197eval $inlibc
16198: see what shmat returns
16199case "$d_shmat" in
16200"$define")
16201 $cat >shmat.c <<'END'
16202#include <sys/shm.h>
16203void *shmat();
16204END
16205 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16206 shmattype='void *'
16207 else
16208 shmattype='char *'
16209 fi
16210 echo "and it returns ($shmattype)." >&4
16211 : see if a prototype for shmat is available
16212 xxx=`./findhdr sys/shm.h`
16213 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16214 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16215 val="$define"
16216 else
16217 val="$undef"
16218 fi
16219 $rm -f shmat.[co]
16220 ;;
16221*)
16222 val="$undef"
16223 ;;
16224esac
16225set d_shmatprototype
16226eval $setvar
16227
16228: see if shmdt exists
16229set shmdt d_shmdt
16230eval $inlibc
16231
16232: see how much of the 'shm*(2)' library is present.
16233h_shm=true
16234echo " "
16235case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16236*"$undef"*) h_shm=false;;
16237esac
16238case "$osname" in
16239freebsd)
16240 case "`ipcs 2>&1`" in
16241 "SVID shared memory"*"not configured"*)
16242 echo "Your $osname does not have the shm*(2) configured." >&4
16243 h_shm=false
16244 val="$undef"
16245 set shmctl d_shmctl
16246 evat $setvar
16247 set shmget d_shmget
16248 evat $setvar
16249 set shmat d_shmat
16250 evat $setvar
16251 set shmdt d_shmdt
16252 evat $setvar
16253 ;;
16254 esac
16255 ;;
16256esac
16257: we could also check for sys/ipc.h ...
16258if $h_shm && $test `./findhdr sys/shm.h`; then
16259 echo "You have the full shm*(2) library." >&4
16260 val="$define"
16261else
16262 echo "You don't have the full shm*(2) library." >&4
16263 val="$undef"
16264fi
16265set d_shm
16266eval $setvar
16267
16268echo " "
16269: see if we have sigaction
16270if set sigaction val -f d_sigaction; eval $csym; $val; then
16271 echo 'sigaction() found.' >&4
073b6de5 16272 $cat > try.c <<EOP
b4eb6b3d
JH
16273#include <stdio.h>
16274#include <sys/types.h>
16275#include <signal.h>
073b6de5
JH
16276#$i_stdlib I_STDLIB
16277#ifdef I_STDLIB
16278#include <stdlib.h>
16279#endif
b4eb6b3d
JH
16280int main()
16281{
16282 struct sigaction act, oact;
16283 act.sa_flags = 0;
16284 oact.sa_handler = 0;
16285 /* so that act and oact are used */
16286 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16287}
16288EOP
16289 set try
16290 if eval $compile_ok; then
16291 val="$define"
16292 else
16293 echo "But you don't seem to have a useable struct sigaction." >&4
16294 val="$undef"
16295 fi
16296else
16297 echo 'sigaction NOT found.' >&4
16298 val="$undef"
16299fi
16300set d_sigaction; eval $setvar
16301$rm -f try try$_o try.c
16302
983dbef6
JH
16303: see if sigprocmask exists
16304set sigprocmask d_sigprocmask
16305eval $inlibc
16306
b4eb6b3d
JH
16307: see if sigsetjmp exists
16308echo " "
16309case "$d_sigsetjmp" in
16310'')
c727eafa 16311 $cat >try.c <<EOP
b4eb6b3d 16312#include <setjmp.h>
d1daaddf
JH
16313#$i_stdlib I_STDLIB
16314#ifdef I_STDLIB
16315#include <stdlib.h>
16316#endif
b4eb6b3d
JH
16317sigjmp_buf env;
16318int set = 1;
16319int main()
16320{
16321 if (sigsetjmp(env,1))
16322 exit(set);
16323 set = 0;
16324 siglongjmp(env, 1);
16325 exit(1);
16326}
16327EOP
16328 set try
16329 if eval $compile; then
5440bc8e 16330 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16331 echo "POSIX sigsetjmp found." >&4
16332 val="$define"
16333 else
16334 $cat >&4 <<EOM
16335Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16336I'll ignore them.
16337EOM
16338 val="$undef"
16339 fi
16340 else
16341 echo "sigsetjmp not found." >&4
16342 val="$undef"
16343 fi
16344 ;;
16345*) val="$d_sigsetjmp"
16346 case "$d_sigsetjmp" in
16347 $define) echo "POSIX sigsetjmp found." >&4;;
16348 $undef) echo "sigsetjmp not found." >&4;;
16349 esac
16350 ;;
16351esac
16352set d_sigsetjmp
16353eval $setvar
16354$rm -f try.c try
16355
49a78c82
JH
16356: see if sockatmark exists
16357set sockatmark d_sockatmark
16358eval $inlibc
16359
2ef53570
JH
16360: see if prototype for sockatmark is available
16361echo " "
16362set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16363eval $hasproto
16364
b4eb6b3d
JH
16365: see if socks5_init exists
16366set socks5_init d_socks5_init
16367eval $inlibc
16368
10bc17b6
JH
16369: see if srand48_r exists
16370set srand48_r d_srand48_r
16371eval $inlibc
16372case "$d_srand48_r" in
16373"$define")
16374 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16375 case "$d_srand48_r_proto:$usethreads" in
16376 ":define") d_srand48_r_proto=define
a48ec845
JH
16377 set d_srand48_r_proto srand48_r $hdrs
16378 eval $hasproto ;;
16379 *) ;;
16380 esac
16381 case "$d_srand48_r_proto" in
16382 define)
10bc17b6
JH
16383 case "$srand48_r_proto" in
16384 ''|0) try='int srand48_r(long, struct drand48_data*);'
16385 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16386 esac
16387 case "$srand48_r_proto" in
90e831dc 16388 ''|0) d_srand48_r=undef
10bc17b6 16389 srand48_r_proto=0
a48ec845 16390 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16391 * ) case "$srand48_r_proto" in
16392 REENTRANT_PROTO*) ;;
16393 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16394 esac
16395 echo "Prototype: $try" ;;
16396 esac
16397 ;;
c18e646a
JH
16398 *) case "$usethreads" in
16399 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16400 esac
90e831dc
SB
16401 d_srand48_r=undef
16402 srand48_r_proto=0
c18e646a 16403 ;;
a48ec845
JH
16404 esac
16405 ;;
10bc17b6
JH
16406*) srand48_r_proto=0
16407 ;;
16408esac
16409
16410: see if srandom_r exists
16411set srandom_r d_srandom_r
16412eval $inlibc
16413case "$d_srandom_r" in
16414"$define")
16415 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16416 case "$d_srandom_r_proto:$usethreads" in
16417 ":define") d_srandom_r_proto=define
a48ec845
JH
16418 set d_srandom_r_proto srandom_r $hdrs
16419 eval $hasproto ;;
16420 *) ;;
16421 esac
16422 case "$d_srandom_r_proto" in
16423 define)
10bc17b6
JH
16424 case "$srandom_r_proto" in
16425 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16426 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16427 esac
16428 case "$srandom_r_proto" in
90e831dc 16429 ''|0) d_srandom_r=undef
10bc17b6 16430 srandom_r_proto=0
a48ec845 16431 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16432 * ) case "$srandom_r_proto" in
16433 REENTRANT_PROTO*) ;;
16434 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16435 esac
16436 echo "Prototype: $try" ;;
16437 esac
16438 ;;
c18e646a
JH
16439 *) case "$usethreads" in
16440 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16441 esac
90e831dc
SB
16442 d_srandom_r=undef
16443 srandom_r_proto=0
c18e646a 16444 ;;
a48ec845
JH
16445 esac
16446 ;;
10bc17b6
JH
16447*) srandom_r_proto=0
16448 ;;
16449esac
16450
eef837ea
JH
16451: see if prototype for setresgid is available
16452echo " "
16453set d_sresgproto setresgid $i_unistd unistd.h
16454eval $hasproto
16455
640374d0
JH
16456: see if prototype for setresuid is available
16457echo " "
16458set d_sresuproto setresuid $i_unistd unistd.h
16459eval $hasproto
16460
b4eb6b3d
JH
16461: see if sys/stat.h is available
16462set sys/stat.h i_sysstat
16463eval $inhdr
16464
16465
16466: see if stat knows about block sizes
16467echo " "
16468echo "Checking to see if your struct stat has st_blocks field..." >&4
16469set d_statblks stat st_blocks $i_sysstat sys/stat.h
16470eval $hasfield
16471
16472
16473: see if this is a sys/vfs.h system
16474set sys/vfs.h i_sysvfs
16475eval $inhdr
16476
16477
16478: see if this is a sys/statfs.h system
16479set sys/statfs.h i_sysstatfs
16480eval $inhdr
16481
16482
16483echo " "
16484echo "Checking to see if your system supports struct statfs..." >&4
16485set 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
16486eval $hasstruct
16487case "$d_statfs_s" in
16488"$define") echo "Yes, it does." ;;
16489*) echo "No, it doesn't." ;;
16490esac
16491
16492
16493
16494: see if struct statfs knows about f_flags
16495case "$d_statfs_s" in
16496define)
16497 echo " "
16498 echo "Checking to see if your struct statfs has f_flags field..." >&4
16499 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
16500 eval $hasfield
16501 ;;
16502*) val="$undef"
16503 set d_statfs_f_flags
16504 eval $setvar
16505 ;;
16506esac
16507case "$d_statfs_f_flags" in
16508"$define") echo "Yes, it does." ;;
16509*) echo "No, it doesn't." ;;
16510esac
16511
b4eb6b3d
JH
16512$cat >&4 <<EOM
16513Checking how to access stdio streams by file descriptor number...
16514EOM
16515case "$stdio_stream_array" in
16516'') $cat >try.c <<EOCP
16517#include <stdio.h>
16518int main() {
16519 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16520 printf("yes\n");
16521}
16522EOCP
16523 for s in _iob __iob __sF
16524 do
16525 set try -DSTDIO_STREAM_ARRAY=$s
16526 if eval $compile; then
5440bc8e 16527 case "`$run ./try`" in
b4eb6b3d
JH
16528 yes) stdio_stream_array=$s; break ;;
16529 esac
16530 fi
16531 done
16532 $rm -f try.* try$exe_ext
16533esac
16534case "$stdio_stream_array" in
16535'') $cat >&4 <<EOM
16536I can't figure out how to access stdio streams by file descriptor number.
16537EOM
16538 d_stdio_stream_array="$undef"
16539 ;;
16540*) $cat >&4 <<EOM
16541You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16542EOM
16543 d_stdio_stream_array="$define"
16544 ;;
16545esac
16546
16547: see if strcoll exists
16548set strcoll d_strcoll
16549eval $inlibc
16550
16551: check for structure copying
16552echo " "
16553echo "Checking to see if your C compiler can copy structs..." >&4
16554$cat >try.c <<'EOCP'
76f47787 16555int main()
b4eb6b3d
JH
16556{
16557 struct blurfl {
16558 int dyick;
16559 } foo, bar;
16560
16561 foo = bar;
16562}
16563EOCP
16564if $cc -c try.c >/dev/null 2>&1 ; then
16565 val="$define"
16566 echo "Yup, it can."
16567else
16568 val="$undef"
16569 echo "Nope, it can't."
16570fi
16571set d_strctcpy
16572eval $setvar
16573$rm -f try.*
16574
16575: see if strerror and/or sys_errlist[] exist
16576echo " "
16577if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16578 if set strerror val -f d_strerror; eval $csym; $val; then
16579 echo 'strerror() found.' >&4
16580 d_strerror="$define"
16581 d_strerrm='strerror(e)'
16582 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16583 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16584 d_syserrlst="$define"
16585 else
16586 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16587 d_syserrlst="$undef"
16588 fi
16589 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16590 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16591 echo 'strerror() found in string header.' >&4
16592 d_strerror="$define"
16593 d_strerrm='strerror(e)'
16594 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16595 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16596 d_syserrlst="$define"
16597 else
16598 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16599 d_syserrlst="$undef"
16600 fi
16601 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16602 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16603 d_strerror="$undef"
16604 d_syserrlst="$define"
16605 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16606 else
16607 echo 'strerror() and sys_errlist[] NOT found.' >&4
16608 d_strerror="$undef"
16609 d_syserrlst="$undef"
16610 d_strerrm='"unknown"'
16611 fi
16612fi
16613
10bc17b6
JH
16614: see if strerror_r exists
16615set strerror_r d_strerror_r
16616eval $inlibc
16617case "$d_strerror_r" in
16618"$define")
16619 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16620 case "$d_strerror_r_proto:$usethreads" in
16621 ":define") d_strerror_r_proto=define
a48ec845
JH
16622 set d_strerror_r_proto strerror_r $hdrs
16623 eval $hasproto ;;
16624 *) ;;
16625 esac
16626 case "$d_strerror_r_proto" in
16627 define)
10bc17b6
JH
16628 case "$strerror_r_proto" in
16629 ''|0) try='int strerror_r(int, char*, size_t);'
16630 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16631 esac
16632 case "$strerror_r_proto" in
16633 ''|0) try='int strerror_r(int, char*, int);'
16634 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16635 esac
16636 case "$strerror_r_proto" in
16637 ''|0) try='char* strerror_r(int, char*, size_t);'
16638 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16639 esac
16640 case "$strerror_r_proto" in
90e831dc 16641 ''|0) d_strerror_r=undef
10bc17b6 16642 strerror_r_proto=0
a48ec845 16643 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16644 * ) case "$strerror_r_proto" in
16645 REENTRANT_PROTO*) ;;
16646 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16647 esac
16648 echo "Prototype: $try" ;;
16649 esac
16650 ;;
c18e646a
JH
16651 *) case "$usethreads" in
16652 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16653 esac
90e831dc
SB
16654 d_strerror_r=undef
16655 strerror_r_proto=0
c18e646a 16656 ;;
a48ec845
JH
16657 esac
16658 ;;
10bc17b6
JH
16659*) strerror_r_proto=0
16660 ;;
16661esac
16662
b3c85772
JH
16663: see if strftime exists
16664set strftime d_strftime
16665eval $inlibc
16666
08c92000
MB
16667: see if strlcat exists
16668set strlcat d_strlcat
16669eval $inlibc
16670
16671: see if strlcpy exists
16672set strlcpy d_strlcpy
16673eval $inlibc
16674
b4eb6b3d
JH
16675: see if strtod exists
16676set strtod d_strtod
16677eval $inlibc
16678
16679: see if strtol exists
16680set strtol d_strtol
16681eval $inlibc
16682
16683: see if strtold exists
16684set strtold d_strtold
16685eval $inlibc
16686
16687: see if strtoll exists
16688set strtoll d_strtoll
16689eval $inlibc
16690
16691case "$d_longlong-$d_strtoll" in
16692"$define-$define")
16693 $cat <<EOM
16694Checking whether your strtoll() works okay...
16695EOM
16696 $cat >try.c <<'EOCP'
16697#include <errno.h>
16698#ifdef __hpux
16699#define strtoll __strtoll
16700#endif
e75931a7
YST
16701#ifdef __EMX__
16702#define strtoll _strtoll
16703#endif
b4eb6b3d
JH
16704#include <stdio.h>
16705extern long long int strtoll(char *s, char **, int);
16706static int bad = 0;
16707int check(char *s, long long ell, int een) {
16708 long long gll;
16709 errno = 0;
16710 gll = strtoll(s, 0, 10);
16711 if (!((gll == ell) && (errno == een)))
16712 bad++;
16713}
16714int main() {
16715 check(" 1", 1LL, 0);
16716 check(" 0", 0LL, 0);
16717 check("-1", -1LL, 0);
16718 check("-9223372036854775808", -9223372036854775808LL, 0);
16719 check("-9223372036854775808", -9223372036854775808LL, 0);
16720 check(" 9223372036854775807", 9223372036854775807LL, 0);
16721 check("-9223372036854775808", -9223372036854775808LL, 0);
16722 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16723 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16724 if (!bad)
16725 printf("ok\n");
16726}
16727EOCP
16728 set try
16729 if eval $compile; then
5440bc8e 16730 yyy=`$run ./try`
e75931a7 16731 case "$yyy" in
b4eb6b3d
JH
16732 ok) echo "Your strtoll() seems to be working okay." ;;
16733 *) cat <<EOM >&4
16734Your strtoll() doesn't seem to be working okay.
16735EOM
16736 d_strtoll="$undef"
16737 ;;
69eadf66 16738 esac
e75931a7
YST
16739 else
16740 echo "(I can't seem to compile the test program--assuming it doesn't)"
16741 d_strtoll="$undef"
b4eb6b3d
JH
16742 fi
16743 ;;
16744esac
16745
28e5dec8
JH
16746: see if strtoq exists
16747set strtoq d_strtoq
16748eval $inlibc
16749
b4eb6b3d
JH
16750: see if strtoul exists
16751set strtoul d_strtoul
16752eval $inlibc
16753
d0e6d399
NC
16754case "$d_strtoul" in
16755"$define")
16756 $cat <<EOM
16757Checking whether your strtoul() works okay...
16758EOM
16759 $cat >try.c <<'EOCP'
16760#include <errno.h>
16761#include <stdio.h>
16762extern unsigned long int strtoul(char *s, char **, int);
16763static int bad = 0;
16764void check(char *s, unsigned long eul, int een) {
16765 unsigned long gul;
16766 errno = 0;
16767 gul = strtoul(s, 0, 10);
16768 if (!((gul == eul) && (errno == een)))
16769 bad++;
16770}
16771int main() {
16772 check(" 1", 1L, 0);
16773 check(" 0", 0L, 0);
16774EOCP
16775 case "$longsize" in
16776 8)
16777 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16778 check("18446744073709551615", 18446744073709551615UL, 0);
16779 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16780#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16781 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16782 check("-18446744073709551614", 2, 0);
16783 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16784 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16785 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16786#endif
d0e6d399
NC
16787EOCP
16788 ;;
16789 4)
16790 $cat >>try.c <<'EOCP'
16791 check("4294967295", 4294967295UL, 0);
16792 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16793#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16794 check("-1", 4294967295UL, 0);
16795 check("-4294967294", 2, 0);
16796 check("-4294967295", 1, 0);
16797 check("-4294967296", 4294967295UL, ERANGE);
16798 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16799#endif
d0e6d399
NC
16800EOCP
16801 ;;
16802 *)
16803: Should we write these tests to be more portable by sprintf-ing
16804: ~0 and then manipulating that char string as input for strtol?
16805 ;;
16806 esac
16807 $cat >>try.c <<'EOCP'
16808 if (!bad)
16809 printf("ok\n");
16810 return 0;
16811}
16812EOCP
16813 set try
16814 if eval $compile; then
5440bc8e 16815 case "`$run ./try`" in
d0e6d399
NC
16816 ok) echo "Your strtoul() seems to be working okay." ;;
16817 *) cat <<EOM >&4
16818Your strtoul() doesn't seem to be working okay.
16819EOM
16820 d_strtoul="$undef"
16821 ;;
16822 esac
16823 fi
16824 ;;
16825esac
16826
b4eb6b3d
JH
16827: see if strtoull exists
16828set strtoull d_strtoull
16829eval $inlibc
16830
16831case "$d_longlong-$d_strtoull" in
16832"$define-$define")
16833 $cat <<EOM
16834Checking whether your strtoull() works okay...
16835EOM
16836 $cat >try.c <<'EOCP'
16837#include <errno.h>
16838#ifdef __hpux
16839#define strtoull __strtoull
16840#endif
16841#include <stdio.h>
16842extern unsigned long long int strtoull(char *s, char **, int);
16843static int bad = 0;
16844int check(char *s, long long eull, int een) {
16845 long long gull;
16846 errno = 0;
16847 gull = strtoull(s, 0, 10);
16848 if (!((gull == eull) && (errno == een)))
16849 bad++;
16850}
16851int main() {
d0e6d399
NC
16852 check(" 1", 1LL, 0);
16853 check(" 0", 0LL, 0);
16854 check("18446744073709551615", 18446744073709551615ULL, 0);
16855 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16856#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16857 check("-1", 18446744073709551615ULL, 0);
16858 check("-18446744073709551614", 2LL, 0);
16859 check("-18446744073709551615", 1LL, 0);
16860 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16861 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16862#endif
b4eb6b3d
JH
16863 if (!bad)
16864 printf("ok\n");
16865}
16866EOCP
16867 set try
16868 if eval $compile; then
5440bc8e 16869 case "`$run ./try`" in
b4eb6b3d
JH
16870 ok) echo "Your strtoull() seems to be working okay." ;;
16871 *) cat <<EOM >&4
16872Your strtoull() doesn't seem to be working okay.
16873EOM
16874 d_strtoull="$undef"
16875 ;;
16876 esac
16877 fi
16878 ;;
16879esac
16880
16881: see if strtouq exists
16882set strtouq d_strtouq
16883eval $inlibc
16884
d0e6d399
NC
16885case "$d_strtouq" in
16886"$define")
16887 $cat <<EOM
16888Checking whether your strtouq() works okay...
16889EOM
16890 $cat >try.c <<'EOCP'
16891#include <errno.h>
16892#include <stdio.h>
16893extern unsigned long long int strtouq(char *s, char **, int);
16894static int bad = 0;
16895void check(char *s, unsigned long long eull, int een) {
16896 unsigned long long gull;
16897 errno = 0;
16898 gull = strtouq(s, 0, 10);
16899 if (!((gull == eull) && (errno == een)))
16900 bad++;
16901}
16902int main() {
16903 check(" 1", 1LL, 0);
16904 check(" 0", 0LL, 0);
16905 check("18446744073709551615", 18446744073709551615ULL, 0);
16906 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16907#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
16908 check("-1", 18446744073709551615ULL, 0);
16909 check("-18446744073709551614", 2LL, 0);
16910 check("-18446744073709551615", 1LL, 0);
16911 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16912 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16913#endif
d0e6d399
NC
16914 if (!bad)
16915 printf("ok\n");
16916 return 0;
16917}
16918EOCP
16919 set try
16920 if eval $compile; then
5440bc8e 16921 case "`$run ./try`" in
d0e6d399
NC
16922 ok) echo "Your strtouq() seems to be working okay." ;;
16923 *) cat <<EOM >&4
16924Your strtouq() doesn't seem to be working okay.
16925EOM
16926 d_strtouq="$undef"
16927 ;;
16928 esac
16929 fi
16930 ;;
16931esac
16932
b4eb6b3d
JH
16933: see if strxfrm exists
16934set strxfrm d_strxfrm
16935eval $inlibc
16936
16937: see if symlink exists
16938set symlink d_symlink
16939eval $inlibc
16940
16941: see if syscall exists
16942set syscall d_syscall
16943eval $inlibc
16944
2ef53570
JH
16945: see if prototype for syscall is available
16946echo " "
16947set d_syscallproto syscall $i_unistd unistd.h
16948eval $hasproto
16949
b4eb6b3d
JH
16950: see if sysconf exists
16951set sysconf d_sysconf
16952eval $inlibc
16953
16954: see if system exists
16955set system d_system
16956eval $inlibc
16957
16958: see if tcgetpgrp exists
16959set tcgetpgrp d_tcgetpgrp
16960eval $inlibc
16961
16962: see if tcsetpgrp exists
16963set tcsetpgrp d_tcsetpgrp
16964eval $inlibc
16965
16966: see if prototype for telldir is available
16967echo " "
16968set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16969eval $hasproto
16970
ad493445
MB
16971: see if time exists
16972echo " "
16973if test "X$d_time" = X -o X"$timetype" = X; then
16974 if set time val -f d_time; eval $csym; $val; then
16975 echo 'time() found.' >&4
16976 val="$define"
16977 rp="What is the type returned by time() on this system?"
16978 set time_t timetype long stdio.h sys/types.h
16979 eval $typedef_ask
16980 else
16981 echo 'time() not found, hope that will do.' >&4
16982 val="$undef"
16983 timetype='int';
16984 fi
16985 set d_time
16986 eval $setvar
16987fi
16988
b4eb6b3d
JH
16989: see if this is a sys/times.h system
16990set sys/times.h i_systimes
16991eval $inhdr
16992
16993: see if times exists
16994echo " "
16995if set times val -f d_times; eval $csym; $val; then
16996 echo 'times() found.' >&4
16997 d_times="$define"
16998 inc=''
16999 case "$i_systimes" in
17000 "$define") inc='sys/times.h';;
17001 esac
17002 rp="What is the type returned by times() on this system?"
17003 set clock_t clocktype long stdio.h sys/types.h $inc
17004 eval $typedef_ask
17005else
17006 echo 'times() NOT found, hope that will do.' >&4
17007 d_times="$undef"
17008 clocktype='int'
17009fi
17010
10bc17b6
JH
17011: see if tmpnam_r exists
17012set tmpnam_r d_tmpnam_r
17013eval $inlibc
17014case "$d_tmpnam_r" in
17015"$define")
31ee0cb7 17016 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17017 case "$d_tmpnam_r_proto:$usethreads" in
17018 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17019 set d_tmpnam_r_proto tmpnam_r $hdrs
17020 eval $hasproto ;;
17021 *) ;;
17022 esac
17023 case "$d_tmpnam_r_proto" in
17024 define)
10bc17b6
JH
17025 case "$tmpnam_r_proto" in
17026 ''|0) try='char* tmpnam_r(char*);'
17027 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17028 esac
17029 case "$tmpnam_r_proto" in
90e831dc 17030 ''|0) d_tmpnam_r=undef
10bc17b6 17031 tmpnam_r_proto=0
a48ec845 17032 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17033 * ) case "$tmpnam_r_proto" in
17034 REENTRANT_PROTO*) ;;
17035 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17036 esac
17037 echo "Prototype: $try" ;;
17038 esac
17039 ;;
c18e646a
JH
17040 *) case "$usethreads" in
17041 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17042 esac
90e831dc
SB
17043 d_tmpnam_r=undef
17044 tmpnam_r_proto=0
c18e646a 17045 ;;
a48ec845
JH
17046 esac
17047 ;;
10bc17b6
JH
17048*) tmpnam_r_proto=0
17049 ;;
17050esac
17051
b4eb6b3d
JH
17052: see if truncate exists
17053set truncate d_truncate
17054eval $inlibc
17055
10bc17b6
JH
17056: see if ttyname_r exists
17057set ttyname_r d_ttyname_r
17058eval $inlibc
17059case "$d_ttyname_r" in
17060"$define")
17061 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17062 case "$d_ttyname_r_proto:$usethreads" in
17063 ":define") d_ttyname_r_proto=define
a48ec845
JH
17064 set d_ttyname_r_proto ttyname_r $hdrs
17065 eval $hasproto ;;
17066 *) ;;
17067 esac
17068 case "$d_ttyname_r_proto" in
17069 define)
10bc17b6
JH
17070 case "$ttyname_r_proto" in
17071 ''|0) try='int ttyname_r(int, char*, size_t);'
17072 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17073 esac
17074 case "$ttyname_r_proto" in
17075 ''|0) try='int ttyname_r(int, char*, int);'
17076 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17077 esac
17078 case "$ttyname_r_proto" in
17079 ''|0) try='char* ttyname_r(int, char*, int);'
17080 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17081 esac
17082 case "$ttyname_r_proto" in
90e831dc 17083 ''|0) d_ttyname_r=undef
10bc17b6 17084 ttyname_r_proto=0
a48ec845 17085 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17086 * ) case "$ttyname_r_proto" in
17087 REENTRANT_PROTO*) ;;
17088 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17089 esac
17090 echo "Prototype: $try" ;;
17091 esac
17092 ;;
c18e646a
JH
17093 *) case "$usethreads" in
17094 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17095 esac
90e831dc
SB
17096 d_ttyname_r=undef
17097 ttyname_r_proto=0
c18e646a 17098 ;;
a48ec845
JH
17099 esac
17100 ;;
10bc17b6
JH
17101*) ttyname_r_proto=0
17102 ;;
17103esac
17104
b4eb6b3d
JH
17105: see if tzname[] exists
17106echo " "
17107if set tzname val -a d_tzname; eval $csym; $val; then
17108 val="$define"
17109 echo 'tzname[] found.' >&4
17110else
17111 val="$undef"
17112 echo 'tzname[] NOT found.' >&4
17113fi
17114set d_tzname
17115eval $setvar
17116
4e0554ec
JH
17117case "$osname" in
17118next|rhapsody|darwin) multiarch="$define" ;;
17119esac
17120case "$multiarch" in
17121''|[nN]*) multiarch="$undef" ;;
17122esac
17123
24412007 17124: check for ordering of bytes in a UV
4e0554ec 17125echo " "
5440bc8e 17126case "$usecrosscompile$multiarch" in
4e0554ec
JH
17127*$define*)
17128 $cat <<EOM
17129You seem to be either cross-compiling or doing a multiarchitecture build,
17130skipping the byteorder check.
17131
17132EOM
5440bc8e 17133 byteorder='ffff'
4e0554ec
JH
17134 ;;
17135*)
17136 case "$byteorder" in
17137 '')
17138 $cat <<'EOM'
17139In the following, larger digits indicate more significance. A big-endian
17140machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17141little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17142machines may have weird orders like 3412. A Cray will report 87654321,
17143an Alpha will report 12345678. If the test program works the default is
17144probably right.
17145I'm now running the test program...
17146EOM
24412007 17147 $cat >try.c <<EOCP
4e0554ec 17148#include <stdio.h>
55954f19
JH
17149#$i_stdlib I_STDLIB
17150#ifdef I_STDLIB
17151#include <stdlib.h>
17152#endif
24412007
JH
17153#include <sys/types.h>
17154typedef $uvtype UV;
4e0554ec
JH
17155int main()
17156{
17157 int i;
17158 union {
24412007
JH
17159 UV l;
17160 char c[$uvsize];
4e0554ec
JH
17161 } u;
17162
24412007 17163 if ($uvsize > 4)
b5ded3e5 17164 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17165 else
a4c53327 17166 u.l = (UV)0x04030201;
24412007 17167 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17168 printf("%c", u.c[i]+'0');
17169 printf("\n");
17170 exit(0);
17171}
17172EOCP
17173 xxx_prompt=y
17174 set try
17175 if eval $compile && ./try > /dev/null; then
5440bc8e 17176 dflt=`$run ./try`
4e0554ec
JH
17177 case "$dflt" in
17178 [1-4][1-4][1-4][1-4]|12345678|87654321)
17179 echo "(The test program ran ok.)"
17180 echo "byteorder=$dflt"
17181 xxx_prompt=n
17182 ;;
17183 ????|????????) echo "(The test program ran ok.)" ;;
17184 *) echo "(The test program didn't run right for some reason.)" ;;
17185 esac
17186 else
17187 dflt='4321'
17188 cat <<'EOM'
17189(I can't seem to compile the test program. Guessing big-endian...)
17190EOM
17191 fi
17192 case "$xxx_prompt" in
17193 y)
24412007 17194 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17195 . ./myread
17196 byteorder="$ans"
17197 ;;
17198 *) byteorder=$dflt
17199 ;;
17200 esac
17201 ;;
17202 esac
17203 $rm -f try.c try
17204 ;;
17205esac
17206
17207
17208$cat <<EOM
17209
17210Checking to see whether you can access character data unalignedly...
17211EOM
dc7b0a4f
JH
17212case "$d_u32align" in
17213'') $cat >try.c <<EOCP
4e0554ec 17214#include <stdio.h>
d1daaddf
JH
17215#$i_stdlib I_STDLIB
17216#ifdef I_STDLIB
17217#include <stdlib.h>
17218#endif
4e0554ec 17219#define U32 $u32type
d308175a
JH
17220#define BYTEORDER 0x$byteorder
17221#define U8 $u8type
9958dc3c
JH
17222#include <signal.h>
17223#ifdef SIGBUS
17224$signal_t bletch(s) int s; { exit(4); }
17225#endif
4e0554ec
JH
17226int main() {
17227#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17228 U8 buf[8];
4e0554ec
JH
17229 U32 *up;
17230 int i;
17231
17232 if (sizeof(U32) != 4) {
17233 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17234 exit(1);
17235 }
17236
17237 fflush(stdout);
17238
9958dc3c
JH
17239#ifdef SIGBUS
17240 signal(SIGBUS, bletch);
17241#endif
17242
8906a23e
JH
17243 buf[0] = 0;
17244 buf[1] = 0;
17245 buf[2] = 0;
17246 buf[3] = 1;
7eac3fd6 17247 buf[4] = 0;
8906a23e
JH
17248 buf[5] = 0;
17249 buf[6] = 0;
7eac3fd6 17250 buf[7] = 1;
8906a23e 17251
4e0554ec
JH
17252 for (i = 0; i < 4; i++) {
17253 up = (U32*)(buf + i);
17254 if (! ((*up == 1 << (8*i)) || /* big-endian */
17255 (*up == 1 << (8*(3-i))) /* little-endian */
17256 )
17257 )
17258 {
17259 printf("read failed (%x)\n", *up);
17260 exit(2);
17261 }
17262 }
17263
17264 /* write test */
17265 for (i = 0; i < 4; i++) {
17266 up = (U32*)(buf + i);
17267 *up = 0xBeef;
17268 if (*up != 0xBeef) {
17269 printf("write failed (%x)\n", *up);
17270 exit(3);
17271 }
17272 }
17273
17274 exit(0);
17275#else
17276 printf("1\n");
17277 exit(1);
17278#endif
17279 return 0;
17280}
17281EOCP
17282set try
17283if eval $compile_ok; then
d308175a 17284 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17285 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17286 case "$?" in
17287 0) cat >&4 <<EOM
17288You can access character data pretty unalignedly.
17289EOM
17290 d_u32align="$undef"
17291 ;;
17292 *) cat >&4 <<EOM
17293It seems that you must access character data in an aligned manner.
17294EOM
17295 d_u32align="$define"
17296 ;;
17297 esac
4e0554ec
JH
17298else
17299 rp='Can you access character data at unaligned addresses?'
17300 dflt='n'
17301 . ./myread
17302 case "$ans" in
17303 [yY]*) d_u32align="$undef" ;;
17304 *) d_u32align="$define" ;;
17305 esac
17306fi
e36b5403 17307$rm -f core core.try.* try.core
dc7b0a4f
JH
17308;;
17309esac
4e0554ec
JH
17310
17311: see if ualarm exists
17312set ualarm d_ualarm
17313eval $inlibc
17314
b4eb6b3d
JH
17315: see if umask exists
17316set umask d_umask
17317eval $inlibc
17318
758a5d79
JH
17319: see if unordered exists
17320set unordered d_unordered
17321eval $inlibc
17322
4e0554ec
JH
17323: see if usleep exists
17324set usleep d_usleep
17325eval $inlibc
17326
2ef53570
JH
17327: see if prototype for usleep is available
17328echo " "
17329set d_usleepproto usleep $i_unistd unistd.h
17330eval $hasproto
17331
b4eb6b3d
JH
17332: see if ustat exists
17333set ustat d_ustat
17334eval $inlibc
17335
17336: backward compatibility for d_hvfork
17337if test X$d_hvfork != X; then
17338 d_vfork="$d_hvfork"
17339 d_hvfork=''
17340fi
17341: see if there is a vfork
17342val=''
17343set vfork val
17344eval $inlibc
17345
17346: Ok, but do we want to use it. vfork is reportedly unreliable in
17347: perl on Solaris 2.x, and probably elsewhere.
17348case "$val" in
17349$define)
17350 echo " "
17351 case "$usevfork" in
17352 false) dflt='n';;
17353 *) dflt='y';;
17354 esac
17355 cat <<'EOM'
17356
17357Perl can only use a vfork() that doesn't suffer from strict
17358restrictions on calling functions or modifying global data in
17359the child. For example, glibc-2.1 contains such a vfork()
17360that is unsuitable. If your system provides a proper fork()
17361call, chances are that you do NOT want perl to use vfork().
17362
17363EOM
17364 rp="Do you still want to use vfork()?"
17365 . ./myread
17366 case "$ans" in
17367 y|Y) ;;
17368 *)
17369 echo "Ok, we won't use vfork()."
17370 val="$undef"
17371 ;;
17372 esac
17373 ;;
17374esac
17375set d_vfork
17376eval $setvar
17377case "$d_vfork" in
17378$define) usevfork='true';;
17379*) usevfork='false';;
17380esac
17381
b4eb6b3d
JH
17382: see if closedir exists
17383set closedir d_closedir
17384eval $inlibc
17385
17386case "$d_closedir" in
17387"$define")
17388 echo " "
17389 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17390 cat > try.c <<EOM
b4eb6b3d
JH
17391#$i_dirent I_DIRENT /**/
17392#$i_sysdir I_SYS_DIR /**/
17393#$i_sysndir I_SYS_NDIR /**/
17394#$i_systypes I_SYS_TYPES /**/
17395
17396#if defined(I_SYS_TYPES)
17397#include <sys/types.h>
17398#endif
17399#if defined(I_DIRENT)
17400#include <dirent.h>
17401#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17402#include <sys/dir.h>
17403#endif
17404#else
17405#ifdef I_SYS_NDIR
17406#include <sys/ndir.h>
17407#else
17408#ifdef I_SYS_DIR
17409#ifdef hp9000s500
17410#include <ndir.h> /* may be wrong in the future */
17411#else
17412#include <sys/dir.h>
17413#endif
17414#endif
17415#endif
17416#endif
17417int main() { return closedir(opendir(".")); }
17418EOM
5440bc8e 17419 set try
b4eb6b3d 17420 if eval $compile_ok; then
5440bc8e 17421 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17422 echo "Yes, it does."
17423 val="$undef"
17424 else
17425 echo "No, it doesn't."
17426 val="$define"
17427 fi
17428 else
17429 echo "(I can't seem to compile the test program--assuming it doesn't)"
17430 val="$define"
17431 fi
17432 ;;
17433*)
17434 val="$undef";
17435 ;;
17436esac
17437set d_void_closedir
17438eval $setvar
5440bc8e 17439$rm -f try try.*
b4eb6b3d
JH
17440: see if there is a wait4
17441set wait4 d_wait4
17442eval $inlibc
17443
17444: see if waitpid exists
17445set waitpid d_waitpid
17446eval $inlibc
17447
17448: see if wcstombs exists
17449set wcstombs d_wcstombs
17450eval $inlibc
17451
17452: see if wctomb exists
17453set wctomb d_wctomb
17454eval $inlibc
17455
4e0554ec
JH
17456: see if writev exists
17457set writev d_writev
17458eval $inlibc
17459
b4eb6b3d
JH
17460: preserve RCS keywords in files with variable substitution, grrr
17461Date='$Date'
17462Id='$Id'
17463Log='$Log'
17464RCSfile='$RCSfile'
17465Revision='$Revision'
17466
b4eb6b3d
JH
17467: check for alignment requirements
17468echo " "
5440bc8e 17469case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17470*$define*)
17471 $cat <<EOM
17472You seem to be either cross-compiling or doing a multiarchitecture build,
17473skipping the memory alignment check.
17474
17475EOM
17476 case "$alignbytes" in
17477 '') alignbytes=8 ;;
17478 esac
17479 ;;
17480*)
17481 case "$alignbytes" in
17482 '') echo "Checking alignment constraints..." >&4
17483 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17484 $cat >try.c <<'EOCP'
17485typedef long double NV;
17486EOCP
17487 else
17488 $cat >try.c <<'EOCP'
17489typedef double NV;
17490EOCP
17491 fi
17492 $cat >>try.c <<'EOCP'
17493#include <stdio.h>
17494struct foobar {
17495 char foo;
17496 NV bar;
17497} try_algn;
17498int main()
17499{
17500 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17501 return(0);
17502}
17503EOCP
17504 set try
17505 if eval $compile_ok; then
5440bc8e 17506 dflt=`$run ./try`
b4eb6b3d
JH
17507 else
17508 dflt='8'
17509 echo "(I can't seem to compile the test program...)"
17510 fi
17511 ;;
17512 *) dflt="$alignbytes"
17513 ;;
17514 esac
17515 rp="Doubles must be aligned on a how-many-byte boundary?"
17516 . ./myread
17517 alignbytes="$ans"
17518 $rm -f try.c try
17519 ;;
17520esac
17521
17522
17523: set the base revision
17524baserev=5.0
17525
3099fc99 17526: how do we concatenate cpp tokens here?
b4eb6b3d 17527echo " "
3099fc99 17528echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17529$cat >cpp_stuff.c <<'EOCP'
17530#define RCAT(a,b)a/**/b
17531#define ACAT(a,b)a ## b
17532RCAT(Rei,ser)
17533ACAT(Cir,cus)
17534EOCP
17535$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17536if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17537 echo "Oh! Smells like ANSI's been here." >&4
17538 echo "We can catify or stringify, separately or together!"
17539 cpp_stuff=42
17540elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17541 echo "Ah, yes! The good old days!" >&4
17542 echo "However, in the good old days we don't know how to stringify and"
17543 echo "catify at the same time."
17544 cpp_stuff=1
17545else
17546 $cat >&4 <<EOM
3099fc99
CW
17547Hmm, I don't seem to be able to concatenate tokens with your cpp.
17548You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17549EOM
17550 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17551fi
17552$rm -f cpp_stuff.*
17553
17554: see if this is a db.h system
17555set db.h i_db
17556eval $inhdr
17557
17558case "$i_db" in
17559$define)
17560 : Check db version.
17561 echo " "
17562 echo "Checking Berkeley DB version ..." >&4
17563 $cat >try.c <<EOCP
17564#$d_const HASCONST
17565#ifndef HASCONST
17566#define const
17567#endif
17568#include <sys/types.h>
17569#include <stdio.h>
55954f19
JH
17570#$i_stdlib I_STDLIB
17571#ifdef I_STDLIB
17572#include <stdlib.h>
17573#endif
b4eb6b3d 17574#include <db.h>
640374d0 17575int main(int argc, char *argv[])
b4eb6b3d
JH
17576{
17577#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17578 int Major, Minor, Patch ;
17579 unsigned long Version ;
17580 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17581 if (argc == 2) {
17582 printf("%d %d %d %d %d %d\n",
17583 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17584 Major, Minor, Patch);
17585 exit(0);
17586 }
17587 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17588
17589 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17590 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17591 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17592 Major, Minor, Patch) ;
17593
17594 /* check that db.h & libdb are compatible */
17595 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17596 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17597 exit(3);
17598 }
17599
640374d0 17600 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17601
17602 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17603 + DB_VERSION_PATCH ;
17604
17605 /* needs to be >= 2.3.4 */
17606 if (Version < 2003004) {
17607 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17608 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17609 exit(2);
17610 }
17611
17612 exit(0);
17613#else
17614#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17615 if (argc == 2) {
17616 printf("1 0 0\n");
17617 exit(0);
17618 }
17619 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17620 exit(0); /* DB version < 2: the coast is clear. */
17621#else
17622 exit(1); /* <db.h> not Berkeley DB? */
17623#endif
17624#endif
17625}
17626EOCP
17627 set try
5440bc8e 17628 if eval $compile_ok && $run ./try; then
b4eb6b3d 17629 echo 'Looks OK.' >&4
5440bc8e 17630 set `$run ./try 1`
640374d0
JH
17631 db_version_major=$1
17632 db_version_minor=$2
17633 db_version_patch=$3
b4eb6b3d
JH
17634 else
17635 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17636 i_db=$undef
17637 case " $libs " in
17638 *"-ldb "*)
17639 : Remove db from list of libraries to use
17640 echo "Removing unusable -ldb from library list" >&4
17641 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17642 shift
17643 libs="$*"
17644 echo "libs = $libs" >&4
17645 ;;
17646 esac
17647 fi
17648 $rm -f try.*
17649 ;;
17650esac
17651
17652case "$i_db" in
17653define)
17654 : Check the return type needed for hash
17655 echo " "
17656 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17657 $cat >try.c <<EOCP
17658#$d_const HASCONST
17659#ifndef HASCONST
17660#define const
17661#endif
17662#include <sys/types.h>
17663#include <db.h>
17664
17665#ifndef DB_VERSION_MAJOR
17666u_int32_t hash_cb (ptr, size)
17667const void *ptr;
17668size_t size;
17669{
17670}
17671HASHINFO info;
17672int main()
17673{
17674 info.hash = hash_cb;
17675}
17676#endif
17677EOCP
17678 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17679 if $contains warning try.out >>/dev/null 2>&1 ; then
17680 db_hashtype='int'
17681 else
17682 db_hashtype='u_int32_t'
17683 fi
17684 else
17685 : XXX Maybe we should just give up here.
17686 db_hashtype=u_int32_t
17687 $cat try.out >&4
17688 echo "Help: I can't seem to compile the db test program." >&4
17689 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17690 fi
17691 $rm -f try.*
17692 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17693 ;;
17694*) db_hashtype=u_int32_t
17695 ;;
17696esac
17697case "$i_db" in
17698define)
17699 : Check the return type needed for prefix
17700 echo " "
17701 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17702 cat >try.c <<EOCP
17703#$d_const HASCONST
17704#ifndef HASCONST
17705#define const
17706#endif
17707#include <sys/types.h>
17708#include <db.h>
17709
17710#ifndef DB_VERSION_MAJOR
17711size_t prefix_cb (key1, key2)
17712const DBT *key1;
17713const DBT *key2;
17714{
17715}
17716BTREEINFO info;
17717int main()
17718{
17719 info.prefix = prefix_cb;
17720}
17721#endif
17722EOCP
17723 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17724 if $contains warning try.out >>/dev/null 2>&1 ; then
17725 db_prefixtype='int'
17726 else
17727 db_prefixtype='size_t'
17728 fi
17729 else
17730 db_prefixtype='size_t'
17731 : XXX Maybe we should just give up here.
17732 $cat try.out >&4
17733 echo "Help: I can't seem to compile the db test program." >&4
17734 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17735 fi
17736 $rm -f try.*
17737 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17738 ;;
17739*) db_prefixtype='size_t'
17740 ;;
17741esac
17742
b4eb6b3d
JH
17743
17744: How can we generate normalized random numbers ?
17745echo " "
17746echo "Looking for a random number function..." >&4
17747case "$randfunc" in
17748'')
17749 if set drand48 val -f; eval $csym; $val; then
17750 dflt="drand48"
17751 echo "Good, found drand48()." >&4
17752 elif set random val -f; eval $csym; $val; then
17753 dflt="random"
17754 echo "OK, found random()." >&4
17755 else
17756 dflt="rand"
17757 echo "Yick, looks like I have to use rand()." >&4
17758 fi
17759 echo " "
17760 ;;
17761*)
17762 dflt="$randfunc"
17763 ;;
17764esac
17765cont=true
17766
17767case "$ccflags" in
17768*-Dmy_rand=*|*-Dmy_srand=*)
17769 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17770 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17771 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17772 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17773 ;;
17774esac
17775
17776while $test "$cont"; do
17777 rp="Use which function to generate random numbers?"
17778 . ./myread
17779 if $test "$ans" = "$dflt"; then
17780 : null
17781 else
17782 randbits=''
17783 fi
17784 randfunc="$ans"
17785 if set $ans val -f; eval $csym; $val; then
17786 cont=''
17787 else
17788 dflt=y
17789 rp="I cannot find function $ans. Use that name anyway?"
17790 . ./myread
17791 dflt=rand
17792 case "$ans" in
17793 [yY]*) cont='';;
17794 esac
17795 fi
17796 case "$cont" in
17797 '')
17798 case "$randfunc" in
17799 drand48)
17800 drand01="drand48()"
17801 seedfunc="srand48"
17802 randbits=48
17803 randseedtype=long
17804 ;;
17805 rand|random)
17806 case "$randbits" in
17807 '')
17808echo "Checking to see how many bits your $randfunc() function produces..." >&4
17809 $cat >try.c <<EOCP
17810#$i_unistd I_UNISTD
17811#$i_stdlib I_STDLIB
17812#include <stdio.h>
17813#ifdef I_UNISTD
17814# include <unistd.h>
17815#endif
17816#ifdef I_STDLIB
17817# include <stdlib.h>
17818#endif
17819int main()
17820{
17821 register int i;
17822 register unsigned long tmp;
17823 register unsigned long max = 0L;
17824
17825 for (i = 1000; i; i--) {
17826 tmp = (unsigned long) $randfunc();
17827 if (tmp > max) max = tmp;
17828 }
17829 for (i = 0; max; i++)
17830 max /= 2;
17831 printf("%d\n",i);
17832}
17833EOCP
17834 set try
17835 if eval $compile_ok; then
17836 dflt=`try`
17837 else
17838 dflt='?'
17839 echo "(I can't seem to compile the test program...)"
17840 fi
17841 ;;
17842 *)
17843 dflt="$randbits"
17844 ;;
17845 esac
17846 rp="How many bits does your $randfunc() function produce?"
17847 . ./myread
17848 randbits="$ans"
17849 $rm -f try.c try
17850 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17851 seedfunc="s$randfunc"
17852 randseedtype=unsigned
17853 ;;
17854 *)
17855 dflt="31"
17856 rp="How many bits does your $randfunc() function produce?"
17857 . ./myread
17858 randbits="$ans"
17859 seedfunc="s$randfunc"
17860 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17861 if set $seedfunc val -f; eval $csym; $val; then
17862 echo "(Using $seedfunc() to seed random generator)"
17863 else
17864 echo "(Warning: no $seedfunc() to seed random generator)"
17865 seedfunc=rand
17866 fi
17867 randseedtype=unsigned
17868 ;;
17869 esac
17870 ;;
17871 esac
17872done
17873
17874echo " "
17875echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17876$cat >try.c <<'EOM'
b4eb6b3d
JH
17877int main()
17878{
17879 if ('M'==0xd4) return 0;
17880 return 1;
17881}
17882EOM
17883
17884val=$undef
5440bc8e 17885set try
b4eb6b3d 17886if eval $compile_ok; then
5440bc8e 17887 if $run ./try; then
b4eb6b3d
JH
17888 echo "You seem to speak EBCDIC." >&4
17889 val="$define"
17890 else
5440bc8e 17891 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
17892 fi
17893else
17894 echo "I'm unable to compile the test program." >&4
17895 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17896fi
5440bc8e 17897$rm -f try try.*
b4eb6b3d
JH
17898set ebcdic
17899eval $setvar
17900
17901echo " "
17902$cat >&4 <<EOM
17903Checking how to flush all pending stdio output...
17904EOM
17905# I only know how to find the first 32 possibly open files on SunOS.
17906# See also hints/sunos_4_1.sh and util.c --AD
17907case "$osname" in
17908sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17909esac
17910$cat >>try.c <<EOCP
17911#include <stdio.h>
55954f19
JH
17912#$i_stdlib I_STDLIB
17913#ifdef I_STDLIB
17914#include <stdlib.h>
17915#endif
b4eb6b3d
JH
17916#$i_unistd I_UNISTD
17917#ifdef I_UNISTD
17918# include <unistd.h>
17919#endif
17920#$d_sysconf HAS_SYSCONF
17921#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17922#ifdef HAS_STDIO_STREAM_ARRAY
17923# define STDIO_STREAM_ARRAY $stdio_stream_array
17924#endif
17925int main() {
5440bc8e
JH
17926 FILE* p;
17927 unlink("try.out");
17928 p = fopen("try.out", "w");
b4eb6b3d
JH
17929#ifdef TRY_FPUTC
17930 fputc('x', p);
17931#else
17932# ifdef TRY_FPRINTF
17933 fprintf(p, "x");
17934# endif
17935#endif
17936#ifdef TRY_FFLUSH_NULL
17937 fflush(NULL);
17938#endif
17939#ifdef TRY_FFLUSH_ALL
17940 {
17941 long open_max = -1;
17942# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17943 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17944# else
17945# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17946 open_max = sysconf(_SC_OPEN_MAX);
17947# else
17948# ifdef FOPEN_MAX
17949 open_max = FOPEN_MAX;
17950# else
17951# ifdef OPEN_MAX
17952 open_max = OPEN_MAX;
17953# else
17954# ifdef _NFILE
17955 open_max = _NFILE;
17956# endif
17957# endif
17958# endif
17959# endif
17960# endif
17961# ifdef HAS_STDIO_STREAM_ARRAY
17962 if (open_max > 0) {
17963 long i;
17964 for (i = 0; i < open_max; i++)
17965 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17966 STDIO_STREAM_ARRAY[i]._file < open_max &&
17967 STDIO_STREAM_ARRAY[i]._flag)
17968 fflush(&STDIO_STREAM_ARRAY[i]);
17969 }
17970 }
17971# endif
17972#endif
17973 _exit(42);
17974}
17975EOCP
17976: first we have to find out how _not_ to flush
5440bc8e 17977$to try.c
b4eb6b3d
JH
17978if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17979 output=''
17980 set try -DTRY_FPUTC
17981 if eval $compile; then
fbe73d74 17982 $run ./try 2>/dev/null
28f5ac64 17983 code="$?"
5440bc8e 17984 $from try.out
28f5ac64 17985 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17986 output=-DTRY_FPUTC
17987 fi
17988 fi
17989 case "$output" in
17990 '')
17991 set try -DTRY_FPRINTF
b4eb6b3d 17992 if eval $compile; then
fbe73d74 17993 $run ./try 2>/dev/null
28f5ac64 17994 code="$?"
5440bc8e 17995 $from try.out
28f5ac64 17996 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17997 output=-DTRY_FPRINTF
17998 fi
17999 fi
18000 ;;
18001 esac
18002fi
18003: check for fflush NULL behaviour
18004case "$fflushNULL" in
18005'') set try -DTRY_FFLUSH_NULL $output
18006 if eval $compile; then
5440bc8e 18007 $run ./try 2>/dev/null
b4eb6b3d 18008 code="$?"
5440bc8e 18009 $from try.out
b4eb6b3d
JH
18010 if $test -s try.out -a "X$code" = X42; then
18011 fflushNULL="`$cat try.out`"
18012 else
18013 if $test "X$code" != X42; then
18014 $cat >&4 <<EOM
18015(If this test failed, don't worry, we'll try another method shortly.)
18016EOM
18017 fi
18018 fi
18019 fi
18020 $rm -f core try.core core.try.*
18021 case "$fflushNULL" in
18022 x) $cat >&4 <<EOM
18023Your fflush(NULL) works okay for output streams.
18024Let's see if it clobbers input pipes...
18025EOM
18026# As of mid-March 2000 all versions of Solaris appear to have a stdio
18027# bug that improperly flushes the input end of pipes. So we avoid the
18028# autoflush on fork/system/exec support for now. :-(
18029$cat >tryp.c <<EOCP
18030#include <stdio.h>
18031int
18032main(int argc, char **argv)
18033{
18034 char buf[1024];
18035 int i;
18036 char *bp = buf;
18037 while (1) {
18038 while ((i = getc(stdin)) != -1
18039 && (*bp++ = i) != '\n'
18040 && bp < &buf[1024])
18041 /* DO NOTHING */ ;
18042 *bp = '\0';
18043 fprintf(stdout, "%s", buf);
18044 fflush(NULL);
18045 if (i == -1)
18046 return 0;
18047 bp = buf;
18048 }
18049}
18050EOCP
18051 fflushNULL="$define"
18052 set tryp
18053 if eval $compile; then
18054 $rm -f tryp.out
5440bc8e 18055 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18056 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18057 $cat >&4 <<EOM
18058fflush(NULL) seems to behave okay with input streams.
18059EOM
18060 fflushNULL="$define"
18061 else
18062 $cat >&4 <<EOM
18063Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18064EOM
18065 fflushNULL="$undef"
18066 fi
18067 fi
18068 $rm -f core tryp.c tryp.core core.tryp.*
18069 ;;
18070 '') $cat >&4 <<EOM
18071Your fflush(NULL) isn't working (contrary to ANSI C).
18072EOM
18073 fflushNULL="$undef"
18074 ;;
18075 *) $cat >&4 <<EOM
18076Cannot figure out whether your fflush(NULL) works or not.
18077I'm assuming it doesn't (contrary to ANSI C).
18078EOM
18079 fflushNULL="$undef"
18080 ;;
18081 esac
18082 ;;
18083$define|true|[yY]*)
18084 fflushNULL="$define"
18085 ;;
18086*)
18087 fflushNULL="$undef"
18088 ;;
18089esac
18090: check explicit looping only if NULL did not work, and if the pipe
18091: bug does not show up on an explicit flush too
18092case "$fflushNULL" in
18093"$undef")
18094 $cat >tryp.c <<EOCP
18095#include <stdio.h>
18096int
18097main(int argc, char **argv)
18098{
18099 char buf[1024];
18100 int i;
18101 char *bp = buf;
18102 while (1) {
18103 while ((i = getc(stdin)) != -1
18104 && (*bp++ = i) != '\n'
18105 && bp < &buf[1024])
18106 /* DO NOTHING */ ;
18107 *bp = '\0';
18108 fprintf(stdout, "%s", buf);
18109 fflush(stdin);
18110 if (i == -1)
18111 return 0;
18112 bp = buf;
18113 }
18114}
18115EOCP
18116 set tryp
18117 if eval $compile; then
18118 $rm -f tryp.out
5440bc8e 18119 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18120 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18121 $cat >&4 <<EOM
18122Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18123EOM
18124 : now check for fflushall behaviour
18125 case "$fflushall" in
18126 '') set try -DTRY_FFLUSH_ALL $output
18127 if eval $compile; then
18128 $cat >&4 <<EOM
18129(Now testing the other method--but note that this also may fail.)
18130EOM
5440bc8e 18131 $run ./try 2>/dev/null
28f5ac64 18132 code=$?
fbe73d74 18133 $from try.out
28f5ac64 18134 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18135 fflushall="`$cat try.out`"
18136 fi
18137 fi
18138 $rm -f core try.core core.try.*
18139 case "$fflushall" in
18140 x) $cat >&4 <<EOM
18141Whew. Flushing explicitly all the stdio streams works.
18142EOM
18143 fflushall="$define"
18144 ;;
18145 '') $cat >&4 <<EOM
18146Sigh. Flushing explicitly all the stdio streams doesn't work.
18147EOM
18148 fflushall="$undef"
18149 ;;
18150 *) $cat >&4 <<EOM
18151Cannot figure out whether flushing stdio streams explicitly works or not.
18152I'm assuming it doesn't.
18153EOM
18154 fflushall="$undef"
18155 ;;
18156 esac
18157 ;;
18158 "$define"|true|[yY]*)
18159 fflushall="$define"
18160 ;;
18161 *)
18162 fflushall="$undef"
18163 ;;
18164 esac
18165 else
18166 $cat >&4 <<EOM
18167All is futile. Even fflush(stdin) clobbers input pipes!
18168EOM
18169 fflushall="$undef"
18170 fi
18171 else
18172 fflushall="$undef"
18173 fi
18174 $rm -f core tryp.c tryp.core core.tryp.*
18175 ;;
18176*) fflushall="$undef"
18177 ;;
18178esac
18179
18180case "$fflushNULL$fflushall" in
18181undefundef)
18182 $cat <<EOM
18183OK, I give up. I cannot figure out how to flush pending stdio output.
18184We won't be flushing handles at all before fork/exec/popen.
18185EOM
18186 ;;
18187esac
18188$rm -f try.* try$exe_ext
18189
18190: Store the full pathname to the ar program for use in the C program
18191: Respect a hint or command line value for full_ar.
18192case "$full_ar" in
18193'') full_ar=$ar ;;
18194esac
18195
18196: Store the full pathname to the sed program for use in the C program
18197full_sed=$sed
18198
18199: see what type gids are declared as in the kernel
18200echo " "
18201echo "Looking for the type for group ids returned by getgid()."
18202set gid_t gidtype xxx stdio.h sys/types.h
18203eval $typedef
18204case "$gidtype" in
18205xxx)
18206 xxx=`./findhdr sys/user.h`
18207 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18208 case $1 in
18209 unsigned) dflt="$1 $2" ;;
18210 *) dflt="$1" ;;
18211 esac
18212 ;;
18213*) dflt="$gidtype";;
18214esac
18215case "$gidtype" in
18216gid_t) echo "gid_t found." ;;
18217*) rp="What is the type for group ids returned by getgid()?"
18218 . ./myread
18219 gidtype="$ans"
18220 ;;
18221esac
18222
18223echo " "
18224case "$gidtype" in
18225*_t) zzz="$gidtype" ;;
18226*) zzz="gid" ;;
18227esac
18228echo "Checking the size of $zzz..." >&4
18229cat > try.c <<EOCP
18230#include <sys/types.h>
18231#include <stdio.h>
d1daaddf
JH
18232#$i_stdlib I_STDLIB
18233#ifdef I_STDLIB
18234#include <stdlib.h>
18235#endif
b4eb6b3d
JH
18236int main() {
18237 printf("%d\n", (int)sizeof($gidtype));
18238 exit(0);
18239}
18240EOCP
18241set try
18242if eval $compile_ok; then
5440bc8e 18243 yyy=`$run ./try`
b4eb6b3d
JH
18244 case "$yyy" in
18245 '') gidsize=4
18246 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18247 ;;
18248 *) gidsize=$yyy
18249 echo "Your $zzz is $gidsize bytes long."
18250 ;;
18251 esac
18252else
18253 gidsize=4
18254 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18255fi
18256
18257
18258echo " "
18259case "$gidtype" in
18260*_t) zzz="$gidtype" ;;
18261*) zzz="gid" ;;
18262esac
18263echo "Checking the sign of $zzz..." >&4
18264cat > try.c <<EOCP
18265#include <sys/types.h>
18266#include <stdio.h>
18267int main() {
18268 $gidtype foo = -1;
18269 if (foo < 0)
18270 printf("-1\n");
18271 else
18272 printf("1\n");
18273}
18274EOCP
18275set try
18276if eval $compile; then
5440bc8e 18277 yyy=`$run ./try`
b4eb6b3d
JH
18278 case "$yyy" in
18279 '') gidsign=1
18280 echo "(I can't execute the test program--guessing unsigned.)" >&4
18281 ;;
18282 *) gidsign=$yyy
18283 case "$gidsign" in
18284 1) echo "Your $zzz is unsigned." ;;
18285 -1) echo "Your $zzz is signed." ;;
18286 esac
18287 ;;
18288 esac
18289else
18290 gidsign=1
18291 echo "(I can't compile the test program--guessing unsigned.)" >&4
18292fi
18293
18294
18295echo " "
18296
18297if $test X"$quadtype" != X; then
18298
18299echo "Checking how to print 64-bit integers..." >&4
18300
18301if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18302 $cat >try.c <<'EOCP'
18303#include <sys/types.h>
18304#include <stdio.h>
18305int main() {
18306 int q = 12345678901;
18307 printf("%ld\n", q);
18308}
18309EOCP
18310 set try
18311 if eval $compile; then
5440bc8e 18312 yyy=`$run ./try`
b4eb6b3d
JH
18313 case "$yyy" in
18314 12345678901)
18315 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18316 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18317 echo "We will use %d."
18318 ;;
18319 esac
18320 fi
18321fi
18322
18323if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18324 $cat >try.c <<'EOCP'
18325#include <sys/types.h>
18326#include <stdio.h>
18327int main() {
18328 long q = 12345678901;
18329 printf("%ld\n", q);
18330}
18331EOCP
18332 set try
18333 if eval $compile; then
5440bc8e 18334 yyy=`$run ./try`
b4eb6b3d
JH
18335 case "$yyy" in
18336 12345678901)
18337 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18338 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18339 echo "We will use %ld."
18340 ;;
18341 esac
18342 fi
18343fi
18344
18345if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18346 $cat >try.c <<'EOCP'
18347#include <sys/types.h>
18348#include <inttypes.h>
18349#include <stdio.h>
18350int main() {
18351 int64_t q = 12345678901;
18352 printf("%" PRId64 "\n", q);
18353}
18354EOCP
18355 set try
18356 if eval $compile; then
5440bc8e 18357 yyy=`$run ./try`
b4eb6b3d
JH
18358 case "$yyy" in
18359 12345678901)
18360 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18361 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18362 echo "We will use the C9X style."
18363 ;;
18364 esac
18365 fi
18366fi
18367
2ef53570
JH
18368if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18369 $cat >try.c <<EOCP
b4eb6b3d
JH
18370#include <sys/types.h>
18371#include <stdio.h>
18372int main() {
2ef53570
JH
18373 $quadtype q = 12345678901;
18374 printf("%Ld\n", q);
b4eb6b3d
JH
18375}
18376EOCP
18377 set try
18378 if eval $compile; then
5440bc8e 18379 yyy=`$run ./try`
b4eb6b3d
JH
18380 case "$yyy" in
18381 12345678901)
2ef53570
JH
18382 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18383 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18384 echo "We will use %Ld."
b4eb6b3d
JH
18385 ;;
18386 esac
18387 fi
18388fi
18389
2ef53570
JH
18390if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18391 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18392#include <sys/types.h>
18393#include <stdio.h>
18394int main() {
2ef53570
JH
18395 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18396 printf("%lld\n", q);
b4eb6b3d
JH
18397}
18398EOCP
18399 set try
18400 if eval $compile; then
5440bc8e 18401 yyy=`$run ./try`
b4eb6b3d
JH
18402 case "$yyy" in
18403 12345678901)
2ef53570
JH
18404 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18405 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18406 echo "We will use the %lld style."
b4eb6b3d
JH
18407 ;;
18408 esac
18409 fi
18410fi
18411
18412if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18413 $cat >try.c <<EOCP
18414#include <sys/types.h>
18415#include <stdio.h>
18416int main() {
18417 $quadtype q = 12345678901;
18418 printf("%qd\n", q);
18419}
18420EOCP
18421 set try
18422 if eval $compile; then
5440bc8e 18423 yyy=`$run ./try`
b4eb6b3d
JH
18424 case "$yyy" in
18425 12345678901)
18426 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18427 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18428 echo "We will use %qd."
18429 ;;
18430 esac
18431 fi
18432fi
18433
18434if $test X"$sPRId64" = X; then
18435 echo "Cannot figure out how to print 64-bit integers." >&4
18436fi
18437
18438$rm -f try try.*
18439
18440fi
18441
18442case "$sPRId64" in
18443'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18444 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18445 ;;
18446*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18447 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18448 ;;
18449esac
18450
18451
18452echo " "
18453$echo "Checking the format strings to be used for Perl's internal types..." >&4
18454
18455if $test X"$ivsize" = X8; then
18456 ivdformat="$sPRId64"
18457 uvuformat="$sPRIu64"
18458 uvoformat="$sPRIo64"
18459 uvxformat="$sPRIx64"
18460 uvXUformat="$sPRIXU64"
18461else
18462 if $test X"$ivsize" = X"$longsize"; then
18463 ivdformat='"ld"'
18464 uvuformat='"lu"'
18465 uvoformat='"lo"'
18466 uvxformat='"lx"'
18467 uvXUformat='"lX"'
18468 else
18469 if $test X"$ivsize" = X"$intsize"; then
18470 ivdformat='"d"'
18471 uvuformat='"u"'
18472 uvoformat='"o"'
18473 uvxformat='"x"'
18474 uvXUformat='"X"'
18475 else
18476 : far out
18477 if $test X"$ivsize" = X"$shortsize"; then
18478 ivdformat='"hd"'
18479 uvuformat='"hu"'
18480 uvoformat='"ho"'
18481 uvxformat='"hx"'
18482 uvXUformat='"hX"'
18483 fi
18484 fi
18485 fi
18486fi
18487
18488if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18489 nveformat="$sPRIeldbl"
18490 nvfformat="$sPRIfldbl"
18491 nvgformat="$sPRIgldbl"
18492 nvEUformat="$sPRIEUldbl"
18493 nvFUformat="$sPRIFUldbl"
18494 nvGUformat="$sPRIGUldbl"
18495else
18496 nveformat='"e"'
18497 nvfformat='"f"'
18498 nvgformat='"g"'
18499 nvEUformat='"E"'
18500 nvFUformat='"F"'
18501 nvGUformat='"G"'
18502fi
18503
18504case "$ivdformat" in
3c728e00 18505'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18506 exit 1
18507 ;;
18508esac
18509
18510
18511echo " "
18512$echo "Checking the format string to be used for gids..." >&4
18513
18514case "$gidsign" in
18515-1) if $test X"$gidsize" = X"$ivsize"; then
18516 gidformat="$ivdformat"
18517 else
18518 if $test X"$gidsize" = X"$longsize"; then
18519 gidformat='"ld"'
18520 else
18521 if $test X"$gidsize" = X"$intsize"; then
18522 gidformat='"d"'
18523 else
18524 if $test X"$gidsize" = X"$shortsize"; then
18525 gidformat='"hd"'
18526 fi
18527 fi
18528 fi
18529 fi
18530 ;;
18531*) if $test X"$gidsize" = X"$uvsize"; then
18532 gidformat="$uvuformat"
18533 else
18534 if $test X"$gidsize" = X"$longsize"; then
18535 gidformat='"lu"'
18536 else
18537 if $test X"$gidsize" = X"$intsize"; then
18538 gidformat='"u"'
18539 else
18540 if $test X"$gidsize" = X"$shortsize"; then
18541 gidformat='"hu"'
18542 fi
18543 fi
18544 fi
18545 fi
18546 ;;
18547esac
18548
18549: see if getgroups exists
18550set getgroups d_getgrps
18551eval $inlibc
18552
18553: see if setgroups exists
18554set setgroups d_setgrps
18555eval $inlibc
18556
18557
18558: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18559echo " "
18560case "$d_getgrps$d_setgrps" in
18561*define*)
18562 case "$groupstype" in
18563 '') dflt="$gidtype" ;;
18564 *) dflt="$groupstype" ;;
18565 esac
18566 $cat <<EOM
18567What type of pointer is the second argument to getgroups() and setgroups()?
18568Usually this is the same as group ids, $gidtype, but not always.
18569
18570EOM
18571 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18572 . ./myread
18573 groupstype="$ans"
18574 ;;
18575*) groupstype="$gidtype";;
18576esac
18577
18578echo " "
18579echo "Checking if your $make program sets \$(MAKE)..." >&4
18580case "$make_set_make" in
18581'')
18582 $sed 's/^X //' > testmake.mak << 'EOF'
18583Xall:
18584X @echo 'maketemp="$(MAKE)"'
18585EOF
18586 case "`$make -f testmake.mak 2>/dev/null`" in
18587 *maketemp=*) make_set_make='#' ;;
18588 *) make_set_make="MAKE=$make" ;;
18589 esac
18590 $rm -f testmake.mak
18591 ;;
18592esac
18593case "$make_set_make" in
18594'#') echo "Yup, it does.";;
18595*) echo "Nope, it doesn't.";;
18596esac
18597
18598: see what type is used for mode_t
18599rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18600set mode_t modetype int stdio.h sys/types.h
18601eval $typedef_ask
18602
2cc61e15
DD
18603: see if stdarg is available
18604echo " "
18605if $test `./findhdr stdarg.h`; then
18606 echo "<stdarg.h> found." >&4
18607 valstd="$define"
18608else
18609 echo "<stdarg.h> NOT found." >&4
18610 valstd="$undef"
18611fi
18612
18613: see if varags is available
18614echo " "
18615if $test `./findhdr varargs.h`; then
18616 echo "<varargs.h> found." >&4
18617else
18618 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18619fi
18620
18621: set up the varargs testing programs
18622$cat > varargs.c <<EOP
18623#ifdef I_STDARG
18624#include <stdarg.h>
18625#endif
18626#ifdef I_VARARGS
18627#include <varargs.h>
18628#endif
18629
18630#ifdef I_STDARG
18631int f(char *p, ...)
18632#else
18633int f(va_alist)
18634va_dcl
18635#endif
18636{
18637 va_list ap;
18638#ifndef I_STDARG
18639 char *p;
18640#endif
18641#ifdef I_STDARG
18642 va_start(ap,p);
18643#else
18644 va_start(ap);
18645 p = va_arg(ap, char *);
18646#endif
18647 va_end(ap);
18648}
18649EOP
18650$cat > varargs <<EOP
18651$startsh
18652if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18653 echo "true"
18654else
18655 echo "false"
18656fi
18657$rm -f varargs$_o
18658EOP
18659chmod +x varargs
18660
18661: now check which varargs header should be included
18662echo " "
18663i_varhdr=''
18664case "$valstd" in
18665"$define")
18666 if `./varargs I_STDARG`; then
18667 val='stdarg.h'
18668 elif `./varargs I_VARARGS`; then
18669 val='varargs.h'
18670 fi
18671 ;;
18672*)
18673 if `./varargs I_VARARGS`; then
18674 val='varargs.h'
18675 fi
18676 ;;
18677esac
18678case "$val" in
18679'')
18680echo "I could not find the definition for va_dcl... You have problems..." >&4
18681 val="$undef"; set i_stdarg; eval $setvar
18682 val="$undef"; set i_varargs; eval $setvar
18683 ;;
18684*)
18685 set i_varhdr
18686 eval $setvar
18687 case "$i_varhdr" in
18688 stdarg.h)
18689 val="$define"; set i_stdarg; eval $setvar
18690 val="$undef"; set i_varargs; eval $setvar
18691 ;;
18692 varargs.h)
18693 val="$undef"; set i_stdarg; eval $setvar
18694 val="$define"; set i_varargs; eval $setvar
18695 ;;
18696 esac
18697 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18698esac
18699$rm -f varargs*
18700
18701: see if we need va_copy
18702echo " "
18703case "$i_stdarg" in
18704"$define")
18705 $cat >try.c <<EOCP
18706#include <stdarg.h>
18707#include <stdio.h>
85c8a686
DD
18708#$i_stdlib I_STDLIB
18709#ifdef I_STDLIB
18710#include <stdlib.h>
18711#endif
18712#include <signal.h>
2cc61e15
DD
18713
18714int
18715ivfprintf(FILE *f, const char *fmt, va_list *valp)
18716{
18717 return vfprintf(f, fmt, *valp);
18718}
18719
18720int
18721myvfprintf(FILE *f, const char *fmt, va_list val)
18722{
18723 return ivfprintf(f, fmt, &val);
18724}
18725
18726int
18727myprintf(char *fmt, ...)
18728{
18729 va_list val;
18730 va_start(val, fmt);
18731 return myvfprintf(stdout, fmt, val);
18732}
18733
18734int
18735main(int ac, char **av)
18736{
85c8a686
DD
18737 signal(SIGSEGV, exit);
18738
2cc61e15
DD
18739 myprintf("%s%cs all right, then\n", "that", '\'');
18740 exit(0);
18741}
18742EOCP
18743 set try
5440bc8e
JH
18744 if eval $compile && $run ./try 2>&1 >/dev/null; then
18745 case "`$run ./try`" in
2cc61e15
DD
18746 "that's all right, then")
18747 okay=yes
18748 ;;
18749 esac
18750 fi
18751 case "$okay" in
18752 yes) echo "It seems that you don't need va_copy()." >&4
18753 need_va_copy="$undef"
18754 ;;
18755 *) echo "It seems that va_copy() or similar will be needed." >&4
18756 need_va_copy="$define"
18757 ;;
18758 esac
18759 $rm -f try.* core core.* *.core *.core.*
18760 ;;
18761*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18762 ;;
18763esac
18764
b4eb6b3d
JH
18765: see what type is used for size_t
18766rp="What is the type used for the length parameter for string functions?"
18767set size_t sizetype 'unsigned int' stdio.h sys/types.h
18768eval $typedef_ask
18769
18770: check for type of arguments to gethostbyaddr.
18771if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18772 case "$d_gethbyaddr" in
18773 $define)
18774 $cat <<EOM
18775
18776Checking to see what type of arguments are accepted by gethostbyaddr().
18777EOM
18778 hdrs="$define sys/types.h
18779 $d_socket sys/socket.h
18780 $i_niin netinet/in.h
18781 $i_netdb netdb.h
18782 $i_unistd unistd.h"
18783 : The first arg can 'char *' or 'void *'
18784 : The second arg is some of integral type
18785 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18786 for yyy in size_t long int; do
18787 case "$netdb_host_type" in
18788 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18789 if ./protochk "$try" $hdrs; then
18790 echo "Your system accepts $xxx for the first arg."
18791 echo "...and $yyy for the second arg."
18792 netdb_host_type="$xxx"
18793 netdb_hlen_type="$yyy"
18794 fi
18795 ;;
18796 esac
18797 done
18798 done
18799 : In case none of those worked, prompt the user.
18800 case "$netdb_host_type" in
18801 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18802 dflt='char *'
18803 . ./myread
18804 netdb_host_type=$ans
18805 rp='What is the type for the 2nd argument to gethostbyaddr?'
18806 dflt="$sizetype"
18807 . ./myread
18808 netdb_hlen_type=$ans
18809 ;;
18810 esac
18811 ;;
18812 *) : no gethostbyaddr, so pick harmless defaults
18813 netdb_host_type='char *'
18814 netdb_hlen_type="$sizetype"
18815 ;;
18816 esac
18817 # Remove the "const" if needed. -- but then we'll have a
18818 # prototype clash!
18819 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18820fi
18821
18822: check for type of argument to gethostbyname.
18823if test "X$netdb_name_type" = X ; then
18824 case "$d_gethbyname" in
18825 $define)
18826 $cat <<EOM
18827
18828Checking to see what type of argument is accepted by gethostbyname().
18829EOM
18830 hdrs="$define sys/types.h
18831 $d_socket sys/socket.h
18832 $i_niin netinet/in.h
18833 $i_netdb netdb.h
18834 $i_unistd unistd.h"
18835 for xxx in "const char *" "char *"; do
18836 case "$netdb_name_type" in
18837 '') try="extern struct hostent *gethostbyname($xxx);"
18838 if ./protochk "$try" $hdrs; then
18839 echo "Your system accepts $xxx."
18840 netdb_name_type="$xxx"
18841 fi
18842 ;;
18843 esac
18844 done
18845 : In case none of those worked, prompt the user.
18846 case "$netdb_name_type" in
18847 '') rp='What is the type for the 1st argument to gethostbyname?'
18848 dflt='char *'
18849 . ./myread
18850 netdb_name_type=$ans
18851 ;;
18852 esac
18853 ;;
18854 *) : no gethostbyname, so pick harmless default
18855 netdb_name_type='char *'
18856 ;;
18857 esac
18858fi
18859
18860: check for type of 1st argument to getnetbyaddr.
18861if test "X$netdb_net_type" = X ; then
18862 case "$d_getnbyaddr" in
18863 $define)
18864 $cat <<EOM
18865
18866Checking to see what type of 1st argument is accepted by getnetbyaddr().
18867EOM
18868 hdrs="$define sys/types.h
18869 $d_socket sys/socket.h
18870 $i_niin netinet/in.h
18871 $i_netdb netdb.h
18872 $i_unistd unistd.h"
18873 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18874 case "$netdb_net_type" in
18875 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18876 if ./protochk "$try" $hdrs; then
18877 echo "Your system accepts $xxx."
18878 netdb_net_type="$xxx"
18879 fi
18880 ;;
18881 esac
18882 done
18883 : In case none of those worked, prompt the user.
18884 case "$netdb_net_type" in
18885 '') rp='What is the type for the 1st argument to getnetbyaddr?'
18886 dflt='long'
18887 . ./myread
18888 netdb_net_type=$ans
18889 ;;
18890 esac
18891 ;;
18892 *) : no getnetbyaddr, so pick harmless default
18893 netdb_net_type='long'
18894 ;;
18895 esac
18896fi
18897: locate the preferred pager for this system
d604bb53 18898fn=f/
b4eb6b3d
JH
18899case "$pager" in
18900'')
18901 dflt=''
18902 case "$pg" in
18903 /*) dflt=$pg;;
18904 [a-zA-Z]:/*) dflt=$pg;;
18905 esac
18906 case "$more" in
18907 /*) dflt=$more;;
18908 [a-zA-Z]:/*) dflt=$more;;
18909 esac
18910 case "$less" in
18911 /*) dflt=$less;;
18912 [a-zA-Z]:/*) dflt=$less;;
18913 esac
18914 case "$dflt" in
18915 '') dflt=/usr/ucb/more;;
18916 esac
18917 ;;
d604bb53
JH
18918*) dflt="$pager"
18919 : Instruct ./getfile to trust the hinted or previous pager value,
18920 : even if it does not begin with a slash. For example, on os2,
18921 : pager might be cmd /c more. See comments in UU/getfile.
18922 fn="f/($pager)"
18923 ;;
b4eb6b3d
JH
18924esac
18925echo " "
b4eb6b3d
JH
18926rp='What pager is used on your system?'
18927. ./getfile
18928pager="$ans"
18929
18930: see what type pids are declared as in the kernel
18931rp="What is the type of process ids on this system?"
18932set pid_t pidtype int stdio.h sys/types.h
18933eval $typedef_ask
18934
b4eb6b3d
JH
18935: see if ar generates random libraries by itself
18936echo " "
18937echo "Checking how to generate random libraries on your machine..." >&4
18938echo 'int bar1() { return bar2(); }' > bar1.c
18939echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
18940$cat > foo.c <<EOP
18941#$i_stdlib I_STDLIB
18942#ifdef I_STDLIB
18943#include <stdlib.h>
18944#endif
b4eb6b3d
JH
18945int main() { printf("%d\n", bar1()); exit(0); }
18946EOP
18947$cc $ccflags -c bar1.c >/dev/null 2>&1
18948$cc $ccflags -c bar2.c >/dev/null 2>&1
18949$cc $ccflags -c foo.c >/dev/null 2>&1
18950$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 18951if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18952 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18953 echo "$ar appears to generate random libraries itself."
18954 orderlib=false
18955 ranlib=":"
18956elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 18957 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18958 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18959 echo "a table of contents needs to be added with '$ar ts'."
18960 orderlib=false
18961 ranlib="$ar ts"
18962else
18963 case "$ranlib" in
18964 :) ranlib='';;
18965 '')
18966 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18967 $test -f $ranlib || ranlib=''
18968 ;;
18969 esac
18970 if $test -n "$ranlib"; then
18971 echo "your system has '$ranlib'; we'll use that."
18972 orderlib=false
18973 else
18974 echo "your system doesn't seem to support random libraries"
18975 echo "so we'll use lorder and tsort to order the libraries."
18976 orderlib=true
18977 ranlib=":"
18978 fi
18979fi
18980$rm -f foo* bar*
18981
18982: check for type of arguments to select.
18983case "$selecttype" in
18984'') case "$d_select" in
18985 $define)
18986 echo " "
18987 $cat <<EOM
18988Checking to see what type of arguments are accepted by select().
18989EOM
18990 hdrs="$define sys/types.h
18991 $i_systime sys/time.h
18992 $i_sysselct sys/select.h
18993 $d_socket sys/socket.h"
18994 : The first arg can be int, unsigned, or size_t
18995 : The last arg may or may not be 'const'
18996 val=''
18997 : void pointer has been seen but using that
18998 : breaks the selectminbits test
18999 for xxx in 'fd_set *' 'int *'; do
19000 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19001 for tmo in 'struct timeval *' 'const struct timeval *'; do
19002 case "$val" in
19003 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19004 if ./protochk "$try" $hdrs; then
19005 echo "Your system accepts $xxx."
19006 val="$xxx"
19007 fi
19008 ;;
19009 esac
19010 done
19011 done
19012 done
19013 case "$val" in
19014 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19015 case "$d_fd_set" in
19016 $define) dflt="fd_set *" ;;
19017 *) dflt="int *" ;;
19018 esac
19019 . ./myread
19020 val=$ans
19021 ;;
19022 esac
19023 selecttype="$val"
19024 ;;
19025 *) : no select, so pick a harmless default
19026 selecttype='int *'
19027 ;;
19028 esac
19029 ;;
19030esac
19031
19032: check for the select 'width'
19033case "$selectminbits" in
e6e7e605
JH
19034'') safebits=`expr $ptrsize \* 8`
19035 case "$d_select" in
b4eb6b3d
JH
19036 $define)
19037 $cat <<EOM
19038
19039Checking to see on how many bits at a time your select() operates...
19040EOM
19041 $cat >try.c <<EOCP
19042#include <sys/types.h>
19043#$i_time I_TIME
19044#$i_systime I_SYS_TIME
19045#$i_systimek I_SYS_TIME_KERNEL
19046#ifdef I_TIME
19047# include <time.h>
19048#endif
19049#ifdef I_SYS_TIME
19050# ifdef I_SYS_TIME_KERNEL
19051# define KERNEL
19052# endif
19053# include <sys/time.h>
19054# ifdef I_SYS_TIME_KERNEL
19055# undef KERNEL
19056# endif
19057#endif
19058#$i_sysselct I_SYS_SELECT
19059#ifdef I_SYS_SELECT
19060#include <sys/select.h>
19061#endif
19062#$d_socket HAS_SOCKET
19063#ifdef HAS_SOCKET
19064# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19065#endif
19066#include <stdio.h>
d1daaddf
JH
19067#$i_stdlib I_STDLIB
19068#ifdef I_STDLIB
19069#include <stdlib.h>
19070#endif
b4eb6b3d
JH
19071$selecttype b;
19072#define S sizeof(*(b))
19073#define MINBITS 64
19074#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19075#define NBITS (NBYTES * 8)
19076int main() {
e6e7e605 19077 char *s = malloc(NBYTES);
b4eb6b3d
JH
19078 struct timeval t;
19079 int i;
19080 FILE* fp;
19081 int fd;
19082
e6e7e605
JH
19083 if (!s)
19084 exit(1);
b4eb6b3d
JH
19085 fclose(stdin);
19086 fp = fopen("try.c", "r");
19087 if (fp == 0)
e6e7e605 19088 exit(2);
b4eb6b3d
JH
19089 fd = fileno(fp);
19090 if (fd < 0)
e6e7e605 19091 exit(3);
b4eb6b3d
JH
19092 b = ($selecttype)s;
19093 for (i = 0; i < NBITS; i++)
19094 FD_SET(i, b);
19095 t.tv_sec = 0;
19096 t.tv_usec = 0;
19097 select(fd + 1, b, 0, 0, &t);
19098 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19099 free(s);
b4eb6b3d
JH
19100 printf("%d\n", i + 1);
19101 return 0;
19102}
19103EOCP
19104 set try
19105 if eval $compile_ok; then
5440bc8e 19106 selectminbits=`$run ./try`
b4eb6b3d
JH
19107 case "$selectminbits" in
19108 '') cat >&4 <<EOM
19109Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19110I'll play safe and guess it is $safebits bits.
b4eb6b3d 19111EOM
e6e7e605
JH
19112 selectminbits=$safebits
19113 bits="$safebits bits"
b4eb6b3d
JH
19114 ;;
19115 1) bits="1 bit" ;;
19116 *) bits="$selectminbits bits" ;;
19117 esac
19118 echo "Your select() operates on $bits at a time." >&4
19119 else
19120 rp='What is the minimum number of bits your select() operates on?'
19121 case "$byteorder" in
e6e7e605
JH
19122 12345678) dflt=64 ;;
19123 1234) dflt=32 ;;
b4eb6b3d
JH
19124 *) dflt=1 ;;
19125 esac
19126 . ./myread
19127 val=$ans
19128 selectminbits="$val"
19129 fi
19130 $rm -f try.* try
19131 ;;
19132 *) : no select, so pick a harmless default
e6e7e605 19133 selectminbits=$safebits
b4eb6b3d
JH
19134 ;;
19135 esac
19136 ;;
19137esac
19138
19139: Trace out the files included by signal.h, then look for SIGxxx names.
19140: Remove SIGARRAYSIZE used by HPUX.
19141: Remove SIGSTKSIZE used by Linux.
19142: Remove SIGSTKSZ used by Posix.
19143: Remove SIGTYP void lines used by OS2.
19144: Some cpps, like os390, dont give the file name anywhere
19145if [ "X$fieldn" = X ]; then
19146 : Just make some guesses. We check them later.
19147 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19148else
19149 xxx=`echo '#include <signal.h>' |
19150 $cppstdin $cppminus $cppflags 2>/dev/null |
19151 $grep '^[ ]*#.*include' |
a938a3bb 19152 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19153fi
19154: Check this list of files to be sure we have parsed the cpp output ok.
19155: This will also avoid potentially non-existent files, such
19156: as ../foo/bar.h
19157xxxfiles=''
19158for xx in $xxx /dev/null ; do
19159 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19160done
19161: If we have found no files, at least try signal.h
19162case "$xxxfiles" in
19163'') xxxfiles=`./findhdr signal.h` ;;
19164esac
19165xxx=`awk '
19166$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19167 print substr($2, 4, 20)
19168}
19169$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19170 print substr($3, 4, 20)
19171}' $xxxfiles`
19172: Append some common names just in case the awk scan failed.
19173xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19174xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19175xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19176xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19177xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19178
19179: generate a few handy files for later
55954f19 19180$cat > signal.c <<EOCP
b4eb6b3d
JH
19181#include <sys/types.h>
19182#include <signal.h>
55954f19
JH
19183#$i_stdlib I_STDLIB
19184#ifdef I_STDLIB
19185#include <stdlib.h>
19186#endif
b4eb6b3d
JH
19187#include <stdio.h>
19188int main() {
19189
19190/* Strange style to avoid deeply-nested #if/#else/#endif */
19191#ifndef NSIG
19192# ifdef _NSIG
19193# define NSIG (_NSIG)
19194# endif
19195#endif
19196
19197#ifndef NSIG
19198# ifdef SIGMAX
19199# define NSIG (SIGMAX+1)
19200# endif
19201#endif
19202
19203#ifndef NSIG
19204# ifdef SIG_MAX
19205# define NSIG (SIG_MAX+1)
19206# endif
19207#endif
19208
19209#ifndef NSIG
19210# ifdef MAXSIG
19211# define NSIG (MAXSIG+1)
19212# endif
19213#endif
19214
19215#ifndef NSIG
19216# ifdef MAX_SIG
19217# define NSIG (MAX_SIG+1)
19218# endif
19219#endif
19220
19221#ifndef NSIG
19222# ifdef SIGARRAYSIZE
19223# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19224# endif
19225#endif
19226
19227#ifndef NSIG
19228# ifdef _sys_nsig
19229# define NSIG (_sys_nsig) /* Solaris 2.5 */
19230# endif
19231#endif
19232
19233/* Default to some arbitrary number that's big enough to get most
19234 of the common signals.
19235*/
19236#ifndef NSIG
19237# define NSIG 50
19238#endif
19239
19240printf("NSIG %d\n", NSIG);
19241
19242#ifndef JUST_NSIG
19243
19244EOCP
19245
19246echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19247{
19248 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19249 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19250 printf $1; printf ");\n"
19251 printf "#endif\n"
19252}
19253END {
19254 printf "#endif /* JUST_NSIG */\n";
19255 printf "exit(0);\n}\n";
19256}
19257' >>signal.c
19258$cat >signal.awk <<'EOP'
19259BEGIN { ndups = 0 }
65197d93 19260$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19261($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19262 if ($2 > maxsig) { maxsig = $2 }
19263 if (sig_name[$2]) {
19264 dup_name[ndups] = $1
19265 dup_num[ndups] = $2
b4eb6b3d
JH
19266 ndups++
19267 }
1ebe1ffb 19268 else {
65197d93
JH
19269 sig_name[$2] = $1
19270 sig_num[$2] = $2
b4eb6b3d
JH
19271 }
19272}
19273END {
19274 if (nsig == 0) {
19275 nsig = maxsig + 1
19276 }
19277 printf("NSIG %d\n", nsig);
19278 for (n = 1; n < nsig; n++) {
19279 if (sig_name[n]) {
19280 printf("%s %d\n", sig_name[n], sig_num[n])
19281 }
19282 else {
19283 printf("NUM%d %d\n", n, n)
19284 }
19285 }
19286 for (n = 0; n < ndups; n++) {
19287 printf("%s %d\n", dup_name[n], dup_num[n])
19288 }
19289}
19290EOP
19291$cat >signal_cmd <<EOS
19292$startsh
19293if $test -s signal.lst; then
19294 echo "Using your existing signal.lst file"
19295 exit 0
19296fi
19297xxx="$xxx"
19298EOS
19299$cat >>signal_cmd <<'EOS'
19300
19301set signal
19302if eval $compile_ok; then
1eb9ad5b 19303 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19304else
19305 echo "(I can't seem be able to compile the whole test program)" >&4
19306 echo "(I'll try it in little pieces.)" >&4
19307 set signal -DJUST_NSIG
19308 if eval $compile_ok; then
5440bc8e 19309 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19310 $cat signal.nsg
19311 else
19312 echo "I can't seem to figure out how many signals you have." >&4
19313 echo "Guessing 50." >&4
19314 echo 'NSIG 50' > signal.nsg
19315 fi
19316 : Now look at all the signal names, one at a time.
19317 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19318 $cat > signal.c <<EOCP
19319#include <sys/types.h>
19320#include <signal.h>
19321#include <stdio.h>
19322int main() {
19323printf("$xx %d\n", SIG${xx});
19324return 0;
19325}
19326EOCP
19327 set signal
19328 if eval $compile; then
19329 echo "SIG${xx} found."
5440bc8e 19330 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19331 else
19332 echo "SIG${xx} NOT found."
19333 fi
19334 done
19335 if $test -s signal.ls1; then
19336 $cat signal.nsg signal.ls1 |
65197d93 19337 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19338 fi
19339
19340fi
19341if $test -s signal.lst; then
19342 :
19343else
19344 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19345 echo 'kill -l' >signal
19346 set X `csh -f <signal`
19347 $rm -f signal
19348 shift
19349 case $# in
19350 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19351 esac
19352 echo $@ | $tr ' ' $trnl | \
19353 $awk '{ printf "%s %d\n", $1, ++s; }
19354 END { printf "NSIG %d\n", ++s }' >signal.lst
19355fi
19356$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19357EOS
19358chmod a+x signal_cmd
19359$eunicefix signal_cmd
19360
19361: generate list of signal names
19362echo " "
19363case "$sig_name_init" in
19364'') doinit=yes ;;
19365*) case "$sig_num_init" in
19366 ''|*,*) doinit=yes ;;
19367 esac ;;
19368esac
19369case "$doinit" in
19370yes)
19371 echo "Generating a list of signal names and numbers..." >&4
19372 . ./signal_cmd
19373 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19374 sig_name=`$awk 'BEGIN { printf "ZERO " }
19375 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19376 sig_num=`$awk 'BEGIN { printf "0 " }
19377 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19378 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19379 !/^NSIG/ { printf "\"%s\", ", $1 }
19380 END { printf "0\n" }' signal.lst`
19381 sig_num_init=`$awk 'BEGIN { printf "0, " }
19382 !/^NSIG/ { printf "%d, ", $2}
19383 END { printf "0\n"}' signal.lst`
19384 ;;
19385esac
19386echo "The following $sig_count signals are available:"
19387echo " "
19388echo $sig_name | $awk \
19389'BEGIN { linelen = 0 }
19390{
19391 for (i = 1; i <= NF; i++) {
19392 name = "SIG" $i " "
19393 linelen = linelen + length(name)
19394 if (linelen > 70) {
19395 printf "\n"
19396 linelen = length(name)
19397 }
19398 printf "%s", name
19399 }
19400 printf "\n"
19401}'
76d3c696 19402sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19403$rm -f signal signal.c signal.awk signal.lst signal_cmd
19404
19405echo " "
19406case "$sizetype" in
19407*_t) zzz="$sizetype" ;;
19408*) zzz="filesize" ;;
19409esac
19410echo "Checking the size of $zzz..." >&4
19411cat > try.c <<EOCP
19412#include <sys/types.h>
19413#include <stdio.h>
d1daaddf
JH
19414#$i_stdlib I_STDLIB
19415#ifdef I_STDLIB
19416#include <stdlib.h>
19417#endif
b4eb6b3d
JH
19418int main() {
19419 printf("%d\n", (int)sizeof($sizetype));
19420 exit(0);
19421}
19422EOCP
19423set try
19424if eval $compile_ok; then
5440bc8e 19425 yyy=`$run ./try`
b4eb6b3d
JH
19426 case "$yyy" in
19427 '') sizesize=4
19428 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19429 ;;
19430 *) sizesize=$yyy
19431 echo "Your $zzz size is $sizesize bytes."
19432 ;;
19433 esac
19434else
19435 sizesize=4
19436 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19437fi
19438
19439
19440: check for socklen_t
19441echo " "
19442echo "Checking to see if you have socklen_t..." >&4
19443$cat >try.c <<EOCP
19444#include <sys/types.h>
19445#$d_socket HAS_SOCKET
19446#ifdef HAS_SOCKET
19447#include <sys/socket.h>
19448#endif
19449int main() { socklen_t x = 16; }
19450EOCP
19451set try
19452if eval $compile; then
19453 val="$define"
19454 echo "You have socklen_t."
19455else
19456 val="$undef"
19457 echo "You do not have socklen_t."
19458 case "$sizetype" in
19459 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19460 esac
19461fi
19462$rm -f try try.*
19463set d_socklen_t
19464eval $setvar
19465
a7710f8d
JH
19466: see if this is a socks.h system
19467set socks.h i_socks
19468eval $inhdr
19469
b4eb6b3d
JH
19470: check for type of the size argument to socket calls
19471case "$d_socket" in
19472"$define")
19473 $cat <<EOM
19474
19475Checking to see what type is the last argument of accept().
19476EOM
b4eb6b3d
JH
19477 yyy=''
19478 case "$d_socklen_t" in
19479 "$define") yyy="$yyy socklen_t"
19480 esac
19481 yyy="$yyy $sizetype int long unsigned"
19482 for xxx in $yyy; do
19483 case "$socksizetype" in
19484 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19485 case "$usesocks" in
19486 "$define")
19487 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19488 echo "Your system accepts '$xxx *' for the last argument of accept()."
19489 socksizetype="$xxx"
19490 fi
19491 ;;
19492 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19493 echo "Your system accepts '$xxx *' for the last argument of accept()."
19494 socksizetype="$xxx"
19495 fi
19496 ;;
19497 esac
b4eb6b3d
JH
19498 ;;
19499 esac
19500 done
19501: In case none of those worked, prompt the user.
19502 case "$socksizetype" in
19503 '') rp='What is the type for socket address structure sizes?'
19504 dflt='int'
19505 . ./myread
19506 socksizetype=$ans
19507 ;;
19508 esac
19509 ;;
19510*) : no sockets, so pick relatively harmless default
19511 socksizetype='int'
19512 ;;
19513esac
19514
19515: see what type is used for signed size_t
19516set ssize_t ssizetype int stdio.h sys/types.h
19517eval $typedef
19518dflt="$ssizetype"
5440bc8e 19519$cat > try.c <<EOM
b4eb6b3d 19520#include <stdio.h>
d1daaddf
JH
19521#$i_stdlib I_STDLIB
19522#ifdef I_STDLIB
19523#include <stdlib.h>
19524#endif
b4eb6b3d
JH
19525#include <sys/types.h>
19526#define Size_t $sizetype
19527#define SSize_t $dflt
19528int main()
19529{
19530 if (sizeof(Size_t) == sizeof(SSize_t))
19531 printf("$dflt\n");
19532 else if (sizeof(Size_t) == sizeof(int))
19533 printf("int\n");
19534 else
19535 printf("long\n");
19536 exit(0);
19537}
19538EOM
19539echo " "
5440bc8e
JH
19540set try
19541if eval $compile_ok && $run ./try > /dev/null; then
19542 ssizetype=`$run ./try`
b4eb6b3d
JH
19543 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19544else
19545 $cat >&4 <<EOM
19546Help! I can't compile and run the ssize_t test program: please enlighten me!
19547(This is probably a misconfiguration in your system or libraries, and
19548you really ought to fix it. Still, I'll try anyway.)
19549
19550I need a type that is the same size as $sizetype, but is guaranteed to
19551be signed. Common values are ssize_t, int and long.
19552
19553EOM
19554 rp="What signed type is the same size as $sizetype?"
19555 . ./myread
19556 ssizetype="$ans"
19557fi
5440bc8e 19558$rm -f try try.*
b4eb6b3d
JH
19559
19560: see what type of char stdio uses.
19561echo " "
aa517f50
JH
19562echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19563if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19564 echo "Your stdio uses unsigned chars." >&4
19565 stdchar="unsigned char"
19566else
aa517f50
JH
19567 echo "Your stdio uses signed chars." >&4
19568 stdchar="char"
b4eb6b3d 19569fi
aa517f50
JH
19570$rm -f stdioh
19571
19572
b4eb6b3d 19573
b4eb6b3d
JH
19574: see what type uids are declared as in the kernel
19575echo " "
19576echo "Looking for the type for user ids returned by getuid()."
19577set uid_t uidtype xxx stdio.h sys/types.h
19578eval $typedef
19579case "$uidtype" in
19580xxx)
19581 xxx=`./findhdr sys/user.h`
19582 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19583 case $1 in
19584 unsigned) dflt="$1 $2" ;;
19585 *) dflt="$1" ;;
19586 esac
19587 ;;
19588*) dflt="$uidtype";;
19589esac
19590case "$uidtype" in
19591uid_t) echo "uid_t found." ;;
19592*) rp="What is the type for user ids returned by getuid()?"
19593 . ./myread
19594 uidtype="$ans"
19595 ;;
19596esac
19597
19598echo " "
19599case "$uidtype" in
19600*_t) zzz="$uidtype" ;;
19601*) zzz="uid" ;;
19602esac
19603echo "Checking the size of $zzz..." >&4
19604cat > try.c <<EOCP
19605#include <sys/types.h>
19606#include <stdio.h>
d1daaddf
JH
19607#$i_stdlib I_STDLIB
19608#ifdef I_STDLIB
19609#include <stdlib.h>
19610#endif
b4eb6b3d
JH
19611int main() {
19612 printf("%d\n", (int)sizeof($uidtype));
19613 exit(0);
19614}
19615EOCP
19616set try
19617if eval $compile_ok; then
5440bc8e 19618 yyy=`$run ./try`
b4eb6b3d
JH
19619 case "$yyy" in
19620 '') uidsize=4
19621 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19622 ;;
19623 *) uidsize=$yyy
19624 echo "Your $zzz is $uidsize bytes long."
19625 ;;
19626 esac
19627else
19628 uidsize=4
19629 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19630fi
19631
19632echo " "
19633case "$uidtype" in
19634*_t) zzz="$uidtype" ;;
19635*) zzz="uid" ;;
19636esac
19637echo "Checking the sign of $zzz..." >&4
19638cat > try.c <<EOCP
19639#include <sys/types.h>
19640#include <stdio.h>
19641int main() {
19642 $uidtype foo = -1;
19643 if (foo < 0)
19644 printf("-1\n");
19645 else
19646 printf("1\n");
19647}
19648EOCP
19649set try
19650if eval $compile; then
5440bc8e 19651 yyy=`$run ./try`
b4eb6b3d
JH
19652 case "$yyy" in
19653 '') uidsign=1
19654 echo "(I can't execute the test program--guessing unsigned.)" >&4
19655 ;;
19656 *) uidsign=$yyy
19657 case "$uidsign" in
19658 1) echo "Your $zzz is unsigned." ;;
19659 -1) echo "Your $zzz is signed." ;;
19660 esac
19661 ;;
19662 esac
19663else
19664 uidsign=1
19665 echo "(I can't compile the test program--guessing unsigned.)" >&4
19666fi
19667
19668
19669
19670echo " "
19671$echo "Checking the format string to be used for uids..." >&4
19672
19673case "$uidsign" in
19674-1) if $test X"$uidsize" = X"$ivsize"; then
19675 uidformat="$ivdformat"
19676 else
19677 if $test X"$uidsize" = X"$longsize"; then
19678 uidformat='"ld"'
19679 else
19680 if $test X"$uidsize" = X"$intsize"; then
19681 uidformat='"d"'
19682 else
19683 if $test X"$uidsize" = X"$shortsize"; then
19684 uidformat='"hd"'
19685 fi
19686 fi
19687 fi
19688 fi
19689 ;;
19690*) if $test X"$uidsize" = X"$uvsize"; then
19691 uidformat="$uvuformat"
19692 else
19693 if $test X"$uidsize" = X"$longsize"; then
19694 uidformat='"lu"'
19695 else
19696 if $test X"$uidsize" = X"$intsize"; then
19697 uidformat='"u"'
19698 else
19699 if $test X"$uidsize" = X"$shortsize"; then
19700 uidformat='"hu"'
19701 fi
19702 fi
19703 fi
19704 fi
19705 ;;
19706esac
19707
4afd418c
MB
19708
19709case "$usesitecustomize" in
19710 $define|true|[Yy]*)
19711 usesitecustomize="$define"
19712 ;;
19713 *)
19714 usesitecustomize="$undef"
19715 ;;
19716 esac
19717
3659ebf1
JH
19718: determine compiler compiler
19719case "$yacc" in
19720'')
19721 dflt=yacc;;
19722*)
19723 dflt="$yacc";;
19724esac
19725echo " "
19726comp='yacc'
3c728e00 19727if $test -f "$byacc$_exe"; then
3659ebf1
JH
19728 dflt="$byacc"
19729 comp="byacc or $comp"
19730fi
3c728e00 19731if $test -f "$bison$_exe"; then
3659ebf1
JH
19732 comp="$comp or bison -y"
19733fi
19734rp="Which compiler compiler ($comp) shall I use?"
19735. ./myread
19736yacc="$ans"
19737case "$yacc" in
19738*bis*)
19739 case "$yacc" in
19740 *-y*) ;;
19741 *)
19742 yacc="$yacc -y"
19743 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19744 ;;
19745 esac
19746 ;;
19747esac
19748
758a5d79
JH
19749: see if this is a fp.h system
19750set fp.h i_fp
19751eval $inhdr
19752
19753: see if this is a fp_class.h system
19754set fp_class.h i_fp_class
19755eval $inhdr
19756
b4eb6b3d 19757: see if this is a ieeefp.h system
b5b9f165
JH
19758case "$i_ieeefp" in
19759'' ) set ieeefp.h i_ieeefp
19760 eval $inhdr
19761 ;;
19762esac
b4eb6b3d
JH
19763
19764: see if this is a libutil.h system
19765set libutil.h i_libutil
19766eval $inhdr
19767
b4eb6b3d
JH
19768: see if mach cthreads are available
19769if test "X$usethreads" = "X$define"; then
19770 set mach/cthreads.h i_machcthr
19771 eval $inhdr
19772else
19773 i_machcthr="$undef"
19774fi
19775
19776
19777
b4eb6b3d
JH
19778: see if this is a mntent.h system
19779set mntent.h i_mntent
19780eval $inhdr
19781
19782: see if ndbm.h is available
19783set ndbm.h t_ndbm
19784eval $inhdr
1c6861ad
JS
19785
19786case "$t_ndbm" in
19787$undef)
19788 # Some Linux distributions such as RedHat 7.1 put the
19789 # ndbm.h header in /usr/include/gdbm/ndbm.h.
19790 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 19791 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
19792 ccflags="$ccflags -I/usr/include/gdbm"
19793 cppflags="$cppflags -I/usr/include/gdbm"
19794 t_ndbm=$define
19795 fi
19796 ;;
19797esac
19798
b4eb6b3d
JH
19799case "$t_ndbm" in
19800$define)
19801 : see if dbm_open exists
19802 set dbm_open d_dbm_open
19803 eval $inlibc
19804 case "$d_dbm_open" in
19805 $undef)
19806 t_ndbm="$undef"
19807 echo "We won't be including <ndbm.h>"
19808 ;;
19809 esac
19810 ;;
19811esac
19812val="$t_ndbm"
19813set i_ndbm
19814eval $setvar
19815
19816: see if net/errno.h is available
19817val=''
19818set net/errno.h val
19819eval $inhdr
19820
19821: Unfortunately, it causes problems on some systems. Arrgh.
19822case "$val" in
19823$define)
19824 cat > try.c <<'EOM'
19825#include <stdio.h>
19826#include <errno.h>
19827#include <net/errno.h>
19828int func()
19829{
19830 return ENOTSOCK;
19831}
19832EOM
19833 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19834 echo "We'll be including <net/errno.h>." >&4
19835 else
19836 echo "We won't be including <net/errno.h>." >&4
19837 val="$undef"
19838 fi
19839 $rm -f try.* try
19840 ;;
19841esac
19842set i_neterrno
19843eval $setvar
19844
19845: see if netinet/tcp.h is available
19846set netinet/tcp.h i_netinettcp
19847eval $inhdr
19848
19849: see if this is a poll.h system
19850set poll.h i_poll
19851eval $inhdr
19852
19853: see if this is a prot.h system
19854set prot.h i_prot
19855eval $inhdr
19856
19857echo " "
19858$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19859$cat <<'EOSH' > Cppsym.know
19860a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19861AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19862alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19863ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19864BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19865BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19866bull c cadmus clipper CMU COFF COMPILER_VERSION
19867concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 19868CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19869Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19870FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19871GLIBC GLIBC_MINOR
19872GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19873H3050R H3050RX hbullx20 hcx host_mips
19874hp200 hp300 hp700 HP700 hp800 hp9000
19875hp9000s200 hp9000s300 hp9000s400 hp9000s500
19876hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19877i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 19878IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
19879INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19880LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19881LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19882Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19883LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19884M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19885M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19886M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19887MATH_HAS_NO_SIDE_EFFECTS
19888mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19889mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19890mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19891MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19892mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19893NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 19894news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
19895ns32016 ns32332 ns32k nsc32000
19896OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19897pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19898pc532 pdp11 PGC PIC plexus PORTAR posix
19899POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19900POSIX_C_SOURCE POSIX_SOURCE POWER
19901PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 19902riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
19903SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19904sony sony_news sonyrisc sparc sparclite spectrum
19905stardent stdc STDC_EXT stratos sun sun3 sun386
19906Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19907SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19908SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19909sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 19910TM3200 TM5400 TM5600
b4eb6b3d
JH
19911tower tower32 tower32_200 tower32_600 tower32_700
19912tower32_800 tower32_850 tss
19913u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19914ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
19915unix UNIX95 UNIX99 unixpc unos
19916USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19917USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19918USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19919USGr4 USGr4_2
b4eb6b3d
JH
19920Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19921XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19922XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19923z8000
19924EOSH
19925# Maybe put other stuff here too.
19926cat <<EOSH >>Cppsym.know
19927$osname
19928EOSH
19929./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19930./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19931$cat Cppsym.know > Cppsym.c
381aa1ff 19932$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
19933$rm -f Cppsym.a Cppsym.b Cppsym.c
19934cat <<EOSH > Cppsym
19935$startsh
19936if $test \$# -gt 0; then
19937 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19938 if $test -s Cppsym.got; then
19939 $rm -f Cppsym.got
19940 exit 0
19941 fi
19942 $rm -f Cppsym.got
19943 exit 1
19944else
19945 $tr " " "$trnl" | ./Cppsym.try
19946 exit 0
19947fi
19948EOSH
19949chmod +x Cppsym
19950$eunicefix Cppsym
19951cat <<EOSH > Cppsym.try
19952$startsh
19953cat <<'EOCP' > try.c
19954#include <stdio.h>
19955int main() {
19956EOCP
19957$awk \\
19958EOSH
19959cat <<'EOSH' >> Cppsym.try
19960'length($1) > 0 {
2ef53570
JH
19961 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19962 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19963 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19964 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 19965}' >> try.c
2ef53570 19966echo 'return 0;}' >> try.c
b4eb6b3d
JH
19967EOSH
19968cat <<EOSH >> Cppsym.try
19969ccflags="$ccflags"
19970case "$osname-$gccversion" in
19971irix-) ccflags="\$ccflags -woff 1178" ;;
19972os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19973esac
5440bc8e 19974$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
19975EOSH
19976chmod +x Cppsym.try
19977$eunicefix Cppsym.try
19978./Cppsym < Cppsym.know > Cppsym.true
19979: now check the C compiler for additional symbols
19980postprocess_cc_v=''
19981case "$osname" in
19982aix) postprocess_cc_v="|$tr , ' '" ;;
19983esac
19984$cat >ccsym <<EOS
19985$startsh
19986$cat >tmp.c <<EOF
19987extern int foo;
19988EOF
19989for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19990do
19991 case "\$i" in
19992 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 19993 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
19994 esac
19995done
19996$rm -f try.c
19997EOS
19998postprocess_cc_v=''
19999chmod +x ccsym
20000$eunicefix ccsym
20001./ccsym > ccsym1.raw
20002if $test -s ccsym1.raw; then
20003 $sort ccsym1.raw | $uniq >ccsym.raw
20004else
20005 mv ccsym1.raw ccsym.raw
20006fi
20007
20008$awk '/\=/ { print $0; next }
20009 { print $0"=1" }' ccsym.raw >ccsym.list
20010$awk '/\=/ { print $0; next }
20011 { print $0"=1" }' Cppsym.true >ccsym.true
20012$comm -13 ccsym.true ccsym.list >ccsym.own
20013$comm -12 ccsym.true ccsym.list >ccsym.com
20014$comm -23 ccsym.true ccsym.list >ccsym.cpp
20015also=''
20016if $test -z ccsym.raw; then
20017 echo "Your C compiler doesn't seem to define any symbols!" >&4
20018 echo " "
20019 echo "However, your C preprocessor defines the following symbols:"
20020 $cat Cppsym.true
20021 ccsymbols=''
20022 cppsymbols=`$cat Cppsym.true`
20023 cppsymbols=`echo $cppsymbols`
20024 cppccsymbols="$cppsymbols"
20025else
20026 if $test -s ccsym.com; then
20027 echo "Your C compiler and pre-processor define these symbols:"
20028 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20029 also='also '
20030 symbols='ones'
20031 cppccsymbols=`$cat ccsym.com`
20032 cppccsymbols=`echo $cppccsymbols`
20033 $test "$silent" || sleep 1
20034 fi
20035 if $test -s ccsym.cpp; then
20036 $test "$also" && echo " "
20037 echo "Your C pre-processor ${also}defines the following symbols:"
20038 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20039 also='further '
20040 cppsymbols=`$cat ccsym.cpp`
20041 cppsymbols=`echo $cppsymbols`
20042 $test "$silent" || sleep 1
20043 fi
20044 if $test -s ccsym.own; then
20045 $test "$also" && echo " "
20046 echo "Your C compiler ${also}defines the following cpp symbols:"
20047 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20048 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20049 ccsymbols=`$cat ccsym.own`
20050 ccsymbols=`echo $ccsymbols`
20051 $test "$silent" || sleep 1
20052 fi
20053fi
b4eb6b3d
JH
20054
20055: see if this is a termio system
20056val="$undef"
20057val2="$undef"
20058val3="$undef"
20059if $test `./findhdr termios.h`; then
20060 set tcsetattr i_termios
20061 eval $inlibc
20062 val3="$i_termios"
20063fi
20064echo " "
20065case "$val3" in
20066"$define") echo "You have POSIX termios.h... good!" >&4;;
20067*) if ./Cppsym pyr; then
20068 case "`/bin/universe`" in
20069 ucb) if $test `./findhdr sgtty.h`; then
20070 val2="$define"
20071 echo "<sgtty.h> found." >&4
20072 else
20073 echo "System is pyramid with BSD universe."
20074 echo "<sgtty.h> not found--you could have problems." >&4
20075 fi;;
20076 *) if $test `./findhdr termio.h`; then
20077 val="$define"
20078 echo "<termio.h> found." >&4
20079 else
20080 echo "System is pyramid with USG universe."
20081 echo "<termio.h> not found--you could have problems." >&4
20082 fi;;
20083 esac
20084 elif ./usg; then
20085 if $test `./findhdr termio.h`; then
20086 echo "<termio.h> found." >&4
20087 val="$define"
20088 elif $test `./findhdr sgtty.h`; then
20089 echo "<sgtty.h> found." >&4
20090 val2="$define"
20091 else
20092echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20093 fi
20094 else
20095 if $test `./findhdr sgtty.h`; then
20096 echo "<sgtty.h> found." >&4
20097 val2="$define"
20098 elif $test `./findhdr termio.h`; then
20099 echo "<termio.h> found." >&4
20100 val="$define"
20101 else
20102echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20103 fi
20104 fi;;
20105esac
20106set i_termio; eval $setvar
20107val=$val2; set i_sgtty; eval $setvar
20108val=$val3; set i_termios; eval $setvar
20109
b4eb6b3d
JH
20110: see if stddef is available
20111set stddef.h i_stddef
20112eval $inhdr
923fc586 20113
b4eb6b3d
JH
20114: see if this is a sunmath.h system
20115set sunmath.h i_sunmath
20116eval $inhdr
5f80c64f 20117
b4eb6b3d
JH
20118: see if sys/access.h is available
20119set sys/access.h i_sysaccess
20120eval $inhdr
20121
20122: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20123set sys/filio.h i_sysfilio
20124eval $inhdr
20125echo " "
20126if $test `./findhdr sys/ioctl.h`; then
20127 val="$define"
20128 echo '<sys/ioctl.h> found.' >&4
20129else
20130 val="$undef"
20131 if $test $i_sysfilio = "$define"; then
20132 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20133 else
b4eb6b3d
JH
20134 $test $i_sgtty = "$define" && xxx="sgtty.h"
20135 $test $i_termio = "$define" && xxx="termio.h"
20136 $test $i_termios = "$define" && xxx="termios.h"
20137echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20138 fi
20139fi
20140set i_sysioctl
20141eval $setvar
20142
49a78c82
JH
20143: see if socket ioctl defs are in sys/sockio.h
20144echo " "
20145xxx=`./findhdr sys/sockio.h`
20146if $test "$xxx"; then
20147 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20148 val="$define"
20149 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20150 else
20151 val="$undef"
20152 echo "No socket ioctls found in <sys/sockio.h>." >&4
20153 fi
20154else
20155 val="$undef"
20156 $cat <<EOM
20157<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20158EOM
20159fi
20160set i_syssockio
20161eval $setvar
20162
b4eb6b3d
JH
20163
20164: see if this is a syslog.h system
20165set syslog.h i_syslog
20166eval $inhdr
20167
20168
20169: see if this is a sys/mode.h system
20170set sys/mode.h i_sysmode
20171eval $inhdr
20172
20173: see if sys/resource.h has to be included
20174set sys/resource.h i_sysresrc
20175eval $inhdr
20176
20177: see if sys/security.h is available
20178set sys/security.h i_syssecrt
20179eval $inhdr
20180
20181: see if this is a sys/statvfs.h system
20182set sys/statvfs.h i_sysstatvfs
20183eval $inhdr
20184
b4eb6b3d
JH
20185: see if this is a sys/un.h system
20186set sys/un.h i_sysun
20187eval $inhdr
20188
20189
20190: see if this is a sys/utsname.h system
20191set sys/utsname.h i_sysutsname
20192eval $inhdr
20193
20194: see if this is a syswait system
20195set sys/wait.h i_syswait
20196eval $inhdr
20197
20198: see if this is a ustat.h system
20199set ustat.h i_ustat
20200eval $inhdr
20201
20202: see if this is an utime system
20203set utime.h i_utime
20204eval $inhdr
20205
20206: see if this is a values.h system
20207set values.h i_values
20208eval $inhdr
20209
20210: see if this is a vfork system
20211case "$d_vfork" in
20212"$define")
20213 set vfork.h i_vfork
20214 eval $inhdr
20215 ;;
20216*)
20217 i_vfork="$undef"
20218 ;;
20219esac
20220
20221: see if gdbm.h is available
20222set gdbm.h t_gdbm
20223eval $inhdr
20224case "$t_gdbm" in
20225$define)
20226 : see if gdbm_open exists
20227 set gdbm_open d_gdbm_open
20228 eval $inlibc
20229 case "$d_gdbm_open" in
20230 $undef)
20231 t_gdbm="$undef"
20232 echo "We won't be including <gdbm.h>"
5f80c64f 20233 ;;
b4eb6b3d
JH
20234 esac
20235 ;;
20236esac
20237val="$t_gdbm"
20238set i_gdbm
20239eval $setvar
20240
20241echo " "
20242echo "Looking for extensions..." >&4
20243: If we are using the old config.sh, known_extensions may contain
20244: old or inaccurate or duplicate values.
20245known_extensions=''
20246nonxs_extensions=''
20247: We do not use find because it might not be available.
20248: We do not just use MANIFEST because the user may have dropped
20249: some additional extensions into the source tree and expect them
20250: to be built.
20251
20252: Function to recursively find available extensions, ignoring DynaLoader
20253: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20254find_extensions='
20255 for xxx in *; do
20256 case "$xxx" in
20257 DynaLoader|dynaload) ;;
20258 *)
20259 if $test -f $xxx/$xxx.xs; then
20260 known_extensions="$known_extensions $1$xxx";
20261 elif $test -f $xxx/Makefile.PL; then
20262 nonxs_extensions="$nonxs_extensions $1$xxx";
20263 else
20264 if $test -d $xxx -a $# -lt 10; then
20265 set $1$xxx/ $*;
6904989c 20266 cd "$xxx";
b4eb6b3d
JH
20267 eval $find_extensions;
20268 cd ..;
20269 shift;
20270 fi;
20271 fi
20272 ;;
20273 esac;
20274 done'
20275tdir=`pwd`
6904989c 20276cd "$rsrc/ext"
b4eb6b3d
JH
20277set X
20278shift
20279eval $find_extensions
4e1a6d26
AD
20280# Special case: Add in threads/shared since it is not picked up by the
20281# recursive find above (and adding in general recursive finding breaks
20282# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20283known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20284set X $nonxs_extensions
20285shift
20286nonxs_extensions="$*"
20287set X $known_extensions
20288shift
20289known_extensions="$*"
6904989c 20290cd "$tdir"
b4eb6b3d
JH
20291
20292: Now see which are supported on this system.
20293avail_ext=''
20294for xxx in $known_extensions ; do
20295 case "$xxx" in
20296 DB_File|db_file)
20297 case "$i_db" in
20298 $define) avail_ext="$avail_ext $xxx" ;;
20299 esac
20300 ;;
20301 GDBM_File|gdbm_fil)
20302 case "$i_gdbm" in
20303 $define) avail_ext="$avail_ext $xxx" ;;
20304 esac
20305 ;;
1d59c593 20306 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20307 case "$i_langinfo$d_nl_langinfo" in
20308 $define$define) avail_ext="$avail_ext $xxx" ;;
20309 esac
20310 ;;
b4eb6b3d
JH
20311 NDBM_File|ndbm_fil)
20312 case "$i_ndbm" in
20313 $define)
20314 case "$osname-$use64bitint" in
0be9fa5d 20315 hpux-define)
b4eb6b3d
JH
20316 case "$libs" in
20317 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20318 esac
20319 ;;
20320 *) avail_ext="$avail_ext $xxx" ;;
20321 esac
20322 ;;
20323 esac
20324 ;;
20325 ODBM_File|odbm_fil)
20326 case "${i_dbm}${i_rpcsvcdbm}" in
20327 *"${define}"*)
20328 case "$osname-$use64bitint" in
0be9fa5d 20329 hpux-define)
b4eb6b3d
JH
20330 case "$libs" in
20331 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20332 esac
20333 ;;
20334 *) avail_ext="$avail_ext $xxx" ;;
20335 esac
20336 ;;
20337 esac
20338 ;;
20339 POSIX|posix)
20340 case "$useposix" in
20341 true|define|y) avail_ext="$avail_ext $xxx" ;;
20342 esac
20343 ;;
20344 Opcode|opcode)
20345 case "$useopcode" in
20346 true|define|y) avail_ext="$avail_ext $xxx" ;;
20347 esac
20348 ;;
20349 Socket|socket)
20350 case "$d_socket" in
4a9f028c
JH
20351 true|$define|y)
20352 case "$osname" in
20353 beos) ;; # not unless BONE
20354 *) avail_ext="$avail_ext $xxx" ;;
20355 esac
20356 ;;
b4eb6b3d
JH
20357 esac
20358 ;;
20359 Sys/Syslog|sys/syslog)
20360 : XXX syslog requires socket
20361 case "$d_socket" in
20362 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20363 esac
20364 ;;
20365 Thread|thread)
b00ec89b
AB
20366 case "$usethreads" in
20367 true|$define|y)
20368 case "$useithreads" in
20369 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20370 esac
b4eb6b3d
JH
20371 esac
20372 ;;
f9b6ed1c
AD
20373 XS/APItest|xs/apitest)
20374 # This is just for testing. Skip it unless we have dynamic loading.
20375
20376 case "$usedl" in
20377 $define) avail_ext="$avail_ext $xxx" ;;
20378 esac
20379 ;;
20380 XS/Typemap|xs/typemap)
20381 # This is just for testing. Skip it unless we have dynamic loading.
20382 case "$usedl" in
20383 $define) avail_ext="$avail_ext $xxx" ;;
20384 esac
20385 ;;
7deadc5f 20386 threads|threads/shared)
73e09c8f
JH
20387 # threads and threads::shared are special cases.
20388 # To stop people from asking "Perl 5.8.0 was supposed
20389 # to have this new fancy threads implementation but my
20390 # perl doesn't have it" and from people trying to
20391 # (re)install the threads module using CPAN.pm and
20392 # CPAN.pm then offering to reinstall Perl 5.8.0,
20393 # the threads.pm and threads/shared.pm will always be
20394 # there, croaking informatively ("you need to rebuild
20395 # all of Perl with threads, sorry") when threads haven't
20396 # been compiled in.
20397 # --jhi
20398 avail_ext="$avail_ext $xxx"
1dca008a 20399 ;;
b4eb6b3d
JH
20400 IPC/SysV|ipc/sysv)
20401 : XXX Do we need a useipcsysv variable here
20402 case "${d_msg}${d_sem}${d_shm}" in
20403 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20404 esac
20405 ;;
20406 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20407 ;;
20408 esac
b4eb6b3d 20409done
5f80c64f 20410
b4eb6b3d
JH
20411set X $avail_ext
20412shift
20413avail_ext="$*"
5f80c64f 20414
ef0c5be8
JH
20415case "$onlyextensions" in
20416'') ;;
20417*) keepextensions=''
20418 echo "You have requested that only certains extensions be included..." >&4
20419 for i in $onlyextensions; do
20420 case " $avail_ext " in
20421 *" $i "*)
20422 echo "Keeping extension $i."
20423 keepextensions="$keepextensions $i"
20424 ;;
20425 *) echo "Ignoring extension $i." ;;
20426 esac
20427 done
20428 avail_ext="$keepextensions"
20429 ;;
20430esac
20431
20432case "$noextensions" in
20433'') ;;
20434*) keepextensions=''
20435 echo "You have requested that certain extensions be ignored..." >&4
20436 for i in $avail_ext; do
c3dadc13
AD
20437 case " $noextensions " in
20438 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20439 *) echo "Keeping extension $i.";
20440 keepextensions="$keepextensions $i"
20441 ;;
20442 esac
20443 done
20444 avail_ext="$keepextensions"
20445 ;;
20446esac
20447
b4eb6b3d
JH
20448: Now see which nonxs extensions are supported on this system.
20449: For now assume all are.
20450nonxs_ext=''
20451for xxx in $nonxs_extensions ; do
20452 case "$xxx" in
20453 *) nonxs_ext="$nonxs_ext $xxx"
20454 ;;
20455 esac
20456done
5f80c64f 20457
b4eb6b3d
JH
20458set X $nonxs_ext
20459shift
20460nonxs_ext="$*"
20461
20462case $usedl in
20463$define)
20464 $cat <<EOM
20465A number of extensions are supplied with $package. You may choose to
20466compile these extensions for dynamic loading (the default), compile
20467them into the $package executable (static loading), or not include
20468them at all. Answer "none" to include no extensions.
20469Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20470
20471EOM
b4eb6b3d 20472 case "$dynamic_ext" in
736accd3
YST
20473 '')
20474 : Exclude those listed in static_ext
20475 dflt=''
20476 for xxx in $avail_ext; do
20477 case " $static_ext " in
20478 *" $xxx "*) ;;
20479 *) dflt="$dflt $xxx" ;;
20480 esac
20481 done
20482 set X $dflt
20483 shift
20484 dflt="$*"
20485 ;;
b4eb6b3d
JH
20486 *) dflt="$dynamic_ext"
20487 # Perhaps we are reusing an old out-of-date config.sh.
20488 case "$hint" in
20489 previous)
20490 if test X"$dynamic_ext" != X"$avail_ext"; then
20491 $cat <<EOM
20492NOTICE: Your previous config.sh list may be incorrect.
20493The extensions now available to you are
20494 ${avail_ext}
20495but the default list from your previous config.sh is
20496 ${dynamic_ext}
9c839522 20497
b4eb6b3d
JH
20498EOM
20499 fi
9c839522
PM
20500 ;;
20501 esac
b4eb6b3d
JH
20502 ;;
20503 esac
5f80c64f 20504 case "$dflt" in
b4eb6b3d
JH
20505 '') dflt=none;;
20506 esac
20507 rp="What extensions do you wish to load dynamically?"
20508 . ./myread
20509 case "$ans" in
20510 none) dynamic_ext=' ' ;;
20511 *) dynamic_ext="$ans" ;;
5f80c64f 20512 esac
5f80c64f 20513
b4eb6b3d
JH
20514 case "$static_ext" in
20515 '')
20516 : Exclude those already listed in dynamic linking
20517 dflt=''
20518 for xxx in $avail_ext; do
20519 case " $dynamic_ext " in
20520 *" $xxx "*) ;;
20521 *) dflt="$dflt $xxx" ;;
20522 esac
20523 done
20524 set X $dflt
20525 shift
20526 dflt="$*"
20527 ;;
20528 *) dflt="$static_ext"
20529 ;;
20530 esac
9c839522 20531
b4eb6b3d
JH
20532 case "$dflt" in
20533 '') dflt=none;;
20534 esac
20535 rp="What extensions do you wish to load statically?"
20536 . ./myread
20537 case "$ans" in
20538 none) static_ext=' ' ;;
20539 *) static_ext="$ans" ;;
20540 esac
20541 ;;
20542*)
20543 $cat <<EOM
20544A number of extensions are supplied with $package. Answer "none"
20545to include no extensions.
20546Note that DynaLoader is always built and need not be mentioned here.
9c839522 20547
b4eb6b3d
JH
20548EOM
20549 case "$static_ext" in
20550 '') dflt="$avail_ext" ;;
20551 *) dflt="$static_ext"
20552 # Perhaps we are reusing an old out-of-date config.sh.
20553 case "$hint" in
20554 previous)
20555 if test X"$static_ext" != X"$avail_ext"; then
20556 $cat <<EOM
20557NOTICE: Your previous config.sh list may be incorrect.
20558The extensions now available to you are
20559 ${avail_ext}
20560but the default list from your previous config.sh is
20561 ${static_ext}
5f80c64f
JH
20562
20563EOM
b4eb6b3d
JH
20564 fi
20565 ;;
20566 esac
20567 ;;
20568 esac
20569 : Exclude those that are not xs extensions
20570 case "$dflt" in
20571 '') dflt=none;;
20572 esac
20573 rp="What extensions do you wish to include?"
20574 . ./myread
20575 case "$ans" in
20576 none) static_ext=' ' ;;
20577 *) static_ext="$ans" ;;
20578 esac
20579 ;;
5f80c64f 20580esac
f1f6834f
AD
20581#
20582# Encode is a special case. If we are building Encode as a static
20583# extension, we need to explicitly list its subextensions as well.
20584# For other nested extensions, this is handled automatically by
20585# the appropriate Makefile.PL.
20586case " $static_ext " in
20587 *" Encode "*) # Add the subextensions of Encode
20588 cd "$rsrc/ext"
20589 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20590 static_ext="$static_ext Encode/$xxx"
20591 done
20592 cd "$tdir"
20593 ;;
20594esac
5f80c64f 20595
b4eb6b3d
JH
20596set X $dynamic_ext $static_ext $nonxs_ext
20597shift
20598extensions="$*"
20599
93a2cd18
AD
20600# Sanity check: We require an extension suitable for use with
20601# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20602# should show up as failures in the test suite, but it's helpful to
20603# catch them now.) The 'extensions' list is normally sorted
20604# alphabetically, so we need to accept either
20605# DB_File ... Fcntl ... IO ....
20606# or something like
20607# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
20608case " $extensions" in
20609*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20610*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20611*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
20612*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20613 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20614 ;;
20615esac
20616
9c839522
PM
20617: Remove libraries needed only for extensions
20618: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20619: The exception is SunOS 4.x, which needs them.
20620case "${osname}X${osvers}" in
20621sunos*X4*)
20622 perllibs="$libs"
20623 ;;
20624*) case "$usedl" in
20625 $define|true|[yY]*)
20626 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20627 shift
20628 perllibs="$*"
20629 ;;
20630 *) perllibs="$libs"
20631 ;;
20632 esac
20633 ;;
9c839522 20634esac
5f80c64f
JH
20635
20636: Remove build directory name from cppstdin so it can be used from
20637: either the present location or the final installed location.
20638echo " "
20639: Get out of the UU directory to get correct path name.
20640cd ..
20641case "$cppstdin" in
20642`pwd`/cppstdin)
20643 echo "Stripping down cppstdin path name"
20644 cppstdin=cppstdin
20645 ;;
20646esac
20647cd UU
20648
20649: end of configuration questions
20650echo " "
20651echo "End of configuration questions."
20652echo " "
20653
20654: back to where it started
20655if test -d ../UU; then
20656 cd ..
20657fi
20658
48370efc
JH
20659: configuration may be patched via a 'config.arch' file
20660if $test -f config.arch; then
20661 echo "I see a config.arch file, loading it."
20662 . ./config.arch
20663fi
20664
5f80c64f
JH
20665: configuration may be patched via a 'config.over' file
20666if $test -f config.over; then
20667 echo " "
20668 dflt=y
20669 rp='I see a config.over file. Do you wish to load it?'
20670 . UU/myread
20671 case "$ans" in
20672 n*) echo "OK, I'll ignore it.";;
20673 *) . ./config.over
20674 echo "Configuration override changes have been loaded."
20675 ;;
20676 esac
20677fi
20678
20679: in case they want portability, strip down executable paths
20680case "$d_portable" in
20681"$define")
20682 echo " "
20683 echo "Stripping down executable paths..." >&4
20684 for file in $loclist $trylist; do
534ac15a
JH
20685 eval temp=\$$file
20686 eval $file=`basename $temp`
5f80c64f
JH
20687 done
20688 ;;
20689esac
20690
20691: create config.sh file
20692echo " "
20693echo "Creating config.sh..." >&4
20694$spitshell <<EOT >config.sh
20695$startsh
20696#
20697# This file was produced by running the Configure script. It holds all the
20698# definitions figured out by Configure. Should you modify one of these values,
20699# do not forget to propagate your changes by running "Configure -der". You may
20700# instead choose to run each of the .SH files by yourself, or "Configure -S".
20701#
20702
20703# Package name : $package
20704# Source directory : $src
20705# Configuration time: $cf_time
20706# Configured by : $cf_by
20707# Target system : $myuname
20708
20709Author='$Author'
20710Date='$Date'
20711Header='$Header'
20712Id='$Id'
20713Locker='$Locker'
20714Log='$Log'
20715Mcc='$Mcc'
20716RCSfile='$RCSfile'
20717Revision='$Revision'
20718Source='$Source'
20719State='$State'
20720_a='$_a'
20721_exe='$_exe'
20722_o='$_o'
b4eb6b3d 20723afs='$afs'
a6d26a0d 20724afsroot='$afsroot'
b4eb6b3d
JH
20725alignbytes='$alignbytes'
20726ansi2knr='$ansi2knr'
20727aphostname='$aphostname'
20728api_revision='$api_revision'
20729api_subversion='$api_subversion'
20730api_version='$api_version'
20731api_versionstring='$api_versionstring'
5f80c64f 20732ar='$ar'
b4eb6b3d
JH
20733archlib='$archlib'
20734archlibexp='$archlibexp'
20735archname64='$archname64'
20736archname='$archname'
5f80c64f 20737archobjs='$archobjs'
10bc17b6 20738asctime_r_proto='$asctime_r_proto'
5f80c64f 20739awk='$awk'
b4eb6b3d 20740baserev='$baserev'
5f80c64f 20741bash='$bash'
b4eb6b3d 20742bin='$bin'
b4eb6b3d 20743binexp='$binexp'
5f80c64f
JH
20744bison='$bison'
20745byacc='$byacc'
b4eb6b3d 20746byteorder='$byteorder'
5f80c64f 20747c='$c'
b4eb6b3d 20748castflags='$castflags'
5f80c64f
JH
20749cat='$cat'
20750cc='$cc'
20751cccdlflags='$cccdlflags'
20752ccdlflags='$ccdlflags'
20753ccflags='$ccflags'
b4eb6b3d 20754ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 20755ccname='$ccname'
b4eb6b3d 20756ccsymbols='$ccsymbols'
6b356c8e 20757ccversion='$ccversion'
5f80c64f 20758cf_by='$cf_by'
b4eb6b3d 20759cf_email='$cf_email'
5f80c64f 20760cf_time='$cf_time'
b4eb6b3d 20761charsize='$charsize'
5f80c64f
JH
20762chgrp='$chgrp'
20763chmod='$chmod'
20764chown='$chown'
b4eb6b3d 20765clocktype='$clocktype'
5f80c64f
JH
20766comm='$comm'
20767compress='$compress'
20768contains='$contains'
20769cp='$cp'
20770cpio='$cpio'
20771cpp='$cpp'
b4eb6b3d
JH
20772cpp_stuff='$cpp_stuff'
20773cppccsymbols='$cppccsymbols'
5f80c64f
JH
20774cppflags='$cppflags'
20775cpplast='$cpplast'
20776cppminus='$cppminus'
20777cpprun='$cpprun'
20778cppstdin='$cppstdin'
b4eb6b3d 20779cppsymbols='$cppsymbols'
10bc17b6 20780crypt_r_proto='$crypt_r_proto'
b4eb6b3d 20781cryptlib='$cryptlib'
5f80c64f 20782csh='$csh'
10bc17b6
JH
20783ctermid_r_proto='$ctermid_r_proto'
20784ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
20785d_Gconvert='$d_Gconvert'
20786d_PRIEUldbl='$d_PRIEUldbl'
20787d_PRIFUldbl='$d_PRIFUldbl'
20788d_PRIGUldbl='$d_PRIGUldbl'
20789d_PRIXU64='$d_PRIXU64'
20790d_PRId64='$d_PRId64'
20791d_PRIeldbl='$d_PRIeldbl'
20792d_PRIfldbl='$d_PRIfldbl'
20793d_PRIgldbl='$d_PRIgldbl'
20794d_PRIi64='$d_PRIi64'
20795d_PRIo64='$d_PRIo64'
20796d_PRIu64='$d_PRIu64'
20797d_PRIx64='$d_PRIx64'
20798d_SCNfldbl='$d_SCNfldbl'
74cac757 20799d__fwalk='$d__fwalk'
b4eb6b3d
JH
20800d_access='$d_access'
20801d_accessx='$d_accessx'
55954f19 20802d_aintl='$d_aintl'
b4eb6b3d
JH
20803d_alarm='$d_alarm'
20804d_archlib='$d_archlib'
10bc17b6 20805d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
20806d_atolf='$d_atolf'
20807d_atoll='$d_atoll'
0dbb1585
AL
20808d_attribute_format='$d_attribute_format'
20809d_attribute_malloc='$d_attribute_malloc'
20810d_attribute_nonnull='$d_attribute_nonnull'
20811d_attribute_noreturn='$d_attribute_noreturn'
20812d_attribute_pure='$d_attribute_pure'
20813d_attribute_unused='$d_attribute_unused'
20814d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
20815d_bcmp='$d_bcmp'
20816d_bcopy='$d_bcopy'
5f80c64f 20817d_bsd='$d_bsd'
b4eb6b3d
JH
20818d_bsdgetpgrp='$d_bsdgetpgrp'
20819d_bsdsetpgrp='$d_bsdsetpgrp'
20820d_bzero='$d_bzero'
20821d_casti32='$d_casti32'
20822d_castneg='$d_castneg'
20823d_charvspr='$d_charvspr'
20824d_chown='$d_chown'
20825d_chroot='$d_chroot'
20826d_chsize='$d_chsize'
758a5d79 20827d_class='$d_class'
b4eb6b3d 20828d_closedir='$d_closedir'
4e0554ec 20829d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 20830d_const='$d_const'
55954f19 20831d_copysignl='$d_copysignl'
b4eb6b3d 20832d_crypt='$d_crypt'
10bc17b6 20833d_crypt_r='$d_crypt_r'
b4eb6b3d 20834d_csh='$d_csh'
10bc17b6
JH
20835d_ctermid_r='$d_ctermid_r'
20836d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
20837d_cuserid='$d_cuserid'
20838d_dbl_dig='$d_dbl_dig'
2ef53570 20839d_dbminitproto='$d_dbminitproto'
b4eb6b3d 20840d_difftime='$d_difftime'
ae0e3d3b 20841d_dirfd='$d_dirfd'
b4eb6b3d
JH
20842d_dirnamlen='$d_dirnamlen'
20843d_dlerror='$d_dlerror'
5f80c64f 20844d_dlopen='$d_dlopen'
b4eb6b3d
JH
20845d_dlsymun='$d_dlsymun'
20846d_dosuid='$d_dosuid'
10bc17b6 20847d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
20848d_drand48proto='$d_drand48proto'
20849d_dup2='$d_dup2'
20850d_eaccess='$d_eaccess'
20851d_endgrent='$d_endgrent'
10bc17b6 20852d_endgrent_r='$d_endgrent_r'
b4eb6b3d 20853d_endhent='$d_endhent'
10bc17b6 20854d_endhostent_r='$d_endhostent_r'
b4eb6b3d 20855d_endnent='$d_endnent'
10bc17b6 20856d_endnetent_r='$d_endnetent_r'
b4eb6b3d 20857d_endpent='$d_endpent'
10bc17b6 20858d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 20859d_endpwent='$d_endpwent'
10bc17b6 20860d_endpwent_r='$d_endpwent_r'
b4eb6b3d 20861d_endsent='$d_endsent'
10bc17b6 20862d_endservent_r='$d_endservent_r'
b4eb6b3d 20863d_eofnblk='$d_eofnblk'
5f80c64f 20864d_eunice='$d_eunice'
15b61c98 20865d_faststdio='$d_faststdio'
b363b713 20866d_fchdir='$d_fchdir'
b4eb6b3d
JH
20867d_fchmod='$d_fchmod'
20868d_fchown='$d_fchown'
20869d_fcntl='$d_fcntl'
9d9004a9 20870d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
20871d_fd_macros='$d_fd_macros'
20872d_fd_set='$d_fd_set'
20873d_fds_bits='$d_fds_bits'
20874d_fgetpos='$d_fgetpos'
758a5d79
JH
20875d_finite='$d_finite'
20876d_finitel='$d_finitel'
b4eb6b3d
JH
20877d_flexfnam='$d_flexfnam'
20878d_flock='$d_flock'
2ef53570 20879d_flockproto='$d_flockproto'
b4eb6b3d 20880d_fork='$d_fork'
758a5d79 20881d_fp_class='$d_fp_class'
b4eb6b3d 20882d_fpathconf='$d_fpathconf'
758a5d79
JH
20883d_fpclass='$d_fpclass'
20884d_fpclassify='$d_fpclassify'
20885d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
20886d_fpos64_t='$d_fpos64_t'
20887d_frexpl='$d_frexpl'
20888d_fs_data_s='$d_fs_data_s'
20889d_fseeko='$d_fseeko'
20890d_fsetpos='$d_fsetpos'
20891d_fstatfs='$d_fstatfs'
20892d_fstatvfs='$d_fstatvfs'
411ab01c 20893d_fsync='$d_fsync'
b4eb6b3d
JH
20894d_ftello='$d_ftello'
20895d_ftime='$d_ftime'
20896d_getcwd='$d_getcwd'
20897d_getespwnam='$d_getespwnam'
20898d_getfsstat='$d_getfsstat'
20899d_getgrent='$d_getgrent'
10bc17b6
JH
20900d_getgrent_r='$d_getgrent_r'
20901d_getgrgid_r='$d_getgrgid_r'
20902d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
20903d_getgrps='$d_getgrps'
20904d_gethbyaddr='$d_gethbyaddr'
20905d_gethbyname='$d_gethbyname'
20906d_gethent='$d_gethent'
20907d_gethname='$d_gethname'
10bc17b6
JH
20908d_gethostbyaddr_r='$d_gethostbyaddr_r'
20909d_gethostbyname_r='$d_gethostbyname_r'
20910d_gethostent_r='$d_gethostent_r'
b4eb6b3d 20911d_gethostprotos='$d_gethostprotos'
4e0554ec 20912d_getitimer='$d_getitimer'
b4eb6b3d 20913d_getlogin='$d_getlogin'
10bc17b6 20914d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
20915d_getmnt='$d_getmnt'
20916d_getmntent='$d_getmntent'
20917d_getnbyaddr='$d_getnbyaddr'
20918d_getnbyname='$d_getnbyname'
20919d_getnent='$d_getnent'
10bc17b6
JH
20920d_getnetbyaddr_r='$d_getnetbyaddr_r'
20921d_getnetbyname_r='$d_getnetbyname_r'
20922d_getnetent_r='$d_getnetent_r'
b4eb6b3d 20923d_getnetprotos='$d_getnetprotos'
0c0643d0 20924d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
20925d_getpbyname='$d_getpbyname'
20926d_getpbynumber='$d_getpbynumber'
20927d_getpent='$d_getpent'
20928d_getpgid='$d_getpgid'
20929d_getpgrp2='$d_getpgrp2'
20930d_getpgrp='$d_getpgrp'
20931d_getppid='$d_getppid'
20932d_getprior='$d_getprior'
10bc17b6
JH
20933d_getprotobyname_r='$d_getprotobyname_r'
20934d_getprotobynumber_r='$d_getprotobynumber_r'
20935d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
20936d_getprotoprotos='$d_getprotoprotos'
20937d_getprpwnam='$d_getprpwnam'
20938d_getpwent='$d_getpwent'
10bc17b6
JH
20939d_getpwent_r='$d_getpwent_r'
20940d_getpwnam_r='$d_getpwnam_r'
20941d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
20942d_getsbyname='$d_getsbyname'
20943d_getsbyport='$d_getsbyport'
20944d_getsent='$d_getsent'
10bc17b6
JH
20945d_getservbyname_r='$d_getservbyname_r'
20946d_getservbyport_r='$d_getservbyport_r'
20947d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
20948d_getservprotos='$d_getservprotos'
20949d_getspnam='$d_getspnam'
10bc17b6 20950d_getspnam_r='$d_getspnam_r'
b4eb6b3d 20951d_gettimeod='$d_gettimeod'
10bc17b6 20952d_gmtime_r='$d_gmtime_r'
5f80c64f 20953d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
20954d_grpasswd='$d_grpasswd'
20955d_hasmntopt='$d_hasmntopt'
20956d_htonl='$d_htonl'
55954f19 20957d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
20958d_index='$d_index'
20959d_inetaton='$d_inetaton'
20960d_int64_t='$d_int64_t'
20961d_isascii='$d_isascii'
758a5d79
JH
20962d_isfinite='$d_isfinite'
20963d_isinf='$d_isinf'
b4eb6b3d
JH
20964d_isnan='$d_isnan'
20965d_isnanl='$d_isnanl'
20966d_killpg='$d_killpg'
20967d_lchown='$d_lchown'
20968d_ldbl_dig='$d_ldbl_dig'
0a0abfba 20969d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 20970d_link='$d_link'
10bc17b6 20971d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
20972d_locconv='$d_locconv'
20973d_lockf='$d_lockf'
20974d_longdbl='$d_longdbl'
20975d_longlong='$d_longlong'
20976d_lseekproto='$d_lseekproto'
20977d_lstat='$d_lstat'
20978d_madvise='$d_madvise'
20979d_mblen='$d_mblen'
20980d_mbstowcs='$d_mbstowcs'
20981d_mbtowc='$d_mbtowc'
20982d_memchr='$d_memchr'
20983d_memcmp='$d_memcmp'
20984d_memcpy='$d_memcpy'
20985d_memmove='$d_memmove'
20986d_memset='$d_memset'
20987d_mkdir='$d_mkdir'
20988d_mkdtemp='$d_mkdtemp'
20989d_mkfifo='$d_mkfifo'
20990d_mkstemp='$d_mkstemp'
20991d_mkstemps='$d_mkstemps'
20992d_mktime='$d_mktime'
20993d_mmap='$d_mmap'
20994d_modfl='$d_modfl'
e67aeab1 20995d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 20996d_modflproto='$d_modflproto'
b4eb6b3d
JH
20997d_mprotect='$d_mprotect'
20998d_msg='$d_msg'
20999d_msg_ctrunc='$d_msg_ctrunc'
21000d_msg_dontroute='$d_msg_dontroute'
21001d_msg_oob='$d_msg_oob'
21002d_msg_peek='$d_msg_peek'
21003d_msg_proxy='$d_msg_proxy'
21004d_msgctl='$d_msgctl'
21005d_msgget='$d_msgget'
4e0554ec 21006d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21007d_msgrcv='$d_msgrcv'
21008d_msgsnd='$d_msgsnd'
21009d_msync='$d_msync'
21010d_munmap='$d_munmap'
21011d_mymalloc='$d_mymalloc'
21012d_nice='$d_nice'
2765b840 21013d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21014d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
21015d_off64_t='$d_off64_t'
21016d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21017d_oldpthreads='$d_oldpthreads'
21018d_oldsock='$d_oldsock'
21019d_open3='$d_open3'
21020d_pathconf='$d_pathconf'
21021d_pause='$d_pause'
21022d_perl_otherlibdirs='$d_perl_otherlibdirs'
21023d_phostname='$d_phostname'
21024d_pipe='$d_pipe'
21025d_poll='$d_poll'
5f80c64f 21026d_portable='$d_portable'
c7aff470 21027d_procselfexe='$d_procselfexe'
d6483fcc 21028d_pthread_atfork='$d_pthread_atfork'
58d975c3 21029d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21030d_pthread_yield='$d_pthread_yield'
21031d_pwage='$d_pwage'
21032d_pwchange='$d_pwchange'
21033d_pwclass='$d_pwclass'
21034d_pwcomment='$d_pwcomment'
21035d_pwexpire='$d_pwexpire'
21036d_pwgecos='$d_pwgecos'
21037d_pwpasswd='$d_pwpasswd'
21038d_pwquota='$d_pwquota'
21039d_qgcvt='$d_qgcvt'
21040d_quad='$d_quad'
10bc17b6
JH
21041d_random_r='$d_random_r'
21042d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21043d_readdir='$d_readdir'
10bc17b6 21044d_readdir_r='$d_readdir_r'
b4eb6b3d 21045d_readlink='$d_readlink'
4e0554ec
JH
21046d_readv='$d_readv'
21047d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21048d_rename='$d_rename'
21049d_rewinddir='$d_rewinddir'
21050d_rmdir='$d_rmdir'
21051d_safebcpy='$d_safebcpy'
21052d_safemcpy='$d_safemcpy'
21053d_sanemcmp='$d_sanemcmp'
ef9f17be 21054d_sbrkproto='$d_sbrkproto'
55954f19 21055d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21056d_sched_yield='$d_sched_yield'
21057d_scm_rights='$d_scm_rights'
21058d_seekdir='$d_seekdir'
21059d_select='$d_select'
21060d_sem='$d_sem'
21061d_semctl='$d_semctl'
21062d_semctl_semid_ds='$d_semctl_semid_ds'
21063d_semctl_semun='$d_semctl_semun'
21064d_semget='$d_semget'
21065d_semop='$d_semop'
4e0554ec 21066d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21067d_setegid='$d_setegid'
21068d_seteuid='$d_seteuid'
21069d_setgrent='$d_setgrent'
10bc17b6 21070d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21071d_setgrps='$d_setgrps'
21072d_sethent='$d_sethent'
10bc17b6 21073d_sethostent_r='$d_sethostent_r'
4e0554ec 21074d_setitimer='$d_setitimer'
b4eb6b3d
JH
21075d_setlinebuf='$d_setlinebuf'
21076d_setlocale='$d_setlocale'
10bc17b6 21077d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21078d_setnent='$d_setnent'
10bc17b6 21079d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21080d_setpent='$d_setpent'
21081d_setpgid='$d_setpgid'
21082d_setpgrp2='$d_setpgrp2'
21083d_setpgrp='$d_setpgrp'
21084d_setprior='$d_setprior'
21085d_setproctitle='$d_setproctitle'
10bc17b6 21086d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21087d_setpwent='$d_setpwent'
10bc17b6 21088d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21089d_setregid='$d_setregid'
21090d_setresgid='$d_setresgid'
21091d_setresuid='$d_setresuid'
21092d_setreuid='$d_setreuid'
21093d_setrgid='$d_setrgid'
21094d_setruid='$d_setruid'
21095d_setsent='$d_setsent'
10bc17b6 21096d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21097d_setsid='$d_setsid'
21098d_setvbuf='$d_setvbuf'
21099d_sfio='$d_sfio'
21100d_shm='$d_shm'
21101d_shmat='$d_shmat'
21102d_shmatprototype='$d_shmatprototype'
21103d_shmctl='$d_shmctl'
21104d_shmdt='$d_shmdt'
21105d_shmget='$d_shmget'
21106d_sigaction='$d_sigaction'
983dbef6 21107d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21108d_sigsetjmp='$d_sigsetjmp'
49a78c82 21109d_sockatmark='$d_sockatmark'
2ef53570 21110d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21111d_socket='$d_socket'
21112d_socklen_t='$d_socklen_t'
21113d_sockpair='$d_sockpair'
21114d_socks5_init='$d_socks5_init'
21115d_sqrtl='$d_sqrtl'
10bc17b6
JH
21116d_srand48_r='$d_srand48_r'
21117d_srandom_r='$d_srandom_r'
eef837ea 21118d_sresgproto='$d_sresgproto'
640374d0 21119d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21120d_statblks='$d_statblks'
21121d_statfs_f_flags='$d_statfs_f_flags'
21122d_statfs_s='$d_statfs_s'
21123d_statvfs='$d_statvfs'
21124d_stdio_cnt_lval='$d_stdio_cnt_lval'
21125d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21126d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21127d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21128d_stdio_stream_array='$d_stdio_stream_array'
21129d_stdiobase='$d_stdiobase'
21130d_stdstdio='$d_stdstdio'
21131d_strchr='$d_strchr'
21132d_strcoll='$d_strcoll'
21133d_strctcpy='$d_strctcpy'
21134d_strerrm='$d_strerrm'
21135d_strerror='$d_strerror'
10bc17b6 21136d_strerror_r='$d_strerror_r'
b3c85772 21137d_strftime='$d_strftime'
08c92000
MB
21138d_strlcat='$d_strlcat'
21139d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21140d_strtod='$d_strtod'
21141d_strtol='$d_strtol'
21142d_strtold='$d_strtold'
21143d_strtoll='$d_strtoll'
28e5dec8 21144d_strtoq='$d_strtoq'
b4eb6b3d
JH
21145d_strtoul='$d_strtoul'
21146d_strtoull='$d_strtoull'
21147d_strtouq='$d_strtouq'
21148d_strxfrm='$d_strxfrm'
21149d_suidsafe='$d_suidsafe'
21150d_symlink='$d_symlink'
21151d_syscall='$d_syscall'
2ef53570 21152d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21153d_sysconf='$d_sysconf'
21154d_sysernlst='$d_sysernlst'
21155d_syserrlst='$d_syserrlst'
21156d_system='$d_system'
21157d_tcgetpgrp='$d_tcgetpgrp'
21158d_tcsetpgrp='$d_tcsetpgrp'
21159d_telldir='$d_telldir'
21160d_telldirproto='$d_telldirproto'
21161d_time='$d_time'
21162d_times='$d_times'
14b90194
JH
21163d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21164d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21165d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21166d_truncate='$d_truncate'
10bc17b6 21167d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21168d_tzname='$d_tzname'
4e0554ec
JH
21169d_u32align='$d_u32align'
21170d_ualarm='$d_ualarm'
b4eb6b3d
JH
21171d_umask='$d_umask'
21172d_uname='$d_uname'
21173d_union_semun='$d_union_semun'
758a5d79 21174d_unordered='$d_unordered'
4e0554ec 21175d_usleep='$d_usleep'
2ef53570 21176d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21177d_ustat='$d_ustat'
21178d_vendorarch='$d_vendorarch'
21179d_vendorbin='$d_vendorbin'
21180d_vendorlib='$d_vendorlib'
6e1038e0 21181d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21182d_vfork='$d_vfork'
21183d_void_closedir='$d_void_closedir'
21184d_voidsig='$d_voidsig'
21185d_voidtty='$d_voidtty'
21186d_volatile='$d_volatile'
21187d_vprintf='$d_vprintf'
21188d_wait4='$d_wait4'
21189d_waitpid='$d_waitpid'
21190d_wcstombs='$d_wcstombs'
21191d_wctomb='$d_wctomb'
4e0554ec 21192d_writev='$d_writev'
5f80c64f
JH
21193d_xenix='$d_xenix'
21194date='$date'
b4eb6b3d
JH
21195db_hashtype='$db_hashtype'
21196db_prefixtype='$db_prefixtype'
640374d0
JH
21197db_version_major='$db_version_major'
21198db_version_minor='$db_version_minor'
21199db_version_patch='$db_version_patch'
b4eb6b3d
JH
21200defvoidused='$defvoidused'
21201direntrytype='$direntrytype'
21202dlext='$dlext'
5f80c64f 21203dlsrc='$dlsrc'
b4eb6b3d
JH
21204doublesize='$doublesize'
21205drand01='$drand01'
10bc17b6 21206drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21207dynamic_ext='$dynamic_ext'
21208eagain='$eagain'
21209ebcdic='$ebcdic'
5f80c64f
JH
21210echo='$echo'
21211egrep='$egrep'
21212emacs='$emacs'
10bc17b6
JH
21213endgrent_r_proto='$endgrent_r_proto'
21214endhostent_r_proto='$endhostent_r_proto'
21215endnetent_r_proto='$endnetent_r_proto'
21216endprotoent_r_proto='$endprotoent_r_proto'
21217endpwent_r_proto='$endpwent_r_proto'
21218endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21219eunicefix='$eunicefix'
21220exe_ext='$exe_ext'
21221expr='$expr'
b4eb6b3d 21222extensions='$extensions'
6fcddf3b 21223extras='$extras'
b4eb6b3d
JH
21224fflushNULL='$fflushNULL'
21225fflushall='$fflushall'
5f80c64f
JH
21226find='$find'
21227firstmakefile='$firstmakefile'
21228flex='$flex'
b4eb6b3d
JH
21229fpossize='$fpossize'
21230fpostype='$fpostype'
21231freetype='$freetype'
5440bc8e 21232from='$from'
b4eb6b3d
JH
21233full_ar='$full_ar'
21234full_csh='$full_csh'
21235full_sed='$full_sed'
2d736872 21236gccansipedantic='$gccansipedantic'
5b463ca7 21237gccosandvers='$gccosandvers'
5f80c64f 21238gccversion='$gccversion'
10bc17b6
JH
21239getgrent_r_proto='$getgrent_r_proto'
21240getgrgid_r_proto='$getgrgid_r_proto'
21241getgrnam_r_proto='$getgrnam_r_proto'
21242gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21243gethostbyname_r_proto='$gethostbyname_r_proto'
21244gethostent_r_proto='$gethostent_r_proto'
21245getlogin_r_proto='$getlogin_r_proto'
21246getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21247getnetbyname_r_proto='$getnetbyname_r_proto'
21248getnetent_r_proto='$getnetent_r_proto'
21249getprotobyname_r_proto='$getprotobyname_r_proto'
21250getprotobynumber_r_proto='$getprotobynumber_r_proto'
21251getprotoent_r_proto='$getprotoent_r_proto'
21252getpwent_r_proto='$getpwent_r_proto'
21253getpwnam_r_proto='$getpwnam_r_proto'
21254getpwuid_r_proto='$getpwuid_r_proto'
21255getservbyname_r_proto='$getservbyname_r_proto'
21256getservbyport_r_proto='$getservbyport_r_proto'
21257getservent_r_proto='$getservent_r_proto'
21258getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21259gidformat='$gidformat'
21260gidsign='$gidsign'
21261gidsize='$gidsize'
21262gidtype='$gidtype'
5f80c64f 21263glibpth='$glibpth'
3c728e00 21264gmake='$gmake'
10bc17b6 21265gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21266gnulibc_version='$gnulibc_version'
5f80c64f 21267grep='$grep'
b4eb6b3d
JH
21268groupcat='$groupcat'
21269groupstype='$groupstype'
5f80c64f 21270gzip='$gzip'
b4eb6b3d
JH
21271h_fcntl='$h_fcntl'
21272h_sysfile='$h_sysfile'
5f80c64f 21273hint='$hint'
b4eb6b3d 21274hostcat='$hostcat'
6e1038e0
MB
21275html1dir='$html1dir'
21276html1direxp='$html1direxp'
21277html3dir='$html3dir'
21278html3direxp='$html3direxp'
b4eb6b3d
JH
21279i16size='$i16size'
21280i16type='$i16type'
21281i32size='$i32size'
21282i32type='$i32type'
21283i64size='$i64size'
21284i64type='$i64type'
21285i8size='$i8size'
21286i8type='$i8type'
21287i_arpainet='$i_arpainet'
21288i_bsdioctl='$i_bsdioctl'
10bc17b6 21289i_crypt='$i_crypt'
b4eb6b3d
JH
21290i_db='$i_db'
21291i_dbm='$i_dbm'
21292i_dirent='$i_dirent'
5f80c64f 21293i_dld='$i_dld'
b4eb6b3d
JH
21294i_dlfcn='$i_dlfcn'
21295i_fcntl='$i_fcntl'
21296i_float='$i_float'
758a5d79
JH
21297i_fp='$i_fp'
21298i_fp_class='$i_fp_class'
b4eb6b3d
JH
21299i_gdbm='$i_gdbm'
21300i_grp='$i_grp'
b4eb6b3d
JH
21301i_ieeefp='$i_ieeefp'
21302i_inttypes='$i_inttypes'
2765b840 21303i_langinfo='$i_langinfo'
b4eb6b3d
JH
21304i_libutil='$i_libutil'
21305i_limits='$i_limits'
21306i_locale='$i_locale'
21307i_machcthr='$i_machcthr'
21308i_malloc='$i_malloc'
21309i_math='$i_math'
21310i_memory='$i_memory'
21311i_mntent='$i_mntent'
21312i_ndbm='$i_ndbm'
21313i_netdb='$i_netdb'
21314i_neterrno='$i_neterrno'
21315i_netinettcp='$i_netinettcp'
21316i_niin='$i_niin'
21317i_poll='$i_poll'
21318i_prot='$i_prot'
21319i_pthread='$i_pthread'
21320i_pwd='$i_pwd'
21321i_rpcsvcdbm='$i_rpcsvcdbm'
21322i_sfio='$i_sfio'
21323i_sgtty='$i_sgtty'
21324i_shadow='$i_shadow'
21325i_socks='$i_socks'
21326i_stdarg='$i_stdarg'
21327i_stddef='$i_stddef'
21328i_stdlib='$i_stdlib'
21329i_string='$i_string'
21330i_sunmath='$i_sunmath'
21331i_sysaccess='$i_sysaccess'
21332i_sysdir='$i_sysdir'
21333i_sysfile='$i_sysfile'
21334i_sysfilio='$i_sysfilio'
21335i_sysin='$i_sysin'
21336i_sysioctl='$i_sysioctl'
21337i_syslog='$i_syslog'
21338i_sysmman='$i_sysmman'
21339i_sysmode='$i_sysmode'
21340i_sysmount='$i_sysmount'
21341i_sysndir='$i_sysndir'
21342i_sysparam='$i_sysparam'
21343i_sysresrc='$i_sysresrc'
21344i_syssecrt='$i_syssecrt'
21345i_sysselct='$i_sysselct'
21346i_syssockio='$i_syssockio'
21347i_sysstat='$i_sysstat'
21348i_sysstatfs='$i_sysstatfs'
21349i_sysstatvfs='$i_sysstatvfs'
21350i_systime='$i_systime'
21351i_systimek='$i_systimek'
21352i_systimes='$i_systimes'
21353i_systypes='$i_systypes'
21354i_sysuio='$i_sysuio'
21355i_sysun='$i_sysun'
21356i_sysutsname='$i_sysutsname'
21357i_sysvfs='$i_sysvfs'
21358i_syswait='$i_syswait'
21359i_termio='$i_termio'
21360i_termios='$i_termios'
21361i_time='$i_time'
21362i_unistd='$i_unistd'
21363i_ustat='$i_ustat'
21364i_utime='$i_utime'
21365i_values='$i_values'
21366i_varargs='$i_varargs'
21367i_varhdr='$i_varhdr'
21368i_vfork='$i_vfork'
5f80c64f 21369ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21370inc_version_list='$inc_version_list'
21371inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21372incpath='$incpath'
21373inews='$inews'
b4eb6b3d
JH
21374installarchlib='$installarchlib'
21375installbin='$installbin'
6e1038e0
MB
21376installhtml1dir='$installhtml1dir'
21377installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21378installman1dir='$installman1dir'
21379installman3dir='$installman3dir'
21380installprefix='$installprefix'
21381installprefixexp='$installprefixexp'
21382installprivlib='$installprivlib'
21383installscript='$installscript'
21384installsitearch='$installsitearch'
21385installsitebin='$installsitebin'
8d2cbf27
JH
21386installsitehtml1dir='$installsitehtml1dir'
21387installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21388installsitelib='$installsitelib'
91e123a8
JH
21389installsiteman1dir='$installsiteman1dir'
21390installsiteman3dir='$installsiteman3dir'
6e1038e0 21391installsitescript='$installsitescript'
b4eb6b3d
JH
21392installstyle='$installstyle'
21393installusrbinperl='$installusrbinperl'
21394installvendorarch='$installvendorarch'
21395installvendorbin='$installvendorbin'
8d2cbf27
JH
21396installvendorhtml1dir='$installvendorhtml1dir'
21397installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21398installvendorlib='$installvendorlib'
91e123a8
JH
21399installvendorman1dir='$installvendorman1dir'
21400installvendorman3dir='$installvendorman3dir'
6e1038e0 21401installvendorscript='$installvendorscript'
b4eb6b3d 21402intsize='$intsize'
4b661809 21403issymlink='$issymlink'
b4eb6b3d
JH
21404ivdformat='$ivdformat'
21405ivsize='$ivsize'
21406ivtype='$ivtype'
21407known_extensions='$known_extensions'
5f80c64f 21408ksh='$ksh'
5f80c64f
JH
21409ld='$ld'
21410lddlflags='$lddlflags'
21411ldflags='$ldflags'
b4eb6b3d
JH
21412ldflags_uselargefiles='$ldflags_uselargefiles'
21413ldlibpthname='$ldlibpthname'
5f80c64f
JH
21414less='$less'
21415lib_ext='$lib_ext'
21416libc='$libc'
b4eb6b3d 21417libperl='$libperl'
5f80c64f
JH
21418libpth='$libpth'
21419libs='$libs'
43999f95
JH
21420libsdirs='$libsdirs'
21421libsfiles='$libsfiles'
21422libsfound='$libsfound'
13b3f787 21423libspath='$libspath'
5f80c64f 21424libswanted='$libswanted'
b4eb6b3d 21425libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21426line='$line'
21427lint='$lint'
21428lkflags='$lkflags'
21429ln='$ln'
21430lns='$lns'
10bc17b6 21431localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21432locincpth='$locincpth'
21433loclibpth='$loclibpth'
b4eb6b3d
JH
21434longdblsize='$longdblsize'
21435longlongsize='$longlongsize'
21436longsize='$longsize'
5f80c64f
JH
21437lp='$lp'
21438lpr='$lpr'
21439ls='$ls'
b4eb6b3d
JH
21440lseeksize='$lseeksize'
21441lseektype='$lseektype'
5f80c64f
JH
21442mail='$mail'
21443mailx='$mailx'
21444make='$make'
21445make_set_make='$make_set_make'
b4eb6b3d
JH
21446mallocobj='$mallocobj'
21447mallocsrc='$mallocsrc'
21448malloctype='$malloctype'
21449man1dir='$man1dir'
21450man1direxp='$man1direxp'
21451man1ext='$man1ext'
21452man3dir='$man3dir'
21453man3direxp='$man3direxp'
21454man3ext='$man3ext'
5f80c64f 21455mips_type='$mips_type'
5129fff4 21456mistrustnm='$mistrustnm'
5f80c64f 21457mkdir='$mkdir'
b4eb6b3d
JH
21458mmaptype='$mmaptype'
21459modetype='$modetype'
5f80c64f 21460more='$more'
b4eb6b3d 21461multiarch='$multiarch'
5f80c64f 21462mv='$mv'
b4eb6b3d
JH
21463myarchname='$myarchname'
21464mydomain='$mydomain'
21465myhostname='$myhostname'
5f80c64f
JH
21466myuname='$myuname'
21467n='$n'
2cc61e15 21468need_va_copy='$need_va_copy'
b4eb6b3d
JH
21469netdb_hlen_type='$netdb_hlen_type'
21470netdb_host_type='$netdb_host_type'
21471netdb_name_type='$netdb_name_type'
21472netdb_net_type='$netdb_net_type'
5f80c64f
JH
21473nm='$nm'
21474nm_opt='$nm_opt'
21475nm_so_opt='$nm_so_opt'
b4eb6b3d 21476nonxs_ext='$nonxs_ext'
5f80c64f 21477nroff='$nroff'
b4eb6b3d
JH
21478nvEUformat='$nvEUformat'
21479nvFUformat='$nvFUformat'
21480nvGUformat='$nvGUformat'
53133ed1 21481nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21482nveformat='$nveformat'
21483nvfformat='$nvfformat'
21484nvgformat='$nvgformat'
21485nvsize='$nvsize'
21486nvtype='$nvtype'
21487o_nonblock='$o_nonblock'
5f80c64f 21488obj_ext='$obj_ext'
b4eb6b3d 21489old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21490optimize='$optimize'
b4eb6b3d 21491orderlib='$orderlib'
5f80c64f
JH
21492osname='$osname'
21493osvers='$osvers'
b4eb6b3d 21494otherlibdirs='$otherlibdirs'
5f80c64f 21495package='$package'
b4eb6b3d
JH
21496pager='$pager'
21497passcat='$passcat'
21498patchlevel='$patchlevel'
5f80c64f 21499path_sep='$path_sep'
b4eb6b3d 21500perl5='$perl5'
5f80c64f 21501perl='$perl'
151e6568 21502perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21503perladmin='$perladmin'
9c839522 21504perllibs='$perllibs'
b4eb6b3d 21505perlpath='$perlpath'
5f80c64f 21506pg='$pg'
b4eb6b3d
JH
21507phostname='$phostname'
21508pidtype='$pidtype'
5f80c64f
JH
21509plibpth='$plibpth'
21510pmake='$pmake'
21511pr='$pr'
b4eb6b3d
JH
21512prefix='$prefix'
21513prefixexp='$prefixexp'
21514privlib='$privlib'
21515privlibexp='$privlibexp'
f24dbf84 21516procselfexe='$procselfexe'
b4eb6b3d
JH
21517prototype='$prototype'
21518ptrsize='$ptrsize'
21519quadkind='$quadkind'
21520quadtype='$quadtype'
21521randbits='$randbits'
21522randfunc='$randfunc'
10bc17b6 21523random_r_proto='$random_r_proto'
b4eb6b3d
JH
21524randseedtype='$randseedtype'
21525ranlib='$ranlib'
21526rd_nodata='$rd_nodata'
10bc17b6
JH
21527readdir64_r_proto='$readdir64_r_proto'
21528readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21529revision='$revision'
5f80c64f
JH
21530rm='$rm'
21531rmail='$rmail'
5440bc8e 21532run='$run'
5f80c64f 21533runnm='$runnm'
b4eb6b3d
JH
21534sPRIEUldbl='$sPRIEUldbl'
21535sPRIFUldbl='$sPRIFUldbl'
21536sPRIGUldbl='$sPRIGUldbl'
21537sPRIXU64='$sPRIXU64'
21538sPRId64='$sPRId64'
21539sPRIeldbl='$sPRIeldbl'
21540sPRIfldbl='$sPRIfldbl'
21541sPRIgldbl='$sPRIgldbl'
21542sPRIi64='$sPRIi64'
21543sPRIo64='$sPRIo64'
21544sPRIu64='$sPRIu64'
21545sPRIx64='$sPRIx64'
21546sSCNfldbl='$sSCNfldbl'
21547sched_yield='$sched_yield'
21548scriptdir='$scriptdir'
21549scriptdirexp='$scriptdirexp'
5f80c64f 21550sed='$sed'
b4eb6b3d
JH
21551seedfunc='$seedfunc'
21552selectminbits='$selectminbits'
21553selecttype='$selecttype'
5f80c64f 21554sendmail='$sendmail'
10bc17b6
JH
21555setgrent_r_proto='$setgrent_r_proto'
21556sethostent_r_proto='$sethostent_r_proto'
21557setlocale_r_proto='$setlocale_r_proto'
21558setnetent_r_proto='$setnetent_r_proto'
21559setprotoent_r_proto='$setprotoent_r_proto'
21560setpwent_r_proto='$setpwent_r_proto'
21561setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21562sh='$sh'
21563shar='$shar'
21564sharpbang='$sharpbang'
b4eb6b3d
JH
21565shmattype='$shmattype'
21566shortsize='$shortsize'
21567shrpenv='$shrpenv'
5f80c64f 21568shsharp='$shsharp'
b4eb6b3d
JH
21569sig_count='$sig_count'
21570sig_name='$sig_name'
21571sig_name_init='$sig_name_init'
21572sig_num='$sig_num'
21573sig_num_init='$sig_num_init'
76d3c696 21574sig_size='$sig_size'
b4eb6b3d
JH
21575signal_t='$signal_t'
21576sitearch='$sitearch'
21577sitearchexp='$sitearchexp'
21578sitebin='$sitebin'
21579sitebinexp='$sitebinexp'
8d2cbf27
JH
21580sitehtml1dir='$sitehtml1dir'
21581sitehtml1direxp='$sitehtml1direxp'
21582sitehtml3dir='$sitehtml3dir'
21583sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
21584sitelib='$sitelib'
21585sitelib_stem='$sitelib_stem'
21586sitelibexp='$sitelibexp'
91e123a8
JH
21587siteman1dir='$siteman1dir'
21588siteman1direxp='$siteman1direxp'
21589siteman3dir='$siteman3dir'
21590siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
21591siteprefix='$siteprefix'
21592siteprefixexp='$siteprefixexp'
6e1038e0
MB
21593sitescript='$sitescript'
21594sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21595sizesize='$sizesize'
21596sizetype='$sizetype'
5f80c64f
JH
21597sleep='$sleep'
21598smail='$smail'
5f80c64f 21599so='$so'
b4eb6b3d
JH
21600sockethdr='$sockethdr'
21601socketlib='$socketlib'
21602socksizetype='$socksizetype'
5f80c64f
JH
21603sort='$sort'
21604spackage='$spackage'
21605spitshell='$spitshell'
10bc17b6
JH
21606srand48_r_proto='$srand48_r_proto'
21607srandom_r_proto='$srandom_r_proto'
5f80c64f 21608src='$src'
b4eb6b3d
JH
21609ssizetype='$ssizetype'
21610startperl='$startperl'
5f80c64f 21611startsh='$startsh'
b4eb6b3d
JH
21612static_ext='$static_ext'
21613stdchar='$stdchar'
21614stdio_base='$stdio_base'
21615stdio_bufsiz='$stdio_bufsiz'
21616stdio_cnt='$stdio_cnt'
21617stdio_filbuf='$stdio_filbuf'
21618stdio_ptr='$stdio_ptr'
21619stdio_stream_array='$stdio_stream_array'
10bc17b6 21620strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21621strings='$strings'
5f80c64f 21622submit='$submit'
b4eb6b3d
JH
21623subversion='$subversion'
21624sysman='$sysman'
5f80c64f
JH
21625tail='$tail'
21626tar='$tar'
5440bc8e 21627targetarch='$targetarch'
5f80c64f
JH
21628tbl='$tbl'
21629tee='$tee'
21630test='$test'
b4eb6b3d
JH
21631timeincl='$timeincl'
21632timetype='$timetype'
10bc17b6 21633tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21634to='$to'
5f80c64f
JH
21635touch='$touch'
21636tr='$tr'
21637trnl='$trnl'
21638troff='$troff'
10bc17b6 21639ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21640u16size='$u16size'
21641u16type='$u16type'
21642u32size='$u32size'
21643u32type='$u32type'
21644u64size='$u64size'
21645u64type='$u64type'
21646u8size='$u8size'
21647u8type='$u8type'
21648uidformat='$uidformat'
21649uidsign='$uidsign'
21650uidsize='$uidsize'
21651uidtype='$uidtype'
5f80c64f
JH
21652uname='$uname'
21653uniq='$uniq'
b4eb6b3d
JH
21654uquadtype='$uquadtype'
21655use5005threads='$use5005threads'
21656use64bitall='$use64bitall'
21657use64bitint='$use64bitint'
5440bc8e 21658usecrosscompile='$usecrosscompile'
5f80c64f 21659usedl='$usedl'
15b61c98 21660usefaststdio='$usefaststdio'
b4eb6b3d
JH
21661useithreads='$useithreads'
21662uselargefiles='$uselargefiles'
21663uselongdouble='$uselongdouble'
19a100ff 21664usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
21665usemorebits='$usemorebits'
21666usemultiplicity='$usemultiplicity'
21667usemymalloc='$usemymalloc'
5f80c64f 21668usenm='$usenm'
b4eb6b3d
JH
21669useopcode='$useopcode'
21670useperlio='$useperlio'
21671useposix='$useposix'
9514c62b 21672usereentrant='$usereentrant'
d51aaa9d 21673userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
21674usesfio='$usesfio'
21675useshrplib='$useshrplib'
5f106f9c 21676usesitecustomize='$usesitecustomize'
29209bc5 21677usesocks='$usesocks'
b4eb6b3d
JH
21678usethreads='$usethreads'
21679usevendorprefix='$usevendorprefix'
21680usevfork='$usevfork'
5f80c64f
JH
21681usrinc='$usrinc'
21682uuname='$uuname'
b4eb6b3d
JH
21683uvXUformat='$uvXUformat'
21684uvoformat='$uvoformat'
21685uvsize='$uvsize'
21686uvtype='$uvtype'
21687uvuformat='$uvuformat'
21688uvxformat='$uvxformat'
21689vendorarch='$vendorarch'
21690vendorarchexp='$vendorarchexp'
21691vendorbin='$vendorbin'
21692vendorbinexp='$vendorbinexp'
8d2cbf27
JH
21693vendorhtml1dir='$vendorhtml1dir'
21694vendorhtml1direxp='$vendorhtml1direxp'
21695vendorhtml3dir='$vendorhtml3dir'
21696vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
21697vendorlib='$vendorlib'
21698vendorlib_stem='$vendorlib_stem'
21699vendorlibexp='$vendorlibexp'
91e123a8
JH
21700vendorman1dir='$vendorman1dir'
21701vendorman1direxp='$vendorman1direxp'
21702vendorman3dir='$vendorman3dir'
21703vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
21704vendorprefix='$vendorprefix'
21705vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21706vendorscript='$vendorscript'
21707vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21708version='$version'
861eb78d 21709version_patchlevel_string='$version_patchlevel_string'
d56c5707 21710versiononly='$versiononly'
5f80c64f 21711vi='$vi'
b4eb6b3d 21712voidflags='$voidflags'
5f80c64f 21713xlibpth='$xlibpth'
3659ebf1
JH
21714yacc='$yacc'
21715yaccflags='$yaccflags'
5f80c64f
JH
21716zcat='$zcat'
21717zip='$zip'
21718EOT
21719
21720: Add in command line options if available
21721$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21722
21723: add special variables
21724$test -f $src/patchlevel.h && \
d00b958f 21725awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21726echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21727echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
21728
21729: propagate old symbols
21730if $test -f UU/config.sh; then
381aa1ff 21731 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 21732 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 21733 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
21734 set X `cat UU/oldsyms`
21735 shift
21736 case $# in
21737 0) ;;
21738 *)
21739 cat <<EOM
21740Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21741EOM
21742 echo "# Variables propagated from previous config.sh file." >>config.sh
21743 for sym in `cat UU/oldsyms`; do
21744 echo " Propagating $hint variable "'$'"$sym..."
21745 eval 'tmp="$'"${sym}"'"'
21746 echo "$tmp" | \
21747 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21748 done
21749 ;;
21750 esac
21751fi
21752
21753: Finish up by extracting the .SH files
21754case "$alldone" in
21755exit)
21756 $rm -rf UU
24ccb310 21757 echo "Extraction done."
5f80c64f
JH
21758 exit 0
21759 ;;
21760cont)
21761 ;;
21762'')
21763 dflt=''
21764 nostick=true
21765 $cat <<EOM
21766
21767If you'd like to make any changes to the config.sh file before I begin
21768to configure things, do it as a shell escape now (e.g. !vi config.sh).
21769
21770EOM
21771 rp="Press return or use a shell escape to edit config.sh:"
21772 . UU/myread
21773 nostick=''
21774 case "$ans" in
21775 '') ;;
21776 *) : in case they cannot read
21777 sh 1>&4 -c "$ans";;
21778 esac
21779 ;;
21780esac
21781
21782: if this fails, just run all the .SH files by hand
21783. ./config.sh
21784
21785echo " "
21786exec 1>&4
a43e8593 21787pwd=`pwd`
5f80c64f 21788. ./UU/extract
6904989c 21789cd "$pwd"
5f80c64f
JH
21790
21791if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21792 dflt=y
21793 case "$silent" in
21794 true) ;;
21795 *)
21796 $cat <<EOM
21797
21798Now you need to generate make dependencies by running "$make depend".
21799You might prefer to run it in background: "$make depend > makedepend.out &"
21800It can take a while, so you might not want to run it right now.
21801
21802EOM
21803 ;;
21804 esac
21805 rp="Run $make depend now?"
21806 . UU/myread
21807 case "$ans" in
21808 y*)
3d5d58b1 21809 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
21810 ;;
21811 *)
21812 echo "You must run '$make depend' then '$make'."
21813 ;;
21814 esac
21815elif test -f [Mm]akefile; then
21816 echo " "
21817 echo "Now you must run a $make."
21818else
24ccb310 21819 echo "Configure done."
5f80c64f
JH
21820fi
21821
21822if $test -f Policy.sh; then
21823 $cat <<EOM
21824
21825If you compile $package on a different machine or from a different object
21826directory, copy the Policy.sh file from this object directory to the
21827new one before you run Configure -- this will help you with most of
21828the policy defaults.
21829
21830EOM
21831fi
21832if $test -f config.msg; then
21833 echo "Hmm. I also noted the following information while running:"
21834 echo " "
21835 $cat config.msg >&4
21836 $rm -f config.msg
21837fi
21838$rm -f kit*isdone ark*isdone
21839$rm -rf UU
21840
21841: End of Configure
21842