xref: /openbsd/gnu/usr.bin/perl/Configure (revision e0a54000)
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/Perl/metaconfig metaconfig
20# The original dist package (including metaconfig) is available on github:
21#    $ git clone https://github.com/rmanfredi/dist.git dist-git
22#
23# Though this script was generated by metaconfig from metaunits, it is
24# OK to send patches against Configure itself (but not to commit them
25# to blead). It's up to
26# the Configure maintainers to backport the patch to the metaunits if it
27# is accepted. Exceptions to this rule, and more information, is in
28# Porting/pumpkin.pod.
29
30# Generated using [metaconfig 3.5 PL0]
31# with additional metaconfig patches from https://github.com/Perl/metaconfig
32
33cat >c1$$ <<EOF
34ARGGGHHHH!!!!!
35
36SCO csh still thinks true is false.  Write to SCO today and tell them that next
37year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42[End of diatribe. We now return you to your regularly scheduled programming...]
43EOF
44cat >c2$$ <<EOF
45
46OOPS!  You naughty creature!  You didn't run Configure with sh!
47I will attempt to remedy the situation by running sh for you...
48EOF
49
50true || cat c1$$ c2$$
51true || exec sh $0 $argv:q
52
53(exit $?0) || cat c2$$
54(exit $?0) || exec sh $0 $argv:q
55rm -f c1$$ c2$$
56
57if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58	cat <<EOF
59***
60*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62*** Please read the README.plan9 for further instructions.
63*** Cannot continue, aborting.
64***
65EOF
66	exit 1
67fi
68
69if test -f /sys/utilities/MultiView ; then
70	# AmigaOS, test -c for /dev/null is not useful
71	:
72elif test ! -c /dev/null ; then
73	cat <<EOF
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81	exit 1
82fi
83
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89	test "$me" || me=$0
90	;;
91esac
92
93: Proper separator for the PATH environment variable
94p_=:
95: On OS/2 this directory should exist if this is not floppy only system ":-]"
96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97	if test -n "$OS2_SHELL"; then
98		p_=\;
99		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101		is_os2=yes
102	elif test -n "$DJGPP"; then
103		case "X${MACHTYPE:-nonesuchmach}" in
104		*cygwin|*msys) ;;
105		*) p_=\; ;;
106		esac
107	fi
108fi
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
119paths="$paths /system/gnu_library/bin"
120
121for p in $paths
122do
123	case "$p_$PATH$p_" in
124	*$p_$p$p_*) ;;
125	*) test -d $p && PATH=$PATH$p_$p ;;
126	esac
127done
128
129PATH=.$p_$PATH
130export PATH
131
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
138if (PATH=.; alias -x) >/dev/null 2>&1; then
139		inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142	needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145	if test X`/usr/bin/uname -v` = X4; then
146		avoidksh="to avoid AIX 4's /bin/sh"
147		newsh=/usr/bin/bsh
148	fi
149fi
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151	if test X`/usr/bin/uname -s` = XOSF1; then
152		avoidksh="to avoid Digital UNIX' ksh"
153		newsh=/bin/sh
154		unset BIN_SH
155	fi
156fi
157case "$inksh/$needksh" in
158/[a-z]*)
159		ENV=''
160		changesh=true
161		reason="$needksh"
162	;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166	changesh=true
167	reason="$avoidksh"
168	;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
172		cat <<EOM
173(I see you are using the Korn shell.  Some ksh's blow up on $me,
174mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175EOM
176	;;
177esac
178case "$changesh" in
179true)
180	export newsh
181	echo "(Feeding myself to $newsh $reason.)"
182	case "$0" in
183	Configure|*/Configure) exec $newsh $0 "$@";;
184	*) exec $newsh Configure "$@";;
185	esac
186	;;
187esac
188test -x "${newsh}" || unset newsh
189
190: if needed, set CDPATH to a harmless value that is not chatty
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'')	;;
194*)	case "$SHELL" in
195	*bash*) CDPATH='.' ;;
196	*) CDPATH='' ;;
197	esac
198	;;
199esac
200
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
203cd UU && rm -f ./*
204
205ccname=''
206ccversion=''
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
210from=''
211hostgenerate=''
212hostosname=''
213hostperl=''
214run=''
215targetarch=''
216targetdir=''
217targetenv=''
218targethost=''
219targetmkdir=''
220targetport=''
221to=''
222usecrosscompile=''
223extern_C=''
224mistrustnm=''
225usedevel=''
226perllibs=''
227dynamic_ext=''
228extensions=''
229known_extensions=''
230nonxs_ext=''
231static_ext=''
232uselanginfo=''
233useopcode=''
234useposix=''
235extras=''
236d_bsd=''
237d_eunice=''
238d_xenix=''
239eunicefix=''
240ar=''
241awk=''
242bash=''
243bison=''
244byacc=''
245cat=''
246chgrp=''
247chmod=''
248chown=''
249comm=''
250compress=''
251cp=''
252cpio=''
253cpp=''
254csh=''
255date=''
256echo=''
257egrep=''
258emacs=''
259expr=''
260find=''
261flex=''
262gmake=''
263grep=''
264gzip=''
265inews=''
266ksh=''
267less=''
268line=''
269lint=''
270ln=''
271lp=''
272lpr=''
273ls=''
274mail=''
275mailx=''
276make=''
277mkdir=''
278more=''
279mv=''
280nm=''
281nroff=''
282perl=''
283pg=''
284pmake=''
285pr=''
286rm=''
287rmail=''
288sed=''
289sendmail=''
290shar=''
291sleep=''
292smail=''
293sort=''
294submit=''
295tail=''
296tar=''
297tbl=''
298tee=''
299test=''
300touch=''
301tr=''
302troff=''
303uname=''
304uniq=''
305uuname=''
306vi=''
307zcat=''
308zip=''
309full_ar=''
310full_sed=''
311libswanted=''
312hint=''
313myuname=''
314osname=''
315osvers=''
316Author=''
317Date=''
318Header=''
319Id=''
320Locker=''
321Log=''
322RCSfile=''
323Revision=''
324Source=''
325State=''
326sysroot=''
327_a=''
328_exe=''
329_o=''
330archobjs=''
331exe_ext=''
332firstmakefile=''
333lib_ext=''
334obj_ext=''
335path_sep=''
336rm_try=''
337afs=''
338afsroot=''
339alignbytes=''
340archlib=''
341archlibexp=''
342d_archlib=''
343installarchlib=''
344archname=''
345myarchname=''
346useversionedarchname=''
347d_atolf=''
348d_atoll=''
349baserev=''
350bin=''
351binexp=''
352initialinstalllocation=''
353installbin=''
354userelocatableinc=''
355byteorder=''
356cc=''
357ccflags=''
358cppflags=''
359ldflags=''
360lkflags=''
361locincpth=''
362optimize=''
363cf_email=''
364cf_by=''
365cf_time=''
366charbits=''
367charsize=''
368compiler_warning=''
369contains=''
370cpp_stuff=''
371cpplast=''
372cppminus=''
373cpprun=''
374cppstdin=''
375d__fwalk=''
376d_accept4=''
377d_access=''
378d_accessx=''
379d_acosh=''
380d_aintl=''
381d_alarm=''
382asctime_r_proto=''
383d_asctime_r=''
384d_asinh=''
385d_atanh=''
386d_attribute_always_inline=''
387d_attribute_deprecated=''
388d_attribute_format=''
389d_attribute_malloc=''
390d_attribute_nonnull=''
391d_attribute_noreturn=''
392d_attribute_pure=''
393d_attribute_unused=''
394d_attribute_visibility=''
395d_attribute_warn_unused_result=''
396d_printf_format_null=''
397d_backtrace=''
398d_non_int_bitfields=''
399d_builtin_choose_expr=''
400d_builtin_expect=''
401d_builtin_add_overflow=''
402d_builtin_mul_overflow=''
403d_builtin_sub_overflow=''
404d_c99_variadic_macros=''
405d_casti32=''
406castflags=''
407d_castneg=''
408d_cbrt=''
409d_chown=''
410d_chroot=''
411d_chsize=''
412d_class=''
413d_clearenv=''
414d_closedir=''
415d_void_closedir=''
416d_cmsghdr_s=''
417d_copysign=''
418d_copysignl=''
419d_cplusplus=''
420cryptlib=''
421d_crypt=''
422crypt_r_proto=''
423d_crypt_r=''
424d_csh=''
425full_csh=''
426d_ctermid=''
427ctermid_r_proto=''
428d_ctermid_r=''
429ctime_r_proto=''
430d_ctime_r=''
431d_cuserid=''
432d_dbminitproto=''
433d_difftime=''
434d_dir_dd_fd=''
435d_dirfd=''
436d_dladdr=''
437d_dlerror=''
438d_dlopen=''
439d_dlsymun=''
440d_dosuid=''
441d_suidsafe=''
442d_drand48_r=''
443drand48_r_proto=''
444d_drand48proto=''
445d_dup2=''
446d_dup3=''
447d_eaccess=''
448d_endgrent=''
449d_endgrent_r=''
450endgrent_r_proto=''
451d_endhent=''
452d_endhostent_r=''
453endhostent_r_proto=''
454d_endnent=''
455d_endnetent_r=''
456endnetent_r_proto=''
457d_endpent=''
458d_endprotoent_r=''
459endprotoent_r_proto=''
460d_endpwent=''
461d_endpwent_r=''
462endpwent_r_proto=''
463d_endsent=''
464d_endservent_r=''
465endservent_r_proto=''
466d_erf=''
467d_erfc=''
468d_exp2=''
469d_expm1=''
470d_faststdio=''
471d_fchdir=''
472d_fchmod=''
473d_fchown=''
474d_fcntl=''
475d_fcntl_can_lock=''
476d_fd_macros=''
477d_fd_set=''
478d_fds_bits=''
479d_fdclose=''
480d_fdim=''
481d_fegetround=''
482d_ffs=''
483d_ffsl=''
484d_fgetpos=''
485d_finite=''
486d_finitel=''
487d_flexfnam=''
488d_flock=''
489d_flockproto=''
490d_fma=''
491d_fmax=''
492d_fmin=''
493d_fork=''
494d_fp_class=''
495d_fp_classl=''
496d_fpclass=''
497d_fp_classify=''
498d_fpclassify=''
499d_fpclassl=''
500d_fpgetround=''
501d_fpos64_t=''
502d_frexpl=''
503d_fs_data_s=''
504d_fchmodat=''
505d_linkat=''
506d_openat=''
507d_renameat=''
508d_unlinkat=''
509d_fseeko=''
510d_fsetpos=''
511d_fstatfs=''
512d_fsync=''
513d_ftello=''
514d_ftime=''
515d_gettimeod=''
516d_futimes=''
517d_gai_strerror=''
518d_Gconvert=''
519d_getaddrinfo=''
520d_getcwd=''
521d_getenv_preserves_other_thread=''
522d_getespwnam=''
523d_getfsstat=''
524d_getgrent=''
525d_getgrent_r=''
526getgrent_r_proto=''
527d_getgrgid_r=''
528getgrgid_r_proto=''
529d_getgrnam_r=''
530getgrnam_r_proto=''
531d_getgrps=''
532d_gethbyaddr=''
533d_gethbyname=''
534d_gethent=''
535aphostname=''
536d_gethname=''
537d_phostname=''
538d_uname=''
539d_gethostbyaddr_r=''
540gethostbyaddr_r_proto=''
541d_gethostbyname_r=''
542gethostbyname_r_proto=''
543d_gethostent_r=''
544gethostent_r_proto=''
545d_gethostprotos=''
546d_getitimer=''
547d_getlogin=''
548d_getlogin_r=''
549getlogin_r_proto=''
550d_getmnt=''
551d_getmntent=''
552d_getnameinfo=''
553d_getnbyaddr=''
554d_getnbyname=''
555d_getnent=''
556d_getnetbyaddr_r=''
557getnetbyaddr_r_proto=''
558d_getnetbyname_r=''
559getnetbyname_r_proto=''
560d_getnetent_r=''
561getnetent_r_proto=''
562d_getnetprotos=''
563d_getpagsz=''
564d_getpent=''
565d_getpgid=''
566d_getpgrp2=''
567d_bsdgetpgrp=''
568d_getpgrp=''
569d_getppid=''
570d_getprior=''
571d_getpbyname=''
572d_getpbynumber=''
573d_getprotobyname_r=''
574getprotobyname_r_proto=''
575d_getprotobynumber_r=''
576getprotobynumber_r_proto=''
577d_getprotoent_r=''
578getprotoent_r_proto=''
579d_getprotoprotos=''
580d_getprpwnam=''
581d_getpwent=''
582d_getpwent_r=''
583getpwent_r_proto=''
584d_getpwnam_r=''
585getpwnam_r_proto=''
586d_getpwuid_r=''
587getpwuid_r_proto=''
588d_getsent=''
589d_getservbyname_r=''
590getservbyname_r_proto=''
591d_getservbyport_r=''
592getservbyport_r_proto=''
593d_getservent_r=''
594getservent_r_proto=''
595d_getservprotos=''
596d_getspnam=''
597d_getspnam_r=''
598getspnam_r_proto=''
599d_getsbyname=''
600d_getsbyport=''
601d_gmtime_r=''
602gmtime_r_proto=''
603d_gnulibc=''
604gnulibc_version=''
605d_hasmntopt=''
606d_htonl=''
607d_hypot=''
608d_ilogb=''
609d_ilogbl=''
610d_inetaton=''
611d_inetntop=''
612d_inetpton=''
613d_int64_t=''
614d_isascii=''
615d_isblank=''
616d_isfinite=''
617d_isfinitel=''
618d_isinf=''
619d_isinfl=''
620d_isless=''
621d_isnan=''
622d_isnanl=''
623d_isnormal=''
624d_j0=''
625d_j0l=''
626d_killpg=''
627d_lc_monetary_2008=''
628d_lchown=''
629d_ldbl_dig=''
630d_lgamma=''
631d_lgamma_r=''
632d_libm_lib_version=''
633d_link=''
634d_llrint=''
635d_llrintl=''
636d_llround=''
637d_llroundl=''
638d_localeconv_l=''
639d_localtime_r=''
640d_localtime_r_needs_tzset=''
641localtime_r_proto=''
642d_locconv=''
643d_lockf=''
644d_log1p=''
645d_log2=''
646d_logb=''
647d_ldexpl=''
648d_long_double_style_ieee=''
649d_long_double_style_ieee_doubledouble=''
650d_long_double_style_ieee_extended=''
651d_long_double_style_ieee_std=''
652d_long_double_style_vax=''
653d_longdbl=''
654longdblkind=''
655longdblsize=''
656d_longlong=''
657longlongsize=''
658d_lrint=''
659d_lrintl=''
660d_lround=''
661d_lroundl=''
662d_lseekproto=''
663d_lstat=''
664d_madvise=''
665d_malloc_good_size=''
666d_malloc_size=''
667d_malloc_usable_size=''
668d_mblen=''
669d_mbrlen=''
670d_mbrtowc=''
671d_mbstowcs=''
672d_mbtowc=''
673d_memmem=''
674d_memrchr=''
675d_mkdir=''
676d_mkdtemp=''
677d_mkfifo=''
678d_mkostemp=''
679d_mkstemp=''
680d_mkstemps=''
681d_mktime=''
682d_mmap=''
683mmaptype=''
684d_modfl=''
685d_modflproto=''
686d_mprotect=''
687d_msg=''
688d_msgctl=''
689d_msgget=''
690d_msghdr_s=''
691d_msgrcv=''
692d_msgsnd=''
693d_msync=''
694d_munmap=''
695d_nan=''
696d_nanosleep=''
697d_nearbyint=''
698d_duplocale=''
699d_freelocale=''
700d_newlocale=''
701d_querylocale=''
702d_uselocale=''
703i_xlocale=''
704xlocale_needed=''
705d_nextafter=''
706d_nexttoward=''
707d_nice=''
708d_nl_langinfo=''
709d_nl_langinfo_l=''
710d_off64_t=''
711d_open3=''
712d_fpathconf=''
713d_pathconf=''
714d_pause=''
715d_pipe2=''
716d_pipe=''
717d_poll=''
718d_portable=''
719d_prctl=''
720d_prctl_set_name=''
721d_procselfexe=''
722procselfexe=''
723d_old_pthread_create_joinable=''
724old_pthread_create_joinable=''
725d_pthread_atfork=''
726d_pthread_attr_setscope=''
727d_pthread_yield=''
728d_sched_yield=''
729sched_yield=''
730d_ptrdiff_t=''
731d_qgcvt=''
732d_random_r=''
733random_r_proto=''
734d_readdir64_r=''
735readdir64_r_proto=''
736d_readdir=''
737d_rewinddir=''
738d_seekdir=''
739d_telldir=''
740d_readdir_r=''
741readdir_r_proto=''
742d_readlink=''
743d_readv=''
744d_recvmsg=''
745d_re_comp=''
746d_regcmp=''
747d_regcomp=''
748d_remainder=''
749d_remquo=''
750d_rename=''
751d_rint=''
752d_rmdir=''
753d_round=''
754d_sbrkproto=''
755d_scalbn=''
756d_scalbnl=''
757d_select=''
758d_sem=''
759d_semctl=''
760d_semget=''
761d_semop=''
762d_sendmsg=''
763d_setegid=''
764d_setenv=''
765d_seteuid=''
766d_setgrent=''
767d_setgrent_r=''
768setgrent_r_proto=''
769d_setgrps=''
770d_sethent=''
771d_sethostent_r=''
772sethostent_r_proto=''
773d_setitimer=''
774d_setlinebuf=''
775d_has_C_UTF8=''
776d_setlocale=''
777d_setlocale_accepts_any_locale_name=''
778d_setlocale_r=''
779setlocale_r_proto=''
780d_setnent=''
781d_setnetent_r=''
782setnetent_r_proto=''
783d_setpent=''
784d_setpgid=''
785d_setpgrp2=''
786d_bsdsetpgrp=''
787d_setpgrp=''
788d_setprior=''
789d_setproctitle=''
790d_setprotoent_r=''
791setprotoent_r_proto=''
792d_setpwent=''
793d_setpwent_r=''
794setpwent_r_proto=''
795d_setregid=''
796d_setresgid=''
797d_setresuid=''
798d_setreuid=''
799d_setrgid=''
800d_setruid=''
801d_setsent=''
802d_setservent_r=''
803setservent_r_proto=''
804d_setsid=''
805d_setvbuf=''
806d_shm=''
807d_shmat=''
808d_shmatprototype=''
809shmattype=''
810d_shmctl=''
811d_shmdt=''
812d_shmget=''
813d_sigaction=''
814d_siginfo_si_addr=''
815d_siginfo_si_band=''
816d_siginfo_si_errno=''
817d_siginfo_si_fd=''
818d_siginfo_si_pid=''
819d_siginfo_si_status=''
820d_siginfo_si_uid=''
821d_siginfo_si_value=''
822d_signbit=''
823d_sigprocmask=''
824d_sigsetjmp=''
825usesitecustomize=''
826d_snprintf=''
827d_vsnprintf=''
828d_sockatmark=''
829d_sockatmarkproto=''
830d_ip_mreq=''
831d_ip_mreq_source=''
832d_ipv6_mreq=''
833d_ipv6_mreq_source=''
834d_msg_ctrunc=''
835d_msg_dontroute=''
836d_msg_oob=''
837d_msg_peek=''
838d_msg_proxy=''
839d_oldsock=''
840d_scm_rights=''
841d_sin6_scope_id=''
842d_sockaddr_in6=''
843d_sockaddr_sa_len=''
844d_sockaddr_storage=''
845d_socket=''
846d_sockpair=''
847sockethdr=''
848socketlib=''
849d_socklen_t=''
850d_socks5_init=''
851d_sqrtl=''
852d_srand48_r=''
853srand48_r_proto=''
854d_srandom_r=''
855srandom_r_proto=''
856d_sresgproto=''
857d_sresuproto=''
858d_stat=''
859d_statblks=''
860d_statfs_f_flags=''
861d_statfs_s=''
862d_static_inline=''
863perl_static_inline=''
864d_fstatvfs=''
865d_statvfs=''
866d_stdio_cnt_lval=''
867d_stdio_ptr_lval=''
868d_stdio_ptr_lval_nochange_cnt=''
869d_stdio_ptr_lval_sets_cnt=''
870d_stdiobase=''
871d_stdstdio=''
872stdio_base=''
873stdio_bufsiz=''
874stdio_cnt=''
875stdio_filbuf=''
876stdio_ptr=''
877d_strcoll=''
878d_sysernlst=''
879d_syserrlst=''
880d_strerror_l=''
881d_strerror_r=''
882strerror_r_proto=''
883d_strftime=''
884d_strlcat=''
885d_strlcpy=''
886d_strnlen=''
887d_strtod=''
888d_strtod_l=''
889d_strtol=''
890d_strtold=''
891d_strtold_l=''
892d_strtoll=''
893d_strtoq=''
894d_strtoul=''
895d_strtoull=''
896d_strtouq=''
897d_strxfrm=''
898d_strxfrm_l=''
899d_symlink=''
900d_syscall=''
901d_syscallproto=''
902d_sysconf=''
903d_system=''
904d_tcgetpgrp=''
905d_tcsetpgrp=''
906d_telldirproto=''
907d_tgamma=''
908d_thread_local=''
909perl_thread_local=''
910d_time=''
911timetype=''
912d_asctime64=''
913d_ctime64=''
914d_difftime64=''
915d_gmtime64=''
916d_localtime64=''
917d_mktime64=''
918d_timegm=''
919clocktype=''
920d_times=''
921d_tmpnam_r=''
922tmpnam_r_proto=''
923d_towlower=''
924d_towupper=''
925d_trunc=''
926d_truncate=''
927d_truncl=''
928d_ttyname_r=''
929ttyname_r_proto=''
930d_tzname=''
931d_u32align=''
932d_ualarm=''
933d_umask=''
934d_semctl_semid_ds=''
935d_semctl_semun=''
936d_union_semun=''
937d_unordered=''
938d_unsetenv=''
939d_usleep=''
940d_usleepproto=''
941d_ustat=''
942d_pseudofork=''
943d_vfork=''
944usevfork=''
945d_voidsig=''
946signal_t=''
947d_wait4=''
948d_waitpid=''
949d_wcrtomb=''
950d_wcscmp=''
951d_wcstombs=''
952d_wcsxfrm=''
953d_wctomb=''
954d_writev=''
955default_inc_excludes_dot=''
956d_perl_lc_all_category_positions_init=''
957d_perl_lc_all_separator=''
958d_perl_lc_all_uses_name_value_pairs=''
959perl_lc_all_category_positions_init=''
960perl_lc_all_separator=''
961dlext=''
962bin_ELF=''
963cccdlflags=''
964ccdlflags=''
965dlsrc=''
966ld=''
967ld_can_script=''
968lddlflags=''
969usedl=''
970doublesize=''
971dtraceobject=''
972dtracexnolibs=''
973ebcdic=''
974fflushNULL=''
975fflushall=''
976fpossize=''
977fpostype=''
978gccansipedantic=''
979gccosandvers=''
980gccversion=''
981gidformat=''
982gidsign=''
983gidsize=''
984gidtype=''
985groupstype=''
986h_fcntl=''
987h_sysfile=''
988html1dir=''
989html1direxp=''
990installhtml1dir=''
991html3dir=''
992html3direxp=''
993installhtml3dir=''
994i_arpainet=''
995i_bfd=''
996i_crypt=''
997db_hashtype=''
998db_prefixtype=''
999db_version_major=''
1000db_version_minor=''
1001db_version_patch=''
1002i_db=''
1003i_dbm=''
1004i_rpcsvcdbm=''
1005d_dirnamlen=''
1006direntrytype=''
1007i_dirent=''
1008i_dlfcn=''
1009i_execinfo=''
1010i_fcntl=''
1011i_fenv=''
1012i_fp=''
1013i_fp_class=''
1014i_gdbm=''
1015d_grpasswd=''
1016i_grp=''
1017i_ieeefp=''
1018i_inttypes=''
1019i_langinfo=''
1020i_libutil=''
1021i_locale=''
1022i_machcthr=''
1023i_malloc=''
1024i_mallocmalloc=''
1025i_mntent=''
1026d_gdbm_ndbm_h_uses_prototypes=''
1027d_gdbmndbm_h_uses_prototypes=''
1028d_ndbm=''
1029d_ndbm_h_uses_prototypes=''
1030i_gdbm_ndbm=''
1031i_gdbmndbm=''
1032i_ndbm=''
1033i_netdb=''
1034i_neterrno=''
1035i_netinettcp=''
1036i_niin=''
1037i_sysin=''
1038i_poll=''
1039i_prot=''
1040i_pthread=''
1041d_pwage=''
1042d_pwchange=''
1043d_pwclass=''
1044d_pwcomment=''
1045d_pwexpire=''
1046d_pwgecos=''
1047d_pwpasswd=''
1048d_pwquota=''
1049i_pwd=''
1050i_quadmath=''
1051i_shadow=''
1052i_socks=''
1053i_stdbool=''
1054i_stdint=''
1055i_stdlib=''
1056i_sunmath=''
1057i_sysaccess=''
1058i_sysdir=''
1059i_sysfile=''
1060d_voidtty=''
1061i_bsdioctl=''
1062i_sysfilio=''
1063i_sysioctl=''
1064i_syssockio=''
1065i_syslog=''
1066i_sysmman=''
1067i_sysmode=''
1068i_sysmount=''
1069i_sysndir=''
1070i_sysparam=''
1071i_syspoll=''
1072i_sysresrc=''
1073i_syssecrt=''
1074i_sysselct=''
1075i_sysstat=''
1076i_sysstatfs=''
1077i_sysstatvfs=''
1078i_syssyscall=''
1079i_systimes=''
1080i_systypes=''
1081i_sysuio=''
1082i_sysun=''
1083i_sysutsname=''
1084i_sysvfs=''
1085i_syswait=''
1086i_sgtty=''
1087i_termio=''
1088i_termios=''
1089d_tm_tm_gmtoff=''
1090d_tm_tm_zone=''
1091i_systime=''
1092i_systimek=''
1093i_time=''
1094timeincl=''
1095i_unistd=''
1096i_ustat=''
1097i_utime=''
1098i_vfork=''
1099i_wchar=''
1100i_wctype=''
1101d_inc_version_list=''
1102inc_version_list=''
1103inc_version_list_init=''
1104doubleinfbytes=''
1105doublenanbytes=''
1106longdblinfbytes=''
1107longdblnanbytes=''
1108installprefix=''
1109installprefixexp=''
1110installstyle=''
1111installusrbinperl=''
1112intsize=''
1113longsize=''
1114shortsize=''
1115issymlink=''
1116libc=''
1117ldlibpthname=''
1118libperl=''
1119shrpenv=''
1120useshrplib=''
1121glibpth=''
1122incpth=''
1123libpth=''
1124loclibpth=''
1125plibpth=''
1126xlibpth=''
1127ignore_versioned_solibs=''
1128libs=''
1129libsdirs=''
1130libsfiles=''
1131libsfound=''
1132libspath=''
1133lns=''
1134d_PRIEUldbl=''
1135d_PRIFUldbl=''
1136d_PRIGUldbl=''
1137d_PRIeldbl=''
1138d_PRIfldbl=''
1139d_PRIgldbl=''
1140d_SCNfldbl=''
1141d_double_has_inf=''
1142d_double_has_nan=''
1143d_double_has_negative_zero=''
1144d_double_has_subnormals=''
1145d_double_style_cray=''
1146d_double_style_ibm=''
1147d_double_style_ieee=''
1148d_double_style_vax=''
1149doublekind=''
1150sPRIEUldbl=''
1151sPRIFUldbl=''
1152sPRIGUldbl=''
1153sPRIeldbl=''
1154sPRIfldbl=''
1155sPRIgldbl=''
1156sSCNfldbl=''
1157lseeksize=''
1158lseektype=''
1159make_set_make=''
1160d_mymalloc=''
1161freetype=''
1162mallocobj=''
1163mallocsrc=''
1164malloctype=''
1165usemallocwrap=''
1166usemymalloc=''
1167installman1dir=''
1168man1dir=''
1169man1direxp=''
1170man1ext=''
1171installman3dir=''
1172man3dir=''
1173man3direxp=''
1174man3ext=''
1175doublemantbits=''
1176longdblmantbits=''
1177nvmantbits=''
1178modetype=''
1179multiarch=''
1180mydomain=''
1181myhostname=''
1182phostname=''
1183c=''
1184n=''
1185d_eofnblk=''
1186eagain=''
1187o_nonblock=''
1188rd_nodata=''
1189need_va_copy=''
1190netdb_hlen_type=''
1191netdb_host_type=''
1192netdb_name_type=''
1193netdb_net_type=''
1194groupcat=''
1195hostcat=''
1196passcat=''
1197orderlib=''
1198ranlib=''
1199d_perl_otherlibdirs=''
1200otherlibdirs=''
1201package=''
1202spackage=''
1203pager=''
1204api_revision=''
1205api_subversion=''
1206api_version=''
1207api_versionstring=''
1208patchlevel=''
1209perl_patchlevel=''
1210revision=''
1211subversion=''
1212version=''
1213version_patchlevel_string=''
1214perl5=''
1215perladmin=''
1216perlpath=''
1217i32dformat=''
1218u32XUformat=''
1219u32oformat=''
1220u32uformat=''
1221u32xformat=''
1222d_nv_preserves_uv=''
1223d_nv_zero_is_allbits_zero=''
1224i16size=''
1225i16type=''
1226i32size=''
1227i32type=''
1228i64size=''
1229i64type=''
1230i8size=''
1231i8type=''
1232ivsize=''
1233ivtype=''
1234nv_overflows_integers_at=''
1235nv_preserves_uv_bits=''
1236nvsize=''
1237nvtype=''
1238u16size=''
1239u16type=''
1240u32size=''
1241u32type=''
1242u64size=''
1243u64type=''
1244u8size=''
1245u8type=''
1246uvsize=''
1247uvtype=''
1248ivdformat=''
1249nvEUformat=''
1250nvFUformat=''
1251nvGUformat=''
1252nveformat=''
1253nvfformat=''
1254nvgformat=''
1255uvXUformat=''
1256uvoformat=''
1257uvuformat=''
1258uvxformat=''
1259pidtype=''
1260prefix=''
1261prefixexp=''
1262installprivlib=''
1263privlib=''
1264privlibexp=''
1265ptrsize=''
1266d_PRIXU64=''
1267d_PRId64=''
1268d_PRIi64=''
1269d_PRIo64=''
1270d_PRIu64=''
1271d_PRIx64=''
1272sPRIXU64=''
1273sPRId64=''
1274sPRIi64=''
1275sPRIo64=''
1276sPRIu64=''
1277sPRIx64=''
1278d_quad=''
1279quadkind=''
1280quadtype=''
1281uquadtype=''
1282drand01=''
1283randbits=''
1284randfunc=''
1285randseedtype=''
1286seedfunc=''
1287installscript=''
1288scriptdir=''
1289scriptdirexp=''
1290selectminbits=''
1291selecttype=''
1292sh=''
1293targetsh=''
1294sig_count=''
1295sig_name=''
1296sig_name_init=''
1297sig_num=''
1298sig_num_init=''
1299sig_size=''
1300d_sitearch=''
1301installsitearch=''
1302sitearch=''
1303sitearchexp=''
1304installsitebin=''
1305sitebin=''
1306sitebinexp=''
1307installsitehtml1dir=''
1308sitehtml1dir=''
1309sitehtml1direxp=''
1310installsitehtml3dir=''
1311sitehtml3dir=''
1312sitehtml3direxp=''
1313installsitelib=''
1314sitelib=''
1315sitelib_stem=''
1316sitelibexp=''
1317installsiteman1dir=''
1318siteman1dir=''
1319siteman1direxp=''
1320installsiteman3dir=''
1321siteman3dir=''
1322siteman3direxp=''
1323siteprefix=''
1324siteprefixexp=''
1325installsitescript=''
1326sitescript=''
1327sitescriptexp=''
1328sizesize=''
1329sizetype=''
1330d_libname_unique=''
1331so=''
1332socksizetype=''
1333sharpbang=''
1334shsharp=''
1335spitshell=''
1336src=''
1337ssizetype=''
1338st_dev_sign=''
1339st_dev_size=''
1340st_ino_sign=''
1341st_ino_size=''
1342startperl=''
1343startsh=''
1344stdchar=''
1345d_stdio_stream_array=''
1346stdio_stream_array=''
1347sysman=''
1348sGMTIME_max=''
1349sGMTIME_min=''
1350sLOCALTIME_max=''
1351sLOCALTIME_min=''
1352trnl=''
1353uidformat=''
1354uidsign=''
1355uidsize=''
1356uidtype=''
1357archname64=''
1358use64bitall=''
1359use64bitint=''
1360usecbacktrace=''
1361usedefaultstrict=''
1362dtrace=''
1363usedtrace=''
1364usefaststdio=''
1365usekernprocpathname=''
1366ccflags_uselargefiles=''
1367ldflags_uselargefiles=''
1368libswanted_uselargefiles=''
1369uselargefiles=''
1370uselongdouble=''
1371usemorebits=''
1372usemultiplicity=''
1373nm_opt=''
1374nm_so_opt=''
1375runnm=''
1376usenm=''
1377usensgetexecutablepath=''
1378useperlio=''
1379usequadmath=''
1380usesocks=''
1381d_oldpthreads=''
1382useithreads=''
1383usereentrant=''
1384usethreads=''
1385incpath=''
1386mips_type=''
1387usrinc=''
1388d_vendorarch=''
1389installvendorarch=''
1390vendorarch=''
1391vendorarchexp=''
1392d_vendorbin=''
1393installvendorbin=''
1394vendorbin=''
1395vendorbinexp=''
1396installvendorhtml1dir=''
1397vendorhtml1dir=''
1398vendorhtml1direxp=''
1399installvendorhtml3dir=''
1400vendorhtml3dir=''
1401vendorhtml3direxp=''
1402d_vendorlib=''
1403installvendorlib=''
1404vendorlib=''
1405vendorlib_stem=''
1406vendorlibexp=''
1407installvendorman1dir=''
1408vendorman1dir=''
1409vendorman1direxp=''
1410installvendorman3dir=''
1411vendorman3dir=''
1412vendorman3direxp=''
1413usevendorprefix=''
1414vendorprefix=''
1415vendorprefixexp=''
1416d_vendorscript=''
1417installvendorscript=''
1418vendorscript=''
1419vendorscriptexp=''
1420versiononly=''
1421yacc=''
1422yaccflags=''
1423CONFIG=''
1424
1425: Detect odd OSs
1426define='define'
1427undef='undef'
1428smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1429rmlist=''
1430
1431: We must find out about Eunice early
1432eunicefix=':'
1433if test -f /etc/unixtovms; then
1434	eunicefix=/etc/unixtovms
1435fi
1436if test -f /etc/unixtovms.exe; then
1437	eunicefix=/etc/unixtovms.exe
1438fi
1439
1440: Set executable suffix now -- needed before hints available
1441if test -f "/libs/version.library"; then
1442: Amiga OS
1443    _exe=""
1444elif test -f "/system/gnu_library/bin/ar.pm"; then
1445: Stratus VOS
1446    _exe=".pm"
1447elif test -n "$DJGPP"; then
1448: DOS DJGPP
1449    _exe=".exe"
1450elif test -f /kern/cookiejar; then
1451: MiNT
1452    _exe=""
1453elif test -d c:/. -o -n "$is_os2" ; then
1454: OS/2 or cygwin
1455    _exe=".exe"
1456fi
1457
1458groupstype=''
1459i_whoami=''
1460: Possible local include directories to search.
1461: Set locincpth to "" in a hint file to defeat local include searches.
1462locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1463locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1464:
1465: no include file wanted by default
1466inclwanted=''
1467
1468: Enable -DEBUGGING and -DDEBUGGING from the command line
1469EBUGGING=''
1470DEBUGGING=''
1471
1472: Trailing extension.  Override this in a hint file, if needed.
1473: Extra object files, if any, needed on this platform.
1474archobjs=''
1475libnames=''
1476: change the next line if compiling for Xenix/286 on Xenix/386
1477xlibpth='/usr/lib/386 /lib/386'
1478: Possible local library directories to search.
1479loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1480loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1481
1482: general looking path for locating libraries
1483glibpth="/lib /usr/lib $xlibpth"
1484glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1485test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1486test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1487test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1488
1489: Private path used by Configure to find libraries.  Its value
1490: is prepended to libpth. This variable takes care of special
1491: machines, like the mips.  Usually, it should be empty.
1492plibpth=''
1493
1494: default library list
1495libswanted=''
1496: some systems want to use only the non-versioned libso:s
1497ignore_versioned_solibs=''
1498ccname=''
1499ccversion=''
1500perllibs=''
1501: set useposix=false in your hint file to disable the POSIX extension.
1502useposix=true
1503: set useopcode=false in your hint file to disable the Opcode extension.
1504useopcode=true
1505: set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1506uselanginfo=true
1507archname64=''
1508ccflags_uselargefiles=''
1509ldflags_uselargefiles=''
1510libswanted_uselargefiles=''
1511: set usemultiplicity on the Configure command line to enable multiplicity.
1512: set usesocks on the Configure command line to enable socks.
1513archname=''
1514: set usethreads on the Configure command line to enable threads.
1515usereentrant='undef'
1516: List of libraries we want.
1517: If anyone needs extra -lxxx, put those in a hint file.
1518libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
1519libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1520: We probably want to search /usr/shlib before most other libraries.
1521: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1522glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1523glibpth="/usr/shlib $glibpth"
1524: Do not use vfork unless overridden by a hint file.
1525usevfork=false
1526
1527: Find the basic shell for Bourne shell scripts
1528case "$sh" in
1529'')
1530	case "$SYSTYPE" in
1531	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1532	*) xxx='/bin/sh';;
1533	esac
1534	if test -f "$xxx"; then
1535		sh="$xxx"
1536	else
1537		: Build up a list and do a single loop so we can 'break' out.
1538		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1539		for xxx in sh bash ksh pdksh ash; do
1540			for p in $pth; do
1541				try="$try ${p}/${xxx}"
1542			done
1543		done
1544		for xxx in $try; do
1545			if test -f "$xxx"; then
1546				sh="$xxx";
1547				break
1548			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1549				sh="$xxx";
1550				break
1551			elif test -f "$xxx.exe"; then
1552				sh="$xxx";
1553				break
1554			fi
1555		done
1556	fi
1557	;;
1558esac
1559
1560case "$sh" in
1561'')	cat >&2 <<EOM
1562$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1563
1564Usually it's in /bin/sh.  How did you even get this far?
1565Please report this issue at https://github.com/Perl/perl5/issues
1566and we'll try to straighten this all out.
1567EOM
1568	exit 1
1569	;;
1570esac
1571
1572: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1573: default both to the same thing, cross-compilers can then set targetsh differently if they like
1574targetsh=$sh
1575
1576: see if sh knows # comments
1577if `$sh -c '#' >/dev/null 2>&1`; then
1578	shsharp=true
1579	spitshell=cat
1580	xcat=/bin/cat
1581	test -f $xcat$_exe || xcat=/usr/bin/cat
1582	if test ! -f $xcat$_exe; then
1583		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1584			if test -f $p/cat$_exe; then
1585				xcat=$p/cat
1586				break
1587			fi
1588		done
1589		if test ! -f $xcat$_exe; then
1590			echo "Can't find cat anywhere!"
1591			exit 1
1592		fi
1593	fi
1594	echo "#!$xcat" >sharp
1595	$eunicefix sharp
1596	chmod +x sharp
1597	./sharp > today 2>/dev/null
1598	if test -s today; then
1599		sharpbang='#!'
1600	else
1601		echo "#! $xcat" > sharp
1602		$eunicefix sharp
1603		chmod +x sharp
1604		./sharp > today 2>/dev/null
1605		if test -s today; then
1606			sharpbang='#! '
1607		else
1608			sharpbang=': use '
1609		fi
1610	fi
1611else
1612	echo " "
1613	echo "Your $sh doesn't grok # comments--I will strip them later on."
1614	shsharp=false
1615	cd ..
1616	echo "exec grep -v '^[ 	]*#'" >spitshell
1617	chmod +x spitshell
1618	$eunicefix spitshell
1619	spitshell=`pwd`/spitshell
1620	cd UU
1621	echo "I presume that if # doesn't work, #! won't work either!"
1622	sharpbang=': use '
1623fi
1624rm -f sharp today
1625
1626: figure out how to guarantee sh startup
1627case "$startsh" in
1628'') startsh=${sharpbang}${sh} ;;
1629*)
1630esac
1631cat >sharp <<EOSS
1632$startsh
1633set abc
1634test "$?abc" != 1
1635EOSS
1636
1637chmod +x sharp
1638$eunicefix sharp
1639if ./sharp; then
1640	: echo "Yup, it does."
1641else
1642	echo "Hmm... '$startsh' does not guarantee sh startup..."
1643	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1644fi
1645rm -f sharp
1646
1647: Save command line options in file UU/cmdline.opt for later use in
1648: generating config.sh.
1649cat > cmdline.opt <<EOSH
1650: Configure command line arguments.
1651config_arg0='$0'
1652config_args='$*'
1653config_argc=$#
1654EOSH
1655argn=1
1656args_exp=''
1657args_sep=''
1658for arg in "$@"; do
1659	cat >>cmdline.opt <<EOSH
1660config_arg$argn='$arg'
1661EOSH
1662	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1663$arg
1664EOC
1665	arg_exp=`cat cmdl.opt`
1666	args_exp="$args_exp$args_sep'$arg_exp'"
1667	argn=`expr $argn + 1`
1668	args_sep=' '
1669done
1670rm -f cmdl.opt
1671
1672: produce awk script to parse command line options
1673cat >options.awk <<'EOF'
1674BEGIN {
1675	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1676
1677	len = length(optstr);
1678	for (i = 1; i <= len; i++) {
1679		c = substr(optstr, i, 1);
1680		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1681		if (a == ":") {
1682			arg[c] = 1;
1683			i++;
1684		}
1685		opt[c] = 1;
1686	}
1687}
1688{
1689	expect = 0;
1690	str = $0;
1691	if (substr(str, 1, 1) != "-") {
1692		printf("'%s'\n", str);
1693		next;
1694	}
1695	len = length($0);
1696	for (i = 2; i <= len; i++) {
1697		c = substr(str, i, 1);
1698		if (!opt[c]) {
1699			printf("-%s\n", substr(str, i));
1700			next;
1701		}
1702		printf("-%s\n", c);
1703		if (arg[c]) {
1704			if (i < len)
1705				printf("'%s'\n", substr(str, i + 1));
1706			else
1707				expect = 1;
1708			next;
1709		}
1710	}
1711}
1712END {
1713	if (expect)
1714		print "?";
1715}
1716EOF
1717
1718: process the command line options
1719set X `for arg in "$@"; do echo "X$arg"; done |
1720	sed -e s/X// | awk -f options.awk`
1721eval "set $*"
1722shift
1723rm -f options.awk
1724
1725: set up default values
1726fastread=''
1727reuseval=false
1728config_sh=''
1729alldone=''
1730error=''
1731silent=''
1732extractsh=''
1733knowitall=''
1734rm -f optdef.sh posthint.sh
1735cat >optdef.sh <<EOS
1736$startsh
1737EOS
1738
1739
1740: option parsing
1741while test $# -gt 0; do
1742	case "$1" in
1743	-d) shift; fastread=yes;;
1744	-e) shift; alldone=cont;;
1745	-f)
1746		shift
1747		cd ..
1748		if test -r "$1"; then
1749			config_sh="$1"
1750		else
1751			echo "$me: cannot read config file $1." >&2
1752			error=true
1753		fi
1754		cd UU
1755		shift;;
1756	--help|\
1757	-h) shift; error=true;;
1758	-r) shift; reuseval=true;;
1759	-s) shift; silent=true; realsilent=true;;
1760	-E) shift; alldone=exit;;
1761	-K) shift; knowitall=true;;
1762	-O) shift;;
1763	-S) shift; silent=true; extractsh=true;;
1764	-D)
1765		shift
1766		case "$1" in
1767		*=)
1768			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1769			echo "$me: ignoring -D $1" >&2
1770			;;
1771		*=*) echo "$1" | \
1772				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1773		*) echo "$1='define'" >> optdef.sh;;
1774		esac
1775		shift
1776		;;
1777	-U)
1778		shift
1779		case "$1" in
1780		*=) echo "$1" >> optdef.sh;;
1781		*=*)
1782			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1783			echo "$me: ignoring -U $1" >&2
1784			;;
1785		*) echo "$1='undef'" >> optdef.sh;;
1786		esac
1787		shift
1788		;;
1789	-A)
1790	    shift
1791	    xxx=''
1792	    yyy="$1"
1793	    zzz=''
1794	    uuu=undef
1795	    case "$yyy" in
1796            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1797                 case "$zzz" in
1798                 *:*) zzz='' ;;
1799                 *)   xxx=append
1800                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1801                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1802                 esac
1803                 ;;
1804            esac
1805            case "$xxx" in
1806            '')  case "$yyy" in
1807                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1808                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1809                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1810                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1811                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1812                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1813                 esac
1814                 ;;
1815            esac
1816	    case "$xxx" in
1817	    append)
1818		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1819	    clear)
1820		echo "$yyy=''"			>> posthint.sh ;;
1821	    define)
1822	        case "$zzz" in
1823		'') zzz=define ;;
1824		esac
1825		echo "$yyy='$zzz'"		>> posthint.sh ;;
1826	    eval)
1827		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1828	    prepend)
1829		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1830	    undef)
1831	        case "$zzz" in
1832		'') zzz="$uuu" ;;
1833		esac
1834		echo "$yyy=$zzz"		>> posthint.sh ;;
1835            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1836	    esac
1837	    shift
1838	    ;;
1839	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1840	    exit 0;;
1841	--) break;;
1842	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1843	*) break;;
1844	esac
1845done
1846
1847case "$error" in
1848true)
1849	cat >&2 <<EOM
1850Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1851                 [-U symbol] [-U symbol=] [-A command:symbol...]
1852  -d : use defaults for all answers.
1853  -e : go on without questioning past the production of config.sh.
1854  -f : specify an alternate default configuration file.
1855  -h : print this help message and exit (with an error status).
1856  -r : reuse C symbols value if possible (skips costly nm extraction).
1857  -s : silent mode, only echoes questions and essential information.
1858  -D : define symbol to have some value:
1859         -D symbol                symbol gets the value 'define'
1860         -D symbol='some value'   symbol is set to 'some value'
1861       common used examples (see INSTALL for more info):
1862         -Duse64bitint            use 64bit integers
1863         -Duse64bitall            use 64bit integers and pointers
1864         -Dusethreads             use thread support
1865         -Dinc_version_list=none  do not include older perl trees in @INC
1866         -DEBUGGING=none          DEBUGGING options
1867         -Dcc=gcc                 choose your compiler
1868         -Dprefix=/opt/perl5      choose your destination
1869  -E : stop at the end of questions, after having produced config.sh.
1870  -K : do not use unless you know what you are doing.
1871  -O : ignored for backward compatibility
1872  -S : perform variable substitutions on all .SH files (can mix with -f)
1873  -U : undefine symbol:
1874         -U symbol    symbol gets the value 'undef'
1875         -U symbol=   symbol gets completely empty
1876       e.g.:  -Uversiononly
1877  -A : manipulate symbol after the platform specific hints have been applied:
1878         -A append:symbol=value   append value to symbol
1879         -A symbol=value          like append:, but with a separating space
1880         -A define:symbol=value   define symbol to have value
1881         -A clear:symbol          define symbol to be ''
1882         -A define:symbol         define symbol to be 'define'
1883         -A eval:symbol=value     define symbol to be eval of value
1884         -A prepend:symbol=value  prepend value to symbol
1885         -A undef:symbol          define symbol to be 'undef'
1886         -A undef:symbol=         define symbol to be ''
1887       e.g.:  -A prepend:libswanted='cl pthread '
1888              -A ccflags=-DSOME_MACRO
1889  -V : print version number and exit (with a zero status).
1890EOM
1891	exit 1
1892	;;
1893esac
1894
1895: Sanity checks
1896case "$fastread$alldone" in
1897yescont|yesexit) ;;
1898*)
1899	case "$extractsh" in
1900	true) ;;
1901	*)
1902		if test ! -t 0; then
1903			echo "Say 'sh Configure', not 'sh <Configure'"
1904			exit 1
1905		fi
1906		;;
1907	esac
1908	;;
1909esac
1910
1911exec 4>&1
1912case "$silent" in
1913true) exec 1>/dev/null;;
1914esac
1915
1916: run the defines and the undefines, if any, but leave the file out there...
1917touch optdef.sh
1918grep '\\' optdef.sh >/dev/null 2>&1
1919if test $? = 0; then
1920    echo "Configure does not support \\ in -D arguments"
1921    exit 1
1922fi
1923. ./optdef.sh
1924: create the posthint manipulation script and leave the file out there...
1925touch posthint.sh
1926
1927: set package name
1928package='perl5'
1929first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1930last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1931case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1932ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1933*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1934esac
1935
1936: Some greps do not return status, grrr.
1937echo "grimblepritz" >grimble
1938if grep blurfldyick grimble >/dev/null 2>&1 ; then
1939	contains=contains
1940elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1941	contains=grep
1942else
1943	contains=contains
1944fi
1945rm -f grimble
1946: the following should work in any shell
1947case "$contains" in
1948contains*)
1949	echo " " >&4
1950	echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
1951	cat >contains <<'EOSS'
1952grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1953EOSS
1954contains=./contains
1955chmod +x $contains
1956esac
1957
1958: Find the path to the source tree
1959case "$src" in
1960'') case "$0" in
1961    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1962         case "$src" in
1963	 /*)	;;
1964	 .)	;;
1965         *)	src=`cd ../$src && pwd` ;;
1966	 esac
1967         ;;
1968    *)   src='.';;
1969    esac;;
1970esac
1971case "$src" in
1972'')	src=/
1973	rsrc=/
1974	;;
1975/*)	rsrc="$src";;
1976*)	rsrc="../$src";;
1977esac
1978if test -f $rsrc/Configure && \
1979	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1980then
1981   : found it, so we are ok.
1982else
1983	rsrc=''
1984	for src in . .. ../.. ../../.. ../../../..; do
1985		if test -f ../$src/Configure && \
1986			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1987		then
1988			rsrc=../$src
1989			break
1990		fi
1991	done
1992fi
1993case "$rsrc" in
1994'')
1995	cat <<EOM >&4
1996
1997Sorry, I can't seem to locate the source dir for $package.  Please start
1998Configure with an explicit path -- i.e. /some/path/Configure.
1999
2000EOM
2001	exit 1
2002	;;
2003../.)	rsrc='..';;
2004*)
2005	echo " "
2006	echo "Sources for $package found in \"$src\"." >&4
2007	;;
2008esac
2009
2010: script used to extract .SH files with variable substitutions
2011cat >extract <<'EOS'
2012PERL_CONFIG_SH=true
2013echo "Doing variable substitutions on .SH files..."
2014if test -f MANIFEST; then
2015	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2016else
2017	echo "(Looking for .SH files under the source directory.)"
2018	set x `(cd "$src"; find . -name "*.SH" -print)`
2019fi
2020shift
2021case $# in
20220) set x `(cd "$src"; echo *.SH)`; shift;;
2023esac
2024if test ! -f "$src/$1"; then
2025	shift
2026fi
2027mkdir_p='
2028name=$1;
2029create="";
2030while test $name; do
2031	if test ! -d "$name"; then
2032		create="$name $create";
2033		name=`echo $name | sed -e "s|^[^/]*$||"`;
2034		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2035	else
2036		name="";
2037	fi;
2038done;
2039for file in $create; do
2040	mkdir $file;
2041done
2042'
2043for file in $*; do
2044	case "$src" in
2045	".")
2046		case "$file" in
2047		*/*)
2048			dir=`expr X$file : 'X\(.*\)/'`
2049			file=`expr X$file : 'X.*/\(.*\)'`
2050			(cd "$dir" && . ./$file)
2051			;;
2052		*)
2053			. ./$file
2054			;;
2055		esac
2056		;;
2057	*)
2058		case "$file" in
2059		*/*)
2060			dir=`expr X$file : 'X\(.*\)/'`
2061			file=`expr X$file : 'X.*/\(.*\)'`
2062			(set x $dir; shift; eval $mkdir_p)
2063			sh <"$src/$dir/$file"
2064			;;
2065		*)
2066			sh <"$src/$file"
2067			;;
2068		esac
2069		;;
2070	esac
2071done
2072if test -f "$src/config_h.SH"; then
2073	if test ! -f config.h; then
2074	: oops, they left it out of MANIFEST, probably, so do it anyway.
2075	. "$src/config_h.SH"
2076	fi
2077fi
2078EOS
2079
2080: extract files and exit if asked to do so
2081case "$extractsh" in
2082true)
2083	case "$realsilent" in
2084	true) ;;
2085	*) exec 1>&4;;
2086	esac
2087	case "$config_sh" in
2088	'') config_sh='config.sh';;
2089	esac
2090	echo " "
2091	echo "Fetching answers from $config_sh..."
2092	cd ..
2093	. $config_sh
2094	. UU/optdef.sh
2095	echo " "
2096	. UU/extract
2097	rm -rf UU
2098	echo "Extraction done."
2099	exit 0
2100	;;
2101esac
2102
2103: Eunice requires " " instead of "", can you believe it
2104echo " "
2105: Here we go...
2106echo "Beginning of configuration questions for $package."
2107
2108trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2109
2110: first determine how to suppress newline on echo command
2111echo " "
2112echo "Checking echo to see how to suppress newlines..."
2113(echo "hi there\c" ; echo " ") >.echotmp
2114if $contains c .echotmp >/dev/null 2>&1 ; then
2115	echo "...using -n."
2116	n='-n'
2117	c=''
2118else
2119	cat <<'EOM'
2120...using \c
2121EOM
2122	n=''
2123	c='\c'
2124fi
2125echo $n "The star should be here-->$c"
2126echo '*'
2127rm -f .echotmp
2128
2129: Now test for existence of everything in MANIFEST
2130echo " "
2131if test -f "$rsrc/MANIFEST"; then
2132	echo "First let's make sure your kit is complete.  Checking..." >&4
2133	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2134		(split -l 50 2>/dev/null || split -50)
2135	rm -f missing
2136	tmppwd=`pwd`
2137	for filelist in x??; do
2138		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2139			>/dev/null 2>>"$tmppwd/missing")
2140	done
2141	if test -s missing; then
2142		cat missing >&4
2143		cat >&4 <<'EOM'
2144
2145THIS PACKAGE SEEMS TO BE INCOMPLETE.
2146
2147You have the option of continuing the configuration process, despite the
2148distinct possibility that your kit is damaged, by typing 'y'es.  If you
2149do, don't blame me if something goes wrong.  I advise you to type 'n'o
2150and contact the author (https://github.com/Perl/perl5/issues).
2151
2152EOM
2153		echo $n "Continue? [n] $c" >&4
2154		read ans
2155		case "$ans" in
2156		y*)
2157			echo "Continuing..." >&4
2158			rm -f missing
2159			;;
2160		*)
2161			echo "ABORTING..." >&4
2162			kill $$
2163			;;
2164		esac
2165	else
2166		echo "Looks good..."
2167	fi
2168else
2169	echo "There is no MANIFEST file.  I hope your kit is complete !"
2170fi
2171rm -f missing x??
2172
2173: Find the appropriate value for a newline for tr
2174if test -n "$DJGPP"; then
2175       trnl='\012'
2176fi
2177if test X"$trnl" = X; then
2178	case "`echo foo | tr '\n' x 2>/dev/null`" in
2179	foox) trnl='\n' ;;
2180	esac
2181fi
2182if test X"$trnl" = X; then
2183	case "`echo foo | tr '\012' x 2>/dev/null`" in
2184	foox) trnl='\012' ;;
2185	esac
2186fi
2187if test X"$trnl" = X; then
2188       case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2189       fooxy) trnl='\n\r' ;;
2190       esac
2191fi
2192if test X"$trnl" = X; then
2193	cat <<EOM >&2
2194
2195$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2196
2197EOM
2198	exit 1
2199fi
2200
2201: compute the number of columns on the terminal for proper question formatting
2202case "$COLUMNS" in
2203'') COLUMNS='80';;
2204esac
2205
2206: set up the echo used in my read
2207myecho="case \"\$xxxm\" in
2208'') echo $n \"\$rp $c\" >&4;;
2209*) case \"\$rp\" in
2210	'') echo $n \"[\$xxxm] $c\";;
2211	*)
2212		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2213			echo \"\$rp\" >&4
2214			echo $n \"[\$xxxm] $c\" >&4
2215		else
2216			echo $n \"\$rp [\$xxxm] $c\" >&4
2217		fi
2218		;;
2219	esac;;
2220esac"
2221
2222: now set up to do reads with possible shell escape and default assignment
2223cat <<EOSC >myread
2224$startsh
2225xxxm=\$dflt
2226$myecho
2227ans='!'
2228counter=42
2229case "\$fastread" in
2230yes) case "\$dflt" in
2231	'') ;;
2232	*) ans='';
2233		case "\$silent-\$rp" in
2234		true-) ;;
2235		*) echo " " >&4;;
2236		esac;;
2237	esac;;
2238*) case "\$silent" in
2239	true) case "\$rp" in
2240		'') ans='';;
2241		esac;;
2242	esac;;
2243esac
2244while expr "X\$ans" : "X!" >/dev/null; do
2245	read answ
2246	set x \$xxxm
2247	shift
2248	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2249	case  "\$answ" in
2250	"!")
2251		sh 1>&4
2252		echo " "
2253		$myecho
2254		;;
2255	!*)
2256		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2257		shift
2258		sh 1>&4 -c "\$*"
2259		echo " "
2260		$myecho
2261		;;
2262	"\$ans")
2263		case "\$ans" in
2264		\\&*)
2265			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2266			shift
2267			case "\$1" in
2268			-d)
2269				fastread=yes
2270				echo "(OK, I'll run with -d after this question.)" >&4
2271				;;
2272			-*)
2273				echo "*** Sorry, \$1 not supported yet." >&4
2274				;;
2275			esac
2276			$myecho
2277			ans=!
2278			;;
2279		esac;;
2280	*)
2281		case "\$aok" in
2282		y)
2283			echo "*** Substitution done -- please confirm."
2284			xxxm="\$ans"
2285			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2286			xxxm="\$ans"
2287			ans=!
2288			;;
2289		*)
2290			echo "*** Error -- try again."
2291			ans=!
2292			;;
2293		esac
2294		$myecho
2295		;;
2296	esac
2297	case "\$ans\$xxxm\$nostick" in
2298	'')
2299		ans=!
2300		$myecho
2301		;;
2302	esac
2303	counter=\`echo \$counter | awk '{ print --\$0 }'\`
2304	if [ \$counter = 0 ]; then
2305		echo >&4
2306		echo >&4 Too many attempts asking the same question.  Giving up.
2307		exit 1
2308	fi
2309done
2310case "\$ans" in
2311'') ans="\$xxxm";;
2312esac
2313EOSC
2314
2315: create .config dir to save info across Configure sessions
2316test -d ../.config || mkdir ../.config
2317cat >../.config/README <<EOF
2318This directory created by Configure to save information that should
2319persist across sessions for $package.
2320
2321You may safely delete it if you wish.
2322EOF
2323
2324: See if we are using a devel version and want that
2325xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2326case "$usedevel" in
2327$define|true|[yY]*)
2328    usedevel="$define" ;;
2329*) case "$xversion" in
2330   *[13579])
2331	cat >&4 <<EOH
2332*** WHOA THERE!!! ***
2333
2334    This is an UNSTABLE DEVELOPMENT release.
2335    The version of this $package distribution is $xversion, that is, odd,
2336    (as opposed to even) and that signifies a development release.
2337    If you want a maintenance release, you want an even-numbered version.
2338
2339    Do ***NOT*** install this into production use.
2340    Data corruption and crashes are possible.
2341
2342    It is most seriously suggested that you do not continue any further
2343    unless you want to help in developing and debugging Perl.
2344
2345    If you *still* want to build perl, you can answer 'y' now,
2346    or pass -Dusedevel to Configure.
2347
2348EOH
2349	rp='Do you really want to continue?'
2350	dflt='n'
2351	. ./myread
2352	case "$ans" in
2353	[yY]) echo >&4 "Okay, continuing."
2354	      usedevel="$define" ;;
2355	*) echo >&4 "Okay, bye."
2356	   exit 1
2357	   ;;
2358	esac
2359	;;
2360    esac
2361    usedevel="$undef"
2362    ;;
2363esac
2364case "$usedevel" in
2365$define|true|[yY]*)
2366	case "$versiononly" in
2367	'') versiononly="$define" ;;
2368	esac
2369	case "$installusrbinperl" in
2370	'') installusrbinperl="$undef" ;;
2371	esac
2372	;;
2373esac
2374
2375: general instructions
2376needman=true
2377firsttime=true
2378user=`(logname) 2>/dev/null`
2379case "$user" in
2380'') user=`whoami 2>&1`;;
2381esac
2382if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2383	firsttime=false
2384	echo " "
2385	rp='Would you like to see the instructions?'
2386	dflt=n
2387	. ./myread
2388	case "$ans" in
2389	[yY]*) ;;
2390	*) needman=false;;
2391	esac
2392fi
2393if $needman; then
2394	cat <<EOH
2395
2396This installation shell script will examine your system and ask you questions
2397to determine how the perl5 package should be installed. If you get
2398stuck on a question, you may use a ! shell escape to start a subshell or
2399execute a command.  Many of the questions will have default answers in square
2400brackets; typing carriage return will give you the default.
2401
2402On some of the questions which ask for file or directory names you are allowed
2403to use the ~name construct to specify the login directory belonging to "name",
2404even if you don't have a shell which knows about that.  Questions where this is
2405allowed will be marked "(~name ok)".
2406
2407EOH
2408	rp=''
2409	dflt='Type carriage return to continue'
2410	. ./myread
2411	cat <<'EOH'
2412
2413The prompter used in this script allows you to use shell variables and
2414backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2415in the default answer, as if the default line was a set of arguments given to a
2416script shell.  This means you may also use $* to repeat the whole default line,
2417so you do not have to re-type everything to add something to the default.
2418
2419Every time there is a substitution, you will have to confirm.  If there is an
2420error (e.g. an unmatched backtick), the default answer will remain unchanged
2421and you will be prompted again.
2422
2423If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2424the questions and use the computed defaults (or the previous answers if there
2425was already a config.sh file). Type 'Configure -h' for a list of options.
2426You may also start interactively and then answer '& -d' at any prompt to turn
2427on the non-interactive behaviour for the remainder of the execution.
2428
2429EOH
2430	. ./myread
2431	cat <<EOH
2432
2433Much effort has been expended to ensure that this shell script will run on any
2434Unix system.  If despite that it blows up on yours, your best bet is to edit
2435Configure and run it again.  If you can't run Configure for some reason,
2436you'll have to generate a config.sh file by hand.  Whatever problems you
2437have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2438
2439This installation script affects things in two ways:
2440
24411) it may do direct variable substitutions on some of the files included
2442   in this kit.
24432) it builds a config.h file for inclusion in C programs.  You may edit
2444   any of these files as the need arises after running this script.
2445
2446If you make a mistake on a question, there is no easy way to back up to it
2447currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2448files.  Configure will offer to let you do this before it runs the SH files.
2449
2450EOH
2451	dflt='Type carriage return to continue'
2452	. ./myread
2453	case "$firsttime" in
2454	true) echo $user >>../.config/instruct;;
2455	esac
2456fi
2457
2458: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2459: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2460if test "X$sysroot" = X; then
2461    sysroot=""
2462else
2463    case "$cc" in
2464	*gcc*|*g++*)
2465	    echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2466	    # _sysroot is used in places where we need --sysroot=foo
2467	    # but using the rest of the flags could cause issues.
2468	    _sysroot="--sysroot=$sysroot";
2469	    case "$ccflags" in
2470		*sysroot*) ;;
2471		'undef'|*)
2472		ccflags="$ccflags $_sysroot"
2473	    esac
2474	    case "$ldflags" in
2475		*sysroot*) ;;
2476		'undef'|*)
2477		ldflags="$ldflags $_sysroot"
2478	    esac
2479	    case "$cppflags" in
2480		*sysroot*) ;;
2481		'undef'|*)
2482		cppflags="$cppflags $_sysroot"
2483	    esac
2484	    # lddlflags updated below in lddlflags section;
2485	    # same with cccdlflags
2486	    ;;
2487    esac
2488
2489    # Adjust some defaults to also use $sysroot
2490    for var in xlibpth loclibpth locincpth glibpth; do
2491	eval xxx=\$$var
2492	eval $var=''
2493	for path in $xxx; do
2494	    eval $var=\"\$$var $sysroot$path\"
2495	done
2496    done
2497
2498fi
2499
2500: find out where common programs are
2501echo " "
2502echo "Locating common programs..." >&4
2503cat <<EOSC >loc
2504$startsh
2505case \$# in
25060) exit 1;;
2507esac
2508thing=\$1
2509shift
2510dflt=\$1
2511shift
2512for dir in \$*; do
2513	case "\$thing" in
2514	.)
2515	if test -d \$dir/\$thing; then
2516		echo \$dir
2517		exit 0
2518	fi
2519	;;
2520	*)
2521	for thisthing in \$dir/\$thing; do
2522		: just loop through to pick last item
2523	done
2524	if test -f \$thisthing; then
2525		echo \$thisthing
2526		exit 0
2527	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2528		echo \$thisthing
2529		exit 0
2530	elif test -f \$dir/\$thing.exe; then
2531		if test -n "$DJGPP"; then
2532			echo \$dir/\$thing.exe
2533		elif test "$eunicefix" != ":"; then
2534			: on Eunice apparently
2535			echo \$dir/\$thing
2536		fi
2537		exit 0
2538	fi
2539	;;
2540	esac
2541done
2542echo \$dflt
2543exit 1
2544EOSC
2545chmod +x loc
2546$eunicefix loc
2547loclist="
2548awk
2549cat
2550chmod
2551comm
2552cp
2553echo
2554expr
2555grep
2556ls
2557mkdir
2558rm
2559sed
2560sort
2561touch
2562tr
2563uniq
2564"
2565trylist="
2566ar
2567bison
2568byacc
2569cpp
2570csh
2571date
2572egrep
2573gmake
2574gzip
2575less
2576ln
2577make
2578more
2579nm
2580nroff
2581perl
2582pg
2583test
2584uname
2585zip
2586"
2587pth=`echo $PATH | sed -e "s/$p_/ /g"`
2588pth="$pth $sysroot/lib $sysroot/usr/lib"
2589for file in $loclist; do
2590	eval xxx=\$$file
2591	case "$xxx" in
2592	/*|?:[\\/]*)
2593		if test -f "$xxx"; then
2594			: ok
2595		else
2596			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2597			xxx=`./loc $file $file $pth`
2598		fi
2599		;;
2600	'') xxx=`./loc $file $file $pth`;;
2601	*) xxx=`./loc $xxx $xxx $pth`;;
2602	esac
2603	eval $file=$xxx$_exe
2604	eval _$file=$xxx
2605	case "$xxx" in
2606	/*)
2607		echo $file is in $xxx.
2608		;;
2609	?:[\\/]*)
2610		echo $file is in $xxx.
2611		;;
2612	*)
2613		echo "I don't know where '$file' is, and my life depends on it." >&4
2614		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2615
2616		test -f /etc/debian_version && echo "Run \"apt install build-essential\" to install make and friends" >&4
2617		test -f /etc/SUSE-brand     && echo "Run \"zypper install 'pattern:devel_C_C++'\" to install make and friends" >&4
2618		test -f /etc/redhat-release && echo "Run \"yum groupinstall 'Development Tools'\" to install make and friends" >&4
2619		test -f /etc/fedora-release && echo "Run \"dnf group install 'Development Tools'\" to install make and friends" >&4
2620		exit 1
2621		;;
2622	esac
2623done
2624echo " "
2625echo "Don't worry if any of the following aren't found..."
2626say=offhand
2627for file in $trylist; do
2628	eval xxx=\$$file
2629	case "$xxx" in
2630	/*|?:[\\/]*)
2631		if test -f "$xxx"; then
2632			: ok
2633		else
2634			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2635			xxx=`./loc $file $file $pth`
2636		fi
2637		;;
2638	'') xxx=`./loc $file $file $pth`;;
2639	*) xxx=`./loc $xxx $xxx $pth`;;
2640	esac
2641	eval $file=$xxx$_exe
2642	eval _$file=$xxx
2643	case "$xxx" in
2644	/*)
2645		echo $file is in $xxx.
2646		;;
2647	?:[\\/]*)
2648		echo $file is in $xxx.
2649		;;
2650	*)
2651		echo "I don't see $file out there, $say."
2652		say=either
2653		;;
2654	esac
2655done
2656case "$egrep" in
2657egrep)
2658	echo "Substituting grep for egrep."
2659	egrep=$grep
2660	_egrep=$grep
2661	;;
2662esac
2663case "$less" in
2664'')	;;
2665*)	if $less -R </dev/null >/dev/null 2>&1; then
2666	       echo "Substituting less -R for less."
2667	       less="$less -R"
2668	       _less=$less
2669	fi
2670	;;
2671esac
2672case "$ln" in
2673ln)
2674	echo "Substituting cp for ln."
2675	ln=$cp
2676	_ln=$cp
2677	;;
2678esac
2679case "$make" in
2680make)
2681	case "$gmake" in
2682	gmake)
2683	echo "I can't find make or gmake, and my life depends on it." >&4
2684	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2685	exit 1
2686	;;
2687	esac
2688	;;
2689esac
2690case "$gmake" in
2691gmake)	;;
2692*)	# We can't have osname yet.
2693	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2694		# Assume that gmake, if found, is definitely GNU make
2695		# and prefer it over the system make.
2696		echo "Substituting gmake for make."
2697		make=$gmake
2698		_make=$gmake
2699	fi
2700	;;
2701esac
2702case "$test" in
2703test)
2704	echo "Hopefully test is built into your sh."
2705	;;
2706*)
2707	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2708		echo "Using the test built into your sh."
2709		test=test
2710		_test=test
2711	fi
2712	;;
2713esac
2714case "$echo" in
2715echo)
2716	echo "Hopefully echo is built into your sh."
2717	;;
2718'') ;;
2719*)
2720	echo " "
2721echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2722	$echo $n "hi there$c" >foo1
2723	echo $n "hi there$c" >foo2
2724	if cmp foo1 foo2 >/dev/null 2>&1; then
2725		echo "They are compatible.  In fact, they may be identical."
2726	else
2727		case "$n" in
2728		'-n') n='' c='\c';;
2729		*) n='-n' c='';;
2730		esac
2731		cat <<FOO
2732They are not compatible!  You are probably running ksh on a non-USG system.
2733I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2734have echo built in and we may have to run some Bourne shell scripts.  That
2735means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2736
2737FOO
2738		$echo $n "The star should be here-->$c"
2739		$echo "*"
2740	fi
2741	$rm -f foo1 foo2
2742	;;
2743esac
2744
2745# This question was auctioned at YAPC::Europe-2007 in Vienna
2746# I never promised you could answer it. I only auctioned the question.
2747cat <<FOO
2748The following message is sponsored by
2749
2750  Dresden.pm<--The stars should be here.
2751
2752Dear Perl user, system administrator or package
2753maintainer, the Perl community sends greetings to
2754you. Do you (emblematical) greet back [Y/n]? n
2755
2756FOO
2757
2758: Check what type of C compiler we use
2759cat <<EOS >trygcc
2760$startsh
2761EOS
2762cat <<'EOSC' >>trygcc
2763case "$cc" in
2764'') ;;
2765*)  $rm -f try try.*
2766    $cat >try.c <<EOM
2767int main(int argc, char *argv[]) {
2768  return 0;
2769}
2770EOM
2771    if $cc -o try $ccflags $ldflags try.c; then
2772       :
2773    else
2774        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2775        despair=yes
2776        trygcc=yes
2777        case "$cc" in
2778        *gcc*) trygcc=no ;;
2779        esac
2780	# Skip this test because it gives a false match on output like:
2781	#    ./trygcc: line 23: cc: command not found
2782        # case "`$cc -v -c try.c 2>&1`" in
2783        # *gcc*) trygcc=no ;;
2784        # esac
2785        if $test X"$trygcc" = Xyes; then
2786            if gcc -o try -c try.c; then
2787                echo " "
2788                echo "You seem to have a working gcc, though." >&4
2789		# Switching compilers may undo the work of hints files.
2790		# The most common problem is -D_REENTRANT for threads.
2791		# This heuristic catches that case, but gets false positives
2792		# if -Dusethreads was not actually specified.  Better to
2793		# bail out here with a useful message than fail
2794		# mysteriously later. Should we perhaps just try to
2795		# re-invoke Configure -Dcc=gcc config_args ?
2796		if $test -f usethreads.cbu; then
2797			$cat >&4 <<EOM
2798
2799*** However, any setting of the C compiler flags (e.g. for thread support)
2800*** will be lost.  It may be necessary for you to restart Configure and
2801*** add -Dcc=gcc to your Configure command line.
2802
2803EOM
2804			rp="Would you like to go ahead and try gcc anyway?"
2805			dflt=n
2806		else
2807			rp="Would you like to use it?"
2808			dflt=y
2809		fi
2810                if $test -f myread; then
2811                    . ./myread
2812                else
2813                    if $test -f UU/myread; then
2814                        . ./UU/myread
2815                    else
2816                        echo "Cannot find myread, sorry.  Aborting." >&4
2817                        exit 1
2818                    fi
2819                fi
2820                case "$ans" in
2821                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2822                esac
2823            fi
2824        fi
2825    fi
2826    $rm -f try try.*
2827    ;;
2828esac
2829EOSC
2830
2831cat <<EOS >checkcc
2832$startsh
2833EOS
2834cat <<'EOSC' >>checkcc
2835case "$cc" in
2836'') ;;
2837*)  $rm -f try try.*
2838    $cat >try.c <<EOM
2839int main(int argc, char *argv[]) {
2840  return 0;
2841}
2842EOM
2843    if $cc -o try $ccflags $ldflags try.c; then
2844       :
2845    else
2846        if $test X"$despair" = Xyes; then
2847           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2848        fi
2849        $cat >&4 <<EOM
2850You need to find a working C compiler.
2851Either (purchase and) install the C compiler supplied by your OS vendor,
2852or for a free C compiler try http://gcc.gnu.org/
2853I cannot continue any further, aborting.
2854EOM
2855        exit 1
2856    fi
2857    $rm -f try try.*
2858    ;;
2859esac
2860EOSC
2861
2862: determine whether symbolic links are supported
2863echo " "
2864$touch blurfl
2865if $ln -s blurfl sym > /dev/null 2>&1 ; then
2866	echo "Symbolic links are supported." >&4
2867	lns="$ln -s"
2868else
2869	echo "Symbolic links are NOT supported." >&4
2870	lns="$ln"
2871fi
2872$rm -f blurfl sym
2873
2874: determine whether symbolic links are supported
2875echo " "
2876case "$lns" in
2877*"ln"*" -s")
2878	echo "Checking how to test for symbolic links..." >&4
2879	$lns blurfl sym
2880	if $test "X$issymlink" = X; then
2881		case "$newsh" in
2882		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2883		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2884		esac
2885		if test $? = 0; then
2886			issymlink="test -h"
2887		else
2888			echo "Your builtin 'test -h' may be broken." >&4
2889			case "$test" in
2890			/*)	;;
2891			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2892				for p in $pth
2893				do
2894					if test -f "$p/$test"; then
2895						test="$p/$test"
2896						break
2897					fi
2898				done
2899				;;
2900			esac
2901			case "$test" in
2902			/*)
2903				echo "Trying external '$test -h'." >&4
2904				issymlink="$test -h"
2905				if $test ! -h sym >/dev/null 2>&1; then
2906					echo "External '$test -h' is broken, too." >&4
2907					issymlink=''
2908				fi
2909				;;
2910			*)	issymlink='' ;;
2911			esac
2912		fi
2913	fi
2914	if $test "X$issymlink" = X; then
2915		if $test -L sym 2>/dev/null; then
2916			issymlink="$test -L"
2917			echo "The builtin '$test -L' worked." >&4
2918		fi
2919	fi
2920	if $test "X$issymlink" != X; then
2921		echo "You can test for symbolic links with '$issymlink'." >&4
2922	else
2923		echo "I do not know how you can test for symbolic links." >&4
2924	fi
2925	$rm -f blurfl sym
2926	;;
2927*)	echo "No symbolic links, so not testing for their testing..." >&4
2928	;;
2929esac
2930
2931: Make symlinks util
2932case "$mksymlinks" in
2933$define|true|[yY]*)
2934	case "$src" in
2935	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2936		exit 1
2937		;;
2938	*)	case "$lns:$issymlink" in
2939		*"ln"*" -s:"*"test -"?)
2940			echo "Creating the symbolic links..." >&4
2941			cd ..
2942			awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2943			awk 'NF == 1 {
2944				dir=".";
2945				file=$1 "";
2946			     }
2947			     NF == 2 {
2948				dir=$1 "";
2949				file=$2 "";
2950			     }
2951			     {
2952				 print "# dir = ", dir, "file = ", file
2953				 mf[dir] = mf[dir]" "source"/"dir"/"file;
2954			     } END {
2955				 for (d in mf) {
2956				     if (d != ".") { print("mkdir -p "d) }
2957				     print("ln -sf "mf[d]" "d);
2958				 }
2959			     }' source="$src" > UU/mksymlinks.$$
2960			sh UU/mksymlinks.$$
2961			rm UU/mksymlinks.$$
2962			# Sanity check 1.
2963			if test ! -d t/base; then
2964				echo "Failed to create the subdirectories.  Aborting." >&4
2965				exit 1
2966			fi
2967			# Sanity check 2.
2968			if test ! -f t/base/lex.t; then
2969				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2970				exit 1
2971			fi
2972			if test ! -f win32/win32.c; then
2973				echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2974				exit 1
2975			fi
2976			cd UU
2977			;;
2978		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2979			;;
2980		esac
2981		;;
2982	esac
2983	;;
2984esac
2985
2986: Check for Cross-Compilation
2987if $test "X$targethost" = "X"; then
2988    targethost=""
2989fi
2990if $test "X$targetenv" = "X"; then
2991    targetenv=""
2992fi
2993case "$usecrosscompile" in
2994$define|true|[yY]*)
2995	$echo "Cross-compiling..."
2996	croak=''
2997	case "$cc" in
2998	*-gcc*|*-g++*) # A cross-compiling gcc, probably.
2999	    # arm-linux-androideabi-gcc  -> arm-linux-androideabi
3000	    # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
3001	    targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
3002	    ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
3003	    # leave out ld, choosing it is more complex
3004	    nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
3005	    ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
3006	    # We are in a weird spot. Just before us, some values
3007	    # were 'saved', to be restored after the hints are
3008	    # run.  This means that the changes we made to ar,
3009	    # nm and ranlib will get reverted.
3010	    # To avoid that, we hijack the saving mechanism and
3011	    # have it save our new values.
3012	    for file in ar nm ranlib; do
3013		eval xxx=\$$file
3014		eval $file=$xxx$_exe
3015		eval _$file=$xxx
3016	    done
3017	;;
3018	esac
3019	case "$targetarch" in
3020	'') echo "Targetarch not defined." >&4; croak=y ;;
3021	*)  echo "Using targetarch $targetarch." >&4 ;;
3022	esac
3023	case "$targethost" in
3024	'') echo "Targethost not defined." >&4; croak=n ;;
3025	*)  echo "Using targethost $targethost." >&4
3026	esac
3027	locincpth=' '
3028	loclibpth=' '
3029	case "$croak" in
3030	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3031	esac
3032    : compile a host miniperl and generate_uudmap, unless we got passed them
3033    if $test "X$hostperl" = X; then
3034      echo "Building host miniperl and generate_uudmap binaries" >&4
3035      before_host=`pwd`
3036      cd ..
3037      cd $src
3038      src=`pwd`
3039      rm -rf $src/host
3040      mkdir $src/host
3041      cd $src/host
3042      $src/Configure -des -Dusedevel -Dmksymlinks
3043      $make miniperl
3044      case "$hostgenerate" in
3045      '') $make generate_uudmap
3046          hostgenerate=$src/host/generate_uudmap
3047          ;;
3048       "$undef") hostgenerate=''
3049          ;;
3050      esac
3051      hostperl=$src/host/miniperl
3052      cd $before_host
3053    fi
3054    hostosname=`$hostperl -le 'print $^O'`
3055    ;;
3056*)
3057    usecrosscompile="$undef"
3058    ;;
3059esac
3060
3061: Define -Dtargethost=somecomputer to run compiled tests on another machine
3062case "$targethost" in
3063    '') echo "Checking for cross-compile" >&4
3064    case "$usecrosscompile$multiarch" in
3065       *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3066         if [ -f Makefile ]; then
3067           echo " "
3068           echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3069         else
3070           echo "Configure done."
3071         fi
3072       exit 0
3073       ;;
3074     *) echo "No targethost for running compiler tests against defined, running locally" >&4
3075        run=''
3076        to=:
3077        from=:
3078        ;;
3079    esac
3080    ;;
3081    *) echo "Using targethost $targethost." >&4
3082	case "$src" in
3083	/*) run=$src/Cross/run
3084	    targetmkdir=$src/Cross/mkdir
3085	    to=$src/Cross/to
3086	    from=$src/Cross/from
3087	    ;;
3088	*)  pwd=`$test -f ../Configure & cd ..; pwd`
3089	    run=$pwd/Cross/run
3090	    targetmkdir=$pwd/Cross/mkdir
3091	    to=$pwd/Cross/to
3092	    from=$pwd/Cross/from
3093	    ;;
3094	esac
3095	case "$targetrun" in
3096	'') targetrun=ssh ;;
3097	esac
3098	case "$targetto" in
3099	'') targetto=scp ;;
3100	esac
3101	case "$targetfrom" in
3102	'') targetfrom=scp ;;
3103	esac
3104	run=$run-$targetrun
3105	to=$to-$targetto
3106	from=$from-$targetfrom
3107	case "$targetdir" in
3108	'')  targetdir=/tmp
3109	     echo "Guessing targetdir $targetdir." >&4
3110	     ;;
3111	esac
3112	case "$targetuser" in
3113	'')  targetuser=root
3114	     echo "Guessing targetuser $targetuser." >&4
3115	     ;;
3116	esac
3117	case "$targetport" in
3118	'')  targetport=22
3119	     echo "Guessing targetport $targetport." >&4
3120	     ;;
3121	esac
3122	case "$targetfrom" in
3123	scp)	q=-q ;;
3124	*)	q='' ;;
3125	esac
3126	case "$targetrun" in
3127	ssh|rsh)
3128	    cat >$run <<EOF
3129#!/bin/sh
3130env=''
3131case "\$1" in
3132-cwd)
3133  shift
3134  cwd=\$1
3135  shift
3136  ;;
3137esac
3138case "\$1" in
3139-env)
3140  shift
3141  env=\$1
3142  shift
3143  ;;
3144esac
3145case "\$cwd" in
3146'') cwd=$targetdir ;;
3147esac
3148exe=\$1
3149shift
3150$to \$exe
3151$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3152EOF
3153	    ;;
3154	adb)
3155	    $touch $run
3156	    ;;
3157	*)  echo "Unknown targetrun '$targetrun'" >&4
3158	    exit 1
3159	    ;;
3160	esac
3161	case "$targetmkdir" in
3162	*/Cross/mkdir)
3163	    cat >$targetmkdir <<EOF
3164#!/bin/sh
3165$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3166EOF
3167	    $chmod a+rx $targetmkdir
3168	    ;;
3169	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3170	    exit 1
3171	    ;;
3172	esac
3173	case "$targetto" in
3174	scp|rcp)
3175	    cat >$to <<EOF
3176#!/bin/sh
3177for f in \$@
3178do
3179  case "\$f" in
3180  /*)
3181    $targetmkdir \`dirname \$f\`
3182    $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3183    ;;
3184  *)
3185    $targetmkdir $targetdir/\`dirname \$f\`
3186    $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3187    ;;
3188  esac
3189done
3190exit 0
3191EOF
3192	    ;;
3193	cp) cat >$to <<EOF
3194#!/bin/sh
3195for f in \$@
3196do
3197  case "\$f" in
3198  /*)
3199    $mkdir -p $targetdir/\`dirname \$f\`
3200    $cp \$f $targetdir/\$f || exit 1
3201    ;;
3202  *)
3203    $targetmkdir $targetdir/\`dirname \$f\`
3204    $cp \$f $targetdir/\$f || exit 1
3205    ;;
3206  esac
3207done
3208exit 0
3209EOF
3210	    ;;
3211	*)  echo "Unknown targetto '$targetto'" >&4
3212	    exit 1
3213	    ;;
3214	esac
3215	case "$targetfrom" in
3216	scp|rcp)
3217	  cat >$from <<EOF
3218#!/bin/sh
3219for f in \$@
3220do
3221  $rm -f \$f
3222  $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3223done
3224exit 0
3225EOF
3226	    ;;
3227	cp) cat >$from <<EOF
3228#!/bin/sh
3229for f in \$@
3230do
3231  $rm -f \$f
3232  cp $targetdir/\$f . || exit 1
3233done
3234exit 0
3235EOF
3236	    ;;
3237	*)  echo "Unknown targetfrom '$targetfrom'" >&4
3238	    exit 1
3239	    ;;
3240	esac
3241	if $test ! -f $run; then
3242	    echo "Target 'run' script '$run' not found." >&4
3243	else
3244	    $chmod a+rx $run
3245	fi
3246	if $test ! -f $to; then
3247	    echo "Target 'to' script '$to' not found." >&4
3248	else
3249	    $chmod a+rx $to
3250	fi
3251	if $test ! -f $from; then
3252	    echo "Target 'from' script '$from' not found." >&4
3253	else
3254	    $chmod a+rx $from
3255	fi
3256	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3257	    exit 1
3258	fi
3259	cat >&4 <<EOF
3260Using '$run' for remote execution,
3261and '$from' and '$to'
3262for remote file transfer.
3263EOF
3264	;;
3265*)	run=''
3266	to=:
3267	from=:
3268	usecrosscompile="$undef"
3269	targetarch=''
3270	;;
3271esac
3272
3273: see whether [:lower:] and [:upper:] are supported character classes
3274echo " "
3275case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3276ABYZ-abyz)
3277	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3278	up='[:upper:]'
3279	low='[:lower:]'
3280	;;
3281*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3282	# (0xd9 and 0xe2), therefore that is a nice testing point.
3283	if test "X$up" = X -o "X$low" = X; then
3284	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3285	    rs) up='[A-Z]'
3286		low='[a-z]'
3287		;;
3288	    esac
3289	fi
3290	if test "X$up" = X -o "X$low" = X; then
3291	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3292	    rs) up='A-Z'
3293		low='a-z'
3294		;;
3295	    esac
3296	fi
3297	if test "X$up" = X -o "X$low" = X; then
3298	    case "`echo RS | od -x 2>/dev/null`" in
3299	    *D9E2*|*d9e2*)
3300		echo "Hey, this might be EBCDIC." >&4
3301		if test "X$up" = X -o "X$low" = X; then
3302		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3303		    rs) up='[A-IJ-RS-Z]'
3304			low='[a-ij-rs-z]'
3305			;;
3306		    esac
3307		fi
3308		if test "X$up" = X -o "X$low" = X; then
3309		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3310		    rs) up='A-IJ-RS-Z'
3311			low='a-ij-rs-z'
3312			;;
3313		    esac
3314		fi
3315		;;
3316	    esac
3317	fi
3318esac
3319case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3320rs)
3321    echo "Using $up and $low to convert case." >&4
3322    ;;
3323*)
3324    echo "I don't know how to translate letters from upper to lower case." >&4
3325    echo "Your tr is not acting any way I know of." >&4
3326    exit 1
3327    ;;
3328esac
3329: set up the translation script tr, must be called with ./tr of course
3330cat >tr <<EOSC
3331$startsh
3332case "\$1\$2" in
3333'[A-Z][a-z]') exec $tr '$up' '$low';;
3334'[a-z][A-Z]') exec $tr '$low' '$up';;
3335esac
3336exec $tr "\$@"
3337EOSC
3338chmod +x tr
3339$eunicefix tr
3340
3341: Try to determine whether config.sh was made on this system
3342case "$config_sh" in
3343'')
3344myuname=`$uname -a 2>/dev/null`
3345$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3346# Downcase everything to avoid ambiguity.
3347# Remove slashes and single quotes so we can use parts of this in
3348# directory and file names.
3349# Remove newlines so myuname is sane to use elsewhere.
3350# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3351# because the A-Z/a-z are not consecutive.
3352myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3353	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3354newmyuname="$myuname"
3355dflt=n
3356case "$knowitall" in
3357'')
3358	if test -f ../config.sh; then
3359		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3360			eval "`grep myuname= ../config.sh`"
3361		fi
3362		if test "X$myuname" = "X$newmyuname"; then
3363			dflt=y
3364		fi
3365	fi
3366	;;
3367*) dflt=y;;
3368esac
3369
3370: Get old answers from old config file if Configure was run on the
3371: same system, otherwise use the hints.
3372hint=default
3373cd ..
3374if test -f config.sh; then
3375	echo " "
3376	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3377	. UU/myread
3378	case "$ans" in
3379	n*|N*) echo "OK, I'll ignore it."
3380		mv config.sh config.sh.old
3381		myuname="$newmyuname"
3382		;;
3383	*)  echo "Fetching default answers from your old config.sh file..." >&4
3384		tmp_n="$n"
3385		tmp_c="$c"
3386		tmp_sh="$sh"
3387		. ./config.sh
3388		cp config.sh UU
3389		n="$tmp_n"
3390		c="$tmp_c"
3391		: Older versions did not always set $sh.  Catch re-use of such
3392		: an old config.sh.
3393		case "$sh" in
3394		'') sh="$tmp_sh" ;;
3395		esac
3396		hint=previous
3397		;;
3398	esac
3399fi
3400. ./UU/checkcc
3401if test ! -f config.sh; then
3402	$cat <<EOM
3403
3404First time through, eh?  I have some defaults handy for some systems
3405that need some extra help getting the Configure answers right:
3406
3407EOM
3408	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3409	dflt=''
3410	: Half the following guesses are probably wrong... If you have better
3411	: tests or hints, please send them to https://github.com/Perl/perl5/issues
3412	: The metaconfig authors would also appreciate a copy...
3413	$test -f /irix && osname=irix
3414	$test -f /xenix && osname=sco_xenix
3415	$test -f /dynix && osname=dynix
3416	$test -f /dnix && osname=dnix
3417	$test -f /lynx.os && osname=lynxos
3418	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3419	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3420	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3421	$test -f /bin/mips && /bin/mips && osname=mips
3422	$test -d /usr/apollo/bin && osname=apollo
3423	$test -f /etc/saf/_sactab && osname=svr4
3424	$test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3425	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3426	$test -f /sys/utilities/MultiView && osname=amigaos
3427	if $test -d /MachTen -o -d /MachTen_Folder; then
3428		osname=machten
3429		if $test -x /sbin/version; then
3430			osvers=`/sbin/version | $awk '{print $2}' |
3431			$sed -e 's/[A-Za-z]$//'`
3432		elif $test -x /usr/etc/version; then
3433			osvers=`/usr/etc/version | $awk '{print $2}' |
3434			$sed -e 's/[A-Za-z]$//'`
3435		else
3436			osvers="$2.$3"
3437		fi
3438	fi
3439
3440	$test -f /sys/posix.dll &&
3441		$test -f /usr/bin/what &&
3442		set X `/usr/bin/what /sys/posix.dll` &&
3443		$test "$3" = UWIN &&
3444		osname=uwin &&
3445		osvers="$5"
3446
3447	if $test -f $uname; then
3448		set X $myuname
3449		shift
3450
3451		case "$5" in
3452		fps*) osname=fps ;;
3453		mips*)
3454			case "$4" in
3455			umips) osname=umips ;;
3456			*) osname=mips ;;
3457			esac;;
3458		[23]100) osname=mips ;;
3459		i386*)
3460			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3461			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3462				osname='sco'
3463				osvers=$tmp
3464			elif $test -f /etc/kconfig; then
3465				osname=isc
3466				if test "$lns" = "$ln -s"; then
3467					osvers=4
3468				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3469					osvers=3
3470				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3471					osvers=2
3472				fi
3473			fi
3474			tmp=''
3475			;;
3476		pc*)
3477			if test -n "$DJGPP"; then
3478				osname=dos
3479				osvers=djgpp
3480			fi
3481			;;
3482		esac
3483
3484		case "$1" in
3485		aix) osname=aix
3486			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3487			case "$tmp" in
3488			# oslevel can fail with:
3489			# oslevel: Unable to acquire lock.
3490			*not\ found) osvers="$4"."$3" ;;
3491			'<3240'|'<>3240') osvers=3.2.0 ;;
3492			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3493			'=3250'|'>3250') osvers=3.2.5 ;;
3494			*) osvers=$tmp;;
3495			esac
3496			;;
3497		bitrig) osname=bitrig
3498			osvers="$3"
3499			;;
3500		bsd386) osname=bsd386
3501			osvers=`$uname -r`
3502			;;
3503		cygwin*) osname=cygwin
3504			osvers="$3"
3505			;;
3506		*dc.osx) osname=dcosx
3507			osvers="$3"
3508			;;
3509		dnix) osname=dnix
3510			osvers="$3"
3511			;;
3512		domainos) osname=apollo
3513			osvers="$3"
3514			;;
3515		dgux)	osname=dgux
3516			osvers="$3"
3517			;;
3518		dragonfly) osname=dragonfly
3519			case "$3" in
3520			    [0-9]*) osvers="$3" ;;
3521			    *) osvers="$2" ;;
3522			esac
3523			;;
3524		dynixptx*) osname=dynixptx
3525			osvers=`echo "$4"|sed 's/^v//'`
3526			;;
3527		freebsd) osname=freebsd
3528			osvers="$3" ;;
3529		genix)	osname=genix ;;
3530		gnu)	osname=gnu
3531			osvers="$3" ;;
3532		hp*)	osname=hpux
3533			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3534			;;
3535		irix*)	osname=irix
3536			case "$3" in
3537			4*) osvers=4 ;;
3538			5*) osvers=5 ;;
3539			*)	osvers="$3" ;;
3540			esac
3541			;;
3542		linux)	osname=linux
3543			case "$3" in
3544			*)	osvers="$3" ;;
3545			esac
3546			$test -f /system/lib/libandroid.so && osname=linux-android
3547			;;
3548		MiNT)	osname=mint
3549			;;
3550		minix)	osname=minix
3551			osvers=`$uname -r`
3552			;;
3553		netbsd*) osname=netbsd
3554			osvers="$3"
3555			;;
3556		news-os) osvers="$3"
3557			case "$3" in
3558			4*) osname=newsos4 ;;
3559			*) osname=newsos ;;
3560			esac
3561			;;
3562		nonstop-ux) osname=nonstopux ;;
3563		openbsd) osname=openbsd
3564			osvers="$3"
3565			;;
3566		os2)	osname=os2
3567			osvers="$4"
3568			;;
3569		POSIX-BC | posix-bc ) osname=posix-bc
3570			osvers="$3"
3571			;;
3572		powerux | power_ux | powermax_os | powermaxos | \
3573		powerunix | power_unix) osname=powerux
3574			osvers="$3"
3575			;;
3576		qnx) osname=qnx
3577			osvers="$4"
3578			;;
3579		solaris) osname=solaris
3580			case "$3" in
3581			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3582			*)	osvers="$3" ;;
3583			esac
3584			;;
3585		sunos) osname=sunos
3586			case "$3" in
3587			5*) osname=solaris
3588				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3589			*)	osvers="$3" ;;
3590			esac
3591			;;
3592		titanos) osname=titanos
3593			case "$3" in
3594			1*) osvers=1 ;;
3595			2*) osvers=2 ;;
3596			3*) osvers=3 ;;
3597			4*) osvers=4 ;;
3598			*)	osvers="$3" ;;
3599			esac
3600			;;
3601		ultrix) osname=ultrix
3602			osvers="$3"
3603			;;
3604		osf1|mls+)	case "$5" in
3605				alpha)
3606					osname=dec_osf
3607					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3608					case "$osvers" in
3609					[1-9].[0-9]*) ;;
3610					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3611					esac
3612					;;
3613			hp*)	osname=hp_osf1	;;
3614			mips)	osname=mips_osf1 ;;
3615			esac
3616			;;
3617		# UnixWare 7.1.2 is known as Open UNIX 8
3618		openunix|unixware) osname=svr5
3619			osvers="$4"
3620			;;
3621		uts)	osname=uts
3622			osvers="$3"
3623			;;
3624		vos) osvers="$3"
3625			;;
3626		$2) case "$osname" in
3627			*isc*) ;;
3628			*freebsd*) ;;
3629			svr*)
3630				: svr4.x or possibly later
3631				case "svr$3" in
3632				${osname}*)
3633					osname=svr$3
3634					osvers=$4
3635					;;
3636				esac
3637				case "$osname" in
3638				svr4.0)
3639					: Check for ESIX
3640					if test -f /stand/boot ; then
3641						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3642						if test -n "$INITPROG" -a -f "$INITPROG"; then
3643			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3644							if test -n "$isesix"; then
3645								osname=esix4
3646							fi
3647						fi
3648					fi
3649					;;
3650				esac
3651				;;
3652			*)	if test -f /etc/systemid; then
3653					osname=sco
3654					set `echo $3 | $sed 's/\./ /g'` $4
3655					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3656						osvers=$1.$2.$3
3657					elif $test -f $src/hints/sco_$1_$2.sh; then
3658						osvers=$1.$2
3659					elif $test -f $src/hints/sco_$1.sh; then
3660						osvers=$1
3661					fi
3662				else
3663					case "$osname" in
3664					'') : Still unknown.  Probably a generic Sys V.
3665						osname="sysv"
3666						osvers="$3"
3667						;;
3668					esac
3669				fi
3670				;;
3671			esac
3672			;;
3673		*)	case "$osname" in
3674			'') : Still unknown.  Probably a generic BSD.
3675				osname="$1"
3676				osvers="$3"
3677				;;
3678			esac
3679			;;
3680		esac
3681	else
3682		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3683			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3684			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3685				osname=news_os
3686			fi
3687			$rm -f UU/kernel.what
3688		elif test -d c:/. -o -n "$is_os2" ; then
3689			set X $myuname
3690			osname=os2
3691			osvers="$5"
3692		fi
3693	fi
3694
3695	case "$targetarch" in
3696	'') ;;
3697	*)  hostarch=$osname
3698	    case "$targetarch" in
3699		nto*|*-nto-*)
3700		    # Will load qnx.sh, which should change osname to nto
3701		    osname=qnx
3702		    osvers=''
3703		    ;;
3704		*linux-android*)
3705		    # Catch arm-linux-androideabi, mipsel-linux-android,
3706		    # and i686-linux-android
3707		    osname=linux-android
3708		    osvers=''
3709		    ;;
3710		*linux*)
3711		    # Something like arm-linux-gnueabihf is really just
3712		    # plain linux.
3713		    osname=linux
3714		    osvers=''
3715		    ;;
3716		*solaris*|*sunos*)
3717		    osname=solaris
3718		    # XXX perhaps we should just assume
3719		    # osvers to be 2, or maybe take the value
3720		    # from targetarch. Using $run before the
3721		    # hints are run is somewhat icky.
3722		    set X `$run $uname -a 2>/dev/null`
3723		    shift
3724		    case "$3" in
3725			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3726			*)  osvers="$3" ;;
3727		    esac
3728		    ;;
3729		*)
3730		    osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3731		    osvers=''
3732		;;
3733	    esac
3734	    ;;
3735	esac
3736
3737	: Now look for a hint file osname_osvers, unless one has been
3738	: specified already.
3739	case "$hintfile" in
3740	''|' ')
3741		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3742		: Also try without trailing minor version numbers.
3743		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3744		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3745		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3746		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3747		case "$file" in
3748		'') dflt=none ;;
3749		*)  case "$osvers" in
3750			'') dflt=$file
3751				;;
3752			*)  if $test -f $src/hints/$file.sh ; then
3753					dflt=$file
3754				elif $test -f $src/hints/$xfile.sh ; then
3755					dflt=$xfile
3756				elif $test -f $src/hints/$xxfile.sh ; then
3757					dflt=$xxfile
3758				elif $test -f $src/hints/$xxxfile.sh ; then
3759					dflt=$xxxfile
3760				elif $test -f $src/hints/$xxxxfile.sh ; then
3761					dflt=$xxxxfile
3762				elif $test -f "$src/hints/${osname}.sh" ; then
3763					dflt="${osname}"
3764				else
3765					dflt=none
3766				fi
3767				;;
3768			esac
3769			;;
3770		esac
3771		if $test -f Policy.sh ; then
3772			case "$dflt" in
3773			*Policy*) ;;
3774			none) dflt="Policy" ;;
3775			*) dflt="Policy $dflt" ;;
3776			esac
3777		fi
3778		;;
3779	*)
3780		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3781		;;
3782	esac
3783
3784	if $test -f Policy.sh ; then
3785		$cat <<EOM
3786
3787There's also a Policy hint file available, which should make the
3788site-specific (policy) questions easier to answer.
3789EOM
3790
3791	fi
3792
3793	$cat <<EOM
3794
3795You may give one or more space-separated answers, or "none" if appropriate.
3796If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3797previous run of Configure, you may specify it as well as or instead of
3798OS-specific hints.  If hints are provided for your OS, you should use them:
3799although Perl can probably be built without hints on many platforms, using
3800hints often improve performance and may enable features that Configure can't
3801set up on its own. If there are no hints that match your OS, specify "none";
3802DO NOT give a wrong version or a wrong OS.
3803
3804EOM
3805
3806	rp="Which of these apply, if any?"
3807	. UU/myread
3808	tans=$ans
3809	for file in $tans; do
3810		if $test X$file = XPolicy -a -f Policy.sh; then
3811			. Policy.sh
3812			$cat Policy.sh >> UU/config.sh
3813		elif $test -f $src/hints/$file.sh; then
3814			. $src/hints/$file.sh
3815			$cat $src/hints/$file.sh >> UU/config.sh
3816		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3817			: nothing
3818		else
3819			: Give one chance to correct a possible typo.
3820			echo "$file.sh does not exist"
3821			dflt=$file
3822			rp="hint to use instead?"
3823			. UU/myread
3824			for file in $ans; do
3825				if $test -f "$src/hints/$file.sh"; then
3826					. $src/hints/$file.sh
3827					$cat $src/hints/$file.sh >> UU/config.sh
3828				elif $test X$ans = X -o X$ans = Xnone ; then
3829					: nothing
3830				else
3831					echo "$file.sh does not exist -- ignored."
3832				fi
3833			done
3834		fi
3835	done
3836
3837	hint=recommended
3838	: Remember our hint file for later.
3839	if $test -f "$src/hints/$file.sh" ; then
3840		hintfile="$file"
3841	else
3842		hintfile=''
3843	fi
3844fi
3845cd UU
3846;;
3847*)
3848	echo " "
3849	echo "Fetching default answers from $config_sh..." >&4
3850	tmp_n="$n"
3851	tmp_c="$c"
3852	cd ..
3853	cp $config_sh config.sh 2>/dev/null
3854	chmod +w config.sh
3855	. ./config.sh
3856	cd UU
3857	cp ../config.sh .
3858	n="$tmp_n"
3859	c="$tmp_c"
3860	hint=previous
3861	;;
3862esac
3863. ./optdef.sh
3864
3865: Restore computed paths
3866for file in $loclist $trylist; do
3867	eval $file="\$_$file"
3868done
3869
3870cat << EOM
3871
3872Configure uses the operating system name and version to set some defaults.
3873The default value is probably right if the name rings a bell. Otherwise,
3874since spelling matters for me, either accept the default or answer "none"
3875to leave it blank.
3876
3877EOM
3878case "$osname" in
3879	''|' ')
3880		case "$hintfile" in
3881		''|' '|none) dflt=none ;;
3882		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3883		esac
3884		;;
3885	*) dflt="$osname" ;;
3886esac
3887rp="Operating system name?"
3888. ./myread
3889case "$ans" in
3890none)  osname='' ;;
3891*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3892esac
3893echo " "
3894case "$osvers" in
3895	''|' ')
3896		case "$hintfile" in
3897		''|' '|none) dflt=none ;;
3898		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3899			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3900			case "$dflt" in
3901			''|' ') dflt=none ;;
3902			esac
3903			;;
3904		esac
3905		;;
3906	*) dflt="$osvers" ;;
3907esac
3908rp="Operating system version?"
3909. ./myread
3910case "$ans" in
3911none)  osvers='' ;;
3912*) osvers="$ans" ;;
3913esac
3914
3915
3916. ./posthint.sh
3917
3918: who configured the system
3919cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3920case "$cf_by" in
3921"")
3922	cf_by=`(logname) 2>/dev/null`
3923	case "$cf_by" in
3924	"")
3925		cf_by=`(whoami) 2>/dev/null`
3926		case "$cf_by" in
3927		"") cf_by=unknown ;;
3928		esac ;;
3929	esac ;;
3930esac
3931
3932: decide how portable to be.  Allow command line overrides.
3933case "$d_portable" in
3934"$undef") ;;
3935*)	d_portable="$define" ;;
3936esac
3937
3938: set up shell script to do ~ expansion
3939cat >filexp <<EOSS
3940$startsh
3941: expand filename
3942case "\$1" in
3943 \~/*|\~)
3944	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3945	;;
3946 \~*)
3947	if $test -f /bin/csh; then
3948		/bin/csh -f -c "glob \$1"
3949		failed=\$?
3950		echo ""
3951		exit \$failed
3952	else
3953		name=\`$expr x\$1 : '..\([^/]*\)'\`
3954		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3955		if $test ! -d "\$dir"; then
3956			me=\`basename \$0\`
3957			echo "\$me: can't locate home directory for: \$name" >&2
3958			exit 1
3959		fi
3960		case "\$1" in
3961		*/*)
3962			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3963			;;
3964		*)
3965			echo \$dir
3966			;;
3967		esac
3968	fi
3969	;;
3970*)
3971	echo \$1
3972	;;
3973esac
3974EOSS
3975chmod +x filexp
3976$eunicefix filexp
3977
3978: now set up to get a file name
3979cat <<EOS >getfile
3980$startsh
3981EOS
3982cat <<'EOSC' >>getfile
3983tilde=''
3984fullpath=''
3985already=''
3986skip=''
3987none_ok=''
3988exp_file=''
3989nopath_ok=''
3990orig_rp="$rp"
3991orig_dflt="$dflt"
3992case "$gfpth" in
3993'') gfpth='.' ;;
3994esac
3995
3996case "$fn" in
3997*\(*)
3998	: getfile will accept an answer from the comma-separated list
3999	: enclosed in parentheses even if it does not meet other criteria.
4000	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4001	fn=`echo $fn | sed 's/(.*)//'`
4002	;;
4003esac
4004
4005case "$fn" in
4006*:*)
4007	loc_file=`expr $fn : '.*:\(.*\)'`
4008	fn=`expr $fn : '\(.*\):.*'`
4009	;;
4010esac
4011
4012case "$fn" in
4013*~*) tilde=true;;
4014esac
4015case "$fn" in
4016*/*) fullpath=true;;
4017esac
4018case "$fn" in
4019*+*) skip=true;;
4020esac
4021case "$fn" in
4022*n*) none_ok=true;;
4023esac
4024case "$fn" in
4025*e*) exp_file=true;;
4026esac
4027case "$fn" in
4028*p*) nopath_ok=true;;
4029esac
4030
4031case "$fn" in
4032*f*) type='File';;
4033*d*) type='Directory';;
4034*l*) type='Locate';;
4035esac
4036
4037what="$type"
4038case "$what" in
4039Locate) what='File';;
4040esac
4041
4042case "$exp_file" in
4043'')
4044	case "$d_portable" in
4045	"$define") ;;
4046	*) exp_file=true;;
4047	esac
4048	;;
4049esac
4050
4051cd ..
4052while test "$type"; do
4053	redo=''
4054	rp="$orig_rp"
4055	dflt="$orig_dflt"
4056	case "$tilde" in
4057	true) rp="$rp (~name ok)";;
4058	esac
4059	. UU/myread
4060	if test -f UU/getfile.ok && \
4061		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4062	then
4063		value="$ans"
4064		ansexp="$ans"
4065		break
4066	fi
4067	case "$ans" in
4068	none)
4069		value=''
4070		ansexp=''
4071		case "$none_ok" in
4072		true) type='';;
4073		esac
4074		;;
4075	*)
4076		case "$tilde" in
4077		'') value="$ans"
4078			ansexp="$ans";;
4079		*)
4080			value=`UU/filexp $ans`
4081			case $? in
4082			0)
4083				if test "$ans" != "$value"; then
4084					echo "(That expands to $value on this system.)"
4085				fi
4086				;;
4087			*) value="$ans";;
4088			esac
4089			ansexp="$value"
4090			case "$exp_file" in
4091			'') value="$ans";;
4092			esac
4093			;;
4094		esac
4095		case "$fullpath" in
4096		true)
4097			case "$ansexp" in
4098			/*) value="$ansexp" ;;
4099			[a-zA-Z]:/*) value="$ansexp" ;;
4100			*)
4101				redo=true
4102				case "$already" in
4103				true)
4104				echo "I shall only accept a full path name, as in /bin/ls." >&4
4105				echo "Use a ! shell escape if you wish to check pathnames." >&4
4106					;;
4107				*)
4108				echo "Please give a full path name, starting with slash." >&4
4109					case "$tilde" in
4110					true)
4111				echo "Note that using ~name is ok provided it expands well." >&4
4112						already=true
4113						;;
4114					esac
4115				esac
4116				;;
4117			esac
4118			;;
4119		esac
4120		case "$redo" in
4121		'')
4122			case "$type" in
4123			File)
4124				for fp in $gfpth; do
4125					if test "X$fp" = X.; then
4126					    pf="$ansexp"
4127					else
4128					    pf="$fp/$ansexp"
4129					fi
4130					if test -f "$pf"; then
4131						type=''
4132					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4133					then
4134						echo "($value is not a plain file, but that's ok.)"
4135						type=''
4136					fi
4137					if test X"$type" = X; then
4138					    value="$pf"
4139					    break
4140					fi
4141				done
4142				;;
4143			Directory)
4144				for fp in $gfpth; do
4145					if test "X$fp" = X.; then
4146					    dir="$ans"
4147					    direxp="$ansexp"
4148					else
4149					    dir="$fp/$ansexp"
4150					    direxp="$fp/$ansexp"
4151					fi
4152					if test -d "$direxp"; then
4153						type=''
4154						value="$dir"
4155						break
4156					fi
4157				done
4158				;;
4159			Locate)
4160				if test -d "$ansexp"; then
4161					echo "(Looking for $loc_file in directory $value.)"
4162					value="$value/$loc_file"
4163					ansexp="$ansexp/$loc_file"
4164				fi
4165				if test -f "$ansexp"; then
4166					type=''
4167				fi
4168				case "$nopath_ok" in
4169				true)	case "$value" in
4170					*/*) ;;
4171					*)	echo "Assuming $value will be in people's path."
4172						type=''
4173						;;
4174					esac
4175					;;
4176				esac
4177				;;
4178			esac
4179
4180			case "$skip" in
4181			true) type='';
4182			esac
4183
4184			case "$type" in
4185			'') ;;
4186			*)
4187				if test "$fastread" = yes; then
4188					dflt=y
4189				else
4190					dflt=n
4191				fi
4192				rp="$what $value doesn't exist.  Use that name anyway?"
4193				. UU/myread
4194				dflt=''
4195				case "$ans" in
4196				y*) type='';;
4197				*) echo " ";;
4198				esac
4199				;;
4200			esac
4201			;;
4202		esac
4203		;;
4204	esac
4205done
4206cd UU
4207ans="$value"
4208rp="$orig_rp"
4209dflt="$orig_dflt"
4210rm -f getfile.ok
4211test "X$gfpthkeep" != Xy && gfpth=""
4212EOSC
4213
4214: determine root of directory hierarchy where package will be installed.
4215case "$prefix" in
4216'')	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4217	;;
4218*)	dflt="$prefix"
4219	;;
4220esac
4221$cat <<EOM
4222
4223By default, $package will be installed in $dflt/bin, manual pages
4224under $dflt/man, etc..., i.e. with $dflt as prefix for all
4225installation directories. Typically this is something like /usr/local.
4226If you wish to have binaries under /usr/bin but other parts of the
4227installation under /usr/local, that's ok: you will be prompted
4228separately for each of the installation directories, the prefix being
4229only used to set the defaults.
4230
4231EOM
4232fn=d~
4233rp='Installation prefix to use?'
4234. ./getfile
4235oldprefix=''
4236case "$prefix" in
4237'')	;;
4238*)	case "$ans" in
4239	"$prefix") ;;
4240	*) oldprefix="$prefix";;
4241	esac
4242	;;
4243esac
4244
4245case "$ans" in
4246*?/)	prefix=`echo "$ans" | sed 's/.$//'`
4247	;;
4248*)	prefix="$ans"
4249esac
4250
4251case "$ansexp" in
4252*?/)	prefixexp=`echo "$ansexp" | sed 's/.$//'`
4253	;;
4254*)	prefixexp="$ansexp"
4255esac
4256
4257: allow them to override the AFS root
4258case "$afsroot" in
4259'')	afsroot=/afs ;;
4260*)	afsroot=$afsroot ;;
4261esac
4262
4263: is AFS running?
4264echo " "
4265case "$afs" in
4266$define|true)	afs=true ;;
4267$undef|false)	afs=false ;;
4268*)	if $test -d $afsroot; then
4269		afs=true
4270	else
4271		afs=false
4272	fi
4273	;;
4274esac
4275if $afs; then
4276	echo "AFS may be running... I'll be extra cautious then..." >&4
4277else
4278	echo "AFS does not seem to be running..." >&4
4279fi
4280
4281: determine installation prefix for where package is to be installed.
4282if $afs; then
4283$cat <<EOM
4284
4285Since you are running AFS, I need to distinguish the directory in which
4286files will reside from the directory in which they are installed (and from
4287which they are presumably copied to the former directory by occult means).
4288
4289EOM
4290	case "$installprefix" in
4291	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4292	*) dflt="$installprefix";;
4293	esac
4294else
4295$cat <<EOM
4296
4297In some special cases, particularly when building $package for distribution,
4298it is convenient to distinguish the directory in which files should be
4299installed from the directory ($prefix) in which they will
4300eventually reside.  For most users, these two directories are the same.
4301
4302EOM
4303	case "$installprefix" in
4304	'') dflt=$prefix ;;
4305	*) dflt=$installprefix;;
4306	esac
4307fi
4308fn=d~
4309rp='What installation prefix should I use for installing files?'
4310. ./getfile
4311installprefix="$ans"
4312installprefixexp="$ansexp"
4313
4314: Perform the prefixexp/installprefixexp correction if necessary
4315cat <<EOS >installprefix
4316$startsh
4317EOS
4318cat <<'EOSC' >>installprefix
4319: Change installation prefix, if necessary.
4320if $test X"$prefix" != X"$installprefix"; then
4321    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4322else
4323    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4324fi
4325EOSC
4326chmod +x installprefix
4327$eunicefix installprefix
4328
4329: Set variables such as privlib and privlibexp from the output of ./getfile
4330: performing the prefixexp/installprefixexp correction if necessary.
4331cat <<EOS >setprefixvar
4332$startsh
4333EOS
4334cat <<'EOSC' >>setprefixvar
4335eval "${prefixvar}=\"\$ans\""
4336eval "${prefixvar}exp=\"\$ansexp\""
4337. ./installprefix
4338EOSC
4339chmod +x setprefixvar
4340$eunicefix setprefixvar
4341
4342: set up the script used to warn in case of inconsistency
4343cat <<EOS >whoa
4344$startsh
4345EOS
4346cat <<'EOSC' >>whoa
4347dflt=y
4348case "$hint" in
4349    recommended)
4350	case "$hintfile" in
4351	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4352		;;
4353	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4354		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4355		;;
4356	esac
4357	;;
4358    *)	echo " "
4359	echo "*** WHOA THERE!!! ***" >&4
4360	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4361	;;
4362esac
4363rp="    Keep the $hint value?"
4364. ./myread
4365case "$ans" in
4366y) td=$was; tu=$was;;
4367esac
4368EOSC
4369
4370: function used to set '$1' to '$val'
4371setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4372case "$val$was" in
4373$define$undef) . ./whoa; eval "$var=\$td";;
4374$undef$define) . ./whoa; eval "$var=\$tu";;
4375*) eval "$var=$val";;
4376esac'
4377
4378: Do we want threads support and if so, what type
4379case "$usethreads" in
4380$define|true|[yY]*)     dflt='y';;
4381*)     # Catch case where user specified ithreads but
4382       # forgot -Dusethreads (A.D. 4/2002)
4383       case "$useithreads" in
4384       *$define*)	dflt='y';;
4385       *)		dflt='n';;
4386       esac
4387       ;;
4388esac
4389cat <<EOM
4390
4391Perl can be built to offer a form of threading support on some systems
4392To do so, Configure can be run with -Dusethreads.
4393
4394Note that Perl built with threading support runs slightly slower
4395and uses slightly more memory than plain Perl.
4396
4397If this doesn't make any sense to you, just accept the default '$dflt'.
4398EOM
4399rp='Build a threading Perl?'
4400. ./myread
4401case "$ans" in
4402y|Y)    val="$define" ;;
4403*)      val="$undef" ;;
4404esac
4405set usethreads
4406eval $setvar
4407
4408useithreads="$usethreads"
4409
4410case "$d_oldpthreads" in
4411'')	: Configure tests would be welcome here.  For now, assume undef.
4412	val="$undef" ;;
4413*)	val="$d_oldpthreads" ;;
4414esac
4415set d_oldpthreads
4416eval $setvar
4417
4418
4419: Look for a hint-file generated 'call-back-unit'.  If the
4420: user has specified that a threading perl is to be built,
4421: we may need to set or change some other defaults.
4422if $test -f usethreads.cbu; then
4423    echo "Your platform has some specific hints regarding threaded builds, using them..."
4424    . ./usethreads.cbu
4425else
4426    case "$usethreads" in
4427	"$define"|true|[yY]*)
4428		$cat <<EOM
4429(Your platform does not have any specific hints for threaded builds.
4430 Assuming POSIX threads, then.)
4431EOM
4432	;;
4433    esac
4434fi
4435
4436: Check if multiplicity is required
4437cat <<EOM
4438
4439Perl can be built so that multiple Perl interpreters can coexist
4440within the same Perl executable.
4441EOM
4442
4443case "$useithreads" in
4444$define)
4445	cat <<EOM
4446This multiple interpreter support is required for interpreter-based threads.
4447EOM
4448	val="$define"
4449	;;
4450*)	case "$usemultiplicity" in
4451	$define|true|[yY]*)	dflt='y';;
4452	*) dflt='n';;
4453	esac
4454	echo " "
4455	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4456	rp='Build Perl for multiplicity?'
4457	. ./myread
4458	case "$ans" in
4459	y|Y)	val="$define" ;;
4460	*)      val="$undef" ;;
4461	esac
4462	;;
4463esac
4464set usemultiplicity
4465eval $setvar
4466
4467: Check if morebits is requested
4468case "$usemorebits" in
4469"$define"|true|[yY]*)
4470	use64bitint="$define"
4471	uselongdouble="$define"
4472	usemorebits="$define"
4473	;;
4474*)	usemorebits="$undef"
4475	;;
4476esac
4477
4478: Determine the C compiler to be used
4479echo " "
4480case "$cc" in
4481'') dflt=cc;;
4482*) dflt="$cc";;
4483esac
4484rp="Use which C compiler?"
4485. ./myread
4486cc="$ans"
4487
4488: See whether they have no cc but they do have gcc
4489. ./trygcc
4490if $test -f cc.cbu; then
4491    . ./cc.cbu
4492fi
4493. ./checkcc
4494
4495: make some quick guesses about what we are up against
4496echo " "
4497$echo $n "Hmm...  $c"
4498echo exit 1 >bsd
4499echo exit 1 >usg
4500echo exit 1 >v7
4501echo exit 1 >osf1
4502echo exit 1 >eunice
4503echo exit 1 >xenix
4504echo exit 1 >venix
4505echo exit 1 >os2
4506d_bsd="$undef"
4507$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4508if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4509then
4510	echo "Looks kind of like an OSF/1 system, but we'll see..."
4511	echo exit 0 >osf1
4512elif test `echo abc | $tr a-z A-Z` = Abc ; then
4513	xxx=`./loc addbib blurfl $pth`
4514	if $test -f $xxx; then
4515	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4516		echo exit 0 >bsd
4517		echo exit 0 >usg
4518	else
4519		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4520			echo "Looks kind of like an extended USG system, but we'll see..."
4521		else
4522			echo "Looks kind of like a USG system, but we'll see..."
4523		fi
4524		echo exit 0 >usg
4525	fi
4526elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4527	echo "Looks kind of like a BSD system, but we'll see..."
4528	d_bsd="$define"
4529	echo exit 0 >bsd
4530else
4531	echo "Looks kind of like a Version 7 system, but we'll see..."
4532	echo exit 0 >v7
4533fi
4534case "$eunicefix" in
4535*unixtovms*)
4536	$cat <<'EOI'
4537There is, however, a strange, musty smell in the air that reminds me of
4538something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4539EOI
4540	echo exit 0 >eunice
4541	d_eunice="$define"
4542: it so happens the Eunice I know will not run shell scripts in Unix format
4543	;;
4544*)
4545	echo " "
4546	echo "Congratulations.  You aren't running Eunice."
4547	d_eunice="$undef"
4548	;;
4549esac
4550: Detect OS2.  The p_ variable is set above in the Head.U unit.
4551: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4552: semicolon as a patch separator
4553case "$p_" in
4554:) ;;
4555*)
4556	$cat <<'EOI'
4557I have the feeling something is not exactly right, however...don't tell me...
4558lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4559(Or you may be running DOS with DJGPP.)
4560EOI
4561	echo exit 0 >os2
4562	;;
4563esac
4564if test -f /xenix; then
4565	echo "Actually, this looks more like a XENIX system..."
4566	echo exit 0 >xenix
4567	d_xenix="$define"
4568else
4569	echo " "
4570	echo "It's not Xenix..."
4571	d_xenix="$undef"
4572fi
4573chmod +x xenix
4574$eunicefix xenix
4575if test -f /venix; then
4576	echo "Actually, this looks more like a VENIX system..."
4577	echo exit 0 >venix
4578else
4579	echo " "
4580	if ./xenix; then
4581		: null
4582	else
4583		echo "Nor is it Venix..."
4584	fi
4585fi
4586chmod +x bsd usg v7 osf1 eunice xenix venix os2
4587$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4588$rm -f foo
4589
4590: Check if we are using GNU gcc and what its version is
4591echo " "
4592echo "Checking for GNU cc in disguise and/or its version number..." >&4
4593$cat >try.c <<EOM
4594#include <stdio.h>
4595int main() {
4596#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4597#ifdef __VERSION__
4598	printf("%s\n", __VERSION__);
4599#else
4600	printf("%s\n", "1");
4601#endif
4602#endif
4603	return(0);
4604}
4605EOM
4606if $cc -o try $ccflags $ldflags try.c; then
4607	gccversion=`$run ./try`
4608	case "$gccversion" in
4609	'') echo "You are not using GNU cc." ;;
4610	*)  echo "You are using GNU cc $gccversion."
4611	    ccname=gcc
4612	    ;;
4613	esac
4614else
4615	echo " "
4616	echo "*** WHOA THERE!!! ***" >&4
4617	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4618	case "$knowitall" in
4619	'')
4620	echo "    You'd better start hunting for one and let me know about it." >&4
4621		exit 1
4622		;;
4623	esac
4624fi
4625$rm -f try try.*
4626case "$gccversion" in
46271.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4628esac
4629case "$gccversion" in
4630'') gccosandvers='' ;;
4631*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4632   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4633   gccshortvers=''
4634   case "$gccosandvers" in
4635   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4636   $osname$osvers) ;; # looking good
4637   $osname*) cat <<EOM >&4
4638
4639*** WHOA THERE!!! ***
4640
4641    Your gcc has not been compiled for the exact release of
4642    your operating system ($gccosandvers versus $osname$osvers).
4643
4644    In general it is a good idea to keep gcc synchronized with
4645    the operating system because otherwise serious problems
4646    may ensue when trying to compile software, like Perl.
4647
4648    I'm trying to be optimistic here, though, and will continue.
4649    If later during the configuration and build icky compilation
4650    problems appear (headerfile conflicts being the most common
4651    manifestation), I suggest reinstalling the gcc to match
4652    your operating system release.
4653
4654EOM
4655      ;;
4656   *) gccosandvers='' ;; # failed to parse, better be silent
4657   esac
4658   ;;
4659esac
4660case "$ccname" in
4661'') ccname="$cc" ;;
4662esac
4663
4664# gcc 3.* complain about adding -Idirectories that they already know about,
4665# so we will take those off from locincpth.
4666case "$gccversion" in
46673.*)
4668    echo "int main(){}">try.c
4669    for incdir in $locincpth; do
4670       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4671	     grep '^c[cp]p*[01]: warning: changing search order '`
4672       if test "X$warn" != X; then
4673	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4674       fi
4675    done
4676    $rm -f try try.*
4677esac
4678
4679# gcc 4.9 by default does some optimizations that break perl.
4680# see ticket 121505.
4681#
4682# The -fwrapv disables those optimizations (and probably others,) so
4683# for gcc 4.9 (and later, since the optimizations probably won't go
4684# away), add -fwrapv unless the user requests -fno-wrapv, which
4685# disables -fwrapv, or if the user requests -fsanitize=undefined,
4686# which turns the overflows -fwrapv ignores into runtime errors.
4687case "$gccversion" in
46884.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4689    case "$ccflags" in
4690    *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4691    *) ccflags="$ccflags -fwrapv" ;;
4692    esac
4693esac
4694
4695# Really old versions of gcc default to C89 and will error for this code.
4696# See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4697# Initialisations in for loops seem to be the particular problem
4698# (Does this syntax conflict with something else that was valid C89?)
4699# We also add a declaration after a statement to detect whether the compiler
4700# (or the user supplied -Accflags) consider such declarations to be errors.
4701# This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4702# to fail hard and early.
4703#
4704# Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4705# syscall, drand48 etc when including <unistd.h>, which messes up our build.
4706# I guess we *could* loop round trying -std=c99 first with checks both for the
4707# prototype found and the code compiling (because -std=gnu99 might do other
4708# things we don't want, particularly on non-GCC compilers) but
4709# 1) We would need to check for the prototype first (without any flags)
4710# 2) We would still end up with most Linux systems either being -std=gnu99
4711#    or "" (no flag), and so both common options would not rigorously check our
4712#    portability to other platforms.
4713# So it doesn't seem worth the complexity and chance of different failure.
4714$cat >try.c <<'EOCP'
4715int main(int argc, char **argv) {
4716    argc = argc + 1;
4717    /* This is deliberately a declaration after a statement. */
4718    unsigned long long count = 0;
4719    for (char **p = argv; *p; ++p) {
4720        ++count;
4721    }
4722    return count == 1 ? 0 : argc;
4723}
4724EOCP
4725c99_for=no
4726for flag in '' '-std=gnu99' '-std=c99'; do
4727    if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4728        c99_for="$flag"
4729        break;
4730    fi
4731done
4732case "$c99_for" in
4733'') echo "Your C compiler doesn't need any special flags to compile C99 code"
4734    ;;
4735no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4736    rp='Do you really want to continue?'
4737    dflt='n'
4738    . ./myread
4739    case "$ans" in
4740	[yY])	echo >&4 "Okay, continuing."	;;
4741	*)	exit 1				;;
4742    esac
4743    ;;
4744*)  echo "Your C compiler needs $c99_for to compile C99 code"
4745    ccflags="$c99_for $ccflags"
4746    ;;
4747esac
4748$rm -f try try.*
4749
4750: What should the include directory be ?
4751: Use sysroot if set, so findhdr looks in the right place.
4752echo " "
4753$echo $n "Hmm...  $c"
4754dflt="$sysroot/usr/include"
4755incpath=''
4756mips_type=''
4757if $test -f /bin/mips && /bin/mips; then
4758	echo "Looks like a MIPS system..."
4759	$cat >usr.c <<'EOCP'
4760#ifdef SYSTYPE_BSD43
4761/bsd43
4762#endif
4763EOCP
4764	if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4765		dflt='/bsd43/usr/include'
4766		incpath='/bsd43'
4767		mips_type='BSD 4.3'
4768	else
4769		mips_type='System V'
4770	fi
4771	$rm -f usr.c usr.out
4772	echo "and you're compiling with the $mips_type compiler and libraries."
4773	xxx_prompt=y
4774	echo "exit 0" >mips
4775else
4776	echo "Doesn't look like a MIPS system."
4777	xxx_prompt=n
4778	echo "exit 1" >mips
4779fi
4780chmod +x mips
4781$eunicefix mips
4782case "$usrinc" in
4783'') ;;
4784*) dflt="$usrinc";;
4785esac
4786case "$xxx_prompt" in
4787y)	fn=d/
4788	echo " "
4789	rp='Where are the include files you want to use?'
4790	. ./getfile
4791	usrinc="$ans"
4792	;;
4793*)	usrinc="$dflt"
4794	;;
4795esac
4796
4797: see how we invoke the C preprocessor
4798echo " "
4799echo "Now, how can we feed standard input to your C preprocessor..." >&4
4800cat <<'EOT' >testcpp.c
4801#define ABC abc
4802#define XYZ xyz
4803ABC.XYZ
4804EOT
4805cd ..
4806if test ! -f cppstdin; then
4807	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4808		# AIX cc -E doesn't show the absolute headerfile
4809		# locations but we'll cheat by using the -M flag.
4810		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
4811	else
4812		echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4813	fi
4814else
4815	echo "Keeping your $hint cppstdin wrapper."
4816fi
4817chmod 755 cppstdin
4818wrapper=`pwd`/cppstdin
4819ok='false'
4820cd UU
4821
4822if $test "X$cppstdin" != "X" && \
4823	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4824	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4825then
4826	echo "You used to use $cppstdin $cppminus so we'll use that again."
4827	case "$cpprun" in
4828	'') echo "But let's see if we can live without a wrapper..." ;;
4829	*)
4830		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4831			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4832		then
4833			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4834			ok='true'
4835		else
4836			echo "(However, $cpprun $cpplast does not work, let's see...)"
4837		fi
4838		;;
4839	esac
4840else
4841	case "$cppstdin" in
4842	'') ;;
4843	*)
4844		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4845		;;
4846	esac
4847fi
4848
4849if $ok; then
4850	: nothing
4851elif echo 'Maybe "'"$cc"' -E" will work...'; \
4852	$cc -E <testcpp.c >testcpp.out 2>&1; \
4853	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854	echo "Yup, it does."
4855	x_cpp="$cc $cppflags -E"
4856	x_minus='';
4857elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4858	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4859	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860	echo "Yup, it does."
4861	x_cpp="$cc $cppflags -E"
4862	x_minus='-';
4863elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4864	$cc -P <testcpp.c >testcpp.out 2>&1; \
4865	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866	echo "Yipee, that works!"
4867	x_cpp="$cc $cppflags -P"
4868	x_minus='';
4869elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4870	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4871	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872	echo "At long last!"
4873	x_cpp="$cc $cppflags -P"
4874	x_minus='-';
4875elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4876	$cpp <testcpp.c >testcpp.out 2>&1; \
4877	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878	echo "It works!"
4879	x_cpp="$cpp $cppflags"
4880	x_minus='';
4881elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4882	$cpp - <testcpp.c >testcpp.out 2>&1; \
4883	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884	echo "Hooray, it works!  I was beginning to wonder."
4885	x_cpp="$cpp $cppflags"
4886	x_minus='-';
4887elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4888	$wrapper <testcpp.c >testcpp.out 2>&1; \
4889	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890	x_cpp="$wrapper"
4891	x_minus=''
4892	echo "Eureka!"
4893else
4894	dflt=''
4895	rp="No dice.  I can't find a C preprocessor.  Name one:"
4896	. ./myread
4897	x_cpp="$ans"
4898	x_minus=''
4899	$x_cpp <testcpp.c >testcpp.out 2>&1
4900	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4901		echo "OK, that will do." >&4
4902	else
4903echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4904		exit 1
4905	fi
4906fi
4907
4908case "$ok" in
4909false)
4910	cppstdin="$x_cpp"
4911	cppminus="$x_minus"
4912	cpprun="$x_cpp"
4913	cpplast="$x_minus"
4914	set X $x_cpp
4915	shift
4916	case "$1" in
4917	"$cpp")
4918		echo "Perhaps can we force $cc -E using a wrapper..."
4919		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4920			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4921		then
4922			echo "Yup, we can."
4923			cppstdin="$wrapper"
4924			cppminus='';
4925		else
4926			echo "Nope, we'll have to live without it..."
4927		fi
4928		;;
4929	esac
4930	case "$cpprun" in
4931	"$wrapper")
4932		cpprun=''
4933		cpplast=''
4934		;;
4935	esac
4936	;;
4937esac
4938
4939case "$cppstdin" in
4940"$wrapper"|'cppstdin') ;;
4941*) $rm -f $wrapper;;
4942esac
4943$rm -f testcpp.c testcpp.out
4944
4945: Adjust cppfilter for path component separator
4946case "$osname" in
4947vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4948os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4949*)   cppfilter='' ;;
4950esac
4951
4952: Use gcc to determine libpth and incpth
4953# If using gcc or clang, we can get better values for libpth, incpth
4954# and usrinc directly from the compiler.
4955# Note that ccname for clang is also gcc.
4956case "$ccname" in
4957    gcc)
4958	realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4959	$echo 'extern int foo;' > try.c
4960	set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4961	shift
4962	inclibpth=""
4963	if $test $# -gt 0; then
4964	    for i in $*; do
4965		case $realpath in
4966		    */realpath) i=`$realpath $i` ;;
4967		esac
4968		incpth="$incpth $i"
4969		j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4970		if $test -d $j; then
4971		    inclibpth="$inclibpth $j"
4972		fi
4973	    done
4974	    incpth="`$echo $incpth | $sed 's/^ //'`"
4975	    for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4976		if $test -d $xxx; then
4977		    case $realpath in
4978			*/realpath) xxx=`$realpath $xxx` ;;
4979		    esac
4980		    case " $libpth " in
4981		    *" $xxx "*) ;;
4982		    *) libpth="$libpth $xxx";;
4983		    esac
4984		fi
4985	    done
4986	    libpth="`$echo $libpth | $sed 's/^ //'`"
4987	fi
4988	$rm -f try.c
4989	case "$usrinc" in
4990	'') for i in $incpth; do
4991		if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4992		    usrinc="$i"
4993		    break
4994		fi
4995	    done
4996	    ;;
4997	esac
4998
4999	case "$usecrosscompile" in
5000	$define|true|[yY]*)
5001	    case "$incpth" in
5002		'') echo "Incpth not defined." >&4; croak=y ;;
5003		*)  echo "Using incpth '$incpth'." >&4 ;;
5004	    esac
5005	    case "$libpth" in
5006		'') echo "Libpth not defined." >&4; croak=y ;;
5007		*)  echo "Using libpth '$libpth'." >&4 ;;
5008	    esac
5009	    case "$usrinc" in
5010		'') echo "Usrinc not defined." >&4; croak=y ;;
5011		*)  echo "Using usrinc $usrinc." >&4 ;;
5012	    esac
5013	    case "$croak" in
5014		y)
5015		if test "X$sysroot" = X; then
5016		    echo "Cannot continue, aborting." >&4; exit 1
5017		else
5018		    echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5019		fi
5020		;;
5021	    esac
5022	    ;;
5023	esac
5024    ;;
5025esac
5026
5027: Default value for incpth is just usrinc
5028case "$incpth" in
5029'') incpth="$usrinc";;
5030esac
5031
5032: Set private lib path
5033case "$plibpth" in
5034'') if ./mips; then
5035	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5036    fi;;
5037esac
5038case "$libpth" in
5039' ') dlist='';;
5040'') dlist="$loclibpth $plibpth $glibpth";;
5041*) dlist="$libpth";;
5042esac
5043
5044: Now check and see which directories actually exist, avoiding duplicates
5045for xxx in $dlist
5046do
5047    if $test -d $xxx; then
5048		case " $libpth " in
5049		*" $xxx "*) ;;
5050		*) libpth="$libpth $xxx";;
5051		esac
5052    fi
5053done
5054$cat <<'EOM'
5055
5056Some systems have incompatible or broken versions of libraries.  Among
5057the directories listed in the question below, please remove any you
5058know not to be holding relevant libraries, and add any that are needed.
5059Say "none" for none.
5060
5061EOM
5062
5063if test "X$sysroot" != X; then
5064    $cat <<EOM
5065You have set sysroot to $sysroot, please supply the directories excluding sysroot
5066
5067EOM
5068fi
5069
5070case "$libpth" in
5071'') dflt='none';;
5072*)
5073	set X $libpth
5074	shift
5075	dflt=${1+"$@"}
5076	;;
5077esac
5078rp="Directories to use for library searches?"
5079. ./myread
5080case "$ans" in
5081none) libpth=' ';;
5082*) libpth="$ans";;
5083esac
5084
5085: compute shared library extension
5086case "$so" in
5087'')
5088	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5089		dflt='sl'
5090	else
5091		dflt='so'
5092	fi
5093	;;
5094*) dflt="$so";;
5095esac
5096$cat <<EOM
5097
5098On some systems, shared libraries may be available.  Answer 'none' if
5099you want to suppress searching of shared libraries for the remainder
5100of this configuration.
5101
5102EOM
5103rp='What is the file extension used for shared libraries?'
5104. ./myread
5105so="$ans"
5106
5107: Does target system insist that shared library basenames are unique
5108$cat << EOM
5109
5110Some dynamic loaders assume that the *basename* of shared library filenames
5111are globally unique.  We'll default this to undef as we assume your system
5112is not this weird. Set to defined if you're on one of them.
5113
5114EOM
5115
5116dflt='n'
5117rp='Make shared library basenames unique?'
5118. ./myread
5119case "$ans" in
5120y|Y) val="$define" ;;
5121*)   val="$undef"  ;;
5122esac
5123set d_libname_unique
5124eval $setvar
5125
5126: Define several unixisms.
5127: Hints files or command line option can be used to override them.
5128: The convoluted testing is in case hints files set either the old
5129: or the new name.
5130case "$_exe" in
5131'')	case "$exe_ext" in
5132	'')	;;
5133	*)	_exe="$exe_ext" ;;
5134	esac
5135	;;
5136esac
5137case "$_a" in
5138'')	case "$lib_ext" in
5139    '')	_a='.a';;
5140	*)	_a="$lib_ext" ;;
5141	esac
5142	;;
5143esac
5144case "$_o" in
5145'') case "$obj_ext" in
5146	'')	_o='.o';;
5147	*)	_o="$obj_ext";;
5148	esac
5149	;;
5150esac
5151case "$p_" in
5152'') case "$path_sep" in
5153	'')	p_=':';;
5154	*)	p_="$path_sep";;
5155	esac
5156	;;
5157esac
5158exe_ext=$_exe
5159lib_ext=$_a
5160obj_ext=$_o
5161path_sep=$p_
5162
5163rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5164
5165: Which makefile gets called first.  This is used by make depend.
5166case "$firstmakefile" in
5167'') firstmakefile='makefile';;
5168esac
5169
5170: Check is we will use socks
5171case "$usesocks" in
5172$define|true|[yY]*)	dflt='y';;
5173*) dflt='n';;
5174esac
5175cat <<EOM
5176
5177Perl can be built to use the SOCKS proxy protocol library.  To do so,
5178Configure must be run with -Dusesocks.  If you use SOCKS you also need
5179to use the PerlIO abstraction layer, this will be implicitly selected.
5180
5181If this doesn't make any sense to you, just accept the default '$dflt'.
5182EOM
5183rp='Build Perl for SOCKS?'
5184. ./myread
5185case "$ans" in
5186y|Y)	val="$define" ;;
5187*)      val="$undef" ;;
5188esac
5189set usesocks
5190eval $setvar
5191
5192: Check for uselongdouble support
5193case "$ccflags" in
5194*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5195esac
5196
5197case "$uselongdouble" in
5198$define|true|[yY]*)	dflt='y';;
5199*) dflt='n';;
5200esac
5201cat <<EOM
5202
5203Perl can be built to take advantage of long doubles which
5204(if available) may give more accuracy and range for floating point numbers.
5205
5206If this doesn't make any sense to you, just accept the default '$dflt'.
5207EOM
5208rp='Try to use long doubles if available?'
5209. ./myread
5210case "$ans" in
5211y|Y)	val="$define"	;;
5212*)      val="$undef"	;;
5213esac
5214set uselongdouble
5215eval $setvar
5216
5217case "$uselongdouble" in
5218true|[yY]*) uselongdouble="$define" ;;
5219esac
5220
5221: Look for a hint-file generated 'call-back-unit'.  If the
5222: user has specified that long doubles should be used,
5223: we may need to set or change some other defaults.
5224if $test -f uselongdouble.cbu; then
5225    echo "Your platform has some specific hints regarding long doubles, using them..."
5226    . ./uselongdouble.cbu
5227else
5228    case "$uselongdouble" in
5229	$define)
5230		$cat <<EOM
5231(Your platform does not have any specific hints for long doubles.)
5232EOM
5233	;;
5234    esac
5235fi
5236
5237: Looking for optional libraries
5238echo " "
5239echo "Checking for optional libraries..." >&4
5240case "$libs" in
5241' '|'') dflt='';;
5242*) dflt="$libs";;
5243esac
5244case "$libswanted" in
5245'') libswanted='c_s';;
5246esac
5247case "$usesocks" in
5248"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5249esac
5250case "$usecbacktrace" in
5251"$define") libswanted="$libswanted bfd" ;;
5252esac
5253libsfound=''
5254libsfiles=''
5255libsdirs=''
5256libspath=''
5257for thisdir in $libpth $xlibpth; do
5258  test -d $thisdir && libspath="$libspath $thisdir"
5259done
5260for thislib in $libswanted; do
5261	for thisdir in $libspath; do
5262	    xxx=''
5263	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5264		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5265	        $test -f "$xxx" && eval $libscheck
5266		$test -f "$xxx" && libstyle=shared
5267		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5268	        $test -f "$xxx" && eval $libscheck
5269		$test -f "$xxx" && libstyle=shared
5270	    fi
5271	    if test ! -f "$xxx"; then
5272		xxx=$thisdir/lib$thislib.$so$_a
5273		$test -f "$xxx" && eval $libscheck
5274		$test -f "$xxx" && libstyle="import"
5275	    fi
5276	    if test ! -f "$xxx"; then
5277		xxx=$thisdir/$thislib.$so$_a
5278		$test -f "$xxx" && eval $libscheck
5279		$test -f "$xxx" && libstyle="import"
5280	    fi
5281	    if test ! -f "$xxx"; then
5282		xxx=$thisdir/lib$thislib.$so
5283	        $test -f "$xxx" && eval $libscheck
5284		$test -f "$xxx" && libstyle=shared
5285	    fi
5286	    if test ! -f "$xxx"; then
5287		xxx=$thisdir/lib$thislib$_a
5288	        $test -f "$xxx" && eval $libscheck
5289		$test -f "$xxx" && libstyle=static
5290	    fi
5291	    if test ! -f "$xxx"; then
5292		xxx=$thisdir/$thislib$_a
5293	        $test -f "$xxx" && eval $libscheck
5294		$test -f "$xxx" && libstyle=static
5295	    fi
5296	    if test ! -f "$xxx"; then
5297		xxx=$thisdir/lib${thislib}_s$_a
5298	        $test -f "$xxx" && eval $libscheck
5299		$test -f "$xxx" && libstyle=static
5300		$test -f "$xxx" && thislib=${thislib}_s
5301	    fi
5302	    if test ! -f "$xxx"; then
5303		xxx=$thisdir/Slib$thislib$_a
5304	        $test -f "$xxx" && eval $libscheck
5305		$test -f "$xxx" && libstyle=static
5306	    fi
5307	    if $test -f "$xxx"; then
5308		case "$libstyle" in
5309		shared) echo "Found -l$thislib (shared)." ;;
5310		static) echo "Found -l$thislib." ;;
5311		*)      echo "Found -l$thislib ($libstyle)." ;;
5312		esac
5313		case " $dflt " in
5314		*"-l$thislib "*);;
5315		*) dflt="$dflt -l$thislib"
5316		   libsfound="$libsfound $xxx"
5317		   yyy=`basename $xxx`
5318		   libsfiles="$libsfiles $yyy"
5319		   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5320		   case " $libsdirs " in
5321		   *" $yyy "*) ;;
5322		   *) libsdirs="$libsdirs $yyy" ;;
5323		   esac
5324		   ;;
5325		esac
5326		break
5327	    fi
5328	done
5329	if $test ! -f "$xxx"; then
5330	    echo "No -l$thislib."
5331	fi
5332done
5333set X $dflt
5334shift
5335dflt="$*"
5336case "$libs" in
5337'') dflt="$dflt";;
5338*) dflt="$libs";;
5339esac
5340case "$dflt" in
5341' '|'') dflt='none';;
5342esac
5343
5344$cat <<EOM
5345
5346In order to compile $package on your machine, a number of libraries
5347are usually needed.  Include any other special libraries here as well.
5348Say "none" for none.  The default list is almost always right.
5349EOM
5350
5351echo " "
5352rp="What libraries to use?"
5353. ./myread
5354case "$ans" in
5355none) libs=' ';;
5356*) libs="$ans";;
5357esac
5358
5359: determine optimization, if desired, or use for debug flag also
5360case "$optimize" in
5361' '|$undef) dflt='none';;
5362'') dflt='-O';;
5363*) dflt="$optimize";;
5364esac
5365$cat <<EOH
5366
5367By default, $package compiles with the -O flag to use the optimizer.
5368Alternately, you might want to use the symbolic debugger, which uses
5369the -g flag (on traditional Unix systems).  Either flag can be
5370specified here.  To use neither flag, specify the word "none".
5371
5372EOH
5373rp="What optimizer/debugger flag should be used?"
5374. ./myread
5375optimize="$ans"
5376case "$optimize" in
5377'none') optimize=" ";;
5378esac
5379
5380: Check what DEBUGGING is required from the command line
5381: -DEBUGGING      or -DDEBUGGING or
5382: -DEBUGGING=both			= -g + -DDEBUGGING
5383: -DEBUGGING=-g   or -Doptimize=-g	= -g
5384: -DEBUGGING=none or -UDEBUGGING	=
5385: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5386case "$EBUGGING" in
5387'')	;;
5388*)	DEBUGGING=$EBUGGING ;;
5389esac
5390
5391case "$DEBUGGING" in
5392-g|both|$define)
5393    case "$optimize" in
5394	*-g*) ;;
5395	*)    optimize="$optimize -g" ;;
5396    esac ;;
5397none|$undef)
5398    case "$optimize" in
5399	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5400		shift
5401		optimize="$*"
5402		;;
5403    esac ;;
5404esac
5405
5406dflt=''
5407case "$DEBUGGING" in
5408both|$define) dflt='-DDEBUGGING'
5409esac
5410
5411: argument order is deliberate, as the flag will start with - which set could
5412: think is an option
5413checkccflag='check=$1; flag=$2; callback=$3;
5414echo " ";
5415echo "Checking if your compiler accepts $flag" >&4;
5416[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5417echo "int main(void) { return 0; }" > gcctest.c;
5418if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5419    echo "Yes, it does." >&4;
5420    if $test -s gcctest.out ; then
5421        echo "But your platform does not like it:";
5422        cat gcctest.out;
5423    else
5424	case "$ccflags" in
5425	*$check*)
5426	    echo "Leaving current flags $ccflags alone." >&4
5427	    ;;
5428	*) dflt="$dflt $flag";
5429	    eval $callback
5430	    ;;
5431	esac
5432    fi
5433else
5434    echo "Nope, it does not, but that is ok." >&4;
5435fi
5436'
5437
5438: We will not override a previous value, but we might want to
5439: augment a hint file
5440case "$hint" in
5441default|recommended)
5442	case "$gccversion" in
5443	1.*) dflt="$dflt -fpcc-struct-return" ;;
5444	esac
5445	case "$optimize:$DEBUGGING" in
5446	*-g*:old) dflt="$dflt -DDEBUGGING";;
5447	esac
5448	case "$gccversion" in
5449	2.*) if $test -d /etc/conf/kconfig.d &&
5450			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5451		then
5452			# Interactive Systems (ISC) POSIX mode.
5453			dflt="$dflt -posix"
5454		fi
5455		;;
5456	esac
5457	case "$gccversion" in
5458	1.*) ;;
5459	2.[0-8]*) ;;
5460	?*)	set strict-aliasing -fno-strict-aliasing
5461		eval $checkccflag
5462		;;
5463	esac
5464	case "$gccversion" in
5465	1*) ;;
5466	2*) ;;
5467	?*) 	echo " "
5468		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5469		echo 'int main(void) { return 0; }' > gcctest.c
5470		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5471			echo "Yes, it does." 2>&1
5472			case "$ccflags" in
5473			*delete-null-pointer-checks*)
5474				echo "Leaving current flags $ccflags alone." 2>&1
5475				;;
5476			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5477			esac
5478		else
5479			echo "Nope, it doesn't, but that's ok." 2>&1
5480		fi
5481		;;
5482	esac
5483	# For gcc, adding -pipe speeds up compilations for some, but apparently
5484	# some assemblers can't read from stdin.  (It also slows down compilations
5485	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5486	case "$gccversion" in
5487	?*)	set pipe -pipe
5488		eval $checkccflag
5489		;;
5490	esac
5491
5492	# on x86_64 (at least) we require an extra library (libssp) in the
5493	# link command line. This library is not named, so I infer that it is
5494	# an implementation detail that may change. Hence the safest approach
5495	# is to add the flag to the flags passed to the compiler at link time,
5496	# as that way the compiler can do the right implementation dependant
5497	# thing. (NWC)
5498	case "$ccflags" in
5499	*-fno-stack-protector*)
5500	    echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5501	    ;;
5502	*) case "$gccversion" in
5503	   ?*)	set stack-protector-strong -fstack-protector-strong
5504		eval $checkccflag
5505		case "$dflt" in
5506		*-fstack-protector-strong*) ;; # It got added.
5507		*) # Try the plain/older -fstack-protector.
5508		   set stack-protector -fstack-protector
5509		   eval $checkccflag
5510		   ;;
5511		esac
5512		;;
5513	    esac
5514	    ;;
5515	esac
5516esac
5517
5518case "$mips_type" in
5519*BSD*|'') inclwanted="$locincpth $usrinc";;
5520*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5521esac
5522for thisincl in $inclwanted; do
5523	if $test -d $thisincl; then
5524		if $test x$thisincl != x$usrinc; then
5525			case "$dflt" in
5526			*" -I$thisincl "*);;
5527			*) dflt="$dflt -I$thisincl ";;
5528			esac
5529		fi
5530	fi
5531done
5532
5533inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5534	xxx=true;
5535elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5536	xxx=true;
5537else
5538	xxx=false;
5539fi;
5540if $xxx; then
5541	case "$dflt" in
5542	*$2*);;
5543	*) dflt="$dflt -D$2";;
5544	esac;
5545fi'
5546
5547set signal.h LANGUAGE_C; eval $inctest
5548
5549case "$usesocks" in
5550$define)
5551	ccflags="$ccflags -DSOCKS"
5552	;;
5553esac
5554
5555case "$hint" in
5556default|recommended) dflt="$ccflags $dflt" ;;
5557*) dflt="$ccflags";;
5558esac
5559
5560case "$dflt" in
5561''|' ') dflt=none;;
5562esac
5563
5564$cat <<EOH
5565
5566Your C compiler may want other flags.  For this question you should include
5567-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5568but you should NOT include libraries or ld flags like -lwhatever.  If you
5569want $package to honor its debug switch, you should include -DDEBUGGING here.
5570Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5571
5572To use no flags, specify the word "none".
5573
5574EOH
5575set X $dflt
5576shift
5577dflt=${1+"$@"}
5578rp="Any additional cc flags?"
5579. ./myread
5580case "$ans" in
5581none) ccflags='';;
5582*) ccflags="$ans";;
5583esac
5584
5585: the following weeds options from ccflags that are of no interest to cpp
5586case "$cppflags" in
5587'') cppflags="$ccflags" ;;
5588*)  set X $ccflags; shift
5589    case " $cppflags " in
5590    *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5591    *) cppflags="$cppflags $ccflags" ;;
5592    esac
5593    ;;
5594esac
5595case "$gccversion" in
55961.*) cppflags="$cppflags -D__GNUC__"
5597esac
5598case "$mips_type" in
5599'');;
5600*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5601esac
5602case "$cppflags" in
5603'');;
5604*)
5605	echo " "
5606	echo "Let me guess what the preprocessor flags are..." >&4
5607	set X $cppflags
5608	shift
5609	cppflags=''
5610	$cat >cpp.c <<'EOM'
5611#define BLURFL foo
5612
5613BLURFL xx LFRULB
5614EOM
5615	previous=''
5616	for flag in $*
5617	do
5618		case "$flag" in
5619		-*) ftry="$flag";;
5620		*) ftry="$previous $flag";;
5621		esac
5622		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5623			>cpp1.out 2>/dev/null && \
5624			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5625			>cpp2.out 2>/dev/null && \
5626			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5627			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5628		then
5629			cppflags="$cppflags $ftry"
5630			previous=''
5631		else
5632			previous="$flag"
5633		fi
5634	done
5635	set X $cppflags
5636	shift
5637	cppflags=${1+"$@"}
5638	case "$cppflags" in
5639	*-*)  echo "They appear to be: $cppflags";;
5640	esac
5641	$rm -f cpp.c cpp?.out
5642	;;
5643esac
5644
5645: flags used in final linking phase
5646case "$ldflags" in
5647'') if ./venix; then
5648		dflt='-i -z'
5649	else
5650		dflt=''
5651	fi
5652	case "$ccflags" in
5653	*-posix*) dflt="$dflt -posix" ;;
5654	esac
5655	;;
5656*) dflt="$ldflags";;
5657esac
5658# See note above about -fstack-protector
5659case "$ccflags" in
5660*-fstack-protector-strong*)
5661	case "$dflt" in
5662	*-fstack-protector-strong*) ;; # Don't add it again
5663	*) dflt="$dflt -fstack-protector-strong" ;;
5664	esac
5665	;;
5666*-fstack-protector*)
5667	case "$dflt" in
5668	*-fstack-protector*) ;; # Don't add it again
5669	*) dflt="$dflt -fstack-protector" ;;
5670	esac
5671	;;
5672esac
5673
5674: Try to guess additional flags to pick up local libraries.
5675for thislibdir in $libpth; do
5676	case " $loclibpth " in
5677	*" $thislibdir "*)
5678		case "$dflt " in
5679		*"-L$thislibdir "*) ;;
5680		*)  dflt="$dflt -L$thislibdir" ;;
5681		esac
5682		;;
5683	esac
5684done
5685
5686case "$dflt" in
5687'') dflt='none' ;;
5688esac
5689
5690$cat <<EOH
5691
5692Your C linker may need flags.  For this question you should
5693include -L/whatever and any other flags used by the C linker, but you
5694should NOT include libraries like -lwhatever.
5695
5696Make sure you include the appropriate -L/path flags if your C linker
5697does not normally search all of the directories you specified above,
5698namely
5699	$libpth
5700To use no flags, specify the word "none".
5701
5702EOH
5703
5704rp="Any additional ld flags (NOT including libraries)?"
5705. ./myread
5706case "$ans" in
5707none) ldflags='';;
5708*) ldflags="$ans";;
5709esac
5710rmlist="$rmlist pdp11"
5711
5712: coherency check
5713echo " "
5714echo "Checking your choice of C compiler and flags for coherency..." >&4
5715$cat > try.c <<'EOF'
5716#include <stdio.h>
5717int main() { printf("Ok\n"); return(0); }
5718EOF
5719set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5720shift
5721$cat >try.msg <<'EOM'
5722I've tried to compile and run the following simple program:
5723
5724EOM
5725$cat try.c >> try.msg
5726
5727$cat >> try.msg <<EOM
5728
5729I used the command:
5730
5731	$*
5732	$run ./try
5733
5734and I got the following output:
5735
5736EOM
5737dflt=y
5738if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5739	if $sh -c "$run ./try " >>try.msg 2>&1; then
5740		xxx=`$run ./try`
5741		case "$xxx" in
5742		"Ok") dflt=n ;;
5743		*)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5744		esac
5745	else
5746		echo "The program compiled OK, but exited with status $?." >>try.msg
5747		rp="You have a problem.  Shall I abort Configure"
5748		dflt=y
5749	fi
5750else
5751	echo "I can't compile the test program." >>try.msg
5752	rp="You have a BIG problem.  Shall I abort Configure"
5753	dflt=y
5754fi
5755case "$dflt" in
5756y)
5757	$cat try.msg >&4
5758	case "$knowitall" in
5759	'')
5760		echo "(The supplied flags or libraries might be incorrect.)"
5761		;;
5762	*) dflt=n;;
5763	esac
5764	echo " "
5765	. ./myread
5766	case "$ans" in
5767	n*|N*) ;;
5768	*)	echo "Ok.  Stopping Configure." >&4
5769		exit 1
5770		;;
5771	esac
5772	;;
5773n) echo "OK, that should do.";;
5774esac
5775$rm_try gcctest gcctest.out
5776
5777: define a shorthand compile call
5778compile='
5779mc_file=$1;
5780shift;
5781case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5782echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5783exit 1;
5784fi;
5785esac;
5786$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5787: define a shorthand compile call for compilations that should be ok.
5788compile_ok='
5789mc_file=$1;
5790shift;
5791$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5792
5793: stub, used only to satisfy other units
5794i_stdlib='define'
5795
5796: check for lengths of integral types
5797echo " "
5798case "$intsize" in
5799'')
5800	echo "Checking to see how big your integers are..." >&4
5801	$cat >try.c <<EOCP
5802#include <stdio.h>
5803#$i_stdlib I_STDLIB
5804#ifdef I_STDLIB
5805#include <stdlib.h>
5806#endif
5807#include <stdio.h>
5808int main()
5809{
5810	printf("intsize=%d;\n", (int)sizeof(int));
5811	printf("longsize=%d;\n", (int)sizeof(long));
5812	printf("shortsize=%d;\n", (int)sizeof(short));
5813	exit(0);
5814}
5815EOCP
5816	set try
5817	if eval $compile_ok && $run ./try > /dev/null; then
5818		eval `$run ./try`
5819		echo "Your integers are $intsize bytes long."
5820		echo "Your long integers are $longsize bytes long."
5821		echo "Your short integers are $shortsize bytes long."
5822	else
5823		$cat >&4 <<EOM
5824!
5825Help! I can't compile and run the intsize test program: please enlighten me!
5826(This is probably a misconfiguration in your system or libraries, and
5827you really ought to fix it.  Still, I'll try anyway.)
5828!
5829EOM
5830		dflt=4
5831		rp="What is the size of an integer (in bytes)?"
5832		. ./myread
5833		intsize="$ans"
5834		dflt=$intsize
5835		rp="What is the size of a long integer (in bytes)?"
5836		. ./myread
5837		longsize="$ans"
5838		dflt=2
5839		rp="What is the size of a short integer (in bytes)?"
5840		. ./myread
5841		shortsize="$ans"
5842	fi
5843	;;
5844esac
5845$rm_try
5846
5847: check for long long
5848echo " "
5849echo "Checking to see if you have long long..." >&4
5850echo 'int main() { long long x = 7; return 0; }' > try.c
5851set try
5852if eval $compile; then
5853	val="$define"
5854	echo "You have long long."
5855else
5856	val="$undef"
5857	echo "You do not have long long."
5858fi
5859$rm_try
5860set d_longlong
5861eval $setvar
5862
5863: check for length of long long
5864case "${d_longlong}${longlongsize}" in
5865$define)
5866	echo " "
5867	echo "Checking to see how big your long longs are..." >&4
5868	$cat >try.c <<'EOCP'
5869#include <stdio.h>
5870int main()
5871{
5872    printf("%d\n", (int)sizeof(long long));
5873    return(0);
5874}
5875EOCP
5876	set try
5877	if eval $compile_ok; then
5878		longlongsize=`$run ./try`
5879		echo "Your long longs are $longlongsize bytes long."
5880	else
5881		dflt='8'
5882		echo " "
5883		echo "(I can't seem to compile the test program.  Guessing...)"
5884		rp="What is the size of a long long (in bytes)?"
5885		. ./myread
5886		longlongsize="$ans"
5887	fi
5888	if $test "X$longsize" = "X$longlongsize"; then
5889		echo "(That isn't any different from an ordinary long.)"
5890	fi
5891	;;
5892esac
5893$rm_try
5894
5895: determine filename position in cpp output
5896echo " "
5897echo "Computing filename position in cpp output for #include directives..." >&4
5898case "$osname" in
5899amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5900esac
5901case "$fieldn" in
5902'')
5903case "$osname" in
5904vos) testaccess=-e ;;
5905*)   testaccess=-r ;;
5906esac
5907echo '#include <stdio.h>' > foo.c
5908$cat >fieldn <<EOF
5909$startsh
5910$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5911$grep '^[ 	]*#.*stdio\.h' | \
5912while read cline; do
5913	pos=1
5914	set \$cline
5915	while $test \$# -gt 0; do
5916		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5917			echo "\$pos"
5918			exit 0
5919		fi
5920		shift
5921		pos=\`expr \$pos + 1\`
5922	done
5923done
5924EOF
5925chmod +x fieldn
5926fieldn=`./fieldn`
5927$rm -f foo.c fieldn
5928;;
5929esac
5930case $fieldn in
5931'') pos='???';;
59321) pos=first;;
59332) pos=second;;
59343) pos=third;;
5935*) pos="${fieldn}th";;
5936esac
5937echo "Your cpp writes the filename in the $pos field of the line."
5938
5939: locate header file
5940$cat >findhdr <<EOF
5941$startsh
5942wanted=\$1
5943name=''
5944for usrincdir in $incpth
5945do
5946	if test -f \$usrincdir/\$wanted; then
5947		echo "\$usrincdir/\$wanted"
5948		exit 0
5949	fi
5950done
5951awkprg='{ print \$$fieldn }'
5952echo "#include <\$wanted>" > foo\$\$.c
5953$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5954$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5955while read cline; do
5956	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5957	case "\$name" in
5958	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5959	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5960	*) exit 2;;
5961	esac;
5962done;
5963#
5964# status = 0: grep returned 0 lines, case statement not executed
5965# status = 1: headerfile found
5966# status = 2: while loop executed, no headerfile found
5967#
5968status=\$?
5969$rm -f foo\$\$.c;
5970if test \$status -eq 1; then
5971	exit 0;
5972fi
5973exit 1
5974EOF
5975chmod +x findhdr
5976
5977: define an alternate in-header-list? function
5978inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5979cont=true; xxf="echo \"<\$1> found.\" >&4";
5980case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5981*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5982esac;
5983case $# in 4) instead=instead;; *) instead="at last";; esac;
5984while $test "$cont"; do
5985	xxx=`./findhdr $1`
5986	var=$2; eval "was=\$$2";
5987	if $test "$xxx" && $test -r "$xxx";
5988	then eval $xxf;
5989	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5990		cont="";
5991	else eval $xxnf;
5992	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5993	set $yyy; shift; shift; yyy=$@;
5994	case $# in 0) cont="";;
5995	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5996		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5997	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5998		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5999	esac;
6000done;
6001while $test "$yyy";
6002do set $yyy; var=$2; eval "was=\$$2";
6003	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6004	set $yyy; shift; shift; yyy=$@;
6005done'
6006
6007: see if inttypes.h is available
6008: we want a real compile instead of Inhdr because some systems
6009: have an inttypes.h which includes non-existent headers
6010echo " "
6011$cat >try.c <<EOCP
6012#include <inttypes.h>
6013int main() {
6014	static int32_t foo32 = 0x12345678;
6015}
6016EOCP
6017set try
6018if eval $compile; then
6019	echo "<inttypes.h> found." >&4
6020	val="$define"
6021else
6022	echo "<inttypes.h> NOT found." >&4
6023	val="$undef"
6024fi
6025$rm_try
6026set i_inttypes
6027eval $setvar
6028
6029: check for int64_t
6030echo " "
6031echo "Checking to see if you have int64_t..." >&4
6032$cat >try.c <<EOCP
6033#include <sys/types.h>
6034#$i_inttypes I_INTTYPES
6035#ifdef I_INTTYPES
6036#include <inttypes.h>
6037#endif
6038int main() { int64_t x = 7; }
6039EOCP
6040set try
6041if eval $compile; then
6042	val="$define"
6043	echo "You have int64_t."
6044else
6045	val="$undef"
6046	echo "You do not have int64_t."
6047fi
6048$rm_try
6049set d_int64_t
6050eval $setvar
6051
6052: Check if 64bit ints have a quad type
6053echo " "
6054echo "Checking which 64-bit integer type we could use..." >&4
6055
6056case "$intsize" in
60578) val=int
6058   set quadtype
6059   eval $setvar
6060   val='"unsigned int"'
6061   set uquadtype
6062   eval $setvar
6063   quadkind=1
6064   ;;
6065*) case "$longsize" in
6066   8) val=long
6067      set quadtype
6068      eval $setvar
6069      val='"unsigned long"'
6070      set uquadtype
6071      eval $setvar
6072      quadkind=2
6073      ;;
6074   *) case "$d_longlong:$longlongsize" in
6075      define:8)
6076        val='"long long"'
6077        set quadtype
6078        eval $setvar
6079        val='"unsigned long long"'
6080        set uquadtype
6081        eval $setvar
6082        quadkind=3
6083        ;;
6084      *) case "$d_int64_t" in
6085         define)
6086           val=int64_t
6087           set quadtype
6088           eval $setvar
6089           val=uint64_t
6090           set uquadtype
6091           eval $setvar
6092           quadkind=4
6093           ;;
6094         esac
6095         ;;
6096      esac
6097      ;;
6098   esac
6099   ;;
6100esac
6101
6102case "$quadtype" in
6103'')	echo "Alas, no 64-bit integer types in sight." >&4
6104	d_quad="$undef"
6105	;;
6106*)	echo "We could use '$quadtype' for 64-bit integers." >&4
6107	d_quad="$define"
6108	;;
6109esac
6110
6111: Do we want 64bit support
6112case "$uselonglong" in
6113"$define"|true|[yY]*)
6114	cat <<EOM >&4
6115
6116*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6117EOM
6118	use64bitint="$define"
6119	;;
6120esac
6121case "$use64bits" in
6122"$define"|true|[yY]*)
6123	cat <<EOM >&4
6124
6125*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6126EOM
6127	use64bitint="$define"
6128	;;
6129esac
6130case "$use64bitints" in
6131"$define"|true|[yY]*)
6132	cat <<EOM >&4
6133
6134*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6135EOM
6136	use64bitint="$define"
6137	;;
6138esac
6139case "$use64bitsint" in
6140"$define"|true|[yY]*)
6141	cat <<EOM >&4
6142
6143*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6144EOM
6145	use64bitint="$define"
6146	;;
6147esac
6148case "$uselonglongs" in
6149"$define"|true|[yY]*)
6150	cat <<EOM >&4
6151
6152*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6153EOM
6154	use64bitint="$define"
6155	;;
6156esac
6157case "$use64bitsall" in
6158"$define"|true|[yY]*)
6159	cat <<EOM >&4
6160
6161*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6162EOM
6163	use64bitall="$define"
6164	;;
6165esac
6166
6167case "$ccflags" in
6168*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6169esac
6170case "$use64bitall" in
6171"$define"|true|[yY]*) use64bitint="$define" ;;
6172esac
6173
6174case "$longsize" in
61758) cat <<EOM
6176
6177You have natively 64-bit long integers.
6178EOM
6179   val="$define"
6180   ;;
6181*) case "$use64bitint" in
6182   "$define"|true|[yY]*) dflt='y';;
6183   *) dflt='n';;
6184   esac
6185   case "$d_quad" in
6186   "$define") ;;
6187   *) dflt='n' ;;
6188   esac
6189   cat <<EOM
6190
6191Perl can be built to take advantage of 64-bit integer types
6192on some systems.  To do so, Configure can be run with -Duse64bitint.
6193Choosing this option will most probably introduce binary incompatibilities.
6194
6195If this doesn't make any sense to you, just accept the default '$dflt'.
6196(The default has been chosen based on your configuration.)
6197EOM
6198   rp='Try to use 64-bit integers, if available?'
6199   . ./myread
6200   case "$ans" in
6201   [yY]*) val="$define" ;;
6202   *)     val="$undef"  ;;
6203   esac
6204   ;;
6205esac
6206set use64bitint
6207eval $setvar
6208
6209case "$use64bitall" in
6210"$define"|true|[yY]*) dflt='y' ;;
6211*) case "$longsize" in
6212   8) dflt='y' ;;
6213   *) dflt='n' ;;
6214   esac
6215   ;;
6216esac
6217cat <<EOM
6218
6219You may also choose to try maximal 64-bitness.  It means using as much
622064-bitness as possible on the platform.  This in turn means even more
6221binary incompatibilities.  On the other hand, your platform may not
6222have any more 64-bitness available than what you already have chosen.
6223
6224If this doesn't make any sense to you, just accept the default '$dflt'.
6225(The default has been chosen based on your configuration.)
6226EOM
6227rp='Try to use maximal 64-bit support, if available?'
6228. ./myread
6229case "$ans" in
6230[yY]*) val="$define" ;;
6231*)     val="$undef"  ;;
6232esac
6233set use64bitall
6234eval $setvar
6235case "$use64bitall" in
6236"$define")
6237	case "$use64bitint" in
6238	"$undef")
6239		cat <<EOM
6240
6241Since you have chosen a maximally 64-bit build, I'm also turning on
6242the use of 64-bit integers.
6243EOM
6244		use64bitint="$define" ;;
6245	esac
6246	;;
6247esac
6248
6249: Look for a hint-file generated 'call-back-unit'.  If the
6250: user has specified that a 64-bit perl is to be built,
6251: we may need to set or change some other defaults.
6252if $test -f use64bitint.cbu; then
6253	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6254	. ./use64bitint.cbu
6255fi
6256case "$use64bitint" in
6257"$define"|true|[yY]*)
6258	: This test was common to all the OpenBSD forks, and seems harmless for
6259	: other platforms:
6260	echo " "
6261	echo "Checking if your C library has broken 64-bit functions..." >&4
6262	cat >try.c <<EOCP
6263#include <stdio.h>
6264typedef $uquadtype myULL;
6265int main (void)
6266{
6267    struct {
6268	double d;
6269	myULL  u;
6270    } *p, test[] = {
6271	{4294967303.15, 4294967303ULL},
6272	{4294967294.2,  4294967294ULL},
6273	{4294967295.7,  4294967295ULL},
6274	{0.0, 0ULL}
6275    };
6276    for (p = test; p->u; p++) {
6277	myULL x = (myULL)p->d;
6278	if (x != p->u) {
6279	    printf("buggy\n");
6280	    return 0;
6281	}
6282    }
6283    printf("ok\n");
6284    return 0;
6285}
6286EOCP
6287	set try
6288	if eval $compile_ok; then
6289	    libcquad=`$run ./try`
6290	    echo "Your C library's 64-bit functions are $libcquad."
6291	else
6292	    echo "(I can't seem to compile the test program.)"
6293	    echo "Assuming that your C library's 64-bit functions are ok."
6294	    libcquad="ok"
6295	fi
6296	$rm_try
6297
6298	case "$libcquad" in
6299	    buggy*)
6300		cat >&4 <<EOM
6301
6302*** You have a C library with broken 64-bit functions.
6303*** 64-bit support does not work reliably in this configuration.
6304*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6305*** Cannot continue, aborting.
6306
6307EOM
6308		exit 1
6309		;;
6310	esac
6311	case "$longsize" in
6312	4) case "$archname64" in
6313	   '') archname64=64int ;;
6314	   esac
6315	   ;;
6316	esac
6317	;;
6318esac
6319
6320: Look for a hint-file generated 'call-back-unit'.  If the
6321: user has specified that a maximally 64-bit perl is to be built,
6322: we may need to set or change some other defaults.
6323if $test -f use64bitall.cbu; then
6324	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6325	. ./use64bitall.cbu
6326fi
6327case "$use64bitall" in
6328"$define"|true|[yY]*)
6329	case "$longsize" in
6330	4) case "$archname64" in
6331	   ''|64int) archname64=64all ;;
6332	   esac
6333	   ;;
6334	esac
6335	;;
6336esac
6337
6338case "$d_quad:$use64bitint" in
6339$undef:$define)
6340	cat >&4 <<EOF
6341
6342*** You have chosen to use 64-bit integers,
6343*** but none can be found.
6344*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6345*** Cannot continue, aborting.
6346
6347EOF
6348	exit 1
6349	;;
6350esac
6351
6352: Check if we are using the GNU C library
6353echo " "
6354echo "Checking for GNU C Library..." >&4
6355cat >try.c <<'EOCP'
6356/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6357   alone are insufficient to distinguish different versions, such as
6358   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6359   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6360*/
6361#include <stdio.h>
6362int main(void)
6363{
6364#ifdef __GLIBC__
6365#   ifdef __GLIBC_MINOR__
6366#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6367#           include <gnu/libc-version.h>
6368	    printf("%s\n",  gnu_get_libc_version());
6369#       else
6370	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6371#       endif
6372#   else
6373	printf("%d\n",  __GLIBC__);
6374#   endif
6375    return 0;
6376#else
6377    return 1;
6378#endif
6379}
6380EOCP
6381set try
6382if eval $compile_ok && $run ./try > glibc.ver; then
6383	val="$define"
6384	gnulibc_version=`$cat glibc.ver`
6385	echo "You are using the GNU C Library version $gnulibc_version"
6386else
6387	val="$undef"
6388	gnulibc_version=''
6389	echo "You are not using the GNU C Library"
6390fi
6391$rm_try glibc.ver
6392set d_gnulibc
6393eval $setvar
6394
6395: see if nm is to be used to determine whether a symbol is defined or not
6396case "$usenm" in
6397'')
6398	dflt=''
6399	case "$d_gnulibc" in
6400	"$define")
6401		echo " "
6402		echo "nm probably won't work on the GNU C Library." >&4
6403		dflt=n
6404		;;
6405	esac
6406	case "$dflt" in
6407	'')
6408		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6409			echo " "
6410			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6411			echo "'nm' won't be sufficient on this system." >&4
6412			dflt=n
6413		fi
6414		;;
6415	esac
6416	case "$dflt" in
6417	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6418		if $test $dflt -gt 20; then
6419			dflt=y
6420		else
6421			dflt=n
6422		fi
6423		;;
6424	esac
6425	;;
6426*)
6427	case "$usenm" in
6428	true|$define) dflt=y;;
6429	*) dflt=n;;
6430	esac
6431	;;
6432esac
6433$cat <<EOM
6434
6435I can use $nm to extract the symbols from your C libraries. This
6436is a time consuming task which may generate huge output on the disk (up
6437to 3 megabytes) but that should make the symbols extraction faster. The
6438alternative is to skip the 'nm' extraction part and to compile a small
6439test program instead to determine whether each symbol is present. If
6440you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6441this may be the best solution.
6442
6443You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6444
6445EOM
6446rp="Shall I use $nm to extract C symbols from the libraries?"
6447. ./myread
6448case "$ans" in
6449[Nn]*) usenm=false;;
6450*) usenm=true;;
6451esac
6452
6453runnm=$usenm
6454case "$reuseval" in
6455true) runnm=false;;
6456esac
6457
6458: nm options which may be necessary
6459case "$nm_opt" in
6460'') if $test -f /mach_boot; then
6461		nm_opt=''	# Mach
6462	elif $test -d /usr/ccs/lib; then
6463		nm_opt='-p'	# Solaris (and SunOS?)
6464	elif $test -f /dgux; then
6465		nm_opt='-p'	# DG-UX
6466	elif $test -f /lib64/rld; then
6467		nm_opt='-p'	# 64-bit Irix
6468	else
6469		nm_opt=''
6470	fi;;
6471esac
6472
6473: nm options which may be necessary for shared libraries but illegal
6474: for archive libraries.  Thank you, Linux.
6475case "$nm_so_opt" in
6476'')	case "$myuname" in
6477	*linux*|gnu*)
6478		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6479			nm_so_opt='--dynamic'
6480		fi
6481		;;
6482	esac
6483	;;
6484esac
6485
6486: Figure out where the libc is located
6487case "$runnm" in
6488true)
6489: get list of predefined functions in a handy place
6490echo " "
6491case "$libc" in
6492'') libc=unknown
6493	case "$libs" in
6494	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6495	esac
6496	;;
6497esac
6498case "$libs" in
6499'') ;;
6500*)  for thislib in $libs; do
6501	case "$thislib" in
6502	-lc|-lc_s)
6503		: Handle C library specially below.
6504		;;
6505	-l*)
6506		thislib=`echo $thislib | $sed -e 's/^-l//'`
6507		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6508			:
6509		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6510			:
6511		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6512			:
6513		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6514			:
6515		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6516			:
6517		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6518			:
6519		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6520			:
6521		else
6522			try=''
6523		fi
6524		libnames="$libnames $try"
6525		;;
6526	*) libnames="$libnames $thislib" ;;
6527	esac
6528	done
6529	;;
6530esac
6531xxx=normal
6532case "$libc" in
6533unknown)
6534	set /lib/libc.$so
6535	for xxx in $libpth; do
6536		$test -r $1 || set $xxx/libc.$so
6537		: The messy sed command sorts on library version numbers.
6538		$test -r $1 || \
6539			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6540			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6541				h
6542				s/[0-9][0-9]*/0000&/g
6543				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6544				G
6545				s/\n/ /' | \
6546			 $sort | $sed -e 's/^.* //'`
6547		eval set \$$#
6548	done
6549	$test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6550	$test -r $1 || set $sysroot/lib/libsys_s$_a
6551	;;
6552*)
6553	set blurfl
6554	;;
6555esac
6556if $test -r "$1"; then
6557	echo "Your (shared) C library seems to be in $1."
6558	libc="$1"
6559elif $test -r /lib/libc && $test -r /lib/clib; then
6560	echo "Your C library seems to be in both /lib/clib and /lib/libc."
6561	xxx=apollo
6562	libc='/lib/clib /lib/libc'
6563	if $test -r /lib/syslib; then
6564		echo "(Your math library is in /lib/syslib.)"
6565		libc="$libc /lib/syslib"
6566	fi
6567elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6568	echo "Your C library seems to be in $libc, as you said before."
6569elif $test -r $incpath/usr/lib/libc$_a; then
6570	libc=$incpath/usr/lib/libc$_a;
6571	echo "Your C library seems to be in $libc.  That's fine."
6572elif $test -r /lib/libc$_a; then
6573	libc=/lib/libc$_a;
6574	echo "Your C library seems to be in $libc.  You're normal."
6575else
6576	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6577		:
6578	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6579		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6580	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6581		:
6582	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6583		:
6584	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6585		:
6586	else
6587		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6588	fi
6589	if $test -r "$tans"; then
6590		echo "Your C library seems to be in $tans, of all places."
6591		libc=$tans
6592	else
6593		libc='blurfl'
6594	fi
6595fi
6596if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6597	dflt="$libc"
6598	cat <<EOM
6599
6600If the guess above is wrong (which it might be if you're using a strange
6601compiler, or your machine supports multiple models), you can override it here.
6602
6603EOM
6604else
6605	dflt=''
6606	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6607	cat >&4 <<EOM
6608I can't seem to find your C library.  I've looked in the following places:
6609
6610EOM
6611	$sed 's/^/	/' libpath
6612	cat <<EOM
6613
6614None of these seems to contain your C library. I need to get its name...
6615
6616EOM
6617fi
6618fn=f
6619rp='Where is your C library?'
6620. ./getfile
6621libc="$ans"
6622
6623echo " "
6624echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6625set X `cat libnames`
6626shift
6627xxx=files
6628case $# in 1) xxx=file; esac
6629echo "Extracting names from the following $xxx for later perusal:" >&4
6630echo " "
6631$sed 's/^/	/' libnames >&4
6632echo " "
6633$echo $n "This may take a while...$c" >&4
6634
6635for file in $*; do
6636	case $file in
6637	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6638	*) $nm $nm_opt $file 2>/dev/null;;
6639	esac
6640done >libc.tmp
6641
6642$echo $n ".$c"
6643$grep fprintf libc.tmp > libc.ptf
6644xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6645xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6646xxx='[ADTSIWi]'
6647if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6648	eval $xscan;\
6649	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6650		eval $xrun
6651elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6652	eval $xscan;\
6653	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654		eval $xrun
6655elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6656	eval $xscan;\
6657	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658		eval $xrun
6659elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6660	eval $xscan;\
6661	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662		eval $xrun
6663elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6664	eval $xscan;\
6665	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666		eval $xrun
6667elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6668	eval $xscan;\
6669	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670		eval $xrun
6671elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6672				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
6673	eval $xscan;\
6674	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675		eval $xrun
6676elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6677	eval $xscan;\
6678	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679		eval $xrun
6680elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6681	eval $xscan;\
6682	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683		eval $xrun
6684elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6685	eval $xscan;\
6686	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687		eval $xrun
6688elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6689	eval $xscan;\
6690	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691		eval $xrun
6692elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6693	eval $xscan;\
6694	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695		eval $xrun
6696elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6697	eval $xscan;\
6698	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699		eval $xrun
6700elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6701	eval $xscan;\
6702	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703		eval $xrun
6704else
6705	$nm -p $* 2>/dev/null >libc.tmp
6706	$grep fprintf libc.tmp > libc.ptf
6707	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6708		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6709	then
6710		nm_opt='-p'
6711		eval $xrun
6712	else
6713		echo " "
6714		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6715		com=''
6716		if $ar t $libc > libc.tmp && \
6717			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
6718		then
6719			for thisname in $libnames $libc; do
6720				$ar t $thisname >>libc.tmp
6721			done
6722			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6723			echo "Ok." >&4
6724		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6725			for thisname in $libnames $libc; do
6726				$ar tv $thisname >>libc.tmp
6727				emximp -o tmp.imp $thisname \
6728				    2>/dev/null && \
6729				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6730				    < tmp.imp >>libc.tmp
6731				$rm -f tmp.imp
6732			done
6733			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6734			echo "Ok." >&4
6735		else
6736			echo "$ar didn't seem to work right." >&4
6737			echo "Maybe this is a Cray...trying bld instead..." >&4
6738			if  bld t $libc | \
6739				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6740				$test -s libc.list
6741			then
6742				for thisname in $libnames; do
6743					bld t $libnames | \
6744					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6745					$ar t $thisname >>libc.tmp
6746				done
6747				echo "Ok." >&4
6748			else
6749				echo "That didn't work either.  Giving up." >&4
6750				exit 1
6751			fi
6752		fi
6753	fi
6754fi
6755nm_extract="$com"
6756case "$PASE" in
6757define)
6758    echo " "
6759    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6760    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6761    ;;
6762*)  if $test -f /lib/syscalls.exp; then
6763	echo " "
6764	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6765	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
6766		/lib/syscalls.exp >>libc.list
6767    fi
6768    ;;
6769esac
6770;;
6771esac
6772$rm -f libnames libpath
6773
6774: Check if we are using C++
6775echo " "
6776echo "Checking for C++..." >&4
6777$cat >try.c <<'EOCP'
6778#include <stdio.h>
6779int main(void)
6780{
6781#ifdef __cplusplus
6782    return 0;
6783#else
6784    return 1;
6785#endif
6786}
6787EOCP
6788set try
6789if eval $compile_ok && $run ./try; then
6790	val="$define"
6791	echo "You are using a C++ compiler."
6792else
6793	val="$undef"
6794	echo "You are not using a C++ compiler."
6795fi
6796$rm_try cplusplus$$
6797set d_cplusplus
6798eval $setvar
6799
6800: is a C symbol defined?
6801csym='tlook=$1;
6802case "$3" in
6803-v) tf=libc.tmp; tdc="";;
6804-a) tf=libc.tmp; tdc="[]";;
6805*) tlook="^$1\$"; tf=libc.list; tdc="()";;
6806esac;
6807case "$d_cplusplus" in
6808    $define)	extern_C="extern \"C\""	;;
6809    *)		extern_C="extern"	;;
6810esac;
6811tx=yes;
6812case "$reuseval-$4" in
6813true-) ;;
6814true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6815esac;
6816case "$tx" in
6817yes)
6818	tval=false;
6819	if $test "$runnm" = true; then
6820		if $contains $tlook $tf >/dev/null 2>&1; then
6821			tval=true;
6822		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6823			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;
6824			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6825			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6826			$rm_try;
6827		fi;
6828	else
6829		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;
6830		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6831		$rm_try;
6832	fi;
6833	;;
6834*)
6835	case "$tval" in
6836	$define) tval=true;;
6837	*) tval=false;;
6838	esac;
6839	;;
6840esac;
6841eval "$2=$tval"'
6842
6843: define an is-in-libc? function
6844inlibc='echo " "; td=$define; tu=$undef;
6845sym=$1; var=$2; eval "was=\$$2";
6846tx=yes;
6847case "$reuseval$was" in
6848true) ;;
6849true*) tx=no;;
6850esac;
6851case "$tx" in
6852yes)
6853	set $sym tres -f;
6854	eval $csym;
6855	case "$tres" in
6856	true)
6857		echo "$sym() found." >&4;
6858		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6859	*)
6860		echo "$sym() NOT found." >&4;
6861		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6862	esac;;
6863*)
6864	case "$was" in
6865	$define) echo "$sym() found." >&4;;
6866	*) echo "$sym() NOT found." >&4;;
6867	esac;;
6868esac'
6869
6870: check for length of double
6871echo " "
6872case "$doublesize" in
6873'')
6874	echo "Checking to see how big your double precision numbers are..." >&4
6875	$cat >try.c <<EOCP
6876#include <stdio.h>
6877#$i_stdlib I_STDLIB
6878#ifdef I_STDLIB
6879#include <stdlib.h>
6880#endif
6881#include <stdio.h>
6882int main()
6883{
6884    printf("%d\n", (int)sizeof(double));
6885    exit(0);
6886}
6887EOCP
6888	set try
6889	if eval $compile_ok; then
6890		doublesize=`$run ./try`
6891		echo "Your double is $doublesize bytes long."
6892	else
6893		dflt='8'
6894		echo "(I can't seem to compile the test program.  Guessing...)"
6895		rp="What is the size of a double precision number (in bytes)?"
6896		. ./myread
6897		doublesize="$ans"
6898	fi
6899	;;
6900esac
6901$rm_try
6902
6903: check for long doubles
6904echo " " >&4
6905echo "Checking to see if you have long double..." >&4
6906echo 'int main() { long double x = 7.0; }' > try.c
6907set try
6908if eval $compile; then
6909	val="$define"
6910	echo "You have long double." >&4
6911else
6912	val="$undef"
6913	echo "You do not have long double." >&4
6914fi
6915$rm_try
6916set d_longdbl
6917eval $setvar
6918
6919: see if ldexpl exists
6920set ldexpl d_ldexpl
6921eval $inlibc
6922
6923: check for length of long double
6924case "${d_longdbl}${longdblsize}" in
6925$define)
6926	echo " " >&4
6927	echo "Checking to see how big your long doubles are..." >&4
6928	$cat >try.c <<'EOCP'
6929#include <stdio.h>
6930int main()
6931{
6932	printf("%d\n", sizeof(long double));
6933}
6934EOCP
6935	set try
6936	set try
6937	if eval $compile; then
6938		longdblsize=`$run ./try`
6939		echo "Your long doubles are $longdblsize bytes long." >&4
6940	else
6941		dflt='8'
6942		echo " " >&4
6943		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6944		rp="What is the size of a long double (in bytes)?"
6945		. ./myread
6946		longdblsize="$ans"
6947	fi
6948	if $test "X$doublesize" = "X$longdblsize"; then
6949		echo "That isn't any different from an ordinary double." >&4
6950		echo "I'll keep your setting anyway, but you may see some" >&4
6951		echo "harmless compilation warnings." >&4
6952	fi
6953	;;
6954esac
6955$rm_try
6956
6957$echo "Checking the kind of long doubles you have..." >&4
6958case "$d_longdbl" in
6959define)
6960$cat <<EOP >try.c
6961#$i_stdlib I_STDLIB
6962#define LONGDBLSIZE $longdblsize
6963#define DOUBLESIZE $doublesize
6964#include <float.h>
6965#ifdef I_STDLIB
6966#include <stdlib.h>
6967#endif
6968#include <stdio.h>
6969static const long double d = -0.1L;
6970int main() {
6971  unsigned const char* b = (unsigned const char*)(&d);
6972#if DOUBLESIZE == LONGDBLSIZE
6973  printf("0\n"); /* if it floats like double */
6974  exit(0);
6975#endif
6976#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6977  if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6978    /* IEEE 754 128-bit little-endian */
6979    printf("1\n");
6980    exit(0);
6981  }
6982  if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6983    /* IEEE 128-bit big-endian, e.g. solaris sparc */
6984    printf("2\n");
6985    exit(0);
6986  }
6987#endif
6988/* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6989 * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6990 * cannot be trusted. */
6991#if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6992  if (b[0] == 0xCD && b[9] == 0xBF) {
6993    /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6994     * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6995     * Also known as "extended precision". */
6996    printf("3\n");
6997    exit(0);
6998  }
6999  if (b[0] == 0xBF && b[9] == 0xCD) {
7000    /* Is there ever big-endian 80-bit, really?
7001     *
7002     * The Motorola 68881 had another "extended precision" format:
7003     * sign:1 exp:15 zero:16 integer:1 mantissa:63
7004     * for total of 96 bits of bytes.  The zero bits were unused.
7005     * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
7006     * If it ever becomes relevant, this format should be allocated a
7007     * new doublekind code since it is quite different from the Intel x87.
7008     */
7009    printf("4\n");
7010    exit(0);
7011  }
7012#endif
7013#if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7014  /* software "double double", the 106 is 53+53.
7015   * but irix thinks it is 107. */
7016  if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7017    /* double double 128-bit fully little-endian,
7018     * little-endian doubles in little-endian order,
7019     * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7020    printf("5\n");
7021    exit(0);
7022  }
7023  if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7024    /* double double 128-bit fully big-endian,
7025     * big-endian doubles in big-endian order,
7026     * e.g. PPC/Power and MIPS:
7027     * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7028    printf("6\n");
7029    exit(0);
7030  }
7031  if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7032    /* double double 128-bit mixed endian.
7033     * little-endian doubles in big-endian order,
7034     * e.g. ppc64el,
7035     * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7036    printf("7\n");
7037    exit(0);
7038  }
7039  if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7040    /* double double 128-bit mixed endian,
7041     * big-endian doubles in little-endian order,
7042     * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7043    printf("8\n");
7044    exit(0);
7045  }
7046#endif
7047/* We are largely making this up because it may well be
7048 * that the VAX format H was never made available to C,
7049 * only to Fortran. */
7050#if LONGDBLSIZE == 16 && defined(__vax__)
7051  if (b[0] == 0xFD && b[15] == 0x99) {
7052    /* VAX format H, PDP-11 mixed endian. */
7053    printf("9\n");
7054    exit(0);
7055  }
7056#endif
7057  printf("-1\n"); /* unknown */
7058  exit(0);
7059}
7060EOP
7061set try
7062if eval $compile; then
7063    longdblkind=`$run ./try`
7064else
7065    longdblkind=-1
7066fi
7067;;
7068*) longdblkind=0 ;;
7069esac
7070case "$longdblkind" in
70710) echo "Your long doubles are doubles." >&4 ;;
70721) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
70732) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
70743) echo "You have x86 80-bit little endian long doubles." >&4 ;;
70754) echo "You have x86 80-bit big endian long doubles." >&4 ;;
70765) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
70776) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
70787) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
70798) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
70809) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7081*) echo "Cannot figure out your long double." >&4 ;;
7082esac
7083d_long_double_style_ieee=$undef
7084d_long_double_style_ieee_std=$undef
7085d_long_double_style_ieee_extended=$undef
7086d_long_double_style_ieee_doubledouble=$undef
7087d_long_double_style_vax=$undef
7088case "$longdblkind" in
70891|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7090esac
7091case "$longdblkind" in
70921|2) d_long_double_style_ieee_std=$define ;;
7093esac
7094case "$longdblkind" in
70953|4) d_long_double_style_ieee_extended=$define ;;
7096esac
7097case "$longdblkind" in
70985|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7099esac
7100case "$longdblkind" in
71019) d_long_double_style_vax=$define ;;
7102esac
7103$rm_try
7104
7105: get the patchlevel
7106echo " "
7107echo "Getting the current patchlevel..." >&4
7108if $test -r $rsrc/patchlevel.h;then
7109	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7110	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7111	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7112	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7113	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7114	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7115	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7116else
7117	revision=0
7118	patchlevel=0
7119	subversion=0
7120	api_revision=0
7121	api_version=0
7122	api_subversion=0
7123	perl_patchlevel=0
7124	$echo "(You do not have patchlevel.h.  Eek.)"
7125fi
7126: Define a handy string here to avoid duplication in myconfig.SH and configpm.
7127version_patchlevel_string="version $patchlevel subversion $subversion"
7128case "$perl_patchlevel" in
71290|'') ;;
7130*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7131    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7132    ;;
7133esac
7134
7135$echo "(You have $package $version_patchlevel_string.)"
7136
7137case "$osname" in
7138dos|vms)
7139	: XXX Should be a Configure test for double-dots in filenames.
7140	version=`echo $revision $patchlevel $subversion | \
7141		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7142	api_versionstring=`echo $api_revision $api_version $api_subversion | \
7143		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7144	;;
7145*)
7146	version=`echo $revision $patchlevel $subversion | \
7147		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7148	api_versionstring=`echo $api_revision $api_version $api_subversion | \
7149		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7150	;;
7151esac
7152: Special case the 5.005_xx maintenance series, which used 5.005
7153: without any subversion label as a subdirectory in $sitelib
7154if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7155	api_versionstring='5.005'
7156fi
7157
7158: Check if quadmath is requested
7159case "$usequadmath" in
7160"$define"|true|[yY]*) usequadmath="$define" ;;
7161*)                    usequadmath="$undef"  ;;
7162esac
7163
7164: Fail if both uselongdouble and usequadmath are requested
7165case "$usequadmath:$uselongdouble" in
7166define:define)
7167	$cat <<EOM >&4
7168
7169*** You requested the use of the quadmath library and use
7170*** of long doubles.
7171***
7172*** Please select one or the other.
7173EOM
7174	exit 1
7175	;;
7176esac
7177
7178: determine the architecture name
7179echo " "
7180if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7181	tarch=`arch`"-$osname"
7182elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7183	if uname -m > tmparch 2>&1 ; then
7184		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7185			-e 's/$/'"-$osname/" tmparch`
7186	else
7187		tarch="$osname"
7188	fi
7189	$rm -f tmparch
7190else
7191	tarch="$osname"
7192fi
7193case "$myarchname" in
7194''|"$tarch") ;;
7195*)
7196	echo "(Your architecture name used to be $myarchname.)"
7197	archname=''
7198	;;
7199esac
7200case "$targetarch" in
7201'') ;;
7202*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7203esac
7204myarchname="$tarch"
7205case "$archname" in
7206'') dflt="$tarch";;
7207*) dflt="$archname";;
7208esac
7209rp='What is your architecture name'
7210. ./myread
7211archname="$ans"
7212
7213: optionally add API version to the architecture for versioned archlibs
7214case "$useversionedarchname" in
7215$define|true|[yY]*) dflt='y';;
7216*)                  dflt='n';;
7217esac
7218rp='Add the Perl API version to your archname?'
7219. ./myread
7220case "$ans" in
7221y|Y)	useversionedarchname="$define" ;;
7222*)      useversionedarchname="$undef" ;;
7223esac
7224case "$useversionedarchname" in
7225$define)
7226	case "$archname" in
7227	*-$api_versionstring)
7228		echo "...and architecture name already has -$api_versionstring" >&4
7229		;;
7230	*)
7231		archname="$archname-$api_versionstring"
7232		echo "...setting architecture name to $archname." >&4
7233		;;
7234	esac
7235	;;
7236esac
7237
7238case "$usethreads" in
7239$define)
7240	echo "Threads selected." >&4
7241	case "$archname" in
7242	*-thread*) echo "...and architecture name already has -thread." >&4
7243		;;
7244	*)      archname="$archname-thread"
7245		echo "...setting architecture name to $archname." >&4
7246		;;
7247	esac
7248	;;
7249esac
7250case "$usemultiplicity" in
7251$define)
7252	echo "Multiplicity selected." >&4
7253	case "$archname" in
7254	*-multi*) echo "...and architecture name already has -multi." >&4
7255		;;
7256	*)      archname="$archname-multi"
7257		echo "...setting architecture name to $archname." >&4
7258		;;
7259	esac
7260	;;
7261esac
7262case "$use64bitint$use64bitall" in
7263*"$define"*)
7264	case "$archname64" in
7265	'')
7266		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7267		;;
7268	*)
7269		case "$use64bitint" in
7270		"$define") echo "64 bit integers selected." >&4 ;;
7271		esac
7272		case "$use64bitall" in
7273		"$define") echo "Maximal 64 bitness selected." >&4 ;;
7274		esac
7275		case "$archname" in
7276		*-$archname64*) echo "...and architecture name already has $archname64." >&4
7277			;;
7278		*)      archname="$archname-$archname64"
7279			echo "...setting architecture name to $archname." >&4
7280			;;
7281		esac
7282		;;
7283	esac
7284esac
7285case "$uselongdouble" in
7286$define)
7287	echo "Long doubles selected." >&4
7288	case "$longdblsize" in
7289	$doublesize)
7290		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7291		;;
7292	*)
7293		case "$archname" in
7294		*-ld*) echo "...and architecture name already has -ld." >&4
7295			;;
7296		*)      archname="$archname-ld"
7297			echo "...setting architecture name to $archname." >&4
7298			;;
7299		esac
7300		;;
7301	esac
7302	;;
7303esac
7304case "$usequadmath" in
7305$define)
7306	echo "quadmath selected." >&4
7307	case "$archname" in
7308	*-quadmath*) echo "...and architecture name already has -quadmath." >&4
7309		;;
7310	*)      archname="$archname-quadmath"
7311		echo "...setting architecture name to $archname." >&4
7312		;;
7313	esac
7314	;;
7315esac
7316if $test -f archname.cbu; then
7317	echo "Your platform has some specific hints for architecture name, using them..."
7318	. ./archname.cbu
7319fi
7320
7321: set the prefixit variable, to compute a suitable default value
7322prefixit='case "$3" in
7323""|none)
7324	case "$oldprefix" in
7325	"") eval "$1=\"\$$2\"";;
7326	*)
7327		case "$3" in
7328		"") eval "$1=";;
7329		none)
7330			eval "tp=\"\$$2\"";
7331			case "$tp" in
7332			""|" "|none) eval "$1=\"\$$2\"";;
7333			*) eval "$1=";;
7334			esac;;
7335		esac;;
7336	esac;;
7337*)
7338	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7339	case "$tp" in
7340	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7341	/*-$oldprefix/*|\~*-$oldprefix/*)
7342		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7343	*) eval "$1=\"\$$2\"";;
7344	esac;;
7345esac'
7346
7347: determine installation style
7348: For now, try to deduce it from prefix unless it is already set.
7349: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7350case "$installstyle" in
7351'')	case "$prefix" in
7352		*perl*) dflt='lib';;
7353		*) dflt='lib/perl5' ;;
7354	esac
7355	;;
7356*)	dflt="$installstyle" ;;
7357esac
7358: Probably not worth prompting for this since we prompt for all
7359: the directories individually, and the prompt would be too long and
7360: confusing anyway.
7361installstyle=$dflt
7362
7363: determine where public executables go
7364echo " "
7365set dflt bin bin
7366eval $prefixit
7367fn=d~
7368rp='Pathname where the public executables will reside?'
7369. ./getfile
7370if $test "X$ansexp" != "X$binexp"; then
7371	installbin=''
7372fi
7373prefixvar=bin
7374: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7375: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7376:     this via initialinstalllocation
7377. ./setprefixvar
7378
7379case "$userelocatableinc" in
7380$define|true|[yY]*)	dflt='y' ;;
7381*)			dflt='n' ;;
7382esac
7383cat <<EOM
7384
7385Would you like to build Perl so that the installation is relocatable, so that
7386library paths in @INC are determined relative to the path of the perl binary?
7387This is not advised for system Perl installs, or if you need to run setid
7388scripts or scripts under taint mode.
7389
7390If this doesn't make any sense to you, just accept the default '$dflt'.
7391EOM
7392rp='Use relocatable @INC?'
7393. ./myread
7394case "$ans" in
7395y|Y)	val="$define" ;;
7396*)	val="$undef"  ;;
7397esac
7398set userelocatableinc
7399eval $setvar
7400
7401initialinstalllocation="$binexp"
7402: Default prefix is now "up one level from where the binaries are"
7403case "$userelocatableinc" in
7404$define|true|[yY]*)
7405    bin=".../"
7406    binexp=".../"
7407    prefix=".../.."
7408    prefixexp=".../.."
7409    installprefixexp=".../.."
7410    ;;
7411esac
7412
7413: determine where private library files go
7414: Usual default is /usr/local/lib/perl5/$version.
7415: Also allow things like /opt/perl/lib/$version, since
7416: /opt/perl/lib/perl5... would be redundant.
7417: The default "style" setting is made in installstyle.U
7418case "$installstyle" in
7419*lib/perl5*) set dflt privlib lib/$package/$version ;;
7420*)	 set dflt privlib lib/$version ;;
7421esac
7422eval $prefixit
7423$cat <<EOM
7424
7425There are some auxiliary files for $package that need to be put into a
7426private library directory that is accessible by everyone.
7427
7428EOM
7429fn=$binexp
7430fn=d~+
7431rp='Pathname where the private library files will reside?'
7432. ./getfile
7433prefixvar=privlib
7434. ./setprefixvar
7435
7436: set the prefixup variable, to restore leading tilda escape
7437prefixup='case "$prefixexp" in
7438"$prefix") ;;
7439*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7440esac'
7441
7442: determine where public architecture dependent libraries go
7443set archlib archlib
7444eval $prefixit
7445: privlib default is /usr/local/lib/$package/$version
7446: archlib default is /usr/local/lib/$package/$version/$archname
7447: privlib may have an optional trailing /share.
7448tdflt=`echo $privlib | $sed 's,/share$,,'`
7449tdflt=$tdflt/$archname
7450case "$archlib" in
7451'')	dflt=$tdflt
7452	;;
7453*)	dflt="$archlib"
7454    ;;
7455esac
7456$cat <<EOM
7457
7458$spackage contains architecture-dependent library files.  If you are
7459sharing libraries in a heterogeneous environment, you might store
7460these files in a separate location.  Otherwise, you can just include
7461them with the rest of the public library files.
7462
7463EOM
7464fn=$binexp
7465fn=d+~
7466rp='Where do you want to put the public architecture-dependent libraries?'
7467. ./getfile
7468prefixvar=archlib
7469. ./setprefixvar
7470if $test X"$archlib" = X"$privlib"; then
7471	d_archlib="$undef"
7472else
7473	d_archlib="$define"
7474fi
7475
7476: see if setuid scripts can be secure
7477$cat <<EOM
7478
7479Some kernels have a bug that prevents setuid #! scripts from being
7480secure.  Some sites have disabled setuid #! scripts because of this.
7481
7482First let's decide if your kernel supports secure setuid #! scripts.
7483(If setuid #! scripts would be secure but have been disabled anyway,
7484don't say that they are secure if asked.)
7485
7486EOM
7487
7488val="$undef"
7489if $test -d /dev/fd; then
7490	echo "#!$ls" >reflect
7491	chmod +x,u+s reflect
7492	./reflect >flect 2>&1
7493	if $contains "/dev/fd" flect >/dev/null; then
7494		echo "Congratulations, your kernel has secure setuid scripts!" >&4
7495		val="$define"
7496	else
7497		$cat <<EOM
7498If you are not sure if they are secure, I can check but I'll need a
7499username and password different from the one you are using right now.
7500If you don't have such a username or don't want me to test, simply
7501enter 'none'.
7502
7503EOM
7504		rp='Other username to test security of setuid scripts with?'
7505		dflt='none'
7506		. ./myread
7507		case "$ans" in
7508		n|none)
7509			case "$d_suidsafe" in
7510			'')	echo "I'll assume setuid scripts are *not* secure." >&4
7511				dflt=n;;
7512			"$undef")
7513				echo "Well, the $hint value is *not* secure." >&4
7514				dflt=n;;
7515			*)	echo "Well, the $hint value *is* secure." >&4
7516				dflt=y;;
7517			esac
7518			;;
7519		*)
7520			$rm -f reflect flect
7521			echo "#!$ls" >reflect
7522			chmod +x,u+s reflect
7523			echo >flect
7524			chmod a+w flect
7525			echo '"su" will (probably) prompt you for '"$ans's password."
7526			su $ans -c './reflect >flect'
7527			if $contains "/dev/fd" flect >/dev/null; then
7528				echo "Okay, it looks like setuid scripts are secure." >&4
7529				dflt=y
7530			else
7531				echo "I don't think setuid scripts are secure." >&4
7532				dflt=n
7533			fi
7534			;;
7535		esac
7536		rp='Does your kernel have *secure* setuid scripts?'
7537		. ./myread
7538		case "$ans" in
7539		[yY]*)	val="$define";;
7540		*)	val="$undef";;
7541		esac
7542	fi
7543else
7544	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7545	echo "(That's for file descriptors, not floppy disks.)"
7546	val="$undef"
7547fi
7548set d_suidsafe
7549eval $setvar
7550
7551$rm -f reflect flect
7552
7553: now see if they want to do setuid emulation
7554if $test $patchlevel -lt 11; then
7555echo " "
7556val="$undef"
7557case "$d_suidsafe" in
7558"$define")
7559	val="$undef"
7560	echo "No need to emulate SUID scripts since they are secure here." >&4
7561	;;
7562*)
7563	$cat <<EOM
7564Some systems have disabled setuid scripts, especially systems where
7565setuid scripts cannot be secure.  On systems where setuid scripts have
7566been disabled, the setuid/setgid bits on scripts are currently
7567useless.  It is possible for $package to detect those bits and emulate
7568setuid/setgid in a secure fashion.  This emulation will only work if
7569setuid scripts have been disabled in your kernel.
7570
7571EOM
7572	case "$d_dosuid" in
7573	"$define") dflt=y ;;
7574	*) dflt=n ;;
7575	esac
7576	rp="Do you want to do setuid/setgid emulation?"
7577	. ./myread
7578	case "$ans" in
7579	[yY]*)	val="$define";;
7580	*)	val="$undef";;
7581	esac
7582	;;
7583esac
7584set d_dosuid
7585eval $setvar
7586else
7587    case "$d_dosuid" in
7588	"$define")
7589	cat >&4 <<EOH
7590
7591SUID emulation has been removed for 5.12
7592Please re-run Configure without -Dd_dosuid
7593
7594EOH
7595	exit 1;
7596	;;
7597    esac
7598    d_dosuid=undef
7599fi
7600
7601: Find perl5.005 or later.
7602echo "Looking for a previously installed perl5.005 or later... "
7603case "$perl5" in
7604'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7605		: Check if this perl is recent and can load a simple module
7606		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7607			perl5=$tdir/perl
7608			break;
7609		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7610			perl5=$tdir/perl5
7611			break;
7612		fi
7613	done
7614	;;
7615*)	perl5="$perl5"
7616	;;
7617esac
7618case "$perl5" in
7619'')	echo "None found.  That's ok.";;
7620*)	echo "Using $perl5." ;;
7621esac
7622
7623: Set the siteprefix variables
7624$cat <<EOM
7625
7626After $package is installed, you may wish to install various
7627add-on modules and utilities.  Typically, these add-ons will
7628be installed under $prefix with the rest
7629of this package.  However, you may wish to install such add-ons
7630elsewhere under a different prefix.
7631
7632If you do not wish to put everything under a single prefix, that's
7633ok.  You will be prompted for the individual locations; this siteprefix
7634is only used to suggest the defaults.
7635
7636The default should be fine for most people.
7637
7638EOM
7639fn=d~+
7640rp='Installation prefix to use for add-on modules and utilities?'
7641: XXX Here might be another good place for an installstyle setting.
7642case "$siteprefix" in
7643'') dflt=$prefix ;;
7644*)  dflt=$siteprefix ;;
7645esac
7646. ./getfile
7647: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7648oldsiteprefix=''
7649case "$siteprefix" in
7650'') ;;
7651*)	case "$ans" in
7652	"$prefix") ;;
7653	*) oldsiteprefix="$prefix";;
7654	esac
7655	;;
7656esac
7657siteprefix="$ans"
7658siteprefixexp="$ansexp"
7659
7660: determine where site specific libraries go.
7661: Usual default is /usr/local/lib/perl5/site_perl/$version
7662: The default "style" setting is made in installstyle.U
7663: XXX No longer works with Prefixit stuff.
7664prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7665case "$sitelib" in
7666'') case "$installstyle" in
7667	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7668	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
7669	esac
7670	;;
7671*)	dflt="$sitelib"
7672	;;
7673esac
7674$cat <<EOM
7675
7676The installation process will create a directory for
7677site-specific extensions and modules.  Most users find it convenient
7678to place all site-specific files in this directory rather than in the
7679main distribution directory.
7680
7681EOM
7682fn=d~+
7683rp='Pathname for the site-specific library files?'
7684. ./getfile
7685prefixvar=sitelib
7686. ./setprefixvar
7687sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7688
7689: Determine list of previous versions to include in @INC
7690$cat > getverlist <<EOPL
7691#!$perl5
7692use strict;
7693use warnings;
7694use File::Basename;
7695my \$api_versionstring = "$api_versionstring";
7696my \$version = "$version";
7697my \$stem = "$sitelib_stem";
7698my \$archname = "$archname";
7699EOPL
7700	$cat >> getverlist <<'EOPL'
7701# The list found is stored twice for each entry: the original name, and
7702# the binary broken down version into pack "s>s>s>", so sorting is easy
7703# and unambiguous.  This will work for all versions that have a maximum
7704# of three digit per group separate by '.'s or '_'s. Names are extended
7705# with ".0.0" to ensure at least three elements for the pack.
7706#                                   -- H.Merijn Brand (m)'06 23-10-2006
7707
7708my @inc_version_list;
7709my @candidates;
7710# XXX Redo to do opendir/readdir?
7711if (-d $stem) {
7712    chdir($stem);
7713    ;@candidates = map {
7714	[ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7715    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7716}
7717else {
7718    ;@candidates = ();
7719}
7720
7721my ($pversion, $aversion, $vsn5005) = map {
7722    pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7723foreach my $d (@candidates) {
7724    if ($d->[1] lt $pversion) {
7725	if ($d->[1] ge $aversion) {
7726	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7727	}
7728	elsif ($d->[1] ge $vsn5005) {
7729	    unshift(@inc_version_list, grep { -d } $d->[0]);
7730	}
7731    }
7732    else {
7733	# Skip newer version.  I.e. don't look in
7734	# 5.7.0 if we're installing 5.6.1.
7735    }
7736}
7737
7738if (@inc_version_list) {
7739    print join(' ', @inc_version_list);
7740}
7741else {
7742    # Blank space to preserve value for next Configure run.
7743    print " ";
7744}
7745EOPL
7746chmod +x getverlist
7747case "$inc_version_list" in
7748'')	if test -x "$perl5$exe_ext"; then
7749		dflt=`$perl5 getverlist`
7750	else
7751		dflt='none'
7752	fi
7753	;;
7754$undef) dflt='none' ;;
7755*)  eval dflt=\"$inc_version_list\" ;;
7756esac
7757case "$dflt" in
7758''|' ') dflt=none ;;
7759esac
7760case "$dflt" in
77615.005) dflt=none ;;
7762esac
7763$cat <<EOM
7764
7765In order to ease the process of upgrading, this version of perl
7766can be configured to use modules built and installed with earlier
7767versions of perl that were installed under $prefix.  Specify here
7768the list of earlier versions that this version of perl should check.
7769If Configure detected no earlier versions of perl installed under
7770$prefix, then the list will be empty.  Answer 'none' to tell perl
7771to not search earlier versions.
7772
7773The default should almost always be sensible, so if you're not sure,
7774just accept the default.
7775EOM
7776
7777rp='List of earlier versions to include in @INC?'
7778. ./myread
7779case "$ans" in
7780[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7781*) inc_version_list="$ans" ;;
7782esac
7783case "$inc_version_list" in
7784''|' ')
7785	inc_version_list_init='0'
7786	d_inc_version_list="$undef"
7787	;;
7788*)	inc_version_list_init=`echo $inc_version_list |
7789		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7790	d_inc_version_list="$define"
7791	;;
7792esac
7793$rm -f getverlist
7794
7795: check for length of pointer
7796echo " "
7797case "$ptrsize" in
7798'')
7799	echo "Checking to see how big your pointers are..." >&4
7800	$cat >try.c <<EOCP
7801#include <stdio.h>
7802#$i_stdlib I_STDLIB
7803#ifdef I_STDLIB
7804#include <stdlib.h>
7805#endif
7806int main()
7807{
7808    printf("%d\n", (int)sizeof(void *));
7809    exit(0);
7810}
7811EOCP
7812	set try
7813	if eval $compile_ok; then
7814		ptrsize=`$run ./try`
7815		echo "Your pointers are $ptrsize bytes long."
7816	else
7817		dflt='4'
7818		echo "(I can't seem to compile the test program.  Guessing...)" >&4
7819		rp="What is the size of a pointer (in bytes)?"
7820		. ./myread
7821		ptrsize="$ans"
7822	fi
7823	;;
7824esac
7825$rm_try
7826case "$use64bitall" in
7827"$define"|true|[yY]*)
7828	case "$ptrsize" in
7829	4)	cat <<EOM >&4
7830
7831*** You have chosen a maximally 64-bit build,
7832*** but your pointers are only 4 bytes wide.
7833*** Please rerun Configure without -Duse64bitall.
7834EOM
7835		case "$d_quad" in
7836		define)
7837			cat <<EOM >&4
7838*** Since you have quads, you could possibly try with -Duse64bitint.
7839EOM
7840			;;
7841		esac
7842		cat <<EOM >&4
7843*** Cannot continue, aborting.
7844
7845EOM
7846
7847		exit 1
7848		;;
7849	esac
7850	;;
7851esac
7852
7853: determine whether to use malloc wrapping
7854echo " "
7855case "$usemallocwrap" in
7856[yY]*|true|$define)	dflt='y' ;;
7857[nN]*|false|$undef)	dflt='n' ;;
7858*)	case "$usedevel" in
7859	[yY]*|true|$define)	dflt='y' ;;
7860	*) dflt='n' ;;
7861	esac
7862	;;
7863esac
7864rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7865. ./myread
7866usemallocwrap="$ans"
7867case "$ans" in
7868y*|true)
7869	usemallocwrap="$define" ;;
7870*)
7871	usemallocwrap="$undef" ;;
7872esac
7873
7874: determine which malloc to compile in
7875echo " "
7876case "$usemymalloc" in
7877[yY]*|true|$define)	dflt='y' ;;
7878[nN]*|false|$undef)	dflt='n' ;;
7879*)	case "$ptrsize" in
7880	4) dflt='y' ;;
7881	*) dflt='n' ;;
7882	esac
7883	if test "$useithreads" = "$define"; then dflt='n'; fi
7884	;;
7885esac
7886rp="Do you wish to attempt to use the malloc that comes with $package?"
7887. ./myread
7888usemymalloc="$ans"
7889case "$ans" in
7890y*|true)
7891	usemymalloc='y'
7892	mallocsrc='malloc.c'
7893	mallocobj="malloc$_o"
7894	d_mymalloc="$define"
7895	case "$libs" in
7896	*-lmalloc*)
7897		: Remove malloc from list of libraries to use
7898		echo "Removing unneeded -lmalloc from library list" >&4
7899		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7900		shift
7901		libs="$*"
7902		echo "libs = $libs" >&4
7903		;;
7904	esac
7905	;;
7906*)
7907	usemymalloc='n'
7908	mallocsrc=''
7909	mallocobj=''
7910	d_mymalloc="$undef"
7911	;;
7912esac
7913
7914: compute the return types of malloc and free
7915echo " "
7916case "$malloctype" in
7917'')
7918	malloctype='void *'
7919	;;
7920esac
7921echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7922
7923case "$freetype" in
7924'')
7925	freetype='void'
7926	;;
7927esac
7928echo "Your system uses $freetype free(), it would seem." >&4
7929
7930: determine where site specific architecture-dependent libraries go.
7931: sitelib  default is /usr/local/lib/perl5/site_perl/$version
7932: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7933: sitelib may have an optional trailing /share.
7934case "$sitearch" in
7935'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
7936	dflt="$dflt/$archname"
7937	;;
7938*)	dflt="$sitearch"
7939	;;
7940esac
7941set sitearch sitearch none
7942eval $prefixit
7943$cat <<EOM
7944
7945The installation process will also create a directory for
7946architecture-dependent site-specific extensions and modules.
7947
7948EOM
7949fn=d~+
7950rp='Pathname for the site-specific architecture-dependent library files?'
7951. ./getfile
7952prefixvar=sitearch
7953. ./setprefixvar
7954if $test X"$sitearch" = X"$sitelib"; then
7955	d_sitearch="$undef"
7956else
7957	d_sitearch="$define"
7958fi
7959
7960: Set the vendorprefix variables
7961$cat <<EOM
7962
7963The installation process will also create a directory for
7964vendor-supplied add-ons.  Vendors who supply perl with their system
7965may find it convenient to place all vendor-supplied files in this
7966directory rather than in the main distribution directory.  This will
7967ease upgrades between binary-compatible maintenance versions of perl.
7968
7969Of course you may also use these directories in whatever way you see
7970fit.  For example, you might use them to access modules shared over a
7971company-wide network.
7972
7973The default answer should be fine for most people.
7974This causes further questions about vendor add-ons to be skipped
7975and no vendor-specific directories will be configured for perl.
7976
7977EOM
7978rp='Do you want to configure vendor-specific add-on directories?'
7979case "$usevendorprefix" in
7980define|true|[yY]*) dflt=y ;;
7981*)	: User may have set vendorprefix directly on Configure command line.
7982	case "$vendorprefix" in
7983	''|' ') dflt=n ;;
7984	*)	dflt=y ;;
7985	esac
7986	;;
7987esac
7988. ./myread
7989case "$ans" in
7990[yY]*)	fn=d~+
7991	rp='Installation prefix to use for vendor-supplied add-ons?'
7992	case "$vendorprefix" in
7993	'') dflt="$prefix" ;;
7994	*)  dflt=$vendorprefix ;;
7995	esac
7996	. ./getfile
7997	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7998	oldvendorprefix=''
7999	case "$vendorprefix" in
8000	'') ;;
8001	*)	case "$ans" in
8002		"$prefix") ;;
8003		*) oldvendorprefix="$prefix";;
8004		esac
8005		;;
8006	esac
8007	usevendorprefix="$define"
8008	vendorprefix="$ans"
8009	vendorprefixexp="$ansexp"
8010	;;
8011*)	usevendorprefix="$undef"
8012	vendorprefix=''
8013	vendorprefixexp=''
8014	;;
8015esac
8016
8017: Set the vendorlib variables
8018case "$vendorprefix" in
8019'')	d_vendorlib="$undef"
8020	vendorlib=''
8021	vendorlibexp=''
8022	;;
8023*)	d_vendorlib="$define"
8024	: determine where vendor-supplied modules go.
8025	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
8026	case "$vendorlib" in
8027	'')
8028		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8029		case "$installstyle" in
8030		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8031		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8032		esac
8033		;;
8034	*)	dflt="$vendorlib"
8035		;;
8036	esac
8037	fn=d~+
8038	rp='Pathname for the vendor-supplied library files?'
8039	. ./getfile
8040	vendorlib="$ans"
8041	vendorlibexp="$ansexp"
8042	;;
8043esac
8044vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8045prefixvar=vendorlib
8046. ./installprefix
8047
8048: Set the vendorarch variables
8049case "$vendorprefix" in
8050'')	d_vendorarch="$undef"
8051	vendorarch=''
8052	vendorarchexp=''
8053	;;
8054*)	d_vendorarch="$define"
8055	: determine where vendor-supplied architecture-dependent libraries go.
8056	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8057	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8058	: vendorlib may have an optional trailing /share.
8059	case "$vendorarch" in
8060	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
8061		dflt="$dflt/$archname"
8062		;;
8063	*)	dflt="$vendorarch" ;;
8064	esac
8065	fn=d~+
8066	rp='Pathname for vendor-supplied architecture-dependent files?'
8067	. ./getfile
8068	vendorarch="$ans"
8069	vendorarchexp="$ansexp"
8070	;;
8071esac
8072prefixvar=vendorarch
8073. ./installprefix
8074if $test X"$vendorarch" = X"$vendorlib"; then
8075	d_vendorarch="$undef"
8076else
8077	d_vendorarch="$define"
8078fi
8079
8080: Final catch-all directories to search
8081$cat <<EOM
8082
8083Lastly, you can have perl look in other directories for extensions and
8084modules in addition to those already specified.
8085These directories will be searched after
8086	$sitearch
8087	$sitelib
8088EOM
8089test X"$vendorlib" != "X" && echo '	' $vendorlib
8090test X"$vendorarch" != "X" && echo '	' $vendorarch
8091echo ' '
8092case "$otherlibdirs" in
8093''|' ') dflt='none' ;;
8094*)	dflt="$otherlibdirs" ;;
8095esac
8096$cat <<EOM
8097Enter a colon-separated set of extra paths to include in perl's @INC
8098search path, or enter 'none' for no extra paths.
8099
8100EOM
8101
8102rp='Colon-separated list of additional directories for perl to search?'
8103. ./myread
8104case "$ans" in
8105' '|''|none)	otherlibdirs=' ' ;;
8106*)	otherlibdirs="$ans" ;;
8107esac
8108case "$otherlibdirs" in
8109' ') val=$undef ;;
8110*)	val=$define ;;
8111esac
8112set d_perl_otherlibdirs
8113eval $setvar
8114
8115: DTrace support
8116dflt_dtrace='/usr/sbin/dtrace'
8117$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8118
8119cat <<EOM
8120
8121Perl can be built to support DTrace on platforms that support it.
8122DTrace is a diagnosis and performance analysis tool from Sun.
8123
8124If this doesn't make any sense to you, just accept the default.
8125EOM
8126
8127while $test 1 ; do
8128	case "$usedtrace" in
8129	$define|true|[yY]*)
8130		dflt='y'
8131		;;
8132	$undef|false|[nN]*)
8133		dflt='n'
8134		dflt_dtrace=""
8135		;;
8136	?*)
8137		dflt='y'
8138		dflt_dtrace=$usedtrace
8139		;;
8140	*)
8141		dflt='n'
8142		;;
8143	esac
8144
8145	rp='Support DTrace if available?'
8146	. ./myread
8147	case "$ans" in
8148	y|Y)	val="$define" ;;
8149	*)      val="$undef" ;;
8150	esac
8151	set usedtrace
8152	eval $setvar
8153
8154	test "X$usedtrace" != "X$define" && break
8155
8156	echo " "
8157	rp='Where is the dtrace executable?'
8158	dflt=$dflt_dtrace
8159	. ./getfile
8160	val="$ans"
8161	set dtrace
8162	eval $setvar
8163
8164	if $test -f $dtrace
8165	then
8166		if $dtrace -h -s ../perldtrace.d \
8167			-o perldtrace.tmp >/dev/null 2>&1 \
8168			&& rm -f perldtrace.tmp
8169		then
8170			echo " "
8171			echo "Good: your $dtrace knows about the -h flag."
8172		else
8173			cat >&2 <<EOM
8174
8175*** $me:  Fatal Error:  $dtrace doesn't support -h flag
8176***
8177*** Your installed dtrace doesn't support the -h switch to compile a D
8178*** program into a C header. Can't continue.
8179
8180EOM
8181			exit 1
8182		fi
8183		break;
8184	fi
8185
8186	case "$fastread" in
8187	yes)
8188		cat >&2 <<EOM
8189
8190*** $me:  Fatal Error:  $dtrace not found.
8191*** Can't continue.
8192
8193EOM
8194		exit 1
8195		;;
8196	*)
8197		echo "*** $dtrace was not found."
8198		echo " "
8199		;;
8200	esac
8201done
8202
8203: See if we want extra modules installed
8204echo " "
8205case "$extras" in
8206'') dflt='n';;
8207*) dflt='y';;
8208esac
8209cat <<EOM
8210Perl can be built with extra modules or bundles of modules which
8211will be fetched from the CPAN and installed alongside Perl.
8212
8213Notice that you will need access to the CPAN; either via the Internet,
8214or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8215be asked later to configure the CPAN.pm module which will in turn do
8216the installation of the rest of the extra modules or bundles.)
8217
8218Notice also that if the modules require any external software such as
8219libraries and headers (the libz library and the zlib.h header for the
8220Compress::Zlib module, for example) you MUST have any such software
8221already installed, this configuration process will NOT install such
8222things for you.
8223
8224If this doesn't make any sense to you, just accept the default '$dflt'.
8225EOM
8226rp='Install any extra modules (y or n)?'
8227. ./myread
8228case "$ans" in
8229y|Y)
8230	cat <<EOM
8231
8232Please list any extra modules or bundles to be installed from CPAN,
8233with spaces between the names.  The names can be in any format the
8234'install' command of CPAN.pm will understand.  (Answer 'none',
8235without the quotes, to install no extra modules or bundles.)
8236EOM
8237	rp='Extras?'
8238	dflt="$extras"
8239	. ./myread
8240	extras="$ans"
8241esac
8242case "$extras" in
8243''|'none')
8244	val=''
8245	$rm -f ../extras.lst
8246	;;
8247*)	echo "(Saving the list of extras for later...)"
8248	echo "$extras" > ../extras.lst
8249	val="'$extras'"
8250	;;
8251esac
8252set extras
8253eval $setvar
8254echo " "
8255
8256: determine where html pages for programs go
8257set html1dir html1dir none
8258eval $prefixit
8259$cat <<EOM
8260
8261If you wish to install html files for programs in $spackage, indicate
8262the appropriate directory here.  To skip installing html files,
8263answer "none".
8264EOM
8265case "$html1dir" in
8266''|none|$undef|' ') dflt=none ;;
8267*) dflt=$html1dir ;;
8268esac
8269fn=dn+~
8270rp="Directory for the main $spackage html pages?"
8271. ./getfile
8272prefixvar=html1dir
8273. ./setprefixvar
8274: Use ' ' for none so value is preserved next time through Configure
8275$test X"$html1dir" = "X" && html1dir=' '
8276
8277: determine where html pages for libraries and modules go
8278set html3dir html3dir none
8279eval $prefixit
8280$cat <<EOM
8281
8282If you wish to install html files for modules associated with $spackage,
8283indicate the appropriate directory here.  To skip installing html files,
8284answer "none".
8285EOM
8286: There is no obvious default.  If they have specified html1dir, then
8287: try to key off that, possibly changing .../html1 into .../html3.
8288case "$html3dir" in
8289'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8290*) dflt=$html3dir ;;
8291esac
8292fn=dn+~
8293rp="Directory for the $spackage module html pages?"
8294. ./getfile
8295prefixvar=html3dir
8296. ./setprefixvar
8297: Use ' ' for none so value is preserved next time through Configure
8298$test X"$html3dir" = "X" && html3dir=' '
8299
8300: determine whether to install perl also as /usr/bin/perl
8301
8302echo " "
8303if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8304	$cat <<EOM
8305Many scripts expect perl to be installed as /usr/bin/perl.
8306
8307If you want to, I can install the perl you are about to compile
8308as /usr/bin/perl (in addition to $bin/perl).
8309EOM
8310	if test -f /usr/bin/perl; then
8311	    $cat <<EOM
8312
8313However, please note that because you already have a /usr/bin/perl,
8314overwriting that with a new Perl would very probably cause problems.
8315Therefore I'm assuming you don't want to do that (unless you insist).
8316
8317EOM
8318	    case "$installusrbinperl" in
8319	    "$define"|[yY]*)	dflt='y';;
8320	    *)			dflt='n';;
8321	    esac
8322	else
8323	    $cat <<EOM
8324
8325Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8326
8327EOM
8328	    case "$installusrbinperl" in
8329	    "$undef"|[nN]*)	dflt='n';;
8330	    *)			dflt='y';;
8331	    esac
8332	fi
8333	rp="Do you want to install perl as /usr/bin/perl?"
8334	. ./myread
8335	case "$ans" in
8336	[yY]*)	val="$define";;
8337	*)	val="$undef" ;;
8338	esac
8339else
8340	val="$undef"
8341fi
8342set installusrbinperl
8343eval $setvar
8344
8345: see if dlopen exists
8346xxx_runnm="$runnm"
8347xxx_ccflags="$ccflags"
8348runnm=false
8349: with g++ one needs -shared to get is-in-libc to work for dlopen
8350case "$gccversion" in
8351'')	;;
8352*Clang*)	;;
8353*)	case "$d_cplusplus" in
8354	"$define") ccflags="$ccflags -shared" ;;
8355	esac
8356	;;
8357esac
8358set dlopen d_dlopen
8359eval $inlibc
8360runnm="$xxx_runnm"
8361ccflags="$xxx_ccflags"
8362
8363: see if this is a unistd.h system
8364set unistd.h i_unistd
8365eval $inhdr
8366
8367: determine which dynamic loading, if any, to compile in
8368echo " "
8369dldir="ext/DynaLoader"
8370case "$usedl" in
8371    $define|y|true)
8372	dflt='y'
8373	usedl="$define"
8374	;;
8375    $undef|n|false)
8376	dflt='n'
8377	usedl="$undef"
8378	;;
8379    *)
8380	dflt='n'
8381	case "$d_dlopen" in
8382	    $define) dflt='y' ;;
8383	esac
8384	: Does a dl_xxx.xs file exist for this operating system
8385	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8386	;;
8387esac
8388rp="Do you wish to use dynamic loading?"
8389. ./myread
8390usedl="$ans"
8391bin_ELF="$undef"
8392case "$ans" in
8393    y*) usedl="$define"
8394	case "$dlsrc" in
8395	    '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8396		    dflt="$dldir/dl_${osname}.xs"
8397		elif $test "$d_dlopen" = "$define" ; then
8398		    dflt="$dldir/dl_dlopen.xs"
8399		else
8400		    dflt=''
8401		fi
8402		;;
8403	    *)  dflt="$dldir/$dlsrc"
8404		;;
8405	esac
8406	echo "The following dynamic loading files are available:"
8407	: Can not go over to $dldir because getfile has path hard-coded in.
8408	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8409	rp="Source file to use for dynamic loading"
8410	fn="fne"
8411	gfpth="$src"
8412	. ./getfile
8413	usedl="$define"
8414	: emulate basename
8415	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8416
8417	$cat << EOM
8418
8419Some systems may require passing special flags to $cc -c to
8420compile modules that will be used to create a shared library.
8421To use no flags, say "none".
8422
8423EOM
8424	case "$cccdlflags" in
8425	    '') case "$gccversion" in
8426		'') case "$osname" in
8427			hpux)	dflt='+z' ;;
8428			irix*)	dflt='-KPIC' ;;
8429			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8430			sunos)	dflt='-pic' ;;
8431			*)	dflt='none' ;;
8432		    esac
8433		    ;;
8434		*)  case "$osname" in
8435			darwin) dflt='none' ;;
8436			*linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8437			*)	dflt='-fpic' ;;
8438		    esac ;;
8439		esac ;;
8440	    ' ') dflt='none' ;;
8441	    *)   dflt="$cccdlflags" ;;
8442	esac
8443
8444	case "$dflt" in
8445	    none) dflt='' ;;
8446	esac
8447
8448	# If -Dsysroot was specified, now's the time to add it
8449	# to cccdlflags
8450	if test "X$sysroot" != X; then
8451	    case "$gccversion" in
8452		'') ;;
8453		*)  case "$dflt" in
8454			*sysroot*) ;;
8455			'undef'|*)
8456			    dflt="$dflt --sysroot=$sysroot" ;;
8457		    esac
8458		    ;;
8459	    esac
8460	fi
8461
8462	case "$dflt" in
8463	    '') dflt='none';;
8464	esac
8465
8466	rp="Any special flags to pass to $cc -c to compile shared library modules?"
8467	. ./myread
8468	case "$ans" in
8469	    none) cccdlflags=' ' ;;
8470	    *)    cccdlflags="$ans" ;;
8471	esac
8472
8473	cat << EOM
8474
8475Some systems use ld to create libraries that can be dynamically loaded,
8476while other systems (such as those using ELF) use $cc.
8477
8478EOM
8479
8480: Determine if this is ELF
8481	$cat >try.c <<EOM
8482/* Test for whether ELF binaries are produced */
8483#include <fcntl.h>
8484#$i_stdlib I_STDLIB
8485#ifdef I_STDLIB
8486#include <stdlib.h>
8487#endif
8488#$i_unistd I_UNISTD
8489#ifdef I_UNISTD
8490#include <unistd.h>
8491#endif
8492int main() {
8493    char b[4];
8494    int i = open("a.out",O_RDONLY);
8495    if(i == -1)
8496	exit(1); /* fail */
8497    if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8498	exit(0); /* succeed (yes, it is ELF) */
8499    exit(1); /* fail */
8500}
8501EOM
8502	if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8503	    bin_ELF="$define"
8504	fi
8505	$rm_try
8506
8507	case "$ld" in
8508	    '') if $test $bin_ELF = "$define"; then
8509		    cat <<EOM
8510You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8511EOM
8512		    dflt="$cc"
8513		else
8514		    echo "I'll use ld to build dynamic libraries."
8515		    dflt='ld'
8516		fi
8517		;;
8518	    *)  dflt="$ld"
8519		;;
8520	esac
8521
8522	rp="What command should be used to create dynamic libraries?"
8523	. ./myread
8524	ld="$ans"
8525
8526	cat << EOM
8527
8528Some systems may require passing special flags to $ld to create a
8529library that can be dynamically loaded.  If your ld flags include
8530-L/other/path options to locate libraries outside your loader's normal
8531search path, you may need to specify those -L options here as well.  To
8532use no flags, say "none".
8533
8534EOM
8535	case "$lddlflags" in
8536	    '') case "$osname" in
8537		    haiku) dflt='-shared' ;;
8538		    hpux) dflt='-b';
8539			  case "$gccversion" in
8540			      '') dflt="$dflt +vnocompatwarnings" ;;
8541			  esac
8542			  ;;
8543		    *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8544		    solaris) # See [perl #66604].
8545			    # On Solaris 11, gcc -m64 on amd64
8546			    # appears not to understand -G.  gcc versions at
8547			    # least as old as 3.4.3 support -shared, so just
8548			    # use that with Solaris 11 and later, but keep
8549			    # the old behavior for older Solaris versions.
8550			    case "$gccversion" in
8551				'') dflt='-G' ;;
8552				*)  case "$osvers" in
8553					2.?|2.10) dflt='-G' ;;
8554					*) dflt='-shared' ;;
8555				    esac
8556				    ;;
8557			    esac
8558			    ;;
8559		    sunos) dflt='-assert nodefinitions' ;;
8560		    svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8561		    *)     dflt='none' ;;
8562		esac
8563		;;
8564	    *) dflt="$lddlflags" ;;
8565	esac
8566
8567	: Only do this for gcc, since, for example, qcc has no concept
8568	: of --sysroot.
8569	if $test "X$sysroot" != X; then
8570	    case "$gccversion" in
8571		'') ;;
8572		*)  dflt="$dflt --sysroot=$sysroot" ;;
8573	    esac
8574	fi
8575
8576	: Try to guess additional flags to pick up local libraries.
8577	: Be careful not to append to a plain 'none'
8578	case "$dflt" in
8579	    none) dflt='' ;;
8580	esac
8581	for thisflag in $ldflags; do
8582	    case "$thisflag" in
8583		-L*|-R*|-Wl,-R*)
8584		    case " $dflt " in
8585			*" $thisflag "*) ;;
8586			*) dflt="$dflt $thisflag" ;;
8587		    esac
8588		    ;;
8589	    esac
8590	done
8591
8592	case "$dflt" in
8593	    ''|' ') dflt='none' ;;
8594	esac
8595
8596	case "$ldflags" in
8597	    *-fstack-protector-strong*)
8598		case "$dflt" in
8599		    *-fstack-protector-strong*) ;; # Don't add it again
8600		    *) dflt="$dflt -fstack-protector-strong" ;;
8601		esac
8602		;;
8603	    *-fstack-protector*)
8604		case "$dflt" in
8605		    *-fstack-protector*) ;; # Don't add it again
8606		    *) dflt="$dflt -fstack-protector" ;;
8607		esac
8608		;;
8609	esac
8610
8611	rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8612	. ./myread
8613	case "$ans" in
8614	    none) lddlflags=' ' ;;
8615	    *) lddlflags="$ans" ;;
8616	esac
8617
8618	cat <<EOM
8619
8620Some systems may require passing special flags to $cc to indicate that
8621the resulting executable will use dynamic linking.  To use no flags,
8622say "none".
8623
8624EOM
8625	case "$ccdlflags" in
8626	    '') case "$osname" in
8627		    *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8628		    sunos)             dflt='none'   ;;
8629		    *)                 dflt='none'   ;;
8630		esac ;;
8631	    ' ') dflt='none' ;;
8632	    *)   dflt="$ccdlflags" ;;
8633	esac
8634	rp="Any special flags to pass to $cc to use dynamic linking?"
8635	. ./myread
8636	case "$ans" in
8637	    none) ccdlflags=' ' ;;
8638	    *)    ccdlflags="$ans" ;;
8639	esac
8640	;;
8641
8642    *)  usedl="$undef"
8643	ld='ld'
8644	dlsrc='dl_none.xs'
8645	lddlflags=''
8646	ccdlflags=''
8647	;;
8648esac
8649
8650ld_can_script="$undef"
8651case "$bin_ELF$usedl" in
8652    $define$define)
8653	# Abuse try.h and a.out names for neat cleanup
8654	$cat >try.c <<EOM
8655void foo() {}
8656void bar() {}
8657EOM
8658	$cat >try.h <<EOM
8659LIBTEST_42 {
8660 global:
8661  foo;
8662 local: *;
8663 };
8664EOM
8665	if $cc $cccdlflags $ccdlflags $ccflags \
8666	       $ldflags $lddlflags -o a.out try.c \
8667	       -Wl,--version-script=try.h >/dev/null 2>&1 \
8668	   &&  $test -s a.out ; then
8669	    echo "ld supports scripting" >&4
8670	    ld_can_script="$define"
8671	else
8672	    echo "ld does not support scripting" >&4
8673	fi
8674	$rm_try
8675	;;
8676esac
8677
8678: Do we want a shared libperl?
8679also=''
8680case "$usedl" in
8681$undef)
8682	# No dynamic loading being used, so don't bother even to prompt.
8683	useshrplib='false'
8684	;;
8685*)	case "$useshrplib" in
8686	'')	case "$osname" in
8687		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8688			dflt=y
8689			also='Building a shared libperl is required for dynamic loading to work on your system.'
8690			;;
8691		*)	dflt=n
8692			;;
8693		esac
8694		;;
8695	$define|true|[Yy]*)
8696		dflt=y
8697		;;
8698	*)	dflt=n
8699		;;
8700	esac
8701	$cat << EOM
8702
8703The perl executable is normally obtained by linking perlmain.c with
8704libperl${_a}, any static extensions (usually just DynaLoader), and
8705any other libraries needed on this system (such as -lm, etc.).  Since
8706your system supports dynamic loading, it is probably possible to build
8707a shared libperl.$so.  If you will have more than one executable linked
8708to libperl.$so, this will significantly reduce the size of each
8709executable, but it may have a noticeable effect on performance.  The
8710default is probably sensible for your system.
8711$also
8712
8713EOM
8714	rp="Build a shared libperl.$so (y/n)"
8715	. ./myread
8716	case "$ans" in
8717	true|$define|[Yy]*)
8718		useshrplib='true'  ;;
8719	*)	useshrplib='false' ;;
8720	esac
8721	;;
8722esac
8723
8724case "$useshrplib" in
8725true)
8726	case "$userelocatableinc" in
8727	true|define)
8728		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8729		echo "See INSTALL for an explanation why that won't work." >&4
8730		exit 4
8731		;;
8732	esac
8733	case "$libperl" in
8734	'')
8735		# Figure out a good name for libperl.so.  Since it gets stored in
8736		# a version-specific architecture-dependent library, the version
8737		# number isn't really that important, except for making cc/ld happy.
8738		#
8739		# A name such as libperl.so.10.1
8740		majmin="libperl.$so.$patchlevel.$subversion"
8741		# A name such as libperl.so.100
8742		majonly=`echo $patchlevel $subversion |
8743			$awk '{printf "%d%02d", $1, $2}'`
8744		majonly=libperl.$so.$majonly
8745		# I'd prefer to keep the os-specific stuff here to a minimum, and
8746		# rely on figuring it out from the naming of libc.
8747		case "${osname}${osvers}" in
8748		*linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8749			dflt=libperl.$so
8750			;;
8751		cygwin*) # ld links now against the dll directly
8752			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8753			majonly=`echo $patchlevel $subversion |
8754				$awk '{printf "%03d%03d", $1, $2}'`
8755			majonly=cygperl5.$majonly.$so
8756			dflt=$majmin
8757			;;
8758		*)	# Try to guess based on whether libc has major.minor.
8759			case "$libc" in
8760			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8761			*libc.$so.[0-9]*) dflt=$majonly ;;
8762			*)	dflt=libperl.$so ;;
8763			esac
8764			;;
8765		esac
8766		;;
8767	*)	dflt=$libperl
8768		;;
8769	esac
8770	cat << EOM
8771
8772I need to select a good name for the shared libperl.  If your system uses
8773library names with major and minor numbers, then you might want something
8774like $majmin.  Alternatively, if your system uses a single version
8775number for shared libraries, then you might want to use $majonly.
8776Or, your system might be quite happy with a simple libperl.$so.
8777
8778Since the shared libperl will get installed into a version-specific
8779architecture-dependent directory, the version number of the shared perl
8780library probably isn't important, so the default should be o.k.
8781
8782EOM
8783	rp='What name do you want to give to the shared libperl?'
8784	. ./myread
8785	libperl=$ans
8786	echo "Ok, I'll use $libperl"
8787	;;
8788*)
8789	libperl="libperl${_a}"
8790	;;
8791esac
8792
8793# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8794case "$shrpdir" in
8795'') ;;
8796*)	$cat >&4 <<EOM
8797WARNING:  Use of the shrpdir variable for the installation location of
8798the shared $libperl is not supported.  It was never documented and
8799will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8800know of any problems this may cause.
8801
8802EOM
8803	case "$shrpdir" in
8804	"$archlibexp/CORE")
8805		$cat >&4 <<EOM
8806But your current setting of $shrpdir is
8807the default anyway, so it's harmless.
8808EOM
8809		;;
8810	*)
8811		$cat >&4 <<EOM
8812Further, your current attempted setting of $shrpdir
8813conflicts with the value of $archlibexp/CORE
8814that installperl will use.
8815EOM
8816		;;
8817	esac
8818	;;
8819esac
8820
8821# How will the perl executable find the installed shared $libperl?
8822# Add $xxx to ccdlflags.
8823# If we can't figure out a command-line option, use $shrpenv to
8824# set env LD_RUN_PATH.  The main perl makefile uses this.
8825shrpdir=$archlibexp/CORE
8826xxx=''
8827tmp_shrpenv=''
8828if "$useshrplib"; then
8829    case "$osname" in
8830	aix)
8831		# We'll set it in Makefile.SH...
8832		;;
8833	solaris)
8834		xxx="-R $shrpdir"
8835		;;
8836	freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8837		xxx="-Wl,-R$shrpdir"
8838		;;
8839	bsdos|linux|irix*|dec_osf|gnu*|haiku)
8840		xxx="-Wl,-rpath,$shrpdir"
8841		;;
8842	hpux*)
8843		# hpux doesn't like the default, either.
8844		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8845		;;
8846	cygwin)
8847		# cygwin needs only ldlibpth
8848		;;
8849	*)
8850		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8851		;;
8852	esac
8853	case "$xxx" in
8854	'') ;;
8855	*)
8856		# Only add $xxx if it isn't already in ccdlflags.
8857		case " $ccdlflags " in
8858		*" $xxx "*)	;;
8859		*)	ccdlflags="$ccdlflags $xxx"
8860			cat <<EOM >&4
8861
8862Adding $xxx to the flags
8863passed to $ld so that the perl executable will find the
8864installed shared $libperl.
8865
8866EOM
8867			;;
8868		esac
8869		;;
8870	esac
8871fi
8872# Fix ccdlflags in AIX for building external extensions.
8873# (For building Perl itself bare -bE:perl.exp is needed,
8874#  Makefile.SH takes care of this.)
8875case "$osname" in
8876aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8877esac
8878# Respect a hint or command-line value.
8879case "$shrpenv" in
8880'') shrpenv="$tmp_shrpenv" ;;
8881esac
8882case "$ldlibpthname" in
8883'')	ldlibpthname=LD_LIBRARY_PATH ;;
8884none)	ldlibpthname='' ;;
8885esac
8886
8887: determine where manual pages are on this system
8888echo " "
8889case "$sysman" in
8890'')
8891	syspath='/usr/share/man/man1 /usr/man/man1'
8892	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8893	syspath="$syspath /usr/man/u_man/man1"
8894	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8895	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8896	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8897	sysman=`./loc . /usr/man/man1 $syspath`
8898	;;
8899esac
8900if $test -d "$sysman"; then
8901	echo "System manual is in $sysman." >&4
8902else
8903	echo "Could not find manual pages in source form." >&4
8904fi
8905
8906: determine where manual pages go
8907set man1dir man1dir none
8908eval $prefixit
8909$cat <<EOM
8910
8911$spackage has manual pages available in source form.
8912EOM
8913case "$nroff" in
8914nroff)
8915	echo "However, you don't have nroff, so they're probably useless to you."
8916	case "$man1dir" in
8917	'') man1dir="none";;
8918	esac;;
8919esac
8920echo "If you don't want the manual sources installed, answer 'none'."
8921case "$man1dir" in
8922' ') dflt=none
8923	;;
8924'')
8925	lookpath="$prefixexp/share/man/man1"
8926	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8927	lookpath="$lookpath $prefixexp/man/p_man/man1"
8928	lookpath="$lookpath $prefixexp/man/u_man/man1"
8929	lookpath="$lookpath $prefixexp/man/man.1"
8930	case "$sysman" in
8931	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8932	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8933	esac
8934	set dflt
8935	eval $prefixup
8936	;;
8937*)  dflt="$man1dir"
8938	;;
8939esac
8940echo " "
8941fn=dn+~
8942rp="Where do the main $spackage manual pages (source) go?"
8943. ./getfile
8944if $test "X$man1direxp" != "X$ansexp"; then
8945	installman1dir=''
8946fi
8947prefixvar=man1dir
8948. ./setprefixvar
8949
8950case "$man1dir" in
8951'')	man1dir=' '
8952	installman1dir='';;
8953esac
8954
8955: What suffix to use on installed man pages
8956
8957case "$man1dir" in
8958' ')
8959	man1ext='0'
8960	;;
8961*)
8962	rp="What suffix should be used for the main $spackage man pages?"
8963	case "$man1ext" in
8964	'')	case "$man1dir" in
8965		*1)  dflt=1 ;;
8966		*1p) dflt=1p ;;
8967		*1pm) dflt=1pm ;;
8968		*l) dflt=l;;
8969		*n) dflt=n;;
8970		*o) dflt=o;;
8971		*p) dflt=p;;
8972		*C) dflt=C;;
8973		*L) dflt=L;;
8974		*L1) dflt=L1;;
8975		*) dflt=1;;
8976		esac
8977		;;
8978	*)	dflt="$man1ext";;
8979	esac
8980	. ./myread
8981	man1ext="$ans"
8982	;;
8983esac
8984
8985: see if we can have long filenames
8986echo " "
8987first=123456789abcdef
8988$rm -f $first
8989if (echo hi >$first) 2>/dev/null; then
8990	if $test -f 123456789abcde; then
8991		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8992		val="$undef"
8993	else
8994		echo 'You can have filenames longer than 14 characters.'>&4
8995		val="$define"
8996	fi
8997else
8998	$cat <<'EOM'
8999You can't have filenames longer than 14 chars.
9000You can't even think about them!
9001EOM
9002	val="$undef"
9003fi
9004set d_flexfnam
9005eval $setvar
9006$rm -rf 123456789abcde*
9007
9008: determine where library module manual pages go
9009set man3dir man3dir none
9010eval $prefixit
9011$cat <<EOM
9012
9013$spackage has manual pages for many of the library modules.
9014EOM
9015
9016case "$nroff" in
9017nroff)
9018	$cat <<'EOM'
9019However, you don't have nroff, so they're probably useless to you.
9020EOM
9021	case "$man3dir" in
9022	'') man3dir="none";;
9023	esac;;
9024esac
9025
9026case "$d_flexfnam" in
9027undef)
9028	$cat <<'EOM'
9029However, your system can't handle the long file names like File::Basename.3.
9030EOM
9031	case "$man3dir" in
9032	'') man3dir="none";;
9033	esac;;
9034esac
9035
9036echo "If you don't want the manual sources installed, answer 'none'."
9037prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9038case "$man3dir" in
9039'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9040	if $test -d "$privlib/man/man3"; then
9041		cat <<EOM >&4
9042
9043WARNING:  Previous versions of perl installed man3 pages into
9044$privlib/man/man3.  This version will suggest a
9045new default of $dflt.
9046EOM
9047		tdflt=$dflt
9048		dflt='n'
9049		rp='Do you wish to preserve the old behavior?(y/n)'
9050		. ./myread
9051		case "$ans" in
9052		y*) dflt="$privlib/man/man3" ;;
9053		*)  dflt=$tdflt ;;
9054		esac
9055    fi
9056	;;
9057*)	dflt="$man3dir" ;;
9058esac
9059case "$dflt" in
9060' ') dflt=none ;;
9061esac
9062echo " "
9063fn=dn+~
9064rp="Where do the $package library man pages (source) go?"
9065. ./getfile
9066prefixvar=man3dir
9067. ./setprefixvar
9068
9069case "$man3dir" in
9070'')	man3dir=' '
9071	installman3dir='';;
9072esac
9073
9074: What suffix to use on installed man pages
9075case "$man3dir" in
9076' ')
9077	man3ext='0'
9078	;;
9079*)
9080	rp="What suffix should be used for the $package library man pages?"
9081	case "$man3ext" in
9082	'')	case "$man3dir" in
9083		*3)  dflt=3 ;;
9084		*3p) dflt=3p ;;
9085		*3pm) dflt=3pm ;;
9086		*l) dflt=l;;
9087		*n) dflt=n;;
9088		*o) dflt=o;;
9089		*p) dflt=p;;
9090		*C) dflt=C;;
9091		*L) dflt=L;;
9092		*L3) dflt=L3;;
9093		*) dflt=3;;
9094		esac
9095		;;
9096	*)	dflt="$man3ext";;
9097	esac
9098	. ./myread
9099	man3ext="$ans"
9100	;;
9101esac
9102
9103: see if we have to deal with yellow pages, now NIS.
9104if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9105	case "$hostcat" in
9106	nidump*) ;;
9107	*)
9108		case "$hostcat" in
9109		*ypcat*) dflt=y;;
9110		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9111				dflt=y
9112			else
9113				dflt=n
9114			fi;;
9115		*) dflt=n;;
9116		esac
9117		echo " "
9118		rp='Are you getting the hosts file via yellow pages?'
9119		. ./myread
9120		case "$ans" in
9121		y*) hostcat='ypcat hosts';;
9122		*) hostcat='cat /etc/hosts';;
9123		esac
9124		;;
9125	esac
9126fi
9127case "$hostcat" in
9128'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9129esac
9130case "$groupcat" in
9131'') test -f /etc/group && groupcat='cat /etc/group';;
9132esac
9133case "$passcat" in
9134'') test -f /etc/passwd && passcat='cat /etc/passwd';;
9135esac
9136
9137: now get the host name
9138echo " "
9139echo "Figuring out host name..." >&4
9140case "$myhostname" in
9141'') cont=true
9142	echo 'Maybe "hostname" will work...'
9143	if tans=`sh -c hostname 2>&1` ; then
9144		myhostname=$tans
9145		phostname=hostname
9146		cont=''
9147	fi
9148	;;
9149*) cont='';;
9150esac
9151if $test "$cont"; then
9152	if ./xenix; then
9153		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9154		if tans=`cat /etc/systemid 2>&1` ; then
9155			myhostname=$tans
9156			phostname='cat /etc/systemid'
9157			echo "Whadyaknow.  Xenix always was a bit strange..."
9158			cont=''
9159		fi
9160	elif $test -r /etc/systemid; then
9161		echo "(What is a non-Xenix system doing with /etc/systemid?)"
9162	fi
9163fi
9164if $test "$cont"; then
9165	echo 'No, maybe "uuname -l" will work...'
9166	if tans=`sh -c 'uuname -l' 2>&1` ; then
9167		myhostname=$tans
9168		phostname='uuname -l'
9169	else
9170		echo 'Strange.  Maybe "uname -n" will work...'
9171		if tans=`sh -c 'uname -n' 2>&1` ; then
9172			myhostname=$tans
9173			phostname='uname -n'
9174		else
9175			echo 'Oh well, maybe I can mine it out of whoami.h...'
9176			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9177				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9178				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9179			else
9180				case "$myhostname" in
9181				'') echo "Does this machine have an identity crisis or something?"
9182					phostname='';;
9183				*)
9184					echo "Well, you said $myhostname before..."
9185					phostname='echo $myhostname';;
9186				esac
9187			fi
9188		fi
9189	fi
9190fi
9191case "$myhostname" in
9192'') myhostname=noname ;;
9193esac
9194: you do not want to know about this
9195set $myhostname
9196myhostname=$1
9197
9198: verify guess
9199if $test "$myhostname" ; then
9200	dflt=y
9201	rp='Your host name appears to be "'$myhostname'".'" Right?"
9202	. ./myread
9203	case "$ans" in
9204	y*) ;;
9205	*) myhostname='';;
9206	esac
9207fi
9208
9209: bad guess or no guess
9210while $test "X$myhostname" = X ; do
9211	dflt=''
9212	rp="Please type the (one word) name of your host:"
9213	. ./myread
9214	myhostname="$ans"
9215done
9216
9217: translate upper to lower if necessary
9218case "$myhostname" in
9219*[A-Z]*)
9220	echo "(Normalizing case in your host name)"
9221	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9222	;;
9223esac
9224
9225case "$myhostname" in
9226*.*)
9227	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9228	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9229	echo "(Trimming domain name from host name--host name is now $myhostname)"
9230	;;
9231*) case "$mydomain" in
9232	'')
9233		{
9234			test "X$hostcat" = "Xypcat hosts" &&
9235			ypmatch "$myhostname" hosts 2>/dev/null |\
9236				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
9237			$test -s hosts
9238		} || {
9239			test "X$hostcat" != "X" &&
9240			$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
9241					/[	 ]$myhostname[	. ]/p" > hosts
9242		}
9243		tmp_re="[	. ]"
9244		if $test -f hosts; then
9245			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
9246			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
9247			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9248				hosts | $sort | $uniq | \
9249				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9250			case `$echo X$dflt` in
9251			X*\ *)	echo "(Several hosts in the database matched hostname)"
9252				dflt=.
9253				;;
9254			X.) echo "(You do not have fully-qualified names in the hosts database)"
9255				;;
9256			esac
9257		else
9258			echo "(I cannot locate a hosts database anywhere)"
9259			dflt=.
9260		fi
9261		case "$dflt" in
9262		.)
9263			tans=`./loc resolv.conf X /etc /usr/etc`
9264			if $test -f "$tans"; then
9265				echo "(Attempting domain name extraction from $tans)"
9266				dflt=.`$sed -n -e 's/	/ /g' \
9267				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9268				  -e 1q 2>/dev/null`
9269				case "$dflt" in
9270				.) dflt=.`$sed -n -e 's/	/ /g' \
9271				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9272				     -e 1q 2>/dev/null`
9273					;;
9274				esac
9275			fi
9276			;;
9277		esac
9278		case "$dflt" in
9279		.) echo "(No help from resolv.conf either -- attempting clever guess)"
9280			dflt=.`sh -c domainname 2>/dev/null`
9281			case "$dflt" in
9282			'') dflt='.';;
9283			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9284			esac
9285			;;
9286		esac
9287		case "$dflt$osname" in
9288		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9289			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9290			;;
9291		esac
9292		case "$dflt" in
9293		.) echo "(Lost all hope -- silly guess then)"
9294			dflt='.nonet'
9295			;;
9296		esac
9297		$rm -f hosts
9298		;;
9299	*) dflt="$mydomain";;
9300	esac;;
9301esac
9302echo " "
9303rp="What is your domain name?"
9304. ./myread
9305tans="$ans"
9306case "$ans" in
9307'') ;;
9308.*) ;;
9309*) tans=".$tans";;
9310esac
9311mydomain="$tans"
9312
9313: translate upper to lower if necessary
9314case "$mydomain" in
9315*[A-Z]*)
9316	echo "(Normalizing case in your domain name)"
9317	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9318	;;
9319esac
9320
9321: a little sanity check here
9322case "$phostname" in
9323'') ;;
9324*)
9325	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9326	$myhostname$mydomain|$myhostname) ;;
9327	*)
9328		case "$phostname" in
9329		sed*)
9330			echo "(That doesn't agree with your whoami.h file, by the way.)"
9331			;;
9332		*)
9333			echo "(That doesn't agree with your $phostname command, by the way.)"
9334			;;
9335		esac
9336	;;
9337	esac
9338	;;
9339esac
9340
9341: determine the e-mail address of the user who is running us
9342$cat <<EOM
9343
9344I need to get your e-mail address in Internet format if possible, i.e.
9345something like user@host.domain. Please answer accurately since I have
9346no easy means to double check it. The default value provided below
9347is most probably close to reality but may not be valid from outside
9348your organization...
9349
9350EOM
9351cont=x
9352while test "$cont"; do
9353	case "$MAILDOMAIN" in
9354	'')
9355		if $test -s /etc/mailname; then
9356			maildomain=`$cat /etc/mailname`
9357		else
9358			maildomain="$myhostname$mydomain"
9359		fi
9360		;;
9361	*)  maildomain="$MAILDOMAIN";;
9362	esac
9363	case "$cf_email" in
9364	'') dflt="$cf_by@$maildomain";;
9365	*)  dflt="$cf_email";;
9366	esac
9367	rp='What is your e-mail address?'
9368	. ./myread
9369	cf_email="$ans"
9370	case "$cf_email" in
9371	*@*.*) cont='' ;;
9372	*)
9373		rp='Address does not look like an Internet one.  Use it anyway?'
9374		case "$fastread" in
9375		yes) dflt=y ;;
9376		*) dflt=n ;;
9377		esac
9378		. ./myread
9379		case "$ans" in
9380		y*) cont='' ;;
9381		*) echo " " ;;
9382		esac
9383		;;
9384	esac
9385done
9386
9387: Ask e-mail of administrator
9388$cat <<EOM
9389
9390If you or somebody else will be maintaining perl at your site, please
9391fill in the correct e-mail address here so that they may be contacted
9392if necessary. You may enter "none" for no administrator.
9393
9394EOM
9395case "$perladmin" in
9396'') dflt="$cf_email";;
9397*) dflt="$perladmin";;
9398esac
9399rp='Perl administrator e-mail address'
9400. ./myread
9401perladmin="$ans"
9402
9403: determine whether to use a version number suffix for installed binaries
9404echo " "
9405$cat <<EOM
9406Do you want to use a version number suffix for installed binaries? This
9407will install 'perl$version' instead of 'perl', and likewise for other
9408binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9409to be installed side-by-side. Unless you are a developer, you probably
9410do *not* want to do this.
9411EOM
9412case "$versiononly" in
9413"$define"|[Yy]*|true) dflt='y' ;;
9414*) dflt='n';
9415esac
9416rp="Do you want to use a version number suffix for installed binaries?"
9417. ./myread
9418case "$ans" in
9419[yY]*)	val="$define";;
9420*)	val="$undef" ;;
9421esac
9422set versiononly
9423eval $setvar
9424
9425case "$versiononly" in
9426"$define") inc_version_list=''
9427           inc_version_list_init=0
9428           ;;
9429esac
9430
9431: figure out how to guarantee perl startup
9432: XXX Note that this currently takes advantage of the bug that binexp ignores
9433:     the Configure -Dinstallprefix setting, which in turn means that under
9434:     relocatable @INC, initialinstalllocation is what binexp started as.
9435case "$startperl" in
9436'')
9437	case "$sharpbang" in
9438	*!)
9439		$cat <<EOH
9440
9441I can use the #! construct to start perl on your system. This will
9442make startup of perl scripts faster, but may cause problems if you
9443want to share those scripts and perl is not in a standard place
9444($initialinstalllocation/perl) on all your platforms. The alternative
9445is to force a shell by starting the script with a single ':' character.
9446
9447EOH
9448		case "$versiononly" in
9449		"$define")      dflt="$initialinstalllocation/perl$version";;
9450		*)              dflt="$initialinstalllocation/perl";;
9451		esac
9452		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9453		. ./myread
9454		case "$ans" in
9455		none)	startperl=": # use perl";;
9456		*)	startperl="#!$ans"
9457			if $test 30 -lt `echo "$ans" | wc -c`; then
9458				$cat >&4 <<EOM
9459
9460WARNING:  Some systems limit the #! command to 32 characters.
9461If you experience difficulty running Perl scripts with #!, try
9462installing Perl in a directory with a shorter pathname.
9463
9464EOM
9465			fi ;;
9466		esac
9467		;;
9468	*) startperl=": # use perl"
9469		;;
9470	esac
9471	;;
9472esac
9473echo "I'll use $startperl to start perl scripts."
9474
9475: figure best path for perl in scripts
9476case "$perlpath" in
9477'')
9478	case "$versiononly" in
9479	"$define")	perlpath="$initialinstalllocation/perl$version";;
9480	*)		perlpath="$initialinstalllocation/perl";;
9481	esac
9482	case "$startperl" in
9483	*!*) ;;
9484	*)
9485		$cat <<EOH
9486
9487I will use the "eval 'exec'" idiom to start Perl on your system.
9488I can use the full path of your Perl binary for this purpose, but
9489doing so may cause problems if you want to share those scripts and
9490Perl is not always in a standard place ($initialinstalllocation/perl).
9491
9492EOH
9493		dflt="$initialinstalllocation/perl"
9494		rp="What path shall I use in \"eval 'exec'\"?"
9495		. ./myread
9496		perlpath="$ans"
9497		;;
9498	esac
9499	;;
9500esac
9501case "$startperl" in
9502*!*)	;;
9503*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9504esac
9505
9506: determine where public executable scripts go
9507set scriptdir scriptdir
9508eval $prefixit
9509case "$scriptdir" in
9510'')
9511	dflt="$bin"
9512	: guess some guesses
9513	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9514	$test -d /usr/share/bin     && dflt=/usr/share/bin
9515	$test -d /usr/local/script  && dflt=/usr/local/script
9516	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9517	$test -d $prefixexp/script  && dflt=$prefixexp/script
9518	set dflt
9519	eval $prefixup
9520	;;
9521*)  dflt="$scriptdir"
9522	;;
9523esac
9524$cat <<EOM
9525
9526Some installations have a separate directory just for executable scripts so
9527that they can mount it across multiple architectures but keep the scripts in
9528one spot.  You might, for example, have a subdirectory of /usr/share for this.
9529Or you might just lump your scripts in with all your other executables.
9530
9531EOM
9532fn=d~
9533rp='Where do you keep publicly executable scripts?'
9534. ./getfile
9535if $test "X$ansexp" != "X$scriptdirexp"; then
9536	installscript=''
9537fi
9538installscriptdir=''
9539prefixvar=scriptdir
9540. ./setprefixvar
9541: A little fix up for an irregularly named variable.
9542installscript="$installscriptdir"
9543
9544: determine where add-on public executables go
9545case "$sitebin" in
9546'')	dflt=$siteprefix/bin ;;
9547*)	dflt=$sitebin ;;
9548esac
9549fn=d~
9550rp='Pathname where the add-on public executables should be installed?'
9551. ./getfile
9552prefixvar=sitebin
9553. ./setprefixvar
9554
9555: determine where add-on html pages go
9556: There is no standard location, so try to copy the previously-selected
9557: directory structure for the core html pages.
9558case "$sitehtml1dir" in
9559'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9560*)     dflt=$sitehtml1dir ;;
9561esac
9562case "$dflt" in
9563''|' ') dflt=none ;;
9564esac
9565fn=dn+~
9566rp='Pathname where the site-specific html pages should be installed?'
9567. ./getfile
9568prefixvar=sitehtml1dir
9569. ./setprefixvar
9570
9571: determine where add-on library html pages go
9572: There is no standard location, so try to copy the previously-selected
9573: directory structure for the core html pages.
9574case "$sitehtml3dir" in
9575'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9576*)     dflt=$sitehtml3dir ;;
9577esac
9578case "$dflt" in
9579''|' ') dflt=none ;;
9580esac
9581fn=dn+~
9582rp='Pathname where the site-specific library html pages should be installed?'
9583. ./getfile
9584prefixvar=sitehtml3dir
9585. ./setprefixvar
9586
9587: determine where add-on manual pages go
9588case "$siteman1dir" in
9589'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9590*)	dflt=$siteman1dir ;;
9591esac
9592case "$dflt" in
9593''|' ') dflt=none ;;
9594esac
9595fn=dn+~
9596rp='Pathname where the site-specific manual pages should be installed?'
9597. ./getfile
9598prefixvar=siteman1dir
9599. ./setprefixvar
9600
9601: determine where add-on library man pages go
9602case "$siteman3dir" in
9603'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9604*)	dflt=$siteman3dir ;;
9605esac
9606case "$dflt" in
9607''|' ') dflt=none ;;
9608esac
9609fn=dn+~
9610rp='Pathname where the site-specific library manual pages should be installed?'
9611. ./getfile
9612prefixvar=siteman3dir
9613. ./setprefixvar
9614
9615: determine where add-on public executable scripts go
9616case "$sitescript" in
9617'')	dflt=$siteprefix/script
9618	$test -d $dflt || dflt=$sitebin ;;
9619*)  dflt="$sitescript" ;;
9620esac
9621fn=d~+
9622rp='Pathname where add-on public executable scripts should be installed?'
9623. ./getfile
9624prefixvar=sitescript
9625. ./setprefixvar
9626
9627: see if backtrace exists
9628set backtrace d_backtrace
9629eval $inlibc
9630
9631: Check if C backtrace is actually supported.
9632case "$usecbacktrace" in
9633  "") usecbacktrace=$undef ;;
9634  [yY]*|true|$define)
9635    case "$d_backtrace" in
9636      [yY]*|true|$define)
9637        ;;
9638      *)
9639        echo "This system does not support backtrace" >&4
9640        usecbacktrace=$undef
9641        ;;
9642      esac
9643    ;;
9644  esac
9645
9646: Check if faststdio is requested and available
9647case "$usefaststdio" in
9648$define|true|[yY]*|'')
9649	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9650	case "$xversion" in
9651	[68])	dflt='y' ;;
9652	*)	dflt='n' ;;
9653	esac
9654	;;
9655*) dflt='n';;
9656esac
9657cat <<EOM
9658
9659Perl can be built to use 'fast stdio', which means using the stdio
9660library but also directly manipulating the stdio buffers to enable
9661faster I/O.  Using stdio is better for backward compatibility (especially
9662for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9663interface has been preferred instead of stdio.
9664
9665If this doesn't make any sense to you, just accept the default '$dflt'.
9666EOM
9667rp='Use the "fast stdio" if available?'
9668. ./myread
9669case "$ans" in
9670y|Y)	val="$define" ;;
9671*)      val="$undef" ;;
9672esac
9673set usefaststdio
9674eval $setvar
9675
9676: define an is-a-typedef? function
9677typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9678case "$inclist" in
9679"") inclist="sys/types.h";;
9680esac;
9681eval "varval=\$$var";
9682case "$varval" in
9683"")
9684	$rm -f temp.c;
9685	for inc in $inclist; do
9686		echo "#include <$inc>" >>temp.c;
9687	done;
9688	echo "#ifdef $type" >> temp.c;
9689	echo "printf(\"We have $type\");" >> temp.c;
9690	echo "#endif" >> temp.c;
9691	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9692	if $contains $type temp.E >/dev/null 2>&1; then
9693		eval "$var=\$type";
9694	else
9695		eval "$var=\$def";
9696	fi;
9697	$rm -f temp.?;;
9698*) eval "$var=\$varval";;
9699esac'
9700
9701: define an is-a-typedef? function that prompts if the type is not available.
9702typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9703case "$inclist" in
9704"") inclist="sys/types.h";;
9705esac;
9706eval "varval=\$$var";
9707case "$varval" in
9708"")
9709	$rm -f temp.c;
9710	for inc in $inclist; do
9711		echo "#include <$inc>" >>temp.c;
9712	done;
9713	echo "#ifdef $type" >> temp.c;
9714	echo "printf(\"We have $type\");" >> temp.c;
9715	echo "#endif" >> temp.c;
9716	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9717	echo " " ;
9718	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9719	if $contains $type temp.E >/dev/null 2>&1; then
9720		echo "$type found." >&4;
9721		eval "$var=\$type";
9722	else
9723		echo "$type NOT found." >&4;
9724		dflt="$def";
9725		. ./myread ;
9726		eval "$var=\$ans";
9727	fi;
9728	$rm -f temp.?;;
9729*) eval "$var=\$varval";;
9730esac'
9731
9732: see what type lseek is declared as in the kernel
9733rp="What is the type used for lseek's offset on this system?"
9734set off_t lseektype long stdio.h sys/types.h
9735eval $typedef_ask
9736
9737echo " "
9738echo "Checking to see how big your file offsets are..." >&4
9739$cat >try.c <<EOCP
9740#include <sys/types.h>
9741#include <stdio.h>
9742int main()
9743{
9744    printf("%d\n", (int)sizeof($lseektype));
9745    return(0);
9746}
9747EOCP
9748set try
9749if eval $compile_ok; then
9750	lseeksize=`$run ./try`
9751	echo "Your file offsets are $lseeksize bytes long."
9752else
9753	dflt=$longsize
9754	echo " "
9755	echo "(I can't seem to compile the test program.  Guessing...)"
9756	rp="What is the size of your file offsets (in bytes)?"
9757	. ./myread
9758	lseeksize="$ans"
9759fi
9760$rm_try
9761
9762: see what type file positions are declared as in the library
9763rp="What is the type for file position used by fsetpos()?"
9764set fpos_t fpostype long stdio.h sys/types.h
9765eval $typedef_ask
9766
9767: Check size for Fpos_t
9768echo " "
9769case "$fpostype" in
9770*_t) zzz="$fpostype"	;;
9771*)   zzz="fpos_t"	;;
9772esac
9773echo "Checking the size of $zzz..." >&4
9774cat > try.c <<EOCP
9775#include <sys/types.h>
9776#include <stdio.h>
9777#$i_stdlib I_STDLIB
9778#ifdef I_STDLIB
9779#include <stdlib.h>
9780#endif
9781int main() {
9782    printf("%d\n", (int)sizeof($fpostype));
9783    exit(0);
9784}
9785EOCP
9786set try
9787if eval $compile_ok; then
9788	yyy=`$run ./try`
9789	case "$yyy" in
9790	'')	fpossize=4
9791		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9792		;;
9793	*)	fpossize=$yyy
9794		echo "Your $zzz is $fpossize bytes long."
9795		;;
9796	esac
9797else
9798	dflt="$longsize"
9799	echo " " >&4
9800	echo "(I can't compile the test program.  Guessing...)" >&4
9801	rp="What is the size of your file positions (in bytes)?"
9802	. ./myread
9803	fpossize="$ans"
9804fi
9805
9806: Check for large file support
9807# Backward compatibility (uselfs is deprecated).
9808case "$uselfs" in
9809"$define"|true|[yY]*)
9810	cat <<EOM >&4
9811
9812*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9813EOM
9814	uselargefiles="$define"
9815	;;
9816esac
9817
9818case "$lseeksize:$fpossize" in
98198:8) cat <<EOM
9820
9821You can have files larger than 2 gigabytes.
9822EOM
9823   val="$define" ;;
9824*)    case "$uselargefiles" in
9825   "$undef"|false|[nN]*) dflt='n' ;;
9826   *)	dflt='y' ;;
9827   esac
9828   cat <<EOM
9829
9830Perl can be built to understand large files (files larger than 2 gigabytes)
9831on some systems.  To do so, Configure can be run with -Duselargefiles.
9832
9833If this doesn't make any sense to you, just accept the default '$dflt'.
9834EOM
9835   rp='Try to understand large files, if available?'
9836   . ./myread
9837   case "$ans" in
9838   y|Y)	val="$define" ;;
9839   *)	val="$undef"  ;;
9840   esac
9841   ;;
9842esac
9843set uselargefiles
9844eval $setvar
9845: Look for a hint-file generated 'call-back-unit'.  If the
9846: user has specified that a large files perl is to be built,
9847: we may need to set or change some other defaults.
9848if $test -f uselargefiles.cbu; then
9849	echo "Your platform has some specific hints regarding large file builds, using them..."
9850	. ./uselargefiles.cbu
9851fi
9852case "$uselargefiles" in
9853"$define")
9854	if $test -f uselargefiles.cbu; then
9855		echo " "
9856		echo "Rechecking to see how big your file offsets are..." >&4
9857		$cat >try.c <<EOCP
9858#include <sys/types.h>
9859#include <stdio.h>
9860int main()
9861{
9862    printf("%d\n", (int)sizeof($lseektype));
9863    return(0);
9864}
9865EOCP
9866		set try
9867		if eval $compile_ok; then
9868			lseeksize=`$run ./try`
9869			$echo "Your file offsets are now $lseeksize bytes long."
9870		else
9871			dflt="$lseeksize"
9872			echo " "
9873			echo "(I can't seem to compile the test program.  Guessing...)"
9874			rp="What is the size of your file offsets (in bytes)?"
9875			. ./myread
9876			lseeksize="$ans"
9877		fi
9878		case "$fpostype" in
9879		*_t) zzz="$fpostype"	;;
9880		*)   zzz="fpos_t"	;;
9881		esac
9882		$echo $n "Rechecking the size of $zzz...$c" >&4
9883		$cat > try.c <<EOCP
9884#include <sys/types.h>
9885#include <stdio.h>
9886#$i_stdlib I_STDLIB
9887#ifdef I_STDLIB
9888#include <stdlib.h>
9889#endif
9890int main() {
9891    printf("%d\n", (int)sizeof($fpostype));
9892    return(0);
9893}
9894EOCP
9895		set try
9896		if eval $compile_ok; then
9897			yyy=`$run ./try`
9898			dflt="$lseeksize"
9899			case "$yyy" in
9900			'')	echo " "
9901				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9902				;;
9903			*)	fpossize=$yyy
9904				echo " $fpossize bytes." >&4
9905				;;
9906			esac
9907		else
9908			dflt="$fpossize"
9909			echo " "
9910			echo "(I can't compile the test program.  Guessing...)" >&4
9911			rp="What is the size of your file positions (in bytes)?"
9912			. ./myread
9913			fpossize="$ans"
9914		fi
9915		$rm_try
9916	fi
9917	;;
9918esac
9919
9920: Check if we want perlio
9921useperlio="$define"
9922
9923: Set the vendorbin variables
9924case "$vendorprefix" in
9925'')	d_vendorbin="$undef"
9926	vendorbin=''
9927	vendorbinexp=''
9928	;;
9929*)	d_vendorbin="$define"
9930	: determine where vendor-supplied executables go.
9931	case "$vendorbin" in
9932	'') dflt=$vendorprefix/bin ;;
9933	*)	dflt="$vendorbin" ;;
9934	esac
9935	fn=d~+
9936	rp='Pathname for the vendor-supplied executables directory?'
9937	. ./getfile
9938	vendorbin="$ans"
9939	vendorbinexp="$ansexp"
9940	;;
9941esac
9942prefixvar=vendorbin
9943. ./installprefix
9944
9945: Set the vendorhtml1dir variables
9946case "$vendorprefix" in
9947'')	vendorhtml1dir=''
9948	vendorhtml1direxp=''
9949	;;
9950*)	: determine where vendor-supplied html pages go.
9951	: There is no standard location, so try to copy the previously-selected
9952	: directory structure for the core html pages.
9953	: XXX Better default suggestions would be welcome.
9954	case "$vendorhtml1dir" in
9955	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9956	*)	dflt=$vendorhtml1dir ;;
9957	esac
9958	case "$dflt" in
9959	''|' ') dflt=none ;;
9960	esac
9961	fn=dn+~
9962	rp='Pathname for the vendor-supplied html pages?'
9963	. ./getfile
9964	vendorhtml1dir="$ans"
9965	vendorhtml1direxp="$ansexp"
9966	;;
9967esac
9968: Use ' ' for none so value is preserved next time through Configure
9969$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9970prefixvar=vendorhtml1dir
9971. ./installprefix
9972
9973: Set the vendorhtml3dir variables
9974case "$vendorprefix" in
9975'')	vendorhtml3dir=''
9976	vendorhtml3direxp=''
9977	;;
9978*)	: determine where vendor-supplied module html pages go.
9979	: There is no standard location, so try to copy the previously-selected
9980	: directory structure for the core html pages.
9981	: XXX Better default suggestions would be welcome.
9982	case "$vendorhtml3dir" in
9983	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9984	*)	dflt=$vendorhtml3dir ;;
9985	esac
9986	case "$dflt" in
9987	''|' ') dflt=none ;;
9988	esac
9989	fn=dn+~
9990	rp='Pathname for the vendor-supplied html pages?'
9991	. ./getfile
9992	vendorhtml3dir="$ans"
9993	vendorhtml3direxp="$ansexp"
9994	;;
9995esac
9996: Use ' ' for none so value is preserved next time through Configure
9997$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9998prefixvar=vendorhtml3dir
9999. ./installprefix
10000
10001: Set the vendorman1dir variables
10002case "$vendorprefix" in
10003'')	vendorman1dir=''
10004	vendorman1direxp=''
10005	;;
10006*)	: determine where vendor-supplied manual pages go.
10007	case "$vendorman1dir" in
10008	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10009	*)	dflt=$vendorman1dir ;;
10010	esac
10011	case "$dflt" in
10012	''|' ') dflt=none ;;
10013	esac
10014	fn=nd~+
10015	rp='Pathname for the vendor-supplied manual section 1 pages?'
10016	. ./getfile
10017	vendorman1dir="$ans"
10018	vendorman1direxp="$ansexp"
10019	;;
10020esac
10021: Use ' ' for none so value is preserved next time through Configure
10022$test X"$vendorman1dir" = "X" && vendorman1dir=' '
10023prefixvar=vendorman1dir
10024. ./installprefix
10025
10026: Set the vendorman3dir variables
10027case "$vendorprefix" in
10028'')	vendorman3dir=''
10029	vendorman3direxp=''
10030	;;
10031*)	: determine where vendor-supplied module manual pages go.
10032	case "$vendorman3dir" in
10033	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10034	*)	dflt=$vendorman3dir ;;
10035	esac
10036	case "$dflt" in
10037	''|' ') dflt=none ;;
10038	esac
10039	fn=nd~+
10040	rp='Pathname for the vendor-supplied manual section 3 pages?'
10041	. ./getfile
10042	vendorman3dir="$ans"
10043	vendorman3direxp="$ansexp"
10044	;;
10045esac
10046: Use ' ' for none so value is preserved next time through Configure
10047$test X"$vendorman3dir" = "X" && vendorman3dir=' '
10048prefixvar=vendorman3dir
10049. ./installprefix
10050
10051: Set the vendorscript variables
10052case "$vendorprefix" in
10053'')	d_vendorscript="$undef"
10054	vendorscript=''
10055	vendorscriptexp=''
10056	;;
10057*)	d_vendorscript="$define"
10058	: determine where vendor-supplied scripts go.
10059	case "$vendorscript" in
10060	'')	dflt=$vendorprefix/script
10061		$test -d $dflt || dflt=$vendorbin ;;
10062	*)  dflt="$vendorscript" ;;
10063	esac
10064	$cat <<EOM
10065
10066The installation process will create a directory for
10067vendor-supplied scripts.
10068
10069EOM
10070	fn=d~+
10071	rp='Pathname for the vendor-supplied scripts directory?'
10072	. ./getfile
10073	vendorscript="$ans"
10074	vendorscriptexp="$ansexp"
10075	;;
10076esac
10077prefixvar=vendorscript
10078. ./installprefix
10079
10080: see if qgcvt exists
10081set qgcvt d_qgcvt
10082eval $inlibc
10083
10084: Check what kind of doubles your system has
10085$echo "Checking the kind of doubles you have..." >&4
10086$cat >try.c <<EOP
10087#$i_stdlib I_STDLIB
10088#define DOUBLESIZE $doublesize
10089#ifdef I_STDLIB
10090#include <stdlib.h>
10091#endif
10092#include <stdio.h>
10093static const double d = -0.1;
10094int main() {
10095  unsigned const char* b = (unsigned const char*)(&d);
10096#if DOUBLESIZE == 4
10097  if (b[0] == 0xCD && b[3] == 0xBD) {
10098    /* IEEE 754 32-bit little-endian */
10099    printf("1\n");
10100    exit(0);
10101  }
10102  if (b[0] == 0xBD && b[3] == 0xCD) {
10103    /* IEEE 754 32-bit big-endian */
10104    printf("2\n");
10105    exit(0);
10106  }
10107  if (b[0] == 0xCC && b[3] == 0xCC) {
10108    /* VAX format F, 32-bit PDP-style mixed endian. */
10109    printf("9\n");
10110    exit(0);
10111  }
10112  if (b[0] == 0xC0 && b[3] == 0x9A) {
10113    /* IBM single 32-bit */
10114    printf("12\n");
10115    exit(0);
10116  }
10117#endif
10118#if DOUBLESIZE == 8
10119  if (b[0] == 0x9A && b[7] == 0xBF) {
10120    /* IEEE 754 64-bit little-endian */
10121    printf("3\n");
10122    exit(0);
10123  }
10124  if (b[0] == 0xBF && b[7] == 0x9A) {
10125    /* IEEE 754 64-bit big-endian */
10126    printf("4\n");
10127    exit(0);
10128  }
10129  if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10130   /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10131    * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10132    * 99 99 b9 bf 9a 99 99 99 */
10133    printf("7\n");
10134    exit(0);
10135  }
10136  if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10137   /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10138    * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10139    * 99 99 99 9a bf b9 99 99 */
10140    printf("8\n");
10141    exit(0);
10142  }
10143  if (b[0] == 0xCC && b[7] == 0xCC) {
10144   /* VAX format D, 64-bit PDP-style mixed endian. */
10145    printf("10\n");
10146    exit(0);
10147  }
10148  if (b[0] == 0xD9 && b[7] == 0x99) {
10149   /* VAX format G, 64-bit PDP-style mixed endian. */
10150    printf("11\n");
10151    exit(0);
10152  }
10153  if (b[0] == 0xC0 && b[7] == 0x9A) {
10154    /* IBM double 64-bit */
10155    printf("13\n");
10156    exit(0);
10157  }
10158  if (b[0] == 0xBF && b[7] == 0xCD) {
10159    /* CRAY single 64-bit */
10160    printf("14\n");
10161    exit(0);
10162  }
10163#endif
10164#if DOUBLESIZE == 16
10165  if (b[0] == 0x9A && b[15] == 0xBF) {
10166    /* IEEE 754 128-bit little-endian */
10167    printf("5\n");
10168    exit(0);
10169  }
10170  if (b[0] == 0xBF && b[15] == 0x9A) {
10171    /* IEEE 754 128-bit big-endian */
10172    printf("6\n");
10173    exit(0);
10174  }
10175#endif
10176  /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10177   * Whether those environments can still build Perl is debatable. */
10178  printf("-1\n"); /* unknown */
10179  exit(0);
10180}
10181EOP
10182set try
10183if eval $compile; then
10184    doublekind=`$run ./try`
10185else
10186    doublekind=-1
10187fi
10188case "$doublekind" in
101891) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
101902) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
101913) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
101924) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
101935) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
101946) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
101957) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
101968) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
101979) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
1019810) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
1019911) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
1020012) echo "You have IBM short 32-bit doubles." >&4 ;;
1020113) echo "You have IBM long 64-bit doubles." >&4 ;;
1020214) echo "You have Cray single 64-bit doubles." >&4 ;;
10203*) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10204esac
10205d_double_style_ieee=$undef
10206d_double_style_vax=$undef
10207d_double_style_ibm=$undef
10208d_double_style_cray=$undef
10209case "$doublekind" in
102101|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
102119|10|11) d_double_style_vax=$define ;;
1021212|13) d_double_style_ibm=$define ;;
1021314) d_double_style_cray=$define ;;
10214esac
10215case "$d_double_style_ieee" in
10216$define)
10217    d_double_has_inf=$define
10218    d_double_has_nan=$define
10219    d_double_has_negative_zero=$define
10220    d_double_has_subnormals=$define
10221    ;;
10222*)
10223    d_double_has_inf=$undef
10224    d_double_has_nan=$undef
10225    d_double_has_negative_zero=$undef
10226    d_double_has_subnormals=$undef
10227    ;;
10228esac
10229$rm_try
10230
10231: Check print/scan long double stuff
10232echo " "
10233
10234if $test X"$d_longdbl" = X"$define"; then
10235
10236echo "Checking how to print long doubles..." >&4
10237
10238if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10239	$cat >try.c <<'EOCP'
10240#include <sys/types.h>
10241#include <stdio.h>
10242int main() {
10243  double d = 123.456;
10244  printf("%.3f\n", d);
10245}
10246EOCP
10247	set try
10248	if eval $compile; then
10249		yyy=`$run ./try`
10250		case "$yyy" in
10251		123.456)
10252			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10253			sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10254			echo "We will use %f."
10255			;;
10256		esac
10257	fi
10258fi
10259
10260if $test X"$sPRIfldbl" = X; then
10261	$cat >try.c <<'EOCP'
10262#include <sys/types.h>
10263#include <stdio.h>
10264int main() {
10265  long double d = 123.456;
10266  printf("%.3Lf\n", d);
10267}
10268EOCP
10269	set try
10270	if eval $compile; then
10271		yyy=`$run ./try`
10272		case "$yyy" in
10273		123.456)
10274			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10275			sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10276			echo "We will use %Lf."
10277			;;
10278		esac
10279	fi
10280fi
10281
10282if $test X"$sPRIfldbl" = X; then
10283	$cat >try.c <<'EOCP'
10284#include <sys/types.h>
10285#include <stdio.h>
10286int main() {
10287  long double d = 123.456;
10288  printf("%.3llf\n", d);
10289}
10290EOCP
10291	set try
10292	if eval $compile; then
10293		yyy=`$run ./try`
10294		case "$yyy" in
10295		123.456)
10296			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10297			sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10298			echo "We will use %llf."
10299			;;
10300		esac
10301	fi
10302fi
10303
10304if $test X"$sPRIfldbl" = X; then
10305	$cat >try.c <<'EOCP'
10306#include <sys/types.h>
10307#include <stdio.h>
10308int main() {
10309  long double d = 123.456;
10310  printf("%.3lf\n", d);
10311}
10312EOCP
10313	set try
10314	if eval $compile; then
10315		yyy=`$run ./try`
10316		case "$yyy" in
10317		123.456)
10318			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10319			sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10320			echo "We will use %lf."
10321			;;
10322		esac
10323	fi
10324fi
10325
10326if $test X"$sPRIfldbl" = X; then
10327	echo "Cannot figure out how to print long doubles." >&4
10328else
10329	sSCNfldbl=$sPRIfldbl	# expect consistency
10330fi
10331
10332$rm_try
10333
10334fi # d_longdbl
10335
10336case "$sPRIfldbl" in
10337'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10338	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10339	d_SCNfldbl="$undef";
10340	;;
10341*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10342	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10343	d_SCNfldbl="$define";
10344	;;
10345esac
10346
10347: Before committing on uselongdouble, see whether that looks sane.
10348if $test "$uselongdouble" = "$define"; then
10349    message=""
10350    echo " "
10351    echo "Checking if your long double math functions work right..." >&4
10352    $cat > try.c <<EOF
10353#include <math.h>
10354#include <stdio.h>
10355int main() {
10356  printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10357}
10358EOF
10359    case "$osname:$gccversion" in
10360    aix:)	saveccflags="$ccflags"
10361		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10362    esac
10363    set try
10364    if eval $compile_ok; then
10365      yyy=`$run ./try`
10366    fi
10367    case "$yyy" in
10368    3) echo "Your long double math functions are working correctly." >&4 ;;
10369    *) echo "Your long double math functions are broken, not using long doubles." >&4
10370       uselongdouble=$undef
10371       ;;
10372    esac
10373    $rm_try
10374    case "$osname:$gccversion" in
10375    aix:)	ccflags="$saveccflags" ;; # restore
10376    esac
10377fi
10378
10379: Check how to convert floats to strings.
10380
10381if test "X$d_Gconvert" = X; then
10382
10383echo " "
10384echo "Checking for an efficient way to convert floats to strings."
10385echo " " > try.c
10386case "$uselongdouble" in
10387"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10388esac
10389case "$d_longdbl" in
10390"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10391esac
10392case "$d_PRIgldbl" in
10393"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10394esac
10395$cat >>try.c <<EOP
10396#ifdef TRY_gconvert
10397#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10398const char *myname = "gconvert";
10399#endif
10400#ifdef TRY_gcvt
10401#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10402const char *myname = "gcvt";
10403#endif
10404#ifdef TRY_qgcvt
10405#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10406const char *myname = "qgcvt";
10407#define DOUBLETYPE long double
10408#endif
10409#ifdef TRY_sprintf
10410#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10411#ifdef HAS_PRIgldbl
10412#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10413#else
10414#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10415#endif
10416#else
10417#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10418#endif
10419const char *myname = "sprintf";
10420#endif
10421
10422#ifndef DOUBLETYPE
10423#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10424#define DOUBLETYPE long double
10425#else
10426#define DOUBLETYPE double
10427#endif
10428#endif
10429
10430#include <stdio.h>
10431
10432#$i_stdlib I_STDLIB
10433#ifdef I_STDLIB
10434#include <stdlib.h>
10435#endif
10436#include <string.h>
10437
10438void checkit(const char *expect, char *got)
10439{
10440    if (strcmp(expect, got)) {
10441		printf("%s oddity:  Expected %s, got %s\n",
10442			myname, expect, got);
10443		exit(1);
10444	}
10445}
10446
10447void lencheck(int expect, int got)
10448{
10449    if (expect != got) {
10450		printf("%s length mismatch:  Expected %d, got %d\n",
10451			myname, expect, got);
10452		exit(1);
10453	}
10454}
10455
10456int main()
10457{
10458	char buf[64];
10459	buf[63] = '\0';
10460
10461	/* This must be 1st test on (which?) platform */
10462	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10463	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10464	checkit("0.1", buf);
10465
10466	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10467	checkit("0.01", buf);
10468
10469	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10470	checkit("0.001", buf);
10471
10472	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10473	checkit("0.0001", buf);
10474
10475	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10476	if (strlen(buf) > 5)
10477	    checkit("9e-005", buf); /* for Microsoft ?? */
10478	else
10479	    checkit("9e-05", buf);
10480
10481	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10482	checkit("1", buf);
10483
10484	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10485	checkit("1.1", buf);
10486
10487	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10488	checkit("1.01", buf);
10489
10490	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10491	checkit("1.001", buf);
10492
10493	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10494	checkit("1.0001", buf);
10495
10496	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10497	checkit("1.00001", buf);
10498
10499	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10500	checkit("1.000001", buf);
10501
10502	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10503	checkit("0", buf);
10504
10505	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10506	checkit("-1", buf);
10507
10508	/* Some Linux gcvt's give 1.e+5 here. */
10509	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10510	checkit("100000", buf);
10511
10512	/* Some Linux gcvt's give -1.e+5 here. */
10513	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10514	checkit("-100000", buf);
10515
10516	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10517	checkit("123.456", buf);
10518
10519	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10520	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10521	/* 34 should be enough to scare even long double
10522	 * places into using the e notation. */
10523	if (strlen(buf) > 5)
10524	    checkit("1e+034", buf); /* for Microsoft */
10525	else
10526	    checkit("1e+34", buf);
10527
10528	/* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
10529	 * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10530
10531	Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10532	lencheck(55, (int)strlen(buf));
10533
10534	/* For Perl, if you add additional tests here, also add them to
10535	 * t/base/num.t for benefit of platforms not using Configure or
10536	 * overriding d_Gconvert */
10537
10538	exit(0);
10539}
10540EOP
10541: first add preferred functions to our list
10542xxx_list=""
10543for xxx_convert in $gconvert_preference; do
10544    case $xxx_convert in
10545    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10546    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10547    esac
10548done
10549: then add any others
10550for xxx_convert in gconvert gcvt sprintf; do
10551    case "$xxx_list" in
10552    *$xxx_convert*) ;;
10553    *) xxx_list="$xxx_list $xxx_convert" ;;
10554    esac
10555done
10556
10557case "$d_longdbl$uselongdouble" in
10558"$define$define")
10559    : again, add preferred functions to our list first
10560    xxx_ld_list=""
10561    for xxx_convert in $gconvert_ld_preference; do
10562        case $xxx_convert in
10563        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10564        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10565        esac
10566    done
10567    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10568    for xxx_convert in qgcvt sprintf $xxx_list; do
10569        case "$xxx_ld_list" in
10570        $xxx_convert*|*" $xxx_convert"*) ;;
10571        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10572        esac
10573    done
10574    : if sprintf cannot do long doubles, move it to the end
10575    if test "$d_PRIgldbl" != "$define"; then
10576        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10577    fi
10578    : if no qgcvt, remove it
10579    if test "$d_qgcvt" != "$define"; then
10580        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10581    fi
10582    : use the ld_list
10583    xxx_list="$xxx_ld_list"
10584    ;;
10585esac
10586
10587for xxx_convert in $xxx_list; do
10588	echo "Trying $xxx_convert..."
10589	$rm -f try try$_o core
10590	set try -DTRY_$xxx_convert
10591	if eval $compile; then
10592		echo "$xxx_convert() found." >&4
10593		if $run ./try; then
10594			echo "I'll use $xxx_convert to convert floats into a string." >&4
10595			break;
10596		else
10597			echo "...But $xxx_convert didn't work as I expected."
10598			xxx_convert=''
10599		fi
10600	else
10601		echo "$xxx_convert NOT found." >&4
10602		xxx_convert=''
10603	fi
10604done
10605
10606if test X$xxx_convert = X; then
10607    echo "*** WHOA THERE!!! ***" >&4
10608    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10609    xxx_convert=sprintf
10610fi
10611
10612case "$xxx_convert" in
10613gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10614gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10615qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10616*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10617   "$define$define$define")
10618      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10619   "$define$define$undef")
10620      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10621   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10622   esac
10623   ;;
10624esac
10625
10626fi
10627$rm_try
10628
10629: see if _fwalk exists
10630set fwalk d__fwalk
10631eval $inlibc
10632
10633: see if accept4 exists
10634set accept4 d_accept4
10635eval $inlibc
10636
10637: Initialize h_fcntl
10638h_fcntl=false
10639
10640: Initialize h_sysfile
10641h_sysfile=false
10642
10643: access call always available on UNIX
10644set access d_access
10645eval $inlibc
10646
10647: locate the flags for 'access()'
10648case "$d_access" in
10649"$define")
10650	echo " "
10651	$cat >access.c <<EOCP
10652#include <sys/types.h>
10653#ifdef I_FCNTL
10654#include <fcntl.h>
10655#endif
10656#ifdef I_SYS_FILE
10657#include <sys/file.h>
10658#endif
10659#ifdef I_UNISTD
10660#include <unistd.h>
10661#endif
10662#$i_stdlib I_STDLIB
10663#ifdef I_STDLIB
10664#include <stdlib.h>
10665#endif
10666int main() {
10667	exit(R_OK);
10668}
10669EOCP
10670	: check sys/file.h first, no particular reason here
10671	if $test `./findhdr sys/file.h` && \
10672		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10673		h_sysfile=true;
10674		echo "<sys/file.h> defines the *_OK access constants." >&4
10675	elif $test `./findhdr fcntl.h` && \
10676		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10677		h_fcntl=true;
10678		echo "<fcntl.h> defines the *_OK access constants." >&4
10679	elif $test `./findhdr unistd.h` && \
10680		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10681		echo "<unistd.h> defines the *_OK access constants." >&4
10682	else
10683		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10684	fi
10685	;;
10686esac
10687$rm -f access*
10688
10689: see if accessx exists
10690set accessx d_accessx
10691eval $inlibc
10692
10693: see if acosh exists
10694set acosh d_acosh
10695eval $inlibc
10696
10697: see if aintl exists
10698set aintl d_aintl
10699eval $inlibc
10700
10701: see if alarm exists
10702set alarm d_alarm
10703eval $inlibc
10704
10705: see if 64bit time functions exists
10706
10707set ctime64 d_ctime64
10708eval $inlibc
10709
10710set localtime64 d_localtime64
10711eval $inlibc
10712
10713set gmtime64 d_gmtime64
10714eval $inlibc
10715
10716set mktime64 d_mktime64
10717eval $inlibc
10718
10719set difftime64 d_difftime64
10720eval $inlibc
10721
10722set asctime64 d_asctime64
10723eval $inlibc
10724
10725: see if POSIX threads are available
10726set pthread.h i_pthread
10727eval $inhdr
10728
10729: define a function to check prototypes
10730$cat > protochk <<EOSH
10731$startsh
10732cc="$cc"
10733optimize="$optimize"
10734ccflags="$ccflags"
10735define="$define"
10736rm_try="$rm_try"
10737usethreads=$usethreads
10738i_pthread=$i_pthread
10739pthread_h_first=$pthread_h_first
10740EOSH
10741
10742$cat >> protochk <<'EOSH'
10743
10744$rm_try
10745foo="$1"
10746shift
10747while test $# -ge 2; do
10748	case "$1" in
10749		$define) echo "#include <$2>" >> try.c ;;
10750		literal) echo "$2" >> try.c ;;
10751	esac
10752    # Extra magic for the benefit of systems that need pthread.h
10753    # to be included early to correctly detect threadsafe functions.
10754    # Such functions must guarantee themselves, though, that the usethreads
10755    # and i_pthread have been defined, before calling protochk.
10756    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10757	echo "#include <pthread.h>" >> try.c
10758	pthread_h_done=yes
10759    fi
10760    shift 2
10761done
10762cat >> try.c <<'EOCP'
10763#define _(args) args
10764EOCP
10765echo "$foo" >> try.c
10766echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10767$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10768status=$?
10769$rm_try
10770exit $status
10771EOSH
10772chmod +x protochk
10773$eunicefix protochk
10774
10775: Define hasproto macro for Configure internal use
10776hasproto='varname=$1; func=$2; shift; shift;
10777while $test $# -ge 2; do
10778	case "$1" in
10779	$define) echo "#include <$2>";;
10780	literal) echo "$2" ;;
10781	esac ;
10782    shift 2;
10783done > try.c;
10784$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10785if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10786	echo "$func() prototype found.";
10787	val="$define";
10788else
10789	echo "$func() prototype NOT found.";
10790	val="$undef";
10791fi;
10792set $varname;
10793eval $setvar;
10794$rm_try tryout.c'
10795
10796: see if sys/types.h has to be included
10797set sys/types.h i_systypes
10798eval $inhdr
10799
10800: see if sys/select.h has to be included
10801set sys/select.h i_sysselct
10802eval $inhdr
10803
10804: Define hasfield macro for Configure internal use
10805hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10806while $test $# -ge 2; do
10807	case "$1" in
10808	$define) echo "#include <$2>";;
10809	esac ;
10810    shift 2;
10811done > try.c;
10812echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10813set try;
10814if eval $compile; then
10815	val="$define";
10816else
10817	val="$undef";
10818fi;
10819set $varname;
10820eval $setvar;
10821$rm_try'
10822
10823: see if we should include sys/time.h
10824echo " "
10825i_time='define'
10826if test "X$timeincl" = X; then
10827	echo "Testing to see if we should include <sys/time.h>." >&4
10828	$echo $n "I'm now running the test program...$c"
10829	$cat >try.c <<EOCP
10830#include <sys/types.h>
10831#include <time.h>
10832#ifdef I_SYSTIME
10833#ifdef SYSTIMEKERNEL
10834#define KERNEL
10835#endif
10836#include <sys/time.h>
10837#endif
10838#ifdef I_SYSSELECT
10839#include <sys/select.h>
10840#endif
10841#$i_stdlib I_STDLIB
10842#ifdef I_STDLIB
10843#include <stdlib.h>
10844#endif
10845int main()
10846{
10847	struct tm foo;
10848#ifdef S_TIMEVAL
10849	struct timeval bar;
10850#endif
10851#ifdef S_TIMEZONE
10852	struct timezone tzp;
10853#endif
10854	if (foo.tm_sec == foo.tm_sec)
10855		exit(0);
10856#ifdef S_TIMEVAL
10857	if (bar.tv_sec == bar.tv_sec)
10858		exit(0);
10859#endif
10860	exit(1);
10861}
10862EOCP
10863	flags=''
10864	for s_timezone in '-DS_TIMEZONE' ''; do
10865	sysselect=''
10866	for s_timeval in '-DS_TIMEVAL' ''; do
10867	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10868	for i_systime in '-DI_SYSTIME' ''; do
10869		case "$flags" in
10870		'') $echo $n ".$c"
10871			set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10872			if eval $compile; then
10873				set X $i_systime $i_systimek $sysselect $s_timeval
10874				shift
10875				flags="$*"
10876				echo " "
10877				$echo $n "Succeeded with $flags$c"
10878			fi
10879			;;
10880		esac
10881	done
10882	done
10883	done
10884	done
10885	timeincl=''
10886	echo " "
10887	case "$flags" in
10888	*SYSTIMEKERNEL*) i_systimek="$define"
10889		timeincl=`./findhdr sys/time.h`
10890		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10891	*) i_systimek="$undef";;
10892	esac
10893	case "$flags" in
10894	*I_SYSTIME*) i_systime="$define"
10895		timeincl=`./findhdr sys/time.h`" $timeincl"
10896		echo "We'll include <sys/time.h>." >&4;;
10897	*) i_systime="$undef";;
10898	esac
10899	$rm_try
10900fi
10901: see if struct tm knows about tm_zone
10902case "$i_systime$i_time" in
10903*$define*)
10904        echo " "
10905        echo "Checking to see if your struct tm has tm_zone field..." >&4
10906        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10907        eval $hasfield
10908        ;;
10909*)      val="$undef"
10910        set d_tm_tm_zone
10911        eval $setvar
10912        ;;
10913esac
10914case "$d_tm_tm_zone" in
10915"$define")      echo "Yes, it does."   ;;
10916*)              echo "No, it doesn't." ;;
10917esac
10918: see if struct tm knows about tm_gmtoff
10919case "$i_systime$i_time" in
10920*$define*)
10921        echo " "
10922        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10923        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10924        eval $hasfield
10925        ;;
10926*)      val="$undef"
10927        set d_tm_tm_gmtoff
10928        eval $setvar
10929        ;;
10930esac
10931case "$d_tm_tm_gmtoff" in
10932"$define")      echo "Yes, it does."   ;;
10933*)              echo "No, it doesn't." ;;
10934esac
10935
10936: see if asctime_r exists
10937set asctime_r d_asctime_r
10938eval $inlibc
10939case "$d_asctime_r" in
10940"$define")
10941	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10942	case "$d_asctime_r_proto:$usethreads" in
10943	":define")	d_asctime_r_proto=define
10944		set d_asctime_r_proto asctime_r $hdrs
10945		eval $hasproto ;;
10946	*)	;;
10947	esac
10948	case "$d_asctime_r_proto" in
10949	define)
10950	case "$asctime_r_proto" in
10951	''|0) try='char* asctime_r(const struct tm*, char*);'
10952	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10953	esac
10954	case "$asctime_r_proto" in
10955	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10956	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10957	esac
10958	case "$asctime_r_proto" in
10959	''|0) try='int asctime_r(const struct tm*, char*);'
10960	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10961	esac
10962	case "$asctime_r_proto" in
10963	''|0) try='int asctime_r(const struct tm*, char*, int);'
10964	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10965	esac
10966	case "$asctime_r_proto" in
10967	''|0)	d_asctime_r=undef
10968		asctime_r_proto=0
10969		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10970	* )	case "$asctime_r_proto" in
10971		REENTRANT_PROTO*) ;;
10972		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10973		esac
10974		echo "Prototype: $try" ;;
10975	esac
10976	;;
10977	*)	case "$usethreads" in
10978		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10979		esac
10980		d_asctime_r=undef
10981		asctime_r_proto=0
10982		;;
10983	esac
10984	;;
10985*)	asctime_r_proto=0
10986	;;
10987esac
10988
10989: see if asinh exists
10990set asinh d_asinh
10991eval $inlibc
10992
10993: see if atanh exists
10994set atanh d_atanh
10995eval $inlibc
10996
10997: see if atolf exists
10998set atolf d_atolf
10999eval $inlibc
11000
11001: see if atoll exists
11002set atoll d_atoll
11003eval $inlibc
11004
11005: See if a file contains compiler warnings
11006case "$osname" in
11007  'aix')
11008	cat >compiler_warning <<EOSS
11009# Sample for aix ('.5' indicates the column number in the line):
11010#    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
11011# Since the word 'warning' isn't present, use a fairly rigorous match of what
11012# warning messages look like
11013#            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
11014$grep -E "^\\"[A-Za-z][A-Za-z0-9_]*\.[ch]\\", line [1-9][0-9]*[.][1-9][0-9]*: [1-9][0-9]*-[1-9][0-9]* \([EW][)] " "\$1"
11015EOSS
11016        compiler_warning=./compiler_warning
11017        chmod +x $compiler_warning
11018    ;;
11019     # Maybe a colon after the 'warning' would be appropriate
11020  *) compiler_warning="$contains -i warning"
11021    ;;
11022esac
11023
11024: Look for GCC-style attribute format
11025case "$d_attribute_format" in
11026'')
11027echo " "
11028echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11029$cat >attrib.c <<'EOCP'
11030#include <stdio.h>
11031void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11032EOCP
11033if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11034	if $compiler_warning attrib.out >/dev/null 2>&1; then
11035		echo "Your C compiler doesn't support __attribute__((format))."
11036		val="$undef"
11037	else
11038		echo "Your C compiler supports __attribute__((format))."
11039		val="$define"
11040	fi
11041else
11042	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11043	val="$undef"
11044fi
11045;;
11046*) val="$d_attribute_format" ;;
11047esac
11048set d_attribute_format
11049eval $setvar
11050$rm -f attrib*
11051
11052: Look for GCC-style attribute format with null format allowed
11053case "$d_printf_format_null" in
11054'') case "$d_attribute_format" in
11055    $define)
11056	echo " "
11057	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11058$cat >attrib.c <<EOCP
11059#include <stdio.h>
11060#$i_stdlib I_STDLIB
11061#ifdef I_STDLIB
11062#include <stdlib.h>
11063#endif
11064#$i_inttypes I_INTTYPES
11065#ifdef I_INTTYPES
11066#include <inttypes.h>
11067#endif
11068#ifndef INTPTR_MAX
11069#define intptr_t int
11070#endif
11071int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11072int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11073int main () { exit(null_printf(NULL)); }
11074EOCP
11075	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11076	    : run the executable in case it produces a run-time warning
11077	    if $run ./attrib >>attrib.out 2>&1; then
11078		if $compiler_warning attrib.out >/dev/null 2>&1; then
11079		    echo "Your C compiler doesn't allow __printf__ format to be null."
11080		    val="$undef"
11081		else
11082		    echo "Your C compiler allows __printf__ format to be null."
11083		    val="$define"
11084		fi
11085	    else
11086	    echo "Your C compiler executable failed with __printf__ format null."
11087	    val="$undef"
11088	fi
11089    else
11090	echo "Your C compiler fails with __printf__ format null."
11091	val="$undef"
11092    fi
11093    ;;
11094    *)  val="$undef" ;;
11095    esac
11096;;
11097*)  val="$d_printf_format_null" ;;
11098esac
11099set d_printf_format_null
11100eval $setvar
11101$rm -f attrib*
11102
11103: Look for GCC-style attribute malloc
11104case "$d_attribute_malloc" in
11105'')
11106echo " "
11107echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11108$cat >attrib.c <<'EOCP'
11109#include <stdio.h>
11110char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11111EOCP
11112if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11113	if $compiler_warning attrib.out >/dev/null 2>&1; then
11114		echo "Your C compiler doesn't support __attribute__((malloc))."
11115		val="$undef"
11116	else
11117		echo "Your C compiler supports __attribute__((malloc))."
11118		val="$define"
11119	fi
11120else
11121	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11122	val="$undef"
11123fi
11124;;
11125*) val="$d_attribute_malloc" ;;
11126esac
11127set d_attribute_malloc
11128eval $setvar
11129$rm -f attrib*
11130
11131: Look for GCC-style attribute nonnull
11132case "$d_attribute_nonnull" in
11133'')
11134echo " "
11135echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11136$cat >attrib.c <<'EOCP'
11137#include <stdio.h>
11138void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11139EOCP
11140if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11141	if $compiler_warning attrib.out >/dev/null 2>&1; then
11142		echo "Your C compiler doesn't support __attribute__((nonnull))."
11143		val="$undef"
11144	else
11145		echo "Your C compiler supports __attribute__((nonnull))."
11146		val="$define"
11147	fi
11148else
11149	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11150	val="$undef"
11151fi
11152;;
11153*) val="$d_attribute_nonnull" ;;
11154esac
11155set d_attribute_nonnull
11156eval $setvar
11157$rm -f attrib*
11158
11159: Look for GCC-style attribute noreturn
11160case "$d_attribute_noreturn" in
11161'')
11162echo " "
11163echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11164$cat >attrib.c <<'EOCP'
11165#include <stdio.h>
11166void fall_over_dead( void ) __attribute__((noreturn));
11167EOCP
11168if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11169	if $compiler_warning attrib.out >/dev/null 2>&1; then
11170		echo "Your C compiler doesn't support __attribute__((noreturn))."
11171		val="$undef"
11172	else
11173		echo "Your C compiler supports __attribute__((noreturn))."
11174		val="$define"
11175	fi
11176else
11177	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11178	val="$undef"
11179fi
11180;;
11181*) val="$d_attribute_noreturn" ;;
11182esac
11183set d_attribute_noreturn
11184eval $setvar
11185$rm -f attrib*
11186
11187: Look for GCC-style attribute pure
11188case "$d_attribute_pure" in
11189'')
11190echo " "
11191echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11192$cat >attrib.c <<'EOCP'
11193#include <stdio.h>
11194int square( int n ) __attribute__((pure));
11195EOCP
11196if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11197	if $compiler_warning attrib.out >/dev/null 2>&1; then
11198		echo "Your C compiler doesn't support __attribute__((pure))."
11199		val="$undef"
11200	else
11201		echo "Your C compiler supports __attribute__((pure))."
11202		val="$define"
11203	fi
11204else
11205	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11206	val="$undef"
11207fi
11208;;
11209*) val="$d_attribute_pure" ;;
11210esac
11211set d_attribute_pure
11212eval $setvar
11213$rm -f attrib*
11214
11215: Look for GCC-style attribute unused
11216case "$d_attribute_unused" in
11217'')
11218echo " "
11219echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11220$cat >attrib.c <<'EOCP'
11221#include <stdio.h>
11222int do_something( int dummy __attribute__((unused)), int n );
11223EOCP
11224if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11225	if $compiler_warning attrib.out >/dev/null 2>&1; then
11226		echo "Your C compiler doesn't support __attribute__((unused))."
11227		val="$undef"
11228	else
11229		echo "Your C compiler supports __attribute__((unused))."
11230		val="$define"
11231	fi
11232else
11233	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11234	val="$undef"
11235fi
11236;;
11237*) val="$d_attribute_unused" ;;
11238esac
11239set d_attribute_unused
11240eval $setvar
11241$rm -f attrib*
11242
11243: Look for GCC-style attribute deprecated
11244case "$d_attribute_deprecated" in
11245'')
11246echo " "
11247echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11248$cat >attrib.c <<'EOCP'
11249#include <stdio.h>
11250int I_am_deprecated(void) __attribute__((deprecated));
11251EOCP
11252if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11253	if $compiler_warning attrib.out >/dev/null 2>&1; then
11254		echo "Your C compiler doesn't support __attribute__((deprecated))."
11255		val="$undef"
11256	else
11257		echo "Your C compiler supports __attribute__((deprecated))."
11258		val="$define"
11259	fi
11260else
11261	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11262	val="$undef"
11263fi
11264;;
11265*) val="$d_attribute_deprecated" ;;
11266esac
11267set d_attribute_deprecated
11268eval $setvar
11269$rm -f attrib*
11270
11271: Look for GCC-style attribute warn_unused_result
11272case "$d_attribute_warn_unused_result" in
11273'')
11274echo " "
11275echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11276$cat >attrib.c <<'EOCP'
11277#include <stdio.h>
11278int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11279EOCP
11280if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11281	if $compiler_warning attrib.out >/dev/null 2>&1; then
11282		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11283		val="$undef"
11284	else
11285		echo "Your C compiler supports __attribute__((warn_unused_result))."
11286		val="$define"
11287	fi
11288else
11289	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11290	val="$undef"
11291fi
11292;;
11293*) val="$d_attribute_warn_unused_result" ;;
11294esac
11295set d_attribute_warn_unused_result
11296eval $setvar
11297$rm -f attrib*
11298
11299: Look for GCC-style attribute always_inline
11300case "$d_attribute_always_inline" in
11301'')
11302echo " "
11303echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11304$cat >attrib.c <<'EOCP'
11305#include <stdio.h>
11306static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11307EOCP
11308if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11309	if $compiler_warning attrib.out >/dev/null 2>&1; then
11310		echo "Your C compiler doesn't support __attribute__((always_inline))."
11311		val="$undef"
11312	else
11313		echo "Your C compiler supports __attribute__((always_inline))."
11314		val="$define"
11315	fi
11316else
11317	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11318	val="$undef"
11319fi
11320;;
11321*) val="$d_attribute_always_inline" ;;
11322esac
11323set d_attribute_always_inline
11324eval $setvar
11325$rm -f attrib*
11326
11327: Look for GCC-style attribute visibility
11328case "$d_attribute_visibility" in
11329'')
11330echo " "
11331echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11332$cat >attrib.c <<'EOCP'
11333#include <stdio.h>
11334__attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11335EOCP
11336if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11337	if $compiler_warning attrib.out >/dev/null 2>&1; then
11338		echo "Your C compiler doesn't support __attribute__((visibility))."
11339		val="$undef"
11340	else
11341		echo "Your C compiler supports __attribute__((visibility))."
11342		val="$define"
11343	fi
11344else
11345	echo "Your C compiler doesn't seem to understand __attribute__ at all."
11346	val="$undef"
11347fi
11348;;
11349*) val="$d_attribute_visibility" ;;
11350esac
11351set d_attribute_visibility
11352eval $setvar
11353$rm -f attrib*
11354
11355: see if getpgrp exists
11356set getpgrp d_getpgrp
11357eval $inlibc
11358
11359case "$d_getpgrp" in
11360"$define")
11361	echo " "
11362	echo "Checking to see which flavor of getpgrp is in use..."
11363	$cat >try.c <<EOP
11364#include <stdio.h>
11365#$i_unistd I_UNISTD
11366#include <sys/types.h>
11367#ifdef I_UNISTD
11368#  include <unistd.h>
11369#endif
11370#$i_stdlib I_STDLIB
11371#ifdef I_STDLIB
11372#include <stdlib.h>
11373#endif
11374int main()
11375{
11376	if (getuid() == 0) {
11377		printf("(I see you are running Configure as super-user...)\n");
11378		setuid(1);
11379	}
11380#ifdef TRY_BSD_PGRP
11381	if (getpgrp(1) == 0)
11382		exit(0);
11383#else
11384	if (getpgrp() > 0)
11385		exit(0);
11386#endif
11387	exit(1);
11388}
11389EOP
11390	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11391		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11392		val="$define"
11393	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11394		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11395		val="$undef"
11396	else
11397		echo "I can't seem to compile and run the test program."
11398		if ./usg; then
11399			xxx="a USG one, i.e. you use getpgrp()."
11400		else
11401			# SVR4 systems can appear rather BSD-ish.
11402			case "$i_unistd" in
11403			$undef)
11404				xxx="a BSD one, i.e. you use getpgrp(pid)."
11405				val="$define"
11406				;;
11407			$define)
11408				xxx="probably a USG one, i.e. you use getpgrp()."
11409				val="$undef"
11410				;;
11411			esac
11412		fi
11413		echo "Assuming your getpgrp is $xxx" >&4
11414	fi
11415	;;
11416*) val="$undef";;
11417esac
11418set d_bsdgetpgrp
11419eval $setvar
11420$rm_try
11421
11422: see if setpgrp exists
11423set setpgrp d_setpgrp
11424eval $inlibc
11425
11426case "$d_setpgrp" in
11427"$define")
11428	echo " "
11429	echo "Checking to see which flavor of setpgrp is in use..."
11430	$cat >try.c <<EOP
11431#include <stdio.h>
11432#$i_unistd I_UNISTD
11433#include <sys/types.h>
11434#ifdef I_UNISTD
11435#  include <unistd.h>
11436#endif
11437#$i_stdlib I_STDLIB
11438#ifdef I_STDLIB
11439#include <stdlib.h>
11440#endif
11441int main()
11442{
11443	if (getuid() == 0) {
11444		printf("(I see you are running Configure as super-user...)\n");
11445		setuid(1);
11446	}
11447#ifdef TRY_BSD_PGRP
11448	if (-1 == setpgrp(1, 1))
11449		exit(0);
11450#else
11451	if (setpgrp() != -1)
11452		exit(0);
11453#endif
11454	exit(1);
11455}
11456EOP
11457	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11458		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11459		val="$define"
11460	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11461		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11462		val="$undef"
11463	else
11464		echo "(I can't seem to compile and run the test program.)"
11465		if ./usg; then
11466			xxx="a USG one, i.e. you use setpgrp()."
11467		else
11468			# SVR4 systems can appear rather BSD-ish.
11469			case "$i_unistd" in
11470			$undef)
11471				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11472				val="$define"
11473				;;
11474			$define)
11475				xxx="probably a USG one, i.e. you use setpgrp()."
11476				val="$undef"
11477				;;
11478			esac
11479		fi
11480		echo "Assuming your setpgrp is $xxx" >&4
11481	fi
11482	;;
11483*) val="$undef";;
11484esac
11485set d_bsdsetpgrp
11486eval $setvar
11487$rm_try
11488
11489: Look for GCC-style __builtin_add_overflow
11490case "$d_builtin_add_overflow" in
11491'')
11492    echo " "
11493    echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11494    $cat >try.c <<'EOCP'
11495int main(void) {
11496    const unsigned int uint_max = ~0u;
11497    int target_int = 0;
11498    if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11499        return 1;
11500    }
11501    if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11502        return 1;
11503    }
11504    if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11505        return 1;
11506    }
11507    return 0;
11508}
11509EOCP
11510    set try
11511    if eval $compile && $run ./try; then
11512        echo "Your C compiler supports __builtin_add_overflow."
11513        val="$define"
11514    else
11515        echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11516        val="$undef"
11517    fi
11518    ;;
11519*) val="$d_builtin_add_overflow" ;;
11520esac
11521
11522set d_builtin_add_overflow
11523eval $setvar
11524$rm_try
11525
11526: Look for GCC-style __builtin_sub_overflow
11527case "$d_builtin_sub_overflow" in
11528'')
11529    echo " "
11530    echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11531    $cat >try.c <<'EOCP'
11532int main(void) {
11533    const unsigned int uint_max = ~0u;
11534    int target_int = 0;
11535    if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11536        return 1;
11537    }
11538    if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11539        return 1;
11540    }
11541    if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11542        return 1;
11543    }
11544    return 0;
11545}
11546EOCP
11547    set try
11548    if eval $compile && $run ./try; then
11549        echo "Your C compiler supports __builtin_sub_overflow."
11550        val="$define"
11551    else
11552        echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11553        val="$undef"
11554    fi
11555    ;;
11556*) val="$d_builtin_sub_overflow" ;;
11557esac
11558
11559set d_builtin_sub_overflow
11560eval $setvar
11561$rm_try
11562
11563: Look for GCC-style __builtin_mul_overflow
11564case "$d_builtin_mul_overflow" in
11565'')
11566    echo " "
11567    echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11568    $cat >try.c <<'EOCP'
11569int main(void) {
11570    const unsigned int uint_max = ~0u;
11571    int target_int = 0;
11572    if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11573        return 1;
11574    }
11575    if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11576        return 1;
11577    }
11578    if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11579        return 1;
11580    }
11581    return 0;
11582}
11583EOCP
11584    set try
11585    if eval $compile && $run ./try; then
11586        echo "Your C compiler supports __builtin_mul_overflow."
11587        val="$define"
11588    else
11589        echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11590        val="$undef"
11591    fi
11592    ;;
11593*) val="$d_builtin_mul_overflow" ;;
11594esac
11595
11596set d_builtin_mul_overflow
11597eval $setvar
11598$rm_try
11599
11600: Look for GCC-style __builtin_choose_expr
11601case "$d_builtin_choose_expr" in
11602'')
11603    echo " "
11604    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11605    $cat >try.c <<'EOCP'
11606#include <assert.h>
11607#include <stdlib.h>
11608#include <stdio.h>
11609
11610#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11611
11612int main(void) {
11613    assert( SYRINX(1) == 2112 );
11614    assert( SYRINX(1) != 5150 );
11615    assert( SYRINX(0) == 5150 );
11616    assert( SYRINX(0) != 2112 );
11617    puts( "All good!" );
11618    exit(0);
11619}
11620
11621EOCP
11622    set try
11623    if eval $compile && $run ./try; then
11624	echo "Your C compiler supports __builtin_choose_expr."
11625	val="$define"
11626    else
11627	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11628	val="$undef"
11629    fi
11630;;
11631*) val="$d_builtin_choose_expr" ;;
11632esac
11633
11634set d_builtin_choose_expr
11635eval $setvar
11636$rm_try
11637
11638: Look for GCC-style __builtin_expect
11639case "$d_builtin_expect" in
11640'')
11641    echo " "
11642    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11643    $cat >try.c <<'EOCP'
11644int main(void) {
11645    int n = 50;
11646    if ( __builtin_expect(n, 0) ) n = 1;
11647    /* Remember shell exit code truth is 0, C truth is non-zero */
11648    return !(n == 1);
11649}
11650EOCP
11651    set try
11652    if eval $compile && $run ./try; then
11653	echo "Your C compiler supports __builtin_expect."
11654	val="$define"
11655    else
11656	echo "Your C compiler doesn't seem to understand __builtin_expect."
11657	val="$undef"
11658    fi
11659    ;;
11660*) val="$d_builtin_expect" ;;
11661esac
11662
11663set d_builtin_expect
11664eval $setvar
11665$rm_try
11666
11667: see if the Compiler supports C99 variadic macros
11668echo "Checking for C99 variadic macros." >&4
11669$cat >try.c <<EOCP
11670#include <stdio.h>
11671#include <stdarg.h>
11672
11673#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11674
11675int main() {
11676  char buf[20];
11677  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11678  puts(buf);
11679  return 0;
11680}
11681EOCP
11682set try
11683if eval $compile && $run ./try 2>&1 >/dev/null; then
11684    case "`$run ./try`" in
11685	"123 456 789")
11686	echo "You have C99 variadic macros." >&4
11687	d_c99_variadic_macros="$define"
11688	;;
11689	*)
11690	echo "You don't have functional C99 variadic macros." >&4
11691	d_c99_variadic_macros="$undef"
11692	;;
11693    esac
11694else
11695    echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11696    d_c99_variadic_macros="$undef"
11697fi
11698$rm_try
11699
11700: see if signal is declared as pointer to function returning int or void
11701echo " "
11702xxx=`./findhdr signal.h`
11703$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11704if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11705	echo "You have int (*signal())() instead of void." >&4
11706	val="$undef"
11707elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11708	echo "You have void (*signal())()." >&4
11709	val="$define"
11710elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11711	echo "You have int (*signal())() instead of void." >&4
11712	val="$undef"
11713elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11714	echo "You have void (*signal())()." >&4
11715	val="$define"
11716else
11717	case "$d_voidsig" in
11718	'')
11719	echo "I can't determine whether signal handler returns void or int..." >&4
11720		dflt=void
11721		rp="What type does your signal handler return?"
11722		. ./myread
11723		case "$ans" in
11724		v*) val="$define";;
11725		*) val="$undef";;
11726		esac;;
11727	"$define")
11728		echo "As you already told me, signal handler returns void." >&4
11729		val="$define"
11730		;;
11731	*)	echo "As you already told me, signal handler returns int." >&4
11732		val="$undef"
11733		;;
11734	esac
11735fi
11736set d_voidsig
11737eval $setvar
11738case "$d_voidsig" in
11739"$define") signal_t="void";;
11740*) signal_t="int";;
11741esac
11742$rm -f $$.tmp
11743
11744: check for ability to cast large floats to 32-bit ints.
11745echo " "
11746echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11747if $test "$intsize" -ge 4; then
11748	xxx=int
11749else
11750	xxx=long
11751fi
11752$cat >try.c <<EOCP
11753#include <stdio.h>
11754#$i_stdlib I_STDLIB
11755#ifdef I_STDLIB
11756#include <stdlib.h>
11757#endif
11758#include <sys/types.h>
11759#include <signal.h>
11760$signal_t blech(int s) { exit(3); }
11761int main()
11762{
11763	$xxx i32;
11764	double f, g;
11765	int result = 0;
11766	char str[16];
11767	signal(SIGFPE, blech);
11768
11769	/* Don't let compiler optimize the test away.  Store the number
11770	   in a writable string for gcc to pass to sscanf under HP-UX.
11771	*/
11772	sprintf(str, "2147483647");
11773	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11774	g = 10 * f;
11775	i32  = ($xxx) g;
11776
11777	/* x86 processors will probably give 0x8000 0000, which is a
11778	   sign change.  We don't want that.  We want to mimic SPARC
11779	   behavior here, which is to preserve the sign and give
11780	   back 0x7fff ffff.
11781	*/
11782	if (i32 != ($xxx) f)
11783		result |= 1;
11784	exit(result);
11785}
11786EOCP
11787set try
11788if eval $compile_ok; then
11789	$run ./try 2>/dev/null
11790	yyy=$?
11791else
11792	echo "(I can't seem to compile the test program--assuming it can't)"
11793	yyy=1
11794fi
11795case "$yyy" in
117960)	val="$define"
11797	echo "Yup, it can."
11798	;;
11799*)	val="$undef"
11800	echo "Nope, it can't."
11801	;;
11802esac
11803set d_casti32
11804eval $setvar
11805$rm_try
11806
11807: check for ability to cast negative floats to unsigned
11808echo " "
11809echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11810$cat >try.c <<EOCP
11811#include <stdio.h>
11812#$i_stdlib I_STDLIB
11813#ifdef I_STDLIB
11814#include <stdlib.h>
11815#endif
11816#include <sys/types.h>
11817#include <signal.h>
11818$signal_t blech(int s) { exit(7); }
11819$signal_t blech_in_list(int s) { exit(4); }
11820unsigned long dummy_long(unsigned long p) { return p; }
11821unsigned int dummy_int(unsigned int p) { return p; }
11822unsigned short dummy_short(unsigned short p) { return p; }
11823int main()
11824{
11825	double f;
11826	unsigned long along;
11827	unsigned int aint;
11828	unsigned short ashort;
11829	int result = 0;
11830	char str[16];
11831
11832	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11833	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11834	   optimized the whole file away
11835	*/
11836	/* Store the number in a writable string for gcc to pass to
11837	   sscanf under HP-UX.
11838	*/
11839	sprintf(str, "-123");
11840	sscanf(str, "%lf", &f);  /* f = -123.; */
11841
11842	signal(SIGFPE, blech);
11843	along = (unsigned long)f;
11844	aint = (unsigned int)f;
11845	ashort = (unsigned short)f;
11846	if (along != (unsigned long)-123)
11847		result |= 1;
11848	if (aint != (unsigned int)-123)
11849		result |= 1;
11850	if (ashort != (unsigned short)-123)
11851		result |= 1;
11852	sprintf(str, "1073741824.");
11853	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11854	f = f + f;
11855	along = 0;
11856	along = (unsigned long)f;
11857	if (along != 0x80000000)
11858		result |= 2;
11859	f -= 1.;
11860	along = 0;
11861	along = (unsigned long)f;
11862	if (along != 0x7fffffff)
11863		result |= 1;
11864	f += 2.;
11865	along = 0;
11866	along = (unsigned long)f;
11867	if (along != 0x80000001)
11868		result |= 2;
11869	if (result)
11870		exit(result);
11871	signal(SIGFPE, blech_in_list);
11872	sprintf(str, "123.");
11873	sscanf(str, "%lf", &f);  /* f = 123.; */
11874	along = dummy_long((unsigned long)f);
11875	aint = dummy_int((unsigned int)f);
11876	ashort = dummy_short((unsigned short)f);
11877	if (along != (unsigned long)123)
11878		result |= 4;
11879	if (aint != (unsigned int)123)
11880		result |= 4;
11881	if (ashort != (unsigned short)123)
11882		result |= 4;
11883	exit(result);
11884
11885}
11886EOCP
11887set try
11888if eval $compile_ok; then
11889	$run ./try 2>/dev/null
11890	castflags=$?
11891else
11892	echo "(I can't seem to compile the test program--assuming it can't)"
11893	castflags=7
11894fi
11895case "$castflags" in
118960)	val="$define"
11897	echo "Yup, it can."
11898	;;
11899*)	val="$undef"
11900	echo "Nope, it can't."
11901	;;
11902esac
11903set d_castneg
11904eval $setvar
11905$rm_try
11906
11907: see if cbrt exists
11908set cbrt d_cbrt
11909eval $inlibc
11910
11911: see if chown exists
11912set chown d_chown
11913eval $inlibc
11914
11915: see if chroot exists
11916set chroot d_chroot
11917eval $inlibc
11918
11919: see if chsize exists
11920set chsize d_chsize
11921eval $inlibc
11922
11923: see if class exists
11924set class d_class
11925eval $inlibc
11926
11927: see if clearenv exists
11928set clearenv d_clearenv
11929eval $inlibc
11930
11931: Define hasstruct macro for Configure internal use
11932hasstruct='varname=$1; struct=$2; shift; shift;
11933while $test $# -ge 2; do
11934	case "$1" in
11935	$define) echo "#include <$2>";;
11936	esac ;
11937    shift 2;
11938done > try.c;
11939echo "int main () { struct $struct foo; }" >> try.c;
11940set try;
11941if eval $compile; then
11942	val="$define";
11943else
11944	val="$undef";
11945fi;
11946set $varname;
11947eval $setvar;
11948$rm_try'
11949
11950: see whether socket exists
11951socketlib=''
11952sockethdr=''
11953echo " "
11954$echo $n "Hmm... $c" >&4
11955if set socket val -f d_socket; eval $csym; $val; then
11956    echo "Looks like you have Berkeley networking support." >&4
11957    d_socket="$define"
11958    if set setsockopt val -f; eval $csym; $val; then
11959	d_oldsock="$undef"
11960    else
11961	echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11962	d_oldsock="$define"
11963    fi
11964else
11965    if $contains socklib libc.list >/dev/null 2>&1; then
11966	echo "Looks like you have Berkeley networking support." >&4
11967	d_socket="$define"
11968	: we will have to assume that it supports the 4.2 BSD interface
11969	d_oldsock="$undef"
11970    else
11971	echo "You don't have Berkeley networking in libc$_a..." >&4
11972	if test "X$d_socket" = "X$define"; then
11973	    echo "...but you seem to believe that you have sockets." >&4
11974	else
11975	    for net in net socket
11976	    do
11977		if test -f $sysroot/usr/lib/lib$net$_a; then
11978		    ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11979		    $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11980		    if $contains socket libc.list >/dev/null 2>&1; then
11981			d_socket="$define"
11982			socketlib="-l$net"
11983			case "$net" in
11984			net)
11985			    echo "...but the Wollongong group seems to have hacked it in." >&4
11986			    sockethdr="-I$sysroot/usr/netinclude"
11987			    ;;
11988			esac
11989			echo "Found Berkeley sockets interface in lib$net." >&4
11990			if $contains setsockopt libc.list >/dev/null 2>&1; then
11991			    d_oldsock="$undef"
11992			else
11993			    echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11994			    d_oldsock="$define"
11995			fi
11996			break
11997		    fi
11998		fi
11999	    done
12000	    if test "X$d_socket" != "X$define"; then
12001	       echo "or anywhere else I see." >&4
12002	       d_socket="$undef"
12003	       d_oldsock="$undef"
12004	    fi
12005	fi
12006    fi
12007fi
12008
12009: see if socketpair exists
12010set socketpair d_sockpair
12011eval $inlibc
12012
12013
12014echo "Checking the availability sa_len in the sock struct ..." >&4
12015$cat >try.c <<EOF
12016#include <sys/types.h>
12017#include <sys/socket.h>
12018int main() {
12019struct sockaddr sa;
12020return (sa.sa_len);
12021}
12022EOF
12023val="$undef"
12024set try; if eval $compile; then
12025    val="$define"
12026fi
12027set d_sockaddr_sa_len; eval $setvar
12028$rm_try
12029
12030echo "Checking the availability struct sockaddr_in6 ..." >&4
12031$cat >try.c <<EOF
12032#include <sys/types.h>
12033#include <sys/socket.h>
12034#include <netinet/in.h>
12035int main() {
12036struct sockaddr_in6 sin6;
12037return (sin6.sin6_family);
12038}
12039EOF
12040val="$undef"
12041set try; if eval $compile; then
12042    val="$define"
12043fi
12044set d_sockaddr_in6; eval $setvar
12045$rm_try
12046
12047echo "Checking the availability struct sockaddr_storage ..." >&4
12048$cat >try.c <<EOF
12049#include <sys/types.h>
12050#include <sys/socket.h>
12051#include <netinet/in.h>
12052int main() {
12053struct sockaddr_storage sastor;
12054return (sastor.ss_family);
12055}
12056EOF
12057val="$undef"
12058set try; if eval $compile; then
12059    val="$define"
12060fi
12061set d_sockaddr_storage; eval $setvar
12062$rm_try
12063
12064echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12065$cat >try.c <<EOF
12066#include <sys/types.h>
12067#include <sys/socket.h>
12068#include <netinet/in.h>
12069int main() {
12070struct sockaddr_in6 sin6;
12071return (sin6.sin6_scope_id);
12072}
12073EOF
12074val="$undef"
12075set try; if eval $compile; then
12076    val="$define"
12077fi
12078set d_sin6_scope_id; eval $setvar
12079$rm_try
12080
12081echo "Checking the availability struct ip_mreq ..." >&4
12082$cat >try.c <<EOF
12083#include <sys/types.h>
12084#include <sys/socket.h>
12085#include <netinet/in.h>
12086int main() {
12087struct ip_mreq mreq;
12088return (mreq.imr_multiaddr.s_addr);
12089}
12090EOF
12091val="$undef"
12092set try; if eval $compile; then
12093       val="$define"
12094fi
12095set d_ip_mreq; eval $setvar
12096$rm_try
12097
12098echo "Checking the availability struct ip_mreq_source ..." >&4
12099$cat >try.c <<EOF
12100#include <sys/types.h>
12101#include <sys/socket.h>
12102#include <netinet/in.h>
12103int main() {
12104struct ip_mreq_source mreq;
12105return (mreq.imr_multiaddr.s_addr);
12106}
12107EOF
12108val="$undef"
12109set try; if eval $compile; then
12110       val="$define"
12111fi
12112set d_ip_mreq_source; eval $setvar
12113$rm_try
12114
12115echo "Checking the availability struct ipv6_mreq ..." >&4
12116$cat >try.c <<EOF
12117#include <sys/types.h>
12118#include <sys/socket.h>
12119#include <netinet/in.h>
12120int main() {
12121struct ipv6_mreq mreq;
12122return (mreq.ipv6mr_interface);
12123}
12124EOF
12125val="$undef"
12126set try; if eval $compile; then
12127    val="$define"
12128fi
12129set d_ipv6_mreq; eval $setvar
12130$rm_try
12131
12132echo "Checking the availability struct ipv6_mreq_source ..." >&4
12133$cat >try.c <<EOF
12134#include <sys/types.h>
12135#include <sys/socket.h>
12136#include <netinet/in.h>
12137int main() {
12138struct ipv6_mreq_source mreq;
12139return (mreq.imr_multiaddr.s_addr);
12140}
12141EOF
12142val="$undef"
12143set try; if eval $compile; then
12144       val="$define"
12145fi
12146set d_ipv6_mreq_source; eval $setvar
12147$rm_try
12148
12149echo "Checking the availability of certain socket constants..." >&4
12150for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12151    enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12152    $cat >try.c <<EOF
12153#include <sys/types.h>
12154#include <sys/socket.h>
12155int main() {
12156    int i = $ENUM;
12157}
12158EOF
12159    val="$undef"
12160    set try; if eval $compile; then
12161	val="$define"
12162    fi
12163    set d_${enum}; eval $setvar
12164    $rm_try
12165done
12166
12167: see if this is a sys/uio.h system
12168set sys/uio.h i_sysuio
12169eval $inhdr
12170
12171: Check for cmsghdr support
12172echo " "
12173echo "Checking to see if your system supports struct cmsghdr..." >&4
12174set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12175eval $hasstruct
12176case "$d_cmsghdr_s" in
12177"$define")      echo "Yes, it does."   ;;
12178*)              echo "No, it doesn't." ;;
12179esac
12180
12181: see if copysign exists
12182set copysign d_copysign
12183eval $inlibc
12184
12185: see if copysignl exists
12186set copysignl d_copysignl
12187eval $inlibc
12188
12189: see if crypt exists
12190echo " "
12191set crypt d_crypt
12192eval $inlibc
12193case "$d_crypt" in
12194$define) cryptlib='' ;;
12195*)	if set crypt val -f d_crypt; eval $csym; $val; then
12196		echo 'crypt() found.' >&4
12197		val="$define"
12198		cryptlib=''
12199	else
12200		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12201		if $test -z "$cryptlib"; then
12202			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12203		else
12204			cryptlib=-lcrypt
12205		fi
12206		if $test -z "$cryptlib"; then
12207			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12208		else
12209			cryptlib=-lcrypt
12210		fi
12211		if $test -z "$cryptlib"; then
12212			cryptlib=`./loc libcrypt$_a "" $libpth`
12213		else
12214			cryptlib=-lcrypt
12215		fi
12216		if $test -z "$cryptlib"; then
12217			echo 'crypt() NOT found.' >&4
12218			val="$undef"
12219		else
12220			val="$define"
12221		fi
12222	fi
12223	set d_crypt
12224	eval $setvar
12225	;;
12226esac
12227
12228: see if this is a crypt.h system
12229set crypt.h i_crypt
12230eval $inhdr
12231
12232: see if crypt_r exists
12233set crypt_r d_crypt_r
12234eval $inlibc
12235case "$d_crypt_r" in
12236"$define")
12237	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12238	case "$d_crypt_r_proto:$usethreads" in
12239	":define")	d_crypt_r_proto=define
12240		set d_crypt_r_proto crypt_r $hdrs
12241		eval $hasproto ;;
12242	*)	;;
12243	esac
12244	case "$d_crypt_r_proto" in
12245	define)
12246	case "$crypt_r_proto" in
12247	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12248	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12249	esac
12250	case "$crypt_r_proto" in
12251	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12252	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12253	esac
12254	case "$crypt_r_proto" in
12255	''|0)	d_crypt_r=undef
12256		crypt_r_proto=0
12257		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12258	* )	case "$crypt_r_proto" in
12259		REENTRANT_PROTO*) ;;
12260		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12261		esac
12262		echo "Prototype: $try" ;;
12263	esac
12264	;;
12265	*)	case "$usethreads" in
12266		define) echo "crypt_r has no prototype, not using it." >&4 ;;
12267		esac
12268		d_crypt_r=undef
12269		crypt_r_proto=0
12270		;;
12271	esac
12272	;;
12273*)	crypt_r_proto=0
12274	;;
12275esac
12276
12277: get csh whereabouts
12278case "$csh" in
12279'csh') val="$undef" ;;
12280*) val="$define" ;;
12281esac
12282set d_csh
12283eval $setvar
12284: Respect a hint or command line value for full_csh.
12285case "$full_csh" in
12286'') full_csh=$csh ;;
12287esac
12288
12289: see if ctermid exists
12290set ctermid d_ctermid
12291eval $inlibc
12292
12293: see if ctermid_r exists
12294set ctermid_r d_ctermid_r
12295eval $inlibc
12296case "$d_ctermid_r" in
12297"$define")
12298	hdrs="$i_systypes sys/types.h define stdio.h "
12299	case "$d_ctermid_r_proto:$usethreads" in
12300	":define")	d_ctermid_r_proto=define
12301		set d_ctermid_r_proto ctermid_r $hdrs
12302		eval $hasproto ;;
12303	*)	;;
12304	esac
12305	case "$d_ctermid_r_proto" in
12306	define)
12307	case "$ctermid_r_proto" in
12308	''|0) try='char* ctermid_r(char*);'
12309	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12310	esac
12311	case "$ctermid_r_proto" in
12312	''|0)	d_ctermid_r=undef
12313		ctermid_r_proto=0
12314		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12315	* )	case "$ctermid_r_proto" in
12316		REENTRANT_PROTO*) ;;
12317		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12318		esac
12319		echo "Prototype: $try" ;;
12320	esac
12321	;;
12322	*)	case "$usethreads" in
12323		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12324		esac
12325		d_ctermid_r=undef
12326		ctermid_r_proto=0
12327		;;
12328	esac
12329	;;
12330*)	ctermid_r_proto=0
12331	;;
12332esac
12333
12334: see if ctime_r exists
12335set ctime_r d_ctime_r
12336eval $inlibc
12337case "$d_ctime_r" in
12338"$define")
12339	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12340	case "$d_ctime_r_proto:$usethreads" in
12341	":define")	d_ctime_r_proto=define
12342		set d_ctime_r_proto ctime_r $hdrs
12343		eval $hasproto ;;
12344	*)	;;
12345	esac
12346	case "$d_ctime_r_proto" in
12347	define)
12348	case "$ctime_r_proto" in
12349	''|0) try='char* ctime_r(const time_t*, char*);'
12350	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12351	esac
12352	case "$ctime_r_proto" in
12353	''|0) try='char* ctime_r(const time_t*, char*, int);'
12354	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12355	esac
12356	case "$ctime_r_proto" in
12357	''|0) try='int ctime_r(const time_t*, char*);'
12358	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12359	esac
12360	case "$ctime_r_proto" in
12361	''|0) try='int ctime_r(const time_t*, char*, int);'
12362	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12363	esac
12364	case "$ctime_r_proto" in
12365	''|0)	d_ctime_r=undef
12366		ctime_r_proto=0
12367		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12368	* )	case "$ctime_r_proto" in
12369		REENTRANT_PROTO*) ;;
12370		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12371		esac
12372		echo "Prototype: $try" ;;
12373	esac
12374	;;
12375	*)	case "$usethreads" in
12376		define) echo "ctime_r has no prototype, not using it." >&4 ;;
12377		esac
12378		d_ctime_r=undef
12379		ctime_r_proto=0
12380		;;
12381	esac
12382	;;
12383*)	ctime_r_proto=0
12384	;;
12385esac
12386
12387: see if cuserid exists
12388set cuserid d_cuserid
12389eval $inlibc
12390
12391: see if dbm.h is available
12392: see if dbmclose exists
12393set dbmclose d_dbmclose
12394eval $inlibc
12395
12396case "$d_dbmclose" in
12397$define)
12398	set dbm.h i_dbm
12399	eval $inhdr
12400	case "$i_dbm" in
12401	$define)
12402		val="$undef"
12403		set i_rpcsvcdbm
12404		eval $setvar
12405		;;
12406	*)	set rpcsvc/dbm.h i_rpcsvcdbm
12407		eval $inhdr
12408		;;
12409	esac
12410	;;
12411*)	echo "We won't be including <dbm.h>"
12412	val="$undef"
12413	set i_dbm
12414	eval $setvar
12415	val="$undef"
12416	set i_rpcsvcdbm
12417	eval $setvar
12418	;;
12419esac
12420
12421: see if prototype for dbminit is available
12422echo " "
12423set d_dbminitproto dbminit $i_dbm dbm.h
12424eval $hasproto
12425
12426: see if difftime exists
12427set difftime d_difftime
12428eval $inlibc
12429
12430: see if this is a dirent system
12431echo " "
12432if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12433	val="$define"
12434	echo "<dirent.h> found." >&4
12435else
12436	val="$undef"
12437	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12438		echo "<sys/dir.h> found." >&4
12439		echo " "
12440	else
12441		xinc=`./findhdr sys/ndir.h`
12442	fi
12443	echo "<dirent.h> NOT found." >&4
12444fi
12445set i_dirent
12446eval $setvar
12447
12448: Look for type of directory structure.
12449echo " "
12450$cppstdin $cppflags $cppminus < "$xinc" > try.c
12451
12452case "$direntrytype" in
12453''|' ')
12454	case "$i_dirent" in
12455	$define) guess1='struct dirent' ;;
12456	*) guess1='struct direct'  ;;
12457	esac
12458	;;
12459*)	guess1="$direntrytype"
12460	;;
12461esac
12462
12463case "$guess1" in
12464'struct dirent') guess2='struct direct' ;;
12465*) guess2='struct dirent' ;;
12466esac
12467
12468if $contains "$guess1" try.c >/dev/null 2>&1; then
12469	direntrytype="$guess1"
12470	echo "Your directory entries are $direntrytype." >&4
12471elif $contains "$guess2" try.c >/dev/null 2>&1; then
12472	direntrytype="$guess2"
12473	echo "Your directory entries seem to be $direntrytype." >&4
12474else
12475	echo "I don't recognize your system's directory entries." >&4
12476	rp="What type is used for directory entries on this system?"
12477	dflt="$guess1"
12478	. ./myread
12479	direntrytype="$ans"
12480fi
12481$rm_try
12482
12483: see if the directory entry stores field length
12484echo " "
12485$cppstdin $cppflags $cppminus < "$xinc" > try.c
12486if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12487	echo "Good, your directory entry keeps length information in d_namlen." >&4
12488	val="$define"
12489else
12490	echo "Your directory entry does not know about the d_namlen field." >&4
12491	val="$undef"
12492fi
12493set d_dirnamlen
12494eval $setvar
12495$rm_try
12496
12497: Look for DIR.dd_fd
12498case "$i_dirent" in
12499"$define")
12500    echo "Checking to see if DIR has a dd_fd member variable" >&4
12501    $cat >try.c <<EOCP
12502#$i_stdlib I_STDLIB
12503#ifdef I_STDLIB
12504#include <stdlib.h>
12505#endif
12506#include <dirent.h>
12507
12508int main() {
12509    DIR dir;
12510    dir.dd_fd = 1;
12511    return 0;
12512}
12513EOCP
12514    val=$undef
12515    set try
12516    if eval $compile; then
12517        echo "Yes, it does."
12518        val="$define"
12519    else
12520        echo "No, it does not."
12521        val="$undef"
12522    fi
12523    ;;
12524*)
12525    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12526    val="$undef"
12527    ;;
12528esac
12529set d_dir_dd_fd
12530eval $setvar
12531$rm_try
12532
12533: see if this is an sysdir system
12534set sys/dir.h i_sysdir
12535eval $inhdr
12536
12537: see if this is an sysndir system
12538set sys/ndir.h i_sysndir
12539eval $inhdr
12540
12541: Look for dirfd
12542echo " "
12543$cat >dirfd.c <<EOM
12544#include <stdio.h>
12545#$i_stdlib I_STDLIB
12546#ifdef I_STDLIB
12547#include <stdlib.h>
12548#endif
12549#$i_dirent I_DIRENT		/**/
12550#$i_sysdir I_SYS_DIR		/**/
12551#$i_sysndir I_SYS_NDIR		/**/
12552#$i_systypes I_SYS_TYPES	/**/
12553#if defined(I_SYS_TYPES)
12554#include <sys/types.h>
12555#endif
12556#if defined(I_DIRENT)
12557#include <dirent.h>
12558#else
12559#ifdef I_SYS_NDIR
12560#include <sys/ndir.h>
12561#else
12562#ifdef I_SYS_DIR
12563#include <sys/dir.h>
12564#endif
12565#endif
12566#endif
12567int main() {
12568	DIR *dirp = opendir(".");
12569	if (dirfd(dirp) >= 0)
12570		exit(0);
12571	else
12572		exit(1);
12573}
12574EOM
12575val=$undef
12576set dirfd
12577if eval $compile; then
12578	val="$define"
12579fi
12580case "$val" in
12581$define)	echo "dirfd() found." >&4	;;
12582*)		echo "dirfd() NOT found." >&4	;;
12583esac
12584set d_dirfd
12585eval $setvar
12586$rm -f dirfd*
12587
12588: see if dladdr exists
12589set dladdr d_dladdr
12590eval $inlibc
12591
12592: see if dlerror exists
12593xxx_runnm="$runnm"
12594runnm=false
12595set dlerror d_dlerror
12596eval $inlibc
12597runnm="$xxx_runnm"
12598
12599: see if dlfcn is available
12600set dlfcn.h i_dlfcn
12601eval $inhdr
12602
12603: Check what extension to use for shared libs
12604case "$usedl" in
12605$define|y|true)
12606	$cat << EOM
12607
12608On a few systems, the dynamically loaded modules that perl generates and uses
12609will need a different extension than shared libs. The default will probably
12610be appropriate.
12611
12612EOM
12613	case "$dlext" in
12614	'')	dflt="$so" ;;
12615	*)	dflt="$dlext" ;;
12616	esac
12617	rp='What is the extension of dynamically loaded modules'
12618	. ./myread
12619	dlext="$ans"
12620	;;
12621*)
12622	dlext="none"
12623	;;
12624esac
12625
12626: Check if dlsym need a leading underscore
12627echo " "
12628val="$undef"
12629
12630case "$dlsrc" in
12631dl_dlopen.xs)
12632	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12633	$cat >dyna.c <<'EOM'
12634void fred (void) { }
12635EOM
12636
12637$cat >fred.c<<EOM
12638
12639#include <stdio.h>
12640#$i_stdlib I_STDLIB
12641#ifdef I_STDLIB
12642#include <stdlib.h>
12643#endif
12644#$i_dlfcn I_DLFCN
12645#ifdef I_DLFCN
12646#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12647#else
12648#include <sys/types.h>
12649#include <nlist.h>
12650#include <link.h>
12651#endif
12652
12653extern void fred(void) ;
12654
12655int main()
12656{
12657    void * handle ;
12658    void * symbol ;
12659#ifndef RTLD_LAZY
12660    int mode = 1 ;
12661#else
12662    int mode = RTLD_LAZY ;
12663#endif
12664    handle = dlopen("./dyna.$dlext", mode) ;
12665    if (handle == NULL) {
12666	printf ("1\n") ;
12667	fflush (stdout) ;
12668	exit(0);
12669    }
12670    symbol = dlsym(handle, "fred") ;
12671    if (symbol == NULL) {
12672	/* try putting a leading underscore */
12673	symbol = dlsym(handle, "_fred") ;
12674	if (symbol == NULL) {
12675	    printf ("2\n") ;
12676	    fflush (stdout) ;
12677	    exit(0);
12678	}
12679	printf ("3\n") ;
12680    }
12681    else
12682	printf ("4\n") ;
12683    fflush (stdout) ;
12684    exit(0);
12685}
12686EOM
12687	: Call the object file tmp-dyna.o in case dlext=o.
12688	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12689		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12690		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12691		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12692		xxx=`$run ./fred`
12693		case $xxx in
12694		1)	echo "Test program failed using dlopen." >&4
12695			echo "Perhaps you should not use dynamic loading." >&4;;
12696		2)	echo "Test program failed using dlsym." >&4
12697			echo "Perhaps you should not use dynamic loading." >&4;;
12698		3)	echo "dlsym needs a leading underscore" >&4
12699			val="$define" ;;
12700		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12701		esac
12702	else
12703		echo "I can't compile and run the test program." >&4
12704                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12705	fi
12706	;;
12707esac
12708
12709$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12710
12711set d_dlsymun
12712eval $setvar
12713
12714: see if drand48_r exists
12715set drand48_r d_drand48_r
12716eval $inlibc
12717case "$d_drand48_r" in
12718"$define")
12719	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12720	case "$d_drand48_r_proto:$usethreads" in
12721	":define")	d_drand48_r_proto=define
12722		set d_drand48_r_proto drand48_r $hdrs
12723		eval $hasproto ;;
12724	*)	;;
12725	esac
12726	case "$d_drand48_r_proto" in
12727	define)
12728	case "$drand48_r_proto" in
12729	''|0) try='int drand48_r(struct drand48_data*, double*);'
12730	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12731	esac
12732	case "$drand48_r_proto" in
12733	''|0)	d_drand48_r=undef
12734		drand48_r_proto=0
12735		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12736	* )	case "$drand48_r_proto" in
12737		REENTRANT_PROTO*) ;;
12738		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12739		esac
12740		echo "Prototype: $try" ;;
12741	esac
12742	;;
12743	*)	case "$usethreads" in
12744		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12745		esac
12746		d_drand48_r=undef
12747		drand48_r_proto=0
12748		;;
12749	esac
12750	;;
12751*)	drand48_r_proto=0
12752	;;
12753esac
12754
12755: see if prototype for drand48 is available
12756echo " "
12757set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12758eval $hasproto
12759
12760: see if dup2 exists
12761set dup2 d_dup2
12762eval $inlibc
12763
12764: see if dup3 exists
12765set dup3 d_dup3
12766eval $inlibc
12767
12768: see if localeconv_l exists
12769set localeconv_l d_localeconv_l
12770eval $inlibc
12771
12772: see if this is an xlocale.h system
12773set xlocale.h i_xlocale
12774eval $inhdr
12775
12776: see if newlocale exists
12777set newlocale d_newlocale
12778eval $inlibc
12779
12780: see if freelocale exists
12781set freelocale d_freelocale
12782eval $inlibc
12783
12784: see if uselocale exists
12785set uselocale d_uselocale
12786eval $inlibc
12787
12788: see if duplocale exists
12789set duplocale d_duplocale
12790eval $inlibc
12791
12792: see if querylocale exists
12793set querylocale d_querylocale
12794eval $inlibc
12795
12796: if we have xlocale.h, check whether it is needed
12797case "$i_xlocale$d_newlocale$xlocale_needed" in
12798"$define$define")
12799	echo "Checking if xlocale.h is needed..." >&4
12800	$cat >try.c <<EOF
12801#include <locale.h>
12802#include <stdio.h>
12803#ifdef TRY_XLOCALE
12804#include <xlocale.h>
12805#endif
12806#$d_localeconv_l HAVE_LOCALECONV_L
12807
12808#ifdef HAVE_LOCALECONV_L
12809struct lconv *(*lcptr)(locale_t) = localeconv_l;
12810#endif
12811
12812int main(void) {
12813  locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12814
12815#ifdef HAVE_LOCALECONV_L
12816  /* FreeBSD hides only localeconv_l() in xlocale.h */
12817  struct lconv *lcbuf = localeconv_l(lc);
12818  printf("decimal: %s\n", lcbuf->decimal_point);
12819#endif
12820
12821  freelocale(lc);
12822  return 0;
12823}
12824EOF
12825	set try
12826	if eval $compile && $run ./try > /dev/null 2>&1 ; then
12827		echo "xlocale.h isn't needed" >&4
12828		xlocale_needed=$undef
12829	else
12830		set try -DTRY_XLOCALE
12831		if eval $compile && $run ./try > /dev/null 2>&1 ; then
12832			xlocale_needed=$define
12833			echo "xlocale.h is needed" >&4
12834		else
12835			echo "I can't build my test either way" >&4
12836			xlocale_needed=$undef
12837		fi
12838	fi
12839	$rm_try
12840	;;
12841*) xlocale_needed=$undef ;;
12842esac
12843
12844: see if eaccess exists
12845set eaccess d_eaccess
12846eval $inlibc
12847
12848: see if endgrent exists
12849set endgrent d_endgrent
12850eval $inlibc
12851
12852: see if this is an grp system
12853set grp.h i_grp
12854eval $inhdr
12855
12856case "$i_grp" in
12857$define)
12858	xxx=`./findhdr grp.h`
12859	$cppstdin $cppflags $cppminus < $xxx >$$.h
12860
12861	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12862		val="$define"
12863	else
12864		val="$undef"
12865	fi
12866	set d_grpasswd
12867	eval $setvar
12868
12869	$rm -f $$.h
12870	;;
12871*)
12872	val="$undef";
12873	set d_grpasswd; eval $setvar
12874	;;
12875esac
12876
12877: see if endgrent_r exists
12878set endgrent_r d_endgrent_r
12879eval $inlibc
12880case "$d_endgrent_r" in
12881"$define")
12882	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12883	case "$d_endgrent_r_proto:$usethreads" in
12884	":define")	d_endgrent_r_proto=define
12885		set d_endgrent_r_proto endgrent_r $hdrs
12886		eval $hasproto ;;
12887	*)	;;
12888	esac
12889	case "$d_endgrent_r_proto" in
12890	define)
12891	case "$endgrent_r_proto" in
12892	''|0) try='int endgrent_r(FILE**);'
12893	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12894	esac
12895	case "$endgrent_r_proto" in
12896	''|0) try='void endgrent_r(FILE**);'
12897	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12898	esac
12899	case "$endgrent_r_proto" in
12900	''|0)	d_endgrent_r=undef
12901		endgrent_r_proto=0
12902		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12903	* )	case "$endgrent_r_proto" in
12904		REENTRANT_PROTO*) ;;
12905		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12906		esac
12907		echo "Prototype: $try" ;;
12908	esac
12909	;;
12910	*)	case "$usethreads" in
12911		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12912		esac
12913		d_endgrent_r=undef
12914		endgrent_r_proto=0
12915		;;
12916	esac
12917	;;
12918*)	endgrent_r_proto=0
12919	;;
12920esac
12921
12922: see if endhostent exists
12923set endhostent d_endhent
12924eval $inlibc
12925
12926: see if this is a netdb.h system
12927set netdb.h i_netdb
12928eval $inhdr
12929
12930: see if endhostent_r exists
12931set endhostent_r d_endhostent_r
12932eval $inlibc
12933case "$d_endhostent_r" in
12934"$define")
12935	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12936	case "$d_endhostent_r_proto:$usethreads" in
12937	":define")	d_endhostent_r_proto=define
12938		set d_endhostent_r_proto endhostent_r $hdrs
12939		eval $hasproto ;;
12940	*)	;;
12941	esac
12942	case "$d_endhostent_r_proto" in
12943	define)
12944	case "$endhostent_r_proto" in
12945	''|0) try='int endhostent_r(struct hostent_data*);'
12946	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12947	esac
12948	case "$endhostent_r_proto" in
12949	''|0) try='void endhostent_r(struct hostent_data*);'
12950	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12951	esac
12952	case "$endhostent_r_proto" in
12953	''|0)	d_endhostent_r=undef
12954		endhostent_r_proto=0
12955		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12956	* )	case "$endhostent_r_proto" in
12957		REENTRANT_PROTO*) ;;
12958		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12959		esac
12960		echo "Prototype: $try" ;;
12961	esac
12962	;;
12963	*)	case "$usethreads" in
12964		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12965		esac
12966		d_endhostent_r=undef
12967		endhostent_r_proto=0
12968		;;
12969	esac
12970	;;
12971*)	endhostent_r_proto=0
12972	;;
12973esac
12974
12975: see if endnetent exists
12976set endnetent d_endnent
12977eval $inlibc
12978
12979: see if endnetent_r exists
12980set endnetent_r d_endnetent_r
12981eval $inlibc
12982case "$d_endnetent_r" in
12983"$define")
12984	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12985	case "$d_endnetent_r_proto:$usethreads" in
12986	":define")	d_endnetent_r_proto=define
12987		set d_endnetent_r_proto endnetent_r $hdrs
12988		eval $hasproto ;;
12989	*)	;;
12990	esac
12991	case "$d_endnetent_r_proto" in
12992	define)
12993	case "$endnetent_r_proto" in
12994	''|0) try='int endnetent_r(struct netent_data*);'
12995	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12996	esac
12997	case "$endnetent_r_proto" in
12998	''|0) try='void endnetent_r(struct netent_data*);'
12999	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13000	esac
13001	case "$endnetent_r_proto" in
13002	''|0)	d_endnetent_r=undef
13003		endnetent_r_proto=0
13004		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13005	* )	case "$endnetent_r_proto" in
13006		REENTRANT_PROTO*) ;;
13007		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13008		esac
13009		echo "Prototype: $try" ;;
13010	esac
13011	;;
13012	*)	case "$usethreads" in
13013		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13014		esac
13015		d_endnetent_r=undef
13016		endnetent_r_proto=0
13017		;;
13018	esac
13019	;;
13020*)	endnetent_r_proto=0
13021	;;
13022esac
13023
13024: see if endprotoent exists
13025set endprotoent d_endpent
13026eval $inlibc
13027
13028: see if endprotoent_r exists
13029set endprotoent_r d_endprotoent_r
13030eval $inlibc
13031case "$d_endprotoent_r" in
13032"$define")
13033	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13034	case "$d_endprotoent_r_proto:$usethreads" in
13035	":define")	d_endprotoent_r_proto=define
13036		set d_endprotoent_r_proto endprotoent_r $hdrs
13037		eval $hasproto ;;
13038	*)	;;
13039	esac
13040	case "$d_endprotoent_r_proto" in
13041	define)
13042	case "$endprotoent_r_proto" in
13043	''|0) try='int endprotoent_r(struct protoent_data*);'
13044	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13045	esac
13046	case "$endprotoent_r_proto" in
13047	''|0) try='void endprotoent_r(struct protoent_data*);'
13048	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13049	esac
13050	case "$endprotoent_r_proto" in
13051	''|0)	d_endprotoent_r=undef
13052		endprotoent_r_proto=0
13053		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13054	* )	case "$endprotoent_r_proto" in
13055		REENTRANT_PROTO*) ;;
13056		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13057		esac
13058		echo "Prototype: $try" ;;
13059	esac
13060	;;
13061	*)	case "$usethreads" in
13062		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13063		esac
13064		d_endprotoent_r=undef
13065		endprotoent_r_proto=0
13066		;;
13067	esac
13068	;;
13069*)	endprotoent_r_proto=0
13070	;;
13071esac
13072
13073: see if endpwent exists
13074set endpwent d_endpwent
13075eval $inlibc
13076
13077: see if this is a pwd.h system
13078set pwd.h i_pwd
13079eval $inhdr
13080
13081case "$i_pwd" in
13082$define)
13083	xxx=`./findhdr pwd.h`
13084	$cppstdin $cppflags $cppminus < $xxx >$$.h
13085
13086	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13087		val="$define"
13088	else
13089		val="$undef"
13090	fi
13091	set d_pwquota
13092	eval $setvar
13093
13094	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13095		val="$define"
13096	else
13097		val="$undef"
13098	fi
13099	set d_pwage
13100	eval $setvar
13101
13102	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13103		val="$define"
13104	else
13105		val="$undef"
13106	fi
13107	set d_pwchange
13108	eval $setvar
13109
13110	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13111		val="$define"
13112	else
13113		val="$undef"
13114	fi
13115	set d_pwclass
13116	eval $setvar
13117
13118	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13119		val="$define"
13120	else
13121		val="$undef"
13122	fi
13123	set d_pwexpire
13124	eval $setvar
13125
13126	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13127		val="$define"
13128	else
13129		val="$undef"
13130	fi
13131	set d_pwcomment
13132	eval $setvar
13133
13134	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13135		val="$define"
13136	else
13137		val="$undef"
13138	fi
13139	set d_pwgecos
13140	eval $setvar
13141
13142	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13143		val="$define"
13144	else
13145		val="$undef"
13146	fi
13147	set d_pwpasswd
13148	eval $setvar
13149
13150	$rm -f $$.h
13151	;;
13152*)
13153	val="$undef";
13154	set d_pwquota; eval $setvar
13155	set d_pwage; eval $setvar
13156	set d_pwchange; eval $setvar
13157	set d_pwclass; eval $setvar
13158	set d_pwexpire; eval $setvar
13159	set d_pwcomment; eval $setvar
13160	set d_pwgecos; eval $setvar
13161	set d_pwpasswd; eval $setvar
13162	;;
13163esac
13164
13165: see if endpwent_r exists
13166set endpwent_r d_endpwent_r
13167eval $inlibc
13168case "$d_endpwent_r" in
13169"$define")
13170	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13171	case "$d_endpwent_r_proto:$usethreads" in
13172	":define")	d_endpwent_r_proto=define
13173		set d_endpwent_r_proto endpwent_r $hdrs
13174		eval $hasproto ;;
13175	*)	;;
13176	esac
13177	case "$d_endpwent_r_proto" in
13178	define)
13179	case "$endpwent_r_proto" in
13180	''|0) try='int endpwent_r(FILE**);'
13181	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13182	esac
13183	case "$endpwent_r_proto" in
13184	''|0) try='void endpwent_r(FILE**);'
13185	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13186	esac
13187	case "$endpwent_r_proto" in
13188	''|0)	d_endpwent_r=undef
13189		endpwent_r_proto=0
13190		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13191	* )	case "$endpwent_r_proto" in
13192		REENTRANT_PROTO*) ;;
13193		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13194		esac
13195		echo "Prototype: $try" ;;
13196	esac
13197	;;
13198	*)	case "$usethreads" in
13199		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13200		esac
13201		d_endpwent_r=undef
13202		endpwent_r_proto=0
13203		;;
13204	esac
13205	;;
13206*)	endpwent_r_proto=0
13207	;;
13208esac
13209
13210: see if endservent exists
13211set endservent d_endsent
13212eval $inlibc
13213
13214: see if endservent_r exists
13215set endservent_r d_endservent_r
13216eval $inlibc
13217case "$d_endservent_r" in
13218"$define")
13219	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13220	case "$d_endservent_r_proto:$usethreads" in
13221	":define")	d_endservent_r_proto=define
13222		set d_endservent_r_proto endservent_r $hdrs
13223		eval $hasproto ;;
13224	*)	;;
13225	esac
13226	case "$d_endservent_r_proto" in
13227	define)
13228	case "$endservent_r_proto" in
13229	''|0) try='int endservent_r(struct servent_data*);'
13230	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13231	esac
13232	case "$endservent_r_proto" in
13233	''|0) try='void endservent_r(struct servent_data*);'
13234	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13235	esac
13236	case "$endservent_r_proto" in
13237	''|0)	d_endservent_r=undef
13238		endservent_r_proto=0
13239		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13240	* )	case "$endservent_r_proto" in
13241		REENTRANT_PROTO*) ;;
13242		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13243		esac
13244		echo "Prototype: $try" ;;
13245	esac
13246	;;
13247	*)	case "$usethreads" in
13248		define) echo "endservent_r has no prototype, not using it." >&4 ;;
13249		esac
13250		d_endservent_r=undef
13251		endservent_r_proto=0
13252		;;
13253	esac
13254	;;
13255*)	endservent_r_proto=0
13256	;;
13257esac
13258
13259: Locate the flags for 'open()'
13260echo " "
13261$cat >try.c <<EOCP
13262#include <sys/types.h>
13263#ifdef I_FCNTL
13264#include <fcntl.h>
13265#endif
13266#ifdef I_SYS_FILE
13267#include <sys/file.h>
13268#endif
13269#$i_stdlib I_STDLIB
13270#ifdef I_STDLIB
13271#include <stdlib.h>
13272#endif
13273int main() {
13274	if(O_RDONLY);
13275#ifdef O_TRUNC
13276	exit(0);
13277#else
13278	exit(1);
13279#endif
13280}
13281EOCP
13282: check sys/file.h first to get FREAD on Sun
13283if $test `./findhdr sys/file.h` && \
13284		set try -DI_SYS_FILE && eval $compile; then
13285	h_sysfile=true;
13286	echo "<sys/file.h> defines the O_* constants..." >&4
13287	if $run ./try; then
13288		echo "and you have the 3 argument form of open()." >&4
13289		val="$define"
13290	else
13291		echo "but not the 3 argument form of open().  Oh, well." >&4
13292		val="$undef"
13293	fi
13294elif $test `./findhdr fcntl.h` && \
13295		set try -DI_FCNTL && eval $compile; then
13296	h_fcntl=true;
13297	echo "<fcntl.h> defines the O_* constants..." >&4
13298	if $run ./try; then
13299		echo "and you have the 3 argument form of open()." >&4
13300		val="$define"
13301	else
13302		echo "but not the 3 argument form of open().  Oh, well." >&4
13303		val="$undef"
13304	fi
13305else
13306	val="$undef"
13307	echo "I can't find the O_* constant definitions!  You got problems." >&4
13308fi
13309set d_open3
13310eval $setvar
13311$rm_try
13312
13313: see if this is a sys/file.h system
13314val=''
13315set sys/file.h val
13316eval $inhdr
13317
13318: do we need to include sys/file.h ?
13319case "$val" in
13320"$define")
13321	echo " "
13322	if $h_sysfile; then
13323		val="$define"
13324		echo "We'll be including <sys/file.h>." >&4
13325	else
13326		val="$undef"
13327		echo "We won't be including <sys/file.h>." >&4
13328	fi
13329	;;
13330*)
13331	h_sysfile=false
13332	;;
13333esac
13334set i_sysfile
13335eval $setvar
13336
13337: see if fcntl.h is there
13338val=''
13339set fcntl.h val
13340eval $inhdr
13341
13342: see if we can include fcntl.h
13343case "$val" in
13344"$define")
13345	echo " "
13346	if $h_fcntl; then
13347		val="$define"
13348		echo "We'll be including <fcntl.h>." >&4
13349	else
13350		val="$undef"
13351		if $h_sysfile; then
13352	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13353		else
13354			echo "We won't be including <fcntl.h>." >&4
13355		fi
13356	fi
13357	;;
13358*)
13359	h_fcntl=false
13360	val="$undef"
13361	;;
13362esac
13363set i_fcntl
13364eval $setvar
13365
13366: see if fork exists
13367set fork d_fork
13368eval $inlibc
13369
13370: see if pipe exists
13371set pipe d_pipe
13372eval $inlibc
13373
13374: check for non-blocking I/O stuff
13375case "$h_sysfile" in
13376true) echo "#include <sys/file.h>" > head.c;;
13377*)
13378       case "$h_fcntl" in
13379       true) echo "#include <fcntl.h>" > head.c;;
13380       *) echo "#include <sys/fcntl.h>" > head.c;;
13381       esac
13382       ;;
13383esac
13384echo " "
13385echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13386case "$o_nonblock" in
13387'')
13388	$cat head.c > try.c
13389	$cat >>try.c <<EOCP
13390#include <stdio.h>
13391#$i_stdlib I_STDLIB
13392#ifdef I_STDLIB
13393#include <stdlib.h>
13394#endif
13395#$i_fcntl I_FCNTL
13396#ifdef I_FCNTL
13397#include <fcntl.h>
13398#endif
13399int main() {
13400#ifdef O_NONBLOCK
13401	printf("O_NONBLOCK\n");
13402	exit(0);
13403#endif
13404#ifdef O_NDELAY
13405	printf("O_NDELAY\n");
13406	exit(0);
13407#endif
13408#ifdef FNDELAY
13409	printf("FNDELAY\n");
13410	exit(0);
13411#endif
13412	exit(0);
13413}
13414EOCP
13415	set try
13416	if eval $compile_ok; then
13417		o_nonblock=`$run ./try`
13418		case "$o_nonblock" in
13419		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13420		*) echo "Seems like we can use $o_nonblock.";;
13421		esac
13422	else
13423		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13424	fi
13425	;;
13426*) echo "Using $hint value $o_nonblock.";;
13427esac
13428$rm_try
13429
13430echo " "
13431echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13432case "$eagain" in
13433'')
13434	case "$d_fork:$d_pipe:$d_alarm" in
13435	define:define:define)
13436	$cat head.c > try.c
13437	$cat >>try.c <<EOCP
13438#include <errno.h>
13439#include <sys/types.h>
13440#include <signal.h>
13441#include <stdio.h>
13442#$i_stdlib I_STDLIB
13443#ifdef I_STDLIB
13444#include <stdlib.h>
13445#endif
13446#$i_fcntl I_FCNTL
13447#ifdef I_FCNTL
13448#include <fcntl.h>
13449#endif
13450#define MY_O_NONBLOCK $o_nonblock
13451#ifndef errno  /* XXX need better Configure test */
13452extern int errno;
13453#endif
13454#$i_unistd I_UNISTD
13455#ifdef I_UNISTD
13456#include <unistd.h>
13457#endif
13458#include <string.h>
13459$signal_t blech(int x) { exit(3); }
13460EOCP
13461	$cat >> try.c <<'EOCP'
13462int main()
13463{
13464	int pd[2];
13465	int pu[2];
13466	char buf[1];
13467	char string[100];
13468	int ret;
13469
13470	ret = pipe(pd);	/* Down: child -> parent */
13471	if (ret != 0)
13472		exit(3);
13473	ret = pipe(pu);	/* Up: parent -> child */
13474	if (ret != 0)
13475		exit(3);
13476	if (0 != fork()) {
13477		close(pd[1]);	/* Parent reads from pd[0] */
13478		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
13479#ifdef F_SETFL
13480		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13481			exit(1);
13482#else
13483		exit(4);
13484#endif
13485		signal(SIGALRM, blech);
13486		alarm(5);
13487		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
13488			exit(2);
13489		sprintf(string, "%d\n", ret);
13490		ret = write(2, string, strlen(string));
13491		if (ret != strlen(string))
13492			exit(3);
13493		alarm(0);
13494#ifdef EAGAIN
13495		if (errno == EAGAIN) {
13496			printf("EAGAIN\n");
13497			goto ok;
13498		}
13499#endif
13500#ifdef EWOULDBLOCK
13501		if (errno == EWOULDBLOCK)
13502			printf("EWOULDBLOCK\n");
13503#endif
13504	ok:
13505		ret = write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
13506		if (ret != 1)
13507			exit(3);
13508		sleep(2);				/* Give it time to close our pipe */
13509		alarm(5);
13510		ret = read(pd[0], buf, 1);	/* Should read EOF */
13511		alarm(0);
13512		sprintf(string, "%d\n", ret);
13513		ret = write(4, string, strlen(string));
13514		if (ret != strlen(string))
13515			exit(3);
13516		exit(0);
13517	}
13518
13519	close(pd[0]);			/* We write to pd[1] */
13520	close(pu[1]);			/* We read from pu[0] */
13521	ret = read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
13522	if (ret != 1)
13523		exit(3);
13524	close(pd[1]);			/* Pipe pd is now fully closed! */
13525	exit(0);				/* Bye bye, thank you for playing! */
13526}
13527EOCP
13528	set try
13529	if eval $compile_ok; then
13530		echo "$startsh" >mtry
13531		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13532		chmod +x mtry
13533		$run ./mtry >/dev/null 2>&1
13534		case $? in
13535		0) eagain=`$cat try.out`;;
13536		1) echo "Could not perform non-blocking setting!";;
13537		2) echo "I did a successful read() for something that was not there!";;
13538		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13539		4) echo "Could not find F_SETFL!";;
13540		*) echo "Something terribly wrong happened during testing.";;
13541		esac
13542		rd_nodata=`$cat try.ret`
13543		echo "A read() system call with no data present returns $rd_nodata."
13544		case "$rd_nodata" in
13545		0|-1) ;;
13546		*)
13547			echo "(That's peculiar, fixing that to be -1.)"
13548			rd_nodata=-1
13549			;;
13550		esac
13551		case "$eagain" in
13552		'')
13553			echo "Forcing errno EAGAIN on read() with no data available."
13554			eagain=EAGAIN
13555			;;
13556		*)
13557			echo "Your read() sets errno to $eagain when no data is available."
13558			;;
13559		esac
13560		status=`$cat try.err`
13561		case "$status" in
13562		0) echo "And it correctly returns 0 to signal EOF.";;
13563		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
13564		*) echo "However, your read() returns '$status' on EOF??";;
13565		esac
13566		val="$define"
13567		if test "$status" = "$rd_nodata"; then
13568			echo "WARNING: you can't distinguish between EOF and no data!"
13569			val="$undef"
13570		fi
13571	else
13572		echo "I can't compile the test program--assuming errno EAGAIN will do."
13573		eagain=EAGAIN
13574	fi
13575	;;
13576	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13577		eagain=EAGAIN
13578		val="$define"
13579		;;
13580	esac
13581	set d_eofnblk
13582	eval $setvar
13583	;;
13584*)
13585	echo "Using $hint value $eagain."
13586	echo "Your read() returns $rd_nodata when no data is present."
13587	case "$d_eofnblk" in
13588	"$define") echo "And you can see EOF because read() returns 0.";;
13589	"$undef") echo "But you can't see EOF status from read() returned value.";;
13590	*)
13591		echo "(Assuming you can't see EOF status from read anyway.)"
13592		d_eofnblk=$undef
13593		;;
13594	esac
13595	;;
13596esac
13597$rm_try head.c mtry
13598
13599: see if erf exists
13600set erf d_erf
13601eval $inlibc
13602
13603: see if erfc exists
13604set erfc d_erfc
13605eval $inlibc
13606
13607: see if exp2 exists
13608set exp2 d_exp2
13609eval $inlibc
13610
13611: see if expm1 exists
13612set expm1 d_expm1
13613eval $inlibc
13614
13615: see if _ptr and _cnt from stdio act std
13616echo " "
13617
13618if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13619	echo "(Looks like you have stdio.h from BSD.)"
13620	case "$stdio_ptr" in
13621	'') stdio_ptr='((fp)->_p)'
13622		ptr_lval=$define
13623		;;
13624	*)	ptr_lval=$d_stdio_ptr_lval;;
13625	esac
13626	case "$stdio_cnt" in
13627	'') stdio_cnt='((fp)->_r)'
13628		cnt_lval=$define
13629		;;
13630	*)	cnt_lval=$d_stdio_cnt_lval;;
13631	esac
13632	case "$stdio_base" in
13633	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13634	esac
13635	case "$stdio_bufsiz" in
13636	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13637	esac
13638elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13639	echo "(Looks like you have stdio.h from Linux.)"
13640	case "$stdio_ptr" in
13641	'') stdio_ptr='((fp)->_IO_read_ptr)'
13642		ptr_lval=$define
13643		;;
13644	*)	ptr_lval=$d_stdio_ptr_lval;;
13645	esac
13646	case "$stdio_cnt" in
13647	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13648		cnt_lval=$undef
13649		;;
13650	*)	cnt_lval=$d_stdio_cnt_lval;;
13651	esac
13652	case "$stdio_base" in
13653	'') stdio_base='((fp)->_IO_read_base)';;
13654	esac
13655	case "$stdio_bufsiz" in
13656	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13657	esac
13658else
13659	case "$stdio_ptr" in
13660	'') stdio_ptr='((fp)->_ptr)'
13661		ptr_lval=$define
13662		;;
13663	*)	ptr_lval=$d_stdio_ptr_lval;;
13664	esac
13665	case "$stdio_cnt" in
13666	'') stdio_cnt='((fp)->_cnt)'
13667		cnt_lval=$define
13668		;;
13669	*)	cnt_lval=$d_stdio_cnt_lval;;
13670	esac
13671	case "$stdio_base" in
13672	'') stdio_base='((fp)->_base)';;
13673	esac
13674	case "$stdio_bufsiz" in
13675	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13676	esac
13677fi
13678
13679: test whether _ptr and _cnt really work
13680echo "Checking how std your stdio is..." >&4
13681$cat >try.c <<EOP
13682#include <stdio.h>
13683#$i_stdlib I_STDLIB
13684#ifdef I_STDLIB
13685#include <stdlib.h>
13686#endif
13687#include <string.h>
13688#define FILE_ptr(fp)	$stdio_ptr
13689#define FILE_cnt(fp)	$stdio_cnt
13690int main() {
13691	FILE *fp = fopen("try.c", "r");
13692	char c = getc(fp);
13693	if (
13694		18 <= FILE_cnt(fp) &&
13695		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13696	)
13697		exit(0);
13698	exit(1);
13699}
13700EOP
13701val="$undef"
13702set try
13703if eval $compile && $to try.c; then
13704	if $run ./try; then
13705		echo "Your stdio acts pretty std."
13706		val="$define"
13707	else
13708		echo "Your stdio isn't very std."
13709	fi
13710else
13711	echo "Your stdio doesn't appear very std."
13712fi
13713$rm_try
13714
13715# glibc 2.2.90 and above apparently change stdio streams so Perl's
13716# direct buffer manipulation no longer works.  The Configure tests
13717# should be changed to correctly detect this, but until then,
13718# the following check should at least let perl compile and run.
13719# (This quick fix should be updated before 5.8.1.)
13720# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13721# A. Dougherty, June 3, 2002.
13722case "$d_gnulibc" in
13723$define)
13724	case "$gnulibc_version" in
13725	2.[01]*)  ;;
13726	2.2) ;;
13727	2.2.[0-9]) ;;
13728	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13729		val="$undef"
13730		;;
13731	esac
13732	;;
13733esac
13734set d_stdstdio
13735eval $setvar
13736
13737: Can _ptr be used as an lvalue?
13738case "$d_stdstdio$ptr_lval" in
13739$define$define) val=$define ;;
13740*) val=$undef ;;
13741esac
13742set d_stdio_ptr_lval
13743eval $setvar
13744
13745: Can _cnt be used as an lvalue?
13746case "$d_stdstdio$cnt_lval" in
13747$define$define) val=$define ;;
13748*) val=$undef ;;
13749esac
13750set d_stdio_cnt_lval
13751eval $setvar
13752
13753
13754: test whether setting _ptr sets _cnt as a side effect
13755d_stdio_ptr_lval_sets_cnt="$undef"
13756d_stdio_ptr_lval_nochange_cnt="$undef"
13757case "$d_stdio_ptr_lval$d_stdstdio" in
13758$define$define)
13759	echo "Checking to see what happens if we set the stdio ptr..." >&4
13760$cat >try.c <<EOP
13761#include <stdio.h>
13762/* Can we scream? */
13763/* Eat dust sed :-) */
13764/* In the buffer space, no one can hear you scream. */
13765#$i_stdlib I_STDLIB
13766#ifdef I_STDLIB
13767#include <stdlib.h>
13768#endif
13769#define FILE_ptr(fp)	$stdio_ptr
13770#define FILE_cnt(fp)	$stdio_cnt
13771#include <sys/types.h>
13772int main() {
13773	FILE *fp = fopen("try.c", "r");
13774	int c;
13775	char *ptr;
13776	size_t cnt;
13777	if (!fp) {
13778	    puts("Fail even to read");
13779	    exit(1);
13780	}
13781	c = getc(fp); /* Read away the first # */
13782	if (c == EOF) {
13783	    puts("Fail even to read");
13784	    exit(1);
13785	}
13786	if (!(
13787		18 <= FILE_cnt(fp) &&
13788		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13789	)) {
13790		puts("Fail even to read");
13791		exit (1);
13792	}
13793	ptr = (char*) FILE_ptr(fp);
13794	cnt = (size_t)FILE_cnt(fp);
13795
13796	FILE_ptr(fp) += 42;
13797
13798	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13799		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13800		exit (1);
13801	}
13802	if (FILE_cnt(fp) <= 20) {
13803		printf ("Fail (<20 chars to test)");
13804		exit (1);
13805	}
13806	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13807		puts("Fail compare");
13808		exit (1);
13809	}
13810	if (cnt == FILE_cnt(fp)) {
13811		puts("Pass_unchanged");
13812		exit (0);
13813	}
13814	if (FILE_cnt(fp) == (cnt - 42)) {
13815		puts("Pass_changed");
13816		exit (0);
13817	}
13818	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13819	return 1;
13820
13821}
13822EOP
13823	set try
13824	if eval $compile && $to try.c; then
13825		case `$run ./try` in
13826		Pass_changed)
13827			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13828			d_stdio_ptr_lval_sets_cnt="$define" ;;
13829		Pass_unchanged)
13830			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13831			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13832		Fail*)
13833			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13834		*)
13835			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13836	esac
13837	else
13838		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13839	fi
13840	$rm_try
13841	;;
13842esac
13843
13844: see if _base is also standard
13845val="$undef"
13846case "$d_stdstdio" in
13847$define)
13848	$cat >try.c <<EOP
13849#include <stdio.h>
13850#$i_stdlib I_STDLIB
13851#ifdef I_STDLIB
13852#include <stdlib.h>
13853#endif
13854#define FILE_base(fp)	$stdio_base
13855#define FILE_bufsiz(fp)	$stdio_bufsiz
13856int main() {
13857	FILE *fp = fopen("try.c", "r");
13858	char c = getc(fp);
13859	if (
13860		19 <= FILE_bufsiz(fp) &&
13861		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13862	)
13863		exit(0);
13864	exit(1);
13865}
13866EOP
13867	set try
13868	if eval $compile && $to try.c; then
13869		if $run ./try; then
13870			echo "And its _base field acts std."
13871			val="$define"
13872		else
13873			echo "But its _base field isn't std."
13874		fi
13875	else
13876		echo "However, it seems to be lacking the _base field."
13877	fi
13878	$rm_try
13879	;;
13880esac
13881set d_stdiobase
13882eval $setvar
13883
13884: see if fast_stdio exists
13885val="$undef"
13886case "$d_stdstdio:$d_stdio_ptr_lval" in
13887"$define:$define")
13888	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13889	*$define*)
13890		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13891		val="$define"
13892		;;
13893	esac
13894	;;
13895esac
13896set d_faststdio
13897eval $setvar
13898
13899: see if fchdir exists
13900set fchdir d_fchdir
13901eval $inlibc
13902
13903: see if fchmod exists
13904set fchmod d_fchmod
13905eval $inlibc
13906
13907: check for openat, unlinkat, renameat, linkat, fchmodat
13908set openat d_openat
13909eval $inlibc
13910
13911set unlinkat d_unlinkat
13912eval $inlibc
13913
13914set renameat d_renameat
13915eval $inlibc
13916
13917set linkat d_linkat
13918eval $inlibc
13919
13920set fchmodat d_fchmodat
13921eval $inlibc
13922
13923: see if fchown exists
13924set fchown d_fchown
13925eval $inlibc
13926
13927: see if this is an fcntl system
13928set fcntl d_fcntl
13929eval $inlibc
13930
13931: See if fcntl-based locking works.
13932echo " "
13933$cat >try.c <<EOCP
13934#$i_stdlib I_STDLIB
13935#ifdef I_STDLIB
13936#include <stdlib.h>
13937#endif
13938#include <unistd.h>
13939#include <fcntl.h>
13940#include <signal.h>
13941$signal_t blech(int x) { exit(3); }
13942int main() {
13943#if defined(F_SETLK) && defined(F_SETLKW)
13944     struct flock flock;
13945     int retval, fd;
13946     fd = open("try.c", O_RDONLY);
13947     flock.l_type = F_RDLCK;
13948     flock.l_whence = SEEK_SET;
13949     flock.l_start = flock.l_len = 0;
13950     signal(SIGALRM, blech);
13951     alarm(10);
13952     retval = fcntl(fd, F_SETLK, &flock);
13953     close(fd);
13954     (retval < 0 ? exit(2) : exit(0));
13955#else
13956     exit(2);
13957#endif
13958}
13959EOCP
13960echo "Checking if fcntl-based file locking works... "
13961case "$d_fcntl" in
13962"$define")
13963	set try
13964	if eval $compile_ok; then
13965		if $run ./try; then
13966			echo "Yes, it seems to work."
13967			val="$define"
13968		else
13969			echo "Nope, it didn't work."
13970			val="$undef"
13971			case "$?" in
13972			3) $cat >&4 <<EOM
13973***
13974*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13975*** This is (almost) impossible.
13976*** If your NFS lock daemons are not feeling well, something like
13977*** this may happen, please investigate.  Cannot continue, aborting.
13978***
13979EOM
13980				exit 1
13981				;;
13982			esac
13983		fi
13984	else
13985		echo "I'm unable to compile the test program, so I'll assume not."
13986		val="$undef"
13987	fi
13988	;;
13989*) val="$undef";
13990	echo "Nope, since you don't even have fcntl()."
13991	;;
13992esac
13993set d_fcntl_can_lock
13994eval $setvar
13995$rm_try
13996
13997: check for fd_set items
13998$cat <<EOM
13999
14000Checking to see how well your C compiler handles fd_set and friends ...
14001EOM
14002$cat >try.c <<EOCP
14003#$i_stdlib I_STDLIB
14004#ifdef I_STDLIB
14005#include <stdlib.h>
14006#endif
14007#$i_systime I_SYS_TIME
14008#$i_sysselct I_SYS_SELECT
14009#$d_socket HAS_SOCKET
14010#include <sys/types.h>
14011#ifdef HAS_SOCKET
14012#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14013#endif
14014#ifdef I_SYS_TIME
14015#include <sys/time.h>
14016#endif
14017#ifdef I_SYS_SELECT
14018#include <sys/select.h>
14019#endif
14020int main() {
14021	fd_set fds;
14022
14023#ifdef TRYBITS
14024	if(fds.fds_bits);
14025#endif
14026
14027#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14028	exit(0);
14029#else
14030	exit(1);
14031#endif
14032}
14033EOCP
14034set try -DTRYBITS
14035if eval $compile; then
14036	d_fds_bits="$define"
14037	d_fd_set="$define"
14038	echo "Well, your system knows about the normal fd_set typedef..." >&4
14039	if $run ./try; then
14040		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14041		d_fd_macros="$define"
14042	else
14043		$cat >&4 <<'EOM'
14044but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14045EOM
14046		d_fd_macros="$undef"
14047	fi
14048else
14049	$cat <<'EOM'
14050Hmm, your compiler has some difficulty with fd_set.  Checking further...
14051EOM
14052	set try
14053	if eval $compile; then
14054		d_fds_bits="$undef"
14055		d_fd_set="$define"
14056		echo "Well, your system has some sort of fd_set available..." >&4
14057		if $run ./try; then
14058			echo "and you have the normal fd_set macros." >&4
14059			d_fd_macros="$define"
14060		else
14061			$cat <<'EOM'
14062but not the normal fd_set macros!  Gross!  More work for me...
14063EOM
14064			d_fd_macros="$undef"
14065		fi
14066	else
14067	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14068		d_fd_set="$undef"
14069		d_fds_bits="$undef"
14070		d_fd_macros="$undef"
14071	fi
14072fi
14073$rm_try
14074
14075: see if fdclose exists
14076set fdclose d_fdclose
14077eval $inlibc
14078
14079: see if fdim exists
14080set fdim d_fdim
14081eval $inlibc
14082
14083: see if fegetround exists
14084set fegetround d_fegetround
14085eval $inlibc
14086
14087: see if ffs exists
14088set ffs d_ffs
14089eval $inlibc
14090: see if ffsl exists
14091set ffsl d_ffsl
14092eval $inlibc
14093
14094: see if fgetpos exists
14095set fgetpos d_fgetpos
14096eval $inlibc
14097
14098: see if finite exists
14099set finite d_finite
14100eval $inlibc
14101
14102: see if finitel exists
14103set finitel d_finitel
14104eval $inlibc
14105
14106: see if flock exists
14107set flock d_flock
14108eval $inlibc
14109
14110: see if prototype for flock is available
14111echo " "
14112set d_flockproto flock $i_sysfile sys/file.h
14113eval $hasproto
14114
14115: see if fma exists
14116set fma d_fma
14117eval $inlibc
14118
14119: see if fmax exists
14120set fmax d_fmax
14121eval $inlibc
14122
14123: see if fmin exists
14124set fmin d_fmin
14125eval $inlibc
14126
14127: see if fp_class exists
14128set fp_class d_fp_class
14129eval $inlibc
14130
14131: check for fpclassify
14132echo "Checking to see if you have fpclassify..." >&4
14133$cat >try.c <<EOCP
14134#include <math.h>
14135int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14136EOCP
14137set try
14138if eval $compile; then
14139	val="$define"
14140	echo "You have fpclassify."
14141else
14142	val="$undef"
14143	echo "You do not have fpclassify."
14144fi
14145$rm_try
14146set d_fpclassify
14147eval $setvar
14148
14149: see if fp_classify exists
14150set fp_classify d_fp_classify
14151eval $inlibc
14152
14153: see if fp_classl exists
14154set fp_classl d_fp_classl
14155eval $inlibc
14156
14157: see if pathconf exists
14158set pathconf d_pathconf
14159eval $inlibc
14160
14161: see if fpathconf exists
14162set fpathconf d_fpathconf
14163eval $inlibc
14164
14165: see if fpclass exists
14166set fpclass d_fpclass
14167eval $inlibc
14168
14169: see if fpclassl exists
14170set fpclassl d_fpclassl
14171eval $inlibc
14172
14173: see if fpgetround exists
14174set fpgetround d_fpgetround
14175eval $inlibc
14176
14177: check for fpos64_t
14178echo " "
14179echo "Checking to see if you have fpos64_t..." >&4
14180$cat >try.c <<EOCP
14181#include <stdio.h>
14182int main() { fpos64_t x = 7; }
14183EOCP
14184set try
14185if eval $compile; then
14186	val="$define"
14187	echo "You have fpos64_t."
14188else
14189	val="$undef"
14190	echo "You do not have fpos64_t."
14191	case "$fpossize" in
14192	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14193	esac
14194fi
14195$rm_try
14196set d_fpos64_t
14197eval $setvar
14198
14199: see if frexpl exists
14200set frexpl d_frexpl
14201eval $inlibc
14202
14203: see if this is a sys/param system
14204set sys/param.h i_sysparam
14205eval $inhdr
14206
14207: see if this is a sys/mount.h system
14208set sys/mount.h i_sysmount
14209eval $inhdr
14210
14211: Check for fs_data_s
14212echo " "
14213echo "Checking to see if your system supports struct fs_data..." >&4
14214set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14215eval $hasstruct
14216case "$d_fs_data_s" in
14217"$define")      echo "Yes, it does."   ;;
14218*)              echo "No, it doesn't." ;;
14219esac
14220
14221: see if fseeko exists
14222set fseeko d_fseeko
14223eval $inlibc
14224case "$longsize" in
142258) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14226esac
14227
14228: see if fsetpos exists
14229set fsetpos d_fsetpos
14230eval $inlibc
14231
14232: see if fstatfs exists
14233set fstatfs d_fstatfs
14234eval $inlibc
14235
14236: see if statvfs exists
14237set statvfs d_statvfs
14238eval $inlibc
14239
14240: see if fstatvfs exists
14241set fstatvfs d_fstatvfs
14242eval $inlibc
14243
14244: see if fsync exists
14245set fsync d_fsync
14246eval $inlibc
14247
14248: see if ftello exists
14249set ftello d_ftello
14250eval $inlibc
14251case "$longsize" in
142528) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14253esac
14254
14255: check for a working futimes
14256d_futimes="$undef"
14257echo " "
14258echo "Checking if you have a working futimes()" >&4
14259$cat >try.c <<EOCP
14260#include <stdio.h>
14261#include <stdlib.h>
14262#include <sys/time.h>
14263#include <errno.h>
14264#include <fcntl.h>
14265#include <stdlib.h>
14266
14267int main ()
14268{
14269    int fd, rv;
14270    fd = open ("try.c", O_RDWR);
14271    if (-1 == fd) exit (1);
14272    rv = futimes (fd, NULL);
14273    exit (rv == -1 ? errno : 0);
14274}
14275EOCP
14276set try
14277if eval $compile; then
14278    `$run ./try`
14279    rc=$?
14280    case "$rc" in
14281	0)  echo "Yes, you have" >&4
14282	    d_futimes="$define"
14283	    ;;
14284	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14285	    ;;
14286    esac
14287else
14288    echo "No, it does not (probably harmless)" >&4
14289fi
14290$rm_try
14291
14292: look for gai_strerror
14293echo " "
14294$cat >try.c <<'EOCP'
14295#include <sys/types.h>
14296#include <sys/socket.h>
14297#include <netdb.h>
14298int main ()
14299{
14300    return (gai_strerror (0) ? 0 : 1);
14301    }
14302EOCP
14303set try
14304val="$undef"
14305if eval $compile; then
14306    `$run ./try`
14307    case "$?" in
14308	0)  echo "A working gai_strerror() found." >&4
14309	    val="$define" ;;
14310	*)  echo "gai_strerror() found, but it doesn't work" >&4
14311	    ;;
14312	esac
14313else
14314    echo "gai_strerror() NOT found." >&4
14315    fi
14316set d_gai_strerror
14317eval $setvar
14318$rm_try
14319
14320: see if ndbm.h is available
14321set ndbm.h i_ndbm
14322eval $inhdr
14323: Compatibility location for RedHat 7.1
14324set gdbm/ndbm.h i_gdbmndbm
14325eval $inhdr
14326: Compatibility location for Debian 4.0
14327set gdbm-ndbm.h i_gdbm_ndbm
14328eval $inhdr
14329
14330val="$undef"
14331if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14332	: see if dbm_open exists
14333	set dbm_open d_dbm_open
14334	eval $inlibc
14335	case "$d_dbm_open" in
14336	$undef)
14337		i_ndbm="$undef"
14338		i_gdbmndbm="$undef"
14339		i_gdbm_ndbm="$undef"
14340		echo "We won't be including <ndbm.h>"
14341		val="$undef"
14342		;;
14343	*) val="$define"
14344	   ;;
14345	esac
14346fi
14347set d_ndbm
14348eval $setvar
14349
14350ndbm_hdr_protochk='name=$1; hdr=$2;
14351eval "ihdr=\$""i_$name";
14352val="$undef";
14353if $test "$ihdr" = "$define"; then
14354	$echo "Checking if your <$hdr> uses prototypes..." >&4;
14355	case "$d_cplusplus" in
14356	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14357	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14358	esac;
14359	case "$val" in
14360	$define) $echo "Your <$hdr> seems to have prototypes";;
14361	*) $echo "Your <$hdr> does not seem to have prototypes";;
14362	esac;
14363fi;
14364set "d_${name}_h_uses_prototypes";
14365eval $setvar'
14366
14367set ndbm ndbm.h
14368eval $ndbm_hdr_protochk
14369set gdbmndbm gdbm/ndbm.h
14370eval $ndbm_hdr_protochk
14371set gdbm_ndbm gdbm-ndbm.h
14372eval $ndbm_hdr_protochk
14373
14374: see if getaddrinfo exists
14375set getaddrinfo d_getaddrinfo
14376eval $inlibc
14377
14378: see if getcwd exists
14379set getcwd d_getcwd
14380eval $inlibc
14381
14382: check for getenv behavior
14383case "$d_getenv_preserves_other_thread" in
14384'')
14385$echo "Checking to see if getenv() preserves a different thread's results" >&4
14386$cat >try.c <<EOCP
14387#$i_stdlib I_STDLIB
14388#ifdef I_STDLIB
14389#  include <stdlib.h>
14390#endif
14391#include <stdio.h>
14392#include <string.h>
14393#$i_pthread I_PTHREAD
14394#ifdef I_PTHREAD
14395#  include <pthread.h>
14396#endif
14397
14398void *
14399thread_start(void * arg)
14400{
14401    return (void *) getenv("HOME");
14402}
14403
14404int main() {
14405    char * main_buffer;
14406    char save_main_buffer[1000];
14407    pthread_t subthread;
14408    pthread_attr_t attr;
14409
14410    main_buffer = getenv("PATH");
14411
14412    /* If too large for our generous allowance, return we couldn't figure it
14413     * out. */
14414    if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14415        exit(2);
14416    }
14417
14418    strcpy(save_main_buffer, main_buffer);
14419
14420    if (pthread_attr_init(&attr) != 0) {
14421        exit(2);
14422    }
14423
14424    if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14425        exit(2);
14426    }
14427
14428    if (pthread_join(subthread, NULL) != 0) {
14429        exit(2);
14430    }
14431
14432    exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14433}
14434EOCP
14435val=
14436set try
14437if eval $compile_ok; then
14438    $run ./try
14439    rc=$?
14440    case "$rc" in
14441	0) echo "getenv() didn't destroy another thread's buffer" >&4
14442	   val=$define
14443	   ;;
14444	1) echo "getenv() does destroy another thread's buffer" >&4
14445	   val=$undef
14446	   ;;
14447	*) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14448	   val=$undef
14449	   ;;
14450    esac
14451else
14452    echo "(I can't seem to compile the test program.)" >&4
14453    echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14454    val=$undef
14455fi
14456set d_getenv_preserves_other_thread
14457eval $setvar
14458$rm_try
14459;;
14460esac
14461
14462: see if getespwnam exists
14463set getespwnam d_getespwnam
14464eval $inlibc
14465
14466: see if getfsstat exists
14467set getfsstat d_getfsstat
14468eval $inlibc
14469
14470: see if getgrent exists
14471set getgrent d_getgrent
14472eval $inlibc
14473
14474: see if getgrent_r exists
14475set getgrent_r d_getgrent_r
14476eval $inlibc
14477case "$d_getgrent_r" in
14478"$define")
14479	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14480	case "$d_getgrent_r_proto:$usethreads" in
14481	":define")	d_getgrent_r_proto=define
14482		set d_getgrent_r_proto getgrent_r $hdrs
14483		eval $hasproto ;;
14484	*)	;;
14485	esac
14486	case "$d_getgrent_r_proto" in
14487	define)
14488	case "$getgrent_r_proto" in
14489	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14490	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14491	esac
14492	case "$getgrent_r_proto" in
14493	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14494	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14495	esac
14496	case "$getgrent_r_proto" in
14497	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14498	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14499	esac
14500	case "$getgrent_r_proto" in
14501	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14502	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14503	esac
14504	case "$getgrent_r_proto" in
14505	''|0) try='int getgrent_r(struct group*, char*, int);'
14506	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14507	esac
14508	case "$getgrent_r_proto" in
14509	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14510	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14511	esac
14512	case "$getgrent_r_proto" in
14513	''|0)	d_getgrent_r=undef
14514		getgrent_r_proto=0
14515		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14516	* )	case "$getgrent_r_proto" in
14517		REENTRANT_PROTO*) ;;
14518		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14519		esac
14520		echo "Prototype: $try" ;;
14521	esac
14522	;;
14523	*)	case "$usethreads" in
14524		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14525		esac
14526		d_getgrent_r=undef
14527		getgrent_r_proto=0
14528		;;
14529	esac
14530	;;
14531*)	getgrent_r_proto=0
14532	;;
14533esac
14534
14535: see if getgrgid_r exists
14536set getgrgid_r d_getgrgid_r
14537eval $inlibc
14538case "$d_getgrgid_r" in
14539"$define")
14540	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14541	case "$d_getgrgid_r_proto:$usethreads" in
14542	":define")	d_getgrgid_r_proto=define
14543		set d_getgrgid_r_proto getgrgid_r $hdrs
14544		eval $hasproto ;;
14545	*)	;;
14546	esac
14547	case "$d_getgrgid_r_proto" in
14548	define)
14549	case "$getgrgid_r_proto" in
14550	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14551	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14552	esac
14553	case "$getgrgid_r_proto" in
14554	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14555	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14556	esac
14557	case "$getgrgid_r_proto" in
14558	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14559	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14560	esac
14561	case "$getgrgid_r_proto" in
14562	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14563	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14564	esac
14565	case "$getgrgid_r_proto" in
14566	''|0)	d_getgrgid_r=undef
14567		getgrgid_r_proto=0
14568		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14569	* )	case "$getgrgid_r_proto" in
14570		REENTRANT_PROTO*) ;;
14571		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14572		esac
14573		echo "Prototype: $try" ;;
14574	esac
14575	;;
14576	*)	case "$usethreads" in
14577		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14578		esac
14579		d_getgrgid_r=undef
14580		getgrgid_r_proto=0
14581		;;
14582	esac
14583	;;
14584*)	getgrgid_r_proto=0
14585	;;
14586esac
14587
14588: see if getgrnam_r exists
14589set getgrnam_r d_getgrnam_r
14590eval $inlibc
14591case "$d_getgrnam_r" in
14592"$define")
14593	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14594	case "$d_getgrnam_r_proto:$usethreads" in
14595	":define")	d_getgrnam_r_proto=define
14596		set d_getgrnam_r_proto getgrnam_r $hdrs
14597		eval $hasproto ;;
14598	*)	;;
14599	esac
14600	case "$d_getgrnam_r_proto" in
14601	define)
14602	case "$getgrnam_r_proto" in
14603	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14604	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14605	esac
14606	case "$getgrnam_r_proto" in
14607	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14608	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14609	esac
14610	case "$getgrnam_r_proto" in
14611	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14612	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14613	esac
14614	case "$getgrnam_r_proto" in
14615	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14616	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14617	esac
14618	case "$getgrnam_r_proto" in
14619	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14620	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14621	esac
14622	case "$getgrnam_r_proto" in
14623	''|0)	d_getgrnam_r=undef
14624		getgrnam_r_proto=0
14625		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14626	* )	case "$getgrnam_r_proto" in
14627		REENTRANT_PROTO*) ;;
14628		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14629		esac
14630		echo "Prototype: $try" ;;
14631	esac
14632	;;
14633	*)	case "$usethreads" in
14634		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14635		esac
14636		d_getgrnam_r=undef
14637		getgrnam_r_proto=0
14638		;;
14639	esac
14640	;;
14641*)	getgrnam_r_proto=0
14642	;;
14643esac
14644
14645: see if gethostbyaddr exists
14646set gethostbyaddr d_gethbyaddr
14647eval $inlibc
14648
14649: see if gethostbyname exists
14650set gethostbyname d_gethbyname
14651eval $inlibc
14652
14653: see if gethostent exists
14654set gethostent d_gethent
14655eval $inlibc
14656
14657: see how we will look up host name
14658echo " "
14659call=''
14660if set gethostname val -f d_gethname; eval $csym; $val; then
14661	echo 'gethostname() found.' >&4
14662	d_gethname="$define"
14663	call=gethostname
14664fi
14665if set uname val -f d_uname; eval $csym; $val; then
14666	if ./xenix; then
14667		$cat <<'EOM'
14668uname() was found, but you're running xenix, and older versions of xenix
14669have a broken uname(). If you don't really know whether your xenix is old
14670enough to have a broken system call, use the default answer.
14671
14672EOM
14673		dflt=y
14674		case "$d_uname" in
14675		"$define") dflt=n;;
14676		esac
14677		rp='Is your uname() broken?'
14678		. ./myread
14679		case "$ans" in
14680		n*) d_uname="$define"; call=uname;;
14681		esac
14682	else
14683		echo 'uname() found.' >&4
14684		d_uname="$define"
14685		case "$call" in
14686		'') call=uname ;;
14687		esac
14688	fi
14689fi
14690case "$d_gethname" in
14691'') d_gethname="$undef";;
14692esac
14693case "$d_uname" in
14694'') d_uname="$undef";;
14695esac
14696case "$d_uname$d_gethname" in
14697*define*)
14698	dflt=n
14699	cat <<EOM
14700
14701Every now and then someone has a $call() that lies about the hostname
14702but can't be fixed for political or economic reasons.  If you wish, I can
14703pretend $call() isn't there and maybe compute hostname at run-time
14704thanks to the '$phostname' command.
14705
14706EOM
14707	rp="Shall I ignore $call() from now on?"
14708	. ./myread
14709	case "$ans" in
14710	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14711	esac;;
14712esac
14713case "$phostname" in
14714'') aphostname='';;
14715*) case "$aphostname" in
14716	/*) ;;
14717	*) set X $phostname
14718		shift
14719		file=$1
14720		shift
14721		file=`./loc $file $file $pth`
14722		aphostname=`echo $file $*`
14723		;;
14724	esac
14725	;;
14726esac
14727case "$d_uname$d_gethname" in
14728*define*) ;;
14729*)
14730	case "$phostname" in
14731	'')
14732		echo "There will be no way for $package to get your hostname." >&4;;
14733	*)
14734	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14735		;;
14736	esac;;
14737esac
14738case "$d_phostname" in
14739'') d_phostname="$undef";;
14740esac
14741
14742: see if gethostbyaddr_r exists
14743set gethostbyaddr_r d_gethostbyaddr_r
14744eval $inlibc
14745case "$d_gethostbyaddr_r" in
14746"$define")
14747	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14748	case "$d_gethostbyaddr_r_proto:$usethreads" in
14749	":define")	d_gethostbyaddr_r_proto=define
14750		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14751		eval $hasproto ;;
14752	*)	;;
14753	esac
14754	case "$d_gethostbyaddr_r_proto" in
14755	define)
14756	case "$gethostbyaddr_r_proto" in
14757	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14758	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14759	esac
14760	case "$gethostbyaddr_r_proto" in
14761	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14762	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14763	esac
14764	case "$gethostbyaddr_r_proto" in
14765	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14766	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14767	esac
14768	case "$gethostbyaddr_r_proto" in
14769	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14770	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14771	esac
14772	case "$gethostbyaddr_r_proto" in
14773	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14774	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14775	esac
14776	case "$gethostbyaddr_r_proto" in
14777	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14778	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14779	esac
14780	case "$gethostbyaddr_r_proto" in
14781	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14782	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14783	esac
14784	case "$gethostbyaddr_r_proto" in
14785	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14786	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14787	esac
14788	case "$gethostbyaddr_r_proto" in
14789	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14790	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14791	esac
14792	case "$gethostbyaddr_r_proto" in
14793	''|0) try='int gethostbyaddr_r(const char*, int, int);'
14794	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14795	esac
14796	case "$gethostbyaddr_r_proto" in
14797	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14798	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14799	esac
14800	case "$gethostbyaddr_r_proto" in
14801	''|0)	d_gethostbyaddr_r=undef
14802		gethostbyaddr_r_proto=0
14803		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14804	* )	case "$gethostbyaddr_r_proto" in
14805		REENTRANT_PROTO*) ;;
14806		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14807		esac
14808		echo "Prototype: $try" ;;
14809	esac
14810	;;
14811	*)	case "$usethreads" in
14812		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14813		esac
14814		d_gethostbyaddr_r=undef
14815		gethostbyaddr_r_proto=0
14816		;;
14817	esac
14818	;;
14819*)	gethostbyaddr_r_proto=0
14820	;;
14821esac
14822
14823: see if gethostbyname_r exists
14824set gethostbyname_r d_gethostbyname_r
14825eval $inlibc
14826case "$d_gethostbyname_r" in
14827"$define")
14828	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14829	case "$d_gethostbyname_r_proto:$usethreads" in
14830	":define")	d_gethostbyname_r_proto=define
14831		set d_gethostbyname_r_proto gethostbyname_r $hdrs
14832		eval $hasproto ;;
14833	*)	;;
14834	esac
14835	case "$d_gethostbyname_r_proto" in
14836	define)
14837	case "$gethostbyname_r_proto" in
14838	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14839	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14840	esac
14841	case "$gethostbyname_r_proto" in
14842	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14843	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14844	esac
14845	case "$gethostbyname_r_proto" in
14846	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14847	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14848	esac
14849	case "$gethostbyname_r_proto" in
14850	''|0)	d_gethostbyname_r=undef
14851		gethostbyname_r_proto=0
14852		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14853	* )	case "$gethostbyname_r_proto" in
14854		REENTRANT_PROTO*) ;;
14855		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14856		esac
14857		echo "Prototype: $try" ;;
14858	esac
14859	;;
14860	*)	case "$usethreads" in
14861		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14862		esac
14863		d_gethostbyname_r=undef
14864		gethostbyname_r_proto=0
14865		;;
14866	esac
14867	;;
14868*)	gethostbyname_r_proto=0
14869	;;
14870esac
14871
14872: see if gethostent_r exists
14873set gethostent_r d_gethostent_r
14874eval $inlibc
14875case "$d_gethostent_r" in
14876"$define")
14877	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14878	case "$d_gethostent_r_proto:$usethreads" in
14879	":define")	d_gethostent_r_proto=define
14880		set d_gethostent_r_proto gethostent_r $hdrs
14881		eval $hasproto ;;
14882	*)	;;
14883	esac
14884	case "$d_gethostent_r_proto" in
14885	define)
14886	case "$gethostent_r_proto" in
14887	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14888	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14889	esac
14890	case "$gethostent_r_proto" in
14891	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14892	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14893	esac
14894	case "$gethostent_r_proto" in
14895	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14896	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14897	esac
14898	case "$gethostent_r_proto" in
14899	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14900	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14901	esac
14902	case "$gethostent_r_proto" in
14903	''|0) try='int gethostent_r(struct hostent*, char*, int);'
14904	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14905	esac
14906	case "$gethostent_r_proto" in
14907	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14908	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14909	esac
14910	case "$gethostent_r_proto" in
14911	''|0)	d_gethostent_r=undef
14912		gethostent_r_proto=0
14913		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14914	* )	case "$gethostent_r_proto" in
14915		REENTRANT_PROTO*) ;;
14916		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14917		esac
14918		echo "Prototype: $try" ;;
14919	esac
14920	;;
14921	*)	case "$usethreads" in
14922		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14923		esac
14924		d_gethostent_r=undef
14925		gethostent_r_proto=0
14926		;;
14927	esac
14928	;;
14929*)	gethostent_r_proto=0
14930	;;
14931esac
14932
14933: see if prototypes for various gethostxxx netdb.h functions are available
14934echo " "
14935set d_gethostprotos gethostent $i_netdb netdb.h
14936eval $hasproto
14937
14938: see if getitimer exists
14939set getitimer d_getitimer
14940eval $inlibc
14941
14942: see if getlogin exists
14943set getlogin d_getlogin
14944eval $inlibc
14945
14946: see if getlogin_r exists
14947set getlogin_r d_getlogin_r
14948eval $inlibc
14949case "$d_getlogin_r" in
14950"$define")
14951	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14952	case "$d_getlogin_r_proto:$usethreads" in
14953	":define")	d_getlogin_r_proto=define
14954		set d_getlogin_r_proto getlogin_r $hdrs
14955		eval $hasproto ;;
14956	*)	;;
14957	esac
14958	case "$d_getlogin_r_proto" in
14959	define)
14960	case "$getlogin_r_proto" in
14961	''|0) try='int getlogin_r(char*, size_t);'
14962	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14963	esac
14964	case "$getlogin_r_proto" in
14965	''|0) try='int getlogin_r(char*, int);'
14966	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14967	esac
14968	case "$getlogin_r_proto" in
14969	''|0) try='char* getlogin_r(char*, size_t);'
14970	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14971	esac
14972	case "$getlogin_r_proto" in
14973	''|0) try='char* getlogin_r(char*, int);'
14974	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14975	esac
14976	case "$getlogin_r_proto" in
14977	''|0)	d_getlogin_r=undef
14978		getlogin_r_proto=0
14979		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14980	* )	case "$getlogin_r_proto" in
14981		REENTRANT_PROTO*) ;;
14982		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14983		esac
14984		echo "Prototype: $try" ;;
14985	esac
14986	;;
14987	*)	case "$usethreads" in
14988		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14989		esac
14990		d_getlogin_r=undef
14991		getlogin_r_proto=0
14992		;;
14993	esac
14994	;;
14995*)	getlogin_r_proto=0
14996	;;
14997esac
14998
14999: see if getmnt exists
15000set getmnt d_getmnt
15001eval $inlibc
15002
15003: see if getmntent exists
15004set getmntent d_getmntent
15005eval $inlibc
15006
15007: see if getnameinfo exists
15008set getnameinfo d_getnameinfo
15009eval $inlibc
15010
15011: see if getnetbyaddr exists
15012set getnetbyaddr d_getnbyaddr
15013eval $inlibc
15014
15015: see if getnetbyname exists
15016set getnetbyname d_getnbyname
15017eval $inlibc
15018
15019: see if getnetent exists
15020set getnetent d_getnent
15021eval $inlibc
15022
15023: see if getnetbyaddr_r exists
15024set getnetbyaddr_r d_getnetbyaddr_r
15025eval $inlibc
15026case "$d_getnetbyaddr_r" in
15027"$define")
15028	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15029	case "$d_getnetbyaddr_r_proto:$usethreads" in
15030	":define")	d_getnetbyaddr_r_proto=define
15031		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15032		eval $hasproto ;;
15033	*)	;;
15034	esac
15035	case "$d_getnetbyaddr_r_proto" in
15036	define)
15037	case "$getnetbyaddr_r_proto" in
15038	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15039	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15040	esac
15041	case "$getnetbyaddr_r_proto" in
15042	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15043	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15044	esac
15045	case "$getnetbyaddr_r_proto" in
15046	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15047	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15048	esac
15049	case "$getnetbyaddr_r_proto" in
15050	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15051	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15052	esac
15053	case "$getnetbyaddr_r_proto" in
15054	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15055	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15056	esac
15057	case "$getnetbyaddr_r_proto" in
15058	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15059	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15060	esac
15061	case "$getnetbyaddr_r_proto" in
15062	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15063	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15064	esac
15065	case "$getnetbyaddr_r_proto" in
15066	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15067	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15068	esac
15069	case "$getnetbyaddr_r_proto" in
15070	''|0)	d_getnetbyaddr_r=undef
15071		getnetbyaddr_r_proto=0
15072		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15073	* )	case "$getnetbyaddr_r_proto" in
15074		REENTRANT_PROTO*) ;;
15075		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15076		esac
15077		echo "Prototype: $try" ;;
15078	esac
15079	;;
15080	*)	case "$usethreads" in
15081		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15082		esac
15083		d_getnetbyaddr_r=undef
15084		getnetbyaddr_r_proto=0
15085		;;
15086	esac
15087	;;
15088*)	getnetbyaddr_r_proto=0
15089	;;
15090esac
15091
15092: see if getnetbyname_r exists
15093set getnetbyname_r d_getnetbyname_r
15094eval $inlibc
15095case "$d_getnetbyname_r" in
15096"$define")
15097	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15098	case "$d_getnetbyname_r_proto:$usethreads" in
15099	":define")	d_getnetbyname_r_proto=define
15100		set d_getnetbyname_r_proto getnetbyname_r $hdrs
15101		eval $hasproto ;;
15102	*)	;;
15103	esac
15104	case "$d_getnetbyname_r_proto" in
15105	define)
15106	case "$getnetbyname_r_proto" in
15107	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15108	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15109	esac
15110	case "$getnetbyname_r_proto" in
15111	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15112	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15113	esac
15114	case "$getnetbyname_r_proto" in
15115	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15116	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15117	esac
15118	case "$getnetbyname_r_proto" in
15119	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15120	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15121	esac
15122	case "$getnetbyname_r_proto" in
15123	''|0)	d_getnetbyname_r=undef
15124		getnetbyname_r_proto=0
15125		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15126	* )	case "$getnetbyname_r_proto" in
15127		REENTRANT_PROTO*) ;;
15128		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15129		esac
15130		echo "Prototype: $try" ;;
15131	esac
15132	;;
15133	*)	case "$usethreads" in
15134		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15135		esac
15136		d_getnetbyname_r=undef
15137		getnetbyname_r_proto=0
15138		;;
15139	esac
15140	;;
15141*)	getnetbyname_r_proto=0
15142	;;
15143esac
15144
15145: see if getnetent_r exists
15146set getnetent_r d_getnetent_r
15147eval $inlibc
15148case "$d_getnetent_r" in
15149"$define")
15150	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15151	case "$d_getnetent_r_proto:$usethreads" in
15152	":define")	d_getnetent_r_proto=define
15153		set d_getnetent_r_proto getnetent_r $hdrs
15154		eval $hasproto ;;
15155	*)	;;
15156	esac
15157	case "$d_getnetent_r_proto" in
15158	define)
15159	case "$getnetent_r_proto" in
15160	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15161	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15162	esac
15163	case "$getnetent_r_proto" in
15164	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15165	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15166	esac
15167	case "$getnetent_r_proto" in
15168	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15169	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15170	esac
15171	case "$getnetent_r_proto" in
15172	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15173	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15174	esac
15175	case "$getnetent_r_proto" in
15176	''|0) try='int getnetent_r(struct netent*, char*, int);'
15177	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15178	esac
15179	case "$getnetent_r_proto" in
15180	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15181	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15182	esac
15183	case "$getnetent_r_proto" in
15184	''|0)	d_getnetent_r=undef
15185		getnetent_r_proto=0
15186		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15187	* )	case "$getnetent_r_proto" in
15188		REENTRANT_PROTO*) ;;
15189		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15190		esac
15191		echo "Prototype: $try" ;;
15192	esac
15193	;;
15194	*)	case "$usethreads" in
15195		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15196		esac
15197		d_getnetent_r=undef
15198		getnetent_r_proto=0
15199		;;
15200	esac
15201	;;
15202*)	getnetent_r_proto=0
15203	;;
15204esac
15205
15206: see if prototypes for various getnetxxx netdb.h functions are available
15207echo " "
15208set d_getnetprotos getnetent $i_netdb netdb.h
15209eval $hasproto
15210
15211: see if getpagesize exists
15212set getpagesize d_getpagsz
15213eval $inlibc
15214
15215: Optional checks for getprotobyname and getprotobynumber
15216
15217: see if getprotobyname exists
15218set getprotobyname d_getpbyname
15219eval $inlibc
15220
15221: see if getprotobynumber exists
15222set getprotobynumber d_getpbynumber
15223eval $inlibc
15224
15225: see if getprotoent exists
15226set getprotoent d_getpent
15227eval $inlibc
15228
15229: see if getpgid exists
15230set getpgid d_getpgid
15231eval $inlibc
15232
15233: see if getpgrp2 exists
15234set getpgrp2 d_getpgrp2
15235eval $inlibc
15236
15237: see if getppid exists
15238set getppid d_getppid
15239eval $inlibc
15240
15241: see if getpriority exists
15242set getpriority d_getprior
15243eval $inlibc
15244
15245: see if getprotobyname_r exists
15246set getprotobyname_r d_getprotobyname_r
15247eval $inlibc
15248case "$d_getprotobyname_r" in
15249"$define")
15250	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15251	case "$d_getprotobyname_r_proto:$usethreads" in
15252	":define")	d_getprotobyname_r_proto=define
15253		set d_getprotobyname_r_proto getprotobyname_r $hdrs
15254		eval $hasproto ;;
15255	*)	;;
15256	esac
15257	case "$d_getprotobyname_r_proto" in
15258	define)
15259	case "$getprotobyname_r_proto" in
15260	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15261	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15262	esac
15263	case "$getprotobyname_r_proto" in
15264	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15265	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15266	esac
15267	case "$getprotobyname_r_proto" in
15268	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15269	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15270	esac
15271	case "$getprotobyname_r_proto" in
15272	''|0)	d_getprotobyname_r=undef
15273		getprotobyname_r_proto=0
15274		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15275	* )	case "$getprotobyname_r_proto" in
15276		REENTRANT_PROTO*) ;;
15277		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15278		esac
15279		echo "Prototype: $try" ;;
15280	esac
15281	;;
15282	*)	case "$usethreads" in
15283		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15284		esac
15285		d_getprotobyname_r=undef
15286		getprotobyname_r_proto=0
15287		;;
15288	esac
15289	;;
15290*)	getprotobyname_r_proto=0
15291	;;
15292esac
15293
15294: see if getprotobynumber_r exists
15295set getprotobynumber_r d_getprotobynumber_r
15296eval $inlibc
15297case "$d_getprotobynumber_r" in
15298"$define")
15299	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15300	case "$d_getprotobynumber_r_proto:$usethreads" in
15301	":define")	d_getprotobynumber_r_proto=define
15302		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15303		eval $hasproto ;;
15304	*)	;;
15305	esac
15306	case "$d_getprotobynumber_r_proto" in
15307	define)
15308	case "$getprotobynumber_r_proto" in
15309	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15310	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15311	esac
15312	case "$getprotobynumber_r_proto" in
15313	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15314	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15315	esac
15316	case "$getprotobynumber_r_proto" in
15317	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15318	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15319	esac
15320	case "$getprotobynumber_r_proto" in
15321	''|0)	d_getprotobynumber_r=undef
15322		getprotobynumber_r_proto=0
15323		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15324	* )	case "$getprotobynumber_r_proto" in
15325		REENTRANT_PROTO*) ;;
15326		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15327		esac
15328		echo "Prototype: $try" ;;
15329	esac
15330	;;
15331	*)	case "$usethreads" in
15332		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15333		esac
15334		d_getprotobynumber_r=undef
15335		getprotobynumber_r_proto=0
15336		;;
15337	esac
15338	;;
15339*)	getprotobynumber_r_proto=0
15340	;;
15341esac
15342
15343: see if getprotoent_r exists
15344set getprotoent_r d_getprotoent_r
15345eval $inlibc
15346case "$d_getprotoent_r" in
15347"$define")
15348	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15349	case "$d_getprotoent_r_proto:$usethreads" in
15350	":define")	d_getprotoent_r_proto=define
15351		set d_getprotoent_r_proto getprotoent_r $hdrs
15352		eval $hasproto ;;
15353	*)	;;
15354	esac
15355	case "$d_getprotoent_r_proto" in
15356	define)
15357	case "$getprotoent_r_proto" in
15358	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15359	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15360	esac
15361	case "$getprotoent_r_proto" in
15362	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15363	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15364	esac
15365	case "$getprotoent_r_proto" in
15366	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15367	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15368	esac
15369	case "$getprotoent_r_proto" in
15370	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15371	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15372	esac
15373	case "$getprotoent_r_proto" in
15374	''|0)	d_getprotoent_r=undef
15375		getprotoent_r_proto=0
15376		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15377	* )	case "$getprotoent_r_proto" in
15378		REENTRANT_PROTO*) ;;
15379		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15380		esac
15381		echo "Prototype: $try" ;;
15382	esac
15383	;;
15384	*)	case "$usethreads" in
15385		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15386		esac
15387		d_getprotoent_r=undef
15388		getprotoent_r_proto=0
15389		;;
15390	esac
15391	;;
15392*)	getprotoent_r_proto=0
15393	;;
15394esac
15395
15396: see if prototypes for various getprotoxxx netdb.h functions are available
15397echo " "
15398set d_getprotoprotos getprotoent $i_netdb netdb.h
15399eval $hasproto
15400
15401: see if getprpwnam exists
15402set getprpwnam d_getprpwnam
15403eval $inlibc
15404
15405: see if getpwent exists
15406set getpwent d_getpwent
15407eval $inlibc
15408
15409: see if getpwent_r exists
15410set getpwent_r d_getpwent_r
15411eval $inlibc
15412case "$d_getpwent_r" in
15413"$define")
15414	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15415	case "$d_getpwent_r_proto:$usethreads" in
15416	":define")	d_getpwent_r_proto=define
15417		set d_getpwent_r_proto getpwent_r $hdrs
15418		eval $hasproto ;;
15419	*)	;;
15420	esac
15421	case "$d_getpwent_r_proto" in
15422	define)
15423	case "$getpwent_r_proto" in
15424	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15425	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15426	esac
15427	case "$getpwent_r_proto" in
15428	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15429	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15430	esac
15431	case "$getpwent_r_proto" in
15432	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15433	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15434	esac
15435	case "$getpwent_r_proto" in
15436	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15437	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15438	esac
15439	case "$getpwent_r_proto" in
15440	''|0) try='int getpwent_r(struct passwd*, char*, int);'
15441	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15442	esac
15443	case "$getpwent_r_proto" in
15444	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15445	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15446	esac
15447	case "$getpwent_r_proto" in
15448	''|0)	d_getpwent_r=undef
15449		getpwent_r_proto=0
15450		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15451	* )	case "$getpwent_r_proto" in
15452		REENTRANT_PROTO*) ;;
15453		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15454		esac
15455		echo "Prototype: $try" ;;
15456	esac
15457	;;
15458	*)	case "$usethreads" in
15459		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15460		esac
15461		d_getpwent_r=undef
15462		getpwent_r_proto=0
15463		;;
15464	esac
15465	;;
15466*)	getpwent_r_proto=0
15467	;;
15468esac
15469
15470: see if getpwnam_r exists
15471set getpwnam_r d_getpwnam_r
15472eval $inlibc
15473case "$d_getpwnam_r" in
15474"$define")
15475	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15476	case "$d_getpwnam_r_proto:$usethreads" in
15477	":define")	d_getpwnam_r_proto=define
15478		set d_getpwnam_r_proto getpwnam_r $hdrs
15479		eval $hasproto ;;
15480	*)	;;
15481	esac
15482	case "$d_getpwnam_r_proto" in
15483	define)
15484	case "$getpwnam_r_proto" in
15485	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15486	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15487	esac
15488	case "$getpwnam_r_proto" in
15489	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15490	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15491	esac
15492	case "$getpwnam_r_proto" in
15493	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15494	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15495	esac
15496	case "$getpwnam_r_proto" in
15497	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15498	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15499	esac
15500	case "$getpwnam_r_proto" in
15501	''|0)	d_getpwnam_r=undef
15502		getpwnam_r_proto=0
15503		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15504	* )	case "$getpwnam_r_proto" in
15505		REENTRANT_PROTO*) ;;
15506		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15507		esac
15508		echo "Prototype: $try" ;;
15509	esac
15510	;;
15511	*)	case "$usethreads" in
15512		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15513		esac
15514		d_getpwnam_r=undef
15515		getpwnam_r_proto=0
15516		;;
15517	esac
15518	;;
15519*)	getpwnam_r_proto=0
15520	;;
15521esac
15522
15523: see if getpwuid_r exists
15524set getpwuid_r d_getpwuid_r
15525eval $inlibc
15526case "$d_getpwuid_r" in
15527"$define")
15528	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15529	case "$d_getpwuid_r_proto:$usethreads" in
15530	":define")	d_getpwuid_r_proto=define
15531		set d_getpwuid_r_proto getpwuid_r $hdrs
15532		eval $hasproto ;;
15533	*)	;;
15534	esac
15535	case "$d_getpwuid_r_proto" in
15536	define)
15537	case "$getpwuid_r_proto" in
15538	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15539	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15540	esac
15541	case "$getpwuid_r_proto" in
15542	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15543	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15544	esac
15545	case "$getpwuid_r_proto" in
15546	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15547	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15548	esac
15549	case "$getpwuid_r_proto" in
15550	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15551	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15552	esac
15553	case "$getpwuid_r_proto" in
15554	''|0)	d_getpwuid_r=undef
15555		getpwuid_r_proto=0
15556		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15557	* )	case "$getpwuid_r_proto" in
15558		REENTRANT_PROTO*) ;;
15559		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15560		esac
15561		echo "Prototype: $try" ;;
15562	esac
15563	;;
15564	*)	case "$usethreads" in
15565		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15566		esac
15567		d_getpwuid_r=undef
15568		getpwuid_r_proto=0
15569		;;
15570	esac
15571	;;
15572*)	getpwuid_r_proto=0
15573	;;
15574esac
15575
15576: Optional checks for getsbyname and getsbyport
15577
15578: see if getservbyname exists
15579set getservbyname d_getsbyname
15580eval $inlibc
15581
15582: see if getservbyport exists
15583set getservbyport d_getsbyport
15584eval $inlibc
15585
15586: see if getservent exists
15587set getservent d_getsent
15588eval $inlibc
15589
15590: see if getservbyname_r exists
15591set getservbyname_r d_getservbyname_r
15592eval $inlibc
15593case "$d_getservbyname_r" in
15594"$define")
15595	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15596	case "$d_getservbyname_r_proto:$usethreads" in
15597	":define")	d_getservbyname_r_proto=define
15598		set d_getservbyname_r_proto getservbyname_r $hdrs
15599		eval $hasproto ;;
15600	*)	;;
15601	esac
15602	case "$d_getservbyname_r_proto" in
15603	define)
15604	case "$getservbyname_r_proto" in
15605	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15606	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15607	esac
15608	case "$getservbyname_r_proto" in
15609	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15610	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15611	esac
15612	case "$getservbyname_r_proto" in
15613	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15614	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15615	esac
15616	case "$getservbyname_r_proto" in
15617	''|0)	d_getservbyname_r=undef
15618		getservbyname_r_proto=0
15619		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15620	* )	case "$getservbyname_r_proto" in
15621		REENTRANT_PROTO*) ;;
15622		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15623		esac
15624		echo "Prototype: $try" ;;
15625	esac
15626	;;
15627	*)	case "$usethreads" in
15628		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15629		esac
15630		d_getservbyname_r=undef
15631		getservbyname_r_proto=0
15632		;;
15633	esac
15634	;;
15635*)	getservbyname_r_proto=0
15636	;;
15637esac
15638
15639: see if getservbyport_r exists
15640set getservbyport_r d_getservbyport_r
15641eval $inlibc
15642case "$d_getservbyport_r" in
15643"$define")
15644	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15645	case "$d_getservbyport_r_proto:$usethreads" in
15646	":define")	d_getservbyport_r_proto=define
15647		set d_getservbyport_r_proto getservbyport_r $hdrs
15648		eval $hasproto ;;
15649	*)	;;
15650	esac
15651	case "$d_getservbyport_r_proto" in
15652	define)
15653	case "$getservbyport_r_proto" in
15654	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15655	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15656	esac
15657	case "$getservbyport_r_proto" in
15658	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15659	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15660	esac
15661	case "$getservbyport_r_proto" in
15662	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15663	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15664	esac
15665	case "$getservbyport_r_proto" in
15666	''|0)	d_getservbyport_r=undef
15667		getservbyport_r_proto=0
15668		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15669	* )	case "$getservbyport_r_proto" in
15670		REENTRANT_PROTO*) ;;
15671		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15672		esac
15673		echo "Prototype: $try" ;;
15674	esac
15675	;;
15676	*)	case "$usethreads" in
15677		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15678		esac
15679		d_getservbyport_r=undef
15680		getservbyport_r_proto=0
15681		;;
15682	esac
15683	;;
15684*)	getservbyport_r_proto=0
15685	;;
15686esac
15687
15688: see if getservent_r exists
15689set getservent_r d_getservent_r
15690eval $inlibc
15691case "$d_getservent_r" in
15692"$define")
15693	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15694	case "$d_getservent_r_proto:$usethreads" in
15695	":define")	d_getservent_r_proto=define
15696		set d_getservent_r_proto getservent_r $hdrs
15697		eval $hasproto ;;
15698	*)	;;
15699	esac
15700	case "$d_getservent_r_proto" in
15701	define)
15702	case "$getservent_r_proto" in
15703	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15704	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15705	esac
15706	case "$getservent_r_proto" in
15707	''|0) try='int getservent_r(struct servent*, char*, int);'
15708	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15709	esac
15710	case "$getservent_r_proto" in
15711	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15712	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15713	esac
15714	case "$getservent_r_proto" in
15715	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15716	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15717	esac
15718	case "$getservent_r_proto" in
15719	''|0)	d_getservent_r=undef
15720		getservent_r_proto=0
15721		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15722	* )	case "$getservent_r_proto" in
15723		REENTRANT_PROTO*) ;;
15724		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15725		esac
15726		echo "Prototype: $try" ;;
15727	esac
15728	;;
15729	*)	case "$usethreads" in
15730		define) echo "getservent_r has no prototype, not using it." >&4 ;;
15731		esac
15732		d_getservent_r=undef
15733		getservent_r_proto=0
15734		;;
15735	esac
15736	;;
15737*)	getservent_r_proto=0
15738	;;
15739esac
15740
15741: see if prototypes for various getservxxx netdb.h functions are available
15742echo " "
15743set d_getservprotos getservent $i_netdb netdb.h
15744eval $hasproto
15745
15746: see if getspnam exists
15747set getspnam d_getspnam
15748eval $inlibc
15749
15750: see if this is a shadow.h system
15751set shadow.h i_shadow
15752eval $inhdr
15753
15754: see if getspnam_r exists
15755set getspnam_r d_getspnam_r
15756eval $inlibc
15757case "$d_getspnam_r" in
15758"$define")
15759	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15760	case "$d_getspnam_r_proto:$usethreads" in
15761	":define")	d_getspnam_r_proto=define
15762		set d_getspnam_r_proto getspnam_r $hdrs
15763		eval $hasproto ;;
15764	*)	;;
15765	esac
15766	case "$d_getspnam_r_proto" in
15767	define)
15768	case "$getspnam_r_proto" in
15769	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15770	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15771	esac
15772	case "$getspnam_r_proto" in
15773	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15774	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15775	esac
15776	case "$getspnam_r_proto" in
15777	''|0)	d_getspnam_r=undef
15778		getspnam_r_proto=0
15779		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15780	* )	case "$getspnam_r_proto" in
15781		REENTRANT_PROTO*) ;;
15782		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15783		esac
15784		echo "Prototype: $try" ;;
15785	esac
15786	;;
15787	*)	case "$usethreads" in
15788		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15789		esac
15790		d_getspnam_r=undef
15791		getspnam_r_proto=0
15792		;;
15793	esac
15794	;;
15795*)	getspnam_r_proto=0
15796	;;
15797esac
15798
15799: see if gettimeofday or ftime exists
15800set gettimeofday d_gettimeod
15801eval $inlibc
15802case "$d_gettimeod" in
15803"$undef")
15804	set ftime d_ftime
15805	eval $inlibc
15806	;;
15807*)
15808	val="$undef"; set d_ftime; eval $setvar
15809	;;
15810esac
15811case "$d_gettimeod$d_ftime" in
15812"$undef$undef")
15813	echo " "
15814	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15815	;;
15816esac
15817
15818: see if gmtime_r exists
15819set gmtime_r d_gmtime_r
15820eval $inlibc
15821case "$d_gmtime_r" in
15822"$define")
15823	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15824	case "$d_gmtime_r_proto:$usethreads" in
15825	":define")	d_gmtime_r_proto=define
15826		set d_gmtime_r_proto gmtime_r $hdrs
15827		eval $hasproto ;;
15828	*)	;;
15829	esac
15830	case "$d_gmtime_r_proto" in
15831	define)
15832	case "$gmtime_r_proto" in
15833	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15834	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15835	esac
15836	case "$gmtime_r_proto" in
15837	''|0) try='int gmtime_r(const time_t*, struct tm*);'
15838	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15839	esac
15840	case "$gmtime_r_proto" in
15841	''|0)	d_gmtime_r=undef
15842		gmtime_r_proto=0
15843		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15844	* )	case "$gmtime_r_proto" in
15845		REENTRANT_PROTO*) ;;
15846		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15847		esac
15848		echo "Prototype: $try" ;;
15849	esac
15850	;;
15851	*)	case "$usethreads" in
15852		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15853		esac
15854		d_gmtime_r=undef
15855		gmtime_r_proto=0
15856		;;
15857	esac
15858	;;
15859*)	gmtime_r_proto=0
15860	;;
15861esac
15862
15863: see if hasmntopt exists
15864set hasmntopt d_hasmntopt
15865eval $inlibc
15866
15867: see if this is a netinet/in.h or sys/in.h system
15868set netinet/in.h i_niin sys/in.h i_sysin
15869eval $inhdr
15870
15871: see if arpa/inet.h has to be included
15872set arpa/inet.h i_arpainet
15873eval $inhdr
15874
15875: see if htonl --and friends-- exists
15876val=''
15877set htonl val
15878eval $inlibc
15879
15880: Maybe they are macros.
15881case "$val" in
15882$undef)
15883	$cat >htonl.c <<EOM
15884#include <stdio.h>
15885#include <sys/types.h>
15886#$i_niin I_NETINET_IN
15887#$i_sysin I_SYS_IN
15888#$i_arpainet I_ARPA_INET
15889#ifdef I_NETINET_IN
15890#include <netinet/in.h>
15891#endif
15892#ifdef I_SYS_IN
15893#include <sys/in.h>
15894#endif
15895#ifdef I_ARPA_INET
15896#include <arpa/inet.h>
15897#endif
15898#ifdef htonl
15899printf("Defined as a macro.");
15900#endif
15901EOM
15902	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15903	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15904		val="$define"
15905		echo "But it seems to be defined as a macro." >&4
15906	fi
15907	$rm -f htonl.?
15908	;;
15909esac
15910set d_htonl
15911eval $setvar
15912
15913: see if hypot exists
15914set hypot d_hypot
15915eval $inlibc
15916
15917: see if ilogb exists
15918set ilogb d_ilogb
15919eval $inlibc
15920
15921: see if ilogbl exists
15922set ilogbl d_ilogbl
15923eval $inlibc
15924
15925: check whether inet_aton exists
15926set inet_aton d_inetaton
15927eval $inlibc
15928
15929: see if inet_ntop exists
15930set inet_ntop d_inetntop
15931eval $inlibc
15932
15933: see if inet_pton exists
15934set inet_pton d_inetpton
15935eval $inlibc
15936
15937: Look for isascii
15938echo " "
15939$cat >isascii.c <<EOCP
15940#include <stdio.h>
15941#include <ctype.h>
15942#$i_stdlib I_STDLIB
15943#ifdef I_STDLIB
15944#include <stdlib.h>
15945#endif
15946int main() {
15947	int c = 'A';
15948	if (isascii(c))
15949		exit(0);
15950	else
15951		exit(1);
15952}
15953EOCP
15954set isascii
15955if eval $compile; then
15956	echo "isascii() found." >&4
15957	val="$define"
15958else
15959	echo "isascii() NOT found." >&4
15960	val="$undef"
15961fi
15962set d_isascii
15963eval $setvar
15964$rm -f isascii*
15965
15966: Look for isblank
15967echo " "
15968$cat >isblank.c <<'EOCP'
15969#include <stdio.h>
15970#include <ctype.h>
15971int main() {
15972	int c = ' ';
15973	if (isblank(c))
15974		return 0 ;
15975	else
15976		return 1 ;
15977}
15978EOCP
15979if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15980	echo "isblank() found." >&4
15981	val="$define"
15982else
15983	echo "isblank() NOT found." >&4
15984	val="$undef"
15985fi
15986set d_isblank
15987eval $setvar
15988$rm -f isblank*
15989
15990: check for isfinite
15991echo "Checking to see if you have isfinite..." >&4
15992$cat >try.c <<EOCP
15993#include <math.h>
15994int main() { return isfinite(0.0); }
15995EOCP
15996set try
15997if eval $compile; then
15998	val="$define"
15999	echo "You have isfinite."
16000else
16001	val="$undef"
16002	echo "You do not have isfinite."
16003fi
16004$rm_try
16005set d_isfinite
16006eval $setvar
16007
16008: see if isfinitel exists
16009set isfinitel d_isfinitel
16010eval $inlibc
16011
16012: check for isinf
16013echo "Checking to see if you have isinf..." >&4
16014$cat >try.c <<EOCP
16015#include <math.h>
16016int main() { return isinf(0.0); }
16017EOCP
16018set try
16019if eval $compile; then
16020	val="$define"
16021	echo "You have isinf."
16022else
16023	val="$undef"
16024	echo "You do not have isinf."
16025fi
16026$rm_try
16027set d_isinf
16028eval $setvar
16029
16030: see if isinfl exists
16031set isinfl d_isinfl
16032eval $inlibc
16033
16034: check for isless
16035echo "Checking to see if you have isless..." >&4
16036$cat >try.c <<EOCP
16037#include <math.h>
16038int main() { return isless(2.0, 1.0); }
16039EOCP
16040set try
16041if eval $compile; then
16042	val="$define"
16043	echo "You have isless."
16044else
16045	val="$undef"
16046	echo "You do not have isless."
16047fi
16048$rm_try
16049set d_isless
16050eval $setvar
16051
16052: check for isnan
16053echo "Checking to see if you have isnan..." >&4
16054$cat >try.c <<EOCP
16055#include <math.h>
16056int main() { return isnan(0.0); }
16057EOCP
16058set try
16059if eval $compile; then
16060	val="$define"
16061	echo "You have isnan."
16062else
16063	val="$undef"
16064	echo "You do not have isnan."
16065fi
16066$rm_try
16067set d_isnan
16068eval $setvar
16069
16070: see if isnanl exists
16071set isnanl d_isnanl
16072eval $inlibc
16073
16074: check for isnormal
16075echo "Checking to see if you have isnormal..." >&4
16076$cat >try.c <<EOCP
16077#include <math.h>
16078int main() { return isnormal(0.0); }
16079EOCP
16080set try
16081if eval $compile; then
16082	val="$define"
16083	echo "You have isnormal."
16084else
16085	val="$undef"
16086	echo "You do not have isnormal."
16087fi
16088$rm_try
16089set d_isnormal
16090eval $setvar
16091
16092: see if j0 exists
16093set j0 d_j0
16094eval $inlibc
16095
16096: see if j0l exists
16097set j0l d_j0l
16098eval $inlibc
16099
16100: see if killpg exists
16101set killpg d_killpg
16102eval $inlibc
16103
16104: see if localeconv exists
16105set localeconv d_locconv
16106eval $inlibc
16107
16108: see if libc has the POSIX.1-2008 currency locale rules
16109case "$d_locconv:$d_lc_monetary_2008" in
16110$define:)
16111	$cat >try.c <<EOCP
16112#include <locale.h>
16113int main() {
16114	struct lconv *lc = localeconv();
16115	char int_p_cs_precedes = lc->int_p_cs_precedes;
16116	return 0;
16117}
16118EOCP
16119	set try
16120	if eval $compile; then
16121		d_lc_monetary_2008="$define"
16122	else
16123		d_lc_monetary_2008="$undef"
16124	fi;
16125	$rm_try
16126	;;
16127*)	d_lc_monetary_2008="$undef"
16128	;;
16129esac
16130
16131: see if lchown exists
16132echo " "
16133$cat > try.c <<EOCP
16134#include <pwd.h>
16135#include <stdio.h>
16136#include <stdlib.h>
16137#$i_unistd	I_UNISTD
16138#ifdef I_UNISTD
16139#  include <unistd.h>
16140#endif
16141int main(int argc, char *argv[])
16142{
16143   if (lchown("./try.c", -1, getgid()) == -1) {
16144       exit(EXIT_FAILURE);
16145   }
16146   exit(EXIT_SUCCESS);
16147}
16148EOCP
16149set try
16150if eval $compile && ./try; then
16151    $echo "lchown() found." >&4
16152    val="$define"
16153else
16154    $echo "lchown() NOT found." >&4
16155    val="$undef"
16156fi
16157set d_lchown
16158eval $setvar
16159$rm_try
16160
16161: See if number of significant digits in a double precision number is known
16162echo " "
16163$cat >ldbl_dig.c <<EOM
16164#include <limits.h>
16165#include <float.h>
16166#ifdef LDBL_DIG
16167printf("Contains LDBL_DIG");
16168#endif
16169EOM
16170$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16171if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16172	echo "LDBL_DIG found." >&4
16173	val="$define"
16174else
16175	echo "LDBL_DIG NOT found." >&4
16176	val="$undef"
16177fi
16178$rm -f ldbl_dig.?
16179set d_ldbl_dig
16180eval $setvar
16181
16182: see if lgamma exists
16183set lgamma d_lgamma
16184eval $inlibc
16185
16186: see if lgamma_r exists
16187set lgamma_r d_lgamma_r
16188eval $inlibc
16189
16190: check to see if math.h defines _LIB_VERSION
16191d_libm_lib_version="$undef"
16192echo " "
16193echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16194$cat >try.c <<EOCP
16195#include <unistd.h>
16196#include <math.h>
16197#include <stdio.h>
16198int main (int argc, char *argv[])
16199{
16200    printf ("%d\n", _LIB_VERSION);
16201    return (0);
16202    } /* main */
16203EOCP
16204set try
16205if eval $compile; then
16206    foo=`$run ./try`
16207    echo "Yes, it does ($foo)" >&4
16208    d_libm_lib_version="$define"
16209else
16210    echo "No, it does not (probably harmless)" >&4
16211    fi
16212$rm_try
16213
16214: see if link exists
16215set link d_link
16216eval $inlibc
16217
16218: see if llrint exists
16219set llrint d_llrint
16220eval $inlibc
16221
16222: see if llrintl exists
16223set llrintl d_llrintl
16224eval $inlibc
16225
16226: see if llround exists
16227set llround d_llround
16228eval $inlibc
16229
16230: see if llroundl exists
16231set llroundl d_llroundl
16232eval $inlibc
16233
16234: see if malloc/malloc.h has to be included
16235set malloc/malloc.h i_mallocmalloc
16236eval $inhdr
16237
16238: see if this is a malloc.h system
16239: we want a real compile instead of Inhdr because some systems have a
16240: malloc.h that just gives a compile error saying to use stdlib.h instead
16241echo " "
16242$cat >try.c <<EOCP
16243#include <stdlib.h>
16244#include <malloc.h>
16245#$i_mallocmalloc I_MALLOCMALLOC
16246#ifdef I_MALLOCMALLOC
16247# include <malloc/malloc.h>
16248#endif
16249
16250int main () { return 0; }
16251EOCP
16252set try
16253if eval $compile; then
16254    echo "<malloc.h> found." >&4
16255    val="$define"
16256else
16257    echo "<malloc.h> NOT found." >&4
16258    val="$undef"
16259fi
16260$rm_try
16261set i_malloc
16262eval $setvar
16263
16264: see if localtime_r exists
16265set localtime_r d_localtime_r
16266eval $inlibc
16267case "$d_localtime_r" in
16268"$define")
16269	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16270	case "$d_localtime_r_proto:$usethreads" in
16271	":define")	d_localtime_r_proto=define
16272		set d_localtime_r_proto localtime_r $hdrs
16273		eval $hasproto ;;
16274	*)	;;
16275	esac
16276	case "$d_localtime_r_proto" in
16277	define)
16278	case "$localtime_r_proto" in
16279	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16280	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16281	esac
16282	case "$localtime_r_proto" in
16283	''|0) try='int localtime_r(const time_t*, struct tm*);'
16284	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16285	esac
16286	case "$localtime_r_proto" in
16287	''|0)	d_localtime_r=undef
16288		localtime_r_proto=0
16289		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16290	* )	case "$localtime_r_proto" in
16291		REENTRANT_PROTO*) ;;
16292		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16293		esac
16294		echo "Prototype: $try" ;;
16295	esac
16296	;;
16297	*)	case "$usethreads" in
16298		define) echo "localtime_r has no prototype, not using it." >&4 ;;
16299		esac
16300		d_localtime_r=undef
16301		localtime_r_proto=0
16302		;;
16303	esac
16304	;;
16305*)	localtime_r_proto=0
16306	;;
16307esac
16308
16309: see if localtime_r calls tzset
16310case "$localtime_r_proto" in
16311REENTRANT_PROTO*)
16312	$cat >try.c <<EOCP
16313/*  Does our libc's localtime_r call tzset ?
16314 *  return 0 if so, 1 otherwise.
16315 */
16316#$i_systypes	I_SYS_TYPES
16317#$i_unistd	I_UNISTD
16318#$i_time	I_TIME
16319#$i_stdlib	I_STDLIB
16320#$i_malloc	I_MALLOC
16321#ifdef I_SYS_TYPES
16322#  include <sys/types.h>
16323#endif
16324#ifdef I_UNISTD
16325#  include <unistd.h>
16326#endif
16327#ifdef I_TIME
16328#  include <time.h>
16329#endif
16330#ifdef I_STDLIB
16331#include <stdlib.h>
16332#endif
16333#include <string.h>
16334#ifdef I_MALLOC
16335#  include <malloc.h>
16336#endif
16337int main()
16338{
16339    int result = 0;
16340    time_t t = time(0L);
16341    char w_tz[]="TZ" "=GMT+5",
16342	 e_tz[]="TZ" "=GMT-5",
16343	*tz_e = (char*)malloc(16),
16344	*tz_w = (char*)malloc(16);
16345    struct tm tm_e, tm_w;
16346    memset(&tm_e,'\0',sizeof(struct tm));
16347    memset(&tm_w,'\0',sizeof(struct tm));
16348    strcpy(tz_e,e_tz);
16349    strcpy(tz_w,w_tz);
16350
16351    putenv(tz_e);
16352    localtime_r(&t, &tm_e);
16353
16354    putenv(tz_w);
16355    localtime_r(&t, &tm_w);
16356
16357    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16358	result = 1;
16359
16360    free(tz_e);free(tz_w);
16361    return result;
16362}
16363EOCP
16364	set try
16365	if eval $compile; then
16366	    if $run ./try; then
16367		d_localtime_r_needs_tzset=undef;
16368	    else
16369		d_localtime_r_needs_tzset=define;
16370	    fi;
16371	else
16372	    d_localtime_r_needs_tzset=undef;
16373	fi;
16374     ;;
16375  *)
16376     d_localtime_r_needs_tzset=undef;
16377     ;;
16378esac
16379$rm_try
16380
16381: see if lockf exists
16382set lockf d_lockf
16383eval $inlibc
16384
16385: see if log1p exists
16386set log1p d_log1p
16387eval $inlibc
16388
16389: see if log2 exists
16390set log2 d_log2
16391eval $inlibc
16392
16393: see if logb exists
16394set logb d_logb
16395eval $inlibc
16396
16397: see if lrint exists
16398set lrint d_lrint
16399eval $inlibc
16400
16401: see if lrintl exists
16402set lrintl d_lrintl
16403eval $inlibc
16404
16405: see if lround exists
16406set lround d_lround
16407eval $inlibc
16408
16409: see if lroundl exists
16410set lroundl d_lroundl
16411eval $inlibc
16412
16413: see if prototype for lseek is available
16414echo " "
16415set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16416eval $hasproto
16417
16418: see if lstat exists
16419set lstat d_lstat
16420eval $inlibc
16421
16422: see if madvise exists
16423set madvise d_madvise
16424eval $inlibc
16425
16426: see if malloc_size exists
16427set malloc_size d_malloc_size
16428eval $inlibc
16429
16430: see if malloc_size_good exists
16431set malloc_good_size d_malloc_good_size
16432eval $inlibc
16433
16434: see if malloc_usable_size exists
16435set malloc_usable_size d_malloc_usable_size
16436eval $inlibc
16437
16438: see if mblen exists
16439set mblen d_mblen
16440eval $inlibc
16441
16442: see if mbrlen exists
16443set mbrlen d_mbrlen
16444eval $inlibc
16445
16446: see if mbrtowc exists
16447set mbrtowc d_mbrtowc
16448eval $inlibc
16449
16450: see if mbstowcs exists
16451set mbstowcs d_mbstowcs
16452eval $inlibc
16453
16454: see if mbtowc exists
16455set mbtowc d_mbtowc
16456eval $inlibc
16457
16458: see if memmem exists
16459: We need both a prototype in string.h and the symbol in libc.
16460echo " "
16461d_memmem_proto=''
16462xx1="#$d_gnulibc HAS_GNULIBC"
16463xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16464xx3='#   define _GNU_SOURCE'
16465xx4='#endif'
16466set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16467eval $hasproto
16468case "$d_memmem_proto" in
16469    define) # see if memmem exists
16470	set memmem d_memmem
16471	eval $inlibc
16472	;;
16473    *)  val=$undef
16474	set d_memmem
16475	eval $setvar
16476	;;
16477esac
16478
16479: see if memrchr exists
16480: We need both a prototype in string.h and the symbol in libc.
16481echo " "
16482d_memrchr_proto=''
16483xx1="#$d_gnulibc HAS_GNULIBC"
16484xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16485xx3='#   define _GNU_SOURCE'
16486xx4='#endif'
16487set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16488eval $hasproto
16489case "$d_memrchr_proto" in
16490    define) # see if memrchr exists
16491	set memrchr d_memrchr
16492	eval $inlibc
16493	;;
16494    *)  val=$undef
16495	set d_memrchr
16496	eval $setvar
16497	;;
16498esac
16499
16500: see if mkdir exists
16501set mkdir d_mkdir
16502eval $inlibc
16503
16504: see if mkdtemp exists
16505set mkdtemp d_mkdtemp
16506eval $inlibc
16507
16508: see if mkfifo exists
16509set mkfifo d_mkfifo
16510eval $inlibc
16511
16512: see if mkostemp exists
16513set mkostemp d_mkostemp
16514eval $inlibc
16515
16516: see if mkstemp exists
16517set mkstemp d_mkstemp
16518eval $inlibc
16519
16520: see if mkstemps exists
16521set mkstemps d_mkstemps
16522eval $inlibc
16523
16524: see if mktime exists
16525set mktime d_mktime
16526eval $inlibc
16527
16528: see if sys/mman.h has to be included
16529set sys/mman.h i_sysmman
16530eval $inhdr
16531
16532: see if mmap exists
16533set mmap d_mmap
16534eval $inlibc
16535: see what shmat returns
16536: default to something harmless
16537mmaptype='void *'
16538case "$i_sysmman$d_mmap" in
16539"$define$define")
16540	$cat >mmap.c <<'END'
16541#include <sys/mman.h>
16542void *mmap();
16543END
16544	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16545		mmaptype='void *'
16546	else
16547		mmaptype='caddr_t'
16548	fi
16549	echo "and it returns ($mmaptype)." >&4
16550	;;
16551esac
16552
16553: see if sqrtl exists
16554set sqrtl d_sqrtl
16555eval $inlibc
16556
16557: see if scalbnl exists
16558set scalbnl d_scalbnl
16559eval $inlibc
16560
16561: see if truncl exists
16562set truncl d_truncl
16563eval $inlibc
16564
16565: see if modfl exists
16566set modfl d_modfl
16567eval $inlibc
16568
16569: see if prototype for modfl is available
16570echo " "
16571set d_modflproto modfl define math.h
16572eval $hasproto
16573
16574if $test "$uselongdouble" = "$define"; then
16575    message=""
16576    if $test "$d_sqrtl" != "$define"; then
16577	message="$message sqrtl"
16578    fi
16579    if $test "$d_modfl" != "$define"; then
16580	if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16581	    echo "You have both truncl and copysignl, so I can emulate modfl."
16582	else
16583	    if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16584		echo "You have both aintl and copysignl, so I can emulate modfl."
16585	    else
16586		message="$message modfl"
16587	    fi
16588	fi
16589    fi
16590    if $test "$d_frexpl" != "$define"; then
16591	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16592	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16593	else
16594	    message="$message frexpl"
16595	fi
16596    fi
16597    if $test "$d_ldexpl" != "$define"; then
16598	message="$message ldexpl"
16599    fi
16600
16601    if $test "$message" != ""; then
16602	$cat <<EOM >&4
16603
16604*** You requested the use of long doubles but you do not seem to have
16605*** the following mathematical functions needed for long double support:
16606***    $message
16607*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16608*** Cannot continue, aborting.
16609
16610EOM
16611
16612	exit 1
16613    fi
16614fi
16615
16616: see if mprotect exists
16617set mprotect d_mprotect
16618eval $inlibc
16619
16620: see if msgctl exists
16621set msgctl d_msgctl
16622eval $inlibc
16623
16624: see if msgget exists
16625set msgget d_msgget
16626eval $inlibc
16627
16628: see if msgsnd exists
16629set msgsnd d_msgsnd
16630eval $inlibc
16631
16632: see if msgrcv exists
16633set msgrcv d_msgrcv
16634eval $inlibc
16635
16636: see how much of the 'msg*(2)' library is present.
16637h_msg=true
16638echo " "
16639case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16640*"$undef"*) h_msg=false;;
16641esac
16642case "$osname" in
16643freebsd)
16644    case "`ipcs 2>&1`" in
16645    "SVID messages"*"not configured"*)
16646	echo "Your $osname does not have the msg*(2) configured." >&4
16647        h_msg=false
16648	val="$undef"
16649	set msgctl d_msgctl
16650	eval $setvar
16651	set msgget d_msgget
16652	eval $setvar
16653	set msgsnd d_msgsnd
16654	eval $setvar
16655	set msgrcv d_msgrcv
16656	eval $setvar
16657	;;
16658    esac
16659    ;;
16660esac
16661: we could also check for sys/ipc.h ...
16662if $h_msg && $test `./findhdr sys/msg.h`; then
16663	echo "You have the full msg*(2) library." >&4
16664	val="$define"
16665else
16666	echo "You don't have the full msg*(2) library." >&4
16667	val="$undef"
16668fi
16669set d_msg
16670eval $setvar
16671
16672: Check for msghdr_s
16673echo " "
16674echo "Checking to see if your system supports struct msghdr..." >&4
16675set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16676eval $hasstruct
16677case "$d_msghdr_s" in
16678"$define")      echo "Yes, it does."   ;;
16679*)              echo "No, it doesn't." ;;
16680esac
16681
16682: see if msync exists
16683set msync d_msync
16684eval $inlibc
16685
16686: see if munmap exists
16687set munmap d_munmap
16688eval $inlibc
16689
16690: see if nan exists
16691set nan d_nan
16692eval $inlibc
16693
16694: see if nanosleep exists
16695set nanosleep d_nanosleep
16696eval $inlibc
16697
16698: see if nearbyint exists
16699set nearbyint d_nearbyint
16700eval $inlibc
16701
16702: see if nextafter exists
16703set nextafter d_nextafter
16704eval $inlibc
16705
16706: see if nexttoward exists
16707set nexttoward d_nexttoward
16708eval $inlibc
16709
16710: see if nice exists
16711set nice d_nice
16712eval $inlibc
16713
16714: see if this is a langinfo.h system
16715set langinfo.h i_langinfo
16716eval $inhdr
16717
16718: see if nl_langinfo and/or nl_langinfo_l exist
16719set nl_langinfo d_nl_langinfo
16720eval $inlibc
16721set nl_langinfo_l d_nl_langinfo_l
16722eval $inlibc
16723
16724: Look for non 'int'-sized bitfields
16725case "$d_non_int_bitfields" in
16726'')
16727echo " " >&4
16728echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16729$cat >try.c <<'EOCP'
16730#include <stdio.h>
16731struct foo {
16732    unsigned char byte:1;
16733    unsigned short halfword:1;
16734} bar;
16735EOCP
16736if $cc $ccflags -c try.c >try.out 2>&1 ; then
16737	if $compiler_warning try.out >/dev/null 2>&1; then
16738		echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16739		val="$undef"
16740	else
16741		echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16742		val="$define"
16743	fi
16744else
16745	echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16746	val="$undef"
16747fi
16748;;
16749*) val="$d_non_int_bitfields" ;;
16750esac
16751set d_non_int_bitfields
16752eval $setvar
16753$rm_try
16754
16755: see if this is a quadmath.h system
16756set quadmath.h i_quadmath
16757eval $inhdr
16758
16759: Check basic sizes
16760echo " "
16761$echo "Choosing the C types to be used for Perl's internal types..." >&4
16762
16763case "$use64bitint:$d_quad:$quadtype" in
16764define:define:?*)
16765	ivtype="$quadtype"
16766	uvtype="$uquadtype"
16767	ivsize=8
16768	uvsize=8
16769	;;
16770*)	ivtype="long"
16771	uvtype="unsigned long"
16772	ivsize=$longsize
16773	uvsize=$longsize
16774	;;
16775esac
16776
16777case "$uselongdouble:$d_longdbl" in
16778define:define)
16779	nvtype="long double"
16780	nvsize=$longdblsize
16781	;;
16782*)	nvtype=double
16783	nvsize=$doublesize
16784	;;
16785esac
16786
16787case "$usequadmath:$i_quadmath" in
16788define:define)
16789  nvtype="__float128"
16790  nvsize=16
16791  : libquadmath is not in the usual places, and the place
16792  : changes if the compiler is upgraded.  So ask the compiler if it
16793  : can find it.
16794  : We do not need to save this, if it fails we abort.
16795  libs="$libs -lquadmath"
16796  set try
16797  $cat >try.c <<EOM
16798#include <quadmath.h>
16799#include <stdio.h>
16800int main(int argc, char *argv[]) {
16801  __float128 x = 1.0;
16802  if (fabsq(logq(x)) > 1e-6) {
16803     fputs("quadmath is broken\n", stderr);
16804     return 1;
16805  }
16806  puts("define");
16807  return 0;
16808}
16809EOM
16810  yyy=''
16811  if eval $compile_ok; then
16812      yyy=`$run ./try`
16813      case "$yyy" in
16814      define) ;;
16815      *) cat <<EOM >&4
16816
16817*** You requested the use of the quadmath library, but
16818*** it appears to be nonfunctional.
16819*** Cannot continue, aborting.
16820
16821EOM
16822       exit 1
16823       ;;
16824       esac
16825  else
16826      $cat <<EOM >&4
16827
16828*** You requested the use of the quadmath library, but you
16829*** do not seem to have the quadmath library installed.
16830*** Cannot continue, aborting.
16831EOM
16832    exit 1
16833  fi
16834  ;;
16835define:*) $cat <<EOM >&4
16836
16837*** You requested the use of the quadmath library, but you
16838*** do not seem to have the required header, <quadmath.h>.
16839EOM
16840  case "$gccversion" in
16841  [23].*|4.[0-5]*)
16842   $cat <<EOM >&4
16843*** Your gcc looks a bit old:
16844*** $gccversion
16845EOM
16846    ;;
16847  '')
16848   $cat <<EOM >&4
16849*** You are not running a gcc.
16850EOM
16851    ;;
16852  esac
16853  $cat <<EOM >&4
16854*** For the quadmath library you need at least gcc 4.6.
16855*** Cannot continue, aborting.
16856EOM
16857  exit 1
16858  ;;
16859esac
16860
16861$echo "(IV will be "$ivtype", $ivsize bytes)"
16862$echo "(UV will be "$uvtype", $uvsize bytes)"
16863$echo "(NV will be "$nvtype", $nvsize bytes)"
16864
16865$cat >try.c <<EOCP
16866#$i_inttypes I_INTTYPES
16867#ifdef I_INTTYPES
16868#include <inttypes.h>
16869#endif
16870#include <stdio.h>
16871int main() {
16872#ifdef INT8
16873   int8_t i =  INT8_MAX;
16874  uint8_t u = UINT8_MAX;
16875  printf("int8_t\n");
16876#endif
16877#ifdef INT16
16878   int16_t i =  INT16_MAX;
16879  uint16_t u = UINT16_MAX;
16880  printf("int16_t\n");
16881#endif
16882#ifdef INT32
16883   int32_t i =  INT32_MAX;
16884  uint32_t u = UINT32_MAX;
16885  printf("int32_t\n");
16886#endif
16887}
16888EOCP
16889
16890i8type="signed char"
16891u8type="unsigned char"
16892i8size=1
16893u8size=1
16894
16895case "$i16type" in
16896'')	case "$shortsize" in
16897	2)	i16type=short
16898		u16type="unsigned short"
16899		i16size=$shortsize
16900		u16size=$shortsize
16901		;;
16902	esac
16903	;;
16904esac
16905case "$i16type" in
16906'')	set try -DINT16
16907	if eval $compile; then
16908		case "`$run ./try`" in
16909		int16_t)
16910			i16type=int16_t
16911			u16type=uint16_t
16912			i16size=2
16913			u16size=2
16914			;;
16915		esac
16916	fi
16917	;;
16918esac
16919case "$i16type" in
16920'')	if $test $shortsize -ge 2; then
16921		i16type=short
16922		u16type="unsigned short"
16923		i16size=$shortsize
16924		u16size=$shortsize
16925	fi
16926	;;
16927esac
16928
16929case "$i32type" in
16930'')	case "$longsize" in
16931	4)	i32type=long
16932		u32type="unsigned long"
16933		i32size=$longsize
16934		u32size=$longsize
16935		;;
16936	*)	case "$intsize" in
16937		4)	i32type=int
16938			u32type="unsigned int"
16939			i32size=$intsize
16940			u32size=$intsize
16941			;;
16942		esac
16943		;;
16944	esac
16945	;;
16946esac
16947case "$i32type" in
16948'')	set try -DINT32
16949	if eval $compile; then
16950		case "`$run ./try`" in
16951		int32_t)
16952			i32type=int32_t
16953			u32type=uint32_t
16954			i32size=4
16955			u32size=4
16956			;;
16957		esac
16958	fi
16959	;;
16960esac
16961case "$i32type" in
16962'')	if $test $intsize -ge 4; then
16963		i32type=int
16964		u32type="unsigned int"
16965		i32size=$intsize
16966		u32size=$intsize
16967	fi
16968	;;
16969esac
16970
16971case "$i64type" in
16972'')	case "$d_quad:$quadtype" in
16973	define:?*)
16974		i64type="$quadtype"
16975		u64type="$uquadtype"
16976		i64size=8
16977		u64size=8
16978		;;
16979	esac
16980	;;
16981esac
16982
16983$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16984$cat <<EOP >try.c
16985#include <stdio.h>
16986#$i_stdlib I_STDLIB
16987#ifdef I_STDLIB
16988#include <stdlib.h>
16989#endif
16990#$i_inttypes I_INTTYPES
16991#ifdef I_INTTYPES
16992#include <inttypes.h>
16993#endif
16994#include <sys/types.h>
16995#include <signal.h>
16996#ifdef SIGFPE
16997/* volatile so that the compiler has to store it out to memory */
16998volatile int bletched = 0;
16999$signal_t blech(int s) { bletched = 1; }
17000#endif
17001int main() {
17002    $uvtype u = 0;
17003    $nvtype d;
17004    int     n = 8 * $uvsize;
17005    int     i;
17006#ifdef SIGFPE
17007    signal(SIGFPE, blech);
17008#endif
17009
17010    for (i = 0; i < n; i++) {
17011      u = u << 1 | ($uvtype)1;
17012      d = ($nvtype)u;
17013      if (($uvtype)d != u)
17014        break;
17015      if (d <= 0)
17016	break;
17017      d = ($nvtype)(u - 1);
17018      if (($uvtype)d != (u - 1))
17019        break;
17020#ifdef SIGFPE
17021      if (bletched)
17022	break;
17023#endif
17024    }
17025    printf("%d\n", ((i == n) ? -n : i));
17026    exit(0);
17027}
17028EOP
17029set try
17030
17031d_nv_preserves_uv="$undef"
17032if eval $compile; then
17033	nv_preserves_uv_bits="`$run ./try`"
17034fi
17035case "$nv_preserves_uv_bits" in
17036\-[1-9]*)
17037	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17038	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  >&4
17039	d_nv_preserves_uv="$define"
17040	;;
17041[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  >&4
17042	d_nv_preserves_uv="$undef" ;;
17043*)	$echo "Can't figure out how many bits your NVs preserve." >&4
17044	nv_preserves_uv_bits="0" ;;
17045esac
17046$rm_try
17047
17048$echo "Checking to find the largest integer value your NVs can hold..." >&4
17049$cat <<EOP >try.c
17050#include <stdio.h>
17051
17052typedef $nvtype NV;
17053
17054int
17055main() {
17056  NV value = 2;
17057  int count = 1;
17058
17059  while(count < 256) {
17060    /* volatile so that the compiler has to store it out to memory */
17061    volatile NV up = value + 1.0;
17062    volatile NV negated = -value;
17063    volatile NV down = negated - 1.0;
17064    volatile NV got_up = up - value;
17065    int up_good = got_up == 1.0;
17066    int got_down = down - negated;
17067    int down_good = got_down == -1.0;
17068
17069    if (down_good != up_good) {
17070      fprintf(stderr,
17071	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17072	      up_good, (double) got_up, down_good, (double) got_down,
17073	      count, (double) value);
17074      return 1;
17075    }
17076    if (!up_good) {
17077      while (1) {
17078	if (count > 8) {
17079	  count -= 8;
17080	  fputs("256.0", stdout);
17081	} else {
17082	  count--;
17083	  fputs("2.0", stdout);
17084	}
17085	if (!count) {
17086	  puts("");
17087	  return 0;
17088	}
17089	fputs("*", stdout);
17090      }
17091    }
17092    value *= 2;
17093    ++count;
17094  }
17095  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17096	  count, (double) value);
17097  return 1;
17098}
17099EOP
17100set try
17101
17102nv_overflows_integers_at='0'
17103if eval $compile; then
17104    xxx="`$run ./try`"
17105    case "$?" in
17106	0)
17107	    case "$xxx" in
17108		2*)  cat >&4 <<EOM
17109The largest integer your NVs can preserve is equal to $xxx
17110EOM
17111		    nv_overflows_integers_at="$xxx"
17112		    ;;
17113		*)  cat >&4 <<EOM
17114Cannot determine the largest integer value your NVs can hold, unexpected output
17115'$xxx'
17116EOM
17117		    ;;
17118	    esac
17119	    ;;
17120	*)  cat >&4 <<EOM
17121Cannot determine the largest integer value your NVs can hold
17122EOM
17123	    ;;
17124    esac
17125fi
17126$rm_try
17127
17128$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17129$cat <<EOP >try.c
17130#include <stdio.h>
17131#$i_stdlib I_STDLIB
17132#ifdef I_STDLIB
17133#include <stdlib.h>
17134#endif
17135#include <string.h>
17136#include <sys/types.h>
17137#include <signal.h>
17138#ifdef SIGFPE
17139/* volatile so that the compiler has to store it out to memory */
17140volatile int bletched = 0;
17141$signal_t blech(int s) { bletched = 1; }
17142#endif
17143
17144int checkit($nvtype d, const char *where) {
17145    void *v = &d;
17146    unsigned char *p = (unsigned char *)v;
17147    unsigned char *end = p + sizeof(d);
17148    int fail = 0;
17149
17150    while (p < end)
17151	fail += *p++;
17152
17153    if (!fail)
17154	return 0;
17155
17156    p = (unsigned char *)v;
17157    printf("No - %s: 0x", where);
17158    while (p < end)
17159	printf ("%02X", *p++);
17160    printf("\n");
17161    return 1;
17162}
17163
17164int main(int argc, char **argv) {
17165    $nvtype d = 0.0;
17166    int fail = 0;
17167    fail += checkit(d, "0.0");
17168
17169    /* The compiler shouldn't be assuming that bletched is 0  */
17170    d = bletched;
17171
17172    fail += checkit(d, "bleched");
17173
17174#ifdef SIGFPE
17175    signal(SIGFPE, blech);
17176#endif
17177
17178    /* Paranoia - the compiler should have no way of knowing that ANSI says
17179       that argv[argc] will always be NULL.  Actually, if it did assume this it
17180       would be buggy, as this is C and main() can be called from elsewhere in
17181       the program.  */
17182    d = argv[argc] ? 1 : 0;
17183
17184    if (d) {
17185	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17186    }
17187
17188    fail += checkit(d, "ternary");
17189
17190    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17191
17192    if (d != 0.0) {
17193	printf("No - memset doesn't give 0.0\n");
17194	/* This might just blow up:  */
17195	printf("(gives %g)\n", d);
17196	return 1;
17197    }
17198
17199#ifdef SIGFPE
17200    if (bletched) {
17201	printf("No - something bleched\n");
17202	return 1;
17203    }
17204#endif
17205    if (fail) {
17206      printf("No - %d fail(s)\n", fail);
17207      return 1;
17208    }
17209    printf("Yes\n");
17210    return 0;
17211}
17212EOP
17213set try
17214
17215d_nv_zero_is_allbits_zero="$undef"
17216if eval $compile; then
17217    xxx="`$run ./try`"
17218    case "$?" in
17219	0)
17220	    case "$xxx" in
17221		Yes)  cat >&4 <<EOM
172220.0 is represented as all bits zero in memory
17223EOM
17224		    d_nv_zero_is_allbits_zero="$define"
17225		    ;;
17226		*)  cat >&4 <<EOM
172270.0 is not represented as all bits zero in memory
17228EOM
17229		    d_nv_zero_is_allbits_zero="$undef"
17230		    ;;
17231	    esac
17232	    ;;
17233	*)  cat >&4 <<EOM
172340.0 is not represented as all bits zero in memory
17235EOM
17236	    d_nv_zero_is_allbits_zero="$undef"
17237	    ;;
17238    esac
17239fi
17240$rm_try
17241
17242: check for off64_t
17243echo " "
17244echo "Checking to see if you have off64_t..." >&4
17245$cat >try.c <<EOCP
17246#include <sys/types.h>
17247#include <unistd.h>
17248int main() { off64_t x = 7; }
17249EOCP
17250set try
17251if eval $compile; then
17252	val="$define"
17253	echo "You have off64_t."
17254else
17255	val="$undef"
17256	echo "You do not have off64_t."
17257	case "$lseeksize" in
17258	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17259	esac
17260fi
17261$rm_try
17262set d_off64_t
17263eval $setvar
17264
17265: how to create joinable pthreads
17266if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17267	echo " "
17268	echo "Checking what constant to use for creating joinable pthreads..." >&4
17269	$cat >try.c <<'EOCP'
17270#include <pthread.h>
17271int main() {
17272    int detachstate = JOINABLE;
17273}
17274EOCP
17275	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17276	if eval $compile; then
17277		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17278		val="$undef" # Yes, undef.
17279		set d_old_pthread_create_joinable
17280		eval $setvar
17281		val=""
17282		set old_pthread_create_joinable
17283		eval $setvar
17284	else
17285		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17286		if eval $compile; then
17287			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17288			val="$define"
17289			set d_old_pthread_create_joinable
17290			eval $setvar
17291			val=PTHREAD_CREATE_UNDETACHED
17292			set old_pthread_create_joinable
17293			eval $setvar
17294		else
17295			set try -DJOINABLE=__UNDETACHED
17296			if eval $compile; then
17297				echo "You seem to use __UNDETACHED." >&4
17298				val="$define"
17299				set d_old_pthread_create_joinable
17300				eval $setvar
17301				val=__UNDETACHED
17302				set old_pthread_create_joinable
17303				eval $setvar
17304			else
17305				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17306				val="$define"
17307				set d_old_pthread_create_joinable
17308				eval $setvar
17309				val=0
17310				set old_pthread_create_joinable
17311				eval $setvar
17312			fi
17313		fi
17314	fi
17315	$rm_try
17316else
17317    d_old_pthread_create_joinable="$undef"
17318    old_pthread_create_joinable=""
17319fi
17320
17321: see if pause exists
17322set pause d_pause
17323eval $inlibc
17324
17325: see if locale.h is available
17326set locale.h i_locale
17327eval $inhdr
17328
17329: see if this system has wctype.h
17330set wctype.h i_wctype
17331eval $inhdr
17332
17333: see if towupper exists
17334set towupper d_towupper
17335eval $inlibc
17336
17337: check for setlocale function and behavior
17338case "$d_setlocale" in
17339'')
17340$cat >&4 <<EOM
17341
17342Checking to see if you have setlocale() and its behavior
17343EOM
17344$cat >try.c <<EOCP
17345#include <stdlib.h>
17346#include <string.h>
17347#$i_locale I_LOCALE
17348#ifdef I_LOCALE
17349#  include <locale.h>
17350#endif
17351#$i_wctype I_WCTYPE
17352#ifdef I_WCTYPE
17353#  include <wctype.h>
17354#endif
17355
17356int main() {
17357    const char * invalid_name = "\a";   /* This is really invalid! */
17358    int accepts_any_locale_name = 0;
17359    int has_C_UTF8 = 0;
17360    unsigned char bad_setlocale = 255;
17361
17362    /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17363     * disabled.  It's hard to imagine an instance where meaningful locale
17364     * handling could be done without LC_CTYPE */
17365    const char *  name = setlocale(LC_CTYPE, "C");
17366
17367    if (name == NULL || strcmp(name, "C") != 0) {
17368        exit(bad_setlocale);
17369    }
17370
17371    name = setlocale(LC_CTYPE, invalid_name);
17372    if (name != NULL) {
17373
17374        /* Let it pass if it accepts the name but gives back one of the C
17375         * locales */
17376        if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17377            accepts_any_locale_name = 1;
17378        }
17379    }
17380
17381    name = setlocale(LC_CTYPE, "C.UTF-8");
17382    if (name != NULL) {
17383        unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17384
17385#$d_towupper HAS_TOWUPPER
17386#ifdef HAS_TOWUPPER
17387
17388        /* We assume that if the machine doesn't have the C99 towupper, it
17389         * doesn't have C.UTF-8, even if we successfully changed locales to
17390         * include it.  This seems safer even on platforms that didn't accept
17391         * the really invalid name */
17392
17393        if (towupper(y_with_diaeresis) == 0x178) {
17394            has_C_UTF8 = 1;
17395        }
17396
17397#endif
17398
17399    }
17400
17401    exit( 0 /* (separator - min_separator) << 3
17402        | uses_name_value_pair_names      << 2
17403          */
17404        | has_C_UTF8                      << 1
17405        | accepts_any_locale_name);
17406
17407}
17408EOCP
17409val=
17410set d_setlocale
17411eval $setvar
17412case $d_setlocale in
17413    $undef) d_setlocale_accepts_any_locale_name="$undef"
17414            d_has_C_UTF8="false"
17415            ;;
17416    *) set try
17417       if eval $compile; then
17418           echo "Your system has setlocale()..." >&4
17419           $run ./try
17420           case $? in
17421               0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
17422                  d_setlocale="$define"
17423                  d_setlocale_accepts_any_locale_name="$undef"
17424                  d_has_C_UTF8="false"
17425                  ;;
17426               1) echo "and it seems sane, but accepts any locale name as valid" >&4
17427                  d_setlocale="$define"
17428                  d_setlocale_accepts_any_locale_name="$define"
17429                  d_has_C_UTF8="false"
17430                  ;;
17431               2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
17432                  d_setlocale="$define"
17433                  d_setlocale_accepts_any_locale_name="$undef"
17434                  d_has_C_UTF8="true"
17435                  ;;
17436               3) echo "and it seems sane, but accepts any locale name as valid" >&4
17437                  d_setlocale="$define"
17438                  d_setlocale_accepts_any_locale_name="$define"
17439                  d_has_C_UTF8="true"
17440                  ;;
17441               *) echo "but it doesn't seem to work, so we won't use it." >&4
17442                  d_setlocale="$undef"
17443                  d_setlocale_accepts_any_locale_name="$undef"
17444                  d_has_C_UTF8="false"
17445                  ;;
17446           esac
17447       else
17448           echo "your system does not have setlocale()" >&4
17449           d_setlocale="$undef"
17450           d_setlocale_accepts_any_locale_name="$undef"
17451           d_has_C_UTF8="false"
17452       fi
17453esac
17454$rm_try
17455;;
17456*) val="$d_setlocale"
17457    set d_setlocale
17458    eval $setvar
17459    case "$d_setlocale" in
17460        $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
17461        ;;
17462    esac
17463    rp="Does your system have the C.UTF-8 locale?"
17464    dflt=n
17465    . ./myread
17466    case "$ans" in
17467        [Yy]*) d_has_C_UTF8="true"
17468               c_utf8_locale=" or C.UTF-8"
17469               ;;
17470        *)     d_has_C_UTF8="false"
17471               c_utf8_locale=""
17472               ;;
17473    esac
17474    case "$d_setlocale" in
17475        $define)
17476            rp="When you set your locale to something besides C$c_utf8_locale, does it actually do so? (Answer no if it just pretends to set it)" >&4
17477            dflt=n
17478            . ./myread
17479            case "$ans" in
17480                true|[Yy]*)
17481		   d_setlocale_accepts_any_locale_name="$define"
17482		   ;;
17483		*) d_setlocale_accepts_any_locale_name="$undef"
17484		   ;;
17485            esac
17486            ;;
17487        *) d_setlocale_accepts_any_locale_name="$undef"
17488	   ;;
17489    esac
17490esac
17491
17492: Check the syntax of LC_ALL when categories are set to different locales
17493echo " "
17494$echo "Checking the syntax of LC_ALL when categories are set to different locales..." >&4
17495
17496case $d_setlocale in
17497    $define)
17498$rm -f try try.*
17499$cat >try.c <<'EOF'
17500#include <limits.h>
17501#include <locale.h>
17502#include <stdlib.h>
17503#include <string.h>
17504#include <stdio.h>
17505
17506#ifndef LC_ALL
17507
17508int
17509main (const int argc, const char ** argv)
17510{
17511}
17512
17513#else
17514#  define C_ARRAY_LENGTH(a)  (sizeof(a)/sizeof((a)[0]))
17515#  define strEQ(s1,s2) (strcmp(s1,s2) == 0)
17516#  define strNE(s1,s2) (strcmp(s1,s2) != 0)
17517#  define Copy(s,d,n,t) (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t))
17518#  define memEQ(s1,s2,l) (memcmp(((const void *) (s1)), ((const void *) (s2)), l) == 0)
17519#  define memNE(s1,s2,l) (! memEQ(s1,s2,l))
17520
17521int
17522main (const int argc, const char ** argv)
17523{
17524
17525    int debug = 0;
17526
17527    /* All categories Perl knows about on any system.  If any are missing, this
17528     * won't work for that system, and they must be added here and in perl.h,
17529     * locale.c */
17530    const int categories[] = {
17531
17532#  ifdef LC_CTYPE
17533        LC_CTYPE,
17534#  endif
17535#  ifdef LC_NUMERIC
17536        LC_NUMERIC,
17537#  endif
17538#  ifdef LC_COLLATE
17539        LC_COLLATE,
17540#  endif
17541#  ifdef LC_TIME
17542        LC_TIME,
17543#  endif
17544#  ifdef LC_MESSAGES
17545        LC_MESSAGES,
17546#  endif
17547#  ifdef LC_MONETARY
17548        LC_MONETARY,
17549#  endif
17550#  ifdef LC_ADDRESS
17551        LC_ADDRESS,
17552#  endif
17553#  ifdef LC_IDENTIFICATION
17554        LC_IDENTIFICATION,
17555#  endif
17556#  ifdef LC_MEASUREMENT
17557        LC_MEASUREMENT,
17558#  endif
17559#  ifdef LC_PAPER
17560        LC_PAPER,
17561#  endif
17562#  ifdef LC_TELEPHONE
17563        LC_TELEPHONE,
17564#  endif
17565#  ifdef LC_NAME
17566        LC_NAME,
17567#  endif
17568#  ifdef LC_SYNTAX
17569        LC_SYNTAX,
17570#  endif
17571#  ifdef LC_TOD
17572        LC_TOD
17573#  endif
17574
17575    };
17576
17577    const char * category_names[] = {
17578
17579#  ifdef LC_CTYPE
17580        "LC_CTYPE",
17581#  endif
17582#  ifdef LC_NUMERIC
17583        "LC_NUMERIC",
17584#  endif
17585#  ifdef LC_COLLATE
17586        "LC_COLLATE",
17587#  endif
17588#  ifdef LC_TIME
17589        "LC_TIME",
17590#  endif
17591#  ifdef LC_MESSAGES
17592        "LC_MESSAGES",
17593#  endif
17594#  ifdef LC_MONETARY
17595        "LC_MONETARY",
17596#  endif
17597#  ifdef LC_ADDRESS
17598        "LC_ADDRESS",
17599#  endif
17600#  ifdef LC_IDENTIFICATION
17601        "LC_IDENTIFICATION",
17602#  endif
17603#  ifdef LC_MEASUREMENT
17604        "LC_MEASUREMENT",
17605#  endif
17606#  ifdef LC_PAPER
17607        "LC_PAPER",
17608#  endif
17609#  ifdef LC_TELEPHONE
17610        "LC_TELEPHONE",
17611#  endif
17612#  ifdef LC_NAME
17613        "LC_NAME",
17614#  endif
17615#  ifdef LC_SYNTAX
17616        "LC_SYNTAX",
17617#  endif
17618#  ifdef LC_TOD
17619        "LC_TOD"
17620#  endif
17621
17622    };
17623
17624    char alternate[1024] = { '\0' } ;
17625
17626    /* This is a list of locales that are likely to be found on any machine
17627     * (Windows and non-Windows) */
17628    const char * candidates[] = {
17629                                  "POSIX",
17630                                  "C.UTF-8",
17631                                  "en_US",
17632                                  "en_US.UTF-8",
17633                                  "American",
17634                                  "English"
17635                                };
17636    char separator[1024];
17637    size_t separator_len = 0;
17638    unsigned int distincts_count = 0;
17639
17640    /* We look through the candidates for one which returns the same non-C
17641     * locale for every category */
17642    for (unsigned int i = 0; i < C_ARRAY_LENGTH(candidates); i++) {
17643        const char * candidate = candidates[i];
17644        distincts_count = 0;
17645        alternate[0] = '\0';
17646
17647        for (unsigned int j = 0; j < C_ARRAY_LENGTH(categories); j++) {
17648            const int category = categories[j];
17649            const char * locale_name = setlocale(category, candidate);
17650
17651            if (locale_name == NULL) {  /* Not on this system */
17652                break;
17653            }
17654
17655            if (debug) fprintf(stderr,
17656                               "i=%d,j=%d;"
17657                               " Return of setlocale(%d=%s, '%s') is '%s'\n",
17658                               i, j,
17659                               category, category_names[j],
17660                               candidate, locale_name);
17661
17662            /* If the candidate is indistinguishable from C, break to try the
17663             * next candidate */
17664            if (strEQ(locale_name, "C")) {
17665                break;
17666            }
17667
17668            /* Save the name the first time through, and on subsequent ones */
17669            /* make sure the name is the same as before, so the code below can
17670             * be assured of finding it when searching */
17671            if (j == 0) {
17672                strncpy(alternate, locale_name, sizeof(alternate));
17673            }
17674            else if (strNE(alternate, locale_name)) {
17675                break;
17676            }
17677
17678            distincts_count++;
17679        }
17680
17681        /* Done with this candidate.  If every category returned the same non-C
17682         * name, this candidate works.  It not, loop to try the next candidate
17683         * */
17684        if (distincts_count == C_ARRAY_LENGTH(categories)) {
17685            break;
17686        }
17687    }
17688
17689    /* Here, either found a suitable candidate, or exhausted the possibilities.
17690     * In the latter case, give up */
17691    if (distincts_count < C_ARRAY_LENGTH(categories)) {
17692        fprintf(stderr, "Couldn't find a locale distinguishable from C\n");
17693        return 1;
17694    }
17695
17696    /* An example syntax, from cygwin, is:
17697     *     LC_COLLATE/LC_CTYPE/LC_MONETARY/LC_NUMERIC/LC_TIME/LC_MESSAGES
17698     * The locales for a given category are always in the same position,
17699     * indicated above, with a slash separating them */
17700
17701    int map_LC_ALL_position_to_category[C_ARRAY_LENGTH(categories)];
17702
17703    /* Initialize */
17704    for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17705        map_LC_ALL_position_to_category[i] = INT_MAX;
17706    }
17707
17708    const char * lc_all = NULL;
17709
17710    /* We need to find the category that goes in each position */
17711    for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17712
17713        /* First set everything to 'C' */
17714        if (! setlocale(LC_ALL, "C")) {
17715            fprintf(stderr, "Failed to set LC_ALL to C\n");
17716            return 1;
17717        }
17718
17719        /* Then set this category to the alternate */
17720        if (! setlocale(categories[i], alternate)) {
17721            fprintf(stderr, "Failed to set %d to to '%s'\n",
17722                            categories[i], alternate);
17723            return 1;
17724        }
17725
17726        /* Then find what the system says LC_ALL looks like with just this one
17727         * category not set to 'C' */
17728        lc_all = setlocale(LC_ALL, NULL);
17729        if (! lc_all) {
17730            fprintf(stderr, "Failed to retrieve LC_ALL\n");
17731            return 1;
17732        }
17733
17734        if (debug) fprintf(stderr, "LC_ALL is '%s'\n", lc_all);
17735
17736        /* Assume is name=value pairs if the result contains both an equals and
17737         * a semi-colon. */
17738        if (strchr(lc_all, '=') && strchr(lc_all, ';')) {
17739            fprintf(stdout, "\"=;\"\n\n");
17740            return 0;
17741        }
17742
17743        /* Here isn't name=value pairs.  Find the position of the alternate */
17744        const char * alt_pos = strstr(lc_all, alternate);
17745        if (! alt_pos) {
17746            fprintf(stderr, "Couldn't find '%s' in '%s'\n", alternate, lc_all);
17747            return 1;
17748        }
17749
17750        /* Parse the LC_ALL string from the beginning up to where the alternate
17751         * locale is */
17752        const char * s = lc_all;
17753        int count = 0;
17754        while (s < alt_pos) {
17755
17756            /* Count the 'C' locales before the non-C one.  (Note the letter
17757             * 'C' can only occur as the entire 'C' locale, since all of them
17758             * are that locale before 'alt_pos') */
17759            const char * next_C = (const char *) memchr(s, 'C', alt_pos - s);
17760            if (next_C) {
17761                count++;
17762                s = next_C + 1;
17763                continue;
17764            }
17765
17766            /* Here, there is no 'C' between 's' and the alternate locale, so
17767             * 'count' gives the total number of occurrences of 'C' in that
17768             * span.  If count is 0, this is the first category in an LC_ALL
17769             * string, and we know its position, but not the separator. */
17770            if (count == 0) {
17771                break;
17772            }
17773
17774            /* When 'count' isn't 0,  's' points to one past the previous 'C'.
17775             * The separator starts here, ending just before the non-C locale.
17776             */
17777
17778            const char * new_sep = s;
17779            unsigned int new_sep_len = alt_pos - s;
17780
17781            /* If we don't already have a separator saved, save this as it */
17782            if (separator_len == 0) {
17783                separator_len = new_sep_len;
17784                Copy(s, separator, separator_len, char);
17785                separator[separator_len] = '\0';
17786            }
17787            else {  /* Otherwise make sure it's the same string as previously
17788                     * calculated */
17789                if (   new_sep_len != separator_len
17790                    || memNE(separator, new_sep, separator_len))
17791                {
17792                    fprintf(stderr, "Unexpectedly got distinct separators"
17793                                    " '%s' vs '%s\n", separator, new_sep);
17794                    return 1;
17795                }
17796            }
17797
17798            /* Here, we have found the position of category[i] in LC_ALL. */
17799            break;
17800
17801        } /* End of loop parsing the LC_ALL string */
17802
17803        if (map_LC_ALL_position_to_category[count] != INT_MAX) {
17804            fprintf(stderr, "Categories %d and %d both appear to occupy"
17805                            " position %d in LC_ALL; there is something"
17806                            " wrong with the calculation\n",
17807                            categories[count], categories[i],
17808                            count);
17809            return 1;
17810        }
17811
17812        /* Save the position of this category */
17813        map_LC_ALL_position_to_category[count] = categories[i];
17814
17815    } /* End of loop through all the categories */
17816
17817    fprintf(stdout, "\"%s\"\n{", separator);
17818    for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories) - 1; i++) {
17819        fprintf(stdout, " %d,", map_LC_ALL_position_to_category[i]);
17820    }
17821    fprintf(stdout, " %d }\n", map_LC_ALL_position_to_category[
17822                                                C_ARRAY_LENGTH(categories) - 1]);
17823    return 0;
17824
17825}
17826
17827#endif
17828EOF
17829set try
17830if eval $compile_ok; then
17831    output=`$run ./try 2>/dev/null`
17832    separator=`echo "$output" | $sed 1q`
17833    case $separator in
17834	"\"=;\"")
17835          d_perl_lc_all_uses_name_value_pairs="$define"
17836          d_perl_lc_all_separator="$undef"
17837            perl_lc_all_separator=
17838	  d_perl_lc_all_category_positions_init="$undef"
17839	    perl_lc_all_category_positions_init=
17840	    ;;
17841	"") d_perl_lc_all_uses_name_value_pairs="$undef"
17842            d_perl_lc_all_separator="$undef"
17843              perl_lc_all_separator=
17844	    d_perl_lc_all_category_positions_init="$undef"
17845	      perl_lc_all_category_positions_init=
17846	    ;;
17847        *)  d_perl_lc_all_uses_name_value_pairs="$undef"
17848            d_perl_lc_all_separator="$define"
17849              perl_lc_all_separator="$separator"
17850	    d_perl_lc_all_category_positions_init="$define"
17851	      perl_lc_all_category_positions_init=`echo "$output" | sed -n 2p`
17852	    ;;
17853    esac
17854else
17855    $echo "Failed to compile lc_all probe" >&4
17856fi
17857$rm -f try try.*
17858;;
17859*)        d_perl_lc_all_separator="$undef"
17860            perl_lc_all_separator=
17861	  d_perl_lc_all_category_positions_init="$undef"
17862	    perl_lc_all_category_positions_init=
17863
17864          # No setlocale(), but using this default allows our code to compile
17865          # and run without having to have a bunch more #ifdef's
17866          d_perl_lc_all_uses_name_value_pairs="$define"
17867;;
17868esac
17869
17870: see if pipe2 exists
17871set pipe2 d_pipe2
17872eval $inlibc
17873
17874: see if poll exists
17875set poll d_poll
17876eval $inlibc
17877
17878: see if prctl exists
17879set prctl d_prctl
17880eval $inlibc
17881
17882: see if prctl supports PR_SET_NAME
17883d_prctl_set_name=$undef
17884case $d_prctl in
17885    $define)
17886	$cat >try.c <<EOM
17887#ifdef __ANDROID__
17888#include <unistd.h>
17889#endif
17890#include <sys/prctl.h>
17891
17892int main (int argc, char *argv[])
17893{
17894    return (prctl (PR_SET_NAME, "Test"));
17895    } /* main */
17896EOM
17897	set try
17898	if eval $compile_ok && $run ./try; then
17899	    echo "Your prctl (PR_SET_NAME, ...) works"
17900	    d_prctl_set_name=$define
17901	    fi
17902	$rm_try
17903	;;
17904    esac
17905
17906: see if readlink exists
17907set readlink d_readlink
17908eval $inlibc
17909
17910: Check if there is a /proc symlink to the abs path of
17911: the executing program.  We will honor hints of d_procselfexe=$undef
17912: or procselfexe being non-empty, otherwise will try to determine both
17913: if we have readlink.
17914: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17915: referenced, and AmigaOS does not have a proc filesystem anyway.
17916echo " "
17917val="$undef"
17918if $test "X$d_procselfexe" = Xundef; then
17919	procselfexe=''
17920elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17921	val="$define"
17922elif $test "X$d_readlink" = Xdefine; then
17923        : NetBSD first as /proc/self is a symlink to /proc/curproc,
17924        : and it feels more tidy to avoid an extra level of symlink
17925	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17926	while test $# -gt 0; do
17927	    type=$1; try=$2
17928	    shift; shift
17929	    if $issymlink $try; then
17930		$ls -l $try > reflect
17931		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17932		    echo "You have $type-like $try."
17933		    procselfexe='"'$try'"'
17934		    val="$define"
17935		    : This will break out of the loop
17936		    set X; shift
17937		fi
17938	    fi
17939	done
17940fi
17941$rm -f reflect
17942set d_procselfexe
17943eval $setvar
17944
17945: backward compatibility for d_hvfork
17946if test X$d_hvfork != X; then
17947	d_vfork="$d_hvfork"
17948	d_hvfork=''
17949fi
17950: see if there is a vfork
17951val=''
17952set vfork val
17953eval $inlibc
17954
17955d_pseudofork=$undef
17956
17957: Ok, but do we want to use it. vfork is reportedly unreliable in
17958: perl on Solaris 2.x, and probably elsewhere.
17959case "$val" in
17960$define)
17961	echo " "
17962	case "$usevfork" in
17963	false) dflt='n';;
17964	*) dflt='y';;
17965	esac
17966	cat <<'EOM'
17967
17968Perl can only use a vfork() that doesn't suffer from strict
17969restrictions on calling functions or modifying global data in
17970the child.  For example, glibc-2.1 contains such a vfork()
17971that is unsuitable.  If your system provides a proper fork()
17972call, chances are that you do NOT want perl to use vfork().
17973
17974EOM
17975	rp="Do you still want to use vfork()?"
17976	. ./myread
17977	case "$ans" in
17978	y|Y) ;;
17979	*)
17980		echo "Ok, we won't use vfork()."
17981		val="$undef"
17982		;;
17983	esac
17984	;;
17985esac
17986set d_vfork
17987eval $setvar
17988case "$d_vfork" in
17989$define) usevfork='true';;
17990*) usevfork='false';;
17991esac
17992
17993: see whether the pthread_atfork exists
17994$cat >try.c <<EOP
17995#include <pthread.h>
17996#include <stdio.h>
17997int main() {
17998#ifdef  PTHREAD_ATFORK
17999        pthread_atfork(NULL,NULL,NULL);
18000#endif
18001}
18002EOP
18003
18004: see if pthread_atfork exists
18005set try -DPTHREAD_ATFORK
18006if eval $compile; then
18007    val="$define"
18008else
18009    val="$undef"
18010fi
18011case "$usethreads" in
18012$define)
18013        case "$val" in
18014        $define) echo 'pthread_atfork found.' >&4        ;;
18015        *)       echo 'pthread_atfork NOT found.' >&4    ;;
18016        esac
18017esac
18018set d_pthread_atfork
18019eval $setvar
18020
18021: see if pthread_attr_setscope exists
18022set pthread_attr_setscope d_pthread_attr_setscope
18023eval $inlibc
18024
18025: see whether the various POSIXish _yields exist
18026$cat >try.c <<EOP
18027#include <pthread.h>
18028#include <stdio.h>
18029int main() {
18030#ifdef SCHED_YIELD
18031	sched_yield();
18032#else
18033#ifdef PTHREAD_YIELD
18034	pthread_yield();
18035#else
18036#ifdef PTHREAD_YIELD_NULL
18037	pthread_yield(NULL);
18038#endif
18039#endif
18040#endif
18041}
18042EOP
18043: see if sched_yield exists
18044set try -DSCHED_YIELD
18045if eval $compile; then
18046    val="$define"
18047    sched_yield='sched_yield()'
18048else
18049    val="$undef"
18050fi
18051case "$usethreads" in
18052$define)
18053	case "$val" in
18054	$define) echo 'sched_yield() found.' >&4	;;
18055	*)	 echo 'sched_yield() NOT found.' >&4	;;
18056	esac
18057esac
18058set d_sched_yield
18059eval $setvar
18060
18061: see if pthread_yield exists
18062set try -DPTHREAD_YIELD
18063if eval $compile; then
18064    val="$define"
18065    case "$sched_yield" in
18066    '') sched_yield='pthread_yield()' ;;
18067    esac
18068else
18069    set try -DPTHREAD_YIELD_NULL
18070    if eval $compile; then
18071	val="$define"
18072	case "$sched_yield" in
18073	'') sched_yield='pthread_yield(NULL)' ;;
18074	esac
18075    else
18076	val="$undef"
18077    fi
18078fi
18079case "$usethreads" in
18080$define)
18081	case "$val" in
18082	$define) echo 'pthread_yield() found.' >&4	;;
18083	*)	 echo 'pthread_yield() NOT found.' >&4	;;
18084	esac
18085	;;
18086esac
18087set d_pthread_yield
18088eval $setvar
18089case "$sched_yield" in
18090'') sched_yield=undef ;;
18091esac
18092$rm_try
18093
18094: check for ptrdiff_t
18095echo " "
18096echo "Checking to see if you have ptrdiff_t..." >&4
18097$cat >try.c <<EOCP
18098#include <stddef.h>
18099int main() { ptrdiff_t x = 7; }
18100EOCP
18101set try
18102if eval $compile; then
18103	val="$define"
18104	echo "You have ptrdiff_t."
18105else
18106	val="$undef"
18107	echo "You do not have ptrdiff_t."
18108fi
18109$rm_try
18110set d_ptrdiff_t
18111eval $setvar
18112
18113: see if random_r exists
18114set random_r d_random_r
18115eval $inlibc
18116case "$d_random_r" in
18117"$define")
18118	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18119	case "$d_random_r_proto:$usethreads" in
18120	":define")	d_random_r_proto=define
18121		set d_random_r_proto random_r $hdrs
18122		eval $hasproto ;;
18123	*)	;;
18124	esac
18125	case "$d_random_r_proto" in
18126	define)
18127	case "$random_r_proto" in
18128	''|0) try='int random_r(int*, struct random_data*);'
18129	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
18130	esac
18131	case "$random_r_proto" in
18132	''|0) try='int random_r(long*, struct random_data*);'
18133	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
18134	esac
18135	case "$random_r_proto" in
18136	''|0) try='int random_r(struct random_data*, int32_t*);'
18137	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
18138	esac
18139	case "$random_r_proto" in
18140	''|0)	d_random_r=undef
18141		random_r_proto=0
18142		echo "Disabling random_r, cannot determine prototype." >&4 ;;
18143	* )	case "$random_r_proto" in
18144		REENTRANT_PROTO*) ;;
18145		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
18146		esac
18147		echo "Prototype: $try" ;;
18148	esac
18149	;;
18150	*)	case "$usethreads" in
18151		define) echo "random_r has no prototype, not using it." >&4 ;;
18152		esac
18153		d_random_r=undef
18154		random_r_proto=0
18155		;;
18156	esac
18157	;;
18158*)	random_r_proto=0
18159	;;
18160esac
18161
18162: see if readdir and friends exist
18163set readdir d_readdir
18164eval $inlibc
18165set seekdir d_seekdir
18166eval $inlibc
18167set telldir d_telldir
18168eval $inlibc
18169set rewinddir d_rewinddir
18170eval $inlibc
18171
18172: see if readdir64_r exists
18173set readdir64_r d_readdir64_r
18174eval $inlibc
18175case "$d_readdir64_r" in
18176"$define")
18177	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18178	case "$d_readdir64_r_proto:$usethreads" in
18179	":define")	d_readdir64_r_proto=define
18180		set d_readdir64_r_proto readdir64_r $hdrs
18181		eval $hasproto ;;
18182	*)	;;
18183	esac
18184	case "$d_readdir64_r_proto" in
18185	define)
18186	case "$readdir64_r_proto" in
18187	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
18188	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
18189	esac
18190	case "$readdir64_r_proto" in
18191	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
18192	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
18193	esac
18194	case "$readdir64_r_proto" in
18195	''|0)	d_readdir64_r=undef
18196		readdir64_r_proto=0
18197		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
18198	* )	case "$readdir64_r_proto" in
18199		REENTRANT_PROTO*) ;;
18200		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
18201		esac
18202		echo "Prototype: $try" ;;
18203	esac
18204	;;
18205	*)	case "$usethreads" in
18206		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
18207		esac
18208		d_readdir64_r=undef
18209		readdir64_r_proto=0
18210		;;
18211	esac
18212	;;
18213*)	readdir64_r_proto=0
18214	;;
18215esac
18216
18217: see if readdir_r exists
18218set readdir_r d_readdir_r
18219eval $inlibc
18220case "$d_readdir_r" in
18221"$define")
18222	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18223	case "$d_readdir_r_proto:$usethreads" in
18224	":define")	d_readdir_r_proto=define
18225		set d_readdir_r_proto readdir_r $hdrs
18226		eval $hasproto ;;
18227	*)	;;
18228	esac
18229	case "$d_readdir_r_proto" in
18230	define)
18231	case "$readdir_r_proto" in
18232	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
18233	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
18234	esac
18235	case "$readdir_r_proto" in
18236	''|0) try='int readdir_r(DIR*, struct dirent*);'
18237	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
18238	esac
18239	case "$readdir_r_proto" in
18240	''|0)	d_readdir_r=undef
18241		readdir_r_proto=0
18242		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
18243	* )	case "$readdir_r_proto" in
18244		REENTRANT_PROTO*) ;;
18245		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
18246		esac
18247		echo "Prototype: $try" ;;
18248	esac
18249	;;
18250	*)	case "$usethreads" in
18251		define) echo "readdir_r has no prototype, not using it." >&4 ;;
18252		esac
18253		d_readdir_r=undef
18254		readdir_r_proto=0
18255		;;
18256	esac
18257	;;
18258*)	readdir_r_proto=0
18259	;;
18260esac
18261
18262: see if readv exists
18263set readv d_readv
18264eval $inlibc
18265
18266: see if recvmsg exists
18267set recvmsg d_recvmsg
18268eval $inlibc
18269
18270: see if regcomp, regcmp, or re_comp exist, for regular pattern matching
18271echo " "
18272if set regcomp val -f d_regcomp; eval $csym; $val; then
18273	echo 'regcomp() found.' >&4
18274	d_regcomp="$define"
18275	d_regcmp="$undef"
18276	d_re_comp="$undef"
18277elif set regcmp val -f d_regcmp; eval $csym; $val; then
18278	echo 'regcmp() found.' >&4
18279	d_regcmp="$define"
18280	d_regcomp="$undef"
18281	d_re_comp="$undef"
18282elif set re_comp val -f d_re_comp; eval $csym; $val; then
18283	echo 're_comp() found, assuming re_exec() also exists.' >&4
18284	d_re_comp="$define"
18285	d_regcomp="$undef"
18286	d_regcmp="$undef"
18287else
18288	$cat >&4 <<EOM
18289No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
18290EOM
18291	d_regcmp="$undef"
18292	d_re_comp="$undef"
18293	d_regcomp="$undef"
18294fi
18295
18296: see if remainder exists
18297set remainder d_remainder
18298eval $inlibc
18299
18300: see if remquo exists
18301set remquo d_remquo
18302eval $inlibc
18303
18304: see if rename exists
18305set rename d_rename
18306eval $inlibc
18307
18308: see if rint exists
18309set rint d_rint
18310eval $inlibc
18311
18312: see if rmdir exists
18313set rmdir d_rmdir
18314eval $inlibc
18315
18316: see if round exists
18317set round d_round
18318eval $inlibc
18319
18320: see if prototype for sbrk is available
18321echo " "
18322set d_sbrkproto sbrk $i_unistd unistd.h
18323eval $hasproto
18324
18325: see if scalbn exists
18326set scalbn d_scalbn
18327eval $inlibc
18328
18329: see if select exists
18330set select d_select
18331eval $inlibc
18332
18333: see if semctl exists
18334set semctl d_semctl
18335eval $inlibc
18336
18337: see if semget exists
18338set semget d_semget
18339eval $inlibc
18340
18341: see if semop exists
18342set semop d_semop
18343eval $inlibc
18344
18345: see how much of the 'sem*(2)' library is present.
18346h_sem=true
18347echo " "
18348case "$d_semctl$d_semget$d_semop" in
18349*"$undef"*) h_sem=false;;
18350esac
18351case "$osname" in
18352freebsd)
18353    case "`ipcs 2>&1`" in
18354    "SVID messages"*"not configured"*)
18355	echo "Your $osname does not have the sem*(2) configured." >&4
18356        h_sem=false
18357	val="$undef"
18358	set semctl d_semctl
18359	eval $setvar
18360	set semget d_semget
18361	eval $setvar
18362	set semop d_semop
18363	eval $setvar
18364	;;
18365    esac
18366    ;;
18367esac
18368: we could also check for sys/ipc.h ...
18369if $h_sem && $test `./findhdr sys/sem.h`; then
18370	echo "You have the full sem*(2) library." >&4
18371	val="$define"
18372else
18373	echo "You don't have the full sem*(2) library." >&4
18374	val="$undef"
18375fi
18376set d_sem
18377eval $setvar
18378
18379: see whether sys/sem.h defines union semun
18380echo " "
18381$cat > try.c <<'END'
18382#include <sys/types.h>
18383#include <sys/ipc.h>
18384#include <sys/sem.h>
18385int main () { union semun semun; semun.buf = 0; }
18386END
18387set try
18388if eval $compile; then
18389    echo "You have union semun in <sys/sem.h>." >&4
18390    val="$define"
18391else
18392    echo "You do not have union semun in <sys/sem.h>." >&4
18393    val="$undef"
18394fi
18395$rm_try
18396set d_union_semun
18397eval $setvar
18398
18399: see how to do semctl IPC_STAT
18400case "$d_sem" in
18401$define)
18402    echo " "
18403    $cat > tryh.h <<END
18404#ifndef S_IRUSR
18405#   ifdef S_IREAD
18406#	define S_IRUSR S_IREAD
18407#	define S_IWUSR S_IWRITE
18408#	define S_IXUSR S_IEXEC
18409#   else
18410#	define S_IRUSR 0400
18411#	define S_IWUSR 0200
18412#	define S_IXUSR 0100
18413#   endif
18414#   define S_IRGRP (S_IRUSR>>3)
18415#   define S_IWGRP (S_IWUSR>>3)
18416#   define S_IXGRP (S_IXUSR>>3)
18417#   define S_IROTH (S_IRUSR>>6)
18418#   define S_IWOTH (S_IWUSR>>6)
18419#   define S_IXOTH (S_IXUSR>>6)
18420#endif
18421#ifndef S_IRWXU
18422#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18423#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18424#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18425#endif
18426END
18427    : see whether semctl IPC_STAT can use union semun
18428    case "$d_semctl_semun" in
18429    '')
18430      val="$undef"
18431      $cat > try.c <<END
18432#include <sys/types.h>
18433#include <sys/ipc.h>
18434#include <sys/sem.h>
18435#include <sys/stat.h>
18436#include <stdio.h>
18437#include <errno.h>
18438#include "tryh.h"
18439#ifndef errno
18440extern int errno;
18441#endif
18442#$d_union_semun HAS_UNION_SEMUN
18443int main() {
18444    union semun
18445#ifndef HAS_UNION_SEMUN
18446    {
18447	int val;
18448	struct semid_ds *buf;
18449	unsigned short *array;
18450    }
18451#endif
18452    arg;
18453    int sem, st;
18454
18455#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18456    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18457    if (sem > -1) {
18458	struct semid_ds argbuf;
18459	arg.buf = &argbuf;
18460#	ifdef IPC_STAT
18461	st = semctl(sem, 0, IPC_STAT, arg);
18462	if (st == 0)
18463	    printf("semun\n");
18464	else
18465#	endif /* IPC_STAT */
18466	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
18467#	ifdef IPC_RMID
18468	if (semctl(sem, 0, IPC_RMID, arg) != 0)
18469#	endif /* IPC_RMID */
18470	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
18471    } else
18472#endif /* IPC_PRIVATE && ... */
18473	printf("semget failed: errno = %d\n", errno);
18474  return 0;
18475}
18476END
18477      set try
18478      if eval $compile; then
18479	  xxx=`$run ./try`
18480          case "$xxx" in
18481          semun) val="$define" ;;
18482          esac
18483      fi
18484      $rm_try
18485      set d_semctl_semun
18486      eval $setvar
18487      ;;
18488    esac
18489    case "$d_semctl_semun" in
18490    $define)
18491        echo "You can use union semun for semctl IPC_STAT." >&4
18492	also='also'
18493        ;;
18494    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18495	also=''
18496        ;;
18497    esac
18498
18499    : see whether semctl IPC_STAT can use struct semid_ds pointer
18500    case "$d_semctl_semid_ds" in
18501    '')
18502      val="$undef"
18503      $cat > try.c <<'END'
18504#include <sys/types.h>
18505#include <sys/ipc.h>
18506#include <sys/sem.h>
18507#include <sys/stat.h>
18508#include "tryh.h"
18509#include <stdio.h>
18510#include <errno.h>
18511#ifndef errno
18512extern int errno;
18513#endif
18514int main() {
18515    union semun
18516#ifndef HAS_UNION_SEMUN
18517    {
18518	int val;
18519	struct semid_ds *buf;
18520	unsigned short *array;
18521    }
18522#endif
18523    arg;
18524    struct semid_ds argbuf;
18525    int sem, st;
18526
18527#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18528    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18529    if (sem > -1) {
18530	arg.buf = &argbuf;
18531#	ifdef IPC_STAT
18532	st = semctl(sem, 0, IPC_STAT, arg);
18533	if (st == 0)
18534	    printf("semid_ds\n");
18535	else
18536#	endif /* IPC_STAT */
18537	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
18538#	ifdef IPC_RMID
18539	if (semctl(sem, 0, IPC_RMID, arg) != 0)
18540#	endif /* IPC_RMID */
18541	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
18542    } else
18543#endif /* IPC_PRIVATE && ... */
18544	printf("semget failed: errno = %d\n", errno);
18545
18546    return 0;
18547}
18548END
18549      set try
18550      if eval $compile; then
18551          xxx=`$run ./try`
18552          case "$xxx" in
18553          semid_ds) val="$define" ;;
18554          esac
18555      fi
18556      $rm_try
18557      set d_semctl_semid_ds
18558      eval $setvar
18559      ;;
18560    esac
18561    case "$d_semctl_semid_ds" in
18562    $define)
18563        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18564        ;;
18565    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18566        ;;
18567    esac
18568    ;;
18569*)  val="$undef"
18570
18571    # We do not have the full sem*(2) library, so assume we can not
18572    # use either.
18573
18574    set d_semctl_semun
18575    eval $setvar
18576
18577    set d_semctl_semid_ds
18578    eval $setvar
18579    ;;
18580esac
18581$rm_try tryh.h
18582
18583: see if sendmsg exists
18584set sendmsg d_sendmsg
18585eval $inlibc
18586
18587: see if setegid exists
18588set setegid d_setegid
18589eval $inlibc
18590
18591: see if setenv exists
18592set setenv d_setenv
18593eval $inlibc
18594
18595: see if seteuid exists
18596set seteuid d_seteuid
18597eval $inlibc
18598
18599: see if setgrent exists
18600set setgrent d_setgrent
18601eval $inlibc
18602
18603: see if setgrent_r exists
18604set setgrent_r d_setgrent_r
18605eval $inlibc
18606case "$d_setgrent_r" in
18607"$define")
18608	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18609	case "$d_setgrent_r_proto:$usethreads" in
18610	":define")	d_setgrent_r_proto=define
18611		set d_setgrent_r_proto setgrent_r $hdrs
18612		eval $hasproto ;;
18613	*)	;;
18614	esac
18615	case "$d_setgrent_r_proto" in
18616	define)
18617	case "$setgrent_r_proto" in
18618	''|0) try='int setgrent_r(FILE**);'
18619	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18620	esac
18621	case "$setgrent_r_proto" in
18622	''|0) try='void setgrent_r(FILE**);'
18623	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18624	esac
18625	case "$setgrent_r_proto" in
18626	''|0)	d_setgrent_r=undef
18627		setgrent_r_proto=0
18628		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18629	* )	case "$setgrent_r_proto" in
18630		REENTRANT_PROTO*) ;;
18631		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18632		esac
18633		echo "Prototype: $try" ;;
18634	esac
18635	;;
18636	*)	case "$usethreads" in
18637		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18638		esac
18639		d_setgrent_r=undef
18640		setgrent_r_proto=0
18641		;;
18642	esac
18643	;;
18644*)	setgrent_r_proto=0
18645	;;
18646esac
18647
18648: see if sethostent exists
18649set sethostent d_sethent
18650eval $inlibc
18651
18652: see if sethostent_r exists
18653set sethostent_r d_sethostent_r
18654eval $inlibc
18655case "$d_sethostent_r" in
18656"$define")
18657	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18658	case "$d_sethostent_r_proto:$usethreads" in
18659	":define")	d_sethostent_r_proto=define
18660		set d_sethostent_r_proto sethostent_r $hdrs
18661		eval $hasproto ;;
18662	*)	;;
18663	esac
18664	case "$d_sethostent_r_proto" in
18665	define)
18666	case "$sethostent_r_proto" in
18667	''|0) try='int sethostent_r(int, struct hostent_data*);'
18668	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18669	esac
18670	case "$sethostent_r_proto" in
18671	''|0) try='void sethostent_r(int, struct hostent_data*);'
18672	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18673	esac
18674	case "$sethostent_r_proto" in
18675	''|0)	d_sethostent_r=undef
18676		sethostent_r_proto=0
18677		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18678	* )	case "$sethostent_r_proto" in
18679		REENTRANT_PROTO*) ;;
18680		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18681		esac
18682		echo "Prototype: $try" ;;
18683	esac
18684	;;
18685	*)	case "$usethreads" in
18686		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18687		esac
18688		d_sethostent_r=undef
18689		sethostent_r_proto=0
18690		;;
18691	esac
18692	;;
18693*)	sethostent_r_proto=0
18694	;;
18695esac
18696
18697: see if setitimer exists
18698set setitimer d_setitimer
18699eval $inlibc
18700
18701: see if setlinebuf exists
18702set setlinebuf d_setlinebuf
18703eval $inlibc
18704
18705: see if setlocale_r exists
18706set setlocale_r d_setlocale_r
18707eval $inlibc
18708case "$d_setlocale_r" in
18709"$define")
18710	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18711	case "$d_setlocale_r_proto:$usethreads" in
18712	":define")	d_setlocale_r_proto=define
18713		set d_setlocale_r_proto setlocale_r $hdrs
18714		eval $hasproto ;;
18715	*)	;;
18716	esac
18717	case "$d_setlocale_r_proto" in
18718	define)
18719	case "$setlocale_r_proto" in
18720	''|0) try='int setlocale_r(int, const char*, char*, int);'
18721	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18722	esac
18723	case "$setlocale_r_proto" in
18724	''|0)	d_setlocale_r=undef
18725		setlocale_r_proto=0
18726		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18727	* )	case "$setlocale_r_proto" in
18728		REENTRANT_PROTO*) ;;
18729		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18730		esac
18731		echo "Prototype: $try" ;;
18732	esac
18733	;;
18734	*)	case "$usethreads" in
18735		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18736		esac
18737		d_setlocale_r=undef
18738		setlocale_r_proto=0
18739		;;
18740	esac
18741	;;
18742*)	setlocale_r_proto=0
18743	;;
18744esac
18745
18746: see if setnetent exists
18747set setnetent d_setnent
18748eval $inlibc
18749
18750: see if setnetent_r exists
18751set setnetent_r d_setnetent_r
18752eval $inlibc
18753case "$d_setnetent_r" in
18754"$define")
18755	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18756	case "$d_setnetent_r_proto:$usethreads" in
18757	":define")	d_setnetent_r_proto=define
18758		set d_setnetent_r_proto setnetent_r $hdrs
18759		eval $hasproto ;;
18760	*)	;;
18761	esac
18762	case "$d_setnetent_r_proto" in
18763	define)
18764	case "$setnetent_r_proto" in
18765	''|0) try='int setnetent_r(int, struct netent_data*);'
18766	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18767	esac
18768	case "$setnetent_r_proto" in
18769	''|0) try='void setnetent_r(int, struct netent_data*);'
18770	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18771	esac
18772	case "$setnetent_r_proto" in
18773	''|0)	d_setnetent_r=undef
18774		setnetent_r_proto=0
18775		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18776	* )	case "$setnetent_r_proto" in
18777		REENTRANT_PROTO*) ;;
18778		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18779		esac
18780		echo "Prototype: $try" ;;
18781	esac
18782	;;
18783	*)	case "$usethreads" in
18784		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18785		esac
18786		d_setnetent_r=undef
18787		setnetent_r_proto=0
18788		;;
18789	esac
18790	;;
18791*)	setnetent_r_proto=0
18792	;;
18793esac
18794
18795: see if setprotoent exists
18796set setprotoent d_setpent
18797eval $inlibc
18798
18799: see if setpgid exists
18800set setpgid d_setpgid
18801eval $inlibc
18802
18803: see if setpgrp2 exists
18804set setpgrp2 d_setpgrp2
18805eval $inlibc
18806
18807: see if setpriority exists
18808set setpriority d_setprior
18809eval $inlibc
18810
18811: see if setproctitle exists
18812set setproctitle d_setproctitle
18813eval $inlibc
18814
18815: see if setprotoent_r exists
18816set setprotoent_r d_setprotoent_r
18817eval $inlibc
18818case "$d_setprotoent_r" in
18819"$define")
18820	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18821	case "$d_setprotoent_r_proto:$usethreads" in
18822	":define")	d_setprotoent_r_proto=define
18823		set d_setprotoent_r_proto setprotoent_r $hdrs
18824		eval $hasproto ;;
18825	*)	;;
18826	esac
18827	case "$d_setprotoent_r_proto" in
18828	define)
18829	case "$setprotoent_r_proto" in
18830	''|0) try='int setprotoent_r(int, struct protoent_data*);'
18831	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18832	esac
18833	case "$setprotoent_r_proto" in
18834	''|0) try='void setprotoent_r(int, struct protoent_data*);'
18835	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18836	esac
18837	case "$setprotoent_r_proto" in
18838	''|0)	d_setprotoent_r=undef
18839		setprotoent_r_proto=0
18840		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18841	* )	case "$setprotoent_r_proto" in
18842		REENTRANT_PROTO*) ;;
18843		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18844		esac
18845		echo "Prototype: $try" ;;
18846	esac
18847	;;
18848	*)	case "$usethreads" in
18849		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18850		esac
18851		d_setprotoent_r=undef
18852		setprotoent_r_proto=0
18853		;;
18854	esac
18855	;;
18856*)	setprotoent_r_proto=0
18857	;;
18858esac
18859
18860: see if setpwent exists
18861set setpwent d_setpwent
18862eval $inlibc
18863
18864: see if setpwent_r exists
18865set setpwent_r d_setpwent_r
18866eval $inlibc
18867case "$d_setpwent_r" in
18868"$define")
18869	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18870	case "$d_setpwent_r_proto:$usethreads" in
18871	":define")	d_setpwent_r_proto=define
18872		set d_setpwent_r_proto setpwent_r $hdrs
18873		eval $hasproto ;;
18874	*)	;;
18875	esac
18876	case "$d_setpwent_r_proto" in
18877	define)
18878	case "$setpwent_r_proto" in
18879	''|0) try='int setpwent_r(FILE**);'
18880	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18881	esac
18882	case "$setpwent_r_proto" in
18883	''|0) try='void setpwent_r(FILE**);'
18884	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18885	esac
18886	case "$setpwent_r_proto" in
18887	''|0)	d_setpwent_r=undef
18888		setpwent_r_proto=0
18889		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18890	* )	case "$setpwent_r_proto" in
18891		REENTRANT_PROTO*) ;;
18892		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18893		esac
18894		echo "Prototype: $try" ;;
18895	esac
18896	;;
18897	*)	case "$usethreads" in
18898		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18899		esac
18900		d_setpwent_r=undef
18901		setpwent_r_proto=0
18902		;;
18903	esac
18904	;;
18905*)	setpwent_r_proto=0
18906	;;
18907esac
18908
18909: see if setregid exists
18910set setregid d_setregid
18911eval $inlibc
18912set setresgid d_setresgid
18913eval $inlibc
18914
18915: see if setreuid exists
18916set setreuid d_setreuid
18917eval $inlibc
18918set setresuid d_setresuid
18919eval $inlibc
18920
18921: see if setrgid exists
18922set setrgid d_setrgid
18923eval $inlibc
18924
18925: see if setruid exists
18926set setruid d_setruid
18927eval $inlibc
18928
18929: see if setservent exists
18930set setservent d_setsent
18931eval $inlibc
18932
18933: see if setservent_r exists
18934set setservent_r d_setservent_r
18935eval $inlibc
18936case "$d_setservent_r" in
18937"$define")
18938	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18939	case "$d_setservent_r_proto:$usethreads" in
18940	":define")	d_setservent_r_proto=define
18941		set d_setservent_r_proto setservent_r $hdrs
18942		eval $hasproto ;;
18943	*)	;;
18944	esac
18945	case "$d_setservent_r_proto" in
18946	define)
18947	case "$setservent_r_proto" in
18948	''|0) try='int setservent_r(int, struct servent_data*);'
18949	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18950	esac
18951	case "$setservent_r_proto" in
18952	''|0) try='void setservent_r(int, struct servent_data*);'
18953	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18954	esac
18955	case "$setservent_r_proto" in
18956	''|0)	d_setservent_r=undef
18957		setservent_r_proto=0
18958		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18959	* )	case "$setservent_r_proto" in
18960		REENTRANT_PROTO*) ;;
18961		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18962		esac
18963		echo "Prototype: $try" ;;
18964	esac
18965	;;
18966	*)	case "$usethreads" in
18967		define) echo "setservent_r has no prototype, not using it." >&4 ;;
18968		esac
18969		d_setservent_r=undef
18970		setservent_r_proto=0
18971		;;
18972	esac
18973	;;
18974*)	setservent_r_proto=0
18975	;;
18976esac
18977
18978: see if setsid exists
18979set setsid d_setsid
18980eval $inlibc
18981
18982: see if setvbuf exists
18983set setvbuf d_setvbuf
18984eval $inlibc
18985
18986: see if shmctl exists
18987set shmctl d_shmctl
18988eval $inlibc
18989
18990: see if shmget exists
18991set shmget d_shmget
18992eval $inlibc
18993
18994: see if shmat exists
18995set shmat d_shmat
18996eval $inlibc
18997: see what shmat returns
18998case "$d_shmat" in
18999"$define")
19000	$cat >shmat.c <<'END'
19001#include <sys/shm.h>
19002void *shmat();
19003END
19004	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
19005		shmattype='void *'
19006	else
19007		shmattype='char *'
19008	fi
19009	echo "and it returns ($shmattype)." >&4
19010	: see if a prototype for shmat is available
19011	xxx=`./findhdr sys/shm.h`
19012	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
19013	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
19014		val="$define"
19015	else
19016		val="$undef"
19017	fi
19018	$rm -f shmat.[co]
19019	;;
19020*)
19021	val="$undef"
19022	;;
19023esac
19024set d_shmatprototype
19025eval $setvar
19026
19027: see if shmdt exists
19028set shmdt d_shmdt
19029eval $inlibc
19030
19031: see how much of the 'shm*(2)' library is present.
19032h_shm=true
19033echo " "
19034case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
19035*"$undef"*) h_shm=false;;
19036esac
19037case "$osname" in
19038freebsd)
19039    case "`ipcs 2>&1`" in
19040    "SVID shared memory"*"not configured"*)
19041	echo "Your $osname does not have the shm*(2) configured." >&4
19042        h_shm=false
19043	val="$undef"
19044	set shmctl d_shmctl
19045	eval $setvar
19046	set shmget d_shmget
19047	eval $setvar
19048	set shmat d_shmat
19049	eval $setvar
19050	set shmdt d_shmdt
19051	eval $setvar
19052	;;
19053    esac
19054    ;;
19055esac
19056: we could also check for sys/ipc.h ...
19057if $h_shm && $test `./findhdr sys/shm.h`; then
19058	echo "You have the full shm*(2) library." >&4
19059	val="$define"
19060else
19061	echo "You don't have the full shm*(2) library." >&4
19062	val="$undef"
19063fi
19064set d_shm
19065eval $setvar
19066
19067: see if we have sigaction
19068echo " "
19069if set sigaction val -f d_sigaction; eval $csym; $val; then
19070	echo 'sigaction() found.' >&4
19071	$cat > try.c <<EOP
19072#include <stdio.h>
19073#include <sys/types.h>
19074#include <signal.h>
19075#$i_stdlib I_STDLIB
19076#ifdef I_STDLIB
19077#include <stdlib.h>
19078#endif
19079int main()
19080{
19081    struct sigaction act, oact;
19082    act.sa_flags = 0;
19083    oact.sa_handler = 0;
19084    /* so that act and oact are used */
19085    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
19086}
19087EOP
19088	set try
19089	if eval $compile_ok; then
19090		val="$define"
19091	else
19092		echo "But you don't seem to have a usable struct sigaction." >&4
19093		val="$undef"
19094	fi
19095else
19096	echo 'sigaction NOT found.' >&4
19097	val="$undef"
19098fi
19099set d_sigaction; eval $setvar
19100$rm_try
19101
19102: see what type pids are declared as in the kernel
19103rp="What is the type of process ids on this system?"
19104set pid_t pidtype int stdio.h sys/types.h
19105eval $typedef_ask
19106
19107: see what type uids are declared as in the kernel
19108echo " "
19109echo "Looking for the type for user ids returned by getuid()."
19110set uid_t uidtype xxx stdio.h sys/types.h
19111eval $typedef
19112case "$uidtype" in
19113xxx)
19114	xxx=`./findhdr sys/user.h`
19115	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19116	case $1 in
19117	unsigned) dflt="$1 $2" ;;
19118	*) dflt="$1" ;;
19119	esac
19120	;;
19121*) dflt="$uidtype";;
19122esac
19123case "$uidtype" in
19124uid_t)	echo "uid_t found." ;;
19125*)	rp="What is the type for user ids returned by getuid()?"
19126	. ./myread
19127	uidtype="$ans"
19128	;;
19129esac
19130
19131: Define hasfield_t macro for Configure internal use
19132hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
19133while $test $# -ge 2; do
19134    case "$1" in
19135	$define) echo "#include <$2>";;
19136    esac ;
19137    shift 2;
19138done > try.c;
19139echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
19140set try;
19141if eval $compile; then
19142	val="$define";
19143else
19144	val="$undef";
19145fi;
19146set $varname;
19147eval $setvar;
19148$rm_try'
19149
19150: see what siginfo fields we have
19151case "$d_sigaction" in
19152"$define")
19153	echo "Checking if your siginfo_t has si_errno field...">&4
19154	set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
19155	eval $hasfield_t;
19156
19157	echo "Checking if your siginfo_t has si_pid field...">&4
19158	set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
19159	eval $hasfield_t;
19160
19161	echo "Checking if your siginfo_t has si_uid field...">&4
19162	set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
19163	eval $hasfield_t;
19164
19165	echo "Checking if your siginfo_t has si_addr field...">&4
19166	set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
19167	eval $hasfield_t;
19168
19169	echo "Checking if your siginfo_t has si_status field...">&4
19170	set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
19171	eval $hasfield_t;
19172
19173	echo "Checking if your siginfo_t has si_band field...">&4
19174	set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
19175	eval $hasfield_t;
19176
19177	echo "Checking if your siginfo_t has si_value field...">&4
19178	set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
19179	eval $hasfield_t;
19180
19181	echo "Checking if your siginfo_t has si_fd field...">&4
19182	set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
19183	eval $hasfield_t;
19184
19185	;;
19186*)
19187	d_siginfo_si_errno="$undef"
19188	d_siginfo_si_pid="$undef"
19189	d_siginfo_si_uid="$undef"
19190	d_siginfo_si_addr="$undef"
19191	d_siginfo_si_status="$undef"
19192	d_siginfo_si_band="$undef"
19193	d_siginfo_si_value="$undef"
19194	d_siginfo_si_fd="$undef"
19195	;;
19196esac
19197
19198: see if this is a sunmath.h system
19199set sunmath.h i_sunmath
19200eval $inhdr
19201
19202: see if signbit exists
19203$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
19204$cat >try.c <<EOCP
19205#$i_sunmath I_SUNMATH
19206#include <math.h>
19207#ifdef I_SUNMATH  /* Solaris special math library */
19208#  include <sunmath.h>
19209#endif
19210#define NV $nvtype
19211int main(int argc, char **argv)
19212{
19213    NV x = 0.0;
19214    NV y = -1.0;
19215    if ((signbit(x) == 0) && (signbit(y) != 0))
19216	return 0;
19217    else
19218	return 1;
19219}
19220EOCP
19221val="$undef"
19222set try
19223if eval $compile; then
19224    if $run ./try; then
19225        $echo "Yes." >&4
19226	val="$define"
19227    else
19228        $echo "Signbit seems to be available, but doesn't work as I expected."
19229        $echo "I won't use it." >&4
19230	val="$undef"
19231    fi
19232else
19233    $echo "Nope." >&4
19234    dflt="$undef"
19235fi
19236set d_signbit
19237eval $setvar
19238$rm_try
19239
19240: see if sigprocmask exists
19241set sigprocmask d_sigprocmask
19242eval $inlibc
19243
19244: see if sigsetjmp exists
19245echo " "
19246case "$d_sigsetjmp" in
19247'')
19248	$cat >try.c <<EOP
19249#include <setjmp.h>
19250#$i_stdlib I_STDLIB
19251#ifdef I_STDLIB
19252#include <stdlib.h>
19253#endif
19254sigjmp_buf env;
19255int set = 1;
19256int main()
19257{
19258	if (sigsetjmp(env,1))
19259		exit(set);
19260	set = 0;
19261	siglongjmp(env, 1);
19262	exit(1);
19263}
19264EOP
19265	set try
19266	if eval $compile; then
19267		if $run ./try >/dev/null 2>&1; then
19268			echo "POSIX sigsetjmp found." >&4
19269			val="$define"
19270		else
19271			$cat >&4 <<EOM
19272Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
19273I'll ignore them.
19274EOM
19275			val="$undef"
19276		fi
19277	else
19278		echo "sigsetjmp not found." >&4
19279		val="$undef"
19280	fi
19281	;;
19282*) val="$d_sigsetjmp"
19283	case "$d_sigsetjmp" in
19284	$define) echo "POSIX sigsetjmp found." >&4;;
19285	$undef) echo "sigsetjmp not found." >&4;;
19286	esac
19287	;;
19288esac
19289set d_sigsetjmp
19290eval $setvar
19291$rm_try
19292
19293: see if snprintf exists
19294set snprintf d_snprintf
19295eval $inlibc
19296
19297: see if vsnprintf exists
19298set vsnprintf d_vsnprintf
19299eval $inlibc
19300
19301case "$d_snprintf-$d_vsnprintf" in
19302"$define-$define")
19303    $cat <<EOM
19304Checking whether your snprintf() and vsnprintf() work okay...
19305EOM
19306    $cat >try.c <<'EOCP'
19307/* v?snprintf testing logic courtesy of Russ Allbery.
19308 * According to C99:
19309 * - if the buffer is too short it still must be \0-terminated
19310 * - if the buffer is too short the potentially required length
19311 *   must be returned and not -1
19312 * - if the buffer is NULL the potentially required length
19313 *   must be returned and not -1 or core dump
19314 */
19315#include <stdio.h>
19316#include <stdarg.h>
19317
19318char buf[2];
19319
19320int test (char *format, ...)
19321{
19322    va_list args;
19323    int count;
19324
19325    va_start (args, format);
19326    count = vsnprintf (buf, sizeof buf, format, args);
19327    va_end (args);
19328    return count;
19329}
19330
19331int main ()
19332{
19333    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19334             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19335}
19336EOCP
19337    set try
19338    if eval $compile; then
19339	`$run ./try`
19340	case "$?" in
19341	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19342	*) cat <<EOM >&4
19343Your snprintf() and snprintf() don't seem to be working okay.
19344EOM
19345	   d_snprintf="$undef"
19346	   d_vsnprintf="$undef"
19347	   ;;
19348	esac
19349    else
19350	echo "(I can't seem to compile the test program--assuming they don't)"
19351	d_snprintf="$undef"
19352	d_vsnprintf="$undef"
19353    fi
19354    $rm_try
19355    ;;
19356esac
19357
19358: see if sockatmark exists
19359set sockatmark d_sockatmark
19360eval $inlibc
19361
19362: see if prototype for sockatmark is available
19363echo " "
19364set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19365eval $hasproto
19366
19367: see if socks5_init exists
19368set socks5_init d_socks5_init
19369eval $inlibc
19370
19371: see if srand48_r exists
19372set srand48_r d_srand48_r
19373eval $inlibc
19374case "$d_srand48_r" in
19375"$define")
19376	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19377	case "$d_srand48_r_proto:$usethreads" in
19378	":define")	d_srand48_r_proto=define
19379		set d_srand48_r_proto srand48_r $hdrs
19380		eval $hasproto ;;
19381	*)	;;
19382	esac
19383	case "$d_srand48_r_proto" in
19384	define)
19385	case "$srand48_r_proto" in
19386	''|0) try='int srand48_r(long, struct drand48_data*);'
19387	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19388	esac
19389	case "$srand48_r_proto" in
19390	''|0)	d_srand48_r=undef
19391		srand48_r_proto=0
19392		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19393	* )	case "$srand48_r_proto" in
19394		REENTRANT_PROTO*) ;;
19395		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19396		esac
19397		echo "Prototype: $try" ;;
19398	esac
19399	;;
19400	*)	case "$usethreads" in
19401		define) echo "srand48_r has no prototype, not using it." >&4 ;;
19402		esac
19403		d_srand48_r=undef
19404		srand48_r_proto=0
19405		;;
19406	esac
19407	;;
19408*)	srand48_r_proto=0
19409	;;
19410esac
19411
19412: see if srandom_r exists
19413set srandom_r d_srandom_r
19414eval $inlibc
19415case "$d_srandom_r" in
19416"$define")
19417	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19418	case "$d_srandom_r_proto:$usethreads" in
19419	":define")	d_srandom_r_proto=define
19420		set d_srandom_r_proto srandom_r $hdrs
19421		eval $hasproto ;;
19422	*)	;;
19423	esac
19424	case "$d_srandom_r_proto" in
19425	define)
19426	case "$srandom_r_proto" in
19427	''|0) try='int srandom_r(unsigned int, struct random_data*);'
19428	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19429	esac
19430	case "$srandom_r_proto" in
19431	''|0)	d_srandom_r=undef
19432		srandom_r_proto=0
19433		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19434	* )	case "$srandom_r_proto" in
19435		REENTRANT_PROTO*) ;;
19436		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19437		esac
19438		echo "Prototype: $try" ;;
19439	esac
19440	;;
19441	*)	case "$usethreads" in
19442		define) echo "srandom_r has no prototype, not using it." >&4 ;;
19443		esac
19444		d_srandom_r=undef
19445		srandom_r_proto=0
19446		;;
19447	esac
19448	;;
19449*)	srandom_r_proto=0
19450	;;
19451esac
19452
19453: see if prototype for setresgid is available
19454echo " "
19455set d_sresgproto setresgid $i_unistd unistd.h
19456eval $hasproto
19457
19458: see if prototype for setresuid is available
19459echo " "
19460set d_sresuproto setresuid $i_unistd unistd.h
19461eval $hasproto
19462
19463: see if stat exists
19464set stat d_stat
19465eval $inlibc
19466
19467: see if sys/stat.h is available
19468set sys/stat.h i_sysstat
19469eval $inhdr
19470
19471: see if stat knows about block sizes
19472echo " "
19473echo "Checking to see if your struct stat has st_blocks field..." >&4
19474set d_statblks stat st_blocks $i_sysstat sys/stat.h
19475eval $hasfield
19476
19477: see if this is a sys/vfs.h system
19478set sys/vfs.h i_sysvfs
19479eval $inhdr
19480
19481: see if this is a sys/statfs.h system
19482set sys/statfs.h i_sysstatfs
19483eval $inhdr
19484
19485: Check for statfs_s
19486echo " "
19487echo "Checking to see if your system supports struct statfs..." >&4
19488set 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
19489eval $hasstruct
19490case "$d_statfs_s" in
19491"$define")      echo "Yes, it does."   ;;
19492*)              echo "No, it doesn't." ;;
19493esac
19494
19495: see if struct statfs knows about f_flags
19496case "$d_statfs_s" in
19497define)
19498	echo " "
19499	echo "Checking to see if your struct statfs has f_flags field..." >&4
19500	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
19501	eval $hasfield
19502	;;
19503*)	val="$undef"
19504	set d_statfs_f_flags
19505	eval $setvar
19506	;;
19507esac
19508case "$d_statfs_f_flags" in
19509"$define")      echo "Yes, it does."   ;;
19510*)              echo "No, it doesn't." ;;
19511esac
19512
19513: see what flavor, if any, of static inline is supported
19514echo " "
19515echo "Checking to see if your system supports static inline..."
19516$cat > try.c <<'EOCP'
19517#include <stdlib.h>
19518extern int f_via_a(int x);
19519extern int f_via_b(int x);
19520int main(int argc, char **argv)
19521{
19522    int y;
19523
19524    y = f_via_a(0);
19525#ifdef USE_B
19526    y = f_via_b(0);
19527#endif
19528    if (y == 42) {
19529        return EXIT_SUCCESS;
19530    }
19531    else {
19532        return EXIT_FAILURE;
19533    }
19534}
19535EOCP
19536$cat > a.c <<'EOCP'
19537static INLINE int f(int x) {
19538    int y;
19539    y = x + 42;
19540    return y;
19541}
19542
19543int f_via_a(int x)
19544{
19545    return f(x);
19546}
19547EOCP
19548$cat > b.c <<'EOCP'
19549extern int f(int x);
19550
19551int f_via_b(int x)
19552{
19553    return f(x);
19554}
19555EOCP
19556
19557# Respect a hint (or previous) value for perl_static_inline, if there is one.
19558case "$perl_static_inline" in
19559'')	# Check the various possibilities, and break out on success.
19560	# For gcc, prefer __inline__, which will still permit
19561	# cflags.SH to add in -ansi.
19562	case "$gccversion" in
19563		'') xxx="inline __inline__ __inline _inline";;
19564		*)  xxx="__inline__ inline __inline _inline";;
19565	esac
19566	for inline in $xxx; do
19567		set try -DINLINE=$inline a.c
19568		if eval $compile && $run ./try; then
19569			# Now make sure there is no external linkage of static
19570			# functions
19571			set try -DINLINE=$inline -DUSE_B a.c b.c
19572			if eval $compile && $run ./try; then
19573				$echo "Your compiler supports static $inline, " >&4
19574				$echo "but it also creates an external definition," >&4
19575				$echo "so I won't use it." >&4
19576				val=$undef
19577			else
19578				$echo "Your compiler supports static $inline." >&4
19579				val=$define
19580				perl_static_inline="static $inline";
19581				break;
19582			fi
19583		else
19584			$echo "Your compiler does NOT support static $inline." >&4
19585			val="$undef"
19586		fi
19587	done
19588	;;
19589*inline*) # Some variant of inline exists.
19590	echo "Keeping your $hint value of $perl_static_inline."
19591	val=$define
19592	;;
19593static)  # No inline capabilities
19594	echo "Keeping your $hint value of $perl_static_inline."
19595	val=$undef
19596	;;
19597*)  # Unrecognized previous value -- blindly trust the supplied
19598	# value and hope it makes sense.  Use old value for
19599	# d_static_inline, if there is one.
19600	echo "Keeping your $hint value of $perl_static_inline."
19601	case "$d_static_inline" in
19602		'') val=$define ;;
19603		*)  val=$d_static_inline ;;
19604	esac
19605	;;
19606esac
19607# Fallback to plain 'static' if nothing worked.
19608case "$perl_static_inline" in
19609'')
19610	perl_static_inline="static"
19611	val=$undef
19612	;;
19613esac
19614set d_static_inline
19615eval $setvar
19616$rm -f a.[co] b.[co]
19617$rm_try
19618
19619: Check stream access
19620$cat >&4 <<EOM
19621Checking how to access stdio streams by file descriptor number...
19622EOM
19623case "$stdio_stream_array" in
19624'')	$cat >try.c <<EOCP
19625#include <stdio.h>
19626int main() {
19627  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19628    printf("yes\n");
19629}
19630EOCP
19631	for s in _iob __iob __sF
19632	do
19633	        set try -DSTDIO_STREAM_ARRAY=$s
19634		if eval $compile; then
19635			case "`$run ./try`" in
19636			yes)	stdio_stream_array=$s; break ;;
19637			esac
19638		fi
19639	done
19640	$rm_try
19641esac
19642case "$stdio_stream_array" in
19643'')	$cat >&4 <<EOM
19644I can't figure out how to access stdio streams by file descriptor number.
19645EOM
19646	d_stdio_stream_array="$undef"
19647	;;
19648*)	$cat >&4 <<EOM
19649You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19650EOM
19651	d_stdio_stream_array="$define"
19652	;;
19653esac
19654
19655: see if strcoll exists
19656set strcoll d_strcoll
19657eval $inlibc
19658
19659: see if strerror_l exists
19660set strerror_l d_strerror_l
19661eval $inlibc
19662
19663: see if strerror_r exists
19664set strerror_r d_strerror_r
19665eval $inlibc
19666case "$d_strerror_r" in
19667"$define")
19668	hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19669	case "$d_strerror_r_proto:$usethreads" in
19670	":define")	d_strerror_r_proto=define
19671		set d_strerror_r_proto strerror_r $hdrs
19672		eval $hasproto ;;
19673	*)	;;
19674	esac
19675	case "$d_strerror_r_proto" in
19676	define)
19677	case "$strerror_r_proto" in
19678	''|0) try='int strerror_r(int, char*, size_t);'
19679	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19680	esac
19681	case "$strerror_r_proto" in
19682	''|0) try='int strerror_r(int, char*, int);'
19683	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19684	esac
19685	case "$strerror_r_proto" in
19686	''|0) try='char* strerror_r(int, char*, size_t);'
19687	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19688	esac
19689	case "$strerror_r_proto" in
19690	''|0)	d_strerror_r=undef
19691		strerror_r_proto=0
19692		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19693	* )	case "$strerror_r_proto" in
19694		REENTRANT_PROTO*) ;;
19695		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19696		esac
19697		echo "Prototype: $try" ;;
19698	esac
19699	;;
19700	*)	case "$usethreads" in
19701		define) echo "strerror_r has no prototype, not using it." >&4 ;;
19702		esac
19703		d_strerror_r=undef
19704		strerror_r_proto=0
19705		;;
19706	esac
19707	;;
19708*)	strerror_r_proto=0
19709	;;
19710esac
19711
19712: see if strftime exists
19713set strftime d_strftime
19714eval $inlibc
19715
19716: see if strlcat exists
19717: We need both a prototype in string.h and the symbol in libc.
19718echo " "
19719d_strlcat_proto=''
19720xx1="#$d_gnulibc HAS_GNULIBC"
19721xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19722xx3='#   define _GNU_SOURCE'
19723xx4='#endif'
19724set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19725eval $hasproto
19726case "$d_strlcat_proto" in
19727    define) # see if strlcat exists
19728	set strlcat d_strlcat
19729	eval $inlibc
19730	;;
19731    *)  val=$undef
19732	set d_strlcat
19733	eval $setvar
19734	;;
19735esac
19736
19737: see if strlcpy exists
19738: We need both a prototype in string.h and the symbol in libc.
19739echo " "
19740d_strlcpy_proto=''
19741xx1="#$d_gnulibc HAS_GNULIBC"
19742xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19743xx3='#   define _GNU_SOURCE'
19744xx4='#endif'
19745set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19746eval $hasproto
19747case "$d_strlcpy_proto" in
19748    define) # see if strlcpy exists
19749	set strlcpy d_strlcpy
19750	eval $inlibc
19751	;;
19752    *)  val=$undef
19753	set d_strlcpy
19754	eval $setvar
19755	;;
19756esac
19757
19758: see if strnlen exists
19759set strnlen d_strnlen
19760eval $inlibc
19761
19762: see if strtod exists
19763set strtod d_strtod
19764eval $inlibc
19765
19766: see if strtod_l exists
19767set strtod_l d_strtod_l
19768eval $inlibc
19769
19770: see if strtol exists
19771set strtol d_strtol
19772eval $inlibc
19773
19774: see if strtold exists
19775set strtold d_strtold
19776eval $inlibc
19777
19778: see if strtold_l exists
19779set strtold_l d_strtold_l
19780eval $inlibc
19781
19782: see if strtoll exists
19783set strtoll d_strtoll
19784eval $inlibc
19785
19786case "$d_longlong-$d_strtoll" in
19787"$define-$define")
19788	$cat <<EOM
19789Checking whether your strtoll() works okay...
19790EOM
19791	$cat >try.c <<'EOCP'
19792#include <errno.h>
19793#ifdef __hpux
19794#define strtoll __strtoll
19795#endif
19796#ifdef __EMX__
19797#define strtoll _strtoll
19798#endif
19799#include <stdio.h>
19800#include <stdlib.h>
19801static int bad = 0;
19802void check(const char *s, long long ell, int een) {
19803	long long gll;
19804	errno = 0;
19805	gll = strtoll(s, 0, 10);
19806	if (!((gll == ell) && (errno == een)))
19807		bad++;
19808}
19809int main() {
19810	check(" 1",                                      1LL, 0);
19811	check(" 0",                                      0LL, 0);
19812	check("-1",                                     -1LL, 0);
19813	check("-9223372036854775808", -9223372036854775808LL, 0);
19814	check("-9223372036854775808", -9223372036854775808LL, 0);
19815	check(" 9223372036854775807",  9223372036854775807LL, 0);
19816	check("-9223372036854775808", -9223372036854775808LL, 0);
19817	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19818	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19819	if (!bad)
19820		printf("ok\n");
19821}
19822EOCP
19823	set try
19824	if eval $compile; then
19825		yyy=`$run ./try`
19826		case "$yyy" in
19827		ok) echo "Your strtoll() seems to be working okay." ;;
19828		*) cat <<EOM >&4
19829Your strtoll() doesn't seem to be working okay.
19830EOM
19831		   d_strtoll="$undef"
19832		   ;;
19833		esac
19834	else
19835		echo "(I can't seem to compile the test program--assuming it doesn't)"
19836		d_strtoll="$undef"
19837	fi
19838	;;
19839esac
19840
19841: see if strtoq exists
19842set strtoq d_strtoq
19843eval $inlibc
19844
19845: see if strtoul exists
19846set strtoul d_strtoul
19847eval $inlibc
19848
19849case "$d_strtoul" in
19850"$define")
19851	$cat <<EOM
19852Checking whether your strtoul() works okay...
19853EOM
19854	$cat >try.c <<'EOCP'
19855#include <stdlib.h>
19856#include <errno.h>
19857#include <stdio.h>
19858static int bad = 0;
19859void check(const char *s, unsigned long eul, int een) {
19860	unsigned long gul;
19861	errno = 0;
19862	gul = strtoul(s, 0, 10);
19863	if (!((gul == eul) && (errno == een)))
19864		bad++;
19865}
19866int main() {
19867	check(" 1", 1L, 0);
19868	check(" 0", 0L, 0);
19869EOCP
19870	case "$longsize" in
19871	8)
19872	    $cat >>try.c <<'EOCP'
19873	check("18446744073709551615", 18446744073709551615UL, 0);
19874	check("18446744073709551616", 18446744073709551615UL, ERANGE);
19875#if 0 /* strtoul() for /^-/ strings is undefined. */
19876	check("-1", 18446744073709551615UL, 0);
19877	check("-18446744073709551614", 2, 0);
19878	check("-18446744073709551615", 1, 0);
19879	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19880	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19881#endif
19882EOCP
19883		;;
19884	4)
19885		    $cat >>try.c <<'EOCP'
19886	check("4294967295", 4294967295UL, 0);
19887	check("4294967296", 4294967295UL, ERANGE);
19888#if 0 /* strtoul() for /^-/ strings is undefined. */
19889	check("-1", 4294967295UL, 0);
19890	check("-4294967294", 2, 0);
19891	check("-4294967295", 1, 0);
19892	check("-4294967296", 4294967295UL, ERANGE);
19893	check("-4294967297", 4294967295UL, ERANGE);
19894#endif
19895EOCP
19896		;;
19897	*)
19898: Should we write these tests to be more portable by sprintf-ing
19899: ~0 and then manipulating that char string as input for strtol?
19900		;;
19901	esac
19902	$cat >>try.c <<'EOCP'
19903	if (!bad)
19904		printf("ok\n");
19905	return 0;
19906}
19907EOCP
19908	set try
19909	if eval $compile; then
19910		case "`$run ./try`" in
19911		ok) echo "Your strtoul() seems to be working okay." ;;
19912		*) cat <<EOM >&4
19913Your strtoul() doesn't seem to be working okay.
19914EOM
19915		   d_strtoul="$undef"
19916		   ;;
19917		esac
19918	else
19919		echo "(I can't seem to compile the test program--assuming it doesn't)"
19920		d_strtoul="$undef"
19921	fi
19922	;;
19923esac
19924
19925: see if strtoull exists
19926set strtoull d_strtoull
19927eval $inlibc
19928
19929case "$d_longlong-$d_strtoull" in
19930"$define-$define")
19931	$cat <<EOM
19932Checking whether your strtoull() works okay...
19933EOM
19934	$cat >try.c <<'EOCP'
19935#include <stdlib.h>
19936#include <errno.h>
19937#ifdef __hpux
19938#define strtoull __strtoull
19939#endif
19940#include <stdio.h>
19941static int bad = 0;
19942void check(const char *s, long long eull, int een) {
19943	long long gull;
19944	errno = 0;
19945	gull = strtoull(s, 0, 10);
19946	if (!((gull == eull) && (errno == een)))
19947		bad++;
19948}
19949int main() {
19950	check(" 1",                                        1LL, 0);
19951	check(" 0",                                        0LL, 0);
19952	check("18446744073709551615",  18446744073709551615ULL, 0);
19953	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19954#if 0 /* strtoull() for /^-/ strings is undefined. */
19955	check("-1",                    18446744073709551615ULL, 0);
19956	check("-18446744073709551614",                     2LL, 0);
19957	check("-18446744073709551615",                     1LL, 0);
19958	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19959	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19960#endif
19961	if (!bad)
19962		printf("ok\n");
19963}
19964EOCP
19965	set try
19966	if eval $compile; then
19967		case "`$run ./try`" in
19968		ok) echo "Your strtoull() seems to be working okay." ;;
19969		*) cat <<EOM >&4
19970Your strtoull() doesn't seem to be working okay.
19971EOM
19972		   d_strtoull="$undef"
19973		   ;;
19974		esac
19975	else
19976		echo "(I can't seem to compile the test program--assuming it doesn't)"
19977		d_strtoull="$undef"
19978	fi
19979	;;
19980esac
19981
19982: see if strtouq exists
19983set strtouq d_strtouq
19984eval $inlibc
19985
19986case "$d_strtouq" in
19987"$define")
19988	$cat <<EOM
19989Checking whether your strtouq() works okay...
19990EOM
19991	$cat >try.c <<'EOCP'
19992#include <stdlib.h>
19993#include <errno.h>
19994#include <stdio.h>
19995static int bad = 0;
19996void check(const char *s, unsigned long long eull, int een) {
19997	unsigned long long gull;
19998	errno = 0;
19999	gull = strtouq(s, 0, 10);
20000	if (!((gull == eull) && (errno == een)))
20001		bad++;
20002}
20003int main() {
20004	check(" 1",                                        1LL, 0);
20005	check(" 0",                                        0LL, 0);
20006	check("18446744073709551615",  18446744073709551615ULL, 0);
20007	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
20008#if 0 /* strtouq() for /^-/ strings is undefined. */
20009	check("-1",                    18446744073709551615ULL, 0);
20010	check("-18446744073709551614",                     2LL, 0);
20011	check("-18446744073709551615",                     1LL, 0);
20012	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
20013	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
20014#endif
20015	if (!bad)
20016		printf("ok\n");
20017	return 0;
20018}
20019EOCP
20020	set try
20021	if eval $compile; then
20022		case "`$run ./try`" in
20023		ok) echo "Your strtouq() seems to be working okay." ;;
20024		*) cat <<EOM >&4
20025Your strtouq() doesn't seem to be working okay.
20026EOM
20027		   d_strtouq="$undef"
20028		   ;;
20029		esac
20030	else
20031		echo "(I can't seem to compile the test program--assuming it doesn't)"
20032		d_strtouq="$undef"
20033	fi
20034	;;
20035esac
20036
20037: see if strxfrm exists
20038set strxfrm d_strxfrm
20039eval $inlibc
20040
20041: see if strxfrm_l exists
20042set strxfrm_l d_strxfrm_l
20043eval $inlibc
20044
20045: see if symlink exists
20046set symlink d_symlink
20047eval $inlibc
20048
20049: see if syscall exists
20050set syscall d_syscall
20051eval $inlibc
20052
20053: see if this is a sys/syscall.h system
20054set sys/syscall.h i_syssyscall
20055eval $inhdr
20056
20057: see if prototype for syscall is available
20058echo " "
20059set d_syscallproto syscall $i_unistd unistd.h $i_syssyscall sys/syscall.h
20060eval $hasproto
20061
20062: see if sysconf exists
20063set sysconf d_sysconf
20064eval $inlibc
20065
20066: see if sys_errlist[] exists
20067echo " "
20068if test "X$d_syserrlst" = X; then
20069	if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
20070		echo "You have sys_errlist[], so we could roll our own strerror."
20071		d_syserrlst="$define"
20072	else
20073		echo "You don't have sys_errlist[], so strerror() is welcome."
20074		d_syserrlst="$undef"
20075	fi
20076fi
20077
20078: see if system exists
20079set system d_system
20080eval $inlibc
20081
20082: see if tcgetpgrp exists
20083set tcgetpgrp d_tcgetpgrp
20084eval $inlibc
20085
20086: see if tcsetpgrp exists
20087set tcsetpgrp d_tcsetpgrp
20088eval $inlibc
20089
20090: see if prototype for telldir is available
20091echo " "
20092set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
20093eval $hasproto
20094
20095: see if tgamma exists
20096set tgamma d_tgamma
20097eval $inlibc
20098
20099: see what flavor, if any, of thread local storage is supported
20100echo " "
20101echo "Checking to see if your system supports C11 thread local storage..."
20102$cat > try.c <<'EOCP'
20103#include <stdio.h>
20104#include <stdlib.h>
20105#include <pthread.h>
20106
20107static int plus_one = 1;
20108static int minus_one = -1;
20109
20110PROBE_MACRO int *minion;
20111
20112int callback (const void *a, const void *b) {
20113    int val_a = *minion * *(const int *)a;
20114    int val_b = *minion * *(const int *)b;
20115    return val_a < val_b ? -1 : val_a > val_b;
20116}
20117
20118#define SIZE 8
20119
20120void *thread_function(void *arg) {
20121    /* thread local variables should start zeroed in each thread. */
20122    if (minion != NULL) {
20123        fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20124                minion);
20125        exit(2);
20126    }
20127    minion = &minus_one;
20128
20129    int array[SIZE];
20130    unsigned int i;
20131    for (i = 0; i < SIZE; ++i) {
20132        /* "Hash randomisation" - this array isn't in sorted order: */
20133        array[i ^ 5] = i * i;
20134    }
20135
20136    qsort(array, SIZE, sizeof(int), callback);
20137
20138    int bad = 0;
20139    for (i = 0; i < SIZE; ++i) {
20140        int want = (SIZE - 1 - i) * (SIZE - 1 - i);
20141        int have = array[i];
20142        if (want != have) {
20143            ++bad;
20144            fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
20145        }
20146    }
20147    if (bad)
20148        exit(3);
20149
20150    return NULL;
20151}
20152
20153int main(int argc, char **argv) {
20154    if (minion != NULL) {
20155        fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20156                minion);
20157        exit(4);
20158    }
20159
20160    minion = &plus_one;
20161
20162    pthread_t tid;
20163    int result = pthread_create(&tid, NULL, thread_function, NULL);
20164    if (result) {
20165        fprintf(stderr, "pthread_create failed (%d)\n", result);
20166        exit(5);
20167    }
20168
20169    result = pthread_join(tid, NULL);
20170    if (result) {
20171        fprintf(stderr, "pthread_join failed (%d)\n", result);
20172        exit(6);
20173    }
20174
20175    if (minion == NULL) {
20176        fprintf(stderr, "__thread variable should not be NULL\n");
20177        exit(7);
20178    }
20179    if (!(minion == &plus_one && *minion == 1)) {
20180        fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
20181                1, &plus_one, *minion, minion);
20182        exit(8);
20183    }
20184
20185    return 0;
20186}
20187EOCP
20188
20189# Respect a hint (or previous) value for perl_thread_local, if there is one.
20190case "$perl_thread_local" in
20191'')	# Check the various possibilities, and break out on success.
20192	for thread_local in _Thread_local __thread; do
20193		set try -DPROBE_MACRO=$thread_local
20194		if eval $compile && $run ./try; then
20195			$echo "Your compiler supports $thread_local." >&4
20196			val=$define
20197			perl_thread_local="$thread_local";
20198			break;
20199		fi
20200		$echo "Your compiler does NOT support $thread_local." >&4
20201		val="$undef"
20202	done
20203	;;
20204*thread*|*Thread*) # Some variant of thread local exists.
20205	echo "Keeping your $hint value of $perl_thread_local."
20206	val=$define
20207	;;
20208*)  # Unrecognized previous value -- blindly trust the supplied
20209	# value and hope it makes sense.  Use old value for
20210	# d_thread_local, if there is one.
20211	echo "Keeping your $hint value of $perl_thread_local."
20212	case "$d_thread_local" in
20213		'') val=$define ;;
20214		*)  val=$d_thread_local ;;
20215	esac
20216	;;
20217esac
20218set d_thread_local
20219eval $setvar
20220$rm_try
20221
20222: see if time exists
20223echo " "
20224if test "X$d_time" = X -o X"$timetype" = X; then
20225    if set time val -f d_time; eval $csym; $val; then
20226		echo 'time() found.' >&4
20227		val="$define"
20228		rp="What is the type returned by time() on this system?"
20229		set time_t timetype long stdio.h sys/types.h
20230		eval $typedef_ask
20231    else
20232		echo 'time() not found, hope that will do.' >&4
20233		val="$undef"
20234		timetype='int';
20235    fi
20236    set d_time
20237    eval $setvar
20238fi
20239
20240: see if timegm exists
20241set timegm d_timegm
20242eval $inlibc
20243
20244: see if this is a sys/times.h system
20245set sys/times.h i_systimes
20246eval $inhdr
20247
20248: see if times exists
20249echo " "
20250if set times val -f d_times; eval $csym; $val; then
20251	echo 'times() found.' >&4
20252	d_times="$define"
20253	inc=''
20254	case "$i_systimes" in
20255	"$define") inc='sys/times.h';;
20256	esac
20257	rp="What is the type returned by times() on this system?"
20258	set clock_t clocktype long stdio.h sys/types.h $inc
20259	eval $typedef_ask
20260else
20261	echo 'times() NOT found, hope that will do.' >&4
20262	d_times="$undef"
20263	clocktype='int'
20264fi
20265
20266: see if tmpnam_r exists
20267set tmpnam_r d_tmpnam_r
20268eval $inlibc
20269case "$d_tmpnam_r" in
20270"$define")
20271	hdrs="$i_systypes sys/types.h define stdio.h "
20272	case "$d_tmpnam_r_proto:$usethreads" in
20273	":define")	d_tmpnam_r_proto=define
20274		set d_tmpnam_r_proto tmpnam_r $hdrs
20275		eval $hasproto ;;
20276	*)	;;
20277	esac
20278	case "$d_tmpnam_r_proto" in
20279	define)
20280	case "$tmpnam_r_proto" in
20281	''|0) try='char* tmpnam_r(char*);'
20282	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
20283	esac
20284	case "$tmpnam_r_proto" in
20285	''|0)	d_tmpnam_r=undef
20286		tmpnam_r_proto=0
20287		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
20288	* )	case "$tmpnam_r_proto" in
20289		REENTRANT_PROTO*) ;;
20290		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
20291		esac
20292		echo "Prototype: $try" ;;
20293	esac
20294	;;
20295	*)	case "$usethreads" in
20296		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20297		esac
20298		d_tmpnam_r=undef
20299		tmpnam_r_proto=0
20300		;;
20301	esac
20302	;;
20303*)	tmpnam_r_proto=0
20304	;;
20305esac
20306
20307: see if towlower exists
20308set towlower d_towlower
20309eval $inlibc
20310
20311: see if trunc exists
20312set trunc d_trunc
20313eval $inlibc
20314
20315: see if truncate exists
20316set truncate d_truncate
20317eval $inlibc
20318
20319: see if ttyname_r exists
20320set ttyname_r d_ttyname_r
20321eval $inlibc
20322case "$d_ttyname_r" in
20323"$define")
20324	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20325	case "$d_ttyname_r_proto:$usethreads" in
20326	":define")	d_ttyname_r_proto=define
20327		set d_ttyname_r_proto ttyname_r $hdrs
20328		eval $hasproto ;;
20329	*)	;;
20330	esac
20331	case "$d_ttyname_r_proto" in
20332	define)
20333	case "$ttyname_r_proto" in
20334	''|0) try='int ttyname_r(int, char*, size_t);'
20335	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20336	esac
20337	case "$ttyname_r_proto" in
20338	''|0) try='int ttyname_r(int, char*, int);'
20339	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20340	esac
20341	case "$ttyname_r_proto" in
20342	''|0) try='char* ttyname_r(int, char*, int);'
20343	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20344	esac
20345	case "$ttyname_r_proto" in
20346	''|0)	d_ttyname_r=undef
20347		ttyname_r_proto=0
20348		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20349	* )	case "$ttyname_r_proto" in
20350		REENTRANT_PROTO*) ;;
20351		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20352		esac
20353		echo "Prototype: $try" ;;
20354	esac
20355	;;
20356	*)	case "$usethreads" in
20357		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20358		esac
20359		d_ttyname_r=undef
20360		ttyname_r_proto=0
20361		;;
20362	esac
20363	;;
20364*)	ttyname_r_proto=0
20365	;;
20366esac
20367
20368: see if tzname[] exists
20369echo " "
20370if set tzname val -a d_tzname; eval $csym; $val; then
20371	val="$define"
20372	echo 'tzname[] found.' >&4
20373else
20374	val="$undef"
20375	echo 'tzname[] NOT found.' >&4
20376fi
20377set d_tzname
20378eval $setvar
20379
20380: Check if is a multiplatform env
20381case "$osname" in
20382darwin) multiarch="$define" ;;
20383esac
20384case "$multiarch" in
20385''|[nN]*) multiarch="$undef" ;;
20386esac
20387
20388: check for ordering of bytes in a UV
20389echo " "
20390case "$multiarch" in
20391*$define*)
20392	$cat <<EOM
20393You seem to be doing a multiarchitecture build,
20394skipping the byteorder check.
20395
20396EOM
20397	byteorder='ffff'
20398	;;
20399*)
20400	case "$byteorder" in
20401	'')
20402		$cat <<'EOM'
20403In the following, larger digits indicate more significance.  A big-endian
20404machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20405little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20406machines may have weird orders like 3412.  A Cray will report 87654321,
20407an Alpha will report 12345678. If the test program works the default is
20408probably right.
20409I'm now running the test program...
20410EOM
20411		$cat >try.c <<EOCP
20412#include <stdio.h>
20413#$i_stdlib I_STDLIB
20414#ifdef I_STDLIB
20415#include <stdlib.h>
20416#endif
20417#$i_inttypes I_INTTYPES
20418#ifdef I_INTTYPES
20419#include <inttypes.h>
20420#endif
20421#include <sys/types.h>
20422typedef $uvtype UV;
20423int main()
20424{
20425	int i;
20426	union {
20427		UV l;
20428		char c[$uvsize];
20429	} u;
20430
20431	if ($uvsize > 4)
20432		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20433	else
20434		u.l = (UV)0x04030201;
20435	for (i = 0; i < $uvsize; i++)
20436		printf("%c", u.c[i]+'0');
20437	printf("\n");
20438	exit(0);
20439}
20440EOCP
20441		xxx_prompt=y
20442		set try
20443		if eval $compile && $run ./try > /dev/null; then
20444			dflt=`$run ./try`
20445			case "$dflt" in
20446			[1-4][1-4][1-4][1-4]|12345678|87654321)
20447				echo "(The test program ran ok.)"
20448				echo "byteorder=$dflt"
20449				xxx_prompt=n
20450			;;
20451			????|????????) echo "(The test program ran ok.)" ;;
20452			*) echo "(The test program didn't run right for some reason.)" ;;
20453			esac
20454		else
20455			dflt='4321'
20456			cat <<'EOM'
20457(I can't seem to compile the test program.  Guessing big-endian...)
20458EOM
20459		fi
20460		case "$xxx_prompt" in
20461		y)
20462			rp="What is the order of bytes in $uvtype?"
20463			. ./myread
20464			byteorder="$ans"
20465			;;
20466		*)	byteorder=$dflt
20467			;;
20468		esac
20469		;;
20470	esac
20471	$rm_try
20472	;;
20473esac
20474
20475: Checking 32bit alignedness
20476$cat <<EOM
20477
20478Checking to see whether you can access character data unalignedly...
20479EOM
20480case "$d_u32align" in
20481'')   $cat >try.c <<EOCP
20482#include <stdio.h>
20483#$i_stdlib I_STDLIB
20484#ifdef I_STDLIB
20485#include <stdlib.h>
20486#endif
20487#define U32 $u32type
20488#define BYTEORDER 0x$byteorder
20489#define U8 $u8type
20490#include <signal.h>
20491#ifdef SIGBUS
20492$signal_t bletch(int s) { exit(4); }
20493#endif
20494int main() {
20495#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20496    volatile U8 buf[8];
20497    volatile U32 *up;
20498    int i;
20499
20500    if (sizeof(U32) != 4) {
20501	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20502	exit(1);
20503    }
20504
20505    fflush(stdout);
20506
20507#ifdef SIGBUS
20508    signal(SIGBUS, bletch);
20509#endif
20510
20511    buf[0] = 0;
20512    buf[1] = 0;
20513    buf[2] = 0;
20514    buf[3] = 1;
20515    buf[4] = 0;
20516    buf[5] = 0;
20517    buf[6] = 0;
20518    buf[7] = 1;
20519
20520    for (i = 0; i < 4; i++) {
20521	up = (U32*)(buf + i);
20522	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20523	       (*up == 1 << (8*(3-i)))  /* little-endian */
20524	      )
20525	   )
20526	{
20527	    printf("read failed (%x)\n", *up);
20528	    exit(2);
20529	}
20530    }
20531
20532    /* write test */
20533    for (i = 0; i < 4; i++) {
20534	up = (U32*)(buf + i);
20535	*up = 0xBeef;
20536	if (*up != 0xBeef) {
20537	    printf("write failed (%x)\n", *up);
20538	    exit(3);
20539	}
20540    }
20541
20542    exit(0);
20543#else
20544    printf("1\n");
20545    exit(1);
20546#endif
20547    return 0;
20548}
20549EOCP
20550set try
20551if eval $compile_ok; then
20552	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20553	$run ./try 2>&1 >/dev/null
20554	case "$?" in
20555	0)	cat >&4 <<EOM
20556You can access character data pretty unalignedly.
20557EOM
20558		d_u32align="$undef"
20559		;;
20560	*)	cat >&4 <<EOM
20561It seems that you must access character data in an aligned manner.
20562EOM
20563		d_u32align="$define"
20564		;;
20565	esac
20566else
20567	rp='Can you access character data at unaligned addresses?'
20568	dflt='n'
20569	. ./myread
20570	case "$ans" in
20571	[yY]*)	d_u32align="$undef"  ;;
20572	*)	d_u32align="$define" ;;
20573	esac
20574fi
20575$rm_try
20576;;
20577esac
20578
20579: see if ualarm exists
20580set ualarm d_ualarm
20581eval $inlibc
20582
20583: see if umask exists
20584set umask d_umask
20585eval $inlibc
20586
20587: see if unordered exists
20588set unordered d_unordered
20589eval $inlibc
20590
20591: see if unsetenv exists
20592set unsetenv d_unsetenv
20593eval $inlibc
20594
20595: see if usleep exists
20596set usleep d_usleep
20597eval $inlibc
20598
20599: see if prototype for usleep is available
20600echo " "
20601set d_usleepproto usleep $i_unistd unistd.h
20602eval $hasproto
20603
20604: see if ustat exists
20605set ustat d_ustat
20606eval $inlibc
20607
20608: see if closedir exists
20609set closedir d_closedir
20610eval $inlibc
20611
20612case "$d_closedir" in
20613"$define")
20614	echo " "
20615	echo "Checking whether closedir() returns a status..." >&4
20616	cat > try.c <<EOM
20617#$i_dirent I_DIRENT		/**/
20618#$i_sysdir I_SYS_DIR		/**/
20619#$i_sysndir I_SYS_NDIR		/**/
20620#$i_systypes I_SYS_TYPES	/**/
20621
20622#if defined(I_SYS_TYPES)
20623#include <sys/types.h>
20624#endif
20625#if defined(I_DIRENT)
20626#include <dirent.h>
20627#else
20628#ifdef I_SYS_NDIR
20629#include <sys/ndir.h>
20630#else
20631#ifdef I_SYS_DIR
20632#include <sys/dir.h>
20633#endif
20634#endif
20635#endif
20636int main() { return closedir(opendir(".")); }
20637EOM
20638	set try
20639	if eval $compile_ok; then
20640		if $run ./try > /dev/null 2>&1 ; then
20641			echo "Yes, it does."
20642			val="$undef"
20643		else
20644			echo "No, it doesn't."
20645			val="$define"
20646		fi
20647	else
20648		echo "(I can't seem to compile the test program--assuming it doesn't)"
20649		val="$define"
20650	fi
20651	;;
20652*)
20653	val="$undef";
20654	;;
20655esac
20656set d_void_closedir
20657eval $setvar
20658$rm_try
20659
20660: see if there is a wait4
20661set wait4 d_wait4
20662eval $inlibc
20663
20664: see if waitpid exists
20665set waitpid d_waitpid
20666eval $inlibc
20667
20668: see if wcrtomb exists
20669set wcrtomb d_wcrtomb
20670eval $inlibc
20671
20672: look for wcscmp
20673echo " "
20674$cat >try.c <<'EOCP'
20675#include <stdio.h>
20676#include <wchar.h>
20677int main ()
20678{
20679    wchar_t *s = L" ";
20680    return (wcscmp (s, s) ? 1 : 0);
20681    }
20682EOCP
20683set try
20684val="$undef"
20685if eval $compile; then
20686    `$run ./try`
20687    case "$?" in
20688	0)  echo "A working wcscmp() found." >&4
20689	    val="$define" ;;
20690	*)  echo "wcscmp() found, but it doesn't work" >&4
20691	    ;;
20692	esac
20693else
20694    echo "wcscmp() NOT found." >&4
20695    fi
20696set d_wcscmp
20697eval $setvar
20698$rm_try
20699
20700: see if wcstombs exists
20701set wcstombs d_wcstombs
20702eval $inlibc
20703
20704: look for wcsxfrm
20705echo " "
20706$cat >try.c <<'EOCP'
20707#include <errno.h>
20708#include <wchar.h>
20709int main ()
20710{
20711    wchar_t dst[4], *src = L" ";
20712    errno = 0;
20713    return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20714    }
20715EOCP
20716set try
20717val="$undef"
20718if eval $compile; then
20719    `$run ./try`
20720    case "$?" in
20721	0)  echo "A working wcsxfrm() found." >&4
20722	    val="$define" ;;
20723	*)  echo "wcsxfrm() found, but it doesn't work" >&4
20724	    ;;
20725	esac
20726else
20727    echo "wcsxfrm() NOT found." >&4
20728    fi
20729set d_wcsxfrm
20730eval $setvar
20731$rm_try
20732
20733: see if wctomb exists
20734set wctomb d_wctomb
20735eval $inlibc
20736
20737: see if writev exists
20738set writev d_writev
20739eval $inlibc
20740
20741: check for alignment requirements
20742echo " "
20743case "$alignbytes" in
20744    '') echo "Checking alignment constraints..." >&4
20745	$cat >try.c <<EOCP
20746#include <stdio.h>
20747struct foobar {
20748    char foo;
20749    $nvtype bar;
20750} try_algn;
20751int main()
20752{
20753    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20754    return(0);
20755}
20756EOCP
20757	set try
20758	if eval $compile_ok; then
20759	    dflt=`$run ./try`
20760	else
20761	    dflt='8'
20762	    echo "(I can't seem to compile the test program...)"
20763	fi
20764	case "$multiarch" in
20765	    *$define*)
20766		: The usual safe value is 8, but Darwin with -Duselongdouble
20767		: needs 16.  Hence, we will take 8 as a minimum, but allow
20768		: Configure to pick a larger value if needed.
20769		if $test "$dflt" -lt 8; then
20770		    dflt='8'
20771		    echo "Setting alignment to 8 for multiarch support.">&4
20772		fi
20773		;;
20774	esac
20775	;;
20776    *) dflt="$alignbytes"
20777	;;
20778esac
20779rp="Doubles must be aligned on a how-many-byte boundary?"
20780. ./myread
20781alignbytes="$ans"
20782$rm_try
20783
20784: set the base revision
20785baserev=5.0
20786
20787: length of character in bytes. Is always 1, otherwise it is not C
20788: This used to be a test using sizeof
20789charsize=1
20790
20791: Check for the number of bits in a character
20792case "$charbits" in
20793'')	echo "Checking how long a character is (in bits)..." >&4
20794	$cat >try.c <<EOCP
20795#include <stdio.h>
20796int main ()
20797{
20798    int n;
20799    unsigned char c;
20800    for (c = 1, n = 0; c; c <<= 1, n++) ;
20801    printf ("%d\n", n);
20802    return (0);
20803    }
20804EOCP
20805	set try
20806	if eval $compile_ok; then
20807		dflt=`$run ./try`
20808	else
20809		dflt='8'
20810		echo "(I can't seem to compile the test program.  Guessing...)"
20811	fi
20812	;;
20813*)
20814	dflt="$charbits"
20815	;;
20816esac
20817rp="What is the length of a character (in bits)?"
20818. ./myread
20819charbits="$ans"
20820$rm_try
20821case "$charbits" in
208228)	;;
20823*)	cat >&4 << EOM
20824Your system has an unsigned character size of $charbits bits, which
20825is rather unusual (normally it is 8 bits).  Perl likely will not work
20826correctly on your system, with subtle bugs in various places.
20827EOM
20828	rp='Do you really want to continue?'
20829	dflt='n'
20830	. ./myread
20831	case "$ans" in
20832		[yY])	echo >&4 "Okay, continuing."	;;
20833		*)	exit 1				;;
20834	esac
20835esac
20836
20837: how do we concatenate cpp tokens here?
20838echo " "
20839echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20840$cat >cpp_stuff.c <<'EOCP'
20841#define RCAT(a,b)a/**/b
20842#define ACAT(a,b)a ## b
20843RCAT(Rei,ser)
20844ACAT(Cir,cus)
20845EOCP
20846$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20847if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20848	echo "Oh!  Smells like ANSI's been here." >&4
20849	echo "We can catify or stringify, separately or together!"
20850	cpp_stuff=42
20851elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20852	echo "Ah, yes!  The good old days!" >&4
20853	echo "However, in the good old days we don't know how to stringify and"
20854	echo "catify at the same time."
20855	cpp_stuff=1
20856else
20857	$cat >&4 <<EOM
20858Hmm, I don't seem to be able to concatenate tokens with your cpp.
20859You're going to have to edit the values of CAT[2-5] in config.h...
20860EOM
20861	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20862fi
20863$rm -f cpp_stuff.*
20864
20865: see if this is a db.h system
20866set db.h i_db
20867eval $inhdr
20868
20869case "$i_db" in
20870$define)
20871	: Check db version.
20872	echo " "
20873	echo "Checking Berkeley DB version ..." >&4
20874	$cat >try.c <<EOCP
20875#include <sys/types.h>
20876#include <stdio.h>
20877#$i_stdlib I_STDLIB
20878#ifdef I_STDLIB
20879#include <stdlib.h>
20880#endif
20881#include <db.h>
20882int main(int argc, char *argv[])
20883{
20884#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
20885    int Major, Minor, Patch ;
20886    unsigned long Version ;
20887    (void)db_version(&Major, &Minor, &Patch) ;
20888    if (argc == 2) {
20889        printf("%d %d %d %d %d %d\n",
20890               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20891               Major, Minor, Patch);
20892        exit(0);
20893    }
20894    printf("You have Berkeley DB Version 2 or greater.\n");
20895
20896    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20897		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20898    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20899		Major, Minor, Patch) ;
20900
20901    /* check that db.h & libdb are compatible */
20902    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20903	printf("db.h and libdb are incompatible.\n") ;
20904        exit(3);
20905    }
20906
20907    printf("db.h and libdb are compatible.\n") ;
20908
20909    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20910		+ DB_VERSION_PATCH ;
20911
20912    /* needs to be >= 2.3.4 */
20913    if (Version < 2003004) {
20914    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20915	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20916        exit(2);
20917    }
20918
20919    exit(0);
20920#else
20921#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20922    if (argc == 2) {
20923        printf("1 0 0\n");
20924        exit(0);
20925    }
20926    printf("You have Berkeley DB Version 1.\n");
20927    exit(0);	/* DB version < 2: the coast is clear. */
20928#else
20929    exit(1);	/* <db.h> not Berkeley DB? */
20930#endif
20931#endif
20932}
20933EOCP
20934	set try
20935	if eval $compile_ok && $run ./try; then
20936		echo 'Looks OK.' >&4
20937		set `$run ./try 1`
20938		db_version_major=$1
20939		db_version_minor=$2
20940		db_version_patch=$3
20941	else
20942		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20943		i_db=$undef
20944		case " $libs " in
20945		*"-ldb "*)
20946			: Remove db from list of libraries to use
20947			echo "Removing unusable -ldb from library list" >&4
20948			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20949			shift
20950			libs="$*"
20951			echo "libs = $libs" >&4
20952			;;
20953		esac
20954	fi
20955	$rm_try
20956	;;
20957esac
20958
20959case "$i_db" in
20960define)
20961	: Check the return type needed for hash
20962	echo " "
20963	echo "Checking return type needed for hash for Berkeley DB ..." >&4
20964	$cat >try.c <<EOCP
20965#include <sys/types.h>
20966#include <db.h>
20967
20968#ifndef DB_VERSION_MAJOR
20969u_int32_t hash_cb (const void* ptr, size_t size)
20970{
20971	return 0;
20972}
20973HASHINFO info;
20974int main()
20975{
20976	info.hash = hash_cb;
20977}
20978#endif
20979EOCP
20980	if $cc $ccflags -c try.c >try.out 2>&1 ; then
20981		if $compiler_warning try.out >>/dev/null 2>&1 ; then
20982			db_hashtype='int'
20983		else
20984			db_hashtype='u_int32_t'
20985		fi
20986	else
20987		: XXX Maybe we should just give up here.
20988		db_hashtype=u_int32_t
20989		$cat try.out >&4
20990		echo "Help:  I can't seem to compile the db test program." >&4
20991		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20992	fi
20993	$rm_try
20994	echo "Your version of Berkeley DB uses $db_hashtype for hash."
20995	;;
20996*)	db_hashtype=u_int32_t
20997	;;
20998esac
20999case "$i_db" in
21000define)
21001	: Check the return type needed for prefix
21002	echo " "
21003	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
21004	cat >try.c <<EOCP
21005#include <sys/types.h>
21006#include <db.h>
21007
21008#ifndef DB_VERSION_MAJOR
21009size_t prefix_cb (const DBT *key1, const DBT *key2)
21010{
21011	return 0;
21012}
21013BTREEINFO info;
21014int main()
21015{
21016	info.prefix = prefix_cb;
21017}
21018#endif
21019EOCP
21020	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
21021		if $compiler_warning try.out >>/dev/null 2>&1 ; then
21022			db_prefixtype='int'
21023		else
21024			db_prefixtype='size_t'
21025		fi
21026	else
21027		db_prefixtype='size_t'
21028		: XXX Maybe we should just give up here.
21029		$cat try.out >&4
21030		echo "Help:  I can't seem to compile the db test program." >&4
21031		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
21032	fi
21033	$rm_try
21034	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
21035	;;
21036*)	db_prefixtype='size_t'
21037	;;
21038esac
21039
21040: Include . in @INC
21041$cat <<EOM
21042
21043Historically Perl has provided a final fallback of the current working
21044directory '.' when searching for a library. This, however, can lead to
21045problems when a Perl program which loads optional modules is called from
21046a shared directory. This can lead to executing unexpected code.
21047
21048EOM
21049
21050# When changing to exclude by default:
21051case "$default_inc_excludes_dot" in
21052    $undef|false|[nN]*) dflt="n" ;;
21053    *)                  dflt="y" ;;
21054esac
21055# To turn exclude off by default:
21056#case "$default_inc_excludes_dot" in
21057#    $define|true|[yY]*) dflt="y" ;;
21058#    *)                  dflt="n" ;;
21059#esac
21060
21061rp='Exclude '.' from @INC by default? '
21062. ./myread
21063case "$ans" in
21064    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
21065    *)          default_inc_excludes_dot="$define" ;;
21066esac
21067
21068: Check what kind of inf/nan your system has
21069$echo "Checking the kind of infinities and nans you have..." >&4
21070$echo "(The following tests may crash.  That's okay.)" >&4
21071$cat >try.c <<EOP
21072#define DOUBLESIZE $doublesize
21073#$d_longdbl HAS_LONG_DOUBLE
21074#ifdef HAS_LONG_DOUBLE
21075#define LONG_DOUBLESIZE $longdblsize
21076#define LONG_DOUBLEKIND $longdblkind
21077#endif
21078#include <math.h>
21079#include <string.h>
21080#include <stdio.h>
21081/* Note that whether the sign bit is on or off
21082 * for NaN depends on the CPU/FPU, and possibly
21083 * can be affected by the build toolchain.
21084 *
21085 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
21086 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
21087 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21088 * (respectively) as opposed to the more usual
21089 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21090 *
21091 * Pre-IEEE-754 floating point format do not even have inf/nan support
21092 * at all.  They might have a "max" value (DBL_MAX), which may be deadly
21093 * to even mention, causing immediate SIGFPE or equivalent: this is
21094 * the case with VAX floating point, for example.
21095 */
21096static void bytes(void *v, unsigned int n) {
21097  unsigned char *p = (unsigned char *)v;
21098  int i;
21099  for (i = 0; i < n; i++) {
21100    printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
21101  }
21102}
21103int main(int argc, char *argv[]) {
21104   /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
21105    * because some compilers are 'smart' and not only warn but refuse to
21106    * compile such 'illegal' values. */
21107   double dinf = exp(1e9);
21108   double dnan = sqrt(-1.0);
21109#ifdef HAS_LONG_DOUBLE
21110   long double ldinf = (long double)exp(1e9);
21111   long double ldnan = (long double)sqrt(-1.0);
21112# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
21113/* the 80-bit long doubles might have garbage in their excess bytes */
21114    memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
21115    memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
21116# endif
21117#endif
21118  if (argc == 2) {
21119    switch (argv[1][0]) {
21120    case '1': bytes(&dinf, sizeof(dinf)); break;
21121    case '2': bytes(&dnan, sizeof(dnan)); break;
21122#ifdef HAS_LONG_DOUBLE
21123    case '3': bytes(&ldinf, sizeof(ldinf)); break;
21124    case '4': bytes(&ldnan, sizeof(ldnan)); break;
21125#endif
21126    }
21127  }
21128  return 0;
21129}
21130EOP
21131set try
21132if eval $compile; then
21133    doubleinfbytes=`$run ./try 1`
21134    doublenanbytes=`$run ./try 2`
21135    case "$d_longdbl" in
21136    $define)
21137      longdblinfbytes=`$run ./try 3`
21138      longdblnanbytes=`$run ./try 4`
21139      ;;
21140    esac
21141else
21142    # Defaults in case the above test program failed.
21143    case "$doublekind" in
21144    1) # IEEE 754 32-bit LE
21145       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
21146       doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
21147       ;;
21148    2) # IEEE 754 32-bit BE
21149       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
21150       doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
21151       ;;
21152    3) # IEEE 754 64-bit LE
21153       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21154       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21155       ;;
21156    4) # IEEE 754 64-bit BE
21157       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21158       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21159       ;;
21160    5) # IEEE 754 128-bit LE
21161       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21162       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21163       ;;
21164    6) # IEEE 754 128-bit BE
21165       doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21166       doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21167       ;;
21168    7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
21169       doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
21170       doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
21171       ;;
21172    8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
21173       doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
21174       doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
21175       ;;
21176    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21177       doubleinfbytes=$undef
21178       doublenanbytes=$undef
21179       ;;
21180    *) # No idea.
21181       doubleinfbytes=$undef
21182       doublenanbytes=$undef
21183       ;;
21184    esac
21185    case "$longdblkind" in
21186    1) # IEEE 754 128-bit LE
21187       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
21188       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
21189       ;;
21190    2) # IEEE 754 128-bit BE
21191       longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21192       longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21193       ;;
21194    3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
21195       case "$longdblsize" in
21196       12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
21197           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
21198           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
21199           ;;
21200       16) # x86_64
21201           longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21202           longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21203           ;;
21204       *)  # No idea.
21205           longdblinfbytes=$undef
21206           longdblnanbytes=$undef
21207       ;;
21208       esac
21209       ;;
21210    4) # IEEE 754 80-bit BE, 12 or 16 bytes
21211       case "$longdblsize" in
21212       12) # 32-bit system
21213           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21214           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21215           ;;
21216       16) # 64-bit system
21217           longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21218           longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21219           ;;
21220       *)  # No idea.
21221           longdblinfbytes=$undef
21222           longdblnanbytes=$undef
21223       ;;
21224       esac
21225       ;;
21226    5) # 128-bit LE-LE "double double"
21227       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21228       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21229       ;;
21230    6) # 128-bit BE-BE "double double"
21231       longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21232       longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21233       ;;
21234    7) # 128-bit LE-BE "double double"
21235       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21236       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21237       ;;
21238    8) # 128-bit BE-LE "double double"
21239       longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21240       longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21241       ;;
21242    9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21243       longdblinfbytes=$undef
21244       longdblnanbytes=$undef
21245       ;;
21246    *) # No idea.
21247       longdblinfbytes=$undef
21248       longdblnanbytes=$undef
21249       ;;
21250    esac
21251fi
21252# In case the program crashed the values are empty, turn them undef.
21253case "$doubleinfbytes" in
21254'') doubleinfbytes=$undef ;;
21255esac
21256case "$doublenanbytes" in
21257'') doublenanbytes=$undef ;;
21258esac
21259case "$longdblinfbytes" in
21260'') longdblinfbytes=$undef ;;
21261esac
21262case "$longdblnanbytes" in
21263'') longdblnanbytes=$undef ;;
21264esac
21265$rm_try
21266
21267: Check the length of the double mantissa
21268$echo "Checking how many mantissa bits your doubles have..." >&4
21269$cat >try.c <<EOP
21270#$i_sunmath I_SUNMATH
21271#include <float.h>
21272#ifdef I_SUNMATH
21273# include <sunmath.h>
21274#endif
21275#ifdef DBL_MANT_DIG
21276# define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
21277#endif
21278#include <stdio.h>
21279int main(int argc, char *argv[]) {
21280#ifdef BITS
21281  printf("%d\n", BITS);
21282#endif
21283  return 0;
21284}
21285EOP
21286set try
21287if eval $compile; then
21288    doublemantbits=`$run ./try`
21289else
21290    doublemantbits="$undef"
21291fi
21292$rm_try
21293
21294: Check the length of the longdouble mantissa
21295$echo "Checking how many mantissa bits your long doubles have..." >&4
21296$cat >try.c <<EOP
21297#$i_sunmath I_SUNMATH
21298#include <float.h>
21299#ifdef I_SUNMATH
21300# include <sunmath.h>
21301#endif
21302#$d_longdbl HAS_LONG_DOUBLE
21303#if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21304# if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21305/* This format has no implicit bit.  Beware, however, that for
21306 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21307 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21308 * and the top bit must have been one since 387, zero is plain invalid.
21309 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21310#  define BITS LDBL_MANT_DIG
21311# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21312/* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21313 * reason e.g. Irix thinks 107.  But in any case, we want only
21314 * the number of real bits, the implicit bits are of no interest.  */
21315#  define BITS 2 * (DBL_MANT_DIG - 1)
21316# else
21317#  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21318# endif
21319#endif
21320#include <stdio.h>
21321int main(int argc, char *argv[]) {
21322#ifdef BITS
21323  printf("%d\n", BITS);
21324#endif
21325  return 0;
21326}
21327EOP
21328set try
21329if eval $compile; then
21330    longdblmantbits=`$run ./try`
21331else
21332    longdblmantbits="$undef"
21333fi
21334$rm_try
21335
21336: Check the length of the NV mantissa
21337$echo "Checking how many mantissa bits your NVs have..." >&4
21338if test "X$usequadmath" = "X$define"; then
21339  nvmantbits=112 # 128-1-15
21340else
21341  if test "X$nvsize" = "X$doublesize"; then
21342    nvmantbits="$doublemantbits"
21343  else
21344     if test "X$nvsize" = "X$longdblsize"; then
21345       nvmantbits="$longdblmantbits"
21346     else
21347       nvmantbits="$undef"
21348     fi
21349  fi
21350fi
21351
21352: How can we generate normalized random numbers ?
21353echo " "
21354echo "Using our internal random number implementation..." >&4
21355
21356case "$ccflags" in
21357*-Dmy_rand=*|*-Dmy_srand=*)
21358	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21359	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21360	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21361	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21362	;;
21363esac
21364
21365randfunc=drand48
21366drand01="drand48()"
21367seedfunc="srand48"
21368randbits=48
21369randseedtype=U32
21370
21371: Probe whether dtrace builds an object, as newer Illumos requires an input
21372: object file that uses at least one of the probes defined in the .d file
21373case "$usedtrace" in
21374$define)
21375    case "$dtracexnolibs" in
21376    $define|true|[yY]*)
21377        dtracexnolibs=$define
21378	$dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21379	;;
21380    ' '|'')
21381        if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21382	     dtracexnolibs=$define
21383	     echo "Your dtrace accepts -xnolibs"
21384	elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21385	     dtracexnolibs=$undef
21386	     echo "Your dtrace doesn't accept -xnolibs"
21387	else
21388             echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21389	     exit 1
21390	fi
21391	;;
21392    *)
21393        dtracexnolibs=$undef
21394	$dtrace -h -s ../perldtrace.d -o perldtrace.h
21395	;;
21396    esac
21397    case $dtracexnolibs in
21398    $define) xnolibs=-xnolibs ;;
21399    *) xnolibs= ;;
21400    esac
21401
21402    case "$dtraceobject" in
21403    $define|true|[yY]*)
21404        dtraceobject=$define
21405        ;;
21406    ' '|'')
21407        $cat >try.c <<EOM
21408#include "perldtrace.h"
21409int main(void) {
21410    PERL_LOADED_FILE("dummy");
21411    return 0;
21412}
21413EOM
21414        dtraceobject=$undef
21415        if $cc -c -o try.o $optimize $ccflags try.c \
21416                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21417                dtraceobject=$define
21418            echo "Your dtrace builds an object file"
21419        fi
21420        ;;
21421    *) dtraceobject=$undef ;;
21422    esac
21423    $rm_try perldtrace.o perldtrace.h
21424esac
21425
21426: Determine if this is an EBCDIC system
21427echo " "
21428echo "Determining whether or not we are on an EBCDIC system..." >&4
21429$cat >try.c <<'EOM'
21430int main()
21431{
21432  if ('M'==0xd4) return 0;
21433  return 1;
21434}
21435EOM
21436
21437val=$undef
21438set try
21439if eval $compile_ok; then
21440	if $run ./try; then
21441		echo "You seem to speak EBCDIC." >&4
21442		val="$define"
21443	else
21444		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21445	fi
21446else
21447	echo "I'm unable to compile the test program." >&4
21448	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21449fi
21450$rm_try
21451set ebcdic
21452eval $setvar
21453
21454: Check how to flush
21455echo " "
21456$cat >&4 <<EOM
21457Checking how to flush all pending stdio output...
21458EOM
21459# I only know how to find the first 32 possibly open files on SunOS.
21460# See also hints/sunos_4_1.sh and util.c  --AD
21461case "$osname" in
21462sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21463esac
21464$cat >>try.c <<EOCP
21465#include <stdio.h>
21466#$i_stdlib I_STDLIB
21467#ifdef I_STDLIB
21468#include <stdlib.h>
21469#endif
21470#$i_unistd I_UNISTD
21471#ifdef I_UNISTD
21472# include <unistd.h>
21473#endif
21474#$d_sysconf HAS_SYSCONF
21475#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21476#ifdef HAS_STDIO_STREAM_ARRAY
21477# define STDIO_STREAM_ARRAY $stdio_stream_array
21478#endif
21479int main() {
21480  FILE* p;
21481  unlink("try.out");
21482  p = fopen("try.out", "w");
21483#ifdef TRY_FPUTC
21484  fputc('x', p);
21485#else
21486# ifdef TRY_FPRINTF
21487  fprintf(p, "x");
21488# endif
21489#endif
21490#ifdef TRY_FFLUSH_NULL
21491  fflush(NULL);
21492#endif
21493#ifdef TRY_FFLUSH_ALL
21494  {
21495    long open_max = -1;
21496# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21497    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21498# else
21499#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21500    open_max = sysconf(_SC_OPEN_MAX);
21501#  else
21502#   ifdef FOPEN_MAX
21503    open_max = FOPEN_MAX;
21504#   else
21505#    ifdef OPEN_MAX
21506    open_max = OPEN_MAX;
21507#    else
21508#     ifdef _NFILE
21509    open_max = _NFILE;
21510#     endif
21511#    endif
21512#   endif
21513#  endif
21514# endif
21515# ifdef HAS_STDIO_STREAM_ARRAY
21516    if (open_max > 0) {
21517      long i;
21518      for (i = 0; i < open_max; i++)
21519	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21520		STDIO_STREAM_ARRAY[i]._file < open_max &&
21521		STDIO_STREAM_ARRAY[i]._flag)
21522		fflush(&STDIO_STREAM_ARRAY[i]);
21523    }
21524# endif
21525  }
21526#endif
21527  _exit(42);
21528}
21529EOCP
21530: first we have to find out how _not_ to flush
21531$to try.c
21532if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21533    output=''
21534    set try -DTRY_FPUTC
21535    if eval $compile; then
21536	    $run ./try 2>/dev/null
21537	    code="$?"
21538	    $from try.out
21539	    if $test ! -s try.out -a "X$code" = X42; then
21540		output=-DTRY_FPUTC
21541	    fi
21542    fi
21543    case "$output" in
21544    '')
21545	    set try -DTRY_FPRINTF
21546	    if eval $compile; then
21547		    $run ./try 2>/dev/null
21548		    code="$?"
21549		    $from try.out
21550		    if $test ! -s try.out -a "X$code" = X42; then
21551			output=-DTRY_FPRINTF
21552		    fi
21553	    fi
21554	;;
21555    esac
21556fi
21557: check for fflush NULL behavior
21558case "$fflushNULL" in
21559'')	set try -DTRY_FFLUSH_NULL $output
21560	if eval $compile; then
21561		$run ./try 2>/dev/null
21562		code="$?"
21563		$from try.out
21564		if $test -s try.out -a "X$code" = X42; then
21565			fflushNULL="`$cat try.out`"
21566		else
21567			if $test "X$code" != X42; then
21568				$cat >&4 <<EOM
21569(If this test failed, don't worry, we'll try another method shortly.)
21570EOM
21571			fi
21572		fi
21573	fi
21574	$rm -f core try.core core.try.*
21575	case "$fflushNULL" in
21576	x)	$cat >&4 <<EOM
21577Your fflush(NULL) works okay for output streams.
21578Let's see if it clobbers input pipes...
21579EOM
21580# As of mid-March 2000 all versions of Solaris appear to have a stdio
21581# bug that improperly flushes the input end of pipes.  So we avoid the
21582# autoflush on fork/system/exec support for now. :-(
21583$cat >tryp.c <<EOCP
21584#include <stdio.h>
21585int
21586main(int argc, char **argv)
21587{
21588    char buf[1024];
21589    int i;
21590    char *bp = buf;
21591    while (1) {
21592	while ((i = getc(stdin)) != -1
21593	       && (*bp++ = i) != '\n'
21594	       && bp < &buf[1024])
21595	/* DO NOTHING */ ;
21596	*bp = '\0';
21597	fprintf(stdout, "%s", buf);
21598	fflush(NULL);
21599	if (i == -1)
21600	    return 0;
21601	bp = buf;
21602    }
21603}
21604EOCP
21605		fflushNULL="$define"
21606		set tryp
21607		if eval $compile; then
21608		    $rm -f tryp.out
21609		    # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21610		    if $test "X$targethost" != X; then
21611			$to tryp.c
21612			$to tryp
21613			$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21614		    else
21615			$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21616		    fi
21617		    if cmp tryp.c tryp.out >/dev/null 2>&1; then
21618		       $cat >&4 <<EOM
21619fflush(NULL) seems to behave okay with input streams.
21620EOM
21621			fflushNULL="$define"
21622		    else
21623			$cat >&4 <<EOM
21624Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21625EOM
21626			fflushNULL="$undef"
21627		    fi
21628		fi
21629		$rm -f core tryp.c tryp.core core.tryp.*
21630		;;
21631	'')	$cat >&4 <<EOM
21632Your fflush(NULL) isn't working (contrary to ANSI C).
21633EOM
21634		fflushNULL="$undef"
21635		;;
21636	*)	$cat >&4 <<EOM
21637Cannot figure out whether your fflush(NULL) works or not.
21638I'm assuming it doesn't (contrary to ANSI C).
21639EOM
21640		fflushNULL="$undef"
21641		;;
21642	esac
21643	;;
21644$define|true|[yY]*)
21645	fflushNULL="$define"
21646	;;
21647*)
21648	fflushNULL="$undef"
21649	;;
21650esac
21651: check explicit looping only if NULL did not work, and if the pipe
21652: bug does not show up on an explicit flush too
21653case "$fflushNULL" in
21654"$undef")
21655	$cat >tryp.c <<EOCP
21656#include <stdio.h>
21657int
21658main(int argc, char **argv)
21659{
21660    char buf[1024];
21661    int i;
21662    char *bp = buf;
21663    while (1) {
21664	while ((i = getc(stdin)) != -1
21665	       && (*bp++ = i) != '\n'
21666	       && bp < &buf[1024])
21667	/* DO NOTHING */ ;
21668	*bp = '\0';
21669	fprintf(stdout, "%s", buf);
21670	fflush(stdin);
21671	if (i == -1)
21672	    return 0;
21673	bp = buf;
21674    }
21675}
21676EOCP
21677	set tryp
21678	if eval $compile; then
21679	    $rm -f tryp.out
21680	    if $test "X$targethost" != X; then
21681		$to tryp.c
21682		$to tryp
21683		$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21684	    else
21685		$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21686	    fi
21687	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
21688	       $cat >&4 <<EOM
21689Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21690EOM
21691		: now check for fflushall behaviour
21692		case "$fflushall" in
21693		'')	set try -DTRY_FFLUSH_ALL $output
21694			if eval $compile; then
21695				$cat >&4 <<EOM
21696(Now testing the other method--but note that this also may fail.)
21697EOM
21698				$run ./try 2>/dev/null
21699				code=$?
21700				$from try.out
21701				if $test -s try.out -a "X$code" = X42; then
21702					fflushall="`$cat try.out`"
21703				fi
21704			fi
21705			$rm_try
21706			case "$fflushall" in
21707			x)	$cat >&4 <<EOM
21708Whew. Flushing explicitly all the stdio streams works.
21709EOM
21710				fflushall="$define"
21711				;;
21712			'')	$cat >&4 <<EOM
21713Sigh. Flushing explicitly all the stdio streams doesn't work.
21714EOM
21715				fflushall="$undef"
21716				;;
21717			*)	$cat >&4 <<EOM
21718Cannot figure out whether flushing stdio streams explicitly works or not.
21719I'm assuming it doesn't.
21720EOM
21721				fflushall="$undef"
21722				;;
21723			esac
21724			;;
21725		"$define"|true|[yY]*)
21726			fflushall="$define"
21727			;;
21728		*)
21729			fflushall="$undef"
21730			;;
21731		esac
21732	    else
21733		$cat >&4 <<EOM
21734All is futile.  Even fflush(stdin) clobbers input pipes!
21735EOM
21736		fflushall="$undef"
21737	    fi
21738	else
21739	    fflushall="$undef"
21740	fi
21741	$rm -f core tryp.c tryp.core core.tryp.*
21742	;;
21743*)	fflushall="$undef"
21744	;;
21745esac
21746
21747case "$fflushNULL$fflushall" in
21748undefundef)
21749	$cat <<EOM
21750OK, I give up.  I cannot figure out how to flush pending stdio output.
21751We won't be flushing handles at all before fork/exec/popen.
21752EOM
21753	;;
21754esac
21755$rm_try tryp
21756
21757: Store the full pathname to the ar program for use in the C program
21758: Respect a hint or command line value for full_ar.
21759case "$full_ar" in
21760'') full_ar=$ar ;;
21761esac
21762
21763: Store the full pathname to the sed program for use in the C program
21764full_sed=$sed
21765
21766: see what type gids are declared as in the kernel
21767echo " "
21768echo "Looking for the type for group ids returned by getgid()."
21769set gid_t gidtype xxx stdio.h sys/types.h
21770eval $typedef
21771case "$gidtype" in
21772xxx)
21773	xxx=`./findhdr sys/user.h`
21774	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21775	case $1 in
21776	unsigned) dflt="$1 $2" ;;
21777	*) dflt="$1" ;;
21778	esac
21779	;;
21780*) dflt="$gidtype";;
21781esac
21782case "$gidtype" in
21783gid_t) echo "gid_t found." ;;
21784*)	rp="What is the type for group ids returned by getgid()?"
21785	. ./myread
21786	gidtype="$ans"
21787	;;
21788esac
21789
21790: Check the size of GID
21791echo " "
21792case "$gidtype" in
21793*_t) zzz="$gidtype"	;;
21794*)   zzz="gid"		;;
21795esac
21796echo "Checking the size of $zzz..." >&4
21797cat > try.c <<EOCP
21798#include <sys/types.h>
21799#include <stdio.h>
21800#$i_stdlib I_STDLIB
21801#ifdef I_STDLIB
21802#include <stdlib.h>
21803#endif
21804int main() {
21805    printf("%d\n", (int)sizeof($gidtype));
21806    exit(0);
21807}
21808EOCP
21809set try
21810if eval $compile_ok; then
21811	yyy=`$run ./try`
21812	case "$yyy" in
21813	'')	gidsize=4
21814		echo "(I can't execute the test program--guessing $gidsize.)" >&4
21815		;;
21816	*)	gidsize=$yyy
21817		echo "Your $zzz is $gidsize bytes long."
21818		;;
21819	esac
21820else
21821	gidsize=4
21822	echo "(I can't compile the test program--guessing $gidsize.)" >&4
21823fi
21824
21825: Check if GID is signed
21826echo " "
21827case "$gidtype" in
21828*_t) zzz="$gidtype"	;;
21829*)   zzz="gid"		;;
21830esac
21831echo "Checking the sign of $zzz..." >&4
21832cat > try.c <<EOCP
21833#include <sys/types.h>
21834#include <stdio.h>
21835int main() {
21836	$gidtype foo = -1;
21837	if (foo < 0)
21838		printf("-1\n");
21839	else
21840		printf("1\n");
21841}
21842EOCP
21843set try
21844if eval $compile; then
21845	yyy=`$run ./try`
21846	case "$yyy" in
21847	'')	gidsign=1
21848		echo "(I can't execute the test program--guessing unsigned.)" >&4
21849		;;
21850	*)	gidsign=$yyy
21851		case "$gidsign" in
21852		 1) echo "Your $zzz is unsigned." ;;
21853		-1) echo "Your $zzz is signed."   ;;
21854		esac
21855		;;
21856	esac
21857else
21858	gidsign=1
21859	echo "(I can't compile the test program--guessing unsigned.)" >&4
21860fi
21861
21862: Check 64bit sizes
21863echo " "
21864
21865if $test X"$quadtype" != X; then
21866
21867echo "Checking how to print 64-bit integers..." >&4
21868
21869if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21870	$cat >try.c <<'EOCP'
21871#include <sys/types.h>
21872#include <stdio.h>
21873int main() {
21874  int q = 12345678901;
21875  printf("%ld\n", q);
21876}
21877EOCP
21878	set try
21879	if eval $compile; then
21880		yyy=`$run ./try`
21881		case "$yyy" in
21882		12345678901)
21883			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21884			sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21885			echo "We will use %d."
21886			;;
21887		esac
21888	fi
21889fi
21890
21891if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21892	$cat >try.c <<'EOCP'
21893#include <sys/types.h>
21894#include <stdio.h>
21895int main() {
21896  long q = 12345678901;
21897  printf("%ld\n", q);
21898}
21899EOCP
21900	set try
21901	if eval $compile; then
21902		yyy=`$run ./try`
21903		case "$yyy" in
21904		12345678901)
21905			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21906			sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21907			echo "We will use %ld."
21908			;;
21909		esac
21910	fi
21911fi
21912
21913if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21914	$cat >try.c <<'EOCP'
21915#include <sys/types.h>
21916#include <inttypes.h>
21917#include <stdio.h>
21918int main() {
21919  int64_t q = 12345678901;
21920  printf("%" PRId64 "\n", q);
21921}
21922EOCP
21923	set try
21924	if eval $compile; then
21925		yyy=`$run ./try`
21926		case "$yyy" in
21927		12345678901)
21928			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21929			sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21930			echo "We will use the C9X style."
21931			;;
21932		esac
21933	fi
21934fi
21935
21936if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21937	$cat >try.c <<'EOCP'
21938#include <sys/types.h>
21939#include <stdio.h>
21940int main() {
21941  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21942  printf("%lld\n", q);
21943}
21944EOCP
21945	set try
21946	if eval $compile; then
21947		yyy=`$run ./try`
21948		case "$yyy" in
21949		12345678901)
21950			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21951			sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21952			echo "We will use the %lld style."
21953			;;
21954		esac
21955	fi
21956fi
21957
21958if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21959	$cat >try.c <<EOCP
21960#include <sys/types.h>
21961#include <stdio.h>
21962int main() {
21963  $quadtype q = 12345678901;
21964  printf("%qd\n", q);
21965}
21966EOCP
21967	set try
21968	if eval $compile; then
21969		yyy=`$run ./try`
21970		case "$yyy" in
21971		12345678901)
21972			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21973			sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21974			echo "We will use %qd."
21975			;;
21976		esac
21977	fi
21978fi
21979
21980if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21981	$cat >try.c <<EOCP
21982#include <sys/types.h>
21983#include <stdio.h>
21984int main() {
21985  $quadtype q = 12345678901;
21986  printf("%Ld\n", q);
21987}
21988EOCP
21989	set try
21990	if eval $compile; then
21991		yyy=`$run ./try`
21992		case "$yyy" in
21993		12345678901)
21994			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21995			sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21996			echo "We will use %Ld."
21997			;;
21998		esac
21999	fi
22000fi
22001
22002if $test X"$sPRId64" = X; then
22003	echo "Cannot figure out how to print 64-bit integers." >&4
22004fi
22005$rm_try
22006
22007fi
22008
22009case "$sPRId64" in
22010'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
22011	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
22012	;;
22013*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
22014	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
22015	;;
22016esac
22017
22018: Check format strings for internal types
22019echo " "
22020$echo "Checking the format strings to be used for Perl's internal types..." >&4
22021
22022if $test X"$ivsize" = X8; then
22023	ivdformat="$sPRId64"
22024	uvuformat="$sPRIu64"
22025	uvoformat="$sPRIo64"
22026	uvxformat="$sPRIx64"
22027	uvXUformat="$sPRIXU64"
22028else
22029	if $test X"$ivsize" = X"$longsize"; then
22030		ivdformat='"ld"'
22031		uvuformat='"lu"'
22032		uvoformat='"lo"'
22033		uvxformat='"lx"'
22034		uvXUformat='"lX"'
22035	else
22036		if $test X"$ivsize" = X"$intsize"; then
22037			ivdformat='"d"'
22038			uvuformat='"u"'
22039			uvoformat='"o"'
22040			uvxformat='"x"'
22041			uvXUformat='"X"'
22042		else
22043			: far out
22044			if $test X"$ivsize" = X"$shortsize"; then
22045				ivdformat='"hd"'
22046				uvuformat='"hu"'
22047				uvoformat='"ho"'
22048				uvxformat='"hx"'
22049				uvXUformat='"hX"'
22050			fi
22051		fi
22052	fi
22053fi
22054
22055if $test X"$usequadmath" = X"$define"; then
22056    nveformat='"Qe"'
22057    nvfformat='"Qf"'
22058    nvgformat='"Qg"'
22059    nvEUformat='"QE"'
22060    nvFUformat='"QF"'
22061    nvGUformat='"QG"'
22062else
22063    if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
22064	nveformat="$sPRIeldbl"
22065	nvfformat="$sPRIfldbl"
22066	nvgformat="$sPRIgldbl"
22067	nvEUformat="$sPRIEUldbl"
22068	nvFUformat="$sPRIFUldbl"
22069	nvGUformat="$sPRIGUldbl"
22070    else
22071	nveformat='"e"'
22072	nvfformat='"f"'
22073	nvgformat='"g"'
22074	nvEUformat='"E"'
22075	nvFUformat='"F"'
22076	nvGUformat='"G"'
22077    fi
22078fi
22079
22080case "$ivdformat" in
22081'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
22082    exit 1
22083    ;;
22084esac
22085
22086: Check format string for GID
22087
22088echo " "
22089$echo "Checking the format string to be used for gids..." >&4
22090
22091case "$gidsign" in
22092-1)	if $test X"$gidsize" = X"$ivsize"; then
22093		gidformat="$ivdformat"
22094	else
22095		if $test X"$gidsize" = X"$longsize"; then
22096			gidformat='"ld"'
22097		else
22098			if $test X"$gidsize" = X"$intsize"; then
22099				gidformat='"d"'
22100			else
22101				if $test X"$gidsize" = X"$shortsize"; then
22102					gidformat='"hd"'
22103				fi
22104			fi
22105		fi
22106	fi
22107	;;
22108*)	if $test X"$gidsize" = X"$uvsize"; then
22109		gidformat="$uvuformat"
22110	else
22111		if $test X"$gidsize" = X"$longsize"; then
22112			gidformat='"lu"'
22113		else
22114			if $test X"$gidsize" = X"$intsize"; then
22115				gidformat='"u"'
22116			else
22117				if $test X"$gidsize" = X"$shortsize"; then
22118					gidformat='"hu"'
22119				fi
22120			fi
22121		fi
22122	fi
22123	;;
22124esac
22125
22126: see if getgroups exists
22127set getgroups d_getgrps
22128eval $inlibc
22129
22130: see if setgroups exists
22131set setgroups d_setgrps
22132eval $inlibc
22133
22134: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
22135echo " "
22136case "$d_getgrps$d_setgrps" in
22137*define*)
22138	case "$groupstype" in
22139	'') dflt="$gidtype" ;;
22140	*)  dflt="$groupstype" ;;
22141	esac
22142	$cat <<EOM
22143What type of pointer is the second argument to getgroups() and setgroups()?
22144Usually this is the same as group ids, $gidtype, but not always.
22145
22146EOM
22147	rp='What type pointer is the second argument to getgroups() and setgroups()?'
22148	. ./myread
22149	groupstype="$ans"
22150	;;
22151*)  groupstype="$gidtype";;
22152esac
22153
22154: Check format strings for internal 32bit types
22155echo " "
22156$echo "Checking the format strings to be used for Perl's internal 32bit-types..." >&4
22157
22158case "$i32dformat" in
22159'')	case "$i32type" in
22160	int)
22161		i32dformat='"d"'
22162		u32uformat='"u"'
22163		u32oformat='"o"'
22164		u32xformat='"x"'
22165		u32XUformat='"X"'
22166		;;
22167	long)
22168		i32dformat='"ld"'
22169		u32uformat='"lu"'
22170		u32oformat='"lo"'
22171		u32xformat='"lx"'
22172		u32XUformat='"lX"'
22173		;;
22174	int_least32_t)		: will not happen currently
22175		i32dformat=PRIdLEAST32
22176		u32uformat=PRIuLEAST32
22177		u32oformat=PRIoLEAST32
22178		u32xformat=PRIxLEAST32
22179		u32XUformat=PRIXLEAST32
22180		;;
22181	int32_t)
22182		i32dformat=PRId32
22183		u32uformat=PRIu32
22184		u32oformat=PRIo32
22185		u32xformat=PRIx32
22186		u32XUformat=PRIX32
22187		;;
22188	esac ;;
22189esac
22190
22191case "$i32dformat" in
22192'') echo "$0: Fatal: failed to find format strings for 32-bit integers, cannot continue." >&4
22193    exit 1
22194    ;;
22195esac
22196
22197: check whether make sets MAKE
22198echo " "
22199echo "Checking if your $make program sets \$(MAKE)..." >&4
22200case "$make_set_make" in
22201'')
22202	$sed 's/^X //' > testmake.mak << 'EOF'
22203Xall:
22204X 	@echo 'maketemp="$(MAKE)"'
22205EOF
22206	case "`$make -f testmake.mak 2>/dev/null`" in
22207	*maketemp=*) make_set_make='#' ;;
22208	*)	make_set_make="MAKE=$make" ;;
22209	esac
22210	$rm -f testmake.mak
22211	;;
22212esac
22213case "$make_set_make" in
22214'#') echo "Yup, it does.";;
22215*) echo "Nope, it doesn't.";;
22216esac
22217
22218: see what type is used for mode_t
22219rp="What is the type used for file modes for system calls (e.g. fchmod())?"
22220set mode_t modetype int stdio.h sys/types.h
22221eval $typedef_ask
22222
22223: see if we need va_copy
22224echo " "
22225$cat >try.c <<EOCP
22226#include <stdarg.h>
22227#include <stdio.h>
22228#include <stdlib.h>
22229#include <signal.h>
22230
22231int
22232ivfprintf(FILE *f, const char *fmt, va_list *valp)
22233{
22234  return vfprintf(f, fmt, *valp);
22235}
22236
22237int
22238myvfprintf(FILE *f, const  char *fmt, va_list val)
22239{
22240  return ivfprintf(f, fmt, &val);
22241}
22242
22243int
22244myprintf(char *fmt, ...)
22245{
22246  va_list val;
22247  va_start(val, fmt);
22248  return myvfprintf(stdout, fmt, val);
22249}
22250
22251int
22252main(int ac, char **av)
22253{
22254  signal(SIGSEGV, exit);
22255#ifdef SIGBUS
22256  signal(SIGBUS,  exit);
22257#endif
22258
22259  myprintf("%s%cs all right, then\n", "that", '\'');
22260  exit(0);
22261}
22262EOCP
22263set try
22264if eval $compile && $run ./try 2>&1 >/dev/null; then
22265	case "`$run ./try`" in
22266	"that's all right, then")
22267		okay=yes
22268		;;
22269	esac
22270fi
22271case "$okay" in
22272yes)	echo "It seems that you don't need va_copy()." >&4
22273	need_va_copy="$undef"
22274	;;
22275*)	echo "It seems that va_copy() or similar will be needed." >&4
22276	need_va_copy="$define"
22277	;;
22278esac
22279$rm_try
22280
22281: see what type is used for size_t
22282rp="What is the type used for the length parameter for string functions?"
22283set size_t sizetype 'unsigned int' stdio.h sys/types.h
22284eval $typedef_ask
22285
22286: check for type of arguments to gethostbyaddr.
22287if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
22288	case "$d_gethbyaddr" in
22289	$define)
22290		$cat <<EOM
22291
22292Checking to see what type of arguments are accepted by gethostbyaddr().
22293EOM
22294		hdrs="$define sys/types.h
22295			$d_socket sys/socket.h
22296			$i_niin netinet/in.h
22297			$i_netdb netdb.h
22298			$i_unistd unistd.h"
22299		: The first arg can 'char *' or 'void *'
22300		: The second arg is some of integral type
22301		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
22302			for yyy in size_t long int; do
22303				case "$netdb_host_type" in
22304				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
22305					if ./protochk "$try" $hdrs; then
22306						echo "Your system accepts $xxx for the first arg."
22307						echo "...and $yyy for the second arg."
22308						netdb_host_type="$xxx"
22309						netdb_hlen_type="$yyy"
22310					fi
22311					;;
22312				esac
22313			done
22314		done
22315		: In case none of those worked, prompt the user.
22316		case "$netdb_host_type" in
22317		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
22318			dflt='char *'
22319			. ./myread
22320			netdb_host_type=$ans
22321			rp='What is the type for the 2nd argument to gethostbyaddr?'
22322			dflt="$sizetype"
22323			. ./myread
22324			netdb_hlen_type=$ans
22325			;;
22326		esac
22327		;;
22328	*)	: no gethostbyaddr, so pick harmless defaults
22329		netdb_host_type='char *'
22330		netdb_hlen_type="$sizetype"
22331		;;
22332	esac
22333	# Remove the "const" if needed. -- but then we'll have a
22334	# prototype clash!
22335	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22336fi
22337
22338: check for type of argument to gethostbyname.
22339if test "X$netdb_name_type" = X ; then
22340	case "$d_gethbyname" in
22341	$define)
22342		$cat <<EOM
22343
22344Checking to see what type of argument is accepted by gethostbyname().
22345EOM
22346		hdrs="$define sys/types.h
22347			$d_socket sys/socket.h
22348			$i_niin netinet/in.h
22349			$i_netdb netdb.h
22350			$i_unistd unistd.h"
22351		for xxx in "const char *" "char *"; do
22352			case "$netdb_name_type" in
22353			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
22354				if ./protochk "$try" $hdrs; then
22355					echo "Your system accepts $xxx."
22356					netdb_name_type="$xxx"
22357				fi
22358				;;
22359			esac
22360		done
22361		: In case none of those worked, prompt the user.
22362		case "$netdb_name_type" in
22363		'')	rp='What is the type for the 1st argument to gethostbyname?'
22364			dflt='char *'
22365			. ./myread
22366			netdb_name_type=$ans
22367			;;
22368		esac
22369		;;
22370	*)	: no gethostbyname, so pick harmless default
22371		netdb_name_type='char *'
22372		;;
22373	esac
22374fi
22375
22376: check for type of 1st argument to getnetbyaddr.
22377if test "X$netdb_net_type" = X ; then
22378	case "$d_getnbyaddr" in
22379	$define)
22380		$cat <<EOM
22381
22382Checking to see what type of 1st argument is accepted by getnetbyaddr().
22383EOM
22384		hdrs="$define sys/types.h
22385			$d_socket sys/socket.h
22386			$i_niin netinet/in.h
22387			$i_netdb netdb.h
22388			$i_unistd unistd.h"
22389		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22390			case "$netdb_net_type" in
22391			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22392				if ./protochk "$try" $hdrs; then
22393					echo "Your system accepts $xxx."
22394					netdb_net_type="$xxx"
22395				fi
22396				;;
22397			esac
22398		done
22399		: In case none of those worked, prompt the user.
22400		case "$netdb_net_type" in
22401		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
22402			dflt='long'
22403			. ./myread
22404			netdb_net_type=$ans
22405			;;
22406		esac
22407		;;
22408	*)	: no getnetbyaddr, so pick harmless default
22409		netdb_net_type='long'
22410		;;
22411	esac
22412fi
22413: locate the preferred pager for this system
22414fn=f/
22415case "$pager" in
22416'')
22417	dflt=''
22418	case "$pg" in
22419	/*) dflt=$pg;;
22420	[a-zA-Z]:/*) dflt=$pg;;
22421	esac
22422	case "$more" in
22423	/*) dflt=$more;;
22424	[a-zA-Z]:/*) dflt=$more;;
22425	esac
22426	case "$less" in
22427	/*) dflt=$less;;
22428	[a-zA-Z]:/*) dflt=$less;;
22429	esac
22430	case "$dflt" in
22431	'') dflt=/usr/ucb/more;;
22432	esac
22433	;;
22434*)	dflt="$pager"
22435	;;
22436esac
22437fn="f/($dflt)"
22438echo " "
22439rp='What pager is used on your system?'
22440. ./getfile
22441pager="$ans"
22442
22443: see if ar generates random libraries by itself
22444echo " "
22445echo "Checking how to generate random libraries on your machine..." >&4
22446echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
22447echo 'int bar2() { return 2; }' > bar2.c
22448$cat > foo.c <<EOP
22449#$i_stdlib I_STDLIB
22450#ifdef I_STDLIB
22451#include <stdlib.h>
22452#endif
22453#include <stdio.h>
22454extern int bar1();
22455int main() { printf("%d\n", bar1()); exit(0); }
22456EOP
22457$cc $ccflags -c bar1.c >/dev/null 2>&1
22458$cc $ccflags -c bar2.c >/dev/null 2>&1
22459$cc $ccflags -c foo.c >/dev/null 2>&1
22460$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22461if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22462	$run ./foobar >/dev/null 2>&1; then
22463	echo "$ar appears to generate random libraries itself."
22464	orderlib=false
22465	if [ "X$ranlib" = "X" ]; then
22466	    ranlib=":"
22467	fi
22468elif $ar s bar$_a >/dev/null 2>&1 &&
22469	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22470	$run ./foobar >/dev/null 2>&1; then
22471		echo "a table of contents needs to be added with '$ar s'."
22472		orderlib=false
22473		ranlib="$ar s"
22474elif $ar ts bar$_a >/dev/null 2>&1 &&
22475	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22476	$run ./foobar >/dev/null 2>&1; then
22477		echo "a table of contents needs to be added with '$ar ts'."
22478		orderlib=false
22479		ranlib="$ar ts"
22480else
22481	case "$ranlib" in
22482	:) ranlib='';;
22483	'')
22484		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22485		$test -f $ranlib || ranlib=''
22486		;;
22487	esac
22488	if $test -n "$ranlib"; then
22489		echo "your system has '$ranlib'; we'll use that."
22490		orderlib=false
22491	else
22492		echo "your system doesn't seem to support random libraries"
22493		echo "so we'll use lorder and tsort to order the libraries."
22494		orderlib=true
22495		ranlib=":"
22496	fi
22497fi
22498$rm -f foo* bar*
22499
22500: Check the max offset that gmtime and localtime accept
22501echo "Checking max offsets that gmtime () accepts"
22502
22503case "$sGMTIME_min/$sGMTIME_max" in
22504    0/0|/)
22505	$cat >try.c <<EOCP
22506#include <sys/types.h>
22507#include <stdio.h>
22508#include <time.h>
22509
22510int i;
22511struct tm *tmp;
22512time_t pt;
22513
22514void gm_check (time_t t, int min_year, int max_year)
22515{
22516    tmp = gmtime (&t);
22517    if ( tmp == NULL ||
22518	/* Check tm_year overflow */
22519	 tmp->tm_year < min_year || tmp->tm_year > max_year)
22520	tmp = NULL;
22521    else
22522	pt = t;
22523    } /* gm_check */
22524
22525int check_max ()
22526{
22527    tmp = NULL;
22528    pt  = 0;
22529#ifdef MAXLONG
22530    gm_check (MAXLONG, 69, 0x7fffffff);
22531#endif
22532    if (tmp == NULL || tmp->tm_year < 0) {
22533	for (i = 63; i >= 0; i--) {
22534	    time_t x = pt | ((time_t)1 << i);
22535	    if (x < 0 || x < pt) continue;
22536	    gm_check (x, 69, 0x7fffffff);
22537	    }
22538	}
22539    printf ("sGMTIME_max=%ld\n", pt);
22540    return (0);
22541    } /* check_max */
22542
22543int check_min ()
22544{
22545    tmp = NULL;
22546    pt  = 0;
22547#ifdef MINLONG
22548    gm_check (MINLONG, -1900, 70);
22549#endif
22550    if (tmp == NULL) {
22551	for (i = 36; i >= 0; i--) {
22552	    time_t x = pt - ((time_t)1 << i);
22553	    if (x > 0) continue;
22554	    gm_check (x, -1900, 70);
22555	    }
22556	}
22557    printf ("sGMTIME_min=%ld\n", pt);
22558    return (0);
22559    } /* check_min */
22560
22561int main (int argc, char *argv[])
22562{
22563    /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22564    check_max ();
22565    check_min ();
22566    return (0);
22567    } /* main */
22568EOCP
22569	set try
22570	if eval $compile; then
22571	    eval `$run ./try 2>/dev/null`
22572	else
22573	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22574	    fi
22575	$rm_try
22576	;;
22577    esac
22578
22579echo "Checking max offsets that localtime () accepts"
22580
22581case "$sLOCALTIME_min/$sLOCALTIME_max" in
22582    0/0|/)
22583	$cat >try.c <<EOCP
22584#include <sys/types.h>
22585#include <stdio.h>
22586#include <time.h>
22587
22588int i;
22589struct tm *tmp;
22590time_t pt;
22591
22592void local_check (time_t t, int min_year, int max_year)
22593{
22594    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22595	tmp = NULL;
22596    else
22597	tmp = localtime (&t);
22598    if ( tmp == NULL ||
22599	/* Check tm_year overflow */
22600	 tmp->tm_year < min_year || tmp->tm_year > max_year)
22601	tmp = NULL;
22602    else
22603	pt = t;
22604    } /* local_check */
22605
22606int check_max ()
22607{
22608    tmp = NULL;
22609    pt  = 0;
22610#ifdef MAXLONG
22611    local_check (MAXLONG, 69, 0x7fffffff);
22612#endif
22613    if (tmp == NULL || tmp->tm_year < 0) {
22614	for (i = 63; i >= 0; i--) {
22615	    time_t x = pt | ((time_t)1 << i);
22616	    if (x < 0 || x < pt) continue;
22617	    local_check (x, 69, 0x7fffffff);
22618	    }
22619	}
22620    printf ("sLOCALTIME_max=%ld\n", pt);
22621    return (0);
22622   } /* check_max */
22623
22624int check_min ()
22625{
22626    tmp = NULL;
22627    pt  = 0;
22628#ifdef MINLONG
22629    local_check (MINLONG, -1900, 70);
22630#endif
22631    if (tmp == NULL) {
22632	for (i = 36; i >= 0; i--) {
22633	    time_t x = pt - ((time_t)1 << i);
22634	    if (x > 0) continue;
22635	    local_check (x, -1900, 70);
22636	    }
22637	}
22638    printf ("sLOCALTIME_min=%ld\n", pt);
22639    return (0);
22640    } /* check_min */
22641
22642int main (int argc, char *argv[])
22643{
22644    check_max ();
22645    check_min ();
22646    return (0);
22647    } /* main */
22648EOCP
22649	set try
22650	if eval $compile; then
22651	    eval `$run ./try 2>/dev/null`
22652	else
22653	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22654	    fi
22655	$rm_try
22656	;;
22657    esac
22658
22659: check for type of arguments to select.
22660case "$selecttype" in
22661'') case "$d_select" in
22662	$define)
22663		echo " "
22664		$cat <<EOM
22665Checking to see what type of arguments are accepted by select().
22666EOM
22667		hdrs="$define sys/types.h
22668			$i_systime sys/time.h
22669			$i_sysselct sys/select.h
22670			$d_socket sys/socket.h"
22671		: The first arg can be int, unsigned, or size_t
22672		: The last arg may or may not be 'const'
22673		val=''
22674		: void pointer has been seen but using that
22675		: breaks the selectminbits test
22676		for xxx in 'fd_set *' 'int *'; do
22677			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22678				for tmo in 'struct timeval *' 'const struct timeval *'; do
22679					case "$val" in
22680					'')	try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22681						if ./protochk "$try" $hdrs; then
22682							echo "Your system accepts $xxx."
22683							val="$xxx"
22684						fi
22685						;;
22686					esac
22687				done
22688			done
22689		done
22690		case "$val" in
22691		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22692			case "$d_fd_set" in
22693				$define) dflt="fd_set *" ;;
22694				*)		dflt="int *" ;;
22695			esac
22696			. ./myread
22697			val=$ans
22698			;;
22699		esac
22700		selecttype="$val"
22701		;;
22702	*)	: no select, so pick a harmless default
22703		selecttype='int *'
22704		;;
22705	esac
22706	;;
22707esac
22708
22709: check for the select 'width'
22710case "$selectminbits" in
22711'') safebits=`expr $ptrsize \* 8`
22712    case "$d_select" in
22713	$define)
22714		$cat <<EOM
22715
22716Checking to see on how many bits at a time your select() operates...
22717EOM
22718		$cat >try.c <<EOCP
22719#include <sys/types.h>
22720#$i_time I_TIME
22721#$i_systime I_SYS_TIME
22722#$i_systimek I_SYS_TIME_KERNEL
22723#ifdef I_TIME
22724#   include <time.h>
22725#endif
22726#ifdef I_SYS_TIME
22727#   ifdef I_SYS_TIME_KERNEL
22728#	define KERNEL
22729#   endif
22730#   include <sys/time.h>
22731#   ifdef I_SYS_TIME_KERNEL
22732#	undef KERNEL
22733#   endif
22734#endif
22735#$i_sysselct I_SYS_SELECT
22736#ifdef I_SYS_SELECT
22737#include <sys/select.h>
22738#endif
22739#$d_socket HAS_SOCKET
22740#ifdef HAS_SOCKET
22741#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22742#endif
22743#include <stdio.h>
22744#$i_stdlib I_STDLIB
22745#ifdef I_STDLIB
22746#include <stdlib.h>
22747#endif
22748$selecttype b;
22749#define S sizeof(*(b))
22750#define MINBITS	64
22751#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22752#define NBITS  (NBYTES * 8)
22753int main() {
22754    char *s = (char *)malloc(NBYTES);
22755    struct timeval t;
22756    int i;
22757    FILE* fp;
22758    int fd;
22759
22760    if (!s)
22761	exit(1);
22762    fclose(stdin);
22763    fp = fopen("try.c", "r");
22764    if (fp == 0)
22765      exit(2);
22766    fd = fileno(fp);
22767    if (fd < 0)
22768      exit(3);
22769    b = ($selecttype)s;
22770    for (i = 0; i < NBITS; i++)
22771	FD_SET(i, b);
22772    t.tv_sec  = 0;
22773    t.tv_usec = 0;
22774    select(fd + 1, b, 0, 0, &t);
22775    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22776    free(s);
22777    printf("%d\n", i + 1);
22778    return 0;
22779}
22780EOCP
22781		set try
22782		if eval $compile_ok; then
22783			selectminbits=`$run ./try 2>/dev/null`
22784			case "$selectminbits" in
22785			'')	cat >&4 <<EOM
22786Cannot figure out on how many bits at a time your select() operates.
22787I'll play safe and guess it is $safebits bits.
22788EOM
22789				selectminbits=$safebits
22790				bits="$safebits bits"
22791				;;
22792			1)	bits="1 bit" ;;
22793			*)	bits="$selectminbits bits" ;;
22794			esac
22795			echo "Your select() operates on $bits at a time." >&4
22796		else
22797			rp='What is the minimum number of bits your select() operates on?'
22798			case "$byteorder" in
22799			12345678)	dflt=64 ;;
22800			1234)		dflt=32 ;;
22801			*)		dflt=1	;;
22802			esac
22803			. ./myread
22804			val=$ans
22805			selectminbits="$val"
22806		fi
22807		$rm_try
22808		;;
22809	*)	: no select, so pick a harmless default
22810		selectminbits=$safebits
22811		;;
22812	esac
22813	;;
22814esac
22815
22816: Trace out the files included by signal.h, then look for SIGxxx names.
22817case "$sig_num_init" in
22818'')
22819if [ "X$fieldn" = X ]; then
22820	: Just make some guesses.  We check them later.
22821	xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22822else
22823	xxx=`echo '#include <signal.h>' |
22824	$cppstdin $cppminus $cppflags 2>/dev/null |
22825	$grep '^[ 	]*#.*include' |
22826	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22827		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22828fi
22829xxxfiles=''
22830for xx in $xxx /dev/null ; do
22831	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
22832done
22833case "$xxxfiles" in
22834'')	xxxfiles=`./findhdr signal.h` ;;
22835esac
22836xxx=`awk '
22837$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22838	print substr($2, 4, 20)
22839}
22840$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22841	print substr($3, 4, 20)
22842}' $xxxfiles`
22843: Append some common names just in case the awk scan failed.
22844xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22845xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22846xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22847xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22848xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22849
22850: generate a few handy files for later
22851$cat > signal.c <<EOCP
22852#include <sys/types.h>
22853#include <signal.h>
22854#$i_stdlib I_STDLIB
22855#ifdef I_STDLIB
22856#include <stdlib.h>
22857#endif
22858#include <stdio.h>
22859int main() {
22860
22861/* Strange style to avoid deeply-nested #if/#else/#endif */
22862#ifndef NSIG
22863#  ifdef _NSIG
22864#    define NSIG (_NSIG)
22865#  endif
22866#endif
22867
22868#ifndef NSIG
22869#  ifdef SIGMAX
22870#    define NSIG (SIGMAX+1)
22871#  endif
22872#endif
22873
22874#ifndef NSIG
22875#  ifdef SIG_MAX
22876#    define NSIG (SIG_MAX+1)
22877#  endif
22878#endif
22879
22880#ifndef NSIG
22881#  ifdef _SIG_MAX
22882#    define NSIG (_SIG_MAX+1)
22883#  endif
22884#endif
22885
22886#ifndef NSIG
22887#  ifdef MAXSIG
22888#    define NSIG (MAXSIG+1)
22889#  endif
22890#endif
22891
22892#ifndef NSIG
22893#  ifdef MAX_SIG
22894#    define NSIG (MAX_SIG+1)
22895#  endif
22896#endif
22897
22898#ifndef NSIG
22899#  ifdef SIGARRAYSIZE
22900#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22901#  endif
22902#endif
22903
22904#ifndef NSIG
22905#  ifdef _sys_nsig
22906#    define NSIG (_sys_nsig) /* Solaris 2.5 */
22907#  endif
22908#endif
22909
22910/* Default to some arbitrary number that's big enough to get most
22911   of the common signals.
22912*/
22913#ifndef NSIG
22914#    define NSIG 50
22915#endif
22916
22917printf("NSIG %d\n", NSIG);
22918
22919#ifndef JUST_NSIG
22920
22921EOCP
22922
22923echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22924{
22925	printf "#ifdef SIG"; printf $1; printf "\n"
22926	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22927	printf $1; printf ");\n"
22928	printf "#endif\n"
22929}
22930END {
22931	printf "#endif /* JUST_NSIG */\n";
22932	printf "exit(0);\n}\n";
22933}
22934' >>signal.c
22935$cat >signal.awk <<'EOP'
22936BEGIN { ndups = 0 }
22937$1 ~ /^NSIG$/ { nsig = $2 }
22938($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22939    if ($2 > maxsig) { maxsig = $2 }
22940    if (sig_name[$2]) {
22941	dup_name[ndups] = $1
22942	dup_num[ndups] = $2
22943	ndups++
22944    }
22945    else {
22946	sig_name[$2] = $1
22947	sig_num[$2] = $2
22948    }
22949}
22950END {
22951    if (nsig == 0) {
22952    	nsig = maxsig + 1
22953    }
22954    printf("NSIG %d\n", nsig);
22955    for (n = 1; n < nsig; n++) {
22956 	if (sig_name[n]) {
22957 	    printf("%s %d\n", sig_name[n], sig_num[n])
22958	}
22959 	else {
22960 	    printf("NUM%d %d\n", n, n)
22961 	}
22962    }
22963    for (n = 0; n < ndups; n++) {
22964 	printf("%s %d\n", dup_name[n], dup_num[n])
22965    }
22966}
22967EOP
22968$cat >signal_cmd <<EOS
22969$startsh
22970if $test -s signal.lst; then
22971    echo "Using your existing signal.lst file"
22972	exit 0
22973fi
22974xxx="$xxx"
22975EOS
22976$cat >>signal_cmd <<'EOS'
22977
22978set signal
22979if eval $compile_ok; then
22980	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22981		$uniq | $awk -f signal.awk >signal.lst
22982else
22983	echo "(I can't seem be able to compile the whole test program)" >&4
22984	echo "(I'll try it in little pieces.)" >&4
22985	set signal -DJUST_NSIG
22986	if eval $compile_ok; then
22987		$run ./signal$_exe > signal.nsg
22988		$cat signal.nsg
22989	else
22990		echo "I can't seem to figure out how many signals you have." >&4
22991		echo "Guessing 50." >&4
22992		echo 'NSIG 50' > signal.nsg
22993	fi
22994	: Now look at all the signal names, one at a time.
22995	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22996		$cat > signal.c <<EOCP
22997#include <sys/types.h>
22998#include <signal.h>
22999#include <stdio.h>
23000int main() {
23001printf("$xx %d\n", SIG${xx});
23002return 0;
23003}
23004EOCP
23005		set signal
23006		if eval $compile; then
23007			echo "SIG${xx} found."
23008			$run ./signal$_exe  >> signal.ls1
23009		else
23010			echo "SIG${xx} NOT found."
23011		fi
23012	done
23013	if $test -s signal.ls1; then
23014		$cat signal.nsg signal.ls1 |
23015			$sort -n | $uniq | $awk -f signal.awk >signal.lst
23016	fi
23017
23018fi
23019if $test -s signal.lst; then
23020	:
23021else
23022	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
23023	echo 'kill -l' >signal
23024	set X `csh -f <signal`
23025	$rm -f signal
23026	shift
23027	case $# in
23028	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
23029	esac
23030	echo $@ | $tr ' ' $trnl | \
23031 	    $awk '{ printf "%s %d\n", $1, ++s; }
23032 		  END { printf "NSIG %d\n", ++s }' >signal.lst
23033fi
23034$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
23035EOS
23036chmod a+x signal_cmd
23037$eunicefix signal_cmd
23038;;
23039esac
23040
23041: generate list of signal names
23042case "$sig_num_init" in
23043'')
23044echo " "
23045case "$sig_name_init" in
23046'') doinit=yes ;;
23047*)  case "$sig_num_init" in
23048    ''|*,*) doinit=yes ;;
23049    esac ;;
23050esac
23051case "$doinit" in
23052yes)
23053	echo "Generating a list of signal names and numbers..." >&4
23054	. ./signal_cmd
23055	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
23056	sig_name=`$awk 'BEGIN { printf "ZERO " }
23057			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
23058	sig_num=`$awk  'BEGIN { printf "0 " }
23059			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
23060	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
23061			     !/^NSIG/	{ printf "\"%s\", ", $1 }
23062			     END	{ printf "0\n" }' signal.lst`
23063	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
23064			     !/^NSIG/	{ printf "%d, ", $2}
23065			     END	{ printf "0\n"}' signal.lst`
23066	;;
23067esac
23068echo "The following $sig_count signals are available:"
23069echo " "
23070echo $sig_name | $awk \
23071'BEGIN { linelen = 0 }
23072{
23073	for (i = 1; i <= NF; i++) {
23074		name = "SIG" $i " "
23075		linelen = linelen + length(name)
23076		if (linelen > 70) {
23077			printf "\n"
23078			linelen = length(name)
23079		}
23080		printf "%s", name
23081	}
23082	printf "\n"
23083}'
23084sig_size=`echo $sig_name | awk '{print NF}'`
23085$rm -f signal signal.c signal.awk signal.lst signal_cmd
23086;;
23087esac
23088
23089: Check size of size
23090echo " "
23091case "$sizetype" in
23092*_t) zzz="$sizetype"	;;
23093*)   zzz="filesize"	;;
23094esac
23095echo "Checking the size of $zzz..." >&4
23096cat > try.c <<EOCP
23097#include <sys/types.h>
23098#include <stdio.h>
23099#$i_stdlib I_STDLIB
23100#ifdef I_STDLIB
23101#include <stdlib.h>
23102#endif
23103int main() {
23104    printf("%d\n", (int)sizeof($sizetype));
23105    exit(0);
23106}
23107EOCP
23108set try
23109if eval $compile_ok; then
23110	yyy=`$run ./try`
23111	case "$yyy" in
23112	'')	sizesize=4
23113		echo "(I can't execute the test program--guessing $sizesize.)" >&4
23114		;;
23115	*)	sizesize=$yyy
23116		echo "Your $zzz size is $sizesize bytes."
23117		;;
23118	esac
23119else
23120	sizesize=4
23121	echo "(I can't compile the test program--guessing $sizesize.)" >&4
23122fi
23123
23124: check for socklen_t
23125echo " "
23126echo "Checking to see if you have socklen_t..." >&4
23127$cat >try.c <<EOCP
23128#include <sys/types.h>
23129#$d_socket HAS_SOCKET
23130#ifdef HAS_SOCKET
23131#include <sys/socket.h>
23132#endif
23133int main() { socklen_t x = 16; }
23134EOCP
23135set try
23136if eval $compile; then
23137	val="$define"
23138	echo "You have socklen_t."
23139else
23140	val="$undef"
23141	echo "You do not have socklen_t."
23142	case "$sizetype" in
23143	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
23144	esac
23145fi
23146$rm_try
23147set d_socklen_t
23148eval $setvar
23149
23150: see if this is a socks.h system
23151set socks.h i_socks
23152eval $inhdr
23153
23154: check for type of the size argument to socket calls
23155case "$d_socket" in
23156"$define")
23157	$cat <<EOM
23158
23159Checking to see what type is the last argument of accept().
23160EOM
23161	yyy=''
23162	case "$d_socklen_t" in
23163	"$define") yyy="$yyy socklen_t"
23164	esac
23165	yyy="$yyy $sizetype int long unsigned"
23166	for xxx in $yyy; do
23167		case "$socksizetype" in
23168		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
23169			case "$usesocks" in
23170			"$define")
23171				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
23172					echo "Your system accepts '$xxx *' for the last argument of accept()."
23173					socksizetype="$xxx"
23174				fi
23175				;;
23176			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
23177					echo "Your system accepts '$xxx *' for the last argument of accept()."
23178					socksizetype="$xxx"
23179				fi
23180				;;
23181			esac
23182			;;
23183		esac
23184	done
23185: In case none of those worked, prompt the user.
23186	case "$socksizetype" in
23187	'')	rp='What is the type for socket address structure sizes?'
23188		dflt='int'
23189		. ./myread
23190		socksizetype=$ans
23191		;;
23192	esac
23193	;;
23194*)	: no sockets, so pick relatively harmless default
23195	socksizetype='int'
23196	;;
23197esac
23198
23199: see what type is used for signed size_t
23200set ssize_t ssizetype int stdio.h sys/types.h
23201eval $typedef
23202dflt="$ssizetype"
23203$cat > try.c <<EOM
23204#include <stdio.h>
23205#$i_stdlib I_STDLIB
23206#ifdef I_STDLIB
23207#include <stdlib.h>
23208#endif
23209#include <sys/types.h>
23210#define Size_t $sizetype
23211#define SSize_t $dflt
23212int main()
23213{
23214	if (sizeof(Size_t) == sizeof(SSize_t))
23215		printf("$dflt\n");
23216	else if (sizeof(Size_t) == sizeof(int))
23217		printf("int\n");
23218	else
23219		printf("long\n");
23220	exit(0);
23221}
23222EOM
23223echo " "
23224set try
23225if eval $compile_ok && $run ./try > /dev/null; then
23226	ssizetype=`$run ./try`
23227	echo "I'll be using $ssizetype for functions returning a byte count." >&4
23228else
23229	$cat >&4 <<EOM
23230Help! I can't compile and run the ssize_t test program: please enlighten me!
23231(This is probably a misconfiguration in your system or libraries, and
23232you really ought to fix it.  Still, I'll try anyway.)
23233
23234I need a type that is the same size as $sizetype, but is guaranteed to
23235be signed.  Common values are ssize_t, int and long.
23236
23237EOM
23238	rp="What signed type is the same size as $sizetype?"
23239	. ./myread
23240	ssizetype="$ans"
23241fi
23242$rm_try
23243
23244: Check the size of st_dev
23245$echo " "
23246$echo "Checking the size of st_dev..." >&4
23247$cat > try.c <<EOCP
23248#include <sys/stat.h>
23249#include <stdio.h>
23250#$i_stdlib I_STDLIB
23251#ifdef I_STDLIB
23252#include <stdlib.h>
23253#endif
23254int main() {
23255    struct stat st;
23256    printf("%d\n", (int)sizeof(st.st_dev));
23257    exit(0);
23258}
23259EOCP
23260set try
23261if eval $compile_ok; then
23262	val=`$run ./try`
23263	case "$val" in
23264	'')	st_dev_size=4
23265		$echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
23266		;;
23267	*)	st_dev_size=$val
23268		$echo "Your st_dev is $st_dev_size bytes long."
23269		;;
23270	esac
23271else
23272	st_dev_size=4
23273	$echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
23274fi
23275$rm_try
23276
23277: Check if st_dev is signed
23278$echo " "
23279$echo "Checking the sign of st_dev..." >&4
23280$cat > try.c <<EOCP
23281#include <sys/stat.h>
23282#include <stdio.h>
23283int main() {
23284	struct stat foo;
23285        foo.st_dev = -1;
23286	if (foo.st_dev < 0)
23287		printf("-1\n");
23288	else
23289		printf("1\n");
23290}
23291EOCP
23292set try
23293if eval $compile; then
23294	val=`$run ./try`
23295	case "$val" in
23296	'')	st_dev_sign=1
23297		$echo "(I can't execute the test program--guessing unsigned.)" >&4
23298		;;
23299	*)	st_dev_sign=$val
23300		case "$st_dev_sign" in
23301		 1) $echo "Your st_dev is unsigned." ;;
23302		-1) $echo "Your st_dev is signed."   ;;
23303		esac
23304		;;
23305	esac
23306else
23307	st_dev_sign=1
23308	$echo "(I can't compile the test program--guessing unsigned.)" >&4
23309fi
23310$rm_try
23311
23312: Check the size of st_ino
23313$echo " "
23314$echo "Checking the size of st_ino..." >&4
23315$cat > try.c <<EOCP
23316#include <sys/stat.h>
23317#include <stdio.h>
23318#$i_stdlib I_STDLIB
23319#ifdef I_STDLIB
23320#include <stdlib.h>
23321#endif
23322int main() {
23323    struct stat st;
23324    printf("%d\n", (int)sizeof(st.st_ino));
23325    exit(0);
23326}
23327EOCP
23328set try
23329if eval $compile_ok; then
23330	val=`$run ./try`
23331	case "$val" in
23332	'')	st_ino_size=4
23333		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23334		;;
23335	*)	st_ino_size=$val
23336		$echo "Your st_ino is $st_ino_size bytes long."
23337		;;
23338	esac
23339else
23340	st_ino_size=4
23341	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23342fi
23343$rm_try
23344
23345: Check if st_ino is signed
23346$echo " "
23347$echo "Checking the sign of st_ino..." >&4
23348$cat > try.c <<EOCP
23349#include <sys/stat.h>
23350#include <stdio.h>
23351int main() {
23352	struct stat foo;
23353        foo.st_ino = -1;
23354	if (foo.st_ino < 0)
23355		printf("-1\n");
23356	else
23357		printf("1\n");
23358}
23359EOCP
23360set try
23361if eval $compile; then
23362	val=`$run ./try`
23363	case "$val" in
23364	'')	st_ino_sign=1
23365		$echo "(I can't execute the test program--guessing unsigned.)" >&4
23366		;;
23367	*)	st_ino_sign=$val
23368		case "$st_ino_sign" in
23369		 1) $echo "Your st_ino is unsigned." ;;
23370		-1) $echo "Your st_ino is signed."   ;;
23371		esac
23372		;;
23373	esac
23374else
23375	st_ino_sign=1
23376	$echo "(I can't compile the test program--guessing unsigned.)" >&4
23377fi
23378$rm_try
23379
23380: see what type of char stdio uses.
23381echo " "
23382echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23383if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23384	echo "Your stdio uses unsigned chars." >&4
23385	stdchar="unsigned char"
23386else
23387	echo "Your stdio uses signed chars." >&4
23388	stdchar="char"
23389fi
23390$rm -f stdioh
23391
23392: Check size of UID
23393echo " "
23394case "$uidtype" in
23395*_t) zzz="$uidtype"	;;
23396*)   zzz="uid"		;;
23397esac
23398echo "Checking the size of $zzz..." >&4
23399cat > try.c <<EOCP
23400#include <sys/types.h>
23401#include <stdio.h>
23402#$i_stdlib I_STDLIB
23403#ifdef I_STDLIB
23404#include <stdlib.h>
23405#endif
23406int main() {
23407    printf("%d\n", (int)sizeof($uidtype));
23408    exit(0);
23409}
23410EOCP
23411set try
23412if eval $compile_ok; then
23413	yyy=`$run ./try`
23414	case "$yyy" in
23415	'')	uidsize=4
23416		echo "(I can't execute the test program--guessing $uidsize.)" >&4
23417		;;
23418	*)	uidsize=$yyy
23419		echo "Your $zzz is $uidsize bytes long."
23420		;;
23421	esac
23422else
23423	uidsize=4
23424	echo "(I can't compile the test program--guessing $uidsize.)" >&4
23425fi
23426
23427: Check if UID is signed
23428echo " "
23429case "$uidtype" in
23430*_t) zzz="$uidtype"	;;
23431*)   zzz="uid"		;;
23432esac
23433echo "Checking the sign of $zzz..." >&4
23434cat > try.c <<EOCP
23435#include <sys/types.h>
23436#include <stdio.h>
23437int main() {
23438	$uidtype foo = -1;
23439	if (foo < 0)
23440		printf("-1\n");
23441	else
23442		printf("1\n");
23443}
23444EOCP
23445set try
23446if eval $compile; then
23447	yyy=`$run ./try`
23448	case "$yyy" in
23449	'')	uidsign=1
23450		echo "(I can't execute the test program--guessing unsigned.)" >&4
23451		;;
23452	*)	uidsign=$yyy
23453		case "$uidsign" in
23454		 1) echo "Your $zzz is unsigned." ;;
23455		-1) echo "Your $zzz is signed."   ;;
23456		esac
23457		;;
23458	esac
23459else
23460	uidsign=1
23461	echo "(I can't compile the test program--guessing unsigned.)" >&4
23462fi
23463
23464: Check format string for UID
23465echo " "
23466$echo "Checking the format string to be used for uids..." >&4
23467
23468case "$uidsign" in
23469-1)	if $test X"$uidsize" = X"$ivsize"; then
23470		uidformat="$ivdformat"
23471	else
23472		if $test X"$uidsize" = X"$longsize"; then
23473			uidformat='"ld"'
23474		else
23475			if $test X"$uidsize" = X"$intsize"; then
23476				uidformat='"d"'
23477			else
23478				if $test X"$uidsize" = X"$shortsize"; then
23479					uidformat='"hd"'
23480				fi
23481			fi
23482		fi
23483	fi
23484	;;
23485*)	if $test X"$uidsize" = X"$uvsize"; then
23486		uidformat="$uvuformat"
23487	else
23488		if $test X"$uidsize" = X"$longsize"; then
23489			uidformat='"lu"'
23490		else
23491			if $test X"$uidsize" = X"$intsize"; then
23492				uidformat='"u"'
23493			else
23494				if $test X"$uidsize" = X"$shortsize"; then
23495					uidformat='"hu"'
23496				fi
23497			fi
23498		fi
23499	fi
23500	;;
23501esac
23502
23503: Ask about strict by default.
23504case "$usedefaultstrict" in
23505    $define|true|[Yy]*)
23506       dflt="y"
23507       ;;
23508    *)
23509       dflt="n"
23510       ;;
23511    esac
23512
23513cat <<EOM
23514
23515EXPERIMENTAL: Perl can now be built with strict on by default when not
23516invoked with -e or -E. This is a diagnostic tool for development.
23517
23518Unless you are familiar with this feature, you should probably answer 'no'.
23519
23520EOM
23521
23522rp='Would you like to build perl with strict enabled by default?'
23523. ./myread
23524case "$ans" in
23525y|Y) val="$define" ;;
23526*)   val="$undef"  ;;
23527esac
23528set usedefaultstrict
23529eval $setvar
23530
23531: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23532echo " "
23533echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23534$cat >try.c <<'EOM'
23535/* Intentionally a long probe as I'd like to sanity check that the exact
23536   approach is going to work, as thinking it will work, but only having it
23537   part working at runtime is worse than not having it.  */
23538
23539#include <sys/types.h>
23540#include <sys/sysctl.h>
23541#include <sys/param.h>
23542#include <stdio.h>
23543#include <string.h>
23544#include <stdlib.h>
23545#include <unistd.h>
23546
23547int
23548main(int argc, char **argv) {
23549    char *buffer;
23550    char *argv_leaf = strrchr(argv[0], '/');
23551    char *buffer_leaf;
23552    size_t size = 0;
23553    int mib[4];
23554
23555    mib[0] = CTL_KERN;
23556    mib[1] = KERN_PROC;
23557    mib[2] = KERN_PROC_PATHNAME;
23558    mib[3] = -1;
23559
23560    if (!argv_leaf) {
23561	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23562	return 1;
23563    }
23564
23565    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23566	perror("sysctl");
23567	return 2;
23568    }
23569
23570    if (size < strlen(argv_leaf) + 1) {
23571	fprintf(stderr, "size %lu is too short for a path\n",
23572		(unsigned long) size);
23573	return 3;
23574    }
23575
23576    if (size > MAXPATHLEN * MAXPATHLEN) {
23577	fprintf(stderr, "size %lu is too long for a path\n",
23578		(unsigned long) size);
23579	return 4;
23580    }
23581
23582    buffer = (char *)malloc(size);
23583    if (!buffer) {
23584	perror("malloc");
23585	return 5;
23586    }
23587
23588    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23589	perror("sysctl");
23590	return 6;
23591    }
23592
23593    if (strlen(buffer) + 1 != size) {
23594	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23595		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
23596        return 7;
23597    }
23598
23599
23600    if (*buffer != '/') {
23601	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23602	return 8;
23603    }
23604
23605    if (strstr(buffer, "/./")) {
23606	fprintf(stderr, "Contains /./: '%s'\n", buffer);
23607	return 9;
23608    }
23609
23610    if (strstr(buffer, "/../")) {
23611	fprintf(stderr, "Contains /../: '%s'\n", buffer);
23612	return 10;
23613    }
23614
23615    buffer_leaf = strrchr(buffer, '/');
23616    if (strcmp(buffer_leaf, argv_leaf) != 0) {
23617	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23618	return 11;
23619    }
23620
23621    free(buffer);
23622
23623    return 0;
23624}
23625EOM
23626
23627val=$undef
23628set try
23629if eval $compile; then
23630	if $run ./try; then
23631		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23632		val="$define"
23633	else
23634		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23635		val="$undef"
23636	fi
23637else
23638	echo "I'm unable to compile the test program." >&4
23639	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23640	val="$undef"
23641fi
23642$rm_try
23643set usekernprocpathname
23644eval $setvar
23645
23646: Determine if we can use _NSGetExecutablePath to find executing program
23647echo " "
23648echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23649$cat >try.c <<'EOM'
23650/* Intentionally a long probe as I'd like to sanity check that the exact
23651   approach is going to work, as thinking it will work, but only having it
23652   part working at runtime is worse than not having it.  */
23653#include <mach-o/dyld.h>
23654#include <stdio.h>
23655#include <stdlib.h>
23656#include <sys/param.h>
23657#include <string.h>
23658
23659int
23660main(int argc, char **argv) {
23661    char buf[1];
23662    uint32_t size = sizeof(buf);
23663    int result;
23664    char *buffer;
23665    char *tidied;
23666    char *argv_leaf = strrchr(argv[0], '/');
23667    char *tidied_leaf;
23668
23669    if (!argv_leaf) {
23670	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23671	return 1;
23672    }
23673
23674    _NSGetExecutablePath(buf, &size);
23675    if (size > MAXPATHLEN * MAXPATHLEN) {
23676	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23677		(unsigned int) size);
23678	return 2;
23679    }
23680
23681    buffer = (char *)malloc(size);
23682    if (!buffer) {
23683	perror("malloc");
23684	return 3;
23685    }
23686
23687    result = _NSGetExecutablePath(buffer, &size);
23688    if (result != 0) {
23689	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23690		result, (unsigned int) size);
23691	return 4;
23692    }
23693
23694    tidied = realpath(buffer, NULL);
23695    if (!tidied) {
23696	perror("realpath");
23697	return 5;
23698    }
23699
23700    free(buffer);
23701
23702    if (*tidied != '/') {
23703	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23704	return 6;
23705    }
23706
23707    if (strstr(tidied, "/./")) {
23708	fprintf(stderr, "Contains /./: '%s'\n", tidied);
23709	return 7;
23710    }
23711
23712    if (strstr(tidied, "/../")) {
23713	fprintf(stderr, "Contains /../: '%s'\n", tidied);
23714	return 8;
23715    }
23716
23717    tidied_leaf = strrchr(tidied, '/');
23718    if (strcmp(tidied_leaf, argv_leaf) != 0) {
23719	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23720	return 9;
23721    }
23722
23723    free(tidied);
23724
23725    return 0;
23726}
23727EOM
23728
23729val=$undef
23730set try
23731if eval $compile; then
23732	if $run ./try; then
23733		echo "You can use _NSGetExecutablePath to find the executing program." >&4
23734		val="$define"
23735	else
23736		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23737	fi
23738else
23739	echo "I'm unable to compile the test program." >&4
23740	echo "I'll assume no _NSGetExecutablePath here." >&4
23741fi
23742$rm_try
23743set usensgetexecutablepath
23744eval $setvar
23745
23746: Check if site customization support was requested
23747case "$usesitecustomize" in
23748    $define|true|[Yy]*)
23749	usesitecustomize="$define"
23750	;;
23751    *)
23752	usesitecustomize="$undef"
23753	;;
23754    esac
23755
23756: determine compiler compiler
23757case "$yacc" in
23758'')
23759	dflt=yacc;;
23760*)
23761	dflt="$yacc";;
23762esac
23763echo " "
23764comp='yacc'
23765if $test -f "$byacc$_exe"; then
23766	dflt="$byacc"
23767	comp="byacc or $comp"
23768fi
23769if $test -f "$bison$_exe"; then
23770	comp="$comp or bison -y"
23771fi
23772rp="Which compiler compiler ($comp) shall I use?"
23773. ./myread
23774yacc="$ans"
23775case "$yacc" in
23776*bis*)
23777	case "$yacc" in
23778	*-y*) ;;
23779	*)
23780		yacc="$yacc -y"
23781		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23782		;;
23783	esac
23784	;;
23785esac
23786
23787: see if this is a bfd.h system
23788set bfd.h i_bfd
23789eval $inhdr
23790
23791: see if this is an execinfo.h system
23792set execinfo.h i_execinfo
23793eval $inhdr
23794
23795: see if this is a fenv.h system
23796set fenv.h i_fenv
23797eval $inhdr
23798
23799: see if this is a fp.h system
23800set fp.h i_fp
23801eval $inhdr
23802
23803: see if this is a fp_class.h system
23804set fp_class.h i_fp_class
23805eval $inhdr
23806
23807: see if gdbm.h is available
23808set gdbm.h t_gdbm
23809eval $inhdr
23810case "$t_gdbm" in
23811$define)
23812	: see if gdbm_open exists
23813	set gdbm_open d_gdbm_open
23814	eval $inlibc
23815	case "$d_gdbm_open" in
23816	$undef)
23817		t_gdbm="$undef"
23818		echo "We won't be including <gdbm.h>"
23819		;;
23820	esac
23821	;;
23822esac
23823val="$t_gdbm"
23824set i_gdbm
23825eval $setvar
23826
23827: see if this is a ieeefp.h system
23828case "$i_ieeefp" in
23829'' ) set ieeefp.h i_ieeefp
23830     eval $inhdr
23831     ;;
23832esac
23833
23834: see if this is a libutil.h system
23835set libutil.h i_libutil
23836eval $inhdr
23837
23838: see if mach cthreads are available
23839if test "X$usethreads" = "X$define"; then
23840	set mach/cthreads.h i_machcthr
23841	eval $inhdr
23842else
23843	i_machcthr="$undef"
23844fi
23845
23846: see if this is a mntent.h system
23847set mntent.h i_mntent
23848eval $inhdr
23849
23850: see if net/errno.h is available
23851val=''
23852set net/errno.h val
23853eval $inhdr
23854
23855: Unfortunately, it causes problems on some systems.  Arrgh.
23856case "$val" in
23857$define)
23858	cat > try.c <<'EOM'
23859#include <stdio.h>
23860#include <errno.h>
23861#include <net/errno.h>
23862int func()
23863{
23864	return ENOTSOCK;
23865}
23866EOM
23867	if $cc $ccflags -c try.c >/dev/null 2>&1; then
23868		echo "We'll be including <net/errno.h>." >&4
23869	else
23870		echo "We won't be including <net/errno.h>." >&4
23871		val="$undef"
23872	fi
23873	$rm_try
23874	;;
23875esac
23876set i_neterrno
23877eval $setvar
23878
23879: see if netinet/tcp.h is available
23880set netinet/tcp.h i_netinettcp
23881eval $inhdr
23882
23883: see if this is a poll.h system
23884set poll.h i_poll
23885eval $inhdr
23886
23887: see if this is a prot.h system
23888set prot.h i_prot
23889eval $inhdr
23890
23891: Preprocessor symbols
23892echo " "
23893$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23894$cat <<'EOSH' > Cppsym.know
23895a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23896AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23897AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23898arch_pwr ardent ARM ARM32 atarist att386 att3b
23899BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23900BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23901byteorder byte_order
23902c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23903convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23904DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23905ELF encore EPI EXTENSIONS
23906FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23907GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23908GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23909H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23910hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23911hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23912i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23913iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23914INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23915ksr1
23916LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23917LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23918LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23919luna88k Lynx
23920M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23921MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23922mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23923merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23924MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23925MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23926M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23927M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23928n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23929news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23930ns32000 ns32016 ns32332 ns32k nsc32000
23931OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23932PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23933plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23934POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23935QK_USER QNX
23936R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23937S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23938SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23939sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23940stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23941SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23942SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23943SYSV4 SYSV5 sysV68 sysV88
23944Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23945TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23946tower32_800 tower32_850 tss
23947u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23948UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23949USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23950USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23951USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23952USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23953uxpm uxps
23954vax venix VMESA vms
23955x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23956XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23957z8000 zarch
23958EOSH
23959# Maybe put other stuff here too.
23960./tr '-' '_' <<EOSH >>Cppsym.know
23961$osname
23962EOSH
23963./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23964./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23965$cat Cppsym.know > Cppsym.c
23966$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23967$rm -f Cppsym.a Cppsym.b Cppsym.c
23968cat <<EOSH > Cppsym
23969$startsh
23970if $test \$# -gt 0; then
23971    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23972    if $test -s Cppsym.got; then
23973	$rm -f Cppsym.got
23974	exit 0
23975    fi
23976    $rm -f Cppsym.got
23977    exit 1
23978else
23979    $tr " " "$trnl" | ./Cppsym.try
23980    exit 0
23981fi
23982EOSH
23983chmod +x Cppsym
23984$eunicefix Cppsym
23985cat <<EOSH > Cppsym.try
23986$startsh
23987cat <<'EOCP' > try.c
23988#include <stdio.h>
23989#if cpp_stuff == 1
23990#define STRINGIFY(a)    "a"
23991#endif
23992#if cpp_stuff == 42
23993#define StGiFy(a)  #a
23994#define STRINGIFY(a)    StGiFy(a)
23995#endif
23996#if $cpp_stuff != 1 && $cpp_stuff != 42
23997#   include "Bletch: How does this C preprocessor stringify macros?"
23998#endif
23999int main() {
24000EOCP
24001$awk \\
24002EOSH
24003cat <<'EOSH' >> Cppsym.try
24004'length($1) > 0 {
24005    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
24006    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
24007    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
24008    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
24009}' >> try.c
24010echo 'return 0;}' >> try.c
24011EOSH
24012cat <<EOSH >> Cppsym.try
24013ccflags="$ccflags"
24014case "$osname-$gccversion" in
24015irix-) ccflags="\$ccflags -woff 1178" ;;
24016os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
24017esac
24018$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
24019EOSH
24020chmod +x Cppsym.try
24021$eunicefix Cppsym.try
24022./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
24023: Add in any Linux cpp "predefined macros":
24024case "$osname::$gccversion" in
24025  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
24026    tHdrH=_tmpHdr
24027    rm -f $tHdrH'.h' $tHdrH
24028    touch $tHdrH'.h'
24029    # Filter out macro arguments, such as Linux's __INT8_C(c)
24030    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
24031       sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
24032       if [ -s $tHdrH'_cppsym.real' ]; then
24033	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
24034       fi
24035    fi
24036    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
24037  ;;
24038esac
24039: now check the C compiler for additional symbols
24040postprocess_cc_v=''
24041case "$osname" in
24042aix) postprocess_cc_v="|$tr , ' '" ;;
24043esac
24044$cat >ccsym <<EOS
24045$startsh
24046$cat >tmp.c <<EOF
24047extern int foo;
24048EOF
24049for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
24050do
24051	case "\$i" in
24052	-D*) echo "\$i" | $sed 's/^-D//;s/['\''\"]//g';;
24053	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
24054	esac
24055done
24056$rm_try
24057EOS
24058postprocess_cc_v=''
24059chmod +x ccsym
24060$eunicefix ccsym
24061./ccsym > ccsym1.raw
24062if $test -s ccsym1.raw; then
24063    $sort ccsym1.raw | $uniq >ccsym.raw
24064else
24065    mv ccsym1.raw ccsym.raw
24066fi
24067
24068$awk '/=/ { print $0; next }
24069	{ print $0"=1" }' ccsym.raw >ccsym.list
24070$comm -13 Cppsym.true ccsym.list >ccsym.own
24071$comm -12 Cppsym.true ccsym.list >ccsym.com
24072$comm -23 Cppsym.true ccsym.list >ccsym.cpp
24073also=''
24074if $test -z ccsym.raw; then
24075	echo "Your C compiler doesn't seem to define any symbols!" >&4
24076	echo " "
24077	echo "However, your C preprocessor defines the following symbols:"
24078	$cat Cppsym.true
24079	ccsymbols=''
24080	cppsymbols=`$cat Cppsym.true`
24081	cppsymbols=`echo $cppsymbols`
24082	cppccsymbols="$cppsymbols"
24083else
24084	if $test -s ccsym.com; then
24085		echo "Your C compiler and pre-processor define these symbols:"
24086		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
24087		also='also '
24088		symbols='ones'
24089		cppccsymbols=`$cat ccsym.com`
24090		cppccsymbols=`echo $cppccsymbols`
24091		$test "$silent" || sleep 1
24092	fi
24093	if $test -s ccsym.cpp; then
24094		$test "$also" && echo " "
24095		echo "Your C pre-processor ${also}defines the following symbols:"
24096		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
24097		also='further '
24098		cppsymbols=`$cat ccsym.cpp`
24099		cppsymbols=`echo $cppsymbols`
24100		$test "$silent" || sleep 1
24101	fi
24102	if $test -s ccsym.own; then
24103		$test "$also" && echo " "
24104		echo "Your C compiler ${also}defines the following cpp symbols:"
24105		$sed -e 's/\(..*\)=1/\1/' ccsym.own
24106		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
24107		ccsymbols=`$cat ccsym.own`
24108		ccsymbols=`echo $ccsymbols`
24109		$test "$silent" || sleep 1
24110	fi
24111fi
24112
24113: add -D_FORTIFY_SOURCE if feasible and not already there
24114case "$gccversion" in
24115[456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
24116	*-O*)	case "$ccflags$cppsymbols" in
24117		*_FORTIFY_SOURCE=*) # Don't add it again.
24118			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
24119			;;
24120		*)	echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
24121			ccflags="$ccflags -D_FORTIFY_SOURCE=2"
24122			;;
24123		esac
24124		;;
24125	*)	echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
24126		;;
24127	esac
24128	;;
24129*)	echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
24130	;;
24131esac
24132
24133: script used to emit important warnings
24134cat >warn <<EOS
24135$startsh
24136if test \$# -gt 0; then
24137	echo "\$@" >msg
24138else
24139	cat >msg
24140fi
24141echo "*** WARNING:" >&4
24142sed -e 's/^/*** /' <msg >&4
24143echo "*** " >&4
24144cat msg >>config.msg
24145echo " " >>config.msg
24146rm -f msg
24147EOS
24148chmod +x warn
24149$eunicefix warn
24150
24151: see if this is a termio system
24152val="$undef"
24153val2="$undef"
24154val3="$undef"
24155if $test `./findhdr termios.h`; then
24156    set tcsetattr i_termios
24157    eval $inlibc
24158    val3="$i_termios"
24159fi
24160echo " "
24161case "$val3" in
24162    "$define") echo "You have POSIX termios.h... good!" >&4;;
24163    *)  if ./Cppsym pyr; then
24164	    case "`$run /bin/universe`" in
24165		ucb) if $test `./findhdr sgtty.h`; then
24166			val2="$define"
24167			echo "<sgtty.h> found." >&4
24168		    else
24169			echo "System is pyramid with BSD universe."
24170			./warn "<sgtty.h> not found--you could have problems."
24171		    fi;;
24172		*)  if $test `./findhdr termio.h`; then
24173			val="$define"
24174			echo "<termio.h> found." >&4
24175		    else
24176			echo "System is pyramid with USG universe."
24177			./warn "<termio.h> not found--you could have problems."
24178		    fi;;
24179	    esac
24180	elif ./usg; then
24181	    if $test `./findhdr termio.h`; then
24182		echo "<termio.h> found." >&4
24183		val="$define"
24184	    elif $test `./findhdr sgtty.h`; then
24185		echo "<sgtty.h> found." >&4
24186		val2="$define"
24187	    else
24188		./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
24189	    fi
24190	else
24191	    if $test `./findhdr sgtty.h`; then
24192		echo "<sgtty.h> found." >&4
24193		val2="$define"
24194	    elif $test `./findhdr termio.h`; then
24195		echo "<termio.h> found." >&4
24196		val="$define"
24197	    else
24198		./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
24199	    fi
24200	fi;;
24201esac
24202set i_termio; eval $setvar
24203val=$val2; set i_sgtty; eval $setvar
24204val=$val3; set i_termios; eval $setvar
24205
24206: see if stdbool is available
24207: we want a real compile instead of Inhdr because some Solaris systems
24208: have stdbool.h, but it can only be used if the compiler indicates it
24209: is sufficiently c99-compliant.
24210echo " "
24211$cat >try.c <<EOCP
24212#include <stdio.h>
24213#include <stdbool.h>
24214int func(bool x)
24215{
24216    return x ? 1 : 0;
24217}
24218int main(int argc, char **argv)
24219{
24220    return func(0);
24221}
24222EOCP
24223set try
24224if eval $compile; then
24225	echo "<stdbool.h> found." >&4
24226	val="$define"
24227else
24228	echo "<stdbool.h> NOT found." >&4
24229	val="$undef"
24230fi
24231$rm_try
24232set i_stdbool
24233eval $setvar
24234
24235: see if stdint is available
24236set stdint.h i_stdint
24237eval $inhdr
24238
24239: see if sys/access.h is available
24240set sys/access.h i_sysaccess
24241eval $inhdr
24242
24243: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
24244set sys/filio.h i_sysfilio
24245eval $inhdr
24246echo " "
24247if $test `./findhdr sys/ioctl.h`; then
24248	val="$define"
24249	echo '<sys/ioctl.h> found.' >&4
24250else
24251	val="$undef"
24252	if $test $i_sysfilio = "$define"; then
24253	    echo '<sys/ioctl.h> NOT found.' >&4
24254	else
24255		$test $i_sgtty = "$define" && xxx="sgtty.h"
24256		$test $i_termio = "$define" && xxx="termio.h"
24257		$test $i_termios = "$define" && xxx="termios.h"
24258echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
24259	fi
24260fi
24261set i_sysioctl
24262eval $setvar
24263
24264: see if socket ioctl defs are in sys/sockio.h
24265echo " "
24266xxx=`./findhdr sys/sockio.h`
24267if $test "$xxx"; then
24268	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
24269		val="$define"
24270		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
24271	else
24272		val="$undef"
24273		echo "No socket ioctls found in <sys/sockio.h>." >&4
24274	fi
24275else
24276	val="$undef"
24277	$cat <<EOM
24278<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
24279EOM
24280fi
24281set i_syssockio
24282eval $setvar
24283
24284: see if this is a syslog.h system
24285set syslog.h i_syslog
24286eval $inhdr
24287
24288: see if this is a sys/mode.h system
24289set sys/mode.h i_sysmode
24290eval $inhdr
24291
24292: see if there is a sys/poll.h file
24293set sys/poll.h i_syspoll
24294eval $inhdr
24295
24296: see if sys/resource.h has to be included
24297set sys/resource.h i_sysresrc
24298eval $inhdr
24299
24300: see if sys/security.h is available
24301set sys/security.h i_syssecrt
24302eval $inhdr
24303
24304: see if this is a sys/statvfs.h system
24305set sys/statvfs.h i_sysstatvfs
24306eval $inhdr
24307
24308: see if this is a sys/un.h system
24309set sys/un.h i_sysun
24310eval $inhdr
24311
24312: see if this is a sys/utsname.h system
24313set sys/utsname.h i_sysutsname
24314eval $inhdr
24315
24316: see if this is a syswait system
24317set sys/wait.h i_syswait
24318eval $inhdr
24319
24320: see if this is a ustat.h system
24321set ustat.h i_ustat
24322eval $inhdr
24323
24324: see if this is an utime system
24325set utime.h i_utime
24326eval $inhdr
24327
24328: see if this is a vfork system
24329case "$d_vfork" in
24330"$define")
24331	set vfork.h i_vfork
24332	eval $inhdr
24333	;;
24334*)
24335	i_vfork="$undef"
24336	;;
24337esac
24338
24339: see if wchar.h is present
24340set wchar.h i_wchar
24341eval $inhdr
24342
24343: Check extensions
24344echo " "
24345echo "Looking for extensions..." >&4
24346: If we are using the old config.sh, nonxs_extensions and xs_extensions may
24347: contain old or inaccurate or duplicate values.
24348nonxs_extensions=''
24349xs_extensions=''
24350: We do not use find because it might not be available.
24351: We do not just use MANIFEST because the user may have dropped
24352: some additional extensions into the source tree and expect them
24353: to be built.
24354
24355: Function to recursively find available extensions, ignoring DynaLoader
24356: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24357: In 5.10.1 and later, extensions are stored in directories
24358: like File-Glob instead of the older File/Glob/.
24359find_extensions='
24360    for xxx in *; do
24361	case "$xxx" in
24362	    CVS) ;;
24363	    DynaLoader|dynaload) ;;
24364	    *)
24365	    this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24366	    case "$this_ext" in
24367		Scalar/List/Utils) this_ext="List/Util"	;;
24368		PathTools)         this_ext="Cwd"	;;
24369	    esac;
24370	    echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24371	    if $contains " $this_ext " "$tdir/$$.tmp"; then
24372		echo >&4;
24373		echo "Duplicate directories detected for extension $xxx" >&4;
24374		echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24375		case "$knowitall" in
24376		"") dflt=y;;
24377		*) dflt=n;;
24378		esac;
24379		. ../UU/myread;
24380		case "$ans" in
24381		n*|N*) ;;
24382		*) echo >&4;
24383		    echo "Ok.  Stopping Configure." >&4;
24384		    echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24385		    exit 1;;
24386		esac;
24387		echo "Ok.  You will need to correct config.sh before running make." >&4;
24388	    fi;
24389	    $ls -1 "$xxx" > "$tdir/$$.tmp";
24390	    if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24391		xs_extensions="$xs_extensions $this_ext";
24392	    elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
24393		xs_extensions="$xs_extensions $this_ext";
24394	    elif $test -d "$xxx"; then
24395		nonxs_extensions="$nonxs_extensions $this_ext";
24396	    fi;
24397	    $rm -f "$tdir/$$.tmp";
24398	    ;;
24399	esac;
24400    done'
24401tdir=`pwd`
24402cd "$rsrc/cpan"
24403set X
24404shift
24405eval $find_extensions
24406cd "$rsrc/dist"
24407set X
24408shift
24409eval $find_extensions
24410cd "$rsrc/ext"
24411set X
24412shift
24413eval $find_extensions
24414set X $xs_extensions
24415shift
24416xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24417set X $nonxs_extensions
24418shift
24419nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24420cd "$tdir"
24421known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
24422
24423: Now see which are supported on this system.
24424avail_ext=''
24425for xxx in $xs_extensions ; do
24426	case "$xxx" in
24427	Amiga*)
24428		case "$osname" in
24429		amigaos) avail_ext="$avail_ext $xxx" ;;
24430		esac
24431		;;
24432	DB_File|db_file)
24433		case "$i_db" in
24434		$define) avail_ext="$avail_ext $xxx" ;;
24435		esac
24436		;;
24437	GDBM_File|gdbm_fil)
24438		case "$i_gdbm" in
24439		$define) avail_ext="$avail_ext $xxx" ;;
24440		esac
24441		;;
24442	IPC/SysV|ipc/sysv)
24443		: XXX Do we need a useipcsysv variable here
24444		case "${d_msg}${d_sem}${d_shm}" in
24445		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
24446		esac
24447		;;
24448	NDBM_File|ndbm_fil)
24449		case "$d_ndbm" in
24450		$define)
24451		    case "$osname-$use64bitint" in
24452		    hpux-define)
24453			case "$libs" in
24454			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
24455			esac
24456			;;
24457		    *) avail_ext="$avail_ext $xxx" ;;
24458		    esac
24459		    ;;
24460		esac
24461		;;
24462	ODBM_File|odbm_fil)
24463		case "${i_dbm}${i_rpcsvcdbm}" in
24464		*"${define}"*)
24465		    case "$d_cplusplus" in
24466		    define) ;; # delete as a function name will not work
24467		    *)  case "$osname-$use64bitint" in
24468			hpux-define)
24469			    case "$libs" in
24470			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24471			    esac
24472			    ;;
24473			*) avail_ext="$avail_ext $xxx" ;;
24474			esac
24475			;;
24476		    esac
24477		    ;;
24478		esac
24479		;;
24480	Opcode|opcode)
24481		case "$useopcode" in
24482		true|define|y) avail_ext="$avail_ext $xxx" ;;
24483		esac
24484		;;
24485	POSIX|posix)
24486		case "$useposix" in
24487		true|define|y) avail_ext="$avail_ext $xxx" ;;
24488		esac
24489		;;
24490	Socket|socket)
24491		case "$d_socket" in
24492		true|$define|y) avail_ext="$avail_ext $xxx" ;;
24493		esac
24494		;;
24495	I18N/Langinfo|langinfo)
24496		case "$uselanginfo" in
24497		true|define|y) avail_ext="$avail_ext $xxx" ;;
24498		esac
24499		;;
24500	Sys/Syslog|sys/syslog)
24501		case $osname in
24502			amigaos) ;; # not really very useful on AmigaOS
24503			*)
24504			: XXX syslog requires socket
24505			case "$d_socket" in
24506			true|$define|y) avail_ext="$avail_ext $xxx" ;;
24507			esac
24508			;;
24509		esac
24510		;;
24511	threads|threads/shared)
24512		# threads and threads::shared are special cases.
24513		# To stop people from asking "Perl 5.8.0 was supposed
24514		# to have this new fancy threads implementation but my
24515		# perl doesn't have it" and from people trying to
24516		# (re)install the threads module using CPAN.pm and
24517		# CPAN.pm then offering to reinstall Perl 5.8.0,
24518		# the threads.pm and threads/shared.pm will always be
24519		# there, croaking informatively ("you need to rebuild
24520		# all of Perl with threads, sorry") when threads haven't
24521		# been compiled in.
24522		# --jhi
24523		avail_ext="$avail_ext $xxx"
24524		;;
24525	VMS*)
24526		;;
24527	Win32*)
24528		case "$osname" in
24529		cygwin) avail_ext="$avail_ext $xxx" ;;
24530		esac
24531		;;
24532	XS/APItest|xs/apitest)
24533		# This is just for testing.  Skip it unless we have dynamic loading.
24534
24535		case "$usedl" in
24536		$define) avail_ext="$avail_ext $xxx" ;;
24537		esac
24538		;;
24539	XS/Typemap|xs/typemap)
24540		# This is just for testing.  Skip it unless we have dynamic loading.
24541		case "$usedl" in
24542		$define) avail_ext="$avail_ext $xxx" ;;
24543		esac
24544		;;
24545	*)	avail_ext="$avail_ext $xxx"
24546		;;
24547	esac
24548done
24549
24550set X $avail_ext
24551shift
24552avail_ext="$*"
24553
24554case "$onlyextensions" in
24555'') ;;
24556*)  keepextensions=''
24557    echo "You have requested that only certain extensions be included..." >&4
24558    for i in $onlyextensions; do
24559        case " $avail_ext " in
24560        *" $i "*)
24561            echo "Keeping extension $i."
24562            keepextensions="$keepextensions $i"
24563            ;;
24564        *) echo "Ignoring extension $i." ;;
24565        esac
24566    done
24567    avail_ext="$keepextensions"
24568    ;;
24569esac
24570
24571case "$noextensions" in
24572'') ;;
24573*)  keepextensions=''
24574    echo "You have requested that certain extensions be ignored..." >&4
24575    for i in $avail_ext; do
24576        case " $noextensions " in
24577        *" $i "*) echo "Ignoring extension $i." ;;
24578        *) echo "Keeping extension $i.";
24579           keepextensions="$keepextensions $i"
24580           ;;
24581        esac
24582    done
24583    avail_ext="$keepextensions"
24584    ;;
24585esac
24586
24587: Now see which nonxs extensions are supported on this system.
24588: For now assume all are.
24589nonxs_ext=''
24590for xxx in $nonxs_extensions ; do
24591	case "$xxx" in
24592	CVS|RCS|SCCS|.svn)
24593		;;
24594	VMS*)
24595		;;
24596	*)	nonxs_ext="$nonxs_ext $xxx"
24597		;;
24598	esac
24599done
24600
24601set X $nonxs_ext
24602shift
24603nonxs_ext="$*"
24604
24605case $usedl in
24606$define)
24607	$cat <<EOM
24608A number of extensions are supplied with $package.  You may choose to
24609compile these extensions for dynamic loading (the default), compile
24610them into the $package executable (static loading), or not include
24611them at all.  Answer "none" to include no extensions.
24612Note that DynaLoader is always built and need not be mentioned here.
24613
24614EOM
24615	case "$dynamic_ext" in
24616	'')
24617		: Exclude those listed in static_ext
24618		dflt=''
24619		for xxx in $avail_ext; do
24620			case " $static_ext " in
24621			*" $xxx "*) ;;
24622			*) dflt="$dflt $xxx" ;;
24623			esac
24624		done
24625		set X $dflt
24626		shift
24627		dflt="$*"
24628		;;
24629	*)	dflt="$dynamic_ext"
24630		# Perhaps we are reusing an old out-of-date config.sh.
24631		case "$hint" in
24632		previous)
24633			if test X"$dynamic_ext" != X"$avail_ext"; then
24634				$cat <<EOM
24635NOTICE:  Your previous config.sh list may be incorrect.
24636The extensions now available to you are
24637	${avail_ext}
24638but the default list from your previous config.sh is
24639	${dynamic_ext}
24640
24641EOM
24642			fi
24643			;;
24644		esac
24645		;;
24646	esac
24647	case "$dflt" in
24648	'')	dflt=none;;
24649	esac
24650	rp="What extensions do you wish to load dynamically?"
24651	. ./myread
24652	case "$ans" in
24653	none) dynamic_ext=' ' ;;
24654	*) dynamic_ext="$ans" ;;
24655	esac
24656
24657	case "$static_ext" in
24658	'')
24659		: Exclude those already listed in dynamic linking
24660		dflt=''
24661		for xxx in $avail_ext; do
24662			case " $dynamic_ext " in
24663			*" $xxx "*) ;;
24664			*) dflt="$dflt $xxx" ;;
24665			esac
24666		done
24667		set X $dflt
24668		shift
24669		dflt="$*"
24670		;;
24671	*)  dflt="$static_ext"
24672		;;
24673	esac
24674
24675	case "$dflt" in
24676	'')	dflt=none;;
24677	esac
24678	rp="What extensions do you wish to load statically?"
24679	. ./myread
24680	case "$ans" in
24681	none) static_ext=' ' ;;
24682	*) static_ext="$ans" ;;
24683	esac
24684	;;
24685*)
24686	$cat <<EOM
24687A number of extensions are supplied with $package.  Answer "none"
24688to include no extensions.
24689Note that DynaLoader is always built and need not be mentioned here.
24690
24691EOM
24692	case "$static_ext" in
24693	'') dflt="$avail_ext" ;;
24694	*)	dflt="$static_ext"
24695		# Perhaps we are reusing an old out-of-date config.sh.
24696		case "$hint" in
24697		previous)
24698			if test X"$static_ext" != X"$avail_ext"; then
24699				$cat <<EOM
24700NOTICE:  Your previous config.sh list may be incorrect.
24701The extensions now available to you are
24702	${avail_ext}
24703but the default list from your previous config.sh is
24704	${static_ext}
24705
24706EOM
24707			fi
24708			;;
24709		esac
24710		;;
24711	esac
24712	: Exclude those that are not xs extensions
24713	case "$dflt" in
24714	'')	dflt=none;;
24715	esac
24716	rp="What extensions do you wish to include?"
24717	. ./myread
24718	case "$ans" in
24719	none) static_ext=' ' ;;
24720	*) static_ext="$ans" ;;
24721	esac
24722	;;
24723esac
24724#
24725# Encode is a special case.  If we are building Encode as a static
24726# extension, we need to explicitly list its subextensions as well.
24727# For other nested extensions, this is handled automatically by
24728# the appropriate Makefile.PL.
24729case " $static_ext " in
24730	*" Encode "*) # Add the subextensions of Encode
24731	cd "$rsrc/cpan"
24732	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24733		static_ext="$static_ext Encode/$xxx"
24734		known_extensions="$known_extensions Encode/$xxx"
24735	done
24736	cd "$tdir"
24737	;;
24738esac
24739
24740set X $dynamic_ext $static_ext $nonxs_ext
24741shift
24742extensions="$*"
24743
24744# Sanity check:  We require an extension suitable for use with
24745# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24746# should show up as failures in the test suite, but it's helpful to
24747# catch them now.) The 'extensions' list is normally sorted
24748# alphabetically, so we need to accept either
24749#    DB_File ... Fcntl ... IO  ....
24750# or something like
24751#    Fcntl ... NDBM_File ... IO  ....
24752case " $extensions"  in
24753*"_File "*" Fcntl "*" IO "*) ;; # DB_File
24754*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24755*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24756*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24757   echo "WARNING: The Perl you are building will be quite crippled." >&4
24758   ;;
24759esac
24760
24761: Remove libraries needed only for extensions
24762: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24763: The exception is SunOS 4.x, which needs them.
24764case "${osname}X${osvers}" in
24765sunos*X4*)
24766    perllibs="$libs"
24767    ;;
24768*) case "$usedl" in
24769    $define|true|[yY]*)
24770	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24771	    shift
24772	    perllibs="$*"
24773	    ;;
24774    *)	perllibs="$libs"
24775	    ;;
24776    esac
24777    ;;
24778esac
24779
24780: Remove build directory name from cppstdin so it can be used from
24781: either the present location or the final installed location.
24782echo " "
24783: Get out of the UU directory to get correct path name.
24784cd ..
24785case "$cppstdin" in
24786`pwd`/cppstdin)
24787	echo "Stripping down cppstdin path name"
24788	cppstdin=cppstdin
24789	;;
24790esac
24791cd UU
24792
24793: end of configuration questions
24794echo " "
24795echo "End of configuration questions."
24796echo " "
24797
24798: back to where it started
24799if test -d ../UU; then
24800	cd ..
24801fi
24802
24803: configuration may be unconditionally patched via a 'config.arch' file
24804if $test -f config.arch; then
24805	echo "I see a config.arch file, loading it." >&4
24806	. ./config.arch
24807fi
24808
24809: configuration may be patched via a 'config.over' file
24810if $test -f config.over; then
24811	echo " "
24812	dflt=y
24813	rp='I see a config.over file.  Do you wish to load it?'
24814	. UU/myread
24815	case "$ans" in
24816	n*) echo "OK, I'll ignore it.";;
24817	*)	. ./config.over
24818		echo "Configuration override changes have been loaded."
24819		;;
24820	esac
24821fi
24822
24823: in case they want portability, strip down executable paths
24824case "$d_portable" in
24825"$define")
24826	echo " "
24827	echo "Stripping down executable paths..." >&4
24828	for file in $loclist $trylist; do
24829		eval temp=\$$file
24830		eval $file=`basename $temp`
24831	done
24832	;;
24833esac
24834
24835: create config.sh file
24836echo " "
24837echo "Creating config.sh..." >&4
24838$spitshell <<EOT >config.sh
24839$startsh
24840#
24841# This file was produced by running the Configure script. It holds all the
24842# definitions figured out by Configure. Should you modify one of these values,
24843# do not forget to propagate your changes by running "Configure -der". You may
24844# instead choose to run each of the .SH files by yourself, or "Configure -S".
24845#
24846
24847# Package name      : $package
24848# Source directory  : $src
24849# Configuration time: $cf_time
24850# Configured by     : $cf_by
24851# Target system     : $myuname
24852
24853EOT
24854: Add in command line options if available
24855$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24856
24857$spitshell <<EOT >>config.sh
24858
24859Author='$Author'
24860Date='$Date'
24861Header='$Header'
24862Id='$Id'
24863Locker='$Locker'
24864Log='$Log'
24865RCSfile='$RCSfile'
24866Revision='$Revision'
24867Source='$Source'
24868State='$State'
24869_a='$_a'
24870_exe='$_exe'
24871_o='$_o'
24872afs='$afs'
24873afsroot='$afsroot'
24874alignbytes='$alignbytes'
24875aphostname='$aphostname'
24876api_revision='$api_revision'
24877api_subversion='$api_subversion'
24878api_version='$api_version'
24879api_versionstring='$api_versionstring'
24880ar='$ar'
24881archlib='$archlib'
24882archlibexp='$archlibexp'
24883archname64='$archname64'
24884archname='$archname'
24885archobjs='$archobjs'
24886asctime_r_proto='$asctime_r_proto'
24887awk='$awk'
24888baserev='$baserev'
24889bash='$bash'
24890bin='$bin'
24891bin_ELF='$bin_ELF'
24892binexp='$binexp'
24893bison='$bison'
24894byacc='$byacc'
24895byteorder='$byteorder'
24896c='$c'
24897castflags='$castflags'
24898cat='$cat'
24899cc='$cc'
24900cccdlflags='$cccdlflags'
24901ccdlflags='$ccdlflags'
24902ccflags='$ccflags'
24903ccflags_uselargefiles='$ccflags_uselargefiles'
24904ccname='$ccname'
24905ccsymbols='$ccsymbols'
24906ccversion='$ccversion'
24907cf_by='$cf_by'
24908cf_email='$cf_email'
24909cf_time='$cf_time'
24910charbits='$charbits'
24911charsize='$charsize'
24912chgrp='$chgrp'
24913chmod='$chmod'
24914chown='$chown'
24915clocktype='$clocktype'
24916comm='$comm'
24917compiler_warning='$compiler_warning'
24918compress='$compress'
24919contains='$contains'
24920cp='$cp'
24921cpio='$cpio'
24922cpp='$cpp'
24923cpp_stuff='$cpp_stuff'
24924cppccsymbols='$cppccsymbols'
24925cppflags='$cppflags'
24926cpplast='$cpplast'
24927cppminus='$cppminus'
24928cpprun='$cpprun'
24929cppstdin='$cppstdin'
24930cppsymbols='$cppsymbols'
24931crypt_r_proto='$crypt_r_proto'
24932cryptlib='$cryptlib'
24933csh='$csh'
24934ctermid_r_proto='$ctermid_r_proto'
24935ctime_r_proto='$ctime_r_proto'
24936d_Gconvert='$d_Gconvert'
24937d_PRIEUldbl='$d_PRIEUldbl'
24938d_PRIFUldbl='$d_PRIFUldbl'
24939d_PRIGUldbl='$d_PRIGUldbl'
24940d_PRIXU64='$d_PRIXU64'
24941d_PRId64='$d_PRId64'
24942d_PRIeldbl='$d_PRIeldbl'
24943d_PRIfldbl='$d_PRIfldbl'
24944d_PRIgldbl='$d_PRIgldbl'
24945d_PRIi64='$d_PRIi64'
24946d_PRIo64='$d_PRIo64'
24947d_PRIu64='$d_PRIu64'
24948d_PRIx64='$d_PRIx64'
24949d_SCNfldbl='$d_SCNfldbl'
24950d__fwalk='$d__fwalk'
24951d_accept4='$d_accept4'
24952d_access='$d_access'
24953d_accessx='$d_accessx'
24954d_acosh='$d_acosh'
24955d_aintl='$d_aintl'
24956d_alarm='$d_alarm'
24957d_archlib='$d_archlib'
24958d_asctime64='$d_asctime64'
24959d_asctime_r='$d_asctime_r'
24960d_asinh='$d_asinh'
24961d_atanh='$d_atanh'
24962d_atolf='$d_atolf'
24963d_atoll='$d_atoll'
24964d_attribute_always_inline='$d_attribute_always_inline'
24965d_attribute_deprecated='$d_attribute_deprecated'
24966d_attribute_format='$d_attribute_format'
24967d_attribute_malloc='$d_attribute_malloc'
24968d_attribute_nonnull='$d_attribute_nonnull'
24969d_attribute_noreturn='$d_attribute_noreturn'
24970d_attribute_pure='$d_attribute_pure'
24971d_attribute_unused='$d_attribute_unused'
24972d_attribute_visibility='$d_attribute_visibility'
24973d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24974d_backtrace='$d_backtrace'
24975d_bsd='$d_bsd'
24976d_bsdgetpgrp='$d_bsdgetpgrp'
24977d_bsdsetpgrp='$d_bsdsetpgrp'
24978d_builtin_add_overflow='$d_builtin_add_overflow'
24979d_builtin_choose_expr='$d_builtin_choose_expr'
24980d_builtin_expect='$d_builtin_expect'
24981d_builtin_mul_overflow='$d_builtin_mul_overflow'
24982d_builtin_sub_overflow='$d_builtin_sub_overflow'
24983d_c99_variadic_macros='$d_c99_variadic_macros'
24984d_casti32='$d_casti32'
24985d_castneg='$d_castneg'
24986d_cbrt='$d_cbrt'
24987d_chown='$d_chown'
24988d_chroot='$d_chroot'
24989d_chsize='$d_chsize'
24990d_class='$d_class'
24991d_clearenv='$d_clearenv'
24992d_closedir='$d_closedir'
24993d_cmsghdr_s='$d_cmsghdr_s'
24994d_copysign='$d_copysign'
24995d_copysignl='$d_copysignl'
24996d_cplusplus='$d_cplusplus'
24997d_crypt='$d_crypt'
24998d_crypt_r='$d_crypt_r'
24999d_csh='$d_csh'
25000d_ctermid='$d_ctermid'
25001d_ctermid_r='$d_ctermid_r'
25002d_ctime64='$d_ctime64'
25003d_ctime_r='$d_ctime_r'
25004d_cuserid='$d_cuserid'
25005d_dbminitproto='$d_dbminitproto'
25006d_difftime64='$d_difftime64'
25007d_difftime='$d_difftime'
25008d_dir_dd_fd='$d_dir_dd_fd'
25009d_dirfd='$d_dirfd'
25010d_dirnamlen='$d_dirnamlen'
25011d_dladdr='$d_dladdr'
25012d_dlerror='$d_dlerror'
25013d_dlopen='$d_dlopen'
25014d_dlsymun='$d_dlsymun'
25015d_dosuid='$d_dosuid'
25016d_double_has_inf='$d_double_has_inf'
25017d_double_has_nan='$d_double_has_nan'
25018d_double_has_negative_zero='$d_double_has_negative_zero'
25019d_double_has_subnormals='$d_double_has_subnormals'
25020d_double_style_cray='$d_double_style_cray'
25021d_double_style_ibm='$d_double_style_ibm'
25022d_double_style_ieee='$d_double_style_ieee'
25023d_double_style_vax='$d_double_style_vax'
25024d_drand48_r='$d_drand48_r'
25025d_drand48proto='$d_drand48proto'
25026d_dup2='$d_dup2'
25027d_dup3='$d_dup3'
25028d_duplocale='$d_duplocale'
25029d_eaccess='$d_eaccess'
25030d_endgrent='$d_endgrent'
25031d_endgrent_r='$d_endgrent_r'
25032d_endhent='$d_endhent'
25033d_endhostent_r='$d_endhostent_r'
25034d_endnent='$d_endnent'
25035d_endnetent_r='$d_endnetent_r'
25036d_endpent='$d_endpent'
25037d_endprotoent_r='$d_endprotoent_r'
25038d_endpwent='$d_endpwent'
25039d_endpwent_r='$d_endpwent_r'
25040d_endsent='$d_endsent'
25041d_endservent_r='$d_endservent_r'
25042d_eofnblk='$d_eofnblk'
25043d_erf='$d_erf'
25044d_erfc='$d_erfc'
25045d_eunice='$d_eunice'
25046d_exp2='$d_exp2'
25047d_expm1='$d_expm1'
25048d_faststdio='$d_faststdio'
25049d_fchdir='$d_fchdir'
25050d_fchmod='$d_fchmod'
25051d_fchmodat='$d_fchmodat'
25052d_fchown='$d_fchown'
25053d_fcntl='$d_fcntl'
25054d_fcntl_can_lock='$d_fcntl_can_lock'
25055d_fd_macros='$d_fd_macros'
25056d_fd_set='$d_fd_set'
25057d_fdclose='$d_fdclose'
25058d_fdim='$d_fdim'
25059d_fds_bits='$d_fds_bits'
25060d_fegetround='$d_fegetround'
25061d_ffs='$d_ffs'
25062d_ffsl='$d_ffsl'
25063d_fgetpos='$d_fgetpos'
25064d_finite='$d_finite'
25065d_finitel='$d_finitel'
25066d_flexfnam='$d_flexfnam'
25067d_flock='$d_flock'
25068d_flockproto='$d_flockproto'
25069d_fma='$d_fma'
25070d_fmax='$d_fmax'
25071d_fmin='$d_fmin'
25072d_fork='$d_fork'
25073d_fp_class='$d_fp_class'
25074d_fp_classify='$d_fp_classify'
25075d_fp_classl='$d_fp_classl'
25076d_fpathconf='$d_fpathconf'
25077d_fpclass='$d_fpclass'
25078d_fpclassify='$d_fpclassify'
25079d_fpclassl='$d_fpclassl'
25080d_fpgetround='$d_fpgetround'
25081d_fpos64_t='$d_fpos64_t'
25082d_freelocale='$d_freelocale'
25083d_frexpl='$d_frexpl'
25084d_fs_data_s='$d_fs_data_s'
25085d_fseeko='$d_fseeko'
25086d_fsetpos='$d_fsetpos'
25087d_fstatfs='$d_fstatfs'
25088d_fstatvfs='$d_fstatvfs'
25089d_fsync='$d_fsync'
25090d_ftello='$d_ftello'
25091d_ftime='$d_ftime'
25092d_futimes='$d_futimes'
25093d_gai_strerror='$d_gai_strerror'
25094d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
25095d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
25096d_getaddrinfo='$d_getaddrinfo'
25097d_getcwd='$d_getcwd'
25098d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
25099d_getespwnam='$d_getespwnam'
25100d_getfsstat='$d_getfsstat'
25101d_getgrent='$d_getgrent'
25102d_getgrent_r='$d_getgrent_r'
25103d_getgrgid_r='$d_getgrgid_r'
25104d_getgrnam_r='$d_getgrnam_r'
25105d_getgrps='$d_getgrps'
25106d_gethbyaddr='$d_gethbyaddr'
25107d_gethbyname='$d_gethbyname'
25108d_gethent='$d_gethent'
25109d_gethname='$d_gethname'
25110d_gethostbyaddr_r='$d_gethostbyaddr_r'
25111d_gethostbyname_r='$d_gethostbyname_r'
25112d_gethostent_r='$d_gethostent_r'
25113d_gethostprotos='$d_gethostprotos'
25114d_getitimer='$d_getitimer'
25115d_getlogin='$d_getlogin'
25116d_getlogin_r='$d_getlogin_r'
25117d_getmnt='$d_getmnt'
25118d_getmntent='$d_getmntent'
25119d_getnameinfo='$d_getnameinfo'
25120d_getnbyaddr='$d_getnbyaddr'
25121d_getnbyname='$d_getnbyname'
25122d_getnent='$d_getnent'
25123d_getnetbyaddr_r='$d_getnetbyaddr_r'
25124d_getnetbyname_r='$d_getnetbyname_r'
25125d_getnetent_r='$d_getnetent_r'
25126d_getnetprotos='$d_getnetprotos'
25127d_getpagsz='$d_getpagsz'
25128d_getpbyname='$d_getpbyname'
25129d_getpbynumber='$d_getpbynumber'
25130d_getpent='$d_getpent'
25131d_getpgid='$d_getpgid'
25132d_getpgrp2='$d_getpgrp2'
25133d_getpgrp='$d_getpgrp'
25134d_getppid='$d_getppid'
25135d_getprior='$d_getprior'
25136d_getprotobyname_r='$d_getprotobyname_r'
25137d_getprotobynumber_r='$d_getprotobynumber_r'
25138d_getprotoent_r='$d_getprotoent_r'
25139d_getprotoprotos='$d_getprotoprotos'
25140d_getprpwnam='$d_getprpwnam'
25141d_getpwent='$d_getpwent'
25142d_getpwent_r='$d_getpwent_r'
25143d_getpwnam_r='$d_getpwnam_r'
25144d_getpwuid_r='$d_getpwuid_r'
25145d_getsbyname='$d_getsbyname'
25146d_getsbyport='$d_getsbyport'
25147d_getsent='$d_getsent'
25148d_getservbyname_r='$d_getservbyname_r'
25149d_getservbyport_r='$d_getservbyport_r'
25150d_getservent_r='$d_getservent_r'
25151d_getservprotos='$d_getservprotos'
25152d_getspnam='$d_getspnam'
25153d_getspnam_r='$d_getspnam_r'
25154d_gettimeod='$d_gettimeod'
25155d_gmtime64='$d_gmtime64'
25156d_gmtime_r='$d_gmtime_r'
25157d_gnulibc='$d_gnulibc'
25158d_grpasswd='$d_grpasswd'
25159d_has_C_UTF8='$d_has_C_UTF8'
25160d_hasmntopt='$d_hasmntopt'
25161d_htonl='$d_htonl'
25162d_hypot='$d_hypot'
25163d_ilogb='$d_ilogb'
25164d_ilogbl='$d_ilogbl'
25165d_inc_version_list='$d_inc_version_list'
25166d_inetaton='$d_inetaton'
25167d_inetntop='$d_inetntop'
25168d_inetpton='$d_inetpton'
25169d_int64_t='$d_int64_t'
25170d_ip_mreq='$d_ip_mreq'
25171d_ip_mreq_source='$d_ip_mreq_source'
25172d_ipv6_mreq='$d_ipv6_mreq'
25173d_ipv6_mreq_source='$d_ipv6_mreq_source'
25174d_isascii='$d_isascii'
25175d_isblank='$d_isblank'
25176d_isfinite='$d_isfinite'
25177d_isfinitel='$d_isfinitel'
25178d_isinf='$d_isinf'
25179d_isinfl='$d_isinfl'
25180d_isless='$d_isless'
25181d_isnan='$d_isnan'
25182d_isnanl='$d_isnanl'
25183d_isnormal='$d_isnormal'
25184d_j0='$d_j0'
25185d_j0l='$d_j0l'
25186d_killpg='$d_killpg'
25187d_lc_monetary_2008='$d_lc_monetary_2008'
25188d_lchown='$d_lchown'
25189d_ldbl_dig='$d_ldbl_dig'
25190d_ldexpl='$d_ldexpl'
25191d_lgamma='$d_lgamma'
25192d_lgamma_r='$d_lgamma_r'
25193d_libm_lib_version='$d_libm_lib_version'
25194d_libname_unique='$d_libname_unique'
25195d_link='$d_link'
25196d_linkat='$d_linkat'
25197d_llrint='$d_llrint'
25198d_llrintl='$d_llrintl'
25199d_llround='$d_llround'
25200d_llroundl='$d_llroundl'
25201d_localeconv_l='$d_localeconv_l'
25202d_localtime64='$d_localtime64'
25203d_localtime_r='$d_localtime_r'
25204d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
25205d_locconv='$d_locconv'
25206d_lockf='$d_lockf'
25207d_log1p='$d_log1p'
25208d_log2='$d_log2'
25209d_logb='$d_logb'
25210d_long_double_style_ieee='$d_long_double_style_ieee'
25211d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
25212d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
25213d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
25214d_long_double_style_vax='$d_long_double_style_vax'
25215d_longdbl='$d_longdbl'
25216d_longlong='$d_longlong'
25217d_lrint='$d_lrint'
25218d_lrintl='$d_lrintl'
25219d_lround='$d_lround'
25220d_lroundl='$d_lroundl'
25221d_lseekproto='$d_lseekproto'
25222d_lstat='$d_lstat'
25223d_madvise='$d_madvise'
25224d_malloc_good_size='$d_malloc_good_size'
25225d_malloc_size='$d_malloc_size'
25226d_malloc_usable_size='$d_malloc_usable_size'
25227d_mblen='$d_mblen'
25228d_mbrlen='$d_mbrlen'
25229d_mbrtowc='$d_mbrtowc'
25230d_mbstowcs='$d_mbstowcs'
25231d_mbtowc='$d_mbtowc'
25232d_memmem='$d_memmem'
25233d_memrchr='$d_memrchr'
25234d_mkdir='$d_mkdir'
25235d_mkdtemp='$d_mkdtemp'
25236d_mkfifo='$d_mkfifo'
25237d_mkostemp='$d_mkostemp'
25238d_mkstemp='$d_mkstemp'
25239d_mkstemps='$d_mkstemps'
25240d_mktime64='$d_mktime64'
25241d_mktime='$d_mktime'
25242d_mmap='$d_mmap'
25243d_modfl='$d_modfl'
25244d_modflproto='$d_modflproto'
25245d_mprotect='$d_mprotect'
25246d_msg='$d_msg'
25247d_msg_ctrunc='$d_msg_ctrunc'
25248d_msg_dontroute='$d_msg_dontroute'
25249d_msg_oob='$d_msg_oob'
25250d_msg_peek='$d_msg_peek'
25251d_msg_proxy='$d_msg_proxy'
25252d_msgctl='$d_msgctl'
25253d_msgget='$d_msgget'
25254d_msghdr_s='$d_msghdr_s'
25255d_msgrcv='$d_msgrcv'
25256d_msgsnd='$d_msgsnd'
25257d_msync='$d_msync'
25258d_munmap='$d_munmap'
25259d_mymalloc='$d_mymalloc'
25260d_nan='$d_nan'
25261d_nanosleep='$d_nanosleep'
25262d_ndbm='$d_ndbm'
25263d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
25264d_nearbyint='$d_nearbyint'
25265d_newlocale='$d_newlocale'
25266d_nextafter='$d_nextafter'
25267d_nexttoward='$d_nexttoward'
25268d_nice='$d_nice'
25269d_nl_langinfo='$d_nl_langinfo'
25270d_nl_langinfo_l='$d_nl_langinfo_l'
25271d_non_int_bitfields='$d_non_int_bitfields'
25272d_nv_preserves_uv='$d_nv_preserves_uv'
25273d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
25274d_off64_t='$d_off64_t'
25275d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
25276d_oldpthreads='$d_oldpthreads'
25277d_oldsock='$d_oldsock'
25278d_open3='$d_open3'
25279d_openat='$d_openat'
25280d_pathconf='$d_pathconf'
25281d_pause='$d_pause'
25282d_perl_lc_all_category_positions_init='$d_perl_lc_all_category_positions_init'
25283d_perl_lc_all_separator='$d_perl_lc_all_separator'
25284d_perl_lc_all_uses_name_value_pairs='$d_perl_lc_all_uses_name_value_pairs'
25285d_perl_otherlibdirs='$d_perl_otherlibdirs'
25286d_phostname='$d_phostname'
25287d_pipe2='$d_pipe2'
25288d_pipe='$d_pipe'
25289d_poll='$d_poll'
25290d_portable='$d_portable'
25291d_prctl='$d_prctl'
25292d_prctl_set_name='$d_prctl_set_name'
25293d_printf_format_null='$d_printf_format_null'
25294d_procselfexe='$d_procselfexe'
25295d_pseudofork='$d_pseudofork'
25296d_pthread_atfork='$d_pthread_atfork'
25297d_pthread_attr_setscope='$d_pthread_attr_setscope'
25298d_pthread_yield='$d_pthread_yield'
25299d_ptrdiff_t='$d_ptrdiff_t'
25300d_pwage='$d_pwage'
25301d_pwchange='$d_pwchange'
25302d_pwclass='$d_pwclass'
25303d_pwcomment='$d_pwcomment'
25304d_pwexpire='$d_pwexpire'
25305d_pwgecos='$d_pwgecos'
25306d_pwpasswd='$d_pwpasswd'
25307d_pwquota='$d_pwquota'
25308d_qgcvt='$d_qgcvt'
25309d_quad='$d_quad'
25310d_querylocale='$d_querylocale'
25311d_random_r='$d_random_r'
25312d_re_comp='$d_re_comp'
25313d_readdir64_r='$d_readdir64_r'
25314d_readdir='$d_readdir'
25315d_readdir_r='$d_readdir_r'
25316d_readlink='$d_readlink'
25317d_readv='$d_readv'
25318d_recvmsg='$d_recvmsg'
25319d_regcmp='$d_regcmp'
25320d_regcomp='$d_regcomp'
25321d_remainder='$d_remainder'
25322d_remquo='$d_remquo'
25323d_rename='$d_rename'
25324d_renameat='$d_renameat'
25325d_rewinddir='$d_rewinddir'
25326d_rint='$d_rint'
25327d_rmdir='$d_rmdir'
25328d_round='$d_round'
25329d_sbrkproto='$d_sbrkproto'
25330d_scalbn='$d_scalbn'
25331d_scalbnl='$d_scalbnl'
25332d_sched_yield='$d_sched_yield'
25333d_scm_rights='$d_scm_rights'
25334d_seekdir='$d_seekdir'
25335d_select='$d_select'
25336d_sem='$d_sem'
25337d_semctl='$d_semctl'
25338d_semctl_semid_ds='$d_semctl_semid_ds'
25339d_semctl_semun='$d_semctl_semun'
25340d_semget='$d_semget'
25341d_semop='$d_semop'
25342d_sendmsg='$d_sendmsg'
25343d_setegid='$d_setegid'
25344d_setenv='$d_setenv'
25345d_seteuid='$d_seteuid'
25346d_setgrent='$d_setgrent'
25347d_setgrent_r='$d_setgrent_r'
25348d_setgrps='$d_setgrps'
25349d_sethent='$d_sethent'
25350d_sethostent_r='$d_sethostent_r'
25351d_setitimer='$d_setitimer'
25352d_setlinebuf='$d_setlinebuf'
25353d_setlocale='$d_setlocale'
25354d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25355d_setlocale_r='$d_setlocale_r'
25356d_setnent='$d_setnent'
25357d_setnetent_r='$d_setnetent_r'
25358d_setpent='$d_setpent'
25359d_setpgid='$d_setpgid'
25360d_setpgrp2='$d_setpgrp2'
25361d_setpgrp='$d_setpgrp'
25362d_setprior='$d_setprior'
25363d_setproctitle='$d_setproctitle'
25364d_setprotoent_r='$d_setprotoent_r'
25365d_setpwent='$d_setpwent'
25366d_setpwent_r='$d_setpwent_r'
25367d_setregid='$d_setregid'
25368d_setresgid='$d_setresgid'
25369d_setresuid='$d_setresuid'
25370d_setreuid='$d_setreuid'
25371d_setrgid='$d_setrgid'
25372d_setruid='$d_setruid'
25373d_setsent='$d_setsent'
25374d_setservent_r='$d_setservent_r'
25375d_setsid='$d_setsid'
25376d_setvbuf='$d_setvbuf'
25377d_shm='$d_shm'
25378d_shmat='$d_shmat'
25379d_shmatprototype='$d_shmatprototype'
25380d_shmctl='$d_shmctl'
25381d_shmdt='$d_shmdt'
25382d_shmget='$d_shmget'
25383d_sigaction='$d_sigaction'
25384d_siginfo_si_addr='$d_siginfo_si_addr'
25385d_siginfo_si_band='$d_siginfo_si_band'
25386d_siginfo_si_errno='$d_siginfo_si_errno'
25387d_siginfo_si_fd='$d_siginfo_si_fd'
25388d_siginfo_si_pid='$d_siginfo_si_pid'
25389d_siginfo_si_status='$d_siginfo_si_status'
25390d_siginfo_si_uid='$d_siginfo_si_uid'
25391d_siginfo_si_value='$d_siginfo_si_value'
25392d_signbit='$d_signbit'
25393d_sigprocmask='$d_sigprocmask'
25394d_sigsetjmp='$d_sigsetjmp'
25395d_sin6_scope_id='$d_sin6_scope_id'
25396d_sitearch='$d_sitearch'
25397d_snprintf='$d_snprintf'
25398d_sockaddr_in6='$d_sockaddr_in6'
25399d_sockaddr_sa_len='$d_sockaddr_sa_len'
25400d_sockaddr_storage='$d_sockaddr_storage'
25401d_sockatmark='$d_sockatmark'
25402d_sockatmarkproto='$d_sockatmarkproto'
25403d_socket='$d_socket'
25404d_socklen_t='$d_socklen_t'
25405d_sockpair='$d_sockpair'
25406d_socks5_init='$d_socks5_init'
25407d_sqrtl='$d_sqrtl'
25408d_srand48_r='$d_srand48_r'
25409d_srandom_r='$d_srandom_r'
25410d_sresgproto='$d_sresgproto'
25411d_sresuproto='$d_sresuproto'
25412d_stat='$d_stat'
25413d_statblks='$d_statblks'
25414d_statfs_f_flags='$d_statfs_f_flags'
25415d_statfs_s='$d_statfs_s'
25416d_static_inline='$d_static_inline'
25417d_statvfs='$d_statvfs'
25418d_stdio_cnt_lval='$d_stdio_cnt_lval'
25419d_stdio_ptr_lval='$d_stdio_ptr_lval'
25420d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25421d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25422d_stdio_stream_array='$d_stdio_stream_array'
25423d_stdiobase='$d_stdiobase'
25424d_stdstdio='$d_stdstdio'
25425d_strcoll='$d_strcoll'
25426d_strerror_l='$d_strerror_l'
25427d_strerror_r='$d_strerror_r'
25428d_strftime='$d_strftime'
25429d_strlcat='$d_strlcat'
25430d_strlcpy='$d_strlcpy'
25431d_strnlen='$d_strnlen'
25432d_strtod='$d_strtod'
25433d_strtod_l='$d_strtod_l'
25434d_strtol='$d_strtol'
25435d_strtold='$d_strtold'
25436d_strtold_l='$d_strtold_l'
25437d_strtoll='$d_strtoll'
25438d_strtoq='$d_strtoq'
25439d_strtoul='$d_strtoul'
25440d_strtoull='$d_strtoull'
25441d_strtouq='$d_strtouq'
25442d_strxfrm='$d_strxfrm'
25443d_strxfrm_l='$d_strxfrm_l'
25444d_suidsafe='$d_suidsafe'
25445d_symlink='$d_symlink'
25446d_syscall='$d_syscall'
25447d_syscallproto='$d_syscallproto'
25448d_sysconf='$d_sysconf'
25449d_sysernlst='$d_sysernlst'
25450d_syserrlst='$d_syserrlst'
25451d_system='$d_system'
25452d_tcgetpgrp='$d_tcgetpgrp'
25453d_tcsetpgrp='$d_tcsetpgrp'
25454d_telldir='$d_telldir'
25455d_telldirproto='$d_telldirproto'
25456d_tgamma='$d_tgamma'
25457d_thread_local='$d_thread_local'
25458d_time='$d_time'
25459d_timegm='$d_timegm'
25460d_times='$d_times'
25461d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25462d_tm_tm_zone='$d_tm_tm_zone'
25463d_tmpnam_r='$d_tmpnam_r'
25464d_towlower='$d_towlower'
25465d_towupper='$d_towupper'
25466d_trunc='$d_trunc'
25467d_truncate='$d_truncate'
25468d_truncl='$d_truncl'
25469d_ttyname_r='$d_ttyname_r'
25470d_tzname='$d_tzname'
25471d_u32align='$d_u32align'
25472d_ualarm='$d_ualarm'
25473d_umask='$d_umask'
25474d_uname='$d_uname'
25475d_union_semun='$d_union_semun'
25476d_unlinkat='$d_unlinkat'
25477d_unordered='$d_unordered'
25478d_unsetenv='$d_unsetenv'
25479d_uselocale='$d_uselocale'
25480d_usleep='$d_usleep'
25481d_usleepproto='$d_usleepproto'
25482d_ustat='$d_ustat'
25483d_vendorarch='$d_vendorarch'
25484d_vendorbin='$d_vendorbin'
25485d_vendorlib='$d_vendorlib'
25486d_vendorscript='$d_vendorscript'
25487d_vfork='$d_vfork'
25488d_void_closedir='$d_void_closedir'
25489d_voidsig='$d_voidsig'
25490d_voidtty='$d_voidtty'
25491d_vsnprintf='$d_vsnprintf'
25492d_wait4='$d_wait4'
25493d_waitpid='$d_waitpid'
25494d_wcrtomb='$d_wcrtomb'
25495d_wcscmp='$d_wcscmp'
25496d_wcstombs='$d_wcstombs'
25497d_wcsxfrm='$d_wcsxfrm'
25498d_wctomb='$d_wctomb'
25499d_writev='$d_writev'
25500d_xenix='$d_xenix'
25501date='$date'
25502db_hashtype='$db_hashtype'
25503db_prefixtype='$db_prefixtype'
25504db_version_major='$db_version_major'
25505db_version_minor='$db_version_minor'
25506db_version_patch='$db_version_patch'
25507default_inc_excludes_dot='$default_inc_excludes_dot'
25508direntrytype='$direntrytype'
25509dlext='$dlext'
25510dlsrc='$dlsrc'
25511doubleinfbytes='$doubleinfbytes'
25512doublekind='$doublekind'
25513doublemantbits='$doublemantbits'
25514doublenanbytes='$doublenanbytes'
25515doublesize='$doublesize'
25516drand01='$drand01'
25517drand48_r_proto='$drand48_r_proto'
25518dtrace='$dtrace'
25519dtraceobject='$dtraceobject'
25520dtracexnolibs='$dtracexnolibs'
25521dynamic_ext='$dynamic_ext'
25522eagain='$eagain'
25523ebcdic='$ebcdic'
25524echo='$echo'
25525egrep='$egrep'
25526emacs='$emacs'
25527endgrent_r_proto='$endgrent_r_proto'
25528endhostent_r_proto='$endhostent_r_proto'
25529endnetent_r_proto='$endnetent_r_proto'
25530endprotoent_r_proto='$endprotoent_r_proto'
25531endpwent_r_proto='$endpwent_r_proto'
25532endservent_r_proto='$endservent_r_proto'
25533eunicefix='$eunicefix'
25534exe_ext='$exe_ext'
25535expr='$expr'
25536extensions='$extensions'
25537extern_C='$extern_C'
25538extras='$extras'
25539fflushNULL='$fflushNULL'
25540fflushall='$fflushall'
25541find='$find'
25542firstmakefile='$firstmakefile'
25543flex='$flex'
25544fpossize='$fpossize'
25545fpostype='$fpostype'
25546freetype='$freetype'
25547from='$from'
25548full_ar='$full_ar'
25549full_csh='$full_csh'
25550full_sed='$full_sed'
25551gccansipedantic='$gccansipedantic'
25552gccosandvers='$gccosandvers'
25553gccversion='$gccversion'
25554getgrent_r_proto='$getgrent_r_proto'
25555getgrgid_r_proto='$getgrgid_r_proto'
25556getgrnam_r_proto='$getgrnam_r_proto'
25557gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25558gethostbyname_r_proto='$gethostbyname_r_proto'
25559gethostent_r_proto='$gethostent_r_proto'
25560getlogin_r_proto='$getlogin_r_proto'
25561getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25562getnetbyname_r_proto='$getnetbyname_r_proto'
25563getnetent_r_proto='$getnetent_r_proto'
25564getprotobyname_r_proto='$getprotobyname_r_proto'
25565getprotobynumber_r_proto='$getprotobynumber_r_proto'
25566getprotoent_r_proto='$getprotoent_r_proto'
25567getpwent_r_proto='$getpwent_r_proto'
25568getpwnam_r_proto='$getpwnam_r_proto'
25569getpwuid_r_proto='$getpwuid_r_proto'
25570getservbyname_r_proto='$getservbyname_r_proto'
25571getservbyport_r_proto='$getservbyport_r_proto'
25572getservent_r_proto='$getservent_r_proto'
25573getspnam_r_proto='$getspnam_r_proto'
25574gidformat='$gidformat'
25575gidsign='$gidsign'
25576gidsize='$gidsize'
25577gidtype='$gidtype'
25578glibpth='$glibpth'
25579gmake='$gmake'
25580gmtime_r_proto='$gmtime_r_proto'
25581gnulibc_version='$gnulibc_version'
25582grep='$grep'
25583groupcat='$groupcat'
25584groupstype='$groupstype'
25585gzip='$gzip'
25586h_fcntl='$h_fcntl'
25587h_sysfile='$h_sysfile'
25588hint='$hint'
25589hostcat='$hostcat'
25590hostgenerate='$hostgenerate'
25591hostosname='$hostosname'
25592hostperl='$hostperl'
25593html1dir='$html1dir'
25594html1direxp='$html1direxp'
25595html3dir='$html3dir'
25596html3direxp='$html3direxp'
25597i16size='$i16size'
25598i16type='$i16type'
25599i32dformat='$i32dformat'
25600i32size='$i32size'
25601i32type='$i32type'
25602i64size='$i64size'
25603i64type='$i64type'
25604i8size='$i8size'
25605i8type='$i8type'
25606i_arpainet='$i_arpainet'
25607i_bfd='$i_bfd'
25608i_bsdioctl='$i_bsdioctl'
25609i_crypt='$i_crypt'
25610i_db='$i_db'
25611i_dbm='$i_dbm'
25612i_dirent='$i_dirent'
25613i_dlfcn='$i_dlfcn'
25614i_execinfo='$i_execinfo'
25615i_fcntl='$i_fcntl'
25616i_fenv='$i_fenv'
25617i_fp='$i_fp'
25618i_fp_class='$i_fp_class'
25619i_gdbm='$i_gdbm'
25620i_gdbm_ndbm='$i_gdbm_ndbm'
25621i_gdbmndbm='$i_gdbmndbm'
25622i_grp='$i_grp'
25623i_ieeefp='$i_ieeefp'
25624i_inttypes='$i_inttypes'
25625i_langinfo='$i_langinfo'
25626i_libutil='$i_libutil'
25627i_locale='$i_locale'
25628i_machcthr='$i_machcthr'
25629i_malloc='$i_malloc'
25630i_mallocmalloc='$i_mallocmalloc'
25631i_mntent='$i_mntent'
25632i_ndbm='$i_ndbm'
25633i_netdb='$i_netdb'
25634i_neterrno='$i_neterrno'
25635i_netinettcp='$i_netinettcp'
25636i_niin='$i_niin'
25637i_poll='$i_poll'
25638i_prot='$i_prot'
25639i_pthread='$i_pthread'
25640i_pwd='$i_pwd'
25641i_quadmath='$i_quadmath'
25642i_rpcsvcdbm='$i_rpcsvcdbm'
25643i_sgtty='$i_sgtty'
25644i_shadow='$i_shadow'
25645i_socks='$i_socks'
25646i_stdbool='$i_stdbool'
25647i_stdint='$i_stdint'
25648i_stdlib='$i_stdlib'
25649i_sunmath='$i_sunmath'
25650i_sysaccess='$i_sysaccess'
25651i_sysdir='$i_sysdir'
25652i_sysfile='$i_sysfile'
25653i_sysfilio='$i_sysfilio'
25654i_sysin='$i_sysin'
25655i_sysioctl='$i_sysioctl'
25656i_syslog='$i_syslog'
25657i_sysmman='$i_sysmman'
25658i_sysmode='$i_sysmode'
25659i_sysmount='$i_sysmount'
25660i_sysndir='$i_sysndir'
25661i_sysparam='$i_sysparam'
25662i_syspoll='$i_syspoll'
25663i_sysresrc='$i_sysresrc'
25664i_syssecrt='$i_syssecrt'
25665i_sysselct='$i_sysselct'
25666i_syssockio='$i_syssockio'
25667i_sysstat='$i_sysstat'
25668i_sysstatfs='$i_sysstatfs'
25669i_sysstatvfs='$i_sysstatvfs'
25670i_syssyscall='$i_syssyscall'
25671i_systime='$i_systime'
25672i_systimek='$i_systimek'
25673i_systimes='$i_systimes'
25674i_systypes='$i_systypes'
25675i_sysuio='$i_sysuio'
25676i_sysun='$i_sysun'
25677i_sysutsname='$i_sysutsname'
25678i_sysvfs='$i_sysvfs'
25679i_syswait='$i_syswait'
25680i_termio='$i_termio'
25681i_termios='$i_termios'
25682i_time='$i_time'
25683i_unistd='$i_unistd'
25684i_ustat='$i_ustat'
25685i_utime='$i_utime'
25686i_vfork='$i_vfork'
25687i_wchar='$i_wchar'
25688i_wctype='$i_wctype'
25689i_xlocale='$i_xlocale'
25690ignore_versioned_solibs='$ignore_versioned_solibs'
25691inc_version_list='$inc_version_list'
25692inc_version_list_init='$inc_version_list_init'
25693incpath='$incpath'
25694incpth='$incpth'
25695inews='$inews'
25696initialinstalllocation='$initialinstalllocation'
25697installarchlib='$installarchlib'
25698installbin='$installbin'
25699installhtml1dir='$installhtml1dir'
25700installhtml3dir='$installhtml3dir'
25701installman1dir='$installman1dir'
25702installman3dir='$installman3dir'
25703installprefix='$installprefix'
25704installprefixexp='$installprefixexp'
25705installprivlib='$installprivlib'
25706installscript='$installscript'
25707installsitearch='$installsitearch'
25708installsitebin='$installsitebin'
25709installsitehtml1dir='$installsitehtml1dir'
25710installsitehtml3dir='$installsitehtml3dir'
25711installsitelib='$installsitelib'
25712installsiteman1dir='$installsiteman1dir'
25713installsiteman3dir='$installsiteman3dir'
25714installsitescript='$installsitescript'
25715installstyle='$installstyle'
25716installusrbinperl='$installusrbinperl'
25717installvendorarch='$installvendorarch'
25718installvendorbin='$installvendorbin'
25719installvendorhtml1dir='$installvendorhtml1dir'
25720installvendorhtml3dir='$installvendorhtml3dir'
25721installvendorlib='$installvendorlib'
25722installvendorman1dir='$installvendorman1dir'
25723installvendorman3dir='$installvendorman3dir'
25724installvendorscript='$installvendorscript'
25725intsize='$intsize'
25726issymlink='$issymlink'
25727ivdformat='$ivdformat'
25728ivsize='$ivsize'
25729ivtype='$ivtype'
25730known_extensions='$known_extensions'
25731ksh='$ksh'
25732ld='$ld'
25733ld_can_script='$ld_can_script'
25734lddlflags='$lddlflags'
25735ldflags='$ldflags'
25736ldflags_uselargefiles='$ldflags_uselargefiles'
25737ldlibpthname='$ldlibpthname'
25738less='$less'
25739lib_ext='$lib_ext'
25740libc='$libc'
25741libperl='$libperl'
25742libpth='$libpth'
25743libs='$libs'
25744libsdirs='$libsdirs'
25745libsfiles='$libsfiles'
25746libsfound='$libsfound'
25747libspath='$libspath'
25748libswanted='$libswanted'
25749libswanted_uselargefiles='$libswanted_uselargefiles'
25750line='$line'
25751lint='$lint'
25752lkflags='$lkflags'
25753ln='$ln'
25754lns='$lns'
25755localtime_r_proto='$localtime_r_proto'
25756locincpth='$locincpth'
25757loclibpth='$loclibpth'
25758longdblinfbytes='$longdblinfbytes'
25759longdblkind='$longdblkind'
25760longdblmantbits='$longdblmantbits'
25761longdblnanbytes='$longdblnanbytes'
25762longdblsize='$longdblsize'
25763longlongsize='$longlongsize'
25764longsize='$longsize'
25765lp='$lp'
25766lpr='$lpr'
25767ls='$ls'
25768lseeksize='$lseeksize'
25769lseektype='$lseektype'
25770mail='$mail'
25771mailx='$mailx'
25772make='$make'
25773make_set_make='$make_set_make'
25774mallocobj='$mallocobj'
25775mallocsrc='$mallocsrc'
25776malloctype='$malloctype'
25777man1dir='$man1dir'
25778man1direxp='$man1direxp'
25779man1ext='$man1ext'
25780man3dir='$man3dir'
25781man3direxp='$man3direxp'
25782man3ext='$man3ext'
25783mips_type='$mips_type'
25784mistrustnm='$mistrustnm'
25785mkdir='$mkdir'
25786mmaptype='$mmaptype'
25787modetype='$modetype'
25788more='$more'
25789multiarch='$multiarch'
25790mv='$mv'
25791myarchname='$myarchname'
25792mydomain='$mydomain'
25793myhostname='$myhostname'
25794myuname='$myuname'
25795n='$n'
25796need_va_copy='$need_va_copy'
25797netdb_hlen_type='$netdb_hlen_type'
25798netdb_host_type='$netdb_host_type'
25799netdb_name_type='$netdb_name_type'
25800netdb_net_type='$netdb_net_type'
25801nm='$nm'
25802nm_opt='$nm_opt'
25803nm_so_opt='$nm_so_opt'
25804nonxs_ext='$nonxs_ext'
25805nroff='$nroff'
25806nvEUformat='$nvEUformat'
25807nvFUformat='$nvFUformat'
25808nvGUformat='$nvGUformat'
25809nv_overflows_integers_at='$nv_overflows_integers_at'
25810nv_preserves_uv_bits='$nv_preserves_uv_bits'
25811nveformat='$nveformat'
25812nvfformat='$nvfformat'
25813nvgformat='$nvgformat'
25814nvmantbits='$nvmantbits'
25815nvsize='$nvsize'
25816nvtype='$nvtype'
25817o_nonblock='$o_nonblock'
25818obj_ext='$obj_ext'
25819old_pthread_create_joinable='$old_pthread_create_joinable'
25820optimize='$optimize'
25821orderlib='$orderlib'
25822osname='$osname'
25823osvers='$osvers'
25824otherlibdirs='$otherlibdirs'
25825package='$package'
25826pager='$pager'
25827passcat='$passcat'
25828patchlevel='$patchlevel'
25829path_sep='$path_sep'
25830perl5='$perl5'
25831perl='$perl'
25832perl_lc_all_category_positions_init='$perl_lc_all_category_positions_init'
25833perl_lc_all_separator='$perl_lc_all_separator'
25834perl_patchlevel='$perl_patchlevel'
25835perl_static_inline='$perl_static_inline'
25836perl_thread_local='$perl_thread_local'
25837perladmin='$perladmin'
25838perllibs='$perllibs'
25839perlpath='$perlpath'
25840pg='$pg'
25841phostname='$phostname'
25842pidtype='$pidtype'
25843plibpth='$plibpth'
25844pmake='$pmake'
25845pr='$pr'
25846prefix='$prefix'
25847prefixexp='$prefixexp'
25848privlib='$privlib'
25849privlibexp='$privlibexp'
25850procselfexe='$procselfexe'
25851ptrsize='$ptrsize'
25852quadkind='$quadkind'
25853quadtype='$quadtype'
25854randbits='$randbits'
25855randfunc='$randfunc'
25856random_r_proto='$random_r_proto'
25857randseedtype='$randseedtype'
25858ranlib='$ranlib'
25859rd_nodata='$rd_nodata'
25860readdir64_r_proto='$readdir64_r_proto'
25861readdir_r_proto='$readdir_r_proto'
25862revision='$revision'
25863rm='$rm'
25864rm_try='$rm_try'
25865rmail='$rmail'
25866run='$run'
25867runnm='$runnm'
25868sGMTIME_max='$sGMTIME_max'
25869sGMTIME_min='$sGMTIME_min'
25870sLOCALTIME_max='$sLOCALTIME_max'
25871sLOCALTIME_min='$sLOCALTIME_min'
25872sPRIEUldbl='$sPRIEUldbl'
25873sPRIFUldbl='$sPRIFUldbl'
25874sPRIGUldbl='$sPRIGUldbl'
25875sPRIXU64='$sPRIXU64'
25876sPRId64='$sPRId64'
25877sPRIeldbl='$sPRIeldbl'
25878sPRIfldbl='$sPRIfldbl'
25879sPRIgldbl='$sPRIgldbl'
25880sPRIi64='$sPRIi64'
25881sPRIo64='$sPRIo64'
25882sPRIu64='$sPRIu64'
25883sPRIx64='$sPRIx64'
25884sSCNfldbl='$sSCNfldbl'
25885sched_yield='$sched_yield'
25886scriptdir='$scriptdir'
25887scriptdirexp='$scriptdirexp'
25888sed='$sed'
25889seedfunc='$seedfunc'
25890selectminbits='$selectminbits'
25891selecttype='$selecttype'
25892sendmail='$sendmail'
25893setgrent_r_proto='$setgrent_r_proto'
25894sethostent_r_proto='$sethostent_r_proto'
25895setlocale_r_proto='$setlocale_r_proto'
25896setnetent_r_proto='$setnetent_r_proto'
25897setprotoent_r_proto='$setprotoent_r_proto'
25898setpwent_r_proto='$setpwent_r_proto'
25899setservent_r_proto='$setservent_r_proto'
25900sh='$sh'
25901shar='$shar'
25902sharpbang='$sharpbang'
25903shmattype='$shmattype'
25904shortsize='$shortsize'
25905shrpenv='$shrpenv'
25906shsharp='$shsharp'
25907sig_count='$sig_count'
25908sig_name='$sig_name'
25909sig_name_init='$sig_name_init'
25910sig_num='$sig_num'
25911sig_num_init='$sig_num_init'
25912sig_size='$sig_size'
25913signal_t='$signal_t'
25914sitearch='$sitearch'
25915sitearchexp='$sitearchexp'
25916sitebin='$sitebin'
25917sitebinexp='$sitebinexp'
25918sitehtml1dir='$sitehtml1dir'
25919sitehtml1direxp='$sitehtml1direxp'
25920sitehtml3dir='$sitehtml3dir'
25921sitehtml3direxp='$sitehtml3direxp'
25922sitelib='$sitelib'
25923sitelib_stem='$sitelib_stem'
25924sitelibexp='$sitelibexp'
25925siteman1dir='$siteman1dir'
25926siteman1direxp='$siteman1direxp'
25927siteman3dir='$siteman3dir'
25928siteman3direxp='$siteman3direxp'
25929siteprefix='$siteprefix'
25930siteprefixexp='$siteprefixexp'
25931sitescript='$sitescript'
25932sitescriptexp='$sitescriptexp'
25933sizesize='$sizesize'
25934sizetype='$sizetype'
25935sleep='$sleep'
25936smail='$smail'
25937so='$so'
25938sockethdr='$sockethdr'
25939socketlib='$socketlib'
25940socksizetype='$socksizetype'
25941sort='$sort'
25942spackage='$spackage'
25943spitshell='$spitshell'
25944srand48_r_proto='$srand48_r_proto'
25945srandom_r_proto='$srandom_r_proto'
25946src='$src'
25947ssizetype='$ssizetype'
25948st_dev_sign='$st_dev_sign'
25949st_dev_size='$st_dev_size'
25950st_ino_sign='$st_ino_sign'
25951st_ino_size='$st_ino_size'
25952startperl='$startperl'
25953startsh='$startsh'
25954static_ext='$static_ext'
25955stdchar='$stdchar'
25956stdio_base='$stdio_base'
25957stdio_bufsiz='$stdio_bufsiz'
25958stdio_cnt='$stdio_cnt'
25959stdio_filbuf='$stdio_filbuf'
25960stdio_ptr='$stdio_ptr'
25961stdio_stream_array='$stdio_stream_array'
25962strerror_r_proto='$strerror_r_proto'
25963submit='$submit'
25964subversion='$subversion'
25965sysman='$sysman'
25966sysroot='$sysroot'
25967tail='$tail'
25968tar='$tar'
25969targetarch='$targetarch'
25970targetdir='$targetdir'
25971targetenv='$targetenv'
25972targethost='$targethost'
25973targetmkdir='$targetmkdir'
25974targetport='$targetport'
25975targetsh='$targetsh'
25976tbl='$tbl'
25977tee='$tee'
25978test='$test'
25979timeincl='$timeincl'
25980timetype='$timetype'
25981tmpnam_r_proto='$tmpnam_r_proto'
25982to='$to'
25983touch='$touch'
25984tr='$tr'
25985trnl='$trnl'
25986troff='$troff'
25987ttyname_r_proto='$ttyname_r_proto'
25988u16size='$u16size'
25989u16type='$u16type'
25990u32XUformat='$u32XUformat'
25991u32oformat='$u32oformat'
25992u32size='$u32size'
25993u32type='$u32type'
25994u32uformat='$u32uformat'
25995u32xformat='$u32xformat'
25996u64size='$u64size'
25997u64type='$u64type'
25998u8size='$u8size'
25999u8type='$u8type'
26000uidformat='$uidformat'
26001uidsign='$uidsign'
26002uidsize='$uidsize'
26003uidtype='$uidtype'
26004uname='$uname'
26005uniq='$uniq'
26006uquadtype='$uquadtype'
26007use64bitall='$use64bitall'
26008use64bitint='$use64bitint'
26009usecbacktrace='$usecbacktrace'
26010usecrosscompile='$usecrosscompile'
26011usedefaultstrict='$usedefaultstrict'
26012usedevel='$usedevel'
26013usedl='$usedl'
26014usedtrace='$usedtrace'
26015usefaststdio='$usefaststdio'
26016useithreads='$useithreads'
26017usekernprocpathname='$usekernprocpathname'
26018uselanginfo='$uselanginfo'
26019uselargefiles='$uselargefiles'
26020uselongdouble='$uselongdouble'
26021usemallocwrap='$usemallocwrap'
26022usemorebits='$usemorebits'
26023usemultiplicity='$usemultiplicity'
26024usemymalloc='$usemymalloc'
26025usenm='$usenm'
26026usensgetexecutablepath='$usensgetexecutablepath'
26027useopcode='$useopcode'
26028useperlio='$useperlio'
26029useposix='$useposix'
26030usequadmath='$usequadmath'
26031usereentrant='$usereentrant'
26032userelocatableinc='$userelocatableinc'
26033useshrplib='$useshrplib'
26034usesitecustomize='$usesitecustomize'
26035usesocks='$usesocks'
26036usethreads='$usethreads'
26037usevendorprefix='$usevendorprefix'
26038useversionedarchname='$useversionedarchname'
26039usevfork='$usevfork'
26040usrinc='$usrinc'
26041uuname='$uuname'
26042uvXUformat='$uvXUformat'
26043uvoformat='$uvoformat'
26044uvsize='$uvsize'
26045uvtype='$uvtype'
26046uvuformat='$uvuformat'
26047uvxformat='$uvxformat'
26048vendorarch='$vendorarch'
26049vendorarchexp='$vendorarchexp'
26050vendorbin='$vendorbin'
26051vendorbinexp='$vendorbinexp'
26052vendorhtml1dir='$vendorhtml1dir'
26053vendorhtml1direxp='$vendorhtml1direxp'
26054vendorhtml3dir='$vendorhtml3dir'
26055vendorhtml3direxp='$vendorhtml3direxp'
26056vendorlib='$vendorlib'
26057vendorlib_stem='$vendorlib_stem'
26058vendorlibexp='$vendorlibexp'
26059vendorman1dir='$vendorman1dir'
26060vendorman1direxp='$vendorman1direxp'
26061vendorman3dir='$vendorman3dir'
26062vendorman3direxp='$vendorman3direxp'
26063vendorprefix='$vendorprefix'
26064vendorprefixexp='$vendorprefixexp'
26065vendorscript='$vendorscript'
26066vendorscriptexp='$vendorscriptexp'
26067version='$version'
26068version_patchlevel_string='$version_patchlevel_string'
26069versiononly='$versiononly'
26070vi='$vi'
26071xlibpth='$xlibpth'
26072xlocale_needed='$xlocale_needed'
26073yacc='$yacc'
26074yaccflags='$yaccflags'
26075zcat='$zcat'
26076zip='$zip'
26077EOT
26078
26079: add special variables
26080$test -f $src/patchlevel.h && \
26081awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
26082echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
26083echo "PERL_CONFIG_SH=true" >>config.sh
26084
26085: propagate old symbols
26086if $test -f UU/config.sh; then
26087	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
26088	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
26089		config.sh config.sh UU/oldconfig.sh |\
26090		$sort | $uniq -u >UU/oldsyms
26091	set X `$cat UU/oldsyms`
26092	shift
26093	case $# in
26094	0) ;;
26095	*)
26096		$cat <<EOM
26097Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
26098EOM
26099		echo ": Variables propagated from previous config.sh file." >>config.sh
26100		for sym in `$cat UU/oldsyms`; do
26101			echo "    Propagating $hint variable "'$'"$sym..."
26102			eval 'tmp="$'"${sym}"'"'
26103			echo "$tmp" | \
26104				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
26105		done
26106		;;
26107	esac
26108fi
26109
26110: preserve RCS keywords in files with variable substitution, grrr
26111Id='$Id'
26112
26113: Finish up by extracting the .SH files
26114case "$alldone" in
26115exit)
26116	echo "Stopping at your request, leaving temporary files around."
26117	exit 0
26118	;;
26119cont)
26120	;;
26121'')
26122	dflt=''
26123	nostick=true
26124	$cat <<EOM
26125
26126If you'd like to make any changes to the config.sh file before I begin
26127to configure things, do it as a shell escape now (e.g. !vi config.sh).
26128
26129EOM
26130	rp="Press return or use a shell escape to edit config.sh:"
26131	. UU/myread
26132	nostick=''
26133	case "$ans" in
26134	'') ;;
26135	*) : in case they cannot read
26136		sh 1>&4 -c "$ans";;
26137	esac
26138	;;
26139esac
26140
26141: if this fails, just run all the .SH files by hand
26142. ./config.sh
26143
26144echo " "
26145exec 1>&4
26146pwd=`pwd`
26147. ./UU/extract
26148cd "$pwd"
26149
26150if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
26151	dflt=y
26152	case "$silent" in
26153	true) ;;
26154	*)
26155		$cat <<EOM
26156
26157Now you need to generate make dependencies by running "$make depend".
26158You might prefer to run it in background: "$make depend > makedepend.out &"
26159It can take a while, so you might not want to run it right now.
26160
26161EOM
26162		;;
26163	esac
26164	rp="Run $make depend now?"
26165	. UU/myread
26166	case "$ans" in
26167	y*)
26168		$make depend && echo "Now you must run '$make'."
26169		;;
26170	*)
26171		echo "You must run '$make depend' then '$make'."
26172		;;
26173	esac
26174elif test -f [Mm]akefile; then
26175	echo " "
26176	echo "Now you must run a $make."
26177else
26178	echo "Configure done."
26179fi
26180
26181if $test -f Policy.sh; then
26182    $cat <<EOM
26183
26184If you compile $package on a different machine or from a different object
26185directory, copy the Policy.sh file from this object directory to the
26186new one before you run Configure -- this will help you with most of
26187the policy defaults.
26188
26189EOM
26190fi
26191if $test -f UU/config.msg; then
26192    echo "Hmm.  I also noted the following information while running:"
26193    echo " "
26194    $cat UU/config.msg >&4
26195fi
26196$rm -f kit*isdone ark*isdone
26197$rm -rf UU
26198
26199: End of Configure
26200
26201