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 by perlbug@perl.org)
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_deprecated=''
386d_attribute_format=''
387d_attribute_malloc=''
388d_attribute_nonnull=''
389d_attribute_noreturn=''
390d_attribute_pure=''
391d_attribute_unused=''
392d_attribute_warn_unused_result=''
393d_printf_format_null=''
394d_backtrace=''
395d_builtin_choose_expr=''
396d_builtin_expect=''
397d_builtin_add_overflow=''
398d_builtin_mul_overflow=''
399d_builtin_sub_overflow=''
400d_c99_variadic_macros=''
401d_casti32=''
402castflags=''
403d_castneg=''
404d_cbrt=''
405d_chown=''
406d_chroot=''
407d_chsize=''
408d_class=''
409d_clearenv=''
410d_closedir=''
411d_void_closedir=''
412d_cmsghdr_s=''
413d_copysign=''
414d_copysignl=''
415d_cplusplus=''
416cryptlib=''
417d_crypt=''
418crypt_r_proto=''
419d_crypt_r=''
420d_csh=''
421full_csh=''
422d_ctermid=''
423ctermid_r_proto=''
424d_ctermid_r=''
425ctime_r_proto=''
426d_ctime_r=''
427d_cuserid=''
428d_dbminitproto=''
429d_difftime=''
430d_dir_dd_fd=''
431d_dirfd=''
432d_dladdr=''
433d_dlerror=''
434d_dlopen=''
435d_dlsymun=''
436d_dosuid=''
437d_suidsafe=''
438d_drand48_r=''
439drand48_r_proto=''
440d_drand48proto=''
441d_dup2=''
442d_dup3=''
443d_eaccess=''
444d_endgrent=''
445d_endgrent_r=''
446endgrent_r_proto=''
447d_endhent=''
448d_endhostent_r=''
449endhostent_r_proto=''
450d_endnent=''
451d_endnetent_r=''
452endnetent_r_proto=''
453d_endpent=''
454d_endprotoent_r=''
455endprotoent_r_proto=''
456d_endpwent=''
457d_endpwent_r=''
458endpwent_r_proto=''
459d_endsent=''
460d_endservent_r=''
461endservent_r_proto=''
462d_erf=''
463d_erfc=''
464d_exp2=''
465d_expm1=''
466d_faststdio=''
467d_fchdir=''
468d_fchmod=''
469d_fchown=''
470d_fcntl=''
471d_fcntl_can_lock=''
472d_fd_macros=''
473d_fd_set=''
474d_fds_bits=''
475d_fdclose=''
476d_fdim=''
477d_fegetround=''
478d_fgetpos=''
479d_finite=''
480d_finitel=''
481d_flexfnam=''
482d_flock=''
483d_flockproto=''
484d_fma=''
485d_fmax=''
486d_fmin=''
487d_fork=''
488d_fp_class=''
489d_fp_classl=''
490d_fpclass=''
491d_fp_classify=''
492d_fpclassify=''
493d_fpclassl=''
494d_fpgetround=''
495d_fpos64_t=''
496d_frexpl=''
497d_fs_data_s=''
498d_fchmodat=''
499d_linkat=''
500d_openat=''
501d_renameat=''
502d_unlinkat=''
503d_fseeko=''
504d_fsetpos=''
505d_fstatfs=''
506d_fsync=''
507d_ftello=''
508d_ftime=''
509d_gettimeod=''
510d_futimes=''
511d_gai_strerror=''
512d_Gconvert=''
513d_getaddrinfo=''
514d_getcwd=''
515d_getespwnam=''
516d_getfsstat=''
517d_getgrent=''
518d_getgrent_r=''
519getgrent_r_proto=''
520d_getgrgid_r=''
521getgrgid_r_proto=''
522d_getgrnam_r=''
523getgrnam_r_proto=''
524d_getgrps=''
525d_gethbyaddr=''
526d_gethbyname=''
527d_gethent=''
528aphostname=''
529d_gethname=''
530d_phostname=''
531d_uname=''
532d_gethostbyaddr_r=''
533gethostbyaddr_r_proto=''
534d_gethostbyname_r=''
535gethostbyname_r_proto=''
536d_gethostent_r=''
537gethostent_r_proto=''
538d_gethostprotos=''
539d_getitimer=''
540d_getlogin=''
541d_getlogin_r=''
542getlogin_r_proto=''
543d_getmnt=''
544d_getmntent=''
545d_getnameinfo=''
546d_getnbyaddr=''
547d_getnbyname=''
548d_getnent=''
549d_getnetbyaddr_r=''
550getnetbyaddr_r_proto=''
551d_getnetbyname_r=''
552getnetbyname_r_proto=''
553d_getnetent_r=''
554getnetent_r_proto=''
555d_getnetprotos=''
556d_getpagsz=''
557d_getpent=''
558d_getpgid=''
559d_getpgrp2=''
560d_bsdgetpgrp=''
561d_getpgrp=''
562d_getppid=''
563d_getprior=''
564d_getpbyname=''
565d_getpbynumber=''
566d_getprotobyname_r=''
567getprotobyname_r_proto=''
568d_getprotobynumber_r=''
569getprotobynumber_r_proto=''
570d_getprotoent_r=''
571getprotoent_r_proto=''
572d_getprotoprotos=''
573d_getprpwnam=''
574d_getpwent=''
575d_getpwent_r=''
576getpwent_r_proto=''
577d_getpwnam_r=''
578getpwnam_r_proto=''
579d_getpwuid_r=''
580getpwuid_r_proto=''
581d_getsent=''
582d_getservbyname_r=''
583getservbyname_r_proto=''
584d_getservbyport_r=''
585getservbyport_r_proto=''
586d_getservent_r=''
587getservent_r_proto=''
588d_getservprotos=''
589d_getspnam=''
590d_getspnam_r=''
591getspnam_r_proto=''
592d_getsbyname=''
593d_getsbyport=''
594d_gmtime_r=''
595gmtime_r_proto=''
596d_gnulibc=''
597gnulibc_version=''
598d_hasmntopt=''
599d_htonl=''
600d_hypot=''
601d_ilogb=''
602d_ilogbl=''
603d_inetaton=''
604d_inetntop=''
605d_inetpton=''
606d_int64_t=''
607d_isascii=''
608d_isblank=''
609d_isfinite=''
610d_isfinitel=''
611d_isinf=''
612d_isinfl=''
613d_isless=''
614d_isnan=''
615d_isnanl=''
616d_isnormal=''
617d_j0=''
618d_j0l=''
619d_killpg=''
620d_lc_monetary_2008=''
621d_lchown=''
622d_ldbl_dig=''
623d_lgamma=''
624d_lgamma_r=''
625d_libm_lib_version=''
626d_link=''
627d_llrint=''
628d_llrintl=''
629d_llround=''
630d_llroundl=''
631d_localeconv_l=''
632d_localtime_r=''
633d_localtime_r_needs_tzset=''
634localtime_r_proto=''
635d_locconv=''
636d_lockf=''
637d_log1p=''
638d_log2=''
639d_logb=''
640d_ldexpl=''
641d_long_double_style_ieee=''
642d_long_double_style_ieee_doubledouble=''
643d_long_double_style_ieee_extended=''
644d_long_double_style_ieee_std=''
645d_long_double_style_vax=''
646d_longdbl=''
647longdblkind=''
648longdblsize=''
649d_longlong=''
650longlongsize=''
651d_lrint=''
652d_lrintl=''
653d_lround=''
654d_lroundl=''
655d_lseekproto=''
656d_lstat=''
657d_madvise=''
658d_malloc_good_size=''
659d_malloc_size=''
660d_mblen=''
661d_mbrlen=''
662d_mbrtowc=''
663d_mbstowcs=''
664d_mbtowc=''
665d_memmem=''
666d_memrchr=''
667d_mkdir=''
668d_mkdtemp=''
669d_mkfifo=''
670d_mkostemp=''
671d_mkstemp=''
672d_mkstemps=''
673d_mktime=''
674d_mmap=''
675mmaptype=''
676d_modfl=''
677d_modflproto=''
678d_mprotect=''
679d_msg=''
680d_msgctl=''
681d_msgget=''
682d_msghdr_s=''
683d_msgrcv=''
684d_msgsnd=''
685d_msync=''
686d_munmap=''
687d_nan=''
688d_nanosleep=''
689d_nearbyint=''
690d_duplocale=''
691d_freelocale=''
692d_newlocale=''
693d_querylocale=''
694d_uselocale=''
695i_xlocale=''
696d_nextafter=''
697d_nexttoward=''
698d_nice=''
699d_nl_langinfo=''
700d_thread_safe_nl_langinfo_l=''
701d_off64_t=''
702d_open3=''
703d_fpathconf=''
704d_pathconf=''
705d_pause=''
706d_pipe2=''
707d_pipe=''
708d_poll=''
709d_portable=''
710d_prctl=''
711d_prctl_set_name=''
712d_procselfexe=''
713procselfexe=''
714d_old_pthread_create_joinable=''
715old_pthread_create_joinable=''
716d_pthread_atfork=''
717d_pthread_attr_setscope=''
718d_pthread_yield=''
719d_sched_yield=''
720sched_yield=''
721d_ptrdiff_t=''
722d_qgcvt=''
723d_random_r=''
724random_r_proto=''
725d_readdir64_r=''
726readdir64_r_proto=''
727d_readdir=''
728d_rewinddir=''
729d_seekdir=''
730d_telldir=''
731d_readdir_r=''
732readdir_r_proto=''
733d_readlink=''
734d_readv=''
735d_recvmsg=''
736d_re_comp=''
737d_regcmp=''
738d_regcomp=''
739d_remainder=''
740d_remquo=''
741d_rename=''
742d_rint=''
743d_rmdir=''
744d_round=''
745d_sbrkproto=''
746d_scalbn=''
747d_scalbnl=''
748d_select=''
749d_sem=''
750d_semctl=''
751d_semget=''
752d_semop=''
753d_sendmsg=''
754d_setegid=''
755d_seteuid=''
756d_setgrent=''
757d_setgrent_r=''
758setgrent_r_proto=''
759d_setgrps=''
760d_sethent=''
761d_sethostent_r=''
762sethostent_r_proto=''
763d_setitimer=''
764d_setlinebuf=''
765d_has_C_UTF8=''
766d_setlocale=''
767d_setlocale_accepts_any_locale_name=''
768d_setlocale_r=''
769setlocale_r_proto=''
770d_setnent=''
771d_setnetent_r=''
772setnetent_r_proto=''
773d_setpent=''
774d_setpgid=''
775d_setpgrp2=''
776d_bsdsetpgrp=''
777d_setpgrp=''
778d_setprior=''
779d_setproctitle=''
780d_setprotoent_r=''
781setprotoent_r_proto=''
782d_setpwent=''
783d_setpwent_r=''
784setpwent_r_proto=''
785d_setregid=''
786d_setresgid=''
787d_setresuid=''
788d_setreuid=''
789d_setrgid=''
790d_setruid=''
791d_setsent=''
792d_setservent_r=''
793setservent_r_proto=''
794d_setsid=''
795d_setvbuf=''
796d_shm=''
797d_shmat=''
798d_shmatprototype=''
799shmattype=''
800d_shmctl=''
801d_shmdt=''
802d_shmget=''
803d_sigaction=''
804d_siginfo_si_addr=''
805d_siginfo_si_band=''
806d_siginfo_si_errno=''
807d_siginfo_si_fd=''
808d_siginfo_si_pid=''
809d_siginfo_si_status=''
810d_siginfo_si_uid=''
811d_siginfo_si_value=''
812d_signbit=''
813d_sigprocmask=''
814d_sigsetjmp=''
815usesitecustomize=''
816d_snprintf=''
817d_vsnprintf=''
818d_sockatmark=''
819d_sockatmarkproto=''
820d_ip_mreq=''
821d_ip_mreq_source=''
822d_ipv6_mreq=''
823d_ipv6_mreq_source=''
824d_msg_ctrunc=''
825d_msg_dontroute=''
826d_msg_oob=''
827d_msg_peek=''
828d_msg_proxy=''
829d_oldsock=''
830d_scm_rights=''
831d_sin6_scope_id=''
832d_sockaddr_in6=''
833d_sockaddr_sa_len=''
834d_socket=''
835d_sockpair=''
836sockethdr=''
837socketlib=''
838d_socklen_t=''
839d_socks5_init=''
840d_sqrtl=''
841d_srand48_r=''
842srand48_r_proto=''
843d_srandom_r=''
844srandom_r_proto=''
845d_sresgproto=''
846d_sresuproto=''
847d_stat=''
848d_statblks=''
849d_statfs_f_flags=''
850d_statfs_s=''
851d_static_inline=''
852perl_static_inline=''
853d_fstatvfs=''
854d_statvfs=''
855d_stdio_cnt_lval=''
856d_stdio_ptr_lval=''
857d_stdio_ptr_lval_nochange_cnt=''
858d_stdio_ptr_lval_sets_cnt=''
859d_stdiobase=''
860d_stdstdio=''
861stdio_base=''
862stdio_bufsiz=''
863stdio_cnt=''
864stdio_filbuf=''
865stdio_ptr=''
866d_strcoll=''
867d_sysernlst=''
868d_syserrlst=''
869d_strerror_l=''
870d_strerror_r=''
871strerror_r_proto=''
872d_strftime=''
873d_strlcat=''
874d_strlcpy=''
875d_strnlen=''
876d_strtod=''
877d_strtod_l=''
878d_strtol=''
879d_strtold=''
880d_strtold_l=''
881d_strtoll=''
882d_strtoq=''
883d_strtoul=''
884d_strtoull=''
885d_strtouq=''
886d_strxfrm=''
887d_symlink=''
888d_syscall=''
889d_syscallproto=''
890d_sysconf=''
891d_system=''
892d_tcgetpgrp=''
893d_tcsetpgrp=''
894d_telldirproto=''
895d_tgamma=''
896d_time=''
897timetype=''
898d_asctime64=''
899d_ctime64=''
900d_difftime64=''
901d_gmtime64=''
902d_localtime64=''
903d_mktime64=''
904d_timegm=''
905clocktype=''
906d_times=''
907d_tmpnam_r=''
908tmpnam_r_proto=''
909d_towlower=''
910d_towupper=''
911d_trunc=''
912d_truncate=''
913d_truncl=''
914d_ttyname_r=''
915ttyname_r_proto=''
916d_tzname=''
917d_u32align=''
918d_ualarm=''
919d_umask=''
920d_semctl_semid_ds=''
921d_semctl_semun=''
922d_union_semun=''
923d_unordered=''
924d_unsetenv=''
925d_usleep=''
926d_usleepproto=''
927d_ustat=''
928d_pseudofork=''
929d_vfork=''
930usevfork=''
931d_voidsig=''
932signal_t=''
933d_wait4=''
934d_waitpid=''
935d_wcscmp=''
936d_wcstombs=''
937d_wcsxfrm=''
938d_wctomb=''
939d_writev=''
940default_inc_excludes_dot=''
941dlext=''
942bin_ELF=''
943cccdlflags=''
944ccdlflags=''
945dlsrc=''
946ld=''
947ld_can_script=''
948lddlflags=''
949usedl=''
950doublesize=''
951dtraceobject=''
952dtracexnolibs=''
953ebcdic=''
954fflushNULL=''
955fflushall=''
956fpossize=''
957fpostype=''
958gccansipedantic=''
959gccosandvers=''
960gccversion=''
961gidformat=''
962gidsign=''
963gidsize=''
964gidtype=''
965groupstype=''
966h_fcntl=''
967h_sysfile=''
968html1dir=''
969html1direxp=''
970installhtml1dir=''
971html3dir=''
972html3direxp=''
973installhtml3dir=''
974i_arpainet=''
975i_bfd=''
976i_crypt=''
977db_hashtype=''
978db_prefixtype=''
979db_version_major=''
980db_version_minor=''
981db_version_patch=''
982i_db=''
983i_dbm=''
984i_rpcsvcdbm=''
985d_dirnamlen=''
986direntrytype=''
987i_dirent=''
988i_dlfcn=''
989i_execinfo=''
990i_fcntl=''
991i_fenv=''
992i_fp=''
993i_fp_class=''
994i_gdbm=''
995d_grpasswd=''
996i_grp=''
997i_ieeefp=''
998i_inttypes=''
999i_langinfo=''
1000i_libutil=''
1001i_locale=''
1002i_machcthr=''
1003i_malloc=''
1004i_mallocmalloc=''
1005i_mntent=''
1006d_gdbm_ndbm_h_uses_prototypes=''
1007d_gdbmndbm_h_uses_prototypes=''
1008d_ndbm=''
1009d_ndbm_h_uses_prototypes=''
1010i_gdbm_ndbm=''
1011i_gdbmndbm=''
1012i_ndbm=''
1013i_netdb=''
1014i_neterrno=''
1015i_netinettcp=''
1016i_niin=''
1017i_sysin=''
1018i_poll=''
1019i_prot=''
1020i_pthread=''
1021d_pwage=''
1022d_pwchange=''
1023d_pwclass=''
1024d_pwcomment=''
1025d_pwexpire=''
1026d_pwgecos=''
1027d_pwpasswd=''
1028d_pwquota=''
1029i_pwd=''
1030i_quadmath=''
1031i_shadow=''
1032i_socks=''
1033i_stdbool=''
1034i_stdint=''
1035i_stdlib=''
1036i_sunmath=''
1037i_sysaccess=''
1038i_sysdir=''
1039i_sysfile=''
1040d_voidtty=''
1041i_bsdioctl=''
1042i_sysfilio=''
1043i_sysioctl=''
1044i_syssockio=''
1045i_syslog=''
1046i_sysmman=''
1047i_sysmode=''
1048i_sysmount=''
1049i_sysndir=''
1050i_sysparam=''
1051i_syspoll=''
1052i_sysresrc=''
1053i_syssecrt=''
1054i_sysselct=''
1055i_sysstat=''
1056i_sysstatfs=''
1057i_sysstatvfs=''
1058i_systimes=''
1059i_systypes=''
1060i_sysuio=''
1061i_sysun=''
1062i_sysutsname=''
1063i_sysvfs=''
1064i_syswait=''
1065i_sgtty=''
1066i_termio=''
1067i_termios=''
1068d_tm_tm_gmtoff=''
1069d_tm_tm_zone=''
1070i_systime=''
1071i_systimek=''
1072i_time=''
1073timeincl=''
1074i_unistd=''
1075i_ustat=''
1076i_utime=''
1077i_vfork=''
1078i_wchar=''
1079i_wctype=''
1080d_inc_version_list=''
1081inc_version_list=''
1082inc_version_list_init=''
1083doubleinfbytes=''
1084doublenanbytes=''
1085longdblinfbytes=''
1086longdblnanbytes=''
1087installprefix=''
1088installprefixexp=''
1089installstyle=''
1090installusrbinperl=''
1091intsize=''
1092longsize=''
1093shortsize=''
1094issymlink=''
1095libc=''
1096ldlibpthname=''
1097libperl=''
1098shrpenv=''
1099useshrplib=''
1100glibpth=''
1101incpth=''
1102libpth=''
1103loclibpth=''
1104plibpth=''
1105xlibpth=''
1106ignore_versioned_solibs=''
1107libs=''
1108libsdirs=''
1109libsfiles=''
1110libsfound=''
1111libspath=''
1112lns=''
1113d_PRIEUldbl=''
1114d_PRIFUldbl=''
1115d_PRIGUldbl=''
1116d_PRIeldbl=''
1117d_PRIfldbl=''
1118d_PRIgldbl=''
1119d_SCNfldbl=''
1120d_double_has_inf=''
1121d_double_has_nan=''
1122d_double_has_negative_zero=''
1123d_double_has_subnormals=''
1124d_double_style_cray=''
1125d_double_style_ibm=''
1126d_double_style_ieee=''
1127d_double_style_vax=''
1128doublekind=''
1129sPRIEUldbl=''
1130sPRIFUldbl=''
1131sPRIGUldbl=''
1132sPRIeldbl=''
1133sPRIfldbl=''
1134sPRIgldbl=''
1135sSCNfldbl=''
1136lseeksize=''
1137lseektype=''
1138make_set_make=''
1139d_mymalloc=''
1140freetype=''
1141mallocobj=''
1142mallocsrc=''
1143malloctype=''
1144usemallocwrap=''
1145usemymalloc=''
1146installman1dir=''
1147man1dir=''
1148man1direxp=''
1149man1ext=''
1150installman3dir=''
1151man3dir=''
1152man3direxp=''
1153man3ext=''
1154doublemantbits=''
1155longdblmantbits=''
1156nvmantbits=''
1157modetype=''
1158multiarch=''
1159mydomain=''
1160myhostname=''
1161phostname=''
1162c=''
1163n=''
1164d_eofnblk=''
1165eagain=''
1166o_nonblock=''
1167rd_nodata=''
1168need_va_copy=''
1169netdb_hlen_type=''
1170netdb_host_type=''
1171netdb_name_type=''
1172netdb_net_type=''
1173groupcat=''
1174hostcat=''
1175passcat=''
1176orderlib=''
1177ranlib=''
1178d_perl_otherlibdirs=''
1179otherlibdirs=''
1180package=''
1181spackage=''
1182pager=''
1183api_revision=''
1184api_subversion=''
1185api_version=''
1186api_versionstring=''
1187patchlevel=''
1188perl_patchlevel=''
1189revision=''
1190subversion=''
1191version=''
1192version_patchlevel_string=''
1193perl5=''
1194perladmin=''
1195perlpath=''
1196d_nv_preserves_uv=''
1197d_nv_zero_is_allbits_zero=''
1198i16size=''
1199i16type=''
1200i32size=''
1201i32type=''
1202i64size=''
1203i64type=''
1204i8size=''
1205i8type=''
1206ivsize=''
1207ivtype=''
1208nv_overflows_integers_at=''
1209nv_preserves_uv_bits=''
1210nvsize=''
1211nvtype=''
1212u16size=''
1213u16type=''
1214u32size=''
1215u32type=''
1216u64size=''
1217u64type=''
1218u8size=''
1219u8type=''
1220uvsize=''
1221uvtype=''
1222ivdformat=''
1223nvEUformat=''
1224nvFUformat=''
1225nvGUformat=''
1226nveformat=''
1227nvfformat=''
1228nvgformat=''
1229uvXUformat=''
1230uvoformat=''
1231uvuformat=''
1232uvxformat=''
1233pidtype=''
1234prefix=''
1235prefixexp=''
1236installprivlib=''
1237privlib=''
1238privlibexp=''
1239ptrsize=''
1240d_PRIXU64=''
1241d_PRId64=''
1242d_PRIi64=''
1243d_PRIo64=''
1244d_PRIu64=''
1245d_PRIx64=''
1246sPRIXU64=''
1247sPRId64=''
1248sPRIi64=''
1249sPRIo64=''
1250sPRIu64=''
1251sPRIx64=''
1252d_quad=''
1253quadkind=''
1254quadtype=''
1255uquadtype=''
1256drand01=''
1257randbits=''
1258randfunc=''
1259randseedtype=''
1260seedfunc=''
1261installscript=''
1262scriptdir=''
1263scriptdirexp=''
1264selectminbits=''
1265selecttype=''
1266sh=''
1267targetsh=''
1268sig_count=''
1269sig_name=''
1270sig_name_init=''
1271sig_num=''
1272sig_num_init=''
1273sig_size=''
1274d_sitearch=''
1275installsitearch=''
1276sitearch=''
1277sitearchexp=''
1278installsitebin=''
1279sitebin=''
1280sitebinexp=''
1281installsitehtml1dir=''
1282sitehtml1dir=''
1283sitehtml1direxp=''
1284installsitehtml3dir=''
1285sitehtml3dir=''
1286sitehtml3direxp=''
1287installsitelib=''
1288sitelib=''
1289sitelib_stem=''
1290sitelibexp=''
1291installsiteman1dir=''
1292siteman1dir=''
1293siteman1direxp=''
1294installsiteman3dir=''
1295siteman3dir=''
1296siteman3direxp=''
1297siteprefix=''
1298siteprefixexp=''
1299installsitescript=''
1300sitescript=''
1301sitescriptexp=''
1302sizesize=''
1303sizetype=''
1304d_libname_unique=''
1305so=''
1306socksizetype=''
1307sharpbang=''
1308shsharp=''
1309spitshell=''
1310src=''
1311ssizetype=''
1312st_ino_sign=''
1313st_ino_size=''
1314startperl=''
1315startsh=''
1316stdchar=''
1317d_stdio_stream_array=''
1318stdio_stream_array=''
1319sysman=''
1320sGMTIME_max=''
1321sGMTIME_min=''
1322sLOCALTIME_max=''
1323sLOCALTIME_min=''
1324trnl=''
1325uidformat=''
1326uidsign=''
1327uidsize=''
1328uidtype=''
1329archname64=''
1330use64bitall=''
1331use64bitint=''
1332usecbacktrace=''
1333dtrace=''
1334usedtrace=''
1335usefaststdio=''
1336usekernprocpathname=''
1337ccflags_uselargefiles=''
1338ldflags_uselargefiles=''
1339libswanted_uselargefiles=''
1340uselargefiles=''
1341uselongdouble=''
1342usemorebits=''
1343usemultiplicity=''
1344nm_opt=''
1345nm_so_opt=''
1346runnm=''
1347usenm=''
1348usensgetexecutablepath=''
1349useperlio=''
1350usequadmath=''
1351usesocks=''
1352d_oldpthreads=''
1353use5005threads=''
1354useithreads=''
1355usereentrant=''
1356usethreads=''
1357incpath=''
1358mips_type=''
1359usrinc=''
1360d_vendorarch=''
1361installvendorarch=''
1362vendorarch=''
1363vendorarchexp=''
1364d_vendorbin=''
1365installvendorbin=''
1366vendorbin=''
1367vendorbinexp=''
1368installvendorhtml1dir=''
1369vendorhtml1dir=''
1370vendorhtml1direxp=''
1371installvendorhtml3dir=''
1372vendorhtml3dir=''
1373vendorhtml3direxp=''
1374d_vendorlib=''
1375installvendorlib=''
1376vendorlib=''
1377vendorlib_stem=''
1378vendorlibexp=''
1379installvendorman1dir=''
1380vendorman1dir=''
1381vendorman1direxp=''
1382installvendorman3dir=''
1383vendorman3dir=''
1384vendorman3direxp=''
1385usevendorprefix=''
1386vendorprefix=''
1387vendorprefixexp=''
1388d_vendorscript=''
1389installvendorscript=''
1390vendorscript=''
1391vendorscriptexp=''
1392versiononly=''
1393yacc=''
1394yaccflags=''
1395CONFIG=''
1396
1397: Detect odd OSs
1398define='define'
1399undef='undef'
1400smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1401rmlist=''
1402
1403: We must find out about Eunice early
1404eunicefix=':'
1405if test -f /etc/unixtovms; then
1406	eunicefix=/etc/unixtovms
1407fi
1408if test -f /etc/unixtovms.exe; then
1409	eunicefix=/etc/unixtovms.exe
1410fi
1411
1412: Set executable suffix now -- needed before hints available
1413if test -f "/libs/version.library"; then
1414: Amiga OS
1415    _exe=""
1416elif test -f "/system/gnu_library/bin/ar.pm"; then
1417: Stratus VOS
1418    _exe=".pm"
1419elif test -n "$DJGPP"; then
1420: DOS DJGPP
1421    _exe=".exe"
1422elif test -f /kern/cookiejar; then
1423: MiNT
1424    _exe=""
1425elif test -d c:/. -o -n "$is_os2" ; then
1426: OS/2 or cygwin
1427    _exe=".exe"
1428fi
1429
1430groupstype=''
1431i_whoami=''
1432: Possible local include directories to search.
1433: Set locincpth to "" in a hint file to defeat local include searches.
1434locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1435locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1436:
1437: no include file wanted by default
1438inclwanted=''
1439
1440: Enable -DEBUGGING and -DDEBUGGING from the command line
1441EBUGGING=''
1442DEBUGGING=''
1443
1444: Trailing extension.  Override this in a hint file, if needed.
1445: Extra object files, if any, needed on this platform.
1446archobjs=''
1447libnames=''
1448: change the next line if compiling for Xenix/286 on Xenix/386
1449xlibpth='/usr/lib/386 /lib/386'
1450: Possible local library directories to search.
1451loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1452loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1453
1454: general looking path for locating libraries
1455glibpth="/lib /usr/lib $xlibpth"
1456glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1457test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1458test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1459test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1460
1461: Private path used by Configure to find libraries.  Its value
1462: is prepended to libpth. This variable takes care of special
1463: machines, like the mips.  Usually, it should be empty.
1464plibpth=''
1465
1466: default library list
1467libswanted=''
1468: some systems want to use only the non-versioned libso:s
1469ignore_versioned_solibs=''
1470ccname=''
1471ccversion=''
1472perllibs=''
1473: set useposix=false in your hint file to disable the POSIX extension.
1474useposix=true
1475: set useopcode=false in your hint file to disable the Opcode extension.
1476useopcode=true
1477: set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1478uselanginfo=true
1479archname64=''
1480ccflags_uselargefiles=''
1481ldflags_uselargefiles=''
1482libswanted_uselargefiles=''
1483: set usemultiplicity on the Configure command line to enable multiplicity.
1484: set usesocks on the Configure command line to enable socks.
1485archname=''
1486: set usethreads on the Configure command line to enable threads.
1487usereentrant='undef'
1488: List of libraries we want.
1489: If anyone needs extra -lxxx, put those in a hint file.
1490libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1491libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1492: We probably want to search /usr/shlib before most other libraries.
1493: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1494glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1495glibpth="/usr/shlib $glibpth"
1496: Do not use vfork unless overridden by a hint file.
1497usevfork=false
1498
1499: Find the basic shell for Bourne shell scripts
1500case "$sh" in
1501'')
1502	case "$SYSTYPE" in
1503	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1504	*) xxx='/bin/sh';;
1505	esac
1506	if test -f "$xxx"; then
1507		sh="$xxx"
1508	else
1509		: Build up a list and do a single loop so we can 'break' out.
1510		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1511		for xxx in sh bash ksh pdksh ash; do
1512			for p in $pth; do
1513				try="$try ${p}/${xxx}"
1514			done
1515		done
1516		for xxx in $try; do
1517			if test -f "$xxx"; then
1518				sh="$xxx";
1519				break
1520			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1521				sh="$xxx";
1522				break
1523			elif test -f "$xxx.exe"; then
1524				sh="$xxx";
1525				break
1526			fi
1527		done
1528	fi
1529	;;
1530esac
1531
1532case "$sh" in
1533'')	cat >&2 <<EOM
1534$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1535
1536Usually it's in /bin/sh.  How did you even get this far?
1537Please contact me (Perl Maintainers) at https://github.com/Perl/perl5/issues
1538and we'll try to straighten this all out.
1539EOM
1540	exit 1
1541	;;
1542esac
1543
1544: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1545: default both to the same thing, cross-compilers can then set targetsh differently if they like
1546targetsh=$sh
1547
1548: see if sh knows # comments
1549if `$sh -c '#' >/dev/null 2>&1`; then
1550	shsharp=true
1551	spitshell=cat
1552	xcat=/bin/cat
1553	test -f $xcat$_exe || xcat=/usr/bin/cat
1554	if test ! -f $xcat$_exe; then
1555		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1556			if test -f $p/cat$_exe; then
1557				xcat=$p/cat
1558				break
1559			fi
1560		done
1561		if test ! -f $xcat$_exe; then
1562			echo "Can't find cat anywhere!"
1563			exit 1
1564		fi
1565	fi
1566	echo "#!$xcat" >sharp
1567	$eunicefix sharp
1568	chmod +x sharp
1569	./sharp > today 2>/dev/null
1570	if test -s today; then
1571		sharpbang='#!'
1572	else
1573		echo "#! $xcat" > sharp
1574		$eunicefix sharp
1575		chmod +x sharp
1576		./sharp > today 2>/dev/null
1577		if test -s today; then
1578			sharpbang='#! '
1579		else
1580			sharpbang=': use '
1581		fi
1582	fi
1583else
1584	echo " "
1585	echo "Your $sh doesn't grok # comments--I will strip them later on."
1586	shsharp=false
1587	cd ..
1588	echo "exec grep -v '^[ 	]*#'" >spitshell
1589	chmod +x spitshell
1590	$eunicefix spitshell
1591	spitshell=`pwd`/spitshell
1592	cd UU
1593	echo "I presume that if # doesn't work, #! won't work either!"
1594	sharpbang=': use '
1595fi
1596rm -f sharp today
1597
1598: figure out how to guarantee sh startup
1599case "$startsh" in
1600'') startsh=${sharpbang}${sh} ;;
1601*)
1602esac
1603cat >sharp <<EOSS
1604$startsh
1605set abc
1606test "$?abc" != 1
1607EOSS
1608
1609chmod +x sharp
1610$eunicefix sharp
1611if ./sharp; then
1612	: echo "Yup, it does."
1613else
1614	echo "Hmm... '$startsh' does not guarantee sh startup..."
1615	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1616fi
1617rm -f sharp
1618
1619: Save command line options in file UU/cmdline.opt for later use in
1620: generating config.sh.
1621cat > cmdline.opt <<EOSH
1622: Configure command line arguments.
1623config_arg0='$0'
1624config_args='$*'
1625config_argc=$#
1626EOSH
1627argn=1
1628args_exp=''
1629args_sep=''
1630for arg in "$@"; do
1631	cat >>cmdline.opt <<EOSH
1632config_arg$argn='$arg'
1633EOSH
1634	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1635$arg
1636EOC
1637	arg_exp=`cat cmdl.opt`
1638	args_exp="$args_exp$args_sep'$arg_exp'"
1639	argn=`expr $argn + 1`
1640	args_sep=' '
1641done
1642rm -f cmdl.opt
1643
1644: produce awk script to parse command line options
1645cat >options.awk <<'EOF'
1646BEGIN {
1647	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1648
1649	len = length(optstr);
1650	for (i = 1; i <= len; i++) {
1651		c = substr(optstr, i, 1);
1652		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1653		if (a == ":") {
1654			arg[c] = 1;
1655			i++;
1656		}
1657		opt[c] = 1;
1658	}
1659}
1660{
1661	expect = 0;
1662	str = $0;
1663	if (substr(str, 1, 1) != "-") {
1664		printf("'%s'\n", str);
1665		next;
1666	}
1667	len = length($0);
1668	for (i = 2; i <= len; i++) {
1669		c = substr(str, i, 1);
1670		if (!opt[c]) {
1671			printf("-%s\n", substr(str, i));
1672			next;
1673		}
1674		printf("-%s\n", c);
1675		if (arg[c]) {
1676			if (i < len)
1677				printf("'%s'\n", substr(str, i + 1));
1678			else
1679				expect = 1;
1680			next;
1681		}
1682	}
1683}
1684END {
1685	if (expect)
1686		print "?";
1687}
1688EOF
1689
1690: process the command line options
1691set X `for arg in "$@"; do echo "X$arg"; done |
1692	sed -e s/X// | awk -f options.awk`
1693eval "set $*"
1694shift
1695rm -f options.awk
1696
1697: set up default values
1698fastread=''
1699reuseval=false
1700config_sh=''
1701alldone=''
1702error=''
1703silent=''
1704extractsh=''
1705knowitall=''
1706rm -f optdef.sh posthint.sh
1707cat >optdef.sh <<EOS
1708$startsh
1709EOS
1710
1711
1712: option parsing
1713while test $# -gt 0; do
1714	case "$1" in
1715	-d) shift; fastread=yes;;
1716	-e) shift; alldone=cont;;
1717	-f)
1718		shift
1719		cd ..
1720		if test -r "$1"; then
1721			config_sh="$1"
1722		else
1723			echo "$me: cannot read config file $1." >&2
1724			error=true
1725		fi
1726		cd UU
1727		shift;;
1728	--help|\
1729	-h) shift; error=true;;
1730	-r) shift; reuseval=true;;
1731	-s) shift; silent=true; realsilent=true;;
1732	-E) shift; alldone=exit;;
1733	-K) shift; knowitall=true;;
1734	-O) shift;;
1735	-S) shift; silent=true; extractsh=true;;
1736	-D)
1737		shift
1738		case "$1" in
1739		*=)
1740			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1741			echo "$me: ignoring -D $1" >&2
1742			;;
1743		*=*) echo "$1" | \
1744				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1745		*) echo "$1='define'" >> optdef.sh;;
1746		esac
1747		shift
1748		;;
1749	-U)
1750		shift
1751		case "$1" in
1752		*=) echo "$1" >> optdef.sh;;
1753		*=*)
1754			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1755			echo "$me: ignoring -U $1" >&2
1756			;;
1757		*) echo "$1='undef'" >> optdef.sh;;
1758		esac
1759		shift
1760		;;
1761	-A)
1762	    shift
1763	    xxx=''
1764	    yyy="$1"
1765	    zzz=''
1766	    uuu=undef
1767	    case "$yyy" in
1768            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1769                 case "$zzz" in
1770                 *:*) zzz='' ;;
1771                 *)   xxx=append
1772                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1773                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1774                 esac
1775                 ;;
1776            esac
1777            case "$xxx" in
1778            '')  case "$yyy" in
1779                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1780                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1781                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1782                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1783                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1784                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1785                 esac
1786                 ;;
1787            esac
1788	    case "$xxx" in
1789	    append)
1790		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1791	    clear)
1792		echo "$yyy=''"			>> posthint.sh ;;
1793	    define)
1794	        case "$zzz" in
1795		'') zzz=define ;;
1796		esac
1797		echo "$yyy='$zzz'"		>> posthint.sh ;;
1798	    eval)
1799		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1800	    prepend)
1801		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1802	    undef)
1803	        case "$zzz" in
1804		'') zzz="$uuu" ;;
1805		esac
1806		echo "$yyy=$zzz"		>> posthint.sh ;;
1807            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1808	    esac
1809	    shift
1810	    ;;
1811	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1812	    exit 0;;
1813	--) break;;
1814	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1815	*) break;;
1816	esac
1817done
1818
1819case "$error" in
1820true)
1821	cat >&2 <<EOM
1822Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1823                 [-U symbol] [-U symbol=] [-A command:symbol...]
1824  -d : use defaults for all answers.
1825  -e : go on without questioning past the production of config.sh.
1826  -f : specify an alternate default configuration file.
1827  -h : print this help message and exit (with an error status).
1828  -r : reuse C symbols value if possible (skips costly nm extraction).
1829  -s : silent mode, only echoes questions and essential information.
1830  -D : define symbol to have some value:
1831         -D symbol         symbol gets the value 'define'
1832         -D symbol=value   symbol gets the value 'value'
1833       common used examples (see INSTALL for more info):
1834         -Duse64bitint            use 64bit integers
1835         -Duse64bitall            use 64bit integers and pointers
1836         -Dusethreads             use thread support
1837         -Dinc_version_list=none  do not include older perl trees in @INC
1838         -DEBUGGING=none          DEBUGGING options
1839         -Dcc=gcc                 choose your compiler
1840         -Dprefix=/opt/perl5      choose your destination
1841  -E : stop at the end of questions, after having produced config.sh.
1842  -K : do not use unless you know what you are doing.
1843  -O : ignored for backward compatibility
1844  -S : perform variable substitutions on all .SH files (can mix with -f)
1845  -U : undefine symbol:
1846         -U symbol    symbol gets the value 'undef'
1847         -U symbol=   symbol gets completely empty
1848       e.g.:  -Uversiononly
1849  -A : manipulate symbol after the platform specific hints have been applied:
1850         -A append:symbol=value   append value to symbol
1851         -A symbol=value          like append:, but with a separating space
1852         -A define:symbol=value   define symbol to have value
1853         -A clear:symbol          define symbol to be ''
1854         -A define:symbol         define symbol to be 'define'
1855         -A eval:symbol=value     define symbol to be eval of value
1856         -A prepend:symbol=value  prepend value to symbol
1857         -A undef:symbol          define symbol to be 'undef'
1858         -A undef:symbol=         define symbol to be ''
1859       e.g.:  -A prepend:libswanted='cl pthread '
1860              -A ccflags=-DSOME_MACRO
1861  -V : print version number and exit (with a zero status).
1862EOM
1863	exit 1
1864	;;
1865esac
1866
1867: Sanity checks
1868case "$fastread$alldone" in
1869yescont|yesexit) ;;
1870*)
1871	case "$extractsh" in
1872	true) ;;
1873	*)
1874		if test ! -t 0; then
1875			echo "Say 'sh Configure', not 'sh <Configure'"
1876			exit 1
1877		fi
1878		;;
1879	esac
1880	;;
1881esac
1882
1883exec 4>&1
1884case "$silent" in
1885true) exec 1>/dev/null;;
1886esac
1887
1888: run the defines and the undefines, if any, but leave the file out there...
1889touch optdef.sh
1890grep '\\' optdef.sh >/dev/null 2>&1
1891if test $? = 0; then
1892    echo "Configure does not support \\ in -D arguments"
1893    exit 1
1894fi
1895. ./optdef.sh
1896: create the posthint manipulation script and leave the file out there...
1897touch posthint.sh
1898
1899: set package name
1900package='perl5'
1901first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1902last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1903case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1904ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1905*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1906esac
1907
1908: Some greps do not return status, grrr.
1909echo "grimblepritz" >grimble
1910if grep blurfldyick grimble >/dev/null 2>&1 ; then
1911	contains=contains
1912elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1913	contains=grep
1914else
1915	contains=contains
1916fi
1917rm -f grimble
1918: the following should work in any shell
1919case "$contains" in
1920contains*)
1921	echo " "
1922	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1923	cat >contains <<'EOSS'
1924grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1925EOSS
1926chmod +x contains
1927esac
1928
1929: Find the path to the source tree
1930case "$src" in
1931'') case "$0" in
1932    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1933         case "$src" in
1934	 /*)	;;
1935	 .)	;;
1936         *)	src=`cd ../$src && pwd` ;;
1937	 esac
1938         ;;
1939    *)   src='.';;
1940    esac;;
1941esac
1942case "$src" in
1943'')	src=/
1944	rsrc=/
1945	;;
1946/*)	rsrc="$src";;
1947*)	rsrc="../$src";;
1948esac
1949if test -f $rsrc/Configure && \
1950	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1951then
1952   : found it, so we are ok.
1953else
1954	rsrc=''
1955	for src in . .. ../.. ../../.. ../../../..; do
1956		if test -f ../$src/Configure && \
1957			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1958		then
1959			rsrc=../$src
1960			break
1961		fi
1962	done
1963fi
1964case "$rsrc" in
1965'')
1966	cat <<EOM >&4
1967
1968Sorry, I can't seem to locate the source dir for $package.  Please start
1969Configure with an explicit path -- i.e. /some/path/Configure.
1970
1971EOM
1972	exit 1
1973	;;
1974../.)	rsrc='..';;
1975*)
1976	echo " "
1977	echo "Sources for $package found in \"$src\"." >&4
1978	;;
1979esac
1980
1981: script used to extract .SH files with variable substitutions
1982cat >extract <<'EOS'
1983PERL_CONFIG_SH=true
1984echo "Doing variable substitutions on .SH files..."
1985if test -f MANIFEST; then
1986	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1987else
1988	echo "(Looking for .SH files under the source directory.)"
1989	set x `(cd "$src"; find . -name "*.SH" -print)`
1990fi
1991shift
1992case $# in
19930) set x `(cd "$src"; echo *.SH)`; shift;;
1994esac
1995if test ! -f "$src/$1"; then
1996	shift
1997fi
1998mkdir_p='
1999name=$1;
2000create="";
2001while test $name; do
2002	if test ! -d "$name"; then
2003		create="$name $create";
2004		name=`echo $name | sed -e "s|^[^/]*$||"`;
2005		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2006	else
2007		name="";
2008	fi;
2009done;
2010for file in $create; do
2011	mkdir $file;
2012done
2013'
2014for file in $*; do
2015	case "$src" in
2016	".")
2017		case "$file" in
2018		*/*)
2019			dir=`expr X$file : 'X\(.*\)/'`
2020			file=`expr X$file : 'X.*/\(.*\)'`
2021			(cd "$dir" && . ./$file)
2022			;;
2023		*)
2024			. ./$file
2025			;;
2026		esac
2027		;;
2028	*)
2029		case "$file" in
2030		*/*)
2031			dir=`expr X$file : 'X\(.*\)/'`
2032			file=`expr X$file : 'X.*/\(.*\)'`
2033			(set x $dir; shift; eval $mkdir_p)
2034			sh <"$src/$dir/$file"
2035			;;
2036		*)
2037			sh <"$src/$file"
2038			;;
2039		esac
2040		;;
2041	esac
2042done
2043if test -f "$src/config_h.SH"; then
2044	if test ! -f config.h; then
2045	: oops, they left it out of MANIFEST, probably, so do it anyway.
2046	. "$src/config_h.SH"
2047	fi
2048fi
2049EOS
2050
2051: extract files and exit if asked to do so
2052case "$extractsh" in
2053true)
2054	case "$realsilent" in
2055	true) ;;
2056	*) exec 1>&4;;
2057	esac
2058	case "$config_sh" in
2059	'') config_sh='config.sh';;
2060	esac
2061	echo " "
2062	echo "Fetching answers from $config_sh..."
2063	cd ..
2064	. $config_sh
2065	. UU/optdef.sh
2066	echo " "
2067	. UU/extract
2068	rm -rf UU
2069	echo "Extraction done."
2070	exit 0
2071	;;
2072esac
2073
2074: Eunice requires " " instead of "", can you believe it
2075echo " "
2076: Here we go...
2077echo "Beginning of configuration questions for $package."
2078
2079trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2080
2081: first determine how to suppress newline on echo command
2082echo " "
2083echo "Checking echo to see how to suppress newlines..."
2084(echo "hi there\c" ; echo " ") >.echotmp
2085if $contains c .echotmp >/dev/null 2>&1 ; then
2086	echo "...using -n."
2087	n='-n'
2088	c=''
2089else
2090	cat <<'EOM'
2091...using \c
2092EOM
2093	n=''
2094	c='\c'
2095fi
2096echo $n "The star should be here-->$c"
2097echo '*'
2098rm -f .echotmp
2099
2100: Now test for existence of everything in MANIFEST
2101echo " "
2102if test -f "$rsrc/MANIFEST"; then
2103	echo "First let's make sure your kit is complete.  Checking..." >&4
2104	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2105		(split -l 50 2>/dev/null || split -50)
2106	rm -f missing
2107	tmppwd=`pwd`
2108	for filelist in x??; do
2109		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2110			>/dev/null 2>>"$tmppwd/missing")
2111	done
2112	if test -s missing; then
2113		cat missing >&4
2114		cat >&4 <<'EOM'
2115
2116THIS PACKAGE SEEMS TO BE INCOMPLETE.
2117
2118You have the option of continuing the configuration process, despite the
2119distinct possibility that your kit is damaged, by typing 'y'es.  If you
2120do, don't blame me if something goes wrong.  I advise you to type 'n'o
2121and contact the author (https://github.com/Perl/perl5/issues).
2122
2123EOM
2124		echo $n "Continue? [n] $c" >&4
2125		read ans
2126		case "$ans" in
2127		y*)
2128			echo "Continuing..." >&4
2129			rm -f missing
2130			;;
2131		*)
2132			echo "ABORTING..." >&4
2133			kill $$
2134			;;
2135		esac
2136	else
2137		echo "Looks good..."
2138	fi
2139else
2140	echo "There is no MANIFEST file.  I hope your kit is complete !"
2141fi
2142rm -f missing x??
2143
2144: Find the appropriate value for a newline for tr
2145if test -n "$DJGPP"; then
2146       trnl='\012'
2147fi
2148if test X"$trnl" = X; then
2149	case "`echo foo | tr '\n' x 2>/dev/null`" in
2150	foox) trnl='\n' ;;
2151	esac
2152fi
2153if test X"$trnl" = X; then
2154	case "`echo foo | tr '\012' x 2>/dev/null`" in
2155	foox) trnl='\012' ;;
2156	esac
2157fi
2158if test X"$trnl" = X; then
2159       case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2160       fooxy) trnl='\n\r' ;;
2161       esac
2162fi
2163if test X"$trnl" = X; then
2164	cat <<EOM >&2
2165
2166$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2167
2168EOM
2169	exit 1
2170fi
2171
2172: compute the number of columns on the terminal for proper question formatting
2173case "$COLUMNS" in
2174'') COLUMNS='80';;
2175esac
2176
2177: set up the echo used in my read
2178myecho="case \"\$xxxm\" in
2179'') echo $n \"\$rp $c\" >&4;;
2180*) case \"\$rp\" in
2181	'') echo $n \"[\$xxxm] $c\";;
2182	*)
2183		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2184			echo \"\$rp\" >&4
2185			echo $n \"[\$xxxm] $c\" >&4
2186		else
2187			echo $n \"\$rp [\$xxxm] $c\" >&4
2188		fi
2189		;;
2190	esac;;
2191esac"
2192
2193: now set up to do reads with possible shell escape and default assignment
2194cat <<EOSC >myread
2195$startsh
2196xxxm=\$dflt
2197$myecho
2198ans='!'
2199case "\$fastread" in
2200yes) case "\$dflt" in
2201	'') ;;
2202	*) ans='';
2203		case "\$silent-\$rp" in
2204		true-) ;;
2205		*) echo " " >&4;;
2206		esac;;
2207	esac;;
2208*) case "\$silent" in
2209	true) case "\$rp" in
2210		'') ans='';;
2211		esac;;
2212	esac;;
2213esac
2214while expr "X\$ans" : "X!" >/dev/null; do
2215	read answ
2216	set x \$xxxm
2217	shift
2218	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2219	case  "\$answ" in
2220	"!")
2221		sh 1>&4
2222		echo " "
2223		$myecho
2224		;;
2225	!*)
2226		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2227		shift
2228		sh 1>&4 -c "\$*"
2229		echo " "
2230		$myecho
2231		;;
2232	"\$ans")
2233		case "\$ans" in
2234		\\&*)
2235			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2236			shift
2237			case "\$1" in
2238			-d)
2239				fastread=yes
2240				echo "(OK, I'll run with -d after this question.)" >&4
2241				;;
2242			-*)
2243				echo "*** Sorry, \$1 not supported yet." >&4
2244				;;
2245			esac
2246			$myecho
2247			ans=!
2248			;;
2249		esac;;
2250	*)
2251		case "\$aok" in
2252		y)
2253			echo "*** Substitution done -- please confirm."
2254			xxxm="\$ans"
2255			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2256			xxxm="\$ans"
2257			ans=!
2258			;;
2259		*)
2260			echo "*** Error -- try again."
2261			ans=!
2262			;;
2263		esac
2264		$myecho
2265		;;
2266	esac
2267	case "\$ans\$xxxm\$nostick" in
2268	'')
2269		ans=!
2270		$myecho
2271		;;
2272	esac
2273done
2274case "\$ans" in
2275'') ans="\$xxxm";;
2276esac
2277EOSC
2278
2279: create .config dir to save info across Configure sessions
2280test -d ../.config || mkdir ../.config
2281cat >../.config/README <<EOF
2282This directory created by Configure to save information that should
2283persist across sessions for $package.
2284
2285You may safely delete it if you wish.
2286EOF
2287
2288: See if we are using a devel version and want that
2289xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2290case "$usedevel" in
2291$define|true|[yY]*)
2292    usedevel="$define" ;;
2293*) case "$xversion" in
2294   *[13579])
2295	cat >&4 <<EOH
2296*** WHOA THERE!!! ***
2297
2298    This is an UNSTABLE DEVELOPMENT release.
2299    The version of this $package distribution is $xversion, that is, odd,
2300    (as opposed to even) and that signifies a development release.
2301    If you want a maintenance release, you want an even-numbered version.
2302
2303    Do ***NOT*** install this into production use.
2304    Data corruption and crashes are possible.
2305
2306    It is most seriously suggested that you do not continue any further
2307    unless you want to help in developing and debugging Perl.
2308
2309    If you *still* want to build perl, you can answer 'y' now,
2310    or pass -Dusedevel to Configure.
2311
2312EOH
2313	rp='Do you really want to continue?'
2314	dflt='n'
2315	. ./myread
2316	case "$ans" in
2317	[yY]) echo >&4 "Okay, continuing."
2318	      usedevel="$define" ;;
2319	*) echo >&4 "Okay, bye."
2320	   exit 1
2321	   ;;
2322	esac
2323	;;
2324    esac
2325    usedevel="$undef"
2326    ;;
2327esac
2328case "$usedevel" in
2329$define|true|[yY]*)
2330	case "$versiononly" in
2331	'') versiononly="$define" ;;
2332	esac
2333	case "$installusrbinperl" in
2334	'') installusrbinperl="$undef" ;;
2335	esac
2336	;;
2337esac
2338
2339: general instructions
2340needman=true
2341firsttime=true
2342user=`(logname) 2>/dev/null`
2343case "$user" in
2344'') user=`whoami 2>&1`;;
2345esac
2346if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2347	firsttime=false
2348	echo " "
2349	rp='Would you like to see the instructions?'
2350	dflt=n
2351	. ./myread
2352	case "$ans" in
2353	[yY]*) ;;
2354	*) needman=false;;
2355	esac
2356fi
2357if $needman; then
2358	cat <<EOH
2359
2360This installation shell script will examine your system and ask you questions
2361to determine how the perl5 package should be installed. If you get
2362stuck on a question, you may use a ! shell escape to start a subshell or
2363execute a command.  Many of the questions will have default answers in square
2364brackets; typing carriage return will give you the default.
2365
2366On some of the questions which ask for file or directory names you are allowed
2367to use the ~name construct to specify the login directory belonging to "name",
2368even if you don't have a shell which knows about that.  Questions where this is
2369allowed will be marked "(~name ok)".
2370
2371EOH
2372	rp=''
2373	dflt='Type carriage return to continue'
2374	. ./myread
2375	cat <<'EOH'
2376
2377The prompter used in this script allows you to use shell variables and
2378backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2379in the default answer, as if the default line was a set of arguments given to a
2380script shell.  This means you may also use $* to repeat the whole default line,
2381so you do not have to re-type everything to add something to the default.
2382
2383Every time there is a substitution, you will have to confirm.  If there is an
2384error (e.g. an unmatched backtick), the default answer will remain unchanged
2385and you will be prompted again.
2386
2387If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2388the questions and use the computed defaults (or the previous answers if there
2389was already a config.sh file). Type 'Configure -h' for a list of options.
2390You may also start interactively and then answer '& -d' at any prompt to turn
2391on the non-interactive behaviour for the remainder of the execution.
2392
2393EOH
2394	. ./myread
2395	cat <<EOH
2396
2397Much effort has been expended to ensure that this shell script will run on any
2398Unix system.  If despite that it blows up on yours, your best bet is to edit
2399Configure and run it again.  If you can't run Configure for some reason,
2400you'll have to generate a config.sh file by hand.  Whatever problems you
2401have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2402
2403This installation script affects things in two ways:
2404
24051) it may do direct variable substitutions on some of the files included
2406   in this kit.
24072) it builds a config.h file for inclusion in C programs.  You may edit
2408   any of these files as the need arises after running this script.
2409
2410If you make a mistake on a question, there is no easy way to back up to it
2411currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2412files.  Configure will offer to let you do this before it runs the SH files.
2413
2414EOH
2415	dflt='Type carriage return to continue'
2416	. ./myread
2417	case "$firsttime" in
2418	true) echo $user >>../.config/instruct;;
2419	esac
2420fi
2421
2422: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2423: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2424if test "X$sysroot" = X; then
2425    sysroot=""
2426else
2427    case "$cc" in
2428	*gcc*|*g++*)
2429	    echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2430	    # _sysroot is used in places where we need --sysroot=foo
2431	    # but using the rest of the flags could cause issues.
2432	    _sysroot="--sysroot=$sysroot";
2433	    case "$ccflags" in
2434		*sysroot*) ;;
2435		'undef'|*)
2436		ccflags="$ccflags $_sysroot"
2437	    esac
2438	    case "$ldflags" in
2439		*sysroot*) ;;
2440		'undef'|*)
2441		ldflags="$ldflags $_sysroot"
2442	    esac
2443	    case "$cppflags" in
2444		*sysroot*) ;;
2445		'undef'|*)
2446		cppflags="$cppflags $_sysroot"
2447	    esac
2448	    # lddlflags updated below in lddlflags section;
2449	    # same with cccdlflags
2450	    ;;
2451    esac
2452
2453    # Adjust some defaults to also use $sysroot
2454    for var in xlibpth loclibpth locincpth glibpth; do
2455	eval xxx=\$$var
2456	eval $var=''
2457	for path in $xxx; do
2458	    eval $var=\"\$$var $sysroot$path\"
2459	done
2460    done
2461
2462fi
2463
2464: find out where common programs are
2465echo " "
2466echo "Locating common programs..." >&4
2467cat <<EOSC >loc
2468$startsh
2469case \$# in
24700) exit 1;;
2471esac
2472thing=\$1
2473shift
2474dflt=\$1
2475shift
2476for dir in \$*; do
2477	case "\$thing" in
2478	.)
2479	if test -d \$dir/\$thing; then
2480		echo \$dir
2481		exit 0
2482	fi
2483	;;
2484	*)
2485	for thisthing in \$dir/\$thing; do
2486		: just loop through to pick last item
2487	done
2488	if test -f \$thisthing; then
2489		echo \$thisthing
2490		exit 0
2491	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2492		echo \$thisthing
2493		exit 0
2494	elif test -f \$dir/\$thing.exe; then
2495		if test -n "$DJGPP"; then
2496			echo \$dir/\$thing.exe
2497		elif test "$eunicefix" != ":"; then
2498			: on Eunice apparently
2499			echo \$dir/\$thing
2500		fi
2501		exit 0
2502	fi
2503	;;
2504	esac
2505done
2506echo \$dflt
2507exit 1
2508EOSC
2509chmod +x loc
2510$eunicefix loc
2511loclist="
2512awk
2513cat
2514chmod
2515comm
2516cp
2517echo
2518expr
2519grep
2520ls
2521mkdir
2522rm
2523sed
2524sort
2525touch
2526tr
2527uniq
2528"
2529trylist="
2530ar
2531bison
2532byacc
2533cpp
2534csh
2535date
2536egrep
2537gmake
2538gzip
2539less
2540ln
2541make
2542more
2543nm
2544nroff
2545perl
2546pg
2547test
2548uname
2549zip
2550"
2551pth=`echo $PATH | sed -e "s/$p_/ /g"`
2552pth="$pth $sysroot/lib $sysroot/usr/lib"
2553for file in $loclist; do
2554	eval xxx=\$$file
2555	case "$xxx" in
2556	/*|?:[\\/]*)
2557		if test -f "$xxx"; then
2558			: ok
2559		else
2560			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2561			xxx=`./loc $file $file $pth`
2562		fi
2563		;;
2564	'') xxx=`./loc $file $file $pth`;;
2565	*) xxx=`./loc $xxx $xxx $pth`;;
2566	esac
2567	eval $file=$xxx$_exe
2568	eval _$file=$xxx
2569	case "$xxx" in
2570	/*)
2571		echo $file is in $xxx.
2572		;;
2573	?:[\\/]*)
2574		echo $file is in $xxx.
2575		;;
2576	*)
2577		echo "I don't know where '$file' is, and my life depends on it." >&4
2578		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2579		exit 1
2580		;;
2581	esac
2582done
2583echo " "
2584echo "Don't worry if any of the following aren't found..."
2585say=offhand
2586for file in $trylist; do
2587	eval xxx=\$$file
2588	case "$xxx" in
2589	/*|?:[\\/]*)
2590		if test -f "$xxx"; then
2591			: ok
2592		else
2593			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2594			xxx=`./loc $file $file $pth`
2595		fi
2596		;;
2597	'') xxx=`./loc $file $file $pth`;;
2598	*) xxx=`./loc $xxx $xxx $pth`;;
2599	esac
2600	eval $file=$xxx$_exe
2601	eval _$file=$xxx
2602	case "$xxx" in
2603	/*)
2604		echo $file is in $xxx.
2605		;;
2606	?:[\\/]*)
2607		echo $file is in $xxx.
2608		;;
2609	*)
2610		echo "I don't see $file out there, $say."
2611		say=either
2612		;;
2613	esac
2614done
2615case "$egrep" in
2616egrep)
2617	echo "Substituting grep for egrep."
2618	egrep=$grep
2619	_egrep=$grep
2620	;;
2621esac
2622case "$less" in
2623'')	;;
2624*)	if $less -R </dev/null >/dev/null 2>&1; then
2625	       echo "Substituting less -R for less."
2626	       less="$less -R"
2627	       _less=$less
2628	fi
2629	;;
2630esac
2631case "$ln" in
2632ln)
2633	echo "Substituting cp for ln."
2634	ln=$cp
2635	_ln=$cp
2636	;;
2637esac
2638case "$make" in
2639make)
2640	case "$gmake" in
2641	gmake)
2642	echo "I can't find make or gmake, and my life depends on it." >&4
2643	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2644	exit 1
2645	;;
2646	esac
2647	;;
2648esac
2649case "$gmake" in
2650gmake)	;;
2651*)	# We can't have osname yet.
2652	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2653		# Assume that gmake, if found, is definitely GNU make
2654		# and prefer it over the system make.
2655		echo "Substituting gmake for make."
2656		make=$gmake
2657		_make=$gmake
2658	fi
2659	;;
2660esac
2661case "$test" in
2662test)
2663	echo "Hopefully test is built into your sh."
2664	;;
2665*)
2666	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2667		echo "Using the test built into your sh."
2668		test=test
2669		_test=test
2670	fi
2671	;;
2672esac
2673case "$echo" in
2674echo)
2675	echo "Hopefully echo is built into your sh."
2676	;;
2677'') ;;
2678*)
2679	echo " "
2680echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2681	$echo $n "hi there$c" >foo1
2682	echo $n "hi there$c" >foo2
2683	if cmp foo1 foo2 >/dev/null 2>&1; then
2684		echo "They are compatible.  In fact, they may be identical."
2685	else
2686		case "$n" in
2687		'-n') n='' c='\c';;
2688		*) n='-n' c='';;
2689		esac
2690		cat <<FOO
2691They are not compatible!  You are probably running ksh on a non-USG system.
2692I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2693have echo built in and we may have to run some Bourne shell scripts.  That
2694means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2695
2696FOO
2697		$echo $n "The star should be here-->$c"
2698		$echo "*"
2699	fi
2700	$rm -f foo1 foo2
2701	;;
2702esac
2703
2704# This question was auctioned at YAPC::Europe-2007 in Vienna
2705# I never promised you could answer it. I only auctioned the question.
2706cat <<FOO
2707The following message is sponsored by
2708
2709  Dresden.pm<--The stars should be here.
2710
2711Dear Perl user, system administrator or package
2712maintainer, the Perl community sends greetings to
2713you. Do you (emblematical) greet back [Y/n]? n
2714
2715FOO
2716
2717: Check what type of C compiler we use
2718cat <<EOS >trygcc
2719$startsh
2720EOS
2721cat <<'EOSC' >>trygcc
2722case "$cc" in
2723'') ;;
2724*)  $rm -f try try.*
2725    $cat >try.c <<EOM
2726int main(int argc, char *argv[]) {
2727  return 0;
2728}
2729EOM
2730    if $cc -o try $ccflags $ldflags try.c; then
2731       :
2732    else
2733        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2734        despair=yes
2735        trygcc=yes
2736        case "$cc" in
2737        *gcc*) trygcc=no ;;
2738        esac
2739	# Skip this test because it gives a false match on output like:
2740	#    ./trygcc: line 23: cc: command not found
2741        # case "`$cc -v -c try.c 2>&1`" in
2742        # *gcc*) trygcc=no ;;
2743        # esac
2744        if $test X"$trygcc" = Xyes; then
2745            if gcc -o try -c try.c; then
2746                echo " "
2747                echo "You seem to have a working gcc, though." >&4
2748		# Switching compilers may undo the work of hints files.
2749		# The most common problem is -D_REENTRANT for threads.
2750		# This heuristic catches that case, but gets false positives
2751		# if -Dusethreads was not actually specified.  Better to
2752		# bail out here with a useful message than fail
2753		# mysteriously later. Should we perhaps just try to
2754		# re-invoke Configure -Dcc=gcc config_args ?
2755		if $test -f usethreads.cbu; then
2756			$cat >&4 <<EOM
2757
2758*** However, any setting of the C compiler flags (e.g. for thread support)
2759*** will be lost.  It may be necessary for you to restart Configure and
2760*** add -Dcc=gcc to your Configure command line.
2761
2762EOM
2763			rp="Would you like to go ahead and try gcc anyway?"
2764			dflt=n
2765		else
2766			rp="Would you like to use it?"
2767			dflt=y
2768		fi
2769                if $test -f myread; then
2770                    . ./myread
2771                else
2772                    if $test -f UU/myread; then
2773                        . ./UU/myread
2774                    else
2775                        echo "Cannot find myread, sorry.  Aborting." >&2
2776                        exit 1
2777                    fi
2778                fi
2779                case "$ans" in
2780                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2781                esac
2782            fi
2783        fi
2784    fi
2785    $rm -f try try.*
2786    ;;
2787esac
2788EOSC
2789
2790cat <<EOS >checkcc
2791$startsh
2792EOS
2793cat <<'EOSC' >>checkcc
2794case "$cc" in
2795'') ;;
2796*)  $rm -f try try.*
2797    $cat >try.c <<EOM
2798int main(int argc, char *argv[]) {
2799  return 0;
2800}
2801EOM
2802    if $cc -o try $ccflags $ldflags try.c; then
2803       :
2804    else
2805        if $test X"$despair" = Xyes; then
2806           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2807        fi
2808        $cat >&4 <<EOM
2809You need to find a working C compiler.
2810Either (purchase and) install the C compiler supplied by your OS vendor,
2811or for a free C compiler try http://gcc.gnu.org/
2812I cannot continue any further, aborting.
2813EOM
2814        exit 1
2815    fi
2816    $rm -f try try.*
2817    ;;
2818esac
2819EOSC
2820
2821: determine whether symbolic links are supported
2822echo " "
2823$touch blurfl
2824if $ln -s blurfl sym > /dev/null 2>&1 ; then
2825	echo "Symbolic links are supported." >&4
2826	lns="$ln -s"
2827else
2828	echo "Symbolic links are NOT supported." >&4
2829	lns="$ln"
2830fi
2831$rm -f blurfl sym
2832
2833: determine whether symbolic links are supported
2834echo " "
2835case "$lns" in
2836*"ln"*" -s")
2837	echo "Checking how to test for symbolic links..." >&4
2838	$lns blurfl sym
2839	if $test "X$issymlink" = X; then
2840		case "$newsh" in
2841		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2842		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2843		esac
2844		if test $? = 0; then
2845			issymlink="test -h"
2846		else
2847			echo "Your builtin 'test -h' may be broken." >&4
2848			case "$test" in
2849			/*)	;;
2850			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2851				for p in $pth
2852				do
2853					if test -f "$p/$test"; then
2854						test="$p/$test"
2855						break
2856					fi
2857				done
2858				;;
2859			esac
2860			case "$test" in
2861			/*)
2862				echo "Trying external '$test -h'." >&4
2863				issymlink="$test -h"
2864				if $test ! -h sym >/dev/null 2>&1; then
2865					echo "External '$test -h' is broken, too." >&4
2866					issymlink=''
2867				fi
2868				;;
2869			*)	issymlink='' ;;
2870			esac
2871		fi
2872	fi
2873	if $test "X$issymlink" = X; then
2874		if $test -L sym 2>/dev/null; then
2875			issymlink="$test -L"
2876			echo "The builtin '$test -L' worked." >&4
2877		fi
2878	fi
2879	if $test "X$issymlink" != X; then
2880		echo "You can test for symbolic links with '$issymlink'." >&4
2881	else
2882		echo "I do not know how you can test for symbolic links." >&4
2883	fi
2884	$rm -f blurfl sym
2885	;;
2886*)	echo "No symbolic links, so not testing for their testing..." >&4
2887	;;
2888esac
2889
2890: Make symlinks util
2891case "$mksymlinks" in
2892$define|true|[yY]*)
2893	case "$src" in
2894	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2895		exit 1
2896		;;
2897	*)	case "$lns:$issymlink" in
2898		*"ln"*" -s:"*"test -"?)
2899			echo "Creating the symbolic links..." >&4
2900			cd ..
2901			awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2902			awk 'NF == 1 {
2903				dir=".";
2904				file=$1 "";
2905			     }
2906			     NF == 2 {
2907				dir=$1 "";
2908				file=$2 "";
2909			     }
2910			     {
2911				 print "# dir = ", dir, "file = ", file
2912				 mf[dir] = mf[dir]" "source"/"dir"/"file;
2913			     } END {
2914				 for (d in mf) {
2915				     if (d != ".") { print("mkdir -p "d) }
2916				     print("ln -sf "mf[d]" "d);
2917				 }
2918			     }' source="$src" > UU/mksymlinks.$$
2919			sh UU/mksymlinks.$$
2920			rm UU/mksymlinks.$$
2921			# Sanity check 1.
2922			if test ! -d t/base; then
2923				echo "Failed to create the subdirectories.  Aborting." >&4
2924				exit 1
2925			fi
2926			# Sanity check 2.
2927			if test ! -f t/base/lex.t; then
2928				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2929				exit 1
2930			fi
2931			if test ! -f win32/win32.c; then
2932				echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2933				exit 1
2934			fi
2935			cd UU
2936			;;
2937		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2938			;;
2939		esac
2940		;;
2941	esac
2942	;;
2943esac
2944
2945: Check for Cross-Compilation
2946if $test "X$targethost" = "X"; then
2947    targethost=""
2948fi
2949if $test "X$targetenv" = "X"; then
2950    targetenv=""
2951fi
2952case "$usecrosscompile" in
2953$define|true|[yY]*)
2954	$echo "Cross-compiling..."
2955	croak=''
2956	case "$cc" in
2957	*-gcc*|*-g++*) # A cross-compiling gcc, probably.
2958	    # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2959	    # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2960	    targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2961	    ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2962	    # leave out ld, choosing it is more complex
2963	    nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2964	    ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2965	    # We are in a weird spot. Just before us, some values
2966	    # were 'saved', to be restored after the hints are
2967	    # run.  This means that the changes we made to ar,
2968	    # nm and ranlib will get reverted.
2969	    # To avoid that, we hijack the saving mechanism and
2970	    # have it save our new values.
2971	    for file in ar nm ranlib; do
2972		eval xxx=\$$file
2973		eval $file=$xxx$_exe
2974		eval _$file=$xxx
2975	    done
2976	;;
2977	esac
2978	case "$targetarch" in
2979	'') echo "Targetarch not defined." >&4; croak=y ;;
2980	*)  echo "Using targetarch $targetarch." >&4 ;;
2981	esac
2982	case "$targethost" in
2983	'') echo "Targethost not defined." >&4; croak=n ;;
2984	*)  echo "Using targethost $targethost." >&4
2985	esac
2986	locincpth=' '
2987	loclibpth=' '
2988	case "$croak" in
2989	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2990	esac
2991    : compile a host miniperl and generate_uudmap, unless we got passed them
2992    if $test "X$hostperl" = X; then
2993      echo "Building host miniperl and generate_uudmap binaries" >&4
2994      before_host=`pwd`
2995      cd ..
2996      cd $src
2997      src=`pwd`
2998      rm -rf $src/host
2999      mkdir $src/host
3000      cd $src/host
3001      $src/Configure -des -Dusedevel -Dmksymlinks
3002      $make miniperl
3003      case "$hostgenerate" in
3004      '') $make generate_uudmap
3005          hostgenerate=$src/host/generate_uudmap
3006          ;;
3007       "$undef") hostgenerate=''
3008          ;;
3009      esac
3010      hostperl=$src/host/miniperl
3011      cd $before_host
3012    fi
3013    hostosname=`$hostperl -le 'print $^O'`
3014    ;;
3015*)
3016    usecrosscompile="$undef"
3017    ;;
3018esac
3019
3020: Define -Dtargethost=somecomputer to run compiled tests on another machine
3021case "$targethost" in
3022    '') echo "Checking for cross-compile" >&4
3023    case "$usecrosscompile$multiarch" in
3024       *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3025         if [ -f Makefile ]; then
3026           echo " "
3027           echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3028         else
3029           echo "Configure done."
3030         fi
3031       exit 0
3032       ;;
3033     *) echo "No targethost for running compiler tests against defined, running locally" >&4
3034        run=''
3035        to=:
3036        from=:
3037        ;;
3038    esac
3039    ;;
3040    *) echo "Using targethost $targethost." >&4
3041	case "$src" in
3042	/*) run=$src/Cross/run
3043	    targetmkdir=$src/Cross/mkdir
3044	    to=$src/Cross/to
3045	    from=$src/Cross/from
3046	    ;;
3047	*)  pwd=`$test -f ../Configure & cd ..; pwd`
3048	    run=$pwd/Cross/run
3049	    targetmkdir=$pwd/Cross/mkdir
3050	    to=$pwd/Cross/to
3051	    from=$pwd/Cross/from
3052	    ;;
3053	esac
3054	case "$targetrun" in
3055	'') targetrun=ssh ;;
3056	esac
3057	case "$targetto" in
3058	'') targetto=scp ;;
3059	esac
3060	case "$targetfrom" in
3061	'') targetfrom=scp ;;
3062	esac
3063	run=$run-$targetrun
3064	to=$to-$targetto
3065	from=$from-$targetfrom
3066	case "$targetdir" in
3067	'')  targetdir=/tmp
3068	     echo "Guessing targetdir $targetdir." >&4
3069	     ;;
3070	esac
3071	case "$targetuser" in
3072	'')  targetuser=root
3073	     echo "Guessing targetuser $targetuser." >&4
3074	     ;;
3075	esac
3076	case "$targetport" in
3077	'')  targetport=22
3078	     echo "Guessing targetport $targetport." >&4
3079	     ;;
3080	esac
3081	case "$targetfrom" in
3082	scp)	q=-q ;;
3083	*)	q='' ;;
3084	esac
3085	case "$targetrun" in
3086	ssh|rsh)
3087	    cat >$run <<EOF
3088#!/bin/sh
3089env=''
3090case "\$1" in
3091-cwd)
3092  shift
3093  cwd=\$1
3094  shift
3095  ;;
3096esac
3097case "\$1" in
3098-env)
3099  shift
3100  env=\$1
3101  shift
3102  ;;
3103esac
3104case "\$cwd" in
3105'') cwd=$targetdir ;;
3106esac
3107exe=\$1
3108shift
3109$to \$exe
3110$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3111EOF
3112	    ;;
3113	adb)
3114	    $touch $run
3115	    ;;
3116	*)  echo "Unknown targetrun '$targetrun'" >&4
3117	    exit 1
3118	    ;;
3119	esac
3120	case "$targetmkdir" in
3121	*/Cross/mkdir)
3122	    cat >$targetmkdir <<EOF
3123#!/bin/sh
3124$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3125EOF
3126	    $chmod a+rx $targetmkdir
3127	    ;;
3128	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3129	    exit 1
3130	    ;;
3131	esac
3132	case "$targetto" in
3133	scp|rcp)
3134	    cat >$to <<EOF
3135#!/bin/sh
3136for f in \$@
3137do
3138  case "\$f" in
3139  /*)
3140    $targetmkdir \`dirname \$f\`
3141    $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3142    ;;
3143  *)
3144    $targetmkdir $targetdir/\`dirname \$f\`
3145    $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3146    ;;
3147  esac
3148done
3149exit 0
3150EOF
3151	    ;;
3152	cp) cat >$to <<EOF
3153#!/bin/sh
3154for f in \$@
3155do
3156  case "\$f" in
3157  /*)
3158    $mkdir -p $targetdir/\`dirname \$f\`
3159    $cp \$f $targetdir/\$f || exit 1
3160    ;;
3161  *)
3162    $targetmkdir $targetdir/\`dirname \$f\`
3163    $cp \$f $targetdir/\$f || exit 1
3164    ;;
3165  esac
3166done
3167exit 0
3168EOF
3169	    ;;
3170	*)  echo "Unknown targetto '$targetto'" >&4
3171	    exit 1
3172	    ;;
3173	esac
3174	case "$targetfrom" in
3175	scp|rcp)
3176	  cat >$from <<EOF
3177#!/bin/sh
3178for f in \$@
3179do
3180  $rm -f \$f
3181  $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3182done
3183exit 0
3184EOF
3185	    ;;
3186	cp) cat >$from <<EOF
3187#!/bin/sh
3188for f in \$@
3189do
3190  $rm -f \$f
3191  cp $targetdir/\$f . || exit 1
3192done
3193exit 0
3194EOF
3195	    ;;
3196	*)  echo "Unknown targetfrom '$targetfrom'" >&4
3197	    exit 1
3198	    ;;
3199	esac
3200	if $test ! -f $run; then
3201	    echo "Target 'run' script '$run' not found." >&4
3202	else
3203	    $chmod a+rx $run
3204	fi
3205	if $test ! -f $to; then
3206	    echo "Target 'to' script '$to' not found." >&4
3207	else
3208	    $chmod a+rx $to
3209	fi
3210	if $test ! -f $from; then
3211	    echo "Target 'from' script '$from' not found." >&4
3212	else
3213	    $chmod a+rx $from
3214	fi
3215	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3216	    exit 1
3217	fi
3218	cat >&4 <<EOF
3219Using '$run' for remote execution,
3220and '$from' and '$to'
3221for remote file transfer.
3222EOF
3223	;;
3224*)	run=''
3225	to=:
3226	from=:
3227	usecrosscompile="$undef"
3228	targetarch=''
3229	;;
3230esac
3231
3232: see whether [:lower:] and [:upper:] are supported character classes
3233echo " "
3234case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3235ABYZ-abyz)
3236	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3237	up='[:upper:]'
3238	low='[:lower:]'
3239	;;
3240*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3241	# (0xd9 and 0xe2), therefore that is a nice testing point.
3242	if test "X$up" = X -o "X$low" = X; then
3243	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3244	    rs) up='[A-Z]'
3245		low='[a-z]'
3246		;;
3247	    esac
3248	fi
3249	if test "X$up" = X -o "X$low" = X; then
3250	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3251	    rs) up='A-Z'
3252		low='a-z'
3253		;;
3254	    esac
3255	fi
3256	if test "X$up" = X -o "X$low" = X; then
3257	    case "`echo RS | od -x 2>/dev/null`" in
3258	    *D9E2*|*d9e2*)
3259		echo "Hey, this might be EBCDIC." >&4
3260		if test "X$up" = X -o "X$low" = X; then
3261		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3262		    rs) up='[A-IJ-RS-Z]'
3263			low='[a-ij-rs-z]'
3264			;;
3265		    esac
3266		fi
3267		if test "X$up" = X -o "X$low" = X; then
3268		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3269		    rs) up='A-IJ-RS-Z'
3270			low='a-ij-rs-z'
3271			;;
3272		    esac
3273		fi
3274		;;
3275	    esac
3276	fi
3277esac
3278case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3279rs)
3280    echo "Using $up and $low to convert case." >&4
3281    ;;
3282*)
3283    echo "I don't know how to translate letters from upper to lower case." >&4
3284    echo "Your tr is not acting any way I know of." >&4
3285    exit 1
3286    ;;
3287esac
3288: set up the translation script tr, must be called with ./tr of course
3289cat >tr <<EOSC
3290$startsh
3291case "\$1\$2" in
3292'[A-Z][a-z]') exec $tr '$up' '$low';;
3293'[a-z][A-Z]') exec $tr '$low' '$up';;
3294esac
3295exec $tr "\$@"
3296EOSC
3297chmod +x tr
3298$eunicefix tr
3299
3300: Try to determine whether config.sh was made on this system
3301case "$config_sh" in
3302'')
3303myuname=`$uname -a 2>/dev/null`
3304$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3305# Downcase everything to avoid ambiguity.
3306# Remove slashes and single quotes so we can use parts of this in
3307# directory and file names.
3308# Remove newlines so myuname is sane to use elsewhere.
3309# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3310# because the A-Z/a-z are not consecutive.
3311myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3312	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3313newmyuname="$myuname"
3314dflt=n
3315case "$knowitall" in
3316'')
3317	if test -f ../config.sh; then
3318		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3319			eval "`grep myuname= ../config.sh`"
3320		fi
3321		if test "X$myuname" = "X$newmyuname"; then
3322			dflt=y
3323		fi
3324	fi
3325	;;
3326*) dflt=y;;
3327esac
3328
3329: Get old answers from old config file if Configure was run on the
3330: same system, otherwise use the hints.
3331hint=default
3332cd ..
3333if test -f config.sh; then
3334	echo " "
3335	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3336	. UU/myread
3337	case "$ans" in
3338	n*|N*) echo "OK, I'll ignore it."
3339		mv config.sh config.sh.old
3340		myuname="$newmyuname"
3341		;;
3342	*)  echo "Fetching default answers from your old config.sh file..." >&4
3343		tmp_n="$n"
3344		tmp_c="$c"
3345		tmp_sh="$sh"
3346		. ./config.sh
3347		cp config.sh UU
3348		n="$tmp_n"
3349		c="$tmp_c"
3350		: Older versions did not always set $sh.  Catch re-use of such
3351		: an old config.sh.
3352		case "$sh" in
3353		'') sh="$tmp_sh" ;;
3354		esac
3355		hint=previous
3356		;;
3357	esac
3358fi
3359. ./UU/checkcc
3360if test ! -f config.sh; then
3361	$cat <<EOM
3362
3363First time through, eh?  I have some defaults handy for some systems
3364that need some extra help getting the Configure answers right:
3365
3366EOM
3367	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3368	dflt=''
3369	: Half the following guesses are probably wrong... If you have better
3370	: tests or hints, please send them to https://github.com/Perl/perl5/issues
3371	: The metaconfig authors would also appreciate a copy...
3372	$test -f /irix && osname=irix
3373	$test -f /xenix && osname=sco_xenix
3374	$test -f /dynix && osname=dynix
3375	$test -f /dnix && osname=dnix
3376	$test -f /lynx.os && osname=lynxos
3377	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3378	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3379	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3380	$test -f /bin/mips && /bin/mips && osname=mips
3381	$test -d /usr/apollo/bin && osname=apollo
3382	$test -f /etc/saf/_sactab && osname=svr4
3383	$test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3384	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3385	$test -f /sys/utilities/MultiView && osname=amigaos
3386	if $test -d /MachTen -o -d /MachTen_Folder; then
3387		osname=machten
3388		if $test -x /sbin/version; then
3389			osvers=`/sbin/version | $awk '{print $2}' |
3390			$sed -e 's/[A-Za-z]$//'`
3391		elif $test -x /usr/etc/version; then
3392			osvers=`/usr/etc/version | $awk '{print $2}' |
3393			$sed -e 's/[A-Za-z]$//'`
3394		else
3395			osvers="$2.$3"
3396		fi
3397	fi
3398
3399	$test -f /sys/posix.dll &&
3400		$test -f /usr/bin/what &&
3401		set X `/usr/bin/what /sys/posix.dll` &&
3402		$test "$3" = UWIN &&
3403		osname=uwin &&
3404		osvers="$5"
3405
3406	if $test -f $uname; then
3407		set X $myuname
3408		shift
3409
3410		case "$5" in
3411		fps*) osname=fps ;;
3412		mips*)
3413			case "$4" in
3414			umips) osname=umips ;;
3415			*) osname=mips ;;
3416			esac;;
3417		[23]100) osname=mips ;;
3418		i386*)
3419			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3420			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3421				osname='sco'
3422				osvers=$tmp
3423			elif $test -f /etc/kconfig; then
3424				osname=isc
3425				if test "$lns" = "$ln -s"; then
3426					osvers=4
3427				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3428					osvers=3
3429				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3430					osvers=2
3431				fi
3432			fi
3433			tmp=''
3434			;;
3435		pc*)
3436			if test -n "$DJGPP"; then
3437				osname=dos
3438				osvers=djgpp
3439			fi
3440			;;
3441		esac
3442
3443		case "$1" in
3444		aix) osname=aix
3445			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3446			case "$tmp" in
3447			# oslevel can fail with:
3448			# oslevel: Unable to acquire lock.
3449			*not\ found) osvers="$4"."$3" ;;
3450			'<3240'|'<>3240') osvers=3.2.0 ;;
3451			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3452			'=3250'|'>3250') osvers=3.2.5 ;;
3453			*) osvers=$tmp;;
3454			esac
3455			;;
3456		bitrig) osname=bitrig
3457			osvers="$3"
3458			;;
3459		bsd386) osname=bsd386
3460			osvers=`$uname -r`
3461			;;
3462		cygwin*) osname=cygwin
3463			osvers="$3"
3464			;;
3465		*dc.osx) osname=dcosx
3466			osvers="$3"
3467			;;
3468		dnix) osname=dnix
3469			osvers="$3"
3470			;;
3471		domainos) osname=apollo
3472			osvers="$3"
3473			;;
3474		dgux)	osname=dgux
3475			osvers="$3"
3476			;;
3477		dragonfly) osname=dragonfly
3478			osvers="$3"
3479			;;
3480		dynixptx*) osname=dynixptx
3481			osvers=`echo "$4"|sed 's/^v//'`
3482			;;
3483		freebsd) osname=freebsd
3484			osvers="$3" ;;
3485		genix)	osname=genix ;;
3486		gnu)	osname=gnu
3487			osvers="$3" ;;
3488		hp*)	osname=hpux
3489			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3490			;;
3491		irix*)	osname=irix
3492			case "$3" in
3493			4*) osvers=4 ;;
3494			5*) osvers=5 ;;
3495			*)	osvers="$3" ;;
3496			esac
3497			;;
3498		linux)	osname=linux
3499			case "$3" in
3500			*)	osvers="$3" ;;
3501			esac
3502			$test -f /system/lib/libandroid.so && osname=linux-android
3503			;;
3504		MiNT)	osname=mint
3505			;;
3506		minix)	osname=minix
3507			osvers=`$uname -r`
3508			;;
3509		netbsd*) osname=netbsd
3510			osvers="$3"
3511			;;
3512		news-os) osvers="$3"
3513			case "$3" in
3514			4*) osname=newsos4 ;;
3515			*) osname=newsos ;;
3516			esac
3517			;;
3518		nonstop-ux) osname=nonstopux ;;
3519		openbsd) osname=openbsd
3520			osvers="$3"
3521			;;
3522		os2)	osname=os2
3523			osvers="$4"
3524			;;
3525		POSIX-BC | posix-bc ) osname=posix-bc
3526			osvers="$3"
3527			;;
3528		powerux | power_ux | powermax_os | powermaxos | \
3529		powerunix | power_unix) osname=powerux
3530			osvers="$3"
3531			;;
3532		qnx) osname=qnx
3533			osvers="$4"
3534			;;
3535		solaris) osname=solaris
3536			case "$3" in
3537			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3538			*)	osvers="$3" ;;
3539			esac
3540			;;
3541		sunos) osname=sunos
3542			case "$3" in
3543			5*) osname=solaris
3544				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3545			*)	osvers="$3" ;;
3546			esac
3547			;;
3548		titanos) osname=titanos
3549			case "$3" in
3550			1*) osvers=1 ;;
3551			2*) osvers=2 ;;
3552			3*) osvers=3 ;;
3553			4*) osvers=4 ;;
3554			*)	osvers="$3" ;;
3555			esac
3556			;;
3557		ultrix) osname=ultrix
3558			osvers="$3"
3559			;;
3560		osf1|mls+)	case "$5" in
3561				alpha)
3562					osname=dec_osf
3563					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3564					case "$osvers" in
3565					[1-9].[0-9]*) ;;
3566					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3567					esac
3568					;;
3569			hp*)	osname=hp_osf1	;;
3570			mips)	osname=mips_osf1 ;;
3571			esac
3572			;;
3573		# UnixWare 7.1.2 is known as Open UNIX 8
3574		openunix|unixware) osname=svr5
3575			osvers="$4"
3576			;;
3577		uts)	osname=uts
3578			osvers="$3"
3579			;;
3580		vos) osvers="$3"
3581			;;
3582		$2) case "$osname" in
3583			*isc*) ;;
3584			*freebsd*) ;;
3585			svr*)
3586				: svr4.x or possibly later
3587				case "svr$3" in
3588				${osname}*)
3589					osname=svr$3
3590					osvers=$4
3591					;;
3592				esac
3593				case "$osname" in
3594				svr4.0)
3595					: Check for ESIX
3596					if test -f /stand/boot ; then
3597						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3598						if test -n "$INITPROG" -a -f "$INITPROG"; then
3599			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3600							if test -n "$isesix"; then
3601								osname=esix4
3602							fi
3603						fi
3604					fi
3605					;;
3606				esac
3607				;;
3608			*)	if test -f /etc/systemid; then
3609					osname=sco
3610					set `echo $3 | $sed 's/\./ /g'` $4
3611					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3612						osvers=$1.$2.$3
3613					elif $test -f $src/hints/sco_$1_$2.sh; then
3614						osvers=$1.$2
3615					elif $test -f $src/hints/sco_$1.sh; then
3616						osvers=$1
3617					fi
3618				else
3619					case "$osname" in
3620					'') : Still unknown.  Probably a generic Sys V.
3621						osname="sysv"
3622						osvers="$3"
3623						;;
3624					esac
3625				fi
3626				;;
3627			esac
3628			;;
3629		*)	case "$osname" in
3630			'') : Still unknown.  Probably a generic BSD.
3631				osname="$1"
3632				osvers="$3"
3633				;;
3634			esac
3635			;;
3636		esac
3637	else
3638		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3639			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3640			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3641				osname=news_os
3642			fi
3643			$rm -f UU/kernel.what
3644		elif test -d c:/. -o -n "$is_os2" ; then
3645			set X $myuname
3646			osname=os2
3647			osvers="$5"
3648		fi
3649	fi
3650
3651        case "$targetarch" in
3652        '') ;;
3653        *)  hostarch=$osname
3654            case "$targetarch" in
3655                nto*|*-nto-*)
3656                    # Will load qnx.sh, which should change osname to nto
3657                    osname=qnx
3658                    osvers=''
3659                    ;;
3660                *linux-android*)
3661                    # Catch arm-linux-androideabi, mipsel-linux-android,
3662                    # and i686-linux-android
3663                    osname=linux-android
3664                    osvers=''
3665                    ;;
3666                *linux*)
3667                    # Something like arm-linux-gnueabihf is really just
3668                    # plain linux.
3669                    osname=linux
3670                    osvers=''
3671                    ;;
3672                *solaris*|*sunos*)
3673                    osname=solaris
3674                    # XXX perhaps we should just assume
3675                    # osvers to be 2, or maybe take the value
3676                    # from targetarch. Using $run before the
3677                    # hints are run is somewhat icky.
3678                    set X `$run $uname -a 2>/dev/null`
3679                    shift
3680                    case "$3" in
3681                        5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3682                        *)  osvers="$3" ;;
3683                    esac
3684                    ;;
3685                *)
3686		    osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3687		    osvers=''
3688                ;;
3689            esac
3690            ;;
3691        esac
3692
3693	: Now look for a hint file osname_osvers, unless one has been
3694	: specified already.
3695	case "$hintfile" in
3696	''|' ')
3697		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3698		: Also try without trailing minor version numbers.
3699		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3700		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3701		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3702		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3703		case "$file" in
3704		'') dflt=none ;;
3705		*)  case "$osvers" in
3706			'') dflt=$file
3707				;;
3708			*)  if $test -f $src/hints/$file.sh ; then
3709					dflt=$file
3710				elif $test -f $src/hints/$xfile.sh ; then
3711					dflt=$xfile
3712				elif $test -f $src/hints/$xxfile.sh ; then
3713					dflt=$xxfile
3714				elif $test -f $src/hints/$xxxfile.sh ; then
3715					dflt=$xxxfile
3716				elif $test -f $src/hints/$xxxxfile.sh ; then
3717					dflt=$xxxxfile
3718				elif $test -f "$src/hints/${osname}.sh" ; then
3719					dflt="${osname}"
3720				else
3721					dflt=none
3722				fi
3723				;;
3724			esac
3725			;;
3726		esac
3727		if $test -f Policy.sh ; then
3728			case "$dflt" in
3729			*Policy*) ;;
3730			none) dflt="Policy" ;;
3731			*) dflt="Policy $dflt" ;;
3732			esac
3733		fi
3734		;;
3735	*)
3736		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3737		;;
3738	esac
3739
3740	if $test -f Policy.sh ; then
3741		$cat <<EOM
3742
3743There's also a Policy hint file available, which should make the
3744site-specific (policy) questions easier to answer.
3745EOM
3746
3747	fi
3748
3749	$cat <<EOM
3750
3751You may give one or more space-separated answers, or "none" if appropriate.
3752If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3753previous run of Configure, you may specify it as well as or instead of
3754OS-specific hints.  If hints are provided for your OS, you should use them:
3755although Perl can probably be built without hints on many platforms, using
3756hints often improve performance and may enable features that Configure can't
3757set up on its own. If there are no hints that match your OS, specify "none";
3758DO NOT give a wrong version or a wrong OS.
3759
3760EOM
3761
3762	rp="Which of these apply, if any?"
3763	. UU/myread
3764	tans=$ans
3765	for file in $tans; do
3766		if $test X$file = XPolicy -a -f Policy.sh; then
3767			. Policy.sh
3768			$cat Policy.sh >> UU/config.sh
3769		elif $test -f $src/hints/$file.sh; then
3770			. $src/hints/$file.sh
3771			$cat $src/hints/$file.sh >> UU/config.sh
3772		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3773			: nothing
3774		else
3775			: Give one chance to correct a possible typo.
3776			echo "$file.sh does not exist"
3777			dflt=$file
3778			rp="hint to use instead?"
3779			. UU/myread
3780			for file in $ans; do
3781				if $test -f "$src/hints/$file.sh"; then
3782					. $src/hints/$file.sh
3783					$cat $src/hints/$file.sh >> UU/config.sh
3784				elif $test X$ans = X -o X$ans = Xnone ; then
3785					: nothing
3786				else
3787					echo "$file.sh does not exist -- ignored."
3788				fi
3789			done
3790		fi
3791	done
3792
3793	hint=recommended
3794	: Remember our hint file for later.
3795	if $test -f "$src/hints/$file.sh" ; then
3796		hintfile="$file"
3797	else
3798		hintfile=''
3799	fi
3800fi
3801cd UU
3802;;
3803*)
3804	echo " "
3805	echo "Fetching default answers from $config_sh..." >&4
3806	tmp_n="$n"
3807	tmp_c="$c"
3808	cd ..
3809	cp $config_sh config.sh 2>/dev/null
3810	chmod +w config.sh
3811	. ./config.sh
3812	cd UU
3813	cp ../config.sh .
3814	n="$tmp_n"
3815	c="$tmp_c"
3816	hint=previous
3817	;;
3818esac
3819. ./optdef.sh
3820
3821: Restore computed paths
3822for file in $loclist $trylist; do
3823	eval $file="\$_$file"
3824done
3825
3826cat << EOM
3827
3828Configure uses the operating system name and version to set some defaults.
3829The default value is probably right if the name rings a bell. Otherwise,
3830since spelling matters for me, either accept the default or answer "none"
3831to leave it blank.
3832
3833EOM
3834case "$osname" in
3835	''|' ')
3836		case "$hintfile" in
3837		''|' '|none) dflt=none ;;
3838		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3839		esac
3840		;;
3841	*) dflt="$osname" ;;
3842esac
3843rp="Operating system name?"
3844. ./myread
3845case "$ans" in
3846none)  osname='' ;;
3847*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3848esac
3849echo " "
3850case "$osvers" in
3851	''|' ')
3852		case "$hintfile" in
3853		''|' '|none) dflt=none ;;
3854		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3855			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3856			case "$dflt" in
3857			''|' ') dflt=none ;;
3858			esac
3859			;;
3860		esac
3861		;;
3862	*) dflt="$osvers" ;;
3863esac
3864rp="Operating system version?"
3865. ./myread
3866case "$ans" in
3867none)  osvers='' ;;
3868*) osvers="$ans" ;;
3869esac
3870
3871
3872. ./posthint.sh
3873
3874: who configured the system
3875case "$cf_time" in
3876"")
3877	cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1` ;;
3878esac
3879case "$cf_by" in
3880"")
3881	cf_by=`(logname) 2>/dev/null`
3882	case "$cf_by" in
3883	"")
3884		cf_by=`(whoami) 2>/dev/null`
3885		case "$cf_by" in
3886		"") cf_by=unknown ;;
3887		esac ;;
3888	esac ;;
3889esac
3890
3891: decide how portable to be.  Allow command line overrides.
3892case "$d_portable" in
3893"$undef") ;;
3894*)	d_portable="$define" ;;
3895esac
3896
3897: set up shell script to do ~ expansion
3898cat >filexp <<EOSS
3899$startsh
3900: expand filename
3901case "\$1" in
3902 \~/*|\~)
3903	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3904	;;
3905 \~*)
3906	if $test -f /bin/csh; then
3907		/bin/csh -f -c "glob \$1"
3908		failed=\$?
3909		echo ""
3910		exit \$failed
3911	else
3912		name=\`$expr x\$1 : '..\([^/]*\)'\`
3913		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3914		if $test ! -d "\$dir"; then
3915			me=\`basename \$0\`
3916			echo "\$me: can't locate home directory for: \$name" >&2
3917			exit 1
3918		fi
3919		case "\$1" in
3920		*/*)
3921			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3922			;;
3923		*)
3924			echo \$dir
3925			;;
3926		esac
3927	fi
3928	;;
3929*)
3930	echo \$1
3931	;;
3932esac
3933EOSS
3934chmod +x filexp
3935$eunicefix filexp
3936
3937: now set up to get a file name
3938cat <<EOS >getfile
3939$startsh
3940EOS
3941cat <<'EOSC' >>getfile
3942tilde=''
3943fullpath=''
3944already=''
3945skip=''
3946none_ok=''
3947exp_file=''
3948nopath_ok=''
3949orig_rp="$rp"
3950orig_dflt="$dflt"
3951case "$gfpth" in
3952'') gfpth='.' ;;
3953esac
3954
3955case "$fn" in
3956*\(*)
3957	: getfile will accept an answer from the comma-separated list
3958	: enclosed in parentheses even if it does not meet other criteria.
3959	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3960	fn=`echo $fn | sed 's/(.*)//'`
3961	;;
3962esac
3963
3964case "$fn" in
3965*:*)
3966	loc_file=`expr $fn : '.*:\(.*\)'`
3967	fn=`expr $fn : '\(.*\):.*'`
3968	;;
3969esac
3970
3971case "$fn" in
3972*~*) tilde=true;;
3973esac
3974case "$fn" in
3975*/*) fullpath=true;;
3976esac
3977case "$fn" in
3978*+*) skip=true;;
3979esac
3980case "$fn" in
3981*n*) none_ok=true;;
3982esac
3983case "$fn" in
3984*e*) exp_file=true;;
3985esac
3986case "$fn" in
3987*p*) nopath_ok=true;;
3988esac
3989
3990case "$fn" in
3991*f*) type='File';;
3992*d*) type='Directory';;
3993*l*) type='Locate';;
3994esac
3995
3996what="$type"
3997case "$what" in
3998Locate) what='File';;
3999esac
4000
4001case "$exp_file" in
4002'')
4003	case "$d_portable" in
4004	"$define") ;;
4005	*) exp_file=true;;
4006	esac
4007	;;
4008esac
4009
4010cd ..
4011while test "$type"; do
4012	redo=''
4013	rp="$orig_rp"
4014	dflt="$orig_dflt"
4015	case "$tilde" in
4016	true) rp="$rp (~name ok)";;
4017	esac
4018	. UU/myread
4019	if test -f UU/getfile.ok && \
4020		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4021	then
4022		value="$ans"
4023		ansexp="$ans"
4024		break
4025	fi
4026	case "$ans" in
4027	none)
4028		value=''
4029		ansexp=''
4030		case "$none_ok" in
4031		true) type='';;
4032		esac
4033		;;
4034	*)
4035		case "$tilde" in
4036		'') value="$ans"
4037			ansexp="$ans";;
4038		*)
4039			value=`UU/filexp $ans`
4040			case $? in
4041			0)
4042				if test "$ans" != "$value"; then
4043					echo "(That expands to $value on this system.)"
4044				fi
4045				;;
4046			*) value="$ans";;
4047			esac
4048			ansexp="$value"
4049			case "$exp_file" in
4050			'') value="$ans";;
4051			esac
4052			;;
4053		esac
4054		case "$fullpath" in
4055		true)
4056			case "$ansexp" in
4057			/*) value="$ansexp" ;;
4058			[a-zA-Z]:/*) value="$ansexp" ;;
4059			*)
4060				redo=true
4061				case "$already" in
4062				true)
4063				echo "I shall only accept a full path name, as in /bin/ls." >&4
4064				echo "Use a ! shell escape if you wish to check pathnames." >&4
4065					;;
4066				*)
4067				echo "Please give a full path name, starting with slash." >&4
4068					case "$tilde" in
4069					true)
4070				echo "Note that using ~name is ok provided it expands well." >&4
4071						already=true
4072						;;
4073					esac
4074				esac
4075				;;
4076			esac
4077			;;
4078		esac
4079		case "$redo" in
4080		'')
4081			case "$type" in
4082			File)
4083				for fp in $gfpth; do
4084					if test "X$fp" = X.; then
4085					    pf="$ansexp"
4086					else
4087					    pf="$fp/$ansexp"
4088					fi
4089					if test -f "$pf"; then
4090						type=''
4091					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4092					then
4093						echo "($value is not a plain file, but that's ok.)"
4094						type=''
4095					fi
4096					if test X"$type" = X; then
4097					    value="$pf"
4098					    break
4099					fi
4100				done
4101				;;
4102			Directory)
4103				for fp in $gfpth; do
4104					if test "X$fp" = X.; then
4105					    dir="$ans"
4106					    direxp="$ansexp"
4107					else
4108					    dir="$fp/$ansexp"
4109					    direxp="$fp/$ansexp"
4110					fi
4111					if test -d "$direxp"; then
4112						type=''
4113						value="$dir"
4114						break
4115					fi
4116				done
4117				;;
4118			Locate)
4119				if test -d "$ansexp"; then
4120					echo "(Looking for $loc_file in directory $value.)"
4121					value="$value/$loc_file"
4122					ansexp="$ansexp/$loc_file"
4123				fi
4124				if test -f "$ansexp"; then
4125					type=''
4126				fi
4127				case "$nopath_ok" in
4128				true)	case "$value" in
4129					*/*) ;;
4130					*)	echo "Assuming $value will be in people's path."
4131						type=''
4132						;;
4133					esac
4134					;;
4135				esac
4136				;;
4137			esac
4138
4139			case "$skip" in
4140			true) type='';
4141			esac
4142
4143			case "$type" in
4144			'') ;;
4145			*)
4146				if test "$fastread" = yes; then
4147					dflt=y
4148				else
4149					dflt=n
4150				fi
4151				rp="$what $value doesn't exist.  Use that name anyway?"
4152				. UU/myread
4153				dflt=''
4154				case "$ans" in
4155				y*) type='';;
4156				*) echo " ";;
4157				esac
4158				;;
4159			esac
4160			;;
4161		esac
4162		;;
4163	esac
4164done
4165cd UU
4166ans="$value"
4167rp="$orig_rp"
4168dflt="$orig_dflt"
4169rm -f getfile.ok
4170test "X$gfpthkeep" != Xy && gfpth=""
4171EOSC
4172
4173: determine root of directory hierarchy where package will be installed.
4174case "$prefix" in
4175'')
4176	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4177	;;
4178*?/)
4179	dflt=`echo "$prefix" | sed 's/.$//'`
4180	;;
4181*)
4182	dflt="$prefix"
4183	;;
4184esac
4185$cat <<EOM
4186
4187By default, $package will be installed in $dflt/bin, manual pages
4188under $dflt/man, etc..., i.e. with $dflt as prefix for all
4189installation directories. Typically this is something like /usr/local.
4190If you wish to have binaries under /usr/bin but other parts of the
4191installation under /usr/local, that's ok: you will be prompted
4192separately for each of the installation directories, the prefix being
4193only used to set the defaults.
4194
4195EOM
4196fn=d~
4197rp='Installation prefix to use?'
4198. ./getfile
4199oldprefix=''
4200case "$prefix" in
4201'') ;;
4202*)
4203	case "$ans" in
4204	"$prefix") ;;
4205	*) oldprefix="$prefix";;
4206	esac
4207	;;
4208esac
4209prefix="$ans"
4210prefixexp="$ansexp"
4211
4212: allow them to override the AFS root
4213case "$afsroot" in
4214'')	afsroot=/afs ;;
4215*)	afsroot=$afsroot ;;
4216esac
4217
4218: is AFS running?
4219echo " "
4220case "$afs" in
4221$define|true)	afs=true ;;
4222$undef|false)	afs=false ;;
4223*)	if $test -d $afsroot; then
4224		afs=true
4225	else
4226		afs=false
4227	fi
4228	;;
4229esac
4230if $afs; then
4231	echo "AFS may be running... I'll be extra cautious then..." >&4
4232else
4233	echo "AFS does not seem to be running..." >&4
4234fi
4235
4236: determine installation prefix for where package is to be installed.
4237if $afs; then
4238$cat <<EOM
4239
4240Since you are running AFS, I need to distinguish the directory in which
4241files will reside from the directory in which they are installed (and from
4242which they are presumably copied to the former directory by occult means).
4243
4244EOM
4245	case "$installprefix" in
4246	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4247	*) dflt="$installprefix";;
4248	esac
4249else
4250$cat <<EOM
4251
4252In some special cases, particularly when building $package for distribution,
4253it is convenient to distinguish the directory in which files should be
4254installed from the directory ($prefix) in which they will
4255eventually reside.  For most users, these two directories are the same.
4256
4257EOM
4258	case "$installprefix" in
4259	'') dflt=$prefix ;;
4260	*) dflt=$installprefix;;
4261	esac
4262fi
4263fn=d~
4264rp='What installation prefix should I use for installing files?'
4265. ./getfile
4266installprefix="$ans"
4267installprefixexp="$ansexp"
4268
4269: Perform the prefixexp/installprefixexp correction if necessary
4270cat <<EOS >installprefix
4271$startsh
4272EOS
4273cat <<'EOSC' >>installprefix
4274: Change installation prefix, if necessary.
4275if $test X"$prefix" != X"$installprefix"; then
4276    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4277else
4278    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4279fi
4280EOSC
4281chmod +x installprefix
4282$eunicefix installprefix
4283
4284: Set variables such as privlib and privlibexp from the output of ./getfile
4285: performing the prefixexp/installprefixexp correction if necessary.
4286cat <<EOS >setprefixvar
4287$startsh
4288EOS
4289cat <<'EOSC' >>setprefixvar
4290eval "${prefixvar}=\"\$ans\""
4291eval "${prefixvar}exp=\"\$ansexp\""
4292. ./installprefix
4293EOSC
4294chmod +x setprefixvar
4295$eunicefix setprefixvar
4296
4297: set up the script used to warn in case of inconsistency
4298cat <<EOS >whoa
4299$startsh
4300EOS
4301cat <<'EOSC' >>whoa
4302dflt=y
4303case "$hint" in
4304    recommended)
4305	case "$hintfile" in
4306	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4307		;;
4308	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4309		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4310		;;
4311	esac
4312	;;
4313    *)	echo " "
4314	echo "*** WHOA THERE!!! ***" >&4
4315	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4316	;;
4317esac
4318rp="    Keep the $hint value?"
4319. ./myread
4320case "$ans" in
4321y) td=$was; tu=$was;;
4322esac
4323EOSC
4324
4325: function used to set '$1' to '$val'
4326setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4327case "$val$was" in
4328$define$undef) . ./whoa; eval "$var=\$td";;
4329$undef$define) . ./whoa; eval "$var=\$tu";;
4330*) eval "$var=$val";;
4331esac'
4332
4333: get the patchlevel
4334echo " "
4335echo "Getting the current patchlevel..." >&4
4336if $test -r $rsrc/patchlevel.h;then
4337	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4338	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4339	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4340	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4341	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4342	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4343	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4344else
4345	revision=0
4346	patchlevel=0
4347	subversion=0
4348	api_revision=0
4349	api_version=0
4350	api_subversion=0
4351	perl_patchlevel=0
4352	$echo "(You do not have patchlevel.h.  Eek.)"
4353fi
4354: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4355version_patchlevel_string="version $patchlevel subversion $subversion"
4356case "$perl_patchlevel" in
43570|'') ;;
4358*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4359    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4360    ;;
4361esac
4362
4363$echo "(You have $package $version_patchlevel_string.)"
4364
4365case "$osname" in
4366dos|vms)
4367	: XXX Should be a Configure test for double-dots in filenames.
4368	version=`echo $revision $patchlevel $subversion | \
4369		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4370	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4371		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4372	;;
4373*)
4374	version=`echo $revision $patchlevel $subversion | \
4375		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4376	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4377		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4378	;;
4379esac
4380: Special case the 5.005_xx maintenance series, which used 5.005
4381: without any subversion label as a subdirectory in $sitelib
4382if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4383	api_versionstring='5.005'
4384fi
4385
4386: Do we want threads support and if so, what type
4387case "$usethreads" in
4388$define|true|[yY]*)     dflt='y';;
4389*)     # Catch case where user specified ithreads or 5005threads but
4390       # forgot -Dusethreads (A.D. 4/2002)
4391       case "$useithreads$use5005threads" in
4392       *$define*)	dflt='y';;
4393       *)		dflt='n';;
4394       esac
4395       ;;
4396esac
4397cat <<EOM
4398
4399Perl can be built to offer a form of threading support on some systems
4400To do so, Configure can be run with -Dusethreads.
4401
4402Note that Perl built with threading support runs slightly slower
4403and uses slightly more memory than plain Perl.
4404
4405If this doesn't make any sense to you, just accept the default '$dflt'.
4406EOM
4407rp='Build a threading Perl?'
4408. ./myread
4409case "$ans" in
4410y|Y)    val="$define" ;;
4411*)      val="$undef" ;;
4412esac
4413set usethreads
4414eval $setvar
4415
4416if $test $patchlevel -lt 9; then
4417    case "$usethreads" in
4418    $define)
4419	: Default to ithreads unless overridden on command line or with
4420	: old config.sh
4421	dflt='y'
4422	case "$use5005threads" in
4423		$define|true|[yY]*)
4424			echo "5.005 threads are no longer supported"
4425			exit 1
4426		;;
4427	esac
4428	case "$useithreads" in
4429		$undef|false|[nN]*) dflt='n';;
4430	esac
4431	rp='Use the newer interpreter-based ithreads?'
4432	. ./myread
4433	case "$ans" in
4434	y|Y)    val="$define" ;;
4435	*)      val="$undef" ;;
4436	esac
4437	set useithreads
4438	eval $setvar
4439	: Now set use5005threads to the opposite value.
4440	case "$useithreads" in
4441	$define) val="$undef" ;;
4442	*) val="$define" ;;
4443	esac
4444	set use5005threads
4445	eval $setvar
4446	;;
4447    *)
4448	useithreads="$undef"
4449	use5005threads="$undef"
4450	;;
4451    esac
4452
4453    case "$useithreads$use5005threads" in
4454    "$define$define")
4455	$cat >&4 <<EOM
4456
4457You cannot have both the ithreads and the 5.005 threads enabled
4458at the same time.  Disabling the 5.005 threads since they are
4459much less stable than the ithreads.
4460
4461EOM
4462	use5005threads="$undef"
4463	;;
4464    esac
4465
4466else
4467: perl-5.9.x and later
4468
4469    if test X"$usethreads" = "X$define"; then
4470	case "$use5005threads" in
4471	    $define|true|[yY]*)
4472		$cat >&4 <<EOM
4473
44745.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4475
4476EOM
4477	    ;;
4478	esac
4479    fi
4480
4481    use5005threads="$undef"
4482    useithreads="$usethreads"
4483fi
4484
4485case "$d_oldpthreads" in
4486'')	: Configure tests would be welcome here.  For now, assume undef.
4487	val="$undef" ;;
4488*)	val="$d_oldpthreads" ;;
4489esac
4490set d_oldpthreads
4491eval $setvar
4492
4493
4494: Look for a hint-file generated 'call-back-unit'.  If the
4495: user has specified that a threading perl is to be built,
4496: we may need to set or change some other defaults.
4497if $test -f usethreads.cbu; then
4498    echo "Your platform has some specific hints regarding threaded builds, using them..."
4499    . ./usethreads.cbu
4500else
4501    case "$usethreads" in
4502	"$define"|true|[yY]*)
4503		$cat <<EOM
4504(Your platform does not have any specific hints for threaded builds.
4505 Assuming POSIX threads, then.)
4506EOM
4507	;;
4508    esac
4509fi
4510
4511: Check if multiplicity is required
4512cat <<EOM
4513
4514Perl can be built so that multiple Perl interpreters can coexist
4515within the same Perl executable.
4516EOM
4517
4518case "$useithreads" in
4519$define)
4520	cat <<EOM
4521This multiple interpreter support is required for interpreter-based threads.
4522EOM
4523	val="$define"
4524	;;
4525*)	case "$usemultiplicity" in
4526	$define|true|[yY]*)	dflt='y';;
4527	*) dflt='n';;
4528	esac
4529	echo " "
4530	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4531	rp='Build Perl for multiplicity?'
4532	. ./myread
4533	case "$ans" in
4534	y|Y)	val="$define" ;;
4535	*)      val="$undef" ;;
4536	esac
4537	;;
4538esac
4539set usemultiplicity
4540eval $setvar
4541
4542: Check if morebits is requested
4543case "$usemorebits" in
4544"$define"|true|[yY]*)
4545	use64bitint="$define"
4546	uselongdouble="$define"
4547	usemorebits="$define"
4548	;;
4549*)	usemorebits="$undef"
4550	;;
4551esac
4552
4553: Determine the C compiler to be used
4554echo " "
4555case "$cc" in
4556'') dflt=cc;;
4557*) dflt="$cc";;
4558esac
4559rp="Use which C compiler?"
4560. ./myread
4561cc="$ans"
4562
4563: See whether they have no cc but they do have gcc
4564. ./trygcc
4565if $test -f cc.cbu; then
4566    . ./cc.cbu
4567fi
4568. ./checkcc
4569
4570: make some quick guesses about what we are up against
4571echo " "
4572$echo $n "Hmm...  $c"
4573echo exit 1 >bsd
4574echo exit 1 >usg
4575echo exit 1 >v7
4576echo exit 1 >osf1
4577echo exit 1 >eunice
4578echo exit 1 >xenix
4579echo exit 1 >venix
4580echo exit 1 >os2
4581d_bsd="$undef"
4582$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4583if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4584then
4585	echo "Looks kind of like an OSF/1 system, but we'll see..."
4586	echo exit 0 >osf1
4587elif test `echo abc | $tr a-z A-Z` = Abc ; then
4588	xxx=`./loc addbib blurfl $pth`
4589	if $test -f $xxx; then
4590	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4591		echo exit 0 >bsd
4592		echo exit 0 >usg
4593	else
4594		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4595			echo "Looks kind of like an extended USG system, but we'll see..."
4596		else
4597			echo "Looks kind of like a USG system, but we'll see..."
4598		fi
4599		echo exit 0 >usg
4600	fi
4601elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4602	echo "Looks kind of like a BSD system, but we'll see..."
4603	d_bsd="$define"
4604	echo exit 0 >bsd
4605else
4606	echo "Looks kind of like a Version 7 system, but we'll see..."
4607	echo exit 0 >v7
4608fi
4609case "$eunicefix" in
4610*unixtovms*)
4611	$cat <<'EOI'
4612There is, however, a strange, musty smell in the air that reminds me of
4613something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4614EOI
4615	echo exit 0 >eunice
4616	d_eunice="$define"
4617: it so happens the Eunice I know will not run shell scripts in Unix format
4618	;;
4619*)
4620	echo " "
4621	echo "Congratulations.  You aren't running Eunice."
4622	d_eunice="$undef"
4623	;;
4624esac
4625: Detect OS2.  The p_ variable is set above in the Head.U unit.
4626: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4627: semicolon as a patch separator
4628case "$p_" in
4629:) ;;
4630*)
4631	$cat <<'EOI'
4632I have the feeling something is not exactly right, however...don't tell me...
4633lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4634(Or you may be running DOS with DJGPP.)
4635EOI
4636	echo exit 0 >os2
4637	;;
4638esac
4639if test -f /xenix; then
4640	echo "Actually, this looks more like a XENIX system..."
4641	echo exit 0 >xenix
4642	d_xenix="$define"
4643else
4644	echo " "
4645	echo "It's not Xenix..."
4646	d_xenix="$undef"
4647fi
4648chmod +x xenix
4649$eunicefix xenix
4650if test -f /venix; then
4651	echo "Actually, this looks more like a VENIX system..."
4652	echo exit 0 >venix
4653else
4654	echo " "
4655	if ./xenix; then
4656		: null
4657	else
4658		echo "Nor is it Venix..."
4659	fi
4660fi
4661chmod +x bsd usg v7 osf1 eunice xenix venix os2
4662$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4663$rm -f foo
4664
4665: Check if we are using GNU gcc and what its version is
4666echo " "
4667echo "Checking for GNU cc in disguise and/or its version number..." >&4
4668$cat >try.c <<EOM
4669#include <stdio.h>
4670int main() {
4671#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4672#ifdef __VERSION__
4673	printf("%s\n", __VERSION__);
4674#else
4675	printf("%s\n", "1");
4676#endif
4677#endif
4678	return(0);
4679}
4680EOM
4681if $cc -o try $ccflags $ldflags try.c; then
4682	gccversion=`$run ./try`
4683	case "$gccversion" in
4684	'') echo "You are not using GNU cc." ;;
4685	*)  echo "You are using GNU cc $gccversion."
4686	    ccname=gcc
4687	    ;;
4688	esac
4689else
4690	echo " "
4691	echo "*** WHOA THERE!!! ***" >&4
4692	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4693	case "$knowitall" in
4694	'')
4695	echo "    You'd better start hunting for one and let me know about it." >&4
4696		exit 1
4697		;;
4698	esac
4699fi
4700$rm -f try try.*
4701case "$gccversion" in
47021.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4703esac
4704case "$gccversion" in
4705'') gccosandvers='' ;;
4706*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4707   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4708   gccshortvers=''
4709   case "$gccosandvers" in
4710   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4711   $osname$osvers) ;; # looking good
4712   $osname*) cat <<EOM >&4
4713
4714*** WHOA THERE!!! ***
4715
4716    Your gcc has not been compiled for the exact release of
4717    your operating system ($gccosandvers versus $osname$osvers).
4718
4719    In general it is a good idea to keep gcc synchronized with
4720    the operating system because otherwise serious problems
4721    may ensue when trying to compile software, like Perl.
4722
4723    I'm trying to be optimistic here, though, and will continue.
4724    If later during the configuration and build icky compilation
4725    problems appear (headerfile conflicts being the most common
4726    manifestation), I suggest reinstalling the gcc to match
4727    your operating system release.
4728
4729EOM
4730      ;;
4731   *) gccosandvers='' ;; # failed to parse, better be silent
4732   esac
4733   ;;
4734esac
4735case "$ccname" in
4736'') ccname="$cc" ;;
4737esac
4738
4739# gcc 3.* complain about adding -Idirectories that they already know about,
4740# so we will take those off from locincpth.
4741case "$gccversion" in
47423.*)
4743    echo "main(){}">try.c
4744    for incdir in $locincpth; do
4745       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4746	     grep '^c[cp]p*[01]: warning: changing search order '`
4747       if test "X$warn" != X; then
4748	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4749       fi
4750    done
4751    $rm -f try try.*
4752esac
4753
4754# gcc 4.9 by default does some optimizations that break perl.
4755# see ticket 121505.
4756#
4757# The -fwrapv disables those optimizations (and probably others,) so
4758# for gcc 4.9 (and later, since the optimizations probably won't go
4759# away), add -fwrapv unless the user requests -fno-wrapv, which
4760# disables -fwrapv, or if the user requests -fsanitize=undefined,
4761# which turns the overflows -fwrapv ignores into runtime errors.
4762case "$gccversion" in
47634.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4764    case "$ccflags" in
4765    *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4766    *) ccflags="$ccflags -fwrapv" ;;
4767    esac
4768esac
4769
4770: What should the include directory be ?
4771: Use sysroot if set, so findhdr looks in the right place.
4772echo " "
4773$echo $n "Hmm...  $c"
4774dflt="$sysroot/usr/include"
4775incpath=''
4776mips_type=''
4777if $test -f /bin/mips && /bin/mips; then
4778	echo "Looks like a MIPS system..."
4779	$cat >usr.c <<'EOCP'
4780#ifdef SYSTYPE_BSD43
4781/bsd43
4782#endif
4783EOCP
4784	if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4785		dflt='/bsd43/usr/include'
4786		incpath='/bsd43'
4787		mips_type='BSD 4.3'
4788	else
4789		mips_type='System V'
4790	fi
4791	$rm -f usr.c usr.out
4792	echo "and you're compiling with the $mips_type compiler and libraries."
4793	xxx_prompt=y
4794	echo "exit 0" >mips
4795else
4796	echo "Doesn't look like a MIPS system."
4797	xxx_prompt=n
4798	echo "exit 1" >mips
4799fi
4800chmod +x mips
4801$eunicefix mips
4802case "$usrinc" in
4803'') ;;
4804*) dflt="$usrinc";;
4805esac
4806case "$xxx_prompt" in
4807y)	fn=d/
4808	echo " "
4809	rp='Where are the include files you want to use?'
4810	. ./getfile
4811	usrinc="$ans"
4812	;;
4813*)	usrinc="$dflt"
4814	;;
4815esac
4816
4817: see how we invoke the C preprocessor
4818echo " "
4819echo "Now, how can we feed standard input to your C preprocessor..." >&4
4820cat <<'EOT' >testcpp.c
4821#define ABC abc
4822#define XYZ xyz
4823ABC.XYZ
4824EOT
4825cd ..
4826if test ! -f cppstdin; then
4827	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4828		# AIX cc -E doesn't show the absolute headerfile
4829		# locations but we'll cheat by using the -M flag.
4830		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
4831	else
4832		echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4833	fi
4834else
4835	echo "Keeping your $hint cppstdin wrapper."
4836fi
4837chmod 755 cppstdin
4838wrapper=`pwd`/cppstdin
4839ok='false'
4840cd UU
4841
4842if $test "X$cppstdin" != "X" && \
4843	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4844	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4845then
4846	echo "You used to use $cppstdin $cppminus so we'll use that again."
4847	case "$cpprun" in
4848	'') echo "But let's see if we can live without a wrapper..." ;;
4849	*)
4850		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4851			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4852		then
4853			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4854			ok='true'
4855		else
4856			echo "(However, $cpprun $cpplast does not work, let's see...)"
4857		fi
4858		;;
4859	esac
4860else
4861	case "$cppstdin" in
4862	'') ;;
4863	*)
4864		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4865		;;
4866	esac
4867fi
4868
4869if $ok; then
4870	: nothing
4871elif echo 'Maybe "'"$cc"' -E" will work...'; \
4872	$cc -E <testcpp.c >testcpp.out 2>&1; \
4873	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4874	echo "Yup, it does."
4875	x_cpp="$cc $cppflags -E"
4876	x_minus='';
4877elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4878	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4879	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4880	echo "Yup, it does."
4881	x_cpp="$cc $cppflags -E"
4882	x_minus='-';
4883elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4884	$cc -P <testcpp.c >testcpp.out 2>&1; \
4885	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4886	echo "Yipee, that works!"
4887	x_cpp="$cc $cppflags -P"
4888	x_minus='';
4889elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4890	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4891	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4892	echo "At long last!"
4893	x_cpp="$cc $cppflags -P"
4894	x_minus='-';
4895elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4896	$cpp <testcpp.c >testcpp.out 2>&1; \
4897	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4898	echo "It works!"
4899	x_cpp="$cpp $cppflags"
4900	x_minus='';
4901elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4902	$cpp - <testcpp.c >testcpp.out 2>&1; \
4903	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4904	echo "Hooray, it works!  I was beginning to wonder."
4905	x_cpp="$cpp $cppflags"
4906	x_minus='-';
4907elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4908	$wrapper <testcpp.c >testcpp.out 2>&1; \
4909	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4910	x_cpp="$wrapper"
4911	x_minus=''
4912	echo "Eureka!"
4913else
4914	dflt=''
4915	rp="No dice.  I can't find a C preprocessor.  Name one:"
4916	. ./myread
4917	x_cpp="$ans"
4918	x_minus=''
4919	$x_cpp <testcpp.c >testcpp.out 2>&1
4920	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4921		echo "OK, that will do." >&4
4922	else
4923echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4924		exit 1
4925	fi
4926fi
4927
4928case "$ok" in
4929false)
4930	cppstdin="$x_cpp"
4931	cppminus="$x_minus"
4932	cpprun="$x_cpp"
4933	cpplast="$x_minus"
4934	set X $x_cpp
4935	shift
4936	case "$1" in
4937	"$cpp")
4938		echo "Perhaps can we force $cc -E using a wrapper..."
4939		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4940			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4941		then
4942			echo "Yup, we can."
4943			cppstdin="$wrapper"
4944			cppminus='';
4945		else
4946			echo "Nope, we'll have to live without it..."
4947		fi
4948		;;
4949	esac
4950	case "$cpprun" in
4951	"$wrapper")
4952		cpprun=''
4953		cpplast=''
4954		;;
4955	esac
4956	;;
4957esac
4958
4959case "$cppstdin" in
4960"$wrapper"|'cppstdin') ;;
4961*) $rm -f $wrapper;;
4962esac
4963$rm -f testcpp.c testcpp.out
4964
4965: Adjust cppfilter for path component separator
4966case "$osname" in
4967vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4968os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4969*)   cppfilter='' ;;
4970esac
4971
4972: Use gcc to determine libpth and incpth
4973# If using gcc or clang, we can get better values for libpth, incpth
4974# and usrinc directly from the compiler.
4975# Note that ccname for clang is also gcc.
4976case "$ccname" in
4977    gcc)
4978	$echo 'extern int foo;' > try.c
4979	set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4980	shift
4981	if $test $# -gt 0; then
4982	    incpth="$incpth $*"
4983	    incpth="`$echo $incpth|$sed 's/^ //'`"
4984	    for i in $*; do
4985		j="`$echo $i|$sed 's,/include$,/lib,'`"
4986		if $test -d $j; then
4987		    libpth="$libpth $j"
4988		fi
4989	    done
4990	    libpth="`$echo $libpth|$sed 's/^ //'`"
4991	    for xxx in $libpth $loclibpth $plibpth $glibpth; do
4992		if $test -d $xxx; then
4993		    case " $libpth " in
4994		    *" $xxx "*) ;;
4995		    *) libpth="$libpth $xxx";;
4996		    esac
4997		fi
4998	    done
4999	fi
5000	$rm -f try.c
5001	case "$usrinc" in
5002	'') for i in $incpth; do
5003		if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5004		    usrinc="$i"
5005		    break
5006		fi
5007	    done
5008	    ;;
5009	esac
5010
5011	case "$usecrosscompile" in
5012	$define|true|[yY]*)
5013	    case "$incpth" in
5014		'') echo "Incpth not defined." >&4; croak=y ;;
5015		*)  echo "Using incpth '$incpth'." >&4 ;;
5016	    esac
5017	    case "$libpth" in
5018		'') echo "Libpth not defined." >&4; croak=y ;;
5019		*)  echo "Using libpth '$libpth'." >&4 ;;
5020	    esac
5021	    case "$usrinc" in
5022		'') echo "Usrinc not defined." >&4; croak=y ;;
5023		*)  echo "Using usrinc $usrinc." >&4 ;;
5024	    esac
5025	    case "$croak" in
5026		y)
5027		if test "X$sysroot" = X; then
5028		    echo "Cannot continue, aborting." >&4; exit 1
5029		else
5030		    echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5031		fi
5032		;;
5033	    esac
5034	    ;;
5035	esac
5036    ;;
5037esac
5038
5039: Default value for incpth is just usrinc
5040case "$incpth" in
5041'') incpth="$usrinc";;
5042esac
5043
5044: Set private lib path
5045case "$plibpth" in
5046'') if ./mips; then
5047	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5048    fi;;
5049esac
5050case "$libpth" in
5051' ') dlist='';;
5052'') dlist="$loclibpth $plibpth $glibpth";;
5053*) dlist="$libpth";;
5054esac
5055
5056: Now check and see which directories actually exist, avoiding duplicates
5057for xxx in $dlist
5058do
5059    if $test -d $xxx || [ $xxx = $prefix/lib ]; then
5060		case " $libpth " in
5061		*" $xxx "*) ;;
5062		*) libpth="$libpth $xxx";;
5063		esac
5064    fi
5065done
5066$cat <<'EOM'
5067
5068Some systems have incompatible or broken versions of libraries.  Among
5069the directories listed in the question below, please remove any you
5070know not to be holding relevant libraries, and add any that are needed.
5071Say "none" for none.
5072
5073EOM
5074
5075if test "X$sysroot" != X; then
5076    $cat <<EOM
5077You have set sysroot to $sysroot, please supply the directories excluding sysroot
5078
5079EOM
5080fi
5081
5082case "$libpth" in
5083'') dflt='none';;
5084*)
5085	set X $libpth
5086	shift
5087	dflt=${1+"$@"}
5088	;;
5089esac
5090rp="Directories to use for library searches?"
5091. ./myread
5092case "$ans" in
5093none) libpth=' ';;
5094*) libpth="$ans";;
5095esac
5096
5097: compute shared library extension
5098case "$so" in
5099'')
5100	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5101		dflt='sl'
5102	else
5103		dflt='so'
5104	fi
5105	;;
5106*) dflt="$so";;
5107esac
5108$cat <<EOM
5109
5110On some systems, shared libraries may be available.  Answer 'none' if
5111you want to suppress searching of shared libraries for the remainder
5112of this configuration.
5113
5114EOM
5115rp='What is the file extension used for shared libraries?'
5116. ./myread
5117so="$ans"
5118
5119: Does target system insist that shared library basenames are unique
5120$cat << EOM
5121
5122Some dynamic loaders assume that the *basename* of shared library filenames
5123are globally unique.  We'll default this to undef as we assume your system
5124is not this weird. Set to defined if you're on one of them.
5125
5126EOM
5127
5128dflt='n'
5129rp='Make shared library basenames unique?'
5130. ./myread
5131case "$ans" in
5132y|Y) val="$define" ;;
5133*)   val="$undef"  ;;
5134esac
5135set d_libname_unique
5136eval $setvar
5137
5138: Define several unixisms.
5139: Hints files or command line option can be used to override them.
5140: The convoluted testing is in case hints files set either the old
5141: or the new name.
5142case "$_exe" in
5143'')	case "$exe_ext" in
5144	'')	;;
5145	*)	_exe="$exe_ext" ;;
5146	esac
5147	;;
5148esac
5149case "$_a" in
5150'')	case "$lib_ext" in
5151    '')	_a='.a';;
5152	*)	_a="$lib_ext" ;;
5153	esac
5154	;;
5155esac
5156case "$_o" in
5157'') case "$obj_ext" in
5158	'')	_o='.o';;
5159	*)	_o="$obj_ext";;
5160	esac
5161	;;
5162esac
5163case "$p_" in
5164'') case "$path_sep" in
5165	'')	p_=':';;
5166	*)	p_="$path_sep";;
5167	esac
5168	;;
5169esac
5170exe_ext=$_exe
5171lib_ext=$_a
5172obj_ext=$_o
5173path_sep=$p_
5174
5175rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5176
5177: Which makefile gets called first.  This is used by make depend.
5178case "$firstmakefile" in
5179'') firstmakefile='makefile';;
5180esac
5181
5182: Check is we will use socks
5183case "$usesocks" in
5184$define|true|[yY]*)	dflt='y';;
5185*) dflt='n';;
5186esac
5187cat <<EOM
5188
5189Perl can be built to use the SOCKS proxy protocol library.  To do so,
5190Configure must be run with -Dusesocks.  If you use SOCKS you also need
5191to use the PerlIO abstraction layer, this will be implicitly selected.
5192
5193If this doesn't make any sense to you, just accept the default '$dflt'.
5194EOM
5195rp='Build Perl for SOCKS?'
5196. ./myread
5197case "$ans" in
5198y|Y)	val="$define" ;;
5199*)      val="$undef" ;;
5200esac
5201set usesocks
5202eval $setvar
5203
5204: Check for uselongdouble support
5205case "$ccflags" in
5206*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5207esac
5208
5209case "$uselongdouble" in
5210$define|true|[yY]*)	dflt='y';;
5211*) dflt='n';;
5212esac
5213cat <<EOM
5214
5215Perl can be built to take advantage of long doubles which
5216(if available) may give more accuracy and range for floating point numbers.
5217
5218If this doesn't make any sense to you, just accept the default '$dflt'.
5219EOM
5220rp='Try to use long doubles if available?'
5221. ./myread
5222case "$ans" in
5223y|Y)	val="$define"	;;
5224*)      val="$undef"	;;
5225esac
5226set uselongdouble
5227eval $setvar
5228
5229case "$uselongdouble" in
5230true|[yY]*) uselongdouble="$define" ;;
5231esac
5232
5233: Look for a hint-file generated 'call-back-unit'.  If the
5234: user has specified that long doubles should be used,
5235: we may need to set or change some other defaults.
5236if $test -f uselongdouble.cbu; then
5237    echo "Your platform has some specific hints regarding long doubles, using them..."
5238    . ./uselongdouble.cbu
5239else
5240    case "$uselongdouble" in
5241	$define)
5242		$cat <<EOM
5243(Your platform does not have any specific hints for long doubles.)
5244EOM
5245	;;
5246    esac
5247fi
5248
5249: Check if quadmath is requested
5250case "$usequadmath" in
5251"$define"|true|[yY]*) usequadmath="$define" ;;
5252*)                    usequadmath="$undef"  ;;
5253esac
5254
5255: Fail if both uselongdouble and usequadmath are requested
5256case "$usequadmath:$uselongdouble" in
5257define:define)
5258	$cat <<EOM >&4
5259
5260*** You requested the use of the quadmath library and use
5261*** of long doubles.
5262***
5263*** Please select one or the other.
5264EOM
5265	exit 1
5266	;;
5267esac
5268
5269: Looking for optional libraries
5270echo " "
5271echo "Checking for optional libraries..." >&4
5272case "$libs" in
5273' '|'') dflt='';;
5274*) dflt="$libs";;
5275esac
5276case "$libswanted" in
5277'') libswanted='c_s';;
5278esac
5279case "$usesocks" in
5280"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5281esac
5282case "$usecbacktrace" in
5283"$define") libswanted="$libswanted bfd" ;;
5284esac
5285case "$usequadmath" in
5286"$define") libswanted="$libswanted quadmath" ;;
5287esac
5288libsfound=''
5289libsfiles=''
5290libsdirs=''
5291libspath=''
5292for thisdir in $libpth $xlibpth; do
5293  test -d $thisdir && libspath="$libspath $thisdir"
5294done
5295for thislib in $libswanted; do
5296	for thisdir in $libspath; do
5297	    xxx=''
5298	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5299		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5300	        $test -f "$xxx" && eval $libscheck
5301		$test -f "$xxx" && libstyle=shared
5302		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5303	        $test -f "$xxx" && eval $libscheck
5304		$test -f "$xxx" && libstyle=shared
5305	    fi
5306	    if test ! -f "$xxx"; then
5307		xxx=$thisdir/lib$thislib.$so
5308	        $test -f "$xxx" && eval $libscheck
5309		$test -f "$xxx" && libstyle=shared
5310	    fi
5311	    if test ! -f "$xxx"; then
5312		xxx=$thisdir/lib$thislib$_a
5313	        $test -f "$xxx" && eval $libscheck
5314		$test -f "$xxx" && libstyle=static
5315	    fi
5316	    if test ! -f "$xxx"; then
5317		xxx=$thisdir/$thislib$_a
5318	        $test -f "$xxx" && eval $libscheck
5319		$test -f "$xxx" && libstyle=static
5320	    fi
5321	    if test ! -f "$xxx"; then
5322		xxx=$thisdir/lib${thislib}_s$_a
5323	        $test -f "$xxx" && eval $libscheck
5324		$test -f "$xxx" && libstyle=static
5325		$test -f "$xxx" && thislib=${thislib}_s
5326	    fi
5327	    if test ! -f "$xxx"; then
5328		xxx=$thisdir/Slib$thislib$_a
5329	        $test -f "$xxx" && eval $libscheck
5330		$test -f "$xxx" && libstyle=static
5331	    fi
5332	    if $test -f "$xxx"; then
5333		case "$libstyle" in
5334		shared) echo "Found -l$thislib (shared)." ;;
5335		static) echo "Found -l$thislib." ;;
5336		*)      echo "Found -l$thislib ($libstyle)." ;;
5337		esac
5338		case " $dflt " in
5339		*"-l$thislib "*);;
5340		*) dflt="$dflt -l$thislib"
5341                   libsfound="$libsfound $xxx"
5342                   yyy=`basename $xxx`
5343                   libsfiles="$libsfiles $yyy"
5344                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5345                   case " $libsdirs " in
5346                   *" $yyy "*) ;;
5347                   *) libsdirs="$libsdirs $yyy" ;;
5348                   esac
5349		   ;;
5350		esac
5351		break
5352	    fi
5353	done
5354	if $test ! -f "$xxx"; then
5355	    echo "No -l$thislib."
5356	fi
5357done
5358set X $dflt
5359shift
5360dflt="$*"
5361case "$libs" in
5362'') dflt="$dflt";;
5363*) dflt="$libs";;
5364esac
5365case "$dflt" in
5366' '|'') dflt='none';;
5367esac
5368
5369$cat <<EOM
5370
5371In order to compile $package on your machine, a number of libraries
5372are usually needed.  Include any other special libraries here as well.
5373Say "none" for none.  The default list is almost always right.
5374EOM
5375
5376echo " "
5377rp="What libraries to use?"
5378. ./myread
5379case "$ans" in
5380none) libs=' ';;
5381*) libs="$ans";;
5382esac
5383
5384: determine optimization, if desired, or use for debug flag also
5385case "$optimize" in
5386' '|$undef) dflt='none';;
5387'') dflt='-O';;
5388*) dflt="$optimize";;
5389esac
5390$cat <<EOH
5391
5392By default, $package compiles with the -O flag to use the optimizer.
5393Alternately, you might want to use the symbolic debugger, which uses
5394the -g flag (on traditional Unix systems).  Either flag can be
5395specified here.  To use neither flag, specify the word "none".
5396
5397EOH
5398rp="What optimizer/debugger flag should be used?"
5399. ./myread
5400optimize="$ans"
5401case "$optimize" in
5402'none') optimize=" ";;
5403esac
5404
5405: Check what DEBUGGING is required from the command line
5406: -DEBUGGING      or -DDEBUGGING or
5407: -DEBUGGING=both			= -g + -DDEBUGGING
5408: -DEBUGGING=-g   or -Doptimize=-g	= -g
5409: -DEBUGGING=none or -UDEBUGGING	=
5410: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5411case "$EBUGGING" in
5412'')	;;
5413*)	DEBUGGING=$EBUGGING ;;
5414esac
5415
5416case "$DEBUGGING" in
5417-g|both|$define)
5418    case "$optimize" in
5419	*-g*) ;;
5420	*)    optimize="$optimize -g" ;;
5421    esac ;;
5422none|$undef)
5423    case "$optimize" in
5424	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5425		shift
5426		optimize="$*"
5427		;;
5428    esac ;;
5429esac
5430
5431dflt=''
5432case "$DEBUGGING" in
5433both|$define) dflt='-DDEBUGGING'
5434esac
5435
5436: argument order is deliberate, as the flag will start with - which set could
5437: think is an option
5438checkccflag='check=$1; flag=$2; callback=$3;
5439echo " ";
5440echo "Checking if your compiler accepts $flag" 2>&1;
5441[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5442echo "int main(void) { return 0; }" > gcctest.c;
5443if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5444    echo "Yes, it does." 2>&1;
5445    if $test -s gcctest.out ; then
5446        echo "But your platform does not like it:";
5447        cat gcctest.out;
5448    else
5449	case "$ccflags" in
5450	*$check*)
5451	    echo "Leaving current flags $ccflags alone." 2>&1
5452	    ;;
5453	*) dflt="$dflt $flag";
5454	    eval $callback
5455	    ;;
5456	esac
5457    fi
5458else
5459    echo "Nope, it does not, but that is ok." 2>&1;
5460fi
5461'
5462
5463: We will not override a previous value, but we might want to
5464: augment a hint file
5465case "$hint" in
5466default|recommended)
5467	case "$gccversion" in
5468	1.*) dflt="$dflt -fpcc-struct-return" ;;
5469	esac
5470	case "$optimize:$DEBUGGING" in
5471	*-g*:old) dflt="$dflt -DDEBUGGING";;
5472	esac
5473	case "$gccversion" in
5474	2.*) if $test -d /etc/conf/kconfig.d &&
5475			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5476		then
5477			# Interactive Systems (ISC) POSIX mode.
5478			dflt="$dflt -posix"
5479		fi
5480		;;
5481	esac
5482	case "$gccversion" in
5483	1.*) ;;
5484	2.[0-8]*) ;;
5485	?*)	set strict-aliasing -fno-strict-aliasing
5486		eval $checkccflag
5487		;;
5488	esac
5489	# For gcc, adding -pipe speeds up compilations for some, but apparently
5490	# some assemblers can't read from stdin.  (It also slows down compilations
5491	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5492	case "$gccversion" in
5493	?*)	set pipe -pipe
5494		eval $checkccflag
5495		;;
5496	esac
5497
5498	# on x86_64 (at least) we require an extra library (libssp) in the
5499	# link command line. This library is not named, so I infer that it is
5500	# an implementation detail that may change. Hence the safest approach
5501	# is to add the flag to the flags passed to the compiler at link time,
5502	# as that way the compiler can do the right implementation dependant
5503	# thing. (NWC)
5504	case "$osname" in
5505	amigaos) ;; # -fstack-protector builds but doesn't work
5506	*)	case "$gccversion" in
5507		?*)	set stack-protector-strong -fstack-protector-strong
5508			eval $checkccflag
5509			case "$dflt" in
5510			*-fstack-protector-strong*) ;; # It got added.
5511			*) # Try the plain/older -fstack-protector.
5512			   set stack-protector -fstack-protector
5513			   eval $checkccflag
5514			   ;;
5515			esac
5516			;;
5517		esac
5518		;;
5519	esac
5520	;;
5521esac
5522
5523case "$mips_type" in
5524*BSD*|'') inclwanted="$locincpth $usrinc";;
5525*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5526esac
5527for thisincl in $inclwanted; do
5528	if $test -d $thisincl; then
5529		if $test x$thisincl != x$usrinc; then
5530			case "$dflt" in
5531			*" -I$thisincl "*);;
5532			*) dflt="$dflt -I$thisincl ";;
5533			esac
5534		fi
5535	fi
5536done
5537
5538inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5539	xxx=true;
5540elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5541	xxx=true;
5542else
5543	xxx=false;
5544fi;
5545if $xxx; then
5546	case "$dflt" in
5547	*$2*);;
5548	*) dflt="$dflt -D$2";;
5549	esac;
5550fi'
5551
5552set signal.h LANGUAGE_C; eval $inctest
5553
5554case "$usesocks" in
5555$define)
5556	ccflags="$ccflags -DSOCKS"
5557	;;
5558esac
5559
5560case "$hint" in
5561default|recommended) dflt="$ccflags $dflt" ;;
5562*) dflt="$ccflags";;
5563esac
5564
5565case "$dflt" in
5566''|' ') dflt=none;;
5567esac
5568
5569$cat <<EOH
5570
5571Your C compiler may want other flags.  For this question you should include
5572-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5573but you should NOT include libraries or ld flags like -lwhatever.  If you
5574want $package to honor its debug switch, you should include -DDEBUGGING here.
5575Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5576
5577To use no flags, specify the word "none".
5578
5579EOH
5580set X $dflt
5581shift
5582dflt=${1+"$@"}
5583rp="Any additional cc flags?"
5584. ./myread
5585case "$ans" in
5586none) ccflags='';;
5587*) ccflags="$ans";;
5588esac
5589
5590: the following weeds options from ccflags that are of no interest to cpp
5591case "$cppflags" in
5592'') cppflags="$ccflags" ;;
5593*)  set X $ccflags; shift
5594    case " $cppflags " in
5595    *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5596    *) cppflags="$cppflags $ccflags" ;;
5597    esac
5598    ;;
5599esac
5600case "$gccversion" in
56011.*) cppflags="$cppflags -D__GNUC__"
5602esac
5603case "$mips_type" in
5604'');;
5605*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5606esac
5607case "$cppflags" in
5608'');;
5609*)
5610	echo " "
5611	echo "Let me guess what the preprocessor flags are..." >&4
5612	set X $cppflags
5613	shift
5614	cppflags=''
5615	$cat >cpp.c <<'EOM'
5616#define BLURFL foo
5617
5618BLURFL xx LFRULB
5619EOM
5620	previous=''
5621	for flag in $*
5622	do
5623		case "$flag" in
5624		-*) ftry="$flag";;
5625		*) ftry="$previous $flag";;
5626		esac
5627		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5628			>cpp1.out 2>/dev/null && \
5629			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5630			>cpp2.out 2>/dev/null && \
5631			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5632			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5633		then
5634			cppflags="$cppflags $ftry"
5635			previous=''
5636		else
5637			previous="$flag"
5638		fi
5639	done
5640	set X $cppflags
5641	shift
5642	cppflags=${1+"$@"}
5643	case "$cppflags" in
5644	*-*)  echo "They appear to be: $cppflags";;
5645	esac
5646	$rm -f cpp.c cpp?.out
5647	;;
5648esac
5649
5650: flags used in final linking phase
5651case "$ldflags" in
5652'') if ./venix; then
5653		dflt='-i -z'
5654	else
5655		dflt=''
5656	fi
5657	case "$ccflags" in
5658	*-posix*) dflt="$dflt -posix" ;;
5659	esac
5660	;;
5661*) dflt="$ldflags";;
5662esac
5663# See note above about -fstack-protector
5664case "$ccflags" in
5665*-fstack-protector-strong*)
5666	case "$dflt" in
5667	*-fstack-protector-strong*) ;; # Don't add it again
5668	*) dflt="$dflt -fstack-protector-strong" ;;
5669	esac
5670	;;
5671*-fstack-protector*)
5672	case "$dflt" in
5673	*-fstack-protector*) ;; # Don't add it again
5674	*) dflt="$dflt -fstack-protector" ;;
5675	esac
5676	;;
5677esac
5678
5679: Try to guess additional flags to pick up local libraries.
5680for thislibdir in $libpth; do
5681	case " $loclibpth " in
5682	*" $thislibdir "*)
5683		case "$dflt " in
5684		*"-L$thislibdir "*) ;;
5685		*)  dflt="$dflt -L$thislibdir" ;;
5686		esac
5687		;;
5688	esac
5689done
5690
5691case "$dflt" in
5692'') dflt='none' ;;
5693esac
5694
5695$cat <<EOH
5696
5697Your C linker may need flags.  For this question you should
5698include -L/whatever and any other flags used by the C linker, but you
5699should NOT include libraries like -lwhatever.
5700
5701Make sure you include the appropriate -L/path flags if your C linker
5702does not normally search all of the directories you specified above,
5703namely
5704	$libpth
5705To use no flags, specify the word "none".
5706
5707EOH
5708
5709rp="Any additional ld flags (NOT including libraries)?"
5710. ./myread
5711case "$ans" in
5712none) ldflags='';;
5713*) ldflags="$ans";;
5714esac
5715rmlist="$rmlist pdp11"
5716
5717: coherency check
5718echo " "
5719echo "Checking your choice of C compiler and flags for coherency..." >&4
5720$cat > try.c <<'EOF'
5721#include <stdio.h>
5722int main() { printf("Ok\n"); return(0); }
5723EOF
5724set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5725shift
5726$cat >try.msg <<'EOM'
5727I've tried to compile and run the following simple program:
5728
5729EOM
5730$cat try.c >> try.msg
5731
5732$cat >> try.msg <<EOM
5733
5734I used the command:
5735
5736	$*
5737	$run ./try
5738
5739and I got the following output:
5740
5741EOM
5742dflt=y
5743if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5744	if $sh -c "$run ./try " >>try.msg 2>&1; then
5745		xxx=`$run ./try`
5746		case "$xxx" in
5747		"Ok") dflt=n ;;
5748		*)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5749		esac
5750	else
5751		echo "The program compiled OK, but exited with status $?." >>try.msg
5752		rp="You have a problem.  Shall I abort Configure"
5753		dflt=y
5754	fi
5755else
5756	echo "I can't compile the test program." >>try.msg
5757	rp="You have a BIG problem.  Shall I abort Configure"
5758	dflt=y
5759fi
5760case "$dflt" in
5761y)
5762	$cat try.msg >&4
5763	case "$knowitall" in
5764	'')
5765		echo "(The supplied flags or libraries might be incorrect.)"
5766		;;
5767	*) dflt=n;;
5768	esac
5769	echo " "
5770	. ./myread
5771	case "$ans" in
5772	n*|N*) ;;
5773	*)	echo "Ok.  Stopping Configure." >&4
5774		exit 1
5775		;;
5776	esac
5777	;;
5778n) echo "OK, that should do.";;
5779esac
5780$rm_try gcctest gcctest.out
5781
5782: define a shorthand compile call
5783compile='
5784mc_file=$1;
5785shift;
5786case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5787echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5788exit 1;
5789fi;
5790esac;
5791$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5792: define a shorthand compile call for compilations that should be ok.
5793compile_ok='
5794mc_file=$1;
5795shift;
5796$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5797
5798: stub, used only to satisfy other units
5799i_stdlib='define'
5800
5801: check for lengths of integral types
5802echo " "
5803case "$intsize" in
5804'')
5805	echo "Checking to see how big your integers are..." >&4
5806	$cat >try.c <<EOCP
5807#include <stdio.h>
5808#$i_stdlib I_STDLIB
5809#ifdef I_STDLIB
5810#include <stdlib.h>
5811#endif
5812int main()
5813{
5814	printf("intsize=%d;\n", (int)sizeof(int));
5815	printf("longsize=%d;\n", (int)sizeof(long));
5816	printf("shortsize=%d;\n", (int)sizeof(short));
5817	exit(0);
5818}
5819EOCP
5820	set try
5821	if eval $compile_ok && $run ./try > /dev/null; then
5822		eval `$run ./try`
5823		echo "Your integers are $intsize bytes long."
5824		echo "Your long integers are $longsize bytes long."
5825		echo "Your short integers are $shortsize bytes long."
5826	else
5827		$cat >&4 <<EOM
5828!
5829Help! I can't compile and run the intsize test program: please enlighten me!
5830(This is probably a misconfiguration in your system or libraries, and
5831you really ought to fix it.  Still, I'll try anyway.)
5832!
5833EOM
5834		dflt=4
5835		rp="What is the size of an integer (in bytes)?"
5836		. ./myread
5837		intsize="$ans"
5838		dflt=$intsize
5839		rp="What is the size of a long integer (in bytes)?"
5840		. ./myread
5841		longsize="$ans"
5842		dflt=2
5843		rp="What is the size of a short integer (in bytes)?"
5844		. ./myread
5845		shortsize="$ans"
5846	fi
5847	;;
5848esac
5849$rm_try
5850
5851: check for long long
5852echo " "
5853echo "Checking to see if you have long long..." >&4
5854echo 'int main() { long long x = 7; return 0; }' > try.c
5855set try
5856if eval $compile; then
5857	val="$define"
5858	echo "You have long long."
5859else
5860	val="$undef"
5861	echo "You do not have long long."
5862fi
5863$rm_try
5864set d_longlong
5865eval $setvar
5866
5867: check for length of long long
5868case "${d_longlong}${longlongsize}" in
5869$define)
5870	echo " "
5871	echo "Checking to see how big your long longs are..." >&4
5872	$cat >try.c <<'EOCP'
5873#include <stdio.h>
5874int main()
5875{
5876    printf("%d\n", (int)sizeof(long long));
5877    return(0);
5878}
5879EOCP
5880	set try
5881	if eval $compile_ok; then
5882		longlongsize=`$run ./try`
5883		echo "Your long longs are $longlongsize bytes long."
5884	else
5885		dflt='8'
5886		echo " "
5887		echo "(I can't seem to compile the test program.  Guessing...)"
5888		rp="What is the size of a long long (in bytes)?"
5889		. ./myread
5890		longlongsize="$ans"
5891	fi
5892	if $test "X$longsize" = "X$longlongsize"; then
5893		echo "(That isn't any different from an ordinary long.)"
5894	fi
5895	;;
5896esac
5897$rm_try
5898
5899: determine filename position in cpp output
5900echo " "
5901echo "Computing filename position in cpp output for #include directives..." >&4
5902case "$osname" in
5903amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5904esac
5905case "$fieldn" in
5906'')
5907case "$osname" in
5908vos) testaccess=-e ;;
5909*)   testaccess=-r ;;
5910esac
5911echo '#include <stdio.h>' > foo.c
5912$cat >fieldn <<EOF
5913$startsh
5914$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5915$grep '^[ 	]*#.*stdio\.h' | \
5916while read cline; do
5917	pos=1
5918	set \$cline
5919	while $test \$# -gt 0; do
5920		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5921			echo "\$pos"
5922			exit 0
5923		fi
5924		shift
5925		pos=\`expr \$pos + 1\`
5926	done
5927done
5928EOF
5929chmod +x fieldn
5930fieldn=`./fieldn`
5931$rm -f foo.c fieldn
5932;;
5933esac
5934case $fieldn in
5935'') pos='???';;
59361) pos=first;;
59372) pos=second;;
59383) pos=third;;
5939*) pos="${fieldn}th";;
5940esac
5941echo "Your cpp writes the filename in the $pos field of the line."
5942
5943: locate header file
5944$cat >findhdr <<EOF
5945$startsh
5946wanted=\$1
5947name=''
5948for usrincdir in $incpth
5949do
5950	if test -f \$usrincdir/\$wanted; then
5951		echo "\$usrincdir/\$wanted"
5952		exit 0
5953	fi
5954done
5955awkprg='{ print \$$fieldn }'
5956echo "#include <\$wanted>" > foo\$\$.c
5957$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5958$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5959while read cline; do
5960	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5961	case "\$name" in
5962	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5963	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5964	*) exit 2;;
5965	esac;
5966done;
5967#
5968# status = 0: grep returned 0 lines, case statement not executed
5969# status = 1: headerfile found
5970# status = 2: while loop executed, no headerfile found
5971#
5972status=\$?
5973$rm -f foo\$\$.c;
5974if test \$status -eq 1; then
5975	exit 0;
5976fi
5977exit 1
5978EOF
5979chmod +x findhdr
5980
5981: define an alternate in-header-list? function
5982inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5983cont=true; xxf="echo \"<\$1> found.\" >&4";
5984case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5985*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5986esac;
5987case $# in 4) instead=instead;; *) instead="at last";; esac;
5988while $test "$cont"; do
5989	xxx=`./findhdr $1`
5990	var=$2; eval "was=\$$2";
5991	if $test "$xxx" && $test -r "$xxx";
5992	then eval $xxf;
5993	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5994		cont="";
5995	else eval $xxnf;
5996	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5997	set $yyy; shift; shift; yyy=$@;
5998	case $# in 0) cont="";;
5999	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6000		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6001	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
6002		xxnf="echo \"there is no <\$1>, ...\" >&4";;
6003	esac;
6004done;
6005while $test "$yyy";
6006do set $yyy; var=$2; eval "was=\$$2";
6007	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6008	set $yyy; shift; shift; yyy=$@;
6009done'
6010
6011: see if inttypes.h is available
6012: we want a real compile instead of Inhdr because some systems
6013: have an inttypes.h which includes non-existent headers
6014echo " "
6015$cat >try.c <<EOCP
6016#include <inttypes.h>
6017int main() {
6018	static int32_t foo32 = 0x12345678;
6019}
6020EOCP
6021set try
6022if eval $compile; then
6023	echo "<inttypes.h> found." >&4
6024	val="$define"
6025else
6026	echo "<inttypes.h> NOT found." >&4
6027	val="$undef"
6028fi
6029$rm_try
6030set i_inttypes
6031eval $setvar
6032
6033: check for int64_t
6034echo " "
6035echo "Checking to see if you have int64_t..." >&4
6036$cat >try.c <<EOCP
6037#include <sys/types.h>
6038#$i_inttypes I_INTTYPES
6039#ifdef I_INTTYPES
6040#include <inttypes.h>
6041#endif
6042int main() { int64_t x = 7; }
6043EOCP
6044set try
6045if eval $compile; then
6046	val="$define"
6047	echo "You have int64_t."
6048else
6049	val="$undef"
6050	echo "You do not have int64_t."
6051fi
6052$rm_try
6053set d_int64_t
6054eval $setvar
6055
6056: Check if 64bit ints have a quad type
6057echo " "
6058echo "Checking which 64-bit integer type we could use..." >&4
6059
6060case "$intsize" in
60618) val=int
6062   set quadtype
6063   eval $setvar
6064   val='"unsigned int"'
6065   set uquadtype
6066   eval $setvar
6067   quadkind=1
6068   ;;
6069*) case "$longsize" in
6070   8) val=long
6071      set quadtype
6072      eval $setvar
6073      val='"unsigned long"'
6074      set uquadtype
6075      eval $setvar
6076      quadkind=2
6077      ;;
6078   *) case "$d_longlong:$longlongsize" in
6079      define:8)
6080        val='"long long"'
6081        set quadtype
6082        eval $setvar
6083        val='"unsigned long long"'
6084        set uquadtype
6085        eval $setvar
6086        quadkind=3
6087        ;;
6088      *) case "$d_int64_t" in
6089         define)
6090           val=int64_t
6091           set quadtype
6092           eval $setvar
6093           val=uint64_t
6094           set uquadtype
6095           eval $setvar
6096           quadkind=4
6097           ;;
6098         esac
6099         ;;
6100      esac
6101      ;;
6102   esac
6103   ;;
6104esac
6105
6106case "$quadtype" in
6107'')	echo "Alas, no 64-bit integer types in sight." >&4
6108	d_quad="$undef"
6109	;;
6110*)	echo "We could use '$quadtype' for 64-bit integers." >&4
6111	d_quad="$define"
6112	;;
6113esac
6114
6115: Do we want 64bit support
6116case "$uselonglong" in
6117"$define"|true|[yY]*)
6118	cat <<EOM >&4
6119
6120*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6121EOM
6122	use64bitint="$define"
6123	;;
6124esac
6125case "$use64bits" in
6126"$define"|true|[yY]*)
6127	cat <<EOM >&4
6128
6129*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6130EOM
6131	use64bitint="$define"
6132	;;
6133esac
6134case "$use64bitints" in
6135"$define"|true|[yY]*)
6136	cat <<EOM >&4
6137
6138*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6139EOM
6140	use64bitint="$define"
6141	;;
6142esac
6143case "$use64bitsint" in
6144"$define"|true|[yY]*)
6145	cat <<EOM >&4
6146
6147*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6148EOM
6149	use64bitint="$define"
6150	;;
6151esac
6152case "$uselonglongs" in
6153"$define"|true|[yY]*)
6154	cat <<EOM >&4
6155
6156*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6157EOM
6158	use64bitint="$define"
6159	;;
6160esac
6161case "$use64bitsall" in
6162"$define"|true|[yY]*)
6163	cat <<EOM >&4
6164
6165*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6166EOM
6167	use64bitall="$define"
6168	;;
6169esac
6170
6171case "$ccflags" in
6172*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6173esac
6174case "$use64bitall" in
6175"$define"|true|[yY]*) use64bitint="$define" ;;
6176esac
6177
6178case "$longsize" in
61798) cat <<EOM
6180
6181You have natively 64-bit long integers.
6182EOM
6183   val="$define"
6184   ;;
6185*) case "$use64bitint" in
6186   "$define"|true|[yY]*) dflt='y';;
6187   *) dflt='n';;
6188   esac
6189   case "$d_quad" in
6190   "$define") ;;
6191   *) dflt='n' ;;
6192   esac
6193   cat <<EOM
6194
6195Perl can be built to take advantage of 64-bit integer types
6196on some systems.  To do so, Configure can be run with -Duse64bitint.
6197Choosing this option will most probably introduce binary incompatibilities.
6198
6199If this doesn't make any sense to you, just accept the default '$dflt'.
6200(The default has been chosen based on your configuration.)
6201EOM
6202   rp='Try to use 64-bit integers, if available?'
6203   . ./myread
6204   case "$ans" in
6205   [yY]*) val="$define" ;;
6206   *)     val="$undef"  ;;
6207   esac
6208   ;;
6209esac
6210set use64bitint
6211eval $setvar
6212
6213case "$use64bitall" in
6214"$define"|true|[yY]*) dflt='y' ;;
6215*) case "$longsize" in
6216   8) dflt='y' ;;
6217   *) dflt='n' ;;
6218   esac
6219   ;;
6220esac
6221cat <<EOM
6222
6223You may also choose to try maximal 64-bitness.  It means using as much
622464-bitness as possible on the platform.  This in turn means even more
6225binary incompatibilities.  On the other hand, your platform may not
6226have any more 64-bitness available than what you already have chosen.
6227
6228If this doesn't make any sense to you, just accept the default '$dflt'.
6229(The default has been chosen based on your configuration.)
6230EOM
6231rp='Try to use maximal 64-bit support, if available?'
6232. ./myread
6233case "$ans" in
6234[yY]*) val="$define" ;;
6235*)     val="$undef"  ;;
6236esac
6237set use64bitall
6238eval $setvar
6239case "$use64bitall" in
6240"$define")
6241	case "$use64bitint" in
6242	"$undef")
6243		cat <<EOM
6244
6245Since you have chosen a maximally 64-bit build, I'm also turning on
6246the use of 64-bit integers.
6247EOM
6248		use64bitint="$define" ;;
6249	esac
6250	;;
6251esac
6252
6253: Look for a hint-file generated 'call-back-unit'.  If the
6254: user has specified that a 64-bit perl is to be built,
6255: we may need to set or change some other defaults.
6256if $test -f use64bitint.cbu; then
6257	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6258	. ./use64bitint.cbu
6259fi
6260case "$use64bitint" in
6261"$define"|true|[yY]*)
6262	: This test was common to all the OpenBSD forks, and seems harmless for
6263	: other platforms:
6264	echo " "
6265	echo "Checking if your C library has broken 64-bit functions..." >&4
6266	cat >try.c <<EOCP
6267#include <stdio.h>
6268typedef $uquadtype myULL;
6269int main (void)
6270{
6271    struct {
6272	double d;
6273	myULL  u;
6274    } *p, test[] = {
6275	{4294967303.15, 4294967303ULL},
6276	{4294967294.2,  4294967294ULL},
6277	{4294967295.7,  4294967295ULL},
6278	{0.0, 0ULL}
6279    };
6280    for (p = test; p->u; p++) {
6281	myULL x = (myULL)p->d;
6282	if (x != p->u) {
6283	    printf("buggy\n");
6284	    return 0;
6285	}
6286    }
6287    printf("ok\n");
6288    return 0;
6289}
6290EOCP
6291	set try
6292	if eval $compile_ok; then
6293	    libcquad=`$run ./try`
6294	    echo "Your C library's 64-bit functions are $libcquad."
6295	else
6296	    echo "(I can't seem to compile the test program.)"
6297	    echo "Assuming that your C library's 64-bit functions are ok."
6298	    libcquad="ok"
6299	fi
6300	$rm_try
6301
6302	case "$libcquad" in
6303	    buggy*)
6304		cat >&4 <<EOM
6305
6306*** You have a C library with broken 64-bit functions.
6307*** 64-bit support does not work reliably in this configuration.
6308*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6309*** Cannot continue, aborting.
6310
6311EOM
6312		exit 1
6313		;;
6314	esac
6315	case "$longsize" in
6316	4) case "$archname64" in
6317	   '') archname64=64int ;;
6318	   esac
6319	   ;;
6320	esac
6321	;;
6322esac
6323
6324: Look for a hint-file generated 'call-back-unit'.  If the
6325: user has specified that a maximally 64-bit perl is to be built,
6326: we may need to set or change some other defaults.
6327if $test -f use64bitall.cbu; then
6328	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6329	. ./use64bitall.cbu
6330fi
6331case "$use64bitall" in
6332"$define"|true|[yY]*)
6333	case "$longsize" in
6334	4) case "$archname64" in
6335	   ''|64int) archname64=64all ;;
6336	   esac
6337	   ;;
6338	esac
6339	;;
6340esac
6341
6342case "$d_quad:$use64bitint" in
6343$undef:$define)
6344	cat >&4 <<EOF
6345
6346*** You have chosen to use 64-bit integers,
6347*** but none can be found.
6348*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6349*** Cannot continue, aborting.
6350
6351EOF
6352	exit 1
6353	;;
6354esac
6355
6356: Check if we are using the GNU C library
6357echo " "
6358echo "Checking for GNU C Library..." >&4
6359cat >try.c <<'EOCP'
6360/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6361   alone are insufficient to distinguish different versions, such as
6362   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6363   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6364*/
6365#include <stdio.h>
6366int main(void)
6367{
6368#ifdef __GLIBC__
6369#   ifdef __GLIBC_MINOR__
6370#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6371#           include <gnu/libc-version.h>
6372	    printf("%s\n",  gnu_get_libc_version());
6373#       else
6374	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6375#       endif
6376#   else
6377	printf("%d\n",  __GLIBC__);
6378#   endif
6379    return 0;
6380#else
6381    return 1;
6382#endif
6383}
6384EOCP
6385set try
6386if eval $compile_ok && $run ./try > glibc.ver; then
6387	val="$define"
6388	gnulibc_version=`$cat glibc.ver`
6389	echo "You are using the GNU C Library version $gnulibc_version"
6390else
6391	val="$undef"
6392	gnulibc_version=''
6393	echo "You are not using the GNU C Library"
6394fi
6395$rm_try glibc.ver
6396set d_gnulibc
6397eval $setvar
6398
6399: see if nm is to be used to determine whether a symbol is defined or not
6400case "$usenm" in
6401'')
6402	dflt=''
6403	case "$d_gnulibc" in
6404	"$define")
6405		echo " "
6406		echo "nm probably won't work on the GNU C Library." >&4
6407		dflt=n
6408		;;
6409	esac
6410	case "$dflt" in
6411	'')
6412		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6413			echo " "
6414			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6415			echo "'nm' won't be sufficient on this system." >&4
6416			dflt=n
6417		fi
6418		;;
6419	esac
6420	case "$dflt" in
6421	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6422		if $test $dflt -gt 20; then
6423			dflt=y
6424		else
6425			dflt=n
6426		fi
6427		;;
6428	esac
6429	;;
6430*)
6431	case "$usenm" in
6432	true|$define) dflt=y;;
6433	*) dflt=n;;
6434	esac
6435	;;
6436esac
6437$cat <<EOM
6438
6439I can use $nm to extract the symbols from your C libraries. This
6440is a time consuming task which may generate huge output on the disk (up
6441to 3 megabytes) but that should make the symbols extraction faster. The
6442alternative is to skip the 'nm' extraction part and to compile a small
6443test program instead to determine whether each symbol is present. If
6444you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6445this may be the best solution.
6446
6447You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6448
6449EOM
6450rp="Shall I use $nm to extract C symbols from the libraries?"
6451. ./myread
6452case "$ans" in
6453[Nn]*) usenm=false;;
6454*) usenm=true;;
6455esac
6456
6457runnm=$usenm
6458case "$reuseval" in
6459true) runnm=false;;
6460esac
6461
6462: nm options which may be necessary
6463case "$nm_opt" in
6464'') if $test -f /mach_boot; then
6465		nm_opt=''	# Mach
6466	elif $test -d /usr/ccs/lib; then
6467		nm_opt='-p'	# Solaris (and SunOS?)
6468	elif $test -f /dgux; then
6469		nm_opt='-p'	# DG-UX
6470	elif $test -f /lib64/rld; then
6471		nm_opt='-p'	# 64-bit Irix
6472	else
6473		nm_opt=''
6474	fi;;
6475esac
6476
6477: nm options which may be necessary for shared libraries but illegal
6478: for archive libraries.  Thank you, Linux.
6479case "$nm_so_opt" in
6480'')	case "$myuname" in
6481	*linux*|gnu*)
6482		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6483			nm_so_opt='--dynamic'
6484		fi
6485		;;
6486	esac
6487	;;
6488esac
6489
6490: Figure out where the libc is located
6491case "$runnm" in
6492true)
6493: get list of predefined functions in a handy place
6494echo " "
6495case "$libc" in
6496'') libc=unknown
6497	case "$libs" in
6498	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6499	esac
6500	;;
6501esac
6502case "$libs" in
6503'') ;;
6504*)  for thislib in $libs; do
6505	case "$thislib" in
6506	-lc|-lc_s)
6507		: Handle C library specially below.
6508		;;
6509	-l*)
6510		thislib=`echo $thislib | $sed -e 's/^-l//'`
6511		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6512			:
6513		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6514			:
6515		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6516			:
6517		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6518			:
6519		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6520			:
6521		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6522			:
6523		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6524			:
6525		else
6526			try=''
6527		fi
6528		libnames="$libnames $try"
6529		;;
6530	*) libnames="$libnames $thislib" ;;
6531	esac
6532	done
6533	;;
6534esac
6535xxx=normal
6536case "$libc" in
6537unknown)
6538	set /lib/libc.$so
6539	for xxx in $libpth; do
6540		$test -r $1 || set $xxx/libc.$so
6541		: The messy sed command sorts on library version numbers.
6542		$test -r $1 || \
6543			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6544			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6545				h
6546				s/[0-9][0-9]*/0000&/g
6547				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6548				G
6549				s/\n/ /' | \
6550			 $sort | $sed -e 's/^.* //'`
6551		eval set \$$#
6552	done
6553	$test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6554	$test -r $1 || set $sysroot/lib/libsys_s$_a
6555	;;
6556*)
6557	set blurfl
6558	;;
6559esac
6560if $test -r "$1"; then
6561	echo "Your (shared) C library seems to be in $1."
6562	libc="$1"
6563elif $test -r /lib/libc && $test -r /lib/clib; then
6564	echo "Your C library seems to be in both /lib/clib and /lib/libc."
6565	xxx=apollo
6566	libc='/lib/clib /lib/libc'
6567	if $test -r /lib/syslib; then
6568		echo "(Your math library is in /lib/syslib.)"
6569		libc="$libc /lib/syslib"
6570	fi
6571elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6572	echo "Your C library seems to be in $libc, as you said before."
6573elif $test -r $incpath/usr/lib/libc$_a; then
6574	libc=$incpath/usr/lib/libc$_a;
6575	echo "Your C library seems to be in $libc.  That's fine."
6576elif $test -r /lib/libc$_a; then
6577	libc=/lib/libc$_a;
6578	echo "Your C library seems to be in $libc.  You're normal."
6579else
6580	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6581		:
6582	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6583		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6584	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6585		:
6586	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6587		:
6588	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6589		:
6590	else
6591		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6592	fi
6593	if $test -r "$tans"; then
6594		echo "Your C library seems to be in $tans, of all places."
6595		libc=$tans
6596	else
6597		libc='blurfl'
6598	fi
6599fi
6600if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6601	dflt="$libc"
6602	cat <<EOM
6603
6604If the guess above is wrong (which it might be if you're using a strange
6605compiler, or your machine supports multiple models), you can override it here.
6606
6607EOM
6608else
6609	dflt=''
6610	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6611	cat >&4 <<EOM
6612I can't seem to find your C library.  I've looked in the following places:
6613
6614EOM
6615	$sed 's/^/	/' libpath
6616	cat <<EOM
6617
6618None of these seems to contain your C library. I need to get its name...
6619
6620EOM
6621fi
6622fn=f
6623rp='Where is your C library?'
6624. ./getfile
6625libc="$ans"
6626
6627echo " "
6628echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6629set X `cat libnames`
6630shift
6631xxx=files
6632case $# in 1) xxx=file; esac
6633echo "Extracting names from the following $xxx for later perusal:" >&4
6634echo " "
6635$sed 's/^/	/' libnames >&4
6636echo " "
6637$echo $n "This may take a while...$c" >&4
6638
6639for file in $*; do
6640	case $file in
6641	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6642	*) $nm $nm_opt $file 2>/dev/null;;
6643	esac
6644done >libc.tmp
6645
6646$echo $n ".$c"
6647$grep fprintf libc.tmp > libc.ptf
6648xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6649xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6650xxx='[ADTSIWi]'
6651if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6652	eval $xscan;\
6653	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654		eval $xrun
6655elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6656	eval $xscan;\
6657	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658		eval $xrun
6659elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6660	eval $xscan;\
6661	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662		eval $xrun
6663elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6664	eval $xscan;\
6665	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666		eval $xrun
6667elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6668	eval $xscan;\
6669	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670		eval $xrun
6671elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6672	eval $xscan;\
6673	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674		eval $xrun
6675elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6676				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
6677	eval $xscan;\
6678	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679		eval $xrun
6680elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6681	eval $xscan;\
6682	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683		eval $xrun
6684elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6685	eval $xscan;\
6686	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687		eval $xrun
6688elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6689	eval $xscan;\
6690	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691		eval $xrun
6692elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6693	eval $xscan;\
6694	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695		eval $xrun
6696elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6697	eval $xscan;\
6698	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699		eval $xrun
6700elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6701	eval $xscan;\
6702	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703		eval $xrun
6704elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6705	eval $xscan;\
6706	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6707		eval $xrun
6708else
6709	$nm -p $* 2>/dev/null >libc.tmp
6710	$grep fprintf libc.tmp > libc.ptf
6711	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6712		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6713	then
6714		nm_opt='-p'
6715		eval $xrun
6716	else
6717		echo " "
6718		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6719		com=''
6720		if $ar t $libc > libc.tmp && \
6721			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
6722		then
6723			for thisname in $libnames $libc; do
6724				$ar t $thisname >>libc.tmp
6725			done
6726			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6727			echo "Ok." >&4
6728		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6729			for thisname in $libnames $libc; do
6730				$ar tv $thisname >>libc.tmp
6731				emximp -o tmp.imp $thisname \
6732				    2>/dev/null && \
6733				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6734				    < tmp.imp >>libc.tmp
6735				$rm -f tmp.imp
6736			done
6737			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6738			echo "Ok." >&4
6739		else
6740			echo "$ar didn't seem to work right." >&4
6741			echo "Maybe this is a Cray...trying bld instead..." >&4
6742			if  bld t $libc | \
6743				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6744				$test -s libc.list
6745			then
6746				for thisname in $libnames; do
6747					bld t $libnames | \
6748					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6749					$ar t $thisname >>libc.tmp
6750				done
6751				echo "Ok." >&4
6752			else
6753				echo "That didn't work either.  Giving up." >&4
6754				exit 1
6755			fi
6756		fi
6757	fi
6758fi
6759nm_extract="$com"
6760case "$PASE" in
6761define)
6762    echo " "
6763    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6764    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6765    ;;
6766*)  if $test -f /lib/syscalls.exp; then
6767	echo " "
6768	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6769	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
6770		/lib/syscalls.exp >>libc.list
6771    fi
6772    ;;
6773esac
6774;;
6775esac
6776$rm -f libnames libpath
6777
6778: Check if we are using C++
6779echo " "
6780echo "Checking for C++..." >&4
6781$cat >try.c <<'EOCP'
6782#include <stdio.h>
6783int main(void)
6784{
6785#ifdef __cplusplus
6786    return 0;
6787#else
6788    return 1;
6789#endif
6790}
6791EOCP
6792set try
6793if eval $compile_ok && $run ./try; then
6794	val="$define"
6795	echo "You are using a C++ compiler."
6796else
6797	val="$undef"
6798	echo "You are not using a C++ compiler."
6799fi
6800$rm_try cplusplus$$
6801set d_cplusplus
6802eval $setvar
6803
6804: is a C symbol defined?
6805csym='tlook=$1;
6806case "$3" in
6807-v) tf=libc.tmp; tdc="";;
6808-a) tf=libc.tmp; tdc="[]";;
6809*) tlook="^$1\$"; tf=libc.list; tdc="()";;
6810esac;
6811case "$d_cplusplus" in
6812    $define)	extern_C="extern \"C\""	;;
6813    *)		extern_C="extern"	;;
6814esac;
6815tx=yes;
6816case "$reuseval-$4" in
6817true-) ;;
6818true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6819esac;
6820case "$tx" in
6821yes)
6822	tval=false;
6823	if $test "$runnm" = true; then
6824		if $contains $tlook $tf >/dev/null 2>&1; then
6825			tval=true;
6826		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6827			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;
6828			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6829			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6830			$rm_try;
6831		fi;
6832	else
6833		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;
6834		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6835		$rm_try;
6836	fi;
6837	;;
6838*)
6839	case "$tval" in
6840	$define) tval=true;;
6841	*) tval=false;;
6842	esac;
6843	;;
6844esac;
6845eval "$2=$tval"'
6846
6847: define an is-in-libc? function
6848inlibc='echo " "; td=$define; tu=$undef;
6849sym=$1; var=$2; eval "was=\$$2";
6850tx=yes;
6851case "$reuseval$was" in
6852true) ;;
6853true*) tx=no;;
6854esac;
6855case "$tx" in
6856yes)
6857	set $sym tres -f;
6858	eval $csym;
6859	case "$tres" in
6860	true)
6861		echo "$sym() found." >&4;
6862		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6863	*)
6864		echo "$sym() NOT found." >&4;
6865		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6866	esac;;
6867*)
6868	case "$was" in
6869	$define) echo "$sym() found." >&4;;
6870	*) echo "$sym() NOT found." >&4;;
6871	esac;;
6872esac'
6873
6874: check for length of double
6875echo " "
6876case "$doublesize" in
6877'')
6878	echo "Checking to see how big your double precision numbers are..." >&4
6879	$cat >try.c <<EOCP
6880#include <stdio.h>
6881#$i_stdlib I_STDLIB
6882#ifdef I_STDLIB
6883#include <stdlib.h>
6884#endif
6885int main()
6886{
6887    printf("%d\n", (int)sizeof(double));
6888    exit(0);
6889}
6890EOCP
6891	set try
6892	if eval $compile_ok; then
6893		doublesize=`$run ./try`
6894		echo "Your double is $doublesize bytes long."
6895	else
6896		dflt='8'
6897		echo "(I can't seem to compile the test program.  Guessing...)"
6898		rp="What is the size of a double precision number (in bytes)?"
6899		. ./myread
6900		doublesize="$ans"
6901	fi
6902	;;
6903esac
6904$rm_try
6905
6906: check for long doubles
6907echo " "
6908echo "Checking to see if you have long double..." >&4
6909echo 'int main() { long double x = 7.0; }' > try.c
6910set try
6911if eval $compile; then
6912	val="$define"
6913	echo "You have long double."
6914else
6915	val="$undef"
6916	echo "You do not have long double."
6917fi
6918$rm_try
6919set d_longdbl
6920eval $setvar
6921
6922: see if ldexpl exists
6923set ldexpl d_ldexpl
6924eval $inlibc
6925
6926: check for length of long double
6927case "${d_longdbl}${longdblsize}" in
6928$define)
6929	echo " "
6930	echo "Checking to see how big your long doubles are..." >&4
6931	$cat >try.c <<'EOCP'
6932#include <stdio.h>
6933int main()
6934{
6935	printf("%d\n", sizeof(long double));
6936}
6937EOCP
6938	set try
6939	set try
6940	if eval $compile; then
6941		longdblsize=`$run ./try`
6942		echo "Your long doubles are $longdblsize bytes long."
6943	else
6944		dflt='8'
6945		echo " "
6946		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6947		rp="What is the size of a long double (in bytes)?"
6948		. ./myread
6949		longdblsize="$ans"
6950	fi
6951	if $test "X$doublesize" = "X$longdblsize"; then
6952		echo "That isn't any different from an ordinary double."
6953		echo "I'll keep your setting anyway, but you may see some"
6954		echo "harmless compilation warnings."
6955	fi
6956	;;
6957esac
6958$rm_try
6959
6960$echo "Checking the kind of long doubles you have..." >&4
6961case "$d_longdbl" in
6962define)
6963$cat <<EOP >try.c
6964#$i_stdlib I_STDLIB
6965#define LONGDBLSIZE $longdblsize
6966#define DOUBLESIZE $doublesize
6967#include <float.h>
6968#ifdef I_STDLIB
6969#include <stdlib.h>
6970#endif
6971#include <stdio.h>
6972static const long double d = -0.1L;
6973int main() {
6974  unsigned const char* b = (unsigned const char*)(&d);
6975#if DOUBLESIZE == LONGDBLSIZE
6976  printf("0\n"); /* if it floats like double */
6977  exit(0);
6978#endif
6979#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6980  if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6981    /* IEEE 754 128-bit little-endian */
6982    printf("1\n");
6983    exit(0);
6984  }
6985  if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6986    /* IEEE 128-bit big-endian, e.g. solaris sparc */
6987    printf("2\n");
6988    exit(0);
6989  }
6990#endif
6991/* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6992 * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6993 * cannot be trusted. */
6994#if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6995  if (b[0] == 0xCD && b[9] == 0xBF) {
6996    /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6997     * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6998     * Also known as "extended precision". */
6999    printf("3\n");
7000    exit(0);
7001  }
7002  if (b[0] == 0xBF && b[9] == 0xCD) {
7003    /* Is there ever big-endian 80-bit, really?
7004     *
7005     * The Motorola 68881 had another "extended precision" format:
7006     * sign:1 exp:15 zero:16 integer:1 mantissa:63
7007     * for total of 96 bits of bytes.  The zero bits were unused.
7008     * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7009     * If it ever becomes relevant, this format should be allocated
7010     * a new doublekind code since it's quite different from the Intel x87.
7011     */
7012    printf("4\n");
7013    exit(0);
7014  }
7015#endif
7016#if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7017  /* software "double double", the 106 is 53+53.
7018   * but irix thinks it is 107. */
7019  if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7020    /* double double 128-bit fully little-endian,
7021     * little-endian doubles in little-endian order,
7022     * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7023    printf("5\n");
7024    exit(0);
7025  }
7026  if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7027    /* double double 128-bit fully big-endian,
7028     * big-endian doubles in big-endian order,
7029     * e.g. PPC/Power and MIPS:
7030     * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7031    printf("6\n");
7032    exit(0);
7033  }
7034  if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7035    /* double double 128-bit mixed endian.
7036     * little-endian doubles in big-endian order,
7037     * e.g. ppc64el,
7038     * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7039    printf("7\n");
7040    exit(0);
7041  }
7042  if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7043    /* double double 128-bit mixed endian,
7044     * big-endian doubles in little-endian order,
7045     * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7046    printf("8\n");
7047    exit(0);
7048  }
7049#endif
7050/* We are largely making this up because it may well be
7051 * that the VAX format H was never made available to C,
7052 * only to Fortran. */
7053#if LONGDBLSIZE == 16 && defined(__vax__)
7054  if (b[0] == 0xFD && b[15] == 0x99) {
7055    /* VAX format H, PDP-11 mixed endian. */
7056    printf("9\n");
7057    exit(0);
7058  }
7059#endif
7060  printf("-1\n"); /* unknown */
7061  exit(0);
7062}
7063EOP
7064set try
7065if eval $compile; then
7066    longdblkind=`$run ./try`
7067else
7068    longdblkind=-1
7069fi
7070;;
7071*) longdblkind=0 ;;
7072esac
7073case "$longdblkind" in
70740) echo "Your long doubles are doubles." >&4 ;;
70751) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
70762) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
70773) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
70784) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
70795) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
70806) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
70817) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
70828) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
70839) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7084*) echo "Cannot figure out your long double." >&4 ;;
7085esac
7086d_long_double_style_ieee=$undef
7087d_long_double_style_ieee_std=$undef
7088d_long_double_style_ieee_extended=$undef
7089d_long_double_style_ieee_doubledouble=$undef
7090d_long_double_style_vax=$undef
7091case "$longdblkind" in
70921|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7093esac
7094case "$longdblkind" in
70951|2) d_long_double_style_ieee_std=$define ;;
7096esac
7097case "$longdblkind" in
70983|4) d_long_double_style_ieee_extended=$define ;;
7099esac
7100case "$longdblkind" in
71015|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7102esac
7103case "$longdblkind" in
71049) d_long_double_style_vax=$define ;;
7105esac
7106$rm_try
7107
7108: determine the architecture name
7109echo " "
7110if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7111	tarch=`arch`"-$osname"
7112elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7113	if uname -m > tmparch 2>&1 ; then
7114		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7115			-e 's/$/'"-$osname/" tmparch`
7116	else
7117		tarch="$osname"
7118	fi
7119	$rm -f tmparch
7120else
7121	tarch="$osname"
7122fi
7123case "$myarchname" in
7124''|"$tarch") ;;
7125*)
7126	echo "(Your architecture name used to be $myarchname.)"
7127	archname=''
7128	;;
7129esac
7130case "$targetarch" in
7131'') ;;
7132*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7133esac
7134myarchname="$tarch"
7135case "$archname" in
7136'') dflt="$tarch";;
7137*) dflt="$archname";;
7138esac
7139rp='What is your architecture name'
7140. ./myread
7141archname="$ans"
7142
7143: optionally add API version to the architecture for versioned archlibs
7144case "$useversionedarchname" in
7145$define|true|[yY]*) dflt='y';;
7146*)                  dflt='n';;
7147esac
7148rp='Add the Perl API version to your archname?'
7149. ./myread
7150case "$ans" in
7151y|Y)	useversionedarchname="$define" ;;
7152*)      useversionedarchname="$undef" ;;
7153esac
7154case "$useversionedarchname" in
7155$define)
7156	case "$archname" in
7157	*-$api_versionstring)
7158		echo "...and architecture name already has -$api_versionstring" >&4
7159		;;
7160	*)
7161		archname="$archname-$api_versionstring"
7162		echo "...setting architecture name to $archname." >&4
7163		;;
7164	esac
7165	;;
7166esac
7167
7168case "$usethreads" in
7169$define)
7170	echo "Threads selected." >&4
7171	case "$archname" in
7172	*-thread*) echo "...and architecture name already has -thread." >&4
7173		;;
7174	*)      archname="$archname-thread"
7175		echo "...setting architecture name to $archname." >&4
7176		;;
7177	esac
7178	;;
7179esac
7180case "$usemultiplicity" in
7181$define)
7182	echo "Multiplicity selected." >&4
7183	case "$archname" in
7184	*-multi*) echo "...and architecture name already has -multi." >&4
7185		;;
7186	*)      archname="$archname-multi"
7187		echo "...setting architecture name to $archname." >&4
7188		;;
7189	esac
7190	;;
7191esac
7192case "$use64bitint$use64bitall" in
7193*"$define"*)
7194	case "$archname64" in
7195	'')
7196		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7197		;;
7198	*)
7199		case "$use64bitint" in
7200		"$define") echo "64 bit integers selected." >&4 ;;
7201		esac
7202		case "$use64bitall" in
7203		"$define") echo "Maximal 64 bitness selected." >&4 ;;
7204		esac
7205		case "$archname" in
7206		*-$archname64*) echo "...and architecture name already has $archname64." >&4
7207			;;
7208		*)      archname="$archname-$archname64"
7209			echo "...setting architecture name to $archname." >&4
7210			;;
7211		esac
7212		;;
7213	esac
7214esac
7215case "$uselongdouble" in
7216$define)
7217	echo "Long doubles selected." >&4
7218	case "$longdblsize" in
7219	$doublesize)
7220		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7221		;;
7222	*)
7223		case "$archname" in
7224		*-ld*) echo "...and architecture name already has -ld." >&4
7225			;;
7226		*)      archname="$archname-ld"
7227			echo "...setting architecture name to $archname." >&4
7228			;;
7229		esac
7230		;;
7231	esac
7232	;;
7233esac
7234case "$usequadmath" in
7235$define)
7236	echo "quadmath selected." >&4
7237	case "$archname" in
7238	*-quadmath*) echo "...and architecture name already has -quadmath." >&4
7239		;;
7240	*)      archname="$archname-quadmath"
7241		echo "...setting architecture name to $archname." >&4
7242		;;
7243	esac
7244	;;
7245esac
7246if $test -f archname.cbu; then
7247	echo "Your platform has some specific hints for architecture name, using them..."
7248	. ./archname.cbu
7249fi
7250
7251: set the prefixit variable, to compute a suitable default value
7252prefixit='case "$3" in
7253""|none)
7254	case "$oldprefix" in
7255	"") eval "$1=\"\$$2\"";;
7256	*)
7257		case "$3" in
7258		"") eval "$1=";;
7259		none)
7260			eval "tp=\"\$$2\"";
7261			case "$tp" in
7262			""|" ") eval "$1=\"\$$2\"";;
7263			*) eval "$1=";;
7264			esac;;
7265		esac;;
7266	esac;;
7267*)
7268	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7269	case "$tp" in
7270	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7271	/*-$oldprefix/*|\~*-$oldprefix/*)
7272		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7273	*) eval "$1=\"\$$2\"";;
7274	esac;;
7275esac'
7276
7277: determine installation style
7278: For now, try to deduce it from prefix unless it is already set.
7279: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7280case "$installstyle" in
7281'')	case "$prefix" in
7282		*perl*) dflt='lib';;
7283		*) dflt='lib/perl5' ;;
7284	esac
7285	;;
7286*)	dflt="$installstyle" ;;
7287esac
7288: Probably not worth prompting for this since we prompt for all
7289: the directories individually, and the prompt would be too long and
7290: confusing anyway.
7291installstyle=$dflt
7292
7293: determine where public executables go
7294echo " "
7295set dflt bin bin
7296eval $prefixit
7297fn=d~
7298rp='Pathname where the public executables will reside?'
7299. ./getfile
7300if $test "X$ansexp" != "X$binexp"; then
7301	installbin=''
7302fi
7303prefixvar=bin
7304: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7305: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7306:     this via initialinstalllocation
7307. ./setprefixvar
7308
7309case "$userelocatableinc" in
7310$define|true|[yY]*)	dflt='y' ;;
7311*)			dflt='n' ;;
7312esac
7313cat <<EOM
7314
7315Would you like to build Perl so that the installation is relocatable, so that
7316library paths in @INC are determined relative to the path of the perl binary?
7317This is not advised for system Perl installs, or if you need to run setid
7318scripts or scripts under taint mode.
7319
7320If this doesn't make any sense to you, just accept the default '$dflt'.
7321EOM
7322rp='Use relocatable @INC?'
7323. ./myread
7324case "$ans" in
7325y|Y)	val="$define" ;;
7326*)	val="$undef"  ;;
7327esac
7328set userelocatableinc
7329eval $setvar
7330
7331initialinstalllocation="$binexp"
7332: Default prefix is now "up one level from where the binaries are"
7333case "$userelocatableinc" in
7334$define|true|[yY]*)
7335    bin=".../"
7336    binexp=".../"
7337    prefix=".../.."
7338    prefixexp=".../.."
7339    installprefixexp=".../.."
7340    ;;
7341esac
7342
7343: determine where private library files go
7344: Usual default is /usr/local/lib/perl5/$version.
7345: Also allow things like /opt/perl/lib/$version, since
7346: /opt/perl/lib/perl5... would be redundant.
7347: The default "style" setting is made in installstyle.U
7348case "$installstyle" in
7349*lib/perl5*) set dflt privlib lib/$package/$version ;;
7350*)	 set dflt privlib lib/$version ;;
7351esac
7352eval $prefixit
7353$cat <<EOM
7354
7355There are some auxiliary files for $package that need to be put into a
7356private library directory that is accessible by everyone.
7357
7358EOM
7359fn=$binexp
7360fn=d~+
7361rp='Pathname where the private library files will reside?'
7362. ./getfile
7363prefixvar=privlib
7364. ./setprefixvar
7365
7366: set the prefixup variable, to restore leading tilda escape
7367prefixup='case "$prefixexp" in
7368"$prefix") ;;
7369*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7370esac'
7371
7372: determine where public architecture dependent libraries go
7373set archlib archlib
7374eval $prefixit
7375: privlib default is /usr/local/lib/$package/$version
7376: archlib default is /usr/local/lib/$package/$version/$archname
7377: privlib may have an optional trailing /share.
7378tdflt=`echo $privlib | $sed 's,/share$,,'`
7379tdflt=$tdflt/$archname
7380case "$archlib" in
7381'')	dflt=$tdflt
7382	;;
7383*)	dflt="$archlib"
7384    ;;
7385esac
7386$cat <<EOM
7387
7388$spackage contains architecture-dependent library files.  If you are
7389sharing libraries in a heterogeneous environment, you might store
7390these files in a separate location.  Otherwise, you can just include
7391them with the rest of the public library files.
7392
7393EOM
7394fn=$binexp
7395fn=d+~
7396rp='Where do you want to put the public architecture-dependent libraries?'
7397. ./getfile
7398prefixvar=archlib
7399. ./setprefixvar
7400if $test X"$archlib" = X"$privlib"; then
7401	d_archlib="$undef"
7402else
7403	d_archlib="$define"
7404fi
7405
7406: see if setuid scripts can be secure
7407$cat <<EOM
7408
7409Some kernels have a bug that prevents setuid #! scripts from being
7410secure.  Some sites have disabled setuid #! scripts because of this.
7411
7412First let's decide if your kernel supports secure setuid #! scripts.
7413(If setuid #! scripts would be secure but have been disabled anyway,
7414don't say that they are secure if asked.)
7415
7416EOM
7417
7418val="$undef"
7419if $test -d /dev/fd; then
7420	echo "#!$ls" >reflect
7421	chmod +x,u+s reflect
7422	./reflect >flect 2>&1
7423	if $contains "/dev/fd" flect >/dev/null; then
7424		echo "Congratulations, your kernel has secure setuid scripts!" >&4
7425		val="$define"
7426	else
7427		$cat <<EOM
7428If you are not sure if they are secure, I can check but I'll need a
7429username and password different from the one you are using right now.
7430If you don't have such a username or don't want me to test, simply
7431enter 'none'.
7432
7433EOM
7434		rp='Other username to test security of setuid scripts with?'
7435		dflt='none'
7436		. ./myread
7437		case "$ans" in
7438		n|none)
7439			case "$d_suidsafe" in
7440			'')	echo "I'll assume setuid scripts are *not* secure." >&4
7441				dflt=n;;
7442			"$undef")
7443				echo "Well, the $hint value is *not* secure." >&4
7444				dflt=n;;
7445			*)	echo "Well, the $hint value *is* secure." >&4
7446				dflt=y;;
7447			esac
7448			;;
7449		*)
7450			$rm -f reflect flect
7451			echo "#!$ls" >reflect
7452			chmod +x,u+s reflect
7453			echo >flect
7454			chmod a+w flect
7455			echo '"su" will (probably) prompt you for '"$ans's password."
7456			su $ans -c './reflect >flect'
7457			if $contains "/dev/fd" flect >/dev/null; then
7458				echo "Okay, it looks like setuid scripts are secure." >&4
7459				dflt=y
7460			else
7461				echo "I don't think setuid scripts are secure." >&4
7462				dflt=n
7463			fi
7464			;;
7465		esac
7466		rp='Does your kernel have *secure* setuid scripts?'
7467		. ./myread
7468		case "$ans" in
7469		[yY]*)	val="$define";;
7470		*)	val="$undef";;
7471		esac
7472	fi
7473else
7474	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7475	echo "(That's for file descriptors, not floppy disks.)"
7476	val="$undef"
7477fi
7478set d_suidsafe
7479eval $setvar
7480
7481$rm -f reflect flect
7482
7483: now see if they want to do setuid emulation
7484if $test $patchlevel -lt 11; then
7485echo " "
7486val="$undef"
7487case "$d_suidsafe" in
7488"$define")
7489	val="$undef"
7490	echo "No need to emulate SUID scripts since they are secure here." >&4
7491	;;
7492*)
7493	$cat <<EOM
7494Some systems have disabled setuid scripts, especially systems where
7495setuid scripts cannot be secure.  On systems where setuid scripts have
7496been disabled, the setuid/setgid bits on scripts are currently
7497useless.  It is possible for $package to detect those bits and emulate
7498setuid/setgid in a secure fashion.  This emulation will only work if
7499setuid scripts have been disabled in your kernel.
7500
7501EOM
7502	case "$d_dosuid" in
7503	"$define") dflt=y ;;
7504	*) dflt=n ;;
7505	esac
7506	rp="Do you want to do setuid/setgid emulation?"
7507	. ./myread
7508	case "$ans" in
7509	[yY]*)	val="$define";;
7510	*)	val="$undef";;
7511	esac
7512	;;
7513esac
7514set d_dosuid
7515eval $setvar
7516else
7517    case "$d_dosuid" in
7518	"$define")
7519	cat >&4 <<EOH
7520
7521SUID emulation has been removed for 5.12
7522Please re-run Configure without -Dd_dosuid
7523
7524EOH
7525	exit 1;
7526	;;
7527    esac
7528    d_dosuid=undef
7529fi
7530
7531: Find perl5.005 or later.
7532echo "Looking for a previously installed perl5.005 or later... "
7533case "$perl5" in
7534'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7535		: Check if this perl is recent and can load a simple module
7536		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7537			perl5=$tdir/perl
7538			break;
7539		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7540			perl5=$tdir/perl5
7541			break;
7542		fi
7543	done
7544	;;
7545*)	perl5="$perl5"
7546	;;
7547esac
7548case "$perl5" in
7549'')	echo "None found.  That's ok.";;
7550*)	echo "Using $perl5." ;;
7551esac
7552
7553: Set the siteprefix variables
7554$cat <<EOM
7555
7556After $package is installed, you may wish to install various
7557add-on modules and utilities.  Typically, these add-ons will
7558be installed under $prefix with the rest
7559of this package.  However, you may wish to install such add-ons
7560elsewhere under a different prefix.
7561
7562If you do not wish to put everything under a single prefix, that's
7563ok.  You will be prompted for the individual locations; this siteprefix
7564is only used to suggest the defaults.
7565
7566The default should be fine for most people.
7567
7568EOM
7569fn=d~+
7570rp='Installation prefix to use for add-on modules and utilities?'
7571: XXX Here might be another good place for an installstyle setting.
7572case "$siteprefix" in
7573'') dflt=$prefix ;;
7574*)  dflt=$siteprefix ;;
7575esac
7576. ./getfile
7577: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7578oldsiteprefix=''
7579case "$siteprefix" in
7580'') ;;
7581*)	case "$ans" in
7582	"$prefix") ;;
7583	*) oldsiteprefix="$prefix";;
7584	esac
7585	;;
7586esac
7587siteprefix="$ans"
7588siteprefixexp="$ansexp"
7589
7590: determine where site specific libraries go.
7591: Usual default is /usr/local/lib/perl5/site_perl/$version
7592: The default "style" setting is made in installstyle.U
7593: XXX No longer works with Prefixit stuff.
7594prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7595case "$sitelib" in
7596'') case "$installstyle" in
7597	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7598	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
7599	esac
7600	;;
7601*)	dflt="$sitelib"
7602	;;
7603esac
7604$cat <<EOM
7605
7606The installation process will create a directory for
7607site-specific extensions and modules.  Most users find it convenient
7608to place all site-specific files in this directory rather than in the
7609main distribution directory.
7610
7611EOM
7612fn=d~+
7613rp='Pathname for the site-specific library files?'
7614. ./getfile
7615prefixvar=sitelib
7616. ./setprefixvar
7617sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7618
7619: Determine list of previous versions to include in @INC
7620$cat > getverlist <<EOPL
7621#!$perl5 -w
7622use File::Basename;
7623\$api_versionstring = "$api_versionstring";
7624\$version = "$version";
7625\$stem = "$sitelib_stem";
7626\$archname = "$archname";
7627EOPL
7628	$cat >> getverlist <<'EOPL'
7629# The list found is store twice for each entry: the original name, and
7630# the binary broken down version as pack "sss", so sorting is easy and
7631# unambiguous. This will work for all versions that have a maximum of
7632# three digit groups, separate by '.'s or '_'s. Names are extended with
7633# ".0.0" to ensure at least three elements for the pack.
7634#					-- H.Merijn Brand (m)'06 23-10-2006
7635
7636# Can't have leading @ because metaconfig interprets it as a command!
7637;@inc_version_list=();
7638# XXX Redo to do opendir/readdir?
7639if (-d $stem) {
7640    chdir($stem);
7641    ;@candidates = map {
7642	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7643    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7644}
7645else {
7646    ;@candidates = ();
7647}
7648
7649($pversion, $aversion, $vsn5005) = map {
7650    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7651foreach $d (@candidates) {
7652    if ($d->[1] lt $pversion) {
7653	if ($d->[1] ge $aversion) {
7654	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7655	}
7656	elsif ($d->[1] ge $vsn5005) {
7657	    unshift(@inc_version_list, grep { -d } $d->[0]);
7658	}
7659    }
7660    else {
7661	# Skip newer version.  I.e. don't look in
7662	# 5.7.0 if we're installing 5.6.1.
7663    }
7664}
7665
7666if (@inc_version_list) {
7667    print join(' ', @inc_version_list);
7668}
7669else {
7670    # Blank space to preserve value for next Configure run.
7671    print " ";
7672}
7673EOPL
7674chmod +x getverlist
7675case "$inc_version_list" in
7676'')	if test -x "$perl5$exe_ext"; then
7677		dflt=`$perl5 getverlist`
7678	else
7679		dflt='none'
7680	fi
7681	;;
7682$undef) dflt='none' ;;
7683*)  eval dflt=\"$inc_version_list\" ;;
7684esac
7685case "$dflt" in
7686''|' ') dflt=none ;;
7687esac
7688case "$dflt" in
76895.005) dflt=none ;;
7690esac
7691$cat <<EOM
7692
7693In order to ease the process of upgrading, this version of perl
7694can be configured to use modules built and installed with earlier
7695versions of perl that were installed under $prefix.  Specify here
7696the list of earlier versions that this version of perl should check.
7697If Configure detected no earlier versions of perl installed under
7698$prefix, then the list will be empty.  Answer 'none' to tell perl
7699to not search earlier versions.
7700
7701The default should almost always be sensible, so if you're not sure,
7702just accept the default.
7703EOM
7704
7705rp='List of earlier versions to include in @INC?'
7706. ./myread
7707case "$ans" in
7708[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7709*) inc_version_list="$ans" ;;
7710esac
7711case "$inc_version_list" in
7712''|' ')
7713	inc_version_list_init='0'
7714	d_inc_version_list="$undef"
7715	;;
7716*)	inc_version_list_init=`echo $inc_version_list |
7717		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7718	d_inc_version_list="$define"
7719	;;
7720esac
7721$rm -f getverlist
7722
7723: see if malloc/malloc.h has to be included
7724set malloc/malloc.h i_mallocmalloc
7725eval $inhdr
7726
7727: see if this is a malloc.h system
7728: we want a real compile instead of Inhdr because some systems have a
7729: malloc.h that just gives a compile error saying to use stdlib.h instead
7730echo " "
7731$cat >try.c <<EOCP
7732#include <stdlib.h>
7733#include <malloc.h>
7734#$i_mallocmalloc I_MALLOCMALLOC
7735#ifdef I_MALLOCMALLOC
7736# include <malloc/malloc.h>
7737#endif
7738
7739int main () { return 0; }
7740EOCP
7741set try
7742if eval $compile; then
7743    echo "<malloc.h> found." >&4
7744    val="$define"
7745else
7746    echo "<malloc.h> NOT found." >&4
7747    val="$undef"
7748fi
7749$rm_try
7750set i_malloc
7751eval $setvar
7752
7753: check for length of pointer
7754echo " "
7755case "$ptrsize" in
7756'')
7757	echo "Checking to see how big your pointers are..." >&4
7758	$cat >try.c <<EOCP
7759#include <stdio.h>
7760#$i_stdlib I_STDLIB
7761#ifdef I_STDLIB
7762#include <stdlib.h>
7763#endif
7764int main()
7765{
7766    printf("%d\n", (int)sizeof(void *));
7767    exit(0);
7768}
7769EOCP
7770	set try
7771	if eval $compile_ok; then
7772		ptrsize=`$run ./try`
7773		echo "Your pointers are $ptrsize bytes long."
7774	else
7775		dflt='4'
7776		echo "(I can't seem to compile the test program.  Guessing...)" >&4
7777		rp="What is the size of a pointer (in bytes)?"
7778		. ./myread
7779		ptrsize="$ans"
7780	fi
7781	;;
7782esac
7783$rm_try
7784case "$use64bitall" in
7785"$define"|true|[yY]*)
7786	case "$ptrsize" in
7787	4)	cat <<EOM >&4
7788
7789*** You have chosen a maximally 64-bit build,
7790*** but your pointers are only 4 bytes wide.
7791*** Please rerun Configure without -Duse64bitall.
7792EOM
7793		case "$d_quad" in
7794		define)
7795			cat <<EOM >&4
7796*** Since you have quads, you could possibly try with -Duse64bitint.
7797EOM
7798			;;
7799		esac
7800		cat <<EOM >&4
7801*** Cannot continue, aborting.
7802
7803EOM
7804
7805		exit 1
7806		;;
7807	esac
7808	;;
7809esac
7810
7811: determine whether to use malloc wrapping
7812echo " "
7813case "$usemallocwrap" in
7814[yY]*|true|$define)	dflt='y' ;;
7815[nN]*|false|$undef)	dflt='n' ;;
7816*)	case "$usedevel" in
7817	[yY]*|true|$define)	dflt='y' ;;
7818	*) dflt='n' ;;
7819	esac
7820	;;
7821esac
7822rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7823. ./myread
7824usemallocwrap="$ans"
7825case "$ans" in
7826y*|true)
7827	usemallocwrap="$define" ;;
7828*)
7829	usemallocwrap="$undef" ;;
7830esac
7831
7832: determine which malloc to compile in
7833echo " "
7834case "$usemymalloc" in
7835[yY]*|true|$define)	dflt='y' ;;
7836[nN]*|false|$undef)	dflt='n' ;;
7837*)	case "$ptrsize" in
7838	4) dflt='y' ;;
7839	*) dflt='n' ;;
7840	esac
7841	if test "$useithreads" = "$define"; then dflt='n'; fi
7842	;;
7843esac
7844rp="Do you wish to attempt to use the malloc that comes with $package?"
7845. ./myread
7846usemymalloc="$ans"
7847case "$ans" in
7848y*|true)
7849	usemymalloc='y'
7850	mallocsrc='malloc.c'
7851	mallocobj="malloc$_o"
7852	d_mymalloc="$define"
7853	case "$libs" in
7854	*-lmalloc*)
7855		: Remove malloc from list of libraries to use
7856		echo "Removing unneeded -lmalloc from library list" >&4
7857		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7858		shift
7859		libs="$*"
7860		echo "libs = $libs" >&4
7861		;;
7862	esac
7863	;;
7864*)
7865	usemymalloc='n'
7866	mallocsrc=''
7867	mallocobj=''
7868	d_mymalloc="$undef"
7869	;;
7870esac
7871
7872: compute the return types of malloc and free
7873echo " "
7874$cat >malloc.c <<END
7875#$i_malloc I_MALLOC
7876#$i_stdlib I_STDLIB
7877#include <stdio.h>
7878#include <sys/types.h>
7879#ifdef I_MALLOC
7880#include <malloc.h>
7881#endif
7882#ifdef I_STDLIB
7883#include <stdlib.h>
7884#endif
7885#ifdef TRY_MALLOC
7886void *malloc();
7887#endif
7888#ifdef TRY_FREE
7889void free();
7890#endif
7891END
7892case "$malloctype" in
7893'')
7894	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7895		malloctype='void *'
7896	else
7897		malloctype='char *'
7898	fi
7899	;;
7900esac
7901echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7902
7903case "$freetype" in
7904'')
7905	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7906		freetype='void'
7907	else
7908		freetype='int'
7909	fi
7910	;;
7911esac
7912echo "Your system uses $freetype free(), it would seem." >&4
7913$rm -f malloc.[co]
7914: determine where site specific architecture-dependent libraries go.
7915: sitelib  default is /usr/local/lib/perl5/site_perl/$version
7916: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7917: sitelib may have an optional trailing /share.
7918case "$sitearch" in
7919'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
7920	dflt="$dflt/$archname"
7921	;;
7922*)	dflt="$sitearch"
7923	;;
7924esac
7925set sitearch sitearch none
7926eval $prefixit
7927$cat <<EOM
7928
7929The installation process will also create a directory for
7930architecture-dependent site-specific extensions and modules.
7931
7932EOM
7933fn=d~+
7934rp='Pathname for the site-specific architecture-dependent library files?'
7935. ./getfile
7936prefixvar=sitearch
7937. ./setprefixvar
7938if $test X"$sitearch" = X"$sitelib"; then
7939	d_sitearch="$undef"
7940else
7941	d_sitearch="$define"
7942fi
7943
7944: Set the vendorprefix variables
7945$cat <<EOM
7946
7947The installation process will also create a directory for
7948vendor-supplied add-ons.  Vendors who supply perl with their system
7949may find it convenient to place all vendor-supplied files in this
7950directory rather than in the main distribution directory.  This will
7951ease upgrades between binary-compatible maintenance versions of perl.
7952
7953Of course you may also use these directories in whatever way you see
7954fit.  For example, you might use them to access modules shared over a
7955company-wide network.
7956
7957The default answer should be fine for most people.
7958This causes further questions about vendor add-ons to be skipped
7959and no vendor-specific directories will be configured for perl.
7960
7961EOM
7962rp='Do you want to configure vendor-specific add-on directories?'
7963case "$usevendorprefix" in
7964define|true|[yY]*) dflt=y ;;
7965*)	: User may have set vendorprefix directly on Configure command line.
7966	case "$vendorprefix" in
7967	''|' ') dflt=n ;;
7968	*)	dflt=y ;;
7969	esac
7970	;;
7971esac
7972. ./myread
7973case "$ans" in
7974[yY]*)	fn=d~+
7975	rp='Installation prefix to use for vendor-supplied add-ons?'
7976	case "$vendorprefix" in
7977	'') dflt="$prefix" ;;
7978	*)  dflt=$vendorprefix ;;
7979	esac
7980	. ./getfile
7981	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7982	oldvendorprefix=''
7983	case "$vendorprefix" in
7984	'') ;;
7985	*)	case "$ans" in
7986		"$prefix") ;;
7987		*) oldvendorprefix="$prefix";;
7988		esac
7989		;;
7990	esac
7991	usevendorprefix="$define"
7992	vendorprefix="$ans"
7993	vendorprefixexp="$ansexp"
7994	;;
7995*)	usevendorprefix="$undef"
7996	vendorprefix=''
7997	vendorprefixexp=''
7998	;;
7999esac
8000
8001: Set the vendorlib variables
8002case "$vendorprefix" in
8003'')	d_vendorlib="$undef"
8004	vendorlib=''
8005	vendorlibexp=''
8006	;;
8007*)	d_vendorlib="$define"
8008	: determine where vendor-supplied modules go.
8009	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
8010	case "$vendorlib" in
8011	'')
8012		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8013		case "$installstyle" in
8014		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8015		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8016		esac
8017		;;
8018	*)	dflt="$vendorlib"
8019		;;
8020	esac
8021	fn=d~+
8022	rp='Pathname for the vendor-supplied library files?'
8023	. ./getfile
8024	vendorlib="$ans"
8025	vendorlibexp="$ansexp"
8026	;;
8027esac
8028vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8029prefixvar=vendorlib
8030. ./installprefix
8031
8032: Set the vendorarch variables
8033case "$vendorprefix" in
8034'')	d_vendorarch="$undef"
8035	vendorarch=''
8036	vendorarchexp=''
8037	;;
8038*)	d_vendorarch="$define"
8039	: determine where vendor-supplied architecture-dependent libraries go.
8040	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8041	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8042	: vendorlib may have an optional trailing /share.
8043	case "$vendorarch" in
8044	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
8045		dflt="$dflt/$archname"
8046		;;
8047	*)	dflt="$vendorarch" ;;
8048	esac
8049	fn=d~+
8050	rp='Pathname for vendor-supplied architecture-dependent files?'
8051	. ./getfile
8052	vendorarch="$ans"
8053	vendorarchexp="$ansexp"
8054	;;
8055esac
8056prefixvar=vendorarch
8057. ./installprefix
8058if $test X"$vendorarch" = X"$vendorlib"; then
8059	d_vendorarch="$undef"
8060else
8061	d_vendorarch="$define"
8062fi
8063
8064: Final catch-all directories to search
8065$cat <<EOM
8066
8067Lastly, you can have perl look in other directories for extensions and
8068modules in addition to those already specified.
8069These directories will be searched after
8070	$sitearch
8071	$sitelib
8072EOM
8073test X"$vendorlib" != "X" && echo '	' $vendorlib
8074test X"$vendorarch" != "X" && echo '	' $vendorarch
8075echo ' '
8076case "$otherlibdirs" in
8077''|' ') dflt='none' ;;
8078*)	dflt="$otherlibdirs" ;;
8079esac
8080$cat <<EOM
8081Enter a colon-separated set of extra paths to include in perl's @INC
8082search path, or enter 'none' for no extra paths.
8083
8084EOM
8085
8086rp='Colon-separated list of additional directories for perl to search?'
8087. ./myread
8088case "$ans" in
8089' '|''|none)	otherlibdirs=' ' ;;
8090*)	otherlibdirs="$ans" ;;
8091esac
8092case "$otherlibdirs" in
8093' ') val=$undef ;;
8094*)	val=$define ;;
8095esac
8096set d_perl_otherlibdirs
8097eval $setvar
8098
8099: DTrace support
8100dflt_dtrace='/usr/sbin/dtrace'
8101$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8102
8103cat <<EOM
8104
8105Perl can be built to support DTrace on platforms that support it.
8106DTrace is a diagnosis and performance analysis tool from Sun.
8107
8108If this doesn't make any sense to you, just accept the default.
8109EOM
8110
8111while $test 1 ; do
8112	case "$usedtrace" in
8113	$define|true|[yY]*)
8114		dflt='y'
8115		;;
8116	?*)
8117		dflt='y'
8118		dflt_dtrace=$usedtrace
8119		;;
8120	*)
8121		dflt='n'
8122		;;
8123	esac
8124
8125	rp='Support DTrace if available?'
8126	. ./myread
8127	case "$ans" in
8128	y|Y)	val="$define" ;;
8129	*)      val="$undef" ;;
8130	esac
8131	set usedtrace
8132	eval $setvar
8133
8134	test "X$usedtrace" != "X$define" && break
8135
8136	echo " "
8137	rp='Where is the dtrace executable?'
8138	dflt=$dflt_dtrace
8139	. ./getfile
8140	val="$ans"
8141	set dtrace
8142	eval $setvar
8143
8144	if $test -f $dtrace
8145	then
8146		if $dtrace -h -s ../perldtrace.d \
8147			-o perldtrace.tmp >/dev/null 2>&1 \
8148			&& rm -f perldtrace.tmp
8149		then
8150			echo " "
8151			echo "Good: your $dtrace knows about the -h flag."
8152		else
8153			cat >&2 <<EOM
8154
8155*** $me:  Fatal Error:  $dtrace doesn't support -h flag
8156***
8157*** Your installed dtrace doesn't support the -h switch to compile a D
8158*** program into a C header. Can't continue.
8159
8160EOM
8161			exit 1
8162		fi
8163		break;
8164	fi
8165
8166	case "$fastread" in
8167	yes)
8168		cat >&2 <<EOM
8169
8170*** $me:  Fatal Error:  $dtrace not found.
8171*** Can't continue.
8172
8173EOM
8174		exit 1
8175		;;
8176	*)
8177		echo "*** $dtrace was not found."
8178		echo " "
8179		;;
8180	esac
8181done
8182
8183: See if we want extra modules installed
8184echo " "
8185case "$extras" in
8186'') dflt='n';;
8187*) dflt='y';;
8188esac
8189cat <<EOM
8190Perl can be built with extra modules or bundles of modules which
8191will be fetched from the CPAN and installed alongside Perl.
8192
8193Notice that you will need access to the CPAN; either via the Internet,
8194or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8195be asked later to configure the CPAN.pm module which will in turn do
8196the installation of the rest of the extra modules or bundles.)
8197
8198Notice also that if the modules require any external software such as
8199libraries and headers (the libz library and the zlib.h header for the
8200Compress::Zlib module, for example) you MUST have any such software
8201already installed, this configuration process will NOT install such
8202things for you.
8203
8204If this doesn't make any sense to you, just accept the default '$dflt'.
8205EOM
8206rp='Install any extra modules (y or n)?'
8207. ./myread
8208case "$ans" in
8209y|Y)
8210	cat <<EOM
8211
8212Please list any extra modules or bundles to be installed from CPAN,
8213with spaces between the names.  The names can be in any format the
8214'install' command of CPAN.pm will understand.  (Answer 'none',
8215without the quotes, to install no extra modules or bundles.)
8216EOM
8217	rp='Extras?'
8218	dflt="$extras"
8219	. ./myread
8220	extras="$ans"
8221esac
8222case "$extras" in
8223''|'none')
8224	val=''
8225	$rm -f ../extras.lst
8226	;;
8227*)	echo "(Saving the list of extras for later...)"
8228	echo "$extras" > ../extras.lst
8229	val="'$extras'"
8230	;;
8231esac
8232set extras
8233eval $setvar
8234echo " "
8235
8236: determine where html pages for programs go
8237set html1dir html1dir none
8238eval $prefixit
8239$cat <<EOM
8240
8241If you wish to install html files for programs in $spackage, indicate
8242the appropriate directory here.  To skip installing html files,
8243answer "none".
8244EOM
8245case "$html1dir" in
8246''|none|$undef|' ') dflt=none ;;
8247*) dflt=$html1dir ;;
8248esac
8249fn=dn+~
8250rp="Directory for the main $spackage html pages?"
8251. ./getfile
8252prefixvar=html1dir
8253. ./setprefixvar
8254: Use ' ' for none so value is preserved next time through Configure
8255$test X"$html1dir" = "X" && html1dir=' '
8256
8257: determine where html pages for libraries and modules go
8258set html3dir html3dir none
8259eval $prefixit
8260$cat <<EOM
8261
8262If you wish to install html files for modules associated with $spackage,
8263indicate the appropriate directory here.  To skip installing html files,
8264answer "none".
8265EOM
8266: There is no obvious default.  If they have specified html1dir, then
8267: try to key off that, possibly changing .../html1 into .../html3.
8268case "$html3dir" in
8269'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8270*) dflt=$html3dir ;;
8271esac
8272fn=dn+~
8273rp="Directory for the $spackage module html pages?"
8274. ./getfile
8275prefixvar=html3dir
8276. ./setprefixvar
8277: Use ' ' for none so value is preserved next time through Configure
8278$test X"$html3dir" = "X" && html3dir=' '
8279
8280: determine whether to install perl also as /usr/bin/perl
8281
8282echo " "
8283if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8284	$cat <<EOM
8285Many scripts expect perl to be installed as /usr/bin/perl.
8286
8287If you want to, I can install the perl you are about to compile
8288as /usr/bin/perl (in addition to $bin/perl).
8289EOM
8290	if test -f /usr/bin/perl; then
8291	    $cat <<EOM
8292
8293However, please note that because you already have a /usr/bin/perl,
8294overwriting that with a new Perl would very probably cause problems.
8295Therefore I'm assuming you don't want to do that (unless you insist).
8296
8297EOM
8298	    case "$installusrbinperl" in
8299	    "$define"|[yY]*)	dflt='y';;
8300	    *)			dflt='n';;
8301	    esac
8302	else
8303	    $cat <<EOM
8304
8305Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8306
8307EOM
8308	    case "$installusrbinperl" in
8309	    "$undef"|[nN]*)	dflt='n';;
8310	    *)			dflt='y';;
8311	    esac
8312	fi
8313	rp="Do you want to install perl as /usr/bin/perl?"
8314	. ./myread
8315	case "$ans" in
8316	[yY]*)	val="$define";;
8317	*)	val="$undef" ;;
8318	esac
8319else
8320	val="$undef"
8321fi
8322set installusrbinperl
8323eval $setvar
8324
8325: see if dlopen exists
8326xxx_runnm="$runnm"
8327xxx_ccflags="$ccflags"
8328runnm=false
8329: with g++ one needs -shared to get is-in-libc to work for dlopen
8330case "$gccversion" in
8331'')	;;
8332*Clang*)	;;
8333*)	case "$d_cplusplus" in
8334	"$define") ccflags="$ccflags -shared" ;;
8335	esac
8336	;;
8337esac
8338set dlopen d_dlopen
8339eval $inlibc
8340runnm="$xxx_runnm"
8341ccflags="$xxx_ccflags"
8342
8343: see if this is a unistd.h system
8344set unistd.h i_unistd
8345eval $inhdr
8346
8347: determine which dynamic loading, if any, to compile in
8348echo " "
8349dldir="ext/DynaLoader"
8350case "$usedl" in
8351    $define|y|true)
8352	dflt='y'
8353	usedl="$define"
8354	;;
8355    $undef|n|false)
8356	dflt='n'
8357	usedl="$undef"
8358	;;
8359    *)
8360	dflt='n'
8361	case "$d_dlopen" in
8362	    $define) dflt='y' ;;
8363	esac
8364	: Does a dl_xxx.xs file exist for this operating system
8365	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8366	;;
8367esac
8368rp="Do you wish to use dynamic loading?"
8369. ./myread
8370usedl="$ans"
8371bin_ELF="$undef"
8372case "$ans" in
8373    y*) usedl="$define"
8374	case "$dlsrc" in
8375	    '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8376		    dflt="$dldir/dl_${osname}.xs"
8377		elif $test "$d_dlopen" = "$define" ; then
8378		    dflt="$dldir/dl_dlopen.xs"
8379		else
8380		    dflt=''
8381		fi
8382		;;
8383	    *)  dflt="$dldir/$dlsrc"
8384		;;
8385	esac
8386	echo "The following dynamic loading files are available:"
8387	: Can not go over to $dldir because getfile has path hard-coded in.
8388	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8389	rp="Source file to use for dynamic loading"
8390	fn="fne"
8391	gfpth="$src"
8392	. ./getfile
8393	usedl="$define"
8394	: emulate basename
8395	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8396
8397	$cat << EOM
8398
8399Some systems may require passing special flags to $cc -c to
8400compile modules that will be used to create a shared library.
8401To use no flags, say "none".
8402
8403EOM
8404	case "$cccdlflags" in
8405	    '') case "$gccversion" in
8406		'') case "$osname" in
8407			hpux)	dflt='+z' ;;
8408			irix*)	dflt='-KPIC' ;;
8409			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8410			sunos)	dflt='-pic' ;;
8411			*)	dflt='none' ;;
8412		    esac
8413		    ;;
8414		*)  case "$osname" in
8415			darwin) dflt='none' ;;
8416			*linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8417			*)	dflt='-fpic' ;;
8418		    esac ;;
8419		esac ;;
8420	    ' ') dflt='none' ;;
8421	    *)   dflt="$cccdlflags" ;;
8422	esac
8423
8424	case "$dflt" in
8425	    none) dflt='' ;;
8426	esac
8427
8428	# If -Dsysroot was specified, now's the time to add it
8429	# to cccdlflags
8430	if test "X$sysroot" != X; then
8431	    case "$gccversion" in
8432		'') ;;
8433		*)  case "$dflt" in
8434			*sysroot*) ;;
8435			'undef'|*)
8436			    dflt="$dflt --sysroot=$sysroot" ;;
8437		    esac
8438		    ;;
8439	    esac
8440	fi
8441
8442	case "$dflt" in
8443	    '') dflt='none';;
8444	esac
8445
8446	rp="Any special flags to pass to $cc -c to compile shared library modules?"
8447	. ./myread
8448	case "$ans" in
8449	    none) cccdlflags=' ' ;;
8450	    *)    cccdlflags="$ans" ;;
8451	esac
8452
8453	cat << EOM
8454
8455Some systems use ld to create libraries that can be dynamically loaded,
8456while other systems (such as those using ELF) use $cc.
8457
8458EOM
8459
8460: Determine if this is ELF
8461	$cat >try.c <<EOM
8462/* Test for whether ELF binaries are produced */
8463#include <fcntl.h>
8464#$i_stdlib I_STDLIB
8465#ifdef I_STDLIB
8466#include <stdlib.h>
8467#endif
8468#$i_unistd I_UNISTD
8469#ifdef I_UNISTD
8470#include <unistd.h>
8471#endif
8472int main() {
8473    char b[4];
8474    int i = open("a.out",O_RDONLY);
8475    if(i == -1)
8476	exit(1); /* fail */
8477    if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8478	exit(0); /* succeed (yes, it is ELF) */
8479    exit(1); /* fail */
8480}
8481EOM
8482	if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8483	    bin_ELF="$define"
8484	fi
8485	$rm_try
8486
8487	case "$ld" in
8488	    '') if $test $bin_ELF = "$define"; then
8489		    cat <<EOM
8490You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8491EOM
8492		    dflt="$cc"
8493		else
8494		    echo "I'll use ld to build dynamic libraries."
8495		    dflt='ld'
8496		fi
8497		;;
8498	    *)  dflt="$ld"
8499		;;
8500	esac
8501
8502	rp="What command should be used to create dynamic libraries?"
8503	. ./myread
8504	ld="$ans"
8505
8506	cat << EOM
8507
8508Some systems may require passing special flags to $ld to create a
8509library that can be dynamically loaded.  If your ld flags include
8510-L/other/path options to locate libraries outside your loader's normal
8511search path, you may need to specify those -L options here as well.  To
8512use no flags, say "none".
8513
8514EOM
8515	case "$lddlflags" in
8516	    '') case "$osname" in
8517		    haiku) dflt='-shared' ;;
8518		    hpux) dflt='-b';
8519			  case "$gccversion" in
8520			      '') dflt="$dflt +vnocompatwarnings" ;;
8521			  esac
8522			  ;;
8523		    *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8524		    solaris) # See [perl #66604].
8525			    # On Solaris 11, gcc -m64 on amd64
8526			    # appears not to understand -G.  gcc versions at
8527			    # least as old as 3.4.3 support -shared, so just
8528			    # use that with Solaris 11 and later, but keep
8529			    # the old behavior for older Solaris versions.
8530			    case "$gccversion" in
8531				'') dflt='-G' ;;
8532				*)  case "$osvers" in
8533					2.?|2.10) dflt='-G' ;;
8534					*) dflt='-shared' ;;
8535				    esac
8536				    ;;
8537			    esac
8538			    ;;
8539		    sunos) dflt='-assert nodefinitions' ;;
8540		    svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8541		    *)     dflt='none' ;;
8542		esac
8543		;;
8544	    *) dflt="$lddlflags" ;;
8545	esac
8546
8547	: Only do this for gcc, since, for example, qcc has no concept
8548	: of --sysroot.
8549	if $test "X$sysroot" != X; then
8550	    case "$gccversion" in
8551		'') ;;
8552		*)  dflt="$dflt --sysroot $sysroot" ;;
8553	    esac
8554	fi
8555
8556	: Try to guess additional flags to pick up local libraries.
8557	: Be careful not to append to a plain 'none'
8558	case "$dflt" in
8559	    none) dflt='' ;;
8560	esac
8561	for thisflag in $ldflags; do
8562	    case "$thisflag" in
8563		-L*|-R*|-Wl,-R*)
8564		    case " $dflt " in
8565			*" $thisflag "*) ;;
8566			*) dflt="$dflt $thisflag" ;;
8567		    esac
8568		    ;;
8569	    esac
8570	done
8571
8572	case "$dflt" in
8573	    ''|' ') dflt='none' ;;
8574	esac
8575
8576	case "$ldflags" in
8577	    *-fstack-protector-strong*)
8578		case "$dflt" in
8579		    *-fstack-protector-strong*) ;; # Don't add it again
8580		    *) dflt="$dflt -fstack-protector-strong" ;;
8581		esac
8582		;;
8583	    *-fstack-protector*)
8584		case "$dflt" in
8585		    *-fstack-protector*) ;; # Don't add it again
8586		    *) dflt="$dflt -fstack-protector" ;;
8587		esac
8588		;;
8589	esac
8590
8591	rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8592	. ./myread
8593	case "$ans" in
8594	    none) lddlflags=' ' ;;
8595	    *) lddlflags="$ans" ;;
8596	esac
8597
8598	cat <<EOM
8599
8600Some systems may require passing special flags to $cc to indicate that
8601the resulting executable will use dynamic linking.  To use no flags,
8602say "none".
8603
8604EOM
8605	case "$ccdlflags" in
8606	    '') case "$osname" in
8607		    *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8608		    sunos)             dflt='none'   ;;
8609		    *)                 dflt='none'   ;;
8610		esac ;;
8611	    ' ') dflt='none' ;;
8612	    *)   dflt="$ccdlflags" ;;
8613	esac
8614	rp="Any special flags to pass to $cc to use dynamic linking?"
8615	. ./myread
8616	case "$ans" in
8617	    none) ccdlflags=' ' ;;
8618	    *)    ccdlflags="$ans" ;;
8619	esac
8620	;;
8621
8622    *)  usedl="$undef"
8623	ld='ld'
8624	dlsrc='dl_none.xs'
8625	lddlflags=''
8626	ccdlflags=''
8627	;;
8628esac
8629
8630ld_can_script="$undef"
8631case "$bin_ELF$usedl" in
8632    $define$define)
8633	# Abuse try.h and a.out names for neat cleanup
8634	$cat >try.c <<EOM
8635void foo() {}
8636void bar() {}
8637EOM
8638	$cat >try.h <<EOM
8639LIBTEST_42 {
8640 global:
8641  foo;
8642 local: *;
8643 };
8644EOM
8645	if $cc $cccdlflags $ccdlflags $ccflags \
8646	       $ldflags $lddlflags -o a.out try.c \
8647	       -Wl,--version-script=try.h >/dev/null 2>&1 \
8648	   &&  $test -s a.out ; then
8649	    echo "ld supports scripting" >&4
8650	    ld_can_script="$define"
8651	else
8652	    echo "ld does not support scripting" >&4
8653	fi
8654	$rm_try
8655	;;
8656esac
8657
8658: Do we want a shared libperl?
8659also=''
8660case "$usedl" in
8661$undef)
8662	# No dynamic loading being used, so don't bother even to prompt.
8663	useshrplib='false'
8664	;;
8665*)	case "$useshrplib" in
8666	'')	case "$osname" in
8667		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8668			dflt=y
8669			also='Building a shared libperl is required for dynamic loading to work on your system.'
8670			;;
8671		*)	dflt=n
8672			;;
8673		esac
8674		;;
8675	$define|true|[Yy]*)
8676		dflt=y
8677		;;
8678	*)	dflt=n
8679		;;
8680	esac
8681	$cat << EOM
8682
8683The perl executable is normally obtained by linking perlmain.c with
8684libperl${_a}, any static extensions (usually just DynaLoader), and
8685any other libraries needed on this system (such as -lm, etc.).  Since
8686your system supports dynamic loading, it is probably possible to build
8687a shared libperl.$so.  If you will have more than one executable linked
8688to libperl.$so, this will significantly reduce the size of each
8689executable, but it may have a noticeable effect on performance.  The
8690default is probably sensible for your system.
8691$also
8692
8693EOM
8694	rp="Build a shared libperl.$so (y/n)"
8695	. ./myread
8696	case "$ans" in
8697	true|$define|[Yy]*)
8698		useshrplib='true'  ;;
8699	*)	useshrplib='false' ;;
8700	esac
8701	;;
8702esac
8703
8704case "$useshrplib" in
8705true)
8706	case "$userelocatableinc" in
8707	true|define)
8708		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8709		echo "See INSTALL for an explanation why that won't work." >&4
8710		exit 4
8711		;;
8712	esac
8713	case "$libperl" in
8714	'')
8715		# Figure out a good name for libperl.so.  Since it gets stored in
8716		# a version-specific architecture-dependent library, the version
8717		# number isn't really that important, except for making cc/ld happy.
8718		#
8719		# A name such as libperl.so.10.1
8720		majmin="libperl.$so.$patchlevel.$subversion"
8721		# A name such as libperl.so.100
8722		majonly=`echo $patchlevel $subversion |
8723			$awk '{printf "%d%02d", $1, $2}'`
8724		majonly=libperl.$so.$majonly
8725		# I'd prefer to keep the os-specific stuff here to a minimum, and
8726		# rely on figuring it out from the naming of libc.
8727		case "${osname}${osvers}" in
8728		*linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8729			dflt=libperl.$so
8730			;;
8731		cygwin*) # ld links now against the dll directly
8732			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8733			majonly=`echo $patchlevel $subversion |
8734				$awk '{printf "%03d%03d", $1, $2}'`
8735			majonly=cygperl5.$majonly.$so
8736			dflt=$majmin
8737			;;
8738		*)	# Try to guess based on whether libc has major.minor.
8739			case "$libc" in
8740			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8741			*libc.$so.[0-9]*) dflt=$majonly ;;
8742			*)	dflt=libperl.$so ;;
8743			esac
8744			;;
8745		esac
8746		;;
8747	*)	dflt=$libperl
8748		;;
8749	esac
8750	cat << EOM
8751
8752I need to select a good name for the shared libperl.  If your system uses
8753library names with major and minor numbers, then you might want something
8754like $majmin.  Alternatively, if your system uses a single version
8755number for shared libraries, then you might want to use $majonly.
8756Or, your system might be quite happy with a simple libperl.$so.
8757
8758Since the shared libperl will get installed into a version-specific
8759architecture-dependent directory, the version number of the shared perl
8760library probably isn't important, so the default should be o.k.
8761
8762EOM
8763	rp='What name do you want to give to the shared libperl?'
8764	. ./myread
8765	libperl=$ans
8766	echo "Ok, I'll use $libperl"
8767	;;
8768*)
8769	libperl="libperl${_a}"
8770	;;
8771esac
8772
8773# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8774case "$shrpdir" in
8775'') ;;
8776*)	$cat >&4 <<EOM
8777WARNING:  Use of the shrpdir variable for the installation location of
8778the shared $libperl is not supported.  It was never documented and
8779will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8780know of any problems this may cause.
8781
8782EOM
8783	case "$shrpdir" in
8784	"$archlibexp/CORE")
8785		$cat >&4 <<EOM
8786But your current setting of $shrpdir is
8787the default anyway, so it's harmless.
8788EOM
8789		;;
8790	*)
8791		$cat >&4 <<EOM
8792Further, your current attempted setting of $shrpdir
8793conflicts with the value of $archlibexp/CORE
8794that installperl will use.
8795EOM
8796		;;
8797	esac
8798	;;
8799esac
8800
8801# How will the perl executable find the installed shared $libperl?
8802# Add $xxx to ccdlflags.
8803# If we can't figure out a command-line option, use $shrpenv to
8804# set env LD_RUN_PATH.  The main perl makefile uses this.
8805shrpdir=$archlibexp/CORE
8806xxx=''
8807tmp_shrpenv=''
8808if "$useshrplib"; then
8809    case "$osname" in
8810	aix)
8811		# We'll set it in Makefile.SH...
8812		;;
8813	solaris)
8814		xxx="-R $shrpdir"
8815		;;
8816	freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8817		xxx="-Wl,-R$shrpdir"
8818		;;
8819	bsdos|linux|irix*|dec_osf|gnu*|haiku)
8820		xxx="-Wl,-rpath,$shrpdir"
8821		;;
8822	hpux*)
8823		# hpux doesn't like the default, either.
8824		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8825		;;
8826	cygwin)
8827		# cygwin needs only ldlibpth
8828		;;
8829	*)
8830		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8831		;;
8832	esac
8833	case "$xxx" in
8834	'') ;;
8835	*)
8836		# Only add $xxx if it isn't already in ccdlflags.
8837		case " $ccdlflags " in
8838		*" $xxx "*)	;;
8839		*)	ccdlflags="$ccdlflags $xxx"
8840			cat <<EOM >&4
8841
8842Adding $xxx to the flags
8843passed to $ld so that the perl executable will find the
8844installed shared $libperl.
8845
8846EOM
8847			;;
8848		esac
8849		;;
8850	esac
8851fi
8852# Fix ccdlflags in AIX for building external extensions.
8853# (For building Perl itself bare -bE:perl.exp is needed,
8854#  Makefile.SH takes care of this.)
8855case "$osname" in
8856aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8857esac
8858# Respect a hint or command-line value.
8859case "$shrpenv" in
8860'') shrpenv="$tmp_shrpenv" ;;
8861esac
8862case "$ldlibpthname" in
8863'')	ldlibpthname=LD_LIBRARY_PATH ;;
8864none)	ldlibpthname='' ;;
8865esac
8866
8867: determine where manual pages are on this system
8868echo " "
8869case "$sysman" in
8870'')
8871	syspath='/usr/share/man/man1 /usr/man/man1'
8872	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8873	syspath="$syspath /usr/man/u_man/man1"
8874	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8875	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8876	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8877	sysman=`./loc . /usr/man/man1 $syspath`
8878	;;
8879esac
8880if $test -d "$sysman"; then
8881	echo "System manual is in $sysman." >&4
8882else
8883	echo "Could not find manual pages in source form." >&4
8884fi
8885
8886: determine where manual pages go
8887set man1dir man1dir none
8888eval $prefixit
8889$cat <<EOM
8890
8891$spackage has manual pages available in source form.
8892EOM
8893case "$nroff" in
8894nroff)
8895	echo "However, you don't have nroff, so they're probably useless to you."
8896	case "$man1dir" in
8897	'') man1dir="none";;
8898	esac;;
8899esac
8900echo "If you don't want the manual sources installed, answer 'none'."
8901case "$man1dir" in
8902' ') dflt=none
8903	;;
8904'')
8905	lookpath="$prefixexp/share/man/man1"
8906	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8907	lookpath="$lookpath $prefixexp/man/p_man/man1"
8908	lookpath="$lookpath $prefixexp/man/u_man/man1"
8909	lookpath="$lookpath $prefixexp/man/man.1"
8910	case "$sysman" in
8911	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8912	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8913	esac
8914	set dflt
8915	eval $prefixup
8916	;;
8917*)  dflt="$man1dir"
8918	;;
8919esac
8920echo " "
8921fn=dn+~
8922rp="Where do the main $spackage manual pages (source) go?"
8923. ./getfile
8924if $test "X$man1direxp" != "X$ansexp"; then
8925	installman1dir=''
8926fi
8927prefixvar=man1dir
8928. ./setprefixvar
8929
8930case "$man1dir" in
8931'')	man1dir=' '
8932	installman1dir='';;
8933esac
8934
8935: What suffix to use on installed man pages
8936
8937case "$man1dir" in
8938' ')
8939	man1ext='0'
8940	;;
8941*)
8942	rp="What suffix should be used for the main $spackage man pages?"
8943	case "$man1ext" in
8944	'')	case "$man1dir" in
8945		*1)  dflt=1 ;;
8946		*1p) dflt=1p ;;
8947		*1pm) dflt=1pm ;;
8948		*l) dflt=l;;
8949		*n) dflt=n;;
8950		*o) dflt=o;;
8951		*p) dflt=p;;
8952		*C) dflt=C;;
8953		*L) dflt=L;;
8954		*L1) dflt=L1;;
8955		*) dflt=1;;
8956		esac
8957		;;
8958	*)	dflt="$man1ext";;
8959	esac
8960	. ./myread
8961	man1ext="$ans"
8962	;;
8963esac
8964
8965: see if we can have long filenames
8966echo " "
8967first=123456789abcdef
8968$rm -f $first
8969if (echo hi >$first) 2>/dev/null; then
8970	if $test -f 123456789abcde; then
8971		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8972		val="$undef"
8973	else
8974		echo 'You can have filenames longer than 14 characters.'>&4
8975		val="$define"
8976	fi
8977else
8978	$cat <<'EOM'
8979You can't have filenames longer than 14 chars.
8980You can't even think about them!
8981EOM
8982	val="$undef"
8983fi
8984set d_flexfnam
8985eval $setvar
8986$rm -rf 123456789abcde*
8987
8988: determine where library module manual pages go
8989set man3dir man3dir none
8990eval $prefixit
8991$cat <<EOM
8992
8993$spackage has manual pages for many of the library modules.
8994EOM
8995
8996case "$nroff" in
8997nroff)
8998	$cat <<'EOM'
8999However, you don't have nroff, so they're probably useless to you.
9000EOM
9001	case "$man3dir" in
9002	'') man3dir="none";;
9003	esac;;
9004esac
9005
9006case "$d_flexfnam" in
9007undef)
9008	$cat <<'EOM'
9009However, your system can't handle the long file names like File::Basename.3.
9010EOM
9011	case "$man3dir" in
9012	'') man3dir="none";;
9013	esac;;
9014esac
9015
9016echo "If you don't want the manual sources installed, answer 'none'."
9017prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9018case "$man3dir" in
9019'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9020	if $test -d "$privlib/man/man3"; then
9021		cat <<EOM >&4
9022
9023WARNING:  Previous versions of perl installed man3 pages into
9024$privlib/man/man3.  This version will suggest a
9025new default of $dflt.
9026EOM
9027		tdflt=$dflt
9028		dflt='n'
9029		rp='Do you wish to preserve the old behavior?(y/n)'
9030		. ./myread
9031		case "$ans" in
9032		y*) dflt="$privlib/man/man3" ;;
9033		*)  dflt=$tdflt ;;
9034		esac
9035    fi
9036	;;
9037*)	dflt="$man3dir" ;;
9038esac
9039case "$dflt" in
9040' ') dflt=none ;;
9041esac
9042echo " "
9043fn=dn+~
9044rp="Where do the $package library man pages (source) go?"
9045. ./getfile
9046prefixvar=man3dir
9047. ./setprefixvar
9048
9049case "$man3dir" in
9050'')	man3dir=' '
9051	installman3dir='';;
9052esac
9053
9054: What suffix to use on installed man pages
9055case "$man3dir" in
9056' ')
9057	man3ext='0'
9058	;;
9059*)
9060	rp="What suffix should be used for the $package library man pages?"
9061	case "$man3ext" in
9062	'')	case "$man3dir" in
9063		*3)  dflt=3 ;;
9064		*3p) dflt=3p ;;
9065		*3pm) dflt=3pm ;;
9066		*l) dflt=l;;
9067		*n) dflt=n;;
9068		*o) dflt=o;;
9069		*p) dflt=p;;
9070		*C) dflt=C;;
9071		*L) dflt=L;;
9072		*L3) dflt=L3;;
9073		*) dflt=3;;
9074		esac
9075		;;
9076	*)	dflt="$man3ext";;
9077	esac
9078	. ./myread
9079	man3ext="$ans"
9080	;;
9081esac
9082
9083: see if we have to deal with yellow pages, now NIS.
9084if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9085	case "$hostcat" in
9086	nidump*) ;;
9087	*)
9088		case "$hostcat" in
9089		*ypcat*) dflt=y;;
9090		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9091				dflt=y
9092			else
9093				dflt=n
9094			fi;;
9095		*) dflt=n;;
9096		esac
9097		echo " "
9098		rp='Are you getting the hosts file via yellow pages?'
9099		. ./myread
9100		case "$ans" in
9101		y*) hostcat='ypcat hosts';;
9102		*) hostcat='cat /etc/hosts';;
9103		esac
9104		;;
9105	esac
9106fi
9107case "$hostcat" in
9108'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9109esac
9110case "$groupcat" in
9111'') test -f /etc/group && groupcat='cat /etc/group';;
9112esac
9113case "$passcat" in
9114'') test -f /etc/passwd && passcat='cat /etc/passwd';;
9115esac
9116
9117: now get the host name
9118echo " "
9119echo "Figuring out host name..." >&4
9120case "$myhostname" in
9121'') cont=true
9122	echo 'Maybe "hostname" will work...'
9123	if tans=`sh -c hostname 2>&1` ; then
9124		myhostname=$tans
9125		phostname=hostname
9126		cont=''
9127	fi
9128	;;
9129*) cont='';;
9130esac
9131if $test "$cont"; then
9132	if ./xenix; then
9133		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9134		if tans=`cat /etc/systemid 2>&1` ; then
9135			myhostname=$tans
9136			phostname='cat /etc/systemid'
9137			echo "Whadyaknow.  Xenix always was a bit strange..."
9138			cont=''
9139		fi
9140	elif $test -r /etc/systemid; then
9141		echo "(What is a non-Xenix system doing with /etc/systemid?)"
9142	fi
9143fi
9144if $test "$cont"; then
9145	echo 'No, maybe "uuname -l" will work...'
9146	if tans=`sh -c 'uuname -l' 2>&1` ; then
9147		myhostname=$tans
9148		phostname='uuname -l'
9149	else
9150		echo 'Strange.  Maybe "uname -n" will work...'
9151		if tans=`sh -c 'uname -n' 2>&1` ; then
9152			myhostname=$tans
9153			phostname='uname -n'
9154		else
9155			echo 'Oh well, maybe I can mine it out of whoami.h...'
9156			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9157				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9158				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9159			else
9160				case "$myhostname" in
9161				'') echo "Does this machine have an identity crisis or something?"
9162					phostname='';;
9163				*)
9164					echo "Well, you said $myhostname before..."
9165					phostname='echo $myhostname';;
9166				esac
9167			fi
9168		fi
9169	fi
9170fi
9171case "$myhostname" in
9172'') myhostname=noname ;;
9173esac
9174: you do not want to know about this
9175set $myhostname
9176myhostname=$1
9177
9178: verify guess
9179if $test "$myhostname" ; then
9180	dflt=y
9181	rp='Your host name appears to be "'$myhostname'".'" Right?"
9182	. ./myread
9183	case "$ans" in
9184	y*) ;;
9185	*) myhostname='';;
9186	esac
9187fi
9188
9189: bad guess or no guess
9190while $test "X$myhostname" = X ; do
9191	dflt=''
9192	rp="Please type the (one word) name of your host:"
9193	. ./myread
9194	myhostname="$ans"
9195done
9196
9197: translate upper to lower if necessary
9198case "$myhostname" in
9199*[A-Z]*)
9200	echo "(Normalizing case in your host name)"
9201	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9202	;;
9203esac
9204
9205case "$myhostname" in
9206*.*)
9207	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9208	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9209	echo "(Trimming domain name from host name--host name is now $myhostname)"
9210	;;
9211*) case "$mydomain" in
9212	'')
9213		{
9214			test "X$hostcat" = "Xypcat hosts" &&
9215			ypmatch "$myhostname" hosts 2>/dev/null |\
9216				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
9217			$test -s hosts
9218		} || {
9219			test "X$hostcat" != "X" &&
9220			$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
9221					/[	 ]$myhostname[	. ]/p" > hosts
9222		}
9223		tmp_re="[	. ]"
9224		if $test -f hosts; then
9225			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
9226			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
9227			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9228				hosts | $sort | $uniq | \
9229				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9230			case `$echo X$dflt` in
9231			X*\ *)	echo "(Several hosts in the database matched hostname)"
9232				dflt=.
9233				;;
9234			X.) echo "(You do not have fully-qualified names in the hosts database)"
9235				;;
9236			esac
9237		else
9238			echo "(I cannot locate a hosts database anywhere)"
9239			dflt=.
9240		fi
9241		case "$dflt" in
9242		.)
9243			tans=`./loc resolv.conf X /etc /usr/etc`
9244			if $test -f "$tans"; then
9245				echo "(Attempting domain name extraction from $tans)"
9246				dflt=.`$sed -n -e 's/	/ /g' \
9247				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9248				  -e 1q 2>/dev/null`
9249				case "$dflt" in
9250				.) dflt=.`$sed -n -e 's/	/ /g' \
9251				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9252				     -e 1q 2>/dev/null`
9253					;;
9254				esac
9255			fi
9256			;;
9257		esac
9258		case "$dflt" in
9259		.) echo "(No help from resolv.conf either -- attempting clever guess)"
9260			dflt=.`sh -c domainname 2>/dev/null`
9261			case "$dflt" in
9262			'') dflt='.';;
9263			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9264			esac
9265			;;
9266		esac
9267		case "$dflt$osname" in
9268		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9269			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9270			;;
9271		esac
9272		case "$dflt" in
9273		.) echo "(Lost all hope -- silly guess then)"
9274			dflt='.nonet'
9275			;;
9276		esac
9277		$rm -f hosts
9278		;;
9279	*) dflt="$mydomain";;
9280	esac;;
9281esac
9282echo " "
9283rp="What is your domain name?"
9284. ./myread
9285tans="$ans"
9286case "$ans" in
9287'') ;;
9288.*) ;;
9289*) tans=".$tans";;
9290esac
9291mydomain="$tans"
9292
9293: translate upper to lower if necessary
9294case "$mydomain" in
9295*[A-Z]*)
9296	echo "(Normalizing case in your domain name)"
9297	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9298	;;
9299esac
9300
9301: a little sanity check here
9302case "$phostname" in
9303'') ;;
9304*)
9305	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9306	$myhostname$mydomain|$myhostname) ;;
9307	*)
9308		case "$phostname" in
9309		sed*)
9310			echo "(That doesn't agree with your whoami.h file, by the way.)"
9311			;;
9312		*)
9313			echo "(That doesn't agree with your $phostname command, by the way.)"
9314			;;
9315		esac
9316	;;
9317	esac
9318	;;
9319esac
9320
9321: determine the e-mail address of the user who is running us
9322$cat <<EOM
9323
9324I need to get your e-mail address in Internet format if possible, i.e.
9325something like user@host.domain. Please answer accurately since I have
9326no easy means to double check it. The default value provided below
9327is most probably close to reality but may not be valid from outside
9328your organization...
9329
9330EOM
9331cont=x
9332while test "$cont"; do
9333	case "$MAILDOMAIN" in
9334	'')
9335		if $test -s /etc/mailname; then
9336			maildomain=`$cat /etc/mailname`
9337		else
9338			maildomain="$myhostname$mydomain"
9339		fi
9340		;;
9341	*)  maildomain="$MAILDOMAIN";;
9342	esac
9343	case "$cf_email" in
9344	'') dflt="$cf_by@$maildomain";;
9345	*)  dflt="$cf_email";;
9346	esac
9347	rp='What is your e-mail address?'
9348	. ./myread
9349	cf_email="$ans"
9350	case "$cf_email" in
9351	*@*.*) cont='' ;;
9352	*)
9353		rp='Address does not look like an Internet one.  Use it anyway?'
9354		case "$fastread" in
9355		yes) dflt=y ;;
9356		*) dflt=n ;;
9357		esac
9358		. ./myread
9359		case "$ans" in
9360		y*) cont='' ;;
9361		*) echo " " ;;
9362		esac
9363		;;
9364	esac
9365done
9366
9367: Ask e-mail of administrator
9368$cat <<EOM
9369
9370If you or somebody else will be maintaining perl at your site, please
9371fill in the correct e-mail address here so that they may be contacted
9372if necessary. Currently, the "perlbug" program included with perl
9373will send mail to this address in addition to perlbug@perl.org. You may
9374enter "none" for no administrator.
9375
9376EOM
9377case "$perladmin" in
9378'') dflt="$cf_email";;
9379*) dflt="$perladmin";;
9380esac
9381rp='Perl administrator e-mail address'
9382. ./myread
9383perladmin="$ans"
9384
9385: determine whether to use a version number suffix for installed binaries
9386echo " "
9387$cat <<EOM
9388Do you want to use a version number suffix for installed binaries? This
9389will install 'perl$version' instead of 'perl', and likewise for other
9390binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9391to be installed side-by-side. Unless you are a developer, you probably
9392do *not* want to do this.
9393EOM
9394case "$versiononly" in
9395"$define"|[Yy]*|true) dflt='y' ;;
9396*) dflt='n';
9397esac
9398rp="Do you want to use a version number suffix for installed binaries?"
9399. ./myread
9400case "$ans" in
9401[yY]*)	val="$define";;
9402*)	val="$undef" ;;
9403esac
9404set versiononly
9405eval $setvar
9406
9407case "$versiononly" in
9408"$define") inc_version_list=''
9409           inc_version_list_init=0
9410           ;;
9411esac
9412
9413: figure out how to guarantee perl startup
9414: XXX Note that this currently takes advantage of the bug that binexp ignores
9415:     the Configure -Dinstallprefix setting, which in turn means that under
9416:     relocatable @INC, initialinstalllocation is what binexp started as.
9417case "$startperl" in
9418'')
9419	case "$sharpbang" in
9420	*!)
9421		$cat <<EOH
9422
9423I can use the #! construct to start perl on your system. This will
9424make startup of perl scripts faster, but may cause problems if you
9425want to share those scripts and perl is not in a standard place
9426($initialinstalllocation/perl) on all your platforms. The alternative
9427is to force a shell by starting the script with a single ':' character.
9428
9429EOH
9430		case "$versiononly" in
9431		"$define")      dflt="$initialinstalllocation/perl$version";;
9432		*)              dflt="$initialinstalllocation/perl";;
9433		esac
9434		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9435		. ./myread
9436		case "$ans" in
9437		none)	startperl=": # use perl";;
9438		*)	startperl="#!$ans"
9439			if $test 30 -lt `echo "$ans" | wc -c`; then
9440				$cat >&4 <<EOM
9441
9442WARNING:  Some systems limit the #! command to 32 characters.
9443If you experience difficulty running Perl scripts with #!, try
9444installing Perl in a directory with a shorter pathname.
9445
9446EOM
9447			fi ;;
9448		esac
9449		;;
9450	*) startperl=": # use perl"
9451		;;
9452	esac
9453	;;
9454esac
9455echo "I'll use $startperl to start perl scripts."
9456
9457: figure best path for perl in scripts
9458case "$perlpath" in
9459'')
9460	case "$versiononly" in
9461	"$define")	perlpath="$initialinstalllocation/perl$version";;
9462	*)		perlpath="$initialinstalllocation/perl";;
9463	esac
9464	case "$startperl" in
9465	*!*) ;;
9466	*)
9467		$cat <<EOH
9468
9469I will use the "eval 'exec'" idiom to start Perl on your system.
9470I can use the full path of your Perl binary for this purpose, but
9471doing so may cause problems if you want to share those scripts and
9472Perl is not always in a standard place ($initialinstalllocation/perl).
9473
9474EOH
9475		dflt="$initialinstalllocation/perl"
9476		rp="What path shall I use in \"eval 'exec'\"?"
9477		. ./myread
9478		perlpath="$ans"
9479		;;
9480	esac
9481	;;
9482esac
9483case "$startperl" in
9484*!*)	;;
9485*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9486esac
9487
9488: determine where public executable scripts go
9489set scriptdir scriptdir
9490eval $prefixit
9491case "$scriptdir" in
9492'')
9493	dflt="$bin"
9494	: guess some guesses
9495	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9496	$test -d /usr/share/bin     && dflt=/usr/share/bin
9497	$test -d /usr/local/script  && dflt=/usr/local/script
9498	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9499	$test -d $prefixexp/script  && dflt=$prefixexp/script
9500	set dflt
9501	eval $prefixup
9502	;;
9503*)  dflt="$scriptdir"
9504	;;
9505esac
9506$cat <<EOM
9507
9508Some installations have a separate directory just for executable scripts so
9509that they can mount it across multiple architectures but keep the scripts in
9510one spot.  You might, for example, have a subdirectory of /usr/share for this.
9511Or you might just lump your scripts in with all your other executables.
9512
9513EOM
9514fn=d~
9515rp='Where do you keep publicly executable scripts?'
9516. ./getfile
9517if $test "X$ansexp" != "X$scriptdirexp"; then
9518	installscript=''
9519fi
9520installscriptdir=''
9521prefixvar=scriptdir
9522. ./setprefixvar
9523: A little fix up for an irregularly named variable.
9524installscript="$installscriptdir"
9525
9526: determine where add-on public executables go
9527case "$sitebin" in
9528'')	dflt=$siteprefix/bin ;;
9529*)	dflt=$sitebin ;;
9530esac
9531fn=d~
9532rp='Pathname where the add-on public executables should be installed?'
9533. ./getfile
9534prefixvar=sitebin
9535. ./setprefixvar
9536
9537: determine where add-on html pages go
9538: There is no standard location, so try to copy the previously-selected
9539: directory structure for the core html pages.
9540case "$sitehtml1dir" in
9541'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9542*)     dflt=$sitehtml1dir ;;
9543esac
9544case "$dflt" in
9545''|' ') dflt=none ;;
9546esac
9547fn=dn+~
9548rp='Pathname where the site-specific html pages should be installed?'
9549. ./getfile
9550prefixvar=sitehtml1dir
9551. ./setprefixvar
9552
9553: determine where add-on library html pages go
9554: There is no standard location, so try to copy the previously-selected
9555: directory structure for the core html pages.
9556case "$sitehtml3dir" in
9557'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9558*)     dflt=$sitehtml3dir ;;
9559esac
9560case "$dflt" in
9561''|' ') dflt=none ;;
9562esac
9563fn=dn+~
9564rp='Pathname where the site-specific library html pages should be installed?'
9565. ./getfile
9566prefixvar=sitehtml3dir
9567. ./setprefixvar
9568
9569: determine where add-on manual pages go
9570case "$siteman1dir" in
9571'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9572*)	dflt=$siteman1dir ;;
9573esac
9574case "$dflt" in
9575''|' ') dflt=none ;;
9576esac
9577fn=dn+~
9578rp='Pathname where the site-specific manual pages should be installed?'
9579. ./getfile
9580prefixvar=siteman1dir
9581. ./setprefixvar
9582
9583: determine where add-on library man pages go
9584case "$siteman3dir" in
9585'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9586*)	dflt=$siteman3dir ;;
9587esac
9588case "$dflt" in
9589''|' ') dflt=none ;;
9590esac
9591fn=dn+~
9592rp='Pathname where the site-specific library manual pages should be installed?'
9593. ./getfile
9594prefixvar=siteman3dir
9595. ./setprefixvar
9596
9597: determine where add-on public executable scripts go
9598case "$sitescript" in
9599'')	dflt=$sitebin ;;
9600*)  dflt="$sitescript" ;;
9601esac
9602fn=d~+
9603rp='Pathname where add-on public executable scripts should be installed?'
9604. ./getfile
9605prefixvar=sitescript
9606. ./setprefixvar
9607
9608: see if backtrace exists
9609set backtrace d_backtrace
9610eval $inlibc
9611
9612: add flags if using c backtrace
9613case "$usecbacktrace" in
9614  "") usecbacktrace=$undef ;;
9615  [yY]*|true|$define)
9616    case "$d_backtrace" in
9617      [yY]*|true|$define)
9618        case " $ccflags " in
9619	  *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9620	  *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9621	  esac
9622        ;;
9623      *)
9624        echo "This system does not support backtrace" >&4
9625        usecbacktrace=$undef
9626        ;;
9627      esac
9628    ;;
9629  esac
9630
9631: Check if faststdio is requested and available
9632case "$usefaststdio" in
9633$define|true|[yY]*|'')
9634	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9635	case "$xversion" in
9636	[68])	dflt='y' ;;
9637	*)	dflt='n' ;;
9638	esac
9639	;;
9640*) dflt='n';;
9641esac
9642cat <<EOM
9643
9644Perl can be built to use 'fast stdio', which means using the stdio
9645library but also directly manipulating the stdio buffers to enable
9646faster I/O.  Using stdio is better for backward compatibility (especially
9647for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9648interface has been preferred instead of stdio.
9649
9650If this doesn't make any sense to you, just accept the default '$dflt'.
9651EOM
9652rp='Use the "fast stdio" if available?'
9653. ./myread
9654case "$ans" in
9655y|Y)	val="$define" ;;
9656*)      val="$undef" ;;
9657esac
9658set usefaststdio
9659eval $setvar
9660
9661: define an is-a-typedef? function
9662typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9663case "$inclist" in
9664"") inclist="sys/types.h";;
9665esac;
9666eval "varval=\$$var";
9667case "$varval" in
9668"")
9669	$rm -f temp.c;
9670	for inc in $inclist; do
9671		echo "#include <$inc>" >>temp.c;
9672	done;
9673	echo "#ifdef $type" >> temp.c;
9674	echo "printf(\"We have $type\");" >> temp.c;
9675	echo "#endif" >> temp.c;
9676	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9677	if $contains $type temp.E >/dev/null 2>&1; then
9678		eval "$var=\$type";
9679	else
9680		eval "$var=\$def";
9681	fi;
9682	$rm -f temp.?;;
9683*) eval "$var=\$varval";;
9684esac'
9685
9686: define an is-a-typedef? function that prompts if the type is not available.
9687typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9688case "$inclist" in
9689"") inclist="sys/types.h";;
9690esac;
9691eval "varval=\$$var";
9692case "$varval" in
9693"")
9694	$rm -f temp.c;
9695	for inc in $inclist; do
9696		echo "#include <$inc>" >>temp.c;
9697	done;
9698	echo "#ifdef $type" >> temp.c;
9699	echo "printf(\"We have $type\");" >> temp.c;
9700	echo "#endif" >> temp.c;
9701	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9702	echo " " ;
9703	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9704	if $contains $type temp.E >/dev/null 2>&1; then
9705		echo "$type found." >&4;
9706		eval "$var=\$type";
9707	else
9708		echo "$type NOT found." >&4;
9709		dflt="$def";
9710		. ./myread ;
9711		eval "$var=\$ans";
9712	fi;
9713	$rm -f temp.?;;
9714*) eval "$var=\$varval";;
9715esac'
9716
9717: see what type lseek is declared as in the kernel
9718rp="What is the type used for lseek's offset on this system?"
9719set off_t lseektype long stdio.h sys/types.h
9720eval $typedef_ask
9721
9722echo " "
9723echo "Checking to see how big your file offsets are..." >&4
9724$cat >try.c <<EOCP
9725#include <sys/types.h>
9726#include <stdio.h>
9727int main()
9728{
9729    printf("%d\n", (int)sizeof($lseektype));
9730    return(0);
9731}
9732EOCP
9733set try
9734if eval $compile_ok; then
9735	lseeksize=`$run ./try`
9736	echo "Your file offsets are $lseeksize bytes long."
9737else
9738	dflt=$longsize
9739	echo " "
9740	echo "(I can't seem to compile the test program.  Guessing...)"
9741	rp="What is the size of your file offsets (in bytes)?"
9742	. ./myread
9743	lseeksize="$ans"
9744fi
9745$rm_try
9746
9747: see what type file positions are declared as in the library
9748rp="What is the type for file position used by fsetpos()?"
9749set fpos_t fpostype long stdio.h sys/types.h
9750eval $typedef_ask
9751
9752: Check size for Fpos_t
9753echo " "
9754case "$fpostype" in
9755*_t) zzz="$fpostype"	;;
9756*)   zzz="fpos_t"	;;
9757esac
9758echo "Checking the size of $zzz..." >&4
9759cat > try.c <<EOCP
9760#include <sys/types.h>
9761#include <stdio.h>
9762#$i_stdlib I_STDLIB
9763#ifdef I_STDLIB
9764#include <stdlib.h>
9765#endif
9766int main() {
9767    printf("%d\n", (int)sizeof($fpostype));
9768    exit(0);
9769}
9770EOCP
9771set try
9772if eval $compile_ok; then
9773	yyy=`$run ./try`
9774	case "$yyy" in
9775	'')	fpossize=4
9776		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9777		;;
9778	*)	fpossize=$yyy
9779		echo "Your $zzz is $fpossize bytes long."
9780		;;
9781	esac
9782else
9783	dflt="$longsize"
9784	echo " " >&4
9785	echo "(I can't compile the test program.  Guessing...)" >&4
9786	rp="What is the size of your file positions (in bytes)?"
9787	. ./myread
9788	fpossize="$ans"
9789fi
9790
9791: Check for large file support
9792# Backward compatibility (uselfs is deprecated).
9793case "$uselfs" in
9794"$define"|true|[yY]*)
9795	cat <<EOM >&4
9796
9797*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9798EOM
9799	uselargefiles="$define"
9800	;;
9801esac
9802
9803case "$lseeksize:$fpossize" in
98048:8) cat <<EOM
9805
9806You can have files larger than 2 gigabytes.
9807EOM
9808   val="$define" ;;
9809*)    case "$uselargefiles" in
9810   "$undef"|false|[nN]*) dflt='n' ;;
9811   *)	dflt='y' ;;
9812   esac
9813   cat <<EOM
9814
9815Perl can be built to understand large files (files larger than 2 gigabytes)
9816on some systems.  To do so, Configure can be run with -Duselargefiles.
9817
9818If this doesn't make any sense to you, just accept the default '$dflt'.
9819EOM
9820   rp='Try to understand large files, if available?'
9821   . ./myread
9822   case "$ans" in
9823   y|Y)	val="$define" ;;
9824   *)	val="$undef"  ;;
9825   esac
9826   ;;
9827esac
9828set uselargefiles
9829eval $setvar
9830: Look for a hint-file generated 'call-back-unit'.  If the
9831: user has specified that a large files perl is to be built,
9832: we may need to set or change some other defaults.
9833if $test -f uselargefiles.cbu; then
9834	echo "Your platform has some specific hints regarding large file builds, using them..."
9835	. ./uselargefiles.cbu
9836fi
9837case "$uselargefiles" in
9838"$define")
9839	if $test -f uselargefiles.cbu; then
9840		echo " "
9841		echo "Rechecking to see how big your file offsets are..." >&4
9842		$cat >try.c <<EOCP
9843#include <sys/types.h>
9844#include <stdio.h>
9845int main()
9846{
9847    printf("%d\n", (int)sizeof($lseektype));
9848    return(0);
9849}
9850EOCP
9851		set try
9852		if eval $compile_ok; then
9853			lseeksize=`$run ./try`
9854			$echo "Your file offsets are now $lseeksize bytes long."
9855		else
9856			dflt="$lseeksize"
9857			echo " "
9858			echo "(I can't seem to compile the test program.  Guessing...)"
9859			rp="What is the size of your file offsets (in bytes)?"
9860			. ./myread
9861			lseeksize="$ans"
9862		fi
9863		case "$fpostype" in
9864		*_t) zzz="$fpostype"	;;
9865		*)   zzz="fpos_t"	;;
9866		esac
9867		$echo $n "Rechecking the size of $zzz...$c" >&4
9868		$cat > try.c <<EOCP
9869#include <sys/types.h>
9870#include <stdio.h>
9871#$i_stdlib I_STDLIB
9872#ifdef I_STDLIB
9873#include <stdlib.h>
9874#endif
9875int main() {
9876    printf("%d\n", (int)sizeof($fpostype));
9877    return(0);
9878}
9879EOCP
9880		set try
9881		if eval $compile_ok; then
9882			yyy=`$run ./try`
9883			dflt="$lseeksize"
9884			case "$yyy" in
9885			'')	echo " "
9886				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9887				;;
9888			*)	fpossize=$yyy
9889				echo " $fpossize bytes." >&4
9890				;;
9891			esac
9892		else
9893			dflt="$fpossize"
9894			echo " "
9895			echo "(I can't compile the test program.  Guessing...)" >&4
9896			rp="What is the size of your file positions (in bytes)?"
9897			. ./myread
9898			fpossize="$ans"
9899		fi
9900		$rm_try
9901	fi
9902	;;
9903esac
9904
9905: Check if we want perlio
9906useperlio="$define"
9907
9908: Set the vendorbin variables
9909case "$vendorprefix" in
9910'')	d_vendorbin="$undef"
9911	vendorbin=''
9912	vendorbinexp=''
9913	;;
9914*)	d_vendorbin="$define"
9915	: determine where vendor-supplied executables go.
9916	case "$vendorbin" in
9917	'') dflt=$vendorprefix/bin ;;
9918	*)	dflt="$vendorbin" ;;
9919	esac
9920	fn=d~+
9921	rp='Pathname for the vendor-supplied executables directory?'
9922	. ./getfile
9923	vendorbin="$ans"
9924	vendorbinexp="$ansexp"
9925	;;
9926esac
9927prefixvar=vendorbin
9928. ./installprefix
9929
9930: Set the vendorhtml1dir variables
9931case "$vendorprefix" in
9932'')	vendorhtml1dir=''
9933	vendorhtml1direxp=''
9934	;;
9935*)	: determine where vendor-supplied html pages go.
9936	: There is no standard location, so try to copy the previously-selected
9937	: directory structure for the core html pages.
9938	: XXX Better default suggestions would be welcome.
9939	case "$vendorhtml1dir" in
9940	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9941	*)	dflt=$vendorhtml1dir ;;
9942	esac
9943	case "$dflt" in
9944	''|' ') dflt=none ;;
9945	esac
9946	fn=dn+~
9947	rp='Pathname for the vendor-supplied html pages?'
9948	. ./getfile
9949	vendorhtml1dir="$ans"
9950	vendorhtml1direxp="$ansexp"
9951	;;
9952esac
9953: Use ' ' for none so value is preserved next time through Configure
9954$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9955prefixvar=vendorhtml1dir
9956. ./installprefix
9957
9958: Set the vendorhtml3dir variables
9959case "$vendorprefix" in
9960'')	vendorhtml3dir=''
9961	vendorhtml3direxp=''
9962	;;
9963*)	: determine where vendor-supplied module html pages go.
9964	: There is no standard location, so try to copy the previously-selected
9965	: directory structure for the core html pages.
9966	: XXX Better default suggestions would be welcome.
9967	case "$vendorhtml3dir" in
9968	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9969	*)	dflt=$vendorhtml3dir ;;
9970	esac
9971	case "$dflt" in
9972	''|' ') dflt=none ;;
9973	esac
9974	fn=dn+~
9975	rp='Pathname for the vendor-supplied html pages?'
9976	. ./getfile
9977	vendorhtml3dir="$ans"
9978	vendorhtml3direxp="$ansexp"
9979	;;
9980esac
9981: Use ' ' for none so value is preserved next time through Configure
9982$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9983prefixvar=vendorhtml3dir
9984. ./installprefix
9985
9986: Set the vendorman1dir variables
9987case "$vendorprefix" in
9988'')	vendorman1dir=''
9989	vendorman1direxp=''
9990	;;
9991*)	: determine where vendor-supplied manual pages go.
9992	case "$vendorman1dir" in
9993	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9994	*)	dflt=$vendorman1dir ;;
9995	esac
9996	case "$dflt" in
9997	''|' ') dflt=none ;;
9998	esac
9999	fn=nd~+
10000	rp='Pathname for the vendor-supplied manual section 1 pages?'
10001	. ./getfile
10002	vendorman1dir="$ans"
10003	vendorman1direxp="$ansexp"
10004	;;
10005esac
10006: Use ' ' for none so value is preserved next time through Configure
10007$test X"$vendorman1dir" = "X" && vendorman1dir=' '
10008prefixvar=vendorman1dir
10009. ./installprefix
10010
10011: Set the vendorman3dir variables
10012case "$vendorprefix" in
10013'')	vendorman3dir=''
10014	vendorman3direxp=''
10015	;;
10016*)	: determine where vendor-supplied module manual pages go.
10017	case "$vendorman3dir" in
10018	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10019	*)	dflt=$vendorman3dir ;;
10020	esac
10021	case "$dflt" in
10022	''|' ') dflt=none ;;
10023	esac
10024	fn=nd~+
10025	rp='Pathname for the vendor-supplied manual section 3 pages?'
10026	. ./getfile
10027	vendorman3dir="$ans"
10028	vendorman3direxp="$ansexp"
10029	;;
10030esac
10031: Use ' ' for none so value is preserved next time through Configure
10032$test X"$vendorman3dir" = "X" && vendorman3dir=' '
10033prefixvar=vendorman3dir
10034. ./installprefix
10035
10036: Set the vendorscript variables
10037case "$vendorprefix" in
10038'')	d_vendorscript="$undef"
10039	vendorscript=''
10040	vendorscriptexp=''
10041	;;
10042*)	d_vendorscript="$define"
10043	: determine where vendor-supplied scripts go.
10044	case "$vendorscript" in
10045	'')	dflt=$vendorprefix/script
10046		$test -d $dflt || dflt=$vendorbin ;;
10047	*)  dflt="$vendorscript" ;;
10048	esac
10049	$cat <<EOM
10050
10051The installation process will create a directory for
10052vendor-supplied scripts.
10053
10054EOM
10055	fn=d~+
10056	rp='Pathname for the vendor-supplied scripts directory?'
10057	. ./getfile
10058	vendorscript="$ans"
10059	vendorscriptexp="$ansexp"
10060	;;
10061esac
10062prefixvar=vendorscript
10063. ./installprefix
10064
10065: see if qgcvt exists
10066set qgcvt d_qgcvt
10067eval $inlibc
10068
10069: Check what kind of doubles your system has
10070$echo "Checking the kind of doubles you have..." >&4
10071$cat >try.c <<EOP
10072#$i_stdlib I_STDLIB
10073#define DOUBLESIZE $doublesize
10074#ifdef I_STDLIB
10075#include <stdlib.h>
10076#endif
10077#include <stdio.h>
10078static const double d = -0.1;
10079int main() {
10080  unsigned const char* b = (unsigned const char*)(&d);
10081#if DOUBLESIZE == 4
10082  if (b[0] == 0xCD && b[3] == 0xBD) {
10083    /* IEEE 754 32-bit little-endian */
10084    printf("1\n");
10085    exit(0);
10086  }
10087  if (b[0] == 0xBD && b[3] == 0xCD) {
10088    /* IEEE 754 32-bit big-endian */
10089    printf("2\n");
10090    exit(0);
10091  }
10092  if (b[0] == 0xCC && b[3] == 0xCC) {
10093    /* VAX format F, 32-bit PDP-style mixed endian. */
10094    printf("9\n");
10095    exit(0);
10096  }
10097  if (b[0] == 0xC0 && b[3] == 0x9A) {
10098    /* IBM single 32-bit */
10099    printf("12\n");
10100    exit(0);
10101  }
10102#endif
10103#if DOUBLESIZE == 8
10104  if (b[0] == 0x9A && b[7] == 0xBF) {
10105    /* IEEE 754 64-bit little-endian */
10106    printf("3\n");
10107    exit(0);
10108  }
10109  if (b[0] == 0xBF && b[7] == 0x9A) {
10110    /* IEEE 754 64-bit big-endian */
10111    printf("4\n");
10112    exit(0);
10113  }
10114  if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10115   /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10116    * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10117    * 99 99 b9 bf 9a 99 99 99 */
10118    printf("7\n");
10119    exit(0);
10120  }
10121  if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10122   /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10123    * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10124    * 99 99 99 9a bf b9 99 99 */
10125    printf("8\n");
10126    exit(0);
10127  }
10128  if (b[0] == 0xCC && b[7] == 0xCC) {
10129   /* VAX format D, 64-bit PDP-style mixed endian. */
10130    printf("10\n");
10131    exit(0);
10132  }
10133  if (b[0] == 0xD9 && b[7] == 0x99) {
10134   /* VAX format G, 64-bit PDP-style mixed endian. */
10135    printf("11\n");
10136    exit(0);
10137  }
10138  if (b[0] == 0xC0 && b[7] == 0x9A) {
10139    /* IBM double 64-bit */
10140    printf("13\n");
10141    exit(0);
10142  }
10143  if (b[0] == 0xBF && b[7] == 0xCD) {
10144    /* CRAY single 64-bit */
10145    printf("14\n");
10146    exit(0);
10147  }
10148#endif
10149#if DOUBLESIZE == 16
10150  if (b[0] == 0x9A && b[15] == 0xBF) {
10151    /* IEEE 754 128-bit little-endian */
10152    printf("5\n");
10153    exit(0);
10154  }
10155  if (b[0] == 0xBF && b[15] == 0x9A) {
10156    /* IEEE 754 128-bit big-endian */
10157    printf("6\n");
10158    exit(0);
10159  }
10160#endif
10161  /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10162   * Whether those environments can still build Perl is debatable. */
10163  printf("-1\n"); /* unknown */
10164  exit(0);
10165}
10166EOP
10167set try
10168if eval $compile; then
10169    doublekind=`$run ./try`
10170else
10171    doublekind=-1
10172fi
10173case "$doublekind" in
101741) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
101752) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
101763) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
101774) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
101785) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
101796) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
101807) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
101818) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
101829) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
1018310) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
1018411) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
1018512) echo "You have IBM short 32-bit doubles." >&4 ;;
1018613) echo "You have IBM long 64-bit doubles." >&4 ;;
1018714) echo "You have Cray single 64-bit doubles." >&4 ;;
10188*) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10189esac
10190d_double_style_ieee=$undef
10191d_double_style_vax=$undef
10192d_double_style_ibm=$undef
10193d_double_style_cray=$undef
10194case "$doublekind" in
101951|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
101969|10|11) d_double_style_vax=$define ;;
1019712|13) d_double_style_ibm=$define ;;
1019814) d_double_style_cray=$define ;;
10199esac
10200case "$d_double_style_ieee" in
10201$define)
10202    d_double_has_inf=$define
10203    d_double_has_nan=$define
10204    d_double_has_negative_zero=$define
10205    d_double_has_subnormals=$define
10206    ;;
10207*)
10208    d_double_has_inf=$undef
10209    d_double_has_nan=$undef
10210    d_double_has_negative_zero=$undef
10211    d_double_has_subnormals=$undef
10212    ;;
10213esac
10214$rm_try
10215
10216: Check print/scan long double stuff
10217echo " "
10218
10219if $test X"$d_longdbl" = X"$define"; then
10220
10221echo "Checking how to print long doubles..." >&4
10222
10223if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10224	$cat >try.c <<'EOCP'
10225#include <sys/types.h>
10226#include <stdio.h>
10227int main() {
10228  double d = 123.456;
10229  printf("%.3f\n", d);
10230}
10231EOCP
10232	set try
10233	if eval $compile; then
10234		yyy=`$run ./try`
10235		case "$yyy" in
10236		123.456)
10237			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10238			sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10239			echo "We will use %f."
10240			;;
10241		esac
10242	fi
10243fi
10244
10245if $test X"$sPRIfldbl" = X; then
10246	$cat >try.c <<'EOCP'
10247#include <sys/types.h>
10248#include <stdio.h>
10249int main() {
10250  long double d = 123.456;
10251  printf("%.3Lf\n", d);
10252}
10253EOCP
10254	set try
10255	if eval $compile; then
10256		yyy=`$run ./try`
10257		case "$yyy" in
10258		123.456)
10259			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10260			sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10261			echo "We will use %Lf."
10262			;;
10263		esac
10264	fi
10265fi
10266
10267if $test X"$sPRIfldbl" = X; then
10268	$cat >try.c <<'EOCP'
10269#include <sys/types.h>
10270#include <stdio.h>
10271int main() {
10272  long double d = 123.456;
10273  printf("%.3llf\n", d);
10274}
10275EOCP
10276	set try
10277	if eval $compile; then
10278		yyy=`$run ./try`
10279		case "$yyy" in
10280		123.456)
10281			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10282			sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10283			echo "We will use %llf."
10284			;;
10285		esac
10286	fi
10287fi
10288
10289if $test X"$sPRIfldbl" = X; then
10290	$cat >try.c <<'EOCP'
10291#include <sys/types.h>
10292#include <stdio.h>
10293int main() {
10294  long double d = 123.456;
10295  printf("%.3lf\n", d);
10296}
10297EOCP
10298	set try
10299	if eval $compile; then
10300		yyy=`$run ./try`
10301		case "$yyy" in
10302		123.456)
10303			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10304			sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10305			echo "We will use %lf."
10306			;;
10307		esac
10308	fi
10309fi
10310
10311if $test X"$sPRIfldbl" = X; then
10312	echo "Cannot figure out how to print long doubles." >&4
10313else
10314	sSCNfldbl=$sPRIfldbl	# expect consistency
10315fi
10316
10317$rm_try
10318
10319fi # d_longdbl
10320
10321case "$sPRIfldbl" in
10322'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10323	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10324	d_SCNfldbl="$undef";
10325	;;
10326*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10327	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10328	d_SCNfldbl="$define";
10329	;;
10330esac
10331
10332: Before committing on uselongdouble, see whether that looks sane.
10333if $test "$uselongdouble" = "$define"; then
10334    message=""
10335    echo " "
10336    echo "Checking if your long double math functions work right..." >&4
10337    $cat > try.c <<EOF
10338#include <math.h>
10339#include <stdio.h>
10340int main() {
10341  printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10342}
10343EOF
10344    case "$osname:$gccversion" in
10345    aix:)	saveccflags="$ccflags"
10346		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10347    esac
10348    set try
10349    if eval $compile_ok; then
10350      yyy=`$run ./try`
10351    fi
10352    case "$yyy" in
10353    3) echo "Your long double math functions are working correctly." >&4 ;;
10354    *) echo "Your long double math functions are broken, not using long doubles." >&4
10355       uselongdouble=$undef
10356       ;;
10357    esac
10358    $rm_try
10359    case "$osname:$gccversion" in
10360    aix:)	ccflags="$saveccflags" ;; # restore
10361    esac
10362fi
10363
10364: Check how to convert floats to strings.
10365
10366if test "X$d_Gconvert" = X; then
10367
10368echo " "
10369echo "Checking for an efficient way to convert floats to strings."
10370echo " " > try.c
10371case "$uselongdouble" in
10372"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10373esac
10374case "$d_longdbl" in
10375"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10376esac
10377case "$d_PRIgldbl" in
10378"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10379esac
10380$cat >>try.c <<EOP
10381#ifdef TRY_gconvert
10382#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10383char *myname = "gconvert";
10384#endif
10385#ifdef TRY_gcvt
10386#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10387char *myname = "gcvt";
10388#endif
10389#ifdef TRY_qgcvt
10390#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10391char *myname = "qgcvt";
10392#define DOUBLETYPE long double
10393#endif
10394#ifdef TRY_sprintf
10395#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10396#ifdef HAS_PRIgldbl
10397#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10398#else
10399#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10400#endif
10401#else
10402#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10403#endif
10404char *myname = "sprintf";
10405#endif
10406
10407#ifndef DOUBLETYPE
10408#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10409#define DOUBLETYPE long double
10410#else
10411#define DOUBLETYPE double
10412#endif
10413#endif
10414
10415#include <stdio.h>
10416
10417#$i_stdlib I_STDLIB
10418#ifdef I_STDLIB
10419#include <stdlib.h>
10420#endif
10421#include <string.h>
10422
10423int checkit(char *expect, char *got)
10424{
10425    if (strcmp(expect, got)) {
10426		printf("%s oddity:  Expected %s, got %s\n",
10427			myname, expect, got);
10428		exit(1);
10429	}
10430}
10431
10432int main()
10433{
10434	char buf[64];
10435	buf[63] = '\0';
10436
10437	/* This must be 1st test on (which?) platform */
10438	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10439	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10440	checkit("0.1", buf);
10441
10442	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10443	checkit("0.01", buf);
10444
10445	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10446	checkit("0.001", buf);
10447
10448	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10449	checkit("0.0001", buf);
10450
10451	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10452	if (strlen(buf) > 5)
10453	    checkit("9e-005", buf); /* for Microsoft ?? */
10454	else
10455	    checkit("9e-05", buf);
10456
10457	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10458	checkit("1", buf);
10459
10460	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10461	checkit("1.1", buf);
10462
10463	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10464	checkit("1.01", buf);
10465
10466	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10467	checkit("1.001", buf);
10468
10469	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10470	checkit("1.0001", buf);
10471
10472	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10473	checkit("1.00001", buf);
10474
10475	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10476	checkit("1.000001", buf);
10477
10478	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10479	checkit("0", buf);
10480
10481	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10482	checkit("-1", buf);
10483
10484	/* Some Linux gcvt's give 1.e+5 here. */
10485	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10486	checkit("100000", buf);
10487
10488	/* Some Linux gcvt's give -1.e+5 here. */
10489	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10490	checkit("-100000", buf);
10491
10492	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10493	checkit("123.456", buf);
10494
10495	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10496	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10497	/* 34 should be enough to scare even long double
10498	 * places into using the e notation. */
10499	if (strlen(buf) > 5)
10500	    checkit("1e+034", buf); /* for Microsoft */
10501	else
10502	    checkit("1e+34", buf);
10503
10504	/* For Perl, if you add additional tests here, also add them to
10505	 * t/base/num.t for benefit of platforms not using Configure or
10506	 * overriding d_Gconvert */
10507
10508	exit(0);
10509}
10510EOP
10511: first add preferred functions to our list
10512xxx_list=""
10513for xxx_convert in $gconvert_preference; do
10514    case $xxx_convert in
10515    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10516    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10517    esac
10518done
10519: then add any others
10520for xxx_convert in gconvert gcvt sprintf; do
10521    case "$xxx_list" in
10522    *$xxx_convert*) ;;
10523    *) xxx_list="$xxx_list $xxx_convert" ;;
10524    esac
10525done
10526
10527case "$d_longdbl$uselongdouble" in
10528"$define$define")
10529    : again, add preferred functions to our list first
10530    xxx_ld_list=""
10531    for xxx_convert in $gconvert_ld_preference; do
10532        case $xxx_convert in
10533        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10534        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10535        esac
10536    done
10537    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10538    for xxx_convert in qgcvt sprintf $xxx_list; do
10539        case "$xxx_ld_list" in
10540        $xxx_convert*|*" $xxx_convert"*) ;;
10541        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10542        esac
10543    done
10544    : if sprintf cannot do long doubles, move it to the end
10545    if test "$d_PRIgldbl" != "$define"; then
10546        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10547    fi
10548    : if no qgcvt, remove it
10549    if test "$d_qgcvt" != "$define"; then
10550        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10551    fi
10552    : use the ld_list
10553    xxx_list="$xxx_ld_list"
10554    ;;
10555esac
10556
10557for xxx_convert in $xxx_list; do
10558	echo "Trying $xxx_convert..."
10559	$rm -f try try$_o core
10560	set try -DTRY_$xxx_convert
10561	if eval $compile; then
10562		echo "$xxx_convert() found." >&4
10563		if $run ./try; then
10564			echo "I'll use $xxx_convert to convert floats into a string." >&4
10565			break;
10566		else
10567			echo "...But $xxx_convert didn't work as I expected."
10568			xxx_convert=''
10569		fi
10570	else
10571		echo "$xxx_convert NOT found." >&4
10572	fi
10573done
10574
10575if test X$xxx_convert = X; then
10576    echo "*** WHOA THERE!!! ***" >&4
10577    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10578    xxx_convert=sprintf
10579fi
10580
10581case "$xxx_convert" in
10582gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10583gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10584qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10585*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10586   "$define$define$define")
10587      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10588   "$define$define$undef")
10589      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10590   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10591   esac
10592   ;;
10593esac
10594
10595fi
10596$rm_try
10597
10598: see if _fwalk exists
10599set fwalk d__fwalk
10600eval $inlibc
10601
10602: see if accept4 exists
10603set accept4 d_accept4
10604eval $inlibc
10605
10606: Initialize h_fcntl
10607h_fcntl=false
10608
10609: Initialize h_sysfile
10610h_sysfile=false
10611
10612: access call always available on UNIX
10613set access d_access
10614eval $inlibc
10615
10616: locate the flags for 'access()'
10617case "$d_access" in
10618"$define")
10619	echo " "
10620	$cat >access.c <<EOCP
10621#include <sys/types.h>
10622#ifdef I_FCNTL
10623#include <fcntl.h>
10624#endif
10625#ifdef I_SYS_FILE
10626#include <sys/file.h>
10627#endif
10628#ifdef I_UNISTD
10629#include <unistd.h>
10630#endif
10631#$i_stdlib I_STDLIB
10632#ifdef I_STDLIB
10633#include <stdlib.h>
10634#endif
10635int main() {
10636	exit(R_OK);
10637}
10638EOCP
10639	: check sys/file.h first, no particular reason here
10640	if $test `./findhdr sys/file.h` && \
10641		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10642		h_sysfile=true;
10643		echo "<sys/file.h> defines the *_OK access constants." >&4
10644	elif $test `./findhdr fcntl.h` && \
10645		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10646		h_fcntl=true;
10647		echo "<fcntl.h> defines the *_OK access constants." >&4
10648	elif $test `./findhdr unistd.h` && \
10649		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10650		echo "<unistd.h> defines the *_OK access constants." >&4
10651	else
10652		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10653	fi
10654	;;
10655esac
10656$rm -f access*
10657
10658: see if accessx exists
10659set accessx d_accessx
10660eval $inlibc
10661
10662: see if acosh exists
10663set acosh d_acosh
10664eval $inlibc
10665
10666: see if aintl exists
10667set aintl d_aintl
10668eval $inlibc
10669
10670: see if alarm exists
10671set alarm d_alarm
10672eval $inlibc
10673
10674: see if 64bit time functions exists
10675
10676set ctime64 d_ctime64
10677eval $inlibc
10678
10679set localtime64 d_localtime64
10680eval $inlibc
10681
10682set gmtime64 d_gmtime64
10683eval $inlibc
10684
10685set mktime64 d_mktime64
10686eval $inlibc
10687
10688set difftime64 d_difftime64
10689eval $inlibc
10690
10691set asctime64 d_asctime64
10692eval $inlibc
10693
10694: see if POSIX threads are available
10695set pthread.h i_pthread
10696eval $inhdr
10697
10698: define a function to check prototypes
10699$cat > protochk <<EOSH
10700$startsh
10701cc="$cc"
10702optimize="$optimize"
10703ccflags="$ccflags"
10704define="$define"
10705rm_try="$rm_try"
10706usethreads=$usethreads
10707i_pthread=$i_pthread
10708pthread_h_first=$pthread_h_first
10709EOSH
10710
10711$cat >> protochk <<'EOSH'
10712
10713$rm_try
10714foo="$1"
10715shift
10716while test $# -ge 2; do
10717	case "$1" in
10718		$define) echo "#include <$2>" >> try.c ;;
10719		literal) echo "$2" >> try.c ;;
10720	esac
10721    # Extra magic for the benefit of systems that need pthread.h
10722    # to be included early to correctly detect threadsafe functions.
10723    # Such functions must guarantee themselves, though, that the usethreads
10724    # and i_pthread have been defined, before calling protochk.
10725    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10726	echo "#include <pthread.h>" >> try.c
10727	pthread_h_done=yes
10728    fi
10729    shift 2
10730done
10731cat >> try.c <<'EOCP'
10732#define	_(args) args
10733EOCP
10734echo "$foo" >> try.c
10735echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10736$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10737status=$?
10738$rm_try
10739exit $status
10740EOSH
10741chmod +x protochk
10742$eunicefix protochk
10743
10744: Define hasproto macro for Configure internal use
10745hasproto='varname=$1; func=$2; shift; shift;
10746while $test $# -ge 2; do
10747	case "$1" in
10748	$define) echo "#include <$2>";;
10749	literal) echo "$2" ;;
10750	esac ;
10751    shift 2;
10752done > try.c;
10753$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10754if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10755	echo "$func() prototype found.";
10756	val="$define";
10757else
10758	echo "$func() prototype NOT found.";
10759	val="$undef";
10760fi;
10761set $varname;
10762eval $setvar;
10763$rm_try tryout.c'
10764
10765: see if sys/types.h has to be included
10766set sys/types.h i_systypes
10767eval $inhdr
10768
10769: see if sys/select.h has to be included
10770set sys/select.h i_sysselct
10771eval $inhdr
10772
10773: Define hasfield macro for Configure internal use
10774hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10775while $test $# -ge 2; do
10776	case "$1" in
10777	$define) echo "#include <$2>";;
10778	esac ;
10779    shift 2;
10780done > try.c;
10781echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10782set try;
10783if eval $compile; then
10784	val="$define";
10785else
10786	val="$undef";
10787fi;
10788set $varname;
10789eval $setvar;
10790$rm_try'
10791
10792: see if we should include sys/time.h
10793echo " "
10794i_time='define'
10795if test "X$timeincl" = X; then
10796	echo "Testing to see if we should include <sys/time.h>." >&4
10797	$echo $n "I'm now running the test program...$c"
10798	$cat >try.c <<EOCP
10799#include <sys/types.h>
10800#include <time.h>
10801#ifdef I_SYSTIME
10802#ifdef SYSTIMEKERNEL
10803#define KERNEL
10804#endif
10805#include <sys/time.h>
10806#endif
10807#ifdef I_SYSSELECT
10808#include <sys/select.h>
10809#endif
10810#$i_stdlib I_STDLIB
10811#ifdef I_STDLIB
10812#include <stdlib.h>
10813#endif
10814int main()
10815{
10816	struct tm foo;
10817#ifdef S_TIMEVAL
10818	struct timeval bar;
10819#endif
10820#ifdef S_TIMEZONE
10821	struct timezone tzp;
10822#endif
10823	if (foo.tm_sec == foo.tm_sec)
10824		exit(0);
10825#ifdef S_TIMEVAL
10826	if (bar.tv_sec == bar.tv_sec)
10827		exit(0);
10828#endif
10829	exit(1);
10830}
10831EOCP
10832	flags=''
10833	for s_timezone in '-DS_TIMEZONE' ''; do
10834	sysselect=''
10835	for s_timeval in '-DS_TIMEVAL' ''; do
10836	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10837	for i_systime in '-DI_SYSTIME' ''; do
10838		case "$flags" in
10839		'') $echo $n ".$c"
10840			set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10841			if eval $compile; then
10842				set X $i_systime $i_systimek $sysselect $s_timeval
10843				shift
10844				flags="$*"
10845				echo " "
10846				$echo $n "Succeeded with $flags$c"
10847			fi
10848			;;
10849		esac
10850	done
10851	done
10852	done
10853	done
10854	timeincl=''
10855	echo " "
10856	case "$flags" in
10857	*SYSTIMEKERNEL*) i_systimek="$define"
10858		timeincl=`./findhdr sys/time.h`
10859		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10860	*) i_systimek="$undef";;
10861	esac
10862	case "$flags" in
10863	*I_SYSTIME*) i_systime="$define"
10864		timeincl=`./findhdr sys/time.h`" $timeincl"
10865		echo "We'll include <sys/time.h>." >&4;;
10866	*) i_systime="$undef";;
10867	esac
10868	$rm_try
10869fi
10870: see if struct tm knows about tm_zone
10871case "$i_systime$i_time" in
10872*$define*)
10873        echo " "
10874        echo "Checking to see if your struct tm has tm_zone field..." >&4
10875        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10876        eval $hasfield
10877        ;;
10878*)      val="$undef"
10879        set d_tm_tm_zone
10880        eval $setvar
10881        ;;
10882esac
10883case "$d_tm_tm_zone" in
10884"$define")      echo "Yes, it does."   ;;
10885*)              echo "No, it doesn't." ;;
10886esac
10887: see if struct tm knows about tm_gmtoff
10888case "$i_systime$i_time" in
10889*$define*)
10890        echo " "
10891        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10892        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10893        eval $hasfield
10894        ;;
10895*)      val="$undef"
10896        set d_tm_tm_gmtoff
10897        eval $setvar
10898        ;;
10899esac
10900case "$d_tm_tm_gmtoff" in
10901"$define")      echo "Yes, it does."   ;;
10902*)              echo "No, it doesn't." ;;
10903esac
10904
10905: see if asctime_r exists
10906set asctime_r d_asctime_r
10907eval $inlibc
10908case "$d_asctime_r" in
10909"$define")
10910	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10911	case "$d_asctime_r_proto:$usethreads" in
10912	":define")	d_asctime_r_proto=define
10913		set d_asctime_r_proto asctime_r $hdrs
10914		eval $hasproto ;;
10915	*)	;;
10916	esac
10917	case "$d_asctime_r_proto" in
10918	define)
10919	case "$asctime_r_proto" in
10920	''|0) try='char* asctime_r(const struct tm*, char*);'
10921	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10922	esac
10923	case "$asctime_r_proto" in
10924	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10925	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10926	esac
10927	case "$asctime_r_proto" in
10928	''|0) try='int asctime_r(const struct tm*, char*);'
10929	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10930	esac
10931	case "$asctime_r_proto" in
10932	''|0) try='int asctime_r(const struct tm*, char*, int);'
10933	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10934	esac
10935	case "$asctime_r_proto" in
10936	''|0)	d_asctime_r=undef
10937		asctime_r_proto=0
10938		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10939	* )	case "$asctime_r_proto" in
10940		REENTRANT_PROTO*) ;;
10941		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10942		esac
10943		echo "Prototype: $try" ;;
10944	esac
10945	;;
10946	*)	case "$usethreads" in
10947		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10948		esac
10949		d_asctime_r=undef
10950		asctime_r_proto=0
10951		;;
10952	esac
10953	;;
10954*)	asctime_r_proto=0
10955	;;
10956esac
10957
10958: see if asinh exists
10959set asinh d_asinh
10960eval $inlibc
10961
10962: see if atanh exists
10963set atanh d_atanh
10964eval $inlibc
10965
10966: see if atolf exists
10967set atolf d_atolf
10968eval $inlibc
10969
10970: see if atoll exists
10971set atoll d_atoll
10972eval $inlibc
10973
10974: Look for GCC-style attribute format
10975case "$d_attribute_format" in
10976'')
10977echo " "
10978echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10979$cat >attrib.c <<'EOCP'
10980#include <stdio.h>
10981void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10982EOCP
10983if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10984	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10985		echo "Your C compiler doesn't support __attribute__((format))."
10986		val="$undef"
10987	else
10988		echo "Your C compiler supports __attribute__((format))."
10989		val="$define"
10990	fi
10991else
10992	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10993	val="$undef"
10994fi
10995;;
10996*) val="$d_attribute_format" ;;
10997esac
10998set d_attribute_format
10999eval $setvar
11000$rm -f attrib*
11001
11002: Look for GCC-style attribute format with null format allowed
11003case "$d_printf_format_null" in
11004'') case "$d_attribute_format" in
11005    $define)
11006	echo " "
11007	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11008$cat >attrib.c <<EOCP
11009#include <stdio.h>
11010#$i_stdlib I_STDLIB
11011#ifdef I_STDLIB
11012#include <stdlib.h>
11013#endif
11014#$i_inttypes I_INTTYPES
11015#ifdef I_INTTYPES
11016#include <inttypes.h>
11017#endif
11018#ifndef INTPTR_MAX
11019#define intptr_t int
11020#endif
11021int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11022int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11023int main () { exit(null_printf(NULL)); }
11024EOCP
11025	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11026	    : run the executable in case it produces a run-time warning
11027	    if $run ./attrib >>attrib.out 2>&1; then
11028		if $contains 'warning' attrib.out >/dev/null 2>&1; then
11029		    echo "Your C compiler doesn't allow __printf__ format to be null."
11030		    val="$undef"
11031		else
11032		    echo "Your C compiler allows __printf__ format to be null."
11033		    val="$define"
11034		fi
11035	    else
11036	    echo "Your C compiler executable failed with __printf__ format null."
11037	    val="$undef"
11038	fi
11039    else
11040	echo "Your C compiler fails with __printf__ format null."
11041	val="$undef"
11042    fi
11043    ;;
11044    *)  val="$undef" ;;
11045    esac
11046;;
11047*)  val="$d_printf_format_null" ;;
11048esac
11049set d_printf_format_null
11050eval $setvar
11051$rm -f attrib*
11052
11053: Look for GCC-style attribute malloc
11054case "$d_attribute_malloc" in
11055'')
11056echo " "
11057echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11058$cat >attrib.c <<'EOCP'
11059#include <stdio.h>
11060char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11061EOCP
11062if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11063	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11064		echo "Your C compiler doesn't support __attribute__((malloc))."
11065		val="$undef"
11066	else
11067		echo "Your C compiler supports __attribute__((malloc))."
11068		val="$define"
11069	fi
11070else
11071	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11072	val="$undef"
11073fi
11074;;
11075*) val="$d_attribute_malloc" ;;
11076esac
11077set d_attribute_malloc
11078eval $setvar
11079$rm -f attrib*
11080
11081: Look for GCC-style attribute nonnull
11082case "$d_attribute_nonnull" in
11083'')
11084echo " "
11085echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11086$cat >attrib.c <<'EOCP'
11087#include <stdio.h>
11088void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11089EOCP
11090if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11091	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11092		echo "Your C compiler doesn't support __attribute__((nonnull))."
11093		val="$undef"
11094	else
11095		echo "Your C compiler supports __attribute__((nonnull))."
11096		val="$define"
11097	fi
11098else
11099	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11100	val="$undef"
11101fi
11102;;
11103*) val="$d_attribute_nonnull" ;;
11104esac
11105set d_attribute_nonnull
11106eval $setvar
11107$rm -f attrib*
11108
11109: Look for GCC-style attribute noreturn
11110case "$d_attribute_noreturn" in
11111'')
11112echo " "
11113echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11114$cat >attrib.c <<'EOCP'
11115#include <stdio.h>
11116void fall_over_dead( void ) __attribute__((noreturn));
11117EOCP
11118if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11119	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11120		echo "Your C compiler doesn't support __attribute__((noreturn))."
11121		val="$undef"
11122	else
11123		echo "Your C compiler supports __attribute__((noreturn))."
11124		val="$define"
11125	fi
11126else
11127	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11128	val="$undef"
11129fi
11130;;
11131*) val="$d_attribute_noreturn" ;;
11132esac
11133set d_attribute_noreturn
11134eval $setvar
11135$rm -f attrib*
11136
11137: Look for GCC-style attribute pure
11138case "$d_attribute_pure" in
11139'')
11140echo " "
11141echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11142$cat >attrib.c <<'EOCP'
11143#include <stdio.h>
11144int square( int n ) __attribute__((pure));
11145EOCP
11146if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11147	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11148		echo "Your C compiler doesn't support __attribute__((pure))."
11149		val="$undef"
11150	else
11151		echo "Your C compiler supports __attribute__((pure))."
11152		val="$define"
11153	fi
11154else
11155	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11156	val="$undef"
11157fi
11158;;
11159*) val="$d_attribute_pure" ;;
11160esac
11161set d_attribute_pure
11162eval $setvar
11163$rm -f attrib*
11164
11165: Look for GCC-style attribute unused
11166case "$d_attribute_unused" in
11167'')
11168echo " "
11169echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11170$cat >attrib.c <<'EOCP'
11171#include <stdio.h>
11172int do_something( int dummy __attribute__((unused)), int n );
11173EOCP
11174if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11175	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11176		echo "Your C compiler doesn't support __attribute__((unused))."
11177		val="$undef"
11178	else
11179		echo "Your C compiler supports __attribute__((unused))."
11180		val="$define"
11181	fi
11182else
11183	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11184	val="$undef"
11185fi
11186;;
11187*) val="$d_attribute_unused" ;;
11188esac
11189set d_attribute_unused
11190eval $setvar
11191$rm -f attrib*
11192
11193: Look for GCC-style attribute deprecated
11194case "$d_attribute_deprecated" in
11195'')
11196echo " "
11197echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11198$cat >attrib.c <<'EOCP'
11199#include <stdio.h>
11200int I_am_deprecated(void) __attribute__((deprecated));
11201EOCP
11202if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11203	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11204		echo "Your C compiler doesn't support __attribute__((deprecated))."
11205		val="$undef"
11206	else
11207		echo "Your C compiler supports __attribute__((deprecated))."
11208		val="$define"
11209	fi
11210else
11211	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11212	val="$undef"
11213fi
11214;;
11215*) val="$d_attribute_deprecated" ;;
11216esac
11217set d_attribute_deprecated
11218eval $setvar
11219$rm -f attrib*
11220
11221: Look for GCC-style attribute warn_unused_result
11222case "$d_attribute_warn_unused_result" in
11223'')
11224echo " "
11225echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11226$cat >attrib.c <<'EOCP'
11227#include <stdio.h>
11228int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11229EOCP
11230if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11231	if $contains 'warning' attrib.out >/dev/null 2>&1; then
11232		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11233		val="$undef"
11234	else
11235		echo "Your C compiler supports __attribute__((warn_unused_result))."
11236		val="$define"
11237	fi
11238else
11239	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11240	val="$undef"
11241fi
11242;;
11243*) val="$d_attribute_warn_unused_result" ;;
11244esac
11245set d_attribute_warn_unused_result
11246eval $setvar
11247$rm -f attrib*
11248
11249: see if getpgrp exists
11250set getpgrp d_getpgrp
11251eval $inlibc
11252
11253case "$d_getpgrp" in
11254"$define")
11255	echo " "
11256	echo "Checking to see which flavor of getpgrp is in use..."
11257	$cat >try.c <<EOP
11258#$i_unistd I_UNISTD
11259#include <sys/types.h>
11260#ifdef I_UNISTD
11261#  include <unistd.h>
11262#endif
11263#$i_stdlib I_STDLIB
11264#ifdef I_STDLIB
11265#include <stdlib.h>
11266#endif
11267int main()
11268{
11269	if (getuid() == 0) {
11270		printf("(I see you are running Configure as super-user...)\n");
11271		setuid(1);
11272	}
11273#ifdef TRY_BSD_PGRP
11274	if (getpgrp(1) == 0)
11275		exit(0);
11276#else
11277	if (getpgrp() > 0)
11278		exit(0);
11279#endif
11280	exit(1);
11281}
11282EOP
11283	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11284		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11285		val="$define"
11286	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11287		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11288		val="$undef"
11289	else
11290		echo "I can't seem to compile and run the test program."
11291		if ./usg; then
11292			xxx="a USG one, i.e. you use getpgrp()."
11293		else
11294			# SVR4 systems can appear rather BSD-ish.
11295			case "$i_unistd" in
11296			$undef)
11297				xxx="a BSD one, i.e. you use getpgrp(pid)."
11298				val="$define"
11299				;;
11300			$define)
11301				xxx="probably a USG one, i.e. you use getpgrp()."
11302				val="$undef"
11303				;;
11304			esac
11305		fi
11306		echo "Assuming your getpgrp is $xxx" >&4
11307	fi
11308	;;
11309*) val="$undef";;
11310esac
11311set d_bsdgetpgrp
11312eval $setvar
11313$rm_try
11314
11315: see if setpgrp exists
11316set setpgrp d_setpgrp
11317eval $inlibc
11318
11319case "$d_setpgrp" in
11320"$define")
11321	echo " "
11322	echo "Checking to see which flavor of setpgrp is in use..."
11323	$cat >try.c <<EOP
11324#$i_unistd I_UNISTD
11325#include <sys/types.h>
11326#ifdef I_UNISTD
11327#  include <unistd.h>
11328#endif
11329#$i_stdlib I_STDLIB
11330#ifdef I_STDLIB
11331#include <stdlib.h>
11332#endif
11333int main()
11334{
11335	if (getuid() == 0) {
11336		printf("(I see you are running Configure as super-user...)\n");
11337		setuid(1);
11338	}
11339#ifdef TRY_BSD_PGRP
11340	if (-1 == setpgrp(1, 1))
11341		exit(0);
11342#else
11343	if (setpgrp() != -1)
11344		exit(0);
11345#endif
11346	exit(1);
11347}
11348EOP
11349	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11350		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11351		val="$define"
11352	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11353		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11354		val="$undef"
11355	else
11356		echo "(I can't seem to compile and run the test program.)"
11357		if ./usg; then
11358			xxx="a USG one, i.e. you use setpgrp()."
11359		else
11360			# SVR4 systems can appear rather BSD-ish.
11361			case "$i_unistd" in
11362			$undef)
11363				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11364				val="$define"
11365				;;
11366			$define)
11367				xxx="probably a USG one, i.e. you use setpgrp()."
11368				val="$undef"
11369				;;
11370			esac
11371		fi
11372		echo "Assuming your setpgrp is $xxx" >&4
11373	fi
11374	;;
11375*) val="$undef";;
11376esac
11377set d_bsdsetpgrp
11378eval $setvar
11379$rm_try
11380
11381: Look for GCC-style __builtin_add_overflow
11382case "$d_builtin_add_overflow" in
11383'')
11384    echo " "
11385    echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11386    $cat >try.c <<'EOCP'
11387int main(void) {
11388    const unsigned int uint_max = ~0u;
11389    int target_int = 0;
11390    if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11391        return 1;
11392    }
11393    if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11394        return 1;
11395    }
11396    if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11397        return 1;
11398    }
11399    return 0;
11400}
11401EOCP
11402    set try
11403    if eval $compile && $run ./try; then
11404        echo "Your C compiler supports __builtin_add_overflow."
11405        val="$define"
11406    else
11407        echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11408        val="$undef"
11409    fi
11410    ;;
11411*) val="$d_builtin_add_overflow" ;;
11412esac
11413
11414set d_builtin_add_overflow
11415eval $setvar
11416$rm_try
11417
11418: Look for GCC-style __builtin_sub_overflow
11419case "$d_builtin_sub_overflow" in
11420'')
11421    echo " "
11422    echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11423    $cat >try.c <<'EOCP'
11424int main(void) {
11425    const unsigned int uint_max = ~0u;
11426    int target_int = 0;
11427    if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11428        return 1;
11429    }
11430    if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11431        return 1;
11432    }
11433    if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11434        return 1;
11435    }
11436    return 0;
11437}
11438EOCP
11439    set try
11440    if eval $compile && $run ./try; then
11441        echo "Your C compiler supports __builtin_sub_overflow."
11442        val="$define"
11443    else
11444        echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11445        val="$undef"
11446    fi
11447    ;;
11448*) val="$d_builtin_sub_overflow" ;;
11449esac
11450
11451set d_builtin_sub_overflow
11452eval $setvar
11453$rm_try
11454
11455: Look for GCC-style __builtin_mul_overflow
11456case "$d_builtin_mul_overflow" in
11457'')
11458    echo " "
11459    echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11460    $cat >try.c <<'EOCP'
11461int main(void) {
11462    const unsigned int uint_max = ~0u;
11463    int target_int = 0;
11464    if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11465        return 1;
11466    }
11467    if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11468        return 1;
11469    }
11470    if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11471        return 1;
11472    }
11473    return 0;
11474}
11475EOCP
11476    set try
11477    if eval $compile && $run ./try; then
11478        echo "Your C compiler supports __builtin_mul_overflow."
11479        val="$define"
11480    else
11481        echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11482        val="$undef"
11483    fi
11484    ;;
11485*) val="$d_builtin_mul_overflow" ;;
11486esac
11487
11488set d_builtin_mul_overflow
11489eval $setvar
11490$rm_try
11491
11492: Look for GCC-style __builtin_choose_expr
11493case "$d_builtin_choose_expr" in
11494'')
11495    echo " "
11496    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11497    $cat >try.c <<'EOCP'
11498#include <assert.h>
11499#include <stdlib.h>
11500#include <stdio.h>
11501
11502#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11503
11504int main(void) {
11505    assert( SYRINX(1) == 2112 );
11506    assert( SYRINX(1) != 5150 );
11507    assert( SYRINX(0) == 5150 );
11508    assert( SYRINX(0) != 2112 );
11509    puts( "All good!" );
11510    exit(0);
11511}
11512
11513EOCP
11514    set try
11515    if eval $compile && $run ./try; then
11516	echo "Your C compiler supports __builtin_choose_expr."
11517	val="$define"
11518    else
11519	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11520	val="$undef"
11521    fi
11522;;
11523*) val="$d_builtin_choose_expr" ;;
11524esac
11525
11526set d_builtin_choose_expr
11527eval $setvar
11528$rm_try
11529
11530: Look for GCC-style __builtin_expect
11531case "$d_builtin_expect" in
11532'')
11533    echo " "
11534    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11535    $cat >try.c <<'EOCP'
11536int main(void) {
11537    int n = 50;
11538    if ( __builtin_expect(n, 0) ) n = 1;
11539    /* Remember shell exit code truth is 0, C truth is non-zero */
11540    return !(n == 1);
11541}
11542EOCP
11543    set try
11544    if eval $compile && $run ./try; then
11545	echo "Your C compiler supports __builtin_expect."
11546	val="$define"
11547    else
11548	echo "Your C compiler doesn't seem to understand __builtin_expect."
11549	val="$undef"
11550    fi
11551    ;;
11552*) val="$d_builtin_expect" ;;
11553esac
11554
11555set d_builtin_expect
11556eval $setvar
11557$rm_try
11558
11559: see if the Compiler supports C99 variadic macros
11560echo "Checking for C99 variadic macros." >&4
11561$cat >try.c <<EOCP
11562#include <stdio.h>
11563#include <stdarg.h>
11564
11565#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11566
11567int main() {
11568  char buf[20];
11569  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11570  puts(buf);
11571  return 0;
11572}
11573EOCP
11574set try
11575if eval $compile && $run ./try 2>&1 >/dev/null; then
11576    case "`$run ./try`" in
11577	"123 456 789")
11578	echo "You have C99 variadic macros." >&4
11579	d_c99_variadic_macros="$define"
11580	;;
11581	*)
11582	echo "You don't have functional C99 variadic macros." >&4
11583	d_c99_variadic_macros="$undef"
11584	;;
11585    esac
11586else
11587    echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11588    d_c99_variadic_macros="$undef"
11589fi
11590$rm_try
11591
11592: see if signal is declared as pointer to function returning int or void
11593echo " "
11594xxx=`./findhdr signal.h`
11595$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11596if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11597	echo "You have int (*signal())() instead of void." >&4
11598	val="$undef"
11599elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11600	echo "You have void (*signal())()." >&4
11601	val="$define"
11602elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11603	echo "You have int (*signal())() instead of void." >&4
11604	val="$undef"
11605elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11606	echo "You have void (*signal())()." >&4
11607	val="$define"
11608else
11609	case "$d_voidsig" in
11610	'')
11611	echo "I can't determine whether signal handler returns void or int..." >&4
11612		dflt=void
11613		rp="What type does your signal handler return?"
11614		. ./myread
11615		case "$ans" in
11616		v*) val="$define";;
11617		*) val="$undef";;
11618		esac;;
11619	"$define")
11620		echo "As you already told me, signal handler returns void." >&4
11621		val="$define"
11622		;;
11623	*)	echo "As you already told me, signal handler returns int." >&4
11624		val="$undef"
11625		;;
11626	esac
11627fi
11628set d_voidsig
11629eval $setvar
11630case "$d_voidsig" in
11631"$define") signal_t="void";;
11632*) signal_t="int";;
11633esac
11634$rm -f $$.tmp
11635
11636: check for ability to cast large floats to 32-bit ints.
11637echo " "
11638echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11639if $test "$intsize" -ge 4; then
11640	xxx=int
11641else
11642	xxx=long
11643fi
11644$cat >try.c <<EOCP
11645#include <stdio.h>
11646#$i_stdlib I_STDLIB
11647#ifdef I_STDLIB
11648#include <stdlib.h>
11649#endif
11650#include <sys/types.h>
11651#include <signal.h>
11652$signal_t blech(int s) { exit(3); }
11653int main()
11654{
11655	$xxx i32;
11656	double f, g;
11657	int result = 0;
11658	char str[16];
11659	signal(SIGFPE, blech);
11660
11661	/* Don't let compiler optimize the test away.  Store the number
11662	   in a writable string for gcc to pass to sscanf under HP-UX.
11663	*/
11664	sprintf(str, "2147483647");
11665	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11666	g = 10 * f;
11667	i32  = ($xxx) g;
11668
11669	/* x86 processors will probably give 0x8000 0000, which is a
11670	   sign change.  We don't want that.  We want to mimic SPARC
11671	   behavior here, which is to preserve the sign and give
11672	   back 0x7fff ffff.
11673	*/
11674	if (i32 != ($xxx) f)
11675		result |= 1;
11676	exit(result);
11677}
11678EOCP
11679set try
11680if eval $compile_ok; then
11681	$run ./try 2>/dev/null
11682	yyy=$?
11683else
11684	echo "(I can't seem to compile the test program--assuming it can't)"
11685	yyy=1
11686fi
11687case "$yyy" in
116880)	val="$define"
11689	echo "Yup, it can."
11690	;;
11691*)	val="$undef"
11692	echo "Nope, it can't."
11693	;;
11694esac
11695set d_casti32
11696eval $setvar
11697$rm_try
11698
11699: check for ability to cast negative floats to unsigned
11700echo " "
11701echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11702$cat >try.c <<EOCP
11703#include <stdio.h>
11704#$i_stdlib I_STDLIB
11705#ifdef I_STDLIB
11706#include <stdlib.h>
11707#endif
11708#include <sys/types.h>
11709#include <signal.h>
11710$signal_t blech(int s) { exit(7); }
11711$signal_t blech_in_list(int s) { exit(4); }
11712unsigned long dummy_long(unsigned long p) { return p; }
11713unsigned int dummy_int(unsigned int p) { return p; }
11714unsigned short dummy_short(unsigned short p) { return p; }
11715int main()
11716{
11717	double f;
11718	unsigned long along;
11719	unsigned int aint;
11720	unsigned short ashort;
11721	int result = 0;
11722	char str[16];
11723
11724	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11725	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11726	   optimized the whole file away
11727	*/
11728	/* Store the number in a writable string for gcc to pass to
11729	   sscanf under HP-UX.
11730	*/
11731	sprintf(str, "-123");
11732	sscanf(str, "%lf", &f);  /* f = -123.; */
11733
11734	signal(SIGFPE, blech);
11735	along = (unsigned long)f;
11736	aint = (unsigned int)f;
11737	ashort = (unsigned short)f;
11738	if (along != (unsigned long)-123)
11739		result |= 1;
11740	if (aint != (unsigned int)-123)
11741		result |= 1;
11742	if (ashort != (unsigned short)-123)
11743		result |= 1;
11744	sprintf(str, "1073741824.");
11745	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11746	f = f + f;
11747	along = 0;
11748	along = (unsigned long)f;
11749	if (along != 0x80000000)
11750		result |= 2;
11751	f -= 1.;
11752	along = 0;
11753	along = (unsigned long)f;
11754	if (along != 0x7fffffff)
11755		result |= 1;
11756	f += 2.;
11757	along = 0;
11758	along = (unsigned long)f;
11759	if (along != 0x80000001)
11760		result |= 2;
11761	if (result)
11762		exit(result);
11763	signal(SIGFPE, blech_in_list);
11764	sprintf(str, "123.");
11765	sscanf(str, "%lf", &f);  /* f = 123.; */
11766	along = dummy_long((unsigned long)f);
11767	aint = dummy_int((unsigned int)f);
11768	ashort = dummy_short((unsigned short)f);
11769	if (along != (unsigned long)123)
11770		result |= 4;
11771	if (aint != (unsigned int)123)
11772		result |= 4;
11773	if (ashort != (unsigned short)123)
11774		result |= 4;
11775	exit(result);
11776
11777}
11778EOCP
11779set try
11780if eval $compile_ok; then
11781	$run ./try 2>/dev/null
11782	castflags=$?
11783else
11784	echo "(I can't seem to compile the test program--assuming it can't)"
11785	castflags=7
11786fi
11787case "$castflags" in
117880)	val="$define"
11789	echo "Yup, it can."
11790	;;
11791*)	val="$undef"
11792	echo "Nope, it can't."
11793	;;
11794esac
11795set d_castneg
11796eval $setvar
11797$rm_try
11798
11799: see if cbrt exists
11800set cbrt d_cbrt
11801eval $inlibc
11802
11803: see if chown exists
11804set chown d_chown
11805eval $inlibc
11806
11807: see if chroot exists
11808set chroot d_chroot
11809eval $inlibc
11810
11811: see if chsize exists
11812set chsize d_chsize
11813eval $inlibc
11814
11815: see if class exists
11816set class d_class
11817eval $inlibc
11818
11819: see if clearenv exists
11820set clearenv d_clearenv
11821eval $inlibc
11822
11823: Define hasstruct macro for Configure internal use
11824hasstruct='varname=$1; struct=$2; shift; shift;
11825while $test $# -ge 2; do
11826	case "$1" in
11827	$define) echo "#include <$2>";;
11828	esac ;
11829    shift 2;
11830done > try.c;
11831echo "int main () { struct $struct foo; }" >> try.c;
11832set try;
11833if eval $compile; then
11834	val="$define";
11835else
11836	val="$undef";
11837fi;
11838set $varname;
11839eval $setvar;
11840$rm_try'
11841
11842: see whether socket exists
11843socketlib=''
11844sockethdr=''
11845echo " "
11846$echo $n "Hmm... $c" >&4
11847if set socket val -f d_socket; eval $csym; $val; then
11848    echo "Looks like you have Berkeley networking support." >&4
11849    d_socket="$define"
11850    if set setsockopt val -f; eval $csym; $val; then
11851	d_oldsock="$undef"
11852    else
11853	echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11854	d_oldsock="$define"
11855    fi
11856else
11857    if $contains socklib libc.list >/dev/null 2>&1; then
11858	echo "Looks like you have Berkeley networking support." >&4
11859	d_socket="$define"
11860	: we will have to assume that it supports the 4.2 BSD interface
11861	d_oldsock="$undef"
11862    else
11863	echo "You don't have Berkeley networking in libc$_a..." >&4
11864	if test "X$d_socket" = "X$define"; then
11865	    echo "...but you seem to believe that you have sockets." >&4
11866	else
11867	    for net in net socket
11868	    do
11869		if test -f $sysroot/usr/lib/lib$net$_a; then
11870		    ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11871		    $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11872		    if $contains socket libc.list >/dev/null 2>&1; then
11873			d_socket="$define"
11874			socketlib="-l$net"
11875			case "$net" in
11876			net)
11877			    echo "...but the Wollongong group seems to have hacked it in." >&4
11878			    sockethdr="-I$sysroot/usr/netinclude"
11879			    ;;
11880			esac
11881			echo "Found Berkeley sockets interface in lib$net." >&4
11882			if $contains setsockopt libc.list >/dev/null 2>&1; then
11883			    d_oldsock="$undef"
11884			else
11885			    echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11886			    d_oldsock="$define"
11887			fi
11888			break
11889		    fi
11890		fi
11891	    done
11892	    if test "X$d_socket" != "X$define"; then
11893	       echo "or anywhere else I see." >&4
11894	       d_socket="$undef"
11895	       d_oldsock="$undef"
11896	    fi
11897	fi
11898    fi
11899fi
11900
11901: see if socketpair exists
11902set socketpair d_sockpair
11903eval $inlibc
11904
11905
11906echo " "
11907echo "Checking the availability sa_len in the sock struct ..." >&4
11908$cat >try.c <<EOF
11909#include <sys/types.h>
11910#include <sys/socket.h>
11911int main() {
11912struct sockaddr sa;
11913return (sa.sa_len);
11914}
11915EOF
11916val="$undef"
11917set try; if eval $compile; then
11918    val="$define"
11919fi
11920set d_sockaddr_sa_len; eval $setvar
11921$rm_try
11922
11923echo " "
11924echo "Checking the availability struct sockaddr_in6 ..." >&4
11925$cat >try.c <<EOF
11926#include <sys/types.h>
11927#include <sys/socket.h>
11928#include <netinet/in.h>
11929int main() {
11930struct sockaddr_in6 sin6;
11931return (sin6.sin6_family);
11932}
11933EOF
11934val="$undef"
11935set try; if eval $compile; then
11936    val="$define"
11937fi
11938set d_sockaddr_in6; eval $setvar
11939$rm_try
11940
11941echo " "
11942echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11943$cat >try.c <<EOF
11944#include <sys/types.h>
11945#include <sys/socket.h>
11946#include <netinet/in.h>
11947int main() {
11948struct sockaddr_in6 sin6;
11949return (sin6.sin6_scope_id);
11950}
11951EOF
11952val="$undef"
11953set try; if eval $compile; then
11954    val="$define"
11955fi
11956set d_sin6_scope_id; eval $setvar
11957$rm_try
11958
11959echo " "
11960echo "Checking the availability struct ip_mreq ..." >&4
11961$cat >try.c <<EOF
11962#include <sys/types.h>
11963#include <sys/socket.h>
11964#include <netinet/in.h>
11965int main() {
11966struct ip_mreq mreq;
11967return (mreq.imr_multiaddr.s_addr);
11968}
11969EOF
11970val="$undef"
11971set try; if eval $compile; then
11972       val="$define"
11973fi
11974set d_ip_mreq; eval $setvar
11975$rm_try
11976
11977echo " "
11978echo "Checking the availability struct ip_mreq_source ..." >&4
11979$cat >try.c <<EOF
11980#include <sys/types.h>
11981#include <sys/socket.h>
11982#include <netinet/in.h>
11983int main() {
11984struct ip_mreq_source mreq;
11985return (mreq.imr_multiaddr.s_addr);
11986}
11987EOF
11988val="$undef"
11989set try; if eval $compile; then
11990       val="$define"
11991fi
11992set d_ip_mreq_source; eval $setvar
11993$rm_try
11994
11995echo " "
11996echo "Checking the availability struct ipv6_mreq ..." >&4
11997$cat >try.c <<EOF
11998#include <sys/types.h>
11999#include <sys/socket.h>
12000#include <netinet/in.h>
12001int main() {
12002struct ipv6_mreq mreq;
12003return (mreq.ipv6mr_interface);
12004}
12005EOF
12006val="$undef"
12007set try; if eval $compile; then
12008    val="$define"
12009fi
12010set d_ipv6_mreq; eval $setvar
12011$rm_try
12012
12013echo " "
12014echo "Checking the availability struct ipv6_mreq_source ..." >&4
12015$cat >try.c <<EOF
12016#include <sys/types.h>
12017#include <sys/socket.h>
12018#include <netinet/in.h>
12019int main() {
12020struct ipv6_mreq_source mreq;
12021return (mreq.imr_multiaddr.s_addr);
12022}
12023EOF
12024val="$undef"
12025set try; if eval $compile; then
12026       val="$define"
12027fi
12028set d_ipv6_mreq_source; eval $setvar
12029$rm_try
12030
12031echo " "
12032echo "Checking the availability of certain socket constants..." >&4
12033for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12034    enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12035    $cat >try.c <<EOF
12036#include <sys/types.h>
12037#include <sys/socket.h>
12038int main() {
12039    int i = $ENUM;
12040}
12041EOF
12042    val="$undef"
12043    set try; if eval $compile; then
12044	val="$define"
12045    fi
12046    set d_${enum}; eval $setvar
12047    $rm_try
12048done
12049
12050: see if this is a sys/uio.h system
12051set sys/uio.h i_sysuio
12052eval $inhdr
12053
12054: Check for cmsghdr support
12055echo " "
12056echo "Checking to see if your system supports struct cmsghdr..." >&4
12057set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12058eval $hasstruct
12059case "$d_cmsghdr_s" in
12060"$define")      echo "Yes, it does."   ;;
12061*)              echo "No, it doesn't." ;;
12062esac
12063
12064: see if copysign exists
12065set copysign d_copysign
12066eval $inlibc
12067
12068: see if copysignl exists
12069set copysignl d_copysignl
12070eval $inlibc
12071
12072: see if crypt exists
12073echo " "
12074set crypt d_crypt
12075eval $inlibc
12076case "$d_crypt" in
12077$define) cryptlib='' ;;
12078*)	if set crypt val -f d_crypt; eval $csym; $val; then
12079		echo 'crypt() found.' >&4
12080		val="$define"
12081		cryptlib=''
12082	else
12083		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12084		if $test -z "$cryptlib"; then
12085			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12086		else
12087			cryptlib=-lcrypt
12088		fi
12089		if $test -z "$cryptlib"; then
12090			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12091		else
12092			cryptlib=-lcrypt
12093		fi
12094		if $test -z "$cryptlib"; then
12095			cryptlib=`./loc libcrypt$_a "" $libpth`
12096		else
12097			cryptlib=-lcrypt
12098		fi
12099		if $test -z "$cryptlib"; then
12100			echo 'crypt() NOT found.' >&4
12101			val="$undef"
12102		else
12103			val="$define"
12104		fi
12105	fi
12106	set d_crypt
12107	eval $setvar
12108	;;
12109esac
12110
12111: see if this is a crypt.h system
12112set crypt.h i_crypt
12113eval $inhdr
12114
12115: see if crypt_r exists
12116set crypt_r d_crypt_r
12117eval $inlibc
12118case "$d_crypt_r" in
12119"$define")
12120	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12121	case "$d_crypt_r_proto:$usethreads" in
12122	":define")	d_crypt_r_proto=define
12123		set d_crypt_r_proto crypt_r $hdrs
12124		eval $hasproto ;;
12125	*)	;;
12126	esac
12127	case "$d_crypt_r_proto" in
12128	define)
12129	case "$crypt_r_proto" in
12130	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12131	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12132	esac
12133	case "$crypt_r_proto" in
12134	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12135	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12136	esac
12137	case "$crypt_r_proto" in
12138	''|0)	d_crypt_r=undef
12139		crypt_r_proto=0
12140		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12141	* )	case "$crypt_r_proto" in
12142		REENTRANT_PROTO*) ;;
12143		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12144		esac
12145		echo "Prototype: $try" ;;
12146	esac
12147	;;
12148	*)	case "$usethreads" in
12149		define) echo "crypt_r has no prototype, not using it." >&4 ;;
12150		esac
12151		d_crypt_r=undef
12152		crypt_r_proto=0
12153		;;
12154	esac
12155	;;
12156*)	crypt_r_proto=0
12157	;;
12158esac
12159
12160: get csh whereabouts
12161case "$csh" in
12162'csh') val="$undef" ;;
12163*) val="$define" ;;
12164esac
12165set d_csh
12166eval $setvar
12167: Respect a hint or command line value for full_csh.
12168case "$full_csh" in
12169'') full_csh=$csh ;;
12170esac
12171
12172: see if ctermid exists
12173set ctermid d_ctermid
12174eval $inlibc
12175
12176: see if ctermid_r exists
12177set ctermid_r d_ctermid_r
12178eval $inlibc
12179case "$d_ctermid_r" in
12180"$define")
12181	hdrs="$i_systypes sys/types.h define stdio.h "
12182	case "$d_ctermid_r_proto:$usethreads" in
12183	":define")	d_ctermid_r_proto=define
12184		set d_ctermid_r_proto ctermid_r $hdrs
12185		eval $hasproto ;;
12186	*)	;;
12187	esac
12188	case "$d_ctermid_r_proto" in
12189	define)
12190	case "$ctermid_r_proto" in
12191	''|0) try='char* ctermid_r(char*);'
12192	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12193	esac
12194	case "$ctermid_r_proto" in
12195	''|0)	d_ctermid_r=undef
12196		ctermid_r_proto=0
12197		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12198	* )	case "$ctermid_r_proto" in
12199		REENTRANT_PROTO*) ;;
12200		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12201		esac
12202		echo "Prototype: $try" ;;
12203	esac
12204	;;
12205	*)	case "$usethreads" in
12206		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12207		esac
12208		d_ctermid_r=undef
12209		ctermid_r_proto=0
12210		;;
12211	esac
12212	;;
12213*)	ctermid_r_proto=0
12214	;;
12215esac
12216
12217: see if ctime_r exists
12218set ctime_r d_ctime_r
12219eval $inlibc
12220case "$d_ctime_r" in
12221"$define")
12222	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12223	case "$d_ctime_r_proto:$usethreads" in
12224	":define")	d_ctime_r_proto=define
12225		set d_ctime_r_proto ctime_r $hdrs
12226		eval $hasproto ;;
12227	*)	;;
12228	esac
12229	case "$d_ctime_r_proto" in
12230	define)
12231	case "$ctime_r_proto" in
12232	''|0) try='char* ctime_r(const time_t*, char*);'
12233	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12234	esac
12235	case "$ctime_r_proto" in
12236	''|0) try='char* ctime_r(const time_t*, char*, int);'
12237	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12238	esac
12239	case "$ctime_r_proto" in
12240	''|0) try='int ctime_r(const time_t*, char*);'
12241	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12242	esac
12243	case "$ctime_r_proto" in
12244	''|0) try='int ctime_r(const time_t*, char*, int);'
12245	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12246	esac
12247	case "$ctime_r_proto" in
12248	''|0)	d_ctime_r=undef
12249		ctime_r_proto=0
12250		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12251	* )	case "$ctime_r_proto" in
12252		REENTRANT_PROTO*) ;;
12253		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12254		esac
12255		echo "Prototype: $try" ;;
12256	esac
12257	;;
12258	*)	case "$usethreads" in
12259		define) echo "ctime_r has no prototype, not using it." >&4 ;;
12260		esac
12261		d_ctime_r=undef
12262		ctime_r_proto=0
12263		;;
12264	esac
12265	;;
12266*)	ctime_r_proto=0
12267	;;
12268esac
12269
12270: see if cuserid exists
12271set cuserid d_cuserid
12272eval $inlibc
12273
12274: see if dbm.h is available
12275: see if dbmclose exists
12276set dbmclose d_dbmclose
12277eval $inlibc
12278
12279case "$d_dbmclose" in
12280$define)
12281	set dbm.h i_dbm
12282	eval $inhdr
12283	case "$i_dbm" in
12284	$define)
12285		val="$undef"
12286		set i_rpcsvcdbm
12287		eval $setvar
12288		;;
12289	*)	set rpcsvc/dbm.h i_rpcsvcdbm
12290		eval $inhdr
12291		;;
12292	esac
12293	;;
12294*)	echo "We won't be including <dbm.h>"
12295	val="$undef"
12296	set i_dbm
12297	eval $setvar
12298	val="$undef"
12299	set i_rpcsvcdbm
12300	eval $setvar
12301	;;
12302esac
12303
12304: see if prototype for dbminit is available
12305echo " "
12306set d_dbminitproto dbminit $i_dbm dbm.h
12307eval $hasproto
12308
12309: see if difftime exists
12310set difftime d_difftime
12311eval $inlibc
12312
12313: see if this is a dirent system
12314echo " "
12315if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12316	val="$define"
12317	echo "<dirent.h> found." >&4
12318else
12319	val="$undef"
12320	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12321		echo "<sys/dir.h> found." >&4
12322		echo " "
12323	else
12324		xinc=`./findhdr sys/ndir.h`
12325	fi
12326	echo "<dirent.h> NOT found." >&4
12327fi
12328set i_dirent
12329eval $setvar
12330
12331: Look for type of directory structure.
12332echo " "
12333$cppstdin $cppflags $cppminus < "$xinc" > try.c
12334
12335case "$direntrytype" in
12336''|' ')
12337	case "$i_dirent" in
12338	$define) guess1='struct dirent' ;;
12339	*) guess1='struct direct'  ;;
12340	esac
12341	;;
12342*)	guess1="$direntrytype"
12343	;;
12344esac
12345
12346case "$guess1" in
12347'struct dirent') guess2='struct direct' ;;
12348*) guess2='struct dirent' ;;
12349esac
12350
12351if $contains "$guess1" try.c >/dev/null 2>&1; then
12352	direntrytype="$guess1"
12353	echo "Your directory entries are $direntrytype." >&4
12354elif $contains "$guess2" try.c >/dev/null 2>&1; then
12355	direntrytype="$guess2"
12356	echo "Your directory entries seem to be $direntrytype." >&4
12357else
12358	echo "I don't recognize your system's directory entries." >&4
12359	rp="What type is used for directory entries on this system?"
12360	dflt="$guess1"
12361	. ./myread
12362	direntrytype="$ans"
12363fi
12364$rm_try
12365
12366: see if the directory entry stores field length
12367echo " "
12368$cppstdin $cppflags $cppminus < "$xinc" > try.c
12369if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12370	echo "Good, your directory entry keeps length information in d_namlen." >&4
12371	val="$define"
12372else
12373	echo "Your directory entry does not know about the d_namlen field." >&4
12374	val="$undef"
12375fi
12376set d_dirnamlen
12377eval $setvar
12378$rm_try
12379
12380: Look for DIR.dd_fd
12381case "$i_dirent" in
12382"$define")
12383    echo "Checking to see if DIR has a dd_fd member variable" >&4
12384    $cat >try.c <<EOCP
12385#$i_stdlib I_STDLIB
12386#ifdef I_STDLIB
12387#include <stdlib.h>
12388#endif
12389#include <dirent.h>
12390
12391int main() {
12392    DIR dir;
12393    dir.dd_fd = 1;
12394    return 0;
12395}
12396EOCP
12397    val=$undef
12398    set try
12399    if eval $compile; then
12400        echo "Yes, it does."
12401        val="$define"
12402    else
12403        echo "No, it does not."
12404        val="$undef"
12405    fi
12406    ;;
12407*)
12408    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12409    val="$undef"
12410    ;;
12411esac
12412set d_dir_dd_fd
12413eval $setvar
12414$rm_try
12415
12416: see if this is an sysdir system
12417set sys/dir.h i_sysdir
12418eval $inhdr
12419
12420: see if this is an sysndir system
12421set sys/ndir.h i_sysndir
12422eval $inhdr
12423
12424: Look for dirfd
12425echo " "
12426$cat >dirfd.c <<EOM
12427#include <stdio.h>
12428#$i_stdlib I_STDLIB
12429#ifdef I_STDLIB
12430#include <stdlib.h>
12431#endif
12432#$i_dirent I_DIRENT		/**/
12433#$i_sysdir I_SYS_DIR		/**/
12434#$i_sysndir I_SYS_NDIR		/**/
12435#$i_systypes I_SYS_TYPES	/**/
12436#if defined(I_SYS_TYPES)
12437#include <sys/types.h>
12438#endif
12439#if defined(I_DIRENT)
12440#include <dirent.h>
12441#else
12442#ifdef I_SYS_NDIR
12443#include <sys/ndir.h>
12444#else
12445#ifdef I_SYS_DIR
12446#include <sys/dir.h>
12447#endif
12448#endif
12449#endif
12450int main() {
12451	DIR *dirp = opendir(".");
12452	if (dirfd(dirp) >= 0)
12453		exit(0);
12454	else
12455		exit(1);
12456}
12457EOM
12458val=$undef
12459set dirfd
12460if eval $compile; then
12461	val="$define"
12462fi
12463case "$val" in
12464$define)	echo "dirfd() found." >&4	;;
12465*)		echo "dirfd() NOT found." >&4	;;
12466esac
12467set d_dirfd
12468eval $setvar
12469$rm -f dirfd*
12470
12471: see if dladdr exists
12472set dladdr d_dladdr
12473eval $inlibc
12474
12475: see if dlerror exists
12476xxx_runnm="$runnm"
12477runnm=false
12478set dlerror d_dlerror
12479eval $inlibc
12480runnm="$xxx_runnm"
12481
12482: see if dlfcn is available
12483set dlfcn.h i_dlfcn
12484eval $inhdr
12485
12486: Check what extension to use for shared libs
12487case "$usedl" in
12488$define|y|true)
12489	$cat << EOM
12490
12491On a few systems, the dynamically loaded modules that perl generates and uses
12492will need a different extension than shared libs. The default will probably
12493be appropriate.
12494
12495EOM
12496	case "$dlext" in
12497	'')	dflt="$so" ;;
12498	*)	dflt="$dlext" ;;
12499	esac
12500	rp='What is the extension of dynamically loaded modules'
12501	. ./myread
12502	dlext="$ans"
12503	;;
12504*)
12505	dlext="none"
12506	;;
12507esac
12508
12509: Check if dlsym need a leading underscore
12510echo " "
12511val="$undef"
12512
12513case "$dlsrc" in
12514dl_dlopen.xs)
12515	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12516	$cat >dyna.c <<'EOM'
12517fred () { }
12518EOM
12519
12520$cat >fred.c<<EOM
12521
12522#include <stdio.h>
12523#$i_stdlib I_STDLIB
12524#ifdef I_STDLIB
12525#include <stdlib.h>
12526#endif
12527#$i_dlfcn I_DLFCN
12528#ifdef I_DLFCN
12529#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12530#else
12531#include <sys/types.h>
12532#include <nlist.h>
12533#include <link.h>
12534#endif
12535
12536extern int fred() ;
12537
12538int main()
12539{
12540    void * handle ;
12541    void * symbol ;
12542#ifndef RTLD_LAZY
12543    int mode = 1 ;
12544#else
12545    int mode = RTLD_LAZY ;
12546#endif
12547    handle = dlopen("./dyna.$dlext", mode) ;
12548    if (handle == NULL) {
12549	printf ("1\n") ;
12550	fflush (stdout) ;
12551	exit(0);
12552    }
12553    symbol = dlsym(handle, "fred") ;
12554    if (symbol == NULL) {
12555	/* try putting a leading underscore */
12556	symbol = dlsym(handle, "_fred") ;
12557	if (symbol == NULL) {
12558	    printf ("2\n") ;
12559	    fflush (stdout) ;
12560	    exit(0);
12561	}
12562	printf ("3\n") ;
12563    }
12564    else
12565	printf ("4\n") ;
12566    fflush (stdout) ;
12567    exit(0);
12568}
12569EOM
12570	: Call the object file tmp-dyna.o in case dlext=o.
12571	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12572		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12573		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12574		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12575		xxx=`$run ./fred`
12576		case $xxx in
12577		1)	echo "Test program failed using dlopen." >&4
12578			echo "Perhaps you should not use dynamic loading." >&4;;
12579		2)	echo "Test program failed using dlsym." >&4
12580			echo "Perhaps you should not use dynamic loading." >&4;;
12581		3)	echo "dlsym needs a leading underscore" >&4
12582			val="$define" ;;
12583		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12584		esac
12585	else
12586		echo "I can't compile and run the test program." >&4
12587                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12588	fi
12589	;;
12590esac
12591
12592$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12593
12594set d_dlsymun
12595eval $setvar
12596
12597: see if drand48_r exists
12598set drand48_r d_drand48_r
12599eval $inlibc
12600case "$d_drand48_r" in
12601"$define")
12602	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12603	case "$d_drand48_r_proto:$usethreads" in
12604	":define")	d_drand48_r_proto=define
12605		set d_drand48_r_proto drand48_r $hdrs
12606		eval $hasproto ;;
12607	*)	;;
12608	esac
12609	case "$d_drand48_r_proto" in
12610	define)
12611	case "$drand48_r_proto" in
12612	''|0) try='int drand48_r(struct drand48_data*, double*);'
12613	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12614	esac
12615	case "$drand48_r_proto" in
12616	''|0)	d_drand48_r=undef
12617		drand48_r_proto=0
12618		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12619	* )	case "$drand48_r_proto" in
12620		REENTRANT_PROTO*) ;;
12621		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12622		esac
12623		echo "Prototype: $try" ;;
12624	esac
12625	;;
12626	*)	case "$usethreads" in
12627		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12628		esac
12629		d_drand48_r=undef
12630		drand48_r_proto=0
12631		;;
12632	esac
12633	;;
12634*)	drand48_r_proto=0
12635	;;
12636esac
12637
12638: see if prototype for drand48 is available
12639echo " "
12640set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12641eval $hasproto
12642
12643: see if dup2 exists
12644set dup2 d_dup2
12645eval $inlibc
12646
12647: see if dup3 exists
12648set dup3 d_dup3
12649eval $inlibc
12650
12651: see if this is an xlocale.h system
12652set xlocale.h i_xlocale
12653eval $inhdr
12654
12655: see if newlocale exists
12656set newlocale d_newlocale
12657eval $inlibc
12658
12659: see if freelocale exists
12660set freelocale d_freelocale
12661eval $inlibc
12662
12663: see if uselocale exists
12664set uselocale d_uselocale
12665eval $inlibc
12666
12667: see if duplocale exists
12668set duplocale d_duplocale
12669eval $inlibc
12670
12671: see if querylocale exists
12672set querylocale d_querylocale
12673eval $inlibc
12674
12675: see if eaccess exists
12676set eaccess d_eaccess
12677eval $inlibc
12678
12679: see if endgrent exists
12680set endgrent d_endgrent
12681eval $inlibc
12682
12683: see if this is an grp system
12684set grp.h i_grp
12685eval $inhdr
12686
12687case "$i_grp" in
12688$define)
12689	xxx=`./findhdr grp.h`
12690	$cppstdin $cppflags $cppminus < $xxx >$$.h
12691
12692	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12693		val="$define"
12694	else
12695		val="$undef"
12696	fi
12697	set d_grpasswd
12698	eval $setvar
12699
12700	$rm -f $$.h
12701	;;
12702*)
12703	val="$undef";
12704	set d_grpasswd; eval $setvar
12705	;;
12706esac
12707
12708: see if endgrent_r exists
12709set endgrent_r d_endgrent_r
12710eval $inlibc
12711case "$d_endgrent_r" in
12712"$define")
12713	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12714	case "$d_endgrent_r_proto:$usethreads" in
12715	":define")	d_endgrent_r_proto=define
12716		set d_endgrent_r_proto endgrent_r $hdrs
12717		eval $hasproto ;;
12718	*)	;;
12719	esac
12720	case "$d_endgrent_r_proto" in
12721	define)
12722	case "$endgrent_r_proto" in
12723	''|0) try='int endgrent_r(FILE**);'
12724	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12725	esac
12726	case "$endgrent_r_proto" in
12727	''|0) try='void endgrent_r(FILE**);'
12728	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12729	esac
12730	case "$endgrent_r_proto" in
12731	''|0)	d_endgrent_r=undef
12732		endgrent_r_proto=0
12733		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12734	* )	case "$endgrent_r_proto" in
12735		REENTRANT_PROTO*) ;;
12736		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12737		esac
12738		echo "Prototype: $try" ;;
12739	esac
12740	;;
12741	*)	case "$usethreads" in
12742		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12743		esac
12744		d_endgrent_r=undef
12745		endgrent_r_proto=0
12746		;;
12747	esac
12748	;;
12749*)	endgrent_r_proto=0
12750	;;
12751esac
12752
12753: see if endhostent exists
12754set endhostent d_endhent
12755eval $inlibc
12756
12757: see if this is a netdb.h system
12758set netdb.h i_netdb
12759eval $inhdr
12760
12761: see if endhostent_r exists
12762set endhostent_r d_endhostent_r
12763eval $inlibc
12764case "$d_endhostent_r" in
12765"$define")
12766	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12767	case "$d_endhostent_r_proto:$usethreads" in
12768	":define")	d_endhostent_r_proto=define
12769		set d_endhostent_r_proto endhostent_r $hdrs
12770		eval $hasproto ;;
12771	*)	;;
12772	esac
12773	case "$d_endhostent_r_proto" in
12774	define)
12775	case "$endhostent_r_proto" in
12776	''|0) try='int endhostent_r(struct hostent_data*);'
12777	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12778	esac
12779	case "$endhostent_r_proto" in
12780	''|0) try='void endhostent_r(struct hostent_data*);'
12781	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12782	esac
12783	case "$endhostent_r_proto" in
12784	''|0)	d_endhostent_r=undef
12785		endhostent_r_proto=0
12786		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12787	* )	case "$endhostent_r_proto" in
12788		REENTRANT_PROTO*) ;;
12789		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12790		esac
12791		echo "Prototype: $try" ;;
12792	esac
12793	;;
12794	*)	case "$usethreads" in
12795		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12796		esac
12797		d_endhostent_r=undef
12798		endhostent_r_proto=0
12799		;;
12800	esac
12801	;;
12802*)	endhostent_r_proto=0
12803	;;
12804esac
12805
12806: see if endnetent exists
12807set endnetent d_endnent
12808eval $inlibc
12809
12810: see if endnetent_r exists
12811set endnetent_r d_endnetent_r
12812eval $inlibc
12813case "$d_endnetent_r" in
12814"$define")
12815	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12816	case "$d_endnetent_r_proto:$usethreads" in
12817	":define")	d_endnetent_r_proto=define
12818		set d_endnetent_r_proto endnetent_r $hdrs
12819		eval $hasproto ;;
12820	*)	;;
12821	esac
12822	case "$d_endnetent_r_proto" in
12823	define)
12824	case "$endnetent_r_proto" in
12825	''|0) try='int endnetent_r(struct netent_data*);'
12826	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12827	esac
12828	case "$endnetent_r_proto" in
12829	''|0) try='void endnetent_r(struct netent_data*);'
12830	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12831	esac
12832	case "$endnetent_r_proto" in
12833	''|0)	d_endnetent_r=undef
12834		endnetent_r_proto=0
12835		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12836	* )	case "$endnetent_r_proto" in
12837		REENTRANT_PROTO*) ;;
12838		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12839		esac
12840		echo "Prototype: $try" ;;
12841	esac
12842	;;
12843	*)	case "$usethreads" in
12844		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12845		esac
12846		d_endnetent_r=undef
12847		endnetent_r_proto=0
12848		;;
12849	esac
12850	;;
12851*)	endnetent_r_proto=0
12852	;;
12853esac
12854
12855: see if endprotoent exists
12856set endprotoent d_endpent
12857eval $inlibc
12858
12859: see if endprotoent_r exists
12860set endprotoent_r d_endprotoent_r
12861eval $inlibc
12862case "$d_endprotoent_r" in
12863"$define")
12864	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12865	case "$d_endprotoent_r_proto:$usethreads" in
12866	":define")	d_endprotoent_r_proto=define
12867		set d_endprotoent_r_proto endprotoent_r $hdrs
12868		eval $hasproto ;;
12869	*)	;;
12870	esac
12871	case "$d_endprotoent_r_proto" in
12872	define)
12873	case "$endprotoent_r_proto" in
12874	''|0) try='int endprotoent_r(struct protoent_data*);'
12875	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12876	esac
12877	case "$endprotoent_r_proto" in
12878	''|0) try='void endprotoent_r(struct protoent_data*);'
12879	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12880	esac
12881	case "$endprotoent_r_proto" in
12882	''|0)	d_endprotoent_r=undef
12883		endprotoent_r_proto=0
12884		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12885	* )	case "$endprotoent_r_proto" in
12886		REENTRANT_PROTO*) ;;
12887		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12888		esac
12889		echo "Prototype: $try" ;;
12890	esac
12891	;;
12892	*)	case "$usethreads" in
12893		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12894		esac
12895		d_endprotoent_r=undef
12896		endprotoent_r_proto=0
12897		;;
12898	esac
12899	;;
12900*)	endprotoent_r_proto=0
12901	;;
12902esac
12903
12904: see if endpwent exists
12905set endpwent d_endpwent
12906eval $inlibc
12907
12908: see if this is a pwd.h system
12909set pwd.h i_pwd
12910eval $inhdr
12911
12912case "$i_pwd" in
12913$define)
12914	xxx=`./findhdr pwd.h`
12915	$cppstdin $cppflags $cppminus < $xxx >$$.h
12916
12917	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12918		val="$define"
12919	else
12920		val="$undef"
12921	fi
12922	set d_pwquota
12923	eval $setvar
12924
12925	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12926		val="$define"
12927	else
12928		val="$undef"
12929	fi
12930	set d_pwage
12931	eval $setvar
12932
12933	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12934		val="$define"
12935	else
12936		val="$undef"
12937	fi
12938	set d_pwchange
12939	eval $setvar
12940
12941	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12942		val="$define"
12943	else
12944		val="$undef"
12945	fi
12946	set d_pwclass
12947	eval $setvar
12948
12949	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12950		val="$define"
12951	else
12952		val="$undef"
12953	fi
12954	set d_pwexpire
12955	eval $setvar
12956
12957	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12958		val="$define"
12959	else
12960		val="$undef"
12961	fi
12962	set d_pwcomment
12963	eval $setvar
12964
12965	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12966		val="$define"
12967	else
12968		val="$undef"
12969	fi
12970	set d_pwgecos
12971	eval $setvar
12972
12973	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12974		val="$define"
12975	else
12976		val="$undef"
12977	fi
12978	set d_pwpasswd
12979	eval $setvar
12980
12981	$rm -f $$.h
12982	;;
12983*)
12984	val="$undef";
12985	set d_pwquota; eval $setvar
12986	set d_pwage; eval $setvar
12987	set d_pwchange; eval $setvar
12988	set d_pwclass; eval $setvar
12989	set d_pwexpire; eval $setvar
12990	set d_pwcomment; eval $setvar
12991	set d_pwgecos; eval $setvar
12992	set d_pwpasswd; eval $setvar
12993	;;
12994esac
12995
12996: see if endpwent_r exists
12997set endpwent_r d_endpwent_r
12998eval $inlibc
12999case "$d_endpwent_r" in
13000"$define")
13001	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13002	case "$d_endpwent_r_proto:$usethreads" in
13003	":define")	d_endpwent_r_proto=define
13004		set d_endpwent_r_proto endpwent_r $hdrs
13005		eval $hasproto ;;
13006	*)	;;
13007	esac
13008	case "$d_endpwent_r_proto" in
13009	define)
13010	case "$endpwent_r_proto" in
13011	''|0) try='int endpwent_r(FILE**);'
13012	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13013	esac
13014	case "$endpwent_r_proto" in
13015	''|0) try='void endpwent_r(FILE**);'
13016	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13017	esac
13018	case "$endpwent_r_proto" in
13019	''|0)	d_endpwent_r=undef
13020		endpwent_r_proto=0
13021		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13022	* )	case "$endpwent_r_proto" in
13023		REENTRANT_PROTO*) ;;
13024		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13025		esac
13026		echo "Prototype: $try" ;;
13027	esac
13028	;;
13029	*)	case "$usethreads" in
13030		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13031		esac
13032		d_endpwent_r=undef
13033		endpwent_r_proto=0
13034		;;
13035	esac
13036	;;
13037*)	endpwent_r_proto=0
13038	;;
13039esac
13040
13041: see if endservent exists
13042set endservent d_endsent
13043eval $inlibc
13044
13045: see if endservent_r exists
13046set endservent_r d_endservent_r
13047eval $inlibc
13048case "$d_endservent_r" in
13049"$define")
13050	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13051	case "$d_endservent_r_proto:$usethreads" in
13052	":define")	d_endservent_r_proto=define
13053		set d_endservent_r_proto endservent_r $hdrs
13054		eval $hasproto ;;
13055	*)	;;
13056	esac
13057	case "$d_endservent_r_proto" in
13058	define)
13059	case "$endservent_r_proto" in
13060	''|0) try='int endservent_r(struct servent_data*);'
13061	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13062	esac
13063	case "$endservent_r_proto" in
13064	''|0) try='void endservent_r(struct servent_data*);'
13065	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13066	esac
13067	case "$endservent_r_proto" in
13068	''|0)	d_endservent_r=undef
13069		endservent_r_proto=0
13070		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13071	* )	case "$endservent_r_proto" in
13072		REENTRANT_PROTO*) ;;
13073		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13074		esac
13075		echo "Prototype: $try" ;;
13076	esac
13077	;;
13078	*)	case "$usethreads" in
13079		define) echo "endservent_r has no prototype, not using it." >&4 ;;
13080		esac
13081		d_endservent_r=undef
13082		endservent_r_proto=0
13083		;;
13084	esac
13085	;;
13086*)	endservent_r_proto=0
13087	;;
13088esac
13089
13090: Locate the flags for 'open()'
13091echo " "
13092$cat >try.c <<EOCP
13093#include <sys/types.h>
13094#ifdef I_FCNTL
13095#include <fcntl.h>
13096#endif
13097#ifdef I_SYS_FILE
13098#include <sys/file.h>
13099#endif
13100#$i_stdlib I_STDLIB
13101#ifdef I_STDLIB
13102#include <stdlib.h>
13103#endif
13104int main() {
13105	if(O_RDONLY);
13106#ifdef O_TRUNC
13107	exit(0);
13108#else
13109	exit(1);
13110#endif
13111}
13112EOCP
13113: check sys/file.h first to get FREAD on Sun
13114if $test `./findhdr sys/file.h` && \
13115		set try -DI_SYS_FILE && eval $compile; then
13116	h_sysfile=true;
13117	echo "<sys/file.h> defines the O_* constants..." >&4
13118	if $run ./try; then
13119		echo "and you have the 3 argument form of open()." >&4
13120		val="$define"
13121	else
13122		echo "but not the 3 argument form of open().  Oh, well." >&4
13123		val="$undef"
13124	fi
13125elif $test `./findhdr fcntl.h` && \
13126		set try -DI_FCNTL && eval $compile; then
13127	h_fcntl=true;
13128	echo "<fcntl.h> defines the O_* constants..." >&4
13129	if $run ./try; then
13130		echo "and you have the 3 argument form of open()." >&4
13131		val="$define"
13132	else
13133		echo "but not the 3 argument form of open().  Oh, well." >&4
13134		val="$undef"
13135	fi
13136else
13137	val="$undef"
13138	echo "I can't find the O_* constant definitions!  You got problems." >&4
13139fi
13140set d_open3
13141eval $setvar
13142$rm_try
13143
13144: see if this is a sys/file.h system
13145val=''
13146set sys/file.h val
13147eval $inhdr
13148
13149: do we need to include sys/file.h ?
13150case "$val" in
13151"$define")
13152	echo " "
13153	if $h_sysfile; then
13154		val="$define"
13155		echo "We'll be including <sys/file.h>." >&4
13156	else
13157		val="$undef"
13158		echo "We won't be including <sys/file.h>." >&4
13159	fi
13160	;;
13161*)
13162	h_sysfile=false
13163	;;
13164esac
13165set i_sysfile
13166eval $setvar
13167
13168: see if fcntl.h is there
13169val=''
13170set fcntl.h val
13171eval $inhdr
13172
13173: see if we can include fcntl.h
13174case "$val" in
13175"$define")
13176	echo " "
13177	if $h_fcntl; then
13178		val="$define"
13179		echo "We'll be including <fcntl.h>." >&4
13180	else
13181		val="$undef"
13182		if $h_sysfile; then
13183	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13184		else
13185			echo "We won't be including <fcntl.h>." >&4
13186		fi
13187	fi
13188	;;
13189*)
13190	h_fcntl=false
13191	val="$undef"
13192	;;
13193esac
13194set i_fcntl
13195eval $setvar
13196
13197: see if fork exists
13198set fork d_fork
13199eval $inlibc
13200
13201: see if pipe exists
13202set pipe d_pipe
13203eval $inlibc
13204
13205: check for non-blocking I/O stuff
13206case "$h_sysfile" in
13207true) echo "#include <sys/file.h>" > head.c;;
13208*)
13209       case "$h_fcntl" in
13210       true) echo "#include <fcntl.h>" > head.c;;
13211       *) echo "#include <sys/fcntl.h>" > head.c;;
13212       esac
13213       ;;
13214esac
13215echo " "
13216echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13217case "$o_nonblock" in
13218'')
13219	$cat head.c > try.c
13220	$cat >>try.c <<EOCP
13221#include <stdio.h>
13222#$i_stdlib I_STDLIB
13223#ifdef I_STDLIB
13224#include <stdlib.h>
13225#endif
13226#$i_fcntl I_FCNTL
13227#ifdef I_FCNTL
13228#include <fcntl.h>
13229#endif
13230int main() {
13231#ifdef O_NONBLOCK
13232	printf("O_NONBLOCK\n");
13233	exit(0);
13234#endif
13235#ifdef O_NDELAY
13236	printf("O_NDELAY\n");
13237	exit(0);
13238#endif
13239#ifdef FNDELAY
13240	printf("FNDELAY\n");
13241	exit(0);
13242#endif
13243	exit(0);
13244}
13245EOCP
13246	set try
13247	if eval $compile_ok; then
13248		o_nonblock=`$run ./try`
13249		case "$o_nonblock" in
13250		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13251		*) echo "Seems like we can use $o_nonblock.";;
13252		esac
13253	else
13254		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13255	fi
13256	;;
13257*) echo "Using $hint value $o_nonblock.";;
13258esac
13259$rm_try
13260
13261echo " "
13262echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13263case "$eagain" in
13264'')
13265	case "$d_fork:$d_pipe:$d_alarm" in
13266	define:define:define)
13267	$cat head.c > try.c
13268	$cat >>try.c <<EOCP
13269#include <errno.h>
13270#include <sys/types.h>
13271#include <signal.h>
13272#include <stdio.h>
13273#$i_stdlib I_STDLIB
13274#ifdef I_STDLIB
13275#include <stdlib.h>
13276#endif
13277#$i_fcntl I_FCNTL
13278#ifdef I_FCNTL
13279#include <fcntl.h>
13280#endif
13281#define MY_O_NONBLOCK $o_nonblock
13282#ifndef errno  /* XXX need better Configure test */
13283extern int errno;
13284#endif
13285#$i_unistd I_UNISTD
13286#ifdef I_UNISTD
13287#include <unistd.h>
13288#endif
13289#include <string.h>
13290$signal_t blech(int x) { exit(3); }
13291EOCP
13292	$cat >> try.c <<'EOCP'
13293int main()
13294{
13295	int pd[2];
13296	int pu[2];
13297	char buf[1];
13298	char string[100];
13299	int ret;
13300
13301	ret = pipe(pd);	/* Down: child -> parent */
13302	if (ret != 0)
13303		exit(3);
13304	ret = pipe(pu);	/* Up: parent -> child */
13305	if (ret != 0)
13306		exit(3);
13307	if (0 != fork()) {
13308		close(pd[1]);	/* Parent reads from pd[0] */
13309		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
13310#ifdef F_SETFL
13311		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13312			exit(1);
13313#else
13314		exit(4);
13315#endif
13316		signal(SIGALRM, blech);
13317		alarm(5);
13318		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
13319			exit(2);
13320		sprintf(string, "%d\n", ret);
13321		ret = write(2, string, strlen(string));
13322		if (ret != strlen(string))
13323			exit(3);
13324		alarm(0);
13325#ifdef EAGAIN
13326		if (errno == EAGAIN) {
13327			printf("EAGAIN\n");
13328			goto ok;
13329		}
13330#endif
13331#ifdef EWOULDBLOCK
13332		if (errno == EWOULDBLOCK)
13333			printf("EWOULDBLOCK\n");
13334#endif
13335	ok:
13336		ret = write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
13337		if (ret != 1)
13338			exit(3);
13339		sleep(2);				/* Give it time to close our pipe */
13340		alarm(5);
13341		ret = read(pd[0], buf, 1);	/* Should read EOF */
13342		alarm(0);
13343		sprintf(string, "%d\n", ret);
13344		ret = write(4, string, strlen(string));
13345		if (ret != strlen(string))
13346			exit(3);
13347		exit(0);
13348	}
13349
13350	close(pd[0]);			/* We write to pd[1] */
13351	close(pu[1]);			/* We read from pu[0] */
13352	ret = read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
13353	if (ret != 1)
13354		exit(3);
13355	close(pd[1]);			/* Pipe pd is now fully closed! */
13356	exit(0);				/* Bye bye, thank you for playing! */
13357}
13358EOCP
13359	set try
13360	if eval $compile_ok; then
13361		echo "$startsh" >mtry
13362		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13363		chmod +x mtry
13364		$run ./mtry >/dev/null 2>&1
13365		case $? in
13366		0) eagain=`$cat try.out`;;
13367		1) echo "Could not perform non-blocking setting!";;
13368		2) echo "I did a successful read() for something that was not there!";;
13369		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13370		4) echo "Could not find F_SETFL!";;
13371		*) echo "Something terribly wrong happened during testing.";;
13372		esac
13373		rd_nodata=`$cat try.ret`
13374		echo "A read() system call with no data present returns $rd_nodata."
13375		case "$rd_nodata" in
13376		0|-1) ;;
13377		*)
13378			echo "(That's peculiar, fixing that to be -1.)"
13379			rd_nodata=-1
13380			;;
13381		esac
13382		case "$eagain" in
13383		'')
13384			echo "Forcing errno EAGAIN on read() with no data available."
13385			eagain=EAGAIN
13386			;;
13387		*)
13388			echo "Your read() sets errno to $eagain when no data is available."
13389			;;
13390		esac
13391		status=`$cat try.err`
13392		case "$status" in
13393		0) echo "And it correctly returns 0 to signal EOF.";;
13394		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
13395		*) echo "However, your read() returns '$status' on EOF??";;
13396		esac
13397		val="$define"
13398		if test "$status" = "$rd_nodata"; then
13399			echo "WARNING: you can't distinguish between EOF and no data!"
13400			val="$undef"
13401		fi
13402	else
13403		echo "I can't compile the test program--assuming errno EAGAIN will do."
13404		eagain=EAGAIN
13405	fi
13406	;;
13407	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13408		eagain=EAGAIN
13409		val="$define"
13410		;;
13411	esac
13412	set d_eofnblk
13413	eval $setvar
13414	;;
13415*)
13416	echo "Using $hint value $eagain."
13417	echo "Your read() returns $rd_nodata when no data is present."
13418	case "$d_eofnblk" in
13419	"$define") echo "And you can see EOF because read() returns 0.";;
13420	"$undef") echo "But you can't see EOF status from read() returned value.";;
13421	*)
13422		echo "(Assuming you can't see EOF status from read anyway.)"
13423		d_eofnblk=$undef
13424		;;
13425	esac
13426	;;
13427esac
13428$rm_try head.c mtry
13429
13430: see if erf exists
13431set erf d_erf
13432eval $inlibc
13433
13434: see if erfc exists
13435set erfc d_erfc
13436eval $inlibc
13437
13438: see if exp2 exists
13439set exp2 d_exp2
13440eval $inlibc
13441
13442: see if expm1 exists
13443set expm1 d_expm1
13444eval $inlibc
13445
13446: see if _ptr and _cnt from stdio act std
13447echo " "
13448
13449if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13450	echo "(Looks like you have stdio.h from BSD.)"
13451	case "$stdio_ptr" in
13452	'') stdio_ptr='((fp)->_p)'
13453		ptr_lval=$define
13454		;;
13455	*)	ptr_lval=$d_stdio_ptr_lval;;
13456	esac
13457	case "$stdio_cnt" in
13458	'') stdio_cnt='((fp)->_r)'
13459		cnt_lval=$define
13460		;;
13461	*)	cnt_lval=$d_stdio_cnt_lval;;
13462	esac
13463	case "$stdio_base" in
13464	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13465	esac
13466	case "$stdio_bufsiz" in
13467	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13468	esac
13469elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13470	echo "(Looks like you have stdio.h from Linux.)"
13471	case "$stdio_ptr" in
13472	'') stdio_ptr='((fp)->_IO_read_ptr)'
13473		ptr_lval=$define
13474		;;
13475	*)	ptr_lval=$d_stdio_ptr_lval;;
13476	esac
13477	case "$stdio_cnt" in
13478	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13479		cnt_lval=$undef
13480		;;
13481	*)	cnt_lval=$d_stdio_cnt_lval;;
13482	esac
13483	case "$stdio_base" in
13484	'') stdio_base='((fp)->_IO_read_base)';;
13485	esac
13486	case "$stdio_bufsiz" in
13487	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13488	esac
13489else
13490	case "$stdio_ptr" in
13491	'') stdio_ptr='((fp)->_ptr)'
13492		ptr_lval=$define
13493		;;
13494	*)	ptr_lval=$d_stdio_ptr_lval;;
13495	esac
13496	case "$stdio_cnt" in
13497	'') stdio_cnt='((fp)->_cnt)'
13498		cnt_lval=$define
13499		;;
13500	*)	cnt_lval=$d_stdio_cnt_lval;;
13501	esac
13502	case "$stdio_base" in
13503	'') stdio_base='((fp)->_base)';;
13504	esac
13505	case "$stdio_bufsiz" in
13506	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13507	esac
13508fi
13509
13510: test whether _ptr and _cnt really work
13511echo "Checking how std your stdio is..." >&4
13512$cat >try.c <<EOP
13513#include <stdio.h>
13514#$i_stdlib I_STDLIB
13515#ifdef I_STDLIB
13516#include <stdlib.h>
13517#endif
13518#define FILE_ptr(fp)	$stdio_ptr
13519#define FILE_cnt(fp)	$stdio_cnt
13520int main() {
13521	FILE *fp = fopen("try.c", "r");
13522	char c = getc(fp);
13523	if (
13524		18 <= FILE_cnt(fp) &&
13525		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13526	)
13527		exit(0);
13528	exit(1);
13529}
13530EOP
13531val="$undef"
13532set try
13533if eval $compile && $to try.c; then
13534	if $run ./try; then
13535		echo "Your stdio acts pretty std."
13536		val="$define"
13537	else
13538		echo "Your stdio isn't very std."
13539	fi
13540else
13541	echo "Your stdio doesn't appear very std."
13542fi
13543$rm_try
13544
13545# glibc 2.2.90 and above apparently change stdio streams so Perl's
13546# direct buffer manipulation no longer works.  The Configure tests
13547# should be changed to correctly detect this, but until then,
13548# the following check should at least let perl compile and run.
13549# (This quick fix should be updated before 5.8.1.)
13550# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13551# A. Dougherty, June 3, 2002.
13552case "$d_gnulibc" in
13553$define)
13554	case "$gnulibc_version" in
13555	2.[01]*)  ;;
13556	2.2) ;;
13557	2.2.[0-9]) ;;
13558	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13559		val="$undef"
13560		;;
13561	esac
13562	;;
13563esac
13564set d_stdstdio
13565eval $setvar
13566
13567: Can _ptr be used as an lvalue?
13568case "$d_stdstdio$ptr_lval" in
13569$define$define) val=$define ;;
13570*) val=$undef ;;
13571esac
13572set d_stdio_ptr_lval
13573eval $setvar
13574
13575: Can _cnt be used as an lvalue?
13576case "$d_stdstdio$cnt_lval" in
13577$define$define) val=$define ;;
13578*) val=$undef ;;
13579esac
13580set d_stdio_cnt_lval
13581eval $setvar
13582
13583
13584: test whether setting _ptr sets _cnt as a side effect
13585d_stdio_ptr_lval_sets_cnt="$undef"
13586d_stdio_ptr_lval_nochange_cnt="$undef"
13587case "$d_stdio_ptr_lval$d_stdstdio" in
13588$define$define)
13589	echo "Checking to see what happens if we set the stdio ptr..." >&4
13590$cat >try.c <<EOP
13591#include <stdio.h>
13592/* Can we scream? */
13593/* Eat dust sed :-) */
13594/* In the buffer space, no one can hear you scream. */
13595#$i_stdlib I_STDLIB
13596#ifdef I_STDLIB
13597#include <stdlib.h>
13598#endif
13599#define FILE_ptr(fp)	$stdio_ptr
13600#define FILE_cnt(fp)	$stdio_cnt
13601#include <sys/types.h>
13602int main() {
13603	FILE *fp = fopen("try.c", "r");
13604	int c;
13605	char *ptr;
13606	size_t cnt;
13607	if (!fp) {
13608	    puts("Fail even to read");
13609	    exit(1);
13610	}
13611	c = getc(fp); /* Read away the first # */
13612	if (c == EOF) {
13613	    puts("Fail even to read");
13614	    exit(1);
13615	}
13616	if (!(
13617		18 <= FILE_cnt(fp) &&
13618		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13619	)) {
13620		puts("Fail even to read");
13621		exit (1);
13622	}
13623	ptr = (char*) FILE_ptr(fp);
13624	cnt = (size_t)FILE_cnt(fp);
13625
13626	FILE_ptr(fp) += 42;
13627
13628	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13629		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13630		exit (1);
13631	}
13632	if (FILE_cnt(fp) <= 20) {
13633		printf ("Fail (<20 chars to test)");
13634		exit (1);
13635	}
13636	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13637		puts("Fail compare");
13638		exit (1);
13639	}
13640	if (cnt == FILE_cnt(fp)) {
13641		puts("Pass_unchanged");
13642		exit (0);
13643	}
13644	if (FILE_cnt(fp) == (cnt - 42)) {
13645		puts("Pass_changed");
13646		exit (0);
13647	}
13648	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13649	return 1;
13650
13651}
13652EOP
13653	set try
13654	if eval $compile && $to try.c; then
13655		case `$run ./try` in
13656		Pass_changed)
13657			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13658			d_stdio_ptr_lval_sets_cnt="$define" ;;
13659		Pass_unchanged)
13660			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13661			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13662		Fail*)
13663			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13664		*)
13665			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13666	esac
13667	else
13668		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13669	fi
13670	$rm_try
13671	;;
13672esac
13673
13674: see if _base is also standard
13675val="$undef"
13676case "$d_stdstdio" in
13677$define)
13678	$cat >try.c <<EOP
13679#include <stdio.h>
13680#$i_stdlib I_STDLIB
13681#ifdef I_STDLIB
13682#include <stdlib.h>
13683#endif
13684#define FILE_base(fp)	$stdio_base
13685#define FILE_bufsiz(fp)	$stdio_bufsiz
13686int main() {
13687	FILE *fp = fopen("try.c", "r");
13688	char c = getc(fp);
13689	if (
13690		19 <= FILE_bufsiz(fp) &&
13691		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13692	)
13693		exit(0);
13694	exit(1);
13695}
13696EOP
13697	set try
13698	if eval $compile && $to try.c; then
13699		if $run ./try; then
13700			echo "And its _base field acts std."
13701			val="$define"
13702		else
13703			echo "But its _base field isn't std."
13704		fi
13705	else
13706		echo "However, it seems to be lacking the _base field."
13707	fi
13708	$rm_try
13709	;;
13710esac
13711set d_stdiobase
13712eval $setvar
13713
13714: see if fast_stdio exists
13715val="$undef"
13716case "$d_stdstdio:$d_stdio_ptr_lval" in
13717"$define:$define")
13718	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13719	*$define*)
13720		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13721		val="$define"
13722		;;
13723	esac
13724	;;
13725esac
13726set d_faststdio
13727eval $setvar
13728
13729: see if fchdir exists
13730set fchdir d_fchdir
13731eval $inlibc
13732
13733: see if fchmod exists
13734set fchmod d_fchmod
13735eval $inlibc
13736
13737: check for openat, unlinkat, renameat, linkat, fchmodat
13738set openat d_openat
13739eval $inlibc
13740
13741set unlinkat d_unlinkat
13742eval $inlibc
13743
13744set renameat d_renameat
13745eval $inlibc
13746
13747set linkat d_linkat
13748eval $inlibc
13749
13750set fchmodat d_fchmodat
13751eval $inlibc
13752
13753: see if fchown exists
13754set fchown d_fchown
13755eval $inlibc
13756
13757: see if this is an fcntl system
13758set fcntl d_fcntl
13759eval $inlibc
13760
13761: See if fcntl-based locking works.
13762echo " "
13763$cat >try.c <<EOCP
13764#$i_stdlib I_STDLIB
13765#ifdef I_STDLIB
13766#include <stdlib.h>
13767#endif
13768#include <unistd.h>
13769#include <fcntl.h>
13770#include <signal.h>
13771$signal_t blech(int x) { exit(3); }
13772int main() {
13773#if defined(F_SETLK) && defined(F_SETLKW)
13774     struct flock flock;
13775     int retval, fd;
13776     fd = open("try.c", O_RDONLY);
13777     flock.l_type = F_RDLCK;
13778     flock.l_whence = SEEK_SET;
13779     flock.l_start = flock.l_len = 0;
13780     signal(SIGALRM, blech);
13781     alarm(10);
13782     retval = fcntl(fd, F_SETLK, &flock);
13783     close(fd);
13784     (retval < 0 ? exit(2) : exit(0));
13785#else
13786     exit(2);
13787#endif
13788}
13789EOCP
13790echo "Checking if fcntl-based file locking works... "
13791case "$d_fcntl" in
13792"$define")
13793	set try
13794	if eval $compile_ok; then
13795		if $run ./try; then
13796			echo "Yes, it seems to work."
13797			val="$define"
13798		else
13799			echo "Nope, it didn't work."
13800			val="$undef"
13801			case "$?" in
13802			3) $cat >&4 <<EOM
13803***
13804*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13805*** This is (almost) impossible.
13806*** If your NFS lock daemons are not feeling well, something like
13807*** this may happen, please investigate.  Cannot continue, aborting.
13808***
13809EOM
13810				exit 1
13811				;;
13812			esac
13813		fi
13814	else
13815		echo "I'm unable to compile the test program, so I'll assume not."
13816		val="$undef"
13817	fi
13818	;;
13819*) val="$undef";
13820	echo "Nope, since you don't even have fcntl()."
13821	;;
13822esac
13823set d_fcntl_can_lock
13824eval $setvar
13825$rm_try
13826
13827: check for fd_set items
13828$cat <<EOM
13829
13830Checking to see how well your C compiler handles fd_set and friends ...
13831EOM
13832$cat >try.c <<EOCP
13833#$i_stdlib I_STDLIB
13834#ifdef I_STDLIB
13835#include <stdlib.h>
13836#endif
13837#$i_systime I_SYS_TIME
13838#$i_sysselct I_SYS_SELECT
13839#$d_socket HAS_SOCKET
13840#include <sys/types.h>
13841#ifdef HAS_SOCKET
13842#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13843#endif
13844#ifdef I_SYS_TIME
13845#include <sys/time.h>
13846#endif
13847#ifdef I_SYS_SELECT
13848#include <sys/select.h>
13849#endif
13850int main() {
13851	fd_set fds;
13852
13853#ifdef TRYBITS
13854	if(fds.fds_bits);
13855#endif
13856
13857#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13858	exit(0);
13859#else
13860	exit(1);
13861#endif
13862}
13863EOCP
13864set try -DTRYBITS
13865if eval $compile; then
13866	d_fds_bits="$define"
13867	d_fd_set="$define"
13868	echo "Well, your system knows about the normal fd_set typedef..." >&4
13869	if $run ./try; then
13870		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13871		d_fd_macros="$define"
13872	else
13873		$cat >&4 <<'EOM'
13874but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13875EOM
13876		d_fd_macros="$undef"
13877	fi
13878else
13879	$cat <<'EOM'
13880Hmm, your compiler has some difficulty with fd_set.  Checking further...
13881EOM
13882	set try
13883	if eval $compile; then
13884		d_fds_bits="$undef"
13885		d_fd_set="$define"
13886		echo "Well, your system has some sort of fd_set available..." >&4
13887		if $run ./try; then
13888			echo "and you have the normal fd_set macros." >&4
13889			d_fd_macros="$define"
13890		else
13891			$cat <<'EOM'
13892but not the normal fd_set macros!  Gross!  More work for me...
13893EOM
13894			d_fd_macros="$undef"
13895		fi
13896	else
13897	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13898		d_fd_set="$undef"
13899		d_fds_bits="$undef"
13900		d_fd_macros="$undef"
13901	fi
13902fi
13903$rm_try
13904
13905: see if fdclose exists
13906set fdclose d_fdclose
13907eval $inlibc
13908
13909: see if fdim exists
13910set fdim d_fdim
13911eval $inlibc
13912
13913: see if fegetround exists
13914set fegetround d_fegetround
13915eval $inlibc
13916
13917: see if fgetpos exists
13918set fgetpos d_fgetpos
13919eval $inlibc
13920
13921: see if finite exists
13922set finite d_finite
13923eval $inlibc
13924
13925: see if finitel exists
13926set finitel d_finitel
13927eval $inlibc
13928
13929: see if flock exists
13930set flock d_flock
13931eval $inlibc
13932
13933: see if prototype for flock is available
13934echo " "
13935set d_flockproto flock $i_sysfile sys/file.h
13936eval $hasproto
13937
13938: see if fma exists
13939set fma d_fma
13940eval $inlibc
13941
13942: see if fmax exists
13943set fmax d_fmax
13944eval $inlibc
13945
13946: see if fmin exists
13947set fmin d_fmin
13948eval $inlibc
13949
13950: see if fp_class exists
13951set fp_class d_fp_class
13952eval $inlibc
13953
13954: check for fpclassify
13955echo "Checking to see if you have fpclassify..." >&4
13956$cat >try.c <<EOCP
13957#include <math.h>
13958int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13959EOCP
13960set try
13961if eval $compile; then
13962	val="$define"
13963	echo "You have fpclassify."
13964else
13965	val="$undef"
13966	echo "You do not have fpclassify."
13967fi
13968$rm_try
13969set d_fpclassify
13970eval $setvar
13971
13972: see if fp_classify exists
13973set fp_classify d_fp_classify
13974eval $inlibc
13975
13976: see if fp_classl exists
13977set fp_classl d_fp_classl
13978eval $inlibc
13979
13980: see if pathconf exists
13981set pathconf d_pathconf
13982eval $inlibc
13983
13984: see if fpathconf exists
13985set fpathconf d_fpathconf
13986eval $inlibc
13987
13988: see if fpclass exists
13989set fpclass d_fpclass
13990eval $inlibc
13991
13992: see if fpclassl exists
13993set fpclassl d_fpclassl
13994eval $inlibc
13995
13996: see if fpgetround exists
13997set fpgetround d_fpgetround
13998eval $inlibc
13999
14000: check for fpos64_t
14001echo " "
14002echo "Checking to see if you have fpos64_t..." >&4
14003$cat >try.c <<EOCP
14004#include <stdio.h>
14005int main() { fpos64_t x = 7; }
14006EOCP
14007set try
14008if eval $compile; then
14009	val="$define"
14010	echo "You have fpos64_t."
14011else
14012	val="$undef"
14013	echo "You do not have fpos64_t."
14014	case "$fpossize" in
14015	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14016	esac
14017fi
14018$rm_try
14019set d_fpos64_t
14020eval $setvar
14021
14022: see if frexpl exists
14023set frexpl d_frexpl
14024eval $inlibc
14025
14026: see if this is a sys/param system
14027set sys/param.h i_sysparam
14028eval $inhdr
14029
14030: see if this is a sys/mount.h system
14031set sys/mount.h i_sysmount
14032eval $inhdr
14033
14034: Check for fs_data_s
14035echo " "
14036echo "Checking to see if your system supports struct fs_data..." >&4
14037set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14038eval $hasstruct
14039case "$d_fs_data_s" in
14040"$define")      echo "Yes, it does."   ;;
14041*)              echo "No, it doesn't." ;;
14042esac
14043
14044: see if fseeko exists
14045set fseeko d_fseeko
14046eval $inlibc
14047case "$longsize" in
140488) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14049esac
14050
14051: see if fsetpos exists
14052set fsetpos d_fsetpos
14053eval $inlibc
14054
14055: see if fstatfs exists
14056set fstatfs d_fstatfs
14057eval $inlibc
14058
14059: see if statvfs exists
14060set statvfs d_statvfs
14061eval $inlibc
14062
14063: see if fstatvfs exists
14064set fstatvfs d_fstatvfs
14065eval $inlibc
14066
14067: see if fsync exists
14068set fsync d_fsync
14069eval $inlibc
14070
14071: see if ftello exists
14072set ftello d_ftello
14073eval $inlibc
14074case "$longsize" in
140758) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14076esac
14077
14078: check for a working futimes
14079d_futimes="$undef"
14080echo " "
14081echo "Checking if you have a working futimes()" >&4
14082$cat >try.c <<EOCP
14083#include <stdio.h>
14084#include <sys/time.h>
14085#include <errno.h>
14086#include <fcntl.h>
14087
14088int main ()
14089{
14090    int fd, rv;
14091    fd = open ("try.c", O_RDWR);
14092    if (-1 == fd) exit (1);
14093    rv = futimes (fd, NULL);
14094    exit (rv == -1 ? errno : 0);
14095}
14096EOCP
14097set try
14098if eval $compile; then
14099    `$run ./try`
14100    rc=$?
14101    case "$rc" in
14102	0)  echo "Yes, you have" >&4
14103	    d_futimes="$define"
14104	    ;;
14105	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14106	    ;;
14107    esac
14108else
14109    echo "No, it does not (probably harmless)" >&4
14110fi
14111$rm_try
14112
14113: look for gai_strerror
14114echo " "
14115$cat >try.c <<'EOCP'
14116#include <sys/types.h>
14117#include <sys/socket.h>
14118#include <netdb.h>
14119int main ()
14120{
14121    return (gai_strerror (0) ? 0 : 1);
14122    }
14123EOCP
14124set try
14125val="$undef"
14126if eval $compile; then
14127    `$run ./try`
14128    case "$?" in
14129	0)  echo "A working gai_strerror() found." >&4
14130	    val="$define" ;;
14131	*)  echo "gai_strerror() found, but it doesn't work" >&4
14132	    ;;
14133	esac
14134else
14135    echo "gai_strerror() NOT found." >&4
14136    fi
14137set d_gai_strerror
14138eval $setvar
14139$rm_try
14140
14141: see if ndbm.h is available
14142set ndbm.h i_ndbm
14143eval $inhdr
14144: Compatibility location for RedHat 7.1
14145set gdbm/ndbm.h i_gdbmndbm
14146eval $inhdr
14147: Compatibility location for Debian 4.0
14148set gdbm-ndbm.h i_gdbm_ndbm
14149eval $inhdr
14150
14151val="$undef"
14152if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14153	: see if dbm_open exists
14154	set dbm_open d_dbm_open
14155	eval $inlibc
14156	case "$d_dbm_open" in
14157	$undef)
14158		i_ndbm="$undef"
14159		i_gdbmndbm="$undef"
14160		i_gdbm_ndbm="$undef"
14161		echo "We won't be including <ndbm.h>"
14162		val="$undef"
14163		;;
14164	*) val="$define"
14165	   ;;
14166	esac
14167fi
14168set d_ndbm
14169eval $setvar
14170
14171ndbm_hdr_protochk='name=$1; hdr=$2;
14172eval "ihdr=\$""i_$name";
14173val="$undef";
14174if $test "$ihdr" = "$define"; then
14175	$echo "Checking if your <$hdr> uses prototypes..." >&4;
14176	case "$d_cplusplus" in
14177	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14178	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14179	esac;
14180	case "$val" in
14181	$define) $echo "Your <$hdr> seems to have prototypes";;
14182	*) $echo "Your <$hdr> does not seem to have prototypes";;
14183	esac;
14184fi;
14185set "d_${name}_h_uses_prototypes";
14186eval $setvar'
14187
14188set ndbm ndbm.h
14189eval $ndbm_hdr_protochk
14190set gdbmndbm gdbm/ndbm.h
14191eval $ndbm_hdr_protochk
14192set gdbm_ndbm gdbm-ndbm.h
14193eval $ndbm_hdr_protochk
14194
14195: see if getaddrinfo exists
14196set getaddrinfo d_getaddrinfo
14197eval $inlibc
14198
14199: see if getcwd exists
14200set getcwd d_getcwd
14201eval $inlibc
14202
14203: see if getespwnam exists
14204set getespwnam d_getespwnam
14205eval $inlibc
14206
14207: see if getfsstat exists
14208set getfsstat d_getfsstat
14209eval $inlibc
14210
14211: see if getgrent exists
14212set getgrent d_getgrent
14213eval $inlibc
14214
14215: see if getgrent_r exists
14216set getgrent_r d_getgrent_r
14217eval $inlibc
14218case "$d_getgrent_r" in
14219"$define")
14220	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14221	case "$d_getgrent_r_proto:$usethreads" in
14222	":define")	d_getgrent_r_proto=define
14223		set d_getgrent_r_proto getgrent_r $hdrs
14224		eval $hasproto ;;
14225	*)	;;
14226	esac
14227	case "$d_getgrent_r_proto" in
14228	define)
14229	case "$getgrent_r_proto" in
14230	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14231	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14232	esac
14233	case "$getgrent_r_proto" in
14234	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14235	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14236	esac
14237	case "$getgrent_r_proto" in
14238	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14239	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14240	esac
14241	case "$getgrent_r_proto" in
14242	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14243	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14244	esac
14245	case "$getgrent_r_proto" in
14246	''|0) try='int getgrent_r(struct group*, char*, int);'
14247	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14248	esac
14249	case "$getgrent_r_proto" in
14250	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14251	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14252	esac
14253	case "$getgrent_r_proto" in
14254	''|0)	d_getgrent_r=undef
14255		getgrent_r_proto=0
14256		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14257	* )	case "$getgrent_r_proto" in
14258		REENTRANT_PROTO*) ;;
14259		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14260		esac
14261		echo "Prototype: $try" ;;
14262	esac
14263	;;
14264	*)	case "$usethreads" in
14265		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14266		esac
14267		d_getgrent_r=undef
14268		getgrent_r_proto=0
14269		;;
14270	esac
14271	;;
14272*)	getgrent_r_proto=0
14273	;;
14274esac
14275
14276: see if getgrgid_r exists
14277set getgrgid_r d_getgrgid_r
14278eval $inlibc
14279case "$d_getgrgid_r" in
14280"$define")
14281	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14282	case "$d_getgrgid_r_proto:$usethreads" in
14283	":define")	d_getgrgid_r_proto=define
14284		set d_getgrgid_r_proto getgrgid_r $hdrs
14285		eval $hasproto ;;
14286	*)	;;
14287	esac
14288	case "$d_getgrgid_r_proto" in
14289	define)
14290	case "$getgrgid_r_proto" in
14291	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14292	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14293	esac
14294	case "$getgrgid_r_proto" in
14295	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14296	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14297	esac
14298	case "$getgrgid_r_proto" in
14299	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14300	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14301	esac
14302	case "$getgrgid_r_proto" in
14303	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14304	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14305	esac
14306	case "$getgrgid_r_proto" in
14307	''|0)	d_getgrgid_r=undef
14308		getgrgid_r_proto=0
14309		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14310	* )	case "$getgrgid_r_proto" in
14311		REENTRANT_PROTO*) ;;
14312		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14313		esac
14314		echo "Prototype: $try" ;;
14315	esac
14316	;;
14317	*)	case "$usethreads" in
14318		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14319		esac
14320		d_getgrgid_r=undef
14321		getgrgid_r_proto=0
14322		;;
14323	esac
14324	;;
14325*)	getgrgid_r_proto=0
14326	;;
14327esac
14328
14329: see if getgrnam_r exists
14330set getgrnam_r d_getgrnam_r
14331eval $inlibc
14332case "$d_getgrnam_r" in
14333"$define")
14334	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14335	case "$d_getgrnam_r_proto:$usethreads" in
14336	":define")	d_getgrnam_r_proto=define
14337		set d_getgrnam_r_proto getgrnam_r $hdrs
14338		eval $hasproto ;;
14339	*)	;;
14340	esac
14341	case "$d_getgrnam_r_proto" in
14342	define)
14343	case "$getgrnam_r_proto" in
14344	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14345	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14346	esac
14347	case "$getgrnam_r_proto" in
14348	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14349	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14350	esac
14351	case "$getgrnam_r_proto" in
14352	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14353	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14354	esac
14355	case "$getgrnam_r_proto" in
14356	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14357	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14358	esac
14359	case "$getgrnam_r_proto" in
14360	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14361	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14362	esac
14363	case "$getgrnam_r_proto" in
14364	''|0)	d_getgrnam_r=undef
14365		getgrnam_r_proto=0
14366		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14367	* )	case "$getgrnam_r_proto" in
14368		REENTRANT_PROTO*) ;;
14369		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14370		esac
14371		echo "Prototype: $try" ;;
14372	esac
14373	;;
14374	*)	case "$usethreads" in
14375		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14376		esac
14377		d_getgrnam_r=undef
14378		getgrnam_r_proto=0
14379		;;
14380	esac
14381	;;
14382*)	getgrnam_r_proto=0
14383	;;
14384esac
14385
14386: see if gethostbyaddr exists
14387set gethostbyaddr d_gethbyaddr
14388eval $inlibc
14389
14390: see if gethostbyname exists
14391set gethostbyname d_gethbyname
14392eval $inlibc
14393
14394: see if gethostent exists
14395set gethostent d_gethent
14396eval $inlibc
14397
14398: see how we will look up host name
14399echo " "
14400call=''
14401if set gethostname val -f d_gethname; eval $csym; $val; then
14402	echo 'gethostname() found.' >&4
14403	d_gethname="$define"
14404	call=gethostname
14405fi
14406if set uname val -f d_uname; eval $csym; $val; then
14407	if ./xenix; then
14408		$cat <<'EOM'
14409uname() was found, but you're running xenix, and older versions of xenix
14410have a broken uname(). If you don't really know whether your xenix is old
14411enough to have a broken system call, use the default answer.
14412
14413EOM
14414		dflt=y
14415		case "$d_uname" in
14416		"$define") dflt=n;;
14417		esac
14418		rp='Is your uname() broken?'
14419		. ./myread
14420		case "$ans" in
14421		n*) d_uname="$define"; call=uname;;
14422		esac
14423	else
14424		echo 'uname() found.' >&4
14425		d_uname="$define"
14426		case "$call" in
14427		'') call=uname ;;
14428		esac
14429	fi
14430fi
14431case "$d_gethname" in
14432'') d_gethname="$undef";;
14433esac
14434case "$d_uname" in
14435'') d_uname="$undef";;
14436esac
14437case "$d_uname$d_gethname" in
14438*define*)
14439	dflt=n
14440	cat <<EOM
14441
14442Every now and then someone has a $call() that lies about the hostname
14443but can't be fixed for political or economic reasons.  If you wish, I can
14444pretend $call() isn't there and maybe compute hostname at run-time
14445thanks to the '$phostname' command.
14446
14447EOM
14448	rp="Shall I ignore $call() from now on?"
14449	. ./myread
14450	case "$ans" in
14451	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14452	esac;;
14453esac
14454case "$phostname" in
14455'') aphostname='';;
14456*) case "$aphostname" in
14457	/*) ;;
14458	*) set X $phostname
14459		shift
14460		file=$1
14461		shift
14462		file=`./loc $file $file $pth`
14463		aphostname=`echo $file $*`
14464		;;
14465	esac
14466	;;
14467esac
14468case "$d_uname$d_gethname" in
14469*define*) ;;
14470*)
14471	case "$phostname" in
14472	'')
14473		echo "There will be no way for $package to get your hostname." >&4;;
14474	*)
14475	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14476		;;
14477	esac;;
14478esac
14479case "$d_phostname" in
14480'') d_phostname="$undef";;
14481esac
14482
14483: see if gethostbyaddr_r exists
14484set gethostbyaddr_r d_gethostbyaddr_r
14485eval $inlibc
14486case "$d_gethostbyaddr_r" in
14487"$define")
14488	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14489	case "$d_gethostbyaddr_r_proto:$usethreads" in
14490	":define")	d_gethostbyaddr_r_proto=define
14491		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14492		eval $hasproto ;;
14493	*)	;;
14494	esac
14495	case "$d_gethostbyaddr_r_proto" in
14496	define)
14497	case "$gethostbyaddr_r_proto" in
14498	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14499	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14500	esac
14501	case "$gethostbyaddr_r_proto" in
14502	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14503	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14504	esac
14505	case "$gethostbyaddr_r_proto" in
14506	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14507	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14508	esac
14509	case "$gethostbyaddr_r_proto" in
14510	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14511	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14512	esac
14513	case "$gethostbyaddr_r_proto" in
14514	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14515	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14516	esac
14517	case "$gethostbyaddr_r_proto" in
14518	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14519	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14520	esac
14521	case "$gethostbyaddr_r_proto" in
14522	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14523	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14524	esac
14525	case "$gethostbyaddr_r_proto" in
14526	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14527	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14528	esac
14529	case "$gethostbyaddr_r_proto" in
14530	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14531	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14532	esac
14533	case "$gethostbyaddr_r_proto" in
14534	''|0) try='int gethostbyaddr_r(const char*, int, int);'
14535	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14536	esac
14537	case "$gethostbyaddr_r_proto" in
14538	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14539	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14540	esac
14541	case "$gethostbyaddr_r_proto" in
14542	''|0)	d_gethostbyaddr_r=undef
14543		gethostbyaddr_r_proto=0
14544		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14545	* )	case "$gethostbyaddr_r_proto" in
14546		REENTRANT_PROTO*) ;;
14547		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14548		esac
14549		echo "Prototype: $try" ;;
14550	esac
14551	;;
14552	*)	case "$usethreads" in
14553		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14554		esac
14555		d_gethostbyaddr_r=undef
14556		gethostbyaddr_r_proto=0
14557		;;
14558	esac
14559	;;
14560*)	gethostbyaddr_r_proto=0
14561	;;
14562esac
14563
14564: see if gethostbyname_r exists
14565set gethostbyname_r d_gethostbyname_r
14566eval $inlibc
14567case "$d_gethostbyname_r" in
14568"$define")
14569	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14570	case "$d_gethostbyname_r_proto:$usethreads" in
14571	":define")	d_gethostbyname_r_proto=define
14572		set d_gethostbyname_r_proto gethostbyname_r $hdrs
14573		eval $hasproto ;;
14574	*)	;;
14575	esac
14576	case "$d_gethostbyname_r_proto" in
14577	define)
14578	case "$gethostbyname_r_proto" in
14579	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14580	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14581	esac
14582	case "$gethostbyname_r_proto" in
14583	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14584	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14585	esac
14586	case "$gethostbyname_r_proto" in
14587	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14588	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14589	esac
14590	case "$gethostbyname_r_proto" in
14591	''|0)	d_gethostbyname_r=undef
14592		gethostbyname_r_proto=0
14593		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14594	* )	case "$gethostbyname_r_proto" in
14595		REENTRANT_PROTO*) ;;
14596		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14597		esac
14598		echo "Prototype: $try" ;;
14599	esac
14600	;;
14601	*)	case "$usethreads" in
14602		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14603		esac
14604		d_gethostbyname_r=undef
14605		gethostbyname_r_proto=0
14606		;;
14607	esac
14608	;;
14609*)	gethostbyname_r_proto=0
14610	;;
14611esac
14612
14613: see if gethostent_r exists
14614set gethostent_r d_gethostent_r
14615eval $inlibc
14616case "$d_gethostent_r" in
14617"$define")
14618	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14619	case "$d_gethostent_r_proto:$usethreads" in
14620	":define")	d_gethostent_r_proto=define
14621		set d_gethostent_r_proto gethostent_r $hdrs
14622		eval $hasproto ;;
14623	*)	;;
14624	esac
14625	case "$d_gethostent_r_proto" in
14626	define)
14627	case "$gethostent_r_proto" in
14628	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14629	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14630	esac
14631	case "$gethostent_r_proto" in
14632	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14633	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14634	esac
14635	case "$gethostent_r_proto" in
14636	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14637	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14638	esac
14639	case "$gethostent_r_proto" in
14640	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14641	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14642	esac
14643	case "$gethostent_r_proto" in
14644	''|0) try='int gethostent_r(struct hostent*, char*, int);'
14645	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14646	esac
14647	case "$gethostent_r_proto" in
14648	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14649	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14650	esac
14651	case "$gethostent_r_proto" in
14652	''|0)	d_gethostent_r=undef
14653		gethostent_r_proto=0
14654		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14655	* )	case "$gethostent_r_proto" in
14656		REENTRANT_PROTO*) ;;
14657		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14658		esac
14659		echo "Prototype: $try" ;;
14660	esac
14661	;;
14662	*)	case "$usethreads" in
14663		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14664		esac
14665		d_gethostent_r=undef
14666		gethostent_r_proto=0
14667		;;
14668	esac
14669	;;
14670*)	gethostent_r_proto=0
14671	;;
14672esac
14673
14674: see if prototypes for various gethostxxx netdb.h functions are available
14675echo " "
14676set d_gethostprotos gethostent $i_netdb netdb.h
14677eval $hasproto
14678
14679: see if getitimer exists
14680set getitimer d_getitimer
14681eval $inlibc
14682
14683: see if getlogin exists
14684set getlogin d_getlogin
14685eval $inlibc
14686
14687: see if getlogin_r exists
14688set getlogin_r d_getlogin_r
14689eval $inlibc
14690case "$d_getlogin_r" in
14691"$define")
14692	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14693	case "$d_getlogin_r_proto:$usethreads" in
14694	":define")	d_getlogin_r_proto=define
14695		set d_getlogin_r_proto getlogin_r $hdrs
14696		eval $hasproto ;;
14697	*)	;;
14698	esac
14699	case "$d_getlogin_r_proto" in
14700	define)
14701	case "$getlogin_r_proto" in
14702	''|0) try='int getlogin_r(char*, size_t);'
14703	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14704	esac
14705	case "$getlogin_r_proto" in
14706	''|0) try='int getlogin_r(char*, int);'
14707	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14708	esac
14709	case "$getlogin_r_proto" in
14710	''|0) try='char* getlogin_r(char*, size_t);'
14711	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14712	esac
14713	case "$getlogin_r_proto" in
14714	''|0) try='char* getlogin_r(char*, int);'
14715	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14716	esac
14717	case "$getlogin_r_proto" in
14718	''|0)	d_getlogin_r=undef
14719		getlogin_r_proto=0
14720		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14721	* )	case "$getlogin_r_proto" in
14722		REENTRANT_PROTO*) ;;
14723		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14724		esac
14725		echo "Prototype: $try" ;;
14726	esac
14727	;;
14728	*)	case "$usethreads" in
14729		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14730		esac
14731		d_getlogin_r=undef
14732		getlogin_r_proto=0
14733		;;
14734	esac
14735	;;
14736*)	getlogin_r_proto=0
14737	;;
14738esac
14739
14740: see if getmnt exists
14741set getmnt d_getmnt
14742eval $inlibc
14743
14744: see if getmntent exists
14745set getmntent d_getmntent
14746eval $inlibc
14747
14748: see if getnameinfo exists
14749set getnameinfo d_getnameinfo
14750eval $inlibc
14751
14752: see if getnetbyaddr exists
14753set getnetbyaddr d_getnbyaddr
14754eval $inlibc
14755
14756: see if getnetbyname exists
14757set getnetbyname d_getnbyname
14758eval $inlibc
14759
14760: see if getnetent exists
14761set getnetent d_getnent
14762eval $inlibc
14763
14764: see if getnetbyaddr_r exists
14765set getnetbyaddr_r d_getnetbyaddr_r
14766eval $inlibc
14767case "$d_getnetbyaddr_r" in
14768"$define")
14769	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14770	case "$d_getnetbyaddr_r_proto:$usethreads" in
14771	":define")	d_getnetbyaddr_r_proto=define
14772		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14773		eval $hasproto ;;
14774	*)	;;
14775	esac
14776	case "$d_getnetbyaddr_r_proto" in
14777	define)
14778	case "$getnetbyaddr_r_proto" in
14779	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14780	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14781	esac
14782	case "$getnetbyaddr_r_proto" in
14783	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14784	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14785	esac
14786	case "$getnetbyaddr_r_proto" in
14787	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14788	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14789	esac
14790	case "$getnetbyaddr_r_proto" in
14791	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14792	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14793	esac
14794	case "$getnetbyaddr_r_proto" in
14795	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14796	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14797	esac
14798	case "$getnetbyaddr_r_proto" in
14799	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14800	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14801	esac
14802	case "$getnetbyaddr_r_proto" in
14803	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14804	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14805	esac
14806	case "$getnetbyaddr_r_proto" in
14807	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14808	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14809	esac
14810	case "$getnetbyaddr_r_proto" in
14811	''|0)	d_getnetbyaddr_r=undef
14812		getnetbyaddr_r_proto=0
14813		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14814	* )	case "$getnetbyaddr_r_proto" in
14815		REENTRANT_PROTO*) ;;
14816		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14817		esac
14818		echo "Prototype: $try" ;;
14819	esac
14820	;;
14821	*)	case "$usethreads" in
14822		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14823		esac
14824		d_getnetbyaddr_r=undef
14825		getnetbyaddr_r_proto=0
14826		;;
14827	esac
14828	;;
14829*)	getnetbyaddr_r_proto=0
14830	;;
14831esac
14832
14833: see if getnetbyname_r exists
14834set getnetbyname_r d_getnetbyname_r
14835eval $inlibc
14836case "$d_getnetbyname_r" in
14837"$define")
14838	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14839	case "$d_getnetbyname_r_proto:$usethreads" in
14840	":define")	d_getnetbyname_r_proto=define
14841		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14842		eval $hasproto ;;
14843	*)	;;
14844	esac
14845	case "$d_getnetbyname_r_proto" in
14846	define)
14847	case "$getnetbyname_r_proto" in
14848	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14849	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14850	esac
14851	case "$getnetbyname_r_proto" in
14852	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14853	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14854	esac
14855	case "$getnetbyname_r_proto" in
14856	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14857	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14858	esac
14859	case "$getnetbyname_r_proto" in
14860	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14861	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14862	esac
14863	case "$getnetbyname_r_proto" in
14864	''|0)	d_getnetbyname_r=undef
14865		getnetbyname_r_proto=0
14866		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14867	* )	case "$getnetbyname_r_proto" in
14868		REENTRANT_PROTO*) ;;
14869		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14870		esac
14871		echo "Prototype: $try" ;;
14872	esac
14873	;;
14874	*)	case "$usethreads" in
14875		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14876		esac
14877		d_getnetbyname_r=undef
14878		getnetbyname_r_proto=0
14879		;;
14880	esac
14881	;;
14882*)	getnetbyname_r_proto=0
14883	;;
14884esac
14885
14886: see if getnetent_r exists
14887set getnetent_r d_getnetent_r
14888eval $inlibc
14889case "$d_getnetent_r" in
14890"$define")
14891	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14892	case "$d_getnetent_r_proto:$usethreads" in
14893	":define")	d_getnetent_r_proto=define
14894		set d_getnetent_r_proto getnetent_r $hdrs
14895		eval $hasproto ;;
14896	*)	;;
14897	esac
14898	case "$d_getnetent_r_proto" in
14899	define)
14900	case "$getnetent_r_proto" in
14901	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14902	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14903	esac
14904	case "$getnetent_r_proto" in
14905	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14906	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14907	esac
14908	case "$getnetent_r_proto" in
14909	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14910	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14911	esac
14912	case "$getnetent_r_proto" in
14913	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14914	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14915	esac
14916	case "$getnetent_r_proto" in
14917	''|0) try='int getnetent_r(struct netent*, char*, int);'
14918	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14919	esac
14920	case "$getnetent_r_proto" in
14921	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14922	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14923	esac
14924	case "$getnetent_r_proto" in
14925	''|0)	d_getnetent_r=undef
14926		getnetent_r_proto=0
14927		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14928	* )	case "$getnetent_r_proto" in
14929		REENTRANT_PROTO*) ;;
14930		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14931		esac
14932		echo "Prototype: $try" ;;
14933	esac
14934	;;
14935	*)	case "$usethreads" in
14936		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14937		esac
14938		d_getnetent_r=undef
14939		getnetent_r_proto=0
14940		;;
14941	esac
14942	;;
14943*)	getnetent_r_proto=0
14944	;;
14945esac
14946
14947: see if prototypes for various getnetxxx netdb.h functions are available
14948echo " "
14949set d_getnetprotos getnetent $i_netdb netdb.h
14950eval $hasproto
14951
14952: see if getpagesize exists
14953set getpagesize d_getpagsz
14954eval $inlibc
14955
14956: Optional checks for getprotobyname and getprotobynumber
14957
14958: see if getprotobyname exists
14959set getprotobyname d_getpbyname
14960eval $inlibc
14961
14962: see if getprotobynumber exists
14963set getprotobynumber d_getpbynumber
14964eval $inlibc
14965
14966: see if getprotoent exists
14967set getprotoent d_getpent
14968eval $inlibc
14969
14970: see if getpgid exists
14971set getpgid d_getpgid
14972eval $inlibc
14973
14974: see if getpgrp2 exists
14975set getpgrp2 d_getpgrp2
14976eval $inlibc
14977
14978: see if getppid exists
14979set getppid d_getppid
14980eval $inlibc
14981
14982: see if getpriority exists
14983set getpriority d_getprior
14984eval $inlibc
14985
14986: see if getprotobyname_r exists
14987set getprotobyname_r d_getprotobyname_r
14988eval $inlibc
14989case "$d_getprotobyname_r" in
14990"$define")
14991	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14992	case "$d_getprotobyname_r_proto:$usethreads" in
14993	":define")	d_getprotobyname_r_proto=define
14994		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14995		eval $hasproto ;;
14996	*)	;;
14997	esac
14998	case "$d_getprotobyname_r_proto" in
14999	define)
15000	case "$getprotobyname_r_proto" in
15001	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15002	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15003	esac
15004	case "$getprotobyname_r_proto" in
15005	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15006	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15007	esac
15008	case "$getprotobyname_r_proto" in
15009	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15010	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15011	esac
15012	case "$getprotobyname_r_proto" in
15013	''|0)	d_getprotobyname_r=undef
15014		getprotobyname_r_proto=0
15015		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15016	* )	case "$getprotobyname_r_proto" in
15017		REENTRANT_PROTO*) ;;
15018		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15019		esac
15020		echo "Prototype: $try" ;;
15021	esac
15022	;;
15023	*)	case "$usethreads" in
15024		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15025		esac
15026		d_getprotobyname_r=undef
15027		getprotobyname_r_proto=0
15028		;;
15029	esac
15030	;;
15031*)	getprotobyname_r_proto=0
15032	;;
15033esac
15034
15035: see if getprotobynumber_r exists
15036set getprotobynumber_r d_getprotobynumber_r
15037eval $inlibc
15038case "$d_getprotobynumber_r" in
15039"$define")
15040	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15041	case "$d_getprotobynumber_r_proto:$usethreads" in
15042	":define")	d_getprotobynumber_r_proto=define
15043		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15044		eval $hasproto ;;
15045	*)	;;
15046	esac
15047	case "$d_getprotobynumber_r_proto" in
15048	define)
15049	case "$getprotobynumber_r_proto" in
15050	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15051	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15052	esac
15053	case "$getprotobynumber_r_proto" in
15054	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15055	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15056	esac
15057	case "$getprotobynumber_r_proto" in
15058	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15059	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15060	esac
15061	case "$getprotobynumber_r_proto" in
15062	''|0)	d_getprotobynumber_r=undef
15063		getprotobynumber_r_proto=0
15064		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15065	* )	case "$getprotobynumber_r_proto" in
15066		REENTRANT_PROTO*) ;;
15067		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15068		esac
15069		echo "Prototype: $try" ;;
15070	esac
15071	;;
15072	*)	case "$usethreads" in
15073		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15074		esac
15075		d_getprotobynumber_r=undef
15076		getprotobynumber_r_proto=0
15077		;;
15078	esac
15079	;;
15080*)	getprotobynumber_r_proto=0
15081	;;
15082esac
15083
15084: see if getprotoent_r exists
15085set getprotoent_r d_getprotoent_r
15086eval $inlibc
15087case "$d_getprotoent_r" in
15088"$define")
15089	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15090	case "$d_getprotoent_r_proto:$usethreads" in
15091	":define")	d_getprotoent_r_proto=define
15092		set d_getprotoent_r_proto getprotoent_r $hdrs
15093		eval $hasproto ;;
15094	*)	;;
15095	esac
15096	case "$d_getprotoent_r_proto" in
15097	define)
15098	case "$getprotoent_r_proto" in
15099	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15100	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15101	esac
15102	case "$getprotoent_r_proto" in
15103	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15104	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15105	esac
15106	case "$getprotoent_r_proto" in
15107	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15108	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15109	esac
15110	case "$getprotoent_r_proto" in
15111	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15112	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15113	esac
15114	case "$getprotoent_r_proto" in
15115	''|0)	d_getprotoent_r=undef
15116		getprotoent_r_proto=0
15117		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15118	* )	case "$getprotoent_r_proto" in
15119		REENTRANT_PROTO*) ;;
15120		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15121		esac
15122		echo "Prototype: $try" ;;
15123	esac
15124	;;
15125	*)	case "$usethreads" in
15126		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15127		esac
15128		d_getprotoent_r=undef
15129		getprotoent_r_proto=0
15130		;;
15131	esac
15132	;;
15133*)	getprotoent_r_proto=0
15134	;;
15135esac
15136
15137: see if prototypes for various getprotoxxx netdb.h functions are available
15138echo " "
15139set d_getprotoprotos getprotoent $i_netdb netdb.h
15140eval $hasproto
15141
15142: see if getprpwnam exists
15143set getprpwnam d_getprpwnam
15144eval $inlibc
15145
15146: see if getpwent exists
15147set getpwent d_getpwent
15148eval $inlibc
15149
15150: see if getpwent_r exists
15151set getpwent_r d_getpwent_r
15152eval $inlibc
15153case "$d_getpwent_r" in
15154"$define")
15155	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15156	case "$d_getpwent_r_proto:$usethreads" in
15157	":define")	d_getpwent_r_proto=define
15158		set d_getpwent_r_proto getpwent_r $hdrs
15159		eval $hasproto ;;
15160	*)	;;
15161	esac
15162	case "$d_getpwent_r_proto" in
15163	define)
15164	case "$getpwent_r_proto" in
15165	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15166	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15167	esac
15168	case "$getpwent_r_proto" in
15169	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15170	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15171	esac
15172	case "$getpwent_r_proto" in
15173	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15174	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15175	esac
15176	case "$getpwent_r_proto" in
15177	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15178	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15179	esac
15180	case "$getpwent_r_proto" in
15181	''|0) try='int getpwent_r(struct passwd*, char*, int);'
15182	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15183	esac
15184	case "$getpwent_r_proto" in
15185	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15186	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15187	esac
15188	case "$getpwent_r_proto" in
15189	''|0)	d_getpwent_r=undef
15190		getpwent_r_proto=0
15191		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15192	* )	case "$getpwent_r_proto" in
15193		REENTRANT_PROTO*) ;;
15194		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15195		esac
15196		echo "Prototype: $try" ;;
15197	esac
15198	;;
15199	*)	case "$usethreads" in
15200		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15201		esac
15202		d_getpwent_r=undef
15203		getpwent_r_proto=0
15204		;;
15205	esac
15206	;;
15207*)	getpwent_r_proto=0
15208	;;
15209esac
15210
15211: see if getpwnam_r exists
15212set getpwnam_r d_getpwnam_r
15213eval $inlibc
15214case "$d_getpwnam_r" in
15215"$define")
15216	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15217	case "$d_getpwnam_r_proto:$usethreads" in
15218	":define")	d_getpwnam_r_proto=define
15219		set d_getpwnam_r_proto getpwnam_r $hdrs
15220		eval $hasproto ;;
15221	*)	;;
15222	esac
15223	case "$d_getpwnam_r_proto" in
15224	define)
15225	case "$getpwnam_r_proto" in
15226	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15227	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15228	esac
15229	case "$getpwnam_r_proto" in
15230	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15231	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15232	esac
15233	case "$getpwnam_r_proto" in
15234	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15235	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15236	esac
15237	case "$getpwnam_r_proto" in
15238	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15239	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15240	esac
15241	case "$getpwnam_r_proto" in
15242	''|0)	d_getpwnam_r=undef
15243		getpwnam_r_proto=0
15244		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15245	* )	case "$getpwnam_r_proto" in
15246		REENTRANT_PROTO*) ;;
15247		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15248		esac
15249		echo "Prototype: $try" ;;
15250	esac
15251	;;
15252	*)	case "$usethreads" in
15253		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15254		esac
15255		d_getpwnam_r=undef
15256		getpwnam_r_proto=0
15257		;;
15258	esac
15259	;;
15260*)	getpwnam_r_proto=0
15261	;;
15262esac
15263
15264: see if getpwuid_r exists
15265set getpwuid_r d_getpwuid_r
15266eval $inlibc
15267case "$d_getpwuid_r" in
15268"$define")
15269	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15270	case "$d_getpwuid_r_proto:$usethreads" in
15271	":define")	d_getpwuid_r_proto=define
15272		set d_getpwuid_r_proto getpwuid_r $hdrs
15273		eval $hasproto ;;
15274	*)	;;
15275	esac
15276	case "$d_getpwuid_r_proto" in
15277	define)
15278	case "$getpwuid_r_proto" in
15279	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15280	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15281	esac
15282	case "$getpwuid_r_proto" in
15283	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15284	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15285	esac
15286	case "$getpwuid_r_proto" in
15287	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15288	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15289	esac
15290	case "$getpwuid_r_proto" in
15291	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15292	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15293	esac
15294	case "$getpwuid_r_proto" in
15295	''|0)	d_getpwuid_r=undef
15296		getpwuid_r_proto=0
15297		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15298	* )	case "$getpwuid_r_proto" in
15299		REENTRANT_PROTO*) ;;
15300		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15301		esac
15302		echo "Prototype: $try" ;;
15303	esac
15304	;;
15305	*)	case "$usethreads" in
15306		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15307		esac
15308		d_getpwuid_r=undef
15309		getpwuid_r_proto=0
15310		;;
15311	esac
15312	;;
15313*)	getpwuid_r_proto=0
15314	;;
15315esac
15316
15317: Optional checks for getsbyname and getsbyport
15318
15319: see if getservbyname exists
15320set getservbyname d_getsbyname
15321eval $inlibc
15322
15323: see if getservbyport exists
15324set getservbyport d_getsbyport
15325eval $inlibc
15326
15327: see if getservent exists
15328set getservent d_getsent
15329eval $inlibc
15330
15331: see if getservbyname_r exists
15332set getservbyname_r d_getservbyname_r
15333eval $inlibc
15334case "$d_getservbyname_r" in
15335"$define")
15336	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15337	case "$d_getservbyname_r_proto:$usethreads" in
15338	":define")	d_getservbyname_r_proto=define
15339		set d_getservbyname_r_proto getservbyname_r $hdrs
15340		eval $hasproto ;;
15341	*)	;;
15342	esac
15343	case "$d_getservbyname_r_proto" in
15344	define)
15345	case "$getservbyname_r_proto" in
15346	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15347	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15348	esac
15349	case "$getservbyname_r_proto" in
15350	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15351	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15352	esac
15353	case "$getservbyname_r_proto" in
15354	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15355	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15356	esac
15357	case "$getservbyname_r_proto" in
15358	''|0)	d_getservbyname_r=undef
15359		getservbyname_r_proto=0
15360		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15361	* )	case "$getservbyname_r_proto" in
15362		REENTRANT_PROTO*) ;;
15363		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15364		esac
15365		echo "Prototype: $try" ;;
15366	esac
15367	;;
15368	*)	case "$usethreads" in
15369		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15370		esac
15371		d_getservbyname_r=undef
15372		getservbyname_r_proto=0
15373		;;
15374	esac
15375	;;
15376*)	getservbyname_r_proto=0
15377	;;
15378esac
15379
15380: see if getservbyport_r exists
15381set getservbyport_r d_getservbyport_r
15382eval $inlibc
15383case "$d_getservbyport_r" in
15384"$define")
15385	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15386	case "$d_getservbyport_r_proto:$usethreads" in
15387	":define")	d_getservbyport_r_proto=define
15388		set d_getservbyport_r_proto getservbyport_r $hdrs
15389		eval $hasproto ;;
15390	*)	;;
15391	esac
15392	case "$d_getservbyport_r_proto" in
15393	define)
15394	case "$getservbyport_r_proto" in
15395	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15396	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15397	esac
15398	case "$getservbyport_r_proto" in
15399	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15400	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15401	esac
15402	case "$getservbyport_r_proto" in
15403	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15404	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15405	esac
15406	case "$getservbyport_r_proto" in
15407	''|0)	d_getservbyport_r=undef
15408		getservbyport_r_proto=0
15409		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15410	* )	case "$getservbyport_r_proto" in
15411		REENTRANT_PROTO*) ;;
15412		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15413		esac
15414		echo "Prototype: $try" ;;
15415	esac
15416	;;
15417	*)	case "$usethreads" in
15418		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15419		esac
15420		d_getservbyport_r=undef
15421		getservbyport_r_proto=0
15422		;;
15423	esac
15424	;;
15425*)	getservbyport_r_proto=0
15426	;;
15427esac
15428
15429: see if getservent_r exists
15430set getservent_r d_getservent_r
15431eval $inlibc
15432case "$d_getservent_r" in
15433"$define")
15434	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15435	case "$d_getservent_r_proto:$usethreads" in
15436	":define")	d_getservent_r_proto=define
15437		set d_getservent_r_proto getservent_r $hdrs
15438		eval $hasproto ;;
15439	*)	;;
15440	esac
15441	case "$d_getservent_r_proto" in
15442	define)
15443	case "$getservent_r_proto" in
15444	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15445	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15446	esac
15447	case "$getservent_r_proto" in
15448	''|0) try='int getservent_r(struct servent*, char*, int);'
15449	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15450	esac
15451	case "$getservent_r_proto" in
15452	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15453	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15454	esac
15455	case "$getservent_r_proto" in
15456	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15457	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15458	esac
15459	case "$getservent_r_proto" in
15460	''|0)	d_getservent_r=undef
15461		getservent_r_proto=0
15462		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15463	* )	case "$getservent_r_proto" in
15464		REENTRANT_PROTO*) ;;
15465		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15466		esac
15467		echo "Prototype: $try" ;;
15468	esac
15469	;;
15470	*)	case "$usethreads" in
15471		define) echo "getservent_r has no prototype, not using it." >&4 ;;
15472		esac
15473		d_getservent_r=undef
15474		getservent_r_proto=0
15475		;;
15476	esac
15477	;;
15478*)	getservent_r_proto=0
15479	;;
15480esac
15481
15482: see if prototypes for various getservxxx netdb.h functions are available
15483echo " "
15484set d_getservprotos getservent $i_netdb netdb.h
15485eval $hasproto
15486
15487: see if getspnam exists
15488set getspnam d_getspnam
15489eval $inlibc
15490
15491: see if this is a shadow.h system
15492set shadow.h i_shadow
15493eval $inhdr
15494
15495: see if getspnam_r exists
15496set getspnam_r d_getspnam_r
15497eval $inlibc
15498case "$d_getspnam_r" in
15499"$define")
15500	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15501	case "$d_getspnam_r_proto:$usethreads" in
15502	":define")	d_getspnam_r_proto=define
15503		set d_getspnam_r_proto getspnam_r $hdrs
15504		eval $hasproto ;;
15505	*)	;;
15506	esac
15507	case "$d_getspnam_r_proto" in
15508	define)
15509	case "$getspnam_r_proto" in
15510	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15511	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15512	esac
15513	case "$getspnam_r_proto" in
15514	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15515	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15516	esac
15517	case "$getspnam_r_proto" in
15518	''|0)	d_getspnam_r=undef
15519		getspnam_r_proto=0
15520		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15521	* )	case "$getspnam_r_proto" in
15522		REENTRANT_PROTO*) ;;
15523		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15524		esac
15525		echo "Prototype: $try" ;;
15526	esac
15527	;;
15528	*)	case "$usethreads" in
15529		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15530		esac
15531		d_getspnam_r=undef
15532		getspnam_r_proto=0
15533		;;
15534	esac
15535	;;
15536*)	getspnam_r_proto=0
15537	;;
15538esac
15539
15540: see if gettimeofday or ftime exists
15541set gettimeofday d_gettimeod
15542eval $inlibc
15543case "$d_gettimeod" in
15544"$undef")
15545	set ftime d_ftime
15546	eval $inlibc
15547	;;
15548*)
15549	val="$undef"; set d_ftime; eval $setvar
15550	;;
15551esac
15552case "$d_gettimeod$d_ftime" in
15553"$undef$undef")
15554	echo " "
15555	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15556	;;
15557esac
15558
15559: see if gmtime_r exists
15560set gmtime_r d_gmtime_r
15561eval $inlibc
15562case "$d_gmtime_r" in
15563"$define")
15564	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15565	case "$d_gmtime_r_proto:$usethreads" in
15566	":define")	d_gmtime_r_proto=define
15567		set d_gmtime_r_proto gmtime_r $hdrs
15568		eval $hasproto ;;
15569	*)	;;
15570	esac
15571	case "$d_gmtime_r_proto" in
15572	define)
15573	case "$gmtime_r_proto" in
15574	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15575	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15576	esac
15577	case "$gmtime_r_proto" in
15578	''|0) try='int gmtime_r(const time_t*, struct tm*);'
15579	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15580	esac
15581	case "$gmtime_r_proto" in
15582	''|0)	d_gmtime_r=undef
15583		gmtime_r_proto=0
15584		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15585	* )	case "$gmtime_r_proto" in
15586		REENTRANT_PROTO*) ;;
15587		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15588		esac
15589		echo "Prototype: $try" ;;
15590	esac
15591	;;
15592	*)	case "$usethreads" in
15593		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15594		esac
15595		d_gmtime_r=undef
15596		gmtime_r_proto=0
15597		;;
15598	esac
15599	;;
15600*)	gmtime_r_proto=0
15601	;;
15602esac
15603
15604: see if hasmntopt exists
15605set hasmntopt d_hasmntopt
15606eval $inlibc
15607
15608: see if this is a netinet/in.h or sys/in.h system
15609set netinet/in.h i_niin sys/in.h i_sysin
15610eval $inhdr
15611
15612: see if arpa/inet.h has to be included
15613set arpa/inet.h i_arpainet
15614eval $inhdr
15615
15616: see if htonl --and friends-- exists
15617val=''
15618set htonl val
15619eval $inlibc
15620
15621: Maybe they are macros.
15622case "$val" in
15623$undef)
15624	$cat >htonl.c <<EOM
15625#include <stdio.h>
15626#include <sys/types.h>
15627#$i_niin I_NETINET_IN
15628#$i_sysin I_SYS_IN
15629#$i_arpainet I_ARPA_INET
15630#ifdef I_NETINET_IN
15631#include <netinet/in.h>
15632#endif
15633#ifdef I_SYS_IN
15634#include <sys/in.h>
15635#endif
15636#ifdef I_ARPA_INET
15637#include <arpa/inet.h>
15638#endif
15639#ifdef htonl
15640printf("Defined as a macro.");
15641#endif
15642EOM
15643	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15644	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15645		val="$define"
15646		echo "But it seems to be defined as a macro." >&4
15647	fi
15648	$rm -f htonl.?
15649	;;
15650esac
15651set d_htonl
15652eval $setvar
15653
15654: see if hypot exists
15655set hypot d_hypot
15656eval $inlibc
15657
15658: see if ilogb exists
15659set ilogb d_ilogb
15660eval $inlibc
15661
15662: see if ilogbl exists
15663set ilogbl d_ilogbl
15664eval $inlibc
15665
15666: check whether inet_aton exists
15667set inet_aton d_inetaton
15668eval $inlibc
15669
15670: see if inet_ntop exists
15671set inet_ntop d_inetntop
15672eval $inlibc
15673
15674: see if inet_pton exists
15675set inet_pton d_inetpton
15676eval $inlibc
15677
15678: Look for isascii
15679echo " "
15680$cat >isascii.c <<EOCP
15681#include <stdio.h>
15682#include <ctype.h>
15683#$i_stdlib I_STDLIB
15684#ifdef I_STDLIB
15685#include <stdlib.h>
15686#endif
15687int main() {
15688	int c = 'A';
15689	if (isascii(c))
15690		exit(0);
15691	else
15692		exit(1);
15693}
15694EOCP
15695set isascii
15696if eval $compile; then
15697	echo "isascii() found." >&4
15698	val="$define"
15699else
15700	echo "isascii() NOT found." >&4
15701	val="$undef"
15702fi
15703set d_isascii
15704eval $setvar
15705$rm -f isascii*
15706
15707: Look for isblank
15708echo " "
15709$cat >isblank.c <<'EOCP'
15710#include <stdio.h>
15711#include <ctype.h>
15712int main() {
15713	int c = ' ';
15714	if (isblank(c))
15715		return 0 ;
15716	else
15717		return 1 ;
15718}
15719EOCP
15720if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15721	echo "isblank() found." >&4
15722	val="$define"
15723else
15724	echo "isblank() NOT found." >&4
15725	val="$undef"
15726fi
15727set d_isblank
15728eval $setvar
15729$rm -f isblank*
15730
15731: check for isfinite
15732echo "Checking to see if you have isfinite..." >&4
15733$cat >try.c <<EOCP
15734#include <math.h>
15735int main() { return isfinite(0.0); }
15736EOCP
15737set try
15738if eval $compile; then
15739	val="$define"
15740	echo "You have isfinite."
15741else
15742	val="$undef"
15743	echo "You do not have isfinite."
15744fi
15745$rm_try
15746set d_isfinite
15747eval $setvar
15748
15749: see if isfinitel exists
15750set isfinitel d_isfinitel
15751eval $inlibc
15752
15753: check for isinf
15754echo "Checking to see if you have isinf..." >&4
15755$cat >try.c <<EOCP
15756#include <math.h>
15757int main() { return isinf(0.0); }
15758EOCP
15759set try
15760if eval $compile; then
15761	val="$define"
15762	echo "You have isinf."
15763else
15764	val="$undef"
15765	echo "You do not have isinf."
15766fi
15767$rm_try
15768set d_isinf
15769eval $setvar
15770
15771: see if isinfl exists
15772set isinfl d_isinfl
15773eval $inlibc
15774
15775: check for isless
15776echo "Checking to see if you have isless..." >&4
15777$cat >try.c <<EOCP
15778#include <math.h>
15779int main() { return isless(0.0); }
15780EOCP
15781set try
15782if eval $compile; then
15783	val="$define"
15784	echo "You have isless."
15785else
15786	val="$undef"
15787	echo "You do not have isless."
15788fi
15789$rm_try
15790set d_isless
15791eval $setvar
15792
15793: check for isnan
15794echo "Checking to see if you have isnan..." >&4
15795$cat >try.c <<EOCP
15796#include <math.h>
15797int main() { return isnan(0.0); }
15798EOCP
15799set try
15800if eval $compile; then
15801	val="$define"
15802	echo "You have isnan."
15803else
15804	val="$undef"
15805	echo "You do not have isnan."
15806fi
15807$rm_try
15808set d_isnan
15809eval $setvar
15810
15811: see if isnanl exists
15812set isnanl d_isnanl
15813eval $inlibc
15814
15815: check for isnormal
15816echo "Checking to see if you have isnormal..." >&4
15817$cat >try.c <<EOCP
15818#include <math.h>
15819int main() { return isnormal(0.0); }
15820EOCP
15821set try
15822if eval $compile; then
15823	val="$define"
15824	echo "You have isnormal."
15825else
15826	val="$undef"
15827	echo "You do not have isnormal."
15828fi
15829$rm_try
15830set d_isnormal
15831eval $setvar
15832
15833: see if j0 exists
15834set j0 d_j0
15835eval $inlibc
15836
15837: see if j0l exists
15838set j0l d_j0l
15839eval $inlibc
15840
15841: see if killpg exists
15842set killpg d_killpg
15843eval $inlibc
15844
15845: see if localeconv exists
15846set localeconv d_locconv
15847eval $inlibc
15848
15849: see if libc has the POSIX.1-2008 currency locale rules
15850case "$d_locconv:$d_lc_monetary_2008" in
15851$define:)
15852	$cat >try.c <<EOCP
15853#include <locale.h>
15854int main() {
15855	struct lconv *lc = localeconv();
15856	char int_p_cs_precedes = lc->int_p_cs_precedes;
15857	return 0;
15858}
15859EOCP
15860	set try
15861	if eval $compile; then
15862		d_lc_monetary_2008="$define"
15863	else
15864		d_lc_monetary_2008="$undef"
15865	fi;
15866	$rm_try
15867	;;
15868esac
15869
15870: see if lchown exists
15871echo " "
15872$cat > try.c <<'EOCP'
15873/* System header to define __stub macros and hopefully few prototypes,
15874    which can conflict with char lchown(); below.  */
15875#include <assert.h>
15876/* Override any gcc2 internal prototype to avoid an error.  */
15877/* We use char because int might match the return type of a gcc2
15878   builtin and then its argument prototype would still apply.  */
15879char lchown();
15880int main() {
15881    /*  The GNU C library defines this for functions which it implements
15882        to always fail with ENOSYS.  Some functions are actually named
15883	something starting with __ and the normal name is an alias.  */
15884#if defined (__stub_lchown) || defined (__stub___lchown)
15885choke me
15886#else
15887lchown();
15888#endif
15889; return 0; }
15890EOCP
15891set try
15892if eval $compile; then
15893    $echo "lchown() found." >&4
15894    val="$define"
15895else
15896    $echo "lchown() NOT found." >&4
15897    val="$undef"
15898fi
15899set d_lchown
15900eval $setvar
15901
15902: See if number of significant digits in a double precision number is known
15903echo " "
15904$cat >ldbl_dig.c <<EOM
15905#include <limits.h>
15906#include <float.h>
15907#ifdef LDBL_DIG
15908printf("Contains LDBL_DIG");
15909#endif
15910EOM
15911$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15912if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15913	echo "LDBL_DIG found." >&4
15914	val="$define"
15915else
15916	echo "LDBL_DIG NOT found." >&4
15917	val="$undef"
15918fi
15919$rm -f ldbl_dig.?
15920set d_ldbl_dig
15921eval $setvar
15922
15923: see if lgamma exists
15924set lgamma d_lgamma
15925eval $inlibc
15926
15927: see if lgamma_r exists
15928set lgamma_r d_lgamma_r
15929eval $inlibc
15930
15931: check to see if math.h defines _LIB_VERSION
15932d_libm_lib_version="$undef"
15933echo " "
15934echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15935$cat >try.c <<EOCP
15936#include <unistd.h>
15937#include <math.h>
15938int main (int argc, char *argv[])
15939{
15940    printf ("%d\n", _LIB_VERSION);
15941    return (0);
15942    } /* main */
15943EOCP
15944set try
15945if eval $compile; then
15946    foo=`$run ./try`
15947    echo "Yes, it does ($foo)" >&4
15948    d_libm_lib_version="$define"
15949else
15950    echo "No, it does not (probably harmless)" >&4
15951    fi
15952$rm_try
15953
15954: see if link exists
15955set link d_link
15956eval $inlibc
15957
15958: see if llrint exists
15959set llrint d_llrint
15960eval $inlibc
15961
15962: see if llrintl exists
15963set llrintl d_llrintl
15964eval $inlibc
15965
15966: see if llround exists
15967set llround d_llround
15968eval $inlibc
15969
15970: see if llroundl exists
15971set llroundl d_llroundl
15972eval $inlibc
15973
15974: see if localeconv_l exists
15975set localeconv_l d_localeconv_l
15976eval $inlibc
15977
15978: see if localtime_r exists
15979set localtime_r d_localtime_r
15980eval $inlibc
15981case "$d_localtime_r" in
15982"$define")
15983	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15984	case "$d_localtime_r_proto:$usethreads" in
15985	":define")	d_localtime_r_proto=define
15986		set d_localtime_r_proto localtime_r $hdrs
15987		eval $hasproto ;;
15988	*)	;;
15989	esac
15990	case "$d_localtime_r_proto" in
15991	define)
15992	case "$localtime_r_proto" in
15993	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15994	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15995	esac
15996	case "$localtime_r_proto" in
15997	''|0) try='int localtime_r(const time_t*, struct tm*);'
15998	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15999	esac
16000	case "$localtime_r_proto" in
16001	''|0)	d_localtime_r=undef
16002		localtime_r_proto=0
16003		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16004	* )	case "$localtime_r_proto" in
16005		REENTRANT_PROTO*) ;;
16006		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16007		esac
16008		echo "Prototype: $try" ;;
16009	esac
16010	;;
16011	*)	case "$usethreads" in
16012		define) echo "localtime_r has no prototype, not using it." >&4 ;;
16013		esac
16014		d_localtime_r=undef
16015		localtime_r_proto=0
16016		;;
16017	esac
16018	;;
16019*)	localtime_r_proto=0
16020	;;
16021esac
16022
16023: see if localtime_r calls tzset
16024case "$localtime_r_proto" in
16025REENTRANT_PROTO*)
16026	$cat >try.c <<EOCP
16027/*  Does our libc's localtime_r call tzset ?
16028 *  return 0 if so, 1 otherwise.
16029 */
16030#$i_systypes	I_SYS_TYPES
16031#$i_unistd	I_UNISTD
16032#$i_time	I_TIME
16033#$i_stdlib	I_STDLIB
16034#$i_malloc	I_MALLOC
16035#ifdef I_SYS_TYPES
16036#  include <sys/types.h>
16037#endif
16038#ifdef I_UNISTD
16039#  include <unistd.h>
16040#endif
16041#ifdef I_TIME
16042#  include <time.h>
16043#endif
16044#ifdef I_STDLIB
16045#include <stdlib.h>
16046#endif
16047#include <string.h>
16048#ifdef I_MALLOC
16049#  include <malloc.h>
16050#endif
16051int main()
16052{
16053    time_t t = time(0L);
16054    char w_tz[]="TZ" "=GMT+5",
16055	 e_tz[]="TZ" "=GMT-5",
16056	*tz_e = (char*)malloc(16),
16057	*tz_w = (char*)malloc(16);
16058    struct tm tm_e, tm_w;
16059    memset(&tm_e,'\0',sizeof(struct tm));
16060    memset(&tm_w,'\0',sizeof(struct tm));
16061    strcpy(tz_e,e_tz);
16062    strcpy(tz_w,w_tz);
16063
16064    putenv(tz_e);
16065    localtime_r(&t, &tm_e);
16066
16067    putenv(tz_w);
16068    localtime_r(&t, &tm_w);
16069
16070    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16071	return 1;
16072    return 0;
16073}
16074EOCP
16075	set try
16076	if eval $compile; then
16077	    if $run ./try; then
16078		d_localtime_r_needs_tzset=undef;
16079	    else
16080		d_localtime_r_needs_tzset=define;
16081	    fi;
16082	else
16083	    d_localtime_r_needs_tzset=undef;
16084	fi;
16085     ;;
16086  *)
16087     d_localtime_r_needs_tzset=undef;
16088     ;;
16089esac
16090$rm_try
16091
16092: see if lockf exists
16093set lockf d_lockf
16094eval $inlibc
16095
16096: see if log1p exists
16097set log1p d_log1p
16098eval $inlibc
16099
16100: see if log2 exists
16101set log2 d_log2
16102eval $inlibc
16103
16104: see if logb exists
16105set logb d_logb
16106eval $inlibc
16107
16108: see if lrint exists
16109set lrint d_lrint
16110eval $inlibc
16111
16112: see if lrintl exists
16113set lrintl d_lrintl
16114eval $inlibc
16115
16116: see if lround exists
16117set lround d_lround
16118eval $inlibc
16119
16120: see if lroundl exists
16121set lroundl d_lroundl
16122eval $inlibc
16123
16124: see if prototype for lseek is available
16125echo " "
16126set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16127eval $hasproto
16128
16129: see if lstat exists
16130set lstat d_lstat
16131eval $inlibc
16132
16133: see if madvise exists
16134set madvise d_madvise
16135eval $inlibc
16136
16137: see if malloc_size exists
16138set malloc_size d_malloc_size
16139eval $inlibc
16140
16141: see if malloc_size_good exists
16142set malloc_good_size d_malloc_good_size
16143eval $inlibc
16144
16145: see if mblen exists
16146set mblen d_mblen
16147eval $inlibc
16148
16149: see if mbrlen exists
16150set mbrlen d_mbrlen
16151eval $inlibc
16152
16153: see if mbrtowc exists
16154set mbrtowc d_mbrtowc
16155eval $inlibc
16156
16157: see if mbstowcs exists
16158set mbstowcs d_mbstowcs
16159eval $inlibc
16160
16161: see if mbtowc exists
16162set mbtowc d_mbtowc
16163eval $inlibc
16164
16165: see if memmem exists
16166: We need both a prototype in string.h and the symbol in libc.
16167echo " "
16168d_memmem_proto=''
16169xx1="#$d_gnulibc HAS_GNULIBC"
16170xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16171xx3='#   define _GNU_SOURCE'
16172xx4='#endif'
16173set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16174eval $hasproto
16175case "$d_memmem_proto" in
16176    define) # see if memmem exists
16177	set memmem d_memmem
16178	eval $inlibc
16179	;;
16180    *)  val=$undef
16181	set d_memmem
16182	eval $setvar
16183	;;
16184esac
16185
16186: see if memrchr exists
16187: We need both a prototype in string.h and the symbol in libc.
16188echo " "
16189d_memrchr_proto=''
16190xx1="#$d_gnulibc HAS_GNULIBC"
16191xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16192xx3='#   define _GNU_SOURCE'
16193xx4='#endif'
16194set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16195eval $hasproto
16196case "$d_memrchr_proto" in
16197    define) # see if memrchr exists
16198	set memrchr d_memrchr
16199	eval $inlibc
16200	;;
16201    *)  val=$undef
16202	set d_memrchr
16203	eval $setvar
16204	;;
16205esac
16206
16207: see if mkdir exists
16208set mkdir d_mkdir
16209eval $inlibc
16210
16211: see if mkdtemp exists
16212set mkdtemp d_mkdtemp
16213eval $inlibc
16214
16215: see if mkfifo exists
16216set mkfifo d_mkfifo
16217eval $inlibc
16218
16219: see if mkostemp exists
16220set mkostemp d_mkostemp
16221eval $inlibc
16222
16223: see if mkstemp exists
16224set mkstemp d_mkstemp
16225eval $inlibc
16226
16227: see if mkstemps exists
16228set mkstemps d_mkstemps
16229eval $inlibc
16230
16231: see if mktime exists
16232set mktime d_mktime
16233eval $inlibc
16234
16235: see if sys/mman.h has to be included
16236set sys/mman.h i_sysmman
16237eval $inhdr
16238
16239: see if mmap exists
16240set mmap d_mmap
16241eval $inlibc
16242: see what shmat returns
16243: default to something harmless
16244mmaptype='void *'
16245case "$i_sysmman$d_mmap" in
16246"$define$define")
16247	$cat >mmap.c <<'END'
16248#include <sys/mman.h>
16249void *mmap();
16250END
16251	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16252		mmaptype='void *'
16253	else
16254		mmaptype='caddr_t'
16255	fi
16256	echo "and it returns ($mmaptype)." >&4
16257	;;
16258esac
16259
16260: see if sqrtl exists
16261set sqrtl d_sqrtl
16262eval $inlibc
16263
16264: see if scalbnl exists
16265set scalbnl d_scalbnl
16266eval $inlibc
16267
16268: see if truncl exists
16269set truncl d_truncl
16270eval $inlibc
16271
16272: see if modfl exists
16273set modfl d_modfl
16274eval $inlibc
16275
16276: see if prototype for modfl is available
16277echo " "
16278set d_modflproto modfl define math.h
16279eval $hasproto
16280
16281if $test "$uselongdouble" = "$define"; then
16282    message=""
16283    if $test "$d_sqrtl" != "$define"; then
16284	message="$message sqrtl"
16285    fi
16286    if $test "$d_modfl" != "$define"; then
16287	if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16288	    echo "You have both truncl and copysignl, so I can emulate modfl."
16289	else
16290	    if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16291		echo "You have both aintl and copysignl, so I can emulate modfl."
16292	    else
16293		message="$message modfl"
16294	    fi
16295	fi
16296    fi
16297    if $test "$d_frexpl" != "$define"; then
16298	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16299	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16300	else
16301	    message="$message frexpl"
16302	fi
16303    fi
16304    if $test "$d_ldexpl" != "$define"; then
16305	message="$message ldexpl"
16306    fi
16307
16308    if $test "$message" != ""; then
16309	$cat <<EOM >&4
16310
16311*** You requested the use of long doubles but you do not seem to have
16312*** the following mathematical functions needed for long double support:
16313***    $message
16314*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16315*** Cannot continue, aborting.
16316
16317EOM
16318
16319	exit 1
16320    fi
16321fi
16322
16323: see if mprotect exists
16324set mprotect d_mprotect
16325eval $inlibc
16326
16327: see if msgctl exists
16328set msgctl d_msgctl
16329eval $inlibc
16330
16331: see if msgget exists
16332set msgget d_msgget
16333eval $inlibc
16334
16335: see if msgsnd exists
16336set msgsnd d_msgsnd
16337eval $inlibc
16338
16339: see if msgrcv exists
16340set msgrcv d_msgrcv
16341eval $inlibc
16342
16343: see how much of the 'msg*(2)' library is present.
16344h_msg=true
16345echo " "
16346case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16347*"$undef"*) h_msg=false;;
16348esac
16349case "$osname" in
16350freebsd)
16351    case "`ipcs 2>&1`" in
16352    "SVID messages"*"not configured"*)
16353	echo "Your $osname does not have the msg*(2) configured." >&4
16354        h_msg=false
16355	val="$undef"
16356	set msgctl d_msgctl
16357	eval $setvar
16358	set msgget d_msgget
16359	eval $setvar
16360	set msgsnd d_msgsnd
16361	eval $setvar
16362	set msgrcv d_msgrcv
16363	eval $setvar
16364	;;
16365    esac
16366    ;;
16367esac
16368: we could also check for sys/ipc.h ...
16369if $h_msg && $test `./findhdr sys/msg.h`; then
16370	echo "You have the full msg*(2) library." >&4
16371	val="$define"
16372else
16373	echo "You don't have the full msg*(2) library." >&4
16374	val="$undef"
16375fi
16376set d_msg
16377eval $setvar
16378
16379: Check for msghdr_s
16380echo " "
16381echo "Checking to see if your system supports struct msghdr..." >&4
16382set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16383eval $hasstruct
16384case "$d_msghdr_s" in
16385"$define")      echo "Yes, it does."   ;;
16386*)              echo "No, it doesn't." ;;
16387esac
16388
16389: see if msync exists
16390set msync d_msync
16391eval $inlibc
16392
16393: see if munmap exists
16394set munmap d_munmap
16395eval $inlibc
16396
16397: see if nan exists
16398set nan d_nan
16399eval $inlibc
16400
16401: see if nanosleep exists
16402set nanosleep d_nanosleep
16403eval $inlibc
16404
16405: see if nearbyint exists
16406set nearbyint d_nearbyint
16407eval $inlibc
16408
16409: see if nextafter exists
16410set nextafter d_nextafter
16411eval $inlibc
16412
16413: see if nexttoward exists
16414set nexttoward d_nexttoward
16415eval $inlibc
16416
16417: see if nice exists
16418set nice d_nice
16419eval $inlibc
16420
16421: see if this is a langinfo.h system
16422set langinfo.h i_langinfo
16423eval $inhdr
16424
16425: see if nl_langinfo exists
16426set nl_langinfo d_nl_langinfo
16427eval $inlibc
16428
16429: see if this is a quadmath.h system
16430set quadmath.h i_quadmath
16431eval $inhdr
16432
16433: Check basic sizes
16434echo " "
16435$echo "Choosing the C types to be used for Perl's internal types..." >&4
16436
16437case "$use64bitint:$d_quad:$quadtype" in
16438define:define:?*)
16439	ivtype="$quadtype"
16440	uvtype="$uquadtype"
16441	ivsize=8
16442	uvsize=8
16443	;;
16444*)	ivtype="long"
16445	uvtype="unsigned long"
16446	ivsize=$longsize
16447	uvsize=$longsize
16448	;;
16449esac
16450
16451case "$uselongdouble:$d_longdbl" in
16452define:define)
16453	nvtype="long double"
16454	nvsize=$longdblsize
16455	;;
16456*)	nvtype=double
16457	nvsize=$doublesize
16458	;;
16459esac
16460
16461case "$usequadmath:$i_quadmath" in
16462define:define)
16463  nvtype="__float128"
16464  nvsize=16
16465  case "$libs" in
16466  *quadmath*) ;;
16467  *) $cat <<EOM >&4
16468
16469*** You requested the use of the quadmath library, but you
16470*** do not seem to have the quadmath library installed.
16471*** Cannot continue, aborting.
16472EOM
16473    exit 1
16474    ;;
16475  esac
16476  ;;
16477define:*) $cat <<EOM >&4
16478
16479*** You requested the use of the quadmath library, but you
16480*** do not seem to have the required header, <quadmath.h>.
16481EOM
16482  case "$gccversion" in
16483  [23].*|4.[0-5]*)
16484   $cat <<EOM >&4
16485*** Your gcc looks a bit old:
16486*** $gccversion
16487EOM
16488    ;;
16489  '')
16490   $cat <<EOM >&4
16491*** You are not running a gcc.
16492EOM
16493    ;;
16494  esac
16495  $cat <<EOM >&4
16496*** For the quadmath library you need at least gcc 4.6.
16497*** Cannot continue, aborting.
16498EOM
16499  exit 1
16500  ;;
16501esac
16502
16503$echo "(IV will be "$ivtype", $ivsize bytes)"
16504$echo "(UV will be "$uvtype", $uvsize bytes)"
16505$echo "(NV will be "$nvtype", $nvsize bytes)"
16506
16507$cat >try.c <<EOCP
16508#$i_inttypes I_INTTYPES
16509#ifdef I_INTTYPES
16510#include <inttypes.h>
16511#endif
16512#include <stdio.h>
16513int main() {
16514#ifdef INT8
16515   int8_t i =  INT8_MAX;
16516  uint8_t u = UINT8_MAX;
16517  printf("int8_t\n");
16518#endif
16519#ifdef INT16
16520   int16_t i =  INT16_MAX;
16521  uint16_t u = UINT16_MAX;
16522  printf("int16_t\n");
16523#endif
16524#ifdef INT32
16525   int32_t i =  INT32_MAX;
16526  uint32_t u = UINT32_MAX;
16527  printf("int32_t\n");
16528#endif
16529}
16530EOCP
16531
16532i8type="signed char"
16533u8type="unsigned char"
16534i8size=1
16535u8size=1
16536
16537case "$i16type" in
16538'')	case "$shortsize" in
16539	2)	i16type=short
16540		u16type="unsigned short"
16541		i16size=$shortsize
16542		u16size=$shortsize
16543		;;
16544	esac
16545	;;
16546esac
16547case "$i16type" in
16548'')	set try -DINT16
16549	if eval $compile; then
16550		case "`$run ./try`" in
16551		int16_t)
16552			i16type=int16_t
16553			u16type=uint16_t
16554			i16size=2
16555			u16size=2
16556			;;
16557		esac
16558	fi
16559	;;
16560esac
16561case "$i16type" in
16562'')	if $test $shortsize -ge 2; then
16563		i16type=short
16564		u16type="unsigned short"
16565		i16size=$shortsize
16566		u16size=$shortsize
16567	fi
16568	;;
16569esac
16570
16571case "$i32type" in
16572'')	case "$longsize" in
16573	4)	i32type=long
16574		u32type="unsigned long"
16575		i32size=$longsize
16576		u32size=$longsize
16577		;;
16578	*)	case "$intsize" in
16579		4)	i32type=int
16580			u32type="unsigned int"
16581			i32size=$intsize
16582			u32size=$intsize
16583			;;
16584		esac
16585		;;
16586	esac
16587	;;
16588esac
16589case "$i32type" in
16590'')	set try -DINT32
16591	if eval $compile; then
16592		case "`$run ./try`" in
16593		int32_t)
16594			i32type=int32_t
16595			u32type=uint32_t
16596			i32size=4
16597			u32size=4
16598			;;
16599		esac
16600	fi
16601	;;
16602esac
16603case "$i32type" in
16604'')	if $test $intsize -ge 4; then
16605		i32type=int
16606		u32type="unsigned int"
16607		i32size=$intsize
16608		u32size=$intsize
16609	fi
16610	;;
16611esac
16612
16613case "$i64type" in
16614'')	case "$d_quad:$quadtype" in
16615	define:?*)
16616		i64type="$quadtype"
16617		u64type="$uquadtype"
16618		i64size=8
16619		u64size=8
16620		;;
16621	esac
16622	;;
16623esac
16624
16625$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16626$cat <<EOP >try.c
16627#include <stdio.h>
16628#$i_stdlib I_STDLIB
16629#ifdef I_STDLIB
16630#include <stdlib.h>
16631#endif
16632#include <sys/types.h>
16633#include <signal.h>
16634#ifdef SIGFPE
16635/* volatile so that the compiler has to store it out to memory */
16636volatile int bletched = 0;
16637$signal_t blech(int s) { bletched = 1; }
16638#endif
16639int main() {
16640    $uvtype u = 0;
16641    $nvtype d;
16642    int     n = 8 * $uvsize;
16643    int     i;
16644#ifdef SIGFPE
16645    signal(SIGFPE, blech);
16646#endif
16647
16648    for (i = 0; i < n; i++) {
16649      u = u << 1 | ($uvtype)1;
16650      d = ($nvtype)u;
16651      if (($uvtype)d != u)
16652        break;
16653      if (d <= 0)
16654	break;
16655      d = ($nvtype)(u - 1);
16656      if (($uvtype)d != (u - 1))
16657        break;
16658#ifdef SIGFPE
16659      if (bletched)
16660	break;
16661#endif
16662    }
16663    printf("%d\n", ((i == n) ? -n : i));
16664    exit(0);
16665}
16666EOP
16667set try
16668
16669d_nv_preserves_uv="$undef"
16670if eval $compile; then
16671	nv_preserves_uv_bits="`$run ./try`"
16672fi
16673case "$nv_preserves_uv_bits" in
16674\-[1-9]*)
16675	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16676	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16677	d_nv_preserves_uv="$define"
16678	;;
16679[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16680	d_nv_preserves_uv="$undef" ;;
16681*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
16682	nv_preserves_uv_bits="0" ;;
16683esac
16684$rm_try
16685
16686$echo "Checking to find the largest integer value your NVs can hold..." >&4
16687$cat <<EOP >try.c
16688#include <stdio.h>
16689
16690typedef $nvtype NV;
16691
16692int
16693main() {
16694  NV value = 2;
16695  int count = 1;
16696
16697  while(count < 256) {
16698    /* volatile so that the compiler has to store it out to memory */
16699    volatile NV up = value + 1.0;
16700    volatile NV negated = -value;
16701    volatile NV down = negated - 1.0;
16702    volatile NV got_up = up - value;
16703    int up_good = got_up == 1.0;
16704    int got_down = down - negated;
16705    int down_good = got_down == -1.0;
16706
16707    if (down_good != up_good) {
16708      fprintf(stderr,
16709	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16710	      up_good, (double) got_up, down_good, (double) got_down,
16711	      count, (double) value);
16712      return 1;
16713    }
16714    if (!up_good) {
16715      while (1) {
16716	if (count > 8) {
16717	  count -= 8;
16718	  fputs("256.0", stdout);
16719	} else {
16720	  count--;
16721	  fputs("2.0", stdout);
16722	}
16723	if (!count) {
16724	  puts("");
16725	  return 0;
16726	}
16727	fputs("*", stdout);
16728      }
16729    }
16730    value *= 2;
16731    ++count;
16732  }
16733  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16734	  count, (double) value);
16735  return 1;
16736}
16737EOP
16738set try
16739
16740nv_overflows_integers_at='0'
16741if eval $compile; then
16742    xxx="`$run ./try`"
16743    case "$?" in
16744	0)
16745	    case "$xxx" in
16746		2*)  cat >&4 <<EOM
16747The largest integer your NVs can preserve is equal to $xxx
16748EOM
16749		    nv_overflows_integers_at="$xxx"
16750		    ;;
16751		*)  cat >&4 <<EOM
16752Cannot determine the largest integer value your NVs can hold, unexpected output
16753'$xxx'
16754EOM
16755		    ;;
16756	    esac
16757	    ;;
16758	*)  cat >&4 <<EOM
16759Cannot determine the largest integer value your NVs can hold
16760EOM
16761	    ;;
16762    esac
16763fi
16764$rm_try
16765
16766$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16767$cat <<EOP >try.c
16768#include <stdio.h>
16769#$i_stdlib I_STDLIB
16770#ifdef I_STDLIB
16771#include <stdlib.h>
16772#endif
16773#include <string.h>
16774#include <sys/types.h>
16775#include <signal.h>
16776#ifdef SIGFPE
16777/* volatile so that the compiler has to store it out to memory */
16778volatile int bletched = 0;
16779$signal_t blech(int s) { bletched = 1; }
16780#endif
16781
16782int checkit($nvtype d, const char *where) {
16783    void *v = &d;
16784    unsigned char *p = (unsigned char *)v;
16785    unsigned char *end = p + sizeof(d);
16786    int fail = 0;
16787
16788    while (p < end)
16789	fail += *p++;
16790
16791    if (!fail)
16792	return 0;
16793
16794    p = (unsigned char *)v;
16795    printf("No - %s: 0x", where);
16796    while (p < end)
16797	printf ("%02X", *p++);
16798    printf("\n");
16799    return 1;
16800}
16801
16802int main(int argc, char **argv) {
16803    $nvtype d = 0.0;
16804    int fail = 0;
16805    fail += checkit(d, "0.0");
16806
16807    /* The compiler shouldn't be assuming that bletched is 0  */
16808    d = bletched;
16809
16810    fail += checkit(d, "bleched");
16811
16812#ifdef SIGFPE
16813    signal(SIGFPE, blech);
16814#endif
16815
16816    /* Paranoia - the compiler should have no way of knowing that ANSI says
16817       that argv[argc] will always be NULL.  Actually, if it did assume this it
16818       would be buggy, as this is C and main() can be called from elsewhere in
16819       the program.  */
16820    d = argv[argc] ? 1 : 0;
16821
16822    if (d) {
16823	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16824    }
16825
16826    fail += checkit(d, "ternary");
16827
16828    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16829
16830    if (d != 0.0) {
16831	printf("No - memset doesn't give 0.0\n");
16832	/* This might just blow up:  */
16833	printf("(gives %g)\n", d);
16834	return 1;
16835    }
16836
16837#ifdef SIGFPE
16838    if (bletched) {
16839	printf("No - something bleched\n");
16840	return 1;
16841    }
16842#endif
16843    if (fail) {
16844      printf("No - %d fail(s)\n", fail);
16845      return 1;
16846    }
16847    printf("Yes\n");
16848    return 0;
16849}
16850EOP
16851set try
16852
16853d_nv_zero_is_allbits_zero="$undef"
16854if eval $compile; then
16855    xxx="`$run ./try`"
16856    case "$?" in
16857	0)
16858	    case "$xxx" in
16859		Yes)  cat >&4 <<EOM
168600.0 is represented as all bits zero in memory
16861EOM
16862		    d_nv_zero_is_allbits_zero="$define"
16863		    ;;
16864		*)  cat >&4 <<EOM
168650.0 is not represented as all bits zero in memory
16866EOM
16867		    d_nv_zero_is_allbits_zero="$undef"
16868		    ;;
16869	    esac
16870	    ;;
16871	*)  cat >&4 <<EOM
168720.0 is not represented as all bits zero in memory
16873EOM
16874	    d_nv_zero_is_allbits_zero="$undef"
16875	    ;;
16876    esac
16877fi
16878$rm_try
16879
16880: check for off64_t
16881echo " "
16882echo "Checking to see if you have off64_t..." >&4
16883$cat >try.c <<EOCP
16884#include <sys/types.h>
16885#include <unistd.h>
16886int main() { off64_t x = 7; }
16887EOCP
16888set try
16889if eval $compile; then
16890	val="$define"
16891	echo "You have off64_t."
16892else
16893	val="$undef"
16894	echo "You do not have off64_t."
16895	case "$lseeksize" in
16896	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16897	esac
16898fi
16899$rm_try
16900set d_off64_t
16901eval $setvar
16902
16903: how to create joinable pthreads
16904if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16905	echo " "
16906	echo "Checking what constant to use for creating joinable pthreads..." >&4
16907	$cat >try.c <<'EOCP'
16908#include <pthread.h>
16909int main() {
16910    int detachstate = JOINABLE;
16911}
16912EOCP
16913	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16914	if eval $compile; then
16915		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16916		val="$undef" # Yes, undef.
16917		set d_old_pthread_create_joinable
16918		eval $setvar
16919		val=""
16920		set old_pthread_create_joinable
16921		eval $setvar
16922	else
16923		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16924		if eval $compile; then
16925			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16926			val="$define"
16927			set d_old_pthread_create_joinable
16928			eval $setvar
16929			val=PTHREAD_CREATE_UNDETACHED
16930			set old_pthread_create_joinable
16931			eval $setvar
16932		else
16933			set try -DJOINABLE=__UNDETACHED
16934			if eval $compile; then
16935				echo "You seem to use __UNDETACHED." >&4
16936				val="$define"
16937				set d_old_pthread_create_joinable
16938				eval $setvar
16939				val=__UNDETACHED
16940				set old_pthread_create_joinable
16941				eval $setvar
16942			else
16943				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16944				val="$define"
16945				set d_old_pthread_create_joinable
16946				eval $setvar
16947				val=0
16948				set old_pthread_create_joinable
16949				eval $setvar
16950			fi
16951		fi
16952	fi
16953	$rm_try
16954else
16955    d_old_pthread_create_joinable="$undef"
16956    old_pthread_create_joinable=""
16957fi
16958
16959: see if pause exists
16960set pause d_pause
16961eval $inlibc
16962
16963: see if pipe2 exists
16964set pipe2 d_pipe2
16965eval $inlibc
16966
16967: see if poll exists
16968set poll d_poll
16969eval $inlibc
16970
16971: see if prctl exists
16972set prctl d_prctl
16973eval $inlibc
16974
16975: see if prctl supports PR_SET_NAME
16976d_prctl_set_name=$undef
16977case $d_prctl in
16978    $define)
16979	$cat >try.c <<EOM
16980#ifdef __ANDROID__
16981#include <unistd.h>
16982#endif
16983#include <sys/prctl.h>
16984
16985int main (int argc, char *argv[])
16986{
16987    return (prctl (PR_SET_NAME, "Test"));
16988    } /* main */
16989EOM
16990	set try
16991	if eval $compile_ok && $run ./try; then
16992	    echo "Your prctl (PR_SET_NAME, ...) works"
16993	    d_prctl_set_name=$define
16994	    fi
16995	$rm_try
16996	;;
16997    esac
16998
16999: see if readlink exists
17000set readlink d_readlink
17001eval $inlibc
17002
17003: Check if there is a /proc symlink to the abs path of
17004: the executing program.  We will honor hints of d_procselfexe=$undef
17005: or procselfexe being non-empty, otherwise will try to determine both
17006: if we have readlink.
17007: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17008: referenced, and AmigaOS does not have a proc filesystem anyway.
17009echo " "
17010val="$undef"
17011if $test "X$d_procselfexe" = Xundef; then
17012	procselfexe=''
17013elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17014	val="$define"
17015elif $test "X$d_readlink" = Xdefine; then
17016        : NetBSD first as /proc/self is a symlink to /proc/curproc,
17017        : and it feels more tidy to avoid an extra level of symlink
17018	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17019	while test $# -gt 0; do
17020	    type=$1; try=$2
17021	    shift; shift
17022	    if $issymlink $try; then
17023		$ls -l $try > reflect
17024		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17025		    echo "You have $type-like $try."
17026		    procselfexe='"'$try'"'
17027		    val="$define"
17028		    : This will break out of the loop
17029		    set X; shift
17030		fi
17031	    fi
17032	done
17033fi
17034$rm -f reflect
17035set d_procselfexe
17036eval $setvar
17037
17038: backward compatibility for d_hvfork
17039if test X$d_hvfork != X; then
17040	d_vfork="$d_hvfork"
17041	d_hvfork=''
17042fi
17043: see if there is a vfork
17044val=''
17045set vfork val
17046eval $inlibc
17047
17048d_pseudofork=$undef
17049
17050: Ok, but do we want to use it. vfork is reportedly unreliable in
17051: perl on Solaris 2.x, and probably elsewhere.
17052case "$val" in
17053$define)
17054	echo " "
17055	case "$usevfork" in
17056	false) dflt='n';;
17057	*) dflt='y';;
17058	esac
17059	cat <<'EOM'
17060
17061Perl can only use a vfork() that doesn't suffer from strict
17062restrictions on calling functions or modifying global data in
17063the child.  For example, glibc-2.1 contains such a vfork()
17064that is unsuitable.  If your system provides a proper fork()
17065call, chances are that you do NOT want perl to use vfork().
17066
17067EOM
17068	rp="Do you still want to use vfork()?"
17069	. ./myread
17070	case "$ans" in
17071	y|Y) ;;
17072	*)
17073		echo "Ok, we won't use vfork()."
17074		val="$undef"
17075		;;
17076	esac
17077	;;
17078esac
17079set d_vfork
17080eval $setvar
17081case "$d_vfork" in
17082$define) usevfork='true';;
17083*) usevfork='false';;
17084esac
17085
17086: see whether the pthread_atfork exists
17087$cat >try.c <<EOP
17088#include <pthread.h>
17089#include <stdio.h>
17090int main() {
17091#ifdef  PTHREAD_ATFORK
17092        pthread_atfork(NULL,NULL,NULL);
17093#endif
17094}
17095EOP
17096
17097: see if pthread_atfork exists
17098set try -DPTHREAD_ATFORK
17099if eval $compile; then
17100    val="$define"
17101else
17102    val="$undef"
17103fi
17104case "$usethreads" in
17105$define)
17106        case "$val" in
17107        $define) echo 'pthread_atfork found.' >&4        ;;
17108        *)       echo 'pthread_atfork NOT found.' >&4    ;;
17109        esac
17110esac
17111set d_pthread_atfork
17112eval $setvar
17113
17114: see if pthread_attr_setscope exists
17115set pthread_attr_setscope d_pthread_attr_setscope
17116eval $inlibc
17117
17118: see whether the various POSIXish _yields exist
17119$cat >try.c <<EOP
17120#include <pthread.h>
17121#include <stdio.h>
17122int main() {
17123#ifdef SCHED_YIELD
17124	sched_yield();
17125#else
17126#ifdef PTHREAD_YIELD
17127	pthread_yield();
17128#else
17129#ifdef PTHREAD_YIELD_NULL
17130	pthread_yield(NULL);
17131#endif
17132#endif
17133#endif
17134}
17135EOP
17136: see if sched_yield exists
17137set try -DSCHED_YIELD
17138if eval $compile; then
17139    val="$define"
17140    sched_yield='sched_yield()'
17141else
17142    val="$undef"
17143fi
17144case "$usethreads" in
17145$define)
17146	case "$val" in
17147	$define) echo 'sched_yield() found.' >&4	;;
17148	*)	 echo 'sched_yield() NOT found.' >&4	;;
17149	esac
17150esac
17151set d_sched_yield
17152eval $setvar
17153
17154: see if pthread_yield exists
17155set try -DPTHREAD_YIELD
17156if eval $compile; then
17157    val="$define"
17158    case "$sched_yield" in
17159    '') sched_yield='pthread_yield()' ;;
17160    esac
17161else
17162    set try -DPTHREAD_YIELD_NULL
17163    if eval $compile; then
17164	val="$define"
17165	case "$sched_yield" in
17166	'') sched_yield='pthread_yield(NULL)' ;;
17167	esac
17168    else
17169	val="$undef"
17170    fi
17171fi
17172case "$usethreads" in
17173$define)
17174	case "$val" in
17175	$define) echo 'pthread_yield() found.' >&4	;;
17176	*)	 echo 'pthread_yield() NOT found.' >&4	;;
17177	esac
17178	;;
17179esac
17180set d_pthread_yield
17181eval $setvar
17182case "$sched_yield" in
17183'') sched_yield=undef ;;
17184esac
17185$rm_try
17186
17187: check for ptrdiff_t
17188echo " "
17189echo "Checking to see if you have ptrdiff_t..." >&4
17190$cat >try.c <<EOCP
17191#include <stddef.h>
17192int main() { ptrdiff_t x = 7; }
17193EOCP
17194set try
17195if eval $compile; then
17196	val="$define"
17197	echo "You have ptrdiff_t."
17198else
17199	val="$undef"
17200	echo "You do not have ptrdiff_t."
17201fi
17202$rm_try
17203set d_ptrdiff_t
17204eval $setvar
17205
17206: see if random_r exists
17207set random_r d_random_r
17208eval $inlibc
17209case "$d_random_r" in
17210"$define")
17211	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17212	case "$d_random_r_proto:$usethreads" in
17213	":define")	d_random_r_proto=define
17214		set d_random_r_proto random_r $hdrs
17215		eval $hasproto ;;
17216	*)	;;
17217	esac
17218	case "$d_random_r_proto" in
17219	define)
17220	case "$random_r_proto" in
17221	''|0) try='int random_r(int*, struct random_data*);'
17222	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17223	esac
17224	case "$random_r_proto" in
17225	''|0) try='int random_r(long*, struct random_data*);'
17226	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17227	esac
17228	case "$random_r_proto" in
17229	''|0) try='int random_r(struct random_data*, int32_t*);'
17230	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17231	esac
17232	case "$random_r_proto" in
17233	''|0)	d_random_r=undef
17234		random_r_proto=0
17235		echo "Disabling random_r, cannot determine prototype." >&4 ;;
17236	* )	case "$random_r_proto" in
17237		REENTRANT_PROTO*) ;;
17238		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17239		esac
17240		echo "Prototype: $try" ;;
17241	esac
17242	;;
17243	*)	case "$usethreads" in
17244		define) echo "random_r has no prototype, not using it." >&4 ;;
17245		esac
17246		d_random_r=undef
17247		random_r_proto=0
17248		;;
17249	esac
17250	;;
17251*)	random_r_proto=0
17252	;;
17253esac
17254
17255: see if readdir and friends exist
17256set readdir d_readdir
17257eval $inlibc
17258set seekdir d_seekdir
17259eval $inlibc
17260set telldir d_telldir
17261eval $inlibc
17262set rewinddir d_rewinddir
17263eval $inlibc
17264
17265: see if readdir64_r exists
17266set readdir64_r d_readdir64_r
17267eval $inlibc
17268case "$d_readdir64_r" in
17269"$define")
17270	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17271	case "$d_readdir64_r_proto:$usethreads" in
17272	":define")	d_readdir64_r_proto=define
17273		set d_readdir64_r_proto readdir64_r $hdrs
17274		eval $hasproto ;;
17275	*)	;;
17276	esac
17277	case "$d_readdir64_r_proto" in
17278	define)
17279	case "$readdir64_r_proto" in
17280	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17281	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17282	esac
17283	case "$readdir64_r_proto" in
17284	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17285	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17286	esac
17287	case "$readdir64_r_proto" in
17288	''|0)	d_readdir64_r=undef
17289		readdir64_r_proto=0
17290		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17291	* )	case "$readdir64_r_proto" in
17292		REENTRANT_PROTO*) ;;
17293		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17294		esac
17295		echo "Prototype: $try" ;;
17296	esac
17297	;;
17298	*)	case "$usethreads" in
17299		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17300		esac
17301		d_readdir64_r=undef
17302		readdir64_r_proto=0
17303		;;
17304	esac
17305	;;
17306*)	readdir64_r_proto=0
17307	;;
17308esac
17309
17310: see if readdir_r exists
17311set readdir_r d_readdir_r
17312eval $inlibc
17313case "$d_readdir_r" in
17314"$define")
17315	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17316	case "$d_readdir_r_proto:$usethreads" in
17317	":define")	d_readdir_r_proto=define
17318		set d_readdir_r_proto readdir_r $hdrs
17319		eval $hasproto ;;
17320	*)	;;
17321	esac
17322	case "$d_readdir_r_proto" in
17323	define)
17324	case "$readdir_r_proto" in
17325	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17326	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17327	esac
17328	case "$readdir_r_proto" in
17329	''|0) try='int readdir_r(DIR*, struct dirent*);'
17330	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17331	esac
17332	case "$readdir_r_proto" in
17333	''|0)	d_readdir_r=undef
17334		readdir_r_proto=0
17335		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17336	* )	case "$readdir_r_proto" in
17337		REENTRANT_PROTO*) ;;
17338		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17339		esac
17340		echo "Prototype: $try" ;;
17341	esac
17342	;;
17343	*)	case "$usethreads" in
17344		define) echo "readdir_r has no prototype, not using it." >&4 ;;
17345		esac
17346		d_readdir_r=undef
17347		readdir_r_proto=0
17348		;;
17349	esac
17350	;;
17351*)	readdir_r_proto=0
17352	;;
17353esac
17354
17355: see if readv exists
17356set readv d_readv
17357eval $inlibc
17358
17359: see if recvmsg exists
17360set recvmsg d_recvmsg
17361eval $inlibc
17362
17363: see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17364echo " "
17365if set regcomp val -f d_regcomp; eval $csym; $val; then
17366	echo 'regcomp() found.' >&4
17367	d_regcomp="$define"
17368	d_regcmp="$undef"
17369	d_re_comp="$undef"
17370elif set regcmp val -f d_regcmp; eval $csym; $val; then
17371	echo 'regcmp() found.' >&4
17372	d_regcmp="$define"
17373	d_regcomp="$undef"
17374	d_re_comp="$undef"
17375elif set re_comp val -f d_re_comp; eval $csym; $val; then
17376	echo 're_comp() found, assuming re_exec() also exists.' >&4
17377	d_re_comp="$define"
17378	d_regcomp="$undef"
17379	d_regcmp="$undef"
17380else
17381	$cat >&4 <<EOM
17382No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17383EOM
17384	d_regcmp="$undef"
17385	d_re_comp="$undef"
17386	d_regcomp="$undef"
17387fi
17388
17389: see if remainder exists
17390set remainder d_remainder
17391eval $inlibc
17392
17393: see if remquo exists
17394set remquo d_remquo
17395eval $inlibc
17396
17397: see if rename exists
17398set rename d_rename
17399eval $inlibc
17400
17401: see if rint exists
17402set rint d_rint
17403eval $inlibc
17404
17405: see if rmdir exists
17406set rmdir d_rmdir
17407eval $inlibc
17408
17409: see if round exists
17410set round d_round
17411eval $inlibc
17412
17413: see if prototype for sbrk is available
17414echo " "
17415set d_sbrkproto sbrk $i_unistd unistd.h
17416eval $hasproto
17417
17418: see if scalbn exists
17419set scalbn d_scalbn
17420eval $inlibc
17421
17422: see if select exists
17423set select d_select
17424eval $inlibc
17425
17426: see if semctl exists
17427set semctl d_semctl
17428eval $inlibc
17429
17430: see if semget exists
17431set semget d_semget
17432eval $inlibc
17433
17434: see if semop exists
17435set semop d_semop
17436eval $inlibc
17437
17438: see how much of the 'sem*(2)' library is present.
17439h_sem=true
17440echo " "
17441case "$d_semctl$d_semget$d_semop" in
17442*"$undef"*) h_sem=false;;
17443esac
17444case "$osname" in
17445freebsd)
17446    case "`ipcs 2>&1`" in
17447    "SVID messages"*"not configured"*)
17448	echo "Your $osname does not have the sem*(2) configured." >&4
17449        h_sem=false
17450	val="$undef"
17451	set semctl d_semctl
17452	eval $setvar
17453	set semget d_semget
17454	eval $setvar
17455	set semop d_semop
17456	eval $setvar
17457	;;
17458    esac
17459    ;;
17460esac
17461: we could also check for sys/ipc.h ...
17462if $h_sem && $test `./findhdr sys/sem.h`; then
17463	echo "You have the full sem*(2) library." >&4
17464	val="$define"
17465else
17466	echo "You don't have the full sem*(2) library." >&4
17467	val="$undef"
17468fi
17469set d_sem
17470eval $setvar
17471
17472: see whether sys/sem.h defines union semun
17473echo " "
17474$cat > try.c <<'END'
17475#include <sys/types.h>
17476#include <sys/ipc.h>
17477#include <sys/sem.h>
17478int main () { union semun semun; semun.buf = 0; }
17479END
17480set try
17481if eval $compile; then
17482    echo "You have union semun in <sys/sem.h>." >&4
17483    val="$define"
17484else
17485    echo "You do not have union semun in <sys/sem.h>." >&4
17486    val="$undef"
17487fi
17488$rm_try
17489set d_union_semun
17490eval $setvar
17491
17492: see how to do semctl IPC_STAT
17493case "$d_sem" in
17494$define)
17495    echo " "
17496    $cat > tryh.h <<END
17497#ifndef S_IRUSR
17498#   ifdef S_IREAD
17499#	define S_IRUSR S_IREAD
17500#	define S_IWUSR S_IWRITE
17501#	define S_IXUSR S_IEXEC
17502#   else
17503#	define S_IRUSR 0400
17504#	define S_IWUSR 0200
17505#	define S_IXUSR 0100
17506#   endif
17507#   define S_IRGRP (S_IRUSR>>3)
17508#   define S_IWGRP (S_IWUSR>>3)
17509#   define S_IXGRP (S_IXUSR>>3)
17510#   define S_IROTH (S_IRUSR>>6)
17511#   define S_IWOTH (S_IWUSR>>6)
17512#   define S_IXOTH (S_IXUSR>>6)
17513#endif
17514#ifndef S_IRWXU
17515#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17516#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17517#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17518#endif
17519END
17520    : see whether semctl IPC_STAT can use union semun
17521    case "$d_semctl_semun" in
17522    '')
17523      val="$undef"
17524      $cat > try.c <<END
17525#include <sys/types.h>
17526#include <sys/ipc.h>
17527#include <sys/sem.h>
17528#include <sys/stat.h>
17529#include <stdio.h>
17530#include <errno.h>
17531#include "tryh.h"
17532#ifndef errno
17533extern int errno;
17534#endif
17535#$d_union_semun HAS_UNION_SEMUN
17536int main() {
17537    union semun
17538#ifndef HAS_UNION_SEMUN
17539    {
17540	int val;
17541	struct semid_ds *buf;
17542	unsigned short *array;
17543    }
17544#endif
17545    arg;
17546    int sem, st;
17547
17548#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17549    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17550    if (sem > -1) {
17551	struct semid_ds argbuf;
17552	arg.buf = &argbuf;
17553#	ifdef IPC_STAT
17554	st = semctl(sem, 0, IPC_STAT, arg);
17555	if (st == 0)
17556	    printf("semun\n");
17557	else
17558#	endif /* IPC_STAT */
17559	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17560#	ifdef IPC_RMID
17561	if (semctl(sem, 0, IPC_RMID, arg) != 0)
17562#	endif /* IPC_RMID */
17563	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17564    } else
17565#endif /* IPC_PRIVATE && ... */
17566	printf("semget failed: errno = %d\n", errno);
17567  return 0;
17568}
17569END
17570      set try
17571      if eval $compile; then
17572	  xxx=`$run ./try`
17573          case "$xxx" in
17574          semun) val="$define" ;;
17575          esac
17576      fi
17577      $rm_try
17578      set d_semctl_semun
17579      eval $setvar
17580      ;;
17581    esac
17582    case "$d_semctl_semun" in
17583    $define)
17584        echo "You can use union semun for semctl IPC_STAT." >&4
17585	also='also'
17586        ;;
17587    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17588	also=''
17589        ;;
17590    esac
17591
17592    : see whether semctl IPC_STAT can use struct semid_ds pointer
17593    case "$d_semctl_semid_ds" in
17594    '')
17595      val="$undef"
17596      $cat > try.c <<'END'
17597#include <sys/types.h>
17598#include <sys/ipc.h>
17599#include <sys/sem.h>
17600#include <sys/stat.h>
17601#include "tryh.h"
17602#include <stdio.h>
17603#include <errno.h>
17604#ifndef errno
17605extern int errno;
17606#endif
17607int main() {
17608    union semun
17609#ifndef HAS_UNION_SEMUN
17610    {
17611	int val;
17612	struct semid_ds *buf;
17613	unsigned short *array;
17614    }
17615#endif
17616    arg;
17617    struct semid_ds argbuf;
17618    int sem, st;
17619
17620#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17621    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17622    if (sem > -1) {
17623	arg.buf = &argbuf;
17624#	ifdef IPC_STAT
17625	st = semctl(sem, 0, IPC_STAT, arg);
17626	if (st == 0)
17627	    printf("semid_ds\n");
17628	else
17629#	endif /* IPC_STAT */
17630	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17631#	ifdef IPC_RMID
17632	if (semctl(sem, 0, IPC_RMID, arg) != 0)
17633#	endif /* IPC_RMID */
17634	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17635    } else
17636#endif /* IPC_PRIVATE && ... */
17637	printf("semget failed: errno = %d\n", errno);
17638
17639    return 0;
17640}
17641END
17642      set try
17643      if eval $compile; then
17644          xxx=`$run ./try`
17645          case "$xxx" in
17646          semid_ds) val="$define" ;;
17647          esac
17648      fi
17649      $rm_try
17650      set d_semctl_semid_ds
17651      eval $setvar
17652      ;;
17653    esac
17654    case "$d_semctl_semid_ds" in
17655    $define)
17656        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17657        ;;
17658    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17659        ;;
17660    esac
17661    ;;
17662*)  val="$undef"
17663
17664    # We do not have the full sem*(2) library, so assume we can not
17665    # use either.
17666
17667    set d_semctl_semun
17668    eval $setvar
17669
17670    set d_semctl_semid_ds
17671    eval $setvar
17672    ;;
17673esac
17674$rm_try tryh.h
17675
17676: see if sendmsg exists
17677set sendmsg d_sendmsg
17678eval $inlibc
17679
17680: see if setegid exists
17681set setegid d_setegid
17682eval $inlibc
17683
17684: see if seteuid exists
17685set seteuid d_seteuid
17686eval $inlibc
17687
17688: see if setgrent exists
17689set setgrent d_setgrent
17690eval $inlibc
17691
17692: see if setgrent_r exists
17693set setgrent_r d_setgrent_r
17694eval $inlibc
17695case "$d_setgrent_r" in
17696"$define")
17697	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17698	case "$d_setgrent_r_proto:$usethreads" in
17699	":define")	d_setgrent_r_proto=define
17700		set d_setgrent_r_proto setgrent_r $hdrs
17701		eval $hasproto ;;
17702	*)	;;
17703	esac
17704	case "$d_setgrent_r_proto" in
17705	define)
17706	case "$setgrent_r_proto" in
17707	''|0) try='int setgrent_r(FILE**);'
17708	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17709	esac
17710	case "$setgrent_r_proto" in
17711	''|0) try='void setgrent_r(FILE**);'
17712	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17713	esac
17714	case "$setgrent_r_proto" in
17715	''|0)	d_setgrent_r=undef
17716		setgrent_r_proto=0
17717		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17718	* )	case "$setgrent_r_proto" in
17719		REENTRANT_PROTO*) ;;
17720		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17721		esac
17722		echo "Prototype: $try" ;;
17723	esac
17724	;;
17725	*)	case "$usethreads" in
17726		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17727		esac
17728		d_setgrent_r=undef
17729		setgrent_r_proto=0
17730		;;
17731	esac
17732	;;
17733*)	setgrent_r_proto=0
17734	;;
17735esac
17736
17737: see if sethostent exists
17738set sethostent d_sethent
17739eval $inlibc
17740
17741: see if sethostent_r exists
17742set sethostent_r d_sethostent_r
17743eval $inlibc
17744case "$d_sethostent_r" in
17745"$define")
17746	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17747	case "$d_sethostent_r_proto:$usethreads" in
17748	":define")	d_sethostent_r_proto=define
17749		set d_sethostent_r_proto sethostent_r $hdrs
17750		eval $hasproto ;;
17751	*)	;;
17752	esac
17753	case "$d_sethostent_r_proto" in
17754	define)
17755	case "$sethostent_r_proto" in
17756	''|0) try='int sethostent_r(int, struct hostent_data*);'
17757	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17758	esac
17759	case "$sethostent_r_proto" in
17760	''|0) try='void sethostent_r(int, struct hostent_data*);'
17761	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17762	esac
17763	case "$sethostent_r_proto" in
17764	''|0)	d_sethostent_r=undef
17765		sethostent_r_proto=0
17766		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17767	* )	case "$sethostent_r_proto" in
17768		REENTRANT_PROTO*) ;;
17769		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17770		esac
17771		echo "Prototype: $try" ;;
17772	esac
17773	;;
17774	*)	case "$usethreads" in
17775		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17776		esac
17777		d_sethostent_r=undef
17778		sethostent_r_proto=0
17779		;;
17780	esac
17781	;;
17782*)	sethostent_r_proto=0
17783	;;
17784esac
17785
17786: see if setitimer exists
17787set setitimer d_setitimer
17788eval $inlibc
17789
17790: see if setlinebuf exists
17791set setlinebuf d_setlinebuf
17792eval $inlibc
17793
17794: see if locale.h is available
17795set locale.h i_locale
17796eval $inhdr
17797
17798: see if this system has wctype.h
17799set wctype.h i_wctype
17800eval $inhdr
17801
17802: see if towupper exists
17803set towupper d_towupper
17804eval $inlibc
17805
17806: check for setlocale function and behavior
17807$cat <<EOM
17808
17809Checking to see if you have setlocale() and its behavior
17810EOM
17811$cat >try.c <<EOCP
17812#include <stdlib.h>
17813#include <string.h>
17814#$i_locale I_LOCALE
17815#ifdef I_LOCALE
17816#  include <locale.h>
17817#endif
17818#$i_wctype I_WCTYPE
17819#ifdef I_WCTYPE
17820#  include <wctype.h>
17821#endif
17822
17823int main() {
17824    const char * invalid_name = "\a";   /* This is really invalid! */
17825    int accepts_any_locale_name = 0;
17826    int has_C_UTF8 = 0;
17827    unsigned char bad_setlocale = 255;
17828
17829    /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17830     * disabled.  It's hard to imagine an instance where meaningful locale
17831     * handling could be done without LC_CTYPE */
17832    const char *  name = setlocale(LC_CTYPE, "C");
17833
17834    if (name == NULL || strcmp(name, "C") != 0) {
17835        exit(bad_setlocale);
17836    }
17837
17838    name = setlocale(LC_CTYPE, invalid_name);
17839    if (name != NULL) {
17840
17841        /* Let it pass if it accepts the name but gives back one of the C
17842         * locales */
17843        if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17844            accepts_any_locale_name = 1;
17845        }
17846    }
17847
17848    name = setlocale(LC_CTYPE, "C.UTF-8");
17849    if (name != NULL) {
17850        unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17851
17852#$d_towupper HAS_TOWUPPER
17853#ifdef HAS_TOWUPPER
17854
17855        /* We assume that if the machine doesn't have the C99 towupper, it
17856         * doesn't have C.UTF-8, even if we successfully changed locales to
17857         * include it.  This seems safer even on platforms that didn't accept
17858         * the really invalid name */
17859
17860        if (towupper(y_with_diaeresis) == 0x178) {
17861            has_C_UTF8 = 1;
17862        }
17863
17864#endif
17865
17866    }
17867
17868#if 0
17869
17870    /* Currently unused code to determine if LC_ALL with disparate values uses
17871     * category = value pairs or positional, and to determine the separator
17872     * between the categories.  We could add code so that if the separator were
17873     * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17874     * every possible ASCII separator would fit in the 5 bits available in the
17875     * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17876     * positional, we probably would want to know the order of the categories.
17877     * Using a file between the C program and the shell script would really be
17878     * require to do that */
17879#ifdef LC_ALL
17880
17881    unsigned char min_separator = ' ' - 1;
17882    unsigned char separator = min_separator;
17883    int uses_name_value_pair_names = 0;
17884
17885    name = setlocale(LC_ALL, "C");
17886    if (name == NULL || strcmp(name, "C") != 0) {
17887        exit(bad_setlocale);
17888    }
17889
17890    if (has_C_UTF8) {
17891        char * pos;
17892
17893        name = setlocale(LC_CTYPE, "C.UTF-8");
17894        if (name == NULL) {
17895            exit(bad_setlocale);
17896        }
17897        name = setlocale(LC_ALL, NULL);
17898        if (name == NULL) {
17899            exit(bad_setlocale);
17900        }
17901
17902        pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17903        if (pos != NULL) {
17904            uses_name_value_pair_names = 1;
17905            if (pos == name) {
17906                separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17907            }
17908            else {
17909                separator = *(pos - 1);
17910            }
17911        }
17912        else {
17913            pos = strstr(name, "C.UTF-8");
17914            if (pos == NULL) {
17915                /* bad */
17916            }
17917            else if (pos == name) {
17918                separator = name[sizeof("C.UTF-8") - 1];
17919            }
17920            else {
17921                separator = *(pos - 1);
17922            }
17923        }
17924    }
17925
17926#endif
17927#endif
17928
17929    exit( 0 /* (separator - min_separator) << 3
17930        | uses_name_value_pair_names      << 2
17931          */
17932        | has_C_UTF8                      << 1
17933        | accepts_any_locale_name);
17934
17935}
17936EOCP
17937set try
17938if eval $compile; then
17939    echo "Your system has setlocale()..." >&4
17940    $run ./try
17941    case $? in
17942        0) echo "and it seems sane" >&4
17943           d_setlocale="$define"
17944           d_setlocale_accepts_any_locale_name="$undef"
17945           d_has_C_UTF8="false"
17946           ;;
17947        1) echo "and it seems sane, but accepts any locale name as valid" >&4
17948           d_setlocale="$define"
17949           d_setlocale_accepts_any_locale_name="$define"
17950           d_has_C_UTF8="false"
17951           ;;
17952        2) echo "and it seems sane" >&4
17953           d_setlocale="$define"
17954           d_setlocale_accepts_any_locale_name="$undef"
17955           d_has_C_UTF8="true"
17956           ;;
17957        3) echo "and it seems sane, but accepts any locale name as valid" >&4
17958           d_setlocale="$define"
17959           d_setlocale_accepts_any_locale_name="$define"
17960           d_has_C_UTF8="true"
17961           ;;
17962        *) echo "but it doesn't seem to work, so we won't use it." >&4
17963           d_setlocale="$undef"
17964           d_setlocale_accepts_any_locale_name="$undef"
17965           d_has_C_UTF8="false"
17966           ;;
17967    esac
17968else
17969    echo "your system does not have setlocale()" >&4
17970    d_setlocale="$undef"
17971    d_setlocale_accepts_any_locale_name="$undef"
17972    d_has_C_UTF8="false"
17973fi
17974$rm_try
17975
17976: see if setlocale_r exists
17977set setlocale_r d_setlocale_r
17978eval $inlibc
17979case "$d_setlocale_r" in
17980"$define")
17981	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17982	case "$d_setlocale_r_proto:$usethreads" in
17983	":define")	d_setlocale_r_proto=define
17984		set d_setlocale_r_proto setlocale_r $hdrs
17985		eval $hasproto ;;
17986	*)	;;
17987	esac
17988	case "$d_setlocale_r_proto" in
17989	define)
17990	case "$setlocale_r_proto" in
17991	''|0) try='int setlocale_r(int, const char*, char*, int);'
17992	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17993	esac
17994	case "$setlocale_r_proto" in
17995	''|0)	d_setlocale_r=undef
17996		setlocale_r_proto=0
17997		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17998	* )	case "$setlocale_r_proto" in
17999		REENTRANT_PROTO*) ;;
18000		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18001		esac
18002		echo "Prototype: $try" ;;
18003	esac
18004	;;
18005	*)	case "$usethreads" in
18006		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18007		esac
18008		d_setlocale_r=undef
18009		setlocale_r_proto=0
18010		;;
18011	esac
18012	;;
18013*)	setlocale_r_proto=0
18014	;;
18015esac
18016
18017: see if setnetent exists
18018set setnetent d_setnent
18019eval $inlibc
18020
18021: see if setnetent_r exists
18022set setnetent_r d_setnetent_r
18023eval $inlibc
18024case "$d_setnetent_r" in
18025"$define")
18026	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18027	case "$d_setnetent_r_proto:$usethreads" in
18028	":define")	d_setnetent_r_proto=define
18029		set d_setnetent_r_proto setnetent_r $hdrs
18030		eval $hasproto ;;
18031	*)	;;
18032	esac
18033	case "$d_setnetent_r_proto" in
18034	define)
18035	case "$setnetent_r_proto" in
18036	''|0) try='int setnetent_r(int, struct netent_data*);'
18037	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18038	esac
18039	case "$setnetent_r_proto" in
18040	''|0) try='void setnetent_r(int, struct netent_data*);'
18041	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18042	esac
18043	case "$setnetent_r_proto" in
18044	''|0)	d_setnetent_r=undef
18045		setnetent_r_proto=0
18046		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18047	* )	case "$setnetent_r_proto" in
18048		REENTRANT_PROTO*) ;;
18049		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18050		esac
18051		echo "Prototype: $try" ;;
18052	esac
18053	;;
18054	*)	case "$usethreads" in
18055		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18056		esac
18057		d_setnetent_r=undef
18058		setnetent_r_proto=0
18059		;;
18060	esac
18061	;;
18062*)	setnetent_r_proto=0
18063	;;
18064esac
18065
18066: see if setprotoent exists
18067set setprotoent d_setpent
18068eval $inlibc
18069
18070: see if setpgid exists
18071set setpgid d_setpgid
18072eval $inlibc
18073
18074: see if setpgrp2 exists
18075set setpgrp2 d_setpgrp2
18076eval $inlibc
18077
18078: see if setpriority exists
18079set setpriority d_setprior
18080eval $inlibc
18081
18082: see if setproctitle exists
18083set setproctitle d_setproctitle
18084eval $inlibc
18085
18086: see if setprotoent_r exists
18087set setprotoent_r d_setprotoent_r
18088eval $inlibc
18089case "$d_setprotoent_r" in
18090"$define")
18091	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18092	case "$d_setprotoent_r_proto:$usethreads" in
18093	":define")	d_setprotoent_r_proto=define
18094		set d_setprotoent_r_proto setprotoent_r $hdrs
18095		eval $hasproto ;;
18096	*)	;;
18097	esac
18098	case "$d_setprotoent_r_proto" in
18099	define)
18100	case "$setprotoent_r_proto" in
18101	''|0) try='int setprotoent_r(int, struct protoent_data*);'
18102	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18103	esac
18104	case "$setprotoent_r_proto" in
18105	''|0) try='void setprotoent_r(int, struct protoent_data*);'
18106	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18107	esac
18108	case "$setprotoent_r_proto" in
18109	''|0)	d_setprotoent_r=undef
18110		setprotoent_r_proto=0
18111		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18112	* )	case "$setprotoent_r_proto" in
18113		REENTRANT_PROTO*) ;;
18114		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18115		esac
18116		echo "Prototype: $try" ;;
18117	esac
18118	;;
18119	*)	case "$usethreads" in
18120		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18121		esac
18122		d_setprotoent_r=undef
18123		setprotoent_r_proto=0
18124		;;
18125	esac
18126	;;
18127*)	setprotoent_r_proto=0
18128	;;
18129esac
18130
18131: see if setpwent exists
18132set setpwent d_setpwent
18133eval $inlibc
18134
18135: see if setpwent_r exists
18136set setpwent_r d_setpwent_r
18137eval $inlibc
18138case "$d_setpwent_r" in
18139"$define")
18140	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18141	case "$d_setpwent_r_proto:$usethreads" in
18142	":define")	d_setpwent_r_proto=define
18143		set d_setpwent_r_proto setpwent_r $hdrs
18144		eval $hasproto ;;
18145	*)	;;
18146	esac
18147	case "$d_setpwent_r_proto" in
18148	define)
18149	case "$setpwent_r_proto" in
18150	''|0) try='int setpwent_r(FILE**);'
18151	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18152	esac
18153	case "$setpwent_r_proto" in
18154	''|0) try='void setpwent_r(FILE**);'
18155	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18156	esac
18157	case "$setpwent_r_proto" in
18158	''|0)	d_setpwent_r=undef
18159		setpwent_r_proto=0
18160		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18161	* )	case "$setpwent_r_proto" in
18162		REENTRANT_PROTO*) ;;
18163		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18164		esac
18165		echo "Prototype: $try" ;;
18166	esac
18167	;;
18168	*)	case "$usethreads" in
18169		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18170		esac
18171		d_setpwent_r=undef
18172		setpwent_r_proto=0
18173		;;
18174	esac
18175	;;
18176*)	setpwent_r_proto=0
18177	;;
18178esac
18179
18180: see if setregid exists
18181set setregid d_setregid
18182eval $inlibc
18183set setresgid d_setresgid
18184eval $inlibc
18185
18186: see if setreuid exists
18187set setreuid d_setreuid
18188eval $inlibc
18189set setresuid d_setresuid
18190eval $inlibc
18191
18192: see if setrgid exists
18193set setrgid d_setrgid
18194eval $inlibc
18195
18196: see if setruid exists
18197set setruid d_setruid
18198eval $inlibc
18199
18200: see if setservent exists
18201set setservent d_setsent
18202eval $inlibc
18203
18204: see if setservent_r exists
18205set setservent_r d_setservent_r
18206eval $inlibc
18207case "$d_setservent_r" in
18208"$define")
18209	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18210	case "$d_setservent_r_proto:$usethreads" in
18211	":define")	d_setservent_r_proto=define
18212		set d_setservent_r_proto setservent_r $hdrs
18213		eval $hasproto ;;
18214	*)	;;
18215	esac
18216	case "$d_setservent_r_proto" in
18217	define)
18218	case "$setservent_r_proto" in
18219	''|0) try='int setservent_r(int, struct servent_data*);'
18220	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18221	esac
18222	case "$setservent_r_proto" in
18223	''|0) try='void setservent_r(int, struct servent_data*);'
18224	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18225	esac
18226	case "$setservent_r_proto" in
18227	''|0)	d_setservent_r=undef
18228		setservent_r_proto=0
18229		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18230	* )	case "$setservent_r_proto" in
18231		REENTRANT_PROTO*) ;;
18232		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18233		esac
18234		echo "Prototype: $try" ;;
18235	esac
18236	;;
18237	*)	case "$usethreads" in
18238		define) echo "setservent_r has no prototype, not using it." >&4 ;;
18239		esac
18240		d_setservent_r=undef
18241		setservent_r_proto=0
18242		;;
18243	esac
18244	;;
18245*)	setservent_r_proto=0
18246	;;
18247esac
18248
18249: see if setsid exists
18250set setsid d_setsid
18251eval $inlibc
18252
18253: see if setvbuf exists
18254set setvbuf d_setvbuf
18255eval $inlibc
18256
18257: see if shmctl exists
18258set shmctl d_shmctl
18259eval $inlibc
18260
18261: see if shmget exists
18262set shmget d_shmget
18263eval $inlibc
18264
18265: see if shmat exists
18266set shmat d_shmat
18267eval $inlibc
18268: see what shmat returns
18269case "$d_shmat" in
18270"$define")
18271	$cat >shmat.c <<'END'
18272#include <sys/shm.h>
18273void *shmat();
18274END
18275	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18276		shmattype='void *'
18277	else
18278		shmattype='char *'
18279	fi
18280	echo "and it returns ($shmattype)." >&4
18281	: see if a prototype for shmat is available
18282	xxx=`./findhdr sys/shm.h`
18283	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18284	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18285		val="$define"
18286	else
18287		val="$undef"
18288	fi
18289	$rm -f shmat.[co]
18290	;;
18291*)
18292	val="$undef"
18293	;;
18294esac
18295set d_shmatprototype
18296eval $setvar
18297
18298: see if shmdt exists
18299set shmdt d_shmdt
18300eval $inlibc
18301
18302: see how much of the 'shm*(2)' library is present.
18303h_shm=true
18304echo " "
18305case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18306*"$undef"*) h_shm=false;;
18307esac
18308case "$osname" in
18309freebsd)
18310    case "`ipcs 2>&1`" in
18311    "SVID shared memory"*"not configured"*)
18312	echo "Your $osname does not have the shm*(2) configured." >&4
18313        h_shm=false
18314	val="$undef"
18315	set shmctl d_shmctl
18316	eval $setvar
18317	set shmget d_shmget
18318	eval $setvar
18319	set shmat d_shmat
18320	eval $setvar
18321	set shmdt d_shmdt
18322	eval $setvar
18323	;;
18324    esac
18325    ;;
18326esac
18327: we could also check for sys/ipc.h ...
18328if $h_shm && $test `./findhdr sys/shm.h`; then
18329	echo "You have the full shm*(2) library." >&4
18330	val="$define"
18331else
18332	echo "You don't have the full shm*(2) library." >&4
18333	val="$undef"
18334fi
18335set d_shm
18336eval $setvar
18337
18338: see if we have sigaction
18339echo " "
18340if set sigaction val -f d_sigaction; eval $csym; $val; then
18341	echo 'sigaction() found.' >&4
18342	$cat > try.c <<EOP
18343#include <stdio.h>
18344#include <sys/types.h>
18345#include <signal.h>
18346#$i_stdlib I_STDLIB
18347#ifdef I_STDLIB
18348#include <stdlib.h>
18349#endif
18350int main()
18351{
18352    struct sigaction act, oact;
18353    act.sa_flags = 0;
18354    oact.sa_handler = 0;
18355    /* so that act and oact are used */
18356    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18357}
18358EOP
18359	set try
18360	if eval $compile_ok; then
18361		val="$define"
18362	else
18363		echo "But you don't seem to have a usable struct sigaction." >&4
18364		val="$undef"
18365	fi
18366else
18367	echo 'sigaction NOT found.' >&4
18368	val="$undef"
18369fi
18370set d_sigaction; eval $setvar
18371$rm_try
18372
18373: see what type pids are declared as in the kernel
18374rp="What is the type of process ids on this system?"
18375set pid_t pidtype int stdio.h sys/types.h
18376eval $typedef_ask
18377
18378: see what type uids are declared as in the kernel
18379echo " "
18380echo "Looking for the type for user ids returned by getuid()."
18381set uid_t uidtype xxx stdio.h sys/types.h
18382eval $typedef
18383case "$uidtype" in
18384xxx)
18385	xxx=`./findhdr sys/user.h`
18386	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18387	case $1 in
18388	unsigned) dflt="$1 $2" ;;
18389	*) dflt="$1" ;;
18390	esac
18391	;;
18392*) dflt="$uidtype";;
18393esac
18394case "$uidtype" in
18395uid_t)	echo "uid_t found." ;;
18396*)	rp="What is the type for user ids returned by getuid()?"
18397	. ./myread
18398	uidtype="$ans"
18399	;;
18400esac
18401
18402: Define hasfield_t macro for Configure internal use
18403hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18404while $test $# -ge 2; do
18405    case "$1" in
18406	$define) echo "#include <$2>";;
18407    esac ;
18408    shift 2;
18409done > try.c;
18410echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18411set try;
18412if eval $compile; then
18413	val="$define";
18414else
18415	val="$undef";
18416fi;
18417set $varname;
18418eval $setvar;
18419$rm_try'
18420
18421: see what siginfo fields we have
18422case "$d_sigaction" in
18423"$define")
18424	echo "Checking if your siginfo_t has si_errno field...">&4
18425	set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18426	eval $hasfield_t;
18427
18428	echo "Checking if your siginfo_t has si_pid field...">&4
18429	set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18430	eval $hasfield_t;
18431
18432	echo "Checking if your siginfo_t has si_uid field...">&4
18433	set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18434	eval $hasfield_t;
18435
18436	echo "Checking if your siginfo_t has si_addr field...">&4
18437	set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18438	eval $hasfield_t;
18439
18440	echo "Checking if your siginfo_t has si_status field...">&4
18441	set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18442	eval $hasfield_t;
18443
18444	echo "Checking if your siginfo_t has si_band field...">&4
18445	set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18446	eval $hasfield_t;
18447
18448	echo "Checking if your siginfo_t has si_value field...">&4
18449	set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18450	eval $hasfield_t;
18451
18452	echo "Checking if your siginfo_t has si_fd field...">&4
18453	set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18454	eval $hasfield_t;
18455
18456	;;
18457*)
18458	d_siginfo_si_errno="$undef"
18459	d_siginfo_si_pid="$undef"
18460	d_siginfo_si_uid="$undef"
18461	d_siginfo_si_addr="$undef"
18462	d_siginfo_si_status="$undef"
18463	d_siginfo_si_band="$undef"
18464	d_siginfo_si_value="$undef"
18465	d_siginfo_si_fd="$undef"
18466	;;
18467esac
18468
18469: see if this is a sunmath.h system
18470set sunmath.h i_sunmath
18471eval $inhdr
18472
18473: see if signbit exists
18474$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18475$cat >try.c <<EOCP
18476#$i_sunmath I_SUNMATH
18477#include <math.h>
18478#ifdef I_SUNMATH  /* Solaris special math library */
18479#  include <sunmath.h>
18480#endif
18481#define NV $nvtype
18482int main(int argc, char **argv)
18483{
18484    NV x = 0.0;
18485    NV y = -1.0;
18486    if ((signbit(x) == 0) && (signbit(y) != 0))
18487	return 0;
18488    else
18489	return 1;
18490}
18491EOCP
18492val="$undef"
18493set try
18494if eval $compile; then
18495    if $run ./try; then
18496        $echo "Yes." >&4
18497	val="$define"
18498    else
18499        $echo "Signbit seems to be available, but doesn't work as I expected."
18500        $echo "I won't use it." >&4
18501	val="$undef"
18502    fi
18503else
18504    $echo "Nope." >&4
18505    dflt="$undef"
18506fi
18507set d_signbit
18508eval $setvar
18509$rm_try
18510
18511: see if sigprocmask exists
18512set sigprocmask d_sigprocmask
18513eval $inlibc
18514
18515: see if sigsetjmp exists
18516echo " "
18517case "$d_sigsetjmp" in
18518'')
18519	$cat >try.c <<EOP
18520#include <setjmp.h>
18521#$i_stdlib I_STDLIB
18522#ifdef I_STDLIB
18523#include <stdlib.h>
18524#endif
18525sigjmp_buf env;
18526int set = 1;
18527int main()
18528{
18529	if (sigsetjmp(env,1))
18530		exit(set);
18531	set = 0;
18532	siglongjmp(env, 1);
18533	exit(1);
18534}
18535EOP
18536	set try
18537	if eval $compile; then
18538		if $run ./try >/dev/null 2>&1; then
18539			echo "POSIX sigsetjmp found." >&4
18540			val="$define"
18541		else
18542			$cat >&4 <<EOM
18543Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18544I'll ignore them.
18545EOM
18546			val="$undef"
18547		fi
18548	else
18549		echo "sigsetjmp not found." >&4
18550		val="$undef"
18551	fi
18552	;;
18553*) val="$d_sigsetjmp"
18554	case "$d_sigsetjmp" in
18555	$define) echo "POSIX sigsetjmp found." >&4;;
18556	$undef) echo "sigsetjmp not found." >&4;;
18557	esac
18558	;;
18559esac
18560set d_sigsetjmp
18561eval $setvar
18562$rm_try
18563
18564: see if snprintf exists
18565set snprintf d_snprintf
18566eval $inlibc
18567
18568: see if vsnprintf exists
18569set vsnprintf d_vsnprintf
18570eval $inlibc
18571
18572case "$d_snprintf-$d_vsnprintf" in
18573"$define-$define")
18574    $cat <<EOM
18575Checking whether your snprintf() and vsnprintf() work okay...
18576EOM
18577    $cat >try.c <<'EOCP'
18578/* v?snprintf testing logic courtesy of Russ Allbery.
18579 * According to C99:
18580 * - if the buffer is too short it still must be \0-terminated
18581 * - if the buffer is too short the potentially required length
18582 *   must be returned and not -1
18583 * - if the buffer is NULL the potentially required length
18584 *   must be returned and not -1 or core dump
18585 */
18586#include <stdio.h>
18587#include <stdarg.h>
18588
18589char buf[2];
18590
18591int test (char *format, ...)
18592{
18593    va_list args;
18594    int count;
18595
18596    va_start (args, format);
18597    count = vsnprintf (buf, sizeof buf, format, args);
18598    va_end (args);
18599    return count;
18600}
18601
18602int main ()
18603{
18604    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18605             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18606}
18607EOCP
18608    set try
18609    if eval $compile; then
18610	`$run ./try`
18611	case "$?" in
18612	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18613	*) cat <<EOM >&4
18614Your snprintf() and snprintf() don't seem to be working okay.
18615EOM
18616	   d_snprintf="$undef"
18617	   d_vsnprintf="$undef"
18618	   ;;
18619	esac
18620    else
18621	echo "(I can't seem to compile the test program--assuming they don't)"
18622	d_snprintf="$undef"
18623	d_vsnprintf="$undef"
18624    fi
18625    $rm_try
18626    ;;
18627esac
18628
18629: see if sockatmark exists
18630set sockatmark d_sockatmark
18631eval $inlibc
18632
18633: see if prototype for sockatmark is available
18634echo " "
18635set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18636eval $hasproto
18637
18638: see if socks5_init exists
18639set socks5_init d_socks5_init
18640eval $inlibc
18641
18642: see if srand48_r exists
18643set srand48_r d_srand48_r
18644eval $inlibc
18645case "$d_srand48_r" in
18646"$define")
18647	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18648	case "$d_srand48_r_proto:$usethreads" in
18649	":define")	d_srand48_r_proto=define
18650		set d_srand48_r_proto srand48_r $hdrs
18651		eval $hasproto ;;
18652	*)	;;
18653	esac
18654	case "$d_srand48_r_proto" in
18655	define)
18656	case "$srand48_r_proto" in
18657	''|0) try='int srand48_r(long, struct drand48_data*);'
18658	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18659	esac
18660	case "$srand48_r_proto" in
18661	''|0)	d_srand48_r=undef
18662		srand48_r_proto=0
18663		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18664	* )	case "$srand48_r_proto" in
18665		REENTRANT_PROTO*) ;;
18666		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18667		esac
18668		echo "Prototype: $try" ;;
18669	esac
18670	;;
18671	*)	case "$usethreads" in
18672		define) echo "srand48_r has no prototype, not using it." >&4 ;;
18673		esac
18674		d_srand48_r=undef
18675		srand48_r_proto=0
18676		;;
18677	esac
18678	;;
18679*)	srand48_r_proto=0
18680	;;
18681esac
18682
18683: see if srandom_r exists
18684set srandom_r d_srandom_r
18685eval $inlibc
18686case "$d_srandom_r" in
18687"$define")
18688	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18689	case "$d_srandom_r_proto:$usethreads" in
18690	":define")	d_srandom_r_proto=define
18691		set d_srandom_r_proto srandom_r $hdrs
18692		eval $hasproto ;;
18693	*)	;;
18694	esac
18695	case "$d_srandom_r_proto" in
18696	define)
18697	case "$srandom_r_proto" in
18698	''|0) try='int srandom_r(unsigned int, struct random_data*);'
18699	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18700	esac
18701	case "$srandom_r_proto" in
18702	''|0)	d_srandom_r=undef
18703		srandom_r_proto=0
18704		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18705	* )	case "$srandom_r_proto" in
18706		REENTRANT_PROTO*) ;;
18707		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18708		esac
18709		echo "Prototype: $try" ;;
18710	esac
18711	;;
18712	*)	case "$usethreads" in
18713		define) echo "srandom_r has no prototype, not using it." >&4 ;;
18714		esac
18715		d_srandom_r=undef
18716		srandom_r_proto=0
18717		;;
18718	esac
18719	;;
18720*)	srandom_r_proto=0
18721	;;
18722esac
18723
18724: see if prototype for setresgid is available
18725echo " "
18726set d_sresgproto setresgid $i_unistd unistd.h
18727eval $hasproto
18728
18729: see if prototype for setresuid is available
18730echo " "
18731set d_sresuproto setresuid $i_unistd unistd.h
18732eval $hasproto
18733
18734: see if stat exists
18735set stat d_stat
18736eval $inlibc
18737
18738: see if sys/stat.h is available
18739set sys/stat.h i_sysstat
18740eval $inhdr
18741
18742: see if stat knows about block sizes
18743echo " "
18744echo "Checking to see if your struct stat has st_blocks field..." >&4
18745set d_statblks stat st_blocks $i_sysstat sys/stat.h
18746eval $hasfield
18747
18748: see if this is a sys/vfs.h system
18749set sys/vfs.h i_sysvfs
18750eval $inhdr
18751
18752: see if this is a sys/statfs.h system
18753set sys/statfs.h i_sysstatfs
18754eval $inhdr
18755
18756: Check for statfs_s
18757echo " "
18758echo "Checking to see if your system supports struct statfs..." >&4
18759set 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
18760eval $hasstruct
18761case "$d_statfs_s" in
18762"$define")      echo "Yes, it does."   ;;
18763*)              echo "No, it doesn't." ;;
18764esac
18765
18766: see if struct statfs knows about f_flags
18767case "$d_statfs_s" in
18768define)
18769	echo " "
18770	echo "Checking to see if your struct statfs has f_flags field..." >&4
18771	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
18772	eval $hasfield
18773	;;
18774*)	val="$undef"
18775	set d_statfs_f_flags
18776	eval $setvar
18777	;;
18778esac
18779case "$d_statfs_f_flags" in
18780"$define")      echo "Yes, it does."   ;;
18781*)              echo "No, it doesn't." ;;
18782esac
18783
18784: see what flavor, if any, of static inline is supported
18785echo " "
18786echo "Checking to see if your system supports static inline..."
18787$cat > try.c <<'EOCP'
18788#include <stdlib.h>
18789extern int f_via_a(int x);
18790extern int f_via_b(int x);
18791int main(int argc, char **argv)
18792{
18793    int y;
18794
18795    y = f_via_a(0);
18796#ifdef USE_B
18797    y = f_via_b(0);
18798#endif
18799    if (y == 42) {
18800        return EXIT_SUCCESS;
18801    }
18802    else {
18803        return EXIT_FAILURE;
18804    }
18805}
18806EOCP
18807$cat > a.c <<'EOCP'
18808static INLINE int f(int x) {
18809    int y;
18810    y = x + 42;
18811    return y;
18812}
18813
18814int f_via_a(int x)
18815{
18816    return f(x);
18817}
18818EOCP
18819$cat > b.c <<'EOCP'
18820extern int f(int x);
18821
18822int f_via_b(int x)
18823{
18824    return f(x);
18825}
18826EOCP
18827
18828# Respect a hint (or previous) value for perl_static_inline, if there is one.
18829case "$perl_static_inline" in
18830'')	# Check the various possibilities, and break out on success.
18831	# For gcc, prefer __inline__, which will still permit
18832	# cflags.SH to add in -ansi.
18833	case "$gccversion" in
18834		'') xxx="inline __inline__ __inline _inline";;
18835		*)  xxx="__inline__ inline __inline _inline";;
18836	esac
18837	for inline in $xxx; do
18838		set try -DINLINE=$inline a.c
18839		if eval $compile && $run ./try; then
18840			# Now make sure there is no external linkage of static
18841			# functions
18842			set try -DINLINE=$inline -DUSE_B a.c b.c
18843			if eval $compile && $run ./try; then
18844				$echo "Your compiler supports static $inline, " >&4
18845				$echo "but it also creates an external definition," >&4
18846				$echo "so I won't use it." >&4
18847				val=$undef
18848			else
18849				$echo "Your compiler supports static $inline." >&4
18850				val=$define
18851				perl_static_inline="static $inline";
18852				break;
18853			fi
18854		else
18855			$echo "Your compiler does NOT support static $inline." >&4
18856			val="$undef"
18857		fi
18858	done
18859	;;
18860*inline*) # Some variant of inline exists.
18861	echo "Keeping your $hint value of $perl_static_inline."
18862	val=$define
18863	;;
18864static)  # No inline capabilities
18865	echo "Keeping your $hint value of $perl_static_inline."
18866	val=$undef
18867	;;
18868*)  # Unrecognized previous value -- blindly trust the supplied
18869	# value and hope it makes sense.  Use old value for
18870	# d_static_inline, if there is one.
18871	echo "Keeping your $hint value of $perl_static_inline."
18872	case "$d_static_inline" in
18873		'') val=$define ;;
18874		*)  val=$d_static_inline ;;
18875	esac
18876	;;
18877esac
18878# Fallback to plain 'static' if nothing worked.
18879case "$perl_static_inline" in
18880'')
18881	perl_static_inline="static"
18882	val=$undef
18883	;;
18884esac
18885set d_static_inline
18886eval $setvar
18887$rm -f a.[co] b.[co]
18888$rm_try
18889
18890: Check stream access
18891$cat >&4 <<EOM
18892Checking how to access stdio streams by file descriptor number...
18893EOM
18894case "$stdio_stream_array" in
18895'')	$cat >try.c <<EOCP
18896#include <stdio.h>
18897int main() {
18898  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18899    printf("yes\n");
18900}
18901EOCP
18902	for s in _iob __iob __sF
18903	do
18904	        set try -DSTDIO_STREAM_ARRAY=$s
18905		if eval $compile; then
18906			case "`$run ./try`" in
18907			yes)	stdio_stream_array=$s; break ;;
18908			esac
18909		fi
18910	done
18911	$rm_try
18912esac
18913case "$stdio_stream_array" in
18914'')	$cat >&4 <<EOM
18915I can't figure out how to access stdio streams by file descriptor number.
18916EOM
18917	d_stdio_stream_array="$undef"
18918	;;
18919*)	$cat >&4 <<EOM
18920You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18921EOM
18922	d_stdio_stream_array="$define"
18923	;;
18924esac
18925
18926: see if strcoll exists
18927set strcoll d_strcoll
18928eval $inlibc
18929
18930: see if strerror_l exists
18931set strerror_l d_strerror_l
18932eval $inlibc
18933
18934: see if strerror_r exists
18935set strerror_r d_strerror_r
18936eval $inlibc
18937case "$d_strerror_r" in
18938"$define")
18939	hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18940	case "$d_strerror_r_proto:$usethreads" in
18941	":define")	d_strerror_r_proto=define
18942		set d_strerror_r_proto strerror_r $hdrs
18943		eval $hasproto ;;
18944	*)	;;
18945	esac
18946	case "$d_strerror_r_proto" in
18947	define)
18948	case "$strerror_r_proto" in
18949	''|0) try='int strerror_r(int, char*, size_t);'
18950	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18951	esac
18952	case "$strerror_r_proto" in
18953	''|0) try='int strerror_r(int, char*, int);'
18954	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18955	esac
18956	case "$strerror_r_proto" in
18957	''|0) try='char* strerror_r(int, char*, size_t);'
18958	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18959	esac
18960	case "$strerror_r_proto" in
18961	''|0)	d_strerror_r=undef
18962		strerror_r_proto=0
18963		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18964	* )	case "$strerror_r_proto" in
18965		REENTRANT_PROTO*) ;;
18966		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18967		esac
18968		echo "Prototype: $try" ;;
18969	esac
18970	;;
18971	*)	case "$usethreads" in
18972		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18973		esac
18974		d_strerror_r=undef
18975		strerror_r_proto=0
18976		;;
18977	esac
18978	;;
18979*)	strerror_r_proto=0
18980	;;
18981esac
18982
18983: see if strftime exists
18984set strftime d_strftime
18985eval $inlibc
18986
18987: see if strlcat exists
18988: We need both a prototype in string.h and the symbol in libc.
18989echo " "
18990d_strlcat_proto=''
18991xx1="#$d_gnulibc HAS_GNULIBC"
18992xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
18993xx3='#   define _GNU_SOURCE'
18994xx4='#endif'
18995set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
18996eval $hasproto
18997case "$d_strlcat_proto" in
18998    define) # see if strlcat exists
18999	set strlcat d_strlcat
19000	eval $inlibc
19001	;;
19002    *)  val=$undef
19003	set d_strlcat
19004	eval $setvar
19005	;;
19006esac
19007
19008: see if strlcpy exists
19009: We need both a prototype in string.h and the symbol in libc.
19010echo " "
19011d_strlcpy_proto=''
19012xx1="#$d_gnulibc HAS_GNULIBC"
19013xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19014xx3='#   define _GNU_SOURCE'
19015xx4='#endif'
19016set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19017eval $hasproto
19018case "$d_strlcpy_proto" in
19019    define) # see if strlcpy exists
19020	set strlcpy d_strlcpy
19021	eval $inlibc
19022	;;
19023    *)  val=$undef
19024	set d_strlcpy
19025	eval $setvar
19026	;;
19027esac
19028
19029: see if strnlen exists
19030set strnlen d_strnlen
19031eval $inlibc
19032
19033: see if strtod exists
19034set strtod d_strtod
19035eval $inlibc
19036
19037: see if strtod_l exists
19038set strtod_l d_strtod_l
19039eval $inlibc
19040
19041: see if strtol exists
19042set strtol d_strtol
19043eval $inlibc
19044
19045: see if strtold exists
19046set strtold d_strtold
19047eval $inlibc
19048
19049: see if strtold_l exists
19050set strtold_l d_strtold_l
19051eval $inlibc
19052
19053: see if strtoll exists
19054set strtoll d_strtoll
19055eval $inlibc
19056
19057case "$d_longlong-$d_strtoll" in
19058"$define-$define")
19059	$cat <<EOM
19060Checking whether your strtoll() works okay...
19061EOM
19062	$cat >try.c <<'EOCP'
19063#include <errno.h>
19064#ifdef __hpux
19065#define strtoll __strtoll
19066#endif
19067#ifdef __EMX__
19068#define strtoll _strtoll
19069#endif
19070#include <stdio.h>
19071extern long long int strtoll(char *s, char **, int);
19072static int bad = 0;
19073int check(char *s, long long ell, int een) {
19074	long long gll;
19075	errno = 0;
19076	gll = strtoll(s, 0, 10);
19077	if (!((gll == ell) && (errno == een)))
19078		bad++;
19079}
19080int main() {
19081	check(" 1",                                      1LL, 0);
19082	check(" 0",                                      0LL, 0);
19083	check("-1",                                     -1LL, 0);
19084	check("-9223372036854775808", -9223372036854775808LL, 0);
19085	check("-9223372036854775808", -9223372036854775808LL, 0);
19086	check(" 9223372036854775807",  9223372036854775807LL, 0);
19087	check("-9223372036854775808", -9223372036854775808LL, 0);
19088	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19089	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19090	if (!bad)
19091		printf("ok\n");
19092}
19093EOCP
19094	set try
19095	if eval $compile; then
19096		yyy=`$run ./try`
19097		case "$yyy" in
19098		ok) echo "Your strtoll() seems to be working okay." ;;
19099		*) cat <<EOM >&4
19100Your strtoll() doesn't seem to be working okay.
19101EOM
19102		   d_strtoll="$undef"
19103		   ;;
19104		esac
19105	else
19106		echo "(I can't seem to compile the test program--assuming it doesn't)"
19107		d_strtoll="$undef"
19108	fi
19109	;;
19110esac
19111
19112: see if strtoq exists
19113set strtoq d_strtoq
19114eval $inlibc
19115
19116: see if strtoul exists
19117set strtoul d_strtoul
19118eval $inlibc
19119
19120case "$d_strtoul" in
19121"$define")
19122	$cat <<EOM
19123Checking whether your strtoul() works okay...
19124EOM
19125	$cat >try.c <<'EOCP'
19126#include <errno.h>
19127#include <stdio.h>
19128extern unsigned long int strtoul(char *s, char **, int);
19129static int bad = 0;
19130void check(char *s, unsigned long eul, int een) {
19131	unsigned long gul;
19132	errno = 0;
19133	gul = strtoul(s, 0, 10);
19134	if (!((gul == eul) && (errno == een)))
19135		bad++;
19136}
19137int main() {
19138	check(" 1", 1L, 0);
19139	check(" 0", 0L, 0);
19140EOCP
19141	case "$longsize" in
19142	8)
19143	    $cat >>try.c <<'EOCP'
19144	check("18446744073709551615", 18446744073709551615UL, 0);
19145	check("18446744073709551616", 18446744073709551615UL, ERANGE);
19146#if 0 /* strtoul() for /^-/ strings is undefined. */
19147	check("-1", 18446744073709551615UL, 0);
19148	check("-18446744073709551614", 2, 0);
19149	check("-18446744073709551615", 1, 0);
19150	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19151	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19152#endif
19153EOCP
19154		;;
19155	4)
19156		    $cat >>try.c <<'EOCP'
19157	check("4294967295", 4294967295UL, 0);
19158	check("4294967296", 4294967295UL, ERANGE);
19159#if 0 /* strtoul() for /^-/ strings is undefined. */
19160	check("-1", 4294967295UL, 0);
19161	check("-4294967294", 2, 0);
19162	check("-4294967295", 1, 0);
19163	check("-4294967296", 4294967295UL, ERANGE);
19164	check("-4294967297", 4294967295UL, ERANGE);
19165#endif
19166EOCP
19167		;;
19168	*)
19169: Should we write these tests to be more portable by sprintf-ing
19170: ~0 and then manipulating that char string as input for strtol?
19171		;;
19172	esac
19173	$cat >>try.c <<'EOCP'
19174	if (!bad)
19175		printf("ok\n");
19176	return 0;
19177}
19178EOCP
19179	set try
19180	if eval $compile; then
19181		case "`$run ./try`" in
19182		ok) echo "Your strtoul() seems to be working okay." ;;
19183		*) cat <<EOM >&4
19184Your strtoul() doesn't seem to be working okay.
19185EOM
19186		   d_strtoul="$undef"
19187		   ;;
19188		esac
19189	else
19190		echo "(I can't seem to compile the test program--assuming it doesn't)"
19191		d_strtoul="$undef"
19192	fi
19193	;;
19194esac
19195
19196: see if strtoull exists
19197set strtoull d_strtoull
19198eval $inlibc
19199
19200case "$d_longlong-$d_strtoull" in
19201"$define-$define")
19202	$cat <<EOM
19203Checking whether your strtoull() works okay...
19204EOM
19205	$cat >try.c <<'EOCP'
19206#include <errno.h>
19207#ifdef __hpux
19208#define strtoull __strtoull
19209#endif
19210#include <stdio.h>
19211extern unsigned long long int strtoull(char *s, char **, int);
19212static int bad = 0;
19213int check(char *s, long long eull, int een) {
19214	long long gull;
19215	errno = 0;
19216	gull = strtoull(s, 0, 10);
19217	if (!((gull == eull) && (errno == een)))
19218		bad++;
19219}
19220int main() {
19221	check(" 1",                                        1LL, 0);
19222	check(" 0",                                        0LL, 0);
19223	check("18446744073709551615",  18446744073709551615ULL, 0);
19224	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19225#if 0 /* strtoull() for /^-/ strings is undefined. */
19226	check("-1",                    18446744073709551615ULL, 0);
19227	check("-18446744073709551614",                     2LL, 0);
19228	check("-18446744073709551615",                     1LL, 0);
19229	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19230	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19231#endif
19232	if (!bad)
19233		printf("ok\n");
19234}
19235EOCP
19236	set try
19237	if eval $compile; then
19238		case "`$run ./try`" in
19239		ok) echo "Your strtoull() seems to be working okay." ;;
19240		*) cat <<EOM >&4
19241Your strtoull() doesn't seem to be working okay.
19242EOM
19243		   d_strtoull="$undef"
19244		   ;;
19245		esac
19246	else
19247		echo "(I can't seem to compile the test program--assuming it doesn't)"
19248		d_strtoull="$undef"
19249	fi
19250	;;
19251esac
19252
19253: see if strtouq exists
19254set strtouq d_strtouq
19255eval $inlibc
19256
19257case "$d_strtouq" in
19258"$define")
19259	$cat <<EOM
19260Checking whether your strtouq() works okay...
19261EOM
19262	$cat >try.c <<'EOCP'
19263#include <errno.h>
19264#include <stdio.h>
19265extern unsigned long long int strtouq(char *s, char **, int);
19266static int bad = 0;
19267void check(char *s, unsigned long long eull, int een) {
19268	unsigned long long gull;
19269	errno = 0;
19270	gull = strtouq(s, 0, 10);
19271	if (!((gull == eull) && (errno == een)))
19272		bad++;
19273}
19274int main() {
19275	check(" 1",                                        1LL, 0);
19276	check(" 0",                                        0LL, 0);
19277	check("18446744073709551615",  18446744073709551615ULL, 0);
19278	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19279#if 0 /* strtouq() for /^-/ strings is undefined. */
19280	check("-1",                    18446744073709551615ULL, 0);
19281	check("-18446744073709551614",                     2LL, 0);
19282	check("-18446744073709551615",                     1LL, 0);
19283	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19284	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19285#endif
19286	if (!bad)
19287		printf("ok\n");
19288	return 0;
19289}
19290EOCP
19291	set try
19292	if eval $compile; then
19293		case "`$run ./try`" in
19294		ok) echo "Your strtouq() seems to be working okay." ;;
19295		*) cat <<EOM >&4
19296Your strtouq() doesn't seem to be working okay.
19297EOM
19298		   d_strtouq="$undef"
19299		   ;;
19300		esac
19301	else
19302		echo "(I can't seem to compile the test program--assuming it doesn't)"
19303		d_strtouq="$undef"
19304	fi
19305	;;
19306esac
19307
19308: see if strxfrm exists
19309set strxfrm d_strxfrm
19310eval $inlibc
19311
19312: see if symlink exists
19313set symlink d_symlink
19314eval $inlibc
19315
19316: see if syscall exists
19317set syscall d_syscall
19318eval $inlibc
19319
19320: see if prototype for syscall is available
19321echo " "
19322set d_syscallproto syscall $i_unistd unistd.h
19323eval $hasproto
19324
19325: see if sysconf exists
19326set sysconf d_sysconf
19327eval $inlibc
19328
19329: see if sys_errlist[] exists
19330echo " "
19331if test "X$d_syserrlst" = X; then
19332	if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19333		echo "You have sys_errlist[], so we could roll our own strerror."
19334		d_syserrlst="$define"
19335	else
19336		echo "You don't have sys_errlist[], so strerror() is welcome."
19337		d_syserrlst="$undef"
19338	fi
19339fi
19340
19341: see if system exists
19342set system d_system
19343eval $inlibc
19344
19345: see if tcgetpgrp exists
19346set tcgetpgrp d_tcgetpgrp
19347eval $inlibc
19348
19349: see if tcsetpgrp exists
19350set tcsetpgrp d_tcsetpgrp
19351eval $inlibc
19352
19353: see if prototype for telldir is available
19354echo " "
19355set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19356eval $hasproto
19357
19358: see if tgamma exists
19359set tgamma d_tgamma
19360eval $inlibc
19361
19362: check for thread_safe_nl_langinfo_l item
19363$cat <<EOM
19364
19365Checking to see if you have nl_langinfo_l() and that it is thread-safe
19366EOM
19367$cat >try.c <<EOCP
19368#$i_stdlib I_STDLIB
19369#ifdef I_STDLIB
19370#  include <stdlib.h>
19371#endif
19372#include <string.h>
19373#$i_langinfo I_LANGINFO
19374#ifdef I_LANGINFO
19375#  include <langinfo.h>
19376#endif
19377#$i_pthread I_PTHREAD
19378#ifdef I_PTHREAD
19379#  include <pthread.h>
19380#endif
19381#$i_locale I_LOCALE
19382#ifdef I_LOCALE
19383#  include <locale.h>
19384#endif
19385
19386void *
19387thread_start(void * arg)
19388{
19389    nl_langinfo(RADIXCHAR);
19390}
19391
19392int main() {
19393    char * main_buffer;
19394    char save_main_buffer[1000];
19395    pthread_t subthread;
19396    pthread_attr_t attr;
19397
19398    main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19399
19400    /* If too large for our generous allowance, just assume we don't have
19401     * it. */
19402    if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19403        exit(1);
19404    }
19405
19406    strcpy(save_main_buffer, main_buffer);
19407
19408    if (pthread_attr_init(&attr) != 0) {
19409        exit(1);
19410    }
19411
19412    if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19413        exit(1);
19414    }
19415
19416    if (pthread_join(subthread, NULL) != 0) {
19417        exit(1);
19418    }
19419
19420    exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19421}
19422EOCP
19423case "$usethreads" in
19424    define)
19425        set try
19426        if eval $compile; then
19427            echo "Your system has nl_langinfo_l()..." >&4
19428            if $run ./try; then
19429                echo "and it is thread-safe (just as I'd hoped)." >&4
19430                d_thread_safe_nl_langinfo_l="$define"
19431                echo "$d_thread_safe_nl_langinfo_l" >&4
19432            else
19433                echo "but it isn't thread-safe, so we won't use it." >&4
19434            fi
19435        else
19436            echo "your system does not have nl_langinfo_l()" >&4
19437        fi
19438        ;;
19439    *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19440esac
19441if test X"$d_thread_safe_nl_langinfo_l" = X; then
19442	d_thread_safe_nl_langinfo_l="$undef"
19443fi
19444$rm_try
19445
19446: see if time exists
19447echo " "
19448if test "X$d_time" = X -o X"$timetype" = X; then
19449    if set time val -f d_time; eval $csym; $val; then
19450		echo 'time() found.' >&4
19451		val="$define"
19452		rp="What is the type returned by time() on this system?"
19453		set time_t timetype long stdio.h sys/types.h
19454		eval $typedef_ask
19455    else
19456		echo 'time() not found, hope that will do.' >&4
19457		val="$undef"
19458		timetype='int';
19459    fi
19460    set d_time
19461    eval $setvar
19462fi
19463
19464: see if timegm exists
19465set timegm d_timegm
19466eval $inlibc
19467
19468: see if this is a sys/times.h system
19469set sys/times.h i_systimes
19470eval $inhdr
19471
19472: see if times exists
19473echo " "
19474if set times val -f d_times; eval $csym; $val; then
19475	echo 'times() found.' >&4
19476	d_times="$define"
19477	inc=''
19478	case "$i_systimes" in
19479	"$define") inc='sys/times.h';;
19480	esac
19481	rp="What is the type returned by times() on this system?"
19482	set clock_t clocktype long stdio.h sys/types.h $inc
19483	eval $typedef_ask
19484else
19485	echo 'times() NOT found, hope that will do.' >&4
19486	d_times="$undef"
19487	clocktype='int'
19488fi
19489
19490: see if tmpnam_r exists
19491set tmpnam_r d_tmpnam_r
19492eval $inlibc
19493case "$d_tmpnam_r" in
19494"$define")
19495	hdrs="$i_systypes sys/types.h define stdio.h "
19496	case "$d_tmpnam_r_proto:$usethreads" in
19497	":define")	d_tmpnam_r_proto=define
19498		set d_tmpnam_r_proto tmpnam_r $hdrs
19499		eval $hasproto ;;
19500	*)	;;
19501	esac
19502	case "$d_tmpnam_r_proto" in
19503	define)
19504	case "$tmpnam_r_proto" in
19505	''|0) try='char* tmpnam_r(char*);'
19506	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19507	esac
19508	case "$tmpnam_r_proto" in
19509	''|0)	d_tmpnam_r=undef
19510		tmpnam_r_proto=0
19511		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19512	* )	case "$tmpnam_r_proto" in
19513		REENTRANT_PROTO*) ;;
19514		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19515		esac
19516		echo "Prototype: $try" ;;
19517	esac
19518	;;
19519	*)	case "$usethreads" in
19520		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19521		esac
19522		d_tmpnam_r=undef
19523		tmpnam_r_proto=0
19524		;;
19525	esac
19526	;;
19527*)	tmpnam_r_proto=0
19528	;;
19529esac
19530
19531: see if towlower exists
19532set towlower d_towlower
19533eval $inlibc
19534
19535: see if trunc exists
19536set trunc d_trunc
19537eval $inlibc
19538
19539: see if truncate exists
19540set truncate d_truncate
19541eval $inlibc
19542
19543: see if ttyname_r exists
19544set ttyname_r d_ttyname_r
19545eval $inlibc
19546case "$d_ttyname_r" in
19547"$define")
19548	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19549	case "$d_ttyname_r_proto:$usethreads" in
19550	":define")	d_ttyname_r_proto=define
19551		set d_ttyname_r_proto ttyname_r $hdrs
19552		eval $hasproto ;;
19553	*)	;;
19554	esac
19555	case "$d_ttyname_r_proto" in
19556	define)
19557	case "$ttyname_r_proto" in
19558	''|0) try='int ttyname_r(int, char*, size_t);'
19559	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19560	esac
19561	case "$ttyname_r_proto" in
19562	''|0) try='int ttyname_r(int, char*, int);'
19563	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19564	esac
19565	case "$ttyname_r_proto" in
19566	''|0) try='char* ttyname_r(int, char*, int);'
19567	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19568	esac
19569	case "$ttyname_r_proto" in
19570	''|0)	d_ttyname_r=undef
19571		ttyname_r_proto=0
19572		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19573	* )	case "$ttyname_r_proto" in
19574		REENTRANT_PROTO*) ;;
19575		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19576		esac
19577		echo "Prototype: $try" ;;
19578	esac
19579	;;
19580	*)	case "$usethreads" in
19581		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19582		esac
19583		d_ttyname_r=undef
19584		ttyname_r_proto=0
19585		;;
19586	esac
19587	;;
19588*)	ttyname_r_proto=0
19589	;;
19590esac
19591
19592: see if tzname[] exists
19593echo " "
19594if set tzname val -a d_tzname; eval $csym; $val; then
19595	val="$define"
19596	echo 'tzname[] found.' >&4
19597else
19598	val="$undef"
19599	echo 'tzname[] NOT found.' >&4
19600fi
19601set d_tzname
19602eval $setvar
19603
19604: Check if is a multiplatform env
19605case "$osname" in
19606darwin) multiarch="$define" ;;
19607esac
19608case "$multiarch" in
19609''|[nN]*) multiarch="$undef" ;;
19610esac
19611
19612: check for ordering of bytes in a UV
19613echo " "
19614case "$multiarch" in
19615*$define*)
19616	$cat <<EOM
19617You seem to be doing a multiarchitecture build,
19618skipping the byteorder check.
19619
19620EOM
19621	byteorder='ffff'
19622	;;
19623*)
19624	case "$byteorder" in
19625	'')
19626		$cat <<'EOM'
19627In the following, larger digits indicate more significance.  A big-endian
19628machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19629little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19630machines may have weird orders like 3412.  A Cray will report 87654321,
19631an Alpha will report 12345678. If the test program works the default is
19632probably right.
19633I'm now running the test program...
19634EOM
19635		$cat >try.c <<EOCP
19636#include <stdio.h>
19637#$i_stdlib I_STDLIB
19638#ifdef I_STDLIB
19639#include <stdlib.h>
19640#endif
19641#include <sys/types.h>
19642typedef $uvtype UV;
19643int main()
19644{
19645	int i;
19646	union {
19647		UV l;
19648		char c[$uvsize];
19649	} u;
19650
19651	if ($uvsize > 4)
19652		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19653	else
19654		u.l = (UV)0x04030201;
19655	for (i = 0; i < $uvsize; i++)
19656		printf("%c", u.c[i]+'0');
19657	printf("\n");
19658	exit(0);
19659}
19660EOCP
19661		xxx_prompt=y
19662		set try
19663		if eval $compile && $run ./try > /dev/null; then
19664			dflt=`$run ./try`
19665			case "$dflt" in
19666			[1-4][1-4][1-4][1-4]|12345678|87654321)
19667				echo "(The test program ran ok.)"
19668				echo "byteorder=$dflt"
19669				xxx_prompt=n
19670			;;
19671			????|????????) echo "(The test program ran ok.)" ;;
19672			*) echo "(The test program didn't run right for some reason.)" ;;
19673			esac
19674		else
19675			dflt='4321'
19676			cat <<'EOM'
19677(I can't seem to compile the test program.  Guessing big-endian...)
19678EOM
19679		fi
19680		case "$xxx_prompt" in
19681		y)
19682			rp="What is the order of bytes in $uvtype?"
19683			. ./myread
19684			byteorder="$ans"
19685			;;
19686		*)	byteorder=$dflt
19687			;;
19688		esac
19689		;;
19690	esac
19691	$rm_try
19692	;;
19693esac
19694
19695: Checking 32bit alignedness
19696$cat <<EOM
19697
19698Checking to see whether you can access character data unalignedly...
19699EOM
19700case "$d_u32align" in
19701'')   $cat >try.c <<EOCP
19702#include <stdio.h>
19703#$i_stdlib I_STDLIB
19704#ifdef I_STDLIB
19705#include <stdlib.h>
19706#endif
19707#define U32 $u32type
19708#define BYTEORDER 0x$byteorder
19709#define U8 $u8type
19710#include <signal.h>
19711#ifdef SIGBUS
19712$signal_t bletch(int s) { exit(4); }
19713#endif
19714int main() {
19715#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19716    volatile U8 buf[8];
19717    volatile U32 *up;
19718    int i;
19719
19720    if (sizeof(U32) != 4) {
19721	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19722	exit(1);
19723    }
19724
19725    fflush(stdout);
19726
19727#ifdef SIGBUS
19728    signal(SIGBUS, bletch);
19729#endif
19730
19731    buf[0] = 0;
19732    buf[1] = 0;
19733    buf[2] = 0;
19734    buf[3] = 1;
19735    buf[4] = 0;
19736    buf[5] = 0;
19737    buf[6] = 0;
19738    buf[7] = 1;
19739
19740    for (i = 0; i < 4; i++) {
19741	up = (U32*)(buf + i);
19742	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19743	       (*up == 1 << (8*(3-i)))  /* little-endian */
19744	      )
19745	   )
19746	{
19747	    printf("read failed (%x)\n", *up);
19748	    exit(2);
19749	}
19750    }
19751
19752    /* write test */
19753    for (i = 0; i < 4; i++) {
19754	up = (U32*)(buf + i);
19755	*up = 0xBeef;
19756	if (*up != 0xBeef) {
19757	    printf("write failed (%x)\n", *up);
19758	    exit(3);
19759	}
19760    }
19761
19762    exit(0);
19763#else
19764    printf("1\n");
19765    exit(1);
19766#endif
19767    return 0;
19768}
19769EOCP
19770set try
19771if eval $compile_ok; then
19772	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19773	$run ./try 2>&1 >/dev/null
19774	case "$?" in
19775	0)	cat >&4 <<EOM
19776You can access character data pretty unalignedly.
19777EOM
19778		d_u32align="$undef"
19779		;;
19780	*)	cat >&4 <<EOM
19781It seems that you must access character data in an aligned manner.
19782EOM
19783		d_u32align="$define"
19784		;;
19785	esac
19786else
19787	rp='Can you access character data at unaligned addresses?'
19788	dflt='n'
19789	. ./myread
19790	case "$ans" in
19791	[yY]*)	d_u32align="$undef"  ;;
19792	*)	d_u32align="$define" ;;
19793	esac
19794fi
19795$rm_try
19796;;
19797esac
19798
19799: see if ualarm exists
19800set ualarm d_ualarm
19801eval $inlibc
19802
19803: see if umask exists
19804set umask d_umask
19805eval $inlibc
19806
19807: see if unordered exists
19808set unordered d_unordered
19809eval $inlibc
19810
19811: see if unsetenv exists
19812set unsetenv d_unsetenv
19813eval $inlibc
19814
19815: see if usleep exists
19816set usleep d_usleep
19817eval $inlibc
19818
19819: see if prototype for usleep is available
19820echo " "
19821set d_usleepproto usleep $i_unistd unistd.h
19822eval $hasproto
19823
19824: see if ustat exists
19825set ustat d_ustat
19826eval $inlibc
19827
19828: see if closedir exists
19829set closedir d_closedir
19830eval $inlibc
19831
19832case "$d_closedir" in
19833"$define")
19834	echo " "
19835	echo "Checking whether closedir() returns a status..." >&4
19836	cat > try.c <<EOM
19837#$i_dirent I_DIRENT		/**/
19838#$i_sysdir I_SYS_DIR		/**/
19839#$i_sysndir I_SYS_NDIR		/**/
19840#$i_systypes I_SYS_TYPES	/**/
19841
19842#if defined(I_SYS_TYPES)
19843#include <sys/types.h>
19844#endif
19845#if defined(I_DIRENT)
19846#include <dirent.h>
19847#else
19848#ifdef I_SYS_NDIR
19849#include <sys/ndir.h>
19850#else
19851#ifdef I_SYS_DIR
19852#include <sys/dir.h>
19853#endif
19854#endif
19855#endif
19856int main() { return closedir(opendir(".")); }
19857EOM
19858	set try
19859	if eval $compile_ok; then
19860		if $run ./try > /dev/null 2>&1 ; then
19861			echo "Yes, it does."
19862			val="$undef"
19863		else
19864			echo "No, it doesn't."
19865			val="$define"
19866		fi
19867	else
19868		echo "(I can't seem to compile the test program--assuming it doesn't)"
19869		val="$define"
19870	fi
19871	;;
19872*)
19873	val="$undef";
19874	;;
19875esac
19876set d_void_closedir
19877eval $setvar
19878$rm_try
19879
19880: see if there is a wait4
19881set wait4 d_wait4
19882eval $inlibc
19883
19884: see if waitpid exists
19885set waitpid d_waitpid
19886eval $inlibc
19887
19888: look for wcscmp
19889echo " "
19890$cat >try.c <<'EOCP'
19891#include <stdio.h>
19892#include <wchar.h>
19893int main ()
19894{
19895    wchar_t *s = L" ";
19896    return (wcscmp (s, s) ? 1 : 0);
19897    }
19898EOCP
19899set try
19900val="$undef"
19901if eval $compile; then
19902    `$run ./try`
19903    case "$?" in
19904	0)  echo "A working wcscmp() found." >&4
19905	    val="$define" ;;
19906	*)  echo "wcscmp() found, but it doesn't work" >&4
19907	    ;;
19908	esac
19909else
19910    echo "wcscmp() NOT found." >&4
19911    fi
19912set d_wcscmp
19913eval $setvar
19914$rm_try
19915
19916: see if wcstombs exists
19917set wcstombs d_wcstombs
19918eval $inlibc
19919
19920: look for wcsxfrm
19921echo " "
19922$cat >try.c <<'EOCP'
19923#include <errno.h>
19924#include <wchar.h>
19925int main ()
19926{
19927    wchar_t dst[4], *src = L" ";
19928    errno = 0;
19929    return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19930    }
19931EOCP
19932set try
19933val="$undef"
19934if eval $compile; then
19935    `$run ./try`
19936    case "$?" in
19937	0)  echo "A working wcsxfrm() found." >&4
19938	    val="$define" ;;
19939	*)  echo "wcsxfrm() found, but it doesn't work" >&4
19940	    ;;
19941	esac
19942else
19943    echo "wcsxfrm() NOT found." >&4
19944    fi
19945set d_wcsxfrm
19946eval $setvar
19947$rm_try
19948
19949: see if wctomb exists
19950set wctomb d_wctomb
19951eval $inlibc
19952
19953: see if writev exists
19954set writev d_writev
19955eval $inlibc
19956
19957: check for alignment requirements
19958echo " "
19959case "$alignbytes" in
19960    '') echo "Checking alignment constraints..." >&4
19961	$cat >try.c <<EOCP
19962#include <stdio.h>
19963struct foobar {
19964    char foo;
19965    $nvtype bar;
19966} try_algn;
19967int main()
19968{
19969    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19970    return(0);
19971}
19972EOCP
19973	set try
19974	if eval $compile_ok; then
19975	    dflt=`$run ./try`
19976	else
19977	    dflt='8'
19978	    echo "(I can't seem to compile the test program...)"
19979	fi
19980	case "$multiarch" in
19981	    *$define*)
19982		: The usual safe value is 8, but Darwin with -Duselongdouble
19983		: needs 16.  Hence, we will take 8 as a minimum, but allow
19984		: Configure to pick a larger value if needed.
19985		if $test "$dflt" -lt 8; then
19986		    dflt='8'
19987		    echo "Setting alignment to 8 for multiarch support.">&4
19988		fi
19989		;;
19990	esac
19991	;;
19992    *) dflt="$alignbytes"
19993	;;
19994esac
19995rp="Doubles must be aligned on a how-many-byte boundary?"
19996. ./myread
19997alignbytes="$ans"
19998$rm_try
19999
20000: set the base revision
20001baserev=5.0
20002
20003: length of character in bytes. Is always 1, otherwise it is not C
20004: This used to be a test using sizeof
20005charsize=1
20006
20007: Check for the number of bits in a character
20008case "$charbits" in
20009'')	echo "Checking how long a character is (in bits)..." >&4
20010	$cat >try.c <<EOCP
20011#include <stdio.h>
20012int main ()
20013{
20014    int n;
20015    unsigned char c;
20016    for (c = 1, n = 0; c; c <<= 1, n++) ;
20017    printf ("%d\n", n);
20018    return (0);
20019    }
20020EOCP
20021	set try
20022	if eval $compile_ok; then
20023		dflt=`$run ./try`
20024	else
20025		dflt='8'
20026		echo "(I can't seem to compile the test program.  Guessing...)"
20027	fi
20028	;;
20029*)
20030	dflt="$charbits"
20031	;;
20032esac
20033rp="What is the length of a character (in bits)?"
20034. ./myread
20035charbits="$ans"
20036$rm_try
20037case "$charbits" in
200388)	;;
20039*)	cat >&4 << EOM
20040Your system has an unsigned character size of $charbits bits, which
20041is rather unusual (normally it is 8 bits).  Perl likely will not work
20042correctly on your system, with subtle bugs in various places.
20043EOM
20044	rp='Do you really want to continue?'
20045	dflt='n'
20046	. ./myread
20047	case "$ans" in
20048		[yY])	echo >&4 "Okay, continuing."	;;
20049		*)	exit 1				;;
20050	esac
20051esac
20052
20053: how do we concatenate cpp tokens here?
20054echo " "
20055echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20056$cat >cpp_stuff.c <<'EOCP'
20057#define RCAT(a,b)a/**/b
20058#define ACAT(a,b)a ## b
20059RCAT(Rei,ser)
20060ACAT(Cir,cus)
20061EOCP
20062$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20063if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20064	echo "Oh!  Smells like ANSI's been here." >&4
20065	echo "We can catify or stringify, separately or together!"
20066	cpp_stuff=42
20067elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20068	echo "Ah, yes!  The good old days!" >&4
20069	echo "However, in the good old days we don't know how to stringify and"
20070	echo "catify at the same time."
20071	cpp_stuff=1
20072else
20073	$cat >&4 <<EOM
20074Hmm, I don't seem to be able to concatenate tokens with your cpp.
20075You're going to have to edit the values of CAT[2-5] in config.h...
20076EOM
20077	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20078fi
20079$rm -f cpp_stuff.*
20080
20081: see if this is a db.h system
20082set db.h i_db
20083eval $inhdr
20084
20085case "$i_db" in
20086$define)
20087	: Check db version.
20088	echo " "
20089	echo "Checking Berkeley DB version ..." >&4
20090	$cat >try.c <<EOCP
20091#include <sys/types.h>
20092#include <stdio.h>
20093#$i_stdlib I_STDLIB
20094#ifdef I_STDLIB
20095#include <stdlib.h>
20096#endif
20097#include <db.h>
20098int main(int argc, char *argv[])
20099{
20100#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
20101    int Major, Minor, Patch ;
20102    unsigned long Version ;
20103    (void)db_version(&Major, &Minor, &Patch) ;
20104    if (argc == 2) {
20105        printf("%d %d %d %d %d %d\n",
20106               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20107               Major, Minor, Patch);
20108        exit(0);
20109    }
20110    printf("You have Berkeley DB Version 2 or greater.\n");
20111
20112    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20113		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20114    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20115		Major, Minor, Patch) ;
20116
20117    /* check that db.h & libdb are compatible */
20118    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20119	printf("db.h and libdb are incompatible.\n") ;
20120        exit(3);
20121    }
20122
20123    printf("db.h and libdb are compatible.\n") ;
20124
20125    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20126		+ DB_VERSION_PATCH ;
20127
20128    /* needs to be >= 2.3.4 */
20129    if (Version < 2003004) {
20130    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20131	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20132        exit(2);
20133    }
20134
20135    exit(0);
20136#else
20137#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20138    if (argc == 2) {
20139        printf("1 0 0\n");
20140        exit(0);
20141    }
20142    printf("You have Berkeley DB Version 1.\n");
20143    exit(0);	/* DB version < 2: the coast is clear. */
20144#else
20145    exit(1);	/* <db.h> not Berkeley DB? */
20146#endif
20147#endif
20148}
20149EOCP
20150	set try
20151	if eval $compile_ok && $run ./try; then
20152		echo 'Looks OK.' >&4
20153		set `$run ./try 1`
20154		db_version_major=$1
20155		db_version_minor=$2
20156		db_version_patch=$3
20157	else
20158		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20159		i_db=$undef
20160		case " $libs " in
20161		*"-ldb "*)
20162			: Remove db from list of libraries to use
20163			echo "Removing unusable -ldb from library list" >&4
20164			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20165			shift
20166			libs="$*"
20167			echo "libs = $libs" >&4
20168			;;
20169		esac
20170	fi
20171	$rm_try
20172	;;
20173esac
20174
20175case "$i_db" in
20176define)
20177	: Check the return type needed for hash
20178	echo " "
20179	echo "Checking return type needed for hash for Berkeley DB ..." >&4
20180	$cat >try.c <<EOCP
20181#include <sys/types.h>
20182#include <db.h>
20183
20184#ifndef DB_VERSION_MAJOR
20185u_int32_t hash_cb (const void* ptr, size_t size)
20186{
20187	return 0;
20188}
20189HASHINFO info;
20190int main()
20191{
20192	info.hash = hash_cb;
20193}
20194#endif
20195EOCP
20196	if $cc $ccflags -c try.c >try.out 2>&1 ; then
20197		if $contains warning try.out >>/dev/null 2>&1 ; then
20198			db_hashtype='int'
20199		else
20200			db_hashtype='u_int32_t'
20201		fi
20202	else
20203		: XXX Maybe we should just give up here.
20204		db_hashtype=u_int32_t
20205		$cat try.out >&4
20206		echo "Help:  I can't seem to compile the db test program." >&4
20207		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20208	fi
20209	$rm_try
20210	echo "Your version of Berkeley DB uses $db_hashtype for hash."
20211	;;
20212*)	db_hashtype=u_int32_t
20213	;;
20214esac
20215case "$i_db" in
20216define)
20217	: Check the return type needed for prefix
20218	echo " "
20219	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20220	cat >try.c <<EOCP
20221#include <sys/types.h>
20222#include <db.h>
20223
20224#ifndef DB_VERSION_MAJOR
20225size_t prefix_cb (const DBT *key1, const DBT *key2)
20226{
20227	return 0;
20228}
20229BTREEINFO info;
20230int main()
20231{
20232	info.prefix = prefix_cb;
20233}
20234#endif
20235EOCP
20236	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20237		if $contains warning try.out >>/dev/null 2>&1 ; then
20238			db_prefixtype='int'
20239		else
20240			db_prefixtype='size_t'
20241		fi
20242	else
20243		db_prefixtype='size_t'
20244		: XXX Maybe we should just give up here.
20245		$cat try.out >&4
20246		echo "Help:  I can't seem to compile the db test program." >&4
20247		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20248	fi
20249	$rm_try
20250	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20251	;;
20252*)	db_prefixtype='size_t'
20253	;;
20254esac
20255
20256: Include . in @INC
20257$cat <<EOM
20258
20259Historically Perl has provided a final fallback of the current working
20260directory '.' when searching for a library. This, however, can lead to
20261problems when a Perl program which loads optional modules is called from
20262a shared directory. This can lead to executing unexpected code.
20263
20264EOM
20265
20266# When changing to exclude by default:
20267case "$default_inc_excludes_dot" in
20268    $undef|false|[nN]*) dflt="n" ;;
20269    *)                  dflt="y" ;;
20270esac
20271# To turn exclude off by default:
20272#case "$default_inc_excludes_dot" in
20273#    $define|true|[yY]*) dflt="y" ;;
20274#    *)                  dflt="n" ;;
20275#esac
20276
20277rp='Exclude '.' from @INC by default? '
20278. ./myread
20279case "$ans" in
20280    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20281    *)          default_inc_excludes_dot="$define" ;;
20282esac
20283
20284: Check what kind of inf/nan your system has
20285$echo "Checking the kind of infinities and nans you have..." >&4
20286$echo "(The following tests may crash.  That's okay.)" >&4
20287$cat >try.c <<EOP
20288#define DOUBLESIZE $doublesize
20289#$d_longdbl HAS_LONG_DOUBLE
20290#ifdef HAS_LONG_DOUBLE
20291#define LONG_DOUBLESIZE $longdblsize
20292#define LONG_DOUBLEKIND $longdblkind
20293#endif
20294#include <math.h>
20295#include <string.h>
20296#include <stdio.h>
20297/* Note that whether the sign bit is on or off
20298 * for NaN depends on the CPU/FPU, and possibly
20299 * can be affected by the build toolchain.
20300 *
20301 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20302 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20303 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20304 * (respectively) as opposed to the more usual
20305 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20306 *
20307 * Pre-IEEE-754 floating point format do not even have inf/nan support
20308 * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20309 * to even mention, causing immediate SIGFPE or equivalent: this is
20310 * the case with VAX floating point, for example.
20311 */
20312static void bytes(void *v, unsigned int n) {
20313  unsigned char *p = (unsigned char *)v;
20314  int i;
20315  for (i = 0; i < n; i++) {
20316    printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20317  }
20318}
20319int main(int argc, char *argv[]) {
20320   /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20321    * because some compilers are 'smart' and not only warn but refuse to
20322    * compile such 'illegal' values. */
20323   double dinf = exp(1e9);
20324   double dnan = sqrt(-1.0);
20325#ifdef HAS_LONG_DOUBLE
20326   long double ldinf = (long double)exp(1e9);
20327   long double ldnan = (long double)sqrt(-1.0);
20328# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20329/* the 80-bit long doubles might have garbage in their excess bytes */
20330    memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20331    memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20332# endif
20333  if (argc == 2) {
20334    switch (argv[1][0]) {
20335    case '1': bytes(&dinf, sizeof(dinf)); break;
20336    case '2': bytes(&dnan, sizeof(dnan)); break;
20337    case '3': bytes(&ldinf, sizeof(ldinf)); break;
20338    case '4': bytes(&ldnan, sizeof(ldnan)); break;
20339#endif
20340    }
20341  }
20342  return 0;
20343}
20344EOP
20345set try
20346if eval $compile; then
20347    doubleinfbytes=`$run ./try 1`
20348    doublenanbytes=`$run ./try 2`
20349    case "$d_longdbl" in
20350    $define)
20351      longdblinfbytes=`$run ./try 3`
20352      longdblnanbytes=`$run ./try 4`
20353      ;;
20354    esac
20355else
20356    # Defaults in case the above test program failed.
20357    case "$doublekind" in
20358    1) # IEEE 754 32-bit LE
20359       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20360       doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20361       ;;
20362    2) # IEEE 754 32-bit BE
20363       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20364       doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20365       ;;
20366    3) # IEEE 754 64-bit LE
20367       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20368       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20369       ;;
20370    4) # IEEE 754 64-bit BE
20371       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20372       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20373       ;;
20374    5) # IEEE 754 128-bit LE
20375       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20376       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20377       ;;
20378    6) # IEEE 754 128-bit BE
20379       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20380       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20381       ;;
20382    7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20383       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20384       doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20385       ;;
20386    8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20387       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20388       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20389       ;;
20390    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20391       doubleinfbytes=$undef
20392       doublenanbytes=$undef
20393       ;;
20394    *) # No idea.
20395       doubleinfbytes=$undef
20396       doublenanbytes=$undef
20397       ;;
20398    esac
20399    case "$longdblkind" in
20400    1) # IEEE 754 128-bit LE
20401       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20402       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20403       ;;
20404    2) # IEEE 754 128-bit BE
20405       longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20406       longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20407       ;;
20408    3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20409       case "$longdblsize" in
20410       12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20411           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20412           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20413           ;;
20414       16) # x86_64
20415           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20416           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20417           ;;
20418       *)  # No idea.
20419           longdblinfbytes=$undef
20420           longdblnanbytes=$undef
20421       ;;
20422       esac
20423       ;;
20424    4) # IEEE 754 80-bit BE, 12 or 16 bytes
20425       case "$longdblsize" in
20426       12) # 32-bit system
20427           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20428           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20429           ;;
20430       16) # 64-bit system
20431           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20432           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20433           ;;
20434       *)  # No idea.
20435           longdblinfbytes=$undef
20436           longdblnanbytes=$undef
20437       ;;
20438       esac
20439       ;;
20440    5) # 128-bit LE-LE "double double"
20441       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20442       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20443       ;;
20444    6) # 128-bit BE-BE "double double"
20445       longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20446       longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20447       ;;
20448    7) # 128-bit LE-BE "double double"
20449       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20450       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20451       ;;
20452    8) # 128-bit BE-LE "double double"
20453       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20454       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20455       ;;
20456    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20457       longdblinfbytes=$undef
20458       longdblnanbytes=$undef
20459       ;;
20460    *) # No idea.
20461       longdblinfbytes=$undef
20462       longdblnanbytes=$undef
20463       ;;
20464    esac
20465fi
20466# In case the program crashed the values are empty, turn them undef.
20467case "$doubleinfbytes" in
20468'') doubleinfbytes=$undef ;;
20469esac
20470case "$doublenanbytes" in
20471'') doublenanbytes=$undef ;;
20472esac
20473case "$longdblinfbytes" in
20474'') longdblinfbytes=$undef ;;
20475esac
20476case "$longdblnanbytes" in
20477'') longdblnanbytes=$undef ;;
20478esac
20479$rm_try
20480
20481: Check the length of the double mantissa
20482$echo "Checking how many mantissa bits your doubles have..." >&4
20483$cat >try.c <<EOP
20484#$i_sunmath I_SUNMATH
20485#include <float.h>
20486#ifdef I_SUNMATH
20487# include <sunmath.h>
20488#endif
20489#ifdef DBL_MANT_DIG
20490# define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20491#endif
20492#include <stdio.h>
20493int main(int argc, char *argv[]) {
20494#ifdef BITS
20495  printf("%d\n", BITS);
20496#endif
20497  return 0;
20498}
20499EOP
20500set try
20501if eval $compile; then
20502    doublemantbits=`$run ./try`
20503else
20504    doublemantbits="$undef"
20505fi
20506$rm_try
20507
20508: Check the length of the longdouble mantissa
20509$echo "Checking how many mantissa bits your long doubles have..." >&4
20510$cat >try.c <<EOP
20511#$i_sunmath I_SUNMATH
20512#include <float.h>
20513#ifdef I_SUNMATH
20514# include <sunmath.h>
20515#endif
20516#$d_longdbl HAS_LONG_DOUBLE
20517#if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20518# if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20519/* This format has no implicit bit.  Beware, however, that for
20520 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20521 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20522 * and the top bit must have been one since 387, zero is plain invalid.
20523 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20524#  define BITS LDBL_MANT_DIG
20525# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20526/* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20527 * reason e.g. Irix thinks 107.  But in any case, we want only
20528 * the number of real bits, the implicit bits are of no interest.  */
20529#  define BITS 2 * (DBL_MANT_DIG - 1)
20530# else
20531#  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20532# endif
20533#endif
20534#include <stdio.h>
20535int main(int argc, char *argv[]) {
20536#ifdef BITS
20537  printf("%d\n", BITS);
20538#endif
20539  return 0;
20540}
20541EOP
20542set try
20543if eval $compile; then
20544    longdblmantbits=`$run ./try`
20545else
20546    longdblmantbits="$undef"
20547fi
20548$rm_try
20549
20550: Check the length of the NV mantissa
20551$echo "Checking how many mantissa bits your NVs have..." >&4
20552if test "X$usequadmath" = "X$define"; then
20553  nvmantbits=112 # 128-1-15
20554else
20555  if test "X$nvsize" = "X$doublesize"; then
20556    nvmantbits="$doublemantbits"
20557  else
20558     if test "X$nvsize" = "X$longdblsize"; then
20559       nvmantbits="$longdblmantbits"
20560     else
20561       nvmantbits="$undef"
20562     fi
20563  fi
20564fi
20565
20566: How can we generate normalized random numbers ?
20567echo " "
20568echo "Using our internal random number implementation..." >&4
20569
20570case "$ccflags" in
20571*-Dmy_rand=*|*-Dmy_srand=*)
20572	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20573	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20574	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20575	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20576	;;
20577esac
20578
20579randfunc=Perl_drand48
20580drand01="Perl_drand48()"
20581seedfunc="Perl_drand48_init"
20582randbits=48
20583randseedtype=U32
20584
20585: Probe whether dtrace builds an object, as newer Illumos requires an input
20586: object file that uses at least one of the probes defined in the .d file
20587case "$usedtrace" in
20588$define)
20589    case "$dtracexnolibs" in
20590    $define|true|[yY]*)
20591        dtracexnolibs=$define
20592	$dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20593	;;
20594    ' '|'')
20595        if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20596	     dtracexnolibs=$define
20597	     echo "Your dtrace accepts -xnolibs"
20598	elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20599	     dtracexnolibs=$undef
20600	     echo "Your dtrace doesn't accept -xnolibs"
20601	else
20602             echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20603	     exit 1
20604	fi
20605	;;
20606    *)
20607        dtracexnolibs=$undef
20608	$dtrace -h -s ../perldtrace.d -o perldtrace.h
20609	;;
20610    esac
20611    case $dtracexnolibs in
20612    $define) xnolibs=-xnolibs ;;
20613    *) xnolibs= ;;
20614    esac
20615
20616    case "$dtraceobject" in
20617    $define|true|[yY]*)
20618        dtraceobject=$define
20619        ;;
20620    ' '|'')
20621        $cat >try.c <<EOM
20622#include "perldtrace.h"
20623int main(void) {
20624    PERL_LOADED_FILE("dummy");
20625    return 0;
20626}
20627EOM
20628        dtraceobject=$undef
20629        if $cc -c -o try.o $optimize $ccflags try.c \
20630                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20631                dtraceobject=$define
20632            echo "Your dtrace builds an object file"
20633        fi
20634        ;;
20635    *) dtraceobject=$undef ;;
20636    esac
20637    $rm_try perldtrace.o perldtrace.h
20638esac
20639
20640: Determine if this is an EBCDIC system
20641echo " "
20642echo "Determining whether or not we are on an EBCDIC system..." >&4
20643$cat >try.c <<'EOM'
20644int main()
20645{
20646  if ('M'==0xd4) return 0;
20647  return 1;
20648}
20649EOM
20650
20651val=$undef
20652set try
20653if eval $compile_ok; then
20654	if $run ./try; then
20655		echo "You seem to speak EBCDIC." >&4
20656		val="$define"
20657	else
20658		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20659	fi
20660else
20661	echo "I'm unable to compile the test program." >&4
20662	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20663fi
20664$rm_try
20665set ebcdic
20666eval $setvar
20667
20668: Check how to flush
20669echo " "
20670$cat >&4 <<EOM
20671Checking how to flush all pending stdio output...
20672EOM
20673# I only know how to find the first 32 possibly open files on SunOS.
20674# See also hints/sunos_4_1.sh and util.c  --AD
20675case "$osname" in
20676sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20677esac
20678$cat >>try.c <<EOCP
20679#include <stdio.h>
20680#$i_stdlib I_STDLIB
20681#ifdef I_STDLIB
20682#include <stdlib.h>
20683#endif
20684#$i_unistd I_UNISTD
20685#ifdef I_UNISTD
20686# include <unistd.h>
20687#endif
20688#$d_sysconf HAS_SYSCONF
20689#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20690#ifdef HAS_STDIO_STREAM_ARRAY
20691# define STDIO_STREAM_ARRAY $stdio_stream_array
20692#endif
20693int main() {
20694  FILE* p;
20695  unlink("try.out");
20696  p = fopen("try.out", "w");
20697#ifdef TRY_FPUTC
20698  fputc('x', p);
20699#else
20700# ifdef TRY_FPRINTF
20701  fprintf(p, "x");
20702# endif
20703#endif
20704#ifdef TRY_FFLUSH_NULL
20705  fflush(NULL);
20706#endif
20707#ifdef TRY_FFLUSH_ALL
20708  {
20709    long open_max = -1;
20710# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20711    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20712# else
20713#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20714    open_max = sysconf(_SC_OPEN_MAX);
20715#  else
20716#   ifdef FOPEN_MAX
20717    open_max = FOPEN_MAX;
20718#   else
20719#    ifdef OPEN_MAX
20720    open_max = OPEN_MAX;
20721#    else
20722#     ifdef _NFILE
20723    open_max = _NFILE;
20724#     endif
20725#    endif
20726#   endif
20727#  endif
20728# endif
20729# ifdef HAS_STDIO_STREAM_ARRAY
20730    if (open_max > 0) {
20731      long i;
20732      for (i = 0; i < open_max; i++)
20733	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20734		STDIO_STREAM_ARRAY[i]._file < open_max &&
20735		STDIO_STREAM_ARRAY[i]._flag)
20736		fflush(&STDIO_STREAM_ARRAY[i]);
20737    }
20738  }
20739# endif
20740#endif
20741  _exit(42);
20742}
20743EOCP
20744: first we have to find out how _not_ to flush
20745$to try.c
20746if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20747    output=''
20748    set try -DTRY_FPUTC
20749    if eval $compile; then
20750	    $run ./try 2>/dev/null
20751	    code="$?"
20752	    $from try.out
20753	    if $test ! -s try.out -a "X$code" = X42; then
20754		output=-DTRY_FPUTC
20755	    fi
20756    fi
20757    case "$output" in
20758    '')
20759	    set try -DTRY_FPRINTF
20760	    if eval $compile; then
20761		    $run ./try 2>/dev/null
20762		    code="$?"
20763		    $from try.out
20764		    if $test ! -s try.out -a "X$code" = X42; then
20765			output=-DTRY_FPRINTF
20766		    fi
20767	    fi
20768	;;
20769    esac
20770fi
20771: check for fflush NULL behavior
20772case "$fflushNULL" in
20773'')	set try -DTRY_FFLUSH_NULL $output
20774	if eval $compile; then
20775		$run ./try 2>/dev/null
20776		code="$?"
20777		$from try.out
20778		if $test -s try.out -a "X$code" = X42; then
20779			fflushNULL="`$cat try.out`"
20780		else
20781			if $test "X$code" != X42; then
20782				$cat >&4 <<EOM
20783(If this test failed, don't worry, we'll try another method shortly.)
20784EOM
20785			fi
20786		fi
20787	fi
20788	$rm -f core try.core core.try.*
20789	case "$fflushNULL" in
20790	x)	$cat >&4 <<EOM
20791Your fflush(NULL) works okay for output streams.
20792Let's see if it clobbers input pipes...
20793EOM
20794# As of mid-March 2000 all versions of Solaris appear to have a stdio
20795# bug that improperly flushes the input end of pipes.  So we avoid the
20796# autoflush on fork/system/exec support for now. :-(
20797$cat >tryp.c <<EOCP
20798#include <stdio.h>
20799int
20800main(int argc, char **argv)
20801{
20802    char buf[1024];
20803    int i;
20804    char *bp = buf;
20805    while (1) {
20806	while ((i = getc(stdin)) != -1
20807	       && (*bp++ = i) != '\n'
20808	       && bp < &buf[1024])
20809	/* DO NOTHING */ ;
20810	*bp = '\0';
20811	fprintf(stdout, "%s", buf);
20812	fflush(NULL);
20813	if (i == -1)
20814	    return 0;
20815	bp = buf;
20816    }
20817}
20818EOCP
20819		fflushNULL="$define"
20820		set tryp
20821		if eval $compile; then
20822		    $rm -f tryp.out
20823		    # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20824		    if $test "X$targethost" != X; then
20825			$to tryp.c
20826			$to tryp
20827			$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20828		    else
20829			$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20830		    fi
20831		    if cmp tryp.c tryp.out >/dev/null 2>&1; then
20832		       $cat >&4 <<EOM
20833fflush(NULL) seems to behave okay with input streams.
20834EOM
20835			fflushNULL="$define"
20836		    else
20837			$cat >&4 <<EOM
20838Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20839EOM
20840			fflushNULL="$undef"
20841		    fi
20842		fi
20843		$rm -f core tryp.c tryp.core core.tryp.*
20844		;;
20845	'')	$cat >&4 <<EOM
20846Your fflush(NULL) isn't working (contrary to ANSI C).
20847EOM
20848		fflushNULL="$undef"
20849		;;
20850	*)	$cat >&4 <<EOM
20851Cannot figure out whether your fflush(NULL) works or not.
20852I'm assuming it doesn't (contrary to ANSI C).
20853EOM
20854		fflushNULL="$undef"
20855		;;
20856	esac
20857	;;
20858$define|true|[yY]*)
20859	fflushNULL="$define"
20860	;;
20861*)
20862	fflushNULL="$undef"
20863	;;
20864esac
20865: check explicit looping only if NULL did not work, and if the pipe
20866: bug does not show up on an explicit flush too
20867case "$fflushNULL" in
20868"$undef")
20869	$cat >tryp.c <<EOCP
20870#include <stdio.h>
20871int
20872main(int argc, char **argv)
20873{
20874    char buf[1024];
20875    int i;
20876    char *bp = buf;
20877    while (1) {
20878	while ((i = getc(stdin)) != -1
20879	       && (*bp++ = i) != '\n'
20880	       && bp < &buf[1024])
20881	/* DO NOTHING */ ;
20882	*bp = '\0';
20883	fprintf(stdout, "%s", buf);
20884	fflush(stdin);
20885	if (i == -1)
20886	    return 0;
20887	bp = buf;
20888    }
20889}
20890EOCP
20891	set tryp
20892	if eval $compile; then
20893	    $rm -f tryp.out
20894	    if $test "X$targethost" != X; then
20895		$to tryp.c
20896		$to tryp
20897		$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20898	    else
20899		$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20900	    fi
20901	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
20902	       $cat >&4 <<EOM
20903Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20904EOM
20905		: now check for fflushall behaviour
20906		case "$fflushall" in
20907		'')	set try -DTRY_FFLUSH_ALL $output
20908			if eval $compile; then
20909				$cat >&4 <<EOM
20910(Now testing the other method--but note that this also may fail.)
20911EOM
20912				$run ./try 2>/dev/null
20913				code=$?
20914				$from try.out
20915				if $test -s try.out -a "X$code" = X42; then
20916					fflushall="`$cat try.out`"
20917				fi
20918			fi
20919			$rm_try
20920			case "$fflushall" in
20921			x)	$cat >&4 <<EOM
20922Whew. Flushing explicitly all the stdio streams works.
20923EOM
20924				fflushall="$define"
20925				;;
20926			'')	$cat >&4 <<EOM
20927Sigh. Flushing explicitly all the stdio streams doesn't work.
20928EOM
20929				fflushall="$undef"
20930				;;
20931			*)	$cat >&4 <<EOM
20932Cannot figure out whether flushing stdio streams explicitly works or not.
20933I'm assuming it doesn't.
20934EOM
20935				fflushall="$undef"
20936				;;
20937			esac
20938			;;
20939		"$define"|true|[yY]*)
20940			fflushall="$define"
20941			;;
20942		*)
20943			fflushall="$undef"
20944			;;
20945		esac
20946	    else
20947		$cat >&4 <<EOM
20948All is futile.  Even fflush(stdin) clobbers input pipes!
20949EOM
20950		fflushall="$undef"
20951	    fi
20952	else
20953	    fflushall="$undef"
20954	fi
20955	$rm -f core tryp.c tryp.core core.tryp.*
20956	;;
20957*)	fflushall="$undef"
20958	;;
20959esac
20960
20961case "$fflushNULL$fflushall" in
20962undefundef)
20963	$cat <<EOM
20964OK, I give up.  I cannot figure out how to flush pending stdio output.
20965We won't be flushing handles at all before fork/exec/popen.
20966EOM
20967	;;
20968esac
20969$rm_try tryp
20970
20971: Store the full pathname to the ar program for use in the C program
20972: Respect a hint or command line value for full_ar.
20973case "$full_ar" in
20974'') full_ar=$ar ;;
20975esac
20976
20977: Store the full pathname to the sed program for use in the C program
20978full_sed=$sed
20979
20980: see what type gids are declared as in the kernel
20981echo " "
20982echo "Looking for the type for group ids returned by getgid()."
20983set gid_t gidtype xxx stdio.h sys/types.h
20984eval $typedef
20985case "$gidtype" in
20986xxx)
20987	xxx=`./findhdr sys/user.h`
20988	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20989	case $1 in
20990	unsigned) dflt="$1 $2" ;;
20991	*) dflt="$1" ;;
20992	esac
20993	;;
20994*) dflt="$gidtype";;
20995esac
20996case "$gidtype" in
20997gid_t) echo "gid_t found." ;;
20998*)	rp="What is the type for group ids returned by getgid()?"
20999	. ./myread
21000	gidtype="$ans"
21001	;;
21002esac
21003
21004: Check the size of GID
21005echo " "
21006case "$gidtype" in
21007*_t) zzz="$gidtype"	;;
21008*)   zzz="gid"		;;
21009esac
21010echo "Checking the size of $zzz..." >&4
21011cat > try.c <<EOCP
21012#include <sys/types.h>
21013#include <stdio.h>
21014#$i_stdlib I_STDLIB
21015#ifdef I_STDLIB
21016#include <stdlib.h>
21017#endif
21018int main() {
21019    printf("%d\n", (int)sizeof($gidtype));
21020    exit(0);
21021}
21022EOCP
21023set try
21024if eval $compile_ok; then
21025	yyy=`$run ./try`
21026	case "$yyy" in
21027	'')	gidsize=4
21028		echo "(I can't execute the test program--guessing $gidsize.)" >&4
21029		;;
21030	*)	gidsize=$yyy
21031		echo "Your $zzz is $gidsize bytes long."
21032		;;
21033	esac
21034else
21035	gidsize=4
21036	echo "(I can't compile the test program--guessing $gidsize.)" >&4
21037fi
21038
21039: Check if GID is signed
21040echo " "
21041case "$gidtype" in
21042*_t) zzz="$gidtype"	;;
21043*)   zzz="gid"		;;
21044esac
21045echo "Checking the sign of $zzz..." >&4
21046cat > try.c <<EOCP
21047#include <sys/types.h>
21048#include <stdio.h>
21049int main() {
21050	$gidtype foo = -1;
21051	if (foo < 0)
21052		printf("-1\n");
21053	else
21054		printf("1\n");
21055}
21056EOCP
21057set try
21058if eval $compile; then
21059	yyy=`$run ./try`
21060	case "$yyy" in
21061	'')	gidsign=1
21062		echo "(I can't execute the test program--guessing unsigned.)" >&4
21063		;;
21064	*)	gidsign=$yyy
21065		case "$gidsign" in
21066		 1) echo "Your $zzz is unsigned." ;;
21067		-1) echo "Your $zzz is signed."   ;;
21068		esac
21069		;;
21070	esac
21071else
21072	gidsign=1
21073	echo "(I can't compile the test program--guessing unsigned.)" >&4
21074fi
21075
21076: Check 64bit sizes
21077echo " "
21078
21079if $test X"$quadtype" != X; then
21080
21081echo "Checking how to print 64-bit integers..." >&4
21082
21083if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21084	$cat >try.c <<'EOCP'
21085#include <sys/types.h>
21086#include <stdio.h>
21087int main() {
21088  int q = 12345678901;
21089  printf("%ld\n", q);
21090}
21091EOCP
21092	set try
21093	if eval $compile; then
21094		yyy=`$run ./try`
21095		case "$yyy" in
21096		12345678901)
21097			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21098			sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21099			echo "We will use %d."
21100			;;
21101		esac
21102	fi
21103fi
21104
21105if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21106	$cat >try.c <<'EOCP'
21107#include <sys/types.h>
21108#include <stdio.h>
21109int main() {
21110  long q = 12345678901;
21111  printf("%ld\n", q);
21112}
21113EOCP
21114	set try
21115	if eval $compile; then
21116		yyy=`$run ./try`
21117		case "$yyy" in
21118		12345678901)
21119			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21120			sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21121			echo "We will use %ld."
21122			;;
21123		esac
21124	fi
21125fi
21126
21127if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21128	$cat >try.c <<'EOCP'
21129#include <sys/types.h>
21130#include <inttypes.h>
21131#include <stdio.h>
21132int main() {
21133  int64_t q = 12345678901;
21134  printf("%" PRId64 "\n", q);
21135}
21136EOCP
21137	set try
21138	if eval $compile; then
21139		yyy=`$run ./try`
21140		case "$yyy" in
21141		12345678901)
21142			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21143			sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21144			echo "We will use the C9X style."
21145			;;
21146		esac
21147	fi
21148fi
21149
21150if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21151	$cat >try.c <<EOCP
21152#include <sys/types.h>
21153#include <stdio.h>
21154int main() {
21155  $quadtype q = 12345678901;
21156  printf("%Ld\n", q);
21157}
21158EOCP
21159	set try
21160	if eval $compile; then
21161		yyy=`$run ./try`
21162		case "$yyy" in
21163		12345678901)
21164			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21165			sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21166			echo "We will use %Ld."
21167			;;
21168		esac
21169	fi
21170fi
21171
21172if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21173	$cat >try.c <<'EOCP'
21174#include <sys/types.h>
21175#include <stdio.h>
21176int main() {
21177  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21178  printf("%lld\n", q);
21179}
21180EOCP
21181	set try
21182	if eval $compile; then
21183		yyy=`$run ./try`
21184		case "$yyy" in
21185		12345678901)
21186			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21187			sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21188			echo "We will use the %lld style."
21189			;;
21190		esac
21191	fi
21192fi
21193
21194if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21195	$cat >try.c <<EOCP
21196#include <sys/types.h>
21197#include <stdio.h>
21198int main() {
21199  $quadtype q = 12345678901;
21200  printf("%qd\n", q);
21201}
21202EOCP
21203	set try
21204	if eval $compile; then
21205		yyy=`$run ./try`
21206		case "$yyy" in
21207		12345678901)
21208			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21209			sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21210			echo "We will use %qd."
21211			;;
21212		esac
21213	fi
21214fi
21215
21216if $test X"$sPRId64" = X; then
21217	echo "Cannot figure out how to print 64-bit integers." >&4
21218fi
21219$rm_try
21220
21221fi
21222
21223case "$sPRId64" in
21224'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21225	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21226	;;
21227*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21228	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21229	;;
21230esac
21231
21232: Check format strings for internal types
21233echo " "
21234$echo "Checking the format strings to be used for Perl's internal types..." >&4
21235
21236if $test X"$ivsize" = X8; then
21237	ivdformat="$sPRId64"
21238	uvuformat="$sPRIu64"
21239	uvoformat="$sPRIo64"
21240	uvxformat="$sPRIx64"
21241	uvXUformat="$sPRIXU64"
21242else
21243	if $test X"$ivsize" = X"$longsize"; then
21244		ivdformat='"ld"'
21245		uvuformat='"lu"'
21246		uvoformat='"lo"'
21247		uvxformat='"lx"'
21248		uvXUformat='"lX"'
21249	else
21250		if $test X"$ivsize" = X"$intsize"; then
21251			ivdformat='"d"'
21252			uvuformat='"u"'
21253			uvoformat='"o"'
21254			uvxformat='"x"'
21255			uvXUformat='"X"'
21256		else
21257			: far out
21258			if $test X"$ivsize" = X"$shortsize"; then
21259				ivdformat='"hd"'
21260				uvuformat='"hu"'
21261				uvoformat='"ho"'
21262				uvxformat='"hx"'
21263				uvXUformat='"hX"'
21264			fi
21265		fi
21266	fi
21267fi
21268
21269if $test X"$usequadmath" = X"$define"; then
21270    nveformat='"Qe"'
21271    nvfformat='"Qf"'
21272    nvgformat='"Qg"'
21273    nvEUformat='"QE"'
21274    nvFUformat='"QF"'
21275    nvGUformat='"QG"'
21276else
21277    if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21278	nveformat="$sPRIeldbl"
21279	nvfformat="$sPRIfldbl"
21280	nvgformat="$sPRIgldbl"
21281	nvEUformat="$sPRIEUldbl"
21282	nvFUformat="$sPRIFUldbl"
21283	nvGUformat="$sPRIGUldbl"
21284    else
21285	nveformat='"e"'
21286	nvfformat='"f"'
21287	nvgformat='"g"'
21288	nvEUformat='"E"'
21289	nvFUformat='"F"'
21290	nvGUformat='"G"'
21291    fi
21292fi
21293
21294case "$ivdformat" in
21295'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21296    exit 1
21297    ;;
21298esac
21299
21300: Check format string for GID
21301
21302echo " "
21303$echo "Checking the format string to be used for gids..." >&4
21304
21305case "$gidsign" in
21306-1)	if $test X"$gidsize" = X"$ivsize"; then
21307		gidformat="$ivdformat"
21308	else
21309		if $test X"$gidsize" = X"$longsize"; then
21310			gidformat='"ld"'
21311		else
21312			if $test X"$gidsize" = X"$intsize"; then
21313				gidformat='"d"'
21314			else
21315				if $test X"$gidsize" = X"$shortsize"; then
21316					gidformat='"hd"'
21317				fi
21318			fi
21319		fi
21320	fi
21321	;;
21322*)	if $test X"$gidsize" = X"$uvsize"; then
21323		gidformat="$uvuformat"
21324	else
21325		if $test X"$gidsize" = X"$longsize"; then
21326			gidformat='"lu"'
21327		else
21328			if $test X"$gidsize" = X"$intsize"; then
21329				gidformat='"u"'
21330			else
21331				if $test X"$gidsize" = X"$shortsize"; then
21332					gidformat='"hu"'
21333				fi
21334			fi
21335		fi
21336	fi
21337	;;
21338esac
21339
21340: see if getgroups exists
21341set getgroups d_getgrps
21342eval $inlibc
21343
21344: see if setgroups exists
21345set setgroups d_setgrps
21346eval $inlibc
21347
21348: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21349echo " "
21350case "$d_getgrps$d_setgrps" in
21351*define*)
21352	case "$groupstype" in
21353	'') dflt="$gidtype" ;;
21354	*)  dflt="$groupstype" ;;
21355	esac
21356	$cat <<EOM
21357What type of pointer is the second argument to getgroups() and setgroups()?
21358Usually this is the same as group ids, $gidtype, but not always.
21359
21360EOM
21361	rp='What type pointer is the second argument to getgroups() and setgroups()?'
21362	. ./myread
21363	groupstype="$ans"
21364	;;
21365*)  groupstype="$gidtype";;
21366esac
21367
21368: check whether make sets MAKE
21369echo " "
21370echo "Checking if your $make program sets \$(MAKE)..." >&4
21371case "$make_set_make" in
21372'')
21373	$sed 's/^X //' > testmake.mak << 'EOF'
21374Xall:
21375X 	@echo 'maketemp="$(MAKE)"'
21376EOF
21377	case "`$make -f testmake.mak 2>/dev/null`" in
21378	*maketemp=*) make_set_make='#' ;;
21379	*)	make_set_make="MAKE=$make" ;;
21380	esac
21381	$rm -f testmake.mak
21382	;;
21383esac
21384case "$make_set_make" in
21385'#') echo "Yup, it does.";;
21386*) echo "Nope, it doesn't.";;
21387esac
21388
21389: see what type is used for mode_t
21390rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21391set mode_t modetype int stdio.h sys/types.h
21392eval $typedef_ask
21393
21394: see if we need va_copy
21395echo " "
21396$cat >try.c <<EOCP
21397#include <stdarg.h>
21398#include <stdio.h>
21399#include <stdlib.h>
21400#include <signal.h>
21401
21402int
21403ivfprintf(FILE *f, const char *fmt, va_list *valp)
21404{
21405  return vfprintf(f, fmt, *valp);
21406}
21407
21408int
21409myvfprintf(FILE *f, const  char *fmt, va_list val)
21410{
21411  return ivfprintf(f, fmt, &val);
21412}
21413
21414int
21415myprintf(char *fmt, ...)
21416{
21417  va_list val;
21418  va_start(val, fmt);
21419  return myvfprintf(stdout, fmt, val);
21420}
21421
21422int
21423main(int ac, char **av)
21424{
21425  signal(SIGSEGV, exit);
21426
21427  myprintf("%s%cs all right, then\n", "that", '\'');
21428  exit(0);
21429}
21430EOCP
21431set try
21432if eval $compile && $run ./try 2>&1 >/dev/null; then
21433	case "`$run ./try`" in
21434	"that's all right, then")
21435		okay=yes
21436		;;
21437	esac
21438fi
21439case "$okay" in
21440yes)	echo "It seems that you don't need va_copy()." >&4
21441	need_va_copy="$undef"
21442	;;
21443*)	echo "It seems that va_copy() or similar will be needed." >&4
21444	need_va_copy="$define"
21445	;;
21446esac
21447$rm_try
21448
21449: see what type is used for size_t
21450rp="What is the type used for the length parameter for string functions?"
21451set size_t sizetype 'unsigned int' stdio.h sys/types.h
21452eval $typedef_ask
21453
21454: check for type of arguments to gethostbyaddr.
21455if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21456	case "$d_gethbyaddr" in
21457	$define)
21458		$cat <<EOM
21459
21460Checking to see what type of arguments are accepted by gethostbyaddr().
21461EOM
21462		hdrs="$define sys/types.h
21463			$d_socket sys/socket.h
21464			$i_niin netinet/in.h
21465			$i_netdb netdb.h
21466			$i_unistd unistd.h"
21467		: The first arg can 'char *' or 'void *'
21468		: The second arg is some of integral type
21469		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21470			for yyy in size_t long int; do
21471				case "$netdb_host_type" in
21472				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21473					if ./protochk "$try" $hdrs; then
21474						echo "Your system accepts $xxx for the first arg."
21475						echo "...and $yyy for the second arg."
21476						netdb_host_type="$xxx"
21477						netdb_hlen_type="$yyy"
21478					fi
21479					;;
21480				esac
21481			done
21482		done
21483		: In case none of those worked, prompt the user.
21484		case "$netdb_host_type" in
21485		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
21486			dflt='char *'
21487			. ./myread
21488			netdb_host_type=$ans
21489			rp='What is the type for the 2nd argument to gethostbyaddr?'
21490			dflt="$sizetype"
21491			. ./myread
21492			netdb_hlen_type=$ans
21493			;;
21494		esac
21495		;;
21496	*)	: no gethostbyaddr, so pick harmless defaults
21497		netdb_host_type='char *'
21498		netdb_hlen_type="$sizetype"
21499		;;
21500	esac
21501	# Remove the "const" if needed. -- but then we'll have a
21502	# prototype clash!
21503	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21504fi
21505
21506: check for type of argument to gethostbyname.
21507if test "X$netdb_name_type" = X ; then
21508	case "$d_gethbyname" in
21509	$define)
21510		$cat <<EOM
21511
21512Checking to see what type of argument is accepted by gethostbyname().
21513EOM
21514		hdrs="$define sys/types.h
21515			$d_socket sys/socket.h
21516			$i_niin netinet/in.h
21517			$i_netdb netdb.h
21518			$i_unistd unistd.h"
21519		for xxx in "const char *" "char *"; do
21520			case "$netdb_name_type" in
21521			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
21522				if ./protochk "$try" $hdrs; then
21523					echo "Your system accepts $xxx."
21524					netdb_name_type="$xxx"
21525				fi
21526				;;
21527			esac
21528		done
21529		: In case none of those worked, prompt the user.
21530		case "$netdb_name_type" in
21531		'')	rp='What is the type for the 1st argument to gethostbyname?'
21532			dflt='char *'
21533			. ./myread
21534			netdb_name_type=$ans
21535			;;
21536		esac
21537		;;
21538	*)	: no gethostbyname, so pick harmless default
21539		netdb_name_type='char *'
21540		;;
21541	esac
21542fi
21543
21544: check for type of 1st argument to getnetbyaddr.
21545if test "X$netdb_net_type" = X ; then
21546	case "$d_getnbyaddr" in
21547	$define)
21548		$cat <<EOM
21549
21550Checking to see what type of 1st argument is accepted by getnetbyaddr().
21551EOM
21552		hdrs="$define sys/types.h
21553			$d_socket sys/socket.h
21554			$i_niin netinet/in.h
21555			$i_netdb netdb.h
21556			$i_unistd unistd.h"
21557		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21558			case "$netdb_net_type" in
21559			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21560				if ./protochk "$try" $hdrs; then
21561					echo "Your system accepts $xxx."
21562					netdb_net_type="$xxx"
21563				fi
21564				;;
21565			esac
21566		done
21567		: In case none of those worked, prompt the user.
21568		case "$netdb_net_type" in
21569		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
21570			dflt='long'
21571			. ./myread
21572			netdb_net_type=$ans
21573			;;
21574		esac
21575		;;
21576	*)	: no getnetbyaddr, so pick harmless default
21577		netdb_net_type='long'
21578		;;
21579	esac
21580fi
21581: locate the preferred pager for this system
21582fn=f/
21583case "$pager" in
21584'')
21585	dflt=''
21586	case "$pg" in
21587	/*) dflt=$pg;;
21588	[a-zA-Z]:/*) dflt=$pg;;
21589	esac
21590	case "$more" in
21591	/*) dflt=$more;;
21592	[a-zA-Z]:/*) dflt=$more;;
21593	esac
21594	case "$less" in
21595	/*) dflt=$less;;
21596	[a-zA-Z]:/*) dflt=$less;;
21597	esac
21598	case "$dflt" in
21599	'') dflt=/usr/ucb/more;;
21600	esac
21601	;;
21602*)	dflt="$pager"
21603	;;
21604esac
21605fn="f/($dflt)"
21606echo " "
21607rp='What pager is used on your system?'
21608. ./getfile
21609pager="$ans"
21610
21611: see if ar generates random libraries by itself
21612echo " "
21613echo "Checking how to generate random libraries on your machine..." >&4
21614echo 'int bar1() { return bar2(); }' > bar1.c
21615echo 'int bar2() { return 2; }' > bar2.c
21616$cat > foo.c <<EOP
21617#$i_stdlib I_STDLIB
21618#ifdef I_STDLIB
21619#include <stdlib.h>
21620#endif
21621int main() { printf("%d\n", bar1()); exit(0); }
21622EOP
21623$cc $ccflags -c bar1.c >/dev/null 2>&1
21624$cc $ccflags -c bar2.c >/dev/null 2>&1
21625$cc $ccflags -c foo.c >/dev/null 2>&1
21626$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21627if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21628	$run ./foobar >/dev/null 2>&1; then
21629	echo "$ar appears to generate random libraries itself."
21630	orderlib=false
21631	if [ "X$ranlib" = "X" ]; then
21632	    ranlib=":"
21633	fi
21634elif $ar s bar$_a >/dev/null 2>&1 &&
21635	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21636	$run ./foobar >/dev/null 2>&1; then
21637		echo "a table of contents needs to be added with '$ar s'."
21638		orderlib=false
21639		ranlib="$ar s"
21640elif $ar ts bar$_a >/dev/null 2>&1 &&
21641	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21642	$run ./foobar >/dev/null 2>&1; then
21643		echo "a table of contents needs to be added with '$ar ts'."
21644		orderlib=false
21645		ranlib="$ar ts"
21646else
21647	case "$ranlib" in
21648	:) ranlib='';;
21649	'')
21650		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21651		$test -f $ranlib || ranlib=''
21652		;;
21653	esac
21654	if $test -n "$ranlib"; then
21655		echo "your system has '$ranlib'; we'll use that."
21656		orderlib=false
21657	else
21658		echo "your system doesn't seem to support random libraries"
21659		echo "so we'll use lorder and tsort to order the libraries."
21660		orderlib=true
21661		ranlib=":"
21662	fi
21663fi
21664$rm -f foo* bar*
21665
21666: Check the max offset that gmtime and localtime accept
21667echo "Checking max offsets that gmtime () accepts"
21668
21669case "$sGMTIME_min/$sGMTIME_max" in
21670    0/0|/)
21671	$cat >try.c <<EOCP
21672#include <sys/types.h>
21673#include <stdio.h>
21674#include <time.h>
21675
21676int i;
21677struct tm *tmp;
21678time_t pt;
21679
21680void gm_check (time_t t, int min_year, int max_year)
21681{
21682    tmp = gmtime (&t);
21683    if ( tmp == NULL ||
21684	/* Check tm_year overflow */
21685	 tmp->tm_year < min_year || tmp->tm_year > max_year)
21686	tmp = NULL;
21687    else
21688	pt = t;
21689    } /* gm_check */
21690
21691int check_max ()
21692{
21693    tmp = NULL;
21694    pt  = 0;
21695#ifdef MAXLONG
21696    gm_check (MAXLONG, 69, 0x7fffffff);
21697#endif
21698    if (tmp == NULL || tmp->tm_year < 0) {
21699	for (i = 63; i >= 0; i--) {
21700	    time_t x = pt | ((time_t)1 << i);
21701	    if (x < 0 || x < pt) continue;
21702	    gm_check (x, 69, 0x7fffffff);
21703	    }
21704	}
21705    printf ("sGMTIME_max=%ld\n", pt);
21706    return (0);
21707    } /* check_max */
21708
21709int check_min ()
21710{
21711    tmp = NULL;
21712    pt  = 0;
21713#ifdef MINLONG
21714    gm_check (MINLONG, -1900, 70);
21715#endif
21716    if (tmp == NULL) {
21717	for (i = 36; i >= 0; i--) {
21718	    time_t x = pt - ((time_t)1 << i);
21719	    if (x > 0) continue;
21720	    gm_check (x, -1900, 70);
21721	    }
21722	}
21723    printf ("sGMTIME_min=%ld\n", pt);
21724    return (0);
21725    } /* check_min */
21726
21727int main (int argc, char *argv[])
21728{
21729    /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21730    check_max ();
21731    check_min ();
21732    return (0);
21733    } /* main */
21734EOCP
21735	set try
21736	if eval $compile; then
21737	    eval `$run ./try 2>/dev/null`
21738	else
21739	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21740	    fi
21741	$rm_try
21742	;;
21743    esac
21744
21745echo "Checking max offsets that localtime () accepts"
21746
21747case "$sLOCALTIME_min/$sLOCALTIME_max" in
21748    0/0|/)
21749	$cat >try.c <<EOCP
21750#include <sys/types.h>
21751#include <stdio.h>
21752#include <time.h>
21753
21754int i;
21755struct tm *tmp;
21756time_t pt;
21757
21758void local_check (time_t t, int min_year, int max_year)
21759{
21760    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21761	tmp = NULL;
21762    else
21763	tmp = localtime (&t);
21764    if ( tmp == NULL ||
21765	/* Check tm_year overflow */
21766	 tmp->tm_year < min_year || tmp->tm_year > max_year)
21767	tmp = NULL;
21768    else
21769	pt = t;
21770    } /* local_check */
21771
21772int check_max ()
21773{
21774    tmp = NULL;
21775    pt  = 0;
21776#ifdef MAXLONG
21777    local_check (MAXLONG, 69, 0x7fffffff);
21778#endif
21779    if (tmp == NULL || tmp->tm_year < 0) {
21780	for (i = 63; i >= 0; i--) {
21781	    time_t x = pt | ((time_t)1 << i);
21782	    if (x < 0 || x < pt) continue;
21783	    local_check (x, 69, 0x7fffffff);
21784	    }
21785	}
21786    printf ("sLOCALTIME_max=%ld\n", pt);
21787    return (0);
21788   } /* check_max */
21789
21790int check_min ()
21791{
21792    tmp = NULL;
21793    pt  = 0;
21794#ifdef MINLONG
21795    local_check (MINLONG, -1900, 70);
21796#endif
21797    if (tmp == NULL) {
21798	for (i = 36; i >= 0; i--) {
21799	    time_t x = pt - ((time_t)1 << i);
21800	    if (x > 0) continue;
21801	    local_check (x, -1900, 70);
21802	    }
21803	}
21804    printf ("sLOCALTIME_min=%ld\n", pt);
21805    return (0);
21806    } /* check_min */
21807
21808int main (int argc, char *argv[])
21809{
21810    check_max ();
21811    check_min ();
21812    return (0);
21813    } /* main */
21814EOCP
21815	set try
21816	if eval $compile; then
21817	    eval `$run ./try 2>/dev/null`
21818	else
21819	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21820	    fi
21821	$rm_try
21822	;;
21823    esac
21824
21825: check for type of arguments to select.
21826case "$selecttype" in
21827'') case "$d_select" in
21828	$define)
21829		echo " "
21830		$cat <<EOM
21831Checking to see what type of arguments are accepted by select().
21832EOM
21833		hdrs="$define sys/types.h
21834			$i_systime sys/time.h
21835			$i_sysselct sys/select.h
21836			$d_socket sys/socket.h"
21837		: The first arg can be int, unsigned, or size_t
21838		: The last arg may or may not be 'const'
21839		val=''
21840		: void pointer has been seen but using that
21841		: breaks the selectminbits test
21842		for xxx in 'fd_set *' 'int *'; do
21843			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21844				for tmo in 'struct timeval *' 'const struct timeval *'; do
21845					case "$val" in
21846					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21847						if ./protochk "$try" $hdrs; then
21848							echo "Your system accepts $xxx."
21849							val="$xxx"
21850						fi
21851						;;
21852					esac
21853				done
21854			done
21855		done
21856		case "$val" in
21857		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21858			case "$d_fd_set" in
21859				$define) dflt="fd_set *" ;;
21860				*)		dflt="int *" ;;
21861			esac
21862			. ./myread
21863			val=$ans
21864			;;
21865		esac
21866		selecttype="$val"
21867		;;
21868	*)	: no select, so pick a harmless default
21869		selecttype='int *'
21870		;;
21871	esac
21872	;;
21873esac
21874
21875: check for the select 'width'
21876case "$selectminbits" in
21877'') safebits=`expr $ptrsize \* 8`
21878    case "$d_select" in
21879	$define)
21880		$cat <<EOM
21881
21882Checking to see on how many bits at a time your select() operates...
21883EOM
21884		$cat >try.c <<EOCP
21885#include <sys/types.h>
21886#$i_time I_TIME
21887#$i_systime I_SYS_TIME
21888#$i_systimek I_SYS_TIME_KERNEL
21889#ifdef I_TIME
21890#   include <time.h>
21891#endif
21892#ifdef I_SYS_TIME
21893#   ifdef I_SYS_TIME_KERNEL
21894#	define KERNEL
21895#   endif
21896#   include <sys/time.h>
21897#   ifdef I_SYS_TIME_KERNEL
21898#	undef KERNEL
21899#   endif
21900#endif
21901#$i_sysselct I_SYS_SELECT
21902#ifdef I_SYS_SELECT
21903#include <sys/select.h>
21904#endif
21905#$d_socket HAS_SOCKET
21906#ifdef HAS_SOCKET
21907#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21908#endif
21909#include <stdio.h>
21910#$i_stdlib I_STDLIB
21911#ifdef I_STDLIB
21912#include <stdlib.h>
21913#endif
21914$selecttype b;
21915#define S sizeof(*(b))
21916#define MINBITS	64
21917#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21918#define NBITS  (NBYTES * 8)
21919int main() {
21920    char *s = (char *)malloc(NBYTES);
21921    struct timeval t;
21922    int i;
21923    FILE* fp;
21924    int fd;
21925
21926    if (!s)
21927	exit(1);
21928    fclose(stdin);
21929    fp = fopen("try.c", "r");
21930    if (fp == 0)
21931      exit(2);
21932    fd = fileno(fp);
21933    if (fd < 0)
21934      exit(3);
21935    b = ($selecttype)s;
21936    for (i = 0; i < NBITS; i++)
21937	FD_SET(i, b);
21938    t.tv_sec  = 0;
21939    t.tv_usec = 0;
21940    select(fd + 1, b, 0, 0, &t);
21941    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21942    free(s);
21943    printf("%d\n", i + 1);
21944    return 0;
21945}
21946EOCP
21947		set try
21948		if eval $compile_ok; then
21949			selectminbits=`$run ./try 2>/dev/null`
21950			case "$selectminbits" in
21951			'')	cat >&4 <<EOM
21952Cannot figure out on how many bits at a time your select() operates.
21953I'll play safe and guess it is $safebits bits.
21954EOM
21955				selectminbits=$safebits
21956				bits="$safebits bits"
21957				;;
21958			1)	bits="1 bit" ;;
21959			*)	bits="$selectminbits bits" ;;
21960			esac
21961			echo "Your select() operates on $bits at a time." >&4
21962		else
21963			rp='What is the minimum number of bits your select() operates on?'
21964			case "$byteorder" in
21965			12345678)	dflt=64 ;;
21966			1234)		dflt=32 ;;
21967			*)		dflt=1	;;
21968			esac
21969			. ./myread
21970			val=$ans
21971			selectminbits="$val"
21972		fi
21973		$rm_try
21974		;;
21975	*)	: no select, so pick a harmless default
21976		selectminbits=$safebits
21977		;;
21978	esac
21979	;;
21980esac
21981
21982: Trace out the files included by signal.h, then look for SIGxxx names.
21983case "$sig_num_init" in
21984'')
21985if [ "X$fieldn" = X ]; then
21986	: Just make some guesses.  We check them later.
21987	xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21988else
21989	xxx=`echo '#include <signal.h>' |
21990	$cppstdin $cppminus $cppflags 2>/dev/null |
21991	$grep '^[ 	]*#.*include' |
21992	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21993		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21994fi
21995xxxfiles=''
21996for xx in $xxx /dev/null ; do
21997	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
21998done
21999case "$xxxfiles" in
22000'')	xxxfiles=`./findhdr signal.h` ;;
22001esac
22002xxx=`awk '
22003$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22004	print substr($2, 4, 20)
22005}
22006$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22007	print substr($3, 4, 20)
22008}' $xxxfiles`
22009: Append some common names just in case the awk scan failed.
22010xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22011xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22012xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22013xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22014xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22015
22016: generate a few handy files for later
22017$cat > signal.c <<EOCP
22018#include <sys/types.h>
22019#include <signal.h>
22020#$i_stdlib I_STDLIB
22021#ifdef I_STDLIB
22022#include <stdlib.h>
22023#endif
22024#include <stdio.h>
22025int main() {
22026
22027/* Strange style to avoid deeply-nested #if/#else/#endif */
22028#ifndef NSIG
22029#  ifdef _NSIG
22030#    define NSIG (_NSIG)
22031#  endif
22032#endif
22033
22034#ifndef NSIG
22035#  ifdef SIGMAX
22036#    define NSIG (SIGMAX+1)
22037#  endif
22038#endif
22039
22040#ifndef NSIG
22041#  ifdef SIG_MAX
22042#    define NSIG (SIG_MAX+1)
22043#  endif
22044#endif
22045
22046#ifndef NSIG
22047#  ifdef _SIG_MAX
22048#    define NSIG (_SIG_MAX+1)
22049#  endif
22050#endif
22051
22052#ifndef NSIG
22053#  ifdef MAXSIG
22054#    define NSIG (MAXSIG+1)
22055#  endif
22056#endif
22057
22058#ifndef NSIG
22059#  ifdef MAX_SIG
22060#    define NSIG (MAX_SIG+1)
22061#  endif
22062#endif
22063
22064#ifndef NSIG
22065#  ifdef SIGARRAYSIZE
22066#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22067#  endif
22068#endif
22069
22070#ifndef NSIG
22071#  ifdef _sys_nsig
22072#    define NSIG (_sys_nsig) /* Solaris 2.5 */
22073#  endif
22074#endif
22075
22076/* Default to some arbitrary number that's big enough to get most
22077   of the common signals.
22078*/
22079#ifndef NSIG
22080#    define NSIG 50
22081#endif
22082
22083printf("NSIG %d\n", NSIG);
22084
22085#ifndef JUST_NSIG
22086
22087EOCP
22088
22089echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22090{
22091	printf "#ifdef SIG"; printf $1; printf "\n"
22092	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22093	printf $1; printf ");\n"
22094	printf "#endif\n"
22095}
22096END {
22097	printf "#endif /* JUST_NSIG */\n";
22098	printf "exit(0);\n}\n";
22099}
22100' >>signal.c
22101$cat >signal.awk <<'EOP'
22102BEGIN { ndups = 0 }
22103$1 ~ /^NSIG$/ { nsig = $2 }
22104($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22105    if ($2 > maxsig) { maxsig = $2 }
22106    if (sig_name[$2]) {
22107	dup_name[ndups] = $1
22108	dup_num[ndups] = $2
22109	ndups++
22110    }
22111    else {
22112	sig_name[$2] = $1
22113	sig_num[$2] = $2
22114    }
22115}
22116END {
22117    if (nsig == 0) {
22118    	nsig = maxsig + 1
22119    }
22120    printf("NSIG %d\n", nsig);
22121    for (n = 1; n < nsig; n++) {
22122 	if (sig_name[n]) {
22123 	    printf("%s %d\n", sig_name[n], sig_num[n])
22124	}
22125 	else {
22126 	    printf("NUM%d %d\n", n, n)
22127 	}
22128    }
22129    for (n = 0; n < ndups; n++) {
22130 	printf("%s %d\n", dup_name[n], dup_num[n])
22131    }
22132}
22133EOP
22134$cat >signal_cmd <<EOS
22135$startsh
22136if $test -s signal.lst; then
22137    echo "Using your existing signal.lst file"
22138	exit 0
22139fi
22140xxx="$xxx"
22141EOS
22142$cat >>signal_cmd <<'EOS'
22143
22144set signal
22145if eval $compile_ok; then
22146	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22147		$uniq | $awk -f signal.awk >signal.lst
22148else
22149	echo "(I can't seem be able to compile the whole test program)" >&4
22150	echo "(I'll try it in little pieces.)" >&4
22151	set signal -DJUST_NSIG
22152	if eval $compile_ok; then
22153		$run ./signal$_exe > signal.nsg
22154		$cat signal.nsg
22155	else
22156		echo "I can't seem to figure out how many signals you have." >&4
22157		echo "Guessing 50." >&4
22158		echo 'NSIG 50' > signal.nsg
22159	fi
22160	: Now look at all the signal names, one at a time.
22161	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22162		$cat > signal.c <<EOCP
22163#include <sys/types.h>
22164#include <signal.h>
22165#include <stdio.h>
22166int main() {
22167printf("$xx %d\n", SIG${xx});
22168return 0;
22169}
22170EOCP
22171		set signal
22172		if eval $compile; then
22173			echo "SIG${xx} found."
22174			$run ./signal$_exe  >> signal.ls1
22175		else
22176			echo "SIG${xx} NOT found."
22177		fi
22178	done
22179	if $test -s signal.ls1; then
22180		$cat signal.nsg signal.ls1 |
22181			$sort -n | $uniq | $awk -f signal.awk >signal.lst
22182	fi
22183
22184fi
22185if $test -s signal.lst; then
22186	:
22187else
22188	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22189	echo 'kill -l' >signal
22190	set X `csh -f <signal`
22191	$rm -f signal
22192	shift
22193	case $# in
22194	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22195	esac
22196	echo $@ | $tr ' ' $trnl | \
22197 	    $awk '{ printf "%s %d\n", $1, ++s; }
22198 		  END { printf "NSIG %d\n", ++s }' >signal.lst
22199fi
22200$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22201EOS
22202chmod a+x signal_cmd
22203$eunicefix signal_cmd
22204;;
22205esac
22206
22207: generate list of signal names
22208case "$sig_num_init" in
22209'')
22210echo " "
22211case "$sig_name_init" in
22212'') doinit=yes ;;
22213*)  case "$sig_num_init" in
22214    ''|*,*) doinit=yes ;;
22215    esac ;;
22216esac
22217case "$doinit" in
22218yes)
22219	echo "Generating a list of signal names and numbers..." >&4
22220	. ./signal_cmd
22221	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22222	sig_name=`$awk 'BEGIN { printf "ZERO " }
22223			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
22224	sig_num=`$awk  'BEGIN { printf "0 " }
22225			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
22226	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
22227			     !/^NSIG/	{ printf "\"%s\", ", $1 }
22228			     END	{ printf "0\n" }' signal.lst`
22229	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
22230			     !/^NSIG/	{ printf "%d, ", $2}
22231			     END	{ printf "0\n"}' signal.lst`
22232	;;
22233esac
22234echo "The following $sig_count signals are available:"
22235echo " "
22236echo $sig_name | $awk \
22237'BEGIN { linelen = 0 }
22238{
22239	for (i = 1; i <= NF; i++) {
22240		name = "SIG" $i " "
22241		linelen = linelen + length(name)
22242		if (linelen > 70) {
22243			printf "\n"
22244			linelen = length(name)
22245		}
22246		printf "%s", name
22247	}
22248	printf "\n"
22249}'
22250sig_size=`echo $sig_name | awk '{print NF}'`
22251$rm -f signal signal.c signal.awk signal.lst signal_cmd
22252;;
22253esac
22254
22255: Check size of size
22256echo " "
22257case "$sizetype" in
22258*_t) zzz="$sizetype"	;;
22259*)   zzz="filesize"	;;
22260esac
22261echo "Checking the size of $zzz..." >&4
22262cat > try.c <<EOCP
22263#include <sys/types.h>
22264#include <stdio.h>
22265#$i_stdlib I_STDLIB
22266#ifdef I_STDLIB
22267#include <stdlib.h>
22268#endif
22269int main() {
22270    printf("%d\n", (int)sizeof($sizetype));
22271    exit(0);
22272}
22273EOCP
22274set try
22275if eval $compile_ok; then
22276	yyy=`$run ./try`
22277	case "$yyy" in
22278	'')	sizesize=4
22279		echo "(I can't execute the test program--guessing $sizesize.)" >&4
22280		;;
22281	*)	sizesize=$yyy
22282		echo "Your $zzz size is $sizesize bytes."
22283		;;
22284	esac
22285else
22286	sizesize=4
22287	echo "(I can't compile the test program--guessing $sizesize.)" >&4
22288fi
22289
22290: check for socklen_t
22291echo " "
22292echo "Checking to see if you have socklen_t..." >&4
22293$cat >try.c <<EOCP
22294#include <sys/types.h>
22295#$d_socket HAS_SOCKET
22296#ifdef HAS_SOCKET
22297#include <sys/socket.h>
22298#endif
22299int main() { socklen_t x = 16; }
22300EOCP
22301set try
22302if eval $compile; then
22303	val="$define"
22304	echo "You have socklen_t."
22305else
22306	val="$undef"
22307	echo "You do not have socklen_t."
22308	case "$sizetype" in
22309	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22310	esac
22311fi
22312$rm_try
22313set d_socklen_t
22314eval $setvar
22315
22316: see if this is a socks.h system
22317set socks.h i_socks
22318eval $inhdr
22319
22320: check for type of the size argument to socket calls
22321case "$d_socket" in
22322"$define")
22323	$cat <<EOM
22324
22325Checking to see what type is the last argument of accept().
22326EOM
22327	yyy=''
22328	case "$d_socklen_t" in
22329	"$define") yyy="$yyy socklen_t"
22330	esac
22331	yyy="$yyy $sizetype int long unsigned"
22332	for xxx in $yyy; do
22333		case "$socksizetype" in
22334		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22335			case "$usesocks" in
22336			"$define")
22337				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22338					echo "Your system accepts '$xxx *' for the last argument of accept()."
22339					socksizetype="$xxx"
22340				fi
22341				;;
22342			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22343					echo "Your system accepts '$xxx *' for the last argument of accept()."
22344					socksizetype="$xxx"
22345				fi
22346				;;
22347			esac
22348			;;
22349		esac
22350	done
22351: In case none of those worked, prompt the user.
22352	case "$socksizetype" in
22353	'')	rp='What is the type for socket address structure sizes?'
22354		dflt='int'
22355		. ./myread
22356		socksizetype=$ans
22357		;;
22358	esac
22359	;;
22360*)	: no sockets, so pick relatively harmless default
22361	socksizetype='int'
22362	;;
22363esac
22364
22365: see what type is used for signed size_t
22366set ssize_t ssizetype int stdio.h sys/types.h
22367eval $typedef
22368dflt="$ssizetype"
22369$cat > try.c <<EOM
22370#include <stdio.h>
22371#$i_stdlib I_STDLIB
22372#ifdef I_STDLIB
22373#include <stdlib.h>
22374#endif
22375#include <sys/types.h>
22376#define Size_t $sizetype
22377#define SSize_t $dflt
22378int main()
22379{
22380	if (sizeof(Size_t) == sizeof(SSize_t))
22381		printf("$dflt\n");
22382	else if (sizeof(Size_t) == sizeof(int))
22383		printf("int\n");
22384	else
22385		printf("long\n");
22386	exit(0);
22387}
22388EOM
22389echo " "
22390set try
22391if eval $compile_ok && $run ./try > /dev/null; then
22392	ssizetype=`$run ./try`
22393	echo "I'll be using $ssizetype for functions returning a byte count." >&4
22394else
22395	$cat >&4 <<EOM
22396Help! I can't compile and run the ssize_t test program: please enlighten me!
22397(This is probably a misconfiguration in your system or libraries, and
22398you really ought to fix it.  Still, I'll try anyway.)
22399
22400I need a type that is the same size as $sizetype, but is guaranteed to
22401be signed.  Common values are ssize_t, int and long.
22402
22403EOM
22404	rp="What signed type is the same size as $sizetype?"
22405	. ./myread
22406	ssizetype="$ans"
22407fi
22408$rm_try
22409
22410: Check the size of st_ino
22411$echo " "
22412$echo "Checking the size of st_ino..." >&4
22413$cat > try.c <<EOCP
22414#include <sys/stat.h>
22415#include <stdio.h>
22416#$i_stdlib I_STDLIB
22417#ifdef I_STDLIB
22418#include <stdlib.h>
22419#endif
22420int main() {
22421    struct stat st;
22422    printf("%d\n", (int)sizeof(st.st_ino));
22423    exit(0);
22424}
22425EOCP
22426set try
22427if eval $compile_ok; then
22428	val=`$run ./try`
22429	case "$val" in
22430	'')	st_ino_size=4
22431		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22432		;;
22433	*)	st_ino_size=$val
22434		$echo "Your st_ino is $st_ino_size bytes long."
22435		;;
22436	esac
22437else
22438	st_ino_size=4
22439	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22440fi
22441$rm_try
22442
22443: Check if st_ino is signed
22444$echo " "
22445$echo "Checking the sign of st_ino..." >&4
22446$cat > try.c <<EOCP
22447#include <sys/stat.h>
22448#include <stdio.h>
22449int main() {
22450	struct stat foo;
22451        foo.st_ino = -1;
22452	if (foo.st_ino < 0)
22453		printf("-1\n");
22454	else
22455		printf("1\n");
22456}
22457EOCP
22458set try
22459if eval $compile; then
22460	val=`$run ./try`
22461	case "$val" in
22462	'')	st_ino_sign=1
22463		$echo "(I can't execute the test program--guessing unsigned.)" >&4
22464		;;
22465	*)	st_ino_sign=$val
22466		case "$st_ino_sign" in
22467		 1) $echo "Your st_ino is unsigned." ;;
22468		-1) $echo "Your st_ino is signed."   ;;
22469		esac
22470		;;
22471	esac
22472else
22473	st_ino_sign=1
22474	$echo "(I can't compile the test program--guessing unsigned.)" >&4
22475fi
22476$rm_try
22477
22478: see what type of char stdio uses.
22479echo " "
22480echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22481if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22482	echo "Your stdio uses unsigned chars." >&4
22483	stdchar="unsigned char"
22484else
22485	echo "Your stdio uses signed chars." >&4
22486	stdchar="char"
22487fi
22488$rm -f stdioh
22489
22490: Check size of UID
22491echo " "
22492case "$uidtype" in
22493*_t) zzz="$uidtype"	;;
22494*)   zzz="uid"		;;
22495esac
22496echo "Checking the size of $zzz..." >&4
22497cat > try.c <<EOCP
22498#include <sys/types.h>
22499#include <stdio.h>
22500#$i_stdlib I_STDLIB
22501#ifdef I_STDLIB
22502#include <stdlib.h>
22503#endif
22504int main() {
22505    printf("%d\n", (int)sizeof($uidtype));
22506    exit(0);
22507}
22508EOCP
22509set try
22510if eval $compile_ok; then
22511	yyy=`$run ./try`
22512	case "$yyy" in
22513	'')	uidsize=4
22514		echo "(I can't execute the test program--guessing $uidsize.)" >&4
22515		;;
22516	*)	uidsize=$yyy
22517		echo "Your $zzz is $uidsize bytes long."
22518		;;
22519	esac
22520else
22521	uidsize=4
22522	echo "(I can't compile the test program--guessing $uidsize.)" >&4
22523fi
22524
22525: Check if UID is signed
22526echo " "
22527case "$uidtype" in
22528*_t) zzz="$uidtype"	;;
22529*)   zzz="uid"		;;
22530esac
22531echo "Checking the sign of $zzz..." >&4
22532cat > try.c <<EOCP
22533#include <sys/types.h>
22534#include <stdio.h>
22535int main() {
22536	$uidtype foo = -1;
22537	if (foo < 0)
22538		printf("-1\n");
22539	else
22540		printf("1\n");
22541}
22542EOCP
22543set try
22544if eval $compile; then
22545	yyy=`$run ./try`
22546	case "$yyy" in
22547	'')	uidsign=1
22548		echo "(I can't execute the test program--guessing unsigned.)" >&4
22549		;;
22550	*)	uidsign=$yyy
22551		case "$uidsign" in
22552		 1) echo "Your $zzz is unsigned." ;;
22553		-1) echo "Your $zzz is signed."   ;;
22554		esac
22555		;;
22556	esac
22557else
22558	uidsign=1
22559	echo "(I can't compile the test program--guessing unsigned.)" >&4
22560fi
22561
22562: Check format string for UID
22563echo " "
22564$echo "Checking the format string to be used for uids..." >&4
22565
22566case "$uidsign" in
22567-1)	if $test X"$uidsize" = X"$ivsize"; then
22568		uidformat="$ivdformat"
22569	else
22570		if $test X"$uidsize" = X"$longsize"; then
22571			uidformat='"ld"'
22572		else
22573			if $test X"$uidsize" = X"$intsize"; then
22574				uidformat='"d"'
22575			else
22576				if $test X"$uidsize" = X"$shortsize"; then
22577					uidformat='"hd"'
22578				fi
22579			fi
22580		fi
22581	fi
22582	;;
22583*)	if $test X"$uidsize" = X"$uvsize"; then
22584		uidformat="$uvuformat"
22585	else
22586		if $test X"$uidsize" = X"$longsize"; then
22587			uidformat='"lu"'
22588		else
22589			if $test X"$uidsize" = X"$intsize"; then
22590				uidformat='"u"'
22591			else
22592				if $test X"$uidsize" = X"$shortsize"; then
22593					uidformat='"hu"'
22594				fi
22595			fi
22596		fi
22597	fi
22598	;;
22599esac
22600
22601: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22602echo " "
22603echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22604$cat >try.c <<'EOM'
22605/* Intentionally a long probe as I'd like to sanity check that the exact
22606   approach is going to work, as thinking it will work, but only having it
22607   part working at runtime is worse than not having it.  */
22608
22609#include <sys/types.h>
22610#include <sys/sysctl.h>
22611#include <sys/param.h>
22612#include <stdio.h>
22613#include <string.h>
22614#include <stdlib.h>
22615#include <unistd.h>
22616
22617int
22618main(int argc, char **argv) {
22619    char *buffer;
22620    char *argv_leaf = strrchr(argv[0], '/');
22621    char *buffer_leaf;
22622    size_t size = 0;
22623    int mib[4];
22624
22625    mib[0] = CTL_KERN;
22626    mib[1] = KERN_PROC;
22627    mib[2] = KERN_PROC_PATHNAME;
22628    mib[3] = -1;
22629
22630    if (!argv_leaf) {
22631	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22632	return 1;
22633    }
22634
22635    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22636	perror("sysctl");
22637	return 2;
22638    }
22639
22640    if (size < strlen(argv_leaf) + 1) {
22641	fprintf(stderr, "size %lu is too short for a path\n",
22642		(unsigned long) size);
22643	return 3;
22644    }
22645
22646    if (size > MAXPATHLEN * MAXPATHLEN) {
22647	fprintf(stderr, "size %lu is too long for a path\n",
22648		(unsigned long) size);
22649	return 4;
22650    }
22651
22652    buffer = (char *)malloc(size);
22653    if (!buffer) {
22654	perror("malloc");
22655	return 5;
22656    }
22657
22658    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22659	perror("sysctl");
22660	return 6;
22661    }
22662
22663    if (strlen(buffer) + 1 != size) {
22664	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22665		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
22666        return 7;
22667    }
22668
22669
22670    if (*buffer != '/') {
22671	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22672	return 8;
22673    }
22674
22675    if (strstr(buffer, "/./")) {
22676	fprintf(stderr, "Contains /./: '%s'\n", buffer);
22677	return 9;
22678    }
22679
22680    if (strstr(buffer, "/../")) {
22681	fprintf(stderr, "Contains /../: '%s'\n", buffer);
22682	return 10;
22683    }
22684
22685    buffer_leaf = strrchr(buffer, '/');
22686    if (strcmp(buffer_leaf, argv_leaf) != 0) {
22687	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22688	return 11;
22689    }
22690
22691    free(buffer);
22692
22693    return 0;
22694}
22695EOM
22696
22697val=$undef
22698set try
22699if eval $compile; then
22700	if $run ./try; then
22701		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22702		val="$define"
22703	else
22704		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22705		val="$undef"
22706	fi
22707else
22708	echo "I'm unable to compile the test program." >&4
22709	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22710	val="$undef"
22711fi
22712$rm_try
22713set usekernprocpathname
22714eval $setvar
22715
22716: Determine if we can use _NSGetExecutablePath to find executing program
22717echo " "
22718echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22719$cat >try.c <<'EOM'
22720/* Intentionally a long probe as I'd like to sanity check that the exact
22721   approach is going to work, as thinking it will work, but only having it
22722   part working at runtime is worse than not having it.  */
22723#include <mach-o/dyld.h>
22724#include <stdio.h>
22725#include <stdlib.h>
22726#include <sys/param.h>
22727#include <string.h>
22728
22729int
22730main(int argc, char **argv) {
22731    char buf[1];
22732    uint32_t size = sizeof(buf);
22733    int result;
22734    char *buffer;
22735    char *tidied;
22736    char *argv_leaf = strrchr(argv[0], '/');
22737    char *tidied_leaf;
22738
22739    if (!argv_leaf) {
22740	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22741	return 1;
22742    }
22743
22744    _NSGetExecutablePath(buf, &size);
22745    if (size > MAXPATHLEN * MAXPATHLEN) {
22746	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22747		(unsigned int) size);
22748	return 2;
22749    }
22750
22751    buffer = (char *)malloc(size);
22752    if (!buffer) {
22753	perror("malloc");
22754	return 3;
22755    }
22756
22757    result = _NSGetExecutablePath(buffer, &size);
22758    if (result != 0) {
22759	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22760		result, (unsigned int) size);
22761	return 4;
22762    }
22763
22764    tidied = realpath(buffer, NULL);
22765    if (!tidied) {
22766	perror("realpath");
22767	return 5;
22768    }
22769
22770    free(buffer);
22771
22772    if (*tidied != '/') {
22773	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22774	return 6;
22775    }
22776
22777    if (strstr(tidied, "/./")) {
22778	fprintf(stderr, "Contains /./: '%s'\n", tidied);
22779	return 7;
22780    }
22781
22782    if (strstr(tidied, "/../")) {
22783	fprintf(stderr, "Contains /../: '%s'\n", tidied);
22784	return 8;
22785    }
22786
22787    tidied_leaf = strrchr(tidied, '/');
22788    if (strcmp(tidied_leaf, argv_leaf) != 0) {
22789	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22790	return 9;
22791    }
22792
22793    free(tidied);
22794
22795    return 0;
22796}
22797EOM
22798
22799val=$undef
22800set try
22801if eval $compile; then
22802	if $run ./try; then
22803		echo "You can use _NSGetExecutablePath to find the executing program." >&4
22804		val="$define"
22805	else
22806		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22807	fi
22808else
22809	echo "I'm unable to compile the test program." >&4
22810	echo "I'll assume no _NSGetExecutablePath here." >&4
22811fi
22812$rm_try
22813set usensgetexecutablepath
22814eval $setvar
22815
22816: Check if site customization support was requested
22817case "$usesitecustomize" in
22818    $define|true|[Yy]*)
22819	usesitecustomize="$define"
22820	;;
22821    *)
22822	usesitecustomize="$undef"
22823	;;
22824    esac
22825
22826: determine compiler compiler
22827case "$yacc" in
22828'')
22829	dflt=yacc;;
22830*)
22831	dflt="$yacc";;
22832esac
22833echo " "
22834comp='yacc'
22835if $test -f "$byacc$_exe"; then
22836	dflt="$byacc"
22837	comp="byacc or $comp"
22838fi
22839if $test -f "$bison$_exe"; then
22840	comp="$comp or bison -y"
22841fi
22842rp="Which compiler compiler ($comp) shall I use?"
22843. ./myread
22844yacc="$ans"
22845case "$yacc" in
22846*bis*)
22847	case "$yacc" in
22848	*-y*) ;;
22849	*)
22850		yacc="$yacc -y"
22851		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22852		;;
22853	esac
22854	;;
22855esac
22856
22857: see if this is a bfd.h system
22858set bfd.h i_bfd
22859eval $inhdr
22860
22861: see if this is an execinfo.h system
22862set execinfo.h i_execinfo
22863eval $inhdr
22864
22865: see if this is a fenv.h system
22866set fenv.h i_fenv
22867eval $inhdr
22868
22869: see if this is a fp.h system
22870set fp.h i_fp
22871eval $inhdr
22872
22873: see if this is a fp_class.h system
22874set fp_class.h i_fp_class
22875eval $inhdr
22876
22877: see if gdbm.h is available
22878set gdbm.h t_gdbm
22879eval $inhdr
22880case "$t_gdbm" in
22881$define)
22882	: see if gdbm_open exists
22883	set gdbm_open d_gdbm_open
22884	eval $inlibc
22885	case "$d_gdbm_open" in
22886	$undef)
22887		t_gdbm="$undef"
22888		echo "We won't be including <gdbm.h>"
22889		;;
22890	esac
22891	;;
22892esac
22893val="$t_gdbm"
22894set i_gdbm
22895eval $setvar
22896
22897: see if this is a ieeefp.h system
22898case "$i_ieeefp" in
22899'' ) set ieeefp.h i_ieeefp
22900     eval $inhdr
22901     ;;
22902esac
22903
22904: see if this is a libutil.h system
22905set libutil.h i_libutil
22906eval $inhdr
22907
22908: see if mach cthreads are available
22909if test "X$usethreads" = "X$define"; then
22910	set mach/cthreads.h i_machcthr
22911	eval $inhdr
22912else
22913	i_machcthr="$undef"
22914fi
22915
22916: see if this is a mntent.h system
22917set mntent.h i_mntent
22918eval $inhdr
22919
22920: see if net/errno.h is available
22921val=''
22922set net/errno.h val
22923eval $inhdr
22924
22925: Unfortunately, it causes problems on some systems.  Arrgh.
22926case "$val" in
22927$define)
22928	cat > try.c <<'EOM'
22929#include <stdio.h>
22930#include <errno.h>
22931#include <net/errno.h>
22932int func()
22933{
22934	return ENOTSOCK;
22935}
22936EOM
22937	if $cc $ccflags -c try.c >/dev/null 2>&1; then
22938		echo "We'll be including <net/errno.h>." >&4
22939	else
22940		echo "We won't be including <net/errno.h>." >&4
22941		val="$undef"
22942	fi
22943	$rm_try
22944	;;
22945esac
22946set i_neterrno
22947eval $setvar
22948
22949: see if netinet/tcp.h is available
22950set netinet/tcp.h i_netinettcp
22951eval $inhdr
22952
22953: see if this is a poll.h system
22954set poll.h i_poll
22955eval $inhdr
22956
22957: see if this is a prot.h system
22958set prot.h i_prot
22959eval $inhdr
22960
22961: Preprocessor symbols
22962echo " "
22963$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22964$cat <<'EOSH' > Cppsym.know
22965a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22966AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22967AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22968arch_pwr ardent ARM ARM32 atarist att386 att3b
22969BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22970BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22971byteorder byte_order
22972c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22973convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22974DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22975ELF encore EPI EXTENSIONS
22976FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22977GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22978GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22979H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22980hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
22981hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22982i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22983iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22984INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22985ksr1
22986LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22987LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22988LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22989luna88k Lynx
22990M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22991MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22992mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22993merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22994MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22995MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22996M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22997M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22998n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22999news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23000ns32000 ns32016 ns32332 ns32k nsc32000
23001OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23002PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23003plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23004POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23005QK_USER QNX
23006R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23007S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23008SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23009sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23010stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23011SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23012SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23013SYSV4 SYSV5 sysV68 sysV88
23014Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23015TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23016tower32_800 tower32_850 tss
23017u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23018UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23019USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23020USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23021USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23022USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23023uxpm uxps
23024vax venix VMESA vms
23025x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23026XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23027z8000 zarch
23028EOSH
23029# Maybe put other stuff here too.
23030./tr '-' '_' <<EOSH >>Cppsym.know
23031$osname
23032EOSH
23033./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23034./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23035$cat Cppsym.know > Cppsym.c
23036$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23037$rm -f Cppsym.a Cppsym.b Cppsym.c
23038cat <<EOSH > Cppsym
23039$startsh
23040if $test \$# -gt 0; then
23041    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23042    if $test -s Cppsym.got; then
23043	$rm -f Cppsym.got
23044	exit 0
23045    fi
23046    $rm -f Cppsym.got
23047    exit 1
23048else
23049    $tr " " "$trnl" | ./Cppsym.try
23050    exit 0
23051fi
23052EOSH
23053chmod +x Cppsym
23054$eunicefix Cppsym
23055cat <<EOSH > Cppsym.try
23056$startsh
23057cat <<'EOCP' > try.c
23058#include <stdio.h>
23059#if cpp_stuff == 1
23060#define STRINGIFY(a)    "a"
23061#endif
23062#if cpp_stuff == 42
23063#define StGiFy(a)  #a
23064#define STRINGIFY(a)    StGiFy(a)
23065#endif
23066#if $cpp_stuff != 1 && $cpp_stuff != 42
23067#   include "Bletch: How does this C preprocessor stringify macros?"
23068#endif
23069int main() {
23070EOCP
23071$awk \\
23072EOSH
23073cat <<'EOSH' >> Cppsym.try
23074'length($1) > 0 {
23075    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23076    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23077    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23078    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23079}' >> try.c
23080echo 'return 0;}' >> try.c
23081EOSH
23082cat <<EOSH >> Cppsym.try
23083ccflags="$ccflags"
23084case "$osname-$gccversion" in
23085irix-) ccflags="\$ccflags -woff 1178" ;;
23086os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23087esac
23088$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23089EOSH
23090chmod +x Cppsym.try
23091$eunicefix Cppsym.try
23092./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23093: Add in any Linux cpp "predefined macros":
23094case "$osname::$gccversion" in
23095  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23096    tHdrH=_tmpHdr
23097    rm -f $tHdrH'.h' $tHdrH
23098    touch $tHdrH'.h'
23099    # Filter out macro arguments, such as Linux's __INT8_C(c)
23100    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23101       sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23102       if [ -s $tHdrH'_cppsym.real' ]; then
23103	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23104       fi
23105    fi
23106    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23107  ;;
23108esac
23109: now check the C compiler for additional symbols
23110postprocess_cc_v=''
23111case "$osname" in
23112aix) postprocess_cc_v="|$tr , ' '" ;;
23113esac
23114$cat >ccsym <<EOS
23115$startsh
23116$cat >tmp.c <<EOF
23117extern int foo;
23118EOF
23119for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23120do
23121	case "\$i" in
23122	-D*) echo "\$i" | $sed 's/^-D//';;
23123	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23124	esac
23125done
23126$rm_try
23127EOS
23128postprocess_cc_v=''
23129chmod +x ccsym
23130$eunicefix ccsym
23131./ccsym > ccsym1.raw
23132if $test -s ccsym1.raw; then
23133    $sort ccsym1.raw | $uniq >ccsym.raw
23134else
23135    mv ccsym1.raw ccsym.raw
23136fi
23137
23138$awk '/\=/ { print $0; next }
23139	{ print $0"=1" }' ccsym.raw >ccsym.list
23140$comm -13 Cppsym.true ccsym.list >ccsym.own
23141$comm -12 Cppsym.true ccsym.list >ccsym.com
23142$comm -23 Cppsym.true ccsym.list >ccsym.cpp
23143also=''
23144if $test -z ccsym.raw; then
23145	echo "Your C compiler doesn't seem to define any symbols!" >&4
23146	echo " "
23147	echo "However, your C preprocessor defines the following symbols:"
23148	$cat Cppsym.true
23149	ccsymbols=''
23150	cppsymbols=`$cat Cppsym.true`
23151	cppsymbols=`echo $cppsymbols`
23152	cppccsymbols="$cppsymbols"
23153else
23154	if $test -s ccsym.com; then
23155		echo "Your C compiler and pre-processor define these symbols:"
23156		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
23157		also='also '
23158		symbols='ones'
23159		cppccsymbols=`$cat ccsym.com`
23160		cppccsymbols=`echo $cppccsymbols`
23161		$test "$silent" || sleep 1
23162	fi
23163	if $test -s ccsym.cpp; then
23164		$test "$also" && echo " "
23165		echo "Your C pre-processor ${also}defines the following symbols:"
23166		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23167		also='further '
23168		cppsymbols=`$cat ccsym.cpp`
23169		cppsymbols=`echo $cppsymbols`
23170		$test "$silent" || sleep 1
23171	fi
23172	if $test -s ccsym.own; then
23173		$test "$also" && echo " "
23174		echo "Your C compiler ${also}defines the following cpp symbols:"
23175		$sed -e 's/\(..*\)=1/\1/' ccsym.own
23176		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23177		ccsymbols=`$cat ccsym.own`
23178		ccsymbols=`echo $ccsymbols`
23179		$test "$silent" || sleep 1
23180	fi
23181fi
23182
23183: add -D_FORTIFY_SOURCE if feasible and not already there
23184case "$gccversion" in
23185[456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
23186	*-O*)	case "$ccflags$cppsymbols" in
23187		*_FORTIFY_SOURCE=*) # Don't add it again.
23188			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23189			;;
23190		*)	echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23191			ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23192			;;
23193		esac
23194		;;
23195	*)	echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23196		;;
23197	esac
23198	;;
23199*)	echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23200	;;
23201esac
23202
23203: script used to emit important warnings
23204cat >warn <<EOS
23205$startsh
23206if test \$# -gt 0; then
23207	echo "\$@" >msg
23208else
23209	cat >msg
23210fi
23211echo "*** WARNING:" >&4
23212sed -e 's/^/*** /' <msg >&4
23213echo "*** " >&4
23214cat msg >>config.msg
23215echo " " >>config.msg
23216rm -f msg
23217EOS
23218chmod +x warn
23219$eunicefix warn
23220
23221: see if this is a termio system
23222val="$undef"
23223val2="$undef"
23224val3="$undef"
23225if $test `./findhdr termios.h`; then
23226    set tcsetattr i_termios
23227    eval $inlibc
23228    val3="$i_termios"
23229fi
23230echo " "
23231case "$val3" in
23232    "$define") echo "You have POSIX termios.h... good!" >&4;;
23233    *)  if ./Cppsym pyr; then
23234	    case "`$run /bin/universe`" in
23235		ucb) if $test `./findhdr sgtty.h`; then
23236			val2="$define"
23237			echo "<sgtty.h> found." >&4
23238		    else
23239			echo "System is pyramid with BSD universe."
23240			./warn "<sgtty.h> not found--you could have problems."
23241		    fi;;
23242		*)  if $test `./findhdr termio.h`; then
23243			val="$define"
23244			echo "<termio.h> found." >&4
23245		    else
23246			echo "System is pyramid with USG universe."
23247			./warn "<termio.h> not found--you could have problems."
23248		    fi;;
23249	    esac
23250	elif ./usg; then
23251	    if $test `./findhdr termio.h`; then
23252		echo "<termio.h> found." >&4
23253		val="$define"
23254	    elif $test `./findhdr sgtty.h`; then
23255		echo "<sgtty.h> found." >&4
23256		val2="$define"
23257	    else
23258		./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23259	    fi
23260	else
23261	    if $test `./findhdr sgtty.h`; then
23262		echo "<sgtty.h> found." >&4
23263		val2="$define"
23264	    elif $test `./findhdr termio.h`; then
23265		echo "<termio.h> found." >&4
23266		val="$define"
23267	    else
23268		./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23269	    fi
23270	fi;;
23271esac
23272set i_termio; eval $setvar
23273val=$val2; set i_sgtty; eval $setvar
23274val=$val3; set i_termios; eval $setvar
23275
23276: see if stdbool is available
23277: we want a real compile instead of Inhdr because some Solaris systems
23278: have stdbool.h, but it can only be used if the compiler indicates it
23279: is sufficiently c99-compliant.
23280echo " "
23281$cat >try.c <<EOCP
23282#include <stdio.h>
23283#include <stdbool.h>
23284int func(bool x)
23285{
23286    return x ? 1 : 0;
23287}
23288int main(int argc, char **argv)
23289{
23290    return func(0);
23291}
23292EOCP
23293set try
23294if eval $compile; then
23295	echo "<stdbool.h> found." >&4
23296	val="$define"
23297else
23298	echo "<stdbool.h> NOT found." >&4
23299	val="$undef"
23300fi
23301$rm_try
23302set i_stdbool
23303eval $setvar
23304
23305: see if stdint is available
23306set stdint.h i_stdint
23307eval $inhdr
23308
23309: see if sys/access.h is available
23310set sys/access.h i_sysaccess
23311eval $inhdr
23312
23313: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23314set sys/filio.h i_sysfilio
23315eval $inhdr
23316echo " "
23317if $test `./findhdr sys/ioctl.h`; then
23318	val="$define"
23319	echo '<sys/ioctl.h> found.' >&4
23320else
23321	val="$undef"
23322	if $test $i_sysfilio = "$define"; then
23323	    echo '<sys/ioctl.h> NOT found.' >&4
23324	else
23325		$test $i_sgtty = "$define" && xxx="sgtty.h"
23326		$test $i_termio = "$define" && xxx="termio.h"
23327		$test $i_termios = "$define" && xxx="termios.h"
23328echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23329	fi
23330fi
23331set i_sysioctl
23332eval $setvar
23333
23334: see if socket ioctl defs are in sys/sockio.h
23335echo " "
23336xxx=`./findhdr sys/sockio.h`
23337if $test "$xxx"; then
23338	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23339		val="$define"
23340		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23341	else
23342		val="$undef"
23343		echo "No socket ioctls found in <sys/sockio.h>." >&4
23344	fi
23345else
23346	val="$undef"
23347	$cat <<EOM
23348<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23349EOM
23350fi
23351set i_syssockio
23352eval $setvar
23353
23354: see if this is a syslog.h system
23355set syslog.h i_syslog
23356eval $inhdr
23357
23358: see if this is a sys/mode.h system
23359set sys/mode.h i_sysmode
23360eval $inhdr
23361
23362: see if there is a sys/poll.h file
23363set sys/poll.h i_syspoll
23364eval $inhdr
23365
23366: see if sys/resource.h has to be included
23367set sys/resource.h i_sysresrc
23368eval $inhdr
23369
23370: see if sys/security.h is available
23371set sys/security.h i_syssecrt
23372eval $inhdr
23373
23374: see if this is a sys/statvfs.h system
23375set sys/statvfs.h i_sysstatvfs
23376eval $inhdr
23377
23378: see if this is a sys/un.h system
23379set sys/un.h i_sysun
23380eval $inhdr
23381
23382: see if this is a sys/utsname.h system
23383set sys/utsname.h i_sysutsname
23384eval $inhdr
23385
23386: see if this is a syswait system
23387set sys/wait.h i_syswait
23388eval $inhdr
23389
23390: see if this is a ustat.h system
23391set ustat.h i_ustat
23392eval $inhdr
23393
23394: see if this is an utime system
23395set utime.h i_utime
23396eval $inhdr
23397
23398: see if this is a vfork system
23399case "$d_vfork" in
23400"$define")
23401	set vfork.h i_vfork
23402	eval $inhdr
23403	;;
23404*)
23405	i_vfork="$undef"
23406	;;
23407esac
23408
23409: see if wchar.h is present
23410set wchar.h i_wchar
23411eval $inhdr
23412
23413: Check extensions
23414echo " "
23415echo "Looking for extensions..." >&4
23416: If we are using the old config.sh, nonxs_extensions and xs_extensions may
23417: contain old or inaccurate or duplicate values.
23418nonxs_extensions=''
23419xs_extensions=''
23420: We do not use find because it might not be available.
23421: We do not just use MANIFEST because the user may have dropped
23422: some additional extensions into the source tree and expect them
23423: to be built.
23424
23425: Function to recursively find available extensions, ignoring DynaLoader
23426: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23427: In 5.10.1 and later, extensions are stored in directories
23428: like File-Glob instead of the older File/Glob/.
23429find_extensions='
23430    for xxx in *; do
23431	case "$xxx" in
23432	    DynaLoader|dynaload) ;;
23433	    *)
23434	    this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23435	    case "$this_ext" in
23436		Scalar/List/Utils) this_ext="List/Util"	;;
23437		PathTools)         this_ext="Cwd"	;;
23438	    esac;
23439	    echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23440	    if $contains " $this_ext " "$tdir/$$.tmp"; then
23441		echo >&4;
23442		echo "Duplicate directories detected for extension $xxx" >&4;
23443		echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23444		case "$knowitall" in
23445		"") dflt=y;;
23446		*) dflt=n;;
23447		esac;
23448		. ../UU/myread;
23449		case "$ans" in
23450		n*|N*) ;;
23451		*) echo >&4;
23452		    echo "Ok.  Stopping Configure." >&4;
23453		    echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23454		    exit 1;;
23455		esac;
23456		echo "Ok.  You will need to correct config.sh before running make." >&4;
23457	    fi;
23458	    $ls -1 "$xxx" > "$tdir/$$.tmp";
23459	    if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23460		xs_extensions="$xs_extensions $this_ext";
23461	    elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23462		xs_extensions="$xs_extensions $this_ext";
23463	    elif $test -d "$xxx"; then
23464		nonxs_extensions="$nonxs_extensions $this_ext";
23465	    fi;
23466	    $rm -f "$tdir/$$.tmp";
23467	    ;;
23468	esac;
23469    done'
23470tdir=`pwd`
23471cd "$rsrc/cpan"
23472set X
23473shift
23474eval $find_extensions
23475cd "$rsrc/dist"
23476set X
23477shift
23478eval $find_extensions
23479cd "$rsrc/ext"
23480set X
23481shift
23482eval $find_extensions
23483set X $xs_extensions
23484shift
23485xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23486set X $nonxs_extensions
23487shift
23488nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23489cd "$tdir"
23490known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23491
23492: Now see which are supported on this system.
23493avail_ext=''
23494for xxx in $xs_extensions ; do
23495	case "$xxx" in
23496	Amiga*)
23497		case "$osname" in
23498		amigaos) avail_ext="$avail_ext $xxx" ;;
23499		esac
23500		;;
23501	DB_File|db_file)
23502		case "$i_db" in
23503		$define) avail_ext="$avail_ext $xxx" ;;
23504		esac
23505		;;
23506	GDBM_File|gdbm_fil)
23507		case "$i_gdbm" in
23508		$define) avail_ext="$avail_ext $xxx" ;;
23509		esac
23510		;;
23511	IPC/SysV|ipc/sysv)
23512		: XXX Do we need a useipcsysv variable here
23513		case "${d_msg}${d_sem}${d_shm}" in
23514		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
23515		esac
23516		;;
23517	NDBM_File|ndbm_fil)
23518		case "$d_ndbm" in
23519		$define)
23520		    case "$osname-$use64bitint" in
23521		    hpux-define)
23522			case "$libs" in
23523			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
23524			esac
23525			;;
23526		    *) avail_ext="$avail_ext $xxx" ;;
23527		    esac
23528		    ;;
23529		esac
23530		;;
23531	ODBM_File|odbm_fil)
23532		case "${i_dbm}${i_rpcsvcdbm}" in
23533		*"${define}"*)
23534		    case "$d_cplusplus" in
23535		    define) ;; # delete as a function name will not work
23536		    *)  case "$osname-$use64bitint" in
23537			hpux-define)
23538			    case "$libs" in
23539			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23540			    esac
23541			    ;;
23542			*) avail_ext="$avail_ext $xxx" ;;
23543			esac
23544			;;
23545		    esac
23546		    ;;
23547		esac
23548		;;
23549	Opcode|opcode)
23550		case "$useopcode" in
23551		true|define|y) avail_ext="$avail_ext $xxx" ;;
23552		esac
23553		;;
23554	POSIX|posix)
23555		case "$useposix" in
23556		true|define|y) avail_ext="$avail_ext $xxx" ;;
23557		esac
23558		;;
23559	Socket|socket)
23560		case "$d_socket" in
23561		true|$define|y) avail_ext="$avail_ext $xxx" ;;
23562		esac
23563		;;
23564	I18N/Langinfo|langinfo)
23565		case "$uselanginfo" in
23566		true|define|y) avail_ext="$avail_ext $xxx" ;;
23567		esac
23568		;;
23569	Sys/Syslog|sys/syslog)
23570		case $osname in
23571			amigaos) ;; # not really very useful on AmigaOS
23572			*)
23573			: XXX syslog requires socket
23574			case "$d_socket" in
23575			true|$define|y) avail_ext="$avail_ext $xxx" ;;
23576			esac
23577			;;
23578		esac
23579		;;
23580	Thread|thread)
23581                case "$usethreads" in
23582                true|$define|y)
23583                        case "$use5005threads" in
23584                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23585                        esac
23586		esac
23587		;;
23588	threads|threads/shared)
23589		# threads and threads::shared are special cases.
23590		# To stop people from asking "Perl 5.8.0 was supposed
23591		# to have this new fancy threads implementation but my
23592		# perl doesn't have it" and from people trying to
23593		# (re)install the threads module using CPAN.pm and
23594		# CPAN.pm then offering to reinstall Perl 5.8.0,
23595		# the threads.pm and threads/shared.pm will always be
23596		# there, croaking informatively ("you need to rebuild
23597		# all of Perl with threads, sorry") when threads haven't
23598		# been compiled in.
23599		# --jhi
23600		avail_ext="$avail_ext $xxx"
23601		;;
23602	VMS*)
23603		;;
23604	Win32*)
23605		case "$osname" in
23606		cygwin) avail_ext="$avail_ext $xxx" ;;
23607		esac
23608		;;
23609	XS/APItest|xs/apitest)
23610		# This is just for testing.  Skip it unless we have dynamic loading.
23611
23612		case "$usedl" in
23613		$define) avail_ext="$avail_ext $xxx" ;;
23614		esac
23615		;;
23616	XS/Typemap|xs/typemap)
23617		# This is just for testing.  Skip it unless we have dynamic loading.
23618		case "$usedl" in
23619		$define) avail_ext="$avail_ext $xxx" ;;
23620		esac
23621		;;
23622	*)	avail_ext="$avail_ext $xxx"
23623		;;
23624	esac
23625done
23626
23627set X $avail_ext
23628shift
23629avail_ext="$*"
23630
23631case "$onlyextensions" in
23632'') ;;
23633*)  keepextensions=''
23634    echo "You have requested that only certain extensions be included..." >&4
23635    for i in $onlyextensions; do
23636        case " $avail_ext " in
23637        *" $i "*)
23638            echo "Keeping extension $i."
23639            keepextensions="$keepextensions $i"
23640            ;;
23641        *) echo "Ignoring extension $i." ;;
23642        esac
23643    done
23644    avail_ext="$keepextensions"
23645    ;;
23646esac
23647
23648case "$noextensions" in
23649'') ;;
23650*)  keepextensions=''
23651    echo "You have requested that certain extensions be ignored..." >&4
23652    for i in $avail_ext; do
23653        case " $noextensions " in
23654        *" $i "*) echo "Ignoring extension $i." ;;
23655        *) echo "Keeping extension $i.";
23656           keepextensions="$keepextensions $i"
23657           ;;
23658        esac
23659    done
23660    avail_ext="$keepextensions"
23661    ;;
23662esac
23663
23664: Now see which nonxs extensions are supported on this system.
23665: For now assume all are.
23666nonxs_ext=''
23667for xxx in $nonxs_extensions ; do
23668	case "$xxx" in
23669	VMS*)
23670		;;
23671	*)	nonxs_ext="$nonxs_ext $xxx"
23672		;;
23673	esac
23674done
23675
23676set X $nonxs_ext
23677shift
23678nonxs_ext="$*"
23679
23680case $usedl in
23681$define)
23682	$cat <<EOM
23683A number of extensions are supplied with $package.  You may choose to
23684compile these extensions for dynamic loading (the default), compile
23685them into the $package executable (static loading), or not include
23686them at all.  Answer "none" to include no extensions.
23687Note that DynaLoader is always built and need not be mentioned here.
23688
23689EOM
23690	case "$dynamic_ext" in
23691	'')
23692		: Exclude those listed in static_ext
23693		dflt=''
23694		for xxx in $avail_ext; do
23695			case " $static_ext " in
23696			*" $xxx "*) ;;
23697			*) dflt="$dflt $xxx" ;;
23698			esac
23699		done
23700		set X $dflt
23701		shift
23702		dflt="$*"
23703		;;
23704	*)	dflt="$dynamic_ext"
23705		# Perhaps we are reusing an old out-of-date config.sh.
23706		case "$hint" in
23707		previous)
23708			if test X"$dynamic_ext" != X"$avail_ext"; then
23709				$cat <<EOM
23710NOTICE:  Your previous config.sh list may be incorrect.
23711The extensions now available to you are
23712	${avail_ext}
23713but the default list from your previous config.sh is
23714	${dynamic_ext}
23715
23716EOM
23717			fi
23718			;;
23719		esac
23720		;;
23721	esac
23722	case "$dflt" in
23723	'')	dflt=none;;
23724	esac
23725	rp="What extensions do you wish to load dynamically?"
23726	. ./myread
23727	case "$ans" in
23728	none) dynamic_ext=' ' ;;
23729	*) dynamic_ext="$ans" ;;
23730	esac
23731
23732	case "$static_ext" in
23733	'')
23734		: Exclude those already listed in dynamic linking
23735		dflt=''
23736		for xxx in $avail_ext; do
23737			case " $dynamic_ext " in
23738			*" $xxx "*) ;;
23739			*) dflt="$dflt $xxx" ;;
23740			esac
23741		done
23742		set X $dflt
23743		shift
23744		dflt="$*"
23745		;;
23746	*)  dflt="$static_ext"
23747		;;
23748	esac
23749
23750	case "$dflt" in
23751	'')	dflt=none;;
23752	esac
23753	rp="What extensions do you wish to load statically?"
23754	. ./myread
23755	case "$ans" in
23756	none) static_ext=' ' ;;
23757	*) static_ext="$ans" ;;
23758	esac
23759	;;
23760*)
23761	$cat <<EOM
23762A number of extensions are supplied with $package.  Answer "none"
23763to include no extensions.
23764Note that DynaLoader is always built and need not be mentioned here.
23765
23766EOM
23767	case "$static_ext" in
23768	'') dflt="$avail_ext" ;;
23769	*)	dflt="$static_ext"
23770		# Perhaps we are reusing an old out-of-date config.sh.
23771		case "$hint" in
23772		previous)
23773			if test X"$static_ext" != X"$avail_ext"; then
23774				$cat <<EOM
23775NOTICE:  Your previous config.sh list may be incorrect.
23776The extensions now available to you are
23777	${avail_ext}
23778but the default list from your previous config.sh is
23779	${static_ext}
23780
23781EOM
23782			fi
23783			;;
23784		esac
23785		;;
23786	esac
23787	: Exclude those that are not xs extensions
23788	case "$dflt" in
23789	'')	dflt=none;;
23790	esac
23791	rp="What extensions do you wish to include?"
23792	. ./myread
23793	case "$ans" in
23794	none) static_ext=' ' ;;
23795	*) static_ext="$ans" ;;
23796	esac
23797	;;
23798esac
23799#
23800# Encode is a special case.  If we are building Encode as a static
23801# extension, we need to explicitly list its subextensions as well.
23802# For other nested extensions, this is handled automatically by
23803# the appropriate Makefile.PL.
23804case " $static_ext " in
23805	*" Encode "*) # Add the subextensions of Encode
23806	cd "$rsrc/cpan"
23807	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23808		static_ext="$static_ext Encode/$xxx"
23809		known_extensions="$known_extensions Encode/$xxx"
23810	done
23811	cd "$tdir"
23812	;;
23813esac
23814
23815set X $dynamic_ext $static_ext $nonxs_ext
23816shift
23817extensions="$*"
23818
23819# Sanity check:  We require an extension suitable for use with
23820# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23821# should show up as failures in the test suite, but it's helpful to
23822# catch them now.) The 'extensions' list is normally sorted
23823# alphabetically, so we need to accept either
23824#    DB_File ... Fcntl ... IO  ....
23825# or something like
23826#    Fcntl ... NDBM_File ... IO  ....
23827case " $extensions"  in
23828*"_File "*" Fcntl "*" IO "*) ;; # DB_File
23829*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23830*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23831*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23832   echo "WARNING: The Perl you are building will be quite crippled." >& 4
23833   ;;
23834esac
23835
23836: Remove libraries needed only for extensions
23837: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23838: The exception is SunOS 4.x, which needs them.
23839case "${osname}X${osvers}" in
23840sunos*X4*)
23841    perllibs="$libs"
23842    ;;
23843*) case "$usedl" in
23844    $define|true|[yY]*)
23845	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23846	    shift
23847	    perllibs="$*"
23848	    ;;
23849    *)	perllibs="$libs"
23850	    ;;
23851    esac
23852    ;;
23853esac
23854
23855: Remove build directory name from cppstdin so it can be used from
23856: either the present location or the final installed location.
23857echo " "
23858: Get out of the UU directory to get correct path name.
23859cd ..
23860case "$cppstdin" in
23861`pwd`/cppstdin)
23862	echo "Stripping down cppstdin path name"
23863	cppstdin=cppstdin
23864	;;
23865esac
23866cd UU
23867
23868: end of configuration questions
23869echo " "
23870echo "End of configuration questions."
23871echo " "
23872
23873: back to where it started
23874if test -d ../UU; then
23875	cd ..
23876fi
23877
23878: configuration may be unconditionally patched via a 'config.arch' file
23879if $test -f config.arch; then
23880	echo "I see a config.arch file, loading it." >&4
23881	. ./config.arch
23882fi
23883
23884: configuration may be patched via a 'config.over' file
23885if $test -f config.over; then
23886	echo " "
23887	dflt=y
23888	rp='I see a config.over file.  Do you wish to load it?'
23889	. UU/myread
23890	case "$ans" in
23891	n*) echo "OK, I'll ignore it.";;
23892	*)	. ./config.over
23893		echo "Configuration override changes have been loaded."
23894		;;
23895	esac
23896fi
23897
23898: in case they want portability, strip down executable paths
23899case "$d_portable" in
23900"$define")
23901	echo " "
23902	echo "Stripping down executable paths..." >&4
23903	for file in $loclist $trylist; do
23904		eval temp=\$$file
23905		eval $file=`basename $temp`
23906	done
23907	;;
23908esac
23909
23910: create config.sh file
23911echo " "
23912echo "Creating config.sh..." >&4
23913$spitshell <<EOT >config.sh
23914$startsh
23915#
23916# This file was produced by running the Configure script. It holds all the
23917# definitions figured out by Configure. Should you modify one of these values,
23918# do not forget to propagate your changes by running "Configure -der". You may
23919# instead choose to run each of the .SH files by yourself, or "Configure -S".
23920#
23921
23922# Package name      : $package
23923# Source directory  : $src
23924# Configuration time: $cf_time
23925# Configured by     : $cf_by
23926# Target system     : $myuname
23927
23928EOT
23929: Add in command line options if available
23930$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23931
23932$spitshell <<EOT >>config.sh
23933
23934Author='$Author'
23935Date='$Date'
23936Header='$Header'
23937Id='$Id'
23938Locker='$Locker'
23939Log='$Log'
23940RCSfile='$RCSfile'
23941Revision='$Revision'
23942Source='$Source'
23943State='$State'
23944_a='$_a'
23945_exe='$_exe'
23946_o='$_o'
23947afs='$afs'
23948afsroot='$afsroot'
23949alignbytes='$alignbytes'
23950aphostname='$aphostname'
23951api_revision='$api_revision'
23952api_subversion='$api_subversion'
23953api_version='$api_version'
23954api_versionstring='$api_versionstring'
23955ar='$ar'
23956archlib='$archlib'
23957archlibexp='$archlibexp'
23958archname64='$archname64'
23959archname='$archname'
23960archobjs='$archobjs'
23961asctime_r_proto='$asctime_r_proto'
23962awk='$awk'
23963baserev='$baserev'
23964bash='$bash'
23965bin='$bin'
23966bin_ELF='$bin_ELF'
23967binexp='$binexp'
23968bison='$bison'
23969byacc='$byacc'
23970byteorder='$byteorder'
23971c='$c'
23972castflags='$castflags'
23973cat='$cat'
23974cc='$cc'
23975cccdlflags='$cccdlflags'
23976ccdlflags='$ccdlflags'
23977ccflags='$ccflags'
23978ccflags_uselargefiles='$ccflags_uselargefiles'
23979ccname='$ccname'
23980ccsymbols='$ccsymbols'
23981ccversion='$ccversion'
23982cf_by='$cf_by'
23983cf_email='$cf_email'
23984cf_time='$cf_time'
23985charbits='$charbits'
23986charsize='$charsize'
23987chgrp='$chgrp'
23988chmod='$chmod'
23989chown='$chown'
23990clocktype='$clocktype'
23991comm='$comm'
23992compress='$compress'
23993contains='$contains'
23994cp='$cp'
23995cpio='$cpio'
23996cpp='$cpp'
23997cpp_stuff='$cpp_stuff'
23998cppccsymbols='$cppccsymbols'
23999cppflags='$cppflags'
24000cpplast='$cpplast'
24001cppminus='$cppminus'
24002cpprun='$cpprun'
24003cppstdin='$cppstdin'
24004cppsymbols='$cppsymbols'
24005crypt_r_proto='$crypt_r_proto'
24006cryptlib='$cryptlib'
24007csh='$csh'
24008ctermid_r_proto='$ctermid_r_proto'
24009ctime_r_proto='$ctime_r_proto'
24010d_Gconvert='$d_Gconvert'
24011d_PRIEUldbl='$d_PRIEUldbl'
24012d_PRIFUldbl='$d_PRIFUldbl'
24013d_PRIGUldbl='$d_PRIGUldbl'
24014d_PRIXU64='$d_PRIXU64'
24015d_PRId64='$d_PRId64'
24016d_PRIeldbl='$d_PRIeldbl'
24017d_PRIfldbl='$d_PRIfldbl'
24018d_PRIgldbl='$d_PRIgldbl'
24019d_PRIi64='$d_PRIi64'
24020d_PRIo64='$d_PRIo64'
24021d_PRIu64='$d_PRIu64'
24022d_PRIx64='$d_PRIx64'
24023d_SCNfldbl='$d_SCNfldbl'
24024d__fwalk='$d__fwalk'
24025d_accept4='$d_accept4'
24026d_access='$d_access'
24027d_accessx='$d_accessx'
24028d_acosh='$d_acosh'
24029d_aintl='$d_aintl'
24030d_alarm='$d_alarm'
24031d_archlib='$d_archlib'
24032d_asctime64='$d_asctime64'
24033d_asctime_r='$d_asctime_r'
24034d_asinh='$d_asinh'
24035d_atanh='$d_atanh'
24036d_atolf='$d_atolf'
24037d_atoll='$d_atoll'
24038d_attribute_deprecated='$d_attribute_deprecated'
24039d_attribute_format='$d_attribute_format'
24040d_attribute_malloc='$d_attribute_malloc'
24041d_attribute_nonnull='$d_attribute_nonnull'
24042d_attribute_noreturn='$d_attribute_noreturn'
24043d_attribute_pure='$d_attribute_pure'
24044d_attribute_unused='$d_attribute_unused'
24045d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24046d_backtrace='$d_backtrace'
24047d_bsd='$d_bsd'
24048d_bsdgetpgrp='$d_bsdgetpgrp'
24049d_bsdsetpgrp='$d_bsdsetpgrp'
24050d_builtin_add_overflow='$d_builtin_add_overflow'
24051d_builtin_choose_expr='$d_builtin_choose_expr'
24052d_builtin_expect='$d_builtin_expect'
24053d_builtin_mul_overflow='$d_builtin_mul_overflow'
24054d_builtin_sub_overflow='$d_builtin_sub_overflow'
24055d_c99_variadic_macros='$d_c99_variadic_macros'
24056d_casti32='$d_casti32'
24057d_castneg='$d_castneg'
24058d_cbrt='$d_cbrt'
24059d_chown='$d_chown'
24060d_chroot='$d_chroot'
24061d_chsize='$d_chsize'
24062d_class='$d_class'
24063d_clearenv='$d_clearenv'
24064d_closedir='$d_closedir'
24065d_cmsghdr_s='$d_cmsghdr_s'
24066d_copysign='$d_copysign'
24067d_copysignl='$d_copysignl'
24068d_cplusplus='$d_cplusplus'
24069d_crypt='$d_crypt'
24070d_crypt_r='$d_crypt_r'
24071d_csh='$d_csh'
24072d_ctermid='$d_ctermid'
24073d_ctermid_r='$d_ctermid_r'
24074d_ctime64='$d_ctime64'
24075d_ctime_r='$d_ctime_r'
24076d_cuserid='$d_cuserid'
24077d_dbminitproto='$d_dbminitproto'
24078d_difftime64='$d_difftime64'
24079d_difftime='$d_difftime'
24080d_dir_dd_fd='$d_dir_dd_fd'
24081d_dirfd='$d_dirfd'
24082d_dirnamlen='$d_dirnamlen'
24083d_dladdr='$d_dladdr'
24084d_dlerror='$d_dlerror'
24085d_dlopen='$d_dlopen'
24086d_dlsymun='$d_dlsymun'
24087d_dosuid='$d_dosuid'
24088d_double_has_inf='$d_double_has_inf'
24089d_double_has_nan='$d_double_has_nan'
24090d_double_has_negative_zero='$d_double_has_negative_zero'
24091d_double_has_subnormals='$d_double_has_subnormals'
24092d_double_style_cray='$d_double_style_cray'
24093d_double_style_ibm='$d_double_style_ibm'
24094d_double_style_ieee='$d_double_style_ieee'
24095d_double_style_vax='$d_double_style_vax'
24096d_drand48_r='$d_drand48_r'
24097d_drand48proto='$d_drand48proto'
24098d_dup2='$d_dup2'
24099d_dup3='$d_dup3'
24100d_duplocale='$d_duplocale'
24101d_eaccess='$d_eaccess'
24102d_endgrent='$d_endgrent'
24103d_endgrent_r='$d_endgrent_r'
24104d_endhent='$d_endhent'
24105d_endhostent_r='$d_endhostent_r'
24106d_endnent='$d_endnent'
24107d_endnetent_r='$d_endnetent_r'
24108d_endpent='$d_endpent'
24109d_endprotoent_r='$d_endprotoent_r'
24110d_endpwent='$d_endpwent'
24111d_endpwent_r='$d_endpwent_r'
24112d_endsent='$d_endsent'
24113d_endservent_r='$d_endservent_r'
24114d_eofnblk='$d_eofnblk'
24115d_erf='$d_erf'
24116d_erfc='$d_erfc'
24117d_eunice='$d_eunice'
24118d_exp2='$d_exp2'
24119d_expm1='$d_expm1'
24120d_faststdio='$d_faststdio'
24121d_fchdir='$d_fchdir'
24122d_fchmod='$d_fchmod'
24123d_fchmodat='$d_fchmodat'
24124d_fchown='$d_fchown'
24125d_fcntl='$d_fcntl'
24126d_fcntl_can_lock='$d_fcntl_can_lock'
24127d_fd_macros='$d_fd_macros'
24128d_fd_set='$d_fd_set'
24129d_fdclose='$d_fdclose'
24130d_fdim='$d_fdim'
24131d_fds_bits='$d_fds_bits'
24132d_fegetround='$d_fegetround'
24133d_fgetpos='$d_fgetpos'
24134d_finite='$d_finite'
24135d_finitel='$d_finitel'
24136d_flexfnam='$d_flexfnam'
24137d_flock='$d_flock'
24138d_flockproto='$d_flockproto'
24139d_fma='$d_fma'
24140d_fmax='$d_fmax'
24141d_fmin='$d_fmin'
24142d_fork='$d_fork'
24143d_fp_class='$d_fp_class'
24144d_fp_classify='$d_fp_classify'
24145d_fp_classl='$d_fp_classl'
24146d_fpathconf='$d_fpathconf'
24147d_fpclass='$d_fpclass'
24148d_fpclassify='$d_fpclassify'
24149d_fpclassl='$d_fpclassl'
24150d_fpgetround='$d_fpgetround'
24151d_fpos64_t='$d_fpos64_t'
24152d_freelocale='$d_freelocale'
24153d_frexpl='$d_frexpl'
24154d_fs_data_s='$d_fs_data_s'
24155d_fseeko='$d_fseeko'
24156d_fsetpos='$d_fsetpos'
24157d_fstatfs='$d_fstatfs'
24158d_fstatvfs='$d_fstatvfs'
24159d_fsync='$d_fsync'
24160d_ftello='$d_ftello'
24161d_ftime='$d_ftime'
24162d_futimes='$d_futimes'
24163d_gai_strerror='$d_gai_strerror'
24164d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24165d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24166d_getaddrinfo='$d_getaddrinfo'
24167d_getcwd='$d_getcwd'
24168d_getespwnam='$d_getespwnam'
24169d_getfsstat='$d_getfsstat'
24170d_getgrent='$d_getgrent'
24171d_getgrent_r='$d_getgrent_r'
24172d_getgrgid_r='$d_getgrgid_r'
24173d_getgrnam_r='$d_getgrnam_r'
24174d_getgrps='$d_getgrps'
24175d_gethbyaddr='$d_gethbyaddr'
24176d_gethbyname='$d_gethbyname'
24177d_gethent='$d_gethent'
24178d_gethname='$d_gethname'
24179d_gethostbyaddr_r='$d_gethostbyaddr_r'
24180d_gethostbyname_r='$d_gethostbyname_r'
24181d_gethostent_r='$d_gethostent_r'
24182d_gethostprotos='$d_gethostprotos'
24183d_getitimer='$d_getitimer'
24184d_getlogin='$d_getlogin'
24185d_getlogin_r='$d_getlogin_r'
24186d_getmnt='$d_getmnt'
24187d_getmntent='$d_getmntent'
24188d_getnameinfo='$d_getnameinfo'
24189d_getnbyaddr='$d_getnbyaddr'
24190d_getnbyname='$d_getnbyname'
24191d_getnent='$d_getnent'
24192d_getnetbyaddr_r='$d_getnetbyaddr_r'
24193d_getnetbyname_r='$d_getnetbyname_r'
24194d_getnetent_r='$d_getnetent_r'
24195d_getnetprotos='$d_getnetprotos'
24196d_getpagsz='$d_getpagsz'
24197d_getpbyname='$d_getpbyname'
24198d_getpbynumber='$d_getpbynumber'
24199d_getpent='$d_getpent'
24200d_getpgid='$d_getpgid'
24201d_getpgrp2='$d_getpgrp2'
24202d_getpgrp='$d_getpgrp'
24203d_getppid='$d_getppid'
24204d_getprior='$d_getprior'
24205d_getprotobyname_r='$d_getprotobyname_r'
24206d_getprotobynumber_r='$d_getprotobynumber_r'
24207d_getprotoent_r='$d_getprotoent_r'
24208d_getprotoprotos='$d_getprotoprotos'
24209d_getprpwnam='$d_getprpwnam'
24210d_getpwent='$d_getpwent'
24211d_getpwent_r='$d_getpwent_r'
24212d_getpwnam_r='$d_getpwnam_r'
24213d_getpwuid_r='$d_getpwuid_r'
24214d_getsbyname='$d_getsbyname'
24215d_getsbyport='$d_getsbyport'
24216d_getsent='$d_getsent'
24217d_getservbyname_r='$d_getservbyname_r'
24218d_getservbyport_r='$d_getservbyport_r'
24219d_getservent_r='$d_getservent_r'
24220d_getservprotos='$d_getservprotos'
24221d_getspnam='$d_getspnam'
24222d_getspnam_r='$d_getspnam_r'
24223d_gettimeod='$d_gettimeod'
24224d_gmtime64='$d_gmtime64'
24225d_gmtime_r='$d_gmtime_r'
24226d_gnulibc='$d_gnulibc'
24227d_grpasswd='$d_grpasswd'
24228d_has_C_UTF8='$d_has_C_UTF8'
24229d_hasmntopt='$d_hasmntopt'
24230d_htonl='$d_htonl'
24231d_hypot='$d_hypot'
24232d_ilogb='$d_ilogb'
24233d_ilogbl='$d_ilogbl'
24234d_inc_version_list='$d_inc_version_list'
24235d_inetaton='$d_inetaton'
24236d_inetntop='$d_inetntop'
24237d_inetpton='$d_inetpton'
24238d_int64_t='$d_int64_t'
24239d_ip_mreq='$d_ip_mreq'
24240d_ip_mreq_source='$d_ip_mreq_source'
24241d_ipv6_mreq='$d_ipv6_mreq'
24242d_ipv6_mreq_source='$d_ipv6_mreq_source'
24243d_isascii='$d_isascii'
24244d_isblank='$d_isblank'
24245d_isfinite='$d_isfinite'
24246d_isfinitel='$d_isfinitel'
24247d_isinf='$d_isinf'
24248d_isinfl='$d_isinfl'
24249d_isless='$d_isless'
24250d_isnan='$d_isnan'
24251d_isnanl='$d_isnanl'
24252d_isnormal='$d_isnormal'
24253d_j0='$d_j0'
24254d_j0l='$d_j0l'
24255d_killpg='$d_killpg'
24256d_lc_monetary_2008='$d_lc_monetary_2008'
24257d_lchown='$d_lchown'
24258d_ldbl_dig='$d_ldbl_dig'
24259d_ldexpl='$d_ldexpl'
24260d_lgamma='$d_lgamma'
24261d_lgamma_r='$d_lgamma_r'
24262d_libm_lib_version='$d_libm_lib_version'
24263d_libname_unique='$d_libname_unique'
24264d_link='$d_link'
24265d_linkat='$d_linkat'
24266d_llrint='$d_llrint'
24267d_llrintl='$d_llrintl'
24268d_llround='$d_llround'
24269d_llroundl='$d_llroundl'
24270d_localeconv_l='$d_localeconv_l'
24271d_localtime64='$d_localtime64'
24272d_localtime_r='$d_localtime_r'
24273d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24274d_locconv='$d_locconv'
24275d_lockf='$d_lockf'
24276d_log1p='$d_log1p'
24277d_log2='$d_log2'
24278d_logb='$d_logb'
24279d_long_double_style_ieee='$d_long_double_style_ieee'
24280d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24281d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24282d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24283d_long_double_style_vax='$d_long_double_style_vax'
24284d_longdbl='$d_longdbl'
24285d_longlong='$d_longlong'
24286d_lrint='$d_lrint'
24287d_lrintl='$d_lrintl'
24288d_lround='$d_lround'
24289d_lroundl='$d_lroundl'
24290d_lseekproto='$d_lseekproto'
24291d_lstat='$d_lstat'
24292d_madvise='$d_madvise'
24293d_malloc_good_size='$d_malloc_good_size'
24294d_malloc_size='$d_malloc_size'
24295d_mblen='$d_mblen'
24296d_mbrlen='$d_mbrlen'
24297d_mbrtowc='$d_mbrtowc'
24298d_mbstowcs='$d_mbstowcs'
24299d_mbtowc='$d_mbtowc'
24300d_memmem='$d_memmem'
24301d_memrchr='$d_memrchr'
24302d_mkdir='$d_mkdir'
24303d_mkdtemp='$d_mkdtemp'
24304d_mkfifo='$d_mkfifo'
24305d_mkostemp='$d_mkostemp'
24306d_mkstemp='$d_mkstemp'
24307d_mkstemps='$d_mkstemps'
24308d_mktime64='$d_mktime64'
24309d_mktime='$d_mktime'
24310d_mmap='$d_mmap'
24311d_modfl='$d_modfl'
24312d_modflproto='$d_modflproto'
24313d_mprotect='$d_mprotect'
24314d_msg='$d_msg'
24315d_msg_ctrunc='$d_msg_ctrunc'
24316d_msg_dontroute='$d_msg_dontroute'
24317d_msg_oob='$d_msg_oob'
24318d_msg_peek='$d_msg_peek'
24319d_msg_proxy='$d_msg_proxy'
24320d_msgctl='$d_msgctl'
24321d_msgget='$d_msgget'
24322d_msghdr_s='$d_msghdr_s'
24323d_msgrcv='$d_msgrcv'
24324d_msgsnd='$d_msgsnd'
24325d_msync='$d_msync'
24326d_munmap='$d_munmap'
24327d_mymalloc='$d_mymalloc'
24328d_nan='$d_nan'
24329d_nanosleep='$d_nanosleep'
24330d_ndbm='$d_ndbm'
24331d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24332d_nearbyint='$d_nearbyint'
24333d_newlocale='$d_newlocale'
24334d_nextafter='$d_nextafter'
24335d_nexttoward='$d_nexttoward'
24336d_nice='$d_nice'
24337d_nl_langinfo='$d_nl_langinfo'
24338d_nv_preserves_uv='$d_nv_preserves_uv'
24339d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24340d_off64_t='$d_off64_t'
24341d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24342d_oldpthreads='$d_oldpthreads'
24343d_oldsock='$d_oldsock'
24344d_open3='$d_open3'
24345d_openat='$d_openat'
24346d_pathconf='$d_pathconf'
24347d_pause='$d_pause'
24348d_perl_otherlibdirs='$d_perl_otherlibdirs'
24349d_phostname='$d_phostname'
24350d_pipe2='$d_pipe2'
24351d_pipe='$d_pipe'
24352d_poll='$d_poll'
24353d_portable='$d_portable'
24354d_prctl='$d_prctl'
24355d_prctl_set_name='$d_prctl_set_name'
24356d_printf_format_null='$d_printf_format_null'
24357d_procselfexe='$d_procselfexe'
24358d_pseudofork='$d_pseudofork'
24359d_pthread_atfork='$d_pthread_atfork'
24360d_pthread_attr_setscope='$d_pthread_attr_setscope'
24361d_pthread_yield='$d_pthread_yield'
24362d_ptrdiff_t='$d_ptrdiff_t'
24363d_pwage='$d_pwage'
24364d_pwchange='$d_pwchange'
24365d_pwclass='$d_pwclass'
24366d_pwcomment='$d_pwcomment'
24367d_pwexpire='$d_pwexpire'
24368d_pwgecos='$d_pwgecos'
24369d_pwpasswd='$d_pwpasswd'
24370d_pwquota='$d_pwquota'
24371d_qgcvt='$d_qgcvt'
24372d_quad='$d_quad'
24373d_querylocale='$d_querylocale'
24374d_random_r='$d_random_r'
24375d_re_comp='$d_re_comp'
24376d_readdir64_r='$d_readdir64_r'
24377d_readdir='$d_readdir'
24378d_readdir_r='$d_readdir_r'
24379d_readlink='$d_readlink'
24380d_readv='$d_readv'
24381d_recvmsg='$d_recvmsg'
24382d_regcmp='$d_regcmp'
24383d_regcomp='$d_regcomp'
24384d_remainder='$d_remainder'
24385d_remquo='$d_remquo'
24386d_rename='$d_rename'
24387d_renameat='$d_renameat'
24388d_rewinddir='$d_rewinddir'
24389d_rint='$d_rint'
24390d_rmdir='$d_rmdir'
24391d_round='$d_round'
24392d_sbrkproto='$d_sbrkproto'
24393d_scalbn='$d_scalbn'
24394d_scalbnl='$d_scalbnl'
24395d_sched_yield='$d_sched_yield'
24396d_scm_rights='$d_scm_rights'
24397d_seekdir='$d_seekdir'
24398d_select='$d_select'
24399d_sem='$d_sem'
24400d_semctl='$d_semctl'
24401d_semctl_semid_ds='$d_semctl_semid_ds'
24402d_semctl_semun='$d_semctl_semun'
24403d_semget='$d_semget'
24404d_semop='$d_semop'
24405d_sendmsg='$d_sendmsg'
24406d_setegid='$d_setegid'
24407d_seteuid='$d_seteuid'
24408d_setgrent='$d_setgrent'
24409d_setgrent_r='$d_setgrent_r'
24410d_setgrps='$d_setgrps'
24411d_sethent='$d_sethent'
24412d_sethostent_r='$d_sethostent_r'
24413d_setitimer='$d_setitimer'
24414d_setlinebuf='$d_setlinebuf'
24415d_setlocale='$d_setlocale'
24416d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24417d_setlocale_r='$d_setlocale_r'
24418d_setnent='$d_setnent'
24419d_setnetent_r='$d_setnetent_r'
24420d_setpent='$d_setpent'
24421d_setpgid='$d_setpgid'
24422d_setpgrp2='$d_setpgrp2'
24423d_setpgrp='$d_setpgrp'
24424d_setprior='$d_setprior'
24425d_setproctitle='$d_setproctitle'
24426d_setprotoent_r='$d_setprotoent_r'
24427d_setpwent='$d_setpwent'
24428d_setpwent_r='$d_setpwent_r'
24429d_setregid='$d_setregid'
24430d_setresgid='$d_setresgid'
24431d_setresuid='$d_setresuid'
24432d_setreuid='$d_setreuid'
24433d_setrgid='$d_setrgid'
24434d_setruid='$d_setruid'
24435d_setsent='$d_setsent'
24436d_setservent_r='$d_setservent_r'
24437d_setsid='$d_setsid'
24438d_setvbuf='$d_setvbuf'
24439d_shm='$d_shm'
24440d_shmat='$d_shmat'
24441d_shmatprototype='$d_shmatprototype'
24442d_shmctl='$d_shmctl'
24443d_shmdt='$d_shmdt'
24444d_shmget='$d_shmget'
24445d_sigaction='$d_sigaction'
24446d_siginfo_si_addr='$d_siginfo_si_addr'
24447d_siginfo_si_band='$d_siginfo_si_band'
24448d_siginfo_si_errno='$d_siginfo_si_errno'
24449d_siginfo_si_fd='$d_siginfo_si_fd'
24450d_siginfo_si_pid='$d_siginfo_si_pid'
24451d_siginfo_si_status='$d_siginfo_si_status'
24452d_siginfo_si_uid='$d_siginfo_si_uid'
24453d_siginfo_si_value='$d_siginfo_si_value'
24454d_signbit='$d_signbit'
24455d_sigprocmask='$d_sigprocmask'
24456d_sigsetjmp='$d_sigsetjmp'
24457d_sin6_scope_id='$d_sin6_scope_id'
24458d_sitearch='$d_sitearch'
24459d_snprintf='$d_snprintf'
24460d_sockaddr_in6='$d_sockaddr_in6'
24461d_sockaddr_sa_len='$d_sockaddr_sa_len'
24462d_sockatmark='$d_sockatmark'
24463d_sockatmarkproto='$d_sockatmarkproto'
24464d_socket='$d_socket'
24465d_socklen_t='$d_socklen_t'
24466d_sockpair='$d_sockpair'
24467d_socks5_init='$d_socks5_init'
24468d_sqrtl='$d_sqrtl'
24469d_srand48_r='$d_srand48_r'
24470d_srandom_r='$d_srandom_r'
24471d_sresgproto='$d_sresgproto'
24472d_sresuproto='$d_sresuproto'
24473d_stat='$d_stat'
24474d_statblks='$d_statblks'
24475d_statfs_f_flags='$d_statfs_f_flags'
24476d_statfs_s='$d_statfs_s'
24477d_static_inline='$d_static_inline'
24478d_statvfs='$d_statvfs'
24479d_stdio_cnt_lval='$d_stdio_cnt_lval'
24480d_stdio_ptr_lval='$d_stdio_ptr_lval'
24481d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24482d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24483d_stdio_stream_array='$d_stdio_stream_array'
24484d_stdiobase='$d_stdiobase'
24485d_stdstdio='$d_stdstdio'
24486d_strcoll='$d_strcoll'
24487d_strerror_l='$d_strerror_l'
24488d_strerror_r='$d_strerror_r'
24489d_strftime='$d_strftime'
24490d_strlcat='$d_strlcat'
24491d_strlcpy='$d_strlcpy'
24492d_strnlen='$d_strnlen'
24493d_strtod='$d_strtod'
24494d_strtod_l='$d_strtod_l'
24495d_strtol='$d_strtol'
24496d_strtold='$d_strtold'
24497d_strtold_l='$d_strtold_l'
24498d_strtoll='$d_strtoll'
24499d_strtoq='$d_strtoq'
24500d_strtoul='$d_strtoul'
24501d_strtoull='$d_strtoull'
24502d_strtouq='$d_strtouq'
24503d_strxfrm='$d_strxfrm'
24504d_suidsafe='$d_suidsafe'
24505d_symlink='$d_symlink'
24506d_syscall='$d_syscall'
24507d_syscallproto='$d_syscallproto'
24508d_sysconf='$d_sysconf'
24509d_sysernlst='$d_sysernlst'
24510d_syserrlst='$d_syserrlst'
24511d_system='$d_system'
24512d_tcgetpgrp='$d_tcgetpgrp'
24513d_tcsetpgrp='$d_tcsetpgrp'
24514d_telldir='$d_telldir'
24515d_telldirproto='$d_telldirproto'
24516d_tgamma='$d_tgamma'
24517d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24518d_time='$d_time'
24519d_timegm='$d_timegm'
24520d_times='$d_times'
24521d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24522d_tm_tm_zone='$d_tm_tm_zone'
24523d_tmpnam_r='$d_tmpnam_r'
24524d_towlower='$d_towlower'
24525d_towupper='$d_towupper'
24526d_trunc='$d_trunc'
24527d_truncate='$d_truncate'
24528d_truncl='$d_truncl'
24529d_ttyname_r='$d_ttyname_r'
24530d_tzname='$d_tzname'
24531d_u32align='$d_u32align'
24532d_ualarm='$d_ualarm'
24533d_umask='$d_umask'
24534d_uname='$d_uname'
24535d_union_semun='$d_union_semun'
24536d_unlinkat='$d_unlinkat'
24537d_unordered='$d_unordered'
24538d_unsetenv='$d_unsetenv'
24539d_uselocale='$d_uselocale'
24540d_usleep='$d_usleep'
24541d_usleepproto='$d_usleepproto'
24542d_ustat='$d_ustat'
24543d_vendorarch='$d_vendorarch'
24544d_vendorbin='$d_vendorbin'
24545d_vendorlib='$d_vendorlib'
24546d_vendorscript='$d_vendorscript'
24547d_vfork='$d_vfork'
24548d_void_closedir='$d_void_closedir'
24549d_voidsig='$d_voidsig'
24550d_voidtty='$d_voidtty'
24551d_vsnprintf='$d_vsnprintf'
24552d_wait4='$d_wait4'
24553d_waitpid='$d_waitpid'
24554d_wcscmp='$d_wcscmp'
24555d_wcstombs='$d_wcstombs'
24556d_wcsxfrm='$d_wcsxfrm'
24557d_wctomb='$d_wctomb'
24558d_writev='$d_writev'
24559d_xenix='$d_xenix'
24560date='$date'
24561db_hashtype='$db_hashtype'
24562db_prefixtype='$db_prefixtype'
24563db_version_major='$db_version_major'
24564db_version_minor='$db_version_minor'
24565db_version_patch='$db_version_patch'
24566default_inc_excludes_dot='$default_inc_excludes_dot'
24567direntrytype='$direntrytype'
24568dlext='$dlext'
24569dlsrc='$dlsrc'
24570doubleinfbytes='$doubleinfbytes'
24571doublekind='$doublekind'
24572doublemantbits='$doublemantbits'
24573doublenanbytes='$doublenanbytes'
24574doublesize='$doublesize'
24575drand01='$drand01'
24576drand48_r_proto='$drand48_r_proto'
24577dtrace='$dtrace'
24578dtraceobject='$dtraceobject'
24579dtracexnolibs='$dtracexnolibs'
24580dynamic_ext='$dynamic_ext'
24581eagain='$eagain'
24582ebcdic='$ebcdic'
24583echo='$echo'
24584egrep='$egrep'
24585emacs='$emacs'
24586endgrent_r_proto='$endgrent_r_proto'
24587endhostent_r_proto='$endhostent_r_proto'
24588endnetent_r_proto='$endnetent_r_proto'
24589endprotoent_r_proto='$endprotoent_r_proto'
24590endpwent_r_proto='$endpwent_r_proto'
24591endservent_r_proto='$endservent_r_proto'
24592eunicefix='$eunicefix'
24593exe_ext='$exe_ext'
24594expr='$expr'
24595extensions='$extensions'
24596extern_C='$extern_C'
24597extras='$extras'
24598fflushNULL='$fflushNULL'
24599fflushall='$fflushall'
24600find='$find'
24601firstmakefile='$firstmakefile'
24602flex='$flex'
24603fpossize='$fpossize'
24604fpostype='$fpostype'
24605freetype='$freetype'
24606from='$from'
24607full_ar='$full_ar'
24608full_csh='$full_csh'
24609full_sed='$full_sed'
24610gccansipedantic='$gccansipedantic'
24611gccosandvers='$gccosandvers'
24612gccversion='$gccversion'
24613getgrent_r_proto='$getgrent_r_proto'
24614getgrgid_r_proto='$getgrgid_r_proto'
24615getgrnam_r_proto='$getgrnam_r_proto'
24616gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24617gethostbyname_r_proto='$gethostbyname_r_proto'
24618gethostent_r_proto='$gethostent_r_proto'
24619getlogin_r_proto='$getlogin_r_proto'
24620getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24621getnetbyname_r_proto='$getnetbyname_r_proto'
24622getnetent_r_proto='$getnetent_r_proto'
24623getprotobyname_r_proto='$getprotobyname_r_proto'
24624getprotobynumber_r_proto='$getprotobynumber_r_proto'
24625getprotoent_r_proto='$getprotoent_r_proto'
24626getpwent_r_proto='$getpwent_r_proto'
24627getpwnam_r_proto='$getpwnam_r_proto'
24628getpwuid_r_proto='$getpwuid_r_proto'
24629getservbyname_r_proto='$getservbyname_r_proto'
24630getservbyport_r_proto='$getservbyport_r_proto'
24631getservent_r_proto='$getservent_r_proto'
24632getspnam_r_proto='$getspnam_r_proto'
24633gidformat='$gidformat'
24634gidsign='$gidsign'
24635gidsize='$gidsize'
24636gidtype='$gidtype'
24637glibpth='$glibpth'
24638gmake='$gmake'
24639gmtime_r_proto='$gmtime_r_proto'
24640gnulibc_version='$gnulibc_version'
24641grep='$grep'
24642groupcat='$groupcat'
24643groupstype='$groupstype'
24644gzip='$gzip'
24645h_fcntl='$h_fcntl'
24646h_sysfile='$h_sysfile'
24647hint='$hint'
24648hostcat='$hostcat'
24649hostgenerate='$hostgenerate'
24650hostosname='$hostosname'
24651hostperl='$hostperl'
24652html1dir='$html1dir'
24653html1direxp='$html1direxp'
24654html3dir='$html3dir'
24655html3direxp='$html3direxp'
24656i16size='$i16size'
24657i16type='$i16type'
24658i32size='$i32size'
24659i32type='$i32type'
24660i64size='$i64size'
24661i64type='$i64type'
24662i8size='$i8size'
24663i8type='$i8type'
24664i_arpainet='$i_arpainet'
24665i_bfd='$i_bfd'
24666i_bsdioctl='$i_bsdioctl'
24667i_crypt='$i_crypt'
24668i_db='$i_db'
24669i_dbm='$i_dbm'
24670i_dirent='$i_dirent'
24671i_dlfcn='$i_dlfcn'
24672i_execinfo='$i_execinfo'
24673i_fcntl='$i_fcntl'
24674i_fenv='$i_fenv'
24675i_fp='$i_fp'
24676i_fp_class='$i_fp_class'
24677i_gdbm='$i_gdbm'
24678i_gdbm_ndbm='$i_gdbm_ndbm'
24679i_gdbmndbm='$i_gdbmndbm'
24680i_grp='$i_grp'
24681i_ieeefp='$i_ieeefp'
24682i_inttypes='$i_inttypes'
24683i_langinfo='$i_langinfo'
24684i_libutil='$i_libutil'
24685i_locale='$i_locale'
24686i_machcthr='$i_machcthr'
24687i_malloc='$i_malloc'
24688i_mallocmalloc='$i_mallocmalloc'
24689i_mntent='$i_mntent'
24690i_ndbm='$i_ndbm'
24691i_netdb='$i_netdb'
24692i_neterrno='$i_neterrno'
24693i_netinettcp='$i_netinettcp'
24694i_niin='$i_niin'
24695i_poll='$i_poll'
24696i_prot='$i_prot'
24697i_pthread='$i_pthread'
24698i_pwd='$i_pwd'
24699i_quadmath='$i_quadmath'
24700i_rpcsvcdbm='$i_rpcsvcdbm'
24701i_sgtty='$i_sgtty'
24702i_shadow='$i_shadow'
24703i_socks='$i_socks'
24704i_stdbool='$i_stdbool'
24705i_stdint='$i_stdint'
24706i_stdlib='$i_stdlib'
24707i_sunmath='$i_sunmath'
24708i_sysaccess='$i_sysaccess'
24709i_sysdir='$i_sysdir'
24710i_sysfile='$i_sysfile'
24711i_sysfilio='$i_sysfilio'
24712i_sysin='$i_sysin'
24713i_sysioctl='$i_sysioctl'
24714i_syslog='$i_syslog'
24715i_sysmman='$i_sysmman'
24716i_sysmode='$i_sysmode'
24717i_sysmount='$i_sysmount'
24718i_sysndir='$i_sysndir'
24719i_sysparam='$i_sysparam'
24720i_syspoll='$i_syspoll'
24721i_sysresrc='$i_sysresrc'
24722i_syssecrt='$i_syssecrt'
24723i_sysselct='$i_sysselct'
24724i_syssockio='$i_syssockio'
24725i_sysstat='$i_sysstat'
24726i_sysstatfs='$i_sysstatfs'
24727i_sysstatvfs='$i_sysstatvfs'
24728i_systime='$i_systime'
24729i_systimek='$i_systimek'
24730i_systimes='$i_systimes'
24731i_systypes='$i_systypes'
24732i_sysuio='$i_sysuio'
24733i_sysun='$i_sysun'
24734i_sysutsname='$i_sysutsname'
24735i_sysvfs='$i_sysvfs'
24736i_syswait='$i_syswait'
24737i_termio='$i_termio'
24738i_termios='$i_termios'
24739i_time='$i_time'
24740i_unistd='$i_unistd'
24741i_ustat='$i_ustat'
24742i_utime='$i_utime'
24743i_vfork='$i_vfork'
24744i_wchar='$i_wchar'
24745i_wctype='$i_wctype'
24746i_xlocale='$i_xlocale'
24747ignore_versioned_solibs='$ignore_versioned_solibs'
24748inc_version_list='$inc_version_list'
24749inc_version_list_init='$inc_version_list_init'
24750incpath='$incpath'
24751incpth='$incpth'
24752inews='$inews'
24753initialinstalllocation='$initialinstalllocation'
24754installarchlib='$installarchlib'
24755installbin='$installbin'
24756installhtml1dir='$installhtml1dir'
24757installhtml3dir='$installhtml3dir'
24758installman1dir='$installman1dir'
24759installman3dir='$installman3dir'
24760installprefix='$installprefix'
24761installprefixexp='$installprefixexp'
24762installprivlib='$installprivlib'
24763installscript='$installscript'
24764installsitearch='$installsitearch'
24765installsitebin='$installsitebin'
24766installsitehtml1dir='$installsitehtml1dir'
24767installsitehtml3dir='$installsitehtml3dir'
24768installsitelib='$installsitelib'
24769installsiteman1dir='$installsiteman1dir'
24770installsiteman3dir='$installsiteman3dir'
24771installsitescript='$installsitescript'
24772installstyle='$installstyle'
24773installusrbinperl='$installusrbinperl'
24774installvendorarch='$installvendorarch'
24775installvendorbin='$installvendorbin'
24776installvendorhtml1dir='$installvendorhtml1dir'
24777installvendorhtml3dir='$installvendorhtml3dir'
24778installvendorlib='$installvendorlib'
24779installvendorman1dir='$installvendorman1dir'
24780installvendorman3dir='$installvendorman3dir'
24781installvendorscript='$installvendorscript'
24782intsize='$intsize'
24783issymlink='$issymlink'
24784ivdformat='$ivdformat'
24785ivsize='$ivsize'
24786ivtype='$ivtype'
24787known_extensions='$known_extensions'
24788ksh='$ksh'
24789ld='$ld'
24790ld_can_script='$ld_can_script'
24791lddlflags='$lddlflags'
24792ldflags='$ldflags'
24793ldflags_uselargefiles='$ldflags_uselargefiles'
24794ldlibpthname='$ldlibpthname'
24795less='$less'
24796lib_ext='$lib_ext'
24797libc='$libc'
24798libperl='$libperl'
24799libpth='$libpth'
24800libs='$libs'
24801libsdirs='$libsdirs'
24802libsfiles='$libsfiles'
24803libsfound='$libsfound'
24804libspath='$libspath'
24805libswanted='$libswanted'
24806libswanted_uselargefiles='$libswanted_uselargefiles'
24807line='$line'
24808lint='$lint'
24809lkflags='$lkflags'
24810ln='$ln'
24811lns='$lns'
24812localtime_r_proto='$localtime_r_proto'
24813locincpth='$locincpth'
24814loclibpth='$loclibpth'
24815longdblinfbytes='$longdblinfbytes'
24816longdblkind='$longdblkind'
24817longdblmantbits='$longdblmantbits'
24818longdblnanbytes='$longdblnanbytes'
24819longdblsize='$longdblsize'
24820longlongsize='$longlongsize'
24821longsize='$longsize'
24822lp='$lp'
24823lpr='$lpr'
24824ls='$ls'
24825lseeksize='$lseeksize'
24826lseektype='$lseektype'
24827mail='$mail'
24828mailx='$mailx'
24829make='$make'
24830make_set_make='$make_set_make'
24831mallocobj='$mallocobj'
24832mallocsrc='$mallocsrc'
24833malloctype='$malloctype'
24834man1dir='$man1dir'
24835man1direxp='$man1direxp'
24836man1ext='$man1ext'
24837man3dir='$man3dir'
24838man3direxp='$man3direxp'
24839man3ext='$man3ext'
24840mips_type='$mips_type'
24841mistrustnm='$mistrustnm'
24842mkdir='$mkdir'
24843mmaptype='$mmaptype'
24844modetype='$modetype'
24845more='$more'
24846multiarch='$multiarch'
24847mv='$mv'
24848myarchname='$myarchname'
24849mydomain='$mydomain'
24850myhostname='$myhostname'
24851myuname='$myuname'
24852n='$n'
24853need_va_copy='$need_va_copy'
24854netdb_hlen_type='$netdb_hlen_type'
24855netdb_host_type='$netdb_host_type'
24856netdb_name_type='$netdb_name_type'
24857netdb_net_type='$netdb_net_type'
24858nm='$nm'
24859nm_opt='$nm_opt'
24860nm_so_opt='$nm_so_opt'
24861nonxs_ext='$nonxs_ext'
24862nroff='$nroff'
24863nvEUformat='$nvEUformat'
24864nvFUformat='$nvFUformat'
24865nvGUformat='$nvGUformat'
24866nv_overflows_integers_at='$nv_overflows_integers_at'
24867nv_preserves_uv_bits='$nv_preserves_uv_bits'
24868nveformat='$nveformat'
24869nvfformat='$nvfformat'
24870nvgformat='$nvgformat'
24871nvmantbits='$nvmantbits'
24872nvsize='$nvsize'
24873nvtype='$nvtype'
24874o_nonblock='$o_nonblock'
24875obj_ext='$obj_ext'
24876old_pthread_create_joinable='$old_pthread_create_joinable'
24877optimize='$optimize'
24878orderlib='$orderlib'
24879osname='$osname'
24880osvers='$osvers'
24881otherlibdirs='$otherlibdirs'
24882package='$package'
24883pager='$pager'
24884passcat='$passcat'
24885patchlevel='$patchlevel'
24886path_sep='$path_sep'
24887perl5='$perl5'
24888perl='$perl'
24889perl_patchlevel='$perl_patchlevel'
24890perl_static_inline='$perl_static_inline'
24891perladmin='$perladmin'
24892perllibs='$perllibs'
24893perlpath='$perlpath'
24894pg='$pg'
24895phostname='$phostname'
24896pidtype='$pidtype'
24897plibpth='$plibpth'
24898pmake='$pmake'
24899pr='$pr'
24900prefix='$prefix'
24901prefixexp='$prefixexp'
24902privlib='$privlib'
24903privlibexp='$privlibexp'
24904procselfexe='$procselfexe'
24905ptrsize='$ptrsize'
24906quadkind='$quadkind'
24907quadtype='$quadtype'
24908randbits='$randbits'
24909randfunc='$randfunc'
24910random_r_proto='$random_r_proto'
24911randseedtype='$randseedtype'
24912ranlib='$ranlib'
24913rd_nodata='$rd_nodata'
24914readdir64_r_proto='$readdir64_r_proto'
24915readdir_r_proto='$readdir_r_proto'
24916revision='$revision'
24917rm='$rm'
24918rm_try='$rm_try'
24919rmail='$rmail'
24920run='$run'
24921runnm='$runnm'
24922sGMTIME_max='$sGMTIME_max'
24923sGMTIME_min='$sGMTIME_min'
24924sLOCALTIME_max='$sLOCALTIME_max'
24925sLOCALTIME_min='$sLOCALTIME_min'
24926sPRIEUldbl='$sPRIEUldbl'
24927sPRIFUldbl='$sPRIFUldbl'
24928sPRIGUldbl='$sPRIGUldbl'
24929sPRIXU64='$sPRIXU64'
24930sPRId64='$sPRId64'
24931sPRIeldbl='$sPRIeldbl'
24932sPRIfldbl='$sPRIfldbl'
24933sPRIgldbl='$sPRIgldbl'
24934sPRIi64='$sPRIi64'
24935sPRIo64='$sPRIo64'
24936sPRIu64='$sPRIu64'
24937sPRIx64='$sPRIx64'
24938sSCNfldbl='$sSCNfldbl'
24939sched_yield='$sched_yield'
24940scriptdir='$scriptdir'
24941scriptdirexp='$scriptdirexp'
24942sed='$sed'
24943seedfunc='$seedfunc'
24944selectminbits='$selectminbits'
24945selecttype='$selecttype'
24946sendmail='$sendmail'
24947setgrent_r_proto='$setgrent_r_proto'
24948sethostent_r_proto='$sethostent_r_proto'
24949setlocale_r_proto='$setlocale_r_proto'
24950setnetent_r_proto='$setnetent_r_proto'
24951setprotoent_r_proto='$setprotoent_r_proto'
24952setpwent_r_proto='$setpwent_r_proto'
24953setservent_r_proto='$setservent_r_proto'
24954sh='$sh'
24955shar='$shar'
24956sharpbang='$sharpbang'
24957shmattype='$shmattype'
24958shortsize='$shortsize'
24959shrpenv='$shrpenv'
24960shsharp='$shsharp'
24961sig_count='$sig_count'
24962sig_name='$sig_name'
24963sig_name_init='$sig_name_init'
24964sig_num='$sig_num'
24965sig_num_init='$sig_num_init'
24966sig_size='$sig_size'
24967signal_t='$signal_t'
24968sitearch='$sitearch'
24969sitearchexp='$sitearchexp'
24970sitebin='$sitebin'
24971sitebinexp='$sitebinexp'
24972sitehtml1dir='$sitehtml1dir'
24973sitehtml1direxp='$sitehtml1direxp'
24974sitehtml3dir='$sitehtml3dir'
24975sitehtml3direxp='$sitehtml3direxp'
24976sitelib='$sitelib'
24977sitelib_stem='$sitelib_stem'
24978sitelibexp='$sitelibexp'
24979siteman1dir='$siteman1dir'
24980siteman1direxp='$siteman1direxp'
24981siteman3dir='$siteman3dir'
24982siteman3direxp='$siteman3direxp'
24983siteprefix='$siteprefix'
24984siteprefixexp='$siteprefixexp'
24985sitescript='$sitescript'
24986sitescriptexp='$sitescriptexp'
24987sizesize='$sizesize'
24988sizetype='$sizetype'
24989sleep='$sleep'
24990smail='$smail'
24991so='$so'
24992sockethdr='$sockethdr'
24993socketlib='$socketlib'
24994socksizetype='$socksizetype'
24995sort='$sort'
24996spackage='$spackage'
24997spitshell='$spitshell'
24998srand48_r_proto='$srand48_r_proto'
24999srandom_r_proto='$srandom_r_proto'
25000src='$src'
25001ssizetype='$ssizetype'
25002st_ino_sign='$st_ino_sign'
25003st_ino_size='$st_ino_size'
25004startperl='$startperl'
25005startsh='$startsh'
25006static_ext='$static_ext'
25007stdchar='$stdchar'
25008stdio_base='$stdio_base'
25009stdio_bufsiz='$stdio_bufsiz'
25010stdio_cnt='$stdio_cnt'
25011stdio_filbuf='$stdio_filbuf'
25012stdio_ptr='$stdio_ptr'
25013stdio_stream_array='$stdio_stream_array'
25014strerror_r_proto='$strerror_r_proto'
25015submit='$submit'
25016subversion='$subversion'
25017sysman='$sysman'
25018sysroot='$sysroot'
25019tail='$tail'
25020tar='$tar'
25021targetarch='$targetarch'
25022targetdir='$targetdir'
25023targetenv='$targetenv'
25024targethost='$targethost'
25025targetmkdir='$targetmkdir'
25026targetport='$targetport'
25027targetsh='$targetsh'
25028tbl='$tbl'
25029tee='$tee'
25030test='$test'
25031timeincl='$timeincl'
25032timetype='$timetype'
25033tmpnam_r_proto='$tmpnam_r_proto'
25034to='$to'
25035touch='$touch'
25036tr='$tr'
25037trnl='$trnl'
25038troff='$troff'
25039ttyname_r_proto='$ttyname_r_proto'
25040u16size='$u16size'
25041u16type='$u16type'
25042u32size='$u32size'
25043u32type='$u32type'
25044u64size='$u64size'
25045u64type='$u64type'
25046u8size='$u8size'
25047u8type='$u8type'
25048uidformat='$uidformat'
25049uidsign='$uidsign'
25050uidsize='$uidsize'
25051uidtype='$uidtype'
25052uname='$uname'
25053uniq='$uniq'
25054uquadtype='$uquadtype'
25055use5005threads='$use5005threads'
25056use64bitall='$use64bitall'
25057use64bitint='$use64bitint'
25058usecbacktrace='$usecbacktrace'
25059usecrosscompile='$usecrosscompile'
25060usedevel='$usedevel'
25061usedl='$usedl'
25062usedtrace='$usedtrace'
25063usefaststdio='$usefaststdio'
25064useithreads='$useithreads'
25065usekernprocpathname='$usekernprocpathname'
25066uselanginfo='$uselanginfo'
25067uselargefiles='$uselargefiles'
25068uselongdouble='$uselongdouble'
25069usemallocwrap='$usemallocwrap'
25070usemorebits='$usemorebits'
25071usemultiplicity='$usemultiplicity'
25072usemymalloc='$usemymalloc'
25073usenm='$usenm'
25074usensgetexecutablepath='$usensgetexecutablepath'
25075useopcode='$useopcode'
25076useperlio='$useperlio'
25077useposix='$useposix'
25078usequadmath='$usequadmath'
25079usereentrant='$usereentrant'
25080userelocatableinc='$userelocatableinc'
25081useshrplib='$useshrplib'
25082usesitecustomize='$usesitecustomize'
25083usesocks='$usesocks'
25084usethreads='$usethreads'
25085usevendorprefix='$usevendorprefix'
25086useversionedarchname='$useversionedarchname'
25087usevfork='$usevfork'
25088usrinc='$usrinc'
25089uuname='$uuname'
25090uvXUformat='$uvXUformat'
25091uvoformat='$uvoformat'
25092uvsize='$uvsize'
25093uvtype='$uvtype'
25094uvuformat='$uvuformat'
25095uvxformat='$uvxformat'
25096vendorarch='$vendorarch'
25097vendorarchexp='$vendorarchexp'
25098vendorbin='$vendorbin'
25099vendorbinexp='$vendorbinexp'
25100vendorhtml1dir='$vendorhtml1dir'
25101vendorhtml1direxp='$vendorhtml1direxp'
25102vendorhtml3dir='$vendorhtml3dir'
25103vendorhtml3direxp='$vendorhtml3direxp'
25104vendorlib='$vendorlib'
25105vendorlib_stem='$vendorlib_stem'
25106vendorlibexp='$vendorlibexp'
25107vendorman1dir='$vendorman1dir'
25108vendorman1direxp='$vendorman1direxp'
25109vendorman3dir='$vendorman3dir'
25110vendorman3direxp='$vendorman3direxp'
25111vendorprefix='$vendorprefix'
25112vendorprefixexp='$vendorprefixexp'
25113vendorscript='$vendorscript'
25114vendorscriptexp='$vendorscriptexp'
25115version='$version'
25116version_patchlevel_string='$version_patchlevel_string'
25117versiononly='$versiononly'
25118vi='$vi'
25119xlibpth='$xlibpth'
25120yacc='$yacc'
25121yaccflags='$yaccflags'
25122zcat='$zcat'
25123zip='$zip'
25124EOT
25125
25126: add special variables
25127$test -f $src/patchlevel.h && \
25128awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25129echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25130echo "PERL_CONFIG_SH=true" >>config.sh
25131
25132: propagate old symbols
25133if $test -f UU/config.sh; then
25134	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
25135	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25136		config.sh config.sh UU/oldconfig.sh |\
25137		$sort | $uniq -u >UU/oldsyms
25138	set X `$cat UU/oldsyms`
25139	shift
25140	case $# in
25141	0) ;;
25142	*)
25143		$cat <<EOM
25144Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25145EOM
25146		echo ": Variables propagated from previous config.sh file." >>config.sh
25147		for sym in `$cat UU/oldsyms`; do
25148			echo "    Propagating $hint variable "'$'"$sym..."
25149			eval 'tmp="$'"${sym}"'"'
25150			echo "$tmp" | \
25151				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25152		done
25153		;;
25154	esac
25155fi
25156
25157: preserve RCS keywords in files with variable substitution, grrr
25158Id='$Id'
25159
25160: Finish up by extracting the .SH files
25161case "$alldone" in
25162exit)
25163	echo "Stopping at your request, leaving temporary files around."
25164	exit 0
25165	;;
25166cont)
25167	;;
25168'')
25169	dflt=''
25170	nostick=true
25171	$cat <<EOM
25172
25173If you'd like to make any changes to the config.sh file before I begin
25174to configure things, do it as a shell escape now (e.g. !vi config.sh).
25175
25176EOM
25177	rp="Press return or use a shell escape to edit config.sh:"
25178	. UU/myread
25179	nostick=''
25180	case "$ans" in
25181	'') ;;
25182	*) : in case they cannot read
25183		sh 1>&4 -c "$ans";;
25184	esac
25185	;;
25186esac
25187
25188: if this fails, just run all the .SH files by hand
25189. ./config.sh
25190
25191echo " "
25192exec 1>&4
25193pwd=`pwd`
25194. ./UU/extract
25195cd "$pwd"
25196
25197if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25198	dflt=y
25199	case "$silent" in
25200	true) ;;
25201	*)
25202		$cat <<EOM
25203
25204Now you need to generate make dependencies by running "$make depend".
25205You might prefer to run it in background: "$make depend > makedepend.out &"
25206It can take a while, so you might not want to run it right now.
25207
25208EOM
25209		;;
25210	esac
25211	rp="Run $make depend now?"
25212	. UU/myread
25213	case "$ans" in
25214	y*)
25215		$make depend && echo "Now you must run '$make'."
25216		;;
25217	*)
25218		echo "You must run '$make depend' then '$make'."
25219		;;
25220	esac
25221elif test -f [Mm]akefile; then
25222	echo " "
25223	echo "Now you must run a $make."
25224else
25225	echo "Configure done."
25226fi
25227
25228if $test -f Policy.sh; then
25229    $cat <<EOM
25230
25231If you compile $package on a different machine or from a different object
25232directory, copy the Policy.sh file from this object directory to the
25233new one before you run Configure -- this will help you with most of
25234the policy defaults.
25235
25236EOM
25237fi
25238if $test -f UU/config.msg; then
25239    echo "Hmm.  I also noted the following information while running:"
25240    echo " "
25241    $cat UU/config.msg >&4
25242fi
25243$rm -f kit*isdone ark*isdone
25244$rm -rf UU
25245
25246: End of Configure
25247
25248