Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #! /bin/sh
     5         kx #
     5         kx # If these # comments don't work, trim them. Don't worry about any other
     5         kx # shell scripts, Configure will trim # comments from them for you.
     5         kx #
     5         kx # (If you are trying to port this package to a machine without sh,
     5         kx # I would suggest you have a look at the prototypical config_h.SH file
     5         kx # and edit it to reflect your system. Some packages may include samples
     5         kx # of config.h for certain machines, so you might look for one of those.)
     5         kx #
     5         kx # Yes, you may rip this off to use in other distribution packages. This
     5         kx # script belongs to the public domain and cannot be copyrighted.
     5         kx #
     5         kx # Note: this Configure script was generated automatically by the tool
     5         kx # called "metaconfig". Rather than working with this copy of Configure,
     5         kx # you should use metaconfig. Perl uses a modified version of this
     5         kx # tool, and this, together with the metaconfig units, are available
     5         kx # in the git repository:
     5         kx #    $ git clone https://github.com/Perl/metaconfig metaconfig
     5         kx # The original dist package (including metaconfig) is available on github:
     5         kx #    $ git clone https://github.com/rmanfredi/dist.git dist-git
     5         kx #
     5         kx # Though this script was generated by metaconfig from metaunits, it is
     5         kx # OK to send patches against Configure itself (but not to commit them
     5         kx # to blead). It's up to
     5         kx # the Configure maintainers to backport the patch to the metaunits if it
     5         kx # is accepted. Exceptions to this rule, and more information, is in
     5         kx # Porting/pumpkin.pod.
     5         kx 
     5         kx # Generated using [metaconfig 3.5 PL0]
     5         kx # with additional metaconfig patches from https://github.com/Perl/metaconfig
     5         kx 
     5         kx cat >c1$$ <<EOF
     5         kx ARGGGHHHH!!!!!
     5         kx 
     5         kx SCO csh still thinks true is false.  Write to SCO today and tell them that next
     5         kx year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
     5         kx 
     5         kx (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
     5         kx we'd have to do is go in and swap the && and || tokens, wherever they are.)
     5         kx 
     5         kx [End of diatribe. We now return you to your regularly scheduled programming...]
     5         kx EOF
     5         kx cat >c2$$ <<EOF
     5         kx 
     5         kx OOPS!  You naughty creature!  You didn't run Configure with sh!
     5         kx I will attempt to remedy the situation by running sh for you...
     5         kx EOF
     5         kx 
     5         kx true || cat c1$$ c2$$
     5         kx true || exec sh $0 $argv:q
     5         kx 
     5         kx (exit $?0) || cat c2$$
     5         kx (exit $?0) || exec sh $0 $argv:q
     5         kx rm -f c1$$ c2$$
     5         kx 
     5         kx if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
     5         kx 	cat <<EOF
     5         kx ***
     5         kx *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
     5         kx *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
     5         kx *** Please read the README.plan9 for further instructions.
     5         kx *** Cannot continue, aborting.
     5         kx ***
     5         kx EOF
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if test -f /sys/utilities/MultiView ; then
     5         kx 	# AmigaOS, test -c for /dev/null is not useful
     5         kx 	:
     5         kx elif test ! -c /dev/null ; then
     5         kx 	cat <<EOF
     5         kx ***
     5         kx *** I'm sorry, but /dev/null appears to be a file rather than a device.
     5         kx *** Please consult your operating sytem's notes for making a device
     5         kx *** in /dev.
     5         kx *** Cannot continue, aborting.
     5         kx ***
     5         kx EOF
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx : compute my invocation name
     5         kx me=$0
     5         kx case "$0" in
     5         kx */*)
     5         kx 	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
     5         kx 	test "$me" || me=$0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Proper separator for the PATH environment variable
     5         kx p_=:
     5         kx : On OS/2 this directory should exist if this is not floppy only system ":-]"
     5         kx if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
     5         kx 	if test -n "$OS2_SHELL"; then
     5         kx 		p_=\;
     5         kx 		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
     5         kx 		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
     5         kx 		is_os2=yes
     5         kx 	elif test -n "$DJGPP"; then
     5         kx 		case "X${MACHTYPE:-nonesuchmach}" in
     5         kx 		*cygwin|*msys) ;;
     5         kx 		*) p_=\; ;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx : Proper PATH setting
     5         kx paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
     5         kx paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
     5         kx paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
     5         kx paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
     5         kx paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
     5         kx paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
     5         kx paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
     5         kx paths="$paths /sbin /usr/sbin /usr/libexec"
     5         kx paths="$paths /system/gnu_library/bin"
     5         kx 
     5         kx for p in $paths
     5         kx do
     5         kx 	case "$p_$PATH$p_" in
     5         kx 	*$p_$p$p_*) ;;
     5         kx 	*) test -d $p && PATH=$PATH$p_$p ;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx PATH=.$p_$PATH
     5         kx export PATH
     5         kx 
     5         kx : shall we be using ksh?
     5         kx inksh=''
     5         kx needksh=''
     5         kx avoidksh=''
     5         kx newsh=/bin/ksh
     5         kx changesh=''
     5         kx if (PATH=.; alias -x) >/dev/null 2>&1; then
     5         kx 		inksh=true
     5         kx fi
     5         kx if test -f /hp-ux -a -f /bin/ksh; then
     5         kx 	needksh='to avoid sh bug in "here document" expansion'
     5         kx fi
     5         kx if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
     5         kx 	if test X`/usr/bin/uname -v` = X4; then
     5         kx 		avoidksh="to avoid AIX 4's /bin/sh"
     5         kx 		newsh=/usr/bin/bsh
     5         kx 	fi
     5         kx fi
     5         kx if test -f /osf_boot -a -f /usr/sbin/setld; then
     5         kx 	if test X`/usr/bin/uname -s` = XOSF1; then
     5         kx 		avoidksh="to avoid Digital UNIX' ksh"
     5         kx 		newsh=/bin/sh
     5         kx 		unset BIN_SH
     5         kx 	fi
     5         kx fi
     5         kx case "$inksh/$needksh" in
     5         kx /[a-z]*)
     5         kx 		ENV=''
     5         kx 		changesh=true
     5         kx 		reason="$needksh"
     5         kx 	;;
     5         kx esac
     5         kx case "$inksh/$avoidksh" in
     5         kx true/[a-z]*)
     5         kx 	changesh=true
     5         kx 	reason="$avoidksh"
     5         kx 	;;
     5         kx esac
     5         kx case "$inksh/$needksh-$avoidksh-" in
     5         kx true/--)
     5         kx 		cat <<EOM
     5         kx (I see you are using the Korn shell.  Some ksh's blow up on $me,
     5         kx mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
     5         kx EOM
     5         kx 	;;
     5         kx esac
     5         kx case "$changesh" in
     5         kx true)
     5         kx 	export newsh
     5         kx 	echo "(Feeding myself to $newsh $reason.)"
     5         kx 	case "$0" in
     5         kx 	Configure|*/Configure) exec $newsh $0 "$@";;
     5         kx 	*) exec $newsh Configure "$@";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx test -x "${newsh}" || unset newsh
     5         kx 
     5         kx : if needed, set CDPATH to a harmless value that is not chatty
     5         kx : avoid bash 2.02 problems with empty CDPATH.
     5         kx case "$CDPATH" in
     5         kx '')	;;
     5         kx *)	case "$SHELL" in
     5         kx 	*bash*) CDPATH='.' ;;
     5         kx 	*) CDPATH='' ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Configure runs within the UU subdirectory
     5         kx test -d UU || mkdir UU
     5         kx cd UU && rm -f ./*
     5         kx 
     5         kx ccname=''
     5         kx ccversion=''
     5         kx ccsymbols=''
     5         kx cppccsymbols=''
     5         kx cppsymbols=''
     5         kx from=''
     5         kx hostgenerate=''
     5         kx hostosname=''
     5         kx hostperl=''
     5         kx run=''
     5         kx targetarch=''
     5         kx targetdir=''
     5         kx targetenv=''
     5         kx targethost=''
     5         kx targetmkdir=''
     5         kx targetport=''
     5         kx to=''
     5         kx usecrosscompile=''
     5         kx extern_C=''
     5         kx mistrustnm=''
     5         kx usedevel=''
     5         kx perllibs=''
     5         kx dynamic_ext=''
     5         kx extensions=''
     5         kx known_extensions=''
     5         kx nonxs_ext=''
     5         kx static_ext=''
     5         kx uselanginfo=''
     5         kx useopcode=''
     5         kx useposix=''
     5         kx extras=''
     5         kx d_bsd=''
     5         kx d_eunice=''
     5         kx d_xenix=''
     5         kx eunicefix=''
     5         kx ar=''
     5         kx awk=''
     5         kx bash=''
     5         kx bison=''
     5         kx byacc=''
     5         kx cat=''
     5         kx chgrp=''
     5         kx chmod=''
     5         kx chown=''
     5         kx comm=''
     5         kx compress=''
     5         kx cp=''
     5         kx cpio=''
     5         kx cpp=''
     5         kx csh=''
     5         kx date=''
     5         kx echo=''
     5         kx egrep=''
     5         kx emacs=''
     5         kx expr=''
     5         kx find=''
     5         kx flex=''
     5         kx gmake=''
     5         kx grep=''
     5         kx gzip=''
     5         kx inews=''
     5         kx ksh=''
     5         kx less=''
     5         kx line=''
     5         kx lint=''
     5         kx ln=''
     5         kx lp=''
     5         kx lpr=''
     5         kx ls=''
     5         kx mail=''
     5         kx mailx=''
     5         kx make=''
     5         kx mkdir=''
     5         kx more=''
     5         kx mv=''
     5         kx nm=''
     5         kx nroff=''
     5         kx perl=''
     5         kx pg=''
     5         kx pmake=''
     5         kx pr=''
     5         kx rm=''
     5         kx rmail=''
     5         kx sed=''
     5         kx sendmail=''
     5         kx shar=''
     5         kx sleep=''
     5         kx smail=''
     5         kx sort=''
     5         kx submit=''
     5         kx tail=''
     5         kx tar=''
     5         kx tbl=''
     5         kx tee=''
     5         kx test=''
     5         kx touch=''
     5         kx tr=''
     5         kx troff=''
     5         kx uname=''
     5         kx uniq=''
     5         kx uuname=''
     5         kx vi=''
     5         kx zcat=''
     5         kx zip=''
     5         kx full_ar=''
     5         kx full_sed=''
     5         kx libswanted=''
     5         kx hint=''
     5         kx myuname=''
     5         kx osname=''
     5         kx osvers=''
     5         kx Author=''
     5         kx Date=''
     5         kx Header=''
     5         kx Id=''
     5         kx Locker=''
     5         kx Log=''
     5         kx RCSfile=''
     5         kx Revision=''
     5         kx Source=''
     5         kx State=''
     5         kx sysroot=''
     5         kx _a=''
     5         kx _exe=''
     5         kx _o=''
     5         kx archobjs=''
     5         kx exe_ext=''
     5         kx firstmakefile=''
     5         kx lib_ext=''
     5         kx obj_ext=''
     5         kx path_sep=''
     5         kx rm_try=''
     5         kx afs=''
     5         kx afsroot=''
     5         kx alignbytes=''
     5         kx archlib=''
     5         kx archlibexp=''
     5         kx d_archlib=''
     5         kx installarchlib=''
     5         kx archname=''
     5         kx myarchname=''
     5         kx useversionedarchname=''
     5         kx d_atolf=''
     5         kx d_atoll=''
     5         kx baserev=''
     5         kx bin=''
     5         kx binexp=''
     5         kx initialinstalllocation=''
     5         kx installbin=''
     5         kx userelocatableinc=''
     5         kx byteorder=''
     5         kx cc=''
     5         kx ccflags=''
     5         kx cppflags=''
     5         kx ldflags=''
     5         kx lkflags=''
     5         kx locincpth=''
     5         kx optimize=''
     5         kx cf_email=''
     5         kx cf_by=''
     5         kx cf_time=''
     5         kx charbits=''
     5         kx charsize=''
     5         kx compiler_warning=''
     5         kx contains=''
     5         kx cpp_stuff=''
     5         kx cpplast=''
     5         kx cppminus=''
     5         kx cpprun=''
     5         kx cppstdin=''
     5         kx d__fwalk=''
     5         kx d_accept4=''
     5         kx d_access=''
     5         kx d_accessx=''
     5         kx d_acosh=''
     5         kx d_aintl=''
     5         kx d_alarm=''
     5         kx asctime_r_proto=''
     5         kx d_asctime_r=''
     5         kx d_asinh=''
     5         kx d_atanh=''
     5         kx d_attribute_always_inline=''
     5         kx d_attribute_deprecated=''
     5         kx d_attribute_format=''
     5         kx d_attribute_malloc=''
     5         kx d_attribute_nonnull=''
     5         kx d_attribute_noreturn=''
     5         kx d_attribute_pure=''
     5         kx d_attribute_unused=''
     5         kx d_attribute_warn_unused_result=''
     5         kx d_printf_format_null=''
     5         kx d_backtrace=''
     5         kx d_non_int_bitfields=''
     5         kx d_builtin_choose_expr=''
     5         kx d_builtin_expect=''
     5         kx d_builtin_add_overflow=''
     5         kx d_builtin_mul_overflow=''
     5         kx d_builtin_sub_overflow=''
     5         kx d_c99_variadic_macros=''
     5         kx d_casti32=''
     5         kx castflags=''
     5         kx d_castneg=''
     5         kx d_cbrt=''
     5         kx d_chown=''
     5         kx d_chroot=''
     5         kx d_chsize=''
     5         kx d_class=''
     5         kx d_clearenv=''
     5         kx d_closedir=''
     5         kx d_void_closedir=''
     5         kx d_cmsghdr_s=''
     5         kx d_copysign=''
     5         kx d_copysignl=''
     5         kx d_cplusplus=''
     5         kx cryptlib=''
     5         kx d_crypt=''
     5         kx crypt_r_proto=''
     5         kx d_crypt_r=''
     5         kx d_csh=''
     5         kx full_csh=''
     5         kx d_ctermid=''
     5         kx ctermid_r_proto=''
     5         kx d_ctermid_r=''
     5         kx ctime_r_proto=''
     5         kx d_ctime_r=''
     5         kx d_cuserid=''
     5         kx d_dbminitproto=''
     5         kx d_difftime=''
     5         kx d_dir_dd_fd=''
     5         kx d_dirfd=''
     5         kx d_dladdr=''
     5         kx d_dlerror=''
     5         kx d_dlopen=''
     5         kx d_dlsymun=''
     5         kx d_dosuid=''
     5         kx d_suidsafe=''
     5         kx d_drand48_r=''
     5         kx drand48_r_proto=''
     5         kx d_drand48proto=''
     5         kx d_dup2=''
     5         kx d_dup3=''
     5         kx d_eaccess=''
     5         kx d_endgrent=''
     5         kx d_endgrent_r=''
     5         kx endgrent_r_proto=''
     5         kx d_endhent=''
     5         kx d_endhostent_r=''
     5         kx endhostent_r_proto=''
     5         kx d_endnent=''
     5         kx d_endnetent_r=''
     5         kx endnetent_r_proto=''
     5         kx d_endpent=''
     5         kx d_endprotoent_r=''
     5         kx endprotoent_r_proto=''
     5         kx d_endpwent=''
     5         kx d_endpwent_r=''
     5         kx endpwent_r_proto=''
     5         kx d_endsent=''
     5         kx d_endservent_r=''
     5         kx endservent_r_proto=''
     5         kx d_erf=''
     5         kx d_erfc=''
     5         kx d_exp2=''
     5         kx d_expm1=''
     5         kx d_faststdio=''
     5         kx d_fchdir=''
     5         kx d_fchmod=''
     5         kx d_fchown=''
     5         kx d_fcntl=''
     5         kx d_fcntl_can_lock=''
     5         kx d_fd_macros=''
     5         kx d_fd_set=''
     5         kx d_fds_bits=''
     5         kx d_fdclose=''
     5         kx d_fdim=''
     5         kx d_fegetround=''
     5         kx d_ffs=''
     5         kx d_ffsl=''
     5         kx d_fgetpos=''
     5         kx d_finite=''
     5         kx d_finitel=''
     5         kx d_flexfnam=''
     5         kx d_flock=''
     5         kx d_flockproto=''
     5         kx d_fma=''
     5         kx d_fmax=''
     5         kx d_fmin=''
     5         kx d_fork=''
     5         kx d_fp_class=''
     5         kx d_fp_classl=''
     5         kx d_fpclass=''
     5         kx d_fp_classify=''
     5         kx d_fpclassify=''
     5         kx d_fpclassl=''
     5         kx d_fpgetround=''
     5         kx d_fpos64_t=''
     5         kx d_frexpl=''
     5         kx d_fs_data_s=''
     5         kx d_fchmodat=''
     5         kx d_linkat=''
     5         kx d_openat=''
     5         kx d_renameat=''
     5         kx d_unlinkat=''
     5         kx d_fseeko=''
     5         kx d_fsetpos=''
     5         kx d_fstatfs=''
     5         kx d_fsync=''
     5         kx d_ftello=''
     5         kx d_ftime=''
     5         kx d_gettimeod=''
     5         kx d_futimes=''
     5         kx d_gai_strerror=''
     5         kx d_Gconvert=''
     5         kx d_getaddrinfo=''
     5         kx d_getcwd=''
     5         kx d_getenv_preserves_other_thread=''
     5         kx d_getespwnam=''
     5         kx d_getfsstat=''
     5         kx d_getgrent=''
     5         kx d_getgrent_r=''
     5         kx getgrent_r_proto=''
     5         kx d_getgrgid_r=''
     5         kx getgrgid_r_proto=''
     5         kx d_getgrnam_r=''
     5         kx getgrnam_r_proto=''
     5         kx d_getgrps=''
     5         kx d_gethbyaddr=''
     5         kx d_gethbyname=''
     5         kx d_gethent=''
     5         kx aphostname=''
     5         kx d_gethname=''
     5         kx d_phostname=''
     5         kx d_uname=''
     5         kx d_gethostbyaddr_r=''
     5         kx gethostbyaddr_r_proto=''
     5         kx d_gethostbyname_r=''
     5         kx gethostbyname_r_proto=''
     5         kx d_gethostent_r=''
     5         kx gethostent_r_proto=''
     5         kx d_gethostprotos=''
     5         kx d_getitimer=''
     5         kx d_getlogin=''
     5         kx d_getlogin_r=''
     5         kx getlogin_r_proto=''
     5         kx d_getmnt=''
     5         kx d_getmntent=''
     5         kx d_getnameinfo=''
     5         kx d_getnbyaddr=''
     5         kx d_getnbyname=''
     5         kx d_getnent=''
     5         kx d_getnetbyaddr_r=''
     5         kx getnetbyaddr_r_proto=''
     5         kx d_getnetbyname_r=''
     5         kx getnetbyname_r_proto=''
     5         kx d_getnetent_r=''
     5         kx getnetent_r_proto=''
     5         kx d_getnetprotos=''
     5         kx d_getpagsz=''
     5         kx d_getpent=''
     5         kx d_getpgid=''
     5         kx d_getpgrp2=''
     5         kx d_bsdgetpgrp=''
     5         kx d_getpgrp=''
     5         kx d_getppid=''
     5         kx d_getprior=''
     5         kx d_getpbyname=''
     5         kx d_getpbynumber=''
     5         kx d_getprotobyname_r=''
     5         kx getprotobyname_r_proto=''
     5         kx d_getprotobynumber_r=''
     5         kx getprotobynumber_r_proto=''
     5         kx d_getprotoent_r=''
     5         kx getprotoent_r_proto=''
     5         kx d_getprotoprotos=''
     5         kx d_getprpwnam=''
     5         kx d_getpwent=''
     5         kx d_getpwent_r=''
     5         kx getpwent_r_proto=''
     5         kx d_getpwnam_r=''
     5         kx getpwnam_r_proto=''
     5         kx d_getpwuid_r=''
     5         kx getpwuid_r_proto=''
     5         kx d_getsent=''
     5         kx d_getservbyname_r=''
     5         kx getservbyname_r_proto=''
     5         kx d_getservbyport_r=''
     5         kx getservbyport_r_proto=''
     5         kx d_getservent_r=''
     5         kx getservent_r_proto=''
     5         kx d_getservprotos=''
     5         kx d_getspnam=''
     5         kx d_getspnam_r=''
     5         kx getspnam_r_proto=''
     5         kx d_getsbyname=''
     5         kx d_getsbyport=''
     5         kx d_gmtime_r=''
     5         kx gmtime_r_proto=''
     5         kx d_gnulibc=''
     5         kx gnulibc_version=''
     5         kx d_hasmntopt=''
     5         kx d_htonl=''
     5         kx d_hypot=''
     5         kx d_ilogb=''
     5         kx d_ilogbl=''
     5         kx d_inetaton=''
     5         kx d_inetntop=''
     5         kx d_inetpton=''
     5         kx d_int64_t=''
     5         kx d_isascii=''
     5         kx d_isblank=''
     5         kx d_isfinite=''
     5         kx d_isfinitel=''
     5         kx d_isinf=''
     5         kx d_isinfl=''
     5         kx d_isless=''
     5         kx d_isnan=''
     5         kx d_isnanl=''
     5         kx d_isnormal=''
     5         kx d_j0=''
     5         kx d_j0l=''
     5         kx d_killpg=''
     5         kx d_lc_monetary_2008=''
     5         kx d_lchown=''
     5         kx d_ldbl_dig=''
     5         kx d_lgamma=''
     5         kx d_lgamma_r=''
     5         kx d_libm_lib_version=''
     5         kx d_link=''
     5         kx d_llrint=''
     5         kx d_llrintl=''
     5         kx d_llround=''
     5         kx d_llroundl=''
     5         kx d_localeconv_l=''
     5         kx d_localtime_r=''
     5         kx d_localtime_r_needs_tzset=''
     5         kx localtime_r_proto=''
     5         kx d_locconv=''
     5         kx d_lockf=''
     5         kx d_log1p=''
     5         kx d_log2=''
     5         kx d_logb=''
     5         kx d_ldexpl=''
     5         kx d_long_double_style_ieee=''
     5         kx d_long_double_style_ieee_doubledouble=''
     5         kx d_long_double_style_ieee_extended=''
     5         kx d_long_double_style_ieee_std=''
     5         kx d_long_double_style_vax=''
     5         kx d_longdbl=''
     5         kx longdblkind=''
     5         kx longdblsize=''
     5         kx d_longlong=''
     5         kx longlongsize=''
     5         kx d_lrint=''
     5         kx d_lrintl=''
     5         kx d_lround=''
     5         kx d_lroundl=''
     5         kx d_lseekproto=''
     5         kx d_lstat=''
     5         kx d_madvise=''
     5         kx d_malloc_good_size=''
     5         kx d_malloc_size=''
     5         kx d_malloc_usable_size=''
     5         kx d_mblen=''
     5         kx d_mbrlen=''
     5         kx d_mbrtowc=''
     5         kx d_mbstowcs=''
     5         kx d_mbtowc=''
     5         kx d_memmem=''
     5         kx d_memrchr=''
     5         kx d_mkdir=''
     5         kx d_mkdtemp=''
     5         kx d_mkfifo=''
     5         kx d_mkostemp=''
     5         kx d_mkstemp=''
     5         kx d_mkstemps=''
     5         kx d_mktime=''
     5         kx d_mmap=''
     5         kx mmaptype=''
     5         kx d_modfl=''
     5         kx d_modflproto=''
     5         kx d_mprotect=''
     5         kx d_msg=''
     5         kx d_msgctl=''
     5         kx d_msgget=''
     5         kx d_msghdr_s=''
     5         kx d_msgrcv=''
     5         kx d_msgsnd=''
     5         kx d_msync=''
     5         kx d_munmap=''
     5         kx d_nan=''
     5         kx d_nanosleep=''
     5         kx d_nearbyint=''
     5         kx d_duplocale=''
     5         kx d_freelocale=''
     5         kx d_newlocale=''
     5         kx d_querylocale=''
     5         kx d_uselocale=''
     5         kx i_xlocale=''
     5         kx xlocale_needed=''
     5         kx d_nextafter=''
     5         kx d_nexttoward=''
     5         kx d_nice=''
     5         kx d_nl_langinfo=''
     5         kx d_nl_langinfo_l=''
     5         kx d_thread_safe_nl_langinfo_l=''
     5         kx d_off64_t=''
     5         kx d_open3=''
     5         kx d_fpathconf=''
     5         kx d_pathconf=''
     5         kx d_pause=''
     5         kx d_pipe2=''
     5         kx d_pipe=''
     5         kx d_poll=''
     5         kx d_portable=''
     5         kx d_prctl=''
     5         kx d_prctl_set_name=''
     5         kx d_procselfexe=''
     5         kx procselfexe=''
     5         kx d_old_pthread_create_joinable=''
     5         kx old_pthread_create_joinable=''
     5         kx d_pthread_atfork=''
     5         kx d_pthread_attr_setscope=''
     5         kx d_pthread_yield=''
     5         kx d_sched_yield=''
     5         kx sched_yield=''
     5         kx d_ptrdiff_t=''
     5         kx d_qgcvt=''
     5         kx d_random_r=''
     5         kx random_r_proto=''
     5         kx d_readdir64_r=''
     5         kx readdir64_r_proto=''
     5         kx d_readdir=''
     5         kx d_rewinddir=''
     5         kx d_seekdir=''
     5         kx d_telldir=''
     5         kx d_readdir_r=''
     5         kx readdir_r_proto=''
     5         kx d_readlink=''
     5         kx d_readv=''
     5         kx d_recvmsg=''
     5         kx d_re_comp=''
     5         kx d_regcmp=''
     5         kx d_regcomp=''
     5         kx d_remainder=''
     5         kx d_remquo=''
     5         kx d_rename=''
     5         kx d_rint=''
     5         kx d_rmdir=''
     5         kx d_round=''
     5         kx d_sbrkproto=''
     5         kx d_scalbn=''
     5         kx d_scalbnl=''
     5         kx d_select=''
     5         kx d_sem=''
     5         kx d_semctl=''
     5         kx d_semget=''
     5         kx d_semop=''
     5         kx d_sendmsg=''
     5         kx d_setegid=''
     5         kx d_seteuid=''
     5         kx d_setgrent=''
     5         kx d_setgrent_r=''
     5         kx setgrent_r_proto=''
     5         kx d_setgrps=''
     5         kx d_sethent=''
     5         kx d_sethostent_r=''
     5         kx sethostent_r_proto=''
     5         kx d_setitimer=''
     5         kx d_setlinebuf=''
     5         kx d_has_C_UTF8=''
     5         kx d_setlocale=''
     5         kx d_setlocale_accepts_any_locale_name=''
     5         kx d_setlocale_r=''
     5         kx setlocale_r_proto=''
     5         kx d_setnent=''
     5         kx d_setnetent_r=''
     5         kx setnetent_r_proto=''
     5         kx d_setpent=''
     5         kx d_setpgid=''
     5         kx d_setpgrp2=''
     5         kx d_bsdsetpgrp=''
     5         kx d_setpgrp=''
     5         kx d_setprior=''
     5         kx d_setproctitle=''
     5         kx d_setprotoent_r=''
     5         kx setprotoent_r_proto=''
     5         kx d_setpwent=''
     5         kx d_setpwent_r=''
     5         kx setpwent_r_proto=''
     5         kx d_setregid=''
     5         kx d_setresgid=''
     5         kx d_setresuid=''
     5         kx d_setreuid=''
     5         kx d_setrgid=''
     5         kx d_setruid=''
     5         kx d_setsent=''
     5         kx d_setservent_r=''
     5         kx setservent_r_proto=''
     5         kx d_setsid=''
     5         kx d_setvbuf=''
     5         kx d_shm=''
     5         kx d_shmat=''
     5         kx d_shmatprototype=''
     5         kx shmattype=''
     5         kx d_shmctl=''
     5         kx d_shmdt=''
     5         kx d_shmget=''
     5         kx d_sigaction=''
     5         kx d_siginfo_si_addr=''
     5         kx d_siginfo_si_band=''
     5         kx d_siginfo_si_errno=''
     5         kx d_siginfo_si_fd=''
     5         kx d_siginfo_si_pid=''
     5         kx d_siginfo_si_status=''
     5         kx d_siginfo_si_uid=''
     5         kx d_siginfo_si_value=''
     5         kx d_signbit=''
     5         kx d_sigprocmask=''
     5         kx d_sigsetjmp=''
     5         kx usesitecustomize=''
     5         kx d_snprintf=''
     5         kx d_vsnprintf=''
     5         kx d_sockatmark=''
     5         kx d_sockatmarkproto=''
     5         kx d_ip_mreq=''
     5         kx d_ip_mreq_source=''
     5         kx d_ipv6_mreq=''
     5         kx d_ipv6_mreq_source=''
     5         kx d_msg_ctrunc=''
     5         kx d_msg_dontroute=''
     5         kx d_msg_oob=''
     5         kx d_msg_peek=''
     5         kx d_msg_proxy=''
     5         kx d_oldsock=''
     5         kx d_scm_rights=''
     5         kx d_sin6_scope_id=''
     5         kx d_sockaddr_in6=''
     5         kx d_sockaddr_sa_len=''
     5         kx d_sockaddr_storage=''
     5         kx d_socket=''
     5         kx d_sockpair=''
     5         kx sockethdr=''
     5         kx socketlib=''
     5         kx d_socklen_t=''
     5         kx d_socks5_init=''
     5         kx d_sqrtl=''
     5         kx d_srand48_r=''
     5         kx srand48_r_proto=''
     5         kx d_srandom_r=''
     5         kx srandom_r_proto=''
     5         kx d_sresgproto=''
     5         kx d_sresuproto=''
     5         kx d_stat=''
     5         kx d_statblks=''
     5         kx d_statfs_f_flags=''
     5         kx d_statfs_s=''
     5         kx d_static_inline=''
     5         kx perl_static_inline=''
     5         kx d_fstatvfs=''
     5         kx d_statvfs=''
     5         kx d_stdio_cnt_lval=''
     5         kx d_stdio_ptr_lval=''
     5         kx d_stdio_ptr_lval_nochange_cnt=''
     5         kx d_stdio_ptr_lval_sets_cnt=''
     5         kx d_stdiobase=''
     5         kx d_stdstdio=''
     5         kx stdio_base=''
     5         kx stdio_bufsiz=''
     5         kx stdio_cnt=''
     5         kx stdio_filbuf=''
     5         kx stdio_ptr=''
     5         kx d_strcoll=''
     5         kx d_sysernlst=''
     5         kx d_syserrlst=''
     5         kx d_strerror_l=''
     5         kx d_strerror_r=''
     5         kx strerror_r_proto=''
     5         kx d_strftime=''
     5         kx d_strlcat=''
     5         kx d_strlcpy=''
     5         kx d_strnlen=''
     5         kx d_strtod=''
     5         kx d_strtod_l=''
     5         kx d_strtol=''
     5         kx d_strtold=''
     5         kx d_strtold_l=''
     5         kx d_strtoll=''
     5         kx d_strtoq=''
     5         kx d_strtoul=''
     5         kx d_strtoull=''
     5         kx d_strtouq=''
     5         kx d_strxfrm=''
     5         kx d_strxfrm_l=''
     5         kx d_symlink=''
     5         kx d_syscall=''
     5         kx d_syscallproto=''
     5         kx d_sysconf=''
     5         kx d_system=''
     5         kx d_tcgetpgrp=''
     5         kx d_tcsetpgrp=''
     5         kx d_telldirproto=''
     5         kx d_tgamma=''
     5         kx d_thread_local=''
     5         kx perl_thread_local=''
     5         kx d_time=''
     5         kx timetype=''
     5         kx d_asctime64=''
     5         kx d_ctime64=''
     5         kx d_difftime64=''
     5         kx d_gmtime64=''
     5         kx d_localtime64=''
     5         kx d_mktime64=''
     5         kx d_timegm=''
     5         kx clocktype=''
     5         kx d_times=''
     5         kx d_tmpnam_r=''
     5         kx tmpnam_r_proto=''
     5         kx d_towlower=''
     5         kx d_towupper=''
     5         kx d_trunc=''
     5         kx d_truncate=''
     5         kx d_truncl=''
     5         kx d_ttyname_r=''
     5         kx ttyname_r_proto=''
     5         kx d_tzname=''
     5         kx d_u32align=''
     5         kx d_ualarm=''
     5         kx d_umask=''
     5         kx d_semctl_semid_ds=''
     5         kx d_semctl_semun=''
     5         kx d_union_semun=''
     5         kx d_unordered=''
     5         kx d_unsetenv=''
     5         kx d_usleep=''
     5         kx d_usleepproto=''
     5         kx d_ustat=''
     5         kx d_pseudofork=''
     5         kx d_vfork=''
     5         kx usevfork=''
     5         kx d_voidsig=''
     5         kx signal_t=''
     5         kx d_wait4=''
     5         kx d_waitpid=''
     5         kx d_wcrtomb=''
     5         kx d_wcscmp=''
     5         kx d_wcstombs=''
     5         kx d_wcsxfrm=''
     5         kx d_wctomb=''
     5         kx d_writev=''
     5         kx default_inc_excludes_dot=''
     5         kx dlext=''
     5         kx bin_ELF=''
     5         kx cccdlflags=''
     5         kx ccdlflags=''
     5         kx dlsrc=''
     5         kx ld=''
     5         kx ld_can_script=''
     5         kx lddlflags=''
     5         kx usedl=''
     5         kx doublesize=''
     5         kx dtraceobject=''
     5         kx dtracexnolibs=''
     5         kx ebcdic=''
     5         kx fflushNULL=''
     5         kx fflushall=''
     5         kx fpossize=''
     5         kx fpostype=''
     5         kx gccansipedantic=''
     5         kx gccosandvers=''
     5         kx gccversion=''
     5         kx gidformat=''
     5         kx gidsign=''
     5         kx gidsize=''
     5         kx gidtype=''
     5         kx groupstype=''
     5         kx h_fcntl=''
     5         kx h_sysfile=''
     5         kx html1dir=''
     5         kx html1direxp=''
     5         kx installhtml1dir=''
     5         kx html3dir=''
     5         kx html3direxp=''
     5         kx installhtml3dir=''
     5         kx i_arpainet=''
     5         kx i_bfd=''
     5         kx i_crypt=''
     5         kx db_hashtype=''
     5         kx db_prefixtype=''
     5         kx db_version_major=''
     5         kx db_version_minor=''
     5         kx db_version_patch=''
     5         kx i_db=''
     5         kx i_dbm=''
     5         kx i_rpcsvcdbm=''
     5         kx d_dirnamlen=''
     5         kx direntrytype=''
     5         kx i_dirent=''
     5         kx i_dlfcn=''
     5         kx i_execinfo=''
     5         kx i_fcntl=''
     5         kx i_fenv=''
     5         kx i_fp=''
     5         kx i_fp_class=''
     5         kx i_gdbm=''
     5         kx d_grpasswd=''
     5         kx i_grp=''
     5         kx i_ieeefp=''
     5         kx i_inttypes=''
     5         kx i_langinfo=''
     5         kx i_libutil=''
     5         kx i_locale=''
     5         kx i_machcthr=''
     5         kx i_malloc=''
     5         kx i_mallocmalloc=''
     5         kx i_mntent=''
     5         kx d_gdbm_ndbm_h_uses_prototypes=''
     5         kx d_gdbmndbm_h_uses_prototypes=''
     5         kx d_ndbm=''
     5         kx d_ndbm_h_uses_prototypes=''
     5         kx i_gdbm_ndbm=''
     5         kx i_gdbmndbm=''
     5         kx i_ndbm=''
     5         kx i_netdb=''
     5         kx i_neterrno=''
     5         kx i_netinettcp=''
     5         kx i_niin=''
     5         kx i_sysin=''
     5         kx i_poll=''
     5         kx i_prot=''
     5         kx i_pthread=''
     5         kx d_pwage=''
     5         kx d_pwchange=''
     5         kx d_pwclass=''
     5         kx d_pwcomment=''
     5         kx d_pwexpire=''
     5         kx d_pwgecos=''
     5         kx d_pwpasswd=''
     5         kx d_pwquota=''
     5         kx i_pwd=''
     5         kx i_quadmath=''
     5         kx i_shadow=''
     5         kx i_socks=''
     5         kx i_stdbool=''
     5         kx i_stdint=''
     5         kx i_stdlib=''
     5         kx i_sunmath=''
     5         kx i_sysaccess=''
     5         kx i_sysdir=''
     5         kx i_sysfile=''
     5         kx d_voidtty=''
     5         kx i_bsdioctl=''
     5         kx i_sysfilio=''
     5         kx i_sysioctl=''
     5         kx i_syssockio=''
     5         kx i_syslog=''
     5         kx i_sysmman=''
     5         kx i_sysmode=''
     5         kx i_sysmount=''
     5         kx i_sysndir=''
     5         kx i_sysparam=''
     5         kx i_syspoll=''
     5         kx i_sysresrc=''
     5         kx i_syssecrt=''
     5         kx i_sysselct=''
     5         kx i_sysstat=''
     5         kx i_sysstatfs=''
     5         kx i_sysstatvfs=''
     5         kx i_systimes=''
     5         kx i_systypes=''
     5         kx i_sysuio=''
     5         kx i_sysun=''
     5         kx i_sysutsname=''
     5         kx i_sysvfs=''
     5         kx i_syswait=''
     5         kx i_sgtty=''
     5         kx i_termio=''
     5         kx i_termios=''
     5         kx d_tm_tm_gmtoff=''
     5         kx d_tm_tm_zone=''
     5         kx i_systime=''
     5         kx i_systimek=''
     5         kx i_time=''
     5         kx timeincl=''
     5         kx i_unistd=''
     5         kx i_ustat=''
     5         kx i_utime=''
     5         kx i_vfork=''
     5         kx i_wchar=''
     5         kx i_wctype=''
     5         kx d_inc_version_list=''
     5         kx inc_version_list=''
     5         kx inc_version_list_init=''
     5         kx doubleinfbytes=''
     5         kx doublenanbytes=''
     5         kx longdblinfbytes=''
     5         kx longdblnanbytes=''
     5         kx installprefix=''
     5         kx installprefixexp=''
     5         kx installstyle=''
     5         kx installusrbinperl=''
     5         kx intsize=''
     5         kx longsize=''
     5         kx shortsize=''
     5         kx issymlink=''
     5         kx libc=''
     5         kx ldlibpthname=''
     5         kx libperl=''
     5         kx shrpenv=''
     5         kx useshrplib=''
     5         kx glibpth=''
     5         kx incpth=''
     5         kx libpth=''
     5         kx loclibpth=''
     5         kx plibpth=''
     5         kx xlibpth=''
     5         kx ignore_versioned_solibs=''
     5         kx libs=''
     5         kx libsdirs=''
     5         kx libsfiles=''
     5         kx libsfound=''
     5         kx libspath=''
     5         kx lns=''
     5         kx d_PRIEUldbl=''
     5         kx d_PRIFUldbl=''
     5         kx d_PRIGUldbl=''
     5         kx d_PRIeldbl=''
     5         kx d_PRIfldbl=''
     5         kx d_PRIgldbl=''
     5         kx d_SCNfldbl=''
     5         kx d_double_has_inf=''
     5         kx d_double_has_nan=''
     5         kx d_double_has_negative_zero=''
     5         kx d_double_has_subnormals=''
     5         kx d_double_style_cray=''
     5         kx d_double_style_ibm=''
     5         kx d_double_style_ieee=''
     5         kx d_double_style_vax=''
     5         kx doublekind=''
     5         kx sPRIEUldbl=''
     5         kx sPRIFUldbl=''
     5         kx sPRIGUldbl=''
     5         kx sPRIeldbl=''
     5         kx sPRIfldbl=''
     5         kx sPRIgldbl=''
     5         kx sSCNfldbl=''
     5         kx lseeksize=''
     5         kx lseektype=''
     5         kx make_set_make=''
     5         kx d_mymalloc=''
     5         kx freetype=''
     5         kx mallocobj=''
     5         kx mallocsrc=''
     5         kx malloctype=''
     5         kx usemallocwrap=''
     5         kx usemymalloc=''
     5         kx installman1dir=''
     5         kx man1dir=''
     5         kx man1direxp=''
     5         kx man1ext=''
     5         kx installman3dir=''
     5         kx man3dir=''
     5         kx man3direxp=''
     5         kx man3ext=''
     5         kx doublemantbits=''
     5         kx longdblmantbits=''
     5         kx nvmantbits=''
     5         kx modetype=''
     5         kx multiarch=''
     5         kx mydomain=''
     5         kx myhostname=''
     5         kx phostname=''
     5         kx c=''
     5         kx n=''
     5         kx d_eofnblk=''
     5         kx eagain=''
     5         kx o_nonblock=''
     5         kx rd_nodata=''
     5         kx need_va_copy=''
     5         kx netdb_hlen_type=''
     5         kx netdb_host_type=''
     5         kx netdb_name_type=''
     5         kx netdb_net_type=''
     5         kx groupcat=''
     5         kx hostcat=''
     5         kx passcat=''
     5         kx orderlib=''
     5         kx ranlib=''
     5         kx d_perl_otherlibdirs=''
     5         kx otherlibdirs=''
     5         kx package=''
     5         kx spackage=''
     5         kx pager=''
     5         kx api_revision=''
     5         kx api_subversion=''
     5         kx api_version=''
     5         kx api_versionstring=''
     5         kx patchlevel=''
     5         kx perl_patchlevel=''
     5         kx revision=''
     5         kx subversion=''
     5         kx version=''
     5         kx version_patchlevel_string=''
     5         kx perl5=''
     5         kx perladmin=''
     5         kx perlpath=''
     5         kx d_nv_preserves_uv=''
     5         kx d_nv_zero_is_allbits_zero=''
     5         kx i16size=''
     5         kx i16type=''
     5         kx i32size=''
     5         kx i32type=''
     5         kx i64size=''
     5         kx i64type=''
     5         kx i8size=''
     5         kx i8type=''
     5         kx ivsize=''
     5         kx ivtype=''
     5         kx nv_overflows_integers_at=''
     5         kx nv_preserves_uv_bits=''
     5         kx nvsize=''
     5         kx nvtype=''
     5         kx u16size=''
     5         kx u16type=''
     5         kx u32size=''
     5         kx u32type=''
     5         kx u64size=''
     5         kx u64type=''
     5         kx u8size=''
     5         kx u8type=''
     5         kx uvsize=''
     5         kx uvtype=''
     5         kx ivdformat=''
     5         kx nvEUformat=''
     5         kx nvFUformat=''
     5         kx nvGUformat=''
     5         kx nveformat=''
     5         kx nvfformat=''
     5         kx nvgformat=''
     5         kx uvXUformat=''
     5         kx uvoformat=''
     5         kx uvuformat=''
     5         kx uvxformat=''
     5         kx pidtype=''
     5         kx prefix=''
     5         kx prefixexp=''
     5         kx installprivlib=''
     5         kx privlib=''
     5         kx privlibexp=''
     5         kx ptrsize=''
     5         kx d_PRIXU64=''
     5         kx d_PRId64=''
     5         kx d_PRIi64=''
     5         kx d_PRIo64=''
     5         kx d_PRIu64=''
     5         kx d_PRIx64=''
     5         kx sPRIXU64=''
     5         kx sPRId64=''
     5         kx sPRIi64=''
     5         kx sPRIo64=''
     5         kx sPRIu64=''
     5         kx sPRIx64=''
     5         kx d_quad=''
     5         kx quadkind=''
     5         kx quadtype=''
     5         kx uquadtype=''
     5         kx drand01=''
     5         kx randbits=''
     5         kx randfunc=''
     5         kx randseedtype=''
     5         kx seedfunc=''
     5         kx installscript=''
     5         kx scriptdir=''
     5         kx scriptdirexp=''
     5         kx selectminbits=''
     5         kx selecttype=''
     5         kx sh=''
     5         kx targetsh=''
     5         kx sig_count=''
     5         kx sig_name=''
     5         kx sig_name_init=''
     5         kx sig_num=''
     5         kx sig_num_init=''
     5         kx sig_size=''
     5         kx d_sitearch=''
     5         kx installsitearch=''
     5         kx sitearch=''
     5         kx sitearchexp=''
     5         kx installsitebin=''
     5         kx sitebin=''
     5         kx sitebinexp=''
     5         kx installsitehtml1dir=''
     5         kx sitehtml1dir=''
     5         kx sitehtml1direxp=''
     5         kx installsitehtml3dir=''
     5         kx sitehtml3dir=''
     5         kx sitehtml3direxp=''
     5         kx installsitelib=''
     5         kx sitelib=''
     5         kx sitelib_stem=''
     5         kx sitelibexp=''
     5         kx installsiteman1dir=''
     5         kx siteman1dir=''
     5         kx siteman1direxp=''
     5         kx installsiteman3dir=''
     5         kx siteman3dir=''
     5         kx siteman3direxp=''
     5         kx siteprefix=''
     5         kx siteprefixexp=''
     5         kx installsitescript=''
     5         kx sitescript=''
     5         kx sitescriptexp=''
     5         kx sizesize=''
     5         kx sizetype=''
     5         kx d_libname_unique=''
     5         kx so=''
     5         kx socksizetype=''
     5         kx sharpbang=''
     5         kx shsharp=''
     5         kx spitshell=''
     5         kx src=''
     5         kx ssizetype=''
     5         kx st_dev_sign=''
     5         kx st_dev_size=''
     5         kx st_ino_sign=''
     5         kx st_ino_size=''
     5         kx startperl=''
     5         kx startsh=''
     5         kx stdchar=''
     5         kx d_stdio_stream_array=''
     5         kx stdio_stream_array=''
     5         kx sysman=''
     5         kx sGMTIME_max=''
     5         kx sGMTIME_min=''
     5         kx sLOCALTIME_max=''
     5         kx sLOCALTIME_min=''
     5         kx trnl=''
     5         kx uidformat=''
     5         kx uidsign=''
     5         kx uidsize=''
     5         kx uidtype=''
     5         kx archname64=''
     5         kx use64bitall=''
     5         kx use64bitint=''
     5         kx usecbacktrace=''
     5         kx usedefaultstrict=''
     5         kx dtrace=''
     5         kx usedtrace=''
     5         kx usefaststdio=''
     5         kx usekernprocpathname=''
     5         kx ccflags_uselargefiles=''
     5         kx ldflags_uselargefiles=''
     5         kx libswanted_uselargefiles=''
     5         kx uselargefiles=''
     5         kx uselongdouble=''
     5         kx usemorebits=''
     5         kx usemultiplicity=''
     5         kx nm_opt=''
     5         kx nm_so_opt=''
     5         kx runnm=''
     5         kx usenm=''
     5         kx usensgetexecutablepath=''
     5         kx useperlio=''
     5         kx usequadmath=''
     5         kx usesocks=''
     5         kx d_oldpthreads=''
     5         kx useithreads=''
     5         kx usereentrant=''
     5         kx usethreads=''
     5         kx incpath=''
     5         kx mips_type=''
     5         kx usrinc=''
     5         kx d_vendorarch=''
     5         kx installvendorarch=''
     5         kx vendorarch=''
     5         kx vendorarchexp=''
     5         kx d_vendorbin=''
     5         kx installvendorbin=''
     5         kx vendorbin=''
     5         kx vendorbinexp=''
     5         kx installvendorhtml1dir=''
     5         kx vendorhtml1dir=''
     5         kx vendorhtml1direxp=''
     5         kx installvendorhtml3dir=''
     5         kx vendorhtml3dir=''
     5         kx vendorhtml3direxp=''
     5         kx d_vendorlib=''
     5         kx installvendorlib=''
     5         kx vendorlib=''
     5         kx vendorlib_stem=''
     5         kx vendorlibexp=''
     5         kx installvendorman1dir=''
     5         kx vendorman1dir=''
     5         kx vendorman1direxp=''
     5         kx installvendorman3dir=''
     5         kx vendorman3dir=''
     5         kx vendorman3direxp=''
     5         kx usevendorprefix=''
     5         kx vendorprefix=''
     5         kx vendorprefixexp=''
     5         kx d_vendorscript=''
     5         kx installvendorscript=''
     5         kx vendorscript=''
     5         kx vendorscriptexp=''
     5         kx versiononly=''
     5         kx yacc=''
     5         kx yaccflags=''
     5         kx CONFIG=''
     5         kx 
     5         kx : Detect odd OSs
     5         kx define='define'
     5         kx undef='undef'
     5         kx smallmach='pdp11 i8086 z8000 i80286 iAPX286'
     5         kx rmlist=''
     5         kx 
     5         kx : We must find out about Eunice early
     5         kx eunicefix=':'
     5         kx if test -f /etc/unixtovms; then
     5         kx 	eunicefix=/etc/unixtovms
     5         kx fi
     5         kx if test -f /etc/unixtovms.exe; then
     5         kx 	eunicefix=/etc/unixtovms.exe
     5         kx fi
     5         kx 
     5         kx : Set executable suffix now -- needed before hints available
     5         kx if test -f "/libs/version.library"; then
     5         kx : Amiga OS
     5         kx     _exe=""
     5         kx elif test -f "/system/gnu_library/bin/ar.pm"; then
     5         kx : Stratus VOS
     5         kx     _exe=".pm"
     5         kx elif test -n "$DJGPP"; then
     5         kx : DOS DJGPP
     5         kx     _exe=".exe"
     5         kx elif test -f /kern/cookiejar; then
     5         kx : MiNT
     5         kx     _exe=""
     5         kx elif test -d c:/. -o -n "$is_os2" ; then
     5         kx : OS/2 or cygwin
     5         kx     _exe=".exe"
     5         kx fi
     5         kx 
     5         kx groupstype=''
     5         kx i_whoami=''
     5         kx : Possible local include directories to search.
     5         kx : Set locincpth to "" in a hint file to defeat local include searches.
     5         kx locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
     5         kx locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
     5         kx :
     5         kx : no include file wanted by default
     5         kx inclwanted=''
     5         kx 
     5         kx : Enable -DEBUGGING and -DDEBUGGING from the command line
     5         kx EBUGGING=''
     5         kx DEBUGGING=''
     5         kx 
     5         kx : Trailing extension.  Override this in a hint file, if needed.
     5         kx : Extra object files, if any, needed on this platform.
     5         kx archobjs=''
     5         kx libnames=''
     5         kx : change the next line if compiling for Xenix/286 on Xenix/386
     5         kx xlibpth='/usr/lib/386 /lib/386'
     5         kx : Possible local library directories to search.
     5         kx loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
     5         kx loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
     5         kx 
     5         kx : general looking path for locating libraries
     5         kx glibpth="/lib /usr/lib $xlibpth"
     5         kx glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
     5         kx test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
     5         kx test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
     5         kx test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
     5         kx 
     5         kx : Private path used by Configure to find libraries.  Its value
     5         kx : is prepended to libpth. This variable takes care of special
     5         kx : machines, like the mips.  Usually, it should be empty.
     5         kx plibpth=''
     5         kx 
     5         kx : default library list
     5         kx libswanted=''
     5         kx : some systems want to use only the non-versioned libso:s
     5         kx ignore_versioned_solibs=''
     5         kx ccname=''
     5         kx ccversion=''
     5         kx perllibs=''
     5         kx : set useposix=false in your hint file to disable the POSIX extension.
     5         kx useposix=true
     5         kx : set useopcode=false in your hint file to disable the Opcode extension.
     5         kx useopcode=true
     5         kx : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
     5         kx uselanginfo=true
     5         kx archname64=''
     5         kx ccflags_uselargefiles=''
     5         kx ldflags_uselargefiles=''
     5         kx libswanted_uselargefiles=''
     5         kx : set usemultiplicity on the Configure command line to enable multiplicity.
     5         kx : set usesocks on the Configure command line to enable socks.
     5         kx archname=''
     5         kx : set usethreads on the Configure command line to enable threads.
     5         kx usereentrant='undef'
     5         kx : List of libraries we want.
     5         kx : If anyone needs extra -lxxx, put those in a hint file.
     5         kx libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
     5         kx libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
     5         kx : We probably want to search /usr/shlib before most other libraries.
     5         kx : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
     5         kx glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
     5         kx glibpth="/usr/shlib $glibpth"
     5         kx : Do not use vfork unless overridden by a hint file.
     5         kx usevfork=false
     5         kx 
     5         kx : Find the basic shell for Bourne shell scripts
     5         kx case "$sh" in
     5         kx '')
     5         kx 	case "$SYSTYPE" in
     5         kx 	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
     5         kx 	*) xxx='/bin/sh';;
     5         kx 	esac
     5         kx 	if test -f "$xxx"; then
     5         kx 		sh="$xxx"
     5         kx 	else
     5         kx 		: Build up a list and do a single loop so we can 'break' out.
     5         kx 		pth=`echo $PATH | sed -e "s/$p_/ /g"`
     5         kx 		for xxx in sh bash ksh pdksh ash; do
     5         kx 			for p in $pth; do
     5         kx 				try="$try ${p}/${xxx}"
     5         kx 			done
     5         kx 		done
     5         kx 		for xxx in $try; do
     5         kx 			if test -f "$xxx"; then
     5         kx 				sh="$xxx";
     5         kx 				break
     5         kx 			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
     5         kx 				sh="$xxx";
     5         kx 				break
     5         kx 			elif test -f "$xxx.exe"; then
     5         kx 				sh="$xxx";
     5         kx 				break
     5         kx 			fi
     5         kx 		done
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$sh" in
     5         kx '')	cat >&2 <<EOM
     5         kx $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
     5         kx 
     5         kx Usually it's in /bin/sh.  How did you even get this far?
     5         kx Please report this issue at https://github.com/Perl/perl5/issues
     5         kx and we'll try to straighten this all out.
     5         kx EOM
     5         kx 	exit 1
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
     5         kx : default both to the same thing, cross-compilers can then set targetsh differently if they like
     5         kx targetsh=$sh
     5         kx 
     5         kx : see if sh knows # comments
     5         kx if `$sh -c '#' >/dev/null 2>&1`; then
     5         kx 	shsharp=true
     5         kx 	spitshell=cat
     5         kx 	xcat=/bin/cat
     5         kx 	test -f $xcat$_exe || xcat=/usr/bin/cat
     5         kx 	if test ! -f $xcat$_exe; then
     5         kx 		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
     5         kx 			if test -f $p/cat$_exe; then
     5         kx 				xcat=$p/cat
     5         kx 				break
     5         kx 			fi
     5         kx 		done
     5         kx 		if test ! -f $xcat$_exe; then
     5         kx 			echo "Can't find cat anywhere!"
     5         kx 			exit 1
     5         kx 		fi
     5         kx 	fi
     5         kx 	echo "#!$xcat" >sharp
     5         kx 	$eunicefix sharp
     5         kx 	chmod +x sharp
     5         kx 	./sharp > today 2>/dev/null
     5         kx 	if test -s today; then
     5         kx 		sharpbang='#!'
     5         kx 	else
     5         kx 		echo "#! $xcat" > sharp
     5         kx 		$eunicefix sharp
     5         kx 		chmod +x sharp
     5         kx 		./sharp > today 2>/dev/null
     5         kx 		if test -s today; then
     5         kx 			sharpbang='#! '
     5         kx 		else
     5         kx 			sharpbang=': use '
     5         kx 		fi
     5         kx 	fi
     5         kx else
     5         kx 	echo " "
     5         kx 	echo "Your $sh doesn't grok # comments--I will strip them later on."
     5         kx 	shsharp=false
     5         kx 	cd ..
     5         kx 	echo "exec grep -v '^[ 	]*#'" >spitshell
     5         kx 	chmod +x spitshell
     5         kx 	$eunicefix spitshell
     5         kx 	spitshell=`pwd`/spitshell
     5         kx 	cd UU
     5         kx 	echo "I presume that if # doesn't work, #! won't work either!"
     5         kx 	sharpbang=': use '
     5         kx fi
     5         kx rm -f sharp today
     5         kx 
     5         kx : figure out how to guarantee sh startup
     5         kx case "$startsh" in
     5         kx '') startsh=${sharpbang}${sh} ;;
     5         kx *)
     5         kx esac
     5         kx cat >sharp <<EOSS
     5         kx $startsh
     5         kx set abc
     5         kx test "$?abc" != 1
     5         kx EOSS
     5         kx 
     5         kx chmod +x sharp
     5         kx $eunicefix sharp
     5         kx if ./sharp; then
     5         kx 	: echo "Yup, it does."
     5         kx else
     5         kx 	echo "Hmm... '$startsh' does not guarantee sh startup..."
     5         kx 	echo "You may have to fix up the shell scripts to make sure $sh runs them."
     5         kx fi
     5         kx rm -f sharp
     5         kx 
     5         kx : Save command line options in file UU/cmdline.opt for later use in
     5         kx : generating config.sh.
     5         kx cat > cmdline.opt <<EOSH
     5         kx : Configure command line arguments.
     5         kx config_arg0='$0'
     5         kx config_args='$*'
     5         kx config_argc=$#
     5         kx EOSH
     5         kx argn=1
     5         kx args_exp=''
     5         kx args_sep=''
     5         kx for arg in "$@"; do
     5         kx 	cat >>cmdline.opt <<EOSH
     5         kx config_arg$argn='$arg'
     5         kx EOSH
     5         kx 	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
     5         kx $arg
     5         kx EOC
     5         kx 	arg_exp=`cat cmdl.opt`
     5         kx 	args_exp="$args_exp$args_sep'$arg_exp'"
     5         kx 	argn=`expr $argn + 1`
     5         kx 	args_sep=' '
     5         kx done
     5         kx rm -f cmdl.opt
     5         kx 
     5         kx : produce awk script to parse command line options
     5         kx cat >options.awk <<'EOF'
     5         kx BEGIN {
     5         kx 	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
     5         kx 
     5         kx 	len = length(optstr);
     5         kx 	for (i = 1; i <= len; i++) {
     5         kx 		c = substr(optstr, i, 1);
     5         kx 		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
     5         kx 		if (a == ":") {
     5         kx 			arg[c] = 1;
     5         kx 			i++;
     5         kx 		}
     5         kx 		opt[c] = 1;
     5         kx 	}
     5         kx }
     5         kx {
     5         kx 	expect = 0;
     5         kx 	str = $0;
     5         kx 	if (substr(str, 1, 1) != "-") {
     5         kx 		printf("'%s'\n", str);
     5         kx 		next;
     5         kx 	}
     5         kx 	len = length($0);
     5         kx 	for (i = 2; i <= len; i++) {
     5         kx 		c = substr(str, i, 1);
     5         kx 		if (!opt[c]) {
     5         kx 			printf("-%s\n", substr(str, i));
     5         kx 			next;
     5         kx 		}
     5         kx 		printf("-%s\n", c);
     5         kx 		if (arg[c]) {
     5         kx 			if (i < len)
     5         kx 				printf("'%s'\n", substr(str, i + 1));
     5         kx 			else
     5         kx 				expect = 1;
     5         kx 			next;
     5         kx 		}
     5         kx 	}
     5         kx }
     5         kx END {
     5         kx 	if (expect)
     5         kx 		print "?";
     5         kx }
     5         kx EOF
     5         kx 
     5         kx : process the command line options
     5         kx set X `for arg in "$@"; do echo "X$arg"; done |
     5         kx 	sed -e s/X// | awk -f options.awk`
     5         kx eval "set $*"
     5         kx shift
     5         kx rm -f options.awk
     5         kx 
     5         kx : set up default values
     5         kx fastread=''
     5         kx reuseval=false
     5         kx config_sh=''
     5         kx alldone=''
     5         kx error=''
     5         kx silent=''
     5         kx extractsh=''
     5         kx knowitall=''
     5         kx rm -f optdef.sh posthint.sh
     5         kx cat >optdef.sh <<EOS
     5         kx $startsh
     5         kx EOS
     5         kx 
     5         kx 
     5         kx : option parsing
     5         kx while test $# -gt 0; do
     5         kx 	case "$1" in
     5         kx 	-d) shift; fastread=yes;;
     5         kx 	-e) shift; alldone=cont;;
     5         kx 	-f)
     5         kx 		shift
     5         kx 		cd ..
     5         kx 		if test -r "$1"; then
     5         kx 			config_sh="$1"
     5         kx 		else
     5         kx 			echo "$me: cannot read config file $1." >&2
     5         kx 			error=true
     5         kx 		fi
     5         kx 		cd UU
     5         kx 		shift;;
     5         kx 	--help|\
     5         kx 	-h) shift; error=true;;
     5         kx 	-r) shift; reuseval=true;;
     5         kx 	-s) shift; silent=true; realsilent=true;;
     5         kx 	-E) shift; alldone=exit;;
     5         kx 	-K) shift; knowitall=true;;
     5         kx 	-O) shift;;
     5         kx 	-S) shift; silent=true; extractsh=true;;
     5         kx 	-D)
     5         kx 		shift
     5         kx 		case "$1" in
     5         kx 		*=)
     5         kx 			echo "$me: use '-U symbol=', not '-D symbol='." >&2
     5         kx 			echo "$me: ignoring -D $1" >&2
     5         kx 			;;
     5         kx 		*=*) echo "$1" | \
     5         kx 				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
     5         kx 		*) echo "$1='define'" >> optdef.sh;;
     5         kx 		esac
     5         kx 		shift
     5         kx 		;;
     5         kx 	-U)
     5         kx 		shift
     5         kx 		case "$1" in
     5         kx 		*=) echo "$1" >> optdef.sh;;
     5         kx 		*=*)
     5         kx 			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
     5         kx 			echo "$me: ignoring -U $1" >&2
     5         kx 			;;
     5         kx 		*) echo "$1='undef'" >> optdef.sh;;
     5         kx 		esac
     5         kx 		shift
     5         kx 		;;
     5         kx 	-A)
     5         kx 	    shift
     5         kx 	    xxx=''
     5         kx 	    yyy="$1"
     5         kx 	    zzz=''
     5         kx 	    uuu=undef
     5         kx 	    case "$yyy" in
     5         kx             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
     5         kx                  case "$zzz" in
     5         kx                  *:*) zzz='' ;;
     5         kx                  *)   xxx=append
     5         kx                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
     5         kx                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
     5         kx                  esac
     5         kx                  ;;
     5         kx             esac
     5         kx             case "$xxx" in
     5         kx             '')  case "$yyy" in
     5         kx                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
     5         kx                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
     5         kx                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
     5         kx                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
     5         kx                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
     5         kx                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
     5         kx                  esac
     5         kx                  ;;
     5         kx             esac
     5         kx 	    case "$xxx" in
     5         kx 	    append)
     5         kx 		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
     5         kx 	    clear)
     5         kx 		echo "$yyy=''"			>> posthint.sh ;;
     5         kx 	    define)
     5         kx 	        case "$zzz" in
     5         kx 		'') zzz=define ;;
     5         kx 		esac
     5         kx 		echo "$yyy='$zzz'"		>> posthint.sh ;;
     5         kx 	    eval)
     5         kx 		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
     5         kx 	    prepend)
     5         kx 		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
     5         kx 	    undef)
     5         kx 	        case "$zzz" in
     5         kx 		'') zzz="$uuu" ;;
     5         kx 		esac
     5         kx 		echo "$yyy=$zzz"		>> posthint.sh ;;
     5         kx             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
     5         kx 	    esac
     5         kx 	    shift
     5         kx 	    ;;
     5         kx 	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
     5         kx 	    exit 0;;
     5         kx 	--) break;;
     5         kx 	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
     5         kx 	*) break;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx case "$error" in
     5         kx true)
     5         kx 	cat >&2 <<EOM
     5         kx Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
     5         kx                  [-U symbol] [-U symbol=] [-A command:symbol...]
     5         kx   -d : use defaults for all answers.
     5         kx   -e : go on without questioning past the production of config.sh.
     5         kx   -f : specify an alternate default configuration file.
     5         kx   -h : print this help message and exit (with an error status).
     5         kx   -r : reuse C symbols value if possible (skips costly nm extraction).
     5         kx   -s : silent mode, only echoes questions and essential information.
     5         kx   -D : define symbol to have some value:
     5         kx          -D symbol                symbol gets the value 'define'
     5         kx          -D symbol='some value'   symbol is set to 'some value'
     5         kx        common used examples (see INSTALL for more info):
     5         kx          -Duse64bitint            use 64bit integers
     5         kx          -Duse64bitall            use 64bit integers and pointers
     5         kx          -Dusethreads             use thread support
     5         kx          -Dinc_version_list=none  do not include older perl trees in @INC
     5         kx          -DEBUGGING=none          DEBUGGING options
     5         kx          -Dcc=gcc                 choose your compiler
     5         kx          -Dprefix=/opt/perl5      choose your destination
     5         kx   -E : stop at the end of questions, after having produced config.sh.
     5         kx   -K : do not use unless you know what you are doing.
     5         kx   -O : ignored for backward compatibility
     5         kx   -S : perform variable substitutions on all .SH files (can mix with -f)
     5         kx   -U : undefine symbol:
     5         kx          -U symbol    symbol gets the value 'undef'
     5         kx          -U symbol=   symbol gets completely empty
     5         kx        e.g.:  -Uversiononly
     5         kx   -A : manipulate symbol after the platform specific hints have been applied:
     5         kx          -A append:symbol=value   append value to symbol
     5         kx          -A symbol=value          like append:, but with a separating space
     5         kx          -A define:symbol=value   define symbol to have value
     5         kx          -A clear:symbol          define symbol to be ''
     5         kx          -A define:symbol         define symbol to be 'define'
     5         kx          -A eval:symbol=value     define symbol to be eval of value
     5         kx          -A prepend:symbol=value  prepend value to symbol
     5         kx          -A undef:symbol          define symbol to be 'undef'
     5         kx          -A undef:symbol=         define symbol to be ''
     5         kx        e.g.:  -A prepend:libswanted='cl pthread '
     5         kx               -A ccflags=-DSOME_MACRO
     5         kx   -V : print version number and exit (with a zero status).
     5         kx EOM
     5         kx 	exit 1
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Sanity checks
     5         kx case "$fastread$alldone" in
     5         kx yescont|yesexit) ;;
     5         kx *)
     5         kx 	case "$extractsh" in
     5         kx 	true) ;;
     5         kx 	*)
     5         kx 		if test ! -t 0; then
     5         kx 			echo "Say 'sh Configure', not 'sh <Configure'"
     5         kx 			exit 1
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx exec 4>&1
     5         kx case "$silent" in
     5         kx true) exec 1>/dev/null;;
     5         kx esac
     5         kx 
     5         kx : run the defines and the undefines, if any, but leave the file out there...
     5         kx touch optdef.sh
     5         kx grep '\\' optdef.sh >/dev/null 2>&1
     5         kx if test $? = 0; then
     5         kx     echo "Configure does not support \\ in -D arguments"
     5         kx     exit 1
     5         kx fi
     5         kx . ./optdef.sh
     5         kx : create the posthint manipulation script and leave the file out there...
     5         kx touch posthint.sh
     5         kx 
     5         kx : set package name
     5         kx package='perl5'
     5         kx first=`echo $package | sed -e 's/^\(.\).*/\1/'`
     5         kx last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
     5         kx case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
     5         kx ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
     5         kx *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
     5         kx esac
     5         kx 
     5         kx : Some greps do not return status, grrr.
     5         kx echo "grimblepritz" >grimble
     5         kx if grep blurfldyick grimble >/dev/null 2>&1 ; then
     5         kx 	contains=contains
     5         kx elif grep grimblepritz grimble >/dev/null 2>&1 ; then
     5         kx 	contains=grep
     5         kx else
     5         kx 	contains=contains
     5         kx fi
     5         kx rm -f grimble
     5         kx : the following should work in any shell
     5         kx case "$contains" in
     5         kx contains*)
     5         kx 	echo " " >&4
     5         kx 	echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
     5         kx 	cat >contains <<'EOSS'
     5         kx grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
     5         kx EOSS
     5         kx contains=./contains
     5         kx chmod +x $contains
     5         kx esac
     5         kx 
     5         kx : Find the path to the source tree
     5         kx case "$src" in
     5         kx '') case "$0" in
     5         kx     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
     5         kx          case "$src" in
     5         kx 	 /*)	;;
     5         kx 	 .)	;;
     5         kx          *)	src=`cd ../$src && pwd` ;;
     5         kx 	 esac
     5         kx          ;;
     5         kx     *)   src='.';;
     5         kx     esac;;
     5         kx esac
     5         kx case "$src" in
     5         kx '')	src=/
     5         kx 	rsrc=/
     5         kx 	;;
     5         kx /*)	rsrc="$src";;
     5         kx *)	rsrc="../$src";;
     5         kx esac
     5         kx if test -f $rsrc/Configure && \
     5         kx 	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
     5         kx then
     5         kx    : found it, so we are ok.
     5         kx else
     5         kx 	rsrc=''
     5         kx 	for src in . .. ../.. ../../.. ../../../..; do
     5         kx 		if test -f ../$src/Configure && \
     5         kx 			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
     5         kx 		then
     5         kx 			rsrc=../$src
     5         kx 			break
     5         kx 		fi
     5         kx 	done
     5         kx fi
     5         kx case "$rsrc" in
     5         kx '')
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx Sorry, I can't seem to locate the source dir for $package.  Please start
     5         kx Configure with an explicit path -- i.e. /some/path/Configure.
     5         kx 
     5         kx EOM
     5         kx 	exit 1
     5         kx 	;;
     5         kx ../.)	rsrc='..';;
     5         kx *)
     5         kx 	echo " "
     5         kx 	echo "Sources for $package found in \"$src\"." >&4
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : script used to extract .SH files with variable substitutions
     5         kx cat >extract <<'EOS'
     5         kx PERL_CONFIG_SH=true
     5         kx echo "Doing variable substitutions on .SH files..."
     5         kx if test -f MANIFEST; then
     5         kx 	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
     5         kx else
     5         kx 	echo "(Looking for .SH files under the source directory.)"
     5         kx 	set x `(cd "$src"; find . -name "*.SH" -print)`
     5         kx fi
     5         kx shift
     5         kx case $# in
     5         kx 0) set x `(cd "$src"; echo *.SH)`; shift;;
     5         kx esac
     5         kx if test ! -f "$src/$1"; then
     5         kx 	shift
     5         kx fi
     5         kx mkdir_p='
     5         kx name=$1;
     5         kx create="";
     5         kx while test $name; do
     5         kx 	if test ! -d "$name"; then
     5         kx 		create="$name $create";
     5         kx 		name=`echo $name | sed -e "s|^[^/]*$||"`;
     5         kx 		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
     5         kx 	else
     5         kx 		name="";
     5         kx 	fi;
     5         kx done;
     5         kx for file in $create; do
     5         kx 	mkdir $file;
     5         kx done
     5         kx '
     5         kx for file in $*; do
     5         kx 	case "$src" in
     5         kx 	".")
     5         kx 		case "$file" in
     5         kx 		*/*)
     5         kx 			dir=`expr X$file : 'X\(.*\)/'`
     5         kx 			file=`expr X$file : 'X.*/\(.*\)'`
     5         kx 			(cd "$dir" && . ./$file)
     5         kx 			;;
     5         kx 		*)
     5         kx 			. ./$file
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)
     5         kx 		case "$file" in
     5         kx 		*/*)
     5         kx 			dir=`expr X$file : 'X\(.*\)/'`
     5         kx 			file=`expr X$file : 'X.*/\(.*\)'`
     5         kx 			(set x $dir; shift; eval $mkdir_p)
     5         kx 			sh <"$src/$dir/$file"
     5         kx 			;;
     5         kx 		*)
     5         kx 			sh <"$src/$file"
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx if test -f "$src/config_h.SH"; then
     5         kx 	if test ! -f config.h; then
     5         kx 	: oops, they left it out of MANIFEST, probably, so do it anyway.
     5         kx 	. "$src/config_h.SH"
     5         kx 	fi
     5         kx fi
     5         kx EOS
     5         kx 
     5         kx : extract files and exit if asked to do so
     5         kx case "$extractsh" in
     5         kx true)
     5         kx 	case "$realsilent" in
     5         kx 	true) ;;
     5         kx 	*) exec 1>&4;;
     5         kx 	esac
     5         kx 	case "$config_sh" in
     5         kx 	'') config_sh='config.sh';;
     5         kx 	esac
     5         kx 	echo " "
     5         kx 	echo "Fetching answers from $config_sh..."
     5         kx 	cd ..
     5         kx 	. $config_sh
     5         kx 	. UU/optdef.sh
     5         kx 	echo " "
     5         kx 	. UU/extract
     5         kx 	rm -rf UU
     5         kx 	echo "Extraction done."
     5         kx 	exit 0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Eunice requires " " instead of "", can you believe it
     5         kx echo " "
     5         kx : Here we go...
     5         kx echo "Beginning of configuration questions for $package."
     5         kx 
     5         kx trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
     5         kx 
     5         kx : first determine how to suppress newline on echo command
     5         kx echo " "
     5         kx echo "Checking echo to see how to suppress newlines..."
     5         kx (echo "hi there\c" ; echo " ") >.echotmp
     5         kx if $contains c .echotmp >/dev/null 2>&1 ; then
     5         kx 	echo "...using -n."
     5         kx 	n='-n'
     5         kx 	c=''
     5         kx else
     5         kx 	cat <<'EOM'
     5         kx ...using \c
     5         kx EOM
     5         kx 	n=''
     5         kx 	c='\c'
     5         kx fi
     5         kx echo $n "The star should be here-->$c"
     5         kx echo '*'
     5         kx rm -f .echotmp
     5         kx 
     5         kx : Now test for existence of everything in MANIFEST
     5         kx echo " "
     5         kx if test -f "$rsrc/MANIFEST"; then
     5         kx 	echo "First let's make sure your kit is complete.  Checking..." >&4
     5         kx 	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
     5         kx 		(split -l 50 2>/dev/null || split -50)
     5         kx 	rm -f missing
     5         kx 	tmppwd=`pwd`
     5         kx 	for filelist in x??; do
     5         kx 		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
     5         kx 			>/dev/null 2>>"$tmppwd/missing")
     5         kx 	done
     5         kx 	if test -s missing; then
     5         kx 		cat missing >&4
     5         kx 		cat >&4 <<'EOM'
     5         kx 
     5         kx THIS PACKAGE SEEMS TO BE INCOMPLETE.
     5         kx 
     5         kx You have the option of continuing the configuration process, despite the
     5         kx distinct possibility that your kit is damaged, by typing 'y'es.  If you
     5         kx do, don't blame me if something goes wrong.  I advise you to type 'n'o
     5         kx and contact the author (https://github.com/Perl/perl5/issues).
     5         kx 
     5         kx EOM
     5         kx 		echo $n "Continue? [n] $c" >&4
     5         kx 		read ans
     5         kx 		case "$ans" in
     5         kx 		y*)
     5         kx 			echo "Continuing..." >&4
     5         kx 			rm -f missing
     5         kx 			;;
     5         kx 		*)
     5         kx 			echo "ABORTING..." >&4
     5         kx 			kill $$
     5         kx 			;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "Looks good..."
     5         kx 	fi
     5         kx else
     5         kx 	echo "There is no MANIFEST file.  I hope your kit is complete !"
     5         kx fi
     5         kx rm -f missing x??
     5         kx 
     5         kx : Find the appropriate value for a newline for tr
     5         kx if test -n "$DJGPP"; then
     5         kx        trnl='\012'
     5         kx fi
     5         kx if test X"$trnl" = X; then
     5         kx 	case "`echo foo | tr '\n' x 2>/dev/null`" in
     5         kx 	foox) trnl='\n' ;;
     5         kx 	esac
     5         kx fi
     5         kx if test X"$trnl" = X; then
     5         kx 	case "`echo foo | tr '\012' x 2>/dev/null`" in
     5         kx 	foox) trnl='\012' ;;
     5         kx 	esac
     5         kx fi
     5         kx if test X"$trnl" = X; then
     5         kx        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
     5         kx        fooxy) trnl='\n\r' ;;
     5         kx        esac
     5         kx fi
     5         kx if test X"$trnl" = X; then
     5         kx 	cat <<EOM >&2
     5         kx 
     5         kx $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
     5         kx 
     5         kx EOM
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx : compute the number of columns on the terminal for proper question formatting
     5         kx case "$COLUMNS" in
     5         kx '') COLUMNS='80';;
     5         kx esac
     5         kx 
     5         kx : set up the echo used in my read
     5         kx myecho="case \"\$xxxm\" in
     5         kx '') echo $n \"\$rp $c\" >&4;;
     5         kx *) case \"\$rp\" in
     5         kx 	'') echo $n \"[\$xxxm] $c\";;
     5         kx 	*)
     5         kx 		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
     5         kx 			echo \"\$rp\" >&4
     5         kx 			echo $n \"[\$xxxm] $c\" >&4
     5         kx 		else
     5         kx 			echo $n \"\$rp [\$xxxm] $c\" >&4
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac;;
     5         kx esac"
     5         kx 
     5         kx : now set up to do reads with possible shell escape and default assignment
     5         kx cat <<EOSC >myread
     5         kx $startsh
     5         kx xxxm=\$dflt
     5         kx $myecho
     5         kx ans='!'
     5         kx case "\$fastread" in
     5         kx yes) case "\$dflt" in
     5         kx 	'') ;;
     5         kx 	*) ans='';
     5         kx 		case "\$silent-\$rp" in
     5         kx 		true-) ;;
     5         kx 		*) echo " " >&4;;
     5         kx 		esac;;
     5         kx 	esac;;
     5         kx *) case "\$silent" in
     5         kx 	true) case "\$rp" in
     5         kx 		'') ans='';;
     5         kx 		esac;;
     5         kx 	esac;;
     5         kx esac
     5         kx while expr "X\$ans" : "X!" >/dev/null; do
     5         kx 	read answ
     5         kx 	set x \$xxxm
     5         kx 	shift
     5         kx 	aok=''; eval "ans=\\"\$answ\\"" && aok=y
     5         kx 	case  "\$answ" in
     5         kx 	"!")
     5         kx 		sh 1>&4
     5         kx 		echo " "
     5         kx 		$myecho
     5         kx 		;;
     5         kx 	!*)
     5         kx 		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
     5         kx 		shift
     5         kx 		sh 1>&4 -c "\$*"
     5         kx 		echo " "
     5         kx 		$myecho
     5         kx 		;;
     5         kx 	"\$ans")
     5         kx 		case "\$ans" in
     5         kx 		\\&*)
     5         kx 			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
     5         kx 			shift
     5         kx 			case "\$1" in
     5         kx 			-d)
     5         kx 				fastread=yes
     5         kx 				echo "(OK, I'll run with -d after this question.)" >&4
     5         kx 				;;
     5         kx 			-*)
     5         kx 				echo "*** Sorry, \$1 not supported yet." >&4
     5         kx 				;;
     5         kx 			esac
     5         kx 			$myecho
     5         kx 			ans=!
     5         kx 			;;
     5         kx 		esac;;
     5         kx 	*)
     5         kx 		case "\$aok" in
     5         kx 		y)
     5         kx 			echo "*** Substitution done -- please confirm."
     5         kx 			xxxm="\$ans"
     5         kx 			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
     5         kx 			xxxm="\$ans"
     5         kx 			ans=!
     5         kx 			;;
     5         kx 		*)
     5         kx 			echo "*** Error -- try again."
     5         kx 			ans=!
     5         kx 			;;
     5         kx 		esac
     5         kx 		$myecho
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "\$ans\$xxxm\$nostick" in
     5         kx 	'')
     5         kx 		ans=!
     5         kx 		$myecho
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx case "\$ans" in
     5         kx '') ans="\$xxxm";;
     5         kx esac
     5         kx EOSC
     5         kx 
     5         kx : create .config dir to save info across Configure sessions
     5         kx test -d ../.config || mkdir ../.config
     5         kx cat >../.config/README <<EOF
     5         kx This directory created by Configure to save information that should
     5         kx persist across sessions for $package.
     5         kx 
     5         kx You may safely delete it if you wish.
     5         kx EOF
     5         kx 
     5         kx : See if we are using a devel version and want that
     5         kx xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx case "$usedevel" in
     5         kx $define|true|[yY]*)
     5         kx     usedevel="$define" ;;
     5         kx *) case "$xversion" in
     5         kx    *[13579])
     5         kx 	cat >&4 <<EOH
     5         kx *** WHOA THERE!!! ***
     5         kx 
     5         kx     This is an UNSTABLE DEVELOPMENT release.
     5         kx     The version of this $package distribution is $xversion, that is, odd,
     5         kx     (as opposed to even) and that signifies a development release.
     5         kx     If you want a maintenance release, you want an even-numbered version.
     5         kx 
     5         kx     Do ***NOT*** install this into production use.
     5         kx     Data corruption and crashes are possible.
     5         kx 
     5         kx     It is most seriously suggested that you do not continue any further
     5         kx     unless you want to help in developing and debugging Perl.
     5         kx 
     5         kx     If you *still* want to build perl, you can answer 'y' now,
     5         kx     or pass -Dusedevel to Configure.
     5         kx 
     5         kx EOH
     5         kx 	rp='Do you really want to continue?'
     5         kx 	dflt='n'
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	[yY]) echo >&4 "Okay, continuing."
     5         kx 	      usedevel="$define" ;;
     5         kx 	*) echo >&4 "Okay, bye."
     5         kx 	   exit 1
     5         kx 	   ;;
     5         kx 	esac
     5         kx 	;;
     5         kx     esac
     5         kx     usedevel="$undef"
     5         kx     ;;
     5         kx esac
     5         kx case "$usedevel" in
     5         kx $define|true|[yY]*)
     5         kx 	case "$versiononly" in
     5         kx 	'') versiononly="$define" ;;
     5         kx 	esac
     5         kx 	case "$installusrbinperl" in
     5         kx 	'') installusrbinperl="$undef" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : general instructions
     5         kx needman=true
     5         kx firsttime=true
     5         kx user=`(logname) 2>/dev/null`
     5         kx case "$user" in
     5         kx '') user=`whoami 2>&1`;;
     5         kx esac
     5         kx if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
     5         kx 	firsttime=false
     5         kx 	echo " "
     5         kx 	rp='Would you like to see the instructions?'
     5         kx 	dflt=n
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	[yY]*) ;;
     5         kx 	*) needman=false;;
     5         kx 	esac
     5         kx fi
     5         kx if $needman; then
     5         kx 	cat <<EOH
     5         kx 
     5         kx This installation shell script will examine your system and ask you questions
     5         kx to determine how the perl5 package should be installed. If you get
     5         kx stuck on a question, you may use a ! shell escape to start a subshell or
     5         kx execute a command.  Many of the questions will have default answers in square
     5         kx brackets; typing carriage return will give you the default.
     5         kx 
     5         kx On some of the questions which ask for file or directory names you are allowed
     5         kx to use the ~name construct to specify the login directory belonging to "name",
     5         kx even if you don't have a shell which knows about that.  Questions where this is
     5         kx allowed will be marked "(~name ok)".
     5         kx 
     5         kx EOH
     5         kx 	rp=''
     5         kx 	dflt='Type carriage return to continue'
     5         kx 	. ./myread
     5         kx 	cat <<'EOH'
     5         kx 
     5         kx The prompter used in this script allows you to use shell variables and
     5         kx backticks in your answers.  You may use $1, $2, etc...  to refer to the words
     5         kx in the default answer, as if the default line was a set of arguments given to a
     5         kx script shell.  This means you may also use $* to repeat the whole default line,
     5         kx so you do not have to re-type everything to add something to the default.
     5         kx 
     5         kx Every time there is a substitution, you will have to confirm.  If there is an
     5         kx error (e.g. an unmatched backtick), the default answer will remain unchanged
     5         kx and you will be prompted again.
     5         kx 
     5         kx If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
     5         kx the questions and use the computed defaults (or the previous answers if there
     5         kx was already a config.sh file). Type 'Configure -h' for a list of options.
     5         kx You may also start interactively and then answer '& -d' at any prompt to turn
     5         kx on the non-interactive behaviour for the remainder of the execution.
     5         kx 
     5         kx EOH
     5         kx 	. ./myread
     5         kx 	cat <<EOH
     5         kx 
     5         kx Much effort has been expended to ensure that this shell script will run on any
     5         kx Unix system.  If despite that it blows up on yours, your best bet is to edit
     5         kx Configure and run it again.  If you can't run Configure for some reason,
     5         kx you'll have to generate a config.sh file by hand.  Whatever problems you
     5         kx have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
     5         kx 
     5         kx This installation script affects things in two ways:
     5         kx 
     5         kx 1) it may do direct variable substitutions on some of the files included
     5         kx    in this kit.
     5         kx 2) it builds a config.h file for inclusion in C programs.  You may edit
     5         kx    any of these files as the need arises after running this script.
     5         kx 
     5         kx If you make a mistake on a question, there is no easy way to back up to it
     5         kx currently.  The easiest thing to do is to edit config.sh and rerun all the SH
     5         kx files.  Configure will offer to let you do this before it runs the SH files.
     5         kx 
     5         kx EOH
     5         kx 	dflt='Type carriage return to continue'
     5         kx 	. ./myread
     5         kx 	case "$firsttime" in
     5         kx 	true) echo $user >>../.config/instruct;;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
     5         kx : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
     5         kx if test "X$sysroot" = X; then
     5         kx     sysroot=""
     5         kx else
     5         kx     case "$cc" in
     5         kx 	*gcc*|*g++*)
     5         kx 	    echo "Using $sysroot to find your headers and libraries, adding to ccflags"
     5         kx 	    # _sysroot is used in places where we need --sysroot=foo
     5         kx 	    # but using the rest of the flags could cause issues.
     5         kx 	    _sysroot="--sysroot=$sysroot";
     5         kx 	    case "$ccflags" in
     5         kx 		*sysroot*) ;;
     5         kx 		'undef'|*)
     5         kx 		ccflags="$ccflags $_sysroot"
     5         kx 	    esac
     5         kx 	    case "$ldflags" in
     5         kx 		*sysroot*) ;;
     5         kx 		'undef'|*)
     5         kx 		ldflags="$ldflags $_sysroot"
     5         kx 	    esac
     5         kx 	    case "$cppflags" in
     5         kx 		*sysroot*) ;;
     5         kx 		'undef'|*)
     5         kx 		cppflags="$cppflags $_sysroot"
     5         kx 	    esac
     5         kx 	    # lddlflags updated below in lddlflags section;
     5         kx 	    # same with cccdlflags
     5         kx 	    ;;
     5         kx     esac
     5         kx 
     5         kx     # Adjust some defaults to also use $sysroot
     5         kx     for var in xlibpth loclibpth locincpth glibpth; do
     5         kx 	eval xxx=\$$var
     5         kx 	eval $var=''
     5         kx 	for path in $xxx; do
     5         kx 	    eval $var=\"\$$var $sysroot$path\"
     5         kx 	done
     5         kx     done
     5         kx 
     5         kx fi
     5         kx 
     5         kx : find out where common programs are
     5         kx echo " "
     5         kx echo "Locating common programs..." >&4
     5         kx cat <<EOSC >loc
     5         kx $startsh
     5         kx case \$# in
     5         kx 0) exit 1;;
     5         kx esac
     5         kx thing=\$1
     5         kx shift
     5         kx dflt=\$1
     5         kx shift
     5         kx for dir in \$*; do
     5         kx 	case "\$thing" in
     5         kx 	.)
     5         kx 	if test -d \$dir/\$thing; then
     5         kx 		echo \$dir
     5         kx 		exit 0
     5         kx 	fi
     5         kx 	;;
     5         kx 	*)
     5         kx 	for thisthing in \$dir/\$thing; do
     5         kx 		: just loop through to pick last item
     5         kx 	done
     5         kx 	if test -f \$thisthing; then
     5         kx 		echo \$thisthing
     5         kx 		exit 0
     5         kx 	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
     5         kx 		echo \$thisthing
     5         kx 		exit 0
     5         kx 	elif test -f \$dir/\$thing.exe; then
     5         kx 		if test -n "$DJGPP"; then
     5         kx 			echo \$dir/\$thing.exe
     5         kx 		elif test "$eunicefix" != ":"; then
     5         kx 			: on Eunice apparently
     5         kx 			echo \$dir/\$thing
     5         kx 		fi
     5         kx 		exit 0
     5         kx 	fi
     5         kx 	;;
     5         kx 	esac
     5         kx done
     5         kx echo \$dflt
     5         kx exit 1
     5         kx EOSC
     5         kx chmod +x loc
     5         kx $eunicefix loc
     5         kx loclist="
     5         kx awk
     5         kx cat
     5         kx chmod
     5         kx comm
     5         kx cp
     5         kx echo
     5         kx expr
     5         kx grep
     5         kx ls
     5         kx mkdir
     5         kx rm
     5         kx sed
     5         kx sort
     5         kx touch
     5         kx tr
     5         kx uniq
     5         kx "
     5         kx trylist="
     5         kx ar
     5         kx bison
     5         kx byacc
     5         kx cpp
     5         kx csh
     5         kx date
     5         kx egrep
     5         kx gmake
     5         kx gzip
     5         kx less
     5         kx ln
     5         kx make
     5         kx more
     5         kx nm
     5         kx nroff
     5         kx perl
     5         kx pg
     5         kx test
     5         kx uname
     5         kx zip
     5         kx "
     5         kx pth=`echo $PATH | sed -e "s/$p_/ /g"`
     5         kx pth="$pth $sysroot/lib $sysroot/usr/lib"
     5         kx for file in $loclist; do
     5         kx 	eval xxx=\$$file
     5         kx 	case "$xxx" in
     5         kx 	/*|?:[\\/]*)
     5         kx 		if test -f "$xxx"; then
     5         kx 			: ok
     5         kx 		else
     5         kx 			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
     5         kx 			xxx=`./loc $file $file $pth`
     5         kx 		fi
     5         kx 		;;
     5         kx 	'') xxx=`./loc $file $file $pth`;;
     5         kx 	*) xxx=`./loc $xxx $xxx $pth`;;
     5         kx 	esac
     5         kx 	eval $file=$xxx$_exe
     5         kx 	eval _$file=$xxx
     5         kx 	case "$xxx" in
     5         kx 	/*)
     5         kx 		echo $file is in $xxx.
     5         kx 		;;
     5         kx 	?:[\\/]*)
     5         kx 		echo $file is in $xxx.
     5         kx 		;;
     5         kx 	*)
     5         kx 		echo "I don't know where '$file' is, and my life depends on it." >&4
     5         kx 		echo "Go find a public domain implementation or fix your PATH setting!" >&4
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx echo " "
     5         kx echo "Don't worry if any of the following aren't found..."
     5         kx say=offhand
     5         kx for file in $trylist; do
     5         kx 	eval xxx=\$$file
     5         kx 	case "$xxx" in
     5         kx 	/*|?:[\\/]*)
     5         kx 		if test -f "$xxx"; then
     5         kx 			: ok
     5         kx 		else
     5         kx 			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
     5         kx 			xxx=`./loc $file $file $pth`
     5         kx 		fi
     5         kx 		;;
     5         kx 	'') xxx=`./loc $file $file $pth`;;
     5         kx 	*) xxx=`./loc $xxx $xxx $pth`;;
     5         kx 	esac
     5         kx 	eval $file=$xxx$_exe
     5         kx 	eval _$file=$xxx
     5         kx 	case "$xxx" in
     5         kx 	/*)
     5         kx 		echo $file is in $xxx.
     5         kx 		;;
     5         kx 	?:[\\/]*)
     5         kx 		echo $file is in $xxx.
     5         kx 		;;
     5         kx 	*)
     5         kx 		echo "I don't see $file out there, $say."
     5         kx 		say=either
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx case "$egrep" in
     5         kx egrep)
     5         kx 	echo "Substituting grep for egrep."
     5         kx 	egrep=$grep
     5         kx 	_egrep=$grep
     5         kx 	;;
     5         kx esac
     5         kx case "$less" in
     5         kx '')	;;
     5         kx *)	if $less -R </dev/null >/dev/null 2>&1; then
     5         kx 	       echo "Substituting less -R for less."
     5         kx 	       less="$less -R"
     5         kx 	       _less=$less
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx case "$ln" in
     5         kx ln)
     5         kx 	echo "Substituting cp for ln."
     5         kx 	ln=$cp
     5         kx 	_ln=$cp
     5         kx 	;;
     5         kx esac
     5         kx case "$make" in
     5         kx make)
     5         kx 	case "$gmake" in
     5         kx 	gmake)
     5         kx 	echo "I can't find make or gmake, and my life depends on it." >&4
     5         kx 	echo "Go find a public domain implementation or fix your PATH setting!" >&4
     5         kx 	exit 1
     5         kx 	;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$gmake" in
     5         kx gmake)	;;
     5         kx *)	# We can't have osname yet.
     5         kx 	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
     5         kx 		# Assume that gmake, if found, is definitely GNU make
     5         kx 		# and prefer it over the system make.
     5         kx 		echo "Substituting gmake for make."
     5         kx 		make=$gmake
     5         kx 		_make=$gmake
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx case "$test" in
     5         kx test)
     5         kx 	echo "Hopefully test is built into your sh."
     5         kx 	;;
     5         kx *)
     5         kx 	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
     5         kx 		echo "Using the test built into your sh."
     5         kx 		test=test
     5         kx 		_test=test
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx case "$echo" in
     5         kx echo)
     5         kx 	echo "Hopefully echo is built into your sh."
     5         kx 	;;
     5         kx '') ;;
     5         kx *)
     5         kx 	echo " "
     5         kx echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
     5         kx 	$echo $n "hi there$c" >foo1
     5         kx 	echo $n "hi there$c" >foo2
     5         kx 	if cmp foo1 foo2 >/dev/null 2>&1; then
     5         kx 		echo "They are compatible.  In fact, they may be identical."
     5         kx 	else
     5         kx 		case "$n" in
     5         kx 		'-n') n='' c='\c';;
     5         kx 		*) n='-n' c='';;
     5         kx 		esac
     5         kx 		cat <<FOO
     5         kx They are not compatible!  You are probably running ksh on a non-USG system.
     5         kx I'll have to use $echo instead of the builtin, since Bourne shell doesn't
     5         kx have echo built in and we may have to run some Bourne shell scripts.  That
     5         kx means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
     5         kx 
     5         kx FOO
     5         kx 		$echo $n "The star should be here-->$c"
     5         kx 		$echo "*"
     5         kx 	fi
     5         kx 	$rm -f foo1 foo2
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx # This question was auctioned at YAPC::Europe-2007 in Vienna
     5         kx # I never promised you could answer it. I only auctioned the question.
     5         kx cat <<FOO
     5         kx The following message is sponsored by
     5         kx 
     5         kx   Dresden.pm<--The stars should be here.
     5         kx 
     5         kx Dear Perl user, system administrator or package
     5         kx maintainer, the Perl community sends greetings to
     5         kx you. Do you (emblematical) greet back [Y/n]? n
     5         kx 
     5         kx FOO
     5         kx 
     5         kx : Check what type of C compiler we use
     5         kx cat <<EOS >trygcc
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>trygcc
     5         kx case "$cc" in
     5         kx '') ;;
     5         kx *)  $rm -f try try.*
     5         kx     $cat >try.c <<EOM
     5         kx int main(int argc, char *argv[]) {
     5         kx   return 0;
     5         kx }
     5         kx EOM
     5         kx     if $cc -o try $ccflags $ldflags try.c; then
     5         kx        :
     5         kx     else
     5         kx         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
     5         kx         despair=yes
     5         kx         trygcc=yes
     5         kx         case "$cc" in
     5         kx         *gcc*) trygcc=no ;;
     5         kx         esac
     5         kx 	# Skip this test because it gives a false match on output like:
     5         kx 	#    ./trygcc: line 23: cc: command not found
     5         kx         # case "`$cc -v -c try.c 2>&1`" in
     5         kx         # *gcc*) trygcc=no ;;
     5         kx         # esac
     5         kx         if $test X"$trygcc" = Xyes; then
     5         kx             if gcc -o try -c try.c; then
     5         kx                 echo " "
     5         kx                 echo "You seem to have a working gcc, though." >&4
     5         kx 		# Switching compilers may undo the work of hints files.
     5         kx 		# The most common problem is -D_REENTRANT for threads.
     5         kx 		# This heuristic catches that case, but gets false positives
     5         kx 		# if -Dusethreads was not actually specified.  Better to
     5         kx 		# bail out here with a useful message than fail
     5         kx 		# mysteriously later. Should we perhaps just try to
     5         kx 		# re-invoke Configure -Dcc=gcc config_args ?
     5         kx 		if $test -f usethreads.cbu; then
     5         kx 			$cat >&4 <<EOM
     5         kx 
     5         kx *** However, any setting of the C compiler flags (e.g. for thread support)
     5         kx *** will be lost.  It may be necessary for you to restart Configure and
     5         kx *** add -Dcc=gcc to your Configure command line.
     5         kx 
     5         kx EOM
     5         kx 			rp="Would you like to go ahead and try gcc anyway?"
     5         kx 			dflt=n
     5         kx 		else
     5         kx 			rp="Would you like to use it?"
     5         kx 			dflt=y
     5         kx 		fi
     5         kx                 if $test -f myread; then
     5         kx                     . ./myread
     5         kx                 else
     5         kx                     if $test -f UU/myread; then
     5         kx                         . ./UU/myread
     5         kx                     else
     5         kx                         echo "Cannot find myread, sorry.  Aborting." >&4
     5         kx                         exit 1
     5         kx                     fi
     5         kx                 fi
     5         kx                 case "$ans" in
     5         kx                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
     5         kx                 esac
     5         kx             fi
     5         kx         fi
     5         kx     fi
     5         kx     $rm -f try try.*
     5         kx     ;;
     5         kx esac
     5         kx EOSC
     5         kx 
     5         kx cat <<EOS >checkcc
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>checkcc
     5         kx case "$cc" in
     5         kx '') ;;
     5         kx *)  $rm -f try try.*
     5         kx     $cat >try.c <<EOM
     5         kx int main(int argc, char *argv[]) {
     5         kx   return 0;
     5         kx }
     5         kx EOM
     5         kx     if $cc -o try $ccflags $ldflags try.c; then
     5         kx        :
     5         kx     else
     5         kx         if $test X"$despair" = Xyes; then
     5         kx            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
     5         kx         fi
     5         kx         $cat >&4 <<EOM
     5         kx You need to find a working C compiler.
     5         kx Either (purchase and) install the C compiler supplied by your OS vendor,
     5         kx or for a free C compiler try http://gcc.gnu.org/
     5         kx I cannot continue any further, aborting.
     5         kx EOM
     5         kx         exit 1
     5         kx     fi
     5         kx     $rm -f try try.*
     5         kx     ;;
     5         kx esac
     5         kx EOSC
     5         kx 
     5         kx : determine whether symbolic links are supported
     5         kx echo " "
     5         kx $touch blurfl
     5         kx if $ln -s blurfl sym > /dev/null 2>&1 ; then
     5         kx 	echo "Symbolic links are supported." >&4
     5         kx 	lns="$ln -s"
     5         kx else
     5         kx 	echo "Symbolic links are NOT supported." >&4
     5         kx 	lns="$ln"
     5         kx fi
     5         kx $rm -f blurfl sym
     5         kx 
     5         kx : determine whether symbolic links are supported
     5         kx echo " "
     5         kx case "$lns" in
     5         kx *"ln"*" -s")
     5         kx 	echo "Checking how to test for symbolic links..." >&4
     5         kx 	$lns blurfl sym
     5         kx 	if $test "X$issymlink" = X; then
     5         kx 		case "$newsh" in
     5         kx 		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
     5         kx 		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
     5         kx 		esac
     5         kx 		if test $? = 0; then
     5         kx 			issymlink="test -h"
     5         kx 		else
     5         kx 			echo "Your builtin 'test -h' may be broken." >&4
     5         kx 			case "$test" in
     5         kx 			/*)	;;
     5         kx 			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
     5         kx 				for p in $pth
     5         kx 				do
     5         kx 					if test -f "$p/$test"; then
     5         kx 						test="$p/$test"
     5         kx 						break
     5         kx 					fi
     5         kx 				done
     5         kx 				;;
     5         kx 			esac
     5         kx 			case "$test" in
     5         kx 			/*)
     5         kx 				echo "Trying external '$test -h'." >&4
     5         kx 				issymlink="$test -h"
     5         kx 				if $test ! -h sym >/dev/null 2>&1; then
     5         kx 					echo "External '$test -h' is broken, too." >&4
     5         kx 					issymlink=''
     5         kx 				fi
     5         kx 				;;
     5         kx 			*)	issymlink='' ;;
     5         kx 			esac
     5         kx 		fi
     5         kx 	fi
     5         kx 	if $test "X$issymlink" = X; then
     5         kx 		if $test -L sym 2>/dev/null; then
     5         kx 			issymlink="$test -L"
     5         kx 			echo "The builtin '$test -L' worked." >&4
     5         kx 		fi
     5         kx 	fi
     5         kx 	if $test "X$issymlink" != X; then
     5         kx 		echo "You can test for symbolic links with '$issymlink'." >&4
     5         kx 	else
     5         kx 		echo "I do not know how you can test for symbolic links." >&4
     5         kx 	fi
     5         kx 	$rm -f blurfl sym
     5         kx 	;;
     5         kx *)	echo "No symbolic links, so not testing for their testing..." >&4
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Make symlinks util
     5         kx case "$mksymlinks" in
     5         kx $define|true|[yY]*)
     5         kx 	case "$src" in
     5         kx 	''|'.')	echo "Cannot create symlinks in the original directory." >&4
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	*)	case "$lns:$issymlink" in
     5         kx 		*"ln"*" -s:"*"test -"?)
     5         kx 			echo "Creating the symbolic links..." >&4
     5         kx 			cd ..
     5         kx 			awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
     5         kx 			awk 'NF == 1 {
     5         kx 				dir=".";
     5         kx 				file=$1 "";
     5         kx 			     }
     5         kx 			     NF == 2 {
     5         kx 				dir=$1 "";
     5         kx 				file=$2 "";
     5         kx 			     }
     5         kx 			     {
     5         kx 				 print "# dir = ", dir, "file = ", file
     5         kx 				 mf[dir] = mf[dir]" "source"/"dir"/"file;
     5         kx 			     } END {
     5         kx 				 for (d in mf) {
     5         kx 				     if (d != ".") { print("mkdir -p "d) }
     5         kx 				     print("ln -sf "mf[d]" "d);
     5         kx 				 }
     5         kx 			     }' source="$src" > UU/mksymlinks.$$
     5         kx 			sh UU/mksymlinks.$$
     5         kx 			rm UU/mksymlinks.$$
     5         kx 			# Sanity check 1.
     5         kx 			if test ! -d t/base; then
     5         kx 				echo "Failed to create the subdirectories.  Aborting." >&4
     5         kx 				exit 1
     5         kx 			fi
     5         kx 			# Sanity check 2.
     5         kx 			if test ! -f t/base/lex.t; then
     5         kx 				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
     5         kx 				exit 1
     5         kx 			fi
     5         kx 			if test ! -f win32/win32.c; then
     5         kx 				echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
     5         kx 				exit 1
     5         kx 			fi
     5         kx 			cd UU
     5         kx 			;;
     5         kx 		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check for Cross-Compilation
     5         kx if $test "X$targethost" = "X"; then
     5         kx     targethost=""
     5         kx fi
     5         kx if $test "X$targetenv" = "X"; then
     5         kx     targetenv=""
     5         kx fi
     5         kx case "$usecrosscompile" in
     5         kx $define|true|[yY]*)
     5         kx 	$echo "Cross-compiling..."
     5         kx 	croak=''
     5         kx 	case "$cc" in
     5         kx 	*-gcc*|*-g++*) # A cross-compiling gcc, probably.
     5         kx 	    # arm-linux-androideabi-gcc  -> arm-linux-androideabi
     5         kx 	    # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
     5         kx 	    targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
     5         kx 	    ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
     5         kx 	    # leave out ld, choosing it is more complex
     5         kx 	    nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
     5         kx 	    ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
     5         kx 	    # We are in a weird spot. Just before us, some values
     5         kx 	    # were 'saved', to be restored after the hints are
     5         kx 	    # run.  This means that the changes we made to ar,
     5         kx 	    # nm and ranlib will get reverted.
     5         kx 	    # To avoid that, we hijack the saving mechanism and
     5         kx 	    # have it save our new values.
     5         kx 	    for file in ar nm ranlib; do
     5         kx 		eval xxx=\$$file
     5         kx 		eval $file=$xxx$_exe
     5         kx 		eval _$file=$xxx
     5         kx 	    done
     5         kx 	;;
     5         kx 	esac
     5         kx 	case "$targetarch" in
     5         kx 	'') echo "Targetarch not defined." >&4; croak=y ;;
     5         kx 	*)  echo "Using targetarch $targetarch." >&4 ;;
     5         kx 	esac
     5         kx 	case "$targethost" in
     5         kx 	'') echo "Targethost not defined." >&4; croak=n ;;
     5         kx 	*)  echo "Using targethost $targethost." >&4
     5         kx 	esac
     5         kx 	locincpth=' '
     5         kx 	loclibpth=' '
     5         kx 	case "$croak" in
     5         kx 	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
     5         kx 	esac
     5         kx     : compile a host miniperl and generate_uudmap, unless we got passed them
     5         kx     if $test "X$hostperl" = X; then
     5         kx       echo "Building host miniperl and generate_uudmap binaries" >&4
     5         kx       before_host=`pwd`
     5         kx       cd ..
     5         kx       cd $src
     5         kx       src=`pwd`
     5         kx       rm -rf $src/host
     5         kx       mkdir $src/host
     5         kx       cd $src/host
     5         kx       $src/Configure -des -Dusedevel -Dmksymlinks
     5         kx       $make miniperl
     5         kx       case "$hostgenerate" in
     5         kx       '') $make generate_uudmap
     5         kx           hostgenerate=$src/host/generate_uudmap
     5         kx           ;;
     5         kx        "$undef") hostgenerate=''
     5         kx           ;;
     5         kx       esac
     5         kx       hostperl=$src/host/miniperl
     5         kx       cd $before_host
     5         kx     fi
     5         kx     hostosname=`$hostperl -le 'print $^O'`
     5         kx     ;;
     5         kx *)
     5         kx     usecrosscompile="$undef"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Define -Dtargethost=somecomputer to run compiled tests on another machine
     5         kx case "$targethost" in
     5         kx     '') echo "Checking for cross-compile" >&4
     5         kx     case "$usecrosscompile$multiarch" in
     5         kx        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
     5         kx          if [ -f Makefile ]; then
     5         kx            echo " "
     5         kx            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
     5         kx          else
     5         kx            echo "Configure done."
     5         kx          fi
     5         kx        exit 0
     5         kx        ;;
     5         kx      *) echo "No targethost for running compiler tests against defined, running locally" >&4
     5         kx         run=''
     5         kx         to=:
     5         kx         from=:
     5         kx         ;;
     5         kx     esac
     5         kx     ;;
     5         kx     *) echo "Using targethost $targethost." >&4
     5         kx 	case "$src" in
     5         kx 	/*) run=$src/Cross/run
     5         kx 	    targetmkdir=$src/Cross/mkdir
     5         kx 	    to=$src/Cross/to
     5         kx 	    from=$src/Cross/from
     5         kx 	    ;;
     5         kx 	*)  pwd=`$test -f ../Configure & cd ..; pwd`
     5         kx 	    run=$pwd/Cross/run
     5         kx 	    targetmkdir=$pwd/Cross/mkdir
     5         kx 	    to=$pwd/Cross/to
     5         kx 	    from=$pwd/Cross/from
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	case "$targetrun" in
     5         kx 	'') targetrun=ssh ;;
     5         kx 	esac
     5         kx 	case "$targetto" in
     5         kx 	'') targetto=scp ;;
     5         kx 	esac
     5         kx 	case "$targetfrom" in
     5         kx 	'') targetfrom=scp ;;
     5         kx 	esac
     5         kx 	run=$run-$targetrun
     5         kx 	to=$to-$targetto
     5         kx 	from=$from-$targetfrom
     5         kx 	case "$targetdir" in
     5         kx 	'')  targetdir=/tmp
     5         kx 	     echo "Guessing targetdir $targetdir." >&4
     5         kx 	     ;;
     5         kx 	esac
     5         kx 	case "$targetuser" in
     5         kx 	'')  targetuser=root
     5         kx 	     echo "Guessing targetuser $targetuser." >&4
     5         kx 	     ;;
     5         kx 	esac
     5         kx 	case "$targetport" in
     5         kx 	'')  targetport=22
     5         kx 	     echo "Guessing targetport $targetport." >&4
     5         kx 	     ;;
     5         kx 	esac
     5         kx 	case "$targetfrom" in
     5         kx 	scp)	q=-q ;;
     5         kx 	*)	q='' ;;
     5         kx 	esac
     5         kx 	case "$targetrun" in
     5         kx 	ssh|rsh)
     5         kx 	    cat >$run <<EOF
     5         kx #!/bin/sh
     5         kx env=''
     5         kx case "\$1" in
     5         kx -cwd)
     5         kx   shift
     5         kx   cwd=\$1
     5         kx   shift
     5         kx   ;;
     5         kx esac
     5         kx case "\$1" in
     5         kx -env)
     5         kx   shift
     5         kx   env=\$1
     5         kx   shift
     5         kx   ;;
     5         kx esac
     5         kx case "\$cwd" in
     5         kx '') cwd=$targetdir ;;
     5         kx esac
     5         kx exe=\$1
     5         kx shift
     5         kx $to \$exe
     5         kx $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
     5         kx EOF
     5         kx 	    ;;
     5         kx 	adb)
     5         kx 	    $touch $run
     5         kx 	    ;;
     5         kx 	*)  echo "Unknown targetrun '$targetrun'" >&4
     5         kx 	    exit 1
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	case "$targetmkdir" in
     5         kx 	*/Cross/mkdir)
     5         kx 	    cat >$targetmkdir <<EOF
     5         kx #!/bin/sh
     5         kx $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
     5         kx EOF
     5         kx 	    $chmod a+rx $targetmkdir
     5         kx 	    ;;
     5         kx 	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
     5         kx 	    exit 1
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	case "$targetto" in
     5         kx 	scp|rcp)
     5         kx 	    cat >$to <<EOF
     5         kx #!/bin/sh
     5         kx for f in \$@
     5         kx do
     5         kx   case "\$f" in
     5         kx   /*)
     5         kx     $targetmkdir \`dirname \$f\`
     5         kx     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
     5         kx     ;;
     5         kx   *)
     5         kx     $targetmkdir $targetdir/\`dirname \$f\`
     5         kx     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
     5         kx     ;;
     5         kx   esac
     5         kx done
     5         kx exit 0
     5         kx EOF
     5         kx 	    ;;
     5         kx 	cp) cat >$to <<EOF
     5         kx #!/bin/sh
     5         kx for f in \$@
     5         kx do
     5         kx   case "\$f" in
     5         kx   /*)
     5         kx     $mkdir -p $targetdir/\`dirname \$f\`
     5         kx     $cp \$f $targetdir/\$f || exit 1
     5         kx     ;;
     5         kx   *)
     5         kx     $targetmkdir $targetdir/\`dirname \$f\`
     5         kx     $cp \$f $targetdir/\$f || exit 1
     5         kx     ;;
     5         kx   esac
     5         kx done
     5         kx exit 0
     5         kx EOF
     5         kx 	    ;;
     5         kx 	*)  echo "Unknown targetto '$targetto'" >&4
     5         kx 	    exit 1
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	case "$targetfrom" in
     5         kx 	scp|rcp)
     5         kx 	  cat >$from <<EOF
     5         kx #!/bin/sh
     5         kx for f in \$@
     5         kx do
     5         kx   $rm -f \$f
     5         kx   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
     5         kx done
     5         kx exit 0
     5         kx EOF
     5         kx 	    ;;
     5         kx 	cp) cat >$from <<EOF
     5         kx #!/bin/sh
     5         kx for f in \$@
     5         kx do
     5         kx   $rm -f \$f
     5         kx   cp $targetdir/\$f . || exit 1
     5         kx done
     5         kx exit 0
     5         kx EOF
     5         kx 	    ;;
     5         kx 	*)  echo "Unknown targetfrom '$targetfrom'" >&4
     5         kx 	    exit 1
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	if $test ! -f $run; then
     5         kx 	    echo "Target 'run' script '$run' not found." >&4
     5         kx 	else
     5         kx 	    $chmod a+rx $run
     5         kx 	fi
     5         kx 	if $test ! -f $to; then
     5         kx 	    echo "Target 'to' script '$to' not found." >&4
     5         kx 	else
     5         kx 	    $chmod a+rx $to
     5         kx 	fi
     5         kx 	if $test ! -f $from; then
     5         kx 	    echo "Target 'from' script '$from' not found." >&4
     5         kx 	else
     5         kx 	    $chmod a+rx $from
     5         kx 	fi
     5         kx 	if $test ! -f $run -o ! -f $to -o ! -f $from; then
     5         kx 	    exit 1
     5         kx 	fi
     5         kx 	cat >&4 <<EOF
     5         kx Using '$run' for remote execution,
     5         kx and '$from' and '$to'
     5         kx for remote file transfer.
     5         kx EOF
     5         kx 	;;
     5         kx *)	run=''
     5         kx 	to=:
     5         kx 	from=:
     5         kx 	usecrosscompile="$undef"
     5         kx 	targetarch=''
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see whether [:lower:] and [:upper:] are supported character classes
     5         kx echo " "
     5         kx case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
     5         kx ABYZ-abyz)
     5         kx 	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
     5         kx 	up='[:upper:]'
     5         kx 	low='[:lower:]'
     5         kx 	;;
     5         kx *)	# There is a discontinuity in EBCDIC between 'R' and 'S'
     5         kx 	# (0xd9 and 0xe2), therefore that is a nice testing point.
     5         kx 	if test "X$up" = X -o "X$low" = X; then
     5         kx 	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
     5         kx 	    rs) up='[A-Z]'
     5         kx 		low='[a-z]'
     5         kx 		;;
     5         kx 	    esac
     5         kx 	fi
     5         kx 	if test "X$up" = X -o "X$low" = X; then
     5         kx 	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
     5         kx 	    rs) up='A-Z'
     5         kx 		low='a-z'
     5         kx 		;;
     5         kx 	    esac
     5         kx 	fi
     5         kx 	if test "X$up" = X -o "X$low" = X; then
     5         kx 	    case "`echo RS | od -x 2>/dev/null`" in
     5         kx 	    *D9E2*|*d9e2*)
     5         kx 		echo "Hey, this might be EBCDIC." >&4
     5         kx 		if test "X$up" = X -o "X$low" = X; then
     5         kx 		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
     5         kx 		    rs) up='[A-IJ-RS-Z]'
     5         kx 			low='[a-ij-rs-z]'
     5         kx 			;;
     5         kx 		    esac
     5         kx 		fi
     5         kx 		if test "X$up" = X -o "X$low" = X; then
     5         kx 		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
     5         kx 		    rs) up='A-IJ-RS-Z'
     5         kx 			low='a-ij-rs-z'
     5         kx 			;;
     5         kx 		    esac
     5         kx 		fi
     5         kx 		;;
     5         kx 	    esac
     5         kx 	fi
     5         kx esac
     5         kx case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
     5         kx rs)
     5         kx     echo "Using $up and $low to convert case." >&4
     5         kx     ;;
     5         kx *)
     5         kx     echo "I don't know how to translate letters from upper to lower case." >&4
     5         kx     echo "Your tr is not acting any way I know of." >&4
     5         kx     exit 1
     5         kx     ;;
     5         kx esac
     5         kx : set up the translation script tr, must be called with ./tr of course
     5         kx cat >tr <<EOSC
     5         kx $startsh
     5         kx case "\$1\$2" in
     5         kx '[A-Z][a-z]') exec $tr '$up' '$low';;
     5         kx '[a-z][A-Z]') exec $tr '$low' '$up';;
     5         kx esac
     5         kx exec $tr "\$@"
     5         kx EOSC
     5         kx chmod +x tr
     5         kx $eunicefix tr
     5         kx 
     5         kx : Try to determine whether config.sh was made on this system
     5         kx case "$config_sh" in
     5         kx '')
     5         kx myuname=`$uname -a 2>/dev/null`
     5         kx $test -z "$myuname" && myuname=`hostname 2>/dev/null`
     5         kx # Downcase everything to avoid ambiguity.
     5         kx # Remove slashes and single quotes so we can use parts of this in
     5         kx # directory and file names.
     5         kx # Remove newlines so myuname is sane to use elsewhere.
     5         kx # tr '[A-Z]' '[a-z]' would not work in EBCDIC
     5         kx # because the A-Z/a-z are not consecutive.
     5         kx myuname=`echo $myuname | $sed -e "s,['/],,g" | \
     5         kx 	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
     5         kx newmyuname="$myuname"
     5         kx dflt=n
     5         kx case "$knowitall" in
     5         kx '')
     5         kx 	if test -f ../config.sh; then
     5         kx 		if $contains myuname= ../config.sh >/dev/null 2>&1; then
     5         kx 			eval "`grep myuname= ../config.sh`"
     5         kx 		fi
     5         kx 		if test "X$myuname" = "X$newmyuname"; then
     5         kx 			dflt=y
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx *) dflt=y;;
     5         kx esac
     5         kx 
     5         kx : Get old answers from old config file if Configure was run on the
     5         kx : same system, otherwise use the hints.
     5         kx hint=default
     5         kx cd ..
     5         kx if test -f config.sh; then
     5         kx 	echo " "
     5         kx 	rp="I see a config.sh file.  Shall I use it to set the defaults?"
     5         kx 	. UU/myread
     5         kx 	case "$ans" in
     5         kx 	n*|N*) echo "OK, I'll ignore it."
     5         kx 		mv config.sh config.sh.old
     5         kx 		myuname="$newmyuname"
     5         kx 		;;
     5         kx 	*)  echo "Fetching default answers from your old config.sh file..." >&4
     5         kx 		tmp_n="$n"
     5         kx 		tmp_c="$c"
     5         kx 		tmp_sh="$sh"
     5         kx 		. ./config.sh
     5         kx 		cp config.sh UU
     5         kx 		n="$tmp_n"
     5         kx 		c="$tmp_c"
     5         kx 		: Older versions did not always set $sh.  Catch re-use of such
     5         kx 		: an old config.sh.
     5         kx 		case "$sh" in
     5         kx 		'') sh="$tmp_sh" ;;
     5         kx 		esac
     5         kx 		hint=previous
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx . ./UU/checkcc
     5         kx if test ! -f config.sh; then
     5         kx 	$cat <<EOM
     5         kx 
     5         kx First time through, eh?  I have some defaults handy for some systems
     5         kx that need some extra help getting the Configure answers right:
     5         kx 
     5         kx EOM
     5         kx 	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
     5         kx 	dflt=''
     5         kx 	: Half the following guesses are probably wrong... If you have better
     5         kx 	: tests or hints, please send them to https://github.com/Perl/perl5/issues
     5         kx 	: The metaconfig authors would also appreciate a copy...
     5         kx 	$test -f /irix && osname=irix
     5         kx 	$test -f /xenix && osname=sco_xenix
     5         kx 	$test -f /dynix && osname=dynix
     5         kx 	$test -f /dnix && osname=dnix
     5         kx 	$test -f /lynx.os && osname=lynxos
     5         kx 	$test -f /unicos && osname=unicos && osvers=`$uname -r`
     5         kx 	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
     5         kx 	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
     5         kx 	$test -f /bin/mips && /bin/mips && osname=mips
     5         kx 	$test -d /usr/apollo/bin && osname=apollo
     5         kx 	$test -f /etc/saf/_sactab && osname=svr4
     5         kx 	$test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
     5         kx 	$test -f /system/gnu_library/bin/ar.pm && osname=vos
     5         kx 	$test -f /sys/utilities/MultiView && osname=amigaos
     5         kx 	if $test -d /MachTen -o -d /MachTen_Folder; then
     5         kx 		osname=machten
     5         kx 		if $test -x /sbin/version; then
     5         kx 			osvers=`/sbin/version | $awk '{print $2}' |
     5         kx 			$sed -e 's/[A-Za-z]$//'`
     5         kx 		elif $test -x /usr/etc/version; then
     5         kx 			osvers=`/usr/etc/version | $awk '{print $2}' |
     5         kx 			$sed -e 's/[A-Za-z]$//'`
     5         kx 		else
     5         kx 			osvers="$2.$3"
     5         kx 		fi
     5         kx 	fi
     5         kx 
     5         kx 	$test -f /sys/posix.dll &&
     5         kx 		$test -f /usr/bin/what &&
     5         kx 		set X `/usr/bin/what /sys/posix.dll` &&
     5         kx 		$test "$3" = UWIN &&
     5         kx 		osname=uwin &&
     5         kx 		osvers="$5"
     5         kx 
     5         kx 	if $test -f $uname; then
     5         kx 		set X $myuname
     5         kx 		shift
     5         kx 
     5         kx 		case "$5" in
     5         kx 		fps*) osname=fps ;;
     5         kx 		mips*)
     5         kx 			case "$4" in
     5         kx 			umips) osname=umips ;;
     5         kx 			*) osname=mips ;;
     5         kx 			esac;;
     5         kx 		[23]100) osname=mips ;;
     5         kx 		i386*)
     5         kx 			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
     5         kx 			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
     5         kx 				osname='sco'
     5         kx 				osvers=$tmp
     5         kx 			elif $test -f /etc/kconfig; then
     5         kx 				osname=isc
     5         kx 				if test "$lns" = "$ln -s"; then
     5         kx 					osvers=4
     5         kx 				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
     5         kx 					osvers=3
     5         kx 				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
     5         kx 					osvers=2
     5         kx 				fi
     5         kx 			fi
     5         kx 			tmp=''
     5         kx 			;;
     5         kx 		pc*)
     5         kx 			if test -n "$DJGPP"; then
     5         kx 				osname=dos
     5         kx 				osvers=djgpp
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 
     5         kx 		case "$1" in
     5         kx 		aix) osname=aix
     5         kx 			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
     5         kx 			case "$tmp" in
     5         kx 			# oslevel can fail with:
     5         kx 			# oslevel: Unable to acquire lock.
     5         kx 			*not\ found) osvers="$4"."$3" ;;
     5         kx 			'<3240'|'<>3240') osvers=3.2.0 ;;
     5         kx 			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
     5         kx 			'=3250'|'>3250') osvers=3.2.5 ;;
     5         kx 			*) osvers=$tmp;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		bitrig) osname=bitrig
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		bsd386) osname=bsd386
     5         kx 			osvers=`$uname -r`
     5         kx 			;;
     5         kx 		cygwin*) osname=cygwin
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		*dc.osx) osname=dcosx
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		dnix) osname=dnix
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		domainos) osname=apollo
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		dgux)	osname=dgux
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		dragonfly) osname=dragonfly
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		dynixptx*) osname=dynixptx
     5         kx 			osvers=`echo "$4"|sed 's/^v//'`
     5         kx 			;;
     5         kx 		freebsd) osname=freebsd
     5         kx 			osvers="$3" ;;
     5         kx 		genix)	osname=genix ;;
     5         kx 		gnu)	osname=gnu
     5         kx 			osvers="$3" ;;
     5         kx 		hp*)	osname=hpux
     5         kx 			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
     5         kx 			;;
     5         kx 		irix*)	osname=irix
     5         kx 			case "$3" in
     5         kx 			4*) osvers=4 ;;
     5         kx 			5*) osvers=5 ;;
     5         kx 			*)	osvers="$3" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		linux)	osname=linux
     5         kx 			case "$3" in
     5         kx 			*)	osvers="$3" ;;
     5         kx 			esac
     5         kx 			$test -f /system/lib/libandroid.so && osname=linux-android
     5         kx 			;;
     5         kx 		MiNT)	osname=mint
     5         kx 			;;
     5         kx 		minix)	osname=minix
     5         kx 			osvers=`$uname -r`
     5         kx 			;;
     5         kx 		netbsd*) osname=netbsd
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		news-os) osvers="$3"
     5         kx 			case "$3" in
     5         kx 			4*) osname=newsos4 ;;
     5         kx 			*) osname=newsos ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		nonstop-ux) osname=nonstopux ;;
     5         kx 		openbsd) osname=openbsd
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		os2)	osname=os2
     5         kx 			osvers="$4"
     5         kx 			;;
     5         kx 		POSIX-BC | posix-bc ) osname=posix-bc
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		powerux | power_ux | powermax_os | powermaxos | \
     5         kx 		powerunix | power_unix) osname=powerux
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		qnx) osname=qnx
     5         kx 			osvers="$4"
     5         kx 			;;
     5         kx 		solaris) osname=solaris
     5         kx 			case "$3" in
     5         kx 			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
     5         kx 			*)	osvers="$3" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		sunos) osname=sunos
     5         kx 			case "$3" in
     5         kx 			5*) osname=solaris
     5         kx 				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
     5         kx 			*)	osvers="$3" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		titanos) osname=titanos
     5         kx 			case "$3" in
     5         kx 			1*) osvers=1 ;;
     5         kx 			2*) osvers=2 ;;
     5         kx 			3*) osvers=3 ;;
     5         kx 			4*) osvers=4 ;;
     5         kx 			*)	osvers="$3" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		ultrix) osname=ultrix
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		osf1|mls+)	case "$5" in
     5         kx 				alpha)
     5         kx 					osname=dec_osf
     5         kx 					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
     5         kx 					case "$osvers" in
     5         kx 					[1-9].[0-9]*) ;;
     5         kx 					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
     5         kx 					esac
     5         kx 					;;
     5         kx 			hp*)	osname=hp_osf1	;;
     5         kx 			mips)	osname=mips_osf1 ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		# UnixWare 7.1.2 is known as Open UNIX 8
     5         kx 		openunix|unixware) osname=svr5
     5         kx 			osvers="$4"
     5         kx 			;;
     5         kx 		uts)	osname=uts
     5         kx 			osvers="$3"
     5         kx 			;;
     5         kx 		vos) osvers="$3"
     5         kx 			;;
     5         kx 		$2) case "$osname" in
     5         kx 			*isc*) ;;
     5         kx 			*freebsd*) ;;
     5         kx 			svr*)
     5         kx 				: svr4.x or possibly later
     5         kx 				case "svr$3" in
     5         kx 				${osname}*)
     5         kx 					osname=svr$3
     5         kx 					osvers=$4
     5         kx 					;;
     5         kx 				esac
     5         kx 				case "$osname" in
     5         kx 				svr4.0)
     5         kx 					: Check for ESIX
     5         kx 					if test -f /stand/boot ; then
     5         kx 						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
     5         kx 						if test -n "$INITPROG" -a -f "$INITPROG"; then
     5         kx 			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
     5         kx 							if test -n "$isesix"; then
     5         kx 								osname=esix4
     5         kx 							fi
     5         kx 						fi
     5         kx 					fi
     5         kx 					;;
     5         kx 				esac
     5         kx 				;;
     5         kx 			*)	if test -f /etc/systemid; then
     5         kx 					osname=sco
     5         kx 					set `echo $3 | $sed 's/\./ /g'` $4
     5         kx 					if $test -f $src/hints/sco_$1_$2_$3.sh; then
     5         kx 						osvers=$1.$2.$3
     5         kx 					elif $test -f $src/hints/sco_$1_$2.sh; then
     5         kx 						osvers=$1.$2
     5         kx 					elif $test -f $src/hints/sco_$1.sh; then
     5         kx 						osvers=$1
     5         kx 					fi
     5         kx 				else
     5         kx 					case "$osname" in
     5         kx 					'') : Still unknown.  Probably a generic Sys V.
     5         kx 						osname="sysv"
     5         kx 						osvers="$3"
     5         kx 						;;
     5         kx 					esac
     5         kx 				fi
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		*)	case "$osname" in
     5         kx 			'') : Still unknown.  Probably a generic BSD.
     5         kx 				osname="$1"
     5         kx 				osvers="$3"
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 	else
     5         kx 		if test -f /vmunix -a -f $src/hints/news_os.sh; then
     5         kx 			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
     5         kx 			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
     5         kx 				osname=news_os
     5         kx 			fi
     5         kx 			$rm -f UU/kernel.what
     5         kx 		elif test -d c:/. -o -n "$is_os2" ; then
     5         kx 			set X $myuname
     5         kx 			osname=os2
     5         kx 			osvers="$5"
     5         kx 		fi
     5         kx 	fi
     5         kx 
     5         kx         case "$targetarch" in
     5         kx         '') ;;
     5         kx         *)  hostarch=$osname
     5         kx             case "$targetarch" in
     5         kx                 nto*|*-nto-*)
     5         kx                     # Will load qnx.sh, which should change osname to nto
     5         kx                     osname=qnx
     5         kx                     osvers=''
     5         kx                     ;;
     5         kx                 *linux-android*)
     5         kx                     # Catch arm-linux-androideabi, mipsel-linux-android,
     5         kx                     # and i686-linux-android
     5         kx                     osname=linux-android
     5         kx                     osvers=''
     5         kx                     ;;
     5         kx                 *linux*)
     5         kx                     # Something like arm-linux-gnueabihf is really just
     5         kx                     # plain linux.
     5         kx                     osname=linux
     5         kx                     osvers=''
     5         kx                     ;;
     5         kx                 *solaris*|*sunos*)
     5         kx                     osname=solaris
     5         kx                     # XXX perhaps we should just assume
     5         kx                     # osvers to be 2, or maybe take the value
     5         kx                     # from targetarch. Using $run before the
     5         kx                     # hints are run is somewhat icky.
     5         kx                     set X `$run $uname -a 2>/dev/null`
     5         kx                     shift
     5         kx                     case "$3" in
     5         kx                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
     5         kx                         *)  osvers="$3" ;;
     5         kx                     esac
     5         kx                     ;;
     5         kx                 *)
     5         kx 		    osname=`echo $targetarch|sed 's,^[^-]*-,,'`
     5         kx 		    osvers=''
     5         kx                 ;;
     5         kx             esac
     5         kx             ;;
     5         kx         esac
     5         kx 
     5         kx 	: Now look for a hint file osname_osvers, unless one has been
     5         kx 	: specified already.
     5         kx 	case "$hintfile" in
     5         kx 	''|' ')
     5         kx 		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
     5         kx 		: Also try without trailing minor version numbers.
     5         kx 		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
     5         kx 		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
     5         kx 		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
     5         kx 		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
     5         kx 		case "$file" in
     5         kx 		'') dflt=none ;;
     5         kx 		*)  case "$osvers" in
     5         kx 			'') dflt=$file
     5         kx 				;;
     5         kx 			*)  if $test -f $src/hints/$file.sh ; then
     5         kx 					dflt=$file
     5         kx 				elif $test -f $src/hints/$xfile.sh ; then
     5         kx 					dflt=$xfile
     5         kx 				elif $test -f $src/hints/$xxfile.sh ; then
     5         kx 					dflt=$xxfile
     5         kx 				elif $test -f $src/hints/$xxxfile.sh ; then
     5         kx 					dflt=$xxxfile
     5         kx 				elif $test -f $src/hints/$xxxxfile.sh ; then
     5         kx 					dflt=$xxxxfile
     5         kx 				elif $test -f "$src/hints/${osname}.sh" ; then
     5         kx 					dflt="${osname}"
     5         kx 				else
     5         kx 					dflt=none
     5         kx 				fi
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		if $test -f Policy.sh ; then
     5         kx 			case "$dflt" in
     5         kx 			*Policy*) ;;
     5         kx 			none) dflt="Policy" ;;
     5         kx 			*) dflt="Policy $dflt" ;;
     5         kx 			esac
     5         kx 		fi
     5         kx 		;;
     5         kx 	*)
     5         kx 		dflt=`echo $hintfile | $sed 's/\.sh$//'`
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	if $test -f Policy.sh ; then
     5         kx 		$cat <<EOM
     5         kx 
     5         kx There's also a Policy hint file available, which should make the
     5         kx site-specific (policy) questions easier to answer.
     5         kx EOM
     5         kx 
     5         kx 	fi
     5         kx 
     5         kx 	$cat <<EOM
     5         kx 
     5         kx You may give one or more space-separated answers, or "none" if appropriate.
     5         kx If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
     5         kx previous run of Configure, you may specify it as well as or instead of
     5         kx OS-specific hints.  If hints are provided for your OS, you should use them:
     5         kx although Perl can probably be built without hints on many platforms, using
     5         kx hints often improve performance and may enable features that Configure can't
     5         kx set up on its own. If there are no hints that match your OS, specify "none";
     5         kx DO NOT give a wrong version or a wrong OS.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx 	rp="Which of these apply, if any?"
     5         kx 	. UU/myread
     5         kx 	tans=$ans
     5         kx 	for file in $tans; do
     5         kx 		if $test X$file = XPolicy -a -f Policy.sh; then
     5         kx 			. Policy.sh
     5         kx 			$cat Policy.sh >> UU/config.sh
     5         kx 		elif $test -f $src/hints/$file.sh; then
     5         kx 			. $src/hints/$file.sh
     5         kx 			$cat $src/hints/$file.sh >> UU/config.sh
     5         kx 		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
     5         kx 			: nothing
     5         kx 		else
     5         kx 			: Give one chance to correct a possible typo.
     5         kx 			echo "$file.sh does not exist"
     5         kx 			dflt=$file
     5         kx 			rp="hint to use instead?"
     5         kx 			. UU/myread
     5         kx 			for file in $ans; do
     5         kx 				if $test -f "$src/hints/$file.sh"; then
     5         kx 					. $src/hints/$file.sh
     5         kx 					$cat $src/hints/$file.sh >> UU/config.sh
     5         kx 				elif $test X$ans = X -o X$ans = Xnone ; then
     5         kx 					: nothing
     5         kx 				else
     5         kx 					echo "$file.sh does not exist -- ignored."
     5         kx 				fi
     5         kx 			done
     5         kx 		fi
     5         kx 	done
     5         kx 
     5         kx 	hint=recommended
     5         kx 	: Remember our hint file for later.
     5         kx 	if $test -f "$src/hints/$file.sh" ; then
     5         kx 		hintfile="$file"
     5         kx 	else
     5         kx 		hintfile=''
     5         kx 	fi
     5         kx fi
     5         kx cd UU
     5         kx ;;
     5         kx *)
     5         kx 	echo " "
     5         kx 	echo "Fetching default answers from $config_sh..." >&4
     5         kx 	tmp_n="$n"
     5         kx 	tmp_c="$c"
     5         kx 	cd ..
     5         kx 	cp $config_sh config.sh 2>/dev/null
     5         kx 	chmod +w config.sh
     5         kx 	. ./config.sh
     5         kx 	cd UU
     5         kx 	cp ../config.sh .
     5         kx 	n="$tmp_n"
     5         kx 	c="$tmp_c"
     5         kx 	hint=previous
     5         kx 	;;
     5         kx esac
     5         kx . ./optdef.sh
     5         kx 
     5         kx : Restore computed paths
     5         kx for file in $loclist $trylist; do
     5         kx 	eval $file="\$_$file"
     5         kx done
     5         kx 
     5         kx cat << EOM
     5         kx 
     5         kx Configure uses the operating system name and version to set some defaults.
     5         kx The default value is probably right if the name rings a bell. Otherwise,
     5         kx since spelling matters for me, either accept the default or answer "none"
     5         kx to leave it blank.
     5         kx 
     5         kx EOM
     5         kx case "$osname" in
     5         kx 	''|' ')
     5         kx 		case "$hintfile" in
     5         kx 		''|' '|none) dflt=none ;;
     5         kx 		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*) dflt="$osname" ;;
     5         kx esac
     5         kx rp="Operating system name?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none)  osname='' ;;
     5         kx *) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
     5         kx esac
     5         kx echo " "
     5         kx case "$osvers" in
     5         kx 	''|' ')
     5         kx 		case "$hintfile" in
     5         kx 		''|' '|none) dflt=none ;;
     5         kx 		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
     5         kx 			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
     5         kx 			case "$dflt" in
     5         kx 			''|' ') dflt=none ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*) dflt="$osvers" ;;
     5         kx esac
     5         kx rp="Operating system version?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none)  osvers='' ;;
     5         kx *) osvers="$ans" ;;
     5         kx esac
     5         kx 
     5         kx 
     5         kx . ./posthint.sh
     5         kx 
     5         kx : who configured the system
     5         kx cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
     5         kx case "$cf_by" in
     5         kx "")
     5         kx 	cf_by=`(logname) 2>/dev/null`
     5         kx 	case "$cf_by" in
     5         kx 	"")
     5         kx 		cf_by=`(whoami) 2>/dev/null`
     5         kx 		case "$cf_by" in
     5         kx 		"") cf_by=unknown ;;
     5         kx 		esac ;;
     5         kx 	esac ;;
     5         kx esac
     5         kx 
     5         kx : decide how portable to be.  Allow command line overrides.
     5         kx case "$d_portable" in
     5         kx "$undef") ;;
     5         kx *)	d_portable="$define" ;;
     5         kx esac
     5         kx 
     5         kx : set up shell script to do ~ expansion
     5         kx cat >filexp <<EOSS
     5         kx $startsh
     5         kx : expand filename
     5         kx case "\$1" in
     5         kx  \~/*|\~)
     5         kx 	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
     5         kx 	;;
     5         kx  \~*)
     5         kx 	if $test -f /bin/csh; then
     5         kx 		/bin/csh -f -c "glob \$1"
     5         kx 		failed=\$?
     5         kx 		echo ""
     5         kx 		exit \$failed
     5         kx 	else
     5         kx 		name=\`$expr x\$1 : '..\([^/]*\)'\`
     5         kx 		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
     5         kx 		if $test ! -d "\$dir"; then
     5         kx 			me=\`basename \$0\`
     5         kx 			echo "\$me: can't locate home directory for: \$name" >&2
     5         kx 			exit 1
     5         kx 		fi
     5         kx 		case "\$1" in
     5         kx 		*/*)
     5         kx 			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
     5         kx 			;;
     5         kx 		*)
     5         kx 			echo \$dir
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx 	;;
     5         kx *)
     5         kx 	echo \$1
     5         kx 	;;
     5         kx esac
     5         kx EOSS
     5         kx chmod +x filexp
     5         kx $eunicefix filexp
     5         kx 
     5         kx : now set up to get a file name
     5         kx cat <<EOS >getfile
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>getfile
     5         kx tilde=''
     5         kx fullpath=''
     5         kx already=''
     5         kx skip=''
     5         kx none_ok=''
     5         kx exp_file=''
     5         kx nopath_ok=''
     5         kx orig_rp="$rp"
     5         kx orig_dflt="$dflt"
     5         kx case "$gfpth" in
     5         kx '') gfpth='.' ;;
     5         kx esac
     5         kx 
     5         kx case "$fn" in
     5         kx *\(*)
     5         kx 	: getfile will accept an answer from the comma-separated list
     5         kx 	: enclosed in parentheses even if it does not meet other criteria.
     5         kx 	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
     5         kx 	fn=`echo $fn | sed 's/(.*)//'`
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$fn" in
     5         kx *:*)
     5         kx 	loc_file=`expr $fn : '.*:\(.*\)'`
     5         kx 	fn=`expr $fn : '\(.*\):.*'`
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$fn" in
     5         kx *~*) tilde=true;;
     5         kx esac
     5         kx case "$fn" in
     5         kx */*) fullpath=true;;
     5         kx esac
     5         kx case "$fn" in
     5         kx *+*) skip=true;;
     5         kx esac
     5         kx case "$fn" in
     5         kx *n*) none_ok=true;;
     5         kx esac
     5         kx case "$fn" in
     5         kx *e*) exp_file=true;;
     5         kx esac
     5         kx case "$fn" in
     5         kx *p*) nopath_ok=true;;
     5         kx esac
     5         kx 
     5         kx case "$fn" in
     5         kx *f*) type='File';;
     5         kx *d*) type='Directory';;
     5         kx *l*) type='Locate';;
     5         kx esac
     5         kx 
     5         kx what="$type"
     5         kx case "$what" in
     5         kx Locate) what='File';;
     5         kx esac
     5         kx 
     5         kx case "$exp_file" in
     5         kx '')
     5         kx 	case "$d_portable" in
     5         kx 	"$define") ;;
     5         kx 	*) exp_file=true;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx cd ..
     5         kx while test "$type"; do
     5         kx 	redo=''
     5         kx 	rp="$orig_rp"
     5         kx 	dflt="$orig_dflt"
     5         kx 	case "$tilde" in
     5         kx 	true) rp="$rp (~name ok)";;
     5         kx 	esac
     5         kx 	. UU/myread
     5         kx 	if test -f UU/getfile.ok && \
     5         kx 		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
     5         kx 	then
     5         kx 		value="$ans"
     5         kx 		ansexp="$ans"
     5         kx 		break
     5         kx 	fi
     5         kx 	case "$ans" in
     5         kx 	none)
     5         kx 		value=''
     5         kx 		ansexp=''
     5         kx 		case "$none_ok" in
     5         kx 		true) type='';;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)
     5         kx 		case "$tilde" in
     5         kx 		'') value="$ans"
     5         kx 			ansexp="$ans";;
     5         kx 		*)
     5         kx 			value=`UU/filexp $ans`
     5         kx 			case $? in
     5         kx 			0)
     5         kx 				if test "$ans" != "$value"; then
     5         kx 					echo "(That expands to $value on this system.)"
     5         kx 				fi
     5         kx 				;;
     5         kx 			*) value="$ans";;
     5         kx 			esac
     5         kx 			ansexp="$value"
     5         kx 			case "$exp_file" in
     5         kx 			'') value="$ans";;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$fullpath" in
     5         kx 		true)
     5         kx 			case "$ansexp" in
     5         kx 			/*) value="$ansexp" ;;
     5         kx 			[a-zA-Z]:/*) value="$ansexp" ;;
     5         kx 			*)
     5         kx 				redo=true
     5         kx 				case "$already" in
     5         kx 				true)
     5         kx 				echo "I shall only accept a full path name, as in /bin/ls." >&4
     5         kx 				echo "Use a ! shell escape if you wish to check pathnames." >&4
     5         kx 					;;
     5         kx 				*)
     5         kx 				echo "Please give a full path name, starting with slash." >&4
     5         kx 					case "$tilde" in
     5         kx 					true)
     5         kx 				echo "Note that using ~name is ok provided it expands well." >&4
     5         kx 						already=true
     5         kx 						;;
     5         kx 					esac
     5         kx 				esac
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$redo" in
     5         kx 		'')
     5         kx 			case "$type" in
     5         kx 			File)
     5         kx 				for fp in $gfpth; do
     5         kx 					if test "X$fp" = X.; then
     5         kx 					    pf="$ansexp"
     5         kx 					else    
     5         kx 					    pf="$fp/$ansexp"
     5         kx 					fi
     5         kx 					if test -f "$pf"; then
     5         kx 						type=''
     5         kx 					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
     5         kx 					then
     5         kx 						echo "($value is not a plain file, but that's ok.)"
     5         kx 						type=''
     5         kx 					fi
     5         kx 					if test X"$type" = X; then
     5         kx 					    value="$pf"
     5         kx 					    break
     5         kx 					fi
     5         kx 				done
     5         kx 				;;
     5         kx 			Directory)
     5         kx 				for fp in $gfpth; do
     5         kx 					if test "X$fp" = X.; then
     5         kx 					    dir="$ans"
     5         kx 					    direxp="$ansexp"
     5         kx 					else    
     5         kx 					    dir="$fp/$ansexp"
     5         kx 					    direxp="$fp/$ansexp"
     5         kx 					fi
     5         kx 					if test -d "$direxp"; then
     5         kx 						type=''
     5         kx 						value="$dir"
     5         kx 						break
     5         kx 					fi
     5         kx 				done
     5         kx 				;;
     5         kx 			Locate)
     5         kx 				if test -d "$ansexp"; then
     5         kx 					echo "(Looking for $loc_file in directory $value.)"
     5         kx 					value="$value/$loc_file"
     5         kx 					ansexp="$ansexp/$loc_file"
     5         kx 				fi
     5         kx 				if test -f "$ansexp"; then
     5         kx 					type=''
     5         kx 				fi
     5         kx 				case "$nopath_ok" in
     5         kx 				true)	case "$value" in
     5         kx 					*/*) ;;
     5         kx 					*)	echo "Assuming $value will be in people's path."
     5         kx 						type=''
     5         kx 						;;
     5         kx 					esac
     5         kx 					;;
     5         kx 				esac
     5         kx 				;;
     5         kx 			esac
     5         kx 
     5         kx 			case "$skip" in
     5         kx 			true) type='';
     5         kx 			esac
     5         kx 
     5         kx 			case "$type" in
     5         kx 			'') ;;
     5         kx 			*)
     5         kx 				if test "$fastread" = yes; then
     5         kx 					dflt=y
     5         kx 				else
     5         kx 					dflt=n
     5         kx 				fi
     5         kx 				rp="$what $value doesn't exist.  Use that name anyway?"
     5         kx 				. UU/myread
     5         kx 				dflt=''
     5         kx 				case "$ans" in
     5         kx 				y*) type='';;
     5         kx 				*) echo " ";;
     5         kx 				esac
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx cd UU
     5         kx ans="$value"
     5         kx rp="$orig_rp"
     5         kx dflt="$orig_dflt"
     5         kx rm -f getfile.ok
     5         kx test "X$gfpthkeep" != Xy && gfpth=""
     5         kx EOSC
     5         kx 
     5         kx : determine root of directory hierarchy where package will be installed.
     5         kx case "$prefix" in
     5         kx '')	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
     5         kx 	;;
     5         kx *)	dflt="$prefix"
     5         kx 	;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx By default, $package will be installed in $dflt/bin, manual pages
     5         kx under $dflt/man, etc..., i.e. with $dflt as prefix for all
     5         kx installation directories. Typically this is something like /usr/local.
     5         kx If you wish to have binaries under /usr/bin but other parts of the
     5         kx installation under /usr/local, that's ok: you will be prompted
     5         kx separately for each of the installation directories, the prefix being
     5         kx only used to set the defaults.
     5         kx 
     5         kx EOM
     5         kx fn=d~
     5         kx rp='Installation prefix to use?'
     5         kx . ./getfile
     5         kx oldprefix=''
     5         kx case "$prefix" in
     5         kx '')	;;
     5         kx *)	case "$ans" in
     5         kx 	"$prefix") ;;
     5         kx 	*) oldprefix="$prefix";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$ans" in
     5         kx *?/)	prefix=`echo "$ans" | sed 's/.$//'`
     5         kx 	;;
     5         kx *)	prefix="$ans"
     5         kx esac
     5         kx 
     5         kx case "$ansexp" in
     5         kx *?/)	prefixexp=`echo "$ansexp" | sed 's/.$//'`
     5         kx 	;;
     5         kx *)	prefixexp="$ansexp"
     5         kx esac
     5         kx 
     5         kx : allow them to override the AFS root
     5         kx case "$afsroot" in
     5         kx '')	afsroot=/afs ;;
     5         kx *)	afsroot=$afsroot ;;
     5         kx esac
     5         kx 
     5         kx : is AFS running?
     5         kx echo " "
     5         kx case "$afs" in
     5         kx $define|true)	afs=true ;;
     5         kx $undef|false)	afs=false ;;
     5         kx *)	if $test -d $afsroot; then
     5         kx 		afs=true
     5         kx 	else
     5         kx 		afs=false
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx if $afs; then
     5         kx 	echo "AFS may be running... I'll be extra cautious then..." >&4
     5         kx else
     5         kx 	echo "AFS does not seem to be running..." >&4
     5         kx fi
     5         kx 
     5         kx : determine installation prefix for where package is to be installed.
     5         kx if $afs; then
     5         kx $cat <<EOM
     5         kx 
     5         kx Since you are running AFS, I need to distinguish the directory in which
     5         kx files will reside from the directory in which they are installed (and from
     5         kx which they are presumably copied to the former directory by occult means).
     5         kx 
     5         kx EOM
     5         kx 	case "$installprefix" in
     5         kx 	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
     5         kx 	*) dflt="$installprefix";;
     5         kx 	esac
     5         kx else
     5         kx $cat <<EOM
     5         kx 
     5         kx In some special cases, particularly when building $package for distribution,
     5         kx it is convenient to distinguish the directory in which files should be
     5         kx installed from the directory ($prefix) in which they will
     5         kx eventually reside.  For most users, these two directories are the same.
     5         kx 
     5         kx EOM
     5         kx 	case "$installprefix" in
     5         kx 	'') dflt=$prefix ;;
     5         kx 	*) dflt=$installprefix;;
     5         kx 	esac
     5         kx fi
     5         kx fn=d~
     5         kx rp='What installation prefix should I use for installing files?'
     5         kx . ./getfile
     5         kx installprefix="$ans"
     5         kx installprefixexp="$ansexp"
     5         kx 
     5         kx : Perform the prefixexp/installprefixexp correction if necessary
     5         kx cat <<EOS >installprefix
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>installprefix
     5         kx : Change installation prefix, if necessary.
     5         kx if $test X"$prefix" != X"$installprefix"; then
     5         kx     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
     5         kx else
     5         kx     eval "install${prefixvar}=\"\$${prefixvar}exp\""
     5         kx fi
     5         kx EOSC
     5         kx chmod +x installprefix
     5         kx $eunicefix installprefix
     5         kx 
     5         kx : Set variables such as privlib and privlibexp from the output of ./getfile
     5         kx : performing the prefixexp/installprefixexp correction if necessary.
     5         kx cat <<EOS >setprefixvar
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>setprefixvar
     5         kx eval "${prefixvar}=\"\$ans\""
     5         kx eval "${prefixvar}exp=\"\$ansexp\""
     5         kx . ./installprefix
     5         kx EOSC
     5         kx chmod +x setprefixvar
     5         kx $eunicefix setprefixvar
     5         kx 
     5         kx : set up the script used to warn in case of inconsistency
     5         kx cat <<EOS >whoa
     5         kx $startsh
     5         kx EOS
     5         kx cat <<'EOSC' >>whoa
     5         kx dflt=y
     5         kx case "$hint" in
     5         kx     recommended)
     5         kx 	case "$hintfile" in
     5         kx 	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
     5         kx 		;;
     5         kx 	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
     5         kx 		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx     *)	echo " "
     5         kx 	echo "*** WHOA THERE!!! ***" >&4
     5         kx 	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
     5         kx 	;;
     5         kx esac
     5         kx rp="    Keep the $hint value?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y) td=$was; tu=$was;;
     5         kx esac
     5         kx EOSC
     5         kx 
     5         kx : function used to set '$1' to '$val'
     5         kx setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
     5         kx case "$val$was" in
     5         kx $define$undef) . ./whoa; eval "$var=\$td";;
     5         kx $undef$define) . ./whoa; eval "$var=\$tu";;
     5         kx *) eval "$var=$val";;
     5         kx esac'
     5         kx 
     5         kx : Do we want threads support and if so, what type
     5         kx case "$usethreads" in
     5         kx $define|true|[yY]*)     dflt='y';;
     5         kx *)     # Catch case where user specified ithreads but
     5         kx        # forgot -Dusethreads (A.D. 4/2002)
     5         kx        case "$useithreads" in
     5         kx        *$define*)	dflt='y';;
     5         kx        *)		dflt='n';;
     5         kx        esac
     5         kx        ;;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built to offer a form of threading support on some systems
     5         kx To do so, Configure can be run with -Dusethreads.
     5         kx 
     5         kx Note that Perl built with threading support runs slightly slower
     5         kx and uses slightly more memory than plain Perl.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Build a threading Perl?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)    val="$define" ;;
     5         kx *)      val="$undef" ;;
     5         kx esac
     5         kx set usethreads
     5         kx eval $setvar
     5         kx 
     5         kx useithreads="$usethreads"
     5         kx 
     5         kx case "$d_oldpthreads" in
     5         kx '')	: Configure tests would be welcome here.  For now, assume undef.
     5         kx 	val="$undef" ;;
     5         kx *)	val="$d_oldpthreads" ;;
     5         kx esac
     5         kx set d_oldpthreads
     5         kx eval $setvar
     5         kx 
     5         kx 
     5         kx : Look for a hint-file generated 'call-back-unit'.  If the
     5         kx : user has specified that a threading perl is to be built,
     5         kx : we may need to set or change some other defaults.
     5         kx if $test -f usethreads.cbu; then
     5         kx     echo "Your platform has some specific hints regarding threaded builds, using them..."
     5         kx     . ./usethreads.cbu
     5         kx else
     5         kx     case "$usethreads" in
     5         kx 	"$define"|true|[yY]*)
     5         kx 		$cat <<EOM
     5         kx (Your platform does not have any specific hints for threaded builds.
     5         kx  Assuming POSIX threads, then.)
     5         kx EOM
     5         kx 	;;
     5         kx     esac
     5         kx fi
     5         kx 
     5         kx : Check if multiplicity is required
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built so that multiple Perl interpreters can coexist
     5         kx within the same Perl executable.
     5         kx EOM
     5         kx 
     5         kx case "$useithreads" in
     5         kx $define)
     5         kx 	cat <<EOM
     5         kx This multiple interpreter support is required for interpreter-based threads.
     5         kx EOM
     5         kx 	val="$define"
     5         kx 	;;
     5         kx *)	case "$usemultiplicity" in
     5         kx 	$define|true|[yY]*)	dflt='y';;
     5         kx 	*) dflt='n';;
     5         kx 	esac
     5         kx 	echo " "
     5         kx 	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
     5         kx 	rp='Build Perl for multiplicity?'
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	y|Y)	val="$define" ;;
     5         kx 	*)      val="$undef" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set usemultiplicity
     5         kx eval $setvar
     5         kx 
     5         kx : Check if morebits is requested
     5         kx case "$usemorebits" in
     5         kx "$define"|true|[yY]*)
     5         kx 	use64bitint="$define"
     5         kx 	uselongdouble="$define"
     5         kx 	usemorebits="$define"
     5         kx 	;;
     5         kx *)	usemorebits="$undef"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Determine the C compiler to be used
     5         kx echo " "
     5         kx case "$cc" in
     5         kx '') dflt=cc;;
     5         kx *) dflt="$cc";;
     5         kx esac
     5         kx rp="Use which C compiler?"
     5         kx . ./myread
     5         kx cc="$ans"
     5         kx 
     5         kx : See whether they have no cc but they do have gcc
     5         kx . ./trygcc
     5         kx if $test -f cc.cbu; then
     5         kx     . ./cc.cbu
     5         kx fi
     5         kx . ./checkcc
     5         kx 
     5         kx : make some quick guesses about what we are up against
     5         kx echo " "
     5         kx $echo $n "Hmm...  $c"
     5         kx echo exit 1 >bsd
     5         kx echo exit 1 >usg
     5         kx echo exit 1 >v7
     5         kx echo exit 1 >osf1
     5         kx echo exit 1 >eunice
     5         kx echo exit 1 >xenix
     5         kx echo exit 1 >venix
     5         kx echo exit 1 >os2
     5         kx d_bsd="$undef"
     5         kx $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
     5         kx if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
     5         kx then
     5         kx 	echo "Looks kind of like an OSF/1 system, but we'll see..."
     5         kx 	echo exit 0 >osf1
     5         kx elif test `echo abc | $tr a-z A-Z` = Abc ; then
     5         kx 	xxx=`./loc addbib blurfl $pth`
     5         kx 	if $test -f $xxx; then
     5         kx 	echo "Looks kind of like a USG system with BSD features, but we'll see..."
     5         kx 		echo exit 0 >bsd
     5         kx 		echo exit 0 >usg
     5         kx 	else
     5         kx 		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
     5         kx 			echo "Looks kind of like an extended USG system, but we'll see..."
     5         kx 		else
     5         kx 			echo "Looks kind of like a USG system, but we'll see..."
     5         kx 		fi
     5         kx 		echo exit 0 >usg
     5         kx 	fi
     5         kx elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
     5         kx 	echo "Looks kind of like a BSD system, but we'll see..."
     5         kx 	d_bsd="$define"
     5         kx 	echo exit 0 >bsd
     5         kx else
     5         kx 	echo "Looks kind of like a Version 7 system, but we'll see..."
     5         kx 	echo exit 0 >v7
     5         kx fi
     5         kx case "$eunicefix" in
     5         kx *unixtovms*)
     5         kx 	$cat <<'EOI'
     5         kx There is, however, a strange, musty smell in the air that reminds me of
     5         kx something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
     5         kx EOI
     5         kx 	echo exit 0 >eunice
     5         kx 	d_eunice="$define"
     5         kx : it so happens the Eunice I know will not run shell scripts in Unix format
     5         kx 	;;
     5         kx *)
     5         kx 	echo " "
     5         kx 	echo "Congratulations.  You aren't running Eunice."
     5         kx 	d_eunice="$undef"
     5         kx 	;;
     5         kx esac
     5         kx : Detect OS2.  The p_ variable is set above in the Head.U unit.
     5         kx : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
     5         kx : semicolon as a patch separator
     5         kx case "$p_" in
     5         kx :) ;;
     5         kx *)
     5         kx 	$cat <<'EOI'
     5         kx I have the feeling something is not exactly right, however...don't tell me...
     5         kx lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
     5         kx (Or you may be running DOS with DJGPP.)
     5         kx EOI
     5         kx 	echo exit 0 >os2
     5         kx 	;;
     5         kx esac
     5         kx if test -f /xenix; then
     5         kx 	echo "Actually, this looks more like a XENIX system..."
     5         kx 	echo exit 0 >xenix
     5         kx 	d_xenix="$define"
     5         kx else
     5         kx 	echo " "
     5         kx 	echo "It's not Xenix..."
     5         kx 	d_xenix="$undef"
     5         kx fi
     5         kx chmod +x xenix
     5         kx $eunicefix xenix
     5         kx if test -f /venix; then
     5         kx 	echo "Actually, this looks more like a VENIX system..."
     5         kx 	echo exit 0 >venix
     5         kx else
     5         kx 	echo " "
     5         kx 	if ./xenix; then
     5         kx 		: null
     5         kx 	else
     5         kx 		echo "Nor is it Venix..."
     5         kx 	fi
     5         kx fi
     5         kx chmod +x bsd usg v7 osf1 eunice xenix venix os2
     5         kx $eunicefix bsd usg v7 osf1 eunice xenix venix os2
     5         kx $rm -f foo
     5         kx 
     5         kx : Check if we are using GNU gcc and what its version is
     5         kx echo " "
     5         kx echo "Checking for GNU cc in disguise and/or its version number..." >&4
     5         kx $cat >try.c <<EOM
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     5         kx #ifdef __VERSION__
     5         kx 	printf("%s\n", __VERSION__);
     5         kx #else
     5         kx 	printf("%s\n", "1");
     5         kx #endif
     5         kx #endif
     5         kx 	return(0);
     5         kx }
     5         kx EOM
     5         kx if $cc -o try $ccflags $ldflags try.c; then
     5         kx 	gccversion=`$run ./try`
     5         kx 	case "$gccversion" in
     5         kx 	'') echo "You are not using GNU cc." ;;
     5         kx 	*)  echo "You are using GNU cc $gccversion."
     5         kx 	    ccname=gcc
     5         kx 	    ;;
     5         kx 	esac
     5         kx else
     5         kx 	echo " "
     5         kx 	echo "*** WHOA THERE!!! ***" >&4
     5         kx 	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
     5         kx 	case "$knowitall" in
     5         kx 	'')
     5         kx 	echo "    You'd better start hunting for one and let me know about it." >&4
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx $rm -f try try.*
     5         kx case "$gccversion" in
     5         kx 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
     5         kx esac
     5         kx case "$gccversion" in
     5         kx '') gccosandvers='' ;;
     5         kx *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
     5         kx    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
     5         kx    gccshortvers=''
     5         kx    case "$gccosandvers" in
     5         kx    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
     5         kx    $osname$osvers) ;; # looking good
     5         kx    $osname*) cat <<EOM >&4
     5         kx 
     5         kx *** WHOA THERE!!! ***
     5         kx 
     5         kx     Your gcc has not been compiled for the exact release of
     5         kx     your operating system ($gccosandvers versus $osname$osvers).
     5         kx 
     5         kx     In general it is a good idea to keep gcc synchronized with
     5         kx     the operating system because otherwise serious problems
     5         kx     may ensue when trying to compile software, like Perl.
     5         kx 
     5         kx     I'm trying to be optimistic here, though, and will continue.
     5         kx     If later during the configuration and build icky compilation
     5         kx     problems appear (headerfile conflicts being the most common
     5         kx     manifestation), I suggest reinstalling the gcc to match
     5         kx     your operating system release.
     5         kx 
     5         kx EOM
     5         kx       ;;
     5         kx    *) gccosandvers='' ;; # failed to parse, better be silent
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx case "$ccname" in
     5         kx '') ccname="$cc" ;;
     5         kx esac
     5         kx 
     5         kx # gcc 3.* complain about adding -Idirectories that they already know about,
     5         kx # so we will take those off from locincpth.
     5         kx case "$gccversion" in
     5         kx 3.*)
     5         kx     echo "main(){}">try.c
     5         kx     for incdir in $locincpth; do
     5         kx        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
     5         kx 	     grep '^c[cp]p*[01]: warning: changing search order '`
     5         kx        if test "X$warn" != X; then
     5         kx 	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
     5         kx        fi
     5         kx     done
     5         kx     $rm -f try try.*
     5         kx esac
     5         kx 
     5         kx # gcc 4.9 by default does some optimizations that break perl.
     5         kx # see ticket 121505.
     5         kx #
     5         kx # The -fwrapv disables those optimizations (and probably others,) so
     5         kx # for gcc 4.9 (and later, since the optimizations probably won't go
     5         kx # away), add -fwrapv unless the user requests -fno-wrapv, which
     5         kx # disables -fwrapv, or if the user requests -fsanitize=undefined,
     5         kx # which turns the overflows -fwrapv ignores into runtime errors.
     5         kx case "$gccversion" in
     5         kx 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
     5         kx     case "$ccflags" in
     5         kx     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
     5         kx     *) ccflags="$ccflags -fwrapv" ;;
     5         kx     esac
     5         kx esac
     5         kx 
     5         kx # Really old versions of gcc default to C89 and will error for this code.
     5         kx # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
     5         kx # Initialisations in for loops seem to be the particular problem
     5         kx # (Does this syntax conflict with something else that was valid C89?)
     5         kx # We also add a declaration after a statement to detect whether the compiler
     5         kx # (or the user supplied -Accflags) consider such declarations to be errors.
     5         kx # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
     5         kx # to fail hard and early.
     5         kx #
     5         kx # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
     5         kx # syscall, drand48 etc when including <unistd.h>, which messes up our build.
     5         kx # I guess we *could* loop round trying -std=c99 first with checks both for the
     5         kx # prototype found and the code compiling (because -std=gnu99 might do other
     5         kx # things we don't want, particularly on non-GCC compilers) but
     5         kx # 1) We would need to check for the prototype first (without any flags)
     5         kx # 2) We would still end up with most Linux systems either being -std=gnu99
     5         kx #    or "" (no flag), and so both common options would not rigorously check our
     5         kx #    portability to other platforms.
     5         kx # So it doesn't seem worth the complexity and chance of different failure.
     5         kx $cat >try.c <<'EOCP'
     5         kx int main(int argc, char **argv) {
     5         kx     argc = argc + 1;
     5         kx     /* This is deliberately a declaration after a statement. */
     5         kx     unsigned long long count = 0;
     5         kx     for (char **p = argv; *p; ++p) {
     5         kx         ++count;
     5         kx     }
     5         kx     return count == 1 ? 0 : argc;
     5         kx }
     5         kx EOCP
     5         kx c99_for=no
     5         kx for flag in '' '-std=gnu99' '-std=c99'; do
     5         kx     if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
     5         kx         c99_for="$flag"
     5         kx         break;
     5         kx     fi
     5         kx done
     5         kx case "$c99_for" in
     5         kx '') echo "Your C compiler doesn't need any special flags to compile C99 code"
     5         kx     ;;
     5         kx no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
     5         kx     rp='Do you really want to continue?'
     5         kx     dflt='n'
     5         kx     . ./myread
     5         kx     case "$ans" in
     5         kx 	[yY])	echo >&4 "Okay, continuing."	;;
     5         kx 	*)	exit 1				;;
     5         kx     esac
     5         kx     ;;
     5         kx *)  echo "Your C compiler needs $c99_for to compile C99 code"
     5         kx     ccflags="$c99_for $ccflags"
     5         kx     ;;
     5         kx esac
     5         kx $rm -f try try.*
     5         kx 
     5         kx : What should the include directory be ?
     5         kx : Use sysroot if set, so findhdr looks in the right place.
     5         kx echo " "
     5         kx $echo $n "Hmm...  $c"
     5         kx dflt="$sysroot/usr/include"
     5         kx incpath=''
     5         kx mips_type=''
     5         kx if $test -f /bin/mips && /bin/mips; then
     5         kx 	echo "Looks like a MIPS system..."
     5         kx 	$cat >usr.c <<'EOCP'
     5         kx #ifdef SYSTYPE_BSD43
     5         kx /bsd43
     5         kx #endif
     5         kx EOCP
     5         kx 	if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
     5         kx 		dflt='/bsd43/usr/include'
     5         kx 		incpath='/bsd43'
     5         kx 		mips_type='BSD 4.3'
     5         kx 	else
     5         kx 		mips_type='System V'
     5         kx 	fi
     5         kx 	$rm -f usr.c usr.out
     5         kx 	echo "and you're compiling with the $mips_type compiler and libraries."
     5         kx 	xxx_prompt=y
     5         kx 	echo "exit 0" >mips
     5         kx else
     5         kx 	echo "Doesn't look like a MIPS system."
     5         kx 	xxx_prompt=n
     5         kx 	echo "exit 1" >mips
     5         kx fi
     5         kx chmod +x mips
     5         kx $eunicefix mips
     5         kx case "$usrinc" in
     5         kx '') ;;
     5         kx *) dflt="$usrinc";;
     5         kx esac
     5         kx case "$xxx_prompt" in
     5         kx y)	fn=d/
     5         kx 	echo " "
     5         kx 	rp='Where are the include files you want to use?'
     5         kx 	. ./getfile
     5         kx 	usrinc="$ans"
     5         kx 	;;
     5         kx *)	usrinc="$dflt"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see how we invoke the C preprocessor
     5         kx echo " "
     5         kx echo "Now, how can we feed standard input to your C preprocessor..." >&4
     5         kx cat <<'EOT' >testcpp.c
     5         kx #define ABC abc
     5         kx #define XYZ xyz
     5         kx ABC.XYZ
     5         kx EOT
     5         kx cd ..
     5         kx if test ! -f cppstdin; then
     5         kx 	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
     5         kx 		# AIX cc -E doesn't show the absolute headerfile
     5         kx 		# locations but we'll cheat by using the -M flag.
     5         kx 		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
     5         kx 	else
     5         kx 		echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
     5         kx 	fi
     5         kx else
     5         kx 	echo "Keeping your $hint cppstdin wrapper."
     5         kx fi
     5         kx chmod 755 cppstdin
     5         kx wrapper=`pwd`/cppstdin
     5         kx ok='false'
     5         kx cd UU
     5         kx 
     5         kx if $test "X$cppstdin" != "X" && \
     5         kx 	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
     5         kx then
     5         kx 	echo "You used to use $cppstdin $cppminus so we'll use that again."
     5         kx 	case "$cpprun" in
     5         kx 	'') echo "But let's see if we can live without a wrapper..." ;;
     5         kx 	*)
     5         kx 		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
     5         kx 			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
     5         kx 		then
     5         kx 			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
     5         kx 			ok='true'
     5         kx 		else
     5         kx 			echo "(However, $cpprun $cpplast does not work, let's see...)"
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	case "$cppstdin" in
     5         kx 	'') ;;
     5         kx 	*)
     5         kx 		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx if $ok; then
     5         kx 	: nothing
     5         kx elif echo 'Maybe "'"$cc"' -E" will work...'; \
     5         kx 	$cc -E <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "Yup, it does."
     5         kx 	x_cpp="$cc $cppflags -E"
     5         kx 	x_minus='';
     5         kx elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
     5         kx 	$cc -E - <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "Yup, it does."
     5         kx 	x_cpp="$cc $cppflags -E"
     5         kx 	x_minus='-';
     5         kx elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
     5         kx 	$cc -P <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "Yipee, that works!"
     5         kx 	x_cpp="$cc $cppflags -P"
     5         kx 	x_minus='';
     5         kx elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
     5         kx 	$cc -P - <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "At long last!"
     5         kx 	x_cpp="$cc $cppflags -P"
     5         kx 	x_minus='-';
     5         kx elif echo 'No such luck, maybe "'$cpp'" will work...'; \
     5         kx 	$cpp <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "It works!"
     5         kx 	x_cpp="$cpp $cppflags"
     5         kx 	x_minus='';
     5         kx elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
     5         kx 	$cpp - <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	echo "Hooray, it works!  I was beginning to wonder."
     5         kx 	x_cpp="$cpp $cppflags"
     5         kx 	x_minus='-';
     5         kx elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
     5         kx 	$wrapper <testcpp.c >testcpp.out 2>&1; \
     5         kx 	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 	x_cpp="$wrapper"
     5         kx 	x_minus=''
     5         kx 	echo "Eureka!"
     5         kx else
     5         kx 	dflt=''
     5         kx 	rp="No dice.  I can't find a C preprocessor.  Name one:"
     5         kx 	. ./myread
     5         kx 	x_cpp="$ans"
     5         kx 	x_minus=''
     5         kx 	$x_cpp <testcpp.c >testcpp.out 2>&1
     5         kx 	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
     5         kx 		echo "OK, that will do." >&4
     5         kx 	else
     5         kx echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
     5         kx 		exit 1
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx case "$ok" in
     5         kx false)
     5         kx 	cppstdin="$x_cpp"
     5         kx 	cppminus="$x_minus"
     5         kx 	cpprun="$x_cpp"
     5         kx 	cpplast="$x_minus"
     5         kx 	set X $x_cpp
     5         kx 	shift
     5         kx 	case "$1" in
     5         kx 	"$cpp")
     5         kx 		echo "Perhaps can we force $cc -E using a wrapper..."
     5         kx 		if $wrapper <testcpp.c >testcpp.out 2>&1; \
     5         kx 			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
     5         kx 		then
     5         kx 			echo "Yup, we can."
     5         kx 			cppstdin="$wrapper"
     5         kx 			cppminus='';
     5         kx 		else
     5         kx 			echo "Nope, we'll have to live without it..."
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$cpprun" in
     5         kx 	"$wrapper")
     5         kx 		cpprun=''
     5         kx 		cpplast=''
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$cppstdin" in
     5         kx "$wrapper"|'cppstdin') ;;
     5         kx *) $rm -f $wrapper;;
     5         kx esac
     5         kx $rm -f testcpp.c testcpp.out
     5         kx 
     5         kx : Adjust cppfilter for path component separator
     5         kx case "$osname" in
     5         kx vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
     5         kx os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
     5         kx *)   cppfilter='' ;;
     5         kx esac
     5         kx 
     5         kx : Use gcc to determine libpth and incpth
     5         kx # If using gcc or clang, we can get better values for libpth, incpth
     5         kx # and usrinc directly from the compiler.
     5         kx # Note that ccname for clang is also gcc.
     5         kx case "$ccname" in
     5         kx     gcc)
     5         kx 	realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
     5         kx 	$echo 'extern int foo;' > try.c
     5         kx 	set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
     5         kx 	shift
     5         kx 	inclibpth=""
     5         kx 	if $test $# -gt 0; then
     5         kx 	    for i in $*; do
     5         kx 		case $realpath in
     5         kx 		    */realpath) i=`$realpath $i` ;;
     5         kx 		esac
     5         kx 		incpth="$incpth $i"
     5         kx 		j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
     5         kx 		if $test -d $j; then
     5         kx 		    inclibpth="$inclibpth $j"
     5         kx 		fi
     5         kx 	    done
     5         kx 	    incpth="`$echo $incpth | $sed 's/^ //'`"
     5         kx 	    for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
     5         kx 		if $test -d $xxx; then
     5         kx 		    case $realpath in
     5         kx 			*/realpath) xxx=`$realpath $xxx` ;;
     5         kx 		    esac
     5         kx 		    case " $libpth " in
     5         kx 		    *" $xxx "*) ;;
     5         kx 		    *) libpth="$libpth $xxx";;
     5         kx 		    esac
     5         kx 		fi
     5         kx 	    done
     5         kx 	    libpth="`$echo $libpth | $sed 's/^ //'`"
     5         kx 	fi
     5         kx 	$rm -f try.c
     5         kx 	case "$usrinc" in
     5         kx 	'') for i in $incpth; do
     5         kx 		if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
     5         kx 		    usrinc="$i"
     5         kx 		    break
     5         kx 		fi
     5         kx 	    done
     5         kx 	    ;;
     5         kx 	esac
     5         kx 
     5         kx 	case "$usecrosscompile" in
     5         kx 	$define|true|[yY]*)
     5         kx 	    case "$incpth" in
     5         kx 		'') echo "Incpth not defined." >&4; croak=y ;;
     5         kx 		*)  echo "Using incpth '$incpth'." >&4 ;;
     5         kx 	    esac
     5         kx 	    case "$libpth" in
     5         kx 		'') echo "Libpth not defined." >&4; croak=y ;;
     5         kx 		*)  echo "Using libpth '$libpth'." >&4 ;;
     5         kx 	    esac
     5         kx 	    case "$usrinc" in
     5         kx 		'') echo "Usrinc not defined." >&4; croak=y ;;
     5         kx 		*)  echo "Using usrinc $usrinc." >&4 ;;
     5         kx 	    esac
     5         kx 	    case "$croak" in
     5         kx 		y)
     5         kx 		if test "X$sysroot" = X; then
     5         kx 		    echo "Cannot continue, aborting." >&4; exit 1
     5         kx 		else
     5         kx 		    echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
     5         kx 		fi
     5         kx 		;;
     5         kx 	    esac
     5         kx 	    ;;
     5         kx 	esac
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Default value for incpth is just usrinc
     5         kx case "$incpth" in
     5         kx '') incpth="$usrinc";;
     5         kx esac
     5         kx 
     5         kx : Set private lib path
     5         kx case "$plibpth" in
     5         kx '') if ./mips; then
     5         kx 	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
     5         kx     fi;;
     5         kx esac
     5         kx case "$libpth" in
     5         kx ' ') dlist='';;
     5         kx '') dlist="$loclibpth $plibpth $glibpth";;
     5         kx *) dlist="$libpth";;
     5         kx esac
     5         kx 
     5         kx : Now check and see which directories actually exist, avoiding duplicates
     5         kx for xxx in $dlist
     5         kx do
     5         kx     if $test -d $xxx; then
     5         kx 		case " $libpth " in
     5         kx 		*" $xxx "*) ;;
     5         kx 		*) libpth="$libpth $xxx";;
     5         kx 		esac
     5         kx     fi
     5         kx done
     5         kx $cat <<'EOM'
     5         kx 
     5         kx Some systems have incompatible or broken versions of libraries.  Among
     5         kx the directories listed in the question below, please remove any you
     5         kx know not to be holding relevant libraries, and add any that are needed.
     5         kx Say "none" for none.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx if test "X$sysroot" != X; then
     5         kx     $cat <<EOM
     5         kx You have set sysroot to $sysroot, please supply the directories excluding sysroot
     5         kx 
     5         kx EOM
     5         kx fi
     5         kx 
     5         kx case "$libpth" in
     5         kx '') dflt='none';;
     5         kx *)
     5         kx 	set X $libpth
     5         kx 	shift
     5         kx 	dflt=${1+"$@"}
     5         kx 	;;
     5         kx esac
     5         kx rp="Directories to use for library searches?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none) libpth=' ';;
     5         kx *) libpth="$ans";;
     5         kx esac
     5         kx 
     5         kx : compute shared library extension
     5         kx case "$so" in
     5         kx '')
     5         kx 	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
     5         kx 		dflt='sl'
     5         kx 	else
     5         kx 		dflt='so'
     5         kx 	fi
     5         kx 	;;
     5         kx *) dflt="$so";;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx On some systems, shared libraries may be available.  Answer 'none' if
     5         kx you want to suppress searching of shared libraries for the remainder
     5         kx of this configuration.
     5         kx 
     5         kx EOM
     5         kx rp='What is the file extension used for shared libraries?'
     5         kx . ./myread
     5         kx so="$ans"
     5         kx 
     5         kx : Does target system insist that shared library basenames are unique
     5         kx $cat << EOM
     5         kx 
     5         kx Some dynamic loaders assume that the *basename* of shared library filenames
     5         kx are globally unique.  We'll default this to undef as we assume your system
     5         kx is not this weird. Set to defined if you're on one of them.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx dflt='n'
     5         kx rp='Make shared library basenames unique?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y) val="$define" ;;
     5         kx *)   val="$undef"  ;;
     5         kx esac
     5         kx set d_libname_unique
     5         kx eval $setvar
     5         kx 
     5         kx : Define several unixisms.
     5         kx : Hints files or command line option can be used to override them.
     5         kx : The convoluted testing is in case hints files set either the old
     5         kx : or the new name.
     5         kx case "$_exe" in
     5         kx '')	case "$exe_ext" in
     5         kx 	'')	;;
     5         kx 	*)	_exe="$exe_ext" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$_a" in
     5         kx '')	case "$lib_ext" in
     5         kx     '')	_a='.a';;
     5         kx 	*)	_a="$lib_ext" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$_o" in
     5         kx '') case "$obj_ext" in
     5         kx 	'')	_o='.o';;
     5         kx 	*)	_o="$obj_ext";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$p_" in
     5         kx '') case "$path_sep" in
     5         kx 	'')	p_=':';;
     5         kx 	*)	p_="$path_sep";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx exe_ext=$_exe
     5         kx lib_ext=$_a
     5         kx obj_ext=$_o
     5         kx path_sep=$p_
     5         kx 
     5         kx rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
     5         kx 
     5         kx : Which makefile gets called first.  This is used by make depend.
     5         kx case "$firstmakefile" in
     5         kx '') firstmakefile='makefile';;
     5         kx esac
     5         kx 
     5         kx : Check is we will use socks
     5         kx case "$usesocks" in
     5         kx $define|true|[yY]*)	dflt='y';;
     5         kx *) dflt='n';;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built to use the SOCKS proxy protocol library.  To do so,
     5         kx Configure must be run with -Dusesocks.  If you use SOCKS you also need
     5         kx to use the PerlIO abstraction layer, this will be implicitly selected.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Build Perl for SOCKS?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)	val="$define" ;;
     5         kx *)      val="$undef" ;;
     5         kx esac
     5         kx set usesocks
     5         kx eval $setvar
     5         kx 
     5         kx : Check for uselongdouble support
     5         kx case "$ccflags" in
     5         kx *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
     5         kx esac
     5         kx 
     5         kx case "$uselongdouble" in
     5         kx $define|true|[yY]*)	dflt='y';;
     5         kx *) dflt='n';;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built to take advantage of long doubles which
     5         kx (if available) may give more accuracy and range for floating point numbers.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Try to use long doubles if available?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)	val="$define"	;;
     5         kx *)      val="$undef"	;;
     5         kx esac
     5         kx set uselongdouble
     5         kx eval $setvar
     5         kx 
     5         kx case "$uselongdouble" in
     5         kx true|[yY]*) uselongdouble="$define" ;;
     5         kx esac
     5         kx 
     5         kx : Look for a hint-file generated 'call-back-unit'.  If the
     5         kx : user has specified that long doubles should be used,
     5         kx : we may need to set or change some other defaults.
     5         kx if $test -f uselongdouble.cbu; then
     5         kx     echo "Your platform has some specific hints regarding long doubles, using them..."
     5         kx     . ./uselongdouble.cbu
     5         kx else
     5         kx     case "$uselongdouble" in
     5         kx 	$define)
     5         kx 		$cat <<EOM
     5         kx (Your platform does not have any specific hints for long doubles.)
     5         kx EOM
     5         kx 	;;
     5         kx     esac
     5         kx fi
     5         kx 
     5         kx : Check if quadmath is requested
     5         kx case "$usequadmath" in
     5         kx "$define"|true|[yY]*) usequadmath="$define" ;;
     5         kx *)                    usequadmath="$undef"  ;;
     5         kx esac
     5         kx 
     5         kx : Fail if both uselongdouble and usequadmath are requested
     5         kx case "$usequadmath:$uselongdouble" in
     5         kx define:define)
     5         kx 	$cat <<EOM >&4
     5         kx 
     5         kx *** You requested the use of the quadmath library and use
     5         kx *** of long doubles.
     5         kx ***
     5         kx *** Please select one or the other.
     5         kx EOM
     5         kx 	exit 1
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Looking for optional libraries
     5         kx echo " "
     5         kx echo "Checking for optional libraries..." >&4
     5         kx case "$libs" in
     5         kx ' '|'') dflt='';;
     5         kx *) dflt="$libs";;
     5         kx esac
     5         kx case "$libswanted" in
     5         kx '') libswanted='c_s';;
     5         kx esac
     5         kx case "$usesocks" in
     5         kx "$define") libswanted="$libswanted socks5 socks5_sh" ;;
     5         kx esac
     5         kx case "$usecbacktrace" in
     5         kx "$define") libswanted="$libswanted bfd" ;;
     5         kx esac
     5         kx case "$usequadmath" in
     5         kx "$define") libswanted="$libswanted quadmath" ;;
     5         kx esac
     5         kx libsfound=''
     5         kx libsfiles=''
     5         kx libsdirs=''
     5         kx libspath=''
     5         kx for thisdir in $libpth $xlibpth; do
     5         kx   test -d $thisdir && libspath="$libspath $thisdir"
     5         kx done
     5         kx for thislib in $libswanted; do
     5         kx 	for thisdir in $libspath; do
     5         kx 	    xxx=''
     5         kx 	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
     5         kx 		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=shared
     5         kx 		xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=shared
     5         kx 	    fi
     5         kx 	    if test ! -f "$xxx"; then
     5         kx 		xxx=$thisdir/lib$thislib.$so
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=shared
     5         kx 	    fi
     5         kx 	    if test ! -f "$xxx"; then
     5         kx 		xxx=$thisdir/lib$thislib$_a
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=static
     5         kx 	    fi
     5         kx 	    if test ! -f "$xxx"; then
     5         kx 		xxx=$thisdir/$thislib$_a
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=static
     5         kx 	    fi
     5         kx 	    if test ! -f "$xxx"; then
     5         kx 		xxx=$thisdir/lib${thislib}_s$_a
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=static
     5         kx 		$test -f "$xxx" && thislib=${thislib}_s
     5         kx 	    fi
     5         kx 	    if test ! -f "$xxx"; then
     5         kx 		xxx=$thisdir/Slib$thislib$_a
     5         kx 	        $test -f "$xxx" && eval $libscheck
     5         kx 		$test -f "$xxx" && libstyle=static
     5         kx 	    fi
     5         kx 	    if $test -f "$xxx"; then
     5         kx 		case "$libstyle" in
     5         kx 		shared) echo "Found -l$thislib (shared)." ;;
     5         kx 		static) echo "Found -l$thislib." ;;
     5         kx 		*)      echo "Found -l$thislib ($libstyle)." ;;
     5         kx 		esac
     5         kx 		case " $dflt " in
     5         kx 		*"-l$thislib "*);;
     5         kx 		*) dflt="$dflt -l$thislib"
     5         kx                    libsfound="$libsfound $xxx"
     5         kx                    yyy=`basename $xxx`
     5         kx                    libsfiles="$libsfiles $yyy"
     5         kx                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
     5         kx                    case " $libsdirs " in
     5         kx                    *" $yyy "*) ;;
     5         kx                    *) libsdirs="$libsdirs $yyy" ;;
     5         kx                    esac
     5         kx 		   ;;
     5         kx 		esac
     5         kx 		break
     5         kx 	    fi
     5         kx 	done
     5         kx 	if $test ! -f "$xxx"; then
     5         kx 	    echo "No -l$thislib."
     5         kx 	fi
     5         kx done
     5         kx set X $dflt
     5         kx shift
     5         kx dflt="$*"
     5         kx case "$libs" in
     5         kx '') dflt="$dflt";;
     5         kx *) dflt="$libs";;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ' '|'') dflt='none';;
     5         kx esac
     5         kx 
     5         kx $cat <<EOM
     5         kx 
     5         kx In order to compile $package on your machine, a number of libraries
     5         kx are usually needed.  Include any other special libraries here as well.
     5         kx Say "none" for none.  The default list is almost always right.
     5         kx EOM
     5         kx 
     5         kx echo " "
     5         kx rp="What libraries to use?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none) libs=' ';;
     5         kx *) libs="$ans";;
     5         kx esac
     5         kx 
     5         kx : determine optimization, if desired, or use for debug flag also
     5         kx case "$optimize" in
     5         kx ' '|$undef) dflt='none';;
     5         kx '') dflt='-O';;
     5         kx *) dflt="$optimize";;
     5         kx esac
     5         kx $cat <<EOH
     5         kx 
     5         kx By default, $package compiles with the -O flag to use the optimizer.
     5         kx Alternately, you might want to use the symbolic debugger, which uses
     5         kx the -g flag (on traditional Unix systems).  Either flag can be
     5         kx specified here.  To use neither flag, specify the word "none".
     5         kx 
     5         kx EOH
     5         kx rp="What optimizer/debugger flag should be used?"
     5         kx . ./myread
     5         kx optimize="$ans"
     5         kx case "$optimize" in
     5         kx 'none') optimize=" ";;
     5         kx esac
     5         kx 
     5         kx : Check what DEBUGGING is required from the command line
     5         kx : -DEBUGGING      or -DDEBUGGING or
     5         kx : -DEBUGGING=both			= -g + -DDEBUGGING
     5         kx : -DEBUGGING=-g   or -Doptimize=-g	= -g
     5         kx : -DEBUGGING=none or -UDEBUGGING	=
     5         kx : -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
     5         kx case "$EBUGGING" in
     5         kx '')	;;
     5         kx *)	DEBUGGING=$EBUGGING ;;
     5         kx esac
     5         kx 
     5         kx case "$DEBUGGING" in
     5         kx -g|both|$define)
     5         kx     case "$optimize" in
     5         kx 	*-g*) ;;
     5         kx 	*)    optimize="$optimize -g" ;;
     5         kx     esac ;;
     5         kx none|$undef)
     5         kx     case "$optimize" in
     5         kx 	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
     5         kx 		shift
     5         kx 		optimize="$*"
     5         kx 		;;
     5         kx     esac ;;
     5         kx esac
     5         kx 
     5         kx dflt=''
     5         kx case "$DEBUGGING" in
     5         kx both|$define) dflt='-DDEBUGGING'
     5         kx esac
     5         kx 
     5         kx : argument order is deliberate, as the flag will start with - which set could
     5         kx : think is an option
     5         kx checkccflag='check=$1; flag=$2; callback=$3;
     5         kx echo " ";
     5         kx echo "Checking if your compiler accepts $flag" >&4;
     5         kx [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
     5         kx echo "int main(void) { return 0; }" > gcctest.c;
     5         kx if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
     5         kx     echo "Yes, it does." >&4;
     5         kx     if $test -s gcctest.out ; then
     5         kx         echo "But your platform does not like it:";
     5         kx         cat gcctest.out;
     5         kx     else
     5         kx 	case "$ccflags" in
     5         kx 	*$check*)
     5         kx 	    echo "Leaving current flags $ccflags alone." >&4
     5         kx 	    ;;
     5         kx 	*) dflt="$dflt $flag";
     5         kx 	    eval $callback
     5         kx 	    ;;
     5         kx 	esac
     5         kx     fi
     5         kx else
     5         kx     echo "Nope, it does not, but that is ok." >&4;
     5         kx fi
     5         kx '
     5         kx 
     5         kx : We will not override a previous value, but we might want to
     5         kx : augment a hint file
     5         kx case "$hint" in
     5         kx default|recommended)
     5         kx 	case "$gccversion" in
     5         kx 	1.*) dflt="$dflt -fpcc-struct-return" ;;
     5         kx 	esac
     5         kx 	case "$optimize:$DEBUGGING" in
     5         kx 	*-g*:old) dflt="$dflt -DDEBUGGING";;
     5         kx 	esac
     5         kx 	case "$gccversion" in
     5         kx 	2.*) if $test -d /etc/conf/kconfig.d &&
     5         kx 			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
     5         kx 		then
     5         kx 			# Interactive Systems (ISC) POSIX mode.
     5         kx 			dflt="$dflt -posix"
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$gccversion" in
     5         kx 	1.*) ;;
     5         kx 	2.[0-8]*) ;;
     5         kx 	?*)	set strict-aliasing -fno-strict-aliasing
     5         kx 		eval $checkccflag
     5         kx 		;;
     5         kx 	esac
     5         kx 	# For gcc, adding -pipe speeds up compilations for some, but apparently
     5         kx 	# some assemblers can't read from stdin.  (It also slows down compilations
     5         kx 	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
     5         kx 	case "$gccversion" in
     5         kx 	?*)	set pipe -pipe
     5         kx 		eval $checkccflag
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	# on x86_64 (at least) we require an extra library (libssp) in the
     5         kx 	# link command line. This library is not named, so I infer that it is
     5         kx 	# an implementation detail that may change. Hence the safest approach
     5         kx 	# is to add the flag to the flags passed to the compiler at link time,
     5         kx 	# as that way the compiler can do the right implementation dependant
     5         kx 	# thing. (NWC)
     5         kx 	case "$ccflags" in
     5         kx 	*-fno-stack-protector*)
     5         kx 	    echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
     5         kx 	    ;;
     5         kx 	*) case "$gccversion" in
     5         kx 	   ?*)	set stack-protector-strong -fstack-protector-strong
     5         kx 		eval $checkccflag
     5         kx 		case "$dflt" in
     5         kx 		*-fstack-protector-strong*) ;; # It got added.
     5         kx 		*) # Try the plain/older -fstack-protector.
     5         kx 		   set stack-protector -fstack-protector
     5         kx 		   eval $checkccflag
     5         kx 		   ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	    esac
     5         kx 	    ;;
     5         kx 	esac
     5         kx esac
     5         kx 
     5         kx case "$mips_type" in
     5         kx *BSD*|'') inclwanted="$locincpth $usrinc";;
     5         kx *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
     5         kx esac
     5         kx for thisincl in $inclwanted; do
     5         kx 	if $test -d $thisincl; then
     5         kx 		if $test x$thisincl != x$usrinc; then
     5         kx 			case "$dflt" in
     5         kx 			*" -I$thisincl "*);;
     5         kx 			*) dflt="$dflt -I$thisincl ";;
     5         kx 			esac
     5         kx 		fi
     5         kx 	fi
     5         kx done
     5         kx 
     5         kx inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
     5         kx 	xxx=true;
     5         kx elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
     5         kx 	xxx=true;
     5         kx else
     5         kx 	xxx=false;
     5         kx fi;
     5         kx if $xxx; then
     5         kx 	case "$dflt" in
     5         kx 	*$2*);;
     5         kx 	*) dflt="$dflt -D$2";;
     5         kx 	esac;
     5         kx fi'
     5         kx 
     5         kx set signal.h LANGUAGE_C; eval $inctest
     5         kx 
     5         kx case "$usesocks" in
     5         kx $define)
     5         kx 	ccflags="$ccflags -DSOCKS"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$hint" in
     5         kx default|recommended) dflt="$ccflags $dflt" ;;
     5         kx *) dflt="$ccflags";;
     5         kx esac
     5         kx 
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none;;
     5         kx esac
     5         kx 
     5         kx $cat <<EOH
     5         kx 
     5         kx Your C compiler may want other flags.  For this question you should include
     5         kx -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
     5         kx but you should NOT include libraries or ld flags like -lwhatever.  If you
     5         kx want $package to honor its debug switch, you should include -DDEBUGGING here.
     5         kx Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
     5         kx 
     5         kx To use no flags, specify the word "none".
     5         kx 
     5         kx EOH
     5         kx set X $dflt
     5         kx shift
     5         kx dflt=${1+"$@"}
     5         kx rp="Any additional cc flags?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none) ccflags='';;
     5         kx *) ccflags="$ans";;
     5         kx esac
     5         kx 
     5         kx : the following weeds options from ccflags that are of no interest to cpp
     5         kx case "$cppflags" in
     5         kx '') cppflags="$ccflags" ;;
     5         kx *)  set X $ccflags; shift
     5         kx     case " $cppflags " in
     5         kx     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
     5         kx     *) cppflags="$cppflags $ccflags" ;;
     5         kx     esac
     5         kx     ;;
     5         kx esac
     5         kx case "$gccversion" in
     5         kx 1.*) cppflags="$cppflags -D__GNUC__"
     5         kx esac
     5         kx case "$mips_type" in
     5         kx '');;
     5         kx *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
     5         kx esac
     5         kx case "$cppflags" in
     5         kx '');;
     5         kx *)
     5         kx 	echo " "
     5         kx 	echo "Let me guess what the preprocessor flags are..." >&4
     5         kx 	set X $cppflags
     5         kx 	shift
     5         kx 	cppflags=''
     5         kx 	$cat >cpp.c <<'EOM'
     5         kx #define BLURFL foo
     5         kx 
     5         kx BLURFL xx LFRULB
     5         kx EOM
     5         kx 	previous=''
     5         kx 	for flag in $*
     5         kx 	do
     5         kx 		case "$flag" in
     5         kx 		-*) ftry="$flag";;
     5         kx 		*) ftry="$previous $flag";;
     5         kx 		esac
     5         kx 		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
     5         kx 			>cpp1.out 2>/dev/null && \
     5         kx 			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
     5         kx 			>cpp2.out 2>/dev/null && \
     5         kx 			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
     5         kx 			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
     5         kx 		then
     5         kx 			cppflags="$cppflags $ftry"
     5         kx 			previous=''
     5         kx 		else
     5         kx 			previous="$flag"
     5         kx 		fi
     5         kx 	done
     5         kx 	set X $cppflags
     5         kx 	shift
     5         kx 	cppflags=${1+"$@"}
     5         kx 	case "$cppflags" in
     5         kx 	*-*)  echo "They appear to be: $cppflags";;
     5         kx 	esac
     5         kx 	$rm -f cpp.c cpp?.out
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : flags used in final linking phase
     5         kx case "$ldflags" in
     5         kx '') if ./venix; then
     5         kx 		dflt='-i -z'
     5         kx 	else
     5         kx 		dflt=''
     5         kx 	fi
     5         kx 	case "$ccflags" in
     5         kx 	*-posix*) dflt="$dflt -posix" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *) dflt="$ldflags";;
     5         kx esac
     5         kx # See note above about -fstack-protector
     5         kx case "$ccflags" in
     5         kx *-fstack-protector-strong*)
     5         kx 	case "$dflt" in
     5         kx 	*-fstack-protector-strong*) ;; # Don't add it again
     5         kx 	*) dflt="$dflt -fstack-protector-strong" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *-fstack-protector*)
     5         kx 	case "$dflt" in
     5         kx 	*-fstack-protector*) ;; # Don't add it again
     5         kx 	*) dflt="$dflt -fstack-protector" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Try to guess additional flags to pick up local libraries.
     5         kx for thislibdir in $libpth; do
     5         kx 	case " $loclibpth " in
     5         kx 	*" $thislibdir "*)
     5         kx 		case "$dflt " in
     5         kx 		*"-L$thislibdir "*) ;;
     5         kx 		*)  dflt="$dflt -L$thislibdir" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx case "$dflt" in
     5         kx '') dflt='none' ;;
     5         kx esac
     5         kx 
     5         kx $cat <<EOH
     5         kx 
     5         kx Your C linker may need flags.  For this question you should
     5         kx include -L/whatever and any other flags used by the C linker, but you
     5         kx should NOT include libraries like -lwhatever.
     5         kx 
     5         kx Make sure you include the appropriate -L/path flags if your C linker
     5         kx does not normally search all of the directories you specified above,
     5         kx namely
     5         kx 	$libpth
     5         kx To use no flags, specify the word "none".
     5         kx 
     5         kx EOH
     5         kx 
     5         kx rp="Any additional ld flags (NOT including libraries)?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx none) ldflags='';;
     5         kx *) ldflags="$ans";;
     5         kx esac
     5         kx rmlist="$rmlist pdp11"
     5         kx 
     5         kx : coherency check
     5         kx echo " "
     5         kx echo "Checking your choice of C compiler and flags for coherency..." >&4
     5         kx $cat > try.c <<'EOF'
     5         kx #include <stdio.h>
     5         kx int main() { printf("Ok\n"); return(0); }
     5         kx EOF
     5         kx set X $cc -o try $optimize $ccflags $ldflags try.c $libs
     5         kx shift
     5         kx $cat >try.msg <<'EOM'
     5         kx I've tried to compile and run the following simple program:
     5         kx 
     5         kx EOM
     5         kx $cat try.c >> try.msg
     5         kx 
     5         kx $cat >> try.msg <<EOM
     5         kx 
     5         kx I used the command:
     5         kx 
     5         kx 	$*
     5         kx 	$run ./try
     5         kx 
     5         kx and I got the following output:
     5         kx 
     5         kx EOM
     5         kx dflt=y
     5         kx if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
     5         kx 	if $sh -c "$run ./try " >>try.msg 2>&1; then
     5         kx 		xxx=`$run ./try`
     5         kx 		case "$xxx" in
     5         kx 		"Ok") dflt=n ;;
     5         kx 		*)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "The program compiled OK, but exited with status $?." >>try.msg
     5         kx 		rp="You have a problem.  Shall I abort Configure"
     5         kx 		dflt=y
     5         kx 	fi
     5         kx else
     5         kx 	echo "I can't compile the test program." >>try.msg
     5         kx 	rp="You have a BIG problem.  Shall I abort Configure"
     5         kx 	dflt=y
     5         kx fi
     5         kx case "$dflt" in
     5         kx y)
     5         kx 	$cat try.msg >&4
     5         kx 	case "$knowitall" in
     5         kx 	'')
     5         kx 		echo "(The supplied flags or libraries might be incorrect.)"
     5         kx 		;;
     5         kx 	*) dflt=n;;
     5         kx 	esac
     5         kx 	echo " "
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	n*|N*) ;;
     5         kx 	*)	echo "Ok.  Stopping Configure." >&4
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx n) echo "OK, that should do.";;
     5         kx esac
     5         kx $rm_try gcctest gcctest.out
     5         kx 
     5         kx : define a shorthand compile call
     5         kx compile='
     5         kx mc_file=$1;
     5         kx shift;
     5         kx case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
     5         kx echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
     5         kx exit 1;
     5         kx fi;
     5         kx esac;
     5         kx $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
     5         kx : define a shorthand compile call for compilations that should be ok.
     5         kx compile_ok='
     5         kx mc_file=$1;
     5         kx shift;
     5         kx $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
     5         kx 
     5         kx : stub, used only to satisfy other units
     5         kx i_stdlib='define'
     5         kx 
     5         kx : check for lengths of integral types
     5         kx echo " "
     5         kx case "$intsize" in
     5         kx '')
     5         kx 	echo "Checking to see how big your integers are..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx 	printf("intsize=%d;\n", (int)sizeof(int));
     5         kx 	printf("longsize=%d;\n", (int)sizeof(long));
     5         kx 	printf("shortsize=%d;\n", (int)sizeof(short));
     5         kx 	exit(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok && $run ./try > /dev/null; then
     5         kx 		eval `$run ./try`
     5         kx 		echo "Your integers are $intsize bytes long."
     5         kx 		echo "Your long integers are $longsize bytes long."
     5         kx 		echo "Your short integers are $shortsize bytes long."
     5         kx 	else
     5         kx 		$cat >&4 <<EOM
     5         kx !
     5         kx Help! I can't compile and run the intsize test program: please enlighten me!
     5         kx (This is probably a misconfiguration in your system or libraries, and
     5         kx you really ought to fix it.  Still, I'll try anyway.)
     5         kx !
     5         kx EOM
     5         kx 		dflt=4
     5         kx 		rp="What is the size of an integer (in bytes)?"
     5         kx 		. ./myread
     5         kx 		intsize="$ans"
     5         kx 		dflt=$intsize
     5         kx 		rp="What is the size of a long integer (in bytes)?"
     5         kx 		. ./myread
     5         kx 		longsize="$ans"
     5         kx 		dflt=2
     5         kx 		rp="What is the size of a short integer (in bytes)?"
     5         kx 		. ./myread
     5         kx 		shortsize="$ans"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : check for long long
     5         kx echo " "
     5         kx echo "Checking to see if you have long long..." >&4
     5         kx echo 'int main() { long long x = 7; return 0; }' > try.c
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have long long."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have long long."
     5         kx fi
     5         kx $rm_try
     5         kx set d_longlong
     5         kx eval $setvar
     5         kx 
     5         kx : check for length of long long
     5         kx case "${d_longlong}${longlongsize}" in
     5         kx $define)
     5         kx 	echo " "
     5         kx 	echo "Checking to see how big your long longs are..." >&4
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)sizeof(long long));
     5         kx     return(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		longlongsize=`$run ./try`
     5         kx 		echo "Your long longs are $longlongsize bytes long."
     5         kx 	else
     5         kx 		dflt='8'
     5         kx 		echo " "
     5         kx 		echo "(I can't seem to compile the test program.  Guessing...)"
     5         kx 		rp="What is the size of a long long (in bytes)?"
     5         kx 		. ./myread
     5         kx 		longlongsize="$ans"
     5         kx 	fi
     5         kx 	if $test "X$longsize" = "X$longlongsize"; then
     5         kx 		echo "(That isn't any different from an ordinary long.)"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : determine filename position in cpp output
     5         kx echo " "
     5         kx echo "Computing filename position in cpp output for #include directives..." >&4
     5         kx case "$osname" in
     5         kx amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
     5         kx esac
     5         kx case "$fieldn" in
     5         kx '')
     5         kx case "$osname" in
     5         kx vos) testaccess=-e ;;
     5         kx *)   testaccess=-r ;;
     5         kx esac
     5         kx echo '#include <stdio.h>' > foo.c
     5         kx $cat >fieldn <<EOF
     5         kx $startsh
     5         kx $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
     5         kx $grep '^[ 	]*#.*stdio\.h' | \
     5         kx while read cline; do
     5         kx 	pos=1
     5         kx 	set \$cline
     5         kx 	while $test \$# -gt 0; do
     5         kx 		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
     5         kx 			echo "\$pos"
     5         kx 			exit 0
     5         kx 		fi
     5         kx 		shift
     5         kx 		pos=\`expr \$pos + 1\`
     5         kx 	done
     5         kx done
     5         kx EOF
     5         kx chmod +x fieldn
     5         kx fieldn=`./fieldn`
     5         kx $rm -f foo.c fieldn
     5         kx ;;
     5         kx esac
     5         kx case $fieldn in
     5         kx '') pos='???';;
     5         kx 1) pos=first;;
     5         kx 2) pos=second;;
     5         kx 3) pos=third;;
     5         kx *) pos="${fieldn}th";;
     5         kx esac
     5         kx echo "Your cpp writes the filename in the $pos field of the line."
     5         kx 
     5         kx : locate header file
     5         kx $cat >findhdr <<EOF
     5         kx $startsh
     5         kx wanted=\$1
     5         kx name=''
     5         kx for usrincdir in $incpth
     5         kx do
     5         kx 	if test -f \$usrincdir/\$wanted; then
     5         kx 		echo "\$usrincdir/\$wanted"
     5         kx 		exit 0
     5         kx 	fi
     5         kx done
     5         kx awkprg='{ print \$$fieldn }'
     5         kx echo "#include <\$wanted>" > foo\$\$.c
     5         kx $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
     5         kx $cppfilter $grep "^[ 	]*#.*\$wanted" | \
     5         kx while read cline; do
     5         kx 	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
     5         kx 	case "\$name" in
     5         kx 	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
     5         kx 	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
     5         kx 	*) exit 2;;
     5         kx 	esac;
     5         kx done;
     5         kx #
     5         kx # status = 0: grep returned 0 lines, case statement not executed
     5         kx # status = 1: headerfile found
     5         kx # status = 2: while loop executed, no headerfile found
     5         kx #
     5         kx status=\$?
     5         kx $rm -f foo\$\$.c;
     5         kx if test \$status -eq 1; then
     5         kx 	exit 0;
     5         kx fi
     5         kx exit 1
     5         kx EOF
     5         kx chmod +x findhdr
     5         kx 
     5         kx : define an alternate in-header-list? function
     5         kx inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
     5         kx cont=true; xxf="echo \"<\$1> found.\" >&4";
     5         kx case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
     5         kx *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
     5         kx esac;
     5         kx case $# in 4) instead=instead;; *) instead="at last";; esac;
     5         kx while $test "$cont"; do
     5         kx 	xxx=`./findhdr $1`
     5         kx 	var=$2; eval "was=\$$2";
     5         kx 	if $test "$xxx" && $test -r "$xxx";
     5         kx 	then eval $xxf;
     5         kx 	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
     5         kx 		cont="";
     5         kx 	else eval $xxnf;
     5         kx 	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
     5         kx 	set $yyy; shift; shift; yyy=$@;
     5         kx 	case $# in 0) cont="";;
     5         kx 	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
     5         kx 		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
     5         kx 	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
     5         kx 		xxnf="echo \"there is no <\$1>, ...\" >&4";;
     5         kx 	esac;
     5         kx done;
     5         kx while $test "$yyy";
     5         kx do set $yyy; var=$2; eval "was=\$$2";
     5         kx 	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
     5         kx 	set $yyy; shift; shift; yyy=$@;
     5         kx done'
     5         kx 
     5         kx : see if inttypes.h is available
     5         kx : we want a real compile instead of Inhdr because some systems
     5         kx : have an inttypes.h which includes non-existent headers
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #include <inttypes.h>
     5         kx int main() {
     5         kx 	static int32_t foo32 = 0x12345678;
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	echo "<inttypes.h> found." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "<inttypes.h> NOT found." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx set i_inttypes
     5         kx eval $setvar
     5         kx 
     5         kx : check for int64_t
     5         kx echo " "
     5         kx echo "Checking to see if you have int64_t..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #$i_inttypes I_INTTYPES
     5         kx #ifdef I_INTTYPES
     5         kx #include <inttypes.h>
     5         kx #endif
     5         kx int main() { int64_t x = 7; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have int64_t."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have int64_t."
     5         kx fi
     5         kx $rm_try
     5         kx set d_int64_t
     5         kx eval $setvar
     5         kx 
     5         kx : Check if 64bit ints have a quad type
     5         kx echo " "
     5         kx echo "Checking which 64-bit integer type we could use..." >&4
     5         kx 
     5         kx case "$intsize" in
     5         kx 8) val=int
     5         kx    set quadtype
     5         kx    eval $setvar
     5         kx    val='"unsigned int"'
     5         kx    set uquadtype
     5         kx    eval $setvar
     5         kx    quadkind=1
     5         kx    ;;
     5         kx *) case "$longsize" in
     5         kx    8) val=long
     5         kx       set quadtype
     5         kx       eval $setvar
     5         kx       val='"unsigned long"'
     5         kx       set uquadtype
     5         kx       eval $setvar
     5         kx       quadkind=2
     5         kx       ;;
     5         kx    *) case "$d_longlong:$longlongsize" in
     5         kx       define:8)
     5         kx         val='"long long"'
     5         kx         set quadtype
     5         kx         eval $setvar
     5         kx         val='"unsigned long long"'
     5         kx         set uquadtype
     5         kx         eval $setvar
     5         kx         quadkind=3
     5         kx         ;;
     5         kx       *) case "$d_int64_t" in
     5         kx          define)
     5         kx            val=int64_t
     5         kx            set quadtype
     5         kx            eval $setvar
     5         kx            val=uint64_t
     5         kx            set uquadtype
     5         kx            eval $setvar
     5         kx            quadkind=4
     5         kx            ;;
     5         kx          esac
     5         kx          ;;
     5         kx       esac
     5         kx       ;;
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx 
     5         kx case "$quadtype" in
     5         kx '')	echo "Alas, no 64-bit integer types in sight." >&4
     5         kx 	d_quad="$undef"
     5         kx 	;;
     5         kx *)	echo "We could use '$quadtype' for 64-bit integers." >&4
     5         kx 	d_quad="$define"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Do we want 64bit support
     5         kx case "$uselonglong" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
     5         kx EOM
     5         kx 	use64bitint="$define"
     5         kx 	;;
     5         kx esac
     5         kx case "$use64bits" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
     5         kx EOM
     5         kx 	use64bitint="$define"
     5         kx 	;;
     5         kx esac
     5         kx case "$use64bitints" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
     5         kx EOM
     5         kx 	use64bitint="$define"
     5         kx 	;;
     5         kx esac
     5         kx case "$use64bitsint" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
     5         kx EOM
     5         kx 	use64bitint="$define"
     5         kx 	;;
     5         kx esac
     5         kx case "$uselonglongs" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
     5         kx EOM
     5         kx 	use64bitint="$define"
     5         kx 	;;
     5         kx esac
     5         kx case "$use64bitsall" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
     5         kx EOM
     5         kx 	use64bitall="$define"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$ccflags" in
     5         kx *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
     5         kx esac
     5         kx case "$use64bitall" in
     5         kx "$define"|true|[yY]*) use64bitint="$define" ;;
     5         kx esac
     5         kx 
     5         kx case "$longsize" in
     5         kx 8) cat <<EOM
     5         kx 
     5         kx You have natively 64-bit long integers.
     5         kx EOM
     5         kx    val="$define"
     5         kx    ;;
     5         kx *) case "$use64bitint" in
     5         kx    "$define"|true|[yY]*) dflt='y';;
     5         kx    *) dflt='n';;
     5         kx    esac
     5         kx    case "$d_quad" in
     5         kx    "$define") ;;
     5         kx    *) dflt='n' ;;
     5         kx    esac
     5         kx    cat <<EOM
     5         kx 
     5         kx Perl can be built to take advantage of 64-bit integer types
     5         kx on some systems.  To do so, Configure can be run with -Duse64bitint.
     5         kx Choosing this option will most probably introduce binary incompatibilities.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx (The default has been chosen based on your configuration.)
     5         kx EOM
     5         kx    rp='Try to use 64-bit integers, if available?'
     5         kx    . ./myread
     5         kx    case "$ans" in
     5         kx    [yY]*) val="$define" ;;
     5         kx    *)     val="$undef"  ;;
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx set use64bitint
     5         kx eval $setvar
     5         kx 
     5         kx case "$use64bitall" in
     5         kx "$define"|true|[yY]*) dflt='y' ;;
     5         kx *) case "$longsize" in
     5         kx    8) dflt='y' ;;
     5         kx    *) dflt='n' ;;
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx You may also choose to try maximal 64-bitness.  It means using as much
     5         kx 64-bitness as possible on the platform.  This in turn means even more
     5         kx binary incompatibilities.  On the other hand, your platform may not
     5         kx have any more 64-bitness available than what you already have chosen.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx (The default has been chosen based on your configuration.)
     5         kx EOM
     5         kx rp='Try to use maximal 64-bit support, if available?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx [yY]*) val="$define" ;;
     5         kx *)     val="$undef"  ;;
     5         kx esac
     5         kx set use64bitall
     5         kx eval $setvar
     5         kx case "$use64bitall" in
     5         kx "$define")
     5         kx 	case "$use64bitint" in
     5         kx 	"$undef")
     5         kx 		cat <<EOM
     5         kx 
     5         kx Since you have chosen a maximally 64-bit build, I'm also turning on
     5         kx the use of 64-bit integers.
     5         kx EOM
     5         kx 		use64bitint="$define" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Look for a hint-file generated 'call-back-unit'.  If the
     5         kx : user has specified that a 64-bit perl is to be built,
     5         kx : we may need to set or change some other defaults.
     5         kx if $test -f use64bitint.cbu; then
     5         kx 	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
     5         kx 	. ./use64bitint.cbu
     5         kx fi
     5         kx case "$use64bitint" in
     5         kx "$define"|true|[yY]*)
     5         kx 	: This test was common to all the OpenBSD forks, and seems harmless for
     5         kx 	: other platforms:
     5         kx 	echo " "
     5         kx 	echo "Checking if your C library has broken 64-bit functions..." >&4
     5         kx 	cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx typedef $uquadtype myULL;
     5         kx int main (void)
     5         kx {
     5         kx     struct {
     5         kx 	double d;
     5         kx 	myULL  u;
     5         kx     } *p, test[] = {
     5         kx 	{4294967303.15, 4294967303ULL},
     5         kx 	{4294967294.2,  4294967294ULL},
     5         kx 	{4294967295.7,  4294967295ULL},
     5         kx 	{0.0, 0ULL}
     5         kx     };
     5         kx     for (p = test; p->u; p++) {
     5         kx 	myULL x = (myULL)p->d;
     5         kx 	if (x != p->u) {
     5         kx 	    printf("buggy\n");
     5         kx 	    return 0;
     5         kx 	}
     5         kx     }
     5         kx     printf("ok\n");
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 	    libcquad=`$run ./try`
     5         kx 	    echo "Your C library's 64-bit functions are $libcquad."
     5         kx 	else
     5         kx 	    echo "(I can't seem to compile the test program.)"
     5         kx 	    echo "Assuming that your C library's 64-bit functions are ok."
     5         kx 	    libcquad="ok"
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 
     5         kx 	case "$libcquad" in
     5         kx 	    buggy*)
     5         kx 		cat >&4 <<EOM
     5         kx 
     5         kx *** You have a C library with broken 64-bit functions.
     5         kx *** 64-bit support does not work reliably in this configuration.
     5         kx *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
     5         kx *** Cannot continue, aborting.
     5         kx 
     5         kx EOM
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$longsize" in
     5         kx 	4) case "$archname64" in
     5         kx 	   '') archname64=64int ;;
     5         kx 	   esac
     5         kx 	   ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Look for a hint-file generated 'call-back-unit'.  If the
     5         kx : user has specified that a maximally 64-bit perl is to be built,
     5         kx : we may need to set or change some other defaults.
     5         kx if $test -f use64bitall.cbu; then
     5         kx 	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
     5         kx 	. ./use64bitall.cbu
     5         kx fi
     5         kx case "$use64bitall" in
     5         kx "$define"|true|[yY]*)
     5         kx 	case "$longsize" in
     5         kx 	4) case "$archname64" in
     5         kx 	   ''|64int) archname64=64all ;;
     5         kx 	   esac
     5         kx 	   ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$d_quad:$use64bitint" in
     5         kx $undef:$define)
     5         kx 	cat >&4 <<EOF
     5         kx 
     5         kx *** You have chosen to use 64-bit integers,
     5         kx *** but none can be found.
     5         kx *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
     5         kx *** Cannot continue, aborting.
     5         kx 
     5         kx EOF
     5         kx 	exit 1
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check if we are using the GNU C library
     5         kx echo " "
     5         kx echo "Checking for GNU C Library..." >&4
     5         kx cat >try.c <<'EOCP'
     5         kx /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
     5         kx    alone are insufficient to distinguish different versions, such as
     5         kx    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
     5         kx    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
     5         kx */
     5         kx #include <stdio.h>
     5         kx int main(void)
     5         kx {
     5         kx #ifdef __GLIBC__
     5         kx #   ifdef __GLIBC_MINOR__
     5         kx #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
     5         kx #           include <gnu/libc-version.h>
     5         kx 	    printf("%s\n",  gnu_get_libc_version());
     5         kx #       else
     5         kx 	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
     5         kx #       endif
     5         kx #   else
     5         kx 	printf("%d\n",  __GLIBC__);
     5         kx #   endif
     5         kx     return 0;
     5         kx #else
     5         kx     return 1;
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok && $run ./try > glibc.ver; then
     5         kx 	val="$define"
     5         kx 	gnulibc_version=`$cat glibc.ver`
     5         kx 	echo "You are using the GNU C Library version $gnulibc_version"
     5         kx else
     5         kx 	val="$undef"
     5         kx 	gnulibc_version=''
     5         kx 	echo "You are not using the GNU C Library"
     5         kx fi
     5         kx $rm_try glibc.ver
     5         kx set d_gnulibc
     5         kx eval $setvar
     5         kx 
     5         kx : see if nm is to be used to determine whether a symbol is defined or not
     5         kx case "$usenm" in
     5         kx '')
     5         kx 	dflt=''
     5         kx 	case "$d_gnulibc" in
     5         kx 	"$define")
     5         kx 		echo " "
     5         kx 		echo "nm probably won't work on the GNU C Library." >&4
     5         kx 		dflt=n
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	'')
     5         kx 		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
     5         kx 			echo " "
     5         kx 			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
     5         kx 			echo "'nm' won't be sufficient on this system." >&4
     5         kx 			dflt=n
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
     5         kx 		if $test $dflt -gt 20; then
     5         kx 			dflt=y
     5         kx 		else
     5         kx 			dflt=n
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)
     5         kx 	case "$usenm" in
     5         kx 	true|$define) dflt=y;;
     5         kx 	*) dflt=n;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx I can use $nm to extract the symbols from your C libraries. This
     5         kx is a time consuming task which may generate huge output on the disk (up
     5         kx to 3 megabytes) but that should make the symbols extraction faster. The
     5         kx alternative is to skip the 'nm' extraction part and to compile a small
     5         kx test program instead to determine whether each symbol is present. If
     5         kx you have a fast C compiler and/or if your 'nm' output cannot be parsed,
     5         kx this may be the best solution.
     5         kx 
     5         kx You probably shouldn't let me use 'nm' if you are using the GNU C Library.
     5         kx 
     5         kx EOM
     5         kx rp="Shall I use $nm to extract C symbols from the libraries?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx [Nn]*) usenm=false;;
     5         kx *) usenm=true;;
     5         kx esac
     5         kx 
     5         kx runnm=$usenm
     5         kx case "$reuseval" in
     5         kx true) runnm=false;;
     5         kx esac
     5         kx 
     5         kx : nm options which may be necessary
     5         kx case "$nm_opt" in
     5         kx '') if $test -f /mach_boot; then
     5         kx 		nm_opt=''	# Mach
     5         kx 	elif $test -d /usr/ccs/lib; then
     5         kx 		nm_opt='-p'	# Solaris (and SunOS?)
     5         kx 	elif $test -f /dgux; then
     5         kx 		nm_opt='-p'	# DG-UX
     5         kx 	elif $test -f /lib64/rld; then
     5         kx 		nm_opt='-p'	# 64-bit Irix
     5         kx 	else
     5         kx 		nm_opt=''
     5         kx 	fi;;
     5         kx esac
     5         kx 
     5         kx : nm options which may be necessary for shared libraries but illegal
     5         kx : for archive libraries.  Thank you, Linux.
     5         kx case "$nm_so_opt" in
     5         kx '')	case "$myuname" in
     5         kx 	*linux*|gnu*)
     5         kx 		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
     5         kx 			nm_so_opt='--dynamic'
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Figure out where the libc is located
     5         kx case "$runnm" in
     5         kx true)
     5         kx : get list of predefined functions in a handy place
     5         kx echo " "
     5         kx case "$libc" in
     5         kx '') libc=unknown
     5         kx 	case "$libs" in
     5         kx 	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$libs" in
     5         kx '') ;;
     5         kx *)  for thislib in $libs; do
     5         kx 	case "$thislib" in
     5         kx 	-lc|-lc_s)
     5         kx 		: Handle C library specially below.
     5         kx 		;;
     5         kx 	-l*)
     5         kx 		thislib=`echo $thislib | $sed -e 's/^-l//'`
     5         kx 		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
     5         kx 			:
     5         kx 		else
     5         kx 			try=''
     5         kx 		fi
     5         kx 		libnames="$libnames $try"
     5         kx 		;;
     5         kx 	*) libnames="$libnames $thislib" ;;
     5         kx 	esac
     5         kx 	done
     5         kx 	;;
     5         kx esac
     5         kx xxx=normal
     5         kx case "$libc" in
     5         kx unknown)
     5         kx 	set /lib/libc.$so
     5         kx 	for xxx in $libpth; do
     5         kx 		$test -r $1 || set $xxx/libc.$so
     5         kx 		: The messy sed command sorts on library version numbers.
     5         kx 		$test -r $1 || \
     5         kx 			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
     5         kx 			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
     5         kx 				h
     5         kx 				s/[0-9][0-9]*/0000&/g
     5         kx 				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
     5         kx 				G
     5         kx 				s/\n/ /' | \
     5         kx 			 $sort | $sed -e 's/^.* //'`
     5         kx 		eval set \$$#
     5         kx 	done
     5         kx 	$test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
     5         kx 	$test -r $1 || set $sysroot/lib/libsys_s$_a
     5         kx 	;;
     5         kx *)
     5         kx 	set blurfl
     5         kx 	;;
     5         kx esac
     5         kx if $test -r "$1"; then
     5         kx 	echo "Your (shared) C library seems to be in $1."
     5         kx 	libc="$1"
     5         kx elif $test -r /lib/libc && $test -r /lib/clib; then
     5         kx 	echo "Your C library seems to be in both /lib/clib and /lib/libc."
     5         kx 	xxx=apollo
     5         kx 	libc='/lib/clib /lib/libc'
     5         kx 	if $test -r /lib/syslib; then
     5         kx 		echo "(Your math library is in /lib/syslib.)"
     5         kx 		libc="$libc /lib/syslib"
     5         kx 	fi
     5         kx elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
     5         kx 	echo "Your C library seems to be in $libc, as you said before."
     5         kx elif $test -r $incpath/usr/lib/libc$_a; then
     5         kx 	libc=$incpath/usr/lib/libc$_a;
     5         kx 	echo "Your C library seems to be in $libc.  That's fine."
     5         kx elif $test -r /lib/libc$_a; then
     5         kx 	libc=/lib/libc$_a;
     5         kx 	echo "Your C library seems to be in $libc.  You're normal."
     5         kx else
     5         kx 	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
     5         kx 		:
     5         kx 	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
     5         kx 		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
     5         kx 	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
     5         kx 		:
     5         kx 	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
     5         kx 		:
     5         kx 	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
     5         kx 		:
     5         kx 	else
     5         kx 		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
     5         kx 	fi
     5         kx 	if $test -r "$tans"; then
     5         kx 		echo "Your C library seems to be in $tans, of all places."
     5         kx 		libc=$tans
     5         kx 	else
     5         kx 		libc='blurfl'
     5         kx 	fi
     5         kx fi
     5         kx if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
     5         kx 	dflt="$libc"
     5         kx 	cat <<EOM
     5         kx 
     5         kx If the guess above is wrong (which it might be if you're using a strange
     5         kx compiler, or your machine supports multiple models), you can override it here.
     5         kx 
     5         kx EOM
     5         kx else
     5         kx 	dflt=''
     5         kx 	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
     5         kx 	cat >&4 <<EOM
     5         kx I can't seem to find your C library.  I've looked in the following places:
     5         kx 
     5         kx EOM
     5         kx 	$sed 's/^/	/' libpath
     5         kx 	cat <<EOM
     5         kx 
     5         kx None of these seems to contain your C library. I need to get its name...
     5         kx 
     5         kx EOM
     5         kx fi
     5         kx fn=f
     5         kx rp='Where is your C library?'
     5         kx . ./getfile
     5         kx libc="$ans"
     5         kx 
     5         kx echo " "
     5         kx echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
     5         kx set X `cat libnames`
     5         kx shift
     5         kx xxx=files
     5         kx case $# in 1) xxx=file; esac
     5         kx echo "Extracting names from the following $xxx for later perusal:" >&4
     5         kx echo " "
     5         kx $sed 's/^/	/' libnames >&4
     5         kx echo " "
     5         kx $echo $n "This may take a while...$c" >&4
     5         kx 
     5         kx for file in $*; do
     5         kx 	case $file in
     5         kx 	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
     5         kx 	*) $nm $nm_opt $file 2>/dev/null;;
     5         kx 	esac
     5         kx done >libc.tmp
     5         kx 
     5         kx $echo $n ".$c"
     5         kx $grep fprintf libc.tmp > libc.ptf
     5         kx xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
     5         kx xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
     5         kx xxx='[ADTSIWi]'
     5         kx if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
     5         kx 				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
     5         kx 	eval $xscan;\
     5         kx 	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
     5         kx 		eval $xrun
     5         kx else
     5         kx 	$nm -p $* 2>/dev/null >libc.tmp
     5         kx 	$grep fprintf libc.tmp > libc.ptf
     5         kx 	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
     5         kx 		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
     5         kx 	then
     5         kx 		nm_opt='-p'
     5         kx 		eval $xrun
     5         kx 	else
     5         kx 		echo " "
     5         kx 		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
     5         kx 		com=''
     5         kx 		if $ar t $libc > libc.tmp && \
     5         kx 			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
     5         kx 		then
     5         kx 			for thisname in $libnames $libc; do
     5         kx 				$ar t $thisname >>libc.tmp
     5         kx 			done
     5         kx 			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
     5         kx 			echo "Ok." >&4
     5         kx 		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
     5         kx 			for thisname in $libnames $libc; do
     5         kx 				$ar tv $thisname >>libc.tmp
     5         kx 				emximp -o tmp.imp $thisname \
     5         kx 				    2>/dev/null && \
     5         kx 				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
     5         kx 				    < tmp.imp >>libc.tmp
     5         kx 				$rm -f tmp.imp
     5         kx 			done
     5         kx 			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
     5         kx 			echo "Ok." >&4
     5         kx 		else
     5         kx 			echo "$ar didn't seem to work right." >&4
     5         kx 			echo "Maybe this is a Cray...trying bld instead..." >&4
     5         kx 			if  bld t $libc | \
     5         kx 				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
     5         kx 				$test -s libc.list
     5         kx 			then
     5         kx 				for thisname in $libnames; do
     5         kx 					bld t $libnames | \
     5         kx 					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
     5         kx 					$ar t $thisname >>libc.tmp
     5         kx 				done
     5         kx 				echo "Ok." >&4
     5         kx 			else
     5         kx 				echo "That didn't work either.  Giving up." >&4
     5         kx 				exit 1
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx fi
     5         kx nm_extract="$com"
     5         kx case "$PASE" in
     5         kx define)
     5         kx     echo " "
     5         kx     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
     5         kx     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
     5         kx     ;;
     5         kx *)  if $test -f /lib/syscalls.exp; then
     5         kx 	echo " "
     5         kx 	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
     5         kx 	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
     5         kx 		/lib/syscalls.exp >>libc.list
     5         kx     fi
     5         kx     ;;
     5         kx esac
     5         kx ;;
     5         kx esac
     5         kx $rm -f libnames libpath
     5         kx 
     5         kx : Check if we are using C++
     5         kx echo " "
     5         kx echo "Checking for C++..." >&4
     5         kx $cat >try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int main(void)
     5         kx {
     5         kx #ifdef __cplusplus
     5         kx     return 0;
     5         kx #else
     5         kx     return 1;
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok && $run ./try; then
     5         kx 	val="$define"
     5         kx 	echo "You are using a C++ compiler."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You are not using a C++ compiler."
     5         kx fi
     5         kx $rm_try cplusplus$$
     5         kx set d_cplusplus
     5         kx eval $setvar
     5         kx 
     5         kx : is a C symbol defined?
     5         kx csym='tlook=$1;
     5         kx case "$3" in
     5         kx -v) tf=libc.tmp; tdc="";;
     5         kx -a) tf=libc.tmp; tdc="[]";;
     5         kx *) tlook="^$1\$"; tf=libc.list; tdc="()";;
     5         kx esac;
     5         kx case "$d_cplusplus" in
     5         kx     $define)	extern_C="extern \"C\""	;;
     5         kx     *)		extern_C="extern"	;;
     5         kx esac;
     5         kx tx=yes;
     5         kx case "$reuseval-$4" in
     5         kx true-) ;;
     5         kx true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
     5         kx esac;
     5         kx case "$tx" in
     5         kx yes)
     5         kx 	tval=false;
     5         kx 	if $test "$runnm" = true; then
     5         kx 		if $contains $tlook $tf >/dev/null 2>&1; then
     5         kx 			tval=true;
     5         kx 		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
     5         kx 			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;
     5         kx 			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
     5         kx 			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
     5         kx 			$rm_try;
     5         kx 		fi;
     5         kx 	else
     5         kx 		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;
     5         kx 		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
     5         kx 		$rm_try;
     5         kx 	fi;
     5         kx 	;;
     5         kx *)
     5         kx 	case "$tval" in
     5         kx 	$define) tval=true;;
     5         kx 	*) tval=false;;
     5         kx 	esac;
     5         kx 	;;
     5         kx esac;
     5         kx eval "$2=$tval"'
     5         kx 
     5         kx : define an is-in-libc? function
     5         kx inlibc='echo " "; td=$define; tu=$undef;
     5         kx sym=$1; var=$2; eval "was=\$$2";
     5         kx tx=yes;
     5         kx case "$reuseval$was" in
     5         kx true) ;;
     5         kx true*) tx=no;;
     5         kx esac;
     5         kx case "$tx" in
     5         kx yes)
     5         kx 	set $sym tres -f;
     5         kx 	eval $csym;
     5         kx 	case "$tres" in
     5         kx 	true)
     5         kx 		echo "$sym() found." >&4;
     5         kx 		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
     5         kx 	*)
     5         kx 		echo "$sym() NOT found." >&4;
     5         kx 		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
     5         kx 	esac;;
     5         kx *)
     5         kx 	case "$was" in
     5         kx 	$define) echo "$sym() found." >&4;;
     5         kx 	*) echo "$sym() NOT found." >&4;;
     5         kx 	esac;;
     5         kx esac'
     5         kx 
     5         kx : check for length of double
     5         kx echo " "
     5         kx case "$doublesize" in
     5         kx '')
     5         kx 	echo "Checking to see how big your double precision numbers are..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)sizeof(double));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		doublesize=`$run ./try`
     5         kx 		echo "Your double is $doublesize bytes long."
     5         kx 	else
     5         kx 		dflt='8'
     5         kx 		echo "(I can't seem to compile the test program.  Guessing...)"
     5         kx 		rp="What is the size of a double precision number (in bytes)?"
     5         kx 		. ./myread
     5         kx 		doublesize="$ans"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : check for long doubles
     5         kx echo " " >&4
     5         kx echo "Checking to see if you have long double..." >&4
     5         kx echo 'int main() { long double x = 7.0; }' > try.c
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have long double." >&4
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have long double." >&4
     5         kx fi
     5         kx $rm_try
     5         kx set d_longdbl
     5         kx eval $setvar
     5         kx 
     5         kx : see if ldexpl exists
     5         kx set ldexpl d_ldexpl
     5         kx eval $inlibc
     5         kx 
     5         kx : check for length of long double
     5         kx case "${d_longdbl}${longdblsize}" in
     5         kx $define)
     5         kx 	echo " " >&4
     5         kx 	echo "Checking to see how big your long doubles are..." >&4
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int main()
     5         kx {
     5         kx 	printf("%d\n", sizeof(long double));
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		longdblsize=`$run ./try`
     5         kx 		echo "Your long doubles are $longdblsize bytes long." >&4
     5         kx 	else
     5         kx 		dflt='8'
     5         kx 		echo " " >&4
     5         kx 		echo "(I can't seem to compile the test program.  Guessing...)" >&4
     5         kx 		rp="What is the size of a long double (in bytes)?"
     5         kx 		. ./myread
     5         kx 		longdblsize="$ans"
     5         kx 	fi
     5         kx 	if $test "X$doublesize" = "X$longdblsize"; then
     5         kx 		echo "That isn't any different from an ordinary double." >&4
     5         kx 		echo "I'll keep your setting anyway, but you may see some" >&4
     5         kx 		echo "harmless compilation warnings." >&4
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx $echo "Checking the kind of long doubles you have..." >&4
     5         kx case "$d_longdbl" in
     5         kx define)
     5         kx $cat <<EOP >try.c
     5         kx #$i_stdlib I_STDLIB
     5         kx #define LONGDBLSIZE $longdblsize
     5         kx #define DOUBLESIZE $doublesize
     5         kx #include <float.h>
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx static const long double d = -0.1L;
     5         kx int main() {
     5         kx   unsigned const char* b = (unsigned const char*)(&d);
     5         kx #if DOUBLESIZE == LONGDBLSIZE
     5         kx   printf("0\n"); /* if it floats like double */
     5         kx   exit(0);
     5         kx #endif
     5         kx #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
     5         kx   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
     5         kx     /* IEEE 754 128-bit little-endian */
     5         kx     printf("1\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
     5         kx     /* IEEE 128-bit big-endian, e.g. solaris sparc */
     5         kx     printf("2\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
     5         kx  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
     5         kx  * cannot be trusted. */
     5         kx #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
     5         kx   if (b[0] == 0xCD && b[9] == 0xBF) {
     5         kx     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
     5         kx      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
     5         kx      * Also known as "extended precision". */
     5         kx     printf("3\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[9] == 0xCD) {
     5         kx     /* Is there ever big-endian 80-bit, really?
     5         kx      *
     5         kx      * The Motorola 68881 had another "extended precision" format:
     5         kx      * sign:1 exp:15 zero:16 integer:1 mantissa:63
     5         kx      * for total of 96 bits of bytes.  The zero bits were unused.
     5         kx      * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
     5         kx      * If it ever becomes relevant, this format should be allocated a
     5         kx      * new doublekind code since it is quite different from the Intel x87.
     5         kx      */
     5         kx     printf("4\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
     5         kx   /* software "double double", the 106 is 53+53.
     5         kx    * but irix thinks it is 107. */
     5         kx   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
     5         kx     /* double double 128-bit fully little-endian,
     5         kx      * little-endian doubles in little-endian order,
     5         kx      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
     5         kx     printf("5\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
     5         kx     /* double double 128-bit fully big-endian,
     5         kx      * big-endian doubles in big-endian order,
     5         kx      * e.g. PPC/Power and MIPS:
     5         kx      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
     5         kx     printf("6\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
     5         kx     /* double double 128-bit mixed endian.
     5         kx      * little-endian doubles in big-endian order,
     5         kx      * e.g. ppc64el,
     5         kx      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
     5         kx     printf("7\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
     5         kx     /* double double 128-bit mixed endian,
     5         kx      * big-endian doubles in little-endian order,
     5         kx      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
     5         kx     printf("8\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx /* We are largely making this up because it may well be
     5         kx  * that the VAX format H was never made available to C,
     5         kx  * only to Fortran. */
     5         kx #if LONGDBLSIZE == 16 && defined(__vax__)
     5         kx   if (b[0] == 0xFD && b[15] == 0x99) {
     5         kx     /* VAX format H, PDP-11 mixed endian. */
     5         kx     printf("9\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx   printf("-1\n"); /* unknown */
     5         kx   exit(0);
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     longdblkind=`$run ./try`
     5         kx else
     5         kx     longdblkind=-1
     5         kx fi
     5         kx ;;
     5         kx *) longdblkind=0 ;;
     5         kx esac
     5         kx case "$longdblkind" in
     5         kx 0) echo "Your long doubles are doubles." >&4 ;;
     5         kx 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
     5         kx 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
     5         kx 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
     5         kx 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
     5         kx 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
     5         kx 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
     5         kx 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
     5         kx 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
     5         kx 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
     5         kx *) echo "Cannot figure out your long double." >&4 ;;
     5         kx esac
     5         kx d_long_double_style_ieee=$undef
     5         kx d_long_double_style_ieee_std=$undef
     5         kx d_long_double_style_ieee_extended=$undef
     5         kx d_long_double_style_ieee_doubledouble=$undef
     5         kx d_long_double_style_vax=$undef
     5         kx case "$longdblkind" in
     5         kx 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
     5         kx esac
     5         kx case "$longdblkind" in
     5         kx 1|2) d_long_double_style_ieee_std=$define ;;
     5         kx esac
     5         kx case "$longdblkind" in
     5         kx 3|4) d_long_double_style_ieee_extended=$define ;;
     5         kx esac
     5         kx case "$longdblkind" in
     5         kx 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
     5         kx esac
     5         kx case "$longdblkind" in
     5         kx 9) d_long_double_style_vax=$define ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : get the patchlevel
     5         kx echo " "
     5         kx echo "Getting the current patchlevel..." >&4
     5         kx if $test -r $rsrc/patchlevel.h;then
     5         kx 	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
     5         kx else
     5         kx 	revision=0
     5         kx 	patchlevel=0
     5         kx 	subversion=0
     5         kx 	api_revision=0
     5         kx 	api_version=0
     5         kx 	api_subversion=0
     5         kx 	perl_patchlevel=0
     5         kx 	$echo "(You do not have patchlevel.h.  Eek.)"
     5         kx fi
     5         kx : Define a handy string here to avoid duplication in myconfig.SH and configpm.
     5         kx version_patchlevel_string="version $patchlevel subversion $subversion"
     5         kx case "$perl_patchlevel" in
     5         kx 0|'') ;;
     5         kx *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
     5         kx     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx $echo "(You have $package $version_patchlevel_string.)"
     5         kx 
     5         kx case "$osname" in
     5         kx dos|vms)
     5         kx 	: XXX Should be a Configure test for double-dots in filenames.
     5         kx 	version=`echo $revision $patchlevel $subversion | \
     5         kx 		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
     5         kx 	api_versionstring=`echo $api_revision $api_version $api_subversion | \
     5         kx 		 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
     5         kx 	;;
     5         kx *)
     5         kx 	version=`echo $revision $patchlevel $subversion | \
     5         kx 		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
     5         kx 	api_versionstring=`echo $api_revision $api_version $api_subversion | \
     5         kx 		 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
     5         kx 	;;
     5         kx esac
     5         kx : Special case the 5.005_xx maintenance series, which used 5.005
     5         kx : without any subversion label as a subdirectory in $sitelib
     5         kx if test "${api_revision}${api_version}${api_subversion}" = "550"; then
     5         kx 	api_versionstring='5.005'
     5         kx fi
     5         kx 
     5         kx : determine the architecture name
     5         kx echo " "
     5         kx if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
     5         kx 	tarch=`arch`"-$osname"
     5         kx elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
     5         kx 	if uname -m > tmparch 2>&1 ; then
     5         kx 		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
     5         kx 			-e 's/$/'"-$osname/" tmparch`
     5         kx 	else
     5         kx 		tarch="$osname"
     5         kx 	fi
     5         kx 	$rm -f tmparch
     5         kx else
     5         kx 	tarch="$osname"
     5         kx fi
     5         kx case "$myarchname" in
     5         kx ''|"$tarch") ;;
     5         kx *)
     5         kx 	echo "(Your architecture name used to be $myarchname.)"
     5         kx 	archname=''
     5         kx 	;;
     5         kx esac
     5         kx case "$targetarch" in
     5         kx '') ;;
     5         kx *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
     5         kx esac
     5         kx myarchname="$tarch"
     5         kx case "$archname" in
     5         kx '') dflt="$tarch";;
     5         kx *) dflt="$archname";;
     5         kx esac
     5         kx rp='What is your architecture name'
     5         kx . ./myread
     5         kx archname="$ans"
     5         kx 
     5         kx : optionally add API version to the architecture for versioned archlibs
     5         kx case "$useversionedarchname" in
     5         kx $define|true|[yY]*) dflt='y';;
     5         kx *)                  dflt='n';;
     5         kx esac
     5         kx rp='Add the Perl API version to your archname?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)	useversionedarchname="$define" ;;
     5         kx *)      useversionedarchname="$undef" ;;
     5         kx esac
     5         kx case "$useversionedarchname" in
     5         kx $define)
     5         kx 	case "$archname" in
     5         kx 	*-$api_versionstring)
     5         kx 		echo "...and architecture name already has -$api_versionstring" >&4
     5         kx 		;;
     5         kx 	*)
     5         kx 		archname="$archname-$api_versionstring"
     5         kx 		echo "...setting architecture name to $archname." >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$usethreads" in
     5         kx $define)
     5         kx 	echo "Threads selected." >&4
     5         kx 	case "$archname" in
     5         kx 	*-thread*) echo "...and architecture name already has -thread." >&4
     5         kx 		;;
     5         kx 	*)      archname="$archname-thread"
     5         kx 		echo "...setting architecture name to $archname." >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$usemultiplicity" in
     5         kx $define)
     5         kx 	echo "Multiplicity selected." >&4
     5         kx 	case "$archname" in
     5         kx 	*-multi*) echo "...and architecture name already has -multi." >&4
     5         kx 		;;
     5         kx 	*)      archname="$archname-multi"
     5         kx 		echo "...setting architecture name to $archname." >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$use64bitint$use64bitall" in
     5         kx *"$define"*)
     5         kx 	case "$archname64" in
     5         kx 	'')
     5         kx 		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
     5         kx 		;;
     5         kx 	*)
     5         kx 		case "$use64bitint" in
     5         kx 		"$define") echo "64 bit integers selected." >&4 ;;
     5         kx 		esac
     5         kx 		case "$use64bitall" in
     5         kx 		"$define") echo "Maximal 64 bitness selected." >&4 ;;
     5         kx 		esac
     5         kx 		case "$archname" in
     5         kx 		*-$archname64*) echo "...and architecture name already has $archname64." >&4
     5         kx 			;;
     5         kx 		*)      archname="$archname-$archname64"
     5         kx 			echo "...setting architecture name to $archname." >&4
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx esac
     5         kx case "$uselongdouble" in
     5         kx $define)
     5         kx 	echo "Long doubles selected." >&4
     5         kx 	case "$longdblsize" in
     5         kx 	$doublesize)
     5         kx 		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
     5         kx 		;;
     5         kx 	*)
     5         kx 		case "$archname" in
     5         kx 		*-ld*) echo "...and architecture name already has -ld." >&4
     5         kx 			;;
     5         kx 		*)      archname="$archname-ld"
     5         kx 			echo "...setting architecture name to $archname." >&4
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$usequadmath" in
     5         kx $define)
     5         kx 	echo "quadmath selected." >&4
     5         kx 	case "$archname" in
     5         kx 	*-quadmath*) echo "...and architecture name already has -quadmath." >&4
     5         kx 		;;
     5         kx 	*)      archname="$archname-quadmath"
     5         kx 		echo "...setting architecture name to $archname." >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx if $test -f archname.cbu; then
     5         kx 	echo "Your platform has some specific hints for architecture name, using them..."
     5         kx 	. ./archname.cbu
     5         kx fi
     5         kx 
     5         kx : set the prefixit variable, to compute a suitable default value
     5         kx prefixit='case "$3" in
     5         kx ""|none)
     5         kx 	case "$oldprefix" in
     5         kx 	"") eval "$1=\"\$$2\"";;
     5         kx 	*)
     5         kx 		case "$3" in
     5         kx 		"") eval "$1=";;
     5         kx 		none)
     5         kx 			eval "tp=\"\$$2\"";
     5         kx 			case "$tp" in
     5         kx 			""|" "|none) eval "$1=\"\$$2\"";;
     5         kx 			*) eval "$1=";;
     5         kx 			esac;;
     5         kx 		esac;;
     5         kx 	esac;;
     5         kx *)
     5         kx 	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
     5         kx 	case "$tp" in
     5         kx 	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
     5         kx 	/*-$oldprefix/*|\~*-$oldprefix/*)
     5         kx 		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
     5         kx 	*) eval "$1=\"\$$2\"";;
     5         kx 	esac;;
     5         kx esac'
     5         kx 
     5         kx : determine installation style
     5         kx : For now, try to deduce it from prefix unless it is already set.
     5         kx : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
     5         kx case "$installstyle" in
     5         kx '')	case "$prefix" in
     5         kx 		*perl*) dflt='lib';;
     5         kx 		*) dflt='lib/perl5' ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	dflt="$installstyle" ;;
     5         kx esac
     5         kx : Probably not worth prompting for this since we prompt for all
     5         kx : the directories individually, and the prompt would be too long and
     5         kx : confusing anyway.
     5         kx installstyle=$dflt
     5         kx 
     5         kx : determine where public executables go
     5         kx echo " "
     5         kx set dflt bin bin
     5         kx eval $prefixit
     5         kx fn=d~
     5         kx rp='Pathname where the public executables will reside?'
     5         kx . ./getfile
     5         kx if $test "X$ansexp" != "X$binexp"; then
     5         kx 	installbin=''
     5         kx fi
     5         kx prefixvar=bin
     5         kx : XXX Bug? -- ignores Configure -Dinstallprefix setting.
     5         kx : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
     5         kx :     this via initialinstalllocation
     5         kx . ./setprefixvar
     5         kx 
     5         kx case "$userelocatableinc" in
     5         kx $define|true|[yY]*)	dflt='y' ;;
     5         kx *)			dflt='n' ;;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx Would you like to build Perl so that the installation is relocatable, so that
     5         kx library paths in @INC are determined relative to the path of the perl binary?
     5         kx This is not advised for system Perl installs, or if you need to run setid
     5         kx scripts or scripts under taint mode.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Use relocatable @INC?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)	val="$define" ;;
     5         kx *)	val="$undef"  ;;
     5         kx esac
     5         kx set userelocatableinc
     5         kx eval $setvar
     5         kx 
     5         kx initialinstalllocation="$binexp"
     5         kx : Default prefix is now "up one level from where the binaries are"
     5         kx case "$userelocatableinc" in
     5         kx $define|true|[yY]*)
     5         kx     bin=".../"
     5         kx     binexp=".../"
     5         kx     prefix=".../.."
     5         kx     prefixexp=".../.."
     5         kx     installprefixexp=".../.."
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : determine where private library files go
     5         kx : Usual default is /usr/local/lib/perl5/$version.
     5         kx : Also allow things like /opt/perl/lib/$version, since
     5         kx : /opt/perl/lib/perl5... would be redundant.
     5         kx : The default "style" setting is made in installstyle.U
     5         kx case "$installstyle" in
     5         kx *lib/perl5*) set dflt privlib lib/$package/$version ;;
     5         kx *lib32/perl5*) set dflt privlib lib32/$package/$version ;;
     5         kx *lib64/perl5*) set dflt privlib lib64/$package/$version ;;
     5         kx *)	 set dflt privlib lib/$version ;;
     5         kx esac
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx There are some auxiliary files for $package that need to be put into a
     5         kx private library directory that is accessible by everyone.
     5         kx 
     5         kx EOM
     5         kx fn=$binexp
     5         kx fn=d~+
     5         kx rp='Pathname where the private library files will reside?'
     5         kx . ./getfile
     5         kx prefixvar=privlib
     5         kx . ./setprefixvar
     5         kx 
     5         kx : set the prefixup variable, to restore leading tilda escape
     5         kx prefixup='case "$prefixexp" in
     5         kx "$prefix") ;;
     5         kx *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
     5         kx esac'
     5         kx 
     5         kx : determine where public architecture dependent libraries go
     5         kx set archlib archlib
     5         kx eval $prefixit
     5         kx : privlib default is /usr/local/lib/$package/$version
     5         kx : archlib default is /usr/local/lib/$package/$version/$archname
     5         kx : privlib may have an optional trailing /share.
     5         kx tdflt=`echo $privlib | $sed 's,/share$,,'`
     5         kx tdflt=$tdflt/$archname
     5         kx case "$archlib" in
     5         kx '')	dflt=$tdflt
     5         kx 	;;
     5         kx *)	dflt="$archlib"
     5         kx     ;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx $spackage contains architecture-dependent library files.  If you are
     5         kx sharing libraries in a heterogeneous environment, you might store
     5         kx these files in a separate location.  Otherwise, you can just include
     5         kx them with the rest of the public library files.
     5         kx 
     5         kx EOM
     5         kx fn=$binexp
     5         kx fn=d+~
     5         kx rp='Where do you want to put the public architecture-dependent libraries?'
     5         kx . ./getfile
     5         kx prefixvar=archlib
     5         kx . ./setprefixvar
     5         kx if $test X"$archlib" = X"$privlib"; then
     5         kx 	d_archlib="$undef"
     5         kx else
     5         kx 	d_archlib="$define"
     5         kx fi
     5         kx 
     5         kx : see if setuid scripts can be secure
     5         kx $cat <<EOM
     5         kx 
     5         kx Some kernels have a bug that prevents setuid #! scripts from being
     5         kx secure.  Some sites have disabled setuid #! scripts because of this.
     5         kx 
     5         kx First let's decide if your kernel supports secure setuid #! scripts.
     5         kx (If setuid #! scripts would be secure but have been disabled anyway,
     5         kx don't say that they are secure if asked.)
     5         kx 
     5         kx EOM
     5         kx 
     5         kx val="$undef"
     5         kx if $test -d /dev/fd; then
     5         kx 	echo "#!$ls" >reflect
     5         kx 	chmod +x,u+s reflect
     5         kx 	./reflect >flect 2>&1
     5         kx 	if $contains "/dev/fd" flect >/dev/null; then
     5         kx 		echo "Congratulations, your kernel has secure setuid scripts!" >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		$cat <<EOM
     5         kx If you are not sure if they are secure, I can check but I'll need a
     5         kx username and password different from the one you are using right now.
     5         kx If you don't have such a username or don't want me to test, simply
     5         kx enter 'none'.
     5         kx 
     5         kx EOM
     5         kx 		rp='Other username to test security of setuid scripts with?'
     5         kx 		dflt='none'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		n|none)
     5         kx 			case "$d_suidsafe" in
     5         kx 			'')	echo "I'll assume setuid scripts are *not* secure." >&4
     5         kx 				dflt=n;;
     5         kx 			"$undef")
     5         kx 				echo "Well, the $hint value is *not* secure." >&4
     5         kx 				dflt=n;;
     5         kx 			*)	echo "Well, the $hint value *is* secure." >&4
     5         kx 				dflt=y;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		*)
     5         kx 			$rm -f reflect flect
     5         kx 			echo "#!$ls" >reflect
     5         kx 			chmod +x,u+s reflect
     5         kx 			echo >flect
     5         kx 			chmod a+w flect
     5         kx 			echo '"su" will (probably) prompt you for '"$ans's password."
     5         kx 			su $ans -c './reflect >flect'
     5         kx 			if $contains "/dev/fd" flect >/dev/null; then
     5         kx 				echo "Okay, it looks like setuid scripts are secure." >&4
     5         kx 				dflt=y
     5         kx 			else
     5         kx 				echo "I don't think setuid scripts are secure." >&4
     5         kx 				dflt=n
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 		rp='Does your kernel have *secure* setuid scripts?'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		[yY]*)	val="$define";;
     5         kx 		*)	val="$undef";;
     5         kx 		esac
     5         kx 	fi
     5         kx else
     5         kx 	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
     5         kx 	echo "(That's for file descriptors, not floppy disks.)"
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_suidsafe
     5         kx eval $setvar
     5         kx 
     5         kx $rm -f reflect flect
     5         kx 
     5         kx : now see if they want to do setuid emulation
     5         kx if $test $patchlevel -lt 11; then
     5         kx echo " "
     5         kx val="$undef"
     5         kx case "$d_suidsafe" in
     5         kx "$define")
     5         kx 	val="$undef"
     5         kx 	echo "No need to emulate SUID scripts since they are secure here." >&4
     5         kx 	;;
     5         kx *)
     5         kx 	$cat <<EOM
     5         kx Some systems have disabled setuid scripts, especially systems where
     5         kx setuid scripts cannot be secure.  On systems where setuid scripts have
     5         kx been disabled, the setuid/setgid bits on scripts are currently
     5         kx useless.  It is possible for $package to detect those bits and emulate
     5         kx setuid/setgid in a secure fashion.  This emulation will only work if
     5         kx setuid scripts have been disabled in your kernel.
     5         kx 
     5         kx EOM
     5         kx 	case "$d_dosuid" in
     5         kx 	"$define") dflt=y ;;
     5         kx 	*) dflt=n ;;
     5         kx 	esac
     5         kx 	rp="Do you want to do setuid/setgid emulation?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	[yY]*)	val="$define";;
     5         kx 	*)	val="$undef";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_dosuid
     5         kx eval $setvar
     5         kx else
     5         kx     case "$d_dosuid" in
     5         kx 	"$define")
     5         kx 	cat >&4 <<EOH
     5         kx 
     5         kx SUID emulation has been removed for 5.12
     5         kx Please re-run Configure without -Dd_dosuid
     5         kx 
     5         kx EOH
     5         kx 	exit 1;
     5         kx 	;;
     5         kx     esac
     5         kx     d_dosuid=undef
     5         kx fi
     5         kx 
     5         kx : Find perl5.005 or later.
     5         kx echo "Looking for a previously installed perl5.005 or later... "
     5         kx case "$perl5" in
     5         kx '')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
     5         kx 		: Check if this perl is recent and can load a simple module
     5         kx 		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
     5         kx 			perl5=$tdir/perl
     5         kx 			break;
     5         kx 		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
     5         kx 			perl5=$tdir/perl5
     5         kx 			break;
     5         kx 		fi
     5         kx 	done
     5         kx 	;;
     5         kx *)	perl5="$perl5"
     5         kx 	;;
     5         kx esac
     5         kx case "$perl5" in
     5         kx '')	echo "None found.  That's ok.";;
     5         kx *)	echo "Using $perl5." ;;
     5         kx esac
     5         kx 
     5         kx : Set the siteprefix variables
     5         kx $cat <<EOM
     5         kx 
     5         kx After $package is installed, you may wish to install various
     5         kx add-on modules and utilities.  Typically, these add-ons will
     5         kx be installed under $prefix with the rest
     5         kx of this package.  However, you may wish to install such add-ons
     5         kx elsewhere under a different prefix.
     5         kx 
     5         kx If you do not wish to put everything under a single prefix, that's
     5         kx ok.  You will be prompted for the individual locations; this siteprefix
     5         kx is only used to suggest the defaults.
     5         kx 
     5         kx The default should be fine for most people.
     5         kx 
     5         kx EOM
     5         kx fn=d~+
     5         kx rp='Installation prefix to use for add-on modules and utilities?'
     5         kx : XXX Here might be another good place for an installstyle setting.
     5         kx case "$siteprefix" in
     5         kx '') dflt=$prefix ;;
     5         kx *)  dflt=$siteprefix ;;
     5         kx esac
     5         kx . ./getfile
     5         kx : XXX Prefixit unit does not yet support siteprefix and vendorprefix
     5         kx oldsiteprefix=''
     5         kx case "$siteprefix" in
     5         kx '') ;;
     5         kx *)	case "$ans" in
     5         kx 	"$prefix") ;;
     5         kx 	*) oldsiteprefix="$prefix";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx siteprefix="$ans"
     5         kx siteprefixexp="$ansexp"
     5         kx 
     5         kx : determine where site specific libraries go.
     5         kx : Usual default is /usr/local/lib/perl5/site_perl/$version
     5         kx : The default "style" setting is made in installstyle.U
     5         kx : XXX No longer works with Prefixit stuff.
     5         kx prog=`echo $package | $sed 's/-*[0-9.]*$//'`
     5         kx case "$sitelib" in
     5         kx '') case "$installstyle" in
     5         kx 	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
     5         kx 	*lib32/perl5*) dflt=$siteprefix/lib32/$package/site_$prog/$version ;;
     5         kx 	*lib64/perl5*) dflt=$siteprefix/lib64/$package/site_$prog/$version ;;
     5         kx 	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	dflt="$sitelib"
     5         kx 	;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx The installation process will create a directory for
     5         kx site-specific extensions and modules.  Most users find it convenient
     5         kx to place all site-specific files in this directory rather than in the
     5         kx main distribution directory.
     5         kx 
     5         kx EOM
     5         kx fn=d~+
     5         kx rp='Pathname for the site-specific library files?'
     5         kx . ./getfile
     5         kx prefixvar=sitelib
     5         kx . ./setprefixvar
     5         kx sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
     5         kx 
     5         kx : Determine list of previous versions to include in @INC
     5         kx $cat > getverlist <<EOPL
     5         kx #!$perl5
     5         kx use strict;
     5         kx use warnings;
     5         kx use File::Basename;
     5         kx my \$api_versionstring = "$api_versionstring";
     5         kx my \$version = "$version";
     5         kx my \$stem = "$sitelib_stem";
     5         kx my \$archname = "$archname";
     5         kx EOPL
     5         kx 	$cat >> getverlist <<'EOPL'
     5         kx # The list found is stored twice for each entry: the original name, and
     5         kx # the binary broken down version into pack "s>s>s>", so sorting is easy
     5         kx # and unambiguous.  This will work for all versions that have a maximum
     5         kx # of three digit per group separate by '.'s or '_'s. Names are extended
     5         kx # with ".0.0" to ensure at least three elements for the pack.
     5         kx #                                   -- H.Merijn Brand (m)'06 23-10-2006
     5         kx 
     5         kx my @inc_version_list;
     5         kx my @candidates;
     5         kx # XXX Redo to do opendir/readdir?
     5         kx if (-d $stem) {
     5         kx     chdir($stem);
     5         kx     ;@candidates = map {
     5         kx 	[ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
     5         kx     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
     5         kx }
     5         kx else {
     5         kx     ;@candidates = ();
     5         kx }
     5         kx 
     5         kx my ($pversion, $aversion, $vsn5005) = map {
     5         kx     pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
     5         kx foreach my $d (@candidates) {
     5         kx     if ($d->[1] lt $pversion) {
     5         kx 	if ($d->[1] ge $aversion) {
     5         kx 	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
     5         kx 	}
     5         kx 	elsif ($d->[1] ge $vsn5005) {
     5         kx 	    unshift(@inc_version_list, grep { -d } $d->[0]);
     5         kx 	}
     5         kx     }
     5         kx     else {
     5         kx 	# Skip newer version.  I.e. don't look in
     5         kx 	# 5.7.0 if we're installing 5.6.1.
     5         kx     }
     5         kx }
     5         kx 
     5         kx if (@inc_version_list) {
     5         kx     print join(' ', @inc_version_list);
     5         kx }
     5         kx else {
     5         kx     # Blank space to preserve value for next Configure run.
     5         kx     print " ";
     5         kx }
     5         kx EOPL
     5         kx chmod +x getverlist
     5         kx case "$inc_version_list" in
     5         kx '')	if test -x "$perl5$exe_ext"; then
     5         kx 		dflt=`$perl5 getverlist`
     5         kx 	else
     5         kx 		dflt='none'
     5         kx 	fi
     5         kx 	;;
     5         kx $undef) dflt='none' ;;
     5         kx *)  eval dflt=\"$inc_version_list\" ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx 5.005) dflt=none ;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx In order to ease the process of upgrading, this version of perl
     5         kx can be configured to use modules built and installed with earlier
     5         kx versions of perl that were installed under $prefix.  Specify here
     5         kx the list of earlier versions that this version of perl should check.
     5         kx If Configure detected no earlier versions of perl installed under
     5         kx $prefix, then the list will be empty.  Answer 'none' to tell perl
     5         kx to not search earlier versions.
     5         kx 
     5         kx The default should almost always be sensible, so if you're not sure,
     5         kx just accept the default.
     5         kx EOM
     5         kx 
     5         kx rp='List of earlier versions to include in @INC?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
     5         kx *) inc_version_list="$ans" ;;
     5         kx esac
     5         kx case "$inc_version_list" in
     5         kx ''|' ')
     5         kx 	inc_version_list_init='0'
     5         kx 	d_inc_version_list="$undef"
     5         kx 	;;
     5         kx *)	inc_version_list_init=`echo $inc_version_list |
     5         kx 		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
     5         kx 	d_inc_version_list="$define"
     5         kx 	;;
     5         kx esac
     5         kx $rm -f getverlist
     5         kx 
     5         kx : see if malloc/malloc.h has to be included
     5         kx set malloc/malloc.h i_mallocmalloc
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a malloc.h system
     5         kx : we want a real compile instead of Inhdr because some systems have a
     5         kx : malloc.h that just gives a compile error saying to use stdlib.h instead
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdlib.h>
     5         kx #include <malloc.h>
     5         kx #$i_mallocmalloc I_MALLOCMALLOC
     5         kx #ifdef I_MALLOCMALLOC
     5         kx # include <malloc/malloc.h>
     5         kx #endif
     5         kx 
     5         kx int main () { return 0; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     echo "<malloc.h> found." >&4
     5         kx     val="$define"
     5         kx else
     5         kx     echo "<malloc.h> NOT found." >&4
     5         kx     val="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx set i_malloc
     5         kx eval $setvar
     5         kx 
     5         kx : check for length of pointer
     5         kx echo " "
     5         kx case "$ptrsize" in
     5         kx '')
     5         kx 	echo "Checking to see how big your pointers are..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)sizeof(void *));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		ptrsize=`$run ./try`
     5         kx 		echo "Your pointers are $ptrsize bytes long."
     5         kx 	else
     5         kx 		dflt='4'
     5         kx 		echo "(I can't seem to compile the test program.  Guessing...)" >&4
     5         kx 		rp="What is the size of a pointer (in bytes)?"
     5         kx 		. ./myread
     5         kx 		ptrsize="$ans"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx case "$use64bitall" in
     5         kx "$define"|true|[yY]*)
     5         kx 	case "$ptrsize" in
     5         kx 	4)	cat <<EOM >&4
     5         kx 
     5         kx *** You have chosen a maximally 64-bit build,
     5         kx *** but your pointers are only 4 bytes wide.
     5         kx *** Please rerun Configure without -Duse64bitall.
     5         kx EOM
     5         kx 		case "$d_quad" in
     5         kx 		define)
     5         kx 			cat <<EOM >&4
     5         kx *** Since you have quads, you could possibly try with -Duse64bitint.
     5         kx EOM
     5         kx 			;;
     5         kx 		esac
     5         kx 		cat <<EOM >&4
     5         kx *** Cannot continue, aborting.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : determine whether to use malloc wrapping
     5         kx echo " "
     5         kx case "$usemallocwrap" in
     5         kx [yY]*|true|$define)	dflt='y' ;;
     5         kx [nN]*|false|$undef)	dflt='n' ;;
     5         kx *)	case "$usedevel" in
     5         kx 	[yY]*|true|$define)	dflt='y' ;;
     5         kx 	*) dflt='n' ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx rp="Do you wish to wrap malloc calls to protect against potential overflows?"
     5         kx . ./myread
     5         kx usemallocwrap="$ans"
     5         kx case "$ans" in
     5         kx y*|true)
     5         kx 	usemallocwrap="$define" ;;
     5         kx *)
     5         kx 	usemallocwrap="$undef" ;;
     5         kx esac
     5         kx 
     5         kx : determine which malloc to compile in
     5         kx echo " "
     5         kx case "$usemymalloc" in
     5         kx [yY]*|true|$define)	dflt='y' ;;
     5         kx [nN]*|false|$undef)	dflt='n' ;;
     5         kx *)	case "$ptrsize" in
     5         kx 	4) dflt='y' ;;
     5         kx 	*) dflt='n' ;;
     5         kx 	esac
     5         kx 	if test "$useithreads" = "$define"; then dflt='n'; fi
     5         kx 	;;
     5         kx esac
     5         kx rp="Do you wish to attempt to use the malloc that comes with $package?"
     5         kx . ./myread
     5         kx usemymalloc="$ans"
     5         kx case "$ans" in
     5         kx y*|true)
     5         kx 	usemymalloc='y'
     5         kx 	mallocsrc='malloc.c'
     5         kx 	mallocobj="malloc$_o"
     5         kx 	d_mymalloc="$define"
     5         kx 	case "$libs" in
     5         kx 	*-lmalloc*)
     5         kx 		: Remove malloc from list of libraries to use
     5         kx 		echo "Removing unneeded -lmalloc from library list" >&4
     5         kx 		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
     5         kx 		shift
     5         kx 		libs="$*"
     5         kx 		echo "libs = $libs" >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)
     5         kx 	usemymalloc='n'
     5         kx 	mallocsrc=''
     5         kx 	mallocobj=''
     5         kx 	d_mymalloc="$undef"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : compute the return types of malloc and free
     5         kx echo " "
     5         kx $cat >malloc.c <<END
     5         kx #$i_malloc I_MALLOC
     5         kx #$i_stdlib I_STDLIB
     5         kx #include <stdio.h>
     5         kx #include <sys/types.h>
     5         kx #ifdef I_MALLOC
     5         kx #include <malloc.h>
     5         kx #endif
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #ifdef TRY_MALLOC
     5         kx void *malloc();
     5         kx #endif
     5         kx #ifdef TRY_FREE
     5         kx void free();
     5         kx #endif
     5         kx END
     5         kx case "$malloctype" in
     5         kx '')
     5         kx 	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
     5         kx 		malloctype='void *'
     5         kx 	else
     5         kx 		malloctype='char *'
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx echo "Your system wants malloc to return '$malloctype', it would seem." >&4
     5         kx 
     5         kx case "$freetype" in
     5         kx '')
     5         kx 	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
     5         kx 		freetype='void'
     5         kx 	else
     5         kx 		freetype='int'
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx echo "Your system uses $freetype free(), it would seem." >&4
     5         kx $rm -f malloc.[co]
     5         kx : determine where site specific architecture-dependent libraries go.
     5         kx : sitelib  default is /usr/local/lib/perl5/site_perl/$version
     5         kx : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
     5         kx : sitelib may have an optional trailing /share.
     5         kx case "$sitearch" in
     5         kx '')	dflt=`echo $sitelib | $sed 's,/share$,,'`
     5         kx 	dflt="$dflt/$archname"
     5         kx 	;;
     5         kx *)	dflt="$sitearch"
     5         kx 	;;
     5         kx esac
     5         kx set sitearch sitearch none
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx The installation process will also create a directory for
     5         kx architecture-dependent site-specific extensions and modules.
     5         kx 
     5         kx EOM
     5         kx fn=d~+
     5         kx rp='Pathname for the site-specific architecture-dependent library files?'
     5         kx . ./getfile
     5         kx prefixvar=sitearch
     5         kx . ./setprefixvar
     5         kx if $test X"$sitearch" = X"$sitelib"; then
     5         kx 	d_sitearch="$undef"
     5         kx else
     5         kx 	d_sitearch="$define"
     5         kx fi
     5         kx 
     5         kx : Set the vendorprefix variables
     5         kx $cat <<EOM
     5         kx 
     5         kx The installation process will also create a directory for
     5         kx vendor-supplied add-ons.  Vendors who supply perl with their system
     5         kx may find it convenient to place all vendor-supplied files in this
     5         kx directory rather than in the main distribution directory.  This will
     5         kx ease upgrades between binary-compatible maintenance versions of perl.
     5         kx 
     5         kx Of course you may also use these directories in whatever way you see
     5         kx fit.  For example, you might use them to access modules shared over a
     5         kx company-wide network.
     5         kx 
     5         kx The default answer should be fine for most people.
     5         kx This causes further questions about vendor add-ons to be skipped
     5         kx and no vendor-specific directories will be configured for perl.
     5         kx 
     5         kx EOM
     5         kx rp='Do you want to configure vendor-specific add-on directories?'
     5         kx case "$usevendorprefix" in
     5         kx define|true|[yY]*) dflt=y ;;
     5         kx *)	: User may have set vendorprefix directly on Configure command line.
     5         kx 	case "$vendorprefix" in
     5         kx 	''|' ') dflt=n ;;
     5         kx 	*)	dflt=y ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx [yY]*)	fn=d~+
     5         kx 	rp='Installation prefix to use for vendor-supplied add-ons?'
     5         kx 	case "$vendorprefix" in
     5         kx 	'') dflt="$prefix" ;;
     5         kx 	*)  dflt=$vendorprefix ;;
     5         kx 	esac
     5         kx 	. ./getfile
     5         kx 	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
     5         kx 	oldvendorprefix=''
     5         kx 	case "$vendorprefix" in
     5         kx 	'') ;;
     5         kx 	*)	case "$ans" in
     5         kx 		"$prefix") ;;
     5         kx 		*) oldvendorprefix="$prefix";;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	usevendorprefix="$define"
     5         kx 	vendorprefix="$ans"
     5         kx 	vendorprefixexp="$ansexp"
     5         kx 	;;
     5         kx *)	usevendorprefix="$undef"
     5         kx 	vendorprefix=''
     5         kx 	vendorprefixexp=''
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Set the vendorlib variables
     5         kx case "$vendorprefix" in
     5         kx '')	d_vendorlib="$undef"
     5         kx 	vendorlib=''
     5         kx 	vendorlibexp=''
     5         kx 	;;
     5         kx *)	d_vendorlib="$define"
     5         kx 	: determine where vendor-supplied modules go.
     5         kx 	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
     5         kx 	case "$vendorlib" in
     5         kx 	'')
     5         kx 		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
     5         kx 		case "$installstyle" in
     5         kx 		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
     5         kx 		*lib32/perl5*) dflt=$vendorprefix/lib32/$package/vendor_$prog/$version ;;
     5         kx 		*lib64/perl5*) dflt=$vendorprefix/lib64/$package/vendor_$prog/$version ;;
     5         kx 		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	dflt="$vendorlib"
     5         kx 		;;
     5         kx 	esac
     5         kx 	fn=d~+
     5         kx 	rp='Pathname for the vendor-supplied library files?'
     5         kx 	. ./getfile
     5         kx 	vendorlib="$ans"
     5         kx 	vendorlibexp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
     5         kx prefixvar=vendorlib
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorarch variables
     5         kx case "$vendorprefix" in
     5         kx '')	d_vendorarch="$undef"
     5         kx 	vendorarch=''
     5         kx 	vendorarchexp=''
     5         kx 	;;
     5         kx *)	d_vendorarch="$define"
     5         kx 	: determine where vendor-supplied architecture-dependent libraries go.
     5         kx 	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
     5         kx 	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
     5         kx 	: vendorlib may have an optional trailing /share.
     5         kx 	case "$vendorarch" in
     5         kx 	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
     5         kx 		dflt="$dflt/$archname"
     5         kx 		;;
     5         kx 	*)	dflt="$vendorarch" ;;
     5         kx 	esac
     5         kx 	fn=d~+
     5         kx 	rp='Pathname for vendor-supplied architecture-dependent files?'
     5         kx 	. ./getfile
     5         kx 	vendorarch="$ans"
     5         kx 	vendorarchexp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx prefixvar=vendorarch
     5         kx . ./installprefix
     5         kx if $test X"$vendorarch" = X"$vendorlib"; then
     5         kx 	d_vendorarch="$undef"
     5         kx else
     5         kx 	d_vendorarch="$define"
     5         kx fi
     5         kx 
     5         kx : Final catch-all directories to search
     5         kx $cat <<EOM
     5         kx 
     5         kx Lastly, you can have perl look in other directories for extensions and
     5         kx modules in addition to those already specified.
     5         kx These directories will be searched after
     5         kx 	$sitearch
     5         kx 	$sitelib
     5         kx EOM
     5         kx test X"$vendorlib" != "X" && echo '	' $vendorlib
     5         kx test X"$vendorarch" != "X" && echo '	' $vendorarch
     5         kx echo ' '
     5         kx case "$otherlibdirs" in
     5         kx ''|' ') dflt='none' ;;
     5         kx *)	dflt="$otherlibdirs" ;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx Enter a colon-separated set of extra paths to include in perl's @INC
     5         kx search path, or enter 'none' for no extra paths.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx rp='Colon-separated list of additional directories for perl to search?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx ' '|''|none)	otherlibdirs=' ' ;;
     5         kx *)	otherlibdirs="$ans" ;;
     5         kx esac
     5         kx case "$otherlibdirs" in
     5         kx ' ') val=$undef ;;
     5         kx *)	val=$define ;;
     5         kx esac
     5         kx set d_perl_otherlibdirs
     5         kx eval $setvar
     5         kx 
     5         kx : DTrace support
     5         kx dflt_dtrace='/usr/sbin/dtrace'
     5         kx $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
     5         kx 
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built to support DTrace on platforms that support it.
     5         kx DTrace is a diagnosis and performance analysis tool from Sun.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default.
     5         kx EOM
     5         kx 
     5         kx while $test 1 ; do
     5         kx 	case "$usedtrace" in
     5         kx 	$define|true|[yY]*)
     5         kx 		dflt='y'
     5         kx 		;;
     5         kx 	$undef|false|[nN]*)
     5         kx 		dflt='n'
     5         kx 		dflt_dtrace=""
     5         kx 		;;
     5         kx 	?*)
     5         kx 		dflt='y'
     5         kx 		dflt_dtrace=$usedtrace
     5         kx 		;;
     5         kx 	*)
     5         kx 		dflt='n'
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	rp='Support DTrace if available?'
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	y|Y)	val="$define" ;;
     5         kx 	*)      val="$undef" ;;
     5         kx 	esac
     5         kx 	set usedtrace
     5         kx 	eval $setvar
     5         kx 
     5         kx 	test "X$usedtrace" != "X$define" && break
     5         kx 
     5         kx 	echo " "
     5         kx 	rp='Where is the dtrace executable?'
     5         kx 	dflt=$dflt_dtrace
     5         kx 	. ./getfile
     5         kx 	val="$ans"
     5         kx 	set dtrace
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $test -f $dtrace
     5         kx 	then
     5         kx 		if $dtrace -h -s ../perldtrace.d \
     5         kx 			-o perldtrace.tmp >/dev/null 2>&1 \
     5         kx 			&& rm -f perldtrace.tmp
     5         kx 		then
     5         kx 			echo " "
     5         kx 			echo "Good: your $dtrace knows about the -h flag."
     5         kx 		else
     5         kx 			cat >&2 <<EOM
     5         kx 
     5         kx *** $me:  Fatal Error:  $dtrace doesn't support -h flag
     5         kx ***
     5         kx *** Your installed dtrace doesn't support the -h switch to compile a D
     5         kx *** program into a C header. Can't continue.
     5         kx 
     5         kx EOM
     5         kx 			exit 1
     5         kx 		fi
     5         kx 		break;
     5         kx 	fi
     5         kx 
     5         kx 	case "$fastread" in
     5         kx 	yes)
     5         kx 		cat >&2 <<EOM
     5         kx 
     5         kx *** $me:  Fatal Error:  $dtrace not found.
     5         kx *** Can't continue.
     5         kx 
     5         kx EOM
     5         kx 		exit 1
     5         kx 		;;
     5         kx 	*)
     5         kx 		echo "*** $dtrace was not found."
     5         kx 		echo " "
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx : See if we want extra modules installed
     5         kx echo " "
     5         kx case "$extras" in
     5         kx '') dflt='n';;
     5         kx *) dflt='y';;
     5         kx esac
     5         kx cat <<EOM
     5         kx Perl can be built with extra modules or bundles of modules which
     5         kx will be fetched from the CPAN and installed alongside Perl.
     5         kx 
     5         kx Notice that you will need access to the CPAN; either via the Internet,
     5         kx or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
     5         kx be asked later to configure the CPAN.pm module which will in turn do
     5         kx the installation of the rest of the extra modules or bundles.)
     5         kx 
     5         kx Notice also that if the modules require any external software such as
     5         kx libraries and headers (the libz library and the zlib.h header for the
     5         kx Compress::Zlib module, for example) you MUST have any such software
     5         kx already installed, this configuration process will NOT install such
     5         kx things for you.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Install any extra modules (y or n)?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)
     5         kx 	cat <<EOM
     5         kx 
     5         kx Please list any extra modules or bundles to be installed from CPAN,
     5         kx with spaces between the names.  The names can be in any format the
     5         kx 'install' command of CPAN.pm will understand.  (Answer 'none',
     5         kx without the quotes, to install no extra modules or bundles.)
     5         kx EOM
     5         kx 	rp='Extras?'
     5         kx 	dflt="$extras"
     5         kx 	. ./myread
     5         kx 	extras="$ans"
     5         kx esac
     5         kx case "$extras" in
     5         kx ''|'none')
     5         kx 	val=''
     5         kx 	$rm -f ../extras.lst
     5         kx 	;;
     5         kx *)	echo "(Saving the list of extras for later...)"
     5         kx 	echo "$extras" > ../extras.lst
     5         kx 	val="'$extras'"
     5         kx 	;;
     5         kx esac
     5         kx set extras
     5         kx eval $setvar
     5         kx echo " "
     5         kx 
     5         kx : determine where html pages for programs go
     5         kx set html1dir html1dir none
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx If you wish to install html files for programs in $spackage, indicate
     5         kx the appropriate directory here.  To skip installing html files,
     5         kx answer "none".
     5         kx EOM
     5         kx case "$html1dir" in
     5         kx ''|none|$undef|' ') dflt=none ;;
     5         kx *) dflt=$html1dir ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp="Directory for the main $spackage html pages?"
     5         kx . ./getfile
     5         kx prefixvar=html1dir
     5         kx . ./setprefixvar
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$html1dir" = "X" && html1dir=' '
     5         kx 
     5         kx : determine where html pages for libraries and modules go
     5         kx set html3dir html3dir none
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx If you wish to install html files for modules associated with $spackage,
     5         kx indicate the appropriate directory here.  To skip installing html files,
     5         kx answer "none".
     5         kx EOM
     5         kx : There is no obvious default.  If they have specified html1dir, then
     5         kx : try to key off that, possibly changing .../html1 into .../html3.
     5         kx case "$html3dir" in
     5         kx '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
     5         kx *) dflt=$html3dir ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp="Directory for the $spackage module html pages?"
     5         kx . ./getfile
     5         kx prefixvar=html3dir
     5         kx . ./setprefixvar
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$html3dir" = "X" && html3dir=' '
     5         kx 
     5         kx : determine whether to install perl also as /usr/bin/perl
     5         kx 
     5         kx echo " "
     5         kx if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
     5         kx 	$cat <<EOM
     5         kx Many scripts expect perl to be installed as /usr/bin/perl.
     5         kx 
     5         kx If you want to, I can install the perl you are about to compile
     5         kx as /usr/bin/perl (in addition to $bin/perl).
     5         kx EOM
     5         kx 	if test -f /usr/bin/perl; then
     5         kx 	    $cat <<EOM
     5         kx 
     5         kx However, please note that because you already have a /usr/bin/perl,
     5         kx overwriting that with a new Perl would very probably cause problems.
     5         kx Therefore I'm assuming you don't want to do that (unless you insist).
     5         kx 
     5         kx EOM
     5         kx 	    case "$installusrbinperl" in
     5         kx 	    "$define"|[yY]*)	dflt='y';;
     5         kx 	    *)			dflt='n';;
     5         kx 	    esac
     5         kx 	else
     5         kx 	    $cat <<EOM
     5         kx 
     5         kx Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
     5         kx 
     5         kx EOM
     5         kx 	    case "$installusrbinperl" in
     5         kx 	    "$undef"|[nN]*)	dflt='n';;
     5         kx 	    *)			dflt='y';;
     5         kx 	    esac
     5         kx 	fi
     5         kx 	rp="Do you want to install perl as /usr/bin/perl?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	[yY]*)	val="$define";;
     5         kx 	*)	val="$undef" ;;
     5         kx 	esac
     5         kx else
     5         kx 	val="$undef"
     5         kx fi
     5         kx set installusrbinperl
     5         kx eval $setvar
     5         kx 
     5         kx : see if dlopen exists
     5         kx xxx_runnm="$runnm"
     5         kx xxx_ccflags="$ccflags"
     5         kx runnm=false
     5         kx : with g++ one needs -shared to get is-in-libc to work for dlopen
     5         kx case "$gccversion" in
     5         kx '')	;;
     5         kx *Clang*)	;;
     5         kx *)	case "$d_cplusplus" in
     5         kx 	"$define") ccflags="$ccflags -shared" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set dlopen d_dlopen
     5         kx eval $inlibc
     5         kx runnm="$xxx_runnm"
     5         kx ccflags="$xxx_ccflags"
     5         kx 
     5         kx : see if this is a unistd.h system
     5         kx set unistd.h i_unistd
     5         kx eval $inhdr
     5         kx 
     5         kx : determine which dynamic loading, if any, to compile in
     5         kx echo " "
     5         kx dldir="ext/DynaLoader"
     5         kx case "$usedl" in
     5         kx     $define|y|true)
     5         kx 	dflt='y'
     5         kx 	usedl="$define"
     5         kx 	;;
     5         kx     $undef|n|false)
     5         kx 	dflt='n'
     5         kx 	usedl="$undef"
     5         kx 	;;
     5         kx     *)
     5         kx 	dflt='n'
     5         kx 	case "$d_dlopen" in
     5         kx 	    $define) dflt='y' ;;
     5         kx 	esac
     5         kx 	: Does a dl_xxx.xs file exist for this operating system
     5         kx 	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
     5         kx 	;;
     5         kx esac
     5         kx rp="Do you wish to use dynamic loading?"
     5         kx . ./myread
     5         kx usedl="$ans"
     5         kx bin_ELF="$undef"
     5         kx case "$ans" in
     5         kx     y*) usedl="$define"
     5         kx 	case "$dlsrc" in
     5         kx 	    '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
     5         kx 		    dflt="$dldir/dl_${osname}.xs"
     5         kx 		elif $test "$d_dlopen" = "$define" ; then
     5         kx 		    dflt="$dldir/dl_dlopen.xs"
     5         kx 		else
     5         kx 		    dflt=''
     5         kx 		fi
     5         kx 		;;
     5         kx 	    *)  dflt="$dldir/$dlsrc"
     5         kx 		;;
     5         kx 	esac
     5         kx 	echo "The following dynamic loading files are available:"
     5         kx 	: Can not go over to $dldir because getfile has path hard-coded in.
     5         kx 	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
     5         kx 	rp="Source file to use for dynamic loading"
     5         kx 	fn="fne"
     5         kx 	gfpth="$src"
     5         kx 	. ./getfile
     5         kx 	usedl="$define"
     5         kx 	: emulate basename
     5         kx 	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
     5         kx 
     5         kx 	$cat << EOM
     5         kx 
     5         kx Some systems may require passing special flags to $cc -c to
     5         kx compile modules that will be used to create a shared library.
     5         kx To use no flags, say "none".
     5         kx 
     5         kx EOM
     5         kx 	case "$cccdlflags" in
     5         kx 	    '') case "$gccversion" in
     5         kx 		'') case "$osname" in
     5         kx 			hpux)	dflt='+z' ;;
     5         kx 			irix*)	dflt='-KPIC' ;;
     5         kx 			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
     5         kx 			sunos)	dflt='-pic' ;;
     5         kx 			*)	dflt='none' ;;
     5         kx 		    esac
     5         kx 		    ;;
     5         kx 		*)  case "$osname" in
     5         kx 			darwin) dflt='none' ;;
     5         kx 			*linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
     5         kx 			*)	dflt='-fpic' ;;
     5         kx 		    esac ;;
     5         kx 		esac ;;
     5         kx 	    ' ') dflt='none' ;;
     5         kx 	    *)   dflt="$cccdlflags" ;;
     5         kx 	esac
     5         kx 
     5         kx 	case "$dflt" in
     5         kx 	    none) dflt='' ;;
     5         kx 	esac
     5         kx 
     5         kx 	# If -Dsysroot was specified, now's the time to add it
     5         kx 	# to cccdlflags
     5         kx 	if test "X$sysroot" != X; then
     5         kx 	    case "$gccversion" in
     5         kx 		'') ;;
     5         kx 		*)  case "$dflt" in
     5         kx 			*sysroot*) ;;
     5         kx 			'undef'|*)
     5         kx 			    dflt="$dflt --sysroot=$sysroot" ;;
     5         kx 		    esac
     5         kx 		    ;;
     5         kx 	    esac
     5         kx 	fi
     5         kx 
     5         kx 	case "$dflt" in
     5         kx 	    '') dflt='none';;
     5         kx 	esac
     5         kx 
     5         kx 	rp="Any special flags to pass to $cc -c to compile shared library modules?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	    none) cccdlflags=' ' ;;
     5         kx 	    *)    cccdlflags="$ans" ;;
     5         kx 	esac
     5         kx 
     5         kx 	cat << EOM
     5         kx 
     5         kx Some systems use ld to create libraries that can be dynamically loaded,
     5         kx while other systems (such as those using ELF) use $cc.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx : Determine if this is ELF
     5         kx 	$cat >try.c <<EOM
     5         kx /* Test for whether ELF binaries are produced */
     5         kx #include <fcntl.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_unistd I_UNISTD
     5         kx #ifdef I_UNISTD
     5         kx #include <unistd.h>
     5         kx #endif
     5         kx int main() {
     5         kx     char b[4];
     5         kx     int i = open("a.out",O_RDONLY);
     5         kx     if(i == -1)
     5         kx 	exit(1); /* fail */
     5         kx     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
     5         kx 	exit(0); /* succeed (yes, it is ELF) */
     5         kx     exit(1); /* fail */
     5         kx }
     5         kx EOM
     5         kx 	if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
     5         kx 	    bin_ELF="$define"
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 
     5         kx 	case "$ld" in
     5         kx 	    '') if $test $bin_ELF = "$define"; then
     5         kx 		    cat <<EOM
     5         kx You appear to have ELF support.  I'll use $cc to build dynamic libraries.
     5         kx EOM
     5         kx 		    dflt="$cc"
     5         kx 		else
     5         kx 		    echo "I'll use ld to build dynamic libraries."
     5         kx 		    dflt='ld'
     5         kx 		fi
     5         kx 		;;
     5         kx 	    *)  dflt="$ld"
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	rp="What command should be used to create dynamic libraries?"
     5         kx 	. ./myread
     5         kx 	ld="$ans"
     5         kx 
     5         kx 	cat << EOM
     5         kx 
     5         kx Some systems may require passing special flags to $ld to create a
     5         kx library that can be dynamically loaded.  If your ld flags include
     5         kx -L/other/path options to locate libraries outside your loader's normal
     5         kx search path, you may need to specify those -L options here as well.  To
     5         kx use no flags, say "none".
     5         kx 
     5         kx EOM
     5         kx 	case "$lddlflags" in
     5         kx 	    '') case "$osname" in
     5         kx 		    haiku) dflt='-shared' ;;
     5         kx 		    hpux) dflt='-b';
     5         kx 			  case "$gccversion" in
     5         kx 			      '') dflt="$dflt +vnocompatwarnings" ;;
     5         kx 			  esac
     5         kx 			  ;;
     5         kx 		    *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
     5         kx 		    solaris) # See [perl #66604].
     5         kx 			    # On Solaris 11, gcc -m64 on amd64
     5         kx 			    # appears not to understand -G.  gcc versions at
     5         kx 			    # least as old as 3.4.3 support -shared, so just
     5         kx 			    # use that with Solaris 11 and later, but keep
     5         kx 			    # the old behavior for older Solaris versions.
     5         kx 			    case "$gccversion" in
     5         kx 				'') dflt='-G' ;;
     5         kx 				*)  case "$osvers" in
     5         kx 					2.?|2.10) dflt='-G' ;;
     5         kx 					*) dflt='-shared' ;;
     5         kx 				    esac
     5         kx 				    ;;
     5         kx 			    esac
     5         kx 			    ;;
     5         kx 		    sunos) dflt='-assert nodefinitions' ;;
     5         kx 		    svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
     5         kx 		    *)     dflt='none' ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	    *) dflt="$lddlflags" ;;
     5         kx 	esac
     5         kx 
     5         kx 	: Only do this for gcc, since, for example, qcc has no concept
     5         kx 	: of --sysroot.
     5         kx 	if $test "X$sysroot" != X; then
     5         kx 	    case "$gccversion" in
     5         kx 		'') ;;
     5         kx 		*)  dflt="$dflt --sysroot=$sysroot" ;;
     5         kx 	    esac
     5         kx 	fi
     5         kx 
     5         kx 	: Try to guess additional flags to pick up local libraries.
     5         kx 	: Be careful not to append to a plain 'none'
     5         kx 	case "$dflt" in
     5         kx 	    none) dflt='' ;;
     5         kx 	esac
     5         kx 	for thisflag in $ldflags; do
     5         kx 	    case "$thisflag" in
     5         kx 		-L*|-R*|-Wl,-R*)
     5         kx 		    case " $dflt " in
     5         kx 			*" $thisflag "*) ;;
     5         kx 			*) dflt="$dflt $thisflag" ;;
     5         kx 		    esac
     5         kx 		    ;;
     5         kx 	    esac
     5         kx 	done
     5         kx 
     5         kx 	case "$dflt" in
     5         kx 	    ''|' ') dflt='none' ;;
     5         kx 	esac
     5         kx 
     5         kx 	case "$ldflags" in
     5         kx 	    *-fstack-protector-strong*)
     5         kx 		case "$dflt" in
     5         kx 		    *-fstack-protector-strong*) ;; # Don't add it again
     5         kx 		    *) dflt="$dflt -fstack-protector-strong" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	    *-fstack-protector*)
     5         kx 		case "$dflt" in
     5         kx 		    *-fstack-protector*) ;; # Don't add it again
     5         kx 		    *) dflt="$dflt -fstack-protector" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	rp="Any special flags to pass to $ld to create a dynamically loaded library?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	    none) lddlflags=' ' ;;
     5         kx 	    *) lddlflags="$ans" ;;
     5         kx 	esac
     5         kx 
     5         kx 	cat <<EOM
     5         kx 
     5         kx Some systems may require passing special flags to $cc to indicate that
     5         kx the resulting executable will use dynamic linking.  To use no flags,
     5         kx say "none".
     5         kx 
     5         kx EOM
     5         kx 	case "$ccdlflags" in
     5         kx 	    '') case "$osname" in
     5         kx 		    *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
     5         kx 		    sunos)             dflt='none'   ;;
     5         kx 		    *)                 dflt='none'   ;;
     5         kx 		esac ;;
     5         kx 	    ' ') dflt='none' ;;
     5         kx 	    *)   dflt="$ccdlflags" ;;
     5         kx 	esac
     5         kx 	rp="Any special flags to pass to $cc to use dynamic linking?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	    none) ccdlflags=' ' ;;
     5         kx 	    *)    ccdlflags="$ans" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 
     5         kx     *)  usedl="$undef"
     5         kx 	ld='ld'
     5         kx 	dlsrc='dl_none.xs'
     5         kx 	lddlflags=''
     5         kx 	ccdlflags=''
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx ld_can_script="$undef"
     5         kx case "$bin_ELF$usedl" in
     5         kx     $define$define)
     5         kx 	# Abuse try.h and a.out names for neat cleanup
     5         kx 	$cat >try.c <<EOM
     5         kx void foo() {}
     5         kx void bar() {}
     5         kx EOM
     5         kx 	$cat >try.h <<EOM
     5         kx LIBTEST_42 {
     5         kx  global:
     5         kx   foo;
     5         kx  local: *;
     5         kx  };
     5         kx EOM
     5         kx 	if $cc $cccdlflags $ccdlflags $ccflags \
     5         kx 	       $ldflags $lddlflags -o a.out try.c \
     5         kx 	       -Wl,--version-script=try.h >/dev/null 2>&1 \
     5         kx 	   &&  $test -s a.out ; then
     5         kx 	    echo "ld supports scripting" >&4
     5         kx 	    ld_can_script="$define"
     5         kx 	else
     5         kx 	    echo "ld does not support scripting" >&4
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Do we want a shared libperl?
     5         kx also=''
     5         kx case "$usedl" in
     5         kx $undef)
     5         kx 	# No dynamic loading being used, so don't bother even to prompt.
     5         kx 	useshrplib='false'
     5         kx 	;;
     5         kx *)	case "$useshrplib" in
     5         kx 	'')	case "$osname" in
     5         kx 		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
     5         kx 			dflt=y
     5         kx 			also='Building a shared libperl is required for dynamic loading to work on your system.'
     5         kx 			;;
     5         kx 		*)	dflt=n
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	$define|true|[Yy]*)
     5         kx 		dflt=y
     5         kx 		;;
     5         kx 	*)	dflt=n
     5         kx 		;;
     5         kx 	esac
     5         kx 	$cat << EOM
     5         kx 
     5         kx The perl executable is normally obtained by linking perlmain.c with
     5         kx libperl${_a}, any static extensions (usually just DynaLoader), and
     5         kx any other libraries needed on this system (such as -lm, etc.).  Since
     5         kx your system supports dynamic loading, it is probably possible to build
     5         kx a shared libperl.$so.  If you will have more than one executable linked
     5         kx to libperl.$so, this will significantly reduce the size of each
     5         kx executable, but it may have a noticeable effect on performance.  The
     5         kx default is probably sensible for your system.
     5         kx $also
     5         kx 
     5         kx EOM
     5         kx 	rp="Build a shared libperl.$so (y/n)"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	true|$define|[Yy]*)
     5         kx 		useshrplib='true'  ;;
     5         kx 	*)	useshrplib='false' ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$useshrplib" in
     5         kx true)
     5         kx 	case "$userelocatableinc" in
     5         kx 	true|define)
     5         kx 		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
     5         kx 		echo "See INSTALL for an explanation why that won't work." >&4
     5         kx 		exit 4
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$libperl" in
     5         kx 	'')
     5         kx 		# Figure out a good name for libperl.so.  Since it gets stored in
     5         kx 		# a version-specific architecture-dependent library, the version
     5         kx 		# number isn't really that important, except for making cc/ld happy.
     5         kx 		#
     5         kx 		# A name such as libperl.so.10.1
     5         kx 		majmin="libperl.$so.$patchlevel.$subversion"
     5         kx 		# A name such as libperl.so.100
     5         kx 		majonly=`echo $patchlevel $subversion |
     5         kx 			$awk '{printf "%d%02d", $1, $2}'`
     5         kx 		majonly=libperl.$so.$majonly
     5         kx 		# I'd prefer to keep the os-specific stuff here to a minimum, and
     5         kx 		# rely on figuring it out from the naming of libc.
     5         kx 		case "${osname}${osvers}" in
     5         kx 		*linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
     5         kx 			dflt=libperl.$so
     5         kx 			;;
     5         kx 		cygwin*) # ld links now against the dll directly
     5         kx 			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
     5         kx 			majonly=`echo $patchlevel $subversion |
     5         kx 				$awk '{printf "%03d%03d", $1, $2}'`
     5         kx 			majonly=cygperl5.$majonly.$so
     5         kx 			dflt=$majmin
     5         kx 			;;
     5         kx 		*)	# Try to guess based on whether libc has major.minor.
     5         kx 			case "$libc" in
     5         kx 			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
     5         kx 			*libc.$so.[0-9]*) dflt=$majonly ;;
     5         kx 			*)	dflt=libperl.$so ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	dflt=$libperl
     5         kx 		;;
     5         kx 	esac
     5         kx 	cat << EOM
     5         kx 
     5         kx I need to select a good name for the shared libperl.  If your system uses
     5         kx library names with major and minor numbers, then you might want something
     5         kx like $majmin.  Alternatively, if your system uses a single version
     5         kx number for shared libraries, then you might want to use $majonly.
     5         kx Or, your system might be quite happy with a simple libperl.$so.
     5         kx 
     5         kx Since the shared libperl will get installed into a version-specific
     5         kx architecture-dependent directory, the version number of the shared perl
     5         kx library probably isn't important, so the default should be o.k.
     5         kx 
     5         kx EOM
     5         kx 	rp='What name do you want to give to the shared libperl?'
     5         kx 	. ./myread
     5         kx 	libperl=$ans
     5         kx 	echo "Ok, I'll use $libperl"
     5         kx 	;;
     5         kx *)
     5         kx 	libperl="libperl${_a}"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx # Detect old use of shrpdir via undocumented Configure -Dshrpdir
     5         kx case "$shrpdir" in
     5         kx '') ;;
     5         kx *)	$cat >&4 <<EOM
     5         kx WARNING:  Use of the shrpdir variable for the installation location of
     5         kx the shared $libperl is not supported.  It was never documented and
     5         kx will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
     5         kx know of any problems this may cause.
     5         kx 
     5         kx EOM
     5         kx 	case "$shrpdir" in
     5         kx 	"$archlibexp/CORE")
     5         kx 		$cat >&4 <<EOM
     5         kx But your current setting of $shrpdir is
     5         kx the default anyway, so it's harmless.
     5         kx EOM
     5         kx 		;;
     5         kx 	*)
     5         kx 		$cat >&4 <<EOM
     5         kx Further, your current attempted setting of $shrpdir
     5         kx conflicts with the value of $archlibexp/CORE
     5         kx that installperl will use.
     5         kx EOM
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx # How will the perl executable find the installed shared $libperl?
     5         kx # Add $xxx to ccdlflags.
     5         kx # If we can't figure out a command-line option, use $shrpenv to
     5         kx # set env LD_RUN_PATH.  The main perl makefile uses this.
     5         kx shrpdir=$archlibexp/CORE
     5         kx xxx=''
     5         kx tmp_shrpenv=''
     5         kx if "$useshrplib"; then
     5         kx     case "$osname" in
     5         kx 	aix)
     5         kx 		# We'll set it in Makefile.SH...
     5         kx 		;;
     5         kx 	solaris)
     5         kx 		xxx="-R $shrpdir"
     5         kx 		;;
     5         kx 	freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
     5         kx 		xxx="-Wl,-R$shrpdir"
     5         kx 		;;
     5         kx 	bsdos|linux|irix*|dec_osf|gnu*|haiku)
     5         kx 		xxx="-Wl,-rpath,$shrpdir"
     5         kx 		;;
     5         kx 	hpux*)
     5         kx 		# hpux doesn't like the default, either.
     5         kx 		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
     5         kx 		;;
     5         kx 	cygwin)
     5         kx 		# cygwin needs only ldlibpth
     5         kx 		;;
     5         kx 	*)
     5         kx 		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$xxx" in
     5         kx 	'') ;;
     5         kx 	*)
     5         kx 		# Only add $xxx if it isn't already in ccdlflags.
     5         kx 		case " $ccdlflags " in
     5         kx 		*" $xxx "*)	;;
     5         kx 		*)	ccdlflags="$ccdlflags $xxx"
     5         kx 			cat <<EOM >&4
     5         kx 
     5         kx Adding $xxx to the flags
     5         kx passed to $ld so that the perl executable will find the
     5         kx installed shared $libperl.
     5         kx 
     5         kx EOM
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx # Fix ccdlflags in AIX for building external extensions.
     5         kx # (For building Perl itself bare -bE:perl.exp is needed,
     5         kx #  Makefile.SH takes care of this.)
     5         kx case "$osname" in
     5         kx aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
     5         kx esac
     5         kx # Respect a hint or command-line value.
     5         kx case "$shrpenv" in
     5         kx '') shrpenv="$tmp_shrpenv" ;;
     5         kx esac
     5         kx case "$ldlibpthname" in
     5         kx '')	ldlibpthname=LD_LIBRARY_PATH ;;
     5         kx none)	ldlibpthname='' ;;
     5         kx esac
     5         kx 
     5         kx : determine where manual pages are on this system
     5         kx echo " "
     5         kx case "$sysman" in
     5         kx '')
     5         kx 	syspath='/usr/share/man/man1 /usr/man/man1'
     5         kx 	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
     5         kx 	syspath="$syspath /usr/man/u_man/man1"
     5         kx 	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
     5         kx 	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
     5         kx 	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
     5         kx 	sysman=`./loc . /usr/man/man1 $syspath`
     5         kx 	;;
     5         kx esac
     5         kx if $test -d "$sysman"; then
     5         kx 	echo "System manual is in $sysman." >&4
     5         kx else
     5         kx 	echo "Could not find manual pages in source form." >&4
     5         kx fi
     5         kx 
     5         kx : determine where manual pages go
     5         kx set man1dir man1dir none
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx $spackage has manual pages available in source form.
     5         kx EOM
     5         kx case "$nroff" in
     5         kx nroff)
     5         kx 	echo "However, you don't have nroff, so they're probably useless to you."
     5         kx 	case "$man1dir" in
     5         kx 	'') man1dir="none";;
     5         kx 	esac;;
     5         kx esac
     5         kx echo "If you don't want the manual sources installed, answer 'none'."
     5         kx case "$man1dir" in
     5         kx ' ') dflt=none
     5         kx 	;;
     5         kx '')
     5         kx 	lookpath="$prefixexp/share/man/man1"
     5         kx 	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
     5         kx 	lookpath="$lookpath $prefixexp/man/p_man/man1"
     5         kx 	lookpath="$lookpath $prefixexp/man/u_man/man1"
     5         kx 	lookpath="$lookpath $prefixexp/man/man.1"
     5         kx 	case "$sysman" in
     5         kx 	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
     5         kx 	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
     5         kx 	esac
     5         kx 	set dflt
     5         kx 	eval $prefixup
     5         kx 	;;
     5         kx *)  dflt="$man1dir"
     5         kx 	;;
     5         kx esac
     5         kx echo " "
     5         kx fn=dn+~
     5         kx rp="Where do the main $spackage manual pages (source) go?"
     5         kx . ./getfile
     5         kx if $test "X$man1direxp" != "X$ansexp"; then
     5         kx 	installman1dir=''
     5         kx fi
     5         kx prefixvar=man1dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx case "$man1dir" in
     5         kx '')	man1dir=' '
     5         kx 	installman1dir='';;
     5         kx esac
     5         kx 
     5         kx : What suffix to use on installed man pages
     5         kx 
     5         kx case "$man1dir" in
     5         kx ' ')
     5         kx 	man1ext='0'
     5         kx 	;;
     5         kx *)
     5         kx 	rp="What suffix should be used for the main $spackage man pages?"
     5         kx 	case "$man1ext" in
     5         kx 	'')	case "$man1dir" in
     5         kx 		*1)  dflt=1 ;;
     5         kx 		*1p) dflt=1p ;;
     5         kx 		*1pm) dflt=1pm ;;
     5         kx 		*l) dflt=l;;
     5         kx 		*n) dflt=n;;
     5         kx 		*o) dflt=o;;
     5         kx 		*p) dflt=p;;
     5         kx 		*C) dflt=C;;
     5         kx 		*L) dflt=L;;
     5         kx 		*L1) dflt=L1;;
     5         kx 		*) dflt=1;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	dflt="$man1ext";;
     5         kx 	esac
     5         kx 	. ./myread
     5         kx 	man1ext="$ans"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if we can have long filenames
     5         kx echo " "
     5         kx first=123456789abcdef
     5         kx $rm -f $first
     5         kx if (echo hi >$first) 2>/dev/null; then
     5         kx 	if $test -f 123456789abcde; then
     5         kx 		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo 'You can have filenames longer than 14 characters.'>&4
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	$cat <<'EOM'
     5         kx You can't have filenames longer than 14 chars.
     5         kx You can't even think about them!
     5         kx EOM
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_flexfnam
     5         kx eval $setvar
     5         kx $rm -rf 123456789abcde*
     5         kx 
     5         kx : determine where library module manual pages go
     5         kx set man3dir man3dir none
     5         kx eval $prefixit
     5         kx $cat <<EOM
     5         kx 
     5         kx $spackage has manual pages for many of the library modules.
     5         kx EOM
     5         kx 
     5         kx case "$nroff" in
     5         kx nroff)
     5         kx 	$cat <<'EOM'
     5         kx However, you don't have nroff, so they're probably useless to you.
     5         kx EOM
     5         kx 	case "$man3dir" in
     5         kx 	'') man3dir="none";;
     5         kx 	esac;;
     5         kx esac
     5         kx 
     5         kx case "$d_flexfnam" in
     5         kx undef)
     5         kx 	$cat <<'EOM'
     5         kx However, your system can't handle the long file names like File::Basename.3.
     5         kx EOM
     5         kx 	case "$man3dir" in
     5         kx 	'') man3dir="none";;
     5         kx 	esac;;
     5         kx esac
     5         kx 
     5         kx echo "If you don't want the manual sources installed, answer 'none'."
     5         kx prog=`echo $package | $sed 's/-*[0-9.]*$//'`
     5         kx case "$man3dir" in
     5         kx '')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
     5         kx 	if $test -d "$privlib/man/man3"; then
     5         kx 		cat <<EOM >&4
     5         kx 
     5         kx WARNING:  Previous versions of perl installed man3 pages into
     5         kx $privlib/man/man3.  This version will suggest a
     5         kx new default of $dflt.
     5         kx EOM
     5         kx 		tdflt=$dflt
     5         kx 		dflt='n'
     5         kx 		rp='Do you wish to preserve the old behavior?(y/n)'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		y*) dflt="$privlib/man/man3" ;;
     5         kx 		*)  dflt=$tdflt ;;
     5         kx 		esac
     5         kx     fi
     5         kx 	;;
     5         kx *)	dflt="$man3dir" ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ' ') dflt=none ;;
     5         kx esac
     5         kx echo " "
     5         kx fn=dn+~
     5         kx rp="Where do the $package library man pages (source) go?"
     5         kx . ./getfile
     5         kx prefixvar=man3dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx case "$man3dir" in
     5         kx '')	man3dir=' '
     5         kx 	installman3dir='';;
     5         kx esac
     5         kx 
     5         kx : What suffix to use on installed man pages
     5         kx case "$man3dir" in
     5         kx ' ')
     5         kx 	man3ext='0'
     5         kx 	;;
     5         kx *)
     5         kx 	rp="What suffix should be used for the $package library man pages?"
     5         kx 	case "$man3ext" in
     5         kx 	'')	case "$man3dir" in
     5         kx 		*3)  dflt=3 ;;
     5         kx 		*3p) dflt=3p ;;
     5         kx 		*3pm) dflt=3pm ;;
     5         kx 		*l) dflt=l;;
     5         kx 		*n) dflt=n;;
     5         kx 		*o) dflt=o;;
     5         kx 		*p) dflt=p;;
     5         kx 		*C) dflt=C;;
     5         kx 		*L) dflt=L;;
     5         kx 		*L3) dflt=L3;;
     5         kx 		*) dflt=3;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	dflt="$man3ext";;
     5         kx 	esac
     5         kx 	. ./myread
     5         kx 	man3ext="$ans"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if we have to deal with yellow pages, now NIS.
     5         kx if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
     5         kx 	case "$hostcat" in
     5         kx 	nidump*) ;;
     5         kx 	*)
     5         kx 		case "$hostcat" in
     5         kx 		*ypcat*) dflt=y;;
     5         kx 		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
     5         kx 				dflt=y
     5         kx 			else
     5         kx 				dflt=n
     5         kx 			fi;;
     5         kx 		*) dflt=n;;
     5         kx 		esac
     5         kx 		echo " "
     5         kx 		rp='Are you getting the hosts file via yellow pages?'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		y*) hostcat='ypcat hosts';;
     5         kx 		*) hostcat='cat /etc/hosts';;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx case "$hostcat" in
     5         kx '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
     5         kx esac
     5         kx case "$groupcat" in
     5         kx '') test -f /etc/group && groupcat='cat /etc/group';;
     5         kx esac
     5         kx case "$passcat" in
     5         kx '') test -f /etc/passwd && passcat='cat /etc/passwd';;
     5         kx esac
     5         kx 
     5         kx : now get the host name
     5         kx echo " "
     5         kx echo "Figuring out host name..." >&4
     5         kx case "$myhostname" in
     5         kx '') cont=true
     5         kx 	echo 'Maybe "hostname" will work...'
     5         kx 	if tans=`sh -c hostname 2>&1` ; then
     5         kx 		myhostname=$tans
     5         kx 		phostname=hostname
     5         kx 		cont=''
     5         kx 	fi
     5         kx 	;;
     5         kx *) cont='';;
     5         kx esac
     5         kx if $test "$cont"; then
     5         kx 	if ./xenix; then
     5         kx 		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
     5         kx 		if tans=`cat /etc/systemid 2>&1` ; then
     5         kx 			myhostname=$tans
     5         kx 			phostname='cat /etc/systemid'
     5         kx 			echo "Whadyaknow.  Xenix always was a bit strange..."
     5         kx 			cont=''
     5         kx 		fi
     5         kx 	elif $test -r /etc/systemid; then
     5         kx 		echo "(What is a non-Xenix system doing with /etc/systemid?)"
     5         kx 	fi
     5         kx fi
     5         kx if $test "$cont"; then
     5         kx 	echo 'No, maybe "uuname -l" will work...'
     5         kx 	if tans=`sh -c 'uuname -l' 2>&1` ; then
     5         kx 		myhostname=$tans
     5         kx 		phostname='uuname -l'
     5         kx 	else
     5         kx 		echo 'Strange.  Maybe "uname -n" will work...'
     5         kx 		if tans=`sh -c 'uname -n' 2>&1` ; then
     5         kx 			myhostname=$tans
     5         kx 			phostname='uname -n'
     5         kx 		else
     5         kx 			echo 'Oh well, maybe I can mine it out of whoami.h...'
     5         kx 			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
     5         kx 				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
     5         kx 				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
     5         kx 			else
     5         kx 				case "$myhostname" in
     5         kx 				'') echo "Does this machine have an identity crisis or something?"
     5         kx 					phostname='';;
     5         kx 				*)
     5         kx 					echo "Well, you said $myhostname before..."
     5         kx 					phostname='echo $myhostname';;
     5         kx 				esac
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx fi
     5         kx case "$myhostname" in
     5         kx '') myhostname=noname ;;
     5         kx esac
     5         kx : you do not want to know about this
     5         kx set $myhostname
     5         kx myhostname=$1
     5         kx 
     5         kx : verify guess
     5         kx if $test "$myhostname" ; then
     5         kx 	dflt=y
     5         kx 	rp='Your host name appears to be "'$myhostname'".'" Right?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	y*) ;;
     5         kx 	*) myhostname='';;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : bad guess or no guess
     5         kx while $test "X$myhostname" = X ; do
     5         kx 	dflt=''
     5         kx 	rp="Please type the (one word) name of your host:"
     5         kx 	. ./myread
     5         kx 	myhostname="$ans"
     5         kx done
     5         kx 
     5         kx : translate upper to lower if necessary
     5         kx case "$myhostname" in
     5         kx *[A-Z]*)
     5         kx 	echo "(Normalizing case in your host name)"
     5         kx 	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$myhostname" in
     5         kx *.*)
     5         kx 	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
     5         kx 	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
     5         kx 	echo "(Trimming domain name from host name--host name is now $myhostname)"
     5         kx 	;;
     5         kx *) case "$mydomain" in
     5         kx 	'')
     5         kx 		{
     5         kx 			test "X$hostcat" = "Xypcat hosts" &&
     5         kx 			ypmatch "$myhostname" hosts 2>/dev/null |\
     5         kx 				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
     5         kx 			$test -s hosts
     5         kx 		} || {
     5         kx 			test "X$hostcat" != "X" &&
     5         kx 			$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
     5         kx 					/[	 ]$myhostname[	. ]/p" > hosts
     5         kx 		}
     5         kx 		tmp_re="[	. ]"
     5         kx 		if $test -f hosts; then
     5         kx 			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
     5         kx 			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
     5         kx 			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
     5         kx 				hosts | $sort | $uniq | \
     5         kx 				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
     5         kx 			case `$echo X$dflt` in
     5         kx 			X*\ *)	echo "(Several hosts in the database matched hostname)"
     5         kx 				dflt=.
     5         kx 				;;
     5         kx 			X.) echo "(You do not have fully-qualified names in the hosts database)"
     5         kx 				;;
     5         kx 			esac
     5         kx 		else
     5         kx 			echo "(I cannot locate a hosts database anywhere)"
     5         kx 			dflt=.
     5         kx 		fi
     5         kx 		case "$dflt" in
     5         kx 		.)
     5         kx 			tans=`./loc resolv.conf X /etc /usr/etc`
     5         kx 			if $test -f "$tans"; then
     5         kx 				echo "(Attempting domain name extraction from $tans)"
     5         kx 				dflt=.`$sed -n -e 's/	/ /g' \
     5         kx 				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
     5         kx 				  -e 1q 2>/dev/null`
     5         kx 				case "$dflt" in
     5         kx 				.) dflt=.`$sed -n -e 's/	/ /g' \
     5         kx 				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
     5         kx 				     -e 1q 2>/dev/null`
     5         kx 					;;
     5         kx 				esac
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$dflt" in
     5         kx 		.) echo "(No help from resolv.conf either -- attempting clever guess)"
     5         kx 			dflt=.`sh -c domainname 2>/dev/null`
     5         kx 			case "$dflt" in
     5         kx 			'') dflt='.';;
     5         kx 			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$dflt$osname" in
     5         kx 		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
     5         kx 			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$dflt" in
     5         kx 		.) echo "(Lost all hope -- silly guess then)"
     5         kx 			dflt='.nonet'
     5         kx 			;;
     5         kx 		esac
     5         kx 		$rm -f hosts
     5         kx 		;;
     5         kx 	*) dflt="$mydomain";;
     5         kx 	esac;;
     5         kx esac
     5         kx echo " "
     5         kx rp="What is your domain name?"
     5         kx . ./myread
     5         kx tans="$ans"
     5         kx case "$ans" in
     5         kx '') ;;
     5         kx .*) ;;
     5         kx *) tans=".$tans";;
     5         kx esac
     5         kx mydomain="$tans"
     5         kx 
     5         kx : translate upper to lower if necessary
     5         kx case "$mydomain" in
     5         kx *[A-Z]*)
     5         kx 	echo "(Normalizing case in your domain name)"
     5         kx 	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : a little sanity check here
     5         kx case "$phostname" in
     5         kx '') ;;
     5         kx *)
     5         kx 	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
     5         kx 	$myhostname$mydomain|$myhostname) ;;
     5         kx 	*)
     5         kx 		case "$phostname" in
     5         kx 		sed*)
     5         kx 			echo "(That doesn't agree with your whoami.h file, by the way.)"
     5         kx 			;;
     5         kx 		*)
     5         kx 			echo "(That doesn't agree with your $phostname command, by the way.)"
     5         kx 			;;
     5         kx 		esac
     5         kx 	;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : determine the e-mail address of the user who is running us
     5         kx $cat <<EOM
     5         kx 
     5         kx I need to get your e-mail address in Internet format if possible, i.e.
     5         kx something like user@host.domain. Please answer accurately since I have
     5         kx no easy means to double check it. The default value provided below
     5         kx is most probably close to reality but may not be valid from outside
     5         kx your organization...
     5         kx 
     5         kx EOM
     5         kx cont=x
     5         kx while test "$cont"; do
     5         kx 	case "$MAILDOMAIN" in
     5         kx 	'')
     5         kx 		if $test -s /etc/mailname; then
     5         kx 			maildomain=`$cat /etc/mailname`
     5         kx 		else
     5         kx 			maildomain="$myhostname$mydomain"
     5         kx 		fi
     5         kx 		;;
     5         kx 	*)  maildomain="$MAILDOMAIN";;
     5         kx 	esac
     5         kx 	case "$cf_email" in
     5         kx 	'') dflt="$cf_by@$maildomain";;
     5         kx 	*)  dflt="$cf_email";;
     5         kx 	esac
     5         kx 	rp='What is your e-mail address?'
     5         kx 	. ./myread
     5         kx 	cf_email="$ans"
     5         kx 	case "$cf_email" in
     5         kx 	*@*.*) cont='' ;;
     5         kx 	*)
     5         kx 		rp='Address does not look like an Internet one.  Use it anyway?'
     5         kx 		case "$fastread" in
     5         kx 		yes) dflt=y ;;
     5         kx 		*) dflt=n ;;
     5         kx 		esac
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		y*) cont='' ;;
     5         kx 		*) echo " " ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx : Ask e-mail of administrator
     5         kx $cat <<EOM
     5         kx 
     5         kx If you or somebody else will be maintaining perl at your site, please
     5         kx fill in the correct e-mail address here so that they may be contacted
     5         kx if necessary. You may enter "none" for no administrator.
     5         kx 
     5         kx EOM
     5         kx case "$perladmin" in
     5         kx '') dflt="$cf_email";;
     5         kx *) dflt="$perladmin";;
     5         kx esac
     5         kx rp='Perl administrator e-mail address'
     5         kx . ./myread
     5         kx perladmin="$ans"
     5         kx 
     5         kx : determine whether to use a version number suffix for installed binaries
     5         kx echo " "
     5         kx $cat <<EOM
     5         kx Do you want to use a version number suffix for installed binaries? This
     5         kx will install 'perl$version' instead of 'perl', and likewise for other
     5         kx binaries like 'perldoc' and 'cpan'. This allows many versions of perl
     5         kx to be installed side-by-side. Unless you are a developer, you probably
     5         kx do *not* want to do this.
     5         kx EOM
     5         kx case "$versiononly" in
     5         kx "$define"|[Yy]*|true) dflt='y' ;;
     5         kx *) dflt='n';
     5         kx esac
     5         kx rp="Do you want to use a version number suffix for installed binaries?"
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx [yY]*)	val="$define";;
     5         kx *)	val="$undef" ;;
     5         kx esac
     5         kx set versiononly
     5         kx eval $setvar
     5         kx 
     5         kx case "$versiononly" in
     5         kx "$define") inc_version_list=''
     5         kx            inc_version_list_init=0
     5         kx            ;;
     5         kx esac
     5         kx 
     5         kx : figure out how to guarantee perl startup
     5         kx : XXX Note that this currently takes advantage of the bug that binexp ignores
     5         kx :     the Configure -Dinstallprefix setting, which in turn means that under
     5         kx :     relocatable @INC, initialinstalllocation is what binexp started as.
     5         kx case "$startperl" in
     5         kx '')
     5         kx 	case "$sharpbang" in
     5         kx 	*!)
     5         kx 		$cat <<EOH
     5         kx 
     5         kx I can use the #! construct to start perl on your system. This will
     5         kx make startup of perl scripts faster, but may cause problems if you
     5         kx want to share those scripts and perl is not in a standard place
     5         kx ($initialinstalllocation/perl) on all your platforms. The alternative
     5         kx is to force a shell by starting the script with a single ':' character.
     5         kx 
     5         kx EOH
     5         kx 		case "$versiononly" in
     5         kx 		"$define")      dflt="$initialinstalllocation/perl$version";;
     5         kx 		*)              dflt="$initialinstalllocation/perl";;
     5         kx 		esac
     5         kx 		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		none)	startperl=": # use perl";;
     5         kx 		*)	startperl="#!$ans"
     5         kx 			if $test 30 -lt `echo "$ans" | wc -c`; then
     5         kx 				$cat >&4 <<EOM
     5         kx 
     5         kx WARNING:  Some systems limit the #! command to 32 characters.
     5         kx If you experience difficulty running Perl scripts with #!, try
     5         kx installing Perl in a directory with a shorter pathname.
     5         kx 
     5         kx EOM
     5         kx 			fi ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*) startperl=": # use perl"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx echo "I'll use $startperl to start perl scripts."
     5         kx 
     5         kx : figure best path for perl in scripts
     5         kx case "$perlpath" in
     5         kx '')
     5         kx 	case "$versiononly" in
     5         kx 	"$define")	perlpath="$initialinstalllocation/perl$version";;
     5         kx 	*)		perlpath="$initialinstalllocation/perl";;
     5         kx 	esac
     5         kx 	case "$startperl" in
     5         kx 	*!*) ;;
     5         kx 	*)
     5         kx 		$cat <<EOH
     5         kx 
     5         kx I will use the "eval 'exec'" idiom to start Perl on your system.
     5         kx I can use the full path of your Perl binary for this purpose, but
     5         kx doing so may cause problems if you want to share those scripts and
     5         kx Perl is not always in a standard place ($initialinstalllocation/perl).
     5         kx 
     5         kx EOH
     5         kx 		dflt="$initialinstalllocation/perl"
     5         kx 		rp="What path shall I use in \"eval 'exec'\"?"
     5         kx 		. ./myread
     5         kx 		perlpath="$ans"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$startperl" in
     5         kx *!*)	;;
     5         kx *)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
     5         kx esac
     5         kx 
     5         kx : determine where public executable scripts go
     5         kx set scriptdir scriptdir
     5         kx eval $prefixit
     5         kx case "$scriptdir" in
     5         kx '')
     5         kx 	dflt="$bin"
     5         kx 	: guess some guesses
     5         kx 	$test -d /usr/share/scripts && dflt=/usr/share/scripts
     5         kx 	$test -d /usr/share/bin     && dflt=/usr/share/bin
     5         kx 	$test -d /usr/local/script  && dflt=/usr/local/script
     5         kx 	$test -d /usr/local/scripts && dflt=/usr/local/scripts
     5         kx 	$test -d $prefixexp/script  && dflt=$prefixexp/script
     5         kx 	set dflt
     5         kx 	eval $prefixup
     5         kx 	;;
     5         kx *)  dflt="$scriptdir"
     5         kx 	;;
     5         kx esac
     5         kx $cat <<EOM
     5         kx 
     5         kx Some installations have a separate directory just for executable scripts so
     5         kx that they can mount it across multiple architectures but keep the scripts in
     5         kx one spot.  You might, for example, have a subdirectory of /usr/share for this.
     5         kx Or you might just lump your scripts in with all your other executables.
     5         kx 
     5         kx EOM
     5         kx fn=d~
     5         kx rp='Where do you keep publicly executable scripts?'
     5         kx . ./getfile
     5         kx if $test "X$ansexp" != "X$scriptdirexp"; then
     5         kx 	installscript=''
     5         kx fi
     5         kx installscriptdir=''
     5         kx prefixvar=scriptdir
     5         kx . ./setprefixvar
     5         kx : A little fix up for an irregularly named variable.
     5         kx installscript="$installscriptdir"
     5         kx 
     5         kx : determine where add-on public executables go
     5         kx case "$sitebin" in
     5         kx '')	dflt=$siteprefix/bin ;;
     5         kx *)	dflt=$sitebin ;;
     5         kx esac
     5         kx fn=d~
     5         kx rp='Pathname where the add-on public executables should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=sitebin
     5         kx . ./setprefixvar
     5         kx 
     5         kx : determine where add-on html pages go
     5         kx : There is no standard location, so try to copy the previously-selected
     5         kx : directory structure for the core html pages.
     5         kx case "$sitehtml1dir" in
     5         kx '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
     5         kx *)     dflt=$sitehtml1dir ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp='Pathname where the site-specific html pages should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=sitehtml1dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx : determine where add-on library html pages go
     5         kx : There is no standard location, so try to copy the previously-selected
     5         kx : directory structure for the core html pages.
     5         kx case "$sitehtml3dir" in
     5         kx '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
     5         kx *)     dflt=$sitehtml3dir ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp='Pathname where the site-specific library html pages should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=sitehtml3dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx : determine where add-on manual pages go
     5         kx case "$siteman1dir" in
     5         kx '')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
     5         kx *)	dflt=$siteman1dir ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp='Pathname where the site-specific manual pages should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=siteman1dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx : determine where add-on library man pages go
     5         kx case "$siteman3dir" in
     5         kx '')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
     5         kx *)	dflt=$siteman3dir ;;
     5         kx esac
     5         kx case "$dflt" in
     5         kx ''|' ') dflt=none ;;
     5         kx esac
     5         kx fn=dn+~
     5         kx rp='Pathname where the site-specific library manual pages should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=siteman3dir
     5         kx . ./setprefixvar
     5         kx 
     5         kx : determine where add-on public executable scripts go
     5         kx case "$sitescript" in
     5         kx '')	dflt=$siteprefix/script
     5         kx 	$test -d $dflt || dflt=$sitebin ;;
     5         kx *)  dflt="$sitescript" ;;
     5         kx esac
     5         kx fn=d~+
     5         kx rp='Pathname where add-on public executable scripts should be installed?'
     5         kx . ./getfile
     5         kx prefixvar=sitescript
     5         kx . ./setprefixvar
     5         kx 
     5         kx : see if backtrace exists
     5         kx set backtrace d_backtrace
     5         kx eval $inlibc
     5         kx 
     5         kx : Check if C backtrace is actually supported.
     5         kx case "$usecbacktrace" in
     5         kx   "") usecbacktrace=$undef ;;
     5         kx   [yY]*|true|$define)
     5         kx     case "$d_backtrace" in
     5         kx       [yY]*|true|$define)
     5         kx         ;;
     5         kx       *)
     5         kx         echo "This system does not support backtrace" >&4
     5         kx         usecbacktrace=$undef
     5         kx         ;;
     5         kx       esac
     5         kx     ;;
     5         kx   esac
     5         kx 
     5         kx : Check if faststdio is requested and available
     5         kx case "$usefaststdio" in
     5         kx $define|true|[yY]*|'')
     5         kx 	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
     5         kx 	case "$xversion" in
     5         kx 	[68])	dflt='y' ;;
     5         kx 	*)	dflt='n' ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *) dflt='n';;
     5         kx esac
     5         kx cat <<EOM
     5         kx 
     5         kx Perl can be built to use 'fast stdio', which means using the stdio
     5         kx library but also directly manipulating the stdio buffers to enable
     5         kx faster I/O.  Using stdio is better for backward compatibility (especially
     5         kx for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
     5         kx interface has been preferred instead of stdio.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx rp='Use the "fast stdio" if available?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y)	val="$define" ;;
     5         kx *)      val="$undef" ;;
     5         kx esac
     5         kx set usefaststdio
     5         kx eval $setvar
     5         kx 
     5         kx : define an is-a-typedef? function
     5         kx typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
     5         kx case "$inclist" in
     5         kx "") inclist="sys/types.h";;
     5         kx esac;
     5         kx eval "varval=\$$var";
     5         kx case "$varval" in
     5         kx "")
     5         kx 	$rm -f temp.c;
     5         kx 	for inc in $inclist; do
     5         kx 		echo "#include <$inc>" >>temp.c;
     5         kx 	done;
     5         kx 	echo "#ifdef $type" >> temp.c;
     5         kx 	echo "printf(\"We have $type\");" >> temp.c;
     5         kx 	echo "#endif" >> temp.c;
     5         kx 	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
     5         kx 	if $contains $type temp.E >/dev/null 2>&1; then
     5         kx 		eval "$var=\$type";
     5         kx 	else
     5         kx 		eval "$var=\$def";
     5         kx 	fi;
     5         kx 	$rm -f temp.?;;
     5         kx *) eval "$var=\$varval";;
     5         kx esac'
     5         kx 
     5         kx : define an is-a-typedef? function that prompts if the type is not available.
     5         kx typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
     5         kx case "$inclist" in
     5         kx "") inclist="sys/types.h";;
     5         kx esac;
     5         kx eval "varval=\$$var";
     5         kx case "$varval" in
     5         kx "")
     5         kx 	$rm -f temp.c;
     5         kx 	for inc in $inclist; do
     5         kx 		echo "#include <$inc>" >>temp.c;
     5         kx 	done;
     5         kx 	echo "#ifdef $type" >> temp.c;
     5         kx 	echo "printf(\"We have $type\");" >> temp.c;
     5         kx 	echo "#endif" >> temp.c;
     5         kx 	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
     5         kx 	echo " " ;
     5         kx 	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
     5         kx 	if $contains $type temp.E >/dev/null 2>&1; then
     5         kx 		echo "$type found." >&4;
     5         kx 		eval "$var=\$type";
     5         kx 	else
     5         kx 		echo "$type NOT found." >&4;
     5         kx 		dflt="$def";
     5         kx 		. ./myread ;
     5         kx 		eval "$var=\$ans";
     5         kx 	fi;
     5         kx 	$rm -f temp.?;;
     5         kx *) eval "$var=\$varval";;
     5         kx esac'
     5         kx 
     5         kx : see what type lseek is declared as in the kernel
     5         kx rp="What is the type used for lseek's offset on this system?"
     5         kx set off_t lseektype long stdio.h sys/types.h
     5         kx eval $typedef_ask
     5         kx 
     5         kx echo " "
     5         kx echo "Checking to see how big your file offsets are..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)sizeof($lseektype));
     5         kx     return(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	lseeksize=`$run ./try`
     5         kx 	echo "Your file offsets are $lseeksize bytes long."
     5         kx else
     5         kx 	dflt=$longsize
     5         kx 	echo " "
     5         kx 	echo "(I can't seem to compile the test program.  Guessing...)"
     5         kx 	rp="What is the size of your file offsets (in bytes)?"
     5         kx 	. ./myread
     5         kx 	lseeksize="$ans"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see what type file positions are declared as in the library
     5         kx rp="What is the type for file position used by fsetpos()?"
     5         kx set fpos_t fpostype long stdio.h sys/types.h
     5         kx eval $typedef_ask
     5         kx 
     5         kx : Check size for Fpos_t
     5         kx echo " "
     5         kx case "$fpostype" in
     5         kx *_t) zzz="$fpostype"	;;
     5         kx *)   zzz="fpos_t"	;;
     5         kx esac
     5         kx echo "Checking the size of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     printf("%d\n", (int)sizeof($fpostype));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	fpossize=4
     5         kx 		echo "(I can't execute the test program--guessing $fpossize.)" >&4
     5         kx 		;;
     5         kx 	*)	fpossize=$yyy
     5         kx 		echo "Your $zzz is $fpossize bytes long."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	dflt="$longsize"
     5         kx 	echo " " >&4
     5         kx 	echo "(I can't compile the test program.  Guessing...)" >&4
     5         kx 	rp="What is the size of your file positions (in bytes)?"
     5         kx 	. ./myread
     5         kx 	fpossize="$ans"
     5         kx fi
     5         kx 
     5         kx : Check for large file support
     5         kx # Backward compatibility (uselfs is deprecated).
     5         kx case "$uselfs" in
     5         kx "$define"|true|[yY]*)
     5         kx 	cat <<EOM >&4
     5         kx 
     5         kx *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
     5         kx EOM
     5         kx 	uselargefiles="$define"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$lseeksize:$fpossize" in
     5         kx 8:8) cat <<EOM
     5         kx 
     5         kx You can have files larger than 2 gigabytes.
     5         kx EOM
     5         kx    val="$define" ;;
     5         kx *)    case "$uselargefiles" in
     5         kx    "$undef"|false|[nN]*) dflt='n' ;;
     5         kx    *)	dflt='y' ;;
     5         kx    esac
     5         kx    cat <<EOM
     5         kx 
     5         kx Perl can be built to understand large files (files larger than 2 gigabytes)
     5         kx on some systems.  To do so, Configure can be run with -Duselargefiles.
     5         kx 
     5         kx If this doesn't make any sense to you, just accept the default '$dflt'.
     5         kx EOM
     5         kx    rp='Try to understand large files, if available?'
     5         kx    . ./myread
     5         kx    case "$ans" in
     5         kx    y|Y)	val="$define" ;;
     5         kx    *)	val="$undef"  ;;
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx set uselargefiles
     5         kx eval $setvar
     5         kx : Look for a hint-file generated 'call-back-unit'.  If the
     5         kx : user has specified that a large files perl is to be built,
     5         kx : we may need to set or change some other defaults.
     5         kx if $test -f uselargefiles.cbu; then
     5         kx 	echo "Your platform has some specific hints regarding large file builds, using them..."
     5         kx 	. ./uselargefiles.cbu
     5         kx fi
     5         kx case "$uselargefiles" in
     5         kx "$define")
     5         kx 	if $test -f uselargefiles.cbu; then
     5         kx 		echo " "
     5         kx 		echo "Rechecking to see how big your file offsets are..." >&4
     5         kx 		$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)sizeof($lseektype));
     5         kx     return(0);
     5         kx }
     5         kx EOCP
     5         kx 		set try
     5         kx 		if eval $compile_ok; then
     5         kx 			lseeksize=`$run ./try`
     5         kx 			$echo "Your file offsets are now $lseeksize bytes long."
     5         kx 		else
     5         kx 			dflt="$lseeksize"
     5         kx 			echo " "
     5         kx 			echo "(I can't seem to compile the test program.  Guessing...)"
     5         kx 			rp="What is the size of your file offsets (in bytes)?"
     5         kx 			. ./myread
     5         kx 			lseeksize="$ans"
     5         kx 		fi
     5         kx 		case "$fpostype" in
     5         kx 		*_t) zzz="$fpostype"	;;
     5         kx 		*)   zzz="fpos_t"	;;
     5         kx 		esac
     5         kx 		$echo $n "Rechecking the size of $zzz...$c" >&4
     5         kx 		$cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     printf("%d\n", (int)sizeof($fpostype));
     5         kx     return(0);
     5         kx }
     5         kx EOCP
     5         kx 		set try
     5         kx 		if eval $compile_ok; then
     5         kx 			yyy=`$run ./try`
     5         kx 			dflt="$lseeksize"
     5         kx 			case "$yyy" in
     5         kx 			'')	echo " "
     5         kx 				echo "(I can't execute the test program--guessing $fpossize.)" >&4
     5         kx 				;;
     5         kx 			*)	fpossize=$yyy
     5         kx 				echo " $fpossize bytes." >&4
     5         kx 				;;
     5         kx 			esac
     5         kx 		else
     5         kx 			dflt="$fpossize"
     5         kx 			echo " "
     5         kx 			echo "(I can't compile the test program.  Guessing...)" >&4
     5         kx 			rp="What is the size of your file positions (in bytes)?"
     5         kx 			. ./myread
     5         kx 			fpossize="$ans"
     5         kx 		fi
     5         kx 		$rm_try
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check if we want perlio
     5         kx useperlio="$define"
     5         kx 
     5         kx : Set the vendorbin variables
     5         kx case "$vendorprefix" in
     5         kx '')	d_vendorbin="$undef"
     5         kx 	vendorbin=''
     5         kx 	vendorbinexp=''
     5         kx 	;;
     5         kx *)	d_vendorbin="$define"
     5         kx 	: determine where vendor-supplied executables go.
     5         kx 	case "$vendorbin" in
     5         kx 	'') dflt=$vendorprefix/bin ;;
     5         kx 	*)	dflt="$vendorbin" ;;
     5         kx 	esac
     5         kx 	fn=d~+
     5         kx 	rp='Pathname for the vendor-supplied executables directory?'
     5         kx 	. ./getfile
     5         kx 	vendorbin="$ans"
     5         kx 	vendorbinexp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx prefixvar=vendorbin
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorhtml1dir variables
     5         kx case "$vendorprefix" in
     5         kx '')	vendorhtml1dir=''
     5         kx 	vendorhtml1direxp=''
     5         kx 	;;
     5         kx *)	: determine where vendor-supplied html pages go.
     5         kx 	: There is no standard location, so try to copy the previously-selected
     5         kx 	: directory structure for the core html pages.
     5         kx 	: XXX Better default suggestions would be welcome.
     5         kx 	case "$vendorhtml1dir" in
     5         kx 	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
     5         kx 	*)	dflt=$vendorhtml1dir ;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	''|' ') dflt=none ;;
     5         kx 	esac
     5         kx 	fn=dn+~
     5         kx 	rp='Pathname for the vendor-supplied html pages?'
     5         kx 	. ./getfile
     5         kx 	vendorhtml1dir="$ans"
     5         kx 	vendorhtml1direxp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
     5         kx prefixvar=vendorhtml1dir
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorhtml3dir variables
     5         kx case "$vendorprefix" in
     5         kx '')	vendorhtml3dir=''
     5         kx 	vendorhtml3direxp=''
     5         kx 	;;
     5         kx *)	: determine where vendor-supplied module html pages go.
     5         kx 	: There is no standard location, so try to copy the previously-selected
     5         kx 	: directory structure for the core html pages.
     5         kx 	: XXX Better default suggestions would be welcome.
     5         kx 	case "$vendorhtml3dir" in
     5         kx 	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
     5         kx 	*)	dflt=$vendorhtml3dir ;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	''|' ') dflt=none ;;
     5         kx 	esac
     5         kx 	fn=dn+~
     5         kx 	rp='Pathname for the vendor-supplied html pages?'
     5         kx 	. ./getfile
     5         kx 	vendorhtml3dir="$ans"
     5         kx 	vendorhtml3direxp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
     5         kx prefixvar=vendorhtml3dir
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorman1dir variables
     5         kx case "$vendorprefix" in
     5         kx '')	vendorman1dir=''
     5         kx 	vendorman1direxp=''
     5         kx 	;;
     5         kx *)	: determine where vendor-supplied manual pages go.
     5         kx 	case "$vendorman1dir" in
     5         kx 	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
     5         kx 	*)	dflt=$vendorman1dir ;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	''|' ') dflt=none ;;
     5         kx 	esac
     5         kx 	fn=nd~+
     5         kx 	rp='Pathname for the vendor-supplied manual section 1 pages?'
     5         kx 	. ./getfile
     5         kx 	vendorman1dir="$ans"
     5         kx 	vendorman1direxp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$vendorman1dir" = "X" && vendorman1dir=' '
     5         kx prefixvar=vendorman1dir
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorman3dir variables
     5         kx case "$vendorprefix" in
     5         kx '')	vendorman3dir=''
     5         kx 	vendorman3direxp=''
     5         kx 	;;
     5         kx *)	: determine where vendor-supplied module manual pages go.
     5         kx 	case "$vendorman3dir" in
     5         kx 	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
     5         kx 	*)	dflt=$vendorman3dir ;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	''|' ') dflt=none ;;
     5         kx 	esac
     5         kx 	fn=nd~+
     5         kx 	rp='Pathname for the vendor-supplied manual section 3 pages?'
     5         kx 	. ./getfile
     5         kx 	vendorman3dir="$ans"
     5         kx 	vendorman3direxp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx : Use ' ' for none so value is preserved next time through Configure
     5         kx $test X"$vendorman3dir" = "X" && vendorman3dir=' '
     5         kx prefixvar=vendorman3dir
     5         kx . ./installprefix
     5         kx 
     5         kx : Set the vendorscript variables
     5         kx case "$vendorprefix" in
     5         kx '')	d_vendorscript="$undef"
     5         kx 	vendorscript=''
     5         kx 	vendorscriptexp=''
     5         kx 	;;
     5         kx *)	d_vendorscript="$define"
     5         kx 	: determine where vendor-supplied scripts go.
     5         kx 	case "$vendorscript" in
     5         kx 	'')	dflt=$vendorprefix/script
     5         kx 		$test -d $dflt || dflt=$vendorbin ;;
     5         kx 	*)  dflt="$vendorscript" ;;
     5         kx 	esac
     5         kx 	$cat <<EOM
     5         kx 
     5         kx The installation process will create a directory for
     5         kx vendor-supplied scripts.
     5         kx 
     5         kx EOM
     5         kx 	fn=d~+
     5         kx 	rp='Pathname for the vendor-supplied scripts directory?'
     5         kx 	. ./getfile
     5         kx 	vendorscript="$ans"
     5         kx 	vendorscriptexp="$ansexp"
     5         kx 	;;
     5         kx esac
     5         kx prefixvar=vendorscript
     5         kx . ./installprefix
     5         kx 
     5         kx : see if qgcvt exists
     5         kx set qgcvt d_qgcvt
     5         kx eval $inlibc
     5         kx 
     5         kx : Check what kind of doubles your system has
     5         kx $echo "Checking the kind of doubles you have..." >&4
     5         kx $cat >try.c <<EOP
     5         kx #$i_stdlib I_STDLIB
     5         kx #define DOUBLESIZE $doublesize
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx static const double d = -0.1;
     5         kx int main() {
     5         kx   unsigned const char* b = (unsigned const char*)(&d);
     5         kx #if DOUBLESIZE == 4
     5         kx   if (b[0] == 0xCD && b[3] == 0xBD) {
     5         kx     /* IEEE 754 32-bit little-endian */
     5         kx     printf("1\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBD && b[3] == 0xCD) {
     5         kx     /* IEEE 754 32-bit big-endian */
     5         kx     printf("2\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xCC && b[3] == 0xCC) {
     5         kx     /* VAX format F, 32-bit PDP-style mixed endian. */
     5         kx     printf("9\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xC0 && b[3] == 0x9A) {
     5         kx     /* IBM single 32-bit */
     5         kx     printf("12\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx #if DOUBLESIZE == 8
     5         kx   if (b[0] == 0x9A && b[7] == 0xBF) {
     5         kx     /* IEEE 754 64-bit little-endian */
     5         kx     printf("3\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[7] == 0x9A) {
     5         kx     /* IEEE 754 64-bit big-endian */
     5         kx     printf("4\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
     5         kx    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
     5         kx     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
     5         kx     * 99 99 b9 bf 9a 99 99 99 */
     5         kx     printf("7\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
     5         kx    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
     5         kx     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
     5         kx     * 99 99 99 9a bf b9 99 99 */
     5         kx     printf("8\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xCC && b[7] == 0xCC) {
     5         kx    /* VAX format D, 64-bit PDP-style mixed endian. */
     5         kx     printf("10\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xD9 && b[7] == 0x99) {
     5         kx    /* VAX format G, 64-bit PDP-style mixed endian. */
     5         kx     printf("11\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xC0 && b[7] == 0x9A) {
     5         kx     /* IBM double 64-bit */
     5         kx     printf("13\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[7] == 0xCD) {
     5         kx     /* CRAY single 64-bit */
     5         kx     printf("14\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx #if DOUBLESIZE == 16
     5         kx   if (b[0] == 0x9A && b[15] == 0xBF) {
     5         kx     /* IEEE 754 128-bit little-endian */
     5         kx     printf("5\n");
     5         kx     exit(0);
     5         kx   }
     5         kx   if (b[0] == 0xBF && b[15] == 0x9A) {
     5         kx     /* IEEE 754 128-bit big-endian */
     5         kx     printf("6\n");
     5         kx     exit(0);
     5         kx   }
     5         kx #endif
     5         kx   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
     5         kx    * Whether those environments can still build Perl is debatable. */
     5         kx   printf("-1\n"); /* unknown */
     5         kx   exit(0);
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     doublekind=`$run ./try`
     5         kx else
     5         kx     doublekind=-1
     5         kx fi
     5         kx case "$doublekind" in
     5         kx 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
     5         kx 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
     5         kx 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
     5         kx 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
     5         kx 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
     5         kx 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
     5         kx 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
     5         kx 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
     5         kx 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
     5         kx 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
     5         kx 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
     5         kx 12) echo "You have IBM short 32-bit doubles." >&4 ;;
     5         kx 13) echo "You have IBM long 64-bit doubles." >&4 ;;
     5         kx 14) echo "You have Cray single 64-bit doubles." >&4 ;;
     5         kx *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
     5         kx esac
     5         kx d_double_style_ieee=$undef
     5         kx d_double_style_vax=$undef
     5         kx d_double_style_ibm=$undef
     5         kx d_double_style_cray=$undef
     5         kx case "$doublekind" in
     5         kx 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
     5         kx 9|10|11) d_double_style_vax=$define ;;
     5         kx 12|13) d_double_style_ibm=$define ;;
     5         kx 14) d_double_style_cray=$define ;;
     5         kx esac
     5         kx case "$d_double_style_ieee" in
     5         kx $define)
     5         kx     d_double_has_inf=$define
     5         kx     d_double_has_nan=$define
     5         kx     d_double_has_negative_zero=$define
     5         kx     d_double_has_subnormals=$define
     5         kx     ;;
     5         kx *)
     5         kx     d_double_has_inf=$undef
     5         kx     d_double_has_nan=$undef
     5         kx     d_double_has_negative_zero=$undef
     5         kx     d_double_has_subnormals=$undef
     5         kx     ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : Check print/scan long double stuff
     5         kx echo " "
     5         kx 
     5         kx if $test X"$d_longdbl" = X"$define"; then
     5         kx 
     5         kx echo "Checking how to print long doubles..." >&4
     5         kx 
     5         kx if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   double d = 123.456;
     5         kx   printf("%.3f\n", d);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		123.456)
     5         kx 			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
     5         kx 			sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
     5         kx 			echo "We will use %f."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRIfldbl" = X; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   long double d = 123.456;
     5         kx   printf("%.3Lf\n", d);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		123.456)
     5         kx 			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
     5         kx 			sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
     5         kx 			echo "We will use %Lf."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRIfldbl" = X; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   long double d = 123.456;
     5         kx   printf("%.3llf\n", d);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		123.456)
     5         kx 			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
     5         kx 			sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
     5         kx 			echo "We will use %llf."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRIfldbl" = X; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   long double d = 123.456;
     5         kx   printf("%.3lf\n", d);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		123.456)
     5         kx 			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
     5         kx 			sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
     5         kx 			echo "We will use %lf."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRIfldbl" = X; then
     5         kx 	echo "Cannot figure out how to print long doubles." >&4
     5         kx else
     5         kx 	sSCNfldbl=$sPRIfldbl	# expect consistency
     5         kx fi
     5         kx 
     5         kx $rm_try
     5         kx 
     5         kx fi # d_longdbl
     5         kx 
     5         kx case "$sPRIfldbl" in
     5         kx '')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
     5         kx 	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
     5         kx 	d_SCNfldbl="$undef";
     5         kx 	;;
     5         kx *)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
     5         kx 	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
     5         kx 	d_SCNfldbl="$define";
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Before committing on uselongdouble, see whether that looks sane.
     5         kx if $test "$uselongdouble" = "$define"; then
     5         kx     message=""
     5         kx     echo " "
     5         kx     echo "Checking if your long double math functions work right..." >&4
     5         kx     $cat > try.c <<EOF
     5         kx #include <math.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
     5         kx }
     5         kx EOF
     5         kx     case "$osname:$gccversion" in
     5         kx     aix:)	saveccflags="$ccflags"
     5         kx 		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
     5         kx     esac
     5         kx     set try
     5         kx     if eval $compile_ok; then
     5         kx       yyy=`$run ./try`
     5         kx     fi
     5         kx     case "$yyy" in
     5         kx     3) echo "Your long double math functions are working correctly." >&4 ;;
     5         kx     *) echo "Your long double math functions are broken, not using long doubles." >&4
     5         kx        uselongdouble=$undef
     5         kx        ;;
     5         kx     esac
     5         kx     $rm_try
     5         kx     case "$osname:$gccversion" in
     5         kx     aix:)	ccflags="$saveccflags" ;; # restore
     5         kx     esac
     5         kx fi
     5         kx 
     5         kx : Check how to convert floats to strings.
     5         kx 
     5         kx if test "X$d_Gconvert" = X; then
     5         kx 
     5         kx echo " "
     5         kx echo "Checking for an efficient way to convert floats to strings."
     5         kx echo " " > try.c
     5         kx case "$uselongdouble" in
     5         kx "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
     5         kx esac
     5         kx case "$d_longdbl" in
     5         kx "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
     5         kx esac
     5         kx case "$d_PRIgldbl" in
     5         kx "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
     5         kx esac
     5         kx $cat >>try.c <<EOP
     5         kx #ifdef TRY_gconvert
     5         kx #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
     5         kx const char *myname = "gconvert";
     5         kx #endif
     5         kx #ifdef TRY_gcvt
     5         kx #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
     5         kx const char *myname = "gcvt";
     5         kx #endif
     5         kx #ifdef TRY_qgcvt
     5         kx #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
     5         kx const char *myname = "qgcvt";
     5         kx #define DOUBLETYPE long double
     5         kx #endif
     5         kx #ifdef TRY_sprintf
     5         kx #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
     5         kx #ifdef HAS_PRIgldbl
     5         kx #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
     5         kx #else
     5         kx #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
     5         kx #endif
     5         kx #else
     5         kx #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
     5         kx #endif
     5         kx const char *myname = "sprintf";
     5         kx #endif
     5         kx 
     5         kx #ifndef DOUBLETYPE
     5         kx #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
     5         kx #define DOUBLETYPE long double
     5         kx #else
     5         kx #define DOUBLETYPE double
     5         kx #endif
     5         kx #endif
     5         kx 
     5         kx #include <stdio.h>
     5         kx 
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <string.h>
     5         kx 
     5         kx void checkit(const char *expect, char *got)
     5         kx {
     5         kx     if (strcmp(expect, got)) {
     5         kx 		printf("%s oddity:  Expected %s, got %s\n",
     5         kx 			myname, expect, got);
     5         kx 		exit(1);
     5         kx 	}
     5         kx }
     5         kx 
     5         kx void lencheck(int expect, int got)
     5         kx {
     5         kx     if (expect != got) {
     5         kx 		printf("%s length mismatch:  Expected %d, got %d\n",
     5         kx 			myname, expect, got);
     5         kx 		exit(1);
     5         kx 	}
     5         kx }
     5         kx 
     5         kx int main()
     5         kx {
     5         kx 	char buf[64];
     5         kx 	buf[63] = '\0';
     5         kx 
     5         kx 	/* This must be 1st test on (which?) platform */
     5         kx 	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
     5         kx 	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
     5         kx 	checkit("0.1", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
     5         kx 	checkit("0.01", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
     5         kx 	checkit("0.001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
     5         kx 	checkit("0.0001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
     5         kx 	if (strlen(buf) > 5)
     5         kx 	    checkit("9e-005", buf); /* for Microsoft ?? */
     5         kx 	else
     5         kx 	    checkit("9e-05", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
     5         kx 	checkit("1", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
     5         kx 	checkit("1.1", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
     5         kx 	checkit("1.01", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
     5         kx 	checkit("1.001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
     5         kx 	checkit("1.0001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
     5         kx 	checkit("1.00001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
     5         kx 	checkit("1.000001", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
     5         kx 	checkit("0", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
     5         kx 	checkit("-1", buf);
     5         kx 
     5         kx 	/* Some Linux gcvt's give 1.e+5 here. */
     5         kx 	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
     5         kx 	checkit("100000", buf);
     5         kx 
     5         kx 	/* Some Linux gcvt's give -1.e+5 here. */
     5         kx 	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
     5         kx 	checkit("-100000", buf);
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
     5         kx 	checkit("123.456", buf);
     5         kx 
     5         kx 	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
     5         kx 	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
     5         kx 	/* 34 should be enough to scare even long double
     5         kx 	 * places into using the e notation. */
     5         kx 	if (strlen(buf) > 5)
     5         kx 	    checkit("1e+034", buf); /* for Microsoft */
     5         kx 	else
     5         kx 	    checkit("1e+34", buf);
     5         kx 
     5         kx 	/* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
     5         kx 	 * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
     5         kx 
     5         kx 	Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
     5         kx 	lencheck(55, (int)strlen(buf));
     5         kx 
     5         kx 	/* For Perl, if you add additional tests here, also add them to
     5         kx 	 * t/base/num.t for benefit of platforms not using Configure or
     5         kx 	 * overriding d_Gconvert */
     5         kx 
     5         kx 	exit(0);
     5         kx }
     5         kx EOP
     5         kx : first add preferred functions to our list
     5         kx xxx_list=""
     5         kx for xxx_convert in $gconvert_preference; do
     5         kx     case $xxx_convert in
     5         kx     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
     5         kx     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
     5         kx     esac
     5         kx done
     5         kx : then add any others
     5         kx for xxx_convert in gconvert gcvt sprintf; do
     5         kx     case "$xxx_list" in
     5         kx     *$xxx_convert*) ;;
     5         kx     *) xxx_list="$xxx_list $xxx_convert" ;;
     5         kx     esac
     5         kx done
     5         kx 
     5         kx case "$d_longdbl$uselongdouble" in
     5         kx "$define$define")
     5         kx     : again, add preferred functions to our list first
     5         kx     xxx_ld_list=""
     5         kx     for xxx_convert in $gconvert_ld_preference; do
     5         kx         case $xxx_convert in
     5         kx         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
     5         kx         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
     5         kx         esac
     5         kx     done
     5         kx     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
     5         kx     for xxx_convert in qgcvt sprintf $xxx_list; do
     5         kx         case "$xxx_ld_list" in
     5         kx         $xxx_convert*|*" $xxx_convert"*) ;;
     5         kx         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
     5         kx         esac
     5         kx     done
     5         kx     : if sprintf cannot do long doubles, move it to the end
     5         kx     if test "$d_PRIgldbl" != "$define"; then
     5         kx         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
     5         kx     fi
     5         kx     : if no qgcvt, remove it
     5         kx     if test "$d_qgcvt" != "$define"; then
     5         kx         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
     5         kx     fi
     5         kx     : use the ld_list
     5         kx     xxx_list="$xxx_ld_list"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx for xxx_convert in $xxx_list; do
     5         kx 	echo "Trying $xxx_convert..."
     5         kx 	$rm -f try try$_o core
     5         kx 	set try -DTRY_$xxx_convert
     5         kx 	if eval $compile; then
     5         kx 		echo "$xxx_convert() found." >&4
     5         kx 		if $run ./try; then
     5         kx 			echo "I'll use $xxx_convert to convert floats into a string." >&4
     5         kx 			break;
     5         kx 		else
     5         kx 			echo "...But $xxx_convert didn't work as I expected."
     5         kx 			xxx_convert=''
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "$xxx_convert NOT found." >&4
     5         kx 		xxx_convert=''
     5         kx 	fi
     5         kx done
     5         kx 
     5         kx if test X$xxx_convert = X; then
     5         kx     echo "*** WHOA THERE!!! ***" >&4
     5         kx     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
     5         kx     xxx_convert=sprintf
     5         kx fi
     5         kx 
     5         kx case "$xxx_convert" in
     5         kx gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
     5         kx gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
     5         kx qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
     5         kx *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
     5         kx    "$define$define$define")
     5         kx       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
     5         kx    "$define$define$undef")
     5         kx       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
     5         kx    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
     5         kx    esac
     5         kx    ;;
     5         kx esac
     5         kx 
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see if _fwalk exists
     5         kx set fwalk d__fwalk
     5         kx eval $inlibc
     5         kx 
     5         kx : see if accept4 exists
     5         kx set accept4 d_accept4
     5         kx eval $inlibc
     5         kx 
     5         kx : Initialize h_fcntl
     5         kx h_fcntl=false
     5         kx 
     5         kx : Initialize h_sysfile
     5         kx h_sysfile=false
     5         kx 
     5         kx : access call always available on UNIX
     5         kx set access d_access
     5         kx eval $inlibc
     5         kx 
     5         kx : locate the flags for 'access()'
     5         kx case "$d_access" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	$cat >access.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #ifdef I_FCNTL
     5         kx #include <fcntl.h>
     5         kx #endif
     5         kx #ifdef I_SYS_FILE
     5         kx #include <sys/file.h>
     5         kx #endif
     5         kx #ifdef I_UNISTD
     5         kx #include <unistd.h>
     5         kx #endif
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx 	exit(R_OK);
     5         kx }
     5         kx EOCP
     5         kx 	: check sys/file.h first, no particular reason here
     5         kx 	if $test `./findhdr sys/file.h` && \
     5         kx 		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
     5         kx 		h_sysfile=true;
     5         kx 		echo "<sys/file.h> defines the *_OK access constants." >&4
     5         kx 	elif $test `./findhdr fcntl.h` && \
     5         kx 		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
     5         kx 		h_fcntl=true;
     5         kx 		echo "<fcntl.h> defines the *_OK access constants." >&4
     5         kx 	elif $test `./findhdr unistd.h` && \
     5         kx 		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
     5         kx 		echo "<unistd.h> defines the *_OK access constants." >&4
     5         kx 	else
     5         kx 		echo "I can't find the four *_OK access constants--I'll use mine." >&4
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx $rm -f access*
     5         kx 
     5         kx : see if accessx exists
     5         kx set accessx d_accessx
     5         kx eval $inlibc
     5         kx 
     5         kx : see if acosh exists
     5         kx set acosh d_acosh
     5         kx eval $inlibc
     5         kx 
     5         kx : see if aintl exists
     5         kx set aintl d_aintl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if alarm exists
     5         kx set alarm d_alarm
     5         kx eval $inlibc
     5         kx 
     5         kx : see if 64bit time functions exists
     5         kx 
     5         kx set ctime64 d_ctime64
     5         kx eval $inlibc
     5         kx 
     5         kx set localtime64 d_localtime64
     5         kx eval $inlibc
     5         kx 
     5         kx set gmtime64 d_gmtime64
     5         kx eval $inlibc
     5         kx 
     5         kx set mktime64 d_mktime64
     5         kx eval $inlibc
     5         kx 
     5         kx set difftime64 d_difftime64
     5         kx eval $inlibc
     5         kx 
     5         kx set asctime64 d_asctime64
     5         kx eval $inlibc
     5         kx 
     5         kx : see if POSIX threads are available
     5         kx set pthread.h i_pthread
     5         kx eval $inhdr
     5         kx 
     5         kx : define a function to check prototypes
     5         kx $cat > protochk <<EOSH
     5         kx $startsh
     5         kx cc="$cc"
     5         kx optimize="$optimize"
     5         kx ccflags="$ccflags"
     5         kx define="$define"
     5         kx rm_try="$rm_try"
     5         kx usethreads=$usethreads
     5         kx i_pthread=$i_pthread
     5         kx pthread_h_first=$pthread_h_first
     5         kx EOSH
     5         kx 
     5         kx $cat >> protochk <<'EOSH'
     5         kx 
     5         kx $rm_try
     5         kx foo="$1"
     5         kx shift
     5         kx while test $# -ge 2; do
     5         kx 	case "$1" in
     5         kx 		$define) echo "#include <$2>" >> try.c ;;
     5         kx 		literal) echo "$2" >> try.c ;;
     5         kx 	esac
     5         kx     # Extra magic for the benefit of systems that need pthread.h
     5         kx     # to be included early to correctly detect threadsafe functions.
     5         kx     # Such functions must guarantee themselves, though, that the usethreads
     5         kx     # and i_pthread have been defined, before calling protochk.
     5         kx     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
     5         kx 	echo "#include <pthread.h>" >> try.c
     5         kx 	pthread_h_done=yes
     5         kx     fi
     5         kx     shift 2
     5         kx done
     5         kx cat >> try.c <<'EOCP'
     5         kx #define	_(args) args
     5         kx EOCP
     5         kx echo "$foo" >> try.c
     5         kx echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
     5         kx $cc $optimize $ccflags -c try.c > /dev/null 2>&1
     5         kx status=$?
     5         kx $rm_try
     5         kx exit $status
     5         kx EOSH
     5         kx chmod +x protochk
     5         kx $eunicefix protochk
     5         kx 
     5         kx : Define hasproto macro for Configure internal use
     5         kx hasproto='varname=$1; func=$2; shift; shift;
     5         kx while $test $# -ge 2; do
     5         kx 	case "$1" in
     5         kx 	$define) echo "#include <$2>";;
     5         kx 	literal) echo "$2" ;;
     5         kx 	esac ;
     5         kx     shift 2;
     5         kx done > try.c;
     5         kx $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
     5         kx if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
     5         kx 	echo "$func() prototype found.";
     5         kx 	val="$define";
     5         kx else
     5         kx 	echo "$func() prototype NOT found.";
     5         kx 	val="$undef";
     5         kx fi;
     5         kx set $varname;
     5         kx eval $setvar;
     5         kx $rm_try tryout.c'
     5         kx 
     5         kx : see if sys/types.h has to be included
     5         kx set sys/types.h i_systypes
     5         kx eval $inhdr
     5         kx 
     5         kx : see if sys/select.h has to be included
     5         kx set sys/select.h i_sysselct
     5         kx eval $inhdr
     5         kx 
     5         kx : Define hasfield macro for Configure internal use
     5         kx hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
     5         kx while $test $# -ge 2; do
     5         kx 	case "$1" in
     5         kx 	$define) echo "#include <$2>";;
     5         kx 	esac ;
     5         kx     shift 2;
     5         kx done > try.c;
     5         kx echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
     5         kx set try;
     5         kx if eval $compile; then
     5         kx 	val="$define";
     5         kx else
     5         kx 	val="$undef";
     5         kx fi;
     5         kx set $varname;
     5         kx eval $setvar;
     5         kx $rm_try'
     5         kx 
     5         kx : see if we should include sys/time.h
     5         kx echo " "
     5         kx i_time='define'
     5         kx if test "X$timeincl" = X; then
     5         kx 	echo "Testing to see if we should include <sys/time.h>." >&4
     5         kx 	$echo $n "I'm now running the test program...$c"
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <time.h>
     5         kx #ifdef I_SYSTIME
     5         kx #ifdef SYSTIMEKERNEL
     5         kx #define KERNEL
     5         kx #endif
     5         kx #include <sys/time.h>
     5         kx #endif
     5         kx #ifdef I_SYSSELECT
     5         kx #include <sys/select.h>
     5         kx #endif
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx 	struct tm foo;
     5         kx #ifdef S_TIMEVAL
     5         kx 	struct timeval bar;
     5         kx #endif
     5         kx #ifdef S_TIMEZONE
     5         kx 	struct timezone tzp;
     5         kx #endif
     5         kx 	if (foo.tm_sec == foo.tm_sec)
     5         kx 		exit(0);
     5         kx #ifdef S_TIMEVAL
     5         kx 	if (bar.tv_sec == bar.tv_sec)
     5         kx 		exit(0);
     5         kx #endif
     5         kx 	exit(1);
     5         kx }
     5         kx EOCP
     5         kx 	flags=''
     5         kx 	for s_timezone in '-DS_TIMEZONE' ''; do
     5         kx 	sysselect=''
     5         kx 	for s_timeval in '-DS_TIMEVAL' ''; do
     5         kx 	for i_systimek in '' '-DSYSTIMEKERNEL'; do
     5         kx 	for i_systime in '-DI_SYSTIME' ''; do
     5         kx 		case "$flags" in
     5         kx 		'') $echo $n ".$c"
     5         kx 			set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
     5         kx 			if eval $compile; then
     5         kx 				set X $i_systime $i_systimek $sysselect $s_timeval
     5         kx 				shift
     5         kx 				flags="$*"
     5         kx 				echo " "
     5         kx 				$echo $n "Succeeded with $flags$c"
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 	done
     5         kx 	done
     5         kx 	done
     5         kx 	done
     5         kx 	timeincl=''
     5         kx 	echo " "
     5         kx 	case "$flags" in
     5         kx 	*SYSTIMEKERNEL*) i_systimek="$define"
     5         kx 		timeincl=`./findhdr sys/time.h`
     5         kx 		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
     5         kx 	*) i_systimek="$undef";;
     5         kx 	esac
     5         kx 	case "$flags" in
     5         kx 	*I_SYSTIME*) i_systime="$define"
     5         kx 		timeincl=`./findhdr sys/time.h`" $timeincl"
     5         kx 		echo "We'll include <sys/time.h>." >&4;;
     5         kx 	*) i_systime="$undef";;
     5         kx 	esac
     5         kx 	$rm_try
     5         kx fi
     5         kx : see if struct tm knows about tm_zone
     5         kx case "$i_systime$i_time" in
     5         kx *$define*)
     5         kx         echo " "
     5         kx         echo "Checking to see if your struct tm has tm_zone field..." >&4
     5         kx         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
     5         kx         eval $hasfield
     5         kx         ;;
     5         kx *)      val="$undef"
     5         kx         set d_tm_tm_zone
     5         kx         eval $setvar
     5         kx         ;;
     5         kx esac
     5         kx case "$d_tm_tm_zone" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx : see if struct tm knows about tm_gmtoff
     5         kx case "$i_systime$i_time" in
     5         kx *$define*)
     5         kx         echo " "
     5         kx         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
     5         kx         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
     5         kx         eval $hasfield
     5         kx         ;;
     5         kx *)      val="$undef"
     5         kx         set d_tm_tm_gmtoff
     5         kx         eval $setvar
     5         kx         ;;
     5         kx esac
     5         kx case "$d_tm_tm_gmtoff" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see if asctime_r exists
     5         kx set asctime_r d_asctime_r
     5         kx eval $inlibc
     5         kx case "$d_asctime_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
     5         kx 	case "$d_asctime_r_proto:$usethreads" in
     5         kx 	":define")	d_asctime_r_proto=define
     5         kx 		set d_asctime_r_proto asctime_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_asctime_r_proto" in
     5         kx 	define)
     5         kx 	case "$asctime_r_proto" in
     5         kx 	''|0) try='char* asctime_r(const struct tm*, char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
     5         kx 	esac
     5         kx 	case "$asctime_r_proto" in
     5         kx 	''|0) try='char* asctime_r(const struct tm*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
     5         kx 	esac
     5         kx 	case "$asctime_r_proto" in
     5         kx 	''|0) try='int asctime_r(const struct tm*, char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
     5         kx 	esac
     5         kx 	case "$asctime_r_proto" in
     5         kx 	''|0) try='int asctime_r(const struct tm*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$asctime_r_proto" in
     5         kx 	''|0)	d_asctime_r=undef
     5         kx 		asctime_r_proto=0
     5         kx 		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$asctime_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "asctime_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_asctime_r=undef
     5         kx 		asctime_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	asctime_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if asinh exists
     5         kx set asinh d_asinh
     5         kx eval $inlibc
     5         kx 
     5         kx : see if atanh exists
     5         kx set atanh d_atanh
     5         kx eval $inlibc
     5         kx 
     5         kx : see if atolf exists
     5         kx set atolf d_atolf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if atoll exists
     5         kx set atoll d_atoll
     5         kx eval $inlibc
     5         kx 
     5         kx : See if a file contains compiler warnings
     5         kx : See if a file contains compiler warnings
     5         kx case "$osname" in
     5         kx   'aix')
     5         kx 	cat >compiler_warning <<EOSS
     5         kx # Sample for aix ('.5' indicates the column number in the line):
     5         kx #    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
     5         kx # Since the word 'warning' isn't present, use a fairly rigorous match of what
     5         kx # warning messages look like
     5         kx #            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
     5         kx $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"
     5         kx EOSS
     5         kx         compiler_warning=./compiler_warning
     5         kx         chmod +x $compiler_warning
     5         kx     ;;
     5         kx      # Maybe a colon after the 'warning' would be appropriate
     5         kx   *) compiler_warning="$contains -i warning"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Look for GCC-style attribute format
     5         kx case "$d_attribute_format" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((format))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((format))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_format" ;;
     5         kx esac
     5         kx set d_attribute_format
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute format with null format allowed
     5         kx case "$d_printf_format_null" in
     5         kx '') case "$d_attribute_format" in
     5         kx     $define)
     5         kx 	echo " "
     5         kx 	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
     5         kx $cat >attrib.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_inttypes I_INTTYPES
     5         kx #ifdef I_INTTYPES
     5         kx #include <inttypes.h>
     5         kx #endif
     5         kx #ifndef INTPTR_MAX
     5         kx #define intptr_t int
     5         kx #endif
     5         kx int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
     5         kx int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
     5         kx int main () { exit(null_printf(NULL)); }
     5         kx EOCP
     5         kx 	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
     5         kx 	    : run the executable in case it produces a run-time warning
     5         kx 	    if $run ./attrib >>attrib.out 2>&1; then
     5         kx 		if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		    echo "Your C compiler doesn't allow __printf__ format to be null."
     5         kx 		    val="$undef"
     5         kx 		else
     5         kx 		    echo "Your C compiler allows __printf__ format to be null."
     5         kx 		    val="$define"
     5         kx 		fi
     5         kx 	    else
     5         kx 	    echo "Your C compiler executable failed with __printf__ format null."
     5         kx 	    val="$undef"
     5         kx 	fi
     5         kx     else
     5         kx 	echo "Your C compiler fails with __printf__ format null."
     5         kx 	val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx     *)  val="$undef" ;;
     5         kx     esac
     5         kx ;;
     5         kx *)  val="$d_printf_format_null" ;;
     5         kx esac
     5         kx set d_printf_format_null
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute malloc
     5         kx case "$d_attribute_malloc" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((malloc))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((malloc))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_malloc" ;;
     5         kx esac
     5         kx set d_attribute_malloc
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute nonnull
     5         kx case "$d_attribute_nonnull" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((nonnull))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((nonnull))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_nonnull" ;;
     5         kx esac
     5         kx set d_attribute_nonnull
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute noreturn
     5         kx case "$d_attribute_noreturn" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx void fall_over_dead( void ) __attribute__((noreturn));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((noreturn))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((noreturn))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_noreturn" ;;
     5         kx esac
     5         kx set d_attribute_noreturn
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute pure
     5         kx case "$d_attribute_pure" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int square( int n ) __attribute__((pure));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((pure))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((pure))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_pure" ;;
     5         kx esac
     5         kx set d_attribute_pure
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute unused
     5         kx case "$d_attribute_unused" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int do_something( int dummy __attribute__((unused)), int n );
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((unused))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((unused))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_unused" ;;
     5         kx esac
     5         kx set d_attribute_unused
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute deprecated
     5         kx case "$d_attribute_deprecated" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int I_am_deprecated(void) __attribute__((deprecated));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((deprecated))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((deprecated))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_deprecated" ;;
     5         kx esac
     5         kx set d_attribute_deprecated
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute warn_unused_result
     5         kx case "$d_attribute_warn_unused_result" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((warn_unused_result))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_warn_unused_result" ;;
     5         kx esac
     5         kx set d_attribute_warn_unused_result
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : Look for GCC-style attribute always_inline
     5         kx case "$d_attribute_always_inline" in
     5         kx '')
     5         kx echo " "
     5         kx echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
     5         kx $cat >attrib.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
     5         kx EOCP
     5         kx if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
     5         kx 	if $compiler_warning attrib.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support __attribute__((always_inline))."
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports __attribute__((always_inline))."
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand __attribute__ at all."
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_attribute_always_inline" ;;
     5         kx esac
     5         kx set d_attribute_always_inline
     5         kx eval $setvar
     5         kx $rm -f attrib*
     5         kx 
     5         kx : see if getpgrp exists
     5         kx set getpgrp d_getpgrp
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_getpgrp" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	echo "Checking to see which flavor of getpgrp is in use..."
     5         kx 	$cat >try.c <<EOP
     5         kx #include <stdio.h>
     5         kx #$i_unistd I_UNISTD
     5         kx #include <sys/types.h>
     5         kx #ifdef I_UNISTD
     5         kx #  include <unistd.h>
     5         kx #endif
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx 	if (getuid() == 0) {
     5         kx 		printf("(I see you are running Configure as super-user...)\n");
     5         kx 		setuid(1);
     5         kx 	}
     5         kx #ifdef TRY_BSD_PGRP
     5         kx 	if (getpgrp(1) == 0)
     5         kx 		exit(0);
     5         kx #else
     5         kx 	if (getpgrp() > 0)
     5         kx 		exit(0);
     5         kx #endif
     5         kx 	exit(1);
     5         kx }
     5         kx EOP
     5         kx 	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
     5         kx 		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
     5         kx 		val="$define"
     5         kx 	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
     5         kx 		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "I can't seem to compile and run the test program."
     5         kx 		if ./usg; then
     5         kx 			xxx="a USG one, i.e. you use getpgrp()."
     5         kx 		else
     5         kx 			# SVR4 systems can appear rather BSD-ish.
     5         kx 			case "$i_unistd" in
     5         kx 			$undef)
     5         kx 				xxx="a BSD one, i.e. you use getpgrp(pid)."
     5         kx 				val="$define"
     5         kx 				;;
     5         kx 			$define)
     5         kx 				xxx="probably a USG one, i.e. you use getpgrp()."
     5         kx 				val="$undef"
     5         kx 				;;
     5         kx 			esac
     5         kx 		fi
     5         kx 		echo "Assuming your getpgrp is $xxx" >&4
     5         kx 	fi
     5         kx 	;;
     5         kx *) val="$undef";;
     5         kx esac
     5         kx set d_bsdgetpgrp
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if setpgrp exists
     5         kx set setpgrp d_setpgrp
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_setpgrp" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	echo "Checking to see which flavor of setpgrp is in use..."
     5         kx 	$cat >try.c <<EOP
     5         kx #include <stdio.h>
     5         kx #$i_unistd I_UNISTD
     5         kx #include <sys/types.h>
     5         kx #ifdef I_UNISTD
     5         kx #  include <unistd.h>
     5         kx #endif
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx 	if (getuid() == 0) {
     5         kx 		printf("(I see you are running Configure as super-user...)\n");
     5         kx 		setuid(1);
     5         kx 	}
     5         kx #ifdef TRY_BSD_PGRP
     5         kx 	if (-1 == setpgrp(1, 1))
     5         kx 		exit(0);
     5         kx #else
     5         kx 	if (setpgrp() != -1)
     5         kx 		exit(0);
     5         kx #endif
     5         kx 	exit(1);
     5         kx }
     5         kx EOP
     5         kx 	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
     5         kx 		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
     5         kx 		val="$define"
     5         kx 	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
     5         kx 		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "(I can't seem to compile and run the test program.)"
     5         kx 		if ./usg; then
     5         kx 			xxx="a USG one, i.e. you use setpgrp()."
     5         kx 		else
     5         kx 			# SVR4 systems can appear rather BSD-ish.
     5         kx 			case "$i_unistd" in
     5         kx 			$undef)
     5         kx 				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
     5         kx 				val="$define"
     5         kx 				;;
     5         kx 			$define)
     5         kx 				xxx="probably a USG one, i.e. you use setpgrp()."
     5         kx 				val="$undef"
     5         kx 				;;
     5         kx 			esac
     5         kx 		fi
     5         kx 		echo "Assuming your setpgrp is $xxx" >&4
     5         kx 	fi
     5         kx 	;;
     5         kx *) val="$undef";;
     5         kx esac
     5         kx set d_bsdsetpgrp
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for GCC-style __builtin_add_overflow
     5         kx case "$d_builtin_add_overflow" in
     5         kx '')
     5         kx     echo " "
     5         kx     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
     5         kx     $cat >try.c <<'EOCP'
     5         kx int main(void) {
     5         kx     const unsigned int uint_max = ~0u;
     5         kx     int target_int = 0;
     5         kx     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile && $run ./try; then
     5         kx         echo "Your C compiler supports __builtin_add_overflow."
     5         kx         val="$define"
     5         kx     else
     5         kx         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
     5         kx         val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx *) val="$d_builtin_add_overflow" ;;
     5         kx esac
     5         kx 
     5         kx set d_builtin_add_overflow
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for GCC-style __builtin_sub_overflow
     5         kx case "$d_builtin_sub_overflow" in
     5         kx '')
     5         kx     echo " "
     5         kx     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
     5         kx     $cat >try.c <<'EOCP'
     5         kx int main(void) {
     5         kx     const unsigned int uint_max = ~0u;
     5         kx     int target_int = 0;
     5         kx     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile && $run ./try; then
     5         kx         echo "Your C compiler supports __builtin_sub_overflow."
     5         kx         val="$define"
     5         kx     else
     5         kx         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
     5         kx         val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx *) val="$d_builtin_sub_overflow" ;;
     5         kx esac
     5         kx 
     5         kx set d_builtin_sub_overflow
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for GCC-style __builtin_mul_overflow
     5         kx case "$d_builtin_mul_overflow" in
     5         kx '')
     5         kx     echo " "
     5         kx     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
     5         kx     $cat >try.c <<'EOCP'
     5         kx int main(void) {
     5         kx     const unsigned int uint_max = ~0u;
     5         kx     int target_int = 0;
     5         kx     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
     5         kx         return 1;
     5         kx     }
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile && $run ./try; then
     5         kx         echo "Your C compiler supports __builtin_mul_overflow."
     5         kx         val="$define"
     5         kx     else
     5         kx         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
     5         kx         val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx *) val="$d_builtin_mul_overflow" ;;
     5         kx esac
     5         kx 
     5         kx set d_builtin_mul_overflow
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for GCC-style __builtin_choose_expr
     5         kx case "$d_builtin_choose_expr" in
     5         kx '')
     5         kx     echo " "
     5         kx     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
     5         kx     $cat >try.c <<'EOCP'
     5         kx #include <assert.h>
     5         kx #include <stdlib.h>
     5         kx #include <stdio.h>
     5         kx 
     5         kx #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
     5         kx 
     5         kx int main(void) {
     5         kx     assert( SYRINX(1) == 2112 );
     5         kx     assert( SYRINX(1) != 5150 );
     5         kx     assert( SYRINX(0) == 5150 );
     5         kx     assert( SYRINX(0) != 2112 );
     5         kx     puts( "All good!" );
     5         kx     exit(0);
     5         kx }
     5         kx 
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile && $run ./try; then
     5         kx 	echo "Your C compiler supports __builtin_choose_expr."
     5         kx 	val="$define"
     5         kx     else
     5         kx 	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
     5         kx 	val="$undef"
     5         kx     fi
     5         kx ;;
     5         kx *) val="$d_builtin_choose_expr" ;;
     5         kx esac
     5         kx 
     5         kx set d_builtin_choose_expr
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for GCC-style __builtin_expect
     5         kx case "$d_builtin_expect" in
     5         kx '')
     5         kx     echo " "
     5         kx     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
     5         kx     $cat >try.c <<'EOCP'
     5         kx int main(void) {
     5         kx     int n = 50;
     5         kx     if ( __builtin_expect(n, 0) ) n = 1;
     5         kx     /* Remember shell exit code truth is 0, C truth is non-zero */
     5         kx     return !(n == 1);
     5         kx }
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile && $run ./try; then
     5         kx 	echo "Your C compiler supports __builtin_expect."
     5         kx 	val="$define"
     5         kx     else
     5         kx 	echo "Your C compiler doesn't seem to understand __builtin_expect."
     5         kx 	val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx *) val="$d_builtin_expect" ;;
     5         kx esac
     5         kx 
     5         kx set d_builtin_expect
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if the Compiler supports C99 variadic macros
     5         kx echo "Checking for C99 variadic macros." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #include <stdarg.h>
     5         kx 
     5         kx #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
     5         kx 
     5         kx int main() {
     5         kx   char buf[20];
     5         kx   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
     5         kx   puts(buf);
     5         kx   return 0;
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile && $run ./try 2>&1 >/dev/null; then
     5         kx     case "`$run ./try`" in
     5         kx 	"123 456 789")
     5         kx 	echo "You have C99 variadic macros." >&4
     5         kx 	d_c99_variadic_macros="$define"
     5         kx 	;;
     5         kx 	*)
     5         kx 	echo "You don't have functional C99 variadic macros." >&4
     5         kx 	d_c99_variadic_macros="$undef"
     5         kx 	;;
     5         kx     esac
     5         kx else
     5         kx     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
     5         kx     d_c99_variadic_macros="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see if signal is declared as pointer to function returning int or void
     5         kx echo " "
     5         kx xxx=`./findhdr signal.h`
     5         kx $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
     5         kx if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
     5         kx 	echo "You have int (*signal())() instead of void." >&4
     5         kx 	val="$undef"
     5         kx elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
     5         kx 	echo "You have void (*signal())()." >&4
     5         kx 	val="$define"
     5         kx elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
     5         kx 	echo "You have int (*signal())() instead of void." >&4
     5         kx 	val="$undef"
     5         kx elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
     5         kx 	echo "You have void (*signal())()." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	case "$d_voidsig" in
     5         kx 	'')
     5         kx 	echo "I can't determine whether signal handler returns void or int..." >&4
     5         kx 		dflt=void
     5         kx 		rp="What type does your signal handler return?"
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		v*) val="$define";;
     5         kx 		*) val="$undef";;
     5         kx 		esac;;
     5         kx 	"$define")
     5         kx 		echo "As you already told me, signal handler returns void." >&4
     5         kx 		val="$define"
     5         kx 		;;
     5         kx 	*)	echo "As you already told me, signal handler returns int." >&4
     5         kx 		val="$undef"
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx set d_voidsig
     5         kx eval $setvar
     5         kx case "$d_voidsig" in
     5         kx "$define") signal_t="void";;
     5         kx *) signal_t="int";;
     5         kx esac
     5         kx $rm -f $$.tmp
     5         kx 
     5         kx : check for ability to cast large floats to 32-bit ints.
     5         kx echo " "
     5         kx echo 'Checking whether your C compiler can cast large floats to int32.' >&4
     5         kx if $test "$intsize" -ge 4; then
     5         kx 	xxx=int
     5         kx else
     5         kx 	xxx=long
     5         kx fi
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx $signal_t blech(int s) { exit(3); }
     5         kx int main()
     5         kx {
     5         kx 	$xxx i32;
     5         kx 	double f, g;
     5         kx 	int result = 0;
     5         kx 	char str[16];
     5         kx 	signal(SIGFPE, blech);
     5         kx 
     5         kx 	/* Don't let compiler optimize the test away.  Store the number
     5         kx 	   in a writable string for gcc to pass to sscanf under HP-UX.
     5         kx 	*/
     5         kx 	sprintf(str, "2147483647");
     5         kx 	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
     5         kx 	g = 10 * f;
     5         kx 	i32  = ($xxx) g;
     5         kx 
     5         kx 	/* x86 processors will probably give 0x8000 0000, which is a
     5         kx 	   sign change.  We don't want that.  We want to mimic SPARC
     5         kx 	   behavior here, which is to preserve the sign and give
     5         kx 	   back 0x7fff ffff.
     5         kx 	*/
     5         kx 	if (i32 != ($xxx) f)
     5         kx 		result |= 1;
     5         kx 	exit(result);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	$run ./try 2>/dev/null
     5         kx 	yyy=$?
     5         kx else
     5         kx 	echo "(I can't seem to compile the test program--assuming it can't)"
     5         kx 	yyy=1
     5         kx fi
     5         kx case "$yyy" in
     5         kx 0)	val="$define"
     5         kx 	echo "Yup, it can."
     5         kx 	;;
     5         kx *)	val="$undef"
     5         kx 	echo "Nope, it can't."
     5         kx 	;;
     5         kx esac
     5         kx set d_casti32
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : check for ability to cast negative floats to unsigned
     5         kx echo " "
     5         kx echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx $signal_t blech(int s) { exit(7); }
     5         kx $signal_t blech_in_list(int s) { exit(4); }
     5         kx unsigned long dummy_long(unsigned long p) { return p; }
     5         kx unsigned int dummy_int(unsigned int p) { return p; }
     5         kx unsigned short dummy_short(unsigned short p) { return p; }
     5         kx int main()
     5         kx {
     5         kx 	double f;
     5         kx 	unsigned long along;
     5         kx 	unsigned int aint;
     5         kx 	unsigned short ashort;
     5         kx 	int result = 0;
     5         kx 	char str[16];
     5         kx 
     5         kx 	/* Frustrate gcc-2.7.2's optimizer which failed this test with
     5         kx 	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
     5         kx 	   optimized the whole file away
     5         kx 	*/
     5         kx 	/* Store the number in a writable string for gcc to pass to
     5         kx 	   sscanf under HP-UX.
     5         kx 	*/
     5         kx 	sprintf(str, "-123");
     5         kx 	sscanf(str, "%lf", &f);  /* f = -123.; */
     5         kx 
     5         kx 	signal(SIGFPE, blech);
     5         kx 	along = (unsigned long)f;
     5         kx 	aint = (unsigned int)f;
     5         kx 	ashort = (unsigned short)f;
     5         kx 	if (along != (unsigned long)-123)
     5         kx 		result |= 1;
     5         kx 	if (aint != (unsigned int)-123)
     5         kx 		result |= 1;
     5         kx 	if (ashort != (unsigned short)-123)
     5         kx 		result |= 1;
     5         kx 	sprintf(str, "1073741824.");
     5         kx 	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
     5         kx 	f = f + f;
     5         kx 	along = 0;
     5         kx 	along = (unsigned long)f;
     5         kx 	if (along != 0x80000000)
     5         kx 		result |= 2;
     5         kx 	f -= 1.;
     5         kx 	along = 0;
     5         kx 	along = (unsigned long)f;
     5         kx 	if (along != 0x7fffffff)
     5         kx 		result |= 1;
     5         kx 	f += 2.;
     5         kx 	along = 0;
     5         kx 	along = (unsigned long)f;
     5         kx 	if (along != 0x80000001)
     5         kx 		result |= 2;
     5         kx 	if (result)
     5         kx 		exit(result);
     5         kx 	signal(SIGFPE, blech_in_list);
     5         kx 	sprintf(str, "123.");
     5         kx 	sscanf(str, "%lf", &f);  /* f = 123.; */
     5         kx 	along = dummy_long((unsigned long)f);
     5         kx 	aint = dummy_int((unsigned int)f);
     5         kx 	ashort = dummy_short((unsigned short)f);
     5         kx 	if (along != (unsigned long)123)
     5         kx 		result |= 4;
     5         kx 	if (aint != (unsigned int)123)
     5         kx 		result |= 4;
     5         kx 	if (ashort != (unsigned short)123)
     5         kx 		result |= 4;
     5         kx 	exit(result);
     5         kx 
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	$run ./try 2>/dev/null
     5         kx 	castflags=$?
     5         kx else
     5         kx 	echo "(I can't seem to compile the test program--assuming it can't)"
     5         kx 	castflags=7
     5         kx fi
     5         kx case "$castflags" in
     5         kx 0)	val="$define"
     5         kx 	echo "Yup, it can."
     5         kx 	;;
     5         kx *)	val="$undef"
     5         kx 	echo "Nope, it can't."
     5         kx 	;;
     5         kx esac
     5         kx set d_castneg
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if cbrt exists
     5         kx set cbrt d_cbrt
     5         kx eval $inlibc
     5         kx 
     5         kx : see if chown exists
     5         kx set chown d_chown
     5         kx eval $inlibc
     5         kx 
     5         kx : see if chroot exists
     5         kx set chroot d_chroot
     5         kx eval $inlibc
     5         kx 
     5         kx : see if chsize exists
     5         kx set chsize d_chsize
     5         kx eval $inlibc
     5         kx 
     5         kx : see if class exists
     5         kx set class d_class
     5         kx eval $inlibc
     5         kx 
     5         kx : see if clearenv exists
     5         kx set clearenv d_clearenv
     5         kx eval $inlibc
     5         kx 
     5         kx : Define hasstruct macro for Configure internal use
     5         kx hasstruct='varname=$1; struct=$2; shift; shift;
     5         kx while $test $# -ge 2; do
     5         kx 	case "$1" in
     5         kx 	$define) echo "#include <$2>";;
     5         kx 	esac ;
     5         kx     shift 2;
     5         kx done > try.c;
     5         kx echo "int main () { struct $struct foo; }" >> try.c;
     5         kx set try;
     5         kx if eval $compile; then
     5         kx 	val="$define";
     5         kx else
     5         kx 	val="$undef";
     5         kx fi;
     5         kx set $varname;
     5         kx eval $setvar;
     5         kx $rm_try'
     5         kx 
     5         kx : see whether socket exists
     5         kx socketlib=''
     5         kx sockethdr=''
     5         kx echo " "
     5         kx $echo $n "Hmm... $c" >&4
     5         kx if set socket val -f d_socket; eval $csym; $val; then
     5         kx     echo "Looks like you have Berkeley networking support." >&4
     5         kx     d_socket="$define"
     5         kx     if set setsockopt val -f; eval $csym; $val; then
     5         kx 	d_oldsock="$undef"
     5         kx     else
     5         kx 	echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
     5         kx 	d_oldsock="$define"
     5         kx     fi
     5         kx else
     5         kx     if $contains socklib libc.list >/dev/null 2>&1; then
     5         kx 	echo "Looks like you have Berkeley networking support." >&4
     5         kx 	d_socket="$define"
     5         kx 	: we will have to assume that it supports the 4.2 BSD interface
     5         kx 	d_oldsock="$undef"
     5         kx     else
     5         kx 	echo "You don't have Berkeley networking in libc$_a..." >&4
     5         kx 	if test "X$d_socket" = "X$define"; then
     5         kx 	    echo "...but you seem to believe that you have sockets." >&4
     5         kx 	else
     5         kx 	    for net in net socket
     5         kx 	    do
     5         kx 		if test -f $sysroot/usr/lib/lib$net$_a; then
     5         kx 		    ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
     5         kx 		    $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
     5         kx 		    if $contains socket libc.list >/dev/null 2>&1; then
     5         kx 			d_socket="$define"
     5         kx 			socketlib="-l$net"
     5         kx 			case "$net" in
     5         kx 			net)
     5         kx 			    echo "...but the Wollongong group seems to have hacked it in." >&4
     5         kx 			    sockethdr="-I$sysroot/usr/netinclude"
     5         kx 			    ;;
     5         kx 			esac
     5         kx 			echo "Found Berkeley sockets interface in lib$net." >&4
     5         kx 			if $contains setsockopt libc.list >/dev/null 2>&1; then
     5         kx 			    d_oldsock="$undef"
     5         kx 			else
     5         kx 			    echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
     5         kx 			    d_oldsock="$define"
     5         kx 			fi
     5         kx 			break
     5         kx 		    fi
     5         kx 		fi
     5         kx 	    done
     5         kx 	    if test "X$d_socket" != "X$define"; then
     5         kx 	       echo "or anywhere else I see." >&4
     5         kx 	       d_socket="$undef"
     5         kx 	       d_oldsock="$undef"
     5         kx 	    fi
     5         kx 	fi
     5         kx     fi
     5         kx fi
     5         kx 
     5         kx : see if socketpair exists
     5         kx set socketpair d_sockpair
     5         kx eval $inlibc
     5         kx 
     5         kx 
     5         kx echo "Checking the availability sa_len in the sock struct ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx int main() {
     5         kx struct sockaddr sa;
     5         kx return (sa.sa_len);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx     val="$define"
     5         kx fi
     5         kx set d_sockaddr_sa_len; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct sockaddr_in6 ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct sockaddr_in6 sin6;
     5         kx return (sin6.sin6_family);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx     val="$define"
     5         kx fi
     5         kx set d_sockaddr_in6; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct sockaddr_storage ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct sockaddr_storage sastor;
     5         kx return (sastor.ss_family);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx     val="$define"
     5         kx fi
     5         kx set d_sockaddr_storage; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct sockaddr_in6 sin6;
     5         kx return (sin6.sin6_scope_id);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx     val="$define"
     5         kx fi
     5         kx set d_sin6_scope_id; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct ip_mreq ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct ip_mreq mreq;
     5         kx return (mreq.imr_multiaddr.s_addr);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx        val="$define"
     5         kx fi
     5         kx set d_ip_mreq; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct ip_mreq_source ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct ip_mreq_source mreq;
     5         kx return (mreq.imr_multiaddr.s_addr);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx        val="$define"
     5         kx fi
     5         kx set d_ip_mreq_source; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct ipv6_mreq ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct ipv6_mreq mreq;
     5         kx return (mreq.ipv6mr_interface);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx     val="$define"
     5         kx fi
     5         kx set d_ipv6_mreq; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability struct ipv6_mreq_source ..." >&4
     5         kx $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netinet/in.h>
     5         kx int main() {
     5         kx struct ipv6_mreq_source mreq;
     5         kx return (mreq.imr_multiaddr.s_addr);
     5         kx }
     5         kx EOF
     5         kx val="$undef"
     5         kx set try; if eval $compile; then
     5         kx        val="$define"
     5         kx fi
     5         kx set d_ipv6_mreq_source; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx echo "Checking the availability of certain socket constants..." >&4
     5         kx for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
     5         kx     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
     5         kx     $cat >try.c <<EOF
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx int main() {
     5         kx     int i = $ENUM;
     5         kx }
     5         kx EOF
     5         kx     val="$undef"
     5         kx     set try; if eval $compile; then
     5         kx 	val="$define"
     5         kx     fi
     5         kx     set d_${enum}; eval $setvar
     5         kx     $rm_try
     5         kx done
     5         kx 
     5         kx : see if this is a sys/uio.h system
     5         kx set sys/uio.h i_sysuio
     5         kx eval $inhdr
     5         kx 
     5         kx : Check for cmsghdr support
     5         kx echo " "
     5         kx echo "Checking to see if your system supports struct cmsghdr..." >&4
     5         kx set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
     5         kx eval $hasstruct
     5         kx case "$d_cmsghdr_s" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see if copysign exists
     5         kx set copysign d_copysign
     5         kx eval $inlibc
     5         kx 
     5         kx : see if copysignl exists
     5         kx set copysignl d_copysignl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if crypt exists
     5         kx echo " "
     5         kx set crypt d_crypt
     5         kx eval $inlibc
     5         kx case "$d_crypt" in
     5         kx $define) cryptlib='' ;;
     5         kx *)	if set crypt val -f d_crypt; eval $csym; $val; then
     5         kx 		echo 'crypt() found.' >&4
     5         kx 		val="$define"
     5         kx 		cryptlib=''
     5         kx 	else
     5         kx 		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
     5         kx 		if $test -z "$cryptlib"; then
     5         kx 			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
     5         kx 		else
     5         kx 			cryptlib=-lcrypt
     5         kx 		fi
     5         kx 		if $test -z "$cryptlib"; then
     5         kx 			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
     5         kx 		else
     5         kx 			cryptlib=-lcrypt
     5         kx 		fi
     5         kx 		if $test -z "$cryptlib"; then
     5         kx 			cryptlib=`./loc libcrypt$_a "" $libpth`
     5         kx 		else
     5         kx 			cryptlib=-lcrypt
     5         kx 		fi
     5         kx 		if $test -z "$cryptlib"; then
     5         kx 			echo 'crypt() NOT found.' >&4
     5         kx 			val="$undef"
     5         kx 		else
     5         kx 			val="$define"
     5         kx 		fi
     5         kx 	fi
     5         kx 	set d_crypt
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if this is a crypt.h system
     5         kx set crypt.h i_crypt
     5         kx eval $inhdr
     5         kx 
     5         kx : see if crypt_r exists
     5         kx set crypt_r d_crypt_r
     5         kx eval $inlibc
     5         kx case "$d_crypt_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
     5         kx 	case "$d_crypt_r_proto:$usethreads" in
     5         kx 	":define")	d_crypt_r_proto=define
     5         kx 		set d_crypt_r_proto crypt_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_crypt_r_proto" in
     5         kx 	define)
     5         kx 	case "$crypt_r_proto" in
     5         kx 	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
     5         kx 	esac
     5         kx 	case "$crypt_r_proto" in
     5         kx 	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
     5         kx 	esac
     5         kx 	case "$crypt_r_proto" in
     5         kx 	''|0)	d_crypt_r=undef
     5         kx 		crypt_r_proto=0
     5         kx 		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$crypt_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "crypt_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_crypt_r=undef
     5         kx 		crypt_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	crypt_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : get csh whereabouts
     5         kx case "$csh" in
     5         kx 'csh') val="$undef" ;;
     5         kx *) val="$define" ;;
     5         kx esac
     5         kx set d_csh
     5         kx eval $setvar
     5         kx : Respect a hint or command line value for full_csh.
     5         kx case "$full_csh" in
     5         kx '') full_csh=$csh ;;
     5         kx esac
     5         kx 
     5         kx : see if ctermid exists
     5         kx set ctermid d_ctermid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ctermid_r exists
     5         kx set ctermid_r d_ctermid_r
     5         kx eval $inlibc
     5         kx case "$d_ctermid_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h "
     5         kx 	case "$d_ctermid_r_proto:$usethreads" in
     5         kx 	":define")	d_ctermid_r_proto=define
     5         kx 		set d_ctermid_r_proto ctermid_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_ctermid_r_proto" in
     5         kx 	define)
     5         kx 	case "$ctermid_r_proto" in
     5         kx 	''|0) try='char* ctermid_r(char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
     5         kx 	esac
     5         kx 	case "$ctermid_r_proto" in
     5         kx 	''|0)	d_ctermid_r=undef
     5         kx 		ctermid_r_proto=0
     5         kx 		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$ctermid_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_ctermid_r=undef
     5         kx 		ctermid_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	ctermid_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if ctime_r exists
     5         kx set ctime_r d_ctime_r
     5         kx eval $inlibc
     5         kx case "$d_ctime_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
     5         kx 	case "$d_ctime_r_proto:$usethreads" in
     5         kx 	":define")	d_ctime_r_proto=define
     5         kx 		set d_ctime_r_proto ctime_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_ctime_r_proto" in
     5         kx 	define)
     5         kx 	case "$ctime_r_proto" in
     5         kx 	''|0) try='char* ctime_r(const time_t*, char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
     5         kx 	esac
     5         kx 	case "$ctime_r_proto" in
     5         kx 	''|0) try='char* ctime_r(const time_t*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
     5         kx 	esac
     5         kx 	case "$ctime_r_proto" in
     5         kx 	''|0) try='int ctime_r(const time_t*, char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
     5         kx 	esac
     5         kx 	case "$ctime_r_proto" in
     5         kx 	''|0) try='int ctime_r(const time_t*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$ctime_r_proto" in
     5         kx 	''|0)	d_ctime_r=undef
     5         kx 		ctime_r_proto=0
     5         kx 		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$ctime_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "ctime_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_ctime_r=undef
     5         kx 		ctime_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	ctime_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if cuserid exists
     5         kx set cuserid d_cuserid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if dbm.h is available
     5         kx : see if dbmclose exists
     5         kx set dbmclose d_dbmclose
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_dbmclose" in
     5         kx $define)
     5         kx 	set dbm.h i_dbm
     5         kx 	eval $inhdr
     5         kx 	case "$i_dbm" in
     5         kx 	$define)
     5         kx 		val="$undef"
     5         kx 		set i_rpcsvcdbm
     5         kx 		eval $setvar
     5         kx 		;;
     5         kx 	*)	set rpcsvc/dbm.h i_rpcsvcdbm
     5         kx 		eval $inhdr
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	echo "We won't be including <dbm.h>"
     5         kx 	val="$undef"
     5         kx 	set i_dbm
     5         kx 	eval $setvar
     5         kx 	val="$undef"
     5         kx 	set i_rpcsvcdbm
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototype for dbminit is available
     5         kx echo " "
     5         kx set d_dbminitproto dbminit $i_dbm dbm.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if difftime exists
     5         kx set difftime d_difftime
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a dirent system
     5         kx echo " "
     5         kx if xinc=`./findhdr dirent.h`; $test "$xinc"; then
     5         kx 	val="$define"
     5         kx 	echo "<dirent.h> found." >&4
     5         kx else
     5         kx 	val="$undef"
     5         kx 	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
     5         kx 		echo "<sys/dir.h> found." >&4
     5         kx 		echo " "
     5         kx 	else
     5         kx 		xinc=`./findhdr sys/ndir.h`
     5         kx 	fi
     5         kx 	echo "<dirent.h> NOT found." >&4
     5         kx fi
     5         kx set i_dirent
     5         kx eval $setvar
     5         kx 
     5         kx : Look for type of directory structure.
     5         kx echo " "
     5         kx $cppstdin $cppflags $cppminus < "$xinc" > try.c
     5         kx 
     5         kx case "$direntrytype" in
     5         kx ''|' ')
     5         kx 	case "$i_dirent" in
     5         kx 	$define) guess1='struct dirent' ;;
     5         kx 	*) guess1='struct direct'  ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	guess1="$direntrytype"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$guess1" in
     5         kx 'struct dirent') guess2='struct direct' ;;
     5         kx *) guess2='struct dirent' ;;
     5         kx esac
     5         kx 
     5         kx if $contains "$guess1" try.c >/dev/null 2>&1; then
     5         kx 	direntrytype="$guess1"
     5         kx 	echo "Your directory entries are $direntrytype." >&4
     5         kx elif $contains "$guess2" try.c >/dev/null 2>&1; then
     5         kx 	direntrytype="$guess2"
     5         kx 	echo "Your directory entries seem to be $direntrytype." >&4
     5         kx else
     5         kx 	echo "I don't recognize your system's directory entries." >&4
     5         kx 	rp="What type is used for directory entries on this system?"
     5         kx 	dflt="$guess1"
     5         kx 	. ./myread
     5         kx 	direntrytype="$ans"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see if the directory entry stores field length
     5         kx echo " "
     5         kx $cppstdin $cppflags $cppminus < "$xinc" > try.c
     5         kx if $contains 'd_namlen' try.c >/dev/null 2>&1; then
     5         kx 	echo "Good, your directory entry keeps length information in d_namlen." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "Your directory entry does not know about the d_namlen field." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_dirnamlen
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : Look for DIR.dd_fd
     5         kx case "$i_dirent" in
     5         kx "$define")
     5         kx     echo "Checking to see if DIR has a dd_fd member variable" >&4
     5         kx     $cat >try.c <<EOCP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <dirent.h>
     5         kx 
     5         kx int main() {
     5         kx     DIR dir;
     5         kx     dir.dd_fd = 1;
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx     val=$undef
     5         kx     set try
     5         kx     if eval $compile; then
     5         kx         echo "Yes, it does."
     5         kx         val="$define"
     5         kx     else
     5         kx         echo "No, it does not."
     5         kx         val="$undef"
     5         kx     fi
     5         kx     ;;
     5         kx *)
     5         kx     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
     5         kx     val="$undef"
     5         kx     ;;
     5         kx esac
     5         kx set d_dir_dd_fd
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if this is an sysdir system
     5         kx set sys/dir.h i_sysdir
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is an sysndir system
     5         kx set sys/ndir.h i_sysndir
     5         kx eval $inhdr
     5         kx 
     5         kx : Look for dirfd
     5         kx echo " "
     5         kx $cat >dirfd.c <<EOM
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_dirent I_DIRENT		/**/
     5         kx #$i_sysdir I_SYS_DIR		/**/
     5         kx #$i_sysndir I_SYS_NDIR		/**/
     5         kx #$i_systypes I_SYS_TYPES	/**/
     5         kx #if defined(I_SYS_TYPES)
     5         kx #include <sys/types.h>
     5         kx #endif
     5         kx #if defined(I_DIRENT)
     5         kx #include <dirent.h>
     5         kx #else
     5         kx #ifdef I_SYS_NDIR
     5         kx #include <sys/ndir.h>
     5         kx #else
     5         kx #ifdef I_SYS_DIR
     5         kx #include <sys/dir.h>
     5         kx #endif
     5         kx #endif
     5         kx #endif
     5         kx int main() {
     5         kx 	DIR *dirp = opendir(".");
     5         kx 	if (dirfd(dirp) >= 0)
     5         kx 		exit(0);
     5         kx 	else
     5         kx 		exit(1);
     5         kx }
     5         kx EOM
     5         kx val=$undef
     5         kx set dirfd
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx fi
     5         kx case "$val" in
     5         kx $define)	echo "dirfd() found." >&4	;;
     5         kx *)		echo "dirfd() NOT found." >&4	;;
     5         kx esac
     5         kx set d_dirfd
     5         kx eval $setvar
     5         kx $rm -f dirfd*
     5         kx 
     5         kx : see if dladdr exists
     5         kx set dladdr d_dladdr
     5         kx eval $inlibc
     5         kx 
     5         kx : see if dlerror exists
     5         kx xxx_runnm="$runnm"
     5         kx runnm=false
     5         kx set dlerror d_dlerror
     5         kx eval $inlibc
     5         kx runnm="$xxx_runnm"
     5         kx 
     5         kx : see if dlfcn is available
     5         kx set dlfcn.h i_dlfcn
     5         kx eval $inhdr
     5         kx 
     5         kx : Check what extension to use for shared libs
     5         kx case "$usedl" in
     5         kx $define|y|true)
     5         kx 	$cat << EOM
     5         kx 
     5         kx On a few systems, the dynamically loaded modules that perl generates and uses
     5         kx will need a different extension than shared libs. The default will probably
     5         kx be appropriate.
     5         kx 
     5         kx EOM
     5         kx 	case "$dlext" in
     5         kx 	'')	dflt="$so" ;;
     5         kx 	*)	dflt="$dlext" ;;
     5         kx 	esac
     5         kx 	rp='What is the extension of dynamically loaded modules'
     5         kx 	. ./myread
     5         kx 	dlext="$ans"
     5         kx 	;;
     5         kx *)
     5         kx 	dlext="none"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check if dlsym need a leading underscore
     5         kx echo " "
     5         kx val="$undef"
     5         kx 
     5         kx case "$dlsrc" in
     5         kx dl_dlopen.xs)
     5         kx 	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
     5         kx 	$cat >dyna.c <<'EOM'
     5         kx fred () { }
     5         kx EOM
     5         kx 
     5         kx $cat >fred.c<<EOM
     5         kx 
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_dlfcn I_DLFCN
     5         kx #ifdef I_DLFCN
     5         kx #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
     5         kx #else
     5         kx #include <sys/types.h>
     5         kx #include <nlist.h>
     5         kx #include <link.h>
     5         kx #endif
     5         kx 
     5         kx extern int fred() ;
     5         kx 
     5         kx int main()
     5         kx {
     5         kx     void * handle ;
     5         kx     void * symbol ;
     5         kx #ifndef RTLD_LAZY
     5         kx     int mode = 1 ;
     5         kx #else
     5         kx     int mode = RTLD_LAZY ;
     5         kx #endif
     5         kx     handle = dlopen("./dyna.$dlext", mode) ;
     5         kx     if (handle == NULL) {
     5         kx 	printf ("1\n") ;
     5         kx 	fflush (stdout) ;
     5         kx 	exit(0);
     5         kx     }
     5         kx     symbol = dlsym(handle, "fred") ;
     5         kx     if (symbol == NULL) {
     5         kx 	/* try putting a leading underscore */
     5         kx 	symbol = dlsym(handle, "_fred") ;
     5         kx 	if (symbol == NULL) {
     5         kx 	    printf ("2\n") ;
     5         kx 	    fflush (stdout) ;
     5         kx 	    exit(0);
     5         kx 	}
     5         kx 	printf ("3\n") ;
     5         kx     }
     5         kx     else
     5         kx 	printf ("4\n") ;
     5         kx     fflush (stdout) ;
     5         kx     exit(0);
     5         kx }
     5         kx EOM
     5         kx 	: Call the object file tmp-dyna.o in case dlext=o.
     5         kx 	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
     5         kx 		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
     5         kx 		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
     5         kx 		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
     5         kx 		xxx=`$run ./fred`
     5         kx 		case $xxx in
     5         kx 		1)	echo "Test program failed using dlopen." >&4
     5         kx 			echo "Perhaps you should not use dynamic loading." >&4;;
     5         kx 		2)	echo "Test program failed using dlsym." >&4
     5         kx 			echo "Perhaps you should not use dynamic loading." >&4;;
     5         kx 		3)	echo "dlsym needs a leading underscore" >&4
     5         kx 			val="$define" ;;
     5         kx 		4)	echo "dlsym doesn't need a leading underscore." >&4;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "I can't compile and run the test program." >&4
     5         kx                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
     5         kx 
     5         kx set d_dlsymun
     5         kx eval $setvar
     5         kx 
     5         kx : see if drand48_r exists
     5         kx set drand48_r d_drand48_r
     5         kx eval $inlibc
     5         kx case "$d_drand48_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
     5         kx 	case "$d_drand48_r_proto:$usethreads" in
     5         kx 	":define")	d_drand48_r_proto=define
     5         kx 		set d_drand48_r_proto drand48_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_drand48_r_proto" in
     5         kx 	define)
     5         kx 	case "$drand48_r_proto" in
     5         kx 	''|0) try='int drand48_r(struct drand48_data*, double*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
     5         kx 	esac
     5         kx 	case "$drand48_r_proto" in
     5         kx 	''|0)	d_drand48_r=undef
     5         kx 		drand48_r_proto=0
     5         kx 		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$drand48_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "drand48_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_drand48_r=undef
     5         kx 		drand48_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	drand48_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototype for drand48 is available
     5         kx echo " "
     5         kx set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if dup2 exists
     5         kx set dup2 d_dup2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if dup3 exists
     5         kx set dup3 d_dup3
     5         kx eval $inlibc
     5         kx 
     5         kx : see if localeconv_l exists
     5         kx set localeconv_l d_localeconv_l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is an xlocale.h system
     5         kx set xlocale.h i_xlocale
     5         kx eval $inhdr
     5         kx 
     5         kx : see if newlocale exists
     5         kx set newlocale d_newlocale
     5         kx eval $inlibc
     5         kx 
     5         kx : see if freelocale exists
     5         kx set freelocale d_freelocale
     5         kx eval $inlibc
     5         kx 
     5         kx : see if uselocale exists
     5         kx set uselocale d_uselocale
     5         kx eval $inlibc
     5         kx 
     5         kx : see if duplocale exists
     5         kx set duplocale d_duplocale
     5         kx eval $inlibc
     5         kx 
     5         kx : see if querylocale exists
     5         kx set querylocale d_querylocale
     5         kx eval $inlibc
     5         kx 
     5         kx : if we have xlocale.h, check whether it is needed
     5         kx case "$i_xlocale$d_newlocale$xlocale_needed" in
     5         kx "$define$define")
     5         kx 	echo "Checking if xlocale.h is needed..." >&4
     5         kx 	$cat >try.c <<EOF
     5         kx #include <locale.h>
     5         kx #include <stdio.h>
     5         kx #ifdef TRY_XLOCALE
     5         kx #include <xlocale.h>
     5         kx #endif
     5         kx #$d_localeconv_l HAVE_LOCALECONV_L
     5         kx 
     5         kx #ifdef HAVE_LOCALECONV_L
     5         kx struct lconv *(*lcptr)(locale_t) = localeconv_l;
     5         kx #endif
     5         kx 
     5         kx int main(void) {
     5         kx   locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
     5         kx 
     5         kx #ifdef HAVE_LOCALECONV_L
     5         kx   /* FreeBSD hides only localeconv_l() in xlocale.h */
     5         kx   struct lconv *lcbuf = localeconv_l(lc);
     5         kx   printf("decimal: %s\n", lcbuf->decimal_point);
     5         kx #endif
     5         kx 
     5         kx   freelocale(lc);
     5         kx   return 0;
     5         kx }
     5         kx EOF
     5         kx 	set try
     5         kx 	if eval $compile && $run ./try > /dev/null 2>&1 ; then
     5         kx 		echo "xlocale.h isn't needed" >&4
     5         kx 		xlocale_needed=$undef
     5         kx 	else
     5         kx 		set try -DTRY_XLOCALE
     5         kx 		if eval $compile && $run ./try > /dev/null 2>&1 ; then
     5         kx 			xlocale_needed=$define
     5         kx 			echo "xlocale.h is needed" >&4
     5         kx 		else
     5         kx 			echo "I can't build my test either way" >&4
     5         kx 			xlocale_needed=$undef
     5         kx 		fi
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx *) xlocale_needed=$undef ;;
     5         kx esac
     5         kx 
     5         kx : see if eaccess exists
     5         kx set eaccess d_eaccess
     5         kx eval $inlibc
     5         kx 
     5         kx : see if endgrent exists
     5         kx set endgrent d_endgrent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is an grp system
     5         kx set grp.h i_grp
     5         kx eval $inhdr
     5         kx 
     5         kx case "$i_grp" in
     5         kx $define)
     5         kx 	xxx=`./findhdr grp.h`
     5         kx 	$cppstdin $cppflags $cppminus < $xxx >$$.h
     5         kx 
     5         kx 	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_grpasswd
     5         kx 	eval $setvar
     5         kx 
     5         kx 	$rm -f $$.h
     5         kx 	;;
     5         kx *)
     5         kx 	val="$undef";
     5         kx 	set d_grpasswd; eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endgrent_r exists
     5         kx set endgrent_r d_endgrent_r
     5         kx eval $inlibc
     5         kx case "$d_endgrent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
     5         kx 	case "$d_endgrent_r_proto:$usethreads" in
     5         kx 	":define")	d_endgrent_r_proto=define
     5         kx 		set d_endgrent_r_proto endgrent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endgrent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endgrent_r_proto" in
     5         kx 	''|0) try='int endgrent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
     5         kx 	esac
     5         kx 	case "$endgrent_r_proto" in
     5         kx 	''|0) try='void endgrent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
     5         kx 	esac
     5         kx 	case "$endgrent_r_proto" in
     5         kx 	''|0)	d_endgrent_r=undef
     5         kx 		endgrent_r_proto=0
     5         kx 		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endgrent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endgrent_r=undef
     5         kx 		endgrent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endgrent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endhostent exists
     5         kx set endhostent d_endhent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a netdb.h system
     5         kx set netdb.h i_netdb
     5         kx eval $inhdr
     5         kx 
     5         kx : see if endhostent_r exists
     5         kx set endhostent_r d_endhostent_r
     5         kx eval $inlibc
     5         kx case "$d_endhostent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_endhostent_r_proto:$usethreads" in
     5         kx 	":define")	d_endhostent_r_proto=define
     5         kx 		set d_endhostent_r_proto endhostent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endhostent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endhostent_r_proto" in
     5         kx 	''|0) try='int endhostent_r(struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
     5         kx 	esac
     5         kx 	case "$endhostent_r_proto" in
     5         kx 	''|0) try='void endhostent_r(struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
     5         kx 	esac
     5         kx 	case "$endhostent_r_proto" in
     5         kx 	''|0)	d_endhostent_r=undef
     5         kx 		endhostent_r_proto=0
     5         kx 		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endhostent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endhostent_r=undef
     5         kx 		endhostent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endhostent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endnetent exists
     5         kx set endnetent d_endnent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if endnetent_r exists
     5         kx set endnetent_r d_endnetent_r
     5         kx eval $inlibc
     5         kx case "$d_endnetent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_endnetent_r_proto:$usethreads" in
     5         kx 	":define")	d_endnetent_r_proto=define
     5         kx 		set d_endnetent_r_proto endnetent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endnetent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endnetent_r_proto" in
     5         kx 	''|0) try='int endnetent_r(struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
     5         kx 	esac
     5         kx 	case "$endnetent_r_proto" in
     5         kx 	''|0) try='void endnetent_r(struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
     5         kx 	esac
     5         kx 	case "$endnetent_r_proto" in
     5         kx 	''|0)	d_endnetent_r=undef
     5         kx 		endnetent_r_proto=0
     5         kx 		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endnetent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endnetent_r=undef
     5         kx 		endnetent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endnetent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endprotoent exists
     5         kx set endprotoent d_endpent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if endprotoent_r exists
     5         kx set endprotoent_r d_endprotoent_r
     5         kx eval $inlibc
     5         kx case "$d_endprotoent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_endprotoent_r_proto:$usethreads" in
     5         kx 	":define")	d_endprotoent_r_proto=define
     5         kx 		set d_endprotoent_r_proto endprotoent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endprotoent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endprotoent_r_proto" in
     5         kx 	''|0) try='int endprotoent_r(struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
     5         kx 	esac
     5         kx 	case "$endprotoent_r_proto" in
     5         kx 	''|0) try='void endprotoent_r(struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
     5         kx 	esac
     5         kx 	case "$endprotoent_r_proto" in
     5         kx 	''|0)	d_endprotoent_r=undef
     5         kx 		endprotoent_r_proto=0
     5         kx 		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endprotoent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endprotoent_r=undef
     5         kx 		endprotoent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endprotoent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endpwent exists
     5         kx set endpwent d_endpwent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a pwd.h system
     5         kx set pwd.h i_pwd
     5         kx eval $inhdr
     5         kx 
     5         kx case "$i_pwd" in
     5         kx $define)
     5         kx 	xxx=`./findhdr pwd.h`
     5         kx 	$cppstdin $cppflags $cppminus < $xxx >$$.h
     5         kx 
     5         kx 	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwquota
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwage
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwchange
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwclass
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwexpire
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwcomment
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwgecos
     5         kx 	eval $setvar
     5         kx 
     5         kx 	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	set d_pwpasswd
     5         kx 	eval $setvar
     5         kx 
     5         kx 	$rm -f $$.h
     5         kx 	;;
     5         kx *)
     5         kx 	val="$undef";
     5         kx 	set d_pwquota; eval $setvar
     5         kx 	set d_pwage; eval $setvar
     5         kx 	set d_pwchange; eval $setvar
     5         kx 	set d_pwclass; eval $setvar
     5         kx 	set d_pwexpire; eval $setvar
     5         kx 	set d_pwcomment; eval $setvar
     5         kx 	set d_pwgecos; eval $setvar
     5         kx 	set d_pwpasswd; eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endpwent_r exists
     5         kx set endpwent_r d_endpwent_r
     5         kx eval $inlibc
     5         kx case "$d_endpwent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
     5         kx 	case "$d_endpwent_r_proto:$usethreads" in
     5         kx 	":define")	d_endpwent_r_proto=define
     5         kx 		set d_endpwent_r_proto endpwent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endpwent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endpwent_r_proto" in
     5         kx 	''|0) try='int endpwent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
     5         kx 	esac
     5         kx 	case "$endpwent_r_proto" in
     5         kx 	''|0) try='void endpwent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
     5         kx 	esac
     5         kx 	case "$endpwent_r_proto" in
     5         kx 	''|0)	d_endpwent_r=undef
     5         kx 		endpwent_r_proto=0
     5         kx 		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endpwent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endpwent_r=undef
     5         kx 		endpwent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endpwent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if endservent exists
     5         kx set endservent d_endsent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if endservent_r exists
     5         kx set endservent_r d_endservent_r
     5         kx eval $inlibc
     5         kx case "$d_endservent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_endservent_r_proto:$usethreads" in
     5         kx 	":define")	d_endservent_r_proto=define
     5         kx 		set d_endservent_r_proto endservent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_endservent_r_proto" in
     5         kx 	define)
     5         kx 	case "$endservent_r_proto" in
     5         kx 	''|0) try='int endservent_r(struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
     5         kx 	esac
     5         kx 	case "$endservent_r_proto" in
     5         kx 	''|0) try='void endservent_r(struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
     5         kx 	esac
     5         kx 	case "$endservent_r_proto" in
     5         kx 	''|0)	d_endservent_r=undef
     5         kx 		endservent_r_proto=0
     5         kx 		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$endservent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "endservent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_endservent_r=undef
     5         kx 		endservent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	endservent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Locate the flags for 'open()'
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #ifdef I_FCNTL
     5         kx #include <fcntl.h>
     5         kx #endif
     5         kx #ifdef I_SYS_FILE
     5         kx #include <sys/file.h>
     5         kx #endif
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx 	if(O_RDONLY);
     5         kx #ifdef O_TRUNC
     5         kx 	exit(0);
     5         kx #else
     5         kx 	exit(1);
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx : check sys/file.h first to get FREAD on Sun
     5         kx if $test `./findhdr sys/file.h` && \
     5         kx 		set try -DI_SYS_FILE && eval $compile; then
     5         kx 	h_sysfile=true;
     5         kx 	echo "<sys/file.h> defines the O_* constants..." >&4
     5         kx 	if $run ./try; then
     5         kx 		echo "and you have the 3 argument form of open()." >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "but not the 3 argument form of open().  Oh, well." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx elif $test `./findhdr fcntl.h` && \
     5         kx 		set try -DI_FCNTL && eval $compile; then
     5         kx 	h_fcntl=true;
     5         kx 	echo "<fcntl.h> defines the O_* constants..." >&4
     5         kx 	if $run ./try; then
     5         kx 		echo "and you have the 3 argument form of open()." >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "but not the 3 argument form of open().  Oh, well." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "I can't find the O_* constant definitions!  You got problems." >&4
     5         kx fi
     5         kx set d_open3
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if this is a sys/file.h system
     5         kx val=''
     5         kx set sys/file.h val
     5         kx eval $inhdr
     5         kx 
     5         kx : do we need to include sys/file.h ?
     5         kx case "$val" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	if $h_sysfile; then
     5         kx 		val="$define"
     5         kx 		echo "We'll be including <sys/file.h>." >&4
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 		echo "We won't be including <sys/file.h>." >&4
     5         kx 	fi
     5         kx 	;;
     5         kx *)
     5         kx 	h_sysfile=false
     5         kx 	;;
     5         kx esac
     5         kx set i_sysfile
     5         kx eval $setvar
     5         kx 
     5         kx : see if fcntl.h is there
     5         kx val=''
     5         kx set fcntl.h val
     5         kx eval $inhdr
     5         kx 
     5         kx : see if we can include fcntl.h
     5         kx case "$val" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	if $h_fcntl; then
     5         kx 		val="$define"
     5         kx 		echo "We'll be including <fcntl.h>." >&4
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 		if $h_sysfile; then
     5         kx 	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
     5         kx 		else
     5         kx 			echo "We won't be including <fcntl.h>." >&4
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx *)
     5         kx 	h_fcntl=false
     5         kx 	val="$undef"
     5         kx 	;;
     5         kx esac
     5         kx set i_fcntl
     5         kx eval $setvar
     5         kx 
     5         kx : see if fork exists
     5         kx set fork d_fork
     5         kx eval $inlibc
     5         kx 
     5         kx : see if pipe exists
     5         kx set pipe d_pipe
     5         kx eval $inlibc
     5         kx 
     5         kx : check for non-blocking I/O stuff
     5         kx case "$h_sysfile" in
     5         kx true) echo "#include <sys/file.h>" > head.c;;
     5         kx *)
     5         kx        case "$h_fcntl" in
     5         kx        true) echo "#include <fcntl.h>" > head.c;;
     5         kx        *) echo "#include <sys/fcntl.h>" > head.c;;
     5         kx        esac
     5         kx        ;;
     5         kx esac
     5         kx echo " "
     5         kx echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
     5         kx case "$o_nonblock" in
     5         kx '')
     5         kx 	$cat head.c > try.c
     5         kx 	$cat >>try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_fcntl I_FCNTL
     5         kx #ifdef I_FCNTL
     5         kx #include <fcntl.h>
     5         kx #endif
     5         kx int main() {
     5         kx #ifdef O_NONBLOCK
     5         kx 	printf("O_NONBLOCK\n");
     5         kx 	exit(0);
     5         kx #endif
     5         kx #ifdef O_NDELAY
     5         kx 	printf("O_NDELAY\n");
     5         kx 	exit(0);
     5         kx #endif
     5         kx #ifdef FNDELAY
     5         kx 	printf("FNDELAY\n");
     5         kx 	exit(0);
     5         kx #endif
     5         kx 	exit(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		o_nonblock=`$run ./try`
     5         kx 		case "$o_nonblock" in
     5         kx 		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
     5         kx 		*) echo "Seems like we can use $o_nonblock.";;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
     5         kx 	fi
     5         kx 	;;
     5         kx *) echo "Using $hint value $o_nonblock.";;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx echo " "
     5         kx echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
     5         kx case "$eagain" in
     5         kx '')
     5         kx 	case "$d_fork:$d_pipe:$d_alarm" in
     5         kx 	define:define:define)
     5         kx 	$cat head.c > try.c
     5         kx 	$cat >>try.c <<EOCP
     5         kx #include <errno.h>
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_fcntl I_FCNTL
     5         kx #ifdef I_FCNTL
     5         kx #include <fcntl.h>
     5         kx #endif
     5         kx #define MY_O_NONBLOCK $o_nonblock
     5         kx #ifndef errno  /* XXX need better Configure test */
     5         kx extern int errno;
     5         kx #endif
     5         kx #$i_unistd I_UNISTD
     5         kx #ifdef I_UNISTD
     5         kx #include <unistd.h>
     5         kx #endif
     5         kx #include <string.h>
     5         kx $signal_t blech(int x) { exit(3); }
     5         kx EOCP
     5         kx 	$cat >> try.c <<'EOCP'
     5         kx int main()
     5         kx {
     5         kx 	int pd[2];
     5         kx 	int pu[2];
     5         kx 	char buf[1];
     5         kx 	char string[100];
     5         kx 	int ret;
     5         kx 
     5         kx 	ret = pipe(pd);	/* Down: child -> parent */
     5         kx 	if (ret != 0)
     5         kx 		exit(3);
     5         kx 	ret = pipe(pu);	/* Up: parent -> child */
     5         kx 	if (ret != 0)
     5         kx 		exit(3);
     5         kx 	if (0 != fork()) {
     5         kx 		close(pd[1]);	/* Parent reads from pd[0] */
     5         kx 		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
     5         kx #ifdef F_SETFL
     5         kx 		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
     5         kx 			exit(1);
     5         kx #else
     5         kx 		exit(4);
     5         kx #endif
     5         kx 		signal(SIGALRM, blech);
     5         kx 		alarm(5);
     5         kx 		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
     5         kx 			exit(2);
     5         kx 		sprintf(string, "%d\n", ret);
     5         kx 		ret = write(2, string, strlen(string));
     5         kx 		if (ret != strlen(string))
     5         kx 			exit(3);
     5         kx 		alarm(0);
     5         kx #ifdef EAGAIN
     5         kx 		if (errno == EAGAIN) {
     5         kx 			printf("EAGAIN\n");
     5         kx 			goto ok;
     5         kx 		}
     5         kx #endif
     5         kx #ifdef EWOULDBLOCK
     5         kx 		if (errno == EWOULDBLOCK)
     5         kx 			printf("EWOULDBLOCK\n");
     5         kx #endif
     5         kx 	ok:
     5         kx 		ret = write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
     5         kx 		if (ret != 1)
     5         kx 			exit(3);
     5         kx 		sleep(2);				/* Give it time to close our pipe */
     5         kx 		alarm(5);
     5         kx 		ret = read(pd[0], buf, 1);	/* Should read EOF */
     5         kx 		alarm(0);
     5         kx 		sprintf(string, "%d\n", ret);
     5         kx 		ret = write(4, string, strlen(string));
     5         kx 		if (ret != strlen(string))
     5         kx 			exit(3);
     5         kx 		exit(0);
     5         kx 	}
     5         kx 
     5         kx 	close(pd[0]);			/* We write to pd[1] */
     5         kx 	close(pu[1]);			/* We read from pu[0] */
     5         kx 	ret = read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
     5         kx 	if (ret != 1)
     5         kx 		exit(3);
     5         kx 	close(pd[1]);			/* Pipe pd is now fully closed! */
     5         kx 	exit(0);				/* Bye bye, thank you for playing! */
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		echo "$startsh" >mtry
     5         kx 		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
     5         kx 		chmod +x mtry
     5         kx 		$run ./mtry >/dev/null 2>&1
     5         kx 		case $? in
     5         kx 		0) eagain=`$cat try.out`;;
     5         kx 		1) echo "Could not perform non-blocking setting!";;
     5         kx 		2) echo "I did a successful read() for something that was not there!";;
     5         kx 		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
     5         kx 		4) echo "Could not find F_SETFL!";;
     5         kx 		*) echo "Something terribly wrong happened during testing.";;
     5         kx 		esac
     5         kx 		rd_nodata=`$cat try.ret`
     5         kx 		echo "A read() system call with no data present returns $rd_nodata."
     5         kx 		case "$rd_nodata" in
     5         kx 		0|-1) ;;
     5         kx 		*)
     5         kx 			echo "(That's peculiar, fixing that to be -1.)"
     5         kx 			rd_nodata=-1
     5         kx 			;;
     5         kx 		esac
     5         kx 		case "$eagain" in
     5         kx 		'')
     5         kx 			echo "Forcing errno EAGAIN on read() with no data available."
     5         kx 			eagain=EAGAIN
     5         kx 			;;
     5         kx 		*)
     5         kx 			echo "Your read() sets errno to $eagain when no data is available."
     5         kx 			;;
     5         kx 		esac
     5         kx 		status=`$cat try.err`
     5         kx 		case "$status" in
     5         kx 		0) echo "And it correctly returns 0 to signal EOF.";;
     5         kx 		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
     5         kx 		*) echo "However, your read() returns '$status' on EOF??";;
     5         kx 		esac
     5         kx 		val="$define"
     5         kx 		if test "$status" = "$rd_nodata"; then
     5         kx 			echo "WARNING: you can't distinguish between EOF and no data!"
     5         kx 			val="$undef"
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "I can't compile the test program--assuming errno EAGAIN will do."
     5         kx 		eagain=EAGAIN
     5         kx 	fi
     5         kx 	;;
     5         kx 	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
     5         kx 		eagain=EAGAIN
     5         kx 		val="$define"
     5         kx 		;;
     5         kx 	esac
     5         kx 	set d_eofnblk
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx *)
     5         kx 	echo "Using $hint value $eagain."
     5         kx 	echo "Your read() returns $rd_nodata when no data is present."
     5         kx 	case "$d_eofnblk" in
     5         kx 	"$define") echo "And you can see EOF because read() returns 0.";;
     5         kx 	"$undef") echo "But you can't see EOF status from read() returned value.";;
     5         kx 	*)
     5         kx 		echo "(Assuming you can't see EOF status from read anyway.)"
     5         kx 		d_eofnblk=$undef
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx $rm_try head.c mtry
     5         kx 
     5         kx : see if erf exists
     5         kx set erf d_erf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if erfc exists
     5         kx set erfc d_erfc
     5         kx eval $inlibc
     5         kx 
     5         kx : see if exp2 exists
     5         kx set exp2 d_exp2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if expm1 exists
     5         kx set expm1 d_expm1
     5         kx eval $inlibc
     5         kx 
     5         kx : see if _ptr and _cnt from stdio act std
     5         kx echo " "
     5         kx 
     5         kx if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
     5         kx 	echo "(Looks like you have stdio.h from BSD.)"
     5         kx 	case "$stdio_ptr" in
     5         kx 	'') stdio_ptr='((fp)->_p)'
     5         kx 		ptr_lval=$define
     5         kx 		;;
     5         kx 	*)	ptr_lval=$d_stdio_ptr_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_cnt" in
     5         kx 	'') stdio_cnt='((fp)->_r)'
     5         kx 		cnt_lval=$define
     5         kx 		;;
     5         kx 	*)	cnt_lval=$d_stdio_cnt_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_base" in
     5         kx 	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
     5         kx 	esac
     5         kx 	case "$stdio_bufsiz" in
     5         kx 	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
     5         kx 	esac
     5         kx elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
     5         kx 	echo "(Looks like you have stdio.h from Linux.)"
     5         kx 	case "$stdio_ptr" in
     5         kx 	'') stdio_ptr='((fp)->_IO_read_ptr)'
     5         kx 		ptr_lval=$define
     5         kx 		;;
     5         kx 	*)	ptr_lval=$d_stdio_ptr_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_cnt" in
     5         kx 	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
     5         kx 		cnt_lval=$undef
     5         kx 		;;
     5         kx 	*)	cnt_lval=$d_stdio_cnt_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_base" in
     5         kx 	'') stdio_base='((fp)->_IO_read_base)';;
     5         kx 	esac
     5         kx 	case "$stdio_bufsiz" in
     5         kx 	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
     5         kx 	esac
     5         kx else
     5         kx 	case "$stdio_ptr" in
     5         kx 	'') stdio_ptr='((fp)->_ptr)'
     5         kx 		ptr_lval=$define
     5         kx 		;;
     5         kx 	*)	ptr_lval=$d_stdio_ptr_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_cnt" in
     5         kx 	'') stdio_cnt='((fp)->_cnt)'
     5         kx 		cnt_lval=$define
     5         kx 		;;
     5         kx 	*)	cnt_lval=$d_stdio_cnt_lval;;
     5         kx 	esac
     5         kx 	case "$stdio_base" in
     5         kx 	'') stdio_base='((fp)->_base)';;
     5         kx 	esac
     5         kx 	case "$stdio_bufsiz" in
     5         kx 	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : test whether _ptr and _cnt really work
     5         kx echo "Checking how std your stdio is..." >&4
     5         kx $cat >try.c <<EOP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #define FILE_ptr(fp)	$stdio_ptr
     5         kx #define FILE_cnt(fp)	$stdio_cnt
     5         kx int main() {
     5         kx 	FILE *fp = fopen("try.c", "r");
     5         kx 	char c = getc(fp);
     5         kx 	if (
     5         kx 		18 <= FILE_cnt(fp) &&
     5         kx 		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
     5         kx 	)
     5         kx 		exit(0);
     5         kx 	exit(1);
     5         kx }
     5         kx EOP
     5         kx val="$undef"
     5         kx set try
     5         kx if eval $compile && $to try.c; then
     5         kx 	if $run ./try; then
     5         kx 		echo "Your stdio acts pretty std."
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "Your stdio isn't very std."
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your stdio doesn't appear very std."
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx # glibc 2.2.90 and above apparently change stdio streams so Perl's
     5         kx # direct buffer manipulation no longer works.  The Configure tests
     5         kx # should be changed to correctly detect this, but until then,
     5         kx # the following check should at least let perl compile and run.
     5         kx # (This quick fix should be updated before 5.8.1.)
     5         kx # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
     5         kx # A. Dougherty, June 3, 2002.
     5         kx case "$d_gnulibc" in
     5         kx $define)
     5         kx 	case "$gnulibc_version" in
     5         kx 	2.[01]*)  ;;
     5         kx 	2.2) ;;
     5         kx 	2.2.[0-9]) ;;
     5         kx 	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
     5         kx 		val="$undef"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_stdstdio
     5         kx eval $setvar
     5         kx 
     5         kx : Can _ptr be used as an lvalue?
     5         kx case "$d_stdstdio$ptr_lval" in
     5         kx $define$define) val=$define ;;
     5         kx *) val=$undef ;;
     5         kx esac
     5         kx set d_stdio_ptr_lval
     5         kx eval $setvar
     5         kx 
     5         kx : Can _cnt be used as an lvalue?
     5         kx case "$d_stdstdio$cnt_lval" in
     5         kx $define$define) val=$define ;;
     5         kx *) val=$undef ;;
     5         kx esac
     5         kx set d_stdio_cnt_lval
     5         kx eval $setvar
     5         kx 
     5         kx 
     5         kx : test whether setting _ptr sets _cnt as a side effect
     5         kx d_stdio_ptr_lval_sets_cnt="$undef"
     5         kx d_stdio_ptr_lval_nochange_cnt="$undef"
     5         kx case "$d_stdio_ptr_lval$d_stdstdio" in
     5         kx $define$define)
     5         kx 	echo "Checking to see what happens if we set the stdio ptr..." >&4
     5         kx $cat >try.c <<EOP
     5         kx #include <stdio.h>
     5         kx /* Can we scream? */
     5         kx /* Eat dust sed :-) */
     5         kx /* In the buffer space, no one can hear you scream. */
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #define FILE_ptr(fp)	$stdio_ptr
     5         kx #define FILE_cnt(fp)	$stdio_cnt
     5         kx #include <sys/types.h>
     5         kx int main() {
     5         kx 	FILE *fp = fopen("try.c", "r");
     5         kx 	int c;
     5         kx 	char *ptr;
     5         kx 	size_t cnt;
     5         kx 	if (!fp) {
     5         kx 	    puts("Fail even to read");
     5         kx 	    exit(1);
     5         kx 	}
     5         kx 	c = getc(fp); /* Read away the first # */
     5         kx 	if (c == EOF) {
     5         kx 	    puts("Fail even to read");
     5         kx 	    exit(1);
     5         kx 	}
     5         kx 	if (!(
     5         kx 		18 <= FILE_cnt(fp) &&
     5         kx 		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
     5         kx 	)) {
     5         kx 		puts("Fail even to read");
     5         kx 		exit (1);
     5         kx 	}
     5         kx 	ptr = (char*) FILE_ptr(fp);
     5         kx 	cnt = (size_t)FILE_cnt(fp);
     5         kx 
     5         kx 	FILE_ptr(fp) += 42;
     5         kx 
     5         kx 	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
     5         kx 		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
     5         kx 		exit (1);
     5         kx 	}
     5         kx 	if (FILE_cnt(fp) <= 20) {
     5         kx 		printf ("Fail (<20 chars to test)");
     5         kx 		exit (1);
     5         kx 	}
     5         kx 	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
     5         kx 		puts("Fail compare");
     5         kx 		exit (1);
     5         kx 	}
     5         kx 	if (cnt == FILE_cnt(fp)) {
     5         kx 		puts("Pass_unchanged");
     5         kx 		exit (0);
     5         kx 	}
     5         kx 	if (FILE_cnt(fp) == (cnt - 42)) {
     5         kx 		puts("Pass_changed");
     5         kx 		exit (0);
     5         kx 	}
     5         kx 	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
     5         kx 	return 1;
     5         kx 
     5         kx }
     5         kx EOP
     5         kx 	set try
     5         kx 	if eval $compile && $to try.c; then
     5         kx 		case `$run ./try` in
     5         kx 		Pass_changed)
     5         kx 			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
     5         kx 			d_stdio_ptr_lval_sets_cnt="$define" ;;
     5         kx 		Pass_unchanged)
     5         kx 			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
     5         kx 			d_stdio_ptr_lval_nochange_cnt="$define" ;;
     5         kx 		Fail*)
     5         kx 			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
     5         kx 		*)
     5         kx 			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
     5         kx 	esac
     5         kx 	else
     5         kx 		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if _base is also standard
     5         kx val="$undef"
     5         kx case "$d_stdstdio" in
     5         kx $define)
     5         kx 	$cat >try.c <<EOP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #define FILE_base(fp)	$stdio_base
     5         kx #define FILE_bufsiz(fp)	$stdio_bufsiz
     5         kx int main() {
     5         kx 	FILE *fp = fopen("try.c", "r");
     5         kx 	char c = getc(fp);
     5         kx 	if (
     5         kx 		19 <= FILE_bufsiz(fp) &&
     5         kx 		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
     5         kx 	)
     5         kx 		exit(0);
     5         kx 	exit(1);
     5         kx }
     5         kx EOP
     5         kx 	set try
     5         kx 	if eval $compile && $to try.c; then
     5         kx 		if $run ./try; then
     5         kx 			echo "And its _base field acts std."
     5         kx 			val="$define"
     5         kx 		else
     5         kx 			echo "But its _base field isn't std."
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "However, it seems to be lacking the _base field."
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx set d_stdiobase
     5         kx eval $setvar
     5         kx 
     5         kx : see if fast_stdio exists
     5         kx val="$undef"
     5         kx case "$d_stdstdio:$d_stdio_ptr_lval" in
     5         kx "$define:$define")
     5         kx 	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
     5         kx 	*$define*)
     5         kx 		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
     5         kx 		val="$define"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_faststdio
     5         kx eval $setvar
     5         kx 
     5         kx : see if fchdir exists
     5         kx set fchdir d_fchdir
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fchmod exists
     5         kx set fchmod d_fchmod
     5         kx eval $inlibc
     5         kx 
     5         kx : check for openat, unlinkat, renameat, linkat, fchmodat
     5         kx set openat d_openat
     5         kx eval $inlibc
     5         kx 
     5         kx set unlinkat d_unlinkat
     5         kx eval $inlibc
     5         kx 
     5         kx set renameat d_renameat
     5         kx eval $inlibc
     5         kx 
     5         kx set linkat d_linkat
     5         kx eval $inlibc
     5         kx 
     5         kx set fchmodat d_fchmodat
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fchown exists
     5         kx set fchown d_fchown
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is an fcntl system
     5         kx set fcntl d_fcntl
     5         kx eval $inlibc
     5         kx 
     5         kx : See if fcntl-based locking works.
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <unistd.h>
     5         kx #include <fcntl.h>
     5         kx #include <signal.h>
     5         kx $signal_t blech(int x) { exit(3); }
     5         kx int main() {
     5         kx #if defined(F_SETLK) && defined(F_SETLKW)
     5         kx      struct flock flock;
     5         kx      int retval, fd;
     5         kx      fd = open("try.c", O_RDONLY);
     5         kx      flock.l_type = F_RDLCK;
     5         kx      flock.l_whence = SEEK_SET;
     5         kx      flock.l_start = flock.l_len = 0;
     5         kx      signal(SIGALRM, blech);
     5         kx      alarm(10);
     5         kx      retval = fcntl(fd, F_SETLK, &flock);
     5         kx      close(fd);
     5         kx      (retval < 0 ? exit(2) : exit(0));
     5         kx #else
     5         kx      exit(2);
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx echo "Checking if fcntl-based file locking works... "
     5         kx case "$d_fcntl" in
     5         kx "$define")
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		if $run ./try; then
     5         kx 			echo "Yes, it seems to work."
     5         kx 			val="$define"
     5         kx 		else
     5         kx 			echo "Nope, it didn't work."
     5         kx 			val="$undef"
     5         kx 			case "$?" in
     5         kx 			3) $cat >&4 <<EOM
     5         kx ***
     5         kx *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
     5         kx *** This is (almost) impossible.
     5         kx *** If your NFS lock daemons are not feeling well, something like
     5         kx *** this may happen, please investigate.  Cannot continue, aborting.
     5         kx ***
     5         kx EOM
     5         kx 				exit 1
     5         kx 				;;
     5         kx 			esac
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "I'm unable to compile the test program, so I'll assume not."
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx *) val="$undef";
     5         kx 	echo "Nope, since you don't even have fcntl()."
     5         kx 	;;
     5         kx esac
     5         kx set d_fcntl_can_lock
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : check for fd_set items
     5         kx $cat <<EOM
     5         kx 
     5         kx Checking to see how well your C compiler handles fd_set and friends ...
     5         kx EOM
     5         kx $cat >try.c <<EOCP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_systime I_SYS_TIME
     5         kx #$i_sysselct I_SYS_SELECT
     5         kx #$d_socket HAS_SOCKET
     5         kx #include <sys/types.h>
     5         kx #ifdef HAS_SOCKET
     5         kx #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
     5         kx #endif
     5         kx #ifdef I_SYS_TIME
     5         kx #include <sys/time.h>
     5         kx #endif
     5         kx #ifdef I_SYS_SELECT
     5         kx #include <sys/select.h>
     5         kx #endif
     5         kx int main() {
     5         kx 	fd_set fds;
     5         kx 
     5         kx #ifdef TRYBITS
     5         kx 	if(fds.fds_bits);
     5         kx #endif
     5         kx 
     5         kx #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
     5         kx 	exit(0);
     5         kx #else
     5         kx 	exit(1);
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx set try -DTRYBITS
     5         kx if eval $compile; then
     5         kx 	d_fds_bits="$define"
     5         kx 	d_fd_set="$define"
     5         kx 	echo "Well, your system knows about the normal fd_set typedef..." >&4
     5         kx 	if $run ./try; then
     5         kx 		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
     5         kx 		d_fd_macros="$define"
     5         kx 	else
     5         kx 		$cat >&4 <<'EOM'
     5         kx but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
     5         kx EOM
     5         kx 		d_fd_macros="$undef"
     5         kx 	fi
     5         kx else
     5         kx 	$cat <<'EOM'
     5         kx Hmm, your compiler has some difficulty with fd_set.  Checking further...
     5         kx EOM
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		d_fds_bits="$undef"
     5         kx 		d_fd_set="$define"
     5         kx 		echo "Well, your system has some sort of fd_set available..." >&4
     5         kx 		if $run ./try; then
     5         kx 			echo "and you have the normal fd_set macros." >&4
     5         kx 			d_fd_macros="$define"
     5         kx 		else
     5         kx 			$cat <<'EOM'
     5         kx but not the normal fd_set macros!  Gross!  More work for me...
     5         kx EOM
     5         kx 			d_fd_macros="$undef"
     5         kx 		fi
     5         kx 	else
     5         kx 	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
     5         kx 		d_fd_set="$undef"
     5         kx 		d_fds_bits="$undef"
     5         kx 		d_fd_macros="$undef"
     5         kx 	fi
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see if fdclose exists
     5         kx set fdclose d_fdclose
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fdim exists
     5         kx set fdim d_fdim
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fegetround exists
     5         kx set fegetround d_fegetround
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ffs exists
     5         kx set ffs d_ffs
     5         kx eval $inlibc
     5         kx : see if ffsl exists
     5         kx set ffsl d_ffsl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fgetpos exists
     5         kx set fgetpos d_fgetpos
     5         kx eval $inlibc
     5         kx 
     5         kx : see if finite exists
     5         kx set finite d_finite
     5         kx eval $inlibc
     5         kx 
     5         kx : see if finitel exists
     5         kx set finitel d_finitel
     5         kx eval $inlibc
     5         kx 
     5         kx : see if flock exists
     5         kx set flock d_flock
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for flock is available
     5         kx echo " "
     5         kx set d_flockproto flock $i_sysfile sys/file.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if fma exists
     5         kx set fma d_fma
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fmax exists
     5         kx set fmax d_fmax
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fmin exists
     5         kx set fmin d_fmin
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fp_class exists
     5         kx set fp_class d_fp_class
     5         kx eval $inlibc
     5         kx 
     5         kx : check for fpclassify
     5         kx echo "Checking to see if you have fpclassify..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have fpclassify."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have fpclassify."
     5         kx fi
     5         kx $rm_try
     5         kx set d_fpclassify
     5         kx eval $setvar
     5         kx 
     5         kx : see if fp_classify exists
     5         kx set fp_classify d_fp_classify
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fp_classl exists
     5         kx set fp_classl d_fp_classl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if pathconf exists
     5         kx set pathconf d_pathconf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fpathconf exists
     5         kx set fpathconf d_fpathconf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fpclass exists
     5         kx set fpclass d_fpclass
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fpclassl exists
     5         kx set fpclassl d_fpclassl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fpgetround exists
     5         kx set fpgetround d_fpgetround
     5         kx eval $inlibc
     5         kx 
     5         kx : check for fpos64_t
     5         kx echo " "
     5         kx echo "Checking to see if you have fpos64_t..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx int main() { fpos64_t x = 7; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have fpos64_t."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have fpos64_t."
     5         kx 	case "$fpossize" in
     5         kx 	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
     5         kx 	esac
     5         kx fi
     5         kx $rm_try
     5         kx set d_fpos64_t
     5         kx eval $setvar
     5         kx 
     5         kx : see if frexpl exists
     5         kx set frexpl d_frexpl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a sys/param system
     5         kx set sys/param.h i_sysparam
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/mount.h system
     5         kx set sys/mount.h i_sysmount
     5         kx eval $inhdr
     5         kx 
     5         kx : Check for fs_data_s
     5         kx echo " "
     5         kx echo "Checking to see if your system supports struct fs_data..." >&4
     5         kx set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
     5         kx eval $hasstruct
     5         kx case "$d_fs_data_s" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see if fseeko exists
     5         kx set fseeko d_fseeko
     5         kx eval $inlibc
     5         kx case "$longsize" in
     5         kx 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
     5         kx esac
     5         kx 
     5         kx : see if fsetpos exists
     5         kx set fsetpos d_fsetpos
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fstatfs exists
     5         kx set fstatfs d_fstatfs
     5         kx eval $inlibc
     5         kx 
     5         kx : see if statvfs exists
     5         kx set statvfs d_statvfs
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fstatvfs exists
     5         kx set fstatvfs d_fstatvfs
     5         kx eval $inlibc
     5         kx 
     5         kx : see if fsync exists
     5         kx set fsync d_fsync
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ftello exists
     5         kx set ftello d_ftello
     5         kx eval $inlibc
     5         kx case "$longsize" in
     5         kx 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
     5         kx esac
     5         kx 
     5         kx : check for a working futimes
     5         kx d_futimes="$undef"
     5         kx echo " "
     5         kx echo "Checking if you have a working futimes()" >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx #include <sys/time.h>
     5         kx #include <errno.h>
     5         kx #include <fcntl.h>
     5         kx #include <stdlib.h>
     5         kx 
     5         kx int main ()
     5         kx {
     5         kx     int fd, rv;
     5         kx     fd = open ("try.c", O_RDWR);
     5         kx     if (-1 == fd) exit (1);
     5         kx     rv = futimes (fd, NULL);
     5         kx     exit (rv == -1 ? errno : 0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     `$run ./try`
     5         kx     rc=$?
     5         kx     case "$rc" in
     5         kx 	0)  echo "Yes, you have" >&4
     5         kx 	    d_futimes="$define"
     5         kx 	    ;;
     5         kx 	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
     5         kx 	    ;;
     5         kx     esac
     5         kx else
     5         kx     echo "No, it does not (probably harmless)" >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : look for gai_strerror
     5         kx echo " "
     5         kx $cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <sys/socket.h>
     5         kx #include <netdb.h>
     5         kx int main ()
     5         kx {
     5         kx     return (gai_strerror (0) ? 0 : 1);
     5         kx     }
     5         kx EOCP
     5         kx set try
     5         kx val="$undef"
     5         kx if eval $compile; then
     5         kx     `$run ./try`
     5         kx     case "$?" in
     5         kx 	0)  echo "A working gai_strerror() found." >&4
     5         kx 	    val="$define" ;;
     5         kx 	*)  echo "gai_strerror() found, but it doesn't work" >&4
     5         kx 	    ;;
     5         kx 	esac
     5         kx else
     5         kx     echo "gai_strerror() NOT found." >&4
     5         kx     fi
     5         kx set d_gai_strerror
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if ndbm.h is available
     5         kx set ndbm.h i_ndbm
     5         kx eval $inhdr
     5         kx : Compatibility location for RedHat 7.1
     5         kx set gdbm/ndbm.h i_gdbmndbm
     5         kx eval $inhdr
     5         kx : Compatibility location for Debian 4.0
     5         kx set gdbm-ndbm.h i_gdbm_ndbm
     5         kx eval $inhdr
     5         kx 
     5         kx val="$undef"
     5         kx if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
     5         kx 	: see if dbm_open exists
     5         kx 	set dbm_open d_dbm_open
     5         kx 	eval $inlibc
     5         kx 	case "$d_dbm_open" in
     5         kx 	$undef)
     5         kx 		i_ndbm="$undef"
     5         kx 		i_gdbmndbm="$undef"
     5         kx 		i_gdbm_ndbm="$undef"
     5         kx 		echo "We won't be including <ndbm.h>"
     5         kx 		val="$undef"
     5         kx 		;;
     5         kx 	*) val="$define"
     5         kx 	   ;;
     5         kx 	esac
     5         kx fi
     5         kx set d_ndbm
     5         kx eval $setvar
     5         kx 
     5         kx ndbm_hdr_protochk='name=$1; hdr=$2;
     5         kx eval "ihdr=\$""i_$name";
     5         kx val="$undef";
     5         kx if $test "$ihdr" = "$define"; then
     5         kx 	$echo "Checking if your <$hdr> uses prototypes..." >&4;
     5         kx 	case "$d_cplusplus" in
     5         kx 	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
     5         kx 	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
     5         kx 	esac;
     5         kx 	case "$val" in
     5         kx 	$define) $echo "Your <$hdr> seems to have prototypes";;
     5         kx 	*) $echo "Your <$hdr> does not seem to have prototypes";;
     5         kx 	esac;
     5         kx fi;
     5         kx set "d_${name}_h_uses_prototypes";
     5         kx eval $setvar'
     5         kx 
     5         kx set ndbm ndbm.h
     5         kx eval $ndbm_hdr_protochk
     5         kx set gdbmndbm gdbm/ndbm.h
     5         kx eval $ndbm_hdr_protochk
     5         kx set gdbm_ndbm gdbm-ndbm.h
     5         kx eval $ndbm_hdr_protochk
     5         kx 
     5         kx : see if getaddrinfo exists
     5         kx set getaddrinfo d_getaddrinfo
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getcwd exists
     5         kx set getcwd d_getcwd
     5         kx eval $inlibc
     5         kx 
     5         kx : check for getenv behavior
     5         kx case "$d_getenv_preserves_other_thread" in
     5         kx '')
     5         kx $echo "Checking to see if getenv() preserves a different thread's results" >&4
     5         kx $cat >try.c <<EOCP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #  include <stdlib.h>
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx #include <string.h>
     5         kx #$i_pthread I_PTHREAD
     5         kx #ifdef I_PTHREAD
     5         kx #  include <pthread.h>
     5         kx #endif
     5         kx 
     5         kx void *
     5         kx thread_start(void * arg)
     5         kx {
     5         kx     return (void *) getenv("HOME");
     5         kx }
     5         kx 
     5         kx int main() {
     5         kx     char * main_buffer;
     5         kx     char save_main_buffer[1000];
     5         kx     pthread_t subthread;
     5         kx     pthread_attr_t attr;
     5         kx 
     5         kx     main_buffer = getenv("PATH");
     5         kx 
     5         kx     /* If too large for our generous allowance, return we couldn't figure it
     5         kx      * out. */
     5         kx     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
     5         kx         exit(2);
     5         kx     }
     5         kx 
     5         kx     strcpy(save_main_buffer, main_buffer);
     5         kx 
     5         kx     if (pthread_attr_init(&attr) != 0) {
     5         kx         exit(2);
     5         kx     }
     5         kx 
     5         kx     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
     5         kx         exit(2);
     5         kx     }
     5         kx 
     5         kx     if (pthread_join(subthread, NULL) != 0) {
     5         kx         exit(2);
     5         kx     }
     5         kx 
     5         kx     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
     5         kx }
     5         kx EOCP
     5         kx val=
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx     $run ./try
     5         kx     rc=$?
     5         kx     case "$rc" in
     5         kx 	0) echo "getenv() didn't destroy another thread's buffer" >&4
     5         kx 	   val=$define
     5         kx 	   ;;
     5         kx 	1) echo "getenv() does destroy another thread's buffer" >&4
     5         kx 	   val=$undef
     5         kx 	   ;;
     5         kx 	*) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
     5         kx 	   val=$undef
     5         kx 	   ;;
     5         kx     esac
     5         kx else
     5         kx     echo "(I can't seem to compile the test program.)" >&4
     5         kx     echo "Assuming that your C library's getenv destroys another thread's return value." >&4
     5         kx     val=$undef
     5         kx fi
     5         kx set d_getenv_preserves_other_thread
     5         kx eval $setvar
     5         kx $rm_try
     5         kx ;;
     5         kx esac
     5         kx 
     5         kx : see if getespwnam exists
     5         kx set getespwnam d_getespwnam
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getfsstat exists
     5         kx set getfsstat d_getfsstat
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getgrent exists
     5         kx set getgrent d_getgrent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getgrent_r exists
     5         kx set getgrent_r d_getgrent_r
     5         kx eval $inlibc
     5         kx case "$d_getgrent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
     5         kx 	case "$d_getgrent_r_proto:$usethreads" in
     5         kx 	":define")	d_getgrent_r_proto=define
     5         kx 		set d_getgrent_r_proto getgrent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getgrent_r_proto" in
     5         kx 	define)
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='int getgrent_r(struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
     5         kx 	esac
     5         kx 	case "$getgrent_r_proto" in
     5         kx 	''|0)	d_getgrent_r=undef
     5         kx 		getgrent_r_proto=0
     5         kx 		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getgrent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getgrent_r=undef
     5         kx 		getgrent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getgrent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getgrgid_r exists
     5         kx set getgrgid_r d_getgrgid_r
     5         kx eval $inlibc
     5         kx case "$d_getgrgid_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
     5         kx 	case "$d_getgrgid_r_proto:$usethreads" in
     5         kx 	":define")	d_getgrgid_r_proto=define
     5         kx 		set d_getgrgid_r_proto getgrgid_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getgrgid_r_proto" in
     5         kx 	define)
     5         kx 	case "$getgrgid_r_proto" in
     5         kx 	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
     5         kx 	esac
     5         kx 	case "$getgrgid_r_proto" in
     5         kx 	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
     5         kx 	esac
     5         kx 	case "$getgrgid_r_proto" in
     5         kx 	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
     5         kx 	esac
     5         kx 	case "$getgrgid_r_proto" in
     5         kx 	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
     5         kx 	esac
     5         kx 	case "$getgrgid_r_proto" in
     5         kx 	''|0)	d_getgrgid_r=undef
     5         kx 		getgrgid_r_proto=0
     5         kx 		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getgrgid_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getgrgid_r=undef
     5         kx 		getgrgid_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getgrgid_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getgrnam_r exists
     5         kx set getgrnam_r d_getgrnam_r
     5         kx eval $inlibc
     5         kx case "$d_getgrnam_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
     5         kx 	case "$d_getgrnam_r_proto:$usethreads" in
     5         kx 	":define")	d_getgrnam_r_proto=define
     5         kx 		set d_getgrnam_r_proto getgrnam_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getgrnam_r_proto" in
     5         kx 	define)
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
     5         kx 	esac
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
     5         kx 	esac
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
     5         kx 	esac
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getgrnam_r_proto" in
     5         kx 	''|0)	d_getgrnam_r=undef
     5         kx 		getgrnam_r_proto=0
     5         kx 		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getgrnam_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getgrnam_r=undef
     5         kx 		getgrnam_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getgrnam_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if gethostbyaddr exists
     5         kx set gethostbyaddr d_gethbyaddr
     5         kx eval $inlibc
     5         kx 
     5         kx : see if gethostbyname exists
     5         kx set gethostbyname d_gethbyname
     5         kx eval $inlibc
     5         kx 
     5         kx : see if gethostent exists
     5         kx set gethostent d_gethent
     5         kx eval $inlibc
     5         kx 
     5         kx : see how we will look up host name
     5         kx echo " "
     5         kx call=''
     5         kx if set gethostname val -f d_gethname; eval $csym; $val; then
     5         kx 	echo 'gethostname() found.' >&4
     5         kx 	d_gethname="$define"
     5         kx 	call=gethostname
     5         kx fi
     5         kx if set uname val -f d_uname; eval $csym; $val; then
     5         kx 	if ./xenix; then
     5         kx 		$cat <<'EOM'
     5         kx uname() was found, but you're running xenix, and older versions of xenix
     5         kx have a broken uname(). If you don't really know whether your xenix is old
     5         kx enough to have a broken system call, use the default answer.
     5         kx 
     5         kx EOM
     5         kx 		dflt=y
     5         kx 		case "$d_uname" in
     5         kx 		"$define") dflt=n;;
     5         kx 		esac
     5         kx 		rp='Is your uname() broken?'
     5         kx 		. ./myread
     5         kx 		case "$ans" in
     5         kx 		n*) d_uname="$define"; call=uname;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo 'uname() found.' >&4
     5         kx 		d_uname="$define"
     5         kx 		case "$call" in
     5         kx 		'') call=uname ;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx case "$d_gethname" in
     5         kx '') d_gethname="$undef";;
     5         kx esac
     5         kx case "$d_uname" in
     5         kx '') d_uname="$undef";;
     5         kx esac
     5         kx case "$d_uname$d_gethname" in
     5         kx *define*)
     5         kx 	dflt=n
     5         kx 	cat <<EOM
     5         kx 
     5         kx Every now and then someone has a $call() that lies about the hostname
     5         kx but can't be fixed for political or economic reasons.  If you wish, I can
     5         kx pretend $call() isn't there and maybe compute hostname at run-time
     5         kx thanks to the '$phostname' command.
     5         kx 
     5         kx EOM
     5         kx 	rp="Shall I ignore $call() from now on?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
     5         kx 	esac;;
     5         kx esac
     5         kx case "$phostname" in
     5         kx '') aphostname='';;
     5         kx *) case "$aphostname" in
     5         kx 	/*) ;;
     5         kx 	*) set X $phostname
     5         kx 		shift
     5         kx 		file=$1
     5         kx 		shift
     5         kx 		file=`./loc $file $file $pth`
     5         kx 		aphostname=`echo $file $*`
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$d_uname$d_gethname" in
     5         kx *define*) ;;
     5         kx *)
     5         kx 	case "$phostname" in
     5         kx 	'')
     5         kx 		echo "There will be no way for $package to get your hostname." >&4;;
     5         kx 	*)
     5         kx 	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
     5         kx 		;;
     5         kx 	esac;;
     5         kx esac
     5         kx case "$d_phostname" in
     5         kx '') d_phostname="$undef";;
     5         kx esac
     5         kx 
     5         kx : see if gethostbyaddr_r exists
     5         kx set gethostbyaddr_r d_gethostbyaddr_r
     5         kx eval $inlibc
     5         kx case "$d_gethostbyaddr_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_gethostbyaddr_r_proto:$usethreads" in
     5         kx 	":define")	d_gethostbyaddr_r_proto=define
     5         kx 		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_gethostbyaddr_r_proto" in
     5         kx 	define)
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='int gethostbyaddr_r(const char*, int, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyaddr_r_proto" in
     5         kx 	''|0)	d_gethostbyaddr_r=undef
     5         kx 		gethostbyaddr_r_proto=0
     5         kx 		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$gethostbyaddr_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_gethostbyaddr_r=undef
     5         kx 		gethostbyaddr_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	gethostbyaddr_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if gethostbyname_r exists
     5         kx set gethostbyname_r d_gethostbyname_r
     5         kx eval $inlibc
     5         kx case "$d_gethostbyname_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_gethostbyname_r_proto:$usethreads" in
     5         kx 	":define")	d_gethostbyname_r_proto=define
     5         kx 		set d_gethostbyname_r_proto gethostbyname_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_gethostbyname_r_proto" in
     5         kx 	define)
     5         kx 	case "$gethostbyname_r_proto" in
     5         kx 	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyname_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostbyname_r_proto" in
     5         kx 	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
     5         kx 	esac
     5         kx 	case "$gethostbyname_r_proto" in
     5         kx 	''|0)	d_gethostbyname_r=undef
     5         kx 		gethostbyname_r_proto=0
     5         kx 		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$gethostbyname_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_gethostbyname_r=undef
     5         kx 		gethostbyname_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	gethostbyname_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if gethostent_r exists
     5         kx set gethostent_r d_gethostent_r
     5         kx eval $inlibc
     5         kx case "$d_gethostent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_gethostent_r_proto:$usethreads" in
     5         kx 	":define")	d_gethostent_r_proto=define
     5         kx 		set d_gethostent_r_proto gethostent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_gethostent_r_proto" in
     5         kx 	define)
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='int gethostent_r(struct hostent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
     5         kx 	esac
     5         kx 	case "$gethostent_r_proto" in
     5         kx 	''|0)	d_gethostent_r=undef
     5         kx 		gethostent_r_proto=0
     5         kx 		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$gethostent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_gethostent_r=undef
     5         kx 		gethostent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	gethostent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototypes for various gethostxxx netdb.h functions are available
     5         kx echo " "
     5         kx set d_gethostprotos gethostent $i_netdb netdb.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if getitimer exists
     5         kx set getitimer d_getitimer
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getlogin exists
     5         kx set getlogin d_getlogin
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getlogin_r exists
     5         kx set getlogin_r d_getlogin_r
     5         kx eval $inlibc
     5         kx case "$d_getlogin_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
     5         kx 	case "$d_getlogin_r_proto:$usethreads" in
     5         kx 	":define")	d_getlogin_r_proto=define
     5         kx 		set d_getlogin_r_proto getlogin_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getlogin_r_proto" in
     5         kx 	define)
     5         kx 	case "$getlogin_r_proto" in
     5         kx 	''|0) try='int getlogin_r(char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
     5         kx 	esac
     5         kx 	case "$getlogin_r_proto" in
     5         kx 	''|0) try='int getlogin_r(char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
     5         kx 	esac
     5         kx 	case "$getlogin_r_proto" in
     5         kx 	''|0) try='char* getlogin_r(char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
     5         kx 	esac
     5         kx 	case "$getlogin_r_proto" in
     5         kx 	''|0) try='char* getlogin_r(char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
     5         kx 	esac
     5         kx 	case "$getlogin_r_proto" in
     5         kx 	''|0)	d_getlogin_r=undef
     5         kx 		getlogin_r_proto=0
     5         kx 		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getlogin_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getlogin_r=undef
     5         kx 		getlogin_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getlogin_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getmnt exists
     5         kx set getmnt d_getmnt
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getmntent exists
     5         kx set getmntent d_getmntent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getnameinfo exists
     5         kx set getnameinfo d_getnameinfo
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getnetbyaddr exists
     5         kx set getnetbyaddr d_getnbyaddr
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getnetbyname exists
     5         kx set getnetbyname d_getnbyname
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getnetent exists
     5         kx set getnetent d_getnent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getnetbyaddr_r exists
     5         kx set getnetbyaddr_r d_getnetbyaddr_r
     5         kx eval $inlibc
     5         kx case "$d_getnetbyaddr_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getnetbyaddr_r_proto:$usethreads" in
     5         kx 	":define")	d_getnetbyaddr_r_proto=define
     5         kx 		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getnetbyaddr_r_proto" in
     5         kx 	define)
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
     5         kx 	esac
     5         kx 	case "$getnetbyaddr_r_proto" in
     5         kx 	''|0)	d_getnetbyaddr_r=undef
     5         kx 		getnetbyaddr_r_proto=0
     5         kx 		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getnetbyaddr_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getnetbyaddr_r=undef
     5         kx 		getnetbyaddr_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getnetbyaddr_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getnetbyname_r exists
     5         kx set getnetbyname_r d_getnetbyname_r
     5         kx eval $inlibc
     5         kx case "$d_getnetbyname_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getnetbyname_r_proto:$usethreads" in
     5         kx 	":define")	d_getnetbyname_r_proto=define
     5         kx 		set d_getnetbyname_r_proto getnetbyname_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getnetbyname_r_proto" in
     5         kx 	define)
     5         kx 	case "$getnetbyname_r_proto" in
     5         kx 	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
     5         kx 	esac
     5         kx 	case "$getnetbyname_r_proto" in
     5         kx 	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getnetbyname_r_proto" in
     5         kx 	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getnetbyname_r_proto" in
     5         kx 	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
     5         kx 	esac
     5         kx 	case "$getnetbyname_r_proto" in
     5         kx 	''|0)	d_getnetbyname_r=undef
     5         kx 		getnetbyname_r_proto=0
     5         kx 		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getnetbyname_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getnetbyname_r=undef
     5         kx 		getnetbyname_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getnetbyname_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getnetent_r exists
     5         kx set getnetent_r d_getnetent_r
     5         kx eval $inlibc
     5         kx case "$d_getnetent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getnetent_r_proto:$usethreads" in
     5         kx 	":define")	d_getnetent_r_proto=define
     5         kx 		set d_getnetent_r_proto getnetent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getnetent_r_proto" in
     5         kx 	define)
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='int getnetent_r(struct netent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
     5         kx 	esac
     5         kx 	case "$getnetent_r_proto" in
     5         kx 	''|0)	d_getnetent_r=undef
     5         kx 		getnetent_r_proto=0
     5         kx 		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getnetent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getnetent_r=undef
     5         kx 		getnetent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getnetent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototypes for various getnetxxx netdb.h functions are available
     5         kx echo " "
     5         kx set d_getnetprotos getnetent $i_netdb netdb.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if getpagesize exists
     5         kx set getpagesize d_getpagsz
     5         kx eval $inlibc
     5         kx 
     5         kx : Optional checks for getprotobyname and getprotobynumber
     5         kx 
     5         kx : see if getprotobyname exists
     5         kx set getprotobyname d_getpbyname
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getprotobynumber exists
     5         kx set getprotobynumber d_getpbynumber
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getprotoent exists
     5         kx set getprotoent d_getpent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getpgid exists
     5         kx set getpgid d_getpgid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getpgrp2 exists
     5         kx set getpgrp2 d_getpgrp2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getppid exists
     5         kx set getppid d_getppid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getpriority exists
     5         kx set getpriority d_getprior
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getprotobyname_r exists
     5         kx set getprotobyname_r d_getprotobyname_r
     5         kx eval $inlibc
     5         kx case "$d_getprotobyname_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getprotobyname_r_proto:$usethreads" in
     5         kx 	":define")	d_getprotobyname_r_proto=define
     5         kx 		set d_getprotobyname_r_proto getprotobyname_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getprotobyname_r_proto" in
     5         kx 	define)
     5         kx 	case "$getprotobyname_r_proto" in
     5         kx 	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
     5         kx 	esac
     5         kx 	case "$getprotobyname_r_proto" in
     5         kx 	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getprotobyname_r_proto" in
     5         kx 	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
     5         kx 	esac
     5         kx 	case "$getprotobyname_r_proto" in
     5         kx 	''|0)	d_getprotobyname_r=undef
     5         kx 		getprotobyname_r_proto=0
     5         kx 		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getprotobyname_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getprotobyname_r=undef
     5         kx 		getprotobyname_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getprotobyname_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getprotobynumber_r exists
     5         kx set getprotobynumber_r d_getprotobynumber_r
     5         kx eval $inlibc
     5         kx case "$d_getprotobynumber_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getprotobynumber_r_proto:$usethreads" in
     5         kx 	":define")	d_getprotobynumber_r_proto=define
     5         kx 		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getprotobynumber_r_proto" in
     5         kx 	define)
     5         kx 	case "$getprotobynumber_r_proto" in
     5         kx 	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
     5         kx 	esac
     5         kx 	case "$getprotobynumber_r_proto" in
     5         kx 	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
     5         kx 	esac
     5         kx 	case "$getprotobynumber_r_proto" in
     5         kx 	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
     5         kx 	esac
     5         kx 	case "$getprotobynumber_r_proto" in
     5         kx 	''|0)	d_getprotobynumber_r=undef
     5         kx 		getprotobynumber_r_proto=0
     5         kx 		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getprotobynumber_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getprotobynumber_r=undef
     5         kx 		getprotobynumber_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getprotobynumber_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getprotoent_r exists
     5         kx set getprotoent_r d_getprotoent_r
     5         kx eval $inlibc
     5         kx case "$d_getprotoent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getprotoent_r_proto:$usethreads" in
     5         kx 	":define")	d_getprotoent_r_proto=define
     5         kx 		set d_getprotoent_r_proto getprotoent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getprotoent_r_proto" in
     5         kx 	define)
     5         kx 	case "$getprotoent_r_proto" in
     5         kx 	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
     5         kx 	esac
     5         kx 	case "$getprotoent_r_proto" in
     5         kx 	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$getprotoent_r_proto" in
     5         kx 	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$getprotoent_r_proto" in
     5         kx 	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
     5         kx 	esac
     5         kx 	case "$getprotoent_r_proto" in
     5         kx 	''|0)	d_getprotoent_r=undef
     5         kx 		getprotoent_r_proto=0
     5         kx 		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getprotoent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getprotoent_r=undef
     5         kx 		getprotoent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getprotoent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototypes for various getprotoxxx netdb.h functions are available
     5         kx echo " "
     5         kx set d_getprotoprotos getprotoent $i_netdb netdb.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if getprpwnam exists
     5         kx set getprpwnam d_getprpwnam
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getpwent exists
     5         kx set getpwent d_getpwent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getpwent_r exists
     5         kx set getpwent_r d_getpwent_r
     5         kx eval $inlibc
     5         kx case "$d_getpwent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
     5         kx 	case "$d_getpwent_r_proto:$usethreads" in
     5         kx 	":define")	d_getpwent_r_proto=define
     5         kx 		set d_getpwent_r_proto getpwent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getpwent_r_proto" in
     5         kx 	define)
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='int getpwent_r(struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
     5         kx 	esac
     5         kx 	case "$getpwent_r_proto" in
     5         kx 	''|0)	d_getpwent_r=undef
     5         kx 		getpwent_r_proto=0
     5         kx 		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getpwent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getpwent_r=undef
     5         kx 		getpwent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getpwent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getpwnam_r exists
     5         kx set getpwnam_r d_getpwnam_r
     5         kx eval $inlibc
     5         kx case "$d_getpwnam_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
     5         kx 	case "$d_getpwnam_r_proto:$usethreads" in
     5         kx 	":define")	d_getpwnam_r_proto=define
     5         kx 		set d_getpwnam_r_proto getpwnam_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getpwnam_r_proto" in
     5         kx 	define)
     5         kx 	case "$getpwnam_r_proto" in
     5         kx 	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
     5         kx 	esac
     5         kx 	case "$getpwnam_r_proto" in
     5         kx 	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
     5         kx 	esac
     5         kx 	case "$getpwnam_r_proto" in
     5         kx 	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getpwnam_r_proto" in
     5         kx 	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getpwnam_r_proto" in
     5         kx 	''|0)	d_getpwnam_r=undef
     5         kx 		getpwnam_r_proto=0
     5         kx 		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getpwnam_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getpwnam_r=undef
     5         kx 		getpwnam_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getpwnam_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getpwuid_r exists
     5         kx set getpwuid_r d_getpwuid_r
     5         kx eval $inlibc
     5         kx case "$d_getpwuid_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
     5         kx 	case "$d_getpwuid_r_proto:$usethreads" in
     5         kx 	":define")	d_getpwuid_r_proto=define
     5         kx 		set d_getpwuid_r_proto getpwuid_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getpwuid_r_proto" in
     5         kx 	define)
     5         kx 	case "$getpwuid_r_proto" in
     5         kx 	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
     5         kx 	esac
     5         kx 	case "$getpwuid_r_proto" in
     5         kx 	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
     5         kx 	esac
     5         kx 	case "$getpwuid_r_proto" in
     5         kx 	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
     5         kx 	esac
     5         kx 	case "$getpwuid_r_proto" in
     5         kx 	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
     5         kx 	esac
     5         kx 	case "$getpwuid_r_proto" in
     5         kx 	''|0)	d_getpwuid_r=undef
     5         kx 		getpwuid_r_proto=0
     5         kx 		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getpwuid_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getpwuid_r=undef
     5         kx 		getpwuid_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getpwuid_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Optional checks for getsbyname and getsbyport
     5         kx 
     5         kx : see if getservbyname exists
     5         kx set getservbyname d_getsbyname
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getservbyport exists
     5         kx set getservbyport d_getsbyport
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getservent exists
     5         kx set getservent d_getsent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if getservbyname_r exists
     5         kx set getservbyname_r d_getservbyname_r
     5         kx eval $inlibc
     5         kx case "$d_getservbyname_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getservbyname_r_proto:$usethreads" in
     5         kx 	":define")	d_getservbyname_r_proto=define
     5         kx 		set d_getservbyname_r_proto getservbyname_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getservbyname_r_proto" in
     5         kx 	define)
     5         kx 	case "$getservbyname_r_proto" in
     5         kx 	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
     5         kx 	esac
     5         kx 	case "$getservbyname_r_proto" in
     5         kx 	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
     5         kx 	esac
     5         kx 	case "$getservbyname_r_proto" in
     5         kx 	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
     5         kx 	esac
     5         kx 	case "$getservbyname_r_proto" in
     5         kx 	''|0)	d_getservbyname_r=undef
     5         kx 		getservbyname_r_proto=0
     5         kx 		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getservbyname_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getservbyname_r=undef
     5         kx 		getservbyname_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getservbyname_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getservbyport_r exists
     5         kx set getservbyport_r d_getservbyport_r
     5         kx eval $inlibc
     5         kx case "$d_getservbyport_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getservbyport_r_proto:$usethreads" in
     5         kx 	":define")	d_getservbyport_r_proto=define
     5         kx 		set d_getservbyport_r_proto getservbyport_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getservbyport_r_proto" in
     5         kx 	define)
     5         kx 	case "$getservbyport_r_proto" in
     5         kx 	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
     5         kx 	esac
     5         kx 	case "$getservbyport_r_proto" in
     5         kx 	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
     5         kx 	esac
     5         kx 	case "$getservbyport_r_proto" in
     5         kx 	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
     5         kx 	esac
     5         kx 	case "$getservbyport_r_proto" in
     5         kx 	''|0)	d_getservbyport_r=undef
     5         kx 		getservbyport_r_proto=0
     5         kx 		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getservbyport_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getservbyport_r=undef
     5         kx 		getservbyport_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getservbyport_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getservent_r exists
     5         kx set getservent_r d_getservent_r
     5         kx eval $inlibc
     5         kx case "$d_getservent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_getservent_r_proto:$usethreads" in
     5         kx 	":define")	d_getservent_r_proto=define
     5         kx 		set d_getservent_r_proto getservent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getservent_r_proto" in
     5         kx 	define)
     5         kx 	case "$getservent_r_proto" in
     5         kx 	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
     5         kx 	esac
     5         kx 	case "$getservent_r_proto" in
     5         kx 	''|0) try='int getservent_r(struct servent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
     5         kx 	esac
     5         kx 	case "$getservent_r_proto" in
     5         kx 	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
     5         kx 	esac
     5         kx 	case "$getservent_r_proto" in
     5         kx 	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
     5         kx 	esac
     5         kx 	case "$getservent_r_proto" in
     5         kx 	''|0)	d_getservent_r=undef
     5         kx 		getservent_r_proto=0
     5         kx 		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getservent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getservent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getservent_r=undef
     5         kx 		getservent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getservent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototypes for various getservxxx netdb.h functions are available
     5         kx echo " "
     5         kx set d_getservprotos getservent $i_netdb netdb.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if getspnam exists
     5         kx set getspnam d_getspnam
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a shadow.h system
     5         kx set shadow.h i_shadow
     5         kx eval $inhdr
     5         kx 
     5         kx : see if getspnam_r exists
     5         kx set getspnam_r d_getspnam_r
     5         kx eval $inlibc
     5         kx case "$d_getspnam_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
     5         kx 	case "$d_getspnam_r_proto:$usethreads" in
     5         kx 	":define")	d_getspnam_r_proto=define
     5         kx 		set d_getspnam_r_proto getspnam_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_getspnam_r_proto" in
     5         kx 	define)
     5         kx 	case "$getspnam_r_proto" in
     5         kx 	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
     5         kx 	esac
     5         kx 	case "$getspnam_r_proto" in
     5         kx 	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
     5         kx 	esac
     5         kx 	case "$getspnam_r_proto" in
     5         kx 	''|0)	d_getspnam_r=undef
     5         kx 		getspnam_r_proto=0
     5         kx 		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$getspnam_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_getspnam_r=undef
     5         kx 		getspnam_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	getspnam_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if gettimeofday or ftime exists
     5         kx set gettimeofday d_gettimeod
     5         kx eval $inlibc
     5         kx case "$d_gettimeod" in
     5         kx "$undef")
     5         kx 	set ftime d_ftime 
     5         kx 	eval $inlibc
     5         kx 	;;
     5         kx *)
     5         kx 	val="$undef"; set d_ftime; eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx case "$d_gettimeod$d_ftime" in
     5         kx "$undef$undef")
     5         kx 	echo " "
     5         kx 	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if gmtime_r exists
     5         kx set gmtime_r d_gmtime_r
     5         kx eval $inlibc
     5         kx case "$d_gmtime_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
     5         kx 	case "$d_gmtime_r_proto:$usethreads" in
     5         kx 	":define")	d_gmtime_r_proto=define
     5         kx 		set d_gmtime_r_proto gmtime_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_gmtime_r_proto" in
     5         kx 	define)
     5         kx 	case "$gmtime_r_proto" in
     5         kx 	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
     5         kx 	esac
     5         kx 	case "$gmtime_r_proto" in
     5         kx 	''|0) try='int gmtime_r(const time_t*, struct tm*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
     5         kx 	esac
     5         kx 	case "$gmtime_r_proto" in
     5         kx 	''|0)	d_gmtime_r=undef
     5         kx 		gmtime_r_proto=0
     5         kx 		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$gmtime_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_gmtime_r=undef
     5         kx 		gmtime_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	gmtime_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if hasmntopt exists
     5         kx set hasmntopt d_hasmntopt
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a netinet/in.h or sys/in.h system
     5         kx set netinet/in.h i_niin sys/in.h i_sysin
     5         kx eval $inhdr
     5         kx 
     5         kx : see if arpa/inet.h has to be included
     5         kx set arpa/inet.h i_arpainet
     5         kx eval $inhdr
     5         kx 
     5         kx : see if htonl --and friends-- exists
     5         kx val=''
     5         kx set htonl val
     5         kx eval $inlibc
     5         kx 
     5         kx : Maybe they are macros.
     5         kx case "$val" in
     5         kx $undef)
     5         kx 	$cat >htonl.c <<EOM
     5         kx #include <stdio.h>
     5         kx #include <sys/types.h>
     5         kx #$i_niin I_NETINET_IN
     5         kx #$i_sysin I_SYS_IN
     5         kx #$i_arpainet I_ARPA_INET
     5         kx #ifdef I_NETINET_IN
     5         kx #include <netinet/in.h>
     5         kx #endif
     5         kx #ifdef I_SYS_IN
     5         kx #include <sys/in.h>
     5         kx #endif
     5         kx #ifdef I_ARPA_INET
     5         kx #include <arpa/inet.h>
     5         kx #endif
     5         kx #ifdef htonl
     5         kx printf("Defined as a macro.");
     5         kx #endif
     5         kx EOM
     5         kx 	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
     5         kx 	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 		echo "But it seems to be defined as a macro." >&4
     5         kx 	fi
     5         kx 	$rm -f htonl.?
     5         kx 	;;
     5         kx esac
     5         kx set d_htonl
     5         kx eval $setvar
     5         kx 
     5         kx : see if hypot exists
     5         kx set hypot d_hypot
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ilogb exists
     5         kx set ilogb d_ilogb
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ilogbl exists
     5         kx set ilogbl d_ilogbl
     5         kx eval $inlibc
     5         kx 
     5         kx : check whether inet_aton exists
     5         kx set inet_aton d_inetaton
     5         kx eval $inlibc
     5         kx 
     5         kx : see if inet_ntop exists
     5         kx set inet_ntop d_inetntop
     5         kx eval $inlibc
     5         kx 
     5         kx : see if inet_pton exists
     5         kx set inet_pton d_inetpton
     5         kx eval $inlibc
     5         kx 
     5         kx : Look for isascii
     5         kx echo " "
     5         kx $cat >isascii.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #include <ctype.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx 	int c = 'A';
     5         kx 	if (isascii(c))
     5         kx 		exit(0);
     5         kx 	else
     5         kx 		exit(1);
     5         kx }
     5         kx EOCP
     5         kx set isascii
     5         kx if eval $compile; then
     5         kx 	echo "isascii() found." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "isascii() NOT found." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_isascii
     5         kx eval $setvar
     5         kx $rm -f isascii*
     5         kx 
     5         kx : Look for isblank
     5         kx echo " "
     5         kx $cat >isblank.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx #include <ctype.h>
     5         kx int main() {
     5         kx 	int c = ' ';
     5         kx 	if (isblank(c))
     5         kx 		return 0 ;
     5         kx 	else
     5         kx 		return 1 ;
     5         kx }
     5         kx EOCP
     5         kx if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
     5         kx 	echo "isblank() found." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "isblank() NOT found." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_isblank
     5         kx eval $setvar
     5         kx $rm -f isblank*
     5         kx 
     5         kx : check for isfinite
     5         kx echo "Checking to see if you have isfinite..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return isfinite(0.0); }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have isfinite."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have isfinite."
     5         kx fi
     5         kx $rm_try
     5         kx set d_isfinite
     5         kx eval $setvar
     5         kx 
     5         kx : see if isfinitel exists
     5         kx set isfinitel d_isfinitel
     5         kx eval $inlibc
     5         kx 
     5         kx : check for isinf
     5         kx echo "Checking to see if you have isinf..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return isinf(0.0); }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have isinf."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have isinf."
     5         kx fi
     5         kx $rm_try
     5         kx set d_isinf
     5         kx eval $setvar
     5         kx 
     5         kx : see if isinfl exists
     5         kx set isinfl d_isinfl
     5         kx eval $inlibc
     5         kx 
     5         kx : check for isless
     5         kx echo "Checking to see if you have isless..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return isless(2.0, 1.0); }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have isless."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have isless."
     5         kx fi
     5         kx $rm_try
     5         kx set d_isless
     5         kx eval $setvar
     5         kx 
     5         kx : check for isnan
     5         kx echo "Checking to see if you have isnan..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return isnan(0.0); }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have isnan."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have isnan."
     5         kx fi
     5         kx $rm_try
     5         kx set d_isnan
     5         kx eval $setvar
     5         kx 
     5         kx : see if isnanl exists
     5         kx set isnanl d_isnanl
     5         kx eval $inlibc
     5         kx 
     5         kx : check for isnormal
     5         kx echo "Checking to see if you have isnormal..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <math.h>
     5         kx int main() { return isnormal(0.0); }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have isnormal."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have isnormal."
     5         kx fi
     5         kx $rm_try
     5         kx set d_isnormal
     5         kx eval $setvar
     5         kx 
     5         kx : see if j0 exists
     5         kx set j0 d_j0
     5         kx eval $inlibc
     5         kx 
     5         kx : see if j0l exists
     5         kx set j0l d_j0l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if killpg exists
     5         kx set killpg d_killpg
     5         kx eval $inlibc
     5         kx 
     5         kx : see if localeconv exists
     5         kx set localeconv d_locconv
     5         kx eval $inlibc
     5         kx 
     5         kx : see if libc has the POSIX.1-2008 currency locale rules
     5         kx case "$d_locconv:$d_lc_monetary_2008" in
     5         kx $define:)
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <locale.h>
     5         kx int main() {
     5         kx 	struct lconv *lc = localeconv();
     5         kx 	char int_p_cs_precedes = lc->int_p_cs_precedes;
     5         kx 	return 0;
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		d_lc_monetary_2008="$define"
     5         kx 	else
     5         kx 		d_lc_monetary_2008="$undef"
     5         kx 	fi;
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if lchown exists
     5         kx echo " "
     5         kx $cat > try.c <<EOCP
     5         kx #include <pwd.h>
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx #$i_unistd	I_UNISTD
     5         kx #ifdef I_UNISTD
     5         kx #  include <unistd.h>
     5         kx #endif
     5         kx int main(int argc, char *argv[])
     5         kx {
     5         kx    if (lchown("./try.c", -1, getgid()) == -1) {
     5         kx        exit(EXIT_FAILURE);
     5         kx    }
     5         kx    exit(EXIT_SUCCESS);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile && ./try; then
     5         kx     $echo "lchown() found." >&4
     5         kx     val="$define"
     5         kx else
     5         kx     $echo "lchown() NOT found." >&4
     5         kx     val="$undef"
     5         kx fi
     5         kx set d_lchown
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : See if number of significant digits in a double precision number is known
     5         kx echo " "
     5         kx $cat >ldbl_dig.c <<EOM
     5         kx #include <limits.h>
     5         kx #include <float.h>
     5         kx #ifdef LDBL_DIG
     5         kx printf("Contains LDBL_DIG");
     5         kx #endif
     5         kx EOM
     5         kx $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
     5         kx if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
     5         kx 	echo "LDBL_DIG found." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "LDBL_DIG NOT found." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx $rm -f ldbl_dig.?
     5         kx set d_ldbl_dig
     5         kx eval $setvar
     5         kx 
     5         kx : see if lgamma exists
     5         kx set lgamma d_lgamma
     5         kx eval $inlibc
     5         kx 
     5         kx : see if lgamma_r exists
     5         kx set lgamma_r d_lgamma_r
     5         kx eval $inlibc
     5         kx 
     5         kx : check to see if math.h defines _LIB_VERSION
     5         kx d_libm_lib_version="$undef"
     5         kx echo " "
     5         kx echo "Checking to see if your libm supports _LIB_VERSION..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <unistd.h>
     5         kx #include <math.h>
     5         kx int main (int argc, char *argv[])
     5         kx {
     5         kx     printf ("%d\n", _LIB_VERSION);
     5         kx     return (0);
     5         kx     } /* main */
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     foo=`$run ./try`
     5         kx     echo "Yes, it does ($foo)" >&4
     5         kx     d_libm_lib_version="$define"
     5         kx else
     5         kx     echo "No, it does not (probably harmless)" >&4
     5         kx     fi
     5         kx $rm_try
     5         kx 
     5         kx : see if link exists
     5         kx set link d_link
     5         kx eval $inlibc
     5         kx 
     5         kx : see if llrint exists
     5         kx set llrint d_llrint
     5         kx eval $inlibc
     5         kx 
     5         kx : see if llrintl exists
     5         kx set llrintl d_llrintl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if llround exists
     5         kx set llround d_llround
     5         kx eval $inlibc
     5         kx 
     5         kx : see if llroundl exists
     5         kx set llroundl d_llroundl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if localtime_r exists
     5         kx set localtime_r d_localtime_r
     5         kx eval $inlibc
     5         kx case "$d_localtime_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
     5         kx 	case "$d_localtime_r_proto:$usethreads" in
     5         kx 	":define")	d_localtime_r_proto=define
     5         kx 		set d_localtime_r_proto localtime_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_localtime_r_proto" in
     5         kx 	define)
     5         kx 	case "$localtime_r_proto" in
     5         kx 	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
     5         kx 	esac
     5         kx 	case "$localtime_r_proto" in
     5         kx 	''|0) try='int localtime_r(const time_t*, struct tm*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
     5         kx 	esac
     5         kx 	case "$localtime_r_proto" in
     5         kx 	''|0)	d_localtime_r=undef
     5         kx 		localtime_r_proto=0
     5         kx 		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$localtime_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "localtime_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_localtime_r=undef
     5         kx 		localtime_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	localtime_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if localtime_r calls tzset
     5         kx case "$localtime_r_proto" in
     5         kx REENTRANT_PROTO*)
     5         kx 	$cat >try.c <<EOCP
     5         kx /*  Does our libc's localtime_r call tzset ?
     5         kx  *  return 0 if so, 1 otherwise.
     5         kx  */
     5         kx #$i_systypes	I_SYS_TYPES
     5         kx #$i_unistd	I_UNISTD
     5         kx #$i_time	I_TIME
     5         kx #$i_stdlib	I_STDLIB
     5         kx #$i_malloc	I_MALLOC
     5         kx #ifdef I_SYS_TYPES
     5         kx #  include <sys/types.h>
     5         kx #endif
     5         kx #ifdef I_UNISTD
     5         kx #  include <unistd.h>
     5         kx #endif
     5         kx #ifdef I_TIME
     5         kx #  include <time.h>
     5         kx #endif
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <string.h>
     5         kx #ifdef I_MALLOC
     5         kx #  include <malloc.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx     int result = 0;
     5         kx     time_t t = time(0L);
     5         kx     char w_tz[]="TZ" "=GMT+5",
     5         kx 	 e_tz[]="TZ" "=GMT-5",
     5         kx 	*tz_e = (char*)malloc(16),
     5         kx 	*tz_w = (char*)malloc(16);
     5         kx     struct tm tm_e, tm_w;
     5         kx     memset(&tm_e,'\0',sizeof(struct tm));
     5         kx     memset(&tm_w,'\0',sizeof(struct tm));
     5         kx     strcpy(tz_e,e_tz);
     5         kx     strcpy(tz_w,w_tz);
     5         kx 
     5         kx     putenv(tz_e);
     5         kx     localtime_r(&t, &tm_e);
     5         kx 
     5         kx     putenv(tz_w);
     5         kx     localtime_r(&t, &tm_w);
     5         kx 
     5         kx     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
     5         kx 	result = 1;
     5         kx 
     5         kx     free(tz_e);free(tz_w);
     5         kx     return result;
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 	    if $run ./try; then
     5         kx 		d_localtime_r_needs_tzset=undef;
     5         kx 	    else
     5         kx 		d_localtime_r_needs_tzset=define;
     5         kx 	    fi;
     5         kx 	else
     5         kx 	    d_localtime_r_needs_tzset=undef;
     5         kx 	fi;
     5         kx      ;;
     5         kx   *)
     5         kx      d_localtime_r_needs_tzset=undef;
     5         kx      ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : see if lockf exists
     5         kx set lockf d_lockf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if log1p exists
     5         kx set log1p d_log1p
     5         kx eval $inlibc
     5         kx 
     5         kx : see if log2 exists
     5         kx set log2 d_log2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if logb exists
     5         kx set logb d_logb
     5         kx eval $inlibc
     5         kx 
     5         kx : see if lrint exists
     5         kx set lrint d_lrint
     5         kx eval $inlibc
     5         kx 
     5         kx : see if lrintl exists
     5         kx set lrintl d_lrintl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if lround exists
     5         kx set lround d_lround
     5         kx eval $inlibc
     5         kx 
     5         kx : see if lroundl exists
     5         kx set lroundl d_lroundl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for lseek is available
     5         kx echo " "
     5         kx set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if lstat exists
     5         kx set lstat d_lstat
     5         kx eval $inlibc
     5         kx 
     5         kx : see if madvise exists
     5         kx set madvise d_madvise
     5         kx eval $inlibc
     5         kx 
     5         kx : see if malloc_size exists
     5         kx set malloc_size d_malloc_size
     5         kx eval $inlibc
     5         kx 
     5         kx : see if malloc_size_good exists
     5         kx set malloc_good_size d_malloc_good_size
     5         kx eval $inlibc
     5         kx 
     5         kx : see if malloc_usable_size exists
     5         kx set malloc_usable_size d_malloc_usable_size
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mblen exists
     5         kx set mblen d_mblen
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mbrlen exists
     5         kx set mbrlen d_mbrlen
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mbrtowc exists
     5         kx set mbrtowc d_mbrtowc
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mbstowcs exists
     5         kx set mbstowcs d_mbstowcs
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mbtowc exists
     5         kx set mbtowc d_mbtowc
     5         kx eval $inlibc
     5         kx 
     5         kx : see if memmem exists
     5         kx : We need both a prototype in string.h and the symbol in libc.
     5         kx echo " "
     5         kx d_memmem_proto=''
     5         kx xx1="#$d_gnulibc HAS_GNULIBC"
     5         kx xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
     5         kx xx3='#   define _GNU_SOURCE'
     5         kx xx4='#endif'
     5         kx set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
     5         kx eval $hasproto
     5         kx case "$d_memmem_proto" in
     5         kx     define) # see if memmem exists
     5         kx 	set memmem d_memmem
     5         kx 	eval $inlibc
     5         kx 	;;
     5         kx     *)  val=$undef
     5         kx 	set d_memmem
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if memrchr exists
     5         kx : We need both a prototype in string.h and the symbol in libc.
     5         kx echo " "
     5         kx d_memrchr_proto=''
     5         kx xx1="#$d_gnulibc HAS_GNULIBC"
     5         kx xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
     5         kx xx3='#   define _GNU_SOURCE'
     5         kx xx4='#endif'
     5         kx set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
     5         kx eval $hasproto
     5         kx case "$d_memrchr_proto" in
     5         kx     define) # see if memrchr exists
     5         kx 	set memrchr d_memrchr
     5         kx 	eval $inlibc
     5         kx 	;;
     5         kx     *)  val=$undef
     5         kx 	set d_memrchr
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if mkdir exists
     5         kx set mkdir d_mkdir
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mkdtemp exists
     5         kx set mkdtemp d_mkdtemp
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mkfifo exists
     5         kx set mkfifo d_mkfifo
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mkostemp exists
     5         kx set mkostemp d_mkostemp
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mkstemp exists
     5         kx set mkstemp d_mkstemp
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mkstemps exists
     5         kx set mkstemps d_mkstemps
     5         kx eval $inlibc
     5         kx 
     5         kx : see if mktime exists
     5         kx set mktime d_mktime
     5         kx eval $inlibc
     5         kx 
     5         kx : see if sys/mman.h has to be included
     5         kx set sys/mman.h i_sysmman
     5         kx eval $inhdr
     5         kx 
     5         kx : see if mmap exists
     5         kx set mmap d_mmap
     5         kx eval $inlibc
     5         kx : see what shmat returns
     5         kx : default to something harmless
     5         kx mmaptype='void *'
     5         kx case "$i_sysmman$d_mmap" in
     5         kx "$define$define")
     5         kx 	$cat >mmap.c <<'END'
     5         kx #include <sys/mman.h>
     5         kx void *mmap();
     5         kx END
     5         kx 	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
     5         kx 		mmaptype='void *'
     5         kx 	else
     5         kx 		mmaptype='caddr_t'
     5         kx 	fi
     5         kx 	echo "and it returns ($mmaptype)." >&4
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if sqrtl exists
     5         kx set sqrtl d_sqrtl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if scalbnl exists
     5         kx set scalbnl d_scalbnl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if truncl exists
     5         kx set truncl d_truncl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if modfl exists
     5         kx set modfl d_modfl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for modfl is available
     5         kx echo " "
     5         kx set d_modflproto modfl define math.h
     5         kx eval $hasproto
     5         kx 
     5         kx if $test "$uselongdouble" = "$define"; then
     5         kx     message=""
     5         kx     if $test "$d_sqrtl" != "$define"; then
     5         kx 	message="$message sqrtl"
     5         kx     fi
     5         kx     if $test "$d_modfl" != "$define"; then
     5         kx 	if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
     5         kx 	    echo "You have both truncl and copysignl, so I can emulate modfl."
     5         kx 	else
     5         kx 	    if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
     5         kx 		echo "You have both aintl and copysignl, so I can emulate modfl."
     5         kx 	    else
     5         kx 		message="$message modfl"
     5         kx 	    fi
     5         kx 	fi
     5         kx     fi
     5         kx     if $test "$d_frexpl" != "$define"; then
     5         kx 	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
     5         kx 	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
     5         kx 	else
     5         kx 	    message="$message frexpl"
     5         kx 	fi
     5         kx     fi
     5         kx     if $test "$d_ldexpl" != "$define"; then
     5         kx 	message="$message ldexpl"
     5         kx     fi
     5         kx 
     5         kx     if $test "$message" != ""; then
     5         kx 	$cat <<EOM >&4
     5         kx 
     5         kx *** You requested the use of long doubles but you do not seem to have
     5         kx *** the following mathematical functions needed for long double support:
     5         kx ***    $message
     5         kx *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
     5         kx *** Cannot continue, aborting.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx 	exit 1
     5         kx     fi
     5         kx fi
     5         kx 
     5         kx : see if mprotect exists
     5         kx set mprotect d_mprotect
     5         kx eval $inlibc
     5         kx 
     5         kx : see if msgctl exists
     5         kx set msgctl d_msgctl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if msgget exists
     5         kx set msgget d_msgget
     5         kx eval $inlibc
     5         kx 
     5         kx : see if msgsnd exists
     5         kx set msgsnd d_msgsnd
     5         kx eval $inlibc
     5         kx 
     5         kx : see if msgrcv exists
     5         kx set msgrcv d_msgrcv
     5         kx eval $inlibc
     5         kx 
     5         kx : see how much of the 'msg*(2)' library is present.
     5         kx h_msg=true
     5         kx echo " "
     5         kx case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
     5         kx *"$undef"*) h_msg=false;;
     5         kx esac
     5         kx case "$osname" in
     5         kx freebsd)
     5         kx     case "`ipcs 2>&1`" in
     5         kx     "SVID messages"*"not configured"*)
     5         kx 	echo "Your $osname does not have the msg*(2) configured." >&4
     5         kx         h_msg=false
     5         kx 	val="$undef"
     5         kx 	set msgctl d_msgctl
     5         kx 	eval $setvar
     5         kx 	set msgget d_msgget
     5         kx 	eval $setvar
     5         kx 	set msgsnd d_msgsnd
     5         kx 	eval $setvar
     5         kx 	set msgrcv d_msgrcv
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx     esac
     5         kx     ;;
     5         kx esac
     5         kx : we could also check for sys/ipc.h ...
     5         kx if $h_msg && $test `./findhdr sys/msg.h`; then
     5         kx 	echo "You have the full msg*(2) library." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "You don't have the full msg*(2) library." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_msg
     5         kx eval $setvar
     5         kx 
     5         kx : Check for msghdr_s
     5         kx echo " "
     5         kx echo "Checking to see if your system supports struct msghdr..." >&4
     5         kx set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
     5         kx eval $hasstruct
     5         kx case "$d_msghdr_s" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see if msync exists
     5         kx set msync d_msync
     5         kx eval $inlibc
     5         kx 
     5         kx : see if munmap exists
     5         kx set munmap d_munmap
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nan exists
     5         kx set nan d_nan
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nanosleep exists
     5         kx set nanosleep d_nanosleep
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nearbyint exists
     5         kx set nearbyint d_nearbyint
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nextafter exists
     5         kx set nextafter d_nextafter
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nexttoward exists
     5         kx set nexttoward d_nexttoward
     5         kx eval $inlibc
     5         kx 
     5         kx : see if nice exists
     5         kx set nice d_nice
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a langinfo.h system
     5         kx set langinfo.h i_langinfo
     5         kx eval $inhdr
     5         kx 
     5         kx : see if nl_langinfo exists
     5         kx set nl_langinfo d_nl_langinfo
     5         kx eval $inlibc
     5         kx 
     5         kx : see if locale.h is available
     5         kx set locale.h i_locale
     5         kx eval $inhdr
     5         kx 
     5         kx : check for nl_langinfo_l item
     5         kx $cat <<EOM
     5         kx 
     5         kx Checking to see if you have nl_langinfo_l(), and that it is thread-safe
     5         kx EOM
     5         kx $cat >try.c <<EOCP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #  include <stdlib.h>
     5         kx #endif
     5         kx #include <string.h>
     5         kx #$i_langinfo I_LANGINFO
     5         kx #ifdef I_LANGINFO
     5         kx #  include <langinfo.h>
     5         kx #endif
     5         kx #$i_pthread I_PTHREAD
     5         kx #ifdef I_PTHREAD
     5         kx #  include <pthread.h>
     5         kx #endif
     5         kx #$i_locale I_LOCALE
     5         kx #ifdef I_LOCALE
     5         kx #  include <locale.h>
     5         kx #endif
     5         kx 
     5         kx void *
     5         kx thread_start(void * arg)
     5         kx {
     5         kx     nl_langinfo(RADIXCHAR);
     5         kx }
     5         kx 
     5         kx int main() {
     5         kx     char * main_buffer;
     5         kx     char save_main_buffer[1000];
     5         kx     pthread_t subthread;
     5         kx     pthread_attr_t attr;
     5         kx 
     5         kx     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
     5         kx 
     5         kx     /* If too large for our generous allowance, just assume we don't have
     5         kx      * it. */
     5         kx     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
     5         kx         exit(1);
     5         kx     }
     5         kx 
     5         kx     strcpy(save_main_buffer, main_buffer);
     5         kx 
     5         kx     if (pthread_attr_init(&attr) != 0) {
     5         kx         exit(1);
     5         kx     }
     5         kx 
     5         kx     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
     5         kx         exit(1);
     5         kx     }
     5         kx 
     5         kx     if (pthread_join(subthread, NULL) != 0) {
     5         kx         exit(1);
     5         kx     }
     5         kx 
     5         kx     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
     5         kx }
     5         kx EOCP
     5         kx case "$usethreads" in
     5         kx     define)
     5         kx         set try
     5         kx         if eval $compile; then
     5         kx             echo "Your system has nl_langinfo_l()..." >&4
     5         kx             d_nl_langinfo_l="$define"
     5         kx             echo "$d_nl_langinfo_l" >&4
     5         kx             if $run ./try; then
     5         kx                 echo "and it is thread-safe (just as I'd hoped)." >&4
     5         kx                 d_thread_safe_nl_langinfo_l="$define"
     5         kx                 echo "$d_thread_safe_nl_langinfo_l" >&4
     5         kx             else
     5         kx                 echo "but it isn't thread-safe." >&4
     5         kx             fi
     5         kx         else
     5         kx             echo "your system does not have nl_langinfo_l()" >&4
     5         kx         fi
     5         kx         ;;
     5         kx     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
     5         kx esac
     5         kx if test X"$d_nl_langinfo_l" = X; then
     5         kx 	d_nl_langinfo_l="$undef"
     5         kx fi
     5         kx if test X"$d_thread_safe_nl_langinfo_l" = X; then
     5         kx 	d_thread_safe_nl_langinfo_l="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Look for non 'int'-sized bitfields
     5         kx case "$d_non_int_bitfields" in
     5         kx '')
     5         kx echo " " >&4
     5         kx echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
     5         kx $cat >try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx struct foo {
     5         kx     unsigned char byte:1;
     5         kx     unsigned short halfword:1;
     5         kx } bar;
     5         kx EOCP
     5         kx if $cc $ccflags -c try.c >try.out 2>&1 ; then
     5         kx 	if $compiler_warning try.out >/dev/null 2>&1; then
     5         kx 		echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
     5         kx 		val="$undef"
     5         kx 	else
     5         kx 		echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
     5         kx 		val="$define"
     5         kx 	fi
     5         kx else
     5         kx 	echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx ;;
     5         kx *) val="$d_non_int_bitfields" ;;
     5         kx esac
     5         kx set d_non_int_bitfields
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if this is a quadmath.h system
     5         kx set quadmath.h i_quadmath
     5         kx eval $inhdr
     5         kx 
     5         kx : Check basic sizes
     5         kx echo " "
     5         kx $echo "Choosing the C types to be used for Perl's internal types..." >&4
     5         kx 
     5         kx case "$use64bitint:$d_quad:$quadtype" in
     5         kx define:define:?*)
     5         kx 	ivtype="$quadtype"
     5         kx 	uvtype="$uquadtype"
     5         kx 	ivsize=8
     5         kx 	uvsize=8
     5         kx 	;;
     5         kx *)	ivtype="long"
     5         kx 	uvtype="unsigned long"
     5         kx 	ivsize=$longsize
     5         kx 	uvsize=$longsize
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$uselongdouble:$d_longdbl" in
     5         kx define:define)
     5         kx 	nvtype="long double"
     5         kx 	nvsize=$longdblsize
     5         kx 	;;
     5         kx *)	nvtype=double
     5         kx 	nvsize=$doublesize
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$usequadmath:$i_quadmath" in
     5         kx define:define)
     5         kx   nvtype="__float128"
     5         kx   nvsize=16
     5         kx   case "$libs" in
     5         kx   *quadmath*) ;;
     5         kx   *) $cat <<EOM >&4
     5         kx 
     5         kx *** You requested the use of the quadmath library, but you
     5         kx *** do not seem to have the quadmath library installed.
     5         kx *** Cannot continue, aborting.
     5         kx EOM
     5         kx     exit 1
     5         kx     ;;
     5         kx   esac
     5         kx   ;;
     5         kx define:*) $cat <<EOM >&4
     5         kx 
     5         kx *** You requested the use of the quadmath library, but you
     5         kx *** do not seem to have the required header, <quadmath.h>.
     5         kx EOM
     5         kx   case "$gccversion" in
     5         kx   [23].*|4.[0-5]*)
     5         kx    $cat <<EOM >&4
     5         kx *** Your gcc looks a bit old:
     5         kx *** $gccversion
     5         kx EOM
     5         kx     ;;
     5         kx   '')
     5         kx    $cat <<EOM >&4
     5         kx *** You are not running a gcc.
     5         kx EOM
     5         kx     ;;
     5         kx   esac
     5         kx   $cat <<EOM >&4
     5         kx *** For the quadmath library you need at least gcc 4.6.
     5         kx *** Cannot continue, aborting.
     5         kx EOM
     5         kx   exit 1
     5         kx   ;;
     5         kx esac
     5         kx 
     5         kx $echo "(IV will be "$ivtype", $ivsize bytes)"
     5         kx $echo "(UV will be "$uvtype", $uvsize bytes)"
     5         kx $echo "(NV will be "$nvtype", $nvsize bytes)"
     5         kx 
     5         kx $cat >try.c <<EOCP
     5         kx #$i_inttypes I_INTTYPES
     5         kx #ifdef I_INTTYPES
     5         kx #include <inttypes.h>
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx #ifdef INT8
     5         kx    int8_t i =  INT8_MAX;
     5         kx   uint8_t u = UINT8_MAX;
     5         kx   printf("int8_t\n");
     5         kx #endif
     5         kx #ifdef INT16
     5         kx    int16_t i =  INT16_MAX;
     5         kx   uint16_t u = UINT16_MAX;
     5         kx   printf("int16_t\n");
     5         kx #endif
     5         kx #ifdef INT32
     5         kx    int32_t i =  INT32_MAX;
     5         kx   uint32_t u = UINT32_MAX;
     5         kx   printf("int32_t\n");
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx 
     5         kx i8type="signed char"
     5         kx u8type="unsigned char"
     5         kx i8size=1
     5         kx u8size=1
     5         kx 
     5         kx case "$i16type" in
     5         kx '')	case "$shortsize" in
     5         kx 	2)	i16type=short
     5         kx 		u16type="unsigned short"
     5         kx 		i16size=$shortsize
     5         kx 		u16size=$shortsize
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$i16type" in
     5         kx '')	set try -DINT16
     5         kx 	if eval $compile; then
     5         kx 		case "`$run ./try`" in
     5         kx 		int16_t)
     5         kx 			i16type=int16_t
     5         kx 			u16type=uint16_t
     5         kx 			i16size=2
     5         kx 			u16size=2
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx case "$i16type" in
     5         kx '')	if $test $shortsize -ge 2; then
     5         kx 		i16type=short
     5         kx 		u16type="unsigned short"
     5         kx 		i16size=$shortsize
     5         kx 		u16size=$shortsize
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$i32type" in
     5         kx '')	case "$longsize" in
     5         kx 	4)	i32type=long
     5         kx 		u32type="unsigned long"
     5         kx 		i32size=$longsize
     5         kx 		u32size=$longsize
     5         kx 		;;
     5         kx 	*)	case "$intsize" in
     5         kx 		4)	i32type=int
     5         kx 			u32type="unsigned int"
     5         kx 			i32size=$intsize
     5         kx 			u32size=$intsize
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx case "$i32type" in
     5         kx '')	set try -DINT32
     5         kx 	if eval $compile; then
     5         kx 		case "`$run ./try`" in
     5         kx 		int32_t)
     5         kx 			i32type=int32_t
     5         kx 			u32type=uint32_t
     5         kx 			i32size=4
     5         kx 			u32size=4
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx case "$i32type" in
     5         kx '')	if $test $intsize -ge 4; then
     5         kx 		i32type=int
     5         kx 		u32type="unsigned int"
     5         kx 		i32size=$intsize
     5         kx 		u32size=$intsize
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$i64type" in
     5         kx '')	case "$d_quad:$quadtype" in
     5         kx 	define:?*)
     5         kx 		i64type="$quadtype"
     5         kx 		u64type="$uquadtype"
     5         kx 		i64size=8
     5         kx 		u64size=8
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
     5         kx $cat <<EOP >try.c
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #ifdef SIGFPE
     5         kx /* volatile so that the compiler has to store it out to memory */
     5         kx volatile int bletched = 0;
     5         kx $signal_t blech(int s) { bletched = 1; }
     5         kx #endif
     5         kx int main() {
     5         kx     $uvtype u = 0;
     5         kx     $nvtype d;
     5         kx     int     n = 8 * $uvsize;
     5         kx     int     i;
     5         kx #ifdef SIGFPE
     5         kx     signal(SIGFPE, blech);
     5         kx #endif
     5         kx 
     5         kx     for (i = 0; i < n; i++) {
     5         kx       u = u << 1 | ($uvtype)1;
     5         kx       d = ($nvtype)u;
     5         kx       if (($uvtype)d != u)
     5         kx         break;
     5         kx       if (d <= 0)
     5         kx 	break;
     5         kx       d = ($nvtype)(u - 1);
     5         kx       if (($uvtype)d != (u - 1))
     5         kx         break;
     5         kx #ifdef SIGFPE
     5         kx       if (bletched)
     5         kx 	break;
     5         kx #endif
     5         kx     }
     5         kx     printf("%d\n", ((i == n) ? -n : i));
     5         kx     exit(0);
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx 
     5         kx d_nv_preserves_uv="$undef"
     5         kx if eval $compile; then
     5         kx 	nv_preserves_uv_bits="`$run ./try`"
     5         kx fi
     5         kx case "$nv_preserves_uv_bits" in
     5         kx \-[1-9]*)
     5         kx 	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
     5         kx 	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  >&4
     5         kx 	d_nv_preserves_uv="$define"
     5         kx 	;;
     5         kx [1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  >&4
     5         kx 	d_nv_preserves_uv="$undef" ;;
     5         kx *)	$echo "Can't figure out how many bits your NVs preserve." >&4
     5         kx 	nv_preserves_uv_bits="0" ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx $echo "Checking to find the largest integer value your NVs can hold..." >&4
     5         kx $cat <<EOP >try.c
     5         kx #include <stdio.h>
     5         kx 
     5         kx typedef $nvtype NV;
     5         kx 
     5         kx int
     5         kx main() {
     5         kx   NV value = 2;
     5         kx   int count = 1;
     5         kx 
     5         kx   while(count < 256) {
     5         kx     /* volatile so that the compiler has to store it out to memory */
     5         kx     volatile NV up = value + 1.0;
     5         kx     volatile NV negated = -value;
     5         kx     volatile NV down = negated - 1.0;
     5         kx     volatile NV got_up = up - value;
     5         kx     int up_good = got_up == 1.0;
     5         kx     int got_down = down - negated;
     5         kx     int down_good = got_down == -1.0;
     5         kx 
     5         kx     if (down_good != up_good) {
     5         kx       fprintf(stderr,
     5         kx 	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
     5         kx 	      up_good, (double) got_up, down_good, (double) got_down,
     5         kx 	      count, (double) value);
     5         kx       return 1;
     5         kx     }
     5         kx     if (!up_good) {
     5         kx       while (1) {
     5         kx 	if (count > 8) {
     5         kx 	  count -= 8;
     5         kx 	  fputs("256.0", stdout);
     5         kx 	} else {
     5         kx 	  count--;
     5         kx 	  fputs("2.0", stdout);
     5         kx 	}
     5         kx 	if (!count) {
     5         kx 	  puts("");
     5         kx 	  return 0;
     5         kx 	}
     5         kx 	fputs("*", stdout);
     5         kx       }
     5         kx     }
     5         kx     value *= 2;
     5         kx     ++count;
     5         kx   }
     5         kx   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
     5         kx 	  count, (double) value);
     5         kx   return 1;
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx 
     5         kx nv_overflows_integers_at='0'
     5         kx if eval $compile; then
     5         kx     xxx="`$run ./try`"
     5         kx     case "$?" in
     5         kx 	0)
     5         kx 	    case "$xxx" in
     5         kx 		2*)  cat >&4 <<EOM
     5         kx The largest integer your NVs can preserve is equal to $xxx
     5         kx EOM
     5         kx 		    nv_overflows_integers_at="$xxx"
     5         kx 		    ;;
     5         kx 		*)  cat >&4 <<EOM
     5         kx Cannot determine the largest integer value your NVs can hold, unexpected output
     5         kx '$xxx'
     5         kx EOM
     5         kx 		    ;;
     5         kx 	    esac
     5         kx 	    ;;
     5         kx 	*)  cat >&4 <<EOM
     5         kx Cannot determine the largest integer value your NVs can hold
     5         kx EOM
     5         kx 	    ;;
     5         kx     esac
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
     5         kx $cat <<EOP >try.c
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <string.h>
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #ifdef SIGFPE
     5         kx /* volatile so that the compiler has to store it out to memory */
     5         kx volatile int bletched = 0;
     5         kx $signal_t blech(int s) { bletched = 1; }
     5         kx #endif
     5         kx 
     5         kx int checkit($nvtype d, const char *where) {
     5         kx     void *v = &d;
     5         kx     unsigned char *p = (unsigned char *)v;
     5         kx     unsigned char *end = p + sizeof(d);
     5         kx     int fail = 0;
     5         kx 
     5         kx     while (p < end)
     5         kx 	fail += *p++;
     5         kx 
     5         kx     if (!fail)
     5         kx 	return 0;
     5         kx 
     5         kx     p = (unsigned char *)v;
     5         kx     printf("No - %s: 0x", where);
     5         kx     while (p < end)
     5         kx 	printf ("%02X", *p++);
     5         kx     printf("\n");
     5         kx     return 1;
     5         kx }
     5         kx 
     5         kx int main(int argc, char **argv) {
     5         kx     $nvtype d = 0.0;
     5         kx     int fail = 0;
     5         kx     fail += checkit(d, "0.0");
     5         kx 
     5         kx     /* The compiler shouldn't be assuming that bletched is 0  */
     5         kx     d = bletched;
     5         kx 
     5         kx     fail += checkit(d, "bleched");
     5         kx 
     5         kx #ifdef SIGFPE
     5         kx     signal(SIGFPE, blech);
     5         kx #endif
     5         kx 
     5         kx     /* Paranoia - the compiler should have no way of knowing that ANSI says
     5         kx        that argv[argc] will always be NULL.  Actually, if it did assume this it
     5         kx        would be buggy, as this is C and main() can be called from elsewhere in
     5         kx        the program.  */
     5         kx     d = argv[argc] ? 1 : 0;
     5         kx 
     5         kx     if (d) {
     5         kx 	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
     5         kx     }
     5         kx 
     5         kx     fail += checkit(d, "ternary");
     5         kx 
     5         kx     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
     5         kx 
     5         kx     if (d != 0.0) {
     5         kx 	printf("No - memset doesn't give 0.0\n");
     5         kx 	/* This might just blow up:  */
     5         kx 	printf("(gives %g)\n", d);
     5         kx 	return 1;
     5         kx     }
     5         kx 
     5         kx #ifdef SIGFPE
     5         kx     if (bletched) {
     5         kx 	printf("No - something bleched\n");
     5         kx 	return 1;
     5         kx     }
     5         kx #endif
     5         kx     if (fail) {
     5         kx       printf("No - %d fail(s)\n", fail);
     5         kx       return 1;
     5         kx     }
     5         kx     printf("Yes\n");
     5         kx     return 0;
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx 
     5         kx d_nv_zero_is_allbits_zero="$undef"
     5         kx if eval $compile; then
     5         kx     xxx="`$run ./try`"
     5         kx     case "$?" in
     5         kx 	0)
     5         kx 	    case "$xxx" in
     5         kx 		Yes)  cat >&4 <<EOM
     5         kx 0.0 is represented as all bits zero in memory
     5         kx EOM
     5         kx 		    d_nv_zero_is_allbits_zero="$define"
     5         kx 		    ;;
     5         kx 		*)  cat >&4 <<EOM
     5         kx 0.0 is not represented as all bits zero in memory
     5         kx EOM
     5         kx 		    d_nv_zero_is_allbits_zero="$undef"
     5         kx 		    ;;
     5         kx 	    esac
     5         kx 	    ;;
     5         kx 	*)  cat >&4 <<EOM
     5         kx 0.0 is not represented as all bits zero in memory
     5         kx EOM
     5         kx 	    d_nv_zero_is_allbits_zero="$undef"
     5         kx 	    ;;
     5         kx     esac
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : check for off64_t
     5         kx echo " "
     5         kx echo "Checking to see if you have off64_t..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <unistd.h>
     5         kx int main() { off64_t x = 7; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have off64_t."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have off64_t."
     5         kx 	case "$lseeksize" in
     5         kx 	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
     5         kx 	esac
     5         kx fi
     5         kx $rm_try
     5         kx set d_off64_t
     5         kx eval $setvar
     5         kx 
     5         kx : how to create joinable pthreads
     5         kx if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
     5         kx 	echo " "
     5         kx 	echo "Checking what constant to use for creating joinable pthreads..." >&4
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <pthread.h>
     5         kx int main() {
     5         kx     int detachstate = JOINABLE;
     5         kx }
     5         kx EOCP
     5         kx 	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
     5         kx 	if eval $compile; then
     5         kx 		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
     5         kx 		val="$undef" # Yes, undef.
     5         kx 		set d_old_pthread_create_joinable
     5         kx 		eval $setvar
     5         kx 		val=""
     5         kx 		set old_pthread_create_joinable
     5         kx 		eval $setvar
     5         kx 	else
     5         kx 		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
     5         kx 		if eval $compile; then
     5         kx 			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
     5         kx 			val="$define"
     5         kx 			set d_old_pthread_create_joinable
     5         kx 			eval $setvar
     5         kx 			val=PTHREAD_CREATE_UNDETACHED
     5         kx 			set old_pthread_create_joinable
     5         kx 			eval $setvar
     5         kx 		else
     5         kx 			set try -DJOINABLE=__UNDETACHED
     5         kx 			if eval $compile; then
     5         kx 				echo "You seem to use __UNDETACHED." >&4
     5         kx 				val="$define"
     5         kx 				set d_old_pthread_create_joinable
     5         kx 				eval $setvar
     5         kx 				val=__UNDETACHED
     5         kx 				set old_pthread_create_joinable
     5         kx 				eval $setvar
     5         kx 			else
     5         kx 				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
     5         kx 				val="$define"
     5         kx 				set d_old_pthread_create_joinable
     5         kx 				eval $setvar
     5         kx 				val=0
     5         kx 				set old_pthread_create_joinable
     5         kx 				eval $setvar
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	$rm_try
     5         kx else
     5         kx     d_old_pthread_create_joinable="$undef"
     5         kx     old_pthread_create_joinable=""
     5         kx fi
     5         kx 
     5         kx : see if pause exists
     5         kx set pause d_pause
     5         kx eval $inlibc
     5         kx 
     5         kx : see if pipe2 exists
     5         kx set pipe2 d_pipe2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if poll exists
     5         kx set poll d_poll
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prctl exists
     5         kx set prctl d_prctl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prctl supports PR_SET_NAME
     5         kx d_prctl_set_name=$undef
     5         kx case $d_prctl in
     5         kx     $define)
     5         kx 	$cat >try.c <<EOM
     5         kx #ifdef __ANDROID__
     5         kx #include <unistd.h>
     5         kx #endif
     5         kx #include <sys/prctl.h>
     5         kx 
     5         kx int main (int argc, char *argv[])
     5         kx {
     5         kx     return (prctl (PR_SET_NAME, "Test"));
     5         kx     } /* main */
     5         kx EOM
     5         kx 	set try
     5         kx 	if eval $compile_ok && $run ./try; then
     5         kx 	    echo "Your prctl (PR_SET_NAME, ...) works"
     5         kx 	    d_prctl_set_name=$define
     5         kx 	    fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx     esac
     5         kx 
     5         kx : see if readlink exists
     5         kx set readlink d_readlink
     5         kx eval $inlibc
     5         kx 
     5         kx : Check if there is a /proc symlink to the abs path of
     5         kx : the executing program.  We will honor hints of d_procselfexe=$undef
     5         kx : or procselfexe being non-empty, otherwise will try to determine both
     5         kx : if we have readlink.
     5         kx : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
     5         kx : referenced, and AmigaOS does not have a proc filesystem anyway.
     5         kx echo " "
     5         kx val="$undef"
     5         kx if $test "X$d_procselfexe" = Xundef; then
     5         kx 	procselfexe=''
     5         kx elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
     5         kx 	val="$define"
     5         kx elif $test "X$d_readlink" = Xdefine; then
     5         kx         : NetBSD first as /proc/self is a symlink to /proc/curproc,
     5         kx         : and it feels more tidy to avoid an extra level of symlink
     5         kx 	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
     5         kx 	while test $# -gt 0; do
     5         kx 	    type=$1; try=$2
     5         kx 	    shift; shift
     5         kx 	    if $issymlink $try; then
     5         kx 		$ls -l $try > reflect
     5         kx 		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
     5         kx 		    echo "You have $type-like $try."
     5         kx 		    procselfexe='"'$try'"'
     5         kx 		    val="$define"
     5         kx 		    : This will break out of the loop
     5         kx 		    set X; shift
     5         kx 		fi
     5         kx 	    fi
     5         kx 	done
     5         kx fi
     5         kx $rm -f reflect
     5         kx set d_procselfexe
     5         kx eval $setvar
     5         kx 
     5         kx : backward compatibility for d_hvfork
     5         kx if test X$d_hvfork != X; then
     5         kx 	d_vfork="$d_hvfork"
     5         kx 	d_hvfork=''
     5         kx fi
     5         kx : see if there is a vfork
     5         kx val=''
     5         kx set vfork val
     5         kx eval $inlibc
     5         kx 
     5         kx d_pseudofork=$undef
     5         kx 
     5         kx : Ok, but do we want to use it. vfork is reportedly unreliable in
     5         kx : perl on Solaris 2.x, and probably elsewhere.
     5         kx case "$val" in
     5         kx $define)
     5         kx 	echo " "
     5         kx 	case "$usevfork" in
     5         kx 	false) dflt='n';;
     5         kx 	*) dflt='y';;
     5         kx 	esac
     5         kx 	cat <<'EOM'
     5         kx 
     5         kx Perl can only use a vfork() that doesn't suffer from strict
     5         kx restrictions on calling functions or modifying global data in
     5         kx the child.  For example, glibc-2.1 contains such a vfork()
     5         kx that is unsuitable.  If your system provides a proper fork()
     5         kx call, chances are that you do NOT want perl to use vfork().
     5         kx 
     5         kx EOM
     5         kx 	rp="Do you still want to use vfork()?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	y|Y) ;;
     5         kx 	*)
     5         kx 		echo "Ok, we won't use vfork()."
     5         kx 		val="$undef"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_vfork
     5         kx eval $setvar
     5         kx case "$d_vfork" in
     5         kx $define) usevfork='true';;
     5         kx *) usevfork='false';;
     5         kx esac
     5         kx 
     5         kx : see whether the pthread_atfork exists
     5         kx $cat >try.c <<EOP
     5         kx #include <pthread.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx #ifdef  PTHREAD_ATFORK
     5         kx         pthread_atfork(NULL,NULL,NULL);
     5         kx #endif
     5         kx }
     5         kx EOP
     5         kx 
     5         kx : see if pthread_atfork exists
     5         kx set try -DPTHREAD_ATFORK
     5         kx if eval $compile; then
     5         kx     val="$define"
     5         kx else
     5         kx     val="$undef"
     5         kx fi
     5         kx case "$usethreads" in
     5         kx $define)
     5         kx         case "$val" in
     5         kx         $define) echo 'pthread_atfork found.' >&4        ;;
     5         kx         *)       echo 'pthread_atfork NOT found.' >&4    ;;
     5         kx         esac
     5         kx esac
     5         kx set d_pthread_atfork
     5         kx eval $setvar
     5         kx 
     5         kx : see if pthread_attr_setscope exists
     5         kx set pthread_attr_setscope d_pthread_attr_setscope
     5         kx eval $inlibc
     5         kx 
     5         kx : see whether the various POSIXish _yields exist
     5         kx $cat >try.c <<EOP
     5         kx #include <pthread.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx #ifdef SCHED_YIELD
     5         kx 	sched_yield();
     5         kx #else
     5         kx #ifdef PTHREAD_YIELD
     5         kx 	pthread_yield();
     5         kx #else
     5         kx #ifdef PTHREAD_YIELD_NULL
     5         kx 	pthread_yield(NULL);
     5         kx #endif
     5         kx #endif
     5         kx #endif
     5         kx }
     5         kx EOP
     5         kx : see if sched_yield exists
     5         kx set try -DSCHED_YIELD
     5         kx if eval $compile; then
     5         kx     val="$define"
     5         kx     sched_yield='sched_yield()'
     5         kx else
     5         kx     val="$undef"
     5         kx fi
     5         kx case "$usethreads" in
     5         kx $define)
     5         kx 	case "$val" in
     5         kx 	$define) echo 'sched_yield() found.' >&4	;;
     5         kx 	*)	 echo 'sched_yield() NOT found.' >&4	;;
     5         kx 	esac
     5         kx esac
     5         kx set d_sched_yield
     5         kx eval $setvar
     5         kx 
     5         kx : see if pthread_yield exists
     5         kx set try -DPTHREAD_YIELD
     5         kx if eval $compile; then
     5         kx     val="$define"
     5         kx     case "$sched_yield" in
     5         kx     '') sched_yield='pthread_yield()' ;;
     5         kx     esac
     5         kx else
     5         kx     set try -DPTHREAD_YIELD_NULL
     5         kx     if eval $compile; then
     5         kx 	val="$define"
     5         kx 	case "$sched_yield" in
     5         kx 	'') sched_yield='pthread_yield(NULL)' ;;
     5         kx 	esac
     5         kx     else
     5         kx 	val="$undef"
     5         kx     fi
     5         kx fi
     5         kx case "$usethreads" in
     5         kx $define)
     5         kx 	case "$val" in
     5         kx 	$define) echo 'pthread_yield() found.' >&4	;;
     5         kx 	*)	 echo 'pthread_yield() NOT found.' >&4	;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_pthread_yield
     5         kx eval $setvar
     5         kx case "$sched_yield" in
     5         kx '') sched_yield=undef ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : check for ptrdiff_t
     5         kx echo " "
     5         kx echo "Checking to see if you have ptrdiff_t..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <stddef.h>
     5         kx int main() { ptrdiff_t x = 7; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have ptrdiff_t."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have ptrdiff_t."
     5         kx fi
     5         kx $rm_try
     5         kx set d_ptrdiff_t
     5         kx eval $setvar
     5         kx 
     5         kx : see if random_r exists
     5         kx set random_r d_random_r
     5         kx eval $inlibc
     5         kx case "$d_random_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
     5         kx 	case "$d_random_r_proto:$usethreads" in
     5         kx 	":define")	d_random_r_proto=define
     5         kx 		set d_random_r_proto random_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_random_r_proto" in
     5         kx 	define)
     5         kx 	case "$random_r_proto" in
     5         kx 	''|0) try='int random_r(int*, struct random_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
     5         kx 	esac
     5         kx 	case "$random_r_proto" in
     5         kx 	''|0) try='int random_r(long*, struct random_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
     5         kx 	esac
     5         kx 	case "$random_r_proto" in
     5         kx 	''|0) try='int random_r(struct random_data*, int32_t*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
     5         kx 	esac
     5         kx 	case "$random_r_proto" in
     5         kx 	''|0)	d_random_r=undef
     5         kx 		random_r_proto=0
     5         kx 		echo "Disabling random_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$random_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "random_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_random_r=undef
     5         kx 		random_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	random_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if readdir and friends exist
     5         kx set readdir d_readdir
     5         kx eval $inlibc
     5         kx set seekdir d_seekdir
     5         kx eval $inlibc
     5         kx set telldir d_telldir
     5         kx eval $inlibc
     5         kx set rewinddir d_rewinddir
     5         kx eval $inlibc
     5         kx 
     5         kx : see if readdir64_r exists
     5         kx set readdir64_r d_readdir64_r
     5         kx eval $inlibc
     5         kx case "$d_readdir64_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
     5         kx 	case "$d_readdir64_r_proto:$usethreads" in
     5         kx 	":define")	d_readdir64_r_proto=define
     5         kx 		set d_readdir64_r_proto readdir64_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_readdir64_r_proto" in
     5         kx 	define)
     5         kx 	case "$readdir64_r_proto" in
     5         kx 	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
     5         kx 	esac
     5         kx 	case "$readdir64_r_proto" in
     5         kx 	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
     5         kx 	esac
     5         kx 	case "$readdir64_r_proto" in
     5         kx 	''|0)	d_readdir64_r=undef
     5         kx 		readdir64_r_proto=0
     5         kx 		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$readdir64_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_readdir64_r=undef
     5         kx 		readdir64_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	readdir64_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if readdir_r exists
     5         kx set readdir_r d_readdir_r
     5         kx eval $inlibc
     5         kx case "$d_readdir_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
     5         kx 	case "$d_readdir_r_proto:$usethreads" in
     5         kx 	":define")	d_readdir_r_proto=define
     5         kx 		set d_readdir_r_proto readdir_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_readdir_r_proto" in
     5         kx 	define)
     5         kx 	case "$readdir_r_proto" in
     5         kx 	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
     5         kx 	esac
     5         kx 	case "$readdir_r_proto" in
     5         kx 	''|0) try='int readdir_r(DIR*, struct dirent*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
     5         kx 	esac
     5         kx 	case "$readdir_r_proto" in
     5         kx 	''|0)	d_readdir_r=undef
     5         kx 		readdir_r_proto=0
     5         kx 		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$readdir_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "readdir_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_readdir_r=undef
     5         kx 		readdir_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	readdir_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if readv exists
     5         kx set readv d_readv
     5         kx eval $inlibc
     5         kx 
     5         kx : see if recvmsg exists
     5         kx set recvmsg d_recvmsg
     5         kx eval $inlibc
     5         kx 
     5         kx : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
     5         kx echo " "
     5         kx if set regcomp val -f d_regcomp; eval $csym; $val; then
     5         kx 	echo 'regcomp() found.' >&4
     5         kx 	d_regcomp="$define"
     5         kx 	d_regcmp="$undef"
     5         kx 	d_re_comp="$undef"
     5         kx elif set regcmp val -f d_regcmp; eval $csym; $val; then
     5         kx 	echo 'regcmp() found.' >&4
     5         kx 	d_regcmp="$define"
     5         kx 	d_regcomp="$undef"
     5         kx 	d_re_comp="$undef"
     5         kx elif set re_comp val -f d_re_comp; eval $csym; $val; then
     5         kx 	echo 're_comp() found, assuming re_exec() also exists.' >&4
     5         kx 	d_re_comp="$define"
     5         kx 	d_regcomp="$undef"
     5         kx 	d_regcmp="$undef"
     5         kx else
     5         kx 	$cat >&4 <<EOM
     5         kx No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
     5         kx EOM
     5         kx 	d_regcmp="$undef"
     5         kx 	d_re_comp="$undef"
     5         kx 	d_regcomp="$undef"
     5         kx fi
     5         kx 
     5         kx : see if remainder exists
     5         kx set remainder d_remainder
     5         kx eval $inlibc
     5         kx 
     5         kx : see if remquo exists
     5         kx set remquo d_remquo
     5         kx eval $inlibc
     5         kx 
     5         kx : see if rename exists
     5         kx set rename d_rename
     5         kx eval $inlibc
     5         kx 
     5         kx : see if rint exists
     5         kx set rint d_rint
     5         kx eval $inlibc
     5         kx 
     5         kx : see if rmdir exists
     5         kx set rmdir d_rmdir
     5         kx eval $inlibc
     5         kx 
     5         kx : see if round exists
     5         kx set round d_round
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for sbrk is available
     5         kx echo " "
     5         kx set d_sbrkproto sbrk $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if scalbn exists
     5         kx set scalbn d_scalbn
     5         kx eval $inlibc
     5         kx 
     5         kx : see if select exists
     5         kx set select d_select
     5         kx eval $inlibc
     5         kx 
     5         kx : see if semctl exists
     5         kx set semctl d_semctl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if semget exists
     5         kx set semget d_semget
     5         kx eval $inlibc
     5         kx 
     5         kx : see if semop exists
     5         kx set semop d_semop
     5         kx eval $inlibc
     5         kx 
     5         kx : see how much of the 'sem*(2)' library is present.
     5         kx h_sem=true
     5         kx echo " "
     5         kx case "$d_semctl$d_semget$d_semop" in
     5         kx *"$undef"*) h_sem=false;;
     5         kx esac
     5         kx case "$osname" in
     5         kx freebsd)
     5         kx     case "`ipcs 2>&1`" in
     5         kx     "SVID messages"*"not configured"*)
     5         kx 	echo "Your $osname does not have the sem*(2) configured." >&4
     5         kx         h_sem=false
     5         kx 	val="$undef"
     5         kx 	set semctl d_semctl
     5         kx 	eval $setvar
     5         kx 	set semget d_semget
     5         kx 	eval $setvar
     5         kx 	set semop d_semop
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx     esac
     5         kx     ;;
     5         kx esac
     5         kx : we could also check for sys/ipc.h ...
     5         kx if $h_sem && $test `./findhdr sys/sem.h`; then
     5         kx 	echo "You have the full sem*(2) library." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "You don't have the full sem*(2) library." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_sem
     5         kx eval $setvar
     5         kx 
     5         kx : see whether sys/sem.h defines union semun
     5         kx echo " "
     5         kx $cat > try.c <<'END'
     5         kx #include <sys/types.h>
     5         kx #include <sys/ipc.h>
     5         kx #include <sys/sem.h>
     5         kx int main () { union semun semun; semun.buf = 0; }
     5         kx END
     5         kx set try
     5         kx if eval $compile; then
     5         kx     echo "You have union semun in <sys/sem.h>." >&4
     5         kx     val="$define"
     5         kx else
     5         kx     echo "You do not have union semun in <sys/sem.h>." >&4
     5         kx     val="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx set d_union_semun
     5         kx eval $setvar
     5         kx 
     5         kx : see how to do semctl IPC_STAT
     5         kx case "$d_sem" in
     5         kx $define)
     5         kx     echo " "
     5         kx     $cat > tryh.h <<END
     5         kx #ifndef S_IRUSR
     5         kx #   ifdef S_IREAD
     5         kx #	define S_IRUSR S_IREAD
     5         kx #	define S_IWUSR S_IWRITE
     5         kx #	define S_IXUSR S_IEXEC
     5         kx #   else
     5         kx #	define S_IRUSR 0400
     5         kx #	define S_IWUSR 0200
     5         kx #	define S_IXUSR 0100
     5         kx #   endif
     5         kx #   define S_IRGRP (S_IRUSR>>3)
     5         kx #   define S_IWGRP (S_IWUSR>>3)
     5         kx #   define S_IXGRP (S_IXUSR>>3)
     5         kx #   define S_IROTH (S_IRUSR>>6)
     5         kx #   define S_IWOTH (S_IWUSR>>6)
     5         kx #   define S_IXOTH (S_IXUSR>>6)
     5         kx #endif
     5         kx #ifndef S_IRWXU
     5         kx #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
     5         kx #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
     5         kx #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
     5         kx #endif
     5         kx END
     5         kx     : see whether semctl IPC_STAT can use union semun
     5         kx     case "$d_semctl_semun" in
     5         kx     '')
     5         kx       val="$undef"
     5         kx       $cat > try.c <<END
     5         kx #include <sys/types.h>
     5         kx #include <sys/ipc.h>
     5         kx #include <sys/sem.h>
     5         kx #include <sys/stat.h>
     5         kx #include <stdio.h>
     5         kx #include <errno.h>
     5         kx #include "tryh.h"
     5         kx #ifndef errno
     5         kx extern int errno;
     5         kx #endif
     5         kx #$d_union_semun HAS_UNION_SEMUN
     5         kx int main() {
     5         kx     union semun
     5         kx #ifndef HAS_UNION_SEMUN
     5         kx     {
     5         kx 	int val;
     5         kx 	struct semid_ds *buf;
     5         kx 	unsigned short *array;
     5         kx     }
     5         kx #endif
     5         kx     arg;
     5         kx     int sem, st;
     5         kx 
     5         kx #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
     5         kx     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
     5         kx     if (sem > -1) {
     5         kx 	struct semid_ds argbuf;
     5         kx 	arg.buf = &argbuf;
     5         kx #	ifdef IPC_STAT
     5         kx 	st = semctl(sem, 0, IPC_STAT, arg);
     5         kx 	if (st == 0)
     5         kx 	    printf("semun\n");
     5         kx 	else
     5         kx #	endif /* IPC_STAT */
     5         kx 	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
     5         kx #	ifdef IPC_RMID
     5         kx 	if (semctl(sem, 0, IPC_RMID, arg) != 0)
     5         kx #	endif /* IPC_RMID */
     5         kx 	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
     5         kx     } else
     5         kx #endif /* IPC_PRIVATE && ... */
     5         kx 	printf("semget failed: errno = %d\n", errno);
     5         kx   return 0;
     5         kx }
     5         kx END
     5         kx       set try
     5         kx       if eval $compile; then
     5         kx 	  xxx=`$run ./try`
     5         kx           case "$xxx" in
     5         kx           semun) val="$define" ;;
     5         kx           esac
     5         kx       fi
     5         kx       $rm_try
     5         kx       set d_semctl_semun
     5         kx       eval $setvar
     5         kx       ;;
     5         kx     esac
     5         kx     case "$d_semctl_semun" in
     5         kx     $define)
     5         kx         echo "You can use union semun for semctl IPC_STAT." >&4
     5         kx 	also='also'
     5         kx         ;;
     5         kx     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
     5         kx 	also=''
     5         kx         ;;
     5         kx     esac
     5         kx 
     5         kx     : see whether semctl IPC_STAT can use struct semid_ds pointer
     5         kx     case "$d_semctl_semid_ds" in
     5         kx     '')
     5         kx       val="$undef"
     5         kx       $cat > try.c <<'END'
     5         kx #include <sys/types.h>
     5         kx #include <sys/ipc.h>
     5         kx #include <sys/sem.h>
     5         kx #include <sys/stat.h>
     5         kx #include "tryh.h"
     5         kx #include <stdio.h>
     5         kx #include <errno.h>
     5         kx #ifndef errno
     5         kx extern int errno;
     5         kx #endif
     5         kx int main() {
     5         kx     union semun
     5         kx #ifndef HAS_UNION_SEMUN
     5         kx     {
     5         kx 	int val;
     5         kx 	struct semid_ds *buf;
     5         kx 	unsigned short *array;
     5         kx     }
     5         kx #endif
     5         kx     arg;
     5         kx     struct semid_ds argbuf;
     5         kx     int sem, st;
     5         kx 
     5         kx #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
     5         kx     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
     5         kx     if (sem > -1) {
     5         kx 	arg.buf = &argbuf;
     5         kx #	ifdef IPC_STAT
     5         kx 	st = semctl(sem, 0, IPC_STAT, arg);
     5         kx 	if (st == 0)
     5         kx 	    printf("semid_ds\n");
     5         kx 	else
     5         kx #	endif /* IPC_STAT */
     5         kx 	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
     5         kx #	ifdef IPC_RMID
     5         kx 	if (semctl(sem, 0, IPC_RMID, arg) != 0)
     5         kx #	endif /* IPC_RMID */
     5         kx 	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
     5         kx     } else
     5         kx #endif /* IPC_PRIVATE && ... */
     5         kx 	printf("semget failed: errno = %d\n", errno);
     5         kx 
     5         kx     return 0;
     5         kx }
     5         kx END
     5         kx       set try
     5         kx       if eval $compile; then
     5         kx           xxx=`$run ./try`
     5         kx           case "$xxx" in
     5         kx           semid_ds) val="$define" ;;
     5         kx           esac
     5         kx       fi
     5         kx       $rm_try
     5         kx       set d_semctl_semid_ds
     5         kx       eval $setvar
     5         kx       ;;
     5         kx     esac
     5         kx     case "$d_semctl_semid_ds" in
     5         kx     $define)
     5         kx         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
     5         kx         ;;
     5         kx     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
     5         kx         ;;
     5         kx     esac
     5         kx     ;;
     5         kx *)  val="$undef"
     5         kx 
     5         kx     # We do not have the full sem*(2) library, so assume we can not
     5         kx     # use either.
     5         kx 
     5         kx     set d_semctl_semun
     5         kx     eval $setvar
     5         kx 
     5         kx     set d_semctl_semid_ds
     5         kx     eval $setvar
     5         kx     ;;
     5         kx esac
     5         kx $rm_try tryh.h
     5         kx 
     5         kx : see if sendmsg exists
     5         kx set sendmsg d_sendmsg
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setegid exists
     5         kx set setegid d_setegid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if seteuid exists
     5         kx set seteuid d_seteuid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setgrent exists
     5         kx set setgrent d_setgrent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setgrent_r exists
     5         kx set setgrent_r d_setgrent_r
     5         kx eval $inlibc
     5         kx case "$d_setgrent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
     5         kx 	case "$d_setgrent_r_proto:$usethreads" in
     5         kx 	":define")	d_setgrent_r_proto=define
     5         kx 		set d_setgrent_r_proto setgrent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setgrent_r_proto" in
     5         kx 	define)
     5         kx 	case "$setgrent_r_proto" in
     5         kx 	''|0) try='int setgrent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
     5         kx 	esac
     5         kx 	case "$setgrent_r_proto" in
     5         kx 	''|0) try='void setgrent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
     5         kx 	esac
     5         kx 	case "$setgrent_r_proto" in
     5         kx 	''|0)	d_setgrent_r=undef
     5         kx 		setgrent_r_proto=0
     5         kx 		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setgrent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setgrent_r=undef
     5         kx 		setgrent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setgrent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if sethostent exists
     5         kx set sethostent d_sethent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if sethostent_r exists
     5         kx set sethostent_r d_sethostent_r
     5         kx eval $inlibc
     5         kx case "$d_sethostent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_sethostent_r_proto:$usethreads" in
     5         kx 	":define")	d_sethostent_r_proto=define
     5         kx 		set d_sethostent_r_proto sethostent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_sethostent_r_proto" in
     5         kx 	define)
     5         kx 	case "$sethostent_r_proto" in
     5         kx 	''|0) try='int sethostent_r(int, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
     5         kx 	esac
     5         kx 	case "$sethostent_r_proto" in
     5         kx 	''|0) try='void sethostent_r(int, struct hostent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
     5         kx 	esac
     5         kx 	case "$sethostent_r_proto" in
     5         kx 	''|0)	d_sethostent_r=undef
     5         kx 		sethostent_r_proto=0
     5         kx 		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$sethostent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_sethostent_r=undef
     5         kx 		sethostent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	sethostent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setitimer exists
     5         kx set setitimer d_setitimer
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setlinebuf exists
     5         kx set setlinebuf d_setlinebuf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this system has wctype.h
     5         kx set wctype.h i_wctype
     5         kx eval $inhdr
     5         kx 
     5         kx : see if towupper exists
     5         kx set towupper d_towupper
     5         kx eval $inlibc
     5         kx 
     5         kx : check for setlocale function and behavior
     5         kx case "$d_setlocale" in
     5         kx '')
     5         kx $cat >&4 <<EOM
     5         kx 
     5         kx Checking to see if you have setlocale() and its behavior
     5         kx EOM
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdlib.h>
     5         kx #include <string.h>
     5         kx #$i_locale I_LOCALE
     5         kx #ifdef I_LOCALE
     5         kx #  include <locale.h>
     5         kx #endif
     5         kx #$i_wctype I_WCTYPE
     5         kx #ifdef I_WCTYPE
     5         kx #  include <wctype.h>
     5         kx #endif
     5         kx 
     5         kx int main() {
     5         kx     const char * invalid_name = "\a";   /* This is really invalid! */
     5         kx     int accepts_any_locale_name = 0;
     5         kx     int has_C_UTF8 = 0;
     5         kx     unsigned char bad_setlocale = 255;
     5         kx 
     5         kx     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
     5         kx      * disabled.  It's hard to imagine an instance where meaningful locale
     5         kx      * handling could be done without LC_CTYPE */
     5         kx     const char *  name = setlocale(LC_CTYPE, "C");
     5         kx 
     5         kx     if (name == NULL || strcmp(name, "C") != 0) {
     5         kx         exit(bad_setlocale);
     5         kx     }
     5         kx 
     5         kx     name = setlocale(LC_CTYPE, invalid_name);
     5         kx     if (name != NULL) {
     5         kx 
     5         kx         /* Let it pass if it accepts the name but gives back one of the C
     5         kx          * locales */
     5         kx         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
     5         kx             accepts_any_locale_name = 1;
     5         kx         }
     5         kx     }
     5         kx 
     5         kx     name = setlocale(LC_CTYPE, "C.UTF-8");
     5         kx     if (name != NULL) {
     5         kx         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
     5         kx 
     5         kx #$d_towupper HAS_TOWUPPER
     5         kx #ifdef HAS_TOWUPPER
     5         kx 
     5         kx         /* We assume that if the machine doesn't have the C99 towupper, it
     5         kx          * doesn't have C.UTF-8, even if we successfully changed locales to
     5         kx          * include it.  This seems safer even on platforms that didn't accept
     5         kx          * the really invalid name */
     5         kx 
     5         kx         if (towupper(y_with_diaeresis) == 0x178) {
     5         kx             has_C_UTF8 = 1;
     5         kx         }
     5         kx 
     5         kx #endif
     5         kx 
     5         kx     }
     5         kx 
     5         kx #if 0
     5         kx 
     5         kx     /* Currently unused code to determine if LC_ALL with disparate values uses
     5         kx      * category = value pairs or positional, and to determine the separator
     5         kx      * between the categories.  We could add code so that if the separator were
     5         kx      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
     5         kx      * every possible ASCII separator would fit in the 5 bits available in the
     5         kx      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
     5         kx      * positional, we probably would want to know the order of the categories.
     5         kx      * Using a file between the C program and the shell script would really be
     5         kx      * require to do that */
     5         kx #ifdef LC_ALL
     5         kx 
     5         kx     unsigned char min_separator = ' ' - 1;
     5         kx     unsigned char separator = min_separator;
     5         kx     int uses_name_value_pair_names = 0;
     5         kx 
     5         kx     name = setlocale(LC_ALL, "C");
     5         kx     if (name == NULL || strcmp(name, "C") != 0) {
     5         kx         exit(bad_setlocale);
     5         kx     }
     5         kx 
     5         kx     if (has_C_UTF8) {
     5         kx         char * pos;
     5         kx 
     5         kx         name = setlocale(LC_CTYPE, "C.UTF-8");
     5         kx         if (name == NULL) {
     5         kx             exit(bad_setlocale);
     5         kx         }
     5         kx         name = setlocale(LC_ALL, NULL);
     5         kx         if (name == NULL) {
     5         kx             exit(bad_setlocale);
     5         kx         }
     5         kx 
     5         kx         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
     5         kx         if (pos != NULL) {
     5         kx             uses_name_value_pair_names = 1;
     5         kx             if (pos == name) {
     5         kx                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
     5         kx             }
     5         kx             else {
     5         kx                 separator = *(pos - 1);
     5         kx             }
     5         kx         }
     5         kx         else {
     5         kx             pos = strstr(name, "C.UTF-8");
     5         kx             if (pos == NULL) {
     5         kx                 /* bad */
     5         kx             }
     5         kx             else if (pos == name) {
     5         kx                 separator = name[sizeof("C.UTF-8") - 1];
     5         kx             }
     5         kx             else {
     5         kx                 separator = *(pos - 1);
     5         kx             }
     5         kx         }
     5         kx     }
     5         kx 
     5         kx #endif
     5         kx #endif
     5         kx 
     5         kx     exit( 0 /* (separator - min_separator) << 3
     5         kx         | uses_name_value_pair_names      << 2
     5         kx           */
     5         kx         | has_C_UTF8                      << 1
     5         kx         | accepts_any_locale_name);
     5         kx 
     5         kx }
     5         kx EOCP
     5         kx val=
     5         kx set d_setlocale
     5         kx eval $setvar
     5         kx case $d_setlocale in
     5         kx     $undef) d_setlocale_accepts_any_locale_name="$undef"
     5         kx             d_has_C_UTF8="false"
     5         kx             ;;
     5         kx     *) set try
     5         kx        if eval $compile; then
     5         kx            echo "Your system has setlocale()..." >&4
     5         kx            $run ./try
     5         kx            case $? in
     5         kx                0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
     5         kx                   d_setlocale="$define"
     5         kx                   d_setlocale_accepts_any_locale_name="$undef"
     5         kx                   d_has_C_UTF8="false"
     5         kx                   ;;
     5         kx                1) echo "and it seems sane, but accepts any locale name as valid" >&4
     5         kx                   d_setlocale="$define"
     5         kx                   d_setlocale_accepts_any_locale_name="$define"
     5         kx                   d_has_C_UTF8="false"
     5         kx                   ;;
     5         kx                2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
     5         kx                   d_setlocale="$define"
     5         kx                   d_setlocale_accepts_any_locale_name="$undef"
     5         kx                   d_has_C_UTF8="true"
     5         kx                   ;;
     5         kx                3) echo "and it seems sane, but accepts any locale name as valid" >&4
     5         kx                   d_setlocale="$define"
     5         kx                   d_setlocale_accepts_any_locale_name="$define"
     5         kx                   d_has_C_UTF8="true"
     5         kx                   ;;
     5         kx                *) echo "but it doesn't seem to work, so we won't use it." >&4
     5         kx                   d_setlocale="$undef"
     5         kx                   d_setlocale_accepts_any_locale_name="$undef"
     5         kx                   d_has_C_UTF8="false"
     5         kx                   ;;
     5         kx            esac
     5         kx        else
     5         kx            echo "your system does not have setlocale()" >&4
     5         kx            d_setlocale="$undef"
     5         kx            d_setlocale_accepts_any_locale_name="$undef"
     5         kx            d_has_C_UTF8="false"
     5         kx        fi
     5         kx esac
     5         kx $rm_try
     5         kx ;;
     5         kx *) val="$d_setlocale"
     5         kx     set d_setlocale
     5         kx     eval $setvar
     5         kx     case "$d_setlocale" in
     5         kx         $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
     5         kx         ;;
     5         kx     esac
     5         kx     rp="Does your system have the C.UTF-8 locale?"
     5         kx     dflt=n
     5         kx     . ./myread
     5         kx     case "$ans" in
     5         kx         [Yy]*) d_has_C_UTF8="true"
     5         kx                c_utf8_locale=" or C.UTF-8"
     5         kx                ;;
     5         kx         *)     d_has_C_UTF8="false"
     5         kx                c_utf8_locale=""
     5         kx                ;;
     5         kx     esac
     5         kx     case "$d_setlocale" in
     5         kx         $define)
     5         kx             rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4
     5         kx             dflt=n
     5         kx             . ./myread
     5         kx             case "$ans" in
     5         kx                 true|[Yy]*)
     5         kx 		   d_setlocale_accepts_any_locale_name="$undef"
     5         kx 		   ;;
     5         kx 		*) d_setlocale_accepts_any_locale_name="$define"
     5         kx 		   ;;
     5         kx             esac
     5         kx             ;;
     5         kx         *) d_setlocale_accepts_any_locale_name="$undef"
     5         kx 	   ;;
     5         kx     esac
     5         kx esac
     5         kx 
     5         kx : see if setlocale_r exists
     5         kx set setlocale_r d_setlocale_r
     5         kx eval $inlibc
     5         kx case "$d_setlocale_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
     5         kx 	case "$d_setlocale_r_proto:$usethreads" in
     5         kx 	":define")	d_setlocale_r_proto=define
     5         kx 		set d_setlocale_r_proto setlocale_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setlocale_r_proto" in
     5         kx 	define)
     5         kx 	case "$setlocale_r_proto" in
     5         kx 	''|0) try='int setlocale_r(int, const char*, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
     5         kx 	esac
     5         kx 	case "$setlocale_r_proto" in
     5         kx 	''|0)	d_setlocale_r=undef
     5         kx 		setlocale_r_proto=0
     5         kx 		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setlocale_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setlocale_r=undef
     5         kx 		setlocale_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setlocale_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setnetent exists
     5         kx set setnetent d_setnent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setnetent_r exists
     5         kx set setnetent_r d_setnetent_r
     5         kx eval $inlibc
     5         kx case "$d_setnetent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_setnetent_r_proto:$usethreads" in
     5         kx 	":define")	d_setnetent_r_proto=define
     5         kx 		set d_setnetent_r_proto setnetent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setnetent_r_proto" in
     5         kx 	define)
     5         kx 	case "$setnetent_r_proto" in
     5         kx 	''|0) try='int setnetent_r(int, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
     5         kx 	esac
     5         kx 	case "$setnetent_r_proto" in
     5         kx 	''|0) try='void setnetent_r(int, struct netent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
     5         kx 	esac
     5         kx 	case "$setnetent_r_proto" in
     5         kx 	''|0)	d_setnetent_r=undef
     5         kx 		setnetent_r_proto=0
     5         kx 		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setnetent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setnetent_r=undef
     5         kx 		setnetent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setnetent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setprotoent exists
     5         kx set setprotoent d_setpent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setpgid exists
     5         kx set setpgid d_setpgid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setpgrp2 exists
     5         kx set setpgrp2 d_setpgrp2
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setpriority exists
     5         kx set setpriority d_setprior
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setproctitle exists
     5         kx set setproctitle d_setproctitle
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setprotoent_r exists
     5         kx set setprotoent_r d_setprotoent_r
     5         kx eval $inlibc
     5         kx case "$d_setprotoent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_setprotoent_r_proto:$usethreads" in
     5         kx 	":define")	d_setprotoent_r_proto=define
     5         kx 		set d_setprotoent_r_proto setprotoent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setprotoent_r_proto" in
     5         kx 	define)
     5         kx 	case "$setprotoent_r_proto" in
     5         kx 	''|0) try='int setprotoent_r(int, struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
     5         kx 	esac
     5         kx 	case "$setprotoent_r_proto" in
     5         kx 	''|0) try='void setprotoent_r(int, struct protoent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
     5         kx 	esac
     5         kx 	case "$setprotoent_r_proto" in
     5         kx 	''|0)	d_setprotoent_r=undef
     5         kx 		setprotoent_r_proto=0
     5         kx 		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setprotoent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setprotoent_r=undef
     5         kx 		setprotoent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setprotoent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setpwent exists
     5         kx set setpwent d_setpwent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setpwent_r exists
     5         kx set setpwent_r d_setpwent_r
     5         kx eval $inlibc
     5         kx case "$d_setpwent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
     5         kx 	case "$d_setpwent_r_proto:$usethreads" in
     5         kx 	":define")	d_setpwent_r_proto=define
     5         kx 		set d_setpwent_r_proto setpwent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setpwent_r_proto" in
     5         kx 	define)
     5         kx 	case "$setpwent_r_proto" in
     5         kx 	''|0) try='int setpwent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
     5         kx 	esac
     5         kx 	case "$setpwent_r_proto" in
     5         kx 	''|0) try='void setpwent_r(FILE**);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
     5         kx 	esac
     5         kx 	case "$setpwent_r_proto" in
     5         kx 	''|0)	d_setpwent_r=undef
     5         kx 		setpwent_r_proto=0
     5         kx 		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setpwent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setpwent_r=undef
     5         kx 		setpwent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setpwent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setregid exists
     5         kx set setregid d_setregid
     5         kx eval $inlibc
     5         kx set setresgid d_setresgid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setreuid exists
     5         kx set setreuid d_setreuid
     5         kx eval $inlibc
     5         kx set setresuid d_setresuid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setrgid exists
     5         kx set setrgid d_setrgid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setruid exists
     5         kx set setruid d_setruid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setservent exists
     5         kx set setservent d_setsent
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setservent_r exists
     5         kx set setservent_r d_setservent_r
     5         kx eval $inlibc
     5         kx case "$d_setservent_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
     5         kx 	case "$d_setservent_r_proto:$usethreads" in
     5         kx 	":define")	d_setservent_r_proto=define
     5         kx 		set d_setservent_r_proto setservent_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_setservent_r_proto" in
     5         kx 	define)
     5         kx 	case "$setservent_r_proto" in
     5         kx 	''|0) try='int setservent_r(int, struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
     5         kx 	esac
     5         kx 	case "$setservent_r_proto" in
     5         kx 	''|0) try='void setservent_r(int, struct servent_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
     5         kx 	esac
     5         kx 	case "$setservent_r_proto" in
     5         kx 	''|0)	d_setservent_r=undef
     5         kx 		setservent_r_proto=0
     5         kx 		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$setservent_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "setservent_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_setservent_r=undef
     5         kx 		setservent_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	setservent_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if setsid exists
     5         kx set setsid d_setsid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setvbuf exists
     5         kx set setvbuf d_setvbuf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if shmctl exists
     5         kx set shmctl d_shmctl
     5         kx eval $inlibc
     5         kx 
     5         kx : see if shmget exists
     5         kx set shmget d_shmget
     5         kx eval $inlibc
     5         kx 
     5         kx : see if shmat exists
     5         kx set shmat d_shmat
     5         kx eval $inlibc
     5         kx : see what shmat returns
     5         kx case "$d_shmat" in
     5         kx "$define")
     5         kx 	$cat >shmat.c <<'END'
     5         kx #include <sys/shm.h>
     5         kx void *shmat();
     5         kx END
     5         kx 	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
     5         kx 		shmattype='void *'
     5         kx 	else
     5         kx 		shmattype='char *'
     5         kx 	fi
     5         kx 	echo "and it returns ($shmattype)." >&4
     5         kx 	: see if a prototype for shmat is available
     5         kx 	xxx=`./findhdr sys/shm.h`
     5         kx 	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
     5         kx 	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	$rm -f shmat.[co]
     5         kx 	;;
     5         kx *)
     5         kx 	val="$undef"
     5         kx 	;;
     5         kx esac
     5         kx set d_shmatprototype
     5         kx eval $setvar
     5         kx 
     5         kx : see if shmdt exists
     5         kx set shmdt d_shmdt
     5         kx eval $inlibc
     5         kx 
     5         kx : see how much of the 'shm*(2)' library is present.
     5         kx h_shm=true
     5         kx echo " "
     5         kx case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
     5         kx *"$undef"*) h_shm=false;;
     5         kx esac
     5         kx case "$osname" in
     5         kx freebsd)
     5         kx     case "`ipcs 2>&1`" in
     5         kx     "SVID shared memory"*"not configured"*)
     5         kx 	echo "Your $osname does not have the shm*(2) configured." >&4
     5         kx         h_shm=false
     5         kx 	val="$undef"
     5         kx 	set shmctl d_shmctl
     5         kx 	eval $setvar
     5         kx 	set shmget d_shmget
     5         kx 	eval $setvar
     5         kx 	set shmat d_shmat
     5         kx 	eval $setvar
     5         kx 	set shmdt d_shmdt
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx     esac
     5         kx     ;;
     5         kx esac
     5         kx : we could also check for sys/ipc.h ...
     5         kx if $h_shm && $test `./findhdr sys/shm.h`; then
     5         kx 	echo "You have the full shm*(2) library." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "You don't have the full shm*(2) library." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_shm
     5         kx eval $setvar
     5         kx 
     5         kx : see if we have sigaction
     5         kx echo " "
     5         kx if set sigaction val -f d_sigaction; eval $csym; $val; then
     5         kx 	echo 'sigaction() found.' >&4
     5         kx 	$cat > try.c <<EOP
     5         kx #include <stdio.h>
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main()
     5         kx {
     5         kx     struct sigaction act, oact;
     5         kx     act.sa_flags = 0;
     5         kx     oact.sa_handler = 0;
     5         kx     /* so that act and oact are used */
     5         kx     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
     5         kx }
     5         kx EOP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "But you don't seem to have a usable struct sigaction." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx else
     5         kx 	echo 'sigaction NOT found.' >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx set d_sigaction; eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see what type pids are declared as in the kernel
     5         kx rp="What is the type of process ids on this system?"
     5         kx set pid_t pidtype int stdio.h sys/types.h
     5         kx eval $typedef_ask
     5         kx 
     5         kx : see what type uids are declared as in the kernel
     5         kx echo " "
     5         kx echo "Looking for the type for user ids returned by getuid()."
     5         kx set uid_t uidtype xxx stdio.h sys/types.h
     5         kx eval $typedef
     5         kx case "$uidtype" in
     5         kx xxx)
     5         kx 	xxx=`./findhdr sys/user.h`
     5         kx 	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
     5         kx 	case $1 in
     5         kx 	unsigned) dflt="$1 $2" ;;
     5         kx 	*) dflt="$1" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *) dflt="$uidtype";;
     5         kx esac
     5         kx case "$uidtype" in
     5         kx uid_t)	echo "uid_t found." ;;
     5         kx *)	rp="What is the type for user ids returned by getuid()?"
     5         kx 	. ./myread
     5         kx 	uidtype="$ans"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Define hasfield_t macro for Configure internal use
     5         kx hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
     5         kx while $test $# -ge 2; do
     5         kx     case "$1" in
     5         kx 	$define) echo "#include <$2>";;
     5         kx     esac ;
     5         kx     shift 2;
     5         kx done > try.c;
     5         kx echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
     5         kx set try;
     5         kx if eval $compile; then
     5         kx 	val="$define";
     5         kx else
     5         kx 	val="$undef";
     5         kx fi;
     5         kx set $varname;
     5         kx eval $setvar;
     5         kx $rm_try'
     5         kx 
     5         kx : see what siginfo fields we have
     5         kx case "$d_sigaction" in
     5         kx "$define")
     5         kx 	echo "Checking if your siginfo_t has si_errno field...">&4
     5         kx 	set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_pid field...">&4
     5         kx 	set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_uid field...">&4
     5         kx 	set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_addr field...">&4
     5         kx 	set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_status field...">&4
     5         kx 	set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_band field...">&4
     5         kx 	set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_value field...">&4
     5         kx 	set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	echo "Checking if your siginfo_t has si_fd field...">&4
     5         kx 	set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
     5         kx 	eval $hasfield_t;
     5         kx 
     5         kx 	;;
     5         kx *)
     5         kx 	d_siginfo_si_errno="$undef"
     5         kx 	d_siginfo_si_pid="$undef"
     5         kx 	d_siginfo_si_uid="$undef"
     5         kx 	d_siginfo_si_addr="$undef"
     5         kx 	d_siginfo_si_status="$undef"
     5         kx 	d_siginfo_si_band="$undef"
     5         kx 	d_siginfo_si_value="$undef"
     5         kx 	d_siginfo_si_fd="$undef"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if this is a sunmath.h system
     5         kx set sunmath.h i_sunmath
     5         kx eval $inhdr
     5         kx 
     5         kx : see if signbit exists
     5         kx $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
     5         kx $cat >try.c <<EOCP
     5         kx #$i_sunmath I_SUNMATH
     5         kx #include <math.h>
     5         kx #ifdef I_SUNMATH  /* Solaris special math library */
     5         kx #  include <sunmath.h>
     5         kx #endif
     5         kx #define NV $nvtype
     5         kx int main(int argc, char **argv)
     5         kx {
     5         kx     NV x = 0.0;
     5         kx     NV y = -1.0;
     5         kx     if ((signbit(x) == 0) && (signbit(y) != 0))
     5         kx 	return 0;
     5         kx     else
     5         kx 	return 1;
     5         kx }
     5         kx EOCP
     5         kx val="$undef"
     5         kx set try
     5         kx if eval $compile; then
     5         kx     if $run ./try; then
     5         kx         $echo "Yes." >&4
     5         kx 	val="$define"
     5         kx     else
     5         kx         $echo "Signbit seems to be available, but doesn't work as I expected."
     5         kx         $echo "I won't use it." >&4
     5         kx 	val="$undef"
     5         kx     fi
     5         kx else
     5         kx     $echo "Nope." >&4
     5         kx     dflt="$undef"
     5         kx fi
     5         kx set d_signbit
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if sigprocmask exists
     5         kx set sigprocmask d_sigprocmask
     5         kx eval $inlibc
     5         kx 
     5         kx : see if sigsetjmp exists
     5         kx echo " "
     5         kx case "$d_sigsetjmp" in
     5         kx '')
     5         kx 	$cat >try.c <<EOP
     5         kx #include <setjmp.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx sigjmp_buf env;
     5         kx int set = 1;
     5         kx int main()
     5         kx {
     5         kx 	if (sigsetjmp(env,1))
     5         kx 		exit(set);
     5         kx 	set = 0;
     5         kx 	siglongjmp(env, 1);
     5         kx 	exit(1);
     5         kx }
     5         kx EOP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		if $run ./try >/dev/null 2>&1; then
     5         kx 			echo "POSIX sigsetjmp found." >&4
     5         kx 			val="$define"
     5         kx 		else
     5         kx 			$cat >&4 <<EOM
     5         kx Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
     5         kx I'll ignore them.
     5         kx EOM
     5         kx 			val="$undef"
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "sigsetjmp not found." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx *) val="$d_sigsetjmp"
     5         kx 	case "$d_sigsetjmp" in
     5         kx 	$define) echo "POSIX sigsetjmp found." >&4;;
     5         kx 	$undef) echo "sigsetjmp not found." >&4;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_sigsetjmp
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if snprintf exists
     5         kx set snprintf d_snprintf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if vsnprintf exists
     5         kx set vsnprintf d_vsnprintf
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_snprintf-$d_vsnprintf" in
     5         kx "$define-$define")
     5         kx     $cat <<EOM
     5         kx Checking whether your snprintf() and vsnprintf() work okay...
     5         kx EOM
     5         kx     $cat >try.c <<'EOCP'
     5         kx /* v?snprintf testing logic courtesy of Russ Allbery.
     5         kx  * According to C99:
     5         kx  * - if the buffer is too short it still must be \0-terminated
     5         kx  * - if the buffer is too short the potentially required length
     5         kx  *   must be returned and not -1
     5         kx  * - if the buffer is NULL the potentially required length
     5         kx  *   must be returned and not -1 or core dump
     5         kx  */
     5         kx #include <stdio.h>
     5         kx #include <stdarg.h>
     5         kx 
     5         kx char buf[2];
     5         kx 
     5         kx int test (char *format, ...)
     5         kx {
     5         kx     va_list args;
     5         kx     int count;
     5         kx 
     5         kx     va_start (args, format);
     5         kx     count = vsnprintf (buf, sizeof buf, format, args);
     5         kx     va_end (args);
     5         kx     return count;
     5         kx }
     5         kx 
     5         kx int main ()
     5         kx {
     5         kx     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
     5         kx              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
     5         kx }
     5         kx EOCP
     5         kx     set try
     5         kx     if eval $compile; then
     5         kx 	`$run ./try`
     5         kx 	case "$?" in
     5         kx 	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
     5         kx 	*) cat <<EOM >&4
     5         kx Your snprintf() and snprintf() don't seem to be working okay.
     5         kx EOM
     5         kx 	   d_snprintf="$undef"
     5         kx 	   d_vsnprintf="$undef"
     5         kx 	   ;;
     5         kx 	esac
     5         kx     else
     5         kx 	echo "(I can't seem to compile the test program--assuming they don't)"
     5         kx 	d_snprintf="$undef"
     5         kx 	d_vsnprintf="$undef"
     5         kx     fi
     5         kx     $rm_try
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : see if sockatmark exists
     5         kx set sockatmark d_sockatmark
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for sockatmark is available
     5         kx echo " "
     5         kx set d_sockatmarkproto sockatmark $d_socket sys/socket.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if socks5_init exists
     5         kx set socks5_init d_socks5_init
     5         kx eval $inlibc
     5         kx 
     5         kx : see if srand48_r exists
     5         kx set srand48_r d_srand48_r
     5         kx eval $inlibc
     5         kx case "$d_srand48_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
     5         kx 	case "$d_srand48_r_proto:$usethreads" in
     5         kx 	":define")	d_srand48_r_proto=define
     5         kx 		set d_srand48_r_proto srand48_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_srand48_r_proto" in
     5         kx 	define)
     5         kx 	case "$srand48_r_proto" in
     5         kx 	''|0) try='int srand48_r(long, struct drand48_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
     5         kx 	esac
     5         kx 	case "$srand48_r_proto" in
     5         kx 	''|0)	d_srand48_r=undef
     5         kx 		srand48_r_proto=0
     5         kx 		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$srand48_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "srand48_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_srand48_r=undef
     5         kx 		srand48_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	srand48_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if srandom_r exists
     5         kx set srandom_r d_srandom_r
     5         kx eval $inlibc
     5         kx case "$d_srandom_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
     5         kx 	case "$d_srandom_r_proto:$usethreads" in
     5         kx 	":define")	d_srandom_r_proto=define
     5         kx 		set d_srandom_r_proto srandom_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_srandom_r_proto" in
     5         kx 	define)
     5         kx 	case "$srandom_r_proto" in
     5         kx 	''|0) try='int srandom_r(unsigned int, struct random_data*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
     5         kx 	esac
     5         kx 	case "$srandom_r_proto" in
     5         kx 	''|0)	d_srandom_r=undef
     5         kx 		srandom_r_proto=0
     5         kx 		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$srandom_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "srandom_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_srandom_r=undef
     5         kx 		srandom_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	srandom_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if prototype for setresgid is available
     5         kx echo " "
     5         kx set d_sresgproto setresgid $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if prototype for setresuid is available
     5         kx echo " "
     5         kx set d_sresuproto setresuid $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if stat exists
     5         kx set stat d_stat
     5         kx eval $inlibc
     5         kx 
     5         kx : see if sys/stat.h is available
     5         kx set sys/stat.h i_sysstat
     5         kx eval $inhdr
     5         kx 
     5         kx : see if stat knows about block sizes
     5         kx echo " "
     5         kx echo "Checking to see if your struct stat has st_blocks field..." >&4
     5         kx set d_statblks stat st_blocks $i_sysstat sys/stat.h
     5         kx eval $hasfield
     5         kx 
     5         kx : see if this is a sys/vfs.h system
     5         kx set sys/vfs.h i_sysvfs
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/statfs.h system
     5         kx set sys/statfs.h i_sysstatfs
     5         kx eval $inhdr
     5         kx 
     5         kx : Check for statfs_s
     5         kx echo " "
     5         kx echo "Checking to see if your system supports struct statfs..." >&4
     5         kx set 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
     5         kx eval $hasstruct
     5         kx case "$d_statfs_s" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see if struct statfs knows about f_flags
     5         kx case "$d_statfs_s" in
     5         kx define)
     5         kx 	echo " "
     5         kx 	echo "Checking to see if your struct statfs has f_flags field..." >&4
     5         kx 	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
     5         kx 	eval $hasfield
     5         kx 	;;
     5         kx *)	val="$undef"
     5         kx 	set d_statfs_f_flags
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx case "$d_statfs_f_flags" in
     5         kx "$define")      echo "Yes, it does."   ;;
     5         kx *)              echo "No, it doesn't." ;;
     5         kx esac
     5         kx 
     5         kx : see what flavor, if any, of static inline is supported
     5         kx echo " "
     5         kx echo "Checking to see if your system supports static inline..."
     5         kx $cat > try.c <<'EOCP'
     5         kx #include <stdlib.h>
     5         kx extern int f_via_a(int x);
     5         kx extern int f_via_b(int x);
     5         kx int main(int argc, char **argv)
     5         kx {
     5         kx     int y;
     5         kx 
     5         kx     y = f_via_a(0);
     5         kx #ifdef USE_B
     5         kx     y = f_via_b(0);
     5         kx #endif
     5         kx     if (y == 42) {
     5         kx         return EXIT_SUCCESS;
     5         kx     }
     5         kx     else {
     5         kx         return EXIT_FAILURE;
     5         kx     }
     5         kx }
     5         kx EOCP
     5         kx $cat > a.c <<'EOCP'
     5         kx static INLINE int f(int x) {
     5         kx     int y;
     5         kx     y = x + 42;
     5         kx     return y;
     5         kx }
     5         kx 
     5         kx int f_via_a(int x)
     5         kx {
     5         kx     return f(x);
     5         kx }
     5         kx EOCP
     5         kx $cat > b.c <<'EOCP'
     5         kx extern int f(int x);
     5         kx 
     5         kx int f_via_b(int x)
     5         kx {
     5         kx     return f(x);
     5         kx }
     5         kx EOCP
     5         kx 
     5         kx # Respect a hint (or previous) value for perl_static_inline, if there is one.
     5         kx case "$perl_static_inline" in
     5         kx '')	# Check the various possibilities, and break out on success.
     5         kx 	# For gcc, prefer __inline__, which will still permit
     5         kx 	# cflags.SH to add in -ansi.
     5         kx 	case "$gccversion" in
     5         kx 		'') xxx="inline __inline__ __inline _inline";;
     5         kx 		*)  xxx="__inline__ inline __inline _inline";;
     5         kx 	esac
     5         kx 	for inline in $xxx; do
     5         kx 		set try -DINLINE=$inline a.c
     5         kx 		if eval $compile && $run ./try; then
     5         kx 			# Now make sure there is no external linkage of static
     5         kx 			# functions
     5         kx 			set try -DINLINE=$inline -DUSE_B a.c b.c
     5         kx 			if eval $compile && $run ./try; then
     5         kx 				$echo "Your compiler supports static $inline, " >&4
     5         kx 				$echo "but it also creates an external definition," >&4
     5         kx 				$echo "so I won't use it." >&4
     5         kx 				val=$undef
     5         kx 			else
     5         kx 				$echo "Your compiler supports static $inline." >&4
     5         kx 				val=$define
     5         kx 				perl_static_inline="static $inline";
     5         kx 				break;
     5         kx 			fi
     5         kx 		else
     5         kx 			$echo "Your compiler does NOT support static $inline." >&4
     5         kx 			val="$undef"
     5         kx 		fi
     5         kx 	done
     5         kx 	;;
     5         kx *inline*) # Some variant of inline exists.
     5         kx 	echo "Keeping your $hint value of $perl_static_inline."
     5         kx 	val=$define
     5         kx 	;;
     5         kx static)  # No inline capabilities
     5         kx 	echo "Keeping your $hint value of $perl_static_inline."
     5         kx 	val=$undef
     5         kx 	;;
     5         kx *)  # Unrecognized previous value -- blindly trust the supplied
     5         kx 	# value and hope it makes sense.  Use old value for
     5         kx 	# d_static_inline, if there is one.
     5         kx 	echo "Keeping your $hint value of $perl_static_inline."
     5         kx 	case "$d_static_inline" in
     5         kx 		'') val=$define ;;
     5         kx 		*)  val=$d_static_inline ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx # Fallback to plain 'static' if nothing worked.
     5         kx case "$perl_static_inline" in
     5         kx '')
     5         kx 	perl_static_inline="static"
     5         kx 	val=$undef
     5         kx 	;;
     5         kx esac
     5         kx set d_static_inline
     5         kx eval $setvar
     5         kx $rm -f a.[co] b.[co]
     5         kx $rm_try
     5         kx 
     5         kx : Check stream access
     5         kx $cat >&4 <<EOM
     5         kx Checking how to access stdio streams by file descriptor number...
     5         kx EOM
     5         kx case "$stdio_stream_array" in
     5         kx '')	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
     5         kx     printf("yes\n");
     5         kx }
     5         kx EOCP
     5         kx 	for s in _iob __iob __sF
     5         kx 	do
     5         kx 	        set try -DSTDIO_STREAM_ARRAY=$s
     5         kx 		if eval $compile; then
     5         kx 			case "`$run ./try`" in
     5         kx 			yes)	stdio_stream_array=$s; break ;;
     5         kx 			esac
     5         kx 		fi
     5         kx 	done
     5         kx 	$rm_try
     5         kx esac
     5         kx case "$stdio_stream_array" in
     5         kx '')	$cat >&4 <<EOM
     5         kx I can't figure out how to access stdio streams by file descriptor number.
     5         kx EOM
     5         kx 	d_stdio_stream_array="$undef"
     5         kx 	;;
     5         kx *)	$cat >&4 <<EOM
     5         kx You can access stdio streams by file descriptor number by the $stdio_stream_array array.
     5         kx EOM
     5         kx 	d_stdio_stream_array="$define"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strcoll exists
     5         kx set strcoll d_strcoll
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strerror_l exists
     5         kx set strerror_l d_strerror_l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strerror_r exists
     5         kx set strerror_r d_strerror_r
     5         kx eval $inlibc
     5         kx case "$d_strerror_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h define string.h"
     5         kx 	case "$d_strerror_r_proto:$usethreads" in
     5         kx 	":define")	d_strerror_r_proto=define
     5         kx 		set d_strerror_r_proto strerror_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_strerror_r_proto" in
     5         kx 	define)
     5         kx 	case "$strerror_r_proto" in
     5         kx 	''|0) try='int strerror_r(int, char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
     5         kx 	esac
     5         kx 	case "$strerror_r_proto" in
     5         kx 	''|0) try='int strerror_r(int, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
     5         kx 	esac
     5         kx 	case "$strerror_r_proto" in
     5         kx 	''|0) try='char* strerror_r(int, char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
     5         kx 	esac
     5         kx 	case "$strerror_r_proto" in
     5         kx 	''|0)	d_strerror_r=undef
     5         kx 		strerror_r_proto=0
     5         kx 		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$strerror_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "strerror_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_strerror_r=undef
     5         kx 		strerror_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	strerror_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strftime exists
     5         kx set strftime d_strftime
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strlcat exists
     5         kx : We need both a prototype in string.h and the symbol in libc.
     5         kx echo " "
     5         kx d_strlcat_proto=''
     5         kx xx1="#$d_gnulibc HAS_GNULIBC"
     5         kx xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
     5         kx xx3='#   define _GNU_SOURCE'
     5         kx xx4='#endif'
     5         kx set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
     5         kx eval $hasproto
     5         kx case "$d_strlcat_proto" in
     5         kx     define) # see if strlcat exists
     5         kx 	set strlcat d_strlcat
     5         kx 	eval $inlibc
     5         kx 	;;
     5         kx     *)  val=$undef
     5         kx 	set d_strlcat
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strlcpy exists
     5         kx : We need both a prototype in string.h and the symbol in libc.
     5         kx echo " "
     5         kx d_strlcpy_proto=''
     5         kx xx1="#$d_gnulibc HAS_GNULIBC"
     5         kx xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
     5         kx xx3='#   define _GNU_SOURCE'
     5         kx xx4='#endif'
     5         kx set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
     5         kx eval $hasproto
     5         kx case "$d_strlcpy_proto" in
     5         kx     define) # see if strlcpy exists
     5         kx 	set strlcpy d_strlcpy
     5         kx 	eval $inlibc
     5         kx 	;;
     5         kx     *)  val=$undef
     5         kx 	set d_strlcpy
     5         kx 	eval $setvar
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strnlen exists
     5         kx set strnlen d_strnlen
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtod exists
     5         kx set strtod d_strtod
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtod_l exists
     5         kx set strtod_l d_strtod_l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtol exists
     5         kx set strtol d_strtol
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtold exists
     5         kx set strtold d_strtold
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtold_l exists
     5         kx set strtold_l d_strtold_l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtoll exists
     5         kx set strtoll d_strtoll
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_longlong-$d_strtoll" in
     5         kx "$define-$define")
     5         kx 	$cat <<EOM
     5         kx Checking whether your strtoll() works okay...
     5         kx EOM
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <errno.h>
     5         kx #ifdef __hpux
     5         kx #define strtoll __strtoll
     5         kx #endif
     5         kx #ifdef __EMX__
     5         kx #define strtoll _strtoll
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx static int bad = 0;
     5         kx void check(const char *s, long long ell, int een) {
     5         kx 	long long gll;
     5         kx 	errno = 0;
     5         kx 	gll = strtoll(s, 0, 10);
     5         kx 	if (!((gll == ell) && (errno == een)))
     5         kx 		bad++;
     5         kx }
     5         kx int main() {
     5         kx 	check(" 1",                                      1LL, 0);
     5         kx 	check(" 0",                                      0LL, 0);
     5         kx 	check("-1",                                     -1LL, 0);
     5         kx 	check("-9223372036854775808", -9223372036854775808LL, 0);
     5         kx 	check("-9223372036854775808", -9223372036854775808LL, 0);
     5         kx 	check(" 9223372036854775807",  9223372036854775807LL, 0);
     5         kx 	check("-9223372036854775808", -9223372036854775808LL, 0);
     5         kx 	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
     5         kx 	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
     5         kx 	if (!bad)
     5         kx 		printf("ok\n");
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		ok) echo "Your strtoll() seems to be working okay." ;;
     5         kx 		*) cat <<EOM >&4
     5         kx Your strtoll() doesn't seem to be working okay.
     5         kx EOM
     5         kx 		   d_strtoll="$undef"
     5         kx 		   ;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "(I can't seem to compile the test program--assuming it doesn't)"
     5         kx 		d_strtoll="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strtoq exists
     5         kx set strtoq d_strtoq
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strtoul exists
     5         kx set strtoul d_strtoul
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_strtoul" in
     5         kx "$define")
     5         kx 	$cat <<EOM
     5         kx Checking whether your strtoul() works okay...
     5         kx EOM
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <stdlib.h>
     5         kx #include <errno.h>
     5         kx #include <stdio.h>
     5         kx static int bad = 0;
     5         kx void check(const char *s, unsigned long eul, int een) {
     5         kx 	unsigned long gul;
     5         kx 	errno = 0;
     5         kx 	gul = strtoul(s, 0, 10);
     5         kx 	if (!((gul == eul) && (errno == een)))
     5         kx 		bad++;
     5         kx }
     5         kx int main() {
     5         kx 	check(" 1", 1L, 0);
     5         kx 	check(" 0", 0L, 0);
     5         kx EOCP
     5         kx 	case "$longsize" in
     5         kx 	8)
     5         kx 	    $cat >>try.c <<'EOCP'
     5         kx 	check("18446744073709551615", 18446744073709551615UL, 0);
     5         kx 	check("18446744073709551616", 18446744073709551615UL, ERANGE);
     5         kx #if 0 /* strtoul() for /^-/ strings is undefined. */
     5         kx 	check("-1", 18446744073709551615UL, 0);
     5         kx 	check("-18446744073709551614", 2, 0);
     5         kx 	check("-18446744073709551615", 1, 0);
     5         kx 	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
     5         kx 	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
     5         kx #endif
     5         kx EOCP
     5         kx 		;;
     5         kx 	4)
     5         kx 		    $cat >>try.c <<'EOCP'
     5         kx 	check("4294967295", 4294967295UL, 0);
     5         kx 	check("4294967296", 4294967295UL, ERANGE);
     5         kx #if 0 /* strtoul() for /^-/ strings is undefined. */
     5         kx 	check("-1", 4294967295UL, 0);
     5         kx 	check("-4294967294", 2, 0);
     5         kx 	check("-4294967295", 1, 0);
     5         kx 	check("-4294967296", 4294967295UL, ERANGE);
     5         kx 	check("-4294967297", 4294967295UL, ERANGE);
     5         kx #endif
     5         kx EOCP
     5         kx 		;;
     5         kx 	*)
     5         kx : Should we write these tests to be more portable by sprintf-ing
     5         kx : ~0 and then manipulating that char string as input for strtol?
     5         kx 		;;
     5         kx 	esac
     5         kx 	$cat >>try.c <<'EOCP'
     5         kx 	if (!bad)
     5         kx 		printf("ok\n");
     5         kx 	return 0;
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		case "`$run ./try`" in
     5         kx 		ok) echo "Your strtoul() seems to be working okay." ;;
     5         kx 		*) cat <<EOM >&4
     5         kx Your strtoul() doesn't seem to be working okay.
     5         kx EOM
     5         kx 		   d_strtoul="$undef"
     5         kx 		   ;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "(I can't seem to compile the test program--assuming it doesn't)"
     5         kx 		d_strtoul="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strtoull exists
     5         kx set strtoull d_strtoull
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_longlong-$d_strtoull" in
     5         kx "$define-$define")
     5         kx 	$cat <<EOM
     5         kx Checking whether your strtoull() works okay...
     5         kx EOM
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <stdlib.h>
     5         kx #include <errno.h>
     5         kx #ifdef __hpux
     5         kx #define strtoull __strtoull
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx static int bad = 0;
     5         kx void check(const char *s, long long eull, int een) {
     5         kx 	long long gull;
     5         kx 	errno = 0;
     5         kx 	gull = strtoull(s, 0, 10);
     5         kx 	if (!((gull == eull) && (errno == een)))
     5         kx 		bad++;
     5         kx }
     5         kx int main() {
     5         kx 	check(" 1",                                        1LL, 0);
     5         kx 	check(" 0",                                        0LL, 0);
     5         kx 	check("18446744073709551615",  18446744073709551615ULL, 0);
     5         kx 	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
     5         kx #if 0 /* strtoull() for /^-/ strings is undefined. */
     5         kx 	check("-1",                    18446744073709551615ULL, 0);
     5         kx 	check("-18446744073709551614",                     2LL, 0);
     5         kx 	check("-18446744073709551615",                     1LL, 0);
     5         kx 	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
     5         kx 	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
     5         kx #endif
     5         kx 	if (!bad)
     5         kx 		printf("ok\n");
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		case "`$run ./try`" in
     5         kx 		ok) echo "Your strtoull() seems to be working okay." ;;
     5         kx 		*) cat <<EOM >&4
     5         kx Your strtoull() doesn't seem to be working okay.
     5         kx EOM
     5         kx 		   d_strtoull="$undef"
     5         kx 		   ;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "(I can't seem to compile the test program--assuming it doesn't)"
     5         kx 		d_strtoull="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strtouq exists
     5         kx set strtouq d_strtouq
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_strtouq" in
     5         kx "$define")
     5         kx 	$cat <<EOM
     5         kx Checking whether your strtouq() works okay...
     5         kx EOM
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <stdlib.h>
     5         kx #include <errno.h>
     5         kx #include <stdio.h>
     5         kx static int bad = 0;
     5         kx void check(const char *s, unsigned long long eull, int een) {
     5         kx 	unsigned long long gull;
     5         kx 	errno = 0;
     5         kx 	gull = strtouq(s, 0, 10);
     5         kx 	if (!((gull == eull) && (errno == een)))
     5         kx 		bad++;
     5         kx }
     5         kx int main() {
     5         kx 	check(" 1",                                        1LL, 0);
     5         kx 	check(" 0",                                        0LL, 0);
     5         kx 	check("18446744073709551615",  18446744073709551615ULL, 0);
     5         kx 	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
     5         kx #if 0 /* strtouq() for /^-/ strings is undefined. */
     5         kx 	check("-1",                    18446744073709551615ULL, 0);
     5         kx 	check("-18446744073709551614",                     2LL, 0);
     5         kx 	check("-18446744073709551615",                     1LL, 0);
     5         kx 	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
     5         kx 	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
     5         kx #endif
     5         kx 	if (!bad)
     5         kx 		printf("ok\n");
     5         kx 	return 0;
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		case "`$run ./try`" in
     5         kx 		ok) echo "Your strtouq() seems to be working okay." ;;
     5         kx 		*) cat <<EOM >&4
     5         kx Your strtouq() doesn't seem to be working okay.
     5         kx EOM
     5         kx 		   d_strtouq="$undef"
     5         kx 		   ;;
     5         kx 		esac
     5         kx 	else
     5         kx 		echo "(I can't seem to compile the test program--assuming it doesn't)"
     5         kx 		d_strtouq="$undef"
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if strxfrm exists
     5         kx set strxfrm d_strxfrm
     5         kx eval $inlibc
     5         kx 
     5         kx : see if strxfrm_l exists
     5         kx set strxfrm_l d_strxfrm_l
     5         kx eval $inlibc
     5         kx 
     5         kx : see if symlink exists
     5         kx set symlink d_symlink
     5         kx eval $inlibc
     5         kx 
     5         kx : see if syscall exists
     5         kx set syscall d_syscall
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for syscall is available
     5         kx echo " "
     5         kx set d_syscallproto syscall $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if sysconf exists
     5         kx set sysconf d_sysconf
     5         kx eval $inlibc
     5         kx 
     5         kx : see if sys_errlist[] exists
     5         kx echo " "
     5         kx if test "X$d_syserrlst" = X; then
     5         kx 	if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
     5         kx 		echo "You have sys_errlist[], so we could roll our own strerror."
     5         kx 		d_syserrlst="$define"
     5         kx 	else
     5         kx 		echo "You don't have sys_errlist[], so strerror() is welcome."
     5         kx 		d_syserrlst="$undef"
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx : see if system exists
     5         kx set system d_system
     5         kx eval $inlibc
     5         kx 
     5         kx : see if tcgetpgrp exists
     5         kx set tcgetpgrp d_tcgetpgrp
     5         kx eval $inlibc
     5         kx 
     5         kx : see if tcsetpgrp exists
     5         kx set tcsetpgrp d_tcsetpgrp
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for telldir is available
     5         kx echo " "
     5         kx set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if tgamma exists
     5         kx set tgamma d_tgamma
     5         kx eval $inlibc
     5         kx 
     5         kx : see what flavor, if any, of thread local storage is supported
     5         kx echo " "
     5         kx echo "Checking to see if your system supports C11 thread local storage..."
     5         kx $cat > try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx #include <pthread.h>
     5         kx 
     5         kx static int plus_one = 1;
     5         kx static int minus_one = -1;
     5         kx 
     5         kx PROBE_MACRO int *minion;
     5         kx 
     5         kx int callback (const void *a, const void *b) {
     5         kx     int val_a = *minion * *(const int *)a;
     5         kx     int val_b = *minion * *(const int *)b;
     5         kx     return val_a < val_b ? -1 : val_a > val_b;
     5         kx }
     5         kx 
     5         kx #define SIZE 8
     5         kx 
     5         kx void *thread_function(void *arg) {
     5         kx     /* thread local variables should start zeroed in each thread. */
     5         kx     if (minion != NULL) {
     5         kx         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
     5         kx                 minion);
     5         kx         exit(2);
     5         kx     }
     5         kx     minion = &minus_one;
     5         kx 
     5         kx     int array[SIZE];
     5         kx     unsigned int i;
     5         kx     for (i = 0; i < SIZE; ++i) {
     5         kx         /* "Hash randomisation" - this array isn't in sorted order: */
     5         kx         array[i ^ 5] = i * i;
     5         kx     }
     5         kx 
     5         kx     qsort(array, SIZE, sizeof(int), callback);
     5         kx 
     5         kx     int bad = 0;
     5         kx     for (i = 0; i < SIZE; ++i) {
     5         kx         int want = (SIZE - 1 - i) * (SIZE - 1 - i);
     5         kx         int have = array[i];
     5         kx         if (want != have) {
     5         kx             ++bad;
     5         kx             fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
     5         kx         }
     5         kx     }
     5         kx     if (bad)
     5         kx         exit(3);
     5         kx 
     5         kx     return NULL;
     5         kx }
     5         kx 
     5         kx int main(int argc, char **argv) {
     5         kx     if (minion != NULL) {
     5         kx         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
     5         kx                 minion);
     5         kx         exit(4);
     5         kx     }
     5         kx 
     5         kx     minion = &plus_one;
     5         kx 
     5         kx     pthread_t tid;
     5         kx     int result = pthread_create(&tid, NULL, thread_function, NULL);
     5         kx     if (result) {
     5         kx         fprintf(stderr, "pthread_create failed (%d)\n", result);
     5         kx         exit(5);
     5         kx     }
     5         kx 
     5         kx     result = pthread_join(tid, NULL);
     5         kx     if (result) {
     5         kx         fprintf(stderr, "pthread_join failed (%d)\n", result);
     5         kx         exit(6);
     5         kx     }
     5         kx 
     5         kx     if (minion == NULL) {
     5         kx         fprintf(stderr, "__thread variable should not be NULL\n");
     5         kx         exit(7);
     5         kx     }
     5         kx     if (!(minion == &plus_one && *minion == 1)) {
     5         kx         fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
     5         kx                 1, &plus_one, *minion, minion);
     5         kx         exit(8);
     5         kx     }
     5         kx 
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx 
     5         kx # Respect a hint (or previous) value for perl_thread_local, if there is one.
     5         kx case "$perl_thread_local" in
     5         kx '')	# Check the various possibilities, and break out on success.
     5         kx 	for thread_local in _Thread_local __thread; do
     5         kx 		set try -DPROBE_MACRO=$thread_local
     5         kx 		if eval $compile && $run ./try; then
     5         kx 			$echo "Your compiler supports $thread_local." >&4
     5         kx 			val=$define
     5         kx 			perl_thread_local="$thread_local";
     5         kx 			break;
     5         kx 		fi
     5         kx 		$echo "Your compiler does NOT support $thread_local." >&4
     5         kx 		val="$undef"
     5         kx 	done
     5         kx 	;;
     5         kx *thread*|*Thread*) # Some variant of thread local exists.
     5         kx 	echo "Keeping your $hint value of $perl_thread_local."
     5         kx 	val=$define
     5         kx 	;;
     5         kx *)  # Unrecognized previous value -- blindly trust the supplied
     5         kx 	# value and hope it makes sense.  Use old value for
     5         kx 	# d_thread_local, if there is one.
     5         kx 	echo "Keeping your $hint value of $perl_thread_local."
     5         kx 	case "$d_thread_local" in
     5         kx 		'') val=$define ;;
     5         kx 		*)  val=$d_thread_local ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx set d_thread_local
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if time exists
     5         kx echo " "
     5         kx if test "X$d_time" = X -o X"$timetype" = X; then
     5         kx     if set time val -f d_time; eval $csym; $val; then
     5         kx 		echo 'time() found.' >&4
     5         kx 		val="$define"
     5         kx 		rp="What is the type returned by time() on this system?"
     5         kx 		set time_t timetype long stdio.h sys/types.h
     5         kx 		eval $typedef_ask
     5         kx     else
     5         kx 		echo 'time() not found, hope that will do.' >&4
     5         kx 		val="$undef"
     5         kx 		timetype='int';
     5         kx     fi
     5         kx     set d_time
     5         kx     eval $setvar
     5         kx fi
     5         kx 
     5         kx : see if timegm exists
     5         kx set timegm d_timegm
     5         kx eval $inlibc
     5         kx 
     5         kx : see if this is a sys/times.h system
     5         kx set sys/times.h i_systimes
     5         kx eval $inhdr
     5         kx 
     5         kx : see if times exists
     5         kx echo " "
     5         kx if set times val -f d_times; eval $csym; $val; then
     5         kx 	echo 'times() found.' >&4
     5         kx 	d_times="$define"
     5         kx 	inc=''
     5         kx 	case "$i_systimes" in
     5         kx 	"$define") inc='sys/times.h';;
     5         kx 	esac
     5         kx 	rp="What is the type returned by times() on this system?"
     5         kx 	set clock_t clocktype long stdio.h sys/types.h $inc
     5         kx 	eval $typedef_ask
     5         kx else
     5         kx 	echo 'times() NOT found, hope that will do.' >&4
     5         kx 	d_times="$undef"
     5         kx 	clocktype='int'
     5         kx fi
     5         kx 
     5         kx : see if tmpnam_r exists
     5         kx set tmpnam_r d_tmpnam_r
     5         kx eval $inlibc
     5         kx case "$d_tmpnam_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h "
     5         kx 	case "$d_tmpnam_r_proto:$usethreads" in
     5         kx 	":define")	d_tmpnam_r_proto=define
     5         kx 		set d_tmpnam_r_proto tmpnam_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_tmpnam_r_proto" in
     5         kx 	define)
     5         kx 	case "$tmpnam_r_proto" in
     5         kx 	''|0) try='char* tmpnam_r(char*);'
     5         kx 	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
     5         kx 	esac
     5         kx 	case "$tmpnam_r_proto" in
     5         kx 	''|0)	d_tmpnam_r=undef
     5         kx 		tmpnam_r_proto=0
     5         kx 		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$tmpnam_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_tmpnam_r=undef
     5         kx 		tmpnam_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	tmpnam_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if towlower exists
     5         kx set towlower d_towlower
     5         kx eval $inlibc
     5         kx 
     5         kx : see if trunc exists
     5         kx set trunc d_trunc
     5         kx eval $inlibc
     5         kx 
     5         kx : see if truncate exists
     5         kx set truncate d_truncate
     5         kx eval $inlibc
     5         kx 
     5         kx : see if ttyname_r exists
     5         kx set ttyname_r d_ttyname_r
     5         kx eval $inlibc
     5         kx case "$d_ttyname_r" in
     5         kx "$define")
     5         kx 	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
     5         kx 	case "$d_ttyname_r_proto:$usethreads" in
     5         kx 	":define")	d_ttyname_r_proto=define
     5         kx 		set d_ttyname_r_proto ttyname_r $hdrs
     5         kx 		eval $hasproto ;;
     5         kx 	*)	;;
     5         kx 	esac
     5         kx 	case "$d_ttyname_r_proto" in
     5         kx 	define)
     5         kx 	case "$ttyname_r_proto" in
     5         kx 	''|0) try='int ttyname_r(int, char*, size_t);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
     5         kx 	esac
     5         kx 	case "$ttyname_r_proto" in
     5         kx 	''|0) try='int ttyname_r(int, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
     5         kx 	esac
     5         kx 	case "$ttyname_r_proto" in
     5         kx 	''|0) try='char* ttyname_r(int, char*, int);'
     5         kx 	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
     5         kx 	esac
     5         kx 	case "$ttyname_r_proto" in
     5         kx 	''|0)	d_ttyname_r=undef
     5         kx 		ttyname_r_proto=0
     5         kx 		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
     5         kx 	* )	case "$ttyname_r_proto" in
     5         kx 		REENTRANT_PROTO*) ;;
     5         kx 		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
     5         kx 		esac
     5         kx 		echo "Prototype: $try" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx 	*)	case "$usethreads" in
     5         kx 		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
     5         kx 		esac
     5         kx 		d_ttyname_r=undef
     5         kx 		ttyname_r_proto=0
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	ttyname_r_proto=0
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if tzname[] exists
     5         kx echo " "
     5         kx if set tzname val -a d_tzname; eval $csym; $val; then
     5         kx 	val="$define"
     5         kx 	echo 'tzname[] found.' >&4
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo 'tzname[] NOT found.' >&4
     5         kx fi
     5         kx set d_tzname
     5         kx eval $setvar
     5         kx 
     5         kx : Check if is a multiplatform env
     5         kx case "$osname" in
     5         kx darwin) multiarch="$define" ;;
     5         kx esac
     5         kx case "$multiarch" in
     5         kx ''|[nN]*) multiarch="$undef" ;;
     5         kx esac
     5         kx 
     5         kx : check for ordering of bytes in a UV
     5         kx echo " "
     5         kx case "$multiarch" in
     5         kx *$define*)
     5         kx 	$cat <<EOM
     5         kx You seem to be doing a multiarchitecture build,
     5         kx skipping the byteorder check.
     5         kx 
     5         kx EOM
     5         kx 	byteorder='ffff'
     5         kx 	;;
     5         kx *)
     5         kx 	case "$byteorder" in
     5         kx 	'')
     5         kx 		$cat <<'EOM'
     5         kx In the following, larger digits indicate more significance.  A big-endian
     5         kx machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
     5         kx little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
     5         kx machines may have weird orders like 3412.  A Cray will report 87654321,
     5         kx an Alpha will report 12345678. If the test program works the default is
     5         kx probably right.
     5         kx I'm now running the test program...
     5         kx EOM
     5         kx 		$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <sys/types.h>
     5         kx typedef $uvtype UV;
     5         kx int main()
     5         kx {
     5         kx 	int i;
     5         kx 	union {
     5         kx 		UV l;
     5         kx 		char c[$uvsize];
     5         kx 	} u;
     5         kx 
     5         kx 	if ($uvsize > 4)
     5         kx 		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
     5         kx 	else
     5         kx 		u.l = (UV)0x04030201;
     5         kx 	for (i = 0; i < $uvsize; i++)
     5         kx 		printf("%c", u.c[i]+'0');
     5         kx 	printf("\n");
     5         kx 	exit(0);
     5         kx }
     5         kx EOCP
     5         kx 		xxx_prompt=y
     5         kx 		set try
     5         kx 		if eval $compile && $run ./try > /dev/null; then
     5         kx 			dflt=`$run ./try`
     5         kx 			case "$dflt" in
     5         kx 			[1-4][1-4][1-4][1-4]|12345678|87654321)
     5         kx 				echo "(The test program ran ok.)"
     5         kx 				echo "byteorder=$dflt"
     5         kx 				xxx_prompt=n
     5         kx 			;;
     5         kx 			????|????????) echo "(The test program ran ok.)" ;;
     5         kx 			*) echo "(The test program didn't run right for some reason.)" ;;
     5         kx 			esac
     5         kx 		else
     5         kx 			dflt='4321'
     5         kx 			cat <<'EOM'
     5         kx (I can't seem to compile the test program.  Guessing big-endian...)
     5         kx EOM
     5         kx 		fi
     5         kx 		case "$xxx_prompt" in
     5         kx 		y)
     5         kx 			rp="What is the order of bytes in $uvtype?"
     5         kx 			. ./myread
     5         kx 			byteorder="$ans"
     5         kx 			;;
     5         kx 		*)	byteorder=$dflt
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Checking 32bit alignedness
     5         kx $cat <<EOM
     5         kx 
     5         kx Checking to see whether you can access character data unalignedly...
     5         kx EOM
     5         kx case "$d_u32align" in
     5         kx '')   $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #define U32 $u32type
     5         kx #define BYTEORDER 0x$byteorder
     5         kx #define U8 $u8type
     5         kx #include <signal.h>
     5         kx #ifdef SIGBUS
     5         kx $signal_t bletch(int s) { exit(4); }
     5         kx #endif
     5         kx int main() {
     5         kx #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
     5         kx     volatile U8 buf[8];
     5         kx     volatile U32 *up;
     5         kx     int i;
     5         kx 
     5         kx     if (sizeof(U32) != 4) {
     5         kx 	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
     5         kx 	exit(1);
     5         kx     }
     5         kx 
     5         kx     fflush(stdout);
     5         kx 
     5         kx #ifdef SIGBUS
     5         kx     signal(SIGBUS, bletch);
     5         kx #endif
     5         kx 
     5         kx     buf[0] = 0;
     5         kx     buf[1] = 0;
     5         kx     buf[2] = 0;
     5         kx     buf[3] = 1;
     5         kx     buf[4] = 0;
     5         kx     buf[5] = 0;
     5         kx     buf[6] = 0;
     5         kx     buf[7] = 1;
     5         kx 
     5         kx     for (i = 0; i < 4; i++) {
     5         kx 	up = (U32*)(buf + i);
     5         kx 	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
     5         kx 	       (*up == 1 << (8*(3-i)))  /* little-endian */
     5         kx 	      )
     5         kx 	   )
     5         kx 	{
     5         kx 	    printf("read failed (%x)\n", *up);
     5         kx 	    exit(2);
     5         kx 	}
     5         kx     }
     5         kx 
     5         kx     /* write test */
     5         kx     for (i = 0; i < 4; i++) {
     5         kx 	up = (U32*)(buf + i);
     5         kx 	*up = 0xBeef;
     5         kx 	if (*up != 0xBeef) {
     5         kx 	    printf("write failed (%x)\n", *up);
     5         kx 	    exit(3);
     5         kx 	}
     5         kx     }
     5         kx 
     5         kx     exit(0);
     5         kx #else
     5         kx     printf("1\n");
     5         kx     exit(1);
     5         kx #endif
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
     5         kx 	$run ./try 2>&1 >/dev/null
     5         kx 	case "$?" in
     5         kx 	0)	cat >&4 <<EOM
     5         kx You can access character data pretty unalignedly.
     5         kx EOM
     5         kx 		d_u32align="$undef"
     5         kx 		;;
     5         kx 	*)	cat >&4 <<EOM
     5         kx It seems that you must access character data in an aligned manner.
     5         kx EOM
     5         kx 		d_u32align="$define"
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	rp='Can you access character data at unaligned addresses?'
     5         kx 	dflt='n'
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	[yY]*)	d_u32align="$undef"  ;;
     5         kx 	*)	d_u32align="$define" ;;
     5         kx 	esac
     5         kx fi
     5         kx $rm_try
     5         kx ;;
     5         kx esac
     5         kx 
     5         kx : see if ualarm exists
     5         kx set ualarm d_ualarm
     5         kx eval $inlibc
     5         kx 
     5         kx : see if umask exists
     5         kx set umask d_umask
     5         kx eval $inlibc
     5         kx 
     5         kx : see if unordered exists
     5         kx set unordered d_unordered
     5         kx eval $inlibc
     5         kx 
     5         kx : see if unsetenv exists
     5         kx set unsetenv d_unsetenv
     5         kx eval $inlibc
     5         kx 
     5         kx : see if usleep exists
     5         kx set usleep d_usleep
     5         kx eval $inlibc
     5         kx 
     5         kx : see if prototype for usleep is available
     5         kx echo " "
     5         kx set d_usleepproto usleep $i_unistd unistd.h
     5         kx eval $hasproto
     5         kx 
     5         kx : see if ustat exists
     5         kx set ustat d_ustat
     5         kx eval $inlibc
     5         kx 
     5         kx : see if closedir exists
     5         kx set closedir d_closedir
     5         kx eval $inlibc
     5         kx 
     5         kx case "$d_closedir" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	echo "Checking whether closedir() returns a status..." >&4
     5         kx 	cat > try.c <<EOM
     5         kx #$i_dirent I_DIRENT		/**/
     5         kx #$i_sysdir I_SYS_DIR		/**/
     5         kx #$i_sysndir I_SYS_NDIR		/**/
     5         kx #$i_systypes I_SYS_TYPES	/**/
     5         kx 
     5         kx #if defined(I_SYS_TYPES)
     5         kx #include <sys/types.h>
     5         kx #endif
     5         kx #if defined(I_DIRENT)
     5         kx #include <dirent.h>
     5         kx #else
     5         kx #ifdef I_SYS_NDIR
     5         kx #include <sys/ndir.h>
     5         kx #else
     5         kx #ifdef I_SYS_DIR
     5         kx #include <sys/dir.h>
     5         kx #endif
     5         kx #endif
     5         kx #endif
     5         kx int main() { return closedir(opendir(".")); }
     5         kx EOM
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		if $run ./try > /dev/null 2>&1 ; then
     5         kx 			echo "Yes, it does."
     5         kx 			val="$undef"
     5         kx 		else
     5         kx 			echo "No, it doesn't."
     5         kx 			val="$define"
     5         kx 		fi
     5         kx 	else
     5         kx 		echo "(I can't seem to compile the test program--assuming it doesn't)"
     5         kx 		val="$define"
     5         kx 	fi
     5         kx 	;;
     5         kx *)
     5         kx 	val="$undef";
     5         kx 	;;
     5         kx esac
     5         kx set d_void_closedir
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if there is a wait4
     5         kx set wait4 d_wait4
     5         kx eval $inlibc
     5         kx 
     5         kx : see if waitpid exists
     5         kx set waitpid d_waitpid
     5         kx eval $inlibc
     5         kx 
     5         kx : see if wcrtomb exists
     5         kx set wcrtomb d_wcrtomb
     5         kx eval $inlibc
     5         kx 
     5         kx : look for wcscmp
     5         kx echo " "
     5         kx $cat >try.c <<'EOCP'
     5         kx #include <stdio.h>
     5         kx #include <wchar.h>
     5         kx int main ()
     5         kx {
     5         kx     wchar_t *s = L" ";
     5         kx     return (wcscmp (s, s) ? 1 : 0);
     5         kx     }
     5         kx EOCP
     5         kx set try
     5         kx val="$undef"
     5         kx if eval $compile; then
     5         kx     `$run ./try`
     5         kx     case "$?" in
     5         kx 	0)  echo "A working wcscmp() found." >&4
     5         kx 	    val="$define" ;;
     5         kx 	*)  echo "wcscmp() found, but it doesn't work" >&4
     5         kx 	    ;;
     5         kx 	esac
     5         kx else
     5         kx     echo "wcscmp() NOT found." >&4
     5         kx     fi
     5         kx set d_wcscmp
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if wcstombs exists
     5         kx set wcstombs d_wcstombs
     5         kx eval $inlibc
     5         kx 
     5         kx : look for wcsxfrm
     5         kx echo " "
     5         kx $cat >try.c <<'EOCP'
     5         kx #include <errno.h>
     5         kx #include <wchar.h>
     5         kx int main ()
     5         kx {
     5         kx     wchar_t dst[4], *src = L" ";
     5         kx     errno = 0;
     5         kx     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
     5         kx     }
     5         kx EOCP
     5         kx set try
     5         kx val="$undef"
     5         kx if eval $compile; then
     5         kx     `$run ./try`
     5         kx     case "$?" in
     5         kx 	0)  echo "A working wcsxfrm() found." >&4
     5         kx 	    val="$define" ;;
     5         kx 	*)  echo "wcsxfrm() found, but it doesn't work" >&4
     5         kx 	    ;;
     5         kx 	esac
     5         kx else
     5         kx     echo "wcsxfrm() NOT found." >&4
     5         kx     fi
     5         kx set d_wcsxfrm
     5         kx eval $setvar
     5         kx $rm_try
     5         kx 
     5         kx : see if wctomb exists
     5         kx set wctomb d_wctomb
     5         kx eval $inlibc
     5         kx 
     5         kx : see if writev exists
     5         kx set writev d_writev
     5         kx eval $inlibc
     5         kx 
     5         kx : check for alignment requirements
     5         kx echo " "
     5         kx case "$alignbytes" in
     5         kx     '') echo "Checking alignment constraints..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx struct foobar {
     5         kx     char foo;
     5         kx     $nvtype bar;
     5         kx } try_algn;
     5         kx int main()
     5         kx {
     5         kx     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
     5         kx     return(0);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 	    dflt=`$run ./try`
     5         kx 	else
     5         kx 	    dflt='8'
     5         kx 	    echo "(I can't seem to compile the test program...)"
     5         kx 	fi
     5         kx 	case "$multiarch" in
     5         kx 	    *$define*)
     5         kx 		: The usual safe value is 8, but Darwin with -Duselongdouble
     5         kx 		: needs 16.  Hence, we will take 8 as a minimum, but allow
     5         kx 		: Configure to pick a larger value if needed.
     5         kx 		if $test "$dflt" -lt 8; then
     5         kx 		    dflt='8'
     5         kx 		    echo "Setting alignment to 8 for multiarch support.">&4
     5         kx 		fi
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx     *) dflt="$alignbytes"
     5         kx 	;;
     5         kx esac
     5         kx rp="Doubles must be aligned on a how-many-byte boundary?"
     5         kx . ./myread
     5         kx alignbytes="$ans"
     5         kx $rm_try
     5         kx 
     5         kx : set the base revision
     5         kx baserev=5.0
     5         kx 
     5         kx : length of character in bytes. Is always 1, otherwise it is not C
     5         kx : This used to be a test using sizeof
     5         kx charsize=1
     5         kx 
     5         kx : Check for the number of bits in a character
     5         kx case "$charbits" in
     5         kx '')	echo "Checking how long a character is (in bits)..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx int main ()
     5         kx {
     5         kx     int n;
     5         kx     unsigned char c;
     5         kx     for (c = 1, n = 0; c; c <<= 1, n++) ;
     5         kx     printf ("%d\n", n);
     5         kx     return (0);
     5         kx     }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok; then
     5         kx 		dflt=`$run ./try`
     5         kx 	else
     5         kx 		dflt='8'
     5         kx 		echo "(I can't seem to compile the test program.  Guessing...)"
     5         kx 	fi
     5         kx 	;;
     5         kx *)
     5         kx 	dflt="$charbits"
     5         kx 	;;
     5         kx esac
     5         kx rp="What is the length of a character (in bits)?"
     5         kx . ./myread
     5         kx charbits="$ans"
     5         kx $rm_try
     5         kx case "$charbits" in
     5         kx 8)	;;
     5         kx *)	cat >&4 << EOM
     5         kx Your system has an unsigned character size of $charbits bits, which
     5         kx is rather unusual (normally it is 8 bits).  Perl likely will not work
     5         kx correctly on your system, with subtle bugs in various places.
     5         kx EOM
     5         kx 	rp='Do you really want to continue?'
     5         kx 	dflt='n'
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 		[yY])	echo >&4 "Okay, continuing."	;;
     5         kx 		*)	exit 1				;;
     5         kx 	esac
     5         kx esac
     5         kx 
     5         kx : how do we concatenate cpp tokens here?
     5         kx echo " "
     5         kx echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
     5         kx $cat >cpp_stuff.c <<'EOCP'
     5         kx #define RCAT(a,b)a/**/b
     5         kx #define ACAT(a,b)a ## b
     5         kx RCAT(Rei,ser)
     5         kx ACAT(Cir,cus)
     5         kx EOCP
     5         kx $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
     5         kx if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
     5         kx 	echo "Oh!  Smells like ANSI's been here." >&4
     5         kx 	echo "We can catify or stringify, separately or together!"
     5         kx 	cpp_stuff=42
     5         kx elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
     5         kx 	echo "Ah, yes!  The good old days!" >&4
     5         kx 	echo "However, in the good old days we don't know how to stringify and"
     5         kx 	echo "catify at the same time."
     5         kx 	cpp_stuff=1
     5         kx else
     5         kx 	$cat >&4 <<EOM
     5         kx Hmm, I don't seem to be able to concatenate tokens with your cpp.
     5         kx You're going to have to edit the values of CAT[2-5] in config.h...
     5         kx EOM
     5         kx 	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
     5         kx fi
     5         kx $rm -f cpp_stuff.*
     5         kx 
     5         kx : see if this is a db.h system
     5         kx set db.h i_db
     5         kx eval $inhdr
     5         kx 
     5         kx case "$i_db" in
     5         kx $define)
     5         kx 	: Check db version.
     5         kx 	echo " "
     5         kx 	echo "Checking Berkeley DB version ..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <db.h>
     5         kx int main(int argc, char *argv[])
     5         kx {
     5         kx #ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
     5         kx     int Major, Minor, Patch ;
     5         kx     unsigned long Version ;
     5         kx     (void)db_version(&Major, &Minor, &Patch) ;
     5         kx     if (argc == 2) {
     5         kx         printf("%d %d %d %d %d %d\n",
     5         kx                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
     5         kx                Major, Minor, Patch);
     5         kx         exit(0);
     5         kx     }
     5         kx     printf("You have Berkeley DB Version 2 or greater.\n");
     5         kx 
     5         kx     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
     5         kx 		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
     5         kx     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
     5         kx 		Major, Minor, Patch) ;
     5         kx 
     5         kx     /* check that db.h & libdb are compatible */
     5         kx     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
     5         kx 	printf("db.h and libdb are incompatible.\n") ;
     5         kx         exit(3);
     5         kx     }
     5         kx 
     5         kx     printf("db.h and libdb are compatible.\n") ;
     5         kx 
     5         kx     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
     5         kx 		+ DB_VERSION_PATCH ;
     5         kx 
     5         kx     /* needs to be >= 2.3.4 */
     5         kx     if (Version < 2003004) {
     5         kx     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
     5         kx 	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
     5         kx         exit(2);
     5         kx     }
     5         kx 
     5         kx     exit(0);
     5         kx #else
     5         kx #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
     5         kx     if (argc == 2) {
     5         kx         printf("1 0 0\n");
     5         kx         exit(0);
     5         kx     }
     5         kx     printf("You have Berkeley DB Version 1.\n");
     5         kx     exit(0);	/* DB version < 2: the coast is clear. */
     5         kx #else
     5         kx     exit(1);	/* <db.h> not Berkeley DB? */
     5         kx #endif
     5         kx #endif
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile_ok && $run ./try; then
     5         kx 		echo 'Looks OK.' >&4
     5         kx 		set `$run ./try 1`
     5         kx 		db_version_major=$1
     5         kx 		db_version_minor=$2
     5         kx 		db_version_patch=$3
     5         kx 	else
     5         kx 		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
     5         kx 		i_db=$undef
     5         kx 		case " $libs " in
     5         kx 		*"-ldb "*)
     5         kx 			: Remove db from list of libraries to use
     5         kx 			echo "Removing unusable -ldb from library list" >&4
     5         kx 			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
     5         kx 			shift
     5         kx 			libs="$*"
     5         kx 			echo "libs = $libs" >&4
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$i_db" in
     5         kx define)
     5         kx 	: Check the return type needed for hash
     5         kx 	echo " "
     5         kx 	echo "Checking return type needed for hash for Berkeley DB ..." >&4
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <db.h>
     5         kx 
     5         kx #ifndef DB_VERSION_MAJOR
     5         kx u_int32_t hash_cb (const void* ptr, size_t size)
     5         kx {
     5         kx 	return 0;
     5         kx }
     5         kx HASHINFO info;
     5         kx int main()
     5         kx {
     5         kx 	info.hash = hash_cb;
     5         kx }
     5         kx #endif
     5         kx EOCP
     5         kx 	if $cc $ccflags -c try.c >try.out 2>&1 ; then
     5         kx 		if $compiler_warning try.out >>/dev/null 2>&1 ; then
     5         kx 			db_hashtype='int'
     5         kx 		else
     5         kx 			db_hashtype='u_int32_t'
     5         kx 		fi
     5         kx 	else
     5         kx 		: XXX Maybe we should just give up here.
     5         kx 		db_hashtype=u_int32_t
     5         kx 		$cat try.out >&4
     5         kx 		echo "Help:  I can't seem to compile the db test program." >&4
     5         kx 		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	echo "Your version of Berkeley DB uses $db_hashtype for hash."
     5         kx 	;;
     5         kx *)	db_hashtype=u_int32_t
     5         kx 	;;
     5         kx esac
     5         kx case "$i_db" in
     5         kx define)
     5         kx 	: Check the return type needed for prefix
     5         kx 	echo " "
     5         kx 	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
     5         kx 	cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <db.h>
     5         kx 
     5         kx #ifndef DB_VERSION_MAJOR
     5         kx size_t prefix_cb (const DBT *key1, const DBT *key2)
     5         kx {
     5         kx 	return 0;
     5         kx }
     5         kx BTREEINFO info;
     5         kx int main()
     5         kx {
     5         kx 	info.prefix = prefix_cb;
     5         kx }
     5         kx #endif
     5         kx EOCP
     5         kx 	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
     5         kx 		if $compiler_warning try.out >>/dev/null 2>&1 ; then
     5         kx 			db_prefixtype='int'
     5         kx 		else
     5         kx 			db_prefixtype='size_t'
     5         kx 		fi
     5         kx 	else
     5         kx 		db_prefixtype='size_t'
     5         kx 		: XXX Maybe we should just give up here.
     5         kx 		$cat try.out >&4
     5         kx 		echo "Help:  I can't seem to compile the db test program." >&4
     5         kx 		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
     5         kx 	;;
     5         kx *)	db_prefixtype='size_t'
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Include . in @INC
     5         kx $cat <<EOM
     5         kx 
     5         kx Historically Perl has provided a final fallback of the current working
     5         kx directory '.' when searching for a library. This, however, can lead to
     5         kx problems when a Perl program which loads optional modules is called from
     5         kx a shared directory. This can lead to executing unexpected code.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx # When changing to exclude by default:
     5         kx case "$default_inc_excludes_dot" in
     5         kx     $undef|false|[nN]*) dflt="n" ;;
     5         kx     *)                  dflt="y" ;;
     5         kx esac
     5         kx # To turn exclude off by default:
     5         kx #case "$default_inc_excludes_dot" in
     5         kx #    $define|true|[yY]*) dflt="y" ;;
     5         kx #    *)                  dflt="n" ;;
     5         kx #esac
     5         kx 
     5         kx rp='Exclude '.' from @INC by default? '
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
     5         kx     *)          default_inc_excludes_dot="$define" ;;
     5         kx esac
     5         kx 
     5         kx : Check what kind of inf/nan your system has
     5         kx $echo "Checking the kind of infinities and nans you have..." >&4
     5         kx $echo "(The following tests may crash.  That's okay.)" >&4
     5         kx $cat >try.c <<EOP
     5         kx #define DOUBLESIZE $doublesize
     5         kx #$d_longdbl HAS_LONG_DOUBLE
     5         kx #ifdef HAS_LONG_DOUBLE
     5         kx #define LONG_DOUBLESIZE $longdblsize
     5         kx #define LONG_DOUBLEKIND $longdblkind
     5         kx #endif
     5         kx #include <math.h>
     5         kx #include <string.h>
     5         kx #include <stdio.h>
     5         kx /* Note that whether the sign bit is on or off
     5         kx  * for NaN depends on the CPU/FPU, and possibly
     5         kx  * can be affected by the build toolchain.
     5         kx  *
     5         kx  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
     5         kx  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
     5         kx  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
     5         kx  * (respectively) as opposed to the more usual
     5         kx  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
     5         kx  *
     5         kx  * Pre-IEEE-754 floating point format do not even have inf/nan support
     5         kx  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
     5         kx  * to even mention, causing immediate SIGFPE or equivalent: this is
     5         kx  * the case with VAX floating point, for example.
     5         kx  */
     5         kx static void bytes(void *v, unsigned int n) {
     5         kx   unsigned char *p = (unsigned char *)v;
     5         kx   int i;
     5         kx   for (i = 0; i < n; i++) {
     5         kx     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
     5         kx   }
     5         kx }
     5         kx int main(int argc, char *argv[]) {
     5         kx    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
     5         kx     * because some compilers are 'smart' and not only warn but refuse to
     5         kx     * compile such 'illegal' values. */
     5         kx    double dinf = exp(1e9);
     5         kx    double dnan = sqrt(-1.0);
     5         kx #ifdef HAS_LONG_DOUBLE
     5         kx    long double ldinf = (long double)exp(1e9);
     5         kx    long double ldnan = (long double)sqrt(-1.0);
     5         kx # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
     5         kx /* the 80-bit long doubles might have garbage in their excess bytes */
     5         kx     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
     5         kx     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
     5         kx # endif
     5         kx #endif
     5         kx   if (argc == 2) {
     5         kx     switch (argv[1][0]) {
     5         kx     case '1': bytes(&dinf, sizeof(dinf)); break;
     5         kx     case '2': bytes(&dnan, sizeof(dnan)); break;
     5         kx #ifdef HAS_LONG_DOUBLE
     5         kx     case '3': bytes(&ldinf, sizeof(ldinf)); break;
     5         kx     case '4': bytes(&ldnan, sizeof(ldnan)); break;
     5         kx #endif
     5         kx     }
     5         kx   }
     5         kx   return 0;
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     doubleinfbytes=`$run ./try 1`
     5         kx     doublenanbytes=`$run ./try 2`
     5         kx     case "$d_longdbl" in
     5         kx     $define)
     5         kx       longdblinfbytes=`$run ./try 3`
     5         kx       longdblnanbytes=`$run ./try 4`
     5         kx       ;;
     5         kx     esac
     5         kx else
     5         kx     # Defaults in case the above test program failed.
     5         kx     case "$doublekind" in
     5         kx     1) # IEEE 754 32-bit LE
     5         kx        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
     5         kx        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
     5         kx        ;;
     5         kx     2) # IEEE 754 32-bit BE
     5         kx        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
     5         kx        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
     5         kx        ;;
     5         kx     3) # IEEE 754 64-bit LE
     5         kx        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
     5         kx        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
     5         kx        ;;
     5         kx     4) # IEEE 754 64-bit BE
     5         kx        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     5) # IEEE 754 128-bit LE
     5         kx        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
     5         kx        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
     5         kx        ;;
     5         kx     6) # IEEE 754 128-bit BE
     5         kx        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
     5         kx        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
     5         kx        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
     5         kx        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
     5         kx        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
     5         kx        ;;
     5         kx     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
     5         kx        doubleinfbytes=$undef
     5         kx        doublenanbytes=$undef
     5         kx        ;;
     5         kx     *) # No idea.
     5         kx        doubleinfbytes=$undef
     5         kx        doublenanbytes=$undef
     5         kx        ;;
     5         kx     esac
     5         kx     case "$longdblkind" in
     5         kx     1) # IEEE 754 128-bit LE
     5         kx        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
     5         kx        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
     5         kx        ;;
     5         kx     2) # IEEE 754 128-bit BE
     5         kx        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
     5         kx        case "$longdblsize" in
     5         kx        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
     5         kx            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
     5         kx            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
     5         kx            ;;
     5         kx        16) # x86_64
     5         kx            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            ;;
     5         kx        *)  # No idea.
     5         kx            longdblinfbytes=$undef
     5         kx            longdblnanbytes=$undef
     5         kx        ;;
     5         kx        esac
     5         kx        ;;
     5         kx     4) # IEEE 754 80-bit BE, 12 or 16 bytes
     5         kx        case "$longdblsize" in
     5         kx        12) # 32-bit system
     5         kx            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            ;;
     5         kx        16) # 64-bit system
     5         kx            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx            ;;
     5         kx        *)  # No idea.
     5         kx            longdblinfbytes=$undef
     5         kx            longdblnanbytes=$undef
     5         kx        ;;
     5         kx        esac
     5         kx        ;;
     5         kx     5) # 128-bit LE-LE "double double"
     5         kx        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
     5         kx        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
     5         kx        ;;
     5         kx     6) # 128-bit BE-BE "double double"
     5         kx        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     7) # 128-bit LE-BE "double double"
     5         kx        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     8) # 128-bit BE-LE "double double"
     5         kx        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
     5         kx        ;;
     5         kx     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
     5         kx        longdblinfbytes=$undef
     5         kx        longdblnanbytes=$undef
     5         kx        ;;
     5         kx     *) # No idea.
     5         kx        longdblinfbytes=$undef
     5         kx        longdblnanbytes=$undef
     5         kx        ;;
     5         kx     esac
     5         kx fi
     5         kx # In case the program crashed the values are empty, turn them undef.
     5         kx case "$doubleinfbytes" in
     5         kx '') doubleinfbytes=$undef ;;
     5         kx esac
     5         kx case "$doublenanbytes" in
     5         kx '') doublenanbytes=$undef ;;
     5         kx esac
     5         kx case "$longdblinfbytes" in
     5         kx '') longdblinfbytes=$undef ;;
     5         kx esac
     5         kx case "$longdblnanbytes" in
     5         kx '') longdblnanbytes=$undef ;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : Check the length of the double mantissa
     5         kx $echo "Checking how many mantissa bits your doubles have..." >&4
     5         kx $cat >try.c <<EOP
     5         kx #$i_sunmath I_SUNMATH
     5         kx #include <float.h>
     5         kx #ifdef I_SUNMATH
     5         kx # include <sunmath.h>
     5         kx #endif
     5         kx #ifdef DBL_MANT_DIG
     5         kx # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx int main(int argc, char *argv[]) {
     5         kx #ifdef BITS
     5         kx   printf("%d\n", BITS);
     5         kx #endif
     5         kx   return 0;
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     doublemantbits=`$run ./try`
     5         kx else
     5         kx     doublemantbits="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check the length of the longdouble mantissa
     5         kx $echo "Checking how many mantissa bits your long doubles have..." >&4
     5         kx $cat >try.c <<EOP
     5         kx #$i_sunmath I_SUNMATH
     5         kx #include <float.h>
     5         kx #ifdef I_SUNMATH
     5         kx # include <sunmath.h>
     5         kx #endif
     5         kx #$d_longdbl HAS_LONG_DOUBLE
     5         kx #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
     5         kx # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
     5         kx /* This format has no implicit bit.  Beware, however, that for
     5         kx  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
     5         kx  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
     5         kx  * and the top bit must have been one since 387, zero is plain invalid.
     5         kx  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
     5         kx #  define BITS LDBL_MANT_DIG
     5         kx # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
     5         kx /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
     5         kx  * reason e.g. Irix thinks 107.  But in any case, we want only
     5         kx  * the number of real bits, the implicit bits are of no interest.  */
     5         kx #  define BITS 2 * (DBL_MANT_DIG - 1)
     5         kx # else
     5         kx #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
     5         kx # endif
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx int main(int argc, char *argv[]) {
     5         kx #ifdef BITS
     5         kx   printf("%d\n", BITS);
     5         kx #endif
     5         kx   return 0;
     5         kx }
     5         kx EOP
     5         kx set try
     5         kx if eval $compile; then
     5         kx     longdblmantbits=`$run ./try`
     5         kx else
     5         kx     longdblmantbits="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check the length of the NV mantissa
     5         kx $echo "Checking how many mantissa bits your NVs have..." >&4
     5         kx if test "X$usequadmath" = "X$define"; then
     5         kx   nvmantbits=112 # 128-1-15
     5         kx else
     5         kx   if test "X$nvsize" = "X$doublesize"; then
     5         kx     nvmantbits="$doublemantbits"
     5         kx   else
     5         kx      if test "X$nvsize" = "X$longdblsize"; then
     5         kx        nvmantbits="$longdblmantbits"
     5         kx      else
     5         kx        nvmantbits="$undef"
     5         kx      fi
     5         kx   fi
     5         kx fi
     5         kx 
     5         kx : How can we generate normalized random numbers ?
     5         kx echo " "
     5         kx echo "Using our internal random number implementation..." >&4
     5         kx 
     5         kx case "$ccflags" in
     5         kx *-Dmy_rand=*|*-Dmy_srand=*)
     5         kx 	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
     5         kx 	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
     5         kx 	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
     5         kx 	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx randfunc=Perl_drand48
     5         kx drand01="Perl_drand48()"
     5         kx seedfunc="Perl_drand48_init"
     5         kx randbits=48
     5         kx randseedtype=U32
     5         kx 
     5         kx : Probe whether dtrace builds an object, as newer Illumos requires an input
     5         kx : object file that uses at least one of the probes defined in the .d file
     5         kx case "$usedtrace" in
     5         kx $define)
     5         kx     case "$dtracexnolibs" in
     5         kx     $define|true|[yY]*)
     5         kx         dtracexnolibs=$define
     5         kx 	$dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
     5         kx 	;;
     5         kx     ' '|'')
     5         kx         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
     5         kx 	     dtracexnolibs=$define
     5         kx 	     echo "Your dtrace accepts -xnolibs"
     5         kx 	elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
     5         kx 	     dtracexnolibs=$undef
     5         kx 	     echo "Your dtrace doesn't accept -xnolibs"
     5         kx 	else
     5         kx              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
     5         kx 	     exit 1
     5         kx 	fi
     5         kx 	;;
     5         kx     *)
     5         kx         dtracexnolibs=$undef
     5         kx 	$dtrace -h -s ../perldtrace.d -o perldtrace.h
     5         kx 	;;
     5         kx     esac
     5         kx     case $dtracexnolibs in
     5         kx     $define) xnolibs=-xnolibs ;;
     5         kx     *) xnolibs= ;;
     5         kx     esac
     5         kx 
     5         kx     case "$dtraceobject" in
     5         kx     $define|true|[yY]*)
     5         kx         dtraceobject=$define
     5         kx         ;;
     5         kx     ' '|'')
     5         kx         $cat >try.c <<EOM
     5         kx #include "perldtrace.h"
     5         kx int main(void) {
     5         kx     PERL_LOADED_FILE("dummy");
     5         kx     return 0;
     5         kx }
     5         kx EOM
     5         kx         dtraceobject=$undef
     5         kx         if $cc -c -o try.o $optimize $ccflags try.c \
     5         kx                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
     5         kx                 dtraceobject=$define
     5         kx             echo "Your dtrace builds an object file"
     5         kx         fi
     5         kx         ;;
     5         kx     *) dtraceobject=$undef ;;
     5         kx     esac
     5         kx     $rm_try perldtrace.o perldtrace.h
     5         kx esac
     5         kx 
     5         kx : Determine if this is an EBCDIC system
     5         kx echo " "
     5         kx echo "Determining whether or not we are on an EBCDIC system..." >&4
     5         kx $cat >try.c <<'EOM'
     5         kx int main()
     5         kx {
     5         kx   if ('M'==0xd4) return 0;
     5         kx   return 1;
     5         kx }
     5         kx EOM
     5         kx 
     5         kx val=$undef
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	if $run ./try; then
     5         kx 		echo "You seem to speak EBCDIC." >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
     5         kx 	fi
     5         kx else
     5         kx 	echo "I'm unable to compile the test program." >&4
     5         kx 	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
     5         kx fi
     5         kx $rm_try
     5         kx set ebcdic
     5         kx eval $setvar
     5         kx 
     5         kx : Check how to flush
     5         kx echo " "
     5         kx $cat >&4 <<EOM
     5         kx Checking how to flush all pending stdio output...
     5         kx EOM
     5         kx # I only know how to find the first 32 possibly open files on SunOS.
     5         kx # See also hints/sunos_4_1.sh and util.c  --AD
     5         kx case "$osname" in
     5         kx sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
     5         kx esac
     5         kx $cat >>try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #$i_unistd I_UNISTD
     5         kx #ifdef I_UNISTD
     5         kx # include <unistd.h>
     5         kx #endif
     5         kx #$d_sysconf HAS_SYSCONF
     5         kx #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
     5         kx #ifdef HAS_STDIO_STREAM_ARRAY
     5         kx # define STDIO_STREAM_ARRAY $stdio_stream_array
     5         kx #endif
     5         kx int main() {
     5         kx   FILE* p;
     5         kx   unlink("try.out");
     5         kx   p = fopen("try.out", "w");
     5         kx #ifdef TRY_FPUTC
     5         kx   fputc('x', p);
     5         kx #else
     5         kx # ifdef TRY_FPRINTF
     5         kx   fprintf(p, "x");
     5         kx # endif
     5         kx #endif
     5         kx #ifdef TRY_FFLUSH_NULL
     5         kx   fflush(NULL);
     5         kx #endif
     5         kx #ifdef TRY_FFLUSH_ALL
     5         kx   {
     5         kx     long open_max = -1;
     5         kx # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
     5         kx     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
     5         kx # else
     5         kx #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
     5         kx     open_max = sysconf(_SC_OPEN_MAX);
     5         kx #  else
     5         kx #   ifdef FOPEN_MAX
     5         kx     open_max = FOPEN_MAX;
     5         kx #   else
     5         kx #    ifdef OPEN_MAX
     5         kx     open_max = OPEN_MAX;
     5         kx #    else
     5         kx #     ifdef _NFILE
     5         kx     open_max = _NFILE;
     5         kx #     endif
     5         kx #    endif
     5         kx #   endif
     5         kx #  endif
     5         kx # endif
     5         kx # ifdef HAS_STDIO_STREAM_ARRAY
     5         kx     if (open_max > 0) {
     5         kx       long i;
     5         kx       for (i = 0; i < open_max; i++)
     5         kx 	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
     5         kx 		STDIO_STREAM_ARRAY[i]._file < open_max &&
     5         kx 		STDIO_STREAM_ARRAY[i]._flag)
     5         kx 		fflush(&STDIO_STREAM_ARRAY[i]);
     5         kx     }
     5         kx   }
     5         kx # endif
     5         kx #endif
     5         kx   _exit(42);
     5         kx }
     5         kx EOCP
     5         kx : first we have to find out how _not_ to flush
     5         kx $to try.c
     5         kx if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
     5         kx     output=''
     5         kx     set try -DTRY_FPUTC
     5         kx     if eval $compile; then
     5         kx 	    $run ./try 2>/dev/null
     5         kx 	    code="$?"
     5         kx 	    $from try.out
     5         kx 	    if $test ! -s try.out -a "X$code" = X42; then
     5         kx 		output=-DTRY_FPUTC
     5         kx 	    fi
     5         kx     fi
     5         kx     case "$output" in
     5         kx     '')
     5         kx 	    set try -DTRY_FPRINTF
     5         kx 	    if eval $compile; then
     5         kx 		    $run ./try 2>/dev/null
     5         kx 		    code="$?"
     5         kx 		    $from try.out
     5         kx 		    if $test ! -s try.out -a "X$code" = X42; then
     5         kx 			output=-DTRY_FPRINTF
     5         kx 		    fi
     5         kx 	    fi
     5         kx 	;;
     5         kx     esac
     5         kx fi
     5         kx : check for fflush NULL behavior
     5         kx case "$fflushNULL" in
     5         kx '')	set try -DTRY_FFLUSH_NULL $output
     5         kx 	if eval $compile; then
     5         kx 		$run ./try 2>/dev/null
     5         kx 		code="$?"
     5         kx 		$from try.out
     5         kx 		if $test -s try.out -a "X$code" = X42; then
     5         kx 			fflushNULL="`$cat try.out`"
     5         kx 		else
     5         kx 			if $test "X$code" != X42; then
     5         kx 				$cat >&4 <<EOM
     5         kx (If this test failed, don't worry, we'll try another method shortly.)
     5         kx EOM
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	$rm -f core try.core core.try.*
     5         kx 	case "$fflushNULL" in
     5         kx 	x)	$cat >&4 <<EOM
     5         kx Your fflush(NULL) works okay for output streams.
     5         kx Let's see if it clobbers input pipes...
     5         kx EOM
     5         kx # As of mid-March 2000 all versions of Solaris appear to have a stdio
     5         kx # bug that improperly flushes the input end of pipes.  So we avoid the
     5         kx # autoflush on fork/system/exec support for now. :-(
     5         kx $cat >tryp.c <<EOCP
     5         kx #include <stdio.h>
     5         kx int
     5         kx main(int argc, char **argv)
     5         kx {
     5         kx     char buf[1024];
     5         kx     int i;
     5         kx     char *bp = buf;
     5         kx     while (1) {
     5         kx 	while ((i = getc(stdin)) != -1
     5         kx 	       && (*bp++ = i) != '\n'
     5         kx 	       && bp < &buf[1024])
     5         kx 	/* DO NOTHING */ ;
     5         kx 	*bp = '\0';
     5         kx 	fprintf(stdout, "%s", buf);
     5         kx 	fflush(NULL);
     5         kx 	if (i == -1)
     5         kx 	    return 0;
     5         kx 	bp = buf;
     5         kx     }
     5         kx }
     5         kx EOCP
     5         kx 		fflushNULL="$define"
     5         kx 		set tryp
     5         kx 		if eval $compile; then
     5         kx 		    $rm -f tryp.out
     5         kx 		    # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
     5         kx 		    if $test "X$targethost" != X; then
     5         kx 			$to tryp.c
     5         kx 			$to tryp
     5         kx 			$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
     5         kx 		    else
     5         kx 			$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
     5         kx 		    fi
     5         kx 		    if cmp tryp.c tryp.out >/dev/null 2>&1; then
     5         kx 		       $cat >&4 <<EOM
     5         kx fflush(NULL) seems to behave okay with input streams.
     5         kx EOM
     5         kx 			fflushNULL="$define"
     5         kx 		    else
     5         kx 			$cat >&4 <<EOM
     5         kx Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
     5         kx EOM
     5         kx 			fflushNULL="$undef"
     5         kx 		    fi
     5         kx 		fi
     5         kx 		$rm -f core tryp.c tryp.core core.tryp.*
     5         kx 		;;
     5         kx 	'')	$cat >&4 <<EOM
     5         kx Your fflush(NULL) isn't working (contrary to ANSI C).
     5         kx EOM
     5         kx 		fflushNULL="$undef"
     5         kx 		;;
     5         kx 	*)	$cat >&4 <<EOM
     5         kx Cannot figure out whether your fflush(NULL) works or not.
     5         kx I'm assuming it doesn't (contrary to ANSI C).
     5         kx EOM
     5         kx 		fflushNULL="$undef"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx $define|true|[yY]*)
     5         kx 	fflushNULL="$define"
     5         kx 	;;
     5         kx *)
     5         kx 	fflushNULL="$undef"
     5         kx 	;;
     5         kx esac
     5         kx : check explicit looping only if NULL did not work, and if the pipe
     5         kx : bug does not show up on an explicit flush too
     5         kx case "$fflushNULL" in
     5         kx "$undef")
     5         kx 	$cat >tryp.c <<EOCP
     5         kx #include <stdio.h>
     5         kx int
     5         kx main(int argc, char **argv)
     5         kx {
     5         kx     char buf[1024];
     5         kx     int i;
     5         kx     char *bp = buf;
     5         kx     while (1) {
     5         kx 	while ((i = getc(stdin)) != -1
     5         kx 	       && (*bp++ = i) != '\n'
     5         kx 	       && bp < &buf[1024])
     5         kx 	/* DO NOTHING */ ;
     5         kx 	*bp = '\0';
     5         kx 	fprintf(stdout, "%s", buf);
     5         kx 	fflush(stdin);
     5         kx 	if (i == -1)
     5         kx 	    return 0;
     5         kx 	bp = buf;
     5         kx     }
     5         kx }
     5         kx EOCP
     5         kx 	set tryp
     5         kx 	if eval $compile; then
     5         kx 	    $rm -f tryp.out
     5         kx 	    if $test "X$targethost" != X; then
     5         kx 		$to tryp.c
     5         kx 		$to tryp
     5         kx 		$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
     5         kx 	    else
     5         kx 		$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
     5         kx 	    fi
     5         kx 	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
     5         kx 	       $cat >&4 <<EOM
     5         kx Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
     5         kx EOM
     5         kx 		: now check for fflushall behaviour
     5         kx 		case "$fflushall" in
     5         kx 		'')	set try -DTRY_FFLUSH_ALL $output
     5         kx 			if eval $compile; then
     5         kx 				$cat >&4 <<EOM
     5         kx (Now testing the other method--but note that this also may fail.)
     5         kx EOM
     5         kx 				$run ./try 2>/dev/null
     5         kx 				code=$?
     5         kx 				$from try.out
     5         kx 				if $test -s try.out -a "X$code" = X42; then
     5         kx 					fflushall="`$cat try.out`"
     5         kx 				fi
     5         kx 			fi
     5         kx 			$rm_try
     5         kx 			case "$fflushall" in
     5         kx 			x)	$cat >&4 <<EOM
     5         kx Whew. Flushing explicitly all the stdio streams works.
     5         kx EOM
     5         kx 				fflushall="$define"
     5         kx 				;;
     5         kx 			'')	$cat >&4 <<EOM
     5         kx Sigh. Flushing explicitly all the stdio streams doesn't work.
     5         kx EOM
     5         kx 				fflushall="$undef"
     5         kx 				;;
     5         kx 			*)	$cat >&4 <<EOM
     5         kx Cannot figure out whether flushing stdio streams explicitly works or not.
     5         kx I'm assuming it doesn't.
     5         kx EOM
     5         kx 				fflushall="$undef"
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		"$define"|true|[yY]*)
     5         kx 			fflushall="$define"
     5         kx 			;;
     5         kx 		*)
     5         kx 			fflushall="$undef"
     5         kx 			;;
     5         kx 		esac
     5         kx 	    else
     5         kx 		$cat >&4 <<EOM
     5         kx All is futile.  Even fflush(stdin) clobbers input pipes!
     5         kx EOM
     5         kx 		fflushall="$undef"
     5         kx 	    fi
     5         kx 	else
     5         kx 	    fflushall="$undef"
     5         kx 	fi
     5         kx 	$rm -f core tryp.c tryp.core core.tryp.*
     5         kx 	;;
     5         kx *)	fflushall="$undef"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx case "$fflushNULL$fflushall" in
     5         kx undefundef)
     5         kx 	$cat <<EOM
     5         kx OK, I give up.  I cannot figure out how to flush pending stdio output.
     5         kx We won't be flushing handles at all before fork/exec/popen.
     5         kx EOM
     5         kx 	;;
     5         kx esac
     5         kx $rm_try tryp
     5         kx 
     5         kx : Store the full pathname to the ar program for use in the C program
     5         kx : Respect a hint or command line value for full_ar.
     5         kx case "$full_ar" in
     5         kx '') full_ar=$ar ;;
     5         kx esac
     5         kx 
     5         kx : Store the full pathname to the sed program for use in the C program
     5         kx full_sed=$sed
     5         kx 
     5         kx : see what type gids are declared as in the kernel
     5         kx echo " "
     5         kx echo "Looking for the type for group ids returned by getgid()."
     5         kx set gid_t gidtype xxx stdio.h sys/types.h
     5         kx eval $typedef
     5         kx case "$gidtype" in
     5         kx xxx)
     5         kx 	xxx=`./findhdr sys/user.h`
     5         kx 	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
     5         kx 	case $1 in
     5         kx 	unsigned) dflt="$1 $2" ;;
     5         kx 	*) dflt="$1" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *) dflt="$gidtype";;
     5         kx esac
     5         kx case "$gidtype" in
     5         kx gid_t) echo "gid_t found." ;;
     5         kx *)	rp="What is the type for group ids returned by getgid()?"
     5         kx 	. ./myread
     5         kx 	gidtype="$ans"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check the size of GID
     5         kx echo " "
     5         kx case "$gidtype" in
     5         kx *_t) zzz="$gidtype"	;;
     5         kx *)   zzz="gid"		;;
     5         kx esac
     5         kx echo "Checking the size of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     printf("%d\n", (int)sizeof($gidtype));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	gidsize=4
     5         kx 		echo "(I can't execute the test program--guessing $gidsize.)" >&4
     5         kx 		;;
     5         kx 	*)	gidsize=$yyy
     5         kx 		echo "Your $zzz is $gidsize bytes long."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	gidsize=4
     5         kx 	echo "(I can't compile the test program--guessing $gidsize.)" >&4
     5         kx fi
     5         kx 
     5         kx : Check if GID is signed
     5         kx echo " "
     5         kx case "$gidtype" in
     5         kx *_t) zzz="$gidtype"	;;
     5         kx *)   zzz="gid"		;;
     5         kx esac
     5         kx echo "Checking the sign of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx 	$gidtype foo = -1;
     5         kx 	if (foo < 0)
     5         kx 		printf("-1\n");
     5         kx 	else
     5         kx 		printf("1\n");
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	gidsign=1
     5         kx 		echo "(I can't execute the test program--guessing unsigned.)" >&4
     5         kx 		;;
     5         kx 	*)	gidsign=$yyy
     5         kx 		case "$gidsign" in
     5         kx 		 1) echo "Your $zzz is unsigned." ;;
     5         kx 		-1) echo "Your $zzz is signed."   ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	gidsign=1
     5         kx 	echo "(I can't compile the test program--guessing unsigned.)" >&4
     5         kx fi
     5         kx 
     5         kx : Check 64bit sizes
     5         kx echo " "
     5         kx 
     5         kx if $test X"$quadtype" != X; then
     5         kx 
     5         kx echo "Checking how to print 64-bit integers..." >&4
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   int q = 12345678901;
     5         kx   printf("%ld\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
     5         kx 			sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
     5         kx 			echo "We will use %d."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   long q = 12345678901;
     5         kx   printf("%ld\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
     5         kx 			sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
     5         kx 			echo "We will use %ld."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <inttypes.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   int64_t q = 12345678901;
     5         kx   printf("%" PRId64 "\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
     5         kx 			sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
     5         kx 			echo "We will use the C9X style."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$quadtype" != X; then
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   $quadtype q = 12345678901;
     5         kx   printf("%Ld\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
     5         kx 			sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
     5         kx 			echo "We will use %Ld."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
     5         kx 	$cat >try.c <<'EOCP'
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
     5         kx   printf("%lld\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
     5         kx 			sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
     5         kx 			echo "We will use the %lld style."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X -a X"$quadtype" != X; then
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx   $quadtype q = 12345678901;
     5         kx   printf("%qd\n", q);
     5         kx }
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 		yyy=`$run ./try`
     5         kx 		case "$yyy" in
     5         kx 		12345678901)
     5         kx 			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
     5         kx 			sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
     5         kx 			echo "We will use %qd."
     5         kx 			;;
     5         kx 		esac
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$sPRId64" = X; then
     5         kx 	echo "Cannot figure out how to print 64-bit integers." >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx fi
     5         kx 
     5         kx case "$sPRId64" in
     5         kx '')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
     5         kx 	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
     5         kx 	;;
     5         kx *)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
     5         kx 	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Check format strings for internal types
     5         kx echo " "
     5         kx $echo "Checking the format strings to be used for Perl's internal types..." >&4
     5         kx 
     5         kx if $test X"$ivsize" = X8; then
     5         kx 	ivdformat="$sPRId64"
     5         kx 	uvuformat="$sPRIu64"
     5         kx 	uvoformat="$sPRIo64"
     5         kx 	uvxformat="$sPRIx64"
     5         kx 	uvXUformat="$sPRIXU64"
     5         kx else
     5         kx 	if $test X"$ivsize" = X"$longsize"; then
     5         kx 		ivdformat='"ld"'
     5         kx 		uvuformat='"lu"'
     5         kx 		uvoformat='"lo"'
     5         kx 		uvxformat='"lx"'
     5         kx 		uvXUformat='"lX"'
     5         kx 	else
     5         kx 		if $test X"$ivsize" = X"$intsize"; then
     5         kx 			ivdformat='"d"'
     5         kx 			uvuformat='"u"'
     5         kx 			uvoformat='"o"'
     5         kx 			uvxformat='"x"'
     5         kx 			uvXUformat='"X"'
     5         kx 		else
     5         kx 			: far out
     5         kx 			if $test X"$ivsize" = X"$shortsize"; then
     5         kx 				ivdformat='"hd"'
     5         kx 				uvuformat='"hu"'
     5         kx 				uvoformat='"ho"'
     5         kx 				uvxformat='"hx"'
     5         kx 				uvXUformat='"hX"'
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx if $test X"$usequadmath" = X"$define"; then
     5         kx     nveformat='"Qe"'
     5         kx     nvfformat='"Qf"'
     5         kx     nvgformat='"Qg"'
     5         kx     nvEUformat='"QE"'
     5         kx     nvFUformat='"QF"'
     5         kx     nvGUformat='"QG"'
     5         kx else
     5         kx     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
     5         kx 	nveformat="$sPRIeldbl"
     5         kx 	nvfformat="$sPRIfldbl"
     5         kx 	nvgformat="$sPRIgldbl"
     5         kx 	nvEUformat="$sPRIEUldbl"
     5         kx 	nvFUformat="$sPRIFUldbl"
     5         kx 	nvGUformat="$sPRIGUldbl"
     5         kx     else
     5         kx 	nveformat='"e"'
     5         kx 	nvfformat='"f"'
     5         kx 	nvgformat='"g"'
     5         kx 	nvEUformat='"E"'
     5         kx 	nvFUformat='"F"'
     5         kx 	nvGUformat='"G"'
     5         kx     fi
     5         kx fi
     5         kx 
     5         kx case "$ivdformat" in
     5         kx '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
     5         kx     exit 1
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Check format string for GID
     5         kx 
     5         kx echo " "
     5         kx $echo "Checking the format string to be used for gids..." >&4
     5         kx 
     5         kx case "$gidsign" in
     5         kx -1)	if $test X"$gidsize" = X"$ivsize"; then
     5         kx 		gidformat="$ivdformat"
     5         kx 	else
     5         kx 		if $test X"$gidsize" = X"$longsize"; then
     5         kx 			gidformat='"ld"'
     5         kx 		else
     5         kx 			if $test X"$gidsize" = X"$intsize"; then
     5         kx 				gidformat='"d"'
     5         kx 			else
     5         kx 				if $test X"$gidsize" = X"$shortsize"; then
     5         kx 					gidformat='"hd"'
     5         kx 				fi
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx *)	if $test X"$gidsize" = X"$uvsize"; then
     5         kx 		gidformat="$uvuformat"
     5         kx 	else
     5         kx 		if $test X"$gidsize" = X"$longsize"; then
     5         kx 			gidformat='"lu"'
     5         kx 		else
     5         kx 			if $test X"$gidsize" = X"$intsize"; then
     5         kx 				gidformat='"u"'
     5         kx 			else
     5         kx 				if $test X"$gidsize" = X"$shortsize"; then
     5         kx 					gidformat='"hu"'
     5         kx 				fi
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if getgroups exists
     5         kx set getgroups d_getgrps
     5         kx eval $inlibc
     5         kx 
     5         kx : see if setgroups exists
     5         kx set setgroups d_setgrps
     5         kx eval $inlibc
     5         kx 
     5         kx : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
     5         kx echo " "
     5         kx case "$d_getgrps$d_setgrps" in
     5         kx *define*)
     5         kx 	case "$groupstype" in
     5         kx 	'') dflt="$gidtype" ;;
     5         kx 	*)  dflt="$groupstype" ;;
     5         kx 	esac
     5         kx 	$cat <<EOM
     5         kx What type of pointer is the second argument to getgroups() and setgroups()?
     5         kx Usually this is the same as group ids, $gidtype, but not always.
     5         kx 
     5         kx EOM
     5         kx 	rp='What type pointer is the second argument to getgroups() and setgroups()?'
     5         kx 	. ./myread
     5         kx 	groupstype="$ans"
     5         kx 	;;
     5         kx *)  groupstype="$gidtype";;
     5         kx esac
     5         kx 
     5         kx : check whether make sets MAKE
     5         kx echo " "
     5         kx echo "Checking if your $make program sets \$(MAKE)..." >&4
     5         kx case "$make_set_make" in
     5         kx '')
     5         kx 	$sed 's/^X //' > testmake.mak << 'EOF'
     5         kx Xall:
     5         kx X 	@echo 'maketemp="$(MAKE)"'
     5         kx EOF
     5         kx 	case "`$make -f testmake.mak 2>/dev/null`" in
     5         kx 	*maketemp=*) make_set_make='#' ;;
     5         kx 	*)	make_set_make="MAKE=$make" ;;
     5         kx 	esac
     5         kx 	$rm -f testmake.mak
     5         kx 	;;
     5         kx esac
     5         kx case "$make_set_make" in
     5         kx '#') echo "Yup, it does.";;
     5         kx *) echo "Nope, it doesn't.";;
     5         kx esac
     5         kx 
     5         kx : see what type is used for mode_t
     5         kx rp="What is the type used for file modes for system calls (e.g. fchmod())?"
     5         kx set mode_t modetype int stdio.h sys/types.h
     5         kx eval $typedef_ask
     5         kx 
     5         kx : see if we need va_copy
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdarg.h>
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx #include <signal.h>
     5         kx 
     5         kx int
     5         kx ivfprintf(FILE *f, const char *fmt, va_list *valp)
     5         kx {
     5         kx   return vfprintf(f, fmt, *valp);
     5         kx }
     5         kx 
     5         kx int
     5         kx myvfprintf(FILE *f, const  char *fmt, va_list val)
     5         kx {
     5         kx   return ivfprintf(f, fmt, &val);
     5         kx }
     5         kx 
     5         kx int
     5         kx myprintf(char *fmt, ...)
     5         kx {
     5         kx   va_list val;
     5         kx   va_start(val, fmt);
     5         kx   return myvfprintf(stdout, fmt, val);
     5         kx }
     5         kx 
     5         kx int
     5         kx main(int ac, char **av)
     5         kx {
     5         kx   signal(SIGSEGV, exit);
     5         kx #ifdef SIGBUS
     5         kx   signal(SIGBUS,  exit);
     5         kx #endif
     5         kx 
     5         kx   myprintf("%s%cs all right, then\n", "that", '\'');
     5         kx   exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile && $run ./try 2>&1 >/dev/null; then
     5         kx 	case "`$run ./try`" in
     5         kx 	"that's all right, then")
     5         kx 		okay=yes
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx case "$okay" in
     5         kx yes)	echo "It seems that you don't need va_copy()." >&4
     5         kx 	need_va_copy="$undef"
     5         kx 	;;
     5         kx *)	echo "It seems that va_copy() or similar will be needed." >&4
     5         kx 	need_va_copy="$define"
     5         kx 	;;
     5         kx esac
     5         kx $rm_try
     5         kx 
     5         kx : see what type is used for size_t
     5         kx rp="What is the type used for the length parameter for string functions?"
     5         kx set size_t sizetype 'unsigned int' stdio.h sys/types.h
     5         kx eval $typedef_ask
     5         kx 
     5         kx : check for type of arguments to gethostbyaddr.
     5         kx if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
     5         kx 	case "$d_gethbyaddr" in
     5         kx 	$define)
     5         kx 		$cat <<EOM
     5         kx 
     5         kx Checking to see what type of arguments are accepted by gethostbyaddr().
     5         kx EOM
     5         kx 		hdrs="$define sys/types.h
     5         kx 			$d_socket sys/socket.h
     5         kx 			$i_niin netinet/in.h
     5         kx 			$i_netdb netdb.h
     5         kx 			$i_unistd unistd.h"
     5         kx 		: The first arg can 'char *' or 'void *'
     5         kx 		: The second arg is some of integral type
     5         kx 		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
     5         kx 			for yyy in size_t long int; do
     5         kx 				case "$netdb_host_type" in
     5         kx 				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
     5         kx 					if ./protochk "$try" $hdrs; then
     5         kx 						echo "Your system accepts $xxx for the first arg."
     5         kx 						echo "...and $yyy for the second arg."
     5         kx 						netdb_host_type="$xxx"
     5         kx 						netdb_hlen_type="$yyy"
     5         kx 					fi
     5         kx 					;;
     5         kx 				esac
     5         kx 			done
     5         kx 		done
     5         kx 		: In case none of those worked, prompt the user.
     5         kx 		case "$netdb_host_type" in
     5         kx 		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
     5         kx 			dflt='char *'
     5         kx 			. ./myread
     5         kx 			netdb_host_type=$ans
     5         kx 			rp='What is the type for the 2nd argument to gethostbyaddr?'
     5         kx 			dflt="$sizetype"
     5         kx 			. ./myread
     5         kx 			netdb_hlen_type=$ans
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	: no gethostbyaddr, so pick harmless defaults
     5         kx 		netdb_host_type='char *'
     5         kx 		netdb_hlen_type="$sizetype"
     5         kx 		;;
     5         kx 	esac
     5         kx 	# Remove the "const" if needed. -- but then we'll have a
     5         kx 	# prototype clash!
     5         kx 	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
     5         kx fi
     5         kx 
     5         kx : check for type of argument to gethostbyname.
     5         kx if test "X$netdb_name_type" = X ; then
     5         kx 	case "$d_gethbyname" in
     5         kx 	$define)
     5         kx 		$cat <<EOM
     5         kx 
     5         kx Checking to see what type of argument is accepted by gethostbyname().
     5         kx EOM
     5         kx 		hdrs="$define sys/types.h
     5         kx 			$d_socket sys/socket.h
     5         kx 			$i_niin netinet/in.h
     5         kx 			$i_netdb netdb.h
     5         kx 			$i_unistd unistd.h"
     5         kx 		for xxx in "const char *" "char *"; do
     5         kx 			case "$netdb_name_type" in
     5         kx 			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
     5         kx 				if ./protochk "$try" $hdrs; then
     5         kx 					echo "Your system accepts $xxx."
     5         kx 					netdb_name_type="$xxx"
     5         kx 				fi
     5         kx 				;;
     5         kx 			esac
     5         kx 		done
     5         kx 		: In case none of those worked, prompt the user.
     5         kx 		case "$netdb_name_type" in
     5         kx 		'')	rp='What is the type for the 1st argument to gethostbyname?'
     5         kx 			dflt='char *'
     5         kx 			. ./myread
     5         kx 			netdb_name_type=$ans
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	: no gethostbyname, so pick harmless default
     5         kx 		netdb_name_type='char *'
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : check for type of 1st argument to getnetbyaddr.
     5         kx if test "X$netdb_net_type" = X ; then
     5         kx 	case "$d_getnbyaddr" in
     5         kx 	$define)
     5         kx 		$cat <<EOM
     5         kx 
     5         kx Checking to see what type of 1st argument is accepted by getnetbyaddr().
     5         kx EOM
     5         kx 		hdrs="$define sys/types.h
     5         kx 			$d_socket sys/socket.h
     5         kx 			$i_niin netinet/in.h
     5         kx 			$i_netdb netdb.h
     5         kx 			$i_unistd unistd.h"
     5         kx 		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
     5         kx 			case "$netdb_net_type" in
     5         kx 			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
     5         kx 				if ./protochk "$try" $hdrs; then
     5         kx 					echo "Your system accepts $xxx."
     5         kx 					netdb_net_type="$xxx"
     5         kx 				fi
     5         kx 				;;
     5         kx 			esac
     5         kx 		done
     5         kx 		: In case none of those worked, prompt the user.
     5         kx 		case "$netdb_net_type" in
     5         kx 		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
     5         kx 			dflt='long'
     5         kx 			. ./myread
     5         kx 			netdb_net_type=$ans
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	: no getnetbyaddr, so pick harmless default
     5         kx 		netdb_net_type='long'
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx : locate the preferred pager for this system
     5         kx fn=f/
     5         kx case "$pager" in
     5         kx '')
     5         kx 	dflt=''
     5         kx 	case "$pg" in
     5         kx 	/*) dflt=$pg;;
     5         kx 	[a-zA-Z]:/*) dflt=$pg;;
     5         kx 	esac
     5         kx 	case "$more" in
     5         kx 	/*) dflt=$more;;
     5         kx 	[a-zA-Z]:/*) dflt=$more;;
     5         kx 	esac
     5         kx 	case "$less" in
     5         kx 	/*) dflt=$less;;
     5         kx 	[a-zA-Z]:/*) dflt=$less;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	'') dflt=/usr/ucb/more;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	dflt="$pager"
     5         kx 	;;
     5         kx esac
     5         kx fn="f/($dflt)"
     5         kx echo " "
     5         kx rp='What pager is used on your system?'
     5         kx . ./getfile
     5         kx pager="$ans"
     5         kx 
     5         kx : see if ar generates random libraries by itself
     5         kx echo " "
     5         kx echo "Checking how to generate random libraries on your machine..." >&4
     5         kx echo 'int bar1() { return bar2(); }' > bar1.c
     5         kx echo 'int bar2() { return 2; }' > bar2.c
     5         kx $cat > foo.c <<EOP
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() { printf("%d\n", bar1()); exit(0); }
     5         kx EOP
     5         kx $cc $ccflags -c bar1.c >/dev/null 2>&1
     5         kx $cc $ccflags -c bar2.c >/dev/null 2>&1
     5         kx $cc $ccflags -c foo.c >/dev/null 2>&1
     5         kx $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
     5         kx if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
     5         kx 	$run ./foobar >/dev/null 2>&1; then
     5         kx 	echo "$ar appears to generate random libraries itself."
     5         kx 	orderlib=false
     5         kx 	if [ "X$ranlib" = "X" ]; then
     5         kx 	    ranlib=":"
     5         kx 	fi
     5         kx elif $ar s bar$_a >/dev/null 2>&1 &&
     5         kx 	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
     5         kx 	$run ./foobar >/dev/null 2>&1; then
     5         kx 		echo "a table of contents needs to be added with '$ar s'."
     5         kx 		orderlib=false
     5         kx 		ranlib="$ar s"
     5         kx elif $ar ts bar$_a >/dev/null 2>&1 &&
     5         kx 	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
     5         kx 	$run ./foobar >/dev/null 2>&1; then
     5         kx 		echo "a table of contents needs to be added with '$ar ts'."
     5         kx 		orderlib=false
     5         kx 		ranlib="$ar ts"
     5         kx else
     5         kx 	case "$ranlib" in
     5         kx 	:) ranlib='';;
     5         kx 	'')
     5         kx 		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
     5         kx 		$test -f $ranlib || ranlib=''
     5         kx 		;;
     5         kx 	esac
     5         kx 	if $test -n "$ranlib"; then
     5         kx 		echo "your system has '$ranlib'; we'll use that."
     5         kx 		orderlib=false
     5         kx 	else
     5         kx 		echo "your system doesn't seem to support random libraries"
     5         kx 		echo "so we'll use lorder and tsort to order the libraries."
     5         kx 		orderlib=true
     5         kx 		ranlib=":"
     5         kx 	fi
     5         kx fi
     5         kx $rm -f foo* bar*
     5         kx 
     5         kx : Check the max offset that gmtime and localtime accept
     5         kx echo "Checking max offsets that gmtime () accepts"
     5         kx 
     5         kx case "$sGMTIME_min/$sGMTIME_max" in
     5         kx     0/0|/)
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #include <time.h>
     5         kx 
     5         kx int i;
     5         kx struct tm *tmp;
     5         kx time_t pt;
     5         kx 
     5         kx void gm_check (time_t t, int min_year, int max_year)
     5         kx {
     5         kx     tmp = gmtime (&t);
     5         kx     if ( tmp == NULL ||
     5         kx 	/* Check tm_year overflow */
     5         kx 	 tmp->tm_year < min_year || tmp->tm_year > max_year)
     5         kx 	tmp = NULL;
     5         kx     else
     5         kx 	pt = t;
     5         kx     } /* gm_check */
     5         kx 
     5         kx int check_max ()
     5         kx {
     5         kx     tmp = NULL;
     5         kx     pt  = 0;
     5         kx #ifdef MAXLONG
     5         kx     gm_check (MAXLONG, 69, 0x7fffffff);
     5         kx #endif
     5         kx     if (tmp == NULL || tmp->tm_year < 0) {
     5         kx 	for (i = 63; i >= 0; i--) {
     5         kx 	    time_t x = pt | ((time_t)1 << i);
     5         kx 	    if (x < 0 || x < pt) continue;
     5         kx 	    gm_check (x, 69, 0x7fffffff);
     5         kx 	    }
     5         kx 	}
     5         kx     printf ("sGMTIME_max=%ld\n", pt);
     5         kx     return (0);
     5         kx     } /* check_max */
     5         kx 
     5         kx int check_min ()
     5         kx {
     5         kx     tmp = NULL;
     5         kx     pt  = 0;
     5         kx #ifdef MINLONG
     5         kx     gm_check (MINLONG, -1900, 70);
     5         kx #endif
     5         kx     if (tmp == NULL) {
     5         kx 	for (i = 36; i >= 0; i--) {
     5         kx 	    time_t x = pt - ((time_t)1 << i);
     5         kx 	    if (x > 0) continue;
     5         kx 	    gm_check (x, -1900, 70);
     5         kx 	    }
     5         kx 	}
     5         kx     printf ("sGMTIME_min=%ld\n", pt);
     5         kx     return (0);
     5         kx     } /* check_min */
     5         kx 
     5         kx int main (int argc, char *argv[])
     5         kx {
     5         kx     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
     5         kx     check_max ();
     5         kx     check_min ();
     5         kx     return (0);
     5         kx     } /* main */
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 	    eval `$run ./try 2>/dev/null`
     5         kx 	else
     5         kx 	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
     5         kx 	    fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx     esac
     5         kx 
     5         kx echo "Checking max offsets that localtime () accepts"
     5         kx 
     5         kx case "$sLOCALTIME_min/$sLOCALTIME_max" in
     5         kx     0/0|/)
     5         kx 	$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #include <time.h>
     5         kx 
     5         kx int i;
     5         kx struct tm *tmp;
     5         kx time_t pt;
     5         kx 
     5         kx void local_check (time_t t, int min_year, int max_year)
     5         kx {
     5         kx     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
     5         kx 	tmp = NULL;
     5         kx     else
     5         kx 	tmp = localtime (&t);
     5         kx     if ( tmp == NULL ||
     5         kx 	/* Check tm_year overflow */
     5         kx 	 tmp->tm_year < min_year || tmp->tm_year > max_year)
     5         kx 	tmp = NULL;
     5         kx     else
     5         kx 	pt = t;
     5         kx     } /* local_check */
     5         kx 
     5         kx int check_max ()
     5         kx {
     5         kx     tmp = NULL;
     5         kx     pt  = 0;
     5         kx #ifdef MAXLONG
     5         kx     local_check (MAXLONG, 69, 0x7fffffff);
     5         kx #endif
     5         kx     if (tmp == NULL || tmp->tm_year < 0) {
     5         kx 	for (i = 63; i >= 0; i--) {
     5         kx 	    time_t x = pt | ((time_t)1 << i);
     5         kx 	    if (x < 0 || x < pt) continue;
     5         kx 	    local_check (x, 69, 0x7fffffff);
     5         kx 	    }
     5         kx 	}
     5         kx     printf ("sLOCALTIME_max=%ld\n", pt);
     5         kx     return (0);
     5         kx    } /* check_max */
     5         kx 
     5         kx int check_min ()
     5         kx {
     5         kx     tmp = NULL;
     5         kx     pt  = 0;
     5         kx #ifdef MINLONG
     5         kx     local_check (MINLONG, -1900, 70);
     5         kx #endif
     5         kx     if (tmp == NULL) {
     5         kx 	for (i = 36; i >= 0; i--) {
     5         kx 	    time_t x = pt - ((time_t)1 << i);
     5         kx 	    if (x > 0) continue;
     5         kx 	    local_check (x, -1900, 70);
     5         kx 	    }
     5         kx 	}
     5         kx     printf ("sLOCALTIME_min=%ld\n", pt);
     5         kx     return (0);
     5         kx     } /* check_min */
     5         kx 
     5         kx int main (int argc, char *argv[])
     5         kx {
     5         kx     check_max ();
     5         kx     check_min ();
     5         kx     return (0);
     5         kx     } /* main */
     5         kx EOCP
     5         kx 	set try
     5         kx 	if eval $compile; then
     5         kx 	    eval `$run ./try 2>/dev/null`
     5         kx 	else
     5         kx 	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
     5         kx 	    fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx     esac
     5         kx 
     5         kx : check for type of arguments to select.
     5         kx case "$selecttype" in
     5         kx '') case "$d_select" in
     5         kx 	$define)
     5         kx 		echo " "
     5         kx 		$cat <<EOM
     5         kx Checking to see what type of arguments are accepted by select().
     5         kx EOM
     5         kx 		hdrs="$define sys/types.h
     5         kx 			$i_systime sys/time.h
     5         kx 			$i_sysselct sys/select.h
     5         kx 			$d_socket sys/socket.h"
     5         kx 		: The first arg can be int, unsigned, or size_t
     5         kx 		: The last arg may or may not be 'const'
     5         kx 		val=''
     5         kx 		: void pointer has been seen but using that
     5         kx 		: breaks the selectminbits test
     5         kx 		for xxx in 'fd_set *' 'int *'; do
     5         kx 			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
     5         kx 				for tmo in 'struct timeval *' 'const struct timeval *'; do
     5         kx 					case "$val" in
     5         kx 					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
     5         kx 						if ./protochk "$try" $hdrs; then
     5         kx 							echo "Your system accepts $xxx."
     5         kx 							val="$xxx"
     5         kx 						fi
     5         kx 						;;
     5         kx 					esac
     5         kx 				done
     5         kx 			done
     5         kx 		done
     5         kx 		case "$val" in
     5         kx 		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
     5         kx 			case "$d_fd_set" in
     5         kx 				$define) dflt="fd_set *" ;;
     5         kx 				*)		dflt="int *" ;;
     5         kx 			esac
     5         kx 			. ./myread
     5         kx 			val=$ans
     5         kx 			;;
     5         kx 		esac
     5         kx 		selecttype="$val"
     5         kx 		;;
     5         kx 	*)	: no select, so pick a harmless default
     5         kx 		selecttype='int *'
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : check for the select 'width'
     5         kx case "$selectminbits" in
     5         kx '') safebits=`expr $ptrsize \* 8`
     5         kx     case "$d_select" in
     5         kx 	$define)
     5         kx 		$cat <<EOM
     5         kx 
     5         kx Checking to see on how many bits at a time your select() operates...
     5         kx EOM
     5         kx 		$cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #$i_time I_TIME
     5         kx #$i_systime I_SYS_TIME
     5         kx #$i_systimek I_SYS_TIME_KERNEL
     5         kx #ifdef I_TIME
     5         kx #   include <time.h>
     5         kx #endif
     5         kx #ifdef I_SYS_TIME
     5         kx #   ifdef I_SYS_TIME_KERNEL
     5         kx #	define KERNEL
     5         kx #   endif
     5         kx #   include <sys/time.h>
     5         kx #   ifdef I_SYS_TIME_KERNEL
     5         kx #	undef KERNEL
     5         kx #   endif
     5         kx #endif
     5         kx #$i_sysselct I_SYS_SELECT
     5         kx #ifdef I_SYS_SELECT
     5         kx #include <sys/select.h>
     5         kx #endif
     5         kx #$d_socket HAS_SOCKET
     5         kx #ifdef HAS_SOCKET
     5         kx #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx $selecttype b;
     5         kx #define S sizeof(*(b))
     5         kx #define MINBITS	64
     5         kx #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
     5         kx #define NBITS  (NBYTES * 8)
     5         kx int main() {
     5         kx     char *s = (char *)malloc(NBYTES);
     5         kx     struct timeval t;
     5         kx     int i;
     5         kx     FILE* fp;
     5         kx     int fd;
     5         kx 
     5         kx     if (!s)
     5         kx 	exit(1);
     5         kx     fclose(stdin);
     5         kx     fp = fopen("try.c", "r");
     5         kx     if (fp == 0)
     5         kx       exit(2);
     5         kx     fd = fileno(fp);
     5         kx     if (fd < 0)
     5         kx       exit(3);
     5         kx     b = ($selecttype)s;
     5         kx     for (i = 0; i < NBITS; i++)
     5         kx 	FD_SET(i, b);
     5         kx     t.tv_sec  = 0;
     5         kx     t.tv_usec = 0;
     5         kx     select(fd + 1, b, 0, 0, &t);
     5         kx     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
     5         kx     free(s);
     5         kx     printf("%d\n", i + 1);
     5         kx     return 0;
     5         kx }
     5         kx EOCP
     5         kx 		set try
     5         kx 		if eval $compile_ok; then
     5         kx 			selectminbits=`$run ./try 2>/dev/null`
     5         kx 			case "$selectminbits" in
     5         kx 			'')	cat >&4 <<EOM
     5         kx Cannot figure out on how many bits at a time your select() operates.
     5         kx I'll play safe and guess it is $safebits bits.
     5         kx EOM
     5         kx 				selectminbits=$safebits
     5         kx 				bits="$safebits bits"
     5         kx 				;;
     5         kx 			1)	bits="1 bit" ;;
     5         kx 			*)	bits="$selectminbits bits" ;;
     5         kx 			esac
     5         kx 			echo "Your select() operates on $bits at a time." >&4
     5         kx 		else
     5         kx 			rp='What is the minimum number of bits your select() operates on?'
     5         kx 			case "$byteorder" in
     5         kx 			12345678)	dflt=64 ;;
     5         kx 			1234)		dflt=32 ;;
     5         kx 			*)		dflt=1	;;
     5         kx 			esac
     5         kx 			. ./myread
     5         kx 			val=$ans
     5         kx 			selectminbits="$val"
     5         kx 		fi
     5         kx 		$rm_try
     5         kx 		;;
     5         kx 	*)	: no select, so pick a harmless default
     5         kx 		selectminbits=$safebits
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Trace out the files included by signal.h, then look for SIGxxx names.
     5         kx case "$sig_num_init" in
     5         kx '')
     5         kx if [ "X$fieldn" = X ]; then
     5         kx 	: Just make some guesses.  We check them later.
     5         kx 	xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
     5         kx else
     5         kx 	xxx=`echo '#include <signal.h>' |
     5         kx 	$cppstdin $cppminus $cppflags 2>/dev/null |
     5         kx 	$grep '^[ 	]*#.*include' |
     5         kx 	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
     5         kx 		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
     5         kx fi
     5         kx xxxfiles=''
     5         kx for xx in $xxx /dev/null ; do
     5         kx 	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
     5         kx done
     5         kx case "$xxxfiles" in
     5         kx '')	xxxfiles=`./findhdr signal.h` ;;
     5         kx esac
     5         kx xxx=`awk '
     5         kx $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
     5         kx 	print substr($2, 4, 20)
     5         kx }
     5         kx $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
     5         kx 	print substr($3, 4, 20)
     5         kx }' $xxxfiles`
     5         kx : Append some common names just in case the awk scan failed.
     5         kx xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
     5         kx xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
     5         kx xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
     5         kx xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
     5         kx xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
     5         kx 
     5         kx : generate a few handy files for later
     5         kx $cat > signal.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx 
     5         kx /* Strange style to avoid deeply-nested #if/#else/#endif */
     5         kx #ifndef NSIG
     5         kx #  ifdef _NSIG
     5         kx #    define NSIG (_NSIG)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef SIGMAX
     5         kx #    define NSIG (SIGMAX+1)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef SIG_MAX
     5         kx #    define NSIG (SIG_MAX+1)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef _SIG_MAX
     5         kx #    define NSIG (_SIG_MAX+1)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef MAXSIG
     5         kx #    define NSIG (MAXSIG+1)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef MAX_SIG
     5         kx #    define NSIG (MAX_SIG+1)
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef SIGARRAYSIZE
     5         kx #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx #ifndef NSIG
     5         kx #  ifdef _sys_nsig
     5         kx #    define NSIG (_sys_nsig) /* Solaris 2.5 */
     5         kx #  endif
     5         kx #endif
     5         kx 
     5         kx /* Default to some arbitrary number that's big enough to get most
     5         kx    of the common signals.
     5         kx */
     5         kx #ifndef NSIG
     5         kx #    define NSIG 50
     5         kx #endif
     5         kx 
     5         kx printf("NSIG %d\n", NSIG);
     5         kx 
     5         kx #ifndef JUST_NSIG
     5         kx 
     5         kx EOCP
     5         kx 
     5         kx echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
     5         kx {
     5         kx 	printf "#ifdef SIG"; printf $1; printf "\n"
     5         kx 	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
     5         kx 	printf $1; printf ");\n"
     5         kx 	printf "#endif\n"
     5         kx }
     5         kx END {
     5         kx 	printf "#endif /* JUST_NSIG */\n";
     5         kx 	printf "exit(0);\n}\n";
     5         kx }
     5         kx ' >>signal.c
     5         kx $cat >signal.awk <<'EOP'
     5         kx BEGIN { ndups = 0 }
     5         kx $1 ~ /^NSIG$/ { nsig = $2 }
     5         kx ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
     5         kx     if ($2 > maxsig) { maxsig = $2 }
     5         kx     if (sig_name[$2]) {
     5         kx 	dup_name[ndups] = $1
     5         kx 	dup_num[ndups] = $2
     5         kx 	ndups++
     5         kx     }
     5         kx     else {
     5         kx 	sig_name[$2] = $1
     5         kx 	sig_num[$2] = $2
     5         kx     }
     5         kx }
     5         kx END {
     5         kx     if (nsig == 0) {
     5         kx     	nsig = maxsig + 1
     5         kx     }
     5         kx     printf("NSIG %d\n", nsig);
     5         kx     for (n = 1; n < nsig; n++) {
     5         kx  	if (sig_name[n]) {
     5         kx  	    printf("%s %d\n", sig_name[n], sig_num[n])
     5         kx 	}
     5         kx  	else {
     5         kx  	    printf("NUM%d %d\n", n, n)
     5         kx  	}
     5         kx     }
     5         kx     for (n = 0; n < ndups; n++) {
     5         kx  	printf("%s %d\n", dup_name[n], dup_num[n])
     5         kx     }
     5         kx }
     5         kx EOP
     5         kx $cat >signal_cmd <<EOS
     5         kx $startsh
     5         kx if $test -s signal.lst; then
     5         kx     echo "Using your existing signal.lst file"
     5         kx 	exit 0
     5         kx fi
     5         kx xxx="$xxx"
     5         kx EOS
     5         kx $cat >>signal_cmd <<'EOS'
     5         kx 
     5         kx set signal
     5         kx if eval $compile_ok; then
     5         kx 	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
     5         kx 		$uniq | $awk -f signal.awk >signal.lst
     5         kx else
     5         kx 	echo "(I can't seem be able to compile the whole test program)" >&4
     5         kx 	echo "(I'll try it in little pieces.)" >&4
     5         kx 	set signal -DJUST_NSIG
     5         kx 	if eval $compile_ok; then
     5         kx 		$run ./signal$_exe > signal.nsg
     5         kx 		$cat signal.nsg
     5         kx 	else
     5         kx 		echo "I can't seem to figure out how many signals you have." >&4
     5         kx 		echo "Guessing 50." >&4
     5         kx 		echo 'NSIG 50' > signal.nsg
     5         kx 	fi
     5         kx 	: Now look at all the signal names, one at a time.
     5         kx 	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
     5         kx 		$cat > signal.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <signal.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx printf("$xx %d\n", SIG${xx});
     5         kx return 0;
     5         kx }
     5         kx EOCP
     5         kx 		set signal
     5         kx 		if eval $compile; then
     5         kx 			echo "SIG${xx} found."
     5         kx 			$run ./signal$_exe  >> signal.ls1
     5         kx 		else
     5         kx 			echo "SIG${xx} NOT found."
     5         kx 		fi
     5         kx 	done
     5         kx 	if $test -s signal.ls1; then
     5         kx 		$cat signal.nsg signal.ls1 |
     5         kx 			$sort -n | $uniq | $awk -f signal.awk >signal.lst
     5         kx 	fi
     5         kx 
     5         kx fi
     5         kx if $test -s signal.lst; then
     5         kx 	:
     5         kx else
     5         kx 	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
     5         kx 	echo 'kill -l' >signal
     5         kx 	set X `csh -f <signal`
     5         kx 	$rm -f signal
     5         kx 	shift
     5         kx 	case $# in
     5         kx 	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
     5         kx 	esac
     5         kx 	echo $@ | $tr ' ' $trnl | \
     5         kx  	    $awk '{ printf "%s %d\n", $1, ++s; }
     5         kx  		  END { printf "NSIG %d\n", ++s }' >signal.lst
     5         kx fi
     5         kx $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
     5         kx EOS
     5         kx chmod a+x signal_cmd
     5         kx $eunicefix signal_cmd
     5         kx ;;
     5         kx esac
     5         kx 
     5         kx : generate list of signal names
     5         kx case "$sig_num_init" in
     5         kx '')
     5         kx echo " "
     5         kx case "$sig_name_init" in
     5         kx '') doinit=yes ;;
     5         kx *)  case "$sig_num_init" in
     5         kx     ''|*,*) doinit=yes ;;
     5         kx     esac ;;
     5         kx esac
     5         kx case "$doinit" in
     5         kx yes)
     5         kx 	echo "Generating a list of signal names and numbers..." >&4
     5         kx 	. ./signal_cmd
     5         kx 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
     5         kx 	sig_name=`$awk 'BEGIN { printf "ZERO " }
     5         kx 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
     5         kx 	sig_num=`$awk  'BEGIN { printf "0 " }
     5         kx 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
     5         kx 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
     5         kx 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
     5         kx 			     END	{ printf "0\n" }' signal.lst`
     5         kx 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
     5         kx 			     !/^NSIG/	{ printf "%d, ", $2}
     5         kx 			     END	{ printf "0\n"}' signal.lst`
     5         kx 	;;
     5         kx esac
     5         kx echo "The following $sig_count signals are available:"
     5         kx echo " "
     5         kx echo $sig_name | $awk \
     5         kx 'BEGIN { linelen = 0 }
     5         kx {
     5         kx 	for (i = 1; i <= NF; i++) {
     5         kx 		name = "SIG" $i " "
     5         kx 		linelen = linelen + length(name)
     5         kx 		if (linelen > 70) {
     5         kx 			printf "\n"
     5         kx 			linelen = length(name)
     5         kx 		}
     5         kx 		printf "%s", name
     5         kx 	}
     5         kx 	printf "\n"
     5         kx }'
     5         kx sig_size=`echo $sig_name | awk '{print NF}'`
     5         kx $rm -f signal signal.c signal.awk signal.lst signal_cmd
     5         kx ;;
     5         kx esac
     5         kx 
     5         kx : Check size of size
     5         kx echo " "
     5         kx case "$sizetype" in
     5         kx *_t) zzz="$sizetype"	;;
     5         kx *)   zzz="filesize"	;;
     5         kx esac
     5         kx echo "Checking the size of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     printf("%d\n", (int)sizeof($sizetype));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	sizesize=4
     5         kx 		echo "(I can't execute the test program--guessing $sizesize.)" >&4
     5         kx 		;;
     5         kx 	*)	sizesize=$yyy
     5         kx 		echo "Your $zzz size is $sizesize bytes."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	sizesize=4
     5         kx 	echo "(I can't compile the test program--guessing $sizesize.)" >&4
     5         kx fi
     5         kx 
     5         kx : check for socklen_t
     5         kx echo " "
     5         kx echo "Checking to see if you have socklen_t..." >&4
     5         kx $cat >try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #$d_socket HAS_SOCKET
     5         kx #ifdef HAS_SOCKET
     5         kx #include <sys/socket.h>
     5         kx #endif
     5         kx int main() { socklen_t x = 16; }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val="$define"
     5         kx 	echo "You have socklen_t."
     5         kx else
     5         kx 	val="$undef"
     5         kx 	echo "You do not have socklen_t."
     5         kx 	case "$sizetype" in
     5         kx 	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
     5         kx 	esac
     5         kx fi
     5         kx $rm_try
     5         kx set d_socklen_t
     5         kx eval $setvar
     5         kx 
     5         kx : see if this is a socks.h system
     5         kx set socks.h i_socks
     5         kx eval $inhdr
     5         kx 
     5         kx : check for type of the size argument to socket calls
     5         kx case "$d_socket" in
     5         kx "$define")
     5         kx 	$cat <<EOM
     5         kx 
     5         kx Checking to see what type is the last argument of accept().
     5         kx EOM
     5         kx 	yyy=''
     5         kx 	case "$d_socklen_t" in
     5         kx 	"$define") yyy="$yyy socklen_t"
     5         kx 	esac
     5         kx 	yyy="$yyy $sizetype int long unsigned"
     5         kx 	for xxx in $yyy; do
     5         kx 		case "$socksizetype" in
     5         kx 		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
     5         kx 			case "$usesocks" in
     5         kx 			"$define")
     5         kx 				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
     5         kx 					echo "Your system accepts '$xxx *' for the last argument of accept()."
     5         kx 					socksizetype="$xxx"
     5         kx 				fi
     5         kx 				;;
     5         kx 			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
     5         kx 					echo "Your system accepts '$xxx *' for the last argument of accept()."
     5         kx 					socksizetype="$xxx"
     5         kx 				fi
     5         kx 				;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 	done
     5         kx : In case none of those worked, prompt the user.
     5         kx 	case "$socksizetype" in
     5         kx 	'')	rp='What is the type for socket address structure sizes?'
     5         kx 		dflt='int'
     5         kx 		. ./myread
     5         kx 		socksizetype=$ans
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	: no sockets, so pick relatively harmless default
     5         kx 	socksizetype='int'
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see what type is used for signed size_t
     5         kx set ssize_t ssizetype int stdio.h sys/types.h
     5         kx eval $typedef
     5         kx dflt="$ssizetype"
     5         kx $cat > try.c <<EOM
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx #include <sys/types.h>
     5         kx #define Size_t $sizetype
     5         kx #define SSize_t $dflt
     5         kx int main()
     5         kx {
     5         kx 	if (sizeof(Size_t) == sizeof(SSize_t))
     5         kx 		printf("$dflt\n");
     5         kx 	else if (sizeof(Size_t) == sizeof(int))
     5         kx 		printf("int\n");
     5         kx 	else
     5         kx 		printf("long\n");
     5         kx 	exit(0);
     5         kx }
     5         kx EOM
     5         kx echo " "
     5         kx set try
     5         kx if eval $compile_ok && $run ./try > /dev/null; then
     5         kx 	ssizetype=`$run ./try`
     5         kx 	echo "I'll be using $ssizetype for functions returning a byte count." >&4
     5         kx else
     5         kx 	$cat >&4 <<EOM
     5         kx Help! I can't compile and run the ssize_t test program: please enlighten me!
     5         kx (This is probably a misconfiguration in your system or libraries, and
     5         kx you really ought to fix it.  Still, I'll try anyway.)
     5         kx 
     5         kx I need a type that is the same size as $sizetype, but is guaranteed to
     5         kx be signed.  Common values are ssize_t, int and long.
     5         kx 
     5         kx EOM
     5         kx 	rp="What signed type is the same size as $sizetype?"
     5         kx 	. ./myread
     5         kx 	ssizetype="$ans"
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check the size of st_dev
     5         kx $echo " "
     5         kx $echo "Checking the size of st_dev..." >&4
     5         kx $cat > try.c <<EOCP
     5         kx #include <sys/stat.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     struct stat st;
     5         kx     printf("%d\n", (int)sizeof(st.st_dev));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	val=`$run ./try`
     5         kx 	case "$val" in
     5         kx 	'')	st_dev_size=4
     5         kx 		$echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
     5         kx 		;;
     5         kx 	*)	st_dev_size=$val
     5         kx 		$echo "Your st_dev is $st_dev_size bytes long."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	st_dev_size=4
     5         kx 	$echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check if st_dev is signed
     5         kx $echo " "
     5         kx $echo "Checking the sign of st_dev..." >&4
     5         kx $cat > try.c <<EOCP
     5         kx #include <sys/stat.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx 	struct stat foo;
     5         kx         foo.st_dev = -1;
     5         kx 	if (foo.st_dev < 0)
     5         kx 		printf("-1\n");
     5         kx 	else
     5         kx 		printf("1\n");
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val=`$run ./try`
     5         kx 	case "$val" in
     5         kx 	'')	st_dev_sign=1
     5         kx 		$echo "(I can't execute the test program--guessing unsigned.)" >&4
     5         kx 		;;
     5         kx 	*)	st_dev_sign=$val
     5         kx 		case "$st_dev_sign" in
     5         kx 		 1) $echo "Your st_dev is unsigned." ;;
     5         kx 		-1) $echo "Your st_dev is signed."   ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	st_dev_sign=1
     5         kx 	$echo "(I can't compile the test program--guessing unsigned.)" >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check the size of st_ino
     5         kx $echo " "
     5         kx $echo "Checking the size of st_ino..." >&4
     5         kx $cat > try.c <<EOCP
     5         kx #include <sys/stat.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     struct stat st;
     5         kx     printf("%d\n", (int)sizeof(st.st_ino));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	val=`$run ./try`
     5         kx 	case "$val" in
     5         kx 	'')	st_ino_size=4
     5         kx 		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
     5         kx 		;;
     5         kx 	*)	st_ino_size=$val
     5         kx 		$echo "Your st_ino is $st_ino_size bytes long."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	st_ino_size=4
     5         kx 	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : Check if st_ino is signed
     5         kx $echo " "
     5         kx $echo "Checking the sign of st_ino..." >&4
     5         kx $cat > try.c <<EOCP
     5         kx #include <sys/stat.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx 	struct stat foo;
     5         kx         foo.st_ino = -1;
     5         kx 	if (foo.st_ino < 0)
     5         kx 		printf("-1\n");
     5         kx 	else
     5         kx 		printf("1\n");
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	val=`$run ./try`
     5         kx 	case "$val" in
     5         kx 	'')	st_ino_sign=1
     5         kx 		$echo "(I can't execute the test program--guessing unsigned.)" >&4
     5         kx 		;;
     5         kx 	*)	st_ino_sign=$val
     5         kx 		case "$st_ino_sign" in
     5         kx 		 1) $echo "Your st_ino is unsigned." ;;
     5         kx 		-1) $echo "Your st_ino is signed."   ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	st_ino_sign=1
     5         kx 	$echo "(I can't compile the test program--guessing unsigned.)" >&4
     5         kx fi
     5         kx $rm_try
     5         kx 
     5         kx : see what type of char stdio uses.
     5         kx echo " "
     5         kx echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
     5         kx if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
     5         kx 	echo "Your stdio uses unsigned chars." >&4
     5         kx 	stdchar="unsigned char"
     5         kx else
     5         kx 	echo "Your stdio uses signed chars." >&4
     5         kx 	stdchar="char"
     5         kx fi
     5         kx $rm -f stdioh
     5         kx 
     5         kx : Check size of UID
     5         kx echo " "
     5         kx case "$uidtype" in
     5         kx *_t) zzz="$uidtype"	;;
     5         kx *)   zzz="uid"		;;
     5         kx esac
     5         kx echo "Checking the size of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx #$i_stdlib I_STDLIB
     5         kx #ifdef I_STDLIB
     5         kx #include <stdlib.h>
     5         kx #endif
     5         kx int main() {
     5         kx     printf("%d\n", (int)sizeof($uidtype));
     5         kx     exit(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile_ok; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	uidsize=4
     5         kx 		echo "(I can't execute the test program--guessing $uidsize.)" >&4
     5         kx 		;;
     5         kx 	*)	uidsize=$yyy
     5         kx 		echo "Your $zzz is $uidsize bytes long."
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	uidsize=4
     5         kx 	echo "(I can't compile the test program--guessing $uidsize.)" >&4
     5         kx fi
     5         kx 
     5         kx : Check if UID is signed
     5         kx echo " "
     5         kx case "$uidtype" in
     5         kx *_t) zzz="$uidtype"	;;
     5         kx *)   zzz="uid"		;;
     5         kx esac
     5         kx echo "Checking the sign of $zzz..." >&4
     5         kx cat > try.c <<EOCP
     5         kx #include <sys/types.h>
     5         kx #include <stdio.h>
     5         kx int main() {
     5         kx 	$uidtype foo = -1;
     5         kx 	if (foo < 0)
     5         kx 		printf("-1\n");
     5         kx 	else
     5         kx 		printf("1\n");
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	yyy=`$run ./try`
     5         kx 	case "$yyy" in
     5         kx 	'')	uidsign=1
     5         kx 		echo "(I can't execute the test program--guessing unsigned.)" >&4
     5         kx 		;;
     5         kx 	*)	uidsign=$yyy
     5         kx 		case "$uidsign" in
     5         kx 		 1) echo "Your $zzz is unsigned." ;;
     5         kx 		-1) echo "Your $zzz is signed."   ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx else
     5         kx 	uidsign=1
     5         kx 	echo "(I can't compile the test program--guessing unsigned.)" >&4
     5         kx fi
     5         kx 
     5         kx : Check format string for UID
     5         kx echo " "
     5         kx $echo "Checking the format string to be used for uids..." >&4
     5         kx 
     5         kx case "$uidsign" in
     5         kx -1)	if $test X"$uidsize" = X"$ivsize"; then
     5         kx 		uidformat="$ivdformat"
     5         kx 	else
     5         kx 		if $test X"$uidsize" = X"$longsize"; then
     5         kx 			uidformat='"ld"'
     5         kx 		else
     5         kx 			if $test X"$uidsize" = X"$intsize"; then
     5         kx 				uidformat='"d"'
     5         kx 			else
     5         kx 				if $test X"$uidsize" = X"$shortsize"; then
     5         kx 					uidformat='"hd"'
     5         kx 				fi
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx *)	if $test X"$uidsize" = X"$uvsize"; then
     5         kx 		uidformat="$uvuformat"
     5         kx 	else
     5         kx 		if $test X"$uidsize" = X"$longsize"; then
     5         kx 			uidformat='"lu"'
     5         kx 		else
     5         kx 			if $test X"$uidsize" = X"$intsize"; then
     5         kx 				uidformat='"u"'
     5         kx 			else
     5         kx 				if $test X"$uidsize" = X"$shortsize"; then
     5         kx 					uidformat='"hu"'
     5         kx 				fi
     5         kx 			fi
     5         kx 		fi
     5         kx 	fi
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : Ask about strict by default.
     5         kx case "$usedefaultstrict" in
     5         kx     $define|true|[Yy]*)
     5         kx        dflt="y"
     5         kx        ;;
     5         kx     *)
     5         kx        dflt="n"
     5         kx        ;;
     5         kx     esac
     5         kx 
     5         kx cat <<EOM
     5         kx 
     5         kx EXPERIMENTAL: Perl can now be built with strict on by default when not
     5         kx invoked with -e or -E. This is a diagnostic tool for development.
     5         kx 
     5         kx Unless you are familiar with this feature, you should probably answer 'no'.
     5         kx 
     5         kx EOM
     5         kx 
     5         kx rp='Would you like to build perl with strict enabled by default?'
     5         kx . ./myread
     5         kx case "$ans" in
     5         kx y|Y) val="$define" ;;
     5         kx *)   val="$undef"  ;;
     5         kx esac
     5         kx set usedefaultstrict
     5         kx eval $setvar
     5         kx 
     5         kx : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
     5         kx echo " "
     5         kx echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
     5         kx $cat >try.c <<'EOM'
     5         kx /* Intentionally a long probe as I'd like to sanity check that the exact
     5         kx    approach is going to work, as thinking it will work, but only having it
     5         kx    part working at runtime is worse than not having it.  */
     5         kx 
     5         kx #include <sys/types.h>
     5         kx #include <sys/sysctl.h>
     5         kx #include <sys/param.h>
     5         kx #include <stdio.h>
     5         kx #include <string.h>
     5         kx #include <stdlib.h>
     5         kx #include <unistd.h>
     5         kx 
     5         kx int
     5         kx main(int argc, char **argv) {
     5         kx     char *buffer;
     5         kx     char *argv_leaf = strrchr(argv[0], '/');
     5         kx     char *buffer_leaf;
     5         kx     size_t size = 0;
     5         kx     int mib[4];
     5         kx 
     5         kx     mib[0] = CTL_KERN;
     5         kx     mib[1] = KERN_PROC;
     5         kx     mib[2] = KERN_PROC_PATHNAME;
     5         kx     mib[3] = -1;
     5         kx 
     5         kx     if (!argv_leaf) {
     5         kx 	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
     5         kx 	return 1;
     5         kx     }
     5         kx 
     5         kx     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
     5         kx 	perror("sysctl");
     5         kx 	return 2;
     5         kx     }
     5         kx 
     5         kx     if (size < strlen(argv_leaf) + 1) {
     5         kx 	fprintf(stderr, "size %lu is too short for a path\n",
     5         kx 		(unsigned long) size);
     5         kx 	return 3;
     5         kx     }
     5         kx 
     5         kx     if (size > MAXPATHLEN * MAXPATHLEN) {
     5         kx 	fprintf(stderr, "size %lu is too long for a path\n",
     5         kx 		(unsigned long) size);
     5         kx 	return 4;
     5         kx     }
     5         kx 
     5         kx     buffer = (char *)malloc(size);
     5         kx     if (!buffer) {
     5         kx 	perror("malloc");
     5         kx 	return 5;
     5         kx     }
     5         kx 
     5         kx     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
     5         kx 	perror("sysctl");
     5         kx 	return 6;
     5         kx     }
     5         kx 
     5         kx     if (strlen(buffer) + 1 != size) {
     5         kx 	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
     5         kx 		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
     5         kx         return 7;
     5         kx     }
     5         kx 
     5         kx 
     5         kx     if (*buffer != '/') {
     5         kx 	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
     5         kx 	return 8;
     5         kx     }
     5         kx 
     5         kx     if (strstr(buffer, "/./")) {
     5         kx 	fprintf(stderr, "Contains /./: '%s'\n", buffer);
     5         kx 	return 9;
     5         kx     }
     5         kx 
     5         kx     if (strstr(buffer, "/../")) {
     5         kx 	fprintf(stderr, "Contains /../: '%s'\n", buffer);
     5         kx 	return 10;
     5         kx     }
     5         kx 
     5         kx     buffer_leaf = strrchr(buffer, '/');
     5         kx     if (strcmp(buffer_leaf, argv_leaf) != 0) {
     5         kx 	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
     5         kx 	return 11;
     5         kx     }
     5         kx 
     5         kx     free(buffer);
     5         kx 
     5         kx     return 0;
     5         kx }
     5         kx EOM
     5         kx 
     5         kx val=$undef
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	if $run ./try; then
     5         kx 		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx else
     5         kx 	echo "I'm unable to compile the test program." >&4
     5         kx 	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx set usekernprocpathname
     5         kx eval $setvar
     5         kx 
     5         kx : Determine if we can use _NSGetExecutablePath to find executing program
     5         kx echo " "
     5         kx echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
     5         kx $cat >try.c <<'EOM'
     5         kx /* Intentionally a long probe as I'd like to sanity check that the exact
     5         kx    approach is going to work, as thinking it will work, but only having it
     5         kx    part working at runtime is worse than not having it.  */
     5         kx #include <mach-o/dyld.h>
     5         kx #include <stdio.h>
     5         kx #include <stdlib.h>
     5         kx #include <sys/param.h>
     5         kx #include <string.h>
     5         kx 
     5         kx int
     5         kx main(int argc, char **argv) {
     5         kx     char buf[1];
     5         kx     uint32_t size = sizeof(buf);
     5         kx     int result;
     5         kx     char *buffer;
     5         kx     char *tidied;
     5         kx     char *argv_leaf = strrchr(argv[0], '/');
     5         kx     char *tidied_leaf;
     5         kx 
     5         kx     if (!argv_leaf) {
     5         kx 	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
     5         kx 	return 1;
     5         kx     }
     5         kx 
     5         kx     _NSGetExecutablePath(buf, &size);
     5         kx     if (size > MAXPATHLEN * MAXPATHLEN) {
     5         kx 	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
     5         kx 		(unsigned int) size);
     5         kx 	return 2;
     5         kx     }
     5         kx 
     5         kx     buffer = (char *)malloc(size);
     5         kx     if (!buffer) {
     5         kx 	perror("malloc");
     5         kx 	return 3;
     5         kx     }
     5         kx 
     5         kx     result = _NSGetExecutablePath(buffer, &size);
     5         kx     if (result != 0) {
     5         kx 	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
     5         kx 		result, (unsigned int) size);
     5         kx 	return 4;
     5         kx     }
     5         kx 
     5         kx     tidied = realpath(buffer, NULL);
     5         kx     if (!tidied) {
     5         kx 	perror("realpath");
     5         kx 	return 5;
     5         kx     }
     5         kx 
     5         kx     free(buffer);
     5         kx 
     5         kx     if (*tidied != '/') {
     5         kx 	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
     5         kx 	return 6;
     5         kx     }
     5         kx 
     5         kx     if (strstr(tidied, "/./")) {
     5         kx 	fprintf(stderr, "Contains /./: '%s'\n", tidied);
     5         kx 	return 7;
     5         kx     }
     5         kx 
     5         kx     if (strstr(tidied, "/../")) {
     5         kx 	fprintf(stderr, "Contains /../: '%s'\n", tidied);
     5         kx 	return 8;
     5         kx     }
     5         kx 
     5         kx     tidied_leaf = strrchr(tidied, '/');
     5         kx     if (strcmp(tidied_leaf, argv_leaf) != 0) {
     5         kx 	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
     5         kx 	return 9;
     5         kx     }
     5         kx 
     5         kx     free(tidied);
     5         kx 
     5         kx     return 0;
     5         kx }
     5         kx EOM
     5         kx 
     5         kx val=$undef
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	if $run ./try; then
     5         kx 		echo "You can use _NSGetExecutablePath to find the executing program." >&4
     5         kx 		val="$define"
     5         kx 	else
     5         kx 		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
     5         kx 	fi
     5         kx else
     5         kx 	echo "I'm unable to compile the test program." >&4
     5         kx 	echo "I'll assume no _NSGetExecutablePath here." >&4
     5         kx fi
     5         kx $rm_try
     5         kx set usensgetexecutablepath
     5         kx eval $setvar
     5         kx 
     5         kx : Check if site customization support was requested
     5         kx case "$usesitecustomize" in
     5         kx     $define|true|[Yy]*)
     5         kx 	usesitecustomize="$define"
     5         kx 	;;
     5         kx     *)
     5         kx 	usesitecustomize="$undef"
     5         kx 	;;
     5         kx     esac
     5         kx 
     5         kx : determine compiler compiler
     5         kx case "$yacc" in
     5         kx '')
     5         kx 	dflt=yacc;;
     5         kx *)
     5         kx 	dflt="$yacc";;
     5         kx esac
     5         kx echo " "
     5         kx comp='yacc'
     5         kx if $test -f "$byacc$_exe"; then
     5         kx 	dflt="$byacc"
     5         kx 	comp="byacc or $comp"
     5         kx fi
     5         kx if $test -f "$bison$_exe"; then
     5         kx 	comp="$comp or bison -y"
     5         kx fi
     5         kx rp="Which compiler compiler ($comp) shall I use?"
     5         kx . ./myread
     5         kx yacc="$ans"
     5         kx case "$yacc" in
     5         kx *bis*)
     5         kx 	case "$yacc" in
     5         kx 	*-y*) ;;
     5         kx 	*)
     5         kx 		yacc="$yacc -y"
     5         kx 		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if this is a bfd.h system
     5         kx set bfd.h i_bfd
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is an execinfo.h system
     5         kx set execinfo.h i_execinfo
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a fenv.h system
     5         kx set fenv.h i_fenv
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a fp.h system
     5         kx set fp.h i_fp
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a fp_class.h system
     5         kx set fp_class.h i_fp_class
     5         kx eval $inhdr
     5         kx 
     5         kx : see if gdbm.h is available
     5         kx set gdbm.h t_gdbm
     5         kx eval $inhdr
     5         kx case "$t_gdbm" in
     5         kx $define)
     5         kx 	: see if gdbm_open exists
     5         kx 	set gdbm_open d_gdbm_open
     5         kx 	eval $inlibc
     5         kx 	case "$d_gdbm_open" in
     5         kx 	$undef)
     5         kx 		t_gdbm="$undef"
     5         kx 		echo "We won't be including <gdbm.h>"
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx val="$t_gdbm"
     5         kx set i_gdbm
     5         kx eval $setvar
     5         kx 
     5         kx : see if this is a ieeefp.h system
     5         kx case "$i_ieeefp" in
     5         kx '' ) set ieeefp.h i_ieeefp
     5         kx      eval $inhdr
     5         kx      ;;
     5         kx esac
     5         kx 
     5         kx : see if this is a libutil.h system
     5         kx set libutil.h i_libutil
     5         kx eval $inhdr
     5         kx 
     5         kx : see if mach cthreads are available
     5         kx if test "X$usethreads" = "X$define"; then
     5         kx 	set mach/cthreads.h i_machcthr
     5         kx 	eval $inhdr
     5         kx else
     5         kx 	i_machcthr="$undef"
     5         kx fi
     5         kx 
     5         kx : see if this is a mntent.h system
     5         kx set mntent.h i_mntent
     5         kx eval $inhdr
     5         kx 
     5         kx : see if net/errno.h is available
     5         kx val=''
     5         kx set net/errno.h val
     5         kx eval $inhdr
     5         kx 
     5         kx : Unfortunately, it causes problems on some systems.  Arrgh.
     5         kx case "$val" in
     5         kx $define)
     5         kx 	cat > try.c <<'EOM'
     5         kx #include <stdio.h>
     5         kx #include <errno.h>
     5         kx #include <net/errno.h>
     5         kx int func()
     5         kx {
     5         kx 	return ENOTSOCK;
     5         kx }
     5         kx EOM
     5         kx 	if $cc $ccflags -c try.c >/dev/null 2>&1; then
     5         kx 		echo "We'll be including <net/errno.h>." >&4
     5         kx 	else
     5         kx 		echo "We won't be including <net/errno.h>." >&4
     5         kx 		val="$undef"
     5         kx 	fi
     5         kx 	$rm_try
     5         kx 	;;
     5         kx esac
     5         kx set i_neterrno
     5         kx eval $setvar
     5         kx 
     5         kx : see if netinet/tcp.h is available
     5         kx set netinet/tcp.h i_netinettcp
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a poll.h system
     5         kx set poll.h i_poll
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a prot.h system
     5         kx set prot.h i_prot
     5         kx eval $inhdr
     5         kx 
     5         kx : Preprocessor symbols
     5         kx echo " "
     5         kx $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
     5         kx $cat <<'EOSH' > Cppsym.know
     5         kx a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
     5         kx AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
     5         kx AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
     5         kx arch_pwr ardent ARM ARM32 atarist att386 att3b
     5         kx BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
     5         kx BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
     5         kx byteorder byte_order
     5         kx c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
     5         kx convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
     5         kx DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
     5         kx ELF encore EPI EXTENSIONS
     5         kx FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
     5         kx GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
     5         kx GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
     5         kx H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
     5         kx hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
     5         kx hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
     5         kx i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
     5         kx iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
     5         kx INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
     5         kx ksr1
     5         kx LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
     5         kx LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
     5         kx LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
     5         kx luna88k Lynx
     5         kx M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
     5         kx MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
     5         kx mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
     5         kx merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
     5         kx MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
     5         kx MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
     5         kx M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
     5         kx M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
     5         kx n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
     5         kx news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
     5         kx ns32000 ns32016 ns32332 ns32k nsc32000
     5         kx OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
     5         kx PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
     5         kx plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
     5         kx POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
     5         kx QK_USER QNX
     5         kx R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
     5         kx S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
     5         kx SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
     5         kx sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
     5         kx stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
     5         kx SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
     5         kx SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
     5         kx SYSV4 SYSV5 sysV68 sysV88
     5         kx Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
     5         kx TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
     5         kx tower32_800 tower32_850 tss
     5         kx u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
     5         kx UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
     5         kx USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
     5         kx USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
     5         kx USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
     5         kx USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
     5         kx uxpm uxps
     5         kx vax venix VMESA vms
     5         kx x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
     5         kx XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
     5         kx z8000 zarch
     5         kx EOSH
     5         kx # Maybe put other stuff here too.
     5         kx ./tr '-' '_' <<EOSH >>Cppsym.know
     5         kx $osname
     5         kx EOSH
     5         kx ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
     5         kx ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
     5         kx $cat Cppsym.know > Cppsym.c
     5         kx $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
     5         kx $rm -f Cppsym.a Cppsym.b Cppsym.c
     5         kx cat <<EOSH > Cppsym
     5         kx $startsh
     5         kx if $test \$# -gt 0; then
     5         kx     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
     5         kx     if $test -s Cppsym.got; then
     5         kx 	$rm -f Cppsym.got
     5         kx 	exit 0
     5         kx     fi
     5         kx     $rm -f Cppsym.got
     5         kx     exit 1
     5         kx else
     5         kx     $tr " " "$trnl" | ./Cppsym.try
     5         kx     exit 0
     5         kx fi
     5         kx EOSH
     5         kx chmod +x Cppsym
     5         kx $eunicefix Cppsym
     5         kx cat <<EOSH > Cppsym.try
     5         kx $startsh
     5         kx cat <<'EOCP' > try.c
     5         kx #include <stdio.h>
     5         kx #if cpp_stuff == 1
     5         kx #define STRINGIFY(a)    "a"
     5         kx #endif
     5         kx #if cpp_stuff == 42
     5         kx #define StGiFy(a)  #a
     5         kx #define STRINGIFY(a)    StGiFy(a)
     5         kx #endif
     5         kx #if $cpp_stuff != 1 && $cpp_stuff != 42
     5         kx #   include "Bletch: How does this C preprocessor stringify macros?"
     5         kx #endif
     5         kx int main() {
     5         kx EOCP
     5         kx $awk \\
     5         kx EOSH
     5         kx cat <<'EOSH' >> Cppsym.try
     5         kx 'length($1) > 0 {
     5         kx     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
     5         kx     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
     5         kx     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
     5         kx     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
     5         kx }' >> try.c
     5         kx echo 'return 0;}' >> try.c
     5         kx EOSH
     5         kx cat <<EOSH >> Cppsym.try
     5         kx ccflags="$ccflags"
     5         kx case "$osname-$gccversion" in
     5         kx irix-) ccflags="\$ccflags -woff 1178" ;;
     5         kx os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
     5         kx esac
     5         kx $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
     5         kx EOSH
     5         kx chmod +x Cppsym.try
     5         kx $eunicefix Cppsym.try
     5         kx ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
     5         kx : Add in any Linux cpp "predefined macros":
     5         kx case "$osname::$gccversion" in
     5         kx   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
     5         kx     tHdrH=_tmpHdr
     5         kx     rm -f $tHdrH'.h' $tHdrH
     5         kx     touch $tHdrH'.h'
     5         kx     # Filter out macro arguments, such as Linux's __INT8_C(c)
     5         kx     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
     5         kx        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
     5         kx        if [ -s $tHdrH'_cppsym.real' ]; then
     5         kx 	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
     5         kx        fi
     5         kx     fi
     5         kx     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
     5         kx   ;;
     5         kx esac
     5         kx : now check the C compiler for additional symbols
     5         kx postprocess_cc_v=''
     5         kx case "$osname" in
     5         kx aix) postprocess_cc_v="|$tr , ' '" ;;
     5         kx esac
     5         kx $cat >ccsym <<EOS
     5         kx $startsh
     5         kx $cat >tmp.c <<EOF
     5         kx extern int foo;
     5         kx EOF
     5         kx for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
     5         kx do
     5         kx 	case "\$i" in
     5         kx 	-D*) echo "\$i" | $sed 's/^-D//';;
     5         kx 	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
     5         kx 	esac
     5         kx done
     5         kx $rm_try
     5         kx EOS
     5         kx postprocess_cc_v=''
     5         kx chmod +x ccsym
     5         kx $eunicefix ccsym
     5         kx ./ccsym > ccsym1.raw
     5         kx if $test -s ccsym1.raw; then
     5         kx     $sort ccsym1.raw | $uniq >ccsym.raw
     5         kx else
     5         kx     mv ccsym1.raw ccsym.raw
     5         kx fi
     5         kx 
     5         kx $awk '/\=/ { print $0; next }
     5         kx 	{ print $0"=1" }' ccsym.raw >ccsym.list
     5         kx $comm -13 Cppsym.true ccsym.list >ccsym.own
     5         kx $comm -12 Cppsym.true ccsym.list >ccsym.com
     5         kx $comm -23 Cppsym.true ccsym.list >ccsym.cpp
     5         kx also=''
     5         kx if $test -z ccsym.raw; then
     5         kx 	echo "Your C compiler doesn't seem to define any symbols!" >&4
     5         kx 	echo " "
     5         kx 	echo "However, your C preprocessor defines the following symbols:"
     5         kx 	$cat Cppsym.true
     5         kx 	ccsymbols=''
     5         kx 	cppsymbols=`$cat Cppsym.true`
     5         kx 	cppsymbols=`echo $cppsymbols`
     5         kx 	cppccsymbols="$cppsymbols"
     5         kx else
     5         kx 	if $test -s ccsym.com; then
     5         kx 		echo "Your C compiler and pre-processor define these symbols:"
     5         kx 		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
     5         kx 		also='also '
     5         kx 		symbols='ones'
     5         kx 		cppccsymbols=`$cat ccsym.com`
     5         kx 		cppccsymbols=`echo $cppccsymbols`
     5         kx 		$test "$silent" || sleep 1
     5         kx 	fi
     5         kx 	if $test -s ccsym.cpp; then
     5         kx 		$test "$also" && echo " "
     5         kx 		echo "Your C pre-processor ${also}defines the following symbols:"
     5         kx 		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
     5         kx 		also='further '
     5         kx 		cppsymbols=`$cat ccsym.cpp`
     5         kx 		cppsymbols=`echo $cppsymbols`
     5         kx 		$test "$silent" || sleep 1
     5         kx 	fi
     5         kx 	if $test -s ccsym.own; then
     5         kx 		$test "$also" && echo " "
     5         kx 		echo "Your C compiler ${also}defines the following cpp symbols:"
     5         kx 		$sed -e 's/\(..*\)=1/\1/' ccsym.own
     5         kx 		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
     5         kx 		ccsymbols=`$cat ccsym.own`
     5         kx 		ccsymbols=`echo $ccsymbols`
     5         kx 		$test "$silent" || sleep 1
     5         kx 	fi
     5         kx fi
     5         kx 
     5         kx : add -D_FORTIFY_SOURCE if feasible and not already there
     5         kx case "$gccversion" in
     5         kx [456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
     5         kx 	*-O*)	case "$ccflags$cppsymbols" in
     5         kx 		*_FORTIFY_SOURCE=*) # Don't add it again.
     5         kx 			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
     5         kx 			;;
     5         kx 		*)	echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
     5         kx 			ccflags="$ccflags -D_FORTIFY_SOURCE=2"
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
     5         kx 		;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)	echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : script used to emit important warnings
     5         kx cat >warn <<EOS
     5         kx $startsh
     5         kx if test \$# -gt 0; then
     5         kx 	echo "\$@" >msg
     5         kx else
     5         kx 	cat >msg
     5         kx fi
     5         kx echo "*** WARNING:" >&4
     5         kx sed -e 's/^/*** /' <msg >&4
     5         kx echo "*** " >&4
     5         kx cat msg >>config.msg
     5         kx echo " " >>config.msg
     5         kx rm -f msg
     5         kx EOS
     5         kx chmod +x warn
     5         kx $eunicefix warn
     5         kx 
     5         kx : see if this is a termio system
     5         kx val="$undef"
     5         kx val2="$undef"
     5         kx val3="$undef"
     5         kx if $test `./findhdr termios.h`; then
     5         kx     set tcsetattr i_termios
     5         kx     eval $inlibc
     5         kx     val3="$i_termios"
     5         kx fi
     5         kx echo " "
     5         kx case "$val3" in
     5         kx     "$define") echo "You have POSIX termios.h... good!" >&4;;
     5         kx     *)  if ./Cppsym pyr; then
     5         kx 	    case "`$run /bin/universe`" in
     5         kx 		ucb) if $test `./findhdr sgtty.h`; then
     5         kx 			val2="$define"
     5         kx 			echo "<sgtty.h> found." >&4
     5         kx 		    else
     5         kx 			echo "System is pyramid with BSD universe."
     5         kx 			./warn "<sgtty.h> not found--you could have problems."
     5         kx 		    fi;;
     5         kx 		*)  if $test `./findhdr termio.h`; then
     5         kx 			val="$define"
     5         kx 			echo "<termio.h> found." >&4
     5         kx 		    else
     5         kx 			echo "System is pyramid with USG universe."
     5         kx 			./warn "<termio.h> not found--you could have problems."
     5         kx 		    fi;;
     5         kx 	    esac
     5         kx 	elif ./usg; then
     5         kx 	    if $test `./findhdr termio.h`; then
     5         kx 		echo "<termio.h> found." >&4
     5         kx 		val="$define"
     5         kx 	    elif $test `./findhdr sgtty.h`; then
     5         kx 		echo "<sgtty.h> found." >&4
     5         kx 		val2="$define"
     5         kx 	    else
     5         kx 		./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
     5         kx 	    fi
     5         kx 	else
     5         kx 	    if $test `./findhdr sgtty.h`; then
     5         kx 		echo "<sgtty.h> found." >&4
     5         kx 		val2="$define"
     5         kx 	    elif $test `./findhdr termio.h`; then
     5         kx 		echo "<termio.h> found." >&4
     5         kx 		val="$define"
     5         kx 	    else
     5         kx 		./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
     5         kx 	    fi
     5         kx 	fi;;
     5         kx esac
     5         kx set i_termio; eval $setvar
     5         kx val=$val2; set i_sgtty; eval $setvar
     5         kx val=$val3; set i_termios; eval $setvar
     5         kx 
     5         kx : see if stdbool is available
     5         kx : we want a real compile instead of Inhdr because some Solaris systems
     5         kx : have stdbool.h, but it can only be used if the compiler indicates it
     5         kx : is sufficiently c99-compliant.
     5         kx echo " "
     5         kx $cat >try.c <<EOCP
     5         kx #include <stdio.h>
     5         kx #include <stdbool.h>
     5         kx int func(bool x)
     5         kx {
     5         kx     return x ? 1 : 0;
     5         kx }
     5         kx int main(int argc, char **argv)
     5         kx {
     5         kx     return func(0);
     5         kx }
     5         kx EOCP
     5         kx set try
     5         kx if eval $compile; then
     5         kx 	echo "<stdbool.h> found." >&4
     5         kx 	val="$define"
     5         kx else
     5         kx 	echo "<stdbool.h> NOT found." >&4
     5         kx 	val="$undef"
     5         kx fi
     5         kx $rm_try
     5         kx set i_stdbool
     5         kx eval $setvar
     5         kx 
     5         kx : see if stdint is available
     5         kx set stdint.h i_stdint
     5         kx eval $inhdr
     5         kx 
     5         kx : see if sys/access.h is available
     5         kx set sys/access.h i_sysaccess
     5         kx eval $inhdr
     5         kx 
     5         kx : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
     5         kx set sys/filio.h i_sysfilio
     5         kx eval $inhdr
     5         kx echo " "
     5         kx if $test `./findhdr sys/ioctl.h`; then
     5         kx 	val="$define"
     5         kx 	echo '<sys/ioctl.h> found.' >&4
     5         kx else
     5         kx 	val="$undef"
     5         kx 	if $test $i_sysfilio = "$define"; then
     5         kx 	    echo '<sys/ioctl.h> NOT found.' >&4
     5         kx 	else
     5         kx 		$test $i_sgtty = "$define" && xxx="sgtty.h"
     5         kx 		$test $i_termio = "$define" && xxx="termio.h"
     5         kx 		$test $i_termios = "$define" && xxx="termios.h"
     5         kx echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
     5         kx 	fi
     5         kx fi
     5         kx set i_sysioctl
     5         kx eval $setvar
     5         kx 
     5         kx : see if socket ioctl defs are in sys/sockio.h
     5         kx echo " "
     5         kx xxx=`./findhdr sys/sockio.h`
     5         kx if $test "$xxx"; then
     5         kx 	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
     5         kx 		val="$define"
     5         kx 		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
     5         kx 	else
     5         kx 		val="$undef"
     5         kx 		echo "No socket ioctls found in <sys/sockio.h>." >&4
     5         kx 	fi
     5         kx else
     5         kx 	val="$undef"
     5         kx 	$cat <<EOM
     5         kx <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
     5         kx EOM
     5         kx fi
     5         kx set i_syssockio
     5         kx eval $setvar
     5         kx 
     5         kx : see if this is a syslog.h system
     5         kx set syslog.h i_syslog
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/mode.h system
     5         kx set sys/mode.h i_sysmode
     5         kx eval $inhdr
     5         kx 
     5         kx : see if there is a sys/poll.h file
     5         kx set sys/poll.h i_syspoll
     5         kx eval $inhdr
     5         kx 
     5         kx : see if sys/resource.h has to be included
     5         kx set sys/resource.h i_sysresrc
     5         kx eval $inhdr
     5         kx 
     5         kx : see if sys/security.h is available
     5         kx set sys/security.h i_syssecrt
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/statvfs.h system
     5         kx set sys/statvfs.h i_sysstatvfs
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/un.h system
     5         kx set sys/un.h i_sysun
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a sys/utsname.h system
     5         kx set sys/utsname.h i_sysutsname
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a syswait system
     5         kx set sys/wait.h i_syswait
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a ustat.h system
     5         kx set ustat.h i_ustat
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is an utime system
     5         kx set utime.h i_utime
     5         kx eval $inhdr
     5         kx 
     5         kx : see if this is a vfork system
     5         kx case "$d_vfork" in
     5         kx "$define")
     5         kx 	set vfork.h i_vfork
     5         kx 	eval $inhdr
     5         kx 	;;
     5         kx *)
     5         kx 	i_vfork="$undef"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : see if wchar.h is present
     5         kx set wchar.h i_wchar
     5         kx eval $inhdr
     5         kx 
     5         kx : Check extensions
     5         kx echo " "
     5         kx echo "Looking for extensions..." >&4
     5         kx : If we are using the old config.sh, nonxs_extensions and xs_extensions may
     5         kx : contain old or inaccurate or duplicate values.
     5         kx nonxs_extensions=''
     5         kx xs_extensions=''
     5         kx : We do not use find because it might not be available.
     5         kx : We do not just use MANIFEST because the user may have dropped
     5         kx : some additional extensions into the source tree and expect them
     5         kx : to be built.
     5         kx 
     5         kx : Function to recursively find available extensions, ignoring DynaLoader
     5         kx : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
     5         kx : In 5.10.1 and later, extensions are stored in directories
     5         kx : like File-Glob instead of the older File/Glob/.
     5         kx find_extensions='
     5         kx     for xxx in *; do
     5         kx 	case "$xxx" in
     5         kx 	    DynaLoader|dynaload) ;;
     5         kx 	    *)
     5         kx 	    this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
     5         kx 	    case "$this_ext" in
     5         kx 		Scalar/List/Utils) this_ext="List/Util"	;;
     5         kx 		PathTools)         this_ext="Cwd"	;;
     5         kx 	    esac;
     5         kx 	    echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
     5         kx 	    if $contains " $this_ext " "$tdir/$$.tmp"; then
     5         kx 		echo >&4;
     5         kx 		echo "Duplicate directories detected for extension $xxx" >&4;
     5         kx 		echo "Configure cannot correctly recover from this - shall I abort?" >&4;
     5         kx 		case "$knowitall" in
     5         kx 		"") dflt=y;;
     5         kx 		*) dflt=n;;
     5         kx 		esac;
     5         kx 		. ../UU/myread;
     5         kx 		case "$ans" in
     5         kx 		n*|N*) ;;
     5         kx 		*) echo >&4;
     5         kx 		    echo "Ok.  Stopping Configure." >&4;
     5         kx 		    echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
     5         kx 		    exit 1;;
     5         kx 		esac;
     5         kx 		echo "Ok.  You will need to correct config.sh before running make." >&4;
     5         kx 	    fi;
     5         kx 	    $ls -1 "$xxx" > "$tdir/$$.tmp";
     5         kx 	    if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
     5         kx 		xs_extensions="$xs_extensions $this_ext";
     5         kx 	    elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
     5         kx 		xs_extensions="$xs_extensions $this_ext";
     5         kx 	    elif $test -d "$xxx"; then
     5         kx 		nonxs_extensions="$nonxs_extensions $this_ext";
     5         kx 	    fi;
     5         kx 	    $rm -f "$tdir/$$.tmp";
     5         kx 	    ;;
     5         kx 	esac;
     5         kx     done'
     5         kx tdir=`pwd`
     5         kx cd "$rsrc/cpan"
     5         kx set X
     5         kx shift
     5         kx eval $find_extensions
     5         kx cd "$rsrc/dist"
     5         kx set X
     5         kx shift
     5         kx eval $find_extensions
     5         kx cd "$rsrc/ext"
     5         kx set X
     5         kx shift
     5         kx eval $find_extensions
     5         kx set X $xs_extensions
     5         kx shift
     5         kx xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
     5         kx set X $nonxs_extensions
     5         kx shift
     5         kx nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
     5         kx cd "$tdir"
     5         kx known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
     5         kx 
     5         kx : Now see which are supported on this system.
     5         kx avail_ext=''
     5         kx for xxx in $xs_extensions ; do
     5         kx 	case "$xxx" in
     5         kx 	Amiga*)
     5         kx 		case "$osname" in
     5         kx 		amigaos) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	DB_File|db_file)
     5         kx 		case "$i_db" in
     5         kx 		$define) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	GDBM_File|gdbm_fil)
     5         kx 		case "$i_gdbm" in
     5         kx 		$define) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	IPC/SysV|ipc/sysv)
     5         kx 		: XXX Do we need a useipcsysv variable here
     5         kx 		case "${d_msg}${d_sem}${d_shm}" in
     5         kx 		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	NDBM_File|ndbm_fil)
     5         kx 		case "$d_ndbm" in
     5         kx 		$define)
     5         kx 		    case "$osname-$use64bitint" in
     5         kx 		    hpux-define)
     5         kx 			case "$libs" in
     5         kx 			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		    *) avail_ext="$avail_ext $xxx" ;;
     5         kx 		    esac
     5         kx 		    ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	ODBM_File|odbm_fil)
     5         kx 		case "${i_dbm}${i_rpcsvcdbm}" in
     5         kx 		*"${define}"*)
     5         kx 		    case "$d_cplusplus" in
     5         kx 		    define) ;; # delete as a function name will not work
     5         kx 		    *)  case "$osname-$use64bitint" in
     5         kx 			hpux-define)
     5         kx 			    case "$libs" in
     5         kx 			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
     5         kx 			    esac
     5         kx 			    ;;
     5         kx 			*) avail_ext="$avail_ext $xxx" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		    esac
     5         kx 		    ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	Opcode|opcode)
     5         kx 		case "$useopcode" in
     5         kx 		true|define|y) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	POSIX|posix)
     5         kx 		case "$useposix" in
     5         kx 		true|define|y) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	Socket|socket)
     5         kx 		case "$d_socket" in
     5         kx 		true|$define|y) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	I18N/Langinfo|langinfo)
     5         kx 		case "$uselanginfo" in
     5         kx 		true|define|y) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	Sys/Syslog|sys/syslog)
     5         kx 		case $osname in
     5         kx 			amigaos) ;; # not really very useful on AmigaOS
     5         kx 			*)
     5         kx 			: XXX syslog requires socket
     5         kx 			case "$d_socket" in
     5         kx 			true|$define|y) avail_ext="$avail_ext $xxx" ;;
     5         kx 			esac
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	threads|threads/shared)
     5         kx 		# threads and threads::shared are special cases.
     5         kx 		# To stop people from asking "Perl 5.8.0 was supposed
     5         kx 		# to have this new fancy threads implementation but my
     5         kx 		# perl doesn't have it" and from people trying to
     5         kx 		# (re)install the threads module using CPAN.pm and
     5         kx 		# CPAN.pm then offering to reinstall Perl 5.8.0,
     5         kx 		# the threads.pm and threads/shared.pm will always be
     5         kx 		# there, croaking informatively ("you need to rebuild
     5         kx 		# all of Perl with threads, sorry") when threads haven't
     5         kx 		# been compiled in.
     5         kx 		# --jhi
     5         kx 		avail_ext="$avail_ext $xxx"
     5         kx 		;;
     5         kx 	VMS*)
     5         kx 		;;
     5         kx 	Win32*)
     5         kx 		case "$osname" in
     5         kx 		cygwin) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	XS/APItest|xs/apitest)
     5         kx 		# This is just for testing.  Skip it unless we have dynamic loading.
     5         kx 
     5         kx 		case "$usedl" in
     5         kx 		$define) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	XS/Typemap|xs/typemap)
     5         kx 		# This is just for testing.  Skip it unless we have dynamic loading.
     5         kx 		case "$usedl" in
     5         kx 		$define) avail_ext="$avail_ext $xxx" ;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	*)	avail_ext="$avail_ext $xxx"
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx set X $avail_ext
     5         kx shift
     5         kx avail_ext="$*"
     5         kx 
     5         kx case "$onlyextensions" in
     5         kx '') ;;
     5         kx *)  keepextensions=''
     5         kx     echo "You have requested that only certain extensions be included..." >&4
     5         kx     for i in $onlyextensions; do
     5         kx         case " $avail_ext " in
     5         kx         *" $i "*)
     5         kx             echo "Keeping extension $i."
     5         kx             keepextensions="$keepextensions $i"
     5         kx             ;;
     5         kx         *) echo "Ignoring extension $i." ;;
     5         kx         esac
     5         kx     done
     5         kx     avail_ext="$keepextensions"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx case "$noextensions" in
     5         kx '') ;;
     5         kx *)  keepextensions=''
     5         kx     echo "You have requested that certain extensions be ignored..." >&4
     5         kx     for i in $avail_ext; do
     5         kx         case " $noextensions " in
     5         kx         *" $i "*) echo "Ignoring extension $i." ;;
     5         kx         *) echo "Keeping extension $i.";
     5         kx            keepextensions="$keepextensions $i"
     5         kx            ;;
     5         kx         esac
     5         kx     done
     5         kx     avail_ext="$keepextensions"
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Now see which nonxs extensions are supported on this system.
     5         kx : For now assume all are.
     5         kx nonxs_ext=''
     5         kx for xxx in $nonxs_extensions ; do
     5         kx 	case "$xxx" in
     5         kx 	VMS*)
     5         kx 		;;
     5         kx 	*)	nonxs_ext="$nonxs_ext $xxx"
     5         kx 		;;
     5         kx 	esac
     5         kx done
     5         kx 
     5         kx set X $nonxs_ext
     5         kx shift
     5         kx nonxs_ext="$*"
     5         kx 
     5         kx case $usedl in
     5         kx $define)
     5         kx 	$cat <<EOM
     5         kx A number of extensions are supplied with $package.  You may choose to
     5         kx compile these extensions for dynamic loading (the default), compile
     5         kx them into the $package executable (static loading), or not include
     5         kx them at all.  Answer "none" to include no extensions.
     5         kx Note that DynaLoader is always built and need not be mentioned here.
     5         kx 
     5         kx EOM
     5         kx 	case "$dynamic_ext" in
     5         kx 	'')
     5         kx 		: Exclude those listed in static_ext
     5         kx 		dflt=''
     5         kx 		for xxx in $avail_ext; do
     5         kx 			case " $static_ext " in
     5         kx 			*" $xxx "*) ;;
     5         kx 			*) dflt="$dflt $xxx" ;;
     5         kx 			esac
     5         kx 		done
     5         kx 		set X $dflt
     5         kx 		shift
     5         kx 		dflt="$*"
     5         kx 		;;
     5         kx 	*)	dflt="$dynamic_ext"
     5         kx 		# Perhaps we are reusing an old out-of-date config.sh.
     5         kx 		case "$hint" in
     5         kx 		previous)
     5         kx 			if test X"$dynamic_ext" != X"$avail_ext"; then
     5         kx 				$cat <<EOM
     5         kx NOTICE:  Your previous config.sh list may be incorrect.
     5         kx The extensions now available to you are
     5         kx 	${avail_ext}
     5         kx but the default list from your previous config.sh is
     5         kx 	${dynamic_ext}
     5         kx 
     5         kx EOM
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	case "$dflt" in
     5         kx 	'')	dflt=none;;
     5         kx 	esac
     5         kx 	rp="What extensions do you wish to load dynamically?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	none) dynamic_ext=' ' ;;
     5         kx 	*) dynamic_ext="$ans" ;;
     5         kx 	esac
     5         kx 
     5         kx 	case "$static_ext" in
     5         kx 	'')
     5         kx 		: Exclude those already listed in dynamic linking
     5         kx 		dflt=''
     5         kx 		for xxx in $avail_ext; do
     5         kx 			case " $dynamic_ext " in
     5         kx 			*" $xxx "*) ;;
     5         kx 			*) dflt="$dflt $xxx" ;;
     5         kx 			esac
     5         kx 		done
     5         kx 		set X $dflt
     5         kx 		shift
     5         kx 		dflt="$*"
     5         kx 		;;
     5         kx 	*)  dflt="$static_ext"
     5         kx 		;;
     5         kx 	esac
     5         kx 
     5         kx 	case "$dflt" in
     5         kx 	'')	dflt=none;;
     5         kx 	esac
     5         kx 	rp="What extensions do you wish to load statically?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	none) static_ext=' ' ;;
     5         kx 	*) static_ext="$ans" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx *)
     5         kx 	$cat <<EOM
     5         kx A number of extensions are supplied with $package.  Answer "none"
     5         kx to include no extensions.
     5         kx Note that DynaLoader is always built and need not be mentioned here.
     5         kx 
     5         kx EOM
     5         kx 	case "$static_ext" in
     5         kx 	'') dflt="$avail_ext" ;;
     5         kx 	*)	dflt="$static_ext"
     5         kx 		# Perhaps we are reusing an old out-of-date config.sh.
     5         kx 		case "$hint" in
     5         kx 		previous)
     5         kx 			if test X"$static_ext" != X"$avail_ext"; then
     5         kx 				$cat <<EOM
     5         kx NOTICE:  Your previous config.sh list may be incorrect.
     5         kx The extensions now available to you are
     5         kx 	${avail_ext}
     5         kx but the default list from your previous config.sh is
     5         kx 	${static_ext}
     5         kx 
     5         kx EOM
     5         kx 			fi
     5         kx 			;;
     5         kx 		esac
     5         kx 		;;
     5         kx 	esac
     5         kx 	: Exclude those that are not xs extensions
     5         kx 	case "$dflt" in
     5         kx 	'')	dflt=none;;
     5         kx 	esac
     5         kx 	rp="What extensions do you wish to include?"
     5         kx 	. ./myread
     5         kx 	case "$ans" in
     5         kx 	none) static_ext=' ' ;;
     5         kx 	*) static_ext="$ans" ;;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx #
     5         kx # Encode is a special case.  If we are building Encode as a static
     5         kx # extension, we need to explicitly list its subextensions as well.
     5         kx # For other nested extensions, this is handled automatically by
     5         kx # the appropriate Makefile.PL.
     5         kx case " $static_ext " in
     5         kx 	*" Encode "*) # Add the subextensions of Encode
     5         kx 	cd "$rsrc/cpan"
     5         kx 	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
     5         kx 		static_ext="$static_ext Encode/$xxx"
     5         kx 		known_extensions="$known_extensions Encode/$xxx"
     5         kx 	done
     5         kx 	cd "$tdir"
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx set X $dynamic_ext $static_ext $nonxs_ext
     5         kx shift
     5         kx extensions="$*"
     5         kx 
     5         kx # Sanity check:  We require an extension suitable for use with
     5         kx # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
     5         kx # should show up as failures in the test suite, but it's helpful to
     5         kx # catch them now.) The 'extensions' list is normally sorted
     5         kx # alphabetically, so we need to accept either
     5         kx #    DB_File ... Fcntl ... IO  ....
     5         kx # or something like
     5         kx #    Fcntl ... NDBM_File ... IO  ....
     5         kx case " $extensions"  in
     5         kx *"_File "*" Fcntl "*" IO "*) ;; # DB_File
     5         kx *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
     5         kx *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
     5         kx *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
     5         kx    echo "WARNING: The Perl you are building will be quite crippled." >& 4
     5         kx    ;;
     5         kx esac
     5         kx 
     5         kx : Remove libraries needed only for extensions
     5         kx : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
     5         kx : The exception is SunOS 4.x, which needs them.
     5         kx case "${osname}X${osvers}" in
     5         kx sunos*X4*)
     5         kx     perllibs="$libs"
     5         kx     ;;
     5         kx *) case "$usedl" in
     5         kx     $define|true|[yY]*)
     5         kx 	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
     5         kx 	    shift
     5         kx 	    perllibs="$*"
     5         kx 	    ;;
     5         kx     *)	perllibs="$libs"
     5         kx 	    ;;
     5         kx     esac
     5         kx     ;;
     5         kx esac
     5         kx 
     5         kx : Remove build directory name from cppstdin so it can be used from
     5         kx : either the present location or the final installed location.
     5         kx echo " "
     5         kx : Get out of the UU directory to get correct path name.
     5         kx cd ..
     5         kx case "$cppstdin" in
     5         kx `pwd`/cppstdin)
     5         kx 	echo "Stripping down cppstdin path name"
     5         kx 	cppstdin=cppstdin
     5         kx 	;;
     5         kx esac
     5         kx cd UU
     5         kx 
     5         kx : end of configuration questions
     5         kx echo " "
     5         kx echo "End of configuration questions."
     5         kx echo " "
     5         kx 
     5         kx : back to where it started
     5         kx if test -d ../UU; then
     5         kx 	cd ..
     5         kx fi
     5         kx 
     5         kx : configuration may be unconditionally patched via a 'config.arch' file
     5         kx if $test -f config.arch; then
     5         kx 	echo "I see a config.arch file, loading it." >&4
     5         kx 	. ./config.arch
     5         kx fi
     5         kx 
     5         kx : configuration may be patched via a 'config.over' file
     5         kx if $test -f config.over; then
     5         kx 	echo " "
     5         kx 	dflt=y
     5         kx 	rp='I see a config.over file.  Do you wish to load it?'
     5         kx 	. UU/myread
     5         kx 	case "$ans" in
     5         kx 	n*) echo "OK, I'll ignore it.";;
     5         kx 	*)	. ./config.over
     5         kx 		echo "Configuration override changes have been loaded."
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : in case they want portability, strip down executable paths
     5         kx case "$d_portable" in
     5         kx "$define")
     5         kx 	echo " "
     5         kx 	echo "Stripping down executable paths..." >&4
     5         kx 	for file in $loclist $trylist; do
     5         kx 		eval temp=\$$file
     5         kx 		eval $file=`basename $temp`
     5         kx 	done
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : create config.sh file
     5         kx echo " "
     5         kx echo "Creating config.sh..." >&4
     5         kx $spitshell <<EOT >config.sh
     5         kx $startsh
     5         kx #
     5         kx # This file was produced by running the Configure script. It holds all the
     5         kx # definitions figured out by Configure. Should you modify one of these values,
     5         kx # do not forget to propagate your changes by running "Configure -der". You may
     5         kx # instead choose to run each of the .SH files by yourself, or "Configure -S".
     5         kx #
     5         kx 
     5         kx # Package name      : $package
     5         kx # Source directory  : $src
     5         kx # Configuration time: $cf_time
     5         kx # Configured by     : $cf_by
     5         kx # Target system     : $myuname
     5         kx 
     5         kx EOT
     5         kx : Add in command line options if available
     5         kx $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
     5         kx 
     5         kx $spitshell <<EOT >>config.sh
     5         kx 
     5         kx Author='$Author'
     5         kx Date='$Date'
     5         kx Header='$Header'
     5         kx Id='$Id'
     5         kx Locker='$Locker'
     5         kx Log='$Log'
     5         kx RCSfile='$RCSfile'
     5         kx Revision='$Revision'
     5         kx Source='$Source'
     5         kx State='$State'
     5         kx _a='$_a'
     5         kx _exe='$_exe'
     5         kx _o='$_o'
     5         kx afs='$afs'
     5         kx afsroot='$afsroot'
     5         kx alignbytes='$alignbytes'
     5         kx aphostname='$aphostname'
     5         kx api_revision='$api_revision'
     5         kx api_subversion='$api_subversion'
     5         kx api_version='$api_version'
     5         kx api_versionstring='$api_versionstring'
     5         kx ar='$ar'
     5         kx archlib='$archlib'
     5         kx archlibexp='$archlibexp'
     5         kx archname64='$archname64'
     5         kx archname='$archname'
     5         kx archobjs='$archobjs'
     5         kx asctime_r_proto='$asctime_r_proto'
     5         kx awk='$awk'
     5         kx baserev='$baserev'
     5         kx bash='$bash'
     5         kx bin='$bin'
     5         kx bin_ELF='$bin_ELF'
     5         kx binexp='$binexp'
     5         kx bison='$bison'
     5         kx byacc='$byacc'
     5         kx byteorder='$byteorder'
     5         kx c='$c'
     5         kx castflags='$castflags'
     5         kx cat='$cat'
     5         kx cc='$cc'
     5         kx cccdlflags='$cccdlflags'
     5         kx ccdlflags='$ccdlflags'
     5         kx ccflags='$ccflags'
     5         kx ccflags_uselargefiles='$ccflags_uselargefiles'
     5         kx ccname='$ccname'
     5         kx ccsymbols='$ccsymbols'
     5         kx ccversion='$ccversion'
     5         kx cf_by='$cf_by'
     5         kx cf_email='$cf_email'
     5         kx cf_time='$cf_time'
     5         kx charbits='$charbits'
     5         kx charsize='$charsize'
     5         kx chgrp='$chgrp'
     5         kx chmod='$chmod'
     5         kx chown='$chown'
     5         kx clocktype='$clocktype'
     5         kx comm='$comm'
     5         kx compiler_warning='$compiler_warning'
     5         kx compress='$compress'
     5         kx contains='$contains'
     5         kx cp='$cp'
     5         kx cpio='$cpio'
     5         kx cpp='$cpp'
     5         kx cpp_stuff='$cpp_stuff'
     5         kx cppccsymbols='$cppccsymbols'
     5         kx cppflags='$cppflags'
     5         kx cpplast='$cpplast'
     5         kx cppminus='$cppminus'
     5         kx cpprun='$cpprun'
     5         kx cppstdin='$cppstdin'
     5         kx cppsymbols='$cppsymbols'
     5         kx crypt_r_proto='$crypt_r_proto'
     5         kx cryptlib='$cryptlib'
     5         kx csh='$csh'
     5         kx ctermid_r_proto='$ctermid_r_proto'
     5         kx ctime_r_proto='$ctime_r_proto'
     5         kx d_Gconvert='$d_Gconvert'
     5         kx d_PRIEUldbl='$d_PRIEUldbl'
     5         kx d_PRIFUldbl='$d_PRIFUldbl'
     5         kx d_PRIGUldbl='$d_PRIGUldbl'
     5         kx d_PRIXU64='$d_PRIXU64'
     5         kx d_PRId64='$d_PRId64'
     5         kx d_PRIeldbl='$d_PRIeldbl'
     5         kx d_PRIfldbl='$d_PRIfldbl'
     5         kx d_PRIgldbl='$d_PRIgldbl'
     5         kx d_PRIi64='$d_PRIi64'
     5         kx d_PRIo64='$d_PRIo64'
     5         kx d_PRIu64='$d_PRIu64'
     5         kx d_PRIx64='$d_PRIx64'
     5         kx d_SCNfldbl='$d_SCNfldbl'
     5         kx d__fwalk='$d__fwalk'
     5         kx d_accept4='$d_accept4'
     5         kx d_access='$d_access'
     5         kx d_accessx='$d_accessx'
     5         kx d_acosh='$d_acosh'
     5         kx d_aintl='$d_aintl'
     5         kx d_alarm='$d_alarm'
     5         kx d_archlib='$d_archlib'
     5         kx d_asctime64='$d_asctime64'
     5         kx d_asctime_r='$d_asctime_r'
     5         kx d_asinh='$d_asinh'
     5         kx d_atanh='$d_atanh'
     5         kx d_atolf='$d_atolf'
     5         kx d_atoll='$d_atoll'
     5         kx d_attribute_always_inline='$d_attribute_always_inline'
     5         kx d_attribute_deprecated='$d_attribute_deprecated'
     5         kx d_attribute_format='$d_attribute_format'
     5         kx d_attribute_malloc='$d_attribute_malloc'
     5         kx d_attribute_nonnull='$d_attribute_nonnull'
     5         kx d_attribute_noreturn='$d_attribute_noreturn'
     5         kx d_attribute_pure='$d_attribute_pure'
     5         kx d_attribute_unused='$d_attribute_unused'
     5         kx d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
     5         kx d_backtrace='$d_backtrace'
     5         kx d_bsd='$d_bsd'
     5         kx d_bsdgetpgrp='$d_bsdgetpgrp'
     5         kx d_bsdsetpgrp='$d_bsdsetpgrp'
     5         kx d_builtin_add_overflow='$d_builtin_add_overflow'
     5         kx d_builtin_choose_expr='$d_builtin_choose_expr'
     5         kx d_builtin_expect='$d_builtin_expect'
     5         kx d_builtin_mul_overflow='$d_builtin_mul_overflow'
     5         kx d_builtin_sub_overflow='$d_builtin_sub_overflow'
     5         kx d_c99_variadic_macros='$d_c99_variadic_macros'
     5         kx d_casti32='$d_casti32'
     5         kx d_castneg='$d_castneg'
     5         kx d_cbrt='$d_cbrt'
     5         kx d_chown='$d_chown'
     5         kx d_chroot='$d_chroot'
     5         kx d_chsize='$d_chsize'
     5         kx d_class='$d_class'
     5         kx d_clearenv='$d_clearenv'
     5         kx d_closedir='$d_closedir'
     5         kx d_cmsghdr_s='$d_cmsghdr_s'
     5         kx d_copysign='$d_copysign'
     5         kx d_copysignl='$d_copysignl'
     5         kx d_cplusplus='$d_cplusplus'
     5         kx d_crypt='$d_crypt'
     5         kx d_crypt_r='$d_crypt_r'
     5         kx d_csh='$d_csh'
     5         kx d_ctermid='$d_ctermid'
     5         kx d_ctermid_r='$d_ctermid_r'
     5         kx d_ctime64='$d_ctime64'
     5         kx d_ctime_r='$d_ctime_r'
     5         kx d_cuserid='$d_cuserid'
     5         kx d_dbminitproto='$d_dbminitproto'
     5         kx d_difftime64='$d_difftime64'
     5         kx d_difftime='$d_difftime'
     5         kx d_dir_dd_fd='$d_dir_dd_fd'
     5         kx d_dirfd='$d_dirfd'
     5         kx d_dirnamlen='$d_dirnamlen'
     5         kx d_dladdr='$d_dladdr'
     5         kx d_dlerror='$d_dlerror'
     5         kx d_dlopen='$d_dlopen'
     5         kx d_dlsymun='$d_dlsymun'
     5         kx d_dosuid='$d_dosuid'
     5         kx d_double_has_inf='$d_double_has_inf'
     5         kx d_double_has_nan='$d_double_has_nan'
     5         kx d_double_has_negative_zero='$d_double_has_negative_zero'
     5         kx d_double_has_subnormals='$d_double_has_subnormals'
     5         kx d_double_style_cray='$d_double_style_cray'
     5         kx d_double_style_ibm='$d_double_style_ibm'
     5         kx d_double_style_ieee='$d_double_style_ieee'
     5         kx d_double_style_vax='$d_double_style_vax'
     5         kx d_drand48_r='$d_drand48_r'
     5         kx d_drand48proto='$d_drand48proto'
     5         kx d_dup2='$d_dup2'
     5         kx d_dup3='$d_dup3'
     5         kx d_duplocale='$d_duplocale'
     5         kx d_eaccess='$d_eaccess'
     5         kx d_endgrent='$d_endgrent'
     5         kx d_endgrent_r='$d_endgrent_r'
     5         kx d_endhent='$d_endhent'
     5         kx d_endhostent_r='$d_endhostent_r'
     5         kx d_endnent='$d_endnent'
     5         kx d_endnetent_r='$d_endnetent_r'
     5         kx d_endpent='$d_endpent'
     5         kx d_endprotoent_r='$d_endprotoent_r'
     5         kx d_endpwent='$d_endpwent'
     5         kx d_endpwent_r='$d_endpwent_r'
     5         kx d_endsent='$d_endsent'
     5         kx d_endservent_r='$d_endservent_r'
     5         kx d_eofnblk='$d_eofnblk'
     5         kx d_erf='$d_erf'
     5         kx d_erfc='$d_erfc'
     5         kx d_eunice='$d_eunice'
     5         kx d_exp2='$d_exp2'
     5         kx d_expm1='$d_expm1'
     5         kx d_faststdio='$d_faststdio'
     5         kx d_fchdir='$d_fchdir'
     5         kx d_fchmod='$d_fchmod'
     5         kx d_fchmodat='$d_fchmodat'
     5         kx d_fchown='$d_fchown'
     5         kx d_fcntl='$d_fcntl'
     5         kx d_fcntl_can_lock='$d_fcntl_can_lock'
     5         kx d_fd_macros='$d_fd_macros'
     5         kx d_fd_set='$d_fd_set'
     5         kx d_fdclose='$d_fdclose'
     5         kx d_fdim='$d_fdim'
     5         kx d_fds_bits='$d_fds_bits'
     5         kx d_fegetround='$d_fegetround'
     5         kx d_ffs='$d_ffs'
     5         kx d_ffsl='$d_ffsl'
     5         kx d_fgetpos='$d_fgetpos'
     5         kx d_finite='$d_finite'
     5         kx d_finitel='$d_finitel'
     5         kx d_flexfnam='$d_flexfnam'
     5         kx d_flock='$d_flock'
     5         kx d_flockproto='$d_flockproto'
     5         kx d_fma='$d_fma'
     5         kx d_fmax='$d_fmax'
     5         kx d_fmin='$d_fmin'
     5         kx d_fork='$d_fork'
     5         kx d_fp_class='$d_fp_class'
     5         kx d_fp_classify='$d_fp_classify'
     5         kx d_fp_classl='$d_fp_classl'
     5         kx d_fpathconf='$d_fpathconf'
     5         kx d_fpclass='$d_fpclass'
     5         kx d_fpclassify='$d_fpclassify'
     5         kx d_fpclassl='$d_fpclassl'
     5         kx d_fpgetround='$d_fpgetround'
     5         kx d_fpos64_t='$d_fpos64_t'
     5         kx d_freelocale='$d_freelocale'
     5         kx d_frexpl='$d_frexpl'
     5         kx d_fs_data_s='$d_fs_data_s'
     5         kx d_fseeko='$d_fseeko'
     5         kx d_fsetpos='$d_fsetpos'
     5         kx d_fstatfs='$d_fstatfs'
     5         kx d_fstatvfs='$d_fstatvfs'
     5         kx d_fsync='$d_fsync'
     5         kx d_ftello='$d_ftello'
     5         kx d_ftime='$d_ftime'
     5         kx d_futimes='$d_futimes'
     5         kx d_gai_strerror='$d_gai_strerror'
     5         kx d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
     5         kx d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
     5         kx d_getaddrinfo='$d_getaddrinfo'
     5         kx d_getcwd='$d_getcwd'
     5         kx d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
     5         kx d_getespwnam='$d_getespwnam'
     5         kx d_getfsstat='$d_getfsstat'
     5         kx d_getgrent='$d_getgrent'
     5         kx d_getgrent_r='$d_getgrent_r'
     5         kx d_getgrgid_r='$d_getgrgid_r'
     5         kx d_getgrnam_r='$d_getgrnam_r'
     5         kx d_getgrps='$d_getgrps'
     5         kx d_gethbyaddr='$d_gethbyaddr'
     5         kx d_gethbyname='$d_gethbyname'
     5         kx d_gethent='$d_gethent'
     5         kx d_gethname='$d_gethname'
     5         kx d_gethostbyaddr_r='$d_gethostbyaddr_r'
     5         kx d_gethostbyname_r='$d_gethostbyname_r'
     5         kx d_gethostent_r='$d_gethostent_r'
     5         kx d_gethostprotos='$d_gethostprotos'
     5         kx d_getitimer='$d_getitimer'
     5         kx d_getlogin='$d_getlogin'
     5         kx d_getlogin_r='$d_getlogin_r'
     5         kx d_getmnt='$d_getmnt'
     5         kx d_getmntent='$d_getmntent'
     5         kx d_getnameinfo='$d_getnameinfo'
     5         kx d_getnbyaddr='$d_getnbyaddr'
     5         kx d_getnbyname='$d_getnbyname'
     5         kx d_getnent='$d_getnent'
     5         kx d_getnetbyaddr_r='$d_getnetbyaddr_r'
     5         kx d_getnetbyname_r='$d_getnetbyname_r'
     5         kx d_getnetent_r='$d_getnetent_r'
     5         kx d_getnetprotos='$d_getnetprotos'
     5         kx d_getpagsz='$d_getpagsz'
     5         kx d_getpbyname='$d_getpbyname'
     5         kx d_getpbynumber='$d_getpbynumber'
     5         kx d_getpent='$d_getpent'
     5         kx d_getpgid='$d_getpgid'
     5         kx d_getpgrp2='$d_getpgrp2'
     5         kx d_getpgrp='$d_getpgrp'
     5         kx d_getppid='$d_getppid'
     5         kx d_getprior='$d_getprior'
     5         kx d_getprotobyname_r='$d_getprotobyname_r'
     5         kx d_getprotobynumber_r='$d_getprotobynumber_r'
     5         kx d_getprotoent_r='$d_getprotoent_r'
     5         kx d_getprotoprotos='$d_getprotoprotos'
     5         kx d_getprpwnam='$d_getprpwnam'
     5         kx d_getpwent='$d_getpwent'
     5         kx d_getpwent_r='$d_getpwent_r'
     5         kx d_getpwnam_r='$d_getpwnam_r'
     5         kx d_getpwuid_r='$d_getpwuid_r'
     5         kx d_getsbyname='$d_getsbyname'
     5         kx d_getsbyport='$d_getsbyport'
     5         kx d_getsent='$d_getsent'
     5         kx d_getservbyname_r='$d_getservbyname_r'
     5         kx d_getservbyport_r='$d_getservbyport_r'
     5         kx d_getservent_r='$d_getservent_r'
     5         kx d_getservprotos='$d_getservprotos'
     5         kx d_getspnam='$d_getspnam'
     5         kx d_getspnam_r='$d_getspnam_r'
     5         kx d_gettimeod='$d_gettimeod'
     5         kx d_gmtime64='$d_gmtime64'
     5         kx d_gmtime_r='$d_gmtime_r'
     5         kx d_gnulibc='$d_gnulibc'
     5         kx d_grpasswd='$d_grpasswd'
     5         kx d_has_C_UTF8='$d_has_C_UTF8'
     5         kx d_hasmntopt='$d_hasmntopt'
     5         kx d_htonl='$d_htonl'
     5         kx d_hypot='$d_hypot'
     5         kx d_ilogb='$d_ilogb'
     5         kx d_ilogbl='$d_ilogbl'
     5         kx d_inc_version_list='$d_inc_version_list'
     5         kx d_inetaton='$d_inetaton'
     5         kx d_inetntop='$d_inetntop'
     5         kx d_inetpton='$d_inetpton'
     5         kx d_int64_t='$d_int64_t'
     5         kx d_ip_mreq='$d_ip_mreq'
     5         kx d_ip_mreq_source='$d_ip_mreq_source'
     5         kx d_ipv6_mreq='$d_ipv6_mreq'
     5         kx d_ipv6_mreq_source='$d_ipv6_mreq_source'
     5         kx d_isascii='$d_isascii'
     5         kx d_isblank='$d_isblank'
     5         kx d_isfinite='$d_isfinite'
     5         kx d_isfinitel='$d_isfinitel'
     5         kx d_isinf='$d_isinf'
     5         kx d_isinfl='$d_isinfl'
     5         kx d_isless='$d_isless'
     5         kx d_isnan='$d_isnan'
     5         kx d_isnanl='$d_isnanl'
     5         kx d_isnormal='$d_isnormal'
     5         kx d_j0='$d_j0'
     5         kx d_j0l='$d_j0l'
     5         kx d_killpg='$d_killpg'
     5         kx d_lc_monetary_2008='$d_lc_monetary_2008'
     5         kx d_lchown='$d_lchown'
     5         kx d_ldbl_dig='$d_ldbl_dig'
     5         kx d_ldexpl='$d_ldexpl'
     5         kx d_lgamma='$d_lgamma'
     5         kx d_lgamma_r='$d_lgamma_r'
     5         kx d_libm_lib_version='$d_libm_lib_version'
     5         kx d_libname_unique='$d_libname_unique'
     5         kx d_link='$d_link'
     5         kx d_linkat='$d_linkat'
     5         kx d_llrint='$d_llrint'
     5         kx d_llrintl='$d_llrintl'
     5         kx d_llround='$d_llround'
     5         kx d_llroundl='$d_llroundl'
     5         kx d_localeconv_l='$d_localeconv_l'
     5         kx d_localtime64='$d_localtime64'
     5         kx d_localtime_r='$d_localtime_r'
     5         kx d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
     5         kx d_locconv='$d_locconv'
     5         kx d_lockf='$d_lockf'
     5         kx d_log1p='$d_log1p'
     5         kx d_log2='$d_log2'
     5         kx d_logb='$d_logb'
     5         kx d_long_double_style_ieee='$d_long_double_style_ieee'
     5         kx d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
     5         kx d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
     5         kx d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
     5         kx d_long_double_style_vax='$d_long_double_style_vax'
     5         kx d_longdbl='$d_longdbl'
     5         kx d_longlong='$d_longlong'
     5         kx d_lrint='$d_lrint'
     5         kx d_lrintl='$d_lrintl'
     5         kx d_lround='$d_lround'
     5         kx d_lroundl='$d_lroundl'
     5         kx d_lseekproto='$d_lseekproto'
     5         kx d_lstat='$d_lstat'
     5         kx d_madvise='$d_madvise'
     5         kx d_malloc_good_size='$d_malloc_good_size'
     5         kx d_malloc_size='$d_malloc_size'
     5         kx d_malloc_usable_size='$d_malloc_usable_size'
     5         kx d_mblen='$d_mblen'
     5         kx d_mbrlen='$d_mbrlen'
     5         kx d_mbrtowc='$d_mbrtowc'
     5         kx d_mbstowcs='$d_mbstowcs'
     5         kx d_mbtowc='$d_mbtowc'
     5         kx d_memmem='$d_memmem'
     5         kx d_memrchr='$d_memrchr'
     5         kx d_mkdir='$d_mkdir'
     5         kx d_mkdtemp='$d_mkdtemp'
     5         kx d_mkfifo='$d_mkfifo'
     5         kx d_mkostemp='$d_mkostemp'
     5         kx d_mkstemp='$d_mkstemp'
     5         kx d_mkstemps='$d_mkstemps'
     5         kx d_mktime64='$d_mktime64'
     5         kx d_mktime='$d_mktime'
     5         kx d_mmap='$d_mmap'
     5         kx d_modfl='$d_modfl'
     5         kx d_modflproto='$d_modflproto'
     5         kx d_mprotect='$d_mprotect'
     5         kx d_msg='$d_msg'
     5         kx d_msg_ctrunc='$d_msg_ctrunc'
     5         kx d_msg_dontroute='$d_msg_dontroute'
     5         kx d_msg_oob='$d_msg_oob'
     5         kx d_msg_peek='$d_msg_peek'
     5         kx d_msg_proxy='$d_msg_proxy'
     5         kx d_msgctl='$d_msgctl'
     5         kx d_msgget='$d_msgget'
     5         kx d_msghdr_s='$d_msghdr_s'
     5         kx d_msgrcv='$d_msgrcv'
     5         kx d_msgsnd='$d_msgsnd'
     5         kx d_msync='$d_msync'
     5         kx d_munmap='$d_munmap'
     5         kx d_mymalloc='$d_mymalloc'
     5         kx d_nan='$d_nan'
     5         kx d_nanosleep='$d_nanosleep'
     5         kx d_ndbm='$d_ndbm'
     5         kx d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
     5         kx d_nearbyint='$d_nearbyint'
     5         kx d_newlocale='$d_newlocale'
     5         kx d_nextafter='$d_nextafter'
     5         kx d_nexttoward='$d_nexttoward'
     5         kx d_nice='$d_nice'
     5         kx d_nl_langinfo='$d_nl_langinfo'
     5         kx d_nl_langinfo_l='$d_nl_langinfo_l'
     5         kx d_non_int_bitfields='$d_non_int_bitfields'
     5         kx d_nv_preserves_uv='$d_nv_preserves_uv'
     5         kx d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
     5         kx d_off64_t='$d_off64_t'
     5         kx d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
     5         kx d_oldpthreads='$d_oldpthreads'
     5         kx d_oldsock='$d_oldsock'
     5         kx d_open3='$d_open3'
     5         kx d_openat='$d_openat'
     5         kx d_pathconf='$d_pathconf'
     5         kx d_pause='$d_pause'
     5         kx d_perl_otherlibdirs='$d_perl_otherlibdirs'
     5         kx d_phostname='$d_phostname'
     5         kx d_pipe2='$d_pipe2'
     5         kx d_pipe='$d_pipe'
     5         kx d_poll='$d_poll'
     5         kx d_portable='$d_portable'
     5         kx d_prctl='$d_prctl'
     5         kx d_prctl_set_name='$d_prctl_set_name'
     5         kx d_printf_format_null='$d_printf_format_null'
     5         kx d_procselfexe='$d_procselfexe'
     5         kx d_pseudofork='$d_pseudofork'
     5         kx d_pthread_atfork='$d_pthread_atfork'
     5         kx d_pthread_attr_setscope='$d_pthread_attr_setscope'
     5         kx d_pthread_yield='$d_pthread_yield'
     5         kx d_ptrdiff_t='$d_ptrdiff_t'
     5         kx d_pwage='$d_pwage'
     5         kx d_pwchange='$d_pwchange'
     5         kx d_pwclass='$d_pwclass'
     5         kx d_pwcomment='$d_pwcomment'
     5         kx d_pwexpire='$d_pwexpire'
     5         kx d_pwgecos='$d_pwgecos'
     5         kx d_pwpasswd='$d_pwpasswd'
     5         kx d_pwquota='$d_pwquota'
     5         kx d_qgcvt='$d_qgcvt'
     5         kx d_quad='$d_quad'
     5         kx d_querylocale='$d_querylocale'
     5         kx d_random_r='$d_random_r'
     5         kx d_re_comp='$d_re_comp'
     5         kx d_readdir64_r='$d_readdir64_r'
     5         kx d_readdir='$d_readdir'
     5         kx d_readdir_r='$d_readdir_r'
     5         kx d_readlink='$d_readlink'
     5         kx d_readv='$d_readv'
     5         kx d_recvmsg='$d_recvmsg'
     5         kx d_regcmp='$d_regcmp'
     5         kx d_regcomp='$d_regcomp'
     5         kx d_remainder='$d_remainder'
     5         kx d_remquo='$d_remquo'
     5         kx d_rename='$d_rename'
     5         kx d_renameat='$d_renameat'
     5         kx d_rewinddir='$d_rewinddir'
     5         kx d_rint='$d_rint'
     5         kx d_rmdir='$d_rmdir'
     5         kx d_round='$d_round'
     5         kx d_sbrkproto='$d_sbrkproto'
     5         kx d_scalbn='$d_scalbn'
     5         kx d_scalbnl='$d_scalbnl'
     5         kx d_sched_yield='$d_sched_yield'
     5         kx d_scm_rights='$d_scm_rights'
     5         kx d_seekdir='$d_seekdir'
     5         kx d_select='$d_select'
     5         kx d_sem='$d_sem'
     5         kx d_semctl='$d_semctl'
     5         kx d_semctl_semid_ds='$d_semctl_semid_ds'
     5         kx d_semctl_semun='$d_semctl_semun'
     5         kx d_semget='$d_semget'
     5         kx d_semop='$d_semop'
     5         kx d_sendmsg='$d_sendmsg'
     5         kx d_setegid='$d_setegid'
     5         kx d_seteuid='$d_seteuid'
     5         kx d_setgrent='$d_setgrent'
     5         kx d_setgrent_r='$d_setgrent_r'
     5         kx d_setgrps='$d_setgrps'
     5         kx d_sethent='$d_sethent'
     5         kx d_sethostent_r='$d_sethostent_r'
     5         kx d_setitimer='$d_setitimer'
     5         kx d_setlinebuf='$d_setlinebuf'
     5         kx d_setlocale='$d_setlocale'
     5         kx d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
     5         kx d_setlocale_r='$d_setlocale_r'
     5         kx d_setnent='$d_setnent'
     5         kx d_setnetent_r='$d_setnetent_r'
     5         kx d_setpent='$d_setpent'
     5         kx d_setpgid='$d_setpgid'
     5         kx d_setpgrp2='$d_setpgrp2'
     5         kx d_setpgrp='$d_setpgrp'
     5         kx d_setprior='$d_setprior'
     5         kx d_setproctitle='$d_setproctitle'
     5         kx d_setprotoent_r='$d_setprotoent_r'
     5         kx d_setpwent='$d_setpwent'
     5         kx d_setpwent_r='$d_setpwent_r'
     5         kx d_setregid='$d_setregid'
     5         kx d_setresgid='$d_setresgid'
     5         kx d_setresuid='$d_setresuid'
     5         kx d_setreuid='$d_setreuid'
     5         kx d_setrgid='$d_setrgid'
     5         kx d_setruid='$d_setruid'
     5         kx d_setsent='$d_setsent'
     5         kx d_setservent_r='$d_setservent_r'
     5         kx d_setsid='$d_setsid'
     5         kx d_setvbuf='$d_setvbuf'
     5         kx d_shm='$d_shm'
     5         kx d_shmat='$d_shmat'
     5         kx d_shmatprototype='$d_shmatprototype'
     5         kx d_shmctl='$d_shmctl'
     5         kx d_shmdt='$d_shmdt'
     5         kx d_shmget='$d_shmget'
     5         kx d_sigaction='$d_sigaction'
     5         kx d_siginfo_si_addr='$d_siginfo_si_addr'
     5         kx d_siginfo_si_band='$d_siginfo_si_band'
     5         kx d_siginfo_si_errno='$d_siginfo_si_errno'
     5         kx d_siginfo_si_fd='$d_siginfo_si_fd'
     5         kx d_siginfo_si_pid='$d_siginfo_si_pid'
     5         kx d_siginfo_si_status='$d_siginfo_si_status'
     5         kx d_siginfo_si_uid='$d_siginfo_si_uid'
     5         kx d_siginfo_si_value='$d_siginfo_si_value'
     5         kx d_signbit='$d_signbit'
     5         kx d_sigprocmask='$d_sigprocmask'
     5         kx d_sigsetjmp='$d_sigsetjmp'
     5         kx d_sin6_scope_id='$d_sin6_scope_id'
     5         kx d_sitearch='$d_sitearch'
     5         kx d_snprintf='$d_snprintf'
     5         kx d_sockaddr_in6='$d_sockaddr_in6'
     5         kx d_sockaddr_sa_len='$d_sockaddr_sa_len'
     5         kx d_sockaddr_storage='$d_sockaddr_storage'
     5         kx d_sockatmark='$d_sockatmark'
     5         kx d_sockatmarkproto='$d_sockatmarkproto'
     5         kx d_socket='$d_socket'
     5         kx d_socklen_t='$d_socklen_t'
     5         kx d_sockpair='$d_sockpair'
     5         kx d_socks5_init='$d_socks5_init'
     5         kx d_sqrtl='$d_sqrtl'
     5         kx d_srand48_r='$d_srand48_r'
     5         kx d_srandom_r='$d_srandom_r'
     5         kx d_sresgproto='$d_sresgproto'
     5         kx d_sresuproto='$d_sresuproto'
     5         kx d_stat='$d_stat'
     5         kx d_statblks='$d_statblks'
     5         kx d_statfs_f_flags='$d_statfs_f_flags'
     5         kx d_statfs_s='$d_statfs_s'
     5         kx d_static_inline='$d_static_inline'
     5         kx d_statvfs='$d_statvfs'
     5         kx d_stdio_cnt_lval='$d_stdio_cnt_lval'
     5         kx d_stdio_ptr_lval='$d_stdio_ptr_lval'
     5         kx d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
     5         kx d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
     5         kx d_stdio_stream_array='$d_stdio_stream_array'
     5         kx d_stdiobase='$d_stdiobase'
     5         kx d_stdstdio='$d_stdstdio'
     5         kx d_strcoll='$d_strcoll'
     5         kx d_strerror_l='$d_strerror_l'
     5         kx d_strerror_r='$d_strerror_r'
     5         kx d_strftime='$d_strftime'
     5         kx d_strlcat='$d_strlcat'
     5         kx d_strlcpy='$d_strlcpy'
     5         kx d_strnlen='$d_strnlen'
     5         kx d_strtod='$d_strtod'
     5         kx d_strtod_l='$d_strtod_l'
     5         kx d_strtol='$d_strtol'
     5         kx d_strtold='$d_strtold'
     5         kx d_strtold_l='$d_strtold_l'
     5         kx d_strtoll='$d_strtoll'
     5         kx d_strtoq='$d_strtoq'
     5         kx d_strtoul='$d_strtoul'
     5         kx d_strtoull='$d_strtoull'
     5         kx d_strtouq='$d_strtouq'
     5         kx d_strxfrm='$d_strxfrm'
     5         kx d_strxfrm_l='$d_strxfrm_l'
     5         kx d_suidsafe='$d_suidsafe'
     5         kx d_symlink='$d_symlink'
     5         kx d_syscall='$d_syscall'
     5         kx d_syscallproto='$d_syscallproto'
     5         kx d_sysconf='$d_sysconf'
     5         kx d_sysernlst='$d_sysernlst'
     5         kx d_syserrlst='$d_syserrlst'
     5         kx d_system='$d_system'
     5         kx d_tcgetpgrp='$d_tcgetpgrp'
     5         kx d_tcsetpgrp='$d_tcsetpgrp'
     5         kx d_telldir='$d_telldir'
     5         kx d_telldirproto='$d_telldirproto'
     5         kx d_tgamma='$d_tgamma'
     5         kx d_thread_local='$d_thread_local'
     5         kx d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
     5         kx d_time='$d_time'
     5         kx d_timegm='$d_timegm'
     5         kx d_times='$d_times'
     5         kx d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
     5         kx d_tm_tm_zone='$d_tm_tm_zone'
     5         kx d_tmpnam_r='$d_tmpnam_r'
     5         kx d_towlower='$d_towlower'
     5         kx d_towupper='$d_towupper'
     5         kx d_trunc='$d_trunc'
     5         kx d_truncate='$d_truncate'
     5         kx d_truncl='$d_truncl'
     5         kx d_ttyname_r='$d_ttyname_r'
     5         kx d_tzname='$d_tzname'
     5         kx d_u32align='$d_u32align'
     5         kx d_ualarm='$d_ualarm'
     5         kx d_umask='$d_umask'
     5         kx d_uname='$d_uname'
     5         kx d_union_semun='$d_union_semun'
     5         kx d_unlinkat='$d_unlinkat'
     5         kx d_unordered='$d_unordered'
     5         kx d_unsetenv='$d_unsetenv'
     5         kx d_uselocale='$d_uselocale'
     5         kx d_usleep='$d_usleep'
     5         kx d_usleepproto='$d_usleepproto'
     5         kx d_ustat='$d_ustat'
     5         kx d_vendorarch='$d_vendorarch'
     5         kx d_vendorbin='$d_vendorbin'
     5         kx d_vendorlib='$d_vendorlib'
     5         kx d_vendorscript='$d_vendorscript'
     5         kx d_vfork='$d_vfork'
     5         kx d_void_closedir='$d_void_closedir'
     5         kx d_voidsig='$d_voidsig'
     5         kx d_voidtty='$d_voidtty'
     5         kx d_vsnprintf='$d_vsnprintf'
     5         kx d_wait4='$d_wait4'
     5         kx d_waitpid='$d_waitpid'
     5         kx d_wcrtomb='$d_wcrtomb'
     5         kx d_wcscmp='$d_wcscmp'
     5         kx d_wcstombs='$d_wcstombs'
     5         kx d_wcsxfrm='$d_wcsxfrm'
     5         kx d_wctomb='$d_wctomb'
     5         kx d_writev='$d_writev'
     5         kx d_xenix='$d_xenix'
     5         kx date='$date'
     5         kx db_hashtype='$db_hashtype'
     5         kx db_prefixtype='$db_prefixtype'
     5         kx db_version_major='$db_version_major'
     5         kx db_version_minor='$db_version_minor'
     5         kx db_version_patch='$db_version_patch'
     5         kx default_inc_excludes_dot='$default_inc_excludes_dot'
     5         kx direntrytype='$direntrytype'
     5         kx dlext='$dlext'
     5         kx dlsrc='$dlsrc'
     5         kx doubleinfbytes='$doubleinfbytes'
     5         kx doublekind='$doublekind'
     5         kx doublemantbits='$doublemantbits'
     5         kx doublenanbytes='$doublenanbytes'
     5         kx doublesize='$doublesize'
     5         kx drand01='$drand01'
     5         kx drand48_r_proto='$drand48_r_proto'
     5         kx dtrace='$dtrace'
     5         kx dtraceobject='$dtraceobject'
     5         kx dtracexnolibs='$dtracexnolibs'
     5         kx dynamic_ext='$dynamic_ext'
     5         kx eagain='$eagain'
     5         kx ebcdic='$ebcdic'
     5         kx echo='$echo'
     5         kx egrep='$egrep'
     5         kx emacs='$emacs'
     5         kx endgrent_r_proto='$endgrent_r_proto'
     5         kx endhostent_r_proto='$endhostent_r_proto'
     5         kx endnetent_r_proto='$endnetent_r_proto'
     5         kx endprotoent_r_proto='$endprotoent_r_proto'
     5         kx endpwent_r_proto='$endpwent_r_proto'
     5         kx endservent_r_proto='$endservent_r_proto'
     5         kx eunicefix='$eunicefix'
     5         kx exe_ext='$exe_ext'
     5         kx expr='$expr'
     5         kx extensions='$extensions'
     5         kx extern_C='$extern_C'
     5         kx extras='$extras'
     5         kx fflushNULL='$fflushNULL'
     5         kx fflushall='$fflushall'
     5         kx find='$find'
     5         kx firstmakefile='$firstmakefile'
     5         kx flex='$flex'
     5         kx fpossize='$fpossize'
     5         kx fpostype='$fpostype'
     5         kx freetype='$freetype'
     5         kx from='$from'
     5         kx full_ar='$full_ar'
     5         kx full_csh='$full_csh'
     5         kx full_sed='$full_sed'
     5         kx gccansipedantic='$gccansipedantic'
     5         kx gccosandvers='$gccosandvers'
     5         kx gccversion='$gccversion'
     5         kx getgrent_r_proto='$getgrent_r_proto'
     5         kx getgrgid_r_proto='$getgrgid_r_proto'
     5         kx getgrnam_r_proto='$getgrnam_r_proto'
     5         kx gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
     5         kx gethostbyname_r_proto='$gethostbyname_r_proto'
     5         kx gethostent_r_proto='$gethostent_r_proto'
     5         kx getlogin_r_proto='$getlogin_r_proto'
     5         kx getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
     5         kx getnetbyname_r_proto='$getnetbyname_r_proto'
     5         kx getnetent_r_proto='$getnetent_r_proto'
     5         kx getprotobyname_r_proto='$getprotobyname_r_proto'
     5         kx getprotobynumber_r_proto='$getprotobynumber_r_proto'
     5         kx getprotoent_r_proto='$getprotoent_r_proto'
     5         kx getpwent_r_proto='$getpwent_r_proto'
     5         kx getpwnam_r_proto='$getpwnam_r_proto'
     5         kx getpwuid_r_proto='$getpwuid_r_proto'
     5         kx getservbyname_r_proto='$getservbyname_r_proto'
     5         kx getservbyport_r_proto='$getservbyport_r_proto'
     5         kx getservent_r_proto='$getservent_r_proto'
     5         kx getspnam_r_proto='$getspnam_r_proto'
     5         kx gidformat='$gidformat'
     5         kx gidsign='$gidsign'
     5         kx gidsize='$gidsize'
     5         kx gidtype='$gidtype'
     5         kx glibpth='$glibpth'
     5         kx gmake='$gmake'
     5         kx gmtime_r_proto='$gmtime_r_proto'
     5         kx gnulibc_version='$gnulibc_version'
     5         kx grep='$grep'
     5         kx groupcat='$groupcat'
     5         kx groupstype='$groupstype'
     5         kx gzip='$gzip'
     5         kx h_fcntl='$h_fcntl'
     5         kx h_sysfile='$h_sysfile'
     5         kx hint='$hint'
     5         kx hostcat='$hostcat'
     5         kx hostgenerate='$hostgenerate'
     5         kx hostosname='$hostosname'
     5         kx hostperl='$hostperl'
     5         kx html1dir='$html1dir'
     5         kx html1direxp='$html1direxp'
     5         kx html3dir='$html3dir'
     5         kx html3direxp='$html3direxp'
     5         kx i16size='$i16size'
     5         kx i16type='$i16type'
     5         kx i32size='$i32size'
     5         kx i32type='$i32type'
     5         kx i64size='$i64size'
     5         kx i64type='$i64type'
     5         kx i8size='$i8size'
     5         kx i8type='$i8type'
     5         kx i_arpainet='$i_arpainet'
     5         kx i_bfd='$i_bfd'
     5         kx i_bsdioctl='$i_bsdioctl'
     5         kx i_crypt='$i_crypt'
     5         kx i_db='$i_db'
     5         kx i_dbm='$i_dbm'
     5         kx i_dirent='$i_dirent'
     5         kx i_dlfcn='$i_dlfcn'
     5         kx i_execinfo='$i_execinfo'
     5         kx i_fcntl='$i_fcntl'
     5         kx i_fenv='$i_fenv'
     5         kx i_fp='$i_fp'
     5         kx i_fp_class='$i_fp_class'
     5         kx i_gdbm='$i_gdbm'
     5         kx i_gdbm_ndbm='$i_gdbm_ndbm'
     5         kx i_gdbmndbm='$i_gdbmndbm'
     5         kx i_grp='$i_grp'
     5         kx i_ieeefp='$i_ieeefp'
     5         kx i_inttypes='$i_inttypes'
     5         kx i_langinfo='$i_langinfo'
     5         kx i_libutil='$i_libutil'
     5         kx i_locale='$i_locale'
     5         kx i_machcthr='$i_machcthr'
     5         kx i_malloc='$i_malloc'
     5         kx i_mallocmalloc='$i_mallocmalloc'
     5         kx i_mntent='$i_mntent'
     5         kx i_ndbm='$i_ndbm'
     5         kx i_netdb='$i_netdb'
     5         kx i_neterrno='$i_neterrno'
     5         kx i_netinettcp='$i_netinettcp'
     5         kx i_niin='$i_niin'
     5         kx i_poll='$i_poll'
     5         kx i_prot='$i_prot'
     5         kx i_pthread='$i_pthread'
     5         kx i_pwd='$i_pwd'
     5         kx i_quadmath='$i_quadmath'
     5         kx i_rpcsvcdbm='$i_rpcsvcdbm'
     5         kx i_sgtty='$i_sgtty'
     5         kx i_shadow='$i_shadow'
     5         kx i_socks='$i_socks'
     5         kx i_stdbool='$i_stdbool'
     5         kx i_stdint='$i_stdint'
     5         kx i_stdlib='$i_stdlib'
     5         kx i_sunmath='$i_sunmath'
     5         kx i_sysaccess='$i_sysaccess'
     5         kx i_sysdir='$i_sysdir'
     5         kx i_sysfile='$i_sysfile'
     5         kx i_sysfilio='$i_sysfilio'
     5         kx i_sysin='$i_sysin'
     5         kx i_sysioctl='$i_sysioctl'
     5         kx i_syslog='$i_syslog'
     5         kx i_sysmman='$i_sysmman'
     5         kx i_sysmode='$i_sysmode'
     5         kx i_sysmount='$i_sysmount'
     5         kx i_sysndir='$i_sysndir'
     5         kx i_sysparam='$i_sysparam'
     5         kx i_syspoll='$i_syspoll'
     5         kx i_sysresrc='$i_sysresrc'
     5         kx i_syssecrt='$i_syssecrt'
     5         kx i_sysselct='$i_sysselct'
     5         kx i_syssockio='$i_syssockio'
     5         kx i_sysstat='$i_sysstat'
     5         kx i_sysstatfs='$i_sysstatfs'
     5         kx i_sysstatvfs='$i_sysstatvfs'
     5         kx i_systime='$i_systime'
     5         kx i_systimek='$i_systimek'
     5         kx i_systimes='$i_systimes'
     5         kx i_systypes='$i_systypes'
     5         kx i_sysuio='$i_sysuio'
     5         kx i_sysun='$i_sysun'
     5         kx i_sysutsname='$i_sysutsname'
     5         kx i_sysvfs='$i_sysvfs'
     5         kx i_syswait='$i_syswait'
     5         kx i_termio='$i_termio'
     5         kx i_termios='$i_termios'
     5         kx i_time='$i_time'
     5         kx i_unistd='$i_unistd'
     5         kx i_ustat='$i_ustat'
     5         kx i_utime='$i_utime'
     5         kx i_vfork='$i_vfork'
     5         kx i_wchar='$i_wchar'
     5         kx i_wctype='$i_wctype'
     5         kx i_xlocale='$i_xlocale'
     5         kx ignore_versioned_solibs='$ignore_versioned_solibs'
     5         kx inc_version_list='$inc_version_list'
     5         kx inc_version_list_init='$inc_version_list_init'
     5         kx incpath='$incpath'
     5         kx incpth='$incpth'
     5         kx inews='$inews'
     5         kx initialinstalllocation='$initialinstalllocation'
     5         kx installarchlib='$installarchlib'
     5         kx installbin='$installbin'
     5         kx installhtml1dir='$installhtml1dir'
     5         kx installhtml3dir='$installhtml3dir'
     5         kx installman1dir='$installman1dir'
     5         kx installman3dir='$installman3dir'
     5         kx installprefix='$installprefix'
     5         kx installprefixexp='$installprefixexp'
     5         kx installprivlib='$installprivlib'
     5         kx installscript='$installscript'
     5         kx installsitearch='$installsitearch'
     5         kx installsitebin='$installsitebin'
     5         kx installsitehtml1dir='$installsitehtml1dir'
     5         kx installsitehtml3dir='$installsitehtml3dir'
     5         kx installsitelib='$installsitelib'
     5         kx installsiteman1dir='$installsiteman1dir'
     5         kx installsiteman3dir='$installsiteman3dir'
     5         kx installsitescript='$installsitescript'
     5         kx installstyle='$installstyle'
     5         kx installusrbinperl='$installusrbinperl'
     5         kx installvendorarch='$installvendorarch'
     5         kx installvendorbin='$installvendorbin'
     5         kx installvendorhtml1dir='$installvendorhtml1dir'
     5         kx installvendorhtml3dir='$installvendorhtml3dir'
     5         kx installvendorlib='$installvendorlib'
     5         kx installvendorman1dir='$installvendorman1dir'
     5         kx installvendorman3dir='$installvendorman3dir'
     5         kx installvendorscript='$installvendorscript'
     5         kx intsize='$intsize'
     5         kx issymlink='$issymlink'
     5         kx ivdformat='$ivdformat'
     5         kx ivsize='$ivsize'
     5         kx ivtype='$ivtype'
     5         kx known_extensions='$known_extensions'
     5         kx ksh='$ksh'
     5         kx ld='$ld'
     5         kx ld_can_script='$ld_can_script'
     5         kx lddlflags='$lddlflags'
     5         kx ldflags='$ldflags'
     5         kx ldflags_uselargefiles='$ldflags_uselargefiles'
     5         kx ldlibpthname='$ldlibpthname'
     5         kx less='$less'
     5         kx lib_ext='$lib_ext'
     5         kx libc='$libc'
     5         kx libperl='$libperl'
     5         kx libpth='$libpth'
     5         kx libs='$libs'
     5         kx libsdirs='$libsdirs'
     5         kx libsfiles='$libsfiles'
     5         kx libsfound='$libsfound'
     5         kx libspath='$libspath'
     5         kx libswanted='$libswanted'
     5         kx libswanted_uselargefiles='$libswanted_uselargefiles'
     5         kx line='$line'
     5         kx lint='$lint'
     5         kx lkflags='$lkflags'
     5         kx ln='$ln'
     5         kx lns='$lns'
     5         kx localtime_r_proto='$localtime_r_proto'
     5         kx locincpth='$locincpth'
     5         kx loclibpth='$loclibpth'
     5         kx longdblinfbytes='$longdblinfbytes'
     5         kx longdblkind='$longdblkind'
     5         kx longdblmantbits='$longdblmantbits'
     5         kx longdblnanbytes='$longdblnanbytes'
     5         kx longdblsize='$longdblsize'
     5         kx longlongsize='$longlongsize'
     5         kx longsize='$longsize'
     5         kx lp='$lp'
     5         kx lpr='$lpr'
     5         kx ls='$ls'
     5         kx lseeksize='$lseeksize'
     5         kx lseektype='$lseektype'
     5         kx mail='$mail'
     5         kx mailx='$mailx'
     5         kx make='$make'
     5         kx make_set_make='$make_set_make'
     5         kx mallocobj='$mallocobj'
     5         kx mallocsrc='$mallocsrc'
     5         kx malloctype='$malloctype'
     5         kx man1dir='$man1dir'
     5         kx man1direxp='$man1direxp'
     5         kx man1ext='$man1ext'
     5         kx man3dir='$man3dir'
     5         kx man3direxp='$man3direxp'
     5         kx man3ext='$man3ext'
     5         kx mips_type='$mips_type'
     5         kx mistrustnm='$mistrustnm'
     5         kx mkdir='$mkdir'
     5         kx mmaptype='$mmaptype'
     5         kx modetype='$modetype'
     5         kx more='$more'
     5         kx multiarch='$multiarch'
     5         kx mv='$mv'
     5         kx myarchname='$myarchname'
     5         kx mydomain='$mydomain'
     5         kx myhostname='$myhostname'
     5         kx myuname='$myuname'
     5         kx n='$n'
     5         kx need_va_copy='$need_va_copy'
     5         kx netdb_hlen_type='$netdb_hlen_type'
     5         kx netdb_host_type='$netdb_host_type'
     5         kx netdb_name_type='$netdb_name_type'
     5         kx netdb_net_type='$netdb_net_type'
     5         kx nm='$nm'
     5         kx nm_opt='$nm_opt'
     5         kx nm_so_opt='$nm_so_opt'
     5         kx nonxs_ext='$nonxs_ext'
     5         kx nroff='$nroff'
     5         kx nvEUformat='$nvEUformat'
     5         kx nvFUformat='$nvFUformat'
     5         kx nvGUformat='$nvGUformat'
     5         kx nv_overflows_integers_at='$nv_overflows_integers_at'
     5         kx nv_preserves_uv_bits='$nv_preserves_uv_bits'
     5         kx nveformat='$nveformat'
     5         kx nvfformat='$nvfformat'
     5         kx nvgformat='$nvgformat'
     5         kx nvmantbits='$nvmantbits'
     5         kx nvsize='$nvsize'
     5         kx nvtype='$nvtype'
     5         kx o_nonblock='$o_nonblock'
     5         kx obj_ext='$obj_ext'
     5         kx old_pthread_create_joinable='$old_pthread_create_joinable'
     5         kx optimize='$optimize'
     5         kx orderlib='$orderlib'
     5         kx osname='$osname'
     5         kx osvers='$osvers'
     5         kx otherlibdirs='$otherlibdirs'
     5         kx package='$package'
     5         kx pager='$pager'
     5         kx passcat='$passcat'
     5         kx patchlevel='$patchlevel'
     5         kx path_sep='$path_sep'
     5         kx perl5='$perl5'
     5         kx perl='$perl'
     5         kx perl_patchlevel='$perl_patchlevel'
     5         kx perl_static_inline='$perl_static_inline'
     5         kx perl_thread_local='$perl_thread_local'
     5         kx perladmin='$perladmin'
     5         kx perllibs='$perllibs'
     5         kx perlpath='$perlpath'
     5         kx pg='$pg'
     5         kx phostname='$phostname'
     5         kx pidtype='$pidtype'
     5         kx plibpth='$plibpth'
     5         kx pmake='$pmake'
     5         kx pr='$pr'
     5         kx prefix='$prefix'
     5         kx prefixexp='$prefixexp'
     5         kx privlib='$privlib'
     5         kx privlibexp='$privlibexp'
     5         kx procselfexe='$procselfexe'
     5         kx ptrsize='$ptrsize'
     5         kx quadkind='$quadkind'
     5         kx quadtype='$quadtype'
     5         kx randbits='$randbits'
     5         kx randfunc='$randfunc'
     5         kx random_r_proto='$random_r_proto'
     5         kx randseedtype='$randseedtype'
     5         kx ranlib='$ranlib'
     5         kx rd_nodata='$rd_nodata'
     5         kx readdir64_r_proto='$readdir64_r_proto'
     5         kx readdir_r_proto='$readdir_r_proto'
     5         kx revision='$revision'
     5         kx rm='$rm'
     5         kx rm_try='$rm_try'
     5         kx rmail='$rmail'
     5         kx run='$run'
     5         kx runnm='$runnm'
     5         kx sGMTIME_max='$sGMTIME_max'
     5         kx sGMTIME_min='$sGMTIME_min'
     5         kx sLOCALTIME_max='$sLOCALTIME_max'
     5         kx sLOCALTIME_min='$sLOCALTIME_min'
     5         kx sPRIEUldbl='$sPRIEUldbl'
     5         kx sPRIFUldbl='$sPRIFUldbl'
     5         kx sPRIGUldbl='$sPRIGUldbl'
     5         kx sPRIXU64='$sPRIXU64'
     5         kx sPRId64='$sPRId64'
     5         kx sPRIeldbl='$sPRIeldbl'
     5         kx sPRIfldbl='$sPRIfldbl'
     5         kx sPRIgldbl='$sPRIgldbl'
     5         kx sPRIi64='$sPRIi64'
     5         kx sPRIo64='$sPRIo64'
     5         kx sPRIu64='$sPRIu64'
     5         kx sPRIx64='$sPRIx64'
     5         kx sSCNfldbl='$sSCNfldbl'
     5         kx sched_yield='$sched_yield'
     5         kx scriptdir='$scriptdir'
     5         kx scriptdirexp='$scriptdirexp'
     5         kx sed='$sed'
     5         kx seedfunc='$seedfunc'
     5         kx selectminbits='$selectminbits'
     5         kx selecttype='$selecttype'
     5         kx sendmail='$sendmail'
     5         kx setgrent_r_proto='$setgrent_r_proto'
     5         kx sethostent_r_proto='$sethostent_r_proto'
     5         kx setlocale_r_proto='$setlocale_r_proto'
     5         kx setnetent_r_proto='$setnetent_r_proto'
     5         kx setprotoent_r_proto='$setprotoent_r_proto'
     5         kx setpwent_r_proto='$setpwent_r_proto'
     5         kx setservent_r_proto='$setservent_r_proto'
     5         kx sh='$sh'
     5         kx shar='$shar'
     5         kx sharpbang='$sharpbang'
     5         kx shmattype='$shmattype'
     5         kx shortsize='$shortsize'
     5         kx shrpenv='$shrpenv'
     5         kx shsharp='$shsharp'
     5         kx sig_count='$sig_count'
     5         kx sig_name='$sig_name'
     5         kx sig_name_init='$sig_name_init'
     5         kx sig_num='$sig_num'
     5         kx sig_num_init='$sig_num_init'
     5         kx sig_size='$sig_size'
     5         kx signal_t='$signal_t'
     5         kx sitearch='$sitearch'
     5         kx sitearchexp='$sitearchexp'
     5         kx sitebin='$sitebin'
     5         kx sitebinexp='$sitebinexp'
     5         kx sitehtml1dir='$sitehtml1dir'
     5         kx sitehtml1direxp='$sitehtml1direxp'
     5         kx sitehtml3dir='$sitehtml3dir'
     5         kx sitehtml3direxp='$sitehtml3direxp'
     5         kx sitelib='$sitelib'
     5         kx sitelib_stem='$sitelib_stem'
     5         kx sitelibexp='$sitelibexp'
     5         kx siteman1dir='$siteman1dir'
     5         kx siteman1direxp='$siteman1direxp'
     5         kx siteman3dir='$siteman3dir'
     5         kx siteman3direxp='$siteman3direxp'
     5         kx siteprefix='$siteprefix'
     5         kx siteprefixexp='$siteprefixexp'
     5         kx sitescript='$sitescript'
     5         kx sitescriptexp='$sitescriptexp'
     5         kx sizesize='$sizesize'
     5         kx sizetype='$sizetype'
     5         kx sleep='$sleep'
     5         kx smail='$smail'
     5         kx so='$so'
     5         kx sockethdr='$sockethdr'
     5         kx socketlib='$socketlib'
     5         kx socksizetype='$socksizetype'
     5         kx sort='$sort'
     5         kx spackage='$spackage'
     5         kx spitshell='$spitshell'
     5         kx srand48_r_proto='$srand48_r_proto'
     5         kx srandom_r_proto='$srandom_r_proto'
     5         kx src='$src'
     5         kx ssizetype='$ssizetype'
     5         kx st_dev_sign='$st_dev_sign'
     5         kx st_dev_size='$st_dev_size'
     5         kx st_ino_sign='$st_ino_sign'
     5         kx st_ino_size='$st_ino_size'
     5         kx startperl='$startperl'
     5         kx startsh='$startsh'
     5         kx static_ext='$static_ext'
     5         kx stdchar='$stdchar'
     5         kx stdio_base='$stdio_base'
     5         kx stdio_bufsiz='$stdio_bufsiz'
     5         kx stdio_cnt='$stdio_cnt'
     5         kx stdio_filbuf='$stdio_filbuf'
     5         kx stdio_ptr='$stdio_ptr'
     5         kx stdio_stream_array='$stdio_stream_array'
     5         kx strerror_r_proto='$strerror_r_proto'
     5         kx submit='$submit'
     5         kx subversion='$subversion'
     5         kx sysman='$sysman'
     5         kx sysroot='$sysroot'
     5         kx tail='$tail'
     5         kx tar='$tar'
     5         kx targetarch='$targetarch'
     5         kx targetdir='$targetdir'
     5         kx targetenv='$targetenv'
     5         kx targethost='$targethost'
     5         kx targetmkdir='$targetmkdir'
     5         kx targetport='$targetport'
     5         kx targetsh='$targetsh'
     5         kx tbl='$tbl'
     5         kx tee='$tee'
     5         kx test='$test'
     5         kx timeincl='$timeincl'
     5         kx timetype='$timetype'
     5         kx tmpnam_r_proto='$tmpnam_r_proto'
     5         kx to='$to'
     5         kx touch='$touch'
     5         kx tr='$tr'
     5         kx trnl='$trnl'
     5         kx troff='$troff'
     5         kx ttyname_r_proto='$ttyname_r_proto'
     5         kx u16size='$u16size'
     5         kx u16type='$u16type'
     5         kx u32size='$u32size'
     5         kx u32type='$u32type'
     5         kx u64size='$u64size'
     5         kx u64type='$u64type'
     5         kx u8size='$u8size'
     5         kx u8type='$u8type'
     5         kx uidformat='$uidformat'
     5         kx uidsign='$uidsign'
     5         kx uidsize='$uidsize'
     5         kx uidtype='$uidtype'
     5         kx uname='$uname'
     5         kx uniq='$uniq'
     5         kx uquadtype='$uquadtype'
     5         kx use64bitall='$use64bitall'
     5         kx use64bitint='$use64bitint'
     5         kx usecbacktrace='$usecbacktrace'
     5         kx usecrosscompile='$usecrosscompile'
     5         kx usedefaultstrict='$usedefaultstrict'
     5         kx usedevel='$usedevel'
     5         kx usedl='$usedl'
     5         kx usedtrace='$usedtrace'
     5         kx usefaststdio='$usefaststdio'
     5         kx useithreads='$useithreads'
     5         kx usekernprocpathname='$usekernprocpathname'
     5         kx uselanginfo='$uselanginfo'
     5         kx uselargefiles='$uselargefiles'
     5         kx uselongdouble='$uselongdouble'
     5         kx usemallocwrap='$usemallocwrap'
     5         kx usemorebits='$usemorebits'
     5         kx usemultiplicity='$usemultiplicity'
     5         kx usemymalloc='$usemymalloc'
     5         kx usenm='$usenm'
     5         kx usensgetexecutablepath='$usensgetexecutablepath'
     5         kx useopcode='$useopcode'
     5         kx useperlio='$useperlio'
     5         kx useposix='$useposix'
     5         kx usequadmath='$usequadmath'
     5         kx usereentrant='$usereentrant'
     5         kx userelocatableinc='$userelocatableinc'
     5         kx useshrplib='$useshrplib'
     5         kx usesitecustomize='$usesitecustomize'
     5         kx usesocks='$usesocks'
     5         kx usethreads='$usethreads'
     5         kx usevendorprefix='$usevendorprefix'
     5         kx useversionedarchname='$useversionedarchname'
     5         kx usevfork='$usevfork'
     5         kx usrinc='$usrinc'
     5         kx uuname='$uuname'
     5         kx uvXUformat='$uvXUformat'
     5         kx uvoformat='$uvoformat'
     5         kx uvsize='$uvsize'
     5         kx uvtype='$uvtype'
     5         kx uvuformat='$uvuformat'
     5         kx uvxformat='$uvxformat'
     5         kx vendorarch='$vendorarch'
     5         kx vendorarchexp='$vendorarchexp'
     5         kx vendorbin='$vendorbin'
     5         kx vendorbinexp='$vendorbinexp'
     5         kx vendorhtml1dir='$vendorhtml1dir'
     5         kx vendorhtml1direxp='$vendorhtml1direxp'
     5         kx vendorhtml3dir='$vendorhtml3dir'
     5         kx vendorhtml3direxp='$vendorhtml3direxp'
     5         kx vendorlib='$vendorlib'
     5         kx vendorlib_stem='$vendorlib_stem'
     5         kx vendorlibexp='$vendorlibexp'
     5         kx vendorman1dir='$vendorman1dir'
     5         kx vendorman1direxp='$vendorman1direxp'
     5         kx vendorman3dir='$vendorman3dir'
     5         kx vendorman3direxp='$vendorman3direxp'
     5         kx vendorprefix='$vendorprefix'
     5         kx vendorprefixexp='$vendorprefixexp'
     5         kx vendorscript='$vendorscript'
     5         kx vendorscriptexp='$vendorscriptexp'
     5         kx version='$version'
     5         kx version_patchlevel_string='$version_patchlevel_string'
     5         kx versiononly='$versiononly'
     5         kx vi='$vi'
     5         kx xlibpth='$xlibpth'
     5         kx xlocale_needed='$xlocale_needed'
     5         kx yacc='$yacc'
     5         kx yaccflags='$yaccflags'
     5         kx zcat='$zcat'
     5         kx zip='$zip'
     5         kx EOT
     5         kx 
     5         kx : add special variables
     5         kx $test -f $src/patchlevel.h && \
     5         kx awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
     5         kx echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
     5         kx echo "PERL_CONFIG_SH=true" >>config.sh
     5         kx 
     5         kx : propagate old symbols
     5         kx if $test -f UU/config.sh; then
     5         kx 	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
     5         kx 	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
     5         kx 		config.sh config.sh UU/oldconfig.sh |\
     5         kx 		$sort | $uniq -u >UU/oldsyms
     5         kx 	set X `$cat UU/oldsyms`
     5         kx 	shift
     5         kx 	case $# in
     5         kx 	0) ;;
     5         kx 	*)
     5         kx 		$cat <<EOM
     5         kx Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
     5         kx EOM
     5         kx 		echo ": Variables propagated from previous config.sh file." >>config.sh
     5         kx 		for sym in `$cat UU/oldsyms`; do
     5         kx 			echo "    Propagating $hint variable "'$'"$sym..."
     5         kx 			eval 'tmp="$'"${sym}"'"'
     5         kx 			echo "$tmp" | \
     5         kx 				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
     5         kx 		done
     5         kx 		;;
     5         kx 	esac
     5         kx fi
     5         kx 
     5         kx : preserve RCS keywords in files with variable substitution, grrr
     5         kx Id='$Id'
     5         kx 
     5         kx : Finish up by extracting the .SH files
     5         kx case "$alldone" in
     5         kx exit)
     5         kx 	echo "Stopping at your request, leaving temporary files around."
     5         kx 	exit 0
     5         kx 	;;
     5         kx cont)
     5         kx 	;;
     5         kx '')
     5         kx 	dflt=''
     5         kx 	nostick=true
     5         kx 	$cat <<EOM
     5         kx 
     5         kx If you'd like to make any changes to the config.sh file before I begin
     5         kx to configure things, do it as a shell escape now (e.g. !vi config.sh).
     5         kx 
     5         kx EOM
     5         kx 	rp="Press return or use a shell escape to edit config.sh:"
     5         kx 	. UU/myread
     5         kx 	nostick=''
     5         kx 	case "$ans" in
     5         kx 	'') ;;
     5         kx 	*) : in case they cannot read
     5         kx 		sh 1>&4 -c "$ans";;
     5         kx 	esac
     5         kx 	;;
     5         kx esac
     5         kx 
     5         kx : if this fails, just run all the .SH files by hand
     5         kx . ./config.sh
     5         kx 
     5         kx echo " "
     5         kx exec 1>&4
     5         kx pwd=`pwd`
     5         kx . ./UU/extract
     5         kx cd "$pwd"
     5         kx 
     5         kx if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
     5         kx 	dflt=y
     5         kx 	case "$silent" in
     5         kx 	true) ;;
     5         kx 	*)
     5         kx 		$cat <<EOM
     5         kx 
     5         kx Now you need to generate make dependencies by running "$make depend".
     5         kx You might prefer to run it in background: "$make depend > makedepend.out &"
     5         kx It can take a while, so you might not want to run it right now.
     5         kx 
     5         kx EOM
     5         kx 		;;
     5         kx 	esac
     5         kx 	rp="Run $make depend now?"
     5         kx 	. UU/myread
     5         kx 	case "$ans" in
     5         kx 	y*)
     5         kx 		$make depend && echo "Now you must run '$make'."
     5         kx 		;;
     5         kx 	*)
     5         kx 		echo "You must run '$make depend' then '$make'."
     5         kx 		;;
     5         kx 	esac
     5         kx elif test -f [Mm]akefile; then
     5         kx 	echo " "
     5         kx 	echo "Now you must run a $make."
     5         kx else
     5         kx 	echo "Configure done."
     5         kx fi
     5         kx 
     5         kx if $test -f Policy.sh; then
     5         kx     $cat <<EOM
     5         kx 
     5         kx If you compile $package on a different machine or from a different object
     5         kx directory, copy the Policy.sh file from this object directory to the
     5         kx new one before you run Configure -- this will help you with most of
     5         kx the policy defaults.
     5         kx 
     5         kx EOM
     5         kx fi
     5         kx if $test -f UU/config.msg; then
     5         kx     echo "Hmm.  I also noted the following information while running:"
     5         kx     echo " "
     5         kx     $cat UU/config.msg >&4
     5         kx fi
     5         kx $rm -f kit*isdone ark*isdone
     5         kx $rm -rf UU
     5         kx 
     5         kx : End of Configure
     5         kx