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 by the tool
15# called "metaconfig". Rather than working with this copy of Configure,
16# you should use metaconfig. Perl uses a modified version of this
17# tool, and this, together with the metaconfig units, are available
18# in the git repository:
19#    $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20# The original dist package (including metaconfig) is available on github:
21#    $ git clone https://github.com/rmanfredi/dist.git dist-git
22#
23# Though this script was generated by metaconfig from metaunits, it is
24# OK to send patches against Configure itself (but not to commit them
25# to blead). It's up to
26# the Configure maintainers to backport the patch to the metaunits if it
27# is accepted. Exceptions to this rule, and more information, is in
28# Porting/pumpkin.pod.
29
30# Generated using [metaconfig 3.5 PL0]
31# with additional metaconfig patches from https://github.com/Perl/metaconfig
32
33cat >c1$$ <<EOF
34ARGGGHHHH!!!!!
35
36SCO csh still thinks true is false.  Write to SCO today and tell them that next
37year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42[End of diatribe. We now return you to your regularly scheduled programming...]
43EOF
44cat >c2$$ <<EOF
45
46OOPS!  You naughty creature!  You didn't run Configure with sh!
47I will attempt to remedy the situation by running sh for you...
48EOF
49
50true || cat c1$$ c2$$
51true || exec sh $0 $argv:q
52
53(exit $?0) || cat c2$$
54(exit $?0) || exec sh $0 $argv:q
55rm -f c1$$ c2$$
56
57if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58	cat <<EOF
59***
60*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62*** Please read the README.plan9 for further instructions.
63*** Cannot continue, aborting.
64***
65EOF
66	exit 1
67fi
68
69if test -f /sys/utilities/MultiView ; then
70	# AmigaOS, test -c for /dev/null is not useful
71	:
72elif test ! -c /dev/null ; then
73	cat <<EOF
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81	exit 1
82fi
83
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89	test "$me" || me=$0
90	;;
91esac
92
93: Proper separator for the PATH environment variable
94p_=:
95: On OS/2 this directory should exist if this is not floppy only system ":-]"
96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97	if test -n "$OS2_SHELL"; then
98		p_=\;
99		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101		is_os2=yes
102	elif test -n "$DJGPP"; then
103		case "X${MACHTYPE:-nonesuchmach}" in
104		*cygwin|*msys) ;;
105		*) p_=\; ;;
106		esac
107	fi
108fi
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
119paths="$paths /system/gnu_library/bin"
120
121for p in $paths
122do
123	case "$p_$PATH$p_" in
124	*$p_$p$p_*) ;;
125	*) test -d $p && PATH=$PATH$p_$p ;;
126	esac
127done
128
129PATH=.$p_$PATH
130export PATH
131
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
138if (PATH=.; alias -x) >/dev/null 2>&1; then
139		inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142	needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145	if test X`/usr/bin/uname -v` = X4; then
146		avoidksh="to avoid AIX 4's /bin/sh"
147		newsh=/usr/bin/bsh
148	fi
149fi
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151	if test X`/usr/bin/uname -s` = XOSF1; then
152		avoidksh="to avoid Digital UNIX' ksh"
153		newsh=/bin/sh
154		unset BIN_SH
155	fi
156fi
157case "$inksh/$needksh" in
158/[a-z]*)
159		ENV=''
160		changesh=true
161		reason="$needksh"
162	;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166	changesh=true
167	reason="$avoidksh"
168	;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
172		cat <<EOM
173(I see you are using the Korn shell.  Some ksh's blow up on $me,
174mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175EOM
176	;;
177esac
178case "$changesh" in
179true)
180	export newsh
181	echo "(Feeding myself to $newsh $reason.)"
182	case "$0" in
183	Configure|*/Configure) exec $newsh $0 "$@";;
184	*) exec $newsh Configure "$@";;
185	esac
186	;;
187esac
188test -x "${newsh}" || unset newsh
189
190: if needed, set CDPATH to a harmless value that is not chatty
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'')	;;
194*)	case "$SHELL" in
195	*bash*) CDPATH='.' ;;
196	*) CDPATH='' ;;
197	esac
198	;;
199esac
200
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
203cd UU && rm -f ./*
204
205ccname=''
206ccversion=''
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
210from=''
211hostgenerate=''
212hostosname=''
213hostperl=''
214run=''
215targetarch=''
216targetdir=''
217targetenv=''
218targethost=''
219targetmkdir=''
220targetport=''
221to=''
222usecrosscompile=''
223extern_C=''
224mistrustnm=''
225usedevel=''
226perllibs=''
227dynamic_ext=''
228extensions=''
229known_extensions=''
230nonxs_ext=''
231static_ext=''
232uselanginfo=''
233useopcode=''
234useposix=''
235extras=''
236d_bsd=''
237d_eunice=''
238d_xenix=''
239eunicefix=''
240ar=''
241awk=''
242bash=''
243bison=''
244byacc=''
245cat=''
246chgrp=''
247chmod=''
248chown=''
249comm=''
250compress=''
251cp=''
252cpio=''
253cpp=''
254csh=''
255date=''
256echo=''
257egrep=''
258emacs=''
259expr=''
260find=''
261flex=''
262gmake=''
263grep=''
264gzip=''
265inews=''
266ksh=''
267less=''
268line=''
269lint=''
270ln=''
271lp=''
272lpr=''
273ls=''
274mail=''
275mailx=''
276make=''
277mkdir=''
278more=''
279mv=''
280nm=''
281nroff=''
282perl=''
283pg=''
284pmake=''
285pr=''
286rm=''
287rmail=''
288sed=''
289sendmail=''
290shar=''
291sleep=''
292smail=''
293sort=''
294submit=''
295tail=''
296tar=''
297tbl=''
298tee=''
299test=''
300touch=''
301tr=''
302troff=''
303uname=''
304uniq=''
305uuname=''
306vi=''
307zcat=''
308zip=''
309full_ar=''
310full_sed=''
311libswanted=''
312hint=''
313myuname=''
314osname=''
315osvers=''
316Author=''
317Date=''
318Header=''
319Id=''
320Locker=''
321Log=''
322RCSfile=''
323Revision=''
324Source=''
325State=''
326sysroot=''
327_a=''
328_exe=''
329_o=''
330archobjs=''
331exe_ext=''
332firstmakefile=''
333lib_ext=''
334obj_ext=''
335path_sep=''
336rm_try=''
337afs=''
338afsroot=''
339alignbytes=''
340archlib=''
341archlibexp=''
342d_archlib=''
343installarchlib=''
344archname=''
345myarchname=''
346useversionedarchname=''
347d_atolf=''
348d_atoll=''
349baserev=''
350bin=''
351binexp=''
352initialinstalllocation=''
353installbin=''
354userelocatableinc=''
355byteorder=''
356cc=''
357ccflags=''
358cppflags=''
359ldflags=''
360lkflags=''
361locincpth=''
362optimize=''
363cf_email=''
364cf_by=''
365cf_time=''
366charbits=''
367charsize=''
368contains=''
369cpp_stuff=''
370cpplast=''
371cppminus=''
372cpprun=''
373cppstdin=''
374d__fwalk=''
375d_accept4=''
376d_access=''
377d_accessx=''
378d_acosh=''
379d_aintl=''
380d_alarm=''
381asctime_r_proto=''
382d_asctime_r=''
383d_asinh=''
384d_atanh=''
385d_attribute_always_inline=''
386d_attribute_deprecated=''
387d_attribute_format=''
388d_attribute_malloc=''
389d_attribute_nonnull=''
390d_attribute_noreturn=''
391d_attribute_pure=''
392d_attribute_unused=''
393d_attribute_warn_unused_result=''
394d_printf_format_null=''
395d_backtrace=''
396d_builtin_choose_expr=''
397d_builtin_expect=''
398d_builtin_add_overflow=''
399d_builtin_mul_overflow=''
400d_builtin_sub_overflow=''
401d_c99_variadic_macros=''
402d_casti32=''
403castflags=''
404d_castneg=''
405d_cbrt=''
406d_chown=''
407d_chroot=''
408d_chsize=''
409d_class=''
410d_clearenv=''
411d_closedir=''
412d_void_closedir=''
413d_cmsghdr_s=''
414d_copysign=''
415d_copysignl=''
416d_cplusplus=''
417cryptlib=''
418d_crypt=''
419crypt_r_proto=''
420d_crypt_r=''
421d_csh=''
422full_csh=''
423d_ctermid=''
424ctermid_r_proto=''
425d_ctermid_r=''
426ctime_r_proto=''
427d_ctime_r=''
428d_cuserid=''
429d_dbminitproto=''
430d_difftime=''
431d_dir_dd_fd=''
432d_dirfd=''
433d_dladdr=''
434d_dlerror=''
435d_dlopen=''
436d_dlsymun=''
437d_dosuid=''
438d_suidsafe=''
439d_drand48_r=''
440drand48_r_proto=''
441d_drand48proto=''
442d_dup2=''
443d_dup3=''
444d_eaccess=''
445d_endgrent=''
446d_endgrent_r=''
447endgrent_r_proto=''
448d_endhent=''
449d_endhostent_r=''
450endhostent_r_proto=''
451d_endnent=''
452d_endnetent_r=''
453endnetent_r_proto=''
454d_endpent=''
455d_endprotoent_r=''
456endprotoent_r_proto=''
457d_endpwent=''
458d_endpwent_r=''
459endpwent_r_proto=''
460d_endsent=''
461d_endservent_r=''
462endservent_r_proto=''
463d_erf=''
464d_erfc=''
465d_exp2=''
466d_expm1=''
467d_faststdio=''
468d_fchdir=''
469d_fchmod=''
470d_fchown=''
471d_fcntl=''
472d_fcntl_can_lock=''
473d_fd_macros=''
474d_fd_set=''
475d_fds_bits=''
476d_fdclose=''
477d_fdim=''
478d_fegetround=''
479d_fgetpos=''
480d_finite=''
481d_finitel=''
482d_flexfnam=''
483d_flock=''
484d_flockproto=''
485d_fma=''
486d_fmax=''
487d_fmin=''
488d_fork=''
489d_fp_class=''
490d_fp_classl=''
491d_fpclass=''
492d_fp_classify=''
493d_fpclassify=''
494d_fpclassl=''
495d_fpgetround=''
496d_fpos64_t=''
497d_frexpl=''
498d_fs_data_s=''
499d_fchmodat=''
500d_linkat=''
501d_openat=''
502d_renameat=''
503d_unlinkat=''
504d_fseeko=''
505d_fsetpos=''
506d_fstatfs=''
507d_fsync=''
508d_ftello=''
509d_ftime=''
510d_gettimeod=''
511d_futimes=''
512d_gai_strerror=''
513d_Gconvert=''
514d_getaddrinfo=''
515d_getcwd=''
516d_getespwnam=''
517d_getfsstat=''
518d_getgrent=''
519d_getgrent_r=''
520getgrent_r_proto=''
521d_getgrgid_r=''
522getgrgid_r_proto=''
523d_getgrnam_r=''
524getgrnam_r_proto=''
525d_getgrps=''
526d_gethbyaddr=''
527d_gethbyname=''
528d_gethent=''
529aphostname=''
530d_gethname=''
531d_phostname=''
532d_uname=''
533d_gethostbyaddr_r=''
534gethostbyaddr_r_proto=''
535d_gethostbyname_r=''
536gethostbyname_r_proto=''
537d_gethostent_r=''
538gethostent_r_proto=''
539d_gethostprotos=''
540d_getitimer=''
541d_getlogin=''
542d_getlogin_r=''
543getlogin_r_proto=''
544d_getmnt=''
545d_getmntent=''
546d_getnameinfo=''
547d_getnbyaddr=''
548d_getnbyname=''
549d_getnent=''
550d_getnetbyaddr_r=''
551getnetbyaddr_r_proto=''
552d_getnetbyname_r=''
553getnetbyname_r_proto=''
554d_getnetent_r=''
555getnetent_r_proto=''
556d_getnetprotos=''
557d_getpagsz=''
558d_getpent=''
559d_getpgid=''
560d_getpgrp2=''
561d_bsdgetpgrp=''
562d_getpgrp=''
563d_getppid=''
564d_getprior=''
565d_getpbyname=''
566d_getpbynumber=''
567d_getprotobyname_r=''
568getprotobyname_r_proto=''
569d_getprotobynumber_r=''
570getprotobynumber_r_proto=''
571d_getprotoent_r=''
572getprotoent_r_proto=''
573d_getprotoprotos=''
574d_getprpwnam=''
575d_getpwent=''
576d_getpwent_r=''
577getpwent_r_proto=''
578d_getpwnam_r=''
579getpwnam_r_proto=''
580d_getpwuid_r=''
581getpwuid_r_proto=''
582d_getsent=''
583d_getservbyname_r=''
584getservbyname_r_proto=''
585d_getservbyport_r=''
586getservbyport_r_proto=''
587d_getservent_r=''
588getservent_r_proto=''
589d_getservprotos=''
590d_getspnam=''
591d_getspnam_r=''
592getspnam_r_proto=''
593d_getsbyname=''
594d_getsbyport=''
595d_gmtime_r=''
596gmtime_r_proto=''
597d_gnulibc=''
598gnulibc_version=''
599d_hasmntopt=''
600d_htonl=''
601d_hypot=''
602d_ilogb=''
603d_ilogbl=''
604d_inetaton=''
605d_inetntop=''
606d_inetpton=''
607d_int64_t=''
608d_isascii=''
609d_isblank=''
610d_isfinite=''
611d_isfinitel=''
612d_isinf=''
613d_isinfl=''
614d_isless=''
615d_isnan=''
616d_isnanl=''
617d_isnormal=''
618d_j0=''
619d_j0l=''
620d_killpg=''
621d_lc_monetary_2008=''
622d_lchown=''
623d_ldbl_dig=''
624d_lgamma=''
625d_lgamma_r=''
626d_libm_lib_version=''
627d_link=''
628d_llrint=''
629d_llrintl=''
630d_llround=''
631d_llroundl=''
632d_localeconv_l=''
633d_localtime_r=''
634d_localtime_r_needs_tzset=''
635localtime_r_proto=''
636d_locconv=''
637d_lockf=''
638d_log1p=''
639d_log2=''
640d_logb=''
641d_ldexpl=''
642d_long_double_style_ieee=''
643d_long_double_style_ieee_doubledouble=''
644d_long_double_style_ieee_extended=''
645d_long_double_style_ieee_std=''
646d_long_double_style_vax=''
647d_longdbl=''
648longdblkind=''
649longdblsize=''
650d_longlong=''
651longlongsize=''
652d_lrint=''
653d_lrintl=''
654d_lround=''
655d_lroundl=''
656d_lseekproto=''
657d_lstat=''
658d_madvise=''
659d_malloc_good_size=''
660d_malloc_size=''
661d_malloc_usable_size=''
662d_mblen=''
663d_mbrlen=''
664d_mbrtowc=''
665d_mbstowcs=''
666d_mbtowc=''
667d_memmem=''
668d_memrchr=''
669d_mkdir=''
670d_mkdtemp=''
671d_mkfifo=''
672d_mkostemp=''
673d_mkstemp=''
674d_mkstemps=''
675d_mktime=''
676d_mmap=''
677mmaptype=''
678d_modfl=''
679d_modflproto=''
680d_mprotect=''
681d_msg=''
682d_msgctl=''
683d_msgget=''
684d_msghdr_s=''
685d_msgrcv=''
686d_msgsnd=''
687d_msync=''
688d_munmap=''
689d_nan=''
690d_nanosleep=''
691d_nearbyint=''
692d_duplocale=''
693d_freelocale=''
694d_newlocale=''
695d_querylocale=''
696d_uselocale=''
697i_xlocale=''
698d_nextafter=''
699d_nexttoward=''
700d_nice=''
701d_nl_langinfo=''
702d_thread_safe_nl_langinfo_l=''
703d_off64_t=''
704d_open3=''
705d_fpathconf=''
706d_pathconf=''
707d_pause=''
708d_pipe2=''
709d_pipe=''
710d_poll=''
711d_portable=''
712d_prctl=''
713d_prctl_set_name=''
714d_procselfexe=''
715procselfexe=''
716d_old_pthread_create_joinable=''
717old_pthread_create_joinable=''
718d_pthread_atfork=''
719d_pthread_attr_setscope=''
720d_pthread_yield=''
721d_sched_yield=''
722sched_yield=''
723d_ptrdiff_t=''
724d_qgcvt=''
725d_random_r=''
726random_r_proto=''
727d_readdir64_r=''
728readdir64_r_proto=''
729d_readdir=''
730d_rewinddir=''
731d_seekdir=''
732d_telldir=''
733d_readdir_r=''
734readdir_r_proto=''
735d_readlink=''
736d_readv=''
737d_recvmsg=''
738d_re_comp=''
739d_regcmp=''
740d_regcomp=''
741d_remainder=''
742d_remquo=''
743d_rename=''
744d_rint=''
745d_rmdir=''
746d_round=''
747d_sbrkproto=''
748d_scalbn=''
749d_scalbnl=''
750d_select=''
751d_sem=''
752d_semctl=''
753d_semget=''
754d_semop=''
755d_sendmsg=''
756d_setegid=''
757d_seteuid=''
758d_setgrent=''
759d_setgrent_r=''
760setgrent_r_proto=''
761d_setgrps=''
762d_sethent=''
763d_sethostent_r=''
764sethostent_r_proto=''
765d_setitimer=''
766d_setlinebuf=''
767d_has_C_UTF8=''
768d_setlocale=''
769d_setlocale_accepts_any_locale_name=''
770d_setlocale_r=''
771setlocale_r_proto=''
772d_setnent=''
773d_setnetent_r=''
774setnetent_r_proto=''
775d_setpent=''
776d_setpgid=''
777d_setpgrp2=''
778d_bsdsetpgrp=''
779d_setpgrp=''
780d_setprior=''
781d_setproctitle=''
782d_setprotoent_r=''
783setprotoent_r_proto=''
784d_setpwent=''
785d_setpwent_r=''
786setpwent_r_proto=''
787d_setregid=''
788d_setresgid=''
789d_setresuid=''
790d_setreuid=''
791d_setrgid=''
792d_setruid=''
793d_setsent=''
794d_setservent_r=''
795setservent_r_proto=''
796d_setsid=''
797d_setvbuf=''
798d_shm=''
799d_shmat=''
800d_shmatprototype=''
801shmattype=''
802d_shmctl=''
803d_shmdt=''
804d_shmget=''
805d_sigaction=''
806d_siginfo_si_addr=''
807d_siginfo_si_band=''
808d_siginfo_si_errno=''
809d_siginfo_si_fd=''
810d_siginfo_si_pid=''
811d_siginfo_si_status=''
812d_siginfo_si_uid=''
813d_siginfo_si_value=''
814d_signbit=''
815d_sigprocmask=''
816d_sigsetjmp=''
817usesitecustomize=''
818d_snprintf=''
819d_vsnprintf=''
820d_sockatmark=''
821d_sockatmarkproto=''
822d_ip_mreq=''
823d_ip_mreq_source=''
824d_ipv6_mreq=''
825d_ipv6_mreq_source=''
826d_msg_ctrunc=''
827d_msg_dontroute=''
828d_msg_oob=''
829d_msg_peek=''
830d_msg_proxy=''
831d_oldsock=''
832d_scm_rights=''
833d_sin6_scope_id=''
834d_sockaddr_in6=''
835d_sockaddr_sa_len=''
836d_sockaddr_storage=''
837d_socket=''
838d_sockpair=''
839sockethdr=''
840socketlib=''
841d_socklen_t=''
842d_socks5_init=''
843d_sqrtl=''
844d_srand48_r=''
845srand48_r_proto=''
846d_srandom_r=''
847srandom_r_proto=''
848d_sresgproto=''
849d_sresuproto=''
850d_stat=''
851d_statblks=''
852d_statfs_f_flags=''
853d_statfs_s=''
854d_static_inline=''
855perl_static_inline=''
856d_fstatvfs=''
857d_statvfs=''
858d_stdio_cnt_lval=''
859d_stdio_ptr_lval=''
860d_stdio_ptr_lval_nochange_cnt=''
861d_stdio_ptr_lval_sets_cnt=''
862d_stdiobase=''
863d_stdstdio=''
864stdio_base=''
865stdio_bufsiz=''
866stdio_cnt=''
867stdio_filbuf=''
868stdio_ptr=''
869d_strcoll=''
870d_sysernlst=''
871d_syserrlst=''
872d_strerror_l=''
873d_strerror_r=''
874strerror_r_proto=''
875d_strftime=''
876d_strlcat=''
877d_strlcpy=''
878d_strnlen=''
879d_strtod=''
880d_strtod_l=''
881d_strtol=''
882d_strtold=''
883d_strtold_l=''
884d_strtoll=''
885d_strtoq=''
886d_strtoul=''
887d_strtoull=''
888d_strtouq=''
889d_strxfrm=''
890d_symlink=''
891d_syscall=''
892d_syscallproto=''
893d_sysconf=''
894d_system=''
895d_tcgetpgrp=''
896d_tcsetpgrp=''
897d_telldirproto=''
898d_tgamma=''
899d_time=''
900timetype=''
901d_asctime64=''
902d_ctime64=''
903d_difftime64=''
904d_gmtime64=''
905d_localtime64=''
906d_mktime64=''
907d_timegm=''
908clocktype=''
909d_times=''
910d_tmpnam_r=''
911tmpnam_r_proto=''
912d_towlower=''
913d_towupper=''
914d_trunc=''
915d_truncate=''
916d_truncl=''
917d_ttyname_r=''
918ttyname_r_proto=''
919d_tzname=''
920d_u32align=''
921d_ualarm=''
922d_umask=''
923d_semctl_semid_ds=''
924d_semctl_semun=''
925d_union_semun=''
926d_unordered=''
927d_unsetenv=''
928d_usleep=''
929d_usleepproto=''
930d_ustat=''
931d_pseudofork=''
932d_vfork=''
933usevfork=''
934d_voidsig=''
935signal_t=''
936d_wait4=''
937d_waitpid=''
938d_wcrtomb=''
939d_wcscmp=''
940d_wcstombs=''
941d_wcsxfrm=''
942d_wctomb=''
943d_writev=''
944default_inc_excludes_dot=''
945dlext=''
946bin_ELF=''
947cccdlflags=''
948ccdlflags=''
949dlsrc=''
950ld=''
951ld_can_script=''
952lddlflags=''
953usedl=''
954doublesize=''
955dtraceobject=''
956dtracexnolibs=''
957ebcdic=''
958fflushNULL=''
959fflushall=''
960fpossize=''
961fpostype=''
962gccansipedantic=''
963gccosandvers=''
964gccversion=''
965gidformat=''
966gidsign=''
967gidsize=''
968gidtype=''
969groupstype=''
970h_fcntl=''
971h_sysfile=''
972html1dir=''
973html1direxp=''
974installhtml1dir=''
975html3dir=''
976html3direxp=''
977installhtml3dir=''
978i_arpainet=''
979i_bfd=''
980i_crypt=''
981db_hashtype=''
982db_prefixtype=''
983db_version_major=''
984db_version_minor=''
985db_version_patch=''
986i_db=''
987i_dbm=''
988i_rpcsvcdbm=''
989d_dirnamlen=''
990direntrytype=''
991i_dirent=''
992i_dlfcn=''
993i_execinfo=''
994i_fcntl=''
995i_fenv=''
996i_fp=''
997i_fp_class=''
998i_gdbm=''
999d_grpasswd=''
1000i_grp=''
1001i_ieeefp=''
1002i_inttypes=''
1003i_langinfo=''
1004i_libutil=''
1005i_locale=''
1006i_machcthr=''
1007i_malloc=''
1008i_mallocmalloc=''
1009i_mntent=''
1010d_gdbm_ndbm_h_uses_prototypes=''
1011d_gdbmndbm_h_uses_prototypes=''
1012d_ndbm=''
1013d_ndbm_h_uses_prototypes=''
1014i_gdbm_ndbm=''
1015i_gdbmndbm=''
1016i_ndbm=''
1017i_netdb=''
1018i_neterrno=''
1019i_netinettcp=''
1020i_niin=''
1021i_sysin=''
1022i_poll=''
1023i_prot=''
1024i_pthread=''
1025d_pwage=''
1026d_pwchange=''
1027d_pwclass=''
1028d_pwcomment=''
1029d_pwexpire=''
1030d_pwgecos=''
1031d_pwpasswd=''
1032d_pwquota=''
1033i_pwd=''
1034i_quadmath=''
1035i_shadow=''
1036i_socks=''
1037i_stdbool=''
1038i_stdint=''
1039i_stdlib=''
1040i_sunmath=''
1041i_sysaccess=''
1042i_sysdir=''
1043i_sysfile=''
1044d_voidtty=''
1045i_bsdioctl=''
1046i_sysfilio=''
1047i_sysioctl=''
1048i_syssockio=''
1049i_syslog=''
1050i_sysmman=''
1051i_sysmode=''
1052i_sysmount=''
1053i_sysndir=''
1054i_sysparam=''
1055i_syspoll=''
1056i_sysresrc=''
1057i_syssecrt=''
1058i_sysselct=''
1059i_sysstat=''
1060i_sysstatfs=''
1061i_sysstatvfs=''
1062i_systimes=''
1063i_systypes=''
1064i_sysuio=''
1065i_sysun=''
1066i_sysutsname=''
1067i_sysvfs=''
1068i_syswait=''
1069i_sgtty=''
1070i_termio=''
1071i_termios=''
1072d_tm_tm_gmtoff=''
1073d_tm_tm_zone=''
1074i_systime=''
1075i_systimek=''
1076i_time=''
1077timeincl=''
1078i_unistd=''
1079i_ustat=''
1080i_utime=''
1081i_vfork=''
1082i_wchar=''
1083i_wctype=''
1084d_inc_version_list=''
1085inc_version_list=''
1086inc_version_list_init=''
1087doubleinfbytes=''
1088doublenanbytes=''
1089longdblinfbytes=''
1090longdblnanbytes=''
1091installprefix=''
1092installprefixexp=''
1093installstyle=''
1094installusrbinperl=''
1095intsize=''
1096longsize=''
1097shortsize=''
1098issymlink=''
1099libc=''
1100ldlibpthname=''
1101libperl=''
1102shrpenv=''
1103useshrplib=''
1104glibpth=''
1105incpth=''
1106libpth=''
1107loclibpth=''
1108plibpth=''
1109xlibpth=''
1110ignore_versioned_solibs=''
1111libs=''
1112libsdirs=''
1113libsfiles=''
1114libsfound=''
1115libspath=''
1116lns=''
1117d_PRIEUldbl=''
1118d_PRIFUldbl=''
1119d_PRIGUldbl=''
1120d_PRIeldbl=''
1121d_PRIfldbl=''
1122d_PRIgldbl=''
1123d_SCNfldbl=''
1124d_double_has_inf=''
1125d_double_has_nan=''
1126d_double_has_negative_zero=''
1127d_double_has_subnormals=''
1128d_double_style_cray=''
1129d_double_style_ibm=''
1130d_double_style_ieee=''
1131d_double_style_vax=''
1132doublekind=''
1133sPRIEUldbl=''
1134sPRIFUldbl=''
1135sPRIGUldbl=''
1136sPRIeldbl=''
1137sPRIfldbl=''
1138sPRIgldbl=''
1139sSCNfldbl=''
1140lseeksize=''
1141lseektype=''
1142make_set_make=''
1143d_mymalloc=''
1144freetype=''
1145mallocobj=''
1146mallocsrc=''
1147malloctype=''
1148usemallocwrap=''
1149usemymalloc=''
1150installman1dir=''
1151man1dir=''
1152man1direxp=''
1153man1ext=''
1154installman3dir=''
1155man3dir=''
1156man3direxp=''
1157man3ext=''
1158doublemantbits=''
1159longdblmantbits=''
1160nvmantbits=''
1161modetype=''
1162multiarch=''
1163mydomain=''
1164myhostname=''
1165phostname=''
1166c=''
1167n=''
1168d_eofnblk=''
1169eagain=''
1170o_nonblock=''
1171rd_nodata=''
1172need_va_copy=''
1173netdb_hlen_type=''
1174netdb_host_type=''
1175netdb_name_type=''
1176netdb_net_type=''
1177groupcat=''
1178hostcat=''
1179passcat=''
1180orderlib=''
1181ranlib=''
1182d_perl_otherlibdirs=''
1183otherlibdirs=''
1184package=''
1185spackage=''
1186pager=''
1187api_revision=''
1188api_subversion=''
1189api_version=''
1190api_versionstring=''
1191patchlevel=''
1192perl_patchlevel=''
1193revision=''
1194subversion=''
1195version=''
1196version_patchlevel_string=''
1197perl5=''
1198perladmin=''
1199perlpath=''
1200d_nv_preserves_uv=''
1201d_nv_zero_is_allbits_zero=''
1202i16size=''
1203i16type=''
1204i32size=''
1205i32type=''
1206i64size=''
1207i64type=''
1208i8size=''
1209i8type=''
1210ivsize=''
1211ivtype=''
1212nv_overflows_integers_at=''
1213nv_preserves_uv_bits=''
1214nvsize=''
1215nvtype=''
1216u16size=''
1217u16type=''
1218u32size=''
1219u32type=''
1220u64size=''
1221u64type=''
1222u8size=''
1223u8type=''
1224uvsize=''
1225uvtype=''
1226ivdformat=''
1227nvEUformat=''
1228nvFUformat=''
1229nvGUformat=''
1230nveformat=''
1231nvfformat=''
1232nvgformat=''
1233uvXUformat=''
1234uvoformat=''
1235uvuformat=''
1236uvxformat=''
1237pidtype=''
1238prefix=''
1239prefixexp=''
1240installprivlib=''
1241privlib=''
1242privlibexp=''
1243ptrsize=''
1244d_PRIXU64=''
1245d_PRId64=''
1246d_PRIi64=''
1247d_PRIo64=''
1248d_PRIu64=''
1249d_PRIx64=''
1250sPRIXU64=''
1251sPRId64=''
1252sPRIi64=''
1253sPRIo64=''
1254sPRIu64=''
1255sPRIx64=''
1256d_quad=''
1257quadkind=''
1258quadtype=''
1259uquadtype=''
1260drand01=''
1261randbits=''
1262randfunc=''
1263randseedtype=''
1264seedfunc=''
1265installscript=''
1266scriptdir=''
1267scriptdirexp=''
1268selectminbits=''
1269selecttype=''
1270sh=''
1271targetsh=''
1272sig_count=''
1273sig_name=''
1274sig_name_init=''
1275sig_num=''
1276sig_num_init=''
1277sig_size=''
1278d_sitearch=''
1279installsitearch=''
1280sitearch=''
1281sitearchexp=''
1282installsitebin=''
1283sitebin=''
1284sitebinexp=''
1285installsitehtml1dir=''
1286sitehtml1dir=''
1287sitehtml1direxp=''
1288installsitehtml3dir=''
1289sitehtml3dir=''
1290sitehtml3direxp=''
1291installsitelib=''
1292sitelib=''
1293sitelib_stem=''
1294sitelibexp=''
1295installsiteman1dir=''
1296siteman1dir=''
1297siteman1direxp=''
1298installsiteman3dir=''
1299siteman3dir=''
1300siteman3direxp=''
1301siteprefix=''
1302siteprefixexp=''
1303installsitescript=''
1304sitescript=''
1305sitescriptexp=''
1306sizesize=''
1307sizetype=''
1308d_libname_unique=''
1309so=''
1310socksizetype=''
1311sharpbang=''
1312shsharp=''
1313spitshell=''
1314src=''
1315ssizetype=''
1316st_ino_sign=''
1317st_ino_size=''
1318startperl=''
1319startsh=''
1320stdchar=''
1321d_stdio_stream_array=''
1322stdio_stream_array=''
1323sysman=''
1324sGMTIME_max=''
1325sGMTIME_min=''
1326sLOCALTIME_max=''
1327sLOCALTIME_min=''
1328trnl=''
1329uidformat=''
1330uidsign=''
1331uidsize=''
1332uidtype=''
1333archname64=''
1334use64bitall=''
1335use64bitint=''
1336usecbacktrace=''
1337dtrace=''
1338usedtrace=''
1339usefaststdio=''
1340usekernprocpathname=''
1341ccflags_uselargefiles=''
1342ldflags_uselargefiles=''
1343libswanted_uselargefiles=''
1344uselargefiles=''
1345uselongdouble=''
1346usemorebits=''
1347usemultiplicity=''
1348nm_opt=''
1349nm_so_opt=''
1350runnm=''
1351usenm=''
1352usensgetexecutablepath=''
1353useperlio=''
1354usequadmath=''
1355usesocks=''
1356d_oldpthreads=''
1357use5005threads=''
1358useithreads=''
1359usereentrant=''
1360usethreads=''
1361incpath=''
1362mips_type=''
1363usrinc=''
1364d_vendorarch=''
1365installvendorarch=''
1366vendorarch=''
1367vendorarchexp=''
1368d_vendorbin=''
1369installvendorbin=''
1370vendorbin=''
1371vendorbinexp=''
1372installvendorhtml1dir=''
1373vendorhtml1dir=''
1374vendorhtml1direxp=''
1375installvendorhtml3dir=''
1376vendorhtml3dir=''
1377vendorhtml3direxp=''
1378d_vendorlib=''
1379installvendorlib=''
1380vendorlib=''
1381vendorlib_stem=''
1382vendorlibexp=''
1383installvendorman1dir=''
1384vendorman1dir=''
1385vendorman1direxp=''
1386installvendorman3dir=''
1387vendorman3dir=''
1388vendorman3direxp=''
1389usevendorprefix=''
1390vendorprefix=''
1391vendorprefixexp=''
1392d_vendorscript=''
1393installvendorscript=''
1394vendorscript=''
1395vendorscriptexp=''
1396versiononly=''
1397yacc=''
1398yaccflags=''
1399CONFIG=''
1400
1401: Detect odd OSs
1402define='define'
1403undef='undef'
1404smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1405rmlist=''
1406
1407: We must find out about Eunice early
1408eunicefix=':'
1409if test -f /etc/unixtovms; then
1410	eunicefix=/etc/unixtovms
1411fi
1412if test -f /etc/unixtovms.exe; then
1413	eunicefix=/etc/unixtovms.exe
1414fi
1415
1416: Set executable suffix now -- needed before hints available
1417if test -f "/libs/version.library"; then
1418: Amiga OS
1419    _exe=""
1420elif test -f "/system/gnu_library/bin/ar.pm"; then
1421: Stratus VOS
1422    _exe=".pm"
1423elif test -n "$DJGPP"; then
1424: DOS DJGPP
1425    _exe=".exe"
1426elif test -f /kern/cookiejar; then
1427: MiNT
1428    _exe=""
1429elif test -d c:/. -o -n "$is_os2" ; then
1430: OS/2 or cygwin
1431    _exe=".exe"
1432fi
1433
1434groupstype=''
1435i_whoami=''
1436: Possible local include directories to search.
1437: Set locincpth to "" in a hint file to defeat local include searches.
1438locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1439locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1440:
1441: no include file wanted by default
1442inclwanted=''
1443
1444: Enable -DEBUGGING and -DDEBUGGING from the command line
1445EBUGGING=''
1446DEBUGGING=''
1447
1448: Trailing extension.  Override this in a hint file, if needed.
1449: Extra object files, if any, needed on this platform.
1450archobjs=''
1451libnames=''
1452: change the next line if compiling for Xenix/286 on Xenix/386
1453xlibpth='/usr/lib/386 /lib/386'
1454: Possible local library directories to search.
1455loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1456loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1457
1458: general looking path for locating libraries
1459glibpth="/lib /usr/lib $xlibpth"
1460glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1461test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1462test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1463test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1464
1465: Private path used by Configure to find libraries.  Its value
1466: is prepended to libpth. This variable takes care of special
1467: machines, like the mips.  Usually, it should be empty.
1468plibpth=''
1469
1470: default library list
1471libswanted=''
1472: some systems want to use only the non-versioned libso:s
1473ignore_versioned_solibs=''
1474ccname=''
1475ccversion=''
1476perllibs=''
1477: set useposix=false in your hint file to disable the POSIX extension.
1478useposix=true
1479: set useopcode=false in your hint file to disable the Opcode extension.
1480useopcode=true
1481: set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1482uselanginfo=true
1483archname64=''
1484ccflags_uselargefiles=''
1485ldflags_uselargefiles=''
1486libswanted_uselargefiles=''
1487: set usemultiplicity on the Configure command line to enable multiplicity.
1488: set usesocks on the Configure command line to enable socks.
1489archname=''
1490: set usethreads on the Configure command line to enable threads.
1491usereentrant='undef'
1492: List of libraries we want.
1493: If anyone needs extra -lxxx, put those in a hint file.
1494libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1495libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1496: We probably want to search /usr/shlib before most other libraries.
1497: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1498glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1499glibpth="/usr/shlib $glibpth"
1500: Do not use vfork unless overridden by a hint file.
1501usevfork=false
1502
1503: Find the basic shell for Bourne shell scripts
1504case "$sh" in
1505'')
1506	case "$SYSTYPE" in
1507	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1508	*) xxx='/bin/sh';;
1509	esac
1510	if test -f "$xxx"; then
1511		sh="$xxx"
1512	else
1513		: Build up a list and do a single loop so we can 'break' out.
1514		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1515		for xxx in sh bash ksh pdksh ash; do
1516			for p in $pth; do
1517				try="$try ${p}/${xxx}"
1518			done
1519		done
1520		for xxx in $try; do
1521			if test -f "$xxx"; then
1522				sh="$xxx";
1523				break
1524			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1525				sh="$xxx";
1526				break
1527			elif test -f "$xxx.exe"; then
1528				sh="$xxx";
1529				break
1530			fi
1531		done
1532	fi
1533	;;
1534esac
1535
1536case "$sh" in
1537'')	cat >&2 <<EOM
1538$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1539
1540Usually it's in /bin/sh.  How did you even get this far?
1541Please report this issue at https://github.com/Perl/perl5/issues
1542and we'll try to straighten this all out.
1543EOM
1544	exit 1
1545	;;
1546esac
1547
1548: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1549: default both to the same thing, cross-compilers can then set targetsh differently if they like
1550targetsh=$sh
1551
1552: see if sh knows # comments
1553if `$sh -c '#' >/dev/null 2>&1`; then
1554	shsharp=true
1555	spitshell=cat
1556	xcat=/bin/cat
1557	test -f $xcat$_exe || xcat=/usr/bin/cat
1558	if test ! -f $xcat$_exe; then
1559		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1560			if test -f $p/cat$_exe; then
1561				xcat=$p/cat
1562				break
1563			fi
1564		done
1565		if test ! -f $xcat$_exe; then
1566			echo "Can't find cat anywhere!"
1567			exit 1
1568		fi
1569	fi
1570	echo "#!$xcat" >sharp
1571	$eunicefix sharp
1572	chmod +x sharp
1573	./sharp > today 2>/dev/null
1574	if test -s today; then
1575		sharpbang='#!'
1576	else
1577		echo "#! $xcat" > sharp
1578		$eunicefix sharp
1579		chmod +x sharp
1580		./sharp > today 2>/dev/null
1581		if test -s today; then
1582			sharpbang='#! '
1583		else
1584			sharpbang=': use '
1585		fi
1586	fi
1587else
1588	echo " "
1589	echo "Your $sh doesn't grok # comments--I will strip them later on."
1590	shsharp=false
1591	cd ..
1592	echo "exec grep -v '^[ 	]*#'" >spitshell
1593	chmod +x spitshell
1594	$eunicefix spitshell
1595	spitshell=`pwd`/spitshell
1596	cd UU
1597	echo "I presume that if # doesn't work, #! won't work either!"
1598	sharpbang=': use '
1599fi
1600rm -f sharp today
1601
1602: figure out how to guarantee sh startup
1603case "$startsh" in
1604'') startsh=${sharpbang}${sh} ;;
1605*)
1606esac
1607cat >sharp <<EOSS
1608$startsh
1609set abc
1610test "$?abc" != 1
1611EOSS
1612
1613chmod +x sharp
1614$eunicefix sharp
1615if ./sharp; then
1616	: echo "Yup, it does."
1617else
1618	echo "Hmm... '$startsh' does not guarantee sh startup..."
1619	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1620fi
1621rm -f sharp
1622
1623: Save command line options in file UU/cmdline.opt for later use in
1624: generating config.sh.
1625cat > cmdline.opt <<EOSH
1626: Configure command line arguments.
1627config_arg0='$0'
1628config_args='$*'
1629config_argc=$#
1630EOSH
1631argn=1
1632args_exp=''
1633args_sep=''
1634for arg in "$@"; do
1635	cat >>cmdline.opt <<EOSH
1636config_arg$argn='$arg'
1637EOSH
1638	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1639$arg
1640EOC
1641	arg_exp=`cat cmdl.opt`
1642	args_exp="$args_exp$args_sep'$arg_exp'"
1643	argn=`expr $argn + 1`
1644	args_sep=' '
1645done
1646rm -f cmdl.opt
1647
1648: produce awk script to parse command line options
1649cat >options.awk <<'EOF'
1650BEGIN {
1651	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1652
1653	len = length(optstr);
1654	for (i = 1; i <= len; i++) {
1655		c = substr(optstr, i, 1);
1656		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1657		if (a == ":") {
1658			arg[c] = 1;
1659			i++;
1660		}
1661		opt[c] = 1;
1662	}
1663}
1664{
1665	expect = 0;
1666	str = $0;
1667	if (substr(str, 1, 1) != "-") {
1668		printf("'%s'\n", str);
1669		next;
1670	}
1671	len = length($0);
1672	for (i = 2; i <= len; i++) {
1673		c = substr(str, i, 1);
1674		if (!opt[c]) {
1675			printf("-%s\n", substr(str, i));
1676			next;
1677		}
1678		printf("-%s\n", c);
1679		if (arg[c]) {
1680			if (i < len)
1681				printf("'%s'\n", substr(str, i + 1));
1682			else
1683				expect = 1;
1684			next;
1685		}
1686	}
1687}
1688END {
1689	if (expect)
1690		print "?";
1691}
1692EOF
1693
1694: process the command line options
1695set X `for arg in "$@"; do echo "X$arg"; done |
1696	sed -e s/X// | awk -f options.awk`
1697eval "set $*"
1698shift
1699rm -f options.awk
1700
1701: set up default values
1702fastread=''
1703reuseval=false
1704config_sh=''
1705alldone=''
1706error=''
1707silent=''
1708extractsh=''
1709knowitall=''
1710rm -f optdef.sh posthint.sh
1711cat >optdef.sh <<EOS
1712$startsh
1713EOS
1714
1715
1716: option parsing
1717while test $# -gt 0; do
1718	case "$1" in
1719	-d) shift; fastread=yes;;
1720	-e) shift; alldone=cont;;
1721	-f)
1722		shift
1723		cd ..
1724		if test -r "$1"; then
1725			config_sh="$1"
1726		else
1727			echo "$me: cannot read config file $1." >&2
1728			error=true
1729		fi
1730		cd UU
1731		shift;;
1732	--help|\
1733	-h) shift; error=true;;
1734	-r) shift; reuseval=true;;
1735	-s) shift; silent=true; realsilent=true;;
1736	-E) shift; alldone=exit;;
1737	-K) shift; knowitall=true;;
1738	-O) shift;;
1739	-S) shift; silent=true; extractsh=true;;
1740	-D)
1741		shift
1742		case "$1" in
1743		*=)
1744			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1745			echo "$me: ignoring -D $1" >&2
1746			;;
1747		*=*) echo "$1" | \
1748				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1749		*) echo "$1='define'" >> optdef.sh;;
1750		esac
1751		shift
1752		;;
1753	-U)
1754		shift
1755		case "$1" in
1756		*=) echo "$1" >> optdef.sh;;
1757		*=*)
1758			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1759			echo "$me: ignoring -U $1" >&2
1760			;;
1761		*) echo "$1='undef'" >> optdef.sh;;
1762		esac
1763		shift
1764		;;
1765	-A)
1766	    shift
1767	    xxx=''
1768	    yyy="$1"
1769	    zzz=''
1770	    uuu=undef
1771	    case "$yyy" in
1772            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1773                 case "$zzz" in
1774                 *:*) zzz='' ;;
1775                 *)   xxx=append
1776                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1777                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1778                 esac
1779                 ;;
1780            esac
1781            case "$xxx" in
1782            '')  case "$yyy" in
1783                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1784                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1785                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1786                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1787                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1788                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1789                 esac
1790                 ;;
1791            esac
1792	    case "$xxx" in
1793	    append)
1794		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1795	    clear)
1796		echo "$yyy=''"			>> posthint.sh ;;
1797	    define)
1798	        case "$zzz" in
1799		'') zzz=define ;;
1800		esac
1801		echo "$yyy='$zzz'"		>> posthint.sh ;;
1802	    eval)
1803		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1804	    prepend)
1805		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1806	    undef)
1807	        case "$zzz" in
1808		'') zzz="$uuu" ;;
1809		esac
1810		echo "$yyy=$zzz"		>> posthint.sh ;;
1811            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1812	    esac
1813	    shift
1814	    ;;
1815	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1816	    exit 0;;
1817	--) break;;
1818	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1819	*) break;;
1820	esac
1821done
1822
1823case "$error" in
1824true)
1825	cat >&2 <<EOM
1826Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1827                 [-U symbol] [-U symbol=] [-A command:symbol...]
1828  -d : use defaults for all answers.
1829  -e : go on without questioning past the production of config.sh.
1830  -f : specify an alternate default configuration file.
1831  -h : print this help message and exit (with an error status).
1832  -r : reuse C symbols value if possible (skips costly nm extraction).
1833  -s : silent mode, only echoes questions and essential information.
1834  -D : define symbol to have some value:
1835         -D symbol         symbol gets the value 'define'
1836         -D symbol=value   symbol gets the value 'value'
1837       common used examples (see INSTALL for more info):
1838         -Duse64bitint            use 64bit integers
1839         -Duse64bitall            use 64bit integers and pointers
1840         -Dusethreads             use thread support
1841         -Dinc_version_list=none  do not include older perl trees in @INC
1842         -DEBUGGING=none          DEBUGGING options
1843         -Dcc=gcc                 choose your compiler
1844         -Dprefix=/opt/perl5      choose your destination
1845  -E : stop at the end of questions, after having produced config.sh.
1846  -K : do not use unless you know what you are doing.
1847  -O : ignored for backward compatibility
1848  -S : perform variable substitutions on all .SH files (can mix with -f)
1849  -U : undefine symbol:
1850         -U symbol    symbol gets the value 'undef'
1851         -U symbol=   symbol gets completely empty
1852       e.g.:  -Uversiononly
1853  -A : manipulate symbol after the platform specific hints have been applied:
1854         -A append:symbol=value   append value to symbol
1855         -A symbol=value          like append:, but with a separating space
1856         -A define:symbol=value   define symbol to have value
1857         -A clear:symbol          define symbol to be ''
1858         -A define:symbol         define symbol to be 'define'
1859         -A eval:symbol=value     define symbol to be eval of value
1860         -A prepend:symbol=value  prepend value to symbol
1861         -A undef:symbol          define symbol to be 'undef'
1862         -A undef:symbol=         define symbol to be ''
1863       e.g.:  -A prepend:libswanted='cl pthread '
1864              -A ccflags=-DSOME_MACRO
1865  -V : print version number and exit (with a zero status).
1866EOM
1867	exit 1
1868	;;
1869esac
1870
1871: Sanity checks
1872case "$fastread$alldone" in
1873yescont|yesexit) ;;
1874*)
1875	case "$extractsh" in
1876	true) ;;
1877	*)
1878		if test ! -t 0; then
1879			echo "Say 'sh Configure', not 'sh <Configure'"
1880			exit 1
1881		fi
1882		;;
1883	esac
1884	;;
1885esac
1886
1887exec 4>&1
1888case "$silent" in
1889true) exec 1>/dev/null;;
1890esac
1891
1892: run the defines and the undefines, if any, but leave the file out there...
1893touch optdef.sh
1894grep '\\' optdef.sh >/dev/null 2>&1
1895if test $? = 0; then
1896    echo "Configure does not support \\ in -D arguments"
1897    exit 1
1898fi
1899. ./optdef.sh
1900: create the posthint manipulation script and leave the file out there...
1901touch posthint.sh
1902
1903: set package name
1904package='perl5'
1905first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1906last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1907case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1908ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1909*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1910esac
1911
1912: Some greps do not return status, grrr.
1913echo "grimblepritz" >grimble
1914if grep blurfldyick grimble >/dev/null 2>&1 ; then
1915	contains=contains
1916elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1917	contains=grep
1918else
1919	contains=contains
1920fi
1921rm -f grimble
1922: the following should work in any shell
1923case "$contains" in
1924contains*)
1925	echo " "
1926	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1927	cat >contains <<'EOSS'
1928grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1929EOSS
1930chmod +x contains
1931esac
1932
1933: Find the path to the source tree
1934case "$src" in
1935'') case "$0" in
1936    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1937         case "$src" in
1938	 /*)	;;
1939	 .)	;;
1940         *)	src=`cd ../$src && pwd` ;;
1941	 esac
1942         ;;
1943    *)   src='.';;
1944    esac;;
1945esac
1946case "$src" in
1947'')	src=/
1948	rsrc=/
1949	;;
1950/*)	rsrc="$src";;
1951*)	rsrc="../$src";;
1952esac
1953if test -f $rsrc/Configure && \
1954	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1955then
1956   : found it, so we are ok.
1957else
1958	rsrc=''
1959	for src in . .. ../.. ../../.. ../../../..; do
1960		if test -f ../$src/Configure && \
1961			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1962		then
1963			rsrc=../$src
1964			break
1965		fi
1966	done
1967fi
1968case "$rsrc" in
1969'')
1970	cat <<EOM >&4
1971
1972Sorry, I can't seem to locate the source dir for $package.  Please start
1973Configure with an explicit path -- i.e. /some/path/Configure.
1974
1975EOM
1976	exit 1
1977	;;
1978../.)	rsrc='..';;
1979*)
1980	echo " "
1981	echo "Sources for $package found in \"$src\"." >&4
1982	;;
1983esac
1984
1985: script used to extract .SH files with variable substitutions
1986cat >extract <<'EOS'
1987PERL_CONFIG_SH=true
1988echo "Doing variable substitutions on .SH files..."
1989if test -f MANIFEST; then
1990	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1991else
1992	echo "(Looking for .SH files under the source directory.)"
1993	set x `(cd "$src"; find . -name "*.SH" -print)`
1994fi
1995shift
1996case $# in
19970) set x `(cd "$src"; echo *.SH)`; shift;;
1998esac
1999if test ! -f "$src/$1"; then
2000	shift
2001fi
2002mkdir_p='
2003name=$1;
2004create="";
2005while test $name; do
2006	if test ! -d "$name"; then
2007		create="$name $create";
2008		name=`echo $name | sed -e "s|^[^/]*$||"`;
2009		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2010	else
2011		name="";
2012	fi;
2013done;
2014for file in $create; do
2015	mkdir $file;
2016done
2017'
2018for file in $*; do
2019	case "$src" in
2020	".")
2021		case "$file" in
2022		*/*)
2023			dir=`expr X$file : 'X\(.*\)/'`
2024			file=`expr X$file : 'X.*/\(.*\)'`
2025			(cd "$dir" && . ./$file)
2026			;;
2027		*)
2028			. ./$file
2029			;;
2030		esac
2031		;;
2032	*)
2033		case "$file" in
2034		*/*)
2035			dir=`expr X$file : 'X\(.*\)/'`
2036			file=`expr X$file : 'X.*/\(.*\)'`
2037			(set x $dir; shift; eval $mkdir_p)
2038			sh <"$src/$dir/$file"
2039			;;
2040		*)
2041			sh <"$src/$file"
2042			;;
2043		esac
2044		;;
2045	esac
2046done
2047if test -f "$src/config_h.SH"; then
2048	if test ! -f config.h; then
2049	: oops, they left it out of MANIFEST, probably, so do it anyway.
2050	. "$src/config_h.SH"
2051	fi
2052fi
2053EOS
2054
2055: extract files and exit if asked to do so
2056case "$extractsh" in
2057true)
2058	case "$realsilent" in
2059	true) ;;
2060	*) exec 1>&4;;
2061	esac
2062	case "$config_sh" in
2063	'') config_sh='config.sh';;
2064	esac
2065	echo " "
2066	echo "Fetching answers from $config_sh..."
2067	cd ..
2068	. $config_sh
2069	. UU/optdef.sh
2070	echo " "
2071	. UU/extract
2072	rm -rf UU
2073	echo "Extraction done."
2074	exit 0
2075	;;
2076esac
2077
2078: Eunice requires " " instead of "", can you believe it
2079echo " "
2080: Here we go...
2081echo "Beginning of configuration questions for $package."
2082
2083trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2084
2085: first determine how to suppress newline on echo command
2086echo " "
2087echo "Checking echo to see how to suppress newlines..."
2088(echo "hi there\c" ; echo " ") >.echotmp
2089if $contains c .echotmp >/dev/null 2>&1 ; then
2090	echo "...using -n."
2091	n='-n'
2092	c=''
2093else
2094	cat <<'EOM'
2095...using \c
2096EOM
2097	n=''
2098	c='\c'
2099fi
2100echo $n "The star should be here-->$c"
2101echo '*'
2102rm -f .echotmp
2103
2104: Now test for existence of everything in MANIFEST
2105echo " "
2106if test -f "$rsrc/MANIFEST"; then
2107	echo "First let's make sure your kit is complete.  Checking..." >&4
2108	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2109		(split -l 50 2>/dev/null || split -50)
2110	rm -f missing
2111	tmppwd=`pwd`
2112	for filelist in x??; do
2113		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2114			>/dev/null 2>>"$tmppwd/missing")
2115	done
2116	if test -s missing; then
2117		cat missing >&4
2118		cat >&4 <<'EOM'
2119
2120THIS PACKAGE SEEMS TO BE INCOMPLETE.
2121
2122You have the option of continuing the configuration process, despite the
2123distinct possibility that your kit is damaged, by typing 'y'es.  If you
2124do, don't blame me if something goes wrong.  I advise you to type 'n'o
2125and contact the author (https://github.com/Perl/perl5/issues).
2126
2127EOM
2128		echo $n "Continue? [n] $c" >&4
2129		read ans
2130		case "$ans" in
2131		y*)
2132			echo "Continuing..." >&4
2133			rm -f missing
2134			;;
2135		*)
2136			echo "ABORTING..." >&4
2137			kill $$
2138			;;
2139		esac
2140	else
2141		echo "Looks good..."
2142	fi
2143else
2144	echo "There is no MANIFEST file.  I hope your kit is complete !"
2145fi
2146rm -f missing x??
2147
2148: Find the appropriate value for a newline for tr
2149if test -n "$DJGPP"; then
2150       trnl='\012'
2151fi
2152if test X"$trnl" = X; then
2153	case "`echo foo | tr '\n' x 2>/dev/null`" in
2154	foox) trnl='\n' ;;
2155	esac
2156fi
2157if test X"$trnl" = X; then
2158	case "`echo foo | tr '\012' x 2>/dev/null`" in
2159	foox) trnl='\012' ;;
2160	esac
2161fi
2162if test X"$trnl" = X; then
2163       case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2164       fooxy) trnl='\n\r' ;;
2165       esac
2166fi
2167if test X"$trnl" = X; then
2168	cat <<EOM >&2
2169
2170$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2171
2172EOM
2173	exit 1
2174fi
2175
2176: compute the number of columns on the terminal for proper question formatting
2177case "$COLUMNS" in
2178'') COLUMNS='80';;
2179esac
2180
2181: set up the echo used in my read
2182myecho="case \"\$xxxm\" in
2183'') echo $n \"\$rp $c\" >&4;;
2184*) case \"\$rp\" in
2185	'') echo $n \"[\$xxxm] $c\";;
2186	*)
2187		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2188			echo \"\$rp\" >&4
2189			echo $n \"[\$xxxm] $c\" >&4
2190		else
2191			echo $n \"\$rp [\$xxxm] $c\" >&4
2192		fi
2193		;;
2194	esac;;
2195esac"
2196
2197: now set up to do reads with possible shell escape and default assignment
2198cat <<EOSC >myread
2199$startsh
2200xxxm=\$dflt
2201$myecho
2202ans='!'
2203case "\$fastread" in
2204yes) case "\$dflt" in
2205	'') ;;
2206	*) ans='';
2207		case "\$silent-\$rp" in
2208		true-) ;;
2209		*) echo " " >&4;;
2210		esac;;
2211	esac;;
2212*) case "\$silent" in
2213	true) case "\$rp" in
2214		'') ans='';;
2215		esac;;
2216	esac;;
2217esac
2218while expr "X\$ans" : "X!" >/dev/null; do
2219	read answ
2220	set x \$xxxm
2221	shift
2222	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2223	case  "\$answ" in
2224	"!")
2225		sh 1>&4
2226		echo " "
2227		$myecho
2228		;;
2229	!*)
2230		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2231		shift
2232		sh 1>&4 -c "\$*"
2233		echo " "
2234		$myecho
2235		;;
2236	"\$ans")
2237		case "\$ans" in
2238		\\&*)
2239			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2240			shift
2241			case "\$1" in
2242			-d)
2243				fastread=yes
2244				echo "(OK, I'll run with -d after this question.)" >&4
2245				;;
2246			-*)
2247				echo "*** Sorry, \$1 not supported yet." >&4
2248				;;
2249			esac
2250			$myecho
2251			ans=!
2252			;;
2253		esac;;
2254	*)
2255		case "\$aok" in
2256		y)
2257			echo "*** Substitution done -- please confirm."
2258			xxxm="\$ans"
2259			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2260			xxxm="\$ans"
2261			ans=!
2262			;;
2263		*)
2264			echo "*** Error -- try again."
2265			ans=!
2266			;;
2267		esac
2268		$myecho
2269		;;
2270	esac
2271	case "\$ans\$xxxm\$nostick" in
2272	'')
2273		ans=!
2274		$myecho
2275		;;
2276	esac
2277done
2278case "\$ans" in
2279'') ans="\$xxxm";;
2280esac
2281EOSC
2282
2283: create .config dir to save info across Configure sessions
2284test -d ../.config || mkdir ../.config
2285cat >../.config/README <<EOF
2286This directory created by Configure to save information that should
2287persist across sessions for $package.
2288
2289You may safely delete it if you wish.
2290EOF
2291
2292: See if we are using a devel version and want that
2293xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2294case "$usedevel" in
2295$define|true|[yY]*)
2296    usedevel="$define" ;;
2297*) case "$xversion" in
2298   *[13579])
2299	cat >&4 <<EOH
2300*** WHOA THERE!!! ***
2301
2302    This is an UNSTABLE DEVELOPMENT release.
2303    The version of this $package distribution is $xversion, that is, odd,
2304    (as opposed to even) and that signifies a development release.
2305    If you want a maintenance release, you want an even-numbered version.
2306
2307    Do ***NOT*** install this into production use.
2308    Data corruption and crashes are possible.
2309
2310    It is most seriously suggested that you do not continue any further
2311    unless you want to help in developing and debugging Perl.
2312
2313    If you *still* want to build perl, you can answer 'y' now,
2314    or pass -Dusedevel to Configure.
2315
2316EOH
2317	rp='Do you really want to continue?'
2318	dflt='n'
2319	. ./myread
2320	case "$ans" in
2321	[yY]) echo >&4 "Okay, continuing."
2322	      usedevel="$define" ;;
2323	*) echo >&4 "Okay, bye."
2324	   exit 1
2325	   ;;
2326	esac
2327	;;
2328    esac
2329    usedevel="$undef"
2330    ;;
2331esac
2332case "$usedevel" in
2333$define|true|[yY]*)
2334	case "$versiononly" in
2335	'') versiononly="$define" ;;
2336	esac
2337	case "$installusrbinperl" in
2338	'') installusrbinperl="$undef" ;;
2339	esac
2340	;;
2341esac
2342
2343: general instructions
2344needman=true
2345firsttime=true
2346user=`(logname) 2>/dev/null`
2347case "$user" in
2348'') user=`whoami 2>&1`;;
2349esac
2350if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2351	firsttime=false
2352	echo " "
2353	rp='Would you like to see the instructions?'
2354	dflt=n
2355	. ./myread
2356	case "$ans" in
2357	[yY]*) ;;
2358	*) needman=false;;
2359	esac
2360fi
2361if $needman; then
2362	cat <<EOH
2363
2364This installation shell script will examine your system and ask you questions
2365to determine how the perl5 package should be installed. If you get
2366stuck on a question, you may use a ! shell escape to start a subshell or
2367execute a command.  Many of the questions will have default answers in square
2368brackets; typing carriage return will give you the default.
2369
2370On some of the questions which ask for file or directory names you are allowed
2371to use the ~name construct to specify the login directory belonging to "name",
2372even if you don't have a shell which knows about that.  Questions where this is
2373allowed will be marked "(~name ok)".
2374
2375EOH
2376	rp=''
2377	dflt='Type carriage return to continue'
2378	. ./myread
2379	cat <<'EOH'
2380
2381The prompter used in this script allows you to use shell variables and
2382backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2383in the default answer, as if the default line was a set of arguments given to a
2384script shell.  This means you may also use $* to repeat the whole default line,
2385so you do not have to re-type everything to add something to the default.
2386
2387Every time there is a substitution, you will have to confirm.  If there is an
2388error (e.g. an unmatched backtick), the default answer will remain unchanged
2389and you will be prompted again.
2390
2391If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2392the questions and use the computed defaults (or the previous answers if there
2393was already a config.sh file). Type 'Configure -h' for a list of options.
2394You may also start interactively and then answer '& -d' at any prompt to turn
2395on the non-interactive behaviour for the remainder of the execution.
2396
2397EOH
2398	. ./myread
2399	cat <<EOH
2400
2401Much effort has been expended to ensure that this shell script will run on any
2402Unix system.  If despite that it blows up on yours, your best bet is to edit
2403Configure and run it again.  If you can't run Configure for some reason,
2404you'll have to generate a config.sh file by hand.  Whatever problems you
2405have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2406
2407This installation script affects things in two ways:
2408
24091) it may do direct variable substitutions on some of the files included
2410   in this kit.
24112) it builds a config.h file for inclusion in C programs.  You may edit
2412   any of these files as the need arises after running this script.
2413
2414If you make a mistake on a question, there is no easy way to back up to it
2415currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2416files.  Configure will offer to let you do this before it runs the SH files.
2417
2418EOH
2419	dflt='Type carriage return to continue'
2420	. ./myread
2421	case "$firsttime" in
2422	true) echo $user >>../.config/instruct;;
2423	esac
2424fi
2425
2426: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2427: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2428if test "X$sysroot" = X; then
2429    sysroot=""
2430else
2431    case "$cc" in
2432	*gcc*|*g++*)
2433	    echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2434	    # _sysroot is used in places where we need --sysroot=foo
2435	    # but using the rest of the flags could cause issues.
2436	    _sysroot="--sysroot=$sysroot";
2437	    case "$ccflags" in
2438		*sysroot*) ;;
2439		'undef'|*)
2440		ccflags="$ccflags $_sysroot"
2441	    esac
2442	    case "$ldflags" in
2443		*sysroot*) ;;
2444		'undef'|*)
2445		ldflags="$ldflags $_sysroot"
2446	    esac
2447	    case "$cppflags" in
2448		*sysroot*) ;;
2449		'undef'|*)
2450		cppflags="$cppflags $_sysroot"
2451	    esac
2452	    # lddlflags updated below in lddlflags section;
2453	    # same with cccdlflags
2454	    ;;
2455    esac
2456
2457    # Adjust some defaults to also use $sysroot
2458    for var in xlibpth loclibpth locincpth glibpth; do
2459	eval xxx=\$$var
2460	eval $var=''
2461	for path in $xxx; do
2462	    eval $var=\"\$$var $sysroot$path\"
2463	done
2464    done
2465
2466fi
2467
2468: find out where common programs are
2469echo " "
2470echo "Locating common programs..." >&4
2471cat <<EOSC >loc
2472$startsh
2473case \$# in
24740) exit 1;;
2475esac
2476thing=\$1
2477shift
2478dflt=\$1
2479shift
2480for dir in \$*; do
2481	case "\$thing" in
2482	.)
2483	if test -d \$dir/\$thing; then
2484		echo \$dir
2485		exit 0
2486	fi
2487	;;
2488	*)
2489	for thisthing in \$dir/\$thing; do
2490		: just loop through to pick last item
2491	done
2492	if test -f \$thisthing; then
2493		echo \$thisthing
2494		exit 0
2495	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2496		echo \$thisthing
2497		exit 0
2498	elif test -f \$dir/\$thing.exe; then
2499		if test -n "$DJGPP"; then
2500			echo \$dir/\$thing.exe
2501		elif test "$eunicefix" != ":"; then
2502			: on Eunice apparently
2503			echo \$dir/\$thing
2504		fi
2505		exit 0
2506	fi
2507	;;
2508	esac
2509done
2510echo \$dflt
2511exit 1
2512EOSC
2513chmod +x loc
2514$eunicefix loc
2515loclist="
2516awk
2517cat
2518chmod
2519comm
2520cp
2521echo
2522expr
2523grep
2524ls
2525mkdir
2526rm
2527sed
2528sort
2529touch
2530tr
2531uniq
2532"
2533trylist="
2534ar
2535bison
2536byacc
2537cpp
2538csh
2539date
2540egrep
2541gmake
2542gzip
2543less
2544ln
2545make
2546more
2547nm
2548nroff
2549perl
2550pg
2551test
2552uname
2553zip
2554"
2555pth=`echo $PATH | sed -e "s/$p_/ /g"`
2556pth="$pth $sysroot/lib $sysroot/usr/lib"
2557for file in $loclist; do
2558	eval xxx=\$$file
2559	case "$xxx" in
2560	/*|?:[\\/]*)
2561		if test -f "$xxx"; then
2562			: ok
2563		else
2564			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2565			xxx=`./loc $file $file $pth`
2566		fi
2567		;;
2568	'') xxx=`./loc $file $file $pth`;;
2569	*) xxx=`./loc $xxx $xxx $pth`;;
2570	esac
2571	eval $file=$xxx$_exe
2572	eval _$file=$xxx
2573	case "$xxx" in
2574	/*)
2575		echo $file is in $xxx.
2576		;;
2577	?:[\\/]*)
2578		echo $file is in $xxx.
2579		;;
2580	*)
2581		echo "I don't know where '$file' is, and my life depends on it." >&4
2582		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2583		exit 1
2584		;;
2585	esac
2586done
2587echo " "
2588echo "Don't worry if any of the following aren't found..."
2589say=offhand
2590for file in $trylist; do
2591	eval xxx=\$$file
2592	case "$xxx" in
2593	/*|?:[\\/]*)
2594		if test -f "$xxx"; then
2595			: ok
2596		else
2597			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2598			xxx=`./loc $file $file $pth`
2599		fi
2600		;;
2601	'') xxx=`./loc $file $file $pth`;;
2602	*) xxx=`./loc $xxx $xxx $pth`;;
2603	esac
2604	eval $file=$xxx$_exe
2605	eval _$file=$xxx
2606	case "$xxx" in
2607	/*)
2608		echo $file is in $xxx.
2609		;;
2610	?:[\\/]*)
2611		echo $file is in $xxx.
2612		;;
2613	*)
2614		echo "I don't see $file out there, $say."
2615		say=either
2616		;;
2617	esac
2618done
2619case "$egrep" in
2620egrep)
2621	echo "Substituting grep for egrep."
2622	egrep=$grep
2623	_egrep=$grep
2624	;;
2625esac
2626case "$less" in
2627'')	;;
2628*)	if $less -R </dev/null >/dev/null 2>&1; then
2629	       echo "Substituting less -R for less."
2630	       less="$less -R"
2631	       _less=$less
2632	fi
2633	;;
2634esac
2635case "$ln" in
2636ln)
2637	echo "Substituting cp for ln."
2638	ln=$cp
2639	_ln=$cp
2640	;;
2641esac
2642case "$make" in
2643make)
2644	case "$gmake" in
2645	gmake)
2646	echo "I can't find make or gmake, and my life depends on it." >&4
2647	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2648	exit 1
2649	;;
2650	esac
2651	;;
2652esac
2653case "$gmake" in
2654gmake)	;;
2655*)	# We can't have osname yet.
2656	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2657		# Assume that gmake, if found, is definitely GNU make
2658		# and prefer it over the system make.
2659		echo "Substituting gmake for make."
2660		make=$gmake
2661		_make=$gmake
2662	fi
2663	;;
2664esac
2665case "$test" in
2666test)
2667	echo "Hopefully test is built into your sh."
2668	;;
2669*)
2670	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2671		echo "Using the test built into your sh."
2672		test=test
2673		_test=test
2674	fi
2675	;;
2676esac
2677case "$echo" in
2678echo)
2679	echo "Hopefully echo is built into your sh."
2680	;;
2681'') ;;
2682*)
2683	echo " "
2684echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2685	$echo $n "hi there$c" >foo1
2686	echo $n "hi there$c" >foo2
2687	if cmp foo1 foo2 >/dev/null 2>&1; then
2688		echo "They are compatible.  In fact, they may be identical."
2689	else
2690		case "$n" in
2691		'-n') n='' c='\c';;
2692		*) n='-n' c='';;
2693		esac
2694		cat <<FOO
2695They are not compatible!  You are probably running ksh on a non-USG system.
2696I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2697have echo built in and we may have to run some Bourne shell scripts.  That
2698means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2699
2700FOO
2701		$echo $n "The star should be here-->$c"
2702		$echo "*"
2703	fi
2704	$rm -f foo1 foo2
2705	;;
2706esac
2707
2708# This question was auctioned at YAPC::Europe-2007 in Vienna
2709# I never promised you could answer it. I only auctioned the question.
2710cat <<FOO
2711The following message is sponsored by
2712
2713  Dresden.pm<--The stars should be here.
2714
2715Dear Perl user, system administrator or package
2716maintainer, the Perl community sends greetings to
2717you. Do you (emblematical) greet back [Y/n]? n
2718
2719FOO
2720
2721: Check what type of C compiler we use
2722cat <<EOS >trygcc
2723$startsh
2724EOS
2725cat <<'EOSC' >>trygcc
2726case "$cc" in
2727'') ;;
2728*)  $rm -f try try.*
2729    $cat >try.c <<EOM
2730int main(int argc, char *argv[]) {
2731  return 0;
2732}
2733EOM
2734    if $cc -o try $ccflags $ldflags try.c; then
2735       :
2736    else
2737        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2738        despair=yes
2739        trygcc=yes
2740        case "$cc" in
2741        *gcc*) trygcc=no ;;
2742        esac
2743	# Skip this test because it gives a false match on output like:
2744	#    ./trygcc: line 23: cc: command not found
2745        # case "`$cc -v -c try.c 2>&1`" in
2746        # *gcc*) trygcc=no ;;
2747        # esac
2748        if $test X"$trygcc" = Xyes; then
2749            if gcc -o try -c try.c; then
2750                echo " "
2751                echo "You seem to have a working gcc, though." >&4
2752		# Switching compilers may undo the work of hints files.
2753		# The most common problem is -D_REENTRANT for threads.
2754		# This heuristic catches that case, but gets false positives
2755		# if -Dusethreads was not actually specified.  Better to
2756		# bail out here with a useful message than fail
2757		# mysteriously later. Should we perhaps just try to
2758		# re-invoke Configure -Dcc=gcc config_args ?
2759		if $test -f usethreads.cbu; then
2760			$cat >&4 <<EOM
2761
2762*** However, any setting of the C compiler flags (e.g. for thread support)
2763*** will be lost.  It may be necessary for you to restart Configure and
2764*** add -Dcc=gcc to your Configure command line.
2765
2766EOM
2767			rp="Would you like to go ahead and try gcc anyway?"
2768			dflt=n
2769		else
2770			rp="Would you like to use it?"
2771			dflt=y
2772		fi
2773                if $test -f myread; then
2774                    . ./myread
2775                else
2776                    if $test -f UU/myread; then
2777                        . ./UU/myread
2778                    else
2779                        echo "Cannot find myread, sorry.  Aborting." >&2
2780                        exit 1
2781                    fi
2782                fi
2783                case "$ans" in
2784                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2785                esac
2786            fi
2787        fi
2788    fi
2789    $rm -f try try.*
2790    ;;
2791esac
2792EOSC
2793
2794cat <<EOS >checkcc
2795$startsh
2796EOS
2797cat <<'EOSC' >>checkcc
2798case "$cc" in
2799'') ;;
2800*)  $rm -f try try.*
2801    $cat >try.c <<EOM
2802int main(int argc, char *argv[]) {
2803  return 0;
2804}
2805EOM
2806    if $cc -o try $ccflags $ldflags try.c; then
2807       :
2808    else
2809        if $test X"$despair" = Xyes; then
2810           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2811        fi
2812        $cat >&4 <<EOM
2813You need to find a working C compiler.
2814Either (purchase and) install the C compiler supplied by your OS vendor,
2815or for a free C compiler try http://gcc.gnu.org/
2816I cannot continue any further, aborting.
2817EOM
2818        exit 1
2819    fi
2820    $rm -f try try.*
2821    ;;
2822esac
2823EOSC
2824
2825: determine whether symbolic links are supported
2826echo " "
2827$touch blurfl
2828if $ln -s blurfl sym > /dev/null 2>&1 ; then
2829	echo "Symbolic links are supported." >&4
2830	lns="$ln -s"
2831else
2832	echo "Symbolic links are NOT supported." >&4
2833	lns="$ln"
2834fi
2835$rm -f blurfl sym
2836
2837: determine whether symbolic links are supported
2838echo " "
2839case "$lns" in
2840*"ln"*" -s")
2841	echo "Checking how to test for symbolic links..." >&4
2842	$lns blurfl sym
2843	if $test "X$issymlink" = X; then
2844		case "$newsh" in
2845		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2846		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2847		esac
2848		if test $? = 0; then
2849			issymlink="test -h"
2850		else
2851			echo "Your builtin 'test -h' may be broken." >&4
2852			case "$test" in
2853			/*)	;;
2854			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2855				for p in $pth
2856				do
2857					if test -f "$p/$test"; then
2858						test="$p/$test"
2859						break
2860					fi
2861				done
2862				;;
2863			esac
2864			case "$test" in
2865			/*)
2866				echo "Trying external '$test -h'." >&4
2867				issymlink="$test -h"
2868				if $test ! -h sym >/dev/null 2>&1; then
2869					echo "External '$test -h' is broken, too." >&4
2870					issymlink=''
2871				fi
2872				;;
2873			*)	issymlink='' ;;
2874			esac
2875		fi
2876	fi
2877	if $test "X$issymlink" = X; then
2878		if $test -L sym 2>/dev/null; then
2879			issymlink="$test -L"
2880			echo "The builtin '$test -L' worked." >&4
2881		fi
2882	fi
2883	if $test "X$issymlink" != X; then
2884		echo "You can test for symbolic links with '$issymlink'." >&4
2885	else
2886		echo "I do not know how you can test for symbolic links." >&4
2887	fi
2888	$rm -f blurfl sym
2889	;;
2890*)	echo "No symbolic links, so not testing for their testing..." >&4
2891	;;
2892esac
2893
2894: Make symlinks util
2895case "$mksymlinks" in
2896$define|true|[yY]*)
2897	case "$src" in
2898	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2899		exit 1
2900		;;
2901	*)	case "$lns:$issymlink" in
2902		*"ln"*" -s:"*"test -"?)
2903			echo "Creating the symbolic links..." >&4
2904			cd ..
2905			awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2906			awk 'NF == 1 {
2907				dir=".";
2908				file=$1 "";
2909			     }
2910			     NF == 2 {
2911				dir=$1 "";
2912				file=$2 "";
2913			     }
2914			     {
2915				 print "# dir = ", dir, "file = ", file
2916				 mf[dir] = mf[dir]" "source"/"dir"/"file;
2917			     } END {
2918				 for (d in mf) {
2919				     if (d != ".") { print("mkdir -p "d) }
2920				     print("ln -sf "mf[d]" "d);
2921				 }
2922			     }' source="$src" > UU/mksymlinks.$$
2923			sh UU/mksymlinks.$$
2924			rm UU/mksymlinks.$$
2925			# Sanity check 1.
2926			if test ! -d t/base; then
2927				echo "Failed to create the subdirectories.  Aborting." >&4
2928				exit 1
2929			fi
2930			# Sanity check 2.
2931			if test ! -f t/base/lex.t; then
2932				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2933				exit 1
2934			fi
2935			if test ! -f win32/win32.c; then
2936				echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2937				exit 1
2938			fi
2939			cd UU
2940			;;
2941		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2942			;;
2943		esac
2944		;;
2945	esac
2946	;;
2947esac
2948
2949: Check for Cross-Compilation
2950if $test "X$targethost" = "X"; then
2951    targethost=""
2952fi
2953if $test "X$targetenv" = "X"; then
2954    targetenv=""
2955fi
2956case "$usecrosscompile" in
2957$define|true|[yY]*)
2958	$echo "Cross-compiling..."
2959	croak=''
2960	case "$cc" in
2961	*-gcc*|*-g++*) # A cross-compiling gcc, probably.
2962	    # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2963	    # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2964	    targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2965	    ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2966	    # leave out ld, choosing it is more complex
2967	    nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2968	    ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2969	    # We are in a weird spot. Just before us, some values
2970	    # were 'saved', to be restored after the hints are
2971	    # run.  This means that the changes we made to ar,
2972	    # nm and ranlib will get reverted.
2973	    # To avoid that, we hijack the saving mechanism and
2974	    # have it save our new values.
2975	    for file in ar nm ranlib; do
2976		eval xxx=\$$file
2977		eval $file=$xxx$_exe
2978		eval _$file=$xxx
2979	    done
2980	;;
2981	esac
2982	case "$targetarch" in
2983	'') echo "Targetarch not defined." >&4; croak=y ;;
2984	*)  echo "Using targetarch $targetarch." >&4 ;;
2985	esac
2986	case "$targethost" in
2987	'') echo "Targethost not defined." >&4; croak=n ;;
2988	*)  echo "Using targethost $targethost." >&4
2989	esac
2990	locincpth=' '
2991	loclibpth=' '
2992	case "$croak" in
2993	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2994	esac
2995    : compile a host miniperl and generate_uudmap, unless we got passed them
2996    if $test "X$hostperl" = X; then
2997      echo "Building host miniperl and generate_uudmap binaries" >&4
2998      before_host=`pwd`
2999      cd ..
3000      cd $src
3001      src=`pwd`
3002      rm -rf $src/host
3003      mkdir $src/host
3004      cd $src/host
3005      $src/Configure -des -Dusedevel -Dmksymlinks
3006      $make miniperl
3007      case "$hostgenerate" in
3008      '') $make generate_uudmap
3009          hostgenerate=$src/host/generate_uudmap
3010          ;;
3011       "$undef") hostgenerate=''
3012          ;;
3013      esac
3014      hostperl=$src/host/miniperl
3015      cd $before_host
3016    fi
3017    hostosname=`$hostperl -le 'print $^O'`
3018    ;;
3019*)
3020    usecrosscompile="$undef"
3021    ;;
3022esac
3023
3024: Define -Dtargethost=somecomputer to run compiled tests on another machine
3025case "$targethost" in
3026    '') echo "Checking for cross-compile" >&4
3027    case "$usecrosscompile$multiarch" in
3028       *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3029         if [ -f Makefile ]; then
3030           echo " "
3031           echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3032         else
3033           echo "Configure done."
3034         fi
3035       exit 0
3036       ;;
3037     *) echo "No targethost for running compiler tests against defined, running locally" >&4
3038        run=''
3039        to=:
3040        from=:
3041        ;;
3042    esac
3043    ;;
3044    *) echo "Using targethost $targethost." >&4
3045	case "$src" in
3046	/*) run=$src/Cross/run
3047	    targetmkdir=$src/Cross/mkdir
3048	    to=$src/Cross/to
3049	    from=$src/Cross/from
3050	    ;;
3051	*)  pwd=`$test -f ../Configure & cd ..; pwd`
3052	    run=$pwd/Cross/run
3053	    targetmkdir=$pwd/Cross/mkdir
3054	    to=$pwd/Cross/to
3055	    from=$pwd/Cross/from
3056	    ;;
3057	esac
3058	case "$targetrun" in
3059	'') targetrun=ssh ;;
3060	esac
3061	case "$targetto" in
3062	'') targetto=scp ;;
3063	esac
3064	case "$targetfrom" in
3065	'') targetfrom=scp ;;
3066	esac
3067	run=$run-$targetrun
3068	to=$to-$targetto
3069	from=$from-$targetfrom
3070	case "$targetdir" in
3071	'')  targetdir=/tmp
3072	     echo "Guessing targetdir $targetdir." >&4
3073	     ;;
3074	esac
3075	case "$targetuser" in
3076	'')  targetuser=root
3077	     echo "Guessing targetuser $targetuser." >&4
3078	     ;;
3079	esac
3080	case "$targetport" in
3081	'')  targetport=22
3082	     echo "Guessing targetport $targetport." >&4
3083	     ;;
3084	esac
3085	case "$targetfrom" in
3086	scp)	q=-q ;;
3087	*)	q='' ;;
3088	esac
3089	case "$targetrun" in
3090	ssh|rsh)
3091	    cat >$run <<EOF
3092#!/bin/sh
3093env=''
3094case "\$1" in
3095-cwd)
3096  shift
3097  cwd=\$1
3098  shift
3099  ;;
3100esac
3101case "\$1" in
3102-env)
3103  shift
3104  env=\$1
3105  shift
3106  ;;
3107esac
3108case "\$cwd" in
3109'') cwd=$targetdir ;;
3110esac
3111exe=\$1
3112shift
3113$to \$exe
3114$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3115EOF
3116	    ;;
3117	adb)
3118	    $touch $run
3119	    ;;
3120	*)  echo "Unknown targetrun '$targetrun'" >&4
3121	    exit 1
3122	    ;;
3123	esac
3124	case "$targetmkdir" in
3125	*/Cross/mkdir)
3126	    cat >$targetmkdir <<EOF
3127#!/bin/sh
3128$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3129EOF
3130	    $chmod a+rx $targetmkdir
3131	    ;;
3132	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3133	    exit 1
3134	    ;;
3135	esac
3136	case "$targetto" in
3137	scp|rcp)
3138	    cat >$to <<EOF
3139#!/bin/sh
3140for f in \$@
3141do
3142  case "\$f" in
3143  /*)
3144    $targetmkdir \`dirname \$f\`
3145    $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3146    ;;
3147  *)
3148    $targetmkdir $targetdir/\`dirname \$f\`
3149    $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3150    ;;
3151  esac
3152done
3153exit 0
3154EOF
3155	    ;;
3156	cp) cat >$to <<EOF
3157#!/bin/sh
3158for f in \$@
3159do
3160  case "\$f" in
3161  /*)
3162    $mkdir -p $targetdir/\`dirname \$f\`
3163    $cp \$f $targetdir/\$f || exit 1
3164    ;;
3165  *)
3166    $targetmkdir $targetdir/\`dirname \$f\`
3167    $cp \$f $targetdir/\$f || exit 1
3168    ;;
3169  esac
3170done
3171exit 0
3172EOF
3173	    ;;
3174	*)  echo "Unknown targetto '$targetto'" >&4
3175	    exit 1
3176	    ;;
3177	esac
3178	case "$targetfrom" in
3179	scp|rcp)
3180	  cat >$from <<EOF
3181#!/bin/sh
3182for f in \$@
3183do
3184  $rm -f \$f
3185  $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3186done
3187exit 0
3188EOF
3189	    ;;
3190	cp) cat >$from <<EOF
3191#!/bin/sh
3192for f in \$@
3193do
3194  $rm -f \$f
3195  cp $targetdir/\$f . || exit 1
3196done
3197exit 0
3198EOF
3199	    ;;
3200	*)  echo "Unknown targetfrom '$targetfrom'" >&4
3201	    exit 1
3202	    ;;
3203	esac
3204	if $test ! -f $run; then
3205	    echo "Target 'run' script '$run' not found." >&4
3206	else
3207	    $chmod a+rx $run
3208	fi
3209	if $test ! -f $to; then
3210	    echo "Target 'to' script '$to' not found." >&4
3211	else
3212	    $chmod a+rx $to
3213	fi
3214	if $test ! -f $from; then
3215	    echo "Target 'from' script '$from' not found." >&4
3216	else
3217	    $chmod a+rx $from
3218	fi
3219	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3220	    exit 1
3221	fi
3222	cat >&4 <<EOF
3223Using '$run' for remote execution,
3224and '$from' and '$to'
3225for remote file transfer.
3226EOF
3227	;;
3228*)	run=''
3229	to=:
3230	from=:
3231	usecrosscompile="$undef"
3232	targetarch=''
3233	;;
3234esac
3235
3236: see whether [:lower:] and [:upper:] are supported character classes
3237echo " "
3238case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3239ABYZ-abyz)
3240	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3241	up='[:upper:]'
3242	low='[:lower:]'
3243	;;
3244*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3245	# (0xd9 and 0xe2), therefore that is a nice testing point.
3246	if test "X$up" = X -o "X$low" = X; then
3247	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3248	    rs) up='[A-Z]'
3249		low='[a-z]'
3250		;;
3251	    esac
3252	fi
3253	if test "X$up" = X -o "X$low" = X; then
3254	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3255	    rs) up='A-Z'
3256		low='a-z'
3257		;;
3258	    esac
3259	fi
3260	if test "X$up" = X -o "X$low" = X; then
3261	    case "`echo RS | od -x 2>/dev/null`" in
3262	    *D9E2*|*d9e2*)
3263		echo "Hey, this might be EBCDIC." >&4
3264		if test "X$up" = X -o "X$low" = X; then
3265		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3266		    rs) up='[A-IJ-RS-Z]'
3267			low='[a-ij-rs-z]'
3268			;;
3269		    esac
3270		fi
3271		if test "X$up" = X -o "X$low" = X; then
3272		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3273		    rs) up='A-IJ-RS-Z'
3274			low='a-ij-rs-z'
3275			;;
3276		    esac
3277		fi
3278		;;
3279	    esac
3280	fi
3281esac
3282case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3283rs)
3284    echo "Using $up and $low to convert case." >&4
3285    ;;
3286*)
3287    echo "I don't know how to translate letters from upper to lower case." >&4
3288    echo "Your tr is not acting any way I know of." >&4
3289    exit 1
3290    ;;
3291esac
3292: set up the translation script tr, must be called with ./tr of course
3293cat >tr <<EOSC
3294$startsh
3295case "\$1\$2" in
3296'[A-Z][a-z]') exec $tr '$up' '$low';;
3297'[a-z][A-Z]') exec $tr '$low' '$up';;
3298esac
3299exec $tr "\$@"
3300EOSC
3301chmod +x tr
3302$eunicefix tr
3303
3304: Try to determine whether config.sh was made on this system
3305case "$config_sh" in
3306'')
3307myuname=`$uname -a 2>/dev/null`
3308$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3309# Downcase everything to avoid ambiguity.
3310# Remove slashes and single quotes so we can use parts of this in
3311# directory and file names.
3312# Remove newlines so myuname is sane to use elsewhere.
3313# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3314# because the A-Z/a-z are not consecutive.
3315myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3316	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3317newmyuname="$myuname"
3318dflt=n
3319case "$knowitall" in
3320'')
3321	if test -f ../config.sh; then
3322		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3323			eval "`grep myuname= ../config.sh`"
3324		fi
3325		if test "X$myuname" = "X$newmyuname"; then
3326			dflt=y
3327		fi
3328	fi
3329	;;
3330*) dflt=y;;
3331esac
3332
3333: Get old answers from old config file if Configure was run on the
3334: same system, otherwise use the hints.
3335hint=default
3336cd ..
3337if test -f config.sh; then
3338	echo " "
3339	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3340	. UU/myread
3341	case "$ans" in
3342	n*|N*) echo "OK, I'll ignore it."
3343		mv config.sh config.sh.old
3344		myuname="$newmyuname"
3345		;;
3346	*)  echo "Fetching default answers from your old config.sh file..." >&4
3347		tmp_n="$n"
3348		tmp_c="$c"
3349		tmp_sh="$sh"
3350		. ./config.sh
3351		cp config.sh UU
3352		n="$tmp_n"
3353		c="$tmp_c"
3354		: Older versions did not always set $sh.  Catch re-use of such
3355		: an old config.sh.
3356		case "$sh" in
3357		'') sh="$tmp_sh" ;;
3358		esac
3359		hint=previous
3360		;;
3361	esac
3362fi
3363. ./UU/checkcc
3364if test ! -f config.sh; then
3365	$cat <<EOM
3366
3367First time through, eh?  I have some defaults handy for some systems
3368that need some extra help getting the Configure answers right:
3369
3370EOM
3371	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3372	dflt=''
3373	: Half the following guesses are probably wrong... If you have better
3374	: tests or hints, please send them to https://github.com/Perl/perl5/issues
3375	: The metaconfig authors would also appreciate a copy...
3376	$test -f /irix && osname=irix
3377	$test -f /xenix && osname=sco_xenix
3378	$test -f /dynix && osname=dynix
3379	$test -f /dnix && osname=dnix
3380	$test -f /lynx.os && osname=lynxos
3381	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3382	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3383	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3384	$test -f /bin/mips && /bin/mips && osname=mips
3385	$test -d /usr/apollo/bin && osname=apollo
3386	$test -f /etc/saf/_sactab && osname=svr4
3387	$test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3388	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3389	$test -f /sys/utilities/MultiView && osname=amigaos
3390	if $test -d /MachTen -o -d /MachTen_Folder; then
3391		osname=machten
3392		if $test -x /sbin/version; then
3393			osvers=`/sbin/version | $awk '{print $2}' |
3394			$sed -e 's/[A-Za-z]$//'`
3395		elif $test -x /usr/etc/version; then
3396			osvers=`/usr/etc/version | $awk '{print $2}' |
3397			$sed -e 's/[A-Za-z]$//'`
3398		else
3399			osvers="$2.$3"
3400		fi
3401	fi
3402
3403	$test -f /sys/posix.dll &&
3404		$test -f /usr/bin/what &&
3405		set X `/usr/bin/what /sys/posix.dll` &&
3406		$test "$3" = UWIN &&
3407		osname=uwin &&
3408		osvers="$5"
3409
3410	if $test -f $uname; then
3411		set X $myuname
3412		shift
3413
3414		case "$5" in
3415		fps*) osname=fps ;;
3416		mips*)
3417			case "$4" in
3418			umips) osname=umips ;;
3419			*) osname=mips ;;
3420			esac;;
3421		[23]100) osname=mips ;;
3422		i386*)
3423			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3424			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3425				osname='sco'
3426				osvers=$tmp
3427			elif $test -f /etc/kconfig; then
3428				osname=isc
3429				if test "$lns" = "$ln -s"; then
3430					osvers=4
3431				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3432					osvers=3
3433				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3434					osvers=2
3435				fi
3436			fi
3437			tmp=''
3438			;;
3439		pc*)
3440			if test -n "$DJGPP"; then
3441				osname=dos
3442				osvers=djgpp
3443			fi
3444			;;
3445		esac
3446
3447		case "$1" in
3448		aix) osname=aix
3449			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3450			case "$tmp" in
3451			# oslevel can fail with:
3452			# oslevel: Unable to acquire lock.
3453			*not\ found) osvers="$4"."$3" ;;
3454			'<3240'|'<>3240') osvers=3.2.0 ;;
3455			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3456			'=3250'|'>3250') osvers=3.2.5 ;;
3457			*) osvers=$tmp;;
3458			esac
3459			;;
3460		bitrig) osname=bitrig
3461			osvers="$3"
3462			;;
3463		bsd386) osname=bsd386
3464			osvers=`$uname -r`
3465			;;
3466		cygwin*) osname=cygwin
3467			osvers="$3"
3468			;;
3469		*dc.osx) osname=dcosx
3470			osvers="$3"
3471			;;
3472		dnix) osname=dnix
3473			osvers="$3"
3474			;;
3475		domainos) osname=apollo
3476			osvers="$3"
3477			;;
3478		dgux)	osname=dgux
3479			osvers="$3"
3480			;;
3481		dragonfly) osname=dragonfly
3482			osvers="$3"
3483			;;
3484		dynixptx*) osname=dynixptx
3485			osvers=`echo "$4"|sed 's/^v//'`
3486			;;
3487		freebsd) osname=freebsd
3488			osvers="$3" ;;
3489		genix)	osname=genix ;;
3490		gnu)	osname=gnu
3491			osvers="$3" ;;
3492		hp*)	osname=hpux
3493			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3494			;;
3495		irix*)	osname=irix
3496			case "$3" in
3497			4*) osvers=4 ;;
3498			5*) osvers=5 ;;
3499			*)	osvers="$3" ;;
3500			esac
3501			;;
3502		linux)	osname=linux
3503			case "$3" in
3504			*)	osvers="$3" ;;
3505			esac
3506			$test -f /system/lib/libandroid.so && osname=linux-android
3507			;;
3508		MiNT)	osname=mint
3509			;;
3510		minix)	osname=minix
3511			osvers=`$uname -r`
3512			;;
3513		netbsd*) osname=netbsd
3514			osvers="$3"
3515			;;
3516		news-os) osvers="$3"
3517			case "$3" in
3518			4*) osname=newsos4 ;;
3519			*) osname=newsos ;;
3520			esac
3521			;;
3522		nonstop-ux) osname=nonstopux ;;
3523		openbsd) osname=openbsd
3524			osvers="$3"
3525			;;
3526		os2)	osname=os2
3527			osvers="$4"
3528			;;
3529		POSIX-BC | posix-bc ) osname=posix-bc
3530			osvers="$3"
3531			;;
3532		powerux | power_ux | powermax_os | powermaxos | \
3533		powerunix | power_unix) osname=powerux
3534			osvers="$3"
3535			;;
3536		qnx) osname=qnx
3537			osvers="$4"
3538			;;
3539		solaris) osname=solaris
3540			case "$3" in
3541			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3542			*)	osvers="$3" ;;
3543			esac
3544			;;
3545		sunos) osname=sunos
3546			case "$3" in
3547			5*) osname=solaris
3548				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3549			*)	osvers="$3" ;;
3550			esac
3551			;;
3552		titanos) osname=titanos
3553			case "$3" in
3554			1*) osvers=1 ;;
3555			2*) osvers=2 ;;
3556			3*) osvers=3 ;;
3557			4*) osvers=4 ;;
3558			*)	osvers="$3" ;;
3559			esac
3560			;;
3561		ultrix) osname=ultrix
3562			osvers="$3"
3563			;;
3564		osf1|mls+)	case "$5" in
3565				alpha)
3566					osname=dec_osf
3567					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3568					case "$osvers" in
3569					[1-9].[0-9]*) ;;
3570					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3571					esac
3572					;;
3573			hp*)	osname=hp_osf1	;;
3574			mips)	osname=mips_osf1 ;;
3575			esac
3576			;;
3577		# UnixWare 7.1.2 is known as Open UNIX 8
3578		openunix|unixware) osname=svr5
3579			osvers="$4"
3580			;;
3581		uts)	osname=uts
3582			osvers="$3"
3583			;;
3584		vos) osvers="$3"
3585			;;
3586		$2) case "$osname" in
3587			*isc*) ;;
3588			*freebsd*) ;;
3589			svr*)
3590				: svr4.x or possibly later
3591				case "svr$3" in
3592				${osname}*)
3593					osname=svr$3
3594					osvers=$4
3595					;;
3596				esac
3597				case "$osname" in
3598				svr4.0)
3599					: Check for ESIX
3600					if test -f /stand/boot ; then
3601						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3602						if test -n "$INITPROG" -a -f "$INITPROG"; then
3603			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3604							if test -n "$isesix"; then
3605								osname=esix4
3606							fi
3607						fi
3608					fi
3609					;;
3610				esac
3611				;;
3612			*)	if test -f /etc/systemid; then
3613					osname=sco
3614					set `echo $3 | $sed 's/\./ /g'` $4
3615					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3616						osvers=$1.$2.$3
3617					elif $test -f $src/hints/sco_$1_$2.sh; then
3618						osvers=$1.$2
3619					elif $test -f $src/hints/sco_$1.sh; then
3620						osvers=$1
3621					fi
3622				else
3623					case "$osname" in
3624					'') : Still unknown.  Probably a generic Sys V.
3625						osname="sysv"
3626						osvers="$3"
3627						;;
3628					esac
3629				fi
3630				;;
3631			esac
3632			;;
3633		*)	case "$osname" in
3634			'') : Still unknown.  Probably a generic BSD.
3635				osname="$1"
3636				osvers="$3"
3637				;;
3638			esac
3639			;;
3640		esac
3641	else
3642		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3643			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3644			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3645				osname=news_os
3646			fi
3647			$rm -f UU/kernel.what
3648		elif test -d c:/. -o -n "$is_os2" ; then
3649			set X $myuname
3650			osname=os2
3651			osvers="$5"
3652		fi
3653	fi
3654
3655        case "$targetarch" in
3656        '') ;;
3657        *)  hostarch=$osname
3658            case "$targetarch" in
3659                nto*|*-nto-*)
3660                    # Will load qnx.sh, which should change osname to nto
3661                    osname=qnx
3662                    osvers=''
3663                    ;;
3664                *linux-android*)
3665                    # Catch arm-linux-androideabi, mipsel-linux-android,
3666                    # and i686-linux-android
3667                    osname=linux-android
3668                    osvers=''
3669                    ;;
3670                *linux*)
3671                    # Something like arm-linux-gnueabihf is really just
3672                    # plain linux.
3673                    osname=linux
3674                    osvers=''
3675                    ;;
3676                *solaris*|*sunos*)
3677                    osname=solaris
3678                    # XXX perhaps we should just assume
3679                    # osvers to be 2, or maybe take the value
3680                    # from targetarch. Using $run before the
3681                    # hints are run is somewhat icky.
3682                    set X `$run $uname -a 2>/dev/null`
3683                    shift
3684                    case "$3" in
3685                        5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3686                        *)  osvers="$3" ;;
3687                    esac
3688                    ;;
3689                *)
3690		    osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3691		    osvers=''
3692                ;;
3693            esac
3694            ;;
3695        esac
3696
3697	: Now look for a hint file osname_osvers, unless one has been
3698	: specified already.
3699	case "$hintfile" in
3700	''|' ')
3701		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3702		: Also try without trailing minor version numbers.
3703		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3704		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3705		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3706		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3707		case "$file" in
3708		'') dflt=none ;;
3709		*)  case "$osvers" in
3710			'') dflt=$file
3711				;;
3712			*)  if $test -f $src/hints/$file.sh ; then
3713					dflt=$file
3714				elif $test -f $src/hints/$xfile.sh ; then
3715					dflt=$xfile
3716				elif $test -f $src/hints/$xxfile.sh ; then
3717					dflt=$xxfile
3718				elif $test -f $src/hints/$xxxfile.sh ; then
3719					dflt=$xxxfile
3720				elif $test -f $src/hints/$xxxxfile.sh ; then
3721					dflt=$xxxxfile
3722				elif $test -f "$src/hints/${osname}.sh" ; then
3723					dflt="${osname}"
3724				else
3725					dflt=none
3726				fi
3727				;;
3728			esac
3729			;;
3730		esac
3731		if $test -f Policy.sh ; then
3732			case "$dflt" in
3733			*Policy*) ;;
3734			none) dflt="Policy" ;;
3735			*) dflt="Policy $dflt" ;;
3736			esac
3737		fi
3738		;;
3739	*)
3740		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3741		;;
3742	esac
3743
3744	if $test -f Policy.sh ; then
3745		$cat <<EOM
3746
3747There's also a Policy hint file available, which should make the
3748site-specific (policy) questions easier to answer.
3749EOM
3750
3751	fi
3752
3753	$cat <<EOM
3754
3755You may give one or more space-separated answers, or "none" if appropriate.
3756If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3757previous run of Configure, you may specify it as well as or instead of
3758OS-specific hints.  If hints are provided for your OS, you should use them:
3759although Perl can probably be built without hints on many platforms, using
3760hints often improve performance and may enable features that Configure can't
3761set up on its own. If there are no hints that match your OS, specify "none";
3762DO NOT give a wrong version or a wrong OS.
3763
3764EOM
3765
3766	rp="Which of these apply, if any?"
3767	. UU/myread
3768	tans=$ans
3769	for file in $tans; do
3770		if $test X$file = XPolicy -a -f Policy.sh; then
3771			. Policy.sh
3772			$cat Policy.sh >> UU/config.sh
3773		elif $test -f $src/hints/$file.sh; then
3774			. $src/hints/$file.sh
3775			$cat $src/hints/$file.sh >> UU/config.sh
3776		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3777			: nothing
3778		else
3779			: Give one chance to correct a possible typo.
3780			echo "$file.sh does not exist"
3781			dflt=$file
3782			rp="hint to use instead?"
3783			. UU/myread
3784			for file in $ans; do
3785				if $test -f "$src/hints/$file.sh"; then
3786					. $src/hints/$file.sh
3787					$cat $src/hints/$file.sh >> UU/config.sh
3788				elif $test X$ans = X -o X$ans = Xnone ; then
3789					: nothing
3790				else
3791					echo "$file.sh does not exist -- ignored."
3792				fi
3793			done
3794		fi
3795	done
3796
3797	hint=recommended
3798	: Remember our hint file for later.
3799	if $test -f "$src/hints/$file.sh" ; then
3800		hintfile="$file"
3801	else
3802		hintfile=''
3803	fi
3804fi
3805cd UU
3806;;
3807*)
3808	echo " "
3809	echo "Fetching default answers from $config_sh..." >&4
3810	tmp_n="$n"
3811	tmp_c="$c"
3812	cd ..
3813	cp $config_sh config.sh 2>/dev/null
3814	chmod +w config.sh
3815	. ./config.sh
3816	cd UU
3817	cp ../config.sh .
3818	n="$tmp_n"
3819	c="$tmp_c"
3820	hint=previous
3821	;;
3822esac
3823. ./optdef.sh
3824
3825: Restore computed paths
3826for file in $loclist $trylist; do
3827	eval $file="\$_$file"
3828done
3829
3830cat << EOM
3831
3832Configure uses the operating system name and version to set some defaults.
3833The default value is probably right if the name rings a bell. Otherwise,
3834since spelling matters for me, either accept the default or answer "none"
3835to leave it blank.
3836
3837EOM
3838case "$osname" in
3839	''|' ')
3840		case "$hintfile" in
3841		''|' '|none) dflt=none ;;
3842		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3843		esac
3844		;;
3845	*) dflt="$osname" ;;
3846esac
3847rp="Operating system name?"
3848. ./myread
3849case "$ans" in
3850none)  osname='' ;;
3851*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3852esac
3853echo " "
3854case "$osvers" in
3855	''|' ')
3856		case "$hintfile" in
3857		''|' '|none) dflt=none ;;
3858		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3859			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3860			case "$dflt" in
3861			''|' ') dflt=none ;;
3862			esac
3863			;;
3864		esac
3865		;;
3866	*) dflt="$osvers" ;;
3867esac
3868rp="Operating system version?"
3869. ./myread
3870case "$ans" in
3871none)  osvers='' ;;
3872*) osvers="$ans" ;;
3873esac
3874
3875
3876. ./posthint.sh
3877
3878: who configured the system
3879case "$cf_time" in
3880"")
3881	cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1` ;;
3882esac
3883case "$cf_by" in
3884"")
3885	cf_by=`(logname) 2>/dev/null`
3886	case "$cf_by" in
3887	"")
3888		cf_by=`(whoami) 2>/dev/null`
3889		case "$cf_by" in
3890		"") cf_by=unknown ;;
3891		esac ;;
3892	esac ;;
3893esac
3894
3895: decide how portable to be.  Allow command line overrides.
3896case "$d_portable" in
3897"$undef") ;;
3898*)	d_portable="$define" ;;
3899esac
3900
3901: set up shell script to do ~ expansion
3902cat >filexp <<EOSS
3903$startsh
3904: expand filename
3905case "\$1" in
3906 \~/*|\~)
3907	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3908	;;
3909 \~*)
3910	if $test -f /bin/csh; then
3911		/bin/csh -f -c "glob \$1"
3912		failed=\$?
3913		echo ""
3914		exit \$failed
3915	else
3916		name=\`$expr x\$1 : '..\([^/]*\)'\`
3917		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3918		if $test ! -d "\$dir"; then
3919			me=\`basename \$0\`
3920			echo "\$me: can't locate home directory for: \$name" >&2
3921			exit 1
3922		fi
3923		case "\$1" in
3924		*/*)
3925			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3926			;;
3927		*)
3928			echo \$dir
3929			;;
3930		esac
3931	fi
3932	;;
3933*)
3934	echo \$1
3935	;;
3936esac
3937EOSS
3938chmod +x filexp
3939$eunicefix filexp
3940
3941: now set up to get a file name
3942cat <<EOS >getfile
3943$startsh
3944EOS
3945cat <<'EOSC' >>getfile
3946tilde=''
3947fullpath=''
3948already=''
3949skip=''
3950none_ok=''
3951exp_file=''
3952nopath_ok=''
3953orig_rp="$rp"
3954orig_dflt="$dflt"
3955case "$gfpth" in
3956'') gfpth='.' ;;
3957esac
3958
3959case "$fn" in
3960*\(*)
3961	: getfile will accept an answer from the comma-separated list
3962	: enclosed in parentheses even if it does not meet other criteria.
3963	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3964	fn=`echo $fn | sed 's/(.*)//'`
3965	;;
3966esac
3967
3968case "$fn" in
3969*:*)
3970	loc_file=`expr $fn : '.*:\(.*\)'`
3971	fn=`expr $fn : '\(.*\):.*'`
3972	;;
3973esac
3974
3975case "$fn" in
3976*~*) tilde=true;;
3977esac
3978case "$fn" in
3979*/*) fullpath=true;;
3980esac
3981case "$fn" in
3982*+*) skip=true;;
3983esac
3984case "$fn" in
3985*n*) none_ok=true;;
3986esac
3987case "$fn" in
3988*e*) exp_file=true;;
3989esac
3990case "$fn" in
3991*p*) nopath_ok=true;;
3992esac
3993
3994case "$fn" in
3995*f*) type='File';;
3996*d*) type='Directory';;
3997*l*) type='Locate';;
3998esac
3999
4000what="$type"
4001case "$what" in
4002Locate) what='File';;
4003esac
4004
4005case "$exp_file" in
4006'')
4007	case "$d_portable" in
4008	"$define") ;;
4009	*) exp_file=true;;
4010	esac
4011	;;
4012esac
4013
4014cd ..
4015while test "$type"; do
4016	redo=''
4017	rp="$orig_rp"
4018	dflt="$orig_dflt"
4019	case "$tilde" in
4020	true) rp="$rp (~name ok)";;
4021	esac
4022	. UU/myread
4023	if test -f UU/getfile.ok && \
4024		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4025	then
4026		value="$ans"
4027		ansexp="$ans"
4028		break
4029	fi
4030	case "$ans" in
4031	none)
4032		value=''
4033		ansexp=''
4034		case "$none_ok" in
4035		true) type='';;
4036		esac
4037		;;
4038	*)
4039		case "$tilde" in
4040		'') value="$ans"
4041			ansexp="$ans";;
4042		*)
4043			value=`UU/filexp $ans`
4044			case $? in
4045			0)
4046				if test "$ans" != "$value"; then
4047					echo "(That expands to $value on this system.)"
4048				fi
4049				;;
4050			*) value="$ans";;
4051			esac
4052			ansexp="$value"
4053			case "$exp_file" in
4054			'') value="$ans";;
4055			esac
4056			;;
4057		esac
4058		case "$fullpath" in
4059		true)
4060			case "$ansexp" in
4061			/*) value="$ansexp" ;;
4062			[a-zA-Z]:/*) value="$ansexp" ;;
4063			*)
4064				redo=true
4065				case "$already" in
4066				true)
4067				echo "I shall only accept a full path name, as in /bin/ls." >&4
4068				echo "Use a ! shell escape if you wish to check pathnames." >&4
4069					;;
4070				*)
4071				echo "Please give a full path name, starting with slash." >&4
4072					case "$tilde" in
4073					true)
4074				echo "Note that using ~name is ok provided it expands well." >&4
4075						already=true
4076						;;
4077					esac
4078				esac
4079				;;
4080			esac
4081			;;
4082		esac
4083		case "$redo" in
4084		'')
4085			case "$type" in
4086			File)
4087				for fp in $gfpth; do
4088					if test "X$fp" = X.; then
4089					    pf="$ansexp"
4090					else
4091					    pf="$fp/$ansexp"
4092					fi
4093					if test -f "$pf"; then
4094						type=''
4095					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4096					then
4097						echo "($value is not a plain file, but that's ok.)"
4098						type=''
4099					fi
4100					if test X"$type" = X; then
4101					    value="$pf"
4102					    break
4103					fi
4104				done
4105				;;
4106			Directory)
4107				for fp in $gfpth; do
4108					if test "X$fp" = X.; then
4109					    dir="$ans"
4110					    direxp="$ansexp"
4111					else
4112					    dir="$fp/$ansexp"
4113					    direxp="$fp/$ansexp"
4114					fi
4115					if test -d "$direxp"; then
4116						type=''
4117						value="$dir"
4118						break
4119					fi
4120				done
4121				;;
4122			Locate)
4123				if test -d "$ansexp"; then
4124					echo "(Looking for $loc_file in directory $value.)"
4125					value="$value/$loc_file"
4126					ansexp="$ansexp/$loc_file"
4127				fi
4128				if test -f "$ansexp"; then
4129					type=''
4130				fi
4131				case "$nopath_ok" in
4132				true)	case "$value" in
4133					*/*) ;;
4134					*)	echo "Assuming $value will be in people's path."
4135						type=''
4136						;;
4137					esac
4138					;;
4139				esac
4140				;;
4141			esac
4142
4143			case "$skip" in
4144			true) type='';
4145			esac
4146
4147			case "$type" in
4148			'') ;;
4149			*)
4150				if test "$fastread" = yes; then
4151					dflt=y
4152				else
4153					dflt=n
4154				fi
4155				rp="$what $value doesn't exist.  Use that name anyway?"
4156				. UU/myread
4157				dflt=''
4158				case "$ans" in
4159				y*) type='';;
4160				*) echo " ";;
4161				esac
4162				;;
4163			esac
4164			;;
4165		esac
4166		;;
4167	esac
4168done
4169cd UU
4170ans="$value"
4171rp="$orig_rp"
4172dflt="$orig_dflt"
4173rm -f getfile.ok
4174test "X$gfpthkeep" != Xy && gfpth=""
4175EOSC
4176
4177: determine root of directory hierarchy where package will be installed.
4178case "$prefix" in
4179'')	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4180	;;
4181*)	dflt="$prefix"
4182	;;
4183esac
4184$cat <<EOM
4185
4186By default, $package will be installed in $dflt/bin, manual pages
4187under $dflt/man, etc..., i.e. with $dflt as prefix for all
4188installation directories. Typically this is something like /usr/local.
4189If you wish to have binaries under /usr/bin but other parts of the
4190installation under /usr/local, that's ok: you will be prompted
4191separately for each of the installation directories, the prefix being
4192only used to set the defaults.
4193
4194EOM
4195fn=d~
4196rp='Installation prefix to use?'
4197. ./getfile
4198oldprefix=''
4199case "$prefix" in
4200'')	;;
4201*)	case "$ans" in
4202	"$prefix") ;;
4203	*) oldprefix="$prefix";;
4204	esac
4205	;;
4206esac
4207
4208case "$ans" in
4209*?/)	prefix=`echo "$ans" | sed 's/.$//'`
4210	;;
4211*)	prefix="$ans"
4212esac
4213
4214case "$ansexp" in
4215*?/)	prefixexp=`echo "$ansexp" | sed 's/.$//'`
4216	;;
4217*)	prefixexp="$ansexp"
4218esac
4219
4220: allow them to override the AFS root
4221case "$afsroot" in
4222'')	afsroot=/afs ;;
4223*)	afsroot=$afsroot ;;
4224esac
4225
4226: is AFS running?
4227echo " "
4228case "$afs" in
4229$define|true)	afs=true ;;
4230$undef|false)	afs=false ;;
4231*)	if $test -d $afsroot; then
4232		afs=true
4233	else
4234		afs=false
4235	fi
4236	;;
4237esac
4238if $afs; then
4239	echo "AFS may be running... I'll be extra cautious then..." >&4
4240else
4241	echo "AFS does not seem to be running..." >&4
4242fi
4243
4244: determine installation prefix for where package is to be installed.
4245if $afs; then
4246$cat <<EOM
4247
4248Since you are running AFS, I need to distinguish the directory in which
4249files will reside from the directory in which they are installed (and from
4250which they are presumably copied to the former directory by occult means).
4251
4252EOM
4253	case "$installprefix" in
4254	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4255	*) dflt="$installprefix";;
4256	esac
4257else
4258$cat <<EOM
4259
4260In some special cases, particularly when building $package for distribution,
4261it is convenient to distinguish the directory in which files should be
4262installed from the directory ($prefix) in which they will
4263eventually reside.  For most users, these two directories are the same.
4264
4265EOM
4266	case "$installprefix" in
4267	'') dflt=$prefix ;;
4268	*) dflt=$installprefix;;
4269	esac
4270fi
4271fn=d~
4272rp='What installation prefix should I use for installing files?'
4273. ./getfile
4274installprefix="$ans"
4275installprefixexp="$ansexp"
4276
4277: Perform the prefixexp/installprefixexp correction if necessary
4278cat <<EOS >installprefix
4279$startsh
4280EOS
4281cat <<'EOSC' >>installprefix
4282: Change installation prefix, if necessary.
4283if $test X"$prefix" != X"$installprefix"; then
4284    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4285else
4286    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4287fi
4288EOSC
4289chmod +x installprefix
4290$eunicefix installprefix
4291
4292: Set variables such as privlib and privlibexp from the output of ./getfile
4293: performing the prefixexp/installprefixexp correction if necessary.
4294cat <<EOS >setprefixvar
4295$startsh
4296EOS
4297cat <<'EOSC' >>setprefixvar
4298eval "${prefixvar}=\"\$ans\""
4299eval "${prefixvar}exp=\"\$ansexp\""
4300. ./installprefix
4301EOSC
4302chmod +x setprefixvar
4303$eunicefix setprefixvar
4304
4305: set up the script used to warn in case of inconsistency
4306cat <<EOS >whoa
4307$startsh
4308EOS
4309cat <<'EOSC' >>whoa
4310dflt=y
4311case "$hint" in
4312    recommended)
4313	case "$hintfile" in
4314	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4315		;;
4316	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4317		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4318		;;
4319	esac
4320	;;
4321    *)	echo " "
4322	echo "*** WHOA THERE!!! ***" >&4
4323	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4324	;;
4325esac
4326rp="    Keep the $hint value?"
4327. ./myread
4328case "$ans" in
4329y) td=$was; tu=$was;;
4330esac
4331EOSC
4332
4333: function used to set '$1' to '$val'
4334setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4335case "$val$was" in
4336$define$undef) . ./whoa; eval "$var=\$td";;
4337$undef$define) . ./whoa; eval "$var=\$tu";;
4338*) eval "$var=$val";;
4339esac'
4340
4341: get the patchlevel
4342echo " "
4343echo "Getting the current patchlevel..." >&4
4344if $test -r $rsrc/patchlevel.h;then
4345	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4346	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4347	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4348	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4349	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4350	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4351	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4352else
4353	revision=0
4354	patchlevel=0
4355	subversion=0
4356	api_revision=0
4357	api_version=0
4358	api_subversion=0
4359	perl_patchlevel=0
4360	$echo "(You do not have patchlevel.h.  Eek.)"
4361fi
4362: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4363version_patchlevel_string="version $patchlevel subversion $subversion"
4364case "$perl_patchlevel" in
43650|'') ;;
4366*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4367    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4368    ;;
4369esac
4370
4371$echo "(You have $package $version_patchlevel_string.)"
4372
4373case "$osname" in
4374dos|vms)
4375	: XXX Should be a Configure test for double-dots in filenames.
4376	version=`echo $revision $patchlevel $subversion | \
4377		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4378	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4379		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4380	;;
4381*)
4382	version=`echo $revision $patchlevel $subversion | \
4383		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4384	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4385		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4386	;;
4387esac
4388: Special case the 5.005_xx maintenance series, which used 5.005
4389: without any subversion label as a subdirectory in $sitelib
4390if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4391	api_versionstring='5.005'
4392fi
4393
4394: Do we want threads support and if so, what type
4395case "$usethreads" in
4396$define|true|[yY]*)     dflt='y';;
4397*)     # Catch case where user specified ithreads or 5005threads but
4398       # forgot -Dusethreads (A.D. 4/2002)
4399       case "$useithreads$use5005threads" in
4400       *$define*)	dflt='y';;
4401       *)		dflt='n';;
4402       esac
4403       ;;
4404esac
4405cat <<EOM
4406
4407Perl can be built to offer a form of threading support on some systems
4408To do so, Configure can be run with -Dusethreads.
4409
4410Note that Perl built with threading support runs slightly slower
4411and uses slightly more memory than plain Perl.
4412
4413If this doesn't make any sense to you, just accept the default '$dflt'.
4414EOM
4415rp='Build a threading Perl?'
4416. ./myread
4417case "$ans" in
4418y|Y)    val="$define" ;;
4419*)      val="$undef" ;;
4420esac
4421set usethreads
4422eval $setvar
4423
4424if $test $patchlevel -lt 9; then
4425    case "$usethreads" in
4426    $define)
4427	: Default to ithreads unless overridden on command line or with
4428	: old config.sh
4429	dflt='y'
4430	case "$use5005threads" in
4431		$define|true|[yY]*)
4432			echo "5.005 threads are no longer supported"
4433			exit 1
4434		;;
4435	esac
4436	case "$useithreads" in
4437		$undef|false|[nN]*) dflt='n';;
4438	esac
4439	rp='Use the newer interpreter-based ithreads?'
4440	. ./myread
4441	case "$ans" in
4442	y|Y)    val="$define" ;;
4443	*)      val="$undef" ;;
4444	esac
4445	set useithreads
4446	eval $setvar
4447	: Now set use5005threads to the opposite value.
4448	case "$useithreads" in
4449	$define) val="$undef" ;;
4450	*) val="$define" ;;
4451	esac
4452	set use5005threads
4453	eval $setvar
4454	;;
4455    *)
4456	useithreads="$undef"
4457	use5005threads="$undef"
4458	;;
4459    esac
4460
4461    case "$useithreads$use5005threads" in
4462    "$define$define")
4463	$cat >&4 <<EOM
4464
4465You cannot have both the ithreads and the 5.005 threads enabled
4466at the same time.  Disabling the 5.005 threads since they are
4467much less stable than the ithreads.
4468
4469EOM
4470	use5005threads="$undef"
4471	;;
4472    esac
4473
4474else
4475: perl-5.9.x and later
4476
4477    if test X"$usethreads" = "X$define"; then
4478	case "$use5005threads" in
4479	    $define|true|[yY]*)
4480		$cat >&4 <<EOM
4481
44825.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4483
4484EOM
4485	    ;;
4486	esac
4487    fi
4488
4489    use5005threads="$undef"
4490    useithreads="$usethreads"
4491fi
4492
4493case "$d_oldpthreads" in
4494'')	: Configure tests would be welcome here.  For now, assume undef.
4495	val="$undef" ;;
4496*)	val="$d_oldpthreads" ;;
4497esac
4498set d_oldpthreads
4499eval $setvar
4500
4501
4502: Look for a hint-file generated 'call-back-unit'.  If the
4503: user has specified that a threading perl is to be built,
4504: we may need to set or change some other defaults.
4505if $test -f usethreads.cbu; then
4506    echo "Your platform has some specific hints regarding threaded builds, using them..."
4507    . ./usethreads.cbu
4508else
4509    case "$usethreads" in
4510	"$define"|true|[yY]*)
4511		$cat <<EOM
4512(Your platform does not have any specific hints for threaded builds.
4513 Assuming POSIX threads, then.)
4514EOM
4515	;;
4516    esac
4517fi
4518
4519: Check if multiplicity is required
4520cat <<EOM
4521
4522Perl can be built so that multiple Perl interpreters can coexist
4523within the same Perl executable.
4524EOM
4525
4526case "$useithreads" in
4527$define)
4528	cat <<EOM
4529This multiple interpreter support is required for interpreter-based threads.
4530EOM
4531	val="$define"
4532	;;
4533*)	case "$usemultiplicity" in
4534	$define|true|[yY]*)	dflt='y';;
4535	*) dflt='n';;
4536	esac
4537	echo " "
4538	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4539	rp='Build Perl for multiplicity?'
4540	. ./myread
4541	case "$ans" in
4542	y|Y)	val="$define" ;;
4543	*)      val="$undef" ;;
4544	esac
4545	;;
4546esac
4547set usemultiplicity
4548eval $setvar
4549
4550: Check if morebits is requested
4551case "$usemorebits" in
4552"$define"|true|[yY]*)
4553	use64bitint="$define"
4554	uselongdouble="$define"
4555	usemorebits="$define"
4556	;;
4557*)	usemorebits="$undef"
4558	;;
4559esac
4560
4561: Determine the C compiler to be used
4562echo " "
4563case "$cc" in
4564'') dflt=cc;;
4565*) dflt="$cc";;
4566esac
4567rp="Use which C compiler?"
4568. ./myread
4569cc="$ans"
4570
4571: See whether they have no cc but they do have gcc
4572. ./trygcc
4573if $test -f cc.cbu; then
4574    . ./cc.cbu
4575fi
4576. ./checkcc
4577
4578: make some quick guesses about what we are up against
4579echo " "
4580$echo $n "Hmm...  $c"
4581echo exit 1 >bsd
4582echo exit 1 >usg
4583echo exit 1 >v7
4584echo exit 1 >osf1
4585echo exit 1 >eunice
4586echo exit 1 >xenix
4587echo exit 1 >venix
4588echo exit 1 >os2
4589d_bsd="$undef"
4590$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4591if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4592then
4593	echo "Looks kind of like an OSF/1 system, but we'll see..."
4594	echo exit 0 >osf1
4595elif test `echo abc | $tr a-z A-Z` = Abc ; then
4596	xxx=`./loc addbib blurfl $pth`
4597	if $test -f $xxx; then
4598	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4599		echo exit 0 >bsd
4600		echo exit 0 >usg
4601	else
4602		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4603			echo "Looks kind of like an extended USG system, but we'll see..."
4604		else
4605			echo "Looks kind of like a USG system, but we'll see..."
4606		fi
4607		echo exit 0 >usg
4608	fi
4609elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4610	echo "Looks kind of like a BSD system, but we'll see..."
4611	d_bsd="$define"
4612	echo exit 0 >bsd
4613else
4614	echo "Looks kind of like a Version 7 system, but we'll see..."
4615	echo exit 0 >v7
4616fi
4617case "$eunicefix" in
4618*unixtovms*)
4619	$cat <<'EOI'
4620There is, however, a strange, musty smell in the air that reminds me of
4621something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4622EOI
4623	echo exit 0 >eunice
4624	d_eunice="$define"
4625: it so happens the Eunice I know will not run shell scripts in Unix format
4626	;;
4627*)
4628	echo " "
4629	echo "Congratulations.  You aren't running Eunice."
4630	d_eunice="$undef"
4631	;;
4632esac
4633: Detect OS2.  The p_ variable is set above in the Head.U unit.
4634: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4635: semicolon as a patch separator
4636case "$p_" in
4637:) ;;
4638*)
4639	$cat <<'EOI'
4640I have the feeling something is not exactly right, however...don't tell me...
4641lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4642(Or you may be running DOS with DJGPP.)
4643EOI
4644	echo exit 0 >os2
4645	;;
4646esac
4647if test -f /xenix; then
4648	echo "Actually, this looks more like a XENIX system..."
4649	echo exit 0 >xenix
4650	d_xenix="$define"
4651else
4652	echo " "
4653	echo "It's not Xenix..."
4654	d_xenix="$undef"
4655fi
4656chmod +x xenix
4657$eunicefix xenix
4658if test -f /venix; then
4659	echo "Actually, this looks more like a VENIX system..."
4660	echo exit 0 >venix
4661else
4662	echo " "
4663	if ./xenix; then
4664		: null
4665	else
4666		echo "Nor is it Venix..."
4667	fi
4668fi
4669chmod +x bsd usg v7 osf1 eunice xenix venix os2
4670$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4671$rm -f foo
4672
4673: Check if we are using GNU gcc and what its version is
4674echo " "
4675echo "Checking for GNU cc in disguise and/or its version number..." >&4
4676$cat >try.c <<EOM
4677#include <stdio.h>
4678int main() {
4679#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4680#ifdef __VERSION__
4681	printf("%s\n", __VERSION__);
4682#else
4683	printf("%s\n", "1");
4684#endif
4685#endif
4686	return(0);
4687}
4688EOM
4689if $cc -o try $ccflags $ldflags try.c; then
4690	gccversion=`$run ./try`
4691	case "$gccversion" in
4692	'') echo "You are not using GNU cc." ;;
4693	*)  echo "You are using GNU cc $gccversion."
4694	    ccname=gcc
4695	    ;;
4696	esac
4697else
4698	echo " "
4699	echo "*** WHOA THERE!!! ***" >&4
4700	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4701	case "$knowitall" in
4702	'')
4703	echo "    You'd better start hunting for one and let me know about it." >&4
4704		exit 1
4705		;;
4706	esac
4707fi
4708$rm -f try try.*
4709case "$gccversion" in
47101.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4711esac
4712case "$gccversion" in
4713'') gccosandvers='' ;;
4714*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4715   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4716   gccshortvers=''
4717   case "$gccosandvers" in
4718   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4719   $osname$osvers) ;; # looking good
4720   $osname*) cat <<EOM >&4
4721
4722*** WHOA THERE!!! ***
4723
4724    Your gcc has not been compiled for the exact release of
4725    your operating system ($gccosandvers versus $osname$osvers).
4726
4727    In general it is a good idea to keep gcc synchronized with
4728    the operating system because otherwise serious problems
4729    may ensue when trying to compile software, like Perl.
4730
4731    I'm trying to be optimistic here, though, and will continue.
4732    If later during the configuration and build icky compilation
4733    problems appear (headerfile conflicts being the most common
4734    manifestation), I suggest reinstalling the gcc to match
4735    your operating system release.
4736
4737EOM
4738      ;;
4739   *) gccosandvers='' ;; # failed to parse, better be silent
4740   esac
4741   ;;
4742esac
4743case "$ccname" in
4744'') ccname="$cc" ;;
4745esac
4746
4747# gcc 3.* complain about adding -Idirectories that they already know about,
4748# so we will take those off from locincpth.
4749case "$gccversion" in
47503.*)
4751    echo "main(){}">try.c
4752    for incdir in $locincpth; do
4753       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4754	     grep '^c[cp]p*[01]: warning: changing search order '`
4755       if test "X$warn" != X; then
4756	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4757       fi
4758    done
4759    $rm -f try try.*
4760esac
4761
4762# gcc 4.9 by default does some optimizations that break perl.
4763# see ticket 121505.
4764#
4765# The -fwrapv disables those optimizations (and probably others,) so
4766# for gcc 4.9 (and later, since the optimizations probably won't go
4767# away), add -fwrapv unless the user requests -fno-wrapv, which
4768# disables -fwrapv, or if the user requests -fsanitize=undefined,
4769# which turns the overflows -fwrapv ignores into runtime errors.
4770case "$gccversion" in
47714.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4772    case "$ccflags" in
4773    *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4774    *) ccflags="$ccflags -fwrapv" ;;
4775    esac
4776esac
4777
4778: What should the include directory be ?
4779: Use sysroot if set, so findhdr looks in the right place.
4780echo " "
4781$echo $n "Hmm...  $c"
4782dflt="$sysroot/usr/include"
4783incpath=''
4784mips_type=''
4785if $test -f /bin/mips && /bin/mips; then
4786	echo "Looks like a MIPS system..."
4787	$cat >usr.c <<'EOCP'
4788#ifdef SYSTYPE_BSD43
4789/bsd43
4790#endif
4791EOCP
4792	if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4793		dflt='/bsd43/usr/include'
4794		incpath='/bsd43'
4795		mips_type='BSD 4.3'
4796	else
4797		mips_type='System V'
4798	fi
4799	$rm -f usr.c usr.out
4800	echo "and you're compiling with the $mips_type compiler and libraries."
4801	xxx_prompt=y
4802	echo "exit 0" >mips
4803else
4804	echo "Doesn't look like a MIPS system."
4805	xxx_prompt=n
4806	echo "exit 1" >mips
4807fi
4808chmod +x mips
4809$eunicefix mips
4810case "$usrinc" in
4811'') ;;
4812*) dflt="$usrinc";;
4813esac
4814case "$xxx_prompt" in
4815y)	fn=d/
4816	echo " "
4817	rp='Where are the include files you want to use?'
4818	. ./getfile
4819	usrinc="$ans"
4820	;;
4821*)	usrinc="$dflt"
4822	;;
4823esac
4824
4825: see how we invoke the C preprocessor
4826echo " "
4827echo "Now, how can we feed standard input to your C preprocessor..." >&4
4828cat <<'EOT' >testcpp.c
4829#define ABC abc
4830#define XYZ xyz
4831ABC.XYZ
4832EOT
4833cd ..
4834if test ! -f cppstdin; then
4835	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4836		# AIX cc -E doesn't show the absolute headerfile
4837		# locations but we'll cheat by using the -M flag.
4838		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
4839	else
4840		echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4841	fi
4842else
4843	echo "Keeping your $hint cppstdin wrapper."
4844fi
4845chmod 755 cppstdin
4846wrapper=`pwd`/cppstdin
4847ok='false'
4848cd UU
4849
4850if $test "X$cppstdin" != "X" && \
4851	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4852	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4853then
4854	echo "You used to use $cppstdin $cppminus so we'll use that again."
4855	case "$cpprun" in
4856	'') echo "But let's see if we can live without a wrapper..." ;;
4857	*)
4858		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4859			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4860		then
4861			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4862			ok='true'
4863		else
4864			echo "(However, $cpprun $cpplast does not work, let's see...)"
4865		fi
4866		;;
4867	esac
4868else
4869	case "$cppstdin" in
4870	'') ;;
4871	*)
4872		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4873		;;
4874	esac
4875fi
4876
4877if $ok; then
4878	: nothing
4879elif echo 'Maybe "'"$cc"' -E" will work...'; \
4880	$cc -E <testcpp.c >testcpp.out 2>&1; \
4881	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4882	echo "Yup, it does."
4883	x_cpp="$cc $cppflags -E"
4884	x_minus='';
4885elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4886	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4887	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4888	echo "Yup, it does."
4889	x_cpp="$cc $cppflags -E"
4890	x_minus='-';
4891elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4892	$cc -P <testcpp.c >testcpp.out 2>&1; \
4893	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894	echo "Yipee, that works!"
4895	x_cpp="$cc $cppflags -P"
4896	x_minus='';
4897elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4898	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4899	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4900	echo "At long last!"
4901	x_cpp="$cc $cppflags -P"
4902	x_minus='-';
4903elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4904	$cpp <testcpp.c >testcpp.out 2>&1; \
4905	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4906	echo "It works!"
4907	x_cpp="$cpp $cppflags"
4908	x_minus='';
4909elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4910	$cpp - <testcpp.c >testcpp.out 2>&1; \
4911	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4912	echo "Hooray, it works!  I was beginning to wonder."
4913	x_cpp="$cpp $cppflags"
4914	x_minus='-';
4915elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4916	$wrapper <testcpp.c >testcpp.out 2>&1; \
4917	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4918	x_cpp="$wrapper"
4919	x_minus=''
4920	echo "Eureka!"
4921else
4922	dflt=''
4923	rp="No dice.  I can't find a C preprocessor.  Name one:"
4924	. ./myread
4925	x_cpp="$ans"
4926	x_minus=''
4927	$x_cpp <testcpp.c >testcpp.out 2>&1
4928	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4929		echo "OK, that will do." >&4
4930	else
4931echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4932		exit 1
4933	fi
4934fi
4935
4936case "$ok" in
4937false)
4938	cppstdin="$x_cpp"
4939	cppminus="$x_minus"
4940	cpprun="$x_cpp"
4941	cpplast="$x_minus"
4942	set X $x_cpp
4943	shift
4944	case "$1" in
4945	"$cpp")
4946		echo "Perhaps can we force $cc -E using a wrapper..."
4947		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4948			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4949		then
4950			echo "Yup, we can."
4951			cppstdin="$wrapper"
4952			cppminus='';
4953		else
4954			echo "Nope, we'll have to live without it..."
4955		fi
4956		;;
4957	esac
4958	case "$cpprun" in
4959	"$wrapper")
4960		cpprun=''
4961		cpplast=''
4962		;;
4963	esac
4964	;;
4965esac
4966
4967case "$cppstdin" in
4968"$wrapper"|'cppstdin') ;;
4969*) $rm -f $wrapper;;
4970esac
4971$rm -f testcpp.c testcpp.out
4972
4973: Adjust cppfilter for path component separator
4974case "$osname" in
4975vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4976os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4977*)   cppfilter='' ;;
4978esac
4979
4980: Use gcc to determine libpth and incpth
4981# If using gcc or clang, we can get better values for libpth, incpth
4982# and usrinc directly from the compiler.
4983# Note that ccname for clang is also gcc.
4984case "$ccname" in
4985    gcc)
4986	$echo 'extern int foo;' > try.c
4987	set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4988	shift
4989	if $test $# -gt 0; then
4990	    incpth="$incpth $*"
4991	    incpth="`$echo $incpth|$sed 's/^ //'`"
4992	    for i in $*; do
4993		j="`$echo $i|$sed 's,/include$,/lib,'`"
4994		if $test -d $j; then
4995		    libpth="$libpth $j"
4996		fi
4997	    done
4998	    libpth="`$echo $libpth|$sed 's/^ //'`"
4999	    for xxx in $libpth $loclibpth $plibpth $glibpth; do
5000		if $test -d $xxx; then
5001		    case " $libpth " in
5002		    *" $xxx "*) ;;
5003		    *) libpth="$libpth $xxx";;
5004		    esac
5005		fi
5006	    done
5007	fi
5008	$rm -f try.c
5009	case "$usrinc" in
5010	'') for i in $incpth; do
5011		if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5012		    usrinc="$i"
5013		    break
5014		fi
5015	    done
5016	    ;;
5017	esac
5018
5019	case "$usecrosscompile" in
5020	$define|true|[yY]*)
5021	    case "$incpth" in
5022		'') echo "Incpth not defined." >&4; croak=y ;;
5023		*)  echo "Using incpth '$incpth'." >&4 ;;
5024	    esac
5025	    case "$libpth" in
5026		'') echo "Libpth not defined." >&4; croak=y ;;
5027		*)  echo "Using libpth '$libpth'." >&4 ;;
5028	    esac
5029	    case "$usrinc" in
5030		'') echo "Usrinc not defined." >&4; croak=y ;;
5031		*)  echo "Using usrinc $usrinc." >&4 ;;
5032	    esac
5033	    case "$croak" in
5034		y)
5035		if test "X$sysroot" = X; then
5036		    echo "Cannot continue, aborting." >&4; exit 1
5037		else
5038		    echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5039		fi
5040		;;
5041	    esac
5042	    ;;
5043	esac
5044    ;;
5045esac
5046
5047: Default value for incpth is just usrinc
5048case "$incpth" in
5049'') incpth="$usrinc";;
5050esac
5051
5052: Set private lib path
5053case "$plibpth" in
5054'') if ./mips; then
5055	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5056    fi;;
5057esac
5058case "$libpth" in
5059' ') dlist='';;
5060'') dlist="$loclibpth $plibpth $glibpth";;
5061*) dlist="$libpth";;
5062esac
5063
5064: Now check and see which directories actually exist, avoiding duplicates
5065for xxx in $dlist
5066do
5067    if $test -d $xxx || [ $xxx = $prefix/lib ]; then
5068		case " $libpth " in
5069		*" $xxx "*) ;;
5070		*) libpth="$libpth $xxx";;
5071		esac
5072    fi
5073done
5074$cat <<'EOM'
5075
5076Some systems have incompatible or broken versions of libraries.  Among
5077the directories listed in the question below, please remove any you
5078know not to be holding relevant libraries, and add any that are needed.
5079Say "none" for none.
5080
5081EOM
5082
5083if test "X$sysroot" != X; then
5084    $cat <<EOM
5085You have set sysroot to $sysroot, please supply the directories excluding sysroot
5086
5087EOM
5088fi
5089
5090case "$libpth" in
5091'') dflt='none';;
5092*)
5093	set X $libpth
5094	shift
5095	dflt=${1+"$@"}
5096	;;
5097esac
5098rp="Directories to use for library searches?"
5099. ./myread
5100case "$ans" in
5101none) libpth=' ';;
5102*) libpth="$ans";;
5103esac
5104
5105: compute shared library extension
5106case "$so" in
5107'')
5108	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5109		dflt='sl'
5110	else
5111		dflt='so'
5112	fi
5113	;;
5114*) dflt="$so";;
5115esac
5116$cat <<EOM
5117
5118On some systems, shared libraries may be available.  Answer 'none' if
5119you want to suppress searching of shared libraries for the remainder
5120of this configuration.
5121
5122EOM
5123rp='What is the file extension used for shared libraries?'
5124. ./myread
5125so="$ans"
5126
5127: Does target system insist that shared library basenames are unique
5128$cat << EOM
5129
5130Some dynamic loaders assume that the *basename* of shared library filenames
5131are globally unique.  We'll default this to undef as we assume your system
5132is not this weird. Set to defined if you're on one of them.
5133
5134EOM
5135
5136dflt='n'
5137rp='Make shared library basenames unique?'
5138. ./myread
5139case "$ans" in
5140y|Y) val="$define" ;;
5141*)   val="$undef"  ;;
5142esac
5143set d_libname_unique
5144eval $setvar
5145
5146: Define several unixisms.
5147: Hints files or command line option can be used to override them.
5148: The convoluted testing is in case hints files set either the old
5149: or the new name.
5150case "$_exe" in
5151'')	case "$exe_ext" in
5152	'')	;;
5153	*)	_exe="$exe_ext" ;;
5154	esac
5155	;;
5156esac
5157case "$_a" in
5158'')	case "$lib_ext" in
5159    '')	_a='.a';;
5160	*)	_a="$lib_ext" ;;
5161	esac
5162	;;
5163esac
5164case "$_o" in
5165'') case "$obj_ext" in
5166	'')	_o='.o';;
5167	*)	_o="$obj_ext";;
5168	esac
5169	;;
5170esac
5171case "$p_" in
5172'') case "$path_sep" in
5173	'')	p_=':';;
5174	*)	p_="$path_sep";;
5175	esac
5176	;;
5177esac
5178exe_ext=$_exe
5179lib_ext=$_a
5180obj_ext=$_o
5181path_sep=$p_
5182
5183rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5184
5185: Which makefile gets called first.  This is used by make depend.
5186case "$firstmakefile" in
5187'') firstmakefile='makefile';;
5188esac
5189
5190: Check is we will use socks
5191case "$usesocks" in
5192$define|true|[yY]*)	dflt='y';;
5193*) dflt='n';;
5194esac
5195cat <<EOM
5196
5197Perl can be built to use the SOCKS proxy protocol library.  To do so,
5198Configure must be run with -Dusesocks.  If you use SOCKS you also need
5199to use the PerlIO abstraction layer, this will be implicitly selected.
5200
5201If this doesn't make any sense to you, just accept the default '$dflt'.
5202EOM
5203rp='Build Perl for SOCKS?'
5204. ./myread
5205case "$ans" in
5206y|Y)	val="$define" ;;
5207*)      val="$undef" ;;
5208esac
5209set usesocks
5210eval $setvar
5211
5212: Check for uselongdouble support
5213case "$ccflags" in
5214*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5215esac
5216
5217case "$uselongdouble" in
5218$define|true|[yY]*)	dflt='y';;
5219*) dflt='n';;
5220esac
5221cat <<EOM
5222
5223Perl can be built to take advantage of long doubles which
5224(if available) may give more accuracy and range for floating point numbers.
5225
5226If this doesn't make any sense to you, just accept the default '$dflt'.
5227EOM
5228rp='Try to use long doubles if available?'
5229. ./myread
5230case "$ans" in
5231y|Y)	val="$define"	;;
5232*)      val="$undef"	;;
5233esac
5234set uselongdouble
5235eval $setvar
5236
5237case "$uselongdouble" in
5238true|[yY]*) uselongdouble="$define" ;;
5239esac
5240
5241: Look for a hint-file generated 'call-back-unit'.  If the
5242: user has specified that long doubles should be used,
5243: we may need to set or change some other defaults.
5244if $test -f uselongdouble.cbu; then
5245    echo "Your platform has some specific hints regarding long doubles, using them..."
5246    . ./uselongdouble.cbu
5247else
5248    case "$uselongdouble" in
5249	$define)
5250		$cat <<EOM
5251(Your platform does not have any specific hints for long doubles.)
5252EOM
5253	;;
5254    esac
5255fi
5256
5257: Check if quadmath is requested
5258case "$usequadmath" in
5259"$define"|true|[yY]*) usequadmath="$define" ;;
5260*)                    usequadmath="$undef"  ;;
5261esac
5262
5263: Fail if both uselongdouble and usequadmath are requested
5264case "$usequadmath:$uselongdouble" in
5265define:define)
5266	$cat <<EOM >&4
5267
5268*** You requested the use of the quadmath library and use
5269*** of long doubles.
5270***
5271*** Please select one or the other.
5272EOM
5273	exit 1
5274	;;
5275esac
5276
5277: Looking for optional libraries
5278echo " "
5279echo "Checking for optional libraries..." >&4
5280case "$libs" in
5281' '|'') dflt='';;
5282*) dflt="$libs";;
5283esac
5284case "$libswanted" in
5285'') libswanted='c_s';;
5286esac
5287case "$usesocks" in
5288"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5289esac
5290case "$usecbacktrace" in
5291"$define") libswanted="$libswanted bfd" ;;
5292esac
5293case "$usequadmath" in
5294"$define") libswanted="$libswanted quadmath" ;;
5295esac
5296libsfound=''
5297libsfiles=''
5298libsdirs=''
5299libspath=''
5300for thisdir in $libpth $xlibpth; do
5301  test -d $thisdir && libspath="$libspath $thisdir"
5302done
5303for thislib in $libswanted; do
5304	for thisdir in $libspath; do
5305	    xxx=''
5306	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5307		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5308	        $test -f "$xxx" && eval $libscheck
5309		$test -f "$xxx" && libstyle=shared
5310		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5311	        $test -f "$xxx" && eval $libscheck
5312		$test -f "$xxx" && libstyle=shared
5313	    fi
5314	    if test ! -f "$xxx"; then
5315		xxx=$thisdir/lib$thislib.$so
5316	        $test -f "$xxx" && eval $libscheck
5317		$test -f "$xxx" && libstyle=shared
5318	    fi
5319	    if test ! -f "$xxx"; then
5320		xxx=$thisdir/lib$thislib$_a
5321	        $test -f "$xxx" && eval $libscheck
5322		$test -f "$xxx" && libstyle=static
5323	    fi
5324	    if test ! -f "$xxx"; then
5325		xxx=$thisdir/$thislib$_a
5326	        $test -f "$xxx" && eval $libscheck
5327		$test -f "$xxx" && libstyle=static
5328	    fi
5329	    if test ! -f "$xxx"; then
5330		xxx=$thisdir/lib${thislib}_s$_a
5331	        $test -f "$xxx" && eval $libscheck
5332		$test -f "$xxx" && libstyle=static
5333		$test -f "$xxx" && thislib=${thislib}_s
5334	    fi
5335	    if test ! -f "$xxx"; then
5336		xxx=$thisdir/Slib$thislib$_a
5337	        $test -f "$xxx" && eval $libscheck
5338		$test -f "$xxx" && libstyle=static
5339	    fi
5340	    if $test -f "$xxx"; then
5341		case "$libstyle" in
5342		shared) echo "Found -l$thislib (shared)." ;;
5343		static) echo "Found -l$thislib." ;;
5344		*)      echo "Found -l$thislib ($libstyle)." ;;
5345		esac
5346		case " $dflt " in
5347		*"-l$thislib "*);;
5348		*) dflt="$dflt -l$thislib"
5349                   libsfound="$libsfound $xxx"
5350                   yyy=`basename $xxx`
5351                   libsfiles="$libsfiles $yyy"
5352                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5353                   case " $libsdirs " in
5354                   *" $yyy "*) ;;
5355                   *) libsdirs="$libsdirs $yyy" ;;
5356                   esac
5357		   ;;
5358		esac
5359		break
5360	    fi
5361	done
5362	if $test ! -f "$xxx"; then
5363	    echo "No -l$thislib."
5364	fi
5365done
5366set X $dflt
5367shift
5368dflt="$*"
5369case "$libs" in
5370'') dflt="$dflt";;
5371*) dflt="$libs";;
5372esac
5373case "$dflt" in
5374' '|'') dflt='none';;
5375esac
5376
5377$cat <<EOM
5378
5379In order to compile $package on your machine, a number of libraries
5380are usually needed.  Include any other special libraries here as well.
5381Say "none" for none.  The default list is almost always right.
5382EOM
5383
5384echo " "
5385rp="What libraries to use?"
5386. ./myread
5387case "$ans" in
5388none) libs=' ';;
5389*) libs="$ans";;
5390esac
5391
5392: determine optimization, if desired, or use for debug flag also
5393case "$optimize" in
5394' '|$undef) dflt='none';;
5395'') dflt='-O';;
5396*) dflt="$optimize";;
5397esac
5398$cat <<EOH
5399
5400By default, $package compiles with the -O flag to use the optimizer.
5401Alternately, you might want to use the symbolic debugger, which uses
5402the -g flag (on traditional Unix systems).  Either flag can be
5403specified here.  To use neither flag, specify the word "none".
5404
5405EOH
5406rp="What optimizer/debugger flag should be used?"
5407. ./myread
5408optimize="$ans"
5409case "$optimize" in
5410'none') optimize=" ";;
5411esac
5412
5413: Check what DEBUGGING is required from the command line
5414: -DEBUGGING      or -DDEBUGGING or
5415: -DEBUGGING=both			= -g + -DDEBUGGING
5416: -DEBUGGING=-g   or -Doptimize=-g	= -g
5417: -DEBUGGING=none or -UDEBUGGING	=
5418: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5419case "$EBUGGING" in
5420'')	;;
5421*)	DEBUGGING=$EBUGGING ;;
5422esac
5423
5424case "$DEBUGGING" in
5425-g|both|$define)
5426    case "$optimize" in
5427	*-g*) ;;
5428	*)    optimize="$optimize -g" ;;
5429    esac ;;
5430none|$undef)
5431    case "$optimize" in
5432	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5433		shift
5434		optimize="$*"
5435		;;
5436    esac ;;
5437esac
5438
5439dflt=''
5440case "$DEBUGGING" in
5441both|$define) dflt='-DDEBUGGING'
5442esac
5443
5444: argument order is deliberate, as the flag will start with - which set could
5445: think is an option
5446checkccflag='check=$1; flag=$2; callback=$3;
5447echo " ";
5448echo "Checking if your compiler accepts $flag" 2>&1;
5449[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5450echo "int main(void) { return 0; }" > gcctest.c;
5451if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5452    echo "Yes, it does." 2>&1;
5453    if $test -s gcctest.out ; then
5454        echo "But your platform does not like it:";
5455        cat gcctest.out;
5456    else
5457	case "$ccflags" in
5458	*$check*)
5459	    echo "Leaving current flags $ccflags alone." 2>&1
5460	    ;;
5461	*) dflt="$dflt $flag";
5462	    eval $callback
5463	    ;;
5464	esac
5465    fi
5466else
5467    echo "Nope, it does not, but that is ok." 2>&1;
5468fi
5469'
5470
5471: We will not override a previous value, but we might want to
5472: augment a hint file
5473case "$hint" in
5474default|recommended)
5475	case "$gccversion" in
5476	1.*) dflt="$dflt -fpcc-struct-return" ;;
5477	esac
5478	case "$optimize:$DEBUGGING" in
5479	*-g*:old) dflt="$dflt -DDEBUGGING";;
5480	esac
5481	case "$gccversion" in
5482	2.*) if $test -d /etc/conf/kconfig.d &&
5483			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5484		then
5485			# Interactive Systems (ISC) POSIX mode.
5486			dflt="$dflt -posix"
5487		fi
5488		;;
5489	esac
5490	case "$gccversion" in
5491	1.*) ;;
5492	2.[0-8]*) ;;
5493	?*)	set strict-aliasing -fno-strict-aliasing
5494		eval $checkccflag
5495		;;
5496	esac
5497	# For gcc, adding -pipe speeds up compilations for some, but apparently
5498	# some assemblers can't read from stdin.  (It also slows down compilations
5499	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5500	case "$gccversion" in
5501	?*)	set pipe -pipe
5502		eval $checkccflag
5503		;;
5504	esac
5505
5506	# on x86_64 (at least) we require an extra library (libssp) in the
5507	# link command line. This library is not named, so I infer that it is
5508	# an implementation detail that may change. Hence the safest approach
5509	# is to add the flag to the flags passed to the compiler at link time,
5510	# as that way the compiler can do the right implementation dependant
5511	# thing. (NWC)
5512	case "$osname" in
5513	amigaos) ;; # -fstack-protector builds but doesn't work
5514	*)	case "$gccversion" in
5515		?*)	set stack-protector-strong -fstack-protector-strong
5516			eval $checkccflag
5517			case "$dflt" in
5518			*-fstack-protector-strong*) ;; # It got added.
5519			*) # Try the plain/older -fstack-protector.
5520			   set stack-protector -fstack-protector
5521			   eval $checkccflag
5522			   ;;
5523			esac
5524			;;
5525		esac
5526		;;
5527	esac
5528	;;
5529esac
5530
5531case "$mips_type" in
5532*BSD*|'') inclwanted="$locincpth $usrinc";;
5533*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5534esac
5535for thisincl in $inclwanted; do
5536	if $test -d $thisincl; then
5537		if $test x$thisincl != x$usrinc; then
5538			case "$dflt" in
5539			*" -I$thisincl "*);;
5540			*) dflt="$dflt -I$thisincl ";;
5541			esac
5542		fi
5543	fi
5544done
5545
5546inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5547	xxx=true;
5548elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5549	xxx=true;
5550else
5551	xxx=false;
5552fi;
5553if $xxx; then
5554	case "$dflt" in
5555	*$2*);;
5556	*) dflt="$dflt -D$2";;
5557	esac;
5558fi'
5559
5560set signal.h LANGUAGE_C; eval $inctest
5561
5562case "$usesocks" in
5563$define)
5564	ccflags="$ccflags -DSOCKS"
5565	;;
5566esac
5567
5568case "$hint" in
5569default|recommended) dflt="$ccflags $dflt" ;;
5570*) dflt="$ccflags";;
5571esac
5572
5573case "$dflt" in
5574''|' ') dflt=none;;
5575esac
5576
5577$cat <<EOH
5578
5579Your C compiler may want other flags.  For this question you should include
5580-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5581but you should NOT include libraries or ld flags like -lwhatever.  If you
5582want $package to honor its debug switch, you should include -DDEBUGGING here.
5583Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5584
5585To use no flags, specify the word "none".
5586
5587EOH
5588set X $dflt
5589shift
5590dflt=${1+"$@"}
5591rp="Any additional cc flags?"
5592. ./myread
5593case "$ans" in
5594none) ccflags='';;
5595*) ccflags="$ans";;
5596esac
5597
5598: the following weeds options from ccflags that are of no interest to cpp
5599case "$cppflags" in
5600'') cppflags="$ccflags" ;;
5601*)  set X $ccflags; shift
5602    case " $cppflags " in
5603    *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5604    *) cppflags="$cppflags $ccflags" ;;
5605    esac
5606    ;;
5607esac
5608case "$gccversion" in
56091.*) cppflags="$cppflags -D__GNUC__"
5610esac
5611case "$mips_type" in
5612'');;
5613*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5614esac
5615case "$cppflags" in
5616'');;
5617*)
5618	echo " "
5619	echo "Let me guess what the preprocessor flags are..." >&4
5620	set X $cppflags
5621	shift
5622	cppflags=''
5623	$cat >cpp.c <<'EOM'
5624#define BLURFL foo
5625
5626BLURFL xx LFRULB
5627EOM
5628	previous=''
5629	for flag in $*
5630	do
5631		case "$flag" in
5632		-*) ftry="$flag";;
5633		*) ftry="$previous $flag";;
5634		esac
5635		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5636			>cpp1.out 2>/dev/null && \
5637			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5638			>cpp2.out 2>/dev/null && \
5639			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5640			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5641		then
5642			cppflags="$cppflags $ftry"
5643			previous=''
5644		else
5645			previous="$flag"
5646		fi
5647	done
5648	set X $cppflags
5649	shift
5650	cppflags=${1+"$@"}
5651	case "$cppflags" in
5652	*-*)  echo "They appear to be: $cppflags";;
5653	esac
5654	$rm -f cpp.c cpp?.out
5655	;;
5656esac
5657
5658: flags used in final linking phase
5659case "$ldflags" in
5660'') if ./venix; then
5661		dflt='-i -z'
5662	else
5663		dflt=''
5664	fi
5665	case "$ccflags" in
5666	*-posix*) dflt="$dflt -posix" ;;
5667	esac
5668	;;
5669*) dflt="$ldflags";;
5670esac
5671# See note above about -fstack-protector
5672case "$ccflags" in
5673*-fstack-protector-strong*)
5674	case "$dflt" in
5675	*-fstack-protector-strong*) ;; # Don't add it again
5676	*) dflt="$dflt -fstack-protector-strong" ;;
5677	esac
5678	;;
5679*-fstack-protector*)
5680	case "$dflt" in
5681	*-fstack-protector*) ;; # Don't add it again
5682	*) dflt="$dflt -fstack-protector" ;;
5683	esac
5684	;;
5685esac
5686
5687: Try to guess additional flags to pick up local libraries.
5688for thislibdir in $libpth; do
5689	case " $loclibpth " in
5690	*" $thislibdir "*)
5691		case "$dflt " in
5692		*"-L$thislibdir "*) ;;
5693		*)  dflt="$dflt -L$thislibdir" ;;
5694		esac
5695		;;
5696	esac
5697done
5698
5699case "$dflt" in
5700'') dflt='none' ;;
5701esac
5702
5703$cat <<EOH
5704
5705Your C linker may need flags.  For this question you should
5706include -L/whatever and any other flags used by the C linker, but you
5707should NOT include libraries like -lwhatever.
5708
5709Make sure you include the appropriate -L/path flags if your C linker
5710does not normally search all of the directories you specified above,
5711namely
5712	$libpth
5713To use no flags, specify the word "none".
5714
5715EOH
5716
5717rp="Any additional ld flags (NOT including libraries)?"
5718. ./myread
5719case "$ans" in
5720none) ldflags='';;
5721*) ldflags="$ans";;
5722esac
5723rmlist="$rmlist pdp11"
5724
5725: coherency check
5726echo " "
5727echo "Checking your choice of C compiler and flags for coherency..." >&4
5728$cat > try.c <<'EOF'
5729#include <stdio.h>
5730int main() { printf("Ok\n"); return(0); }
5731EOF
5732set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5733shift
5734$cat >try.msg <<'EOM'
5735I've tried to compile and run the following simple program:
5736
5737EOM
5738$cat try.c >> try.msg
5739
5740$cat >> try.msg <<EOM
5741
5742I used the command:
5743
5744	$*
5745	$run ./try
5746
5747and I got the following output:
5748
5749EOM
5750dflt=y
5751if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5752	if $sh -c "$run ./try " >>try.msg 2>&1; then
5753		xxx=`$run ./try`
5754		case "$xxx" in
5755		"Ok") dflt=n ;;
5756		*)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5757		esac
5758	else
5759		echo "The program compiled OK, but exited with status $?." >>try.msg
5760		rp="You have a problem.  Shall I abort Configure"
5761		dflt=y
5762	fi
5763else
5764	echo "I can't compile the test program." >>try.msg
5765	rp="You have a BIG problem.  Shall I abort Configure"
5766	dflt=y
5767fi
5768case "$dflt" in
5769y)
5770	$cat try.msg >&4
5771	case "$knowitall" in
5772	'')
5773		echo "(The supplied flags or libraries might be incorrect.)"
5774		;;
5775	*) dflt=n;;
5776	esac
5777	echo " "
5778	. ./myread
5779	case "$ans" in
5780	n*|N*) ;;
5781	*)	echo "Ok.  Stopping Configure." >&4
5782		exit 1
5783		;;
5784	esac
5785	;;
5786n) echo "OK, that should do.";;
5787esac
5788$rm_try gcctest gcctest.out
5789
5790: define a shorthand compile call
5791compile='
5792mc_file=$1;
5793shift;
5794case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5795echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5796exit 1;
5797fi;
5798esac;
5799$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5800: define a shorthand compile call for compilations that should be ok.
5801compile_ok='
5802mc_file=$1;
5803shift;
5804$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5805
5806: stub, used only to satisfy other units
5807i_stdlib='define'
5808
5809: check for lengths of integral types
5810echo " "
5811case "$intsize" in
5812'')
5813	echo "Checking to see how big your integers are..." >&4
5814	$cat >try.c <<EOCP
5815#include <stdio.h>
5816#$i_stdlib I_STDLIB
5817#ifdef I_STDLIB
5818#include <stdlib.h>
5819#endif
5820int main()
5821{
5822	printf("intsize=%d;\n", (int)sizeof(int));
5823	printf("longsize=%d;\n", (int)sizeof(long));
5824	printf("shortsize=%d;\n", (int)sizeof(short));
5825	exit(0);
5826}
5827EOCP
5828	set try
5829	if eval $compile_ok && $run ./try > /dev/null; then
5830		eval `$run ./try`
5831		echo "Your integers are $intsize bytes long."
5832		echo "Your long integers are $longsize bytes long."
5833		echo "Your short integers are $shortsize bytes long."
5834	else
5835		$cat >&4 <<EOM
5836!
5837Help! I can't compile and run the intsize test program: please enlighten me!
5838(This is probably a misconfiguration in your system or libraries, and
5839you really ought to fix it.  Still, I'll try anyway.)
5840!
5841EOM
5842		dflt=4
5843		rp="What is the size of an integer (in bytes)?"
5844		. ./myread
5845		intsize="$ans"
5846		dflt=$intsize
5847		rp="What is the size of a long integer (in bytes)?"
5848		. ./myread
5849		longsize="$ans"
5850		dflt=2
5851		rp="What is the size of a short integer (in bytes)?"
5852		. ./myread
5853		shortsize="$ans"
5854	fi
5855	;;
5856esac
5857$rm_try
5858
5859: check for long long
5860echo " "
5861echo "Checking to see if you have long long..." >&4
5862echo 'int main() { long long x = 7; return 0; }' > try.c
5863set try
5864if eval $compile; then
5865	val="$define"
5866	echo "You have long long."
5867else
5868	val="$undef"
5869	echo "You do not have long long."
5870fi
5871$rm_try
5872set d_longlong
5873eval $setvar
5874
5875: check for length of long long
5876case "${d_longlong}${longlongsize}" in
5877$define)
5878	echo " "
5879	echo "Checking to see how big your long longs are..." >&4
5880	$cat >try.c <<'EOCP'
5881#include <stdio.h>
5882int main()
5883{
5884    printf("%d\n", (int)sizeof(long long));
5885    return(0);
5886}
5887EOCP
5888	set try
5889	if eval $compile_ok; then
5890		longlongsize=`$run ./try`
5891		echo "Your long longs are $longlongsize bytes long."
5892	else
5893		dflt='8'
5894		echo " "
5895		echo "(I can't seem to compile the test program.  Guessing...)"
5896		rp="What is the size of a long long (in bytes)?"
5897		. ./myread
5898		longlongsize="$ans"
5899	fi
5900	if $test "X$longsize" = "X$longlongsize"; then
5901		echo "(That isn't any different from an ordinary long.)"
5902	fi
5903	;;
5904esac
5905$rm_try
5906
5907: determine filename position in cpp output
5908echo " "
5909echo "Computing filename position in cpp output for #include directives..." >&4
5910case "$osname" in
5911amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5912esac
5913case "$fieldn" in
5914'')
5915case "$osname" in
5916vos) testaccess=-e ;;
5917*)   testaccess=-r ;;
5918esac
5919echo '#include <stdio.h>' > foo.c
5920$cat >fieldn <<EOF
5921$startsh
5922$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5923$grep '^[ 	]*#.*stdio\.h' | \
5924while read cline; do
5925	pos=1
5926	set \$cline
5927	while $test \$# -gt 0; do
5928		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5929			echo "\$pos"
5930			exit 0
5931		fi
5932		shift
5933		pos=\`expr \$pos + 1\`
5934	done
5935done
5936EOF
5937chmod +x fieldn
5938fieldn=`./fieldn`
5939$rm -f foo.c fieldn
5940;;
5941esac
5942case $fieldn in
5943'') pos='???';;
59441) pos=first;;
59452) pos=second;;
59463) pos=third;;
5947*) pos="${fieldn}th";;
5948esac
5949echo "Your cpp writes the filename in the $pos field of the line."
5950
5951: locate header file
5952$cat >findhdr <<EOF
5953$startsh
5954wanted=\$1
5955name=''
5956for usrincdir in $incpth
5957do
5958	if test -f \$usrincdir/\$wanted; then
5959		echo "\$usrincdir/\$wanted"
5960		exit 0
5961	fi
5962done
5963awkprg='{ print \$$fieldn }'
5964echo "#include <\$wanted>" > foo\$\$.c
5965$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5966$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5967while read cline; do
5968	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5969	case "\$name" in
5970	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5971	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5972	*) exit 2;;
5973	esac;
5974done;
5975#
5976# status = 0: grep returned 0 lines, case statement not executed
5977# status = 1: headerfile found
5978# status = 2: while loop executed, no headerfile found
5979#
5980status=\$?
5981$rm -f foo\$\$.c;
5982if test \$status -eq 1; then
5983	exit 0;
5984fi
5985exit 1
5986EOF
5987chmod +x findhdr
5988
5989: define an alternate in-header-list? function
5990inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5991cont=true; xxf="echo \"<\$1> found.\" >&4";
5992case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5993*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5994esac;
5995case $# in 4) instead=instead;; *) instead="at last";; esac;
5996while $test "$cont"; do
5997	xxx=`./findhdr $1`
5998	var=$2; eval "was=\$$2";
5999	if $test "$xxx" && $test -r "$xxx";
6000	then eval $xxf;
6001	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
6002		cont="";
6003	else eval $xxnf;
6004	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6005	set $yyy; shift; shift; yyy=$@;
6006	case $# in 0) cont="";;
6007	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6008		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6009	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
6010		xxnf="echo \"there is no <\$1>, ...\" >&4";;
6011	esac;
6012done;
6013while $test "$yyy";
6014do set $yyy; var=$2; eval "was=\$$2";
6015	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6016	set $yyy; shift; shift; yyy=$@;
6017done'
6018
6019: see if inttypes.h is available
6020: we want a real compile instead of Inhdr because some systems
6021: have an inttypes.h which includes non-existent headers
6022echo " "
6023$cat >try.c <<EOCP
6024#include <inttypes.h>
6025int main() {
6026	static int32_t foo32 = 0x12345678;
6027}
6028EOCP
6029set try
6030if eval $compile; then
6031	echo "<inttypes.h> found." >&4
6032	val="$define"
6033else
6034	echo "<inttypes.h> NOT found." >&4
6035	val="$undef"
6036fi
6037$rm_try
6038set i_inttypes
6039eval $setvar
6040
6041: check for int64_t
6042echo " "
6043echo "Checking to see if you have int64_t..." >&4
6044$cat >try.c <<EOCP
6045#include <sys/types.h>
6046#$i_inttypes I_INTTYPES
6047#ifdef I_INTTYPES
6048#include <inttypes.h>
6049#endif
6050int main() { int64_t x = 7; }
6051EOCP
6052set try
6053if eval $compile; then
6054	val="$define"
6055	echo "You have int64_t."
6056else
6057	val="$undef"
6058	echo "You do not have int64_t."
6059fi
6060$rm_try
6061set d_int64_t
6062eval $setvar
6063
6064: Check if 64bit ints have a quad type
6065echo " "
6066echo "Checking which 64-bit integer type we could use..." >&4
6067
6068case "$intsize" in
60698) val=int
6070   set quadtype
6071   eval $setvar
6072   val='"unsigned int"'
6073   set uquadtype
6074   eval $setvar
6075   quadkind=1
6076   ;;
6077*) case "$longsize" in
6078   8) val=long
6079      set quadtype
6080      eval $setvar
6081      val='"unsigned long"'
6082      set uquadtype
6083      eval $setvar
6084      quadkind=2
6085      ;;
6086   *) case "$d_longlong:$longlongsize" in
6087      define:8)
6088        val='"long long"'
6089        set quadtype
6090        eval $setvar
6091        val='"unsigned long long"'
6092        set uquadtype
6093        eval $setvar
6094        quadkind=3
6095        ;;
6096      *) case "$d_int64_t" in
6097         define)
6098           val=int64_t
6099           set quadtype
6100           eval $setvar
6101           val=uint64_t
6102           set uquadtype
6103           eval $setvar
6104           quadkind=4
6105           ;;
6106         esac
6107         ;;
6108      esac
6109      ;;
6110   esac
6111   ;;
6112esac
6113
6114case "$quadtype" in
6115'')	echo "Alas, no 64-bit integer types in sight." >&4
6116	d_quad="$undef"
6117	;;
6118*)	echo "We could use '$quadtype' for 64-bit integers." >&4
6119	d_quad="$define"
6120	;;
6121esac
6122
6123: Do we want 64bit support
6124case "$uselonglong" in
6125"$define"|true|[yY]*)
6126	cat <<EOM >&4
6127
6128*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6129EOM
6130	use64bitint="$define"
6131	;;
6132esac
6133case "$use64bits" in
6134"$define"|true|[yY]*)
6135	cat <<EOM >&4
6136
6137*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6138EOM
6139	use64bitint="$define"
6140	;;
6141esac
6142case "$use64bitints" in
6143"$define"|true|[yY]*)
6144	cat <<EOM >&4
6145
6146*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6147EOM
6148	use64bitint="$define"
6149	;;
6150esac
6151case "$use64bitsint" in
6152"$define"|true|[yY]*)
6153	cat <<EOM >&4
6154
6155*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6156EOM
6157	use64bitint="$define"
6158	;;
6159esac
6160case "$uselonglongs" in
6161"$define"|true|[yY]*)
6162	cat <<EOM >&4
6163
6164*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6165EOM
6166	use64bitint="$define"
6167	;;
6168esac
6169case "$use64bitsall" in
6170"$define"|true|[yY]*)
6171	cat <<EOM >&4
6172
6173*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6174EOM
6175	use64bitall="$define"
6176	;;
6177esac
6178
6179case "$ccflags" in
6180*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6181esac
6182case "$use64bitall" in
6183"$define"|true|[yY]*) use64bitint="$define" ;;
6184esac
6185
6186case "$longsize" in
61878) cat <<EOM
6188
6189You have natively 64-bit long integers.
6190EOM
6191   val="$define"
6192   ;;
6193*) case "$use64bitint" in
6194   "$define"|true|[yY]*) dflt='y';;
6195   *) dflt='n';;
6196   esac
6197   case "$d_quad" in
6198   "$define") ;;
6199   *) dflt='n' ;;
6200   esac
6201   cat <<EOM
6202
6203Perl can be built to take advantage of 64-bit integer types
6204on some systems.  To do so, Configure can be run with -Duse64bitint.
6205Choosing this option will most probably introduce binary incompatibilities.
6206
6207If this doesn't make any sense to you, just accept the default '$dflt'.
6208(The default has been chosen based on your configuration.)
6209EOM
6210   rp='Try to use 64-bit integers, if available?'
6211   . ./myread
6212   case "$ans" in
6213   [yY]*) val="$define" ;;
6214   *)     val="$undef"  ;;
6215   esac
6216   ;;
6217esac
6218set use64bitint
6219eval $setvar
6220
6221case "$use64bitall" in
6222"$define"|true|[yY]*) dflt='y' ;;
6223*) case "$longsize" in
6224   8) dflt='y' ;;
6225   *) dflt='n' ;;
6226   esac
6227   ;;
6228esac
6229cat <<EOM
6230
6231You may also choose to try maximal 64-bitness.  It means using as much
623264-bitness as possible on the platform.  This in turn means even more
6233binary incompatibilities.  On the other hand, your platform may not
6234have any more 64-bitness available than what you already have chosen.
6235
6236If this doesn't make any sense to you, just accept the default '$dflt'.
6237(The default has been chosen based on your configuration.)
6238EOM
6239rp='Try to use maximal 64-bit support, if available?'
6240. ./myread
6241case "$ans" in
6242[yY]*) val="$define" ;;
6243*)     val="$undef"  ;;
6244esac
6245set use64bitall
6246eval $setvar
6247case "$use64bitall" in
6248"$define")
6249	case "$use64bitint" in
6250	"$undef")
6251		cat <<EOM
6252
6253Since you have chosen a maximally 64-bit build, I'm also turning on
6254the use of 64-bit integers.
6255EOM
6256		use64bitint="$define" ;;
6257	esac
6258	;;
6259esac
6260
6261: Look for a hint-file generated 'call-back-unit'.  If the
6262: user has specified that a 64-bit perl is to be built,
6263: we may need to set or change some other defaults.
6264if $test -f use64bitint.cbu; then
6265	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6266	. ./use64bitint.cbu
6267fi
6268case "$use64bitint" in
6269"$define"|true|[yY]*)
6270	: This test was common to all the OpenBSD forks, and seems harmless for
6271	: other platforms:
6272	echo " "
6273	echo "Checking if your C library has broken 64-bit functions..." >&4
6274	cat >try.c <<EOCP
6275#include <stdio.h>
6276typedef $uquadtype myULL;
6277int main (void)
6278{
6279    struct {
6280	double d;
6281	myULL  u;
6282    } *p, test[] = {
6283	{4294967303.15, 4294967303ULL},
6284	{4294967294.2,  4294967294ULL},
6285	{4294967295.7,  4294967295ULL},
6286	{0.0, 0ULL}
6287    };
6288    for (p = test; p->u; p++) {
6289	myULL x = (myULL)p->d;
6290	if (x != p->u) {
6291	    printf("buggy\n");
6292	    return 0;
6293	}
6294    }
6295    printf("ok\n");
6296    return 0;
6297}
6298EOCP
6299	set try
6300	if eval $compile_ok; then
6301	    libcquad=`$run ./try`
6302	    echo "Your C library's 64-bit functions are $libcquad."
6303	else
6304	    echo "(I can't seem to compile the test program.)"
6305	    echo "Assuming that your C library's 64-bit functions are ok."
6306	    libcquad="ok"
6307	fi
6308	$rm_try
6309
6310	case "$libcquad" in
6311	    buggy*)
6312		cat >&4 <<EOM
6313
6314*** You have a C library with broken 64-bit functions.
6315*** 64-bit support does not work reliably in this configuration.
6316*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6317*** Cannot continue, aborting.
6318
6319EOM
6320		exit 1
6321		;;
6322	esac
6323	case "$longsize" in
6324	4) case "$archname64" in
6325	   '') archname64=64int ;;
6326	   esac
6327	   ;;
6328	esac
6329	;;
6330esac
6331
6332: Look for a hint-file generated 'call-back-unit'.  If the
6333: user has specified that a maximally 64-bit perl is to be built,
6334: we may need to set or change some other defaults.
6335if $test -f use64bitall.cbu; then
6336	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6337	. ./use64bitall.cbu
6338fi
6339case "$use64bitall" in
6340"$define"|true|[yY]*)
6341	case "$longsize" in
6342	4) case "$archname64" in
6343	   ''|64int) archname64=64all ;;
6344	   esac
6345	   ;;
6346	esac
6347	;;
6348esac
6349
6350case "$d_quad:$use64bitint" in
6351$undef:$define)
6352	cat >&4 <<EOF
6353
6354*** You have chosen to use 64-bit integers,
6355*** but none can be found.
6356*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6357*** Cannot continue, aborting.
6358
6359EOF
6360	exit 1
6361	;;
6362esac
6363
6364: Check if we are using the GNU C library
6365echo " "
6366echo "Checking for GNU C Library..." >&4
6367cat >try.c <<'EOCP'
6368/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6369   alone are insufficient to distinguish different versions, such as
6370   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6371   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6372*/
6373#include <stdio.h>
6374int main(void)
6375{
6376#ifdef __GLIBC__
6377#   ifdef __GLIBC_MINOR__
6378#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6379#           include <gnu/libc-version.h>
6380	    printf("%s\n",  gnu_get_libc_version());
6381#       else
6382	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6383#       endif
6384#   else
6385	printf("%d\n",  __GLIBC__);
6386#   endif
6387    return 0;
6388#else
6389    return 1;
6390#endif
6391}
6392EOCP
6393set try
6394if eval $compile_ok && $run ./try > glibc.ver; then
6395	val="$define"
6396	gnulibc_version=`$cat glibc.ver`
6397	echo "You are using the GNU C Library version $gnulibc_version"
6398else
6399	val="$undef"
6400	gnulibc_version=''
6401	echo "You are not using the GNU C Library"
6402fi
6403$rm_try glibc.ver
6404set d_gnulibc
6405eval $setvar
6406
6407: see if nm is to be used to determine whether a symbol is defined or not
6408case "$usenm" in
6409'')
6410	dflt=''
6411	case "$d_gnulibc" in
6412	"$define")
6413		echo " "
6414		echo "nm probably won't work on the GNU C Library." >&4
6415		dflt=n
6416		;;
6417	esac
6418	case "$dflt" in
6419	'')
6420		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6421			echo " "
6422			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6423			echo "'nm' won't be sufficient on this system." >&4
6424			dflt=n
6425		fi
6426		;;
6427	esac
6428	case "$dflt" in
6429	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6430		if $test $dflt -gt 20; then
6431			dflt=y
6432		else
6433			dflt=n
6434		fi
6435		;;
6436	esac
6437	;;
6438*)
6439	case "$usenm" in
6440	true|$define) dflt=y;;
6441	*) dflt=n;;
6442	esac
6443	;;
6444esac
6445$cat <<EOM
6446
6447I can use $nm to extract the symbols from your C libraries. This
6448is a time consuming task which may generate huge output on the disk (up
6449to 3 megabytes) but that should make the symbols extraction faster. The
6450alternative is to skip the 'nm' extraction part and to compile a small
6451test program instead to determine whether each symbol is present. If
6452you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6453this may be the best solution.
6454
6455You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6456
6457EOM
6458rp="Shall I use $nm to extract C symbols from the libraries?"
6459. ./myread
6460case "$ans" in
6461[Nn]*) usenm=false;;
6462*) usenm=true;;
6463esac
6464
6465runnm=$usenm
6466case "$reuseval" in
6467true) runnm=false;;
6468esac
6469
6470: nm options which may be necessary
6471case "$nm_opt" in
6472'') if $test -f /mach_boot; then
6473		nm_opt=''	# Mach
6474	elif $test -d /usr/ccs/lib; then
6475		nm_opt='-p'	# Solaris (and SunOS?)
6476	elif $test -f /dgux; then
6477		nm_opt='-p'	# DG-UX
6478	elif $test -f /lib64/rld; then
6479		nm_opt='-p'	# 64-bit Irix
6480	else
6481		nm_opt=''
6482	fi;;
6483esac
6484
6485: nm options which may be necessary for shared libraries but illegal
6486: for archive libraries.  Thank you, Linux.
6487case "$nm_so_opt" in
6488'')	case "$myuname" in
6489	*linux*|gnu*)
6490		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6491			nm_so_opt='--dynamic'
6492		fi
6493		;;
6494	esac
6495	;;
6496esac
6497
6498: Figure out where the libc is located
6499case "$runnm" in
6500true)
6501: get list of predefined functions in a handy place
6502echo " "
6503case "$libc" in
6504'') libc=unknown
6505	case "$libs" in
6506	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6507	esac
6508	;;
6509esac
6510case "$libs" in
6511'') ;;
6512*)  for thislib in $libs; do
6513	case "$thislib" in
6514	-lc|-lc_s)
6515		: Handle C library specially below.
6516		;;
6517	-l*)
6518		thislib=`echo $thislib | $sed -e 's/^-l//'`
6519		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6520			:
6521		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6522			:
6523		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6524			:
6525		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6526			:
6527		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6528			:
6529		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6530			:
6531		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6532			:
6533		else
6534			try=''
6535		fi
6536		libnames="$libnames $try"
6537		;;
6538	*) libnames="$libnames $thislib" ;;
6539	esac
6540	done
6541	;;
6542esac
6543xxx=normal
6544case "$libc" in
6545unknown)
6546	set /lib/libc.$so
6547	for xxx in $libpth; do
6548		$test -r $1 || set $xxx/libc.$so
6549		: The messy sed command sorts on library version numbers.
6550		$test -r $1 || \
6551			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6552			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6553				h
6554				s/[0-9][0-9]*/0000&/g
6555				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6556				G
6557				s/\n/ /' | \
6558			 $sort | $sed -e 's/^.* //'`
6559		eval set \$$#
6560	done
6561	$test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6562	$test -r $1 || set $sysroot/lib/libsys_s$_a
6563	;;
6564*)
6565	set blurfl
6566	;;
6567esac
6568if $test -r "$1"; then
6569	echo "Your (shared) C library seems to be in $1."
6570	libc="$1"
6571elif $test -r /lib/libc && $test -r /lib/clib; then
6572	echo "Your C library seems to be in both /lib/clib and /lib/libc."
6573	xxx=apollo
6574	libc='/lib/clib /lib/libc'
6575	if $test -r /lib/syslib; then
6576		echo "(Your math library is in /lib/syslib.)"
6577		libc="$libc /lib/syslib"
6578	fi
6579elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6580	echo "Your C library seems to be in $libc, as you said before."
6581elif $test -r $incpath/usr/lib/libc$_a; then
6582	libc=$incpath/usr/lib/libc$_a;
6583	echo "Your C library seems to be in $libc.  That's fine."
6584elif $test -r /lib/libc$_a; then
6585	libc=/lib/libc$_a;
6586	echo "Your C library seems to be in $libc.  You're normal."
6587else
6588	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6589		:
6590	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6591		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6592	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6593		:
6594	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6595		:
6596	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6597		:
6598	else
6599		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6600	fi
6601	if $test -r "$tans"; then
6602		echo "Your C library seems to be in $tans, of all places."
6603		libc=$tans
6604	else
6605		libc='blurfl'
6606	fi
6607fi
6608if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6609	dflt="$libc"
6610	cat <<EOM
6611
6612If the guess above is wrong (which it might be if you're using a strange
6613compiler, or your machine supports multiple models), you can override it here.
6614
6615EOM
6616else
6617	dflt=''
6618	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6619	cat >&4 <<EOM
6620I can't seem to find your C library.  I've looked in the following places:
6621
6622EOM
6623	$sed 's/^/	/' libpath
6624	cat <<EOM
6625
6626None of these seems to contain your C library. I need to get its name...
6627
6628EOM
6629fi
6630fn=f
6631rp='Where is your C library?'
6632. ./getfile
6633libc="$ans"
6634
6635echo " "
6636echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6637set X `cat libnames`
6638shift
6639xxx=files
6640case $# in 1) xxx=file; esac
6641echo "Extracting names from the following $xxx for later perusal:" >&4
6642echo " "
6643$sed 's/^/	/' libnames >&4
6644echo " "
6645$echo $n "This may take a while...$c" >&4
6646
6647for file in $*; do
6648	case $file in
6649	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6650	*) $nm $nm_opt $file 2>/dev/null;;
6651	esac
6652done >libc.tmp
6653
6654$echo $n ".$c"
6655$grep fprintf libc.tmp > libc.ptf
6656xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6657xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6658xxx='[ADTSIWi]'
6659if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6660	eval $xscan;\
6661	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662		eval $xrun
6663elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6664	eval $xscan;\
6665	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666		eval $xrun
6667elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6668	eval $xscan;\
6669	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670		eval $xrun
6671elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6672	eval $xscan;\
6673	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674		eval $xrun
6675elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6676	eval $xscan;\
6677	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678		eval $xrun
6679elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6680	eval $xscan;\
6681	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682		eval $xrun
6683elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6684				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
6685	eval $xscan;\
6686	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687		eval $xrun
6688elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6689	eval $xscan;\
6690	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691		eval $xrun
6692elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6693	eval $xscan;\
6694	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695		eval $xrun
6696elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6697	eval $xscan;\
6698	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699		eval $xrun
6700elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6701	eval $xscan;\
6702	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703		eval $xrun
6704elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6705	eval $xscan;\
6706	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6707		eval $xrun
6708elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6709	eval $xscan;\
6710	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6711		eval $xrun
6712elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6713	eval $xscan;\
6714	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6715		eval $xrun
6716else
6717	$nm -p $* 2>/dev/null >libc.tmp
6718	$grep fprintf libc.tmp > libc.ptf
6719	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6720		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6721	then
6722		nm_opt='-p'
6723		eval $xrun
6724	else
6725		echo " "
6726		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6727		com=''
6728		if $ar t $libc > libc.tmp && \
6729			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
6730		then
6731			for thisname in $libnames $libc; do
6732				$ar t $thisname >>libc.tmp
6733			done
6734			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6735			echo "Ok." >&4
6736		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6737			for thisname in $libnames $libc; do
6738				$ar tv $thisname >>libc.tmp
6739				emximp -o tmp.imp $thisname \
6740				    2>/dev/null && \
6741				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6742				    < tmp.imp >>libc.tmp
6743				$rm -f tmp.imp
6744			done
6745			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6746			echo "Ok." >&4
6747		else
6748			echo "$ar didn't seem to work right." >&4
6749			echo "Maybe this is a Cray...trying bld instead..." >&4
6750			if  bld t $libc | \
6751				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6752				$test -s libc.list
6753			then
6754				for thisname in $libnames; do
6755					bld t $libnames | \
6756					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6757					$ar t $thisname >>libc.tmp
6758				done
6759				echo "Ok." >&4
6760			else
6761				echo "That didn't work either.  Giving up." >&4
6762				exit 1
6763			fi
6764		fi
6765	fi
6766fi
6767nm_extract="$com"
6768case "$PASE" in
6769define)
6770    echo " "
6771    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6772    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6773    ;;
6774*)  if $test -f /lib/syscalls.exp; then
6775	echo " "
6776	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6777	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
6778		/lib/syscalls.exp >>libc.list
6779    fi
6780    ;;
6781esac
6782;;
6783esac
6784$rm -f libnames libpath
6785
6786: Check if we are using C++
6787echo " "
6788echo "Checking for C++..." >&4
6789$cat >try.c <<'EOCP'
6790#include <stdio.h>
6791int main(void)
6792{
6793#ifdef __cplusplus
6794    return 0;
6795#else
6796    return 1;
6797#endif
6798}
6799EOCP
6800set try
6801if eval $compile_ok && $run ./try; then
6802	val="$define"
6803	echo "You are using a C++ compiler."
6804else
6805	val="$undef"
6806	echo "You are not using a C++ compiler."
6807fi
6808$rm_try cplusplus$$
6809set d_cplusplus
6810eval $setvar
6811
6812: is a C symbol defined?
6813csym='tlook=$1;
6814case "$3" in
6815-v) tf=libc.tmp; tdc="";;
6816-a) tf=libc.tmp; tdc="[]";;
6817*) tlook="^$1\$"; tf=libc.list; tdc="()";;
6818esac;
6819case "$d_cplusplus" in
6820    $define)	extern_C="extern \"C\""	;;
6821    *)		extern_C="extern"	;;
6822esac;
6823tx=yes;
6824case "$reuseval-$4" in
6825true-) ;;
6826true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6827esac;
6828case "$tx" in
6829yes)
6830	tval=false;
6831	if $test "$runnm" = true; then
6832		if $contains $tlook $tf >/dev/null 2>&1; then
6833			tval=true;
6834		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6835			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6836			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6837			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6838			$rm_try;
6839		fi;
6840	else
6841		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6842		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6843		$rm_try;
6844	fi;
6845	;;
6846*)
6847	case "$tval" in
6848	$define) tval=true;;
6849	*) tval=false;;
6850	esac;
6851	;;
6852esac;
6853eval "$2=$tval"'
6854
6855: define an is-in-libc? function
6856inlibc='echo " "; td=$define; tu=$undef;
6857sym=$1; var=$2; eval "was=\$$2";
6858tx=yes;
6859case "$reuseval$was" in
6860true) ;;
6861true*) tx=no;;
6862esac;
6863case "$tx" in
6864yes)
6865	set $sym tres -f;
6866	eval $csym;
6867	case "$tres" in
6868	true)
6869		echo "$sym() found." >&4;
6870		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6871	*)
6872		echo "$sym() NOT found." >&4;
6873		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6874	esac;;
6875*)
6876	case "$was" in
6877	$define) echo "$sym() found." >&4;;
6878	*) echo "$sym() NOT found." >&4;;
6879	esac;;
6880esac'
6881
6882: check for length of double
6883echo " "
6884case "$doublesize" in
6885'')
6886	echo "Checking to see how big your double precision numbers are..." >&4
6887	$cat >try.c <<EOCP
6888#include <stdio.h>
6889#$i_stdlib I_STDLIB
6890#ifdef I_STDLIB
6891#include <stdlib.h>
6892#endif
6893int main()
6894{
6895    printf("%d\n", (int)sizeof(double));
6896    exit(0);
6897}
6898EOCP
6899	set try
6900	if eval $compile_ok; then
6901		doublesize=`$run ./try`
6902		echo "Your double is $doublesize bytes long."
6903	else
6904		dflt='8'
6905		echo "(I can't seem to compile the test program.  Guessing...)"
6906		rp="What is the size of a double precision number (in bytes)?"
6907		. ./myread
6908		doublesize="$ans"
6909	fi
6910	;;
6911esac
6912$rm_try
6913
6914: check for long doubles
6915echo " "
6916echo "Checking to see if you have long double..." >&4
6917echo 'int main() { long double x = 7.0; }' > try.c
6918set try
6919if eval $compile; then
6920	val="$define"
6921	echo "You have long double."
6922else
6923	val="$undef"
6924	echo "You do not have long double."
6925fi
6926$rm_try
6927set d_longdbl
6928eval $setvar
6929
6930: see if ldexpl exists
6931set ldexpl d_ldexpl
6932eval $inlibc
6933
6934: check for length of long double
6935case "${d_longdbl}${longdblsize}" in
6936$define)
6937	echo " "
6938	echo "Checking to see how big your long doubles are..." >&4
6939	$cat >try.c <<'EOCP'
6940#include <stdio.h>
6941int main()
6942{
6943	printf("%d\n", sizeof(long double));
6944}
6945EOCP
6946	set try
6947	set try
6948	if eval $compile; then
6949		longdblsize=`$run ./try`
6950		echo "Your long doubles are $longdblsize bytes long."
6951	else
6952		dflt='8'
6953		echo " "
6954		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6955		rp="What is the size of a long double (in bytes)?"
6956		. ./myread
6957		longdblsize="$ans"
6958	fi
6959	if $test "X$doublesize" = "X$longdblsize"; then
6960		echo "That isn't any different from an ordinary double."
6961		echo "I'll keep your setting anyway, but you may see some"
6962		echo "harmless compilation warnings."
6963	fi
6964	;;
6965esac
6966$rm_try
6967
6968$echo "Checking the kind of long doubles you have..." >&4
6969case "$d_longdbl" in
6970define)
6971$cat <<EOP >try.c
6972#$i_stdlib I_STDLIB
6973#define LONGDBLSIZE $longdblsize
6974#define DOUBLESIZE $doublesize
6975#include <float.h>
6976#ifdef I_STDLIB
6977#include <stdlib.h>
6978#endif
6979#include <stdio.h>
6980static const long double d = -0.1L;
6981int main() {
6982  unsigned const char* b = (unsigned const char*)(&d);
6983#if DOUBLESIZE == LONGDBLSIZE
6984  printf("0\n"); /* if it floats like double */
6985  exit(0);
6986#endif
6987#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6988  if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6989    /* IEEE 754 128-bit little-endian */
6990    printf("1\n");
6991    exit(0);
6992  }
6993  if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6994    /* IEEE 128-bit big-endian, e.g. solaris sparc */
6995    printf("2\n");
6996    exit(0);
6997  }
6998#endif
6999/* For alignment 32-bit platforms have the 80 bits in 12 bytes,
7000 * while 64-bits platforms have it in 16 bytes.  The trailing bytes
7001 * cannot be trusted. */
7002#if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7003  if (b[0] == 0xCD && b[9] == 0xBF) {
7004    /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7005     * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7006     * Also known as "extended precision". */
7007    printf("3\n");
7008    exit(0);
7009  }
7010  if (b[0] == 0xBF && b[9] == 0xCD) {
7011    /* Is there ever big-endian 80-bit, really?
7012     *
7013     * The Motorola 68881 had another "extended precision" format:
7014     * sign:1 exp:15 zero:16 integer:1 mantissa:63
7015     * for total of 96 bits of bytes.  The zero bits were unused.
7016     * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7017     * If it ever becomes relevant, this format should be allocated
7018     * a new doublekind code since it's quite different from the Intel x87.
7019     */
7020    printf("4\n");
7021    exit(0);
7022  }
7023#endif
7024#if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7025  /* software "double double", the 106 is 53+53.
7026   * but irix thinks it is 107. */
7027  if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7028    /* double double 128-bit fully little-endian,
7029     * little-endian doubles in little-endian order,
7030     * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7031    printf("5\n");
7032    exit(0);
7033  }
7034  if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7035    /* double double 128-bit fully big-endian,
7036     * big-endian doubles in big-endian order,
7037     * e.g. PPC/Power and MIPS:
7038     * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7039    printf("6\n");
7040    exit(0);
7041  }
7042  if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7043    /* double double 128-bit mixed endian.
7044     * little-endian doubles in big-endian order,
7045     * e.g. ppc64el,
7046     * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7047    printf("7\n");
7048    exit(0);
7049  }
7050  if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7051    /* double double 128-bit mixed endian,
7052     * big-endian doubles in little-endian order,
7053     * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7054    printf("8\n");
7055    exit(0);
7056  }
7057#endif
7058/* We are largely making this up because it may well be
7059 * that the VAX format H was never made available to C,
7060 * only to Fortran. */
7061#if LONGDBLSIZE == 16 && defined(__vax__)
7062  if (b[0] == 0xFD && b[15] == 0x99) {
7063    /* VAX format H, PDP-11 mixed endian. */
7064    printf("9\n");
7065    exit(0);
7066  }
7067#endif
7068  printf("-1\n"); /* unknown */
7069  exit(0);
7070}
7071EOP
7072set try
7073if eval $compile; then
7074    longdblkind=`$run ./try`
7075else
7076    longdblkind=-1
7077fi
7078;;
7079*) longdblkind=0 ;;
7080esac
7081case "$longdblkind" in
70820) echo "Your long doubles are doubles." >&4 ;;
70831) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
70842) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
70853) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
70864) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
70875) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
70886) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
70897) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
70908) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
70919) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7092*) echo "Cannot figure out your long double." >&4 ;;
7093esac
7094d_long_double_style_ieee=$undef
7095d_long_double_style_ieee_std=$undef
7096d_long_double_style_ieee_extended=$undef
7097d_long_double_style_ieee_doubledouble=$undef
7098d_long_double_style_vax=$undef
7099case "$longdblkind" in
71001|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7101esac
7102case "$longdblkind" in
71031|2) d_long_double_style_ieee_std=$define ;;
7104esac
7105case "$longdblkind" in
71063|4) d_long_double_style_ieee_extended=$define ;;
7107esac
7108case "$longdblkind" in
71095|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7110esac
7111case "$longdblkind" in
71129) d_long_double_style_vax=$define ;;
7113esac
7114$rm_try
7115
7116: determine the architecture name
7117echo " "
7118if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7119	tarch=`arch`"-$osname"
7120elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7121	if uname -m > tmparch 2>&1 ; then
7122		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7123			-e 's/$/'"-$osname/" tmparch`
7124	else
7125		tarch="$osname"
7126	fi
7127	$rm -f tmparch
7128else
7129	tarch="$osname"
7130fi
7131case "$myarchname" in
7132''|"$tarch") ;;
7133*)
7134	echo "(Your architecture name used to be $myarchname.)"
7135	archname=''
7136	;;
7137esac
7138case "$targetarch" in
7139'') ;;
7140*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7141esac
7142myarchname="$tarch"
7143case "$archname" in
7144'') dflt="$tarch";;
7145*) dflt="$archname";;
7146esac
7147rp='What is your architecture name'
7148. ./myread
7149archname="$ans"
7150
7151: optionally add API version to the architecture for versioned archlibs
7152case "$useversionedarchname" in
7153$define|true|[yY]*) dflt='y';;
7154*)                  dflt='n';;
7155esac
7156rp='Add the Perl API version to your archname?'
7157. ./myread
7158case "$ans" in
7159y|Y)	useversionedarchname="$define" ;;
7160*)      useversionedarchname="$undef" ;;
7161esac
7162case "$useversionedarchname" in
7163$define)
7164	case "$archname" in
7165	*-$api_versionstring)
7166		echo "...and architecture name already has -$api_versionstring" >&4
7167		;;
7168	*)
7169		archname="$archname-$api_versionstring"
7170		echo "...setting architecture name to $archname." >&4
7171		;;
7172	esac
7173	;;
7174esac
7175
7176case "$usethreads" in
7177$define)
7178	echo "Threads selected." >&4
7179	case "$archname" in
7180	*-thread*) echo "...and architecture name already has -thread." >&4
7181		;;
7182	*)      archname="$archname-thread"
7183		echo "...setting architecture name to $archname." >&4
7184		;;
7185	esac
7186	;;
7187esac
7188case "$usemultiplicity" in
7189$define)
7190	echo "Multiplicity selected." >&4
7191	case "$archname" in
7192	*-multi*) echo "...and architecture name already has -multi." >&4
7193		;;
7194	*)      archname="$archname-multi"
7195		echo "...setting architecture name to $archname." >&4
7196		;;
7197	esac
7198	;;
7199esac
7200case "$use64bitint$use64bitall" in
7201*"$define"*)
7202	case "$archname64" in
7203	'')
7204		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7205		;;
7206	*)
7207		case "$use64bitint" in
7208		"$define") echo "64 bit integers selected." >&4 ;;
7209		esac
7210		case "$use64bitall" in
7211		"$define") echo "Maximal 64 bitness selected." >&4 ;;
7212		esac
7213		case "$archname" in
7214		*-$archname64*) echo "...and architecture name already has $archname64." >&4
7215			;;
7216		*)      archname="$archname-$archname64"
7217			echo "...setting architecture name to $archname." >&4
7218			;;
7219		esac
7220		;;
7221	esac
7222esac
7223case "$uselongdouble" in
7224$define)
7225	echo "Long doubles selected." >&4
7226	case "$longdblsize" in
7227	$doublesize)
7228		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7229		;;
7230	*)
7231		case "$archname" in
7232		*-ld*) echo "...and architecture name already has -ld." >&4
7233			;;
7234		*)      archname="$archname-ld"
7235			echo "...setting architecture name to $archname." >&4
7236			;;
7237		esac
7238		;;
7239	esac
7240	;;
7241esac
7242case "$usequadmath" in
7243$define)
7244	echo "quadmath selected." >&4
7245	case "$archname" in
7246	*-quadmath*) echo "...and architecture name already has -quadmath." >&4
7247		;;
7248	*)      archname="$archname-quadmath"
7249		echo "...setting architecture name to $archname." >&4
7250		;;
7251	esac
7252	;;
7253esac
7254if $test -f archname.cbu; then
7255	echo "Your platform has some specific hints for architecture name, using them..."
7256	. ./archname.cbu
7257fi
7258
7259: set the prefixit variable, to compute a suitable default value
7260prefixit='case "$3" in
7261""|none)
7262	case "$oldprefix" in
7263	"") eval "$1=\"\$$2\"";;
7264	*)
7265		case "$3" in
7266		"") eval "$1=";;
7267		none)
7268			eval "tp=\"\$$2\"";
7269			case "$tp" in
7270			""|" "|none) eval "$1=\"\$$2\"";;
7271			*) eval "$1=";;
7272			esac;;
7273		esac;;
7274	esac;;
7275*)
7276	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7277	case "$tp" in
7278	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7279	/*-$oldprefix/*|\~*-$oldprefix/*)
7280		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7281	*) eval "$1=\"\$$2\"";;
7282	esac;;
7283esac'
7284
7285: determine installation style
7286: For now, try to deduce it from prefix unless it is already set.
7287: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7288case "$installstyle" in
7289'')	case "$prefix" in
7290		*perl*) dflt='lib';;
7291		*) dflt='lib/perl5' ;;
7292	esac
7293	;;
7294*)	dflt="$installstyle" ;;
7295esac
7296: Probably not worth prompting for this since we prompt for all
7297: the directories individually, and the prompt would be too long and
7298: confusing anyway.
7299installstyle=$dflt
7300
7301: determine where public executables go
7302echo " "
7303set dflt bin bin
7304eval $prefixit
7305fn=d~
7306rp='Pathname where the public executables will reside?'
7307. ./getfile
7308if $test "X$ansexp" != "X$binexp"; then
7309	installbin=''
7310fi
7311prefixvar=bin
7312: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7313: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7314:     this via initialinstalllocation
7315. ./setprefixvar
7316
7317case "$userelocatableinc" in
7318$define|true|[yY]*)	dflt='y' ;;
7319*)			dflt='n' ;;
7320esac
7321cat <<EOM
7322
7323Would you like to build Perl so that the installation is relocatable, so that
7324library paths in @INC are determined relative to the path of the perl binary?
7325This is not advised for system Perl installs, or if you need to run setid
7326scripts or scripts under taint mode.
7327
7328If this doesn't make any sense to you, just accept the default '$dflt'.
7329EOM
7330rp='Use relocatable @INC?'
7331. ./myread
7332case "$ans" in
7333y|Y)	val="$define" ;;
7334*)	val="$undef"  ;;
7335esac
7336set userelocatableinc
7337eval $setvar
7338
7339initialinstalllocation="$binexp"
7340: Default prefix is now "up one level from where the binaries are"
7341case "$userelocatableinc" in
7342$define|true|[yY]*)
7343    bin=".../"
7344    binexp=".../"
7345    prefix=".../.."
7346    prefixexp=".../.."
7347    installprefixexp=".../.."
7348    ;;
7349esac
7350
7351: determine where private library files go
7352: Usual default is /usr/local/lib/perl5/$version.
7353: Also allow things like /opt/perl/lib/$version, since
7354: /opt/perl/lib/perl5... would be redundant.
7355: The default "style" setting is made in installstyle.U
7356case "$installstyle" in
7357*lib/perl5*) set dflt privlib lib/$package/$version ;;
7358*)	 set dflt privlib lib/$version ;;
7359esac
7360eval $prefixit
7361$cat <<EOM
7362
7363There are some auxiliary files for $package that need to be put into a
7364private library directory that is accessible by everyone.
7365
7366EOM
7367fn=$binexp
7368fn=d~+
7369rp='Pathname where the private library files will reside?'
7370. ./getfile
7371prefixvar=privlib
7372. ./setprefixvar
7373
7374: set the prefixup variable, to restore leading tilda escape
7375prefixup='case "$prefixexp" in
7376"$prefix") ;;
7377*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7378esac'
7379
7380: determine where public architecture dependent libraries go
7381set archlib archlib
7382eval $prefixit
7383: privlib default is /usr/local/lib/$package/$version
7384: archlib default is /usr/local/lib/$package/$version/$archname
7385: privlib may have an optional trailing /share.
7386tdflt=`echo $privlib | $sed 's,/share$,,'`
7387tdflt=$tdflt/$archname
7388case "$archlib" in
7389'')	dflt=$tdflt
7390	;;
7391*)	dflt="$archlib"
7392    ;;
7393esac
7394$cat <<EOM
7395
7396$spackage contains architecture-dependent library files.  If you are
7397sharing libraries in a heterogeneous environment, you might store
7398these files in a separate location.  Otherwise, you can just include
7399them with the rest of the public library files.
7400
7401EOM
7402fn=$binexp
7403fn=d+~
7404rp='Where do you want to put the public architecture-dependent libraries?'
7405. ./getfile
7406prefixvar=archlib
7407. ./setprefixvar
7408if $test X"$archlib" = X"$privlib"; then
7409	d_archlib="$undef"
7410else
7411	d_archlib="$define"
7412fi
7413
7414: see if setuid scripts can be secure
7415$cat <<EOM
7416
7417Some kernels have a bug that prevents setuid #! scripts from being
7418secure.  Some sites have disabled setuid #! scripts because of this.
7419
7420First let's decide if your kernel supports secure setuid #! scripts.
7421(If setuid #! scripts would be secure but have been disabled anyway,
7422don't say that they are secure if asked.)
7423
7424EOM
7425
7426val="$undef"
7427if $test -d /dev/fd; then
7428	echo "#!$ls" >reflect
7429	chmod +x,u+s reflect
7430	./reflect >flect 2>&1
7431	if $contains "/dev/fd" flect >/dev/null; then
7432		echo "Congratulations, your kernel has secure setuid scripts!" >&4
7433		val="$define"
7434	else
7435		$cat <<EOM
7436If you are not sure if they are secure, I can check but I'll need a
7437username and password different from the one you are using right now.
7438If you don't have such a username or don't want me to test, simply
7439enter 'none'.
7440
7441EOM
7442		rp='Other username to test security of setuid scripts with?'
7443		dflt='none'
7444		. ./myread
7445		case "$ans" in
7446		n|none)
7447			case "$d_suidsafe" in
7448			'')	echo "I'll assume setuid scripts are *not* secure." >&4
7449				dflt=n;;
7450			"$undef")
7451				echo "Well, the $hint value is *not* secure." >&4
7452				dflt=n;;
7453			*)	echo "Well, the $hint value *is* secure." >&4
7454				dflt=y;;
7455			esac
7456			;;
7457		*)
7458			$rm -f reflect flect
7459			echo "#!$ls" >reflect
7460			chmod +x,u+s reflect
7461			echo >flect
7462			chmod a+w flect
7463			echo '"su" will (probably) prompt you for '"$ans's password."
7464			su $ans -c './reflect >flect'
7465			if $contains "/dev/fd" flect >/dev/null; then
7466				echo "Okay, it looks like setuid scripts are secure." >&4
7467				dflt=y
7468			else
7469				echo "I don't think setuid scripts are secure." >&4
7470				dflt=n
7471			fi
7472			;;
7473		esac
7474		rp='Does your kernel have *secure* setuid scripts?'
7475		. ./myread
7476		case "$ans" in
7477		[yY]*)	val="$define";;
7478		*)	val="$undef";;
7479		esac
7480	fi
7481else
7482	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7483	echo "(That's for file descriptors, not floppy disks.)"
7484	val="$undef"
7485fi
7486set d_suidsafe
7487eval $setvar
7488
7489$rm -f reflect flect
7490
7491: now see if they want to do setuid emulation
7492if $test $patchlevel -lt 11; then
7493echo " "
7494val="$undef"
7495case "$d_suidsafe" in
7496"$define")
7497	val="$undef"
7498	echo "No need to emulate SUID scripts since they are secure here." >&4
7499	;;
7500*)
7501	$cat <<EOM
7502Some systems have disabled setuid scripts, especially systems where
7503setuid scripts cannot be secure.  On systems where setuid scripts have
7504been disabled, the setuid/setgid bits on scripts are currently
7505useless.  It is possible for $package to detect those bits and emulate
7506setuid/setgid in a secure fashion.  This emulation will only work if
7507setuid scripts have been disabled in your kernel.
7508
7509EOM
7510	case "$d_dosuid" in
7511	"$define") dflt=y ;;
7512	*) dflt=n ;;
7513	esac
7514	rp="Do you want to do setuid/setgid emulation?"
7515	. ./myread
7516	case "$ans" in
7517	[yY]*)	val="$define";;
7518	*)	val="$undef";;
7519	esac
7520	;;
7521esac
7522set d_dosuid
7523eval $setvar
7524else
7525    case "$d_dosuid" in
7526	"$define")
7527	cat >&4 <<EOH
7528
7529SUID emulation has been removed for 5.12
7530Please re-run Configure without -Dd_dosuid
7531
7532EOH
7533	exit 1;
7534	;;
7535    esac
7536    d_dosuid=undef
7537fi
7538
7539: Find perl5.005 or later.
7540echo "Looking for a previously installed perl5.005 or later... "
7541case "$perl5" in
7542'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7543		: Check if this perl is recent and can load a simple module
7544		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7545			perl5=$tdir/perl
7546			break;
7547		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7548			perl5=$tdir/perl5
7549			break;
7550		fi
7551	done
7552	;;
7553*)	perl5="$perl5"
7554	;;
7555esac
7556case "$perl5" in
7557'')	echo "None found.  That's ok.";;
7558*)	echo "Using $perl5." ;;
7559esac
7560
7561: Set the siteprefix variables
7562$cat <<EOM
7563
7564After $package is installed, you may wish to install various
7565add-on modules and utilities.  Typically, these add-ons will
7566be installed under $prefix with the rest
7567of this package.  However, you may wish to install such add-ons
7568elsewhere under a different prefix.
7569
7570If you do not wish to put everything under a single prefix, that's
7571ok.  You will be prompted for the individual locations; this siteprefix
7572is only used to suggest the defaults.
7573
7574The default should be fine for most people.
7575
7576EOM
7577fn=d~+
7578rp='Installation prefix to use for add-on modules and utilities?'
7579: XXX Here might be another good place for an installstyle setting.
7580case "$siteprefix" in
7581'') dflt=$prefix ;;
7582*)  dflt=$siteprefix ;;
7583esac
7584. ./getfile
7585: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7586oldsiteprefix=''
7587case "$siteprefix" in
7588'') ;;
7589*)	case "$ans" in
7590	"$prefix") ;;
7591	*) oldsiteprefix="$prefix";;
7592	esac
7593	;;
7594esac
7595siteprefix="$ans"
7596siteprefixexp="$ansexp"
7597
7598: determine where site specific libraries go.
7599: Usual default is /usr/local/lib/perl5/site_perl/$version
7600: The default "style" setting is made in installstyle.U
7601: XXX No longer works with Prefixit stuff.
7602prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7603case "$sitelib" in
7604'') case "$installstyle" in
7605	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7606	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
7607	esac
7608	;;
7609*)	dflt="$sitelib"
7610	;;
7611esac
7612$cat <<EOM
7613
7614The installation process will create a directory for
7615site-specific extensions and modules.  Most users find it convenient
7616to place all site-specific files in this directory rather than in the
7617main distribution directory.
7618
7619EOM
7620fn=d~+
7621rp='Pathname for the site-specific library files?'
7622. ./getfile
7623prefixvar=sitelib
7624. ./setprefixvar
7625sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7626
7627: Determine list of previous versions to include in @INC
7628$cat > getverlist <<EOPL
7629#!$perl5 -w
7630use File::Basename;
7631\$api_versionstring = "$api_versionstring";
7632\$version = "$version";
7633\$stem = "$sitelib_stem";
7634\$archname = "$archname";
7635EOPL
7636	$cat >> getverlist <<'EOPL'
7637# The list found is store twice for each entry: the original name, and
7638# the binary broken down version as pack "sss", so sorting is easy and
7639# unambiguous. This will work for all versions that have a maximum of
7640# three digit groups, separate by '.'s or '_'s. Names are extended with
7641# ".0.0" to ensure at least three elements for the pack.
7642#					-- H.Merijn Brand (m)'06 23-10-2006
7643
7644# Can't have leading @ because metaconfig interprets it as a command!
7645;@inc_version_list=();
7646# XXX Redo to do opendir/readdir?
7647if (-d $stem) {
7648    chdir($stem);
7649    ;@candidates = map {
7650	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7651    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7652}
7653else {
7654    ;@candidates = ();
7655}
7656
7657($pversion, $aversion, $vsn5005) = map {
7658    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7659foreach $d (@candidates) {
7660    if ($d->[1] lt $pversion) {
7661	if ($d->[1] ge $aversion) {
7662	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7663	}
7664	elsif ($d->[1] ge $vsn5005) {
7665	    unshift(@inc_version_list, grep { -d } $d->[0]);
7666	}
7667    }
7668    else {
7669	# Skip newer version.  I.e. don't look in
7670	# 5.7.0 if we're installing 5.6.1.
7671    }
7672}
7673
7674if (@inc_version_list) {
7675    print join(' ', @inc_version_list);
7676}
7677else {
7678    # Blank space to preserve value for next Configure run.
7679    print " ";
7680}
7681EOPL
7682chmod +x getverlist
7683case "$inc_version_list" in
7684'')	if test -x "$perl5$exe_ext"; then
7685		dflt=`$perl5 getverlist`
7686	else
7687		dflt='none'
7688	fi
7689	;;
7690$undef) dflt='none' ;;
7691*)  eval dflt=\"$inc_version_list\" ;;
7692esac
7693case "$dflt" in
7694''|' ') dflt=none ;;
7695esac
7696case "$dflt" in
76975.005) dflt=none ;;
7698esac
7699$cat <<EOM
7700
7701In order to ease the process of upgrading, this version of perl
7702can be configured to use modules built and installed with earlier
7703versions of perl that were installed under $prefix.  Specify here
7704the list of earlier versions that this version of perl should check.
7705If Configure detected no earlier versions of perl installed under
7706$prefix, then the list will be empty.  Answer 'none' to tell perl
7707to not search earlier versions.
7708
7709The default should almost always be sensible, so if you're not sure,
7710just accept the default.
7711EOM
7712
7713rp='List of earlier versions to include in @INC?'
7714. ./myread
7715case "$ans" in
7716[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7717*) inc_version_list="$ans" ;;
7718esac
7719case "$inc_version_list" in
7720''|' ')
7721	inc_version_list_init='0'
7722	d_inc_version_list="$undef"
7723	;;
7724*)	inc_version_list_init=`echo $inc_version_list |
7725		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7726	d_inc_version_list="$define"
7727	;;
7728esac
7729$rm -f getverlist
7730
7731: see if malloc/malloc.h has to be included
7732set malloc/malloc.h i_mallocmalloc
7733eval $inhdr
7734
7735: see if this is a malloc.h system
7736: we want a real compile instead of Inhdr because some systems have a
7737: malloc.h that just gives a compile error saying to use stdlib.h instead
7738echo " "
7739$cat >try.c <<EOCP
7740#include <stdlib.h>
7741#include <malloc.h>
7742#$i_mallocmalloc I_MALLOCMALLOC
7743#ifdef I_MALLOCMALLOC
7744# include <malloc/malloc.h>
7745#endif
7746
7747int main () { return 0; }
7748EOCP
7749set try
7750if eval $compile; then
7751    echo "<malloc.h> found." >&4
7752    val="$define"
7753else
7754    echo "<malloc.h> NOT found." >&4
7755    val="$undef"
7756fi
7757$rm_try
7758set i_malloc
7759eval $setvar
7760
7761: check for length of pointer
7762echo " "
7763case "$ptrsize" in
7764'')
7765	echo "Checking to see how big your pointers are..." >&4
7766	$cat >try.c <<EOCP
7767#include <stdio.h>
7768#$i_stdlib I_STDLIB
7769#ifdef I_STDLIB
7770#include <stdlib.h>
7771#endif
7772int main()
7773{
7774    printf("%d\n", (int)sizeof(void *));
7775    exit(0);
7776}
7777EOCP
7778	set try
7779	if eval $compile_ok; then
7780		ptrsize=`$run ./try`
7781		echo "Your pointers are $ptrsize bytes long."
7782	else
7783		dflt='4'
7784		echo "(I can't seem to compile the test program.  Guessing...)" >&4
7785		rp="What is the size of a pointer (in bytes)?"
7786		. ./myread
7787		ptrsize="$ans"
7788	fi
7789	;;
7790esac
7791$rm_try
7792case "$use64bitall" in
7793"$define"|true|[yY]*)
7794	case "$ptrsize" in
7795	4)	cat <<EOM >&4
7796
7797*** You have chosen a maximally 64-bit build,
7798*** but your pointers are only 4 bytes wide.
7799*** Please rerun Configure without -Duse64bitall.
7800EOM
7801		case "$d_quad" in
7802		define)
7803			cat <<EOM >&4
7804*** Since you have quads, you could possibly try with -Duse64bitint.
7805EOM
7806			;;
7807		esac
7808		cat <<EOM >&4
7809*** Cannot continue, aborting.
7810
7811EOM
7812
7813		exit 1
7814		;;
7815	esac
7816	;;
7817esac
7818
7819: determine whether to use malloc wrapping
7820echo " "
7821case "$usemallocwrap" in
7822[yY]*|true|$define)	dflt='y' ;;
7823[nN]*|false|$undef)	dflt='n' ;;
7824*)	case "$usedevel" in
7825	[yY]*|true|$define)	dflt='y' ;;
7826	*) dflt='n' ;;
7827	esac
7828	;;
7829esac
7830rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7831. ./myread
7832usemallocwrap="$ans"
7833case "$ans" in
7834y*|true)
7835	usemallocwrap="$define" ;;
7836*)
7837	usemallocwrap="$undef" ;;
7838esac
7839
7840: determine which malloc to compile in
7841echo " "
7842case "$usemymalloc" in
7843[yY]*|true|$define)	dflt='y' ;;
7844[nN]*|false|$undef)	dflt='n' ;;
7845*)	case "$ptrsize" in
7846	4) dflt='y' ;;
7847	*) dflt='n' ;;
7848	esac
7849	if test "$useithreads" = "$define"; then dflt='n'; fi
7850	;;
7851esac
7852rp="Do you wish to attempt to use the malloc that comes with $package?"
7853. ./myread
7854usemymalloc="$ans"
7855case "$ans" in
7856y*|true)
7857	usemymalloc='y'
7858	mallocsrc='malloc.c'
7859	mallocobj="malloc$_o"
7860	d_mymalloc="$define"
7861	case "$libs" in
7862	*-lmalloc*)
7863		: Remove malloc from list of libraries to use
7864		echo "Removing unneeded -lmalloc from library list" >&4
7865		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7866		shift
7867		libs="$*"
7868		echo "libs = $libs" >&4
7869		;;
7870	esac
7871	;;
7872*)
7873	usemymalloc='n'
7874	mallocsrc=''
7875	mallocobj=''
7876	d_mymalloc="$undef"
7877	;;
7878esac
7879
7880: compute the return types of malloc and free
7881echo " "
7882$cat >malloc.c <<END
7883#$i_malloc I_MALLOC
7884#$i_stdlib I_STDLIB
7885#include <stdio.h>
7886#include <sys/types.h>
7887#ifdef I_MALLOC
7888#include <malloc.h>
7889#endif
7890#ifdef I_STDLIB
7891#include <stdlib.h>
7892#endif
7893#ifdef TRY_MALLOC
7894void *malloc();
7895#endif
7896#ifdef TRY_FREE
7897void free();
7898#endif
7899END
7900case "$malloctype" in
7901'')
7902	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7903		malloctype='void *'
7904	else
7905		malloctype='char *'
7906	fi
7907	;;
7908esac
7909echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7910
7911case "$freetype" in
7912'')
7913	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7914		freetype='void'
7915	else
7916		freetype='int'
7917	fi
7918	;;
7919esac
7920echo "Your system uses $freetype free(), it would seem." >&4
7921$rm -f malloc.[co]
7922: determine where site specific architecture-dependent libraries go.
7923: sitelib  default is /usr/local/lib/perl5/site_perl/$version
7924: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7925: sitelib may have an optional trailing /share.
7926case "$sitearch" in
7927'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
7928	dflt="$dflt/$archname"
7929	;;
7930*)	dflt="$sitearch"
7931	;;
7932esac
7933set sitearch sitearch none
7934eval $prefixit
7935$cat <<EOM
7936
7937The installation process will also create a directory for
7938architecture-dependent site-specific extensions and modules.
7939
7940EOM
7941fn=d~+
7942rp='Pathname for the site-specific architecture-dependent library files?'
7943. ./getfile
7944prefixvar=sitearch
7945. ./setprefixvar
7946if $test X"$sitearch" = X"$sitelib"; then
7947	d_sitearch="$undef"
7948else
7949	d_sitearch="$define"
7950fi
7951
7952: Set the vendorprefix variables
7953$cat <<EOM
7954
7955The installation process will also create a directory for
7956vendor-supplied add-ons.  Vendors who supply perl with their system
7957may find it convenient to place all vendor-supplied files in this
7958directory rather than in the main distribution directory.  This will
7959ease upgrades between binary-compatible maintenance versions of perl.
7960
7961Of course you may also use these directories in whatever way you see
7962fit.  For example, you might use them to access modules shared over a
7963company-wide network.
7964
7965The default answer should be fine for most people.
7966This causes further questions about vendor add-ons to be skipped
7967and no vendor-specific directories will be configured for perl.
7968
7969EOM
7970rp='Do you want to configure vendor-specific add-on directories?'
7971case "$usevendorprefix" in
7972define|true|[yY]*) dflt=y ;;
7973*)	: User may have set vendorprefix directly on Configure command line.
7974	case "$vendorprefix" in
7975	''|' ') dflt=n ;;
7976	*)	dflt=y ;;
7977	esac
7978	;;
7979esac
7980. ./myread
7981case "$ans" in
7982[yY]*)	fn=d~+
7983	rp='Installation prefix to use for vendor-supplied add-ons?'
7984	case "$vendorprefix" in
7985	'') dflt="$prefix" ;;
7986	*)  dflt=$vendorprefix ;;
7987	esac
7988	. ./getfile
7989	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7990	oldvendorprefix=''
7991	case "$vendorprefix" in
7992	'') ;;
7993	*)	case "$ans" in
7994		"$prefix") ;;
7995		*) oldvendorprefix="$prefix";;
7996		esac
7997		;;
7998	esac
7999	usevendorprefix="$define"
8000	vendorprefix="$ans"
8001	vendorprefixexp="$ansexp"
8002	;;
8003*)	usevendorprefix="$undef"
8004	vendorprefix=''
8005	vendorprefixexp=''
8006	;;
8007esac
8008
8009: Set the vendorlib variables
8010case "$vendorprefix" in
8011'')	d_vendorlib="$undef"
8012	vendorlib=''
8013	vendorlibexp=''
8014	;;
8015*)	d_vendorlib="$define"
8016	: determine where vendor-supplied modules go.
8017	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
8018	case "$vendorlib" in
8019	'')
8020		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8021		case "$installstyle" in
8022		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8023		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8024		esac
8025		;;
8026	*)	dflt="$vendorlib"
8027		;;
8028	esac
8029	fn=d~+
8030	rp='Pathname for the vendor-supplied library files?'
8031	. ./getfile
8032	vendorlib="$ans"
8033	vendorlibexp="$ansexp"
8034	;;
8035esac
8036vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8037prefixvar=vendorlib
8038. ./installprefix
8039
8040: Set the vendorarch variables
8041case "$vendorprefix" in
8042'')	d_vendorarch="$undef"
8043	vendorarch=''
8044	vendorarchexp=''
8045	;;
8046*)	d_vendorarch="$define"
8047	: determine where vendor-supplied architecture-dependent libraries go.
8048	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8049	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8050	: vendorlib may have an optional trailing /share.
8051	case "$vendorarch" in
8052	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
8053		dflt="$dflt/$archname"
8054		;;
8055	*)	dflt="$vendorarch" ;;
8056	esac
8057	fn=d~+
8058	rp='Pathname for vendor-supplied architecture-dependent files?'
8059	. ./getfile
8060	vendorarch="$ans"
8061	vendorarchexp="$ansexp"
8062	;;
8063esac
8064prefixvar=vendorarch
8065. ./installprefix
8066if $test X"$vendorarch" = X"$vendorlib"; then
8067	d_vendorarch="$undef"
8068else
8069	d_vendorarch="$define"
8070fi
8071
8072: Final catch-all directories to search
8073$cat <<EOM
8074
8075Lastly, you can have perl look in other directories for extensions and
8076modules in addition to those already specified.
8077These directories will be searched after
8078	$sitearch
8079	$sitelib
8080EOM
8081test X"$vendorlib" != "X" && echo '	' $vendorlib
8082test X"$vendorarch" != "X" && echo '	' $vendorarch
8083echo ' '
8084case "$otherlibdirs" in
8085''|' ') dflt='none' ;;
8086*)	dflt="$otherlibdirs" ;;
8087esac
8088$cat <<EOM
8089Enter a colon-separated set of extra paths to include in perl's @INC
8090search path, or enter 'none' for no extra paths.
8091
8092EOM
8093
8094rp='Colon-separated list of additional directories for perl to search?'
8095. ./myread
8096case "$ans" in
8097' '|''|none)	otherlibdirs=' ' ;;
8098*)	otherlibdirs="$ans" ;;
8099esac
8100case "$otherlibdirs" in
8101' ') val=$undef ;;
8102*)	val=$define ;;
8103esac
8104set d_perl_otherlibdirs
8105eval $setvar
8106
8107: DTrace support
8108dflt_dtrace='/usr/sbin/dtrace'
8109$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8110
8111cat <<EOM
8112
8113Perl can be built to support DTrace on platforms that support it.
8114DTrace is a diagnosis and performance analysis tool from Sun.
8115
8116If this doesn't make any sense to you, just accept the default.
8117EOM
8118
8119while $test 1 ; do
8120	case "$usedtrace" in
8121	$define|true|[yY]*)
8122		dflt='y'
8123		;;
8124	$undef|false|[nN]*)
8125		dflt='n'
8126		dflt_dtrace=""
8127		;;
8128	?*)
8129		dflt='y'
8130		dflt_dtrace=$usedtrace
8131		;;
8132	*)
8133		dflt='n'
8134		;;
8135	esac
8136
8137	rp='Support DTrace if available?'
8138	. ./myread
8139	case "$ans" in
8140	y|Y)	val="$define" ;;
8141	*)      val="$undef" ;;
8142	esac
8143	set usedtrace
8144	eval $setvar
8145
8146	test "X$usedtrace" != "X$define" && break
8147
8148	echo " "
8149	rp='Where is the dtrace executable?'
8150	dflt=$dflt_dtrace
8151	. ./getfile
8152	val="$ans"
8153	set dtrace
8154	eval $setvar
8155
8156	if $test -f $dtrace
8157	then
8158		if $dtrace -h -s ../perldtrace.d \
8159			-o perldtrace.tmp >/dev/null 2>&1 \
8160			&& rm -f perldtrace.tmp
8161		then
8162			echo " "
8163			echo "Good: your $dtrace knows about the -h flag."
8164		else
8165			cat >&2 <<EOM
8166
8167*** $me:  Fatal Error:  $dtrace doesn't support -h flag
8168***
8169*** Your installed dtrace doesn't support the -h switch to compile a D
8170*** program into a C header. Can't continue.
8171
8172EOM
8173			exit 1
8174		fi
8175		break;
8176	fi
8177
8178	case "$fastread" in
8179	yes)
8180		cat >&2 <<EOM
8181
8182*** $me:  Fatal Error:  $dtrace not found.
8183*** Can't continue.
8184
8185EOM
8186		exit 1
8187		;;
8188	*)
8189		echo "*** $dtrace was not found."
8190		echo " "
8191		;;
8192	esac
8193done
8194
8195: See if we want extra modules installed
8196echo " "
8197case "$extras" in
8198'') dflt='n';;
8199*) dflt='y';;
8200esac
8201cat <<EOM
8202Perl can be built with extra modules or bundles of modules which
8203will be fetched from the CPAN and installed alongside Perl.
8204
8205Notice that you will need access to the CPAN; either via the Internet,
8206or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8207be asked later to configure the CPAN.pm module which will in turn do
8208the installation of the rest of the extra modules or bundles.)
8209
8210Notice also that if the modules require any external software such as
8211libraries and headers (the libz library and the zlib.h header for the
8212Compress::Zlib module, for example) you MUST have any such software
8213already installed, this configuration process will NOT install such
8214things for you.
8215
8216If this doesn't make any sense to you, just accept the default '$dflt'.
8217EOM
8218rp='Install any extra modules (y or n)?'
8219. ./myread
8220case "$ans" in
8221y|Y)
8222	cat <<EOM
8223
8224Please list any extra modules or bundles to be installed from CPAN,
8225with spaces between the names.  The names can be in any format the
8226'install' command of CPAN.pm will understand.  (Answer 'none',
8227without the quotes, to install no extra modules or bundles.)
8228EOM
8229	rp='Extras?'
8230	dflt="$extras"
8231	. ./myread
8232	extras="$ans"
8233esac
8234case "$extras" in
8235''|'none')
8236	val=''
8237	$rm -f ../extras.lst
8238	;;
8239*)	echo "(Saving the list of extras for later...)"
8240	echo "$extras" > ../extras.lst
8241	val="'$extras'"
8242	;;
8243esac
8244set extras
8245eval $setvar
8246echo " "
8247
8248: determine where html pages for programs go
8249set html1dir html1dir none
8250eval $prefixit
8251$cat <<EOM
8252
8253If you wish to install html files for programs in $spackage, indicate
8254the appropriate directory here.  To skip installing html files,
8255answer "none".
8256EOM
8257case "$html1dir" in
8258''|none|$undef|' ') dflt=none ;;
8259*) dflt=$html1dir ;;
8260esac
8261fn=dn+~
8262rp="Directory for the main $spackage html pages?"
8263. ./getfile
8264prefixvar=html1dir
8265. ./setprefixvar
8266: Use ' ' for none so value is preserved next time through Configure
8267$test X"$html1dir" = "X" && html1dir=' '
8268
8269: determine where html pages for libraries and modules go
8270set html3dir html3dir none
8271eval $prefixit
8272$cat <<EOM
8273
8274If you wish to install html files for modules associated with $spackage,
8275indicate the appropriate directory here.  To skip installing html files,
8276answer "none".
8277EOM
8278: There is no obvious default.  If they have specified html1dir, then
8279: try to key off that, possibly changing .../html1 into .../html3.
8280case "$html3dir" in
8281'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8282*) dflt=$html3dir ;;
8283esac
8284fn=dn+~
8285rp="Directory for the $spackage module html pages?"
8286. ./getfile
8287prefixvar=html3dir
8288. ./setprefixvar
8289: Use ' ' for none so value is preserved next time through Configure
8290$test X"$html3dir" = "X" && html3dir=' '
8291
8292: determine whether to install perl also as /usr/bin/perl
8293
8294echo " "
8295if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8296	$cat <<EOM
8297Many scripts expect perl to be installed as /usr/bin/perl.
8298
8299If you want to, I can install the perl you are about to compile
8300as /usr/bin/perl (in addition to $bin/perl).
8301EOM
8302	if test -f /usr/bin/perl; then
8303	    $cat <<EOM
8304
8305However, please note that because you already have a /usr/bin/perl,
8306overwriting that with a new Perl would very probably cause problems.
8307Therefore I'm assuming you don't want to do that (unless you insist).
8308
8309EOM
8310	    case "$installusrbinperl" in
8311	    "$define"|[yY]*)	dflt='y';;
8312	    *)			dflt='n';;
8313	    esac
8314	else
8315	    $cat <<EOM
8316
8317Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8318
8319EOM
8320	    case "$installusrbinperl" in
8321	    "$undef"|[nN]*)	dflt='n';;
8322	    *)			dflt='y';;
8323	    esac
8324	fi
8325	rp="Do you want to install perl as /usr/bin/perl?"
8326	. ./myread
8327	case "$ans" in
8328	[yY]*)	val="$define";;
8329	*)	val="$undef" ;;
8330	esac
8331else
8332	val="$undef"
8333fi
8334set installusrbinperl
8335eval $setvar
8336
8337: see if dlopen exists
8338xxx_runnm="$runnm"
8339xxx_ccflags="$ccflags"
8340runnm=false
8341: with g++ one needs -shared to get is-in-libc to work for dlopen
8342case "$gccversion" in
8343'')	;;
8344*Clang*)	;;
8345*)	case "$d_cplusplus" in
8346	"$define") ccflags="$ccflags -shared" ;;
8347	esac
8348	;;
8349esac
8350set dlopen d_dlopen
8351eval $inlibc
8352runnm="$xxx_runnm"
8353ccflags="$xxx_ccflags"
8354
8355: see if this is a unistd.h system
8356set unistd.h i_unistd
8357eval $inhdr
8358
8359: determine which dynamic loading, if any, to compile in
8360echo " "
8361dldir="ext/DynaLoader"
8362case "$usedl" in
8363    $define|y|true)
8364	dflt='y'
8365	usedl="$define"
8366	;;
8367    $undef|n|false)
8368	dflt='n'
8369	usedl="$undef"
8370	;;
8371    *)
8372	dflt='n'
8373	case "$d_dlopen" in
8374	    $define) dflt='y' ;;
8375	esac
8376	: Does a dl_xxx.xs file exist for this operating system
8377	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8378	;;
8379esac
8380rp="Do you wish to use dynamic loading?"
8381. ./myread
8382usedl="$ans"
8383bin_ELF="$undef"
8384case "$ans" in
8385    y*) usedl="$define"
8386	case "$dlsrc" in
8387	    '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8388		    dflt="$dldir/dl_${osname}.xs"
8389		elif $test "$d_dlopen" = "$define" ; then
8390		    dflt="$dldir/dl_dlopen.xs"
8391		else
8392		    dflt=''
8393		fi
8394		;;
8395	    *)  dflt="$dldir/$dlsrc"
8396		;;
8397	esac
8398	echo "The following dynamic loading files are available:"
8399	: Can not go over to $dldir because getfile has path hard-coded in.
8400	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8401	rp="Source file to use for dynamic loading"
8402	fn="fne"
8403	gfpth="$src"
8404	. ./getfile
8405	usedl="$define"
8406	: emulate basename
8407	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8408
8409	$cat << EOM
8410
8411Some systems may require passing special flags to $cc -c to
8412compile modules that will be used to create a shared library.
8413To use no flags, say "none".
8414
8415EOM
8416	case "$cccdlflags" in
8417	    '') case "$gccversion" in
8418		'') case "$osname" in
8419			hpux)	dflt='+z' ;;
8420			irix*)	dflt='-KPIC' ;;
8421			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8422			sunos)	dflt='-pic' ;;
8423			*)	dflt='none' ;;
8424		    esac
8425		    ;;
8426		*)  case "$osname" in
8427			darwin) dflt='none' ;;
8428			*linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8429			*)	dflt='-fpic' ;;
8430		    esac ;;
8431		esac ;;
8432	    ' ') dflt='none' ;;
8433	    *)   dflt="$cccdlflags" ;;
8434	esac
8435
8436	case "$dflt" in
8437	    none) dflt='' ;;
8438	esac
8439
8440	# If -Dsysroot was specified, now's the time to add it
8441	# to cccdlflags
8442	if test "X$sysroot" != X; then
8443	    case "$gccversion" in
8444		'') ;;
8445		*)  case "$dflt" in
8446			*sysroot*) ;;
8447			'undef'|*)
8448			    dflt="$dflt --sysroot=$sysroot" ;;
8449		    esac
8450		    ;;
8451	    esac
8452	fi
8453
8454	case "$dflt" in
8455	    '') dflt='none';;
8456	esac
8457
8458	rp="Any special flags to pass to $cc -c to compile shared library modules?"
8459	. ./myread
8460	case "$ans" in
8461	    none) cccdlflags=' ' ;;
8462	    *)    cccdlflags="$ans" ;;
8463	esac
8464
8465	cat << EOM
8466
8467Some systems use ld to create libraries that can be dynamically loaded,
8468while other systems (such as those using ELF) use $cc.
8469
8470EOM
8471
8472: Determine if this is ELF
8473	$cat >try.c <<EOM
8474/* Test for whether ELF binaries are produced */
8475#include <fcntl.h>
8476#$i_stdlib I_STDLIB
8477#ifdef I_STDLIB
8478#include <stdlib.h>
8479#endif
8480#$i_unistd I_UNISTD
8481#ifdef I_UNISTD
8482#include <unistd.h>
8483#endif
8484int main() {
8485    char b[4];
8486    int i = open("a.out",O_RDONLY);
8487    if(i == -1)
8488	exit(1); /* fail */
8489    if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8490	exit(0); /* succeed (yes, it is ELF) */
8491    exit(1); /* fail */
8492}
8493EOM
8494	if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8495	    bin_ELF="$define"
8496	fi
8497	$rm_try
8498
8499	case "$ld" in
8500	    '') if $test $bin_ELF = "$define"; then
8501		    cat <<EOM
8502You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8503EOM
8504		    dflt="$cc"
8505		else
8506		    echo "I'll use ld to build dynamic libraries."
8507		    dflt='ld'
8508		fi
8509		;;
8510	    *)  dflt="$ld"
8511		;;
8512	esac
8513
8514	rp="What command should be used to create dynamic libraries?"
8515	. ./myread
8516	ld="$ans"
8517
8518	cat << EOM
8519
8520Some systems may require passing special flags to $ld to create a
8521library that can be dynamically loaded.  If your ld flags include
8522-L/other/path options to locate libraries outside your loader's normal
8523search path, you may need to specify those -L options here as well.  To
8524use no flags, say "none".
8525
8526EOM
8527	case "$lddlflags" in
8528	    '') case "$osname" in
8529		    haiku) dflt='-shared' ;;
8530		    hpux) dflt='-b';
8531			  case "$gccversion" in
8532			      '') dflt="$dflt +vnocompatwarnings" ;;
8533			  esac
8534			  ;;
8535		    *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8536		    solaris) # See [perl #66604].
8537			    # On Solaris 11, gcc -m64 on amd64
8538			    # appears not to understand -G.  gcc versions at
8539			    # least as old as 3.4.3 support -shared, so just
8540			    # use that with Solaris 11 and later, but keep
8541			    # the old behavior for older Solaris versions.
8542			    case "$gccversion" in
8543				'') dflt='-G' ;;
8544				*)  case "$osvers" in
8545					2.?|2.10) dflt='-G' ;;
8546					*) dflt='-shared' ;;
8547				    esac
8548				    ;;
8549			    esac
8550			    ;;
8551		    sunos) dflt='-assert nodefinitions' ;;
8552		    svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8553		    *)     dflt='none' ;;
8554		esac
8555		;;
8556	    *) dflt="$lddlflags" ;;
8557	esac
8558
8559	: Only do this for gcc, since, for example, qcc has no concept
8560	: of --sysroot.
8561	if $test "X$sysroot" != X; then
8562	    case "$gccversion" in
8563		'') ;;
8564		*)  dflt="$dflt --sysroot=$sysroot" ;;
8565	    esac
8566	fi
8567
8568	: Try to guess additional flags to pick up local libraries.
8569	: Be careful not to append to a plain 'none'
8570	case "$dflt" in
8571	    none) dflt='' ;;
8572	esac
8573	for thisflag in $ldflags; do
8574	    case "$thisflag" in
8575		-L*|-R*|-Wl,-R*)
8576		    case " $dflt " in
8577			*" $thisflag "*) ;;
8578			*) dflt="$dflt $thisflag" ;;
8579		    esac
8580		    ;;
8581	    esac
8582	done
8583
8584	case "$dflt" in
8585	    ''|' ') dflt='none' ;;
8586	esac
8587
8588	case "$ldflags" in
8589	    *-fstack-protector-strong*)
8590		case "$dflt" in
8591		    *-fstack-protector-strong*) ;; # Don't add it again
8592		    *) dflt="$dflt -fstack-protector-strong" ;;
8593		esac
8594		;;
8595	    *-fstack-protector*)
8596		case "$dflt" in
8597		    *-fstack-protector*) ;; # Don't add it again
8598		    *) dflt="$dflt -fstack-protector" ;;
8599		esac
8600		;;
8601	esac
8602
8603	rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8604	. ./myread
8605	case "$ans" in
8606	    none) lddlflags=' ' ;;
8607	    *) lddlflags="$ans" ;;
8608	esac
8609
8610	cat <<EOM
8611
8612Some systems may require passing special flags to $cc to indicate that
8613the resulting executable will use dynamic linking.  To use no flags,
8614say "none".
8615
8616EOM
8617	case "$ccdlflags" in
8618	    '') case "$osname" in
8619		    *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8620		    sunos)             dflt='none'   ;;
8621		    *)                 dflt='none'   ;;
8622		esac ;;
8623	    ' ') dflt='none' ;;
8624	    *)   dflt="$ccdlflags" ;;
8625	esac
8626	rp="Any special flags to pass to $cc to use dynamic linking?"
8627	. ./myread
8628	case "$ans" in
8629	    none) ccdlflags=' ' ;;
8630	    *)    ccdlflags="$ans" ;;
8631	esac
8632	;;
8633
8634    *)  usedl="$undef"
8635	ld='ld'
8636	dlsrc='dl_none.xs'
8637	lddlflags=''
8638	ccdlflags=''
8639	;;
8640esac
8641
8642ld_can_script="$undef"
8643case "$bin_ELF$usedl" in
8644    $define$define)
8645	# Abuse try.h and a.out names for neat cleanup
8646	$cat >try.c <<EOM
8647void foo() {}
8648void bar() {}
8649EOM
8650	$cat >try.h <<EOM
8651LIBTEST_42 {
8652 global:
8653  foo;
8654 local: *;
8655 };
8656EOM
8657	if $cc $cccdlflags $ccdlflags $ccflags \
8658	       $ldflags $lddlflags -o a.out try.c \
8659	       -Wl,--version-script=try.h >/dev/null 2>&1 \
8660	   &&  $test -s a.out ; then
8661	    echo "ld supports scripting" >&4
8662	    ld_can_script="$define"
8663	else
8664	    echo "ld does not support scripting" >&4
8665	fi
8666	$rm_try
8667	;;
8668esac
8669
8670: Do we want a shared libperl?
8671also=''
8672case "$usedl" in
8673$undef)
8674	# No dynamic loading being used, so don't bother even to prompt.
8675	useshrplib='false'
8676	;;
8677*)	case "$useshrplib" in
8678	'')	case "$osname" in
8679		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8680			dflt=y
8681			also='Building a shared libperl is required for dynamic loading to work on your system.'
8682			;;
8683		*)	dflt=n
8684			;;
8685		esac
8686		;;
8687	$define|true|[Yy]*)
8688		dflt=y
8689		;;
8690	*)	dflt=n
8691		;;
8692	esac
8693	$cat << EOM
8694
8695The perl executable is normally obtained by linking perlmain.c with
8696libperl${_a}, any static extensions (usually just DynaLoader), and
8697any other libraries needed on this system (such as -lm, etc.).  Since
8698your system supports dynamic loading, it is probably possible to build
8699a shared libperl.$so.  If you will have more than one executable linked
8700to libperl.$so, this will significantly reduce the size of each
8701executable, but it may have a noticeable effect on performance.  The
8702default is probably sensible for your system.
8703$also
8704
8705EOM
8706	rp="Build a shared libperl.$so (y/n)"
8707	. ./myread
8708	case "$ans" in
8709	true|$define|[Yy]*)
8710		useshrplib='true'  ;;
8711	*)	useshrplib='false' ;;
8712	esac
8713	;;
8714esac
8715
8716case "$useshrplib" in
8717true)
8718	case "$userelocatableinc" in
8719	true|define)
8720		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8721		echo "See INSTALL for an explanation why that won't work." >&4
8722		exit 4
8723		;;
8724	esac
8725	case "$libperl" in
8726	'')
8727		# Figure out a good name for libperl.so.  Since it gets stored in
8728		# a version-specific architecture-dependent library, the version
8729		# number isn't really that important, except for making cc/ld happy.
8730		#
8731		# A name such as libperl.so.10.1
8732		majmin="libperl.$so.$patchlevel.$subversion"
8733		# A name such as libperl.so.100
8734		majonly=`echo $patchlevel $subversion |
8735			$awk '{printf "%d%02d", $1, $2}'`
8736		majonly=libperl.$so.$majonly
8737		# I'd prefer to keep the os-specific stuff here to a minimum, and
8738		# rely on figuring it out from the naming of libc.
8739		case "${osname}${osvers}" in
8740		*linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8741			dflt=libperl.$so
8742			;;
8743		cygwin*) # ld links now against the dll directly
8744			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8745			majonly=`echo $patchlevel $subversion |
8746				$awk '{printf "%03d%03d", $1, $2}'`
8747			majonly=cygperl5.$majonly.$so
8748			dflt=$majmin
8749			;;
8750		*)	# Try to guess based on whether libc has major.minor.
8751			case "$libc" in
8752			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8753			*libc.$so.[0-9]*) dflt=$majonly ;;
8754			*)	dflt=libperl.$so ;;
8755			esac
8756			;;
8757		esac
8758		;;
8759	*)	dflt=$libperl
8760		;;
8761	esac
8762	cat << EOM
8763
8764I need to select a good name for the shared libperl.  If your system uses
8765library names with major and minor numbers, then you might want something
8766like $majmin.  Alternatively, if your system uses a single version
8767number for shared libraries, then you might want to use $majonly.
8768Or, your system might be quite happy with a simple libperl.$so.
8769
8770Since the shared libperl will get installed into a version-specific
8771architecture-dependent directory, the version number of the shared perl
8772library probably isn't important, so the default should be o.k.
8773
8774EOM
8775	rp='What name do you want to give to the shared libperl?'
8776	. ./myread
8777	libperl=$ans
8778	echo "Ok, I'll use $libperl"
8779	;;
8780*)
8781	libperl="libperl${_a}"
8782	;;
8783esac
8784
8785# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8786case "$shrpdir" in
8787'') ;;
8788*)	$cat >&4 <<EOM
8789WARNING:  Use of the shrpdir variable for the installation location of
8790the shared $libperl is not supported.  It was never documented and
8791will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8792know of any problems this may cause.
8793
8794EOM
8795	case "$shrpdir" in
8796	"$archlibexp/CORE")
8797		$cat >&4 <<EOM
8798But your current setting of $shrpdir is
8799the default anyway, so it's harmless.
8800EOM
8801		;;
8802	*)
8803		$cat >&4 <<EOM
8804Further, your current attempted setting of $shrpdir
8805conflicts with the value of $archlibexp/CORE
8806that installperl will use.
8807EOM
8808		;;
8809	esac
8810	;;
8811esac
8812
8813# How will the perl executable find the installed shared $libperl?
8814# Add $xxx to ccdlflags.
8815# If we can't figure out a command-line option, use $shrpenv to
8816# set env LD_RUN_PATH.  The main perl makefile uses this.
8817shrpdir=$archlibexp/CORE
8818xxx=''
8819tmp_shrpenv=''
8820if "$useshrplib"; then
8821    case "$osname" in
8822	aix)
8823		# We'll set it in Makefile.SH...
8824		;;
8825	solaris)
8826		xxx="-R $shrpdir"
8827		;;
8828	freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8829		xxx="-Wl,-R$shrpdir"
8830		;;
8831	bsdos|linux|irix*|dec_osf|gnu*|haiku)
8832		xxx="-Wl,-rpath,$shrpdir"
8833		;;
8834	hpux*)
8835		# hpux doesn't like the default, either.
8836		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8837		;;
8838	cygwin)
8839		# cygwin needs only ldlibpth
8840		;;
8841	*)
8842		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8843		;;
8844	esac
8845	case "$xxx" in
8846	'') ;;
8847	*)
8848		# Only add $xxx if it isn't already in ccdlflags.
8849		case " $ccdlflags " in
8850		*" $xxx "*)	;;
8851		*)	ccdlflags="$ccdlflags $xxx"
8852			cat <<EOM >&4
8853
8854Adding $xxx to the flags
8855passed to $ld so that the perl executable will find the
8856installed shared $libperl.
8857
8858EOM
8859			;;
8860		esac
8861		;;
8862	esac
8863fi
8864# Fix ccdlflags in AIX for building external extensions.
8865# (For building Perl itself bare -bE:perl.exp is needed,
8866#  Makefile.SH takes care of this.)
8867case "$osname" in
8868aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8869esac
8870# Respect a hint or command-line value.
8871case "$shrpenv" in
8872'') shrpenv="$tmp_shrpenv" ;;
8873esac
8874case "$ldlibpthname" in
8875'')	ldlibpthname=LD_LIBRARY_PATH ;;
8876none)	ldlibpthname='' ;;
8877esac
8878
8879: determine where manual pages are on this system
8880echo " "
8881case "$sysman" in
8882'')
8883	syspath='/usr/share/man/man1 /usr/man/man1'
8884	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8885	syspath="$syspath /usr/man/u_man/man1"
8886	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8887	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8888	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8889	sysman=`./loc . /usr/man/man1 $syspath`
8890	;;
8891esac
8892if $test -d "$sysman"; then
8893	echo "System manual is in $sysman." >&4
8894else
8895	echo "Could not find manual pages in source form." >&4
8896fi
8897
8898: determine where manual pages go
8899set man1dir man1dir none
8900eval $prefixit
8901$cat <<EOM
8902
8903$spackage has manual pages available in source form.
8904EOM
8905case "$nroff" in
8906nroff)
8907	echo "However, you don't have nroff, so they're probably useless to you."
8908	case "$man1dir" in
8909	'') man1dir="none";;
8910	esac;;
8911esac
8912echo "If you don't want the manual sources installed, answer 'none'."
8913case "$man1dir" in
8914' ') dflt=none
8915	;;
8916'')
8917	lookpath="$prefixexp/share/man/man1"
8918	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8919	lookpath="$lookpath $prefixexp/man/p_man/man1"
8920	lookpath="$lookpath $prefixexp/man/u_man/man1"
8921	lookpath="$lookpath $prefixexp/man/man.1"
8922	case "$sysman" in
8923	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8924	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8925	esac
8926	set dflt
8927	eval $prefixup
8928	;;
8929*)  dflt="$man1dir"
8930	;;
8931esac
8932echo " "
8933fn=dn+~
8934rp="Where do the main $spackage manual pages (source) go?"
8935. ./getfile
8936if $test "X$man1direxp" != "X$ansexp"; then
8937	installman1dir=''
8938fi
8939prefixvar=man1dir
8940. ./setprefixvar
8941
8942case "$man1dir" in
8943'')	man1dir=' '
8944	installman1dir='';;
8945esac
8946
8947: What suffix to use on installed man pages
8948
8949case "$man1dir" in
8950' ')
8951	man1ext='0'
8952	;;
8953*)
8954	rp="What suffix should be used for the main $spackage man pages?"
8955	case "$man1ext" in
8956	'')	case "$man1dir" in
8957		*1)  dflt=1 ;;
8958		*1p) dflt=1p ;;
8959		*1pm) dflt=1pm ;;
8960		*l) dflt=l;;
8961		*n) dflt=n;;
8962		*o) dflt=o;;
8963		*p) dflt=p;;
8964		*C) dflt=C;;
8965		*L) dflt=L;;
8966		*L1) dflt=L1;;
8967		*) dflt=1;;
8968		esac
8969		;;
8970	*)	dflt="$man1ext";;
8971	esac
8972	. ./myread
8973	man1ext="$ans"
8974	;;
8975esac
8976
8977: see if we can have long filenames
8978echo " "
8979first=123456789abcdef
8980$rm -f $first
8981if (echo hi >$first) 2>/dev/null; then
8982	if $test -f 123456789abcde; then
8983		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8984		val="$undef"
8985	else
8986		echo 'You can have filenames longer than 14 characters.'>&4
8987		val="$define"
8988	fi
8989else
8990	$cat <<'EOM'
8991You can't have filenames longer than 14 chars.
8992You can't even think about them!
8993EOM
8994	val="$undef"
8995fi
8996set d_flexfnam
8997eval $setvar
8998$rm -rf 123456789abcde*
8999
9000: determine where library module manual pages go
9001set man3dir man3dir none
9002eval $prefixit
9003$cat <<EOM
9004
9005$spackage has manual pages for many of the library modules.
9006EOM
9007
9008case "$nroff" in
9009nroff)
9010	$cat <<'EOM'
9011However, you don't have nroff, so they're probably useless to you.
9012EOM
9013	case "$man3dir" in
9014	'') man3dir="none";;
9015	esac;;
9016esac
9017
9018case "$d_flexfnam" in
9019undef)
9020	$cat <<'EOM'
9021However, your system can't handle the long file names like File::Basename.3.
9022EOM
9023	case "$man3dir" in
9024	'') man3dir="none";;
9025	esac;;
9026esac
9027
9028echo "If you don't want the manual sources installed, answer 'none'."
9029prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9030case "$man3dir" in
9031'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9032	if $test -d "$privlib/man/man3"; then
9033		cat <<EOM >&4
9034
9035WARNING:  Previous versions of perl installed man3 pages into
9036$privlib/man/man3.  This version will suggest a
9037new default of $dflt.
9038EOM
9039		tdflt=$dflt
9040		dflt='n'
9041		rp='Do you wish to preserve the old behavior?(y/n)'
9042		. ./myread
9043		case "$ans" in
9044		y*) dflt="$privlib/man/man3" ;;
9045		*)  dflt=$tdflt ;;
9046		esac
9047    fi
9048	;;
9049*)	dflt="$man3dir" ;;
9050esac
9051case "$dflt" in
9052' ') dflt=none ;;
9053esac
9054echo " "
9055fn=dn+~
9056rp="Where do the $package library man pages (source) go?"
9057. ./getfile
9058prefixvar=man3dir
9059. ./setprefixvar
9060
9061case "$man3dir" in
9062'')	man3dir=' '
9063	installman3dir='';;
9064esac
9065
9066: What suffix to use on installed man pages
9067case "$man3dir" in
9068' ')
9069	man3ext='0'
9070	;;
9071*)
9072	rp="What suffix should be used for the $package library man pages?"
9073	case "$man3ext" in
9074	'')	case "$man3dir" in
9075		*3)  dflt=3 ;;
9076		*3p) dflt=3p ;;
9077		*3pm) dflt=3pm ;;
9078		*l) dflt=l;;
9079		*n) dflt=n;;
9080		*o) dflt=o;;
9081		*p) dflt=p;;
9082		*C) dflt=C;;
9083		*L) dflt=L;;
9084		*L3) dflt=L3;;
9085		*) dflt=3;;
9086		esac
9087		;;
9088	*)	dflt="$man3ext";;
9089	esac
9090	. ./myread
9091	man3ext="$ans"
9092	;;
9093esac
9094
9095: see if we have to deal with yellow pages, now NIS.
9096if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9097	case "$hostcat" in
9098	nidump*) ;;
9099	*)
9100		case "$hostcat" in
9101		*ypcat*) dflt=y;;
9102		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9103				dflt=y
9104			else
9105				dflt=n
9106			fi;;
9107		*) dflt=n;;
9108		esac
9109		echo " "
9110		rp='Are you getting the hosts file via yellow pages?'
9111		. ./myread
9112		case "$ans" in
9113		y*) hostcat='ypcat hosts';;
9114		*) hostcat='cat /etc/hosts';;
9115		esac
9116		;;
9117	esac
9118fi
9119case "$hostcat" in
9120'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9121esac
9122case "$groupcat" in
9123'') test -f /etc/group && groupcat='cat /etc/group';;
9124esac
9125case "$passcat" in
9126'') test -f /etc/passwd && passcat='cat /etc/passwd';;
9127esac
9128
9129: now get the host name
9130echo " "
9131echo "Figuring out host name..." >&4
9132case "$myhostname" in
9133'') cont=true
9134	echo 'Maybe "hostname" will work...'
9135	if tans=`sh -c hostname 2>&1` ; then
9136		myhostname=$tans
9137		phostname=hostname
9138		cont=''
9139	fi
9140	;;
9141*) cont='';;
9142esac
9143if $test "$cont"; then
9144	if ./xenix; then
9145		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9146		if tans=`cat /etc/systemid 2>&1` ; then
9147			myhostname=$tans
9148			phostname='cat /etc/systemid'
9149			echo "Whadyaknow.  Xenix always was a bit strange..."
9150			cont=''
9151		fi
9152	elif $test -r /etc/systemid; then
9153		echo "(What is a non-Xenix system doing with /etc/systemid?)"
9154	fi
9155fi
9156if $test "$cont"; then
9157	echo 'No, maybe "uuname -l" will work...'
9158	if tans=`sh -c 'uuname -l' 2>&1` ; then
9159		myhostname=$tans
9160		phostname='uuname -l'
9161	else
9162		echo 'Strange.  Maybe "uname -n" will work...'
9163		if tans=`sh -c 'uname -n' 2>&1` ; then
9164			myhostname=$tans
9165			phostname='uname -n'
9166		else
9167			echo 'Oh well, maybe I can mine it out of whoami.h...'
9168			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9169				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9170				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9171			else
9172				case "$myhostname" in
9173				'') echo "Does this machine have an identity crisis or something?"
9174					phostname='';;
9175				*)
9176					echo "Well, you said $myhostname before..."
9177					phostname='echo $myhostname';;
9178				esac
9179			fi
9180		fi
9181	fi
9182fi
9183case "$myhostname" in
9184'') myhostname=noname ;;
9185esac
9186: you do not want to know about this
9187set $myhostname
9188myhostname=$1
9189
9190: verify guess
9191if $test "$myhostname" ; then
9192	dflt=y
9193	rp='Your host name appears to be "'$myhostname'".'" Right?"
9194	. ./myread
9195	case "$ans" in
9196	y*) ;;
9197	*) myhostname='';;
9198	esac
9199fi
9200
9201: bad guess or no guess
9202while $test "X$myhostname" = X ; do
9203	dflt=''
9204	rp="Please type the (one word) name of your host:"
9205	. ./myread
9206	myhostname="$ans"
9207done
9208
9209: translate upper to lower if necessary
9210case "$myhostname" in
9211*[A-Z]*)
9212	echo "(Normalizing case in your host name)"
9213	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9214	;;
9215esac
9216
9217case "$myhostname" in
9218*.*)
9219	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9220	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9221	echo "(Trimming domain name from host name--host name is now $myhostname)"
9222	;;
9223*) case "$mydomain" in
9224	'')
9225		{
9226			test "X$hostcat" = "Xypcat hosts" &&
9227			ypmatch "$myhostname" hosts 2>/dev/null |\
9228				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
9229			$test -s hosts
9230		} || {
9231			test "X$hostcat" != "X" &&
9232			$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
9233					/[	 ]$myhostname[	. ]/p" > hosts
9234		}
9235		tmp_re="[	. ]"
9236		if $test -f hosts; then
9237			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
9238			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
9239			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9240				hosts | $sort | $uniq | \
9241				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9242			case `$echo X$dflt` in
9243			X*\ *)	echo "(Several hosts in the database matched hostname)"
9244				dflt=.
9245				;;
9246			X.) echo "(You do not have fully-qualified names in the hosts database)"
9247				;;
9248			esac
9249		else
9250			echo "(I cannot locate a hosts database anywhere)"
9251			dflt=.
9252		fi
9253		case "$dflt" in
9254		.)
9255			tans=`./loc resolv.conf X /etc /usr/etc`
9256			if $test -f "$tans"; then
9257				echo "(Attempting domain name extraction from $tans)"
9258				dflt=.`$sed -n -e 's/	/ /g' \
9259				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9260				  -e 1q 2>/dev/null`
9261				case "$dflt" in
9262				.) dflt=.`$sed -n -e 's/	/ /g' \
9263				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9264				     -e 1q 2>/dev/null`
9265					;;
9266				esac
9267			fi
9268			;;
9269		esac
9270		case "$dflt" in
9271		.) echo "(No help from resolv.conf either -- attempting clever guess)"
9272			dflt=.`sh -c domainname 2>/dev/null`
9273			case "$dflt" in
9274			'') dflt='.';;
9275			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9276			esac
9277			;;
9278		esac
9279		case "$dflt$osname" in
9280		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9281			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9282			;;
9283		esac
9284		case "$dflt" in
9285		.) echo "(Lost all hope -- silly guess then)"
9286			dflt='.nonet'
9287			;;
9288		esac
9289		$rm -f hosts
9290		;;
9291	*) dflt="$mydomain";;
9292	esac;;
9293esac
9294echo " "
9295rp="What is your domain name?"
9296. ./myread
9297tans="$ans"
9298case "$ans" in
9299'') ;;
9300.*) ;;
9301*) tans=".$tans";;
9302esac
9303mydomain="$tans"
9304
9305: translate upper to lower if necessary
9306case "$mydomain" in
9307*[A-Z]*)
9308	echo "(Normalizing case in your domain name)"
9309	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9310	;;
9311esac
9312
9313: a little sanity check here
9314case "$phostname" in
9315'') ;;
9316*)
9317	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9318	$myhostname$mydomain|$myhostname) ;;
9319	*)
9320		case "$phostname" in
9321		sed*)
9322			echo "(That doesn't agree with your whoami.h file, by the way.)"
9323			;;
9324		*)
9325			echo "(That doesn't agree with your $phostname command, by the way.)"
9326			;;
9327		esac
9328	;;
9329	esac
9330	;;
9331esac
9332
9333: determine the e-mail address of the user who is running us
9334$cat <<EOM
9335
9336I need to get your e-mail address in Internet format if possible, i.e.
9337something like user@host.domain. Please answer accurately since I have
9338no easy means to double check it. The default value provided below
9339is most probably close to reality but may not be valid from outside
9340your organization...
9341
9342EOM
9343cont=x
9344while test "$cont"; do
9345	case "$MAILDOMAIN" in
9346	'')
9347		if $test -s /etc/mailname; then
9348			maildomain=`$cat /etc/mailname`
9349		else
9350			maildomain="$myhostname$mydomain"
9351		fi
9352		;;
9353	*)  maildomain="$MAILDOMAIN";;
9354	esac
9355	case "$cf_email" in
9356	'') dflt="$cf_by@$maildomain";;
9357	*)  dflt="$cf_email";;
9358	esac
9359	rp='What is your e-mail address?'
9360	. ./myread
9361	cf_email="$ans"
9362	case "$cf_email" in
9363	*@*.*) cont='' ;;
9364	*)
9365		rp='Address does not look like an Internet one.  Use it anyway?'
9366		case "$fastread" in
9367		yes) dflt=y ;;
9368		*) dflt=n ;;
9369		esac
9370		. ./myread
9371		case "$ans" in
9372		y*) cont='' ;;
9373		*) echo " " ;;
9374		esac
9375		;;
9376	esac
9377done
9378
9379: Ask e-mail of administrator
9380$cat <<EOM
9381
9382If you or somebody else will be maintaining perl at your site, please
9383fill in the correct e-mail address here so that they may be contacted
9384if necessary. Currently, the "perlbug" program included with perl
9385will send mail to this address in addition to perlbug@perl.org. You may
9386enter "none" for no administrator.
9387
9388EOM
9389case "$perladmin" in
9390'') dflt="$cf_email";;
9391*) dflt="$perladmin";;
9392esac
9393rp='Perl administrator e-mail address'
9394. ./myread
9395perladmin="$ans"
9396
9397: determine whether to use a version number suffix for installed binaries
9398echo " "
9399$cat <<EOM
9400Do you want to use a version number suffix for installed binaries? This
9401will install 'perl$version' instead of 'perl', and likewise for other
9402binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9403to be installed side-by-side. Unless you are a developer, you probably
9404do *not* want to do this.
9405EOM
9406case "$versiononly" in
9407"$define"|[Yy]*|true) dflt='y' ;;
9408*) dflt='n';
9409esac
9410rp="Do you want to use a version number suffix for installed binaries?"
9411. ./myread
9412case "$ans" in
9413[yY]*)	val="$define";;
9414*)	val="$undef" ;;
9415esac
9416set versiononly
9417eval $setvar
9418
9419case "$versiononly" in
9420"$define") inc_version_list=''
9421           inc_version_list_init=0
9422           ;;
9423esac
9424
9425: figure out how to guarantee perl startup
9426: XXX Note that this currently takes advantage of the bug that binexp ignores
9427:     the Configure -Dinstallprefix setting, which in turn means that under
9428:     relocatable @INC, initialinstalllocation is what binexp started as.
9429case "$startperl" in
9430'')
9431	case "$sharpbang" in
9432	*!)
9433		$cat <<EOH
9434
9435I can use the #! construct to start perl on your system. This will
9436make startup of perl scripts faster, but may cause problems if you
9437want to share those scripts and perl is not in a standard place
9438($initialinstalllocation/perl) on all your platforms. The alternative
9439is to force a shell by starting the script with a single ':' character.
9440
9441EOH
9442		case "$versiononly" in
9443		"$define")      dflt="$initialinstalllocation/perl$version";;
9444		*)              dflt="$initialinstalllocation/perl";;
9445		esac
9446		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9447		. ./myread
9448		case "$ans" in
9449		none)	startperl=": # use perl";;
9450		*)	startperl="#!$ans"
9451			if $test 30 -lt `echo "$ans" | wc -c`; then
9452				$cat >&4 <<EOM
9453
9454WARNING:  Some systems limit the #! command to 32 characters.
9455If you experience difficulty running Perl scripts with #!, try
9456installing Perl in a directory with a shorter pathname.
9457
9458EOM
9459			fi ;;
9460		esac
9461		;;
9462	*) startperl=": # use perl"
9463		;;
9464	esac
9465	;;
9466esac
9467echo "I'll use $startperl to start perl scripts."
9468
9469: figure best path for perl in scripts
9470case "$perlpath" in
9471'')
9472	case "$versiononly" in
9473	"$define")	perlpath="$initialinstalllocation/perl$version";;
9474	*)		perlpath="$initialinstalllocation/perl";;
9475	esac
9476	case "$startperl" in
9477	*!*) ;;
9478	*)
9479		$cat <<EOH
9480
9481I will use the "eval 'exec'" idiom to start Perl on your system.
9482I can use the full path of your Perl binary for this purpose, but
9483doing so may cause problems if you want to share those scripts and
9484Perl is not always in a standard place ($initialinstalllocation/perl).
9485
9486EOH
9487		dflt="$initialinstalllocation/perl"
9488		rp="What path shall I use in \"eval 'exec'\"?"
9489		. ./myread
9490		perlpath="$ans"
9491		;;
9492	esac
9493	;;
9494esac
9495case "$startperl" in
9496*!*)	;;
9497*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9498esac
9499
9500: determine where public executable scripts go
9501set scriptdir scriptdir
9502eval $prefixit
9503case "$scriptdir" in
9504'')
9505	dflt="$bin"
9506	: guess some guesses
9507	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9508	$test -d /usr/share/bin     && dflt=/usr/share/bin
9509	$test -d /usr/local/script  && dflt=/usr/local/script
9510	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9511	$test -d $prefixexp/script  && dflt=$prefixexp/script
9512	set dflt
9513	eval $prefixup
9514	;;
9515*)  dflt="$scriptdir"
9516	;;
9517esac
9518$cat <<EOM
9519
9520Some installations have a separate directory just for executable scripts so
9521that they can mount it across multiple architectures but keep the scripts in
9522one spot.  You might, for example, have a subdirectory of /usr/share for this.
9523Or you might just lump your scripts in with all your other executables.
9524
9525EOM
9526fn=d~
9527rp='Where do you keep publicly executable scripts?'
9528. ./getfile
9529if $test "X$ansexp" != "X$scriptdirexp"; then
9530	installscript=''
9531fi
9532installscriptdir=''
9533prefixvar=scriptdir
9534. ./setprefixvar
9535: A little fix up for an irregularly named variable.
9536installscript="$installscriptdir"
9537
9538: determine where add-on public executables go
9539case "$sitebin" in
9540'')	dflt=$siteprefix/bin ;;
9541*)	dflt=$sitebin ;;
9542esac
9543fn=d~
9544rp='Pathname where the add-on public executables should be installed?'
9545. ./getfile
9546prefixvar=sitebin
9547. ./setprefixvar
9548
9549: determine where add-on html pages go
9550: There is no standard location, so try to copy the previously-selected
9551: directory structure for the core html pages.
9552case "$sitehtml1dir" in
9553'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9554*)     dflt=$sitehtml1dir ;;
9555esac
9556case "$dflt" in
9557''|' ') dflt=none ;;
9558esac
9559fn=dn+~
9560rp='Pathname where the site-specific html pages should be installed?'
9561. ./getfile
9562prefixvar=sitehtml1dir
9563. ./setprefixvar
9564
9565: determine where add-on library html pages go
9566: There is no standard location, so try to copy the previously-selected
9567: directory structure for the core html pages.
9568case "$sitehtml3dir" in
9569'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9570*)     dflt=$sitehtml3dir ;;
9571esac
9572case "$dflt" in
9573''|' ') dflt=none ;;
9574esac
9575fn=dn+~
9576rp='Pathname where the site-specific library html pages should be installed?'
9577. ./getfile
9578prefixvar=sitehtml3dir
9579. ./setprefixvar
9580
9581: determine where add-on manual pages go
9582case "$siteman1dir" in
9583'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9584*)	dflt=$siteman1dir ;;
9585esac
9586case "$dflt" in
9587''|' ') dflt=none ;;
9588esac
9589fn=dn+~
9590rp='Pathname where the site-specific manual pages should be installed?'
9591. ./getfile
9592prefixvar=siteman1dir
9593. ./setprefixvar
9594
9595: determine where add-on library man pages go
9596case "$siteman3dir" in
9597'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9598*)	dflt=$siteman3dir ;;
9599esac
9600case "$dflt" in
9601''|' ') dflt=none ;;
9602esac
9603fn=dn+~
9604rp='Pathname where the site-specific library manual pages should be installed?'
9605. ./getfile
9606prefixvar=siteman3dir
9607. ./setprefixvar
9608
9609: determine where add-on public executable scripts go
9610case "$sitescript" in
9611'')	dflt=$sitebin ;;
9612*)  dflt="$sitescript" ;;
9613esac
9614fn=d~+
9615rp='Pathname where add-on public executable scripts should be installed?'
9616. ./getfile
9617prefixvar=sitescript
9618. ./setprefixvar
9619
9620: see if backtrace exists
9621set backtrace d_backtrace
9622eval $inlibc
9623
9624: Check if C backtrace is actually supported.
9625case "$usecbacktrace" in
9626  "") usecbacktrace=$undef ;;
9627  [yY]*|true|$define)
9628    case "$d_backtrace" in
9629      [yY]*|true|$define)
9630        ;;
9631      *)
9632        echo "This system does not support backtrace" >&4
9633        usecbacktrace=$undef
9634        ;;
9635      esac
9636    ;;
9637  esac
9638
9639: Check if faststdio is requested and available
9640case "$usefaststdio" in
9641$define|true|[yY]*|'')
9642	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9643	case "$xversion" in
9644	[68])	dflt='y' ;;
9645	*)	dflt='n' ;;
9646	esac
9647	;;
9648*) dflt='n';;
9649esac
9650cat <<EOM
9651
9652Perl can be built to use 'fast stdio', which means using the stdio
9653library but also directly manipulating the stdio buffers to enable
9654faster I/O.  Using stdio is better for backward compatibility (especially
9655for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9656interface has been preferred instead of stdio.
9657
9658If this doesn't make any sense to you, just accept the default '$dflt'.
9659EOM
9660rp='Use the "fast stdio" if available?'
9661. ./myread
9662case "$ans" in
9663y|Y)	val="$define" ;;
9664*)      val="$undef" ;;
9665esac
9666set usefaststdio
9667eval $setvar
9668
9669: define an is-a-typedef? function
9670typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9671case "$inclist" in
9672"") inclist="sys/types.h";;
9673esac;
9674eval "varval=\$$var";
9675case "$varval" in
9676"")
9677	$rm -f temp.c;
9678	for inc in $inclist; do
9679		echo "#include <$inc>" >>temp.c;
9680	done;
9681	echo "#ifdef $type" >> temp.c;
9682	echo "printf(\"We have $type\");" >> temp.c;
9683	echo "#endif" >> temp.c;
9684	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9685	if $contains $type temp.E >/dev/null 2>&1; then
9686		eval "$var=\$type";
9687	else
9688		eval "$var=\$def";
9689	fi;
9690	$rm -f temp.?;;
9691*) eval "$var=\$varval";;
9692esac'
9693
9694: define an is-a-typedef? function that prompts if the type is not available.
9695typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9696case "$inclist" in
9697"") inclist="sys/types.h";;
9698esac;
9699eval "varval=\$$var";
9700case "$varval" in
9701"")
9702	$rm -f temp.c;
9703	for inc in $inclist; do
9704		echo "#include <$inc>" >>temp.c;
9705	done;
9706	echo "#ifdef $type" >> temp.c;
9707	echo "printf(\"We have $type\");" >> temp.c;
9708	echo "#endif" >> temp.c;
9709	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9710	echo " " ;
9711	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9712	if $contains $type temp.E >/dev/null 2>&1; then
9713		echo "$type found." >&4;
9714		eval "$var=\$type";
9715	else
9716		echo "$type NOT found." >&4;
9717		dflt="$def";
9718		. ./myread ;
9719		eval "$var=\$ans";
9720	fi;
9721	$rm -f temp.?;;
9722*) eval "$var=\$varval";;
9723esac'
9724
9725: see what type lseek is declared as in the kernel
9726rp="What is the type used for lseek's offset on this system?"
9727set off_t lseektype long stdio.h sys/types.h
9728eval $typedef_ask
9729
9730echo " "
9731echo "Checking to see how big your file offsets are..." >&4
9732$cat >try.c <<EOCP
9733#include <sys/types.h>
9734#include <stdio.h>
9735int main()
9736{
9737    printf("%d\n", (int)sizeof($lseektype));
9738    return(0);
9739}
9740EOCP
9741set try
9742if eval $compile_ok; then
9743	lseeksize=`$run ./try`
9744	echo "Your file offsets are $lseeksize bytes long."
9745else
9746	dflt=$longsize
9747	echo " "
9748	echo "(I can't seem to compile the test program.  Guessing...)"
9749	rp="What is the size of your file offsets (in bytes)?"
9750	. ./myread
9751	lseeksize="$ans"
9752fi
9753$rm_try
9754
9755: see what type file positions are declared as in the library
9756rp="What is the type for file position used by fsetpos()?"
9757set fpos_t fpostype long stdio.h sys/types.h
9758eval $typedef_ask
9759
9760: Check size for Fpos_t
9761echo " "
9762case "$fpostype" in
9763*_t) zzz="$fpostype"	;;
9764*)   zzz="fpos_t"	;;
9765esac
9766echo "Checking the size of $zzz..." >&4
9767cat > try.c <<EOCP
9768#include <sys/types.h>
9769#include <stdio.h>
9770#$i_stdlib I_STDLIB
9771#ifdef I_STDLIB
9772#include <stdlib.h>
9773#endif
9774int main() {
9775    printf("%d\n", (int)sizeof($fpostype));
9776    exit(0);
9777}
9778EOCP
9779set try
9780if eval $compile_ok; then
9781	yyy=`$run ./try`
9782	case "$yyy" in
9783	'')	fpossize=4
9784		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9785		;;
9786	*)	fpossize=$yyy
9787		echo "Your $zzz is $fpossize bytes long."
9788		;;
9789	esac
9790else
9791	dflt="$longsize"
9792	echo " " >&4
9793	echo "(I can't compile the test program.  Guessing...)" >&4
9794	rp="What is the size of your file positions (in bytes)?"
9795	. ./myread
9796	fpossize="$ans"
9797fi
9798
9799: Check for large file support
9800# Backward compatibility (uselfs is deprecated).
9801case "$uselfs" in
9802"$define"|true|[yY]*)
9803	cat <<EOM >&4
9804
9805*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9806EOM
9807	uselargefiles="$define"
9808	;;
9809esac
9810
9811case "$lseeksize:$fpossize" in
98128:8) cat <<EOM
9813
9814You can have files larger than 2 gigabytes.
9815EOM
9816   val="$define" ;;
9817*)    case "$uselargefiles" in
9818   "$undef"|false|[nN]*) dflt='n' ;;
9819   *)	dflt='y' ;;
9820   esac
9821   cat <<EOM
9822
9823Perl can be built to understand large files (files larger than 2 gigabytes)
9824on some systems.  To do so, Configure can be run with -Duselargefiles.
9825
9826If this doesn't make any sense to you, just accept the default '$dflt'.
9827EOM
9828   rp='Try to understand large files, if available?'
9829   . ./myread
9830   case "$ans" in
9831   y|Y)	val="$define" ;;
9832   *)	val="$undef"  ;;
9833   esac
9834   ;;
9835esac
9836set uselargefiles
9837eval $setvar
9838: Look for a hint-file generated 'call-back-unit'.  If the
9839: user has specified that a large files perl is to be built,
9840: we may need to set or change some other defaults.
9841if $test -f uselargefiles.cbu; then
9842	echo "Your platform has some specific hints regarding large file builds, using them..."
9843	. ./uselargefiles.cbu
9844fi
9845case "$uselargefiles" in
9846"$define")
9847	if $test -f uselargefiles.cbu; then
9848		echo " "
9849		echo "Rechecking to see how big your file offsets are..." >&4
9850		$cat >try.c <<EOCP
9851#include <sys/types.h>
9852#include <stdio.h>
9853int main()
9854{
9855    printf("%d\n", (int)sizeof($lseektype));
9856    return(0);
9857}
9858EOCP
9859		set try
9860		if eval $compile_ok; then
9861			lseeksize=`$run ./try`
9862			$echo "Your file offsets are now $lseeksize bytes long."
9863		else
9864			dflt="$lseeksize"
9865			echo " "
9866			echo "(I can't seem to compile the test program.  Guessing...)"
9867			rp="What is the size of your file offsets (in bytes)?"
9868			. ./myread
9869			lseeksize="$ans"
9870		fi
9871		case "$fpostype" in
9872		*_t) zzz="$fpostype"	;;
9873		*)   zzz="fpos_t"	;;
9874		esac
9875		$echo $n "Rechecking the size of $zzz...$c" >&4
9876		$cat > try.c <<EOCP
9877#include <sys/types.h>
9878#include <stdio.h>
9879#$i_stdlib I_STDLIB
9880#ifdef I_STDLIB
9881#include <stdlib.h>
9882#endif
9883int main() {
9884    printf("%d\n", (int)sizeof($fpostype));
9885    return(0);
9886}
9887EOCP
9888		set try
9889		if eval $compile_ok; then
9890			yyy=`$run ./try`
9891			dflt="$lseeksize"
9892			case "$yyy" in
9893			'')	echo " "
9894				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9895				;;
9896			*)	fpossize=$yyy
9897				echo " $fpossize bytes." >&4
9898				;;
9899			esac
9900		else
9901			dflt="$fpossize"
9902			echo " "
9903			echo "(I can't compile the test program.  Guessing...)" >&4
9904			rp="What is the size of your file positions (in bytes)?"
9905			. ./myread
9906			fpossize="$ans"
9907		fi
9908		$rm_try
9909	fi
9910	;;
9911esac
9912
9913: Check if we want perlio
9914useperlio="$define"
9915
9916: Set the vendorbin variables
9917case "$vendorprefix" in
9918'')	d_vendorbin="$undef"
9919	vendorbin=''
9920	vendorbinexp=''
9921	;;
9922*)	d_vendorbin="$define"
9923	: determine where vendor-supplied executables go.
9924	case "$vendorbin" in
9925	'') dflt=$vendorprefix/bin ;;
9926	*)	dflt="$vendorbin" ;;
9927	esac
9928	fn=d~+
9929	rp='Pathname for the vendor-supplied executables directory?'
9930	. ./getfile
9931	vendorbin="$ans"
9932	vendorbinexp="$ansexp"
9933	;;
9934esac
9935prefixvar=vendorbin
9936. ./installprefix
9937
9938: Set the vendorhtml1dir variables
9939case "$vendorprefix" in
9940'')	vendorhtml1dir=''
9941	vendorhtml1direxp=''
9942	;;
9943*)	: determine where vendor-supplied html pages go.
9944	: There is no standard location, so try to copy the previously-selected
9945	: directory structure for the core html pages.
9946	: XXX Better default suggestions would be welcome.
9947	case "$vendorhtml1dir" in
9948	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9949	*)	dflt=$vendorhtml1dir ;;
9950	esac
9951	case "$dflt" in
9952	''|' ') dflt=none ;;
9953	esac
9954	fn=dn+~
9955	rp='Pathname for the vendor-supplied html pages?'
9956	. ./getfile
9957	vendorhtml1dir="$ans"
9958	vendorhtml1direxp="$ansexp"
9959	;;
9960esac
9961: Use ' ' for none so value is preserved next time through Configure
9962$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9963prefixvar=vendorhtml1dir
9964. ./installprefix
9965
9966: Set the vendorhtml3dir variables
9967case "$vendorprefix" in
9968'')	vendorhtml3dir=''
9969	vendorhtml3direxp=''
9970	;;
9971*)	: determine where vendor-supplied module html pages go.
9972	: There is no standard location, so try to copy the previously-selected
9973	: directory structure for the core html pages.
9974	: XXX Better default suggestions would be welcome.
9975	case "$vendorhtml3dir" in
9976	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9977	*)	dflt=$vendorhtml3dir ;;
9978	esac
9979	case "$dflt" in
9980	''|' ') dflt=none ;;
9981	esac
9982	fn=dn+~
9983	rp='Pathname for the vendor-supplied html pages?'
9984	. ./getfile
9985	vendorhtml3dir="$ans"
9986	vendorhtml3direxp="$ansexp"
9987	;;
9988esac
9989: Use ' ' for none so value is preserved next time through Configure
9990$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9991prefixvar=vendorhtml3dir
9992. ./installprefix
9993
9994: Set the vendorman1dir variables
9995case "$vendorprefix" in
9996'')	vendorman1dir=''
9997	vendorman1direxp=''
9998	;;
9999*)	: determine where vendor-supplied manual pages go.
10000	case "$vendorman1dir" in
10001	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10002	*)	dflt=$vendorman1dir ;;
10003	esac
10004	case "$dflt" in
10005	''|' ') dflt=none ;;
10006	esac
10007	fn=nd~+
10008	rp='Pathname for the vendor-supplied manual section 1 pages?'
10009	. ./getfile
10010	vendorman1dir="$ans"
10011	vendorman1direxp="$ansexp"
10012	;;
10013esac
10014: Use ' ' for none so value is preserved next time through Configure
10015$test X"$vendorman1dir" = "X" && vendorman1dir=' '
10016prefixvar=vendorman1dir
10017. ./installprefix
10018
10019: Set the vendorman3dir variables
10020case "$vendorprefix" in
10021'')	vendorman3dir=''
10022	vendorman3direxp=''
10023	;;
10024*)	: determine where vendor-supplied module manual pages go.
10025	case "$vendorman3dir" in
10026	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10027	*)	dflt=$vendorman3dir ;;
10028	esac
10029	case "$dflt" in
10030	''|' ') dflt=none ;;
10031	esac
10032	fn=nd~+
10033	rp='Pathname for the vendor-supplied manual section 3 pages?'
10034	. ./getfile
10035	vendorman3dir="$ans"
10036	vendorman3direxp="$ansexp"
10037	;;
10038esac
10039: Use ' ' for none so value is preserved next time through Configure
10040$test X"$vendorman3dir" = "X" && vendorman3dir=' '
10041prefixvar=vendorman3dir
10042. ./installprefix
10043
10044: Set the vendorscript variables
10045case "$vendorprefix" in
10046'')	d_vendorscript="$undef"
10047	vendorscript=''
10048	vendorscriptexp=''
10049	;;
10050*)	d_vendorscript="$define"
10051	: determine where vendor-supplied scripts go.
10052	case "$vendorscript" in
10053	'')	dflt=$vendorprefix/script
10054		$test -d $dflt || dflt=$vendorbin ;;
10055	*)  dflt="$vendorscript" ;;
10056	esac
10057	$cat <<EOM
10058
10059The installation process will create a directory for
10060vendor-supplied scripts.
10061
10062EOM
10063	fn=d~+
10064	rp='Pathname for the vendor-supplied scripts directory?'
10065	. ./getfile
10066	vendorscript="$ans"
10067	vendorscriptexp="$ansexp"
10068	;;
10069esac
10070prefixvar=vendorscript
10071. ./installprefix
10072
10073: see if qgcvt exists
10074set qgcvt d_qgcvt
10075eval $inlibc
10076
10077: Check what kind of doubles your system has
10078$echo "Checking the kind of doubles you have..." >&4
10079$cat >try.c <<EOP
10080#$i_stdlib I_STDLIB
10081#define DOUBLESIZE $doublesize
10082#ifdef I_STDLIB
10083#include <stdlib.h>
10084#endif
10085#include <stdio.h>
10086static const double d = -0.1;
10087int main() {
10088  unsigned const char* b = (unsigned const char*)(&d);
10089#if DOUBLESIZE == 4
10090  if (b[0] == 0xCD && b[3] == 0xBD) {
10091    /* IEEE 754 32-bit little-endian */
10092    printf("1\n");
10093    exit(0);
10094  }
10095  if (b[0] == 0xBD && b[3] == 0xCD) {
10096    /* IEEE 754 32-bit big-endian */
10097    printf("2\n");
10098    exit(0);
10099  }
10100  if (b[0] == 0xCC && b[3] == 0xCC) {
10101    /* VAX format F, 32-bit PDP-style mixed endian. */
10102    printf("9\n");
10103    exit(0);
10104  }
10105  if (b[0] == 0xC0 && b[3] == 0x9A) {
10106    /* IBM single 32-bit */
10107    printf("12\n");
10108    exit(0);
10109  }
10110#endif
10111#if DOUBLESIZE == 8
10112  if (b[0] == 0x9A && b[7] == 0xBF) {
10113    /* IEEE 754 64-bit little-endian */
10114    printf("3\n");
10115    exit(0);
10116  }
10117  if (b[0] == 0xBF && b[7] == 0x9A) {
10118    /* IEEE 754 64-bit big-endian */
10119    printf("4\n");
10120    exit(0);
10121  }
10122  if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10123   /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10124    * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10125    * 99 99 b9 bf 9a 99 99 99 */
10126    printf("7\n");
10127    exit(0);
10128  }
10129  if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10130   /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10131    * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10132    * 99 99 99 9a bf b9 99 99 */
10133    printf("8\n");
10134    exit(0);
10135  }
10136  if (b[0] == 0xCC && b[7] == 0xCC) {
10137   /* VAX format D, 64-bit PDP-style mixed endian. */
10138    printf("10\n");
10139    exit(0);
10140  }
10141  if (b[0] == 0xD9 && b[7] == 0x99) {
10142   /* VAX format G, 64-bit PDP-style mixed endian. */
10143    printf("11\n");
10144    exit(0);
10145  }
10146  if (b[0] == 0xC0 && b[7] == 0x9A) {
10147    /* IBM double 64-bit */
10148    printf("13\n");
10149    exit(0);
10150  }
10151  if (b[0] == 0xBF && b[7] == 0xCD) {
10152    /* CRAY single 64-bit */
10153    printf("14\n");
10154    exit(0);
10155  }
10156#endif
10157#if DOUBLESIZE == 16
10158  if (b[0] == 0x9A && b[15] == 0xBF) {
10159    /* IEEE 754 128-bit little-endian */
10160    printf("5\n");
10161    exit(0);
10162  }
10163  if (b[0] == 0xBF && b[15] == 0x9A) {
10164    /* IEEE 754 128-bit big-endian */
10165    printf("6\n");
10166    exit(0);
10167  }
10168#endif
10169  /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10170   * Whether those environments can still build Perl is debatable. */
10171  printf("-1\n"); /* unknown */
10172  exit(0);
10173}
10174EOP
10175set try
10176if eval $compile; then
10177    doublekind=`$run ./try`
10178else
10179    doublekind=-1
10180fi
10181case "$doublekind" in
101821) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
101832) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
101843) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
101854) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
101865) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
101876) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
101887) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
101898) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
101909) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
1019110) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
1019211) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
1019312) echo "You have IBM short 32-bit doubles." >&4 ;;
1019413) echo "You have IBM long 64-bit doubles." >&4 ;;
1019514) echo "You have Cray single 64-bit doubles." >&4 ;;
10196*) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10197esac
10198d_double_style_ieee=$undef
10199d_double_style_vax=$undef
10200d_double_style_ibm=$undef
10201d_double_style_cray=$undef
10202case "$doublekind" in
102031|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
102049|10|11) d_double_style_vax=$define ;;
1020512|13) d_double_style_ibm=$define ;;
1020614) d_double_style_cray=$define ;;
10207esac
10208case "$d_double_style_ieee" in
10209$define)
10210    d_double_has_inf=$define
10211    d_double_has_nan=$define
10212    d_double_has_negative_zero=$define
10213    d_double_has_subnormals=$define
10214    ;;
10215*)
10216    d_double_has_inf=$undef
10217    d_double_has_nan=$undef
10218    d_double_has_negative_zero=$undef
10219    d_double_has_subnormals=$undef
10220    ;;
10221esac
10222$rm_try
10223
10224: Check print/scan long double stuff
10225echo " "
10226
10227if $test X"$d_longdbl" = X"$define"; then
10228
10229echo "Checking how to print long doubles..." >&4
10230
10231if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10232	$cat >try.c <<'EOCP'
10233#include <sys/types.h>
10234#include <stdio.h>
10235int main() {
10236  double d = 123.456;
10237  printf("%.3f\n", d);
10238}
10239EOCP
10240	set try
10241	if eval $compile; then
10242		yyy=`$run ./try`
10243		case "$yyy" in
10244		123.456)
10245			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10246			sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10247			echo "We will use %f."
10248			;;
10249		esac
10250	fi
10251fi
10252
10253if $test X"$sPRIfldbl" = X; then
10254	$cat >try.c <<'EOCP'
10255#include <sys/types.h>
10256#include <stdio.h>
10257int main() {
10258  long double d = 123.456;
10259  printf("%.3Lf\n", d);
10260}
10261EOCP
10262	set try
10263	if eval $compile; then
10264		yyy=`$run ./try`
10265		case "$yyy" in
10266		123.456)
10267			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10268			sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10269			echo "We will use %Lf."
10270			;;
10271		esac
10272	fi
10273fi
10274
10275if $test X"$sPRIfldbl" = X; then
10276	$cat >try.c <<'EOCP'
10277#include <sys/types.h>
10278#include <stdio.h>
10279int main() {
10280  long double d = 123.456;
10281  printf("%.3llf\n", d);
10282}
10283EOCP
10284	set try
10285	if eval $compile; then
10286		yyy=`$run ./try`
10287		case "$yyy" in
10288		123.456)
10289			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10290			sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10291			echo "We will use %llf."
10292			;;
10293		esac
10294	fi
10295fi
10296
10297if $test X"$sPRIfldbl" = X; then
10298	$cat >try.c <<'EOCP'
10299#include <sys/types.h>
10300#include <stdio.h>
10301int main() {
10302  long double d = 123.456;
10303  printf("%.3lf\n", d);
10304}
10305EOCP
10306	set try
10307	if eval $compile; then
10308		yyy=`$run ./try`
10309		case "$yyy" in
10310		123.456)
10311			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10312			sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10313			echo "We will use %lf."
10314			;;
10315		esac
10316	fi
10317fi
10318
10319if $test X"$sPRIfldbl" = X; then
10320	echo "Cannot figure out how to print long doubles." >&4
10321else
10322	sSCNfldbl=$sPRIfldbl	# expect consistency
10323fi
10324
10325$rm_try
10326
10327fi # d_longdbl
10328
10329case "$sPRIfldbl" in
10330'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10331	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10332	d_SCNfldbl="$undef";
10333	;;
10334*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10335	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10336	d_SCNfldbl="$define";
10337	;;
10338esac
10339
10340: Before committing on uselongdouble, see whether that looks sane.
10341if $test "$uselongdouble" = "$define"; then
10342    message=""
10343    echo " "
10344    echo "Checking if your long double math functions work right..." >&4
10345    $cat > try.c <<EOF
10346#include <math.h>
10347#include <stdio.h>
10348int main() {
10349  printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10350}
10351EOF
10352    case "$osname:$gccversion" in
10353    aix:)	saveccflags="$ccflags"
10354		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10355    esac
10356    set try
10357    if eval $compile_ok; then
10358      yyy=`$run ./try`
10359    fi
10360    case "$yyy" in
10361    3) echo "Your long double math functions are working correctly." >&4 ;;
10362    *) echo "Your long double math functions are broken, not using long doubles." >&4
10363       uselongdouble=$undef
10364       ;;
10365    esac
10366    $rm_try
10367    case "$osname:$gccversion" in
10368    aix:)	ccflags="$saveccflags" ;; # restore
10369    esac
10370fi
10371
10372: Check how to convert floats to strings.
10373
10374if test "X$d_Gconvert" = X; then
10375
10376echo " "
10377echo "Checking for an efficient way to convert floats to strings."
10378echo " " > try.c
10379case "$uselongdouble" in
10380"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10381esac
10382case "$d_longdbl" in
10383"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10384esac
10385case "$d_PRIgldbl" in
10386"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10387esac
10388$cat >>try.c <<EOP
10389#ifdef TRY_gconvert
10390#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10391const char *myname = "gconvert";
10392#endif
10393#ifdef TRY_gcvt
10394#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10395const char *myname = "gcvt";
10396#endif
10397#ifdef TRY_qgcvt
10398#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10399const char *myname = "qgcvt";
10400#define DOUBLETYPE long double
10401#endif
10402#ifdef TRY_sprintf
10403#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10404#ifdef HAS_PRIgldbl
10405#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10406#else
10407#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10408#endif
10409#else
10410#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10411#endif
10412const char *myname = "sprintf";
10413#endif
10414
10415#ifndef DOUBLETYPE
10416#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10417#define DOUBLETYPE long double
10418#else
10419#define DOUBLETYPE double
10420#endif
10421#endif
10422
10423#include <stdio.h>
10424
10425#$i_stdlib I_STDLIB
10426#ifdef I_STDLIB
10427#include <stdlib.h>
10428#endif
10429#include <string.h>
10430
10431void checkit(const char *expect, char *got)
10432{
10433    if (strcmp(expect, got)) {
10434		printf("%s oddity:  Expected %s, got %s\n",
10435			myname, expect, got);
10436		exit(1);
10437	}
10438}
10439
10440int main()
10441{
10442	char buf[64];
10443	buf[63] = '\0';
10444
10445	/* This must be 1st test on (which?) platform */
10446	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10447	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10448	checkit("0.1", buf);
10449
10450	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10451	checkit("0.01", buf);
10452
10453	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10454	checkit("0.001", buf);
10455
10456	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10457	checkit("0.0001", buf);
10458
10459	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10460	if (strlen(buf) > 5)
10461	    checkit("9e-005", buf); /* for Microsoft ?? */
10462	else
10463	    checkit("9e-05", buf);
10464
10465	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10466	checkit("1", buf);
10467
10468	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10469	checkit("1.1", buf);
10470
10471	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10472	checkit("1.01", buf);
10473
10474	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10475	checkit("1.001", buf);
10476
10477	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10478	checkit("1.0001", buf);
10479
10480	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10481	checkit("1.00001", buf);
10482
10483	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10484	checkit("1.000001", buf);
10485
10486	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10487	checkit("0", buf);
10488
10489	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10490	checkit("-1", buf);
10491
10492	/* Some Linux gcvt's give 1.e+5 here. */
10493	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10494	checkit("100000", buf);
10495
10496	/* Some Linux gcvt's give -1.e+5 here. */
10497	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10498	checkit("-100000", buf);
10499
10500	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10501	checkit("123.456", buf);
10502
10503	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10504	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10505	/* 34 should be enough to scare even long double
10506	 * places into using the e notation. */
10507	if (strlen(buf) > 5)
10508	    checkit("1e+034", buf); /* for Microsoft */
10509	else
10510	    checkit("1e+34", buf);
10511
10512	/* For Perl, if you add additional tests here, also add them to
10513	 * t/base/num.t for benefit of platforms not using Configure or
10514	 * overriding d_Gconvert */
10515
10516	exit(0);
10517}
10518EOP
10519: first add preferred functions to our list
10520xxx_list=""
10521for xxx_convert in $gconvert_preference; do
10522    case $xxx_convert in
10523    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10524    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10525    esac
10526done
10527: then add any others
10528for xxx_convert in gconvert gcvt sprintf; do
10529    case "$xxx_list" in
10530    *$xxx_convert*) ;;
10531    *) xxx_list="$xxx_list $xxx_convert" ;;
10532    esac
10533done
10534
10535case "$d_longdbl$uselongdouble" in
10536"$define$define")
10537    : again, add preferred functions to our list first
10538    xxx_ld_list=""
10539    for xxx_convert in $gconvert_ld_preference; do
10540        case $xxx_convert in
10541        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10542        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10543        esac
10544    done
10545    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10546    for xxx_convert in qgcvt sprintf $xxx_list; do
10547        case "$xxx_ld_list" in
10548        $xxx_convert*|*" $xxx_convert"*) ;;
10549        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10550        esac
10551    done
10552    : if sprintf cannot do long doubles, move it to the end
10553    if test "$d_PRIgldbl" != "$define"; then
10554        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10555    fi
10556    : if no qgcvt, remove it
10557    if test "$d_qgcvt" != "$define"; then
10558        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10559    fi
10560    : use the ld_list
10561    xxx_list="$xxx_ld_list"
10562    ;;
10563esac
10564
10565for xxx_convert in $xxx_list; do
10566	echo "Trying $xxx_convert..."
10567	$rm -f try try$_o core
10568	set try -DTRY_$xxx_convert
10569	if eval $compile; then
10570		echo "$xxx_convert() found." >&4
10571		if $run ./try; then
10572			echo "I'll use $xxx_convert to convert floats into a string." >&4
10573			break;
10574		else
10575			echo "...But $xxx_convert didn't work as I expected."
10576			xxx_convert=''
10577		fi
10578	else
10579		echo "$xxx_convert NOT found." >&4
10580		xxx_convert=''
10581	fi
10582done
10583
10584if test X$xxx_convert = X; then
10585    echo "*** WHOA THERE!!! ***" >&4
10586    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10587    xxx_convert=sprintf
10588fi
10589
10590case "$xxx_convert" in
10591gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10592gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10593qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10594*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10595   "$define$define$define")
10596      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10597   "$define$define$undef")
10598      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10599   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10600   esac
10601   ;;
10602esac
10603
10604fi
10605$rm_try
10606
10607: see if _fwalk exists
10608set fwalk d__fwalk
10609eval $inlibc
10610
10611: see if accept4 exists
10612set accept4 d_accept4
10613eval $inlibc
10614
10615: Initialize h_fcntl
10616h_fcntl=false
10617
10618: Initialize h_sysfile
10619h_sysfile=false
10620
10621: access call always available on UNIX
10622set access d_access
10623eval $inlibc
10624
10625: locate the flags for 'access()'
10626case "$d_access" in
10627"$define")
10628	echo " "
10629	$cat >access.c <<EOCP
10630#include <sys/types.h>
10631#ifdef I_FCNTL
10632#include <fcntl.h>
10633#endif
10634#ifdef I_SYS_FILE
10635#include <sys/file.h>
10636#endif
10637#ifdef I_UNISTD
10638#include <unistd.h>
10639#endif
10640#$i_stdlib I_STDLIB
10641#ifdef I_STDLIB
10642#include <stdlib.h>
10643#endif
10644int main() {
10645	exit(R_OK);
10646}
10647EOCP
10648	: check sys/file.h first, no particular reason here
10649	if $test `./findhdr sys/file.h` && \
10650		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10651		h_sysfile=true;
10652		echo "<sys/file.h> defines the *_OK access constants." >&4
10653	elif $test `./findhdr fcntl.h` && \
10654		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10655		h_fcntl=true;
10656		echo "<fcntl.h> defines the *_OK access constants." >&4
10657	elif $test `./findhdr unistd.h` && \
10658		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10659		echo "<unistd.h> defines the *_OK access constants." >&4
10660	else
10661		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10662	fi
10663	;;
10664esac
10665$rm -f access*
10666
10667: see if accessx exists
10668set accessx d_accessx
10669eval $inlibc
10670
10671: see if acosh exists
10672set acosh d_acosh
10673eval $inlibc
10674
10675: see if aintl exists
10676set aintl d_aintl
10677eval $inlibc
10678
10679: see if alarm exists
10680set alarm d_alarm
10681eval $inlibc
10682
10683: see if 64bit time functions exists
10684
10685set ctime64 d_ctime64
10686eval $inlibc
10687
10688set localtime64 d_localtime64
10689eval $inlibc
10690
10691set gmtime64 d_gmtime64
10692eval $inlibc
10693
10694set mktime64 d_mktime64
10695eval $inlibc
10696
10697set difftime64 d_difftime64
10698eval $inlibc
10699
10700set asctime64 d_asctime64
10701eval $inlibc
10702
10703: see if POSIX threads are available
10704set pthread.h i_pthread
10705eval $inhdr
10706
10707: define a function to check prototypes
10708$cat > protochk <<EOSH
10709$startsh
10710cc="$cc"
10711optimize="$optimize"
10712ccflags="$ccflags"
10713define="$define"
10714rm_try="$rm_try"
10715usethreads=$usethreads
10716i_pthread=$i_pthread
10717pthread_h_first=$pthread_h_first
10718EOSH
10719
10720$cat >> protochk <<'EOSH'
10721
10722$rm_try
10723foo="$1"
10724shift
10725while test $# -ge 2; do
10726	case "$1" in
10727		$define) echo "#include <$2>" >> try.c ;;
10728		literal) echo "$2" >> try.c ;;
10729	esac
10730    # Extra magic for the benefit of systems that need pthread.h
10731    # to be included early to correctly detect threadsafe functions.
10732    # Such functions must guarantee themselves, though, that the usethreads
10733    # and i_pthread have been defined, before calling protochk.
10734    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10735	echo "#include <pthread.h>" >> try.c
10736	pthread_h_done=yes
10737    fi
10738    shift 2
10739done
10740cat >> try.c <<'EOCP'
10741#define	_(args) args
10742EOCP
10743echo "$foo" >> try.c
10744echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10745$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10746status=$?
10747$rm_try
10748exit $status
10749EOSH
10750chmod +x protochk
10751$eunicefix protochk
10752
10753: Define hasproto macro for Configure internal use
10754hasproto='varname=$1; func=$2; shift; shift;
10755while $test $# -ge 2; do
10756	case "$1" in
10757	$define) echo "#include <$2>";;
10758	literal) echo "$2" ;;
10759	esac ;
10760    shift 2;
10761done > try.c;
10762$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10763if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10764	echo "$func() prototype found.";
10765	val="$define";
10766else
10767	echo "$func() prototype NOT found.";
10768	val="$undef";
10769fi;
10770set $varname;
10771eval $setvar;
10772$rm_try tryout.c'
10773
10774: see if sys/types.h has to be included
10775set sys/types.h i_systypes
10776eval $inhdr
10777
10778: see if sys/select.h has to be included
10779set sys/select.h i_sysselct
10780eval $inhdr
10781
10782: Define hasfield macro for Configure internal use
10783hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10784while $test $# -ge 2; do
10785	case "$1" in
10786	$define) echo "#include <$2>";;
10787	esac ;
10788    shift 2;
10789done > try.c;
10790echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10791set try;
10792if eval $compile; then
10793	val="$define";
10794else
10795	val="$undef";
10796fi;
10797set $varname;
10798eval $setvar;
10799$rm_try'
10800
10801: see if we should include sys/time.h
10802echo " "
10803i_time='define'
10804if test "X$timeincl" = X; then
10805	echo "Testing to see if we should include <sys/time.h>." >&4
10806	$echo $n "I'm now running the test program...$c"
10807	$cat >try.c <<EOCP
10808#include <sys/types.h>
10809#include <time.h>
10810#ifdef I_SYSTIME
10811#ifdef SYSTIMEKERNEL
10812#define KERNEL
10813#endif
10814#include <sys/time.h>
10815#endif
10816#ifdef I_SYSSELECT
10817#include <sys/select.h>
10818#endif
10819#$i_stdlib I_STDLIB
10820#ifdef I_STDLIB
10821#include <stdlib.h>
10822#endif
10823int main()
10824{
10825	struct tm foo;
10826#ifdef S_TIMEVAL
10827	struct timeval bar;
10828#endif
10829#ifdef S_TIMEZONE
10830	struct timezone tzp;
10831#endif
10832	if (foo.tm_sec == foo.tm_sec)
10833		exit(0);
10834#ifdef S_TIMEVAL
10835	if (bar.tv_sec == bar.tv_sec)
10836		exit(0);
10837#endif
10838	exit(1);
10839}
10840EOCP
10841	flags=''
10842	for s_timezone in '-DS_TIMEZONE' ''; do
10843	sysselect=''
10844	for s_timeval in '-DS_TIMEVAL' ''; do
10845	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10846	for i_systime in '-DI_SYSTIME' ''; do
10847		case "$flags" in
10848		'') $echo $n ".$c"
10849			set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10850			if eval $compile; then
10851				set X $i_systime $i_systimek $sysselect $s_timeval
10852				shift
10853				flags="$*"
10854				echo " "
10855				$echo $n "Succeeded with $flags$c"
10856			fi
10857			;;
10858		esac
10859	done
10860	done
10861	done
10862	done
10863	timeincl=''
10864	echo " "
10865	case "$flags" in
10866	*SYSTIMEKERNEL*) i_systimek="$define"
10867		timeincl=`./findhdr sys/time.h`
10868		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10869	*) i_systimek="$undef";;
10870	esac
10871	case "$flags" in
10872	*I_SYSTIME*) i_systime="$define"
10873		timeincl=`./findhdr sys/time.h`" $timeincl"
10874		echo "We'll include <sys/time.h>." >&4;;
10875	*) i_systime="$undef";;
10876	esac
10877	$rm_try
10878fi
10879: see if struct tm knows about tm_zone
10880case "$i_systime$i_time" in
10881*$define*)
10882        echo " "
10883        echo "Checking to see if your struct tm has tm_zone field..." >&4
10884        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10885        eval $hasfield
10886        ;;
10887*)      val="$undef"
10888        set d_tm_tm_zone
10889        eval $setvar
10890        ;;
10891esac
10892case "$d_tm_tm_zone" in
10893"$define")      echo "Yes, it does."   ;;
10894*)              echo "No, it doesn't." ;;
10895esac
10896: see if struct tm knows about tm_gmtoff
10897case "$i_systime$i_time" in
10898*$define*)
10899        echo " "
10900        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10901        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10902        eval $hasfield
10903        ;;
10904*)      val="$undef"
10905        set d_tm_tm_gmtoff
10906        eval $setvar
10907        ;;
10908esac
10909case "$d_tm_tm_gmtoff" in
10910"$define")      echo "Yes, it does."   ;;
10911*)              echo "No, it doesn't." ;;
10912esac
10913
10914: see if asctime_r exists
10915set asctime_r d_asctime_r
10916eval $inlibc
10917case "$d_asctime_r" in
10918"$define")
10919	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10920	case "$d_asctime_r_proto:$usethreads" in
10921	":define")	d_asctime_r_proto=define
10922		set d_asctime_r_proto asctime_r $hdrs
10923		eval $hasproto ;;
10924	*)	;;
10925	esac
10926	case "$d_asctime_r_proto" in
10927	define)
10928	case "$asctime_r_proto" in
10929	''|0) try='char* asctime_r(const struct tm*, char*);'
10930	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10931	esac
10932	case "$asctime_r_proto" in
10933	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10934	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10935	esac
10936	case "$asctime_r_proto" in
10937	''|0) try='int asctime_r(const struct tm*, char*);'
10938	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10939	esac
10940	case "$asctime_r_proto" in
10941	''|0) try='int asctime_r(const struct tm*, char*, int);'
10942	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10943	esac
10944	case "$asctime_r_proto" in
10945	''|0)	d_asctime_r=undef
10946		asctime_r_proto=0
10947		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10948	* )	case "$asctime_r_proto" in
10949		REENTRANT_PROTO*) ;;
10950		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10951		esac
10952		echo "Prototype: $try" ;;
10953	esac
10954	;;
10955	*)	case "$usethreads" in
10956		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10957		esac
10958		d_asctime_r=undef
10959		asctime_r_proto=0
10960		;;
10961	esac
10962	;;
10963*)	asctime_r_proto=0
10964	;;
10965esac
10966
10967: see if asinh exists
10968set asinh d_asinh
10969eval $inlibc
10970
10971: see if atanh exists
10972set atanh d_atanh
10973eval $inlibc
10974
10975: see if atolf exists
10976set atolf d_atolf
10977eval $inlibc
10978
10979: see if atoll exists
10980set atoll d_atoll
10981eval $inlibc
10982
10983: Look for GCC-style attribute format
10984case "$d_attribute_format" in
10985'')
10986echo " "
10987echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10988$cat >attrib.c <<'EOCP'
10989#include <stdio.h>
10990void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10991EOCP
10992if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10993	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10994		echo "Your C compiler doesn't support __attribute__((format))."
10995		val="$undef"
10996	else
10997		echo "Your C compiler supports __attribute__((format))."
10998		val="$define"
10999	fi
11000else
11001	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11002	val="$undef"
11003fi
11004;;
11005*) val="$d_attribute_format" ;;
11006esac
11007set d_attribute_format
11008eval $setvar
11009$rm -f attrib*
11010
11011: Look for GCC-style attribute format with null format allowed
11012case "$d_printf_format_null" in
11013'') case "$d_attribute_format" in
11014    $define)
11015	echo " "
11016	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11017$cat >attrib.c <<EOCP
11018#include <stdio.h>
11019#$i_stdlib I_STDLIB
11020#ifdef I_STDLIB
11021#include <stdlib.h>
11022#endif
11023#$i_inttypes I_INTTYPES
11024#ifdef I_INTTYPES
11025#include <inttypes.h>
11026#endif
11027#ifndef INTPTR_MAX
11028#define intptr_t int
11029#endif
11030int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11031int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11032int main () { exit(null_printf(NULL)); }
11033EOCP
11034	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11035	    : run the executable in case it produces a run-time warning
11036	    if $run ./attrib >>attrib.out 2>&1; then
11037		if $contains 'warning' attrib.out >/dev/null 2>&1; then
11038		    echo "Your C compiler doesn't allow __printf__ format to be null."
11039		    val="$undef"
11040		else
11041		    echo "Your C compiler allows __printf__ format to be null."
11042		    val="$define"
11043		fi
11044	    else
11045	    echo "Your C compiler executable failed with __printf__ format null."
11046	    val="$undef"
11047	fi
11048    else
11049	echo "Your C compiler fails with __printf__ format null."
11050	val="$undef"
11051    fi
11052    ;;
11053    *)  val="$undef" ;;
11054    esac
11055;;
11056*)  val="$d_printf_format_null" ;;
11057esac
11058set d_printf_format_null
11059eval $setvar
11060$rm -f attrib*
11061
11062: Look for GCC-style attribute malloc
11063case "$d_attribute_malloc" in
11064'')
11065echo " "
11066echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11067$cat >attrib.c <<'EOCP'
11068#include <stdio.h>
11069char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11070EOCP
11071if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11072	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11073		echo "Your C compiler doesn't support __attribute__((malloc))."
11074		val="$undef"
11075	else
11076		echo "Your C compiler supports __attribute__((malloc))."
11077		val="$define"
11078	fi
11079else
11080	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11081	val="$undef"
11082fi
11083;;
11084*) val="$d_attribute_malloc" ;;
11085esac
11086set d_attribute_malloc
11087eval $setvar
11088$rm -f attrib*
11089
11090: Look for GCC-style attribute nonnull
11091case "$d_attribute_nonnull" in
11092'')
11093echo " "
11094echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11095$cat >attrib.c <<'EOCP'
11096#include <stdio.h>
11097void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11098EOCP
11099if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11100	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11101		echo "Your C compiler doesn't support __attribute__((nonnull))."
11102		val="$undef"
11103	else
11104		echo "Your C compiler supports __attribute__((nonnull))."
11105		val="$define"
11106	fi
11107else
11108	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11109	val="$undef"
11110fi
11111;;
11112*) val="$d_attribute_nonnull" ;;
11113esac
11114set d_attribute_nonnull
11115eval $setvar
11116$rm -f attrib*
11117
11118: Look for GCC-style attribute noreturn
11119case "$d_attribute_noreturn" in
11120'')
11121echo " "
11122echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11123$cat >attrib.c <<'EOCP'
11124#include <stdio.h>
11125void fall_over_dead( void ) __attribute__((noreturn));
11126EOCP
11127if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11128	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11129		echo "Your C compiler doesn't support __attribute__((noreturn))."
11130		val="$undef"
11131	else
11132		echo "Your C compiler supports __attribute__((noreturn))."
11133		val="$define"
11134	fi
11135else
11136	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11137	val="$undef"
11138fi
11139;;
11140*) val="$d_attribute_noreturn" ;;
11141esac
11142set d_attribute_noreturn
11143eval $setvar
11144$rm -f attrib*
11145
11146: Look for GCC-style attribute pure
11147case "$d_attribute_pure" in
11148'')
11149echo " "
11150echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11151$cat >attrib.c <<'EOCP'
11152#include <stdio.h>
11153int square( int n ) __attribute__((pure));
11154EOCP
11155if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11156	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11157		echo "Your C compiler doesn't support __attribute__((pure))."
11158		val="$undef"
11159	else
11160		echo "Your C compiler supports __attribute__((pure))."
11161		val="$define"
11162	fi
11163else
11164	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11165	val="$undef"
11166fi
11167;;
11168*) val="$d_attribute_pure" ;;
11169esac
11170set d_attribute_pure
11171eval $setvar
11172$rm -f attrib*
11173
11174: Look for GCC-style attribute unused
11175case "$d_attribute_unused" in
11176'')
11177echo " "
11178echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11179$cat >attrib.c <<'EOCP'
11180#include <stdio.h>
11181int do_something( int dummy __attribute__((unused)), int n );
11182EOCP
11183if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11184	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11185		echo "Your C compiler doesn't support __attribute__((unused))."
11186		val="$undef"
11187	else
11188		echo "Your C compiler supports __attribute__((unused))."
11189		val="$define"
11190	fi
11191else
11192	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11193	val="$undef"
11194fi
11195;;
11196*) val="$d_attribute_unused" ;;
11197esac
11198set d_attribute_unused
11199eval $setvar
11200$rm -f attrib*
11201
11202: Look for GCC-style attribute deprecated
11203case "$d_attribute_deprecated" in
11204'')
11205echo " "
11206echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11207$cat >attrib.c <<'EOCP'
11208#include <stdio.h>
11209int I_am_deprecated(void) __attribute__((deprecated));
11210EOCP
11211if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11212	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11213		echo "Your C compiler doesn't support __attribute__((deprecated))."
11214		val="$undef"
11215	else
11216		echo "Your C compiler supports __attribute__((deprecated))."
11217		val="$define"
11218	fi
11219else
11220	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11221	val="$undef"
11222fi
11223;;
11224*) val="$d_attribute_deprecated" ;;
11225esac
11226set d_attribute_deprecated
11227eval $setvar
11228$rm -f attrib*
11229
11230: Look for GCC-style attribute warn_unused_result
11231case "$d_attribute_warn_unused_result" in
11232'')
11233echo " "
11234echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11235$cat >attrib.c <<'EOCP'
11236#include <stdio.h>
11237int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11238EOCP
11239if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11240	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11241		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11242		val="$undef"
11243	else
11244		echo "Your C compiler supports __attribute__((warn_unused_result))."
11245		val="$define"
11246	fi
11247else
11248	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11249	val="$undef"
11250fi
11251;;
11252*) val="$d_attribute_warn_unused_result" ;;
11253esac
11254set d_attribute_warn_unused_result
11255eval $setvar
11256$rm -f attrib*
11257
11258: Look for GCC-style attribute always_inline
11259case "$d_attribute_always_inline" in
11260'')
11261echo " "
11262echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11263$cat >attrib.c <<'EOCP'
11264#include <stdio.h>
11265static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11266EOCP
11267if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11268	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11269		echo "Your C compiler doesn't support __attribute__((always_inline))."
11270		val="$undef"
11271	else
11272		echo "Your C compiler supports __attribute__((always_inline))."
11273		val="$define"
11274	fi
11275else
11276	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11277	val="$undef"
11278fi
11279;;
11280*) val="$d_attribute_always_inline" ;;
11281esac
11282set d_attribute_always_inline
11283eval $setvar
11284$rm -f attrib*
11285
11286: see if getpgrp exists
11287set getpgrp d_getpgrp
11288eval $inlibc
11289
11290case "$d_getpgrp" in
11291"$define")
11292	echo " "
11293	echo "Checking to see which flavor of getpgrp is in use..."
11294	$cat >try.c <<EOP
11295#include <stdio.h>
11296#$i_unistd I_UNISTD
11297#include <sys/types.h>
11298#ifdef I_UNISTD
11299#  include <unistd.h>
11300#endif
11301#$i_stdlib I_STDLIB
11302#ifdef I_STDLIB
11303#include <stdlib.h>
11304#endif
11305int main()
11306{
11307	if (getuid() == 0) {
11308		printf("(I see you are running Configure as super-user...)\n");
11309		setuid(1);
11310	}
11311#ifdef TRY_BSD_PGRP
11312	if (getpgrp(1) == 0)
11313		exit(0);
11314#else
11315	if (getpgrp() > 0)
11316		exit(0);
11317#endif
11318	exit(1);
11319}
11320EOP
11321	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11322		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11323		val="$define"
11324	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11325		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11326		val="$undef"
11327	else
11328		echo "I can't seem to compile and run the test program."
11329		if ./usg; then
11330			xxx="a USG one, i.e. you use getpgrp()."
11331		else
11332			# SVR4 systems can appear rather BSD-ish.
11333			case "$i_unistd" in
11334			$undef)
11335				xxx="a BSD one, i.e. you use getpgrp(pid)."
11336				val="$define"
11337				;;
11338			$define)
11339				xxx="probably a USG one, i.e. you use getpgrp()."
11340				val="$undef"
11341				;;
11342			esac
11343		fi
11344		echo "Assuming your getpgrp is $xxx" >&4
11345	fi
11346	;;
11347*) val="$undef";;
11348esac
11349set d_bsdgetpgrp
11350eval $setvar
11351$rm_try
11352
11353: see if setpgrp exists
11354set setpgrp d_setpgrp
11355eval $inlibc
11356
11357case "$d_setpgrp" in
11358"$define")
11359	echo " "
11360	echo "Checking to see which flavor of setpgrp is in use..."
11361	$cat >try.c <<EOP
11362#include <stdio.h>
11363#$i_unistd I_UNISTD
11364#include <sys/types.h>
11365#ifdef I_UNISTD
11366#  include <unistd.h>
11367#endif
11368#$i_stdlib I_STDLIB
11369#ifdef I_STDLIB
11370#include <stdlib.h>
11371#endif
11372int main()
11373{
11374	if (getuid() == 0) {
11375		printf("(I see you are running Configure as super-user...)\n");
11376		setuid(1);
11377	}
11378#ifdef TRY_BSD_PGRP
11379	if (-1 == setpgrp(1, 1))
11380		exit(0);
11381#else
11382	if (setpgrp() != -1)
11383		exit(0);
11384#endif
11385	exit(1);
11386}
11387EOP
11388	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11389		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11390		val="$define"
11391	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11392		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11393		val="$undef"
11394	else
11395		echo "(I can't seem to compile and run the test program.)"
11396		if ./usg; then
11397			xxx="a USG one, i.e. you use setpgrp()."
11398		else
11399			# SVR4 systems can appear rather BSD-ish.
11400			case "$i_unistd" in
11401			$undef)
11402				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11403				val="$define"
11404				;;
11405			$define)
11406				xxx="probably a USG one, i.e. you use setpgrp()."
11407				val="$undef"
11408				;;
11409			esac
11410		fi
11411		echo "Assuming your setpgrp is $xxx" >&4
11412	fi
11413	;;
11414*) val="$undef";;
11415esac
11416set d_bsdsetpgrp
11417eval $setvar
11418$rm_try
11419
11420: Look for GCC-style __builtin_add_overflow
11421case "$d_builtin_add_overflow" in
11422'')
11423    echo " "
11424    echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11425    $cat >try.c <<'EOCP'
11426int main(void) {
11427    const unsigned int uint_max = ~0u;
11428    int target_int = 0;
11429    if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11430        return 1;
11431    }
11432    if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11433        return 1;
11434    }
11435    if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11436        return 1;
11437    }
11438    return 0;
11439}
11440EOCP
11441    set try
11442    if eval $compile && $run ./try; then
11443        echo "Your C compiler supports __builtin_add_overflow."
11444        val="$define"
11445    else
11446        echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11447        val="$undef"
11448    fi
11449    ;;
11450*) val="$d_builtin_add_overflow" ;;
11451esac
11452
11453set d_builtin_add_overflow
11454eval $setvar
11455$rm_try
11456
11457: Look for GCC-style __builtin_sub_overflow
11458case "$d_builtin_sub_overflow" in
11459'')
11460    echo " "
11461    echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11462    $cat >try.c <<'EOCP'
11463int main(void) {
11464    const unsigned int uint_max = ~0u;
11465    int target_int = 0;
11466    if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11467        return 1;
11468    }
11469    if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11470        return 1;
11471    }
11472    if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11473        return 1;
11474    }
11475    return 0;
11476}
11477EOCP
11478    set try
11479    if eval $compile && $run ./try; then
11480        echo "Your C compiler supports __builtin_sub_overflow."
11481        val="$define"
11482    else
11483        echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11484        val="$undef"
11485    fi
11486    ;;
11487*) val="$d_builtin_sub_overflow" ;;
11488esac
11489
11490set d_builtin_sub_overflow
11491eval $setvar
11492$rm_try
11493
11494: Look for GCC-style __builtin_mul_overflow
11495case "$d_builtin_mul_overflow" in
11496'')
11497    echo " "
11498    echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11499    $cat >try.c <<'EOCP'
11500int main(void) {
11501    const unsigned int uint_max = ~0u;
11502    int target_int = 0;
11503    if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11504        return 1;
11505    }
11506    if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11507        return 1;
11508    }
11509    if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11510        return 1;
11511    }
11512    return 0;
11513}
11514EOCP
11515    set try
11516    if eval $compile && $run ./try; then
11517        echo "Your C compiler supports __builtin_mul_overflow."
11518        val="$define"
11519    else
11520        echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11521        val="$undef"
11522    fi
11523    ;;
11524*) val="$d_builtin_mul_overflow" ;;
11525esac
11526
11527set d_builtin_mul_overflow
11528eval $setvar
11529$rm_try
11530
11531: Look for GCC-style __builtin_choose_expr
11532case "$d_builtin_choose_expr" in
11533'')
11534    echo " "
11535    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11536    $cat >try.c <<'EOCP'
11537#include <assert.h>
11538#include <stdlib.h>
11539#include <stdio.h>
11540
11541#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11542
11543int main(void) {
11544    assert( SYRINX(1) == 2112 );
11545    assert( SYRINX(1) != 5150 );
11546    assert( SYRINX(0) == 5150 );
11547    assert( SYRINX(0) != 2112 );
11548    puts( "All good!" );
11549    exit(0);
11550}
11551
11552EOCP
11553    set try
11554    if eval $compile && $run ./try; then
11555	echo "Your C compiler supports __builtin_choose_expr."
11556	val="$define"
11557    else
11558	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11559	val="$undef"
11560    fi
11561;;
11562*) val="$d_builtin_choose_expr" ;;
11563esac
11564
11565set d_builtin_choose_expr
11566eval $setvar
11567$rm_try
11568
11569: Look for GCC-style __builtin_expect
11570case "$d_builtin_expect" in
11571'')
11572    echo " "
11573    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11574    $cat >try.c <<'EOCP'
11575int main(void) {
11576    int n = 50;
11577    if ( __builtin_expect(n, 0) ) n = 1;
11578    /* Remember shell exit code truth is 0, C truth is non-zero */
11579    return !(n == 1);
11580}
11581EOCP
11582    set try
11583    if eval $compile && $run ./try; then
11584	echo "Your C compiler supports __builtin_expect."
11585	val="$define"
11586    else
11587	echo "Your C compiler doesn't seem to understand __builtin_expect."
11588	val="$undef"
11589    fi
11590    ;;
11591*) val="$d_builtin_expect" ;;
11592esac
11593
11594set d_builtin_expect
11595eval $setvar
11596$rm_try
11597
11598: see if the Compiler supports C99 variadic macros
11599echo "Checking for C99 variadic macros." >&4
11600$cat >try.c <<EOCP
11601#include <stdio.h>
11602#include <stdarg.h>
11603
11604#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11605
11606int main() {
11607  char buf[20];
11608  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11609  puts(buf);
11610  return 0;
11611}
11612EOCP
11613set try
11614if eval $compile && $run ./try 2>&1 >/dev/null; then
11615    case "`$run ./try`" in
11616	"123 456 789")
11617	echo "You have C99 variadic macros." >&4
11618	d_c99_variadic_macros="$define"
11619	;;
11620	*)
11621	echo "You don't have functional C99 variadic macros." >&4
11622	d_c99_variadic_macros="$undef"
11623	;;
11624    esac
11625else
11626    echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11627    d_c99_variadic_macros="$undef"
11628fi
11629$rm_try
11630
11631: see if signal is declared as pointer to function returning int or void
11632echo " "
11633xxx=`./findhdr signal.h`
11634$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11635if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11636	echo "You have int (*signal())() instead of void." >&4
11637	val="$undef"
11638elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11639	echo "You have void (*signal())()." >&4
11640	val="$define"
11641elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11642	echo "You have int (*signal())() instead of void." >&4
11643	val="$undef"
11644elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11645	echo "You have void (*signal())()." >&4
11646	val="$define"
11647else
11648	case "$d_voidsig" in
11649	'')
11650	echo "I can't determine whether signal handler returns void or int..." >&4
11651		dflt=void
11652		rp="What type does your signal handler return?"
11653		. ./myread
11654		case "$ans" in
11655		v*) val="$define";;
11656		*) val="$undef";;
11657		esac;;
11658	"$define")
11659		echo "As you already told me, signal handler returns void." >&4
11660		val="$define"
11661		;;
11662	*)	echo "As you already told me, signal handler returns int." >&4
11663		val="$undef"
11664		;;
11665	esac
11666fi
11667set d_voidsig
11668eval $setvar
11669case "$d_voidsig" in
11670"$define") signal_t="void";;
11671*) signal_t="int";;
11672esac
11673$rm -f $$.tmp
11674
11675: check for ability to cast large floats to 32-bit ints.
11676echo " "
11677echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11678if $test "$intsize" -ge 4; then
11679	xxx=int
11680else
11681	xxx=long
11682fi
11683$cat >try.c <<EOCP
11684#include <stdio.h>
11685#$i_stdlib I_STDLIB
11686#ifdef I_STDLIB
11687#include <stdlib.h>
11688#endif
11689#include <sys/types.h>
11690#include <signal.h>
11691$signal_t blech(int s) { exit(3); }
11692int main()
11693{
11694	$xxx i32;
11695	double f, g;
11696	int result = 0;
11697	char str[16];
11698	signal(SIGFPE, blech);
11699
11700	/* Don't let compiler optimize the test away.  Store the number
11701	   in a writable string for gcc to pass to sscanf under HP-UX.
11702	*/
11703	sprintf(str, "2147483647");
11704	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11705	g = 10 * f;
11706	i32  = ($xxx) g;
11707
11708	/* x86 processors will probably give 0x8000 0000, which is a
11709	   sign change.  We don't want that.  We want to mimic SPARC
11710	   behavior here, which is to preserve the sign and give
11711	   back 0x7fff ffff.
11712	*/
11713	if (i32 != ($xxx) f)
11714		result |= 1;
11715	exit(result);
11716}
11717EOCP
11718set try
11719if eval $compile_ok; then
11720	$run ./try 2>/dev/null
11721	yyy=$?
11722else
11723	echo "(I can't seem to compile the test program--assuming it can't)"
11724	yyy=1
11725fi
11726case "$yyy" in
117270)	val="$define"
11728	echo "Yup, it can."
11729	;;
11730*)	val="$undef"
11731	echo "Nope, it can't."
11732	;;
11733esac
11734set d_casti32
11735eval $setvar
11736$rm_try
11737
11738: check for ability to cast negative floats to unsigned
11739echo " "
11740echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11741$cat >try.c <<EOCP
11742#include <stdio.h>
11743#$i_stdlib I_STDLIB
11744#ifdef I_STDLIB
11745#include <stdlib.h>
11746#endif
11747#include <sys/types.h>
11748#include <signal.h>
11749$signal_t blech(int s) { exit(7); }
11750$signal_t blech_in_list(int s) { exit(4); }
11751unsigned long dummy_long(unsigned long p) { return p; }
11752unsigned int dummy_int(unsigned int p) { return p; }
11753unsigned short dummy_short(unsigned short p) { return p; }
11754int main()
11755{
11756	double f;
11757	unsigned long along;
11758	unsigned int aint;
11759	unsigned short ashort;
11760	int result = 0;
11761	char str[16];
11762
11763	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11764	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11765	   optimized the whole file away
11766	*/
11767	/* Store the number in a writable string for gcc to pass to
11768	   sscanf under HP-UX.
11769	*/
11770	sprintf(str, "-123");
11771	sscanf(str, "%lf", &f);  /* f = -123.; */
11772
11773	signal(SIGFPE, blech);
11774	along = (unsigned long)f;
11775	aint = (unsigned int)f;
11776	ashort = (unsigned short)f;
11777	if (along != (unsigned long)-123)
11778		result |= 1;
11779	if (aint != (unsigned int)-123)
11780		result |= 1;
11781	if (ashort != (unsigned short)-123)
11782		result |= 1;
11783	sprintf(str, "1073741824.");
11784	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11785	f = f + f;
11786	along = 0;
11787	along = (unsigned long)f;
11788	if (along != 0x80000000)
11789		result |= 2;
11790	f -= 1.;
11791	along = 0;
11792	along = (unsigned long)f;
11793	if (along != 0x7fffffff)
11794		result |= 1;
11795	f += 2.;
11796	along = 0;
11797	along = (unsigned long)f;
11798	if (along != 0x80000001)
11799		result |= 2;
11800	if (result)
11801		exit(result);
11802	signal(SIGFPE, blech_in_list);
11803	sprintf(str, "123.");
11804	sscanf(str, "%lf", &f);  /* f = 123.; */
11805	along = dummy_long((unsigned long)f);
11806	aint = dummy_int((unsigned int)f);
11807	ashort = dummy_short((unsigned short)f);
11808	if (along != (unsigned long)123)
11809		result |= 4;
11810	if (aint != (unsigned int)123)
11811		result |= 4;
11812	if (ashort != (unsigned short)123)
11813		result |= 4;
11814	exit(result);
11815
11816}
11817EOCP
11818set try
11819if eval $compile_ok; then
11820	$run ./try 2>/dev/null
11821	castflags=$?
11822else
11823	echo "(I can't seem to compile the test program--assuming it can't)"
11824	castflags=7
11825fi
11826case "$castflags" in
118270)	val="$define"
11828	echo "Yup, it can."
11829	;;
11830*)	val="$undef"
11831	echo "Nope, it can't."
11832	;;
11833esac
11834set d_castneg
11835eval $setvar
11836$rm_try
11837
11838: see if cbrt exists
11839set cbrt d_cbrt
11840eval $inlibc
11841
11842: see if chown exists
11843set chown d_chown
11844eval $inlibc
11845
11846: see if chroot exists
11847set chroot d_chroot
11848eval $inlibc
11849
11850: see if chsize exists
11851set chsize d_chsize
11852eval $inlibc
11853
11854: see if class exists
11855set class d_class
11856eval $inlibc
11857
11858: see if clearenv exists
11859set clearenv d_clearenv
11860eval $inlibc
11861
11862: Define hasstruct macro for Configure internal use
11863hasstruct='varname=$1; struct=$2; shift; shift;
11864while $test $# -ge 2; do
11865	case "$1" in
11866	$define) echo "#include <$2>";;
11867	esac ;
11868    shift 2;
11869done > try.c;
11870echo "int main () { struct $struct foo; }" >> try.c;
11871set try;
11872if eval $compile; then
11873	val="$define";
11874else
11875	val="$undef";
11876fi;
11877set $varname;
11878eval $setvar;
11879$rm_try'
11880
11881: see whether socket exists
11882socketlib=''
11883sockethdr=''
11884echo " "
11885$echo $n "Hmm... $c" >&4
11886if set socket val -f d_socket; eval $csym; $val; then
11887    echo "Looks like you have Berkeley networking support." >&4
11888    d_socket="$define"
11889    if set setsockopt val -f; eval $csym; $val; then
11890	d_oldsock="$undef"
11891    else
11892	echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11893	d_oldsock="$define"
11894    fi
11895else
11896    if $contains socklib libc.list >/dev/null 2>&1; then
11897	echo "Looks like you have Berkeley networking support." >&4
11898	d_socket="$define"
11899	: we will have to assume that it supports the 4.2 BSD interface
11900	d_oldsock="$undef"
11901    else
11902	echo "You don't have Berkeley networking in libc$_a..." >&4
11903	if test "X$d_socket" = "X$define"; then
11904	    echo "...but you seem to believe that you have sockets." >&4
11905	else
11906	    for net in net socket
11907	    do
11908		if test -f $sysroot/usr/lib/lib$net$_a; then
11909		    ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11910		    $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11911		    if $contains socket libc.list >/dev/null 2>&1; then
11912			d_socket="$define"
11913			socketlib="-l$net"
11914			case "$net" in
11915			net)
11916			    echo "...but the Wollongong group seems to have hacked it in." >&4
11917			    sockethdr="-I$sysroot/usr/netinclude"
11918			    ;;
11919			esac
11920			echo "Found Berkeley sockets interface in lib$net." >&4
11921			if $contains setsockopt libc.list >/dev/null 2>&1; then
11922			    d_oldsock="$undef"
11923			else
11924			    echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11925			    d_oldsock="$define"
11926			fi
11927			break
11928		    fi
11929		fi
11930	    done
11931	    if test "X$d_socket" != "X$define"; then
11932	       echo "or anywhere else I see." >&4
11933	       d_socket="$undef"
11934	       d_oldsock="$undef"
11935	    fi
11936	fi
11937    fi
11938fi
11939
11940: see if socketpair exists
11941set socketpair d_sockpair
11942eval $inlibc
11943
11944
11945echo "Checking the availability sa_len in the sock struct ..." >&4
11946$cat >try.c <<EOF
11947#include <sys/types.h>
11948#include <sys/socket.h>
11949int main() {
11950struct sockaddr sa;
11951return (sa.sa_len);
11952}
11953EOF
11954val="$undef"
11955set try; if eval $compile; then
11956    val="$define"
11957fi
11958set d_sockaddr_sa_len; eval $setvar
11959$rm_try
11960
11961echo "Checking the availability struct sockaddr_in6 ..." >&4
11962$cat >try.c <<EOF
11963#include <sys/types.h>
11964#include <sys/socket.h>
11965#include <netinet/in.h>
11966int main() {
11967struct sockaddr_in6 sin6;
11968return (sin6.sin6_family);
11969}
11970EOF
11971val="$undef"
11972set try; if eval $compile; then
11973    val="$define"
11974fi
11975set d_sockaddr_in6; eval $setvar
11976$rm_try
11977
11978echo "Checking the availability struct sockaddr_storage ..." >&4
11979$cat >try.c <<EOF
11980#include <sys/types.h>
11981#include <sys/socket.h>
11982#include <netinet/in.h>
11983int main() {
11984struct sockaddr_storage sastor;
11985return (sastor.ss_family);
11986}
11987EOF
11988val="$undef"
11989set try; if eval $compile; then
11990    val="$define"
11991fi
11992set d_sockaddr_storage; eval $setvar
11993$rm_try
11994
11995echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11996$cat >try.c <<EOF
11997#include <sys/types.h>
11998#include <sys/socket.h>
11999#include <netinet/in.h>
12000int main() {
12001struct sockaddr_in6 sin6;
12002return (sin6.sin6_scope_id);
12003}
12004EOF
12005val="$undef"
12006set try; if eval $compile; then
12007    val="$define"
12008fi
12009set d_sin6_scope_id; eval $setvar
12010$rm_try
12011
12012echo "Checking the availability struct ip_mreq ..." >&4
12013$cat >try.c <<EOF
12014#include <sys/types.h>
12015#include <sys/socket.h>
12016#include <netinet/in.h>
12017int main() {
12018struct ip_mreq mreq;
12019return (mreq.imr_multiaddr.s_addr);
12020}
12021EOF
12022val="$undef"
12023set try; if eval $compile; then
12024       val="$define"
12025fi
12026set d_ip_mreq; eval $setvar
12027$rm_try
12028
12029echo "Checking the availability struct ip_mreq_source ..." >&4
12030$cat >try.c <<EOF
12031#include <sys/types.h>
12032#include <sys/socket.h>
12033#include <netinet/in.h>
12034int main() {
12035struct ip_mreq_source mreq;
12036return (mreq.imr_multiaddr.s_addr);
12037}
12038EOF
12039val="$undef"
12040set try; if eval $compile; then
12041       val="$define"
12042fi
12043set d_ip_mreq_source; eval $setvar
12044$rm_try
12045
12046echo "Checking the availability struct ipv6_mreq ..." >&4
12047$cat >try.c <<EOF
12048#include <sys/types.h>
12049#include <sys/socket.h>
12050#include <netinet/in.h>
12051int main() {
12052struct ipv6_mreq mreq;
12053return (mreq.ipv6mr_interface);
12054}
12055EOF
12056val="$undef"
12057set try; if eval $compile; then
12058    val="$define"
12059fi
12060set d_ipv6_mreq; eval $setvar
12061$rm_try
12062
12063echo "Checking the availability struct ipv6_mreq_source ..." >&4
12064$cat >try.c <<EOF
12065#include <sys/types.h>
12066#include <sys/socket.h>
12067#include <netinet/in.h>
12068int main() {
12069struct ipv6_mreq_source mreq;
12070return (mreq.imr_multiaddr.s_addr);
12071}
12072EOF
12073val="$undef"
12074set try; if eval $compile; then
12075       val="$define"
12076fi
12077set d_ipv6_mreq_source; eval $setvar
12078$rm_try
12079
12080echo "Checking the availability of certain socket constants..." >&4
12081for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12082    enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12083    $cat >try.c <<EOF
12084#include <sys/types.h>
12085#include <sys/socket.h>
12086int main() {
12087    int i = $ENUM;
12088}
12089EOF
12090    val="$undef"
12091    set try; if eval $compile; then
12092	val="$define"
12093    fi
12094    set d_${enum}; eval $setvar
12095    $rm_try
12096done
12097
12098: see if this is a sys/uio.h system
12099set sys/uio.h i_sysuio
12100eval $inhdr
12101
12102: Check for cmsghdr support
12103echo " "
12104echo "Checking to see if your system supports struct cmsghdr..." >&4
12105set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12106eval $hasstruct
12107case "$d_cmsghdr_s" in
12108"$define")      echo "Yes, it does."   ;;
12109*)              echo "No, it doesn't." ;;
12110esac
12111
12112: see if copysign exists
12113set copysign d_copysign
12114eval $inlibc
12115
12116: see if copysignl exists
12117set copysignl d_copysignl
12118eval $inlibc
12119
12120: see if crypt exists
12121echo " "
12122set crypt d_crypt
12123eval $inlibc
12124case "$d_crypt" in
12125$define) cryptlib='' ;;
12126*)	if set crypt val -f d_crypt; eval $csym; $val; then
12127		echo 'crypt() found.' >&4
12128		val="$define"
12129		cryptlib=''
12130	else
12131		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12132		if $test -z "$cryptlib"; then
12133			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12134		else
12135			cryptlib=-lcrypt
12136		fi
12137		if $test -z "$cryptlib"; then
12138			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12139		else
12140			cryptlib=-lcrypt
12141		fi
12142		if $test -z "$cryptlib"; then
12143			cryptlib=`./loc libcrypt$_a "" $libpth`
12144		else
12145			cryptlib=-lcrypt
12146		fi
12147		if $test -z "$cryptlib"; then
12148			echo 'crypt() NOT found.' >&4
12149			val="$undef"
12150		else
12151			val="$define"
12152		fi
12153	fi
12154	set d_crypt
12155	eval $setvar
12156	;;
12157esac
12158
12159: see if this is a crypt.h system
12160set crypt.h i_crypt
12161eval $inhdr
12162
12163: see if crypt_r exists
12164set crypt_r d_crypt_r
12165eval $inlibc
12166case "$d_crypt_r" in
12167"$define")
12168	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12169	case "$d_crypt_r_proto:$usethreads" in
12170	":define")	d_crypt_r_proto=define
12171		set d_crypt_r_proto crypt_r $hdrs
12172		eval $hasproto ;;
12173	*)	;;
12174	esac
12175	case "$d_crypt_r_proto" in
12176	define)
12177	case "$crypt_r_proto" in
12178	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12179	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12180	esac
12181	case "$crypt_r_proto" in
12182	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12183	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12184	esac
12185	case "$crypt_r_proto" in
12186	''|0)	d_crypt_r=undef
12187		crypt_r_proto=0
12188		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12189	* )	case "$crypt_r_proto" in
12190		REENTRANT_PROTO*) ;;
12191		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12192		esac
12193		echo "Prototype: $try" ;;
12194	esac
12195	;;
12196	*)	case "$usethreads" in
12197		define) echo "crypt_r has no prototype, not using it." >&4 ;;
12198		esac
12199		d_crypt_r=undef
12200		crypt_r_proto=0
12201		;;
12202	esac
12203	;;
12204*)	crypt_r_proto=0
12205	;;
12206esac
12207
12208: get csh whereabouts
12209case "$csh" in
12210'csh') val="$undef" ;;
12211*) val="$define" ;;
12212esac
12213set d_csh
12214eval $setvar
12215: Respect a hint or command line value for full_csh.
12216case "$full_csh" in
12217'') full_csh=$csh ;;
12218esac
12219
12220: see if ctermid exists
12221set ctermid d_ctermid
12222eval $inlibc
12223
12224: see if ctermid_r exists
12225set ctermid_r d_ctermid_r
12226eval $inlibc
12227case "$d_ctermid_r" in
12228"$define")
12229	hdrs="$i_systypes sys/types.h define stdio.h "
12230	case "$d_ctermid_r_proto:$usethreads" in
12231	":define")	d_ctermid_r_proto=define
12232		set d_ctermid_r_proto ctermid_r $hdrs
12233		eval $hasproto ;;
12234	*)	;;
12235	esac
12236	case "$d_ctermid_r_proto" in
12237	define)
12238	case "$ctermid_r_proto" in
12239	''|0) try='char* ctermid_r(char*);'
12240	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12241	esac
12242	case "$ctermid_r_proto" in
12243	''|0)	d_ctermid_r=undef
12244		ctermid_r_proto=0
12245		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12246	* )	case "$ctermid_r_proto" in
12247		REENTRANT_PROTO*) ;;
12248		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12249		esac
12250		echo "Prototype: $try" ;;
12251	esac
12252	;;
12253	*)	case "$usethreads" in
12254		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12255		esac
12256		d_ctermid_r=undef
12257		ctermid_r_proto=0
12258		;;
12259	esac
12260	;;
12261*)	ctermid_r_proto=0
12262	;;
12263esac
12264
12265: see if ctime_r exists
12266set ctime_r d_ctime_r
12267eval $inlibc
12268case "$d_ctime_r" in
12269"$define")
12270	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12271	case "$d_ctime_r_proto:$usethreads" in
12272	":define")	d_ctime_r_proto=define
12273		set d_ctime_r_proto ctime_r $hdrs
12274		eval $hasproto ;;
12275	*)	;;
12276	esac
12277	case "$d_ctime_r_proto" in
12278	define)
12279	case "$ctime_r_proto" in
12280	''|0) try='char* ctime_r(const time_t*, char*);'
12281	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12282	esac
12283	case "$ctime_r_proto" in
12284	''|0) try='char* ctime_r(const time_t*, char*, int);'
12285	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12286	esac
12287	case "$ctime_r_proto" in
12288	''|0) try='int ctime_r(const time_t*, char*);'
12289	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12290	esac
12291	case "$ctime_r_proto" in
12292	''|0) try='int ctime_r(const time_t*, char*, int);'
12293	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12294	esac
12295	case "$ctime_r_proto" in
12296	''|0)	d_ctime_r=undef
12297		ctime_r_proto=0
12298		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12299	* )	case "$ctime_r_proto" in
12300		REENTRANT_PROTO*) ;;
12301		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12302		esac
12303		echo "Prototype: $try" ;;
12304	esac
12305	;;
12306	*)	case "$usethreads" in
12307		define) echo "ctime_r has no prototype, not using it." >&4 ;;
12308		esac
12309		d_ctime_r=undef
12310		ctime_r_proto=0
12311		;;
12312	esac
12313	;;
12314*)	ctime_r_proto=0
12315	;;
12316esac
12317
12318: see if cuserid exists
12319set cuserid d_cuserid
12320eval $inlibc
12321
12322: see if dbm.h is available
12323: see if dbmclose exists
12324set dbmclose d_dbmclose
12325eval $inlibc
12326
12327case "$d_dbmclose" in
12328$define)
12329	set dbm.h i_dbm
12330	eval $inhdr
12331	case "$i_dbm" in
12332	$define)
12333		val="$undef"
12334		set i_rpcsvcdbm
12335		eval $setvar
12336		;;
12337	*)	set rpcsvc/dbm.h i_rpcsvcdbm
12338		eval $inhdr
12339		;;
12340	esac
12341	;;
12342*)	echo "We won't be including <dbm.h>"
12343	val="$undef"
12344	set i_dbm
12345	eval $setvar
12346	val="$undef"
12347	set i_rpcsvcdbm
12348	eval $setvar
12349	;;
12350esac
12351
12352: see if prototype for dbminit is available
12353echo " "
12354set d_dbminitproto dbminit $i_dbm dbm.h
12355eval $hasproto
12356
12357: see if difftime exists
12358set difftime d_difftime
12359eval $inlibc
12360
12361: see if this is a dirent system
12362echo " "
12363if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12364	val="$define"
12365	echo "<dirent.h> found." >&4
12366else
12367	val="$undef"
12368	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12369		echo "<sys/dir.h> found." >&4
12370		echo " "
12371	else
12372		xinc=`./findhdr sys/ndir.h`
12373	fi
12374	echo "<dirent.h> NOT found." >&4
12375fi
12376set i_dirent
12377eval $setvar
12378
12379: Look for type of directory structure.
12380echo " "
12381$cppstdin $cppflags $cppminus < "$xinc" > try.c
12382
12383case "$direntrytype" in
12384''|' ')
12385	case "$i_dirent" in
12386	$define) guess1='struct dirent' ;;
12387	*) guess1='struct direct'  ;;
12388	esac
12389	;;
12390*)	guess1="$direntrytype"
12391	;;
12392esac
12393
12394case "$guess1" in
12395'struct dirent') guess2='struct direct' ;;
12396*) guess2='struct dirent' ;;
12397esac
12398
12399if $contains "$guess1" try.c >/dev/null 2>&1; then
12400	direntrytype="$guess1"
12401	echo "Your directory entries are $direntrytype." >&4
12402elif $contains "$guess2" try.c >/dev/null 2>&1; then
12403	direntrytype="$guess2"
12404	echo "Your directory entries seem to be $direntrytype." >&4
12405else
12406	echo "I don't recognize your system's directory entries." >&4
12407	rp="What type is used for directory entries on this system?"
12408	dflt="$guess1"
12409	. ./myread
12410	direntrytype="$ans"
12411fi
12412$rm_try
12413
12414: see if the directory entry stores field length
12415echo " "
12416$cppstdin $cppflags $cppminus < "$xinc" > try.c
12417if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12418	echo "Good, your directory entry keeps length information in d_namlen." >&4
12419	val="$define"
12420else
12421	echo "Your directory entry does not know about the d_namlen field." >&4
12422	val="$undef"
12423fi
12424set d_dirnamlen
12425eval $setvar
12426$rm_try
12427
12428: Look for DIR.dd_fd
12429case "$i_dirent" in
12430"$define")
12431    echo "Checking to see if DIR has a dd_fd member variable" >&4
12432    $cat >try.c <<EOCP
12433#$i_stdlib I_STDLIB
12434#ifdef I_STDLIB
12435#include <stdlib.h>
12436#endif
12437#include <dirent.h>
12438
12439int main() {
12440    DIR dir;
12441    dir.dd_fd = 1;
12442    return 0;
12443}
12444EOCP
12445    val=$undef
12446    set try
12447    if eval $compile; then
12448        echo "Yes, it does."
12449        val="$define"
12450    else
12451        echo "No, it does not."
12452        val="$undef"
12453    fi
12454    ;;
12455*)
12456    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12457    val="$undef"
12458    ;;
12459esac
12460set d_dir_dd_fd
12461eval $setvar
12462$rm_try
12463
12464: see if this is an sysdir system
12465set sys/dir.h i_sysdir
12466eval $inhdr
12467
12468: see if this is an sysndir system
12469set sys/ndir.h i_sysndir
12470eval $inhdr
12471
12472: Look for dirfd
12473echo " "
12474$cat >dirfd.c <<EOM
12475#include <stdio.h>
12476#$i_stdlib I_STDLIB
12477#ifdef I_STDLIB
12478#include <stdlib.h>
12479#endif
12480#$i_dirent I_DIRENT		/**/
12481#$i_sysdir I_SYS_DIR		/**/
12482#$i_sysndir I_SYS_NDIR		/**/
12483#$i_systypes I_SYS_TYPES	/**/
12484#if defined(I_SYS_TYPES)
12485#include <sys/types.h>
12486#endif
12487#if defined(I_DIRENT)
12488#include <dirent.h>
12489#else
12490#ifdef I_SYS_NDIR
12491#include <sys/ndir.h>
12492#else
12493#ifdef I_SYS_DIR
12494#include <sys/dir.h>
12495#endif
12496#endif
12497#endif
12498int main() {
12499	DIR *dirp = opendir(".");
12500	if (dirfd(dirp) >= 0)
12501		exit(0);
12502	else
12503		exit(1);
12504}
12505EOM
12506val=$undef
12507set dirfd
12508if eval $compile; then
12509	val="$define"
12510fi
12511case "$val" in
12512$define)	echo "dirfd() found." >&4	;;
12513*)		echo "dirfd() NOT found." >&4	;;
12514esac
12515set d_dirfd
12516eval $setvar
12517$rm -f dirfd*
12518
12519: see if dladdr exists
12520set dladdr d_dladdr
12521eval $inlibc
12522
12523: see if dlerror exists
12524xxx_runnm="$runnm"
12525runnm=false
12526set dlerror d_dlerror
12527eval $inlibc
12528runnm="$xxx_runnm"
12529
12530: see if dlfcn is available
12531set dlfcn.h i_dlfcn
12532eval $inhdr
12533
12534: Check what extension to use for shared libs
12535case "$usedl" in
12536$define|y|true)
12537	$cat << EOM
12538
12539On a few systems, the dynamically loaded modules that perl generates and uses
12540will need a different extension than shared libs. The default will probably
12541be appropriate.
12542
12543EOM
12544	case "$dlext" in
12545	'')	dflt="$so" ;;
12546	*)	dflt="$dlext" ;;
12547	esac
12548	rp='What is the extension of dynamically loaded modules'
12549	. ./myread
12550	dlext="$ans"
12551	;;
12552*)
12553	dlext="none"
12554	;;
12555esac
12556
12557: Check if dlsym need a leading underscore
12558echo " "
12559val="$undef"
12560
12561case "$dlsrc" in
12562dl_dlopen.xs)
12563	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12564	$cat >dyna.c <<'EOM'
12565fred () { }
12566EOM
12567
12568$cat >fred.c<<EOM
12569
12570#include <stdio.h>
12571#$i_stdlib I_STDLIB
12572#ifdef I_STDLIB
12573#include <stdlib.h>
12574#endif
12575#$i_dlfcn I_DLFCN
12576#ifdef I_DLFCN
12577#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12578#else
12579#include <sys/types.h>
12580#include <nlist.h>
12581#include <link.h>
12582#endif
12583
12584extern int fred() ;
12585
12586int main()
12587{
12588    void * handle ;
12589    void * symbol ;
12590#ifndef RTLD_LAZY
12591    int mode = 1 ;
12592#else
12593    int mode = RTLD_LAZY ;
12594#endif
12595    handle = dlopen("./dyna.$dlext", mode) ;
12596    if (handle == NULL) {
12597	printf ("1\n") ;
12598	fflush (stdout) ;
12599	exit(0);
12600    }
12601    symbol = dlsym(handle, "fred") ;
12602    if (symbol == NULL) {
12603	/* try putting a leading underscore */
12604	symbol = dlsym(handle, "_fred") ;
12605	if (symbol == NULL) {
12606	    printf ("2\n") ;
12607	    fflush (stdout) ;
12608	    exit(0);
12609	}
12610	printf ("3\n") ;
12611    }
12612    else
12613	printf ("4\n") ;
12614    fflush (stdout) ;
12615    exit(0);
12616}
12617EOM
12618	: Call the object file tmp-dyna.o in case dlext=o.
12619	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12620		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12621		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12622		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12623		xxx=`$run ./fred`
12624		case $xxx in
12625		1)	echo "Test program failed using dlopen." >&4
12626			echo "Perhaps you should not use dynamic loading." >&4;;
12627		2)	echo "Test program failed using dlsym." >&4
12628			echo "Perhaps you should not use dynamic loading." >&4;;
12629		3)	echo "dlsym needs a leading underscore" >&4
12630			val="$define" ;;
12631		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12632		esac
12633	else
12634		echo "I can't compile and run the test program." >&4
12635                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12636	fi
12637	;;
12638esac
12639
12640$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12641
12642set d_dlsymun
12643eval $setvar
12644
12645: see if drand48_r exists
12646set drand48_r d_drand48_r
12647eval $inlibc
12648case "$d_drand48_r" in
12649"$define")
12650	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12651	case "$d_drand48_r_proto:$usethreads" in
12652	":define")	d_drand48_r_proto=define
12653		set d_drand48_r_proto drand48_r $hdrs
12654		eval $hasproto ;;
12655	*)	;;
12656	esac
12657	case "$d_drand48_r_proto" in
12658	define)
12659	case "$drand48_r_proto" in
12660	''|0) try='int drand48_r(struct drand48_data*, double*);'
12661	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12662	esac
12663	case "$drand48_r_proto" in
12664	''|0)	d_drand48_r=undef
12665		drand48_r_proto=0
12666		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12667	* )	case "$drand48_r_proto" in
12668		REENTRANT_PROTO*) ;;
12669		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12670		esac
12671		echo "Prototype: $try" ;;
12672	esac
12673	;;
12674	*)	case "$usethreads" in
12675		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12676		esac
12677		d_drand48_r=undef
12678		drand48_r_proto=0
12679		;;
12680	esac
12681	;;
12682*)	drand48_r_proto=0
12683	;;
12684esac
12685
12686: see if prototype for drand48 is available
12687echo " "
12688set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12689eval $hasproto
12690
12691: see if dup2 exists
12692set dup2 d_dup2
12693eval $inlibc
12694
12695: see if dup3 exists
12696set dup3 d_dup3
12697eval $inlibc
12698
12699: see if this is an xlocale.h system
12700set xlocale.h i_xlocale
12701eval $inhdr
12702
12703: see if newlocale exists
12704set newlocale d_newlocale
12705eval $inlibc
12706
12707: see if freelocale exists
12708set freelocale d_freelocale
12709eval $inlibc
12710
12711: see if uselocale exists
12712set uselocale d_uselocale
12713eval $inlibc
12714
12715: see if duplocale exists
12716set duplocale d_duplocale
12717eval $inlibc
12718
12719: see if querylocale exists
12720set querylocale d_querylocale
12721eval $inlibc
12722
12723: see if eaccess exists
12724set eaccess d_eaccess
12725eval $inlibc
12726
12727: see if endgrent exists
12728set endgrent d_endgrent
12729eval $inlibc
12730
12731: see if this is an grp system
12732set grp.h i_grp
12733eval $inhdr
12734
12735case "$i_grp" in
12736$define)
12737	xxx=`./findhdr grp.h`
12738	$cppstdin $cppflags $cppminus < $xxx >$$.h
12739
12740	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12741		val="$define"
12742	else
12743		val="$undef"
12744	fi
12745	set d_grpasswd
12746	eval $setvar
12747
12748	$rm -f $$.h
12749	;;
12750*)
12751	val="$undef";
12752	set d_grpasswd; eval $setvar
12753	;;
12754esac
12755
12756: see if endgrent_r exists
12757set endgrent_r d_endgrent_r
12758eval $inlibc
12759case "$d_endgrent_r" in
12760"$define")
12761	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12762	case "$d_endgrent_r_proto:$usethreads" in
12763	":define")	d_endgrent_r_proto=define
12764		set d_endgrent_r_proto endgrent_r $hdrs
12765		eval $hasproto ;;
12766	*)	;;
12767	esac
12768	case "$d_endgrent_r_proto" in
12769	define)
12770	case "$endgrent_r_proto" in
12771	''|0) try='int endgrent_r(FILE**);'
12772	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12773	esac
12774	case "$endgrent_r_proto" in
12775	''|0) try='void endgrent_r(FILE**);'
12776	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12777	esac
12778	case "$endgrent_r_proto" in
12779	''|0)	d_endgrent_r=undef
12780		endgrent_r_proto=0
12781		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12782	* )	case "$endgrent_r_proto" in
12783		REENTRANT_PROTO*) ;;
12784		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12785		esac
12786		echo "Prototype: $try" ;;
12787	esac
12788	;;
12789	*)	case "$usethreads" in
12790		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12791		esac
12792		d_endgrent_r=undef
12793		endgrent_r_proto=0
12794		;;
12795	esac
12796	;;
12797*)	endgrent_r_proto=0
12798	;;
12799esac
12800
12801: see if endhostent exists
12802set endhostent d_endhent
12803eval $inlibc
12804
12805: see if this is a netdb.h system
12806set netdb.h i_netdb
12807eval $inhdr
12808
12809: see if endhostent_r exists
12810set endhostent_r d_endhostent_r
12811eval $inlibc
12812case "$d_endhostent_r" in
12813"$define")
12814	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12815	case "$d_endhostent_r_proto:$usethreads" in
12816	":define")	d_endhostent_r_proto=define
12817		set d_endhostent_r_proto endhostent_r $hdrs
12818		eval $hasproto ;;
12819	*)	;;
12820	esac
12821	case "$d_endhostent_r_proto" in
12822	define)
12823	case "$endhostent_r_proto" in
12824	''|0) try='int endhostent_r(struct hostent_data*);'
12825	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12826	esac
12827	case "$endhostent_r_proto" in
12828	''|0) try='void endhostent_r(struct hostent_data*);'
12829	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12830	esac
12831	case "$endhostent_r_proto" in
12832	''|0)	d_endhostent_r=undef
12833		endhostent_r_proto=0
12834		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12835	* )	case "$endhostent_r_proto" in
12836		REENTRANT_PROTO*) ;;
12837		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12838		esac
12839		echo "Prototype: $try" ;;
12840	esac
12841	;;
12842	*)	case "$usethreads" in
12843		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12844		esac
12845		d_endhostent_r=undef
12846		endhostent_r_proto=0
12847		;;
12848	esac
12849	;;
12850*)	endhostent_r_proto=0
12851	;;
12852esac
12853
12854: see if endnetent exists
12855set endnetent d_endnent
12856eval $inlibc
12857
12858: see if endnetent_r exists
12859set endnetent_r d_endnetent_r
12860eval $inlibc
12861case "$d_endnetent_r" in
12862"$define")
12863	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12864	case "$d_endnetent_r_proto:$usethreads" in
12865	":define")	d_endnetent_r_proto=define
12866		set d_endnetent_r_proto endnetent_r $hdrs
12867		eval $hasproto ;;
12868	*)	;;
12869	esac
12870	case "$d_endnetent_r_proto" in
12871	define)
12872	case "$endnetent_r_proto" in
12873	''|0) try='int endnetent_r(struct netent_data*);'
12874	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12875	esac
12876	case "$endnetent_r_proto" in
12877	''|0) try='void endnetent_r(struct netent_data*);'
12878	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12879	esac
12880	case "$endnetent_r_proto" in
12881	''|0)	d_endnetent_r=undef
12882		endnetent_r_proto=0
12883		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12884	* )	case "$endnetent_r_proto" in
12885		REENTRANT_PROTO*) ;;
12886		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12887		esac
12888		echo "Prototype: $try" ;;
12889	esac
12890	;;
12891	*)	case "$usethreads" in
12892		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12893		esac
12894		d_endnetent_r=undef
12895		endnetent_r_proto=0
12896		;;
12897	esac
12898	;;
12899*)	endnetent_r_proto=0
12900	;;
12901esac
12902
12903: see if endprotoent exists
12904set endprotoent d_endpent
12905eval $inlibc
12906
12907: see if endprotoent_r exists
12908set endprotoent_r d_endprotoent_r
12909eval $inlibc
12910case "$d_endprotoent_r" in
12911"$define")
12912	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12913	case "$d_endprotoent_r_proto:$usethreads" in
12914	":define")	d_endprotoent_r_proto=define
12915		set d_endprotoent_r_proto endprotoent_r $hdrs
12916		eval $hasproto ;;
12917	*)	;;
12918	esac
12919	case "$d_endprotoent_r_proto" in
12920	define)
12921	case "$endprotoent_r_proto" in
12922	''|0) try='int endprotoent_r(struct protoent_data*);'
12923	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12924	esac
12925	case "$endprotoent_r_proto" in
12926	''|0) try='void endprotoent_r(struct protoent_data*);'
12927	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12928	esac
12929	case "$endprotoent_r_proto" in
12930	''|0)	d_endprotoent_r=undef
12931		endprotoent_r_proto=0
12932		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12933	* )	case "$endprotoent_r_proto" in
12934		REENTRANT_PROTO*) ;;
12935		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12936		esac
12937		echo "Prototype: $try" ;;
12938	esac
12939	;;
12940	*)	case "$usethreads" in
12941		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12942		esac
12943		d_endprotoent_r=undef
12944		endprotoent_r_proto=0
12945		;;
12946	esac
12947	;;
12948*)	endprotoent_r_proto=0
12949	;;
12950esac
12951
12952: see if endpwent exists
12953set endpwent d_endpwent
12954eval $inlibc
12955
12956: see if this is a pwd.h system
12957set pwd.h i_pwd
12958eval $inhdr
12959
12960case "$i_pwd" in
12961$define)
12962	xxx=`./findhdr pwd.h`
12963	$cppstdin $cppflags $cppminus < $xxx >$$.h
12964
12965	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12966		val="$define"
12967	else
12968		val="$undef"
12969	fi
12970	set d_pwquota
12971	eval $setvar
12972
12973	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12974		val="$define"
12975	else
12976		val="$undef"
12977	fi
12978	set d_pwage
12979	eval $setvar
12980
12981	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12982		val="$define"
12983	else
12984		val="$undef"
12985	fi
12986	set d_pwchange
12987	eval $setvar
12988
12989	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12990		val="$define"
12991	else
12992		val="$undef"
12993	fi
12994	set d_pwclass
12995	eval $setvar
12996
12997	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12998		val="$define"
12999	else
13000		val="$undef"
13001	fi
13002	set d_pwexpire
13003	eval $setvar
13004
13005	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13006		val="$define"
13007	else
13008		val="$undef"
13009	fi
13010	set d_pwcomment
13011	eval $setvar
13012
13013	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13014		val="$define"
13015	else
13016		val="$undef"
13017	fi
13018	set d_pwgecos
13019	eval $setvar
13020
13021	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13022		val="$define"
13023	else
13024		val="$undef"
13025	fi
13026	set d_pwpasswd
13027	eval $setvar
13028
13029	$rm -f $$.h
13030	;;
13031*)
13032	val="$undef";
13033	set d_pwquota; eval $setvar
13034	set d_pwage; eval $setvar
13035	set d_pwchange; eval $setvar
13036	set d_pwclass; eval $setvar
13037	set d_pwexpire; eval $setvar
13038	set d_pwcomment; eval $setvar
13039	set d_pwgecos; eval $setvar
13040	set d_pwpasswd; eval $setvar
13041	;;
13042esac
13043
13044: see if endpwent_r exists
13045set endpwent_r d_endpwent_r
13046eval $inlibc
13047case "$d_endpwent_r" in
13048"$define")
13049	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13050	case "$d_endpwent_r_proto:$usethreads" in
13051	":define")	d_endpwent_r_proto=define
13052		set d_endpwent_r_proto endpwent_r $hdrs
13053		eval $hasproto ;;
13054	*)	;;
13055	esac
13056	case "$d_endpwent_r_proto" in
13057	define)
13058	case "$endpwent_r_proto" in
13059	''|0) try='int endpwent_r(FILE**);'
13060	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13061	esac
13062	case "$endpwent_r_proto" in
13063	''|0) try='void endpwent_r(FILE**);'
13064	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13065	esac
13066	case "$endpwent_r_proto" in
13067	''|0)	d_endpwent_r=undef
13068		endpwent_r_proto=0
13069		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13070	* )	case "$endpwent_r_proto" in
13071		REENTRANT_PROTO*) ;;
13072		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13073		esac
13074		echo "Prototype: $try" ;;
13075	esac
13076	;;
13077	*)	case "$usethreads" in
13078		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13079		esac
13080		d_endpwent_r=undef
13081		endpwent_r_proto=0
13082		;;
13083	esac
13084	;;
13085*)	endpwent_r_proto=0
13086	;;
13087esac
13088
13089: see if endservent exists
13090set endservent d_endsent
13091eval $inlibc
13092
13093: see if endservent_r exists
13094set endservent_r d_endservent_r
13095eval $inlibc
13096case "$d_endservent_r" in
13097"$define")
13098	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13099	case "$d_endservent_r_proto:$usethreads" in
13100	":define")	d_endservent_r_proto=define
13101		set d_endservent_r_proto endservent_r $hdrs
13102		eval $hasproto ;;
13103	*)	;;
13104	esac
13105	case "$d_endservent_r_proto" in
13106	define)
13107	case "$endservent_r_proto" in
13108	''|0) try='int endservent_r(struct servent_data*);'
13109	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13110	esac
13111	case "$endservent_r_proto" in
13112	''|0) try='void endservent_r(struct servent_data*);'
13113	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13114	esac
13115	case "$endservent_r_proto" in
13116	''|0)	d_endservent_r=undef
13117		endservent_r_proto=0
13118		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13119	* )	case "$endservent_r_proto" in
13120		REENTRANT_PROTO*) ;;
13121		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13122		esac
13123		echo "Prototype: $try" ;;
13124	esac
13125	;;
13126	*)	case "$usethreads" in
13127		define) echo "endservent_r has no prototype, not using it." >&4 ;;
13128		esac
13129		d_endservent_r=undef
13130		endservent_r_proto=0
13131		;;
13132	esac
13133	;;
13134*)	endservent_r_proto=0
13135	;;
13136esac
13137
13138: Locate the flags for 'open()'
13139echo " "
13140$cat >try.c <<EOCP
13141#include <sys/types.h>
13142#ifdef I_FCNTL
13143#include <fcntl.h>
13144#endif
13145#ifdef I_SYS_FILE
13146#include <sys/file.h>
13147#endif
13148#$i_stdlib I_STDLIB
13149#ifdef I_STDLIB
13150#include <stdlib.h>
13151#endif
13152int main() {
13153	if(O_RDONLY);
13154#ifdef O_TRUNC
13155	exit(0);
13156#else
13157	exit(1);
13158#endif
13159}
13160EOCP
13161: check sys/file.h first to get FREAD on Sun
13162if $test `./findhdr sys/file.h` && \
13163		set try -DI_SYS_FILE && eval $compile; then
13164	h_sysfile=true;
13165	echo "<sys/file.h> defines the O_* constants..." >&4
13166	if $run ./try; then
13167		echo "and you have the 3 argument form of open()." >&4
13168		val="$define"
13169	else
13170		echo "but not the 3 argument form of open().  Oh, well." >&4
13171		val="$undef"
13172	fi
13173elif $test `./findhdr fcntl.h` && \
13174		set try -DI_FCNTL && eval $compile; then
13175	h_fcntl=true;
13176	echo "<fcntl.h> defines the O_* constants..." >&4
13177	if $run ./try; then
13178		echo "and you have the 3 argument form of open()." >&4
13179		val="$define"
13180	else
13181		echo "but not the 3 argument form of open().  Oh, well." >&4
13182		val="$undef"
13183	fi
13184else
13185	val="$undef"
13186	echo "I can't find the O_* constant definitions!  You got problems." >&4
13187fi
13188set d_open3
13189eval $setvar
13190$rm_try
13191
13192: see if this is a sys/file.h system
13193val=''
13194set sys/file.h val
13195eval $inhdr
13196
13197: do we need to include sys/file.h ?
13198case "$val" in
13199"$define")
13200	echo " "
13201	if $h_sysfile; then
13202		val="$define"
13203		echo "We'll be including <sys/file.h>." >&4
13204	else
13205		val="$undef"
13206		echo "We won't be including <sys/file.h>." >&4
13207	fi
13208	;;
13209*)
13210	h_sysfile=false
13211	;;
13212esac
13213set i_sysfile
13214eval $setvar
13215
13216: see if fcntl.h is there
13217val=''
13218set fcntl.h val
13219eval $inhdr
13220
13221: see if we can include fcntl.h
13222case "$val" in
13223"$define")
13224	echo " "
13225	if $h_fcntl; then
13226		val="$define"
13227		echo "We'll be including <fcntl.h>." >&4
13228	else
13229		val="$undef"
13230		if $h_sysfile; then
13231	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13232		else
13233			echo "We won't be including <fcntl.h>." >&4
13234		fi
13235	fi
13236	;;
13237*)
13238	h_fcntl=false
13239	val="$undef"
13240	;;
13241esac
13242set i_fcntl
13243eval $setvar
13244
13245: see if fork exists
13246set fork d_fork
13247eval $inlibc
13248
13249: see if pipe exists
13250set pipe d_pipe
13251eval $inlibc
13252
13253: check for non-blocking I/O stuff
13254case "$h_sysfile" in
13255true) echo "#include <sys/file.h>" > head.c;;
13256*)
13257       case "$h_fcntl" in
13258       true) echo "#include <fcntl.h>" > head.c;;
13259       *) echo "#include <sys/fcntl.h>" > head.c;;
13260       esac
13261       ;;
13262esac
13263echo " "
13264echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13265case "$o_nonblock" in
13266'')
13267	$cat head.c > try.c
13268	$cat >>try.c <<EOCP
13269#include <stdio.h>
13270#$i_stdlib I_STDLIB
13271#ifdef I_STDLIB
13272#include <stdlib.h>
13273#endif
13274#$i_fcntl I_FCNTL
13275#ifdef I_FCNTL
13276#include <fcntl.h>
13277#endif
13278int main() {
13279#ifdef O_NONBLOCK
13280	printf("O_NONBLOCK\n");
13281	exit(0);
13282#endif
13283#ifdef O_NDELAY
13284	printf("O_NDELAY\n");
13285	exit(0);
13286#endif
13287#ifdef FNDELAY
13288	printf("FNDELAY\n");
13289	exit(0);
13290#endif
13291	exit(0);
13292}
13293EOCP
13294	set try
13295	if eval $compile_ok; then
13296		o_nonblock=`$run ./try`
13297		case "$o_nonblock" in
13298		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13299		*) echo "Seems like we can use $o_nonblock.";;
13300		esac
13301	else
13302		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13303	fi
13304	;;
13305*) echo "Using $hint value $o_nonblock.";;
13306esac
13307$rm_try
13308
13309echo " "
13310echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13311case "$eagain" in
13312'')
13313	case "$d_fork:$d_pipe:$d_alarm" in
13314	define:define:define)
13315	$cat head.c > try.c
13316	$cat >>try.c <<EOCP
13317#include <errno.h>
13318#include <sys/types.h>
13319#include <signal.h>
13320#include <stdio.h>
13321#$i_stdlib I_STDLIB
13322#ifdef I_STDLIB
13323#include <stdlib.h>
13324#endif
13325#$i_fcntl I_FCNTL
13326#ifdef I_FCNTL
13327#include <fcntl.h>
13328#endif
13329#define MY_O_NONBLOCK $o_nonblock
13330#ifndef errno  /* XXX need better Configure test */
13331extern int errno;
13332#endif
13333#$i_unistd I_UNISTD
13334#ifdef I_UNISTD
13335#include <unistd.h>
13336#endif
13337#include <string.h>
13338$signal_t blech(int x) { exit(3); }
13339EOCP
13340	$cat >> try.c <<'EOCP'
13341int main()
13342{
13343	int pd[2];
13344	int pu[2];
13345	char buf[1];
13346	char string[100];
13347	int ret;
13348
13349	ret = pipe(pd);	/* Down: child -> parent */
13350	if (ret != 0)
13351		exit(3);
13352	ret = pipe(pu);	/* Up: parent -> child */
13353	if (ret != 0)
13354		exit(3);
13355	if (0 != fork()) {
13356		close(pd[1]);	/* Parent reads from pd[0] */
13357		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
13358#ifdef F_SETFL
13359		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13360			exit(1);
13361#else
13362		exit(4);
13363#endif
13364		signal(SIGALRM, blech);
13365		alarm(5);
13366		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
13367			exit(2);
13368		sprintf(string, "%d\n", ret);
13369		ret = write(2, string, strlen(string));
13370		if (ret != strlen(string))
13371			exit(3);
13372		alarm(0);
13373#ifdef EAGAIN
13374		if (errno == EAGAIN) {
13375			printf("EAGAIN\n");
13376			goto ok;
13377		}
13378#endif
13379#ifdef EWOULDBLOCK
13380		if (errno == EWOULDBLOCK)
13381			printf("EWOULDBLOCK\n");
13382#endif
13383	ok:
13384		ret = write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
13385		if (ret != 1)
13386			exit(3);
13387		sleep(2);				/* Give it time to close our pipe */
13388		alarm(5);
13389		ret = read(pd[0], buf, 1);	/* Should read EOF */
13390		alarm(0);
13391		sprintf(string, "%d\n", ret);
13392		ret = write(4, string, strlen(string));
13393		if (ret != strlen(string))
13394			exit(3);
13395		exit(0);
13396	}
13397
13398	close(pd[0]);			/* We write to pd[1] */
13399	close(pu[1]);			/* We read from pu[0] */
13400	ret = read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
13401	if (ret != 1)
13402		exit(3);
13403	close(pd[1]);			/* Pipe pd is now fully closed! */
13404	exit(0);				/* Bye bye, thank you for playing! */
13405}
13406EOCP
13407	set try
13408	if eval $compile_ok; then
13409		echo "$startsh" >mtry
13410		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13411		chmod +x mtry
13412		$run ./mtry >/dev/null 2>&1
13413		case $? in
13414		0) eagain=`$cat try.out`;;
13415		1) echo "Could not perform non-blocking setting!";;
13416		2) echo "I did a successful read() for something that was not there!";;
13417		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13418		4) echo "Could not find F_SETFL!";;
13419		*) echo "Something terribly wrong happened during testing.";;
13420		esac
13421		rd_nodata=`$cat try.ret`
13422		echo "A read() system call with no data present returns $rd_nodata."
13423		case "$rd_nodata" in
13424		0|-1) ;;
13425		*)
13426			echo "(That's peculiar, fixing that to be -1.)"
13427			rd_nodata=-1
13428			;;
13429		esac
13430		case "$eagain" in
13431		'')
13432			echo "Forcing errno EAGAIN on read() with no data available."
13433			eagain=EAGAIN
13434			;;
13435		*)
13436			echo "Your read() sets errno to $eagain when no data is available."
13437			;;
13438		esac
13439		status=`$cat try.err`
13440		case "$status" in
13441		0) echo "And it correctly returns 0 to signal EOF.";;
13442		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
13443		*) echo "However, your read() returns '$status' on EOF??";;
13444		esac
13445		val="$define"
13446		if test "$status" = "$rd_nodata"; then
13447			echo "WARNING: you can't distinguish between EOF and no data!"
13448			val="$undef"
13449		fi
13450	else
13451		echo "I can't compile the test program--assuming errno EAGAIN will do."
13452		eagain=EAGAIN
13453	fi
13454	;;
13455	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13456		eagain=EAGAIN
13457		val="$define"
13458		;;
13459	esac
13460	set d_eofnblk
13461	eval $setvar
13462	;;
13463*)
13464	echo "Using $hint value $eagain."
13465	echo "Your read() returns $rd_nodata when no data is present."
13466	case "$d_eofnblk" in
13467	"$define") echo "And you can see EOF because read() returns 0.";;
13468	"$undef") echo "But you can't see EOF status from read() returned value.";;
13469	*)
13470		echo "(Assuming you can't see EOF status from read anyway.)"
13471		d_eofnblk=$undef
13472		;;
13473	esac
13474	;;
13475esac
13476$rm_try head.c mtry
13477
13478: see if erf exists
13479set erf d_erf
13480eval $inlibc
13481
13482: see if erfc exists
13483set erfc d_erfc
13484eval $inlibc
13485
13486: see if exp2 exists
13487set exp2 d_exp2
13488eval $inlibc
13489
13490: see if expm1 exists
13491set expm1 d_expm1
13492eval $inlibc
13493
13494: see if _ptr and _cnt from stdio act std
13495echo " "
13496
13497if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13498	echo "(Looks like you have stdio.h from BSD.)"
13499	case "$stdio_ptr" in
13500	'') stdio_ptr='((fp)->_p)'
13501		ptr_lval=$define
13502		;;
13503	*)	ptr_lval=$d_stdio_ptr_lval;;
13504	esac
13505	case "$stdio_cnt" in
13506	'') stdio_cnt='((fp)->_r)'
13507		cnt_lval=$define
13508		;;
13509	*)	cnt_lval=$d_stdio_cnt_lval;;
13510	esac
13511	case "$stdio_base" in
13512	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13513	esac
13514	case "$stdio_bufsiz" in
13515	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13516	esac
13517elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13518	echo "(Looks like you have stdio.h from Linux.)"
13519	case "$stdio_ptr" in
13520	'') stdio_ptr='((fp)->_IO_read_ptr)'
13521		ptr_lval=$define
13522		;;
13523	*)	ptr_lval=$d_stdio_ptr_lval;;
13524	esac
13525	case "$stdio_cnt" in
13526	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13527		cnt_lval=$undef
13528		;;
13529	*)	cnt_lval=$d_stdio_cnt_lval;;
13530	esac
13531	case "$stdio_base" in
13532	'') stdio_base='((fp)->_IO_read_base)';;
13533	esac
13534	case "$stdio_bufsiz" in
13535	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13536	esac
13537else
13538	case "$stdio_ptr" in
13539	'') stdio_ptr='((fp)->_ptr)'
13540		ptr_lval=$define
13541		;;
13542	*)	ptr_lval=$d_stdio_ptr_lval;;
13543	esac
13544	case "$stdio_cnt" in
13545	'') stdio_cnt='((fp)->_cnt)'
13546		cnt_lval=$define
13547		;;
13548	*)	cnt_lval=$d_stdio_cnt_lval;;
13549	esac
13550	case "$stdio_base" in
13551	'') stdio_base='((fp)->_base)';;
13552	esac
13553	case "$stdio_bufsiz" in
13554	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13555	esac
13556fi
13557
13558: test whether _ptr and _cnt really work
13559echo "Checking how std your stdio is..." >&4
13560$cat >try.c <<EOP
13561#include <stdio.h>
13562#$i_stdlib I_STDLIB
13563#ifdef I_STDLIB
13564#include <stdlib.h>
13565#endif
13566#define FILE_ptr(fp)	$stdio_ptr
13567#define FILE_cnt(fp)	$stdio_cnt
13568int main() {
13569	FILE *fp = fopen("try.c", "r");
13570	char c = getc(fp);
13571	if (
13572		18 <= FILE_cnt(fp) &&
13573		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13574	)
13575		exit(0);
13576	exit(1);
13577}
13578EOP
13579val="$undef"
13580set try
13581if eval $compile && $to try.c; then
13582	if $run ./try; then
13583		echo "Your stdio acts pretty std."
13584		val="$define"
13585	else
13586		echo "Your stdio isn't very std."
13587	fi
13588else
13589	echo "Your stdio doesn't appear very std."
13590fi
13591$rm_try
13592
13593# glibc 2.2.90 and above apparently change stdio streams so Perl's
13594# direct buffer manipulation no longer works.  The Configure tests
13595# should be changed to correctly detect this, but until then,
13596# the following check should at least let perl compile and run.
13597# (This quick fix should be updated before 5.8.1.)
13598# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13599# A. Dougherty, June 3, 2002.
13600case "$d_gnulibc" in
13601$define)
13602	case "$gnulibc_version" in
13603	2.[01]*)  ;;
13604	2.2) ;;
13605	2.2.[0-9]) ;;
13606	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13607		val="$undef"
13608		;;
13609	esac
13610	;;
13611esac
13612set d_stdstdio
13613eval $setvar
13614
13615: Can _ptr be used as an lvalue?
13616case "$d_stdstdio$ptr_lval" in
13617$define$define) val=$define ;;
13618*) val=$undef ;;
13619esac
13620set d_stdio_ptr_lval
13621eval $setvar
13622
13623: Can _cnt be used as an lvalue?
13624case "$d_stdstdio$cnt_lval" in
13625$define$define) val=$define ;;
13626*) val=$undef ;;
13627esac
13628set d_stdio_cnt_lval
13629eval $setvar
13630
13631
13632: test whether setting _ptr sets _cnt as a side effect
13633d_stdio_ptr_lval_sets_cnt="$undef"
13634d_stdio_ptr_lval_nochange_cnt="$undef"
13635case "$d_stdio_ptr_lval$d_stdstdio" in
13636$define$define)
13637	echo "Checking to see what happens if we set the stdio ptr..." >&4
13638$cat >try.c <<EOP
13639#include <stdio.h>
13640/* Can we scream? */
13641/* Eat dust sed :-) */
13642/* In the buffer space, no one can hear you scream. */
13643#$i_stdlib I_STDLIB
13644#ifdef I_STDLIB
13645#include <stdlib.h>
13646#endif
13647#define FILE_ptr(fp)	$stdio_ptr
13648#define FILE_cnt(fp)	$stdio_cnt
13649#include <sys/types.h>
13650int main() {
13651	FILE *fp = fopen("try.c", "r");
13652	int c;
13653	char *ptr;
13654	size_t cnt;
13655	if (!fp) {
13656	    puts("Fail even to read");
13657	    exit(1);
13658	}
13659	c = getc(fp); /* Read away the first # */
13660	if (c == EOF) {
13661	    puts("Fail even to read");
13662	    exit(1);
13663	}
13664	if (!(
13665		18 <= FILE_cnt(fp) &&
13666		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13667	)) {
13668		puts("Fail even to read");
13669		exit (1);
13670	}
13671	ptr = (char*) FILE_ptr(fp);
13672	cnt = (size_t)FILE_cnt(fp);
13673
13674	FILE_ptr(fp) += 42;
13675
13676	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13677		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13678		exit (1);
13679	}
13680	if (FILE_cnt(fp) <= 20) {
13681		printf ("Fail (<20 chars to test)");
13682		exit (1);
13683	}
13684	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13685		puts("Fail compare");
13686		exit (1);
13687	}
13688	if (cnt == FILE_cnt(fp)) {
13689		puts("Pass_unchanged");
13690		exit (0);
13691	}
13692	if (FILE_cnt(fp) == (cnt - 42)) {
13693		puts("Pass_changed");
13694		exit (0);
13695	}
13696	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13697	return 1;
13698
13699}
13700EOP
13701	set try
13702	if eval $compile && $to try.c; then
13703		case `$run ./try` in
13704		Pass_changed)
13705			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13706			d_stdio_ptr_lval_sets_cnt="$define" ;;
13707		Pass_unchanged)
13708			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13709			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13710		Fail*)
13711			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13712		*)
13713			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13714	esac
13715	else
13716		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13717	fi
13718	$rm_try
13719	;;
13720esac
13721
13722: see if _base is also standard
13723val="$undef"
13724case "$d_stdstdio" in
13725$define)
13726	$cat >try.c <<EOP
13727#include <stdio.h>
13728#$i_stdlib I_STDLIB
13729#ifdef I_STDLIB
13730#include <stdlib.h>
13731#endif
13732#define FILE_base(fp)	$stdio_base
13733#define FILE_bufsiz(fp)	$stdio_bufsiz
13734int main() {
13735	FILE *fp = fopen("try.c", "r");
13736	char c = getc(fp);
13737	if (
13738		19 <= FILE_bufsiz(fp) &&
13739		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13740	)
13741		exit(0);
13742	exit(1);
13743}
13744EOP
13745	set try
13746	if eval $compile && $to try.c; then
13747		if $run ./try; then
13748			echo "And its _base field acts std."
13749			val="$define"
13750		else
13751			echo "But its _base field isn't std."
13752		fi
13753	else
13754		echo "However, it seems to be lacking the _base field."
13755	fi
13756	$rm_try
13757	;;
13758esac
13759set d_stdiobase
13760eval $setvar
13761
13762: see if fast_stdio exists
13763val="$undef"
13764case "$d_stdstdio:$d_stdio_ptr_lval" in
13765"$define:$define")
13766	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13767	*$define*)
13768		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13769		val="$define"
13770		;;
13771	esac
13772	;;
13773esac
13774set d_faststdio
13775eval $setvar
13776
13777: see if fchdir exists
13778set fchdir d_fchdir
13779eval $inlibc
13780
13781: see if fchmod exists
13782set fchmod d_fchmod
13783eval $inlibc
13784
13785: check for openat, unlinkat, renameat, linkat, fchmodat
13786set openat d_openat
13787eval $inlibc
13788
13789set unlinkat d_unlinkat
13790eval $inlibc
13791
13792set renameat d_renameat
13793eval $inlibc
13794
13795set linkat d_linkat
13796eval $inlibc
13797
13798set fchmodat d_fchmodat
13799eval $inlibc
13800
13801: see if fchown exists
13802set fchown d_fchown
13803eval $inlibc
13804
13805: see if this is an fcntl system
13806set fcntl d_fcntl
13807eval $inlibc
13808
13809: See if fcntl-based locking works.
13810echo " "
13811$cat >try.c <<EOCP
13812#$i_stdlib I_STDLIB
13813#ifdef I_STDLIB
13814#include <stdlib.h>
13815#endif
13816#include <unistd.h>
13817#include <fcntl.h>
13818#include <signal.h>
13819$signal_t blech(int x) { exit(3); }
13820int main() {
13821#if defined(F_SETLK) && defined(F_SETLKW)
13822     struct flock flock;
13823     int retval, fd;
13824     fd = open("try.c", O_RDONLY);
13825     flock.l_type = F_RDLCK;
13826     flock.l_whence = SEEK_SET;
13827     flock.l_start = flock.l_len = 0;
13828     signal(SIGALRM, blech);
13829     alarm(10);
13830     retval = fcntl(fd, F_SETLK, &flock);
13831     close(fd);
13832     (retval < 0 ? exit(2) : exit(0));
13833#else
13834     exit(2);
13835#endif
13836}
13837EOCP
13838echo "Checking if fcntl-based file locking works... "
13839case "$d_fcntl" in
13840"$define")
13841	set try
13842	if eval $compile_ok; then
13843		if $run ./try; then
13844			echo "Yes, it seems to work."
13845			val="$define"
13846		else
13847			echo "Nope, it didn't work."
13848			val="$undef"
13849			case "$?" in
13850			3) $cat >&4 <<EOM
13851***
13852*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13853*** This is (almost) impossible.
13854*** If your NFS lock daemons are not feeling well, something like
13855*** this may happen, please investigate.  Cannot continue, aborting.
13856***
13857EOM
13858				exit 1
13859				;;
13860			esac
13861		fi
13862	else
13863		echo "I'm unable to compile the test program, so I'll assume not."
13864		val="$undef"
13865	fi
13866	;;
13867*) val="$undef";
13868	echo "Nope, since you don't even have fcntl()."
13869	;;
13870esac
13871set d_fcntl_can_lock
13872eval $setvar
13873$rm_try
13874
13875: check for fd_set items
13876$cat <<EOM
13877
13878Checking to see how well your C compiler handles fd_set and friends ...
13879EOM
13880$cat >try.c <<EOCP
13881#$i_stdlib I_STDLIB
13882#ifdef I_STDLIB
13883#include <stdlib.h>
13884#endif
13885#$i_systime I_SYS_TIME
13886#$i_sysselct I_SYS_SELECT
13887#$d_socket HAS_SOCKET
13888#include <sys/types.h>
13889#ifdef HAS_SOCKET
13890#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13891#endif
13892#ifdef I_SYS_TIME
13893#include <sys/time.h>
13894#endif
13895#ifdef I_SYS_SELECT
13896#include <sys/select.h>
13897#endif
13898int main() {
13899	fd_set fds;
13900
13901#ifdef TRYBITS
13902	if(fds.fds_bits);
13903#endif
13904
13905#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13906	exit(0);
13907#else
13908	exit(1);
13909#endif
13910}
13911EOCP
13912set try -DTRYBITS
13913if eval $compile; then
13914	d_fds_bits="$define"
13915	d_fd_set="$define"
13916	echo "Well, your system knows about the normal fd_set typedef..." >&4
13917	if $run ./try; then
13918		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13919		d_fd_macros="$define"
13920	else
13921		$cat >&4 <<'EOM'
13922but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13923EOM
13924		d_fd_macros="$undef"
13925	fi
13926else
13927	$cat <<'EOM'
13928Hmm, your compiler has some difficulty with fd_set.  Checking further...
13929EOM
13930	set try
13931	if eval $compile; then
13932		d_fds_bits="$undef"
13933		d_fd_set="$define"
13934		echo "Well, your system has some sort of fd_set available..." >&4
13935		if $run ./try; then
13936			echo "and you have the normal fd_set macros." >&4
13937			d_fd_macros="$define"
13938		else
13939			$cat <<'EOM'
13940but not the normal fd_set macros!  Gross!  More work for me...
13941EOM
13942			d_fd_macros="$undef"
13943		fi
13944	else
13945	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13946		d_fd_set="$undef"
13947		d_fds_bits="$undef"
13948		d_fd_macros="$undef"
13949	fi
13950fi
13951$rm_try
13952
13953: see if fdclose exists
13954set fdclose d_fdclose
13955eval $inlibc
13956
13957: see if fdim exists
13958set fdim d_fdim
13959eval $inlibc
13960
13961: see if fegetround exists
13962set fegetround d_fegetround
13963eval $inlibc
13964
13965: see if fgetpos exists
13966set fgetpos d_fgetpos
13967eval $inlibc
13968
13969: see if finite exists
13970set finite d_finite
13971eval $inlibc
13972
13973: see if finitel exists
13974set finitel d_finitel
13975eval $inlibc
13976
13977: see if flock exists
13978set flock d_flock
13979eval $inlibc
13980
13981: see if prototype for flock is available
13982echo " "
13983set d_flockproto flock $i_sysfile sys/file.h
13984eval $hasproto
13985
13986: see if fma exists
13987set fma d_fma
13988eval $inlibc
13989
13990: see if fmax exists
13991set fmax d_fmax
13992eval $inlibc
13993
13994: see if fmin exists
13995set fmin d_fmin
13996eval $inlibc
13997
13998: see if fp_class exists
13999set fp_class d_fp_class
14000eval $inlibc
14001
14002: check for fpclassify
14003echo "Checking to see if you have fpclassify..." >&4
14004$cat >try.c <<EOCP
14005#include <math.h>
14006int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14007EOCP
14008set try
14009if eval $compile; then
14010	val="$define"
14011	echo "You have fpclassify."
14012else
14013	val="$undef"
14014	echo "You do not have fpclassify."
14015fi
14016$rm_try
14017set d_fpclassify
14018eval $setvar
14019
14020: see if fp_classify exists
14021set fp_classify d_fp_classify
14022eval $inlibc
14023
14024: see if fp_classl exists
14025set fp_classl d_fp_classl
14026eval $inlibc
14027
14028: see if pathconf exists
14029set pathconf d_pathconf
14030eval $inlibc
14031
14032: see if fpathconf exists
14033set fpathconf d_fpathconf
14034eval $inlibc
14035
14036: see if fpclass exists
14037set fpclass d_fpclass
14038eval $inlibc
14039
14040: see if fpclassl exists
14041set fpclassl d_fpclassl
14042eval $inlibc
14043
14044: see if fpgetround exists
14045set fpgetround d_fpgetround
14046eval $inlibc
14047
14048: check for fpos64_t
14049echo " "
14050echo "Checking to see if you have fpos64_t..." >&4
14051$cat >try.c <<EOCP
14052#include <stdio.h>
14053int main() { fpos64_t x = 7; }
14054EOCP
14055set try
14056if eval $compile; then
14057	val="$define"
14058	echo "You have fpos64_t."
14059else
14060	val="$undef"
14061	echo "You do not have fpos64_t."
14062	case "$fpossize" in
14063	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14064	esac
14065fi
14066$rm_try
14067set d_fpos64_t
14068eval $setvar
14069
14070: see if frexpl exists
14071set frexpl d_frexpl
14072eval $inlibc
14073
14074: see if this is a sys/param system
14075set sys/param.h i_sysparam
14076eval $inhdr
14077
14078: see if this is a sys/mount.h system
14079set sys/mount.h i_sysmount
14080eval $inhdr
14081
14082: Check for fs_data_s
14083echo " "
14084echo "Checking to see if your system supports struct fs_data..." >&4
14085set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14086eval $hasstruct
14087case "$d_fs_data_s" in
14088"$define")      echo "Yes, it does."   ;;
14089*)              echo "No, it doesn't." ;;
14090esac
14091
14092: see if fseeko exists
14093set fseeko d_fseeko
14094eval $inlibc
14095case "$longsize" in
140968) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14097esac
14098
14099: see if fsetpos exists
14100set fsetpos d_fsetpos
14101eval $inlibc
14102
14103: see if fstatfs exists
14104set fstatfs d_fstatfs
14105eval $inlibc
14106
14107: see if statvfs exists
14108set statvfs d_statvfs
14109eval $inlibc
14110
14111: see if fstatvfs exists
14112set fstatvfs d_fstatvfs
14113eval $inlibc
14114
14115: see if fsync exists
14116set fsync d_fsync
14117eval $inlibc
14118
14119: see if ftello exists
14120set ftello d_ftello
14121eval $inlibc
14122case "$longsize" in
141238) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14124esac
14125
14126: check for a working futimes
14127d_futimes="$undef"
14128echo " "
14129echo "Checking if you have a working futimes()" >&4
14130$cat >try.c <<EOCP
14131#include <stdio.h>
14132#include <stdlib.h>
14133#include <sys/time.h>
14134#include <errno.h>
14135#include <fcntl.h>
14136#include <stdlib.h>
14137
14138int main ()
14139{
14140    int fd, rv;
14141    fd = open ("try.c", O_RDWR);
14142    if (-1 == fd) exit (1);
14143    rv = futimes (fd, NULL);
14144    exit (rv == -1 ? errno : 0);
14145}
14146EOCP
14147set try
14148if eval $compile; then
14149    `$run ./try`
14150    rc=$?
14151    case "$rc" in
14152	0)  echo "Yes, you have" >&4
14153	    d_futimes="$define"
14154	    ;;
14155	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14156	    ;;
14157    esac
14158else
14159    echo "No, it does not (probably harmless)" >&4
14160fi
14161$rm_try
14162
14163: look for gai_strerror
14164echo " "
14165$cat >try.c <<'EOCP'
14166#include <sys/types.h>
14167#include <sys/socket.h>
14168#include <netdb.h>
14169int main ()
14170{
14171    return (gai_strerror (0) ? 0 : 1);
14172    }
14173EOCP
14174set try
14175val="$undef"
14176if eval $compile; then
14177    `$run ./try`
14178    case "$?" in
14179	0)  echo "A working gai_strerror() found." >&4
14180	    val="$define" ;;
14181	*)  echo "gai_strerror() found, but it doesn't work" >&4
14182	    ;;
14183	esac
14184else
14185    echo "gai_strerror() NOT found." >&4
14186    fi
14187set d_gai_strerror
14188eval $setvar
14189$rm_try
14190
14191: see if ndbm.h is available
14192set ndbm.h i_ndbm
14193eval $inhdr
14194: Compatibility location for RedHat 7.1
14195set gdbm/ndbm.h i_gdbmndbm
14196eval $inhdr
14197: Compatibility location for Debian 4.0
14198set gdbm-ndbm.h i_gdbm_ndbm
14199eval $inhdr
14200
14201val="$undef"
14202if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14203	: see if dbm_open exists
14204	set dbm_open d_dbm_open
14205	eval $inlibc
14206	case "$d_dbm_open" in
14207	$undef)
14208		i_ndbm="$undef"
14209		i_gdbmndbm="$undef"
14210		i_gdbm_ndbm="$undef"
14211		echo "We won't be including <ndbm.h>"
14212		val="$undef"
14213		;;
14214	*) val="$define"
14215	   ;;
14216	esac
14217fi
14218set d_ndbm
14219eval $setvar
14220
14221ndbm_hdr_protochk='name=$1; hdr=$2;
14222eval "ihdr=\$""i_$name";
14223val="$undef";
14224if $test "$ihdr" = "$define"; then
14225	$echo "Checking if your <$hdr> uses prototypes..." >&4;
14226	case "$d_cplusplus" in
14227	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14228	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14229	esac;
14230	case "$val" in
14231	$define) $echo "Your <$hdr> seems to have prototypes";;
14232	*) $echo "Your <$hdr> does not seem to have prototypes";;
14233	esac;
14234fi;
14235set "d_${name}_h_uses_prototypes";
14236eval $setvar'
14237
14238set ndbm ndbm.h
14239eval $ndbm_hdr_protochk
14240set gdbmndbm gdbm/ndbm.h
14241eval $ndbm_hdr_protochk
14242set gdbm_ndbm gdbm-ndbm.h
14243eval $ndbm_hdr_protochk
14244
14245: see if getaddrinfo exists
14246set getaddrinfo d_getaddrinfo
14247eval $inlibc
14248
14249: see if getcwd exists
14250set getcwd d_getcwd
14251eval $inlibc
14252
14253: see if getespwnam exists
14254set getespwnam d_getespwnam
14255eval $inlibc
14256
14257: see if getfsstat exists
14258set getfsstat d_getfsstat
14259eval $inlibc
14260
14261: see if getgrent exists
14262set getgrent d_getgrent
14263eval $inlibc
14264
14265: see if getgrent_r exists
14266set getgrent_r d_getgrent_r
14267eval $inlibc
14268case "$d_getgrent_r" in
14269"$define")
14270	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14271	case "$d_getgrent_r_proto:$usethreads" in
14272	":define")	d_getgrent_r_proto=define
14273		set d_getgrent_r_proto getgrent_r $hdrs
14274		eval $hasproto ;;
14275	*)	;;
14276	esac
14277	case "$d_getgrent_r_proto" in
14278	define)
14279	case "$getgrent_r_proto" in
14280	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14281	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14282	esac
14283	case "$getgrent_r_proto" in
14284	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14285	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14286	esac
14287	case "$getgrent_r_proto" in
14288	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14289	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14290	esac
14291	case "$getgrent_r_proto" in
14292	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14293	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14294	esac
14295	case "$getgrent_r_proto" in
14296	''|0) try='int getgrent_r(struct group*, char*, int);'
14297	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14298	esac
14299	case "$getgrent_r_proto" in
14300	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14301	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14302	esac
14303	case "$getgrent_r_proto" in
14304	''|0)	d_getgrent_r=undef
14305		getgrent_r_proto=0
14306		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14307	* )	case "$getgrent_r_proto" in
14308		REENTRANT_PROTO*) ;;
14309		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14310		esac
14311		echo "Prototype: $try" ;;
14312	esac
14313	;;
14314	*)	case "$usethreads" in
14315		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14316		esac
14317		d_getgrent_r=undef
14318		getgrent_r_proto=0
14319		;;
14320	esac
14321	;;
14322*)	getgrent_r_proto=0
14323	;;
14324esac
14325
14326: see if getgrgid_r exists
14327set getgrgid_r d_getgrgid_r
14328eval $inlibc
14329case "$d_getgrgid_r" in
14330"$define")
14331	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14332	case "$d_getgrgid_r_proto:$usethreads" in
14333	":define")	d_getgrgid_r_proto=define
14334		set d_getgrgid_r_proto getgrgid_r $hdrs
14335		eval $hasproto ;;
14336	*)	;;
14337	esac
14338	case "$d_getgrgid_r_proto" in
14339	define)
14340	case "$getgrgid_r_proto" in
14341	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14342	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14343	esac
14344	case "$getgrgid_r_proto" in
14345	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14346	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14347	esac
14348	case "$getgrgid_r_proto" in
14349	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14350	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14351	esac
14352	case "$getgrgid_r_proto" in
14353	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14354	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14355	esac
14356	case "$getgrgid_r_proto" in
14357	''|0)	d_getgrgid_r=undef
14358		getgrgid_r_proto=0
14359		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14360	* )	case "$getgrgid_r_proto" in
14361		REENTRANT_PROTO*) ;;
14362		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14363		esac
14364		echo "Prototype: $try" ;;
14365	esac
14366	;;
14367	*)	case "$usethreads" in
14368		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14369		esac
14370		d_getgrgid_r=undef
14371		getgrgid_r_proto=0
14372		;;
14373	esac
14374	;;
14375*)	getgrgid_r_proto=0
14376	;;
14377esac
14378
14379: see if getgrnam_r exists
14380set getgrnam_r d_getgrnam_r
14381eval $inlibc
14382case "$d_getgrnam_r" in
14383"$define")
14384	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14385	case "$d_getgrnam_r_proto:$usethreads" in
14386	":define")	d_getgrnam_r_proto=define
14387		set d_getgrnam_r_proto getgrnam_r $hdrs
14388		eval $hasproto ;;
14389	*)	;;
14390	esac
14391	case "$d_getgrnam_r_proto" in
14392	define)
14393	case "$getgrnam_r_proto" in
14394	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14395	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14396	esac
14397	case "$getgrnam_r_proto" in
14398	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14399	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14400	esac
14401	case "$getgrnam_r_proto" in
14402	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14403	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14404	esac
14405	case "$getgrnam_r_proto" in
14406	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14407	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14408	esac
14409	case "$getgrnam_r_proto" in
14410	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14411	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14412	esac
14413	case "$getgrnam_r_proto" in
14414	''|0)	d_getgrnam_r=undef
14415		getgrnam_r_proto=0
14416		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14417	* )	case "$getgrnam_r_proto" in
14418		REENTRANT_PROTO*) ;;
14419		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14420		esac
14421		echo "Prototype: $try" ;;
14422	esac
14423	;;
14424	*)	case "$usethreads" in
14425		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14426		esac
14427		d_getgrnam_r=undef
14428		getgrnam_r_proto=0
14429		;;
14430	esac
14431	;;
14432*)	getgrnam_r_proto=0
14433	;;
14434esac
14435
14436: see if gethostbyaddr exists
14437set gethostbyaddr d_gethbyaddr
14438eval $inlibc
14439
14440: see if gethostbyname exists
14441set gethostbyname d_gethbyname
14442eval $inlibc
14443
14444: see if gethostent exists
14445set gethostent d_gethent
14446eval $inlibc
14447
14448: see how we will look up host name
14449echo " "
14450call=''
14451if set gethostname val -f d_gethname; eval $csym; $val; then
14452	echo 'gethostname() found.' >&4
14453	d_gethname="$define"
14454	call=gethostname
14455fi
14456if set uname val -f d_uname; eval $csym; $val; then
14457	if ./xenix; then
14458		$cat <<'EOM'
14459uname() was found, but you're running xenix, and older versions of xenix
14460have a broken uname(). If you don't really know whether your xenix is old
14461enough to have a broken system call, use the default answer.
14462
14463EOM
14464		dflt=y
14465		case "$d_uname" in
14466		"$define") dflt=n;;
14467		esac
14468		rp='Is your uname() broken?'
14469		. ./myread
14470		case "$ans" in
14471		n*) d_uname="$define"; call=uname;;
14472		esac
14473	else
14474		echo 'uname() found.' >&4
14475		d_uname="$define"
14476		case "$call" in
14477		'') call=uname ;;
14478		esac
14479	fi
14480fi
14481case "$d_gethname" in
14482'') d_gethname="$undef";;
14483esac
14484case "$d_uname" in
14485'') d_uname="$undef";;
14486esac
14487case "$d_uname$d_gethname" in
14488*define*)
14489	dflt=n
14490	cat <<EOM
14491
14492Every now and then someone has a $call() that lies about the hostname
14493but can't be fixed for political or economic reasons.  If you wish, I can
14494pretend $call() isn't there and maybe compute hostname at run-time
14495thanks to the '$phostname' command.
14496
14497EOM
14498	rp="Shall I ignore $call() from now on?"
14499	. ./myread
14500	case "$ans" in
14501	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14502	esac;;
14503esac
14504case "$phostname" in
14505'') aphostname='';;
14506*) case "$aphostname" in
14507	/*) ;;
14508	*) set X $phostname
14509		shift
14510		file=$1
14511		shift
14512		file=`./loc $file $file $pth`
14513		aphostname=`echo $file $*`
14514		;;
14515	esac
14516	;;
14517esac
14518case "$d_uname$d_gethname" in
14519*define*) ;;
14520*)
14521	case "$phostname" in
14522	'')
14523		echo "There will be no way for $package to get your hostname." >&4;;
14524	*)
14525	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14526		;;
14527	esac;;
14528esac
14529case "$d_phostname" in
14530'') d_phostname="$undef";;
14531esac
14532
14533: see if gethostbyaddr_r exists
14534set gethostbyaddr_r d_gethostbyaddr_r
14535eval $inlibc
14536case "$d_gethostbyaddr_r" in
14537"$define")
14538	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14539	case "$d_gethostbyaddr_r_proto:$usethreads" in
14540	":define")	d_gethostbyaddr_r_proto=define
14541		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14542		eval $hasproto ;;
14543	*)	;;
14544	esac
14545	case "$d_gethostbyaddr_r_proto" in
14546	define)
14547	case "$gethostbyaddr_r_proto" in
14548	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14549	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14550	esac
14551	case "$gethostbyaddr_r_proto" in
14552	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14553	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14554	esac
14555	case "$gethostbyaddr_r_proto" in
14556	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14557	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14558	esac
14559	case "$gethostbyaddr_r_proto" in
14560	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14561	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14562	esac
14563	case "$gethostbyaddr_r_proto" in
14564	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14565	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14566	esac
14567	case "$gethostbyaddr_r_proto" in
14568	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14569	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14570	esac
14571	case "$gethostbyaddr_r_proto" in
14572	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14573	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14574	esac
14575	case "$gethostbyaddr_r_proto" in
14576	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14577	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14578	esac
14579	case "$gethostbyaddr_r_proto" in
14580	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14581	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14582	esac
14583	case "$gethostbyaddr_r_proto" in
14584	''|0) try='int gethostbyaddr_r(const char*, int, int);'
14585	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14586	esac
14587	case "$gethostbyaddr_r_proto" in
14588	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14589	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14590	esac
14591	case "$gethostbyaddr_r_proto" in
14592	''|0)	d_gethostbyaddr_r=undef
14593		gethostbyaddr_r_proto=0
14594		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14595	* )	case "$gethostbyaddr_r_proto" in
14596		REENTRANT_PROTO*) ;;
14597		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14598		esac
14599		echo "Prototype: $try" ;;
14600	esac
14601	;;
14602	*)	case "$usethreads" in
14603		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14604		esac
14605		d_gethostbyaddr_r=undef
14606		gethostbyaddr_r_proto=0
14607		;;
14608	esac
14609	;;
14610*)	gethostbyaddr_r_proto=0
14611	;;
14612esac
14613
14614: see if gethostbyname_r exists
14615set gethostbyname_r d_gethostbyname_r
14616eval $inlibc
14617case "$d_gethostbyname_r" in
14618"$define")
14619	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14620	case "$d_gethostbyname_r_proto:$usethreads" in
14621	":define")	d_gethostbyname_r_proto=define
14622		set d_gethostbyname_r_proto gethostbyname_r $hdrs
14623		eval $hasproto ;;
14624	*)	;;
14625	esac
14626	case "$d_gethostbyname_r_proto" in
14627	define)
14628	case "$gethostbyname_r_proto" in
14629	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14630	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14631	esac
14632	case "$gethostbyname_r_proto" in
14633	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14634	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14635	esac
14636	case "$gethostbyname_r_proto" in
14637	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14638	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14639	esac
14640	case "$gethostbyname_r_proto" in
14641	''|0)	d_gethostbyname_r=undef
14642		gethostbyname_r_proto=0
14643		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14644	* )	case "$gethostbyname_r_proto" in
14645		REENTRANT_PROTO*) ;;
14646		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14647		esac
14648		echo "Prototype: $try" ;;
14649	esac
14650	;;
14651	*)	case "$usethreads" in
14652		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14653		esac
14654		d_gethostbyname_r=undef
14655		gethostbyname_r_proto=0
14656		;;
14657	esac
14658	;;
14659*)	gethostbyname_r_proto=0
14660	;;
14661esac
14662
14663: see if gethostent_r exists
14664set gethostent_r d_gethostent_r
14665eval $inlibc
14666case "$d_gethostent_r" in
14667"$define")
14668	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14669	case "$d_gethostent_r_proto:$usethreads" in
14670	":define")	d_gethostent_r_proto=define
14671		set d_gethostent_r_proto gethostent_r $hdrs
14672		eval $hasproto ;;
14673	*)	;;
14674	esac
14675	case "$d_gethostent_r_proto" in
14676	define)
14677	case "$gethostent_r_proto" in
14678	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14679	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14680	esac
14681	case "$gethostent_r_proto" in
14682	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14683	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14684	esac
14685	case "$gethostent_r_proto" in
14686	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14687	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14688	esac
14689	case "$gethostent_r_proto" in
14690	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14691	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14692	esac
14693	case "$gethostent_r_proto" in
14694	''|0) try='int gethostent_r(struct hostent*, char*, int);'
14695	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14696	esac
14697	case "$gethostent_r_proto" in
14698	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14699	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14700	esac
14701	case "$gethostent_r_proto" in
14702	''|0)	d_gethostent_r=undef
14703		gethostent_r_proto=0
14704		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14705	* )	case "$gethostent_r_proto" in
14706		REENTRANT_PROTO*) ;;
14707		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14708		esac
14709		echo "Prototype: $try" ;;
14710	esac
14711	;;
14712	*)	case "$usethreads" in
14713		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14714		esac
14715		d_gethostent_r=undef
14716		gethostent_r_proto=0
14717		;;
14718	esac
14719	;;
14720*)	gethostent_r_proto=0
14721	;;
14722esac
14723
14724: see if prototypes for various gethostxxx netdb.h functions are available
14725echo " "
14726set d_gethostprotos gethostent $i_netdb netdb.h
14727eval $hasproto
14728
14729: see if getitimer exists
14730set getitimer d_getitimer
14731eval $inlibc
14732
14733: see if getlogin exists
14734set getlogin d_getlogin
14735eval $inlibc
14736
14737: see if getlogin_r exists
14738set getlogin_r d_getlogin_r
14739eval $inlibc
14740case "$d_getlogin_r" in
14741"$define")
14742	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14743	case "$d_getlogin_r_proto:$usethreads" in
14744	":define")	d_getlogin_r_proto=define
14745		set d_getlogin_r_proto getlogin_r $hdrs
14746		eval $hasproto ;;
14747	*)	;;
14748	esac
14749	case "$d_getlogin_r_proto" in
14750	define)
14751	case "$getlogin_r_proto" in
14752	''|0) try='int getlogin_r(char*, size_t);'
14753	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14754	esac
14755	case "$getlogin_r_proto" in
14756	''|0) try='int getlogin_r(char*, int);'
14757	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14758	esac
14759	case "$getlogin_r_proto" in
14760	''|0) try='char* getlogin_r(char*, size_t);'
14761	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14762	esac
14763	case "$getlogin_r_proto" in
14764	''|0) try='char* getlogin_r(char*, int);'
14765	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14766	esac
14767	case "$getlogin_r_proto" in
14768	''|0)	d_getlogin_r=undef
14769		getlogin_r_proto=0
14770		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14771	* )	case "$getlogin_r_proto" in
14772		REENTRANT_PROTO*) ;;
14773		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14774		esac
14775		echo "Prototype: $try" ;;
14776	esac
14777	;;
14778	*)	case "$usethreads" in
14779		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14780		esac
14781		d_getlogin_r=undef
14782		getlogin_r_proto=0
14783		;;
14784	esac
14785	;;
14786*)	getlogin_r_proto=0
14787	;;
14788esac
14789
14790: see if getmnt exists
14791set getmnt d_getmnt
14792eval $inlibc
14793
14794: see if getmntent exists
14795set getmntent d_getmntent
14796eval $inlibc
14797
14798: see if getnameinfo exists
14799set getnameinfo d_getnameinfo
14800eval $inlibc
14801
14802: see if getnetbyaddr exists
14803set getnetbyaddr d_getnbyaddr
14804eval $inlibc
14805
14806: see if getnetbyname exists
14807set getnetbyname d_getnbyname
14808eval $inlibc
14809
14810: see if getnetent exists
14811set getnetent d_getnent
14812eval $inlibc
14813
14814: see if getnetbyaddr_r exists
14815set getnetbyaddr_r d_getnetbyaddr_r
14816eval $inlibc
14817case "$d_getnetbyaddr_r" in
14818"$define")
14819	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14820	case "$d_getnetbyaddr_r_proto:$usethreads" in
14821	":define")	d_getnetbyaddr_r_proto=define
14822		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14823		eval $hasproto ;;
14824	*)	;;
14825	esac
14826	case "$d_getnetbyaddr_r_proto" in
14827	define)
14828	case "$getnetbyaddr_r_proto" in
14829	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14830	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14831	esac
14832	case "$getnetbyaddr_r_proto" in
14833	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14834	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14835	esac
14836	case "$getnetbyaddr_r_proto" in
14837	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14838	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14839	esac
14840	case "$getnetbyaddr_r_proto" in
14841	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14842	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14843	esac
14844	case "$getnetbyaddr_r_proto" in
14845	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14846	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14847	esac
14848	case "$getnetbyaddr_r_proto" in
14849	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14850	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14851	esac
14852	case "$getnetbyaddr_r_proto" in
14853	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14854	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14855	esac
14856	case "$getnetbyaddr_r_proto" in
14857	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14858	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14859	esac
14860	case "$getnetbyaddr_r_proto" in
14861	''|0)	d_getnetbyaddr_r=undef
14862		getnetbyaddr_r_proto=0
14863		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14864	* )	case "$getnetbyaddr_r_proto" in
14865		REENTRANT_PROTO*) ;;
14866		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14867		esac
14868		echo "Prototype: $try" ;;
14869	esac
14870	;;
14871	*)	case "$usethreads" in
14872		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14873		esac
14874		d_getnetbyaddr_r=undef
14875		getnetbyaddr_r_proto=0
14876		;;
14877	esac
14878	;;
14879*)	getnetbyaddr_r_proto=0
14880	;;
14881esac
14882
14883: see if getnetbyname_r exists
14884set getnetbyname_r d_getnetbyname_r
14885eval $inlibc
14886case "$d_getnetbyname_r" in
14887"$define")
14888	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14889	case "$d_getnetbyname_r_proto:$usethreads" in
14890	":define")	d_getnetbyname_r_proto=define
14891		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14892		eval $hasproto ;;
14893	*)	;;
14894	esac
14895	case "$d_getnetbyname_r_proto" in
14896	define)
14897	case "$getnetbyname_r_proto" in
14898	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14899	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14900	esac
14901	case "$getnetbyname_r_proto" in
14902	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14903	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14904	esac
14905	case "$getnetbyname_r_proto" in
14906	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14907	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14908	esac
14909	case "$getnetbyname_r_proto" in
14910	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14911	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14912	esac
14913	case "$getnetbyname_r_proto" in
14914	''|0)	d_getnetbyname_r=undef
14915		getnetbyname_r_proto=0
14916		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14917	* )	case "$getnetbyname_r_proto" in
14918		REENTRANT_PROTO*) ;;
14919		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14920		esac
14921		echo "Prototype: $try" ;;
14922	esac
14923	;;
14924	*)	case "$usethreads" in
14925		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14926		esac
14927		d_getnetbyname_r=undef
14928		getnetbyname_r_proto=0
14929		;;
14930	esac
14931	;;
14932*)	getnetbyname_r_proto=0
14933	;;
14934esac
14935
14936: see if getnetent_r exists
14937set getnetent_r d_getnetent_r
14938eval $inlibc
14939case "$d_getnetent_r" in
14940"$define")
14941	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14942	case "$d_getnetent_r_proto:$usethreads" in
14943	":define")	d_getnetent_r_proto=define
14944		set d_getnetent_r_proto getnetent_r $hdrs
14945		eval $hasproto ;;
14946	*)	;;
14947	esac
14948	case "$d_getnetent_r_proto" in
14949	define)
14950	case "$getnetent_r_proto" in
14951	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14952	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14953	esac
14954	case "$getnetent_r_proto" in
14955	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14956	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14957	esac
14958	case "$getnetent_r_proto" in
14959	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14960	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14961	esac
14962	case "$getnetent_r_proto" in
14963	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14964	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14965	esac
14966	case "$getnetent_r_proto" in
14967	''|0) try='int getnetent_r(struct netent*, char*, int);'
14968	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14969	esac
14970	case "$getnetent_r_proto" in
14971	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14972	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14973	esac
14974	case "$getnetent_r_proto" in
14975	''|0)	d_getnetent_r=undef
14976		getnetent_r_proto=0
14977		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14978	* )	case "$getnetent_r_proto" in
14979		REENTRANT_PROTO*) ;;
14980		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14981		esac
14982		echo "Prototype: $try" ;;
14983	esac
14984	;;
14985	*)	case "$usethreads" in
14986		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14987		esac
14988		d_getnetent_r=undef
14989		getnetent_r_proto=0
14990		;;
14991	esac
14992	;;
14993*)	getnetent_r_proto=0
14994	;;
14995esac
14996
14997: see if prototypes for various getnetxxx netdb.h functions are available
14998echo " "
14999set d_getnetprotos getnetent $i_netdb netdb.h
15000eval $hasproto
15001
15002: see if getpagesize exists
15003set getpagesize d_getpagsz
15004eval $inlibc
15005
15006: Optional checks for getprotobyname and getprotobynumber
15007
15008: see if getprotobyname exists
15009set getprotobyname d_getpbyname
15010eval $inlibc
15011
15012: see if getprotobynumber exists
15013set getprotobynumber d_getpbynumber
15014eval $inlibc
15015
15016: see if getprotoent exists
15017set getprotoent d_getpent
15018eval $inlibc
15019
15020: see if getpgid exists
15021set getpgid d_getpgid
15022eval $inlibc
15023
15024: see if getpgrp2 exists
15025set getpgrp2 d_getpgrp2
15026eval $inlibc
15027
15028: see if getppid exists
15029set getppid d_getppid
15030eval $inlibc
15031
15032: see if getpriority exists
15033set getpriority d_getprior
15034eval $inlibc
15035
15036: see if getprotobyname_r exists
15037set getprotobyname_r d_getprotobyname_r
15038eval $inlibc
15039case "$d_getprotobyname_r" in
15040"$define")
15041	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15042	case "$d_getprotobyname_r_proto:$usethreads" in
15043	":define")	d_getprotobyname_r_proto=define
15044		set d_getprotobyname_r_proto getprotobyname_r $hdrs
15045		eval $hasproto ;;
15046	*)	;;
15047	esac
15048	case "$d_getprotobyname_r_proto" in
15049	define)
15050	case "$getprotobyname_r_proto" in
15051	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15052	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15053	esac
15054	case "$getprotobyname_r_proto" in
15055	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15056	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15057	esac
15058	case "$getprotobyname_r_proto" in
15059	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15060	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15061	esac
15062	case "$getprotobyname_r_proto" in
15063	''|0)	d_getprotobyname_r=undef
15064		getprotobyname_r_proto=0
15065		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15066	* )	case "$getprotobyname_r_proto" in
15067		REENTRANT_PROTO*) ;;
15068		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15069		esac
15070		echo "Prototype: $try" ;;
15071	esac
15072	;;
15073	*)	case "$usethreads" in
15074		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15075		esac
15076		d_getprotobyname_r=undef
15077		getprotobyname_r_proto=0
15078		;;
15079	esac
15080	;;
15081*)	getprotobyname_r_proto=0
15082	;;
15083esac
15084
15085: see if getprotobynumber_r exists
15086set getprotobynumber_r d_getprotobynumber_r
15087eval $inlibc
15088case "$d_getprotobynumber_r" in
15089"$define")
15090	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15091	case "$d_getprotobynumber_r_proto:$usethreads" in
15092	":define")	d_getprotobynumber_r_proto=define
15093		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15094		eval $hasproto ;;
15095	*)	;;
15096	esac
15097	case "$d_getprotobynumber_r_proto" in
15098	define)
15099	case "$getprotobynumber_r_proto" in
15100	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15101	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15102	esac
15103	case "$getprotobynumber_r_proto" in
15104	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15105	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15106	esac
15107	case "$getprotobynumber_r_proto" in
15108	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15109	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15110	esac
15111	case "$getprotobynumber_r_proto" in
15112	''|0)	d_getprotobynumber_r=undef
15113		getprotobynumber_r_proto=0
15114		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15115	* )	case "$getprotobynumber_r_proto" in
15116		REENTRANT_PROTO*) ;;
15117		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15118		esac
15119		echo "Prototype: $try" ;;
15120	esac
15121	;;
15122	*)	case "$usethreads" in
15123		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15124		esac
15125		d_getprotobynumber_r=undef
15126		getprotobynumber_r_proto=0
15127		;;
15128	esac
15129	;;
15130*)	getprotobynumber_r_proto=0
15131	;;
15132esac
15133
15134: see if getprotoent_r exists
15135set getprotoent_r d_getprotoent_r
15136eval $inlibc
15137case "$d_getprotoent_r" in
15138"$define")
15139	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15140	case "$d_getprotoent_r_proto:$usethreads" in
15141	":define")	d_getprotoent_r_proto=define
15142		set d_getprotoent_r_proto getprotoent_r $hdrs
15143		eval $hasproto ;;
15144	*)	;;
15145	esac
15146	case "$d_getprotoent_r_proto" in
15147	define)
15148	case "$getprotoent_r_proto" in
15149	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15150	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15151	esac
15152	case "$getprotoent_r_proto" in
15153	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15154	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15155	esac
15156	case "$getprotoent_r_proto" in
15157	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15158	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15159	esac
15160	case "$getprotoent_r_proto" in
15161	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15162	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15163	esac
15164	case "$getprotoent_r_proto" in
15165	''|0)	d_getprotoent_r=undef
15166		getprotoent_r_proto=0
15167		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15168	* )	case "$getprotoent_r_proto" in
15169		REENTRANT_PROTO*) ;;
15170		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15171		esac
15172		echo "Prototype: $try" ;;
15173	esac
15174	;;
15175	*)	case "$usethreads" in
15176		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15177		esac
15178		d_getprotoent_r=undef
15179		getprotoent_r_proto=0
15180		;;
15181	esac
15182	;;
15183*)	getprotoent_r_proto=0
15184	;;
15185esac
15186
15187: see if prototypes for various getprotoxxx netdb.h functions are available
15188echo " "
15189set d_getprotoprotos getprotoent $i_netdb netdb.h
15190eval $hasproto
15191
15192: see if getprpwnam exists
15193set getprpwnam d_getprpwnam
15194eval $inlibc
15195
15196: see if getpwent exists
15197set getpwent d_getpwent
15198eval $inlibc
15199
15200: see if getpwent_r exists
15201set getpwent_r d_getpwent_r
15202eval $inlibc
15203case "$d_getpwent_r" in
15204"$define")
15205	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15206	case "$d_getpwent_r_proto:$usethreads" in
15207	":define")	d_getpwent_r_proto=define
15208		set d_getpwent_r_proto getpwent_r $hdrs
15209		eval $hasproto ;;
15210	*)	;;
15211	esac
15212	case "$d_getpwent_r_proto" in
15213	define)
15214	case "$getpwent_r_proto" in
15215	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15216	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15217	esac
15218	case "$getpwent_r_proto" in
15219	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15220	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15221	esac
15222	case "$getpwent_r_proto" in
15223	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15224	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15225	esac
15226	case "$getpwent_r_proto" in
15227	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15228	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15229	esac
15230	case "$getpwent_r_proto" in
15231	''|0) try='int getpwent_r(struct passwd*, char*, int);'
15232	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15233	esac
15234	case "$getpwent_r_proto" in
15235	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15236	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15237	esac
15238	case "$getpwent_r_proto" in
15239	''|0)	d_getpwent_r=undef
15240		getpwent_r_proto=0
15241		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15242	* )	case "$getpwent_r_proto" in
15243		REENTRANT_PROTO*) ;;
15244		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15245		esac
15246		echo "Prototype: $try" ;;
15247	esac
15248	;;
15249	*)	case "$usethreads" in
15250		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15251		esac
15252		d_getpwent_r=undef
15253		getpwent_r_proto=0
15254		;;
15255	esac
15256	;;
15257*)	getpwent_r_proto=0
15258	;;
15259esac
15260
15261: see if getpwnam_r exists
15262set getpwnam_r d_getpwnam_r
15263eval $inlibc
15264case "$d_getpwnam_r" in
15265"$define")
15266	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15267	case "$d_getpwnam_r_proto:$usethreads" in
15268	":define")	d_getpwnam_r_proto=define
15269		set d_getpwnam_r_proto getpwnam_r $hdrs
15270		eval $hasproto ;;
15271	*)	;;
15272	esac
15273	case "$d_getpwnam_r_proto" in
15274	define)
15275	case "$getpwnam_r_proto" in
15276	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15277	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15278	esac
15279	case "$getpwnam_r_proto" in
15280	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15281	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15282	esac
15283	case "$getpwnam_r_proto" in
15284	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15285	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15286	esac
15287	case "$getpwnam_r_proto" in
15288	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15289	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15290	esac
15291	case "$getpwnam_r_proto" in
15292	''|0)	d_getpwnam_r=undef
15293		getpwnam_r_proto=0
15294		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15295	* )	case "$getpwnam_r_proto" in
15296		REENTRANT_PROTO*) ;;
15297		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15298		esac
15299		echo "Prototype: $try" ;;
15300	esac
15301	;;
15302	*)	case "$usethreads" in
15303		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15304		esac
15305		d_getpwnam_r=undef
15306		getpwnam_r_proto=0
15307		;;
15308	esac
15309	;;
15310*)	getpwnam_r_proto=0
15311	;;
15312esac
15313
15314: see if getpwuid_r exists
15315set getpwuid_r d_getpwuid_r
15316eval $inlibc
15317case "$d_getpwuid_r" in
15318"$define")
15319	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15320	case "$d_getpwuid_r_proto:$usethreads" in
15321	":define")	d_getpwuid_r_proto=define
15322		set d_getpwuid_r_proto getpwuid_r $hdrs
15323		eval $hasproto ;;
15324	*)	;;
15325	esac
15326	case "$d_getpwuid_r_proto" in
15327	define)
15328	case "$getpwuid_r_proto" in
15329	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15330	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15331	esac
15332	case "$getpwuid_r_proto" in
15333	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15334	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15335	esac
15336	case "$getpwuid_r_proto" in
15337	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15338	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15339	esac
15340	case "$getpwuid_r_proto" in
15341	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15342	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15343	esac
15344	case "$getpwuid_r_proto" in
15345	''|0)	d_getpwuid_r=undef
15346		getpwuid_r_proto=0
15347		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15348	* )	case "$getpwuid_r_proto" in
15349		REENTRANT_PROTO*) ;;
15350		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15351		esac
15352		echo "Prototype: $try" ;;
15353	esac
15354	;;
15355	*)	case "$usethreads" in
15356		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15357		esac
15358		d_getpwuid_r=undef
15359		getpwuid_r_proto=0
15360		;;
15361	esac
15362	;;
15363*)	getpwuid_r_proto=0
15364	;;
15365esac
15366
15367: Optional checks for getsbyname and getsbyport
15368
15369: see if getservbyname exists
15370set getservbyname d_getsbyname
15371eval $inlibc
15372
15373: see if getservbyport exists
15374set getservbyport d_getsbyport
15375eval $inlibc
15376
15377: see if getservent exists
15378set getservent d_getsent
15379eval $inlibc
15380
15381: see if getservbyname_r exists
15382set getservbyname_r d_getservbyname_r
15383eval $inlibc
15384case "$d_getservbyname_r" in
15385"$define")
15386	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15387	case "$d_getservbyname_r_proto:$usethreads" in
15388	":define")	d_getservbyname_r_proto=define
15389		set d_getservbyname_r_proto getservbyname_r $hdrs
15390		eval $hasproto ;;
15391	*)	;;
15392	esac
15393	case "$d_getservbyname_r_proto" in
15394	define)
15395	case "$getservbyname_r_proto" in
15396	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15397	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15398	esac
15399	case "$getservbyname_r_proto" in
15400	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15401	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15402	esac
15403	case "$getservbyname_r_proto" in
15404	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15405	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15406	esac
15407	case "$getservbyname_r_proto" in
15408	''|0)	d_getservbyname_r=undef
15409		getservbyname_r_proto=0
15410		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15411	* )	case "$getservbyname_r_proto" in
15412		REENTRANT_PROTO*) ;;
15413		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15414		esac
15415		echo "Prototype: $try" ;;
15416	esac
15417	;;
15418	*)	case "$usethreads" in
15419		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15420		esac
15421		d_getservbyname_r=undef
15422		getservbyname_r_proto=0
15423		;;
15424	esac
15425	;;
15426*)	getservbyname_r_proto=0
15427	;;
15428esac
15429
15430: see if getservbyport_r exists
15431set getservbyport_r d_getservbyport_r
15432eval $inlibc
15433case "$d_getservbyport_r" in
15434"$define")
15435	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15436	case "$d_getservbyport_r_proto:$usethreads" in
15437	":define")	d_getservbyport_r_proto=define
15438		set d_getservbyport_r_proto getservbyport_r $hdrs
15439		eval $hasproto ;;
15440	*)	;;
15441	esac
15442	case "$d_getservbyport_r_proto" in
15443	define)
15444	case "$getservbyport_r_proto" in
15445	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15446	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15447	esac
15448	case "$getservbyport_r_proto" in
15449	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15450	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15451	esac
15452	case "$getservbyport_r_proto" in
15453	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15454	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15455	esac
15456	case "$getservbyport_r_proto" in
15457	''|0)	d_getservbyport_r=undef
15458		getservbyport_r_proto=0
15459		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15460	* )	case "$getservbyport_r_proto" in
15461		REENTRANT_PROTO*) ;;
15462		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15463		esac
15464		echo "Prototype: $try" ;;
15465	esac
15466	;;
15467	*)	case "$usethreads" in
15468		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15469		esac
15470		d_getservbyport_r=undef
15471		getservbyport_r_proto=0
15472		;;
15473	esac
15474	;;
15475*)	getservbyport_r_proto=0
15476	;;
15477esac
15478
15479: see if getservent_r exists
15480set getservent_r d_getservent_r
15481eval $inlibc
15482case "$d_getservent_r" in
15483"$define")
15484	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15485	case "$d_getservent_r_proto:$usethreads" in
15486	":define")	d_getservent_r_proto=define
15487		set d_getservent_r_proto getservent_r $hdrs
15488		eval $hasproto ;;
15489	*)	;;
15490	esac
15491	case "$d_getservent_r_proto" in
15492	define)
15493	case "$getservent_r_proto" in
15494	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15495	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15496	esac
15497	case "$getservent_r_proto" in
15498	''|0) try='int getservent_r(struct servent*, char*, int);'
15499	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15500	esac
15501	case "$getservent_r_proto" in
15502	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15503	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15504	esac
15505	case "$getservent_r_proto" in
15506	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15507	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15508	esac
15509	case "$getservent_r_proto" in
15510	''|0)	d_getservent_r=undef
15511		getservent_r_proto=0
15512		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15513	* )	case "$getservent_r_proto" in
15514		REENTRANT_PROTO*) ;;
15515		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15516		esac
15517		echo "Prototype: $try" ;;
15518	esac
15519	;;
15520	*)	case "$usethreads" in
15521		define) echo "getservent_r has no prototype, not using it." >&4 ;;
15522		esac
15523		d_getservent_r=undef
15524		getservent_r_proto=0
15525		;;
15526	esac
15527	;;
15528*)	getservent_r_proto=0
15529	;;
15530esac
15531
15532: see if prototypes for various getservxxx netdb.h functions are available
15533echo " "
15534set d_getservprotos getservent $i_netdb netdb.h
15535eval $hasproto
15536
15537: see if getspnam exists
15538set getspnam d_getspnam
15539eval $inlibc
15540
15541: see if this is a shadow.h system
15542set shadow.h i_shadow
15543eval $inhdr
15544
15545: see if getspnam_r exists
15546set getspnam_r d_getspnam_r
15547eval $inlibc
15548case "$d_getspnam_r" in
15549"$define")
15550	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15551	case "$d_getspnam_r_proto:$usethreads" in
15552	":define")	d_getspnam_r_proto=define
15553		set d_getspnam_r_proto getspnam_r $hdrs
15554		eval $hasproto ;;
15555	*)	;;
15556	esac
15557	case "$d_getspnam_r_proto" in
15558	define)
15559	case "$getspnam_r_proto" in
15560	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15561	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15562	esac
15563	case "$getspnam_r_proto" in
15564	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15565	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15566	esac
15567	case "$getspnam_r_proto" in
15568	''|0)	d_getspnam_r=undef
15569		getspnam_r_proto=0
15570		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15571	* )	case "$getspnam_r_proto" in
15572		REENTRANT_PROTO*) ;;
15573		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15574		esac
15575		echo "Prototype: $try" ;;
15576	esac
15577	;;
15578	*)	case "$usethreads" in
15579		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15580		esac
15581		d_getspnam_r=undef
15582		getspnam_r_proto=0
15583		;;
15584	esac
15585	;;
15586*)	getspnam_r_proto=0
15587	;;
15588esac
15589
15590: see if gettimeofday or ftime exists
15591set gettimeofday d_gettimeod
15592eval $inlibc
15593case "$d_gettimeod" in
15594"$undef")
15595	set ftime d_ftime
15596	eval $inlibc
15597	;;
15598*)
15599	val="$undef"; set d_ftime; eval $setvar
15600	;;
15601esac
15602case "$d_gettimeod$d_ftime" in
15603"$undef$undef")
15604	echo " "
15605	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15606	;;
15607esac
15608
15609: see if gmtime_r exists
15610set gmtime_r d_gmtime_r
15611eval $inlibc
15612case "$d_gmtime_r" in
15613"$define")
15614	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15615	case "$d_gmtime_r_proto:$usethreads" in
15616	":define")	d_gmtime_r_proto=define
15617		set d_gmtime_r_proto gmtime_r $hdrs
15618		eval $hasproto ;;
15619	*)	;;
15620	esac
15621	case "$d_gmtime_r_proto" in
15622	define)
15623	case "$gmtime_r_proto" in
15624	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15625	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15626	esac
15627	case "$gmtime_r_proto" in
15628	''|0) try='int gmtime_r(const time_t*, struct tm*);'
15629	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15630	esac
15631	case "$gmtime_r_proto" in
15632	''|0)	d_gmtime_r=undef
15633		gmtime_r_proto=0
15634		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15635	* )	case "$gmtime_r_proto" in
15636		REENTRANT_PROTO*) ;;
15637		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15638		esac
15639		echo "Prototype: $try" ;;
15640	esac
15641	;;
15642	*)	case "$usethreads" in
15643		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15644		esac
15645		d_gmtime_r=undef
15646		gmtime_r_proto=0
15647		;;
15648	esac
15649	;;
15650*)	gmtime_r_proto=0
15651	;;
15652esac
15653
15654: see if hasmntopt exists
15655set hasmntopt d_hasmntopt
15656eval $inlibc
15657
15658: see if this is a netinet/in.h or sys/in.h system
15659set netinet/in.h i_niin sys/in.h i_sysin
15660eval $inhdr
15661
15662: see if arpa/inet.h has to be included
15663set arpa/inet.h i_arpainet
15664eval $inhdr
15665
15666: see if htonl --and friends-- exists
15667val=''
15668set htonl val
15669eval $inlibc
15670
15671: Maybe they are macros.
15672case "$val" in
15673$undef)
15674	$cat >htonl.c <<EOM
15675#include <stdio.h>
15676#include <sys/types.h>
15677#$i_niin I_NETINET_IN
15678#$i_sysin I_SYS_IN
15679#$i_arpainet I_ARPA_INET
15680#ifdef I_NETINET_IN
15681#include <netinet/in.h>
15682#endif
15683#ifdef I_SYS_IN
15684#include <sys/in.h>
15685#endif
15686#ifdef I_ARPA_INET
15687#include <arpa/inet.h>
15688#endif
15689#ifdef htonl
15690printf("Defined as a macro.");
15691#endif
15692EOM
15693	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15694	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15695		val="$define"
15696		echo "But it seems to be defined as a macro." >&4
15697	fi
15698	$rm -f htonl.?
15699	;;
15700esac
15701set d_htonl
15702eval $setvar
15703
15704: see if hypot exists
15705set hypot d_hypot
15706eval $inlibc
15707
15708: see if ilogb exists
15709set ilogb d_ilogb
15710eval $inlibc
15711
15712: see if ilogbl exists
15713set ilogbl d_ilogbl
15714eval $inlibc
15715
15716: check whether inet_aton exists
15717set inet_aton d_inetaton
15718eval $inlibc
15719
15720: see if inet_ntop exists
15721set inet_ntop d_inetntop
15722eval $inlibc
15723
15724: see if inet_pton exists
15725set inet_pton d_inetpton
15726eval $inlibc
15727
15728: Look for isascii
15729echo " "
15730$cat >isascii.c <<EOCP
15731#include <stdio.h>
15732#include <ctype.h>
15733#$i_stdlib I_STDLIB
15734#ifdef I_STDLIB
15735#include <stdlib.h>
15736#endif
15737int main() {
15738	int c = 'A';
15739	if (isascii(c))
15740		exit(0);
15741	else
15742		exit(1);
15743}
15744EOCP
15745set isascii
15746if eval $compile; then
15747	echo "isascii() found." >&4
15748	val="$define"
15749else
15750	echo "isascii() NOT found." >&4
15751	val="$undef"
15752fi
15753set d_isascii
15754eval $setvar
15755$rm -f isascii*
15756
15757: Look for isblank
15758echo " "
15759$cat >isblank.c <<'EOCP'
15760#include <stdio.h>
15761#include <ctype.h>
15762int main() {
15763	int c = ' ';
15764	if (isblank(c))
15765		return 0 ;
15766	else
15767		return 1 ;
15768}
15769EOCP
15770if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15771	echo "isblank() found." >&4
15772	val="$define"
15773else
15774	echo "isblank() NOT found." >&4
15775	val="$undef"
15776fi
15777set d_isblank
15778eval $setvar
15779$rm -f isblank*
15780
15781: check for isfinite
15782echo "Checking to see if you have isfinite..." >&4
15783$cat >try.c <<EOCP
15784#include <math.h>
15785int main() { return isfinite(0.0); }
15786EOCP
15787set try
15788if eval $compile; then
15789	val="$define"
15790	echo "You have isfinite."
15791else
15792	val="$undef"
15793	echo "You do not have isfinite."
15794fi
15795$rm_try
15796set d_isfinite
15797eval $setvar
15798
15799: see if isfinitel exists
15800set isfinitel d_isfinitel
15801eval $inlibc
15802
15803: check for isinf
15804echo "Checking to see if you have isinf..." >&4
15805$cat >try.c <<EOCP
15806#include <math.h>
15807int main() { return isinf(0.0); }
15808EOCP
15809set try
15810if eval $compile; then
15811	val="$define"
15812	echo "You have isinf."
15813else
15814	val="$undef"
15815	echo "You do not have isinf."
15816fi
15817$rm_try
15818set d_isinf
15819eval $setvar
15820
15821: see if isinfl exists
15822set isinfl d_isinfl
15823eval $inlibc
15824
15825: check for isless
15826echo "Checking to see if you have isless..." >&4
15827$cat >try.c <<EOCP
15828#include <math.h>
15829int main() { return isless(2.0, 1.0); }
15830EOCP
15831set try
15832if eval $compile; then
15833	val="$define"
15834	echo "You have isless."
15835else
15836	val="$undef"
15837	echo "You do not have isless."
15838fi
15839$rm_try
15840set d_isless
15841eval $setvar
15842
15843: check for isnan
15844echo "Checking to see if you have isnan..." >&4
15845$cat >try.c <<EOCP
15846#include <math.h>
15847int main() { return isnan(0.0); }
15848EOCP
15849set try
15850if eval $compile; then
15851	val="$define"
15852	echo "You have isnan."
15853else
15854	val="$undef"
15855	echo "You do not have isnan."
15856fi
15857$rm_try
15858set d_isnan
15859eval $setvar
15860
15861: see if isnanl exists
15862set isnanl d_isnanl
15863eval $inlibc
15864
15865: check for isnormal
15866echo "Checking to see if you have isnormal..." >&4
15867$cat >try.c <<EOCP
15868#include <math.h>
15869int main() { return isnormal(0.0); }
15870EOCP
15871set try
15872if eval $compile; then
15873	val="$define"
15874	echo "You have isnormal."
15875else
15876	val="$undef"
15877	echo "You do not have isnormal."
15878fi
15879$rm_try
15880set d_isnormal
15881eval $setvar
15882
15883: see if j0 exists
15884set j0 d_j0
15885eval $inlibc
15886
15887: see if j0l exists
15888set j0l d_j0l
15889eval $inlibc
15890
15891: see if killpg exists
15892set killpg d_killpg
15893eval $inlibc
15894
15895: see if localeconv exists
15896set localeconv d_locconv
15897eval $inlibc
15898
15899: see if libc has the POSIX.1-2008 currency locale rules
15900case "$d_locconv:$d_lc_monetary_2008" in
15901$define:)
15902	$cat >try.c <<EOCP
15903#include <locale.h>
15904int main() {
15905	struct lconv *lc = localeconv();
15906	char int_p_cs_precedes = lc->int_p_cs_precedes;
15907	return 0;
15908}
15909EOCP
15910	set try
15911	if eval $compile; then
15912		d_lc_monetary_2008="$define"
15913	else
15914		d_lc_monetary_2008="$undef"
15915	fi;
15916	$rm_try
15917	;;
15918esac
15919
15920: see if lchown exists
15921echo " "
15922$cat > try.c <<EOCP
15923#include <pwd.h>
15924#include <stdio.h>
15925#include <stdlib.h>
15926#$i_unistd	I_UNISTD
15927#ifdef I_UNISTD
15928#  include <unistd.h>
15929#endif
15930int main(int argc, char *argv[])
15931{
15932   if (lchown("./try.c", -1, getgid()) == -1) {
15933       exit(EXIT_FAILURE);
15934   }
15935   exit(EXIT_SUCCESS);
15936}
15937EOCP
15938set try
15939if eval $compile && ./try; then
15940    $echo "lchown() found." >&4
15941    val="$define"
15942else
15943    $echo "lchown() NOT found." >&4
15944    val="$undef"
15945fi
15946set d_lchown
15947eval $setvar
15948$rm_try
15949
15950: See if number of significant digits in a double precision number is known
15951echo " "
15952$cat >ldbl_dig.c <<EOM
15953#include <limits.h>
15954#include <float.h>
15955#ifdef LDBL_DIG
15956printf("Contains LDBL_DIG");
15957#endif
15958EOM
15959$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15960if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15961	echo "LDBL_DIG found." >&4
15962	val="$define"
15963else
15964	echo "LDBL_DIG NOT found." >&4
15965	val="$undef"
15966fi
15967$rm -f ldbl_dig.?
15968set d_ldbl_dig
15969eval $setvar
15970
15971: see if lgamma exists
15972set lgamma d_lgamma
15973eval $inlibc
15974
15975: see if lgamma_r exists
15976set lgamma_r d_lgamma_r
15977eval $inlibc
15978
15979: check to see if math.h defines _LIB_VERSION
15980d_libm_lib_version="$undef"
15981echo " "
15982echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15983$cat >try.c <<EOCP
15984#include <unistd.h>
15985#include <math.h>
15986int main (int argc, char *argv[])
15987{
15988    printf ("%d\n", _LIB_VERSION);
15989    return (0);
15990    } /* main */
15991EOCP
15992set try
15993if eval $compile; then
15994    foo=`$run ./try`
15995    echo "Yes, it does ($foo)" >&4
15996    d_libm_lib_version="$define"
15997else
15998    echo "No, it does not (probably harmless)" >&4
15999    fi
16000$rm_try
16001
16002: see if link exists
16003set link d_link
16004eval $inlibc
16005
16006: see if llrint exists
16007set llrint d_llrint
16008eval $inlibc
16009
16010: see if llrintl exists
16011set llrintl d_llrintl
16012eval $inlibc
16013
16014: see if llround exists
16015set llround d_llround
16016eval $inlibc
16017
16018: see if llroundl exists
16019set llroundl d_llroundl
16020eval $inlibc
16021
16022: see if localeconv_l exists
16023set localeconv_l d_localeconv_l
16024eval $inlibc
16025
16026: see if localtime_r exists
16027set localtime_r d_localtime_r
16028eval $inlibc
16029case "$d_localtime_r" in
16030"$define")
16031	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16032	case "$d_localtime_r_proto:$usethreads" in
16033	":define")	d_localtime_r_proto=define
16034		set d_localtime_r_proto localtime_r $hdrs
16035		eval $hasproto ;;
16036	*)	;;
16037	esac
16038	case "$d_localtime_r_proto" in
16039	define)
16040	case "$localtime_r_proto" in
16041	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16042	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16043	esac
16044	case "$localtime_r_proto" in
16045	''|0) try='int localtime_r(const time_t*, struct tm*);'
16046	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16047	esac
16048	case "$localtime_r_proto" in
16049	''|0)	d_localtime_r=undef
16050		localtime_r_proto=0
16051		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16052	* )	case "$localtime_r_proto" in
16053		REENTRANT_PROTO*) ;;
16054		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16055		esac
16056		echo "Prototype: $try" ;;
16057	esac
16058	;;
16059	*)	case "$usethreads" in
16060		define) echo "localtime_r has no prototype, not using it." >&4 ;;
16061		esac
16062		d_localtime_r=undef
16063		localtime_r_proto=0
16064		;;
16065	esac
16066	;;
16067*)	localtime_r_proto=0
16068	;;
16069esac
16070
16071: see if localtime_r calls tzset
16072case "$localtime_r_proto" in
16073REENTRANT_PROTO*)
16074	$cat >try.c <<EOCP
16075/*  Does our libc's localtime_r call tzset ?
16076 *  return 0 if so, 1 otherwise.
16077 */
16078#$i_systypes	I_SYS_TYPES
16079#$i_unistd	I_UNISTD
16080#$i_time	I_TIME
16081#$i_stdlib	I_STDLIB
16082#$i_malloc	I_MALLOC
16083#ifdef I_SYS_TYPES
16084#  include <sys/types.h>
16085#endif
16086#ifdef I_UNISTD
16087#  include <unistd.h>
16088#endif
16089#ifdef I_TIME
16090#  include <time.h>
16091#endif
16092#ifdef I_STDLIB
16093#include <stdlib.h>
16094#endif
16095#include <string.h>
16096#ifdef I_MALLOC
16097#  include <malloc.h>
16098#endif
16099int main()
16100{
16101    time_t t = time(0L);
16102    char w_tz[]="TZ" "=GMT+5",
16103	 e_tz[]="TZ" "=GMT-5",
16104	*tz_e = (char*)malloc(16),
16105	*tz_w = (char*)malloc(16);
16106    struct tm tm_e, tm_w;
16107    memset(&tm_e,'\0',sizeof(struct tm));
16108    memset(&tm_w,'\0',sizeof(struct tm));
16109    strcpy(tz_e,e_tz);
16110    strcpy(tz_w,w_tz);
16111
16112    putenv(tz_e);
16113    localtime_r(&t, &tm_e);
16114
16115    putenv(tz_w);
16116    localtime_r(&t, &tm_w);
16117
16118    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16119	return 1;
16120    return 0;
16121}
16122EOCP
16123	set try
16124	if eval $compile; then
16125	    if $run ./try; then
16126		d_localtime_r_needs_tzset=undef;
16127	    else
16128		d_localtime_r_needs_tzset=define;
16129	    fi;
16130	else
16131	    d_localtime_r_needs_tzset=undef;
16132	fi;
16133     ;;
16134  *)
16135     d_localtime_r_needs_tzset=undef;
16136     ;;
16137esac
16138$rm_try
16139
16140: see if lockf exists
16141set lockf d_lockf
16142eval $inlibc
16143
16144: see if log1p exists
16145set log1p d_log1p
16146eval $inlibc
16147
16148: see if log2 exists
16149set log2 d_log2
16150eval $inlibc
16151
16152: see if logb exists
16153set logb d_logb
16154eval $inlibc
16155
16156: see if lrint exists
16157set lrint d_lrint
16158eval $inlibc
16159
16160: see if lrintl exists
16161set lrintl d_lrintl
16162eval $inlibc
16163
16164: see if lround exists
16165set lround d_lround
16166eval $inlibc
16167
16168: see if lroundl exists
16169set lroundl d_lroundl
16170eval $inlibc
16171
16172: see if prototype for lseek is available
16173echo " "
16174set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16175eval $hasproto
16176
16177: see if lstat exists
16178set lstat d_lstat
16179eval $inlibc
16180
16181: see if madvise exists
16182set madvise d_madvise
16183eval $inlibc
16184
16185: see if malloc_size exists
16186set malloc_size d_malloc_size
16187eval $inlibc
16188
16189: see if malloc_size_good exists
16190set malloc_good_size d_malloc_good_size
16191eval $inlibc
16192
16193: see if malloc_usable_size exists
16194set malloc_usable_size d_malloc_usable_size
16195eval $inlibc
16196
16197: see if mblen exists
16198set mblen d_mblen
16199eval $inlibc
16200
16201: see if mbrlen exists
16202set mbrlen d_mbrlen
16203eval $inlibc
16204
16205: see if mbrtowc exists
16206set mbrtowc d_mbrtowc
16207eval $inlibc
16208
16209: see if mbstowcs exists
16210set mbstowcs d_mbstowcs
16211eval $inlibc
16212
16213: see if mbtowc exists
16214set mbtowc d_mbtowc
16215eval $inlibc
16216
16217: see if memmem exists
16218: We need both a prototype in string.h and the symbol in libc.
16219echo " "
16220d_memmem_proto=''
16221xx1="#$d_gnulibc HAS_GNULIBC"
16222xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16223xx3='#   define _GNU_SOURCE'
16224xx4='#endif'
16225set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16226eval $hasproto
16227case "$d_memmem_proto" in
16228    define) # see if memmem exists
16229	set memmem d_memmem
16230	eval $inlibc
16231	;;
16232    *)  val=$undef
16233	set d_memmem
16234	eval $setvar
16235	;;
16236esac
16237
16238: see if memrchr exists
16239: We need both a prototype in string.h and the symbol in libc.
16240echo " "
16241d_memrchr_proto=''
16242xx1="#$d_gnulibc HAS_GNULIBC"
16243xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16244xx3='#   define _GNU_SOURCE'
16245xx4='#endif'
16246set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16247eval $hasproto
16248case "$d_memrchr_proto" in
16249    define) # see if memrchr exists
16250	set memrchr d_memrchr
16251	eval $inlibc
16252	;;
16253    *)  val=$undef
16254	set d_memrchr
16255	eval $setvar
16256	;;
16257esac
16258
16259: see if mkdir exists
16260set mkdir d_mkdir
16261eval $inlibc
16262
16263: see if mkdtemp exists
16264set mkdtemp d_mkdtemp
16265eval $inlibc
16266
16267: see if mkfifo exists
16268set mkfifo d_mkfifo
16269eval $inlibc
16270
16271: see if mkostemp exists
16272set mkostemp d_mkostemp
16273eval $inlibc
16274
16275: see if mkstemp exists
16276set mkstemp d_mkstemp
16277eval $inlibc
16278
16279: see if mkstemps exists
16280set mkstemps d_mkstemps
16281eval $inlibc
16282
16283: see if mktime exists
16284set mktime d_mktime
16285eval $inlibc
16286
16287: see if sys/mman.h has to be included
16288set sys/mman.h i_sysmman
16289eval $inhdr
16290
16291: see if mmap exists
16292set mmap d_mmap
16293eval $inlibc
16294: see what shmat returns
16295: default to something harmless
16296mmaptype='void *'
16297case "$i_sysmman$d_mmap" in
16298"$define$define")
16299	$cat >mmap.c <<'END'
16300#include <sys/mman.h>
16301void *mmap();
16302END
16303	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16304		mmaptype='void *'
16305	else
16306		mmaptype='caddr_t'
16307	fi
16308	echo "and it returns ($mmaptype)." >&4
16309	;;
16310esac
16311
16312: see if sqrtl exists
16313set sqrtl d_sqrtl
16314eval $inlibc
16315
16316: see if scalbnl exists
16317set scalbnl d_scalbnl
16318eval $inlibc
16319
16320: see if truncl exists
16321set truncl d_truncl
16322eval $inlibc
16323
16324: see if modfl exists
16325set modfl d_modfl
16326eval $inlibc
16327
16328: see if prototype for modfl is available
16329echo " "
16330set d_modflproto modfl define math.h
16331eval $hasproto
16332
16333if $test "$uselongdouble" = "$define"; then
16334    message=""
16335    if $test "$d_sqrtl" != "$define"; then
16336	message="$message sqrtl"
16337    fi
16338    if $test "$d_modfl" != "$define"; then
16339	if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16340	    echo "You have both truncl and copysignl, so I can emulate modfl."
16341	else
16342	    if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16343		echo "You have both aintl and copysignl, so I can emulate modfl."
16344	    else
16345		message="$message modfl"
16346	    fi
16347	fi
16348    fi
16349    if $test "$d_frexpl" != "$define"; then
16350	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16351	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16352	else
16353	    message="$message frexpl"
16354	fi
16355    fi
16356    if $test "$d_ldexpl" != "$define"; then
16357	message="$message ldexpl"
16358    fi
16359
16360    if $test "$message" != ""; then
16361	$cat <<EOM >&4
16362
16363*** You requested the use of long doubles but you do not seem to have
16364*** the following mathematical functions needed for long double support:
16365***    $message
16366*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16367*** Cannot continue, aborting.
16368
16369EOM
16370
16371	exit 1
16372    fi
16373fi
16374
16375: see if mprotect exists
16376set mprotect d_mprotect
16377eval $inlibc
16378
16379: see if msgctl exists
16380set msgctl d_msgctl
16381eval $inlibc
16382
16383: see if msgget exists
16384set msgget d_msgget
16385eval $inlibc
16386
16387: see if msgsnd exists
16388set msgsnd d_msgsnd
16389eval $inlibc
16390
16391: see if msgrcv exists
16392set msgrcv d_msgrcv
16393eval $inlibc
16394
16395: see how much of the 'msg*(2)' library is present.
16396h_msg=true
16397echo " "
16398case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16399*"$undef"*) h_msg=false;;
16400esac
16401case "$osname" in
16402freebsd)
16403    case "`ipcs 2>&1`" in
16404    "SVID messages"*"not configured"*)
16405	echo "Your $osname does not have the msg*(2) configured." >&4
16406        h_msg=false
16407	val="$undef"
16408	set msgctl d_msgctl
16409	eval $setvar
16410	set msgget d_msgget
16411	eval $setvar
16412	set msgsnd d_msgsnd
16413	eval $setvar
16414	set msgrcv d_msgrcv
16415	eval $setvar
16416	;;
16417    esac
16418    ;;
16419esac
16420: we could also check for sys/ipc.h ...
16421if $h_msg && $test `./findhdr sys/msg.h`; then
16422	echo "You have the full msg*(2) library." >&4
16423	val="$define"
16424else
16425	echo "You don't have the full msg*(2) library." >&4
16426	val="$undef"
16427fi
16428set d_msg
16429eval $setvar
16430
16431: Check for msghdr_s
16432echo " "
16433echo "Checking to see if your system supports struct msghdr..." >&4
16434set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16435eval $hasstruct
16436case "$d_msghdr_s" in
16437"$define")      echo "Yes, it does."   ;;
16438*)              echo "No, it doesn't." ;;
16439esac
16440
16441: see if msync exists
16442set msync d_msync
16443eval $inlibc
16444
16445: see if munmap exists
16446set munmap d_munmap
16447eval $inlibc
16448
16449: see if nan exists
16450set nan d_nan
16451eval $inlibc
16452
16453: see if nanosleep exists
16454set nanosleep d_nanosleep
16455eval $inlibc
16456
16457: see if nearbyint exists
16458set nearbyint d_nearbyint
16459eval $inlibc
16460
16461: see if nextafter exists
16462set nextafter d_nextafter
16463eval $inlibc
16464
16465: see if nexttoward exists
16466set nexttoward d_nexttoward
16467eval $inlibc
16468
16469: see if nice exists
16470set nice d_nice
16471eval $inlibc
16472
16473: see if this is a langinfo.h system
16474set langinfo.h i_langinfo
16475eval $inhdr
16476
16477: see if nl_langinfo exists
16478set nl_langinfo d_nl_langinfo
16479eval $inlibc
16480
16481: see if this is a quadmath.h system
16482set quadmath.h i_quadmath
16483eval $inhdr
16484
16485: Check basic sizes
16486echo " "
16487$echo "Choosing the C types to be used for Perl's internal types..." >&4
16488
16489case "$use64bitint:$d_quad:$quadtype" in
16490define:define:?*)
16491	ivtype="$quadtype"
16492	uvtype="$uquadtype"
16493	ivsize=8
16494	uvsize=8
16495	;;
16496*)	ivtype="long"
16497	uvtype="unsigned long"
16498	ivsize=$longsize
16499	uvsize=$longsize
16500	;;
16501esac
16502
16503case "$uselongdouble:$d_longdbl" in
16504define:define)
16505	nvtype="long double"
16506	nvsize=$longdblsize
16507	;;
16508*)	nvtype=double
16509	nvsize=$doublesize
16510	;;
16511esac
16512
16513case "$usequadmath:$i_quadmath" in
16514define:define)
16515  nvtype="__float128"
16516  nvsize=16
16517  case "$libs" in
16518  *quadmath*) ;;
16519  *) $cat <<EOM >&4
16520
16521*** You requested the use of the quadmath library, but you
16522*** do not seem to have the quadmath library installed.
16523*** Cannot continue, aborting.
16524EOM
16525    exit 1
16526    ;;
16527  esac
16528  ;;
16529define:*) $cat <<EOM >&4
16530
16531*** You requested the use of the quadmath library, but you
16532*** do not seem to have the required header, <quadmath.h>.
16533EOM
16534  case "$gccversion" in
16535  [23].*|4.[0-5]*)
16536   $cat <<EOM >&4
16537*** Your gcc looks a bit old:
16538*** $gccversion
16539EOM
16540    ;;
16541  '')
16542   $cat <<EOM >&4
16543*** You are not running a gcc.
16544EOM
16545    ;;
16546  esac
16547  $cat <<EOM >&4
16548*** For the quadmath library you need at least gcc 4.6.
16549*** Cannot continue, aborting.
16550EOM
16551  exit 1
16552  ;;
16553esac
16554
16555$echo "(IV will be "$ivtype", $ivsize bytes)"
16556$echo "(UV will be "$uvtype", $uvsize bytes)"
16557$echo "(NV will be "$nvtype", $nvsize bytes)"
16558
16559$cat >try.c <<EOCP
16560#$i_inttypes I_INTTYPES
16561#ifdef I_INTTYPES
16562#include <inttypes.h>
16563#endif
16564#include <stdio.h>
16565int main() {
16566#ifdef INT8
16567   int8_t i =  INT8_MAX;
16568  uint8_t u = UINT8_MAX;
16569  printf("int8_t\n");
16570#endif
16571#ifdef INT16
16572   int16_t i =  INT16_MAX;
16573  uint16_t u = UINT16_MAX;
16574  printf("int16_t\n");
16575#endif
16576#ifdef INT32
16577   int32_t i =  INT32_MAX;
16578  uint32_t u = UINT32_MAX;
16579  printf("int32_t\n");
16580#endif
16581}
16582EOCP
16583
16584i8type="signed char"
16585u8type="unsigned char"
16586i8size=1
16587u8size=1
16588
16589case "$i16type" in
16590'')	case "$shortsize" in
16591	2)	i16type=short
16592		u16type="unsigned short"
16593		i16size=$shortsize
16594		u16size=$shortsize
16595		;;
16596	esac
16597	;;
16598esac
16599case "$i16type" in
16600'')	set try -DINT16
16601	if eval $compile; then
16602		case "`$run ./try`" in
16603		int16_t)
16604			i16type=int16_t
16605			u16type=uint16_t
16606			i16size=2
16607			u16size=2
16608			;;
16609		esac
16610	fi
16611	;;
16612esac
16613case "$i16type" in
16614'')	if $test $shortsize -ge 2; then
16615		i16type=short
16616		u16type="unsigned short"
16617		i16size=$shortsize
16618		u16size=$shortsize
16619	fi
16620	;;
16621esac
16622
16623case "$i32type" in
16624'')	case "$longsize" in
16625	4)	i32type=long
16626		u32type="unsigned long"
16627		i32size=$longsize
16628		u32size=$longsize
16629		;;
16630	*)	case "$intsize" in
16631		4)	i32type=int
16632			u32type="unsigned int"
16633			i32size=$intsize
16634			u32size=$intsize
16635			;;
16636		esac
16637		;;
16638	esac
16639	;;
16640esac
16641case "$i32type" in
16642'')	set try -DINT32
16643	if eval $compile; then
16644		case "`$run ./try`" in
16645		int32_t)
16646			i32type=int32_t
16647			u32type=uint32_t
16648			i32size=4
16649			u32size=4
16650			;;
16651		esac
16652	fi
16653	;;
16654esac
16655case "$i32type" in
16656'')	if $test $intsize -ge 4; then
16657		i32type=int
16658		u32type="unsigned int"
16659		i32size=$intsize
16660		u32size=$intsize
16661	fi
16662	;;
16663esac
16664
16665case "$i64type" in
16666'')	case "$d_quad:$quadtype" in
16667	define:?*)
16668		i64type="$quadtype"
16669		u64type="$uquadtype"
16670		i64size=8
16671		u64size=8
16672		;;
16673	esac
16674	;;
16675esac
16676
16677$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16678$cat <<EOP >try.c
16679#include <stdio.h>
16680#$i_stdlib I_STDLIB
16681#ifdef I_STDLIB
16682#include <stdlib.h>
16683#endif
16684#include <sys/types.h>
16685#include <signal.h>
16686#ifdef SIGFPE
16687/* volatile so that the compiler has to store it out to memory */
16688volatile int bletched = 0;
16689$signal_t blech(int s) { bletched = 1; }
16690#endif
16691int main() {
16692    $uvtype u = 0;
16693    $nvtype d;
16694    int     n = 8 * $uvsize;
16695    int     i;
16696#ifdef SIGFPE
16697    signal(SIGFPE, blech);
16698#endif
16699
16700    for (i = 0; i < n; i++) {
16701      u = u << 1 | ($uvtype)1;
16702      d = ($nvtype)u;
16703      if (($uvtype)d != u)
16704        break;
16705      if (d <= 0)
16706	break;
16707      d = ($nvtype)(u - 1);
16708      if (($uvtype)d != (u - 1))
16709        break;
16710#ifdef SIGFPE
16711      if (bletched)
16712	break;
16713#endif
16714    }
16715    printf("%d\n", ((i == n) ? -n : i));
16716    exit(0);
16717}
16718EOP
16719set try
16720
16721d_nv_preserves_uv="$undef"
16722if eval $compile; then
16723	nv_preserves_uv_bits="`$run ./try`"
16724fi
16725case "$nv_preserves_uv_bits" in
16726\-[1-9]*)
16727	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16728	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16729	d_nv_preserves_uv="$define"
16730	;;
16731[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16732	d_nv_preserves_uv="$undef" ;;
16733*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
16734	nv_preserves_uv_bits="0" ;;
16735esac
16736$rm_try
16737
16738$echo "Checking to find the largest integer value your NVs can hold..." >&4
16739$cat <<EOP >try.c
16740#include <stdio.h>
16741
16742typedef $nvtype NV;
16743
16744int
16745main() {
16746  NV value = 2;
16747  int count = 1;
16748
16749  while(count < 256) {
16750    /* volatile so that the compiler has to store it out to memory */
16751    volatile NV up = value + 1.0;
16752    volatile NV negated = -value;
16753    volatile NV down = negated - 1.0;
16754    volatile NV got_up = up - value;
16755    int up_good = got_up == 1.0;
16756    int got_down = down - negated;
16757    int down_good = got_down == -1.0;
16758
16759    if (down_good != up_good) {
16760      fprintf(stderr,
16761	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16762	      up_good, (double) got_up, down_good, (double) got_down,
16763	      count, (double) value);
16764      return 1;
16765    }
16766    if (!up_good) {
16767      while (1) {
16768	if (count > 8) {
16769	  count -= 8;
16770	  fputs("256.0", stdout);
16771	} else {
16772	  count--;
16773	  fputs("2.0", stdout);
16774	}
16775	if (!count) {
16776	  puts("");
16777	  return 0;
16778	}
16779	fputs("*", stdout);
16780      }
16781    }
16782    value *= 2;
16783    ++count;
16784  }
16785  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16786	  count, (double) value);
16787  return 1;
16788}
16789EOP
16790set try
16791
16792nv_overflows_integers_at='0'
16793if eval $compile; then
16794    xxx="`$run ./try`"
16795    case "$?" in
16796	0)
16797	    case "$xxx" in
16798		2*)  cat >&4 <<EOM
16799The largest integer your NVs can preserve is equal to $xxx
16800EOM
16801		    nv_overflows_integers_at="$xxx"
16802		    ;;
16803		*)  cat >&4 <<EOM
16804Cannot determine the largest integer value your NVs can hold, unexpected output
16805'$xxx'
16806EOM
16807		    ;;
16808	    esac
16809	    ;;
16810	*)  cat >&4 <<EOM
16811Cannot determine the largest integer value your NVs can hold
16812EOM
16813	    ;;
16814    esac
16815fi
16816$rm_try
16817
16818$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16819$cat <<EOP >try.c
16820#include <stdio.h>
16821#$i_stdlib I_STDLIB
16822#ifdef I_STDLIB
16823#include <stdlib.h>
16824#endif
16825#include <string.h>
16826#include <sys/types.h>
16827#include <signal.h>
16828#ifdef SIGFPE
16829/* volatile so that the compiler has to store it out to memory */
16830volatile int bletched = 0;
16831$signal_t blech(int s) { bletched = 1; }
16832#endif
16833
16834int checkit($nvtype d, const char *where) {
16835    void *v = &d;
16836    unsigned char *p = (unsigned char *)v;
16837    unsigned char *end = p + sizeof(d);
16838    int fail = 0;
16839
16840    while (p < end)
16841	fail += *p++;
16842
16843    if (!fail)
16844	return 0;
16845
16846    p = (unsigned char *)v;
16847    printf("No - %s: 0x", where);
16848    while (p < end)
16849	printf ("%02X", *p++);
16850    printf("\n");
16851    return 1;
16852}
16853
16854int main(int argc, char **argv) {
16855    $nvtype d = 0.0;
16856    int fail = 0;
16857    fail += checkit(d, "0.0");
16858
16859    /* The compiler shouldn't be assuming that bletched is 0  */
16860    d = bletched;
16861
16862    fail += checkit(d, "bleched");
16863
16864#ifdef SIGFPE
16865    signal(SIGFPE, blech);
16866#endif
16867
16868    /* Paranoia - the compiler should have no way of knowing that ANSI says
16869       that argv[argc] will always be NULL.  Actually, if it did assume this it
16870       would be buggy, as this is C and main() can be called from elsewhere in
16871       the program.  */
16872    d = argv[argc] ? 1 : 0;
16873
16874    if (d) {
16875	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16876    }
16877
16878    fail += checkit(d, "ternary");
16879
16880    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16881
16882    if (d != 0.0) {
16883	printf("No - memset doesn't give 0.0\n");
16884	/* This might just blow up:  */
16885	printf("(gives %g)\n", d);
16886	return 1;
16887    }
16888
16889#ifdef SIGFPE
16890    if (bletched) {
16891	printf("No - something bleched\n");
16892	return 1;
16893    }
16894#endif
16895    if (fail) {
16896      printf("No - %d fail(s)\n", fail);
16897      return 1;
16898    }
16899    printf("Yes\n");
16900    return 0;
16901}
16902EOP
16903set try
16904
16905d_nv_zero_is_allbits_zero="$undef"
16906if eval $compile; then
16907    xxx="`$run ./try`"
16908    case "$?" in
16909	0)
16910	    case "$xxx" in
16911		Yes)  cat >&4 <<EOM
169120.0 is represented as all bits zero in memory
16913EOM
16914		    d_nv_zero_is_allbits_zero="$define"
16915		    ;;
16916		*)  cat >&4 <<EOM
169170.0 is not represented as all bits zero in memory
16918EOM
16919		    d_nv_zero_is_allbits_zero="$undef"
16920		    ;;
16921	    esac
16922	    ;;
16923	*)  cat >&4 <<EOM
169240.0 is not represented as all bits zero in memory
16925EOM
16926	    d_nv_zero_is_allbits_zero="$undef"
16927	    ;;
16928    esac
16929fi
16930$rm_try
16931
16932: check for off64_t
16933echo " "
16934echo "Checking to see if you have off64_t..." >&4
16935$cat >try.c <<EOCP
16936#include <sys/types.h>
16937#include <unistd.h>
16938int main() { off64_t x = 7; }
16939EOCP
16940set try
16941if eval $compile; then
16942	val="$define"
16943	echo "You have off64_t."
16944else
16945	val="$undef"
16946	echo "You do not have off64_t."
16947	case "$lseeksize" in
16948	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16949	esac
16950fi
16951$rm_try
16952set d_off64_t
16953eval $setvar
16954
16955: how to create joinable pthreads
16956if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16957	echo " "
16958	echo "Checking what constant to use for creating joinable pthreads..." >&4
16959	$cat >try.c <<'EOCP'
16960#include <pthread.h>
16961int main() {
16962    int detachstate = JOINABLE;
16963}
16964EOCP
16965	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16966	if eval $compile; then
16967		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16968		val="$undef" # Yes, undef.
16969		set d_old_pthread_create_joinable
16970		eval $setvar
16971		val=""
16972		set old_pthread_create_joinable
16973		eval $setvar
16974	else
16975		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16976		if eval $compile; then
16977			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16978			val="$define"
16979			set d_old_pthread_create_joinable
16980			eval $setvar
16981			val=PTHREAD_CREATE_UNDETACHED
16982			set old_pthread_create_joinable
16983			eval $setvar
16984		else
16985			set try -DJOINABLE=__UNDETACHED
16986			if eval $compile; then
16987				echo "You seem to use __UNDETACHED." >&4
16988				val="$define"
16989				set d_old_pthread_create_joinable
16990				eval $setvar
16991				val=__UNDETACHED
16992				set old_pthread_create_joinable
16993				eval $setvar
16994			else
16995				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16996				val="$define"
16997				set d_old_pthread_create_joinable
16998				eval $setvar
16999				val=0
17000				set old_pthread_create_joinable
17001				eval $setvar
17002			fi
17003		fi
17004	fi
17005	$rm_try
17006else
17007    d_old_pthread_create_joinable="$undef"
17008    old_pthread_create_joinable=""
17009fi
17010
17011: see if pause exists
17012set pause d_pause
17013eval $inlibc
17014
17015: see if pipe2 exists
17016set pipe2 d_pipe2
17017eval $inlibc
17018
17019: see if poll exists
17020set poll d_poll
17021eval $inlibc
17022
17023: see if prctl exists
17024set prctl d_prctl
17025eval $inlibc
17026
17027: see if prctl supports PR_SET_NAME
17028d_prctl_set_name=$undef
17029case $d_prctl in
17030    $define)
17031	$cat >try.c <<EOM
17032#ifdef __ANDROID__
17033#include <unistd.h>
17034#endif
17035#include <sys/prctl.h>
17036
17037int main (int argc, char *argv[])
17038{
17039    return (prctl (PR_SET_NAME, "Test"));
17040    } /* main */
17041EOM
17042	set try
17043	if eval $compile_ok && $run ./try; then
17044	    echo "Your prctl (PR_SET_NAME, ...) works"
17045	    d_prctl_set_name=$define
17046	    fi
17047	$rm_try
17048	;;
17049    esac
17050
17051: see if readlink exists
17052set readlink d_readlink
17053eval $inlibc
17054
17055: Check if there is a /proc symlink to the abs path of
17056: the executing program.  We will honor hints of d_procselfexe=$undef
17057: or procselfexe being non-empty, otherwise will try to determine both
17058: if we have readlink.
17059: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17060: referenced, and AmigaOS does not have a proc filesystem anyway.
17061echo " "
17062val="$undef"
17063if $test "X$d_procselfexe" = Xundef; then
17064	procselfexe=''
17065elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17066	val="$define"
17067elif $test "X$d_readlink" = Xdefine; then
17068        : NetBSD first as /proc/self is a symlink to /proc/curproc,
17069        : and it feels more tidy to avoid an extra level of symlink
17070	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17071	while test $# -gt 0; do
17072	    type=$1; try=$2
17073	    shift; shift
17074	    if $issymlink $try; then
17075		$ls -l $try > reflect
17076		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17077		    echo "You have $type-like $try."
17078		    procselfexe='"'$try'"'
17079		    val="$define"
17080		    : This will break out of the loop
17081		    set X; shift
17082		fi
17083	    fi
17084	done
17085fi
17086$rm -f reflect
17087set d_procselfexe
17088eval $setvar
17089
17090: backward compatibility for d_hvfork
17091if test X$d_hvfork != X; then
17092	d_vfork="$d_hvfork"
17093	d_hvfork=''
17094fi
17095: see if there is a vfork
17096val=''
17097set vfork val
17098eval $inlibc
17099
17100d_pseudofork=$undef
17101
17102: Ok, but do we want to use it. vfork is reportedly unreliable in
17103: perl on Solaris 2.x, and probably elsewhere.
17104case "$val" in
17105$define)
17106	echo " "
17107	case "$usevfork" in
17108	false) dflt='n';;
17109	*) dflt='y';;
17110	esac
17111	cat <<'EOM'
17112
17113Perl can only use a vfork() that doesn't suffer from strict
17114restrictions on calling functions or modifying global data in
17115the child.  For example, glibc-2.1 contains such a vfork()
17116that is unsuitable.  If your system provides a proper fork()
17117call, chances are that you do NOT want perl to use vfork().
17118
17119EOM
17120	rp="Do you still want to use vfork()?"
17121	. ./myread
17122	case "$ans" in
17123	y|Y) ;;
17124	*)
17125		echo "Ok, we won't use vfork()."
17126		val="$undef"
17127		;;
17128	esac
17129	;;
17130esac
17131set d_vfork
17132eval $setvar
17133case "$d_vfork" in
17134$define) usevfork='true';;
17135*) usevfork='false';;
17136esac
17137
17138: see whether the pthread_atfork exists
17139$cat >try.c <<EOP
17140#include <pthread.h>
17141#include <stdio.h>
17142int main() {
17143#ifdef  PTHREAD_ATFORK
17144        pthread_atfork(NULL,NULL,NULL);
17145#endif
17146}
17147EOP
17148
17149: see if pthread_atfork exists
17150set try -DPTHREAD_ATFORK
17151if eval $compile; then
17152    val="$define"
17153else
17154    val="$undef"
17155fi
17156case "$usethreads" in
17157$define)
17158        case "$val" in
17159        $define) echo 'pthread_atfork found.' >&4        ;;
17160        *)       echo 'pthread_atfork NOT found.' >&4    ;;
17161        esac
17162esac
17163set d_pthread_atfork
17164eval $setvar
17165
17166: see if pthread_attr_setscope exists
17167set pthread_attr_setscope d_pthread_attr_setscope
17168eval $inlibc
17169
17170: see whether the various POSIXish _yields exist
17171$cat >try.c <<EOP
17172#include <pthread.h>
17173#include <stdio.h>
17174int main() {
17175#ifdef SCHED_YIELD
17176	sched_yield();
17177#else
17178#ifdef PTHREAD_YIELD
17179	pthread_yield();
17180#else
17181#ifdef PTHREAD_YIELD_NULL
17182	pthread_yield(NULL);
17183#endif
17184#endif
17185#endif
17186}
17187EOP
17188: see if sched_yield exists
17189set try -DSCHED_YIELD
17190if eval $compile; then
17191    val="$define"
17192    sched_yield='sched_yield()'
17193else
17194    val="$undef"
17195fi
17196case "$usethreads" in
17197$define)
17198	case "$val" in
17199	$define) echo 'sched_yield() found.' >&4	;;
17200	*)	 echo 'sched_yield() NOT found.' >&4	;;
17201	esac
17202esac
17203set d_sched_yield
17204eval $setvar
17205
17206: see if pthread_yield exists
17207set try -DPTHREAD_YIELD
17208if eval $compile; then
17209    val="$define"
17210    case "$sched_yield" in
17211    '') sched_yield='pthread_yield()' ;;
17212    esac
17213else
17214    set try -DPTHREAD_YIELD_NULL
17215    if eval $compile; then
17216	val="$define"
17217	case "$sched_yield" in
17218	'') sched_yield='pthread_yield(NULL)' ;;
17219	esac
17220    else
17221	val="$undef"
17222    fi
17223fi
17224case "$usethreads" in
17225$define)
17226	case "$val" in
17227	$define) echo 'pthread_yield() found.' >&4	;;
17228	*)	 echo 'pthread_yield() NOT found.' >&4	;;
17229	esac
17230	;;
17231esac
17232set d_pthread_yield
17233eval $setvar
17234case "$sched_yield" in
17235'') sched_yield=undef ;;
17236esac
17237$rm_try
17238
17239: check for ptrdiff_t
17240echo " "
17241echo "Checking to see if you have ptrdiff_t..." >&4
17242$cat >try.c <<EOCP
17243#include <stddef.h>
17244int main() { ptrdiff_t x = 7; }
17245EOCP
17246set try
17247if eval $compile; then
17248	val="$define"
17249	echo "You have ptrdiff_t."
17250else
17251	val="$undef"
17252	echo "You do not have ptrdiff_t."
17253fi
17254$rm_try
17255set d_ptrdiff_t
17256eval $setvar
17257
17258: see if random_r exists
17259set random_r d_random_r
17260eval $inlibc
17261case "$d_random_r" in
17262"$define")
17263	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17264	case "$d_random_r_proto:$usethreads" in
17265	":define")	d_random_r_proto=define
17266		set d_random_r_proto random_r $hdrs
17267		eval $hasproto ;;
17268	*)	;;
17269	esac
17270	case "$d_random_r_proto" in
17271	define)
17272	case "$random_r_proto" in
17273	''|0) try='int random_r(int*, struct random_data*);'
17274	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17275	esac
17276	case "$random_r_proto" in
17277	''|0) try='int random_r(long*, struct random_data*);'
17278	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17279	esac
17280	case "$random_r_proto" in
17281	''|0) try='int random_r(struct random_data*, int32_t*);'
17282	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17283	esac
17284	case "$random_r_proto" in
17285	''|0)	d_random_r=undef
17286		random_r_proto=0
17287		echo "Disabling random_r, cannot determine prototype." >&4 ;;
17288	* )	case "$random_r_proto" in
17289		REENTRANT_PROTO*) ;;
17290		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17291		esac
17292		echo "Prototype: $try" ;;
17293	esac
17294	;;
17295	*)	case "$usethreads" in
17296		define) echo "random_r has no prototype, not using it." >&4 ;;
17297		esac
17298		d_random_r=undef
17299		random_r_proto=0
17300		;;
17301	esac
17302	;;
17303*)	random_r_proto=0
17304	;;
17305esac
17306
17307: see if readdir and friends exist
17308set readdir d_readdir
17309eval $inlibc
17310set seekdir d_seekdir
17311eval $inlibc
17312set telldir d_telldir
17313eval $inlibc
17314set rewinddir d_rewinddir
17315eval $inlibc
17316
17317: see if readdir64_r exists
17318set readdir64_r d_readdir64_r
17319eval $inlibc
17320case "$d_readdir64_r" in
17321"$define")
17322	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17323	case "$d_readdir64_r_proto:$usethreads" in
17324	":define")	d_readdir64_r_proto=define
17325		set d_readdir64_r_proto readdir64_r $hdrs
17326		eval $hasproto ;;
17327	*)	;;
17328	esac
17329	case "$d_readdir64_r_proto" in
17330	define)
17331	case "$readdir64_r_proto" in
17332	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17333	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17334	esac
17335	case "$readdir64_r_proto" in
17336	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17337	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17338	esac
17339	case "$readdir64_r_proto" in
17340	''|0)	d_readdir64_r=undef
17341		readdir64_r_proto=0
17342		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17343	* )	case "$readdir64_r_proto" in
17344		REENTRANT_PROTO*) ;;
17345		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17346		esac
17347		echo "Prototype: $try" ;;
17348	esac
17349	;;
17350	*)	case "$usethreads" in
17351		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17352		esac
17353		d_readdir64_r=undef
17354		readdir64_r_proto=0
17355		;;
17356	esac
17357	;;
17358*)	readdir64_r_proto=0
17359	;;
17360esac
17361
17362: see if readdir_r exists
17363set readdir_r d_readdir_r
17364eval $inlibc
17365case "$d_readdir_r" in
17366"$define")
17367	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17368	case "$d_readdir_r_proto:$usethreads" in
17369	":define")	d_readdir_r_proto=define
17370		set d_readdir_r_proto readdir_r $hdrs
17371		eval $hasproto ;;
17372	*)	;;
17373	esac
17374	case "$d_readdir_r_proto" in
17375	define)
17376	case "$readdir_r_proto" in
17377	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17378	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17379	esac
17380	case "$readdir_r_proto" in
17381	''|0) try='int readdir_r(DIR*, struct dirent*);'
17382	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17383	esac
17384	case "$readdir_r_proto" in
17385	''|0)	d_readdir_r=undef
17386		readdir_r_proto=0
17387		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17388	* )	case "$readdir_r_proto" in
17389		REENTRANT_PROTO*) ;;
17390		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17391		esac
17392		echo "Prototype: $try" ;;
17393	esac
17394	;;
17395	*)	case "$usethreads" in
17396		define) echo "readdir_r has no prototype, not using it." >&4 ;;
17397		esac
17398		d_readdir_r=undef
17399		readdir_r_proto=0
17400		;;
17401	esac
17402	;;
17403*)	readdir_r_proto=0
17404	;;
17405esac
17406
17407: see if readv exists
17408set readv d_readv
17409eval $inlibc
17410
17411: see if recvmsg exists
17412set recvmsg d_recvmsg
17413eval $inlibc
17414
17415: see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17416echo " "
17417if set regcomp val -f d_regcomp; eval $csym; $val; then
17418	echo 'regcomp() found.' >&4
17419	d_regcomp="$define"
17420	d_regcmp="$undef"
17421	d_re_comp="$undef"
17422elif set regcmp val -f d_regcmp; eval $csym; $val; then
17423	echo 'regcmp() found.' >&4
17424	d_regcmp="$define"
17425	d_regcomp="$undef"
17426	d_re_comp="$undef"
17427elif set re_comp val -f d_re_comp; eval $csym; $val; then
17428	echo 're_comp() found, assuming re_exec() also exists.' >&4
17429	d_re_comp="$define"
17430	d_regcomp="$undef"
17431	d_regcmp="$undef"
17432else
17433	$cat >&4 <<EOM
17434No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17435EOM
17436	d_regcmp="$undef"
17437	d_re_comp="$undef"
17438	d_regcomp="$undef"
17439fi
17440
17441: see if remainder exists
17442set remainder d_remainder
17443eval $inlibc
17444
17445: see if remquo exists
17446set remquo d_remquo
17447eval $inlibc
17448
17449: see if rename exists
17450set rename d_rename
17451eval $inlibc
17452
17453: see if rint exists
17454set rint d_rint
17455eval $inlibc
17456
17457: see if rmdir exists
17458set rmdir d_rmdir
17459eval $inlibc
17460
17461: see if round exists
17462set round d_round
17463eval $inlibc
17464
17465: see if prototype for sbrk is available
17466echo " "
17467set d_sbrkproto sbrk $i_unistd unistd.h
17468eval $hasproto
17469
17470: see if scalbn exists
17471set scalbn d_scalbn
17472eval $inlibc
17473
17474: see if select exists
17475set select d_select
17476eval $inlibc
17477
17478: see if semctl exists
17479set semctl d_semctl
17480eval $inlibc
17481
17482: see if semget exists
17483set semget d_semget
17484eval $inlibc
17485
17486: see if semop exists
17487set semop d_semop
17488eval $inlibc
17489
17490: see how much of the 'sem*(2)' library is present.
17491h_sem=true
17492echo " "
17493case "$d_semctl$d_semget$d_semop" in
17494*"$undef"*) h_sem=false;;
17495esac
17496case "$osname" in
17497freebsd)
17498    case "`ipcs 2>&1`" in
17499    "SVID messages"*"not configured"*)
17500	echo "Your $osname does not have the sem*(2) configured." >&4
17501        h_sem=false
17502	val="$undef"
17503	set semctl d_semctl
17504	eval $setvar
17505	set semget d_semget
17506	eval $setvar
17507	set semop d_semop
17508	eval $setvar
17509	;;
17510    esac
17511    ;;
17512esac
17513: we could also check for sys/ipc.h ...
17514if $h_sem && $test `./findhdr sys/sem.h`; then
17515	echo "You have the full sem*(2) library." >&4
17516	val="$define"
17517else
17518	echo "You don't have the full sem*(2) library." >&4
17519	val="$undef"
17520fi
17521set d_sem
17522eval $setvar
17523
17524: see whether sys/sem.h defines union semun
17525echo " "
17526$cat > try.c <<'END'
17527#include <sys/types.h>
17528#include <sys/ipc.h>
17529#include <sys/sem.h>
17530int main () { union semun semun; semun.buf = 0; }
17531END
17532set try
17533if eval $compile; then
17534    echo "You have union semun in <sys/sem.h>." >&4
17535    val="$define"
17536else
17537    echo "You do not have union semun in <sys/sem.h>." >&4
17538    val="$undef"
17539fi
17540$rm_try
17541set d_union_semun
17542eval $setvar
17543
17544: see how to do semctl IPC_STAT
17545case "$d_sem" in
17546$define)
17547    echo " "
17548    $cat > tryh.h <<END
17549#ifndef S_IRUSR
17550#   ifdef S_IREAD
17551#	define S_IRUSR S_IREAD
17552#	define S_IWUSR S_IWRITE
17553#	define S_IXUSR S_IEXEC
17554#   else
17555#	define S_IRUSR 0400
17556#	define S_IWUSR 0200
17557#	define S_IXUSR 0100
17558#   endif
17559#   define S_IRGRP (S_IRUSR>>3)
17560#   define S_IWGRP (S_IWUSR>>3)
17561#   define S_IXGRP (S_IXUSR>>3)
17562#   define S_IROTH (S_IRUSR>>6)
17563#   define S_IWOTH (S_IWUSR>>6)
17564#   define S_IXOTH (S_IXUSR>>6)
17565#endif
17566#ifndef S_IRWXU
17567#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17568#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17569#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17570#endif
17571END
17572    : see whether semctl IPC_STAT can use union semun
17573    case "$d_semctl_semun" in
17574    '')
17575      val="$undef"
17576      $cat > try.c <<END
17577#include <sys/types.h>
17578#include <sys/ipc.h>
17579#include <sys/sem.h>
17580#include <sys/stat.h>
17581#include <stdio.h>
17582#include <errno.h>
17583#include "tryh.h"
17584#ifndef errno
17585extern int errno;
17586#endif
17587#$d_union_semun HAS_UNION_SEMUN
17588int main() {
17589    union semun
17590#ifndef HAS_UNION_SEMUN
17591    {
17592	int val;
17593	struct semid_ds *buf;
17594	unsigned short *array;
17595    }
17596#endif
17597    arg;
17598    int sem, st;
17599
17600#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17601    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17602    if (sem > -1) {
17603	struct semid_ds argbuf;
17604	arg.buf = &argbuf;
17605#	ifdef IPC_STAT
17606	st = semctl(sem, 0, IPC_STAT, arg);
17607	if (st == 0)
17608	    printf("semun\n");
17609	else
17610#	endif /* IPC_STAT */
17611	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17612#	ifdef IPC_RMID
17613	if (semctl(sem, 0, IPC_RMID, arg) != 0)
17614#	endif /* IPC_RMID */
17615	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17616    } else
17617#endif /* IPC_PRIVATE && ... */
17618	printf("semget failed: errno = %d\n", errno);
17619  return 0;
17620}
17621END
17622      set try
17623      if eval $compile; then
17624	  xxx=`$run ./try`
17625          case "$xxx" in
17626          semun) val="$define" ;;
17627          esac
17628      fi
17629      $rm_try
17630      set d_semctl_semun
17631      eval $setvar
17632      ;;
17633    esac
17634    case "$d_semctl_semun" in
17635    $define)
17636        echo "You can use union semun for semctl IPC_STAT." >&4
17637	also='also'
17638        ;;
17639    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17640	also=''
17641        ;;
17642    esac
17643
17644    : see whether semctl IPC_STAT can use struct semid_ds pointer
17645    case "$d_semctl_semid_ds" in
17646    '')
17647      val="$undef"
17648      $cat > try.c <<'END'
17649#include <sys/types.h>
17650#include <sys/ipc.h>
17651#include <sys/sem.h>
17652#include <sys/stat.h>
17653#include "tryh.h"
17654#include <stdio.h>
17655#include <errno.h>
17656#ifndef errno
17657extern int errno;
17658#endif
17659int main() {
17660    union semun
17661#ifndef HAS_UNION_SEMUN
17662    {
17663	int val;
17664	struct semid_ds *buf;
17665	unsigned short *array;
17666    }
17667#endif
17668    arg;
17669    struct semid_ds argbuf;
17670    int sem, st;
17671
17672#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17673    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17674    if (sem > -1) {
17675	arg.buf = &argbuf;
17676#	ifdef IPC_STAT
17677	st = semctl(sem, 0, IPC_STAT, arg);
17678	if (st == 0)
17679	    printf("semid_ds\n");
17680	else
17681#	endif /* IPC_STAT */
17682	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17683#	ifdef IPC_RMID
17684	if (semctl(sem, 0, IPC_RMID, arg) != 0)
17685#	endif /* IPC_RMID */
17686	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17687    } else
17688#endif /* IPC_PRIVATE && ... */
17689	printf("semget failed: errno = %d\n", errno);
17690
17691    return 0;
17692}
17693END
17694      set try
17695      if eval $compile; then
17696          xxx=`$run ./try`
17697          case "$xxx" in
17698          semid_ds) val="$define" ;;
17699          esac
17700      fi
17701      $rm_try
17702      set d_semctl_semid_ds
17703      eval $setvar
17704      ;;
17705    esac
17706    case "$d_semctl_semid_ds" in
17707    $define)
17708        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17709        ;;
17710    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17711        ;;
17712    esac
17713    ;;
17714*)  val="$undef"
17715
17716    # We do not have the full sem*(2) library, so assume we can not
17717    # use either.
17718
17719    set d_semctl_semun
17720    eval $setvar
17721
17722    set d_semctl_semid_ds
17723    eval $setvar
17724    ;;
17725esac
17726$rm_try tryh.h
17727
17728: see if sendmsg exists
17729set sendmsg d_sendmsg
17730eval $inlibc
17731
17732: see if setegid exists
17733set setegid d_setegid
17734eval $inlibc
17735
17736: see if seteuid exists
17737set seteuid d_seteuid
17738eval $inlibc
17739
17740: see if setgrent exists
17741set setgrent d_setgrent
17742eval $inlibc
17743
17744: see if setgrent_r exists
17745set setgrent_r d_setgrent_r
17746eval $inlibc
17747case "$d_setgrent_r" in
17748"$define")
17749	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17750	case "$d_setgrent_r_proto:$usethreads" in
17751	":define")	d_setgrent_r_proto=define
17752		set d_setgrent_r_proto setgrent_r $hdrs
17753		eval $hasproto ;;
17754	*)	;;
17755	esac
17756	case "$d_setgrent_r_proto" in
17757	define)
17758	case "$setgrent_r_proto" in
17759	''|0) try='int setgrent_r(FILE**);'
17760	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17761	esac
17762	case "$setgrent_r_proto" in
17763	''|0) try='void setgrent_r(FILE**);'
17764	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17765	esac
17766	case "$setgrent_r_proto" in
17767	''|0)	d_setgrent_r=undef
17768		setgrent_r_proto=0
17769		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17770	* )	case "$setgrent_r_proto" in
17771		REENTRANT_PROTO*) ;;
17772		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17773		esac
17774		echo "Prototype: $try" ;;
17775	esac
17776	;;
17777	*)	case "$usethreads" in
17778		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17779		esac
17780		d_setgrent_r=undef
17781		setgrent_r_proto=0
17782		;;
17783	esac
17784	;;
17785*)	setgrent_r_proto=0
17786	;;
17787esac
17788
17789: see if sethostent exists
17790set sethostent d_sethent
17791eval $inlibc
17792
17793: see if sethostent_r exists
17794set sethostent_r d_sethostent_r
17795eval $inlibc
17796case "$d_sethostent_r" in
17797"$define")
17798	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17799	case "$d_sethostent_r_proto:$usethreads" in
17800	":define")	d_sethostent_r_proto=define
17801		set d_sethostent_r_proto sethostent_r $hdrs
17802		eval $hasproto ;;
17803	*)	;;
17804	esac
17805	case "$d_sethostent_r_proto" in
17806	define)
17807	case "$sethostent_r_proto" in
17808	''|0) try='int sethostent_r(int, struct hostent_data*);'
17809	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17810	esac
17811	case "$sethostent_r_proto" in
17812	''|0) try='void sethostent_r(int, struct hostent_data*);'
17813	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17814	esac
17815	case "$sethostent_r_proto" in
17816	''|0)	d_sethostent_r=undef
17817		sethostent_r_proto=0
17818		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17819	* )	case "$sethostent_r_proto" in
17820		REENTRANT_PROTO*) ;;
17821		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17822		esac
17823		echo "Prototype: $try" ;;
17824	esac
17825	;;
17826	*)	case "$usethreads" in
17827		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17828		esac
17829		d_sethostent_r=undef
17830		sethostent_r_proto=0
17831		;;
17832	esac
17833	;;
17834*)	sethostent_r_proto=0
17835	;;
17836esac
17837
17838: see if setitimer exists
17839set setitimer d_setitimer
17840eval $inlibc
17841
17842: see if setlinebuf exists
17843set setlinebuf d_setlinebuf
17844eval $inlibc
17845
17846: see if locale.h is available
17847set locale.h i_locale
17848eval $inhdr
17849
17850: see if this system has wctype.h
17851set wctype.h i_wctype
17852eval $inhdr
17853
17854: see if towupper exists
17855set towupper d_towupper
17856eval $inlibc
17857
17858: check for setlocale function and behavior
17859$cat <<EOM
17860
17861Checking to see if you have setlocale() and its behavior
17862EOM
17863$cat >try.c <<EOCP
17864#include <stdlib.h>
17865#include <string.h>
17866#$i_locale I_LOCALE
17867#ifdef I_LOCALE
17868#  include <locale.h>
17869#endif
17870#$i_wctype I_WCTYPE
17871#ifdef I_WCTYPE
17872#  include <wctype.h>
17873#endif
17874
17875int main() {
17876    const char * invalid_name = "\a";   /* This is really invalid! */
17877    int accepts_any_locale_name = 0;
17878    int has_C_UTF8 = 0;
17879    unsigned char bad_setlocale = 255;
17880
17881    /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17882     * disabled.  It's hard to imagine an instance where meaningful locale
17883     * handling could be done without LC_CTYPE */
17884    const char *  name = setlocale(LC_CTYPE, "C");
17885
17886    if (name == NULL || strcmp(name, "C") != 0) {
17887        exit(bad_setlocale);
17888    }
17889
17890    name = setlocale(LC_CTYPE, invalid_name);
17891    if (name != NULL) {
17892
17893        /* Let it pass if it accepts the name but gives back one of the C
17894         * locales */
17895        if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17896            accepts_any_locale_name = 1;
17897        }
17898    }
17899
17900    name = setlocale(LC_CTYPE, "C.UTF-8");
17901    if (name != NULL) {
17902        unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17903
17904#$d_towupper HAS_TOWUPPER
17905#ifdef HAS_TOWUPPER
17906
17907        /* We assume that if the machine doesn't have the C99 towupper, it
17908         * doesn't have C.UTF-8, even if we successfully changed locales to
17909         * include it.  This seems safer even on platforms that didn't accept
17910         * the really invalid name */
17911
17912        if (towupper(y_with_diaeresis) == 0x178) {
17913            has_C_UTF8 = 1;
17914        }
17915
17916#endif
17917
17918    }
17919
17920#if 0
17921
17922    /* Currently unused code to determine if LC_ALL with disparate values uses
17923     * category = value pairs or positional, and to determine the separator
17924     * between the categories.  We could add code so that if the separator were
17925     * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17926     * every possible ASCII separator would fit in the 5 bits available in the
17927     * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17928     * positional, we probably would want to know the order of the categories.
17929     * Using a file between the C program and the shell script would really be
17930     * require to do that */
17931#ifdef LC_ALL
17932
17933    unsigned char min_separator = ' ' - 1;
17934    unsigned char separator = min_separator;
17935    int uses_name_value_pair_names = 0;
17936
17937    name = setlocale(LC_ALL, "C");
17938    if (name == NULL || strcmp(name, "C") != 0) {
17939        exit(bad_setlocale);
17940    }
17941
17942    if (has_C_UTF8) {
17943        char * pos;
17944
17945        name = setlocale(LC_CTYPE, "C.UTF-8");
17946        if (name == NULL) {
17947            exit(bad_setlocale);
17948        }
17949        name = setlocale(LC_ALL, NULL);
17950        if (name == NULL) {
17951            exit(bad_setlocale);
17952        }
17953
17954        pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17955        if (pos != NULL) {
17956            uses_name_value_pair_names = 1;
17957            if (pos == name) {
17958                separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17959            }
17960            else {
17961                separator = *(pos - 1);
17962            }
17963        }
17964        else {
17965            pos = strstr(name, "C.UTF-8");
17966            if (pos == NULL) {
17967                /* bad */
17968            }
17969            else if (pos == name) {
17970                separator = name[sizeof("C.UTF-8") - 1];
17971            }
17972            else {
17973                separator = *(pos - 1);
17974            }
17975        }
17976    }
17977
17978#endif
17979#endif
17980
17981    exit( 0 /* (separator - min_separator) << 3
17982        | uses_name_value_pair_names      << 2
17983          */
17984        | has_C_UTF8                      << 1
17985        | accepts_any_locale_name);
17986
17987}
17988EOCP
17989set try
17990if eval $compile; then
17991    echo "Your system has setlocale()..." >&4
17992    $run ./try
17993    case $? in
17994        0) echo "and it seems sane" >&4
17995           d_setlocale="$define"
17996           d_setlocale_accepts_any_locale_name="$undef"
17997           d_has_C_UTF8="false"
17998           ;;
17999        1) echo "and it seems sane, but accepts any locale name as valid" >&4
18000           d_setlocale="$define"
18001           d_setlocale_accepts_any_locale_name="$define"
18002           d_has_C_UTF8="false"
18003           ;;
18004        2) echo "and it seems sane" >&4
18005           d_setlocale="$define"
18006           d_setlocale_accepts_any_locale_name="$undef"
18007           d_has_C_UTF8="true"
18008           ;;
18009        3) echo "and it seems sane, but accepts any locale name as valid" >&4
18010           d_setlocale="$define"
18011           d_setlocale_accepts_any_locale_name="$define"
18012           d_has_C_UTF8="true"
18013           ;;
18014        *) echo "but it doesn't seem to work, so we won't use it." >&4
18015           d_setlocale="$undef"
18016           d_setlocale_accepts_any_locale_name="$undef"
18017           d_has_C_UTF8="false"
18018           ;;
18019    esac
18020else
18021    echo "your system does not have setlocale()" >&4
18022    d_setlocale="$undef"
18023    d_setlocale_accepts_any_locale_name="$undef"
18024    d_has_C_UTF8="false"
18025fi
18026$rm_try
18027
18028: see if setlocale_r exists
18029set setlocale_r d_setlocale_r
18030eval $inlibc
18031case "$d_setlocale_r" in
18032"$define")
18033	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18034	case "$d_setlocale_r_proto:$usethreads" in
18035	":define")	d_setlocale_r_proto=define
18036		set d_setlocale_r_proto setlocale_r $hdrs
18037		eval $hasproto ;;
18038	*)	;;
18039	esac
18040	case "$d_setlocale_r_proto" in
18041	define)
18042	case "$setlocale_r_proto" in
18043	''|0) try='int setlocale_r(int, const char*, char*, int);'
18044	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18045	esac
18046	case "$setlocale_r_proto" in
18047	''|0)	d_setlocale_r=undef
18048		setlocale_r_proto=0
18049		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18050	* )	case "$setlocale_r_proto" in
18051		REENTRANT_PROTO*) ;;
18052		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18053		esac
18054		echo "Prototype: $try" ;;
18055	esac
18056	;;
18057	*)	case "$usethreads" in
18058		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18059		esac
18060		d_setlocale_r=undef
18061		setlocale_r_proto=0
18062		;;
18063	esac
18064	;;
18065*)	setlocale_r_proto=0
18066	;;
18067esac
18068
18069: see if setnetent exists
18070set setnetent d_setnent
18071eval $inlibc
18072
18073: see if setnetent_r exists
18074set setnetent_r d_setnetent_r
18075eval $inlibc
18076case "$d_setnetent_r" in
18077"$define")
18078	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18079	case "$d_setnetent_r_proto:$usethreads" in
18080	":define")	d_setnetent_r_proto=define
18081		set d_setnetent_r_proto setnetent_r $hdrs
18082		eval $hasproto ;;
18083	*)	;;
18084	esac
18085	case "$d_setnetent_r_proto" in
18086	define)
18087	case "$setnetent_r_proto" in
18088	''|0) try='int setnetent_r(int, struct netent_data*);'
18089	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18090	esac
18091	case "$setnetent_r_proto" in
18092	''|0) try='void setnetent_r(int, struct netent_data*);'
18093	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18094	esac
18095	case "$setnetent_r_proto" in
18096	''|0)	d_setnetent_r=undef
18097		setnetent_r_proto=0
18098		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18099	* )	case "$setnetent_r_proto" in
18100		REENTRANT_PROTO*) ;;
18101		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18102		esac
18103		echo "Prototype: $try" ;;
18104	esac
18105	;;
18106	*)	case "$usethreads" in
18107		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18108		esac
18109		d_setnetent_r=undef
18110		setnetent_r_proto=0
18111		;;
18112	esac
18113	;;
18114*)	setnetent_r_proto=0
18115	;;
18116esac
18117
18118: see if setprotoent exists
18119set setprotoent d_setpent
18120eval $inlibc
18121
18122: see if setpgid exists
18123set setpgid d_setpgid
18124eval $inlibc
18125
18126: see if setpgrp2 exists
18127set setpgrp2 d_setpgrp2
18128eval $inlibc
18129
18130: see if setpriority exists
18131set setpriority d_setprior
18132eval $inlibc
18133
18134: see if setproctitle exists
18135set setproctitle d_setproctitle
18136eval $inlibc
18137
18138: see if setprotoent_r exists
18139set setprotoent_r d_setprotoent_r
18140eval $inlibc
18141case "$d_setprotoent_r" in
18142"$define")
18143	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18144	case "$d_setprotoent_r_proto:$usethreads" in
18145	":define")	d_setprotoent_r_proto=define
18146		set d_setprotoent_r_proto setprotoent_r $hdrs
18147		eval $hasproto ;;
18148	*)	;;
18149	esac
18150	case "$d_setprotoent_r_proto" in
18151	define)
18152	case "$setprotoent_r_proto" in
18153	''|0) try='int setprotoent_r(int, struct protoent_data*);'
18154	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18155	esac
18156	case "$setprotoent_r_proto" in
18157	''|0) try='void setprotoent_r(int, struct protoent_data*);'
18158	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18159	esac
18160	case "$setprotoent_r_proto" in
18161	''|0)	d_setprotoent_r=undef
18162		setprotoent_r_proto=0
18163		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18164	* )	case "$setprotoent_r_proto" in
18165		REENTRANT_PROTO*) ;;
18166		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18167		esac
18168		echo "Prototype: $try" ;;
18169	esac
18170	;;
18171	*)	case "$usethreads" in
18172		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18173		esac
18174		d_setprotoent_r=undef
18175		setprotoent_r_proto=0
18176		;;
18177	esac
18178	;;
18179*)	setprotoent_r_proto=0
18180	;;
18181esac
18182
18183: see if setpwent exists
18184set setpwent d_setpwent
18185eval $inlibc
18186
18187: see if setpwent_r exists
18188set setpwent_r d_setpwent_r
18189eval $inlibc
18190case "$d_setpwent_r" in
18191"$define")
18192	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18193	case "$d_setpwent_r_proto:$usethreads" in
18194	":define")	d_setpwent_r_proto=define
18195		set d_setpwent_r_proto setpwent_r $hdrs
18196		eval $hasproto ;;
18197	*)	;;
18198	esac
18199	case "$d_setpwent_r_proto" in
18200	define)
18201	case "$setpwent_r_proto" in
18202	''|0) try='int setpwent_r(FILE**);'
18203	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18204	esac
18205	case "$setpwent_r_proto" in
18206	''|0) try='void setpwent_r(FILE**);'
18207	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18208	esac
18209	case "$setpwent_r_proto" in
18210	''|0)	d_setpwent_r=undef
18211		setpwent_r_proto=0
18212		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18213	* )	case "$setpwent_r_proto" in
18214		REENTRANT_PROTO*) ;;
18215		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18216		esac
18217		echo "Prototype: $try" ;;
18218	esac
18219	;;
18220	*)	case "$usethreads" in
18221		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18222		esac
18223		d_setpwent_r=undef
18224		setpwent_r_proto=0
18225		;;
18226	esac
18227	;;
18228*)	setpwent_r_proto=0
18229	;;
18230esac
18231
18232: see if setregid exists
18233set setregid d_setregid
18234eval $inlibc
18235set setresgid d_setresgid
18236eval $inlibc
18237
18238: see if setreuid exists
18239set setreuid d_setreuid
18240eval $inlibc
18241set setresuid d_setresuid
18242eval $inlibc
18243
18244: see if setrgid exists
18245set setrgid d_setrgid
18246eval $inlibc
18247
18248: see if setruid exists
18249set setruid d_setruid
18250eval $inlibc
18251
18252: see if setservent exists
18253set setservent d_setsent
18254eval $inlibc
18255
18256: see if setservent_r exists
18257set setservent_r d_setservent_r
18258eval $inlibc
18259case "$d_setservent_r" in
18260"$define")
18261	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18262	case "$d_setservent_r_proto:$usethreads" in
18263	":define")	d_setservent_r_proto=define
18264		set d_setservent_r_proto setservent_r $hdrs
18265		eval $hasproto ;;
18266	*)	;;
18267	esac
18268	case "$d_setservent_r_proto" in
18269	define)
18270	case "$setservent_r_proto" in
18271	''|0) try='int setservent_r(int, struct servent_data*);'
18272	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18273	esac
18274	case "$setservent_r_proto" in
18275	''|0) try='void setservent_r(int, struct servent_data*);'
18276	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18277	esac
18278	case "$setservent_r_proto" in
18279	''|0)	d_setservent_r=undef
18280		setservent_r_proto=0
18281		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18282	* )	case "$setservent_r_proto" in
18283		REENTRANT_PROTO*) ;;
18284		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18285		esac
18286		echo "Prototype: $try" ;;
18287	esac
18288	;;
18289	*)	case "$usethreads" in
18290		define) echo "setservent_r has no prototype, not using it." >&4 ;;
18291		esac
18292		d_setservent_r=undef
18293		setservent_r_proto=0
18294		;;
18295	esac
18296	;;
18297*)	setservent_r_proto=0
18298	;;
18299esac
18300
18301: see if setsid exists
18302set setsid d_setsid
18303eval $inlibc
18304
18305: see if setvbuf exists
18306set setvbuf d_setvbuf
18307eval $inlibc
18308
18309: see if shmctl exists
18310set shmctl d_shmctl
18311eval $inlibc
18312
18313: see if shmget exists
18314set shmget d_shmget
18315eval $inlibc
18316
18317: see if shmat exists
18318set shmat d_shmat
18319eval $inlibc
18320: see what shmat returns
18321case "$d_shmat" in
18322"$define")
18323	$cat >shmat.c <<'END'
18324#include <sys/shm.h>
18325void *shmat();
18326END
18327	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18328		shmattype='void *'
18329	else
18330		shmattype='char *'
18331	fi
18332	echo "and it returns ($shmattype)." >&4
18333	: see if a prototype for shmat is available
18334	xxx=`./findhdr sys/shm.h`
18335	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18336	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18337		val="$define"
18338	else
18339		val="$undef"
18340	fi
18341	$rm -f shmat.[co]
18342	;;
18343*)
18344	val="$undef"
18345	;;
18346esac
18347set d_shmatprototype
18348eval $setvar
18349
18350: see if shmdt exists
18351set shmdt d_shmdt
18352eval $inlibc
18353
18354: see how much of the 'shm*(2)' library is present.
18355h_shm=true
18356echo " "
18357case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18358*"$undef"*) h_shm=false;;
18359esac
18360case "$osname" in
18361freebsd)
18362    case "`ipcs 2>&1`" in
18363    "SVID shared memory"*"not configured"*)
18364	echo "Your $osname does not have the shm*(2) configured." >&4
18365        h_shm=false
18366	val="$undef"
18367	set shmctl d_shmctl
18368	eval $setvar
18369	set shmget d_shmget
18370	eval $setvar
18371	set shmat d_shmat
18372	eval $setvar
18373	set shmdt d_shmdt
18374	eval $setvar
18375	;;
18376    esac
18377    ;;
18378esac
18379: we could also check for sys/ipc.h ...
18380if $h_shm && $test `./findhdr sys/shm.h`; then
18381	echo "You have the full shm*(2) library." >&4
18382	val="$define"
18383else
18384	echo "You don't have the full shm*(2) library." >&4
18385	val="$undef"
18386fi
18387set d_shm
18388eval $setvar
18389
18390: see if we have sigaction
18391echo " "
18392if set sigaction val -f d_sigaction; eval $csym; $val; then
18393	echo 'sigaction() found.' >&4
18394	$cat > try.c <<EOP
18395#include <stdio.h>
18396#include <sys/types.h>
18397#include <signal.h>
18398#$i_stdlib I_STDLIB
18399#ifdef I_STDLIB
18400#include <stdlib.h>
18401#endif
18402int main()
18403{
18404    struct sigaction act, oact;
18405    act.sa_flags = 0;
18406    oact.sa_handler = 0;
18407    /* so that act and oact are used */
18408    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18409}
18410EOP
18411	set try
18412	if eval $compile_ok; then
18413		val="$define"
18414	else
18415		echo "But you don't seem to have a usable struct sigaction." >&4
18416		val="$undef"
18417	fi
18418else
18419	echo 'sigaction NOT found.' >&4
18420	val="$undef"
18421fi
18422set d_sigaction; eval $setvar
18423$rm_try
18424
18425: see what type pids are declared as in the kernel
18426rp="What is the type of process ids on this system?"
18427set pid_t pidtype int stdio.h sys/types.h
18428eval $typedef_ask
18429
18430: see what type uids are declared as in the kernel
18431echo " "
18432echo "Looking for the type for user ids returned by getuid()."
18433set uid_t uidtype xxx stdio.h sys/types.h
18434eval $typedef
18435case "$uidtype" in
18436xxx)
18437	xxx=`./findhdr sys/user.h`
18438	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18439	case $1 in
18440	unsigned) dflt="$1 $2" ;;
18441	*) dflt="$1" ;;
18442	esac
18443	;;
18444*) dflt="$uidtype";;
18445esac
18446case "$uidtype" in
18447uid_t)	echo "uid_t found." ;;
18448*)	rp="What is the type for user ids returned by getuid()?"
18449	. ./myread
18450	uidtype="$ans"
18451	;;
18452esac
18453
18454: Define hasfield_t macro for Configure internal use
18455hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18456while $test $# -ge 2; do
18457    case "$1" in
18458	$define) echo "#include <$2>";;
18459    esac ;
18460    shift 2;
18461done > try.c;
18462echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18463set try;
18464if eval $compile; then
18465	val="$define";
18466else
18467	val="$undef";
18468fi;
18469set $varname;
18470eval $setvar;
18471$rm_try'
18472
18473: see what siginfo fields we have
18474case "$d_sigaction" in
18475"$define")
18476	echo "Checking if your siginfo_t has si_errno field...">&4
18477	set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18478	eval $hasfield_t;
18479
18480	echo "Checking if your siginfo_t has si_pid field...">&4
18481	set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18482	eval $hasfield_t;
18483
18484	echo "Checking if your siginfo_t has si_uid field...">&4
18485	set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18486	eval $hasfield_t;
18487
18488	echo "Checking if your siginfo_t has si_addr field...">&4
18489	set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18490	eval $hasfield_t;
18491
18492	echo "Checking if your siginfo_t has si_status field...">&4
18493	set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18494	eval $hasfield_t;
18495
18496	echo "Checking if your siginfo_t has si_band field...">&4
18497	set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18498	eval $hasfield_t;
18499
18500	echo "Checking if your siginfo_t has si_value field...">&4
18501	set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18502	eval $hasfield_t;
18503
18504	echo "Checking if your siginfo_t has si_fd field...">&4
18505	set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18506	eval $hasfield_t;
18507
18508	;;
18509*)
18510	d_siginfo_si_errno="$undef"
18511	d_siginfo_si_pid="$undef"
18512	d_siginfo_si_uid="$undef"
18513	d_siginfo_si_addr="$undef"
18514	d_siginfo_si_status="$undef"
18515	d_siginfo_si_band="$undef"
18516	d_siginfo_si_value="$undef"
18517	d_siginfo_si_fd="$undef"
18518	;;
18519esac
18520
18521: see if this is a sunmath.h system
18522set sunmath.h i_sunmath
18523eval $inhdr
18524
18525: see if signbit exists
18526$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18527$cat >try.c <<EOCP
18528#$i_sunmath I_SUNMATH
18529#include <math.h>
18530#ifdef I_SUNMATH  /* Solaris special math library */
18531#  include <sunmath.h>
18532#endif
18533#define NV $nvtype
18534int main(int argc, char **argv)
18535{
18536    NV x = 0.0;
18537    NV y = -1.0;
18538    if ((signbit(x) == 0) && (signbit(y) != 0))
18539	return 0;
18540    else
18541	return 1;
18542}
18543EOCP
18544val="$undef"
18545set try
18546if eval $compile; then
18547    if $run ./try; then
18548        $echo "Yes." >&4
18549	val="$define"
18550    else
18551        $echo "Signbit seems to be available, but doesn't work as I expected."
18552        $echo "I won't use it." >&4
18553	val="$undef"
18554    fi
18555else
18556    $echo "Nope." >&4
18557    dflt="$undef"
18558fi
18559set d_signbit
18560eval $setvar
18561$rm_try
18562
18563: see if sigprocmask exists
18564set sigprocmask d_sigprocmask
18565eval $inlibc
18566
18567: see if sigsetjmp exists
18568echo " "
18569case "$d_sigsetjmp" in
18570'')
18571	$cat >try.c <<EOP
18572#include <setjmp.h>
18573#$i_stdlib I_STDLIB
18574#ifdef I_STDLIB
18575#include <stdlib.h>
18576#endif
18577sigjmp_buf env;
18578int set = 1;
18579int main()
18580{
18581	if (sigsetjmp(env,1))
18582		exit(set);
18583	set = 0;
18584	siglongjmp(env, 1);
18585	exit(1);
18586}
18587EOP
18588	set try
18589	if eval $compile; then
18590		if $run ./try >/dev/null 2>&1; then
18591			echo "POSIX sigsetjmp found." >&4
18592			val="$define"
18593		else
18594			$cat >&4 <<EOM
18595Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18596I'll ignore them.
18597EOM
18598			val="$undef"
18599		fi
18600	else
18601		echo "sigsetjmp not found." >&4
18602		val="$undef"
18603	fi
18604	;;
18605*) val="$d_sigsetjmp"
18606	case "$d_sigsetjmp" in
18607	$define) echo "POSIX sigsetjmp found." >&4;;
18608	$undef) echo "sigsetjmp not found." >&4;;
18609	esac
18610	;;
18611esac
18612set d_sigsetjmp
18613eval $setvar
18614$rm_try
18615
18616: see if snprintf exists
18617set snprintf d_snprintf
18618eval $inlibc
18619
18620: see if vsnprintf exists
18621set vsnprintf d_vsnprintf
18622eval $inlibc
18623
18624case "$d_snprintf-$d_vsnprintf" in
18625"$define-$define")
18626    $cat <<EOM
18627Checking whether your snprintf() and vsnprintf() work okay...
18628EOM
18629    $cat >try.c <<'EOCP'
18630/* v?snprintf testing logic courtesy of Russ Allbery.
18631 * According to C99:
18632 * - if the buffer is too short it still must be \0-terminated
18633 * - if the buffer is too short the potentially required length
18634 *   must be returned and not -1
18635 * - if the buffer is NULL the potentially required length
18636 *   must be returned and not -1 or core dump
18637 */
18638#include <stdio.h>
18639#include <stdarg.h>
18640
18641char buf[2];
18642
18643int test (char *format, ...)
18644{
18645    va_list args;
18646    int count;
18647
18648    va_start (args, format);
18649    count = vsnprintf (buf, sizeof buf, format, args);
18650    va_end (args);
18651    return count;
18652}
18653
18654int main ()
18655{
18656    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18657             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18658}
18659EOCP
18660    set try
18661    if eval $compile; then
18662	`$run ./try`
18663	case "$?" in
18664	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18665	*) cat <<EOM >&4
18666Your snprintf() and snprintf() don't seem to be working okay.
18667EOM
18668	   d_snprintf="$undef"
18669	   d_vsnprintf="$undef"
18670	   ;;
18671	esac
18672    else
18673	echo "(I can't seem to compile the test program--assuming they don't)"
18674	d_snprintf="$undef"
18675	d_vsnprintf="$undef"
18676    fi
18677    $rm_try
18678    ;;
18679esac
18680
18681: see if sockatmark exists
18682set sockatmark d_sockatmark
18683eval $inlibc
18684
18685: see if prototype for sockatmark is available
18686echo " "
18687set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18688eval $hasproto
18689
18690: see if socks5_init exists
18691set socks5_init d_socks5_init
18692eval $inlibc
18693
18694: see if srand48_r exists
18695set srand48_r d_srand48_r
18696eval $inlibc
18697case "$d_srand48_r" in
18698"$define")
18699	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18700	case "$d_srand48_r_proto:$usethreads" in
18701	":define")	d_srand48_r_proto=define
18702		set d_srand48_r_proto srand48_r $hdrs
18703		eval $hasproto ;;
18704	*)	;;
18705	esac
18706	case "$d_srand48_r_proto" in
18707	define)
18708	case "$srand48_r_proto" in
18709	''|0) try='int srand48_r(long, struct drand48_data*);'
18710	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18711	esac
18712	case "$srand48_r_proto" in
18713	''|0)	d_srand48_r=undef
18714		srand48_r_proto=0
18715		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18716	* )	case "$srand48_r_proto" in
18717		REENTRANT_PROTO*) ;;
18718		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18719		esac
18720		echo "Prototype: $try" ;;
18721	esac
18722	;;
18723	*)	case "$usethreads" in
18724		define) echo "srand48_r has no prototype, not using it." >&4 ;;
18725		esac
18726		d_srand48_r=undef
18727		srand48_r_proto=0
18728		;;
18729	esac
18730	;;
18731*)	srand48_r_proto=0
18732	;;
18733esac
18734
18735: see if srandom_r exists
18736set srandom_r d_srandom_r
18737eval $inlibc
18738case "$d_srandom_r" in
18739"$define")
18740	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18741	case "$d_srandom_r_proto:$usethreads" in
18742	":define")	d_srandom_r_proto=define
18743		set d_srandom_r_proto srandom_r $hdrs
18744		eval $hasproto ;;
18745	*)	;;
18746	esac
18747	case "$d_srandom_r_proto" in
18748	define)
18749	case "$srandom_r_proto" in
18750	''|0) try='int srandom_r(unsigned int, struct random_data*);'
18751	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18752	esac
18753	case "$srandom_r_proto" in
18754	''|0)	d_srandom_r=undef
18755		srandom_r_proto=0
18756		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18757	* )	case "$srandom_r_proto" in
18758		REENTRANT_PROTO*) ;;
18759		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18760		esac
18761		echo "Prototype: $try" ;;
18762	esac
18763	;;
18764	*)	case "$usethreads" in
18765		define) echo "srandom_r has no prototype, not using it." >&4 ;;
18766		esac
18767		d_srandom_r=undef
18768		srandom_r_proto=0
18769		;;
18770	esac
18771	;;
18772*)	srandom_r_proto=0
18773	;;
18774esac
18775
18776: see if prototype for setresgid is available
18777echo " "
18778set d_sresgproto setresgid $i_unistd unistd.h
18779eval $hasproto
18780
18781: see if prototype for setresuid is available
18782echo " "
18783set d_sresuproto setresuid $i_unistd unistd.h
18784eval $hasproto
18785
18786: see if stat exists
18787set stat d_stat
18788eval $inlibc
18789
18790: see if sys/stat.h is available
18791set sys/stat.h i_sysstat
18792eval $inhdr
18793
18794: see if stat knows about block sizes
18795echo " "
18796echo "Checking to see if your struct stat has st_blocks field..." >&4
18797set d_statblks stat st_blocks $i_sysstat sys/stat.h
18798eval $hasfield
18799
18800: see if this is a sys/vfs.h system
18801set sys/vfs.h i_sysvfs
18802eval $inhdr
18803
18804: see if this is a sys/statfs.h system
18805set sys/statfs.h i_sysstatfs
18806eval $inhdr
18807
18808: Check for statfs_s
18809echo " "
18810echo "Checking to see if your system supports struct statfs..." >&4
18811set 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
18812eval $hasstruct
18813case "$d_statfs_s" in
18814"$define")      echo "Yes, it does."   ;;
18815*)              echo "No, it doesn't." ;;
18816esac
18817
18818: see if struct statfs knows about f_flags
18819case "$d_statfs_s" in
18820define)
18821	echo " "
18822	echo "Checking to see if your struct statfs has f_flags field..." >&4
18823	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
18824	eval $hasfield
18825	;;
18826*)	val="$undef"
18827	set d_statfs_f_flags
18828	eval $setvar
18829	;;
18830esac
18831case "$d_statfs_f_flags" in
18832"$define")      echo "Yes, it does."   ;;
18833*)              echo "No, it doesn't." ;;
18834esac
18835
18836: see what flavor, if any, of static inline is supported
18837echo " "
18838echo "Checking to see if your system supports static inline..."
18839$cat > try.c <<'EOCP'
18840#include <stdlib.h>
18841extern int f_via_a(int x);
18842extern int f_via_b(int x);
18843int main(int argc, char **argv)
18844{
18845    int y;
18846
18847    y = f_via_a(0);
18848#ifdef USE_B
18849    y = f_via_b(0);
18850#endif
18851    if (y == 42) {
18852        return EXIT_SUCCESS;
18853    }
18854    else {
18855        return EXIT_FAILURE;
18856    }
18857}
18858EOCP
18859$cat > a.c <<'EOCP'
18860static INLINE int f(int x) {
18861    int y;
18862    y = x + 42;
18863    return y;
18864}
18865
18866int f_via_a(int x)
18867{
18868    return f(x);
18869}
18870EOCP
18871$cat > b.c <<'EOCP'
18872extern int f(int x);
18873
18874int f_via_b(int x)
18875{
18876    return f(x);
18877}
18878EOCP
18879
18880# Respect a hint (or previous) value for perl_static_inline, if there is one.
18881case "$perl_static_inline" in
18882'')	# Check the various possibilities, and break out on success.
18883	# For gcc, prefer __inline__, which will still permit
18884	# cflags.SH to add in -ansi.
18885	case "$gccversion" in
18886		'') xxx="inline __inline__ __inline _inline";;
18887		*)  xxx="__inline__ inline __inline _inline";;
18888	esac
18889	for inline in $xxx; do
18890		set try -DINLINE=$inline a.c
18891		if eval $compile && $run ./try; then
18892			# Now make sure there is no external linkage of static
18893			# functions
18894			set try -DINLINE=$inline -DUSE_B a.c b.c
18895			if eval $compile && $run ./try; then
18896				$echo "Your compiler supports static $inline, " >&4
18897				$echo "but it also creates an external definition," >&4
18898				$echo "so I won't use it." >&4
18899				val=$undef
18900			else
18901				$echo "Your compiler supports static $inline." >&4
18902				val=$define
18903				perl_static_inline="static $inline";
18904				break;
18905			fi
18906		else
18907			$echo "Your compiler does NOT support static $inline." >&4
18908			val="$undef"
18909		fi
18910	done
18911	;;
18912*inline*) # Some variant of inline exists.
18913	echo "Keeping your $hint value of $perl_static_inline."
18914	val=$define
18915	;;
18916static)  # No inline capabilities
18917	echo "Keeping your $hint value of $perl_static_inline."
18918	val=$undef
18919	;;
18920*)  # Unrecognized previous value -- blindly trust the supplied
18921	# value and hope it makes sense.  Use old value for
18922	# d_static_inline, if there is one.
18923	echo "Keeping your $hint value of $perl_static_inline."
18924	case "$d_static_inline" in
18925		'') val=$define ;;
18926		*)  val=$d_static_inline ;;
18927	esac
18928	;;
18929esac
18930# Fallback to plain 'static' if nothing worked.
18931case "$perl_static_inline" in
18932'')
18933	perl_static_inline="static"
18934	val=$undef
18935	;;
18936esac
18937set d_static_inline
18938eval $setvar
18939$rm -f a.[co] b.[co]
18940$rm_try
18941
18942: Check stream access
18943$cat >&4 <<EOM
18944Checking how to access stdio streams by file descriptor number...
18945EOM
18946case "$stdio_stream_array" in
18947'')	$cat >try.c <<EOCP
18948#include <stdio.h>
18949int main() {
18950  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18951    printf("yes\n");
18952}
18953EOCP
18954	for s in _iob __iob __sF
18955	do
18956	        set try -DSTDIO_STREAM_ARRAY=$s
18957		if eval $compile; then
18958			case "`$run ./try`" in
18959			yes)	stdio_stream_array=$s; break ;;
18960			esac
18961		fi
18962	done
18963	$rm_try
18964esac
18965case "$stdio_stream_array" in
18966'')	$cat >&4 <<EOM
18967I can't figure out how to access stdio streams by file descriptor number.
18968EOM
18969	d_stdio_stream_array="$undef"
18970	;;
18971*)	$cat >&4 <<EOM
18972You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18973EOM
18974	d_stdio_stream_array="$define"
18975	;;
18976esac
18977
18978: see if strcoll exists
18979set strcoll d_strcoll
18980eval $inlibc
18981
18982: see if strerror_l exists
18983set strerror_l d_strerror_l
18984eval $inlibc
18985
18986: see if strerror_r exists
18987set strerror_r d_strerror_r
18988eval $inlibc
18989case "$d_strerror_r" in
18990"$define")
18991	hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18992	case "$d_strerror_r_proto:$usethreads" in
18993	":define")	d_strerror_r_proto=define
18994		set d_strerror_r_proto strerror_r $hdrs
18995		eval $hasproto ;;
18996	*)	;;
18997	esac
18998	case "$d_strerror_r_proto" in
18999	define)
19000	case "$strerror_r_proto" in
19001	''|0) try='int strerror_r(int, char*, size_t);'
19002	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19003	esac
19004	case "$strerror_r_proto" in
19005	''|0) try='int strerror_r(int, char*, int);'
19006	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19007	esac
19008	case "$strerror_r_proto" in
19009	''|0) try='char* strerror_r(int, char*, size_t);'
19010	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19011	esac
19012	case "$strerror_r_proto" in
19013	''|0)	d_strerror_r=undef
19014		strerror_r_proto=0
19015		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19016	* )	case "$strerror_r_proto" in
19017		REENTRANT_PROTO*) ;;
19018		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19019		esac
19020		echo "Prototype: $try" ;;
19021	esac
19022	;;
19023	*)	case "$usethreads" in
19024		define) echo "strerror_r has no prototype, not using it." >&4 ;;
19025		esac
19026		d_strerror_r=undef
19027		strerror_r_proto=0
19028		;;
19029	esac
19030	;;
19031*)	strerror_r_proto=0
19032	;;
19033esac
19034
19035: see if strftime exists
19036set strftime d_strftime
19037eval $inlibc
19038
19039: see if strlcat exists
19040: We need both a prototype in string.h and the symbol in libc.
19041echo " "
19042d_strlcat_proto=''
19043xx1="#$d_gnulibc HAS_GNULIBC"
19044xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19045xx3='#   define _GNU_SOURCE'
19046xx4='#endif'
19047set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19048eval $hasproto
19049case "$d_strlcat_proto" in
19050    define) # see if strlcat exists
19051	set strlcat d_strlcat
19052	eval $inlibc
19053	;;
19054    *)  val=$undef
19055	set d_strlcat
19056	eval $setvar
19057	;;
19058esac
19059
19060: see if strlcpy exists
19061: We need both a prototype in string.h and the symbol in libc.
19062echo " "
19063d_strlcpy_proto=''
19064xx1="#$d_gnulibc HAS_GNULIBC"
19065xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19066xx3='#   define _GNU_SOURCE'
19067xx4='#endif'
19068set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19069eval $hasproto
19070case "$d_strlcpy_proto" in
19071    define) # see if strlcpy exists
19072	set strlcpy d_strlcpy
19073	eval $inlibc
19074	;;
19075    *)  val=$undef
19076	set d_strlcpy
19077	eval $setvar
19078	;;
19079esac
19080
19081: see if strnlen exists
19082set strnlen d_strnlen
19083eval $inlibc
19084
19085: see if strtod exists
19086set strtod d_strtod
19087eval $inlibc
19088
19089: see if strtod_l exists
19090set strtod_l d_strtod_l
19091eval $inlibc
19092
19093: see if strtol exists
19094set strtol d_strtol
19095eval $inlibc
19096
19097: see if strtold exists
19098set strtold d_strtold
19099eval $inlibc
19100
19101: see if strtold_l exists
19102set strtold_l d_strtold_l
19103eval $inlibc
19104
19105: see if strtoll exists
19106set strtoll d_strtoll
19107eval $inlibc
19108
19109case "$d_longlong-$d_strtoll" in
19110"$define-$define")
19111	$cat <<EOM
19112Checking whether your strtoll() works okay...
19113EOM
19114	$cat >try.c <<'EOCP'
19115#include <errno.h>
19116#ifdef __hpux
19117#define strtoll __strtoll
19118#endif
19119#ifdef __EMX__
19120#define strtoll _strtoll
19121#endif
19122#include <stdio.h>
19123#include <stdlib.h>
19124static int bad = 0;
19125void check(const char *s, long long ell, int een) {
19126	long long gll;
19127	errno = 0;
19128	gll = strtoll(s, 0, 10);
19129	if (!((gll == ell) && (errno == een)))
19130		bad++;
19131}
19132int main() {
19133	check(" 1",                                      1LL, 0);
19134	check(" 0",                                      0LL, 0);
19135	check("-1",                                     -1LL, 0);
19136	check("-9223372036854775808", -9223372036854775808LL, 0);
19137	check("-9223372036854775808", -9223372036854775808LL, 0);
19138	check(" 9223372036854775807",  9223372036854775807LL, 0);
19139	check("-9223372036854775808", -9223372036854775808LL, 0);
19140	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19141	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19142	if (!bad)
19143		printf("ok\n");
19144}
19145EOCP
19146	set try
19147	if eval $compile; then
19148		yyy=`$run ./try`
19149		case "$yyy" in
19150		ok) echo "Your strtoll() seems to be working okay." ;;
19151		*) cat <<EOM >&4
19152Your strtoll() doesn't seem to be working okay.
19153EOM
19154		   d_strtoll="$undef"
19155		   ;;
19156		esac
19157	else
19158		echo "(I can't seem to compile the test program--assuming it doesn't)"
19159		d_strtoll="$undef"
19160	fi
19161	;;
19162esac
19163
19164: see if strtoq exists
19165set strtoq d_strtoq
19166eval $inlibc
19167
19168: see if strtoul exists
19169set strtoul d_strtoul
19170eval $inlibc
19171
19172case "$d_strtoul" in
19173"$define")
19174	$cat <<EOM
19175Checking whether your strtoul() works okay...
19176EOM
19177	$cat >try.c <<'EOCP'
19178#include <stdlib.h>
19179#include <errno.h>
19180#include <stdio.h>
19181static int bad = 0;
19182void check(const char *s, unsigned long eul, int een) {
19183	unsigned long gul;
19184	errno = 0;
19185	gul = strtoul(s, 0, 10);
19186	if (!((gul == eul) && (errno == een)))
19187		bad++;
19188}
19189int main() {
19190	check(" 1", 1L, 0);
19191	check(" 0", 0L, 0);
19192EOCP
19193	case "$longsize" in
19194	8)
19195	    $cat >>try.c <<'EOCP'
19196	check("18446744073709551615", 18446744073709551615UL, 0);
19197	check("18446744073709551616", 18446744073709551615UL, ERANGE);
19198#if 0 /* strtoul() for /^-/ strings is undefined. */
19199	check("-1", 18446744073709551615UL, 0);
19200	check("-18446744073709551614", 2, 0);
19201	check("-18446744073709551615", 1, 0);
19202	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19203	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19204#endif
19205EOCP
19206		;;
19207	4)
19208		    $cat >>try.c <<'EOCP'
19209	check("4294967295", 4294967295UL, 0);
19210	check("4294967296", 4294967295UL, ERANGE);
19211#if 0 /* strtoul() for /^-/ strings is undefined. */
19212	check("-1", 4294967295UL, 0);
19213	check("-4294967294", 2, 0);
19214	check("-4294967295", 1, 0);
19215	check("-4294967296", 4294967295UL, ERANGE);
19216	check("-4294967297", 4294967295UL, ERANGE);
19217#endif
19218EOCP
19219		;;
19220	*)
19221: Should we write these tests to be more portable by sprintf-ing
19222: ~0 and then manipulating that char string as input for strtol?
19223		;;
19224	esac
19225	$cat >>try.c <<'EOCP'
19226	if (!bad)
19227		printf("ok\n");
19228	return 0;
19229}
19230EOCP
19231	set try
19232	if eval $compile; then
19233		case "`$run ./try`" in
19234		ok) echo "Your strtoul() seems to be working okay." ;;
19235		*) cat <<EOM >&4
19236Your strtoul() doesn't seem to be working okay.
19237EOM
19238		   d_strtoul="$undef"
19239		   ;;
19240		esac
19241	else
19242		echo "(I can't seem to compile the test program--assuming it doesn't)"
19243		d_strtoul="$undef"
19244	fi
19245	;;
19246esac
19247
19248: see if strtoull exists
19249set strtoull d_strtoull
19250eval $inlibc
19251
19252case "$d_longlong-$d_strtoull" in
19253"$define-$define")
19254	$cat <<EOM
19255Checking whether your strtoull() works okay...
19256EOM
19257	$cat >try.c <<'EOCP'
19258#include <stdlib.h>
19259#include <errno.h>
19260#ifdef __hpux
19261#define strtoull __strtoull
19262#endif
19263#include <stdio.h>
19264static int bad = 0;
19265void check(const char *s, long long eull, int een) {
19266	long long gull;
19267	errno = 0;
19268	gull = strtoull(s, 0, 10);
19269	if (!((gull == eull) && (errno == een)))
19270		bad++;
19271}
19272int main() {
19273	check(" 1",                                        1LL, 0);
19274	check(" 0",                                        0LL, 0);
19275	check("18446744073709551615",  18446744073709551615ULL, 0);
19276	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19277#if 0 /* strtoull() for /^-/ strings is undefined. */
19278	check("-1",                    18446744073709551615ULL, 0);
19279	check("-18446744073709551614",                     2LL, 0);
19280	check("-18446744073709551615",                     1LL, 0);
19281	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19282	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19283#endif
19284	if (!bad)
19285		printf("ok\n");
19286}
19287EOCP
19288	set try
19289	if eval $compile; then
19290		case "`$run ./try`" in
19291		ok) echo "Your strtoull() seems to be working okay." ;;
19292		*) cat <<EOM >&4
19293Your strtoull() doesn't seem to be working okay.
19294EOM
19295		   d_strtoull="$undef"
19296		   ;;
19297		esac
19298	else
19299		echo "(I can't seem to compile the test program--assuming it doesn't)"
19300		d_strtoull="$undef"
19301	fi
19302	;;
19303esac
19304
19305: see if strtouq exists
19306set strtouq d_strtouq
19307eval $inlibc
19308
19309case "$d_strtouq" in
19310"$define")
19311	$cat <<EOM
19312Checking whether your strtouq() works okay...
19313EOM
19314	$cat >try.c <<'EOCP'
19315#include <stdlib.h>
19316#include <errno.h>
19317#include <stdio.h>
19318static int bad = 0;
19319void check(const char *s, unsigned long long eull, int een) {
19320	unsigned long long gull;
19321	errno = 0;
19322	gull = strtouq(s, 0, 10);
19323	if (!((gull == eull) && (errno == een)))
19324		bad++;
19325}
19326int main() {
19327	check(" 1",                                        1LL, 0);
19328	check(" 0",                                        0LL, 0);
19329	check("18446744073709551615",  18446744073709551615ULL, 0);
19330	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19331#if 0 /* strtouq() for /^-/ strings is undefined. */
19332	check("-1",                    18446744073709551615ULL, 0);
19333	check("-18446744073709551614",                     2LL, 0);
19334	check("-18446744073709551615",                     1LL, 0);
19335	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19336	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19337#endif
19338	if (!bad)
19339		printf("ok\n");
19340	return 0;
19341}
19342EOCP
19343	set try
19344	if eval $compile; then
19345		case "`$run ./try`" in
19346		ok) echo "Your strtouq() seems to be working okay." ;;
19347		*) cat <<EOM >&4
19348Your strtouq() doesn't seem to be working okay.
19349EOM
19350		   d_strtouq="$undef"
19351		   ;;
19352		esac
19353	else
19354		echo "(I can't seem to compile the test program--assuming it doesn't)"
19355		d_strtouq="$undef"
19356	fi
19357	;;
19358esac
19359
19360: see if strxfrm exists
19361set strxfrm d_strxfrm
19362eval $inlibc
19363
19364: see if symlink exists
19365set symlink d_symlink
19366eval $inlibc
19367
19368: see if syscall exists
19369set syscall d_syscall
19370eval $inlibc
19371
19372: see if prototype for syscall is available
19373echo " "
19374set d_syscallproto syscall $i_unistd unistd.h
19375eval $hasproto
19376
19377: see if sysconf exists
19378set sysconf d_sysconf
19379eval $inlibc
19380
19381: see if sys_errlist[] exists
19382echo " "
19383if test "X$d_syserrlst" = X; then
19384	if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19385		echo "You have sys_errlist[], so we could roll our own strerror."
19386		d_syserrlst="$define"
19387	else
19388		echo "You don't have sys_errlist[], so strerror() is welcome."
19389		d_syserrlst="$undef"
19390	fi
19391fi
19392
19393: see if system exists
19394set system d_system
19395eval $inlibc
19396
19397: see if tcgetpgrp exists
19398set tcgetpgrp d_tcgetpgrp
19399eval $inlibc
19400
19401: see if tcsetpgrp exists
19402set tcsetpgrp d_tcsetpgrp
19403eval $inlibc
19404
19405: see if prototype for telldir is available
19406echo " "
19407set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19408eval $hasproto
19409
19410: see if tgamma exists
19411set tgamma d_tgamma
19412eval $inlibc
19413
19414: check for thread_safe_nl_langinfo_l item
19415$cat <<EOM
19416
19417Checking to see if you have nl_langinfo_l() and that it is thread-safe
19418EOM
19419$cat >try.c <<EOCP
19420#$i_stdlib I_STDLIB
19421#ifdef I_STDLIB
19422#  include <stdlib.h>
19423#endif
19424#include <string.h>
19425#$i_langinfo I_LANGINFO
19426#ifdef I_LANGINFO
19427#  include <langinfo.h>
19428#endif
19429#$i_pthread I_PTHREAD
19430#ifdef I_PTHREAD
19431#  include <pthread.h>
19432#endif
19433#$i_locale I_LOCALE
19434#ifdef I_LOCALE
19435#  include <locale.h>
19436#endif
19437
19438void *
19439thread_start(void * arg)
19440{
19441    nl_langinfo(RADIXCHAR);
19442}
19443
19444int main() {
19445    char * main_buffer;
19446    char save_main_buffer[1000];
19447    pthread_t subthread;
19448    pthread_attr_t attr;
19449
19450    main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19451
19452    /* If too large for our generous allowance, just assume we don't have
19453     * it. */
19454    if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19455        exit(1);
19456    }
19457
19458    strcpy(save_main_buffer, main_buffer);
19459
19460    if (pthread_attr_init(&attr) != 0) {
19461        exit(1);
19462    }
19463
19464    if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19465        exit(1);
19466    }
19467
19468    if (pthread_join(subthread, NULL) != 0) {
19469        exit(1);
19470    }
19471
19472    exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19473}
19474EOCP
19475case "$usethreads" in
19476    define)
19477        set try
19478        if eval $compile; then
19479            echo "Your system has nl_langinfo_l()..." >&4
19480            if $run ./try; then
19481                echo "and it is thread-safe (just as I'd hoped)." >&4
19482                d_thread_safe_nl_langinfo_l="$define"
19483                echo "$d_thread_safe_nl_langinfo_l" >&4
19484            else
19485                echo "but it isn't thread-safe, so we won't use it." >&4
19486            fi
19487        else
19488            echo "your system does not have nl_langinfo_l()" >&4
19489        fi
19490        ;;
19491    *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19492esac
19493if test X"$d_thread_safe_nl_langinfo_l" = X; then
19494	d_thread_safe_nl_langinfo_l="$undef"
19495fi
19496$rm_try
19497
19498: see if time exists
19499echo " "
19500if test "X$d_time" = X -o X"$timetype" = X; then
19501    if set time val -f d_time; eval $csym; $val; then
19502		echo 'time() found.' >&4
19503		val="$define"
19504		rp="What is the type returned by time() on this system?"
19505		set time_t timetype long stdio.h sys/types.h
19506		eval $typedef_ask
19507    else
19508		echo 'time() not found, hope that will do.' >&4
19509		val="$undef"
19510		timetype='int';
19511    fi
19512    set d_time
19513    eval $setvar
19514fi
19515
19516: see if timegm exists
19517set timegm d_timegm
19518eval $inlibc
19519
19520: see if this is a sys/times.h system
19521set sys/times.h i_systimes
19522eval $inhdr
19523
19524: see if times exists
19525echo " "
19526if set times val -f d_times; eval $csym; $val; then
19527	echo 'times() found.' >&4
19528	d_times="$define"
19529	inc=''
19530	case "$i_systimes" in
19531	"$define") inc='sys/times.h';;
19532	esac
19533	rp="What is the type returned by times() on this system?"
19534	set clock_t clocktype long stdio.h sys/types.h $inc
19535	eval $typedef_ask
19536else
19537	echo 'times() NOT found, hope that will do.' >&4
19538	d_times="$undef"
19539	clocktype='int'
19540fi
19541
19542: see if tmpnam_r exists
19543set tmpnam_r d_tmpnam_r
19544eval $inlibc
19545case "$d_tmpnam_r" in
19546"$define")
19547	hdrs="$i_systypes sys/types.h define stdio.h "
19548	case "$d_tmpnam_r_proto:$usethreads" in
19549	":define")	d_tmpnam_r_proto=define
19550		set d_tmpnam_r_proto tmpnam_r $hdrs
19551		eval $hasproto ;;
19552	*)	;;
19553	esac
19554	case "$d_tmpnam_r_proto" in
19555	define)
19556	case "$tmpnam_r_proto" in
19557	''|0) try='char* tmpnam_r(char*);'
19558	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19559	esac
19560	case "$tmpnam_r_proto" in
19561	''|0)	d_tmpnam_r=undef
19562		tmpnam_r_proto=0
19563		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19564	* )	case "$tmpnam_r_proto" in
19565		REENTRANT_PROTO*) ;;
19566		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19567		esac
19568		echo "Prototype: $try" ;;
19569	esac
19570	;;
19571	*)	case "$usethreads" in
19572		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19573		esac
19574		d_tmpnam_r=undef
19575		tmpnam_r_proto=0
19576		;;
19577	esac
19578	;;
19579*)	tmpnam_r_proto=0
19580	;;
19581esac
19582
19583: see if towlower exists
19584set towlower d_towlower
19585eval $inlibc
19586
19587: see if trunc exists
19588set trunc d_trunc
19589eval $inlibc
19590
19591: see if truncate exists
19592set truncate d_truncate
19593eval $inlibc
19594
19595: see if ttyname_r exists
19596set ttyname_r d_ttyname_r
19597eval $inlibc
19598case "$d_ttyname_r" in
19599"$define")
19600	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19601	case "$d_ttyname_r_proto:$usethreads" in
19602	":define")	d_ttyname_r_proto=define
19603		set d_ttyname_r_proto ttyname_r $hdrs
19604		eval $hasproto ;;
19605	*)	;;
19606	esac
19607	case "$d_ttyname_r_proto" in
19608	define)
19609	case "$ttyname_r_proto" in
19610	''|0) try='int ttyname_r(int, char*, size_t);'
19611	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19612	esac
19613	case "$ttyname_r_proto" in
19614	''|0) try='int ttyname_r(int, char*, int);'
19615	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19616	esac
19617	case "$ttyname_r_proto" in
19618	''|0) try='char* ttyname_r(int, char*, int);'
19619	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19620	esac
19621	case "$ttyname_r_proto" in
19622	''|0)	d_ttyname_r=undef
19623		ttyname_r_proto=0
19624		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19625	* )	case "$ttyname_r_proto" in
19626		REENTRANT_PROTO*) ;;
19627		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19628		esac
19629		echo "Prototype: $try" ;;
19630	esac
19631	;;
19632	*)	case "$usethreads" in
19633		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19634		esac
19635		d_ttyname_r=undef
19636		ttyname_r_proto=0
19637		;;
19638	esac
19639	;;
19640*)	ttyname_r_proto=0
19641	;;
19642esac
19643
19644: see if tzname[] exists
19645echo " "
19646if set tzname val -a d_tzname; eval $csym; $val; then
19647	val="$define"
19648	echo 'tzname[] found.' >&4
19649else
19650	val="$undef"
19651	echo 'tzname[] NOT found.' >&4
19652fi
19653set d_tzname
19654eval $setvar
19655
19656: Check if is a multiplatform env
19657case "$osname" in
19658darwin) multiarch="$define" ;;
19659esac
19660case "$multiarch" in
19661''|[nN]*) multiarch="$undef" ;;
19662esac
19663
19664: check for ordering of bytes in a UV
19665echo " "
19666case "$multiarch" in
19667*$define*)
19668	$cat <<EOM
19669You seem to be doing a multiarchitecture build,
19670skipping the byteorder check.
19671
19672EOM
19673	byteorder='ffff'
19674	;;
19675*)
19676	case "$byteorder" in
19677	'')
19678		$cat <<'EOM'
19679In the following, larger digits indicate more significance.  A big-endian
19680machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19681little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19682machines may have weird orders like 3412.  A Cray will report 87654321,
19683an Alpha will report 12345678. If the test program works the default is
19684probably right.
19685I'm now running the test program...
19686EOM
19687		$cat >try.c <<EOCP
19688#include <stdio.h>
19689#$i_stdlib I_STDLIB
19690#ifdef I_STDLIB
19691#include <stdlib.h>
19692#endif
19693#include <sys/types.h>
19694typedef $uvtype UV;
19695int main()
19696{
19697	int i;
19698	union {
19699		UV l;
19700		char c[$uvsize];
19701	} u;
19702
19703	if ($uvsize > 4)
19704		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19705	else
19706		u.l = (UV)0x04030201;
19707	for (i = 0; i < $uvsize; i++)
19708		printf("%c", u.c[i]+'0');
19709	printf("\n");
19710	exit(0);
19711}
19712EOCP
19713		xxx_prompt=y
19714		set try
19715		if eval $compile && $run ./try > /dev/null; then
19716			dflt=`$run ./try`
19717			case "$dflt" in
19718			[1-4][1-4][1-4][1-4]|12345678|87654321)
19719				echo "(The test program ran ok.)"
19720				echo "byteorder=$dflt"
19721				xxx_prompt=n
19722			;;
19723			????|????????) echo "(The test program ran ok.)" ;;
19724			*) echo "(The test program didn't run right for some reason.)" ;;
19725			esac
19726		else
19727			dflt='4321'
19728			cat <<'EOM'
19729(I can't seem to compile the test program.  Guessing big-endian...)
19730EOM
19731		fi
19732		case "$xxx_prompt" in
19733		y)
19734			rp="What is the order of bytes in $uvtype?"
19735			. ./myread
19736			byteorder="$ans"
19737			;;
19738		*)	byteorder=$dflt
19739			;;
19740		esac
19741		;;
19742	esac
19743	$rm_try
19744	;;
19745esac
19746
19747: Checking 32bit alignedness
19748$cat <<EOM
19749
19750Checking to see whether you can access character data unalignedly...
19751EOM
19752case "$d_u32align" in
19753'')   $cat >try.c <<EOCP
19754#include <stdio.h>
19755#$i_stdlib I_STDLIB
19756#ifdef I_STDLIB
19757#include <stdlib.h>
19758#endif
19759#define U32 $u32type
19760#define BYTEORDER 0x$byteorder
19761#define U8 $u8type
19762#include <signal.h>
19763#ifdef SIGBUS
19764$signal_t bletch(int s) { exit(4); }
19765#endif
19766int main() {
19767#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19768    volatile U8 buf[8];
19769    volatile U32 *up;
19770    int i;
19771
19772    if (sizeof(U32) != 4) {
19773	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19774	exit(1);
19775    }
19776
19777    fflush(stdout);
19778
19779#ifdef SIGBUS
19780    signal(SIGBUS, bletch);
19781#endif
19782
19783    buf[0] = 0;
19784    buf[1] = 0;
19785    buf[2] = 0;
19786    buf[3] = 1;
19787    buf[4] = 0;
19788    buf[5] = 0;
19789    buf[6] = 0;
19790    buf[7] = 1;
19791
19792    for (i = 0; i < 4; i++) {
19793	up = (U32*)(buf + i);
19794	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19795	       (*up == 1 << (8*(3-i)))  /* little-endian */
19796	      )
19797	   )
19798	{
19799	    printf("read failed (%x)\n", *up);
19800	    exit(2);
19801	}
19802    }
19803
19804    /* write test */
19805    for (i = 0; i < 4; i++) {
19806	up = (U32*)(buf + i);
19807	*up = 0xBeef;
19808	if (*up != 0xBeef) {
19809	    printf("write failed (%x)\n", *up);
19810	    exit(3);
19811	}
19812    }
19813
19814    exit(0);
19815#else
19816    printf("1\n");
19817    exit(1);
19818#endif
19819    return 0;
19820}
19821EOCP
19822set try
19823if eval $compile_ok; then
19824	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19825	$run ./try 2>&1 >/dev/null
19826	case "$?" in
19827	0)	cat >&4 <<EOM
19828You can access character data pretty unalignedly.
19829EOM
19830		d_u32align="$undef"
19831		;;
19832	*)	cat >&4 <<EOM
19833It seems that you must access character data in an aligned manner.
19834EOM
19835		d_u32align="$define"
19836		;;
19837	esac
19838else
19839	rp='Can you access character data at unaligned addresses?'
19840	dflt='n'
19841	. ./myread
19842	case "$ans" in
19843	[yY]*)	d_u32align="$undef"  ;;
19844	*)	d_u32align="$define" ;;
19845	esac
19846fi
19847$rm_try
19848;;
19849esac
19850
19851: see if ualarm exists
19852set ualarm d_ualarm
19853eval $inlibc
19854
19855: see if umask exists
19856set umask d_umask
19857eval $inlibc
19858
19859: see if unordered exists
19860set unordered d_unordered
19861eval $inlibc
19862
19863: see if unsetenv exists
19864set unsetenv d_unsetenv
19865eval $inlibc
19866
19867: see if usleep exists
19868set usleep d_usleep
19869eval $inlibc
19870
19871: see if prototype for usleep is available
19872echo " "
19873set d_usleepproto usleep $i_unistd unistd.h
19874eval $hasproto
19875
19876: see if ustat exists
19877set ustat d_ustat
19878eval $inlibc
19879
19880: see if closedir exists
19881set closedir d_closedir
19882eval $inlibc
19883
19884case "$d_closedir" in
19885"$define")
19886	echo " "
19887	echo "Checking whether closedir() returns a status..." >&4
19888	cat > try.c <<EOM
19889#$i_dirent I_DIRENT		/**/
19890#$i_sysdir I_SYS_DIR		/**/
19891#$i_sysndir I_SYS_NDIR		/**/
19892#$i_systypes I_SYS_TYPES	/**/
19893
19894#if defined(I_SYS_TYPES)
19895#include <sys/types.h>
19896#endif
19897#if defined(I_DIRENT)
19898#include <dirent.h>
19899#else
19900#ifdef I_SYS_NDIR
19901#include <sys/ndir.h>
19902#else
19903#ifdef I_SYS_DIR
19904#include <sys/dir.h>
19905#endif
19906#endif
19907#endif
19908int main() { return closedir(opendir(".")); }
19909EOM
19910	set try
19911	if eval $compile_ok; then
19912		if $run ./try > /dev/null 2>&1 ; then
19913			echo "Yes, it does."
19914			val="$undef"
19915		else
19916			echo "No, it doesn't."
19917			val="$define"
19918		fi
19919	else
19920		echo "(I can't seem to compile the test program--assuming it doesn't)"
19921		val="$define"
19922	fi
19923	;;
19924*)
19925	val="$undef";
19926	;;
19927esac
19928set d_void_closedir
19929eval $setvar
19930$rm_try
19931
19932: see if there is a wait4
19933set wait4 d_wait4
19934eval $inlibc
19935
19936: see if waitpid exists
19937set waitpid d_waitpid
19938eval $inlibc
19939
19940: see if wcrtomb exists
19941set wcrtomb d_wcrtomb
19942eval $inlibc
19943
19944: look for wcscmp
19945echo " "
19946$cat >try.c <<'EOCP'
19947#include <stdio.h>
19948#include <wchar.h>
19949int main ()
19950{
19951    wchar_t *s = L" ";
19952    return (wcscmp (s, s) ? 1 : 0);
19953    }
19954EOCP
19955set try
19956val="$undef"
19957if eval $compile; then
19958    `$run ./try`
19959    case "$?" in
19960	0)  echo "A working wcscmp() found." >&4
19961	    val="$define" ;;
19962	*)  echo "wcscmp() found, but it doesn't work" >&4
19963	    ;;
19964	esac
19965else
19966    echo "wcscmp() NOT found." >&4
19967    fi
19968set d_wcscmp
19969eval $setvar
19970$rm_try
19971
19972: see if wcstombs exists
19973set wcstombs d_wcstombs
19974eval $inlibc
19975
19976: look for wcsxfrm
19977echo " "
19978$cat >try.c <<'EOCP'
19979#include <errno.h>
19980#include <wchar.h>
19981int main ()
19982{
19983    wchar_t dst[4], *src = L" ";
19984    errno = 0;
19985    return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19986    }
19987EOCP
19988set try
19989val="$undef"
19990if eval $compile; then
19991    `$run ./try`
19992    case "$?" in
19993	0)  echo "A working wcsxfrm() found." >&4
19994	    val="$define" ;;
19995	*)  echo "wcsxfrm() found, but it doesn't work" >&4
19996	    ;;
19997	esac
19998else
19999    echo "wcsxfrm() NOT found." >&4
20000    fi
20001set d_wcsxfrm
20002eval $setvar
20003$rm_try
20004
20005: see if wctomb exists
20006set wctomb d_wctomb
20007eval $inlibc
20008
20009: see if writev exists
20010set writev d_writev
20011eval $inlibc
20012
20013: check for alignment requirements
20014echo " "
20015case "$alignbytes" in
20016    '') echo "Checking alignment constraints..." >&4
20017	$cat >try.c <<EOCP
20018#include <stdio.h>
20019struct foobar {
20020    char foo;
20021    $nvtype bar;
20022} try_algn;
20023int main()
20024{
20025    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20026    return(0);
20027}
20028EOCP
20029	set try
20030	if eval $compile_ok; then
20031	    dflt=`$run ./try`
20032	else
20033	    dflt='8'
20034	    echo "(I can't seem to compile the test program...)"
20035	fi
20036	case "$multiarch" in
20037	    *$define*)
20038		: The usual safe value is 8, but Darwin with -Duselongdouble
20039		: needs 16.  Hence, we will take 8 as a minimum, but allow
20040		: Configure to pick a larger value if needed.
20041		if $test "$dflt" -lt 8; then
20042		    dflt='8'
20043		    echo "Setting alignment to 8 for multiarch support.">&4
20044		fi
20045		;;
20046	esac
20047	;;
20048    *) dflt="$alignbytes"
20049	;;
20050esac
20051rp="Doubles must be aligned on a how-many-byte boundary?"
20052. ./myread
20053alignbytes="$ans"
20054$rm_try
20055
20056: set the base revision
20057baserev=5.0
20058
20059: length of character in bytes. Is always 1, otherwise it is not C
20060: This used to be a test using sizeof
20061charsize=1
20062
20063: Check for the number of bits in a character
20064case "$charbits" in
20065'')	echo "Checking how long a character is (in bits)..." >&4
20066	$cat >try.c <<EOCP
20067#include <stdio.h>
20068int main ()
20069{
20070    int n;
20071    unsigned char c;
20072    for (c = 1, n = 0; c; c <<= 1, n++) ;
20073    printf ("%d\n", n);
20074    return (0);
20075    }
20076EOCP
20077	set try
20078	if eval $compile_ok; then
20079		dflt=`$run ./try`
20080	else
20081		dflt='8'
20082		echo "(I can't seem to compile the test program.  Guessing...)"
20083	fi
20084	;;
20085*)
20086	dflt="$charbits"
20087	;;
20088esac
20089rp="What is the length of a character (in bits)?"
20090. ./myread
20091charbits="$ans"
20092$rm_try
20093case "$charbits" in
200948)	;;
20095*)	cat >&4 << EOM
20096Your system has an unsigned character size of $charbits bits, which
20097is rather unusual (normally it is 8 bits).  Perl likely will not work
20098correctly on your system, with subtle bugs in various places.
20099EOM
20100	rp='Do you really want to continue?'
20101	dflt='n'
20102	. ./myread
20103	case "$ans" in
20104		[yY])	echo >&4 "Okay, continuing."	;;
20105		*)	exit 1				;;
20106	esac
20107esac
20108
20109: how do we concatenate cpp tokens here?
20110echo " "
20111echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20112$cat >cpp_stuff.c <<'EOCP'
20113#define RCAT(a,b)a/**/b
20114#define ACAT(a,b)a ## b
20115RCAT(Rei,ser)
20116ACAT(Cir,cus)
20117EOCP
20118$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20119if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20120	echo "Oh!  Smells like ANSI's been here." >&4
20121	echo "We can catify or stringify, separately or together!"
20122	cpp_stuff=42
20123elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20124	echo "Ah, yes!  The good old days!" >&4
20125	echo "However, in the good old days we don't know how to stringify and"
20126	echo "catify at the same time."
20127	cpp_stuff=1
20128else
20129	$cat >&4 <<EOM
20130Hmm, I don't seem to be able to concatenate tokens with your cpp.
20131You're going to have to edit the values of CAT[2-5] in config.h...
20132EOM
20133	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20134fi
20135$rm -f cpp_stuff.*
20136
20137: see if this is a db.h system
20138set db.h i_db
20139eval $inhdr
20140
20141case "$i_db" in
20142$define)
20143	: Check db version.
20144	echo " "
20145	echo "Checking Berkeley DB version ..." >&4
20146	$cat >try.c <<EOCP
20147#include <sys/types.h>
20148#include <stdio.h>
20149#$i_stdlib I_STDLIB
20150#ifdef I_STDLIB
20151#include <stdlib.h>
20152#endif
20153#include <db.h>
20154int main(int argc, char *argv[])
20155{
20156#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
20157    int Major, Minor, Patch ;
20158    unsigned long Version ;
20159    (void)db_version(&Major, &Minor, &Patch) ;
20160    if (argc == 2) {
20161        printf("%d %d %d %d %d %d\n",
20162               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20163               Major, Minor, Patch);
20164        exit(0);
20165    }
20166    printf("You have Berkeley DB Version 2 or greater.\n");
20167
20168    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20169		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20170    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20171		Major, Minor, Patch) ;
20172
20173    /* check that db.h & libdb are compatible */
20174    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20175	printf("db.h and libdb are incompatible.\n") ;
20176        exit(3);
20177    }
20178
20179    printf("db.h and libdb are compatible.\n") ;
20180
20181    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20182		+ DB_VERSION_PATCH ;
20183
20184    /* needs to be >= 2.3.4 */
20185    if (Version < 2003004) {
20186    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20187	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20188        exit(2);
20189    }
20190
20191    exit(0);
20192#else
20193#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20194    if (argc == 2) {
20195        printf("1 0 0\n");
20196        exit(0);
20197    }
20198    printf("You have Berkeley DB Version 1.\n");
20199    exit(0);	/* DB version < 2: the coast is clear. */
20200#else
20201    exit(1);	/* <db.h> not Berkeley DB? */
20202#endif
20203#endif
20204}
20205EOCP
20206	set try
20207	if eval $compile_ok && $run ./try; then
20208		echo 'Looks OK.' >&4
20209		set `$run ./try 1`
20210		db_version_major=$1
20211		db_version_minor=$2
20212		db_version_patch=$3
20213	else
20214		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20215		i_db=$undef
20216		case " $libs " in
20217		*"-ldb "*)
20218			: Remove db from list of libraries to use
20219			echo "Removing unusable -ldb from library list" >&4
20220			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20221			shift
20222			libs="$*"
20223			echo "libs = $libs" >&4
20224			;;
20225		esac
20226	fi
20227	$rm_try
20228	;;
20229esac
20230
20231case "$i_db" in
20232define)
20233	: Check the return type needed for hash
20234	echo " "
20235	echo "Checking return type needed for hash for Berkeley DB ..." >&4
20236	$cat >try.c <<EOCP
20237#include <sys/types.h>
20238#include <db.h>
20239
20240#ifndef DB_VERSION_MAJOR
20241u_int32_t hash_cb (const void* ptr, size_t size)
20242{
20243	return 0;
20244}
20245HASHINFO info;
20246int main()
20247{
20248	info.hash = hash_cb;
20249}
20250#endif
20251EOCP
20252	if $cc $ccflags -c try.c >try.out 2>&1 ; then
20253		if $contains warning try.out >>/dev/null 2>&1 ; then
20254			db_hashtype='int'
20255		else
20256			db_hashtype='u_int32_t'
20257		fi
20258	else
20259		: XXX Maybe we should just give up here.
20260		db_hashtype=u_int32_t
20261		$cat try.out >&4
20262		echo "Help:  I can't seem to compile the db test program." >&4
20263		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20264	fi
20265	$rm_try
20266	echo "Your version of Berkeley DB uses $db_hashtype for hash."
20267	;;
20268*)	db_hashtype=u_int32_t
20269	;;
20270esac
20271case "$i_db" in
20272define)
20273	: Check the return type needed for prefix
20274	echo " "
20275	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20276	cat >try.c <<EOCP
20277#include <sys/types.h>
20278#include <db.h>
20279
20280#ifndef DB_VERSION_MAJOR
20281size_t prefix_cb (const DBT *key1, const DBT *key2)
20282{
20283	return 0;
20284}
20285BTREEINFO info;
20286int main()
20287{
20288	info.prefix = prefix_cb;
20289}
20290#endif
20291EOCP
20292	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20293		if $contains warning try.out >>/dev/null 2>&1 ; then
20294			db_prefixtype='int'
20295		else
20296			db_prefixtype='size_t'
20297		fi
20298	else
20299		db_prefixtype='size_t'
20300		: XXX Maybe we should just give up here.
20301		$cat try.out >&4
20302		echo "Help:  I can't seem to compile the db test program." >&4
20303		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20304	fi
20305	$rm_try
20306	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20307	;;
20308*)	db_prefixtype='size_t'
20309	;;
20310esac
20311
20312: Include . in @INC
20313$cat <<EOM
20314
20315Historically Perl has provided a final fallback of the current working
20316directory '.' when searching for a library. This, however, can lead to
20317problems when a Perl program which loads optional modules is called from
20318a shared directory. This can lead to executing unexpected code.
20319
20320EOM
20321
20322# When changing to exclude by default:
20323case "$default_inc_excludes_dot" in
20324    $undef|false|[nN]*) dflt="n" ;;
20325    *)                  dflt="y" ;;
20326esac
20327# To turn exclude off by default:
20328#case "$default_inc_excludes_dot" in
20329#    $define|true|[yY]*) dflt="y" ;;
20330#    *)                  dflt="n" ;;
20331#esac
20332
20333rp='Exclude '.' from @INC by default? '
20334. ./myread
20335case "$ans" in
20336    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20337    *)          default_inc_excludes_dot="$define" ;;
20338esac
20339
20340: Check what kind of inf/nan your system has
20341$echo "Checking the kind of infinities and nans you have..." >&4
20342$echo "(The following tests may crash.  That's okay.)" >&4
20343$cat >try.c <<EOP
20344#define DOUBLESIZE $doublesize
20345#$d_longdbl HAS_LONG_DOUBLE
20346#ifdef HAS_LONG_DOUBLE
20347#define LONG_DOUBLESIZE $longdblsize
20348#define LONG_DOUBLEKIND $longdblkind
20349#endif
20350#include <math.h>
20351#include <string.h>
20352#include <stdio.h>
20353/* Note that whether the sign bit is on or off
20354 * for NaN depends on the CPU/FPU, and possibly
20355 * can be affected by the build toolchain.
20356 *
20357 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20358 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20359 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20360 * (respectively) as opposed to the more usual
20361 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20362 *
20363 * Pre-IEEE-754 floating point format do not even have inf/nan support
20364 * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20365 * to even mention, causing immediate SIGFPE or equivalent: this is
20366 * the case with VAX floating point, for example.
20367 */
20368static void bytes(void *v, unsigned int n) {
20369  unsigned char *p = (unsigned char *)v;
20370  int i;
20371  for (i = 0; i < n; i++) {
20372    printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20373  }
20374}
20375int main(int argc, char *argv[]) {
20376   /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20377    * because some compilers are 'smart' and not only warn but refuse to
20378    * compile such 'illegal' values. */
20379   double dinf = exp(1e9);
20380   double dnan = sqrt(-1.0);
20381#ifdef HAS_LONG_DOUBLE
20382   long double ldinf = (long double)exp(1e9);
20383   long double ldnan = (long double)sqrt(-1.0);
20384# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20385/* the 80-bit long doubles might have garbage in their excess bytes */
20386    memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20387    memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20388# endif
20389  if (argc == 2) {
20390    switch (argv[1][0]) {
20391    case '1': bytes(&dinf, sizeof(dinf)); break;
20392    case '2': bytes(&dnan, sizeof(dnan)); break;
20393    case '3': bytes(&ldinf, sizeof(ldinf)); break;
20394    case '4': bytes(&ldnan, sizeof(ldnan)); break;
20395#endif
20396    }
20397  }
20398  return 0;
20399}
20400EOP
20401set try
20402if eval $compile; then
20403    doubleinfbytes=`$run ./try 1`
20404    doublenanbytes=`$run ./try 2`
20405    case "$d_longdbl" in
20406    $define)
20407      longdblinfbytes=`$run ./try 3`
20408      longdblnanbytes=`$run ./try 4`
20409      ;;
20410    esac
20411else
20412    # Defaults in case the above test program failed.
20413    case "$doublekind" in
20414    1) # IEEE 754 32-bit LE
20415       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20416       doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20417       ;;
20418    2) # IEEE 754 32-bit BE
20419       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20420       doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20421       ;;
20422    3) # IEEE 754 64-bit LE
20423       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20424       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20425       ;;
20426    4) # IEEE 754 64-bit BE
20427       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20428       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20429       ;;
20430    5) # IEEE 754 128-bit LE
20431       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20432       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20433       ;;
20434    6) # IEEE 754 128-bit BE
20435       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20436       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20437       ;;
20438    7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20439       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20440       doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20441       ;;
20442    8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20443       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20444       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20445       ;;
20446    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20447       doubleinfbytes=$undef
20448       doublenanbytes=$undef
20449       ;;
20450    *) # No idea.
20451       doubleinfbytes=$undef
20452       doublenanbytes=$undef
20453       ;;
20454    esac
20455    case "$longdblkind" in
20456    1) # IEEE 754 128-bit LE
20457       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20458       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20459       ;;
20460    2) # IEEE 754 128-bit BE
20461       longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20462       longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20463       ;;
20464    3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20465       case "$longdblsize" in
20466       12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20467           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20468           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20469           ;;
20470       16) # x86_64
20471           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20472           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20473           ;;
20474       *)  # No idea.
20475           longdblinfbytes=$undef
20476           longdblnanbytes=$undef
20477       ;;
20478       esac
20479       ;;
20480    4) # IEEE 754 80-bit BE, 12 or 16 bytes
20481       case "$longdblsize" in
20482       12) # 32-bit system
20483           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20484           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20485           ;;
20486       16) # 64-bit system
20487           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20488           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20489           ;;
20490       *)  # No idea.
20491           longdblinfbytes=$undef
20492           longdblnanbytes=$undef
20493       ;;
20494       esac
20495       ;;
20496    5) # 128-bit LE-LE "double double"
20497       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20498       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20499       ;;
20500    6) # 128-bit BE-BE "double double"
20501       longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20502       longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20503       ;;
20504    7) # 128-bit LE-BE "double double"
20505       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20506       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20507       ;;
20508    8) # 128-bit BE-LE "double double"
20509       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20510       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20511       ;;
20512    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20513       longdblinfbytes=$undef
20514       longdblnanbytes=$undef
20515       ;;
20516    *) # No idea.
20517       longdblinfbytes=$undef
20518       longdblnanbytes=$undef
20519       ;;
20520    esac
20521fi
20522# In case the program crashed the values are empty, turn them undef.
20523case "$doubleinfbytes" in
20524'') doubleinfbytes=$undef ;;
20525esac
20526case "$doublenanbytes" in
20527'') doublenanbytes=$undef ;;
20528esac
20529case "$longdblinfbytes" in
20530'') longdblinfbytes=$undef ;;
20531esac
20532case "$longdblnanbytes" in
20533'') longdblnanbytes=$undef ;;
20534esac
20535$rm_try
20536
20537: Check the length of the double mantissa
20538$echo "Checking how many mantissa bits your doubles have..." >&4
20539$cat >try.c <<EOP
20540#$i_sunmath I_SUNMATH
20541#include <float.h>
20542#ifdef I_SUNMATH
20543# include <sunmath.h>
20544#endif
20545#ifdef DBL_MANT_DIG
20546# define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20547#endif
20548#include <stdio.h>
20549int main(int argc, char *argv[]) {
20550#ifdef BITS
20551  printf("%d\n", BITS);
20552#endif
20553  return 0;
20554}
20555EOP
20556set try
20557if eval $compile; then
20558    doublemantbits=`$run ./try`
20559else
20560    doublemantbits="$undef"
20561fi
20562$rm_try
20563
20564: Check the length of the longdouble mantissa
20565$echo "Checking how many mantissa bits your long doubles have..." >&4
20566$cat >try.c <<EOP
20567#$i_sunmath I_SUNMATH
20568#include <float.h>
20569#ifdef I_SUNMATH
20570# include <sunmath.h>
20571#endif
20572#$d_longdbl HAS_LONG_DOUBLE
20573#if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20574# if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20575/* This format has no implicit bit.  Beware, however, that for
20576 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20577 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20578 * and the top bit must have been one since 387, zero is plain invalid.
20579 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20580#  define BITS LDBL_MANT_DIG
20581# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20582/* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20583 * reason e.g. Irix thinks 107.  But in any case, we want only
20584 * the number of real bits, the implicit bits are of no interest.  */
20585#  define BITS 2 * (DBL_MANT_DIG - 1)
20586# else
20587#  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20588# endif
20589#endif
20590#include <stdio.h>
20591int main(int argc, char *argv[]) {
20592#ifdef BITS
20593  printf("%d\n", BITS);
20594#endif
20595  return 0;
20596}
20597EOP
20598set try
20599if eval $compile; then
20600    longdblmantbits=`$run ./try`
20601else
20602    longdblmantbits="$undef"
20603fi
20604$rm_try
20605
20606: Check the length of the NV mantissa
20607$echo "Checking how many mantissa bits your NVs have..." >&4
20608if test "X$usequadmath" = "X$define"; then
20609  nvmantbits=112 # 128-1-15
20610else
20611  if test "X$nvsize" = "X$doublesize"; then
20612    nvmantbits="$doublemantbits"
20613  else
20614     if test "X$nvsize" = "X$longdblsize"; then
20615       nvmantbits="$longdblmantbits"
20616     else
20617       nvmantbits="$undef"
20618     fi
20619  fi
20620fi
20621
20622: How can we generate normalized random numbers ?
20623echo " "
20624echo "Using our internal random number implementation..." >&4
20625
20626case "$ccflags" in
20627*-Dmy_rand=*|*-Dmy_srand=*)
20628	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20629	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20630	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20631	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20632	;;
20633esac
20634
20635randfunc=Perl_drand48
20636drand01="Perl_drand48()"
20637seedfunc="Perl_drand48_init"
20638randbits=48
20639randseedtype=U32
20640
20641: Probe whether dtrace builds an object, as newer Illumos requires an input
20642: object file that uses at least one of the probes defined in the .d file
20643case "$usedtrace" in
20644$define)
20645    case "$dtracexnolibs" in
20646    $define|true|[yY]*)
20647        dtracexnolibs=$define
20648	$dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20649	;;
20650    ' '|'')
20651        if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20652	     dtracexnolibs=$define
20653	     echo "Your dtrace accepts -xnolibs"
20654	elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20655	     dtracexnolibs=$undef
20656	     echo "Your dtrace doesn't accept -xnolibs"
20657	else
20658             echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20659	     exit 1
20660	fi
20661	;;
20662    *)
20663        dtracexnolibs=$undef
20664	$dtrace -h -s ../perldtrace.d -o perldtrace.h
20665	;;
20666    esac
20667    case $dtracexnolibs in
20668    $define) xnolibs=-xnolibs ;;
20669    *) xnolibs= ;;
20670    esac
20671
20672    case "$dtraceobject" in
20673    $define|true|[yY]*)
20674        dtraceobject=$define
20675        ;;
20676    ' '|'')
20677        $cat >try.c <<EOM
20678#include "perldtrace.h"
20679int main(void) {
20680    PERL_LOADED_FILE("dummy");
20681    return 0;
20682}
20683EOM
20684        dtraceobject=$undef
20685        if $cc -c -o try.o $optimize $ccflags try.c \
20686                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20687                dtraceobject=$define
20688            echo "Your dtrace builds an object file"
20689        fi
20690        ;;
20691    *) dtraceobject=$undef ;;
20692    esac
20693    $rm_try perldtrace.o perldtrace.h
20694esac
20695
20696: Determine if this is an EBCDIC system
20697echo " "
20698echo "Determining whether or not we are on an EBCDIC system..." >&4
20699$cat >try.c <<'EOM'
20700int main()
20701{
20702  if ('M'==0xd4) return 0;
20703  return 1;
20704}
20705EOM
20706
20707val=$undef
20708set try
20709if eval $compile_ok; then
20710	if $run ./try; then
20711		echo "You seem to speak EBCDIC." >&4
20712		val="$define"
20713	else
20714		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20715	fi
20716else
20717	echo "I'm unable to compile the test program." >&4
20718	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20719fi
20720$rm_try
20721set ebcdic
20722eval $setvar
20723
20724: Check how to flush
20725echo " "
20726$cat >&4 <<EOM
20727Checking how to flush all pending stdio output...
20728EOM
20729# I only know how to find the first 32 possibly open files on SunOS.
20730# See also hints/sunos_4_1.sh and util.c  --AD
20731case "$osname" in
20732sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20733esac
20734$cat >>try.c <<EOCP
20735#include <stdio.h>
20736#$i_stdlib I_STDLIB
20737#ifdef I_STDLIB
20738#include <stdlib.h>
20739#endif
20740#$i_unistd I_UNISTD
20741#ifdef I_UNISTD
20742# include <unistd.h>
20743#endif
20744#$d_sysconf HAS_SYSCONF
20745#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20746#ifdef HAS_STDIO_STREAM_ARRAY
20747# define STDIO_STREAM_ARRAY $stdio_stream_array
20748#endif
20749int main() {
20750  FILE* p;
20751  unlink("try.out");
20752  p = fopen("try.out", "w");
20753#ifdef TRY_FPUTC
20754  fputc('x', p);
20755#else
20756# ifdef TRY_FPRINTF
20757  fprintf(p, "x");
20758# endif
20759#endif
20760#ifdef TRY_FFLUSH_NULL
20761  fflush(NULL);
20762#endif
20763#ifdef TRY_FFLUSH_ALL
20764  {
20765    long open_max = -1;
20766# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20767    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20768# else
20769#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20770    open_max = sysconf(_SC_OPEN_MAX);
20771#  else
20772#   ifdef FOPEN_MAX
20773    open_max = FOPEN_MAX;
20774#   else
20775#    ifdef OPEN_MAX
20776    open_max = OPEN_MAX;
20777#    else
20778#     ifdef _NFILE
20779    open_max = _NFILE;
20780#     endif
20781#    endif
20782#   endif
20783#  endif
20784# endif
20785# ifdef HAS_STDIO_STREAM_ARRAY
20786    if (open_max > 0) {
20787      long i;
20788      for (i = 0; i < open_max; i++)
20789	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20790		STDIO_STREAM_ARRAY[i]._file < open_max &&
20791		STDIO_STREAM_ARRAY[i]._flag)
20792		fflush(&STDIO_STREAM_ARRAY[i]);
20793    }
20794  }
20795# endif
20796#endif
20797  _exit(42);
20798}
20799EOCP
20800: first we have to find out how _not_ to flush
20801$to try.c
20802if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20803    output=''
20804    set try -DTRY_FPUTC
20805    if eval $compile; then
20806	    $run ./try 2>/dev/null
20807	    code="$?"
20808	    $from try.out
20809	    if $test ! -s try.out -a "X$code" = X42; then
20810		output=-DTRY_FPUTC
20811	    fi
20812    fi
20813    case "$output" in
20814    '')
20815	    set try -DTRY_FPRINTF
20816	    if eval $compile; then
20817		    $run ./try 2>/dev/null
20818		    code="$?"
20819		    $from try.out
20820		    if $test ! -s try.out -a "X$code" = X42; then
20821			output=-DTRY_FPRINTF
20822		    fi
20823	    fi
20824	;;
20825    esac
20826fi
20827: check for fflush NULL behavior
20828case "$fflushNULL" in
20829'')	set try -DTRY_FFLUSH_NULL $output
20830	if eval $compile; then
20831		$run ./try 2>/dev/null
20832		code="$?"
20833		$from try.out
20834		if $test -s try.out -a "X$code" = X42; then
20835			fflushNULL="`$cat try.out`"
20836		else
20837			if $test "X$code" != X42; then
20838				$cat >&4 <<EOM
20839(If this test failed, don't worry, we'll try another method shortly.)
20840EOM
20841			fi
20842		fi
20843	fi
20844	$rm -f core try.core core.try.*
20845	case "$fflushNULL" in
20846	x)	$cat >&4 <<EOM
20847Your fflush(NULL) works okay for output streams.
20848Let's see if it clobbers input pipes...
20849EOM
20850# As of mid-March 2000 all versions of Solaris appear to have a stdio
20851# bug that improperly flushes the input end of pipes.  So we avoid the
20852# autoflush on fork/system/exec support for now. :-(
20853$cat >tryp.c <<EOCP
20854#include <stdio.h>
20855int
20856main(int argc, char **argv)
20857{
20858    char buf[1024];
20859    int i;
20860    char *bp = buf;
20861    while (1) {
20862	while ((i = getc(stdin)) != -1
20863	       && (*bp++ = i) != '\n'
20864	       && bp < &buf[1024])
20865	/* DO NOTHING */ ;
20866	*bp = '\0';
20867	fprintf(stdout, "%s", buf);
20868	fflush(NULL);
20869	if (i == -1)
20870	    return 0;
20871	bp = buf;
20872    }
20873}
20874EOCP
20875		fflushNULL="$define"
20876		set tryp
20877		if eval $compile; then
20878		    $rm -f tryp.out
20879		    # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20880		    if $test "X$targethost" != X; then
20881			$to tryp.c
20882			$to tryp
20883			$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20884		    else
20885			$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20886		    fi
20887		    if cmp tryp.c tryp.out >/dev/null 2>&1; then
20888		       $cat >&4 <<EOM
20889fflush(NULL) seems to behave okay with input streams.
20890EOM
20891			fflushNULL="$define"
20892		    else
20893			$cat >&4 <<EOM
20894Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20895EOM
20896			fflushNULL="$undef"
20897		    fi
20898		fi
20899		$rm -f core tryp.c tryp.core core.tryp.*
20900		;;
20901	'')	$cat >&4 <<EOM
20902Your fflush(NULL) isn't working (contrary to ANSI C).
20903EOM
20904		fflushNULL="$undef"
20905		;;
20906	*)	$cat >&4 <<EOM
20907Cannot figure out whether your fflush(NULL) works or not.
20908I'm assuming it doesn't (contrary to ANSI C).
20909EOM
20910		fflushNULL="$undef"
20911		;;
20912	esac
20913	;;
20914$define|true|[yY]*)
20915	fflushNULL="$define"
20916	;;
20917*)
20918	fflushNULL="$undef"
20919	;;
20920esac
20921: check explicit looping only if NULL did not work, and if the pipe
20922: bug does not show up on an explicit flush too
20923case "$fflushNULL" in
20924"$undef")
20925	$cat >tryp.c <<EOCP
20926#include <stdio.h>
20927int
20928main(int argc, char **argv)
20929{
20930    char buf[1024];
20931    int i;
20932    char *bp = buf;
20933    while (1) {
20934	while ((i = getc(stdin)) != -1
20935	       && (*bp++ = i) != '\n'
20936	       && bp < &buf[1024])
20937	/* DO NOTHING */ ;
20938	*bp = '\0';
20939	fprintf(stdout, "%s", buf);
20940	fflush(stdin);
20941	if (i == -1)
20942	    return 0;
20943	bp = buf;
20944    }
20945}
20946EOCP
20947	set tryp
20948	if eval $compile; then
20949	    $rm -f tryp.out
20950	    if $test "X$targethost" != X; then
20951		$to tryp.c
20952		$to tryp
20953		$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20954	    else
20955		$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20956	    fi
20957	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
20958	       $cat >&4 <<EOM
20959Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20960EOM
20961		: now check for fflushall behaviour
20962		case "$fflushall" in
20963		'')	set try -DTRY_FFLUSH_ALL $output
20964			if eval $compile; then
20965				$cat >&4 <<EOM
20966(Now testing the other method--but note that this also may fail.)
20967EOM
20968				$run ./try 2>/dev/null
20969				code=$?
20970				$from try.out
20971				if $test -s try.out -a "X$code" = X42; then
20972					fflushall="`$cat try.out`"
20973				fi
20974			fi
20975			$rm_try
20976			case "$fflushall" in
20977			x)	$cat >&4 <<EOM
20978Whew. Flushing explicitly all the stdio streams works.
20979EOM
20980				fflushall="$define"
20981				;;
20982			'')	$cat >&4 <<EOM
20983Sigh. Flushing explicitly all the stdio streams doesn't work.
20984EOM
20985				fflushall="$undef"
20986				;;
20987			*)	$cat >&4 <<EOM
20988Cannot figure out whether flushing stdio streams explicitly works or not.
20989I'm assuming it doesn't.
20990EOM
20991				fflushall="$undef"
20992				;;
20993			esac
20994			;;
20995		"$define"|true|[yY]*)
20996			fflushall="$define"
20997			;;
20998		*)
20999			fflushall="$undef"
21000			;;
21001		esac
21002	    else
21003		$cat >&4 <<EOM
21004All is futile.  Even fflush(stdin) clobbers input pipes!
21005EOM
21006		fflushall="$undef"
21007	    fi
21008	else
21009	    fflushall="$undef"
21010	fi
21011	$rm -f core tryp.c tryp.core core.tryp.*
21012	;;
21013*)	fflushall="$undef"
21014	;;
21015esac
21016
21017case "$fflushNULL$fflushall" in
21018undefundef)
21019	$cat <<EOM
21020OK, I give up.  I cannot figure out how to flush pending stdio output.
21021We won't be flushing handles at all before fork/exec/popen.
21022EOM
21023	;;
21024esac
21025$rm_try tryp
21026
21027: Store the full pathname to the ar program for use in the C program
21028: Respect a hint or command line value for full_ar.
21029case "$full_ar" in
21030'') full_ar=$ar ;;
21031esac
21032
21033: Store the full pathname to the sed program for use in the C program
21034full_sed=$sed
21035
21036: see what type gids are declared as in the kernel
21037echo " "
21038echo "Looking for the type for group ids returned by getgid()."
21039set gid_t gidtype xxx stdio.h sys/types.h
21040eval $typedef
21041case "$gidtype" in
21042xxx)
21043	xxx=`./findhdr sys/user.h`
21044	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21045	case $1 in
21046	unsigned) dflt="$1 $2" ;;
21047	*) dflt="$1" ;;
21048	esac
21049	;;
21050*) dflt="$gidtype";;
21051esac
21052case "$gidtype" in
21053gid_t) echo "gid_t found." ;;
21054*)	rp="What is the type for group ids returned by getgid()?"
21055	. ./myread
21056	gidtype="$ans"
21057	;;
21058esac
21059
21060: Check the size of GID
21061echo " "
21062case "$gidtype" in
21063*_t) zzz="$gidtype"	;;
21064*)   zzz="gid"		;;
21065esac
21066echo "Checking the size of $zzz..." >&4
21067cat > try.c <<EOCP
21068#include <sys/types.h>
21069#include <stdio.h>
21070#$i_stdlib I_STDLIB
21071#ifdef I_STDLIB
21072#include <stdlib.h>
21073#endif
21074int main() {
21075    printf("%d\n", (int)sizeof($gidtype));
21076    exit(0);
21077}
21078EOCP
21079set try
21080if eval $compile_ok; then
21081	yyy=`$run ./try`
21082	case "$yyy" in
21083	'')	gidsize=4
21084		echo "(I can't execute the test program--guessing $gidsize.)" >&4
21085		;;
21086	*)	gidsize=$yyy
21087		echo "Your $zzz is $gidsize bytes long."
21088		;;
21089	esac
21090else
21091	gidsize=4
21092	echo "(I can't compile the test program--guessing $gidsize.)" >&4
21093fi
21094
21095: Check if GID is signed
21096echo " "
21097case "$gidtype" in
21098*_t) zzz="$gidtype"	;;
21099*)   zzz="gid"		;;
21100esac
21101echo "Checking the sign of $zzz..." >&4
21102cat > try.c <<EOCP
21103#include <sys/types.h>
21104#include <stdio.h>
21105int main() {
21106	$gidtype foo = -1;
21107	if (foo < 0)
21108		printf("-1\n");
21109	else
21110		printf("1\n");
21111}
21112EOCP
21113set try
21114if eval $compile; then
21115	yyy=`$run ./try`
21116	case "$yyy" in
21117	'')	gidsign=1
21118		echo "(I can't execute the test program--guessing unsigned.)" >&4
21119		;;
21120	*)	gidsign=$yyy
21121		case "$gidsign" in
21122		 1) echo "Your $zzz is unsigned." ;;
21123		-1) echo "Your $zzz is signed."   ;;
21124		esac
21125		;;
21126	esac
21127else
21128	gidsign=1
21129	echo "(I can't compile the test program--guessing unsigned.)" >&4
21130fi
21131
21132: Check 64bit sizes
21133echo " "
21134
21135if $test X"$quadtype" != X; then
21136
21137echo "Checking how to print 64-bit integers..." >&4
21138
21139if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21140	$cat >try.c <<'EOCP'
21141#include <sys/types.h>
21142#include <stdio.h>
21143int main() {
21144  int q = 12345678901;
21145  printf("%ld\n", q);
21146}
21147EOCP
21148	set try
21149	if eval $compile; then
21150		yyy=`$run ./try`
21151		case "$yyy" in
21152		12345678901)
21153			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21154			sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21155			echo "We will use %d."
21156			;;
21157		esac
21158	fi
21159fi
21160
21161if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21162	$cat >try.c <<'EOCP'
21163#include <sys/types.h>
21164#include <stdio.h>
21165int main() {
21166  long q = 12345678901;
21167  printf("%ld\n", q);
21168}
21169EOCP
21170	set try
21171	if eval $compile; then
21172		yyy=`$run ./try`
21173		case "$yyy" in
21174		12345678901)
21175			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21176			sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21177			echo "We will use %ld."
21178			;;
21179		esac
21180	fi
21181fi
21182
21183if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21184	$cat >try.c <<'EOCP'
21185#include <sys/types.h>
21186#include <inttypes.h>
21187#include <stdio.h>
21188int main() {
21189  int64_t q = 12345678901;
21190  printf("%" PRId64 "\n", q);
21191}
21192EOCP
21193	set try
21194	if eval $compile; then
21195		yyy=`$run ./try`
21196		case "$yyy" in
21197		12345678901)
21198			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21199			sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21200			echo "We will use the C9X style."
21201			;;
21202		esac
21203	fi
21204fi
21205
21206if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21207	$cat >try.c <<EOCP
21208#include <sys/types.h>
21209#include <stdio.h>
21210int main() {
21211  $quadtype q = 12345678901;
21212  printf("%Ld\n", q);
21213}
21214EOCP
21215	set try
21216	if eval $compile; then
21217		yyy=`$run ./try`
21218		case "$yyy" in
21219		12345678901)
21220			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21221			sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21222			echo "We will use %Ld."
21223			;;
21224		esac
21225	fi
21226fi
21227
21228if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21229	$cat >try.c <<'EOCP'
21230#include <sys/types.h>
21231#include <stdio.h>
21232int main() {
21233  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21234  printf("%lld\n", q);
21235}
21236EOCP
21237	set try
21238	if eval $compile; then
21239		yyy=`$run ./try`
21240		case "$yyy" in
21241		12345678901)
21242			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21243			sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21244			echo "We will use the %lld style."
21245			;;
21246		esac
21247	fi
21248fi
21249
21250if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21251	$cat >try.c <<EOCP
21252#include <sys/types.h>
21253#include <stdio.h>
21254int main() {
21255  $quadtype q = 12345678901;
21256  printf("%qd\n", q);
21257}
21258EOCP
21259	set try
21260	if eval $compile; then
21261		yyy=`$run ./try`
21262		case "$yyy" in
21263		12345678901)
21264			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21265			sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21266			echo "We will use %qd."
21267			;;
21268		esac
21269	fi
21270fi
21271
21272if $test X"$sPRId64" = X; then
21273	echo "Cannot figure out how to print 64-bit integers." >&4
21274fi
21275$rm_try
21276
21277fi
21278
21279case "$sPRId64" in
21280'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21281	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21282	;;
21283*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21284	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21285	;;
21286esac
21287
21288: Check format strings for internal types
21289echo " "
21290$echo "Checking the format strings to be used for Perl's internal types..." >&4
21291
21292if $test X"$ivsize" = X8; then
21293	ivdformat="$sPRId64"
21294	uvuformat="$sPRIu64"
21295	uvoformat="$sPRIo64"
21296	uvxformat="$sPRIx64"
21297	uvXUformat="$sPRIXU64"
21298else
21299	if $test X"$ivsize" = X"$longsize"; then
21300		ivdformat='"ld"'
21301		uvuformat='"lu"'
21302		uvoformat='"lo"'
21303		uvxformat='"lx"'
21304		uvXUformat='"lX"'
21305	else
21306		if $test X"$ivsize" = X"$intsize"; then
21307			ivdformat='"d"'
21308			uvuformat='"u"'
21309			uvoformat='"o"'
21310			uvxformat='"x"'
21311			uvXUformat='"X"'
21312		else
21313			: far out
21314			if $test X"$ivsize" = X"$shortsize"; then
21315				ivdformat='"hd"'
21316				uvuformat='"hu"'
21317				uvoformat='"ho"'
21318				uvxformat='"hx"'
21319				uvXUformat='"hX"'
21320			fi
21321		fi
21322	fi
21323fi
21324
21325if $test X"$usequadmath" = X"$define"; then
21326    nveformat='"Qe"'
21327    nvfformat='"Qf"'
21328    nvgformat='"Qg"'
21329    nvEUformat='"QE"'
21330    nvFUformat='"QF"'
21331    nvGUformat='"QG"'
21332else
21333    if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21334	nveformat="$sPRIeldbl"
21335	nvfformat="$sPRIfldbl"
21336	nvgformat="$sPRIgldbl"
21337	nvEUformat="$sPRIEUldbl"
21338	nvFUformat="$sPRIFUldbl"
21339	nvGUformat="$sPRIGUldbl"
21340    else
21341	nveformat='"e"'
21342	nvfformat='"f"'
21343	nvgformat='"g"'
21344	nvEUformat='"E"'
21345	nvFUformat='"F"'
21346	nvGUformat='"G"'
21347    fi
21348fi
21349
21350case "$ivdformat" in
21351'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21352    exit 1
21353    ;;
21354esac
21355
21356: Check format string for GID
21357
21358echo " "
21359$echo "Checking the format string to be used for gids..." >&4
21360
21361case "$gidsign" in
21362-1)	if $test X"$gidsize" = X"$ivsize"; then
21363		gidformat="$ivdformat"
21364	else
21365		if $test X"$gidsize" = X"$longsize"; then
21366			gidformat='"ld"'
21367		else
21368			if $test X"$gidsize" = X"$intsize"; then
21369				gidformat='"d"'
21370			else
21371				if $test X"$gidsize" = X"$shortsize"; then
21372					gidformat='"hd"'
21373				fi
21374			fi
21375		fi
21376	fi
21377	;;
21378*)	if $test X"$gidsize" = X"$uvsize"; then
21379		gidformat="$uvuformat"
21380	else
21381		if $test X"$gidsize" = X"$longsize"; then
21382			gidformat='"lu"'
21383		else
21384			if $test X"$gidsize" = X"$intsize"; then
21385				gidformat='"u"'
21386			else
21387				if $test X"$gidsize" = X"$shortsize"; then
21388					gidformat='"hu"'
21389				fi
21390			fi
21391		fi
21392	fi
21393	;;
21394esac
21395
21396: see if getgroups exists
21397set getgroups d_getgrps
21398eval $inlibc
21399
21400: see if setgroups exists
21401set setgroups d_setgrps
21402eval $inlibc
21403
21404: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21405echo " "
21406case "$d_getgrps$d_setgrps" in
21407*define*)
21408	case "$groupstype" in
21409	'') dflt="$gidtype" ;;
21410	*)  dflt="$groupstype" ;;
21411	esac
21412	$cat <<EOM
21413What type of pointer is the second argument to getgroups() and setgroups()?
21414Usually this is the same as group ids, $gidtype, but not always.
21415
21416EOM
21417	rp='What type pointer is the second argument to getgroups() and setgroups()?'
21418	. ./myread
21419	groupstype="$ans"
21420	;;
21421*)  groupstype="$gidtype";;
21422esac
21423
21424: check whether make sets MAKE
21425echo " "
21426echo "Checking if your $make program sets \$(MAKE)..." >&4
21427case "$make_set_make" in
21428'')
21429	$sed 's/^X //' > testmake.mak << 'EOF'
21430Xall:
21431X 	@echo 'maketemp="$(MAKE)"'
21432EOF
21433	case "`$make -f testmake.mak 2>/dev/null`" in
21434	*maketemp=*) make_set_make='#' ;;
21435	*)	make_set_make="MAKE=$make" ;;
21436	esac
21437	$rm -f testmake.mak
21438	;;
21439esac
21440case "$make_set_make" in
21441'#') echo "Yup, it does.";;
21442*) echo "Nope, it doesn't.";;
21443esac
21444
21445: see what type is used for mode_t
21446rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21447set mode_t modetype int stdio.h sys/types.h
21448eval $typedef_ask
21449
21450: see if we need va_copy
21451echo " "
21452$cat >try.c <<EOCP
21453#include <stdarg.h>
21454#include <stdio.h>
21455#include <stdlib.h>
21456#include <signal.h>
21457
21458int
21459ivfprintf(FILE *f, const char *fmt, va_list *valp)
21460{
21461  return vfprintf(f, fmt, *valp);
21462}
21463
21464int
21465myvfprintf(FILE *f, const  char *fmt, va_list val)
21466{
21467  return ivfprintf(f, fmt, &val);
21468}
21469
21470int
21471myprintf(char *fmt, ...)
21472{
21473  va_list val;
21474  va_start(val, fmt);
21475  return myvfprintf(stdout, fmt, val);
21476}
21477
21478int
21479main(int ac, char **av)
21480{
21481  signal(SIGSEGV, exit);
21482#ifdef SIGBUS
21483  signal(SIGBUS,  exit);
21484#endif
21485
21486  myprintf("%s%cs all right, then\n", "that", '\'');
21487  exit(0);
21488}
21489EOCP
21490set try
21491if eval $compile && $run ./try 2>&1 >/dev/null; then
21492	case "`$run ./try`" in
21493	"that's all right, then")
21494		okay=yes
21495		;;
21496	esac
21497fi
21498case "$okay" in
21499yes)	echo "It seems that you don't need va_copy()." >&4
21500	need_va_copy="$undef"
21501	;;
21502*)	echo "It seems that va_copy() or similar will be needed." >&4
21503	need_va_copy="$define"
21504	;;
21505esac
21506$rm_try
21507
21508: see what type is used for size_t
21509rp="What is the type used for the length parameter for string functions?"
21510set size_t sizetype 'unsigned int' stdio.h sys/types.h
21511eval $typedef_ask
21512
21513: check for type of arguments to gethostbyaddr.
21514if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21515	case "$d_gethbyaddr" in
21516	$define)
21517		$cat <<EOM
21518
21519Checking to see what type of arguments are accepted by gethostbyaddr().
21520EOM
21521		hdrs="$define sys/types.h
21522			$d_socket sys/socket.h
21523			$i_niin netinet/in.h
21524			$i_netdb netdb.h
21525			$i_unistd unistd.h"
21526		: The first arg can 'char *' or 'void *'
21527		: The second arg is some of integral type
21528		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21529			for yyy in size_t long int; do
21530				case "$netdb_host_type" in
21531				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21532					if ./protochk "$try" $hdrs; then
21533						echo "Your system accepts $xxx for the first arg."
21534						echo "...and $yyy for the second arg."
21535						netdb_host_type="$xxx"
21536						netdb_hlen_type="$yyy"
21537					fi
21538					;;
21539				esac
21540			done
21541		done
21542		: In case none of those worked, prompt the user.
21543		case "$netdb_host_type" in
21544		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
21545			dflt='char *'
21546			. ./myread
21547			netdb_host_type=$ans
21548			rp='What is the type for the 2nd argument to gethostbyaddr?'
21549			dflt="$sizetype"
21550			. ./myread
21551			netdb_hlen_type=$ans
21552			;;
21553		esac
21554		;;
21555	*)	: no gethostbyaddr, so pick harmless defaults
21556		netdb_host_type='char *'
21557		netdb_hlen_type="$sizetype"
21558		;;
21559	esac
21560	# Remove the "const" if needed. -- but then we'll have a
21561	# prototype clash!
21562	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21563fi
21564
21565: check for type of argument to gethostbyname.
21566if test "X$netdb_name_type" = X ; then
21567	case "$d_gethbyname" in
21568	$define)
21569		$cat <<EOM
21570
21571Checking to see what type of argument is accepted by gethostbyname().
21572EOM
21573		hdrs="$define sys/types.h
21574			$d_socket sys/socket.h
21575			$i_niin netinet/in.h
21576			$i_netdb netdb.h
21577			$i_unistd unistd.h"
21578		for xxx in "const char *" "char *"; do
21579			case "$netdb_name_type" in
21580			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
21581				if ./protochk "$try" $hdrs; then
21582					echo "Your system accepts $xxx."
21583					netdb_name_type="$xxx"
21584				fi
21585				;;
21586			esac
21587		done
21588		: In case none of those worked, prompt the user.
21589		case "$netdb_name_type" in
21590		'')	rp='What is the type for the 1st argument to gethostbyname?'
21591			dflt='char *'
21592			. ./myread
21593			netdb_name_type=$ans
21594			;;
21595		esac
21596		;;
21597	*)	: no gethostbyname, so pick harmless default
21598		netdb_name_type='char *'
21599		;;
21600	esac
21601fi
21602
21603: check for type of 1st argument to getnetbyaddr.
21604if test "X$netdb_net_type" = X ; then
21605	case "$d_getnbyaddr" in
21606	$define)
21607		$cat <<EOM
21608
21609Checking to see what type of 1st argument is accepted by getnetbyaddr().
21610EOM
21611		hdrs="$define sys/types.h
21612			$d_socket sys/socket.h
21613			$i_niin netinet/in.h
21614			$i_netdb netdb.h
21615			$i_unistd unistd.h"
21616		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21617			case "$netdb_net_type" in
21618			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21619				if ./protochk "$try" $hdrs; then
21620					echo "Your system accepts $xxx."
21621					netdb_net_type="$xxx"
21622				fi
21623				;;
21624			esac
21625		done
21626		: In case none of those worked, prompt the user.
21627		case "$netdb_net_type" in
21628		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
21629			dflt='long'
21630			. ./myread
21631			netdb_net_type=$ans
21632			;;
21633		esac
21634		;;
21635	*)	: no getnetbyaddr, so pick harmless default
21636		netdb_net_type='long'
21637		;;
21638	esac
21639fi
21640: locate the preferred pager for this system
21641fn=f/
21642case "$pager" in
21643'')
21644	dflt=''
21645	case "$pg" in
21646	/*) dflt=$pg;;
21647	[a-zA-Z]:/*) dflt=$pg;;
21648	esac
21649	case "$more" in
21650	/*) dflt=$more;;
21651	[a-zA-Z]:/*) dflt=$more;;
21652	esac
21653	case "$less" in
21654	/*) dflt=$less;;
21655	[a-zA-Z]:/*) dflt=$less;;
21656	esac
21657	case "$dflt" in
21658	'') dflt=/usr/ucb/more;;
21659	esac
21660	;;
21661*)	dflt="$pager"
21662	;;
21663esac
21664fn="f/($dflt)"
21665echo " "
21666rp='What pager is used on your system?'
21667. ./getfile
21668pager="$ans"
21669
21670: see if ar generates random libraries by itself
21671echo " "
21672echo "Checking how to generate random libraries on your machine..." >&4
21673echo 'int bar1() { return bar2(); }' > bar1.c
21674echo 'int bar2() { return 2; }' > bar2.c
21675$cat > foo.c <<EOP
21676#$i_stdlib I_STDLIB
21677#ifdef I_STDLIB
21678#include <stdlib.h>
21679#endif
21680int main() { printf("%d\n", bar1()); exit(0); }
21681EOP
21682$cc $ccflags -c bar1.c >/dev/null 2>&1
21683$cc $ccflags -c bar2.c >/dev/null 2>&1
21684$cc $ccflags -c foo.c >/dev/null 2>&1
21685$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21686if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21687	$run ./foobar >/dev/null 2>&1; then
21688	echo "$ar appears to generate random libraries itself."
21689	orderlib=false
21690	if [ "X$ranlib" = "X" ]; then
21691	    ranlib=":"
21692	fi
21693elif $ar s bar$_a >/dev/null 2>&1 &&
21694	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21695	$run ./foobar >/dev/null 2>&1; then
21696		echo "a table of contents needs to be added with '$ar s'."
21697		orderlib=false
21698		ranlib="$ar s"
21699elif $ar ts bar$_a >/dev/null 2>&1 &&
21700	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21701	$run ./foobar >/dev/null 2>&1; then
21702		echo "a table of contents needs to be added with '$ar ts'."
21703		orderlib=false
21704		ranlib="$ar ts"
21705else
21706	case "$ranlib" in
21707	:) ranlib='';;
21708	'')
21709		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21710		$test -f $ranlib || ranlib=''
21711		;;
21712	esac
21713	if $test -n "$ranlib"; then
21714		echo "your system has '$ranlib'; we'll use that."
21715		orderlib=false
21716	else
21717		echo "your system doesn't seem to support random libraries"
21718		echo "so we'll use lorder and tsort to order the libraries."
21719		orderlib=true
21720		ranlib=":"
21721	fi
21722fi
21723$rm -f foo* bar*
21724
21725: Check the max offset that gmtime and localtime accept
21726echo "Checking max offsets that gmtime () accepts"
21727
21728case "$sGMTIME_min/$sGMTIME_max" in
21729    0/0|/)
21730	$cat >try.c <<EOCP
21731#include <sys/types.h>
21732#include <stdio.h>
21733#include <time.h>
21734
21735int i;
21736struct tm *tmp;
21737time_t pt;
21738
21739void gm_check (time_t t, int min_year, int max_year)
21740{
21741    tmp = gmtime (&t);
21742    if ( tmp == NULL ||
21743	/* Check tm_year overflow */
21744	 tmp->tm_year < min_year || tmp->tm_year > max_year)
21745	tmp = NULL;
21746    else
21747	pt = t;
21748    } /* gm_check */
21749
21750int check_max ()
21751{
21752    tmp = NULL;
21753    pt  = 0;
21754#ifdef MAXLONG
21755    gm_check (MAXLONG, 69, 0x7fffffff);
21756#endif
21757    if (tmp == NULL || tmp->tm_year < 0) {
21758	for (i = 63; i >= 0; i--) {
21759	    time_t x = pt | ((time_t)1 << i);
21760	    if (x < 0 || x < pt) continue;
21761	    gm_check (x, 69, 0x7fffffff);
21762	    }
21763	}
21764    printf ("sGMTIME_max=%ld\n", pt);
21765    return (0);
21766    } /* check_max */
21767
21768int check_min ()
21769{
21770    tmp = NULL;
21771    pt  = 0;
21772#ifdef MINLONG
21773    gm_check (MINLONG, -1900, 70);
21774#endif
21775    if (tmp == NULL) {
21776	for (i = 36; i >= 0; i--) {
21777	    time_t x = pt - ((time_t)1 << i);
21778	    if (x > 0) continue;
21779	    gm_check (x, -1900, 70);
21780	    }
21781	}
21782    printf ("sGMTIME_min=%ld\n", pt);
21783    return (0);
21784    } /* check_min */
21785
21786int main (int argc, char *argv[])
21787{
21788    /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21789    check_max ();
21790    check_min ();
21791    return (0);
21792    } /* main */
21793EOCP
21794	set try
21795	if eval $compile; then
21796	    eval `$run ./try 2>/dev/null`
21797	else
21798	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21799	    fi
21800	$rm_try
21801	;;
21802    esac
21803
21804echo "Checking max offsets that localtime () accepts"
21805
21806case "$sLOCALTIME_min/$sLOCALTIME_max" in
21807    0/0|/)
21808	$cat >try.c <<EOCP
21809#include <sys/types.h>
21810#include <stdio.h>
21811#include <time.h>
21812
21813int i;
21814struct tm *tmp;
21815time_t pt;
21816
21817void local_check (time_t t, int min_year, int max_year)
21818{
21819    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21820	tmp = NULL;
21821    else
21822	tmp = localtime (&t);
21823    if ( tmp == NULL ||
21824	/* Check tm_year overflow */
21825	 tmp->tm_year < min_year || tmp->tm_year > max_year)
21826	tmp = NULL;
21827    else
21828	pt = t;
21829    } /* local_check */
21830
21831int check_max ()
21832{
21833    tmp = NULL;
21834    pt  = 0;
21835#ifdef MAXLONG
21836    local_check (MAXLONG, 69, 0x7fffffff);
21837#endif
21838    if (tmp == NULL || tmp->tm_year < 0) {
21839	for (i = 63; i >= 0; i--) {
21840	    time_t x = pt | ((time_t)1 << i);
21841	    if (x < 0 || x < pt) continue;
21842	    local_check (x, 69, 0x7fffffff);
21843	    }
21844	}
21845    printf ("sLOCALTIME_max=%ld\n", pt);
21846    return (0);
21847   } /* check_max */
21848
21849int check_min ()
21850{
21851    tmp = NULL;
21852    pt  = 0;
21853#ifdef MINLONG
21854    local_check (MINLONG, -1900, 70);
21855#endif
21856    if (tmp == NULL) {
21857	for (i = 36; i >= 0; i--) {
21858	    time_t x = pt - ((time_t)1 << i);
21859	    if (x > 0) continue;
21860	    local_check (x, -1900, 70);
21861	    }
21862	}
21863    printf ("sLOCALTIME_min=%ld\n", pt);
21864    return (0);
21865    } /* check_min */
21866
21867int main (int argc, char *argv[])
21868{
21869    check_max ();
21870    check_min ();
21871    return (0);
21872    } /* main */
21873EOCP
21874	set try
21875	if eval $compile; then
21876	    eval `$run ./try 2>/dev/null`
21877	else
21878	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21879	    fi
21880	$rm_try
21881	;;
21882    esac
21883
21884: check for type of arguments to select.
21885case "$selecttype" in
21886'') case "$d_select" in
21887	$define)
21888		echo " "
21889		$cat <<EOM
21890Checking to see what type of arguments are accepted by select().
21891EOM
21892		hdrs="$define sys/types.h
21893			$i_systime sys/time.h
21894			$i_sysselct sys/select.h
21895			$d_socket sys/socket.h"
21896		: The first arg can be int, unsigned, or size_t
21897		: The last arg may or may not be 'const'
21898		val=''
21899		: void pointer has been seen but using that
21900		: breaks the selectminbits test
21901		for xxx in 'fd_set *' 'int *'; do
21902			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21903				for tmo in 'struct timeval *' 'const struct timeval *'; do
21904					case "$val" in
21905					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21906						if ./protochk "$try" $hdrs; then
21907							echo "Your system accepts $xxx."
21908							val="$xxx"
21909						fi
21910						;;
21911					esac
21912				done
21913			done
21914		done
21915		case "$val" in
21916		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21917			case "$d_fd_set" in
21918				$define) dflt="fd_set *" ;;
21919				*)		dflt="int *" ;;
21920			esac
21921			. ./myread
21922			val=$ans
21923			;;
21924		esac
21925		selecttype="$val"
21926		;;
21927	*)	: no select, so pick a harmless default
21928		selecttype='int *'
21929		;;
21930	esac
21931	;;
21932esac
21933
21934: check for the select 'width'
21935case "$selectminbits" in
21936'') safebits=`expr $ptrsize \* 8`
21937    case "$d_select" in
21938	$define)
21939		$cat <<EOM
21940
21941Checking to see on how many bits at a time your select() operates...
21942EOM
21943		$cat >try.c <<EOCP
21944#include <sys/types.h>
21945#$i_time I_TIME
21946#$i_systime I_SYS_TIME
21947#$i_systimek I_SYS_TIME_KERNEL
21948#ifdef I_TIME
21949#   include <time.h>
21950#endif
21951#ifdef I_SYS_TIME
21952#   ifdef I_SYS_TIME_KERNEL
21953#	define KERNEL
21954#   endif
21955#   include <sys/time.h>
21956#   ifdef I_SYS_TIME_KERNEL
21957#	undef KERNEL
21958#   endif
21959#endif
21960#$i_sysselct I_SYS_SELECT
21961#ifdef I_SYS_SELECT
21962#include <sys/select.h>
21963#endif
21964#$d_socket HAS_SOCKET
21965#ifdef HAS_SOCKET
21966#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21967#endif
21968#include <stdio.h>
21969#$i_stdlib I_STDLIB
21970#ifdef I_STDLIB
21971#include <stdlib.h>
21972#endif
21973$selecttype b;
21974#define S sizeof(*(b))
21975#define MINBITS	64
21976#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21977#define NBITS  (NBYTES * 8)
21978int main() {
21979    char *s = (char *)malloc(NBYTES);
21980    struct timeval t;
21981    int i;
21982    FILE* fp;
21983    int fd;
21984
21985    if (!s)
21986	exit(1);
21987    fclose(stdin);
21988    fp = fopen("try.c", "r");
21989    if (fp == 0)
21990      exit(2);
21991    fd = fileno(fp);
21992    if (fd < 0)
21993      exit(3);
21994    b = ($selecttype)s;
21995    for (i = 0; i < NBITS; i++)
21996	FD_SET(i, b);
21997    t.tv_sec  = 0;
21998    t.tv_usec = 0;
21999    select(fd + 1, b, 0, 0, &t);
22000    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22001    free(s);
22002    printf("%d\n", i + 1);
22003    return 0;
22004}
22005EOCP
22006		set try
22007		if eval $compile_ok; then
22008			selectminbits=`$run ./try 2>/dev/null`
22009			case "$selectminbits" in
22010			'')	cat >&4 <<EOM
22011Cannot figure out on how many bits at a time your select() operates.
22012I'll play safe and guess it is $safebits bits.
22013EOM
22014				selectminbits=$safebits
22015				bits="$safebits bits"
22016				;;
22017			1)	bits="1 bit" ;;
22018			*)	bits="$selectminbits bits" ;;
22019			esac
22020			echo "Your select() operates on $bits at a time." >&4
22021		else
22022			rp='What is the minimum number of bits your select() operates on?'
22023			case "$byteorder" in
22024			12345678)	dflt=64 ;;
22025			1234)		dflt=32 ;;
22026			*)		dflt=1	;;
22027			esac
22028			. ./myread
22029			val=$ans
22030			selectminbits="$val"
22031		fi
22032		$rm_try
22033		;;
22034	*)	: no select, so pick a harmless default
22035		selectminbits=$safebits
22036		;;
22037	esac
22038	;;
22039esac
22040
22041: Trace out the files included by signal.h, then look for SIGxxx names.
22042case "$sig_num_init" in
22043'')
22044if [ "X$fieldn" = X ]; then
22045	: Just make some guesses.  We check them later.
22046	xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22047else
22048	xxx=`echo '#include <signal.h>' |
22049	$cppstdin $cppminus $cppflags 2>/dev/null |
22050	$grep '^[ 	]*#.*include' |
22051	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22052		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22053fi
22054xxxfiles=''
22055for xx in $xxx /dev/null ; do
22056	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
22057done
22058case "$xxxfiles" in
22059'')	xxxfiles=`./findhdr signal.h` ;;
22060esac
22061xxx=`awk '
22062$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22063	print substr($2, 4, 20)
22064}
22065$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22066	print substr($3, 4, 20)
22067}' $xxxfiles`
22068: Append some common names just in case the awk scan failed.
22069xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22070xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22071xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22072xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22073xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22074
22075: generate a few handy files for later
22076$cat > signal.c <<EOCP
22077#include <sys/types.h>
22078#include <signal.h>
22079#$i_stdlib I_STDLIB
22080#ifdef I_STDLIB
22081#include <stdlib.h>
22082#endif
22083#include <stdio.h>
22084int main() {
22085
22086/* Strange style to avoid deeply-nested #if/#else/#endif */
22087#ifndef NSIG
22088#  ifdef _NSIG
22089#    define NSIG (_NSIG)
22090#  endif
22091#endif
22092
22093#ifndef NSIG
22094#  ifdef SIGMAX
22095#    define NSIG (SIGMAX+1)
22096#  endif
22097#endif
22098
22099#ifndef NSIG
22100#  ifdef SIG_MAX
22101#    define NSIG (SIG_MAX+1)
22102#  endif
22103#endif
22104
22105#ifndef NSIG
22106#  ifdef _SIG_MAX
22107#    define NSIG (_SIG_MAX+1)
22108#  endif
22109#endif
22110
22111#ifndef NSIG
22112#  ifdef MAXSIG
22113#    define NSIG (MAXSIG+1)
22114#  endif
22115#endif
22116
22117#ifndef NSIG
22118#  ifdef MAX_SIG
22119#    define NSIG (MAX_SIG+1)
22120#  endif
22121#endif
22122
22123#ifndef NSIG
22124#  ifdef SIGARRAYSIZE
22125#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22126#  endif
22127#endif
22128
22129#ifndef NSIG
22130#  ifdef _sys_nsig
22131#    define NSIG (_sys_nsig) /* Solaris 2.5 */
22132#  endif
22133#endif
22134
22135/* Default to some arbitrary number that's big enough to get most
22136   of the common signals.
22137*/
22138#ifndef NSIG
22139#    define NSIG 50
22140#endif
22141
22142printf("NSIG %d\n", NSIG);
22143
22144#ifndef JUST_NSIG
22145
22146EOCP
22147
22148echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22149{
22150	printf "#ifdef SIG"; printf $1; printf "\n"
22151	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22152	printf $1; printf ");\n"
22153	printf "#endif\n"
22154}
22155END {
22156	printf "#endif /* JUST_NSIG */\n";
22157	printf "exit(0);\n}\n";
22158}
22159' >>signal.c
22160$cat >signal.awk <<'EOP'
22161BEGIN { ndups = 0 }
22162$1 ~ /^NSIG$/ { nsig = $2 }
22163($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22164    if ($2 > maxsig) { maxsig = $2 }
22165    if (sig_name[$2]) {
22166	dup_name[ndups] = $1
22167	dup_num[ndups] = $2
22168	ndups++
22169    }
22170    else {
22171	sig_name[$2] = $1
22172	sig_num[$2] = $2
22173    }
22174}
22175END {
22176    if (nsig == 0) {
22177    	nsig = maxsig + 1
22178    }
22179    printf("NSIG %d\n", nsig);
22180    for (n = 1; n < nsig; n++) {
22181 	if (sig_name[n]) {
22182 	    printf("%s %d\n", sig_name[n], sig_num[n])
22183	}
22184 	else {
22185 	    printf("NUM%d %d\n", n, n)
22186 	}
22187    }
22188    for (n = 0; n < ndups; n++) {
22189 	printf("%s %d\n", dup_name[n], dup_num[n])
22190    }
22191}
22192EOP
22193$cat >signal_cmd <<EOS
22194$startsh
22195if $test -s signal.lst; then
22196    echo "Using your existing signal.lst file"
22197	exit 0
22198fi
22199xxx="$xxx"
22200EOS
22201$cat >>signal_cmd <<'EOS'
22202
22203set signal
22204if eval $compile_ok; then
22205	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22206		$uniq | $awk -f signal.awk >signal.lst
22207else
22208	echo "(I can't seem be able to compile the whole test program)" >&4
22209	echo "(I'll try it in little pieces.)" >&4
22210	set signal -DJUST_NSIG
22211	if eval $compile_ok; then
22212		$run ./signal$_exe > signal.nsg
22213		$cat signal.nsg
22214	else
22215		echo "I can't seem to figure out how many signals you have." >&4
22216		echo "Guessing 50." >&4
22217		echo 'NSIG 50' > signal.nsg
22218	fi
22219	: Now look at all the signal names, one at a time.
22220	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22221		$cat > signal.c <<EOCP
22222#include <sys/types.h>
22223#include <signal.h>
22224#include <stdio.h>
22225int main() {
22226printf("$xx %d\n", SIG${xx});
22227return 0;
22228}
22229EOCP
22230		set signal
22231		if eval $compile; then
22232			echo "SIG${xx} found."
22233			$run ./signal$_exe  >> signal.ls1
22234		else
22235			echo "SIG${xx} NOT found."
22236		fi
22237	done
22238	if $test -s signal.ls1; then
22239		$cat signal.nsg signal.ls1 |
22240			$sort -n | $uniq | $awk -f signal.awk >signal.lst
22241	fi
22242
22243fi
22244if $test -s signal.lst; then
22245	:
22246else
22247	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22248	echo 'kill -l' >signal
22249	set X `csh -f <signal`
22250	$rm -f signal
22251	shift
22252	case $# in
22253	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22254	esac
22255	echo $@ | $tr ' ' $trnl | \
22256 	    $awk '{ printf "%s %d\n", $1, ++s; }
22257 		  END { printf "NSIG %d\n", ++s }' >signal.lst
22258fi
22259$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22260EOS
22261chmod a+x signal_cmd
22262$eunicefix signal_cmd
22263;;
22264esac
22265
22266: generate list of signal names
22267case "$sig_num_init" in
22268'')
22269echo " "
22270case "$sig_name_init" in
22271'') doinit=yes ;;
22272*)  case "$sig_num_init" in
22273    ''|*,*) doinit=yes ;;
22274    esac ;;
22275esac
22276case "$doinit" in
22277yes)
22278	echo "Generating a list of signal names and numbers..." >&4
22279	. ./signal_cmd
22280	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22281	sig_name=`$awk 'BEGIN { printf "ZERO " }
22282			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
22283	sig_num=`$awk  'BEGIN { printf "0 " }
22284			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
22285	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
22286			     !/^NSIG/	{ printf "\"%s\", ", $1 }
22287			     END	{ printf "0\n" }' signal.lst`
22288	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
22289			     !/^NSIG/	{ printf "%d, ", $2}
22290			     END	{ printf "0\n"}' signal.lst`
22291	;;
22292esac
22293echo "The following $sig_count signals are available:"
22294echo " "
22295echo $sig_name | $awk \
22296'BEGIN { linelen = 0 }
22297{
22298	for (i = 1; i <= NF; i++) {
22299		name = "SIG" $i " "
22300		linelen = linelen + length(name)
22301		if (linelen > 70) {
22302			printf "\n"
22303			linelen = length(name)
22304		}
22305		printf "%s", name
22306	}
22307	printf "\n"
22308}'
22309sig_size=`echo $sig_name | awk '{print NF}'`
22310$rm -f signal signal.c signal.awk signal.lst signal_cmd
22311;;
22312esac
22313
22314: Check size of size
22315echo " "
22316case "$sizetype" in
22317*_t) zzz="$sizetype"	;;
22318*)   zzz="filesize"	;;
22319esac
22320echo "Checking the size of $zzz..." >&4
22321cat > try.c <<EOCP
22322#include <sys/types.h>
22323#include <stdio.h>
22324#$i_stdlib I_STDLIB
22325#ifdef I_STDLIB
22326#include <stdlib.h>
22327#endif
22328int main() {
22329    printf("%d\n", (int)sizeof($sizetype));
22330    exit(0);
22331}
22332EOCP
22333set try
22334if eval $compile_ok; then
22335	yyy=`$run ./try`
22336	case "$yyy" in
22337	'')	sizesize=4
22338		echo "(I can't execute the test program--guessing $sizesize.)" >&4
22339		;;
22340	*)	sizesize=$yyy
22341		echo "Your $zzz size is $sizesize bytes."
22342		;;
22343	esac
22344else
22345	sizesize=4
22346	echo "(I can't compile the test program--guessing $sizesize.)" >&4
22347fi
22348
22349: check for socklen_t
22350echo " "
22351echo "Checking to see if you have socklen_t..." >&4
22352$cat >try.c <<EOCP
22353#include <sys/types.h>
22354#$d_socket HAS_SOCKET
22355#ifdef HAS_SOCKET
22356#include <sys/socket.h>
22357#endif
22358int main() { socklen_t x = 16; }
22359EOCP
22360set try
22361if eval $compile; then
22362	val="$define"
22363	echo "You have socklen_t."
22364else
22365	val="$undef"
22366	echo "You do not have socklen_t."
22367	case "$sizetype" in
22368	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22369	esac
22370fi
22371$rm_try
22372set d_socklen_t
22373eval $setvar
22374
22375: see if this is a socks.h system
22376set socks.h i_socks
22377eval $inhdr
22378
22379: check for type of the size argument to socket calls
22380case "$d_socket" in
22381"$define")
22382	$cat <<EOM
22383
22384Checking to see what type is the last argument of accept().
22385EOM
22386	yyy=''
22387	case "$d_socklen_t" in
22388	"$define") yyy="$yyy socklen_t"
22389	esac
22390	yyy="$yyy $sizetype int long unsigned"
22391	for xxx in $yyy; do
22392		case "$socksizetype" in
22393		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22394			case "$usesocks" in
22395			"$define")
22396				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22397					echo "Your system accepts '$xxx *' for the last argument of accept()."
22398					socksizetype="$xxx"
22399				fi
22400				;;
22401			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22402					echo "Your system accepts '$xxx *' for the last argument of accept()."
22403					socksizetype="$xxx"
22404				fi
22405				;;
22406			esac
22407			;;
22408		esac
22409	done
22410: In case none of those worked, prompt the user.
22411	case "$socksizetype" in
22412	'')	rp='What is the type for socket address structure sizes?'
22413		dflt='int'
22414		. ./myread
22415		socksizetype=$ans
22416		;;
22417	esac
22418	;;
22419*)	: no sockets, so pick relatively harmless default
22420	socksizetype='int'
22421	;;
22422esac
22423
22424: see what type is used for signed size_t
22425set ssize_t ssizetype int stdio.h sys/types.h
22426eval $typedef
22427dflt="$ssizetype"
22428$cat > try.c <<EOM
22429#include <stdio.h>
22430#$i_stdlib I_STDLIB
22431#ifdef I_STDLIB
22432#include <stdlib.h>
22433#endif
22434#include <sys/types.h>
22435#define Size_t $sizetype
22436#define SSize_t $dflt
22437int main()
22438{
22439	if (sizeof(Size_t) == sizeof(SSize_t))
22440		printf("$dflt\n");
22441	else if (sizeof(Size_t) == sizeof(int))
22442		printf("int\n");
22443	else
22444		printf("long\n");
22445	exit(0);
22446}
22447EOM
22448echo " "
22449set try
22450if eval $compile_ok && $run ./try > /dev/null; then
22451	ssizetype=`$run ./try`
22452	echo "I'll be using $ssizetype for functions returning a byte count." >&4
22453else
22454	$cat >&4 <<EOM
22455Help! I can't compile and run the ssize_t test program: please enlighten me!
22456(This is probably a misconfiguration in your system or libraries, and
22457you really ought to fix it.  Still, I'll try anyway.)
22458
22459I need a type that is the same size as $sizetype, but is guaranteed to
22460be signed.  Common values are ssize_t, int and long.
22461
22462EOM
22463	rp="What signed type is the same size as $sizetype?"
22464	. ./myread
22465	ssizetype="$ans"
22466fi
22467$rm_try
22468
22469: Check the size of st_ino
22470$echo " "
22471$echo "Checking the size of st_ino..." >&4
22472$cat > try.c <<EOCP
22473#include <sys/stat.h>
22474#include <stdio.h>
22475#$i_stdlib I_STDLIB
22476#ifdef I_STDLIB
22477#include <stdlib.h>
22478#endif
22479int main() {
22480    struct stat st;
22481    printf("%d\n", (int)sizeof(st.st_ino));
22482    exit(0);
22483}
22484EOCP
22485set try
22486if eval $compile_ok; then
22487	val=`$run ./try`
22488	case "$val" in
22489	'')	st_ino_size=4
22490		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22491		;;
22492	*)	st_ino_size=$val
22493		$echo "Your st_ino is $st_ino_size bytes long."
22494		;;
22495	esac
22496else
22497	st_ino_size=4
22498	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22499fi
22500$rm_try
22501
22502: Check if st_ino is signed
22503$echo " "
22504$echo "Checking the sign of st_ino..." >&4
22505$cat > try.c <<EOCP
22506#include <sys/stat.h>
22507#include <stdio.h>
22508int main() {
22509	struct stat foo;
22510        foo.st_ino = -1;
22511	if (foo.st_ino < 0)
22512		printf("-1\n");
22513	else
22514		printf("1\n");
22515}
22516EOCP
22517set try
22518if eval $compile; then
22519	val=`$run ./try`
22520	case "$val" in
22521	'')	st_ino_sign=1
22522		$echo "(I can't execute the test program--guessing unsigned.)" >&4
22523		;;
22524	*)	st_ino_sign=$val
22525		case "$st_ino_sign" in
22526		 1) $echo "Your st_ino is unsigned." ;;
22527		-1) $echo "Your st_ino is signed."   ;;
22528		esac
22529		;;
22530	esac
22531else
22532	st_ino_sign=1
22533	$echo "(I can't compile the test program--guessing unsigned.)" >&4
22534fi
22535$rm_try
22536
22537: see what type of char stdio uses.
22538echo " "
22539echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22540if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22541	echo "Your stdio uses unsigned chars." >&4
22542	stdchar="unsigned char"
22543else
22544	echo "Your stdio uses signed chars." >&4
22545	stdchar="char"
22546fi
22547$rm -f stdioh
22548
22549: Check size of UID
22550echo " "
22551case "$uidtype" in
22552*_t) zzz="$uidtype"	;;
22553*)   zzz="uid"		;;
22554esac
22555echo "Checking the size of $zzz..." >&4
22556cat > try.c <<EOCP
22557#include <sys/types.h>
22558#include <stdio.h>
22559#$i_stdlib I_STDLIB
22560#ifdef I_STDLIB
22561#include <stdlib.h>
22562#endif
22563int main() {
22564    printf("%d\n", (int)sizeof($uidtype));
22565    exit(0);
22566}
22567EOCP
22568set try
22569if eval $compile_ok; then
22570	yyy=`$run ./try`
22571	case "$yyy" in
22572	'')	uidsize=4
22573		echo "(I can't execute the test program--guessing $uidsize.)" >&4
22574		;;
22575	*)	uidsize=$yyy
22576		echo "Your $zzz is $uidsize bytes long."
22577		;;
22578	esac
22579else
22580	uidsize=4
22581	echo "(I can't compile the test program--guessing $uidsize.)" >&4
22582fi
22583
22584: Check if UID is signed
22585echo " "
22586case "$uidtype" in
22587*_t) zzz="$uidtype"	;;
22588*)   zzz="uid"		;;
22589esac
22590echo "Checking the sign of $zzz..." >&4
22591cat > try.c <<EOCP
22592#include <sys/types.h>
22593#include <stdio.h>
22594int main() {
22595	$uidtype foo = -1;
22596	if (foo < 0)
22597		printf("-1\n");
22598	else
22599		printf("1\n");
22600}
22601EOCP
22602set try
22603if eval $compile; then
22604	yyy=`$run ./try`
22605	case "$yyy" in
22606	'')	uidsign=1
22607		echo "(I can't execute the test program--guessing unsigned.)" >&4
22608		;;
22609	*)	uidsign=$yyy
22610		case "$uidsign" in
22611		 1) echo "Your $zzz is unsigned." ;;
22612		-1) echo "Your $zzz is signed."   ;;
22613		esac
22614		;;
22615	esac
22616else
22617	uidsign=1
22618	echo "(I can't compile the test program--guessing unsigned.)" >&4
22619fi
22620
22621: Check format string for UID
22622echo " "
22623$echo "Checking the format string to be used for uids..." >&4
22624
22625case "$uidsign" in
22626-1)	if $test X"$uidsize" = X"$ivsize"; then
22627		uidformat="$ivdformat"
22628	else
22629		if $test X"$uidsize" = X"$longsize"; then
22630			uidformat='"ld"'
22631		else
22632			if $test X"$uidsize" = X"$intsize"; then
22633				uidformat='"d"'
22634			else
22635				if $test X"$uidsize" = X"$shortsize"; then
22636					uidformat='"hd"'
22637				fi
22638			fi
22639		fi
22640	fi
22641	;;
22642*)	if $test X"$uidsize" = X"$uvsize"; then
22643		uidformat="$uvuformat"
22644	else
22645		if $test X"$uidsize" = X"$longsize"; then
22646			uidformat='"lu"'
22647		else
22648			if $test X"$uidsize" = X"$intsize"; then
22649				uidformat='"u"'
22650			else
22651				if $test X"$uidsize" = X"$shortsize"; then
22652					uidformat='"hu"'
22653				fi
22654			fi
22655		fi
22656	fi
22657	;;
22658esac
22659
22660: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22661echo " "
22662echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22663$cat >try.c <<'EOM'
22664/* Intentionally a long probe as I'd like to sanity check that the exact
22665   approach is going to work, as thinking it will work, but only having it
22666   part working at runtime is worse than not having it.  */
22667
22668#include <sys/types.h>
22669#include <sys/sysctl.h>
22670#include <sys/param.h>
22671#include <stdio.h>
22672#include <string.h>
22673#include <stdlib.h>
22674#include <unistd.h>
22675
22676int
22677main(int argc, char **argv) {
22678    char *buffer;
22679    char *argv_leaf = strrchr(argv[0], '/');
22680    char *buffer_leaf;
22681    size_t size = 0;
22682    int mib[4];
22683
22684    mib[0] = CTL_KERN;
22685    mib[1] = KERN_PROC;
22686    mib[2] = KERN_PROC_PATHNAME;
22687    mib[3] = -1;
22688
22689    if (!argv_leaf) {
22690	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22691	return 1;
22692    }
22693
22694    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22695	perror("sysctl");
22696	return 2;
22697    }
22698
22699    if (size < strlen(argv_leaf) + 1) {
22700	fprintf(stderr, "size %lu is too short for a path\n",
22701		(unsigned long) size);
22702	return 3;
22703    }
22704
22705    if (size > MAXPATHLEN * MAXPATHLEN) {
22706	fprintf(stderr, "size %lu is too long for a path\n",
22707		(unsigned long) size);
22708	return 4;
22709    }
22710
22711    buffer = (char *)malloc(size);
22712    if (!buffer) {
22713	perror("malloc");
22714	return 5;
22715    }
22716
22717    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22718	perror("sysctl");
22719	return 6;
22720    }
22721
22722    if (strlen(buffer) + 1 != size) {
22723	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22724		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
22725        return 7;
22726    }
22727
22728
22729    if (*buffer != '/') {
22730	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22731	return 8;
22732    }
22733
22734    if (strstr(buffer, "/./")) {
22735	fprintf(stderr, "Contains /./: '%s'\n", buffer);
22736	return 9;
22737    }
22738
22739    if (strstr(buffer, "/../")) {
22740	fprintf(stderr, "Contains /../: '%s'\n", buffer);
22741	return 10;
22742    }
22743
22744    buffer_leaf = strrchr(buffer, '/');
22745    if (strcmp(buffer_leaf, argv_leaf) != 0) {
22746	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22747	return 11;
22748    }
22749
22750    free(buffer);
22751
22752    return 0;
22753}
22754EOM
22755
22756val=$undef
22757set try
22758if eval $compile; then
22759	if $run ./try; then
22760		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22761		val="$define"
22762	else
22763		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22764		val="$undef"
22765	fi
22766else
22767	echo "I'm unable to compile the test program." >&4
22768	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22769	val="$undef"
22770fi
22771$rm_try
22772set usekernprocpathname
22773eval $setvar
22774
22775: Determine if we can use _NSGetExecutablePath to find executing program
22776echo " "
22777echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22778$cat >try.c <<'EOM'
22779/* Intentionally a long probe as I'd like to sanity check that the exact
22780   approach is going to work, as thinking it will work, but only having it
22781   part working at runtime is worse than not having it.  */
22782#include <mach-o/dyld.h>
22783#include <stdio.h>
22784#include <stdlib.h>
22785#include <sys/param.h>
22786#include <string.h>
22787
22788int
22789main(int argc, char **argv) {
22790    char buf[1];
22791    uint32_t size = sizeof(buf);
22792    int result;
22793    char *buffer;
22794    char *tidied;
22795    char *argv_leaf = strrchr(argv[0], '/');
22796    char *tidied_leaf;
22797
22798    if (!argv_leaf) {
22799	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22800	return 1;
22801    }
22802
22803    _NSGetExecutablePath(buf, &size);
22804    if (size > MAXPATHLEN * MAXPATHLEN) {
22805	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22806		(unsigned int) size);
22807	return 2;
22808    }
22809
22810    buffer = (char *)malloc(size);
22811    if (!buffer) {
22812	perror("malloc");
22813	return 3;
22814    }
22815
22816    result = _NSGetExecutablePath(buffer, &size);
22817    if (result != 0) {
22818	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22819		result, (unsigned int) size);
22820	return 4;
22821    }
22822
22823    tidied = realpath(buffer, NULL);
22824    if (!tidied) {
22825	perror("realpath");
22826	return 5;
22827    }
22828
22829    free(buffer);
22830
22831    if (*tidied != '/') {
22832	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22833	return 6;
22834    }
22835
22836    if (strstr(tidied, "/./")) {
22837	fprintf(stderr, "Contains /./: '%s'\n", tidied);
22838	return 7;
22839    }
22840
22841    if (strstr(tidied, "/../")) {
22842	fprintf(stderr, "Contains /../: '%s'\n", tidied);
22843	return 8;
22844    }
22845
22846    tidied_leaf = strrchr(tidied, '/');
22847    if (strcmp(tidied_leaf, argv_leaf) != 0) {
22848	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22849	return 9;
22850    }
22851
22852    free(tidied);
22853
22854    return 0;
22855}
22856EOM
22857
22858val=$undef
22859set try
22860if eval $compile; then
22861	if $run ./try; then
22862		echo "You can use _NSGetExecutablePath to find the executing program." >&4
22863		val="$define"
22864	else
22865		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22866	fi
22867else
22868	echo "I'm unable to compile the test program." >&4
22869	echo "I'll assume no _NSGetExecutablePath here." >&4
22870fi
22871$rm_try
22872set usensgetexecutablepath
22873eval $setvar
22874
22875: Check if site customization support was requested
22876case "$usesitecustomize" in
22877    $define|true|[Yy]*)
22878	usesitecustomize="$define"
22879	;;
22880    *)
22881	usesitecustomize="$undef"
22882	;;
22883    esac
22884
22885: determine compiler compiler
22886case "$yacc" in
22887'')
22888	dflt=yacc;;
22889*)
22890	dflt="$yacc";;
22891esac
22892echo " "
22893comp='yacc'
22894if $test -f "$byacc$_exe"; then
22895	dflt="$byacc"
22896	comp="byacc or $comp"
22897fi
22898if $test -f "$bison$_exe"; then
22899	comp="$comp or bison -y"
22900fi
22901rp="Which compiler compiler ($comp) shall I use?"
22902. ./myread
22903yacc="$ans"
22904case "$yacc" in
22905*bis*)
22906	case "$yacc" in
22907	*-y*) ;;
22908	*)
22909		yacc="$yacc -y"
22910		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22911		;;
22912	esac
22913	;;
22914esac
22915
22916: see if this is a bfd.h system
22917set bfd.h i_bfd
22918eval $inhdr
22919
22920: see if this is an execinfo.h system
22921set execinfo.h i_execinfo
22922eval $inhdr
22923
22924: see if this is a fenv.h system
22925set fenv.h i_fenv
22926eval $inhdr
22927
22928: see if this is a fp.h system
22929set fp.h i_fp
22930eval $inhdr
22931
22932: see if this is a fp_class.h system
22933set fp_class.h i_fp_class
22934eval $inhdr
22935
22936: see if gdbm.h is available
22937set gdbm.h t_gdbm
22938eval $inhdr
22939case "$t_gdbm" in
22940$define)
22941	: see if gdbm_open exists
22942	set gdbm_open d_gdbm_open
22943	eval $inlibc
22944	case "$d_gdbm_open" in
22945	$undef)
22946		t_gdbm="$undef"
22947		echo "We won't be including <gdbm.h>"
22948		;;
22949	esac
22950	;;
22951esac
22952val="$t_gdbm"
22953set i_gdbm
22954eval $setvar
22955
22956: see if this is a ieeefp.h system
22957case "$i_ieeefp" in
22958'' ) set ieeefp.h i_ieeefp
22959     eval $inhdr
22960     ;;
22961esac
22962
22963: see if this is a libutil.h system
22964set libutil.h i_libutil
22965eval $inhdr
22966
22967: see if mach cthreads are available
22968if test "X$usethreads" = "X$define"; then
22969	set mach/cthreads.h i_machcthr
22970	eval $inhdr
22971else
22972	i_machcthr="$undef"
22973fi
22974
22975: see if this is a mntent.h system
22976set mntent.h i_mntent
22977eval $inhdr
22978
22979: see if net/errno.h is available
22980val=''
22981set net/errno.h val
22982eval $inhdr
22983
22984: Unfortunately, it causes problems on some systems.  Arrgh.
22985case "$val" in
22986$define)
22987	cat > try.c <<'EOM'
22988#include <stdio.h>
22989#include <errno.h>
22990#include <net/errno.h>
22991int func()
22992{
22993	return ENOTSOCK;
22994}
22995EOM
22996	if $cc $ccflags -c try.c >/dev/null 2>&1; then
22997		echo "We'll be including <net/errno.h>." >&4
22998	else
22999		echo "We won't be including <net/errno.h>." >&4
23000		val="$undef"
23001	fi
23002	$rm_try
23003	;;
23004esac
23005set i_neterrno
23006eval $setvar
23007
23008: see if netinet/tcp.h is available
23009set netinet/tcp.h i_netinettcp
23010eval $inhdr
23011
23012: see if this is a poll.h system
23013set poll.h i_poll
23014eval $inhdr
23015
23016: see if this is a prot.h system
23017set prot.h i_prot
23018eval $inhdr
23019
23020: Preprocessor symbols
23021echo " "
23022$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23023$cat <<'EOSH' > Cppsym.know
23024a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23025AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23026AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23027arch_pwr ardent ARM ARM32 atarist att386 att3b
23028BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23029BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23030byteorder byte_order
23031c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23032convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23033DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23034ELF encore EPI EXTENSIONS
23035FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23036GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23037GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23038H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23039hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23040hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23041i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23042iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23043INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23044ksr1
23045LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23046LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23047LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23048luna88k Lynx
23049M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23050MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23051mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23052merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23053MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23054MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23055M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23056M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23057n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23058news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23059ns32000 ns32016 ns32332 ns32k nsc32000
23060OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23061PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23062plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23063POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23064QK_USER QNX
23065R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23066S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23067SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23068sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23069stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23070SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23071SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23072SYSV4 SYSV5 sysV68 sysV88
23073Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23074TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23075tower32_800 tower32_850 tss
23076u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23077UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23078USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23079USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23080USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23081USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23082uxpm uxps
23083vax venix VMESA vms
23084x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23085XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23086z8000 zarch
23087EOSH
23088# Maybe put other stuff here too.
23089./tr '-' '_' <<EOSH >>Cppsym.know
23090$osname
23091EOSH
23092./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23093./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23094$cat Cppsym.know > Cppsym.c
23095$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23096$rm -f Cppsym.a Cppsym.b Cppsym.c
23097cat <<EOSH > Cppsym
23098$startsh
23099if $test \$# -gt 0; then
23100    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23101    if $test -s Cppsym.got; then
23102	$rm -f Cppsym.got
23103	exit 0
23104    fi
23105    $rm -f Cppsym.got
23106    exit 1
23107else
23108    $tr " " "$trnl" | ./Cppsym.try
23109    exit 0
23110fi
23111EOSH
23112chmod +x Cppsym
23113$eunicefix Cppsym
23114cat <<EOSH > Cppsym.try
23115$startsh
23116cat <<'EOCP' > try.c
23117#include <stdio.h>
23118#if cpp_stuff == 1
23119#define STRINGIFY(a)    "a"
23120#endif
23121#if cpp_stuff == 42
23122#define StGiFy(a)  #a
23123#define STRINGIFY(a)    StGiFy(a)
23124#endif
23125#if $cpp_stuff != 1 && $cpp_stuff != 42
23126#   include "Bletch: How does this C preprocessor stringify macros?"
23127#endif
23128int main() {
23129EOCP
23130$awk \\
23131EOSH
23132cat <<'EOSH' >> Cppsym.try
23133'length($1) > 0 {
23134    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23135    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23136    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23137    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23138}' >> try.c
23139echo 'return 0;}' >> try.c
23140EOSH
23141cat <<EOSH >> Cppsym.try
23142ccflags="$ccflags"
23143case "$osname-$gccversion" in
23144irix-) ccflags="\$ccflags -woff 1178" ;;
23145os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23146esac
23147$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23148EOSH
23149chmod +x Cppsym.try
23150$eunicefix Cppsym.try
23151./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23152: Add in any Linux cpp "predefined macros":
23153case "$osname::$gccversion" in
23154  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23155    tHdrH=_tmpHdr
23156    rm -f $tHdrH'.h' $tHdrH
23157    touch $tHdrH'.h'
23158    # Filter out macro arguments, such as Linux's __INT8_C(c)
23159    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23160       sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23161       if [ -s $tHdrH'_cppsym.real' ]; then
23162	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23163       fi
23164    fi
23165    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23166  ;;
23167esac
23168: now check the C compiler for additional symbols
23169postprocess_cc_v=''
23170case "$osname" in
23171aix) postprocess_cc_v="|$tr , ' '" ;;
23172esac
23173$cat >ccsym <<EOS
23174$startsh
23175$cat >tmp.c <<EOF
23176extern int foo;
23177EOF
23178for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23179do
23180	case "\$i" in
23181	-D*) echo "\$i" | $sed 's/^-D//';;
23182	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23183	esac
23184done
23185$rm_try
23186EOS
23187postprocess_cc_v=''
23188chmod +x ccsym
23189$eunicefix ccsym
23190./ccsym > ccsym1.raw
23191if $test -s ccsym1.raw; then
23192    $sort ccsym1.raw | $uniq >ccsym.raw
23193else
23194    mv ccsym1.raw ccsym.raw
23195fi
23196
23197$awk '/\=/ { print $0; next }
23198	{ print $0"=1" }' ccsym.raw >ccsym.list
23199$comm -13 Cppsym.true ccsym.list >ccsym.own
23200$comm -12 Cppsym.true ccsym.list >ccsym.com
23201$comm -23 Cppsym.true ccsym.list >ccsym.cpp
23202also=''
23203if $test -z ccsym.raw; then
23204	echo "Your C compiler doesn't seem to define any symbols!" >&4
23205	echo " "
23206	echo "However, your C preprocessor defines the following symbols:"
23207	$cat Cppsym.true
23208	ccsymbols=''
23209	cppsymbols=`$cat Cppsym.true`
23210	cppsymbols=`echo $cppsymbols`
23211	cppccsymbols="$cppsymbols"
23212else
23213	if $test -s ccsym.com; then
23214		echo "Your C compiler and pre-processor define these symbols:"
23215		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
23216		also='also '
23217		symbols='ones'
23218		cppccsymbols=`$cat ccsym.com`
23219		cppccsymbols=`echo $cppccsymbols`
23220		$test "$silent" || sleep 1
23221	fi
23222	if $test -s ccsym.cpp; then
23223		$test "$also" && echo " "
23224		echo "Your C pre-processor ${also}defines the following symbols:"
23225		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23226		also='further '
23227		cppsymbols=`$cat ccsym.cpp`
23228		cppsymbols=`echo $cppsymbols`
23229		$test "$silent" || sleep 1
23230	fi
23231	if $test -s ccsym.own; then
23232		$test "$also" && echo " "
23233		echo "Your C compiler ${also}defines the following cpp symbols:"
23234		$sed -e 's/\(..*\)=1/\1/' ccsym.own
23235		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23236		ccsymbols=`$cat ccsym.own`
23237		ccsymbols=`echo $ccsymbols`
23238		$test "$silent" || sleep 1
23239	fi
23240fi
23241
23242: add -D_FORTIFY_SOURCE if feasible and not already there
23243case "$gccversion" in
23244[456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
23245	*-O*)	case "$ccflags$cppsymbols" in
23246		*_FORTIFY_SOURCE=*) # Don't add it again.
23247			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23248			;;
23249		*)	echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23250			ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23251			;;
23252		esac
23253		;;
23254	*)	echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23255		;;
23256	esac
23257	;;
23258*)	echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23259	;;
23260esac
23261
23262: script used to emit important warnings
23263cat >warn <<EOS
23264$startsh
23265if test \$# -gt 0; then
23266	echo "\$@" >msg
23267else
23268	cat >msg
23269fi
23270echo "*** WARNING:" >&4
23271sed -e 's/^/*** /' <msg >&4
23272echo "*** " >&4
23273cat msg >>config.msg
23274echo " " >>config.msg
23275rm -f msg
23276EOS
23277chmod +x warn
23278$eunicefix warn
23279
23280: see if this is a termio system
23281val="$undef"
23282val2="$undef"
23283val3="$undef"
23284if $test `./findhdr termios.h`; then
23285    set tcsetattr i_termios
23286    eval $inlibc
23287    val3="$i_termios"
23288fi
23289echo " "
23290case "$val3" in
23291    "$define") echo "You have POSIX termios.h... good!" >&4;;
23292    *)  if ./Cppsym pyr; then
23293	    case "`$run /bin/universe`" in
23294		ucb) if $test `./findhdr sgtty.h`; then
23295			val2="$define"
23296			echo "<sgtty.h> found." >&4
23297		    else
23298			echo "System is pyramid with BSD universe."
23299			./warn "<sgtty.h> not found--you could have problems."
23300		    fi;;
23301		*)  if $test `./findhdr termio.h`; then
23302			val="$define"
23303			echo "<termio.h> found." >&4
23304		    else
23305			echo "System is pyramid with USG universe."
23306			./warn "<termio.h> not found--you could have problems."
23307		    fi;;
23308	    esac
23309	elif ./usg; then
23310	    if $test `./findhdr termio.h`; then
23311		echo "<termio.h> found." >&4
23312		val="$define"
23313	    elif $test `./findhdr sgtty.h`; then
23314		echo "<sgtty.h> found." >&4
23315		val2="$define"
23316	    else
23317		./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23318	    fi
23319	else
23320	    if $test `./findhdr sgtty.h`; then
23321		echo "<sgtty.h> found." >&4
23322		val2="$define"
23323	    elif $test `./findhdr termio.h`; then
23324		echo "<termio.h> found." >&4
23325		val="$define"
23326	    else
23327		./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23328	    fi
23329	fi;;
23330esac
23331set i_termio; eval $setvar
23332val=$val2; set i_sgtty; eval $setvar
23333val=$val3; set i_termios; eval $setvar
23334
23335: see if stdbool is available
23336: we want a real compile instead of Inhdr because some Solaris systems
23337: have stdbool.h, but it can only be used if the compiler indicates it
23338: is sufficiently c99-compliant.
23339echo " "
23340$cat >try.c <<EOCP
23341#include <stdio.h>
23342#include <stdbool.h>
23343int func(bool x)
23344{
23345    return x ? 1 : 0;
23346}
23347int main(int argc, char **argv)
23348{
23349    return func(0);
23350}
23351EOCP
23352set try
23353if eval $compile; then
23354	echo "<stdbool.h> found." >&4
23355	val="$define"
23356else
23357	echo "<stdbool.h> NOT found." >&4
23358	val="$undef"
23359fi
23360$rm_try
23361set i_stdbool
23362eval $setvar
23363
23364: see if stdint is available
23365set stdint.h i_stdint
23366eval $inhdr
23367
23368: see if sys/access.h is available
23369set sys/access.h i_sysaccess
23370eval $inhdr
23371
23372: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23373set sys/filio.h i_sysfilio
23374eval $inhdr
23375echo " "
23376if $test `./findhdr sys/ioctl.h`; then
23377	val="$define"
23378	echo '<sys/ioctl.h> found.' >&4
23379else
23380	val="$undef"
23381	if $test $i_sysfilio = "$define"; then
23382	    echo '<sys/ioctl.h> NOT found.' >&4
23383	else
23384		$test $i_sgtty = "$define" && xxx="sgtty.h"
23385		$test $i_termio = "$define" && xxx="termio.h"
23386		$test $i_termios = "$define" && xxx="termios.h"
23387echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23388	fi
23389fi
23390set i_sysioctl
23391eval $setvar
23392
23393: see if socket ioctl defs are in sys/sockio.h
23394echo " "
23395xxx=`./findhdr sys/sockio.h`
23396if $test "$xxx"; then
23397	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23398		val="$define"
23399		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23400	else
23401		val="$undef"
23402		echo "No socket ioctls found in <sys/sockio.h>." >&4
23403	fi
23404else
23405	val="$undef"
23406	$cat <<EOM
23407<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23408EOM
23409fi
23410set i_syssockio
23411eval $setvar
23412
23413: see if this is a syslog.h system
23414set syslog.h i_syslog
23415eval $inhdr
23416
23417: see if this is a sys/mode.h system
23418set sys/mode.h i_sysmode
23419eval $inhdr
23420
23421: see if there is a sys/poll.h file
23422set sys/poll.h i_syspoll
23423eval $inhdr
23424
23425: see if sys/resource.h has to be included
23426set sys/resource.h i_sysresrc
23427eval $inhdr
23428
23429: see if sys/security.h is available
23430set sys/security.h i_syssecrt
23431eval $inhdr
23432
23433: see if this is a sys/statvfs.h system
23434set sys/statvfs.h i_sysstatvfs
23435eval $inhdr
23436
23437: see if this is a sys/un.h system
23438set sys/un.h i_sysun
23439eval $inhdr
23440
23441: see if this is a sys/utsname.h system
23442set sys/utsname.h i_sysutsname
23443eval $inhdr
23444
23445: see if this is a syswait system
23446set sys/wait.h i_syswait
23447eval $inhdr
23448
23449: see if this is a ustat.h system
23450set ustat.h i_ustat
23451eval $inhdr
23452
23453: see if this is an utime system
23454set utime.h i_utime
23455eval $inhdr
23456
23457: see if this is a vfork system
23458case "$d_vfork" in
23459"$define")
23460	set vfork.h i_vfork
23461	eval $inhdr
23462	;;
23463*)
23464	i_vfork="$undef"
23465	;;
23466esac
23467
23468: see if wchar.h is present
23469set wchar.h i_wchar
23470eval $inhdr
23471
23472: Check extensions
23473echo " "
23474echo "Looking for extensions..." >&4
23475: If we are using the old config.sh, nonxs_extensions and xs_extensions may
23476: contain old or inaccurate or duplicate values.
23477nonxs_extensions=''
23478xs_extensions=''
23479: We do not use find because it might not be available.
23480: We do not just use MANIFEST because the user may have dropped
23481: some additional extensions into the source tree and expect them
23482: to be built.
23483
23484: Function to recursively find available extensions, ignoring DynaLoader
23485: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23486: In 5.10.1 and later, extensions are stored in directories
23487: like File-Glob instead of the older File/Glob/.
23488find_extensions='
23489    for xxx in *; do
23490	case "$xxx" in
23491	    DynaLoader|dynaload) ;;
23492	    *)
23493	    this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23494	    case "$this_ext" in
23495		Scalar/List/Utils) this_ext="List/Util"	;;
23496		PathTools)         this_ext="Cwd"	;;
23497	    esac;
23498	    echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23499	    if $contains " $this_ext " "$tdir/$$.tmp"; then
23500		echo >&4;
23501		echo "Duplicate directories detected for extension $xxx" >&4;
23502		echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23503		case "$knowitall" in
23504		"") dflt=y;;
23505		*) dflt=n;;
23506		esac;
23507		. ../UU/myread;
23508		case "$ans" in
23509		n*|N*) ;;
23510		*) echo >&4;
23511		    echo "Ok.  Stopping Configure." >&4;
23512		    echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23513		    exit 1;;
23514		esac;
23515		echo "Ok.  You will need to correct config.sh before running make." >&4;
23516	    fi;
23517	    $ls -1 "$xxx" > "$tdir/$$.tmp";
23518	    if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23519		xs_extensions="$xs_extensions $this_ext";
23520	    elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23521		xs_extensions="$xs_extensions $this_ext";
23522	    elif $test -d "$xxx"; then
23523		nonxs_extensions="$nonxs_extensions $this_ext";
23524	    fi;
23525	    $rm -f "$tdir/$$.tmp";
23526	    ;;
23527	esac;
23528    done'
23529tdir=`pwd`
23530cd "$rsrc/cpan"
23531set X
23532shift
23533eval $find_extensions
23534cd "$rsrc/dist"
23535set X
23536shift
23537eval $find_extensions
23538cd "$rsrc/ext"
23539set X
23540shift
23541eval $find_extensions
23542set X $xs_extensions
23543shift
23544xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23545set X $nonxs_extensions
23546shift
23547nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23548cd "$tdir"
23549known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23550
23551: Now see which are supported on this system.
23552avail_ext=''
23553for xxx in $xs_extensions ; do
23554	case "$xxx" in
23555	Amiga*)
23556		case "$osname" in
23557		amigaos) avail_ext="$avail_ext $xxx" ;;
23558		esac
23559		;;
23560	DB_File|db_file)
23561		case "$i_db" in
23562		$define) avail_ext="$avail_ext $xxx" ;;
23563		esac
23564		;;
23565	GDBM_File|gdbm_fil)
23566		case "$i_gdbm" in
23567		$define) avail_ext="$avail_ext $xxx" ;;
23568		esac
23569		;;
23570	IPC/SysV|ipc/sysv)
23571		: XXX Do we need a useipcsysv variable here
23572		case "${d_msg}${d_sem}${d_shm}" in
23573		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
23574		esac
23575		;;
23576	NDBM_File|ndbm_fil)
23577		case "$d_ndbm" in
23578		$define)
23579		    case "$osname-$use64bitint" in
23580		    hpux-define)
23581			case "$libs" in
23582			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
23583			esac
23584			;;
23585		    *) avail_ext="$avail_ext $xxx" ;;
23586		    esac
23587		    ;;
23588		esac
23589		;;
23590	ODBM_File|odbm_fil)
23591		case "${i_dbm}${i_rpcsvcdbm}" in
23592		*"${define}"*)
23593		    case "$d_cplusplus" in
23594		    define) ;; # delete as a function name will not work
23595		    *)  case "$osname-$use64bitint" in
23596			hpux-define)
23597			    case "$libs" in
23598			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23599			    esac
23600			    ;;
23601			*) avail_ext="$avail_ext $xxx" ;;
23602			esac
23603			;;
23604		    esac
23605		    ;;
23606		esac
23607		;;
23608	Opcode|opcode)
23609		case "$useopcode" in
23610		true|define|y) avail_ext="$avail_ext $xxx" ;;
23611		esac
23612		;;
23613	POSIX|posix)
23614		case "$useposix" in
23615		true|define|y) avail_ext="$avail_ext $xxx" ;;
23616		esac
23617		;;
23618	Socket|socket)
23619		case "$d_socket" in
23620		true|$define|y) avail_ext="$avail_ext $xxx" ;;
23621		esac
23622		;;
23623	I18N/Langinfo|langinfo)
23624		case "$uselanginfo" in
23625		true|define|y) avail_ext="$avail_ext $xxx" ;;
23626		esac
23627		;;
23628	Sys/Syslog|sys/syslog)
23629		case $osname in
23630			amigaos) ;; # not really very useful on AmigaOS
23631			*)
23632			: XXX syslog requires socket
23633			case "$d_socket" in
23634			true|$define|y) avail_ext="$avail_ext $xxx" ;;
23635			esac
23636			;;
23637		esac
23638		;;
23639	Thread|thread)
23640                case "$usethreads" in
23641                true|$define|y)
23642                        case "$use5005threads" in
23643                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23644                        esac
23645		esac
23646		;;
23647	threads|threads/shared)
23648		# threads and threads::shared are special cases.
23649		# To stop people from asking "Perl 5.8.0 was supposed
23650		# to have this new fancy threads implementation but my
23651		# perl doesn't have it" and from people trying to
23652		# (re)install the threads module using CPAN.pm and
23653		# CPAN.pm then offering to reinstall Perl 5.8.0,
23654		# the threads.pm and threads/shared.pm will always be
23655		# there, croaking informatively ("you need to rebuild
23656		# all of Perl with threads, sorry") when threads haven't
23657		# been compiled in.
23658		# --jhi
23659		avail_ext="$avail_ext $xxx"
23660		;;
23661	VMS*)
23662		;;
23663	Win32*)
23664		case "$osname" in
23665		cygwin) avail_ext="$avail_ext $xxx" ;;
23666		esac
23667		;;
23668	XS/APItest|xs/apitest)
23669		# This is just for testing.  Skip it unless we have dynamic loading.
23670
23671		case "$usedl" in
23672		$define) avail_ext="$avail_ext $xxx" ;;
23673		esac
23674		;;
23675	XS/Typemap|xs/typemap)
23676		# This is just for testing.  Skip it unless we have dynamic loading.
23677		case "$usedl" in
23678		$define) avail_ext="$avail_ext $xxx" ;;
23679		esac
23680		;;
23681	*)	avail_ext="$avail_ext $xxx"
23682		;;
23683	esac
23684done
23685
23686set X $avail_ext
23687shift
23688avail_ext="$*"
23689
23690case "$onlyextensions" in
23691'') ;;
23692*)  keepextensions=''
23693    echo "You have requested that only certain extensions be included..." >&4
23694    for i in $onlyextensions; do
23695        case " $avail_ext " in
23696        *" $i "*)
23697            echo "Keeping extension $i."
23698            keepextensions="$keepextensions $i"
23699            ;;
23700        *) echo "Ignoring extension $i." ;;
23701        esac
23702    done
23703    avail_ext="$keepextensions"
23704    ;;
23705esac
23706
23707case "$noextensions" in
23708'') ;;
23709*)  keepextensions=''
23710    echo "You have requested that certain extensions be ignored..." >&4
23711    for i in $avail_ext; do
23712        case " $noextensions " in
23713        *" $i "*) echo "Ignoring extension $i." ;;
23714        *) echo "Keeping extension $i.";
23715           keepextensions="$keepextensions $i"
23716           ;;
23717        esac
23718    done
23719    avail_ext="$keepextensions"
23720    ;;
23721esac
23722
23723: Now see which nonxs extensions are supported on this system.
23724: For now assume all are.
23725nonxs_ext=''
23726for xxx in $nonxs_extensions ; do
23727	case "$xxx" in
23728	VMS*)
23729		;;
23730	*)	nonxs_ext="$nonxs_ext $xxx"
23731		;;
23732	esac
23733done
23734
23735set X $nonxs_ext
23736shift
23737nonxs_ext="$*"
23738
23739case $usedl in
23740$define)
23741	$cat <<EOM
23742A number of extensions are supplied with $package.  You may choose to
23743compile these extensions for dynamic loading (the default), compile
23744them into the $package executable (static loading), or not include
23745them at all.  Answer "none" to include no extensions.
23746Note that DynaLoader is always built and need not be mentioned here.
23747
23748EOM
23749	case "$dynamic_ext" in
23750	'')
23751		: Exclude those listed in static_ext
23752		dflt=''
23753		for xxx in $avail_ext; do
23754			case " $static_ext " in
23755			*" $xxx "*) ;;
23756			*) dflt="$dflt $xxx" ;;
23757			esac
23758		done
23759		set X $dflt
23760		shift
23761		dflt="$*"
23762		;;
23763	*)	dflt="$dynamic_ext"
23764		# Perhaps we are reusing an old out-of-date config.sh.
23765		case "$hint" in
23766		previous)
23767			if test X"$dynamic_ext" != X"$avail_ext"; then
23768				$cat <<EOM
23769NOTICE:  Your previous config.sh list may be incorrect.
23770The extensions now available to you are
23771	${avail_ext}
23772but the default list from your previous config.sh is
23773	${dynamic_ext}
23774
23775EOM
23776			fi
23777			;;
23778		esac
23779		;;
23780	esac
23781	case "$dflt" in
23782	'')	dflt=none;;
23783	esac
23784	rp="What extensions do you wish to load dynamically?"
23785	. ./myread
23786	case "$ans" in
23787	none) dynamic_ext=' ' ;;
23788	*) dynamic_ext="$ans" ;;
23789	esac
23790
23791	case "$static_ext" in
23792	'')
23793		: Exclude those already listed in dynamic linking
23794		dflt=''
23795		for xxx in $avail_ext; do
23796			case " $dynamic_ext " in
23797			*" $xxx "*) ;;
23798			*) dflt="$dflt $xxx" ;;
23799			esac
23800		done
23801		set X $dflt
23802		shift
23803		dflt="$*"
23804		;;
23805	*)  dflt="$static_ext"
23806		;;
23807	esac
23808
23809	case "$dflt" in
23810	'')	dflt=none;;
23811	esac
23812	rp="What extensions do you wish to load statically?"
23813	. ./myread
23814	case "$ans" in
23815	none) static_ext=' ' ;;
23816	*) static_ext="$ans" ;;
23817	esac
23818	;;
23819*)
23820	$cat <<EOM
23821A number of extensions are supplied with $package.  Answer "none"
23822to include no extensions.
23823Note that DynaLoader is always built and need not be mentioned here.
23824
23825EOM
23826	case "$static_ext" in
23827	'') dflt="$avail_ext" ;;
23828	*)	dflt="$static_ext"
23829		# Perhaps we are reusing an old out-of-date config.sh.
23830		case "$hint" in
23831		previous)
23832			if test X"$static_ext" != X"$avail_ext"; then
23833				$cat <<EOM
23834NOTICE:  Your previous config.sh list may be incorrect.
23835The extensions now available to you are
23836	${avail_ext}
23837but the default list from your previous config.sh is
23838	${static_ext}
23839
23840EOM
23841			fi
23842			;;
23843		esac
23844		;;
23845	esac
23846	: Exclude those that are not xs extensions
23847	case "$dflt" in
23848	'')	dflt=none;;
23849	esac
23850	rp="What extensions do you wish to include?"
23851	. ./myread
23852	case "$ans" in
23853	none) static_ext=' ' ;;
23854	*) static_ext="$ans" ;;
23855	esac
23856	;;
23857esac
23858#
23859# Encode is a special case.  If we are building Encode as a static
23860# extension, we need to explicitly list its subextensions as well.
23861# For other nested extensions, this is handled automatically by
23862# the appropriate Makefile.PL.
23863case " $static_ext " in
23864	*" Encode "*) # Add the subextensions of Encode
23865	cd "$rsrc/cpan"
23866	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23867		static_ext="$static_ext Encode/$xxx"
23868		known_extensions="$known_extensions Encode/$xxx"
23869	done
23870	cd "$tdir"
23871	;;
23872esac
23873
23874set X $dynamic_ext $static_ext $nonxs_ext
23875shift
23876extensions="$*"
23877
23878# Sanity check:  We require an extension suitable for use with
23879# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23880# should show up as failures in the test suite, but it's helpful to
23881# catch them now.) The 'extensions' list is normally sorted
23882# alphabetically, so we need to accept either
23883#    DB_File ... Fcntl ... IO  ....
23884# or something like
23885#    Fcntl ... NDBM_File ... IO  ....
23886case " $extensions"  in
23887*"_File "*" Fcntl "*" IO "*) ;; # DB_File
23888*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23889*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23890*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23891   echo "WARNING: The Perl you are building will be quite crippled." >& 4
23892   ;;
23893esac
23894
23895: Remove libraries needed only for extensions
23896: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23897: The exception is SunOS 4.x, which needs them.
23898case "${osname}X${osvers}" in
23899sunos*X4*)
23900    perllibs="$libs"
23901    ;;
23902*) case "$usedl" in
23903    $define|true|[yY]*)
23904	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23905	    shift
23906	    perllibs="$*"
23907	    ;;
23908    *)	perllibs="$libs"
23909	    ;;
23910    esac
23911    ;;
23912esac
23913
23914: Remove build directory name from cppstdin so it can be used from
23915: either the present location or the final installed location.
23916echo " "
23917: Get out of the UU directory to get correct path name.
23918cd ..
23919case "$cppstdin" in
23920`pwd`/cppstdin)
23921	echo "Stripping down cppstdin path name"
23922	cppstdin=cppstdin
23923	;;
23924esac
23925cd UU
23926
23927: end of configuration questions
23928echo " "
23929echo "End of configuration questions."
23930echo " "
23931
23932: back to where it started
23933if test -d ../UU; then
23934	cd ..
23935fi
23936
23937: configuration may be unconditionally patched via a 'config.arch' file
23938if $test -f config.arch; then
23939	echo "I see a config.arch file, loading it." >&4
23940	. ./config.arch
23941fi
23942
23943: configuration may be patched via a 'config.over' file
23944if $test -f config.over; then
23945	echo " "
23946	dflt=y
23947	rp='I see a config.over file.  Do you wish to load it?'
23948	. UU/myread
23949	case "$ans" in
23950	n*) echo "OK, I'll ignore it.";;
23951	*)	. ./config.over
23952		echo "Configuration override changes have been loaded."
23953		;;
23954	esac
23955fi
23956
23957: in case they want portability, strip down executable paths
23958case "$d_portable" in
23959"$define")
23960	echo " "
23961	echo "Stripping down executable paths..." >&4
23962	for file in $loclist $trylist; do
23963		eval temp=\$$file
23964		eval $file=`basename $temp`
23965	done
23966	;;
23967esac
23968
23969: create config.sh file
23970echo " "
23971echo "Creating config.sh..." >&4
23972$spitshell <<EOT >config.sh
23973$startsh
23974#
23975# This file was produced by running the Configure script. It holds all the
23976# definitions figured out by Configure. Should you modify one of these values,
23977# do not forget to propagate your changes by running "Configure -der". You may
23978# instead choose to run each of the .SH files by yourself, or "Configure -S".
23979#
23980
23981# Package name      : $package
23982# Source directory  : $src
23983# Configuration time: $cf_time
23984# Configured by     : $cf_by
23985# Target system     : $myuname
23986
23987EOT
23988: Add in command line options if available
23989$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23990
23991$spitshell <<EOT >>config.sh
23992
23993Author='$Author'
23994Date='$Date'
23995Header='$Header'
23996Id='$Id'
23997Locker='$Locker'
23998Log='$Log'
23999RCSfile='$RCSfile'
24000Revision='$Revision'
24001Source='$Source'
24002State='$State'
24003_a='$_a'
24004_exe='$_exe'
24005_o='$_o'
24006afs='$afs'
24007afsroot='$afsroot'
24008alignbytes='$alignbytes'
24009aphostname='$aphostname'
24010api_revision='$api_revision'
24011api_subversion='$api_subversion'
24012api_version='$api_version'
24013api_versionstring='$api_versionstring'
24014ar='$ar'
24015archlib='$archlib'
24016archlibexp='$archlibexp'
24017archname64='$archname64'
24018archname='$archname'
24019archobjs='$archobjs'
24020asctime_r_proto='$asctime_r_proto'
24021awk='$awk'
24022baserev='$baserev'
24023bash='$bash'
24024bin='$bin'
24025bin_ELF='$bin_ELF'
24026binexp='$binexp'
24027bison='$bison'
24028byacc='$byacc'
24029byteorder='$byteorder'
24030c='$c'
24031castflags='$castflags'
24032cat='$cat'
24033cc='$cc'
24034cccdlflags='$cccdlflags'
24035ccdlflags='$ccdlflags'
24036ccflags='$ccflags'
24037ccflags_uselargefiles='$ccflags_uselargefiles'
24038ccname='$ccname'
24039ccsymbols='$ccsymbols'
24040ccversion='$ccversion'
24041cf_by='$cf_by'
24042cf_email='$cf_email'
24043cf_time='$cf_time'
24044charbits='$charbits'
24045charsize='$charsize'
24046chgrp='$chgrp'
24047chmod='$chmod'
24048chown='$chown'
24049clocktype='$clocktype'
24050comm='$comm'
24051compress='$compress'
24052contains='$contains'
24053cp='$cp'
24054cpio='$cpio'
24055cpp='$cpp'
24056cpp_stuff='$cpp_stuff'
24057cppccsymbols='$cppccsymbols'
24058cppflags='$cppflags'
24059cpplast='$cpplast'
24060cppminus='$cppminus'
24061cpprun='$cpprun'
24062cppstdin='$cppstdin'
24063cppsymbols='$cppsymbols'
24064crypt_r_proto='$crypt_r_proto'
24065cryptlib='$cryptlib'
24066csh='$csh'
24067ctermid_r_proto='$ctermid_r_proto'
24068ctime_r_proto='$ctime_r_proto'
24069d_Gconvert='$d_Gconvert'
24070d_PRIEUldbl='$d_PRIEUldbl'
24071d_PRIFUldbl='$d_PRIFUldbl'
24072d_PRIGUldbl='$d_PRIGUldbl'
24073d_PRIXU64='$d_PRIXU64'
24074d_PRId64='$d_PRId64'
24075d_PRIeldbl='$d_PRIeldbl'
24076d_PRIfldbl='$d_PRIfldbl'
24077d_PRIgldbl='$d_PRIgldbl'
24078d_PRIi64='$d_PRIi64'
24079d_PRIo64='$d_PRIo64'
24080d_PRIu64='$d_PRIu64'
24081d_PRIx64='$d_PRIx64'
24082d_SCNfldbl='$d_SCNfldbl'
24083d__fwalk='$d__fwalk'
24084d_accept4='$d_accept4'
24085d_access='$d_access'
24086d_accessx='$d_accessx'
24087d_acosh='$d_acosh'
24088d_aintl='$d_aintl'
24089d_alarm='$d_alarm'
24090d_archlib='$d_archlib'
24091d_asctime64='$d_asctime64'
24092d_asctime_r='$d_asctime_r'
24093d_asinh='$d_asinh'
24094d_atanh='$d_atanh'
24095d_atolf='$d_atolf'
24096d_atoll='$d_atoll'
24097d_attribute_always_inline='$d_attribute_always_inline'
24098d_attribute_deprecated='$d_attribute_deprecated'
24099d_attribute_format='$d_attribute_format'
24100d_attribute_malloc='$d_attribute_malloc'
24101d_attribute_nonnull='$d_attribute_nonnull'
24102d_attribute_noreturn='$d_attribute_noreturn'
24103d_attribute_pure='$d_attribute_pure'
24104d_attribute_unused='$d_attribute_unused'
24105d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24106d_backtrace='$d_backtrace'
24107d_bsd='$d_bsd'
24108d_bsdgetpgrp='$d_bsdgetpgrp'
24109d_bsdsetpgrp='$d_bsdsetpgrp'
24110d_builtin_add_overflow='$d_builtin_add_overflow'
24111d_builtin_choose_expr='$d_builtin_choose_expr'
24112d_builtin_expect='$d_builtin_expect'
24113d_builtin_mul_overflow='$d_builtin_mul_overflow'
24114d_builtin_sub_overflow='$d_builtin_sub_overflow'
24115d_c99_variadic_macros='$d_c99_variadic_macros'
24116d_casti32='$d_casti32'
24117d_castneg='$d_castneg'
24118d_cbrt='$d_cbrt'
24119d_chown='$d_chown'
24120d_chroot='$d_chroot'
24121d_chsize='$d_chsize'
24122d_class='$d_class'
24123d_clearenv='$d_clearenv'
24124d_closedir='$d_closedir'
24125d_cmsghdr_s='$d_cmsghdr_s'
24126d_copysign='$d_copysign'
24127d_copysignl='$d_copysignl'
24128d_cplusplus='$d_cplusplus'
24129d_crypt='$d_crypt'
24130d_crypt_r='$d_crypt_r'
24131d_csh='$d_csh'
24132d_ctermid='$d_ctermid'
24133d_ctermid_r='$d_ctermid_r'
24134d_ctime64='$d_ctime64'
24135d_ctime_r='$d_ctime_r'
24136d_cuserid='$d_cuserid'
24137d_dbminitproto='$d_dbminitproto'
24138d_difftime64='$d_difftime64'
24139d_difftime='$d_difftime'
24140d_dir_dd_fd='$d_dir_dd_fd'
24141d_dirfd='$d_dirfd'
24142d_dirnamlen='$d_dirnamlen'
24143d_dladdr='$d_dladdr'
24144d_dlerror='$d_dlerror'
24145d_dlopen='$d_dlopen'
24146d_dlsymun='$d_dlsymun'
24147d_dosuid='$d_dosuid'
24148d_double_has_inf='$d_double_has_inf'
24149d_double_has_nan='$d_double_has_nan'
24150d_double_has_negative_zero='$d_double_has_negative_zero'
24151d_double_has_subnormals='$d_double_has_subnormals'
24152d_double_style_cray='$d_double_style_cray'
24153d_double_style_ibm='$d_double_style_ibm'
24154d_double_style_ieee='$d_double_style_ieee'
24155d_double_style_vax='$d_double_style_vax'
24156d_drand48_r='$d_drand48_r'
24157d_drand48proto='$d_drand48proto'
24158d_dup2='$d_dup2'
24159d_dup3='$d_dup3'
24160d_duplocale='$d_duplocale'
24161d_eaccess='$d_eaccess'
24162d_endgrent='$d_endgrent'
24163d_endgrent_r='$d_endgrent_r'
24164d_endhent='$d_endhent'
24165d_endhostent_r='$d_endhostent_r'
24166d_endnent='$d_endnent'
24167d_endnetent_r='$d_endnetent_r'
24168d_endpent='$d_endpent'
24169d_endprotoent_r='$d_endprotoent_r'
24170d_endpwent='$d_endpwent'
24171d_endpwent_r='$d_endpwent_r'
24172d_endsent='$d_endsent'
24173d_endservent_r='$d_endservent_r'
24174d_eofnblk='$d_eofnblk'
24175d_erf='$d_erf'
24176d_erfc='$d_erfc'
24177d_eunice='$d_eunice'
24178d_exp2='$d_exp2'
24179d_expm1='$d_expm1'
24180d_faststdio='$d_faststdio'
24181d_fchdir='$d_fchdir'
24182d_fchmod='$d_fchmod'
24183d_fchmodat='$d_fchmodat'
24184d_fchown='$d_fchown'
24185d_fcntl='$d_fcntl'
24186d_fcntl_can_lock='$d_fcntl_can_lock'
24187d_fd_macros='$d_fd_macros'
24188d_fd_set='$d_fd_set'
24189d_fdclose='$d_fdclose'
24190d_fdim='$d_fdim'
24191d_fds_bits='$d_fds_bits'
24192d_fegetround='$d_fegetround'
24193d_fgetpos='$d_fgetpos'
24194d_finite='$d_finite'
24195d_finitel='$d_finitel'
24196d_flexfnam='$d_flexfnam'
24197d_flock='$d_flock'
24198d_flockproto='$d_flockproto'
24199d_fma='$d_fma'
24200d_fmax='$d_fmax'
24201d_fmin='$d_fmin'
24202d_fork='$d_fork'
24203d_fp_class='$d_fp_class'
24204d_fp_classify='$d_fp_classify'
24205d_fp_classl='$d_fp_classl'
24206d_fpathconf='$d_fpathconf'
24207d_fpclass='$d_fpclass'
24208d_fpclassify='$d_fpclassify'
24209d_fpclassl='$d_fpclassl'
24210d_fpgetround='$d_fpgetround'
24211d_fpos64_t='$d_fpos64_t'
24212d_freelocale='$d_freelocale'
24213d_frexpl='$d_frexpl'
24214d_fs_data_s='$d_fs_data_s'
24215d_fseeko='$d_fseeko'
24216d_fsetpos='$d_fsetpos'
24217d_fstatfs='$d_fstatfs'
24218d_fstatvfs='$d_fstatvfs'
24219d_fsync='$d_fsync'
24220d_ftello='$d_ftello'
24221d_ftime='$d_ftime'
24222d_futimes='$d_futimes'
24223d_gai_strerror='$d_gai_strerror'
24224d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24225d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24226d_getaddrinfo='$d_getaddrinfo'
24227d_getcwd='$d_getcwd'
24228d_getespwnam='$d_getespwnam'
24229d_getfsstat='$d_getfsstat'
24230d_getgrent='$d_getgrent'
24231d_getgrent_r='$d_getgrent_r'
24232d_getgrgid_r='$d_getgrgid_r'
24233d_getgrnam_r='$d_getgrnam_r'
24234d_getgrps='$d_getgrps'
24235d_gethbyaddr='$d_gethbyaddr'
24236d_gethbyname='$d_gethbyname'
24237d_gethent='$d_gethent'
24238d_gethname='$d_gethname'
24239d_gethostbyaddr_r='$d_gethostbyaddr_r'
24240d_gethostbyname_r='$d_gethostbyname_r'
24241d_gethostent_r='$d_gethostent_r'
24242d_gethostprotos='$d_gethostprotos'
24243d_getitimer='$d_getitimer'
24244d_getlogin='$d_getlogin'
24245d_getlogin_r='$d_getlogin_r'
24246d_getmnt='$d_getmnt'
24247d_getmntent='$d_getmntent'
24248d_getnameinfo='$d_getnameinfo'
24249d_getnbyaddr='$d_getnbyaddr'
24250d_getnbyname='$d_getnbyname'
24251d_getnent='$d_getnent'
24252d_getnetbyaddr_r='$d_getnetbyaddr_r'
24253d_getnetbyname_r='$d_getnetbyname_r'
24254d_getnetent_r='$d_getnetent_r'
24255d_getnetprotos='$d_getnetprotos'
24256d_getpagsz='$d_getpagsz'
24257d_getpbyname='$d_getpbyname'
24258d_getpbynumber='$d_getpbynumber'
24259d_getpent='$d_getpent'
24260d_getpgid='$d_getpgid'
24261d_getpgrp2='$d_getpgrp2'
24262d_getpgrp='$d_getpgrp'
24263d_getppid='$d_getppid'
24264d_getprior='$d_getprior'
24265d_getprotobyname_r='$d_getprotobyname_r'
24266d_getprotobynumber_r='$d_getprotobynumber_r'
24267d_getprotoent_r='$d_getprotoent_r'
24268d_getprotoprotos='$d_getprotoprotos'
24269d_getprpwnam='$d_getprpwnam'
24270d_getpwent='$d_getpwent'
24271d_getpwent_r='$d_getpwent_r'
24272d_getpwnam_r='$d_getpwnam_r'
24273d_getpwuid_r='$d_getpwuid_r'
24274d_getsbyname='$d_getsbyname'
24275d_getsbyport='$d_getsbyport'
24276d_getsent='$d_getsent'
24277d_getservbyname_r='$d_getservbyname_r'
24278d_getservbyport_r='$d_getservbyport_r'
24279d_getservent_r='$d_getservent_r'
24280d_getservprotos='$d_getservprotos'
24281d_getspnam='$d_getspnam'
24282d_getspnam_r='$d_getspnam_r'
24283d_gettimeod='$d_gettimeod'
24284d_gmtime64='$d_gmtime64'
24285d_gmtime_r='$d_gmtime_r'
24286d_gnulibc='$d_gnulibc'
24287d_grpasswd='$d_grpasswd'
24288d_has_C_UTF8='$d_has_C_UTF8'
24289d_hasmntopt='$d_hasmntopt'
24290d_htonl='$d_htonl'
24291d_hypot='$d_hypot'
24292d_ilogb='$d_ilogb'
24293d_ilogbl='$d_ilogbl'
24294d_inc_version_list='$d_inc_version_list'
24295d_inetaton='$d_inetaton'
24296d_inetntop='$d_inetntop'
24297d_inetpton='$d_inetpton'
24298d_int64_t='$d_int64_t'
24299d_ip_mreq='$d_ip_mreq'
24300d_ip_mreq_source='$d_ip_mreq_source'
24301d_ipv6_mreq='$d_ipv6_mreq'
24302d_ipv6_mreq_source='$d_ipv6_mreq_source'
24303d_isascii='$d_isascii'
24304d_isblank='$d_isblank'
24305d_isfinite='$d_isfinite'
24306d_isfinitel='$d_isfinitel'
24307d_isinf='$d_isinf'
24308d_isinfl='$d_isinfl'
24309d_isless='$d_isless'
24310d_isnan='$d_isnan'
24311d_isnanl='$d_isnanl'
24312d_isnormal='$d_isnormal'
24313d_j0='$d_j0'
24314d_j0l='$d_j0l'
24315d_killpg='$d_killpg'
24316d_lc_monetary_2008='$d_lc_monetary_2008'
24317d_lchown='$d_lchown'
24318d_ldbl_dig='$d_ldbl_dig'
24319d_ldexpl='$d_ldexpl'
24320d_lgamma='$d_lgamma'
24321d_lgamma_r='$d_lgamma_r'
24322d_libm_lib_version='$d_libm_lib_version'
24323d_libname_unique='$d_libname_unique'
24324d_link='$d_link'
24325d_linkat='$d_linkat'
24326d_llrint='$d_llrint'
24327d_llrintl='$d_llrintl'
24328d_llround='$d_llround'
24329d_llroundl='$d_llroundl'
24330d_localeconv_l='$d_localeconv_l'
24331d_localtime64='$d_localtime64'
24332d_localtime_r='$d_localtime_r'
24333d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24334d_locconv='$d_locconv'
24335d_lockf='$d_lockf'
24336d_log1p='$d_log1p'
24337d_log2='$d_log2'
24338d_logb='$d_logb'
24339d_long_double_style_ieee='$d_long_double_style_ieee'
24340d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24341d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24342d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24343d_long_double_style_vax='$d_long_double_style_vax'
24344d_longdbl='$d_longdbl'
24345d_longlong='$d_longlong'
24346d_lrint='$d_lrint'
24347d_lrintl='$d_lrintl'
24348d_lround='$d_lround'
24349d_lroundl='$d_lroundl'
24350d_lseekproto='$d_lseekproto'
24351d_lstat='$d_lstat'
24352d_madvise='$d_madvise'
24353d_malloc_good_size='$d_malloc_good_size'
24354d_malloc_size='$d_malloc_size'
24355d_malloc_usable_size='$d_malloc_usable_size'
24356d_mblen='$d_mblen'
24357d_mbrlen='$d_mbrlen'
24358d_mbrtowc='$d_mbrtowc'
24359d_mbstowcs='$d_mbstowcs'
24360d_mbtowc='$d_mbtowc'
24361d_memmem='$d_memmem'
24362d_memrchr='$d_memrchr'
24363d_mkdir='$d_mkdir'
24364d_mkdtemp='$d_mkdtemp'
24365d_mkfifo='$d_mkfifo'
24366d_mkostemp='$d_mkostemp'
24367d_mkstemp='$d_mkstemp'
24368d_mkstemps='$d_mkstemps'
24369d_mktime64='$d_mktime64'
24370d_mktime='$d_mktime'
24371d_mmap='$d_mmap'
24372d_modfl='$d_modfl'
24373d_modflproto='$d_modflproto'
24374d_mprotect='$d_mprotect'
24375d_msg='$d_msg'
24376d_msg_ctrunc='$d_msg_ctrunc'
24377d_msg_dontroute='$d_msg_dontroute'
24378d_msg_oob='$d_msg_oob'
24379d_msg_peek='$d_msg_peek'
24380d_msg_proxy='$d_msg_proxy'
24381d_msgctl='$d_msgctl'
24382d_msgget='$d_msgget'
24383d_msghdr_s='$d_msghdr_s'
24384d_msgrcv='$d_msgrcv'
24385d_msgsnd='$d_msgsnd'
24386d_msync='$d_msync'
24387d_munmap='$d_munmap'
24388d_mymalloc='$d_mymalloc'
24389d_nan='$d_nan'
24390d_nanosleep='$d_nanosleep'
24391d_ndbm='$d_ndbm'
24392d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24393d_nearbyint='$d_nearbyint'
24394d_newlocale='$d_newlocale'
24395d_nextafter='$d_nextafter'
24396d_nexttoward='$d_nexttoward'
24397d_nice='$d_nice'
24398d_nl_langinfo='$d_nl_langinfo'
24399d_nv_preserves_uv='$d_nv_preserves_uv'
24400d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24401d_off64_t='$d_off64_t'
24402d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24403d_oldpthreads='$d_oldpthreads'
24404d_oldsock='$d_oldsock'
24405d_open3='$d_open3'
24406d_openat='$d_openat'
24407d_pathconf='$d_pathconf'
24408d_pause='$d_pause'
24409d_perl_otherlibdirs='$d_perl_otherlibdirs'
24410d_phostname='$d_phostname'
24411d_pipe2='$d_pipe2'
24412d_pipe='$d_pipe'
24413d_poll='$d_poll'
24414d_portable='$d_portable'
24415d_prctl='$d_prctl'
24416d_prctl_set_name='$d_prctl_set_name'
24417d_printf_format_null='$d_printf_format_null'
24418d_procselfexe='$d_procselfexe'
24419d_pseudofork='$d_pseudofork'
24420d_pthread_atfork='$d_pthread_atfork'
24421d_pthread_attr_setscope='$d_pthread_attr_setscope'
24422d_pthread_yield='$d_pthread_yield'
24423d_ptrdiff_t='$d_ptrdiff_t'
24424d_pwage='$d_pwage'
24425d_pwchange='$d_pwchange'
24426d_pwclass='$d_pwclass'
24427d_pwcomment='$d_pwcomment'
24428d_pwexpire='$d_pwexpire'
24429d_pwgecos='$d_pwgecos'
24430d_pwpasswd='$d_pwpasswd'
24431d_pwquota='$d_pwquota'
24432d_qgcvt='$d_qgcvt'
24433d_quad='$d_quad'
24434d_querylocale='$d_querylocale'
24435d_random_r='$d_random_r'
24436d_re_comp='$d_re_comp'
24437d_readdir64_r='$d_readdir64_r'
24438d_readdir='$d_readdir'
24439d_readdir_r='$d_readdir_r'
24440d_readlink='$d_readlink'
24441d_readv='$d_readv'
24442d_recvmsg='$d_recvmsg'
24443d_regcmp='$d_regcmp'
24444d_regcomp='$d_regcomp'
24445d_remainder='$d_remainder'
24446d_remquo='$d_remquo'
24447d_rename='$d_rename'
24448d_renameat='$d_renameat'
24449d_rewinddir='$d_rewinddir'
24450d_rint='$d_rint'
24451d_rmdir='$d_rmdir'
24452d_round='$d_round'
24453d_sbrkproto='$d_sbrkproto'
24454d_scalbn='$d_scalbn'
24455d_scalbnl='$d_scalbnl'
24456d_sched_yield='$d_sched_yield'
24457d_scm_rights='$d_scm_rights'
24458d_seekdir='$d_seekdir'
24459d_select='$d_select'
24460d_sem='$d_sem'
24461d_semctl='$d_semctl'
24462d_semctl_semid_ds='$d_semctl_semid_ds'
24463d_semctl_semun='$d_semctl_semun'
24464d_semget='$d_semget'
24465d_semop='$d_semop'
24466d_sendmsg='$d_sendmsg'
24467d_setegid='$d_setegid'
24468d_seteuid='$d_seteuid'
24469d_setgrent='$d_setgrent'
24470d_setgrent_r='$d_setgrent_r'
24471d_setgrps='$d_setgrps'
24472d_sethent='$d_sethent'
24473d_sethostent_r='$d_sethostent_r'
24474d_setitimer='$d_setitimer'
24475d_setlinebuf='$d_setlinebuf'
24476d_setlocale='$d_setlocale'
24477d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24478d_setlocale_r='$d_setlocale_r'
24479d_setnent='$d_setnent'
24480d_setnetent_r='$d_setnetent_r'
24481d_setpent='$d_setpent'
24482d_setpgid='$d_setpgid'
24483d_setpgrp2='$d_setpgrp2'
24484d_setpgrp='$d_setpgrp'
24485d_setprior='$d_setprior'
24486d_setproctitle='$d_setproctitle'
24487d_setprotoent_r='$d_setprotoent_r'
24488d_setpwent='$d_setpwent'
24489d_setpwent_r='$d_setpwent_r'
24490d_setregid='$d_setregid'
24491d_setresgid='$d_setresgid'
24492d_setresuid='$d_setresuid'
24493d_setreuid='$d_setreuid'
24494d_setrgid='$d_setrgid'
24495d_setruid='$d_setruid'
24496d_setsent='$d_setsent'
24497d_setservent_r='$d_setservent_r'
24498d_setsid='$d_setsid'
24499d_setvbuf='$d_setvbuf'
24500d_shm='$d_shm'
24501d_shmat='$d_shmat'
24502d_shmatprototype='$d_shmatprototype'
24503d_shmctl='$d_shmctl'
24504d_shmdt='$d_shmdt'
24505d_shmget='$d_shmget'
24506d_sigaction='$d_sigaction'
24507d_siginfo_si_addr='$d_siginfo_si_addr'
24508d_siginfo_si_band='$d_siginfo_si_band'
24509d_siginfo_si_errno='$d_siginfo_si_errno'
24510d_siginfo_si_fd='$d_siginfo_si_fd'
24511d_siginfo_si_pid='$d_siginfo_si_pid'
24512d_siginfo_si_status='$d_siginfo_si_status'
24513d_siginfo_si_uid='$d_siginfo_si_uid'
24514d_siginfo_si_value='$d_siginfo_si_value'
24515d_signbit='$d_signbit'
24516d_sigprocmask='$d_sigprocmask'
24517d_sigsetjmp='$d_sigsetjmp'
24518d_sin6_scope_id='$d_sin6_scope_id'
24519d_sitearch='$d_sitearch'
24520d_snprintf='$d_snprintf'
24521d_sockaddr_in6='$d_sockaddr_in6'
24522d_sockaddr_sa_len='$d_sockaddr_sa_len'
24523d_sockaddr_storage='$d_sockaddr_storage'
24524d_sockatmark='$d_sockatmark'
24525d_sockatmarkproto='$d_sockatmarkproto'
24526d_socket='$d_socket'
24527d_socklen_t='$d_socklen_t'
24528d_sockpair='$d_sockpair'
24529d_socks5_init='$d_socks5_init'
24530d_sqrtl='$d_sqrtl'
24531d_srand48_r='$d_srand48_r'
24532d_srandom_r='$d_srandom_r'
24533d_sresgproto='$d_sresgproto'
24534d_sresuproto='$d_sresuproto'
24535d_stat='$d_stat'
24536d_statblks='$d_statblks'
24537d_statfs_f_flags='$d_statfs_f_flags'
24538d_statfs_s='$d_statfs_s'
24539d_static_inline='$d_static_inline'
24540d_statvfs='$d_statvfs'
24541d_stdio_cnt_lval='$d_stdio_cnt_lval'
24542d_stdio_ptr_lval='$d_stdio_ptr_lval'
24543d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24544d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24545d_stdio_stream_array='$d_stdio_stream_array'
24546d_stdiobase='$d_stdiobase'
24547d_stdstdio='$d_stdstdio'
24548d_strcoll='$d_strcoll'
24549d_strerror_l='$d_strerror_l'
24550d_strerror_r='$d_strerror_r'
24551d_strftime='$d_strftime'
24552d_strlcat='$d_strlcat'
24553d_strlcpy='$d_strlcpy'
24554d_strnlen='$d_strnlen'
24555d_strtod='$d_strtod'
24556d_strtod_l='$d_strtod_l'
24557d_strtol='$d_strtol'
24558d_strtold='$d_strtold'
24559d_strtold_l='$d_strtold_l'
24560d_strtoll='$d_strtoll'
24561d_strtoq='$d_strtoq'
24562d_strtoul='$d_strtoul'
24563d_strtoull='$d_strtoull'
24564d_strtouq='$d_strtouq'
24565d_strxfrm='$d_strxfrm'
24566d_suidsafe='$d_suidsafe'
24567d_symlink='$d_symlink'
24568d_syscall='$d_syscall'
24569d_syscallproto='$d_syscallproto'
24570d_sysconf='$d_sysconf'
24571d_sysernlst='$d_sysernlst'
24572d_syserrlst='$d_syserrlst'
24573d_system='$d_system'
24574d_tcgetpgrp='$d_tcgetpgrp'
24575d_tcsetpgrp='$d_tcsetpgrp'
24576d_telldir='$d_telldir'
24577d_telldirproto='$d_telldirproto'
24578d_tgamma='$d_tgamma'
24579d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24580d_time='$d_time'
24581d_timegm='$d_timegm'
24582d_times='$d_times'
24583d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24584d_tm_tm_zone='$d_tm_tm_zone'
24585d_tmpnam_r='$d_tmpnam_r'
24586d_towlower='$d_towlower'
24587d_towupper='$d_towupper'
24588d_trunc='$d_trunc'
24589d_truncate='$d_truncate'
24590d_truncl='$d_truncl'
24591d_ttyname_r='$d_ttyname_r'
24592d_tzname='$d_tzname'
24593d_u32align='$d_u32align'
24594d_ualarm='$d_ualarm'
24595d_umask='$d_umask'
24596d_uname='$d_uname'
24597d_union_semun='$d_union_semun'
24598d_unlinkat='$d_unlinkat'
24599d_unordered='$d_unordered'
24600d_unsetenv='$d_unsetenv'
24601d_uselocale='$d_uselocale'
24602d_usleep='$d_usleep'
24603d_usleepproto='$d_usleepproto'
24604d_ustat='$d_ustat'
24605d_vendorarch='$d_vendorarch'
24606d_vendorbin='$d_vendorbin'
24607d_vendorlib='$d_vendorlib'
24608d_vendorscript='$d_vendorscript'
24609d_vfork='$d_vfork'
24610d_void_closedir='$d_void_closedir'
24611d_voidsig='$d_voidsig'
24612d_voidtty='$d_voidtty'
24613d_vsnprintf='$d_vsnprintf'
24614d_wait4='$d_wait4'
24615d_waitpid='$d_waitpid'
24616d_wcrtomb='$d_wcrtomb'
24617d_wcscmp='$d_wcscmp'
24618d_wcstombs='$d_wcstombs'
24619d_wcsxfrm='$d_wcsxfrm'
24620d_wctomb='$d_wctomb'
24621d_writev='$d_writev'
24622d_xenix='$d_xenix'
24623date='$date'
24624db_hashtype='$db_hashtype'
24625db_prefixtype='$db_prefixtype'
24626db_version_major='$db_version_major'
24627db_version_minor='$db_version_minor'
24628db_version_patch='$db_version_patch'
24629default_inc_excludes_dot='$default_inc_excludes_dot'
24630direntrytype='$direntrytype'
24631dlext='$dlext'
24632dlsrc='$dlsrc'
24633doubleinfbytes='$doubleinfbytes'
24634doublekind='$doublekind'
24635doublemantbits='$doublemantbits'
24636doublenanbytes='$doublenanbytes'
24637doublesize='$doublesize'
24638drand01='$drand01'
24639drand48_r_proto='$drand48_r_proto'
24640dtrace='$dtrace'
24641dtraceobject='$dtraceobject'
24642dtracexnolibs='$dtracexnolibs'
24643dynamic_ext='$dynamic_ext'
24644eagain='$eagain'
24645ebcdic='$ebcdic'
24646echo='$echo'
24647egrep='$egrep'
24648emacs='$emacs'
24649endgrent_r_proto='$endgrent_r_proto'
24650endhostent_r_proto='$endhostent_r_proto'
24651endnetent_r_proto='$endnetent_r_proto'
24652endprotoent_r_proto='$endprotoent_r_proto'
24653endpwent_r_proto='$endpwent_r_proto'
24654endservent_r_proto='$endservent_r_proto'
24655eunicefix='$eunicefix'
24656exe_ext='$exe_ext'
24657expr='$expr'
24658extensions='$extensions'
24659extern_C='$extern_C'
24660extras='$extras'
24661fflushNULL='$fflushNULL'
24662fflushall='$fflushall'
24663find='$find'
24664firstmakefile='$firstmakefile'
24665flex='$flex'
24666fpossize='$fpossize'
24667fpostype='$fpostype'
24668freetype='$freetype'
24669from='$from'
24670full_ar='$full_ar'
24671full_csh='$full_csh'
24672full_sed='$full_sed'
24673gccansipedantic='$gccansipedantic'
24674gccosandvers='$gccosandvers'
24675gccversion='$gccversion'
24676getgrent_r_proto='$getgrent_r_proto'
24677getgrgid_r_proto='$getgrgid_r_proto'
24678getgrnam_r_proto='$getgrnam_r_proto'
24679gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24680gethostbyname_r_proto='$gethostbyname_r_proto'
24681gethostent_r_proto='$gethostent_r_proto'
24682getlogin_r_proto='$getlogin_r_proto'
24683getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24684getnetbyname_r_proto='$getnetbyname_r_proto'
24685getnetent_r_proto='$getnetent_r_proto'
24686getprotobyname_r_proto='$getprotobyname_r_proto'
24687getprotobynumber_r_proto='$getprotobynumber_r_proto'
24688getprotoent_r_proto='$getprotoent_r_proto'
24689getpwent_r_proto='$getpwent_r_proto'
24690getpwnam_r_proto='$getpwnam_r_proto'
24691getpwuid_r_proto='$getpwuid_r_proto'
24692getservbyname_r_proto='$getservbyname_r_proto'
24693getservbyport_r_proto='$getservbyport_r_proto'
24694getservent_r_proto='$getservent_r_proto'
24695getspnam_r_proto='$getspnam_r_proto'
24696gidformat='$gidformat'
24697gidsign='$gidsign'
24698gidsize='$gidsize'
24699gidtype='$gidtype'
24700glibpth='$glibpth'
24701gmake='$gmake'
24702gmtime_r_proto='$gmtime_r_proto'
24703gnulibc_version='$gnulibc_version'
24704grep='$grep'
24705groupcat='$groupcat'
24706groupstype='$groupstype'
24707gzip='$gzip'
24708h_fcntl='$h_fcntl'
24709h_sysfile='$h_sysfile'
24710hint='$hint'
24711hostcat='$hostcat'
24712hostgenerate='$hostgenerate'
24713hostosname='$hostosname'
24714hostperl='$hostperl'
24715html1dir='$html1dir'
24716html1direxp='$html1direxp'
24717html3dir='$html3dir'
24718html3direxp='$html3direxp'
24719i16size='$i16size'
24720i16type='$i16type'
24721i32size='$i32size'
24722i32type='$i32type'
24723i64size='$i64size'
24724i64type='$i64type'
24725i8size='$i8size'
24726i8type='$i8type'
24727i_arpainet='$i_arpainet'
24728i_bfd='$i_bfd'
24729i_bsdioctl='$i_bsdioctl'
24730i_crypt='$i_crypt'
24731i_db='$i_db'
24732i_dbm='$i_dbm'
24733i_dirent='$i_dirent'
24734i_dlfcn='$i_dlfcn'
24735i_execinfo='$i_execinfo'
24736i_fcntl='$i_fcntl'
24737i_fenv='$i_fenv'
24738i_fp='$i_fp'
24739i_fp_class='$i_fp_class'
24740i_gdbm='$i_gdbm'
24741i_gdbm_ndbm='$i_gdbm_ndbm'
24742i_gdbmndbm='$i_gdbmndbm'
24743i_grp='$i_grp'
24744i_ieeefp='$i_ieeefp'
24745i_inttypes='$i_inttypes'
24746i_langinfo='$i_langinfo'
24747i_libutil='$i_libutil'
24748i_locale='$i_locale'
24749i_machcthr='$i_machcthr'
24750i_malloc='$i_malloc'
24751i_mallocmalloc='$i_mallocmalloc'
24752i_mntent='$i_mntent'
24753i_ndbm='$i_ndbm'
24754i_netdb='$i_netdb'
24755i_neterrno='$i_neterrno'
24756i_netinettcp='$i_netinettcp'
24757i_niin='$i_niin'
24758i_poll='$i_poll'
24759i_prot='$i_prot'
24760i_pthread='$i_pthread'
24761i_pwd='$i_pwd'
24762i_quadmath='$i_quadmath'
24763i_rpcsvcdbm='$i_rpcsvcdbm'
24764i_sgtty='$i_sgtty'
24765i_shadow='$i_shadow'
24766i_socks='$i_socks'
24767i_stdbool='$i_stdbool'
24768i_stdint='$i_stdint'
24769i_stdlib='$i_stdlib'
24770i_sunmath='$i_sunmath'
24771i_sysaccess='$i_sysaccess'
24772i_sysdir='$i_sysdir'
24773i_sysfile='$i_sysfile'
24774i_sysfilio='$i_sysfilio'
24775i_sysin='$i_sysin'
24776i_sysioctl='$i_sysioctl'
24777i_syslog='$i_syslog'
24778i_sysmman='$i_sysmman'
24779i_sysmode='$i_sysmode'
24780i_sysmount='$i_sysmount'
24781i_sysndir='$i_sysndir'
24782i_sysparam='$i_sysparam'
24783i_syspoll='$i_syspoll'
24784i_sysresrc='$i_sysresrc'
24785i_syssecrt='$i_syssecrt'
24786i_sysselct='$i_sysselct'
24787i_syssockio='$i_syssockio'
24788i_sysstat='$i_sysstat'
24789i_sysstatfs='$i_sysstatfs'
24790i_sysstatvfs='$i_sysstatvfs'
24791i_systime='$i_systime'
24792i_systimek='$i_systimek'
24793i_systimes='$i_systimes'
24794i_systypes='$i_systypes'
24795i_sysuio='$i_sysuio'
24796i_sysun='$i_sysun'
24797i_sysutsname='$i_sysutsname'
24798i_sysvfs='$i_sysvfs'
24799i_syswait='$i_syswait'
24800i_termio='$i_termio'
24801i_termios='$i_termios'
24802i_time='$i_time'
24803i_unistd='$i_unistd'
24804i_ustat='$i_ustat'
24805i_utime='$i_utime'
24806i_vfork='$i_vfork'
24807i_wchar='$i_wchar'
24808i_wctype='$i_wctype'
24809i_xlocale='$i_xlocale'
24810ignore_versioned_solibs='$ignore_versioned_solibs'
24811inc_version_list='$inc_version_list'
24812inc_version_list_init='$inc_version_list_init'
24813incpath='$incpath'
24814incpth='$incpth'
24815inews='$inews'
24816initialinstalllocation='$initialinstalllocation'
24817installarchlib='$installarchlib'
24818installbin='$installbin'
24819installhtml1dir='$installhtml1dir'
24820installhtml3dir='$installhtml3dir'
24821installman1dir='$installman1dir'
24822installman3dir='$installman3dir'
24823installprefix='$installprefix'
24824installprefixexp='$installprefixexp'
24825installprivlib='$installprivlib'
24826installscript='$installscript'
24827installsitearch='$installsitearch'
24828installsitebin='$installsitebin'
24829installsitehtml1dir='$installsitehtml1dir'
24830installsitehtml3dir='$installsitehtml3dir'
24831installsitelib='$installsitelib'
24832installsiteman1dir='$installsiteman1dir'
24833installsiteman3dir='$installsiteman3dir'
24834installsitescript='$installsitescript'
24835installstyle='$installstyle'
24836installusrbinperl='$installusrbinperl'
24837installvendorarch='$installvendorarch'
24838installvendorbin='$installvendorbin'
24839installvendorhtml1dir='$installvendorhtml1dir'
24840installvendorhtml3dir='$installvendorhtml3dir'
24841installvendorlib='$installvendorlib'
24842installvendorman1dir='$installvendorman1dir'
24843installvendorman3dir='$installvendorman3dir'
24844installvendorscript='$installvendorscript'
24845intsize='$intsize'
24846issymlink='$issymlink'
24847ivdformat='$ivdformat'
24848ivsize='$ivsize'
24849ivtype='$ivtype'
24850known_extensions='$known_extensions'
24851ksh='$ksh'
24852ld='$ld'
24853ld_can_script='$ld_can_script'
24854lddlflags='$lddlflags'
24855ldflags='$ldflags'
24856ldflags_uselargefiles='$ldflags_uselargefiles'
24857ldlibpthname='$ldlibpthname'
24858less='$less'
24859lib_ext='$lib_ext'
24860libc='$libc'
24861libperl='$libperl'
24862libpth='$libpth'
24863libs='$libs'
24864libsdirs='$libsdirs'
24865libsfiles='$libsfiles'
24866libsfound='$libsfound'
24867libspath='$libspath'
24868libswanted='$libswanted'
24869libswanted_uselargefiles='$libswanted_uselargefiles'
24870line='$line'
24871lint='$lint'
24872lkflags='$lkflags'
24873ln='$ln'
24874lns='$lns'
24875localtime_r_proto='$localtime_r_proto'
24876locincpth='$locincpth'
24877loclibpth='$loclibpth'
24878longdblinfbytes='$longdblinfbytes'
24879longdblkind='$longdblkind'
24880longdblmantbits='$longdblmantbits'
24881longdblnanbytes='$longdblnanbytes'
24882longdblsize='$longdblsize'
24883longlongsize='$longlongsize'
24884longsize='$longsize'
24885lp='$lp'
24886lpr='$lpr'
24887ls='$ls'
24888lseeksize='$lseeksize'
24889lseektype='$lseektype'
24890mail='$mail'
24891mailx='$mailx'
24892make='$make'
24893make_set_make='$make_set_make'
24894mallocobj='$mallocobj'
24895mallocsrc='$mallocsrc'
24896malloctype='$malloctype'
24897man1dir='$man1dir'
24898man1direxp='$man1direxp'
24899man1ext='$man1ext'
24900man3dir='$man3dir'
24901man3direxp='$man3direxp'
24902man3ext='$man3ext'
24903mips_type='$mips_type'
24904mistrustnm='$mistrustnm'
24905mkdir='$mkdir'
24906mmaptype='$mmaptype'
24907modetype='$modetype'
24908more='$more'
24909multiarch='$multiarch'
24910mv='$mv'
24911myarchname='$myarchname'
24912mydomain='$mydomain'
24913myhostname='$myhostname'
24914myuname='$myuname'
24915n='$n'
24916need_va_copy='$need_va_copy'
24917netdb_hlen_type='$netdb_hlen_type'
24918netdb_host_type='$netdb_host_type'
24919netdb_name_type='$netdb_name_type'
24920netdb_net_type='$netdb_net_type'
24921nm='$nm'
24922nm_opt='$nm_opt'
24923nm_so_opt='$nm_so_opt'
24924nonxs_ext='$nonxs_ext'
24925nroff='$nroff'
24926nvEUformat='$nvEUformat'
24927nvFUformat='$nvFUformat'
24928nvGUformat='$nvGUformat'
24929nv_overflows_integers_at='$nv_overflows_integers_at'
24930nv_preserves_uv_bits='$nv_preserves_uv_bits'
24931nveformat='$nveformat'
24932nvfformat='$nvfformat'
24933nvgformat='$nvgformat'
24934nvmantbits='$nvmantbits'
24935nvsize='$nvsize'
24936nvtype='$nvtype'
24937o_nonblock='$o_nonblock'
24938obj_ext='$obj_ext'
24939old_pthread_create_joinable='$old_pthread_create_joinable'
24940optimize='$optimize'
24941orderlib='$orderlib'
24942osname='$osname'
24943osvers='$osvers'
24944otherlibdirs='$otherlibdirs'
24945package='$package'
24946pager='$pager'
24947passcat='$passcat'
24948patchlevel='$patchlevel'
24949path_sep='$path_sep'
24950perl5='$perl5'
24951perl='$perl'
24952perl_patchlevel='$perl_patchlevel'
24953perl_static_inline='$perl_static_inline'
24954perladmin='$perladmin'
24955perllibs='$perllibs'
24956perlpath='$perlpath'
24957pg='$pg'
24958phostname='$phostname'
24959pidtype='$pidtype'
24960plibpth='$plibpth'
24961pmake='$pmake'
24962pr='$pr'
24963prefix='$prefix'
24964prefixexp='$prefixexp'
24965privlib='$privlib'
24966privlibexp='$privlibexp'
24967procselfexe='$procselfexe'
24968ptrsize='$ptrsize'
24969quadkind='$quadkind'
24970quadtype='$quadtype'
24971randbits='$randbits'
24972randfunc='$randfunc'
24973random_r_proto='$random_r_proto'
24974randseedtype='$randseedtype'
24975ranlib='$ranlib'
24976rd_nodata='$rd_nodata'
24977readdir64_r_proto='$readdir64_r_proto'
24978readdir_r_proto='$readdir_r_proto'
24979revision='$revision'
24980rm='$rm'
24981rm_try='$rm_try'
24982rmail='$rmail'
24983run='$run'
24984runnm='$runnm'
24985sGMTIME_max='$sGMTIME_max'
24986sGMTIME_min='$sGMTIME_min'
24987sLOCALTIME_max='$sLOCALTIME_max'
24988sLOCALTIME_min='$sLOCALTIME_min'
24989sPRIEUldbl='$sPRIEUldbl'
24990sPRIFUldbl='$sPRIFUldbl'
24991sPRIGUldbl='$sPRIGUldbl'
24992sPRIXU64='$sPRIXU64'
24993sPRId64='$sPRId64'
24994sPRIeldbl='$sPRIeldbl'
24995sPRIfldbl='$sPRIfldbl'
24996sPRIgldbl='$sPRIgldbl'
24997sPRIi64='$sPRIi64'
24998sPRIo64='$sPRIo64'
24999sPRIu64='$sPRIu64'
25000sPRIx64='$sPRIx64'
25001sSCNfldbl='$sSCNfldbl'
25002sched_yield='$sched_yield'
25003scriptdir='$scriptdir'
25004scriptdirexp='$scriptdirexp'
25005sed='$sed'
25006seedfunc='$seedfunc'
25007selectminbits='$selectminbits'
25008selecttype='$selecttype'
25009sendmail='$sendmail'
25010setgrent_r_proto='$setgrent_r_proto'
25011sethostent_r_proto='$sethostent_r_proto'
25012setlocale_r_proto='$setlocale_r_proto'
25013setnetent_r_proto='$setnetent_r_proto'
25014setprotoent_r_proto='$setprotoent_r_proto'
25015setpwent_r_proto='$setpwent_r_proto'
25016setservent_r_proto='$setservent_r_proto'
25017sh='$sh'
25018shar='$shar'
25019sharpbang='$sharpbang'
25020shmattype='$shmattype'
25021shortsize='$shortsize'
25022shrpenv='$shrpenv'
25023shsharp='$shsharp'
25024sig_count='$sig_count'
25025sig_name='$sig_name'
25026sig_name_init='$sig_name_init'
25027sig_num='$sig_num'
25028sig_num_init='$sig_num_init'
25029sig_size='$sig_size'
25030signal_t='$signal_t'
25031sitearch='$sitearch'
25032sitearchexp='$sitearchexp'
25033sitebin='$sitebin'
25034sitebinexp='$sitebinexp'
25035sitehtml1dir='$sitehtml1dir'
25036sitehtml1direxp='$sitehtml1direxp'
25037sitehtml3dir='$sitehtml3dir'
25038sitehtml3direxp='$sitehtml3direxp'
25039sitelib='$sitelib'
25040sitelib_stem='$sitelib_stem'
25041sitelibexp='$sitelibexp'
25042siteman1dir='$siteman1dir'
25043siteman1direxp='$siteman1direxp'
25044siteman3dir='$siteman3dir'
25045siteman3direxp='$siteman3direxp'
25046siteprefix='$siteprefix'
25047siteprefixexp='$siteprefixexp'
25048sitescript='$sitescript'
25049sitescriptexp='$sitescriptexp'
25050sizesize='$sizesize'
25051sizetype='$sizetype'
25052sleep='$sleep'
25053smail='$smail'
25054so='$so'
25055sockethdr='$sockethdr'
25056socketlib='$socketlib'
25057socksizetype='$socksizetype'
25058sort='$sort'
25059spackage='$spackage'
25060spitshell='$spitshell'
25061srand48_r_proto='$srand48_r_proto'
25062srandom_r_proto='$srandom_r_proto'
25063src='$src'
25064ssizetype='$ssizetype'
25065st_ino_sign='$st_ino_sign'
25066st_ino_size='$st_ino_size'
25067startperl='$startperl'
25068startsh='$startsh'
25069static_ext='$static_ext'
25070stdchar='$stdchar'
25071stdio_base='$stdio_base'
25072stdio_bufsiz='$stdio_bufsiz'
25073stdio_cnt='$stdio_cnt'
25074stdio_filbuf='$stdio_filbuf'
25075stdio_ptr='$stdio_ptr'
25076stdio_stream_array='$stdio_stream_array'
25077strerror_r_proto='$strerror_r_proto'
25078submit='$submit'
25079subversion='$subversion'
25080sysman='$sysman'
25081sysroot='$sysroot'
25082tail='$tail'
25083tar='$tar'
25084targetarch='$targetarch'
25085targetdir='$targetdir'
25086targetenv='$targetenv'
25087targethost='$targethost'
25088targetmkdir='$targetmkdir'
25089targetport='$targetport'
25090targetsh='$targetsh'
25091tbl='$tbl'
25092tee='$tee'
25093test='$test'
25094timeincl='$timeincl'
25095timetype='$timetype'
25096tmpnam_r_proto='$tmpnam_r_proto'
25097to='$to'
25098touch='$touch'
25099tr='$tr'
25100trnl='$trnl'
25101troff='$troff'
25102ttyname_r_proto='$ttyname_r_proto'
25103u16size='$u16size'
25104u16type='$u16type'
25105u32size='$u32size'
25106u32type='$u32type'
25107u64size='$u64size'
25108u64type='$u64type'
25109u8size='$u8size'
25110u8type='$u8type'
25111uidformat='$uidformat'
25112uidsign='$uidsign'
25113uidsize='$uidsize'
25114uidtype='$uidtype'
25115uname='$uname'
25116uniq='$uniq'
25117uquadtype='$uquadtype'
25118use5005threads='$use5005threads'
25119use64bitall='$use64bitall'
25120use64bitint='$use64bitint'
25121usecbacktrace='$usecbacktrace'
25122usecrosscompile='$usecrosscompile'
25123usedevel='$usedevel'
25124usedl='$usedl'
25125usedtrace='$usedtrace'
25126usefaststdio='$usefaststdio'
25127useithreads='$useithreads'
25128usekernprocpathname='$usekernprocpathname'
25129uselanginfo='$uselanginfo'
25130uselargefiles='$uselargefiles'
25131uselongdouble='$uselongdouble'
25132usemallocwrap='$usemallocwrap'
25133usemorebits='$usemorebits'
25134usemultiplicity='$usemultiplicity'
25135usemymalloc='$usemymalloc'
25136usenm='$usenm'
25137usensgetexecutablepath='$usensgetexecutablepath'
25138useopcode='$useopcode'
25139useperlio='$useperlio'
25140useposix='$useposix'
25141usequadmath='$usequadmath'
25142usereentrant='$usereentrant'
25143userelocatableinc='$userelocatableinc'
25144useshrplib='$useshrplib'
25145usesitecustomize='$usesitecustomize'
25146usesocks='$usesocks'
25147usethreads='$usethreads'
25148usevendorprefix='$usevendorprefix'
25149useversionedarchname='$useversionedarchname'
25150usevfork='$usevfork'
25151usrinc='$usrinc'
25152uuname='$uuname'
25153uvXUformat='$uvXUformat'
25154uvoformat='$uvoformat'
25155uvsize='$uvsize'
25156uvtype='$uvtype'
25157uvuformat='$uvuformat'
25158uvxformat='$uvxformat'
25159vendorarch='$vendorarch'
25160vendorarchexp='$vendorarchexp'
25161vendorbin='$vendorbin'
25162vendorbinexp='$vendorbinexp'
25163vendorhtml1dir='$vendorhtml1dir'
25164vendorhtml1direxp='$vendorhtml1direxp'
25165vendorhtml3dir='$vendorhtml3dir'
25166vendorhtml3direxp='$vendorhtml3direxp'
25167vendorlib='$vendorlib'
25168vendorlib_stem='$vendorlib_stem'
25169vendorlibexp='$vendorlibexp'
25170vendorman1dir='$vendorman1dir'
25171vendorman1direxp='$vendorman1direxp'
25172vendorman3dir='$vendorman3dir'
25173vendorman3direxp='$vendorman3direxp'
25174vendorprefix='$vendorprefix'
25175vendorprefixexp='$vendorprefixexp'
25176vendorscript='$vendorscript'
25177vendorscriptexp='$vendorscriptexp'
25178version='$version'
25179version_patchlevel_string='$version_patchlevel_string'
25180versiononly='$versiononly'
25181vi='$vi'
25182xlibpth='$xlibpth'
25183yacc='$yacc'
25184yaccflags='$yaccflags'
25185zcat='$zcat'
25186zip='$zip'
25187EOT
25188
25189: add special variables
25190$test -f $src/patchlevel.h && \
25191awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25192echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25193echo "PERL_CONFIG_SH=true" >>config.sh
25194
25195: propagate old symbols
25196if $test -f UU/config.sh; then
25197	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
25198	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25199		config.sh config.sh UU/oldconfig.sh |\
25200		$sort | $uniq -u >UU/oldsyms
25201	set X `$cat UU/oldsyms`
25202	shift
25203	case $# in
25204	0) ;;
25205	*)
25206		$cat <<EOM
25207Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25208EOM
25209		echo ": Variables propagated from previous config.sh file." >>config.sh
25210		for sym in `$cat UU/oldsyms`; do
25211			echo "    Propagating $hint variable "'$'"$sym..."
25212			eval 'tmp="$'"${sym}"'"'
25213			echo "$tmp" | \
25214				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25215		done
25216		;;
25217	esac
25218fi
25219
25220: preserve RCS keywords in files with variable substitution, grrr
25221Id='$Id'
25222
25223: Finish up by extracting the .SH files
25224case "$alldone" in
25225exit)
25226	echo "Stopping at your request, leaving temporary files around."
25227	exit 0
25228	;;
25229cont)
25230	;;
25231'')
25232	dflt=''
25233	nostick=true
25234	$cat <<EOM
25235
25236If you'd like to make any changes to the config.sh file before I begin
25237to configure things, do it as a shell escape now (e.g. !vi config.sh).
25238
25239EOM
25240	rp="Press return or use a shell escape to edit config.sh:"
25241	. UU/myread
25242	nostick=''
25243	case "$ans" in
25244	'') ;;
25245	*) : in case they cannot read
25246		sh 1>&4 -c "$ans";;
25247	esac
25248	;;
25249esac
25250
25251: if this fails, just run all the .SH files by hand
25252. ./config.sh
25253
25254echo " "
25255exec 1>&4
25256pwd=`pwd`
25257. ./UU/extract
25258cd "$pwd"
25259
25260if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25261	dflt=y
25262	case "$silent" in
25263	true) ;;
25264	*)
25265		$cat <<EOM
25266
25267Now you need to generate make dependencies by running "$make depend".
25268You might prefer to run it in background: "$make depend > makedepend.out &"
25269It can take a while, so you might not want to run it right now.
25270
25271EOM
25272		;;
25273	esac
25274	rp="Run $make depend now?"
25275	. UU/myread
25276	case "$ans" in
25277	y*)
25278		$make depend && echo "Now you must run '$make'."
25279		;;
25280	*)
25281		echo "You must run '$make depend' then '$make'."
25282		;;
25283	esac
25284elif test -f [Mm]akefile; then
25285	echo " "
25286	echo "Now you must run a $make."
25287else
25288	echo "Configure done."
25289fi
25290
25291if $test -f Policy.sh; then
25292    $cat <<EOM
25293
25294If you compile $package on a different machine or from a different object
25295directory, copy the Policy.sh file from this object directory to the
25296new one before you run Configure -- this will help you with most of
25297the policy defaults.
25298
25299EOM
25300fi
25301if $test -f UU/config.msg; then
25302    echo "Hmm.  I also noted the following information while running:"
25303    echo " "
25304    $cat UU/config.msg >&4
25305fi
25306$rm -f kit*isdone ark*isdone
25307$rm -rf UU
25308
25309: End of Configure
25310
25311