xref: /openbsd-src/gnu/usr.bin/perl/Configure (revision 91f110e064cd7c194e59e019b83bb7496c1c84d4)
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 package (which contains metaconfig) is available via SVN:
17#     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18#
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
22# For more information on patching Configure, see pod/perlhack.pod
23#
24# The metaunits are also available from the public git repository:
25#     http://perl5.git.perl.org/metaconfig.git/ or
26#     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27#
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
30
31# Generated on Sun Apr  1 12:00:35 CEST 2012 [metaconfig 3.5 PL0]
32# (with additional metaconfig patches by perlbug@perl.org)
33
34cat >c1$$ <<EOF
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false.  Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
45cat >c2$$ <<EOF
46
47OOPS!  You naughty creature!  You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
51true || cat c1$$ c2$$
52true || exec sh $0 $argv:q
53
54(exit $?0) || cat c2$$
55(exit $?0) || exec sh $0 $argv:q
56rm -f c1$$ c2$$
57
58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59	cat <<EOF
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67	exit 1
68fi
69
70if test ! -c /dev/null ; then
71	cat <<EOF
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79	exit 1
80fi
81
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87	test "$me" || me=$0
88	;;
89esac
90
91: Proper separator for the PATH environment variable
92p_=:
93: On OS/2 this directory should exist if this is not floppy only system ":-]"
94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95	if test -n "$OS2_SHELL"; then
96		p_=\;
97		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99		is_os2=yes
100	elif test -n "$DJGPP"; then
101		case "X${MACHTYPE:-nonesuchmach}" in
102		*cygwin) ;;
103		*) p_=\; ;;
104		esac
105	fi
106fi
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
117paths="$paths /system/gnu_library/bin"
118
119for p in $paths
120do
121	case "$p_$PATH$p_" in
122	*$p_$p$p_*) ;;
123	*) test -d $p && PATH=$PATH$p_$p ;;
124	esac
125done
126
127PATH=.$p_$PATH
128export PATH
129
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
136if (PATH=.; alias -x) >/dev/null 2>&1; then
137		inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140	needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143	if test X`/usr/bin/uname -v` = X4; then
144		avoidksh="to avoid AIX 4's /bin/sh"
145		newsh=/usr/bin/bsh
146	fi
147fi
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149	if test X`/usr/bin/uname -s` = XOSF1; then
150		avoidksh="to avoid Digital UNIX' ksh"
151		newsh=/bin/sh
152		unset BIN_SH
153	fi
154fi
155case "$inksh/$needksh" in
156/[a-z]*)
157		ENV=''
158		changesh=true
159		reason="$needksh"
160	;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164	changesh=true
165	reason="$avoidksh"
166	;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
170		cat <<EOM
171(I see you are using the Korn shell.  Some ksh's blow up on $me,
172mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173EOM
174	;;
175esac
176case "$changesh" in
177true)
178	export newsh
179	echo "(Feeding myself to $newsh $reason.)"
180	case "$0" in
181	Configure|*/Configure) exec $newsh $0 "$@";;
182	*) exec $newsh Configure "$@";;
183	esac
184	;;
185esac
186test -x "${newsh}" || unset newsh
187
188: if needed, set CDPATH to a harmless value that is not chatty
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'')	;;
192*)	case "$SHELL" in
193	*bash*) CDPATH='.' ;;
194	*) CDPATH='' ;;
195	esac
196	;;
197esac
198
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
201cd UU && rm -f ./*
202
203ccname=''
204ccversion=''
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
208from=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
213extern_C=''
214mistrustnm=''
215usedevel=''
216perllibs=''
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
224extras=''
225d_bsd=''
226d_eunice=''
227d_xenix=''
228eunicefix=''
229ar=''
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
238comm=''
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
251gmake=''
252grep=''
253gzip=''
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
265make=''
266mkdir=''
267more=''
268mv=''
269nm=''
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
287tee=''
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
297zip=''
298full_ar=''
299full_sed=''
300libswanted=''
301hint=''
302myuname=''
303osname=''
304osvers=''
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
315_a=''
316_exe=''
317_o=''
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
324rm_try=''
325afs=''
326afsroot=''
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
335d_atolf=''
336d_atoll=''
337baserev=''
338bin=''
339binexp=''
340initialinstalllocation=''
341installbin=''
342userelocatableinc=''
343byteorder=''
344cc=''
345ccflags=''
346cppflags=''
347ldflags=''
348lkflags=''
349locincpth=''
350optimize=''
351cf_email=''
352cf_by=''
353cf_time=''
354charbits=''
355charsize=''
356contains=''
357cpp_stuff=''
358cpplast=''
359cppminus=''
360cpprun=''
361cppstdin=''
362d__fwalk=''
363d_access=''
364d_accessx=''
365d_aintl=''
366d_alarm=''
367asctime_r_proto=''
368d_asctime_r=''
369d_attribute_deprecated=''
370d_attribute_format=''
371d_attribute_malloc=''
372d_attribute_nonnull=''
373d_attribute_noreturn=''
374d_attribute_pure=''
375d_attribute_unused=''
376d_attribute_warn_unused_result=''
377d_printf_format_null=''
378d_bcmp=''
379d_bcopy=''
380d_builtin_choose_expr=''
381d_builtin_expect=''
382d_bzero=''
383d_c99_variadic_macros=''
384d_casti32=''
385castflags=''
386d_castneg=''
387d_chown=''
388d_chroot=''
389d_chsize=''
390d_class=''
391d_clearenv=''
392d_closedir=''
393d_void_closedir=''
394d_cmsghdr_s=''
395d_const=''
396d_copysignl=''
397d_cplusplus=''
398cryptlib=''
399d_crypt=''
400crypt_r_proto=''
401d_crypt_r=''
402d_csh=''
403full_csh=''
404d_ctermid=''
405ctermid_r_proto=''
406d_ctermid_r=''
407ctime_r_proto=''
408d_ctime_r=''
409d_cuserid=''
410d_dbl_dig=''
411d_dbminitproto=''
412d_difftime=''
413d_dir_dd_fd=''
414d_dirfd=''
415d_dlerror=''
416d_dlopen=''
417d_dlsymun=''
418d_dosuid=''
419d_suidsafe=''
420d_drand48_r=''
421drand48_r_proto=''
422d_drand48proto=''
423d_dup2=''
424d_eaccess=''
425d_endgrent=''
426d_endgrent_r=''
427endgrent_r_proto=''
428d_endhent=''
429d_endhostent_r=''
430endhostent_r_proto=''
431d_endnent=''
432d_endnetent_r=''
433endnetent_r_proto=''
434d_endpent=''
435d_endprotoent_r=''
436endprotoent_r_proto=''
437d_endpwent=''
438d_endpwent_r=''
439endpwent_r_proto=''
440d_endsent=''
441d_endservent_r=''
442endservent_r_proto=''
443d_faststdio=''
444d_fchdir=''
445d_fchmod=''
446d_fchown=''
447d_fcntl=''
448d_fcntl_can_lock=''
449d_fd_macros=''
450d_fd_set=''
451d_fds_bits=''
452d_fgetpos=''
453d_finite=''
454d_finitel=''
455d_flexfnam=''
456d_flock=''
457d_flockproto=''
458d_fork=''
459d_fp_class=''
460d_fpclass=''
461d_fpclassify=''
462d_fpclassl=''
463d_fpos64_t=''
464d_frexpl=''
465d_fs_data_s=''
466d_fseeko=''
467d_fsetpos=''
468d_fstatfs=''
469d_fsync=''
470d_ftello=''
471d_ftime=''
472d_gettimeod=''
473d_futimes=''
474d_Gconvert=''
475d_getaddrinfo=''
476d_getcwd=''
477d_getespwnam=''
478d_getfsstat=''
479d_getgrent=''
480d_getgrent_r=''
481getgrent_r_proto=''
482d_getgrgid_r=''
483getgrgid_r_proto=''
484d_getgrnam_r=''
485getgrnam_r_proto=''
486d_getgrps=''
487d_gethbyaddr=''
488d_gethbyname=''
489d_gethent=''
490aphostname=''
491d_gethname=''
492d_phostname=''
493d_uname=''
494d_gethostbyaddr_r=''
495gethostbyaddr_r_proto=''
496d_gethostbyname_r=''
497gethostbyname_r_proto=''
498d_gethostent_r=''
499gethostent_r_proto=''
500d_gethostprotos=''
501d_getitimer=''
502d_getlogin=''
503d_getlogin_r=''
504getlogin_r_proto=''
505d_getmnt=''
506d_getmntent=''
507d_getnameinfo=''
508d_getnbyaddr=''
509d_getnbyname=''
510d_getnent=''
511d_getnetbyaddr_r=''
512getnetbyaddr_r_proto=''
513d_getnetbyname_r=''
514getnetbyname_r_proto=''
515d_getnetent_r=''
516getnetent_r_proto=''
517d_getnetprotos=''
518d_getpagsz=''
519d_getpent=''
520d_getpgid=''
521d_getpgrp2=''
522d_bsdgetpgrp=''
523d_getpgrp=''
524d_getppid=''
525d_getprior=''
526d_getpbyname=''
527d_getpbynumber=''
528d_getprotobyname_r=''
529getprotobyname_r_proto=''
530d_getprotobynumber_r=''
531getprotobynumber_r_proto=''
532d_getprotoent_r=''
533getprotoent_r_proto=''
534d_getprotoprotos=''
535d_getprpwnam=''
536d_getpwent=''
537d_getpwent_r=''
538getpwent_r_proto=''
539d_getpwnam_r=''
540getpwnam_r_proto=''
541d_getpwuid_r=''
542getpwuid_r_proto=''
543d_getsent=''
544d_getservbyname_r=''
545getservbyname_r_proto=''
546d_getservbyport_r=''
547getservbyport_r_proto=''
548d_getservent_r=''
549getservent_r_proto=''
550d_getservprotos=''
551d_getspnam=''
552d_getspnam_r=''
553getspnam_r_proto=''
554d_getsbyname=''
555d_getsbyport=''
556d_gmtime_r=''
557gmtime_r_proto=''
558d_gnulibc=''
559gnulibc_version=''
560d_hasmntopt=''
561d_htonl=''
562d_ilogbl=''
563d_inetaton=''
564d_inetntop=''
565d_inetpton=''
566d_int64_t=''
567d_isascii=''
568d_isblank=''
569d_isfinite=''
570d_isinf=''
571d_isnan=''
572d_isnanl=''
573d_killpg=''
574d_lchown=''
575d_ldbl_dig=''
576d_libm_lib_version=''
577d_link=''
578d_localtime_r=''
579d_localtime_r_needs_tzset=''
580localtime_r_proto=''
581d_locconv=''
582d_lockf=''
583d_longdbl=''
584longdblsize=''
585d_longlong=''
586longlongsize=''
587d_lseekproto=''
588d_lstat=''
589d_madvise=''
590d_malloc_good_size=''
591d_malloc_size=''
592d_mblen=''
593d_mbstowcs=''
594d_mbtowc=''
595d_memchr=''
596d_memcmp=''
597d_memcpy=''
598d_memmove=''
599d_memset=''
600d_mkdir=''
601d_mkdtemp=''
602d_mkfifo=''
603d_mkstemp=''
604d_mkstemps=''
605d_mktime=''
606d_mmap=''
607mmaptype=''
608d_modfl=''
609d_modfl_pow32_bug=''
610d_modflproto=''
611d_mprotect=''
612d_msg=''
613d_msgctl=''
614d_msgget=''
615d_msghdr_s=''
616d_msgrcv=''
617d_msgsnd=''
618d_msync=''
619d_munmap=''
620d_nice=''
621d_nl_langinfo=''
622d_off64_t=''
623d_open3=''
624d_fpathconf=''
625d_pathconf=''
626d_pause=''
627d_pipe=''
628d_poll=''
629d_portable=''
630d_prctl=''
631d_prctl_set_name=''
632d_procselfexe=''
633procselfexe=''
634d_old_pthread_create_joinable=''
635old_pthread_create_joinable=''
636d_pthread_atfork=''
637d_pthread_attr_setscope=''
638d_pthread_yield=''
639d_sched_yield=''
640sched_yield=''
641d_qgcvt=''
642d_random_r=''
643random_r_proto=''
644d_readdir64_r=''
645readdir64_r_proto=''
646d_readdir=''
647d_rewinddir=''
648d_seekdir=''
649d_telldir=''
650d_readdir_r=''
651readdir_r_proto=''
652d_readlink=''
653d_readv=''
654d_recvmsg=''
655d_rename=''
656d_rmdir=''
657d_safebcpy=''
658d_safemcpy=''
659d_sanemcmp=''
660d_sbrkproto=''
661d_scalbnl=''
662d_select=''
663d_sem=''
664d_semctl=''
665d_semget=''
666d_semop=''
667d_sendmsg=''
668d_setegid=''
669d_seteuid=''
670d_setgrent=''
671d_setgrent_r=''
672setgrent_r_proto=''
673d_setgrps=''
674d_sethent=''
675d_sethostent_r=''
676sethostent_r_proto=''
677d_setitimer=''
678d_setlinebuf=''
679d_setlocale=''
680d_setlocale_r=''
681setlocale_r_proto=''
682d_setnent=''
683d_setnetent_r=''
684setnetent_r_proto=''
685d_setpent=''
686d_setpgid=''
687d_setpgrp2=''
688d_bsdsetpgrp=''
689d_setpgrp=''
690d_setprior=''
691d_setproctitle=''
692d_setprotoent_r=''
693setprotoent_r_proto=''
694d_setpwent=''
695d_setpwent_r=''
696setpwent_r_proto=''
697d_setregid=''
698d_setresgid=''
699d_setresuid=''
700d_setreuid=''
701d_setrgid=''
702d_setruid=''
703d_setsent=''
704d_setservent_r=''
705setservent_r_proto=''
706d_setsid=''
707d_setvbuf=''
708d_sfio=''
709usesfio=''
710d_shm=''
711d_shmat=''
712d_shmatprototype=''
713shmattype=''
714d_shmctl=''
715d_shmdt=''
716d_shmget=''
717d_sigaction=''
718d_signbit=''
719d_sigprocmask=''
720d_sigsetjmp=''
721usesitecustomize=''
722d_snprintf=''
723d_vsnprintf=''
724d_sockatmark=''
725d_sockatmarkproto=''
726d_ipv6_mreq=''
727d_msg_ctrunc=''
728d_msg_dontroute=''
729d_msg_oob=''
730d_msg_peek=''
731d_msg_proxy=''
732d_oldsock=''
733d_scm_rights=''
734d_sin6_scope_id=''
735d_sockaddr_in6=''
736d_sockaddr_sa_len=''
737d_socket=''
738d_sockpair=''
739sockethdr=''
740socketlib=''
741d_socklen_t=''
742d_socks5_init=''
743d_sprintf_returns_strlen=''
744d_sqrtl=''
745d_srand48_r=''
746srand48_r_proto=''
747d_srandom_r=''
748srandom_r_proto=''
749d_sresgproto=''
750d_sresuproto=''
751d_statblks=''
752d_statfs_f_flags=''
753d_statfs_s=''
754d_static_inline=''
755perl_static_inline=''
756d_fstatvfs=''
757d_statvfs=''
758d_stdio_cnt_lval=''
759d_stdio_ptr_lval=''
760d_stdio_ptr_lval_nochange_cnt=''
761d_stdio_ptr_lval_sets_cnt=''
762d_stdiobase=''
763d_stdstdio=''
764stdio_base=''
765stdio_bufsiz=''
766stdio_cnt=''
767stdio_filbuf=''
768stdio_ptr=''
769d_index=''
770d_strchr=''
771d_strcoll=''
772d_strctcpy=''
773d_strerrm=''
774d_strerror=''
775d_sysernlst=''
776d_syserrlst=''
777d_strerror_r=''
778strerror_r_proto=''
779d_strftime=''
780d_strlcat=''
781d_strlcpy=''
782d_strtod=''
783d_strtol=''
784d_strtold=''
785d_strtoll=''
786d_strtoq=''
787d_strtoul=''
788d_strtoull=''
789d_strtouq=''
790d_strxfrm=''
791d_symlink=''
792d_syscall=''
793d_syscallproto=''
794d_sysconf=''
795d_system=''
796d_tcgetpgrp=''
797d_tcsetpgrp=''
798d_telldirproto=''
799d_time=''
800timetype=''
801d_asctime64=''
802d_ctime64=''
803d_difftime64=''
804d_gmtime64=''
805d_localtime64=''
806d_mktime64=''
807d_timegm=''
808clocktype=''
809d_times=''
810d_tmpnam_r=''
811tmpnam_r_proto=''
812d_truncate=''
813d_ttyname_r=''
814ttyname_r_proto=''
815d_tzname=''
816d_u32align=''
817d_ualarm=''
818d_umask=''
819d_semctl_semid_ds=''
820d_semctl_semun=''
821d_union_semun=''
822d_unordered=''
823d_unsetenv=''
824d_usleep=''
825d_usleepproto=''
826d_ustat=''
827d_pseudofork=''
828d_vfork=''
829usevfork=''
830d_voidsig=''
831signal_t=''
832d_volatile=''
833d_charvspr=''
834d_vprintf=''
835d_wait4=''
836d_waitpid=''
837d_wcstombs=''
838d_wctomb=''
839d_writev=''
840dlext=''
841bin_ELF=''
842cccdlflags=''
843ccdlflags=''
844dlsrc=''
845ld=''
846ld_can_script=''
847lddlflags=''
848usedl=''
849doublesize=''
850ebcdic=''
851fflushNULL=''
852fflushall=''
853fpossize=''
854fpostype=''
855gccansipedantic=''
856gccosandvers=''
857gccversion=''
858gidformat=''
859gidsign=''
860gidsize=''
861gidtype=''
862groupstype=''
863h_fcntl=''
864h_sysfile=''
865html1dir=''
866html1direxp=''
867installhtml1dir=''
868html3dir=''
869html3direxp=''
870installhtml3dir=''
871i_arpainet=''
872i_assert=''
873i_crypt=''
874db_hashtype=''
875db_prefixtype=''
876db_version_major=''
877db_version_minor=''
878db_version_patch=''
879i_db=''
880i_dbm=''
881i_rpcsvcdbm=''
882d_dirnamlen=''
883direntrytype=''
884i_dirent=''
885i_dld=''
886i_dlfcn=''
887i_fcntl=''
888i_float=''
889i_fp=''
890i_fp_class=''
891i_gdbm=''
892d_grpasswd=''
893i_grp=''
894i_ieeefp=''
895i_inttypes=''
896i_langinfo=''
897i_libutil=''
898i_limits=''
899i_locale=''
900i_machcthr=''
901i_malloc=''
902i_mallocmalloc=''
903i_math=''
904i_memory=''
905i_mntent=''
906d_gdbm_ndbm_h_uses_prototypes=''
907d_gdbmndbm_h_uses_prototypes=''
908d_ndbm=''
909d_ndbm_h_uses_prototypes=''
910i_gdbm_ndbm=''
911i_gdbmndbm=''
912i_ndbm=''
913i_netdb=''
914i_neterrno=''
915i_netinettcp=''
916i_niin=''
917i_sysin=''
918i_poll=''
919i_prot=''
920i_pthread=''
921d_pwage=''
922d_pwchange=''
923d_pwclass=''
924d_pwcomment=''
925d_pwexpire=''
926d_pwgecos=''
927d_pwpasswd=''
928d_pwquota=''
929i_pwd=''
930i_sfio=''
931i_shadow=''
932i_socks=''
933i_stdbool=''
934i_stddef=''
935i_stdlib=''
936i_string=''
937strings=''
938i_sunmath=''
939i_sysaccess=''
940i_sysdir=''
941i_sysfile=''
942d_voidtty=''
943i_bsdioctl=''
944i_sysfilio=''
945i_sysioctl=''
946i_syssockio=''
947i_syslog=''
948i_sysmman=''
949i_sysmode=''
950i_sysmount=''
951i_sysndir=''
952i_sysparam=''
953i_syspoll=''
954i_sysresrc=''
955i_syssecrt=''
956i_sysselct=''
957i_sysstat=''
958i_sysstatfs=''
959i_sysstatvfs=''
960i_systimes=''
961i_systypes=''
962i_sysuio=''
963i_sysun=''
964i_sysutsname=''
965i_sysvfs=''
966i_syswait=''
967i_sgtty=''
968i_termio=''
969i_termios=''
970d_tm_tm_gmtoff=''
971d_tm_tm_zone=''
972i_systime=''
973i_systimek=''
974i_time=''
975timeincl=''
976i_unistd=''
977i_ustat=''
978i_utime=''
979i_values=''
980i_stdarg=''
981i_varargs=''
982i_varhdr=''
983i_vfork=''
984d_inc_version_list=''
985inc_version_list=''
986inc_version_list_init=''
987installprefix=''
988installprefixexp=''
989installstyle=''
990installusrbinperl=''
991intsize=''
992longsize=''
993shortsize=''
994issymlink=''
995libc=''
996ldlibpthname=''
997libperl=''
998shrpenv=''
999useshrplib=''
1000glibpth=''
1001libpth=''
1002loclibpth=''
1003plibpth=''
1004xlibpth=''
1005ignore_versioned_solibs=''
1006libs=''
1007libsdirs=''
1008libsfiles=''
1009libsfound=''
1010libspath=''
1011lns=''
1012d_PRIEUldbl=''
1013d_PRIFUldbl=''
1014d_PRIGUldbl=''
1015d_PRIeldbl=''
1016d_PRIfldbl=''
1017d_PRIgldbl=''
1018d_SCNfldbl=''
1019sPRIEUldbl=''
1020sPRIFUldbl=''
1021sPRIGUldbl=''
1022sPRIeldbl=''
1023sPRIfldbl=''
1024sPRIgldbl=''
1025sSCNfldbl=''
1026lseeksize=''
1027lseektype=''
1028mad=''
1029madlyh=''
1030madlyobj=''
1031madlysrc=''
1032make_set_make=''
1033d_mymalloc=''
1034freetype=''
1035mallocobj=''
1036mallocsrc=''
1037malloctype=''
1038usemallocwrap=''
1039usemymalloc=''
1040installman1dir=''
1041man1dir=''
1042man1direxp=''
1043man1ext=''
1044installman3dir=''
1045man3dir=''
1046man3direxp=''
1047man3ext=''
1048modetype=''
1049multiarch=''
1050mydomain=''
1051myhostname=''
1052phostname=''
1053c=''
1054n=''
1055d_eofnblk=''
1056eagain=''
1057o_nonblock=''
1058rd_nodata=''
1059need_va_copy=''
1060netdb_hlen_type=''
1061netdb_host_type=''
1062netdb_name_type=''
1063netdb_net_type=''
1064groupcat=''
1065hostcat=''
1066passcat=''
1067orderlib=''
1068ranlib=''
1069d_perl_otherlibdirs=''
1070otherlibdirs=''
1071package=''
1072spackage=''
1073pager=''
1074api_revision=''
1075api_subversion=''
1076api_version=''
1077api_versionstring=''
1078patchlevel=''
1079perl_patchlevel=''
1080revision=''
1081subversion=''
1082version=''
1083version_patchlevel_string=''
1084perl5=''
1085perladmin=''
1086perlpath=''
1087d_nv_preserves_uv=''
1088d_nv_zero_is_allbits_zero=''
1089i16size=''
1090i16type=''
1091i32size=''
1092i32type=''
1093i64size=''
1094i64type=''
1095i8size=''
1096i8type=''
1097ivsize=''
1098ivtype=''
1099nv_overflows_integers_at=''
1100nv_preserves_uv_bits=''
1101nvsize=''
1102nvtype=''
1103u16size=''
1104u16type=''
1105u32size=''
1106u32type=''
1107u64size=''
1108u64type=''
1109u8size=''
1110u8type=''
1111uvsize=''
1112uvtype=''
1113ivdformat=''
1114nvEUformat=''
1115nvFUformat=''
1116nvGUformat=''
1117nveformat=''
1118nvfformat=''
1119nvgformat=''
1120uvXUformat=''
1121uvoformat=''
1122uvuformat=''
1123uvxformat=''
1124pidtype=''
1125prefix=''
1126prefixexp=''
1127installprivlib=''
1128privlib=''
1129privlibexp=''
1130prototype=''
1131ptrsize=''
1132d_PRIXU64=''
1133d_PRId64=''
1134d_PRIi64=''
1135d_PRIo64=''
1136d_PRIu64=''
1137d_PRIx64=''
1138sPRIXU64=''
1139sPRId64=''
1140sPRIi64=''
1141sPRIo64=''
1142sPRIu64=''
1143sPRIx64=''
1144d_quad=''
1145quadkind=''
1146quadtype=''
1147uquadtype=''
1148drand01=''
1149randbits=''
1150randfunc=''
1151randseedtype=''
1152seedfunc=''
1153installscript=''
1154scriptdir=''
1155scriptdirexp=''
1156selectminbits=''
1157selecttype=''
1158sh=''
1159sig_count=''
1160sig_name=''
1161sig_name_init=''
1162sig_num=''
1163sig_num_init=''
1164sig_size=''
1165d_sitearch=''
1166installsitearch=''
1167sitearch=''
1168sitearchexp=''
1169installsitebin=''
1170sitebin=''
1171sitebinexp=''
1172installsitehtml1dir=''
1173sitehtml1dir=''
1174sitehtml1direxp=''
1175installsitehtml3dir=''
1176sitehtml3dir=''
1177sitehtml3direxp=''
1178installsitelib=''
1179sitelib=''
1180sitelib_stem=''
1181sitelibexp=''
1182installsiteman1dir=''
1183siteman1dir=''
1184siteman1direxp=''
1185installsiteman3dir=''
1186siteman3dir=''
1187siteman3direxp=''
1188siteprefix=''
1189siteprefixexp=''
1190installsitescript=''
1191sitescript=''
1192sitescriptexp=''
1193sizesize=''
1194sizetype=''
1195so=''
1196socksizetype=''
1197sharpbang=''
1198shsharp=''
1199spitshell=''
1200src=''
1201ssizetype=''
1202st_ino_sign=''
1203st_ino_size=''
1204startperl=''
1205startsh=''
1206stdchar=''
1207d_stdio_stream_array=''
1208stdio_stream_array=''
1209sysman=''
1210sGMTIME_max=''
1211sGMTIME_min=''
1212sLOCALTIME_max=''
1213sLOCALTIME_min=''
1214trnl=''
1215uidformat=''
1216uidsign=''
1217uidsize=''
1218uidtype=''
1219archname64=''
1220use64bitall=''
1221use64bitint=''
1222dtrace=''
1223usedtrace=''
1224usefaststdio=''
1225usekernprocpathname=''
1226ccflags_uselargefiles=''
1227ldflags_uselargefiles=''
1228libswanted_uselargefiles=''
1229uselargefiles=''
1230uselongdouble=''
1231usemorebits=''
1232usemultiplicity=''
1233nm_opt=''
1234nm_so_opt=''
1235runnm=''
1236usenm=''
1237usensgetexecutablepath=''
1238useperlio=''
1239usesocks=''
1240d_oldpthreads=''
1241use5005threads=''
1242useithreads=''
1243usereentrant=''
1244usethreads=''
1245incpath=''
1246mips_type=''
1247usrinc=''
1248vaproto=''
1249d_vendorarch=''
1250installvendorarch=''
1251vendorarch=''
1252vendorarchexp=''
1253d_vendorbin=''
1254installvendorbin=''
1255vendorbin=''
1256vendorbinexp=''
1257installvendorhtml1dir=''
1258vendorhtml1dir=''
1259vendorhtml1direxp=''
1260installvendorhtml3dir=''
1261vendorhtml3dir=''
1262vendorhtml3direxp=''
1263d_vendorlib=''
1264installvendorlib=''
1265vendorlib=''
1266vendorlib_stem=''
1267vendorlibexp=''
1268installvendorman1dir=''
1269vendorman1dir=''
1270vendorman1direxp=''
1271installvendorman3dir=''
1272vendorman3dir=''
1273vendorman3direxp=''
1274usevendorprefix=''
1275vendorprefix=''
1276vendorprefixexp=''
1277d_vendorscript=''
1278installvendorscript=''
1279vendorscript=''
1280vendorscriptexp=''
1281versiononly=''
1282defvoidused=''
1283voidflags=''
1284yacc=''
1285yaccflags=''
1286CONFIG=''
1287
1288: Detect odd OSs
1289define='define'
1290undef='undef'
1291smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1292rmlist=''
1293
1294: We must find out about Eunice early
1295eunicefix=':'
1296if test -f /etc/unixtovms; then
1297	eunicefix=/etc/unixtovms
1298fi
1299if test -f /etc/unixtovms.exe; then
1300	eunicefix=/etc/unixtovms.exe
1301fi
1302
1303: Set executable suffix now -- needed before hints available
1304if test -f "/libs/version.library"; then
1305: Amiga OS
1306    _exe=""
1307elif test -f "/system/gnu_library/bin/ar.pm"; then
1308: Stratus VOS
1309    _exe=".pm"
1310elif test -n "$DJGPP"; then
1311: DOS DJGPP
1312    _exe=".exe"
1313elif test -d c:/. -o -n "$is_os2" ; then
1314: OS/2 or cygwin
1315    _exe=".exe"
1316fi
1317
1318groupstype=''
1319i_whoami=''
1320: Trailing extension.  Override this in a hint file, if needed.
1321: Extra object files, if any, needed on this platform.
1322archobjs=''
1323archname=''
1324: Possible local include directories to search.
1325: Set locincpth to "" in a hint file to defeat local include searches.
1326locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1327locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1328:
1329: no include file wanted by default
1330inclwanted=''
1331
1332: Enable -DEBUGGING and -DDEBUGGING from the command line
1333EBUGGING=''
1334DEBUGGING=''
1335
1336libnames=''
1337: change the next line if compiling for Xenix/286 on Xenix/386
1338xlibpth='/usr/lib/386 /lib/386'
1339: Possible local library directories to search.
1340loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1341loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1342
1343: general looking path for locating libraries
1344glibpth="/lib /usr/lib $xlibpth"
1345glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1346test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1347test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1348test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1349
1350: Private path used by Configure to find libraries.  Its value
1351: is prepended to libpth. This variable takes care of special
1352: machines, like the mips.  Usually, it should be empty.
1353plibpth=''
1354
1355: default library list
1356libswanted=''
1357: some systems want to use only the non-versioned libso:s
1358ignore_versioned_solibs=''
1359: set usethreads on the Configure command line to enable threads.
1360usereentrant='undef'
1361: full support for void wanted by default
1362defvoidused=15
1363
1364ccname=''
1365ccversion=''
1366perllibs=''
1367: set useposix=false in your hint file to disable the POSIX extension.
1368useposix=true
1369: set useopcode=false in your hint file to disable the Opcode extension.
1370useopcode=true
1371archname64=''
1372ccflags_uselargefiles=''
1373ldflags_uselargefiles=''
1374libswanted_uselargefiles=''
1375: set usemultiplicity on the Configure command line to enable multiplicity.
1376: set usesocks on the Configure command line to enable socks.
1377: List of libraries we want.
1378: If anyone needs extra -lxxx, put those in a hint file.
1379libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1380libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1381: We probably want to search /usr/shlib before most other libraries.
1382: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1383glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1384glibpth="/usr/shlib $glibpth"
1385: Do not use vfork unless overridden by a hint file.
1386usevfork=false
1387
1388: Find the basic shell for Bourne shell scripts
1389case "$sh" in
1390'')
1391	case "$SYSTYPE" in
1392	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1393	*) xxx='/bin/sh';;
1394	esac
1395	if test -f "$xxx"; then
1396		sh="$xxx"
1397	else
1398		: Build up a list and do a single loop so we can 'break' out.
1399		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1400		for xxx in sh bash ksh pdksh ash; do
1401			for p in $pth; do
1402				try="$try ${p}/${xxx}"
1403			done
1404		done
1405		for xxx in $try; do
1406			if test -f "$xxx"; then
1407				sh="$xxx";
1408				break
1409			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1410				sh="$xxx";
1411				break
1412			elif test -f "$xxx.exe"; then
1413				sh="$xxx";
1414				break
1415			fi
1416		done
1417	fi
1418	;;
1419esac
1420
1421case "$sh" in
1422'')	cat >&2 <<EOM
1423$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1424
1425Usually it's in /bin/sh.  How did you even get this far?
1426Please contact me (Perl Maintainers) at perlbug@perl.org and 
1427we'll try to straighten this all out.
1428EOM
1429	exit 1
1430	;;
1431esac
1432
1433: see if sh knows # comments
1434if `$sh -c '#' >/dev/null 2>&1`; then
1435	shsharp=true
1436	spitshell=cat
1437	xcat=/bin/cat
1438	test -f $xcat$_exe || xcat=/usr/bin/cat
1439	if test ! -f $xcat$_exe; then
1440		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1441			if test -f $p/cat$_exe; then
1442				xcat=$p/cat
1443				break
1444			fi
1445		done
1446		if test ! -f $xcat$_exe; then
1447			echo "Can't find cat anywhere!"
1448			exit 1
1449		fi
1450	fi
1451	echo "#!$xcat" >sharp
1452	$eunicefix sharp
1453	chmod +x sharp
1454	./sharp > today 2>/dev/null
1455	if test -s today; then
1456		sharpbang='#!'
1457	else
1458		echo "#! $xcat" > sharp
1459		$eunicefix sharp
1460		chmod +x sharp
1461		./sharp > today 2>/dev/null
1462		if test -s today; then
1463			sharpbang='#! '
1464		else
1465			sharpbang=': use '
1466		fi
1467	fi
1468else
1469	echo " "
1470	echo "Your $sh doesn't grok # comments--I will strip them later on."
1471	shsharp=false
1472	cd ..
1473	echo "exec grep -v '^[ 	]*#'" >spitshell
1474	chmod +x spitshell
1475	$eunicefix spitshell
1476	spitshell=`pwd`/spitshell
1477	cd UU
1478	echo "I presume that if # doesn't work, #! won't work either!"
1479	sharpbang=': use '
1480fi
1481rm -f sharp today
1482
1483: figure out how to guarantee sh startup
1484case "$startsh" in
1485'') startsh=${sharpbang}${sh} ;;
1486*)
1487esac
1488cat >sharp <<EOSS
1489$startsh
1490set abc
1491test "$?abc" != 1
1492EOSS
1493
1494chmod +x sharp
1495$eunicefix sharp
1496if ./sharp; then
1497	: echo "Yup, it does."
1498else
1499	echo "Hmm... '$startsh' does not guarantee sh startup..."
1500	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1501fi
1502rm -f sharp
1503
1504: Save command line options in file UU/cmdline.opt for later use in
1505: generating config.sh.
1506cat > cmdline.opt <<EOSH
1507: Configure command line arguments.
1508config_arg0='$0'
1509config_args='$*'
1510config_argc=$#
1511EOSH
1512argn=1
1513args_exp=''
1514args_sep=''
1515for arg in "$@"; do
1516	cat >>cmdline.opt <<EOSH
1517config_arg$argn='$arg'
1518EOSH
1519	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1520$arg
1521EOC
1522	arg_exp=`cat cmdl.opt`
1523	args_exp="$args_exp$args_sep'$arg_exp'"
1524	argn=`expr $argn + 1`
1525	args_sep=' '
1526done
1527rm -f cmdl.opt
1528
1529: produce awk script to parse command line options
1530cat >options.awk <<'EOF'
1531BEGIN {
1532	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1533
1534	len = length(optstr);
1535	for (i = 1; i <= len; i++) {
1536		c = substr(optstr, i, 1);
1537		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1538		if (a == ":") {
1539			arg[c] = 1;
1540			i++;
1541		}
1542		opt[c] = 1;
1543	}
1544}
1545{
1546	expect = 0;
1547	str = $0;
1548	if (substr(str, 1, 1) != "-") {
1549		printf("'%s'\n", str);
1550		next;
1551	}
1552	len = length($0);
1553	for (i = 2; i <= len; i++) {
1554		c = substr(str, i, 1);
1555		if (!opt[c]) {
1556			printf("-%s\n", substr(str, i));
1557			next;
1558		}
1559		printf("-%s\n", c);
1560		if (arg[c]) {
1561			if (i < len)
1562				printf("'%s'\n", substr(str, i + 1));
1563			else
1564				expect = 1;
1565			next;
1566		}
1567	}
1568}
1569END {
1570	if (expect)
1571		print "?";
1572}
1573EOF
1574
1575: process the command line options
1576set X `for arg in "$@"; do echo "X$arg"; done |
1577	sed -e s/X// | awk -f options.awk`
1578eval "set $*"
1579shift
1580rm -f options.awk
1581
1582: set up default values
1583fastread=''
1584reuseval=false
1585config_sh=''
1586alldone=''
1587error=''
1588silent=''
1589extractsh=''
1590override=''
1591knowitall=''
1592rm -f optdef.sh posthint.sh
1593cat >optdef.sh <<EOS
1594$startsh
1595EOS
1596
1597
1598: option parsing
1599while test $# -gt 0; do
1600	case "$1" in
1601	-d) shift; fastread=yes;;
1602	-e) shift; alldone=cont;;
1603	-f)
1604		shift
1605		cd ..
1606		if test -r "$1"; then
1607			config_sh="$1"
1608		else
1609			echo "$me: cannot read config file $1." >&2
1610			error=true
1611		fi
1612		cd UU
1613		shift;;
1614	--help|\
1615	-h) shift; error=true;;
1616	-r) shift; reuseval=true;;
1617	-s) shift; silent=true; realsilent=true;;
1618	-E) shift; alldone=exit;;
1619	-K) shift; knowitall=true;;
1620	-O) shift; override=true;;
1621	-S) shift; silent=true; extractsh=true;;
1622	-D)
1623		shift
1624		case "$1" in
1625		*=)
1626			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1627			echo "$me: ignoring -D $1" >&2
1628			;;
1629		*=*) echo "$1" | \
1630				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1631		*) echo "$1='define'" >> optdef.sh;;
1632		esac
1633		shift
1634		;;
1635	-U)
1636		shift
1637		case "$1" in
1638		*=) echo "$1" >> optdef.sh;;
1639		*=*)
1640			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1641			echo "$me: ignoring -U $1" >&2
1642			;;
1643		*) echo "$1='undef'" >> optdef.sh;;
1644		esac
1645		shift
1646		;;
1647	-A)
1648	    shift
1649	    xxx=''
1650	    yyy="$1"
1651	    zzz=''
1652	    uuu=undef
1653	    case "$yyy" in
1654            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1655                 case "$zzz" in
1656                 *:*) zzz='' ;;
1657                 *)   xxx=append
1658                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1659                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660                 esac
1661                 ;;
1662            esac
1663            case "$xxx" in
1664            '')  case "$yyy" in
1665                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1666                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1667                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1668                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1669                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1670                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1671                 esac
1672                 ;;
1673            esac
1674	    case "$xxx" in
1675	    append)
1676		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1677	    clear)
1678		echo "$yyy=''"			>> posthint.sh ;;
1679	    define)
1680	        case "$zzz" in
1681		'') zzz=define ;;
1682		esac
1683		echo "$yyy='$zzz'"		>> posthint.sh ;;
1684	    eval)
1685		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1686	    prepend)
1687		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1688	    undef)
1689	        case "$zzz" in
1690		'') zzz="$uuu" ;;
1691		esac
1692		echo "$yyy=$zzz"		>> posthint.sh ;;
1693            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1694	    esac
1695	    shift
1696	    ;;
1697	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1698	    exit 0;;
1699	--) break;;
1700	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1701	*) break;;
1702	esac
1703done
1704
1705case "$error" in
1706true)
1707	cat >&2 <<EOM
1708Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1709                 [-U symbol] [-U symbol=] [-A command:symbol...]
1710  -d : use defaults for all answers.
1711  -e : go on without questioning past the production of config.sh.
1712  -f : specify an alternate default configuration file.
1713  -h : print this help message and exit (with an error status).
1714  -r : reuse C symbols value if possible (skips costly nm extraction).
1715  -s : silent mode, only echoes questions and essential information.
1716  -D : define symbol to have some value:
1717         -D symbol         symbol gets the value 'define'
1718         -D symbol=value   symbol gets the value 'value'
1719       common used examples (see INSTALL for more info):
1720         -Duse64bitint            use 64bit integers
1721         -Duse64bitall            use 64bit integers and pointers
1722         -Dusethreads             use thread support
1723         -Dinc_version_list=none  do not include older perl trees in @INC
1724         -DEBUGGING=none          DEBUGGING options
1725         -Dcc=gcc                 choose your compiler
1726         -Dprefix=/opt/perl5      choose your destination
1727  -E : stop at the end of questions, after having produced config.sh.
1728  -K : do not use unless you know what you are doing.
1729  -O : let -D and -U override definitions from loaded configuration file.
1730  -S : perform variable substitutions on all .SH files (can mix with -f)
1731  -U : undefine symbol:
1732         -U symbol    symbol gets the value 'undef'
1733         -U symbol=   symbol gets completely empty
1734       e.g.:  -Uversiononly
1735  -A : manipulate symbol after the platform specific hints have been applied:
1736         -A append:symbol=value   append value to symbol
1737         -A symbol=value          like append:, but with a separating space
1738         -A define:symbol=value   define symbol to have value
1739         -A clear:symbol          define symbol to be ''
1740         -A define:symbol         define symbol to be 'define'
1741         -A eval:symbol=value     define symbol to be eval of value
1742         -A prepend:symbol=value  prepend value to symbol
1743         -A undef:symbol          define symbol to be 'undef'
1744         -A undef:symbol=         define symbol to be ''
1745       e.g.:  -A prepend:libswanted='cl pthread '
1746              -A ccflags=-DSOME_MACRO
1747  -V : print version number and exit (with a zero status).
1748EOM
1749	exit 1
1750	;;
1751esac
1752
1753: Sanity checks
1754case "$fastread$alldone" in
1755yescont|yesexit) ;;
1756*)
1757	case "$extractsh" in
1758	true) ;;
1759	*)
1760		if test ! -t 0; then
1761			echo "Say 'sh Configure', not 'sh <Configure'"
1762			exit 1
1763		fi
1764		;;
1765	esac
1766	;;
1767esac
1768
1769exec 4>&1
1770case "$silent" in
1771true) exec 1>/dev/null;;
1772esac
1773
1774: run the defines and the undefines, if any, but leave the file out there...
1775touch optdef.sh
1776. ./optdef.sh
1777: create the posthint manipulation script and leave the file out there...
1778touch posthint.sh
1779
1780: set package name
1781package='perl5'
1782first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1783last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1784case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1785ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1786*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1787esac
1788
1789: Some greps do not return status, grrr.
1790echo "grimblepritz" >grimble
1791if grep blurfldyick grimble >/dev/null 2>&1 ; then
1792	contains=contains
1793elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1794	contains=grep
1795else
1796	contains=contains
1797fi
1798rm -f grimble
1799: the following should work in any shell
1800case "$contains" in
1801contains*)
1802	echo " "
1803	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1804	cat >contains <<'EOSS'
1805grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1806EOSS
1807chmod +x contains
1808esac
1809
1810: Find the path to the source tree
1811case "$src" in
1812'') case "$0" in
1813    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1814         case "$src" in
1815	 /*)	;;
1816	 .)	;;
1817         *)	src=`cd ../$src && pwd` ;;
1818	 esac
1819         ;;
1820    *)   src='.';;
1821    esac;;
1822esac
1823case "$src" in
1824'')	src=/
1825	rsrc=/
1826	;;
1827/*)	rsrc="$src";;
1828*)	rsrc="../$src";;
1829esac
1830if test -f $rsrc/Configure && \
1831	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1832then
1833   : found it, so we are ok.
1834else
1835	rsrc=''
1836	for src in . .. ../.. ../../.. ../../../..; do
1837		if test -f ../$src/Configure && \
1838			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1839		then
1840			rsrc=../$src
1841			break
1842		fi
1843	done
1844fi
1845case "$rsrc" in
1846'')
1847	cat <<EOM >&4
1848
1849Sorry, I can't seem to locate the source dir for $package.  Please start
1850Configure with an explicit path -- i.e. /some/path/Configure.
1851
1852EOM
1853	exit 1
1854	;;
1855../.)	rsrc='..';;
1856*)
1857	echo " "
1858	echo "Sources for $package found in \"$src\"." >&4
1859	;;
1860esac
1861
1862: script used to extract .SH files with variable substitutions
1863cat >extract <<'EOS'
1864PERL_CONFIG_SH=true
1865echo "Doing variable substitutions on .SH files..."
1866if test -f MANIFEST; then
1867	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1868else
1869	echo "(Looking for .SH files under the source directory.)"
1870	set x `(cd "$src"; find . -name "*.SH" -print)`
1871fi
1872shift
1873case $# in
18740) set x `(cd "$src"; echo *.SH)`; shift;;
1875esac
1876if test ! -f "$src/$1"; then
1877	shift
1878fi
1879mkdir_p='
1880name=$1;
1881create="";
1882while test $name; do
1883	if test ! -d "$name"; then
1884		create="$name $create";
1885		name=`echo $name | sed -e "s|^[^/]*$||"`;
1886		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1887	else
1888		name="";
1889	fi;
1890done;
1891for file in $create; do
1892	mkdir $file;
1893done
1894'
1895for file in $*; do
1896	case "$src" in
1897	".")
1898		case "$file" in
1899		*/*)
1900			dir=`expr X$file : 'X\(.*\)/'`
1901			file=`expr X$file : 'X.*/\(.*\)'`
1902			(cd "$dir" && . ./$file)
1903			;;
1904		*)
1905			. ./$file
1906			;;
1907		esac
1908		;;
1909	*)
1910		case "$file" in
1911		*/*)
1912			dir=`expr X$file : 'X\(.*\)/'`
1913			file=`expr X$file : 'X.*/\(.*\)'`
1914			(set x $dir; shift; eval $mkdir_p)
1915			sh <"$src/$dir/$file"
1916			;;
1917		*)
1918			sh <"$src/$file"
1919			;;
1920		esac
1921		;;
1922	esac
1923done
1924if test -f "$src/config_h.SH"; then
1925	if test ! -f config.h; then
1926	: oops, they left it out of MANIFEST, probably, so do it anyway.
1927	. "$src/config_h.SH"
1928	fi
1929fi
1930EOS
1931
1932: extract files and exit if asked to do so
1933case "$extractsh" in
1934true)
1935	case "$realsilent" in
1936	true) ;;
1937	*) exec 1>&4;;
1938	esac
1939	case "$config_sh" in
1940	'') config_sh='config.sh';;
1941	esac
1942	echo " "
1943	echo "Fetching answers from $config_sh..."
1944	cd ..
1945	. $config_sh
1946	test "$override" && . ./optdef.sh
1947	echo " "
1948	. UU/extract
1949	rm -rf UU
1950	echo "Extraction done."
1951	exit 0
1952	;;
1953esac
1954
1955: Eunice requires " " instead of "", can you believe it
1956echo " "
1957: Here we go...
1958echo "Beginning of configuration questions for $package."
1959
1960trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1961
1962: first determine how to suppress newline on echo command
1963echo " "
1964echo "Checking echo to see how to suppress newlines..."
1965(echo "hi there\c" ; echo " ") >.echotmp
1966if $contains c .echotmp >/dev/null 2>&1 ; then
1967	echo "...using -n."
1968	n='-n'
1969	c=''
1970else
1971	cat <<'EOM'
1972...using \c
1973EOM
1974	n=''
1975	c='\c'
1976fi
1977echo $n "The star should be here-->$c"
1978echo '*'
1979rm -f .echotmp
1980
1981: Now test for existence of everything in MANIFEST
1982echo " "
1983if test -f "$rsrc/MANIFEST"; then
1984	echo "First let's make sure your kit is complete.  Checking..." >&4
1985	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1986		(split -l 50 2>/dev/null || split -50)
1987	rm -f missing
1988	tmppwd=`pwd`
1989	for filelist in x??; do
1990		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1991			>/dev/null 2>>"$tmppwd/missing")
1992	done
1993	if test -s missing; then
1994		cat missing >&4
1995		cat >&4 <<'EOM'
1996
1997THIS PACKAGE SEEMS TO BE INCOMPLETE.
1998
1999You have the option of continuing the configuration process, despite the
2000distinct possibility that your kit is damaged, by typing 'y'es.  If you
2001do, don't blame me if something goes wrong.  I advise you to type 'n'o
2002and contact the author (perlbug@perl.org).
2003
2004EOM
2005		echo $n "Continue? [n] $c" >&4
2006		read ans
2007		case "$ans" in
2008		y*)
2009			echo "Continuing..." >&4
2010			rm -f missing
2011			;;
2012		*)
2013			echo "ABORTING..." >&4
2014			kill $$
2015			;;
2016		esac
2017	else
2018		echo "Looks good..."
2019	fi
2020else
2021	echo "There is no MANIFEST file.  I hope your kit is complete !"
2022fi
2023rm -f missing x??
2024
2025: Find the appropriate value for a newline for tr
2026echo " "
2027if test -n "$DJGPP"; then
2028       trnl='\012'
2029fi
2030if test X"$trnl" = X; then
2031	case "`echo foo|tr '\n' x 2>/dev/null`" in
2032	foox) trnl='\n' ;;
2033	esac
2034fi
2035if test X"$trnl" = X; then
2036	case "`echo foo|tr '\012' x 2>/dev/null`" in
2037	foox) trnl='\012' ;;
2038	esac
2039fi
2040if test X"$trnl" = X; then
2041       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2042       fooxy) trnl='\n\r' ;;
2043       esac
2044fi
2045if test X"$trnl" = X; then
2046	cat <<EOM >&2
2047
2048$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2049
2050EOM
2051	exit 1
2052fi
2053
2054: compute the number of columns on the terminal for proper question formatting
2055case "$COLUMNS" in
2056'') COLUMNS='80';;
2057esac
2058
2059: set up the echo used in my read
2060myecho="case \"\$xxxm\" in
2061'') echo $n \"\$rp $c\" >&4;;
2062*) case \"\$rp\" in
2063	'') echo $n \"[\$xxxm] $c\";;
2064	*)
2065		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2066			echo \"\$rp\" >&4
2067			echo $n \"[\$xxxm] $c\" >&4
2068		else
2069			echo $n \"\$rp [\$xxxm] $c\" >&4
2070		fi
2071		;;
2072	esac;;
2073esac"
2074
2075: now set up to do reads with possible shell escape and default assignment
2076cat <<EOSC >myread
2077$startsh
2078xxxm=\$dflt
2079$myecho
2080ans='!'
2081case "\$fastread" in
2082yes) case "\$dflt" in
2083	'') ;;
2084	*) ans='';
2085		case "\$silent-\$rp" in
2086		true-) ;;
2087		*) echo " " >&4;;
2088		esac;;
2089	esac;;
2090*) case "\$silent" in
2091	true) case "\$rp" in
2092		'') ans='';;
2093		esac;;
2094	esac;;
2095esac
2096while expr "X\$ans" : "X!" >/dev/null; do
2097	read answ
2098	set x \$xxxm
2099	shift
2100	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2101	case  "\$answ" in
2102	"!")
2103		sh 1>&4
2104		echo " "
2105		$myecho
2106		;;
2107	!*)
2108		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2109		shift
2110		sh 1>&4 -c "\$*"
2111		echo " "
2112		$myecho
2113		;;
2114	"\$ans")
2115		case "\$ans" in
2116		\\&*)
2117			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2118			shift
2119			case "\$1" in
2120			-d)
2121				fastread=yes
2122				echo "(OK, I'll run with -d after this question.)" >&4
2123				;;
2124			-*)
2125				echo "*** Sorry, \$1 not supported yet." >&4
2126				;;
2127			esac
2128			$myecho
2129			ans=!
2130			;;
2131		esac;;
2132	*)
2133		case "\$aok" in
2134		y)
2135			echo "*** Substitution done -- please confirm."
2136			xxxm="\$ans"
2137			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2138			xxxm="\$ans"
2139			ans=!
2140			;;
2141		*)
2142			echo "*** Error -- try again."
2143			ans=!
2144			;;
2145		esac
2146		$myecho
2147		;;
2148	esac
2149	case "\$ans\$xxxm\$nostick" in
2150	'')
2151		ans=!
2152		$myecho
2153		;;
2154	esac
2155done
2156case "\$ans" in
2157'') ans="\$xxxm";;
2158esac
2159EOSC
2160
2161: create .config dir to save info across Configure sessions
2162test -d ../.config || mkdir ../.config
2163cat >../.config/README <<EOF
2164This directory created by Configure to save information that should
2165persist across sessions for $package.
2166
2167You may safely delete it if you wish.
2168EOF
2169
2170: See if we are using a devel version and want that
2171xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2172case "$usedevel" in
2173$define|true|[yY]*)
2174    usedevel="$define" ;;
2175*) case "$xversion" in
2176   *[13579])
2177	cat >&4 <<EOH
2178*** WHOA THERE!!! ***
2179
2180    This is an UNSTABLE DEVELOPMENT release.
2181    The version of this $package distribution is $xversion, that is, odd,
2182    (as opposed to even) and that signifies a development release.
2183    If you want a maintenance release, you want an even-numbered version.
2184
2185    Do ***NOT*** install this into production use.
2186    Data corruption and crashes are possible.
2187
2188    It is most seriously suggested that you do not continue any further
2189    unless you want to help in developing and debugging Perl.
2190
2191    If you *still* want to build perl, you can answer 'y' now,
2192    or pass -Dusedevel to Configure.
2193
2194EOH
2195	rp='Do you really want to continue?'
2196	dflt='n'
2197	. ./myread
2198	case "$ans" in
2199	[yY]) echo >&4 "Okay, continuing."
2200	      usedevel="$define" ;;
2201	*) echo >&4 "Okay, bye."
2202	   exit 1
2203	   ;;
2204	esac
2205	;;
2206    esac
2207    usedevel="$undef"
2208    ;;
2209esac
2210case "$usedevel" in
2211$define|true|[yY]*)
2212	case "$versiononly" in
2213	'') versiononly="$define" ;;
2214	esac
2215	case "$installusrbinperl" in
2216	'') installusrbinperl="$undef" ;;
2217	esac
2218	;;
2219esac
2220
2221: general instructions
2222needman=true
2223firsttime=true
2224user=`(logname) 2>/dev/null`
2225case "$user" in
2226'') user=`whoami 2>&1`;;
2227esac
2228if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2229	firsttime=false
2230	echo " "
2231	rp='Would you like to see the instructions?'
2232	dflt=n
2233	. ./myread
2234	case "$ans" in
2235	[yY]*) ;;
2236	*) needman=false;;
2237	esac
2238fi
2239if $needman; then
2240	cat <<EOH
2241
2242This installation shell script will examine your system and ask you questions
2243to determine how the perl5 package should be installed. If you get
2244stuck on a question, you may use a ! shell escape to start a subshell or
2245execute a command.  Many of the questions will have default answers in square
2246brackets; typing carriage return will give you the default.
2247
2248On some of the questions which ask for file or directory names you are allowed
2249to use the ~name construct to specify the login directory belonging to "name",
2250even if you don't have a shell which knows about that.  Questions where this is
2251allowed will be marked "(~name ok)".
2252
2253EOH
2254	rp=''
2255	dflt='Type carriage return to continue'
2256	. ./myread
2257	cat <<'EOH'
2258
2259The prompter used in this script allows you to use shell variables and
2260backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2261in the default answer, as if the default line was a set of arguments given to a
2262script shell.  This means you may also use $* to repeat the whole default line,
2263so you do not have to re-type everything to add something to the default.
2264
2265Every time there is a substitution, you will have to confirm.  If there is an
2266error (e.g. an unmatched backtick), the default answer will remain unchanged
2267and you will be prompted again.
2268
2269If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2270the questions and use the computed defaults (or the previous answers if there
2271was already a config.sh file). Type 'Configure -h' for a list of options.
2272You may also start interactively and then answer '& -d' at any prompt to turn
2273on the non-interactive behaviour for the remainder of the execution.
2274
2275EOH
2276	. ./myread
2277	cat <<EOH
2278
2279Much effort has been expended to ensure that this shell script will run on any
2280Unix system.  If despite that it blows up on yours, your best bet is to edit
2281Configure and run it again.  If you can't run Configure for some reason,
2282you'll have to generate a config.sh file by hand.  Whatever problems you
2283have, let me (perlbug@perl.org) know how I blew it.
2284
2285This installation script affects things in two ways:
2286
22871) it may do direct variable substitutions on some of the files included
2288   in this kit.
22892) it builds a config.h file for inclusion in C programs.  You may edit
2290   any of these files as the need arises after running this script.
2291
2292If you make a mistake on a question, there is no easy way to back up to it
2293currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2294files.  Configure will offer to let you do this before it runs the SH files.
2295
2296EOH
2297	dflt='Type carriage return to continue'
2298	. ./myread
2299	case "$firsttime" in
2300	true) echo $user >>../.config/instruct;;
2301	esac
2302fi
2303
2304: find out where common programs are
2305echo " "
2306echo "Locating common programs..." >&4
2307cat <<EOSC >loc
2308$startsh
2309case \$# in
23100) exit 1;;
2311esac
2312thing=\$1
2313shift
2314dflt=\$1
2315shift
2316for dir in \$*; do
2317	case "\$thing" in
2318	.)
2319	if test -d \$dir/\$thing; then
2320		echo \$dir
2321		exit 0
2322	fi
2323	;;
2324	*)
2325	for thisthing in \$dir/\$thing; do
2326		: just loop through to pick last item
2327	done
2328	if test -f \$thisthing; then
2329		echo \$thisthing
2330		exit 0
2331	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2332		echo \$thisthing
2333		exit 0
2334	elif test -f \$dir/\$thing.exe; then
2335		if test -n "$DJGPP"; then
2336			echo \$dir/\$thing.exe
2337		elif test "$eunicefix" != ":"; then
2338			: on Eunice apparently
2339			echo \$dir/\$thing
2340		fi
2341		exit 0
2342	fi
2343	;;
2344	esac
2345done
2346echo \$dflt
2347exit 1
2348EOSC
2349chmod +x loc
2350$eunicefix loc
2351loclist="
2352awk
2353cat
2354chmod
2355comm
2356cp
2357echo
2358expr
2359grep
2360ls
2361mkdir
2362rm
2363sed
2364sort
2365touch
2366tr
2367uniq
2368"
2369trylist="
2370ar
2371bison
2372byacc
2373cpp
2374csh
2375date
2376egrep
2377gmake
2378gzip
2379less
2380ln
2381make
2382more
2383nm
2384nroff
2385perl
2386pg
2387test
2388uname
2389zip
2390"
2391pth=`echo $PATH | sed -e "s/$p_/ /g"`
2392pth="$pth /lib /usr/lib"
2393for file in $loclist; do
2394	eval xxx=\$$file
2395	case "$xxx" in
2396	/*|?:[\\/]*)
2397		if test -f "$xxx"; then
2398			: ok
2399		else
2400			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2401			xxx=`./loc $file $file $pth`
2402		fi
2403		;;
2404	'') xxx=`./loc $file $file $pth`;;
2405	*) xxx=`./loc $xxx $xxx $pth`;;
2406	esac
2407	eval $file=$xxx$_exe
2408	eval _$file=$xxx
2409	case "$xxx" in
2410	/*)
2411		echo $file is in $xxx.
2412		;;
2413	?:[\\/]*)
2414		echo $file is in $xxx.
2415		;;
2416	*)
2417		echo "I don't know where '$file' is, and my life depends on it." >&4
2418		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2419		exit 1
2420		;;
2421	esac
2422done
2423echo " "
2424echo "Don't worry if any of the following aren't found..."
2425say=offhand
2426for file in $trylist; do
2427	eval xxx=\$$file
2428	case "$xxx" in
2429	/*|?:[\\/]*)
2430		if test -f "$xxx"; then
2431			: ok
2432		else
2433			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2434			xxx=`./loc $file $file $pth`
2435		fi
2436		;;
2437	'') xxx=`./loc $file $file $pth`;;
2438	*) xxx=`./loc $xxx $xxx $pth`;;
2439	esac
2440	eval $file=$xxx$_exe
2441	eval _$file=$xxx
2442	case "$xxx" in
2443	/*)
2444		echo $file is in $xxx.
2445		;;
2446	?:[\\/]*)
2447		echo $file is in $xxx.
2448		;;
2449	*)
2450		echo "I don't see $file out there, $say."
2451		say=either
2452		;;
2453	esac
2454done
2455case "$egrep" in
2456egrep)
2457	echo "Substituting grep for egrep."
2458	egrep=$grep
2459	_egrep=$grep
2460	;;
2461esac
2462case "$less" in
2463'')	;;
2464*)	if $less -R </dev/null >/dev/null; then
2465	       echo "Substituting less -R for less."
2466	       less="$less -R"
2467	       _less=$less
2468	fi
2469	;;
2470esac
2471case "$ln" in
2472ln)
2473	echo "Substituting cp for ln."
2474	ln=$cp
2475	_ln=$cp
2476	;;
2477esac
2478case "$make" in
2479make)
2480	case "$gmake" in
2481	gmake)
2482	echo "I can't find make or gmake, and my life depends on it." >&4
2483	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2484	exit 1
2485	;;
2486	esac
2487	;;
2488esac
2489case "$gmake" in
2490gmake)	;;
2491*)	# We can't have osname yet.
2492	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2493		# Assume that gmake, if found, is definitely GNU make
2494		# and prefer it over the system make.
2495		echo "Substituting gmake for make."
2496		make=$gmake
2497		_make=$gmake
2498	fi
2499	;;
2500esac
2501case "$test" in
2502test)
2503	echo "Hopefully test is built into your sh."
2504	;;
2505*)
2506	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2507		echo "Using the test built into your sh."
2508		test=test
2509		_test=test
2510	fi
2511	;;
2512esac
2513case "$echo" in
2514echo)
2515	echo "Hopefully echo is built into your sh."
2516	;;
2517'') ;;
2518*)
2519	echo " "
2520echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2521	$echo $n "hi there$c" >foo1
2522	echo $n "hi there$c" >foo2
2523	if cmp foo1 foo2 >/dev/null 2>&1; then
2524		echo "They are compatible.  In fact, they may be identical."
2525	else
2526		case "$n" in
2527		'-n') n='' c='\c';;
2528		*) n='-n' c='';;
2529		esac
2530		cat <<FOO
2531They are not compatible!  You are probably running ksh on a non-USG system.
2532I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2533have echo built in and we may have to run some Bourne shell scripts.  That
2534means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2535
2536FOO
2537		$echo $n "The star should be here-->$c"
2538		$echo "*"
2539	fi
2540	$rm -f foo1 foo2
2541	;;
2542esac
2543
2544# This question was auctioned at YAPC::Europe-2007 in Vienna
2545# I never promised you could answer it. I only auctioned the question.
2546cat <<FOO
2547The following message is sponsored by
2548
2549  Dresden.pm<--The stars should be here.
2550
2551Dear Perl user, system administrator or package
2552maintainer, the Perl community sends greetings to
2553you. Do you (emblematical) greet back [Y/n]? n
2554
2555FOO
2556
2557: Check what type of C compiler we use
2558cat <<EOS >trygcc
2559$startsh
2560EOS
2561cat <<'EOSC' >>trygcc
2562case "$cc" in
2563'') ;;
2564*)  $rm -f try try.*
2565    $cat >try.c <<EOM
2566int main(int argc, char *argv[]) {
2567  return 0;
2568}
2569EOM
2570    if $cc -o try $ccflags $ldflags try.c; then
2571       :
2572    else
2573        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2574        despair=yes
2575        trygcc=yes
2576        case "$cc" in
2577        *gcc*) trygcc=no ;;
2578        esac
2579	# Skip this test because it gives a false match on output like:
2580	#    ./trygcc: line 23: cc: command not found
2581        # case "`$cc -v -c try.c 2>&1`" in
2582        # *gcc*) trygcc=no ;;
2583        # esac
2584        if $test X"$trygcc" = Xyes; then
2585            if gcc -o try -c try.c; then
2586                echo " "
2587                echo "You seem to have a working gcc, though." >&4
2588		# Switching compilers may undo the work of hints files.
2589		# The most common problem is -D_REENTRANT for threads.
2590		# This heuristic catches that case, but gets false positives
2591		# if -Dusethreads was not actually specified.  Better to
2592		# bail out here with a useful message than fail
2593		# mysteriously later. Should we perhaps just try to
2594		# re-invoke Configure -Dcc=gcc config_args ?
2595		if $test -f usethreads.cbu; then
2596			$cat >&4 <<EOM 
2597
2598*** However, any setting of the C compiler flags (e.g. for thread support)
2599*** will be lost.  It may be necessary for you to restart Configure and
2600*** add -Dcc=gcc to your Configure command line.
2601
2602EOM
2603			rp="Would you like to go ahead and try gcc anyway?"
2604			dflt=n
2605		else
2606			rp="Would you like to use it?"
2607			dflt=y
2608		fi
2609                if $test -f myread; then
2610                    . ./myread
2611                else
2612                    if $test -f UU/myread; then
2613                        . ./UU/myread
2614                    else
2615                        echo "Cannot find myread, sorry.  Aborting." >&2
2616                        exit 1
2617                    fi
2618                fi
2619                case "$ans" in
2620                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2621                esac
2622            fi
2623        fi
2624    fi
2625    $rm -f try try.*
2626    ;;
2627esac
2628EOSC
2629
2630cat <<EOS >checkcc
2631$startsh
2632EOS
2633cat <<'EOSC' >>checkcc
2634case "$cc" in
2635'') ;;
2636*)  $rm -f try try.*
2637    $cat >try.c <<EOM
2638int main(int argc, char *argv[]) {
2639  return 0;
2640}
2641EOM
2642    if $cc -o try $ccflags $ldflags try.c; then
2643       :
2644    else
2645        if $test X"$despair" = Xyes; then
2646           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2647        fi
2648        $cat >&4 <<EOM         
2649You need to find a working C compiler.
2650Either (purchase and) install the C compiler supplied by your OS vendor,
2651or for a free C compiler try http://gcc.gnu.org/
2652I cannot continue any further, aborting.
2653EOM
2654        exit 1
2655    fi
2656    $rm -f try try.*
2657    ;;
2658esac
2659EOSC
2660
2661: determine whether symbolic links are supported
2662echo " "
2663$touch blurfl
2664if $ln -s blurfl sym > /dev/null 2>&1 ; then
2665	echo "Symbolic links are supported." >&4
2666	lns="$ln -s"
2667else
2668	echo "Symbolic links are NOT supported." >&4
2669	lns="$ln"
2670fi
2671$rm -f blurfl sym
2672
2673: determine whether symbolic links are supported
2674echo " "
2675case "$lns" in
2676*"ln"*" -s")
2677	echo "Checking how to test for symbolic links..." >&4
2678	$lns blurfl sym
2679	if $test "X$issymlink" = X; then
2680		case "$newsh" in
2681		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2683		esac
2684		if test $? = 0; then
2685			issymlink="test -h"
2686		else
2687			echo "Your builtin 'test -h' may be broken." >&4
2688			case "$test" in
2689			/*)	;;
2690			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2691				for p in $pth
2692				do
2693					if test -f "$p/$test"; then
2694						test="$p/$test"
2695						break
2696					fi
2697				done
2698				;;
2699			esac
2700			case "$test" in
2701			/*)
2702				echo "Trying external '$test -h'." >&4
2703				issymlink="$test -h"
2704				if $test ! -h sym >/dev/null 2>&1; then
2705					echo "External '$test -h' is broken, too." >&4
2706					issymlink=''
2707				fi
2708				;;
2709			*)	issymlink='' ;;
2710			esac
2711		fi
2712	fi
2713	if $test "X$issymlink" = X; then
2714		if $test -L sym 2>/dev/null; then
2715			issymlink="$test -L"
2716			echo "The builtin '$test -L' worked." >&4
2717		fi
2718	fi
2719	if $test "X$issymlink" != X; then
2720		echo "You can test for symbolic links with '$issymlink'." >&4
2721	else
2722		echo "I do not know how you can test for symbolic links." >&4
2723	fi
2724	$rm -f blurfl sym
2725	;;
2726*)	echo "No symbolic links, so not testing for their testing..." >&4
2727	;;
2728esac
2729echo " "
2730
2731: Make symlinks util
2732case "$mksymlinks" in
2733$define|true|[yY]*)
2734	case "$src" in
2735	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2736		exit 1
2737		;;
2738	*)	case "$lns:$issymlink" in
2739		*"ln"*" -s:"*"test -"?)
2740			echo "Creating the symbolic links..." >&4
2741			cd ..
2742			awk -v src="$src" '{
2743				dir=$1;
2744				if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." }
2745				mf[dir] = mf[dir]" "src"/"$1;
2746			} END {
2747				for (d in mf) {
2748					if (d != ".") { system("mkdir -p "d) }
2749					system("ln -sf "mf[d]" "d);
2750				}
2751			}' $src/MANIFEST
2752			# Sanity check 1.
2753			if test ! -d t/base; then
2754				echo "Failed to create the subdirectories.  Aborting." >&4
2755				exit 1
2756			fi
2757			# Sanity check 2.
2758			if test ! -f t/base/lex.t; then
2759				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2760				exit 1
2761			fi
2762			if test ! -f x2p/walk.c; then
2763				echo "Failed to create the symlinks (x2p/walk.c missing).  Aborting." >&4
2764				exit 1
2765			fi
2766			cd UU
2767			;;
2768		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2769			;;
2770		esac
2771		;;
2772	esac
2773	;;
2774esac
2775
2776: Check for Cross-Compilation
2777case "$usecrosscompile" in
2778$define|true|[yY]*)
2779	$echo "Cross-compiling..."
2780        croak=''
2781    	case "$cc" in
2782	*-*-gcc) # A cross-compiling gcc, probably.
2783	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2784	    ar=$targetarch-ar
2785	    # leave out ld, choosing it is more complex
2786	    nm=$targetarch-nm
2787	    ranlib=$targetarch-ranlib
2788	    $echo 'extern int foo;' > try.c
2789	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2790	    shift
2791            if $test $# -gt 0; then
2792	        incpth="$incpth $*"
2793		incpth="`$echo $incpth|$sed 's/^ //'`"
2794                echo "Guessing incpth '$incpth'." >&4
2795                for i in $*; do
2796		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2797		    if $test -d $j; then
2798			libpth="$libpth $j"
2799		    fi
2800                done
2801		libpth="`$echo $libpth|$sed 's/^ //'`"
2802                echo "Guessing libpth '$libpth'." >&4
2803	    fi
2804	    $rm -f try.c
2805	    ;;
2806	esac
2807	case "$targetarch" in
2808	'') echo "Targetarch not defined." >&4; croak=y ;;
2809        *)  echo "Using targetarch $targetarch." >&4 ;;
2810	esac
2811	case "$incpth" in
2812	'') echo "Incpth not defined." >&4; croak=y ;;
2813        *)  echo "Using incpth '$incpth'." >&4 ;;
2814	esac
2815	case "$libpth" in
2816	'') echo "Libpth not defined." >&4; croak=y ;;
2817        *)  echo "Using libpth '$libpth'." >&4 ;;
2818	esac
2819	case "$usrinc" in
2820	'') for i in $incpth; do
2821	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2822		    usrinc=$i
2823	            echo "Guessing usrinc $usrinc." >&4
2824		    break
2825		fi
2826	    done
2827	    case "$usrinc" in
2828	    '') echo "Usrinc not defined." >&4; croak=y ;;
2829	    esac
2830            ;;
2831        *)  echo "Using usrinc $usrinc." >&4 ;;
2832	esac
2833	case "$targethost" in
2834	'') echo "Targethost not defined." >&4; croak=y ;;
2835        *)  echo "Using targethost $targethost." >&4
2836	esac
2837	locincpth=' '
2838	loclibpth=' '
2839	case "$croak" in
2840	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2841	esac
2842	case "$src" in
2843	/*) run=$src/Cross/run
2844	    targetmkdir=$src/Cross/mkdir
2845	    to=$src/Cross/to
2846	    from=$src/Cross/from
2847	    ;;
2848	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2849	    run=$pwd/Cross/run
2850	    targetmkdir=$pwd/Cross/mkdir
2851	    to=$pwd/Cross/to
2852	    from=$pwd/Cross/from
2853	    ;;
2854	esac
2855	case "$targetrun" in
2856	'') targetrun=ssh ;;
2857	esac
2858	case "$targetto" in
2859	'') targetto=scp ;;
2860	esac
2861	case "$targetfrom" in
2862	'') targetfrom=scp ;;
2863	esac
2864    	run=$run-$targetrun
2865    	to=$to-$targetto
2866    	from=$from-$targetfrom
2867	case "$targetdir" in
2868	'')  targetdir=/tmp
2869             echo "Guessing targetdir $targetdir." >&4
2870             ;;
2871	esac
2872	case "$targetuser" in
2873	'')  targetuser=root
2874             echo "Guessing targetuser $targetuser." >&4
2875             ;;
2876	esac
2877	case "$targetfrom" in
2878	scp)	q=-q ;;
2879	*)	q='' ;;
2880	esac
2881	case "$targetrun" in
2882	ssh|rsh)
2883	    cat >$run <<EOF
2884#!/bin/sh
2885case "\$1" in
2886-cwd)
2887  shift
2888  cwd=\$1
2889  shift
2890  ;;
2891esac
2892case "\$cwd" in
2893'') cwd=$targetdir ;;
2894esac
2895exe=\$1
2896shift
2897if $test ! -f \$exe.xok; then
2898  $to \$exe
2899  $touch \$exe.xok
2900fi
2901$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2902EOF
2903	    ;;
2904	*)  echo "Unknown targetrun '$targetrun'" >&4
2905	    exit 1
2906	    ;;
2907	esac
2908	case "$targetmkdir" in
2909	*/Cross/mkdir)
2910	    cat >$targetmkdir <<EOF
2911#!/bin/sh
2912$targetrun -l $targetuser $targethost "mkdir -p \$@"
2913EOF
2914	    $chmod a+rx $targetmkdir
2915	    ;;
2916	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2917	    exit 1
2918	    ;;
2919	esac
2920	case "$targetto" in
2921	scp|rcp)
2922	    cat >$to <<EOF
2923#!/bin/sh
2924for f in \$@
2925do
2926  case "\$f" in
2927  /*)
2928    $targetmkdir \`dirname \$f\`
2929    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2930    ;;
2931  *)
2932    $targetmkdir $targetdir/\`dirname \$f\`
2933    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2934    ;;
2935  esac
2936done
2937exit 0
2938EOF
2939	    ;;
2940	cp) cat >$to <<EOF
2941#!/bin/sh
2942for f in \$@
2943do
2944  case "\$f" in
2945  /*)
2946    $mkdir -p $targetdir/\`dirname \$f\`
2947    $cp \$f $targetdir/\$f || exit 1
2948    ;;
2949  *)
2950    $targetmkdir $targetdir/\`dirname \$f\`
2951    $cp \$f $targetdir/\$f || exit 1
2952    ;;
2953  esac
2954done
2955exit 0
2956EOF
2957	    ;;
2958	*)  echo "Unknown targetto '$targetto'" >&4
2959	    exit 1
2960	    ;;
2961	esac
2962	case "$targetfrom" in
2963	scp|rcp)
2964	  cat >$from <<EOF
2965#!/bin/sh
2966for f in \$@
2967do
2968  $rm -f \$f
2969  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2970done
2971exit 0
2972EOF
2973	    ;;
2974	cp) cat >$from <<EOF
2975#!/bin/sh
2976for f in \$@
2977do
2978  $rm -f \$f
2979  cp $targetdir/\$f . || exit 1
2980done
2981exit 0
2982EOF
2983	    ;;
2984	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2985	    exit 1
2986	    ;;
2987	esac
2988	if $test ! -f $run; then
2989	    echo "Target 'run' script '$run' not found." >&4
2990	else
2991	    $chmod a+rx $run
2992	fi
2993	if $test ! -f $to; then
2994	    echo "Target 'to' script '$to' not found." >&4
2995	else
2996	    $chmod a+rx $to
2997	fi
2998	if $test ! -f $from; then
2999	    echo "Target 'from' script '$from' not found." >&4
3000	else
3001	    $chmod a+rx $from
3002	fi
3003	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3004	    exit 1
3005	fi
3006	cat >&4 <<EOF
3007Using '$run' for remote execution,
3008and '$from' and '$to'
3009for remote file transfer.
3010EOF
3011	;;
3012*)	run=''
3013	to=:
3014	from=:
3015	usecrosscompile='undef'
3016	targetarch=''
3017	;;
3018esac
3019
3020: see whether [:lower:] and [:upper:] are supported character classes
3021echo " "
3022case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3023ABYZ)
3024	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3025	up='[:upper:]'
3026	low='[:lower:]'
3027	;;
3028*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3029	# (0xd9 and 0xe2), therefore that is a nice testing point.
3030	if test "X$up" = X -o "X$low" = X; then
3031	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3032	    rs) up='[A-Z]'
3033		low='[a-z]'
3034		;;
3035	    esac
3036	fi
3037	if test "X$up" = X -o "X$low" = X; then
3038	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3039	    rs) up='A-Z'
3040		low='a-z'
3041		;;
3042	    esac
3043	fi
3044	if test "X$up" = X -o "X$low" = X; then
3045	    case "`echo RS | od -x 2>/dev/null`" in
3046	    *D9E2*|*d9e2*)
3047		echo "Hey, this might be EBCDIC." >&4
3048		if test "X$up" = X -o "X$low" = X; then
3049		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3050		    rs) up='[A-IJ-RS-Z]'
3051			low='[a-ij-rs-z]'
3052			;;
3053		    esac
3054		fi
3055		if test "X$up" = X -o "X$low" = X; then
3056		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3057		    rs) up='A-IJ-RS-Z'
3058			low='a-ij-rs-z'
3059			;;
3060		    esac
3061		fi
3062		;;
3063	    esac
3064	fi
3065esac
3066case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3067rs)
3068    echo "Using $up and $low to convert case." >&4
3069    ;;
3070*)
3071    echo "I don't know how to translate letters from upper to lower case." >&4
3072    echo "Your tr is not acting any way I know of." >&4
3073    exit 1
3074    ;;
3075esac
3076: set up the translation script tr, must be called with ./tr of course
3077cat >tr <<EOSC
3078$startsh
3079case "\$1\$2" in
3080'[A-Z][a-z]') exec $tr '$up' '$low';;
3081'[a-z][A-Z]') exec $tr '$low' '$up';;
3082esac
3083exec $tr "\$@"
3084EOSC
3085chmod +x tr
3086$eunicefix tr
3087
3088: Try to determine whether config.sh was made on this system
3089case "$config_sh" in
3090'')
3091myuname=`$uname -a 2>/dev/null`
3092$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3093# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3094# because the A-Z/a-z are not consecutive.
3095myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3096	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3097newmyuname="$myuname"
3098dflt=n
3099case "$knowitall" in
3100'')
3101	if test -f ../config.sh; then
3102		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3103			eval "`grep myuname= ../config.sh`"
3104		fi
3105		if test "X$myuname" = "X$newmyuname"; then
3106			dflt=y
3107		fi
3108	fi
3109	;;
3110*) dflt=y;;
3111esac
3112
3113: Get old answers from old config file if Configure was run on the
3114: same system, otherwise use the hints.
3115hint=default
3116cd ..
3117if test -f config.sh; then
3118	echo " "
3119	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3120	. UU/myread
3121	case "$ans" in
3122	n*|N*) echo "OK, I'll ignore it."
3123		mv config.sh config.sh.old
3124		myuname="$newmyuname"
3125		;;
3126	*)  echo "Fetching default answers from your old config.sh file..." >&4
3127		tmp_n="$n"
3128		tmp_c="$c"
3129		tmp_sh="$sh"
3130		. ./config.sh
3131		cp config.sh UU
3132		n="$tmp_n"
3133		c="$tmp_c"
3134		: Older versions did not always set $sh.  Catch re-use of such
3135		: an old config.sh.
3136		case "$sh" in
3137		'') sh="$tmp_sh" ;;
3138		esac
3139		hint=previous
3140		;;
3141	esac
3142fi
3143. ./UU/checkcc
3144if test ! -f config.sh; then
3145	$cat <<EOM
3146
3147First time through, eh?  I have some defaults handy for some systems
3148that need some extra help getting the Configure answers right:
3149
3150EOM
3151	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3152	dflt=''
3153	: Half the following guesses are probably wrong... If you have better
3154	: tests or hints, please send them to perlbug@perl.org
3155	: The metaconfig authors would also appreciate a copy...
3156	$test -f /irix && osname=irix
3157	$test -f /xenix && osname=sco_xenix
3158	$test -f /dynix && osname=dynix
3159	$test -f /dnix && osname=dnix
3160	$test -f /lynx.os && osname=lynxos
3161	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3162	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3163	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3164	$test -f /bin/mips && /bin/mips && osname=mips
3165	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3166		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3167	$test -d /usr/apollo/bin && osname=apollo
3168	$test -f /etc/saf/_sactab && osname=svr4
3169	$test -d /usr/include/minix && osname=minix
3170	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3171	if $test -d /MachTen -o -d /MachTen_Folder; then
3172		osname=machten
3173		if $test -x /sbin/version; then
3174			osvers=`/sbin/version | $awk '{print $2}' |
3175			$sed -e 's/[A-Za-z]$//'`
3176		elif $test -x /usr/etc/version; then
3177			osvers=`/usr/etc/version | $awk '{print $2}' |
3178			$sed -e 's/[A-Za-z]$//'`
3179		else
3180			osvers="$2.$3"
3181		fi
3182	fi
3183
3184	$test -f /sys/posix.dll &&
3185		$test -f /usr/bin/what &&
3186		set X `/usr/bin/what /sys/posix.dll` &&
3187		$test "$3" = UWIN &&
3188		osname=uwin &&
3189		osvers="$5"
3190
3191	if $test -f $uname; then
3192		set X $myuname
3193		shift
3194
3195		case "$5" in
3196		fps*) osname=fps ;;
3197		mips*)
3198			case "$4" in
3199			umips) osname=umips ;;
3200			*) osname=mips ;;
3201			esac;;
3202		[23]100) osname=mips ;;
3203		next*) osname=next ;;
3204		i386*)
3205			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3206			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3207				osname='sco'
3208				osvers=$tmp
3209			elif $test -f /etc/kconfig; then
3210				osname=isc
3211				if test "$lns" = "$ln -s"; then
3212					osvers=4
3213				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3214					osvers=3
3215				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3216					osvers=2
3217				fi
3218			fi
3219			tmp=''
3220			;;
3221		pc*)
3222			if test -n "$DJGPP"; then
3223				osname=dos
3224				osvers=djgpp
3225			fi
3226			;;
3227		esac
3228
3229		case "$1" in
3230		aix) osname=aix
3231			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3232			case "$tmp" in
3233			# oslevel can fail with:
3234			# oslevel: Unable to acquire lock.
3235			*not\ found) osvers="$4"."$3" ;;
3236			'<3240'|'<>3240') osvers=3.2.0 ;;
3237			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3238			'=3250'|'>3250') osvers=3.2.5 ;;
3239			*) osvers=$tmp;;
3240			esac
3241			;;
3242		bsd386) osname=bsd386
3243			osvers=`$uname -r`
3244			;;
3245		cygwin*) osname=cygwin
3246			osvers="$3"
3247			;;
3248		*dc.osx) osname=dcosx
3249			osvers="$3"
3250			;;
3251		dnix) osname=dnix
3252			osvers="$3"
3253			;;
3254		domainos) osname=apollo
3255			osvers="$3"
3256			;;
3257		dgux)	osname=dgux
3258			osvers="$3"
3259			;;
3260		dragonfly) osname=dragonfly
3261			osvers="$3"
3262			;;
3263		dynixptx*) osname=dynixptx
3264			osvers=`echo "$4"|sed 's/^v//'`
3265			;;
3266		freebsd) osname=freebsd
3267			osvers="$3" ;;
3268		genix)	osname=genix ;;
3269		gnu)	osname=gnu
3270			osvers="$3" ;;
3271		hp*)	osname=hpux
3272			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3273			;;
3274		irix*)	osname=irix
3275			case "$3" in
3276			4*) osvers=4 ;;
3277			5*) osvers=5 ;;
3278			*)	osvers="$3" ;;
3279			esac
3280			;;
3281		linux)	osname=linux
3282			case "$3" in
3283			*)	osvers="$3" ;;
3284			esac
3285			;;
3286		MiNT)	osname=mint
3287			;;
3288		netbsd*) osname=netbsd
3289			osvers="$3"
3290			;;
3291		news-os) osvers="$3"
3292			case "$3" in
3293			4*) osname=newsos4 ;;
3294			*) osname=newsos ;;
3295			esac
3296			;;
3297		next*) osname=next ;;
3298		nonstop-ux) osname=nonstopux ;;
3299		openbsd) osname=openbsd
3300                	osvers="$3"
3301                	;;
3302		os2)	osname=os2
3303			osvers="$4"
3304			;;
3305		POSIX-BC | posix-bc ) osname=posix-bc
3306			osvers="$3"
3307			;;
3308		powerux | power_ux | powermax_os | powermaxos | \
3309		powerunix | power_unix) osname=powerux
3310			osvers="$3"
3311			;;
3312		qnx) osname=qnx
3313			osvers="$4"
3314			;;
3315		solaris) osname=solaris
3316			case "$3" in
3317			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3318			*)	osvers="$3" ;;
3319			esac
3320			;;
3321		sunos) osname=sunos
3322			case "$3" in
3323			5*) osname=solaris
3324				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3325			*)	osvers="$3" ;;
3326			esac
3327			;;
3328		titanos) osname=titanos
3329			case "$3" in
3330			1*) osvers=1 ;;
3331			2*) osvers=2 ;;
3332			3*) osvers=3 ;;
3333			4*) osvers=4 ;;
3334			*)	osvers="$3" ;;
3335			esac
3336			;;
3337		ultrix) osname=ultrix
3338			osvers="$3"
3339			;;
3340		osf1|mls+)	case "$5" in
3341				alpha)
3342					osname=dec_osf
3343					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3344					case "$osvers" in
3345					[1-9].[0-9]*) ;;
3346					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3347					esac
3348					;;
3349			hp*)	osname=hp_osf1	;;
3350			mips)	osname=mips_osf1 ;;
3351			esac
3352			;;
3353		# UnixWare 7.1.2 is known as Open UNIX 8
3354		openunix|unixware) osname=svr5
3355			osvers="$4"
3356			;;
3357		uts)	osname=uts
3358			osvers="$3"
3359			;;
3360		vos) osvers="$3"
3361			;;
3362		$2) case "$osname" in
3363			*isc*) ;;
3364			*freebsd*) ;;
3365			svr*)
3366				: svr4.x or possibly later
3367				case "svr$3" in
3368				${osname}*)
3369					osname=svr$3
3370					osvers=$4
3371					;;
3372				esac
3373				case "$osname" in
3374				svr4.0)
3375					: Check for ESIX
3376					if test -f /stand/boot ; then
3377						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3378						if test -n "$INITPROG" -a -f "$INITPROG"; then
3379			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3380							if test -n "$isesix"; then
3381								osname=esix4
3382							fi
3383						fi
3384					fi
3385					;;
3386				esac
3387				;;
3388			*)	if test -f /etc/systemid; then
3389					osname=sco
3390					set `echo $3 | $sed 's/\./ /g'` $4
3391					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3392						osvers=$1.$2.$3
3393					elif $test -f $src/hints/sco_$1_$2.sh; then
3394						osvers=$1.$2
3395					elif $test -f $src/hints/sco_$1.sh; then
3396						osvers=$1
3397					fi
3398				else
3399					case "$osname" in
3400					'') : Still unknown.  Probably a generic Sys V.
3401						osname="sysv"
3402						osvers="$3"
3403						;;
3404					esac
3405				fi
3406				;;
3407			esac
3408			;;
3409		*)	case "$osname" in
3410			'') : Still unknown.  Probably a generic BSD.
3411				osname="$1"
3412				osvers="$3"
3413				;;
3414			esac
3415			;;
3416		esac
3417	else
3418		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3419			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3420			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3421				osname=news_os
3422			fi
3423			$rm -f UU/kernel.what
3424		elif test -d c:/. -o -n "$is_os2" ; then
3425			set X $myuname
3426			osname=os2
3427			osvers="$5"
3428		fi
3429	fi
3430
3431        case "$targetarch" in
3432        '') ;;
3433        *)  hostarch=$osname
3434            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3435            osvers=''
3436            ;;
3437        esac
3438
3439	: Now look for a hint file osname_osvers, unless one has been
3440	: specified already.
3441	case "$hintfile" in
3442	''|' ')
3443		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3444		: Also try without trailing minor version numbers.
3445		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3446		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3447		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3448		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3449		case "$file" in
3450		'') dflt=none ;;
3451		*)  case "$osvers" in
3452			'') dflt=$file
3453				;;
3454			*)  if $test -f $src/hints/$file.sh ; then
3455					dflt=$file
3456				elif $test -f $src/hints/$xfile.sh ; then
3457					dflt=$xfile
3458				elif $test -f $src/hints/$xxfile.sh ; then
3459					dflt=$xxfile
3460				elif $test -f $src/hints/$xxxfile.sh ; then
3461					dflt=$xxxfile
3462				elif $test -f $src/hints/$xxxxfile.sh ; then
3463					dflt=$xxxxfile
3464				elif $test -f "$src/hints/${osname}.sh" ; then
3465					dflt="${osname}"
3466				else
3467					dflt=none
3468				fi
3469				;;
3470			esac
3471			;;
3472		esac
3473		if $test -f Policy.sh ; then
3474			case "$dflt" in
3475			*Policy*) ;;
3476			none) dflt="Policy" ;;
3477			*) dflt="Policy $dflt" ;;
3478			esac
3479		fi
3480		;;
3481	*)
3482		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3483		;;
3484	esac
3485
3486	if $test -f Policy.sh ; then
3487		$cat <<EOM
3488
3489There's also a Policy hint file available, which should make the
3490site-specific (policy) questions easier to answer.
3491EOM
3492
3493	fi
3494
3495	$cat <<EOM
3496
3497You may give one or more space-separated answers, or "none" if appropriate.
3498If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3499previous run of Configure, you may specify it as well as or instead of
3500OS-specific hints.  If hints are provided for your OS, you should use them:
3501although Perl can probably be built without hints on many platforms, using
3502hints often improve performance and may enable features that Configure can't
3503set up on its own. If there are no hints that match your OS, specify "none";
3504DO NOT give a wrong version or a wrong OS.
3505
3506EOM
3507
3508	rp="Which of these apply, if any?"
3509	. UU/myread
3510	tans=$ans
3511	for file in $tans; do
3512		if $test X$file = XPolicy -a -f Policy.sh; then
3513			. Policy.sh
3514			$cat Policy.sh >> UU/config.sh
3515		elif $test -f $src/hints/$file.sh; then
3516			. $src/hints/$file.sh
3517			$cat $src/hints/$file.sh >> UU/config.sh
3518		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3519			: nothing
3520		else
3521			: Give one chance to correct a possible typo.
3522			echo "$file.sh does not exist"
3523			dflt=$file
3524			rp="hint to use instead?"
3525			. UU/myread
3526			for file in $ans; do
3527				if $test -f "$src/hints/$file.sh"; then
3528					. $src/hints/$file.sh
3529					$cat $src/hints/$file.sh >> UU/config.sh
3530				elif $test X$ans = X -o X$ans = Xnone ; then
3531					: nothing
3532				else
3533					echo "$file.sh does not exist -- ignored."
3534				fi
3535			done
3536		fi
3537	done
3538
3539	hint=recommended
3540	: Remember our hint file for later.
3541	if $test -f "$src/hints/$file.sh" ; then
3542		hintfile="$file"
3543	else
3544		hintfile=''
3545	fi
3546fi
3547cd UU
3548;;
3549*)
3550	echo " "
3551	echo "Fetching default answers from $config_sh..." >&4
3552	tmp_n="$n"
3553	tmp_c="$c"
3554	cd ..
3555	cp $config_sh config.sh 2>/dev/null
3556	chmod +w config.sh
3557	. ./config.sh
3558	cd UU
3559	cp ../config.sh .
3560	n="$tmp_n"
3561	c="$tmp_c"
3562	hint=previous
3563	;;
3564esac
3565test "$override" && . ./optdef.sh
3566
3567: Restore computed paths
3568for file in $loclist $trylist; do
3569	eval $file="\$_$file"
3570done
3571
3572cat << EOM
3573
3574Configure uses the operating system name and version to set some defaults.
3575The default value is probably right if the name rings a bell. Otherwise,
3576since spelling matters for me, either accept the default or answer "none"
3577to leave it blank.
3578
3579EOM
3580case "$osname" in
3581	''|' ')
3582		case "$hintfile" in
3583		''|' '|none) dflt=none ;;
3584		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3585		esac
3586		;;
3587	*) dflt="$osname" ;;
3588esac
3589rp="Operating system name?"
3590. ./myread
3591case "$ans" in
3592none)  osname='' ;;
3593*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3594esac
3595echo " "
3596case "$osvers" in
3597	''|' ')
3598		case "$hintfile" in
3599		''|' '|none) dflt=none ;;
3600		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3601			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3602			case "$dflt" in
3603			''|' ') dflt=none ;;
3604			esac
3605			;;
3606		esac
3607		;;
3608	*) dflt="$osvers" ;;
3609esac
3610rp="Operating system version?"
3611. ./myread
3612case "$ans" in
3613none)  osvers='' ;;
3614*) osvers="$ans" ;;
3615esac
3616
3617
3618. ./posthint.sh
3619
3620: who configured the system
3621cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3622case "$cf_by" in
3623"")
3624	cf_by=`(logname) 2>/dev/null`
3625	case "$cf_by" in
3626	"")
3627		cf_by=`(whoami) 2>/dev/null`
3628		case "$cf_by" in
3629		"") cf_by=unknown ;;
3630		esac ;;
3631	esac ;;
3632esac
3633
3634: decide how portable to be.  Allow command line overrides.
3635case "$d_portable" in
3636"$undef") ;;
3637*)	d_portable="$define" ;;
3638esac
3639
3640: set up shell script to do ~ expansion
3641cat >filexp <<EOSS
3642$startsh
3643: expand filename
3644case "\$1" in
3645 \~/*|\~)
3646	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3647	;;
3648 \~*)
3649	if $test -f /bin/csh; then
3650		/bin/csh -f -c "glob \$1"
3651		failed=\$?
3652		echo ""
3653		exit \$failed
3654	else
3655		name=\`$expr x\$1 : '..\([^/]*\)'\`
3656		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3657		if $test ! -d "\$dir"; then
3658			me=\`basename \$0\`
3659			echo "\$me: can't locate home directory for: \$name" >&2
3660			exit 1
3661		fi
3662		case "\$1" in
3663		*/*)
3664			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3665			;;
3666		*)
3667			echo \$dir
3668			;;
3669		esac
3670	fi
3671	;;
3672*)
3673	echo \$1
3674	;;
3675esac
3676EOSS
3677chmod +x filexp
3678$eunicefix filexp
3679
3680: now set up to get a file name
3681cat <<EOS >getfile
3682$startsh
3683EOS
3684cat <<'EOSC' >>getfile
3685tilde=''
3686fullpath=''
3687already=''
3688skip=''
3689none_ok=''
3690exp_file=''
3691nopath_ok=''
3692orig_rp="$rp"
3693orig_dflt="$dflt"
3694case "$gfpth" in
3695'') gfpth='.' ;;
3696esac
3697
3698case "$fn" in
3699*\(*)
3700	: getfile will accept an answer from the comma-separated list
3701	: enclosed in parentheses even if it does not meet other criteria.
3702	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3703	fn=`echo $fn | sed 's/(.*)//'`
3704	;;
3705esac
3706
3707case "$fn" in
3708*:*)
3709	loc_file=`expr $fn : '.*:\(.*\)'`
3710	fn=`expr $fn : '\(.*\):.*'`
3711	;;
3712esac
3713
3714case "$fn" in
3715*~*) tilde=true;;
3716esac
3717case "$fn" in
3718*/*) fullpath=true;;
3719esac
3720case "$fn" in
3721*+*) skip=true;;
3722esac
3723case "$fn" in
3724*n*) none_ok=true;;
3725esac
3726case "$fn" in
3727*e*) exp_file=true;;
3728esac
3729case "$fn" in
3730*p*) nopath_ok=true;;
3731esac
3732
3733case "$fn" in
3734*f*) type='File';;
3735*d*) type='Directory';;
3736*l*) type='Locate';;
3737esac
3738
3739what="$type"
3740case "$what" in
3741Locate) what='File';;
3742esac
3743
3744case "$exp_file" in
3745'')
3746	case "$d_portable" in
3747	"$define") ;;
3748	*) exp_file=true;;
3749	esac
3750	;;
3751esac
3752
3753cd ..
3754while test "$type"; do
3755	redo=''
3756	rp="$orig_rp"
3757	dflt="$orig_dflt"
3758	case "$tilde" in
3759	true) rp="$rp (~name ok)";;
3760	esac
3761	. UU/myread
3762	if test -f UU/getfile.ok && \
3763		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3764	then
3765		value="$ans"
3766		ansexp="$ans"
3767		break
3768	fi
3769	case "$ans" in
3770	none)
3771		value=''
3772		ansexp=''
3773		case "$none_ok" in
3774		true) type='';;
3775		esac
3776		;;
3777	*)
3778		case "$tilde" in
3779		'') value="$ans"
3780			ansexp="$ans";;
3781		*)
3782			value=`UU/filexp $ans`
3783			case $? in
3784			0)
3785				if test "$ans" != "$value"; then
3786					echo "(That expands to $value on this system.)"
3787				fi
3788				;;
3789			*) value="$ans";;
3790			esac
3791			ansexp="$value"
3792			case "$exp_file" in
3793			'') value="$ans";;
3794			esac
3795			;;
3796		esac
3797		case "$fullpath" in
3798		true)
3799			case "$ansexp" in
3800			/*) value="$ansexp" ;;
3801			[a-zA-Z]:/*) value="$ansexp" ;;
3802			*)
3803				redo=true
3804				case "$already" in
3805				true)
3806				echo "I shall only accept a full path name, as in /bin/ls." >&4
3807				echo "Use a ! shell escape if you wish to check pathnames." >&4
3808					;;
3809				*)
3810				echo "Please give a full path name, starting with slash." >&4
3811					case "$tilde" in
3812					true)
3813				echo "Note that using ~name is ok provided it expands well." >&4
3814						already=true
3815						;;
3816					esac
3817				esac
3818				;;
3819			esac
3820			;;
3821		esac
3822		case "$redo" in
3823		'')
3824			case "$type" in
3825			File)
3826				for fp in $gfpth; do
3827					if test "X$fp" = X.; then
3828					    pf="$ansexp"
3829					else
3830					    pf="$fp/$ansexp"
3831					fi
3832					if test -f "$pf"; then
3833						type=''
3834					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3835					then
3836						echo "($value is not a plain file, but that's ok.)"
3837						type=''
3838					fi
3839					if test X"$type" = X; then
3840					    value="$pf"
3841					    break
3842					fi
3843				done
3844				;;
3845			Directory)
3846				for fp in $gfpth; do
3847					if test "X$fp" = X.; then
3848					    dir="$ans"
3849					    direxp="$ansexp"
3850					else
3851					    dir="$fp/$ansexp"
3852					    direxp="$fp/$ansexp"
3853					fi
3854					if test -d "$direxp"; then
3855						type=''
3856						value="$dir"
3857						break
3858					fi
3859				done
3860				;;
3861			Locate)
3862				if test -d "$ansexp"; then
3863					echo "(Looking for $loc_file in directory $value.)"
3864					value="$value/$loc_file"
3865					ansexp="$ansexp/$loc_file"
3866				fi
3867				if test -f "$ansexp"; then
3868					type=''
3869				fi
3870				case "$nopath_ok" in
3871				true)	case "$value" in
3872					*/*) ;;
3873					*)	echo "Assuming $value will be in people's path."
3874						type=''
3875						;;
3876					esac
3877					;;
3878				esac
3879				;;
3880			esac
3881
3882			case "$skip" in
3883			true) type='';
3884			esac
3885
3886			case "$type" in
3887			'') ;;
3888			*)
3889				if test "$fastread" = yes; then
3890					dflt=y
3891				else
3892					dflt=n
3893				fi
3894				rp="$what $value doesn't exist.  Use that name anyway?"
3895				. UU/myread
3896				dflt=''
3897				case "$ans" in
3898				y*) type='';;
3899				*) echo " ";;
3900				esac
3901				;;
3902			esac
3903			;;
3904		esac
3905		;;
3906	esac
3907done
3908cd UU
3909ans="$value"
3910rp="$orig_rp"
3911dflt="$orig_dflt"
3912rm -f getfile.ok
3913test "X$gfpthkeep" != Xy && gfpth=""
3914EOSC
3915
3916: determine root of directory hierarchy where package will be installed.
3917case "$prefix" in
3918'')
3919	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3920	;;
3921*?/)
3922	dflt=`echo "$prefix" | sed 's/.$//'`
3923	;;
3924*)
3925	dflt="$prefix"
3926	;;
3927esac
3928$cat <<EOM
3929
3930By default, $package will be installed in $dflt/bin, manual pages
3931under $dflt/man, etc..., i.e. with $dflt as prefix for all
3932installation directories. Typically this is something like /usr/local.
3933If you wish to have binaries under /usr/bin but other parts of the
3934installation under /usr/local, that's ok: you will be prompted
3935separately for each of the installation directories, the prefix being
3936only used to set the defaults.
3937
3938EOM
3939fn=d~
3940rp='Installation prefix to use?'
3941. ./getfile
3942oldprefix=''
3943case "$prefix" in
3944'') ;;
3945*)
3946	case "$ans" in
3947	"$prefix") ;;
3948	*) oldprefix="$prefix";;
3949	esac
3950	;;
3951esac
3952prefix="$ans"
3953prefixexp="$ansexp"
3954
3955: allow them to override the AFS root
3956case "$afsroot" in
3957'')	afsroot=/afs ;;
3958*)	afsroot=$afsroot ;;
3959esac
3960
3961: is AFS running?
3962echo " "
3963case "$afs" in
3964$define|true)	afs=true ;;
3965$undef|false)	afs=false ;;
3966*)	if $test -d $afsroot; then
3967		afs=true
3968	else
3969		afs=false
3970	fi
3971	;;
3972esac
3973if $afs; then
3974	echo "AFS may be running... I'll be extra cautious then..." >&4
3975else
3976	echo "AFS does not seem to be running..." >&4
3977fi
3978
3979: determine installation prefix for where package is to be installed.
3980if $afs; then
3981$cat <<EOM
3982
3983Since you are running AFS, I need to distinguish the directory in which
3984files will reside from the directory in which they are installed (and from
3985which they are presumably copied to the former directory by occult means).
3986
3987EOM
3988	case "$installprefix" in
3989	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3990	*) dflt="$installprefix";;
3991	esac
3992else
3993$cat <<EOM
3994
3995In some special cases, particularly when building $package for distribution,
3996it is convenient to distinguish the directory in which files should be
3997installed from the directory ($prefix) in which they will
3998eventually reside.  For most users, these two directories are the same.
3999
4000EOM
4001	case "$installprefix" in
4002	'') dflt=$prefix ;;
4003	*) dflt=$installprefix;;
4004	esac
4005fi
4006fn=d~
4007rp='What installation prefix should I use for installing files?'
4008. ./getfile
4009installprefix="$ans"
4010installprefixexp="$ansexp"
4011
4012: Perform the prefixexp/installprefixexp correction if necessary
4013cat <<EOS >installprefix
4014$startsh
4015EOS
4016cat <<'EOSC' >>installprefix
4017: Change installation prefix, if necessary.
4018if $test X"$prefix" != X"$installprefix"; then
4019    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4020else
4021    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4022fi
4023EOSC
4024chmod +x installprefix
4025$eunicefix installprefix
4026
4027: Set variables such as privlib and privlibexp from the output of ./getfile
4028: performing the prefixexp/installprefixexp correction if necessary.
4029cat <<EOS >setprefixvar
4030$startsh
4031EOS
4032cat <<'EOSC' >>setprefixvar
4033eval "${prefixvar}=\"\$ans\""
4034eval "${prefixvar}exp=\"\$ansexp\""
4035. ./installprefix
4036EOSC
4037chmod +x setprefixvar
4038$eunicefix setprefixvar
4039
4040: set up the script used to warn in case of inconsistency
4041cat <<EOS >whoa
4042$startsh
4043EOS
4044cat <<'EOSC' >>whoa
4045dflt=y
4046case "$hint" in
4047    recommended)
4048	case "$hintfile" in
4049	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4050		;;
4051	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4052		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4053		;;
4054	esac
4055	;;
4056    *)	echo " "
4057	echo "*** WHOA THERE!!! ***" >&4
4058	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4059	;;
4060esac
4061rp="    Keep the $hint value?"
4062. ./myread
4063case "$ans" in
4064y) td=$was; tu=$was;;
4065esac
4066EOSC
4067
4068: function used to set '$1' to '$val'
4069setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4070case "$val$was" in
4071$define$undef) . ./whoa; eval "$var=\$td";;
4072$undef$define) . ./whoa; eval "$var=\$tu";;
4073*) eval "$var=$val";;
4074esac'
4075
4076: get the patchlevel
4077echo " "
4078echo "Getting the current patchlevel..." >&4
4079if $test -r $rsrc/patchlevel.h;then
4080	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4081	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4082	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4083	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4084	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4085	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4086	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4087else
4088	revision=0
4089	patchlevel=0
4090	subversion=0
4091	api_revision=0
4092	api_version=0
4093	api_subversion=0
4094	perl_patchlevel=0
4095	$echo "(You do not have patchlevel.h.  Eek.)"
4096fi
4097: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4098version_patchlevel_string="version $patchlevel subversion $subversion"
4099case "$perl_patchlevel" in
41000|'') ;;
4101*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4102    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4103    ;;
4104esac
4105
4106$echo "(You have $package $version_patchlevel_string.)"
4107
4108case "$osname" in
4109dos|vms)
4110	: XXX Should be a Configure test for double-dots in filenames.
4111	version=`echo $revision $patchlevel $subversion | \
4112		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4113	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4114		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4115	;;
4116*)
4117	version=`echo $revision $patchlevel $subversion | \
4118		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4119	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4120		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4121	;;
4122esac
4123: Special case the 5.005_xx maintenance series, which used 5.005
4124: without any subversion label as a subdirectory in $sitelib
4125if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4126	api_versionstring='5.005'
4127fi
4128
4129: Do we want threads support and if so, what type
4130case "$usethreads" in
4131$define|true|[yY]*)     dflt='y';;
4132*)     # Catch case where user specified ithreads or 5005threads but
4133       # forgot -Dusethreads (A.D. 4/2002)
4134       case "$useithreads$use5005threads" in
4135       *$define*)	dflt='y';;
4136       *)		dflt='n';;
4137       esac
4138       ;;
4139esac
4140cat <<EOM
4141
4142Perl can be built to take advantage of threads on some systems.
4143To do so, Configure can be run with -Dusethreads.
4144
4145Note that Perl built with threading support runs slightly slower
4146and uses more memory than plain Perl. The current implementation
4147is believed to be stable, but it is fairly new, and so should be
4148treated with caution.
4149
4150If this doesn't make any sense to you, just accept the default '$dflt'.
4151EOM
4152rp='Build a threading Perl?'
4153. ./myread
4154case "$ans" in
4155y|Y)    val="$define" ;;
4156*)      val="$undef" ;;
4157esac
4158set usethreads
4159eval $setvar
4160
4161if $test $patchlevel -lt 9; then
4162    case "$usethreads" in
4163    $define)
4164	$cat <<EOM
4165
4166Since release 5.6, Perl has had two different threading implementations,
4167the newer interpreter-based version (ithreads) with one interpreter per
4168thread, and the older 5.005 version (5005threads).
4169The 5005threads version is effectively unmaintained and will probably be
4170removed in Perl 5.10, so there should be no need to build a Perl using it
4171unless needed for backwards compatibility with some existing 5.005threads
4172code.
4173
4174EOM
4175	: Default to ithreads unless overridden on command line or with
4176	: old config.sh
4177	dflt='y'
4178	case "$use5005threads" in
4179		$define|true|[yY]*) dflt='n';;
4180	esac
4181	case "$useithreads" in
4182		$undef|false|[nN]*) dflt='n';;
4183	esac
4184	rp='Use the newer interpreter-based ithreads?'
4185	. ./myread
4186	case "$ans" in
4187	y|Y)    val="$define" ;;
4188	*)      val="$undef" ;;
4189	esac
4190	set useithreads
4191	eval $setvar
4192	: Now set use5005threads to the opposite value.
4193	case "$useithreads" in
4194	$define) val="$undef" ;;
4195	*) val="$define" ;;
4196	esac
4197	set use5005threads
4198	eval $setvar
4199	;;
4200    *)
4201	useithreads="$undef"
4202	use5005threads="$undef"
4203	;;
4204    esac
4205
4206    case "$useithreads$use5005threads" in
4207    "$define$define")
4208	$cat >&4 <<EOM
4209
4210You cannot have both the ithreads and the 5.005 threads enabled
4211at the same time.  Disabling the 5.005 threads since they are
4212much less stable than the ithreads.
4213
4214EOM
4215	use5005threads="$undef"
4216	;;
4217    esac
4218
4219else
4220: perl-5.9.x and later
4221
4222    if test X"$usethreads" = "X$define"; then
4223	case "$use5005threads" in
4224	    $define|true|[yY]*)
4225		$cat >&4 <<EOM
4226
42275.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4228
4229EOM
4230	    ;;
4231	esac
4232    fi
4233
4234    use5005threads="$undef"
4235    useithreads="$usethreads"
4236fi
4237
4238case "$d_oldpthreads" in
4239'')	: Configure tests would be welcome here.  For now, assume undef.
4240	val="$undef" ;;
4241*)	val="$d_oldpthreads" ;;
4242esac
4243set d_oldpthreads
4244eval $setvar
4245
4246
4247: Look for a hint-file generated 'call-back-unit'.  If the
4248: user has specified that a threading perl is to be built,
4249: we may need to set or change some other defaults.
4250if $test -f usethreads.cbu; then
4251    echo "Your platform has some specific hints regarding threaded builds, using them..."
4252    . ./usethreads.cbu
4253else
4254    case "$usethreads" in
4255	"$define"|true|[yY]*)
4256		$cat <<EOM
4257(Your platform does not have any specific hints for threaded builds.
4258 Assuming POSIX threads, then.)
4259EOM
4260	;;
4261    esac
4262fi
4263
4264: Check if multiplicity is required
4265cat <<EOM
4266
4267Perl can be built so that multiple Perl interpreters can coexist
4268within the same Perl executable.
4269EOM
4270
4271case "$useithreads" in
4272$define)
4273	cat <<EOM
4274This multiple interpreter support is required for interpreter-based threads.
4275EOM
4276	val="$define"
4277	;;
4278*)	case "$usemultiplicity" in
4279	$define|true|[yY]*)	dflt='y';;
4280	*) dflt='n';;
4281	esac
4282	echo " "
4283	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4284	rp='Build Perl for multiplicity?'
4285	. ./myread
4286	case "$ans" in
4287	y|Y)	val="$define" ;;
4288	*)      val="$undef" ;;
4289	esac
4290	;;
4291esac
4292set usemultiplicity
4293eval $setvar
4294
4295: Check if morebits is requested
4296case "$usemorebits" in
4297"$define"|true|[yY]*)
4298	use64bitint="$define"
4299	uselongdouble="$define"
4300	usemorebits="$define"
4301	;;
4302*)	usemorebits="$undef"
4303	;;
4304esac
4305
4306: Determine the C compiler to be used
4307echo " "
4308case "$cc" in
4309'') dflt=cc;;
4310*) dflt="$cc";;
4311esac
4312rp="Use which C compiler?"
4313. ./myread
4314cc="$ans"
4315
4316: See whether they have no cc but they do have gcc
4317. ./trygcc
4318if $test -f cc.cbu; then
4319    . ./cc.cbu
4320fi
4321. ./checkcc
4322
4323: make some quick guesses about what we are up against
4324echo " "
4325$echo $n "Hmm...  $c"
4326echo exit 1 >bsd
4327echo exit 1 >usg
4328echo exit 1 >v7
4329echo exit 1 >osf1
4330echo exit 1 >eunice
4331echo exit 1 >xenix
4332echo exit 1 >venix
4333echo exit 1 >os2
4334d_bsd="$undef"
4335$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4336if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4337then
4338	echo "Looks kind of like an OSF/1 system, but we'll see..."
4339	echo exit 0 >osf1
4340elif test `echo abc | $tr a-z A-Z` = Abc ; then
4341	xxx=`./loc addbib blurfl $pth`
4342	if $test -f $xxx; then
4343	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4344		echo exit 0 >bsd
4345		echo exit 0 >usg
4346	else
4347		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4348			echo "Looks kind of like an extended USG system, but we'll see..."
4349		else
4350			echo "Looks kind of like a USG system, but we'll see..."
4351		fi
4352		echo exit 0 >usg
4353	fi
4354elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4355	echo "Looks kind of like a BSD system, but we'll see..."
4356	d_bsd="$define"
4357	echo exit 0 >bsd
4358else
4359	echo "Looks kind of like a Version 7 system, but we'll see..."
4360	echo exit 0 >v7
4361fi
4362case "$eunicefix" in
4363*unixtovms*)
4364	$cat <<'EOI'
4365There is, however, a strange, musty smell in the air that reminds me of
4366something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4367EOI
4368	echo exit 0 >eunice
4369	d_eunice="$define"
4370: it so happens the Eunice I know will not run shell scripts in Unix format
4371	;;
4372*)
4373	echo " "
4374	echo "Congratulations.  You aren't running Eunice."
4375	d_eunice="$undef"
4376	;;
4377esac
4378: Detect OS2.  The p_ variable is set above in the Head.U unit.
4379: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4380: semicolon as a patch separator
4381case "$p_" in
4382:) ;;
4383*)
4384	$cat <<'EOI'
4385I have the feeling something is not exactly right, however...don't tell me...
4386lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4387(Or you may be running DOS with DJGPP.)
4388EOI
4389	echo exit 0 >os2
4390	;;
4391esac
4392if test -f /xenix; then
4393	echo "Actually, this looks more like a XENIX system..."
4394	echo exit 0 >xenix
4395	d_xenix="$define"
4396else
4397	echo " "
4398	echo "It's not Xenix..."
4399	d_xenix="$undef"
4400fi
4401chmod +x xenix
4402$eunicefix xenix
4403if test -f /venix; then
4404	echo "Actually, this looks more like a VENIX system..."
4405	echo exit 0 >venix
4406else
4407	echo " "
4408	if ./xenix; then
4409		: null
4410	else
4411		echo "Nor is it Venix..."
4412	fi
4413fi
4414chmod +x bsd usg v7 osf1 eunice xenix venix os2
4415$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4416$rm -f foo
4417
4418: Check if we are using GNU gcc and what its version is
4419echo " "
4420echo "Checking for GNU cc in disguise and/or its version number..." >&4
4421$cat >try.c <<EOM
4422#include <stdio.h>
4423int main() {
4424#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4425#ifdef __VERSION__
4426	printf("%s\n", __VERSION__);
4427#else
4428	printf("%s\n", "1");
4429#endif
4430#endif
4431	return(0);
4432}
4433EOM
4434if $cc -o try $ccflags $ldflags try.c; then
4435	gccversion=`$run ./try`
4436	case "$gccversion" in
4437	'') echo "You are not using GNU cc." ;;
4438	*)  echo "You are using GNU cc $gccversion."
4439	    ccname=gcc
4440	    ;;
4441	esac
4442else
4443	echo " "
4444	echo "*** WHOA THERE!!! ***" >&4
4445	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4446	case "$knowitall" in
4447	'')
4448	echo "    You'd better start hunting for one and let me know about it." >&4
4449		exit 1
4450		;;
4451	esac
4452fi
4453$rm -f try try.*
4454case "$gccversion" in
44551*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4456esac
4457case "$gccversion" in
4458'') gccosandvers='' ;;
4459*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4460   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4461   gccshortvers=''
4462   case "$gccosandvers" in
4463   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4464   $osname$osvers) ;; # looking good
4465   $osname*) cat <<EOM >&4
4466
4467*** WHOA THERE!!! ***
4468
4469    Your gcc has not been compiled for the exact release of
4470    your operating system ($gccosandvers versus $osname$osvers).
4471
4472    In general it is a good idea to keep gcc synchronized with
4473    the operating system because otherwise serious problems
4474    may ensue when trying to compile software, like Perl.
4475
4476    I'm trying to be optimistic here, though, and will continue.
4477    If later during the configuration and build icky compilation
4478    problems appear (headerfile conflicts being the most common
4479    manifestation), I suggest reinstalling the gcc to match
4480    your operating system release.
4481
4482EOM
4483      ;;
4484   *) gccosandvers='' ;; # failed to parse, better be silent
4485   esac
4486   ;;
4487esac
4488case "$ccname" in
4489'') ccname="$cc" ;;
4490esac
4491
4492# gcc 3.* complain about adding -Idirectories that they already know about,
4493# so we will take those off from locincpth.
4494case "$gccversion" in
44953*)
4496    echo "main(){}">try.c
4497    for incdir in $locincpth; do
4498       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4499	     grep '^c[cp]p*[01]: warning: changing search order '`
4500       if test "X$warn" != X; then
4501	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4502       fi
4503    done
4504    $rm -f try try.*
4505esac
4506
4507: What should the include directory be ?
4508echo " "
4509$echo $n "Hmm...  $c"
4510dflt='/usr/include'
4511incpath=''
4512mips_type=''
4513if $test -f /bin/mips && /bin/mips; then
4514	echo "Looks like a MIPS system..."
4515	$cat >usr.c <<'EOCP'
4516#ifdef SYSTYPE_BSD43
4517/bsd43
4518#endif
4519EOCP
4520	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4521		dflt='/bsd43/usr/include'
4522		incpath='/bsd43'
4523		mips_type='BSD 4.3'
4524	else
4525		mips_type='System V'
4526	fi
4527	$rm -f usr.c usr.out
4528	echo "and you're compiling with the $mips_type compiler and libraries."
4529	xxx_prompt=y
4530	echo "exit 0" >mips
4531else
4532	echo "Doesn't look like a MIPS system."
4533	xxx_prompt=n
4534	echo "exit 1" >mips
4535fi
4536chmod +x mips
4537$eunicefix mips
4538case "$usrinc" in
4539'') ;;
4540*) dflt="$usrinc";;
4541esac
4542case "$xxx_prompt" in
4543y)	fn=d/
4544	echo " "
4545	rp='Where are the include files you want to use?'
4546	. ./getfile
4547	usrinc="$ans"
4548	;;
4549*)	usrinc="$dflt"
4550	;;
4551esac
4552
4553: see how we invoke the C preprocessor
4554echo " "
4555echo "Now, how can we feed standard input to your C preprocessor..." >&4
4556cat <<'EOT' >testcpp.c
4557#define ABC abc
4558#define XYZ xyz
4559ABC.XYZ
4560EOT
4561cd ..
4562if test ! -f cppstdin; then
4563	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4564		# AIX cc -E doesn't show the absolute headerfile
4565		# locations but we'll cheat by using the -M flag.
4566		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
4567	else
4568		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4569	fi
4570else
4571	echo "Keeping your $hint cppstdin wrapper."
4572fi
4573chmod 755 cppstdin
4574wrapper=`pwd`/cppstdin
4575ok='false'
4576cd UU
4577
4578if $test "X$cppstdin" != "X" && \
4579	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4580	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4581then
4582	echo "You used to use $cppstdin $cppminus so we'll use that again."
4583	case "$cpprun" in
4584	'') echo "But let's see if we can live without a wrapper..." ;;
4585	*)
4586		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4587			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4588		then
4589			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4590			ok='true'
4591		else
4592			echo "(However, $cpprun $cpplast does not work, let's see...)"
4593		fi
4594		;;
4595	esac
4596else
4597	case "$cppstdin" in
4598	'') ;;
4599	*)
4600		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4601		;;
4602	esac
4603fi
4604
4605if $ok; then
4606	: nothing
4607elif echo 'Maybe "'"$cc"' -E" will work...'; \
4608	$cc -E <testcpp.c >testcpp.out 2>&1; \
4609	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4610	echo "Yup, it does."
4611	x_cpp="$cc -E"
4612	x_minus='';
4613elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4614	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4615	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4616	echo "Yup, it does."
4617	x_cpp="$cc -E"
4618	x_minus='-';
4619elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4620	$cc -P <testcpp.c >testcpp.out 2>&1; \
4621	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4622	echo "Yipee, that works!"
4623	x_cpp="$cc -P"
4624	x_minus='';
4625elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4626	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4627	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4628	echo "At long last!"
4629	x_cpp="$cc -P"
4630	x_minus='-';
4631elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4632	$cpp <testcpp.c >testcpp.out 2>&1; \
4633	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4634	echo "It works!"
4635	x_cpp="$cpp"
4636	x_minus='';
4637elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4638	$cpp - <testcpp.c >testcpp.out 2>&1; \
4639	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4640	echo "Hooray, it works!  I was beginning to wonder."
4641	x_cpp="$cpp"
4642	x_minus='-';
4643elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4644	$wrapper <testcpp.c >testcpp.out 2>&1; \
4645	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646	x_cpp="$wrapper"
4647	x_minus=''
4648	echo "Eureka!"
4649else
4650	dflt=''
4651	rp="No dice.  I can't find a C preprocessor.  Name one:"
4652	. ./myread
4653	x_cpp="$ans"
4654	x_minus=''
4655	$x_cpp <testcpp.c >testcpp.out 2>&1
4656	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4657		echo "OK, that will do." >&4
4658	else
4659echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4660		exit 1
4661	fi
4662fi
4663
4664case "$ok" in
4665false)
4666	cppstdin="$x_cpp"
4667	cppminus="$x_minus"
4668	cpprun="$x_cpp"
4669	cpplast="$x_minus"
4670	set X $x_cpp
4671	shift
4672	case "$1" in
4673	"$cpp")
4674		echo "Perhaps can we force $cc -E using a wrapper..."
4675		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4676			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4677		then
4678			echo "Yup, we can."
4679			cppstdin="$wrapper"
4680			cppminus='';
4681		else
4682			echo "Nope, we'll have to live without it..."
4683		fi
4684		;;
4685	esac
4686	case "$cpprun" in
4687	"$wrapper")
4688		cpprun=''
4689		cpplast=''
4690		;;
4691	esac
4692	;;
4693esac
4694
4695case "$cppstdin" in
4696"$wrapper"|'cppstdin') ;;
4697*) $rm -f $wrapper;;
4698esac
4699$rm -f testcpp.c testcpp.out
4700
4701: Set private lib path
4702case "$plibpth" in
4703'') if ./mips; then
4704		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4705	fi;;
4706esac
4707case "$libpth" in
4708' ') dlist='';;
4709'') dlist="$loclibpth $plibpth $glibpth";;
4710*) dlist="$libpth";;
4711esac
4712
4713: Now check and see which directories actually exist, avoiding duplicates
4714libpth=''
4715for xxx in $dlist
4716do
4717    if $test -d $xxx; then
4718		case " $libpth " in
4719		*" $xxx "*) ;;
4720		*) libpth="$libpth $xxx";;
4721		esac
4722    fi
4723done
4724$cat <<'EOM'
4725
4726Some systems have incompatible or broken versions of libraries.  Among
4727the directories listed in the question below, please remove any you
4728know not to be holding relevant libraries, and add any that are needed.
4729Say "none" for none.
4730
4731EOM
4732case "$libpth" in
4733'') dflt='none';;
4734*)
4735	set X $libpth
4736	shift
4737	dflt=${1+"$@"}
4738	;;
4739esac
4740rp="Directories to use for library searches?"
4741. ./myread
4742case "$ans" in
4743none) libpth=' ';;
4744*) libpth="$ans";;
4745esac
4746
4747: compute shared library extension
4748case "$so" in
4749'')
4750	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4751		dflt='sl'
4752	else
4753		dflt='so'
4754	fi
4755	;;
4756*) dflt="$so";;
4757esac
4758$cat <<EOM
4759
4760On some systems, shared libraries may be available.  Answer 'none' if
4761you want to suppress searching of shared libraries for the remainder
4762of this configuration.
4763
4764EOM
4765rp='What is the file extension used for shared libraries?'
4766. ./myread
4767so="$ans"
4768
4769: Define several unixisms.
4770: Hints files or command line option can be used to override them.
4771: The convoluted testing is in case hints files set either the old
4772: or the new name.
4773case "$_exe" in
4774'')	case "$exe_ext" in
4775	'')	;;
4776	*)	_exe="$exe_ext" ;;
4777	esac
4778	;;
4779esac
4780case "$_a" in
4781'')	case "$lib_ext" in
4782    '')	_a='.a';;
4783	*)	_a="$lib_ext" ;;
4784	esac
4785	;;
4786esac
4787case "$_o" in
4788'') case "$obj_ext" in
4789	'')	_o='.o';;
4790	*)	_o="$obj_ext";;
4791	esac
4792	;;
4793esac
4794case "$p_" in
4795'') case "$path_sep" in
4796	'')	p_=':';;
4797	*)	p_="$path_sep";;
4798	esac
4799	;;
4800esac
4801exe_ext=$_exe
4802lib_ext=$_a
4803obj_ext=$_o
4804path_sep=$p_
4805
4806rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4807
4808: Which makefile gets called first.  This is used by make depend.
4809case "$firstmakefile" in
4810'') firstmakefile='makefile';;
4811esac
4812
4813: Check is we will use socks
4814case "$usesocks" in
4815$define|true|[yY]*)	dflt='y';;
4816*) dflt='n';;
4817esac
4818cat <<EOM
4819
4820Perl can be built to use the SOCKS proxy protocol library.  To do so,
4821Configure must be run with -Dusesocks.  If you use SOCKS you also need
4822to use the PerlIO abstraction layer, this will be implicitly selected.
4823
4824If this doesn't make any sense to you, just accept the default '$dflt'.
4825EOM
4826rp='Build Perl for SOCKS?'
4827. ./myread
4828case "$ans" in
4829y|Y)	val="$define" ;;
4830*)      val="$undef" ;;
4831esac
4832set usesocks
4833eval $setvar
4834
4835: Check for uselongdouble support
4836case "$ccflags" in
4837*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4838esac
4839
4840case "$uselongdouble" in
4841$define|true|[yY]*)	dflt='y';;
4842*) dflt='n';;
4843esac
4844cat <<EOM
4845
4846Perl can be built to take advantage of long doubles which
4847(if available) may give more accuracy and range for floating point numbers.
4848
4849If this doesn't make any sense to you, just accept the default '$dflt'.
4850EOM
4851rp='Try to use long doubles if available?'
4852. ./myread
4853case "$ans" in
4854y|Y) 	val="$define"	;;
4855*)      val="$undef"	;;
4856esac
4857set uselongdouble
4858eval $setvar
4859
4860case "$uselongdouble" in
4861true|[yY]*) uselongdouble="$define" ;;
4862esac
4863
4864: Look for a hint-file generated 'call-back-unit'.  If the
4865: user has specified that long doubles should be used,
4866: we may need to set or change some other defaults.
4867if $test -f uselongdouble.cbu; then
4868    echo "Your platform has some specific hints regarding long doubles, using them..."
4869    . ./uselongdouble.cbu
4870else
4871    case "$uselongdouble" in
4872	$define)
4873		$cat <<EOM
4874(Your platform does not have any specific hints for long doubles.)
4875EOM
4876	;;
4877    esac
4878fi
4879
4880: Looking for optional libraries
4881echo " "
4882echo "Checking for optional libraries..." >&4
4883case "$libs" in
4884' '|'') dflt='';;
4885*) dflt="$libs";;
4886esac
4887case "$libswanted" in
4888'') libswanted='c_s';;
4889esac
4890case "$usesocks" in
4891"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4892esac
4893libsfound=''
4894libsfiles=''
4895libsdirs=''
4896libspath=''
4897for thisdir in $libpth $xlibpth; do
4898  test -d $thisdir && libspath="$libspath $thisdir"
4899done
4900for thislib in $libswanted; do
4901	for thisdir in $libspath; do
4902	    xxx=''
4903	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4904		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4905	        $test -f "$xxx" && eval $libscheck
4906		$test -f "$xxx" && libstyle=shared
4907	    fi
4908	    if test ! -f "$xxx"; then
4909		xxx=$thisdir/lib$thislib.$so
4910	        $test -f "$xxx" && eval $libscheck
4911		$test -f "$xxx" && libstyle=shared
4912	    fi
4913	    if test ! -f "$xxx"; then
4914		xxx=$thisdir/lib$thislib$_a
4915	        $test -f "$xxx" && eval $libscheck
4916		$test -f "$xxx" && libstyle=static
4917	    fi
4918	    if test ! -f "$xxx"; then
4919		xxx=$thisdir/$thislib$_a
4920	        $test -f "$xxx" && eval $libscheck
4921		$test -f "$xxx" && libstyle=static
4922	    fi
4923	    if test ! -f "$xxx"; then
4924		xxx=$thisdir/lib${thislib}_s$_a
4925	        $test -f "$xxx" && eval $libscheck
4926		$test -f "$xxx" && libstyle=static
4927		$test -f "$xxx" && thislib=${thislib}_s
4928	    fi
4929	    if test ! -f "$xxx"; then
4930		xxx=$thisdir/Slib$thislib$_a
4931	        $test -f "$xxx" && eval $libscheck
4932		$test -f "$xxx" && libstyle=static
4933	    fi
4934	    if $test -f "$xxx"; then
4935		case "$libstyle" in
4936		shared) echo "Found -l$thislib (shared)." ;;
4937		static) echo "Found -l$thislib." ;;
4938		*)      echo "Found -l$thislib ($libstyle)." ;;
4939		esac
4940		case " $dflt " in
4941		*"-l$thislib "*);;
4942		*) dflt="$dflt -l$thislib"
4943                   libsfound="$libsfound $xxx"
4944                   yyy=`basename $xxx`
4945                   libsfiles="$libsfiles $yyy"
4946                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4947                   case " $libsdirs " in
4948                   *" $yyy "*) ;;
4949                   *) libsdirs="$libsdirs $yyy" ;;
4950                   esac
4951		   ;;
4952		esac
4953		break
4954	    fi
4955	done
4956	if $test ! -f "$xxx"; then
4957	    echo "No -l$thislib."
4958	fi
4959done
4960set X $dflt
4961shift
4962dflt="$*"
4963case "$libs" in
4964'') dflt="$dflt";;
4965*) dflt="$libs";;
4966esac
4967case "$dflt" in
4968' '|'') dflt='none';;
4969esac
4970
4971$cat <<EOM
4972
4973In order to compile $package on your machine, a number of libraries
4974are usually needed.  Include any other special libraries here as well.
4975Say "none" for none.  The default list is almost always right.
4976EOM
4977
4978echo " "
4979rp="What libraries to use?"
4980. ./myread
4981case "$ans" in
4982none) libs=' ';;
4983*) libs="$ans";;
4984esac
4985
4986: determine optimization, if desired, or use for debug flag also
4987case "$optimize" in
4988' '|$undef) dflt='none';;
4989'') dflt='-O';;
4990*) dflt="$optimize";;
4991esac
4992$cat <<EOH
4993
4994By default, $package compiles with the -O flag to use the optimizer.
4995Alternately, you might want to use the symbolic debugger, which uses
4996the -g flag (on traditional Unix systems).  Either flag can be
4997specified here.  To use neither flag, specify the word "none".
4998
4999EOH
5000rp="What optimizer/debugger flag should be used?"
5001. ./myread
5002optimize="$ans"
5003case "$optimize" in
5004'none') optimize=" ";;
5005esac
5006
5007: Check what DEBUGGING is required from the command line
5008: -DEBUGGING      or -DDEBUGGING or
5009: -DEBUGGING=both			= -g + -DDEBUGGING
5010: -DEBUGGING=-g   or -Doptimize=-g	= -g
5011: -DEBUGGING=none or -UDEBUGGING	=
5012: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5013case "$EBUGGING" in
5014'')	;;
5015*)	DEBUGGING=$EBUGGING ;;
5016esac
5017
5018case "$DEBUGGING" in
5019-g|both|$define)
5020    case "$optimize" in
5021	*-g*) ;;
5022	*)    optimize="$optimize -g" ;;
5023    esac ;;
5024none|$undef)
5025    case "$optimize" in
5026	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5027		shift
5028		optimize="$*"
5029		;;
5030    esac ;;
5031esac
5032
5033dflt=''
5034case "$DEBUGGING" in
5035both|$define) dflt='-DDEBUGGING'
5036esac
5037
5038: argument order is deliberate, as the flag will start with - which set could
5039: think is an option
5040checkccflag='check=$1; flag=$2; callback=$3;
5041echo " ";
5042echo "Checking if your compiler accepts $flag" 2>&1;
5043echo "int main(void) { return 0; }" > gcctest.c;
5044if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5045    echo "Yes, it does." 2>&1;
5046    if $test -s gcctest.out ; then
5047        echo "But your platform does not like it:";
5048        cat gcctest.out;
5049    else
5050	case "$ccflags" in
5051	*$check*)
5052	    echo "Leaving current flags $ccflags alone." 2>&1
5053	    ;;
5054	*) dflt="$dflt $flag";
5055	    eval $callback
5056	    ;;
5057	esac
5058    fi
5059else
5060    echo "Nope, it does not, but that is ok." 2>&1;
5061fi
5062'
5063
5064: We will not override a previous value, but we might want to
5065: augment a hint file
5066case "$hint" in
5067default|recommended)
5068	case "$gccversion" in
5069	1*) dflt="$dflt -fpcc-struct-return" ;;
5070	esac
5071	case "$optimize:$DEBUGGING" in
5072	*-g*:old) dflt="$dflt -DDEBUGGING";;
5073	esac
5074	case "$gccversion" in
5075	2*) if $test -d /etc/conf/kconfig.d &&
5076			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5077		then
5078			# Interactive Systems (ISC) POSIX mode.
5079			dflt="$dflt -posix"
5080		fi
5081		;;
5082	esac
5083	case "$gccversion" in
5084	1*) ;;
5085	2.[0-8]*) ;;
5086	?*)	set strict-aliasing -fno-strict-aliasing
5087		eval $checkccflag
5088		;;
5089	esac
5090	case "$gccversion" in
5091	1*) ;;
5092	2*) ;;
5093	?*) 	echo " "
5094		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5095		echo 'int main(void) { return 0; }' > gcctest.c
5096		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5097			echo "Yes, it does." 2>&1
5098			case "$ccflags" in
5099			*delete-null-pointer-checks*)
5100				echo "Leaving current flags $ccflags alone." 2>&1
5101				;;
5102			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5103			esac
5104		else
5105			echo "Nope, it doesn't, but that's ok." 2>&1
5106		fi
5107		;;
5108	esac
5109	# For gcc, adding -pipe speeds up compilations for some, but apparently
5110	# some assemblers can't read from stdin.  (It also slows down compilations
5111	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5112	case "$gccversion" in
5113	?*)	set pipe -pipe
5114		eval $checkccflag
5115		;;
5116	esac
5117
5118	# on x86_64 (at least) we require an extra library (libssp) in the
5119	# link command line. This library is not named, so I infer that it is
5120	# an implementation detail that may change. Hence the safest approach
5121	# is to add the flag to the flags passed to the compiler at link time,
5122	# as that way the compiler can do the right implementation dependant
5123	# thing. (NWC)
5124	case "$gccversion" in
5125	?*)	set stack-protector -fstack-protector
5126		eval $checkccflag
5127		;;
5128	esac
5129	;;
5130esac
5131
5132case "$mips_type" in
5133*BSD*|'') inclwanted="$locincpth $usrinc";;
5134*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5135esac
5136for thisincl in $inclwanted; do
5137	if $test -d $thisincl; then
5138		if $test x$thisincl != x$usrinc; then
5139			case "$dflt" in
5140			*" -I$thisincl "*);;
5141			*) dflt="$dflt -I$thisincl ";;
5142			esac
5143		fi
5144	fi
5145done
5146
5147inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5148	xxx=true;
5149elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5150	xxx=true;
5151else
5152	xxx=false;
5153fi;
5154if $xxx; then
5155	case "$dflt" in
5156	*$2*);;
5157	*) dflt="$dflt -D$2";;
5158	esac;
5159fi'
5160
5161set signal.h LANGUAGE_C; eval $inctest
5162
5163case "$usesocks" in
5164$define)
5165	ccflags="$ccflags -DSOCKS"
5166	;;
5167esac
5168
5169case "$hint" in
5170default|recommended) dflt="$ccflags $dflt" ;;
5171*) dflt="$ccflags";;
5172esac
5173
5174case "$dflt" in
5175''|' ') dflt=none;;
5176esac
5177
5178$cat <<EOH
5179
5180Your C compiler may want other flags.  For this question you should include
5181-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5182but you should NOT include libraries or ld flags like -lwhatever.  If you
5183want $package to honor its debug switch, you should include -DDEBUGGING here.
5184Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5185
5186To use no flags, specify the word "none".
5187
5188EOH
5189set X $dflt
5190shift
5191dflt=${1+"$@"}
5192rp="Any additional cc flags?"
5193. ./myread
5194case "$ans" in
5195none) ccflags='';;
5196*) ccflags="$ans";;
5197esac
5198
5199: the following weeds options from ccflags that are of no interest to cpp
5200case "$cppflags" in
5201'') cppflags="$ccflags" ;;
5202*)  cppflags="$cppflags $ccflags" ;;
5203esac
5204case "$gccversion" in
52051*) cppflags="$cppflags -D__GNUC__"
5206esac
5207case "$mips_type" in
5208'');;
5209*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5210esac
5211case "$cppflags" in
5212'');;
5213*)
5214	echo " "
5215	echo "Let me guess what the preprocessor flags are..." >&4
5216	set X $cppflags
5217	shift
5218	cppflags=''
5219	$cat >cpp.c <<'EOM'
5220#define BLURFL foo
5221
5222BLURFL xx LFRULB
5223EOM
5224	previous=''
5225	for flag in $*
5226	do
5227		case "$flag" in
5228		-*) ftry="$flag";;
5229		*) ftry="$previous $flag";;
5230		esac
5231		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5232			>cpp1.out 2>/dev/null && \
5233			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5234			>cpp2.out 2>/dev/null && \
5235			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5236			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5237		then
5238			cppflags="$cppflags $ftry"
5239			previous=''
5240		else
5241			previous="$flag"
5242		fi
5243	done
5244	set X $cppflags
5245	shift
5246	cppflags=${1+"$@"}
5247	case "$cppflags" in
5248	*-*)  echo "They appear to be: $cppflags";;
5249	esac
5250	$rm -f cpp.c cpp?.out
5251	;;
5252esac
5253
5254: flags used in final linking phase
5255case "$ldflags" in
5256'') if ./venix; then
5257		dflt='-i -z'
5258	else
5259		dflt=''
5260	fi
5261	case "$ccflags" in
5262	*-posix*) dflt="$dflt -posix" ;;
5263	esac
5264	;;
5265*) dflt="$ldflags";;
5266esac
5267# See note above about -fstack-protector
5268case "$ccflags" in
5269*-fstack-protector*)
5270	case "$dflt" in
5271	*-fstack-protector*) ;; # Don't add it again
5272	*) dflt="$dflt -fstack-protector" ;;
5273	esac
5274	;;
5275esac
5276
5277: Try to guess additional flags to pick up local libraries.
5278for thislibdir in $libpth; do
5279	case " $loclibpth " in
5280	*" $thislibdir "*)
5281		case "$dflt " in
5282		*"-L$thislibdir "*) ;;
5283		*)  dflt="$dflt -L$thislibdir" ;;
5284		esac
5285		;;
5286	esac
5287done
5288
5289case "$dflt" in
5290'') dflt='none' ;;
5291esac
5292
5293$cat <<EOH
5294
5295Your C linker may need flags.  For this question you should
5296include -L/whatever and any other flags used by the C linker, but you
5297should NOT include libraries like -lwhatever.
5298
5299Make sure you include the appropriate -L/path flags if your C linker
5300does not normally search all of the directories you specified above,
5301namely
5302	$libpth
5303To use no flags, specify the word "none".
5304
5305EOH
5306
5307rp="Any additional ld flags (NOT including libraries)?"
5308. ./myread
5309case "$ans" in
5310none) ldflags='';;
5311*) ldflags="$ans";;
5312esac
5313rmlist="$rmlist pdp11"
5314
5315: coherency check
5316echo " "
5317echo "Checking your choice of C compiler and flags for coherency..." >&4
5318$cat > try.c <<'EOF'
5319#include <stdio.h>
5320int main() { printf("Ok\n"); return(0); }
5321EOF
5322set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5323shift
5324$cat >try.msg <<'EOM'
5325I've tried to compile and run the following simple program:
5326
5327EOM
5328$cat try.c >> try.msg
5329
5330$cat >> try.msg <<EOM
5331
5332I used the command:
5333
5334	$*
5335	$run ./try
5336
5337and I got the following output:
5338
5339EOM
5340dflt=y
5341if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5342	if $sh -c "$run ./try " >>try.msg 2>&1; then
5343		xxx=`$run ./try`
5344		case "$xxx" in
5345		"Ok") dflt=n ;;
5346		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
5347			case " $libs " in
5348			*" -lsfio "*)
5349				cat >> try.msg <<'EOQS'
5350If $libs contains -lsfio, and sfio is mis-configured, then it
5351sometimes (apparently) runs and exits with a 0 status, but with no
5352output!  It may have to do with sfio's use of _exit vs. exit.
5353
5354EOQS
5355				rp="You have a big problem.  Shall I abort Configure"
5356				dflt=y
5357				;;
5358			esac
5359			;;
5360		esac
5361	else
5362		echo "The program compiled OK, but exited with status $?." >>try.msg
5363		rp="You have a problem.  Shall I abort Configure"
5364		dflt=y
5365	fi
5366else
5367	echo "I can't compile the test program." >>try.msg
5368	rp="You have a BIG problem.  Shall I abort Configure"
5369	dflt=y
5370fi
5371case "$dflt" in
5372y)
5373	$cat try.msg >&4
5374	case "$knowitall" in
5375	'')
5376		echo "(The supplied flags or libraries might be incorrect.)"
5377		;;
5378	*) dflt=n;;
5379	esac
5380	echo " "
5381	. ./myread
5382	case "$ans" in
5383	n*|N*) ;;
5384	*)	echo "Ok.  Stopping Configure." >&4
5385		exit 1
5386		;;
5387	esac
5388	;;
5389n) echo "OK, that should do.";;
5390esac
5391$rm_try gcctest gcctest.out
5392
5393: define a shorthand compile call
5394compile='
5395mc_file=$1;
5396shift;
5397case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5398echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5399exit 1;
5400fi;
5401esac;
5402$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5403: define a shorthand compile call for compilations that should be ok.
5404compile_ok='
5405mc_file=$1;
5406shift;
5407$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5408
5409: determine filename position in cpp output
5410echo " "
5411echo "Computing filename position in cpp output for #include directives..." >&4
5412case "$osname" in
5413vos) testaccess=-e ;;
5414*)   testaccess=-r ;;
5415esac
5416echo '#include <stdio.h>' > foo.c
5417$cat >fieldn <<EOF
5418$startsh
5419$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5420$grep '^[ 	]*#.*stdio\.h' | \
5421while read cline; do
5422	pos=1
5423	set \$cline
5424	while $test \$# -gt 0; do
5425		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5426			echo "\$pos"
5427			exit 0
5428		fi
5429		shift
5430		pos=\`expr \$pos + 1\`
5431	done
5432done
5433EOF
5434chmod +x fieldn
5435fieldn=`./fieldn`
5436$rm -f foo.c fieldn
5437case $fieldn in
5438'') pos='???';;
54391) pos=first;;
54402) pos=second;;
54413) pos=third;;
5442*) pos="${fieldn}th";;
5443esac
5444echo "Your cpp writes the filename in the $pos field of the line."
5445
5446case "$osname" in
5447vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5448os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5449*)   cppfilter='' ;;
5450esac
5451: locate header file
5452$cat >findhdr <<EOF
5453$startsh
5454wanted=\$1
5455name=''
5456for usrincdir in $usrinc
5457do
5458	if test -f \$usrincdir/\$wanted; then
5459		echo "\$usrincdir/\$wanted"
5460		exit 0
5461	fi
5462done
5463awkprg='{ print \$$fieldn }'
5464echo "#include <\$wanted>" > foo\$\$.c
5465$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5466$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5467while read cline; do
5468	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5469	case "\$name" in
5470	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5471	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5472	*) exit 2;;
5473	esac;
5474done;
5475#
5476# status = 0: grep returned 0 lines, case statement not executed
5477# status = 1: headerfile found
5478# status = 2: while loop executed, no headerfile found
5479#
5480status=\$?
5481$rm -f foo\$\$.c;
5482if test \$status -eq 1; then
5483	exit 0;
5484fi
5485exit 1
5486EOF
5487chmod +x findhdr
5488
5489: define an alternate in-header-list? function
5490inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5491cont=true; xxf="echo \"<\$1> found.\" >&4";
5492case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5493*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5494esac;
5495case $# in 4) instead=instead;; *) instead="at last";; esac;
5496while $test "$cont"; do
5497	xxx=`./findhdr $1`
5498	var=$2; eval "was=\$$2";
5499	if $test "$xxx" && $test -r "$xxx";
5500	then eval $xxf;
5501	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5502		cont="";
5503	else eval $xxnf;
5504	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5505	set $yyy; shift; shift; yyy=$@;
5506	case $# in 0) cont="";;
5507	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5508		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5509	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5510		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5511	esac;
5512done;
5513while $test "$yyy";
5514do set $yyy; var=$2; eval "was=\$$2";
5515	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5516	set $yyy; shift; shift; yyy=$@;
5517done'
5518
5519: see if stdlib is available
5520set stdlib.h i_stdlib
5521eval $inhdr
5522
5523: check for lengths of integral types
5524echo " "
5525case "$intsize" in
5526'')
5527	echo "Checking to see how big your integers are..." >&4
5528	$cat >try.c <<EOCP
5529#include <stdio.h>
5530#$i_stdlib I_STDLIB
5531#ifdef I_STDLIB
5532#include <stdlib.h>
5533#endif
5534int main()
5535{
5536	printf("intsize=%d;\n", (int)sizeof(int));
5537	printf("longsize=%d;\n", (int)sizeof(long));
5538	printf("shortsize=%d;\n", (int)sizeof(short));
5539	exit(0);
5540}
5541EOCP
5542	set try
5543	if eval $compile_ok && $run ./try > /dev/null; then
5544		eval `$run ./try`
5545		echo "Your integers are $intsize bytes long."
5546		echo "Your long integers are $longsize bytes long."
5547		echo "Your short integers are $shortsize bytes long."
5548	else
5549		$cat >&4 <<EOM
5550!
5551Help! I can't compile and run the intsize test program: please enlighten me!
5552(This is probably a misconfiguration in your system or libraries, and
5553you really ought to fix it.  Still, I'll try anyway.)
5554!
5555EOM
5556		dflt=4
5557		rp="What is the size of an integer (in bytes)?"
5558		. ./myread
5559		intsize="$ans"
5560		dflt=$intsize
5561		rp="What is the size of a long integer (in bytes)?"
5562		. ./myread
5563		longsize="$ans"
5564		dflt=2
5565		rp="What is the size of a short integer (in bytes)?"
5566		. ./myread
5567		shortsize="$ans"
5568	fi
5569	;;
5570esac
5571$rm_try
5572
5573: check for long long
5574echo " "
5575echo "Checking to see if you have long long..." >&4
5576echo 'int main() { long long x = 7; return 0; }' > try.c
5577set try
5578if eval $compile; then
5579	val="$define"
5580	echo "You have long long."
5581else
5582	val="$undef"
5583	echo "You do not have long long."
5584fi
5585$rm_try
5586set d_longlong
5587eval $setvar
5588
5589: check for length of long long
5590case "${d_longlong}${longlongsize}" in
5591$define)
5592	echo " "
5593	echo "Checking to see how big your long longs are..." >&4
5594	$cat >try.c <<'EOCP'
5595#include <stdio.h>
5596int main()
5597{
5598    printf("%d\n", (int)sizeof(long long));
5599    return(0);
5600}
5601EOCP
5602	set try
5603	if eval $compile_ok; then
5604		longlongsize=`$run ./try`
5605		echo "Your long longs are $longlongsize bytes long."
5606	else
5607		dflt='8'
5608		echo " "
5609		echo "(I can't seem to compile the test program.  Guessing...)"
5610		rp="What is the size of a long long (in bytes)?"
5611		. ./myread
5612		longlongsize="$ans"
5613	fi
5614	if $test "X$longsize" = "X$longlongsize"; then
5615		echo "(That isn't any different from an ordinary long.)"
5616	fi
5617	;;
5618esac
5619$rm_try
5620
5621: see if inttypes.h is available
5622: we want a real compile instead of Inhdr because some systems
5623: have an inttypes.h which includes non-existent headers
5624echo " "
5625$cat >try.c <<EOCP
5626#include <inttypes.h>
5627int main() {
5628	static int32_t foo32 = 0x12345678;
5629}
5630EOCP
5631set try
5632if eval $compile; then
5633	echo "<inttypes.h> found." >&4
5634	val="$define"
5635else
5636	echo "<inttypes.h> NOT found." >&4
5637	val="$undef"
5638fi
5639$rm_try
5640set i_inttypes
5641eval $setvar
5642
5643: check for int64_t
5644echo " "
5645echo "Checking to see if you have int64_t..." >&4
5646$cat >try.c <<EOCP
5647#include <sys/types.h>
5648#$i_inttypes I_INTTYPES
5649#ifdef I_INTTYPES
5650#include <inttypes.h>
5651#endif
5652int main() { int64_t x = 7; }
5653EOCP
5654set try
5655if eval $compile; then
5656	val="$define"
5657	echo "You have int64_t."
5658else
5659	val="$undef"
5660	echo "You do not have int64_t."
5661fi
5662$rm_try
5663set d_int64_t
5664eval $setvar
5665
5666: Check if 64bit ints have a quad type
5667echo " "
5668echo "Checking which 64-bit integer type we could use..." >&4
5669
5670case "$intsize" in
56718) val=int
5672   set quadtype
5673   eval $setvar
5674   val='"unsigned int"'
5675   set uquadtype
5676   eval $setvar
5677   quadkind=1
5678   ;;
5679*) case "$longsize" in
5680   8) val=long
5681      set quadtype
5682      eval $setvar
5683      val='"unsigned long"'
5684      set uquadtype
5685      eval $setvar
5686      quadkind=2
5687      ;;
5688   *) case "$d_longlong:$longlongsize" in
5689      define:8)
5690        val='"long long"'
5691        set quadtype
5692        eval $setvar
5693        val='"unsigned long long"'
5694        set uquadtype
5695        eval $setvar
5696        quadkind=3
5697        ;;
5698      *) case "$d_int64_t" in
5699         define)
5700           val=int64_t
5701           set quadtype
5702           eval $setvar
5703           val=uint64_t
5704           set uquadtype
5705           eval $setvar
5706           quadkind=4
5707           ;;
5708         esac
5709         ;;
5710      esac
5711      ;;
5712   esac
5713   ;;
5714esac
5715
5716case "$quadtype" in
5717'')	echo "Alas, no 64-bit integer types in sight." >&4
5718	d_quad="$undef"
5719	;;
5720*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5721	d_quad="$define"
5722	;;
5723esac
5724
5725: Do we want 64bit support
5726case "$uselonglong" in
5727"$define"|true|[yY]*)
5728	cat <<EOM >&4
5729
5730*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5731EOM
5732	use64bitint="$define"
5733	;;
5734esac
5735case "$use64bits" in
5736"$define"|true|[yY]*)
5737	cat <<EOM >&4
5738
5739*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5740EOM
5741	use64bitint="$define"
5742	;;
5743esac
5744case "$use64bitints" in
5745"$define"|true|[yY]*)
5746	cat <<EOM >&4
5747
5748*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5749EOM
5750	use64bitint="$define"
5751	;;
5752esac
5753case "$use64bitsint" in
5754"$define"|true|[yY]*)
5755	cat <<EOM >&4
5756
5757*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5758EOM
5759	use64bitint="$define"
5760	;;
5761esac
5762case "$uselonglongs" in
5763"$define"|true|[yY]*)
5764	cat <<EOM >&4
5765
5766*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5767EOM
5768	use64bitint="$define"
5769	;;
5770esac
5771case "$use64bitsall" in
5772"$define"|true|[yY]*)
5773	cat <<EOM >&4
5774
5775*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5776EOM
5777	use64bitall="$define"
5778	;;
5779esac
5780
5781case "$ccflags" in
5782*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5783esac
5784case "$use64bitall" in
5785"$define"|true|[yY]*) use64bitint="$define" ;;
5786esac
5787
5788case "$longsize" in
57898) cat <<EOM
5790
5791You have natively 64-bit long integers.
5792EOM
5793   val="$define"
5794   ;;
5795*) case "$use64bitint" in
5796   "$define"|true|[yY]*) dflt='y';;
5797   *) dflt='n';;
5798   esac
5799   case "$d_quad" in
5800   "$define") ;;
5801   *) dflt='n' ;;
5802   esac
5803   cat <<EOM
5804
5805Perl can be built to take advantage of 64-bit integer types
5806on some systems.  To do so, Configure can be run with -Duse64bitint.
5807Choosing this option will most probably introduce binary incompatibilities.
5808
5809If this doesn't make any sense to you, just accept the default '$dflt'.
5810(The default has been chosen based on your configuration.)
5811EOM
5812   rp='Try to use 64-bit integers, if available?'
5813   . ./myread
5814   case "$ans" in
5815   [yY]*) val="$define" ;;
5816   *)     val="$undef"  ;;
5817   esac
5818   ;;
5819esac
5820set use64bitint
5821eval $setvar
5822
5823case "$use64bitall" in
5824"$define"|true|[yY]*) dflt='y' ;;
5825*) case "$longsize" in
5826   8) dflt='y' ;;
5827   *) dflt='n' ;;
5828   esac
5829   ;;
5830esac
5831cat <<EOM
5832
5833You may also choose to try maximal 64-bitness.  It means using as much
583464-bitness as possible on the platform.  This in turn means even more
5835binary incompatibilities.  On the other hand, your platform may not
5836have any more 64-bitness available than what you already have chosen.
5837
5838If this doesn't make any sense to you, just accept the default '$dflt'.
5839(The default has been chosen based on your configuration.)
5840EOM
5841rp='Try to use maximal 64-bit support, if available?'
5842. ./myread
5843case "$ans" in
5844[yY]*) val="$define" ;;
5845*)     val="$undef"  ;;
5846esac
5847set use64bitall
5848eval $setvar
5849case "$use64bitall" in
5850"$define")
5851	case "$use64bitint" in
5852	"$undef")
5853		cat <<EOM
5854
5855Since you have chosen a maximally 64-bit build, I'm also turning on
5856the use of 64-bit integers.
5857EOM
5858		use64bitint="$define" ;;
5859	esac
5860	;;
5861esac
5862
5863: Look for a hint-file generated 'call-back-unit'.  If the
5864: user has specified that a 64-bit perl is to be built,
5865: we may need to set or change some other defaults.
5866if $test -f use64bitint.cbu; then
5867	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5868	. ./use64bitint.cbu
5869fi
5870case "$use64bitint" in
5871"$define"|true|[yY]*)
5872	case "$longsize" in
5873	4) case "$archname64" in
5874	   '') archname64=64int ;;
5875	   esac
5876	   ;;
5877	esac
5878	;;
5879esac
5880
5881: Look for a hint-file generated 'call-back-unit'.  If the
5882: user has specified that a maximally 64-bit perl is to be built,
5883: we may need to set or change some other defaults.
5884if $test -f use64bitall.cbu; then
5885	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5886	. ./use64bitall.cbu
5887fi
5888case "$use64bitall" in
5889"$define"|true|[yY]*)
5890	case "$longsize" in
5891	4) case "$archname64" in
5892	   ''|64int) archname64=64all ;;
5893	   esac
5894	   ;;
5895	esac
5896	;;
5897esac
5898
5899case "$d_quad:$use64bitint" in
5900$undef:$define)
5901	cat >&4 <<EOF
5902
5903*** You have chosen to use 64-bit integers,
5904*** but none can be found.
5905*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5906*** Cannot continue, aborting.
5907
5908EOF
5909	exit 1
5910	;;
5911esac
5912
5913: check for length of double
5914echo " "
5915case "$doublesize" in
5916'')
5917	echo "Checking to see how big your double precision numbers are..." >&4
5918	$cat >try.c <<EOCP
5919#include <stdio.h>
5920#$i_stdlib I_STDLIB
5921#ifdef I_STDLIB
5922#include <stdlib.h>
5923#endif
5924int main()
5925{
5926    printf("%d\n", (int)sizeof(double));
5927    exit(0);
5928}
5929EOCP
5930	set try
5931	if eval $compile_ok; then
5932		doublesize=`$run ./try`
5933		echo "Your double is $doublesize bytes long."
5934	else
5935		dflt='8'
5936		echo "(I can't seem to compile the test program.  Guessing...)"
5937		rp="What is the size of a double precision number (in bytes)?"
5938		. ./myread
5939		doublesize="$ans"
5940	fi
5941	;;
5942esac
5943$rm_try
5944
5945: check for long doubles
5946echo " "
5947echo "Checking to see if you have long double..." >&4
5948echo 'int main() { long double x = 7.0; }' > try.c
5949set try
5950if eval $compile; then
5951	val="$define"
5952	echo "You have long double."
5953else
5954	val="$undef"
5955	echo "You do not have long double."
5956fi
5957$rm_try
5958set d_longdbl
5959eval $setvar
5960
5961: check for length of long double
5962case "${d_longdbl}${longdblsize}" in
5963$define)
5964	echo " "
5965	echo "Checking to see how big your long doubles are..." >&4
5966	$cat >try.c <<'EOCP'
5967#include <stdio.h>
5968int main()
5969{
5970	printf("%d\n", sizeof(long double));
5971}
5972EOCP
5973	set try
5974	set try
5975	if eval $compile; then
5976		longdblsize=`$run ./try`
5977		echo "Your long doubles are $longdblsize bytes long."
5978	else
5979		dflt='8'
5980		echo " "
5981		echo "(I can't seem to compile the test program.  Guessing...)" >&4
5982		rp="What is the size of a long double (in bytes)?"
5983		. ./myread
5984		longdblsize="$ans"
5985	fi
5986	if $test "X$doublesize" = "X$longdblsize"; then
5987		echo "That isn't any different from an ordinary double."
5988		echo "I'll keep your setting anyway, but you may see some"
5989		echo "harmless compilation warnings."
5990	fi
5991	;;
5992esac
5993$rm_try
5994
5995: determine the architecture name
5996echo " "
5997if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5998	tarch=`arch`"-$osname"
5999elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6000	if uname -m > tmparch 2>&1 ; then
6001		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6002			-e 's/$/'"-$osname/" tmparch`
6003	else
6004		tarch="$osname"
6005	fi
6006	$rm -f tmparch
6007else
6008	tarch="$osname"
6009fi
6010case "$myarchname" in
6011''|"$tarch") ;;
6012*)
6013	echo "(Your architecture name used to be $myarchname.)"
6014	archname=''
6015	;;
6016esac
6017case "$targetarch" in
6018'') ;;
6019*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6020esac
6021myarchname="$tarch"
6022case "$archname" in
6023'') dflt="$tarch";;
6024*) dflt="$archname";;
6025esac
6026rp='What is your architecture name'
6027. ./myread
6028archname="$ans"
6029case "$usethreads" in
6030$define)
6031	echo "Threads selected." >&4
6032	case "$archname" in
6033        *-thread*) echo "...and architecture name already has -thread." >&4
6034                ;;
6035        *)      archname="$archname-thread"
6036                echo "...setting architecture name to $archname." >&4
6037                ;;
6038        esac
6039	;;
6040esac
6041case "$usemultiplicity" in
6042$define)
6043	echo "Multiplicity selected." >&4
6044	case "$archname" in
6045        *-multi*) echo "...and architecture name already has -multi." >&4
6046                ;;
6047        *)      archname="$archname-multi"
6048                echo "...setting architecture name to $archname." >&4
6049                ;;
6050        esac
6051	;;
6052esac
6053case "$use64bitint$use64bitall" in
6054*"$define"*)
6055	case "$archname64" in
6056	'')
6057		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6058		;;
6059	*)
6060		case "$use64bitint" in
6061		"$define") echo "64 bit integers selected." >&4 ;;
6062		esac
6063		case "$use64bitall" in
6064		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6065		esac
6066		case "$archname" in
6067	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6068	                ;;
6069	        *)      archname="$archname-$archname64"
6070	                echo "...setting architecture name to $archname." >&4
6071	                ;;
6072	        esac
6073		;;
6074	esac
6075esac
6076case "$uselongdouble" in
6077$define)
6078	echo "Long doubles selected." >&4
6079	case "$longdblsize" in
6080	$doublesize)
6081		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6082		;;
6083	*)
6084		case "$archname" in
6085	        *-ld*) echo "...and architecture name already has -ld." >&4
6086	                ;;
6087	        *)      archname="$archname-ld"
6088	                echo "...setting architecture name to $archname." >&4
6089        	        ;;
6090	        esac
6091		;;
6092	esac
6093	;;
6094esac
6095if $test -f archname.cbu; then
6096	echo "Your platform has some specific hints for architecture name, using them..."
6097	. ./archname.cbu
6098fi
6099
6100: set the prefixit variable, to compute a suitable default value
6101prefixit='case "$3" in
6102""|none)
6103	case "$oldprefix" in
6104	"") eval "$1=\"\$$2\"";;
6105	*)
6106		case "$3" in
6107		"") eval "$1=";;
6108		none)
6109			eval "tp=\"\$$2\"";
6110			case "$tp" in
6111			""|" ") eval "$1=\"\$$2\"";;
6112			*) eval "$1=";;
6113			esac;;
6114		esac;;
6115	esac;;
6116*)
6117	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6118	case "$tp" in
6119	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6120	/*-$oldprefix/*|\~*-$oldprefix/*)
6121		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6122	*) eval "$1=\"\$$2\"";;
6123	esac;;
6124esac'
6125
6126: determine installation style
6127: For now, try to deduce it from prefix unless it is already set.
6128: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6129case "$installstyle" in
6130'')	case "$prefix" in
6131		*perl*) dflt='lib';;
6132		*) dflt='lib/perl5' ;;
6133	esac
6134	;;
6135*)	dflt="$installstyle" ;;
6136esac
6137: Probably not worth prompting for this since we prompt for all
6138: the directories individually, and the prompt would be too long and
6139: confusing anyway.
6140installstyle=$dflt
6141
6142: determine where public executables go
6143echo " "
6144set dflt bin bin
6145eval $prefixit
6146fn=d~
6147rp='Pathname where the public executables will reside?'
6148. ./getfile
6149if $test "X$ansexp" != "X$binexp"; then
6150	installbin=''
6151fi
6152prefixvar=bin
6153: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6154: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6155:     this via initialinstalllocation
6156. ./setprefixvar
6157
6158case "$userelocatableinc" in
6159$define|true|[yY]*)	dflt='y' ;;
6160*)			dflt='n' ;;
6161esac
6162cat <<EOM
6163
6164Would you like to build Perl so that the installation is relocatable, so that
6165library paths in @INC are determined relative to the path of the perl binary?
6166This is not advised for system Perl installs, or if you need to run setid
6167scripts or scripts under taint mode.
6168
6169If this doesn't make any sense to you, just accept the default '$dflt'.
6170EOM
6171rp='Use relocatable @INC?'
6172. ./myread
6173case "$ans" in
6174y|Y)	val="$define" ;;
6175*)	val="$undef"  ;;
6176esac
6177set userelocatableinc
6178eval $setvar
6179
6180initialinstalllocation="$binexp"
6181: Default prefix is now "up one level from where the binaries are"
6182case "$userelocatableinc" in
6183$define|true|[yY]*)
6184    bin=".../"
6185    binexp=".../"
6186    prefix=".../.."
6187    prefixexp=".../.."
6188    installprefixexp=".../.."
6189    ;;
6190esac
6191
6192: determine where private library files go
6193: Usual default is /usr/local/lib/perl5/$version.
6194: Also allow things like /opt/perl/lib/$version, since
6195: /opt/perl/lib/perl5... would be redundant.
6196: The default "style" setting is made in installstyle.U
6197case "$installstyle" in
6198*lib/perl5*) set dflt privlib lib/$package/$version ;;
6199*)	 set dflt privlib lib/$version ;;
6200esac
6201eval $prefixit
6202$cat <<EOM
6203
6204There are some auxiliary files for $package that need to be put into a
6205private library directory that is accessible by everyone.
6206
6207EOM
6208fn=$binexp
6209fn=d~+
6210rp='Pathname where the private library files will reside?'
6211. ./getfile
6212prefixvar=privlib
6213. ./setprefixvar
6214
6215: set the prefixup variable, to restore leading tilda escape
6216prefixup='case "$prefixexp" in
6217"$prefix") ;;
6218*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6219esac'
6220
6221: determine where public architecture dependent libraries go
6222set archlib archlib
6223eval $prefixit
6224: privlib default is /usr/local/lib/$package/$version
6225: archlib default is /usr/local/lib/$package/$version/$archname
6226: privlib may have an optional trailing /share.
6227tdflt=`echo $privlib | $sed 's,/share$,,'`
6228tdflt=$tdflt/$archname
6229case "$archlib" in
6230'')	dflt=$tdflt
6231	;;
6232*)	dflt="$archlib"
6233    ;;
6234esac
6235$cat <<EOM
6236
6237$spackage contains architecture-dependent library files.  If you are
6238sharing libraries in a heterogeneous environment, you might store
6239these files in a separate location.  Otherwise, you can just include
6240them with the rest of the public library files.
6241
6242EOM
6243fn=$binexp
6244fn=d+~
6245rp='Where do you want to put the public architecture-dependent libraries?'
6246. ./getfile
6247prefixvar=archlib
6248. ./setprefixvar
6249if $test X"$archlib" = X"$privlib"; then
6250	d_archlib="$undef"
6251else
6252	d_archlib="$define"
6253fi
6254
6255: see if setuid scripts can be secure
6256$cat <<EOM
6257
6258Some kernels have a bug that prevents setuid #! scripts from being
6259secure.  Some sites have disabled setuid #! scripts because of this.
6260
6261First let's decide if your kernel supports secure setuid #! scripts.
6262(If setuid #! scripts would be secure but have been disabled anyway,
6263don't say that they are secure if asked.)
6264
6265EOM
6266
6267val="$undef"
6268if $test -d /dev/fd; then
6269	echo "#!$ls" >reflect
6270	chmod +x,u+s reflect
6271	./reflect >flect 2>&1
6272	if $contains "/dev/fd" flect >/dev/null; then
6273		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6274		val="$define"
6275	else
6276		$cat <<EOM
6277If you are not sure if they are secure, I can check but I'll need a
6278username and password different from the one you are using right now.
6279If you don't have such a username or don't want me to test, simply
6280enter 'none'.
6281
6282EOM
6283		rp='Other username to test security of setuid scripts with?'
6284		dflt='none'
6285		. ./myread
6286		case "$ans" in
6287		n|none)
6288			case "$d_suidsafe" in
6289			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6290				dflt=n;;
6291			"$undef")
6292				echo "Well, the $hint value is *not* secure." >&4
6293				dflt=n;;
6294			*)	echo "Well, the $hint value *is* secure." >&4
6295				dflt=y;;
6296			esac
6297			;;
6298		*)
6299			$rm -f reflect flect
6300			echo "#!$ls" >reflect
6301			chmod +x,u+s reflect
6302			echo >flect
6303			chmod a+w flect
6304			echo '"su" will (probably) prompt you for '"$ans's password."
6305			su $ans -c './reflect >flect'
6306			if $contains "/dev/fd" flect >/dev/null; then
6307				echo "Okay, it looks like setuid scripts are secure." >&4
6308				dflt=y
6309			else
6310				echo "I don't think setuid scripts are secure." >&4
6311				dflt=n
6312			fi
6313			;;
6314		esac
6315		rp='Does your kernel have *secure* setuid scripts?'
6316		. ./myread
6317		case "$ans" in
6318		[yY]*)	val="$define";;
6319		*)	val="$undef";;
6320		esac
6321	fi
6322else
6323	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6324	echo "(That's for file descriptors, not floppy disks.)"
6325	val="$undef"
6326fi
6327set d_suidsafe
6328eval $setvar
6329
6330$rm -f reflect flect
6331
6332: now see if they want to do setuid emulation
6333if $test $patchlevel -lt 11; then
6334echo " "
6335val="$undef"
6336case "$d_suidsafe" in
6337"$define")
6338	val="$undef"
6339	echo "No need to emulate SUID scripts since they are secure here." >&4
6340	;;
6341*)
6342	$cat <<EOM
6343Some systems have disabled setuid scripts, especially systems where
6344setuid scripts cannot be secure.  On systems where setuid scripts have
6345been disabled, the setuid/setgid bits on scripts are currently
6346useless.  It is possible for $package to detect those bits and emulate
6347setuid/setgid in a secure fashion.  This emulation will only work if
6348setuid scripts have been disabled in your kernel.
6349
6350EOM
6351	case "$d_dosuid" in
6352	"$define") dflt=y ;;
6353	*) dflt=n ;;
6354	esac
6355	rp="Do you want to do setuid/setgid emulation?"
6356	. ./myread
6357	case "$ans" in
6358	[yY]*)	val="$define";;
6359	*)	val="$undef";;
6360	esac
6361	;;
6362esac
6363set d_dosuid
6364eval $setvar
6365else
6366    case "$d_dosuid" in
6367	"$define")
6368	cat >&4 <<EOH
6369
6370SUID emulation has been removed for 5.12
6371Please re-run Configure without -Dd_dosuid
6372
6373EOH
6374	exit 1;
6375	;;
6376    esac
6377    d_dosuid=undef
6378fi
6379
6380: Find perl5.005 or later.
6381echo "Looking for a previously installed perl5.005 or later... "
6382case "$perl5" in
6383'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6384		: Check if this perl is recent and can load a simple module
6385		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6386			perl5=$tdir/perl
6387			break;
6388		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6389			perl5=$tdir/perl5
6390			break;
6391		fi
6392	done
6393	;;
6394*)	perl5="$perl5"
6395	;;
6396esac
6397case "$perl5" in
6398'')	echo "None found.  That's ok.";;
6399*)	echo "Using $perl5." ;;
6400esac
6401
6402: Set the siteprefix variables
6403$cat <<EOM
6404
6405After $package is installed, you may wish to install various
6406add-on modules and utilities.  Typically, these add-ons will
6407be installed under $prefix with the rest
6408of this package.  However, you may wish to install such add-ons
6409elsewhere under a different prefix.
6410
6411If you do not wish to put everything under a single prefix, that's
6412ok.  You will be prompted for the individual locations; this siteprefix
6413is only used to suggest the defaults.
6414
6415The default should be fine for most people.
6416
6417EOM
6418fn=d~+
6419rp='Installation prefix to use for add-on modules and utilities?'
6420: XXX Here might be another good place for an installstyle setting.
6421case "$siteprefix" in
6422'') dflt=$prefix ;;
6423*)  dflt=$siteprefix ;;
6424esac
6425. ./getfile
6426: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6427oldsiteprefix=''
6428case "$siteprefix" in
6429'') ;;
6430*)	case "$ans" in
6431	"$prefix") ;;
6432	*) oldsiteprefix="$prefix";;
6433	esac
6434	;;
6435esac
6436siteprefix="$ans"
6437siteprefixexp="$ansexp"
6438
6439: determine where site specific libraries go.
6440: Usual default is /usr/local/lib/perl5/site_perl/$version
6441: The default "style" setting is made in installstyle.U
6442: XXX No longer works with Prefixit stuff.
6443prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6444case "$sitelib" in
6445'') case "$installstyle" in
6446	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6447	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6448	esac
6449	;;
6450*)	dflt="$sitelib"
6451	;;
6452esac
6453$cat <<EOM
6454
6455The installation process will create a directory for
6456site-specific extensions and modules.  Most users find it convenient
6457to place all site-specific files in this directory rather than in the
6458main distribution directory.
6459
6460EOM
6461fn=d~+
6462rp='Pathname for the site-specific library files?'
6463. ./getfile
6464prefixvar=sitelib
6465. ./setprefixvar
6466sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6467
6468: Determine list of previous versions to include in @INC
6469$cat > getverlist <<EOPL
6470#!$perl5 -w
6471use File::Basename;
6472\$api_versionstring = "$api_versionstring";
6473\$version = "$version";
6474\$stem = "$sitelib_stem";
6475\$archname = "$archname";
6476EOPL
6477	$cat >> getverlist <<'EOPL'
6478# The list found is store twice for each entry: the original name, and
6479# the binary broken down version as pack "sss", so sorting is easy and
6480# unambiguous. This will work for all versions that have a maximum of
6481# three digit groups, separate by '.'s or '_'s. Names are extended with
6482# ".0.0" to ensure at least three elements for the pack.
6483#					-- H.Merijn Brand (m)'06 23-10-2006
6484
6485# Can't have leading @ because metaconfig interprets it as a command!
6486;@inc_version_list=();
6487# XXX Redo to do opendir/readdir?
6488if (-d $stem) {
6489    chdir($stem);
6490    ;@candidates = map {
6491	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6492    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6493}
6494else {
6495    ;@candidates = ();
6496}
6497
6498($pversion, $aversion, $vsn5005) = map {
6499    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6500foreach $d (@candidates) {
6501    if ($d->[1] lt $pversion) {
6502	if ($d->[1] ge $aversion) {
6503	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6504	}
6505	elsif ($d->[1] ge $vsn5005) {
6506	    unshift(@inc_version_list, grep { -d } $d->[0]);
6507	}
6508    }
6509    else {
6510	# Skip newer version.  I.e. don't look in
6511	# 5.7.0 if we're installing 5.6.1.
6512    }
6513}
6514
6515if (@inc_version_list) {
6516    print join(' ', @inc_version_list);
6517}
6518else {
6519    # Blank space to preserve value for next Configure run.
6520    print " ";
6521}
6522EOPL
6523chmod +x getverlist
6524case "$inc_version_list" in
6525'')	if test -x "$perl5$exe_ext"; then
6526		dflt=`$perl5 getverlist`
6527	else
6528		dflt='none'
6529	fi
6530	;;
6531$undef) dflt='none' ;;
6532*)  eval dflt=\"$inc_version_list\" ;;
6533esac
6534case "$dflt" in
6535''|' ') dflt=none ;;
6536esac
6537case "$dflt" in
65385.005) dflt=none ;;
6539esac
6540$cat <<EOM
6541
6542In order to ease the process of upgrading, this version of perl
6543can be configured to use modules built and installed with earlier
6544versions of perl that were installed under $prefix.  Specify here
6545the list of earlier versions that this version of perl should check.
6546If Configure detected no earlier versions of perl installed under
6547$prefix, then the list will be empty.  Answer 'none' to tell perl
6548to not search earlier versions.
6549
6550The default should almost always be sensible, so if you're not sure,
6551just accept the default.
6552EOM
6553
6554rp='List of earlier versions to include in @INC?'
6555. ./myread
6556case "$ans" in
6557[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6558*) inc_version_list="$ans" ;;
6559esac
6560case "$inc_version_list" in
6561''|' ')
6562	inc_version_list_init='0'
6563	d_inc_version_list="$undef"
6564	;;
6565*)	inc_version_list_init=`echo $inc_version_list |
6566		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6567	d_inc_version_list="$define"
6568	;;
6569esac
6570$rm -f getverlist
6571
6572: see if malloc/malloc.h has to be included
6573set malloc/malloc.h i_mallocmalloc
6574eval $inhdr
6575
6576: see if this is a malloc.h system
6577: we want a real compile instead of Inhdr because some systems have a
6578: malloc.h that just gives a compile error saying to use stdlib.h instead
6579echo " "
6580$cat >try.c <<EOCP
6581#include <stdlib.h>
6582#include <malloc.h>
6583#$i_mallocmalloc I_MALLOCMALLOC
6584#ifdef I_MALLOCMALLOC
6585# include <malloc/malloc.h>
6586#endif
6587
6588int main () { return 0; }
6589EOCP
6590set try
6591if eval $compile; then
6592    echo "<malloc.h> found." >&4
6593    val="$define"
6594else
6595    echo "<malloc.h> NOT found." >&4
6596    val="$undef"
6597fi
6598$rm_try
6599set i_malloc
6600eval $setvar
6601
6602: check for void type
6603echo " "
6604echo "Checking to see how well your C compiler groks the void type..." >&4
6605case "$voidflags" in
6606'')
6607	$cat >try.c <<EOCP
6608#$i_stdlib I_STDLIB
6609#ifdef I_STDLIB
6610#include <stdlib.h>
6611#endif
6612#if TRY & 1
6613void sub() {
6614#else
6615sub() {
6616#endif
6617	extern void moo();	/* function returning void */
6618	void (*goo)();		/* ptr to func returning void */
6619#if TRY & 8
6620	void *hue;		/* generic ptr */
6621#endif
6622#if TRY & 2
6623	void (*foo[10])();
6624#endif
6625
6626#if TRY & 4
6627	if(goo == moo) {
6628		exit(0);
6629	}
6630#endif
6631	exit(0);
6632}
6633int main() { sub(); }
6634EOCP
6635	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6636		voidflags=$defvoidused
6637	echo "Good.  It appears to support void to the level $package wants.">&4
6638		if $contains warning .out >/dev/null 2>&1; then
6639			echo "However, you might get some warnings that look like this:"
6640			$cat .out
6641		fi
6642	else
6643echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6644		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6645			echo "It supports 1..."
6646			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6647				echo "It also supports 2..."
6648				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6649					voidflags=7
6650					echo "And it supports 4 but not 8 definitely."
6651				else
6652					echo "It doesn't support 4..."
6653					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6654						voidflags=11
6655						echo "But it supports 8."
6656					else
6657						voidflags=3
6658						echo "Neither does it support 8."
6659					fi
6660				fi
6661			else
6662				echo "It does not support 2..."
6663				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6664					voidflags=13
6665					echo "But it supports 4 and 8."
6666				else
6667					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6668						voidflags=5
6669						echo "And it supports 4 but has not heard about 8."
6670					else
6671						echo "However it supports 8 but not 4."
6672					fi
6673				fi
6674			fi
6675		else
6676			echo "There is no support at all for void."
6677			voidflags=0
6678		fi
6679	fi
6680esac
6681case "$voidflags" in
6682"$defvoidused") ;;
6683*)	$cat >&4 <<'EOM'
6684  Support flag bits are:
6685    1: basic void declarations.
6686    2: arrays of pointers to functions returning void.
6687    4: operations between pointers to and addresses of void functions.
6688    8: generic void pointers.
6689EOM
6690	dflt="$voidflags";
6691	rp="Your void support flags add up to what?"
6692	. ./myread
6693	voidflags="$ans"
6694	;;
6695esac
6696$rm_try
6697
6698: check for length of pointer
6699echo " "
6700case "$ptrsize" in
6701'')
6702	echo "Checking to see how big your pointers are..." >&4
6703	if test "$voidflags" -gt 7; then
6704		echo '#define VOID_PTR char *' > try.c
6705	else
6706		echo '#define VOID_PTR void *' > try.c
6707	fi
6708	$cat >>try.c <<EOCP
6709#include <stdio.h>
6710#$i_stdlib I_STDLIB
6711#ifdef I_STDLIB
6712#include <stdlib.h>
6713#endif
6714int main()
6715{
6716    printf("%d\n", (int)sizeof(VOID_PTR));
6717    exit(0);
6718}
6719EOCP
6720	set try
6721	if eval $compile_ok; then
6722		ptrsize=`$run ./try`
6723		echo "Your pointers are $ptrsize bytes long."
6724	else
6725		dflt='4'
6726		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6727		rp="What is the size of a pointer (in bytes)?"
6728		. ./myread
6729		ptrsize="$ans"
6730	fi
6731	;;
6732esac
6733$rm_try
6734case "$use64bitall" in
6735"$define"|true|[yY]*)
6736	case "$ptrsize" in
6737	4)	cat <<EOM >&4
6738
6739*** You have chosen a maximally 64-bit build,
6740*** but your pointers are only 4 bytes wide.
6741*** Please rerun Configure without -Duse64bitall.
6742EOM
6743		case "$d_quad" in
6744		define)
6745			cat <<EOM >&4
6746*** Since you have quads, you could possibly try with -Duse64bitint.
6747EOM
6748			;;
6749		esac
6750		cat <<EOM >&4
6751*** Cannot continue, aborting.
6752
6753EOM
6754
6755		exit 1
6756		;;
6757	esac
6758	;;
6759esac
6760
6761
6762: determine whether to use malloc wrapping
6763echo " "
6764case "$usemallocwrap" in
6765[yY]*|true|$define)	dflt='y' ;;
6766[nN]*|false|$undef)	dflt='n' ;;
6767*)	case "$usedevel" in
6768	[yY]*|true|$define)	dflt='y' ;;
6769	*) dflt='n' ;;
6770	esac
6771	;;
6772esac
6773rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6774. ./myread
6775usemallocwrap="$ans"
6776case "$ans" in
6777y*|true)
6778	usemallocwrap="$define" ;;
6779*)
6780	usemallocwrap="$undef" ;;
6781esac
6782
6783: determine which malloc to compile in
6784echo " "
6785case "$usemymalloc" in
6786[yY]*|true|$define)	dflt='y' ;;
6787[nN]*|false|$undef)	dflt='n' ;;
6788*)	case "$ptrsize" in
6789	4) dflt='y' ;;
6790	*) dflt='n' ;;
6791	esac
6792	if test "$useithreads" = "$define"; then dflt='n'; fi
6793	;;
6794esac
6795rp="Do you wish to attempt to use the malloc that comes with $package?"
6796. ./myread
6797usemymalloc="$ans"
6798case "$ans" in
6799y*|true)
6800	usemymalloc='y'
6801	mallocsrc='malloc.c'
6802	mallocobj="malloc$_o"
6803	d_mymalloc="$define"
6804	case "$libs" in
6805	*-lmalloc*)
6806		: Remove malloc from list of libraries to use
6807		echo "Removing unneeded -lmalloc from library list" >&4
6808		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6809		shift
6810		libs="$*"
6811		echo "libs = $libs" >&4
6812		;;
6813	esac
6814	;;
6815*)
6816	usemymalloc='n'
6817	mallocsrc=''
6818	mallocobj=''
6819	d_mymalloc="$undef"
6820	;;
6821esac
6822
6823: compute the return types of malloc and free
6824echo " "
6825$cat >malloc.c <<END
6826#$i_malloc I_MALLOC
6827#$i_stdlib I_STDLIB
6828#include <stdio.h>
6829#include <sys/types.h>
6830#ifdef I_MALLOC
6831#include <malloc.h>
6832#endif
6833#ifdef I_STDLIB
6834#include <stdlib.h>
6835#endif
6836#ifdef TRY_MALLOC
6837void *malloc();
6838#endif
6839#ifdef TRY_FREE
6840void free();
6841#endif
6842END
6843case "$malloctype" in
6844'')
6845	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6846		malloctype='void *'
6847	else
6848		malloctype='char *'
6849	fi
6850	;;
6851esac
6852echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6853
6854case "$freetype" in
6855'')
6856	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6857		freetype='void'
6858	else
6859		freetype='int'
6860	fi
6861	;;
6862esac
6863echo "Your system uses $freetype free(), it would seem." >&4
6864$rm -f malloc.[co]
6865: determine where site specific architecture-dependent libraries go.
6866: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6867: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6868: sitelib may have an optional trailing /share.
6869case "$sitearch" in
6870'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6871	dflt="$dflt/$archname"
6872	;;
6873*)	dflt="$sitearch"
6874	;;
6875esac
6876set sitearch sitearch none
6877eval $prefixit
6878$cat <<EOM
6879
6880The installation process will also create a directory for
6881architecture-dependent site-specific extensions and modules.
6882
6883EOM
6884fn=d~+
6885rp='Pathname for the site-specific architecture-dependent library files?'
6886. ./getfile
6887prefixvar=sitearch
6888. ./setprefixvar
6889if $test X"$sitearch" = X"$sitelib"; then
6890	d_sitearch="$undef"
6891else
6892	d_sitearch="$define"
6893fi
6894
6895: Set the vendorprefix variables
6896$cat <<EOM
6897
6898The installation process will also create a directory for
6899vendor-supplied add-ons.  Vendors who supply perl with their system
6900may find it convenient to place all vendor-supplied files in this
6901directory rather than in the main distribution directory.  This will
6902ease upgrades between binary-compatible maintenance versions of perl.
6903
6904Of course you may also use these directories in whatever way you see
6905fit.  For example, you might use them to access modules shared over a
6906company-wide network.
6907
6908The default answer should be fine for most people.
6909This causes further questions about vendor add-ons to be skipped
6910and no vendor-specific directories will be configured for perl.
6911
6912EOM
6913rp='Do you want to configure vendor-specific add-on directories?'
6914case "$usevendorprefix" in
6915define|true|[yY]*) dflt=y ;;
6916*)	: User may have set vendorprefix directly on Configure command line.
6917	case "$vendorprefix" in
6918	''|' ') dflt=n ;;
6919	*)	dflt=y ;;
6920	esac
6921	;;
6922esac
6923. ./myread
6924case "$ans" in
6925[yY]*)	fn=d~+
6926	rp='Installation prefix to use for vendor-supplied add-ons?'
6927	case "$vendorprefix" in
6928	'') dflt='' ;;
6929	*)  dflt=$vendorprefix ;;
6930	esac
6931	. ./getfile
6932	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6933	oldvendorprefix=''
6934	case "$vendorprefix" in
6935	'') ;;
6936	*)	case "$ans" in
6937		"$prefix") ;;
6938		*) oldvendorprefix="$prefix";;
6939		esac
6940		;;
6941	esac
6942	usevendorprefix="$define"
6943	vendorprefix="$ans"
6944	vendorprefixexp="$ansexp"
6945	;;
6946*)	usevendorprefix="$undef"
6947	vendorprefix=''
6948	vendorprefixexp=''
6949	;;
6950esac
6951
6952: Set the vendorlib variables
6953case "$vendorprefix" in
6954'')	d_vendorlib="$undef"
6955	vendorlib=''
6956	vendorlibexp=''
6957	;;
6958*)	d_vendorlib="$define"
6959	: determine where vendor-supplied modules go.
6960	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
6961	case "$vendorlib" in
6962	'')
6963		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6964		case "$installstyle" in
6965		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6966		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6967		esac
6968		;;
6969	*)	dflt="$vendorlib"
6970		;;
6971	esac
6972	fn=d~+
6973	rp='Pathname for the vendor-supplied library files?'
6974	. ./getfile
6975	vendorlib="$ans"
6976	vendorlibexp="$ansexp"
6977	;;
6978esac
6979vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6980prefixvar=vendorlib
6981. ./installprefix
6982
6983: Set the vendorarch variables
6984case "$vendorprefix" in
6985'')	d_vendorarch="$undef"
6986	vendorarch=''
6987	vendorarchexp=''
6988	;;
6989*)	d_vendorarch="$define"
6990	: determine where vendor-supplied architecture-dependent libraries go.
6991	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6992	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6993	: vendorlib may have an optional trailing /share.
6994	case "$vendorarch" in
6995	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
6996		dflt="$dflt/$archname"
6997		;;
6998	*)	dflt="$vendorarch" ;;
6999	esac
7000	fn=d~+
7001	rp='Pathname for vendor-supplied architecture-dependent files?'
7002	. ./getfile
7003	vendorarch="$ans"
7004	vendorarchexp="$ansexp"
7005	;;
7006esac
7007prefixvar=vendorarch
7008. ./installprefix
7009if $test X"$vendorarch" = X"$vendorlib"; then
7010	d_vendorarch="$undef"
7011else
7012	d_vendorarch="$define"
7013fi
7014
7015: Final catch-all directories to search
7016$cat <<EOM
7017
7018Lastly, you can have perl look in other directories for extensions and
7019modules in addition to those already specified.
7020These directories will be searched after 
7021	$sitearch 
7022	$sitelib 
7023EOM
7024test X"$vendorlib" != "X" && echo '	' $vendorlib
7025test X"$vendorarch" != "X" && echo '	' $vendorarch
7026echo ' '
7027case "$otherlibdirs" in
7028''|' ') dflt='none' ;;
7029*)	dflt="$otherlibdirs" ;;
7030esac
7031$cat <<EOM
7032Enter a colon-separated set of extra paths to include in perl's @INC
7033search path, or enter 'none' for no extra paths.
7034
7035EOM
7036
7037rp='Colon-separated list of additional directories for perl to search?'
7038. ./myread
7039case "$ans" in
7040' '|''|none)	otherlibdirs=' ' ;;
7041*)	otherlibdirs="$ans" ;;
7042esac
7043case "$otherlibdirs" in
7044' ') val=$undef ;;
7045*)	val=$define ;;
7046esac
7047set d_perl_otherlibdirs
7048eval $setvar
7049
7050: Cruising for prototypes
7051echo " "
7052echo "Checking out function prototypes..." >&4
7053$cat >prototype.c <<EOCP
7054#$i_stdlib I_STDLIB
7055#ifdef I_STDLIB
7056#include <stdlib.h>
7057#endif
7058int main(int argc, char *argv[]) {
7059	exit(0);}
7060EOCP
7061if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7062	echo "Your C compiler appears to support function prototypes."
7063	val="$define"
7064else
7065	echo "Your C compiler doesn't seem to understand function prototypes."
7066	val="$undef"
7067fi
7068set prototype
7069eval $setvar
7070$rm -f prototype*
7071
7072: Check if ansi2knr is required
7073case "$prototype" in
7074"$define") ;;
7075*)	ansi2knr='ansi2knr'
7076	echo " "
7077	cat <<EOM >&4
7078
7079$me:  FATAL ERROR:
7080This version of $package can only be compiled by a compiler that 
7081understands function prototypes.  Unfortunately, your C compiler 
7082	$cc $ccflags
7083doesn't seem to understand them.  Sorry about that.
7084
7085If GNU cc is available for your system, perhaps you could try that instead.  
7086
7087Eventually, we hope to support building Perl with pre-ANSI compilers.
7088If you would like to help in that effort, please contact <perlbug@perl.org>.
7089
7090Aborting Configure now.
7091EOM
7092	exit 2
7093	;;
7094esac
7095
7096: DTrace support
7097dflt_dtrace='/usr/sbin/dtrace'
7098$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7099
7100cat <<EOM
7101
7102Perl can be built to support DTrace on platforms that support it.
7103DTrace is a diagnosis and performance analysis tool from Sun.
7104
7105If this doesn't make any sense to you, just accept the default '$dflt'.
7106EOM
7107
7108while $test 1 ; do
7109	case "$usedtrace" in
7110	$define|true|[yY]*)
7111		dflt='y'
7112		;;
7113	?*)
7114		dflt='y'
7115		dflt_dtrace=$usedtrace
7116		;;
7117	*)
7118		dflt='n'
7119		;;
7120	esac
7121
7122	rp='Support DTrace if available?'
7123	. ./myread
7124	case "$ans" in
7125	y|Y)	val="$define" ;;
7126	*)      val="$undef" ;;
7127	esac
7128	set usedtrace
7129	eval $setvar
7130
7131	test "X$usedtrace" != "X$define" && break
7132
7133	echo " "
7134	rp='Where is the dtrace executable?'
7135	dflt=$dflt_dtrace
7136	. ./getfile
7137	val="$ans"
7138	set dtrace
7139	eval $setvar
7140
7141	if $test -f $dtrace
7142	then
7143		if $dtrace -h -s ../perldtrace.d \
7144			-o perldtrace.tmp >/dev/null 2>&1 \
7145			&& rm -f perldtrace.tmp
7146		then
7147			echo " "
7148			echo "Good: your $dtrace knows about the -h flag."
7149		else
7150			cat >&2 <<EOM
7151
7152*** $me:  Fatal Error:  $dtrace doesn't support -h flag
7153***
7154*** Your installed dtrace doesn't support the -h switch to compile a D
7155*** program into a C header. Can't continue.
7156
7157EOM
7158			exit 1
7159		fi
7160		break;
7161	fi
7162
7163	case "$fastread" in
7164	yes)
7165		cat >&2 <<EOM
7166
7167*** $me:  Fatal Error:  $dtrace not found.
7168*** Can't continue.
7169
7170EOM
7171		exit 1
7172		;;
7173	*)
7174		echo "*** $dtrace was not found."
7175		echo " "
7176		;;
7177	esac
7178done
7179
7180: See if we want extra modules installed
7181echo " "
7182case "$extras" in
7183'') dflt='n';;
7184*) dflt='y';;
7185esac
7186cat <<EOM
7187Perl can be built with extra modules or bundles of modules which
7188will be fetched from the CPAN and installed alongside Perl.
7189
7190Notice that you will need access to the CPAN; either via the Internet,
7191or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7192be asked later to configure the CPAN.pm module which will in turn do
7193the installation of the rest of the extra modules or bundles.)
7194
7195Notice also that if the modules require any external software such as
7196libraries and headers (the libz library and the zlib.h header for the
7197Compress::Zlib module, for example) you MUST have any such software
7198already installed, this configuration process will NOT install such
7199things for you.
7200
7201If this doesn't make any sense to you, just accept the default '$dflt'.
7202EOM
7203rp='Install any extra modules (y or n)?'
7204. ./myread
7205case "$ans" in
7206y|Y)
7207	cat <<EOM
7208
7209Please list any extra modules or bundles to be installed from CPAN,
7210with spaces between the names.  The names can be in any format the
7211'install' command of CPAN.pm will understand.  (Answer 'none',
7212without the quotes, to install no extra modules or bundles.)
7213EOM
7214	rp='Extras?'
7215	dflt="$extras"
7216	. ./myread
7217	extras="$ans"
7218esac
7219case "$extras" in
7220''|'none')
7221	val=''
7222	$rm -f ../extras.lst
7223	;;
7224*)	echo "(Saving the list of extras for later...)"
7225	echo "$extras" > ../extras.lst
7226	val="'$extras'"
7227	;;
7228esac
7229set extras
7230eval $setvar
7231echo " "
7232
7233: determine where html pages for programs go
7234set html1dir html1dir none
7235eval $prefixit
7236$cat <<EOM
7237
7238If you wish to install html files for programs in $spackage, indicate
7239the appropriate directory here.  To skip installing html files,
7240answer "none".
7241EOM
7242case "$html1dir" in
7243''|none|$undef|' ') dflt=none ;;
7244*) dflt=$html1dir ;;
7245esac
7246fn=dn+~
7247rp="Directory for the main $spackage html pages?"
7248. ./getfile
7249prefixvar=html1dir
7250. ./setprefixvar
7251: Use ' ' for none so value is preserved next time through Configure
7252$test X"$html1dir" = "X" && html1dir=' '
7253
7254: determine where html pages for libraries and modules go
7255set html3dir html3dir none
7256eval $prefixit
7257$cat <<EOM
7258
7259If you wish to install html files for modules associated with $spackage,
7260indicate the appropriate directory here.  To skip installing html files,
7261answer "none".
7262EOM
7263: There is no obvious default.  If they have specified html1dir, then
7264: try to key off that, possibly changing .../html1 into .../html3.
7265case "$html3dir" in
7266'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7267*) dflt=$html3dir ;;
7268esac
7269fn=dn+~
7270rp="Directory for the $spackage module html pages?"
7271. ./getfile
7272prefixvar=html3dir
7273. ./setprefixvar
7274: Use ' ' for none so value is preserved next time through Configure
7275$test X"$html3dir" = "X" && html3dir=' '
7276
7277: determine whether to install perl also as /usr/bin/perl
7278
7279echo " "
7280if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7281	$cat <<EOM
7282Many scripts expect perl to be installed as /usr/bin/perl.
7283
7284If you want to, I can install the perl you are about to compile
7285as /usr/bin/perl (in addition to $bin/perl).
7286EOM
7287	if test -f /usr/bin/perl; then
7288	    $cat <<EOM
7289
7290However, please note that because you already have a /usr/bin/perl,
7291overwriting that with a new Perl would very probably cause problems.
7292Therefore I'm assuming you don't want to do that (unless you insist).
7293
7294EOM
7295	    case "$installusrbinperl" in
7296	    "$define"|[yY]*)	dflt='y';;
7297	    *)			dflt='n';;
7298	    esac
7299	else
7300	    $cat <<EOM
7301
7302Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7303
7304EOM
7305	    case "$installusrbinperl" in
7306	    "$undef"|[nN]*)	dflt='n';;
7307	    *)			dflt='y';;
7308	    esac
7309	fi
7310	rp="Do you want to install perl as /usr/bin/perl?"
7311	. ./myread
7312	case "$ans" in
7313	[yY]*)	val="$define";;
7314	*)	val="$undef" ;;
7315	esac
7316else
7317	val="$undef"
7318fi
7319set installusrbinperl
7320eval $setvar
7321
7322: Check if we are using the GNU C library
7323echo " "
7324echo "Checking for GNU C Library..." >&4
7325cat >try.c <<'EOCP'
7326/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7327   alone are insufficient to distinguish different versions, such as
7328   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7329   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7330*/
7331#include <stdio.h>
7332int main(void)
7333{
7334#ifdef __GLIBC__
7335#   ifdef __GLIBC_MINOR__
7336#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7337#           include <gnu/libc-version.h>
7338	    printf("%s\n",  gnu_get_libc_version());
7339#       else
7340	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7341#       endif
7342#   else
7343	printf("%d\n",  __GLIBC__);
7344#   endif
7345    return 0;
7346#else
7347    return 1;
7348#endif
7349}
7350EOCP
7351set try
7352if eval $compile_ok && $run ./try > glibc.ver; then
7353	val="$define"
7354	gnulibc_version=`$cat glibc.ver`
7355	echo "You are using the GNU C Library version $gnulibc_version"
7356else
7357	val="$undef"
7358	gnulibc_version=''
7359	echo "You are not using the GNU C Library"
7360fi
7361$rm_try glibc.ver
7362set d_gnulibc
7363eval $setvar
7364
7365: see if nm is to be used to determine whether a symbol is defined or not
7366case "$usenm" in
7367'')
7368	dflt=''
7369	case "$d_gnulibc" in
7370	"$define")
7371		echo " "
7372		echo "nm probably won't work on the GNU C Library." >&4
7373		dflt=n
7374		;;
7375	esac
7376	case "$dflt" in
7377	'')
7378		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7379			echo " "
7380			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7381			echo "'nm' won't be sufficient on this sytem." >&4
7382			dflt=n
7383		fi
7384		;;
7385	esac
7386	case "$dflt" in
7387	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7388		if $test $dflt -gt 20; then
7389			dflt=y
7390		else
7391			dflt=n
7392		fi
7393		;;
7394	esac
7395	;;
7396*)
7397	case "$usenm" in
7398	true|$define) dflt=y;;
7399	*) dflt=n;;
7400	esac
7401	;;
7402esac
7403$cat <<EOM
7404
7405I can use $nm to extract the symbols from your C libraries. This
7406is a time consuming task which may generate huge output on the disk (up
7407to 3 megabytes) but that should make the symbols extraction faster. The
7408alternative is to skip the 'nm' extraction part and to compile a small
7409test program instead to determine whether each symbol is present. If
7410you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7411this may be the best solution.
7412
7413You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7414
7415EOM
7416rp="Shall I use $nm to extract C symbols from the libraries?"
7417. ./myread
7418case "$ans" in
7419[Nn]*) usenm=false;;
7420*) usenm=true;;
7421esac
7422
7423runnm=$usenm
7424case "$reuseval" in
7425true) runnm=false;;
7426esac
7427
7428: nm options which may be necessary
7429case "$nm_opt" in
7430'') if $test -f /mach_boot; then
7431		nm_opt=''	# Mach
7432	elif $test -d /usr/ccs/lib; then
7433		nm_opt='-p'	# Solaris (and SunOS?)
7434	elif $test -f /dgux; then
7435		nm_opt='-p'	# DG-UX
7436	elif $test -f /lib64/rld; then
7437		nm_opt='-p'	# 64-bit Irix
7438	else
7439		nm_opt=''
7440	fi;;
7441esac
7442
7443: nm options which may be necessary for shared libraries but illegal
7444: for archive libraries.  Thank you, Linux.
7445case "$nm_so_opt" in
7446'')	case "$myuname" in
7447	*linux*|gnu*)
7448		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7449			nm_so_opt='--dynamic'
7450		fi
7451		;;
7452	esac
7453	;;
7454esac
7455
7456: Figure out where the libc is located
7457case "$runnm" in
7458true)
7459: get list of predefined functions in a handy place
7460echo " "
7461case "$libc" in
7462'') libc=unknown
7463	case "$libs" in
7464	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7465	esac
7466	;;
7467esac
7468case "$libs" in
7469'') ;;
7470*)  for thislib in $libs; do
7471	case "$thislib" in
7472	-lc|-lc_s)
7473		: Handle C library specially below.
7474		;;
7475	-l*)
7476		thislib=`echo $thislib | $sed -e 's/^-l//'`
7477		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7478			:
7479		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7480			:
7481		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7482			:
7483		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7484			:
7485		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7486			:
7487		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7488			:
7489		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7490			:
7491		else
7492			try=''
7493		fi
7494		libnames="$libnames $try"
7495		;;
7496	*) libnames="$libnames $thislib" ;;
7497	esac
7498	done
7499	;;
7500esac
7501xxx=normal
7502case "$libc" in
7503unknown)
7504	set /lib/libc.$so
7505	for xxx in $libpth; do
7506		$test -r $1 || set $xxx/libc.$so
7507		: The messy sed command sorts on library version numbers.
7508		$test -r $1 || \
7509			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7510			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7511				h
7512				s/[0-9][0-9]*/0000&/g
7513				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7514				G
7515				s/\n/ /' | \
7516			 $sort | $sed -e 's/^.* //'`
7517		eval set \$$#
7518	done
7519	$test -r $1 || set /usr/ccs/lib/libc.$so
7520	$test -r $1 || set /lib/libsys_s$_a
7521	;;
7522*)
7523	set blurfl
7524	;;
7525esac
7526if $test -r "$1"; then
7527	echo "Your (shared) C library seems to be in $1."
7528	libc="$1"
7529elif $test -r /lib/libc && $test -r /lib/clib; then
7530	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7531	xxx=apollo
7532	libc='/lib/clib /lib/libc'
7533	if $test -r /lib/syslib; then
7534		echo "(Your math library is in /lib/syslib.)"
7535		libc="$libc /lib/syslib"
7536	fi
7537elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7538	echo "Your C library seems to be in $libc, as you said before."
7539elif $test -r $incpath/usr/lib/libc$_a; then
7540	libc=$incpath/usr/lib/libc$_a;
7541	echo "Your C library seems to be in $libc.  That's fine."
7542elif $test -r /lib/libc$_a; then
7543	libc=/lib/libc$_a;
7544	echo "Your C library seems to be in $libc.  You're normal."
7545else
7546	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7547		:
7548	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7549		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7550	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7551		:
7552	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7553		:
7554	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7555		:
7556	else
7557		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7558	fi
7559	if $test -r "$tans"; then
7560		echo "Your C library seems to be in $tans, of all places."
7561		libc=$tans
7562	else
7563		libc='blurfl'
7564	fi
7565fi
7566if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7567	dflt="$libc"
7568	cat <<EOM
7569
7570If the guess above is wrong (which it might be if you're using a strange
7571compiler, or your machine supports multiple models), you can override it here.
7572
7573EOM
7574else
7575	dflt=''
7576	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7577	cat >&4 <<EOM
7578I can't seem to find your C library.  I've looked in the following places:
7579
7580EOM
7581	$sed 's/^/	/' libpath
7582	cat <<EOM
7583
7584None of these seems to contain your C library. I need to get its name...
7585
7586EOM
7587fi
7588fn=f
7589rp='Where is your C library?'
7590. ./getfile
7591libc="$ans"
7592
7593echo " "
7594echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7595set X `cat libnames`
7596shift
7597xxx=files
7598case $# in 1) xxx=file; esac
7599echo "Extracting names from the following $xxx for later perusal:" >&4
7600echo " "
7601$sed 's/^/	/' libnames >&4
7602echo " "
7603$echo $n "This may take a while...$c" >&4
7604
7605for file in $*; do
7606	case $file in
7607	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7608	*) $nm $nm_opt $file 2>/dev/null;;
7609	esac
7610done >libc.tmp
7611
7612$echo $n ".$c"
7613$grep fprintf libc.tmp > libc.ptf
7614xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7615xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7616xxx='[ADTSIWi]'
7617if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7618	eval $xscan;\
7619	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620		eval $xrun
7621elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7622	eval $xscan;\
7623	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7624		eval $xrun
7625elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7626	eval $xscan;\
7627	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628		eval $xrun
7629elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7630	eval $xscan;\
7631	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632		eval $xrun
7633elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7634	eval $xscan;\
7635	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636		eval $xrun
7637elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7638	eval $xscan;\
7639	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640		eval $xrun
7641elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7642				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7643	eval $xscan;\
7644	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645		eval $xrun
7646elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7647	eval $xscan;\
7648	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649		eval $xrun
7650elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7651	eval $xscan;\
7652	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653		eval $xrun
7654elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7655	eval $xscan;\
7656	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657		eval $xrun
7658elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7659	eval $xscan;\
7660	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7661		eval $xrun
7662elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7663	eval $xscan;\
7664	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7665		eval $xrun
7666elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7667	eval $xscan;\
7668	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7669		eval $xrun
7670elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7671	eval $xscan;\
7672	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7673		eval $xrun
7674else
7675	$nm -p $* 2>/dev/null >libc.tmp
7676	$grep fprintf libc.tmp > libc.ptf
7677	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7678		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7679	then
7680		nm_opt='-p'
7681		eval $xrun
7682	else
7683		echo " "
7684		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7685		com=''
7686		if $ar t $libc > libc.tmp && \
7687			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
7688		then
7689			for thisname in $libnames $libc; do
7690				$ar t $thisname >>libc.tmp
7691			done
7692			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7693			echo "Ok." >&4
7694		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7695			for thisname in $libnames $libc; do
7696				$ar tv $thisname >>libc.tmp
7697				emximp -o tmp.imp $thisname \
7698				    2>/dev/null && \
7699				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7700				    < tmp.imp >>libc.tmp
7701				$rm -f tmp.imp
7702			done
7703			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7704			echo "Ok." >&4
7705		else
7706			echo "$ar didn't seem to work right." >&4
7707			echo "Maybe this is a Cray...trying bld instead..." >&4
7708			if  bld t $libc | \
7709				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7710				$test -s libc.list
7711			then
7712				for thisname in $libnames; do
7713					bld t $libnames | \
7714					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7715					$ar t $thisname >>libc.tmp
7716				done
7717				echo "Ok." >&4
7718			else
7719				echo "That didn't work either.  Giving up." >&4
7720				exit 1
7721			fi
7722		fi
7723	fi
7724fi
7725nm_extract="$com"
7726case "$PASE" in
7727define)
7728    echo " "
7729    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7730    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7731    ;;
7732*)  if $test -f /lib/syscalls.exp; then
7733	echo " "
7734	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7735	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
7736		/lib/syscalls.exp >>libc.list
7737    fi
7738    ;;
7739esac
7740;;
7741esac
7742$rm -f libnames libpath
7743
7744: see if dld is available
7745set dld.h i_dld
7746eval $inhdr
7747
7748: Check if we are using C++
7749echo " "
7750echo "Checking for C++..." >&4
7751$cat >try.c <<'EOCP'
7752#include <stdio.h>
7753int main(void)
7754{
7755#ifdef __cplusplus
7756    return 0;
7757#else
7758    return 1;
7759#endif
7760}
7761EOCP
7762set try
7763if eval $compile_ok && $run ./try; then
7764	val="$define"
7765	echo "You are using a C++ compiler."
7766else
7767	val="$undef"
7768	echo "You are not using a C++ compiler."
7769fi
7770$rm_try cplusplus$$
7771set d_cplusplus
7772eval $setvar
7773
7774: is a C symbol defined?
7775csym='tlook=$1;
7776case "$3" in
7777-v) tf=libc.tmp; tdc="";;
7778-a) tf=libc.tmp; tdc="[]";;
7779*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7780esac;
7781case "$d_cplusplus" in
7782    $define)	extern_C="extern \"C\""	;;
7783    *)		extern_C="extern"	;;
7784esac;
7785tx=yes;
7786case "$reuseval-$4" in
7787true-) ;;
7788true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7789esac;
7790case "$tx" in
7791yes)
7792	tval=false;
7793	if $test "$runnm" = true; then
7794		if $contains $tlook $tf >/dev/null 2>&1; then
7795			tval=true;
7796		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7797			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7798			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7799			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7800			$rm_try;
7801		fi;
7802	else
7803		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7804		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7805		$rm_try;
7806	fi;
7807	;;
7808*)
7809	case "$tval" in
7810	$define) tval=true;;
7811	*) tval=false;;
7812	esac;
7813	;;
7814esac;
7815eval "$2=$tval"'
7816
7817: define an is-in-libc? function
7818inlibc='echo " "; td=$define; tu=$undef;
7819sym=$1; var=$2; eval "was=\$$2";
7820tx=yes;
7821case "$reuseval$was" in
7822true) ;;
7823true*) tx=no;;
7824esac;
7825case "$tx" in
7826yes)
7827	set $sym tres -f;
7828	eval $csym;
7829	case "$tres" in
7830	true)
7831		echo "$sym() found." >&4;
7832		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7833	*)
7834		echo "$sym() NOT found." >&4;
7835		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7836	esac;;
7837*)
7838	case "$was" in
7839	$define) echo "$sym() found." >&4;;
7840	*) echo "$sym() NOT found." >&4;;
7841	esac;;
7842esac'
7843
7844: see if dlopen exists
7845xxx_runnm="$runnm"
7846xxx_ccflags="$ccflags"
7847runnm=false
7848: with g++ one needs -shared to get is-in-libc to work for dlopen
7849case "$gccversion" in
7850'')	;;
7851*)	case "$d_cplusplus" in
7852	"$define") ccflags="$ccflags -shared" ;;
7853	esac
7854	;;
7855esac
7856set dlopen d_dlopen
7857eval $inlibc
7858runnm="$xxx_runnm"
7859ccflags="$xxx_ccflags"
7860
7861: see if this is a unistd.h system
7862set unistd.h i_unistd
7863eval $inhdr
7864
7865: determine which dynamic loading, if any, to compile in
7866echo " "
7867dldir="ext/DynaLoader"
7868case "$usedl" in
7869$define|y|true)
7870	dflt='y'
7871	usedl="$define"
7872	;;
7873$undef|n|false)
7874	dflt='n'
7875	usedl="$undef"
7876	;;
7877*)
7878	dflt='n'
7879	case "$d_dlopen" in
7880	    $define) dflt='y' ;;
7881	esac
7882	case "$i_dld" in
7883	    $define) dflt='y' ;;
7884	esac
7885	: Does a dl_xxx.xs file exist for this operating system
7886	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7887	;;
7888esac
7889rp="Do you wish to use dynamic loading?"
7890. ./myread
7891usedl="$ans"
7892bin_ELF="$undef"
7893case "$ans" in
7894y*) usedl="$define"
7895	case "$dlsrc" in
7896	'')
7897		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7898			dflt="$dldir/dl_${osname}.xs"
7899		elif $test "$d_dlopen" = "$define" ; then
7900			dflt="$dldir/dl_dlopen.xs"
7901		elif $test "$i_dld" = "$define" ; then
7902			dflt="$dldir/dl_dld.xs"
7903		else
7904			dflt=''
7905		fi
7906		;;
7907	*)	dflt="$dldir/$dlsrc"
7908		;;
7909	esac
7910    echo "The following dynamic loading files are available:"
7911	: Can not go over to $dldir because getfile has path hard-coded in.
7912	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7913	rp="Source file to use for dynamic loading"
7914	fn="fne"
7915	gfpth="$src"
7916	. ./getfile
7917	usedl="$define"
7918	: emulate basename
7919	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7920
7921	$cat << EOM
7922
7923Some systems may require passing special flags to $cc -c to
7924compile modules that will be used to create a shared library.
7925To use no flags, say "none".
7926
7927EOM
7928    case "$cccdlflags" in
7929    '')	case "$gccversion" in
7930		'') case "$osname" in
7931			hpux)	dflt='+z' ;;
7932			next)	dflt='none' ;;
7933			irix*)	dflt='-KPIC' ;;
7934			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7935			sunos)	dflt='-pic' ;;
7936			*)	dflt='none' ;;
7937		    esac
7938			;;
7939		*)  case "$osname" in
7940	                darwin) dflt='none' ;;
7941			linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7942			*)	dflt='-fpic' ;;
7943		    esac ;;
7944	    esac ;;
7945	' ') dflt='none' ;;
7946    *)	dflt="$cccdlflags" ;;
7947    esac
7948    rp="Any special flags to pass to $cc -c to compile shared library modules?"
7949    . ./myread
7950    case "$ans" in
7951    none) cccdlflags=' ' ;;
7952    *) cccdlflags="$ans" ;;
7953    esac
7954
7955    cat << EOM
7956
7957Some systems use ld to create libraries that can be dynamically loaded,
7958while other systems (such as those using ELF) use $cc.
7959
7960EOM
7961
7962: Determine if this is ELF
7963	$cat >try.c <<EOM
7964/* Test for whether ELF binaries are produced */
7965#include <fcntl.h>
7966#$i_stdlib I_STDLIB
7967#ifdef I_STDLIB
7968#include <stdlib.h>
7969#endif
7970#$i_unistd I_UNISTD
7971#ifdef I_UNISTD
7972#include <unistd.h>
7973#endif
7974int main() {
7975	char b[4];
7976	int i = open("a.out",O_RDONLY);
7977	if(i == -1)
7978		exit(1); /* fail */
7979	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7980		exit(0); /* succeed (yes, it is ELF) */
7981	else
7982		exit(1); /* fail */
7983}
7984EOM
7985	if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7986		bin_ELF="$define"
7987	fi
7988	$rm_try
7989
7990	case "$ld" in
7991	'')	if $test $bin_ELF = "$define"; then
7992			cat <<EOM
7993You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7994EOM
7995			dflt="$cc"
7996		else
7997			echo "I'll use ld to build dynamic libraries."
7998			dflt='ld'
7999		fi
8000		;;
8001	*)	dflt="$ld"
8002		;;
8003	esac
8004
8005    rp="What command should be used to create dynamic libraries?"
8006    . ./myread
8007	ld="$ans"
8008
8009    cat << EOM
8010
8011Some systems may require passing special flags to $ld to create a
8012library that can be dynamically loaded.  If your ld flags include
8013-L/other/path options to locate libraries outside your loader's normal
8014search path, you may need to specify those -L options here as well.  To
8015use no flags, say "none".
8016
8017EOM
8018    case "$lddlflags" in
8019    '') case "$osname" in
8020  			beos) dflt='-nostart' ;;
8021  			haiku) dflt='-shared' ;;
8022			hpux) dflt='-b';
8023			      case "$gccversion" in
8024			      '') dflt="$dflt +vnocompatwarnings" ;;
8025			      esac
8026			      ;;
8027			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8028			next)  dflt='none' ;;
8029			solaris) dflt='-G' ;;
8030			sunos) dflt='-assert nodefinitions' ;;
8031			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8032	        *)     dflt='none' ;;
8033			esac
8034			;;
8035    *) dflt="$lddlflags" ;;
8036    esac
8037
8038	: Try to guess additional flags to pick up local libraries.
8039	: Be careful not to append to a plain 'none'
8040	case "$dflt" in
8041	none) dflt='' ;;
8042	esac
8043	for thisflag in $ldflags; do
8044		case "$thisflag" in
8045		-L*|-R*|-Wl,-R*)
8046			case " $dflt " in
8047			*" $thisflag "*) ;;
8048			*) dflt="$dflt $thisflag" ;;
8049			esac
8050			;;
8051		esac
8052	done
8053
8054	case "$dflt" in
8055	''|' ') dflt='none' ;;
8056	esac
8057
8058	case "$ldflags" in
8059	*-fstack-protector*)
8060	    case "$dflt" in
8061			*-fstack-protector*) ;; # Don't add it again
8062			*) dflt="$dflt -fstack-protector" ;;
8063		esac
8064		;;
8065	esac
8066
8067
8068    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8069    . ./myread
8070    case "$ans" in
8071    none) lddlflags=' ' ;;
8072    *) lddlflags="$ans" ;;
8073    esac
8074
8075	cat <<EOM
8076
8077Some systems may require passing special flags to $cc to indicate that
8078the resulting executable will use dynamic linking.  To use no flags,
8079say "none".
8080
8081EOM
8082    case "$ccdlflags" in
8083    '') case "$osname" in
8084	    linux|hpux|gnu*)	dflt='-Wl,-E' ;;
8085	    next|sunos)	dflt='none' ;;
8086	    *)		dflt='none' ;;
8087	    esac ;;
8088    ' ')  dflt='none' ;;
8089    *)  dflt="$ccdlflags" ;;
8090    esac
8091    rp="Any special flags to pass to $cc to use dynamic linking?"
8092    . ./myread
8093    case "$ans" in
8094    none) ccdlflags=' ' ;;
8095    *) ccdlflags="$ans" ;;
8096    esac
8097    ;;
8098*)  usedl="$undef"
8099	ld='ld'
8100    dlsrc='dl_none.xs'
8101    lddlflags=''
8102    ccdlflags=''
8103    ;;
8104esac
8105
8106ld_can_script="$undef"
8107case "$bin_ELF$usedl" in
8108$define$define)
8109    # Abuse try.h and a.out names for neat cleanup
8110    $cat >try.c <<EOM
8111void foo() {}
8112void bar() {}
8113EOM
8114    $cat >try.h <<EOM
8115LIBTEST_42 {
8116 global:
8117  foo;
8118 local: *;
8119 };
8120EOM
8121    if $cc $cccdlflags $ccdlflags $ccflags \
8122           $ldflags $lddlflags -o a.out try.c \
8123           -Wl,--version-script=try.h >/dev/null 2>&1 \
8124       &&  $test -s a.out ; then
8125	echo "ld supports scripting" >&4
8126	ld_can_script="$define"
8127    else
8128	echo "ld does not support scripting" >&4
8129    fi
8130    $rm_try
8131    ;;
8132esac
8133
8134: Do we want a shared libperl?
8135also=''
8136case "$usedl" in
8137$undef)
8138	# No dynamic loading being used, so don't bother even to prompt.
8139	useshrplib='false'
8140	;;
8141*)	case "$useshrplib" in
8142	'')	case "$osname" in
8143		svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8144			dflt=y
8145			also='Building a shared libperl is required for dynamic loading to work on your system.'
8146			;;
8147		next*)
8148			case "$osvers" in
8149			4*)	dflt=y
8150				also='Building a shared libperl is needed for MAB support.'
8151				;;
8152			*)	dflt=n
8153				;;
8154			esac
8155			;;
8156		*)	dflt=n
8157			;;
8158		esac
8159		;;
8160	$define|true|[Yy]*)
8161		dflt=y
8162		;;
8163	*)	dflt=n
8164		;;
8165	esac
8166	$cat << EOM
8167
8168The perl executable is normally obtained by linking perlmain.c with
8169libperl${_a}, any static extensions (usually just DynaLoader), and
8170any other libraries needed on this system (such as -lm, etc.).  Since
8171your system supports dynamic loading, it is probably possible to build
8172a shared libperl.$so.  If you will have more than one executable linked
8173to libperl.$so, this will significantly reduce the size of each
8174executable, but it may have a noticeable effect on performance.  The
8175default is probably sensible for your system.
8176$also
8177
8178EOM
8179	rp="Build a shared libperl.$so (y/n)"
8180	. ./myread
8181	case "$ans" in
8182	true|$define|[Yy]*)
8183		useshrplib='true'  ;;
8184	*)	useshrplib='false' ;;
8185	esac
8186	;;
8187esac
8188
8189case "$useshrplib" in
8190true)
8191	case "$userelocatableinc" in
8192	true|define)
8193		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8194		echo "See INSTALL for an explanation why that won't work." >&4
8195		exit 4
8196		;;
8197	esac
8198	case "$libperl" in
8199	'')
8200		# Figure out a good name for libperl.so.  Since it gets stored in
8201		# a version-specific architecture-dependent library, the version
8202		# number isn't really that important, except for making cc/ld happy.
8203		#
8204		# A name such as libperl.so.10.1
8205		majmin="libperl.$so.$patchlevel.$subversion"
8206		# A name such as libperl.so.100
8207		majonly=`echo $patchlevel $subversion |
8208			$awk '{printf "%d%02d", $1, $2}'`
8209		majonly=libperl.$so.$majonly
8210		# I'd prefer to keep the os-specific stuff here to a minimum, and
8211		# rely on figuring it out from the naming of libc.
8212		case "${osname}${osvers}" in
8213		next4*)
8214			dflt=libperl.5.$so
8215			# XXX How handle the --version stuff for MAB?
8216			;;
8217		linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8218			dflt=libperl.$so
8219			;;
8220		cygwin*) # ld links now against the dll directly
8221			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8222			majonly=`echo $patchlevel $subversion |
8223				$awk '{printf "%03d%03d", $1, $2}'`
8224			majonly=cygperl5.$majonly.$so
8225			dflt=$majmin
8226			;;
8227		*)	# Try to guess based on whether libc has major.minor.
8228			case "$libc" in
8229			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8230			*libc.$so.[0-9]*) dflt=$majonly ;;
8231			*)	dflt=libperl.$so ;;
8232			esac
8233			;;
8234		esac
8235		;;
8236	*)	dflt=$libperl
8237		;;
8238	esac
8239	cat << EOM
8240
8241I need to select a good name for the shared libperl.  If your system uses
8242library names with major and minor numbers, then you might want something
8243like $majmin.  Alternatively, if your system uses a single version
8244number for shared libraries, then you might want to use $majonly.
8245Or, your system might be quite happy with a simple libperl.$so.
8246
8247Since the shared libperl will get installed into a version-specific
8248architecture-dependent directory, the version number of the shared perl
8249library probably isn't important, so the default should be o.k.
8250
8251EOM
8252	rp='What name do you want to give to the shared libperl?'
8253	. ./myread
8254	libperl=$ans
8255	echo "Ok, I'll use $libperl"
8256	;;
8257*)
8258	libperl="libperl${_a}"
8259	;;
8260esac
8261
8262# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8263case "$shrpdir" in
8264'') ;;
8265*)	$cat >&4 <<EOM
8266WARNING:  Use of the shrpdir variable for the installation location of
8267the shared $libperl is not supported.  It was never documented and
8268will not work in this version.  Let me (perlbug@perl.org)
8269know of any problems this may cause.
8270
8271EOM
8272	case "$shrpdir" in
8273	"$archlibexp/CORE")
8274		$cat >&4 <<EOM
8275But your current setting of $shrpdir is
8276the default anyway, so it's harmless.
8277EOM
8278		;;
8279	*)
8280		$cat >&4 <<EOM
8281Further, your current attempted setting of $shrpdir
8282conflicts with the value of $archlibexp/CORE
8283that installperl will use.
8284EOM
8285		;;
8286	esac
8287	;;
8288esac
8289
8290# How will the perl executable find the installed shared $libperl?
8291# Add $xxx to ccdlflags.
8292# If we can't figure out a command-line option, use $shrpenv to
8293# set env LD_RUN_PATH.  The main perl makefile uses this.
8294shrpdir=$archlibexp/CORE
8295xxx=''
8296tmp_shrpenv=''
8297if "$useshrplib"; then
8298    case "$osname" in
8299	aix)
8300		# We'll set it in Makefile.SH...
8301		;;
8302	solaris)
8303		xxx="-R $shrpdir"
8304		;;
8305	freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8306		xxx="-Wl,-R$shrpdir"
8307		;;
8308	bsdos|linux|irix*|dec_osf|gnu*)
8309		xxx="-Wl,-rpath,$shrpdir"
8310		;;
8311	next)
8312		# next doesn't like the default...
8313		;;
8314	beos)
8315		# beos doesn't like the default, either.
8316		;;
8317	haiku)
8318		# Haiku doesn't like the default, either.
8319		;;
8320	hpux*)
8321		# hpux doesn't like the default, either.
8322		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8323		;;
8324	cygwin)
8325		# cygwin needs only ldlibpth
8326		;;
8327	*)
8328		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8329		;;
8330	esac
8331	case "$xxx" in
8332	'') ;;
8333	*)
8334		# Only add $xxx if it isn't already in ccdlflags.
8335		case " $ccdlflags " in
8336		*" $xxx "*)	;;
8337		*)	ccdlflags="$ccdlflags $xxx"
8338			cat <<EOM >&4
8339
8340Adding $xxx to the flags
8341passed to $ld so that the perl executable will find the
8342installed shared $libperl.
8343
8344EOM
8345			;;
8346		esac
8347		;;
8348	esac
8349fi
8350# Fix ccdlflags in AIX for building external extensions.
8351# (For building Perl itself bare -bE:perl.exp is needed,
8352#  Makefile.SH takes care of this.)
8353case "$osname" in
8354aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8355esac
8356# Respect a hint or command-line value.
8357case "$shrpenv" in
8358'') shrpenv="$tmp_shrpenv" ;;
8359esac
8360case "$ldlibpthname" in
8361'')	ldlibpthname=LD_LIBRARY_PATH ;;
8362none)	ldlibpthname='' ;;
8363esac
8364
8365: determine where manual pages are on this system
8366echo " "
8367case "$sysman" in
8368'')
8369	syspath='/usr/share/man/man1 /usr/man/man1'
8370	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8371	syspath="$syspath /usr/man/u_man/man1"
8372	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8373	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8374	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8375	sysman=`./loc . /usr/man/man1 $syspath`
8376	;;
8377esac
8378if $test -d "$sysman"; then
8379	echo "System manual is in $sysman." >&4
8380else
8381	echo "Could not find manual pages in source form." >&4
8382fi
8383
8384: determine where manual pages go
8385set man1dir man1dir none
8386eval $prefixit
8387$cat <<EOM
8388
8389$spackage has manual pages available in source form.
8390EOM
8391case "$nroff" in
8392nroff)
8393	echo "However, you don't have nroff, so they're probably useless to you."
8394	case "$man1dir" in
8395	'') man1dir="none";;
8396	esac;;
8397esac
8398echo "If you don't want the manual sources installed, answer 'none'."
8399case "$man1dir" in
8400' ') dflt=none
8401	;;
8402'')
8403	lookpath="$prefixexp/share/man/man1"
8404	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8405	lookpath="$lookpath $prefixexp/man/p_man/man1"
8406	lookpath="$lookpath $prefixexp/man/u_man/man1"
8407	lookpath="$lookpath $prefixexp/man/man.1"
8408	case "$sysman" in
8409	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8410	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8411	esac
8412	set dflt
8413	eval $prefixup
8414	;;
8415*)  dflt="$man1dir"
8416	;;
8417esac
8418echo " "
8419fn=dn+~
8420rp="Where do the main $spackage manual pages (source) go?"
8421. ./getfile
8422if $test "X$man1direxp" != "X$ansexp"; then
8423	installman1dir=''
8424fi
8425prefixvar=man1dir
8426. ./setprefixvar
8427
8428case "$man1dir" in
8429'')	man1dir=' '
8430	installman1dir='';;
8431esac
8432
8433: What suffix to use on installed man pages
8434
8435case "$man1dir" in
8436' ')
8437	man1ext='0'
8438	;;
8439*)
8440	rp="What suffix should be used for the main $spackage man pages?"
8441	case "$man1ext" in
8442	'')	case "$man1dir" in
8443		*1)  dflt=1 ;;
8444		*1p) dflt=1p ;;
8445		*1pm) dflt=1pm ;;
8446		*l) dflt=l;;
8447		*n) dflt=n;;
8448		*o) dflt=o;;
8449		*p) dflt=p;;
8450		*C) dflt=C;;
8451		*L) dflt=L;;
8452		*L1) dflt=L1;;
8453		*) dflt=1;;
8454		esac
8455		;;
8456	*)	dflt="$man1ext";;
8457	esac
8458	. ./myread
8459	man1ext="$ans"
8460	;;
8461esac
8462
8463: see if we can have long filenames
8464echo " "
8465first=123456789abcdef
8466$rm -f $first
8467if (echo hi >$first) 2>/dev/null; then
8468	if $test -f 123456789abcde; then
8469		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8470		val="$undef"
8471	else
8472 		echo 'You can have filenames longer than 14 characters.'>&4
8473 		val="$define"
8474	fi
8475else
8476	$cat <<'EOM'
8477You can't have filenames longer than 14 chars.
8478You can't even think about them!
8479EOM
8480	val="$undef"
8481fi
8482set d_flexfnam
8483eval $setvar
8484$rm -rf 123456789abcde*
8485
8486: determine where library module manual pages go
8487set man3dir man3dir none
8488eval $prefixit
8489$cat <<EOM
8490
8491$spackage has manual pages for many of the library modules.
8492EOM
8493
8494case "$nroff" in
8495nroff)
8496	$cat <<'EOM'
8497However, you don't have nroff, so they're probably useless to you.
8498EOM
8499	case "$man3dir" in
8500	'') man3dir="none";;
8501	esac;;
8502esac
8503
8504case "$d_flexfnam" in
8505undef)
8506	$cat <<'EOM'
8507However, your system can't handle the long file names like File::Basename.3.
8508EOM
8509	case "$man3dir" in
8510	'') man3dir="none";;
8511	esac;;
8512esac
8513
8514echo "If you don't want the manual sources installed, answer 'none'."
8515prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8516case "$man3dir" in
8517'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8518	if $test -d "$privlib/man/man3"; then
8519		cat <<EOM >&4
8520
8521WARNING:  Previous versions of perl installed man3 pages into
8522$privlib/man/man3.  This version will suggest a
8523new default of $dflt.
8524EOM
8525		tdflt=$dflt
8526		dflt='n'
8527		rp='Do you wish to preserve the old behavior?(y/n)'
8528		. ./myread
8529		case "$ans" in
8530		y*) dflt="$privlib/man/man3" ;;
8531		*)  dflt=$tdflt ;;
8532		esac
8533    fi
8534	;;
8535*)	dflt="$man3dir" ;;
8536esac
8537case "$dflt" in
8538' ') dflt=none ;;
8539esac
8540echo " "
8541fn=dn+~
8542rp="Where do the $package library man pages (source) go?"
8543. ./getfile
8544prefixvar=man3dir
8545. ./setprefixvar
8546
8547case "$man3dir" in
8548'')	man3dir=' '
8549	installman3dir='';;
8550esac
8551
8552: What suffix to use on installed man pages
8553case "$man3dir" in
8554' ')
8555	man3ext='0'
8556	;;
8557*)
8558	rp="What suffix should be used for the $package library man pages?"
8559	case "$man3ext" in
8560	'')	case "$man3dir" in
8561		*3)  dflt=3 ;;
8562		*3p) dflt=3p ;;
8563		*3pm) dflt=3pm ;;
8564		*l) dflt=l;;
8565		*n) dflt=n;;
8566		*o) dflt=o;;
8567		*p) dflt=p;;
8568		*C) dflt=C;;
8569		*L) dflt=L;;
8570		*L3) dflt=L3;;
8571		*) dflt=3;;
8572		esac
8573		;;
8574	*)	dflt="$man3ext";;
8575	esac
8576	. ./myread
8577	man3ext="$ans"
8578	;;
8579esac
8580
8581: see if we have to deal with yellow pages, now NIS.
8582if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8583	if $test -f /usr/etc/nibindd; then
8584		echo " "
8585		echo "I'm fairly confident you're on a NeXT."
8586		echo " "
8587		rp='Do you get the hosts file via NetInfo?'
8588		dflt=y
8589		case "$hostcat" in
8590		nidump*) ;;
8591		'') ;;
8592		*) dflt=n;;
8593		esac
8594		. ./myread
8595		case "$ans" in
8596		y*) hostcat='nidump hosts .';;
8597		*)	case "$hostcat" in
8598			nidump*) hostcat='';;
8599			esac
8600			;;
8601		esac
8602	fi
8603	case "$hostcat" in
8604	nidump*) ;;
8605	*)
8606		case "$hostcat" in
8607		*ypcat*) dflt=y;;
8608		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8609				dflt=y
8610			else
8611				dflt=n
8612			fi;;
8613		*) dflt=n;;
8614		esac
8615		echo " "
8616		rp='Are you getting the hosts file via yellow pages?'
8617		. ./myread
8618		case "$ans" in
8619		y*) hostcat='ypcat hosts';;
8620		*) hostcat='cat /etc/hosts';;
8621		esac
8622		;;
8623	esac
8624fi
8625case "$hostcat" in
8626'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8627esac
8628case "$groupcat" in
8629'') test -f /etc/group && groupcat='cat /etc/group';;
8630esac
8631case "$passcat" in
8632'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8633esac
8634
8635: now get the host name
8636echo " "
8637echo "Figuring out host name..." >&4
8638case "$myhostname" in
8639'') cont=true
8640	echo 'Maybe "hostname" will work...'
8641	if tans=`sh -c hostname 2>&1` ; then
8642		myhostname=$tans
8643		phostname=hostname
8644		cont=''
8645	fi
8646	;;
8647*) cont='';;
8648esac
8649if $test "$cont"; then
8650	if ./xenix; then
8651		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8652		if tans=`cat /etc/systemid 2>&1` ; then
8653			myhostname=$tans
8654			phostname='cat /etc/systemid'
8655			echo "Whadyaknow.  Xenix always was a bit strange..."
8656			cont=''
8657		fi
8658	elif $test -r /etc/systemid; then
8659		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8660	fi
8661fi
8662if $test "$cont"; then
8663	echo 'No, maybe "uuname -l" will work...'
8664	if tans=`sh -c 'uuname -l' 2>&1` ; then
8665		myhostname=$tans
8666		phostname='uuname -l'
8667	else
8668		echo 'Strange.  Maybe "uname -n" will work...'
8669		if tans=`sh -c 'uname -n' 2>&1` ; then
8670			myhostname=$tans
8671			phostname='uname -n'
8672		else
8673			echo 'Oh well, maybe I can mine it out of whoami.h...'
8674			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8675				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8676				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8677			else
8678				case "$myhostname" in
8679				'') echo "Does this machine have an identity crisis or something?"
8680					phostname='';;
8681				*)
8682					echo "Well, you said $myhostname before..."
8683					phostname='echo $myhostname';;
8684				esac
8685			fi
8686		fi
8687	fi
8688fi
8689case "$myhostname" in
8690'') myhostname=noname ;;
8691esac
8692: you do not want to know about this
8693set $myhostname
8694myhostname=$1
8695
8696: verify guess
8697if $test "$myhostname" ; then
8698	dflt=y
8699	rp='Your host name appears to be "'$myhostname'".'" Right?"
8700	. ./myread
8701	case "$ans" in
8702	y*) ;;
8703	*) myhostname='';;
8704	esac
8705fi
8706
8707: bad guess or no guess
8708while $test "X$myhostname" = X ; do
8709	dflt=''
8710	rp="Please type the (one word) name of your host:"
8711	. ./myread
8712	myhostname="$ans"
8713done
8714
8715: translate upper to lower if necessary
8716case "$myhostname" in
8717*[A-Z]*)
8718	echo "(Normalizing case in your host name)"
8719	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8720	;;
8721esac
8722
8723case "$myhostname" in
8724*.*)
8725	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8726	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8727	echo "(Trimming domain name from host name--host name is now $myhostname)"
8728	;;
8729*) case "$mydomain" in
8730	'')
8731		{
8732			test "X$hostcat" = "Xypcat hosts" &&
8733			ypmatch "$myhostname" hosts 2>/dev/null |\
8734				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8735			$test -s hosts
8736		} || {
8737			test "X$hostcat" != "X" &&
8738		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8739					/[	 ]$myhostname[	. ]/p" > hosts
8740		}
8741		tmp_re="[	. ]"
8742		if $test -f hosts; then
8743			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8744			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8745			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8746				hosts | $sort | $uniq | \
8747				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8748			case `$echo X$dflt` in
8749			X*\ *)	echo "(Several hosts in the database matched hostname)"
8750				dflt=.
8751				;;
8752			X.) echo "(You do not have fully-qualified names in the hosts database)"
8753				;;
8754			esac
8755		else
8756			echo "(I cannot locate a hosts database anywhere)"
8757			dflt=.
8758		fi
8759		case "$dflt" in
8760		.)
8761			tans=`./loc resolv.conf X /etc /usr/etc`
8762			if $test -f "$tans"; then
8763				echo "(Attempting domain name extraction from $tans)"
8764				dflt=.`$sed -n -e 's/	/ /g' \
8765				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8766				  -e 1q 2>/dev/null`
8767				case "$dflt" in
8768				.) dflt=.`$sed -n -e 's/	/ /g' \
8769				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8770				     -e 1q 2>/dev/null`
8771  					;;
8772				esac
8773			fi
8774			;;
8775		esac
8776		case "$dflt" in
8777		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8778			dflt=.`sh -c domainname 2>/dev/null`
8779			case "$dflt" in
8780			'') dflt='.';;
8781			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8782			esac
8783			;;
8784		esac
8785		case "$dflt$osname" in
8786		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8787			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8788			;;
8789		esac
8790		case "$dflt" in
8791		.) echo "(Lost all hope -- silly guess then)"
8792			dflt='.nonet'
8793			;;
8794		esac
8795		$rm -f hosts
8796		;;
8797	*) dflt="$mydomain";;
8798	esac;;
8799esac
8800echo " "
8801rp="What is your domain name?"
8802. ./myread
8803tans="$ans"
8804case "$ans" in
8805'') ;;
8806.*) ;;
8807*) tans=".$tans";;
8808esac
8809mydomain="$tans"
8810
8811: translate upper to lower if necessary
8812case "$mydomain" in
8813*[A-Z]*)
8814	echo "(Normalizing case in your domain name)"
8815	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8816	;;
8817esac
8818
8819: a little sanity check here
8820case "$phostname" in
8821'') ;;
8822*)
8823	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8824	$myhostname$mydomain|$myhostname) ;;
8825	*)
8826		case "$phostname" in
8827		sed*)
8828			echo "(That doesn't agree with your whoami.h file, by the way.)"
8829			;;
8830		*)
8831			echo "(That doesn't agree with your $phostname command, by the way.)"
8832			;;
8833		esac
8834	;;
8835	esac
8836	;;
8837esac
8838
8839: determine the e-mail address of the user who is running us
8840$cat <<EOM
8841
8842I need to get your e-mail address in Internet format if possible, i.e.
8843something like user@host.domain. Please answer accurately since I have
8844no easy means to double check it. The default value provided below
8845is most probably close to reality but may not be valid from outside
8846your organization...
8847
8848EOM
8849cont=x
8850while test "$cont"; do
8851	case "$cf_email" in
8852	'') dflt="$cf_by@$myhostname$mydomain";;
8853	*) dflt="$cf_email";;
8854	esac
8855	rp='What is your e-mail address?'
8856	. ./myread
8857	cf_email="$ans"
8858	case "$cf_email" in
8859	*@*.*) cont='' ;;
8860	*)
8861		rp='Address does not look like an Internet one.  Use it anyway?'
8862		case "$fastread" in
8863		yes) dflt=y ;;
8864		*) dflt=n ;;
8865		esac
8866		. ./myread
8867		case "$ans" in
8868		y*) cont='' ;;
8869		*) echo " " ;;
8870		esac
8871		;;
8872	esac
8873done
8874
8875: Ask e-mail of administrator
8876$cat <<EOM
8877
8878If you or somebody else will be maintaining perl at your site, please
8879fill in the correct e-mail address here so that they may be contacted
8880if necessary. Currently, the "perlbug" program included with perl
8881will send mail to this address in addition to perlbug@perl.org. You may
8882enter "none" for no administrator.
8883
8884EOM
8885case "$perladmin" in
8886'') dflt="$cf_email";;
8887*) dflt="$perladmin";;
8888esac
8889rp='Perl administrator e-mail address'
8890. ./myread
8891perladmin="$ans"
8892
8893: determine whether to only install version-specific parts.
8894echo " "
8895$cat <<EOM
8896Do you want to install only the version-specific parts of the perl
8897distribution?  Usually you do *not* want to do this.
8898EOM
8899case "$versiononly" in
8900"$define"|[Yy]*|true) dflt='y' ;;
8901*) dflt='n';
8902esac
8903rp="Do you want to install only the version-specific parts of perl?"
8904. ./myread
8905case "$ans" in
8906[yY]*)	val="$define";;
8907*)	val="$undef" ;;
8908esac
8909set versiononly
8910eval $setvar
8911
8912case "$versiononly" in
8913"$define") inc_version_list=''
8914           inc_version_list_init=0
8915           ;;
8916esac
8917
8918: figure out how to guarantee perl startup
8919: XXX Note that this currently takes advantage of the bug that binexp ignores
8920:     the Configure -Dinstallprefix setting, which in turn means that under
8921:     relocatable @INC, initialinstalllocation is what binexp started as.
8922case "$startperl" in
8923'')
8924	case "$sharpbang" in
8925	*!)
8926		$cat <<EOH
8927
8928I can use the #! construct to start perl on your system. This will
8929make startup of perl scripts faster, but may cause problems if you
8930want to share those scripts and perl is not in a standard place
8931($initialinstalllocation/perl) on all your platforms. The alternative
8932is to force a shell by starting the script with a single ':' character.
8933
8934EOH
8935		case "$versiononly" in
8936		"$define")      dflt="$initialinstalllocation/perl$version";;
8937		*)              dflt="$initialinstalllocation/perl";;
8938		esac
8939		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8940		. ./myread
8941		case "$ans" in
8942		none)	startperl=": # use perl";;
8943		*)	startperl="#!$ans"
8944			if $test 30 -lt `echo "$ans" | wc -c`; then
8945				$cat >&4 <<EOM
8946
8947WARNING:  Some systems limit the #! command to 32 characters.
8948If you experience difficulty running Perl scripts with #!, try
8949installing Perl in a directory with a shorter pathname.
8950
8951EOM
8952			fi ;;
8953		esac
8954		;;
8955	*) startperl=": # use perl"
8956		;;
8957	esac
8958	;;
8959esac
8960echo "I'll use $startperl to start perl scripts."
8961
8962: figure best path for perl in scripts
8963case "$perlpath" in
8964'')
8965	case "$versiononly" in
8966	"$define")	perlpath="$initialinstalllocation/perl$version";;
8967	*)		perlpath="$initialinstalllocation/perl";;
8968	esac
8969	case "$startperl" in
8970	*!*) ;;
8971	*)
8972		$cat <<EOH
8973
8974I will use the "eval 'exec'" idiom to start Perl on your system.
8975I can use the full path of your Perl binary for this purpose, but
8976doing so may cause problems if you want to share those scripts and
8977Perl is not always in a standard place ($initialinstalllocation/perl).
8978
8979EOH
8980		dflt="$initialinstalllocation/perl"
8981		rp="What path shall I use in \"eval 'exec'\"?"
8982		. ./myread
8983		perlpath="$ans"
8984		;;
8985	esac
8986	;;
8987esac
8988case "$startperl" in
8989*!*)	;;
8990*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8991esac
8992
8993: determine where public executable scripts go
8994set scriptdir scriptdir
8995eval $prefixit
8996case "$scriptdir" in
8997'')
8998	dflt="$bin"
8999	: guess some guesses
9000	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9001	$test -d /usr/share/bin     && dflt=/usr/share/bin
9002	$test -d /usr/local/script  && dflt=/usr/local/script
9003	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9004	$test -d $prefixexp/script  && dflt=$prefixexp/script
9005	set dflt
9006	eval $prefixup
9007	;;
9008*)  dflt="$scriptdir"
9009	;;
9010esac
9011$cat <<EOM
9012
9013Some installations have a separate directory just for executable scripts so
9014that they can mount it across multiple architectures but keep the scripts in
9015one spot.  You might, for example, have a subdirectory of /usr/share for this.
9016Or you might just lump your scripts in with all your other executables.
9017
9018EOM
9019fn=d~
9020rp='Where do you keep publicly executable scripts?'
9021. ./getfile
9022if $test "X$ansexp" != "X$scriptdirexp"; then
9023	installscript=''
9024fi
9025installscriptdir=''
9026prefixvar=scriptdir
9027. ./setprefixvar
9028: A little fix up for an irregularly named variable.
9029installscript="$installscriptdir"
9030
9031: determine where add-on public executables go
9032case "$sitebin" in
9033'')	dflt=$siteprefix/bin ;;
9034*)	dflt=$sitebin ;;
9035esac
9036fn=d~
9037rp='Pathname where the add-on public executables should be installed?'
9038. ./getfile
9039prefixvar=sitebin
9040. ./setprefixvar
9041
9042: determine where add-on html pages go
9043: There is no standard location, so try to copy the previously-selected
9044: directory structure for the core html pages.
9045case "$sitehtml1dir" in
9046'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9047*)     dflt=$sitehtml1dir ;;
9048esac
9049case "$dflt" in
9050''|' ') dflt=none ;;
9051esac
9052fn=dn+~
9053rp='Pathname where the site-specific html pages should be installed?'
9054. ./getfile
9055prefixvar=sitehtml1dir
9056. ./setprefixvar
9057
9058: determine where add-on library html pages go
9059: There is no standard location, so try to copy the previously-selected
9060: directory structure for the core html pages.
9061case "$sitehtml3dir" in
9062'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9063*)     dflt=$sitehtml3dir ;;
9064esac
9065case "$dflt" in
9066''|' ') dflt=none ;;
9067esac
9068fn=dn+~
9069rp='Pathname where the site-specific library html pages should be installed?'
9070. ./getfile
9071prefixvar=sitehtml3dir
9072. ./setprefixvar
9073
9074: determine where add-on manual pages go
9075case "$siteman1dir" in
9076'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9077*)	dflt=$siteman1dir ;;
9078esac
9079case "$dflt" in
9080''|' ') dflt=none ;;
9081esac
9082fn=dn+~
9083rp='Pathname where the site-specific manual pages should be installed?'
9084. ./getfile
9085prefixvar=siteman1dir
9086. ./setprefixvar
9087
9088: determine where add-on library man pages go
9089case "$siteman3dir" in
9090'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9091*)	dflt=$siteman3dir ;;
9092esac
9093case "$dflt" in
9094''|' ') dflt=none ;;
9095esac
9096fn=dn+~
9097rp='Pathname where the site-specific library manual pages should be installed?'
9098. ./getfile
9099prefixvar=siteman3dir
9100. ./setprefixvar
9101
9102: determine where add-on public executable scripts go
9103case "$sitescript" in
9104'')	dflt=$siteprefix/script
9105	$test -d $dflt || dflt=$sitebin ;;
9106*)  dflt="$sitescript" ;;
9107esac
9108fn=d~+
9109rp='Pathname where add-on public executable scripts should be installed?'
9110. ./getfile
9111prefixvar=sitescript
9112. ./setprefixvar
9113
9114: Check if faststdio is requested and available
9115case "$usefaststdio" in
9116$define|true|[yY]*|'')
9117	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9118	case "$xversion" in
9119	[68])	dflt='y' ;;
9120	*)	dflt='n' ;;
9121	esac
9122	;;
9123*) dflt='n';;
9124esac
9125cat <<EOM
9126
9127Perl can be built to use 'fast stdio', which means using the stdio
9128library but also directly manipulating the stdio buffers to enable
9129faster I/O.  Using stdio is better for backward compatibility (especially
9130for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9131interface has been preferred instead of stdio.
9132
9133If this doesn't make any sense to you, just accept the default '$dflt'.
9134EOM
9135rp='Use the "fast stdio" if available?'
9136. ./myread
9137case "$ans" in
9138y|Y)	val="$define" ;;
9139*)      val="$undef" ;;
9140esac
9141set usefaststdio
9142eval $setvar
9143
9144
9145: define an is-a-typedef? function
9146typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9147case "$inclist" in
9148"") inclist="sys/types.h";;
9149esac;
9150eval "varval=\$$var";
9151case "$varval" in
9152"")
9153	$rm -f temp.c;
9154	for inc in $inclist; do
9155		echo "#include <$inc>" >>temp.c;
9156	done;
9157	echo "#ifdef $type" >> temp.c;
9158	echo "printf(\"We have $type\");" >> temp.c;
9159	echo "#endif" >> temp.c;
9160	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9161	if $contains $type temp.E >/dev/null 2>&1; then
9162		eval "$var=\$type";
9163	else
9164		eval "$var=\$def";
9165	fi;
9166	$rm -f temp.?;;
9167*) eval "$var=\$varval";;
9168esac'
9169
9170: define an is-a-typedef? function that prompts if the type is not available.
9171typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9172case "$inclist" in
9173"") inclist="sys/types.h";;
9174esac;
9175eval "varval=\$$var";
9176case "$varval" in
9177"")
9178	$rm -f temp.c;
9179	for inc in $inclist; do
9180		echo "#include <$inc>" >>temp.c;
9181	done;
9182	echo "#ifdef $type" >> temp.c;
9183	echo "printf(\"We have $type\");" >> temp.c;
9184	echo "#endif" >> temp.c;
9185	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9186	echo " " ;
9187	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9188	if $contains $type temp.E >/dev/null 2>&1; then
9189		echo "$type found." >&4;
9190		eval "$var=\$type";
9191	else
9192		echo "$type NOT found." >&4;
9193		dflt="$def";
9194		. ./myread ;
9195		eval "$var=\$ans";
9196	fi;
9197	$rm -f temp.?;;
9198*) eval "$var=\$varval";;
9199esac'
9200
9201: see what type lseek is declared as in the kernel
9202rp="What is the type used for lseek's offset on this system?"
9203set off_t lseektype long stdio.h sys/types.h
9204eval $typedef_ask
9205
9206echo " "
9207echo "Checking to see how big your file offsets are..." >&4
9208$cat >try.c <<EOCP
9209#include <sys/types.h>
9210#include <stdio.h>
9211int main()
9212{
9213    printf("%d\n", (int)sizeof($lseektype));
9214    return(0);
9215}
9216EOCP
9217set try
9218if eval $compile_ok; then
9219	lseeksize=`$run ./try`
9220	echo "Your file offsets are $lseeksize bytes long."
9221else
9222	dflt=$longsize
9223	echo " "
9224	echo "(I can't seem to compile the test program.  Guessing...)"
9225	rp="What is the size of your file offsets (in bytes)?"
9226	. ./myread
9227	lseeksize="$ans"
9228fi
9229$rm_try
9230
9231: see what type file positions are declared as in the library
9232rp="What is the type for file position used by fsetpos()?"
9233set fpos_t fpostype long stdio.h sys/types.h
9234eval $typedef_ask
9235
9236: Check size for Fpos_t
9237echo " "
9238case "$fpostype" in
9239*_t) zzz="$fpostype"	;;
9240*)   zzz="fpos_t"	;;
9241esac
9242echo "Checking the size of $zzz..." >&4
9243cat > try.c <<EOCP
9244#include <sys/types.h>
9245#include <stdio.h>
9246#$i_stdlib I_STDLIB
9247#ifdef I_STDLIB
9248#include <stdlib.h>
9249#endif
9250int main() {
9251    printf("%d\n", (int)sizeof($fpostype));
9252    exit(0);
9253}
9254EOCP
9255set try
9256if eval $compile_ok; then
9257	yyy=`$run ./try`
9258	case "$yyy" in
9259	'')	fpossize=4
9260		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9261		;;
9262	*)	fpossize=$yyy
9263		echo "Your $zzz is $fpossize bytes long."
9264		;;
9265	esac
9266else
9267	dflt="$longsize"
9268	echo " " >&4
9269	echo "(I can't compile the test program.  Guessing...)" >&4
9270	rp="What is the size of your file positions (in bytes)?"
9271	. ./myread
9272	fpossize="$ans"
9273fi
9274
9275: Check for large file support
9276# Backward compatibility (uselfs is deprecated).
9277case "$uselfs" in
9278"$define"|true|[yY]*)
9279	cat <<EOM >&4
9280
9281*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9282EOM
9283	uselargefiles="$define"
9284	;;
9285esac
9286
9287case "$lseeksize:$fpossize" in
92888:8) cat <<EOM
9289
9290You can have files larger than 2 gigabytes.
9291EOM
9292   val="$define" ;;
9293*)    case "$uselargefiles" in
9294   "$undef"|false|[nN]*) dflt='n' ;;
9295   *)	dflt='y' ;;
9296   esac
9297   cat <<EOM
9298
9299Perl can be built to understand large files (files larger than 2 gigabytes)
9300on some systems.  To do so, Configure can be run with -Duselargefiles.
9301
9302If this doesn't make any sense to you, just accept the default '$dflt'.
9303EOM
9304   rp='Try to understand large files, if available?'
9305   . ./myread
9306   case "$ans" in
9307   y|Y) 	val="$define" ;;
9308   *)   	val="$undef"  ;;
9309   esac
9310   ;;
9311esac
9312set uselargefiles
9313eval $setvar
9314: Look for a hint-file generated 'call-back-unit'.  If the
9315: user has specified that a large files perl is to be built,
9316: we may need to set or change some other defaults.
9317if $test -f uselargefiles.cbu; then
9318	echo "Your platform has some specific hints regarding large file builds, using them..."
9319	. ./uselargefiles.cbu
9320fi
9321case "$uselargefiles" in
9322"$define")
9323	if $test -f uselargefiles.cbu; then
9324		echo " "
9325		echo "Rechecking to see how big your file offsets are..." >&4
9326		$cat >try.c <<EOCP
9327#include <sys/types.h>
9328#include <stdio.h>
9329int main()
9330{
9331    printf("%d\n", (int)sizeof($lseektype));
9332    return(0);
9333}
9334EOCP
9335		set try
9336		if eval $compile_ok; then
9337			lseeksize=`$run ./try`
9338			$echo "Your file offsets are now $lseeksize bytes long."
9339		else
9340			dflt="$lseeksize"
9341			echo " "
9342			echo "(I can't seem to compile the test program.  Guessing...)"
9343			rp="What is the size of your file offsets (in bytes)?"
9344			. ./myread
9345			lseeksize="$ans"
9346		fi
9347		case "$fpostype" in
9348		*_t) zzz="$fpostype"	;;
9349		*)   zzz="fpos_t"	;;
9350		esac
9351		$echo $n "Rechecking the size of $zzz...$c" >&4
9352		$cat > try.c <<EOCP
9353#include <sys/types.h>
9354#include <stdio.h>
9355#$i_stdlib I_STDLIB
9356#ifdef I_STDLIB
9357#include <stdlib.h>
9358#endif
9359int main() {
9360    printf("%d\n", (int)sizeof($fpostype));
9361    return(0);
9362}
9363EOCP
9364		set try
9365		if eval $compile_ok; then
9366			yyy=`$run ./try`
9367			dflt="$lseeksize"
9368			case "$yyy" in
9369			'')	echo " "
9370				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9371				;;
9372			*)	fpossize=$yyy
9373				echo " $fpossize bytes." >&4
9374				;;
9375			esac
9376		else
9377			dflt="$fpossize"
9378			echo " "
9379			echo "(I can't compile the test program.  Guessing...)" >&4
9380			rp="What is the size of your file positions (in bytes)?"
9381			. ./myread
9382			fpossize="$ans"
9383		fi
9384		$rm_try
9385	fi
9386	;;
9387esac
9388
9389: Check if we want perlio
9390useperlio="$define"
9391
9392: Set the vendorbin variables
9393case "$vendorprefix" in
9394'')	d_vendorbin="$undef"
9395	vendorbin=''
9396	vendorbinexp=''
9397	;;
9398*)	d_vendorbin="$define"
9399	: determine where vendor-supplied executables go.
9400	case "$vendorbin" in
9401	'') dflt=$vendorprefix/bin ;;
9402	*)	dflt="$vendorbin" ;;
9403	esac
9404	fn=d~+
9405	rp='Pathname for the vendor-supplied executables directory?'
9406	. ./getfile
9407	vendorbin="$ans"
9408	vendorbinexp="$ansexp"
9409	;;
9410esac
9411prefixvar=vendorbin
9412. ./installprefix
9413
9414: Set the vendorhtml1dir variables
9415case "$vendorprefix" in
9416'')	vendorhtml1dir=''
9417	vendorhtml1direxp=''
9418	;;
9419*)	: determine where vendor-supplied html pages go.
9420	: There is no standard location, so try to copy the previously-selected
9421	: directory structure for the core html pages.
9422	: XXX Better default suggestions would be welcome.
9423	case "$vendorhtml1dir" in
9424	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9425	*)	dflt=$vendorhtml1dir ;;
9426	esac
9427	case "$dflt" in
9428	''|' ') dflt=none ;;
9429	esac
9430	fn=dn+~
9431	rp='Pathname for the vendor-supplied html pages?'
9432	. ./getfile
9433	vendorhtml1dir="$ans"
9434	vendorhtml1direxp="$ansexp"
9435	;;
9436esac
9437: Use ' ' for none so value is preserved next time through Configure
9438$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9439prefixvar=vendorhtml1dir
9440. ./installprefix
9441
9442: Set the vendorhtml3dir variables
9443case "$vendorprefix" in
9444'')	vendorhtml3dir=''
9445	vendorhtml3direxp=''
9446	;;
9447*)	: determine where vendor-supplied module html pages go.
9448	: There is no standard location, so try to copy the previously-selected
9449	: directory structure for the core html pages.
9450	: XXX Better default suggestions would be welcome.
9451	case "$vendorhtml3dir" in
9452	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9453	*)	dflt=$vendorhtml3dir ;;
9454	esac
9455	case "$dflt" in
9456	''|' ') dflt=none ;;
9457	esac
9458	fn=dn+~
9459	rp='Pathname for the vendor-supplied html pages?'
9460	. ./getfile
9461	vendorhtml3dir="$ans"
9462	vendorhtml3direxp="$ansexp"
9463	;;
9464esac
9465: Use ' ' for none so value is preserved next time through Configure
9466$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9467prefixvar=vendorhtml3dir
9468. ./installprefix
9469
9470: Set the vendorman1dir variables
9471case "$vendorprefix" in
9472'')	vendorman1dir=''
9473	vendorman1direxp=''
9474	;;
9475*)	: determine where vendor-supplied manual pages go.
9476	case "$vendorman1dir" in
9477	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9478	*)	dflt=$vendorman1dir ;;
9479	esac
9480	case "$dflt" in
9481	''|' ') dflt=none ;;
9482	esac
9483	fn=nd~+
9484	rp='Pathname for the vendor-supplied manual section 1 pages?'
9485	. ./getfile
9486	vendorman1dir="$ans"
9487	vendorman1direxp="$ansexp"
9488	;;
9489esac
9490: Use ' ' for none so value is preserved next time through Configure
9491$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9492prefixvar=vendorman1dir
9493. ./installprefix
9494
9495: Set the vendorman3dir variables
9496case "$vendorprefix" in
9497'')	vendorman3dir=''
9498	vendorman3direxp=''
9499	;;
9500*)	: determine where vendor-supplied module manual pages go.
9501	case "$vendorman3dir" in
9502	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9503	*)	dflt=$vendorman3dir ;;
9504	esac
9505	case "$dflt" in
9506	''|' ') dflt=none ;;
9507	esac
9508	fn=nd~+
9509	rp='Pathname for the vendor-supplied manual section 3 pages?'
9510	. ./getfile
9511	vendorman3dir="$ans"
9512	vendorman3direxp="$ansexp"
9513	;;
9514esac
9515: Use ' ' for none so value is preserved next time through Configure
9516$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9517prefixvar=vendorman3dir
9518. ./installprefix
9519
9520: Set the vendorscript variables
9521case "$vendorprefix" in
9522'')	d_vendorscript="$undef"
9523	vendorscript=''
9524	vendorscriptexp=''
9525	;;
9526*)	d_vendorscript="$define"
9527	: determine where vendor-supplied scripts go.
9528	case "$vendorscript" in
9529	'')	dflt=$vendorprefix/script
9530		$test -d $dflt || dflt=$vendorbin ;;
9531	*)  dflt="$vendorscript" ;;
9532	esac
9533	$cat <<EOM
9534
9535The installation process will create a directory for
9536vendor-supplied scripts.
9537
9538EOM
9539	fn=d~+
9540	rp='Pathname for the vendor-supplied scripts directory?'
9541	. ./getfile
9542	vendorscript="$ans"
9543	vendorscriptexp="$ansexp"
9544	;;
9545esac
9546prefixvar=vendorscript
9547. ./installprefix
9548
9549: script used to emit important warnings
9550cat >warn <<EOS
9551$startsh
9552if test \$# -gt 0; then
9553	echo "\$@" >msg
9554else
9555	cat >msg
9556fi
9557echo "*** WARNING:" >&4
9558sed -e 's/^/*** /' <msg >&4
9559echo "*** " >&4
9560cat msg >>config.msg
9561echo " " >>config.msg
9562rm -f msg
9563EOS
9564chmod +x warn
9565$eunicefix warn
9566
9567: see which of string.h or strings.h is needed
9568echo " "
9569strings=`./findhdr string.h`
9570if $test "$strings" && $test -r "$strings"; then
9571	echo "Using <string.h> instead of <strings.h>." >&4
9572	val="$define"
9573else
9574	val="$undef"
9575	strings=`./findhdr strings.h`
9576	if $test "$strings" && $test -r "$strings"; then
9577		echo "Using <strings.h> instead of <string.h>." >&4
9578	else
9579		./warn "No string header found -- You'll surely have problems."
9580	fi
9581fi
9582set i_string
9583eval $setvar
9584case "$i_string" in
9585"$undef") strings=`./findhdr strings.h`;;
9586*)	  strings=`./findhdr string.h`;;
9587esac
9588
9589: see if qgcvt exists
9590set qgcvt d_qgcvt
9591eval $inlibc
9592
9593: Check print/scan long double stuff
9594echo " "
9595
9596if $test X"$d_longdbl" = X"$define"; then
9597
9598echo "Checking how to print long doubles..." >&4
9599
9600if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9601	$cat >try.c <<'EOCP'
9602#include <sys/types.h>
9603#include <stdio.h>
9604int main() {
9605  double d = 123.456;
9606  printf("%.3f\n", d);
9607}
9608EOCP
9609	set try
9610	if eval $compile; then
9611		yyy=`$run ./try`
9612		case "$yyy" in
9613		123.456)
9614			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9615                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9616			echo "We will use %f."
9617			;;
9618		esac
9619	fi
9620fi
9621
9622if $test X"$sPRIfldbl" = X; then
9623	$cat >try.c <<'EOCP'
9624#include <sys/types.h>
9625#include <stdio.h>
9626int main() {
9627  long double d = 123.456;
9628  printf("%.3Lf\n", d);
9629}
9630EOCP
9631	set try
9632	if eval $compile; then
9633		yyy=`$run ./try`
9634		case "$yyy" in
9635		123.456)
9636			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9637                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9638			echo "We will use %Lf."
9639			;;
9640		esac
9641	fi
9642fi
9643
9644if $test X"$sPRIfldbl" = X; then
9645	$cat >try.c <<'EOCP'
9646#include <sys/types.h>
9647#include <stdio.h>
9648int main() {
9649  long double d = 123.456;
9650  printf("%.3llf\n", d);
9651}
9652EOCP
9653	set try
9654	if eval $compile; then
9655		yyy=`$run ./try`
9656		case "$yyy" in
9657		123.456)
9658			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9659                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9660			echo "We will use %llf."
9661			;;
9662		esac
9663	fi
9664fi
9665
9666if $test X"$sPRIfldbl" = X; then
9667	$cat >try.c <<'EOCP'
9668#include <sys/types.h>
9669#include <stdio.h>
9670int main() {
9671  long double d = 123.456;
9672  printf("%.3lf\n", d);
9673}
9674EOCP
9675	set try
9676	if eval $compile; then
9677		yyy=`$run ./try`
9678		case "$yyy" in
9679		123.456)
9680			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9681                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9682			echo "We will use %lf."
9683			;;
9684		esac
9685	fi
9686fi
9687
9688if $test X"$sPRIfldbl" = X; then
9689	echo "Cannot figure out how to print long doubles." >&4
9690else
9691	sSCNfldbl=$sPRIfldbl	# expect consistency
9692fi
9693
9694$rm_try
9695
9696fi # d_longdbl
9697
9698case "$sPRIfldbl" in
9699'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9700	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9701	d_SCNfldbl="$undef";
9702	;;
9703*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9704	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9705	d_SCNfldbl="$define";
9706	;;
9707esac
9708
9709: Check how to convert floats to strings.
9710
9711if test "X$d_Gconvert" = X; then
9712
9713echo " "
9714echo "Checking for an efficient way to convert floats to strings."
9715echo " " > try.c
9716case "$uselongdouble" in
9717"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9718esac
9719case "$d_longdbl" in
9720"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9721esac
9722case "$d_PRIgldbl" in
9723"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9724esac
9725$cat >>try.c <<EOP
9726#ifdef TRY_gconvert
9727#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9728char *myname = "gconvert";
9729#endif
9730#ifdef TRY_gcvt
9731#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9732char *myname = "gcvt";
9733#endif
9734#ifdef TRY_qgcvt
9735#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9736char *myname = "qgcvt";
9737#define DOUBLETYPE long double
9738#endif
9739#ifdef TRY_sprintf
9740#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9741#ifdef HAS_PRIgldbl
9742#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9743#else
9744#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9745#endif
9746#else
9747#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9748#endif
9749char *myname = "sprintf";
9750#endif
9751
9752#ifndef DOUBLETYPE
9753#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9754#define DOUBLETYPE long double
9755#else
9756#define DOUBLETYPE double
9757#endif
9758#endif
9759
9760#include <stdio.h>
9761
9762#$i_stdlib I_STDLIB
9763#ifdef I_STDLIB
9764#include <stdlib.h>
9765#endif
9766#$i_string I_STRING
9767#ifdef I_STRING
9768#  include <string.h>
9769#else
9770#  include <strings.h>
9771#endif
9772
9773int checkit(char *expect, char *got)
9774{
9775    if (strcmp(expect, got)) {
9776		printf("%s oddity:  Expected %s, got %s\n",
9777			myname, expect, got);
9778		exit(1);
9779	}
9780}
9781
9782int main()
9783{
9784	char buf[64];
9785	buf[63] = '\0';
9786
9787	/* This must be 1st test on (which?) platform */
9788	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9789	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9790	checkit("0.1", buf);
9791
9792	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9793	checkit("0.01", buf);
9794
9795	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9796	checkit("0.001", buf);
9797
9798	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9799	checkit("0.0001", buf);
9800
9801	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9802	if (strlen(buf) > 5)
9803	    checkit("9e-005", buf); /* for Microsoft ?? */
9804	else
9805	    checkit("9e-05", buf);
9806
9807	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9808	checkit("1", buf);
9809
9810	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9811	checkit("1.1", buf);
9812
9813	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9814	checkit("1.01", buf);
9815
9816	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9817	checkit("1.001", buf);
9818
9819	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9820	checkit("1.0001", buf);
9821
9822	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9823	checkit("1.00001", buf);
9824
9825	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9826	checkit("1.000001", buf);
9827
9828	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9829	checkit("0", buf);
9830
9831	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9832	checkit("-1", buf);
9833
9834	/* Some Linux gcvt's give 1.e+5 here. */
9835	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9836	checkit("100000", buf);
9837
9838	/* Some Linux gcvt's give -1.e+5 here. */
9839	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9840	checkit("-100000", buf);
9841
9842	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9843	checkit("123.456", buf);
9844
9845	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9846	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9847	/* 34 should be enough to scare even long double
9848	 * places into using the e notation. */
9849	if (strlen(buf) > 5)
9850	    checkit("1e+034", buf); /* for Microsoft */
9851	else
9852	    checkit("1e+34", buf);
9853
9854	/* For Perl, if you add additional tests here, also add them to
9855	 * t/base/num.t for benefit of platforms not using Configure or
9856	 * overriding d_Gconvert */
9857
9858	exit(0);
9859}
9860EOP
9861: first add preferred functions to our list
9862xxx_list=""
9863for xxx_convert in $gconvert_preference; do
9864    case $xxx_convert in
9865    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9866    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9867    esac
9868done
9869: then add any others
9870for xxx_convert in gconvert gcvt sprintf; do
9871    case "$xxx_list" in
9872    *$xxx_convert*) ;;
9873    *) xxx_list="$xxx_list $xxx_convert" ;;
9874    esac
9875done
9876
9877case "$d_longdbl$uselongdouble" in
9878"$define$define")
9879    : again, add preferred functions to our list first
9880    xxx_ld_list=""
9881    for xxx_convert in $gconvert_ld_preference; do
9882        case $xxx_convert in
9883        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9884        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9885        esac
9886    done
9887    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9888    for xxx_convert in qgcvt sprintf $xxx_list; do
9889        case "$xxx_ld_list" in
9890        $xxx_convert*|*" $xxx_convert"*) ;;
9891        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9892        esac
9893    done
9894    : if sprintf cannot do long doubles, move it to the end
9895    if test "$d_PRIgldbl" != "$define"; then
9896        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9897    fi
9898    : if no qgcvt, remove it
9899    if test "$d_qgcvt" != "$define"; then
9900        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9901    fi
9902    : use the ld_list
9903    xxx_list="$xxx_ld_list"
9904    ;;
9905esac
9906
9907for xxx_convert in $xxx_list; do
9908	echo "Trying $xxx_convert..."
9909	$rm -f try try$_o core
9910	set try -DTRY_$xxx_convert
9911	if eval $compile; then
9912		echo "$xxx_convert() found." >&4
9913		if $run ./try; then
9914			echo "I'll use $xxx_convert to convert floats into a string." >&4
9915			break;
9916		else
9917			echo "...But $xxx_convert didn't work as I expected."
9918			xxx_convert=''
9919		fi
9920	else
9921		echo "$xxx_convert NOT found." >&4
9922	fi
9923done
9924
9925if test X$xxx_convert = X; then
9926    echo "*** WHOA THERE!!! ***" >&4
9927    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9928    xxx_convert=sprintf
9929fi
9930
9931case "$xxx_convert" in
9932gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9933gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9934qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9935*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9936   "$define$define$define")
9937      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9938   "$define$define$undef")
9939      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9940   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9941   esac
9942   ;;
9943esac
9944
9945fi
9946$rm_try
9947
9948: see if _fwalk exists
9949set fwalk d__fwalk
9950eval $inlibc
9951
9952: Initialize h_fcntl
9953h_fcntl=false
9954
9955: Initialize h_sysfile
9956h_sysfile=false
9957
9958: access call always available on UNIX
9959set access d_access
9960eval $inlibc
9961
9962: locate the flags for 'access()'
9963case "$d_access" in
9964"$define")
9965	echo " "
9966	$cat >access.c <<EOCP
9967#include <sys/types.h>
9968#ifdef I_FCNTL
9969#include <fcntl.h>
9970#endif
9971#ifdef I_SYS_FILE
9972#include <sys/file.h>
9973#endif
9974#ifdef I_UNISTD
9975#include <unistd.h>
9976#endif
9977#$i_stdlib I_STDLIB
9978#ifdef I_STDLIB
9979#include <stdlib.h>
9980#endif
9981int main() {
9982	exit(R_OK);
9983}
9984EOCP
9985	: check sys/file.h first, no particular reason here
9986	if $test `./findhdr sys/file.h` && \
9987		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9988		h_sysfile=true;
9989		echo "<sys/file.h> defines the *_OK access constants." >&4
9990	elif $test `./findhdr fcntl.h` && \
9991		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9992		h_fcntl=true;
9993		echo "<fcntl.h> defines the *_OK access constants." >&4
9994	elif $test `./findhdr unistd.h` && \
9995		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9996		echo "<unistd.h> defines the *_OK access constants." >&4
9997	else
9998		echo "I can't find the four *_OK access constants--I'll use mine." >&4
9999	fi
10000	;;
10001esac
10002$rm -f access*
10003
10004: see if accessx exists
10005set accessx d_accessx
10006eval $inlibc
10007
10008: see if aintl exists
10009set aintl d_aintl
10010eval $inlibc
10011
10012: see if alarm exists
10013set alarm d_alarm
10014eval $inlibc
10015
10016: see if 64bit time functions exists
10017
10018set ctime64 d_ctime64
10019eval $inlibc
10020
10021set localtime64 d_localtime64
10022eval $inlibc
10023
10024set gmtime64 d_gmtime64
10025eval $inlibc
10026
10027set mktime64 d_mktime64
10028eval $inlibc
10029
10030set difftime64 d_difftime64
10031eval $inlibc
10032
10033set asctime64 d_asctime64
10034eval $inlibc
10035
10036: see if POSIX threads are available
10037set pthread.h i_pthread
10038eval $inhdr
10039
10040: define a function to check prototypes
10041$cat > protochk <<EOSH
10042$startsh
10043cc="$cc"
10044optimize="$optimize"
10045ccflags="$ccflags"
10046prototype="$prototype"
10047define="$define"
10048rm_try="$rm_try"
10049usethreads=$usethreads
10050i_pthread=$i_pthread
10051pthread_h_first=$pthread_h_first
10052EOSH
10053
10054$cat >> protochk <<'EOSH'
10055
10056$rm_try
10057foo="$1"
10058shift
10059while test $# -ge 2; do
10060	case "$1" in
10061		$define) echo "#include <$2>" >> try.c ;;
10062		literal) echo "$2" >> try.c ;;
10063	esac
10064    # Extra magic for the benefit of systems that need pthread.h
10065    # to be included early to correctly detect threadsafe functions.
10066    # Such functions must guarantee themselves, though, that the usethreads
10067    # and i_pthread have been defined, before calling protochk.
10068    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10069	echo "#include <pthread.h>" >> try.c
10070	pthread_h_done=yes
10071    fi
10072    shift 2
10073done
10074test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10075cat >> try.c <<'EOCP'
10076#ifdef CAN_PROTOTYPE
10077#define	_(args) args
10078#else
10079#define	_(args) ()
10080#endif
10081EOCP
10082echo "$foo" >> try.c
10083echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10084$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10085status=$?
10086$rm_try
10087exit $status
10088EOSH
10089chmod +x protochk
10090$eunicefix protochk
10091
10092: Define hasproto macro for Configure internal use
10093hasproto='varname=$1; func=$2; shift; shift;
10094while $test $# -ge 2; do
10095	case "$1" in
10096	$define) echo "#include <$2>";;
10097	esac ;
10098    shift 2;
10099done > try.c;
10100$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10101if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10102	echo "$func() prototype found.";
10103	val="$define";
10104else
10105	echo "$func() prototype NOT found.";
10106	val="$undef";
10107fi;
10108set $varname;
10109eval $setvar;
10110$rm_try tryout.c'
10111
10112: see if sys/types.h has to be included
10113set sys/types.h i_systypes
10114eval $inhdr
10115
10116: see if sys/select.h has to be included
10117set sys/select.h i_sysselct
10118eval $inhdr
10119
10120: Define hasfield macro for Configure internal use
10121hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10122while $test $# -ge 2; do
10123	case "$1" in
10124	$define) echo "#include <$2>";;
10125	esac ;
10126    shift 2;
10127done > try.c;
10128echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10129set try;
10130if eval $compile; then
10131	val="$define";
10132else
10133	val="$undef";
10134fi;
10135set $varname;
10136eval $setvar;
10137$rm_try'
10138
10139: see if we should include time.h, sys/time.h, or both
10140echo " "
10141if test "X$timeincl" = X; then
10142	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10143	$echo $n "I'm now running the test program...$c"
10144	$cat >try.c <<EOCP
10145#include <sys/types.h>
10146#ifdef I_TIME
10147#include <time.h>
10148#endif
10149#ifdef I_SYSTIME
10150#ifdef SYSTIMEKERNEL
10151#define KERNEL
10152#endif
10153#include <sys/time.h>
10154#endif
10155#ifdef I_SYSSELECT
10156#include <sys/select.h>
10157#endif
10158#$i_stdlib I_STDLIB
10159#ifdef I_STDLIB
10160#include <stdlib.h>
10161#endif
10162int main()
10163{
10164	struct tm foo;
10165#ifdef S_TIMEVAL
10166	struct timeval bar;
10167#endif
10168#ifdef S_TIMEZONE
10169	struct timezone tzp;
10170#endif
10171	if (foo.tm_sec == foo.tm_sec)
10172		exit(0);
10173#ifdef S_TIMEVAL
10174	if (bar.tv_sec == bar.tv_sec)
10175		exit(0);
10176#endif
10177	exit(1);
10178}
10179EOCP
10180	flags=''
10181	for s_timezone in '-DS_TIMEZONE' ''; do
10182	sysselect=''
10183	for s_timeval in '-DS_TIMEVAL' ''; do
10184	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10185	for i_time in '' '-DI_TIME'; do
10186	for i_systime in '-DI_SYSTIME' ''; do
10187		case "$flags" in
10188		'') $echo $n ".$c"
10189			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10190			if eval $compile; then
10191				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10192				shift
10193				flags="$*"
10194				echo " "
10195				$echo $n "Succeeded with $flags$c"
10196			fi
10197			;;
10198		esac
10199	done
10200	done
10201	done
10202	done
10203	done
10204	timeincl=''
10205	echo " "
10206	case "$flags" in
10207	*SYSTIMEKERNEL*) i_systimek="$define"
10208		timeincl=`./findhdr sys/time.h`
10209		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10210	*) i_systimek="$undef";;
10211	esac
10212	case "$flags" in
10213	*I_TIME*) i_time="$define"
10214		timeincl=`./findhdr time.h`" $timeincl"
10215		echo "We'll include <time.h>." >&4;;
10216	*) i_time="$undef";;
10217	esac
10218	case "$flags" in
10219	*I_SYSTIME*) i_systime="$define"
10220		timeincl=`./findhdr sys/time.h`" $timeincl"
10221		echo "We'll include <sys/time.h>." >&4;;
10222	*) i_systime="$undef";;
10223	esac
10224	$rm_try
10225fi
10226: see if struct tm knows about tm_zone
10227case "$i_systime$i_time" in
10228*$define*)
10229        echo " "
10230        echo "Checking to see if your struct tm has tm_zone field..." >&4
10231        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10232        eval $hasfield
10233        ;;
10234*)      val="$undef"
10235        set d_tm_tm_zone
10236        eval $setvar
10237        ;;
10238esac
10239case "$d_tm_tm_zone" in
10240"$define")      echo "Yes, it does."   ;;
10241*)              echo "No, it doesn't." ;;
10242esac
10243: see if struct tm knows about tm_gmtoff
10244case "$i_systime$i_time" in
10245*$define*)
10246        echo " "
10247        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10248        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10249        eval $hasfield
10250        ;;
10251*)      val="$undef"
10252        set d_tm_tm_gmtoff
10253        eval $setvar
10254        ;;
10255esac
10256case "$d_tm_tm_gmtoff" in
10257"$define")      echo "Yes, it does."   ;;
10258*)              echo "No, it doesn't." ;;
10259esac
10260
10261: see if asctime_r exists
10262set asctime_r d_asctime_r
10263eval $inlibc
10264case "$d_asctime_r" in
10265"$define")
10266	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10267	case "$d_asctime_r_proto:$usethreads" in
10268	":define")	d_asctime_r_proto=define
10269		set d_asctime_r_proto asctime_r $hdrs
10270		eval $hasproto ;;
10271	*)	;;
10272	esac
10273	case "$d_asctime_r_proto" in
10274	define)
10275	case "$asctime_r_proto" in
10276	''|0) try='char* asctime_r(const struct tm*, char*);'
10277	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10278	esac
10279	case "$asctime_r_proto" in
10280	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10281	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10282	esac
10283	case "$asctime_r_proto" in
10284	''|0) try='int asctime_r(const struct tm*, char*);'
10285	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10286	esac
10287	case "$asctime_r_proto" in
10288	''|0) try='int asctime_r(const struct tm*, char*, int);'
10289	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10290	esac
10291	case "$asctime_r_proto" in
10292	''|0)	d_asctime_r=undef
10293 	        asctime_r_proto=0
10294		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10295	* )	case "$asctime_r_proto" in
10296		REENTRANT_PROTO*) ;;
10297		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10298		esac
10299		echo "Prototype: $try" ;;
10300	esac
10301	;;
10302	*)	case "$usethreads" in
10303		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10304		esac
10305		d_asctime_r=undef
10306		asctime_r_proto=0
10307		;;
10308	esac
10309	;;
10310*)	asctime_r_proto=0
10311	;;
10312esac
10313
10314: see if atolf exists
10315set atolf d_atolf
10316eval $inlibc
10317
10318: see if atoll exists
10319set atoll d_atoll
10320eval $inlibc
10321
10322: Look for GCC-style attribute format
10323case "$d_attribute_format" in
10324'')
10325echo " "
10326echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10327$cat >attrib.c <<'EOCP'
10328#include <stdio.h>
10329void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10330EOCP
10331if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10332	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10333		echo "Your C compiler doesn't support __attribute__((format))."
10334		val="$undef"
10335	else
10336		echo "Your C compiler supports __attribute__((format))."
10337		val="$define"
10338	fi
10339else
10340	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10341	val="$undef"
10342fi
10343;;
10344*) val="$d_attribute_format" ;;
10345esac
10346set d_attribute_format
10347eval $setvar
10348$rm -f attrib*
10349
10350: Look for GCC-style attribute format with null format allowed
10351case "$d_printf_format_null" in
10352'') case "$d_attribute_format" in
10353    $define)
10354	echo " "
10355	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10356$cat >attrib.c <<EOCP
10357#include <stdio.h>
10358#$i_stdlib I_STDLIB
10359#ifdef I_STDLIB
10360#include <stdlib.h>
10361#endif
10362int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10363int null_printf (char* pat,...) { return (int)pat; }
10364int main () { exit(null_printf(NULL)); }
10365EOCP
10366	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10367	    : run the executable in case it produces a run-time warning
10368	    if $run ./attrib >>attrib.out 2>&1; then
10369		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10370		    echo "Your C compiler doesn't allow __printf__ format to be null."
10371		    val="$undef"
10372		else
10373		    echo "Your C compiler allows __printf__ format to be null."
10374		    val="$define"
10375		fi
10376	    else
10377	    echo "Your C compiler executable failed with __printf__ format null."
10378	    val="$undef"
10379	fi
10380    else
10381	echo "Your C compiler fails with __printf__ format null."
10382	val="$undef"
10383    fi
10384    ;;
10385    *)  val="$undef" ;;
10386    esac
10387;;
10388*)  val="$d_printf_format_null" ;;
10389esac
10390set d_printf_format_null
10391eval $setvar
10392$rm -f attrib*
10393
10394: Look for GCC-style attribute malloc
10395case "$d_attribute_malloc" in
10396'')
10397echo " "
10398echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10399$cat >attrib.c <<'EOCP'
10400#include <stdio.h>
10401char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10402EOCP
10403if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10404	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10405		echo "Your C compiler doesn't support __attribute__((malloc))."
10406		val="$undef"
10407	else
10408		echo "Your C compiler supports __attribute__((malloc))."
10409		val="$define"
10410	fi
10411else
10412	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10413	val="$undef"
10414fi
10415;;
10416*) val="$d_attribute_malloc" ;;
10417esac
10418set d_attribute_malloc
10419eval $setvar
10420$rm -f attrib*
10421
10422: Look for GCC-style attribute nonnull
10423case "$d_attribute_nonnull" in
10424'')
10425echo " "
10426echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10427$cat >attrib.c <<'EOCP'
10428#include <stdio.h>
10429void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10430EOCP
10431if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10432	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10433		echo "Your C compiler doesn't support __attribute__((nonnull))."
10434		val="$undef"
10435	else
10436		echo "Your C compiler supports __attribute__((nonnull))."
10437		val="$define"
10438	fi
10439else
10440	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10441	val="$undef"
10442fi
10443;;
10444*) val="$d_attribute_nonnull" ;;
10445esac
10446set d_attribute_nonnull
10447eval $setvar
10448$rm -f attrib*
10449
10450: Look for GCC-style attribute noreturn
10451case "$d_attribute_noreturn" in
10452'')
10453echo " "
10454echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10455$cat >attrib.c <<'EOCP'
10456#include <stdio.h>
10457void fall_over_dead( void ) __attribute__((noreturn));
10458EOCP
10459if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10460	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10461		echo "Your C compiler doesn't support __attribute__((noreturn))."
10462		val="$undef"
10463	else
10464		echo "Your C compiler supports __attribute__((noreturn))."
10465		val="$define"
10466	fi
10467else
10468	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10469	val="$undef"
10470fi
10471;;
10472*) val="$d_attribute_noreturn" ;;
10473esac
10474set d_attribute_noreturn
10475eval $setvar
10476$rm -f attrib*
10477
10478: Look for GCC-style attribute pure
10479case "$d_attribute_pure" in
10480'')
10481echo " "
10482echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10483$cat >attrib.c <<'EOCP'
10484#include <stdio.h>
10485int square( int n ) __attribute__((pure));
10486EOCP
10487if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10488	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10489		echo "Your C compiler doesn't support __attribute__((pure))."
10490		val="$undef"
10491	else
10492		echo "Your C compiler supports __attribute__((pure))."
10493		val="$define"
10494	fi
10495else
10496	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10497	val="$undef"
10498fi
10499;;
10500*) val="$d_attribute_pure" ;;
10501esac
10502set d_attribute_pure
10503eval $setvar
10504$rm -f attrib*
10505
10506: Look for GCC-style attribute unused
10507case "$d_attribute_unused" in
10508'')
10509echo " "
10510echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10511$cat >attrib.c <<'EOCP'
10512#include <stdio.h>
10513int do_something( int dummy __attribute__((unused)), int n );
10514EOCP
10515if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10516	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10517		echo "Your C compiler doesn't support __attribute__((unused))."
10518		val="$undef"
10519	else
10520		echo "Your C compiler supports __attribute__((unused))."
10521		val="$define"
10522	fi
10523else
10524	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10525	val="$undef"
10526fi
10527;;
10528*) val="$d_attribute_unused" ;;
10529esac
10530set d_attribute_unused
10531eval $setvar
10532$rm -f attrib*
10533
10534: Look for GCC-style attribute deprecated
10535case "$d_attribute_deprecated" in
10536'')
10537echo " "
10538echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10539$cat >attrib.c <<'EOCP'
10540#include <stdio.h>
10541int I_am_deprecated(void) __attribute__((deprecated));
10542EOCP
10543if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10544	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10545		echo "Your C compiler doesn't support __attribute__((deprecated))."
10546		val="$undef"
10547	else
10548		echo "Your C compiler supports __attribute__((deprecated))."
10549		val="$define"
10550	fi
10551else
10552	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10553	val="$undef"
10554fi
10555;;
10556*) val="$d_attribute_deprecated" ;;
10557esac
10558set d_attribute_deprecated
10559eval $setvar
10560$rm -f attrib*
10561
10562: Look for GCC-style attribute warn_unused_result
10563case "$d_attribute_warn_unused_result" in
10564'')
10565echo " "
10566echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10567$cat >attrib.c <<'EOCP'
10568#include <stdio.h>
10569int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10570EOCP
10571if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10572	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10573		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10574		val="$undef"
10575	else
10576		echo "Your C compiler supports __attribute__((warn_unused_result))."
10577		val="$define"
10578	fi
10579else
10580	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10581	val="$undef"
10582fi
10583;;
10584*) val="$d_attribute_warn_unused_result" ;;
10585esac
10586set d_attribute_warn_unused_result
10587eval $setvar
10588$rm -f attrib*
10589
10590: see if bcmp exists
10591set bcmp d_bcmp
10592eval $inlibc
10593
10594: see if bcopy exists
10595set bcopy d_bcopy
10596eval $inlibc
10597
10598: see if getpgrp exists
10599set getpgrp d_getpgrp
10600eval $inlibc
10601
10602case "$d_getpgrp" in
10603"$define")
10604	echo " "
10605	echo "Checking to see which flavor of getpgrp is in use..."
10606	$cat >try.c <<EOP
10607#$i_unistd I_UNISTD
10608#include <sys/types.h>
10609#ifdef I_UNISTD
10610#  include <unistd.h>
10611#endif
10612#$i_stdlib I_STDLIB
10613#ifdef I_STDLIB
10614#include <stdlib.h>
10615#endif
10616int main()
10617{
10618	if (getuid() == 0) {
10619		printf("(I see you are running Configure as super-user...)\n");
10620		setuid(1);
10621	}
10622#ifdef TRY_BSD_PGRP
10623	if (getpgrp(1) == 0)
10624		exit(0);
10625#else
10626	if (getpgrp() > 0)
10627		exit(0);
10628#endif
10629	exit(1);
10630}
10631EOP
10632	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10633		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10634		val="$define"
10635	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10636		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10637		val="$undef"
10638	else
10639		echo "I can't seem to compile and run the test program."
10640		if ./usg; then
10641			xxx="a USG one, i.e. you use getpgrp()."
10642		else
10643			# SVR4 systems can appear rather BSD-ish.
10644			case "$i_unistd" in
10645			$undef)
10646				xxx="a BSD one, i.e. you use getpgrp(pid)."
10647				val="$define"
10648				;;
10649			$define)
10650				xxx="probably a USG one, i.e. you use getpgrp()."
10651				val="$undef"
10652				;;
10653			esac
10654		fi
10655		echo "Assuming your getpgrp is $xxx" >&4
10656	fi
10657	;;
10658*) val="$undef";;
10659esac
10660set d_bsdgetpgrp
10661eval $setvar
10662$rm_try
10663
10664: see if setpgrp exists
10665set setpgrp d_setpgrp
10666eval $inlibc
10667
10668case "$d_setpgrp" in
10669"$define")
10670	echo " "
10671	echo "Checking to see which flavor of setpgrp is in use..."
10672	$cat >try.c <<EOP
10673#$i_unistd I_UNISTD
10674#include <sys/types.h>
10675#ifdef I_UNISTD
10676#  include <unistd.h>
10677#endif
10678#$i_stdlib I_STDLIB
10679#ifdef I_STDLIB
10680#include <stdlib.h>
10681#endif
10682int main()
10683{
10684	if (getuid() == 0) {
10685		printf("(I see you are running Configure as super-user...)\n");
10686		setuid(1);
10687	}
10688#ifdef TRY_BSD_PGRP
10689	if (-1 == setpgrp(1, 1))
10690		exit(0);
10691#else
10692	if (setpgrp() != -1)
10693		exit(0);
10694#endif
10695	exit(1);
10696}
10697EOP
10698	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10699		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10700		val="$define"
10701	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10702		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10703		val="$undef"
10704	else
10705		echo "(I can't seem to compile and run the test program.)"
10706		if ./usg; then
10707			xxx="a USG one, i.e. you use setpgrp()."
10708		else
10709			# SVR4 systems can appear rather BSD-ish.
10710			case "$i_unistd" in
10711			$undef)
10712				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10713				val="$define"
10714				;;
10715			$define)
10716				xxx="probably a USG one, i.e. you use setpgrp()."
10717				val="$undef"
10718				;;
10719			esac
10720		fi
10721		echo "Assuming your setpgrp is $xxx" >&4
10722	fi
10723	;;
10724*) val="$undef";;
10725esac
10726set d_bsdsetpgrp
10727eval $setvar
10728$rm_try
10729
10730: Look for GCC-style __builtin_choose_expr
10731case "$d_builtin_choose_expr" in
10732'')
10733    echo " "
10734    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10735    $cat >try.c <<'EOCP'
10736#include <assert.h>
10737#include <stdlib.h>
10738#include <stdio.h>
10739
10740#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10741
10742int main(void) {
10743    assert( SYRINX(1) == 2112 );
10744    assert( SYRINX(1) != 5150 );
10745    assert( SYRINX(0) == 5150 );
10746    assert( SYRINX(0) != 2112 );
10747    puts( "All good!" );
10748    exit(0);
10749}
10750
10751EOCP
10752    set try
10753    if eval $compile && $run ./try; then
10754	echo "Your C compiler supports __builtin_choose_expr."
10755	val="$define"
10756    else
10757	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10758	val="$undef"
10759    fi
10760;;
10761*) val="$d_builtin_choose_expr" ;;
10762esac
10763
10764set d_builtin_choose_expr
10765eval $setvar
10766$rm_try
10767
10768: Look for GCC-style __builtin_expect
10769case "$d_builtin_expect" in
10770'')
10771    echo " "
10772    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10773    $cat >try.c <<'EOCP'
10774int main(void) {
10775    int n = 50;
10776    if ( __builtin_expect(n, 0) ) n = 1;
10777    /* Remember shell exit code truth is 0, C truth is non-zero */
10778    return !(n == 1);
10779}
10780EOCP
10781    set try
10782    if eval $compile && $run ./try; then
10783	echo "Your C compiler supports __builtin_expect."
10784	val="$define"
10785    else
10786	echo "Your C compiler doesn't seem to understand __builtin_expect."
10787	val="$undef"
10788    fi
10789    ;;
10790*) val="$d_builtin_expect" ;;
10791esac
10792
10793set d_builtin_expect
10794eval $setvar
10795$rm_try
10796
10797: see if bzero exists
10798set bzero d_bzero
10799eval $inlibc
10800
10801: see if stdarg is available
10802echo " "
10803if $test `./findhdr stdarg.h`; then
10804	echo "<stdarg.h> found." >&4
10805	valstd="$define"
10806else
10807	echo "<stdarg.h> NOT found." >&4
10808	valstd="$undef"
10809fi
10810
10811: see if varags is available
10812echo " "
10813if $test `./findhdr varargs.h`; then
10814	echo "<varargs.h> found." >&4
10815else
10816	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10817fi
10818
10819: set up the varargs testing programs
10820$cat > varargs.c <<EOP
10821#ifdef I_STDARG
10822#include <stdarg.h>
10823#endif
10824#ifdef I_VARARGS
10825#include <varargs.h>
10826#endif
10827
10828#ifdef I_STDARG
10829int f(char *p, ...)
10830#else
10831int f(va_alist)
10832va_dcl
10833#endif
10834{
10835	va_list ap;
10836#ifndef I_STDARG
10837	char *p;
10838#endif
10839#ifdef I_STDARG
10840	va_start(ap,p);
10841#else
10842	va_start(ap);
10843	p = va_arg(ap, char *);
10844#endif
10845	va_end(ap);
10846	return 0;
10847}
10848EOP
10849$cat > varargs <<EOP
10850$startsh
10851if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10852	echo "true"
10853else
10854	echo "false"
10855fi
10856$rm -f varargs$_o
10857EOP
10858chmod +x varargs
10859
10860: now check which varargs header should be included
10861echo " "
10862i_varhdr=''
10863case "$valstd" in
10864"$define")
10865	if `./varargs I_STDARG`; then
10866		val='stdarg.h'
10867	elif `./varargs I_VARARGS`; then
10868		val='varargs.h'
10869	fi
10870	;;
10871*)
10872	if `./varargs I_VARARGS`; then
10873		val='varargs.h'
10874	fi
10875	;;
10876esac
10877case "$val" in
10878'')
10879echo "I could not find the definition for va_dcl... You have problems..." >&4
10880	val="$undef"; set i_stdarg; eval $setvar
10881	val="$undef"; set i_varargs; eval $setvar
10882	;;
10883*)
10884	set i_varhdr
10885	eval $setvar
10886	case "$i_varhdr" in
10887	stdarg.h)
10888		val="$define"; set i_stdarg; eval $setvar
10889		val="$undef"; set i_varargs; eval $setvar
10890		;;
10891	varargs.h)
10892		val="$undef"; set i_stdarg; eval $setvar
10893		val="$define"; set i_varargs; eval $setvar
10894		;;
10895	esac
10896	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10897esac
10898$rm -f varargs*
10899
10900: see if the Compiler supports C99 variadic macros
10901case "$i_stdarg$i_stdlib" in
10902    "$define$define")
10903    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10904    $cat >try.c <<EOCP
10905#include <stdio.h>
10906#include <stdarg.h>
10907
10908#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10909
10910int main() {
10911  char buf[20];
10912  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10913  puts(buf);
10914  return 0;
10915}
10916EOCP
10917    set try
10918    if eval $compile && $run ./try 2>&1 >/dev/null; then
10919	case "`$run ./try`" in
10920	    "123 456 789")
10921	    echo "You have C99 variadic macros." >&4
10922	    d_c99_variadic_macros="$define"
10923	    ;;
10924	    *)
10925	    echo "You don't have functional C99 variadic macros." >&4
10926	    d_c99_variadic_macros="$undef"
10927	    ;;
10928	esac
10929    else
10930	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10931	d_c99_variadic_macros="$undef"
10932    fi
10933    $rm_try
10934    ;;
10935    *)
10936    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10937    d_c99_variadic_macros="$undef"
10938    ;;
10939esac
10940
10941: see if signal is declared as pointer to function returning int or void
10942echo " "
10943xxx=`./findhdr signal.h`
10944$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10945if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10946	echo "You have int (*signal())() instead of void." >&4
10947	val="$undef"
10948elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10949	echo "You have void (*signal())()." >&4
10950	val="$define"
10951elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10952	echo "You have int (*signal())() instead of void." >&4
10953	val="$undef"
10954elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10955	echo "You have void (*signal())()." >&4
10956	val="$define"
10957else
10958	case "$d_voidsig" in
10959	'')
10960	echo "I can't determine whether signal handler returns void or int..." >&4
10961		dflt=void
10962		rp="What type does your signal handler return?"
10963		. ./myread
10964		case "$ans" in
10965		v*) val="$define";;
10966		*) val="$undef";;
10967		esac;;
10968	"$define")
10969		echo "As you already told me, signal handler returns void." >&4
10970		val="$define"
10971		;;
10972	*)	echo "As you already told me, signal handler returns int." >&4
10973		val="$undef"
10974		;;
10975	esac
10976fi
10977set d_voidsig
10978eval $setvar
10979case "$d_voidsig" in
10980"$define") signal_t="void";;
10981*) signal_t="int";;
10982esac
10983$rm -f $$.tmp
10984
10985: check for ability to cast large floats to 32-bit ints.
10986echo " "
10987echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10988if $test "$intsize" -ge 4; then
10989	xxx=int
10990else
10991	xxx=long
10992fi
10993$cat >try.c <<EOCP
10994#include <stdio.h>
10995#$i_stdlib I_STDLIB
10996#ifdef I_STDLIB
10997#include <stdlib.h>
10998#endif
10999#include <sys/types.h>
11000#include <signal.h>
11001$signal_t blech(int s) { exit(3); }
11002int main()
11003{
11004	$xxx i32;
11005	double f, g;
11006	int result = 0;
11007	char str[16];
11008	signal(SIGFPE, blech);
11009
11010	/* Don't let compiler optimize the test away.  Store the number
11011	   in a writable string for gcc to pass to sscanf under HP-UX.
11012	*/
11013	sprintf(str, "2147483647");
11014	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11015	g = 10 * f;
11016	i32  = ($xxx) g;
11017
11018	/* x86 processors will probably give 0x8000 0000, which is a
11019	   sign change.  We don't want that.  We want to mimic SPARC
11020	   behavior here, which is to preserve the sign and give
11021	   back 0x7fff ffff.
11022	*/
11023	if (i32 != ($xxx) f)
11024		result |= 1;
11025	exit(result);
11026}
11027EOCP
11028set try
11029if eval $compile_ok; then
11030	$run ./try
11031	yyy=$?
11032else
11033	echo "(I can't seem to compile the test program--assuming it can't)"
11034	yyy=1
11035fi
11036case "$yyy" in
110370)	val="$define"
11038	echo "Yup, it can."
11039	;;
11040*)	val="$undef"
11041	echo "Nope, it can't."
11042	;;
11043esac
11044set d_casti32
11045eval $setvar
11046$rm_try
11047
11048: check for ability to cast negative floats to unsigned
11049echo " "
11050echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11051$cat >try.c <<EOCP
11052#include <stdio.h>
11053#$i_stdlib I_STDLIB
11054#ifdef I_STDLIB
11055#include <stdlib.h>
11056#endif
11057#include <sys/types.h>
11058#include <signal.h>
11059$signal_t blech(int s) { exit(7); }
11060$signal_t blech_in_list(int s) { exit(4); }
11061unsigned long dummy_long(unsigned long p) { return p; }
11062unsigned int dummy_int(unsigned int p) { return p; }
11063unsigned short dummy_short(unsigned short p) { return p; }
11064int main()
11065{
11066	double f;
11067	unsigned long along;
11068	unsigned int aint;
11069	unsigned short ashort;
11070	int result = 0;
11071	char str[16];
11072
11073	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11074	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11075	   optimized the whole file away
11076	*/
11077	/* Store the number in a writable string for gcc to pass to
11078	   sscanf under HP-UX.
11079	*/
11080	sprintf(str, "-123");
11081	sscanf(str, "%lf", &f);  /* f = -123.; */
11082
11083	signal(SIGFPE, blech);
11084	along = (unsigned long)f;
11085	aint = (unsigned int)f;
11086	ashort = (unsigned short)f;
11087	if (along != (unsigned long)-123)
11088		result |= 1;
11089	if (aint != (unsigned int)-123)
11090		result |= 1;
11091	if (ashort != (unsigned short)-123)
11092		result |= 1;
11093	sprintf(str, "1073741824.");
11094	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11095	f = f + f;
11096	along = 0;
11097	along = (unsigned long)f;
11098	if (along != 0x80000000)
11099		result |= 2;
11100	f -= 1.;
11101	along = 0;
11102	along = (unsigned long)f;
11103	if (along != 0x7fffffff)
11104		result |= 1;
11105	f += 2.;
11106	along = 0;
11107	along = (unsigned long)f;
11108	if (along != 0x80000001)
11109		result |= 2;
11110	if (result)
11111		exit(result);
11112	signal(SIGFPE, blech_in_list);
11113	sprintf(str, "123.");
11114	sscanf(str, "%lf", &f);  /* f = 123.; */
11115	along = dummy_long((unsigned long)f);
11116	aint = dummy_int((unsigned int)f);
11117	ashort = dummy_short((unsigned short)f);
11118	if (along != (unsigned long)123)
11119		result |= 4;
11120	if (aint != (unsigned int)123)
11121		result |= 4;
11122	if (ashort != (unsigned short)123)
11123		result |= 4;
11124	exit(result);
11125
11126}
11127EOCP
11128set try
11129if eval $compile_ok; then
11130	$run ./try
11131	castflags=$?
11132else
11133	echo "(I can't seem to compile the test program--assuming it can't)"
11134	castflags=7
11135fi
11136case "$castflags" in
111370)	val="$define"
11138	echo "Yup, it can."
11139	;;
11140*)	val="$undef"
11141	echo "Nope, it can't."
11142	;;
11143esac
11144set d_castneg
11145eval $setvar
11146$rm_try
11147
11148: see if vprintf exists
11149echo " "
11150if set vprintf val -f d_vprintf; eval $csym; $val; then
11151	echo 'vprintf() found.' >&4
11152	val="$define"
11153	$cat >try.c <<EOF
11154#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11155#$i_varargs I_VARARGS
11156
11157#$i_stdlib I_STDLIB
11158#$i_unistd I_UNISTD
11159
11160#ifdef I_STDARG
11161#  include <stdarg.h>
11162#else /* I_VARARGS */
11163#  include <varargs.h>
11164#endif
11165
11166#ifdef I_UNISTD
11167#  include <unistd.h>
11168#endif
11169
11170#ifdef I_STDLIB
11171#  include <stdlib.h>
11172#endif
11173
11174#include <stdio.h> /* vsprintf prototype */
11175
11176#ifdef I_STDARG
11177void xxx(int n, ...)
11178{
11179    va_list args;
11180    char buf[10];
11181    va_start(args, n);
11182    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11183}
11184int main() { xxx(1, "foo"); }
11185
11186#else /* I_VARARGS */
11187
11188xxx(va_alist)
11189va_dcl
11190{
11191    va_list args;
11192    char buf[10];
11193    va_start(args);
11194    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11195}
11196int main() { xxx("foo"); }
11197
11198#endif
11199
11200EOF
11201	set try
11202	if eval $compile_ok; then
11203		if $run ./try; then
11204			echo "Your vsprintf() returns (int)." >&4
11205			val2="$undef"
11206		else
11207			echo "Your vsprintf() returns (char*)." >&4
11208			val2="$define"
11209		fi
11210	else
11211		echo 'I am unable to compile the vsprintf() test program.' >&4
11212		# We shouldn't get here.  If we do, assume the standard signature,
11213		# not the old BSD one.
11214		echo 'Guessing that vsprintf() returns (int).' >&4
11215		val2="$undef"
11216	fi
11217else
11218	echo 'vprintf() NOT found.' >&4
11219	val="$undef"
11220	val2="$undef"
11221fi
11222$rm_try
11223set d_vprintf
11224eval $setvar
11225val=$val2
11226set d_charvspr
11227eval $setvar
11228
11229: see if chown exists
11230set chown d_chown
11231eval $inlibc
11232
11233: see if chroot exists
11234set chroot d_chroot
11235eval $inlibc
11236
11237: see if chsize exists
11238set chsize d_chsize
11239eval $inlibc
11240
11241: see if class exists
11242set class d_class
11243eval $inlibc
11244
11245: see if clearenv exists
11246set clearenv d_clearenv
11247eval $inlibc
11248
11249: Define hasstruct macro for Configure internal use
11250hasstruct='varname=$1; struct=$2; shift; shift;
11251while $test $# -ge 2; do
11252	case "$1" in
11253	$define) echo "#include <$2>";;
11254	esac ;
11255    shift 2;
11256done > try.c;
11257echo "int main () { struct $struct foo; }" >> try.c;
11258set try;
11259if eval $compile; then
11260	val="$define";
11261else
11262	val="$undef";
11263fi;
11264set $varname;
11265eval $setvar;
11266$rm_try'
11267
11268: see whether socket exists
11269socketlib=''
11270sockethdr=''
11271echo " "
11272$echo $n "Hmm... $c" >&4
11273if set socket val -f d_socket; eval $csym; $val; then
11274	echo "Looks like you have Berkeley networking support." >&4
11275	d_socket="$define"
11276	if set setsockopt val -f; eval $csym; $val; then
11277		d_oldsock="$undef"
11278	else
11279		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11280		d_oldsock="$define"
11281	fi
11282else
11283	if $contains socklib libc.list >/dev/null 2>&1; then
11284		echo "Looks like you have Berkeley networking support." >&4
11285		d_socket="$define"
11286		: we will have to assume that it supports the 4.2 BSD interface
11287		d_oldsock="$undef"
11288	else
11289		echo "You don't have Berkeley networking in libc$_a..." >&4
11290		if test "X$d_socket" = "X$define"; then
11291		   echo "...but you seem to believe that you have sockets." >&4
11292		else
11293			for net in net socket
11294			do
11295				if test -f /usr/lib/lib$net$_a; then
11296					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11297					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11298					if $contains socket libc.list >/dev/null 2>&1; then
11299						d_socket="$define"
11300						socketlib="-l$net"
11301						case "$net" in
11302						net)
11303							echo "...but the Wollongong group seems to have hacked it in." >&4
11304							sockethdr="-I/usr/netinclude"
11305							;;
11306						esac
11307						echo "Found Berkeley sockets interface in lib$net." >&4
11308						if $contains setsockopt libc.list >/dev/null 2>&1; then
11309							d_oldsock="$undef"
11310						else
11311							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11312							d_oldsock="$define"
11313						fi
11314						break
11315					fi
11316				fi
11317			done
11318			if test "X$d_socket" != "X$define"; then
11319			   echo "or anywhere else I see." >&4
11320			   d_socket="$undef"
11321			   d_oldsock="$undef"
11322			fi
11323		fi
11324	fi
11325fi
11326
11327: see if socketpair exists
11328set socketpair d_sockpair
11329eval $inlibc
11330
11331
11332echo " "
11333echo "Checking the availability sa_len in the sock struct ..." >&4
11334$cat >try.c <<EOF
11335#include <sys/types.h>
11336#include <sys/socket.h>
11337int main() {
11338struct sockaddr sa;
11339return (sa.sa_len);
11340}
11341EOF
11342val="$undef"
11343set try; if eval $compile; then
11344	val="$define"
11345fi
11346set d_sockaddr_sa_len; eval $setvar
11347$rm_try
11348
11349echo " "
11350echo "Checking the availability struct sockaddr_in6 ..." >&4
11351$cat >try.c <<EOF
11352#include <sys/types.h>
11353#include <sys/socket.h>
11354#include <netinet/in.h>
11355int main() {
11356struct sockaddr_in6 sin6;
11357return (sin6.sin6_family);
11358}
11359EOF
11360val="$undef"
11361set try; if eval $compile; then
11362	val="$define"
11363fi
11364set d_sockaddr_in6; eval $setvar
11365$rm_try
11366
11367echo " "
11368echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11369$cat >try.c <<EOF
11370#include <sys/types.h>
11371#include <sys/socket.h>
11372#include <netinet/in.h>
11373int main() {
11374struct sockaddr_in6 sin6;
11375return (sin6.sin6_scope_id);
11376}
11377EOF
11378val="$undef"
11379set try; if eval $compile; then
11380	val="$define"
11381fi
11382set d_sin6_scope_id; eval $setvar
11383$rm_try
11384
11385echo " "
11386echo "Checking the availability struct ipv6_mreq ..." >&4
11387$cat >try.c <<EOF
11388#include <sys/types.h>
11389#include <sys/socket.h>
11390#include <netinet/in.h>
11391int main() {
11392struct ipv6_mreq mreq;
11393return (mreq.ipv6mr_interface);
11394}
11395EOF
11396val="$undef"
11397set try; if eval $compile; then
11398	val="$define"
11399fi
11400set d_ipv6_mreq; eval $setvar
11401$rm_try
11402
11403echo " "
11404echo "Checking the availability of certain socket constants..." >&4
11405for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11406	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11407	$cat >try.c <<EOF
11408#include <sys/types.h>
11409#include <sys/socket.h>
11410int main() {
11411    int i = $ENUM;
11412}
11413EOF
11414	val="$undef"
11415	set try; if eval $compile; then
11416		val="$define"
11417	fi
11418	set d_${enum}; eval $setvar
11419	$rm_try
11420done
11421
11422: see if this is a sys/uio.h system
11423set sys/uio.h i_sysuio
11424eval $inhdr
11425
11426: Check for cmsghdr support
11427echo " "
11428echo "Checking to see if your system supports struct cmsghdr..." >&4
11429set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11430eval $hasstruct
11431case "$d_cmsghdr_s" in
11432"$define")      echo "Yes, it does."   ;;
11433*)              echo "No, it doesn't." ;;
11434esac
11435
11436
11437: check for const keyword
11438echo " "
11439echo 'Checking to see if your C compiler knows about "const"...' >&4
11440$cat >const.c <<'EOCP'
11441typedef struct spug { int drokk; } spug;
11442int main()
11443{
11444	const char *foo;
11445	const spug y = { 0 };
11446}
11447EOCP
11448if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11449	val="$define"
11450	echo "Yup, it does."
11451else
11452	val="$undef"
11453	echo "Nope, it doesn't."
11454fi
11455set d_const
11456eval $setvar
11457
11458: see if copysignl exists
11459set copysignl d_copysignl
11460eval $inlibc
11461
11462: see if crypt exists
11463echo " "
11464set crypt d_crypt
11465eval $inlibc
11466case "$d_crypt" in
11467$define) cryptlib='' ;;
11468*)	if set crypt val -f d_crypt; eval $csym; $val; then
11469		echo 'crypt() found.' >&4
11470		val="$define"
11471		cryptlib=''
11472	else
11473		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11474		if $test -z "$cryptlib"; then
11475			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11476		else
11477			cryptlib=-lcrypt
11478		fi
11479		if $test -z "$cryptlib"; then
11480			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11481		else
11482			cryptlib=-lcrypt
11483		fi
11484		if $test -z "$cryptlib"; then
11485			cryptlib=`./loc libcrypt$_a "" $libpth`
11486		else
11487			cryptlib=-lcrypt
11488		fi
11489		if $test -z "$cryptlib"; then
11490			echo 'crypt() NOT found.' >&4
11491			val="$undef"
11492		else
11493			val="$define"
11494		fi
11495	fi
11496	set d_crypt
11497	eval $setvar
11498	;;
11499esac
11500
11501: see if this is a crypt.h system
11502set crypt.h i_crypt
11503eval $inhdr
11504
11505: see if crypt_r exists
11506set crypt_r d_crypt_r
11507eval $inlibc
11508case "$d_crypt_r" in
11509"$define")
11510	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11511	case "$d_crypt_r_proto:$usethreads" in
11512	":define")	d_crypt_r_proto=define
11513		set d_crypt_r_proto crypt_r $hdrs
11514		eval $hasproto ;;
11515	*)	;;
11516	esac
11517	case "$d_crypt_r_proto" in
11518	define)
11519	case "$crypt_r_proto" in
11520	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11521	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11522	esac
11523	case "$crypt_r_proto" in
11524	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11525	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11526	esac
11527	case "$crypt_r_proto" in
11528	''|0)	d_crypt_r=undef
11529 	        crypt_r_proto=0
11530		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11531	* )	case "$crypt_r_proto" in
11532		REENTRANT_PROTO*) ;;
11533		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11534		esac
11535		echo "Prototype: $try" ;;
11536	esac
11537	;;
11538	*)	case "$usethreads" in
11539		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11540		esac
11541		d_crypt_r=undef
11542		crypt_r_proto=0
11543		;;
11544	esac
11545	;;
11546*)	crypt_r_proto=0
11547	;;
11548esac
11549
11550: get csh whereabouts
11551case "$csh" in
11552'csh') val="$undef" ;;
11553*) val="$define" ;;
11554esac
11555set d_csh
11556eval $setvar
11557: Respect a hint or command line value for full_csh.
11558case "$full_csh" in
11559'') full_csh=$csh ;;
11560esac
11561
11562: see if ctermid exists
11563set ctermid d_ctermid
11564eval $inlibc
11565
11566: see if ctermid_r exists
11567set ctermid_r d_ctermid_r
11568eval $inlibc
11569case "$d_ctermid_r" in
11570"$define")
11571	hdrs="$i_systypes sys/types.h define stdio.h "
11572	case "$d_ctermid_r_proto:$usethreads" in
11573	":define")	d_ctermid_r_proto=define
11574		set d_ctermid_r_proto ctermid_r $hdrs
11575		eval $hasproto ;;
11576	*)	;;
11577	esac
11578	case "$d_ctermid_r_proto" in
11579	define)
11580	case "$ctermid_r_proto" in
11581	''|0) try='char* ctermid_r(char*);'
11582	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11583	esac
11584	case "$ctermid_r_proto" in
11585	''|0)	d_ctermid_r=undef
11586 	        ctermid_r_proto=0
11587		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11588	* )	case "$ctermid_r_proto" in
11589		REENTRANT_PROTO*) ;;
11590		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11591		esac
11592		echo "Prototype: $try" ;;
11593	esac
11594	;;
11595	*)	case "$usethreads" in
11596		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11597		esac
11598		d_ctermid_r=undef
11599		ctermid_r_proto=0
11600		;;
11601	esac
11602	;;
11603*)	ctermid_r_proto=0
11604	;;
11605esac
11606
11607: see if ctime_r exists
11608set ctime_r d_ctime_r
11609eval $inlibc
11610case "$d_ctime_r" in
11611"$define")
11612	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11613	case "$d_ctime_r_proto:$usethreads" in
11614	":define")	d_ctime_r_proto=define
11615		set d_ctime_r_proto ctime_r $hdrs
11616		eval $hasproto ;;
11617	*)	;;
11618	esac
11619	case "$d_ctime_r_proto" in
11620	define)
11621	case "$ctime_r_proto" in
11622	''|0) try='char* ctime_r(const time_t*, char*);'
11623	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11624	esac
11625	case "$ctime_r_proto" in
11626	''|0) try='char* ctime_r(const time_t*, char*, int);'
11627	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11628	esac
11629	case "$ctime_r_proto" in
11630	''|0) try='int ctime_r(const time_t*, char*);'
11631	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11632	esac
11633	case "$ctime_r_proto" in
11634	''|0) try='int ctime_r(const time_t*, char*, int);'
11635	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11636	esac
11637	case "$ctime_r_proto" in
11638	''|0)	d_ctime_r=undef
11639 	        ctime_r_proto=0
11640		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11641	* )	case "$ctime_r_proto" in
11642		REENTRANT_PROTO*) ;;
11643		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11644		esac
11645		echo "Prototype: $try" ;;
11646	esac
11647	;;
11648	*)	case "$usethreads" in
11649		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11650		esac
11651		d_ctime_r=undef
11652		ctime_r_proto=0
11653		;;
11654	esac
11655	;;
11656*)	ctime_r_proto=0
11657	;;
11658esac
11659
11660: see if cuserid exists
11661set cuserid d_cuserid
11662eval $inlibc
11663
11664: see if this is a limits.h system
11665set limits.h i_limits
11666eval $inhdr
11667
11668: see if this is a float.h system
11669set float.h i_float
11670eval $inhdr
11671
11672: See if number of significant digits in a double precision number is known
11673echo " "
11674$cat >dbl_dig.c <<EOM
11675#$i_limits I_LIMITS
11676#$i_float I_FLOAT
11677#ifdef I_LIMITS
11678#include <limits.h>
11679#endif
11680#ifdef I_FLOAT
11681#include <float.h>
11682#endif
11683#ifdef DBL_DIG
11684printf("Contains DBL_DIG");
11685#endif
11686EOM
11687$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11688if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11689	echo "DBL_DIG found." >&4
11690	val="$define"
11691else
11692	echo "DBL_DIG NOT found." >&4
11693	val="$undef"
11694fi
11695$rm -f dbl_dig.?
11696set d_dbl_dig
11697eval $setvar
11698
11699: see if dbm.h is available
11700: see if dbmclose exists
11701set dbmclose d_dbmclose
11702eval $inlibc
11703
11704case "$d_dbmclose" in
11705$define)
11706	set dbm.h i_dbm
11707	eval $inhdr
11708	case "$i_dbm" in
11709	$define)
11710		val="$undef"
11711		set i_rpcsvcdbm
11712		eval $setvar
11713		;;
11714	*)	set rpcsvc/dbm.h i_rpcsvcdbm
11715		eval $inhdr
11716		;;
11717	esac
11718	;;
11719*)	echo "We won't be including <dbm.h>"
11720	val="$undef"
11721	set i_dbm
11722	eval $setvar
11723	val="$undef"
11724	set i_rpcsvcdbm
11725	eval $setvar
11726	;;
11727esac
11728
11729: see if prototype for dbminit is available
11730echo " "
11731set d_dbminitproto dbminit $i_dbm dbm.h
11732eval $hasproto
11733
11734: see if difftime exists
11735set difftime d_difftime
11736eval $inlibc
11737
11738: see if this is a dirent system
11739echo " "
11740if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11741	val="$define"
11742	echo "<dirent.h> found." >&4
11743else
11744	val="$undef"
11745	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11746		echo "<sys/dir.h> found." >&4
11747		echo " "
11748	else
11749		xinc=`./findhdr sys/ndir.h`
11750	fi
11751	echo "<dirent.h> NOT found." >&4
11752fi
11753set i_dirent
11754eval $setvar
11755
11756: Look for type of directory structure.
11757echo " "
11758$cppstdin $cppflags $cppminus < "$xinc" > try.c
11759
11760case "$direntrytype" in
11761''|' ')
11762	case "$i_dirent" in
11763	$define) guess1='struct dirent' ;;
11764	*) guess1='struct direct'  ;;
11765	esac
11766	;;
11767*)	guess1="$direntrytype"
11768	;;
11769esac
11770
11771case "$guess1" in
11772'struct dirent') guess2='struct direct' ;;
11773*) guess2='struct dirent' ;;
11774esac
11775
11776if $contains "$guess1" try.c >/dev/null 2>&1; then
11777	direntrytype="$guess1"
11778	echo "Your directory entries are $direntrytype." >&4
11779elif $contains "$guess2" try.c >/dev/null 2>&1; then
11780	direntrytype="$guess2"
11781	echo "Your directory entries seem to be $direntrytype." >&4
11782else
11783	echo "I don't recognize your system's directory entries." >&4
11784	rp="What type is used for directory entries on this system?"
11785	dflt="$guess1"
11786	. ./myread
11787	direntrytype="$ans"
11788fi
11789$rm_try
11790
11791: see if the directory entry stores field length
11792echo " "
11793$cppstdin $cppflags $cppminus < "$xinc" > try.c
11794if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11795	echo "Good, your directory entry keeps length information in d_namlen." >&4
11796	val="$define"
11797else
11798	echo "Your directory entry does not know about the d_namlen field." >&4
11799	val="$undef"
11800fi
11801set d_dirnamlen
11802eval $setvar
11803$rm_try
11804
11805: Look for DIR.dd_fd
11806case "$i_dirent" in
11807"$define")
11808    echo "Checking to see if DIR has a dd_fd member variable" >&4
11809    $cat >try.c <<EOCP
11810#$i_stdlib I_STDLIB
11811#ifdef I_STDLIB
11812#include <stdlib.h>
11813#endif
11814#include <dirent.h>
11815
11816int main() {
11817    DIR dir;
11818    dir.dd_fd = 1;
11819    return 0;
11820}
11821EOCP
11822    val=$undef
11823    set try
11824    if eval $compile; then
11825        echo "Yes, it does."
11826        val="$define"
11827    else
11828        echo "No, it does not."
11829        val="$undef"
11830    fi
11831    ;;
11832*)
11833    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11834    val="$undef"
11835    ;;
11836esac
11837set d_dir_dd_fd
11838eval $setvar
11839$rm_try
11840
11841: see if this is an sysdir system
11842set sys/dir.h i_sysdir
11843eval $inhdr
11844
11845: see if this is an sysndir system
11846set sys/ndir.h i_sysndir
11847eval $inhdr
11848
11849: Look for dirfd
11850echo " "
11851$cat >dirfd.c <<EOM
11852#include <stdio.h>
11853#$i_stdlib I_STDLIB
11854#ifdef I_STDLIB
11855#include <stdlib.h>
11856#endif
11857#$i_dirent I_DIRENT		/**/
11858#$i_sysdir I_SYS_DIR		/**/
11859#$i_sysndir I_SYS_NDIR		/**/
11860#$i_systypes I_SYS_TYPES	/**/
11861#if defined(I_SYS_TYPES)
11862#include <sys/types.h>
11863#endif
11864#if defined(I_DIRENT)
11865#include <dirent.h>
11866#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11867#include <sys/dir.h>
11868#endif
11869#else
11870#ifdef I_SYS_NDIR
11871#include <sys/ndir.h>
11872#else
11873#ifdef I_SYS_DIR
11874#ifdef hp9000s500
11875#include <ndir.h>	/* may be wrong in the future */
11876#else
11877#include <sys/dir.h>
11878#endif
11879#endif
11880#endif
11881#endif 
11882int main() {
11883	DIR *dirp = opendir(".");
11884	if (dirfd(dirp) >= 0)
11885		exit(0);
11886	else
11887		exit(1);
11888}
11889EOM
11890val=$undef
11891set dirfd
11892if eval $compile; then
11893	val="$define"
11894fi
11895case "$val" in
11896$define)	echo "dirfd() found." >&4	;;
11897*)		echo "dirfd() NOT found." >&4	;;
11898esac
11899set d_dirfd
11900eval $setvar
11901$rm -f dirfd*
11902
11903: see if dlerror exists
11904xxx_runnm="$runnm"
11905runnm=false
11906set dlerror d_dlerror
11907eval $inlibc
11908runnm="$xxx_runnm"
11909
11910: see if dlfcn is available
11911set dlfcn.h i_dlfcn
11912eval $inhdr
11913
11914: Check what extension to use for shared libs
11915case "$usedl" in
11916$define|y|true)
11917	$cat << EOM
11918
11919On a few systems, the dynamically loaded modules that perl generates and uses
11920will need a different extension than shared libs. The default will probably
11921be appropriate.
11922
11923EOM
11924	case "$dlext" in
11925	'')	dflt="$so" ;;
11926	*)	dflt="$dlext" ;;
11927	esac
11928	rp='What is the extension of dynamically loaded modules'
11929	. ./myread
11930	dlext="$ans"
11931	;;
11932*)
11933	dlext="none"
11934	;;
11935esac
11936
11937: Check if dlsym need a leading underscore
11938echo " "
11939val="$undef"
11940
11941case "$dlsrc" in
11942dl_dlopen.xs)
11943	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11944	$cat >dyna.c <<'EOM'
11945fred () { }
11946EOM
11947
11948$cat >fred.c<<EOM
11949
11950#include <stdio.h>
11951#$i_stdlib I_STDLIB
11952#ifdef I_STDLIB
11953#include <stdlib.h>
11954#endif
11955#$i_dlfcn I_DLFCN
11956#ifdef I_DLFCN
11957#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11958#else
11959#include <sys/types.h>
11960#include <nlist.h>
11961#include <link.h>
11962#endif
11963
11964extern int fred() ;
11965
11966int main()
11967{
11968    void * handle ;
11969    void * symbol ;
11970#ifndef RTLD_LAZY
11971    int mode = 1 ;
11972#else
11973    int mode = RTLD_LAZY ;
11974#endif
11975    handle = dlopen("./dyna.$dlext", mode) ;
11976    if (handle == NULL) {
11977	printf ("1\n") ;
11978	fflush (stdout) ;
11979	exit(0);
11980    }
11981    symbol = dlsym(handle, "fred") ;
11982    if (symbol == NULL) {
11983	/* try putting a leading underscore */
11984	symbol = dlsym(handle, "_fred") ;
11985	if (symbol == NULL) {
11986	    printf ("2\n") ;
11987	    fflush (stdout) ;
11988	    exit(0);
11989	}
11990	printf ("3\n") ;
11991    }
11992    else
11993	printf ("4\n") ;
11994    fflush (stdout) ;
11995    exit(0);
11996}
11997EOM
11998	: Call the object file tmp-dyna.o in case dlext=o.
11999	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12000		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12001		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12002		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12003		xxx=`$run ./fred`
12004		case $xxx in
12005		1)	echo "Test program failed using dlopen." >&4
12006			echo "Perhaps you should not use dynamic loading." >&4;;
12007		2)	echo "Test program failed using dlsym." >&4
12008			echo "Perhaps you should not use dynamic loading." >&4;;
12009		3)	echo "dlsym needs a leading underscore" >&4
12010			val="$define" ;;
12011		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12012		esac
12013	else
12014		echo "I can't compile and run the test program." >&4
12015                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12016	fi
12017	;;
12018esac
12019
12020$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12021
12022set d_dlsymun
12023eval $setvar
12024
12025: see if drand48_r exists
12026set drand48_r d_drand48_r
12027eval $inlibc
12028case "$d_drand48_r" in
12029"$define")
12030	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12031	case "$d_drand48_r_proto:$usethreads" in
12032	":define")	d_drand48_r_proto=define
12033		set d_drand48_r_proto drand48_r $hdrs
12034		eval $hasproto ;;
12035	*)	;;
12036	esac
12037	case "$d_drand48_r_proto" in
12038	define)
12039	case "$drand48_r_proto" in
12040	''|0) try='int drand48_r(struct drand48_data*, double*);'
12041	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12042	esac
12043	case "$drand48_r_proto" in
12044	''|0)	d_drand48_r=undef
12045 	        drand48_r_proto=0
12046		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12047	* )	case "$drand48_r_proto" in
12048		REENTRANT_PROTO*) ;;
12049		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12050		esac
12051		echo "Prototype: $try" ;;
12052	esac
12053	;;
12054	*)	case "$usethreads" in
12055		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12056		esac
12057		d_drand48_r=undef
12058		drand48_r_proto=0
12059		;;
12060	esac
12061	;;
12062*)	drand48_r_proto=0
12063	;;
12064esac
12065
12066: see if prototype for drand48 is available
12067echo " "
12068set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12069eval $hasproto
12070
12071: see if dup2 exists
12072set dup2 d_dup2
12073eval $inlibc
12074
12075: see if eaccess exists
12076set eaccess d_eaccess
12077eval $inlibc
12078
12079: see if endgrent exists
12080set endgrent d_endgrent
12081eval $inlibc
12082
12083: see if this is an grp system
12084set grp.h i_grp
12085eval $inhdr
12086
12087case "$i_grp" in
12088$define)
12089	xxx=`./findhdr grp.h`
12090	$cppstdin $cppflags $cppminus < $xxx >$$.h
12091
12092	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12093		val="$define"
12094	else
12095		val="$undef"
12096	fi
12097	set d_grpasswd
12098	eval $setvar
12099
12100	$rm -f $$.h
12101	;;
12102*)
12103	val="$undef";
12104	set d_grpasswd; eval $setvar
12105	;;
12106esac
12107
12108: see if endgrent_r exists
12109set endgrent_r d_endgrent_r
12110eval $inlibc
12111case "$d_endgrent_r" in
12112"$define")
12113	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12114	case "$d_endgrent_r_proto:$usethreads" in
12115	":define")	d_endgrent_r_proto=define
12116		set d_endgrent_r_proto endgrent_r $hdrs
12117		eval $hasproto ;;
12118	*)	;;
12119	esac
12120	case "$d_endgrent_r_proto" in
12121	define)
12122	case "$endgrent_r_proto" in
12123	''|0) try='int endgrent_r(FILE**);'
12124	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12125	esac
12126	case "$endgrent_r_proto" in
12127	''|0) try='void endgrent_r(FILE**);'
12128	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12129	esac
12130	case "$endgrent_r_proto" in
12131	''|0)	d_endgrent_r=undef
12132 	        endgrent_r_proto=0
12133		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12134	* )	case "$endgrent_r_proto" in
12135		REENTRANT_PROTO*) ;;
12136		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12137		esac
12138		echo "Prototype: $try" ;;
12139	esac
12140	;;
12141	*)	case "$usethreads" in
12142		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12143		esac
12144		d_endgrent_r=undef
12145		endgrent_r_proto=0
12146		;;
12147	esac
12148	;;
12149*)	endgrent_r_proto=0
12150	;;
12151esac
12152
12153: see if endhostent exists
12154set endhostent d_endhent
12155eval $inlibc
12156
12157: see if this is a netdb.h system
12158set netdb.h i_netdb
12159eval $inhdr
12160
12161: see if endhostent_r exists
12162set endhostent_r d_endhostent_r
12163eval $inlibc
12164case "$d_endhostent_r" in
12165"$define")
12166	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12167	case "$d_endhostent_r_proto:$usethreads" in
12168	":define")	d_endhostent_r_proto=define
12169		set d_endhostent_r_proto endhostent_r $hdrs
12170		eval $hasproto ;;
12171	*)	;;
12172	esac
12173	case "$d_endhostent_r_proto" in
12174	define)
12175	case "$endhostent_r_proto" in
12176	''|0) try='int endhostent_r(struct hostent_data*);'
12177	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12178	esac
12179	case "$endhostent_r_proto" in
12180	''|0) try='void endhostent_r(struct hostent_data*);'
12181	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12182	esac
12183	case "$endhostent_r_proto" in
12184	''|0)	d_endhostent_r=undef
12185 	        endhostent_r_proto=0
12186		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12187	* )	case "$endhostent_r_proto" in
12188		REENTRANT_PROTO*) ;;
12189		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12190		esac
12191		echo "Prototype: $try" ;;
12192	esac
12193	;;
12194	*)	case "$usethreads" in
12195		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12196		esac
12197		d_endhostent_r=undef
12198		endhostent_r_proto=0
12199		;;
12200	esac
12201	;;
12202*)	endhostent_r_proto=0
12203	;;
12204esac
12205
12206: see if endnetent exists
12207set endnetent d_endnent
12208eval $inlibc
12209
12210: see if endnetent_r exists
12211set endnetent_r d_endnetent_r
12212eval $inlibc
12213case "$d_endnetent_r" in
12214"$define")
12215	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12216	case "$d_endnetent_r_proto:$usethreads" in
12217	":define")	d_endnetent_r_proto=define
12218		set d_endnetent_r_proto endnetent_r $hdrs
12219		eval $hasproto ;;
12220	*)	;;
12221	esac
12222	case "$d_endnetent_r_proto" in
12223	define)
12224	case "$endnetent_r_proto" in
12225	''|0) try='int endnetent_r(struct netent_data*);'
12226	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12227	esac
12228	case "$endnetent_r_proto" in
12229	''|0) try='void endnetent_r(struct netent_data*);'
12230	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12231	esac
12232	case "$endnetent_r_proto" in
12233	''|0)	d_endnetent_r=undef
12234 	        endnetent_r_proto=0
12235		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12236	* )	case "$endnetent_r_proto" in
12237		REENTRANT_PROTO*) ;;
12238		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12239		esac
12240		echo "Prototype: $try" ;;
12241	esac
12242	;;
12243	*)	case "$usethreads" in
12244		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12245		esac
12246		d_endnetent_r=undef
12247		endnetent_r_proto=0
12248		;;
12249	esac
12250	;;
12251*)	endnetent_r_proto=0
12252	;;
12253esac
12254
12255: see if endprotoent exists
12256set endprotoent d_endpent
12257eval $inlibc
12258
12259: see if endprotoent_r exists
12260set endprotoent_r d_endprotoent_r
12261eval $inlibc
12262case "$d_endprotoent_r" in
12263"$define")
12264	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12265	case "$d_endprotoent_r_proto:$usethreads" in
12266	":define")	d_endprotoent_r_proto=define
12267		set d_endprotoent_r_proto endprotoent_r $hdrs
12268		eval $hasproto ;;
12269	*)	;;
12270	esac
12271	case "$d_endprotoent_r_proto" in
12272	define)
12273	case "$endprotoent_r_proto" in
12274	''|0) try='int endprotoent_r(struct protoent_data*);'
12275	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12276	esac
12277	case "$endprotoent_r_proto" in
12278	''|0) try='void endprotoent_r(struct protoent_data*);'
12279	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12280	esac
12281	case "$endprotoent_r_proto" in
12282	''|0)	d_endprotoent_r=undef
12283 	        endprotoent_r_proto=0
12284		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12285	* )	case "$endprotoent_r_proto" in
12286		REENTRANT_PROTO*) ;;
12287		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12288		esac
12289		echo "Prototype: $try" ;;
12290	esac
12291	;;
12292	*)	case "$usethreads" in
12293		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12294		esac
12295		d_endprotoent_r=undef
12296		endprotoent_r_proto=0
12297		;;
12298	esac
12299	;;
12300*)	endprotoent_r_proto=0
12301	;;
12302esac
12303
12304: see if endpwent exists
12305set endpwent d_endpwent
12306eval $inlibc
12307
12308: see if this is a pwd.h system
12309set pwd.h i_pwd
12310eval $inhdr
12311
12312case "$i_pwd" in
12313$define)
12314	xxx=`./findhdr pwd.h`
12315	$cppstdin $cppflags $cppminus < $xxx >$$.h
12316
12317	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12318		val="$define"
12319	else
12320		val="$undef"
12321	fi
12322	set d_pwquota
12323	eval $setvar
12324
12325	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12326		val="$define"
12327	else
12328		val="$undef"
12329	fi
12330	set d_pwage
12331	eval $setvar
12332
12333	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12334		val="$define"
12335	else
12336		val="$undef"
12337	fi
12338	set d_pwchange
12339	eval $setvar
12340
12341	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12342		val="$define"
12343	else
12344		val="$undef"
12345	fi
12346	set d_pwclass
12347	eval $setvar
12348
12349	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12350		val="$define"
12351	else
12352		val="$undef"
12353	fi
12354	set d_pwexpire
12355	eval $setvar
12356
12357	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12358		val="$define"
12359	else
12360		val="$undef"
12361	fi
12362	set d_pwcomment
12363	eval $setvar
12364
12365	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12366		val="$define"
12367	else
12368		val="$undef"
12369	fi
12370	set d_pwgecos
12371	eval $setvar
12372
12373	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12374		val="$define"
12375	else
12376		val="$undef"
12377	fi
12378	set d_pwpasswd
12379	eval $setvar
12380
12381	$rm -f $$.h
12382	;;
12383*)
12384	val="$undef";
12385	set d_pwquota; eval $setvar
12386	set d_pwage; eval $setvar
12387	set d_pwchange; eval $setvar
12388	set d_pwclass; eval $setvar
12389	set d_pwexpire; eval $setvar
12390	set d_pwcomment; eval $setvar
12391	set d_pwgecos; eval $setvar
12392	set d_pwpasswd; eval $setvar
12393	;;
12394esac
12395
12396: see if endpwent_r exists
12397set endpwent_r d_endpwent_r
12398eval $inlibc
12399case "$d_endpwent_r" in
12400"$define")
12401	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12402	case "$d_endpwent_r_proto:$usethreads" in
12403	":define")	d_endpwent_r_proto=define
12404		set d_endpwent_r_proto endpwent_r $hdrs
12405		eval $hasproto ;;
12406	*)	;;
12407	esac
12408	case "$d_endpwent_r_proto" in
12409	define)
12410	case "$endpwent_r_proto" in
12411	''|0) try='int endpwent_r(FILE**);'
12412	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12413	esac
12414	case "$endpwent_r_proto" in
12415	''|0) try='void endpwent_r(FILE**);'
12416	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12417	esac
12418	case "$endpwent_r_proto" in
12419	''|0)	d_endpwent_r=undef
12420 	        endpwent_r_proto=0
12421		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12422	* )	case "$endpwent_r_proto" in
12423		REENTRANT_PROTO*) ;;
12424		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12425		esac
12426		echo "Prototype: $try" ;;
12427	esac
12428	;;
12429	*)	case "$usethreads" in
12430		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12431		esac
12432		d_endpwent_r=undef
12433		endpwent_r_proto=0
12434		;;
12435	esac
12436	;;
12437*)	endpwent_r_proto=0
12438	;;
12439esac
12440
12441: see if endservent exists
12442set endservent d_endsent
12443eval $inlibc
12444
12445: see if endservent_r exists
12446set endservent_r d_endservent_r
12447eval $inlibc
12448case "$d_endservent_r" in
12449"$define")
12450	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12451	case "$d_endservent_r_proto:$usethreads" in
12452	":define")	d_endservent_r_proto=define
12453		set d_endservent_r_proto endservent_r $hdrs
12454		eval $hasproto ;;
12455	*)	;;
12456	esac
12457	case "$d_endservent_r_proto" in
12458	define)
12459	case "$endservent_r_proto" in
12460	''|0) try='int endservent_r(struct servent_data*);'
12461	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12462	esac
12463	case "$endservent_r_proto" in
12464	''|0) try='void endservent_r(struct servent_data*);'
12465	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12466	esac
12467	case "$endservent_r_proto" in
12468	''|0)	d_endservent_r=undef
12469 	        endservent_r_proto=0
12470		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12471	* )	case "$endservent_r_proto" in
12472		REENTRANT_PROTO*) ;;
12473		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12474		esac
12475		echo "Prototype: $try" ;;
12476	esac
12477	;;
12478	*)	case "$usethreads" in
12479		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12480		esac
12481		d_endservent_r=undef
12482		endservent_r_proto=0
12483		;;
12484	esac
12485	;;
12486*)	endservent_r_proto=0
12487	;;
12488esac
12489
12490: Locate the flags for 'open()'
12491echo " "
12492$cat >try.c <<EOCP
12493#include <sys/types.h>
12494#ifdef I_FCNTL
12495#include <fcntl.h>
12496#endif
12497#ifdef I_SYS_FILE
12498#include <sys/file.h>
12499#endif
12500#$i_stdlib I_STDLIB
12501#ifdef I_STDLIB
12502#include <stdlib.h>
12503#endif
12504int main() {
12505	if(O_RDONLY);
12506#ifdef O_TRUNC
12507	exit(0);
12508#else
12509	exit(1);
12510#endif
12511}
12512EOCP
12513: check sys/file.h first to get FREAD on Sun
12514if $test `./findhdr sys/file.h` && \
12515		set try -DI_SYS_FILE && eval $compile; then
12516	h_sysfile=true;
12517	echo "<sys/file.h> defines the O_* constants..." >&4
12518	if $run ./try; then
12519		echo "and you have the 3 argument form of open()." >&4
12520		val="$define"
12521	else
12522		echo "but not the 3 argument form of open().  Oh, well." >&4
12523		val="$undef"
12524	fi
12525elif $test `./findhdr fcntl.h` && \
12526		set try -DI_FCNTL && eval $compile; then
12527	h_fcntl=true;
12528	echo "<fcntl.h> defines the O_* constants..." >&4
12529	if $run ./try; then
12530		echo "and you have the 3 argument form of open()." >&4
12531		val="$define"
12532	else
12533		echo "but not the 3 argument form of open().  Oh, well." >&4
12534		val="$undef"
12535	fi
12536else
12537	val="$undef"
12538	echo "I can't find the O_* constant definitions!  You got problems." >&4
12539fi
12540set d_open3
12541eval $setvar
12542$rm_try
12543
12544: see if this is a sys/file.h system
12545val=''
12546set sys/file.h val
12547eval $inhdr
12548
12549: do we need to include sys/file.h ?
12550case "$val" in
12551"$define")
12552	echo " "
12553	if $h_sysfile; then
12554		val="$define"
12555		echo "We'll be including <sys/file.h>." >&4
12556	else
12557		val="$undef"
12558		echo "We won't be including <sys/file.h>." >&4
12559	fi
12560	;;
12561*)
12562	h_sysfile=false
12563	;;
12564esac
12565set i_sysfile
12566eval $setvar
12567
12568: see if fcntl.h is there
12569val=''
12570set fcntl.h val
12571eval $inhdr
12572
12573: see if we can include fcntl.h
12574case "$val" in
12575"$define")
12576	echo " "
12577	if $h_fcntl; then
12578		val="$define"
12579		echo "We'll be including <fcntl.h>." >&4
12580	else
12581		val="$undef"
12582		if $h_sysfile; then
12583	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12584		else
12585			echo "We won't be including <fcntl.h>." >&4
12586		fi
12587	fi
12588	;;
12589*)
12590	h_fcntl=false
12591	val="$undef"
12592	;;
12593esac
12594set i_fcntl
12595eval $setvar
12596
12597: see if fork exists
12598set fork d_fork
12599eval $inlibc
12600
12601: see if pipe exists
12602set pipe d_pipe
12603eval $inlibc
12604
12605: check for non-blocking I/O stuff
12606case "$h_sysfile" in
12607true) echo "#include <sys/file.h>" > head.c;;
12608*)
12609       case "$h_fcntl" in
12610       true) echo "#include <fcntl.h>" > head.c;;
12611       *) echo "#include <sys/fcntl.h>" > head.c;;
12612       esac
12613       ;;
12614esac
12615echo " "
12616echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12617case "$o_nonblock" in
12618'')
12619	$cat head.c > try.c
12620	$cat >>try.c <<EOCP
12621#include <stdio.h>
12622#$i_stdlib I_STDLIB
12623#ifdef I_STDLIB
12624#include <stdlib.h>
12625#endif
12626#$i_fcntl I_FCNTL
12627#ifdef I_FCNTL
12628#include <fcntl.h>
12629#endif
12630int main() {
12631#ifdef O_NONBLOCK
12632	printf("O_NONBLOCK\n");
12633	exit(0);
12634#endif
12635#ifdef O_NDELAY
12636	printf("O_NDELAY\n");
12637	exit(0);
12638#endif
12639#ifdef FNDELAY
12640	printf("FNDELAY\n");
12641	exit(0);
12642#endif
12643	exit(0);
12644}
12645EOCP
12646	set try
12647	if eval $compile_ok; then
12648		o_nonblock=`$run ./try`
12649		case "$o_nonblock" in
12650		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12651		*) echo "Seems like we can use $o_nonblock.";;
12652		esac
12653	else
12654		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12655	fi
12656	;;
12657*) echo "Using $hint value $o_nonblock.";;
12658esac
12659$rm_try
12660
12661echo " "
12662echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12663case "$eagain" in
12664'')
12665	case "$d_fork:$d_pipe" in
12666	define:define)
12667	$cat head.c > try.c
12668	$cat >>try.c <<EOCP
12669#include <errno.h>
12670#include <sys/types.h>
12671#include <signal.h>
12672#include <stdio.h>
12673#$i_stdlib I_STDLIB
12674#ifdef I_STDLIB
12675#include <stdlib.h>
12676#endif
12677#$i_fcntl I_FCNTL
12678#ifdef I_FCNTL
12679#include <fcntl.h>
12680#endif
12681#define MY_O_NONBLOCK $o_nonblock
12682#ifndef errno  /* XXX need better Configure test */
12683extern int errno;
12684#endif
12685#$i_unistd I_UNISTD
12686#ifdef I_UNISTD
12687#include <unistd.h>
12688#endif
12689#$i_string I_STRING
12690#ifdef I_STRING
12691#include <string.h>
12692#else
12693#include <strings.h>
12694#endif
12695$signal_t blech(int x) { exit(3); }
12696EOCP
12697	$cat >> try.c <<'EOCP'
12698int main()
12699{
12700	int pd[2];
12701	int pu[2];
12702	char buf[1];
12703	char string[100];
12704
12705	pipe(pd);	/* Down: child -> parent */
12706	pipe(pu);	/* Up: parent -> child */
12707	if (0 != fork()) {
12708		int ret;
12709		close(pd[1]);	/* Parent reads from pd[0] */
12710		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
12711#ifdef F_SETFL
12712		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12713			exit(1);
12714#else
12715		exit(4);
12716#endif
12717		signal(SIGALRM, blech);
12718		alarm(5);
12719		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
12720			exit(2);
12721		sprintf(string, "%d\n", ret);
12722		write(2, string, strlen(string));
12723		alarm(0);
12724#ifdef EAGAIN
12725		if (errno == EAGAIN) {
12726			printf("EAGAIN\n");
12727			goto ok;
12728		}
12729#endif
12730#ifdef EWOULDBLOCK
12731		if (errno == EWOULDBLOCK)
12732			printf("EWOULDBLOCK\n");
12733#endif
12734	ok:
12735		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
12736		sleep(2);				/* Give it time to close our pipe */
12737		alarm(5);
12738		ret = read(pd[0], buf, 1);	/* Should read EOF */
12739		alarm(0);
12740		sprintf(string, "%d\n", ret);
12741		write(4, string, strlen(string));
12742		exit(0);
12743	}
12744
12745	close(pd[0]);			/* We write to pd[1] */
12746	close(pu[1]);			/* We read from pu[0] */
12747	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
12748	close(pd[1]);			/* Pipe pd is now fully closed! */
12749	exit(0);				/* Bye bye, thank you for playing! */
12750}
12751EOCP
12752	set try
12753	if eval $compile_ok; then
12754		echo "$startsh" >mtry
12755		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12756		chmod +x mtry
12757		./mtry >/dev/null 2>&1
12758		case $? in
12759		0) eagain=`$cat try.out`;;
12760		1) echo "Could not perform non-blocking setting!";;
12761		2) echo "I did a successful read() for something that was not there!";;
12762		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12763		4) echo "Could not find F_SETFL!";;
12764		*) echo "Something terribly wrong happened during testing.";;
12765		esac
12766		rd_nodata=`$cat try.ret`
12767		echo "A read() system call with no data present returns $rd_nodata."
12768		case "$rd_nodata" in
12769		0|-1) ;;
12770		*)
12771			echo "(That's peculiar, fixing that to be -1.)"
12772			rd_nodata=-1
12773			;;
12774		esac
12775		case "$eagain" in
12776		'')
12777			echo "Forcing errno EAGAIN on read() with no data available."
12778			eagain=EAGAIN
12779			;;
12780		*)
12781			echo "Your read() sets errno to $eagain when no data is available."
12782			;;
12783		esac
12784		status=`$cat try.err`
12785		case "$status" in
12786		0) echo "And it correctly returns 0 to signal EOF.";;
12787		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
12788		*) echo "However, your read() returns '$status' on EOF??";;
12789		esac
12790		val="$define"
12791		if test "$status" = "$rd_nodata"; then
12792			echo "WARNING: you can't distinguish between EOF and no data!"
12793			val="$undef"
12794		fi
12795	else
12796		echo "I can't compile the test program--assuming errno EAGAIN will do."
12797		eagain=EAGAIN
12798	fi
12799	;;
12800	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12801		eagain=EAGAIN
12802		val="$define"
12803		;;
12804	esac
12805	set d_eofnblk
12806	eval $setvar
12807	;;
12808*)
12809	echo "Using $hint value $eagain."
12810	echo "Your read() returns $rd_nodata when no data is present."
12811	case "$d_eofnblk" in
12812	"$define") echo "And you can see EOF because read() returns 0.";;
12813	"$undef") echo "But you can't see EOF status from read() returned value.";;
12814	*)
12815		echo "(Assuming you can't see EOF status from read anyway.)"
12816		d_eofnblk=$undef
12817		;;
12818	esac
12819	;;
12820esac
12821$rm_try head.c mtry
12822
12823: see if _ptr and _cnt from stdio act std
12824echo " "
12825
12826if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12827	echo "(Looks like you have stdio.h from BSD.)"
12828	case "$stdio_ptr" in
12829	'') stdio_ptr='((fp)->_p)'
12830		ptr_lval=$define
12831		;;
12832	*)	ptr_lval=$d_stdio_ptr_lval;;
12833	esac
12834	case "$stdio_cnt" in
12835	'') stdio_cnt='((fp)->_r)'
12836		cnt_lval=$define
12837		;;
12838	*)	cnt_lval=$d_stdio_cnt_lval;;
12839	esac
12840	case "$stdio_base" in
12841	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12842	esac
12843	case "$stdio_bufsiz" in
12844	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12845	esac
12846elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12847	echo "(Looks like you have stdio.h from Linux.)"
12848	case "$stdio_ptr" in
12849	'') stdio_ptr='((fp)->_IO_read_ptr)'
12850		ptr_lval=$define
12851		;;
12852	*)	ptr_lval=$d_stdio_ptr_lval;;
12853	esac
12854	case "$stdio_cnt" in
12855	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12856		cnt_lval=$undef
12857		;;
12858	*)	cnt_lval=$d_stdio_cnt_lval;;
12859	esac
12860	case "$stdio_base" in
12861	'') stdio_base='((fp)->_IO_read_base)';;
12862	esac
12863	case "$stdio_bufsiz" in
12864	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12865	esac
12866else
12867	case "$stdio_ptr" in
12868	'') stdio_ptr='((fp)->_ptr)'
12869		ptr_lval=$define
12870		;;
12871	*)	ptr_lval=$d_stdio_ptr_lval;;
12872	esac
12873	case "$stdio_cnt" in
12874	'') stdio_cnt='((fp)->_cnt)'
12875		cnt_lval=$define
12876		;;
12877	*)	cnt_lval=$d_stdio_cnt_lval;;
12878	esac
12879	case "$stdio_base" in
12880	'') stdio_base='((fp)->_base)';;
12881	esac
12882	case "$stdio_bufsiz" in
12883	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12884	esac
12885fi
12886
12887: test whether _ptr and _cnt really work
12888echo "Checking how std your stdio is..." >&4
12889$cat >try.c <<EOP
12890#include <stdio.h>
12891#$i_stdlib I_STDLIB
12892#ifdef I_STDLIB
12893#include <stdlib.h>
12894#endif
12895#define FILE_ptr(fp)	$stdio_ptr
12896#define FILE_cnt(fp)	$stdio_cnt
12897int main() {
12898	FILE *fp = fopen("try.c", "r");
12899	char c = getc(fp);
12900	if (
12901		18 <= FILE_cnt(fp) &&
12902		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12903	)
12904		exit(0);
12905	exit(1);
12906}
12907EOP
12908val="$undef"
12909set try
12910if eval $compile && $to try.c; then
12911	if $run ./try; then
12912		echo "Your stdio acts pretty std."
12913		val="$define"
12914	else
12915		echo "Your stdio isn't very std."
12916	fi
12917else
12918	echo "Your stdio doesn't appear very std."
12919fi
12920$rm_try
12921
12922# glibc 2.2.90 and above apparently change stdio streams so Perl's
12923# direct buffer manipulation no longer works.  The Configure tests
12924# should be changed to correctly detect this, but until then,
12925# the following check should at least let perl compile and run.
12926# (This quick fix should be updated before 5.8.1.)
12927# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12928# A. Dougherty, June 3, 2002.
12929case "$d_gnulibc" in
12930$define)
12931	case "$gnulibc_version" in
12932	2.[01]*)  ;;
12933	2.2) ;;
12934	2.2.[0-9]) ;;
12935	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12936		val="$undef"
12937		;;
12938	esac
12939	;;
12940esac
12941set d_stdstdio
12942eval $setvar
12943
12944: Can _ptr be used as an lvalue?
12945case "$d_stdstdio$ptr_lval" in
12946$define$define) val=$define ;;
12947*) val=$undef ;;
12948esac
12949set d_stdio_ptr_lval
12950eval $setvar
12951
12952: Can _cnt be used as an lvalue?
12953case "$d_stdstdio$cnt_lval" in
12954$define$define) val=$define ;;
12955*) val=$undef ;;
12956esac
12957set d_stdio_cnt_lval
12958eval $setvar
12959
12960
12961: test whether setting _ptr sets _cnt as a side effect
12962d_stdio_ptr_lval_sets_cnt="$undef"
12963d_stdio_ptr_lval_nochange_cnt="$undef"
12964case "$d_stdio_ptr_lval$d_stdstdio" in
12965$define$define)
12966	echo "Checking to see what happens if we set the stdio ptr..." >&4
12967$cat >try.c <<EOP
12968#include <stdio.h>
12969/* Can we scream? */
12970/* Eat dust sed :-) */
12971/* In the buffer space, no one can hear you scream. */
12972#$i_stdlib I_STDLIB
12973#ifdef I_STDLIB
12974#include <stdlib.h>
12975#endif
12976#define FILE_ptr(fp)	$stdio_ptr
12977#define FILE_cnt(fp)	$stdio_cnt
12978#include <sys/types.h>
12979int main() {
12980	FILE *fp = fopen("try.c", "r");
12981	int c;
12982	char *ptr;
12983	size_t cnt;
12984	if (!fp) {
12985	    puts("Fail even to read");
12986	    exit(1);
12987	}
12988	c = getc(fp); /* Read away the first # */
12989	if (c == EOF) {
12990	    puts("Fail even to read");
12991	    exit(1);
12992	}
12993	if (!(
12994		18 <= FILE_cnt(fp) &&
12995		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12996	)) {
12997		puts("Fail even to read");
12998		exit (1);
12999	}
13000	ptr = (char*) FILE_ptr(fp);
13001	cnt = (size_t)FILE_cnt(fp);
13002
13003	FILE_ptr(fp) += 42;
13004
13005	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13006		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13007		exit (1);
13008	}
13009	if (FILE_cnt(fp) <= 20) {
13010		printf ("Fail (<20 chars to test)");
13011		exit (1);
13012	}
13013	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13014		puts("Fail compare");
13015		exit (1);
13016	}
13017	if (cnt == FILE_cnt(fp)) {
13018		puts("Pass_unchanged");
13019		exit (0);
13020	}
13021	if (FILE_cnt(fp) == (cnt - 42)) {
13022		puts("Pass_changed");
13023		exit (0);
13024	}
13025	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13026	return 1;
13027
13028}
13029EOP
13030	set try
13031	if eval $compile && $to try.c; then
13032 		case `$run ./try` in
13033		Pass_changed)
13034			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13035			d_stdio_ptr_lval_sets_cnt="$define" ;;
13036		Pass_unchanged)
13037			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13038			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13039		Fail*)
13040			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13041		*)
13042			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13043	esac
13044	else
13045		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13046	fi
13047	$rm_try
13048	;;
13049esac
13050
13051: see if _base is also standard
13052val="$undef"
13053case "$d_stdstdio" in
13054$define)
13055	$cat >try.c <<EOP
13056#include <stdio.h>
13057#$i_stdlib I_STDLIB
13058#ifdef I_STDLIB
13059#include <stdlib.h>
13060#endif
13061#define FILE_base(fp)	$stdio_base
13062#define FILE_bufsiz(fp)	$stdio_bufsiz
13063int main() {
13064	FILE *fp = fopen("try.c", "r");
13065	char c = getc(fp);
13066	if (
13067		19 <= FILE_bufsiz(fp) &&
13068		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13069	)
13070		exit(0);
13071	exit(1);
13072}
13073EOP
13074	set try
13075	if eval $compile && $to try.c; then
13076		if $run ./try; then
13077			echo "And its _base field acts std."
13078			val="$define"
13079		else
13080			echo "But its _base field isn't std."
13081		fi
13082	else
13083		echo "However, it seems to be lacking the _base field."
13084	fi
13085	$rm_try
13086	;;
13087esac
13088set d_stdiobase
13089eval $setvar
13090
13091: see if fast_stdio exists
13092val="$undef"
13093case "$d_stdstdio:$d_stdio_ptr_lval" in
13094"$define:$define")
13095	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13096	*$define*)
13097		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13098		val="$define"
13099		;;
13100	esac
13101	;;
13102esac
13103set d_faststdio
13104eval $setvar
13105
13106
13107
13108: see if fchdir exists
13109set fchdir d_fchdir
13110eval $inlibc
13111
13112: see if fchmod exists
13113set fchmod d_fchmod
13114eval $inlibc
13115
13116: see if fchown exists
13117set fchown d_fchown
13118eval $inlibc
13119
13120: see if this is an fcntl system
13121set fcntl d_fcntl
13122eval $inlibc
13123
13124: See if fcntl-based locking works.
13125echo " "
13126$cat >try.c <<EOCP
13127#$i_stdlib I_STDLIB
13128#ifdef I_STDLIB
13129#include <stdlib.h>
13130#endif
13131#include <unistd.h>
13132#include <fcntl.h>
13133#include <signal.h>
13134$signal_t blech(int x) { exit(3); }
13135int main() {
13136#if defined(F_SETLK) && defined(F_SETLKW)
13137     struct flock flock;
13138     int retval, fd;
13139     fd = open("try.c", O_RDONLY);
13140     flock.l_type = F_RDLCK;
13141     flock.l_whence = SEEK_SET;
13142     flock.l_start = flock.l_len = 0;
13143     signal(SIGALRM, blech);
13144     alarm(10);
13145     retval = fcntl(fd, F_SETLK, &flock);
13146     close(fd);
13147     (retval < 0 ? exit(2) : exit(0));
13148#else
13149     exit(2);
13150#endif
13151}
13152EOCP
13153echo "Checking if fcntl-based file locking works... "
13154case "$d_fcntl" in
13155"$define")
13156	set try
13157	if eval $compile_ok; then
13158		if $run ./try; then
13159			echo "Yes, it seems to work."
13160			val="$define"
13161		else
13162			echo "Nope, it didn't work."
13163			val="$undef"
13164			case "$?" in
13165			3) $cat >&4 <<EOM
13166***
13167*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13168*** This is (almost) impossible.
13169*** If your NFS lock daemons are not feeling well, something like
13170*** this may happen, please investigate.  Cannot continue, aborting.
13171***
13172EOM
13173				exit 1
13174				;;
13175			esac
13176		fi
13177	else
13178		echo "I'm unable to compile the test program, so I'll assume not."
13179		val="$undef"
13180	fi
13181	;;
13182*) val="$undef";
13183	echo "Nope, since you don't even have fcntl()."
13184	;;
13185esac
13186set d_fcntl_can_lock
13187eval $setvar
13188$rm_try
13189
13190: check for fd_set items
13191$cat <<EOM
13192
13193Checking to see how well your C compiler handles fd_set and friends ...
13194EOM
13195$cat >try.c <<EOCP
13196#$i_stdlib I_STDLIB
13197#ifdef I_STDLIB
13198#include <stdlib.h>
13199#endif
13200#$i_systime I_SYS_TIME
13201#$i_sysselct I_SYS_SELECT
13202#$d_socket HAS_SOCKET
13203#include <sys/types.h>
13204#ifdef HAS_SOCKET
13205#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13206#endif
13207#ifdef I_SYS_TIME
13208#include <sys/time.h>
13209#endif
13210#ifdef I_SYS_SELECT
13211#include <sys/select.h>
13212#endif
13213int main() {
13214	fd_set fds;
13215
13216#ifdef TRYBITS
13217	if(fds.fds_bits);
13218#endif
13219
13220#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13221	exit(0);
13222#else
13223	exit(1);
13224#endif
13225}
13226EOCP
13227set try -DTRYBITS
13228if eval $compile; then
13229	d_fds_bits="$define"
13230	d_fd_set="$define"
13231	echo "Well, your system knows about the normal fd_set typedef..." >&4
13232	if $run ./try; then
13233		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13234		d_fd_macros="$define"
13235	else
13236		$cat >&4 <<'EOM'
13237but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13238EOM
13239		d_fd_macros="$undef"
13240	fi
13241else
13242	$cat <<'EOM'
13243Hmm, your compiler has some difficulty with fd_set.  Checking further...
13244EOM
13245	set try
13246	if eval $compile; then
13247		d_fds_bits="$undef"
13248		d_fd_set="$define"
13249		echo "Well, your system has some sort of fd_set available..." >&4
13250		if $run ./try; then
13251			echo "and you have the normal fd_set macros." >&4
13252			d_fd_macros="$define"
13253		else
13254			$cat <<'EOM'
13255but not the normal fd_set macros!  Gross!  More work for me...
13256EOM
13257			d_fd_macros="$undef"
13258		fi
13259	else
13260	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13261		d_fd_set="$undef"
13262		d_fds_bits="$undef"
13263		d_fd_macros="$undef"
13264	fi
13265fi
13266$rm_try
13267
13268: see if fgetpos exists
13269set fgetpos d_fgetpos
13270eval $inlibc
13271
13272: see if finite exists
13273set finite d_finite
13274eval $inlibc
13275
13276: see if finitel exists
13277set finitel d_finitel
13278eval $inlibc
13279
13280: see if flock exists
13281set flock d_flock
13282eval $inlibc
13283
13284: see if prototype for flock is available
13285echo " "
13286set d_flockproto flock $i_sysfile sys/file.h
13287eval $hasproto
13288
13289: see if fp_class exists
13290set fp_class d_fp_class
13291eval $inlibc
13292
13293: see if pathconf exists
13294set pathconf d_pathconf
13295eval $inlibc
13296
13297: see if fpathconf exists
13298set fpathconf d_fpathconf
13299eval $inlibc
13300
13301: see if fpclass exists
13302set fpclass d_fpclass
13303eval $inlibc
13304
13305: see if fpclassify exists
13306set fpclassify d_fpclassify
13307eval $inlibc
13308
13309: see if fpclassl exists
13310set fpclassl d_fpclassl
13311eval $inlibc
13312
13313: check for fpos64_t
13314echo " "
13315echo "Checking to see if you have fpos64_t..." >&4
13316$cat >try.c <<EOCP
13317#include <stdio.h>
13318int main() { fpos64_t x = 7; }
13319EOCP
13320set try
13321if eval $compile; then
13322	val="$define"
13323	echo "You have fpos64_t."
13324else
13325	val="$undef"
13326	echo "You do not have fpos64_t."
13327	case "$fpossize" in
13328	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13329	esac
13330fi
13331$rm_try
13332set d_fpos64_t
13333eval $setvar
13334
13335: see if frexpl exists
13336set frexpl d_frexpl
13337eval $inlibc
13338
13339: see if this is a sys/param system
13340set sys/param.h i_sysparam
13341eval $inhdr
13342
13343: see if this is a sys/mount.h system
13344set sys/mount.h i_sysmount
13345eval $inhdr
13346
13347: Check for fs_data_s
13348echo " "
13349echo "Checking to see if your system supports struct fs_data..." >&4
13350set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13351eval $hasstruct
13352case "$d_fs_data_s" in
13353"$define")      echo "Yes, it does."   ;;
13354*)              echo "No, it doesn't." ;;
13355esac
13356
13357: see if fseeko exists
13358set fseeko d_fseeko
13359eval $inlibc
13360case "$longsize" in
133618) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13362esac
13363
13364: see if fsetpos exists
13365set fsetpos d_fsetpos
13366eval $inlibc
13367
13368: see if fstatfs exists
13369set fstatfs d_fstatfs
13370eval $inlibc
13371
13372: see if statvfs exists
13373set statvfs d_statvfs
13374eval $inlibc
13375
13376: see if fstatvfs exists
13377set fstatvfs d_fstatvfs
13378eval $inlibc
13379
13380
13381: see if fsync exists
13382set fsync d_fsync
13383eval $inlibc
13384
13385: see if ftello exists
13386set ftello d_ftello
13387eval $inlibc
13388case "$longsize" in
133898) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13390esac
13391
13392: check for a working futimes
13393d_futimes="$undef"
13394echo " "
13395echo "Checking if you have a working futimes()" >&4
13396$cat >try.c <<EOCP
13397#include <stdio.h>
13398#include <sys/time.h>
13399#include <errno.h>
13400#include <fcntl.h>
13401
13402int main ()
13403{
13404    int fd, rv;
13405    fd = open ("try.c", O_RDWR);
13406    if (-1 == fd) exit (1);
13407    rv = futimes (fd, NULL);
13408    exit (rv == -1 ? errno : 0);
13409}
13410EOCP
13411set try
13412if eval $compile; then
13413    `$run ./try`
13414    rc=$?
13415    case "$rc" in
13416	0)  echo "Yes, you have" >&4
13417	    d_futimes="$define"
13418	    ;;
13419	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13420	    ;;
13421    esac
13422else
13423    echo "No, it does not (probably harmless)" >&4
13424fi
13425$rm_try
13426
13427: see if ndbm.h is available
13428set ndbm.h i_ndbm
13429eval $inhdr
13430: Compatibility location for RedHat 7.1
13431set gdbm/ndbm.h i_gdbmndbm
13432eval $inhdr
13433: Compatibility location for Debian 4.0
13434set gdbm-ndbm.h i_gdbm_ndbm
13435eval $inhdr
13436
13437val="$undef"
13438if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13439	: see if dbm_open exists
13440	set dbm_open d_dbm_open
13441	eval $inlibc
13442	case "$d_dbm_open" in
13443	$undef)
13444		i_ndbm="$undef"
13445		i_gdbmndbm="$undef"
13446		i_gdbm_ndbm="$undef"
13447		echo "We won't be including <ndbm.h>"
13448		val="$undef"
13449		;;
13450	*) val="$define"
13451	   ;;
13452	esac
13453fi
13454set d_ndbm
13455eval $setvar
13456
13457ndbm_hdr_protochk='name=$1; hdr=$2;
13458eval "ihdr=\$""i_$name";
13459val="$undef";
13460if $test "$ihdr" = "$define"; then
13461	$echo "Checking if your <$hdr> uses prototypes..." >&4;
13462	case "$d_cplusplus" in
13463	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13464	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13465	esac;
13466	case "$val" in
13467	$define) $echo "Your <$hdr> seems to have prototypes";;
13468	*) $echo "Your <$hdr> does not seem to have prototypes";;
13469	esac;
13470fi;
13471set "d_${name}_h_uses_prototypes";
13472eval $setvar'
13473
13474set ndbm ndbm.h
13475eval $ndbm_hdr_protochk
13476set gdbmndbm gdbm/ndbm.h
13477eval $ndbm_hdr_protochk
13478set gdbm_ndbm gdbm-ndbm.h
13479eval $ndbm_hdr_protochk
13480
13481: see if getaddrinfo exists
13482set getaddrinfo d_getaddrinfo
13483eval $inlibc
13484
13485: see if getcwd exists
13486set getcwd d_getcwd
13487eval $inlibc
13488
13489: see if getespwnam exists
13490set getespwnam d_getespwnam
13491eval $inlibc
13492
13493: see if getfsstat exists
13494set getfsstat d_getfsstat
13495eval $inlibc
13496
13497: see if getgrent exists
13498set getgrent d_getgrent
13499eval $inlibc
13500
13501: see if getgrent_r exists
13502set getgrent_r d_getgrent_r
13503eval $inlibc
13504case "$d_getgrent_r" in
13505"$define")
13506	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13507	case "$d_getgrent_r_proto:$usethreads" in
13508	":define")	d_getgrent_r_proto=define
13509		set d_getgrent_r_proto getgrent_r $hdrs
13510		eval $hasproto ;;
13511	*)	;;
13512	esac
13513	case "$d_getgrent_r_proto" in
13514	define)
13515	case "$getgrent_r_proto" in
13516	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13517	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13518	esac
13519	case "$getgrent_r_proto" in
13520	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13521	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13522	esac
13523	case "$getgrent_r_proto" in
13524	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13525	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13526	esac
13527	case "$getgrent_r_proto" in
13528	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13529	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13530	esac
13531	case "$getgrent_r_proto" in
13532	''|0) try='int getgrent_r(struct group*, char*, int);'
13533	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13534	esac
13535	case "$getgrent_r_proto" in
13536	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13537	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13538	esac
13539	case "$getgrent_r_proto" in
13540	''|0)	d_getgrent_r=undef
13541 	        getgrent_r_proto=0
13542		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13543	* )	case "$getgrent_r_proto" in
13544		REENTRANT_PROTO*) ;;
13545		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13546		esac
13547		echo "Prototype: $try" ;;
13548	esac
13549	;;
13550	*)	case "$usethreads" in
13551		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13552		esac
13553		d_getgrent_r=undef
13554		getgrent_r_proto=0
13555		;;
13556	esac
13557	;;
13558*)	getgrent_r_proto=0
13559	;;
13560esac
13561
13562: see if getgrgid_r exists
13563set getgrgid_r d_getgrgid_r
13564eval $inlibc
13565case "$d_getgrgid_r" in
13566"$define")
13567	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13568	case "$d_getgrgid_r_proto:$usethreads" in
13569	":define")	d_getgrgid_r_proto=define
13570		set d_getgrgid_r_proto getgrgid_r $hdrs
13571		eval $hasproto ;;
13572	*)	;;
13573	esac
13574	case "$d_getgrgid_r_proto" in
13575	define)
13576	case "$getgrgid_r_proto" in
13577	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13578	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13579	esac
13580	case "$getgrgid_r_proto" in
13581	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13582	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13583	esac
13584	case "$getgrgid_r_proto" in
13585	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13586	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13587	esac
13588	case "$getgrgid_r_proto" in
13589	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13590	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13591	esac
13592	case "$getgrgid_r_proto" in
13593	''|0)	d_getgrgid_r=undef
13594 	        getgrgid_r_proto=0
13595		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13596	* )	case "$getgrgid_r_proto" in
13597		REENTRANT_PROTO*) ;;
13598		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13599		esac
13600		echo "Prototype: $try" ;;
13601	esac
13602	;;
13603	*)	case "$usethreads" in
13604		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13605		esac
13606		d_getgrgid_r=undef
13607		getgrgid_r_proto=0
13608		;;
13609	esac
13610	;;
13611*)	getgrgid_r_proto=0
13612	;;
13613esac
13614
13615: see if getgrnam_r exists
13616set getgrnam_r d_getgrnam_r
13617eval $inlibc
13618case "$d_getgrnam_r" in
13619"$define")
13620	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13621	case "$d_getgrnam_r_proto:$usethreads" in
13622	":define")	d_getgrnam_r_proto=define
13623		set d_getgrnam_r_proto getgrnam_r $hdrs
13624		eval $hasproto ;;
13625	*)	;;
13626	esac
13627	case "$d_getgrnam_r_proto" in
13628	define)
13629	case "$getgrnam_r_proto" in
13630	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13631	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13632	esac
13633	case "$getgrnam_r_proto" in
13634	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13635	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13636	esac
13637	case "$getgrnam_r_proto" in
13638	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13639	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13640	esac
13641	case "$getgrnam_r_proto" in
13642	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13643	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13644	esac
13645	case "$getgrnam_r_proto" in
13646	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13647	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13648	esac
13649	case "$getgrnam_r_proto" in
13650	''|0)	d_getgrnam_r=undef
13651 	        getgrnam_r_proto=0
13652		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13653	* )	case "$getgrnam_r_proto" in
13654		REENTRANT_PROTO*) ;;
13655		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13656		esac
13657		echo "Prototype: $try" ;;
13658	esac
13659	;;
13660	*)	case "$usethreads" in
13661		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13662		esac
13663		d_getgrnam_r=undef
13664		getgrnam_r_proto=0
13665		;;
13666	esac
13667	;;
13668*)	getgrnam_r_proto=0
13669	;;
13670esac
13671
13672: see if gethostbyaddr exists
13673set gethostbyaddr d_gethbyaddr
13674eval $inlibc
13675
13676: see if gethostbyname exists
13677set gethostbyname d_gethbyname
13678eval $inlibc
13679
13680: see if gethostent exists
13681set gethostent d_gethent
13682eval $inlibc
13683
13684: see how we will look up host name
13685echo " "
13686call=''
13687if set gethostname val -f d_gethname; eval $csym; $val; then
13688	echo 'gethostname() found.' >&4
13689	d_gethname="$define"
13690	call=gethostname
13691fi
13692if set uname val -f d_uname; eval $csym; $val; then
13693	if ./xenix; then
13694		$cat <<'EOM'
13695uname() was found, but you're running xenix, and older versions of xenix
13696have a broken uname(). If you don't really know whether your xenix is old
13697enough to have a broken system call, use the default answer.
13698
13699EOM
13700		dflt=y
13701		case "$d_uname" in
13702		"$define") dflt=n;;
13703		esac
13704		rp='Is your uname() broken?'
13705		. ./myread
13706		case "$ans" in
13707		n*) d_uname="$define"; call=uname;;
13708		esac
13709	else
13710		echo 'uname() found.' >&4
13711		d_uname="$define"
13712		case "$call" in
13713		'') call=uname ;;
13714		esac
13715	fi
13716fi
13717case "$d_gethname" in
13718'') d_gethname="$undef";;
13719esac
13720case "$d_uname" in
13721'') d_uname="$undef";;
13722esac
13723case "$d_uname$d_gethname" in
13724*define*)
13725	dflt=n
13726	cat <<EOM
13727
13728Every now and then someone has a $call() that lies about the hostname
13729but can't be fixed for political or economic reasons.  If you wish, I can
13730pretend $call() isn't there and maybe compute hostname at run-time
13731thanks to the '$phostname' command.
13732
13733EOM
13734	rp="Shall I ignore $call() from now on?"
13735	. ./myread
13736	case "$ans" in
13737	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13738	esac;;
13739esac
13740case "$phostname" in
13741'') aphostname='';;
13742*) case "$aphostname" in
13743	/*) ;;
13744	*) set X $phostname
13745		shift
13746		file=$1
13747		shift
13748		file=`./loc $file $file $pth`
13749		aphostname=`echo $file $*`
13750		;;
13751	esac
13752	;;
13753esac
13754case "$d_uname$d_gethname" in
13755*define*) ;;
13756*)
13757	case "$phostname" in
13758	'')
13759		echo "There will be no way for $package to get your hostname." >&4;;
13760	*)
13761	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13762		;;
13763	esac;;
13764esac
13765case "$d_phostname" in
13766'') d_phostname="$undef";;
13767esac
13768
13769: see if gethostbyaddr_r exists
13770set gethostbyaddr_r d_gethostbyaddr_r
13771eval $inlibc
13772case "$d_gethostbyaddr_r" in
13773"$define")
13774	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13775	case "$d_gethostbyaddr_r_proto:$usethreads" in
13776	":define")	d_gethostbyaddr_r_proto=define
13777		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13778		eval $hasproto ;;
13779	*)	;;
13780	esac
13781	case "$d_gethostbyaddr_r_proto" in
13782	define)
13783	case "$gethostbyaddr_r_proto" in
13784	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13785	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13786	esac
13787	case "$gethostbyaddr_r_proto" in
13788	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13789	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13790	esac
13791	case "$gethostbyaddr_r_proto" in
13792	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13793	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13794	esac
13795	case "$gethostbyaddr_r_proto" in
13796	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13797	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13798	esac
13799	case "$gethostbyaddr_r_proto" in
13800	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13801	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13802	esac
13803	case "$gethostbyaddr_r_proto" in
13804	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13805	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13806	esac
13807	case "$gethostbyaddr_r_proto" in
13808	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13809	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13810	esac
13811	case "$gethostbyaddr_r_proto" in
13812	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13813	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13814	esac
13815	case "$gethostbyaddr_r_proto" in
13816	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13817	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13818	esac
13819	case "$gethostbyaddr_r_proto" in
13820	''|0) try='int gethostbyaddr_r(const char*, int, int);'
13821	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13822	esac
13823	case "$gethostbyaddr_r_proto" in
13824	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13825	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13826	esac
13827	case "$gethostbyaddr_r_proto" in
13828	''|0)	d_gethostbyaddr_r=undef
13829 	        gethostbyaddr_r_proto=0
13830		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13831	* )	case "$gethostbyaddr_r_proto" in
13832		REENTRANT_PROTO*) ;;
13833		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13834		esac
13835		echo "Prototype: $try" ;;
13836	esac
13837	;;
13838	*)	case "$usethreads" in
13839		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13840		esac
13841		d_gethostbyaddr_r=undef
13842		gethostbyaddr_r_proto=0
13843		;;
13844	esac
13845	;;
13846*)	gethostbyaddr_r_proto=0
13847	;;
13848esac
13849
13850: see if gethostbyname_r exists
13851set gethostbyname_r d_gethostbyname_r
13852eval $inlibc
13853case "$d_gethostbyname_r" in
13854"$define")
13855	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13856	case "$d_gethostbyname_r_proto:$usethreads" in
13857	":define")	d_gethostbyname_r_proto=define
13858		set d_gethostbyname_r_proto gethostbyname_r $hdrs
13859		eval $hasproto ;;
13860	*)	;;
13861	esac
13862	case "$d_gethostbyname_r_proto" in
13863	define)
13864	case "$gethostbyname_r_proto" in
13865	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13866	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13867	esac
13868	case "$gethostbyname_r_proto" in
13869	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13870	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13871	esac
13872	case "$gethostbyname_r_proto" in
13873	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13874	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13875	esac
13876	case "$gethostbyname_r_proto" in
13877	''|0)	d_gethostbyname_r=undef
13878 	        gethostbyname_r_proto=0
13879		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13880	* )	case "$gethostbyname_r_proto" in
13881		REENTRANT_PROTO*) ;;
13882		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13883		esac
13884		echo "Prototype: $try" ;;
13885	esac
13886	;;
13887	*)	case "$usethreads" in
13888		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13889		esac
13890		d_gethostbyname_r=undef
13891		gethostbyname_r_proto=0
13892		;;
13893	esac
13894	;;
13895*)	gethostbyname_r_proto=0
13896	;;
13897esac
13898
13899: see if gethostent_r exists
13900set gethostent_r d_gethostent_r
13901eval $inlibc
13902case "$d_gethostent_r" in
13903"$define")
13904	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13905	case "$d_gethostent_r_proto:$usethreads" in
13906	":define")	d_gethostent_r_proto=define
13907		set d_gethostent_r_proto gethostent_r $hdrs
13908		eval $hasproto ;;
13909	*)	;;
13910	esac
13911	case "$d_gethostent_r_proto" in
13912	define)
13913	case "$gethostent_r_proto" in
13914	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13915	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13916	esac
13917	case "$gethostent_r_proto" in
13918	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13919	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13920	esac
13921	case "$gethostent_r_proto" in
13922	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13923	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13924	esac
13925	case "$gethostent_r_proto" in
13926	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13927	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13928	esac
13929	case "$gethostent_r_proto" in
13930	''|0) try='int gethostent_r(struct hostent*, char*, int);'
13931	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13932	esac
13933	case "$gethostent_r_proto" in
13934	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13935	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13936	esac
13937	case "$gethostent_r_proto" in
13938	''|0)	d_gethostent_r=undef
13939 	        gethostent_r_proto=0
13940		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13941	* )	case "$gethostent_r_proto" in
13942		REENTRANT_PROTO*) ;;
13943		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13944		esac
13945		echo "Prototype: $try" ;;
13946	esac
13947	;;
13948	*)	case "$usethreads" in
13949		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13950		esac
13951		d_gethostent_r=undef
13952		gethostent_r_proto=0
13953		;;
13954	esac
13955	;;
13956*)	gethostent_r_proto=0
13957	;;
13958esac
13959
13960: see if prototypes for various gethostxxx netdb.h functions are available
13961echo " "
13962set d_gethostprotos gethostent $i_netdb netdb.h
13963eval $hasproto
13964
13965: see if getitimer exists
13966set getitimer d_getitimer
13967eval $inlibc
13968
13969: see if getlogin exists
13970set getlogin d_getlogin
13971eval $inlibc
13972
13973: see if getlogin_r exists
13974set getlogin_r d_getlogin_r
13975eval $inlibc
13976case "$d_getlogin_r" in
13977"$define")
13978	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13979	case "$d_getlogin_r_proto:$usethreads" in
13980	":define")	d_getlogin_r_proto=define
13981		set d_getlogin_r_proto getlogin_r $hdrs
13982		eval $hasproto ;;
13983	*)	;;
13984	esac
13985	case "$d_getlogin_r_proto" in
13986	define)
13987	case "$getlogin_r_proto" in
13988	''|0) try='int getlogin_r(char*, size_t);'
13989	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13990	esac
13991	case "$getlogin_r_proto" in
13992	''|0) try='int getlogin_r(char*, int);'
13993	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13994	esac
13995	case "$getlogin_r_proto" in
13996	''|0) try='char* getlogin_r(char*, size_t);'
13997	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13998	esac
13999	case "$getlogin_r_proto" in
14000	''|0) try='char* getlogin_r(char*, int);'
14001	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14002	esac
14003	case "$getlogin_r_proto" in
14004	''|0)	d_getlogin_r=undef
14005 	        getlogin_r_proto=0
14006		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14007	* )	case "$getlogin_r_proto" in
14008		REENTRANT_PROTO*) ;;
14009		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14010		esac
14011		echo "Prototype: $try" ;;
14012	esac
14013	;;
14014	*)	case "$usethreads" in
14015		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14016		esac
14017		d_getlogin_r=undef
14018		getlogin_r_proto=0
14019		;;
14020	esac
14021	;;
14022*)	getlogin_r_proto=0
14023	;;
14024esac
14025
14026: see if getmnt exists
14027set getmnt d_getmnt
14028eval $inlibc
14029
14030: see if getmntent exists
14031set getmntent d_getmntent
14032eval $inlibc
14033
14034: see if getnameinfo exists
14035set getnameinfo d_getnameinfo
14036eval $inlibc
14037
14038: see if getnetbyaddr exists
14039set getnetbyaddr d_getnbyaddr
14040eval $inlibc
14041
14042: see if getnetbyname exists
14043set getnetbyname d_getnbyname
14044eval $inlibc
14045
14046: see if getnetent exists
14047set getnetent d_getnent
14048eval $inlibc
14049
14050: see if getnetbyaddr_r exists
14051set getnetbyaddr_r d_getnetbyaddr_r
14052eval $inlibc
14053case "$d_getnetbyaddr_r" in
14054"$define")
14055	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14056	case "$d_getnetbyaddr_r_proto:$usethreads" in
14057	":define")	d_getnetbyaddr_r_proto=define
14058		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14059		eval $hasproto ;;
14060	*)	;;
14061	esac
14062	case "$d_getnetbyaddr_r_proto" in
14063	define)
14064	case "$getnetbyaddr_r_proto" in
14065	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14066	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14067	esac
14068	case "$getnetbyaddr_r_proto" in
14069	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14070	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14071	esac
14072	case "$getnetbyaddr_r_proto" in
14073	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14074	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14075	esac
14076	case "$getnetbyaddr_r_proto" in
14077	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14078	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14079	esac
14080	case "$getnetbyaddr_r_proto" in
14081	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14082	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14083	esac
14084	case "$getnetbyaddr_r_proto" in
14085	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14086	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14087	esac
14088	case "$getnetbyaddr_r_proto" in
14089	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14090	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14091	esac
14092	case "$getnetbyaddr_r_proto" in
14093	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14094	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14095	esac
14096	case "$getnetbyaddr_r_proto" in
14097	''|0)	d_getnetbyaddr_r=undef
14098 	        getnetbyaddr_r_proto=0
14099		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14100	* )	case "$getnetbyaddr_r_proto" in
14101		REENTRANT_PROTO*) ;;
14102		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14103		esac
14104		echo "Prototype: $try" ;;
14105	esac
14106	;;
14107	*)	case "$usethreads" in
14108		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14109		esac
14110		d_getnetbyaddr_r=undef
14111		getnetbyaddr_r_proto=0
14112		;;
14113	esac
14114	;;
14115*)	getnetbyaddr_r_proto=0
14116	;;
14117esac
14118
14119: see if getnetbyname_r exists
14120set getnetbyname_r d_getnetbyname_r
14121eval $inlibc
14122case "$d_getnetbyname_r" in
14123"$define")
14124	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14125	case "$d_getnetbyname_r_proto:$usethreads" in
14126	":define")	d_getnetbyname_r_proto=define
14127		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14128		eval $hasproto ;;
14129	*)	;;
14130	esac
14131	case "$d_getnetbyname_r_proto" in
14132	define)
14133	case "$getnetbyname_r_proto" in
14134	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14135	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14136	esac
14137	case "$getnetbyname_r_proto" in
14138	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14139	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14140	esac
14141	case "$getnetbyname_r_proto" in
14142	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14143	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14144	esac
14145	case "$getnetbyname_r_proto" in
14146	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14147	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14148	esac
14149	case "$getnetbyname_r_proto" in
14150	''|0)	d_getnetbyname_r=undef
14151 	        getnetbyname_r_proto=0
14152		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14153	* )	case "$getnetbyname_r_proto" in
14154		REENTRANT_PROTO*) ;;
14155		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14156		esac
14157		echo "Prototype: $try" ;;
14158	esac
14159	;;
14160	*)	case "$usethreads" in
14161		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14162		esac
14163		d_getnetbyname_r=undef
14164		getnetbyname_r_proto=0
14165		;;
14166	esac
14167	;;
14168*)	getnetbyname_r_proto=0
14169	;;
14170esac
14171
14172: see if getnetent_r exists
14173set getnetent_r d_getnetent_r
14174eval $inlibc
14175case "$d_getnetent_r" in
14176"$define")
14177	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14178	case "$d_getnetent_r_proto:$usethreads" in
14179	":define")	d_getnetent_r_proto=define
14180		set d_getnetent_r_proto getnetent_r $hdrs
14181		eval $hasproto ;;
14182	*)	;;
14183	esac
14184	case "$d_getnetent_r_proto" in
14185	define)
14186	case "$getnetent_r_proto" in
14187	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14188	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14189	esac
14190	case "$getnetent_r_proto" in
14191	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14192	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14193	esac
14194	case "$getnetent_r_proto" in
14195	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14196	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14197	esac
14198	case "$getnetent_r_proto" in
14199	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14200	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14201	esac
14202	case "$getnetent_r_proto" in
14203	''|0) try='int getnetent_r(struct netent*, char*, int);'
14204	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14205	esac
14206	case "$getnetent_r_proto" in
14207	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14208	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14209	esac
14210	case "$getnetent_r_proto" in
14211	''|0)	d_getnetent_r=undef
14212 	        getnetent_r_proto=0
14213		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14214	* )	case "$getnetent_r_proto" in
14215		REENTRANT_PROTO*) ;;
14216		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14217		esac
14218		echo "Prototype: $try" ;;
14219	esac
14220	;;
14221	*)	case "$usethreads" in
14222		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14223		esac
14224		d_getnetent_r=undef
14225		getnetent_r_proto=0
14226		;;
14227	esac
14228	;;
14229*)	getnetent_r_proto=0
14230	;;
14231esac
14232
14233: see if prototypes for various getnetxxx netdb.h functions are available
14234echo " "
14235set d_getnetprotos getnetent $i_netdb netdb.h
14236eval $hasproto
14237
14238: see if getpagesize exists
14239set getpagesize d_getpagsz
14240eval $inlibc
14241
14242: Optional checks for getprotobyname and getprotobynumber
14243
14244: see if getprotobyname exists
14245set getprotobyname d_getpbyname
14246eval $inlibc
14247
14248: see if getprotobynumber exists
14249set getprotobynumber d_getpbynumber
14250eval $inlibc
14251
14252: see if getprotoent exists
14253set getprotoent d_getpent
14254eval $inlibc
14255
14256: see if getpgid exists
14257set getpgid d_getpgid
14258eval $inlibc
14259
14260: see if getpgrp2 exists
14261set getpgrp2 d_getpgrp2
14262eval $inlibc
14263
14264: see if getppid exists
14265set getppid d_getppid
14266eval $inlibc
14267
14268: see if getpriority exists
14269set getpriority d_getprior
14270eval $inlibc
14271
14272: see if getprotobyname_r exists
14273set getprotobyname_r d_getprotobyname_r
14274eval $inlibc
14275case "$d_getprotobyname_r" in
14276"$define")
14277	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14278	case "$d_getprotobyname_r_proto:$usethreads" in
14279	":define")	d_getprotobyname_r_proto=define
14280		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14281		eval $hasproto ;;
14282	*)	;;
14283	esac
14284	case "$d_getprotobyname_r_proto" in
14285	define)
14286	case "$getprotobyname_r_proto" in
14287	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14288	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14289	esac
14290	case "$getprotobyname_r_proto" in
14291	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14292	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14293	esac
14294	case "$getprotobyname_r_proto" in
14295	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14296	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14297	esac
14298	case "$getprotobyname_r_proto" in
14299	''|0)	d_getprotobyname_r=undef
14300 	        getprotobyname_r_proto=0
14301		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14302	* )	case "$getprotobyname_r_proto" in
14303		REENTRANT_PROTO*) ;;
14304		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14305		esac
14306		echo "Prototype: $try" ;;
14307	esac
14308	;;
14309	*)	case "$usethreads" in
14310		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14311		esac
14312		d_getprotobyname_r=undef
14313		getprotobyname_r_proto=0
14314		;;
14315	esac
14316	;;
14317*)	getprotobyname_r_proto=0
14318	;;
14319esac
14320
14321: see if getprotobynumber_r exists
14322set getprotobynumber_r d_getprotobynumber_r
14323eval $inlibc
14324case "$d_getprotobynumber_r" in
14325"$define")
14326	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14327	case "$d_getprotobynumber_r_proto:$usethreads" in
14328	":define")	d_getprotobynumber_r_proto=define
14329		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14330		eval $hasproto ;;
14331	*)	;;
14332	esac
14333	case "$d_getprotobynumber_r_proto" in
14334	define)
14335	case "$getprotobynumber_r_proto" in
14336	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14337	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14338	esac
14339	case "$getprotobynumber_r_proto" in
14340	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14341	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14342	esac
14343	case "$getprotobynumber_r_proto" in
14344	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14345	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14346	esac
14347	case "$getprotobynumber_r_proto" in
14348	''|0)	d_getprotobynumber_r=undef
14349 	        getprotobynumber_r_proto=0
14350		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14351	* )	case "$getprotobynumber_r_proto" in
14352		REENTRANT_PROTO*) ;;
14353		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14354		esac
14355		echo "Prototype: $try" ;;
14356	esac
14357	;;
14358	*)	case "$usethreads" in
14359		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14360		esac
14361		d_getprotobynumber_r=undef
14362		getprotobynumber_r_proto=0
14363		;;
14364	esac
14365	;;
14366*)	getprotobynumber_r_proto=0
14367	;;
14368esac
14369
14370: see if getprotoent_r exists
14371set getprotoent_r d_getprotoent_r
14372eval $inlibc
14373case "$d_getprotoent_r" in
14374"$define")
14375	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14376	case "$d_getprotoent_r_proto:$usethreads" in
14377	":define")	d_getprotoent_r_proto=define
14378		set d_getprotoent_r_proto getprotoent_r $hdrs
14379		eval $hasproto ;;
14380	*)	;;
14381	esac
14382	case "$d_getprotoent_r_proto" in
14383	define)
14384	case "$getprotoent_r_proto" in
14385	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14386	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14387	esac
14388	case "$getprotoent_r_proto" in
14389	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14390	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14391	esac
14392	case "$getprotoent_r_proto" in
14393	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14394	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14395	esac
14396	case "$getprotoent_r_proto" in
14397	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14398	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14399	esac
14400	case "$getprotoent_r_proto" in
14401	''|0)	d_getprotoent_r=undef
14402 	        getprotoent_r_proto=0
14403		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14404	* )	case "$getprotoent_r_proto" in
14405		REENTRANT_PROTO*) ;;
14406		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14407		esac
14408		echo "Prototype: $try" ;;
14409	esac
14410	;;
14411	*)	case "$usethreads" in
14412		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14413		esac
14414		d_getprotoent_r=undef
14415		getprotoent_r_proto=0
14416		;;
14417	esac
14418	;;
14419*)	getprotoent_r_proto=0
14420	;;
14421esac
14422
14423: see if prototypes for various getprotoxxx netdb.h functions are available
14424echo " "
14425set d_getprotoprotos getprotoent $i_netdb netdb.h
14426eval $hasproto
14427
14428: see if getprpwnam exists
14429set getprpwnam d_getprpwnam
14430eval $inlibc
14431
14432: see if getpwent exists
14433set getpwent d_getpwent
14434eval $inlibc
14435
14436: see if getpwent_r exists
14437set getpwent_r d_getpwent_r
14438eval $inlibc
14439case "$d_getpwent_r" in
14440"$define")
14441	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14442	case "$d_getpwent_r_proto:$usethreads" in
14443	":define")	d_getpwent_r_proto=define
14444		set d_getpwent_r_proto getpwent_r $hdrs
14445		eval $hasproto ;;
14446	*)	;;
14447	esac
14448	case "$d_getpwent_r_proto" in
14449	define)
14450	case "$getpwent_r_proto" in
14451	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14452	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14453	esac
14454	case "$getpwent_r_proto" in
14455	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14456	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14457	esac
14458	case "$getpwent_r_proto" in
14459	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14460	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14461	esac
14462	case "$getpwent_r_proto" in
14463	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14464	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14465	esac
14466	case "$getpwent_r_proto" in
14467	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14468	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14469	esac
14470	case "$getpwent_r_proto" in
14471	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14472	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14473	esac
14474	case "$getpwent_r_proto" in
14475	''|0)	d_getpwent_r=undef
14476 	        getpwent_r_proto=0
14477		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14478	* )	case "$getpwent_r_proto" in
14479		REENTRANT_PROTO*) ;;
14480		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14481		esac
14482		echo "Prototype: $try" ;;
14483	esac
14484	;;
14485	*)	case "$usethreads" in
14486		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14487		esac
14488		d_getpwent_r=undef
14489		getpwent_r_proto=0
14490		;;
14491	esac
14492	;;
14493*)	getpwent_r_proto=0
14494	;;
14495esac
14496
14497: see if getpwnam_r exists
14498set getpwnam_r d_getpwnam_r
14499eval $inlibc
14500case "$d_getpwnam_r" in
14501"$define")
14502	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14503	case "$d_getpwnam_r_proto:$usethreads" in
14504	":define")	d_getpwnam_r_proto=define
14505		set d_getpwnam_r_proto getpwnam_r $hdrs
14506		eval $hasproto ;;
14507	*)	;;
14508	esac
14509	case "$d_getpwnam_r_proto" in
14510	define)
14511	case "$getpwnam_r_proto" in
14512	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14513	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14514	esac
14515	case "$getpwnam_r_proto" in
14516	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14517	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14518	esac
14519	case "$getpwnam_r_proto" in
14520	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14521	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14522	esac
14523	case "$getpwnam_r_proto" in
14524	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14525	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14526	esac
14527	case "$getpwnam_r_proto" in
14528	''|0)	d_getpwnam_r=undef
14529 	        getpwnam_r_proto=0
14530		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14531	* )	case "$getpwnam_r_proto" in
14532		REENTRANT_PROTO*) ;;
14533		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14534		esac
14535		echo "Prototype: $try" ;;
14536	esac
14537	;;
14538	*)	case "$usethreads" in
14539		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14540		esac
14541		d_getpwnam_r=undef
14542		getpwnam_r_proto=0
14543		;;
14544	esac
14545	;;
14546*)	getpwnam_r_proto=0
14547	;;
14548esac
14549
14550: see if getpwuid_r exists
14551set getpwuid_r d_getpwuid_r
14552eval $inlibc
14553case "$d_getpwuid_r" in
14554"$define")
14555	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14556	case "$d_getpwuid_r_proto:$usethreads" in
14557	":define")	d_getpwuid_r_proto=define
14558		set d_getpwuid_r_proto getpwuid_r $hdrs
14559		eval $hasproto ;;
14560	*)	;;
14561	esac
14562	case "$d_getpwuid_r_proto" in
14563	define)
14564	case "$getpwuid_r_proto" in
14565	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14566	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14567	esac
14568	case "$getpwuid_r_proto" in
14569	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14570	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14571	esac
14572	case "$getpwuid_r_proto" in
14573	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14574	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14575	esac
14576	case "$getpwuid_r_proto" in
14577	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14578	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14579	esac
14580	case "$getpwuid_r_proto" in
14581	''|0)	d_getpwuid_r=undef
14582 	        getpwuid_r_proto=0
14583		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14584	* )	case "$getpwuid_r_proto" in
14585		REENTRANT_PROTO*) ;;
14586		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14587		esac
14588		echo "Prototype: $try" ;;
14589	esac
14590	;;
14591	*)	case "$usethreads" in
14592		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14593		esac
14594		d_getpwuid_r=undef
14595		getpwuid_r_proto=0
14596		;;
14597	esac
14598	;;
14599*)	getpwuid_r_proto=0
14600	;;
14601esac
14602
14603: Optional checks for getsbyname and getsbyport
14604
14605: see if getservbyname exists
14606set getservbyname d_getsbyname
14607eval $inlibc
14608
14609: see if getservbyport exists
14610set getservbyport d_getsbyport
14611eval $inlibc
14612
14613: see if getservent exists
14614set getservent d_getsent
14615eval $inlibc
14616
14617: see if getservbyname_r exists
14618set getservbyname_r d_getservbyname_r
14619eval $inlibc
14620case "$d_getservbyname_r" in
14621"$define")
14622	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14623	case "$d_getservbyname_r_proto:$usethreads" in
14624	":define")	d_getservbyname_r_proto=define
14625		set d_getservbyname_r_proto getservbyname_r $hdrs
14626		eval $hasproto ;;
14627	*)	;;
14628	esac
14629	case "$d_getservbyname_r_proto" in
14630	define)
14631	case "$getservbyname_r_proto" in
14632	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14633	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14634	esac
14635	case "$getservbyname_r_proto" in
14636	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14637	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14638	esac
14639	case "$getservbyname_r_proto" in
14640	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14641	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14642	esac
14643	case "$getservbyname_r_proto" in
14644	''|0)	d_getservbyname_r=undef
14645 	        getservbyname_r_proto=0
14646		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14647	* )	case "$getservbyname_r_proto" in
14648		REENTRANT_PROTO*) ;;
14649		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14650		esac
14651		echo "Prototype: $try" ;;
14652	esac
14653	;;
14654	*)	case "$usethreads" in
14655		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14656		esac
14657		d_getservbyname_r=undef
14658		getservbyname_r_proto=0
14659		;;
14660	esac
14661	;;
14662*)	getservbyname_r_proto=0
14663	;;
14664esac
14665
14666: see if getservbyport_r exists
14667set getservbyport_r d_getservbyport_r
14668eval $inlibc
14669case "$d_getservbyport_r" in
14670"$define")
14671	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14672	case "$d_getservbyport_r_proto:$usethreads" in
14673	":define")	d_getservbyport_r_proto=define
14674		set d_getservbyport_r_proto getservbyport_r $hdrs
14675		eval $hasproto ;;
14676	*)	;;
14677	esac
14678	case "$d_getservbyport_r_proto" in
14679	define)
14680	case "$getservbyport_r_proto" in
14681	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14682	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14683	esac
14684	case "$getservbyport_r_proto" in
14685	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14686	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14687	esac
14688	case "$getservbyport_r_proto" in
14689	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14690	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14691	esac
14692	case "$getservbyport_r_proto" in
14693	''|0)	d_getservbyport_r=undef
14694 	        getservbyport_r_proto=0
14695		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14696	* )	case "$getservbyport_r_proto" in
14697		REENTRANT_PROTO*) ;;
14698		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14699		esac
14700		echo "Prototype: $try" ;;
14701	esac
14702	;;
14703	*)	case "$usethreads" in
14704		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14705		esac
14706		d_getservbyport_r=undef
14707		getservbyport_r_proto=0
14708		;;
14709	esac
14710	;;
14711*)	getservbyport_r_proto=0
14712	;;
14713esac
14714
14715: see if getservent_r exists
14716set getservent_r d_getservent_r
14717eval $inlibc
14718case "$d_getservent_r" in
14719"$define")
14720	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14721	case "$d_getservent_r_proto:$usethreads" in
14722	":define")	d_getservent_r_proto=define
14723		set d_getservent_r_proto getservent_r $hdrs
14724		eval $hasproto ;;
14725	*)	;;
14726	esac
14727	case "$d_getservent_r_proto" in
14728	define)
14729	case "$getservent_r_proto" in
14730	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14731	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14732	esac
14733	case "$getservent_r_proto" in
14734	''|0) try='int getservent_r(struct servent*, char*, int);'
14735	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14736	esac
14737	case "$getservent_r_proto" in
14738	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14739	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14740	esac
14741	case "$getservent_r_proto" in
14742	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14743	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14744	esac
14745	case "$getservent_r_proto" in
14746	''|0)	d_getservent_r=undef
14747 	        getservent_r_proto=0
14748		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14749	* )	case "$getservent_r_proto" in
14750		REENTRANT_PROTO*) ;;
14751		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14752		esac
14753		echo "Prototype: $try" ;;
14754	esac
14755	;;
14756	*)	case "$usethreads" in
14757		define) echo "getservent_r has no prototype, not using it." >&4 ;;
14758		esac
14759		d_getservent_r=undef
14760		getservent_r_proto=0
14761		;;
14762	esac
14763	;;
14764*)	getservent_r_proto=0
14765	;;
14766esac
14767
14768: see if prototypes for various getservxxx netdb.h functions are available
14769echo " "
14770set d_getservprotos getservent $i_netdb netdb.h
14771eval $hasproto
14772
14773: see if getspnam exists
14774set getspnam d_getspnam
14775eval $inlibc
14776
14777: see if this is a shadow.h system
14778set shadow.h i_shadow
14779eval $inhdr
14780
14781: see if getspnam_r exists
14782set getspnam_r d_getspnam_r
14783eval $inlibc
14784case "$d_getspnam_r" in
14785"$define")
14786	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14787	case "$d_getspnam_r_proto:$usethreads" in
14788	":define")	d_getspnam_r_proto=define
14789		set d_getspnam_r_proto getspnam_r $hdrs
14790		eval $hasproto ;;
14791	*)	;;
14792	esac
14793	case "$d_getspnam_r_proto" in
14794	define)
14795	case "$getspnam_r_proto" in
14796	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14797	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14798	esac
14799	case "$getspnam_r_proto" in
14800	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14801	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14802	esac
14803	case "$getspnam_r_proto" in
14804	''|0)	d_getspnam_r=undef
14805 	        getspnam_r_proto=0
14806		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14807	* )	case "$getspnam_r_proto" in
14808		REENTRANT_PROTO*) ;;
14809		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14810		esac
14811		echo "Prototype: $try" ;;
14812	esac
14813	;;
14814	*)	case "$usethreads" in
14815		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14816		esac
14817		d_getspnam_r=undef
14818		getspnam_r_proto=0
14819		;;
14820	esac
14821	;;
14822*)	getspnam_r_proto=0
14823	;;
14824esac
14825
14826: see if gettimeofday or ftime exists
14827set gettimeofday d_gettimeod
14828eval $inlibc
14829case "$d_gettimeod" in
14830"$undef")
14831	set ftime d_ftime
14832	eval $inlibc
14833	;;
14834*)
14835	val="$undef"; set d_ftime; eval $setvar
14836	;;
14837esac
14838case "$d_gettimeod$d_ftime" in
14839"$undef$undef")
14840	echo " "
14841	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14842	;;
14843esac
14844
14845: see if gmtime_r exists
14846set gmtime_r d_gmtime_r
14847eval $inlibc
14848case "$d_gmtime_r" in
14849"$define")
14850	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14851	case "$d_gmtime_r_proto:$usethreads" in
14852	":define")	d_gmtime_r_proto=define
14853		set d_gmtime_r_proto gmtime_r $hdrs
14854		eval $hasproto ;;
14855	*)	;;
14856	esac
14857	case "$d_gmtime_r_proto" in
14858	define)
14859	case "$gmtime_r_proto" in
14860	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14861	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14862	esac
14863	case "$gmtime_r_proto" in
14864	''|0) try='int gmtime_r(const time_t*, struct tm*);'
14865	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14866	esac
14867	case "$gmtime_r_proto" in
14868	''|0)	d_gmtime_r=undef
14869 	        gmtime_r_proto=0
14870		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14871	* )	case "$gmtime_r_proto" in
14872		REENTRANT_PROTO*) ;;
14873		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14874		esac
14875		echo "Prototype: $try" ;;
14876	esac
14877	;;
14878	*)	case "$usethreads" in
14879		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14880		esac
14881		d_gmtime_r=undef
14882		gmtime_r_proto=0
14883		;;
14884	esac
14885	;;
14886*)	gmtime_r_proto=0
14887	;;
14888esac
14889
14890: see if hasmntopt exists
14891set hasmntopt d_hasmntopt
14892eval $inlibc
14893
14894: see if this is a netinet/in.h or sys/in.h system
14895set netinet/in.h i_niin sys/in.h i_sysin
14896eval $inhdr
14897
14898: see if arpa/inet.h has to be included
14899set arpa/inet.h i_arpainet
14900eval $inhdr
14901
14902: see if htonl --and friends-- exists
14903val=''
14904set htonl val
14905eval $inlibc
14906
14907: Maybe they are macros.
14908case "$val" in
14909$undef)
14910	$cat >htonl.c <<EOM
14911#include <stdio.h>
14912#include <sys/types.h>
14913#$i_niin I_NETINET_IN
14914#$i_sysin I_SYS_IN
14915#$i_arpainet I_ARPA_INET
14916#ifdef I_NETINET_IN
14917#include <netinet/in.h>
14918#endif
14919#ifdef I_SYS_IN
14920#include <sys/in.h>
14921#endif
14922#ifdef I_ARPA_INET
14923#include <arpa/inet.h>
14924#endif
14925#ifdef htonl
14926printf("Defined as a macro.");
14927#endif
14928EOM
14929	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14930	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14931		val="$define"
14932		echo "But it seems to be defined as a macro." >&4
14933	fi
14934	$rm -f htonl.?
14935	;;
14936esac
14937set d_htonl
14938eval $setvar
14939
14940: see if ilogbl exists
14941set ilogbl d_ilogbl
14942eval $inlibc
14943
14944: index or strchr
14945echo " "
14946if set index val -f; eval $csym; $val; then
14947	if set strchr val -f d_strchr; eval $csym; $val; then
14948		if $contains strchr "$strings" >/dev/null 2>&1 ; then
14949			val="$define"
14950			vali="$undef"
14951			echo "strchr() found." >&4
14952		else
14953			val="$undef"
14954			vali="$define"
14955			echo "index() found." >&4
14956		fi
14957	else
14958		val="$undef"
14959		vali="$define"
14960		echo "index() found." >&4
14961	fi
14962else
14963	if set strchr val -f d_strchr; eval $csym; $val; then
14964		val="$define"
14965		vali="$undef"
14966		echo "strchr() found." >&4
14967	else
14968		echo "No index() or strchr() found!" >&4
14969		val="$undef"
14970		vali="$undef"
14971	fi
14972fi
14973set d_strchr; eval $setvar
14974val="$vali"
14975set d_index; eval $setvar
14976
14977: check whether inet_aton exists
14978set inet_aton d_inetaton
14979eval $inlibc
14980
14981: see if inet_ntop exists
14982set inet_ntop d_inetntop
14983eval $inlibc
14984
14985: see if inet_pton exists
14986set inet_pton d_inetpton
14987eval $inlibc
14988
14989: Look for isascii
14990echo " "
14991$cat >isascii.c <<EOCP
14992#include <stdio.h>
14993#include <ctype.h>
14994#$i_stdlib I_STDLIB
14995#ifdef I_STDLIB
14996#include <stdlib.h>
14997#endif
14998int main() {
14999	int c = 'A';
15000	if (isascii(c))
15001		exit(0);
15002	else
15003		exit(1);
15004}
15005EOCP
15006set isascii
15007if eval $compile; then
15008	echo "isascii() found." >&4
15009	val="$define"
15010else
15011	echo "isascii() NOT found." >&4
15012	val="$undef"
15013fi
15014set d_isascii
15015eval $setvar
15016$rm -f isascii*
15017
15018: Look for isblank
15019echo " "
15020$cat >isblank.c <<'EOCP'
15021#include <stdio.h>
15022#include <ctype.h>
15023int main() {
15024	int c = ' ';
15025	if (isblank(c))
15026		exit(0);
15027	else
15028		exit(1);
15029}
15030EOCP
15031if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15032	echo "isblank() found." >&4
15033	val="$define"
15034else
15035	echo "isblank() NOT found." >&4
15036	val="$undef"
15037fi
15038set d_isblank
15039eval $setvar
15040$rm -f isblank*
15041
15042: see if isfinite exists
15043set isfinite d_isfinite
15044eval $inlibc
15045
15046: see if isinf exists
15047set isinf d_isinf
15048eval $inlibc
15049
15050: see if isnan exists
15051set isnan d_isnan
15052eval $inlibc
15053
15054: see if isnanl exists
15055set isnanl d_isnanl
15056eval $inlibc
15057
15058: see if killpg exists
15059set killpg d_killpg
15060eval $inlibc
15061
15062: see if lchown exists
15063echo " "
15064$cat > try.c <<'EOCP'
15065/* System header to define __stub macros and hopefully few prototypes,
15066    which can conflict with char lchown(); below.  */
15067#include <assert.h>
15068/* Override any gcc2 internal prototype to avoid an error.  */
15069/* We use char because int might match the return type of a gcc2
15070   builtin and then its argument prototype would still apply.  */
15071char lchown();
15072int main() {
15073    /*  The GNU C library defines this for functions which it implements
15074        to always fail with ENOSYS.  Some functions are actually named
15075	something starting with __ and the normal name is an alias.  */
15076#if defined (__stub_lchown) || defined (__stub___lchown)
15077choke me
15078#else
15079lchown();
15080#endif
15081; return 0; }
15082EOCP
15083set try
15084if eval $compile; then
15085    $echo "lchown() found." >&4
15086    val="$define"
15087else
15088    $echo "lchown() NOT found." >&4
15089    val="$undef"
15090fi
15091set d_lchown
15092eval $setvar
15093
15094: See if number of significant digits in a double precision number is known
15095echo " "
15096$cat >ldbl_dig.c <<EOM
15097#$i_limits I_LIMITS
15098#$i_float I_FLOAT
15099#ifdef I_LIMITS
15100#include <limits.h>
15101#endif
15102#ifdef I_FLOAT
15103#include <float.h>
15104#endif
15105#ifdef LDBL_DIG
15106printf("Contains LDBL_DIG");
15107#endif
15108EOM
15109$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15110if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15111	echo "LDBL_DIG found." >&4
15112	val="$define"
15113else
15114	echo "LDBL_DIG NOT found." >&4
15115	val="$undef"
15116fi
15117$rm -f ldbl_dig.?
15118set d_ldbl_dig
15119eval $setvar
15120
15121: see if this is a math.h system
15122set math.h i_math
15123eval $inhdr
15124
15125: check to see if math.h defines _LIB_VERSION
15126d_libm_lib_version="$undef"
15127case $i_math in
15128    $define)
15129	echo " "
15130	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15131	$cat >try.c <<EOCP
15132#include <unistd.h>
15133#include <math.h>
15134int main (int argc, char *argv[])
15135{
15136    printf ("%d\n", _LIB_VERSION);
15137    return (0);
15138    } /* main */
15139EOCP
15140	set try
15141	if eval $compile; then
15142	    foo=`$run ./try`
15143	    echo "Yes, it does ($foo)" >&4
15144	    d_libm_lib_version="$define"
15145	else
15146	    echo "No, it does not (probably harmless)" >&4
15147	    fi
15148	$rm_try
15149	;;
15150
15151    esac
15152
15153: see if link exists
15154set link d_link
15155eval $inlibc
15156
15157: see if localtime_r exists
15158set localtime_r d_localtime_r
15159eval $inlibc
15160case "$d_localtime_r" in
15161"$define")
15162	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15163	case "$d_localtime_r_proto:$usethreads" in
15164	":define")	d_localtime_r_proto=define
15165		set d_localtime_r_proto localtime_r $hdrs
15166		eval $hasproto ;;
15167	*)	;;
15168	esac
15169	case "$d_localtime_r_proto" in
15170	define)
15171	case "$localtime_r_proto" in
15172	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15173	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15174	esac
15175	case "$localtime_r_proto" in
15176	''|0) try='int localtime_r(const time_t*, struct tm*);'
15177	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15178	esac
15179	case "$localtime_r_proto" in
15180	''|0)	d_localtime_r=undef
15181 	        localtime_r_proto=0
15182		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15183	* )	case "$localtime_r_proto" in
15184		REENTRANT_PROTO*) ;;
15185		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15186		esac
15187		echo "Prototype: $try" ;;
15188	esac
15189	;;
15190	*)	case "$usethreads" in
15191		define) echo "localtime_r has no prototype, not using it." >&4 ;;
15192		esac
15193		d_localtime_r=undef
15194		localtime_r_proto=0
15195		;;
15196	esac
15197	;;
15198*)	localtime_r_proto=0
15199	;;
15200esac
15201
15202: see if localtime_r calls tzset
15203case "$localtime_r_proto" in
15204REENTRANT_PROTO*)
15205	$cat >try.c <<EOCP
15206/*  Does our libc's localtime_r call tzset ?
15207 *  return 0 if so, 1 otherwise.
15208 */
15209#$i_systypes	I_SYS_TYPES
15210#$i_unistd	I_UNISTD
15211#$i_time	I_TIME
15212#$i_stdlib	I_STDLIB
15213#$i_string	I_STRING
15214#$i_malloc	I_MALLOC
15215#ifdef I_SYS_TYPES
15216#  include <sys/types.h>
15217#endif
15218#ifdef I_UNISTD
15219#  include <unistd.h>
15220#endif
15221#ifdef I_TIME
15222#  include <time.h>
15223#endif
15224#ifdef I_STDLIB
15225#include <stdlib.h>
15226#endif
15227#ifdef I_STRING
15228#  include <string.h>
15229#else
15230#  include <strings.h>
15231#endif
15232#ifdef I_MALLOC
15233#  include <malloc.h>
15234#endif
15235int main()
15236{
15237    time_t t = time(0L);
15238    char w_tz[]="TZ" "=GMT+5",
15239	 e_tz[]="TZ" "=GMT-5",
15240	*tz_e = (char*)malloc(16),
15241	*tz_w = (char*)malloc(16);
15242    struct tm tm_e, tm_w;
15243    memset(&tm_e,'\0',sizeof(struct tm));
15244    memset(&tm_w,'\0',sizeof(struct tm));
15245    strcpy(tz_e,e_tz);
15246    strcpy(tz_w,w_tz);
15247
15248    putenv(tz_e);
15249    localtime_r(&t, &tm_e);
15250
15251    putenv(tz_w);
15252    localtime_r(&t, &tm_w);
15253
15254    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15255	return 1;
15256    return 0;
15257}
15258EOCP
15259	set try
15260	if eval $compile; then
15261	    if $run ./try; then
15262		d_localtime_r_needs_tzset=undef;
15263	    else
15264		d_localtime_r_needs_tzset=define;
15265	    fi;
15266	else
15267	    d_localtime_r_needs_tzset=undef;
15268	fi;
15269     ;;
15270  *)
15271     d_localtime_r_needs_tzset=undef;
15272     ;;
15273esac
15274$rm_try
15275
15276: see if localeconv exists
15277set localeconv d_locconv
15278eval $inlibc
15279
15280: see if lockf exists
15281set lockf d_lockf
15282eval $inlibc
15283
15284: see if prototype for lseek is available
15285echo " "
15286set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15287eval $hasproto
15288
15289: see if lstat exists
15290set lstat d_lstat
15291eval $inlibc
15292
15293: see if madvise exists
15294set madvise d_madvise
15295eval $inlibc
15296
15297: see if malloc_size exists
15298set malloc_size d_malloc_size
15299eval $inlibc
15300
15301: see if malloc_size_good exists
15302set malloc_good_size d_malloc_good_size
15303eval $inlibc
15304
15305: see if mblen exists
15306set mblen d_mblen
15307eval $inlibc
15308
15309: see if mbstowcs exists
15310set mbstowcs d_mbstowcs
15311eval $inlibc
15312
15313: see if mbtowc exists
15314set mbtowc d_mbtowc
15315eval $inlibc
15316
15317: see if memchr exists
15318set memchr d_memchr
15319eval $inlibc
15320
15321: see if memcmp exists
15322set memcmp d_memcmp
15323eval $inlibc
15324
15325: see if memcpy exists
15326set memcpy d_memcpy
15327eval $inlibc
15328
15329: see if memmove exists
15330set memmove d_memmove
15331eval $inlibc
15332
15333: see if memset exists
15334set memset d_memset
15335eval $inlibc
15336
15337: see if mkdir exists
15338set mkdir d_mkdir
15339eval $inlibc
15340
15341: see if mkdtemp exists
15342set mkdtemp d_mkdtemp
15343eval $inlibc
15344
15345: see if mkfifo exists
15346set mkfifo d_mkfifo
15347eval $inlibc
15348
15349: see if mkstemp exists
15350set mkstemp d_mkstemp
15351eval $inlibc
15352
15353: see if mkstemps exists
15354set mkstemps d_mkstemps
15355eval $inlibc
15356
15357: see if mktime exists
15358set mktime d_mktime
15359eval $inlibc
15360
15361: see if this is a sys/mman.h system
15362set sys/mman.h i_sysmman
15363eval $inhdr
15364
15365: see if mmap exists
15366set mmap d_mmap
15367eval $inlibc
15368: see what shmat returns
15369: default to something harmless
15370mmaptype='void *'
15371case "$i_sysmman$d_mmap" in
15372"$define$define")
15373	$cat >mmap.c <<'END'
15374#include <sys/mman.h>
15375void *mmap();
15376END
15377	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15378		mmaptype='void *'
15379	else
15380		mmaptype='caddr_t'
15381	fi
15382	echo "and it returns ($mmaptype)." >&4
15383	;;
15384esac
15385
15386
15387
15388: see if sqrtl exists
15389set sqrtl d_sqrtl
15390eval $inlibc
15391
15392: see if scalbnl exists
15393set scalbnl d_scalbnl
15394eval $inlibc
15395
15396: see if modfl exists
15397set modfl d_modfl
15398eval $inlibc
15399
15400: see if prototype for modfl is available
15401echo " "
15402set d_modflproto modfl $i_math math.h
15403eval $hasproto
15404
15405d_modfl_pow32_bug="$undef"
15406
15407case "$d_longdbl$d_modfl" in
15408$define$define)
15409	$cat <<EOM
15410Checking to see whether your modfl() is okay for large values...
15411EOM
15412$cat >try.c <<EOCP
15413#include <math.h>
15414#include <stdio.h>
15415EOCP
15416if $test "X$d_modflproto" != "X$define"; then
15417	$cat >>try.c <<EOCP
15418/* Sigh. many current glibcs provide the function, but do not prototype it. */
15419long double modfl (long double, long double *);
15420EOCP
15421fi
15422$cat >>try.c <<EOCP
15423int main() {
15424    long double nv = 4294967303.15;
15425    long double v, w;
15426    v = modfl(nv, &w);
15427#ifdef __GLIBC__
15428    printf("glibc");
15429#endif
15430    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15431    return 0;
15432}
15433EOCP
15434	case "$osname:$gccversion" in
15435	aix:)	saveccflags="$ccflags"
15436		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15437	esac
15438	set try
15439	if eval $compile; then
15440		foo=`$run ./try`
15441		case "$foo" in
15442		*" 4294967303.150000 1.150000 4294967302.000000")
15443			echo >&4 "Your modfl() is broken for large values."
15444			d_modfl_pow32_bug="$define"
15445			case "$foo" in
15446			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15447			;;
15448			esac
15449			;;
15450		*" 4294967303.150000 0.150000 4294967303.000000")
15451			echo >&4 "Your modfl() seems okay for large values."
15452			;;
15453		*)	echo >&4 "I don't understand your modfl() at all."
15454			d_modfl="$undef"
15455			;;
15456		esac
15457		$rm_try
15458	else
15459		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15460		d_modfl="$undef"
15461	fi
15462	case "$osname:$gccversion" in
15463	aix:)	ccflags="$saveccflags" ;; # restore
15464	esac
15465	;;
15466esac
15467
15468if $test "$uselongdouble" = "$define"; then
15469    message=""
15470    if $test "$d_sqrtl" != "$define"; then
15471	message="$message sqrtl"
15472    fi
15473    if $test "$d_modfl" != "$define"; then
15474	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15475	    echo "You have both aintl and copysignl, so I can emulate modfl."
15476	else
15477	    message="$message modfl"
15478	fi
15479    fi
15480    if $test "$d_frexpl" != "$define"; then
15481	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15482	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15483	else
15484	    message="$message frexpl"
15485	fi
15486    fi
15487
15488    if $test "$message" != ""; then
15489	$cat <<EOM >&4
15490
15491*** You requested the use of long doubles but you do not seem to have
15492*** the following mathematical functions needed for long double support:
15493***    $message
15494*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15495*** Cannot continue, aborting.
15496
15497EOM
15498
15499	exit 1
15500    fi
15501fi
15502
15503: see if mprotect exists
15504set mprotect d_mprotect
15505eval $inlibc
15506
15507: see if msgctl exists
15508set msgctl d_msgctl
15509eval $inlibc
15510
15511: see if msgget exists
15512set msgget d_msgget
15513eval $inlibc
15514
15515: see if msgsnd exists
15516set msgsnd d_msgsnd
15517eval $inlibc
15518
15519: see if msgrcv exists
15520set msgrcv d_msgrcv
15521eval $inlibc
15522
15523: see how much of the 'msg*(2)' library is present.
15524h_msg=true
15525echo " "
15526case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15527*"$undef"*) h_msg=false;;
15528esac
15529case "$osname" in
15530freebsd)
15531    case "`ipcs 2>&1`" in
15532    "SVID messages"*"not configured"*)
15533	echo "Your $osname does not have the msg*(2) configured." >&4
15534        h_msg=false
15535	val="$undef"
15536	set msgctl d_msgctl
15537	eval $setvar
15538	set msgget d_msgget
15539	eval $setvar
15540	set msgsnd d_msgsnd
15541	eval $setvar
15542	set msgrcv d_msgrcv
15543	eval $setvar
15544	;;
15545    esac
15546    ;;
15547esac
15548: we could also check for sys/ipc.h ...
15549if $h_msg && $test `./findhdr sys/msg.h`; then
15550	echo "You have the full msg*(2) library." >&4
15551	val="$define"
15552else
15553	echo "You don't have the full msg*(2) library." >&4
15554	val="$undef"
15555fi
15556set d_msg
15557eval $setvar
15558
15559: Check for msghdr_s
15560echo " "
15561echo "Checking to see if your system supports struct msghdr..." >&4
15562set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15563eval $hasstruct
15564case "$d_msghdr_s" in
15565"$define")      echo "Yes, it does."   ;;
15566*)              echo "No, it doesn't." ;;
15567esac
15568
15569
15570: see if msync exists
15571set msync d_msync
15572eval $inlibc
15573
15574: see if munmap exists
15575set munmap d_munmap
15576eval $inlibc
15577
15578: see if nice exists
15579set nice d_nice
15580eval $inlibc
15581
15582: see if this is a langinfo.h system
15583set langinfo.h i_langinfo
15584eval $inhdr
15585
15586: see if nl_langinfo exists
15587set nl_langinfo d_nl_langinfo
15588eval $inlibc
15589
15590: check for volatile keyword
15591echo " "
15592echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15593$cat >try.c <<'EOCP'
15594int main()
15595{
15596	typedef struct _goo_struct goo_struct;
15597	goo_struct * volatile goo = ((goo_struct *)0);
15598	struct _goo_struct {
15599		long long_int;
15600		int reg_int;
15601		char char_var;
15602	};
15603	typedef unsigned short foo_t;
15604	char *volatile foo;
15605	volatile int bar;
15606	volatile foo_t blech;
15607	foo = foo;
15608}
15609EOCP
15610if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15611	val="$define"
15612	echo "Yup, it does."
15613else
15614	val="$undef"
15615	echo "Nope, it doesn't."
15616fi
15617set d_volatile
15618eval $setvar
15619$rm_try
15620
15621: Check basic sizes
15622echo " "
15623$echo "Choosing the C types to be used for Perl's internal types..." >&4
15624
15625case "$use64bitint:$d_quad:$quadtype" in
15626define:define:?*)
15627	ivtype="$quadtype"
15628	uvtype="$uquadtype"
15629	ivsize=8
15630	uvsize=8
15631	;;
15632*)	ivtype="long"
15633	uvtype="unsigned long"
15634	ivsize=$longsize
15635	uvsize=$longsize
15636	;;
15637esac
15638
15639case "$uselongdouble:$d_longdbl" in
15640define:define)
15641	nvtype="long double"
15642	nvsize=$longdblsize
15643	;;
15644*)	nvtype=double
15645	nvsize=$doublesize
15646	;;
15647esac
15648
15649$echo "(IV will be "$ivtype", $ivsize bytes)"
15650$echo "(UV will be "$uvtype", $uvsize bytes)"
15651$echo "(NV will be "$nvtype", $nvsize bytes)"
15652
15653$cat >try.c <<EOCP
15654#$i_inttypes I_INTTYPES
15655#ifdef I_INTTYPES
15656#include <inttypes.h>
15657#endif
15658#include <stdio.h>
15659int main() {
15660#ifdef INT8
15661   int8_t i =  INT8_MAX;
15662  uint8_t u = UINT8_MAX;
15663  printf("int8_t\n");
15664#endif
15665#ifdef INT16
15666   int16_t i =  INT16_MAX;
15667  uint16_t i = UINT16_MAX;
15668  printf("int16_t\n");
15669#endif
15670#ifdef INT32
15671   int32_t i =  INT32_MAX;
15672  uint32_t u = UINT32_MAX;
15673  printf("int32_t\n");
15674#endif
15675}
15676EOCP
15677
15678i8type="signed char"
15679u8type="unsigned char"
15680i8size=1
15681u8size=1
15682
15683case "$i16type" in
15684'')	case "$shortsize" in
15685	2)	i16type=short
15686		u16type="unsigned short"
15687		i16size=$shortsize
15688		u16size=$shortsize
15689		;;
15690	esac
15691	;;
15692esac
15693case "$i16type" in
15694'')	set try -DINT16
15695	if eval $compile; then
15696		case "`$run ./try`" in
15697		int16_t)
15698			i16type=int16_t
15699			u16type=uint16_t
15700			i16size=2
15701			u16size=2
15702			;;
15703		esac
15704	fi
15705	;;
15706esac
15707case "$i16type" in
15708'')	if $test $shortsize -ge 2; then
15709		i16type=short
15710		u16type="unsigned short"
15711		i16size=$shortsize
15712		u16size=$shortsize
15713	fi
15714	;;
15715esac
15716
15717case "$i32type" in
15718'')	case "$longsize" in
15719	4)	i32type=long
15720		u32type="unsigned long"
15721		i32size=$longsize
15722		u32size=$longsize
15723		;;
15724	*)	case "$intsize" in
15725		4)	i32type=int
15726			u32type="unsigned int"
15727			i32size=$intsize
15728			u32size=$intsize
15729			;;
15730		esac
15731		;;
15732	esac
15733	;;
15734esac
15735case "$i32type" in
15736'')	set try -DINT32
15737	if eval $compile; then
15738		case "`$run ./try`" in
15739		int32_t)
15740			i32type=int32_t
15741			u32type=uint32_t
15742			i32size=4
15743			u32size=4
15744			;;
15745		esac
15746	fi
15747	;;
15748esac
15749case "$i32type" in
15750'')	if $test $intsize -ge 4; then
15751		i32type=int
15752		u32type="unsigned int"
15753		i32size=$intsize
15754		u32size=$intsize
15755	fi
15756	;;
15757esac
15758
15759case "$i64type" in
15760'')	case "$d_quad:$quadtype" in
15761	define:?*)
15762		i64type="$quadtype"
15763		u64type="$uquadtype"
15764		i64size=8
15765		u64size=8
15766		;;
15767	esac
15768	;;
15769esac
15770
15771$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15772: volatile so that the compiler has to store it out to memory.
15773if test X"$d_volatile" = X"$define"; then
15774	volatile=volatile
15775fi
15776$cat <<EOP >try.c
15777#include <stdio.h>
15778#$i_stdlib I_STDLIB
15779#ifdef I_STDLIB
15780#include <stdlib.h>
15781#endif
15782#include <sys/types.h>
15783#include <signal.h>
15784#ifdef SIGFPE
15785$volatile int bletched = 0;
15786$signal_t blech(int s) { bletched = 1; }
15787#endif
15788int main() {
15789    $uvtype u = 0;
15790    $nvtype d;
15791    int     n = 8 * $uvsize;
15792    int     i;
15793#ifdef SIGFPE
15794    signal(SIGFPE, blech);
15795#endif
15796
15797    for (i = 0; i < n; i++) {
15798      u = u << 1 | ($uvtype)1;
15799      d = ($nvtype)u;
15800      if (($uvtype)d != u)
15801        break;
15802      if (d <= 0)
15803	break;
15804      d = ($nvtype)(u - 1);
15805      if (($uvtype)d != (u - 1))
15806        break;
15807#ifdef SIGFPE
15808      if (bletched)
15809	break;
15810#endif
15811    }
15812    printf("%d\n", ((i == n) ? -n : i));
15813    exit(0);
15814}
15815EOP
15816set try
15817
15818d_nv_preserves_uv="$undef"
15819if eval $compile; then
15820	nv_preserves_uv_bits="`$run ./try`"
15821fi
15822case "$nv_preserves_uv_bits" in
15823\-[1-9]*)
15824	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15825	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15826	d_nv_preserves_uv="$define"
15827	;;
15828[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15829	d_nv_preserves_uv="$undef" ;;
15830*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
15831	nv_preserves_uv_bits="0" ;;
15832esac
15833$rm_try
15834
15835$echo "Checking to find the largest integer value your NVs can hold..." >&4
15836: volatile so that the compiler has to store it out to memory.
15837if test X"$d_volatile" = X"$define"; then
15838	volatile=volatile
15839fi
15840$cat <<EOP >try.c
15841#include <stdio.h>
15842
15843typedef $nvtype NV;
15844
15845int
15846main() {
15847  NV value = 2;
15848  int count = 1;
15849
15850  while(count < 256) {
15851    $volatile NV up = value + 1.0;
15852    $volatile NV negated = -value;
15853    $volatile NV down = negated - 1.0;
15854    $volatile NV got_up = up - value;
15855    int up_good = got_up == 1.0;
15856    int got_down = down - negated;
15857    int down_good = got_down == -1.0;
15858
15859    if (down_good != up_good) {
15860      fprintf(stderr,
15861	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15862	      up_good, (double) got_up, down_good, (double) got_down,
15863	      count, (double) value);
15864      return 1;
15865    }
15866    if (!up_good) {
15867      while (1) {
15868	if (count > 8) {
15869	  count -= 8;
15870	  fputs("256.0", stdout);
15871	} else {
15872	  count--;
15873	  fputs("2.0", stdout);
15874	}
15875	if (!count) {
15876	  puts("");
15877	  return 0;
15878	}
15879	fputs("*", stdout);
15880      }
15881    }
15882    value *= 2;
15883    ++count;
15884  }
15885  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15886	  count, (double) value);
15887  return 1;
15888}
15889EOP
15890set try
15891
15892nv_overflows_integers_at='0'
15893if eval $compile; then
15894    xxx="`$run ./try`"
15895    case "$?" in
15896	0)
15897	    case "$xxx" in
15898		2*)  cat >&4 <<EOM
15899The largest integer your NVs can preserve is equal to $xxx
15900EOM
15901		    nv_overflows_integers_at="$xxx"
15902		    ;;
15903		*)  cat >&4 <<EOM
15904Cannot determine the largest integer value your NVs can hold, unexpected output
15905'$xxx'
15906EOM
15907		    ;;
15908	    esac
15909	    ;;
15910	*)  cat >&4 <<EOM
15911Cannot determine the largest integer value your NVs can hold
15912EOM
15913	    ;;
15914    esac
15915fi
15916$rm_try
15917
15918$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15919: volatile so that the compiler has to store it out to memory.
15920if test X"$d_volatile" = X"$define"; then
15921	volatile=volatile
15922fi
15923$cat <<EOP >try.c
15924#include <stdio.h>
15925#$i_stdlib I_STDLIB
15926#ifdef I_STDLIB
15927#include <stdlib.h>
15928#endif
15929#$i_string I_STRING
15930#ifdef I_STRING
15931#  include <string.h>
15932#else
15933#  include <strings.h>
15934#endif
15935#include <sys/types.h>
15936#include <signal.h>
15937#ifdef SIGFPE
15938$volatile int bletched = 0;
15939$signal_t blech(int s) { bletched = 1; }
15940#endif
15941
15942int checkit($nvtype d, char *where) {
15943    unsigned char *p = (char *)&d;
15944    unsigned char *end = p + sizeof(d);
15945    int fail = 0;
15946
15947    while (p < end)
15948	fail += *p++;
15949
15950    if (!fail)
15951	return 0;
15952
15953    p = (char *)&d;
15954    printf("No - %s: 0x", where);
15955    while (p < end)
15956	printf ("%02X", *p++);
15957    printf("\n");
15958    return 1;
15959}
15960
15961int main(int argc, char **argv) {
15962    $nvtype d = 0.0;
15963    int fail = 0;
15964    fail += checkit(d, "0.0");
15965
15966    /* The compiler shouldn't be assuming that bletched is 0  */
15967    d = bletched;
15968
15969    fail += checkit(d, "bleched");
15970
15971#ifdef SIGFPE
15972    signal(SIGFPE, blech);
15973#endif
15974
15975    /* Paranoia - the compiler should have no way of knowing that ANSI says
15976       that argv[argc] will always be NULL.  Actually, if it did assume this it
15977       would be buggy, as this is C and main() can be called from elsewhere in
15978       the program.  */
15979    d = argv[argc] ? 1 : 0;
15980
15981    if (d) {
15982	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15983    }
15984
15985    fail += checkit(d, "ternary");
15986
15987    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15988
15989    if (d != 0.0) {
15990	printf("No - memset doesn't give 0.0\n");
15991	/* This might just blow up:  */
15992	printf("(gives %g)\n", d);
15993	return 1;
15994    }
15995
15996#ifdef SIGFPE
15997    if (bletched) {
15998	printf("No - something bleched\n");
15999	return 1;
16000    }
16001#endif
16002    if (fail) {
16003      printf("No - %d fail(s)\n", fail);
16004      return 1;
16005    }
16006    printf("Yes\n");
16007    return 0;
16008}
16009EOP
16010set try
16011
16012d_nv_zero_is_allbits_zero="$undef"
16013if eval $compile; then
16014    xxx="`$run ./try`"
16015    case "$?" in
16016	0)
16017	    case "$xxx" in
16018		Yes)  cat >&4 <<EOM
160190.0 is represented as all bits zero in memory
16020EOM
16021		    d_nv_zero_is_allbits_zero="$define"
16022		    ;;
16023		*)  cat >&4 <<EOM
160240.0 is not represented as all bits zero in memory
16025EOM
16026		    d_nv_zero_is_allbits_zero="$undef"
16027		    ;;
16028	    esac
16029	    ;;
16030	*)  cat >&4 <<EOM
160310.0 is not represented as all bits zero in memory
16032EOM
16033	    d_nv_zero_is_allbits_zero="$undef"
16034	    ;;
16035    esac
16036fi
16037$rm_try
16038
16039: check for off64_t
16040echo " "
16041echo "Checking to see if you have off64_t..." >&4
16042$cat >try.c <<EOCP
16043#include <sys/types.h>
16044#include <unistd.h>
16045int main() { off64_t x = 7; }
16046EOCP
16047set try
16048if eval $compile; then
16049	val="$define"
16050	echo "You have off64_t."
16051else
16052	val="$undef"
16053	echo "You do not have off64_t."
16054	case "$lseeksize" in
16055	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16056	esac
16057fi
16058$rm_try
16059set d_off64_t
16060eval $setvar
16061
16062: how to create joinable pthreads
16063if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16064	echo " "
16065	echo "Checking what constant to use for creating joinable pthreads..." >&4
16066	$cat >try.c <<'EOCP'
16067#include <pthread.h>
16068int main() {
16069    int detachstate = JOINABLE;
16070}
16071EOCP
16072	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16073	if eval $compile; then
16074		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16075		val="$undef" # Yes, undef.
16076		set d_old_pthread_create_joinable
16077		eval $setvar
16078		val=""
16079		set old_pthread_create_joinable
16080		eval $setvar
16081	else
16082		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16083		if eval $compile; then
16084			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16085			val="$define"
16086			set d_old_pthread_create_joinable
16087			eval $setvar
16088			val=PTHREAD_CREATE_UNDETACHED
16089			set old_pthread_create_joinable
16090			eval $setvar
16091		else
16092			set try -DJOINABLE=__UNDETACHED
16093			if eval $compile; then
16094				echo "You seem to use __UNDETACHED." >&4
16095				val="$define"
16096				set d_old_pthread_create_joinable
16097				eval $setvar
16098				val=__UNDETACHED
16099				set old_pthread_create_joinable
16100				eval $setvar
16101			else
16102				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16103				val="$define"
16104				set d_old_pthread_create_joinable
16105				eval $setvar
16106				val=0
16107				set old_pthread_create_joinable
16108				eval $setvar
16109			fi
16110		fi
16111	fi
16112	$rm_try
16113else
16114    d_old_pthread_create_joinable="$undef"
16115    old_pthread_create_joinable=""
16116fi
16117
16118: see if pause exists
16119set pause d_pause
16120eval $inlibc
16121
16122: see if poll exists
16123set poll d_poll
16124eval $inlibc
16125
16126: see if prctl exists
16127set prctl d_prctl
16128eval $inlibc
16129
16130: see if prctl supports PR_SET_NAME
16131d_prctl_set_name=$undef
16132case $d_prctl in
16133    $define)
16134	$cat >try.c <<EOM
16135#include <sys/prctl.h>
16136
16137int main (int argc, char *argv[])
16138{
16139    return (prctl (PR_SET_NAME, "Test"));
16140    } /* main */
16141EOM
16142	set try
16143	if eval $compile_ok && $run ./try; then
16144	    echo "Your prctl (PR_SET_NAME, ...) works"
16145	    d_prctl_set_name=$define
16146	    fi
16147	$rm_try
16148	;;
16149    esac
16150
16151: see if readlink exists
16152set readlink d_readlink
16153eval $inlibc
16154
16155: Check if exe is symlink to abs path of executing program
16156echo " "
16157procselfexe=''
16158val="$undef"
16159case "$d_readlink" in
16160    "$define")
16161	: NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16162	: more tidy to avoid an extra level of symlink
16163	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16164	while test $# -gt 0; do
16165	    type=$1; try=$2
16166	    shift; shift
16167	    if $issymlink $try; then
16168		$ls -l $try > reflect
16169		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16170		    echo "You have $type-like $try."
16171		    procselfexe='"'$try'"'
16172		    val="$define"
16173		    : This will break out of the loop
16174		    set X; shift
16175		fi
16176	    fi
16177	done
16178	;;
16179esac
16180$rm -f reflect
16181set d_procselfexe
16182eval $setvar
16183
16184: backward compatibility for d_hvfork
16185if test X$d_hvfork != X; then
16186	d_vfork="$d_hvfork"
16187	d_hvfork=''
16188fi
16189: see if there is a vfork
16190val=''
16191set vfork val
16192eval $inlibc
16193
16194d_pseudofork=$undef
16195
16196: Ok, but do we want to use it. vfork is reportedly unreliable in
16197: perl on Solaris 2.x, and probably elsewhere.
16198case "$val" in
16199$define)
16200	echo " "
16201	case "$usevfork" in
16202	false) dflt='n';;
16203	*) dflt='y';;
16204	esac
16205	cat <<'EOM'
16206
16207Perl can only use a vfork() that doesn't suffer from strict
16208restrictions on calling functions or modifying global data in
16209the child.  For example, glibc-2.1 contains such a vfork()
16210that is unsuitable.  If your system provides a proper fork()
16211call, chances are that you do NOT want perl to use vfork().
16212
16213EOM
16214	rp="Do you still want to use vfork()?"
16215	. ./myread
16216	case "$ans" in
16217	y|Y) ;;
16218	*)
16219		echo "Ok, we won't use vfork()."
16220		val="$undef"
16221		;;
16222	esac
16223	;;
16224esac
16225set d_vfork
16226eval $setvar
16227case "$d_vfork" in
16228$define) usevfork='true';;
16229*) usevfork='false';;
16230esac
16231
16232: see whether the pthread_atfork exists
16233$cat >try.c <<EOP
16234#include <pthread.h>
16235#include <stdio.h>
16236int main() {
16237#ifdef  PTHREAD_ATFORK
16238        pthread_atfork(NULL,NULL,NULL);
16239#endif
16240}
16241EOP
16242
16243: see if pthread_atfork exists
16244set try -DPTHREAD_ATFORK
16245if eval $compile; then
16246    val="$define"
16247else
16248    val="$undef"
16249fi
16250case "$usethreads" in
16251$define)
16252        case "$val" in
16253        $define) echo 'pthread_atfork found.' >&4        ;;
16254        *)       echo 'pthread_atfork NOT found.' >&4    ;;
16255        esac
16256esac
16257set d_pthread_atfork
16258eval $setvar
16259
16260: see if pthread_attr_setscope exists
16261set pthread_attr_setscope d_pthread_attr_setscope
16262eval $inlibc
16263
16264: see whether the various POSIXish _yields exist
16265$cat >try.c <<EOP
16266#include <pthread.h>
16267#include <stdio.h>
16268int main() {
16269#ifdef SCHED_YIELD
16270	sched_yield();
16271#else
16272#ifdef PTHREAD_YIELD
16273	pthread_yield();
16274#else
16275#ifdef PTHREAD_YIELD_NULL
16276	pthread_yield(NULL);
16277#endif
16278#endif
16279#endif
16280}
16281EOP
16282: see if sched_yield exists
16283set try -DSCHED_YIELD
16284if eval $compile; then
16285    val="$define"
16286    sched_yield='sched_yield()'
16287else
16288    val="$undef"
16289fi
16290case "$usethreads" in
16291$define)
16292	case "$val" in
16293	$define) echo 'sched_yield() found.' >&4	;;
16294	*)	 echo 'sched_yield() NOT found.' >&4	;;
16295	esac
16296esac
16297set d_sched_yield
16298eval $setvar
16299
16300: see if pthread_yield exists
16301set try -DPTHREAD_YIELD
16302if eval $compile; then
16303    val="$define"
16304    case "$sched_yield" in
16305    '') sched_yield='pthread_yield()' ;;
16306    esac
16307else
16308    set try -DPTHREAD_YIELD_NULL
16309    if eval $compile; then
16310	val="$define"
16311	case "$sched_yield" in
16312	'') sched_yield='pthread_yield(NULL)' ;;
16313	esac
16314    else
16315	val="$undef"
16316    fi
16317fi
16318case "$usethreads" in
16319$define)
16320	case "$val" in
16321	$define) echo 'pthread_yield() found.' >&4	;;
16322	*)	 echo 'pthread_yield() NOT found.' >&4	;;
16323	esac
16324	;;
16325esac
16326set d_pthread_yield
16327eval $setvar
16328case "$sched_yield" in
16329'') sched_yield=undef ;;
16330esac
16331$rm_try
16332
16333: see if random_r exists
16334set random_r d_random_r
16335eval $inlibc
16336case "$d_random_r" in
16337"$define")
16338	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16339	case "$d_random_r_proto:$usethreads" in
16340	":define")	d_random_r_proto=define
16341		set d_random_r_proto random_r $hdrs
16342		eval $hasproto ;;
16343	*)	;;
16344	esac
16345	case "$d_random_r_proto" in
16346	define)
16347	case "$random_r_proto" in
16348	''|0) try='int random_r(int*, struct random_data*);'
16349	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16350	esac
16351	case "$random_r_proto" in
16352	''|0) try='int random_r(long*, struct random_data*);'
16353	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16354	esac
16355	case "$random_r_proto" in
16356	''|0) try='int random_r(struct random_data*, int32_t*);'
16357	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16358	esac
16359	case "$random_r_proto" in
16360	''|0)	d_random_r=undef
16361 	        random_r_proto=0
16362		echo "Disabling random_r, cannot determine prototype." >&4 ;;
16363	* )	case "$random_r_proto" in
16364		REENTRANT_PROTO*) ;;
16365		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16366		esac
16367		echo "Prototype: $try" ;;
16368	esac
16369	;;
16370	*)	case "$usethreads" in
16371		define) echo "random_r has no prototype, not using it." >&4 ;;
16372		esac
16373		d_random_r=undef
16374		random_r_proto=0
16375		;;
16376	esac
16377	;;
16378*)	random_r_proto=0
16379	;;
16380esac
16381
16382: see if readdir and friends exist
16383set readdir d_readdir
16384eval $inlibc
16385set seekdir d_seekdir
16386eval $inlibc
16387set telldir d_telldir
16388eval $inlibc
16389set rewinddir d_rewinddir
16390eval $inlibc
16391
16392: see if readdir64_r exists
16393set readdir64_r d_readdir64_r
16394eval $inlibc
16395case "$d_readdir64_r" in
16396"$define")
16397	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16398	case "$d_readdir64_r_proto:$usethreads" in
16399	":define")	d_readdir64_r_proto=define
16400		set d_readdir64_r_proto readdir64_r $hdrs
16401		eval $hasproto ;;
16402	*)	;;
16403	esac
16404	case "$d_readdir64_r_proto" in
16405	define)
16406	case "$readdir64_r_proto" in
16407	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16408	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16409	esac
16410	case "$readdir64_r_proto" in
16411	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16412	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16413	esac
16414	case "$readdir64_r_proto" in
16415	''|0)	d_readdir64_r=undef
16416 	        readdir64_r_proto=0
16417		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16418	* )	case "$readdir64_r_proto" in
16419		REENTRANT_PROTO*) ;;
16420		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16421		esac
16422		echo "Prototype: $try" ;;
16423	esac
16424	;;
16425	*)	case "$usethreads" in
16426		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16427		esac
16428		d_readdir64_r=undef
16429		readdir64_r_proto=0
16430		;;
16431	esac
16432	;;
16433*)	readdir64_r_proto=0
16434	;;
16435esac
16436
16437: see if readdir_r exists
16438set readdir_r d_readdir_r
16439eval $inlibc
16440case "$d_readdir_r" in
16441"$define")
16442	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16443	case "$d_readdir_r_proto:$usethreads" in
16444	":define")	d_readdir_r_proto=define
16445		set d_readdir_r_proto readdir_r $hdrs
16446		eval $hasproto ;;
16447	*)	;;
16448	esac
16449	case "$d_readdir_r_proto" in
16450	define)
16451	case "$readdir_r_proto" in
16452	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16453	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16454	esac
16455	case "$readdir_r_proto" in
16456	''|0) try='int readdir_r(DIR*, struct dirent*);'
16457	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16458	esac
16459	case "$readdir_r_proto" in
16460	''|0)	d_readdir_r=undef
16461 	        readdir_r_proto=0
16462		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16463	* )	case "$readdir_r_proto" in
16464		REENTRANT_PROTO*) ;;
16465		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16466		esac
16467		echo "Prototype: $try" ;;
16468	esac
16469	;;
16470	*)	case "$usethreads" in
16471		define) echo "readdir_r has no prototype, not using it." >&4 ;;
16472		esac
16473		d_readdir_r=undef
16474		readdir_r_proto=0
16475		;;
16476	esac
16477	;;
16478*)	readdir_r_proto=0
16479	;;
16480esac
16481
16482: see if readv exists
16483set readv d_readv
16484eval $inlibc
16485
16486: see if recvmsg exists
16487set recvmsg d_recvmsg
16488eval $inlibc
16489
16490: see if rename exists
16491set rename d_rename
16492eval $inlibc
16493
16494: see if rmdir exists
16495set rmdir d_rmdir
16496eval $inlibc
16497
16498: see if memory.h is available.
16499val=''
16500set memory.h val
16501eval $inhdr
16502
16503: See if it conflicts with string.h
16504case "$val" in
16505$define)
16506	case "$strings" in
16507	'') ;;
16508	*)
16509		$cppstdin $cppflags $cppminus < $strings > mem.h
16510		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16511			echo " "
16512			echo "We won't be including <memory.h>."
16513			val="$undef"
16514		fi
16515		$rm -f mem.h
16516		;;
16517	esac
16518esac
16519set i_memory
16520eval $setvar
16521
16522: can bcopy handle overlapping blocks?
16523echo " "
16524val="$undef"
16525case "$d_memmove" in
16526"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16527*)	case "$d_bcopy" in
16528	"$define")
16529		echo "Checking to see if bcopy() can do overlapping copies..." >&4
16530		$cat >try.c <<EOCP
16531#$i_memory I_MEMORY
16532#$i_stdlib I_STDLIB
16533#$i_string I_STRING
16534#$i_unistd I_UNISTD
16535EOCP
16536	$cat >>try.c <<'EOCP'
16537#include <stdio.h>
16538#ifdef I_MEMORY
16539#  include <memory.h>
16540#endif
16541#ifdef I_STDLIB
16542#  include <stdlib.h>
16543#endif
16544#ifdef I_STRING
16545#  include <string.h>
16546#else
16547#  include <strings.h>
16548#endif
16549#ifdef I_UNISTD
16550#  include <unistd.h>  /* Needed for NetBSD */
16551#endif
16552int main()
16553{
16554char buf[128], abc[128];
16555char *b;
16556int len;
16557int off;
16558int align;
16559
16560/* Copy "abcde..." string to char abc[] so that gcc doesn't
16561   try to store the string in read-only memory. */
16562bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16563
16564for (align = 7; align >= 0; align--) {
16565	for (len = 36; len; len--) {
16566		b = buf+align;
16567		bcopy(abc, b, len);
16568		for (off = 1; off <= len; off++) {
16569			bcopy(b, b+off, len);
16570			bcopy(b+off, b, len);
16571			if (bcmp(b, abc, len))
16572				exit(1);
16573		}
16574	}
16575}
16576exit(0);
16577}
16578EOCP
16579		set try
16580		if eval $compile_ok; then
16581			if $run ./try 2>/dev/null; then
16582				echo "Yes, it can."
16583				val="$define"
16584			else
16585				echo "It can't, sorry."
16586			fi
16587		else
16588			echo "(I can't compile the test program, so we'll assume not...)"
16589		fi
16590		;;
16591	esac
16592	$rm_try
16593	;;
16594esac
16595set d_safebcpy
16596eval $setvar
16597
16598: can memcpy handle overlapping blocks?
16599echo " "
16600val="$undef"
16601case "$d_memmove" in
16602"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16603*)	case "$d_memcpy" in
16604	"$define")
16605		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16606		$cat >try.c <<EOCP
16607#$i_memory I_MEMORY
16608#$i_stdlib I_STDLIB
16609#$i_string I_STRING
16610#$i_unistd I_UNISTD
16611EOCP
16612	$cat >>try.c <<'EOCP'
16613#include <stdio.h>
16614#ifdef I_MEMORY
16615#  include <memory.h>
16616#endif
16617#ifdef I_STDLIB
16618#  include <stdlib.h>
16619#endif
16620#ifdef I_STRING
16621#  include <string.h>
16622#else
16623#  include <strings.h>
16624#endif
16625#ifdef I_UNISTD
16626#  include <unistd.h>  /* Needed for NetBSD */
16627#endif
16628int main()
16629{
16630char buf[128], abc[128];
16631char *b;
16632int len;
16633int off;
16634int align;
16635
16636/* Copy "abcde..." string to char abc[] so that gcc doesn't
16637   try to store the string in read-only memory. */
16638memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16639
16640for (align = 7; align >= 0; align--) {
16641	for (len = 36; len; len--) {
16642		b = buf+align;
16643		memcpy(b, abc, len);
16644		for (off = 1; off <= len; off++) {
16645			memcpy(b+off, b, len);
16646			memcpy(b, b+off, len);
16647			if (memcmp(b, abc, len))
16648				exit(1);
16649		}
16650	}
16651}
16652exit(0);
16653}
16654EOCP
16655		set try
16656		if eval $compile_ok; then
16657			if $run ./try 2>/dev/null; then
16658				echo "Yes, it can."
16659				val="$define"
16660			else
16661				echo "It can't, sorry."
16662			fi
16663		else
16664			echo "(I can't compile the test program, so we'll assume not...)"
16665		fi
16666		;;
16667	esac
16668	$rm_try
16669	;;
16670esac
16671set d_safemcpy
16672eval $setvar
16673
16674: can memcmp be trusted to compare relative magnitude?
16675val="$undef"
16676case "$d_memcmp" in
16677"$define")
16678	echo " "
16679	echo "Checking if your memcmp() can compare relative magnitude..." >&4
16680	$cat >try.c <<EOCP
16681#$i_memory I_MEMORY
16682#$i_stdlib I_STDLIB
16683#$i_string I_STRING
16684#$i_unistd I_UNISTD
16685EOCP
16686	$cat >>try.c <<'EOCP'
16687#include <stdio.h>
16688#ifdef I_MEMORY
16689#  include <memory.h>
16690#endif
16691#ifdef I_STDLIB
16692#  include <stdlib.h>
16693#endif
16694#ifdef I_STRING
16695#  include <string.h>
16696#else
16697#  include <strings.h>
16698#endif
16699#ifdef I_UNISTD
16700#  include <unistd.h>  /* Needed for NetBSD */
16701#endif
16702int main()
16703{
16704char a = -1;
16705char b = 0;
16706if ((a < b) && memcmp(&a, &b, 1) < 0)
16707	exit(1);
16708exit(0);
16709}
16710EOCP
16711	set try
16712	if eval $compile_ok; then
16713		if $run ./try 2>/dev/null; then
16714			echo "Yes, it can."
16715			val="$define"
16716		else
16717			echo "No, it can't (it uses signed chars)."
16718		fi
16719	else
16720		echo "(I can't compile the test program, so we'll assume not...)"
16721	fi
16722	;;
16723esac
16724$rm_try
16725set d_sanemcmp
16726eval $setvar
16727
16728: see if prototype for sbrk is available
16729echo " "
16730set d_sbrkproto sbrk $i_unistd unistd.h
16731eval $hasproto
16732
16733: see if select exists
16734set select d_select
16735eval $inlibc
16736
16737: see if semctl exists
16738set semctl d_semctl
16739eval $inlibc
16740
16741: see if semget exists
16742set semget d_semget
16743eval $inlibc
16744
16745: see if semop exists
16746set semop d_semop
16747eval $inlibc
16748
16749: see how much of the 'sem*(2)' library is present.
16750h_sem=true
16751echo " "
16752case "$d_semctl$d_semget$d_semop" in
16753*"$undef"*) h_sem=false;;
16754esac
16755case "$osname" in
16756freebsd)
16757    case "`ipcs 2>&1`" in
16758    "SVID messages"*"not configured"*)
16759	echo "Your $osname does not have the sem*(2) configured." >&4
16760        h_sem=false
16761	val="$undef"
16762	set semctl d_semctl
16763	eval $setvar
16764	set semget d_semget
16765	eval $setvar
16766	set semop d_semop
16767	eval $setvar
16768	;;
16769    esac
16770    ;;
16771esac
16772: we could also check for sys/ipc.h ...
16773if $h_sem && $test `./findhdr sys/sem.h`; then
16774	echo "You have the full sem*(2) library." >&4
16775	val="$define"
16776else
16777	echo "You don't have the full sem*(2) library." >&4
16778	val="$undef"
16779fi
16780set d_sem
16781eval $setvar
16782
16783: see whether sys/sem.h defines union semun
16784echo " "
16785$cat > try.c <<'END'
16786#include <sys/types.h>
16787#include <sys/ipc.h>
16788#include <sys/sem.h>
16789int main () { union semun semun; semun.buf = 0; }
16790END
16791set try
16792if eval $compile; then
16793    echo "You have union semun in <sys/sem.h>." >&4
16794    val="$define"
16795else
16796    echo "You do not have union semun in <sys/sem.h>." >&4
16797    val="$undef"
16798fi
16799$rm_try
16800set d_union_semun
16801eval $setvar
16802
16803: see how to do semctl IPC_STAT
16804case "$d_sem" in
16805$define)
16806    echo " "
16807    $cat > tryh.h <<END
16808#ifndef S_IRUSR
16809#   ifdef S_IREAD
16810#	define S_IRUSR S_IREAD
16811#	define S_IWUSR S_IWRITE
16812#	define S_IXUSR S_IEXEC
16813#   else
16814#	define S_IRUSR 0400
16815#	define S_IWUSR 0200
16816#	define S_IXUSR 0100
16817#   endif
16818#   define S_IRGRP (S_IRUSR>>3)
16819#   define S_IWGRP (S_IWUSR>>3)
16820#   define S_IXGRP (S_IXUSR>>3)
16821#   define S_IROTH (S_IRUSR>>6)
16822#   define S_IWOTH (S_IWUSR>>6)
16823#   define S_IXOTH (S_IXUSR>>6)
16824#endif
16825#ifndef S_IRWXU
16826#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16827#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16828#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16829#endif
16830END
16831    : see whether semctl IPC_STAT can use union semun
16832    case "$d_semctl_semun" in
16833    '')
16834      val="$undef"
16835      $cat > try.c <<END
16836#include <sys/types.h>
16837#include <sys/ipc.h>
16838#include <sys/sem.h>
16839#include <sys/stat.h>
16840#include <stdio.h>
16841#include <errno.h>
16842#include "tryh.h"
16843#ifndef errno
16844extern int errno;
16845#endif
16846#$d_union_semun HAS_UNION_SEMUN
16847int main() {
16848    union semun
16849#ifndef HAS_UNION_SEMUN
16850    {
16851	int val;
16852	struct semid_ds *buf;
16853	unsigned short *array;
16854    }
16855#endif
16856    arg;
16857    int sem, st;
16858
16859#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16860    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16861    if (sem > -1) {
16862	struct semid_ds argbuf;
16863	arg.buf = &argbuf;
16864#	ifdef IPC_STAT
16865	st = semctl(sem, 0, IPC_STAT, arg);
16866	if (st == 0)
16867	    printf("semun\n");
16868	else
16869#	endif /* IPC_STAT */
16870	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16871#	ifdef IPC_RMID
16872	if (semctl(sem, 0, IPC_RMID, arg) != 0)
16873#	endif /* IPC_RMID */
16874	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16875    } else
16876#endif /* IPC_PRIVATE && ... */
16877	printf("semget failed: errno = %d\n", errno);
16878  return 0;
16879}
16880END
16881      set try
16882      if eval $compile; then
16883	  xxx=`$run ./try`
16884          case "$xxx" in
16885          semun) val="$define" ;;
16886          esac
16887      fi
16888      $rm_try
16889      set d_semctl_semun
16890      eval $setvar
16891      ;;
16892    esac
16893    case "$d_semctl_semun" in
16894    $define)
16895        echo "You can use union semun for semctl IPC_STAT." >&4
16896	also='also'
16897        ;;
16898    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16899	also=''
16900        ;;
16901    esac
16902
16903    : see whether semctl IPC_STAT can use struct semid_ds pointer
16904    case "$d_semctl_semid_ds" in
16905    '')
16906      val="$undef"
16907      $cat > try.c <<'END'
16908#include <sys/types.h>
16909#include <sys/ipc.h>
16910#include <sys/sem.h>
16911#include <sys/stat.h>
16912#include "tryh.h"
16913#include <stdio.h>
16914#include <errno.h>
16915#ifndef errno
16916extern int errno;
16917#endif
16918int main() {
16919    struct semid_ds arg;
16920    int sem, st;
16921
16922#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16923    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16924    if (sem > -1) {
16925#	ifdef IPC_STAT
16926	st = semctl(sem, 0, IPC_STAT, &arg);
16927	if (st == 0)
16928	    printf("semid_ds\n");
16929	else
16930#	endif /* IPC_STAT */
16931	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16932#	ifdef IPC_RMID
16933	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16934#	endif /* IPC_RMID */
16935	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16936    } else
16937#endif /* IPC_PRIVATE && ... */
16938	printf("semget failed: errno = %d\n", errno);
16939
16940    return 0;
16941}
16942END
16943      set try
16944      if eval $compile; then
16945          xxx=`$run ./try`
16946          case "$xxx" in
16947          semid_ds) val="$define" ;;
16948          esac
16949      fi
16950      $rm_try
16951      set d_semctl_semid_ds
16952      eval $setvar
16953      ;;
16954    esac
16955    case "$d_semctl_semid_ds" in
16956    $define)
16957        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16958        ;;
16959    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16960        ;;
16961    esac
16962    ;;
16963*)  val="$undef"
16964
16965    # We do not have the full sem*(2) library, so assume we can not
16966    # use either.
16967
16968    set d_semctl_semun
16969    eval $setvar
16970
16971    set d_semctl_semid_ds
16972    eval $setvar
16973    ;;
16974esac
16975$rm_try tryh.h
16976
16977: see if sendmsg exists
16978set sendmsg d_sendmsg
16979eval $inlibc
16980
16981: see if setegid exists
16982set setegid d_setegid
16983eval $inlibc
16984
16985: see if seteuid exists
16986set seteuid d_seteuid
16987eval $inlibc
16988
16989: see if setgrent exists
16990set setgrent d_setgrent
16991eval $inlibc
16992
16993: see if setgrent_r exists
16994set setgrent_r d_setgrent_r
16995eval $inlibc
16996case "$d_setgrent_r" in
16997"$define")
16998	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16999	case "$d_setgrent_r_proto:$usethreads" in
17000	":define")	d_setgrent_r_proto=define
17001		set d_setgrent_r_proto setgrent_r $hdrs
17002		eval $hasproto ;;
17003	*)	;;
17004	esac
17005	case "$d_setgrent_r_proto" in
17006	define)
17007	case "$setgrent_r_proto" in
17008	''|0) try='int setgrent_r(FILE**);'
17009	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17010	esac
17011	case "$setgrent_r_proto" in
17012	''|0) try='void setgrent_r(FILE**);'
17013	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17014	esac
17015	case "$setgrent_r_proto" in
17016	''|0)	d_setgrent_r=undef
17017 	        setgrent_r_proto=0
17018		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17019	* )	case "$setgrent_r_proto" in
17020		REENTRANT_PROTO*) ;;
17021		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17022		esac
17023		echo "Prototype: $try" ;;
17024	esac
17025	;;
17026	*)	case "$usethreads" in
17027		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17028		esac
17029		d_setgrent_r=undef
17030		setgrent_r_proto=0
17031		;;
17032	esac
17033	;;
17034*)	setgrent_r_proto=0
17035	;;
17036esac
17037
17038: see if sethostent exists
17039set sethostent d_sethent
17040eval $inlibc
17041
17042: see if sethostent_r exists
17043set sethostent_r d_sethostent_r
17044eval $inlibc
17045case "$d_sethostent_r" in
17046"$define")
17047	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17048	case "$d_sethostent_r_proto:$usethreads" in
17049	":define")	d_sethostent_r_proto=define
17050		set d_sethostent_r_proto sethostent_r $hdrs
17051		eval $hasproto ;;
17052	*)	;;
17053	esac
17054	case "$d_sethostent_r_proto" in
17055	define)
17056	case "$sethostent_r_proto" in
17057	''|0) try='int sethostent_r(int, struct hostent_data*);'
17058	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17059	esac
17060	case "$sethostent_r_proto" in
17061	''|0) try='void sethostent_r(int, struct hostent_data*);'
17062	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17063	esac
17064	case "$sethostent_r_proto" in
17065	''|0)	d_sethostent_r=undef
17066 	        sethostent_r_proto=0
17067		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17068	* )	case "$sethostent_r_proto" in
17069		REENTRANT_PROTO*) ;;
17070		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17071		esac
17072		echo "Prototype: $try" ;;
17073	esac
17074	;;
17075	*)	case "$usethreads" in
17076		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17077		esac
17078		d_sethostent_r=undef
17079		sethostent_r_proto=0
17080		;;
17081	esac
17082	;;
17083*)	sethostent_r_proto=0
17084	;;
17085esac
17086
17087: see if setitimer exists
17088set setitimer d_setitimer
17089eval $inlibc
17090
17091: see if setlinebuf exists
17092set setlinebuf d_setlinebuf
17093eval $inlibc
17094
17095: see if setlocale exists
17096set setlocale d_setlocale
17097eval $inlibc
17098
17099: see if locale.h is available
17100set locale.h i_locale
17101eval $inhdr
17102
17103: see if setlocale_r exists
17104set setlocale_r d_setlocale_r
17105eval $inlibc
17106case "$d_setlocale_r" in
17107"$define")
17108	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17109	case "$d_setlocale_r_proto:$usethreads" in
17110	":define")	d_setlocale_r_proto=define
17111		set d_setlocale_r_proto setlocale_r $hdrs
17112		eval $hasproto ;;
17113	*)	;;
17114	esac
17115	case "$d_setlocale_r_proto" in
17116	define)
17117	case "$setlocale_r_proto" in
17118	''|0) try='int setlocale_r(int, const char*, char*, int);'
17119	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17120	esac
17121	case "$setlocale_r_proto" in
17122	''|0)	d_setlocale_r=undef
17123 	        setlocale_r_proto=0
17124		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17125	* )	case "$setlocale_r_proto" in
17126		REENTRANT_PROTO*) ;;
17127		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17128		esac
17129		echo "Prototype: $try" ;;
17130	esac
17131	;;
17132	*)	case "$usethreads" in
17133		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17134		esac
17135		d_setlocale_r=undef
17136		setlocale_r_proto=0
17137		;;
17138	esac
17139	;;
17140*)	setlocale_r_proto=0
17141	;;
17142esac
17143
17144: see if setnetent exists
17145set setnetent d_setnent
17146eval $inlibc
17147
17148: see if setnetent_r exists
17149set setnetent_r d_setnetent_r
17150eval $inlibc
17151case "$d_setnetent_r" in
17152"$define")
17153	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17154	case "$d_setnetent_r_proto:$usethreads" in
17155	":define")	d_setnetent_r_proto=define
17156		set d_setnetent_r_proto setnetent_r $hdrs
17157		eval $hasproto ;;
17158	*)	;;
17159	esac
17160	case "$d_setnetent_r_proto" in
17161	define)
17162	case "$setnetent_r_proto" in
17163	''|0) try='int setnetent_r(int, struct netent_data*);'
17164	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17165	esac
17166	case "$setnetent_r_proto" in
17167	''|0) try='void setnetent_r(int, struct netent_data*);'
17168	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17169	esac
17170	case "$setnetent_r_proto" in
17171	''|0)	d_setnetent_r=undef
17172 	        setnetent_r_proto=0
17173		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17174	* )	case "$setnetent_r_proto" in
17175		REENTRANT_PROTO*) ;;
17176		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17177		esac
17178		echo "Prototype: $try" ;;
17179	esac
17180	;;
17181	*)	case "$usethreads" in
17182		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17183		esac
17184		d_setnetent_r=undef
17185		setnetent_r_proto=0
17186		;;
17187	esac
17188	;;
17189*)	setnetent_r_proto=0
17190	;;
17191esac
17192
17193: see if setprotoent exists
17194set setprotoent d_setpent
17195eval $inlibc
17196
17197: see if setpgid exists
17198set setpgid d_setpgid
17199eval $inlibc
17200
17201: see if setpgrp2 exists
17202set setpgrp2 d_setpgrp2
17203eval $inlibc
17204
17205: see if setpriority exists
17206set setpriority d_setprior
17207eval $inlibc
17208
17209: see if setproctitle exists
17210set setproctitle d_setproctitle
17211eval $inlibc
17212
17213: see if setprotoent_r exists
17214set setprotoent_r d_setprotoent_r
17215eval $inlibc
17216case "$d_setprotoent_r" in
17217"$define")
17218	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17219	case "$d_setprotoent_r_proto:$usethreads" in
17220	":define")	d_setprotoent_r_proto=define
17221		set d_setprotoent_r_proto setprotoent_r $hdrs
17222		eval $hasproto ;;
17223	*)	;;
17224	esac
17225	case "$d_setprotoent_r_proto" in
17226	define)
17227	case "$setprotoent_r_proto" in
17228	''|0) try='int setprotoent_r(int, struct protoent_data*);'
17229	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17230	esac
17231	case "$setprotoent_r_proto" in
17232	''|0) try='void setprotoent_r(int, struct protoent_data*);'
17233	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17234	esac
17235	case "$setprotoent_r_proto" in
17236	''|0)	d_setprotoent_r=undef
17237 	        setprotoent_r_proto=0
17238		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17239	* )	case "$setprotoent_r_proto" in
17240		REENTRANT_PROTO*) ;;
17241		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17242		esac
17243		echo "Prototype: $try" ;;
17244	esac
17245	;;
17246	*)	case "$usethreads" in
17247		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17248		esac
17249		d_setprotoent_r=undef
17250		setprotoent_r_proto=0
17251		;;
17252	esac
17253	;;
17254*)	setprotoent_r_proto=0
17255	;;
17256esac
17257
17258: see if setpwent exists
17259set setpwent d_setpwent
17260eval $inlibc
17261
17262: see if setpwent_r exists
17263set setpwent_r d_setpwent_r
17264eval $inlibc
17265case "$d_setpwent_r" in
17266"$define")
17267	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17268	case "$d_setpwent_r_proto:$usethreads" in
17269	":define")	d_setpwent_r_proto=define
17270		set d_setpwent_r_proto setpwent_r $hdrs
17271		eval $hasproto ;;
17272	*)	;;
17273	esac
17274	case "$d_setpwent_r_proto" in
17275	define)
17276	case "$setpwent_r_proto" in
17277	''|0) try='int setpwent_r(FILE**);'
17278	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17279	esac
17280	case "$setpwent_r_proto" in
17281	''|0) try='void setpwent_r(FILE**);'
17282	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17283	esac
17284	case "$setpwent_r_proto" in
17285	''|0)	d_setpwent_r=undef
17286 	        setpwent_r_proto=0
17287		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17288	* )	case "$setpwent_r_proto" in
17289		REENTRANT_PROTO*) ;;
17290		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17291		esac
17292		echo "Prototype: $try" ;;
17293	esac
17294	;;
17295	*)	case "$usethreads" in
17296		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17297		esac
17298		d_setpwent_r=undef
17299		setpwent_r_proto=0
17300		;;
17301	esac
17302	;;
17303*)	setpwent_r_proto=0
17304	;;
17305esac
17306
17307: see if setregid exists
17308set setregid d_setregid
17309eval $inlibc
17310set setresgid d_setresgid
17311eval $inlibc
17312
17313: see if setreuid exists
17314set setreuid d_setreuid
17315eval $inlibc
17316set setresuid d_setresuid
17317eval $inlibc
17318
17319: see if setrgid exists
17320set setrgid d_setrgid
17321eval $inlibc
17322
17323: see if setruid exists
17324set setruid d_setruid
17325eval $inlibc
17326
17327: see if setservent exists
17328set setservent d_setsent
17329eval $inlibc
17330
17331: see if setservent_r exists
17332set setservent_r d_setservent_r
17333eval $inlibc
17334case "$d_setservent_r" in
17335"$define")
17336	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17337	case "$d_setservent_r_proto:$usethreads" in
17338	":define")	d_setservent_r_proto=define
17339		set d_setservent_r_proto setservent_r $hdrs
17340		eval $hasproto ;;
17341	*)	;;
17342	esac
17343	case "$d_setservent_r_proto" in
17344	define)
17345	case "$setservent_r_proto" in
17346	''|0) try='int setservent_r(int, struct servent_data*);'
17347	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17348	esac
17349	case "$setservent_r_proto" in
17350	''|0) try='void setservent_r(int, struct servent_data*);'
17351	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17352	esac
17353	case "$setservent_r_proto" in
17354	''|0)	d_setservent_r=undef
17355 	        setservent_r_proto=0
17356		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17357	* )	case "$setservent_r_proto" in
17358		REENTRANT_PROTO*) ;;
17359		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17360		esac
17361		echo "Prototype: $try" ;;
17362	esac
17363	;;
17364	*)	case "$usethreads" in
17365		define) echo "setservent_r has no prototype, not using it." >&4 ;;
17366		esac
17367		d_setservent_r=undef
17368		setservent_r_proto=0
17369		;;
17370	esac
17371	;;
17372*)	setservent_r_proto=0
17373	;;
17374esac
17375
17376: see if setsid exists
17377set setsid d_setsid
17378eval $inlibc
17379
17380: see if setvbuf exists
17381set setvbuf d_setvbuf
17382eval $inlibc
17383
17384: see if sfio.h is available
17385set sfio.h i_sfio
17386eval $inhdr
17387
17388: see if sfio library is available
17389case "$i_sfio" in
17390$define)
17391	val=''
17392	set sfreserve val
17393	eval $inlibc
17394	;;
17395*)
17396	val="$undef"
17397	;;
17398esac
17399: Ok, but do we want to use it.
17400case "$val" in
17401$define)
17402	case "$usesfio" in
17403	true|$define|[yY]*) dflt='y';;
17404	*) dflt='n';;
17405	esac
17406	echo "$package can use the sfio library, but it is experimental."
17407	rp="You seem to have sfio available, do you want to try using it?"
17408	. ./myread
17409	case "$ans" in
17410	y|Y)	echo "Ok, turning on sfio then."
17411		val="$define"
17412		;;
17413	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17414		val="$undef"
17415		;;
17416	esac
17417	;;
17418*)	case "$usesfio" in
17419	true|$define|[yY]*)
17420		echo "Sorry, cannot find sfio on this machine." >&4
17421		echo "Ignoring your setting of usesfio=$usesfio." >&4
17422		val="$undef"
17423		;;
17424	esac
17425	;;
17426esac
17427set d_sfio
17428eval $setvar
17429case "$d_sfio" in
17430$define) usesfio='true';;
17431*) usesfio='false';;
17432esac
17433case "$d_sfio" in
17434$define) ;;
17435*)	: Remove sfio from list of libraries to use
17436	case "$libs" in
17437	*-lsfio*)
17438		echo "Removing unneeded -lsfio from library list" >&4
17439		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17440		shift
17441		libs="$*"
17442		echo "libs = $libs" >&4
17443		;;
17444	esac
17445;;
17446esac
17447
17448
17449: see if shmctl exists
17450set shmctl d_shmctl
17451eval $inlibc
17452
17453: see if shmget exists
17454set shmget d_shmget
17455eval $inlibc
17456
17457: see if shmat exists
17458set shmat d_shmat
17459eval $inlibc
17460: see what shmat returns
17461case "$d_shmat" in
17462"$define")
17463	$cat >shmat.c <<'END'
17464#include <sys/shm.h>
17465void *shmat();
17466END
17467	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17468		shmattype='void *'
17469	else
17470		shmattype='char *'
17471	fi
17472	echo "and it returns ($shmattype)." >&4
17473	: see if a prototype for shmat is available
17474	xxx=`./findhdr sys/shm.h`
17475	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17476	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17477		val="$define"
17478	else
17479		val="$undef"
17480	fi
17481	$rm -f shmat.[co]
17482	;;
17483*)
17484	val="$undef"
17485	;;
17486esac
17487set d_shmatprototype
17488eval $setvar
17489
17490: see if shmdt exists
17491set shmdt d_shmdt
17492eval $inlibc
17493
17494: see how much of the 'shm*(2)' library is present.
17495h_shm=true
17496echo " "
17497case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17498*"$undef"*) h_shm=false;;
17499esac
17500case "$osname" in
17501freebsd)
17502    case "`ipcs 2>&1`" in
17503    "SVID shared memory"*"not configured"*)
17504	echo "Your $osname does not have the shm*(2) configured." >&4
17505        h_shm=false
17506	val="$undef"
17507	set shmctl d_shmctl
17508	evat $setvar
17509	set shmget d_shmget
17510	evat $setvar
17511	set shmat d_shmat
17512	evat $setvar
17513	set shmdt d_shmdt
17514	evat $setvar
17515	;;
17516    esac
17517    ;;
17518esac
17519: we could also check for sys/ipc.h ...
17520if $h_shm && $test `./findhdr sys/shm.h`; then
17521	echo "You have the full shm*(2) library." >&4
17522	val="$define"
17523else
17524	echo "You don't have the full shm*(2) library." >&4
17525	val="$undef"
17526fi
17527set d_shm
17528eval $setvar
17529
17530: see if we have sigaction
17531echo " "
17532if set sigaction val -f d_sigaction; eval $csym; $val; then
17533	echo 'sigaction() found.' >&4
17534	$cat > try.c <<EOP
17535#include <stdio.h>
17536#include <sys/types.h>
17537#include <signal.h>
17538#$i_stdlib I_STDLIB
17539#ifdef I_STDLIB
17540#include <stdlib.h>
17541#endif
17542int main()
17543{
17544    struct sigaction act, oact;
17545    act.sa_flags = 0;
17546    oact.sa_handler = 0;
17547    /* so that act and oact are used */
17548    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17549}
17550EOP
17551	set try
17552	if eval $compile_ok; then
17553		val="$define"
17554	else
17555		echo "But you don't seem to have a useable struct sigaction." >&4
17556		val="$undef"
17557	fi
17558else
17559	echo 'sigaction NOT found.' >&4
17560	val="$undef"
17561fi
17562set d_sigaction; eval $setvar
17563$rm_try
17564
17565: see if this is a sunmath.h system
17566set sunmath.h i_sunmath
17567eval $inhdr
17568
17569: see if signbit exists
17570$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17571$cat >try.c <<EOCP
17572#$i_math I_MATH
17573#$i_sunmath I_SUNMATH
17574#ifdef I_MATH
17575#  include <math.h>
17576#endif
17577#ifdef I_SUNMATH  /* Solaris special math library */
17578#  include <sunmath.h>
17579#endif
17580#define NV $nvtype
17581int main(int argc, char **argv)
17582{
17583    NV x = 0.0;
17584    NV y = -0.0;
17585    if ((signbit(x) == 0) && (signbit(y) != 0))
17586	return 0;
17587    else
17588	return 1;
17589}
17590EOCP
17591val="$undef"
17592set try
17593if eval $compile; then
17594    if $run ./try; then
17595        $echo "Yes." >&4
17596	val="$define"
17597    else
17598        $echo "Signbit seems to be available, but doesn't work as I expected."
17599        $echo "I won't use it." >&4
17600	val="$undef"
17601    fi
17602else
17603    $echo "Nope." >&4
17604    dflt="$undef"
17605fi
17606set d_signbit
17607eval $setvar
17608$rm_try
17609
17610: see if sigprocmask exists
17611set sigprocmask d_sigprocmask
17612eval $inlibc
17613
17614: see if sigsetjmp exists
17615echo " "
17616case "$d_sigsetjmp" in
17617'')
17618	$cat >try.c <<EOP
17619#include <setjmp.h>
17620#$i_stdlib I_STDLIB
17621#ifdef I_STDLIB
17622#include <stdlib.h>
17623#endif
17624sigjmp_buf env;
17625int set = 1;
17626int main()
17627{
17628	if (sigsetjmp(env,1))
17629		exit(set);
17630	set = 0;
17631	siglongjmp(env, 1);
17632	exit(1);
17633}
17634EOP
17635	set try
17636	if eval $compile; then
17637		if $run ./try >/dev/null 2>&1; then
17638			echo "POSIX sigsetjmp found." >&4
17639			val="$define"
17640		else
17641			$cat >&4 <<EOM
17642Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17643I'll ignore them.
17644EOM
17645			val="$undef"
17646		fi
17647	else
17648		echo "sigsetjmp not found." >&4
17649		val="$undef"
17650	fi
17651	;;
17652*) val="$d_sigsetjmp"
17653	case "$d_sigsetjmp" in
17654	$define) echo "POSIX sigsetjmp found." >&4;;
17655	$undef) echo "sigsetjmp not found." >&4;;
17656	esac
17657	;;
17658esac
17659set d_sigsetjmp
17660eval $setvar
17661$rm_try
17662
17663: see if snprintf exists
17664set snprintf d_snprintf
17665eval $inlibc
17666
17667: see if vsnprintf exists
17668set vsnprintf d_vsnprintf
17669eval $inlibc
17670
17671case "$d_snprintf-$d_vsnprintf" in
17672"$define-$define")
17673    $cat <<EOM
17674Checking whether your snprintf() and vsnprintf() work okay...
17675EOM
17676    $cat >try.c <<'EOCP'
17677/* v?snprintf testing logic courtesy of Russ Allbery.
17678 * According to C99:
17679 * - if the buffer is too short it still must be \0-terminated
17680 * - if the buffer is too short the potentially required length
17681 *   must be returned and not -1
17682 * - if the buffer is NULL the potentially required length
17683 *   must be returned and not -1 or core dump
17684 */
17685#include <stdio.h>
17686#include <stdarg.h>
17687
17688char buf[2];
17689
17690int test (char *format, ...)
17691{
17692    va_list args;
17693    int count;
17694
17695    va_start (args, format);
17696    count = vsnprintf (buf, sizeof buf, format, args);
17697    va_end (args);
17698    return count;
17699}
17700
17701int main ()
17702{
17703    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17704             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17705}
17706EOCP
17707    set try
17708    if eval $compile; then
17709	`$run ./try`
17710	case "$?" in
17711	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17712	*) cat <<EOM >&4
17713Your snprintf() and snprintf() don't seem to be working okay.
17714EOM
17715	   d_snprintf="$undef"
17716	   d_vsnprintf="$undef"
17717	   ;;
17718	esac
17719    else
17720	echo "(I can't seem to compile the test program--assuming they don't)"
17721	d_snprintf="$undef"
17722	d_vsnprintf="$undef"
17723    fi
17724    $rm_try
17725    ;;
17726esac
17727
17728: see if sockatmark exists
17729set sockatmark d_sockatmark
17730eval $inlibc
17731
17732: see if prototype for sockatmark is available
17733echo " "
17734set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17735eval $hasproto
17736
17737: see if socks5_init exists
17738set socks5_init d_socks5_init
17739eval $inlibc
17740
17741: see if sprintf returns the length of the string in the buffer as per ANSI
17742$echo "Checking whether sprintf returns the length of the string..." >&4
17743$cat <<EOP >try.c
17744#include <stdio.h>
17745#$i_stdlib I_STDLIB
17746#ifdef I_STDLIB
17747#include <stdlib.h>
17748#endif
17749#$i_string I_STRING
17750#ifdef I_STRING
17751#  include <string.h>
17752#else
17753#  include <strings.h>
17754#endif
17755#$i_math I_MATH
17756#ifdef I_MATH
17757#include <math.h>
17758#endif
17759
17760char buffer[256];
17761
17762int check (size_t expect, int test) {
17763  size_t got = strlen(buffer);
17764  if (expect == got)
17765    return 0;
17766
17767  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17768       test, buffer);
17769  exit (test);
17770}
17771
17772int main(int argc, char **argv) {
17773  int test = 0;
17774
17775  check(sprintf(buffer, ""), ++test);
17776  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17777  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17778
17779  return 0;
17780}
17781EOP
17782set try
17783
17784if eval $compile; then
17785    xxx="`$run ./try`"
17786    case "$?" in
17787	0) cat >&4 <<EOM
17788sprintf returns the length of the string (as ANSI says it should)
17789EOM
17790	d_sprintf_returns_strlen="$define"
17791	;;
17792	*) cat >&4 <<EOM
17793sprintf does not return the length of the string (how old is this system?)
17794EOM
17795	d_sprintf_returns_strlen="$undef"
17796        ;;
17797    esac
17798else
17799    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17800    d_sprintf_returns_strlen="$undef"
17801fi
17802$rm_try
17803
17804: see if srand48_r exists
17805set srand48_r d_srand48_r
17806eval $inlibc
17807case "$d_srand48_r" in
17808"$define")
17809	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17810	case "$d_srand48_r_proto:$usethreads" in
17811	":define")	d_srand48_r_proto=define
17812		set d_srand48_r_proto srand48_r $hdrs
17813		eval $hasproto ;;
17814	*)	;;
17815	esac
17816	case "$d_srand48_r_proto" in
17817	define)
17818	case "$srand48_r_proto" in
17819	''|0) try='int srand48_r(long, struct drand48_data*);'
17820	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17821	esac
17822	case "$srand48_r_proto" in
17823	''|0)	d_srand48_r=undef
17824 	        srand48_r_proto=0
17825		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17826	* )	case "$srand48_r_proto" in
17827		REENTRANT_PROTO*) ;;
17828		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17829		esac
17830		echo "Prototype: $try" ;;
17831	esac
17832	;;
17833	*)	case "$usethreads" in
17834		define) echo "srand48_r has no prototype, not using it." >&4 ;;
17835		esac
17836		d_srand48_r=undef
17837		srand48_r_proto=0
17838		;;
17839	esac
17840	;;
17841*)	srand48_r_proto=0
17842	;;
17843esac
17844
17845: see if srandom_r exists
17846set srandom_r d_srandom_r
17847eval $inlibc
17848case "$d_srandom_r" in
17849"$define")
17850	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17851	case "$d_srandom_r_proto:$usethreads" in
17852	":define")	d_srandom_r_proto=define
17853		set d_srandom_r_proto srandom_r $hdrs
17854		eval $hasproto ;;
17855	*)	;;
17856	esac
17857	case "$d_srandom_r_proto" in
17858	define)
17859	case "$srandom_r_proto" in
17860	''|0) try='int srandom_r(unsigned int, struct random_data*);'
17861	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17862	esac
17863	case "$srandom_r_proto" in
17864	''|0)	d_srandom_r=undef
17865 	        srandom_r_proto=0
17866		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17867	* )	case "$srandom_r_proto" in
17868		REENTRANT_PROTO*) ;;
17869		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17870		esac
17871		echo "Prototype: $try" ;;
17872	esac
17873	;;
17874	*)	case "$usethreads" in
17875		define) echo "srandom_r has no prototype, not using it." >&4 ;;
17876		esac
17877		d_srandom_r=undef
17878		srandom_r_proto=0
17879		;;
17880	esac
17881	;;
17882*)	srandom_r_proto=0
17883	;;
17884esac
17885
17886: see if prototype for setresgid is available
17887echo " "
17888set d_sresgproto setresgid $i_unistd unistd.h
17889eval $hasproto
17890
17891: see if prototype for setresuid is available
17892echo " "
17893set d_sresuproto setresuid $i_unistd unistd.h
17894eval $hasproto
17895
17896: see if sys/stat.h is available
17897set sys/stat.h i_sysstat
17898eval $inhdr
17899
17900: see if stat knows about block sizes
17901echo " "
17902echo "Checking to see if your struct stat has st_blocks field..." >&4
17903set d_statblks stat st_blocks $i_sysstat sys/stat.h
17904eval $hasfield
17905
17906: see if this is a sys/vfs.h system
17907set sys/vfs.h i_sysvfs
17908eval $inhdr
17909
17910: see if this is a sys/statfs.h system
17911set sys/statfs.h i_sysstatfs
17912eval $inhdr
17913
17914: Check for statfs_s
17915echo " "
17916echo "Checking to see if your system supports struct statfs..." >&4
17917set 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
17918eval $hasstruct
17919case "$d_statfs_s" in
17920"$define")      echo "Yes, it does."   ;;
17921*)              echo "No, it doesn't." ;;
17922esac
17923
17924
17925: see if struct statfs knows about f_flags
17926case "$d_statfs_s" in
17927define)
17928	echo " "
17929	echo "Checking to see if your struct statfs has f_flags field..." >&4
17930	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
17931	eval $hasfield
17932	;;
17933*)	val="$undef"
17934	set d_statfs_f_flags
17935	eval $setvar
17936	;;
17937esac
17938case "$d_statfs_f_flags" in
17939"$define")      echo "Yes, it does."   ;;
17940*)              echo "No, it doesn't." ;;
17941esac
17942
17943: see what flavor, if any, of static inline is supported
17944echo " "
17945echo "Checking to see if your system supports static inline..."
17946$cat > try.c <<'EOCP'
17947#include <stdlib.h>
17948extern int f_via_a(int x);
17949extern int f_via_b(int x);
17950int main(int argc, char **argv)
17951{
17952    int y;
17953
17954    y = f_via_a(0);
17955#ifdef USE_B
17956    y = f_via_b(0);
17957#endif
17958    if (y == 42) {
17959        return EXIT_SUCCESS;
17960    }
17961    else {
17962        return EXIT_FAILURE;
17963    }
17964}
17965EOCP
17966$cat > a.c <<'EOCP'
17967static INLINE int f(int x) {
17968    int y;
17969    y = x + 42;
17970    return y;
17971}
17972
17973int f_via_a(int x)
17974{
17975    return f(x);
17976}
17977EOCP
17978$cat > b.c <<'EOCP'
17979extern int f(int x);
17980
17981int f_via_b(int x)
17982{
17983    return f(x);
17984}
17985EOCP
17986
17987# Respect a hint (or previous) value for perl_static_inline, if there is one.
17988case "$perl_static_inline" in
17989'')	# Check the various possibilities, and break out on success.
17990	# For gcc, prefer __inline__, which will still permit
17991	# cflags.SH to add in -ansi.
17992	case "$gccversion" in
17993		'') xxx="inline __inline__ __inline _inline";;
17994		*)  xxx="__inline__ inline __inline _inline";;
17995	esac
17996	for inline in $xxx; do
17997		set try -DINLINE=$inline a.c
17998		if eval $compile && $run ./try; then
17999			# Now make sure there is no external linkage of static
18000			# functions
18001			set try -DINLINE=$inline -DUSE_B a.c b.c
18002			if eval $compile && $run ./try; then
18003				$echo "Your compiler supports static $inline, " >&4
18004				$echo "but it also creates an external definition," >&4
18005				$echo "so I won't use it." >&4
18006				val=$undef
18007			else
18008				$echo "Your compiler supports static $inline." >&4
18009				val=$define
18010				perl_static_inline="static $inline";
18011				break;
18012			fi
18013		else
18014			$echo "Your compiler does NOT support static $inline." >&4
18015			val="$undef"
18016		fi
18017	done
18018	;;
18019*inline*) # Some variant of inline exists.
18020	echo "Keeping your $hint value of $perl_static_inline."
18021	val=$define
18022	;;
18023static)  # No inline capabilities
18024	echo "Keeping your $hint value of $perl_static_inline."
18025	val=$undef
18026	;;
18027*)  # Unrecognized previous value -- blindly trust the supplied
18028	# value and hope it makes sense.  Use old value for
18029	# d_static_inline, if there is one.
18030	echo "Keeping your $hint value of $perl_static_inline."
18031	case "$d_static_inline" in
18032		'') val=$define ;;
18033		*)  val=$d_static_inline ;;
18034	esac
18035	;;
18036esac
18037# Fallback to plain 'static' if nothing worked.
18038case "$perl_static_inline" in
18039'')
18040	perl_static_inline="static"
18041	val=$undef
18042	;;
18043esac
18044set d_static_inline
18045eval $setvar
18046$rm -f a.[co] b.[co]
18047$rm_try
18048
18049: Check stream access
18050$cat >&4 <<EOM
18051Checking how to access stdio streams by file descriptor number...
18052EOM
18053case "$stdio_stream_array" in
18054'') 	$cat >try.c <<EOCP
18055#include <stdio.h>
18056int main() {
18057  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18058    printf("yes\n");
18059}
18060EOCP
18061	for s in _iob __iob __sF
18062	do
18063	        set try -DSTDIO_STREAM_ARRAY=$s
18064		if eval $compile; then
18065		    	case "`$run ./try`" in
18066			yes)	stdio_stream_array=$s; break ;;
18067			esac
18068		fi
18069	done
18070	$rm_try
18071esac
18072case "$stdio_stream_array" in
18073'')	$cat >&4 <<EOM
18074I can't figure out how to access stdio streams by file descriptor number.
18075EOM
18076	d_stdio_stream_array="$undef"
18077	;;
18078*)	$cat >&4 <<EOM
18079You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18080EOM
18081	d_stdio_stream_array="$define"
18082	;;
18083esac
18084
18085: see if strcoll exists
18086set strcoll d_strcoll
18087eval $inlibc
18088
18089: check for structure copying
18090echo " "
18091echo "Checking to see if your C compiler can copy structs..." >&4
18092$cat >try.c <<'EOCP'
18093int main()
18094{
18095	struct blurfl {
18096		int dyick;
18097	} foo, bar;
18098
18099	foo = bar;
18100}
18101EOCP
18102if $cc -c try.c >/dev/null 2>&1 ; then
18103	val="$define"
18104	echo "Yup, it can."
18105else
18106	val="$undef"
18107	echo "Nope, it can't."
18108fi
18109set d_strctcpy
18110eval $setvar
18111$rm_try
18112
18113: see if strerror and/or sys_errlist[] exist
18114echo " "
18115if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18116    if set strerror val -f d_strerror; eval $csym; $val; then
18117		echo 'strerror() found.' >&4
18118		d_strerror="$define"
18119		d_strerrm='strerror(e)'
18120		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18121			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18122			d_syserrlst="$define"
18123		else
18124			echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18125			d_syserrlst="$undef"
18126		fi
18127    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18128			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18129		echo 'strerror() found in string header.' >&4
18130		d_strerror="$define"
18131		d_strerrm='strerror(e)'
18132		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18133			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18134				d_syserrlst="$define"
18135		else
18136			echo "(You don't appear to have any sys_errlist[], how can this be?)"
18137			d_syserrlst="$undef"
18138		fi
18139    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18140		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18141		d_strerror="$undef"
18142		d_syserrlst="$define"
18143		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18144    else
18145		echo 'strerror() and sys_errlist[] NOT found.' >&4
18146		d_strerror="$undef"
18147		d_syserrlst="$undef"
18148		d_strerrm='"unknown"'
18149    fi
18150fi
18151
18152: see if strerror_r exists
18153set strerror_r d_strerror_r
18154eval $inlibc
18155case "$d_strerror_r" in
18156"$define")
18157	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18158	case "$d_strerror_r_proto:$usethreads" in
18159	":define")	d_strerror_r_proto=define
18160		set d_strerror_r_proto strerror_r $hdrs
18161		eval $hasproto ;;
18162	*)	;;
18163	esac
18164	case "$d_strerror_r_proto" in
18165	define)
18166	case "$strerror_r_proto" in
18167	''|0) try='int strerror_r(int, char*, size_t);'
18168	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18169	esac
18170	case "$strerror_r_proto" in
18171	''|0) try='int strerror_r(int, char*, int);'
18172	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18173	esac
18174	case "$strerror_r_proto" in
18175	''|0) try='char* strerror_r(int, char*, size_t);'
18176	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18177	esac
18178	case "$strerror_r_proto" in
18179	''|0)	d_strerror_r=undef
18180 	        strerror_r_proto=0
18181		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18182	* )	case "$strerror_r_proto" in
18183		REENTRANT_PROTO*) ;;
18184		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18185		esac
18186		echo "Prototype: $try" ;;
18187	esac
18188	;;
18189	*)	case "$usethreads" in
18190		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18191		esac
18192		d_strerror_r=undef
18193		strerror_r_proto=0
18194		;;
18195	esac
18196	;;
18197*)	strerror_r_proto=0
18198	;;
18199esac
18200
18201: see if strftime exists
18202set strftime d_strftime
18203eval $inlibc
18204
18205: see if strlcat exists
18206set strlcat d_strlcat
18207eval $inlibc
18208
18209: see if strlcpy exists
18210set strlcpy d_strlcpy
18211eval $inlibc
18212
18213: see if strtod exists
18214set strtod d_strtod
18215eval $inlibc
18216
18217: see if strtol exists
18218set strtol d_strtol
18219eval $inlibc
18220
18221: see if strtold exists
18222set strtold d_strtold
18223eval $inlibc
18224
18225: see if strtoll exists
18226set strtoll d_strtoll
18227eval $inlibc
18228
18229case "$d_longlong-$d_strtoll" in
18230"$define-$define")
18231	$cat <<EOM
18232Checking whether your strtoll() works okay...
18233EOM
18234	$cat >try.c <<'EOCP'
18235#include <errno.h>
18236#ifdef __hpux
18237#define strtoll __strtoll
18238#endif
18239#ifdef __EMX__
18240#define strtoll _strtoll
18241#endif
18242#include <stdio.h>
18243extern long long int strtoll(char *s, char **, int);
18244static int bad = 0;
18245int check(char *s, long long ell, int een) {
18246	long long gll;
18247	errno = 0;
18248	gll = strtoll(s, 0, 10);
18249	if (!((gll == ell) && (errno == een)))
18250		bad++;
18251}
18252int main() {
18253	check(" 1",                                      1LL, 0);
18254	check(" 0",                                      0LL, 0);
18255	check("-1",                                     -1LL, 0);
18256	check("-9223372036854775808", -9223372036854775808LL, 0);
18257	check("-9223372036854775808", -9223372036854775808LL, 0);
18258	check(" 9223372036854775807",  9223372036854775807LL, 0);
18259	check("-9223372036854775808", -9223372036854775808LL, 0);
18260	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18261	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18262	if (!bad)
18263		printf("ok\n");
18264}
18265EOCP
18266	set try
18267	if eval $compile; then
18268		yyy=`$run ./try`
18269		case "$yyy" in
18270		ok) echo "Your strtoll() seems to be working okay." ;;
18271		*) cat <<EOM >&4
18272Your strtoll() doesn't seem to be working okay.
18273EOM
18274		   d_strtoll="$undef"
18275		   ;;
18276		esac
18277	else
18278		echo "(I can't seem to compile the test program--assuming it doesn't)"
18279		d_strtoll="$undef"
18280	fi
18281	;;
18282esac
18283
18284: see if strtoq exists
18285set strtoq d_strtoq
18286eval $inlibc
18287
18288: see if strtoul exists
18289set strtoul d_strtoul
18290eval $inlibc
18291
18292case "$d_strtoul" in
18293"$define")
18294	$cat <<EOM
18295Checking whether your strtoul() works okay...
18296EOM
18297	$cat >try.c <<'EOCP'
18298#include <errno.h>
18299#include <stdio.h>
18300extern unsigned long int strtoul(char *s, char **, int);
18301static int bad = 0;
18302void check(char *s, unsigned long eul, int een) {
18303	unsigned long gul;
18304	errno = 0;
18305	gul = strtoul(s, 0, 10);
18306	if (!((gul == eul) && (errno == een)))
18307		bad++;
18308}
18309int main() {
18310	check(" 1", 1L, 0);
18311	check(" 0", 0L, 0);
18312EOCP
18313	case "$longsize" in
18314	8)
18315	    $cat >>try.c <<'EOCP'
18316	check("18446744073709551615", 18446744073709551615UL, 0);
18317	check("18446744073709551616", 18446744073709551615UL, ERANGE);
18318#if 0 /* strtoul() for /^-/ strings is undefined. */
18319	check("-1", 18446744073709551615UL, 0);
18320	check("-18446744073709551614", 2, 0);
18321	check("-18446744073709551615", 1, 0);
18322       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18323	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18324#endif
18325EOCP
18326		;;
18327	4)
18328		    $cat >>try.c <<'EOCP'
18329	check("4294967295", 4294967295UL, 0);
18330	check("4294967296", 4294967295UL, ERANGE);
18331#if 0 /* strtoul() for /^-/ strings is undefined. */
18332	check("-1", 4294967295UL, 0);
18333	check("-4294967294", 2, 0);
18334	check("-4294967295", 1, 0);
18335       	check("-4294967296", 4294967295UL, ERANGE);
18336	check("-4294967297", 4294967295UL, ERANGE);
18337#endif
18338EOCP
18339		;;
18340	*)
18341: Should we write these tests to be more portable by sprintf-ing
18342: ~0 and then manipulating that char string as input for strtol?
18343		;;
18344	esac
18345	$cat >>try.c <<'EOCP'
18346	if (!bad)
18347		printf("ok\n");
18348	return 0;
18349}
18350EOCP
18351	set try
18352	if eval $compile; then
18353		case "`$run ./try`" in
18354		ok) echo "Your strtoul() seems to be working okay." ;;
18355		*) cat <<EOM >&4
18356Your strtoul() doesn't seem to be working okay.
18357EOM
18358		   d_strtoul="$undef"
18359		   ;;
18360		esac
18361	else
18362		echo "(I can't seem to compile the test program--assuming it doesn't)"
18363		d_strtoul="$undef"
18364	fi
18365	;;
18366esac
18367
18368: see if strtoull exists
18369set strtoull d_strtoull
18370eval $inlibc
18371
18372case "$d_longlong-$d_strtoull" in
18373"$define-$define")
18374	$cat <<EOM
18375Checking whether your strtoull() works okay...
18376EOM
18377	$cat >try.c <<'EOCP'
18378#include <errno.h>
18379#ifdef __hpux
18380#define strtoull __strtoull
18381#endif
18382#include <stdio.h>
18383extern unsigned long long int strtoull(char *s, char **, int);
18384static int bad = 0;
18385int check(char *s, long long eull, int een) {
18386	long long gull;
18387	errno = 0;
18388	gull = strtoull(s, 0, 10);
18389	if (!((gull == eull) && (errno == een)))
18390		bad++;
18391}
18392int main() {
18393	check(" 1",                                        1LL, 0);
18394	check(" 0",                                        0LL, 0);
18395	check("18446744073709551615",  18446744073709551615ULL, 0);
18396	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18397#if 0 /* strtoull() for /^-/ strings is undefined. */
18398	check("-1",                    18446744073709551615ULL, 0);
18399	check("-18446744073709551614",                     2LL, 0);
18400	check("-18446744073709551615",                     1LL, 0);
18401       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18402	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18403#endif
18404	if (!bad)
18405		printf("ok\n");
18406}
18407EOCP
18408	set try
18409	if eval $compile; then
18410		case "`$run ./try`" in
18411		ok) echo "Your strtoull() seems to be working okay." ;;
18412		*) cat <<EOM >&4
18413Your strtoull() doesn't seem to be working okay.
18414EOM
18415		   d_strtoull="$undef"
18416		   ;;
18417		esac
18418	else
18419		echo "(I can't seem to compile the test program--assuming it doesn't)"
18420		d_strtoull="$undef"
18421	fi
18422	;;
18423esac
18424
18425: see if strtouq exists
18426set strtouq d_strtouq
18427eval $inlibc
18428
18429case "$d_strtouq" in
18430"$define")
18431	$cat <<EOM
18432Checking whether your strtouq() works okay...
18433EOM
18434	$cat >try.c <<'EOCP'
18435#include <errno.h>
18436#include <stdio.h>
18437extern unsigned long long int strtouq(char *s, char **, int);
18438static int bad = 0;
18439void check(char *s, unsigned long long eull, int een) {
18440	unsigned long long gull;
18441	errno = 0;
18442	gull = strtouq(s, 0, 10);
18443	if (!((gull == eull) && (errno == een)))
18444		bad++;
18445}
18446int main() {
18447	check(" 1",                                        1LL, 0);
18448	check(" 0",                                        0LL, 0);
18449	check("18446744073709551615",  18446744073709551615ULL, 0);
18450	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18451#if 0 /* strtouq() for /^-/ strings is undefined. */
18452	check("-1",                    18446744073709551615ULL, 0);
18453	check("-18446744073709551614",                     2LL, 0);
18454	check("-18446744073709551615",                     1LL, 0);
18455       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18456	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18457#endif
18458	if (!bad)
18459		printf("ok\n");
18460	return 0;
18461}
18462EOCP
18463	set try
18464	if eval $compile; then
18465		case "`$run ./try`" in
18466		ok) echo "Your strtouq() seems to be working okay." ;;
18467		*) cat <<EOM >&4
18468Your strtouq() doesn't seem to be working okay.
18469EOM
18470		   d_strtouq="$undef"
18471		   ;;
18472		esac
18473	else
18474		echo "(I can't seem to compile the test program--assuming it doesn't)"
18475		d_strtouq="$undef"
18476	fi
18477	;;
18478esac
18479
18480: see if strxfrm exists
18481set strxfrm d_strxfrm
18482eval $inlibc
18483
18484: see if symlink exists
18485set symlink d_symlink
18486eval $inlibc
18487
18488: see if syscall exists
18489set syscall d_syscall
18490eval $inlibc
18491
18492: see if prototype for syscall is available
18493echo " "
18494set d_syscallproto syscall $i_unistd unistd.h
18495eval $hasproto
18496
18497: see if sysconf exists
18498set sysconf d_sysconf
18499eval $inlibc
18500
18501: see if system exists
18502set system d_system
18503eval $inlibc
18504
18505: see if tcgetpgrp exists
18506set tcgetpgrp d_tcgetpgrp
18507eval $inlibc
18508
18509: see if tcsetpgrp exists
18510set tcsetpgrp d_tcsetpgrp
18511eval $inlibc
18512
18513: see if prototype for telldir is available
18514echo " "
18515set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18516eval $hasproto
18517
18518: see if time exists
18519echo " "
18520if test "X$d_time" = X -o X"$timetype" = X; then
18521    if set time val -f d_time; eval $csym; $val; then
18522		echo 'time() found.' >&4
18523		val="$define"
18524		rp="What is the type returned by time() on this system?"
18525		set time_t timetype long stdio.h sys/types.h
18526		eval $typedef_ask
18527    else
18528		echo 'time() not found, hope that will do.' >&4
18529		val="$undef"
18530		timetype='int';
18531    fi
18532    set d_time
18533    eval $setvar
18534fi
18535
18536: see if timegm exists
18537set timegm d_timegm
18538eval $inlibc
18539
18540: see if this is a sys/times.h system
18541set sys/times.h i_systimes
18542eval $inhdr
18543
18544: see if times exists
18545echo " "
18546if set times val -f d_times; eval $csym; $val; then
18547	echo 'times() found.' >&4
18548	d_times="$define"
18549	inc=''
18550	case "$i_systimes" in
18551	"$define") inc='sys/times.h';;
18552	esac
18553	rp="What is the type returned by times() on this system?"
18554	set clock_t clocktype long stdio.h sys/types.h $inc
18555	eval $typedef_ask
18556else
18557	echo 'times() NOT found, hope that will do.' >&4
18558	d_times="$undef"
18559	clocktype='int'
18560fi
18561
18562: see if tmpnam_r exists
18563set tmpnam_r d_tmpnam_r
18564eval $inlibc
18565case "$d_tmpnam_r" in
18566"$define")
18567	hdrs="$i_systypes sys/types.h define stdio.h "
18568	case "$d_tmpnam_r_proto:$usethreads" in
18569	":define")	d_tmpnam_r_proto=define
18570		set d_tmpnam_r_proto tmpnam_r $hdrs
18571		eval $hasproto ;;
18572	*)	;;
18573	esac
18574	case "$d_tmpnam_r_proto" in
18575	define)
18576	case "$tmpnam_r_proto" in
18577	''|0) try='char* tmpnam_r(char*);'
18578	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18579	esac
18580	case "$tmpnam_r_proto" in
18581	''|0)	d_tmpnam_r=undef
18582 	        tmpnam_r_proto=0
18583		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18584	* )	case "$tmpnam_r_proto" in
18585		REENTRANT_PROTO*) ;;
18586		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18587		esac
18588		echo "Prototype: $try" ;;
18589	esac
18590	;;
18591	*)	case "$usethreads" in
18592		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18593		esac
18594		d_tmpnam_r=undef
18595		tmpnam_r_proto=0
18596		;;
18597	esac
18598	;;
18599*)	tmpnam_r_proto=0
18600	;;
18601esac
18602
18603: see if truncate exists
18604set truncate d_truncate
18605eval $inlibc
18606
18607: see if ttyname_r exists
18608set ttyname_r d_ttyname_r
18609eval $inlibc
18610case "$d_ttyname_r" in
18611"$define")
18612	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18613	case "$d_ttyname_r_proto:$usethreads" in
18614	":define")	d_ttyname_r_proto=define
18615		set d_ttyname_r_proto ttyname_r $hdrs
18616		eval $hasproto ;;
18617	*)	;;
18618	esac
18619	case "$d_ttyname_r_proto" in
18620	define)
18621	case "$ttyname_r_proto" in
18622	''|0) try='int ttyname_r(int, char*, size_t);'
18623	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18624	esac
18625	case "$ttyname_r_proto" in
18626	''|0) try='int ttyname_r(int, char*, int);'
18627	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18628	esac
18629	case "$ttyname_r_proto" in
18630	''|0) try='char* ttyname_r(int, char*, int);'
18631	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18632	esac
18633	case "$ttyname_r_proto" in
18634	''|0)	d_ttyname_r=undef
18635 	        ttyname_r_proto=0
18636		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18637	* )	case "$ttyname_r_proto" in
18638		REENTRANT_PROTO*) ;;
18639		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18640		esac
18641		echo "Prototype: $try" ;;
18642	esac
18643	;;
18644	*)	case "$usethreads" in
18645		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18646		esac
18647		d_ttyname_r=undef
18648		ttyname_r_proto=0
18649		;;
18650	esac
18651	;;
18652*)	ttyname_r_proto=0
18653	;;
18654esac
18655
18656: see if tzname[] exists
18657echo " "
18658if set tzname val -a d_tzname; eval $csym; $val; then
18659	val="$define"
18660	echo 'tzname[] found.' >&4
18661else
18662	val="$undef"
18663	echo 'tzname[] NOT found.' >&4
18664fi
18665set d_tzname
18666eval $setvar
18667
18668: Check if is a multiplatform env
18669case "$osname" in
18670next|rhapsody|darwin) multiarch="$define" ;;
18671esac
18672case "$multiarch" in
18673''|[nN]*) multiarch="$undef" ;;
18674esac
18675
18676: check for ordering of bytes in a UV
18677echo " "
18678case "$usecrosscompile$multiarch" in
18679*$define*)
18680	$cat <<EOM
18681You seem to be either cross-compiling or doing a multiarchitecture build,
18682skipping the byteorder check.
18683
18684EOM
18685	byteorder='ffff'
18686	;;
18687*)
18688	case "$byteorder" in
18689	'')
18690		$cat <<'EOM'
18691In the following, larger digits indicate more significance.  A big-endian
18692machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18693little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18694machines may have weird orders like 3412.  A Cray will report 87654321,
18695an Alpha will report 12345678. If the test program works the default is
18696probably right.
18697I'm now running the test program...
18698EOM
18699		$cat >try.c <<EOCP
18700#include <stdio.h>
18701#$i_stdlib I_STDLIB
18702#ifdef I_STDLIB
18703#include <stdlib.h>
18704#endif
18705#include <sys/types.h>
18706typedef $uvtype UV;
18707int main()
18708{
18709	int i;
18710	union {
18711		UV l;
18712		char c[$uvsize];
18713	} u;
18714
18715	if ($uvsize > 4)
18716		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18717	else
18718		u.l = (UV)0x04030201;
18719	for (i = 0; i < $uvsize; i++)
18720		printf("%c", u.c[i]+'0');
18721	printf("\n");
18722	exit(0);
18723}
18724EOCP
18725		xxx_prompt=y
18726		set try
18727		if eval $compile && $run ./try > /dev/null; then
18728			dflt=`$run ./try`
18729			case "$dflt" in
18730			[1-4][1-4][1-4][1-4]|12345678|87654321)
18731				echo "(The test program ran ok.)"
18732				echo "byteorder=$dflt"
18733				xxx_prompt=n
18734			;;
18735			????|????????) echo "(The test program ran ok.)" ;;
18736			*) echo "(The test program didn't run right for some reason.)" ;;
18737			esac
18738		else
18739			dflt='4321'
18740			cat <<'EOM'
18741(I can't seem to compile the test program.  Guessing big-endian...)
18742EOM
18743		fi
18744		case "$xxx_prompt" in
18745		y)
18746			rp="What is the order of bytes in $uvtype?"
18747			. ./myread
18748			byteorder="$ans"
18749			;;
18750		*)	byteorder=$dflt
18751			;;
18752		esac
18753		;;
18754	esac
18755	$rm_try
18756	;;
18757esac
18758
18759: Checking 32bit alignedness
18760$cat <<EOM
18761
18762Checking to see whether you can access character data unalignedly...
18763EOM
18764case "$d_u32align" in
18765'')   $cat >try.c <<EOCP
18766#include <stdio.h>
18767#$i_stdlib I_STDLIB
18768#ifdef I_STDLIB
18769#include <stdlib.h>
18770#endif
18771#define U32 $u32type
18772#define BYTEORDER 0x$byteorder
18773#define U8 $u8type
18774#include <signal.h>
18775#ifdef SIGBUS
18776$signal_t bletch(int s) { exit(4); }
18777#endif
18778int main() {
18779#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18780    volatile U8 buf[8];
18781    volatile U32 *up;
18782    int i;
18783
18784    if (sizeof(U32) != 4) {
18785	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18786	exit(1);
18787    }
18788
18789    fflush(stdout);
18790
18791#ifdef SIGBUS
18792    signal(SIGBUS, bletch);
18793#endif
18794
18795    buf[0] = 0;
18796    buf[1] = 0;
18797    buf[2] = 0;
18798    buf[3] = 1;
18799    buf[4] = 0;
18800    buf[5] = 0;
18801    buf[6] = 0;
18802    buf[7] = 1;
18803
18804    for (i = 0; i < 4; i++) {
18805	up = (U32*)(buf + i);
18806	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18807	       (*up == 1 << (8*(3-i)))  /* little-endian */
18808	      )
18809	   )
18810	{
18811	    printf("read failed (%x)\n", *up);
18812	    exit(2);
18813	}
18814    }
18815
18816    /* write test */
18817    for (i = 0; i < 4; i++) {
18818	up = (U32*)(buf + i);
18819	*up = 0xBeef;
18820	if (*up != 0xBeef) {
18821	    printf("write failed (%x)\n", *up);
18822	    exit(3);
18823	}
18824    }
18825
18826    exit(0);
18827#else
18828    printf("1\n");
18829    exit(1);
18830#endif
18831    return 0;
18832}
18833EOCP
18834set try
18835if eval $compile_ok; then
18836	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18837	$run ./try 2>&1 >/dev/null
18838	case "$?" in
18839	0)	cat >&4 <<EOM
18840You can access character data pretty unalignedly.
18841EOM
18842		d_u32align="$undef"
18843		;;
18844	*)	cat >&4 <<EOM
18845It seems that you must access character data in an aligned manner.
18846EOM
18847		d_u32align="$define"
18848		;;
18849	esac
18850else
18851	rp='Can you access character data at unaligned addresses?'
18852	dflt='n'
18853	. ./myread
18854	case "$ans" in
18855	[yY]*)	d_u32align="$undef"  ;;
18856	*)	d_u32align="$define" ;;
18857	esac
18858fi
18859$rm_try
18860;;
18861esac
18862
18863: see if ualarm exists
18864set ualarm d_ualarm
18865eval $inlibc
18866
18867: see if umask exists
18868set umask d_umask
18869eval $inlibc
18870
18871: see if unordered exists
18872set unordered d_unordered
18873eval $inlibc
18874
18875: see if unsetenv exists
18876set unsetenv d_unsetenv
18877eval $inlibc
18878
18879: see if usleep exists
18880set usleep d_usleep
18881eval $inlibc
18882
18883: see if prototype for usleep is available
18884echo " "
18885set d_usleepproto usleep $i_unistd unistd.h
18886eval $hasproto
18887
18888: see if ustat exists
18889set ustat d_ustat
18890eval $inlibc
18891
18892: see if closedir exists
18893set closedir d_closedir
18894eval $inlibc
18895
18896case "$d_closedir" in
18897"$define")
18898	echo " "
18899	echo "Checking whether closedir() returns a status..." >&4
18900	cat > try.c <<EOM
18901#$i_dirent I_DIRENT		/**/
18902#$i_sysdir I_SYS_DIR		/**/
18903#$i_sysndir I_SYS_NDIR		/**/
18904#$i_systypes I_SYS_TYPES	/**/
18905
18906#if defined(I_SYS_TYPES)
18907#include <sys/types.h>
18908#endif
18909#if defined(I_DIRENT)
18910#include <dirent.h>
18911#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18912#include <sys/dir.h>
18913#endif
18914#else
18915#ifdef I_SYS_NDIR
18916#include <sys/ndir.h>
18917#else
18918#ifdef I_SYS_DIR
18919#ifdef hp9000s500
18920#include <ndir.h>	/* may be wrong in the future */
18921#else
18922#include <sys/dir.h>
18923#endif
18924#endif
18925#endif
18926#endif
18927int main() { return closedir(opendir(".")); }
18928EOM
18929	set try
18930	if eval $compile_ok; then
18931		if $run ./try > /dev/null 2>&1 ; then
18932			echo "Yes, it does."
18933			val="$undef"
18934		else
18935			echo "No, it doesn't."
18936			val="$define"
18937		fi
18938	else
18939		echo "(I can't seem to compile the test program--assuming it doesn't)"
18940		val="$define"
18941	fi
18942	;;
18943*)
18944	val="$undef";
18945	;;
18946esac
18947set d_void_closedir
18948eval $setvar
18949$rm_try
18950
18951: see if there is a wait4
18952set wait4 d_wait4
18953eval $inlibc
18954
18955: see if waitpid exists
18956set waitpid d_waitpid
18957eval $inlibc
18958
18959: see if wcstombs exists
18960set wcstombs d_wcstombs
18961eval $inlibc
18962
18963: see if wctomb exists
18964set wctomb d_wctomb
18965eval $inlibc
18966
18967: see if writev exists
18968set writev d_writev
18969eval $inlibc
18970
18971: preserve RCS keywords in files with variable substitution, grrr
18972Date='$Date'
18973Id='$Id'
18974Log='$Log'
18975RCSfile='$RCSfile'
18976Revision='$Revision'
18977
18978: check for alignment requirements
18979echo " "
18980case "$usecrosscompile$multiarch" in
18981*$define*)
18982	$cat <<EOM
18983You seem to be either cross-compiling or doing a multiarchitecture build,
18984skipping the memory alignment check.
18985
18986EOM
18987	case "$alignbytes" in
18988	'') alignbytes=8 ;;
18989	esac
18990	;;
18991*)
18992	case "$alignbytes" in
18993	'') echo "Checking alignment constraints..." >&4
18994		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18995			$cat >try.c <<'EOCP'
18996typedef long double NV;
18997EOCP
18998		else
18999			$cat >try.c <<'EOCP'
19000typedef double NV;
19001EOCP
19002		fi
19003		$cat >>try.c <<'EOCP'
19004#include <stdio.h>
19005struct foobar {
19006	char foo;
19007	NV bar;
19008} try_algn;
19009int main()
19010{
19011    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19012    return(0);
19013}
19014EOCP
19015		set try
19016		if eval $compile_ok; then
19017			dflt=`$run ./try`
19018		else
19019			dflt='8'
19020			echo "(I can't seem to compile the test program...)"
19021		fi
19022		;;
19023	*) dflt="$alignbytes"
19024		;;
19025	esac
19026	rp="Doubles must be aligned on a how-many-byte boundary?"
19027	. ./myread
19028	alignbytes="$ans"
19029	$rm_try
19030	;;
19031esac
19032
19033
19034: set the base revision
19035baserev=5.0
19036
19037: length of character in bytes. Is always 1, otherwise it isnt C
19038: This used to be a test using sizeof
19039charsize=1
19040
19041: Check for the number of bits in a character
19042case "$charbits" in
19043'')	echo "Checking how long a character is (in bits)..." >&4
19044	$cat >try.c <<EOCP
19045#include <stdio.h>
19046int main ()
19047{
19048    int n;
19049    unsigned char c;
19050    for (c = 1, n = 0; c; c <<= 1, n++) ;
19051    printf ("%d\n", n);
19052    return (0);
19053    }
19054EOCP
19055	set try
19056	if eval $compile_ok; then
19057		dflt=`$run ./try`
19058	else
19059		dflt='8'
19060		echo "(I can't seem to compile the test program.  Guessing...)"
19061	fi
19062	;;
19063*)
19064	dflt="$charbits"
19065	;;
19066esac
19067rp="What is the length of a character (in bits)?"
19068. ./myread
19069charbits="$ans"
19070$rm_try
19071case "$charbits" in
190728)	;;
19073*)	cat >&4 << EOM
19074Your system has an unsigned character size of $charbits bits, which
19075is rather unusual (normally it is 8 bits).  Perl likely will not work
19076correctly on your system, with subtle bugs in various places.
19077EOM
19078	rp='Do you really want to continue?'
19079	dflt='n'
19080	. ./myread
19081	case "$ans" in
19082		[yY])	echo >&4 "Okay, continuing."	;;
19083		*)	exit 1				;;
19084	esac
19085esac
19086
19087: how do we concatenate cpp tokens here?
19088echo " "
19089echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19090$cat >cpp_stuff.c <<'EOCP'
19091#define RCAT(a,b)a/**/b
19092#define ACAT(a,b)a ## b
19093RCAT(Rei,ser)
19094ACAT(Cir,cus)
19095EOCP
19096$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19097if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19098	echo "Oh!  Smells like ANSI's been here." >&4
19099	echo "We can catify or stringify, separately or together!"
19100	cpp_stuff=42
19101elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19102	echo "Ah, yes!  The good old days!" >&4
19103	echo "However, in the good old days we don't know how to stringify and"
19104	echo "catify at the same time."
19105	cpp_stuff=1
19106else
19107	$cat >&4 <<EOM
19108Hmm, I don't seem to be able to concatenate tokens with your cpp.
19109You're going to have to edit the values of CAT[2-5] in config.h...
19110EOM
19111	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19112fi
19113$rm -f cpp_stuff.*
19114
19115: see if this is a db.h system
19116set db.h i_db
19117eval $inhdr
19118
19119case "$i_db" in
19120$define)
19121	: Check db version.
19122	echo " "
19123	echo "Checking Berkeley DB version ..." >&4
19124	$cat >try.c <<EOCP
19125#$d_const HASCONST
19126#ifndef HASCONST
19127#define const
19128#endif
19129#include <sys/types.h>
19130#include <stdio.h>
19131#$i_stdlib I_STDLIB
19132#ifdef I_STDLIB
19133#include <stdlib.h>
19134#endif
19135#include <db.h>
19136int main(int argc, char *argv[])
19137{
19138#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
19139    int Major, Minor, Patch ;
19140    unsigned long Version ;
19141    (void)db_version(&Major, &Minor, &Patch) ;
19142    if (argc == 2) {
19143        printf("%d %d %d %d %d %d\n",
19144               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19145               Major, Minor, Patch);
19146        exit(0);
19147    }
19148    printf("You have Berkeley DB Version 2 or greater.\n");
19149
19150    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19151		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19152    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19153		Major, Minor, Patch) ;
19154
19155    /* check that db.h & libdb are compatible */
19156    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19157	printf("db.h and libdb are incompatible.\n") ;
19158        exit(3);
19159    }
19160
19161    printf("db.h and libdb are compatible.\n") ;
19162
19163    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19164		+ DB_VERSION_PATCH ;
19165
19166    /* needs to be >= 2.3.4 */
19167    if (Version < 2003004) {
19168    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19169	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19170        exit(2);
19171    }
19172
19173    exit(0);
19174#else
19175#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19176    if (argc == 2) {
19177        printf("1 0 0\n");
19178        exit(0);
19179    }
19180    printf("You have Berkeley DB Version 1.\n");
19181    exit(0);	/* DB version < 2: the coast is clear. */
19182#else
19183    exit(1);	/* <db.h> not Berkeley DB? */
19184#endif
19185#endif
19186}
19187EOCP
19188	set try
19189	if eval $compile_ok && $run ./try; then
19190		echo 'Looks OK.' >&4
19191		set `$run ./try 1`
19192		db_version_major=$1
19193		db_version_minor=$2
19194		db_version_patch=$3
19195	else
19196		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19197		i_db=$undef
19198		case " $libs " in
19199		*"-ldb "*)
19200			: Remove db from list of libraries to use
19201			echo "Removing unusable -ldb from library list" >&4
19202			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19203			shift
19204			libs="$*"
19205			echo "libs = $libs" >&4
19206			;;
19207		esac
19208	fi
19209	$rm_try
19210	;;
19211esac
19212
19213case "$i_db" in
19214define)
19215	: Check the return type needed for hash
19216	echo " "
19217	echo "Checking return type needed for hash for Berkeley DB ..." >&4
19218	$cat >try.c <<EOCP
19219#$d_const HASCONST
19220#ifndef HASCONST
19221#define const
19222#endif
19223#include <sys/types.h>
19224#include <db.h>
19225
19226#ifndef DB_VERSION_MAJOR
19227u_int32_t hash_cb (ptr, size)
19228const void *ptr;
19229size_t size;
19230{
19231}
19232HASHINFO info;
19233int main()
19234{
19235	info.hash = hash_cb;
19236}
19237#endif
19238EOCP
19239	if $cc $ccflags -c try.c >try.out 2>&1 ; then
19240		if $contains warning try.out >>/dev/null 2>&1 ; then
19241			db_hashtype='int'
19242		else
19243			db_hashtype='u_int32_t'
19244		fi
19245	else
19246		: XXX Maybe we should just give up here.
19247		db_hashtype=u_int32_t
19248		$cat try.out >&4
19249		echo "Help:  I can't seem to compile the db test program." >&4
19250		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19251	fi
19252	$rm_try
19253	echo "Your version of Berkeley DB uses $db_hashtype for hash."
19254	;;
19255*)	db_hashtype=u_int32_t
19256	;;
19257esac
19258case "$i_db" in
19259define)
19260	: Check the return type needed for prefix
19261	echo " "
19262	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19263	cat >try.c <<EOCP
19264#$d_const HASCONST
19265#ifndef HASCONST
19266#define const
19267#endif
19268#include <sys/types.h>
19269#include <db.h>
19270
19271#ifndef DB_VERSION_MAJOR
19272size_t prefix_cb (key1, key2)
19273const DBT *key1;
19274const DBT *key2;
19275{
19276}
19277BTREEINFO info;
19278int main()
19279{
19280	info.prefix = prefix_cb;
19281}
19282#endif
19283EOCP
19284	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19285		if $contains warning try.out >>/dev/null 2>&1 ; then
19286			db_prefixtype='int'
19287		else
19288			db_prefixtype='size_t'
19289		fi
19290	else
19291		db_prefixtype='size_t'
19292		: XXX Maybe we should just give up here.
19293		$cat try.out >&4
19294		echo "Help:  I can't seem to compile the db test program." >&4
19295		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19296	fi
19297	$rm_try
19298	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19299	;;
19300*)	db_prefixtype='size_t'
19301	;;
19302esac
19303
19304: How can we generate normalized random numbers ?
19305echo " "
19306echo "Looking for a random number function..." >&4
19307case "$randfunc" in
19308'')
19309	if set drand48 val -f; eval $csym; $val; then
19310		dflt="drand48"
19311		echo "Good, found drand48()." >&4
19312	elif set random val -f; eval $csym; $val; then
19313		dflt="random"
19314		echo "OK, found random()." >&4
19315	else
19316		dflt="rand"
19317		echo "Yick, looks like I have to use rand()." >&4
19318	fi
19319	echo " "
19320	;;
19321*)
19322	dflt="$randfunc"
19323	;;
19324esac
19325cont=true
19326
19327case "$ccflags" in
19328*-Dmy_rand=*|*-Dmy_srand=*)
19329	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19330	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19331	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19332	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19333	;;
19334esac
19335
19336while $test "$cont"; do
19337	rp="Use which function to generate random numbers?"
19338	. ./myread
19339	if $test "$ans" = "$dflt"; then
19340		: null
19341	else
19342		randbits=''
19343	fi
19344	randfunc="$ans"
19345	if set $ans val -f; eval $csym; $val; then
19346		cont=''
19347	else
19348		dflt=y
19349		rp="I cannot find function $ans. Use that name anyway?"
19350		. ./myread
19351		dflt=rand
19352		case "$ans" in
19353			[yY]*) cont='';;
19354		esac
19355	fi
19356	case "$cont" in
19357	'')
19358		case "$randfunc" in
19359		drand48)
19360			drand01="drand48()"
19361			seedfunc="srand48"
19362			randbits=48
19363			randseedtype=long
19364			;;
19365		rand|random)
19366			case "$randbits" in
19367			'')
19368echo "Checking to see how many bits your $randfunc() function produces..." >&4
19369				$cat >try.c <<EOCP
19370#$i_unistd I_UNISTD
19371#$i_stdlib I_STDLIB
19372#include <stdio.h>
19373#ifdef I_UNISTD
19374#  include <unistd.h>
19375#endif
19376#ifdef I_STDLIB
19377#  include <stdlib.h>
19378#endif
19379int main()
19380{
19381	register int i;
19382	register unsigned long tmp;
19383	register unsigned long max = 0L;
19384
19385	for (i = 1000; i; i--) {
19386		tmp = (unsigned long) $randfunc();
19387		if (tmp > max) max = tmp;
19388	}
19389	for (i = 0; max; i++)
19390		max /= 2;
19391	printf("%d\n",i);
19392}
19393EOCP
19394				set try
19395				if eval $compile_ok; then
19396					dflt=`try`
19397				else
19398					dflt='?'
19399					echo "(I can't seem to compile the test program...)"
19400				fi
19401				;;
19402			*)
19403				dflt="$randbits"
19404				;;
19405			esac
19406			rp="How many bits does your $randfunc() function produce?"
19407			. ./myread
19408			randbits="$ans"
19409			$rm_try
19410			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19411			seedfunc="s$randfunc"
19412			randseedtype=unsigned
19413			;;
19414		*)
19415			dflt="31"
19416			rp="How many bits does your $randfunc() function produce?"
19417			. ./myread
19418			randbits="$ans"
19419			seedfunc="s$randfunc"
19420			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19421			if set $seedfunc val -f; eval $csym; $val; then
19422				echo "(Using $seedfunc() to seed random generator)"
19423			else
19424				echo "(Warning: no $seedfunc() to seed random generator)"
19425				seedfunc=rand
19426			fi
19427			randseedtype=unsigned
19428			;;
19429		esac
19430		;;
19431	esac
19432done
19433
19434: Determine if this is an EBCDIC system
19435echo " "
19436echo "Determining whether or not we are on an EBCDIC system..." >&4
19437$cat >try.c <<'EOM'
19438int main()
19439{
19440  if ('M'==0xd4) return 0;
19441  return 1;
19442}
19443EOM
19444
19445val=$undef
19446set try
19447if eval $compile_ok; then
19448	if $run ./try; then
19449		echo "You seem to speak EBCDIC." >&4
19450		val="$define"
19451	else
19452		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19453	fi
19454else
19455	echo "I'm unable to compile the test program." >&4
19456	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19457fi
19458$rm_try
19459set ebcdic
19460eval $setvar
19461
19462: Check how to flush
19463echo " "
19464$cat >&4 <<EOM
19465Checking how to flush all pending stdio output...
19466EOM
19467# I only know how to find the first 32 possibly open files on SunOS.
19468# See also hints/sunos_4_1.sh and util.c  --AD
19469case "$osname" in
19470sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19471esac
19472$cat >>try.c <<EOCP
19473#include <stdio.h>
19474#$i_stdlib I_STDLIB
19475#ifdef I_STDLIB
19476#include <stdlib.h>
19477#endif
19478#$i_unistd I_UNISTD
19479#ifdef I_UNISTD
19480# include <unistd.h>
19481#endif
19482#$d_sysconf HAS_SYSCONF
19483#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19484#ifdef HAS_STDIO_STREAM_ARRAY
19485# define STDIO_STREAM_ARRAY $stdio_stream_array
19486#endif
19487int main() {
19488  FILE* p;
19489  unlink("try.out");
19490  p = fopen("try.out", "w");
19491#ifdef TRY_FPUTC
19492  fputc('x', p);
19493#else
19494# ifdef TRY_FPRINTF
19495  fprintf(p, "x");
19496# endif
19497#endif
19498#ifdef TRY_FFLUSH_NULL
19499  fflush(NULL);
19500#endif
19501#ifdef TRY_FFLUSH_ALL
19502  {
19503    long open_max = -1;
19504# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19505    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19506# else
19507#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19508    open_max = sysconf(_SC_OPEN_MAX);
19509#  else
19510#   ifdef FOPEN_MAX
19511    open_max = FOPEN_MAX;
19512#   else
19513#    ifdef OPEN_MAX
19514    open_max = OPEN_MAX;
19515#    else
19516#     ifdef _NFILE
19517    open_max = _NFILE;
19518#     endif
19519#    endif
19520#   endif
19521#  endif
19522# endif
19523# ifdef HAS_STDIO_STREAM_ARRAY
19524    if (open_max > 0) {
19525      long i;
19526      for (i = 0; i < open_max; i++)
19527	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19528		STDIO_STREAM_ARRAY[i]._file < open_max &&
19529		STDIO_STREAM_ARRAY[i]._flag)
19530		fflush(&STDIO_STREAM_ARRAY[i]);
19531    }
19532  }
19533# endif
19534#endif
19535  _exit(42);
19536}
19537EOCP
19538: first we have to find out how _not_ to flush
19539$to try.c
19540if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19541    output=''
19542    set try -DTRY_FPUTC
19543    if eval $compile; then
19544 	    $run ./try 2>/dev/null
19545	    code="$?"
19546	    $from try.out
19547	    if $test ! -s try.out -a "X$code" = X42; then
19548		output=-DTRY_FPUTC
19549	    fi
19550    fi
19551    case "$output" in
19552    '')
19553	    set try -DTRY_FPRINTF
19554	    if eval $compile; then
19555 		    $run ./try 2>/dev/null
19556		    code="$?"
19557		    $from try.out
19558		    if $test ! -s try.out -a "X$code" = X42; then
19559			output=-DTRY_FPRINTF
19560		    fi
19561	    fi
19562	;;
19563    esac
19564fi
19565: check for fflush NULL behaviour
19566case "$fflushNULL" in
19567'') 	set try -DTRY_FFLUSH_NULL $output
19568	if eval $compile; then
19569	    	$run ./try 2>/dev/null
19570		code="$?"
19571		$from try.out
19572		if $test -s try.out -a "X$code" = X42; then
19573			fflushNULL="`$cat try.out`"
19574		else
19575			if $test "X$code" != X42; then
19576				$cat >&4 <<EOM
19577(If this test failed, don't worry, we'll try another method shortly.)
19578EOM
19579			fi
19580		fi
19581	fi
19582	$rm -f core try.core core.try.*
19583	case "$fflushNULL" in
19584	x)	$cat >&4 <<EOM
19585Your fflush(NULL) works okay for output streams.
19586Let's see if it clobbers input pipes...
19587EOM
19588# As of mid-March 2000 all versions of Solaris appear to have a stdio
19589# bug that improperly flushes the input end of pipes.  So we avoid the
19590# autoflush on fork/system/exec support for now. :-(
19591$cat >tryp.c <<EOCP
19592#include <stdio.h>
19593int
19594main(int argc, char **argv)
19595{
19596    char buf[1024];
19597    int i;
19598    char *bp = buf;
19599    while (1) {
19600        while ((i = getc(stdin)) != -1
19601               && (*bp++ = i) != '\n'
19602               && bp < &buf[1024])
19603    	/* DO NOTHING */ ;
19604        *bp = '\0';
19605        fprintf(stdout, "%s", buf);
19606        fflush(NULL);
19607        if (i == -1)
19608	    return 0;
19609        bp = buf;
19610    }
19611}
19612EOCP
19613                fflushNULL="$define"
19614                set tryp
19615                if eval $compile; then
19616                    $rm -f tryp.out
19617                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19618                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19619                       $cat >&4 <<EOM
19620fflush(NULL) seems to behave okay with input streams.
19621EOM
19622			fflushNULL="$define"
19623                    else
19624			$cat >&4 <<EOM
19625Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19626EOM
19627                        fflushNULL="$undef"
19628                    fi
19629                fi
19630	        $rm -f core tryp.c tryp.core core.tryp.*
19631		;;
19632	'')	$cat >&4 <<EOM
19633Your fflush(NULL) isn't working (contrary to ANSI C).
19634EOM
19635		fflushNULL="$undef"
19636		;;
19637	*)	$cat >&4 <<EOM
19638Cannot figure out whether your fflush(NULL) works or not.
19639I'm assuming it doesn't (contrary to ANSI C).
19640EOM
19641		fflushNULL="$undef"
19642		;;
19643	esac
19644	;;
19645$define|true|[yY]*)
19646	fflushNULL="$define"
19647	;;
19648*)
19649	fflushNULL="$undef"
19650	;;
19651esac
19652: check explicit looping only if NULL did not work, and if the pipe
19653: bug does not show up on an explicit flush too
19654case "$fflushNULL" in
19655"$undef")
19656	$cat >tryp.c <<EOCP
19657#include <stdio.h>
19658int
19659main(int argc, char **argv)
19660{
19661    char buf[1024];
19662    int i;
19663    char *bp = buf;
19664    while (1) {
19665	while ((i = getc(stdin)) != -1
19666	       && (*bp++ = i) != '\n'
19667	       && bp < &buf[1024])
19668	/* DO NOTHING */ ;
19669	*bp = '\0';
19670	fprintf(stdout, "%s", buf);
19671	fflush(stdin);
19672	if (i == -1)
19673	    return 0;
19674	bp = buf;
19675    }
19676}
19677EOCP
19678	set tryp
19679	if eval $compile; then
19680	    $rm -f tryp.out
19681	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19682	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19683	       $cat >&4 <<EOM
19684Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19685EOM
19686		: now check for fflushall behaviour
19687		case "$fflushall" in
19688		'') 	set try -DTRY_FFLUSH_ALL $output
19689			if eval $compile; then
19690				$cat >&4 <<EOM
19691(Now testing the other method--but note that this also may fail.)
19692EOM
19693				$run ./try 2>/dev/null
19694				code=$?
19695				$from try.out
19696				if $test -s try.out -a "X$code" = X42; then
19697					fflushall="`$cat try.out`"
19698				fi
19699			fi
19700			$rm_try
19701			case "$fflushall" in
19702			x)	$cat >&4 <<EOM
19703Whew. Flushing explicitly all the stdio streams works.
19704EOM
19705				fflushall="$define"
19706				;;
19707			'')	$cat >&4 <<EOM
19708Sigh. Flushing explicitly all the stdio streams doesn't work.
19709EOM
19710				fflushall="$undef"
19711				;;
19712			*)	$cat >&4 <<EOM
19713Cannot figure out whether flushing stdio streams explicitly works or not.
19714I'm assuming it doesn't.
19715EOM
19716				fflushall="$undef"
19717				;;
19718			esac
19719			;;
19720		"$define"|true|[yY]*)
19721			fflushall="$define"
19722			;;
19723		*)
19724			fflushall="$undef"
19725			;;
19726		esac
19727	    else
19728		$cat >&4 <<EOM
19729All is futile.  Even fflush(stdin) clobbers input pipes!
19730EOM
19731		fflushall="$undef"
19732	    fi
19733	else
19734	    fflushall="$undef"
19735	fi
19736	$rm -f core tryp.c tryp.core core.tryp.*
19737	;;
19738*)	fflushall="$undef"
19739	;;
19740esac
19741
19742case "$fflushNULL$fflushall" in
19743undefundef)
19744	$cat <<EOM
19745OK, I give up.  I cannot figure out how to flush pending stdio output.
19746We won't be flushing handles at all before fork/exec/popen.
19747EOM
19748	;;
19749esac
19750$rm_try tryp
19751
19752: Store the full pathname to the ar program for use in the C program
19753: Respect a hint or command line value for full_ar.
19754case "$full_ar" in
19755'') full_ar=$ar ;;
19756esac
19757
19758: Store the full pathname to the sed program for use in the C program
19759full_sed=$sed
19760
19761: see what type gids are declared as in the kernel
19762echo " "
19763echo "Looking for the type for group ids returned by getgid()."
19764set gid_t gidtype xxx stdio.h sys/types.h
19765eval $typedef
19766case "$gidtype" in
19767xxx)
19768	xxx=`./findhdr sys/user.h`
19769	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19770	case $1 in
19771	unsigned) dflt="$1 $2" ;;
19772	*) dflt="$1" ;;
19773	esac
19774	;;
19775*) dflt="$gidtype";;
19776esac
19777case "$gidtype" in
19778gid_t) echo "gid_t found." ;;
19779*)	rp="What is the type for group ids returned by getgid()?"
19780	. ./myread
19781	gidtype="$ans"
19782	;;
19783esac
19784
19785: Check the size of GID
19786echo " "
19787case "$gidtype" in
19788*_t) zzz="$gidtype"	;;
19789*)   zzz="gid"		;;
19790esac
19791echo "Checking the size of $zzz..." >&4
19792cat > try.c <<EOCP
19793#include <sys/types.h>
19794#include <stdio.h>
19795#$i_stdlib I_STDLIB
19796#ifdef I_STDLIB
19797#include <stdlib.h>
19798#endif
19799int main() {
19800    printf("%d\n", (int)sizeof($gidtype));
19801    exit(0);
19802}
19803EOCP
19804set try
19805if eval $compile_ok; then
19806	yyy=`$run ./try`
19807	case "$yyy" in
19808	'')	gidsize=4
19809		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19810		;;
19811	*)	gidsize=$yyy
19812		echo "Your $zzz is $gidsize bytes long."
19813		;;
19814	esac
19815else
19816	gidsize=4
19817	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19818fi
19819
19820
19821: Check if GID is signed
19822echo " "
19823case "$gidtype" in
19824*_t) zzz="$gidtype"	;;
19825*)   zzz="gid"		;;
19826esac
19827echo "Checking the sign of $zzz..." >&4
19828cat > try.c <<EOCP
19829#include <sys/types.h>
19830#include <stdio.h>
19831int main() {
19832	$gidtype foo = -1;
19833	if (foo < 0)
19834		printf("-1\n");
19835	else
19836		printf("1\n");
19837}
19838EOCP
19839set try
19840if eval $compile; then
19841	yyy=`$run ./try`
19842	case "$yyy" in
19843	'')	gidsign=1
19844		echo "(I can't execute the test program--guessing unsigned.)" >&4
19845		;;
19846	*)	gidsign=$yyy
19847		case "$gidsign" in
19848		 1) echo "Your $zzz is unsigned." ;;
19849		-1) echo "Your $zzz is signed."   ;;
19850		esac
19851		;;
19852	esac
19853else
19854	gidsign=1
19855	echo "(I can't compile the test program--guessing unsigned.)" >&4
19856fi
19857
19858
19859: Check 64bit sizes
19860echo " "
19861
19862if $test X"$quadtype" != X; then
19863
19864echo "Checking how to print 64-bit integers..." >&4
19865
19866if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19867	$cat >try.c <<'EOCP'
19868#include <sys/types.h>
19869#include <stdio.h>
19870int main() {
19871  int q = 12345678901;
19872  printf("%ld\n", q);
19873}
19874EOCP
19875	set try
19876	if eval $compile; then
19877		yyy=`$run ./try`
19878		case "$yyy" in
19879		12345678901)
19880			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19881                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19882			echo "We will use %d."
19883			;;
19884		esac
19885	fi
19886fi
19887
19888if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19889	$cat >try.c <<'EOCP'
19890#include <sys/types.h>
19891#include <stdio.h>
19892int main() {
19893  long q = 12345678901;
19894  printf("%ld\n", q);
19895}
19896EOCP
19897	set try
19898	if eval $compile; then
19899		yyy=`$run ./try`
19900		case "$yyy" in
19901		12345678901)
19902			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19903                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19904			echo "We will use %ld."
19905			;;
19906		esac
19907	fi
19908fi
19909
19910if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19911	$cat >try.c <<'EOCP'
19912#include <sys/types.h>
19913#include <inttypes.h>
19914#include <stdio.h>
19915int main() {
19916  int64_t q = 12345678901;
19917  printf("%" PRId64 "\n", q);
19918}
19919EOCP
19920	set try
19921	if eval $compile; then
19922		yyy=`$run ./try`
19923		case "$yyy" in
19924		12345678901)
19925			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19926                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19927			echo "We will use the C9X style."
19928			;;
19929		esac
19930	fi
19931fi
19932
19933if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19934	$cat >try.c <<EOCP
19935#include <sys/types.h>
19936#include <stdio.h>
19937int main() {
19938  $quadtype q = 12345678901;
19939  printf("%Ld\n", q);
19940}
19941EOCP
19942	set try
19943	if eval $compile; then
19944		yyy=`$run ./try`
19945		case "$yyy" in
19946		12345678901)
19947			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19948                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19949			echo "We will use %Ld."
19950			;;
19951		esac
19952	fi
19953fi
19954
19955if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19956	$cat >try.c <<'EOCP'
19957#include <sys/types.h>
19958#include <stdio.h>
19959int main() {
19960  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19961  printf("%lld\n", q);
19962}
19963EOCP
19964	set try
19965	if eval $compile; then
19966		yyy=`$run ./try`
19967		case "$yyy" in
19968		12345678901)
19969			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19970                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19971			echo "We will use the %lld style."
19972			;;
19973		esac
19974	fi
19975fi
19976
19977if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19978	$cat >try.c <<EOCP
19979#include <sys/types.h>
19980#include <stdio.h>
19981int main() {
19982  $quadtype q = 12345678901;
19983  printf("%qd\n", q);
19984}
19985EOCP
19986	set try
19987	if eval $compile; then
19988		yyy=`$run ./try`
19989		case "$yyy" in
19990		12345678901)
19991			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19992                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19993			echo "We will use %qd."
19994			;;
19995		esac
19996	fi
19997fi
19998
19999if $test X"$sPRId64" = X; then
20000	echo "Cannot figure out how to print 64-bit integers." >&4
20001fi
20002$rm_try
20003
20004fi
20005
20006case "$sPRId64" in
20007'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20008	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20009	;;
20010*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20011	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20012	;;
20013esac
20014
20015: Check format strings for internal types
20016echo " "
20017$echo "Checking the format strings to be used for Perl's internal types..." >&4
20018
20019if $test X"$ivsize" = X8; then
20020	ivdformat="$sPRId64"
20021	uvuformat="$sPRIu64"
20022	uvoformat="$sPRIo64"
20023	uvxformat="$sPRIx64"
20024	uvXUformat="$sPRIXU64"
20025else
20026	if $test X"$ivsize" = X"$longsize"; then
20027		ivdformat='"ld"'
20028		uvuformat='"lu"'
20029		uvoformat='"lo"'
20030		uvxformat='"lx"'
20031		uvXUformat='"lX"'
20032	else
20033		if $test X"$ivsize" = X"$intsize"; then
20034			ivdformat='"d"'
20035			uvuformat='"u"'
20036			uvoformat='"o"'
20037			uvxformat='"x"'
20038			uvXUformat='"X"'
20039		else
20040			: far out
20041			if $test X"$ivsize" = X"$shortsize"; then
20042				ivdformat='"hd"'
20043				uvuformat='"hu"'
20044				uvoformat='"ho"'
20045				uvxformat='"hx"'
20046				uvXUformat='"hX"'
20047			fi
20048		fi
20049	fi
20050fi
20051
20052if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20053	nveformat="$sPRIeldbl"
20054	nvfformat="$sPRIfldbl"
20055	nvgformat="$sPRIgldbl"
20056	nvEUformat="$sPRIEUldbl"
20057	nvFUformat="$sPRIFUldbl"
20058	nvGUformat="$sPRIGUldbl"
20059else
20060	nveformat='"e"'
20061	nvfformat='"f"'
20062	nvgformat='"g"'
20063	nvEUformat='"E"'
20064	nvFUformat='"F"'
20065	nvGUformat='"G"'
20066fi
20067
20068case "$ivdformat" in
20069'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20070    exit 1
20071    ;;
20072esac
20073
20074: Check format string for GID
20075
20076echo " "
20077$echo "Checking the format string to be used for gids..." >&4
20078
20079case "$gidsign" in
20080-1)	if $test X"$gidsize" = X"$ivsize"; then
20081		gidformat="$ivdformat"
20082	else
20083		if $test X"$gidsize" = X"$longsize"; then
20084			gidformat='"ld"'
20085		else
20086			if $test X"$gidsize" = X"$intsize"; then
20087				gidformat='"d"'
20088			else
20089				if $test X"$gidsize" = X"$shortsize"; then
20090					gidformat='"hd"'
20091				fi
20092			fi
20093		fi
20094	fi
20095	;;
20096*)	if $test X"$gidsize" = X"$uvsize"; then
20097		gidformat="$uvuformat"
20098	else
20099		if $test X"$gidsize" = X"$longsize"; then
20100			gidformat='"lu"'
20101		else
20102			if $test X"$gidsize" = X"$intsize"; then
20103				gidformat='"u"'
20104			else
20105				if $test X"$gidsize" = X"$shortsize"; then
20106					gidformat='"hu"'
20107				fi
20108			fi
20109		fi
20110	fi
20111	;;
20112esac
20113
20114: see if getgroups exists
20115set getgroups d_getgrps
20116eval $inlibc
20117
20118: see if setgroups exists
20119set setgroups d_setgrps
20120eval $inlibc
20121
20122: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20123echo " "
20124case "$d_getgrps$d_setgrps" in
20125*define*)
20126	case "$groupstype" in
20127	'') dflt="$gidtype" ;;
20128	*)  dflt="$groupstype" ;;
20129	esac
20130	$cat <<EOM
20131What type of pointer is the second argument to getgroups() and setgroups()?
20132Usually this is the same as group ids, $gidtype, but not always.
20133
20134EOM
20135	rp='What type pointer is the second argument to getgroups() and setgroups()?'
20136	. ./myread
20137	groupstype="$ans"
20138	;;
20139*)  groupstype="$gidtype";;
20140esac
20141
20142: MAD = Misc Attribute Definition
20143
20144if $test $patchlevel -lt 9; then
20145: MAD is not available in 5.8.x or earlier.
20146    ans=n;
20147else
20148    case "$mad" in
20149    $define|true|[yY]*)	dflt='y' ;;
20150    *)			dflt='n' ;;
20151    esac
20152    cat <<EOM
20153
20154Would you like to build with Misc Attribute Decoration? This is development
20155work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20156overhead on the interpreter.
20157
20158If this doesn't make any sense to you, just accept the default '$dflt'.
20159EOM
20160    rp='Build Perl with MAD?'
20161    . ./myread
20162fi
20163case "$ans" in
20164y|Y)	val="$define"
20165	madlyh='madly.h madly.act madly.tab'
20166	madlysrc='madly.c'
20167	madlyobj="madly$_o" ;;
20168*)	val="$undef"
20169	madlyh=''
20170	madlysrc=''
20171	madlyobj='' ;;
20172esac
20173set mad
20174eval $setvar
20175
20176: check whether make sets MAKE
20177echo " "
20178echo "Checking if your $make program sets \$(MAKE)..." >&4
20179case "$make_set_make" in
20180'')
20181	$sed 's/^X //' > testmake.mak << 'EOF'
20182Xall:
20183X 	@echo 'maketemp="$(MAKE)"'
20184EOF
20185	case "`$make -f testmake.mak 2>/dev/null`" in
20186	*maketemp=*) make_set_make='#' ;;
20187	*)	make_set_make="MAKE=$make" ;;
20188	esac
20189	$rm -f testmake.mak
20190	;;
20191esac
20192case "$make_set_make" in
20193'#') echo "Yup, it does.";;
20194*) echo "Nope, it doesn't.";;
20195esac
20196
20197: see what type is used for mode_t
20198rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20199set mode_t modetype int stdio.h sys/types.h
20200eval $typedef_ask
20201
20202: see if we need va_copy
20203echo " "
20204case "$i_stdarg" in
20205"$define")
20206	$cat >try.c <<EOCP
20207#include <stdarg.h>
20208#include <stdio.h>
20209#$i_stdlib I_STDLIB
20210#ifdef I_STDLIB
20211#include <stdlib.h>
20212#endif
20213#include <signal.h>
20214
20215int
20216ivfprintf(FILE *f, const char *fmt, va_list *valp)
20217{
20218  return vfprintf(f, fmt, *valp);
20219}
20220
20221int
20222myvfprintf(FILE *f, const  char *fmt, va_list val)
20223{
20224  return ivfprintf(f, fmt, &val);
20225}
20226
20227int
20228myprintf(char *fmt, ...)
20229{
20230  va_list val;
20231  va_start(val, fmt);
20232  return myvfprintf(stdout, fmt, val);
20233}
20234
20235int
20236main(int ac, char **av)
20237{
20238  signal(SIGSEGV, exit);
20239
20240  myprintf("%s%cs all right, then\n", "that", '\'');
20241  exit(0);
20242}
20243EOCP
20244	set try
20245	if eval $compile && $run ./try 2>&1 >/dev/null; then
20246		case "`$run ./try`" in
20247		"that's all right, then")
20248			okay=yes
20249			;;
20250		esac
20251	fi
20252	case "$okay" in
20253	yes)	echo "It seems that you don't need va_copy()." >&4
20254		need_va_copy="$undef"
20255		;;
20256	*)	echo "It seems that va_copy() or similar will be needed." >&4
20257		need_va_copy="$define"
20258		;;
20259	esac
20260	$rm_try
20261	;;
20262*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20263	;;
20264esac
20265
20266: see what type is used for size_t
20267rp="What is the type used for the length parameter for string functions?"
20268set size_t sizetype 'unsigned int' stdio.h sys/types.h
20269eval $typedef_ask
20270
20271: check for type of arguments to gethostbyaddr.
20272if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20273	case "$d_gethbyaddr" in
20274	$define)
20275		$cat <<EOM
20276
20277Checking to see what type of arguments are accepted by gethostbyaddr().
20278EOM
20279		hdrs="$define sys/types.h
20280			$d_socket sys/socket.h
20281			$i_niin netinet/in.h
20282			$i_netdb netdb.h
20283			$i_unistd unistd.h"
20284		: The first arg can 'char *' or 'void *'
20285		: The second arg is some of integral type
20286		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20287			for yyy in size_t long int; do
20288				case "$netdb_host_type" in
20289				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20290					if ./protochk "$try" $hdrs; then
20291						echo "Your system accepts $xxx for the first arg."
20292						echo "...and $yyy for the second arg."
20293						netdb_host_type="$xxx"
20294						netdb_hlen_type="$yyy"
20295					fi
20296					;;
20297				esac
20298			done
20299		done
20300		: In case none of those worked, prompt the user.
20301		case "$netdb_host_type" in
20302		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
20303			dflt='char *'
20304			. ./myread
20305			netdb_host_type=$ans
20306			rp='What is the type for the 2nd argument to gethostbyaddr?'
20307			dflt="$sizetype"
20308			. ./myread
20309			netdb_hlen_type=$ans
20310			;;
20311		esac
20312		;;
20313	*)	: no gethostbyaddr, so pick harmless defaults
20314		netdb_host_type='char *'
20315		netdb_hlen_type="$sizetype"
20316		;;
20317	esac
20318	# Remove the "const" if needed. -- but then we'll have a
20319	# prototype clash!
20320	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20321fi
20322
20323: check for type of argument to gethostbyname.
20324if test "X$netdb_name_type" = X ; then
20325	case "$d_gethbyname" in
20326	$define)
20327		$cat <<EOM
20328
20329Checking to see what type of argument is accepted by gethostbyname().
20330EOM
20331		hdrs="$define sys/types.h
20332			$d_socket sys/socket.h
20333			$i_niin netinet/in.h
20334			$i_netdb netdb.h
20335			$i_unistd unistd.h"
20336		for xxx in "const char *" "char *"; do
20337			case "$netdb_name_type" in
20338			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
20339				if ./protochk "$try" $hdrs; then
20340					echo "Your system accepts $xxx."
20341					netdb_name_type="$xxx"
20342				fi
20343				;;
20344			esac
20345		done
20346		: In case none of those worked, prompt the user.
20347		case "$netdb_name_type" in
20348		'')	rp='What is the type for the 1st argument to gethostbyname?'
20349			dflt='char *'
20350			. ./myread
20351			netdb_name_type=$ans
20352			;;
20353		esac
20354		;;
20355	*)	: no gethostbyname, so pick harmless default
20356		netdb_name_type='char *'
20357		;;
20358	esac
20359fi
20360
20361: check for type of 1st argument to getnetbyaddr.
20362if test "X$netdb_net_type" = X ; then
20363	case "$d_getnbyaddr" in
20364	$define)
20365		$cat <<EOM
20366
20367Checking to see what type of 1st argument is accepted by getnetbyaddr().
20368EOM
20369		hdrs="$define sys/types.h
20370			$d_socket sys/socket.h
20371			$i_niin netinet/in.h
20372			$i_netdb netdb.h
20373			$i_unistd unistd.h"
20374		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20375			case "$netdb_net_type" in
20376			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20377				if ./protochk "$try" $hdrs; then
20378					echo "Your system accepts $xxx."
20379					netdb_net_type="$xxx"
20380				fi
20381				;;
20382			esac
20383		done
20384		: In case none of those worked, prompt the user.
20385		case "$netdb_net_type" in
20386		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
20387			dflt='long'
20388			. ./myread
20389			netdb_net_type=$ans
20390			;;
20391		esac
20392		;;
20393	*)	: no getnetbyaddr, so pick harmless default
20394		netdb_net_type='long'
20395		;;
20396	esac
20397fi
20398: locate the preferred pager for this system
20399fn=f/
20400case "$pager" in
20401'')
20402	dflt=''
20403	case "$pg" in
20404	/*) dflt=$pg;;
20405	[a-zA-Z]:/*) dflt=$pg;;
20406	esac
20407	case "$more" in
20408	/*) dflt=$more;;
20409	[a-zA-Z]:/*) dflt=$more;;
20410	esac
20411	case "$less" in
20412	/*) dflt=$less;;
20413	[a-zA-Z]:/*) dflt=$less;;
20414	esac
20415	case "$dflt" in
20416	'') dflt=/usr/ucb/more;;
20417	esac
20418	;;
20419*)	dflt="$pager"
20420	fn="f/($pager)"
20421	;;
20422esac
20423echo " "
20424rp='What pager is used on your system?'
20425. ./getfile
20426pager="$ans"
20427
20428: see what type pids are declared as in the kernel
20429rp="What is the type of process ids on this system?"
20430set pid_t pidtype int stdio.h sys/types.h
20431eval $typedef_ask
20432
20433: see if ar generates random libraries by itself
20434echo " "
20435echo "Checking how to generate random libraries on your machine..." >&4
20436echo 'int bar1() { return bar2(); }' > bar1.c
20437echo 'int bar2() { return 2; }' > bar2.c
20438$cat > foo.c <<EOP
20439#$i_stdlib I_STDLIB
20440#ifdef I_STDLIB
20441#include <stdlib.h>
20442#endif
20443int main() { printf("%d\n", bar1()); exit(0); }
20444EOP
20445$cc $ccflags -c bar1.c >/dev/null 2>&1
20446$cc $ccflags -c bar2.c >/dev/null 2>&1
20447$cc $ccflags -c foo.c >/dev/null 2>&1
20448$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20449if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20450	$run ./foobar >/dev/null 2>&1; then
20451	echo "$ar appears to generate random libraries itself."
20452	orderlib=false
20453	if [ "X$ranlib" = "X" ]; then
20454	    ranlib=":"
20455	fi
20456elif $ar s bar$_a >/dev/null 2>&1 &&
20457	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20458	$run ./foobar >/dev/null 2>&1; then
20459		echo "a table of contents needs to be added with '$ar s'."
20460		orderlib=false
20461		ranlib="$ar s"
20462elif $ar ts bar$_a >/dev/null 2>&1 &&
20463	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20464	$run ./foobar >/dev/null 2>&1; then
20465		echo "a table of contents needs to be added with '$ar ts'."
20466		orderlib=false
20467		ranlib="$ar ts"
20468else
20469	case "$ranlib" in
20470	:) ranlib='';;
20471	'')
20472		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20473		$test -f $ranlib || ranlib=''
20474		;;
20475	esac
20476	if $test -n "$ranlib"; then
20477		echo "your system has '$ranlib'; we'll use that."
20478		orderlib=false
20479	else
20480		echo "your system doesn't seem to support random libraries"
20481		echo "so we'll use lorder and tsort to order the libraries."
20482		orderlib=true
20483		ranlib=":"
20484	fi
20485fi
20486$rm -f foo* bar*
20487
20488: see if this is a values.h system
20489set values.h i_values
20490eval $inhdr
20491
20492: Check the max offset that gmtime and localtime accept
20493echo "Checking max offsets that gmtime () accepts"
20494
20495case $i_values in
20496    define) yyy="#include <values.h>" ;;
20497    *)      yyy="" ;;
20498    esac
20499
20500case "$sGMTIME_min/$sGMTIME_max" in
20501    0/0|/)
20502	$cat >try.c <<EOCP
20503#include <sys/types.h>
20504#include <stdio.h>
20505#include <time.h>
20506$yyy
20507
20508int i;
20509struct tm *tmp;
20510time_t pt;
20511
20512void gm_check (time_t t, int min_year, int max_year)
20513{
20514    tmp = gmtime (&t);
20515    if ( tmp == NULL ||
20516	/* Check tm_year overflow */
20517	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20518	tmp = NULL;
20519    else
20520	pt = t;
20521    } /* gm_check */
20522
20523int check_max ()
20524{
20525    tmp = NULL;
20526    pt  = 0;
20527#ifdef MAXLONG
20528    gm_check (MAXLONG, 69, 0x7fffffff);
20529#endif
20530    if (tmp == NULL || tmp->tm_year < 0) {
20531	for (i = 63; i >= 0; i--) {
20532	    time_t x = pt | ((time_t)1 << i);
20533	    if (x < 0 || x < pt) continue;
20534	    gm_check (x, 69, 0x7fffffff);
20535	    }
20536	}
20537    printf ("sGMTIME_max=%ld\n", pt);
20538    return (0);
20539    } /* check_max */
20540
20541int check_min ()
20542{
20543    tmp = NULL;
20544    pt  = 0;
20545#ifdef MINLONG
20546    gm_check (MINLONG, -1900, 70);
20547#endif
20548    if (tmp == NULL) {
20549	for (i = 36; i >= 0; i--) {
20550	    time_t x = pt - ((time_t)1 << i);
20551	    if (x > 0) continue;
20552	    gm_check (x, -1900, 70);
20553	    }
20554	}
20555    printf ("sGMTIME_min=%ld\n", pt);
20556    return (0);
20557    } /* check_min */
20558
20559int main (int argc, char *argv[])
20560{
20561    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20562    check_max ();
20563    check_min ();
20564    return (0);
20565    } /* main */
20566EOCP
20567	set try
20568	if eval $compile; then
20569	    eval `$run ./try`
20570	else
20571	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20572	    fi
20573	$rm_try
20574	;;
20575    esac
20576
20577echo "Checking max offsets that localtime () accepts"
20578
20579case "$sLOCALTIME_min/$sLOCALTIME_max" in
20580    0/0|/)
20581	$cat >try.c <<EOCP
20582#include <sys/types.h>
20583#include <stdio.h>
20584#include <time.h>
20585$yyy
20586
20587int i;
20588struct tm *tmp;
20589time_t pt;
20590
20591void local_check (time_t t, int min_year, int max_year)
20592{
20593    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20594	tmp = NULL;
20595    else
20596	tmp = localtime (&t);
20597    if ( tmp == NULL ||
20598	/* Check tm_year overflow */
20599	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20600	tmp = NULL;
20601    else
20602	pt = t;
20603    } /* local_check */
20604
20605int check_max ()
20606{
20607    tmp = NULL;
20608    pt  = 0;
20609#ifdef MAXLONG
20610    local_check (MAXLONG, 69, 0x7fffffff);
20611#endif
20612    if (tmp == NULL || tmp->tm_year < 0) {
20613	for (i = 63; i >= 0; i--) {
20614	    time_t x = pt | ((time_t)1 << i);
20615	    if (x < 0 || x < pt) continue;
20616	    local_check (x, 69, 0x7fffffff);
20617	    }
20618	}
20619    printf ("sLOCALTIME_max=%ld\n", pt);
20620    return (0);
20621   } /* check_max */
20622
20623int check_min ()
20624{
20625    tmp = NULL;
20626    pt  = 0;
20627#ifdef MINLONG
20628    local_check (MINLONG, -1900, 70);
20629#endif
20630    if (tmp == NULL) {
20631	for (i = 36; i >= 0; i--) {
20632	    time_t x = pt - ((time_t)1 << i);
20633	    if (x > 0) continue;
20634	    local_check (x, -1900, 70);
20635	    }
20636	}
20637    printf ("sLOCALTIME_min=%ld\n", pt);
20638    return (0);
20639    } /* check_min */
20640
20641int main (int argc, char *argv[])
20642{
20643    check_max ();
20644    check_min ();
20645    return (0);
20646    } /* main */
20647EOCP
20648	set try
20649	if eval $compile; then
20650	    eval `$run ./try`
20651	else
20652	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20653	    fi
20654	$rm_try
20655	;;
20656    esac
20657
20658: check for type of arguments to select.
20659case "$selecttype" in
20660'') case "$d_select" in
20661	$define)
20662		echo " "
20663		$cat <<EOM
20664Checking to see what type of arguments are accepted by select().
20665EOM
20666		hdrs="$define sys/types.h
20667			$i_systime sys/time.h
20668			$i_sysselct sys/select.h
20669			$d_socket sys/socket.h"
20670		: The first arg can be int, unsigned, or size_t
20671		: The last arg may or may not be 'const'
20672		val=''
20673		: void pointer has been seen but using that
20674		: breaks the selectminbits test
20675		for xxx in 'fd_set *' 'int *'; do
20676			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20677				for tmo in 'struct timeval *' 'const struct timeval *'; do
20678					case "$val" in
20679					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20680						if ./protochk "$try" $hdrs; then
20681							echo "Your system accepts $xxx."
20682							val="$xxx"
20683						fi
20684						;;
20685					esac
20686				done
20687			done
20688		done
20689		case "$val" in
20690		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20691			case "$d_fd_set" in
20692				$define) dflt="fd_set *" ;;
20693				*)		dflt="int *" ;;
20694			esac
20695			. ./myread
20696			val=$ans
20697			;;
20698		esac
20699		selecttype="$val"
20700		;;
20701	*)	: no select, so pick a harmless default
20702		selecttype='int *'
20703		;;
20704	esac
20705	;;
20706esac
20707
20708: check for the select 'width'
20709case "$selectminbits" in
20710'') safebits=`expr $ptrsize \* 8`
20711    case "$d_select" in
20712	$define)
20713		$cat <<EOM
20714
20715Checking to see on how many bits at a time your select() operates...
20716EOM
20717		$cat >try.c <<EOCP
20718#include <sys/types.h>
20719#$i_time I_TIME
20720#$i_systime I_SYS_TIME
20721#$i_systimek I_SYS_TIME_KERNEL
20722#ifdef I_TIME
20723#   include <time.h>
20724#endif
20725#ifdef I_SYS_TIME
20726#   ifdef I_SYS_TIME_KERNEL
20727#	define KERNEL
20728#   endif
20729#   include <sys/time.h>
20730#   ifdef I_SYS_TIME_KERNEL
20731#	undef KERNEL
20732#   endif
20733#endif
20734#$i_sysselct I_SYS_SELECT
20735#ifdef I_SYS_SELECT
20736#include <sys/select.h>
20737#endif
20738#$d_socket HAS_SOCKET
20739#ifdef HAS_SOCKET
20740#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20741#endif
20742#include <stdio.h>
20743#$i_stdlib I_STDLIB
20744#ifdef I_STDLIB
20745#include <stdlib.h>
20746#endif
20747$selecttype b;
20748#define S sizeof(*(b))
20749#define MINBITS	64
20750#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20751#define NBITS  (NBYTES * 8)
20752int main() {
20753    char *s = (char *)malloc(NBYTES);
20754    struct timeval t;
20755    int i;
20756    FILE* fp;
20757    int fd;
20758
20759    if (!s)
20760	exit(1);
20761    fclose(stdin);
20762    fp = fopen("try.c", "r");
20763    if (fp == 0)
20764      exit(2);
20765    fd = fileno(fp);
20766    if (fd < 0)
20767      exit(3);
20768    b = ($selecttype)s;
20769    for (i = 0; i < NBITS; i++)
20770	FD_SET(i, b);
20771    t.tv_sec  = 0;
20772    t.tv_usec = 0;
20773    select(fd + 1, b, 0, 0, &t);
20774    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20775    free(s);
20776    printf("%d\n", i + 1);
20777    return 0;
20778}
20779EOCP
20780		set try
20781		if eval $compile_ok; then
20782			selectminbits=`$run ./try`
20783			case "$selectminbits" in
20784			'')	cat >&4 <<EOM
20785Cannot figure out on how many bits at a time your select() operates.
20786I'll play safe and guess it is $safebits bits.
20787EOM
20788				selectminbits=$safebits
20789				bits="$safebits bits"
20790				;;
20791			1)	bits="1 bit" ;;
20792			*)	bits="$selectminbits bits" ;;
20793			esac
20794			echo "Your select() operates on $bits at a time." >&4
20795		else
20796			rp='What is the minimum number of bits your select() operates on?'
20797			case "$byteorder" in
20798			12345678)	dflt=64 ;;
20799			1234)		dflt=32 ;;
20800			*)		dflt=1	;;
20801			esac
20802			. ./myread
20803			val=$ans
20804			selectminbits="$val"
20805		fi
20806		$rm_try
20807		;;
20808	*)	: no select, so pick a harmless default
20809		selectminbits=$safebits
20810		;;
20811	esac
20812	;;
20813esac
20814
20815: Trace out the files included by signal.h, then look for SIGxxx names.
20816if [ "X$fieldn" = X ]; then
20817	: Just make some guesses.  We check them later.
20818	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20819else
20820	xxx=`echo '#include <signal.h>' |
20821	$cppstdin $cppminus $cppflags 2>/dev/null |
20822	$grep '^[ 	]*#.*include' |
20823	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20824		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20825fi
20826xxxfiles=''
20827for xx in $xxx /dev/null ; do
20828	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
20829done
20830case "$xxxfiles" in
20831'')	xxxfiles=`./findhdr signal.h` ;;
20832esac
20833xxx=`awk '
20834$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20835	print substr($2, 4, 20)
20836}
20837$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20838	print substr($3, 4, 20)
20839}' $xxxfiles`
20840: Append some common names just in case the awk scan failed.
20841xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20842xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20843xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20844xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20845xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20846
20847: generate a few handy files for later
20848$cat > signal.c <<EOCP
20849#include <sys/types.h>
20850#include <signal.h>
20851#$i_stdlib I_STDLIB
20852#ifdef I_STDLIB
20853#include <stdlib.h>
20854#endif
20855#include <stdio.h>
20856int main() {
20857
20858/* Strange style to avoid deeply-nested #if/#else/#endif */
20859#ifndef NSIG
20860#  ifdef _NSIG
20861#    define NSIG (_NSIG)
20862#  endif
20863#endif
20864
20865#ifndef NSIG
20866#  ifdef SIGMAX
20867#    define NSIG (SIGMAX+1)
20868#  endif
20869#endif
20870
20871#ifndef NSIG
20872#  ifdef SIG_MAX
20873#    define NSIG (SIG_MAX+1)
20874#  endif
20875#endif
20876
20877#ifndef NSIG
20878#  ifdef _SIG_MAX
20879#    define NSIG (_SIG_MAX+1)
20880#  endif
20881#endif
20882
20883#ifndef NSIG
20884#  ifdef MAXSIG
20885#    define NSIG (MAXSIG+1)
20886#  endif
20887#endif
20888
20889#ifndef NSIG
20890#  ifdef MAX_SIG
20891#    define NSIG (MAX_SIG+1)
20892#  endif
20893#endif
20894
20895#ifndef NSIG
20896#  ifdef SIGARRAYSIZE
20897#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20898#  endif
20899#endif
20900
20901#ifndef NSIG
20902#  ifdef _sys_nsig
20903#    define NSIG (_sys_nsig) /* Solaris 2.5 */
20904#  endif
20905#endif
20906
20907/* Default to some arbitrary number that's big enough to get most
20908   of the common signals.
20909*/
20910#ifndef NSIG
20911#    define NSIG 50
20912#endif
20913
20914printf("NSIG %d\n", NSIG);
20915
20916#ifndef JUST_NSIG
20917
20918EOCP
20919
20920echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20921{
20922	printf "#ifdef SIG"; printf $1; printf "\n"
20923	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20924	printf $1; printf ");\n"
20925	printf "#endif\n"
20926}
20927END {
20928	printf "#endif /* JUST_NSIG */\n";
20929	printf "exit(0);\n}\n";
20930}
20931' >>signal.c
20932$cat >signal.awk <<'EOP'
20933BEGIN { ndups = 0 }
20934$1 ~ /^NSIG$/ { nsig = $2 }
20935($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20936    if ($2 > maxsig) { maxsig = $2 }
20937    if (sig_name[$2]) {
20938	dup_name[ndups] = $1
20939	dup_num[ndups] = $2
20940	ndups++
20941    }
20942    else {
20943	sig_name[$2] = $1
20944	sig_num[$2] = $2
20945    }
20946}
20947END {
20948    if (nsig == 0) {
20949    	nsig = maxsig + 1
20950    }
20951    printf("NSIG %d\n", nsig);
20952    for (n = 1; n < nsig; n++) {
20953 	if (sig_name[n]) {
20954 	    printf("%s %d\n", sig_name[n], sig_num[n])
20955	}
20956 	else {
20957 	    printf("NUM%d %d\n", n, n)
20958 	}
20959    }
20960    for (n = 0; n < ndups; n++) {
20961 	printf("%s %d\n", dup_name[n], dup_num[n])
20962    }
20963}
20964EOP
20965$cat >signal_cmd <<EOS
20966$startsh
20967if $test -s signal.lst; then
20968    echo "Using your existing signal.lst file"
20969	exit 0
20970fi
20971xxx="$xxx"
20972EOS
20973$cat >>signal_cmd <<'EOS'
20974
20975set signal
20976if eval $compile_ok; then
20977	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20978		$uniq | $awk -f signal.awk >signal.lst
20979else
20980	echo "(I can't seem be able to compile the whole test program)" >&4
20981	echo "(I'll try it in little pieces.)" >&4
20982	set signal -DJUST_NSIG
20983	if eval $compile_ok; then
20984		$run ./signal$_exe > signal.nsg
20985		$cat signal.nsg
20986	else
20987		echo "I can't seem to figure out how many signals you have." >&4
20988		echo "Guessing 50." >&4
20989		echo 'NSIG 50' > signal.nsg
20990	fi
20991	: Now look at all the signal names, one at a time.
20992	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20993		$cat > signal.c <<EOCP
20994#include <sys/types.h>
20995#include <signal.h>
20996#include <stdio.h>
20997int main() {
20998printf("$xx %d\n", SIG${xx});
20999return 0;
21000}
21001EOCP
21002		set signal
21003		if eval $compile; then
21004			echo "SIG${xx} found."
21005			$run ./signal$_exe  >> signal.ls1
21006		else
21007			echo "SIG${xx} NOT found."
21008		fi
21009	done
21010	if $test -s signal.ls1; then
21011		$cat signal.nsg signal.ls1 |
21012			$sort -n | $uniq | $awk -f signal.awk >signal.lst
21013	fi
21014
21015fi
21016if $test -s signal.lst; then
21017	:
21018else
21019	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21020	echo 'kill -l' >signal
21021	set X `csh -f <signal`
21022	$rm -f signal
21023	shift
21024	case $# in
21025	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21026	esac
21027	echo $@ | $tr ' ' $trnl | \
21028 	    $awk '{ printf "%s %d\n", $1, ++s; }
21029 		  END { printf "NSIG %d\n", ++s }' >signal.lst
21030fi
21031$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21032EOS
21033chmod a+x signal_cmd
21034$eunicefix signal_cmd
21035
21036: generate list of signal names
21037echo " "
21038case "$sig_name_init" in
21039'') doinit=yes ;;
21040*)  case "$sig_num_init" in
21041    ''|*,*) doinit=yes ;;
21042    esac ;;
21043esac
21044case "$doinit" in
21045yes)
21046	echo "Generating a list of signal names and numbers..." >&4
21047	. ./signal_cmd
21048 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21049 	sig_name=`$awk 'BEGIN { printf "ZERO " }
21050 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
21051 	sig_num=`$awk  'BEGIN { printf "0 " }
21052 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
21053 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
21054 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
21055 			     END	{ printf "0\n" }' signal.lst`
21056 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
21057 			     !/^NSIG/	{ printf "%d, ", $2}
21058 			     END	{ printf "0\n"}' signal.lst`
21059	;;
21060esac
21061echo "The following $sig_count signals are available:"
21062echo " "
21063echo $sig_name | $awk \
21064'BEGIN { linelen = 0 }
21065{
21066	for (i = 1; i <= NF; i++) {
21067		name = "SIG" $i " "
21068		linelen = linelen + length(name)
21069		if (linelen > 70) {
21070			printf "\n"
21071			linelen = length(name)
21072		}
21073		printf "%s", name
21074	}
21075	printf "\n"
21076}'
21077sig_size=`echo $sig_name | awk '{print NF}'`
21078$rm -f signal signal.c signal.awk signal.lst signal_cmd
21079
21080: Check size of size
21081echo " "
21082case "$sizetype" in
21083*_t) zzz="$sizetype"	;;
21084*)   zzz="filesize"	;;
21085esac
21086echo "Checking the size of $zzz..." >&4
21087cat > try.c <<EOCP
21088#include <sys/types.h>
21089#include <stdio.h>
21090#$i_stdlib I_STDLIB
21091#ifdef I_STDLIB
21092#include <stdlib.h>
21093#endif
21094int main() {
21095    printf("%d\n", (int)sizeof($sizetype));
21096    exit(0);
21097}
21098EOCP
21099set try
21100if eval $compile_ok; then
21101	yyy=`$run ./try`
21102	case "$yyy" in
21103	'')	sizesize=4
21104		echo "(I can't execute the test program--guessing $sizesize.)" >&4
21105		;;
21106	*)	sizesize=$yyy
21107		echo "Your $zzz size is $sizesize bytes."
21108		;;
21109	esac
21110else
21111	sizesize=4
21112	echo "(I can't compile the test program--guessing $sizesize.)" >&4
21113fi
21114
21115
21116: check for socklen_t
21117echo " "
21118echo "Checking to see if you have socklen_t..." >&4
21119$cat >try.c <<EOCP
21120#include <sys/types.h>
21121#$d_socket HAS_SOCKET
21122#ifdef HAS_SOCKET
21123#include <sys/socket.h>
21124#endif
21125int main() { socklen_t x = 16; }
21126EOCP
21127set try
21128if eval $compile; then
21129	val="$define"
21130	echo "You have socklen_t."
21131else
21132	val="$undef"
21133	echo "You do not have socklen_t."
21134	case "$sizetype" in
21135	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21136	esac
21137fi
21138$rm_try
21139set d_socklen_t
21140eval $setvar
21141
21142: see if this is a socks.h system
21143set socks.h i_socks
21144eval $inhdr
21145
21146: check for type of the size argument to socket calls
21147case "$d_socket" in
21148"$define")
21149	$cat <<EOM
21150
21151Checking to see what type is the last argument of accept().
21152EOM
21153	yyy=''
21154	case "$d_socklen_t" in
21155	"$define") yyy="$yyy socklen_t"
21156	esac
21157	yyy="$yyy $sizetype int long unsigned"
21158	for xxx in $yyy; do
21159		case "$socksizetype" in
21160		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21161			case "$usesocks" in
21162			"$define")
21163				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21164					echo "Your system accepts '$xxx *' for the last argument of accept()."
21165					socksizetype="$xxx"
21166				fi
21167				;;
21168			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21169					echo "Your system accepts '$xxx *' for the last argument of accept()."
21170					socksizetype="$xxx"
21171				fi
21172				;;
21173			esac
21174			;;
21175		esac
21176	done
21177: In case none of those worked, prompt the user.
21178	case "$socksizetype" in
21179	'')	rp='What is the type for socket address structure sizes?'
21180		dflt='int'
21181		. ./myread
21182		socksizetype=$ans
21183		;;
21184	esac
21185	;;
21186*)	: no sockets, so pick relatively harmless default
21187	socksizetype='int'
21188	;;
21189esac
21190
21191: see what type is used for signed size_t
21192set ssize_t ssizetype int stdio.h sys/types.h
21193eval $typedef
21194dflt="$ssizetype"
21195$cat > try.c <<EOM
21196#include <stdio.h>
21197#$i_stdlib I_STDLIB
21198#ifdef I_STDLIB
21199#include <stdlib.h>
21200#endif
21201#include <sys/types.h>
21202#define Size_t $sizetype
21203#define SSize_t $dflt
21204int main()
21205{
21206	if (sizeof(Size_t) == sizeof(SSize_t))
21207		printf("$dflt\n");
21208	else if (sizeof(Size_t) == sizeof(int))
21209		printf("int\n");
21210	else
21211		printf("long\n");
21212	exit(0);
21213}
21214EOM
21215echo " "
21216set try
21217if eval $compile_ok && $run ./try > /dev/null; then
21218	ssizetype=`$run ./try`
21219	echo "I'll be using $ssizetype for functions returning a byte count." >&4
21220else
21221	$cat >&4 <<EOM
21222Help! I can't compile and run the ssize_t test program: please enlighten me!
21223(This is probably a misconfiguration in your system or libraries, and
21224you really ought to fix it.  Still, I'll try anyway.)
21225
21226I need a type that is the same size as $sizetype, but is guaranteed to
21227be signed.  Common values are ssize_t, int and long.
21228
21229EOM
21230	rp="What signed type is the same size as $sizetype?"
21231	. ./myread
21232	ssizetype="$ans"
21233fi
21234$rm_try
21235
21236: Check the size of st_ino
21237$echo " "
21238$echo "Checking the size of st_ino..." >&4
21239$cat > try.c <<EOCP
21240#include <sys/stat.h>
21241#include <stdio.h>
21242#$i_stdlib I_STDLIB
21243#ifdef I_STDLIB
21244#include <stdlib.h>
21245#endif
21246int main() {
21247    struct stat st;
21248    printf("%d\n", (int)sizeof(st.st_ino));
21249    exit(0);
21250}
21251EOCP
21252set try
21253if eval $compile_ok; then
21254	val=`$run ./try`
21255	case "$val" in
21256	'')	st_ino_size=4
21257		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21258		;;
21259	*)	st_ino_size=$val
21260		$echo "Your st_ino is $st_ino_size bytes long."
21261		;;
21262	esac
21263else
21264	st_ino_size=4
21265	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21266fi
21267$rm_try
21268
21269: Check if st_ino is signed
21270$echo " "
21271$echo "Checking the sign of st_ino..." >&4
21272$cat > try.c <<EOCP
21273#include <sys/stat.h>
21274#include <stdio.h>
21275int main() {
21276	struct stat foo;
21277        foo.st_ino = -1;
21278	if (foo.st_ino < 0)
21279		printf("-1\n");
21280	else
21281		printf("1\n");
21282}
21283EOCP
21284set try
21285if eval $compile; then
21286	val=`$run ./try`
21287	case "$val" in
21288	'')	st_ino_sign=1
21289		$echo "(I can't execute the test program--guessing unsigned.)" >&4
21290		;;
21291	*)	st_ino_sign=$val
21292		case "$st_ino_sign" in
21293		 1) $echo "Your st_ino is unsigned." ;;
21294		-1) $echo "Your st_ino is signed."   ;;
21295		esac
21296		;;
21297	esac
21298else
21299	st_ino_sign=1
21300	$echo "(I can't compile the test program--guessing unsigned.)" >&4
21301fi
21302$rm_try
21303
21304: see what type of char stdio uses.
21305echo " "
21306echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21307if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21308	echo "Your stdio uses unsigned chars." >&4
21309	stdchar="unsigned char"
21310else
21311	echo "Your stdio uses signed chars." >&4
21312	stdchar="char"
21313fi
21314$rm -f stdioh
21315
21316: see what type uids are declared as in the kernel
21317echo " "
21318echo "Looking for the type for user ids returned by getuid()."
21319set uid_t uidtype xxx stdio.h sys/types.h
21320eval $typedef
21321case "$uidtype" in
21322xxx)
21323	xxx=`./findhdr sys/user.h`
21324	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21325	case $1 in
21326	unsigned) dflt="$1 $2" ;;
21327	*) dflt="$1" ;;
21328	esac
21329	;;
21330*) dflt="$uidtype";;
21331esac
21332case "$uidtype" in
21333uid_t)	echo "uid_t found." ;;
21334*)	rp="What is the type for user ids returned by getuid()?"
21335	. ./myread
21336	uidtype="$ans"
21337	;;
21338esac
21339
21340: Check size of UID
21341echo " "
21342case "$uidtype" in
21343*_t) zzz="$uidtype"	;;
21344*)   zzz="uid"		;;
21345esac
21346echo "Checking the size of $zzz..." >&4
21347cat > try.c <<EOCP
21348#include <sys/types.h>
21349#include <stdio.h>
21350#$i_stdlib I_STDLIB
21351#ifdef I_STDLIB
21352#include <stdlib.h>
21353#endif
21354int main() {
21355    printf("%d\n", (int)sizeof($uidtype));
21356    exit(0);
21357}
21358EOCP
21359set try
21360if eval $compile_ok; then
21361	yyy=`$run ./try`
21362	case "$yyy" in
21363	'')	uidsize=4
21364		echo "(I can't execute the test program--guessing $uidsize.)" >&4
21365		;;
21366	*)	uidsize=$yyy
21367		echo "Your $zzz is $uidsize bytes long."
21368		;;
21369	esac
21370else
21371	uidsize=4
21372	echo "(I can't compile the test program--guessing $uidsize.)" >&4
21373fi
21374
21375: Check if UID is signed
21376echo " "
21377case "$uidtype" in
21378*_t) zzz="$uidtype"	;;
21379*)   zzz="uid"		;;
21380esac
21381echo "Checking the sign of $zzz..." >&4
21382cat > try.c <<EOCP
21383#include <sys/types.h>
21384#include <stdio.h>
21385int main() {
21386	$uidtype foo = -1;
21387	if (foo < 0)
21388		printf("-1\n");
21389	else
21390		printf("1\n");
21391}
21392EOCP
21393set try
21394if eval $compile; then
21395	yyy=`$run ./try`
21396	case "$yyy" in
21397	'')	uidsign=1
21398		echo "(I can't execute the test program--guessing unsigned.)" >&4
21399		;;
21400	*)	uidsign=$yyy
21401		case "$uidsign" in
21402		 1) echo "Your $zzz is unsigned." ;;
21403		-1) echo "Your $zzz is signed."   ;;
21404		esac
21405		;;
21406	esac
21407else
21408	uidsign=1
21409	echo "(I can't compile the test program--guessing unsigned.)" >&4
21410fi
21411
21412
21413: Check format string for UID
21414echo " "
21415$echo "Checking the format string to be used for uids..." >&4
21416
21417case "$uidsign" in
21418-1)	if $test X"$uidsize" = X"$ivsize"; then
21419		uidformat="$ivdformat"
21420	else
21421		if $test X"$uidsize" = X"$longsize"; then
21422			uidformat='"ld"'
21423		else
21424			if $test X"$uidsize" = X"$intsize"; then
21425				uidformat='"d"'
21426			else
21427				if $test X"$uidsize" = X"$shortsize"; then
21428					uidformat='"hd"'
21429				fi
21430			fi
21431		fi
21432	fi
21433	;;
21434*)	if $test X"$uidsize" = X"$uvsize"; then
21435		uidformat="$uvuformat"
21436	else
21437		if $test X"$uidsize" = X"$longsize"; then
21438			uidformat='"lu"'
21439		else
21440			if $test X"$uidsize" = X"$intsize"; then
21441				uidformat='"u"'
21442			else
21443				if $test X"$uidsize" = X"$shortsize"; then
21444					uidformat='"hu"'
21445				fi
21446			fi
21447		fi
21448	fi
21449	;;
21450esac
21451
21452: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21453echo " "
21454echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21455$cat >try.c <<'EOM'
21456/* Intentionally a long probe as I'd like to sanity check that the exact
21457   approach is going to work, as thinking it will work, but only having it
21458   part working at runtime is worse than not having it.  */
21459
21460#include <sys/types.h>
21461#include <sys/sysctl.h>
21462#include <sys/param.h>
21463#include <stdio.h>
21464#include <string.h>
21465#include <stdlib.h>
21466#include <unistd.h>
21467
21468int
21469main(int argc, char **argv) {
21470    char *buffer;
21471    char *argv_leaf = strrchr(argv[0], '/');
21472    char *buffer_leaf;
21473    size_t size = 0;
21474    int mib[4];
21475
21476    mib[0] = CTL_KERN;
21477    mib[1] = KERN_PROC;
21478    mib[2] = KERN_PROC_PATHNAME;
21479    mib[3] = -1;
21480
21481    if (!argv_leaf) {
21482	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21483	return 1;
21484    }
21485
21486    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21487	perror("sysctl");
21488	return 2;
21489    }
21490
21491    if (size < strlen(argv_leaf) + 1) {
21492	fprintf(stderr, "size %lu is too short for a path\n",
21493		(unsigned long) size);
21494	return 3;
21495    }
21496
21497    if (size > MAXPATHLEN * MAXPATHLEN) {
21498	fprintf(stderr, "size %lu is too long for a path\n",
21499		(unsigned long) size);
21500	return 4;
21501    }
21502
21503    buffer = malloc(size);
21504    if (!buffer) {
21505	perror("malloc");
21506	return 5;
21507    }
21508
21509    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21510	perror("sysctl");
21511	return 6;
21512    }
21513
21514    if (strlen(buffer) + 1 != size) {
21515	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21516		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
21517        return 7;
21518    }
21519
21520
21521    if (*buffer != '/') {
21522	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21523	return 8;
21524    }
21525
21526    if (strstr(buffer, "/./")) {
21527	fprintf(stderr, "Contains /./: '%s'\n", buffer);
21528	return 9;
21529    }
21530
21531    if (strstr(buffer, "/../")) {
21532	fprintf(stderr, "Contains /../: '%s'\n", buffer);
21533	return 10;
21534    }
21535
21536    buffer_leaf = strrchr(buffer, '/');
21537    if (strcmp(buffer_leaf, argv_leaf) != 0) {
21538	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21539	return 11;
21540    }
21541
21542    free(buffer);
21543
21544    return 0;
21545}
21546EOM
21547
21548val=$undef
21549set try
21550if eval $compile_ok; then
21551	if $run ./try; then
21552		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21553		val="$define"
21554	else
21555		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21556		val="$undef"
21557	fi
21558else
21559	echo "I'm unable to compile the test program." >&4
21560	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21561	val="$undef"
21562fi
21563$rm_try
21564set usekernprocpathname
21565eval $setvar
21566
21567: Determine if we can use _NSGetExecutablePath to find executing program
21568echo " "
21569echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21570$cat >try.c <<'EOM'
21571/* Intentionally a long probe as I'd like to sanity check that the exact
21572   approach is going to work, as thinking it will work, but only having it
21573   part working at runtime is worse than not having it.  */
21574#include <mach-o/dyld.h>
21575#include <stdio.h>
21576#include <stdlib.h>
21577#include <sys/param.h>
21578#include <string.h>
21579
21580int
21581main(int argc, char **argv) {
21582    char buf[1];
21583    uint32_t size = sizeof(buf);
21584    int result;
21585    char *buffer;
21586    char *tidied;
21587    char *argv_leaf = strrchr(argv[0], '/');
21588    char *tidied_leaf;
21589
21590    if (!argv_leaf) {
21591	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21592	return 1;
21593    }
21594
21595    _NSGetExecutablePath(buf, &size);
21596    if (size > MAXPATHLEN * MAXPATHLEN) {
21597	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21598		(unsigned int) size);
21599	return 2;
21600    }
21601
21602    buffer = malloc(size);
21603    if (!buffer) {
21604	perror("malloc");
21605	return 3;
21606    }
21607
21608    result = _NSGetExecutablePath(buffer, &size);
21609    if (result != 0) {
21610	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21611		result, (unsigned int) size);
21612	return 4;
21613    }
21614
21615    tidied = realpath(buffer, NULL);
21616    if (!tidied) {
21617	perror("realpath");
21618	return 5;
21619    }
21620
21621    free(buffer);
21622
21623    if (*tidied != '/') {
21624	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21625	return 6;
21626    }
21627
21628    if (strstr(tidied, "/./")) {
21629	fprintf(stderr, "Contains /./: '%s'\n", tidied);
21630	return 7;
21631    }
21632
21633    if (strstr(tidied, "/../")) {
21634	fprintf(stderr, "Contains /../: '%s'\n", tidied);
21635	return 8;
21636    }
21637
21638    tidied_leaf = strrchr(tidied, '/');
21639    if (strcmp(tidied_leaf, argv_leaf) != 0) {
21640	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21641	return 9;
21642    }
21643
21644    free(tidied);
21645
21646    return 0;
21647}
21648EOM
21649
21650val=$undef
21651set try
21652if eval $compile_ok; then
21653	if $run ./try; then
21654		echo "You can use _NSGetExecutablePath to find the executing program." >&4
21655		val="$define"
21656	else
21657		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21658	fi
21659else
21660	echo "I'm unable to compile the test program." >&4
21661	echo "I'll assume no _NSGetExecutablePath here." >&4
21662fi
21663$rm_try
21664set usensgetexecutablepath
21665eval $setvar
21666
21667: Check if site customization support was requested
21668case "$usesitecustomize" in
21669    $define|true|[Yy]*)
21670	usesitecustomize="$define"
21671	;;
21672    *)
21673	usesitecustomize="$undef"
21674	;;
21675    esac
21676
21677: see if prototypes support variable argument declarations
21678echo " "
21679case "$prototype$i_stdarg" in
21680$define$define)
21681	echo "It appears we'll be able to prototype varargs functions." >&4
21682	val="$define"
21683	;;
21684*)
21685	echo "Too bad... We won't be using prototyped varargs functions..." >&4
21686	val="$undef"
21687	;;
21688esac
21689set vaproto
21690eval $setvar
21691
21692: determine compiler compiler
21693case "$yacc" in
21694'')
21695	dflt=yacc;;
21696*)
21697	dflt="$yacc";;
21698esac
21699echo " "
21700comp='yacc'
21701if $test -f "$byacc$_exe"; then
21702	dflt="$byacc"
21703	comp="byacc or $comp"
21704fi
21705if $test -f "$bison$_exe"; then
21706	comp="$comp or bison -y"
21707fi
21708rp="Which compiler compiler ($comp) shall I use?"
21709. ./myread
21710yacc="$ans"
21711case "$yacc" in
21712*bis*)
21713	case "$yacc" in
21714	*-y*) ;;
21715	*)
21716		yacc="$yacc -y"
21717		echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21718		;;
21719	esac
21720	;;
21721esac
21722
21723: see if this is a assert.h system
21724set assert.h i_assert
21725eval $inhdr
21726
21727: see if this is a fp.h system
21728set fp.h i_fp
21729eval $inhdr
21730
21731: see if this is a fp_class.h system
21732set fp_class.h i_fp_class
21733eval $inhdr
21734
21735: see if gdbm.h is available
21736set gdbm.h t_gdbm
21737eval $inhdr
21738case "$t_gdbm" in
21739$define)
21740	: see if gdbm_open exists
21741	set gdbm_open d_gdbm_open
21742	eval $inlibc
21743	case "$d_gdbm_open" in
21744	$undef)
21745		t_gdbm="$undef"
21746		echo "We won't be including <gdbm.h>"
21747		;;
21748	esac
21749	;;
21750esac
21751val="$t_gdbm"
21752set i_gdbm
21753eval $setvar
21754
21755: see if this is a ieeefp.h system
21756case "$i_ieeefp" in
21757'' ) set ieeefp.h i_ieeefp
21758     eval $inhdr
21759     ;;
21760esac
21761
21762: see if this is a libutil.h system
21763set libutil.h i_libutil
21764eval $inhdr
21765
21766: see if mach cthreads are available
21767if test "X$usethreads" = "X$define"; then
21768	set mach/cthreads.h i_machcthr
21769	eval $inhdr
21770else
21771	i_machcthr="$undef"
21772fi
21773
21774: see if this is a mntent.h system
21775set mntent.h i_mntent
21776eval $inhdr
21777
21778: see if net/errno.h is available
21779val=''
21780set net/errno.h val
21781eval $inhdr
21782
21783: Unfortunately, it causes problems on some systems.  Arrgh.
21784case "$val" in
21785$define)
21786	cat > try.c <<'EOM'
21787#include <stdio.h>
21788#include <errno.h>
21789#include <net/errno.h>
21790int func()
21791{
21792	return ENOTSOCK;
21793}
21794EOM
21795	if $cc $ccflags -c try.c >/dev/null 2>&1; then
21796		echo "We'll be including <net/errno.h>." >&4
21797	else
21798		echo "We won't be including <net/errno.h>." >&4
21799		val="$undef"
21800	fi
21801	$rm_try
21802	;;
21803esac
21804set i_neterrno
21805eval $setvar
21806
21807: see if netinet/tcp.h is available
21808set netinet/tcp.h i_netinettcp
21809eval $inhdr
21810
21811: see if this is a poll.h system
21812set poll.h i_poll
21813eval $inhdr
21814
21815: see if this is a prot.h system
21816set prot.h i_prot
21817eval $inhdr
21818
21819: Preprocessor symbols
21820echo " "
21821$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21822$cat <<'EOSH' > Cppsym.know
21823a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21824AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21825alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21826ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21827BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21828BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21829bull c cadmus clipper CMU COFF COMPILER_VERSION
21830concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21831CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21832Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21833FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21834GLIBC GLIBC_MINOR
21835GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21836H3050R H3050RX hbullx20 hcx host_mips
21837hp200 hp300 hp700 HP700 hp800 hp9000
21838hp9000s200 hp9000s300 hp9000s400 hp9000s500
21839hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21840i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21841IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21842INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21843LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21844LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21845LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21846LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21847M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21848M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21849M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21850MATH_HAS_NO_SIDE_EFFECTS
21851mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21852mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21853mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21854MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21855mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21856NetBSD news1500 news1700 news1800 news1900 news3700
21857news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21858ns32016 ns32332 ns32k nsc32000
21859OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21860pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21861pc532 pdp11 PGC PIC plexus PORTAR posix
21862POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21863POSIX_C_SOURCE POSIX_SOURCE POWER
21864PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21865riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21866SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21867sony sony_news sonyrisc sparc sparclite spectrum
21868stardent stdc STDC_EXT stratos sun sun3 sun386
21869Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21870SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21871SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21872sysV68 sysV88 Tek4132 Tek4300 titan
21873TM3200 TM5400 TM5600
21874tower tower32 tower32_200 tower32_600 tower32_700
21875tower32_800 tower32_850 tss
21876u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21877ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21878unix UNIX95 UNIX99 unixpc unos
21879USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21880USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21881USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21882USGr4 USGr4_2
21883Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21884XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21885XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21886z8000
21887EOSH
21888# Maybe put other stuff here too.
21889cat <<EOSH >>Cppsym.know
21890$osname
21891EOSH
21892./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21893./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21894$cat Cppsym.know > Cppsym.c
21895$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21896$rm -f Cppsym.a Cppsym.b Cppsym.c
21897cat <<EOSH > Cppsym
21898$startsh
21899if $test \$# -gt 0; then
21900    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21901    if $test -s Cppsym.got; then
21902        $rm -f Cppsym.got
21903        exit 0
21904    fi
21905    $rm -f Cppsym.got
21906    exit 1
21907else
21908    $tr " " "$trnl" | ./Cppsym.try
21909    exit 0
21910fi
21911EOSH
21912chmod +x Cppsym
21913$eunicefix Cppsym
21914cat <<EOSH > Cppsym.try
21915$startsh
21916cat <<'EOCP' > try.c
21917#include <stdio.h>
21918#if cpp_stuff == 1
21919#define STRINGIFY(a)    "a"
21920#endif
21921#if cpp_stuff == 42
21922#define StGiFy(a)  #a
21923#define STRINGIFY(a)    StGiFy(a)
21924#endif
21925#if $cpp_stuff != 1 && $cpp_stuff != 42
21926#   include "Bletch: How does this C preprocessor stringify macros?"
21927#endif
21928int main() {
21929EOCP
21930$awk \\
21931EOSH
21932cat <<'EOSH' >> Cppsym.try
21933'length($1) > 0 {
21934    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21935    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21936    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21937    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21938}'	 >> try.c
21939echo 'return 0;}' >> try.c
21940EOSH
21941cat <<EOSH >> Cppsym.try
21942ccflags="$ccflags"
21943case "$osname-$gccversion" in
21944irix-) ccflags="\$ccflags -woff 1178" ;;
21945os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21946esac
21947$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21948EOSH
21949chmod +x Cppsym.try
21950$eunicefix Cppsym.try
21951./Cppsym < Cppsym.know > Cppsym.true
21952: Add in any linux cpp "predefined macros":
21953case "$osname::$gccversion" in
21954  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21955    tHdrH=_tmpHdr
21956    rm -f $tHdrH'.h' $tHdrH
21957    touch $tHdrH'.h'
21958    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21959       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21960       if [ -s $tHdrH'_cppsym.real' ]; then
21961	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21962       fi
21963    fi
21964    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21965  ;;
21966esac
21967: now check the C compiler for additional symbols
21968postprocess_cc_v=''
21969case "$osname" in
21970aix) postprocess_cc_v="|$tr , ' '" ;;
21971esac
21972$cat >ccsym <<EOS
21973$startsh
21974$cat >tmp.c <<EOF
21975extern int foo;
21976EOF
21977for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21978do
21979	case "\$i" in
21980	-D*) echo "\$i" | $sed 's/^-D//';;
21981	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21982	esac
21983done
21984$rm_try
21985EOS
21986postprocess_cc_v=''
21987chmod +x ccsym
21988$eunicefix ccsym
21989./ccsym > ccsym1.raw
21990if $test -s ccsym1.raw; then
21991       $sort ccsym1.raw | $uniq >ccsym.raw
21992else
21993       mv ccsym1.raw ccsym.raw
21994fi
21995
21996$awk '/\=/ { print $0; next }
21997	{ print $0"=1" }' ccsym.raw >ccsym.list
21998$comm -13 Cppsym.true ccsym.list >ccsym.own
21999$comm -12 Cppsym.true ccsym.list >ccsym.com
22000$comm -23 Cppsym.true ccsym.list >ccsym.cpp
22001also=''
22002if $test -z ccsym.raw; then
22003	echo "Your C compiler doesn't seem to define any symbols!" >&4
22004	echo " "
22005	echo "However, your C preprocessor defines the following symbols:"
22006	$cat Cppsym.true
22007    	ccsymbols=''
22008	cppsymbols=`$cat Cppsym.true`
22009        cppsymbols=`echo $cppsymbols`
22010	cppccsymbols="$cppsymbols"
22011else
22012	if $test -s ccsym.com; then
22013		echo "Your C compiler and pre-processor define these symbols:"
22014		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
22015		also='also '
22016		symbols='ones'
22017		cppccsymbols=`$cat ccsym.com`
22018		cppccsymbols=`echo $cppccsymbols`
22019		$test "$silent" || sleep 1
22020	fi
22021	if $test -s ccsym.cpp; then
22022		$test "$also" && echo " "
22023		echo "Your C pre-processor ${also}defines the following symbols:"
22024		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22025		also='further '
22026		cppsymbols=`$cat ccsym.cpp`
22027		cppsymbols=`echo $cppsymbols`
22028		$test "$silent" || sleep 1
22029	fi
22030	if $test -s ccsym.own; then
22031		$test "$also" && echo " "
22032		echo "Your C compiler ${also}defines the following cpp symbols:"
22033		$sed -e 's/\(..*\)=1/\1/' ccsym.own
22034		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22035	        ccsymbols=`$cat ccsym.own`
22036	        ccsymbols=`echo $ccsymbols`
22037		$test "$silent" || sleep 1
22038	fi
22039fi
22040
22041: see if this is a termio system
22042val="$undef"
22043val2="$undef"
22044val3="$undef"
22045if $test `./findhdr termios.h`; then
22046	set tcsetattr i_termios
22047	eval $inlibc
22048	val3="$i_termios"
22049fi
22050echo " "
22051case "$val3" in
22052"$define") echo "You have POSIX termios.h... good!" >&4;;
22053*) if ./Cppsym pyr; then
22054		case "`/bin/universe`" in
22055		ucb) if $test `./findhdr sgtty.h`; then
22056				val2="$define"
22057				echo "<sgtty.h> found." >&4
22058			else
22059				echo "System is pyramid with BSD universe."
22060				./warn "<sgtty.h> not found--you could have problems."
22061			fi;;
22062		*) if $test `./findhdr termio.h`; then
22063				val="$define"
22064				echo "<termio.h> found." >&4
22065			else
22066				echo "System is pyramid with USG universe."
22067				./warn "<termio.h> not found--you could have problems."
22068			fi;;
22069		esac
22070	elif ./usg; then
22071		if $test `./findhdr termio.h`; then
22072			echo "<termio.h> found." >&4
22073			val="$define"
22074		elif $test `./findhdr sgtty.h`; then
22075			echo "<sgtty.h> found." >&4
22076			val2="$define"
22077		else
22078			./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22079		fi
22080	else
22081		if $test `./findhdr sgtty.h`; then
22082			echo "<sgtty.h> found." >&4
22083			val2="$define"
22084		elif $test `./findhdr termio.h`; then
22085			echo "<termio.h> found." >&4
22086			val="$define"
22087		else
22088			./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22089		fi
22090	fi;;
22091esac
22092set i_termio; eval $setvar
22093val=$val2; set i_sgtty; eval $setvar
22094val=$val3; set i_termios; eval $setvar
22095
22096: see if stdbool is available
22097: we want a real compile instead of Inhdr because some Solaris systems
22098: have stdbool.h, but it can only be used if the compiler indicates it
22099: is sufficiently c99-compliant.
22100echo " "
22101$cat >try.c <<EOCP
22102#include <stdio.h>
22103#include <stdbool.h>
22104int func(bool x)
22105{
22106    return x ? 1 : 0;
22107}
22108int main(int argc, char **argv)
22109{
22110    return func(0);
22111}
22112EOCP
22113set try
22114if eval $compile; then
22115	echo "<stdbool.h> found." >&4
22116	val="$define"
22117else
22118	echo "<stdbool.h> NOT found." >&4
22119	val="$undef"
22120fi
22121$rm_try
22122set i_stdbool
22123eval $setvar
22124
22125: see if stddef is available
22126set stddef.h i_stddef
22127eval $inhdr
22128
22129: see if sys/access.h is available
22130set sys/access.h i_sysaccess
22131eval $inhdr
22132
22133: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22134set sys/filio.h i_sysfilio
22135eval $inhdr
22136echo " "
22137if $test `./findhdr sys/ioctl.h`; then
22138	val="$define"
22139	echo '<sys/ioctl.h> found.' >&4
22140else
22141	val="$undef"
22142	if $test $i_sysfilio = "$define"; then
22143	    echo '<sys/ioctl.h> NOT found.' >&4
22144	else
22145		$test $i_sgtty = "$define" && xxx="sgtty.h"
22146		$test $i_termio = "$define" && xxx="termio.h"
22147		$test $i_termios = "$define" && xxx="termios.h"
22148echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22149	fi
22150fi
22151set i_sysioctl
22152eval $setvar
22153
22154: see if socket ioctl defs are in sys/sockio.h
22155echo " "
22156xxx=`./findhdr sys/sockio.h`
22157if $test "$xxx"; then
22158	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22159		val="$define"
22160		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22161	else
22162		val="$undef"
22163		echo "No socket ioctls found in <sys/sockio.h>." >&4
22164	fi
22165else
22166	val="$undef"
22167	$cat <<EOM
22168<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22169EOM
22170fi
22171set i_syssockio
22172eval $setvar
22173
22174: see if this is a syslog.h system
22175set syslog.h i_syslog
22176eval $inhdr
22177
22178: see if this is a sys/mode.h system
22179set sys/mode.h i_sysmode
22180eval $inhdr
22181
22182: see if there is a sys/poll.h file
22183set sys/poll.h i_syspoll
22184eval $inhdr
22185
22186: see if sys/resource.h has to be included
22187set sys/resource.h i_sysresrc
22188eval $inhdr
22189
22190: see if sys/security.h is available
22191set sys/security.h i_syssecrt
22192eval $inhdr
22193
22194: see if this is a sys/statvfs.h system
22195set sys/statvfs.h i_sysstatvfs
22196eval $inhdr
22197
22198: see if this is a sys/un.h system
22199set sys/un.h i_sysun
22200eval $inhdr
22201
22202: see if this is a sys/utsname.h system
22203set sys/utsname.h i_sysutsname
22204eval $inhdr
22205
22206: see if this is a syswait system
22207set sys/wait.h i_syswait
22208eval $inhdr
22209
22210: see if this is a ustat.h system
22211set ustat.h i_ustat
22212eval $inhdr
22213
22214: see if this is an utime system
22215set utime.h i_utime
22216eval $inhdr
22217
22218: see if this is a vfork system
22219case "$d_vfork" in
22220"$define")
22221	set vfork.h i_vfork
22222	eval $inhdr
22223	;;
22224*)
22225	i_vfork="$undef"
22226	;;
22227esac
22228
22229: Check extensions
22230echo " "
22231echo "Looking for extensions..." >&4
22232: If we are using the old config.sh, known_extensions may contain
22233: old or inaccurate or duplicate values.
22234known_extensions=''
22235nonxs_extensions=''
22236: We do not use find because it might not be available.
22237: We do not just use MANIFEST because the user may have dropped
22238: some additional extensions into the source tree and expect them
22239: to be built.
22240
22241: Function to recursively find available extensions, ignoring DynaLoader
22242: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22243: In 5.10.1 and later, extensions are stored in directories
22244: like File-Glob instead of the older File/Glob/.
22245find_extensions='
22246    for xxx in *; do
22247	case "$xxx" in
22248	    CVS) ;;
22249	    DynaLoader|dynaload) ;;
22250	    *)
22251	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22252	    leaf=`echo $xxx | $sed -e s/.*-//`;
22253	    if $test -d File; then
22254		if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22255		    known_extensions="$known_extensions $1$this_ext";
22256		elif $test -f $xxx/Makefile.PL; then
22257		    nonxs_extensions="$nonxs_extensions $1$this_ext";
22258		else
22259		    if $test -d $xxx -a $# -lt 10; then
22260			set $1$xxx/ $*;
22261			cd "$xxx";
22262			eval $find_extensions;
22263			cd ..;
22264			shift;
22265		    fi;
22266		fi;
22267	    else
22268		echo " $known_extensions $nonxs_extensions" > $$.tmp;
22269		if $contains " $this_ext " $$.tmp; then
22270		    echo >&4;
22271		    echo "Duplicate directories detected for extension $xxx" >&4;
22272		    echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22273		    case "$knowitall" in
22274		    "") dflt=y;;
22275		    *) dflt=n;;
22276		    esac;
22277		    . ../UU/myread;
22278		    case "$ans" in
22279		    n*|N*) ;;
22280		    *) echo >&4;
22281		       echo "Ok.  Stopping Configure." >&4;
22282		       echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22283			exit 1;;
22284		    esac;
22285		    echo "Ok.  You will need to correct config.sh before running make." >&4;
22286		fi;
22287		$ls -1 $xxx > $$.tmp;
22288		if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22289		    known_extensions="$known_extensions $this_ext";
22290		elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22291		    known_extensions="$known_extensions $this_ext";
22292		elif $test -d $xxx; then
22293		    nonxs_extensions="$nonxs_extensions $this_ext";
22294		fi;
22295		$rm -f $$.tmp;
22296	    fi
22297	    ;;
22298	esac;
22299    done'
22300tdir=`pwd`
22301cd "$rsrc/cpan"
22302set X
22303shift
22304eval $find_extensions
22305cd "$rsrc/dist"
22306set X
22307shift
22308eval $find_extensions
22309cd "$rsrc/ext"
22310set X
22311shift
22312eval $find_extensions
22313if $test -d File-Glob; then
22314    : All ext/ flattened
22315else
22316    # Special case:  Add in modules that nest beyond the first level.
22317    # Currently threads/shared and Hash/Util/FieldHash, since they are
22318    # not picked up by the recursive find above (and adding in general
22319    # recursive finding breaks SDBM_File/sdbm).
22320    # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22321    known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22322fi
22323set X $known_extensions
22324shift
22325known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22326set X $nonxs_extensions
22327shift
22328nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22329cd "$tdir"
22330
22331: Now see which are supported on this system.
22332avail_ext=''
22333for xxx in $known_extensions ; do
22334	case "$xxx" in
22335	DB_File|db_file)
22336		case "$i_db" in
22337		$define) avail_ext="$avail_ext $xxx" ;;
22338		esac
22339		;;
22340	GDBM_File|gdbm_fil)
22341		case "$i_gdbm" in
22342		$define) avail_ext="$avail_ext $xxx" ;;
22343		esac
22344		;;
22345	I18N/Langinfo|i18n_lan)
22346		case "$i_langinfo$d_nl_langinfo" in
22347		$define$define) avail_ext="$avail_ext $xxx" ;;
22348		esac
22349		;;
22350	IPC/SysV|ipc/sysv)
22351		: XXX Do we need a useipcsysv variable here
22352		case "${d_msg}${d_sem}${d_shm}" in
22353		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
22354		esac
22355		;;
22356	NDBM_File|ndbm_fil)
22357		case "$d_ndbm" in
22358		$define)
22359		    case "$osname-$use64bitint" in
22360		    hpux-define)
22361			case "$libs" in
22362			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
22363			esac
22364			;;
22365		    *) avail_ext="$avail_ext $xxx" ;;
22366		    esac
22367		    ;;
22368		esac
22369		;;
22370	ODBM_File|odbm_fil)
22371		case "${i_dbm}${i_rpcsvcdbm}" in
22372		*"${define}"*)
22373		    case "$d_cplusplus" in
22374		    define) ;; # delete as a function name will not work
22375		    *)  case "$osname-$use64bitint" in
22376			hpux-define)
22377			    case "$libs" in
22378			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22379			    esac
22380			    ;;
22381			*) avail_ext="$avail_ext $xxx" ;;
22382			esac
22383			;;
22384		    esac
22385		    ;;
22386		esac
22387		;;
22388	Opcode|opcode)
22389		case "$useopcode" in
22390		true|define|y) avail_ext="$avail_ext $xxx" ;;
22391		esac
22392		;;
22393	POSIX|posix)
22394		case "$useposix" in
22395		true|define|y) avail_ext="$avail_ext $xxx" ;;
22396		esac
22397		;;
22398	Socket|socket)
22399		case "$d_socket" in
22400		true|$define|y)
22401		    case "$osname" in
22402		    beos) ;; # not unless BONE
22403		    *) avail_ext="$avail_ext $xxx" ;;
22404		    esac
22405		    ;;
22406		esac
22407		;;
22408	Sys/Syslog|sys/syslog)
22409		: XXX syslog requires socket
22410		case "$d_socket" in
22411		true|$define|y) avail_ext="$avail_ext $xxx" ;;
22412		esac
22413		;;
22414	Thread|thread)
22415                case "$usethreads" in
22416                true|$define|y)
22417                        case "$use5005threads" in
22418                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22419                        esac
22420		esac
22421		;;
22422	threads|threads/shared)
22423		# threads and threads::shared are special cases.
22424		# To stop people from asking "Perl 5.8.0 was supposed
22425		# to have this new fancy threads implementation but my
22426		# perl doesn't have it" and from people trying to
22427		# (re)install the threads module using CPAN.pm and
22428		# CPAN.pm then offering to reinstall Perl 5.8.0,
22429		# the threads.pm and threads/shared.pm will always be
22430		# there, croaking informatively ("you need to rebuild
22431		# all of Perl with threads, sorry") when threads haven't
22432		# been compiled in.
22433		# --jhi
22434		avail_ext="$avail_ext $xxx"
22435		;;
22436	VMS*)
22437		;;
22438	Win32*)
22439		case "$osname" in
22440		cygwin) avail_ext="$avail_ext $xxx" ;;
22441		esac
22442		;;
22443	XS/APItest|xs/apitest)
22444		# This is just for testing.  Skip it unless we have dynamic loading.
22445
22446		case "$usedl" in
22447		$define) avail_ext="$avail_ext $xxx" ;;
22448		esac
22449		;;
22450	XS/Typemap|xs/typemap)
22451		# This is just for testing.  Skip it unless we have dynamic loading.
22452		case "$usedl" in
22453		$define) avail_ext="$avail_ext $xxx" ;;
22454		esac
22455		;;
22456	*)	avail_ext="$avail_ext $xxx"
22457		;;
22458	esac
22459done
22460
22461set X $avail_ext
22462shift
22463avail_ext="$*"
22464
22465case "$onlyextensions" in
22466'') ;;
22467*)  keepextensions=''
22468    echo "You have requested that only certain extensions be included..." >&4
22469    for i in $onlyextensions; do
22470        case " $avail_ext " in
22471        *" $i "*)
22472            echo "Keeping extension $i."
22473            keepextensions="$keepextensions $i"
22474            ;;
22475        *) echo "Ignoring extension $i." ;;
22476        esac
22477    done
22478    avail_ext="$keepextensions"
22479    ;;
22480esac
22481
22482case "$noextensions" in
22483'') ;;
22484*)  keepextensions=''
22485    echo "You have requested that certain extensions be ignored..." >&4
22486    for i in $avail_ext; do
22487        case " $noextensions " in
22488        *" $i "*) echo "Ignoring extension $i." ;;
22489        *) echo "Keeping extension $i.";
22490           keepextensions="$keepextensions $i"
22491           ;;
22492        esac
22493    done
22494    avail_ext="$keepextensions"
22495    ;;
22496esac
22497
22498: Now see which nonxs extensions are supported on this system.
22499: For now assume all are.
22500nonxs_ext=''
22501for xxx in $nonxs_extensions ; do
22502	case "$xxx" in
22503	CVS|RCS|SCCS|.svn)
22504		;;
22505	*)	nonxs_ext="$nonxs_ext $xxx"
22506		;;
22507	esac
22508done
22509
22510set X $nonxs_ext
22511shift
22512nonxs_ext="$*"
22513
22514case $usedl in
22515$define)
22516	$cat <<EOM
22517A number of extensions are supplied with $package.  You may choose to
22518compile these extensions for dynamic loading (the default), compile
22519them into the $package executable (static loading), or not include
22520them at all.  Answer "none" to include no extensions.
22521Note that DynaLoader is always built and need not be mentioned here.
22522
22523EOM
22524	case "$dynamic_ext" in
22525	'')
22526		: Exclude those listed in static_ext
22527		dflt=''
22528		for xxx in $avail_ext; do
22529			case " $static_ext " in
22530			*" $xxx "*) ;;
22531			*) dflt="$dflt $xxx" ;;
22532			esac
22533		done
22534		set X $dflt
22535		shift
22536		dflt="$*"
22537		;;
22538	*)	dflt="$dynamic_ext"
22539		# Perhaps we are reusing an old out-of-date config.sh.
22540		case "$hint" in
22541		previous)
22542			if test X"$dynamic_ext" != X"$avail_ext"; then
22543				$cat <<EOM
22544NOTICE:  Your previous config.sh list may be incorrect.
22545The extensions now available to you are
22546	${avail_ext}
22547but the default list from your previous config.sh is
22548	${dynamic_ext}
22549
22550EOM
22551			fi
22552			;;
22553		esac
22554		;;
22555	esac
22556	case "$dflt" in
22557	'')	dflt=none;;
22558	esac
22559	rp="What extensions do you wish to load dynamically?"
22560	. ./myread
22561	case "$ans" in
22562	none) dynamic_ext=' ' ;;
22563	*) dynamic_ext="$ans" ;;
22564	esac
22565
22566	case "$static_ext" in
22567	'')
22568		: Exclude those already listed in dynamic linking
22569		dflt=''
22570		for xxx in $avail_ext; do
22571			case " $dynamic_ext " in
22572			*" $xxx "*) ;;
22573			*) dflt="$dflt $xxx" ;;
22574			esac
22575		done
22576		set X $dflt
22577		shift
22578		dflt="$*"
22579		;;
22580	*)  dflt="$static_ext"
22581		;;
22582	esac
22583
22584	case "$dflt" in
22585	'')	dflt=none;;
22586	esac
22587	rp="What extensions do you wish to load statically?"
22588	. ./myread
22589	case "$ans" in
22590	none) static_ext=' ' ;;
22591	*) static_ext="$ans" ;;
22592	esac
22593	;;
22594*)
22595	$cat <<EOM
22596A number of extensions are supplied with $package.  Answer "none"
22597to include no extensions.
22598Note that DynaLoader is always built and need not be mentioned here.
22599
22600EOM
22601	case "$static_ext" in
22602	'') dflt="$avail_ext" ;;
22603	*)	dflt="$static_ext"
22604		# Perhaps we are reusing an old out-of-date config.sh.
22605		case "$hint" in
22606		previous)
22607			if test X"$static_ext" != X"$avail_ext"; then
22608				$cat <<EOM
22609NOTICE:  Your previous config.sh list may be incorrect.
22610The extensions now available to you are
22611	${avail_ext}
22612but the default list from your previous config.sh is
22613	${static_ext}
22614
22615EOM
22616			fi
22617			;;
22618		esac
22619		;;
22620	esac
22621	: Exclude those that are not xs extensions
22622	case "$dflt" in
22623	'')	dflt=none;;
22624	esac
22625	rp="What extensions do you wish to include?"
22626	. ./myread
22627	case "$ans" in
22628	none) static_ext=' ' ;;
22629	*) static_ext="$ans" ;;
22630	esac
22631	;;
22632esac
22633#
22634# Encode is a special case.  If we are building Encode as a static
22635# extension, we need to explicitly list its subextensions as well.
22636# For other nested extensions, this is handled automatically by
22637# the appropriate Makefile.PL.
22638case " $static_ext " in
22639	*" Encode "*) # Add the subextensions of Encode
22640	cd "$rsrc/cpan"
22641	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22642		static_ext="$static_ext Encode/$xxx"
22643	done
22644	cd "$tdir"
22645	;;
22646esac
22647
22648set X $dynamic_ext $static_ext $nonxs_ext
22649shift
22650extensions="$*"
22651
22652# Sanity check:  We require an extension suitable for use with
22653# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22654# should show up as failures in the test suite, but it's helpful to
22655# catch them now.) The 'extensions' list is normally sorted
22656# alphabetically, so we need to accept either
22657#    DB_File ... Fcntl ... IO  ....
22658# or something like
22659#    Fcntl ... NDBM_File ... IO  ....
22660case " $extensions"  in
22661*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22662*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22663*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22664*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22665   echo "WARNING: The Perl you are building will be quite crippled." >& 4
22666   ;;
22667esac
22668
22669: Remove libraries needed only for extensions
22670: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22671: The exception is SunOS 4.x, which needs them.
22672case "${osname}X${osvers}" in
22673sunos*X4*)
22674    perllibs="$libs"
22675    ;;
22676*) case "$usedl" in
22677    $define|true|[yY]*)
22678	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22679	    shift
22680	    perllibs="$*"
22681	    ;;
22682    *)	perllibs="$libs"
22683	    ;;
22684    esac
22685    ;;
22686esac
22687
22688: Remove build directory name from cppstdin so it can be used from
22689: either the present location or the final installed location.
22690echo " "
22691: Get out of the UU directory to get correct path name.
22692cd ..
22693case "$cppstdin" in
22694`pwd`/cppstdin)
22695	echo "Stripping down cppstdin path name"
22696	cppstdin=cppstdin
22697	;;
22698esac
22699cd UU
22700
22701: end of configuration questions
22702echo " "
22703echo "End of configuration questions."
22704echo " "
22705
22706: back to where it started
22707if test -d ../UU; then
22708	cd ..
22709fi
22710
22711: configuration may be unconditionally patched via a 'config.arch' file
22712if $test -f config.arch; then
22713	echo "I see a config.arch file, loading it." >&4
22714	. ./config.arch
22715fi
22716
22717: configuration may be patched via a 'config.over' file
22718if $test -f config.over; then
22719	echo " "
22720	dflt=y
22721	rp='I see a config.over file.  Do you wish to load it?'
22722	. UU/myread
22723	case "$ans" in
22724	n*) echo "OK, I'll ignore it.";;
22725	*)	. ./config.over
22726		echo "Configuration override changes have been loaded."
22727		;;
22728	esac
22729fi
22730
22731: in case they want portability, strip down executable paths
22732case "$d_portable" in
22733"$define")
22734	echo " "
22735	echo "Stripping down executable paths..." >&4
22736	for file in $loclist $trylist; do
22737		eval temp=\$$file
22738		eval $file=`basename $temp`
22739	done
22740	;;
22741esac
22742
22743: create config.sh file
22744echo " "
22745echo "Creating config.sh..." >&4
22746$spitshell <<EOT >config.sh
22747$startsh
22748#
22749# This file was produced by running the Configure script. It holds all the
22750# definitions figured out by Configure. Should you modify one of these values,
22751# do not forget to propagate your changes by running "Configure -der". You may
22752# instead choose to run each of the .SH files by yourself, or "Configure -S".
22753#
22754
22755# Package name      : $package
22756# Source directory  : $src
22757# Configuration time: $cf_time
22758# Configured by     : $cf_by
22759# Target system     : $myuname
22760
22761EOT
22762: Add in command line options if available
22763$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22764
22765$spitshell <<EOT >>config.sh
22766
22767Author='$Author'
22768Date='$Date'
22769Header='$Header'
22770Id='$Id'
22771Locker='$Locker'
22772Log='$Log'
22773RCSfile='$RCSfile'
22774Revision='$Revision'
22775Source='$Source'
22776State='$State'
22777_a='$_a'
22778_exe='$_exe'
22779_o='$_o'
22780afs='$afs'
22781afsroot='$afsroot'
22782alignbytes='$alignbytes'
22783ansi2knr='$ansi2knr'
22784aphostname='$aphostname'
22785api_revision='$api_revision'
22786api_subversion='$api_subversion'
22787api_version='$api_version'
22788api_versionstring='$api_versionstring'
22789ar='$ar'
22790archlib='$archlib'
22791archlibexp='$archlibexp'
22792archname64='$archname64'
22793archname='$archname'
22794archobjs='$archobjs'
22795asctime_r_proto='$asctime_r_proto'
22796awk='$awk'
22797baserev='$baserev'
22798bash='$bash'
22799bin='$bin'
22800bin_ELF='$bin_ELF'
22801binexp='$binexp'
22802bison='$bison'
22803byacc='$byacc'
22804byteorder='$byteorder'
22805c='$c'
22806castflags='$castflags'
22807cat='$cat'
22808cc='$cc'
22809cccdlflags='$cccdlflags'
22810ccdlflags='$ccdlflags'
22811ccflags='$ccflags'
22812ccflags_uselargefiles='$ccflags_uselargefiles'
22813ccname='$ccname'
22814ccsymbols='$ccsymbols'
22815ccversion='$ccversion'
22816cf_by='$cf_by'
22817cf_email='$cf_email'
22818cf_time='$cf_time'
22819charbits='$charbits'
22820charsize='$charsize'
22821chgrp='$chgrp'
22822chmod='$chmod'
22823chown='$chown'
22824clocktype='$clocktype'
22825comm='$comm'
22826compress='$compress'
22827contains='$contains'
22828cp='$cp'
22829cpio='$cpio'
22830cpp='$cpp'
22831cpp_stuff='$cpp_stuff'
22832cppccsymbols='$cppccsymbols'
22833cppflags='$cppflags'
22834cpplast='$cpplast'
22835cppminus='$cppminus'
22836cpprun='$cpprun'
22837cppstdin='$cppstdin'
22838cppsymbols='$cppsymbols'
22839crypt_r_proto='$crypt_r_proto'
22840cryptlib='$cryptlib'
22841csh='$csh'
22842ctermid_r_proto='$ctermid_r_proto'
22843ctime_r_proto='$ctime_r_proto'
22844d_Gconvert='$d_Gconvert'
22845d_PRIEUldbl='$d_PRIEUldbl'
22846d_PRIFUldbl='$d_PRIFUldbl'
22847d_PRIGUldbl='$d_PRIGUldbl'
22848d_PRIXU64='$d_PRIXU64'
22849d_PRId64='$d_PRId64'
22850d_PRIeldbl='$d_PRIeldbl'
22851d_PRIfldbl='$d_PRIfldbl'
22852d_PRIgldbl='$d_PRIgldbl'
22853d_PRIi64='$d_PRIi64'
22854d_PRIo64='$d_PRIo64'
22855d_PRIu64='$d_PRIu64'
22856d_PRIx64='$d_PRIx64'
22857d_SCNfldbl='$d_SCNfldbl'
22858d__fwalk='$d__fwalk'
22859d_access='$d_access'
22860d_accessx='$d_accessx'
22861d_aintl='$d_aintl'
22862d_alarm='$d_alarm'
22863d_archlib='$d_archlib'
22864d_asctime64='$d_asctime64'
22865d_asctime_r='$d_asctime_r'
22866d_atolf='$d_atolf'
22867d_atoll='$d_atoll'
22868d_attribute_deprecated='$d_attribute_deprecated'
22869d_attribute_format='$d_attribute_format'
22870d_attribute_malloc='$d_attribute_malloc'
22871d_attribute_nonnull='$d_attribute_nonnull'
22872d_attribute_noreturn='$d_attribute_noreturn'
22873d_attribute_pure='$d_attribute_pure'
22874d_attribute_unused='$d_attribute_unused'
22875d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22876d_bcmp='$d_bcmp'
22877d_bcopy='$d_bcopy'
22878d_bsd='$d_bsd'
22879d_bsdgetpgrp='$d_bsdgetpgrp'
22880d_bsdsetpgrp='$d_bsdsetpgrp'
22881d_builtin_choose_expr='$d_builtin_choose_expr'
22882d_builtin_expect='$d_builtin_expect'
22883d_bzero='$d_bzero'
22884d_c99_variadic_macros='$d_c99_variadic_macros'
22885d_casti32='$d_casti32'
22886d_castneg='$d_castneg'
22887d_charvspr='$d_charvspr'
22888d_chown='$d_chown'
22889d_chroot='$d_chroot'
22890d_chsize='$d_chsize'
22891d_class='$d_class'
22892d_clearenv='$d_clearenv'
22893d_closedir='$d_closedir'
22894d_cmsghdr_s='$d_cmsghdr_s'
22895d_const='$d_const'
22896d_copysignl='$d_copysignl'
22897d_cplusplus='$d_cplusplus'
22898d_crypt='$d_crypt'
22899d_crypt_r='$d_crypt_r'
22900d_csh='$d_csh'
22901d_ctermid='$d_ctermid'
22902d_ctermid_r='$d_ctermid_r'
22903d_ctime64='$d_ctime64'
22904d_ctime_r='$d_ctime_r'
22905d_cuserid='$d_cuserid'
22906d_dbl_dig='$d_dbl_dig'
22907d_dbminitproto='$d_dbminitproto'
22908d_difftime64='$d_difftime64'
22909d_difftime='$d_difftime'
22910d_dir_dd_fd='$d_dir_dd_fd'
22911d_dirfd='$d_dirfd'
22912d_dirnamlen='$d_dirnamlen'
22913d_dlerror='$d_dlerror'
22914d_dlopen='$d_dlopen'
22915d_dlsymun='$d_dlsymun'
22916d_dosuid='$d_dosuid'
22917d_drand48_r='$d_drand48_r'
22918d_drand48proto='$d_drand48proto'
22919d_dup2='$d_dup2'
22920d_eaccess='$d_eaccess'
22921d_endgrent='$d_endgrent'
22922d_endgrent_r='$d_endgrent_r'
22923d_endhent='$d_endhent'
22924d_endhostent_r='$d_endhostent_r'
22925d_endnent='$d_endnent'
22926d_endnetent_r='$d_endnetent_r'
22927d_endpent='$d_endpent'
22928d_endprotoent_r='$d_endprotoent_r'
22929d_endpwent='$d_endpwent'
22930d_endpwent_r='$d_endpwent_r'
22931d_endsent='$d_endsent'
22932d_endservent_r='$d_endservent_r'
22933d_eofnblk='$d_eofnblk'
22934d_eunice='$d_eunice'
22935d_faststdio='$d_faststdio'
22936d_fchdir='$d_fchdir'
22937d_fchmod='$d_fchmod'
22938d_fchown='$d_fchown'
22939d_fcntl='$d_fcntl'
22940d_fcntl_can_lock='$d_fcntl_can_lock'
22941d_fd_macros='$d_fd_macros'
22942d_fd_set='$d_fd_set'
22943d_fds_bits='$d_fds_bits'
22944d_fgetpos='$d_fgetpos'
22945d_finite='$d_finite'
22946d_finitel='$d_finitel'
22947d_flexfnam='$d_flexfnam'
22948d_flock='$d_flock'
22949d_flockproto='$d_flockproto'
22950d_fork='$d_fork'
22951d_fp_class='$d_fp_class'
22952d_fpathconf='$d_fpathconf'
22953d_fpclass='$d_fpclass'
22954d_fpclassify='$d_fpclassify'
22955d_fpclassl='$d_fpclassl'
22956d_fpos64_t='$d_fpos64_t'
22957d_frexpl='$d_frexpl'
22958d_fs_data_s='$d_fs_data_s'
22959d_fseeko='$d_fseeko'
22960d_fsetpos='$d_fsetpos'
22961d_fstatfs='$d_fstatfs'
22962d_fstatvfs='$d_fstatvfs'
22963d_fsync='$d_fsync'
22964d_ftello='$d_ftello'
22965d_ftime='$d_ftime'
22966d_futimes='$d_futimes'
22967d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22968d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22969d_getaddrinfo='$d_getaddrinfo'
22970d_getcwd='$d_getcwd'
22971d_getespwnam='$d_getespwnam'
22972d_getfsstat='$d_getfsstat'
22973d_getgrent='$d_getgrent'
22974d_getgrent_r='$d_getgrent_r'
22975d_getgrgid_r='$d_getgrgid_r'
22976d_getgrnam_r='$d_getgrnam_r'
22977d_getgrps='$d_getgrps'
22978d_gethbyaddr='$d_gethbyaddr'
22979d_gethbyname='$d_gethbyname'
22980d_gethent='$d_gethent'
22981d_gethname='$d_gethname'
22982d_gethostbyaddr_r='$d_gethostbyaddr_r'
22983d_gethostbyname_r='$d_gethostbyname_r'
22984d_gethostent_r='$d_gethostent_r'
22985d_gethostprotos='$d_gethostprotos'
22986d_getitimer='$d_getitimer'
22987d_getlogin='$d_getlogin'
22988d_getlogin_r='$d_getlogin_r'
22989d_getmnt='$d_getmnt'
22990d_getmntent='$d_getmntent'
22991d_getnameinfo='$d_getnameinfo'
22992d_getnbyaddr='$d_getnbyaddr'
22993d_getnbyname='$d_getnbyname'
22994d_getnent='$d_getnent'
22995d_getnetbyaddr_r='$d_getnetbyaddr_r'
22996d_getnetbyname_r='$d_getnetbyname_r'
22997d_getnetent_r='$d_getnetent_r'
22998d_getnetprotos='$d_getnetprotos'
22999d_getpagsz='$d_getpagsz'
23000d_getpbyname='$d_getpbyname'
23001d_getpbynumber='$d_getpbynumber'
23002d_getpent='$d_getpent'
23003d_getpgid='$d_getpgid'
23004d_getpgrp2='$d_getpgrp2'
23005d_getpgrp='$d_getpgrp'
23006d_getppid='$d_getppid'
23007d_getprior='$d_getprior'
23008d_getprotobyname_r='$d_getprotobyname_r'
23009d_getprotobynumber_r='$d_getprotobynumber_r'
23010d_getprotoent_r='$d_getprotoent_r'
23011d_getprotoprotos='$d_getprotoprotos'
23012d_getprpwnam='$d_getprpwnam'
23013d_getpwent='$d_getpwent'
23014d_getpwent_r='$d_getpwent_r'
23015d_getpwnam_r='$d_getpwnam_r'
23016d_getpwuid_r='$d_getpwuid_r'
23017d_getsbyname='$d_getsbyname'
23018d_getsbyport='$d_getsbyport'
23019d_getsent='$d_getsent'
23020d_getservbyname_r='$d_getservbyname_r'
23021d_getservbyport_r='$d_getservbyport_r'
23022d_getservent_r='$d_getservent_r'
23023d_getservprotos='$d_getservprotos'
23024d_getspnam='$d_getspnam'
23025d_getspnam_r='$d_getspnam_r'
23026d_gettimeod='$d_gettimeod'
23027d_gmtime64='$d_gmtime64'
23028d_gmtime_r='$d_gmtime_r'
23029d_gnulibc='$d_gnulibc'
23030d_grpasswd='$d_grpasswd'
23031d_hasmntopt='$d_hasmntopt'
23032d_htonl='$d_htonl'
23033d_ilogbl='$d_ilogbl'
23034d_inc_version_list='$d_inc_version_list'
23035d_index='$d_index'
23036d_inetaton='$d_inetaton'
23037d_inetntop='$d_inetntop'
23038d_inetpton='$d_inetpton'
23039d_int64_t='$d_int64_t'
23040d_ipv6_mreq='$d_ipv6_mreq'
23041d_isascii='$d_isascii'
23042d_isblank='$d_isblank'
23043d_isfinite='$d_isfinite'
23044d_isinf='$d_isinf'
23045d_isnan='$d_isnan'
23046d_isnanl='$d_isnanl'
23047d_killpg='$d_killpg'
23048d_lchown='$d_lchown'
23049d_ldbl_dig='$d_ldbl_dig'
23050d_libm_lib_version='$d_libm_lib_version'
23051d_link='$d_link'
23052d_localtime64='$d_localtime64'
23053d_localtime_r='$d_localtime_r'
23054d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23055d_locconv='$d_locconv'
23056d_lockf='$d_lockf'
23057d_longdbl='$d_longdbl'
23058d_longlong='$d_longlong'
23059d_lseekproto='$d_lseekproto'
23060d_lstat='$d_lstat'
23061d_madvise='$d_madvise'
23062d_malloc_good_size='$d_malloc_good_size'
23063d_malloc_size='$d_malloc_size'
23064d_mblen='$d_mblen'
23065d_mbstowcs='$d_mbstowcs'
23066d_mbtowc='$d_mbtowc'
23067d_memchr='$d_memchr'
23068d_memcmp='$d_memcmp'
23069d_memcpy='$d_memcpy'
23070d_memmove='$d_memmove'
23071d_memset='$d_memset'
23072d_mkdir='$d_mkdir'
23073d_mkdtemp='$d_mkdtemp'
23074d_mkfifo='$d_mkfifo'
23075d_mkstemp='$d_mkstemp'
23076d_mkstemps='$d_mkstemps'
23077d_mktime64='$d_mktime64'
23078d_mktime='$d_mktime'
23079d_mmap='$d_mmap'
23080d_modfl='$d_modfl'
23081d_modfl_pow32_bug='$d_modfl_pow32_bug'
23082d_modflproto='$d_modflproto'
23083d_mprotect='$d_mprotect'
23084d_msg='$d_msg'
23085d_msg_ctrunc='$d_msg_ctrunc'
23086d_msg_dontroute='$d_msg_dontroute'
23087d_msg_oob='$d_msg_oob'
23088d_msg_peek='$d_msg_peek'
23089d_msg_proxy='$d_msg_proxy'
23090d_msgctl='$d_msgctl'
23091d_msgget='$d_msgget'
23092d_msghdr_s='$d_msghdr_s'
23093d_msgrcv='$d_msgrcv'
23094d_msgsnd='$d_msgsnd'
23095d_msync='$d_msync'
23096d_munmap='$d_munmap'
23097d_mymalloc='$d_mymalloc'
23098d_ndbm='$d_ndbm'
23099d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23100d_nice='$d_nice'
23101d_nl_langinfo='$d_nl_langinfo'
23102d_nv_preserves_uv='$d_nv_preserves_uv'
23103d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23104d_off64_t='$d_off64_t'
23105d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23106d_oldpthreads='$d_oldpthreads'
23107d_oldsock='$d_oldsock'
23108d_open3='$d_open3'
23109d_pathconf='$d_pathconf'
23110d_pause='$d_pause'
23111d_perl_otherlibdirs='$d_perl_otherlibdirs'
23112d_phostname='$d_phostname'
23113d_pipe='$d_pipe'
23114d_poll='$d_poll'
23115d_portable='$d_portable'
23116d_prctl='$d_prctl'
23117d_prctl_set_name='$d_prctl_set_name'
23118d_printf_format_null='$d_printf_format_null'
23119d_procselfexe='$d_procselfexe'
23120d_pseudofork='$d_pseudofork'
23121d_pthread_atfork='$d_pthread_atfork'
23122d_pthread_attr_setscope='$d_pthread_attr_setscope'
23123d_pthread_yield='$d_pthread_yield'
23124d_pwage='$d_pwage'
23125d_pwchange='$d_pwchange'
23126d_pwclass='$d_pwclass'
23127d_pwcomment='$d_pwcomment'
23128d_pwexpire='$d_pwexpire'
23129d_pwgecos='$d_pwgecos'
23130d_pwpasswd='$d_pwpasswd'
23131d_pwquota='$d_pwquota'
23132d_qgcvt='$d_qgcvt'
23133d_quad='$d_quad'
23134d_random_r='$d_random_r'
23135d_readdir64_r='$d_readdir64_r'
23136d_readdir='$d_readdir'
23137d_readdir_r='$d_readdir_r'
23138d_readlink='$d_readlink'
23139d_readv='$d_readv'
23140d_recvmsg='$d_recvmsg'
23141d_rename='$d_rename'
23142d_rewinddir='$d_rewinddir'
23143d_rmdir='$d_rmdir'
23144d_safebcpy='$d_safebcpy'
23145d_safemcpy='$d_safemcpy'
23146d_sanemcmp='$d_sanemcmp'
23147d_sbrkproto='$d_sbrkproto'
23148d_scalbnl='$d_scalbnl'
23149d_sched_yield='$d_sched_yield'
23150d_scm_rights='$d_scm_rights'
23151d_seekdir='$d_seekdir'
23152d_select='$d_select'
23153d_sem='$d_sem'
23154d_semctl='$d_semctl'
23155d_semctl_semid_ds='$d_semctl_semid_ds'
23156d_semctl_semun='$d_semctl_semun'
23157d_semget='$d_semget'
23158d_semop='$d_semop'
23159d_sendmsg='$d_sendmsg'
23160d_setegid='$d_setegid'
23161d_seteuid='$d_seteuid'
23162d_setgrent='$d_setgrent'
23163d_setgrent_r='$d_setgrent_r'
23164d_setgrps='$d_setgrps'
23165d_sethent='$d_sethent'
23166d_sethostent_r='$d_sethostent_r'
23167d_setitimer='$d_setitimer'
23168d_setlinebuf='$d_setlinebuf'
23169d_setlocale='$d_setlocale'
23170d_setlocale_r='$d_setlocale_r'
23171d_setnent='$d_setnent'
23172d_setnetent_r='$d_setnetent_r'
23173d_setpent='$d_setpent'
23174d_setpgid='$d_setpgid'
23175d_setpgrp2='$d_setpgrp2'
23176d_setpgrp='$d_setpgrp'
23177d_setprior='$d_setprior'
23178d_setproctitle='$d_setproctitle'
23179d_setprotoent_r='$d_setprotoent_r'
23180d_setpwent='$d_setpwent'
23181d_setpwent_r='$d_setpwent_r'
23182d_setregid='$d_setregid'
23183d_setresgid='$d_setresgid'
23184d_setresuid='$d_setresuid'
23185d_setreuid='$d_setreuid'
23186d_setrgid='$d_setrgid'
23187d_setruid='$d_setruid'
23188d_setsent='$d_setsent'
23189d_setservent_r='$d_setservent_r'
23190d_setsid='$d_setsid'
23191d_setvbuf='$d_setvbuf'
23192d_sfio='$d_sfio'
23193d_shm='$d_shm'
23194d_shmat='$d_shmat'
23195d_shmatprototype='$d_shmatprototype'
23196d_shmctl='$d_shmctl'
23197d_shmdt='$d_shmdt'
23198d_shmget='$d_shmget'
23199d_sigaction='$d_sigaction'
23200d_signbit='$d_signbit'
23201d_sigprocmask='$d_sigprocmask'
23202d_sigsetjmp='$d_sigsetjmp'
23203d_sin6_scope_id='$d_sin6_scope_id'
23204d_sitearch='$d_sitearch'
23205d_snprintf='$d_snprintf'
23206d_sockaddr_in6='$d_sockaddr_in6'
23207d_sockaddr_sa_len='$d_sockaddr_sa_len'
23208d_sockatmark='$d_sockatmark'
23209d_sockatmarkproto='$d_sockatmarkproto'
23210d_socket='$d_socket'
23211d_socklen_t='$d_socklen_t'
23212d_sockpair='$d_sockpair'
23213d_socks5_init='$d_socks5_init'
23214d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23215d_sqrtl='$d_sqrtl'
23216d_srand48_r='$d_srand48_r'
23217d_srandom_r='$d_srandom_r'
23218d_sresgproto='$d_sresgproto'
23219d_sresuproto='$d_sresuproto'
23220d_statblks='$d_statblks'
23221d_statfs_f_flags='$d_statfs_f_flags'
23222d_statfs_s='$d_statfs_s'
23223d_static_inline='$d_static_inline'
23224d_statvfs='$d_statvfs'
23225d_stdio_cnt_lval='$d_stdio_cnt_lval'
23226d_stdio_ptr_lval='$d_stdio_ptr_lval'
23227d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23228d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23229d_stdio_stream_array='$d_stdio_stream_array'
23230d_stdiobase='$d_stdiobase'
23231d_stdstdio='$d_stdstdio'
23232d_strchr='$d_strchr'
23233d_strcoll='$d_strcoll'
23234d_strctcpy='$d_strctcpy'
23235d_strerrm='$d_strerrm'
23236d_strerror='$d_strerror'
23237d_strerror_r='$d_strerror_r'
23238d_strftime='$d_strftime'
23239d_strlcat='$d_strlcat'
23240d_strlcpy='$d_strlcpy'
23241d_strtod='$d_strtod'
23242d_strtol='$d_strtol'
23243d_strtold='$d_strtold'
23244d_strtoll='$d_strtoll'
23245d_strtoq='$d_strtoq'
23246d_strtoul='$d_strtoul'
23247d_strtoull='$d_strtoull'
23248d_strtouq='$d_strtouq'
23249d_strxfrm='$d_strxfrm'
23250d_suidsafe='$d_suidsafe'
23251d_symlink='$d_symlink'
23252d_syscall='$d_syscall'
23253d_syscallproto='$d_syscallproto'
23254d_sysconf='$d_sysconf'
23255d_sysernlst='$d_sysernlst'
23256d_syserrlst='$d_syserrlst'
23257d_system='$d_system'
23258d_tcgetpgrp='$d_tcgetpgrp'
23259d_tcsetpgrp='$d_tcsetpgrp'
23260d_telldir='$d_telldir'
23261d_telldirproto='$d_telldirproto'
23262d_time='$d_time'
23263d_timegm='$d_timegm'
23264d_times='$d_times'
23265d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23266d_tm_tm_zone='$d_tm_tm_zone'
23267d_tmpnam_r='$d_tmpnam_r'
23268d_truncate='$d_truncate'
23269d_ttyname_r='$d_ttyname_r'
23270d_tzname='$d_tzname'
23271d_u32align='$d_u32align'
23272d_ualarm='$d_ualarm'
23273d_umask='$d_umask'
23274d_uname='$d_uname'
23275d_union_semun='$d_union_semun'
23276d_unordered='$d_unordered'
23277d_unsetenv='$d_unsetenv'
23278d_usleep='$d_usleep'
23279d_usleepproto='$d_usleepproto'
23280d_ustat='$d_ustat'
23281d_vendorarch='$d_vendorarch'
23282d_vendorbin='$d_vendorbin'
23283d_vendorlib='$d_vendorlib'
23284d_vendorscript='$d_vendorscript'
23285d_vfork='$d_vfork'
23286d_void_closedir='$d_void_closedir'
23287d_voidsig='$d_voidsig'
23288d_voidtty='$d_voidtty'
23289d_volatile='$d_volatile'
23290d_vprintf='$d_vprintf'
23291d_vsnprintf='$d_vsnprintf'
23292d_wait4='$d_wait4'
23293d_waitpid='$d_waitpid'
23294d_wcstombs='$d_wcstombs'
23295d_wctomb='$d_wctomb'
23296d_writev='$d_writev'
23297d_xenix='$d_xenix'
23298date='$date'
23299db_hashtype='$db_hashtype'
23300db_prefixtype='$db_prefixtype'
23301db_version_major='$db_version_major'
23302db_version_minor='$db_version_minor'
23303db_version_patch='$db_version_patch'
23304defvoidused='$defvoidused'
23305direntrytype='$direntrytype'
23306dlext='$dlext'
23307dlsrc='$dlsrc'
23308doublesize='$doublesize'
23309drand01='$drand01'
23310drand48_r_proto='$drand48_r_proto'
23311dtrace='$dtrace'
23312dynamic_ext='$dynamic_ext'
23313eagain='$eagain'
23314ebcdic='$ebcdic'
23315echo='$echo'
23316egrep='$egrep'
23317emacs='$emacs'
23318endgrent_r_proto='$endgrent_r_proto'
23319endhostent_r_proto='$endhostent_r_proto'
23320endnetent_r_proto='$endnetent_r_proto'
23321endprotoent_r_proto='$endprotoent_r_proto'
23322endpwent_r_proto='$endpwent_r_proto'
23323endservent_r_proto='$endservent_r_proto'
23324eunicefix='$eunicefix'
23325exe_ext='$exe_ext'
23326expr='$expr'
23327extensions='$extensions'
23328extern_C='$extern_C'
23329extras='$extras'
23330fflushNULL='$fflushNULL'
23331fflushall='$fflushall'
23332find='$find'
23333firstmakefile='$firstmakefile'
23334flex='$flex'
23335fpossize='$fpossize'
23336fpostype='$fpostype'
23337freetype='$freetype'
23338from='$from'
23339full_ar='$full_ar'
23340full_csh='$full_csh'
23341full_sed='$full_sed'
23342gccansipedantic='$gccansipedantic'
23343gccosandvers='$gccosandvers'
23344gccversion='$gccversion'
23345getgrent_r_proto='$getgrent_r_proto'
23346getgrgid_r_proto='$getgrgid_r_proto'
23347getgrnam_r_proto='$getgrnam_r_proto'
23348gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23349gethostbyname_r_proto='$gethostbyname_r_proto'
23350gethostent_r_proto='$gethostent_r_proto'
23351getlogin_r_proto='$getlogin_r_proto'
23352getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23353getnetbyname_r_proto='$getnetbyname_r_proto'
23354getnetent_r_proto='$getnetent_r_proto'
23355getprotobyname_r_proto='$getprotobyname_r_proto'
23356getprotobynumber_r_proto='$getprotobynumber_r_proto'
23357getprotoent_r_proto='$getprotoent_r_proto'
23358getpwent_r_proto='$getpwent_r_proto'
23359getpwnam_r_proto='$getpwnam_r_proto'
23360getpwuid_r_proto='$getpwuid_r_proto'
23361getservbyname_r_proto='$getservbyname_r_proto'
23362getservbyport_r_proto='$getservbyport_r_proto'
23363getservent_r_proto='$getservent_r_proto'
23364getspnam_r_proto='$getspnam_r_proto'
23365gidformat='$gidformat'
23366gidsign='$gidsign'
23367gidsize='$gidsize'
23368gidtype='$gidtype'
23369glibpth='$glibpth'
23370gmake='$gmake'
23371gmtime_r_proto='$gmtime_r_proto'
23372gnulibc_version='$gnulibc_version'
23373grep='$grep'
23374groupcat='$groupcat'
23375groupstype='$groupstype'
23376gzip='$gzip'
23377h_fcntl='$h_fcntl'
23378h_sysfile='$h_sysfile'
23379hint='$hint'
23380hostcat='$hostcat'
23381html1dir='$html1dir'
23382html1direxp='$html1direxp'
23383html3dir='$html3dir'
23384html3direxp='$html3direxp'
23385i16size='$i16size'
23386i16type='$i16type'
23387i32size='$i32size'
23388i32type='$i32type'
23389i64size='$i64size'
23390i64type='$i64type'
23391i8size='$i8size'
23392i8type='$i8type'
23393i_arpainet='$i_arpainet'
23394i_assert='$i_assert'
23395i_bsdioctl='$i_bsdioctl'
23396i_crypt='$i_crypt'
23397i_db='$i_db'
23398i_dbm='$i_dbm'
23399i_dirent='$i_dirent'
23400i_dld='$i_dld'
23401i_dlfcn='$i_dlfcn'
23402i_fcntl='$i_fcntl'
23403i_float='$i_float'
23404i_fp='$i_fp'
23405i_fp_class='$i_fp_class'
23406i_gdbm='$i_gdbm'
23407i_gdbm_ndbm='$i_gdbm_ndbm'
23408i_gdbmndbm='$i_gdbmndbm'
23409i_grp='$i_grp'
23410i_ieeefp='$i_ieeefp'
23411i_inttypes='$i_inttypes'
23412i_langinfo='$i_langinfo'
23413i_libutil='$i_libutil'
23414i_limits='$i_limits'
23415i_locale='$i_locale'
23416i_machcthr='$i_machcthr'
23417i_malloc='$i_malloc'
23418i_mallocmalloc='$i_mallocmalloc'
23419i_math='$i_math'
23420i_memory='$i_memory'
23421i_mntent='$i_mntent'
23422i_ndbm='$i_ndbm'
23423i_netdb='$i_netdb'
23424i_neterrno='$i_neterrno'
23425i_netinettcp='$i_netinettcp'
23426i_niin='$i_niin'
23427i_poll='$i_poll'
23428i_prot='$i_prot'
23429i_pthread='$i_pthread'
23430i_pwd='$i_pwd'
23431i_rpcsvcdbm='$i_rpcsvcdbm'
23432i_sfio='$i_sfio'
23433i_sgtty='$i_sgtty'
23434i_shadow='$i_shadow'
23435i_socks='$i_socks'
23436i_stdarg='$i_stdarg'
23437i_stdbool='$i_stdbool'
23438i_stddef='$i_stddef'
23439i_stdlib='$i_stdlib'
23440i_string='$i_string'
23441i_sunmath='$i_sunmath'
23442i_sysaccess='$i_sysaccess'
23443i_sysdir='$i_sysdir'
23444i_sysfile='$i_sysfile'
23445i_sysfilio='$i_sysfilio'
23446i_sysin='$i_sysin'
23447i_sysioctl='$i_sysioctl'
23448i_syslog='$i_syslog'
23449i_sysmman='$i_sysmman'
23450i_sysmode='$i_sysmode'
23451i_sysmount='$i_sysmount'
23452i_sysndir='$i_sysndir'
23453i_sysparam='$i_sysparam'
23454i_syspoll='$i_syspoll'
23455i_sysresrc='$i_sysresrc'
23456i_syssecrt='$i_syssecrt'
23457i_sysselct='$i_sysselct'
23458i_syssockio='$i_syssockio'
23459i_sysstat='$i_sysstat'
23460i_sysstatfs='$i_sysstatfs'
23461i_sysstatvfs='$i_sysstatvfs'
23462i_systime='$i_systime'
23463i_systimek='$i_systimek'
23464i_systimes='$i_systimes'
23465i_systypes='$i_systypes'
23466i_sysuio='$i_sysuio'
23467i_sysun='$i_sysun'
23468i_sysutsname='$i_sysutsname'
23469i_sysvfs='$i_sysvfs'
23470i_syswait='$i_syswait'
23471i_termio='$i_termio'
23472i_termios='$i_termios'
23473i_time='$i_time'
23474i_unistd='$i_unistd'
23475i_ustat='$i_ustat'
23476i_utime='$i_utime'
23477i_values='$i_values'
23478i_varargs='$i_varargs'
23479i_varhdr='$i_varhdr'
23480i_vfork='$i_vfork'
23481ignore_versioned_solibs='$ignore_versioned_solibs'
23482inc_version_list='$inc_version_list'
23483inc_version_list_init='$inc_version_list_init'
23484incpath='$incpath'
23485inews='$inews'
23486initialinstalllocation='$initialinstalllocation'
23487installarchlib='$installarchlib'
23488installbin='$installbin'
23489installhtml1dir='$installhtml1dir'
23490installhtml3dir='$installhtml3dir'
23491installman1dir='$installman1dir'
23492installman3dir='$installman3dir'
23493installprefix='$installprefix'
23494installprefixexp='$installprefixexp'
23495installprivlib='$installprivlib'
23496installscript='$installscript'
23497installsitearch='$installsitearch'
23498installsitebin='$installsitebin'
23499installsitehtml1dir='$installsitehtml1dir'
23500installsitehtml3dir='$installsitehtml3dir'
23501installsitelib='$installsitelib'
23502installsiteman1dir='$installsiteman1dir'
23503installsiteman3dir='$installsiteman3dir'
23504installsitescript='$installsitescript'
23505installstyle='$installstyle'
23506installusrbinperl='$installusrbinperl'
23507installvendorarch='$installvendorarch'
23508installvendorbin='$installvendorbin'
23509installvendorhtml1dir='$installvendorhtml1dir'
23510installvendorhtml3dir='$installvendorhtml3dir'
23511installvendorlib='$installvendorlib'
23512installvendorman1dir='$installvendorman1dir'
23513installvendorman3dir='$installvendorman3dir'
23514installvendorscript='$installvendorscript'
23515intsize='$intsize'
23516issymlink='$issymlink'
23517ivdformat='$ivdformat'
23518ivsize='$ivsize'
23519ivtype='$ivtype'
23520known_extensions='$known_extensions'
23521ksh='$ksh'
23522ld='$ld'
23523ld_can_script='$ld_can_script'
23524lddlflags='$lddlflags'
23525ldflags='$ldflags'
23526ldflags_uselargefiles='$ldflags_uselargefiles'
23527ldlibpthname='$ldlibpthname'
23528less='$less'
23529lib_ext='$lib_ext'
23530libc='$libc'
23531libperl='$libperl'
23532libpth='$libpth'
23533libs='$libs'
23534libsdirs='$libsdirs'
23535libsfiles='$libsfiles'
23536libsfound='$libsfound'
23537libspath='$libspath'
23538libswanted='$libswanted'
23539libswanted_uselargefiles='$libswanted_uselargefiles'
23540line='$line'
23541lint='$lint'
23542lkflags='$lkflags'
23543ln='$ln'
23544lns='$lns'
23545localtime_r_proto='$localtime_r_proto'
23546locincpth='$locincpth'
23547loclibpth='$loclibpth'
23548longdblsize='$longdblsize'
23549longlongsize='$longlongsize'
23550longsize='$longsize'
23551lp='$lp'
23552lpr='$lpr'
23553ls='$ls'
23554lseeksize='$lseeksize'
23555lseektype='$lseektype'
23556mad='$mad'
23557madlyh='$madlyh'
23558madlyobj='$madlyobj'
23559madlysrc='$madlysrc'
23560mail='$mail'
23561mailx='$mailx'
23562make='$make'
23563make_set_make='$make_set_make'
23564mallocobj='$mallocobj'
23565mallocsrc='$mallocsrc'
23566malloctype='$malloctype'
23567man1dir='$man1dir'
23568man1direxp='$man1direxp'
23569man1ext='$man1ext'
23570man3dir='$man3dir'
23571man3direxp='$man3direxp'
23572man3ext='$man3ext'
23573mips_type='$mips_type'
23574mistrustnm='$mistrustnm'
23575mkdir='$mkdir'
23576mmaptype='$mmaptype'
23577modetype='$modetype'
23578more='$more'
23579multiarch='$multiarch'
23580mv='$mv'
23581myarchname='$myarchname'
23582mydomain='$mydomain'
23583myhostname='$myhostname'
23584myuname='$myuname'
23585n='$n'
23586need_va_copy='$need_va_copy'
23587netdb_hlen_type='$netdb_hlen_type'
23588netdb_host_type='$netdb_host_type'
23589netdb_name_type='$netdb_name_type'
23590netdb_net_type='$netdb_net_type'
23591nm='$nm'
23592nm_opt='$nm_opt'
23593nm_so_opt='$nm_so_opt'
23594nonxs_ext='$nonxs_ext'
23595nroff='$nroff'
23596nvEUformat='$nvEUformat'
23597nvFUformat='$nvFUformat'
23598nvGUformat='$nvGUformat'
23599nv_overflows_integers_at='$nv_overflows_integers_at'
23600nv_preserves_uv_bits='$nv_preserves_uv_bits'
23601nveformat='$nveformat'
23602nvfformat='$nvfformat'
23603nvgformat='$nvgformat'
23604nvsize='$nvsize'
23605nvtype='$nvtype'
23606o_nonblock='$o_nonblock'
23607obj_ext='$obj_ext'
23608old_pthread_create_joinable='$old_pthread_create_joinable'
23609optimize='$optimize'
23610orderlib='$orderlib'
23611osname='$osname'
23612osvers='$osvers'
23613otherlibdirs='$otherlibdirs'
23614package='$package'
23615pager='$pager'
23616passcat='$passcat'
23617patchlevel='$patchlevel'
23618path_sep='$path_sep'
23619perl5='$perl5'
23620perl='$perl'
23621perl_patchlevel='$perl_patchlevel'
23622perl_static_inline='$perl_static_inline'
23623perladmin='$perladmin'
23624perllibs='$perllibs'
23625perlpath='$perlpath'
23626pg='$pg'
23627phostname='$phostname'
23628pidtype='$pidtype'
23629plibpth='$plibpth'
23630pmake='$pmake'
23631pr='$pr'
23632prefix='$prefix'
23633prefixexp='$prefixexp'
23634privlib='$privlib'
23635privlibexp='$privlibexp'
23636procselfexe='$procselfexe'
23637prototype='$prototype'
23638ptrsize='$ptrsize'
23639quadkind='$quadkind'
23640quadtype='$quadtype'
23641randbits='$randbits'
23642randfunc='$randfunc'
23643random_r_proto='$random_r_proto'
23644randseedtype='$randseedtype'
23645ranlib='$ranlib'
23646rd_nodata='$rd_nodata'
23647readdir64_r_proto='$readdir64_r_proto'
23648readdir_r_proto='$readdir_r_proto'
23649revision='$revision'
23650rm='$rm'
23651rm_try='$rm_try'
23652rmail='$rmail'
23653run='$run'
23654runnm='$runnm'
23655sGMTIME_max='$sGMTIME_max'
23656sGMTIME_min='$sGMTIME_min'
23657sLOCALTIME_max='$sLOCALTIME_max'
23658sLOCALTIME_min='$sLOCALTIME_min'
23659sPRIEUldbl='$sPRIEUldbl'
23660sPRIFUldbl='$sPRIFUldbl'
23661sPRIGUldbl='$sPRIGUldbl'
23662sPRIXU64='$sPRIXU64'
23663sPRId64='$sPRId64'
23664sPRIeldbl='$sPRIeldbl'
23665sPRIfldbl='$sPRIfldbl'
23666sPRIgldbl='$sPRIgldbl'
23667sPRIi64='$sPRIi64'
23668sPRIo64='$sPRIo64'
23669sPRIu64='$sPRIu64'
23670sPRIx64='$sPRIx64'
23671sSCNfldbl='$sSCNfldbl'
23672sched_yield='$sched_yield'
23673scriptdir='$scriptdir'
23674scriptdirexp='$scriptdirexp'
23675sed='$sed'
23676seedfunc='$seedfunc'
23677selectminbits='$selectminbits'
23678selecttype='$selecttype'
23679sendmail='$sendmail'
23680setgrent_r_proto='$setgrent_r_proto'
23681sethostent_r_proto='$sethostent_r_proto'
23682setlocale_r_proto='$setlocale_r_proto'
23683setnetent_r_proto='$setnetent_r_proto'
23684setprotoent_r_proto='$setprotoent_r_proto'
23685setpwent_r_proto='$setpwent_r_proto'
23686setservent_r_proto='$setservent_r_proto'
23687sh='$sh'
23688shar='$shar'
23689sharpbang='$sharpbang'
23690shmattype='$shmattype'
23691shortsize='$shortsize'
23692shrpenv='$shrpenv'
23693shsharp='$shsharp'
23694sig_count='$sig_count'
23695sig_name='$sig_name'
23696sig_name_init='$sig_name_init'
23697sig_num='$sig_num'
23698sig_num_init='$sig_num_init'
23699sig_size='$sig_size'
23700signal_t='$signal_t'
23701sitearch='$sitearch'
23702sitearchexp='$sitearchexp'
23703sitebin='$sitebin'
23704sitebinexp='$sitebinexp'
23705sitehtml1dir='$sitehtml1dir'
23706sitehtml1direxp='$sitehtml1direxp'
23707sitehtml3dir='$sitehtml3dir'
23708sitehtml3direxp='$sitehtml3direxp'
23709sitelib='$sitelib'
23710sitelib_stem='$sitelib_stem'
23711sitelibexp='$sitelibexp'
23712siteman1dir='$siteman1dir'
23713siteman1direxp='$siteman1direxp'
23714siteman3dir='$siteman3dir'
23715siteman3direxp='$siteman3direxp'
23716siteprefix='$siteprefix'
23717siteprefixexp='$siteprefixexp'
23718sitescript='$sitescript'
23719sitescriptexp='$sitescriptexp'
23720sizesize='$sizesize'
23721sizetype='$sizetype'
23722sleep='$sleep'
23723smail='$smail'
23724so='$so'
23725sockethdr='$sockethdr'
23726socketlib='$socketlib'
23727socksizetype='$socksizetype'
23728sort='$sort'
23729spackage='$spackage'
23730spitshell='$spitshell'
23731srand48_r_proto='$srand48_r_proto'
23732srandom_r_proto='$srandom_r_proto'
23733src='$src'
23734ssizetype='$ssizetype'
23735st_ino_sign='$st_ino_sign'
23736st_ino_size='$st_ino_size'
23737startperl='$startperl'
23738startsh='$startsh'
23739static_ext='$static_ext'
23740stdchar='$stdchar'
23741stdio_base='$stdio_base'
23742stdio_bufsiz='$stdio_bufsiz'
23743stdio_cnt='$stdio_cnt'
23744stdio_filbuf='$stdio_filbuf'
23745stdio_ptr='$stdio_ptr'
23746stdio_stream_array='$stdio_stream_array'
23747strerror_r_proto='$strerror_r_proto'
23748strings='$strings'
23749submit='$submit'
23750subversion='$subversion'
23751sysman='$sysman'
23752tail='$tail'
23753tar='$tar'
23754targetarch='$targetarch'
23755tbl='$tbl'
23756tee='$tee'
23757test='$test'
23758timeincl='$timeincl'
23759timetype='$timetype'
23760tmpnam_r_proto='$tmpnam_r_proto'
23761to='$to'
23762touch='$touch'
23763tr='$tr'
23764trnl='$trnl'
23765troff='$troff'
23766ttyname_r_proto='$ttyname_r_proto'
23767u16size='$u16size'
23768u16type='$u16type'
23769u32size='$u32size'
23770u32type='$u32type'
23771u64size='$u64size'
23772u64type='$u64type'
23773u8size='$u8size'
23774u8type='$u8type'
23775uidformat='$uidformat'
23776uidsign='$uidsign'
23777uidsize='$uidsize'
23778uidtype='$uidtype'
23779uname='$uname'
23780uniq='$uniq'
23781uquadtype='$uquadtype'
23782use5005threads='$use5005threads'
23783use64bitall='$use64bitall'
23784use64bitint='$use64bitint'
23785usecrosscompile='$usecrosscompile'
23786usedevel='$usedevel'
23787usedl='$usedl'
23788usedtrace='$usedtrace'
23789usefaststdio='$usefaststdio'
23790useithreads='$useithreads'
23791usekernprocpathname='$usekernprocpathname'
23792uselargefiles='$uselargefiles'
23793uselongdouble='$uselongdouble'
23794usemallocwrap='$usemallocwrap'
23795usemorebits='$usemorebits'
23796usemultiplicity='$usemultiplicity'
23797usemymalloc='$usemymalloc'
23798usenm='$usenm'
23799usensgetexecutablepath='$usensgetexecutablepath'
23800useopcode='$useopcode'
23801useperlio='$useperlio'
23802useposix='$useposix'
23803usereentrant='$usereentrant'
23804userelocatableinc='$userelocatableinc'
23805usesfio='$usesfio'
23806useshrplib='$useshrplib'
23807usesitecustomize='$usesitecustomize'
23808usesocks='$usesocks'
23809usethreads='$usethreads'
23810usevendorprefix='$usevendorprefix'
23811usevfork='$usevfork'
23812usrinc='$usrinc'
23813uuname='$uuname'
23814uvXUformat='$uvXUformat'
23815uvoformat='$uvoformat'
23816uvsize='$uvsize'
23817uvtype='$uvtype'
23818uvuformat='$uvuformat'
23819uvxformat='$uvxformat'
23820vaproto='$vaproto'
23821vendorarch='$vendorarch'
23822vendorarchexp='$vendorarchexp'
23823vendorbin='$vendorbin'
23824vendorbinexp='$vendorbinexp'
23825vendorhtml1dir='$vendorhtml1dir'
23826vendorhtml1direxp='$vendorhtml1direxp'
23827vendorhtml3dir='$vendorhtml3dir'
23828vendorhtml3direxp='$vendorhtml3direxp'
23829vendorlib='$vendorlib'
23830vendorlib_stem='$vendorlib_stem'
23831vendorlibexp='$vendorlibexp'
23832vendorman1dir='$vendorman1dir'
23833vendorman1direxp='$vendorman1direxp'
23834vendorman3dir='$vendorman3dir'
23835vendorman3direxp='$vendorman3direxp'
23836vendorprefix='$vendorprefix'
23837vendorprefixexp='$vendorprefixexp'
23838vendorscript='$vendorscript'
23839vendorscriptexp='$vendorscriptexp'
23840version='$version'
23841version_patchlevel_string='$version_patchlevel_string'
23842versiononly='$versiononly'
23843vi='$vi'
23844voidflags='$voidflags'
23845xlibpth='$xlibpth'
23846yacc='$yacc'
23847yaccflags='$yaccflags'
23848zcat='$zcat'
23849zip='$zip'
23850EOT
23851
23852: add special variables
23853$test -f $src/patchlevel.h && \
23854awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23855echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23856echo "PERL_CONFIG_SH=true" >>config.sh
23857
23858: propagate old symbols
23859if $test -f UU/config.sh; then
23860	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
23861	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23862		config.sh config.sh UU/oldconfig.sh |\
23863		$sort | $uniq -u >UU/oldsyms
23864	set X `$cat UU/oldsyms`
23865	shift
23866	case $# in
23867	0) ;;
23868	*)
23869		$cat <<EOM
23870Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23871EOM
23872		echo ": Variables propagated from previous config.sh file." >>config.sh
23873		for sym in `$cat UU/oldsyms`; do
23874			echo "    Propagating $hint variable "'$'"$sym..."
23875			eval 'tmp="$'"${sym}"'"'
23876			echo "$tmp" | \
23877				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23878		done
23879		;;
23880	esac
23881fi
23882
23883: Finish up by extracting the .SH files
23884case "$alldone" in
23885exit)
23886	$rm -rf UU
23887	echo "Extraction done."
23888	exit 0
23889	;;
23890cont)
23891	;;
23892'')
23893	dflt=''
23894	nostick=true
23895	$cat <<EOM
23896
23897If you'd like to make any changes to the config.sh file before I begin
23898to configure things, do it as a shell escape now (e.g. !vi config.sh).
23899
23900EOM
23901	rp="Press return or use a shell escape to edit config.sh:"
23902	. UU/myread
23903	nostick=''
23904	case "$ans" in
23905	'') ;;
23906	*) : in case they cannot read
23907		sh 1>&4 -c "$ans";;
23908	esac
23909	;;
23910esac
23911
23912: if this fails, just run all the .SH files by hand
23913. ./config.sh
23914
23915echo " "
23916exec 1>&4
23917pwd=`pwd`
23918. ./UU/extract
23919cd "$pwd"
23920
23921if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23922	dflt=y
23923	case "$silent" in
23924	true) ;;
23925	*)
23926		$cat <<EOM
23927
23928Now you need to generate make dependencies by running "$make depend".
23929You might prefer to run it in background: "$make depend > makedepend.out &"
23930It can take a while, so you might not want to run it right now.
23931
23932EOM
23933		;;
23934	esac
23935	rp="Run $make depend now?"
23936	. UU/myread
23937	case "$ans" in
23938	y*)
23939		$make depend && echo "Now you must run '$make'."
23940		;;
23941	*)
23942		echo "You must run '$make depend' then '$make'."
23943		;;
23944	esac
23945elif test -f [Mm]akefile; then
23946	echo " "
23947	echo "Now you must run a $make."
23948else
23949	echo "Configure done."
23950fi
23951
23952if $test -f Policy.sh; then
23953    $cat <<EOM
23954
23955If you compile $package on a different machine or from a different object
23956directory, copy the Policy.sh file from this object directory to the
23957new one before you run Configure -- this will help you with most of
23958the policy defaults.
23959
23960EOM
23961fi
23962if $test -f config.msg; then
23963    echo "Hmm.  I also noted the following information while running:"
23964    echo " "
23965    $cat config.msg >&4
23966    $rm -f config.msg
23967fi
23968$rm -f kit*isdone ark*isdone
23969$rm -rf UU
23970
23971: End of Configure
23972
23973