xref: /openbsd-src/gnu/usr.bin/perl/Configure (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist package (which contains metaconfig) is available via SVN:
17#     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18#
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
22# For more information on patching Configure, see pod/perlhack.pod
23#
24# The metaunits are also available from the public git repository:
25#     http://perl5.git.perl.org/metaconfig.git/ or
26#     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27#
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
30
31# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32#
33# Generated on Wed Jun 23 16:03:55 CEST 2010 [metaconfig 3.5 PL0]
34# (with additional metaconfig patches by perlbug@perl.org)
35
36cat >c1$$ <<EOF
37ARGGGHHHH!!!!!
38
39SCO csh still thinks true is false.  Write to SCO today and tell them that next
40year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45[End of diatribe. We now return you to your regularly scheduled programming...]
46EOF
47cat >c2$$ <<EOF
48
49OOPS!  You naughty creature!  You didn't run Configure with sh!
50I will attempt to remedy the situation by running sh for you...
51EOF
52
53true || cat c1$$ c2$$
54true || exec sh $0 $argv:q
55
56(exit $?0) || cat c2$$
57(exit $?0) || exec sh $0 $argv:q
58rm -f c1$$ c2$$
59
60if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61	cat <<EOF
62***
63*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65*** Please read the README.plan9 for further instructions.
66*** Cannot continue, aborting.
67***
68EOF
69	exit 1
70fi
71
72if test ! -c /dev/null ; then
73	cat <<EOF
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81	exit 1
82fi
83
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89	test "$me" || me=$0
90	;;
91esac
92
93: Proper separator for the PATH environment variable
94p_=:
95: On OS/2 this directory should exist if this is not floppy only system ":-]"
96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97	if test -n "$OS2_SHELL"; then
98		p_=\;
99		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101		is_os2=yes
102	elif test -n "$DJGPP"; then
103		case "X${MACHTYPE:-nonesuchmach}" in
104		*cygwin) ;;
105		*) p_=\; ;;
106		esac
107	fi
108fi
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
119paths="$paths /system/gnu_library/bin"
120
121for p in $paths
122do
123	case "$p_$PATH$p_" in
124	*$p_$p$p_*) ;;
125	*) test -d $p && PATH=$PATH$p_$p ;;
126	esac
127done
128
129PATH=.$p_$PATH
130export PATH
131
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
138if (PATH=.; alias -x) >/dev/null 2>&1; then
139		inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142	needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145	if test X`/usr/bin/uname -v` = X4; then
146		avoidksh="to avoid AIX 4's /bin/sh"
147		newsh=/usr/bin/bsh
148	fi
149fi
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151	if test X`/usr/bin/uname -s` = XOSF1; then
152		avoidksh="to avoid Digital UNIX' ksh"
153		newsh=/bin/sh
154		unset BIN_SH
155	fi
156fi
157case "$inksh/$needksh" in
158/[a-z]*)
159		ENV=''
160		changesh=true
161		reason="$needksh"
162	;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166	changesh=true
167	reason="$avoidksh"
168	;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
172		cat <<EOM
173(I see you are using the Korn shell.  Some ksh's blow up on $me,
174mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175EOM
176	;;
177esac
178case "$changesh" in
179true)
180	export newsh
181	echo "(Feeding myself to $newsh $reason.)"
182	case "$0" in
183	Configure|*/Configure) exec $newsh $0 "$@";;
184	*) exec $newsh Configure "$@";;
185	esac
186	;;
187esac
188test -x "${newsh}" || unset newsh
189
190: if needed, set CDPATH to a harmless value that is not chatty
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'')	;;
194*)	case "$SHELL" in
195	*bash*) CDPATH='.' ;;
196	*) CDPATH='' ;;
197	esac
198	;;
199esac
200
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
203cd UU && rm -f ./*
204
205ccname=''
206ccversion=''
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
210from=''
211run=''
212targetarch=''
213to=''
214usecrosscompile=''
215extern_C=''
216mistrustnm=''
217usedevel=''
218perllibs=''
219dynamic_ext=''
220extensions=''
221known_extensions=''
222nonxs_ext=''
223static_ext=''
224useopcode=''
225useposix=''
226extras=''
227d_bsd=''
228d_eunice=''
229d_xenix=''
230eunicefix=''
231ar=''
232awk=''
233bash=''
234bison=''
235byacc=''
236cat=''
237chgrp=''
238chmod=''
239chown=''
240comm=''
241compress=''
242cp=''
243cpio=''
244cpp=''
245csh=''
246date=''
247echo=''
248egrep=''
249emacs=''
250expr=''
251find=''
252flex=''
253gmake=''
254grep=''
255gzip=''
256inews=''
257ksh=''
258less=''
259line=''
260lint=''
261ln=''
262lp=''
263lpr=''
264ls=''
265mail=''
266mailx=''
267make=''
268mkdir=''
269more=''
270mv=''
271nm=''
272nroff=''
273perl=''
274pg=''
275pmake=''
276pr=''
277rm=''
278rmail=''
279sed=''
280sendmail=''
281shar=''
282sleep=''
283smail=''
284sort=''
285submit=''
286tail=''
287tar=''
288tbl=''
289tee=''
290test=''
291touch=''
292tr=''
293troff=''
294uname=''
295uniq=''
296uuname=''
297vi=''
298zcat=''
299zip=''
300full_ar=''
301full_sed=''
302libswanted=''
303hint=''
304myuname=''
305osname=''
306osvers=''
307Author=''
308Date=''
309Header=''
310Id=''
311Locker=''
312Log=''
313RCSfile=''
314Revision=''
315Source=''
316State=''
317_a=''
318_exe=''
319_o=''
320archobjs=''
321exe_ext=''
322firstmakefile=''
323lib_ext=''
324obj_ext=''
325path_sep=''
326rm_try=''
327afs=''
328afsroot=''
329alignbytes=''
330ansi2knr=''
331archlib=''
332archlibexp=''
333d_archlib=''
334installarchlib=''
335archname=''
336myarchname=''
337d_atolf=''
338d_atoll=''
339baserev=''
340bin=''
341binexp=''
342initialinstalllocation=''
343installbin=''
344userelocatableinc=''
345byteorder=''
346cc=''
347ccflags=''
348cppflags=''
349ldflags=''
350lkflags=''
351locincpth=''
352optimize=''
353cf_email=''
354cf_by=''
355cf_time=''
356charbits=''
357charsize=''
358contains=''
359cpp_stuff=''
360cpplast=''
361cppminus=''
362cpprun=''
363cppstdin=''
364d__fwalk=''
365d_access=''
366d_accessx=''
367d_aintl=''
368d_alarm=''
369asctime_r_proto=''
370d_asctime_r=''
371d_attribute_deprecated=''
372d_attribute_format=''
373d_attribute_malloc=''
374d_attribute_nonnull=''
375d_attribute_noreturn=''
376d_attribute_pure=''
377d_attribute_unused=''
378d_attribute_warn_unused_result=''
379d_printf_format_null=''
380d_bcmp=''
381d_bcopy=''
382d_builtin_choose_expr=''
383d_builtin_expect=''
384d_bzero=''
385d_c99_variadic_macros=''
386d_casti32=''
387castflags=''
388d_castneg=''
389d_chown=''
390d_chroot=''
391d_chsize=''
392d_class=''
393d_clearenv=''
394d_closedir=''
395d_void_closedir=''
396d_cmsghdr_s=''
397d_const=''
398d_copysignl=''
399d_cplusplus=''
400cryptlib=''
401d_crypt=''
402crypt_r_proto=''
403d_crypt_r=''
404d_csh=''
405full_csh=''
406d_ctermid=''
407ctermid_r_proto=''
408d_ctermid_r=''
409ctime_r_proto=''
410d_ctime_r=''
411d_cuserid=''
412d_dbl_dig=''
413d_dbminitproto=''
414d_difftime=''
415d_dir_dd_fd=''
416d_dirfd=''
417d_dlerror=''
418d_dlopen=''
419d_dlsymun=''
420d_dosuid=''
421d_suidsafe=''
422d_drand48_r=''
423drand48_r_proto=''
424d_drand48proto=''
425d_dup2=''
426d_eaccess=''
427d_endgrent=''
428d_endgrent_r=''
429endgrent_r_proto=''
430d_endhent=''
431d_endhostent_r=''
432endhostent_r_proto=''
433d_endnent=''
434d_endnetent_r=''
435endnetent_r_proto=''
436d_endpent=''
437d_endprotoent_r=''
438endprotoent_r_proto=''
439d_endpwent=''
440d_endpwent_r=''
441endpwent_r_proto=''
442d_endsent=''
443d_endservent_r=''
444endservent_r_proto=''
445d_faststdio=''
446d_fchdir=''
447d_fchmod=''
448d_fchown=''
449d_fcntl=''
450d_fcntl_can_lock=''
451d_fd_macros=''
452d_fd_set=''
453d_fds_bits=''
454d_fgetpos=''
455d_finite=''
456d_finitel=''
457d_flexfnam=''
458d_flock=''
459d_flockproto=''
460d_fork=''
461d_fp_class=''
462d_fpclass=''
463d_fpclassify=''
464d_fpclassl=''
465d_fpos64_t=''
466d_frexpl=''
467d_fs_data_s=''
468d_fseeko=''
469d_fsetpos=''
470d_fstatfs=''
471d_fsync=''
472d_ftello=''
473d_ftime=''
474d_gettimeod=''
475d_futimes=''
476d_Gconvert=''
477d_getaddrinfo=''
478d_getcwd=''
479d_getespwnam=''
480d_getfsstat=''
481d_getgrent=''
482d_getgrent_r=''
483getgrent_r_proto=''
484d_getgrgid_r=''
485getgrgid_r_proto=''
486d_getgrnam_r=''
487getgrnam_r_proto=''
488d_getgrps=''
489d_gethbyaddr=''
490d_gethbyname=''
491d_gethent=''
492aphostname=''
493d_gethname=''
494d_phostname=''
495d_uname=''
496d_gethostbyaddr_r=''
497gethostbyaddr_r_proto=''
498d_gethostbyname_r=''
499gethostbyname_r_proto=''
500d_gethostent_r=''
501gethostent_r_proto=''
502d_gethostprotos=''
503d_getitimer=''
504d_getlogin=''
505d_getlogin_r=''
506getlogin_r_proto=''
507d_getmnt=''
508d_getmntent=''
509d_getnameinfo=''
510d_getnbyaddr=''
511d_getnbyname=''
512d_getnent=''
513d_getnetbyaddr_r=''
514getnetbyaddr_r_proto=''
515d_getnetbyname_r=''
516getnetbyname_r_proto=''
517d_getnetent_r=''
518getnetent_r_proto=''
519d_getnetprotos=''
520d_getpagsz=''
521d_getpent=''
522d_getpgid=''
523d_getpgrp2=''
524d_bsdgetpgrp=''
525d_getpgrp=''
526d_getppid=''
527d_getprior=''
528d_getpbyname=''
529d_getpbynumber=''
530d_getprotobyname_r=''
531getprotobyname_r_proto=''
532d_getprotobynumber_r=''
533getprotobynumber_r_proto=''
534d_getprotoent_r=''
535getprotoent_r_proto=''
536d_getprotoprotos=''
537d_getprpwnam=''
538d_getpwent=''
539d_getpwent_r=''
540getpwent_r_proto=''
541d_getpwnam_r=''
542getpwnam_r_proto=''
543d_getpwuid_r=''
544getpwuid_r_proto=''
545d_getsent=''
546d_getservbyname_r=''
547getservbyname_r_proto=''
548d_getservbyport_r=''
549getservbyport_r_proto=''
550d_getservent_r=''
551getservent_r_proto=''
552d_getservprotos=''
553d_getspnam=''
554d_getspnam_r=''
555getspnam_r_proto=''
556d_getsbyname=''
557d_getsbyport=''
558d_gmtime_r=''
559gmtime_r_proto=''
560d_gnulibc=''
561gnulibc_version=''
562d_hasmntopt=''
563d_htonl=''
564d_ilogbl=''
565d_inetaton=''
566d_inetntop=''
567d_inetpton=''
568d_int64_t=''
569d_isascii=''
570d_isfinite=''
571d_isinf=''
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
577d_libm_lib_version=''
578d_link=''
579d_localtime_r=''
580d_localtime_r_needs_tzset=''
581localtime_r_proto=''
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
591d_malloc_good_size=''
592d_malloc_size=''
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
610d_modfl_pow32_bug=''
611d_modflproto=''
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
616d_msghdr_s=''
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
622d_nl_langinfo=''
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
630d_portable=''
631d_procselfexe=''
632procselfexe=''
633d_old_pthread_create_joinable=''
634old_pthread_create_joinable=''
635d_pthread_atfork=''
636d_pthread_attr_setscope=''
637d_pthread_yield=''
638d_sched_yield=''
639sched_yield=''
640d_qgcvt=''
641d_random_r=''
642random_r_proto=''
643d_readdir64_r=''
644readdir64_r_proto=''
645d_readdir=''
646d_rewinddir=''
647d_seekdir=''
648d_telldir=''
649d_readdir_r=''
650readdir_r_proto=''
651d_readlink=''
652d_readv=''
653d_recvmsg=''
654d_rename=''
655d_rmdir=''
656d_safebcpy=''
657d_safemcpy=''
658d_sanemcmp=''
659d_sbrkproto=''
660d_scalbnl=''
661d_select=''
662d_sem=''
663d_semctl=''
664d_semget=''
665d_semop=''
666d_sendmsg=''
667d_setegid=''
668d_seteuid=''
669d_setgrent=''
670d_setgrent_r=''
671setgrent_r_proto=''
672d_setgrps=''
673d_sethent=''
674d_sethostent_r=''
675sethostent_r_proto=''
676d_setitimer=''
677d_setlinebuf=''
678d_setlocale=''
679d_setlocale_r=''
680setlocale_r_proto=''
681d_setnent=''
682d_setnetent_r=''
683setnetent_r_proto=''
684d_setpent=''
685d_setpgid=''
686d_setpgrp2=''
687d_bsdsetpgrp=''
688d_setpgrp=''
689d_setprior=''
690d_setproctitle=''
691d_setprotoent_r=''
692setprotoent_r_proto=''
693d_setpwent=''
694d_setpwent_r=''
695setpwent_r_proto=''
696d_setregid=''
697d_setresgid=''
698d_setresuid=''
699d_setreuid=''
700d_setrgid=''
701d_setruid=''
702d_setsent=''
703d_setservent_r=''
704setservent_r_proto=''
705d_setsid=''
706d_setvbuf=''
707d_sfio=''
708usesfio=''
709d_shm=''
710d_shmat=''
711d_shmatprototype=''
712shmattype=''
713d_shmctl=''
714d_shmdt=''
715d_shmget=''
716d_sigaction=''
717d_signbit=''
718d_sigprocmask=''
719d_sigsetjmp=''
720usesitecustomize=''
721d_snprintf=''
722d_vsnprintf=''
723d_sockatmark=''
724d_sockatmarkproto=''
725d_msg_ctrunc=''
726d_msg_dontroute=''
727d_msg_oob=''
728d_msg_peek=''
729d_msg_proxy=''
730d_oldsock=''
731d_scm_rights=''
732d_socket=''
733d_sockpair=''
734sockethdr=''
735socketlib=''
736d_socklen_t=''
737d_socks5_init=''
738d_sprintf_returns_strlen=''
739d_sqrtl=''
740d_srand48_r=''
741srand48_r_proto=''
742d_srandom_r=''
743srandom_r_proto=''
744d_sresgproto=''
745d_sresuproto=''
746d_statblks=''
747d_statfs_f_flags=''
748d_statfs_s=''
749d_fstatvfs=''
750d_statvfs=''
751d_stdio_cnt_lval=''
752d_stdio_ptr_lval=''
753d_stdio_ptr_lval_nochange_cnt=''
754d_stdio_ptr_lval_sets_cnt=''
755d_stdiobase=''
756d_stdstdio=''
757stdio_base=''
758stdio_bufsiz=''
759stdio_cnt=''
760stdio_filbuf=''
761stdio_ptr=''
762d_index=''
763d_strchr=''
764d_strcoll=''
765d_strctcpy=''
766d_strerrm=''
767d_strerror=''
768d_sysernlst=''
769d_syserrlst=''
770d_strerror_r=''
771strerror_r_proto=''
772d_strftime=''
773d_strlcat=''
774d_strlcpy=''
775d_strtod=''
776d_strtol=''
777d_strtold=''
778d_strtoll=''
779d_strtoq=''
780d_strtoul=''
781d_strtoull=''
782d_strtouq=''
783d_strxfrm=''
784d_symlink=''
785d_syscall=''
786d_syscallproto=''
787d_sysconf=''
788d_system=''
789d_tcgetpgrp=''
790d_tcsetpgrp=''
791d_telldirproto=''
792d_time=''
793timetype=''
794d_asctime64=''
795d_ctime64=''
796d_difftime64=''
797d_gmtime64=''
798d_localtime64=''
799d_mktime64=''
800d_timegm=''
801clocktype=''
802d_times=''
803d_tmpnam_r=''
804tmpnam_r_proto=''
805d_truncate=''
806d_ttyname_r=''
807ttyname_r_proto=''
808d_tzname=''
809d_u32align=''
810d_ualarm=''
811d_umask=''
812d_semctl_semid_ds=''
813d_semctl_semun=''
814d_union_semun=''
815d_unordered=''
816d_unsetenv=''
817d_usleep=''
818d_usleepproto=''
819d_ustat=''
820d_pseudofork=''
821d_vfork=''
822usevfork=''
823d_voidsig=''
824signal_t=''
825d_volatile=''
826d_charvspr=''
827d_vprintf=''
828d_wait4=''
829d_waitpid=''
830d_wcstombs=''
831d_wctomb=''
832d_writev=''
833dlext=''
834bin_ELF=''
835cccdlflags=''
836ccdlflags=''
837dlsrc=''
838ld=''
839lddlflags=''
840usedl=''
841doublesize=''
842ebcdic=''
843fflushNULL=''
844fflushall=''
845fpossize=''
846fpostype=''
847gccansipedantic=''
848gccosandvers=''
849gccversion=''
850gidformat=''
851gidsign=''
852gidsize=''
853gidtype=''
854groupstype=''
855h_fcntl=''
856h_sysfile=''
857html1dir=''
858html1direxp=''
859installhtml1dir=''
860html3dir=''
861html3direxp=''
862installhtml3dir=''
863i_arpainet=''
864i_assert=''
865i_crypt=''
866db_hashtype=''
867db_prefixtype=''
868db_version_major=''
869db_version_minor=''
870db_version_patch=''
871i_db=''
872i_dbm=''
873i_rpcsvcdbm=''
874d_dirnamlen=''
875direntrytype=''
876i_dirent=''
877i_dld=''
878i_dlfcn=''
879i_fcntl=''
880i_float=''
881i_fp=''
882i_fp_class=''
883i_gdbm=''
884d_grpasswd=''
885i_grp=''
886i_ieeefp=''
887i_inttypes=''
888i_langinfo=''
889i_libutil=''
890i_limits=''
891i_locale=''
892i_machcthr=''
893i_malloc=''
894i_mallocmalloc=''
895i_math=''
896i_memory=''
897i_mntent=''
898d_gdbm_ndbm_h_uses_prototypes=''
899d_gdbmndbm_h_uses_prototypes=''
900d_ndbm=''
901d_ndbm_h_uses_prototypes=''
902i_gdbm_ndbm=''
903i_gdbmndbm=''
904i_ndbm=''
905i_netdb=''
906i_neterrno=''
907i_netinettcp=''
908i_niin=''
909i_sysin=''
910i_poll=''
911i_prot=''
912i_pthread=''
913d_pwage=''
914d_pwchange=''
915d_pwclass=''
916d_pwcomment=''
917d_pwexpire=''
918d_pwgecos=''
919d_pwpasswd=''
920d_pwquota=''
921i_pwd=''
922i_sfio=''
923i_shadow=''
924i_socks=''
925i_stddef=''
926i_stdlib=''
927i_string=''
928strings=''
929i_sunmath=''
930i_sysaccess=''
931i_sysdir=''
932i_sysfile=''
933d_voidtty=''
934i_bsdioctl=''
935i_sysfilio=''
936i_sysioctl=''
937i_syssockio=''
938i_syslog=''
939i_sysmman=''
940i_sysmode=''
941i_sysmount=''
942i_sysndir=''
943i_sysparam=''
944i_syspoll=''
945i_sysresrc=''
946i_syssecrt=''
947i_sysselct=''
948i_sysstat=''
949i_sysstatfs=''
950i_sysstatvfs=''
951i_systimes=''
952i_systypes=''
953i_sysuio=''
954i_sysun=''
955i_sysutsname=''
956i_sysvfs=''
957i_syswait=''
958i_sgtty=''
959i_termio=''
960i_termios=''
961d_tm_tm_gmtoff=''
962d_tm_tm_zone=''
963i_systime=''
964i_systimek=''
965i_time=''
966timeincl=''
967i_unistd=''
968i_ustat=''
969i_utime=''
970i_values=''
971i_stdarg=''
972i_varargs=''
973i_varhdr=''
974i_vfork=''
975d_inc_version_list=''
976inc_version_list=''
977inc_version_list_init=''
978installprefix=''
979installprefixexp=''
980installstyle=''
981installusrbinperl=''
982intsize=''
983longsize=''
984shortsize=''
985issymlink=''
986libc=''
987ldlibpthname=''
988libperl=''
989shrpenv=''
990useshrplib=''
991glibpth=''
992libpth=''
993loclibpth=''
994plibpth=''
995xlibpth=''
996ignore_versioned_solibs=''
997libs=''
998libsdirs=''
999libsfiles=''
1000libsfound=''
1001libspath=''
1002lns=''
1003d_PRIEUldbl=''
1004d_PRIFUldbl=''
1005d_PRIGUldbl=''
1006d_PRIeldbl=''
1007d_PRIfldbl=''
1008d_PRIgldbl=''
1009d_SCNfldbl=''
1010sPRIEUldbl=''
1011sPRIFUldbl=''
1012sPRIGUldbl=''
1013sPRIeldbl=''
1014sPRIfldbl=''
1015sPRIgldbl=''
1016sSCNfldbl=''
1017lseeksize=''
1018lseektype=''
1019mad=''
1020madlyh=''
1021madlyobj=''
1022madlysrc=''
1023make_set_make=''
1024d_mymalloc=''
1025freetype=''
1026mallocobj=''
1027mallocsrc=''
1028malloctype=''
1029usemallocwrap=''
1030usemymalloc=''
1031installman1dir=''
1032man1dir=''
1033man1direxp=''
1034man1ext=''
1035installman3dir=''
1036man3dir=''
1037man3direxp=''
1038man3ext=''
1039modetype=''
1040multiarch=''
1041mydomain=''
1042myhostname=''
1043phostname=''
1044c=''
1045n=''
1046d_eofnblk=''
1047eagain=''
1048o_nonblock=''
1049rd_nodata=''
1050need_va_copy=''
1051netdb_hlen_type=''
1052netdb_host_type=''
1053netdb_name_type=''
1054netdb_net_type=''
1055groupcat=''
1056hostcat=''
1057passcat=''
1058orderlib=''
1059ranlib=''
1060d_perl_otherlibdirs=''
1061otherlibdirs=''
1062package=''
1063spackage=''
1064pager=''
1065api_revision=''
1066api_subversion=''
1067api_version=''
1068api_versionstring=''
1069patchlevel=''
1070perl_patchlevel=''
1071revision=''
1072subversion=''
1073version=''
1074version_patchlevel_string=''
1075perl5=''
1076perladmin=''
1077perlpath=''
1078d_nv_preserves_uv=''
1079d_nv_zero_is_allbits_zero=''
1080i16size=''
1081i16type=''
1082i32size=''
1083i32type=''
1084i64size=''
1085i64type=''
1086i8size=''
1087i8type=''
1088ivsize=''
1089ivtype=''
1090nv_overflows_integers_at=''
1091nv_preserves_uv_bits=''
1092nvsize=''
1093nvtype=''
1094u16size=''
1095u16type=''
1096u32size=''
1097u32type=''
1098u64size=''
1099u64type=''
1100u8size=''
1101u8type=''
1102uvsize=''
1103uvtype=''
1104ivdformat=''
1105nvEUformat=''
1106nvFUformat=''
1107nvGUformat=''
1108nveformat=''
1109nvfformat=''
1110nvgformat=''
1111uvXUformat=''
1112uvoformat=''
1113uvuformat=''
1114uvxformat=''
1115pidtype=''
1116prefix=''
1117prefixexp=''
1118installprivlib=''
1119privlib=''
1120privlibexp=''
1121prototype=''
1122ptrsize=''
1123d_PRIXU64=''
1124d_PRId64=''
1125d_PRIi64=''
1126d_PRIo64=''
1127d_PRIu64=''
1128d_PRIx64=''
1129sPRIXU64=''
1130sPRId64=''
1131sPRIi64=''
1132sPRIo64=''
1133sPRIu64=''
1134sPRIx64=''
1135d_quad=''
1136quadkind=''
1137quadtype=''
1138uquadtype=''
1139drand01=''
1140randbits=''
1141randfunc=''
1142randseedtype=''
1143seedfunc=''
1144installscript=''
1145scriptdir=''
1146scriptdirexp=''
1147selectminbits=''
1148selecttype=''
1149sh=''
1150sig_count=''
1151sig_name=''
1152sig_name_init=''
1153sig_num=''
1154sig_num_init=''
1155sig_size=''
1156d_sitearch=''
1157installsitearch=''
1158sitearch=''
1159sitearchexp=''
1160installsitebin=''
1161sitebin=''
1162sitebinexp=''
1163installsitehtml1dir=''
1164sitehtml1dir=''
1165sitehtml1direxp=''
1166installsitehtml3dir=''
1167sitehtml3dir=''
1168sitehtml3direxp=''
1169installsitelib=''
1170sitelib=''
1171sitelib_stem=''
1172sitelibexp=''
1173installsiteman1dir=''
1174siteman1dir=''
1175siteman1direxp=''
1176installsiteman3dir=''
1177siteman3dir=''
1178siteman3direxp=''
1179siteprefix=''
1180siteprefixexp=''
1181installsitescript=''
1182sitescript=''
1183sitescriptexp=''
1184sizesize=''
1185sizetype=''
1186so=''
1187socksizetype=''
1188sharpbang=''
1189shsharp=''
1190spitshell=''
1191src=''
1192ssizetype=''
1193startperl=''
1194startsh=''
1195stdchar=''
1196d_stdio_stream_array=''
1197stdio_stream_array=''
1198sysman=''
1199sGMTIME_max=''
1200sGMTIME_min=''
1201sLOCALTIME_max=''
1202sLOCALTIME_min=''
1203trnl=''
1204uidformat=''
1205uidsign=''
1206uidsize=''
1207uidtype=''
1208archname64=''
1209use64bitall=''
1210use64bitint=''
1211dtrace=''
1212usedtrace=''
1213usefaststdio=''
1214ccflags_uselargefiles=''
1215ldflags_uselargefiles=''
1216libswanted_uselargefiles=''
1217uselargefiles=''
1218uselongdouble=''
1219usemorebits=''
1220usemultiplicity=''
1221nm_opt=''
1222nm_so_opt=''
1223runnm=''
1224usenm=''
1225useperlio=''
1226usesocks=''
1227d_oldpthreads=''
1228use5005threads=''
1229useithreads=''
1230usereentrant=''
1231usethreads=''
1232incpath=''
1233mips_type=''
1234usrinc=''
1235vaproto=''
1236d_vendorarch=''
1237installvendorarch=''
1238vendorarch=''
1239vendorarchexp=''
1240d_vendorbin=''
1241installvendorbin=''
1242vendorbin=''
1243vendorbinexp=''
1244installvendorhtml1dir=''
1245vendorhtml1dir=''
1246vendorhtml1direxp=''
1247installvendorhtml3dir=''
1248vendorhtml3dir=''
1249vendorhtml3direxp=''
1250d_vendorlib=''
1251installvendorlib=''
1252vendorlib=''
1253vendorlib_stem=''
1254vendorlibexp=''
1255installvendorman1dir=''
1256vendorman1dir=''
1257vendorman1direxp=''
1258installvendorman3dir=''
1259vendorman3dir=''
1260vendorman3direxp=''
1261usevendorprefix=''
1262vendorprefix=''
1263vendorprefixexp=''
1264d_vendorscript=''
1265installvendorscript=''
1266vendorscript=''
1267vendorscriptexp=''
1268versiononly=''
1269defvoidused=''
1270voidflags=''
1271yacc=''
1272yaccflags=''
1273CONFIG=''
1274
1275: Detect odd OSs
1276define='define'
1277undef='undef'
1278smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1279rmlist=''
1280
1281: We must find out about Eunice early
1282eunicefix=':'
1283if test -f /etc/unixtovms; then
1284	eunicefix=/etc/unixtovms
1285fi
1286if test -f /etc/unixtovms.exe; then
1287	eunicefix=/etc/unixtovms.exe
1288fi
1289
1290: Set executable suffix now -- needed before hints available
1291if test -f "/libs/version.library"; then
1292: Amiga OS
1293    _exe=""
1294elif test -f "/system/gnu_library/bin/ar.pm"; then
1295: Stratus VOS
1296    _exe=".pm"
1297elif test -n "$DJGPP"; then
1298: DOS DJGPP
1299    _exe=".exe"
1300elif test -d c:/. -o -n "$is_os2" ; then
1301: OS/2 or cygwin
1302    _exe=".exe"
1303fi
1304
1305groupstype=''
1306i_whoami=''
1307: Trailing extension.  Override this in a hint file, if needed.
1308: Extra object files, if any, needed on this platform.
1309archobjs=''
1310archname=''
1311libnames=''
1312: change the next line if compiling for Xenix/286 on Xenix/386
1313xlibpth='/usr/lib/386 /lib/386'
1314: Possible local library directories to search.
1315loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1316loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1317
1318: general looking path for locating libraries
1319glibpth="/lib /usr/lib $xlibpth"
1320glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1321test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1322test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1323test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1324
1325: Private path used by Configure to find libraries.  Its value
1326: is prepended to libpth. This variable takes care of special
1327: machines, like the mips.  Usually, it should be empty.
1328plibpth=''
1329
1330: default library list
1331libswanted=''
1332: some systems want to use only the non-versioned libso:s
1333ignore_versioned_solibs=''
1334: set usethreads on the Configure command line to enable threads.
1335usereentrant='undef'
1336: full support for void wanted by default
1337defvoidused=15
1338
1339: Possible local include directories to search.
1340: Set locincpth to "" in a hint file to defeat local include searches.
1341locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343:
1344: no include file wanted by default
1345inclwanted=''
1346
1347: Enable -DEBUGGING and -DDEBUGGING from the command line
1348EBUGGING=''
1349DEBUGGING=old
1350
1351ccname=''
1352ccversion=''
1353perllibs=''
1354: set useposix=false in your hint file to disable the POSIX extension.
1355useposix=true
1356: set useopcode=false in your hint file to disable the Opcode extension.
1357useopcode=true
1358archname64=''
1359ccflags_uselargefiles=''
1360ldflags_uselargefiles=''
1361libswanted_uselargefiles=''
1362: set usemultiplicity on the Configure command line to enable multiplicity.
1363: set usesocks on the Configure command line to enable socks.
1364: List of libraries we want.
1365: If anyone needs extra -lxxx, put those in a hint file.
1366libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1367libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1368: We probably want to search /usr/shlib before most other libraries.
1369: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1370glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1371glibpth="/usr/shlib $glibpth"
1372: Do not use vfork unless overridden by a hint file.
1373usevfork=false
1374
1375: Find the basic shell for Bourne shell scripts
1376case "$sh" in
1377'')
1378	case "$SYSTYPE" in
1379	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1380	*) xxx='/bin/sh';;
1381	esac
1382	if test -f "$xxx"; then
1383		sh="$xxx"
1384	else
1385		: Build up a list and do a single loop so we can 'break' out.
1386		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1387		for xxx in sh bash ksh pdksh ash; do
1388			for p in $pth; do
1389				try="$try ${p}/${xxx}"
1390			done
1391		done
1392		for xxx in $try; do
1393			if test -f "$xxx"; then
1394				sh="$xxx";
1395				break
1396			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1397				sh="$xxx";
1398				break
1399			elif test -f "$xxx.exe"; then
1400				sh="$xxx";
1401				break
1402			fi
1403		done
1404	fi
1405	;;
1406esac
1407
1408case "$sh" in
1409'')	cat >&2 <<EOM
1410$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1411
1412Usually it's in /bin/sh.  How did you even get this far?
1413Please contact me (Perl Maintainers) at perlbug@perl.org and 
1414we'll try to straighten this all out.
1415EOM
1416	exit 1
1417	;;
1418esac
1419
1420: see if sh knows # comments
1421if `$sh -c '#' >/dev/null 2>&1`; then
1422	shsharp=true
1423	spitshell=cat
1424	xcat=/bin/cat
1425	test -f $xcat$_exe || xcat=/usr/bin/cat
1426	if test ! -f $xcat$_exe; then
1427		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1428			if test -f $p/cat$_exe; then
1429				xcat=$p/cat
1430				break
1431			fi
1432		done
1433		if test ! -f $xcat$_exe; then
1434			echo "Can't find cat anywhere!"
1435			exit 1
1436		fi
1437	fi
1438	echo "#!$xcat" >sharp
1439	$eunicefix sharp
1440	chmod +x sharp
1441	./sharp > today 2>/dev/null
1442	if test -s today; then
1443		sharpbang='#!'
1444	else
1445		echo "#! $xcat" > sharp
1446		$eunicefix sharp
1447		chmod +x sharp
1448		./sharp > today 2>/dev/null
1449		if test -s today; then
1450			sharpbang='#! '
1451		else
1452			sharpbang=': use '
1453		fi
1454	fi
1455else
1456	echo " "
1457	echo "Your $sh doesn't grok # comments--I will strip them later on."
1458	shsharp=false
1459	cd ..
1460	echo "exec grep -v '^[ 	]*#'" >spitshell
1461	chmod +x spitshell
1462	$eunicefix spitshell
1463	spitshell=`pwd`/spitshell
1464	cd UU
1465	echo "I presume that if # doesn't work, #! won't work either!"
1466	sharpbang=': use '
1467fi
1468rm -f sharp today
1469
1470: figure out how to guarantee sh startup
1471case "$startsh" in
1472'') startsh=${sharpbang}${sh} ;;
1473*)
1474esac
1475cat >sharp <<EOSS
1476$startsh
1477set abc
1478test "$?abc" != 1
1479EOSS
1480
1481chmod +x sharp
1482$eunicefix sharp
1483if ./sharp; then
1484	: echo "Yup, it does."
1485else
1486	echo "Hmm... '$startsh' does not guarantee sh startup..."
1487	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1488fi
1489rm -f sharp
1490
1491: Save command line options in file UU/cmdline.opt for later use in
1492: generating config.sh.
1493cat > cmdline.opt <<EOSH
1494: Configure command line arguments.
1495config_arg0='$0'
1496config_args='$*'
1497config_argc=$#
1498EOSH
1499argn=1
1500args_exp=''
1501args_sep=''
1502for arg in "$@"; do
1503	cat >>cmdline.opt <<EOSH
1504config_arg$argn='$arg'
1505EOSH
1506	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1507$arg
1508EOC
1509	arg_exp=`cat cmdl.opt`
1510	args_exp="$args_exp$args_sep'$arg_exp'"
1511	argn=`expr $argn + 1`
1512	args_sep=' '
1513done
1514rm -f cmdl.opt
1515
1516: produce awk script to parse command line options
1517cat >options.awk <<'EOF'
1518BEGIN {
1519	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1520
1521	len = length(optstr);
1522	for (i = 1; i <= len; i++) {
1523		c = substr(optstr, i, 1);
1524		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1525		if (a == ":") {
1526			arg[c] = 1;
1527			i++;
1528		}
1529		opt[c] = 1;
1530	}
1531}
1532{
1533	expect = 0;
1534	str = $0;
1535	if (substr(str, 1, 1) != "-") {
1536		printf("'%s'\n", str);
1537		next;
1538	}
1539	len = length($0);
1540	for (i = 2; i <= len; i++) {
1541		c = substr(str, i, 1);
1542		if (!opt[c]) {
1543			printf("-%s\n", substr(str, i));
1544			next;
1545		}
1546		printf("-%s\n", c);
1547		if (arg[c]) {
1548			if (i < len)
1549				printf("'%s'\n", substr(str, i + 1));
1550			else
1551				expect = 1;
1552			next;
1553		}
1554	}
1555}
1556END {
1557	if (expect)
1558		print "?";
1559}
1560EOF
1561
1562: process the command line options
1563set X `for arg in "$@"; do echo "X$arg"; done |
1564	sed -e s/X// | awk -f options.awk`
1565eval "set $*"
1566shift
1567rm -f options.awk
1568
1569: set up default values
1570fastread=''
1571reuseval=false
1572config_sh=''
1573alldone=''
1574error=''
1575silent=''
1576extractsh=''
1577override=''
1578knowitall=''
1579rm -f optdef.sh posthint.sh
1580cat >optdef.sh <<EOS
1581$startsh
1582EOS
1583
1584
1585: option parsing
1586while test $# -gt 0; do
1587	case "$1" in
1588	-d) shift; fastread=yes;;
1589	-e) shift; alldone=cont;;
1590	-f)
1591		shift
1592		cd ..
1593		if test -r "$1"; then
1594			config_sh="$1"
1595		else
1596			echo "$me: cannot read config file $1." >&2
1597			error=true
1598		fi
1599		cd UU
1600		shift;;
1601	--help|\
1602	-h) shift; error=true;;
1603	-r) shift; reuseval=true;;
1604	-s) shift; silent=true; realsilent=true;;
1605	-E) shift; alldone=exit;;
1606	-K) shift; knowitall=true;;
1607	-O) shift; override=true;;
1608	-S) shift; silent=true; extractsh=true;;
1609	-D)
1610		shift
1611		case "$1" in
1612		*=)
1613			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1614			echo "$me: ignoring -D $1" >&2
1615			;;
1616		*=*) echo "$1" | \
1617				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1618		*) echo "$1='define'" >> optdef.sh;;
1619		esac
1620		shift
1621		;;
1622	-U)
1623		shift
1624		case "$1" in
1625		*=) echo "$1" >> optdef.sh;;
1626		*=*)
1627			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1628			echo "$me: ignoring -U $1" >&2
1629			;;
1630		*) echo "$1='undef'" >> optdef.sh;;
1631		esac
1632		shift
1633		;;
1634	-A)
1635	    shift
1636	    xxx=''
1637	    yyy="$1"
1638	    zzz=''
1639	    uuu=undef
1640	    case "$yyy" in
1641            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1642                 case "$zzz" in
1643                 *:*) zzz='' ;;
1644                 *)   xxx=append
1645                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                 esac
1648                 ;;
1649            esac
1650            case "$xxx" in
1651            '')  case "$yyy" in
1652                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1653                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1654                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1655                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1658                 esac
1659                 ;;
1660            esac
1661	    case "$xxx" in
1662	    append)
1663		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1664	    clear)
1665		echo "$yyy=''"			>> posthint.sh ;;
1666	    define)
1667	        case "$zzz" in
1668		'') zzz=define ;;
1669		esac
1670		echo "$yyy='$zzz'"		>> posthint.sh ;;
1671	    eval)
1672		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1673	    prepend)
1674		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1675	    undef)
1676	        case "$zzz" in
1677		'') zzz="$uuu" ;;
1678		esac
1679		echo "$yyy=$zzz"		>> posthint.sh ;;
1680            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1681	    esac
1682	    shift
1683	    ;;
1684	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1685	    exit 0;;
1686	--) break;;
1687	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1688	*) break;;
1689	esac
1690done
1691
1692case "$error" in
1693true)
1694	cat >&2 <<EOM
1695Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1696                 [-U symbol] [-U symbol=] [-A command:symbol...]
1697  -d : use defaults for all answers.
1698  -e : go on without questioning past the production of config.sh.
1699  -f : specify an alternate default configuration file.
1700  -h : print this help message and exit (with an error status).
1701  -r : reuse C symbols value if possible (skips costly nm extraction).
1702  -s : silent mode, only echoes questions and essential information.
1703  -D : define symbol to have some value:
1704         -D symbol         symbol gets the value 'define'
1705         -D symbol=value   symbol gets the value 'value'
1706       common used examples (see INSTALL for more info):
1707         -Duse64bitint            use 64bit integers
1708         -Duse64bitall            use 64bit integers and pointers
1709         -Dusethreads             use thread support
1710         -Dinc_version_list=none  do not include older perl trees in @INC
1711         -DEBUGGING=none          DEBUGGING options
1712         -Dcc=gcc                 choose your compiler
1713         -Dprefix=/opt/perl5      choose your destination
1714  -E : stop at the end of questions, after having produced config.sh.
1715  -K : do not use unless you know what you are doing.
1716  -O : let -D and -U override definitions from loaded configuration file.
1717  -S : perform variable substitutions on all .SH files (can mix with -f)
1718  -U : undefine symbol:
1719         -U symbol    symbol gets the value 'undef'
1720         -U symbol=   symbol gets completely empty
1721       e.g.:  -Uversiononly
1722  -A : manipulate symbol after the platform specific hints have been applied:
1723         -A append:symbol=value   append value to symbol
1724         -A symbol=value          like append:, but with a separating space
1725         -A define:symbol=value   define symbol to have value
1726         -A clear:symbol          define symbol to be ''
1727         -A define:symbol         define symbol to be 'define'
1728         -A eval:symbol=value     define symbol to be eval of value
1729         -A prepend:symbol=value  prepend value to symbol
1730         -A undef:symbol          define symbol to be 'undef'
1731         -A undef:symbol=         define symbol to be ''
1732       e.g.:  -A prepend:libswanted='cl pthread '
1733              -A ccflags=-DSOME_MACRO
1734  -V : print version number and exit (with a zero status).
1735EOM
1736	exit 1
1737	;;
1738esac
1739
1740: Sanity checks
1741case "$fastread$alldone" in
1742yescont|yesexit) ;;
1743*)
1744	case "$extractsh" in
1745	true) ;;
1746	*)
1747		if test ! -t 0; then
1748			echo "Say 'sh Configure', not 'sh <Configure'"
1749			exit 1
1750		fi
1751		;;
1752	esac
1753	;;
1754esac
1755
1756exec 4>&1
1757case "$silent" in
1758true) exec 1>/dev/null;;
1759esac
1760
1761: run the defines and the undefines, if any, but leave the file out there...
1762touch optdef.sh
1763. ./optdef.sh
1764: create the posthint manipulation script and leave the file out there...
1765touch posthint.sh
1766
1767: set package name
1768package='perl5'
1769first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1770last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1771case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1772ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1773*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1774esac
1775
1776: Some greps do not return status, grrr.
1777echo "grimblepritz" >grimble
1778if grep blurfldyick grimble >/dev/null 2>&1 ; then
1779	contains=contains
1780elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1781	contains=grep
1782else
1783	contains=contains
1784fi
1785rm -f grimble
1786: the following should work in any shell
1787case "$contains" in
1788contains*)
1789	echo " "
1790	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1791	cat >contains <<'EOSS'
1792grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1793EOSS
1794chmod +x contains
1795esac
1796
1797: Find the path to the source tree
1798case "$src" in
1799'') case "$0" in
1800    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1801         case "$src" in
1802	 /*)	;;
1803	 .)	;;
1804         *)	src=`cd ../$src && pwd` ;;
1805	 esac
1806         ;;
1807    *)   src='.';;
1808    esac;;
1809esac
1810case "$src" in
1811'')	src=/
1812	rsrc=/
1813	;;
1814/*)	rsrc="$src";;
1815*)	rsrc="../$src";;
1816esac
1817if test -f $rsrc/Configure && \
1818	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1819then
1820   : found it, so we are ok.
1821else
1822	rsrc=''
1823	for src in . .. ../.. ../../.. ../../../..; do
1824		if test -f ../$src/Configure && \
1825			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1826		then
1827			rsrc=../$src
1828			break
1829		fi
1830	done
1831fi
1832case "$rsrc" in
1833'')
1834	cat <<EOM >&4
1835
1836Sorry, I can't seem to locate the source dir for $package.  Please start
1837Configure with an explicit path -- i.e. /some/path/Configure.
1838
1839EOM
1840	exit 1
1841	;;
1842../.)	rsrc='..';;
1843*)
1844	echo " "
1845	echo "Sources for $package found in \"$src\"." >&4
1846	;;
1847esac
1848
1849: script used to extract .SH files with variable substitutions
1850cat >extract <<'EOS'
1851PERL_CONFIG_SH=true
1852echo "Doing variable substitutions on .SH files..."
1853if test -f MANIFEST; then
1854	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1855else
1856	echo "(Looking for .SH files under the source directory.)"
1857	set x `(cd "$src"; find . -name "*.SH" -print)`
1858fi
1859shift
1860case $# in
18610) set x `(cd "$src"; echo *.SH)`; shift;;
1862esac
1863if test ! -f "$src/$1"; then
1864	shift
1865fi
1866mkdir_p='
1867name=$1;
1868create="";
1869while test $name; do
1870	if test ! -d "$name"; then
1871		create="$name $create";
1872		name=`echo $name | sed -e "s|^[^/]*$||"`;
1873		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1874	else
1875		name="";
1876	fi;
1877done;
1878for file in $create; do
1879	mkdir $file;
1880done
1881'
1882for file in $*; do
1883	case "$src" in
1884	".")
1885		case "$file" in
1886		*/*)
1887			dir=`expr X$file : 'X\(.*\)/'`
1888			file=`expr X$file : 'X.*/\(.*\)'`
1889			(cd "$dir" && . ./$file)
1890			;;
1891		*)
1892			. ./$file
1893			;;
1894		esac
1895		;;
1896	*)
1897		case "$file" in
1898		*/*)
1899			dir=`expr X$file : 'X\(.*\)/'`
1900			file=`expr X$file : 'X.*/\(.*\)'`
1901			(set x $dir; shift; eval $mkdir_p)
1902			sh <"$src/$dir/$file"
1903			;;
1904		*)
1905			sh <"$src/$file"
1906			;;
1907		esac
1908		;;
1909	esac
1910done
1911if test -f "$src/config_h.SH"; then
1912	if test ! -f config.h; then
1913	: oops, they left it out of MANIFEST, probably, so do it anyway.
1914	. "$src/config_h.SH"
1915	fi
1916fi
1917EOS
1918
1919: extract files and exit if asked to do so
1920case "$extractsh" in
1921true)
1922	case "$realsilent" in
1923	true) ;;
1924	*) exec 1>&4;;
1925	esac
1926	case "$config_sh" in
1927	'') config_sh='config.sh';;
1928	esac
1929	echo " "
1930	echo "Fetching answers from $config_sh..."
1931	cd ..
1932	. $config_sh
1933	test "$override" && . ./optdef.sh
1934	echo " "
1935	. UU/extract
1936	rm -rf UU
1937	echo "Extraction done."
1938	exit 0
1939	;;
1940esac
1941
1942: Eunice requires " " instead of "", can you believe it
1943echo " "
1944: Here we go...
1945echo "Beginning of configuration questions for $package."
1946
1947trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1948
1949: first determine how to suppress newline on echo command
1950echo " "
1951echo "Checking echo to see how to suppress newlines..."
1952(echo "hi there\c" ; echo " ") >.echotmp
1953if $contains c .echotmp >/dev/null 2>&1 ; then
1954	echo "...using -n."
1955	n='-n'
1956	c=''
1957else
1958	cat <<'EOM'
1959...using \c
1960EOM
1961	n=''
1962	c='\c'
1963fi
1964echo $n "The star should be here-->$c"
1965echo '*'
1966rm -f .echotmp
1967
1968: Now test for existence of everything in MANIFEST
1969echo " "
1970if test -f "$rsrc/MANIFEST"; then
1971	echo "First let's make sure your kit is complete.  Checking..." >&4
1972	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1973		(split -l 50 2>/dev/null || split -50)
1974	rm -f missing
1975	tmppwd=`pwd`
1976	for filelist in x??; do
1977		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1978			>/dev/null 2>>"$tmppwd/missing")
1979	done
1980	if test -s missing; then
1981		cat missing >&4
1982		cat >&4 <<'EOM'
1983
1984THIS PACKAGE SEEMS TO BE INCOMPLETE.
1985
1986You have the option of continuing the configuration process, despite the
1987distinct possibility that your kit is damaged, by typing 'y'es.  If you
1988do, don't blame me if something goes wrong.  I advise you to type 'n'o
1989and contact the author (perlbug@perl.org).
1990
1991EOM
1992		echo $n "Continue? [n] $c" >&4
1993		read ans
1994		case "$ans" in
1995		y*)
1996			echo "Continuing..." >&4
1997			rm -f missing
1998			;;
1999		*)
2000			echo "ABORTING..." >&4
2001			kill $$
2002			;;
2003		esac
2004	else
2005		echo "Looks good..."
2006	fi
2007else
2008	echo "There is no MANIFEST file.  I hope your kit is complete !"
2009fi
2010rm -f missing x??
2011
2012: Find the appropriate value for a newline for tr
2013echo " "
2014if test -n "$DJGPP"; then
2015       trnl='\012'
2016fi
2017if test X"$trnl" = X; then
2018	case "`echo foo|tr '\n' x 2>/dev/null`" in
2019	foox) trnl='\n' ;;
2020	esac
2021fi
2022if test X"$trnl" = X; then
2023	case "`echo foo|tr '\012' x 2>/dev/null`" in
2024	foox) trnl='\012' ;;
2025	esac
2026fi
2027if test X"$trnl" = X; then
2028       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2029       fooxy) trnl='\n\r' ;;
2030       esac
2031fi
2032if test X"$trnl" = X; then
2033	cat <<EOM >&2
2034
2035$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2036
2037EOM
2038	exit 1
2039fi
2040
2041: compute the number of columns on the terminal for proper question formatting
2042case "$COLUMNS" in
2043'') COLUMNS='80';;
2044esac
2045
2046: set up the echo used in my read
2047myecho="case \"\$xxxm\" in
2048'') echo $n \"\$rp $c\" >&4;;
2049*) case \"\$rp\" in
2050	'') echo $n \"[\$xxxm] $c\";;
2051	*)
2052		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2053			echo \"\$rp\" >&4
2054			echo $n \"[\$xxxm] $c\" >&4
2055		else
2056			echo $n \"\$rp [\$xxxm] $c\" >&4
2057		fi
2058		;;
2059	esac;;
2060esac"
2061
2062: now set up to do reads with possible shell escape and default assignment
2063cat <<EOSC >myread
2064$startsh
2065xxxm=\$dflt
2066$myecho
2067ans='!'
2068case "\$fastread" in
2069yes) case "\$dflt" in
2070	'') ;;
2071	*) ans='';
2072		case "\$silent-\$rp" in
2073		true-) ;;
2074		*) echo " " >&4;;
2075		esac;;
2076	esac;;
2077*) case "\$silent" in
2078	true) case "\$rp" in
2079		'') ans='';;
2080		esac;;
2081	esac;;
2082esac
2083while expr "X\$ans" : "X!" >/dev/null; do
2084	read answ
2085	set x \$xxxm
2086	shift
2087	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2088	case  "\$answ" in
2089	"!")
2090		sh 1>&4
2091		echo " "
2092		$myecho
2093		;;
2094	!*)
2095		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2096		shift
2097		sh 1>&4 -c "\$*"
2098		echo " "
2099		$myecho
2100		;;
2101	"\$ans")
2102		case "\$ans" in
2103		\\&*)
2104			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2105			shift
2106			case "\$1" in
2107			-d)
2108				fastread=yes
2109				echo "(OK, I'll run with -d after this question.)" >&4
2110				;;
2111			-*)
2112				echo "*** Sorry, \$1 not supported yet." >&4
2113				;;
2114			esac
2115			$myecho
2116			ans=!
2117			;;
2118		esac;;
2119	*)
2120		case "\$aok" in
2121		y)
2122			echo "*** Substitution done -- please confirm."
2123			xxxm="\$ans"
2124			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2125			xxxm="\$ans"
2126			ans=!
2127			;;
2128		*)
2129			echo "*** Error -- try again."
2130			ans=!
2131			;;
2132		esac
2133		$myecho
2134		;;
2135	esac
2136	case "\$ans\$xxxm\$nostick" in
2137	'')
2138		ans=!
2139		$myecho
2140		;;
2141	esac
2142done
2143case "\$ans" in
2144'') ans="\$xxxm";;
2145esac
2146EOSC
2147
2148: create .config dir to save info across Configure sessions
2149test -d ../.config || mkdir ../.config
2150cat >../.config/README <<EOF
2151This directory created by Configure to save information that should
2152persist across sessions for $package.
2153
2154You may safely delete it if you wish.
2155EOF
2156
2157: See if we are using a devel version and want that
2158xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2159case "$usedevel" in
2160$define|true|[yY]*)
2161    usedevel="$define" ;;
2162*) case "$xversion" in
2163   *[13579])
2164	cat >&4 <<EOH
2165*** WHOA THERE!!! ***
2166
2167    This is an UNSTABLE DEVELOPMENT release.
2168    The version of this $package distribution is $xversion, that is, odd,
2169    (as opposed to even) and that signifies a development release.
2170    If you want a maintenance release, you want an even-numbered version.
2171
2172    Do ***NOT*** install this into production use.
2173    Data corruption and crashes are possible.
2174
2175    It is most seriously suggested that you do not continue any further
2176    unless you want to help in developing and debugging Perl.
2177
2178    If you *still* want to build perl, you can answer 'y' now,
2179    or pass -Dusedevel to Configure.
2180
2181EOH
2182	rp='Do you really want to continue?'
2183	dflt='n'
2184	. ./myread
2185	case "$ans" in
2186	[yY]) echo >&4 "Okay, continuing."
2187	      usedevel="$define" ;;
2188	*) echo >&4 "Okay, bye."
2189	   exit 1
2190	   ;;
2191	esac
2192	;;
2193    esac
2194    usedevel="$undef"
2195    ;;
2196esac
2197case "$usedevel" in
2198$define|true|[yY]*)
2199	case "$versiononly" in
2200	'') versiononly="$define" ;;
2201	esac
2202	case "$installusrbinperl" in
2203	'') installusrbinperl="$undef" ;;
2204	esac
2205	;;
2206esac
2207
2208: general instructions
2209needman=true
2210firsttime=true
2211user=`(logname) 2>/dev/null`
2212case "$user" in
2213'') user=`whoami 2>&1`;;
2214esac
2215if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2216	firsttime=false
2217	echo " "
2218	rp='Would you like to see the instructions?'
2219	dflt=n
2220	. ./myread
2221	case "$ans" in
2222	[yY]*) ;;
2223	*) needman=false;;
2224	esac
2225fi
2226if $needman; then
2227	cat <<EOH
2228
2229This installation shell script will examine your system and ask you questions
2230to determine how the perl5 package should be installed. If you get
2231stuck on a question, you may use a ! shell escape to start a subshell or
2232execute a command.  Many of the questions will have default answers in square
2233brackets; typing carriage return will give you the default.
2234
2235On some of the questions which ask for file or directory names you are allowed
2236to use the ~name construct to specify the login directory belonging to "name",
2237even if you don't have a shell which knows about that.  Questions where this is
2238allowed will be marked "(~name ok)".
2239
2240EOH
2241	rp=''
2242	dflt='Type carriage return to continue'
2243	. ./myread
2244	cat <<'EOH'
2245
2246The prompter used in this script allows you to use shell variables and
2247backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2248in the default answer, as if the default line was a set of arguments given to a
2249script shell.  This means you may also use $* to repeat the whole default line,
2250so you do not have to re-type everything to add something to the default.
2251
2252Everytime there is a substitution, you will have to confirm.  If there is an
2253error (e.g. an unmatched backtick), the default answer will remain unchanged
2254and you will be prompted again.
2255
2256If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2257the questions and use the computed defaults (or the previous answers if there
2258was already a config.sh file). Type 'Configure -h' for a list of options.
2259You may also start interactively and then answer '& -d' at any prompt to turn
2260on the non-interactive behaviour for the remainder of the execution.
2261
2262EOH
2263	. ./myread
2264	cat <<EOH
2265
2266Much effort has been expended to ensure that this shell script will run on any
2267Unix system.  If despite that it blows up on yours, your best bet is to edit
2268Configure and run it again.  If you can't run Configure for some reason,
2269you'll have to generate a config.sh file by hand.  Whatever problems you
2270have, let me (perlbug@perl.org) know how I blew it.
2271
2272This installation script affects things in two ways:
2273
22741) it may do direct variable substitutions on some of the files included
2275   in this kit.
22762) it builds a config.h file for inclusion in C programs.  You may edit
2277   any of these files as the need arises after running this script.
2278
2279If you make a mistake on a question, there is no easy way to back up to it
2280currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2281files.  Configure will offer to let you do this before it runs the SH files.
2282
2283EOH
2284	dflt='Type carriage return to continue'
2285	. ./myread
2286	case "$firsttime" in
2287	true) echo $user >>../.config/instruct;;
2288	esac
2289fi
2290
2291: find out where common programs are
2292echo " "
2293echo "Locating common programs..." >&4
2294cat <<EOSC >loc
2295$startsh
2296case \$# in
22970) exit 1;;
2298esac
2299thing=\$1
2300shift
2301dflt=\$1
2302shift
2303for dir in \$*; do
2304	case "\$thing" in
2305	.)
2306	if test -d \$dir/\$thing; then
2307		echo \$dir
2308		exit 0
2309	fi
2310	;;
2311	*)
2312	for thisthing in \$dir/\$thing; do
2313		: just loop through to pick last item
2314	done
2315	if test -f \$thisthing; then
2316		echo \$thisthing
2317		exit 0
2318	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2319		echo \$thisthing
2320		exit 0
2321	elif test -f \$dir/\$thing.exe; then
2322		if test -n "$DJGPP"; then
2323			echo \$dir/\$thing.exe
2324		elif test "$eunicefix" != ":"; then
2325			: on Eunice apparently
2326			echo \$dir/\$thing
2327		fi
2328		exit 0
2329	fi
2330	;;
2331	esac
2332done
2333echo \$dflt
2334exit 1
2335EOSC
2336chmod +x loc
2337$eunicefix loc
2338loclist="
2339awk
2340cat
2341chmod
2342comm
2343cp
2344echo
2345expr
2346grep
2347ls
2348mkdir
2349rm
2350sed
2351sort
2352touch
2353tr
2354uniq
2355"
2356trylist="
2357ar
2358bison
2359byacc
2360cpp
2361csh
2362date
2363egrep
2364gmake
2365gzip
2366less
2367ln
2368make
2369more
2370nm
2371nroff
2372pg
2373test
2374uname
2375zip
2376"
2377pth=`echo $PATH | sed -e "s/$p_/ /g"`
2378pth="$pth /lib /usr/lib"
2379for file in $loclist; do
2380	eval xxx=\$$file
2381	case "$xxx" in
2382	/*|?:[\\/]*)
2383		if test -f "$xxx"; then
2384			: ok
2385		else
2386			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2387			xxx=`./loc $file $file $pth`
2388		fi
2389		;;
2390	'') xxx=`./loc $file $file $pth`;;
2391	*) xxx=`./loc $xxx $xxx $pth`;;
2392	esac
2393	eval $file=$xxx$_exe
2394	eval _$file=$xxx
2395	case "$xxx" in
2396	/*)
2397		echo $file is in $xxx.
2398		;;
2399	?:[\\/]*)
2400		echo $file is in $xxx.
2401		;;
2402	*)
2403		echo "I don't know where '$file' is, and my life depends on it." >&4
2404		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2405		exit 1
2406		;;
2407	esac
2408done
2409echo " "
2410echo "Don't worry if any of the following aren't found..."
2411say=offhand
2412for file in $trylist; do
2413	eval xxx=\$$file
2414	case "$xxx" in
2415	/*|?:[\\/]*)
2416		if test -f "$xxx"; then
2417			: ok
2418		else
2419			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2420			xxx=`./loc $file $file $pth`
2421		fi
2422		;;
2423	'') xxx=`./loc $file $file $pth`;;
2424	*) xxx=`./loc $xxx $xxx $pth`;;
2425	esac
2426	eval $file=$xxx$_exe
2427	eval _$file=$xxx
2428	case "$xxx" in
2429	/*)
2430		echo $file is in $xxx.
2431		;;
2432	?:[\\/]*)
2433		echo $file is in $xxx.
2434		;;
2435	*)
2436		echo "I don't see $file out there, $say."
2437		say=either
2438		;;
2439	esac
2440done
2441case "$egrep" in
2442egrep)
2443	echo "Substituting grep for egrep."
2444	egrep=$grep
2445	_egrep=$grep
2446	;;
2447esac
2448case "$less" in
2449'')	;;
2450*)	if $less -R </dev/null >/dev/null; then
2451	       echo "Substituting less -R for less."
2452	       less="$less -R"
2453	       _less=$less
2454	fi
2455	;;
2456esac
2457case "$ln" in
2458ln)
2459	echo "Substituting cp for ln."
2460	ln=$cp
2461	_ln=$cp
2462	;;
2463esac
2464case "$make" in
2465make)
2466	case "$gmake" in
2467	gmake)
2468	echo "I can't find make or gmake, and my life depends on it." >&4
2469	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2470	exit 1
2471	;;
2472	esac
2473	;;
2474esac
2475case "$gmake" in
2476gmake)	;;
2477*)	# We can't have osname yet.
2478	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2479		# Assume that gmake, if found, is definitely GNU make
2480		# and prefer it over the system make.
2481		echo "Substituting gmake for make."
2482		make=$gmake
2483		_make=$gmake
2484	fi
2485	;;
2486esac
2487case "$test" in
2488test)
2489	echo "Hopefully test is built into your sh."
2490	;;
2491*)
2492	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2493		echo "Using the test built into your sh."
2494		test=test
2495		_test=test
2496	fi
2497	;;
2498esac
2499case "$echo" in
2500echo)
2501	echo "Hopefully echo is built into your sh."
2502	;;
2503'') ;;
2504*)
2505	echo " "
2506echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2507	$echo $n "hi there$c" >foo1
2508	echo $n "hi there$c" >foo2
2509	if cmp foo1 foo2 >/dev/null 2>&1; then
2510		echo "They are compatible.  In fact, they may be identical."
2511	else
2512		case "$n" in
2513		'-n') n='' c='\c';;
2514		*) n='-n' c='';;
2515		esac
2516		cat <<FOO
2517They are not compatible!  You are probably running ksh on a non-USG system.
2518I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2519have echo built in and we may have to run some Bourne shell scripts.  That
2520means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2521
2522FOO
2523		$echo $n "The star should be here-->$c"
2524		$echo "*"
2525	fi
2526	$rm -f foo1 foo2
2527	;;
2528esac
2529
2530# This question was auctioned at YAPC::Europe-2007 in Vienna
2531# I never promised you could answer it. I only auctioned the question.
2532cat <<FOO
2533The following message is sponsored by
2534
2535  Dresden.pm<--The stars should be here.
2536
2537Dear Perl user, system administrator or package
2538maintainer, the Perl community sends greetings to
2539you. Do you (emblematical) greet back [Y/n]? n
2540
2541FOO
2542
2543: Check what type of C compiler we use
2544cat <<EOS >trygcc
2545$startsh
2546EOS
2547cat <<'EOSC' >>trygcc
2548case "$cc" in
2549'') ;;
2550*)  $rm -f try try.*
2551    $cat >try.c <<EOM
2552int main(int argc, char *argv[]) {
2553  return 0;
2554}
2555EOM
2556    if $cc -o try $ccflags $ldflags try.c; then
2557       :
2558    else
2559        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2560        despair=yes
2561        trygcc=yes
2562        case "$cc" in
2563        *gcc*) trygcc=no ;;
2564        esac
2565	# Skip this test because it gives a false match on output like:
2566	#    ./trygcc: line 23: cc: command not found
2567        # case "`$cc -v -c try.c 2>&1`" in
2568        # *gcc*) trygcc=no ;;
2569        # esac
2570        if $test X"$trygcc" = Xyes; then
2571            if gcc -o try -c try.c; then
2572                echo " "
2573                echo "You seem to have a working gcc, though." >&4
2574		# Switching compilers may undo the work of hints files.
2575		# The most common problem is -D_REENTRANT for threads.
2576		# This heuristic catches that case, but gets false positives
2577		# if -Dusethreads was not actually specified.  Better to
2578		# bail out here with a useful message than fail
2579		# mysteriously later. Should we perhaps just try to
2580		# re-invoke Configure -Dcc=gcc config_args ?
2581		if $test -f usethreads.cbu; then
2582			$cat >&4 <<EOM 
2583
2584*** However, any setting of the C compiler flags (e.g. for thread support)
2585*** will be lost.  It may be necessary for you to restart Configure and
2586*** add -Dcc=gcc to your Configure command line.
2587
2588EOM
2589			rp="Would you like to go ahead and try gcc anyway?"
2590			dflt=n
2591		else
2592			rp="Would you like to use it?"
2593			dflt=y
2594		fi
2595                if $test -f myread; then
2596                    . ./myread
2597                else
2598                    if $test -f UU/myread; then
2599                        . ./UU/myread
2600                    else
2601                        echo "Cannot find myread, sorry.  Aborting." >&2
2602                        exit 1
2603                    fi
2604                fi
2605                case "$ans" in
2606                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2607                esac
2608            fi
2609        fi
2610    fi
2611    $rm -f try try.*
2612    ;;
2613esac
2614EOSC
2615
2616cat <<EOS >checkcc
2617$startsh
2618EOS
2619cat <<'EOSC' >>checkcc
2620case "$cc" in
2621'') ;;
2622*)  $rm -f try try.*
2623    $cat >try.c <<EOM
2624int main(int argc, char *argv[]) {
2625  return 0;
2626}
2627EOM
2628    if $cc -o try $ccflags $ldflags try.c; then
2629       :
2630    else
2631        if $test X"$despair" = Xyes; then
2632           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2633        fi
2634        $cat >&4 <<EOM         
2635You need to find a working C compiler.
2636Either (purchase and) install the C compiler supplied by your OS vendor,
2637or for a free C compiler try http://gcc.gnu.org/
2638I cannot continue any further, aborting.
2639EOM
2640        exit 1
2641    fi
2642    $rm -f try try.*
2643    ;;
2644esac
2645EOSC
2646
2647: determine whether symbolic links are supported
2648echo " "
2649$touch blurfl
2650if $ln -s blurfl sym > /dev/null 2>&1 ; then
2651	echo "Symbolic links are supported." >&4
2652	lns="$ln -s"
2653else
2654	echo "Symbolic links are NOT supported." >&4
2655	lns="$ln"
2656fi
2657$rm -f blurfl sym
2658
2659: determine whether symbolic links are supported
2660echo " "
2661case "$lns" in
2662*"ln"*" -s")
2663	echo "Checking how to test for symbolic links..." >&4
2664	$lns blurfl sym
2665	if $test "X$issymlink" = X; then
2666		case "$newsh" in
2667		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2668		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2669		esac
2670		if test $? = 0; then
2671			issymlink="test -h"
2672		else
2673			echo "Your builtin 'test -h' may be broken." >&4
2674			case "$test" in
2675			/*)	;;
2676			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2677				for p in $pth
2678				do
2679					if test -f "$p/$test"; then
2680						test="$p/$test"
2681						break
2682					fi
2683				done
2684				;;
2685			esac
2686			case "$test" in
2687			/*)
2688				echo "Trying external '$test -h'." >&4
2689				issymlink="$test -h"
2690				if $test ! -h sym >/dev/null 2>&1; then
2691					echo "External '$test -h' is broken, too." >&4
2692					issymlink=''
2693				fi
2694				;;
2695			*)	issymlink='' ;;
2696			esac
2697		fi
2698	fi
2699	if $test "X$issymlink" = X; then
2700		if $test -L sym 2>/dev/null; then
2701			issymlink="$test -L"
2702			echo "The builtin '$test -L' worked." >&4
2703		fi
2704	fi
2705	if $test "X$issymlink" != X; then
2706		echo "You can test for symbolic links with '$issymlink'." >&4
2707	else
2708		echo "I do not know how you can test for symbolic links." >&4
2709	fi
2710	$rm -f blurfl sym
2711	;;
2712*)	echo "No symbolic links, so not testing for their testing..." >&4
2713	;;
2714esac
2715echo " "
2716
2717: Make symlinks util
2718case "$mksymlinks" in
2719$define|true|[yY]*)
2720	case "$src" in
2721	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2722		exit 1
2723		;;
2724	*)	case "$lns:$issymlink" in
2725		*"ln"*" -s:"*"test -"?)
2726			echo "Creating the symbolic links..." >&4
2727			cd ..
2728			awk -v src="$src" '{
2729				dir=$1;
2730				if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." }
2731				mf[dir] = mf[dir]" "src"/"$1;
2732			} END {
2733				for (d in mf) {
2734					if (d != ".") { system("mkdir -p "d) }
2735					system("ln -sf "mf[d]" "d);
2736				}
2737			}' $src/MANIFEST
2738			# Sanity check 1.
2739			if test ! -d t/base; then
2740				echo "Failed to create the subdirectories.  Aborting." >&4
2741				exit 1
2742			fi
2743			# Sanity check 2.
2744			if test ! -f t/base/lex.t; then
2745				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2746				exit 1
2747			fi
2748			if test ! -f x2p/walk.c; then
2749				echo "Failed to create the symlinks (x2p/walk.c missing).  Aborting." >&4
2750				exit 1
2751			fi
2752			cd UU
2753			;;
2754		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2755			;;
2756		esac
2757		;;
2758	esac
2759	;;
2760esac
2761
2762: Check for Cross-Compilation
2763case "$usecrosscompile" in
2764$define|true|[yY]*)
2765	$echo "Cross-compiling..."
2766        croak=''
2767    	case "$cc" in
2768	*-*-gcc) # A cross-compiling gcc, probably.
2769	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2770	    ar=$targetarch-ar
2771	    # leave out ld, choosing it is more complex
2772	    nm=$targetarch-nm
2773	    ranlib=$targetarch-ranlib
2774	    $echo 'extern int foo;' > try.c
2775	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2776	    shift
2777            if $test $# -gt 0; then
2778	        incpth="$incpth $*"
2779		incpth="`$echo $incpth|$sed 's/^ //'`"
2780                echo "Guessing incpth '$incpth'." >&4
2781                for i in $*; do
2782		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2783		    if $test -d $j; then
2784			libpth="$libpth $j"
2785		    fi
2786                done
2787		libpth="`$echo $libpth|$sed 's/^ //'`"
2788                echo "Guessing libpth '$libpth'." >&4
2789	    fi
2790	    $rm -f try.c
2791	    ;;
2792	esac
2793	case "$targetarch" in
2794	'') echo "Targetarch not defined." >&4; croak=y ;;
2795        *)  echo "Using targetarch $targetarch." >&4 ;;
2796	esac
2797	case "$incpth" in
2798	'') echo "Incpth not defined." >&4; croak=y ;;
2799        *)  echo "Using incpth '$incpth'." >&4 ;;
2800	esac
2801	case "$libpth" in
2802	'') echo "Libpth not defined." >&4; croak=y ;;
2803        *)  echo "Using libpth '$libpth'." >&4 ;;
2804	esac
2805	case "$usrinc" in
2806	'') for i in $incpth; do
2807	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2808		    usrinc=$i
2809	            echo "Guessing usrinc $usrinc." >&4
2810		    break
2811		fi
2812	    done
2813	    case "$usrinc" in
2814	    '') echo "Usrinc not defined." >&4; croak=y ;;
2815	    esac
2816            ;;
2817        *)  echo "Using usrinc $usrinc." >&4 ;;
2818	esac
2819	case "$targethost" in
2820	'') echo "Targethost not defined." >&4; croak=y ;;
2821        *)  echo "Using targethost $targethost." >&4
2822	esac
2823	locincpth=' '
2824	loclibpth=' '
2825	case "$croak" in
2826	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2827	esac
2828	case "$src" in
2829	/*) run=$src/Cross/run
2830	    targetmkdir=$src/Cross/mkdir
2831	    to=$src/Cross/to
2832	    from=$src/Cross/from
2833	    ;;
2834	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2835	    run=$pwd/Cross/run
2836	    targetmkdir=$pwd/Cross/mkdir
2837	    to=$pwd/Cross/to
2838	    from=$pwd/Cross/from
2839	    ;;
2840	esac
2841	case "$targetrun" in
2842	'') targetrun=ssh ;;
2843	esac
2844	case "$targetto" in
2845	'') targetto=scp ;;
2846	esac
2847	case "$targetfrom" in
2848	'') targetfrom=scp ;;
2849	esac
2850    	run=$run-$targetrun
2851    	to=$to-$targetto
2852    	from=$from-$targetfrom
2853	case "$targetdir" in
2854	'')  targetdir=/tmp
2855             echo "Guessing targetdir $targetdir." >&4
2856             ;;
2857	esac
2858	case "$targetuser" in
2859	'')  targetuser=root
2860             echo "Guessing targetuser $targetuser." >&4
2861             ;;
2862	esac
2863	case "$targetfrom" in
2864	scp)	q=-q ;;
2865	*)	q='' ;;
2866	esac
2867	case "$targetrun" in
2868	ssh|rsh)
2869	    cat >$run <<EOF
2870#!/bin/sh
2871case "\$1" in
2872-cwd)
2873  shift
2874  cwd=\$1
2875  shift
2876  ;;
2877esac
2878case "\$cwd" in
2879'') cwd=$targetdir ;;
2880esac
2881exe=\$1
2882shift
2883if $test ! -f \$exe.xok; then
2884  $to \$exe
2885  $touch \$exe.xok
2886fi
2887$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2888EOF
2889	    ;;
2890	*)  echo "Unknown targetrun '$targetrun'" >&4
2891	    exit 1
2892	    ;;
2893	esac
2894	case "$targetmkdir" in
2895	*/Cross/mkdir)
2896	    cat >$targetmkdir <<EOF
2897#!/bin/sh
2898$targetrun -l $targetuser $targethost "mkdir -p \$@"
2899EOF
2900	    $chmod a+rx $targetmkdir
2901	    ;;
2902	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2903	    exit 1
2904	    ;;
2905	esac
2906	case "$targetto" in
2907	scp|rcp)
2908	    cat >$to <<EOF
2909#!/bin/sh
2910for f in \$@
2911do
2912  case "\$f" in
2913  /*)
2914    $targetmkdir \`dirname \$f\`
2915    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2916    ;;
2917  *)
2918    $targetmkdir $targetdir/\`dirname \$f\`
2919    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2920    ;;
2921  esac
2922done
2923exit 0
2924EOF
2925	    ;;
2926	cp) cat >$to <<EOF
2927#!/bin/sh
2928for f in \$@
2929do
2930  case "\$f" in
2931  /*)
2932    $mkdir -p $targetdir/\`dirname \$f\`
2933    $cp \$f $targetdir/\$f || exit 1
2934    ;;
2935  *)
2936    $targetmkdir $targetdir/\`dirname \$f\`
2937    $cp \$f $targetdir/\$f || exit 1
2938    ;;
2939  esac
2940done
2941exit 0
2942EOF
2943	    ;;
2944	*)  echo "Unknown targetto '$targetto'" >&4
2945	    exit 1
2946	    ;;
2947	esac
2948	case "$targetfrom" in
2949	scp|rcp)
2950	  cat >$from <<EOF
2951#!/bin/sh
2952for f in \$@
2953do
2954  $rm -f \$f
2955  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2956done
2957exit 0
2958EOF
2959	    ;;
2960	cp) cat >$from <<EOF
2961#!/bin/sh
2962for f in \$@
2963do
2964  $rm -f \$f
2965  cp $targetdir/\$f . || exit 1
2966done
2967exit 0
2968EOF
2969	    ;;
2970	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2971	    exit 1
2972	    ;;
2973	esac
2974	if $test ! -f $run; then
2975	    echo "Target 'run' script '$run' not found." >&4
2976	else
2977	    $chmod a+rx $run
2978	fi
2979	if $test ! -f $to; then
2980	    echo "Target 'to' script '$to' not found." >&4
2981	else
2982	    $chmod a+rx $to
2983	fi
2984	if $test ! -f $from; then
2985	    echo "Target 'from' script '$from' not found." >&4
2986	else
2987	    $chmod a+rx $from
2988	fi
2989	if $test ! -f $run -o ! -f $to -o ! -f $from; then
2990	    exit 1
2991	fi
2992	cat >&4 <<EOF
2993Using '$run' for remote execution,
2994and '$from' and '$to'
2995for remote file transfer.
2996EOF
2997	;;
2998*)	run=''
2999	to=:
3000	from=:
3001	usecrosscompile='undef'
3002	targetarch=''
3003	;;
3004esac
3005
3006: see whether [:lower:] and [:upper:] are supported character classes
3007echo " "
3008case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3009ABYZ)
3010	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3011	up='[:upper:]'
3012	low='[:lower:]'
3013	;;
3014*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3015	# (0xd9 and 0xe2), therefore that is a nice testing point.
3016	if test "X$up" = X -o "X$low" = X; then
3017	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3018	    rs) up='[A-Z]'
3019		low='[a-z]'
3020		;;
3021	    esac
3022	fi
3023	if test "X$up" = X -o "X$low" = X; then
3024	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3025	    rs) up='A-Z'
3026		low='a-z'
3027		;;
3028	    esac
3029	fi
3030	if test "X$up" = X -o "X$low" = X; then
3031	    case "`echo RS | od -x 2>/dev/null`" in
3032	    *D9E2*|*d9e2*)
3033		echo "Hey, this might be EBCDIC." >&4
3034		if test "X$up" = X -o "X$low" = X; then
3035		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3036		    rs) up='[A-IJ-RS-Z]'
3037			low='[a-ij-rs-z]'
3038			;;
3039		    esac
3040		fi
3041		if test "X$up" = X -o "X$low" = X; then
3042		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3043		    rs) up='A-IJ-RS-Z'
3044			low='a-ij-rs-z'
3045			;;
3046		    esac
3047		fi
3048		;;
3049	    esac
3050	fi
3051esac
3052case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3053rs)
3054    echo "Using $up and $low to convert case." >&4
3055    ;;
3056*)
3057    echo "I don't know how to translate letters from upper to lower case." >&4
3058    echo "Your tr is not acting any way I know of." >&4
3059    exit 1
3060    ;;
3061esac
3062: set up the translation script tr, must be called with ./tr of course
3063cat >tr <<EOSC
3064$startsh
3065case "\$1\$2" in
3066'[A-Z][a-z]') exec $tr '$up' '$low';;
3067'[a-z][A-Z]') exec $tr '$low' '$up';;
3068esac
3069exec $tr "\$@"
3070EOSC
3071chmod +x tr
3072$eunicefix tr
3073
3074: Try to determine whether config.sh was made on this system
3075case "$config_sh" in
3076'')
3077myuname=`$uname -a 2>/dev/null`
3078$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3079# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3080# because the A-Z/a-z are not consecutive.
3081myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3082	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3083newmyuname="$myuname"
3084dflt=n
3085case "$knowitall" in
3086'')
3087	if test -f ../config.sh; then
3088		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3089			eval "`grep myuname= ../config.sh`"
3090		fi
3091		if test "X$myuname" = "X$newmyuname"; then
3092			dflt=y
3093		fi
3094	fi
3095	;;
3096*) dflt=y;;
3097esac
3098
3099: Get old answers from old config file if Configure was run on the
3100: same system, otherwise use the hints.
3101hint=default
3102cd ..
3103if test -f config.sh; then
3104	echo " "
3105	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3106	. UU/myread
3107	case "$ans" in
3108	n*|N*) echo "OK, I'll ignore it."
3109		mv config.sh config.sh.old
3110		myuname="$newmyuname"
3111		;;
3112	*)  echo "Fetching default answers from your old config.sh file..." >&4
3113		tmp_n="$n"
3114		tmp_c="$c"
3115		tmp_sh="$sh"
3116		. ./config.sh
3117		cp config.sh UU
3118		n="$tmp_n"
3119		c="$tmp_c"
3120		: Older versions did not always set $sh.  Catch re-use of such
3121		: an old config.sh.
3122		case "$sh" in
3123		'') sh="$tmp_sh" ;;
3124		esac
3125		hint=previous
3126		;;
3127	esac
3128fi
3129. ./UU/checkcc
3130if test ! -f config.sh; then
3131	$cat <<EOM
3132
3133First time through, eh?  I have some defaults handy for some systems
3134that need some extra help getting the Configure answers right:
3135
3136EOM
3137	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3138	dflt=''
3139	: Half the following guesses are probably wrong... If you have better
3140	: tests or hints, please send them to perlbug@perl.org
3141	: The metaconfig authors would also appreciate a copy...
3142	$test -f /irix && osname=irix
3143	$test -f /xenix && osname=sco_xenix
3144	$test -f /dynix && osname=dynix
3145	$test -f /dnix && osname=dnix
3146	$test -f /lynx.os && osname=lynxos
3147	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3148	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3149	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3150	$test -f /bin/mips && /bin/mips && osname=mips
3151	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3152		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3153	$test -d /usr/apollo/bin && osname=apollo
3154	$test -f /etc/saf/_sactab && osname=svr4
3155	$test -d /usr/include/minix && osname=minix
3156	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3157	if $test -d /MachTen -o -d /MachTen_Folder; then
3158		osname=machten
3159		if $test -x /sbin/version; then
3160			osvers=`/sbin/version | $awk '{print $2}' |
3161			$sed -e 's/[A-Za-z]$//'`
3162		elif $test -x /usr/etc/version; then
3163			osvers=`/usr/etc/version | $awk '{print $2}' |
3164			$sed -e 's/[A-Za-z]$//'`
3165		else
3166			osvers="$2.$3"
3167		fi
3168	fi
3169
3170	$test -f /sys/posix.dll &&
3171		$test -f /usr/bin/what &&
3172		set X `/usr/bin/what /sys/posix.dll` &&
3173		$test "$3" = UWIN &&
3174		osname=uwin &&
3175		osvers="$5"
3176
3177	if $test -f $uname; then
3178		set X $myuname
3179		shift
3180
3181		case "$5" in
3182		fps*) osname=fps ;;
3183		mips*)
3184			case "$4" in
3185			umips) osname=umips ;;
3186			*) osname=mips ;;
3187			esac;;
3188		[23]100) osname=mips ;;
3189		next*) osname=next ;;
3190		i386*)
3191			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3192			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3193				osname='sco'
3194				osvers=$tmp
3195			elif $test -f /etc/kconfig; then
3196				osname=isc
3197				if test "$lns" = "$ln -s"; then
3198					osvers=4
3199				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3200					osvers=3
3201				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3202					osvers=2
3203				fi
3204			fi
3205			tmp=''
3206			;;
3207		pc*)
3208			if test -n "$DJGPP"; then
3209				osname=dos
3210				osvers=djgpp
3211			fi
3212			;;
3213		esac
3214
3215		case "$1" in
3216		aix) osname=aix
3217			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3218			case "$tmp" in
3219			# oslevel can fail with:
3220			# oslevel: Unable to acquire lock.
3221			*not\ found) osvers="$4"."$3" ;;
3222			'<3240'|'<>3240') osvers=3.2.0 ;;
3223			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3224			'=3250'|'>3250') osvers=3.2.5 ;;
3225			*) osvers=$tmp;;
3226			esac
3227			;;
3228		bsd386) osname=bsd386
3229			osvers=`$uname -r`
3230			;;
3231		cygwin*) osname=cygwin
3232			osvers="$3"
3233			;;
3234		*dc.osx) osname=dcosx
3235			osvers="$3"
3236			;;
3237		dnix) osname=dnix
3238			osvers="$3"
3239			;;
3240		domainos) osname=apollo
3241			osvers="$3"
3242			;;
3243		dgux)	osname=dgux
3244			osvers="$3"
3245			;;
3246		dragonfly) osname=dragonfly
3247			osvers="$3"
3248			;;
3249		dynixptx*) osname=dynixptx
3250			osvers=`echo "$4"|sed 's/^v//'`
3251			;;
3252		freebsd) osname=freebsd
3253			osvers="$3" ;;
3254		genix)	osname=genix ;;
3255		gnu)	osname=gnu
3256			osvers="$3" ;;
3257		hp*)	osname=hpux
3258			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3259			;;
3260		irix*)	osname=irix
3261			case "$3" in
3262			4*) osvers=4 ;;
3263			5*) osvers=5 ;;
3264			*)	osvers="$3" ;;
3265			esac
3266			;;
3267		linux)	osname=linux
3268			case "$3" in
3269			*)	osvers="$3" ;;
3270			esac
3271			;;
3272		MiNT)	osname=mint
3273			;;
3274		netbsd*) osname=netbsd
3275			osvers="$3"
3276			;;
3277		news-os) osvers="$3"
3278			case "$3" in
3279			4*) osname=newsos4 ;;
3280			*) osname=newsos ;;
3281			esac
3282			;;
3283		next*) osname=next ;;
3284		nonstop-ux) osname=nonstopux ;;
3285		openbsd) osname=openbsd
3286                	osvers="$3"
3287                	;;
3288		os2)	osname=os2
3289			osvers="$4"
3290			;;
3291		POSIX-BC | posix-bc ) osname=posix-bc
3292			osvers="$3"
3293			;;
3294		powerux | power_ux | powermax_os | powermaxos | \
3295		powerunix | power_unix) osname=powerux
3296			osvers="$3"
3297			;;
3298		qnx) osname=qnx
3299			osvers="$4"
3300			;;
3301		solaris) osname=solaris
3302			case "$3" in
3303			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3304			*)	osvers="$3" ;;
3305			esac
3306			;;
3307		sunos) osname=sunos
3308			case "$3" in
3309			5*) osname=solaris
3310				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3311			*)	osvers="$3" ;;
3312			esac
3313			;;
3314		titanos) osname=titanos
3315			case "$3" in
3316			1*) osvers=1 ;;
3317			2*) osvers=2 ;;
3318			3*) osvers=3 ;;
3319			4*) osvers=4 ;;
3320			*)	osvers="$3" ;;
3321			esac
3322			;;
3323		ultrix) osname=ultrix
3324			osvers="$3"
3325			;;
3326		osf1|mls+)	case "$5" in
3327				alpha)
3328					osname=dec_osf
3329					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3330					case "$osvers" in
3331					[1-9].[0-9]*) ;;
3332					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3333					esac
3334					;;
3335			hp*)	osname=hp_osf1	;;
3336			mips)	osname=mips_osf1 ;;
3337			esac
3338			;;
3339		# UnixWare 7.1.2 is known as Open UNIX 8
3340		openunix|unixware) osname=svr5
3341			osvers="$4"
3342			;;
3343		uts)	osname=uts
3344			osvers="$3"
3345			;;
3346		vos) osvers="$3"
3347			;;
3348		$2) case "$osname" in
3349			*isc*) ;;
3350			*freebsd*) ;;
3351			svr*)
3352				: svr4.x or possibly later
3353				case "svr$3" in
3354				${osname}*)
3355					osname=svr$3
3356					osvers=$4
3357					;;
3358				esac
3359				case "$osname" in
3360				svr4.0)
3361					: Check for ESIX
3362					if test -f /stand/boot ; then
3363						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3364						if test -n "$INITPROG" -a -f "$INITPROG"; then
3365			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3366							if test -n "$isesix"; then
3367								osname=esix4
3368							fi
3369						fi
3370					fi
3371					;;
3372				esac
3373				;;
3374			*)	if test -f /etc/systemid; then
3375					osname=sco
3376					set `echo $3 | $sed 's/\./ /g'` $4
3377					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3378						osvers=$1.$2.$3
3379					elif $test -f $src/hints/sco_$1_$2.sh; then
3380						osvers=$1.$2
3381					elif $test -f $src/hints/sco_$1.sh; then
3382						osvers=$1
3383					fi
3384				else
3385					case "$osname" in
3386					'') : Still unknown.  Probably a generic Sys V.
3387						osname="sysv"
3388						osvers="$3"
3389						;;
3390					esac
3391				fi
3392				;;
3393			esac
3394			;;
3395		*)	case "$osname" in
3396			'') : Still unknown.  Probably a generic BSD.
3397				osname="$1"
3398				osvers="$3"
3399				;;
3400			esac
3401			;;
3402		esac
3403	else
3404		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3405			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3406			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3407				osname=news_os
3408			fi
3409			$rm -f UU/kernel.what
3410		elif test -d c:/. -o -n "$is_os2" ; then
3411			set X $myuname
3412			osname=os2
3413			osvers="$5"
3414		fi
3415	fi
3416
3417        case "$targetarch" in
3418        '') ;;
3419        *)  hostarch=$osname
3420            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3421            osvers=''
3422            ;;
3423        esac
3424
3425	: Now look for a hint file osname_osvers, unless one has been
3426	: specified already.
3427	case "$hintfile" in
3428	''|' ')
3429		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3430		: Also try without trailing minor version numbers.
3431		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3432		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3433		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3434		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3435		case "$file" in
3436		'') dflt=none ;;
3437		*)  case "$osvers" in
3438			'') dflt=$file
3439				;;
3440			*)  if $test -f $src/hints/$file.sh ; then
3441					dflt=$file
3442				elif $test -f $src/hints/$xfile.sh ; then
3443					dflt=$xfile
3444				elif $test -f $src/hints/$xxfile.sh ; then
3445					dflt=$xxfile
3446				elif $test -f $src/hints/$xxxfile.sh ; then
3447					dflt=$xxxfile
3448				elif $test -f $src/hints/$xxxxfile.sh ; then
3449					dflt=$xxxxfile
3450				elif $test -f "$src/hints/${osname}.sh" ; then
3451					dflt="${osname}"
3452				else
3453					dflt=none
3454				fi
3455				;;
3456			esac
3457			;;
3458		esac
3459		if $test -f Policy.sh ; then
3460			case "$dflt" in
3461			*Policy*) ;;
3462			none) dflt="Policy" ;;
3463			*) dflt="Policy $dflt" ;;
3464			esac
3465		fi
3466		;;
3467	*)
3468		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3469		;;
3470	esac
3471
3472	if $test -f Policy.sh ; then
3473		$cat <<EOM
3474
3475There's also a Policy hint file available, which should make the
3476site-specific (policy) questions easier to answer.
3477EOM
3478
3479	fi
3480
3481	$cat <<EOM
3482
3483You may give one or more space-separated answers, or "none" if appropriate.
3484If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3485previous run of Configure, you may specify it as well as or instead of
3486OS-specific hints.  If hints are provided for your OS, you should use them:
3487although Perl can probably be built without hints on many platforms, using
3488hints often improve performance and may enable features that Configure can't
3489set up on its own. If there are no hints that match your OS, specify "none";
3490DO NOT give a wrong version or a wrong OS.
3491
3492EOM
3493
3494	rp="Which of these apply, if any?"
3495	. UU/myread
3496	tans=$ans
3497	for file in $tans; do
3498		if $test X$file = XPolicy -a -f Policy.sh; then
3499			. Policy.sh
3500			$cat Policy.sh >> UU/config.sh
3501		elif $test -f $src/hints/$file.sh; then
3502			. $src/hints/$file.sh
3503			$cat $src/hints/$file.sh >> UU/config.sh
3504		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3505			: nothing
3506		else
3507			: Give one chance to correct a possible typo.
3508			echo "$file.sh does not exist"
3509			dflt=$file
3510			rp="hint to use instead?"
3511			. UU/myread
3512			for file in $ans; do
3513				if $test -f "$src/hints/$file.sh"; then
3514					. $src/hints/$file.sh
3515					$cat $src/hints/$file.sh >> UU/config.sh
3516				elif $test X$ans = X -o X$ans = Xnone ; then
3517					: nothing
3518				else
3519					echo "$file.sh does not exist -- ignored."
3520				fi
3521			done
3522		fi
3523	done
3524
3525	hint=recommended
3526	: Remember our hint file for later.
3527	if $test -f "$src/hints/$file.sh" ; then
3528		hintfile="$file"
3529	else
3530		hintfile=''
3531	fi
3532fi
3533cd UU
3534;;
3535*)
3536	echo " "
3537	echo "Fetching default answers from $config_sh..." >&4
3538	tmp_n="$n"
3539	tmp_c="$c"
3540	cd ..
3541	cp $config_sh config.sh 2>/dev/null
3542	chmod +w config.sh
3543	. ./config.sh
3544	cd UU
3545	cp ../config.sh .
3546	n="$tmp_n"
3547	c="$tmp_c"
3548	hint=previous
3549	;;
3550esac
3551test "$override" && . ./optdef.sh
3552
3553: Restore computed paths
3554for file in $loclist $trylist; do
3555	eval $file="\$_$file"
3556done
3557
3558cat << EOM
3559
3560Configure uses the operating system name and version to set some defaults.
3561The default value is probably right if the name rings a bell. Otherwise,
3562since spelling matters for me, either accept the default or answer "none"
3563to leave it blank.
3564
3565EOM
3566case "$osname" in
3567	''|' ')
3568		case "$hintfile" in
3569		''|' '|none) dflt=none ;;
3570		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3571		esac
3572		;;
3573	*) dflt="$osname" ;;
3574esac
3575rp="Operating system name?"
3576. ./myread
3577case "$ans" in
3578none)  osname='' ;;
3579*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3580esac
3581echo " "
3582case "$osvers" in
3583	''|' ')
3584		case "$hintfile" in
3585		''|' '|none) dflt=none ;;
3586		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3587			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3588			case "$dflt" in
3589			''|' ') dflt=none ;;
3590			esac
3591			;;
3592		esac
3593		;;
3594	*) dflt="$osvers" ;;
3595esac
3596rp="Operating system version?"
3597. ./myread
3598case "$ans" in
3599none)  osvers='' ;;
3600*) osvers="$ans" ;;
3601esac
3602
3603
3604. ./posthint.sh
3605
3606: who configured the system
3607cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3608case "$cf_by" in
3609"")
3610	cf_by=`(logname) 2>/dev/null`
3611	case "$cf_by" in
3612	"")
3613		cf_by=`(whoami) 2>/dev/null`
3614		case "$cf_by" in
3615		"") cf_by=unknown ;;
3616		esac ;;
3617	esac ;;
3618esac
3619
3620: decide how portable to be.  Allow command line overrides.
3621case "$d_portable" in
3622"$undef") ;;
3623*)	d_portable="$define" ;;
3624esac
3625
3626: set up shell script to do ~ expansion
3627cat >filexp <<EOSS
3628$startsh
3629: expand filename
3630case "\$1" in
3631 \~/*|\~)
3632	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3633	;;
3634 \~*)
3635	if $test -f /bin/csh; then
3636		/bin/csh -f -c "glob \$1"
3637		failed=\$?
3638		echo ""
3639		exit \$failed
3640	else
3641		name=\`$expr x\$1 : '..\([^/]*\)'\`
3642		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3643		if $test ! -d "\$dir"; then
3644			me=\`basename \$0\`
3645			echo "\$me: can't locate home directory for: \$name" >&2
3646			exit 1
3647		fi
3648		case "\$1" in
3649		*/*)
3650			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3651			;;
3652		*)
3653			echo \$dir
3654			;;
3655		esac
3656	fi
3657	;;
3658*)
3659	echo \$1
3660	;;
3661esac
3662EOSS
3663chmod +x filexp
3664$eunicefix filexp
3665
3666: now set up to get a file name
3667cat <<EOS >getfile
3668$startsh
3669EOS
3670cat <<'EOSC' >>getfile
3671tilde=''
3672fullpath=''
3673already=''
3674skip=''
3675none_ok=''
3676exp_file=''
3677nopath_ok=''
3678orig_rp="$rp"
3679orig_dflt="$dflt"
3680case "$gfpth" in
3681'') gfpth='.' ;;
3682esac
3683
3684case "$fn" in
3685*\(*)
3686	: getfile will accept an answer from the comma-separated list
3687	: enclosed in parentheses even if it does not meet other criteria.
3688	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3689	fn=`echo $fn | sed 's/(.*)//'`
3690	;;
3691esac
3692
3693case "$fn" in
3694*:*)
3695	loc_file=`expr $fn : '.*:\(.*\)'`
3696	fn=`expr $fn : '\(.*\):.*'`
3697	;;
3698esac
3699
3700case "$fn" in
3701*~*) tilde=true;;
3702esac
3703case "$fn" in
3704*/*) fullpath=true;;
3705esac
3706case "$fn" in
3707*+*) skip=true;;
3708esac
3709case "$fn" in
3710*n*) none_ok=true;;
3711esac
3712case "$fn" in
3713*e*) exp_file=true;;
3714esac
3715case "$fn" in
3716*p*) nopath_ok=true;;
3717esac
3718
3719case "$fn" in
3720*f*) type='File';;
3721*d*) type='Directory';;
3722*l*) type='Locate';;
3723esac
3724
3725what="$type"
3726case "$what" in
3727Locate) what='File';;
3728esac
3729
3730case "$exp_file" in
3731'')
3732	case "$d_portable" in
3733	"$define") ;;
3734	*) exp_file=true;;
3735	esac
3736	;;
3737esac
3738
3739cd ..
3740while test "$type"; do
3741	redo=''
3742	rp="$orig_rp"
3743	dflt="$orig_dflt"
3744	case "$tilde" in
3745	true) rp="$rp (~name ok)";;
3746	esac
3747	. UU/myread
3748	if test -f UU/getfile.ok && \
3749		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3750	then
3751		value="$ans"
3752		ansexp="$ans"
3753		break
3754	fi
3755	case "$ans" in
3756	none)
3757		value=''
3758		ansexp=''
3759		case "$none_ok" in
3760		true) type='';;
3761		esac
3762		;;
3763	*)
3764		case "$tilde" in
3765		'') value="$ans"
3766			ansexp="$ans";;
3767		*)
3768			value=`UU/filexp $ans`
3769			case $? in
3770			0)
3771				if test "$ans" != "$value"; then
3772					echo "(That expands to $value on this system.)"
3773				fi
3774				;;
3775			*) value="$ans";;
3776			esac
3777			ansexp="$value"
3778			case "$exp_file" in
3779			'') value="$ans";;
3780			esac
3781			;;
3782		esac
3783		case "$fullpath" in
3784		true)
3785			case "$ansexp" in
3786			/*) value="$ansexp" ;;
3787			[a-zA-Z]:/*) value="$ansexp" ;;
3788			*)
3789				redo=true
3790				case "$already" in
3791				true)
3792				echo "I shall only accept a full path name, as in /bin/ls." >&4
3793				echo "Use a ! shell escape if you wish to check pathnames." >&4
3794					;;
3795				*)
3796				echo "Please give a full path name, starting with slash." >&4
3797					case "$tilde" in
3798					true)
3799				echo "Note that using ~name is ok provided it expands well." >&4
3800						already=true
3801						;;
3802					esac
3803				esac
3804				;;
3805			esac
3806			;;
3807		esac
3808		case "$redo" in
3809		'')
3810			case "$type" in
3811			File)
3812				for fp in $gfpth; do
3813					if test "X$fp" = X.; then
3814					    pf="$ansexp"
3815					else
3816					    pf="$fp/$ansexp"
3817					fi
3818					if test -f "$pf"; then
3819						type=''
3820					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3821					then
3822						echo "($value is not a plain file, but that's ok.)"
3823						type=''
3824					fi
3825					if test X"$type" = X; then
3826					    value="$pf"
3827					    break
3828					fi
3829				done
3830				;;
3831			Directory)
3832				for fp in $gfpth; do
3833					if test "X$fp" = X.; then
3834					    dir="$ans"
3835					    direxp="$ansexp"
3836					else
3837					    dir="$fp/$ansexp"
3838					    direxp="$fp/$ansexp"
3839					fi
3840					if test -d "$direxp"; then
3841						type=''
3842						value="$dir"
3843						break
3844					fi
3845				done
3846				;;
3847			Locate)
3848				if test -d "$ansexp"; then
3849					echo "(Looking for $loc_file in directory $value.)"
3850					value="$value/$loc_file"
3851					ansexp="$ansexp/$loc_file"
3852				fi
3853				if test -f "$ansexp"; then
3854					type=''
3855				fi
3856				case "$nopath_ok" in
3857				true)	case "$value" in
3858					*/*) ;;
3859					*)	echo "Assuming $value will be in people's path."
3860						type=''
3861						;;
3862					esac
3863					;;
3864				esac
3865				;;
3866			esac
3867
3868			case "$skip" in
3869			true) type='';
3870			esac
3871
3872			case "$type" in
3873			'') ;;
3874			*)
3875				if test "$fastread" = yes; then
3876					dflt=y
3877				else
3878					dflt=n
3879				fi
3880				rp="$what $value doesn't exist.  Use that name anyway?"
3881				. UU/myread
3882				dflt=''
3883				case "$ans" in
3884				y*) type='';;
3885				*) echo " ";;
3886				esac
3887				;;
3888			esac
3889			;;
3890		esac
3891		;;
3892	esac
3893done
3894cd UU
3895ans="$value"
3896rp="$orig_rp"
3897dflt="$orig_dflt"
3898rm -f getfile.ok
3899test "X$gfpthkeep" != Xy && gfpth=""
3900EOSC
3901
3902: determine root of directory hierarchy where package will be installed.
3903case "$prefix" in
3904'')
3905	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3906	;;
3907*?/)
3908	dflt=`echo "$prefix" | sed 's/.$//'`
3909	;;
3910*)
3911	dflt="$prefix"
3912	;;
3913esac
3914$cat <<EOM
3915
3916By default, $package will be installed in $dflt/bin, manual pages
3917under $dflt/man, etc..., i.e. with $dflt as prefix for all
3918installation directories. Typically this is something like /usr/local.
3919If you wish to have binaries under /usr/bin but other parts of the
3920installation under /usr/local, that's ok: you will be prompted
3921separately for each of the installation directories, the prefix being
3922only used to set the defaults.
3923
3924EOM
3925fn=d~
3926rp='Installation prefix to use?'
3927. ./getfile
3928oldprefix=''
3929case "$prefix" in
3930'') ;;
3931*)
3932	case "$ans" in
3933	"$prefix") ;;
3934	*) oldprefix="$prefix";;
3935	esac
3936	;;
3937esac
3938prefix="$ans"
3939prefixexp="$ansexp"
3940
3941: allow them to override the AFS root
3942case "$afsroot" in
3943'')	afsroot=/afs ;;
3944*)	afsroot=$afsroot ;;
3945esac
3946
3947: is AFS running?
3948echo " "
3949case "$afs" in
3950$define|true)	afs=true ;;
3951$undef|false)	afs=false ;;
3952*)	if $test -d $afsroot; then
3953		afs=true
3954	else
3955		afs=false
3956	fi
3957	;;
3958esac
3959if $afs; then
3960	echo "AFS may be running... I'll be extra cautious then..." >&4
3961else
3962	echo "AFS does not seem to be running..." >&4
3963fi
3964
3965: determine installation prefix for where package is to be installed.
3966if $afs; then
3967$cat <<EOM
3968
3969Since you are running AFS, I need to distinguish the directory in which
3970files will reside from the directory in which they are installed (and from
3971which they are presumably copied to the former directory by occult means).
3972
3973EOM
3974	case "$installprefix" in
3975	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3976	*) dflt="$installprefix";;
3977	esac
3978else
3979$cat <<EOM
3980
3981In some special cases, particularly when building $package for distribution,
3982it is convenient to distinguish the directory in which files should be
3983installed from the directory ($prefix) in which they will
3984eventually reside.  For most users, these two directories are the same.
3985
3986EOM
3987	case "$installprefix" in
3988	'') dflt=$prefix ;;
3989	*) dflt=$installprefix;;
3990	esac
3991fi
3992fn=d~
3993rp='What installation prefix should I use for installing files?'
3994. ./getfile
3995installprefix="$ans"
3996installprefixexp="$ansexp"
3997
3998: Perform the prefixexp/installprefixexp correction if necessary
3999cat <<EOS >installprefix
4000$startsh
4001EOS
4002cat <<'EOSC' >>installprefix
4003: Change installation prefix, if necessary.
4004if $test X"$prefix" != X"$installprefix"; then
4005    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4006else
4007    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4008fi
4009EOSC
4010chmod +x installprefix
4011$eunicefix installprefix
4012
4013: Set variables such as privlib and privlibexp from the output of ./getfile
4014: performing the prefixexp/installprefixexp correction if necessary.
4015cat <<EOS >setprefixvar
4016$startsh
4017EOS
4018cat <<'EOSC' >>setprefixvar
4019eval "${prefixvar}=\"\$ans\""
4020eval "${prefixvar}exp=\"\$ansexp\""
4021. ./installprefix
4022EOSC
4023chmod +x setprefixvar
4024$eunicefix setprefixvar
4025
4026: set up the script used to warn in case of inconsistency
4027cat <<EOS >whoa
4028$startsh
4029EOS
4030cat <<'EOSC' >>whoa
4031dflt=y
4032case "$hint" in
4033    recommended)
4034	case "$hintfile" in
4035	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4036		;;
4037	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4038		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4039		;;
4040	esac
4041	;;
4042    *)	echo " "
4043	echo "*** WHOA THERE!!! ***" >&4
4044	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4045	;;
4046esac
4047rp="    Keep the $hint value?"
4048. ./myread
4049case "$ans" in
4050y) td=$was; tu=$was;;
4051esac
4052EOSC
4053
4054: function used to set '$1' to '$val'
4055setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4056case "$val$was" in
4057$define$undef) . ./whoa; eval "$var=\$td";;
4058$undef$define) . ./whoa; eval "$var=\$tu";;
4059*) eval "$var=$val";;
4060esac'
4061
4062: Check is we will use socks
4063case "$usesocks" in
4064$define|true|[yY]*)	dflt='y';;
4065*) dflt='n';;
4066esac
4067cat <<EOM
4068
4069Perl can be built to use the SOCKS proxy protocol library.  To do so,
4070Configure must be run with -Dusesocks.  If you use SOCKS you also need
4071to use the PerlIO abstraction layer, this will be implicitly selected.
4072
4073If this doesn't make any sense to you, just accept the default '$dflt'.
4074EOM
4075rp='Build Perl for SOCKS?'
4076. ./myread
4077case "$ans" in
4078y|Y)	val="$define" ;;
4079*)      val="$undef" ;;
4080esac
4081set usesocks
4082eval $setvar
4083
4084case "$usesocks" in
4085$define|true|[yY]*) useperlio="$define";;
4086esac
4087
4088: Check if we want perlio
4089case "$useperlio" in
4090$define|true|[yY]*|'')	dflt='y';;
4091*) dflt='n';;
4092esac
4093cat <<EOM
4094
4095Previous version of $package used the standard IO mechanisms as
4096defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4097alternate IO mechanisms via the PerlIO abstraction layer, but the
4098stdio mechanism is still available if needed.  The abstraction layer
4099can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4100Using PerlIO with sfio may cause problems with some extension modules.
4101
4102If this doesn't make any sense to you, just accept the default '$dflt'.
4103EOM
4104rp='Use the PerlIO abstraction layer?'
4105. ./myread
4106case "$ans" in
4107y|Y)
4108	val="$define"
4109	;;
4110*)
4111	echo "Ok, doing things the stdio way."
4112	val="$undef"
4113	;;
4114esac
4115set useperlio
4116eval $setvar
4117
4118case "$usesocks" in
4119$define|true|[yY]*)
4120	case "$useperlio" in
4121	$define|true|[yY]*) ;;
4122	*)	cat >&4 <<EOM
4123
4124You are using the SOCKS proxy protocol library which means that you
4125should also use the PerlIO layer.  You may be headed for trouble.
4126
4127EOM
4128		;;
4129	esac
4130	;;
4131esac
4132
4133: get the patchlevel
4134echo " "
4135echo "Getting the current patchlevel..." >&4
4136if $test -r $rsrc/patchlevel.h;then
4137	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4138	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4139	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4140	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4141	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4142	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4143	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4144else
4145	revision=0
4146	patchlevel=0
4147	subversion=0
4148	api_revision=0
4149	api_version=0
4150	api_subversion=0
4151	perl_patchlevel=0
4152	$echo "(You do not have patchlevel.h.  Eek.)"
4153fi
4154if $test -r $rsrc/.patch ; then
4155	if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4156		perl_patchlevel=`cat $rsrc/.patch`
4157	fi
4158fi
4159: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4160version_patchlevel_string="version $patchlevel subversion $subversion"
4161case "$perl_patchlevel" in
41620|'') ;;
4163*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4164    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4165    ;;
4166esac
4167
4168$echo "(You have $package $version_patchlevel_string.)"
4169
4170case "$osname" in
4171dos|vms)
4172	: XXX Should be a Configure test for double-dots in filenames.
4173	version=`echo $revision $patchlevel $subversion | \
4174		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4175	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4176		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4177	;;
4178*)
4179	version=`echo $revision $patchlevel $subversion | \
4180		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4181	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4182		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4183	;;
4184esac
4185: Special case the 5.005_xx maintenance series, which used 5.005
4186: without any subversion label as a subdirectory in $sitelib
4187if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4188	api_versionstring='5.005'
4189fi
4190
4191: Do we want threads support and if so, what type
4192case "$usethreads" in
4193$define|true|[yY]*)     dflt='y';;
4194*)     # Catch case where user specified ithreads or 5005threads but
4195       # forgot -Dusethreads (A.D. 4/2002)
4196       case "$useithreads$use5005threads" in
4197       *$define*)
4198		case "$useperlio" in
4199		"$define")	dflt='y' ;;
4200		*)		dflt='n' ;;
4201		esac
4202		;;
4203       *)	dflt='n';;
4204       esac
4205       ;;
4206esac
4207cat <<EOM
4208
4209Perl can be built to take advantage of threads on some systems.
4210To do so, Configure can be run with -Dusethreads.
4211
4212Note that Perl built with threading support runs slightly slower
4213and uses more memory than plain Perl. The current implementation
4214is believed to be stable, but it is fairly new, and so should be
4215treated with caution.
4216
4217If this doesn't make any sense to you, just accept the default '$dflt'.
4218EOM
4219rp='Build a threading Perl?'
4220. ./myread
4221case "$ans" in
4222y|Y)    val="$define" ;;
4223*)      val="$undef" ;;
4224esac
4225set usethreads
4226eval $setvar
4227
4228if $test $patchlevel -lt 9; then
4229    case "$usethreads" in
4230    $define)
4231	$cat <<EOM
4232
4233Since release 5.6, Perl has had two different threading implementations,
4234the newer interpreter-based version (ithreads) with one interpreter per
4235thread, and the older 5.005 version (5005threads).
4236The 5005threads version is effectively unmaintained and will probably be
4237removed in Perl 5.10, so there should be no need to build a Perl using it
4238unless needed for backwards compatibility with some existing 5.005threads
4239code.
4240
4241EOM
4242	: Default to ithreads unless overridden on command line or with
4243	: old config.sh
4244	dflt='y'
4245	case "$use5005threads" in
4246		$define|true|[yY]*) dflt='n';;
4247	esac
4248	case "$useithreads" in
4249		$undef|false|[nN]*) dflt='n';;
4250	esac
4251	rp='Use the newer interpreter-based ithreads?'
4252	. ./myread
4253	case "$ans" in
4254	y|Y)    val="$define" ;;
4255	*)      val="$undef" ;;
4256	esac
4257	set useithreads
4258	eval $setvar
4259	: Now set use5005threads to the opposite value.
4260	case "$useithreads" in
4261	$define) val="$undef" ;;
4262	*) val="$define" ;;
4263	esac
4264	set use5005threads
4265	eval $setvar
4266	;;
4267    *)
4268	useithreads="$undef"
4269	use5005threads="$undef"
4270	;;
4271    esac
4272
4273    case "$useithreads$use5005threads" in
4274    "$define$define")
4275	$cat >&4 <<EOM
4276
4277You cannot have both the ithreads and the 5.005 threads enabled
4278at the same time.  Disabling the 5.005 threads since they are
4279much less stable than the ithreads.
4280
4281EOM
4282	use5005threads="$undef"
4283	;;
4284    esac
4285
4286else
4287: perl-5.9.x and later
4288
4289    if test X"$usethreads" = "X$define"; then
4290	case "$use5005threads" in
4291	    $define|true|[yY]*)
4292		$cat >&4 <<EOM
4293
42945.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4295
4296EOM
4297	    ;;
4298	esac
4299    fi
4300
4301    use5005threads="$undef"
4302    useithreads="$usethreads"
4303fi
4304
4305if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4306	cat >&4 <<EOF
4307***
4308*** To build with ithreads you must also use the PerlIO layer.
4309*** Cannot continue, aborting.
4310***
4311EOF
4312	exit 1
4313fi
4314
4315case "$d_oldpthreads" in
4316'')	: Configure tests would be welcome here.  For now, assume undef.
4317	val="$undef" ;;
4318*)	val="$d_oldpthreads" ;;
4319esac
4320set d_oldpthreads
4321eval $setvar
4322
4323
4324: Look for a hint-file generated 'call-back-unit'.  If the
4325: user has specified that a threading perl is to be built,
4326: we may need to set or change some other defaults.
4327if $test -f usethreads.cbu; then
4328    echo "Your platform has some specific hints regarding threaded builds, using them..."
4329    . ./usethreads.cbu
4330else
4331    case "$usethreads" in
4332	"$define"|true|[yY]*)
4333		$cat <<EOM
4334(Your platform does not have any specific hints for threaded builds.
4335 Assuming POSIX threads, then.)
4336EOM
4337	;;
4338    esac
4339fi
4340
4341: Check if multiplicity is required
4342cat <<EOM
4343
4344Perl can be built so that multiple Perl interpreters can coexist
4345within the same Perl executable.
4346EOM
4347
4348case "$useithreads" in
4349$define)
4350	cat <<EOM
4351This multiple interpreter support is required for interpreter-based threads.
4352EOM
4353	val="$define"
4354	;;
4355*)	case "$usemultiplicity" in
4356	$define|true|[yY]*)	dflt='y';;
4357	*) dflt='n';;
4358	esac
4359	echo " "
4360	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4361	rp='Build Perl for multiplicity?'
4362	. ./myread
4363	case "$ans" in
4364	y|Y)	val="$define" ;;
4365	*)      val="$undef" ;;
4366	esac
4367	;;
4368esac
4369set usemultiplicity
4370eval $setvar
4371
4372: Check if morebits is requested
4373case "$usemorebits" in
4374"$define"|true|[yY]*)
4375	use64bitint="$define"
4376	uselongdouble="$define"
4377	usemorebits="$define"
4378	;;
4379*)	usemorebits="$undef"
4380	;;
4381esac
4382
4383: Determine the C compiler to be used
4384echo " "
4385case "$cc" in
4386'') dflt=cc;;
4387*) dflt="$cc";;
4388esac
4389rp="Use which C compiler?"
4390. ./myread
4391cc="$ans"
4392
4393: See whether they have no cc but they do have gcc
4394. ./trygcc
4395if $test -f cc.cbu; then
4396    . ./cc.cbu
4397fi
4398. ./checkcc
4399
4400: make some quick guesses about what we are up against
4401echo " "
4402$echo $n "Hmm...  $c"
4403echo exit 1 >bsd
4404echo exit 1 >usg
4405echo exit 1 >v7
4406echo exit 1 >osf1
4407echo exit 1 >eunice
4408echo exit 1 >xenix
4409echo exit 1 >venix
4410echo exit 1 >os2
4411d_bsd="$undef"
4412$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4413if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4414then
4415	echo "Looks kind of like an OSF/1 system, but we'll see..."
4416	echo exit 0 >osf1
4417elif test `echo abc | $tr a-z A-Z` = Abc ; then
4418	xxx=`./loc addbib blurfl $pth`
4419	if $test -f $xxx; then
4420	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4421		echo exit 0 >bsd
4422		echo exit 0 >usg
4423	else
4424		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4425			echo "Looks kind of like an extended USG system, but we'll see..."
4426		else
4427			echo "Looks kind of like a USG system, but we'll see..."
4428		fi
4429		echo exit 0 >usg
4430	fi
4431elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432	echo "Looks kind of like a BSD system, but we'll see..."
4433	d_bsd="$define"
4434	echo exit 0 >bsd
4435else
4436	echo "Looks kind of like a Version 7 system, but we'll see..."
4437	echo exit 0 >v7
4438fi
4439case "$eunicefix" in
4440*unixtovms*)
4441	$cat <<'EOI'
4442There is, however, a strange, musty smell in the air that reminds me of
4443something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4444EOI
4445	echo exit 0 >eunice
4446	d_eunice="$define"
4447: it so happens the Eunice I know will not run shell scripts in Unix format
4448	;;
4449*)
4450	echo " "
4451	echo "Congratulations.  You aren't running Eunice."
4452	d_eunice="$undef"
4453	;;
4454esac
4455: Detect OS2.  The p_ variable is set above in the Head.U unit.
4456: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4457: semicolon as a patch separator
4458case "$p_" in
4459:) ;;
4460*)
4461	$cat <<'EOI'
4462I have the feeling something is not exactly right, however...don't tell me...
4463lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4464(Or you may be running DOS with DJGPP.)
4465EOI
4466	echo exit 0 >os2
4467	;;
4468esac
4469if test -f /xenix; then
4470	echo "Actually, this looks more like a XENIX system..."
4471	echo exit 0 >xenix
4472	d_xenix="$define"
4473else
4474	echo " "
4475	echo "It's not Xenix..."
4476	d_xenix="$undef"
4477fi
4478chmod +x xenix
4479$eunicefix xenix
4480if test -f /venix; then
4481	echo "Actually, this looks more like a VENIX system..."
4482	echo exit 0 >venix
4483else
4484	echo " "
4485	if ./xenix; then
4486		: null
4487	else
4488		echo "Nor is it Venix..."
4489	fi
4490fi
4491chmod +x bsd usg v7 osf1 eunice xenix venix os2
4492$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4493$rm -f foo
4494
4495: Check if we are using GNU gcc and what its version is
4496echo " "
4497echo "Checking for GNU cc in disguise and/or its version number..." >&4
4498$cat >try.c <<EOM
4499#include <stdio.h>
4500int main() {
4501#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4502#ifdef __VERSION__
4503	printf("%s\n", __VERSION__);
4504#else
4505	printf("%s\n", "1");
4506#endif
4507#endif
4508	return(0);
4509}
4510EOM
4511if $cc -o try $ccflags $ldflags try.c; then
4512	gccversion=`$run ./try`
4513	case "$gccversion" in
4514	'') echo "You are not using GNU cc." ;;
4515	*)  echo "You are using GNU cc $gccversion."
4516	    ccname=gcc
4517	    ;;
4518	esac
4519else
4520	echo " "
4521	echo "*** WHOA THERE!!! ***" >&4
4522	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4523	case "$knowitall" in
4524	'')
4525	echo "    You'd better start hunting for one and let me know about it." >&4
4526		exit 1
4527		;;
4528	esac
4529fi
4530$rm -f try try.*
4531case "$gccversion" in
45321*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4533esac
4534case "$gccversion" in
4535'') gccosandvers='' ;;
4536*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4537   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4538   gccshortvers=''
4539   case "$gccosandvers" in
4540   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4541   $osname$osvers) ;; # looking good
4542   $osname*) cat <<EOM >&4
4543
4544*** WHOA THERE!!! ***
4545
4546    Your gcc has not been compiled for the exact release of
4547    your operating system ($gccosandvers versus $osname$osvers).
4548
4549    In general it is a good idea to keep gcc synchronized with
4550    the operating system because otherwise serious problems
4551    may ensue when trying to compile software, like Perl.
4552
4553    I'm trying to be optimistic here, though, and will continue.
4554    If later during the configuration and build icky compilation
4555    problems appear (headerfile conflicts being the most common
4556    manifestation), I suggest reinstalling the gcc to match
4557    your operating system release.
4558
4559EOM
4560      ;;
4561   *) gccosandvers='' ;; # failed to parse, better be silent
4562   esac
4563   ;;
4564esac
4565case "$ccname" in
4566'') ccname="$cc" ;;
4567esac
4568
4569# gcc 3.* complain about adding -Idirectories that they already know about,
4570# so we will take those off from locincpth.
4571case "$gccversion" in
45723*)
4573    echo "main(){}">try.c
4574    for incdir in $locincpth; do
4575       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4576	     grep '^c[cp]p*[01]: warning: changing search order '`
4577       if test "X$warn" != X; then
4578	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4579       fi
4580    done
4581    $rm -f try try.*
4582esac
4583
4584: What should the include directory be ?
4585echo " "
4586$echo $n "Hmm...  $c"
4587dflt='/usr/include'
4588incpath=''
4589mips_type=''
4590if $test -f /bin/mips && /bin/mips; then
4591	echo "Looks like a MIPS system..."
4592	$cat >usr.c <<'EOCP'
4593#ifdef SYSTYPE_BSD43
4594/bsd43
4595#endif
4596EOCP
4597	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4598		dflt='/bsd43/usr/include'
4599		incpath='/bsd43'
4600		mips_type='BSD 4.3'
4601	else
4602		mips_type='System V'
4603	fi
4604	$rm -f usr.c usr.out
4605	echo "and you're compiling with the $mips_type compiler and libraries."
4606	xxx_prompt=y
4607	echo "exit 0" >mips
4608else
4609	echo "Doesn't look like a MIPS system."
4610	xxx_prompt=n
4611	echo "exit 1" >mips
4612fi
4613chmod +x mips
4614$eunicefix mips
4615case "$usrinc" in
4616'') ;;
4617*) dflt="$usrinc";;
4618esac
4619case "$xxx_prompt" in
4620y)	fn=d/
4621	echo " "
4622	rp='Where are the include files you want to use?'
4623	. ./getfile
4624	usrinc="$ans"
4625	;;
4626*)	usrinc="$dflt"
4627	;;
4628esac
4629
4630: see how we invoke the C preprocessor
4631echo " "
4632echo "Now, how can we feed standard input to your C preprocessor..." >&4
4633cat <<'EOT' >testcpp.c
4634#define ABC abc
4635#define XYZ xyz
4636ABC.XYZ
4637EOT
4638cd ..
4639if test ! -f cppstdin; then
4640	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4641		# AIX cc -E doesn't show the absolute headerfile
4642		# locations but we'll cheat by using the -M flag.
4643		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
4644	else
4645		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4646	fi
4647else
4648	echo "Keeping your $hint cppstdin wrapper."
4649fi
4650chmod 755 cppstdin
4651wrapper=`pwd`/cppstdin
4652ok='false'
4653cd UU
4654
4655if $test "X$cppstdin" != "X" && \
4656	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4657	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4658then
4659	echo "You used to use $cppstdin $cppminus so we'll use that again."
4660	case "$cpprun" in
4661	'') echo "But let's see if we can live without a wrapper..." ;;
4662	*)
4663		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4664			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665		then
4666			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4667			ok='true'
4668		else
4669			echo "(However, $cpprun $cpplast does not work, let's see...)"
4670		fi
4671		;;
4672	esac
4673else
4674	case "$cppstdin" in
4675	'') ;;
4676	*)
4677		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4678		;;
4679	esac
4680fi
4681
4682if $ok; then
4683	: nothing
4684elif echo 'Maybe "'"$cc"' -E" will work...'; \
4685	$cc -E <testcpp.c >testcpp.out 2>&1; \
4686	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4687	echo "Yup, it does."
4688	x_cpp="$cc -E"
4689	x_minus='';
4690elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4691	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4692	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693	echo "Yup, it does."
4694	x_cpp="$cc -E"
4695	x_minus='-';
4696elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4697	$cc -P <testcpp.c >testcpp.out 2>&1; \
4698	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699	echo "Yipee, that works!"
4700	x_cpp="$cc -P"
4701	x_minus='';
4702elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4703	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4704	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4705	echo "At long last!"
4706	x_cpp="$cc -P"
4707	x_minus='-';
4708elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4709	$cpp <testcpp.c >testcpp.out 2>&1; \
4710	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4711	echo "It works!"
4712	x_cpp="$cpp"
4713	x_minus='';
4714elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4715	$cpp - <testcpp.c >testcpp.out 2>&1; \
4716	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4717	echo "Hooray, it works!  I was beginning to wonder."
4718	x_cpp="$cpp"
4719	x_minus='-';
4720elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4721	$wrapper <testcpp.c >testcpp.out 2>&1; \
4722	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4723	x_cpp="$wrapper"
4724	x_minus=''
4725	echo "Eureka!"
4726else
4727	dflt=''
4728	rp="No dice.  I can't find a C preprocessor.  Name one:"
4729	. ./myread
4730	x_cpp="$ans"
4731	x_minus=''
4732	$x_cpp <testcpp.c >testcpp.out 2>&1
4733	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4734		echo "OK, that will do." >&4
4735	else
4736echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4737		exit 1
4738	fi
4739fi
4740
4741case "$ok" in
4742false)
4743	cppstdin="$x_cpp"
4744	cppminus="$x_minus"
4745	cpprun="$x_cpp"
4746	cpplast="$x_minus"
4747	set X $x_cpp
4748	shift
4749	case "$1" in
4750	"$cpp")
4751		echo "Perhaps can we force $cc -E using a wrapper..."
4752		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4753			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4754		then
4755			echo "Yup, we can."
4756			cppstdin="$wrapper"
4757			cppminus='';
4758		else
4759			echo "Nope, we'll have to live without it..."
4760		fi
4761		;;
4762	esac
4763	case "$cpprun" in
4764	"$wrapper")
4765		cpprun=''
4766		cpplast=''
4767		;;
4768	esac
4769	;;
4770esac
4771
4772case "$cppstdin" in
4773"$wrapper"|'cppstdin') ;;
4774*) $rm -f $wrapper;;
4775esac
4776$rm -f testcpp.c testcpp.out
4777
4778: Set private lib path
4779case "$plibpth" in
4780'') if ./mips; then
4781		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4782	fi;;
4783esac
4784case "$libpth" in
4785' ') dlist='';;
4786'') dlist="$loclibpth $plibpth $glibpth";;
4787*) dlist="$libpth";;
4788esac
4789
4790: Now check and see which directories actually exist, avoiding duplicates
4791libpth=''
4792for xxx in $dlist
4793do
4794    if $test -d $xxx; then
4795		case " $libpth " in
4796		*" $xxx "*) ;;
4797		*) libpth="$libpth $xxx";;
4798		esac
4799    fi
4800done
4801$cat <<'EOM'
4802
4803Some systems have incompatible or broken versions of libraries.  Among
4804the directories listed in the question below, please remove any you
4805know not to be holding relevant libraries, and add any that are needed.
4806Say "none" for none.
4807
4808EOM
4809case "$libpth" in
4810'') dflt='none';;
4811*)
4812	set X $libpth
4813	shift
4814	dflt=${1+"$@"}
4815	;;
4816esac
4817rp="Directories to use for library searches?"
4818. ./myread
4819case "$ans" in
4820none) libpth=' ';;
4821*) libpth="$ans";;
4822esac
4823
4824: compute shared library extension
4825case "$so" in
4826'')
4827	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4828		dflt='sl'
4829	else
4830		dflt='so'
4831	fi
4832	;;
4833*) dflt="$so";;
4834esac
4835$cat <<EOM
4836
4837On some systems, shared libraries may be available.  Answer 'none' if
4838you want to suppress searching of shared libraries for the remainder
4839of this configuration.
4840
4841EOM
4842rp='What is the file extension used for shared libraries?'
4843. ./myread
4844so="$ans"
4845
4846: Define several unixisms.
4847: Hints files or command line option can be used to override them.
4848: The convoluted testing is in case hints files set either the old
4849: or the new name.
4850case "$_exe" in
4851'')	case "$exe_ext" in
4852	'')	;;
4853	*)	_exe="$exe_ext" ;;
4854	esac
4855	;;
4856esac
4857case "$_a" in
4858'')	case "$lib_ext" in
4859    '')	_a='.a';;
4860	*)	_a="$lib_ext" ;;
4861	esac
4862	;;
4863esac
4864case "$_o" in
4865'') case "$obj_ext" in
4866	'')	_o='.o';;
4867	*)	_o="$obj_ext";;
4868	esac
4869	;;
4870esac
4871case "$p_" in
4872'') case "$path_sep" in
4873	'')	p_=':';;
4874	*)	p_="$path_sep";;
4875	esac
4876	;;
4877esac
4878exe_ext=$_exe
4879lib_ext=$_a
4880obj_ext=$_o
4881path_sep=$p_
4882
4883rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4884
4885: Which makefile gets called first.  This is used by make depend.
4886case "$firstmakefile" in
4887'') firstmakefile='makefile';;
4888esac
4889
4890: Check for uselongdouble support
4891case "$ccflags" in
4892*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4893esac
4894
4895case "$uselongdouble" in
4896$define|true|[yY]*)	dflt='y';;
4897*) dflt='n';;
4898esac
4899cat <<EOM
4900
4901Perl can be built to take advantage of long doubles which
4902(if available) may give more accuracy and range for floating point numbers.
4903
4904If this doesn't make any sense to you, just accept the default '$dflt'.
4905EOM
4906rp='Try to use long doubles if available?'
4907. ./myread
4908case "$ans" in
4909y|Y) 	val="$define"	;;
4910*)      val="$undef"	;;
4911esac
4912set uselongdouble
4913eval $setvar
4914
4915case "$uselongdouble" in
4916true|[yY]*) uselongdouble="$define" ;;
4917esac
4918
4919: Look for a hint-file generated 'call-back-unit'.  If the
4920: user has specified that long doubles should be used,
4921: we may need to set or change some other defaults.
4922if $test -f uselongdouble.cbu; then
4923    echo "Your platform has some specific hints regarding long doubles, using them..."
4924    . ./uselongdouble.cbu
4925else
4926    case "$uselongdouble" in
4927	$define)
4928		$cat <<EOM
4929(Your platform does not have any specific hints for long doubles.)
4930EOM
4931	;;
4932    esac
4933fi
4934
4935: Looking for optional libraries
4936echo " "
4937echo "Checking for optional libraries..." >&4
4938case "$libs" in
4939' '|'') dflt='';;
4940*) dflt="$libs";;
4941esac
4942case "$libswanted" in
4943'') libswanted='c_s';;
4944esac
4945case "$usesocks" in
4946"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4947esac
4948libsfound=''
4949libsfiles=''
4950libsdirs=''
4951libspath=''
4952for thisdir in $libpth $xlibpth; do
4953  test -d $thisdir && libspath="$libspath $thisdir"
4954done
4955for thislib in $libswanted; do
4956	for thisdir in $libspath; do
4957	    xxx=''
4958	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4959		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4960	        $test -f "$xxx" && eval $libscheck
4961		$test -f "$xxx" && libstyle=shared
4962	    fi
4963	    if test ! -f "$xxx"; then
4964		xxx=$thisdir/lib$thislib.$so
4965	        $test -f "$xxx" && eval $libscheck
4966		$test -f "$xxx" && libstyle=shared
4967	    fi
4968	    if test ! -f "$xxx"; then
4969		xxx=$thisdir/lib$thislib$_a
4970	        $test -f "$xxx" && eval $libscheck
4971		$test -f "$xxx" && libstyle=static
4972	    fi
4973	    if test ! -f "$xxx"; then
4974		xxx=$thisdir/$thislib$_a
4975	        $test -f "$xxx" && eval $libscheck
4976		$test -f "$xxx" && libstyle=static
4977	    fi
4978	    if test ! -f "$xxx"; then
4979		xxx=$thisdir/lib${thislib}_s$_a
4980	        $test -f "$xxx" && eval $libscheck
4981		$test -f "$xxx" && libstyle=static
4982		$test -f "$xxx" && thislib=${thislib}_s
4983	    fi
4984	    if test ! -f "$xxx"; then
4985		xxx=$thisdir/Slib$thislib$_a
4986	        $test -f "$xxx" && eval $libscheck
4987		$test -f "$xxx" && libstyle=static
4988	    fi
4989	    if $test -f "$xxx"; then
4990		case "$libstyle" in
4991		shared) echo "Found -l$thislib (shared)." ;;
4992		static) echo "Found -l$thislib." ;;
4993		*)      echo "Found -l$thislib ($libstyle)." ;;
4994		esac
4995		case " $dflt " in
4996		*"-l$thislib "*);;
4997		*) dflt="$dflt -l$thislib"
4998                   libsfound="$libsfound $xxx"
4999                   yyy=`basename $xxx`
5000                   libsfiles="$libsfiles $yyy"
5001                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5002                   case " $libsdirs " in
5003                   *" $yyy "*) ;;
5004                   *) libsdirs="$libsdirs $yyy" ;;
5005                   esac
5006		   ;;
5007		esac
5008		break
5009	    fi
5010	done
5011	if $test ! -f "$xxx"; then
5012	    echo "No -l$thislib."
5013	fi
5014done
5015set X $dflt
5016shift
5017dflt="$*"
5018case "$libs" in
5019'') dflt="$dflt";;
5020*) dflt="$libs";;
5021esac
5022case "$dflt" in
5023' '|'') dflt='none';;
5024esac
5025
5026$cat <<EOM
5027
5028In order to compile $package on your machine, a number of libraries
5029are usually needed.  Include any other special libraries here as well.
5030Say "none" for none.  The default list is almost always right.
5031EOM
5032
5033echo " "
5034rp="What libraries to use?"
5035. ./myread
5036case "$ans" in
5037none) libs=' ';;
5038*) libs="$ans";;
5039esac
5040
5041: determine optimization, if desired, or use for debug flag also
5042case "$optimize" in
5043' '|$undef) dflt='none';;
5044'') dflt='-O';;
5045*) dflt="$optimize";;
5046esac
5047$cat <<EOH
5048
5049By default, $package compiles with the -O flag to use the optimizer.
5050Alternately, you might want to use the symbolic debugger, which uses
5051the -g flag (on traditional Unix systems).  Either flag can be
5052specified here.  To use neither flag, specify the word "none".
5053
5054EOH
5055rp="What optimizer/debugger flag should be used?"
5056. ./myread
5057optimize="$ans"
5058case "$optimize" in
5059'none') optimize=" ";;
5060esac
5061
5062: Check what DEBUGGING is required from the command line
5063: -DEBUGGING      or -DDEBUGGING or
5064: -DEBUGGING=both			= -g + -DDEBUGGING
5065: -DEBUGGING=-g   or -Doptimize=-g	= -g
5066: -DEBUGGING=none or -UDEBUGGING	=
5067: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5068case "$EBUGGING" in
5069'')	;;
5070*)	DEBUGGING=$EBUGGING ;;
5071esac
5072
5073case "$DEBUGGING" in
5074-g|both|$define)
5075    case "$optimize" in
5076	*-g*) ;;
5077	*)    optimize="$optimize -g" ;;
5078    esac ;;
5079none|$undef)
5080    case "$optimize" in
5081	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5082		shift
5083		optimize="$*"
5084		;;
5085    esac ;;
5086esac
5087
5088dflt=''
5089case "$DEBUGGING" in
5090both|$define) dflt='-DDEBUGGING'
5091esac
5092
5093: argument order is deliberate, as the flag will start with - which set could
5094: think is an option
5095checkccflag='check=$1; flag=$2; callback=$3;
5096echo " ";
5097echo "Checking if your compiler accepts $flag" 2>&1;
5098echo "int main(void) { return 0; }" > gcctest.c;
5099if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5100    echo "Yes, it does." 2>&1;
5101    if $test -s gcctest.out ; then
5102        echo "But your platform does not like it:";
5103        cat gcctest.out;
5104    else
5105	case "$ccflags" in
5106	*$check*)
5107	    echo "Leaving current flags $ccflags alone." 2>&1
5108	    ;;
5109	*) dflt="$dflt $flag";
5110	    eval $callback
5111	    ;;
5112	esac
5113    fi
5114else
5115    echo "Nope, it does not, but that is ok." 2>&1;
5116fi
5117'
5118
5119: We will not override a previous value, but we might want to
5120: augment a hint file
5121case "$hint" in
5122default|recommended)
5123	case "$gccversion" in
5124	1*) dflt="$dflt -fpcc-struct-return" ;;
5125	esac
5126	case "$optimize:$DEBUGGING" in
5127	*-g*:old) dflt="$dflt -DDEBUGGING";;
5128	esac
5129	case "$gccversion" in
5130	2*) if $test -d /etc/conf/kconfig.d &&
5131			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5132		then
5133			# Interactive Systems (ISC) POSIX mode.
5134			dflt="$dflt -posix"
5135		fi
5136		;;
5137	esac
5138	case "$gccversion" in
5139	1*) ;;
5140	2.[0-8]*) ;;
5141	?*)	set strict-aliasing -fno-strict-aliasing
5142		eval $checkccflag
5143		;;
5144	esac
5145	case "$gccversion" in
5146	1*) ;;
5147	2*) ;;
5148	?*) 	echo " "
5149		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5150		echo 'int main(void) { return 0; }' > gcctest.c
5151		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5152			echo "Yes, it does." 2>&1
5153			case "$ccflags" in
5154			*delete-null-pointer-checks*)
5155				echo "Leaving current flags $ccflags alone." 2>&1
5156				;;
5157			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5158			esac
5159		else
5160			echo "Nope, it doesn't, but that's ok." 2>&1
5161		fi
5162		;;
5163	esac
5164	# For gcc, adding -pipe speeds up compilations for some, but apparently
5165	# some assemblers can't read from stdin.  (It also slows down compilations
5166	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5167	case "$gccversion" in
5168	?*)	set pipe -pipe
5169		eval $checkccflag
5170		;;
5171	esac
5172
5173	# on x86_64 (at least) we require an extra library (libssp) in the
5174	# link command line. This library is not named, so I infer that it is
5175	# an implementation detail that may change. Hence the safest approach
5176	# is to add the flag to the flags passed to the compiler at link time,
5177	# as that way the compiler can do the right implementation dependant
5178	# thing. (NWC)
5179	case "$gccversion" in
5180	?*)	set stack-protector -fstack-protector
5181		eval $checkccflag
5182		;;
5183	esac
5184	;;
5185esac
5186
5187case "$mips_type" in
5188*BSD*|'') inclwanted="$locincpth $usrinc";;
5189*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5190esac
5191for thisincl in $inclwanted; do
5192	if $test -d $thisincl; then
5193		if $test x$thisincl != x$usrinc; then
5194			case "$dflt" in
5195			*" -I$thisincl "*);;
5196			*) dflt="$dflt -I$thisincl ";;
5197			esac
5198		fi
5199	fi
5200done
5201
5202inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5203	xxx=true;
5204elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5205	xxx=true;
5206else
5207	xxx=false;
5208fi;
5209if $xxx; then
5210	case "$dflt" in
5211	*$2*);;
5212	*) dflt="$dflt -D$2";;
5213	esac;
5214fi'
5215
5216set signal.h LANGUAGE_C; eval $inctest
5217
5218case "$usesocks" in
5219$define)
5220	ccflags="$ccflags -DSOCKS"
5221	;;
5222esac
5223
5224case "$hint" in
5225default|recommended) dflt="$ccflags $dflt" ;;
5226*) dflt="$ccflags";;
5227esac
5228
5229case "$dflt" in
5230''|' ') dflt=none;;
5231esac
5232
5233$cat <<EOH
5234
5235Your C compiler may want other flags.  For this question you should include
5236-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5237but you should NOT include libraries or ld flags like -lwhatever.  If you
5238want $package to honor its debug switch, you should include -DDEBUGGING here.
5239Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5240
5241To use no flags, specify the word "none".
5242
5243EOH
5244set X $dflt
5245shift
5246dflt=${1+"$@"}
5247rp="Any additional cc flags?"
5248. ./myread
5249case "$ans" in
5250none) ccflags='';;
5251*) ccflags="$ans";;
5252esac
5253
5254: the following weeds options from ccflags that are of no interest to cpp
5255case "$cppflags" in
5256'') cppflags="$ccflags" ;;
5257*)  cppflags="$cppflags $ccflags" ;;
5258esac
5259case "$gccversion" in
52601*) cppflags="$cppflags -D__GNUC__"
5261esac
5262case "$mips_type" in
5263'');;
5264*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5265esac
5266case "$cppflags" in
5267'');;
5268*)
5269	echo " "
5270	echo "Let me guess what the preprocessor flags are..." >&4
5271	set X $cppflags
5272	shift
5273	cppflags=''
5274	$cat >cpp.c <<'EOM'
5275#define BLURFL foo
5276
5277BLURFL xx LFRULB
5278EOM
5279	previous=''
5280	for flag in $*
5281	do
5282		case "$flag" in
5283		-*) ftry="$flag";;
5284		*) ftry="$previous $flag";;
5285		esac
5286		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5287			>cpp1.out 2>/dev/null && \
5288			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5289			>cpp2.out 2>/dev/null && \
5290			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5291			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5292		then
5293			cppflags="$cppflags $ftry"
5294			previous=''
5295		else
5296			previous="$flag"
5297		fi
5298	done
5299	set X $cppflags
5300	shift
5301	cppflags=${1+"$@"}
5302	case "$cppflags" in
5303	*-*)  echo "They appear to be: $cppflags";;
5304	esac
5305	$rm -f cpp.c cpp?.out
5306	;;
5307esac
5308
5309: flags used in final linking phase
5310case "$ldflags" in
5311'') if ./venix; then
5312		dflt='-i -z'
5313	else
5314		dflt=''
5315	fi
5316	case "$ccflags" in
5317	*-posix*) dflt="$dflt -posix" ;;
5318	esac
5319	;;
5320*) dflt="$ldflags";;
5321esac
5322# See note above about -fstack-protector
5323case "$ccflags" in
5324*-fstack-protector*)
5325	case "$dflt" in
5326	*-fstack-protector*) ;; # Don't add it again
5327	*) dflt="$dflt -fstack-protector" ;;
5328	esac
5329	;;
5330esac
5331
5332: Try to guess additional flags to pick up local libraries.
5333for thislibdir in $libpth; do
5334	case " $loclibpth " in
5335	*" $thislibdir "*)
5336		case "$dflt " in
5337		*"-L$thislibdir "*) ;;
5338		*)  dflt="$dflt -L$thislibdir" ;;
5339		esac
5340		;;
5341	esac
5342done
5343
5344case "$dflt" in
5345'') dflt='none' ;;
5346esac
5347
5348$cat <<EOH
5349
5350Your C linker may need flags.  For this question you should
5351include -L/whatever and any other flags used by the C linker, but you
5352should NOT include libraries like -lwhatever.
5353
5354Make sure you include the appropriate -L/path flags if your C linker
5355does not normally search all of the directories you specified above,
5356namely
5357	$libpth
5358To use no flags, specify the word "none".
5359
5360EOH
5361
5362rp="Any additional ld flags (NOT including libraries)?"
5363. ./myread
5364case "$ans" in
5365none) ldflags='';;
5366*) ldflags="$ans";;
5367esac
5368rmlist="$rmlist pdp11"
5369
5370: coherency check
5371echo " "
5372echo "Checking your choice of C compiler and flags for coherency..." >&4
5373$cat > try.c <<'EOF'
5374#include <stdio.h>
5375int main() { printf("Ok\n"); return(0); }
5376EOF
5377set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5378shift
5379$cat >try.msg <<'EOM'
5380I've tried to compile and run the following simple program:
5381
5382EOM
5383$cat try.c >> try.msg
5384
5385$cat >> try.msg <<EOM
5386
5387I used the command:
5388
5389	$*
5390	$run ./try
5391
5392and I got the following output:
5393
5394EOM
5395dflt=y
5396if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5397	if $sh -c "$run ./try " >>try.msg 2>&1; then
5398		xxx=`$run ./try`
5399		case "$xxx" in
5400		"Ok") dflt=n ;;
5401		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
5402			case " $libs " in
5403			*" -lsfio "*)
5404				cat >> try.msg <<'EOQS'
5405If $libs contains -lsfio, and sfio is mis-configured, then it
5406sometimes (apparently) runs and exits with a 0 status, but with no
5407output!  It may have to do with sfio's use of _exit vs. exit.
5408
5409EOQS
5410				rp="You have a big problem.  Shall I abort Configure"
5411				dflt=y
5412				;;
5413			esac
5414			;;
5415		esac
5416	else
5417		echo "The program compiled OK, but exited with status $?." >>try.msg
5418		rp="You have a problem.  Shall I abort Configure"
5419		dflt=y
5420	fi
5421else
5422	echo "I can't compile the test program." >>try.msg
5423	rp="You have a BIG problem.  Shall I abort Configure"
5424	dflt=y
5425fi
5426case "$dflt" in
5427y)
5428	$cat try.msg >&4
5429	case "$knowitall" in
5430	'')
5431		echo "(The supplied flags or libraries might be incorrect.)"
5432		;;
5433	*) dflt=n;;
5434	esac
5435	echo " "
5436	. ./myread
5437	case "$ans" in
5438	n*|N*) ;;
5439	*)	echo "Ok.  Stopping Configure." >&4
5440		exit 1
5441		;;
5442	esac
5443	;;
5444n) echo "OK, that should do.";;
5445esac
5446$rm_try gcctest gcctest.out
5447
5448: define a shorthand compile call
5449compile='
5450mc_file=$1;
5451shift;
5452case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5453echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5454exit 1;
5455fi;
5456esac;
5457$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5458: define a shorthand compile call for compilations that should be ok.
5459compile_ok='
5460mc_file=$1;
5461shift;
5462$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5463
5464: determine filename position in cpp output
5465echo " "
5466echo "Computing filename position in cpp output for #include directives..." >&4
5467case "$osname" in
5468vos) testaccess=-e ;;
5469*)   testaccess=-r ;;
5470esac
5471echo '#include <stdio.h>' > foo.c
5472$cat >fieldn <<EOF
5473$startsh
5474$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5475$grep '^[ 	]*#.*stdio\.h' | \
5476while read cline; do
5477	pos=1
5478	set \$cline
5479	while $test \$# -gt 0; do
5480		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5481			echo "\$pos"
5482			exit 0
5483		fi
5484		shift
5485		pos=\`expr \$pos + 1\`
5486	done
5487done
5488EOF
5489chmod +x fieldn
5490fieldn=`./fieldn`
5491$rm -f foo.c fieldn
5492case $fieldn in
5493'') pos='???';;
54941) pos=first;;
54952) pos=second;;
54963) pos=third;;
5497*) pos="${fieldn}th";;
5498esac
5499echo "Your cpp writes the filename in the $pos field of the line."
5500
5501case "$osname" in
5502vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5503os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5504*)   cppfilter='' ;;
5505esac
5506: locate header file
5507$cat >findhdr <<EOF
5508$startsh
5509wanted=\$1
5510name=''
5511for usrincdir in $usrinc
5512do
5513	if test -f \$usrincdir/\$wanted; then
5514		echo "\$usrincdir/\$wanted"
5515		exit 0
5516	fi
5517done
5518awkprg='{ print \$$fieldn }'
5519echo "#include <\$wanted>" > foo\$\$.c
5520$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5521$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5522while read cline; do
5523	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5524	case "\$name" in
5525	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5526	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5527	*) exit 2;;
5528	esac;
5529done;
5530#
5531# status = 0: grep returned 0 lines, case statement not executed
5532# status = 1: headerfile found
5533# status = 2: while loop executed, no headerfile found
5534#
5535status=\$?
5536$rm -f foo\$\$.c;
5537if test \$status -eq 1; then
5538	exit 0;
5539fi
5540exit 1
5541EOF
5542chmod +x findhdr
5543
5544: define an alternate in-header-list? function
5545inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5546cont=true; xxf="echo \"<\$1> found.\" >&4";
5547case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5548*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5549esac;
5550case $# in 4) instead=instead;; *) instead="at last";; esac;
5551while $test "$cont"; do
5552	xxx=`./findhdr $1`
5553	var=$2; eval "was=\$$2";
5554	if $test "$xxx" && $test -r "$xxx";
5555	then eval $xxf;
5556	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5557		cont="";
5558	else eval $xxnf;
5559	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5560	set $yyy; shift; shift; yyy=$@;
5561	case $# in 0) cont="";;
5562	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5563		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5564	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5565		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5566	esac;
5567done;
5568while $test "$yyy";
5569do set $yyy; var=$2; eval "was=\$$2";
5570	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5571	set $yyy; shift; shift; yyy=$@;
5572done'
5573
5574: see if stdlib is available
5575set stdlib.h i_stdlib
5576eval $inhdr
5577
5578: check for lengths of integral types
5579echo " "
5580case "$intsize" in
5581'')
5582	echo "Checking to see how big your integers are..." >&4
5583	$cat >try.c <<EOCP
5584#include <stdio.h>
5585#$i_stdlib I_STDLIB
5586#ifdef I_STDLIB
5587#include <stdlib.h>
5588#endif
5589int main()
5590{
5591	printf("intsize=%d;\n", (int)sizeof(int));
5592	printf("longsize=%d;\n", (int)sizeof(long));
5593	printf("shortsize=%d;\n", (int)sizeof(short));
5594	exit(0);
5595}
5596EOCP
5597	set try
5598	if eval $compile_ok && $run ./try > /dev/null; then
5599		eval `$run ./try`
5600		echo "Your integers are $intsize bytes long."
5601		echo "Your long integers are $longsize bytes long."
5602		echo "Your short integers are $shortsize bytes long."
5603	else
5604		$cat >&4 <<EOM
5605!
5606Help! I can't compile and run the intsize test program: please enlighten me!
5607(This is probably a misconfiguration in your system or libraries, and
5608you really ought to fix it.  Still, I'll try anyway.)
5609!
5610EOM
5611		dflt=4
5612		rp="What is the size of an integer (in bytes)?"
5613		. ./myread
5614		intsize="$ans"
5615		dflt=$intsize
5616		rp="What is the size of a long integer (in bytes)?"
5617		. ./myread
5618		longsize="$ans"
5619		dflt=2
5620		rp="What is the size of a short integer (in bytes)?"
5621		. ./myread
5622		shortsize="$ans"
5623	fi
5624	;;
5625esac
5626$rm_try
5627
5628: check for long long
5629echo " "
5630echo "Checking to see if you have long long..." >&4
5631echo 'int main() { long long x = 7; return 0; }' > try.c
5632set try
5633if eval $compile; then
5634	val="$define"
5635	echo "You have long long."
5636else
5637	val="$undef"
5638	echo "You do not have long long."
5639fi
5640$rm_try
5641set d_longlong
5642eval $setvar
5643
5644: check for length of long long
5645case "${d_longlong}${longlongsize}" in
5646$define)
5647	echo " "
5648	echo "Checking to see how big your long longs are..." >&4
5649	$cat >try.c <<'EOCP'
5650#include <stdio.h>
5651int main()
5652{
5653    printf("%d\n", (int)sizeof(long long));
5654    return(0);
5655}
5656EOCP
5657	set try
5658	if eval $compile_ok; then
5659		longlongsize=`$run ./try`
5660		echo "Your long longs are $longlongsize bytes long."
5661	else
5662		dflt='8'
5663		echo " "
5664		echo "(I can't seem to compile the test program.  Guessing...)"
5665		rp="What is the size of a long long (in bytes)?"
5666		. ./myread
5667		longlongsize="$ans"
5668	fi
5669	if $test "X$longsize" = "X$longlongsize"; then
5670		echo "(That isn't any different from an ordinary long.)"
5671	fi
5672	;;
5673esac
5674$rm_try
5675
5676: see if inttypes.h is available
5677: we want a real compile instead of Inhdr because some systems
5678: have an inttypes.h which includes non-existent headers
5679echo " "
5680$cat >try.c <<EOCP
5681#include <inttypes.h>
5682int main() {
5683	static int32_t foo32 = 0x12345678;
5684}
5685EOCP
5686set try
5687if eval $compile; then
5688	echo "<inttypes.h> found." >&4
5689	val="$define"
5690else
5691	echo "<inttypes.h> NOT found." >&4
5692	val="$undef"
5693fi
5694$rm_try
5695set i_inttypes
5696eval $setvar
5697
5698: check for int64_t
5699echo " "
5700echo "Checking to see if you have int64_t..." >&4
5701$cat >try.c <<EOCP
5702#include <sys/types.h>
5703#$i_inttypes I_INTTYPES
5704#ifdef I_INTTYPES
5705#include <inttypes.h>
5706#endif
5707int main() { int64_t x = 7; }
5708EOCP
5709set try
5710if eval $compile; then
5711	val="$define"
5712	echo "You have int64_t."
5713else
5714	val="$undef"
5715	echo "You do not have int64_t."
5716fi
5717$rm_try
5718set d_int64_t
5719eval $setvar
5720
5721: Check if 64bit ints have a quad type
5722echo " "
5723echo "Checking which 64-bit integer type we could use..." >&4
5724
5725case "$intsize" in
57268) val=int
5727   set quadtype
5728   eval $setvar
5729   val='"unsigned int"'
5730   set uquadtype
5731   eval $setvar
5732   quadkind=1
5733   ;;
5734*) case "$longsize" in
5735   8) val=long
5736      set quadtype
5737      eval $setvar
5738      val='"unsigned long"'
5739      set uquadtype
5740      eval $setvar
5741      quadkind=2
5742      ;;
5743   *) case "$d_longlong:$longlongsize" in
5744      define:8)
5745        val='"long long"'
5746        set quadtype
5747        eval $setvar
5748        val='"unsigned long long"'
5749        set uquadtype
5750        eval $setvar
5751        quadkind=3
5752        ;;
5753      *) case "$d_int64_t" in
5754         define)
5755           val=int64_t
5756           set quadtype
5757           eval $setvar
5758           val=uint64_t
5759           set uquadtype
5760           eval $setvar
5761           quadkind=4
5762           ;;
5763         esac
5764         ;;
5765      esac
5766      ;;
5767   esac
5768   ;;
5769esac
5770
5771case "$quadtype" in
5772'')	echo "Alas, no 64-bit integer types in sight." >&4
5773	d_quad="$undef"
5774	;;
5775*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5776	d_quad="$define"
5777	;;
5778esac
5779
5780: Do we want 64bit support
5781case "$uselonglong" in
5782"$define"|true|[yY]*)
5783	cat <<EOM >&4
5784
5785*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5786EOM
5787	use64bitint="$define"
5788	;;
5789esac
5790case "$use64bits" in
5791"$define"|true|[yY]*)
5792	cat <<EOM >&4
5793
5794*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5795EOM
5796	use64bitint="$define"
5797	;;
5798esac
5799case "$use64bitints" in
5800"$define"|true|[yY]*)
5801	cat <<EOM >&4
5802
5803*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5804EOM
5805	use64bitint="$define"
5806	;;
5807esac
5808case "$use64bitsint" in
5809"$define"|true|[yY]*)
5810	cat <<EOM >&4
5811
5812*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5813EOM
5814	use64bitint="$define"
5815	;;
5816esac
5817case "$uselonglongs" in
5818"$define"|true|[yY]*)
5819	cat <<EOM >&4
5820
5821*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5822EOM
5823	use64bitint="$define"
5824	;;
5825esac
5826case "$use64bitsall" in
5827"$define"|true|[yY]*)
5828	cat <<EOM >&4
5829
5830*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5831EOM
5832	use64bitall="$define"
5833	;;
5834esac
5835
5836case "$ccflags" in
5837*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5838esac
5839case "$use64bitall" in
5840"$define"|true|[yY]*) use64bitint="$define" ;;
5841esac
5842
5843case "$longsize" in
58448) cat <<EOM
5845
5846You have natively 64-bit long integers.
5847EOM
5848   val="$define"
5849   ;;
5850*) case "$use64bitint" in
5851   "$define"|true|[yY]*) dflt='y';;
5852   *) dflt='n';;
5853   esac
5854   case "$d_quad" in
5855   "$define") ;;
5856   *) dflt='n' ;;
5857   esac
5858   cat <<EOM
5859
5860Perl can be built to take advantage of 64-bit integer types
5861on some systems.  To do so, Configure can be run with -Duse64bitint.
5862Choosing this option will most probably introduce binary incompatibilities.
5863
5864If this doesn't make any sense to you, just accept the default '$dflt'.
5865(The default has been chosen based on your configuration.)
5866EOM
5867   rp='Try to use 64-bit integers, if available?'
5868   . ./myread
5869   case "$ans" in
5870   [yY]*) val="$define" ;;
5871   *)     val="$undef"  ;;
5872   esac
5873   ;;
5874esac
5875set use64bitint
5876eval $setvar
5877
5878case "$use64bitall" in
5879"$define"|true|[yY]*) dflt='y' ;;
5880*) case "$longsize" in
5881   8) dflt='y' ;;
5882   *) dflt='n' ;;
5883   esac
5884   ;;
5885esac
5886cat <<EOM
5887
5888You may also choose to try maximal 64-bitness.  It means using as much
588964-bitness as possible on the platform.  This in turn means even more
5890binary incompatibilities.  On the other hand, your platform may not
5891have any more 64-bitness available than what you already have chosen.
5892
5893If this doesn't make any sense to you, just accept the default '$dflt'.
5894(The default has been chosen based on your configuration.)
5895EOM
5896rp='Try to use maximal 64-bit support, if available?'
5897. ./myread
5898case "$ans" in
5899[yY]*) val="$define" ;;
5900*)     val="$undef"  ;;
5901esac
5902set use64bitall
5903eval $setvar
5904case "$use64bitall" in
5905"$define")
5906	case "$use64bitint" in
5907	"$undef")
5908		cat <<EOM
5909
5910Since you have chosen a maximally 64-bit build, I'm also turning on
5911the use of 64-bit integers.
5912EOM
5913		use64bitint="$define" ;;
5914	esac
5915	;;
5916esac
5917
5918: Look for a hint-file generated 'call-back-unit'.  If the
5919: user has specified that a 64-bit perl is to be built,
5920: we may need to set or change some other defaults.
5921if $test -f use64bitint.cbu; then
5922	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5923	. ./use64bitint.cbu
5924fi
5925case "$use64bitint" in
5926"$define"|true|[yY]*)
5927	case "$longsize" in
5928	4) case "$archname64" in
5929	   '') archname64=64int ;;
5930	   esac
5931	   ;;
5932	esac
5933	;;
5934esac
5935
5936: Look for a hint-file generated 'call-back-unit'.  If the
5937: user has specified that a maximally 64-bit perl is to be built,
5938: we may need to set or change some other defaults.
5939if $test -f use64bitall.cbu; then
5940	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5941	. ./use64bitall.cbu
5942fi
5943case "$use64bitall" in
5944"$define"|true|[yY]*)
5945	case "$longsize" in
5946	4) case "$archname64" in
5947	   ''|64int) archname64=64all ;;
5948	   esac
5949	   ;;
5950	esac
5951	;;
5952esac
5953
5954case "$d_quad:$use64bitint" in
5955$undef:$define)
5956	cat >&4 <<EOF
5957
5958*** You have chosen to use 64-bit integers,
5959*** but none can be found.
5960*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5961*** Cannot continue, aborting.
5962
5963EOF
5964	exit 1
5965	;;
5966esac
5967
5968: check for length of double
5969echo " "
5970case "$doublesize" in
5971'')
5972	echo "Checking to see how big your double precision numbers are..." >&4
5973	$cat >try.c <<EOCP
5974#include <stdio.h>
5975#$i_stdlib I_STDLIB
5976#ifdef I_STDLIB
5977#include <stdlib.h>
5978#endif
5979int main()
5980{
5981    printf("%d\n", (int)sizeof(double));
5982    exit(0);
5983}
5984EOCP
5985	set try
5986	if eval $compile_ok; then
5987		doublesize=`$run ./try`
5988		echo "Your double is $doublesize bytes long."
5989	else
5990		dflt='8'
5991		echo "(I can't seem to compile the test program.  Guessing...)"
5992		rp="What is the size of a double precision number (in bytes)?"
5993		. ./myread
5994		doublesize="$ans"
5995	fi
5996	;;
5997esac
5998$rm_try
5999
6000: check for long doubles
6001echo " "
6002echo "Checking to see if you have long double..." >&4
6003echo 'int main() { long double x = 7.0; }' > try.c
6004set try
6005if eval $compile; then
6006	val="$define"
6007	echo "You have long double."
6008else
6009	val="$undef"
6010	echo "You do not have long double."
6011fi
6012$rm_try
6013set d_longdbl
6014eval $setvar
6015
6016: check for length of long double
6017case "${d_longdbl}${longdblsize}" in
6018$define)
6019	echo " "
6020	echo "Checking to see how big your long doubles are..." >&4
6021	$cat >try.c <<'EOCP'
6022#include <stdio.h>
6023int main()
6024{
6025	printf("%d\n", sizeof(long double));
6026}
6027EOCP
6028	set try
6029	set try
6030	if eval $compile; then
6031		longdblsize=`$run ./try`
6032		echo "Your long doubles are $longdblsize bytes long."
6033	else
6034		dflt='8'
6035		echo " "
6036		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6037		rp="What is the size of a long double (in bytes)?"
6038		. ./myread
6039		longdblsize="$ans"
6040	fi
6041	if $test "X$doublesize" = "X$longdblsize"; then
6042		echo "That isn't any different from an ordinary double."
6043		echo "I'll keep your setting anyway, but you may see some"
6044		echo "harmless compilation warnings."
6045	fi
6046	;;
6047esac
6048$rm_try
6049
6050: determine the architecture name
6051echo " "
6052if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6053	tarch=`arch`"-$osname"
6054elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6055	if uname -m > tmparch 2>&1 ; then
6056		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6057			-e 's/$/'"-$osname/" tmparch`
6058	else
6059		tarch="$osname"
6060	fi
6061	$rm -f tmparch
6062else
6063	tarch="$osname"
6064fi
6065case "$myarchname" in
6066''|"$tarch") ;;
6067*)
6068	echo "(Your architecture name used to be $myarchname.)"
6069	archname=''
6070	;;
6071esac
6072case "$targetarch" in
6073'') ;;
6074*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6075esac
6076myarchname="$tarch"
6077case "$archname" in
6078'') dflt="$tarch";;
6079*) dflt="$archname";;
6080esac
6081rp='What is your architecture name'
6082. ./myread
6083archname="$ans"
6084case "$usethreads" in
6085$define)
6086	echo "Threads selected." >&4
6087	case "$archname" in
6088        *-thread*) echo "...and architecture name already has -thread." >&4
6089                ;;
6090        *)      archname="$archname-thread"
6091                echo "...setting architecture name to $archname." >&4
6092                ;;
6093        esac
6094	;;
6095esac
6096case "$usemultiplicity" in
6097$define)
6098	echo "Multiplicity selected." >&4
6099	case "$archname" in
6100        *-multi*) echo "...and architecture name already has -multi." >&4
6101                ;;
6102        *)      archname="$archname-multi"
6103                echo "...setting architecture name to $archname." >&4
6104                ;;
6105        esac
6106	;;
6107esac
6108case "$use64bitint$use64bitall" in
6109*"$define"*)
6110	case "$archname64" in
6111	'')
6112		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6113		;;
6114	*)
6115		case "$use64bitint" in
6116		"$define") echo "64 bit integers selected." >&4 ;;
6117		esac
6118		case "$use64bitall" in
6119		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6120		esac
6121		case "$archname" in
6122	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6123	                ;;
6124	        *)      archname="$archname-$archname64"
6125	                echo "...setting architecture name to $archname." >&4
6126	                ;;
6127	        esac
6128		;;
6129	esac
6130esac
6131case "$uselongdouble" in
6132$define)
6133	echo "Long doubles selected." >&4
6134	case "$longdblsize" in
6135	$doublesize)
6136		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6137		;;
6138	*)
6139		case "$archname" in
6140	        *-ld*) echo "...and architecture name already has -ld." >&4
6141	                ;;
6142	        *)      archname="$archname-ld"
6143	                echo "...setting architecture name to $archname." >&4
6144        	        ;;
6145	        esac
6146		;;
6147	esac
6148	;;
6149esac
6150case "$useperlio" in
6151$define)
6152	echo "Perlio selected." >&4
6153	;;
6154*)
6155	echo "Perlio not selected, using stdio." >&4
6156	case "$archname" in
6157        *-stdio*) echo "...and architecture name already has -stdio." >&4
6158                ;;
6159        *)      archname="$archname-stdio"
6160                echo "...setting architecture name to $archname." >&4
6161                ;;
6162        esac
6163	;;
6164esac
6165if $test -f archname.cbu; then
6166	echo "Your platform has some specific hints for architecture name, using them..."
6167	. ./archname.cbu
6168fi
6169
6170: set the prefixit variable, to compute a suitable default value
6171prefixit='case "$3" in
6172""|none)
6173	case "$oldprefix" in
6174	"") eval "$1=\"\$$2\"";;
6175	*)
6176		case "$3" in
6177		"") eval "$1=";;
6178		none)
6179			eval "tp=\"\$$2\"";
6180			case "$tp" in
6181			""|" ") eval "$1=\"\$$2\"";;
6182			*) eval "$1=";;
6183			esac;;
6184		esac;;
6185	esac;;
6186*)
6187	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6188	case "$tp" in
6189	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6190	/*-$oldprefix/*|\~*-$oldprefix/*)
6191		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6192	*) eval "$1=\"\$$2\"";;
6193	esac;;
6194esac'
6195
6196: determine installation style
6197: For now, try to deduce it from prefix unless it is already set.
6198: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6199case "$installstyle" in
6200'')	case "$prefix" in
6201		*perl*) dflt='lib';;
6202		*) dflt='lib/perl5' ;;
6203	esac
6204	;;
6205*)	dflt="$installstyle" ;;
6206esac
6207: Probably not worth prompting for this since we prompt for all
6208: the directories individually, and the prompt would be too long and
6209: confusing anyway.
6210installstyle=$dflt
6211
6212: determine where public executables go
6213echo " "
6214set dflt bin bin
6215eval $prefixit
6216fn=d~
6217rp='Pathname where the public executables will reside?'
6218. ./getfile
6219if $test "X$ansexp" != "X$binexp"; then
6220	installbin=''
6221fi
6222prefixvar=bin
6223: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6224: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6225:     this via initialinstalllocation
6226. ./setprefixvar
6227
6228case "$userelocatableinc" in
6229$define|true|[yY]*)	dflt='y' ;;
6230*)			dflt='n' ;;
6231esac
6232cat <<EOM
6233
6234Would you like to build Perl so that the installation is relocatable, so that
6235library paths in @INC are determined relative to the path of the perl binary?
6236This is not advised for system Perl installs, or if you need to run setid
6237scripts or scripts under taint mode.
6238
6239If this doesn't make any sense to you, just accept the default '$dflt'.
6240EOM
6241rp='Use relocatable @INC?'
6242. ./myread
6243case "$ans" in
6244y|Y)	val="$define" ;;
6245*)	val="$undef"  ;;
6246esac
6247set userelocatableinc
6248eval $setvar
6249
6250initialinstalllocation="$binexp"
6251: Default prefix is now "up one level from where the binaries are"
6252case "$userelocatableinc" in
6253$define|true|[yY]*)
6254    bin=".../"
6255    binexp=".../"
6256    prefix=".../.."
6257    prefixexp=".../.."
6258    installprefixexp=".../.."
6259    ;;
6260esac
6261
6262: determine where private library files go
6263: Usual default is /usr/local/lib/perl5/$version.
6264: Also allow things like /opt/perl/lib/$version, since
6265: /opt/perl/lib/perl5... would be redundant.
6266: The default "style" setting is made in installstyle.U
6267case "$installstyle" in
6268*lib/perl5*) set dflt privlib lib/$package/$version ;;
6269*)	 set dflt privlib lib/$version ;;
6270esac
6271eval $prefixit
6272$cat <<EOM
6273
6274There are some auxiliary files for $package that need to be put into a
6275private library directory that is accessible by everyone.
6276
6277EOM
6278fn=$binexp
6279fn=d~+
6280rp='Pathname where the private library files will reside?'
6281. ./getfile
6282prefixvar=privlib
6283. ./setprefixvar
6284
6285: set the prefixup variable, to restore leading tilda escape
6286prefixup='case "$prefixexp" in
6287"$prefix") ;;
6288*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6289esac'
6290
6291: determine where public architecture dependent libraries go
6292set archlib archlib
6293eval $prefixit
6294: privlib default is /usr/local/lib/$package/$version
6295: archlib default is /usr/local/lib/$package/$version/$archname
6296: privlib may have an optional trailing /share.
6297tdflt=`echo $privlib | $sed 's,/share$,,'`
6298tdflt=$tdflt/$archname
6299case "$archlib" in
6300'')	dflt=$tdflt
6301	;;
6302*)	dflt="$archlib"
6303    ;;
6304esac
6305$cat <<EOM
6306
6307$spackage contains architecture-dependent library files.  If you are
6308sharing libraries in a heterogeneous environment, you might store
6309these files in a separate location.  Otherwise, you can just include
6310them with the rest of the public library files.
6311
6312EOM
6313fn=$binexp
6314fn=d+~
6315rp='Where do you want to put the public architecture-dependent libraries?'
6316. ./getfile
6317prefixvar=archlib
6318. ./setprefixvar
6319if $test X"$archlib" = X"$privlib"; then
6320	d_archlib="$undef"
6321else
6322	d_archlib="$define"
6323fi
6324
6325: see if setuid scripts can be secure
6326$cat <<EOM
6327
6328Some kernels have a bug that prevents setuid #! scripts from being
6329secure.  Some sites have disabled setuid #! scripts because of this.
6330
6331First let's decide if your kernel supports secure setuid #! scripts.
6332(If setuid #! scripts would be secure but have been disabled anyway,
6333don't say that they are secure if asked.)
6334
6335EOM
6336
6337val="$undef"
6338if $test -d /dev/fd; then
6339	echo "#!$ls" >reflect
6340	chmod +x,u+s reflect
6341	./reflect >flect 2>&1
6342	if $contains "/dev/fd" flect >/dev/null; then
6343		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6344		val="$define"
6345	else
6346		$cat <<EOM
6347If you are not sure if they are secure, I can check but I'll need a
6348username and password different from the one you are using right now.
6349If you don't have such a username or don't want me to test, simply
6350enter 'none'.
6351
6352EOM
6353		rp='Other username to test security of setuid scripts with?'
6354		dflt='none'
6355		. ./myread
6356		case "$ans" in
6357		n|none)
6358			case "$d_suidsafe" in
6359			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6360				dflt=n;;
6361			"$undef")
6362				echo "Well, the $hint value is *not* secure." >&4
6363				dflt=n;;
6364			*)	echo "Well, the $hint value *is* secure." >&4
6365				dflt=y;;
6366			esac
6367			;;
6368		*)
6369			$rm -f reflect flect
6370			echo "#!$ls" >reflect
6371			chmod +x,u+s reflect
6372			echo >flect
6373			chmod a+w flect
6374			echo '"su" will (probably) prompt you for '"$ans's password."
6375			su $ans -c './reflect >flect'
6376			if $contains "/dev/fd" flect >/dev/null; then
6377				echo "Okay, it looks like setuid scripts are secure." >&4
6378				dflt=y
6379			else
6380				echo "I don't think setuid scripts are secure." >&4
6381				dflt=n
6382			fi
6383			;;
6384		esac
6385		rp='Does your kernel have *secure* setuid scripts?'
6386		. ./myread
6387		case "$ans" in
6388		[yY]*)	val="$define";;
6389		*)	val="$undef";;
6390		esac
6391	fi
6392else
6393	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6394	echo "(That's for file descriptors, not floppy disks.)"
6395	val="$undef"
6396fi
6397set d_suidsafe
6398eval $setvar
6399
6400$rm -f reflect flect
6401
6402: now see if they want to do setuid emulation
6403if $test $patchlevel -lt 11; then
6404echo " "
6405val="$undef"
6406case "$d_suidsafe" in
6407"$define")
6408	val="$undef"
6409	echo "No need to emulate SUID scripts since they are secure here." >&4
6410	;;
6411*)
6412	$cat <<EOM
6413Some systems have disabled setuid scripts, especially systems where
6414setuid scripts cannot be secure.  On systems where setuid scripts have
6415been disabled, the setuid/setgid bits on scripts are currently
6416useless.  It is possible for $package to detect those bits and emulate
6417setuid/setgid in a secure fashion.  This emulation will only work if
6418setuid scripts have been disabled in your kernel.
6419
6420EOM
6421	case "$d_dosuid" in
6422	"$define") dflt=y ;;
6423	*) dflt=n ;;
6424	esac
6425	rp="Do you want to do setuid/setgid emulation?"
6426	. ./myread
6427	case "$ans" in
6428	[yY]*)	val="$define";;
6429	*)	val="$undef";;
6430	esac
6431	;;
6432esac
6433set d_dosuid
6434eval $setvar
6435else
6436    case "$d_dosuid" in
6437	"$define")
6438	cat >&4 <<EOH
6439
6440SUID emulation has been removed for 5.12
6441Please re-run Configure without -Dd_dosuid
6442
6443EOH
6444	exit 1;
6445	;;
6446    esac
6447    d_dosuid=undef
6448fi
6449
6450: Find perl5.005 or later.
6451echo "Looking for a previously installed perl5.005 or later... "
6452case "$perl5" in
6453'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6454		: Check if this perl is recent and can load a simple module
6455		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6456			perl5=$tdir/perl
6457			break;
6458		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6459			perl5=$tdir/perl5
6460			break;
6461		fi
6462	done
6463	;;
6464*)	perl5="$perl5"
6465	;;
6466esac
6467case "$perl5" in
6468'')	echo "None found.  That's ok.";;
6469*)	echo "Using $perl5." ;;
6470esac
6471
6472: Set the siteprefix variables
6473$cat <<EOM
6474
6475After $package is installed, you may wish to install various
6476add-on modules and utilities.  Typically, these add-ons will
6477be installed under $prefix with the rest
6478of this package.  However, you may wish to install such add-ons
6479elsewhere under a different prefix.
6480
6481If you do not wish to put everything under a single prefix, that's
6482ok.  You will be prompted for the individual locations; this siteprefix
6483is only used to suggest the defaults.
6484
6485The default should be fine for most people.
6486
6487EOM
6488fn=d~+
6489rp='Installation prefix to use for add-on modules and utilities?'
6490: XXX Here might be another good place for an installstyle setting.
6491case "$siteprefix" in
6492'') dflt=$prefix ;;
6493*)  dflt=$siteprefix ;;
6494esac
6495. ./getfile
6496: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6497oldsiteprefix=''
6498case "$siteprefix" in
6499'') ;;
6500*)	case "$ans" in
6501	"$prefix") ;;
6502	*) oldsiteprefix="$prefix";;
6503	esac
6504	;;
6505esac
6506siteprefix="$ans"
6507siteprefixexp="$ansexp"
6508
6509: determine where site specific libraries go.
6510: Usual default is /usr/local/lib/perl5/site_perl/$version
6511: The default "style" setting is made in installstyle.U
6512: XXX No longer works with Prefixit stuff.
6513prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6514case "$sitelib" in
6515'') case "$installstyle" in
6516	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6517	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6518	esac
6519	;;
6520*)	dflt="$sitelib"
6521	;;
6522esac
6523$cat <<EOM
6524
6525The installation process will create a directory for
6526site-specific extensions and modules.  Most users find it convenient
6527to place all site-specific files in this directory rather than in the
6528main distribution directory.
6529
6530EOM
6531fn=d~+
6532rp='Pathname for the site-specific library files?'
6533. ./getfile
6534prefixvar=sitelib
6535. ./setprefixvar
6536sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6537
6538: Determine list of previous versions to include in @INC
6539$cat > getverlist <<EOPL
6540#!$perl5 -w
6541use File::Basename;
6542\$api_versionstring = "$api_versionstring";
6543\$version = "$version";
6544\$stem = "$sitelib_stem";
6545\$archname = "$archname";
6546EOPL
6547	$cat >> getverlist <<'EOPL'
6548# The list found is store twice for each entry: the original name, and
6549# the binary broken down version as pack "sss", so sorting is easy and
6550# unambiguous. This will work for all versions that have a maximum of
6551# three digit groups, separate by '.'s or '_'s. Names are extended with
6552# ".0.0" to ensure at least three elements for the pack.
6553#					-- H.Merijn Brand (m)'06 23-10-2006
6554
6555# Can't have leading @ because metaconfig interprets it as a command!
6556;@inc_version_list=();
6557# XXX Redo to do opendir/readdir?
6558if (-d $stem) {
6559    chdir($stem);
6560    ;@candidates = map {
6561	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6562    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6563}
6564else {
6565    ;@candidates = ();
6566}
6567
6568($pversion, $aversion, $vsn5005) = map {
6569    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6570foreach $d (@candidates) {
6571    if ($d->[1] lt $pversion) {
6572	if ($d->[1] ge $aversion) {
6573	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6574	}
6575	elsif ($d->[1] ge $vsn5005) {
6576	    unshift(@inc_version_list, grep { -d } $d->[0]);
6577	}
6578    }
6579    else {
6580	# Skip newer version.  I.e. don't look in
6581	# 5.7.0 if we're installing 5.6.1.
6582    }
6583}
6584
6585if (@inc_version_list) {
6586    print join(' ', @inc_version_list);
6587}
6588else {
6589    # Blank space to preserve value for next Configure run.
6590    print " ";
6591}
6592EOPL
6593chmod +x getverlist
6594case "$inc_version_list" in
6595'')	if test -x "$perl5$exe_ext"; then
6596		dflt=`$perl5 getverlist`
6597	else
6598		dflt='none'
6599	fi
6600	;;
6601$undef) dflt='none' ;;
6602*)  eval dflt=\"$inc_version_list\" ;;
6603esac
6604case "$dflt" in
6605''|' ') dflt=none ;;
6606esac
6607case "$dflt" in
66085.005) dflt=none ;;
6609esac
6610$cat <<EOM
6611
6612In order to ease the process of upgrading, this version of perl
6613can be configured to use modules built and installed with earlier
6614versions of perl that were installed under $prefix.  Specify here
6615the list of earlier versions that this version of perl should check.
6616If Configure detected no earlier versions of perl installed under
6617$prefix, then the list will be empty.  Answer 'none' to tell perl
6618to not search earlier versions.
6619
6620The default should almost always be sensible, so if you're not sure,
6621just accept the default.
6622EOM
6623
6624rp='List of earlier versions to include in @INC?'
6625. ./myread
6626case "$ans" in
6627[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6628*) inc_version_list="$ans" ;;
6629esac
6630case "$inc_version_list" in
6631''|' ')
6632	inc_version_list_init='0'
6633	d_inc_version_list="$undef"
6634	;;
6635*)	inc_version_list_init=`echo $inc_version_list |
6636		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6637	d_inc_version_list="$define"
6638	;;
6639esac
6640$rm -f getverlist
6641
6642: see if malloc/malloc.h has to be included
6643set malloc/malloc.h i_mallocmalloc
6644eval $inhdr
6645
6646: see if this is a malloc.h system
6647: we want a real compile instead of Inhdr because some systems have a
6648: malloc.h that just gives a compile error saying to use stdlib.h instead
6649echo " "
6650$cat >try.c <<EOCP
6651#include <stdlib.h>
6652#include <malloc.h>
6653#$i_mallocmalloc I_MALLOCMALLOC
6654#ifdef I_MALLOCMALLOC
6655# include <malloc/malloc.h>
6656#endif
6657
6658int main () { return 0; }
6659EOCP
6660set try
6661if eval $compile; then
6662    echo "<malloc.h> found." >&4
6663    val="$define"
6664else
6665    echo "<malloc.h> NOT found." >&4
6666    val="$undef"
6667fi
6668$rm_try
6669set i_malloc
6670eval $setvar
6671
6672: check for void type
6673echo " "
6674echo "Checking to see how well your C compiler groks the void type..." >&4
6675case "$voidflags" in
6676'')
6677	$cat >try.c <<EOCP
6678#$i_stdlib I_STDLIB
6679#ifdef I_STDLIB
6680#include <stdlib.h>
6681#endif
6682#if TRY & 1
6683void sub() {
6684#else
6685sub() {
6686#endif
6687	extern void moo();	/* function returning void */
6688	void (*goo)();		/* ptr to func returning void */
6689#if TRY & 8
6690	void *hue;		/* generic ptr */
6691#endif
6692#if TRY & 2
6693	void (*foo[10])();
6694#endif
6695
6696#if TRY & 4
6697	if(goo == moo) {
6698		exit(0);
6699	}
6700#endif
6701	exit(0);
6702}
6703int main() { sub(); }
6704EOCP
6705	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6706		voidflags=$defvoidused
6707	echo "Good.  It appears to support void to the level $package wants.">&4
6708		if $contains warning .out >/dev/null 2>&1; then
6709			echo "However, you might get some warnings that look like this:"
6710			$cat .out
6711		fi
6712	else
6713echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6714		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6715			echo "It supports 1..."
6716			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6717				echo "It also supports 2..."
6718				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6719					voidflags=7
6720					echo "And it supports 4 but not 8 definitely."
6721				else
6722					echo "It doesn't support 4..."
6723					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6724						voidflags=11
6725						echo "But it supports 8."
6726					else
6727						voidflags=3
6728						echo "Neither does it support 8."
6729					fi
6730				fi
6731			else
6732				echo "It does not support 2..."
6733				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6734					voidflags=13
6735					echo "But it supports 4 and 8."
6736				else
6737					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6738						voidflags=5
6739						echo "And it supports 4 but has not heard about 8."
6740					else
6741						echo "However it supports 8 but not 4."
6742					fi
6743				fi
6744			fi
6745		else
6746			echo "There is no support at all for void."
6747			voidflags=0
6748		fi
6749	fi
6750esac
6751case "$voidflags" in
6752"$defvoidused") ;;
6753*)	$cat >&4 <<'EOM'
6754  Support flag bits are:
6755    1: basic void declarations.
6756    2: arrays of pointers to functions returning void.
6757    4: operations between pointers to and addresses of void functions.
6758    8: generic void pointers.
6759EOM
6760	dflt="$voidflags";
6761	rp="Your void support flags add up to what?"
6762	. ./myread
6763	voidflags="$ans"
6764	;;
6765esac
6766$rm_try
6767
6768: check for length of pointer
6769echo " "
6770case "$ptrsize" in
6771'')
6772	echo "Checking to see how big your pointers are..." >&4
6773	if test "$voidflags" -gt 7; then
6774		echo '#define VOID_PTR char *' > try.c
6775	else
6776		echo '#define VOID_PTR void *' > try.c
6777	fi
6778	$cat >>try.c <<EOCP
6779#include <stdio.h>
6780#$i_stdlib I_STDLIB
6781#ifdef I_STDLIB
6782#include <stdlib.h>
6783#endif
6784int main()
6785{
6786    printf("%d\n", (int)sizeof(VOID_PTR));
6787    exit(0);
6788}
6789EOCP
6790	set try
6791	if eval $compile_ok; then
6792		ptrsize=`$run ./try`
6793		echo "Your pointers are $ptrsize bytes long."
6794	else
6795		dflt='4'
6796		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6797		rp="What is the size of a pointer (in bytes)?"
6798		. ./myread
6799		ptrsize="$ans"
6800	fi
6801	;;
6802esac
6803$rm_try
6804case "$use64bitall" in
6805"$define"|true|[yY]*)
6806	case "$ptrsize" in
6807	4)	cat <<EOM >&4
6808
6809*** You have chosen a maximally 64-bit build,
6810*** but your pointers are only 4 bytes wide.
6811*** Please rerun Configure without -Duse64bitall.
6812EOM
6813		case "$d_quad" in
6814		define)
6815			cat <<EOM >&4
6816*** Since you have quads, you could possibly try with -Duse64bitint.
6817EOM
6818			;;
6819		esac
6820		cat <<EOM >&4
6821*** Cannot continue, aborting.
6822
6823EOM
6824
6825		exit 1
6826		;;
6827	esac
6828	;;
6829esac
6830
6831
6832: determine whether to use malloc wrapping
6833echo " "
6834case "$usemallocwrap" in
6835[yY]*|true|$define)	dflt='y' ;;
6836[nN]*|false|$undef)	dflt='n' ;;
6837*)	case "$usedevel" in
6838	[yY]*|true|$define)	dflt='y' ;;
6839	*) dflt='n' ;;
6840	esac
6841	;;
6842esac
6843rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6844. ./myread
6845usemallocwrap="$ans"
6846case "$ans" in
6847y*|true)
6848	usemallocwrap="$define" ;;
6849*)
6850	usemallocwrap="$undef" ;;
6851esac
6852
6853: determine which malloc to compile in
6854echo " "
6855case "$usemymalloc" in
6856[yY]*|true|$define)	dflt='y' ;;
6857[nN]*|false|$undef)	dflt='n' ;;
6858*)	case "$ptrsize" in
6859	4) dflt='y' ;;
6860	*) dflt='n' ;;
6861	esac
6862	;;
6863esac
6864rp="Do you wish to attempt to use the malloc that comes with $package?"
6865. ./myread
6866usemymalloc="$ans"
6867case "$ans" in
6868y*|true)
6869	usemymalloc='y'
6870	mallocsrc='malloc.c'
6871	mallocobj="malloc$_o"
6872	d_mymalloc="$define"
6873	case "$libs" in
6874	*-lmalloc*)
6875		: Remove malloc from list of libraries to use
6876		echo "Removing unneeded -lmalloc from library list" >&4
6877		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6878		shift
6879		libs="$*"
6880		echo "libs = $libs" >&4
6881		;;
6882	esac
6883	;;
6884*)
6885	usemymalloc='n'
6886	mallocsrc=''
6887	mallocobj=''
6888	d_mymalloc="$undef"
6889	;;
6890esac
6891
6892: compute the return types of malloc and free
6893echo " "
6894$cat >malloc.c <<END
6895#$i_malloc I_MALLOC
6896#$i_stdlib I_STDLIB
6897#include <stdio.h>
6898#include <sys/types.h>
6899#ifdef I_MALLOC
6900#include <malloc.h>
6901#endif
6902#ifdef I_STDLIB
6903#include <stdlib.h>
6904#endif
6905#ifdef TRY_MALLOC
6906void *malloc();
6907#endif
6908#ifdef TRY_FREE
6909void free();
6910#endif
6911END
6912case "$malloctype" in
6913'')
6914	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6915		malloctype='void *'
6916	else
6917		malloctype='char *'
6918	fi
6919	;;
6920esac
6921echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6922
6923case "$freetype" in
6924'')
6925	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6926		freetype='void'
6927	else
6928		freetype='int'
6929	fi
6930	;;
6931esac
6932echo "Your system uses $freetype free(), it would seem." >&4
6933$rm -f malloc.[co]
6934: determine where site specific architecture-dependent libraries go.
6935: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6936: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6937: sitelib may have an optional trailing /share.
6938case "$sitearch" in
6939'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6940	dflt="$dflt/$archname"
6941	;;
6942*)	dflt="$sitearch"
6943	;;
6944esac
6945set sitearch sitearch none
6946eval $prefixit
6947$cat <<EOM
6948
6949The installation process will also create a directory for
6950architecture-dependent site-specific extensions and modules.
6951
6952EOM
6953fn=d~+
6954rp='Pathname for the site-specific architecture-dependent library files?'
6955. ./getfile
6956prefixvar=sitearch
6957. ./setprefixvar
6958if $test X"$sitearch" = X"$sitelib"; then
6959	d_sitearch="$undef"
6960else
6961	d_sitearch="$define"
6962fi
6963
6964: Set the vendorprefix variables
6965$cat <<EOM
6966
6967The installation process will also create a directory for
6968vendor-supplied add-ons.  Vendors who supply perl with their system
6969may find it convenient to place all vendor-supplied files in this
6970directory rather than in the main distribution directory.  This will
6971ease upgrades between binary-compatible maintenance versions of perl.
6972
6973Of course you may also use these directories in whatever way you see
6974fit.  For example, you might use them to access modules shared over a
6975company-wide network.
6976
6977The default answer should be fine for most people.
6978This causes further questions about vendor add-ons to be skipped
6979and no vendor-specific directories will be configured for perl.
6980
6981EOM
6982rp='Do you want to configure vendor-specific add-on directories?'
6983case "$usevendorprefix" in
6984define|true|[yY]*) dflt=y ;;
6985*)	: User may have set vendorprefix directly on Configure command line.
6986	case "$vendorprefix" in
6987	''|' ') dflt=n ;;
6988	*)	dflt=y ;;
6989	esac
6990	;;
6991esac
6992. ./myread
6993case "$ans" in
6994[yY]*)	fn=d~+
6995	rp='Installation prefix to use for vendor-supplied add-ons?'
6996	case "$vendorprefix" in
6997	'') dflt='' ;;
6998	*)  dflt=$vendorprefix ;;
6999	esac
7000	. ./getfile
7001	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7002	oldvendorprefix=''
7003	case "$vendorprefix" in
7004	'') ;;
7005	*)	case "$ans" in
7006		"$prefix") ;;
7007		*) oldvendorprefix="$prefix";;
7008		esac
7009		;;
7010	esac
7011	usevendorprefix="$define"
7012	vendorprefix="$ans"
7013	vendorprefixexp="$ansexp"
7014	;;
7015*)	usevendorprefix="$undef"
7016	vendorprefix=''
7017	vendorprefixexp=''
7018	;;
7019esac
7020
7021: Set the vendorlib variables
7022case "$vendorprefix" in
7023'')	d_vendorlib="$undef"
7024	vendorlib=''
7025	vendorlibexp=''
7026	;;
7027*)	d_vendorlib="$define"
7028	: determine where vendor-supplied modules go.
7029	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
7030	case "$vendorlib" in
7031	'')
7032		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7033		case "$installstyle" in
7034		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7035		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7036		esac
7037		;;
7038	*)	dflt="$vendorlib"
7039		;;
7040	esac
7041	fn=d~+
7042	rp='Pathname for the vendor-supplied library files?'
7043	. ./getfile
7044	vendorlib="$ans"
7045	vendorlibexp="$ansexp"
7046	;;
7047esac
7048vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7049prefixvar=vendorlib
7050. ./installprefix
7051
7052: Set the vendorarch variables
7053case "$vendorprefix" in
7054'')	d_vendorarch="$undef"
7055	vendorarch=''
7056	vendorarchexp=''
7057	;;
7058*)	d_vendorarch="$define"
7059	: determine where vendor-supplied architecture-dependent libraries go.
7060	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7061	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7062	: vendorlib may have an optional trailing /share.
7063	case "$vendorarch" in
7064	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
7065		dflt="$dflt/$archname"
7066		;;
7067	*)	dflt="$vendorarch" ;;
7068	esac
7069	fn=d~+
7070	rp='Pathname for vendor-supplied architecture-dependent files?'
7071	. ./getfile
7072	vendorarch="$ans"
7073	vendorarchexp="$ansexp"
7074	;;
7075esac
7076prefixvar=vendorarch
7077. ./installprefix
7078if $test X"$vendorarch" = X"$vendorlib"; then
7079	d_vendorarch="$undef"
7080else
7081	d_vendorarch="$define"
7082fi
7083
7084: Final catch-all directories to search
7085$cat <<EOM
7086
7087Lastly, you can have perl look in other directories for extensions and
7088modules in addition to those already specified.
7089These directories will be searched after 
7090	$sitearch 
7091	$sitelib 
7092EOM
7093test X"$vendorlib" != "X" && echo '	' $vendorlib
7094test X"$vendorarch" != "X" && echo '	' $vendorarch
7095echo ' '
7096case "$otherlibdirs" in
7097''|' ') dflt='none' ;;
7098*)	dflt="$otherlibdirs" ;;
7099esac
7100$cat <<EOM
7101Enter a colon-separated set of extra paths to include in perl's @INC
7102search path, or enter 'none' for no extra paths.
7103
7104EOM
7105
7106rp='Colon-separated list of additional directories for perl to search?'
7107. ./myread
7108case "$ans" in
7109' '|''|none)	otherlibdirs=' ' ;;
7110*)	otherlibdirs="$ans" ;;
7111esac
7112case "$otherlibdirs" in
7113' ') val=$undef ;;
7114*)	val=$define ;;
7115esac
7116set d_perl_otherlibdirs
7117eval $setvar
7118
7119: Cruising for prototypes
7120echo " "
7121echo "Checking out function prototypes..." >&4
7122$cat >prototype.c <<EOCP
7123#$i_stdlib I_STDLIB
7124#ifdef I_STDLIB
7125#include <stdlib.h>
7126#endif
7127int main(int argc, char *argv[]) {
7128	exit(0);}
7129EOCP
7130if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7131	echo "Your C compiler appears to support function prototypes."
7132	val="$define"
7133else
7134	echo "Your C compiler doesn't seem to understand function prototypes."
7135	val="$undef"
7136fi
7137set prototype
7138eval $setvar
7139$rm -f prototype*
7140
7141: Check if ansi2knr is required
7142case "$prototype" in
7143"$define") ;;
7144*)	ansi2knr='ansi2knr'
7145	echo " "
7146	cat <<EOM >&4
7147
7148$me:  FATAL ERROR:
7149This version of $package can only be compiled by a compiler that 
7150understands function prototypes.  Unfortunately, your C compiler 
7151	$cc $ccflags
7152doesn't seem to understand them.  Sorry about that.
7153
7154If GNU cc is available for your system, perhaps you could try that instead.  
7155
7156Eventually, we hope to support building Perl with pre-ANSI compilers.
7157If you would like to help in that effort, please contact <perlbug@perl.org>.
7158
7159Aborting Configure now.
7160EOM
7161	exit 2
7162	;;
7163esac
7164
7165: DTrace support
7166dflt_dtrace='/usr/sbin/dtrace'
7167$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7168
7169cat <<EOM
7170
7171Perl can be built to support DTrace on platforms that support it.
7172DTrace is a diagnosis and performance analysis tool from Sun.
7173
7174If this doesn't make any sense to you, just accept the default '$dflt'.
7175EOM
7176
7177while $test 1 ; do
7178	case "$usedtrace" in
7179	$define|true|[yY]*)
7180		dflt='y'
7181		;;
7182	?*)
7183		dflt='y'
7184		dflt_dtrace=$usedtrace
7185		;;
7186	*)
7187		dflt='n'
7188		;;
7189	esac
7190
7191	rp='Support DTrace if available?'
7192	. ./myread
7193	case "$ans" in
7194	y|Y)	val="$define" ;;
7195	*)      val="$undef" ;;
7196	esac
7197	set usedtrace
7198	eval $setvar
7199
7200	test "X$usedtrace" != "X$define" && break
7201
7202	echo " "
7203	rp='Where is the dtrace executable?'
7204	dflt=$dflt_dtrace
7205	. ./getfile
7206	val="$ans"
7207	set dtrace
7208	eval $setvar
7209
7210	if $test -f $dtrace
7211	then
7212		if $dtrace -h -s ../perldtrace.d \
7213			-o perldtrace.tmp >/dev/null 2>&1 \
7214			&& rm -f perldtrace.tmp
7215		then
7216			echo " "
7217			echo "Good: your $dtrace knows about the -h flag."
7218		else
7219			cat >&2 <<EOM
7220
7221*** $me:  Fatal Error:  $dtrace doesn't support -h flag
7222***
7223*** Your installed dtrace doesn't support the -h switch to compile a D
7224*** program into a C header. Can't continue.
7225
7226EOM
7227			exit 1
7228		fi
7229		break;
7230	fi
7231
7232	case "$fastread" in
7233	yes)
7234		cat >&2 <<EOM
7235
7236*** $me:  Fatal Error:  $dtrace not found.
7237*** Can't continue.
7238
7239EOM
7240		exit 1
7241		;;
7242	*)
7243		echo "*** $dtrace was not found."
7244		echo " "
7245		;;
7246	esac
7247done
7248
7249: See if we want extra modules installed
7250echo " "
7251case "$extras" in
7252'') dflt='n';;
7253*) dflt='y';;
7254esac
7255cat <<EOM
7256Perl can be built with extra modules or bundles of modules which
7257will be fetched from the CPAN and installed alongside Perl.
7258
7259Notice that you will need access to the CPAN; either via the Internet,
7260or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7261be asked later to configure the CPAN.pm module which will in turn do
7262the installation of the rest of the extra modules or bundles.)
7263
7264Notice also that if the modules require any external software such as
7265libraries and headers (the libz library and the zlib.h header for the
7266Compress::Zlib module, for example) you MUST have any such software
7267already installed, this configuration process will NOT install such
7268things for you.
7269
7270If this doesn't make any sense to you, just accept the default '$dflt'.
7271EOM
7272rp='Install any extra modules (y or n)?'
7273. ./myread
7274case "$ans" in
7275y|Y)
7276	cat <<EOM
7277
7278Please list any extra modules or bundles to be installed from CPAN,
7279with spaces between the names.  The names can be in any format the
7280'install' command of CPAN.pm will understand.  (Answer 'none',
7281without the quotes, to install no extra modules or bundles.)
7282EOM
7283	rp='Extras?'
7284	dflt="$extras"
7285	. ./myread
7286	extras="$ans"
7287esac
7288case "$extras" in
7289''|'none')
7290	val=''
7291	$rm -f ../extras.lst
7292	;;
7293*)	echo "(Saving the list of extras for later...)"
7294	echo "$extras" > ../extras.lst
7295	val="'$extras'"
7296	;;
7297esac
7298set extras
7299eval $setvar
7300echo " "
7301
7302: determine where html pages for programs go
7303set html1dir html1dir none
7304eval $prefixit
7305$cat <<EOM
7306
7307If you wish to install html files for programs in $spackage, indicate
7308the appropriate directory here.  To skip installing html files,
7309answer "none".
7310EOM
7311case "$html1dir" in
7312''|none|$undef|' ') dflt=none ;;
7313*) dflt=$html1dir ;;
7314esac
7315fn=dn+~
7316rp="Directory for the main $spackage html pages?"
7317. ./getfile
7318prefixvar=html1dir
7319. ./setprefixvar
7320: Use ' ' for none so value is preserved next time through Configure
7321$test X"$html1dir" = "X" && html1dir=' '
7322
7323: determine where html pages for libraries and modules go
7324set html3dir html3dir none
7325eval $prefixit
7326$cat <<EOM
7327
7328If you wish to install html files for modules associated with $spackage,
7329indicate the appropriate directory here.  To skip installing html files,
7330answer "none".
7331EOM
7332: There is no obvious default.  If they have specified html1dir, then
7333: try to key off that, possibly changing .../html1 into .../html3.
7334case "$html3dir" in
7335'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7336*) dflt=$html3dir ;;
7337esac
7338fn=dn+~
7339rp="Directory for the $spackage module html pages?"
7340. ./getfile
7341prefixvar=html3dir
7342. ./setprefixvar
7343: Use ' ' for none so value is preserved next time through Configure
7344$test X"$html3dir" = "X" && html3dir=' '
7345
7346: determine whether to install perl also as /usr/bin/perl
7347
7348echo " "
7349if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7350	$cat <<EOM
7351Many scripts expect perl to be installed as /usr/bin/perl.
7352
7353If you want to, I can install the perl you are about to compile
7354as /usr/bin/perl (in addition to $bin/perl).
7355EOM
7356	if test -f /usr/bin/perl; then
7357	    $cat <<EOM
7358
7359However, please note that because you already have a /usr/bin/perl,
7360overwriting that with a new Perl would very probably cause problems.
7361Therefore I'm assuming you don't want to do that (unless you insist).
7362
7363EOM
7364	    case "$installusrbinperl" in
7365	    "$define"|[yY]*)	dflt='y';;
7366	    *)			dflt='n';;
7367	    esac
7368	else
7369	    $cat <<EOM
7370
7371Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7372
7373EOM
7374	    case "$installusrbinperl" in
7375	    "$undef"|[nN]*)	dflt='n';;
7376	    *)			dflt='y';;
7377	    esac
7378	fi
7379	rp="Do you want to install perl as /usr/bin/perl?"
7380	. ./myread
7381	case "$ans" in
7382	[yY]*)	val="$define";;
7383	*)	val="$undef" ;;
7384	esac
7385else
7386	val="$undef"
7387fi
7388set installusrbinperl
7389eval $setvar
7390
7391: Check if we are using the GNU C library
7392echo " "
7393echo "Checking for GNU C Library..." >&4
7394cat >try.c <<'EOCP'
7395/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7396   alone are insufficient to distinguish different versions, such as
7397   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7398   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7399*/
7400#include <stdio.h>
7401int main(void)
7402{
7403#ifdef __GLIBC__
7404#   ifdef __GLIBC_MINOR__
7405#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7406#           include <gnu/libc-version.h>
7407	    printf("%s\n",  gnu_get_libc_version());
7408#       else
7409	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7410#       endif
7411#   else
7412	printf("%d\n",  __GLIBC__);
7413#   endif
7414    return 0;
7415#else
7416    return 1;
7417#endif
7418}
7419EOCP
7420set try
7421if eval $compile_ok && $run ./try > glibc.ver; then
7422	val="$define"
7423	gnulibc_version=`$cat glibc.ver`
7424	echo "You are using the GNU C Library version $gnulibc_version"
7425else
7426	val="$undef"
7427	gnulibc_version=''
7428	echo "You are not using the GNU C Library"
7429fi
7430$rm_try glibc.ver
7431set d_gnulibc
7432eval $setvar
7433
7434: see if nm is to be used to determine whether a symbol is defined or not
7435case "$usenm" in
7436'')
7437	dflt=''
7438	case "$d_gnulibc" in
7439	"$define")
7440		echo " "
7441		echo "nm probably won't work on the GNU C Library." >&4
7442		dflt=n
7443		;;
7444	esac
7445	case "$dflt" in
7446	'')
7447		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7448			echo " "
7449			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7450			echo "'nm' won't be sufficient on this sytem." >&4
7451			dflt=n
7452		fi
7453		;;
7454	esac
7455	case "$dflt" in
7456	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7457		if $test $dflt -gt 20; then
7458			dflt=y
7459		else
7460			dflt=n
7461		fi
7462		;;
7463	esac
7464	;;
7465*)
7466	case "$usenm" in
7467	true|$define) dflt=y;;
7468	*) dflt=n;;
7469	esac
7470	;;
7471esac
7472$cat <<EOM
7473
7474I can use $nm to extract the symbols from your C libraries. This
7475is a time consuming task which may generate huge output on the disk (up
7476to 3 megabytes) but that should make the symbols extraction faster. The
7477alternative is to skip the 'nm' extraction part and to compile a small
7478test program instead to determine whether each symbol is present. If
7479you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7480this may be the best solution.
7481
7482You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7483
7484EOM
7485rp="Shall I use $nm to extract C symbols from the libraries?"
7486. ./myread
7487case "$ans" in
7488[Nn]*) usenm=false;;
7489*) usenm=true;;
7490esac
7491
7492runnm=$usenm
7493case "$reuseval" in
7494true) runnm=false;;
7495esac
7496
7497: nm options which may be necessary
7498case "$nm_opt" in
7499'') if $test -f /mach_boot; then
7500		nm_opt=''	# Mach
7501	elif $test -d /usr/ccs/lib; then
7502		nm_opt='-p'	# Solaris (and SunOS?)
7503	elif $test -f /dgux; then
7504		nm_opt='-p'	# DG-UX
7505	elif $test -f /lib64/rld; then
7506		nm_opt='-p'	# 64-bit Irix
7507	else
7508		nm_opt=''
7509	fi;;
7510esac
7511
7512: nm options which may be necessary for shared libraries but illegal
7513: for archive libraries.  Thank you, Linux.
7514case "$nm_so_opt" in
7515'')	case "$myuname" in
7516	*linux*|gnu*)
7517		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7518			nm_so_opt='--dynamic'
7519		fi
7520		;;
7521	esac
7522	;;
7523esac
7524
7525: Figure out where the libc is located
7526case "$runnm" in
7527true)
7528: get list of predefined functions in a handy place
7529echo " "
7530case "$libc" in
7531'') libc=unknown
7532	case "$libs" in
7533	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7534	esac
7535	;;
7536esac
7537case "$libs" in
7538'') ;;
7539*)  for thislib in $libs; do
7540	case "$thislib" in
7541	-lc|-lc_s)
7542		: Handle C library specially below.
7543		;;
7544	-l*)
7545		thislib=`echo $thislib | $sed -e 's/^-l//'`
7546		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7547			:
7548		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7549			:
7550		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7551			:
7552		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7553			:
7554		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7555			:
7556		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7557			:
7558		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7559			:
7560		else
7561			try=''
7562		fi
7563		libnames="$libnames $try"
7564		;;
7565	*) libnames="$libnames $thislib" ;;
7566	esac
7567	done
7568	;;
7569esac
7570xxx=normal
7571case "$libc" in
7572unknown)
7573	set /lib/libc.$so
7574	for xxx in $libpth; do
7575		$test -r $1 || set $xxx/libc.$so
7576		: The messy sed command sorts on library version numbers.
7577		$test -r $1 || \
7578			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7579			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7580				h
7581				s/[0-9][0-9]*/0000&/g
7582				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7583				G
7584				s/\n/ /' | \
7585			 $sort | $sed -e 's/^.* //'`
7586		eval set \$$#
7587	done
7588	$test -r $1 || set /usr/ccs/lib/libc.$so
7589	$test -r $1 || set /lib/libsys_s$_a
7590	;;
7591*)
7592	set blurfl
7593	;;
7594esac
7595if $test -r "$1"; then
7596	echo "Your (shared) C library seems to be in $1."
7597	libc="$1"
7598elif $test -r /lib/libc && $test -r /lib/clib; then
7599	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7600	xxx=apollo
7601	libc='/lib/clib /lib/libc'
7602	if $test -r /lib/syslib; then
7603		echo "(Your math library is in /lib/syslib.)"
7604		libc="$libc /lib/syslib"
7605	fi
7606elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7607	echo "Your C library seems to be in $libc, as you said before."
7608elif $test -r $incpath/usr/lib/libc$_a; then
7609	libc=$incpath/usr/lib/libc$_a;
7610	echo "Your C library seems to be in $libc.  That's fine."
7611elif $test -r /lib/libc$_a; then
7612	libc=/lib/libc$_a;
7613	echo "Your C library seems to be in $libc.  You're normal."
7614else
7615	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7616		:
7617	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7618		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7619	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7620		:
7621	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7622		:
7623	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7624		:
7625	else
7626		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7627	fi
7628	if $test -r "$tans"; then
7629		echo "Your C library seems to be in $tans, of all places."
7630		libc=$tans
7631	else
7632		libc='blurfl'
7633	fi
7634fi
7635if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7636	dflt="$libc"
7637	cat <<EOM
7638
7639If the guess above is wrong (which it might be if you're using a strange
7640compiler, or your machine supports multiple models), you can override it here.
7641
7642EOM
7643else
7644	dflt=''
7645	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7646	cat >&4 <<EOM
7647I can't seem to find your C library.  I've looked in the following places:
7648
7649EOM
7650	$sed 's/^/	/' libpath
7651	cat <<EOM
7652
7653None of these seems to contain your C library. I need to get its name...
7654
7655EOM
7656fi
7657fn=f
7658rp='Where is your C library?'
7659. ./getfile
7660libc="$ans"
7661
7662echo " "
7663echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7664set X `cat libnames`
7665shift
7666xxx=files
7667case $# in 1) xxx=file; esac
7668echo "Extracting names from the following $xxx for later perusal:" >&4
7669echo " "
7670$sed 's/^/	/' libnames >&4
7671echo " "
7672$echo $n "This may take a while...$c" >&4
7673
7674for file in $*; do
7675	case $file in
7676	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7677	*) $nm $nm_opt $file 2>/dev/null;;
7678	esac
7679done >libc.tmp
7680
7681$echo $n ".$c"
7682$grep fprintf libc.tmp > libc.ptf
7683xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7684xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7685xxx='[ADTSIW]'
7686if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7687	eval $xscan;\
7688	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689		eval $xrun
7690elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7691	eval $xscan;\
7692	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693		eval $xrun
7694elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7695	eval $xscan;\
7696	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697		eval $xrun
7698elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7699	eval $xscan;\
7700	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701		eval $xrun
7702elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7703	eval $xscan;\
7704	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705		eval $xrun
7706elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7707	eval $xscan;\
7708	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709		eval $xrun
7710elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7711				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7712	eval $xscan;\
7713	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714		eval $xrun
7715elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7716	eval $xscan;\
7717	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718		eval $xrun
7719elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7720	eval $xscan;\
7721	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722		eval $xrun
7723elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7724	eval $xscan;\
7725	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726		eval $xrun
7727elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7728	eval $xscan;\
7729	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730		eval $xrun
7731elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7732	eval $xscan;\
7733	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7734		eval $xrun
7735elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7736	eval $xscan;\
7737	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7738		eval $xrun
7739elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7740	eval $xscan;\
7741	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7742		eval $xrun
7743else
7744	$nm -p $* 2>/dev/null >libc.tmp
7745	$grep fprintf libc.tmp > libc.ptf
7746	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7747		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7748	then
7749		nm_opt='-p'
7750		eval $xrun
7751	else
7752		echo " "
7753		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7754		com=''
7755		if $ar t $libc > libc.tmp && \
7756			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
7757		then
7758			for thisname in $libnames $libc; do
7759				$ar t $thisname >>libc.tmp
7760			done
7761			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7762			echo "Ok." >&4
7763		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7764			for thisname in $libnames $libc; do
7765				$ar tv $thisname >>libc.tmp
7766				emximp -o tmp.imp $thisname \
7767				    2>/dev/null && \
7768				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7769				    < tmp.imp >>libc.tmp
7770				$rm -f tmp.imp
7771			done
7772			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7773			echo "Ok." >&4
7774		else
7775			echo "$ar didn't seem to work right." >&4
7776			echo "Maybe this is a Cray...trying bld instead..." >&4
7777			if  bld t $libc | \
7778				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7779				$test -s libc.list
7780			then
7781				for thisname in $libnames; do
7782					bld t $libnames | \
7783					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7784					$ar t $thisname >>libc.tmp
7785				done
7786				echo "Ok." >&4
7787			else
7788				echo "That didn't work either.  Giving up." >&4
7789				exit 1
7790			fi
7791		fi
7792	fi
7793fi
7794nm_extract="$com"
7795case "$PASE" in
7796define)
7797    echo " "
7798    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7799    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7800    ;;
7801*)  if $test -f /lib/syscalls.exp; then
7802	echo " "
7803	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7804	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
7805		/lib/syscalls.exp >>libc.list
7806    fi
7807    ;;
7808esac
7809;;
7810esac
7811$rm -f libnames libpath
7812
7813: see if dld is available
7814set dld.h i_dld
7815eval $inhdr
7816
7817: Check if we are using C++
7818echo " "
7819echo "Checking for C++..." >&4
7820$cat >try.c <<'EOCP'
7821#include <stdio.h>
7822int main(void)
7823{
7824#ifdef __cplusplus
7825    return 0;
7826#else
7827    return 1;
7828#endif
7829}
7830EOCP
7831set try
7832if eval $compile_ok && $run ./try; then
7833	val="$define"
7834	echo "You are using a C++ compiler."
7835else
7836	val="$undef"
7837	echo "You are not using a C++ compiler."
7838fi
7839$rm_try cplusplus$$
7840set d_cplusplus
7841eval $setvar
7842
7843: is a C symbol defined?
7844csym='tlook=$1;
7845case "$3" in
7846-v) tf=libc.tmp; tdc="";;
7847-a) tf=libc.tmp; tdc="[]";;
7848*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7849esac;
7850case "$d_cplusplus" in
7851    $define)	extern_C="extern \"C\""	;;
7852    *)		extern_C="extern"	;;
7853esac;
7854tx=yes;
7855case "$reuseval-$4" in
7856true-) ;;
7857true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7858esac;
7859case "$tx" in
7860yes)
7861	tval=false;
7862	if $test "$runnm" = true; then
7863		if $contains $tlook $tf >/dev/null 2>&1; then
7864			tval=true;
7865		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7866			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7867			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7868			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7869			$rm_try;
7870		fi;
7871	else
7872		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7873		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7874		$rm_try;
7875	fi;
7876	;;
7877*)
7878	case "$tval" in
7879	$define) tval=true;;
7880	*) tval=false;;
7881	esac;
7882	;;
7883esac;
7884eval "$2=$tval"'
7885
7886: define an is-in-libc? function
7887inlibc='echo " "; td=$define; tu=$undef;
7888sym=$1; var=$2; eval "was=\$$2";
7889tx=yes;
7890case "$reuseval$was" in
7891true) ;;
7892true*) tx=no;;
7893esac;
7894case "$tx" in
7895yes)
7896	set $sym tres -f;
7897	eval $csym;
7898	case "$tres" in
7899	true)
7900		echo "$sym() found." >&4;
7901		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7902	*)
7903		echo "$sym() NOT found." >&4;
7904		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7905	esac;;
7906*)
7907	case "$was" in
7908	$define) echo "$sym() found." >&4;;
7909	*) echo "$sym() NOT found." >&4;;
7910	esac;;
7911esac'
7912
7913: see if dlopen exists
7914xxx_runnm="$runnm"
7915xxx_ccflags="$ccflags"
7916runnm=false
7917: with g++ one needs -shared to get is-in-libc to work for dlopen
7918case "$gccversion" in
7919'')	;;
7920*)	case "$d_cplusplus" in
7921	"$define") ccflags="$ccflags -shared" ;;
7922	esac
7923	;;
7924esac
7925set dlopen d_dlopen
7926eval $inlibc
7927runnm="$xxx_runnm"
7928ccflags="$xxx_ccflags"
7929
7930: see if this is a unistd.h system
7931set unistd.h i_unistd
7932eval $inhdr
7933
7934: determine which dynamic loading, if any, to compile in
7935echo " "
7936dldir="ext/DynaLoader"
7937case "$usedl" in
7938$define|y|true)
7939	dflt='y'
7940	usedl="$define"
7941	;;
7942$undef|n|false)
7943	dflt='n'
7944	usedl="$undef"
7945	;;
7946*)
7947	dflt='n'
7948	case "$d_dlopen" in
7949	    $define) dflt='y' ;;
7950	esac
7951	case "$i_dld" in
7952	    $define) dflt='y' ;;
7953	esac
7954	: Does a dl_xxx.xs file exist for this operating system
7955	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7956	;;
7957esac
7958rp="Do you wish to use dynamic loading?"
7959. ./myread
7960usedl="$ans"
7961bin_ELF="$undef"
7962case "$ans" in
7963y*) usedl="$define"
7964	case "$dlsrc" in
7965	'')
7966		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7967			dflt="$dldir/dl_${osname}.xs"
7968		elif $test "$d_dlopen" = "$define" ; then
7969			dflt="$dldir/dl_dlopen.xs"
7970		elif $test "$i_dld" = "$define" ; then
7971			dflt="$dldir/dl_dld.xs"
7972		else
7973			dflt=''
7974		fi
7975		;;
7976	*)	dflt="$dldir/$dlsrc"
7977		;;
7978	esac
7979    echo "The following dynamic loading files are available:"
7980	: Can not go over to $dldir because getfile has path hard-coded in.
7981	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7982	rp="Source file to use for dynamic loading"
7983	fn="fne"
7984	gfpth="$src"
7985	. ./getfile
7986	usedl="$define"
7987	: emulate basename
7988	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7989
7990	$cat << EOM
7991
7992Some systems may require passing special flags to $cc -c to
7993compile modules that will be used to create a shared library.
7994To use no flags, say "none".
7995
7996EOM
7997    case "$cccdlflags" in
7998    '')	case "$gccversion" in
7999		'') case "$osname" in
8000			hpux)	dflt='+z' ;;
8001			next)	dflt='none' ;;
8002			irix*)	dflt='-KPIC' ;;
8003			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8004			sunos)	dflt='-pic' ;;
8005			*)	dflt='none' ;;
8006		    esac
8007			;;
8008		*)  case "$osname" in
8009	                darwin) dflt='none' ;;
8010			linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8011			*)	dflt='-fpic' ;;
8012		    esac ;;
8013	    esac ;;
8014	' ') dflt='none' ;;
8015    *)	dflt="$cccdlflags" ;;
8016    esac
8017    rp="Any special flags to pass to $cc -c to compile shared library modules?"
8018    . ./myread
8019    case "$ans" in
8020    none) cccdlflags=' ' ;;
8021    *) cccdlflags="$ans" ;;
8022    esac
8023
8024    cat << EOM
8025
8026Some systems use ld to create libraries that can be dynamically loaded,
8027while other systems (such as those using ELF) use $cc.
8028
8029EOM
8030	case "$ld" in
8031	'')	$cat >try.c <<EOM
8032/* Test for whether ELF binaries are produced */
8033#include <fcntl.h>
8034#$i_stdlib I_STDLIB
8035#ifdef I_STDLIB
8036#include <stdlib.h>
8037#endif
8038#$i_unistd I_UNISTD
8039#ifdef I_UNISTD
8040#include <unistd.h>
8041#endif
8042int main() {
8043	char b[4];
8044	int i = open("a.out",O_RDONLY);
8045	if(i == -1)
8046		exit(1); /* fail */
8047	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8048		exit(0); /* succeed (yes, it's ELF) */
8049	else
8050		exit(1); /* fail */
8051}
8052EOM
8053		if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8054			cat <<EOM
8055You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8056EOM
8057			dflt="$cc"
8058			bin_ELF="$define"
8059		else
8060			echo "I'll use ld to build dynamic libraries."
8061			dflt='ld'
8062		fi
8063		$rm_try
8064		;;
8065	*)	dflt="$ld"
8066		;;
8067	esac
8068
8069    rp="What command should be used to create dynamic libraries?"
8070    . ./myread
8071	ld="$ans"
8072
8073    cat << EOM
8074
8075Some systems may require passing special flags to $ld to create a
8076library that can be dynamically loaded.  If your ld flags include
8077-L/other/path options to locate libraries outside your loader's normal
8078search path, you may need to specify those -L options here as well.  To
8079use no flags, say "none".
8080
8081EOM
8082    case "$lddlflags" in
8083    '') case "$osname" in
8084  			beos) dflt='-nostart' ;;
8085  			haiku) dflt='-shared' ;;
8086			hpux) dflt='-b';
8087			      case "$gccversion" in
8088			      '') dflt="$dflt +vnocompatwarnings" ;;
8089			      esac
8090			      ;;
8091			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8092			next)  dflt='none' ;;
8093			solaris) dflt='-G' ;;
8094			sunos) dflt='-assert nodefinitions' ;;
8095			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8096	        *)     dflt='none' ;;
8097			esac
8098			;;
8099    *) dflt="$lddlflags" ;;
8100    esac
8101
8102	: Try to guess additional flags to pick up local libraries.
8103	: Be careful not to append to a plain 'none'
8104	case "$dflt" in
8105	none) dflt='' ;;
8106	esac
8107	for thisflag in $ldflags; do
8108		case "$thisflag" in
8109		-L*|-R*|-Wl,-R*)
8110			case " $dflt " in
8111			*" $thisflag "*) ;;
8112			*) dflt="$dflt $thisflag" ;;
8113			esac
8114			;;
8115		esac
8116	done
8117
8118	case "$dflt" in
8119	''|' ') dflt='none' ;;
8120	esac
8121
8122	case "$ldflags" in
8123	*-fstack-protector*)
8124	    case "$dflt" in
8125			*-fstack-protector*) ;; # Don't add it again
8126			*) dflt="$dflt -fstack-protector" ;;
8127		esac
8128		;;
8129	esac
8130
8131
8132    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8133    . ./myread
8134    case "$ans" in
8135    none) lddlflags=' ' ;;
8136    *) lddlflags="$ans" ;;
8137    esac
8138
8139	cat <<EOM
8140
8141Some systems may require passing special flags to $cc to indicate that
8142the resulting executable will use dynamic linking.  To use no flags,
8143say "none".
8144
8145EOM
8146    case "$ccdlflags" in
8147    '') case "$osname" in
8148	    linux|hpux|gnu*)	dflt='-Wl,-E' ;;
8149	    next|sunos)	dflt='none' ;;
8150	    *)		dflt='none' ;;
8151	    esac ;;
8152    ' ')  dflt='none' ;;
8153    *)  dflt="$ccdlflags" ;;
8154    esac
8155    rp="Any special flags to pass to $cc to use dynamic linking?"
8156    . ./myread
8157    case "$ans" in
8158    none) ccdlflags=' ' ;;
8159    *) ccdlflags="$ans" ;;
8160    esac
8161    ;;
8162*)  usedl="$undef"
8163	ld='ld'
8164    dlsrc='dl_none.xs'
8165    lddlflags=''
8166    ccdlflags=''
8167    ;;
8168esac
8169
8170: Do we want a shared libperl?
8171also=''
8172case "$usedl" in
8173$undef)
8174	# No dynamic loading being used, so don't bother even to prompt.
8175	useshrplib='false'
8176	;;
8177*)	case "$useshrplib" in
8178	'')	case "$osname" in
8179		svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8180			dflt=y
8181			also='Building a shared libperl is required for dynamic loading to work on your system.'
8182			;;
8183		next*)
8184			case "$osvers" in
8185			4*)	dflt=y
8186				also='Building a shared libperl is needed for MAB support.'
8187				;;
8188			*)	dflt=n
8189				;;
8190			esac
8191			;;
8192		*)	dflt=n
8193			;;
8194		esac
8195		;;
8196	$define|true|[Yy]*)
8197		dflt=y
8198		;;
8199	*)	dflt=n
8200		;;
8201	esac
8202	$cat << EOM
8203
8204The perl executable is normally obtained by linking perlmain.c with
8205libperl${_a}, any static extensions (usually just DynaLoader), and
8206any other libraries needed on this system (such as -lm, etc.).  Since
8207your system supports dynamic loading, it is probably possible to build
8208a shared libperl.$so.  If you will have more than one executable linked
8209to libperl.$so, this will significantly reduce the size of each
8210executable, but it may have a noticeable effect on performance.  The
8211default is probably sensible for your system.
8212$also
8213
8214EOM
8215	rp="Build a shared libperl.$so (y/n)"
8216	. ./myread
8217	case "$ans" in
8218	true|$define|[Yy]*)
8219		useshrplib='true'  ;;
8220	*)	useshrplib='false' ;;
8221	esac
8222	;;
8223esac
8224
8225case "$useshrplib" in
8226true)
8227	case "$userelocatableinc" in
8228	true|define)
8229		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8230		echo "See INSTALL for an explanation why that won't work." >&4
8231		exit 4
8232		;;
8233	esac
8234	case "$libperl" in
8235	'')
8236		# Figure out a good name for libperl.so.  Since it gets stored in
8237		# a version-specific architecture-dependent library, the version
8238		# number isn't really that important, except for making cc/ld happy.
8239		#
8240		# A name such as libperl.so.10.1
8241		majmin="libperl.$so.$patchlevel.$subversion"
8242		# A name such as libperl.so.100
8243		majonly=`echo $patchlevel $subversion |
8244			$awk '{printf "%d%02d", $1, $2}'`
8245		majonly=libperl.$so.$majonly
8246		# I'd prefer to keep the os-specific stuff here to a minimum, and
8247		# rely on figuring it out from the naming of libc.
8248		case "${osname}${osvers}" in
8249		next4*)
8250			dflt=libperl.5.$so
8251			# XXX How handle the --version stuff for MAB?
8252			;;
8253		linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8254			dflt=libperl.$so
8255			;;
8256		cygwin*) # ld links now against the dll directly
8257			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8258			majonly=`echo $patchlevel $subversion |
8259				$awk '{printf "%03d%03d", $1, $2}'`
8260			majonly=cygperl5.$majonly.$so
8261			dflt=$majmin
8262			;;
8263		*)	# Try to guess based on whether libc has major.minor.
8264			case "$libc" in
8265			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8266			*libc.$so.[0-9]*) dflt=$majonly ;;
8267			*)	dflt=libperl.$so ;;
8268			esac
8269			;;
8270		esac
8271		;;
8272	*)	dflt=$libperl
8273		;;
8274	esac
8275	cat << EOM
8276
8277I need to select a good name for the shared libperl.  If your system uses
8278library names with major and minor numbers, then you might want something
8279like $majmin.  Alternatively, if your system uses a single version
8280number for shared libraries, then you might want to use $majonly.
8281Or, your system might be quite happy with a simple libperl.$so.
8282
8283Since the shared libperl will get installed into a version-specific
8284architecture-dependent directory, the version number of the shared perl
8285library probably isn't important, so the default should be o.k.
8286
8287EOM
8288	rp='What name do you want to give to the shared libperl?'
8289	. ./myread
8290	libperl=$ans
8291	echo "Ok, I'll use $libperl"
8292	;;
8293*)
8294	libperl="libperl${_a}"
8295	;;
8296esac
8297
8298# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8299case "$shrpdir" in
8300'') ;;
8301*)	$cat >&4 <<EOM
8302WARNING:  Use of the shrpdir variable for the installation location of
8303the shared $libperl is not supported.  It was never documented and
8304will not work in this version.  Let me (perlbug@perl.org)
8305know of any problems this may cause.
8306
8307EOM
8308	case "$shrpdir" in
8309	"$archlibexp/CORE")
8310		$cat >&4 <<EOM
8311But your current setting of $shrpdir is
8312the default anyway, so it's harmless.
8313EOM
8314		;;
8315	*)
8316		$cat >&4 <<EOM
8317Further, your current attempted setting of $shrpdir
8318conflicts with the value of $archlibexp/CORE
8319that installperl will use.
8320EOM
8321		;;
8322	esac
8323	;;
8324esac
8325
8326# How will the perl executable find the installed shared $libperl?
8327# Add $xxx to ccdlflags.
8328# If we can't figure out a command-line option, use $shrpenv to
8329# set env LD_RUN_PATH.  The main perl makefile uses this.
8330shrpdir=$archlibexp/CORE
8331xxx=''
8332tmp_shrpenv=''
8333if "$useshrplib"; then
8334    case "$osname" in
8335	aix)
8336		# We'll set it in Makefile.SH...
8337		;;
8338	solaris)
8339		xxx="-R $shrpdir"
8340		;;
8341	freebsd|netbsd|openbsd|interix|dragonfly)
8342		xxx="-Wl,-R$shrpdir"
8343		;;
8344	bsdos|linux|irix*|dec_osf|gnu*)
8345		xxx="-Wl,-rpath,$shrpdir"
8346		;;
8347	next)
8348		# next doesn't like the default...
8349		;;
8350	beos)
8351		# beos doesn't like the default, either.
8352		;;
8353	haiku)
8354		# Haiku doesn't like the default, either.
8355		;;
8356	hpux*)
8357		# hpux doesn't like the default, either.
8358		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8359		;;
8360	cygwin)
8361		# cygwin needs only ldlibpth
8362		;;
8363	*)
8364		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8365		;;
8366	esac
8367	case "$xxx" in
8368	'') ;;
8369	*)
8370		# Only add $xxx if it isn't already in ccdlflags.
8371		case " $ccdlflags " in
8372		*" $xxx "*)	;;
8373		*)	ccdlflags="$ccdlflags $xxx"
8374			cat <<EOM >&4
8375
8376Adding $xxx to the flags
8377passed to $ld so that the perl executable will find the
8378installed shared $libperl.
8379
8380EOM
8381			;;
8382		esac
8383		;;
8384	esac
8385fi
8386# Fix ccdlflags in AIX for building external extensions.
8387# (For building Perl itself bare -bE:perl.exp is needed,
8388#  Makefile.SH takes care of this.)
8389case "$osname" in
8390aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8391esac
8392# Respect a hint or command-line value.
8393case "$shrpenv" in
8394'') shrpenv="$tmp_shrpenv" ;;
8395esac
8396case "$ldlibpthname" in
8397'')	ldlibpthname=LD_LIBRARY_PATH ;;
8398none)	ldlibpthname='' ;;
8399esac
8400
8401: determine where manual pages are on this system
8402echo " "
8403case "$sysman" in
8404'')
8405	syspath='/usr/share/man/man1 /usr/man/man1'
8406	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8407	syspath="$syspath /usr/man/u_man/man1"
8408	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8409	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8410	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8411	sysman=`./loc . /usr/man/man1 $syspath`
8412	;;
8413esac
8414if $test -d "$sysman"; then
8415	echo "System manual is in $sysman." >&4
8416else
8417	echo "Could not find manual pages in source form." >&4
8418fi
8419
8420: determine where manual pages go
8421set man1dir man1dir none
8422eval $prefixit
8423$cat <<EOM
8424
8425$spackage has manual pages available in source form.
8426EOM
8427case "$nroff" in
8428nroff)
8429	echo "However, you don't have nroff, so they're probably useless to you."
8430	case "$man1dir" in
8431	'') man1dir="none";;
8432	esac;;
8433esac
8434echo "If you don't want the manual sources installed, answer 'none'."
8435case "$man1dir" in
8436' ') dflt=none
8437	;;
8438'')
8439	lookpath="$prefixexp/share/man/man1"
8440	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8441	lookpath="$lookpath $prefixexp/man/p_man/man1"
8442	lookpath="$lookpath $prefixexp/man/u_man/man1"
8443	lookpath="$lookpath $prefixexp/man/man.1"
8444	case "$sysman" in
8445	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8446	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8447	esac
8448	set dflt
8449	eval $prefixup
8450	;;
8451*)  dflt="$man1dir"
8452	;;
8453esac
8454echo " "
8455fn=dn+~
8456rp="Where do the main $spackage manual pages (source) go?"
8457. ./getfile
8458if $test "X$man1direxp" != "X$ansexp"; then
8459	installman1dir=''
8460fi
8461prefixvar=man1dir
8462. ./setprefixvar
8463
8464case "$man1dir" in
8465'')	man1dir=' '
8466	installman1dir='';;
8467esac
8468
8469: What suffix to use on installed man pages
8470
8471case "$man1dir" in
8472' ')
8473	man1ext='0'
8474	;;
8475*)
8476	rp="What suffix should be used for the main $spackage man pages?"
8477	case "$man1ext" in
8478	'')	case "$man1dir" in
8479		*1)  dflt=1 ;;
8480		*1p) dflt=1p ;;
8481		*1pm) dflt=1pm ;;
8482		*l) dflt=l;;
8483		*n) dflt=n;;
8484		*o) dflt=o;;
8485		*p) dflt=p;;
8486		*C) dflt=C;;
8487		*L) dflt=L;;
8488		*L1) dflt=L1;;
8489		*) dflt=1;;
8490		esac
8491		;;
8492	*)	dflt="$man1ext";;
8493	esac
8494	. ./myread
8495	man1ext="$ans"
8496	;;
8497esac
8498
8499: see if we can have long filenames
8500echo " "
8501first=123456789abcdef
8502$rm -f $first
8503if (echo hi >$first) 2>/dev/null; then
8504	if $test -f 123456789abcde; then
8505		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8506		val="$undef"
8507	else
8508 		echo 'You can have filenames longer than 14 characters.'>&4
8509 		val="$define"
8510	fi
8511else
8512	$cat <<'EOM'
8513You can't have filenames longer than 14 chars.
8514You can't even think about them!
8515EOM
8516	val="$undef"
8517fi
8518set d_flexfnam
8519eval $setvar
8520$rm -rf 123456789abcde*
8521
8522: determine where library module manual pages go
8523set man3dir man3dir none
8524eval $prefixit
8525$cat <<EOM
8526
8527$spackage has manual pages for many of the library modules.
8528EOM
8529
8530case "$nroff" in
8531nroff)
8532	$cat <<'EOM'
8533However, you don't have nroff, so they're probably useless to you.
8534EOM
8535	case "$man3dir" in
8536	'') man3dir="none";;
8537	esac;;
8538esac
8539
8540case "$d_flexfnam" in
8541undef)
8542	$cat <<'EOM'
8543However, your system can't handle the long file names like File::Basename.3.
8544EOM
8545	case "$man3dir" in
8546	'') man3dir="none";;
8547	esac;;
8548esac
8549
8550echo "If you don't want the manual sources installed, answer 'none'."
8551prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8552case "$man3dir" in
8553'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8554	if $test -d "$privlib/man/man3"; then
8555		cat <<EOM >&4
8556
8557WARNING:  Previous versions of perl installed man3 pages into
8558$privlib/man/man3.  This version will suggest a
8559new default of $dflt.
8560EOM
8561		tdflt=$dflt
8562		dflt='n'
8563		rp='Do you wish to preserve the old behavior?(y/n)'
8564		. ./myread
8565		case "$ans" in
8566		y*) dflt="$privlib/man/man3" ;;
8567		*)  dflt=$tdflt ;;
8568		esac
8569    fi
8570	;;
8571*)	dflt="$man3dir" ;;
8572esac
8573case "$dflt" in
8574' ') dflt=none ;;
8575esac
8576echo " "
8577fn=dn+~
8578rp="Where do the $package library man pages (source) go?"
8579. ./getfile
8580prefixvar=man3dir
8581. ./setprefixvar
8582
8583case "$man3dir" in
8584'')	man3dir=' '
8585	installman3dir='';;
8586esac
8587
8588: What suffix to use on installed man pages
8589case "$man3dir" in
8590' ')
8591	man3ext='0'
8592	;;
8593*)
8594	rp="What suffix should be used for the $package library man pages?"
8595	case "$man3ext" in
8596	'')	case "$man3dir" in
8597		*3)  dflt=3 ;;
8598		*3p) dflt=3p ;;
8599		*3pm) dflt=3pm ;;
8600		*l) dflt=l;;
8601		*n) dflt=n;;
8602		*o) dflt=o;;
8603		*p) dflt=p;;
8604		*C) dflt=C;;
8605		*L) dflt=L;;
8606		*L3) dflt=L3;;
8607		*) dflt=3;;
8608		esac
8609		;;
8610	*)	dflt="$man3ext";;
8611	esac
8612	. ./myread
8613	man3ext="$ans"
8614	;;
8615esac
8616
8617: see if we have to deal with yellow pages, now NIS.
8618if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8619	if $test -f /usr/etc/nibindd; then
8620		echo " "
8621		echo "I'm fairly confident you're on a NeXT."
8622		echo " "
8623		rp='Do you get the hosts file via NetInfo?'
8624		dflt=y
8625		case "$hostcat" in
8626		nidump*) ;;
8627		'') ;;
8628		*) dflt=n;;
8629		esac
8630		. ./myread
8631		case "$ans" in
8632		y*) hostcat='nidump hosts .';;
8633		*)	case "$hostcat" in
8634			nidump*) hostcat='';;
8635			esac
8636			;;
8637		esac
8638	fi
8639	case "$hostcat" in
8640	nidump*) ;;
8641	*)
8642		case "$hostcat" in
8643		*ypcat*) dflt=y;;
8644		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8645				dflt=y
8646			else
8647				dflt=n
8648			fi;;
8649		*) dflt=n;;
8650		esac
8651		echo " "
8652		rp='Are you getting the hosts file via yellow pages?'
8653		. ./myread
8654		case "$ans" in
8655		y*) hostcat='ypcat hosts';;
8656		*) hostcat='cat /etc/hosts';;
8657		esac
8658		;;
8659	esac
8660fi
8661case "$hostcat" in
8662'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8663esac
8664case "$groupcat" in
8665'') test -f /etc/group && groupcat='cat /etc/group';;
8666esac
8667case "$passcat" in
8668'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8669esac
8670
8671: now get the host name
8672echo " "
8673echo "Figuring out host name..." >&4
8674case "$myhostname" in
8675'') cont=true
8676	echo 'Maybe "hostname" will work...'
8677	if tans=`sh -c hostname 2>&1` ; then
8678		myhostname=$tans
8679		phostname=hostname
8680		cont=''
8681	fi
8682	;;
8683*) cont='';;
8684esac
8685if $test "$cont"; then
8686	if ./xenix; then
8687		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8688		if tans=`cat /etc/systemid 2>&1` ; then
8689			myhostname=$tans
8690			phostname='cat /etc/systemid'
8691			echo "Whadyaknow.  Xenix always was a bit strange..."
8692			cont=''
8693		fi
8694	elif $test -r /etc/systemid; then
8695		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8696	fi
8697fi
8698if $test "$cont"; then
8699	echo 'No, maybe "uuname -l" will work...'
8700	if tans=`sh -c 'uuname -l' 2>&1` ; then
8701		myhostname=$tans
8702		phostname='uuname -l'
8703	else
8704		echo 'Strange.  Maybe "uname -n" will work...'
8705		if tans=`sh -c 'uname -n' 2>&1` ; then
8706			myhostname=$tans
8707			phostname='uname -n'
8708		else
8709			echo 'Oh well, maybe I can mine it out of whoami.h...'
8710			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8711				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8712				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8713			else
8714				case "$myhostname" in
8715				'') echo "Does this machine have an identity crisis or something?"
8716					phostname='';;
8717				*)
8718					echo "Well, you said $myhostname before..."
8719					phostname='echo $myhostname';;
8720				esac
8721			fi
8722		fi
8723	fi
8724fi
8725case "$myhostname" in
8726'') myhostname=noname ;;
8727esac
8728: you do not want to know about this
8729set $myhostname
8730myhostname=$1
8731
8732: verify guess
8733if $test "$myhostname" ; then
8734	dflt=y
8735	rp='Your host name appears to be "'$myhostname'".'" Right?"
8736	. ./myread
8737	case "$ans" in
8738	y*) ;;
8739	*) myhostname='';;
8740	esac
8741fi
8742
8743: bad guess or no guess
8744while $test "X$myhostname" = X ; do
8745	dflt=''
8746	rp="Please type the (one word) name of your host:"
8747	. ./myread
8748	myhostname="$ans"
8749done
8750
8751: translate upper to lower if necessary
8752case "$myhostname" in
8753*[A-Z]*)
8754	echo "(Normalizing case in your host name)"
8755	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8756	;;
8757esac
8758
8759case "$myhostname" in
8760*.*)
8761	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8762	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8763	echo "(Trimming domain name from host name--host name is now $myhostname)"
8764	;;
8765*) case "$mydomain" in
8766	'')
8767		{
8768			test "X$hostcat" = "Xypcat hosts" &&
8769			ypmatch "$myhostname" hosts 2>/dev/null |\
8770				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8771			$test -s hosts
8772		} || {
8773			test "X$hostcat" != "X" &&
8774		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8775					/[	 ]$myhostname[	. ]/p" > hosts
8776		}
8777		tmp_re="[	. ]"
8778		if $test -f hosts; then
8779			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8780			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8781			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8782				hosts | $sort | $uniq | \
8783				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8784			case `$echo X$dflt` in
8785			X*\ *)	echo "(Several hosts in the database matched hostname)"
8786				dflt=.
8787				;;
8788			X.) echo "(You do not have fully-qualified names in the hosts database)"
8789				;;
8790			esac
8791		else
8792			echo "(I cannot locate a hosts database anywhere)"
8793			dflt=.
8794		fi
8795		case "$dflt" in
8796		.)
8797			tans=`./loc resolv.conf X /etc /usr/etc`
8798			if $test -f "$tans"; then
8799				echo "(Attempting domain name extraction from $tans)"
8800				dflt=.`$sed -n -e 's/	/ /g' \
8801				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8802				  -e 1q 2>/dev/null`
8803				case "$dflt" in
8804				.) dflt=.`$sed -n -e 's/	/ /g' \
8805				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8806				     -e 1q 2>/dev/null`
8807  					;;
8808				esac
8809			fi
8810			;;
8811		esac
8812		case "$dflt" in
8813		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8814			dflt=.`sh -c domainname 2>/dev/null`
8815			case "$dflt" in
8816			'') dflt='.';;
8817			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8818			esac
8819			;;
8820		esac
8821		case "$dflt$osname" in
8822		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8823			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8824			;;
8825		esac
8826		case "$dflt" in
8827		.) echo "(Lost all hope -- silly guess then)"
8828			dflt='.nonet'
8829			;;
8830		esac
8831		$rm -f hosts
8832		;;
8833	*) dflt="$mydomain";;
8834	esac;;
8835esac
8836echo " "
8837rp="What is your domain name?"
8838. ./myread
8839tans="$ans"
8840case "$ans" in
8841'') ;;
8842.*) ;;
8843*) tans=".$tans";;
8844esac
8845mydomain="$tans"
8846
8847: translate upper to lower if necessary
8848case "$mydomain" in
8849*[A-Z]*)
8850	echo "(Normalizing case in your domain name)"
8851	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8852	;;
8853esac
8854
8855: a little sanity check here
8856case "$phostname" in
8857'') ;;
8858*)
8859	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8860	$myhostname$mydomain|$myhostname) ;;
8861	*)
8862		case "$phostname" in
8863		sed*)
8864			echo "(That doesn't agree with your whoami.h file, by the way.)"
8865			;;
8866		*)
8867			echo "(That doesn't agree with your $phostname command, by the way.)"
8868			;;
8869		esac
8870	;;
8871	esac
8872	;;
8873esac
8874
8875: determine the e-mail address of the user who is running us
8876$cat <<EOM
8877
8878I need to get your e-mail address in Internet format if possible, i.e.
8879something like user@host.domain. Please answer accurately since I have
8880no easy means to double check it. The default value provided below
8881is most probably close to reality but may not be valid from outside
8882your organization...
8883
8884EOM
8885cont=x
8886while test "$cont"; do
8887	case "$cf_email" in
8888	'') dflt="$cf_by@$myhostname$mydomain";;
8889	*) dflt="$cf_email";;
8890	esac
8891	rp='What is your e-mail address?'
8892	. ./myread
8893	cf_email="$ans"
8894	case "$cf_email" in
8895	*@*.*) cont='' ;;
8896	*)
8897		rp='Address does not look like an Internet one.  Use it anyway?'
8898		case "$fastread" in
8899		yes) dflt=y ;;
8900		*) dflt=n ;;
8901		esac
8902		. ./myread
8903		case "$ans" in
8904		y*) cont='' ;;
8905		*) echo " " ;;
8906		esac
8907		;;
8908	esac
8909done
8910
8911: Ask e-mail of administrator
8912$cat <<EOM
8913
8914If you or somebody else will be maintaining perl at your site, please
8915fill in the correct e-mail address here so that they may be contacted
8916if necessary. Currently, the "perlbug" program included with perl
8917will send mail to this address in addition to perlbug@perl.org. You may
8918enter "none" for no administrator.
8919
8920EOM
8921case "$perladmin" in
8922'') dflt="$cf_email";;
8923*) dflt="$perladmin";;
8924esac
8925rp='Perl administrator e-mail address'
8926. ./myread
8927perladmin="$ans"
8928
8929: determine whether to only install version-specific parts.
8930echo " "
8931$cat <<EOM
8932Do you want to install only the version-specific parts of the perl
8933distribution?  Usually you do *not* want to do this.
8934EOM
8935case "$versiononly" in
8936"$define"|[Yy]*|true) dflt='y' ;;
8937*) dflt='n';
8938esac
8939rp="Do you want to install only the version-specific parts of perl?"
8940. ./myread
8941case "$ans" in
8942[yY]*)	val="$define";;
8943*)	val="$undef" ;;
8944esac
8945set versiononly
8946eval $setvar
8947
8948case "$versiononly" in
8949"$define") inc_version_list=''
8950           inc_version_list_init=0
8951           ;;
8952esac
8953
8954: figure out how to guarantee perl startup
8955: XXX Note that this currently takes advantage of the bug that binexp ignores
8956:     the Configure -Dinstallprefix setting, which in turn means that under
8957:     relocatable @INC, initialinstalllocation is what binexp started as.
8958case "$startperl" in
8959'')
8960	case "$sharpbang" in
8961	*!)
8962		$cat <<EOH
8963
8964I can use the #! construct to start perl on your system. This will
8965make startup of perl scripts faster, but may cause problems if you
8966want to share those scripts and perl is not in a standard place
8967($initialinstalllocation/perl) on all your platforms. The alternative
8968is to force a shell by starting the script with a single ':' character.
8969
8970EOH
8971		case "$versiononly" in
8972		"$define")      dflt="$initialinstalllocation/perl$version";;
8973		*)              dflt="$initialinstalllocation/perl";;
8974		esac
8975		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8976		. ./myread
8977		case "$ans" in
8978		none)	startperl=": # use perl";;
8979		*)	startperl="#!$ans"
8980			if $test 30 -lt `echo "$ans" | wc -c`; then
8981				$cat >&4 <<EOM
8982
8983WARNING:  Some systems limit the #! command to 32 characters.
8984If you experience difficulty running Perl scripts with #!, try
8985installing Perl in a directory with a shorter pathname.
8986
8987EOM
8988			fi ;;
8989		esac
8990		;;
8991	*) startperl=": # use perl"
8992		;;
8993	esac
8994	;;
8995esac
8996echo "I'll use $startperl to start perl scripts."
8997
8998: figure best path for perl in scripts
8999case "$perlpath" in
9000'')
9001	case "$versiononly" in
9002	"$define")	perlpath="$initialinstalllocation/perl$version";;
9003	*)		perlpath="$initialinstalllocation/perl";;
9004	esac
9005	case "$startperl" in
9006	*!*) ;;
9007	*)
9008		$cat <<EOH
9009
9010I will use the "eval 'exec'" idiom to start Perl on your system.
9011I can use the full path of your Perl binary for this purpose, but
9012doing so may cause problems if you want to share those scripts and
9013Perl is not always in a standard place ($initialinstalllocation/perl).
9014
9015EOH
9016		dflt="$initialinstalllocation/perl"
9017		rp="What path shall I use in \"eval 'exec'\"?"
9018		. ./myread
9019		perlpath="$ans"
9020		;;
9021	esac
9022	;;
9023esac
9024case "$startperl" in
9025*!*)	;;
9026*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9027esac
9028
9029: determine where public executable scripts go
9030set scriptdir scriptdir
9031eval $prefixit
9032case "$scriptdir" in
9033'')
9034	dflt="$bin"
9035	: guess some guesses
9036	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9037	$test -d /usr/share/bin     && dflt=/usr/share/bin
9038	$test -d /usr/local/script  && dflt=/usr/local/script
9039	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9040	$test -d $prefixexp/script  && dflt=$prefixexp/script
9041	set dflt
9042	eval $prefixup
9043	;;
9044*)  dflt="$scriptdir"
9045	;;
9046esac
9047$cat <<EOM
9048
9049Some installations have a separate directory just for executable scripts so
9050that they can mount it across multiple architectures but keep the scripts in
9051one spot.  You might, for example, have a subdirectory of /usr/share for this.
9052Or you might just lump your scripts in with all your other executables.
9053
9054EOM
9055fn=d~
9056rp='Where do you keep publicly executable scripts?'
9057. ./getfile
9058if $test "X$ansexp" != "X$scriptdirexp"; then
9059	installscript=''
9060fi
9061installscriptdir=''
9062prefixvar=scriptdir
9063. ./setprefixvar
9064: A little fix up for an irregularly named variable.
9065installscript="$installscriptdir"
9066
9067: determine where add-on public executables go
9068case "$sitebin" in
9069'')	dflt=$siteprefix/bin ;;
9070*)	dflt=$sitebin ;;
9071esac
9072fn=d~
9073rp='Pathname where the add-on public executables should be installed?'
9074. ./getfile
9075prefixvar=sitebin
9076. ./setprefixvar
9077
9078: determine where add-on html pages go
9079: There is no standard location, so try to copy the previously-selected
9080: directory structure for the core html pages.
9081case "$sitehtml1dir" in
9082'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9083*)     dflt=$sitehtml1dir ;;
9084esac
9085case "$dflt" in
9086''|' ') dflt=none ;;
9087esac
9088fn=dn+~
9089rp='Pathname where the site-specific html pages should be installed?'
9090. ./getfile
9091prefixvar=sitehtml1dir
9092. ./setprefixvar
9093
9094: determine where add-on library html pages go
9095: There is no standard location, so try to copy the previously-selected
9096: directory structure for the core html pages.
9097case "$sitehtml3dir" in
9098'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9099*)     dflt=$sitehtml3dir ;;
9100esac
9101case "$dflt" in
9102''|' ') dflt=none ;;
9103esac
9104fn=dn+~
9105rp='Pathname where the site-specific library html pages should be installed?'
9106. ./getfile
9107prefixvar=sitehtml3dir
9108. ./setprefixvar
9109
9110: determine where add-on manual pages go
9111case "$siteman1dir" in
9112'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9113*)	dflt=$siteman1dir ;;
9114esac
9115case "$dflt" in
9116''|' ') dflt=none ;;
9117esac
9118fn=dn+~
9119rp='Pathname where the site-specific manual pages should be installed?'
9120. ./getfile
9121prefixvar=siteman1dir
9122. ./setprefixvar
9123
9124: determine where add-on library man pages go
9125case "$siteman3dir" in
9126'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9127*)	dflt=$siteman3dir ;;
9128esac
9129case "$dflt" in
9130''|' ') dflt=none ;;
9131esac
9132fn=dn+~
9133rp='Pathname where the site-specific library manual pages should be installed?'
9134. ./getfile
9135prefixvar=siteman3dir
9136. ./setprefixvar
9137
9138: determine where add-on public executable scripts go
9139case "$sitescript" in
9140'')	dflt=$siteprefix/script
9141	$test -d $dflt || dflt=$sitebin ;;
9142*)  dflt="$sitescript" ;;
9143esac
9144fn=d~+
9145rp='Pathname where add-on public executable scripts should be installed?'
9146. ./getfile
9147prefixvar=sitescript
9148. ./setprefixvar
9149
9150: Check if faststdio is requested and available
9151case "$usefaststdio" in
9152$define|true|[yY]*|'')
9153	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9154	case "$xversion" in
9155	[68])	dflt='y' ;;
9156	*)	dflt='n' ;;
9157	esac
9158	;;
9159*) dflt='n';;
9160esac
9161cat <<EOM
9162
9163Perl can be built to use 'fast stdio', which means using the stdio
9164library but also directly manipulating the stdio buffers to enable
9165faster I/O.  Using stdio is better for backward compatibility (especially
9166for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9167interface has been preferred instead of stdio.
9168
9169If this doesn't make any sense to you, just accept the default '$dflt'.
9170EOM
9171rp='Use the "fast stdio" if available?'
9172. ./myread
9173case "$ans" in
9174y|Y)	val="$define" ;;
9175*)      val="$undef" ;;
9176esac
9177set usefaststdio
9178eval $setvar
9179
9180
9181: define an is-a-typedef? function
9182typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9183case "$inclist" in
9184"") inclist="sys/types.h";;
9185esac;
9186eval "varval=\$$var";
9187case "$varval" in
9188"")
9189	$rm -f temp.c;
9190	for inc in $inclist; do
9191		echo "#include <$inc>" >>temp.c;
9192	done;
9193	echo "#ifdef $type" >> temp.c;
9194	echo "printf(\"We have $type\");" >> temp.c;
9195	echo "#endif" >> temp.c;
9196	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9197	if $contains $type temp.E >/dev/null 2>&1; then
9198		eval "$var=\$type";
9199	else
9200		eval "$var=\$def";
9201	fi;
9202	$rm -f temp.?;;
9203*) eval "$var=\$varval";;
9204esac'
9205
9206: define an is-a-typedef? function that prompts if the type is not available.
9207typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9208case "$inclist" in
9209"") inclist="sys/types.h";;
9210esac;
9211eval "varval=\$$var";
9212case "$varval" in
9213"")
9214	$rm -f temp.c;
9215	for inc in $inclist; do
9216		echo "#include <$inc>" >>temp.c;
9217	done;
9218	echo "#ifdef $type" >> temp.c;
9219	echo "printf(\"We have $type\");" >> temp.c;
9220	echo "#endif" >> temp.c;
9221	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9222	echo " " ;
9223	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9224	if $contains $type temp.E >/dev/null 2>&1; then
9225		echo "$type found." >&4;
9226		eval "$var=\$type";
9227	else
9228		echo "$type NOT found." >&4;
9229		dflt="$def";
9230		. ./myread ;
9231		eval "$var=\$ans";
9232	fi;
9233	$rm -f temp.?;;
9234*) eval "$var=\$varval";;
9235esac'
9236
9237: see what type lseek is declared as in the kernel
9238rp="What is the type used for lseek's offset on this system?"
9239set off_t lseektype long stdio.h sys/types.h
9240eval $typedef_ask
9241
9242echo " "
9243echo "Checking to see how big your file offsets are..." >&4
9244$cat >try.c <<EOCP
9245#include <sys/types.h>
9246#include <stdio.h>
9247int main()
9248{
9249    printf("%d\n", (int)sizeof($lseektype));
9250    return(0);
9251}
9252EOCP
9253set try
9254if eval $compile_ok; then
9255	lseeksize=`$run ./try`
9256	echo "Your file offsets are $lseeksize bytes long."
9257else
9258	dflt=$longsize
9259	echo " "
9260	echo "(I can't seem to compile the test program.  Guessing...)"
9261	rp="What is the size of your file offsets (in bytes)?"
9262	. ./myread
9263	lseeksize="$ans"
9264fi
9265$rm_try
9266
9267: see what type file positions are declared as in the library
9268rp="What is the type for file position used by fsetpos()?"
9269set fpos_t fpostype long stdio.h sys/types.h
9270eval $typedef_ask
9271
9272: Check size for Fpos_t
9273echo " "
9274case "$fpostype" in
9275*_t) zzz="$fpostype"	;;
9276*)   zzz="fpos_t"	;;
9277esac
9278echo "Checking the size of $zzz..." >&4
9279cat > try.c <<EOCP
9280#include <sys/types.h>
9281#include <stdio.h>
9282#$i_stdlib I_STDLIB
9283#ifdef I_STDLIB
9284#include <stdlib.h>
9285#endif
9286int main() {
9287    printf("%d\n", (int)sizeof($fpostype));
9288    exit(0);
9289}
9290EOCP
9291set try
9292if eval $compile_ok; then
9293	yyy=`$run ./try`
9294	case "$yyy" in
9295	'')	fpossize=4
9296		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9297		;;
9298	*)	fpossize=$yyy
9299		echo "Your $zzz is $fpossize bytes long."
9300		;;
9301	esac
9302else
9303	dflt="$longsize"
9304	echo " " >&4
9305	echo "(I can't compile the test program.  Guessing...)" >&4
9306	rp="What is the size of your file positions (in bytes)?"
9307	. ./myread
9308	fpossize="$ans"
9309fi
9310
9311: Check for large file support
9312# Backward compatibility (uselfs is deprecated).
9313case "$uselfs" in
9314"$define"|true|[yY]*)
9315	cat <<EOM >&4
9316
9317*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9318EOM
9319	uselargefiles="$define"
9320	;;
9321esac
9322
9323case "$lseeksize:$fpossize" in
93248:8) cat <<EOM
9325
9326You can have files larger than 2 gigabytes.
9327EOM
9328   val="$define" ;;
9329*)    case "$uselargefiles" in
9330   "$undef"|false|[nN]*) dflt='n' ;;
9331   *)	dflt='y' ;;
9332   esac
9333   cat <<EOM
9334
9335Perl can be built to understand large files (files larger than 2 gigabytes)
9336on some systems.  To do so, Configure can be run with -Duselargefiles.
9337
9338If this doesn't make any sense to you, just accept the default '$dflt'.
9339EOM
9340   rp='Try to understand large files, if available?'
9341   . ./myread
9342   case "$ans" in
9343   y|Y) 	val="$define" ;;
9344   *)   	val="$undef"  ;;
9345   esac
9346   ;;
9347esac
9348set uselargefiles
9349eval $setvar
9350: Look for a hint-file generated 'call-back-unit'.  If the
9351: user has specified that a large files perl is to be built,
9352: we may need to set or change some other defaults.
9353if $test -f uselargefiles.cbu; then
9354	echo "Your platform has some specific hints regarding large file builds, using them..."
9355	. ./uselargefiles.cbu
9356fi
9357case "$uselargefiles" in
9358"$define")
9359	if $test -f uselargefiles.cbu; then
9360		echo " "
9361		echo "Rechecking to see how big your file offsets are..." >&4
9362		$cat >try.c <<EOCP
9363#include <sys/types.h>
9364#include <stdio.h>
9365int main()
9366{
9367    printf("%d\n", (int)sizeof($lseektype));
9368    return(0);
9369}
9370EOCP
9371		set try
9372		if eval $compile_ok; then
9373			lseeksize=`$run ./try`
9374			$echo "Your file offsets are now $lseeksize bytes long."
9375		else
9376			dflt="$lseeksize"
9377			echo " "
9378			echo "(I can't seem to compile the test program.  Guessing...)"
9379			rp="What is the size of your file offsets (in bytes)?"
9380			. ./myread
9381			lseeksize="$ans"
9382		fi
9383		case "$fpostype" in
9384		*_t) zzz="$fpostype"	;;
9385		*)   zzz="fpos_t"	;;
9386		esac
9387		$echo $n "Rechecking the size of $zzz...$c" >&4
9388		$cat > try.c <<EOCP
9389#include <sys/types.h>
9390#include <stdio.h>
9391#$i_stdlib I_STDLIB
9392#ifdef I_STDLIB
9393#include <stdlib.h>
9394#endif
9395int main() {
9396    printf("%d\n", (int)sizeof($fpostype));
9397    return(0);
9398}
9399EOCP
9400		set try
9401		if eval $compile_ok; then
9402			yyy=`$run ./try`
9403			dflt="$lseeksize"
9404			case "$yyy" in
9405			'')	echo " "
9406				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9407				;;
9408			*)	fpossize=$yyy
9409				echo " $fpossize bytes." >&4
9410				;;
9411			esac
9412		else
9413			dflt="$fpossize"
9414			echo " "
9415			echo "(I can't compile the test program.  Guessing...)" >&4
9416			rp="What is the size of your file positions (in bytes)?"
9417			. ./myread
9418			fpossize="$ans"
9419		fi
9420		$rm_try
9421	fi
9422	;;
9423esac
9424
9425: Set the vendorbin variables
9426case "$vendorprefix" in
9427'')	d_vendorbin="$undef"
9428	vendorbin=''
9429	vendorbinexp=''
9430	;;
9431*)	d_vendorbin="$define"
9432	: determine where vendor-supplied executables go.
9433	case "$vendorbin" in
9434	'') dflt=$vendorprefix/bin ;;
9435	*)	dflt="$vendorbin" ;;
9436	esac
9437	fn=d~+
9438	rp='Pathname for the vendor-supplied executables directory?'
9439	. ./getfile
9440	vendorbin="$ans"
9441	vendorbinexp="$ansexp"
9442	;;
9443esac
9444prefixvar=vendorbin
9445. ./installprefix
9446
9447: Set the vendorhtml1dir variables
9448case "$vendorprefix" in
9449'')	vendorhtml1dir=''
9450	vendorhtml1direxp=''
9451	;;
9452*)	: determine where vendor-supplied html pages go.
9453	: There is no standard location, so try to copy the previously-selected
9454	: directory structure for the core html pages.
9455	: XXX Better default suggestions would be welcome.
9456	case "$vendorhtml1dir" in
9457	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9458	*)	dflt=$vendorhtml1dir ;;
9459	esac
9460	case "$dflt" in
9461	''|' ') dflt=none ;;
9462	esac
9463	fn=dn+~
9464	rp='Pathname for the vendor-supplied html pages?'
9465	. ./getfile
9466	vendorhtml1dir="$ans"
9467	vendorhtml1direxp="$ansexp"
9468	;;
9469esac
9470: Use ' ' for none so value is preserved next time through Configure
9471$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9472prefixvar=vendorhtml1dir
9473. ./installprefix
9474
9475: Set the vendorhtml3dir variables
9476case "$vendorprefix" in
9477'')	vendorhtml3dir=''
9478	vendorhtml3direxp=''
9479	;;
9480*)	: determine where vendor-supplied module html pages go.
9481	: There is no standard location, so try to copy the previously-selected
9482	: directory structure for the core html pages.
9483	: XXX Better default suggestions would be welcome.
9484	case "$vendorhtml3dir" in
9485	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9486	*)	dflt=$vendorhtml3dir ;;
9487	esac
9488	case "$dflt" in
9489	''|' ') dflt=none ;;
9490	esac
9491	fn=dn+~
9492	rp='Pathname for the vendor-supplied html pages?'
9493	. ./getfile
9494	vendorhtml3dir="$ans"
9495	vendorhtml3direxp="$ansexp"
9496	;;
9497esac
9498: Use ' ' for none so value is preserved next time through Configure
9499$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9500prefixvar=vendorhtml3dir
9501. ./installprefix
9502
9503: Set the vendorman1dir variables
9504case "$vendorprefix" in
9505'')	vendorman1dir=''
9506	vendorman1direxp=''
9507	;;
9508*)	: determine where vendor-supplied manual pages go.
9509	case "$vendorman1dir" in
9510	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9511	*)	dflt=$vendorman1dir ;;
9512	esac
9513	case "$dflt" in
9514	''|' ') dflt=none ;;
9515	esac
9516	fn=nd~+
9517	rp='Pathname for the vendor-supplied manual section 1 pages?'
9518	. ./getfile
9519	vendorman1dir="$ans"
9520	vendorman1direxp="$ansexp"
9521	;;
9522esac
9523: Use ' ' for none so value is preserved next time through Configure
9524$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9525prefixvar=vendorman1dir
9526. ./installprefix
9527
9528: Set the vendorman3dir variables
9529case "$vendorprefix" in
9530'')	vendorman3dir=''
9531	vendorman3direxp=''
9532	;;
9533*)	: determine where vendor-supplied module manual pages go.
9534	case "$vendorman3dir" in
9535	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9536	*)	dflt=$vendorman3dir ;;
9537	esac
9538	case "$dflt" in
9539	''|' ') dflt=none ;;
9540	esac
9541	fn=nd~+
9542	rp='Pathname for the vendor-supplied manual section 3 pages?'
9543	. ./getfile
9544	vendorman3dir="$ans"
9545	vendorman3direxp="$ansexp"
9546	;;
9547esac
9548: Use ' ' for none so value is preserved next time through Configure
9549$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9550prefixvar=vendorman3dir
9551. ./installprefix
9552
9553: Set the vendorscript variables
9554case "$vendorprefix" in
9555'')	d_vendorscript="$undef"
9556	vendorscript=''
9557	vendorscriptexp=''
9558	;;
9559*)	d_vendorscript="$define"
9560	: determine where vendor-supplied scripts go.
9561	case "$vendorscript" in
9562	'')	dflt=$vendorprefix/script
9563		$test -d $dflt || dflt=$vendorbin ;;
9564	*)  dflt="$vendorscript" ;;
9565	esac
9566	$cat <<EOM
9567
9568The installation process will create a directory for
9569vendor-supplied scripts.
9570
9571EOM
9572	fn=d~+
9573	rp='Pathname for the vendor-supplied scripts directory?'
9574	. ./getfile
9575	vendorscript="$ans"
9576	vendorscriptexp="$ansexp"
9577	;;
9578esac
9579prefixvar=vendorscript
9580. ./installprefix
9581
9582: script used to emit important warnings
9583cat >warn <<EOS
9584$startsh
9585if test \$# -gt 0; then
9586	echo "\$@" >msg
9587else
9588	cat >msg
9589fi
9590echo "*** WARNING:" >&4
9591sed -e 's/^/*** /' <msg >&4
9592echo "*** " >&4
9593cat msg >>config.msg
9594echo " " >>config.msg
9595rm -f msg
9596EOS
9597chmod +x warn
9598$eunicefix warn
9599
9600: see which of string.h or strings.h is needed
9601echo " "
9602strings=`./findhdr string.h`
9603if $test "$strings" && $test -r "$strings"; then
9604	echo "Using <string.h> instead of <strings.h>." >&4
9605	val="$define"
9606else
9607	val="$undef"
9608	strings=`./findhdr strings.h`
9609	if $test "$strings" && $test -r "$strings"; then
9610		echo "Using <strings.h> instead of <string.h>." >&4
9611	else
9612		./warn "No string header found -- You'll surely have problems."
9613	fi
9614fi
9615set i_string
9616eval $setvar
9617case "$i_string" in
9618"$undef") strings=`./findhdr strings.h`;;
9619*)	  strings=`./findhdr string.h`;;
9620esac
9621
9622: see if qgcvt exists
9623set qgcvt d_qgcvt
9624eval $inlibc
9625
9626: Check print/scan long double stuff
9627echo " "
9628
9629if $test X"$d_longdbl" = X"$define"; then
9630
9631echo "Checking how to print long doubles..." >&4
9632
9633if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9634	$cat >try.c <<'EOCP'
9635#include <sys/types.h>
9636#include <stdio.h>
9637int main() {
9638  double d = 123.456;
9639  printf("%.3f\n", d);
9640}
9641EOCP
9642	set try
9643	if eval $compile; then
9644		yyy=`$run ./try`
9645		case "$yyy" in
9646		123.456)
9647			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9648                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9649			echo "We will use %f."
9650			;;
9651		esac
9652	fi
9653fi
9654
9655if $test X"$sPRIfldbl" = X; then
9656	$cat >try.c <<'EOCP'
9657#include <sys/types.h>
9658#include <stdio.h>
9659int main() {
9660  long double d = 123.456;
9661  printf("%.3Lf\n", d);
9662}
9663EOCP
9664	set try
9665	if eval $compile; then
9666		yyy=`$run ./try`
9667		case "$yyy" in
9668		123.456)
9669			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9670                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9671			echo "We will use %Lf."
9672			;;
9673		esac
9674	fi
9675fi
9676
9677if $test X"$sPRIfldbl" = X; then
9678	$cat >try.c <<'EOCP'
9679#include <sys/types.h>
9680#include <stdio.h>
9681int main() {
9682  long double d = 123.456;
9683  printf("%.3llf\n", d);
9684}
9685EOCP
9686	set try
9687	if eval $compile; then
9688		yyy=`$run ./try`
9689		case "$yyy" in
9690		123.456)
9691			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9692                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9693			echo "We will use %llf."
9694			;;
9695		esac
9696	fi
9697fi
9698
9699if $test X"$sPRIfldbl" = X; then
9700	$cat >try.c <<'EOCP'
9701#include <sys/types.h>
9702#include <stdio.h>
9703int main() {
9704  long double d = 123.456;
9705  printf("%.3lf\n", d);
9706}
9707EOCP
9708	set try
9709	if eval $compile; then
9710		yyy=`$run ./try`
9711		case "$yyy" in
9712		123.456)
9713			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9714                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9715			echo "We will use %lf."
9716			;;
9717		esac
9718	fi
9719fi
9720
9721if $test X"$sPRIfldbl" = X; then
9722	echo "Cannot figure out how to print long doubles." >&4
9723else
9724	sSCNfldbl=$sPRIfldbl	# expect consistency
9725fi
9726
9727$rm_try
9728
9729fi # d_longdbl
9730
9731case "$sPRIfldbl" in
9732'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9733	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9734	d_SCNfldbl="$undef";
9735	;;
9736*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9737	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9738	d_SCNfldbl="$define";
9739	;;
9740esac
9741
9742: Check how to convert floats to strings.
9743
9744if test "X$d_Gconvert" = X; then
9745
9746echo " "
9747echo "Checking for an efficient way to convert floats to strings."
9748echo " " > try.c
9749case "$uselongdouble" in
9750"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9751esac
9752case "$d_longdbl" in
9753"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9754esac
9755case "$d_PRIgldbl" in
9756"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9757esac
9758$cat >>try.c <<EOP
9759#ifdef TRY_gconvert
9760#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9761char *myname = "gconvert";
9762#endif
9763#ifdef TRY_gcvt
9764#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9765char *myname = "gcvt";
9766#endif
9767#ifdef TRY_qgcvt
9768#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9769char *myname = "qgcvt";
9770#define DOUBLETYPE long double
9771#endif
9772#ifdef TRY_sprintf
9773#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9774#ifdef HAS_PRIgldbl
9775#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9776#else
9777#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9778#endif
9779#else
9780#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9781#endif
9782char *myname = "sprintf";
9783#endif
9784
9785#ifndef DOUBLETYPE
9786#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9787#define DOUBLETYPE long double
9788#else
9789#define DOUBLETYPE double
9790#endif
9791#endif
9792
9793#include <stdio.h>
9794
9795#$i_stdlib I_STDLIB
9796#ifdef I_STDLIB
9797#include <stdlib.h>
9798#endif
9799#$i_string I_STRING
9800#ifdef I_STRING
9801#  include <string.h>
9802#else
9803#  include <strings.h>
9804#endif
9805
9806int checkit(char *expect, char *got)
9807{
9808    if (strcmp(expect, got)) {
9809		printf("%s oddity:  Expected %s, got %s\n",
9810			myname, expect, got);
9811		exit(1);
9812	}
9813}
9814
9815int main()
9816{
9817	char buf[64];
9818	buf[63] = '\0';
9819
9820	/* This must be 1st test on (which?) platform */
9821	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9822	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9823	checkit("0.1", buf);
9824
9825	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9826	checkit("0.01", buf);
9827
9828	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9829	checkit("0.001", buf);
9830
9831	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9832	checkit("0.0001", buf);
9833
9834	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9835	if (strlen(buf) > 5)
9836	    checkit("9e-005", buf); /* for Microsoft ?? */
9837	else
9838	    checkit("9e-05", buf);
9839
9840	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9841	checkit("1", buf);
9842
9843	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9844	checkit("1.1", buf);
9845
9846	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9847	checkit("1.01", buf);
9848
9849	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9850	checkit("1.001", buf);
9851
9852	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9853	checkit("1.0001", buf);
9854
9855	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9856	checkit("1.00001", buf);
9857
9858	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9859	checkit("1.000001", buf);
9860
9861	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9862	checkit("0", buf);
9863
9864	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9865	checkit("-1", buf);
9866
9867	/* Some Linux gcvt's give 1.e+5 here. */
9868	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9869	checkit("100000", buf);
9870
9871	/* Some Linux gcvt's give -1.e+5 here. */
9872	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9873	checkit("-100000", buf);
9874
9875	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9876	checkit("123.456", buf);
9877
9878	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9879	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9880	/* 34 should be enough to scare even long double
9881	 * places into using the e notation. */
9882	if (strlen(buf) > 5)
9883	    checkit("1e+034", buf); /* for Microsoft */
9884	else
9885	    checkit("1e+34", buf);
9886
9887	/* For Perl, if you add additional tests here, also add them to
9888	 * t/base/num.t for benefit of platforms not using Configure or
9889	 * overriding d_Gconvert */
9890
9891	exit(0);
9892}
9893EOP
9894: first add preferred functions to our list
9895xxx_list=""
9896for xxx_convert in $gconvert_preference; do
9897    case $xxx_convert in
9898    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9899    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9900    esac
9901done
9902: then add any others
9903for xxx_convert in gconvert gcvt sprintf; do
9904    case "$xxx_list" in
9905    *$xxx_convert*) ;;
9906    *) xxx_list="$xxx_list $xxx_convert" ;;
9907    esac
9908done
9909
9910case "$d_longdbl$uselongdouble" in
9911"$define$define")
9912    : again, add prefered functions to our list first
9913    xxx_ld_list=""
9914    for xxx_convert in $gconvert_ld_preference; do
9915        case $xxx_convert in
9916        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9917        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9918        esac
9919    done
9920    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9921    for xxx_convert in qgcvt sprintf $xxx_list; do
9922        case "$xxx_ld_list" in
9923        $xxx_convert*|*" $xxx_convert"*) ;;
9924        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9925        esac
9926    done
9927    : if sprintf cannot do long doubles, move it to the end
9928    if test "$d_PRIgldbl" != "$define"; then
9929        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9930    fi
9931    : if no qgcvt, remove it
9932    if test "$d_qgcvt" != "$define"; then
9933        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9934    fi
9935    : use the ld_list
9936    xxx_list="$xxx_ld_list"
9937    ;;
9938esac
9939
9940for xxx_convert in $xxx_list; do
9941	echo "Trying $xxx_convert..."
9942	$rm -f try try$_o core
9943	set try -DTRY_$xxx_convert
9944	if eval $compile; then
9945		echo "$xxx_convert() found." >&4
9946		if $run ./try; then
9947			echo "I'll use $xxx_convert to convert floats into a string." >&4
9948			break;
9949		else
9950			echo "...But $xxx_convert didn't work as I expected."
9951			xxx_convert=''
9952		fi
9953	else
9954		echo "$xxx_convert NOT found." >&4
9955	fi
9956done
9957
9958if test X$xxx_convert = X; then
9959    echo "*** WHOA THERE!!! ***" >&4
9960    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9961    xxx_convert=sprintf
9962fi
9963
9964case "$xxx_convert" in
9965gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9966gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9967qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9968*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9969   "$define$define$define")
9970      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9971   "$define$define$undef")
9972      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9973   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9974   esac
9975   ;;
9976esac
9977
9978fi
9979$rm_try
9980
9981: see if _fwalk exists
9982set fwalk d__fwalk
9983eval $inlibc
9984
9985: Initialize h_fcntl
9986h_fcntl=false
9987
9988: Initialize h_sysfile
9989h_sysfile=false
9990
9991: access call always available on UNIX
9992set access d_access
9993eval $inlibc
9994
9995: locate the flags for 'access()'
9996case "$d_access" in
9997"$define")
9998	echo " "
9999	$cat >access.c <<EOCP
10000#include <sys/types.h>
10001#ifdef I_FCNTL
10002#include <fcntl.h>
10003#endif
10004#ifdef I_SYS_FILE
10005#include <sys/file.h>
10006#endif
10007#ifdef I_UNISTD
10008#include <unistd.h>
10009#endif
10010#$i_stdlib I_STDLIB
10011#ifdef I_STDLIB
10012#include <stdlib.h>
10013#endif
10014int main() {
10015	exit(R_OK);
10016}
10017EOCP
10018	: check sys/file.h first, no particular reason here
10019	if $test `./findhdr sys/file.h` && \
10020		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10021		h_sysfile=true;
10022		echo "<sys/file.h> defines the *_OK access constants." >&4
10023	elif $test `./findhdr fcntl.h` && \
10024		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10025		h_fcntl=true;
10026		echo "<fcntl.h> defines the *_OK access constants." >&4
10027	elif $test `./findhdr unistd.h` && \
10028		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10029		echo "<unistd.h> defines the *_OK access constants." >&4
10030	else
10031		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10032	fi
10033	;;
10034esac
10035$rm -f access*
10036
10037: see if accessx exists
10038set accessx d_accessx
10039eval $inlibc
10040
10041: see if aintl exists
10042set aintl d_aintl
10043eval $inlibc
10044
10045: see if alarm exists
10046set alarm d_alarm
10047eval $inlibc
10048
10049: see if 64bit time functions exists
10050
10051set ctime64 d_ctime64
10052eval $inlibc
10053
10054set localtime64 d_localtime64
10055eval $inlibc
10056
10057set gmtime64 d_gmtime64
10058eval $inlibc
10059
10060set mktime64 d_mktime64
10061eval $inlibc
10062
10063set difftime64 d_difftime64
10064eval $inlibc
10065
10066set asctime64 d_asctime64
10067eval $inlibc
10068
10069: see if POSIX threads are available
10070set pthread.h i_pthread
10071eval $inhdr
10072
10073: define a fucntion to check prototypes
10074$cat > protochk <<EOSH
10075$startsh
10076cc="$cc"
10077optimize="$optimize"
10078ccflags="$ccflags"
10079prototype="$prototype"
10080define="$define"
10081rm_try="$rm_try"
10082usethreads=$usethreads
10083i_pthread=$i_pthread
10084pthread_h_first=$pthread_h_first
10085EOSH
10086
10087$cat >> protochk <<'EOSH'
10088
10089$rm_try
10090foo="$1"
10091shift
10092while test $# -ge 2; do
10093	case "$1" in
10094		$define) echo "#include <$2>" >> try.c ;;
10095		literal) echo "$2" >> try.c ;;
10096	esac
10097    # Extra magic for the benefit of systems that need pthread.h
10098    # to be included early to correctly detect threadsafe functions.
10099    # Such functions must guarantee themselves, though, that the usethreads
10100    # and i_pthread have been defined, before calling protochk.
10101    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10102	echo "#include <pthread.h>" >> try.c
10103	pthread_h_done=yes
10104    fi
10105    shift 2
10106done
10107test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10108cat >> try.c <<'EOCP'
10109#ifdef CAN_PROTOTYPE
10110#define	_(args) args
10111#else
10112#define	_(args) ()
10113#endif
10114EOCP
10115echo "$foo" >> try.c
10116echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10117$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10118status=$?
10119$rm_try
10120exit $status
10121EOSH
10122chmod +x protochk
10123$eunicefix protochk
10124
10125: Define hasproto macro for Configure internal use
10126hasproto='varname=$1; func=$2; shift; shift;
10127while $test $# -ge 2; do
10128	case "$1" in
10129	$define) echo "#include <$2>";;
10130	esac ;
10131    shift 2;
10132done > try.c;
10133$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10134if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10135	echo "$func() prototype found.";
10136	val="$define";
10137else
10138	echo "$func() prototype NOT found.";
10139	val="$undef";
10140fi;
10141set $varname;
10142eval $setvar;
10143$rm_try tryout.c'
10144
10145: see if sys/types.h has to be included
10146set sys/types.h i_systypes
10147eval $inhdr
10148
10149: see if sys/select.h has to be included
10150set sys/select.h i_sysselct
10151eval $inhdr
10152
10153: Define hasfield macro for Configure internal use
10154hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10155while $test $# -ge 2; do
10156	case "$1" in
10157	$define) echo "#include <$2>";;
10158	esac ;
10159    shift 2;
10160done > try.c;
10161echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10162set try;
10163if eval $compile; then
10164	val="$define";
10165else
10166	val="$undef";
10167fi;
10168set $varname;
10169eval $setvar;
10170$rm_try'
10171
10172: see if we should include time.h, sys/time.h, or both
10173echo " "
10174if test "X$timeincl" = X; then
10175	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10176	$echo $n "I'm now running the test program...$c"
10177	$cat >try.c <<EOCP
10178#include <sys/types.h>
10179#ifdef I_TIME
10180#include <time.h>
10181#endif
10182#ifdef I_SYSTIME
10183#ifdef SYSTIMEKERNEL
10184#define KERNEL
10185#endif
10186#include <sys/time.h>
10187#endif
10188#ifdef I_SYSSELECT
10189#include <sys/select.h>
10190#endif
10191#$i_stdlib I_STDLIB
10192#ifdef I_STDLIB
10193#include <stdlib.h>
10194#endif
10195int main()
10196{
10197	struct tm foo;
10198#ifdef S_TIMEVAL
10199	struct timeval bar;
10200#endif
10201#ifdef S_TIMEZONE
10202	struct timezone tzp;
10203#endif
10204	if (foo.tm_sec == foo.tm_sec)
10205		exit(0);
10206#ifdef S_TIMEVAL
10207	if (bar.tv_sec == bar.tv_sec)
10208		exit(0);
10209#endif
10210	exit(1);
10211}
10212EOCP
10213	flags=''
10214	for s_timezone in '-DS_TIMEZONE' ''; do
10215	sysselect=''
10216	for s_timeval in '-DS_TIMEVAL' ''; do
10217	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10218	for i_time in '' '-DI_TIME'; do
10219	for i_systime in '-DI_SYSTIME' ''; do
10220		case "$flags" in
10221		'') $echo $n ".$c"
10222			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10223			if eval $compile; then
10224				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10225				shift
10226				flags="$*"
10227				echo " "
10228				$echo $n "Succeeded with $flags$c"
10229			fi
10230			;;
10231		esac
10232	done
10233	done
10234	done
10235	done
10236	done
10237	timeincl=''
10238	echo " "
10239	case "$flags" in
10240	*SYSTIMEKERNEL*) i_systimek="$define"
10241		timeincl=`./findhdr sys/time.h`
10242		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10243	*) i_systimek="$undef";;
10244	esac
10245	case "$flags" in
10246	*I_TIME*) i_time="$define"
10247		timeincl=`./findhdr time.h`" $timeincl"
10248		echo "We'll include <time.h>." >&4;;
10249	*) i_time="$undef";;
10250	esac
10251	case "$flags" in
10252	*I_SYSTIME*) i_systime="$define"
10253		timeincl=`./findhdr sys/time.h`" $timeincl"
10254		echo "We'll include <sys/time.h>." >&4;;
10255	*) i_systime="$undef";;
10256	esac
10257	$rm_try
10258fi
10259: see if struct tm knows about tm_zone
10260case "$i_systime$i_time" in
10261*$define*)
10262        echo " "
10263        echo "Checking to see if your struct tm has tm_zone field..." >&4
10264        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10265        eval $hasfield
10266        ;;
10267*)      val="$undef"
10268        set d_tm_tm_zone
10269        eval $setvar
10270        ;;
10271esac
10272case "$d_tm_tm_zone" in
10273"$define")      echo "Yes, it does."   ;;
10274*)              echo "No, it doesn't." ;;
10275esac
10276: see if struct tm knows about tm_gmtoff
10277case "$i_systime$i_time" in
10278*$define*)
10279        echo " "
10280        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10281        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10282        eval $hasfield
10283        ;;
10284*)      val="$undef"
10285        set d_tm_tm_gmtoff
10286        eval $setvar
10287        ;;
10288esac
10289case "$d_tm_tm_gmtoff" in
10290"$define")      echo "Yes, it does."   ;;
10291*)              echo "No, it doesn't." ;;
10292esac
10293
10294: see if asctime_r exists
10295set asctime_r d_asctime_r
10296eval $inlibc
10297case "$d_asctime_r" in
10298"$define")
10299	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10300	case "$d_asctime_r_proto:$usethreads" in
10301	":define")	d_asctime_r_proto=define
10302		set d_asctime_r_proto asctime_r $hdrs
10303		eval $hasproto ;;
10304	*)	;;
10305	esac
10306	case "$d_asctime_r_proto" in
10307	define)
10308	case "$asctime_r_proto" in
10309	''|0) try='char* asctime_r(const struct tm*, char*);'
10310	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10311	esac
10312	case "$asctime_r_proto" in
10313	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10314	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10315	esac
10316	case "$asctime_r_proto" in
10317	''|0) try='int asctime_r(const struct tm*, char*);'
10318	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10319	esac
10320	case "$asctime_r_proto" in
10321	''|0) try='int asctime_r(const struct tm*, char*, int);'
10322	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10323	esac
10324	case "$asctime_r_proto" in
10325	''|0)	d_asctime_r=undef
10326 	        asctime_r_proto=0
10327		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10328	* )	case "$asctime_r_proto" in
10329		REENTRANT_PROTO*) ;;
10330		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10331		esac
10332		echo "Prototype: $try" ;;
10333	esac
10334	;;
10335	*)	case "$usethreads" in
10336		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10337		esac
10338		d_asctime_r=undef
10339		asctime_r_proto=0
10340		;;
10341	esac
10342	;;
10343*)	asctime_r_proto=0
10344	;;
10345esac
10346
10347: see if atolf exists
10348set atolf d_atolf
10349eval $inlibc
10350
10351: see if atoll exists
10352set atoll d_atoll
10353eval $inlibc
10354
10355: Look for GCC-style attribute format
10356case "$d_attribute_format" in
10357'')
10358echo " "
10359echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10360$cat >attrib.c <<'EOCP'
10361#include <stdio.h>
10362void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10363EOCP
10364if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10365	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10366		echo "Your C compiler doesn't support __attribute__((format))."
10367		val="$undef"
10368	else
10369		echo "Your C compiler supports __attribute__((format))."
10370		val="$define"
10371	fi
10372else
10373	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10374	val="$undef"
10375fi
10376;;
10377*) val="$d_attribute_format" ;;
10378esac
10379set d_attribute_format
10380eval $setvar
10381$rm -f attrib*
10382
10383: Look for GCC-style attribute format with null format allowed
10384case "$d_printf_format_null" in
10385'') case "$d_attribute_format" in
10386    $define)
10387	echo " "
10388	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10389$cat >attrib.c <<EOCP
10390#include <stdio.h>
10391#$i_stdlib I_STDLIB
10392#ifdef I_STDLIB
10393#include <stdlib.h>
10394#endif
10395int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10396int null_printf (char* pat,...) { return (int)pat; }
10397int main () { exit(null_printf(NULL)); }
10398EOCP
10399	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10400	    : run the executable in case it produces a run-time warning
10401	    if $run ./attrib >>attrib.out 2>&1; then
10402		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10403		    echo "Your C compiler doesn't allow __printf__ format to be null."
10404		    val="$undef"
10405		else
10406		    echo "Your C compiler allows __printf__ format to be null."
10407		    val="$define"
10408		fi
10409	    else
10410	    echo "Your C compiler executable failed with __printf__ format null."
10411	    val="$undef"
10412	fi
10413    else
10414	echo "Your C compiler fails with __printf__ format null."
10415	val="$undef"
10416    fi
10417    ;;
10418    *)  val="$undef" ;;
10419    esac
10420;;
10421*)  val="$d_printf_format_null" ;;
10422esac
10423set d_printf_format_null
10424eval $setvar
10425$rm -f attrib*
10426
10427: Look for GCC-style attribute malloc
10428case "$d_attribute_malloc" in
10429'')
10430echo " "
10431echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10432$cat >attrib.c <<'EOCP'
10433#include <stdio.h>
10434char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10435EOCP
10436if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10437	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10438		echo "Your C compiler doesn't support __attribute__((malloc))."
10439		val="$undef"
10440	else
10441		echo "Your C compiler supports __attribute__((malloc))."
10442		val="$define"
10443	fi
10444else
10445	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10446	val="$undef"
10447fi
10448;;
10449*) val="$d_attribute_malloc" ;;
10450esac
10451set d_attribute_malloc
10452eval $setvar
10453$rm -f attrib*
10454
10455: Look for GCC-style attribute nonnull
10456case "$d_attribute_nonnull" in
10457'')
10458echo " "
10459echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10460$cat >attrib.c <<'EOCP'
10461#include <stdio.h>
10462void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10463EOCP
10464if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10465	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10466		echo "Your C compiler doesn't support __attribute__((nonnull))."
10467		val="$undef"
10468	else
10469		echo "Your C compiler supports __attribute__((nonnull))."
10470		val="$define"
10471	fi
10472else
10473	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10474	val="$undef"
10475fi
10476;;
10477*) val="$d_attribute_nonnull" ;;
10478esac
10479set d_attribute_nonnull
10480eval $setvar
10481$rm -f attrib*
10482
10483: Look for GCC-style attribute noreturn
10484case "$d_attribute_noreturn" in
10485'')
10486echo " "
10487echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10488$cat >attrib.c <<'EOCP'
10489#include <stdio.h>
10490void fall_over_dead( void ) __attribute__((noreturn));
10491EOCP
10492if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10493	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10494		echo "Your C compiler doesn't support __attribute__((noreturn))."
10495		val="$undef"
10496	else
10497		echo "Your C compiler supports __attribute__((noreturn))."
10498		val="$define"
10499	fi
10500else
10501	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10502	val="$undef"
10503fi
10504;;
10505*) val="$d_attribute_noreturn" ;;
10506esac
10507set d_attribute_noreturn
10508eval $setvar
10509$rm -f attrib*
10510
10511: Look for GCC-style attribute pure
10512case "$d_attribute_pure" in
10513'')
10514echo " "
10515echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10516$cat >attrib.c <<'EOCP'
10517#include <stdio.h>
10518int square( int n ) __attribute__((pure));
10519EOCP
10520if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10521	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10522		echo "Your C compiler doesn't support __attribute__((pure))."
10523		val="$undef"
10524	else
10525		echo "Your C compiler supports __attribute__((pure))."
10526		val="$define"
10527	fi
10528else
10529	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10530	val="$undef"
10531fi
10532;;
10533*) val="$d_attribute_pure" ;;
10534esac
10535set d_attribute_pure
10536eval $setvar
10537$rm -f attrib*
10538
10539: Look for GCC-style attribute unused
10540case "$d_attribute_unused" in
10541'')
10542echo " "
10543echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10544$cat >attrib.c <<'EOCP'
10545#include <stdio.h>
10546int do_something( int dummy __attribute__((unused)), int n );
10547EOCP
10548if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10549	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10550		echo "Your C compiler doesn't support __attribute__((unused))."
10551		val="$undef"
10552	else
10553		echo "Your C compiler supports __attribute__((unused))."
10554		val="$define"
10555	fi
10556else
10557	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10558	val="$undef"
10559fi
10560;;
10561*) val="$d_attribute_unused" ;;
10562esac
10563set d_attribute_unused
10564eval $setvar
10565$rm -f attrib*
10566
10567: Look for GCC-style attribute deprecated
10568case "$d_attribute_deprecated" in
10569'')
10570echo " "
10571echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10572$cat >attrib.c <<'EOCP'
10573#include <stdio.h>
10574int I_am_deprecated(void) __attribute__((deprecated));
10575EOCP
10576if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10577	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10578		echo "Your C compiler doesn't support __attribute__((deprecated))."
10579		val="$undef"
10580	else
10581		echo "Your C compiler supports __attribute__((deprecated))."
10582		val="$define"
10583	fi
10584else
10585	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10586	val="$undef"
10587fi
10588;;
10589*) val="$d_attribute_deprecated" ;;
10590esac
10591set d_attribute_deprecated
10592eval $setvar
10593$rm -f attrib*
10594
10595: Look for GCC-style attribute warn_unused_result
10596case "$d_attribute_warn_unused_result" in
10597'')
10598echo " "
10599echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10600$cat >attrib.c <<'EOCP'
10601#include <stdio.h>
10602int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10603EOCP
10604if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10605	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10606		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10607		val="$undef"
10608	else
10609		echo "Your C compiler supports __attribute__((warn_unused_result))."
10610		val="$define"
10611	fi
10612else
10613	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10614	val="$undef"
10615fi
10616;;
10617*) val="$d_attribute_warn_unused_result" ;;
10618esac
10619set d_attribute_warn_unused_result
10620eval $setvar
10621$rm -f attrib*
10622
10623: see if bcmp exists
10624set bcmp d_bcmp
10625eval $inlibc
10626
10627: see if bcopy exists
10628set bcopy d_bcopy
10629eval $inlibc
10630
10631: see if getpgrp exists
10632set getpgrp d_getpgrp
10633eval $inlibc
10634
10635case "$d_getpgrp" in
10636"$define")
10637	echo " "
10638	echo "Checking to see which flavor of getpgrp is in use..."
10639	$cat >try.c <<EOP
10640#$i_unistd I_UNISTD
10641#include <sys/types.h>
10642#ifdef I_UNISTD
10643#  include <unistd.h>
10644#endif
10645#$i_stdlib I_STDLIB
10646#ifdef I_STDLIB
10647#include <stdlib.h>
10648#endif
10649int main()
10650{
10651	if (getuid() == 0) {
10652		printf("(I see you are running Configure as super-user...)\n");
10653		setuid(1);
10654	}
10655#ifdef TRY_BSD_PGRP
10656	if (getpgrp(1) == 0)
10657		exit(0);
10658#else
10659	if (getpgrp() > 0)
10660		exit(0);
10661#endif
10662	exit(1);
10663}
10664EOP
10665	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10666		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10667		val="$define"
10668	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10669		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10670		val="$undef"
10671	else
10672		echo "I can't seem to compile and run the test program."
10673		if ./usg; then
10674			xxx="a USG one, i.e. you use getpgrp()."
10675		else
10676			# SVR4 systems can appear rather BSD-ish.
10677			case "$i_unistd" in
10678			$undef)
10679				xxx="a BSD one, i.e. you use getpgrp(pid)."
10680				val="$define"
10681				;;
10682			$define)
10683				xxx="probably a USG one, i.e. you use getpgrp()."
10684				val="$undef"
10685				;;
10686			esac
10687		fi
10688		echo "Assuming your getpgrp is $xxx" >&4
10689	fi
10690	;;
10691*) val="$undef";;
10692esac
10693set d_bsdgetpgrp
10694eval $setvar
10695$rm_try
10696
10697: see if setpgrp exists
10698set setpgrp d_setpgrp
10699eval $inlibc
10700
10701case "$d_setpgrp" in
10702"$define")
10703	echo " "
10704	echo "Checking to see which flavor of setpgrp is in use..."
10705	$cat >try.c <<EOP
10706#$i_unistd I_UNISTD
10707#include <sys/types.h>
10708#ifdef I_UNISTD
10709#  include <unistd.h>
10710#endif
10711#$i_stdlib I_STDLIB
10712#ifdef I_STDLIB
10713#include <stdlib.h>
10714#endif
10715int main()
10716{
10717	if (getuid() == 0) {
10718		printf("(I see you are running Configure as super-user...)\n");
10719		setuid(1);
10720	}
10721#ifdef TRY_BSD_PGRP
10722	if (-1 == setpgrp(1, 1))
10723		exit(0);
10724#else
10725	if (setpgrp() != -1)
10726		exit(0);
10727#endif
10728	exit(1);
10729}
10730EOP
10731	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10732		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10733		val="$define"
10734	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10735		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10736		val="$undef"
10737	else
10738		echo "(I can't seem to compile and run the test program.)"
10739		if ./usg; then
10740			xxx="a USG one, i.e. you use setpgrp()."
10741		else
10742			# SVR4 systems can appear rather BSD-ish.
10743			case "$i_unistd" in
10744			$undef)
10745				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10746				val="$define"
10747				;;
10748			$define)
10749				xxx="probably a USG one, i.e. you use setpgrp()."
10750				val="$undef"
10751				;;
10752			esac
10753		fi
10754		echo "Assuming your setpgrp is $xxx" >&4
10755	fi
10756	;;
10757*) val="$undef";;
10758esac
10759set d_bsdsetpgrp
10760eval $setvar
10761$rm_try
10762
10763: Look for GCC-style __builtin_choose_expr
10764case "$d_builtin_choose_expr" in
10765'')
10766    echo " "
10767    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10768    $cat >try.c <<'EOCP'
10769#include <assert.h>
10770#include <stdlib.h>
10771#include <stdio.h>
10772
10773#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10774
10775int main(void) {
10776    assert( SYRINX(1) == 2112 );
10777    assert( SYRINX(1) != 5150 );
10778    assert( SYRINX(0) == 5150 );
10779    assert( SYRINX(0) != 2112 );
10780    puts( "All good!" );
10781    exit(0);
10782}
10783
10784EOCP
10785    set try
10786    if eval $compile && $run ./try; then
10787	echo "Your C compiler supports __builtin_choose_expr."
10788	val="$define"
10789    else
10790	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10791	val="$undef"
10792    fi
10793;;
10794*) val="$d_builtin_choose_expr" ;;
10795esac
10796
10797set d_builtin_choose_expr
10798eval $setvar
10799$rm_try
10800
10801: Look for GCC-style __builtin_expect
10802case "$d_builtin_expect" in
10803'')
10804    echo " "
10805    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10806    $cat >try.c <<'EOCP'
10807int main(void) {
10808    int n = 50;
10809    if ( __builtin_expect(n, 0) ) n = 1;
10810    /* Remember shell exit code truth is 0, C truth is non-zero */
10811    return !(n == 1);
10812}
10813EOCP
10814    set try
10815    if eval $compile && $run ./try; then
10816	echo "Your C compiler supports __builtin_expect."
10817	val="$define"
10818    else
10819	echo "Your C compiler doesn't seem to understand __builtin_expect."
10820	val="$undef"
10821    fi
10822    ;;
10823*) val="$d_builtin_expect" ;;
10824esac
10825
10826set d_builtin_expect
10827eval $setvar
10828$rm_try
10829
10830: see if bzero exists
10831set bzero d_bzero
10832eval $inlibc
10833
10834: see if stdarg is available
10835echo " "
10836if $test `./findhdr stdarg.h`; then
10837	echo "<stdarg.h> found." >&4
10838	valstd="$define"
10839else
10840	echo "<stdarg.h> NOT found." >&4
10841	valstd="$undef"
10842fi
10843
10844: see if varags is available
10845echo " "
10846if $test `./findhdr varargs.h`; then
10847	echo "<varargs.h> found." >&4
10848else
10849	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10850fi
10851
10852: set up the varargs testing programs
10853$cat > varargs.c <<EOP
10854#ifdef I_STDARG
10855#include <stdarg.h>
10856#endif
10857#ifdef I_VARARGS
10858#include <varargs.h>
10859#endif
10860
10861#ifdef I_STDARG
10862int f(char *p, ...)
10863#else
10864int f(va_alist)
10865va_dcl
10866#endif
10867{
10868	va_list ap;
10869#ifndef I_STDARG
10870	char *p;
10871#endif
10872#ifdef I_STDARG
10873	va_start(ap,p);
10874#else
10875	va_start(ap);
10876	p = va_arg(ap, char *);
10877#endif
10878	va_end(ap);
10879	return 0;
10880}
10881EOP
10882$cat > varargs <<EOP
10883$startsh
10884if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10885	echo "true"
10886else
10887	echo "false"
10888fi
10889$rm -f varargs$_o
10890EOP
10891chmod +x varargs
10892
10893: now check which varargs header should be included
10894echo " "
10895i_varhdr=''
10896case "$valstd" in
10897"$define")
10898	if `./varargs I_STDARG`; then
10899		val='stdarg.h'
10900	elif `./varargs I_VARARGS`; then
10901		val='varargs.h'
10902	fi
10903	;;
10904*)
10905	if `./varargs I_VARARGS`; then
10906		val='varargs.h'
10907	fi
10908	;;
10909esac
10910case "$val" in
10911'')
10912echo "I could not find the definition for va_dcl... You have problems..." >&4
10913	val="$undef"; set i_stdarg; eval $setvar
10914	val="$undef"; set i_varargs; eval $setvar
10915	;;
10916*)
10917	set i_varhdr
10918	eval $setvar
10919	case "$i_varhdr" in
10920	stdarg.h)
10921		val="$define"; set i_stdarg; eval $setvar
10922		val="$undef"; set i_varargs; eval $setvar
10923		;;
10924	varargs.h)
10925		val="$undef"; set i_stdarg; eval $setvar
10926		val="$define"; set i_varargs; eval $setvar
10927		;;
10928	esac
10929	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10930esac
10931$rm -f varargs*
10932
10933: see if the Compiler supports C99 variadic macros
10934case "$i_stdarg$i_stdlib" in
10935    "$define$define")
10936    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10937    $cat >try.c <<EOCP
10938#include <stdio.h>
10939#include <stdarg.h>
10940
10941#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10942
10943int main() {
10944  char buf[20];
10945  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10946  puts(buf);
10947  return 0;
10948}
10949EOCP
10950    set try
10951    if eval $compile && $run ./try 2>&1 >/dev/null; then
10952	case "`$run ./try`" in
10953	    "123 456 789")
10954	    echo "You have C99 variadic macros." >&4
10955	    d_c99_variadic_macros="$define"
10956	    ;;
10957	    *)
10958	    echo "You don't have functional C99 variadic macros." >&4
10959	    d_c99_variadic_macros="$undef"
10960	    ;;
10961	esac
10962    else
10963	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10964	d_c99_variadic_macros="$undef"
10965    fi
10966    $rm_try
10967    ;;
10968    *)
10969    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10970    d_c99_variadic_macros="$undef"
10971    ;;
10972esac
10973
10974: see if signal is declared as pointer to function returning int or void
10975echo " "
10976xxx=`./findhdr signal.h`
10977$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10978if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10979	echo "You have int (*signal())() instead of void." >&4
10980	val="$undef"
10981elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10982	echo "You have void (*signal())()." >&4
10983	val="$define"
10984elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10985	echo "You have int (*signal())() instead of void." >&4
10986	val="$undef"
10987elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10988	echo "You have void (*signal())()." >&4
10989	val="$define"
10990else
10991	case "$d_voidsig" in
10992	'')
10993	echo "I can't determine whether signal handler returns void or int..." >&4
10994		dflt=void
10995		rp="What type does your signal handler return?"
10996		. ./myread
10997		case "$ans" in
10998		v*) val="$define";;
10999		*) val="$undef";;
11000		esac;;
11001	"$define")
11002		echo "As you already told me, signal handler returns void." >&4
11003		val="$define"
11004		;;
11005	*)	echo "As you already told me, signal handler returns int." >&4
11006		val="$undef"
11007		;;
11008	esac
11009fi
11010set d_voidsig
11011eval $setvar
11012case "$d_voidsig" in
11013"$define") signal_t="void";;
11014*) signal_t="int";;
11015esac
11016$rm -f $$.tmp
11017
11018: check for ability to cast large floats to 32-bit ints.
11019echo " "
11020echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11021if $test "$intsize" -ge 4; then
11022	xxx=int
11023else
11024	xxx=long
11025fi
11026$cat >try.c <<EOCP
11027#include <stdio.h>
11028#$i_stdlib I_STDLIB
11029#ifdef I_STDLIB
11030#include <stdlib.h>
11031#endif
11032#include <sys/types.h>
11033#include <signal.h>
11034$signal_t blech(int s) { exit(3); }
11035int main()
11036{
11037	$xxx i32;
11038	double f, g;
11039	int result = 0;
11040	char str[16];
11041	signal(SIGFPE, blech);
11042
11043	/* Don't let compiler optimize the test away.  Store the number
11044	   in a writable string for gcc to pass to sscanf under HP-UX.
11045	*/
11046	sprintf(str, "2147483647");
11047	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11048	g = 10 * f;
11049	i32  = ($xxx) g;
11050
11051	/* x86 processors will probably give 0x8000 0000, which is a
11052	   sign change.  We don't want that.  We want to mimic SPARC
11053	   behavior here, which is to preserve the sign and give
11054	   back 0x7fff ffff.
11055	*/
11056	if (i32 != ($xxx) f)
11057		result |= 1;
11058	exit(result);
11059}
11060EOCP
11061set try
11062if eval $compile_ok; then
11063	$run ./try
11064	yyy=$?
11065else
11066	echo "(I can't seem to compile the test program--assuming it can't)"
11067	yyy=1
11068fi
11069case "$yyy" in
110700)	val="$define"
11071	echo "Yup, it can."
11072	;;
11073*)	val="$undef"
11074	echo "Nope, it can't."
11075	;;
11076esac
11077set d_casti32
11078eval $setvar
11079$rm_try
11080
11081: check for ability to cast negative floats to unsigned
11082echo " "
11083echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11084$cat >try.c <<EOCP
11085#include <stdio.h>
11086#$i_stdlib I_STDLIB
11087#ifdef I_STDLIB
11088#include <stdlib.h>
11089#endif
11090#include <sys/types.h>
11091#include <signal.h>
11092$signal_t blech(int s) { exit(7); }
11093$signal_t blech_in_list(int s) { exit(4); }
11094unsigned long dummy_long(unsigned long p) { return p; }
11095unsigned int dummy_int(unsigned int p) { return p; }
11096unsigned short dummy_short(unsigned short p) { return p; }
11097int main()
11098{
11099	double f;
11100	unsigned long along;
11101	unsigned int aint;
11102	unsigned short ashort;
11103	int result = 0;
11104	char str[16];
11105
11106	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11107	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11108	   optimized the whole file away
11109	*/
11110	/* Store the number in a writable string for gcc to pass to
11111	   sscanf under HP-UX.
11112	*/
11113	sprintf(str, "-123");
11114	sscanf(str, "%lf", &f);  /* f = -123.; */
11115
11116	signal(SIGFPE, blech);
11117	along = (unsigned long)f;
11118	aint = (unsigned int)f;
11119	ashort = (unsigned short)f;
11120	if (along != (unsigned long)-123)
11121		result |= 1;
11122	if (aint != (unsigned int)-123)
11123		result |= 1;
11124	if (ashort != (unsigned short)-123)
11125		result |= 1;
11126	sprintf(str, "1073741824.");
11127	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11128	f = f + f;
11129	along = 0;
11130	along = (unsigned long)f;
11131	if (along != 0x80000000)
11132		result |= 2;
11133	f -= 1.;
11134	along = 0;
11135	along = (unsigned long)f;
11136	if (along != 0x7fffffff)
11137		result |= 1;
11138	f += 2.;
11139	along = 0;
11140	along = (unsigned long)f;
11141	if (along != 0x80000001)
11142		result |= 2;
11143	if (result)
11144		exit(result);
11145	signal(SIGFPE, blech_in_list);
11146	sprintf(str, "123.");
11147	sscanf(str, "%lf", &f);  /* f = 123.; */
11148	along = dummy_long((unsigned long)f);
11149	aint = dummy_int((unsigned int)f);
11150	ashort = dummy_short((unsigned short)f);
11151	if (along != (unsigned long)123)
11152		result |= 4;
11153	if (aint != (unsigned int)123)
11154		result |= 4;
11155	if (ashort != (unsigned short)123)
11156		result |= 4;
11157	exit(result);
11158
11159}
11160EOCP
11161set try
11162if eval $compile_ok; then
11163	$run ./try
11164	castflags=$?
11165else
11166	echo "(I can't seem to compile the test program--assuming it can't)"
11167	castflags=7
11168fi
11169case "$castflags" in
111700)	val="$define"
11171	echo "Yup, it can."
11172	;;
11173*)	val="$undef"
11174	echo "Nope, it can't."
11175	;;
11176esac
11177set d_castneg
11178eval $setvar
11179$rm_try
11180
11181: see if vprintf exists
11182echo " "
11183if set vprintf val -f d_vprintf; eval $csym; $val; then
11184	echo 'vprintf() found.' >&4
11185	val="$define"
11186	$cat >try.c <<EOF
11187#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11188#$i_varargs I_VARARGS
11189
11190#$i_stdlib I_STDLIB
11191#$i_unistd I_UNISTD
11192
11193#ifdef I_STDARG
11194#  include <stdarg.h>
11195#else /* I_VARARGS */
11196#  include <varargs.h>
11197#endif
11198
11199#ifdef I_UNISTD
11200#  include <unistd.h>
11201#endif
11202
11203#ifdef I_STDLIB
11204#  include <stdlib.h>
11205#endif
11206
11207#include <stdio.h> /* vsprintf prototype */
11208
11209#ifdef I_STDARG
11210void xxx(int n, ...)
11211{
11212    va_list args;
11213    char buf[10];
11214    va_start(args, n);
11215    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11216}
11217int main() { xxx(1, "foo"); }
11218
11219#else /* I_VARARGS */
11220
11221xxx(va_alist)
11222va_dcl
11223{
11224    va_list args;
11225    char buf[10];
11226    va_start(args);
11227    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11228}
11229int main() { xxx("foo"); }
11230
11231#endif
11232
11233EOF
11234	set try
11235	if eval $compile_ok; then
11236		if $run ./try; then
11237			echo "Your vsprintf() returns (int)." >&4
11238			val2="$undef"
11239		else
11240			echo "Your vsprintf() returns (char*)." >&4
11241			val2="$define"
11242		fi
11243	else
11244		echo 'I am unable to compile the vsprintf() test program.' >&4
11245		# We shouldn't get here.  If we do, assume the standard signature,
11246		# not the old BSD one.
11247		echo 'Guessing that vsprintf() returns (int).' >&4
11248		val2="$undef"
11249	fi
11250else
11251	echo 'vprintf() NOT found.' >&4
11252	val="$undef"
11253	val2="$undef"
11254fi
11255$rm_try
11256set d_vprintf
11257eval $setvar
11258val=$val2
11259set d_charvspr
11260eval $setvar
11261
11262: see if chown exists
11263set chown d_chown
11264eval $inlibc
11265
11266: see if chroot exists
11267set chroot d_chroot
11268eval $inlibc
11269
11270: see if chsize exists
11271set chsize d_chsize
11272eval $inlibc
11273
11274: see if class exists
11275set class d_class
11276eval $inlibc
11277
11278: see if clearenv exists
11279set clearenv d_clearenv
11280eval $inlibc
11281
11282: Define hasstruct macro for Configure internal use
11283hasstruct='varname=$1; struct=$2; shift; shift;
11284while $test $# -ge 2; do
11285	case "$1" in
11286	$define) echo "#include <$2>";;
11287	esac ;
11288    shift 2;
11289done > try.c;
11290echo "int main () { struct $struct foo; }" >> try.c;
11291set try;
11292if eval $compile; then
11293	val="$define";
11294else
11295	val="$undef";
11296fi;
11297set $varname;
11298eval $setvar;
11299$rm_try'
11300
11301: see whether socket exists
11302socketlib=''
11303sockethdr=''
11304echo " "
11305$echo $n "Hmm... $c" >&4
11306if set socket val -f d_socket; eval $csym; $val; then
11307	echo "Looks like you have Berkeley networking support." >&4
11308	d_socket="$define"
11309	if set setsockopt val -f; eval $csym; $val; then
11310		d_oldsock="$undef"
11311	else
11312		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11313		d_oldsock="$define"
11314	fi
11315else
11316	if $contains socklib libc.list >/dev/null 2>&1; then
11317		echo "Looks like you have Berkeley networking support." >&4
11318		d_socket="$define"
11319		: we will have to assume that it supports the 4.2 BSD interface
11320		d_oldsock="$undef"
11321	else
11322		echo "You don't have Berkeley networking in libc$_a..." >&4
11323		if test "X$d_socket" = "X$define"; then
11324		   echo "...but you seem to believe that you have sockets." >&4
11325		else
11326			for net in net socket
11327			do
11328				if test -f /usr/lib/lib$net$_a; then
11329					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11330					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11331					if $contains socket libc.list >/dev/null 2>&1; then
11332						d_socket="$define"
11333						socketlib="-l$net"
11334						case "$net" in
11335						net)
11336							echo "...but the Wollongong group seems to have hacked it in." >&4
11337							sockethdr="-I/usr/netinclude"
11338							;;
11339						esac
11340						echo "Found Berkeley sockets interface in lib$net." >&4
11341						if $contains setsockopt libc.list >/dev/null 2>&1; then
11342							d_oldsock="$undef"
11343						else
11344							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11345							d_oldsock="$define"
11346						fi
11347						break
11348					fi
11349				fi
11350			done
11351			if test "X$d_socket" != "X$define"; then
11352			   echo "or anywhere else I see." >&4
11353			   d_socket="$undef"
11354			   d_oldsock="$undef"
11355			fi
11356		fi
11357	fi
11358fi
11359
11360: see if socketpair exists
11361set socketpair d_sockpair
11362eval $inlibc
11363
11364
11365echo " "
11366echo "Checking the availability of certain socket constants..." >&4
11367for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11368	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11369	$cat >try.c <<EOF
11370#include <sys/types.h>
11371#include <sys/socket.h>
11372int main() {
11373    int i = $ENUM;
11374}
11375EOF
11376	val="$undef"
11377	set try; if eval $compile; then
11378		val="$define"
11379	fi
11380	set d_${enum}; eval $setvar
11381	$rm_try
11382done
11383
11384: see if this is a sys/uio.h system
11385set sys/uio.h i_sysuio
11386eval $inhdr
11387
11388: Check for cmsghdr support
11389echo " "
11390echo "Checking to see if your system supports struct cmsghdr..." >&4
11391set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11392eval $hasstruct
11393case "$d_cmsghdr_s" in
11394"$define")      echo "Yes, it does."   ;;
11395*)              echo "No, it doesn't." ;;
11396esac
11397
11398
11399: check for const keyword
11400echo " "
11401echo 'Checking to see if your C compiler knows about "const"...' >&4
11402$cat >const.c <<'EOCP'
11403typedef struct spug { int drokk; } spug;
11404int main()
11405{
11406	const char *foo;
11407	const spug y = { 0 };
11408}
11409EOCP
11410if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11411	val="$define"
11412	echo "Yup, it does."
11413else
11414	val="$undef"
11415	echo "Nope, it doesn't."
11416fi
11417set d_const
11418eval $setvar
11419
11420: see if copysignl exists
11421set copysignl d_copysignl
11422eval $inlibc
11423
11424: see if crypt exists
11425echo " "
11426set crypt d_crypt
11427eval $inlibc
11428case "$d_crypt" in
11429$define) cryptlib='' ;;
11430*)	if set crypt val -f d_crypt; eval $csym; $val; then
11431		echo 'crypt() found.' >&4
11432		val="$define"
11433		cryptlib=''
11434	else
11435		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11436		if $test -z "$cryptlib"; then
11437			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11438		else
11439			cryptlib=-lcrypt
11440		fi
11441		if $test -z "$cryptlib"; then
11442			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11443		else
11444			cryptlib=-lcrypt
11445		fi
11446		if $test -z "$cryptlib"; then
11447			cryptlib=`./loc libcrypt$_a "" $libpth`
11448		else
11449			cryptlib=-lcrypt
11450		fi
11451		if $test -z "$cryptlib"; then
11452			echo 'crypt() NOT found.' >&4
11453			val="$undef"
11454		else
11455			val="$define"
11456		fi
11457	fi
11458	set d_crypt
11459	eval $setvar
11460	;;
11461esac
11462
11463: see if this is a crypt.h system
11464set crypt.h i_crypt
11465eval $inhdr
11466
11467: see if crypt_r exists
11468set crypt_r d_crypt_r
11469eval $inlibc
11470case "$d_crypt_r" in
11471"$define")
11472	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11473	case "$d_crypt_r_proto:$usethreads" in
11474	":define")	d_crypt_r_proto=define
11475		set d_crypt_r_proto crypt_r $hdrs
11476		eval $hasproto ;;
11477	*)	;;
11478	esac
11479	case "$d_crypt_r_proto" in
11480	define)
11481	case "$crypt_r_proto" in
11482	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11483	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11484	esac
11485	case "$crypt_r_proto" in
11486	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11487	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11488	esac
11489	case "$crypt_r_proto" in
11490	''|0)	d_crypt_r=undef
11491 	        crypt_r_proto=0
11492		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11493	* )	case "$crypt_r_proto" in
11494		REENTRANT_PROTO*) ;;
11495		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11496		esac
11497		echo "Prototype: $try" ;;
11498	esac
11499	;;
11500	*)	case "$usethreads" in
11501		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11502		esac
11503		d_crypt_r=undef
11504		crypt_r_proto=0
11505		;;
11506	esac
11507	;;
11508*)	crypt_r_proto=0
11509	;;
11510esac
11511
11512: get csh whereabouts
11513case "$csh" in
11514'csh') val="$undef" ;;
11515*) val="$define" ;;
11516esac
11517set d_csh
11518eval $setvar
11519: Respect a hint or command line value for full_csh.
11520case "$full_csh" in
11521'') full_csh=$csh ;;
11522esac
11523
11524: see if ctermid exists
11525set ctermid d_ctermid
11526eval $inlibc
11527
11528: see if ctermid_r exists
11529set ctermid_r d_ctermid_r
11530eval $inlibc
11531case "$d_ctermid_r" in
11532"$define")
11533	hdrs="$i_systypes sys/types.h define stdio.h "
11534	case "$d_ctermid_r_proto:$usethreads" in
11535	":define")	d_ctermid_r_proto=define
11536		set d_ctermid_r_proto ctermid_r $hdrs
11537		eval $hasproto ;;
11538	*)	;;
11539	esac
11540	case "$d_ctermid_r_proto" in
11541	define)
11542	case "$ctermid_r_proto" in
11543	''|0) try='char* ctermid_r(char*);'
11544	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11545	esac
11546	case "$ctermid_r_proto" in
11547	''|0)	d_ctermid_r=undef
11548 	        ctermid_r_proto=0
11549		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11550	* )	case "$ctermid_r_proto" in
11551		REENTRANT_PROTO*) ;;
11552		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11553		esac
11554		echo "Prototype: $try" ;;
11555	esac
11556	;;
11557	*)	case "$usethreads" in
11558		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11559		esac
11560		d_ctermid_r=undef
11561		ctermid_r_proto=0
11562		;;
11563	esac
11564	;;
11565*)	ctermid_r_proto=0
11566	;;
11567esac
11568
11569: see if ctime_r exists
11570set ctime_r d_ctime_r
11571eval $inlibc
11572case "$d_ctime_r" in
11573"$define")
11574	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11575	case "$d_ctime_r_proto:$usethreads" in
11576	":define")	d_ctime_r_proto=define
11577		set d_ctime_r_proto ctime_r $hdrs
11578		eval $hasproto ;;
11579	*)	;;
11580	esac
11581	case "$d_ctime_r_proto" in
11582	define)
11583	case "$ctime_r_proto" in
11584	''|0) try='char* ctime_r(const time_t*, char*);'
11585	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11586	esac
11587	case "$ctime_r_proto" in
11588	''|0) try='char* ctime_r(const time_t*, char*, int);'
11589	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11590	esac
11591	case "$ctime_r_proto" in
11592	''|0) try='int ctime_r(const time_t*, char*);'
11593	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11594	esac
11595	case "$ctime_r_proto" in
11596	''|0) try='int ctime_r(const time_t*, char*, int);'
11597	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11598	esac
11599	case "$ctime_r_proto" in
11600	''|0)	d_ctime_r=undef
11601 	        ctime_r_proto=0
11602		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11603	* )	case "$ctime_r_proto" in
11604		REENTRANT_PROTO*) ;;
11605		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11606		esac
11607		echo "Prototype: $try" ;;
11608	esac
11609	;;
11610	*)	case "$usethreads" in
11611		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11612		esac
11613		d_ctime_r=undef
11614		ctime_r_proto=0
11615		;;
11616	esac
11617	;;
11618*)	ctime_r_proto=0
11619	;;
11620esac
11621
11622: see if cuserid exists
11623set cuserid d_cuserid
11624eval $inlibc
11625
11626: see if this is a limits.h system
11627set limits.h i_limits
11628eval $inhdr
11629
11630: see if this is a float.h system
11631set float.h i_float
11632eval $inhdr
11633
11634: See if number of significant digits in a double precision number is known
11635echo " "
11636$cat >dbl_dig.c <<EOM
11637#$i_limits I_LIMITS
11638#$i_float I_FLOAT
11639#ifdef I_LIMITS
11640#include <limits.h>
11641#endif
11642#ifdef I_FLOAT
11643#include <float.h>
11644#endif
11645#ifdef DBL_DIG
11646printf("Contains DBL_DIG");
11647#endif
11648EOM
11649$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11650if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11651	echo "DBL_DIG found." >&4
11652	val="$define"
11653else
11654	echo "DBL_DIG NOT found." >&4
11655	val="$undef"
11656fi
11657$rm -f dbl_dig.?
11658set d_dbl_dig
11659eval $setvar
11660
11661: see if dbm.h is available
11662: see if dbmclose exists
11663set dbmclose d_dbmclose
11664eval $inlibc
11665
11666case "$d_dbmclose" in
11667$define)
11668	set dbm.h i_dbm
11669	eval $inhdr
11670	case "$i_dbm" in
11671	$define)
11672		val="$undef"
11673		set i_rpcsvcdbm
11674		eval $setvar
11675		;;
11676	*)	set rpcsvc/dbm.h i_rpcsvcdbm
11677		eval $inhdr
11678		;;
11679	esac
11680	;;
11681*)	echo "We won't be including <dbm.h>"
11682	val="$undef"
11683	set i_dbm
11684	eval $setvar
11685	val="$undef"
11686	set i_rpcsvcdbm
11687	eval $setvar
11688	;;
11689esac
11690
11691: see if prototype for dbminit is available
11692echo " "
11693set d_dbminitproto dbminit $i_dbm dbm.h
11694eval $hasproto
11695
11696: see if difftime exists
11697set difftime d_difftime
11698eval $inlibc
11699
11700: see if this is a dirent system
11701echo " "
11702if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11703	val="$define"
11704	echo "<dirent.h> found." >&4
11705else
11706	val="$undef"
11707	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11708		echo "<sys/dir.h> found." >&4
11709		echo " "
11710	else
11711		xinc=`./findhdr sys/ndir.h`
11712	fi
11713	echo "<dirent.h> NOT found." >&4
11714fi
11715set i_dirent
11716eval $setvar
11717
11718: Look for type of directory structure.
11719echo " "
11720$cppstdin $cppflags $cppminus < "$xinc" > try.c
11721
11722case "$direntrytype" in
11723''|' ')
11724	case "$i_dirent" in
11725	$define) guess1='struct dirent' ;;
11726	*) guess1='struct direct'  ;;
11727	esac
11728	;;
11729*)	guess1="$direntrytype"
11730	;;
11731esac
11732
11733case "$guess1" in
11734'struct dirent') guess2='struct direct' ;;
11735*) guess2='struct dirent' ;;
11736esac
11737
11738if $contains "$guess1" try.c >/dev/null 2>&1; then
11739	direntrytype="$guess1"
11740	echo "Your directory entries are $direntrytype." >&4
11741elif $contains "$guess2" try.c >/dev/null 2>&1; then
11742	direntrytype="$guess2"
11743	echo "Your directory entries seem to be $direntrytype." >&4
11744else
11745	echo "I don't recognize your system's directory entries." >&4
11746	rp="What type is used for directory entries on this system?"
11747	dflt="$guess1"
11748	. ./myread
11749	direntrytype="$ans"
11750fi
11751$rm_try
11752
11753: see if the directory entry stores field length
11754echo " "
11755$cppstdin $cppflags $cppminus < "$xinc" > try.c
11756if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11757	echo "Good, your directory entry keeps length information in d_namlen." >&4
11758	val="$define"
11759else
11760	echo "Your directory entry does not know about the d_namlen field." >&4
11761	val="$undef"
11762fi
11763set d_dirnamlen
11764eval $setvar
11765$rm_try
11766
11767: Look for DIR.dd_fd
11768case "$i_dirent" in
11769"$define")
11770    echo "Checking to see if DIR has a dd_fd member variable" >&4
11771    $cat >try.c <<EOCP
11772#$i_stdlib I_STDLIB
11773#ifdef I_STDLIB
11774#include <stdlib.h>
11775#endif
11776#include <dirent.h>
11777
11778int main() {
11779    DIR dir;
11780    dir.dd_fd = 1;
11781    return 0;
11782}
11783EOCP
11784    val=$undef
11785    set try
11786    if eval $compile; then
11787        echo "Yes, it does."
11788        val="$define"
11789    else
11790        echo "No, it does not."
11791        val="$undef"
11792    fi
11793    ;;
11794*)
11795    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11796    val="$undef"
11797    ;;
11798esac
11799set d_dir_dd_fd
11800eval $setvar
11801$rm_try
11802
11803: see if this is an sysdir system
11804set sys/dir.h i_sysdir
11805eval $inhdr
11806
11807: see if this is an sysndir system
11808set sys/ndir.h i_sysndir
11809eval $inhdr
11810
11811: Look for dirfd
11812echo " "
11813$cat >dirfd.c <<EOM
11814#include <stdio.h>
11815#$i_stdlib I_STDLIB
11816#ifdef I_STDLIB
11817#include <stdlib.h>
11818#endif
11819#$i_dirent I_DIRENT		/**/
11820#$i_sysdir I_SYS_DIR		/**/
11821#$i_sysndir I_SYS_NDIR		/**/
11822#$i_systypes I_SYS_TYPES	/**/
11823#if defined(I_SYS_TYPES)
11824#include <sys/types.h>
11825#endif
11826#if defined(I_DIRENT)
11827#include <dirent.h>
11828#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11829#include <sys/dir.h>
11830#endif
11831#else
11832#ifdef I_SYS_NDIR
11833#include <sys/ndir.h>
11834#else
11835#ifdef I_SYS_DIR
11836#ifdef hp9000s500
11837#include <ndir.h>	/* may be wrong in the future */
11838#else
11839#include <sys/dir.h>
11840#endif
11841#endif
11842#endif
11843#endif 
11844int main() {
11845	DIR *dirp = opendir(".");
11846	if (dirfd(dirp) >= 0)
11847		exit(0);
11848	else
11849		exit(1);
11850}
11851EOM
11852val=$undef
11853set dirfd
11854if eval $compile; then
11855	val="$define"
11856fi
11857case "$val" in
11858$define)	echo "dirfd() found." >&4	;;
11859*)		echo "dirfd() NOT found." >&4	;;
11860esac
11861set d_dirfd
11862eval $setvar
11863$rm -f dirfd*
11864
11865: see if dlerror exists
11866xxx_runnm="$runnm"
11867runnm=false
11868set dlerror d_dlerror
11869eval $inlibc
11870runnm="$xxx_runnm"
11871
11872: see if dlfcn is available
11873set dlfcn.h i_dlfcn
11874eval $inhdr
11875
11876: Check what extension to use for shared libs
11877case "$usedl" in
11878$define|y|true)
11879	$cat << EOM
11880
11881On a few systems, the dynamically loaded modules that perl generates and uses
11882will need a different extension than shared libs. The default will probably
11883be appropriate.
11884
11885EOM
11886	case "$dlext" in
11887	'')	dflt="$so" ;;
11888	*)	dflt="$dlext" ;;
11889	esac
11890	rp='What is the extension of dynamically loaded modules'
11891	. ./myread
11892	dlext="$ans"
11893	;;
11894*)
11895	dlext="none"
11896	;;
11897esac
11898
11899: Check if dlsym need a leading underscore
11900echo " "
11901val="$undef"
11902
11903case "$dlsrc" in
11904dl_dlopen.xs)
11905	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11906	$cat >dyna.c <<'EOM'
11907fred () { }
11908EOM
11909
11910$cat >fred.c<<EOM
11911
11912#include <stdio.h>
11913#$i_stdlib I_STDLIB
11914#ifdef I_STDLIB
11915#include <stdlib.h>
11916#endif
11917#$i_dlfcn I_DLFCN
11918#ifdef I_DLFCN
11919#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11920#else
11921#include <sys/types.h>
11922#include <nlist.h>
11923#include <link.h>
11924#endif
11925
11926extern int fred() ;
11927
11928int main()
11929{
11930    void * handle ;
11931    void * symbol ;
11932#ifndef RTLD_LAZY
11933    int mode = 1 ;
11934#else
11935    int mode = RTLD_LAZY ;
11936#endif
11937    handle = dlopen("./dyna.$dlext", mode) ;
11938    if (handle == NULL) {
11939	printf ("1\n") ;
11940	fflush (stdout) ;
11941	exit(0);
11942    }
11943    symbol = dlsym(handle, "fred") ;
11944    if (symbol == NULL) {
11945	/* try putting a leading underscore */
11946	symbol = dlsym(handle, "_fred") ;
11947	if (symbol == NULL) {
11948	    printf ("2\n") ;
11949	    fflush (stdout) ;
11950	    exit(0);
11951	}
11952	printf ("3\n") ;
11953    }
11954    else
11955	printf ("4\n") ;
11956    fflush (stdout) ;
11957    exit(0);
11958}
11959EOM
11960	: Call the object file tmp-dyna.o in case dlext=o.
11961	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11962		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11963		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11964		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11965		xxx=`$run ./fred`
11966		case $xxx in
11967		1)	echo "Test program failed using dlopen." >&4
11968			echo "Perhaps you should not use dynamic loading." >&4;;
11969		2)	echo "Test program failed using dlsym." >&4
11970			echo "Perhaps you should not use dynamic loading." >&4;;
11971		3)	echo "dlsym needs a leading underscore" >&4
11972			val="$define" ;;
11973		4)	echo "dlsym doesn't need a leading underscore." >&4;;
11974		esac
11975	else
11976		echo "I can't compile and run the test program." >&4
11977                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11978	fi
11979	;;
11980esac
11981
11982$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11983
11984set d_dlsymun
11985eval $setvar
11986
11987: see if drand48_r exists
11988set drand48_r d_drand48_r
11989eval $inlibc
11990case "$d_drand48_r" in
11991"$define")
11992	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11993	case "$d_drand48_r_proto:$usethreads" in
11994	":define")	d_drand48_r_proto=define
11995		set d_drand48_r_proto drand48_r $hdrs
11996		eval $hasproto ;;
11997	*)	;;
11998	esac
11999	case "$d_drand48_r_proto" in
12000	define)
12001	case "$drand48_r_proto" in
12002	''|0) try='int drand48_r(struct drand48_data*, double*);'
12003	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12004	esac
12005	case "$drand48_r_proto" in
12006	''|0)	d_drand48_r=undef
12007 	        drand48_r_proto=0
12008		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12009	* )	case "$drand48_r_proto" in
12010		REENTRANT_PROTO*) ;;
12011		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12012		esac
12013		echo "Prototype: $try" ;;
12014	esac
12015	;;
12016	*)	case "$usethreads" in
12017		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12018		esac
12019		d_drand48_r=undef
12020		drand48_r_proto=0
12021		;;
12022	esac
12023	;;
12024*)	drand48_r_proto=0
12025	;;
12026esac
12027
12028: see if prototype for drand48 is available
12029echo " "
12030set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12031eval $hasproto
12032
12033: see if dup2 exists
12034set dup2 d_dup2
12035eval $inlibc
12036
12037: see if eaccess exists
12038set eaccess d_eaccess
12039eval $inlibc
12040
12041: see if endgrent exists
12042set endgrent d_endgrent
12043eval $inlibc
12044
12045: see if this is an grp system
12046set grp.h i_grp
12047eval $inhdr
12048
12049case "$i_grp" in
12050$define)
12051	xxx=`./findhdr grp.h`
12052	$cppstdin $cppflags $cppminus < $xxx >$$.h
12053
12054	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12055		val="$define"
12056	else
12057		val="$undef"
12058	fi
12059	set d_grpasswd
12060	eval $setvar
12061
12062	$rm -f $$.h
12063	;;
12064*)
12065	val="$undef";
12066	set d_grpasswd; eval $setvar
12067	;;
12068esac
12069
12070: see if endgrent_r exists
12071set endgrent_r d_endgrent_r
12072eval $inlibc
12073case "$d_endgrent_r" in
12074"$define")
12075	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12076	case "$d_endgrent_r_proto:$usethreads" in
12077	":define")	d_endgrent_r_proto=define
12078		set d_endgrent_r_proto endgrent_r $hdrs
12079		eval $hasproto ;;
12080	*)	;;
12081	esac
12082	case "$d_endgrent_r_proto" in
12083	define)
12084	case "$endgrent_r_proto" in
12085	''|0) try='int endgrent_r(FILE**);'
12086	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12087	esac
12088	case "$endgrent_r_proto" in
12089	''|0) try='void endgrent_r(FILE**);'
12090	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12091	esac
12092	case "$endgrent_r_proto" in
12093	''|0)	d_endgrent_r=undef
12094 	        endgrent_r_proto=0
12095		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12096	* )	case "$endgrent_r_proto" in
12097		REENTRANT_PROTO*) ;;
12098		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12099		esac
12100		echo "Prototype: $try" ;;
12101	esac
12102	;;
12103	*)	case "$usethreads" in
12104		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12105		esac
12106		d_endgrent_r=undef
12107		endgrent_r_proto=0
12108		;;
12109	esac
12110	;;
12111*)	endgrent_r_proto=0
12112	;;
12113esac
12114
12115: see if endhostent exists
12116set endhostent d_endhent
12117eval $inlibc
12118
12119: see if this is a netdb.h system
12120set netdb.h i_netdb
12121eval $inhdr
12122
12123: see if endhostent_r exists
12124set endhostent_r d_endhostent_r
12125eval $inlibc
12126case "$d_endhostent_r" in
12127"$define")
12128	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12129	case "$d_endhostent_r_proto:$usethreads" in
12130	":define")	d_endhostent_r_proto=define
12131		set d_endhostent_r_proto endhostent_r $hdrs
12132		eval $hasproto ;;
12133	*)	;;
12134	esac
12135	case "$d_endhostent_r_proto" in
12136	define)
12137	case "$endhostent_r_proto" in
12138	''|0) try='int endhostent_r(struct hostent_data*);'
12139	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12140	esac
12141	case "$endhostent_r_proto" in
12142	''|0) try='void endhostent_r(struct hostent_data*);'
12143	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12144	esac
12145	case "$endhostent_r_proto" in
12146	''|0)	d_endhostent_r=undef
12147 	        endhostent_r_proto=0
12148		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12149	* )	case "$endhostent_r_proto" in
12150		REENTRANT_PROTO*) ;;
12151		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12152		esac
12153		echo "Prototype: $try" ;;
12154	esac
12155	;;
12156	*)	case "$usethreads" in
12157		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12158		esac
12159		d_endhostent_r=undef
12160		endhostent_r_proto=0
12161		;;
12162	esac
12163	;;
12164*)	endhostent_r_proto=0
12165	;;
12166esac
12167
12168: see if endnetent exists
12169set endnetent d_endnent
12170eval $inlibc
12171
12172: see if endnetent_r exists
12173set endnetent_r d_endnetent_r
12174eval $inlibc
12175case "$d_endnetent_r" in
12176"$define")
12177	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12178	case "$d_endnetent_r_proto:$usethreads" in
12179	":define")	d_endnetent_r_proto=define
12180		set d_endnetent_r_proto endnetent_r $hdrs
12181		eval $hasproto ;;
12182	*)	;;
12183	esac
12184	case "$d_endnetent_r_proto" in
12185	define)
12186	case "$endnetent_r_proto" in
12187	''|0) try='int endnetent_r(struct netent_data*);'
12188	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12189	esac
12190	case "$endnetent_r_proto" in
12191	''|0) try='void endnetent_r(struct netent_data*);'
12192	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12193	esac
12194	case "$endnetent_r_proto" in
12195	''|0)	d_endnetent_r=undef
12196 	        endnetent_r_proto=0
12197		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12198	* )	case "$endnetent_r_proto" in
12199		REENTRANT_PROTO*) ;;
12200		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12201		esac
12202		echo "Prototype: $try" ;;
12203	esac
12204	;;
12205	*)	case "$usethreads" in
12206		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12207		esac
12208		d_endnetent_r=undef
12209		endnetent_r_proto=0
12210		;;
12211	esac
12212	;;
12213*)	endnetent_r_proto=0
12214	;;
12215esac
12216
12217: see if endprotoent exists
12218set endprotoent d_endpent
12219eval $inlibc
12220
12221: see if endprotoent_r exists
12222set endprotoent_r d_endprotoent_r
12223eval $inlibc
12224case "$d_endprotoent_r" in
12225"$define")
12226	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12227	case "$d_endprotoent_r_proto:$usethreads" in
12228	":define")	d_endprotoent_r_proto=define
12229		set d_endprotoent_r_proto endprotoent_r $hdrs
12230		eval $hasproto ;;
12231	*)	;;
12232	esac
12233	case "$d_endprotoent_r_proto" in
12234	define)
12235	case "$endprotoent_r_proto" in
12236	''|0) try='int endprotoent_r(struct protoent_data*);'
12237	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12238	esac
12239	case "$endprotoent_r_proto" in
12240	''|0) try='void endprotoent_r(struct protoent_data*);'
12241	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12242	esac
12243	case "$endprotoent_r_proto" in
12244	''|0)	d_endprotoent_r=undef
12245 	        endprotoent_r_proto=0
12246		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12247	* )	case "$endprotoent_r_proto" in
12248		REENTRANT_PROTO*) ;;
12249		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12250		esac
12251		echo "Prototype: $try" ;;
12252	esac
12253	;;
12254	*)	case "$usethreads" in
12255		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12256		esac
12257		d_endprotoent_r=undef
12258		endprotoent_r_proto=0
12259		;;
12260	esac
12261	;;
12262*)	endprotoent_r_proto=0
12263	;;
12264esac
12265
12266: see if endpwent exists
12267set endpwent d_endpwent
12268eval $inlibc
12269
12270: see if this is a pwd.h system
12271set pwd.h i_pwd
12272eval $inhdr
12273
12274case "$i_pwd" in
12275$define)
12276	xxx=`./findhdr pwd.h`
12277	$cppstdin $cppflags $cppminus < $xxx >$$.h
12278
12279	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12280		val="$define"
12281	else
12282		val="$undef"
12283	fi
12284	set d_pwquota
12285	eval $setvar
12286
12287	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12288		val="$define"
12289	else
12290		val="$undef"
12291	fi
12292	set d_pwage
12293	eval $setvar
12294
12295	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12296		val="$define"
12297	else
12298		val="$undef"
12299	fi
12300	set d_pwchange
12301	eval $setvar
12302
12303	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12304		val="$define"
12305	else
12306		val="$undef"
12307	fi
12308	set d_pwclass
12309	eval $setvar
12310
12311	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12312		val="$define"
12313	else
12314		val="$undef"
12315	fi
12316	set d_pwexpire
12317	eval $setvar
12318
12319	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12320		val="$define"
12321	else
12322		val="$undef"
12323	fi
12324	set d_pwcomment
12325	eval $setvar
12326
12327	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12328		val="$define"
12329	else
12330		val="$undef"
12331	fi
12332	set d_pwgecos
12333	eval $setvar
12334
12335	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12336		val="$define"
12337	else
12338		val="$undef"
12339	fi
12340	set d_pwpasswd
12341	eval $setvar
12342
12343	$rm -f $$.h
12344	;;
12345*)
12346	val="$undef";
12347	set d_pwquota; eval $setvar
12348	set d_pwage; eval $setvar
12349	set d_pwchange; eval $setvar
12350	set d_pwclass; eval $setvar
12351	set d_pwexpire; eval $setvar
12352	set d_pwcomment; eval $setvar
12353	set d_pwgecos; eval $setvar
12354	set d_pwpasswd; eval $setvar
12355	;;
12356esac
12357
12358: see if endpwent_r exists
12359set endpwent_r d_endpwent_r
12360eval $inlibc
12361case "$d_endpwent_r" in
12362"$define")
12363	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12364	case "$d_endpwent_r_proto:$usethreads" in
12365	":define")	d_endpwent_r_proto=define
12366		set d_endpwent_r_proto endpwent_r $hdrs
12367		eval $hasproto ;;
12368	*)	;;
12369	esac
12370	case "$d_endpwent_r_proto" in
12371	define)
12372	case "$endpwent_r_proto" in
12373	''|0) try='int endpwent_r(FILE**);'
12374	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12375	esac
12376	case "$endpwent_r_proto" in
12377	''|0) try='void endpwent_r(FILE**);'
12378	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12379	esac
12380	case "$endpwent_r_proto" in
12381	''|0)	d_endpwent_r=undef
12382 	        endpwent_r_proto=0
12383		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12384	* )	case "$endpwent_r_proto" in
12385		REENTRANT_PROTO*) ;;
12386		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12387		esac
12388		echo "Prototype: $try" ;;
12389	esac
12390	;;
12391	*)	case "$usethreads" in
12392		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12393		esac
12394		d_endpwent_r=undef
12395		endpwent_r_proto=0
12396		;;
12397	esac
12398	;;
12399*)	endpwent_r_proto=0
12400	;;
12401esac
12402
12403: see if endservent exists
12404set endservent d_endsent
12405eval $inlibc
12406
12407: see if endservent_r exists
12408set endservent_r d_endservent_r
12409eval $inlibc
12410case "$d_endservent_r" in
12411"$define")
12412	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12413	case "$d_endservent_r_proto:$usethreads" in
12414	":define")	d_endservent_r_proto=define
12415		set d_endservent_r_proto endservent_r $hdrs
12416		eval $hasproto ;;
12417	*)	;;
12418	esac
12419	case "$d_endservent_r_proto" in
12420	define)
12421	case "$endservent_r_proto" in
12422	''|0) try='int endservent_r(struct servent_data*);'
12423	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12424	esac
12425	case "$endservent_r_proto" in
12426	''|0) try='void endservent_r(struct servent_data*);'
12427	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12428	esac
12429	case "$endservent_r_proto" in
12430	''|0)	d_endservent_r=undef
12431 	        endservent_r_proto=0
12432		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12433	* )	case "$endservent_r_proto" in
12434		REENTRANT_PROTO*) ;;
12435		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12436		esac
12437		echo "Prototype: $try" ;;
12438	esac
12439	;;
12440	*)	case "$usethreads" in
12441		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12442		esac
12443		d_endservent_r=undef
12444		endservent_r_proto=0
12445		;;
12446	esac
12447	;;
12448*)	endservent_r_proto=0
12449	;;
12450esac
12451
12452: Locate the flags for 'open()'
12453echo " "
12454$cat >try.c <<EOCP
12455#include <sys/types.h>
12456#ifdef I_FCNTL
12457#include <fcntl.h>
12458#endif
12459#ifdef I_SYS_FILE
12460#include <sys/file.h>
12461#endif
12462#$i_stdlib I_STDLIB
12463#ifdef I_STDLIB
12464#include <stdlib.h>
12465#endif
12466int main() {
12467	if(O_RDONLY);
12468#ifdef O_TRUNC
12469	exit(0);
12470#else
12471	exit(1);
12472#endif
12473}
12474EOCP
12475: check sys/file.h first to get FREAD on Sun
12476if $test `./findhdr sys/file.h` && \
12477		set try -DI_SYS_FILE && eval $compile; then
12478	h_sysfile=true;
12479	echo "<sys/file.h> defines the O_* constants..." >&4
12480	if $run ./try; then
12481		echo "and you have the 3 argument form of open()." >&4
12482		val="$define"
12483	else
12484		echo "but not the 3 argument form of open().  Oh, well." >&4
12485		val="$undef"
12486	fi
12487elif $test `./findhdr fcntl.h` && \
12488		set try -DI_FCNTL && eval $compile; then
12489	h_fcntl=true;
12490	echo "<fcntl.h> defines the O_* constants..." >&4
12491	if $run ./try; then
12492		echo "and you have the 3 argument form of open()." >&4
12493		val="$define"
12494	else
12495		echo "but not the 3 argument form of open().  Oh, well." >&4
12496		val="$undef"
12497	fi
12498else
12499	val="$undef"
12500	echo "I can't find the O_* constant definitions!  You got problems." >&4
12501fi
12502set d_open3
12503eval $setvar
12504$rm_try
12505
12506: see if this is a sys/file.h system
12507val=''
12508set sys/file.h val
12509eval $inhdr
12510
12511: do we need to include sys/file.h ?
12512case "$val" in
12513"$define")
12514	echo " "
12515	if $h_sysfile; then
12516		val="$define"
12517		echo "We'll be including <sys/file.h>." >&4
12518	else
12519		val="$undef"
12520		echo "We won't be including <sys/file.h>." >&4
12521	fi
12522	;;
12523*)
12524	h_sysfile=false
12525	;;
12526esac
12527set i_sysfile
12528eval $setvar
12529
12530: see if fcntl.h is there
12531val=''
12532set fcntl.h val
12533eval $inhdr
12534
12535: see if we can include fcntl.h
12536case "$val" in
12537"$define")
12538	echo " "
12539	if $h_fcntl; then
12540		val="$define"
12541		echo "We'll be including <fcntl.h>." >&4
12542	else
12543		val="$undef"
12544		if $h_sysfile; then
12545	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12546		else
12547			echo "We won't be including <fcntl.h>." >&4
12548		fi
12549	fi
12550	;;
12551*)
12552	h_fcntl=false
12553	val="$undef"
12554	;;
12555esac
12556set i_fcntl
12557eval $setvar
12558
12559: see if fork exists
12560set fork d_fork
12561eval $inlibc
12562
12563: see if pipe exists
12564set pipe d_pipe
12565eval $inlibc
12566
12567: check for non-blocking I/O stuff
12568case "$h_sysfile" in
12569true) echo "#include <sys/file.h>" > head.c;;
12570*)
12571       case "$h_fcntl" in
12572       true) echo "#include <fcntl.h>" > head.c;;
12573       *) echo "#include <sys/fcntl.h>" > head.c;;
12574       esac
12575       ;;
12576esac
12577echo " "
12578echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12579case "$o_nonblock" in
12580'')
12581	$cat head.c > try.c
12582	$cat >>try.c <<EOCP
12583#include <stdio.h>
12584#$i_stdlib I_STDLIB
12585#ifdef I_STDLIB
12586#include <stdlib.h>
12587#endif
12588#$i_fcntl I_FCNTL
12589#ifdef I_FCNTL
12590#include <fcntl.h>
12591#endif
12592int main() {
12593#ifdef O_NONBLOCK
12594	printf("O_NONBLOCK\n");
12595	exit(0);
12596#endif
12597#ifdef O_NDELAY
12598	printf("O_NDELAY\n");
12599	exit(0);
12600#endif
12601#ifdef FNDELAY
12602	printf("FNDELAY\n");
12603	exit(0);
12604#endif
12605	exit(0);
12606}
12607EOCP
12608	set try
12609	if eval $compile_ok; then
12610		o_nonblock=`$run ./try`
12611		case "$o_nonblock" in
12612		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12613		*) echo "Seems like we can use $o_nonblock.";;
12614		esac
12615	else
12616		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12617	fi
12618	;;
12619*) echo "Using $hint value $o_nonblock.";;
12620esac
12621$rm_try
12622
12623echo " "
12624echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12625case "$eagain" in
12626'')
12627	case "$d_fork:$d_pipe" in
12628	define:define)
12629	$cat head.c > try.c
12630	$cat >>try.c <<EOCP
12631#include <errno.h>
12632#include <sys/types.h>
12633#include <signal.h>
12634#include <stdio.h>
12635#$i_stdlib I_STDLIB
12636#ifdef I_STDLIB
12637#include <stdlib.h>
12638#endif
12639#$i_fcntl I_FCNTL
12640#ifdef I_FCNTL
12641#include <fcntl.h>
12642#endif
12643#define MY_O_NONBLOCK $o_nonblock
12644#ifndef errno  /* XXX need better Configure test */
12645extern int errno;
12646#endif
12647#$i_unistd I_UNISTD
12648#ifdef I_UNISTD
12649#include <unistd.h>
12650#endif
12651#$i_string I_STRING
12652#ifdef I_STRING
12653#include <string.h>
12654#else
12655#include <strings.h>
12656#endif
12657$signal_t blech(int x) { exit(3); }
12658EOCP
12659	$cat >> try.c <<'EOCP'
12660int main()
12661{
12662	int pd[2];
12663	int pu[2];
12664	char buf[1];
12665	char string[100];
12666
12667	pipe(pd);	/* Down: child -> parent */
12668	pipe(pu);	/* Up: parent -> child */
12669	if (0 != fork()) {
12670		int ret;
12671		close(pd[1]);	/* Parent reads from pd[0] */
12672		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
12673#ifdef F_SETFL
12674		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12675			exit(1);
12676#else
12677		exit(4);
12678#endif
12679		signal(SIGALRM, blech);
12680		alarm(5);
12681		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
12682			exit(2);
12683		sprintf(string, "%d\n", ret);
12684		write(2, string, strlen(string));
12685		alarm(0);
12686#ifdef EAGAIN
12687		if (errno == EAGAIN) {
12688			printf("EAGAIN\n");
12689			goto ok;
12690		}
12691#endif
12692#ifdef EWOULDBLOCK
12693		if (errno == EWOULDBLOCK)
12694			printf("EWOULDBLOCK\n");
12695#endif
12696	ok:
12697		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
12698		sleep(2);				/* Give it time to close our pipe */
12699		alarm(5);
12700		ret = read(pd[0], buf, 1);	/* Should read EOF */
12701		alarm(0);
12702		sprintf(string, "%d\n", ret);
12703		write(4, string, strlen(string));
12704		exit(0);
12705	}
12706
12707	close(pd[0]);			/* We write to pd[1] */
12708	close(pu[1]);			/* We read from pu[0] */
12709	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
12710	close(pd[1]);			/* Pipe pd is now fully closed! */
12711	exit(0);				/* Bye bye, thank you for playing! */
12712}
12713EOCP
12714	set try
12715	if eval $compile_ok; then
12716		echo "$startsh" >mtry
12717		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12718		chmod +x mtry
12719		./mtry >/dev/null 2>&1
12720		case $? in
12721		0) eagain=`$cat try.out`;;
12722		1) echo "Could not perform non-blocking setting!";;
12723		2) echo "I did a successful read() for something that was not there!";;
12724		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12725		4) echo "Could not find F_SETFL!";;
12726		*) echo "Something terribly wrong happened during testing.";;
12727		esac
12728		rd_nodata=`$cat try.ret`
12729		echo "A read() system call with no data present returns $rd_nodata."
12730		case "$rd_nodata" in
12731		0|-1) ;;
12732		*)
12733			echo "(That's peculiar, fixing that to be -1.)"
12734			rd_nodata=-1
12735			;;
12736		esac
12737		case "$eagain" in
12738		'')
12739			echo "Forcing errno EAGAIN on read() with no data available."
12740			eagain=EAGAIN
12741			;;
12742		*)
12743			echo "Your read() sets errno to $eagain when no data is available."
12744			;;
12745		esac
12746		status=`$cat try.err`
12747		case "$status" in
12748		0) echo "And it correctly returns 0 to signal EOF.";;
12749		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
12750		*) echo "However, your read() returns '$status' on EOF??";;
12751		esac
12752		val="$define"
12753		if test "$status" = "$rd_nodata"; then
12754			echo "WARNING: you can't distinguish between EOF and no data!"
12755			val="$undef"
12756		fi
12757	else
12758		echo "I can't compile the test program--assuming errno EAGAIN will do."
12759		eagain=EAGAIN
12760	fi
12761	;;
12762	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12763		eagain=EAGAIN
12764		val="$define"
12765		;;
12766	esac
12767	set d_eofnblk
12768	eval $setvar
12769	;;
12770*)
12771	echo "Using $hint value $eagain."
12772	echo "Your read() returns $rd_nodata when no data is present."
12773	case "$d_eofnblk" in
12774	"$define") echo "And you can see EOF because read() returns 0.";;
12775	"$undef") echo "But you can't see EOF status from read() returned value.";;
12776	*)
12777		echo "(Assuming you can't see EOF status from read anyway.)"
12778		d_eofnblk=$undef
12779		;;
12780	esac
12781	;;
12782esac
12783$rm_try head.c mtry
12784
12785: see if _ptr and _cnt from stdio act std
12786echo " "
12787
12788if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12789	echo "(Looks like you have stdio.h from BSD.)"
12790	case "$stdio_ptr" in
12791	'') stdio_ptr='((fp)->_p)'
12792		ptr_lval=$define
12793		;;
12794	*)	ptr_lval=$d_stdio_ptr_lval;;
12795	esac
12796	case "$stdio_cnt" in
12797	'') stdio_cnt='((fp)->_r)'
12798		cnt_lval=$define
12799		;;
12800	*)	cnt_lval=$d_stdio_cnt_lval;;
12801	esac
12802	case "$stdio_base" in
12803	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12804	esac
12805	case "$stdio_bufsiz" in
12806	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12807	esac
12808elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12809	echo "(Looks like you have stdio.h from Linux.)"
12810	case "$stdio_ptr" in
12811	'') stdio_ptr='((fp)->_IO_read_ptr)'
12812		ptr_lval=$define
12813		;;
12814	*)	ptr_lval=$d_stdio_ptr_lval;;
12815	esac
12816	case "$stdio_cnt" in
12817	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12818		cnt_lval=$undef
12819		;;
12820	*)	cnt_lval=$d_stdio_cnt_lval;;
12821	esac
12822	case "$stdio_base" in
12823	'') stdio_base='((fp)->_IO_read_base)';;
12824	esac
12825	case "$stdio_bufsiz" in
12826	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12827	esac
12828else
12829	case "$stdio_ptr" in
12830	'') stdio_ptr='((fp)->_ptr)'
12831		ptr_lval=$define
12832		;;
12833	*)	ptr_lval=$d_stdio_ptr_lval;;
12834	esac
12835	case "$stdio_cnt" in
12836	'') stdio_cnt='((fp)->_cnt)'
12837		cnt_lval=$define
12838		;;
12839	*)	cnt_lval=$d_stdio_cnt_lval;;
12840	esac
12841	case "$stdio_base" in
12842	'') stdio_base='((fp)->_base)';;
12843	esac
12844	case "$stdio_bufsiz" in
12845	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12846	esac
12847fi
12848
12849: test whether _ptr and _cnt really work
12850echo "Checking how std your stdio is..." >&4
12851$cat >try.c <<EOP
12852#include <stdio.h>
12853#$i_stdlib I_STDLIB
12854#ifdef I_STDLIB
12855#include <stdlib.h>
12856#endif
12857#define FILE_ptr(fp)	$stdio_ptr
12858#define FILE_cnt(fp)	$stdio_cnt
12859int main() {
12860	FILE *fp = fopen("try.c", "r");
12861	char c = getc(fp);
12862	if (
12863		18 <= FILE_cnt(fp) &&
12864		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12865	)
12866		exit(0);
12867	exit(1);
12868}
12869EOP
12870val="$undef"
12871set try
12872if eval $compile && $to try.c; then
12873	if $run ./try; then
12874		echo "Your stdio acts pretty std."
12875		val="$define"
12876	else
12877		echo "Your stdio isn't very std."
12878	fi
12879else
12880	echo "Your stdio doesn't appear very std."
12881fi
12882$rm_try
12883
12884# glibc 2.2.90 and above apparently change stdio streams so Perl's
12885# direct buffer manipulation no longer works.  The Configure tests
12886# should be changed to correctly detect this, but until then,
12887# the following check should at least let perl compile and run.
12888# (This quick fix should be updated before 5.8.1.)
12889# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12890# A. Dougherty, June 3, 2002.
12891case "$d_gnulibc" in
12892$define)
12893	case "$gnulibc_version" in
12894	2.[01]*)  ;;
12895	2.2) ;;
12896	2.2.[0-9]) ;;
12897	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12898		val="$undef"
12899		;;
12900	esac
12901	;;
12902esac
12903set d_stdstdio
12904eval $setvar
12905
12906: Can _ptr be used as an lvalue?
12907case "$d_stdstdio$ptr_lval" in
12908$define$define) val=$define ;;
12909*) val=$undef ;;
12910esac
12911set d_stdio_ptr_lval
12912eval $setvar
12913
12914: Can _cnt be used as an lvalue?
12915case "$d_stdstdio$cnt_lval" in
12916$define$define) val=$define ;;
12917*) val=$undef ;;
12918esac
12919set d_stdio_cnt_lval
12920eval $setvar
12921
12922
12923: test whether setting _ptr sets _cnt as a side effect
12924d_stdio_ptr_lval_sets_cnt="$undef"
12925d_stdio_ptr_lval_nochange_cnt="$undef"
12926case "$d_stdio_ptr_lval$d_stdstdio" in
12927$define$define)
12928	echo "Checking to see what happens if we set the stdio ptr..." >&4
12929$cat >try.c <<EOP
12930#include <stdio.h>
12931/* Can we scream? */
12932/* Eat dust sed :-) */
12933/* In the buffer space, no one can hear you scream. */
12934#$i_stdlib I_STDLIB
12935#ifdef I_STDLIB
12936#include <stdlib.h>
12937#endif
12938#define FILE_ptr(fp)	$stdio_ptr
12939#define FILE_cnt(fp)	$stdio_cnt
12940#include <sys/types.h>
12941int main() {
12942	FILE *fp = fopen("try.c", "r");
12943	int c;
12944	char *ptr;
12945	size_t cnt;
12946	if (!fp) {
12947	    puts("Fail even to read");
12948	    exit(1);
12949	}
12950	c = getc(fp); /* Read away the first # */
12951	if (c == EOF) {
12952	    puts("Fail even to read");
12953	    exit(1);
12954	}
12955	if (!(
12956		18 <= FILE_cnt(fp) &&
12957		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12958	)) {
12959		puts("Fail even to read");
12960		exit (1);
12961	}
12962	ptr = (char*) FILE_ptr(fp);
12963	cnt = (size_t)FILE_cnt(fp);
12964
12965	FILE_ptr(fp) += 42;
12966
12967	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12968		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12969		exit (1);
12970	}
12971	if (FILE_cnt(fp) <= 20) {
12972		printf ("Fail (<20 chars to test)");
12973		exit (1);
12974	}
12975	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12976		puts("Fail compare");
12977		exit (1);
12978	}
12979	if (cnt == FILE_cnt(fp)) {
12980		puts("Pass_unchanged");
12981		exit (0);
12982	}
12983	if (FILE_cnt(fp) == (cnt - 42)) {
12984		puts("Pass_changed");
12985		exit (0);
12986	}
12987	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12988	return 1;
12989
12990}
12991EOP
12992	set try
12993	if eval $compile && $to try.c; then
12994 		case `$run ./try` in
12995		Pass_changed)
12996			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12997			d_stdio_ptr_lval_sets_cnt="$define" ;;
12998		Pass_unchanged)
12999			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13000			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13001		Fail*)
13002			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13003		*)
13004			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13005	esac
13006	else
13007		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13008	fi
13009	$rm_try
13010	;;
13011esac
13012
13013: see if _base is also standard
13014val="$undef"
13015case "$d_stdstdio" in
13016$define)
13017	$cat >try.c <<EOP
13018#include <stdio.h>
13019#$i_stdlib I_STDLIB
13020#ifdef I_STDLIB
13021#include <stdlib.h>
13022#endif
13023#define FILE_base(fp)	$stdio_base
13024#define FILE_bufsiz(fp)	$stdio_bufsiz
13025int main() {
13026	FILE *fp = fopen("try.c", "r");
13027	char c = getc(fp);
13028	if (
13029		19 <= FILE_bufsiz(fp) &&
13030		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13031	)
13032		exit(0);
13033	exit(1);
13034}
13035EOP
13036	set try
13037	if eval $compile && $to try.c; then
13038		if $run ./try; then
13039			echo "And its _base field acts std."
13040			val="$define"
13041		else
13042			echo "But its _base field isn't std."
13043		fi
13044	else
13045		echo "However, it seems to be lacking the _base field."
13046	fi
13047	$rm_try
13048	;;
13049esac
13050set d_stdiobase
13051eval $setvar
13052
13053: see if fast_stdio exists
13054val="$undef"
13055case "$d_stdstdio:$d_stdio_ptr_lval" in
13056"$define:$define")
13057	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13058	*$define*)
13059		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13060		val="$define"
13061		;;
13062	esac
13063	;;
13064esac
13065set d_faststdio
13066eval $setvar
13067
13068
13069
13070: see if fchdir exists
13071set fchdir d_fchdir
13072eval $inlibc
13073
13074: see if fchmod exists
13075set fchmod d_fchmod
13076eval $inlibc
13077
13078: see if fchown exists
13079set fchown d_fchown
13080eval $inlibc
13081
13082: see if this is an fcntl system
13083set fcntl d_fcntl
13084eval $inlibc
13085
13086: See if fcntl-based locking works.
13087echo " "
13088$cat >try.c <<EOCP
13089#$i_stdlib I_STDLIB
13090#ifdef I_STDLIB
13091#include <stdlib.h>
13092#endif
13093#include <unistd.h>
13094#include <fcntl.h>
13095#include <signal.h>
13096$signal_t blech(int x) { exit(3); }
13097int main() {
13098#if defined(F_SETLK) && defined(F_SETLKW)
13099     struct flock flock;
13100     int retval, fd;
13101     fd = open("try.c", O_RDONLY);
13102     flock.l_type = F_RDLCK;
13103     flock.l_whence = SEEK_SET;
13104     flock.l_start = flock.l_len = 0;
13105     signal(SIGALRM, blech);
13106     alarm(10);
13107     retval = fcntl(fd, F_SETLK, &flock);
13108     close(fd);
13109     (retval < 0 ? exit(2) : exit(0));
13110#else
13111     exit(2);
13112#endif
13113}
13114EOCP
13115echo "Checking if fcntl-based file locking works... "
13116case "$d_fcntl" in
13117"$define")
13118	set try
13119	if eval $compile_ok; then
13120		if $run ./try; then
13121			echo "Yes, it seems to work."
13122			val="$define"
13123		else
13124			echo "Nope, it didn't work."
13125			val="$undef"
13126			case "$?" in
13127			3) $cat >&4 <<EOM
13128***
13129*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13130*** This is (almost) impossible.
13131*** If your NFS lock daemons are not feeling well, something like
13132*** this may happen, please investigate.  Cannot continue, aborting.
13133***
13134EOM
13135				exit 1
13136				;;
13137			esac
13138		fi
13139	else
13140		echo "I'm unable to compile the test program, so I'll assume not."
13141		val="$undef"
13142	fi
13143	;;
13144*) val="$undef";
13145	echo "Nope, since you don't even have fcntl()."
13146	;;
13147esac
13148set d_fcntl_can_lock
13149eval $setvar
13150$rm_try
13151
13152: check for fd_set items
13153$cat <<EOM
13154
13155Checking to see how well your C compiler handles fd_set and friends ...
13156EOM
13157$cat >try.c <<EOCP
13158#$i_stdlib I_STDLIB
13159#ifdef I_STDLIB
13160#include <stdlib.h>
13161#endif
13162#$i_systime I_SYS_TIME
13163#$i_sysselct I_SYS_SELECT
13164#$d_socket HAS_SOCKET
13165#include <sys/types.h>
13166#ifdef HAS_SOCKET
13167#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13168#endif
13169#ifdef I_SYS_TIME
13170#include <sys/time.h>
13171#endif
13172#ifdef I_SYS_SELECT
13173#include <sys/select.h>
13174#endif
13175int main() {
13176	fd_set fds;
13177
13178#ifdef TRYBITS
13179	if(fds.fds_bits);
13180#endif
13181
13182#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13183	exit(0);
13184#else
13185	exit(1);
13186#endif
13187}
13188EOCP
13189set try -DTRYBITS
13190if eval $compile; then
13191	d_fds_bits="$define"
13192	d_fd_set="$define"
13193	echo "Well, your system knows about the normal fd_set typedef..." >&4
13194	if $run ./try; then
13195		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13196		d_fd_macros="$define"
13197	else
13198		$cat >&4 <<'EOM'
13199but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13200EOM
13201		d_fd_macros="$undef"
13202	fi
13203else
13204	$cat <<'EOM'
13205Hmm, your compiler has some difficulty with fd_set.  Checking further...
13206EOM
13207	set try
13208	if eval $compile; then
13209		d_fds_bits="$undef"
13210		d_fd_set="$define"
13211		echo "Well, your system has some sort of fd_set available..." >&4
13212		if $run ./try; then
13213			echo "and you have the normal fd_set macros." >&4
13214			d_fd_macros="$define"
13215		else
13216			$cat <<'EOM'
13217but not the normal fd_set macros!  Gross!  More work for me...
13218EOM
13219			d_fd_macros="$undef"
13220		fi
13221	else
13222	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13223		d_fd_set="$undef"
13224		d_fds_bits="$undef"
13225		d_fd_macros="$undef"
13226	fi
13227fi
13228$rm_try
13229
13230: see if fgetpos exists
13231set fgetpos d_fgetpos
13232eval $inlibc
13233
13234: see if finite exists
13235set finite d_finite
13236eval $inlibc
13237
13238: see if finitel exists
13239set finitel d_finitel
13240eval $inlibc
13241
13242: see if flock exists
13243set flock d_flock
13244eval $inlibc
13245
13246: see if prototype for flock is available
13247echo " "
13248set d_flockproto flock $i_sysfile sys/file.h
13249eval $hasproto
13250
13251: see if fp_class exists
13252set fp_class d_fp_class
13253eval $inlibc
13254
13255: see if pathconf exists
13256set pathconf d_pathconf
13257eval $inlibc
13258
13259: see if fpathconf exists
13260set fpathconf d_fpathconf
13261eval $inlibc
13262
13263: see if fpclass exists
13264set fpclass d_fpclass
13265eval $inlibc
13266
13267: see if fpclassify exists
13268set fpclassify d_fpclassify
13269eval $inlibc
13270
13271: see if fpclassl exists
13272set fpclassl d_fpclassl
13273eval $inlibc
13274
13275: check for fpos64_t
13276echo " "
13277echo "Checking to see if you have fpos64_t..." >&4
13278$cat >try.c <<EOCP
13279#include <stdio.h>
13280int main() { fpos64_t x = 7; }
13281EOCP
13282set try
13283if eval $compile; then
13284	val="$define"
13285	echo "You have fpos64_t."
13286else
13287	val="$undef"
13288	echo "You do not have fpos64_t."
13289	case "$fpossize" in
13290	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13291	esac
13292fi
13293$rm_try
13294set d_fpos64_t
13295eval $setvar
13296
13297: see if frexpl exists
13298set frexpl d_frexpl
13299eval $inlibc
13300
13301: see if this is a sys/param system
13302set sys/param.h i_sysparam
13303eval $inhdr
13304
13305: see if this is a sys/mount.h system
13306set sys/mount.h i_sysmount
13307eval $inhdr
13308
13309: Check for fs_data_s
13310echo " "
13311echo "Checking to see if your system supports struct fs_data..." >&4
13312set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13313eval $hasstruct
13314case "$d_fs_data_s" in
13315"$define")      echo "Yes, it does."   ;;
13316*)              echo "No, it doesn't." ;;
13317esac
13318
13319: see if fseeko exists
13320set fseeko d_fseeko
13321eval $inlibc
13322case "$longsize" in
133238) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13324esac
13325
13326: see if fsetpos exists
13327set fsetpos d_fsetpos
13328eval $inlibc
13329
13330: see if fstatfs exists
13331set fstatfs d_fstatfs
13332eval $inlibc
13333
13334: see if statvfs exists
13335set statvfs d_statvfs
13336eval $inlibc
13337
13338: see if fstatvfs exists
13339set fstatvfs d_fstatvfs
13340eval $inlibc
13341
13342
13343: see if fsync exists
13344set fsync d_fsync
13345eval $inlibc
13346
13347: see if ftello exists
13348set ftello d_ftello
13349eval $inlibc
13350case "$longsize" in
133518) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13352esac
13353
13354: check for a working futimes
13355d_futimes="$undef"
13356echo " "
13357echo "Checking if you have a working futimes()" >&4
13358$cat >try.c <<EOCP
13359#include <stdio.h>
13360#include <sys/time.h>
13361#include <errno.h>
13362#include <fcntl.h>
13363
13364int main ()
13365{
13366    int fd, rv;
13367    fd = open ("try.c", O_RDWR);
13368    if (-1 == fd) exit (1);
13369    rv = futimes (fd, NULL);
13370    exit (rv == -1 ? errno : 0);
13371}
13372EOCP
13373set try
13374if eval $compile; then
13375    `$run ./try`
13376    rc=$?
13377    case "$rc" in
13378	0)  echo "Yes, you have" >&4
13379	    d_futimes="$define"
13380	    ;;
13381	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13382	    ;;
13383    esac
13384else
13385    echo "No, it does not (probably harmless)" >&4
13386fi
13387$rm_try
13388
13389: see if ndbm.h is available
13390set ndbm.h i_ndbm
13391eval $inhdr
13392: Compatibility location for RedHat 7.1
13393set gdbm/ndbm.h i_gdbmndbm
13394eval $inhdr
13395: Compatibility location for Debian 4.0
13396set gdbm-ndbm.h i_gdbm_ndbm
13397eval $inhdr
13398
13399val="$undef"
13400if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13401	: see if dbm_open exists
13402	set dbm_open d_dbm_open
13403	eval $inlibc
13404	case "$d_dbm_open" in
13405	$undef)
13406		i_ndbm="$undef"
13407		i_gdbmndbm="$undef"
13408		i_gdbm_ndbm="$undef"
13409		echo "We won't be including <ndbm.h>"
13410		val="$undef"
13411		;;
13412	*) val="$define"
13413	   ;;
13414	esac
13415fi
13416set d_ndbm
13417eval $setvar
13418
13419ndbm_hdr_protochk='name=$1; hdr=$2;
13420eval "ihdr=\$""i_$name";
13421val="$undef";
13422if $test "$ihdr" = "$define"; then
13423	$echo "Checking if your <$hdr> uses prototypes..." >&4;
13424	case "$d_cplusplus" in
13425	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13426	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13427	esac;
13428	case "$val" in
13429	$define) $echo "Your <$hdr> seems to have prototypes";;
13430	*) $echo "Your <$hdr> does not seem to have prototypes";;
13431	esac;
13432fi;
13433set "d_${name}_h_uses_prototypes";
13434eval $setvar'
13435
13436set ndbm ndbm.h
13437eval $ndbm_hdr_protochk
13438set gdbmndbm gdbm/ndbm.h
13439eval $ndbm_hdr_protochk
13440set gdbm_ndbm gdbm-ndbm.h
13441eval $ndbm_hdr_protochk
13442
13443: see if getaddrinfo exists
13444set getaddrinfo d_getaddrinfo
13445eval $inlibc
13446
13447: see if getcwd exists
13448set getcwd d_getcwd
13449eval $inlibc
13450
13451: see if getespwnam exists
13452set getespwnam d_getespwnam
13453eval $inlibc
13454
13455: see if getfsstat exists
13456set getfsstat d_getfsstat
13457eval $inlibc
13458
13459: see if getgrent exists
13460set getgrent d_getgrent
13461eval $inlibc
13462
13463: see if getgrent_r exists
13464set getgrent_r d_getgrent_r
13465eval $inlibc
13466case "$d_getgrent_r" in
13467"$define")
13468	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13469	case "$d_getgrent_r_proto:$usethreads" in
13470	":define")	d_getgrent_r_proto=define
13471		set d_getgrent_r_proto getgrent_r $hdrs
13472		eval $hasproto ;;
13473	*)	;;
13474	esac
13475	case "$d_getgrent_r_proto" in
13476	define)
13477	case "$getgrent_r_proto" in
13478	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13479	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13480	esac
13481	case "$getgrent_r_proto" in
13482	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13483	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13484	esac
13485	case "$getgrent_r_proto" in
13486	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13487	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13488	esac
13489	case "$getgrent_r_proto" in
13490	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13491	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13492	esac
13493	case "$getgrent_r_proto" in
13494	''|0) try='int getgrent_r(struct group*, char*, int);'
13495	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13496	esac
13497	case "$getgrent_r_proto" in
13498	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13499	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13500	esac
13501	case "$getgrent_r_proto" in
13502	''|0)	d_getgrent_r=undef
13503 	        getgrent_r_proto=0
13504		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13505	* )	case "$getgrent_r_proto" in
13506		REENTRANT_PROTO*) ;;
13507		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13508		esac
13509		echo "Prototype: $try" ;;
13510	esac
13511	;;
13512	*)	case "$usethreads" in
13513		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13514		esac
13515		d_getgrent_r=undef
13516		getgrent_r_proto=0
13517		;;
13518	esac
13519	;;
13520*)	getgrent_r_proto=0
13521	;;
13522esac
13523
13524: see if getgrgid_r exists
13525set getgrgid_r d_getgrgid_r
13526eval $inlibc
13527case "$d_getgrgid_r" in
13528"$define")
13529	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13530	case "$d_getgrgid_r_proto:$usethreads" in
13531	":define")	d_getgrgid_r_proto=define
13532		set d_getgrgid_r_proto getgrgid_r $hdrs
13533		eval $hasproto ;;
13534	*)	;;
13535	esac
13536	case "$d_getgrgid_r_proto" in
13537	define)
13538	case "$getgrgid_r_proto" in
13539	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13540	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13541	esac
13542	case "$getgrgid_r_proto" in
13543	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13544	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13545	esac
13546	case "$getgrgid_r_proto" in
13547	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13548	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13549	esac
13550	case "$getgrgid_r_proto" in
13551	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13552	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13553	esac
13554	case "$getgrgid_r_proto" in
13555	''|0)	d_getgrgid_r=undef
13556 	        getgrgid_r_proto=0
13557		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13558	* )	case "$getgrgid_r_proto" in
13559		REENTRANT_PROTO*) ;;
13560		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13561		esac
13562		echo "Prototype: $try" ;;
13563	esac
13564	;;
13565	*)	case "$usethreads" in
13566		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13567		esac
13568		d_getgrgid_r=undef
13569		getgrgid_r_proto=0
13570		;;
13571	esac
13572	;;
13573*)	getgrgid_r_proto=0
13574	;;
13575esac
13576
13577: see if getgrnam_r exists
13578set getgrnam_r d_getgrnam_r
13579eval $inlibc
13580case "$d_getgrnam_r" in
13581"$define")
13582	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13583	case "$d_getgrnam_r_proto:$usethreads" in
13584	":define")	d_getgrnam_r_proto=define
13585		set d_getgrnam_r_proto getgrnam_r $hdrs
13586		eval $hasproto ;;
13587	*)	;;
13588	esac
13589	case "$d_getgrnam_r_proto" in
13590	define)
13591	case "$getgrnam_r_proto" in
13592	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13593	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13594	esac
13595	case "$getgrnam_r_proto" in
13596	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13597	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13598	esac
13599	case "$getgrnam_r_proto" in
13600	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13601	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13602	esac
13603	case "$getgrnam_r_proto" in
13604	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13605	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13606	esac
13607	case "$getgrnam_r_proto" in
13608	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13609	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13610	esac
13611	case "$getgrnam_r_proto" in
13612	''|0)	d_getgrnam_r=undef
13613 	        getgrnam_r_proto=0
13614		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13615	* )	case "$getgrnam_r_proto" in
13616		REENTRANT_PROTO*) ;;
13617		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13618		esac
13619		echo "Prototype: $try" ;;
13620	esac
13621	;;
13622	*)	case "$usethreads" in
13623		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13624		esac
13625		d_getgrnam_r=undef
13626		getgrnam_r_proto=0
13627		;;
13628	esac
13629	;;
13630*)	getgrnam_r_proto=0
13631	;;
13632esac
13633
13634: see if gethostbyaddr exists
13635set gethostbyaddr d_gethbyaddr
13636eval $inlibc
13637
13638: see if gethostbyname exists
13639set gethostbyname d_gethbyname
13640eval $inlibc
13641
13642: see if gethostent exists
13643set gethostent d_gethent
13644eval $inlibc
13645
13646: see how we will look up host name
13647echo " "
13648call=''
13649if set gethostname val -f d_gethname; eval $csym; $val; then
13650	echo 'gethostname() found.' >&4
13651	d_gethname="$define"
13652	call=gethostname
13653fi
13654if set uname val -f d_uname; eval $csym; $val; then
13655	if ./xenix; then
13656		$cat <<'EOM'
13657uname() was found, but you're running xenix, and older versions of xenix
13658have a broken uname(). If you don't really know whether your xenix is old
13659enough to have a broken system call, use the default answer.
13660
13661EOM
13662		dflt=y
13663		case "$d_uname" in
13664		"$define") dflt=n;;
13665		esac
13666		rp='Is your uname() broken?'
13667		. ./myread
13668		case "$ans" in
13669		n*) d_uname="$define"; call=uname;;
13670		esac
13671	else
13672		echo 'uname() found.' >&4
13673		d_uname="$define"
13674		case "$call" in
13675		'') call=uname ;;
13676		esac
13677	fi
13678fi
13679case "$d_gethname" in
13680'') d_gethname="$undef";;
13681esac
13682case "$d_uname" in
13683'') d_uname="$undef";;
13684esac
13685case "$d_uname$d_gethname" in
13686*define*)
13687	dflt=n
13688	cat <<EOM
13689
13690Every now and then someone has a $call() that lies about the hostname
13691but can't be fixed for political or economic reasons.  If you wish, I can
13692pretend $call() isn't there and maybe compute hostname at run-time
13693thanks to the '$phostname' command.
13694
13695EOM
13696	rp="Shall I ignore $call() from now on?"
13697	. ./myread
13698	case "$ans" in
13699	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13700	esac;;
13701esac
13702case "$phostname" in
13703'') aphostname='';;
13704*) case "$aphostname" in
13705	/*) ;;
13706	*) set X $phostname
13707		shift
13708		file=$1
13709		shift
13710		file=`./loc $file $file $pth`
13711		aphostname=`echo $file $*`
13712		;;
13713	esac
13714	;;
13715esac
13716case "$d_uname$d_gethname" in
13717*define*) ;;
13718*)
13719	case "$phostname" in
13720	'')
13721		echo "There will be no way for $package to get your hostname." >&4;;
13722	*)
13723	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13724		;;
13725	esac;;
13726esac
13727case "$d_phostname" in
13728'') d_phostname="$undef";;
13729esac
13730
13731: see if gethostbyaddr_r exists
13732set gethostbyaddr_r d_gethostbyaddr_r
13733eval $inlibc
13734case "$d_gethostbyaddr_r" in
13735"$define")
13736	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13737	case "$d_gethostbyaddr_r_proto:$usethreads" in
13738	":define")	d_gethostbyaddr_r_proto=define
13739		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13740		eval $hasproto ;;
13741	*)	;;
13742	esac
13743	case "$d_gethostbyaddr_r_proto" in
13744	define)
13745	case "$gethostbyaddr_r_proto" in
13746	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13747	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13748	esac
13749	case "$gethostbyaddr_r_proto" in
13750	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13751	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13752	esac
13753	case "$gethostbyaddr_r_proto" in
13754	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13755	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13756	esac
13757	case "$gethostbyaddr_r_proto" in
13758	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13759	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13760	esac
13761	case "$gethostbyaddr_r_proto" in
13762	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13763	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13764	esac
13765	case "$gethostbyaddr_r_proto" in
13766	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13767	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13768	esac
13769	case "$gethostbyaddr_r_proto" in
13770	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13771	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13772	esac
13773	case "$gethostbyaddr_r_proto" in
13774	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13775	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13776	esac
13777	case "$gethostbyaddr_r_proto" in
13778	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13779	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13780	esac
13781	case "$gethostbyaddr_r_proto" in
13782	''|0) try='int gethostbyaddr_r(const char*, int, int);'
13783	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13784	esac
13785	case "$gethostbyaddr_r_proto" in
13786	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13787	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13788	esac
13789	case "$gethostbyaddr_r_proto" in
13790	''|0)	d_gethostbyaddr_r=undef
13791 	        gethostbyaddr_r_proto=0
13792		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13793	* )	case "$gethostbyaddr_r_proto" in
13794		REENTRANT_PROTO*) ;;
13795		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13796		esac
13797		echo "Prototype: $try" ;;
13798	esac
13799	;;
13800	*)	case "$usethreads" in
13801		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13802		esac
13803		d_gethostbyaddr_r=undef
13804		gethostbyaddr_r_proto=0
13805		;;
13806	esac
13807	;;
13808*)	gethostbyaddr_r_proto=0
13809	;;
13810esac
13811
13812: see if gethostbyname_r exists
13813set gethostbyname_r d_gethostbyname_r
13814eval $inlibc
13815case "$d_gethostbyname_r" in
13816"$define")
13817	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13818	case "$d_gethostbyname_r_proto:$usethreads" in
13819	":define")	d_gethostbyname_r_proto=define
13820		set d_gethostbyname_r_proto gethostbyname_r $hdrs
13821		eval $hasproto ;;
13822	*)	;;
13823	esac
13824	case "$d_gethostbyname_r_proto" in
13825	define)
13826	case "$gethostbyname_r_proto" in
13827	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13828	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13829	esac
13830	case "$gethostbyname_r_proto" in
13831	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13832	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13833	esac
13834	case "$gethostbyname_r_proto" in
13835	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13836	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13837	esac
13838	case "$gethostbyname_r_proto" in
13839	''|0)	d_gethostbyname_r=undef
13840 	        gethostbyname_r_proto=0
13841		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13842	* )	case "$gethostbyname_r_proto" in
13843		REENTRANT_PROTO*) ;;
13844		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13845		esac
13846		echo "Prototype: $try" ;;
13847	esac
13848	;;
13849	*)	case "$usethreads" in
13850		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13851		esac
13852		d_gethostbyname_r=undef
13853		gethostbyname_r_proto=0
13854		;;
13855	esac
13856	;;
13857*)	gethostbyname_r_proto=0
13858	;;
13859esac
13860
13861: see if gethostent_r exists
13862set gethostent_r d_gethostent_r
13863eval $inlibc
13864case "$d_gethostent_r" in
13865"$define")
13866	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13867	case "$d_gethostent_r_proto:$usethreads" in
13868	":define")	d_gethostent_r_proto=define
13869		set d_gethostent_r_proto gethostent_r $hdrs
13870		eval $hasproto ;;
13871	*)	;;
13872	esac
13873	case "$d_gethostent_r_proto" in
13874	define)
13875	case "$gethostent_r_proto" in
13876	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13877	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13878	esac
13879	case "$gethostent_r_proto" in
13880	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13881	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13882	esac
13883	case "$gethostent_r_proto" in
13884	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13885	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13886	esac
13887	case "$gethostent_r_proto" in
13888	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13889	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13890	esac
13891	case "$gethostent_r_proto" in
13892	''|0) try='int gethostent_r(struct hostent*, char*, int);'
13893	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13894	esac
13895	case "$gethostent_r_proto" in
13896	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13897	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13898	esac
13899	case "$gethostent_r_proto" in
13900	''|0)	d_gethostent_r=undef
13901 	        gethostent_r_proto=0
13902		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13903	* )	case "$gethostent_r_proto" in
13904		REENTRANT_PROTO*) ;;
13905		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13906		esac
13907		echo "Prototype: $try" ;;
13908	esac
13909	;;
13910	*)	case "$usethreads" in
13911		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13912		esac
13913		d_gethostent_r=undef
13914		gethostent_r_proto=0
13915		;;
13916	esac
13917	;;
13918*)	gethostent_r_proto=0
13919	;;
13920esac
13921
13922: see if prototypes for various gethostxxx netdb.h functions are available
13923echo " "
13924set d_gethostprotos gethostent $i_netdb netdb.h
13925eval $hasproto
13926
13927: see if getitimer exists
13928set getitimer d_getitimer
13929eval $inlibc
13930
13931: see if getlogin exists
13932set getlogin d_getlogin
13933eval $inlibc
13934
13935: see if getlogin_r exists
13936set getlogin_r d_getlogin_r
13937eval $inlibc
13938case "$d_getlogin_r" in
13939"$define")
13940	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13941	case "$d_getlogin_r_proto:$usethreads" in
13942	":define")	d_getlogin_r_proto=define
13943		set d_getlogin_r_proto getlogin_r $hdrs
13944		eval $hasproto ;;
13945	*)	;;
13946	esac
13947	case "$d_getlogin_r_proto" in
13948	define)
13949	case "$getlogin_r_proto" in
13950	''|0) try='int getlogin_r(char*, size_t);'
13951	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13952	esac
13953	case "$getlogin_r_proto" in
13954	''|0) try='int getlogin_r(char*, int);'
13955	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13956	esac
13957	case "$getlogin_r_proto" in
13958	''|0) try='char* getlogin_r(char*, size_t);'
13959	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13960	esac
13961	case "$getlogin_r_proto" in
13962	''|0) try='char* getlogin_r(char*, int);'
13963	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13964	esac
13965	case "$getlogin_r_proto" in
13966	''|0)	d_getlogin_r=undef
13967 	        getlogin_r_proto=0
13968		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13969	* )	case "$getlogin_r_proto" in
13970		REENTRANT_PROTO*) ;;
13971		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13972		esac
13973		echo "Prototype: $try" ;;
13974	esac
13975	;;
13976	*)	case "$usethreads" in
13977		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13978		esac
13979		d_getlogin_r=undef
13980		getlogin_r_proto=0
13981		;;
13982	esac
13983	;;
13984*)	getlogin_r_proto=0
13985	;;
13986esac
13987
13988: see if getmnt exists
13989set getmnt d_getmnt
13990eval $inlibc
13991
13992: see if getmntent exists
13993set getmntent d_getmntent
13994eval $inlibc
13995
13996: see if getnameinfo exists
13997set getnameinfo d_getnameinfo
13998eval $inlibc
13999
14000: see if getnetbyaddr exists
14001set getnetbyaddr d_getnbyaddr
14002eval $inlibc
14003
14004: see if getnetbyname exists
14005set getnetbyname d_getnbyname
14006eval $inlibc
14007
14008: see if getnetent exists
14009set getnetent d_getnent
14010eval $inlibc
14011
14012: see if getnetbyaddr_r exists
14013set getnetbyaddr_r d_getnetbyaddr_r
14014eval $inlibc
14015case "$d_getnetbyaddr_r" in
14016"$define")
14017	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14018	case "$d_getnetbyaddr_r_proto:$usethreads" in
14019	":define")	d_getnetbyaddr_r_proto=define
14020		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14021		eval $hasproto ;;
14022	*)	;;
14023	esac
14024	case "$d_getnetbyaddr_r_proto" in
14025	define)
14026	case "$getnetbyaddr_r_proto" in
14027	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14028	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14029	esac
14030	case "$getnetbyaddr_r_proto" in
14031	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14032	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14033	esac
14034	case "$getnetbyaddr_r_proto" in
14035	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14036	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14037	esac
14038	case "$getnetbyaddr_r_proto" in
14039	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14040	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14041	esac
14042	case "$getnetbyaddr_r_proto" in
14043	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14044	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14045	esac
14046	case "$getnetbyaddr_r_proto" in
14047	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14048	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14049	esac
14050	case "$getnetbyaddr_r_proto" in
14051	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14052	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14053	esac
14054	case "$getnetbyaddr_r_proto" in
14055	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14056	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14057	esac
14058	case "$getnetbyaddr_r_proto" in
14059	''|0)	d_getnetbyaddr_r=undef
14060 	        getnetbyaddr_r_proto=0
14061		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14062	* )	case "$getnetbyaddr_r_proto" in
14063		REENTRANT_PROTO*) ;;
14064		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14065		esac
14066		echo "Prototype: $try" ;;
14067	esac
14068	;;
14069	*)	case "$usethreads" in
14070		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14071		esac
14072		d_getnetbyaddr_r=undef
14073		getnetbyaddr_r_proto=0
14074		;;
14075	esac
14076	;;
14077*)	getnetbyaddr_r_proto=0
14078	;;
14079esac
14080
14081: see if getnetbyname_r exists
14082set getnetbyname_r d_getnetbyname_r
14083eval $inlibc
14084case "$d_getnetbyname_r" in
14085"$define")
14086	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14087	case "$d_getnetbyname_r_proto:$usethreads" in
14088	":define")	d_getnetbyname_r_proto=define
14089		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14090		eval $hasproto ;;
14091	*)	;;
14092	esac
14093	case "$d_getnetbyname_r_proto" in
14094	define)
14095	case "$getnetbyname_r_proto" in
14096	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14097	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14098	esac
14099	case "$getnetbyname_r_proto" in
14100	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14101	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14102	esac
14103	case "$getnetbyname_r_proto" in
14104	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14105	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14106	esac
14107	case "$getnetbyname_r_proto" in
14108	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14109	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14110	esac
14111	case "$getnetbyname_r_proto" in
14112	''|0)	d_getnetbyname_r=undef
14113 	        getnetbyname_r_proto=0
14114		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14115	* )	case "$getnetbyname_r_proto" in
14116		REENTRANT_PROTO*) ;;
14117		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14118		esac
14119		echo "Prototype: $try" ;;
14120	esac
14121	;;
14122	*)	case "$usethreads" in
14123		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14124		esac
14125		d_getnetbyname_r=undef
14126		getnetbyname_r_proto=0
14127		;;
14128	esac
14129	;;
14130*)	getnetbyname_r_proto=0
14131	;;
14132esac
14133
14134: see if getnetent_r exists
14135set getnetent_r d_getnetent_r
14136eval $inlibc
14137case "$d_getnetent_r" in
14138"$define")
14139	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14140	case "$d_getnetent_r_proto:$usethreads" in
14141	":define")	d_getnetent_r_proto=define
14142		set d_getnetent_r_proto getnetent_r $hdrs
14143		eval $hasproto ;;
14144	*)	;;
14145	esac
14146	case "$d_getnetent_r_proto" in
14147	define)
14148	case "$getnetent_r_proto" in
14149	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14150	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14151	esac
14152	case "$getnetent_r_proto" in
14153	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14154	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14155	esac
14156	case "$getnetent_r_proto" in
14157	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14158	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14159	esac
14160	case "$getnetent_r_proto" in
14161	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14162	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14163	esac
14164	case "$getnetent_r_proto" in
14165	''|0) try='int getnetent_r(struct netent*, char*, int);'
14166	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14167	esac
14168	case "$getnetent_r_proto" in
14169	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14170	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14171	esac
14172	case "$getnetent_r_proto" in
14173	''|0)	d_getnetent_r=undef
14174 	        getnetent_r_proto=0
14175		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14176	* )	case "$getnetent_r_proto" in
14177		REENTRANT_PROTO*) ;;
14178		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14179		esac
14180		echo "Prototype: $try" ;;
14181	esac
14182	;;
14183	*)	case "$usethreads" in
14184		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14185		esac
14186		d_getnetent_r=undef
14187		getnetent_r_proto=0
14188		;;
14189	esac
14190	;;
14191*)	getnetent_r_proto=0
14192	;;
14193esac
14194
14195: see if prototypes for various getnetxxx netdb.h functions are available
14196echo " "
14197set d_getnetprotos getnetent $i_netdb netdb.h
14198eval $hasproto
14199
14200: see if getpagesize exists
14201set getpagesize d_getpagsz
14202eval $inlibc
14203
14204: Optional checks for getprotobyname and getprotobynumber
14205
14206: see if getprotobyname exists
14207set getprotobyname d_getpbyname
14208eval $inlibc
14209
14210: see if getprotobynumber exists
14211set getprotobynumber d_getpbynumber
14212eval $inlibc
14213
14214: see if getprotoent exists
14215set getprotoent d_getpent
14216eval $inlibc
14217
14218: see if getpgid exists
14219set getpgid d_getpgid
14220eval $inlibc
14221
14222: see if getpgrp2 exists
14223set getpgrp2 d_getpgrp2
14224eval $inlibc
14225
14226: see if getppid exists
14227set getppid d_getppid
14228eval $inlibc
14229
14230: see if getpriority exists
14231set getpriority d_getprior
14232eval $inlibc
14233
14234: see if getprotobyname_r exists
14235set getprotobyname_r d_getprotobyname_r
14236eval $inlibc
14237case "$d_getprotobyname_r" in
14238"$define")
14239	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14240	case "$d_getprotobyname_r_proto:$usethreads" in
14241	":define")	d_getprotobyname_r_proto=define
14242		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14243		eval $hasproto ;;
14244	*)	;;
14245	esac
14246	case "$d_getprotobyname_r_proto" in
14247	define)
14248	case "$getprotobyname_r_proto" in
14249	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14250	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14251	esac
14252	case "$getprotobyname_r_proto" in
14253	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14254	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14255	esac
14256	case "$getprotobyname_r_proto" in
14257	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14258	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14259	esac
14260	case "$getprotobyname_r_proto" in
14261	''|0)	d_getprotobyname_r=undef
14262 	        getprotobyname_r_proto=0
14263		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14264	* )	case "$getprotobyname_r_proto" in
14265		REENTRANT_PROTO*) ;;
14266		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14267		esac
14268		echo "Prototype: $try" ;;
14269	esac
14270	;;
14271	*)	case "$usethreads" in
14272		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14273		esac
14274		d_getprotobyname_r=undef
14275		getprotobyname_r_proto=0
14276		;;
14277	esac
14278	;;
14279*)	getprotobyname_r_proto=0
14280	;;
14281esac
14282
14283: see if getprotobynumber_r exists
14284set getprotobynumber_r d_getprotobynumber_r
14285eval $inlibc
14286case "$d_getprotobynumber_r" in
14287"$define")
14288	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14289	case "$d_getprotobynumber_r_proto:$usethreads" in
14290	":define")	d_getprotobynumber_r_proto=define
14291		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14292		eval $hasproto ;;
14293	*)	;;
14294	esac
14295	case "$d_getprotobynumber_r_proto" in
14296	define)
14297	case "$getprotobynumber_r_proto" in
14298	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14299	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14300	esac
14301	case "$getprotobynumber_r_proto" in
14302	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14303	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14304	esac
14305	case "$getprotobynumber_r_proto" in
14306	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14307	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14308	esac
14309	case "$getprotobynumber_r_proto" in
14310	''|0)	d_getprotobynumber_r=undef
14311 	        getprotobynumber_r_proto=0
14312		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14313	* )	case "$getprotobynumber_r_proto" in
14314		REENTRANT_PROTO*) ;;
14315		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14316		esac
14317		echo "Prototype: $try" ;;
14318	esac
14319	;;
14320	*)	case "$usethreads" in
14321		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14322		esac
14323		d_getprotobynumber_r=undef
14324		getprotobynumber_r_proto=0
14325		;;
14326	esac
14327	;;
14328*)	getprotobynumber_r_proto=0
14329	;;
14330esac
14331
14332: see if getprotoent_r exists
14333set getprotoent_r d_getprotoent_r
14334eval $inlibc
14335case "$d_getprotoent_r" in
14336"$define")
14337	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14338	case "$d_getprotoent_r_proto:$usethreads" in
14339	":define")	d_getprotoent_r_proto=define
14340		set d_getprotoent_r_proto getprotoent_r $hdrs
14341		eval $hasproto ;;
14342	*)	;;
14343	esac
14344	case "$d_getprotoent_r_proto" in
14345	define)
14346	case "$getprotoent_r_proto" in
14347	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14348	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14349	esac
14350	case "$getprotoent_r_proto" in
14351	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14352	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14353	esac
14354	case "$getprotoent_r_proto" in
14355	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14356	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14357	esac
14358	case "$getprotoent_r_proto" in
14359	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14360	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14361	esac
14362	case "$getprotoent_r_proto" in
14363	''|0)	d_getprotoent_r=undef
14364 	        getprotoent_r_proto=0
14365		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14366	* )	case "$getprotoent_r_proto" in
14367		REENTRANT_PROTO*) ;;
14368		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14369		esac
14370		echo "Prototype: $try" ;;
14371	esac
14372	;;
14373	*)	case "$usethreads" in
14374		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14375		esac
14376		d_getprotoent_r=undef
14377		getprotoent_r_proto=0
14378		;;
14379	esac
14380	;;
14381*)	getprotoent_r_proto=0
14382	;;
14383esac
14384
14385: see if prototypes for various getprotoxxx netdb.h functions are available
14386echo " "
14387set d_getprotoprotos getprotoent $i_netdb netdb.h
14388eval $hasproto
14389
14390: see if getprpwnam exists
14391set getprpwnam d_getprpwnam
14392eval $inlibc
14393
14394: see if getpwent exists
14395set getpwent d_getpwent
14396eval $inlibc
14397
14398: see if getpwent_r exists
14399set getpwent_r d_getpwent_r
14400eval $inlibc
14401case "$d_getpwent_r" in
14402"$define")
14403	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14404	case "$d_getpwent_r_proto:$usethreads" in
14405	":define")	d_getpwent_r_proto=define
14406		set d_getpwent_r_proto getpwent_r $hdrs
14407		eval $hasproto ;;
14408	*)	;;
14409	esac
14410	case "$d_getpwent_r_proto" in
14411	define)
14412	case "$getpwent_r_proto" in
14413	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14414	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14415	esac
14416	case "$getpwent_r_proto" in
14417	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14418	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14419	esac
14420	case "$getpwent_r_proto" in
14421	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14422	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14423	esac
14424	case "$getpwent_r_proto" in
14425	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14426	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14427	esac
14428	case "$getpwent_r_proto" in
14429	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14430	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14431	esac
14432	case "$getpwent_r_proto" in
14433	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14434	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14435	esac
14436	case "$getpwent_r_proto" in
14437	''|0)	d_getpwent_r=undef
14438 	        getpwent_r_proto=0
14439		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14440	* )	case "$getpwent_r_proto" in
14441		REENTRANT_PROTO*) ;;
14442		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14443		esac
14444		echo "Prototype: $try" ;;
14445	esac
14446	;;
14447	*)	case "$usethreads" in
14448		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14449		esac
14450		d_getpwent_r=undef
14451		getpwent_r_proto=0
14452		;;
14453	esac
14454	;;
14455*)	getpwent_r_proto=0
14456	;;
14457esac
14458
14459: see if getpwnam_r exists
14460set getpwnam_r d_getpwnam_r
14461eval $inlibc
14462case "$d_getpwnam_r" in
14463"$define")
14464	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14465	case "$d_getpwnam_r_proto:$usethreads" in
14466	":define")	d_getpwnam_r_proto=define
14467		set d_getpwnam_r_proto getpwnam_r $hdrs
14468		eval $hasproto ;;
14469	*)	;;
14470	esac
14471	case "$d_getpwnam_r_proto" in
14472	define)
14473	case "$getpwnam_r_proto" in
14474	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14475	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14476	esac
14477	case "$getpwnam_r_proto" in
14478	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14479	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14480	esac
14481	case "$getpwnam_r_proto" in
14482	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14483	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14484	esac
14485	case "$getpwnam_r_proto" in
14486	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14487	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14488	esac
14489	case "$getpwnam_r_proto" in
14490	''|0)	d_getpwnam_r=undef
14491 	        getpwnam_r_proto=0
14492		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14493	* )	case "$getpwnam_r_proto" in
14494		REENTRANT_PROTO*) ;;
14495		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14496		esac
14497		echo "Prototype: $try" ;;
14498	esac
14499	;;
14500	*)	case "$usethreads" in
14501		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14502		esac
14503		d_getpwnam_r=undef
14504		getpwnam_r_proto=0
14505		;;
14506	esac
14507	;;
14508*)	getpwnam_r_proto=0
14509	;;
14510esac
14511
14512: see if getpwuid_r exists
14513set getpwuid_r d_getpwuid_r
14514eval $inlibc
14515case "$d_getpwuid_r" in
14516"$define")
14517	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14518	case "$d_getpwuid_r_proto:$usethreads" in
14519	":define")	d_getpwuid_r_proto=define
14520		set d_getpwuid_r_proto getpwuid_r $hdrs
14521		eval $hasproto ;;
14522	*)	;;
14523	esac
14524	case "$d_getpwuid_r_proto" in
14525	define)
14526	case "$getpwuid_r_proto" in
14527	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14528	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14529	esac
14530	case "$getpwuid_r_proto" in
14531	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14532	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14533	esac
14534	case "$getpwuid_r_proto" in
14535	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14536	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14537	esac
14538	case "$getpwuid_r_proto" in
14539	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14540	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14541	esac
14542	case "$getpwuid_r_proto" in
14543	''|0)	d_getpwuid_r=undef
14544 	        getpwuid_r_proto=0
14545		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14546	* )	case "$getpwuid_r_proto" in
14547		REENTRANT_PROTO*) ;;
14548		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14549		esac
14550		echo "Prototype: $try" ;;
14551	esac
14552	;;
14553	*)	case "$usethreads" in
14554		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14555		esac
14556		d_getpwuid_r=undef
14557		getpwuid_r_proto=0
14558		;;
14559	esac
14560	;;
14561*)	getpwuid_r_proto=0
14562	;;
14563esac
14564
14565: Optional checks for getsbyname and getsbyport
14566
14567: see if getservbyname exists
14568set getservbyname d_getsbyname
14569eval $inlibc
14570
14571: see if getservbyport exists
14572set getservbyport d_getsbyport
14573eval $inlibc
14574
14575: see if getservent exists
14576set getservent d_getsent
14577eval $inlibc
14578
14579: see if getservbyname_r exists
14580set getservbyname_r d_getservbyname_r
14581eval $inlibc
14582case "$d_getservbyname_r" in
14583"$define")
14584	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14585	case "$d_getservbyname_r_proto:$usethreads" in
14586	":define")	d_getservbyname_r_proto=define
14587		set d_getservbyname_r_proto getservbyname_r $hdrs
14588		eval $hasproto ;;
14589	*)	;;
14590	esac
14591	case "$d_getservbyname_r_proto" in
14592	define)
14593	case "$getservbyname_r_proto" in
14594	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14595	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14596	esac
14597	case "$getservbyname_r_proto" in
14598	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14599	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14600	esac
14601	case "$getservbyname_r_proto" in
14602	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14603	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14604	esac
14605	case "$getservbyname_r_proto" in
14606	''|0)	d_getservbyname_r=undef
14607 	        getservbyname_r_proto=0
14608		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14609	* )	case "$getservbyname_r_proto" in
14610		REENTRANT_PROTO*) ;;
14611		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14612		esac
14613		echo "Prototype: $try" ;;
14614	esac
14615	;;
14616	*)	case "$usethreads" in
14617		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14618		esac
14619		d_getservbyname_r=undef
14620		getservbyname_r_proto=0
14621		;;
14622	esac
14623	;;
14624*)	getservbyname_r_proto=0
14625	;;
14626esac
14627
14628: see if getservbyport_r exists
14629set getservbyport_r d_getservbyport_r
14630eval $inlibc
14631case "$d_getservbyport_r" in
14632"$define")
14633	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14634	case "$d_getservbyport_r_proto:$usethreads" in
14635	":define")	d_getservbyport_r_proto=define
14636		set d_getservbyport_r_proto getservbyport_r $hdrs
14637		eval $hasproto ;;
14638	*)	;;
14639	esac
14640	case "$d_getservbyport_r_proto" in
14641	define)
14642	case "$getservbyport_r_proto" in
14643	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14644	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14645	esac
14646	case "$getservbyport_r_proto" in
14647	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14648	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14649	esac
14650	case "$getservbyport_r_proto" in
14651	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14652	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14653	esac
14654	case "$getservbyport_r_proto" in
14655	''|0)	d_getservbyport_r=undef
14656 	        getservbyport_r_proto=0
14657		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14658	* )	case "$getservbyport_r_proto" in
14659		REENTRANT_PROTO*) ;;
14660		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14661		esac
14662		echo "Prototype: $try" ;;
14663	esac
14664	;;
14665	*)	case "$usethreads" in
14666		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14667		esac
14668		d_getservbyport_r=undef
14669		getservbyport_r_proto=0
14670		;;
14671	esac
14672	;;
14673*)	getservbyport_r_proto=0
14674	;;
14675esac
14676
14677: see if getservent_r exists
14678set getservent_r d_getservent_r
14679eval $inlibc
14680case "$d_getservent_r" in
14681"$define")
14682	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14683	case "$d_getservent_r_proto:$usethreads" in
14684	":define")	d_getservent_r_proto=define
14685		set d_getservent_r_proto getservent_r $hdrs
14686		eval $hasproto ;;
14687	*)	;;
14688	esac
14689	case "$d_getservent_r_proto" in
14690	define)
14691	case "$getservent_r_proto" in
14692	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14693	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14694	esac
14695	case "$getservent_r_proto" in
14696	''|0) try='int getservent_r(struct servent*, char*, int);'
14697	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14698	esac
14699	case "$getservent_r_proto" in
14700	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14701	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14702	esac
14703	case "$getservent_r_proto" in
14704	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14705	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14706	esac
14707	case "$getservent_r_proto" in
14708	''|0)	d_getservent_r=undef
14709 	        getservent_r_proto=0
14710		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14711	* )	case "$getservent_r_proto" in
14712		REENTRANT_PROTO*) ;;
14713		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14714		esac
14715		echo "Prototype: $try" ;;
14716	esac
14717	;;
14718	*)	case "$usethreads" in
14719		define) echo "getservent_r has no prototype, not using it." >&4 ;;
14720		esac
14721		d_getservent_r=undef
14722		getservent_r_proto=0
14723		;;
14724	esac
14725	;;
14726*)	getservent_r_proto=0
14727	;;
14728esac
14729
14730: see if prototypes for various getservxxx netdb.h functions are available
14731echo " "
14732set d_getservprotos getservent $i_netdb netdb.h
14733eval $hasproto
14734
14735: see if getspnam exists
14736set getspnam d_getspnam
14737eval $inlibc
14738
14739: see if this is a shadow.h system
14740set shadow.h i_shadow
14741eval $inhdr
14742
14743: see if getspnam_r exists
14744set getspnam_r d_getspnam_r
14745eval $inlibc
14746case "$d_getspnam_r" in
14747"$define")
14748	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14749	case "$d_getspnam_r_proto:$usethreads" in
14750	":define")	d_getspnam_r_proto=define
14751		set d_getspnam_r_proto getspnam_r $hdrs
14752		eval $hasproto ;;
14753	*)	;;
14754	esac
14755	case "$d_getspnam_r_proto" in
14756	define)
14757	case "$getspnam_r_proto" in
14758	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14759	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14760	esac
14761	case "$getspnam_r_proto" in
14762	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14763	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14764	esac
14765	case "$getspnam_r_proto" in
14766	''|0)	d_getspnam_r=undef
14767 	        getspnam_r_proto=0
14768		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14769	* )	case "$getspnam_r_proto" in
14770		REENTRANT_PROTO*) ;;
14771		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14772		esac
14773		echo "Prototype: $try" ;;
14774	esac
14775	;;
14776	*)	case "$usethreads" in
14777		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14778		esac
14779		d_getspnam_r=undef
14780		getspnam_r_proto=0
14781		;;
14782	esac
14783	;;
14784*)	getspnam_r_proto=0
14785	;;
14786esac
14787
14788: see if gettimeofday or ftime exists
14789set gettimeofday d_gettimeod
14790eval $inlibc
14791case "$d_gettimeod" in
14792"$undef")
14793	set ftime d_ftime
14794	eval $inlibc
14795	;;
14796*)
14797	val="$undef"; set d_ftime; eval $setvar
14798	;;
14799esac
14800case "$d_gettimeod$d_ftime" in
14801"$undef$undef")
14802	echo " "
14803	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14804	;;
14805esac
14806
14807: see if gmtime_r exists
14808set gmtime_r d_gmtime_r
14809eval $inlibc
14810case "$d_gmtime_r" in
14811"$define")
14812	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14813	case "$d_gmtime_r_proto:$usethreads" in
14814	":define")	d_gmtime_r_proto=define
14815		set d_gmtime_r_proto gmtime_r $hdrs
14816		eval $hasproto ;;
14817	*)	;;
14818	esac
14819	case "$d_gmtime_r_proto" in
14820	define)
14821	case "$gmtime_r_proto" in
14822	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14823	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14824	esac
14825	case "$gmtime_r_proto" in
14826	''|0) try='int gmtime_r(const time_t*, struct tm*);'
14827	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14828	esac
14829	case "$gmtime_r_proto" in
14830	''|0)	d_gmtime_r=undef
14831 	        gmtime_r_proto=0
14832		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14833	* )	case "$gmtime_r_proto" in
14834		REENTRANT_PROTO*) ;;
14835		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14836		esac
14837		echo "Prototype: $try" ;;
14838	esac
14839	;;
14840	*)	case "$usethreads" in
14841		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14842		esac
14843		d_gmtime_r=undef
14844		gmtime_r_proto=0
14845		;;
14846	esac
14847	;;
14848*)	gmtime_r_proto=0
14849	;;
14850esac
14851
14852: see if hasmntopt exists
14853set hasmntopt d_hasmntopt
14854eval $inlibc
14855
14856: see if this is a netinet/in.h or sys/in.h system
14857set netinet/in.h i_niin sys/in.h i_sysin
14858eval $inhdr
14859
14860: see if arpa/inet.h has to be included
14861set arpa/inet.h i_arpainet
14862eval $inhdr
14863
14864: see if htonl --and friends-- exists
14865val=''
14866set htonl val
14867eval $inlibc
14868
14869: Maybe they are macros.
14870case "$val" in
14871$undef)
14872	$cat >htonl.c <<EOM
14873#include <stdio.h>
14874#include <sys/types.h>
14875#$i_niin I_NETINET_IN
14876#$i_sysin I_SYS_IN
14877#$i_arpainet I_ARPA_INET
14878#ifdef I_NETINET_IN
14879#include <netinet/in.h>
14880#endif
14881#ifdef I_SYS_IN
14882#include <sys/in.h>
14883#endif
14884#ifdef I_ARPA_INET
14885#include <arpa/inet.h>
14886#endif
14887#ifdef htonl
14888printf("Defined as a macro.");
14889#endif
14890EOM
14891	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14892	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14893		val="$define"
14894		echo "But it seems to be defined as a macro." >&4
14895	fi
14896	$rm -f htonl.?
14897	;;
14898esac
14899set d_htonl
14900eval $setvar
14901
14902: see if ilogbl exists
14903set ilogbl d_ilogbl
14904eval $inlibc
14905
14906: index or strchr
14907echo " "
14908if set index val -f; eval $csym; $val; then
14909	if set strchr val -f d_strchr; eval $csym; $val; then
14910		if $contains strchr "$strings" >/dev/null 2>&1 ; then
14911			val="$define"
14912			vali="$undef"
14913			echo "strchr() found." >&4
14914		else
14915			val="$undef"
14916			vali="$define"
14917			echo "index() found." >&4
14918		fi
14919	else
14920		val="$undef"
14921		vali="$define"
14922		echo "index() found." >&4
14923	fi
14924else
14925	if set strchr val -f d_strchr; eval $csym; $val; then
14926		val="$define"
14927		vali="$undef"
14928		echo "strchr() found." >&4
14929	else
14930		echo "No index() or strchr() found!" >&4
14931		val="$undef"
14932		vali="$undef"
14933	fi
14934fi
14935set d_strchr; eval $setvar
14936val="$vali"
14937set d_index; eval $setvar
14938
14939: check whether inet_aton exists
14940set inet_aton d_inetaton
14941eval $inlibc
14942
14943: see if inet_ntop exists
14944set inet_ntop d_inetntop
14945eval $inlibc
14946
14947: see if inet_pton exists
14948set inet_pton d_inetpton
14949eval $inlibc
14950
14951: Look for isascii
14952echo " "
14953$cat >isascii.c <<EOCP
14954#include <stdio.h>
14955#include <ctype.h>
14956#$i_stdlib I_STDLIB
14957#ifdef I_STDLIB
14958#include <stdlib.h>
14959#endif
14960int main() {
14961	int c = 'A';
14962	if (isascii(c))
14963		exit(0);
14964	else
14965		exit(1);
14966}
14967EOCP
14968set isascii
14969if eval $compile; then
14970	echo "isascii() found." >&4
14971	val="$define"
14972else
14973	echo "isascii() NOT found." >&4
14974	val="$undef"
14975fi
14976set d_isascii
14977eval $setvar
14978$rm -f isascii*
14979
14980: see if isfinite exists
14981set isfinite d_isfinite
14982eval $inlibc
14983
14984: see if isinf exists
14985set isinf d_isinf
14986eval $inlibc
14987
14988: see if isnan exists
14989set isnan d_isnan
14990eval $inlibc
14991
14992: see if isnanl exists
14993set isnanl d_isnanl
14994eval $inlibc
14995
14996: see if killpg exists
14997set killpg d_killpg
14998eval $inlibc
14999
15000: see if lchown exists
15001echo " "
15002$cat > try.c <<'EOCP'
15003/* System header to define __stub macros and hopefully few prototypes,
15004    which can conflict with char lchown(); below.  */
15005#include <assert.h>
15006/* Override any gcc2 internal prototype to avoid an error.  */
15007/* We use char because int might match the return type of a gcc2
15008   builtin and then its argument prototype would still apply.  */
15009char lchown();
15010int main() {
15011    /*  The GNU C library defines this for functions which it implements
15012        to always fail with ENOSYS.  Some functions are actually named
15013	something starting with __ and the normal name is an alias.  */
15014#if defined (__stub_lchown) || defined (__stub___lchown)
15015choke me
15016#else
15017lchown();
15018#endif
15019; return 0; }
15020EOCP
15021set try
15022if eval $compile; then
15023    $echo "lchown() found." >&4
15024    val="$define"
15025else
15026    $echo "lchown() NOT found." >&4
15027    val="$undef"
15028fi
15029set d_lchown
15030eval $setvar
15031
15032: See if number of significant digits in a double precision number is known
15033echo " "
15034$cat >ldbl_dig.c <<EOM
15035#$i_limits I_LIMITS
15036#$i_float I_FLOAT
15037#ifdef I_LIMITS
15038#include <limits.h>
15039#endif
15040#ifdef I_FLOAT
15041#include <float.h>
15042#endif
15043#ifdef LDBL_DIG
15044printf("Contains LDBL_DIG");
15045#endif
15046EOM
15047$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15048if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15049	echo "LDBL_DIG found." >&4
15050	val="$define"
15051else
15052	echo "LDBL_DIG NOT found." >&4
15053	val="$undef"
15054fi
15055$rm -f ldbl_dig.?
15056set d_ldbl_dig
15057eval $setvar
15058
15059: see if this is a math.h system
15060set math.h i_math
15061eval $inhdr
15062
15063: check to see if math.h defines _LIB_VERSION
15064d_libm_lib_version="$undef"
15065case $i_math in
15066    $define)
15067	echo " "
15068	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15069	$cat >try.c <<EOCP
15070#include <unistd.h>
15071#include <math.h>
15072int main (int argc, char *argv[])
15073{
15074    printf ("%d\n", _LIB_VERSION);
15075    return (0);
15076    } /* main */
15077EOCP
15078	set try
15079	if eval $compile; then
15080	    foo=`$run ./try`
15081	    echo "Yes, it does ($foo)" >&4
15082	    d_libm_lib_version="$define"
15083	else
15084	    echo "No, it does not (probably harmless)" >&4
15085	    fi
15086	$rm_try
15087	;;
15088
15089    esac
15090
15091: see if link exists
15092set link d_link
15093eval $inlibc
15094
15095: see if localtime_r exists
15096set localtime_r d_localtime_r
15097eval $inlibc
15098case "$d_localtime_r" in
15099"$define")
15100	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15101	case "$d_localtime_r_proto:$usethreads" in
15102	":define")	d_localtime_r_proto=define
15103		set d_localtime_r_proto localtime_r $hdrs
15104		eval $hasproto ;;
15105	*)	;;
15106	esac
15107	case "$d_localtime_r_proto" in
15108	define)
15109	case "$localtime_r_proto" in
15110	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15111	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15112	esac
15113	case "$localtime_r_proto" in
15114	''|0) try='int localtime_r(const time_t*, struct tm*);'
15115	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15116	esac
15117	case "$localtime_r_proto" in
15118	''|0)	d_localtime_r=undef
15119 	        localtime_r_proto=0
15120		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15121	* )	case "$localtime_r_proto" in
15122		REENTRANT_PROTO*) ;;
15123		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15124		esac
15125		echo "Prototype: $try" ;;
15126	esac
15127	;;
15128	*)	case "$usethreads" in
15129		define) echo "localtime_r has no prototype, not using it." >&4 ;;
15130		esac
15131		d_localtime_r=undef
15132		localtime_r_proto=0
15133		;;
15134	esac
15135	;;
15136*)	localtime_r_proto=0
15137	;;
15138esac
15139
15140: see if localtime_r calls tzset
15141case "$localtime_r_proto" in
15142REENTRANT_PROTO*)
15143	$cat >try.c <<EOCP
15144/*  Does our libc's localtime_r call tzset ?
15145 *  return 0 if so, 1 otherwise.
15146 */
15147#$i_systypes	I_SYS_TYPES
15148#$i_unistd	I_UNISTD
15149#$i_time	I_TIME
15150#$i_stdlib	I_STDLIB
15151#$i_string	I_STRING
15152#$i_malloc	I_MALLOC
15153#ifdef I_SYS_TYPES
15154#  include <sys/types.h>
15155#endif
15156#ifdef I_UNISTD
15157#  include <unistd.h>
15158#endif
15159#ifdef I_TIME
15160#  include <time.h>
15161#endif
15162#ifdef I_STDLIB
15163#include <stdlib.h>
15164#endif
15165#ifdef I_STRING
15166#  include <string.h>
15167#else
15168#  include <strings.h>
15169#endif
15170#ifdef I_MALLOC
15171#  include <malloc.h>
15172#endif
15173int main()
15174{
15175    time_t t = time(0L);
15176    char w_tz[]="TZ" "=GMT+5",
15177	 e_tz[]="TZ" "=GMT-5",
15178	*tz_e = (char*)malloc(16),
15179	*tz_w = (char*)malloc(16);
15180    struct tm tm_e, tm_w;
15181    memset(&tm_e,'\0',sizeof(struct tm));
15182    memset(&tm_w,'\0',sizeof(struct tm));
15183    strcpy(tz_e,e_tz);
15184    strcpy(tz_w,w_tz);
15185
15186    putenv(tz_e);
15187    localtime_r(&t, &tm_e);
15188
15189    putenv(tz_w);
15190    localtime_r(&t, &tm_w);
15191
15192    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15193	return 1;
15194    return 0;
15195}
15196EOCP
15197	set try
15198	if eval $compile; then
15199	    if $run ./try; then
15200		d_localtime_r_needs_tzset=undef;
15201	    else
15202		d_localtime_r_needs_tzset=define;
15203	    fi;
15204	else
15205	    d_localtime_r_needs_tzset=undef;
15206	fi;
15207     ;;
15208  *)
15209     d_localtime_r_needs_tzset=undef;
15210     ;;
15211esac
15212$rm_try
15213
15214: see if localeconv exists
15215set localeconv d_locconv
15216eval $inlibc
15217
15218: see if lockf exists
15219set lockf d_lockf
15220eval $inlibc
15221
15222: see if prototype for lseek is available
15223echo " "
15224set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15225eval $hasproto
15226
15227: see if lstat exists
15228set lstat d_lstat
15229eval $inlibc
15230
15231: see if madvise exists
15232set madvise d_madvise
15233eval $inlibc
15234
15235: see if malloc_size exists
15236set malloc_size d_malloc_size
15237eval $inlibc
15238
15239: see if malloc_size_good exists
15240set malloc_good_size d_malloc_good_size
15241eval $inlibc
15242
15243: see if mblen exists
15244set mblen d_mblen
15245eval $inlibc
15246
15247: see if mbstowcs exists
15248set mbstowcs d_mbstowcs
15249eval $inlibc
15250
15251: see if mbtowc exists
15252set mbtowc d_mbtowc
15253eval $inlibc
15254
15255: see if memchr exists
15256set memchr d_memchr
15257eval $inlibc
15258
15259: see if memcmp exists
15260set memcmp d_memcmp
15261eval $inlibc
15262
15263: see if memcpy exists
15264set memcpy d_memcpy
15265eval $inlibc
15266
15267: see if memmove exists
15268set memmove d_memmove
15269eval $inlibc
15270
15271: see if memset exists
15272set memset d_memset
15273eval $inlibc
15274
15275: see if mkdir exists
15276set mkdir d_mkdir
15277eval $inlibc
15278
15279: see if mkdtemp exists
15280set mkdtemp d_mkdtemp
15281eval $inlibc
15282
15283: see if mkfifo exists
15284set mkfifo d_mkfifo
15285eval $inlibc
15286
15287: see if mkstemp exists
15288set mkstemp d_mkstemp
15289eval $inlibc
15290
15291: see if mkstemps exists
15292set mkstemps d_mkstemps
15293eval $inlibc
15294
15295: see if mktime exists
15296set mktime d_mktime
15297eval $inlibc
15298
15299: see if this is a sys/mman.h system
15300set sys/mman.h i_sysmman
15301eval $inhdr
15302
15303: see if mmap exists
15304set mmap d_mmap
15305eval $inlibc
15306: see what shmat returns
15307: default to something harmless
15308mmaptype='void *'
15309case "$i_sysmman$d_mmap" in
15310"$define$define")
15311	$cat >mmap.c <<'END'
15312#include <sys/mman.h>
15313void *mmap();
15314END
15315	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15316		mmaptype='void *'
15317	else
15318		mmaptype='caddr_t'
15319	fi
15320	echo "and it returns ($mmaptype)." >&4
15321	;;
15322esac
15323
15324
15325
15326: see if sqrtl exists
15327set sqrtl d_sqrtl
15328eval $inlibc
15329
15330: see if scalbnl exists
15331set scalbnl d_scalbnl
15332eval $inlibc
15333
15334: see if modfl exists
15335set modfl d_modfl
15336eval $inlibc
15337
15338: see if prototype for modfl is available
15339echo " "
15340set d_modflproto modfl $i_math math.h
15341eval $hasproto
15342
15343d_modfl_pow32_bug="$undef"
15344
15345case "$d_longdbl$d_modfl" in
15346$define$define)
15347	$cat <<EOM
15348Checking to see whether your modfl() is okay for large values...
15349EOM
15350$cat >try.c <<EOCP
15351#include <math.h>
15352#include <stdio.h>
15353EOCP
15354if $test "X$d_modflproto" != "X$define"; then
15355	$cat >>try.c <<EOCP
15356/* Sigh. many current glibcs provide the function, but do not prototype it. */
15357long double modfl (long double, long double *);
15358EOCP
15359fi
15360$cat >>try.c <<EOCP
15361int main() {
15362    long double nv = 4294967303.15;
15363    long double v, w;
15364    v = modfl(nv, &w);
15365#ifdef __GLIBC__
15366    printf("glibc");
15367#endif
15368    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15369    return 0;
15370}
15371EOCP
15372	case "$osname:$gccversion" in
15373	aix:)	saveccflags="$ccflags"
15374		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15375	esac
15376	set try
15377	if eval $compile; then
15378		foo=`$run ./try`
15379		case "$foo" in
15380		*" 4294967303.150000 1.150000 4294967302.000000")
15381			echo >&4 "Your modfl() is broken for large values."
15382			d_modfl_pow32_bug="$define"
15383			case "$foo" in
15384			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15385			;;
15386			esac
15387			;;
15388		*" 4294967303.150000 0.150000 4294967303.000000")
15389			echo >&4 "Your modfl() seems okay for large values."
15390			;;
15391		*)	echo >&4 "I don't understand your modfl() at all."
15392			d_modfl="$undef"
15393			;;
15394		esac
15395		$rm_try
15396	else
15397		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15398		d_modfl="$undef"
15399	fi
15400	case "$osname:$gccversion" in
15401	aix:)	ccflags="$saveccflags" ;; # restore
15402	esac
15403	;;
15404esac
15405
15406if $test "$uselongdouble" = "$define"; then
15407    message=""
15408    if $test "$d_sqrtl" != "$define"; then
15409	message="$message sqrtl"
15410    fi
15411    if $test "$d_modfl" != "$define"; then
15412	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15413	    echo "You have both aintl and copysignl, so I can emulate modfl."
15414	else
15415	    message="$message modfl"
15416	fi
15417    fi
15418    if $test "$d_frexpl" != "$define"; then
15419	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15420	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15421	else
15422	    message="$message frexpl"
15423	fi
15424    fi
15425
15426    if $test "$message" != ""; then
15427	$cat <<EOM >&4
15428
15429*** You requested the use of long doubles but you do not seem to have
15430*** the following mathematical functions needed for long double support:
15431***    $message
15432*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15433*** Cannot continue, aborting.
15434
15435EOM
15436
15437	exit 1
15438    fi
15439fi
15440
15441: see if mprotect exists
15442set mprotect d_mprotect
15443eval $inlibc
15444
15445: see if msgctl exists
15446set msgctl d_msgctl
15447eval $inlibc
15448
15449: see if msgget exists
15450set msgget d_msgget
15451eval $inlibc
15452
15453: see if msgsnd exists
15454set msgsnd d_msgsnd
15455eval $inlibc
15456
15457: see if msgrcv exists
15458set msgrcv d_msgrcv
15459eval $inlibc
15460
15461: see how much of the 'msg*(2)' library is present.
15462h_msg=true
15463echo " "
15464case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15465*"$undef"*) h_msg=false;;
15466esac
15467case "$osname" in
15468freebsd)
15469    case "`ipcs 2>&1`" in
15470    "SVID messages"*"not configured"*)
15471	echo "Your $osname does not have the msg*(2) configured." >&4
15472        h_msg=false
15473	val="$undef"
15474	set msgctl d_msgctl
15475	eval $setvar
15476	set msgget d_msgget
15477	eval $setvar
15478	set msgsnd d_msgsnd
15479	eval $setvar
15480	set msgrcv d_msgrcv
15481	eval $setvar
15482	;;
15483    esac
15484    ;;
15485esac
15486: we could also check for sys/ipc.h ...
15487if $h_msg && $test `./findhdr sys/msg.h`; then
15488	echo "You have the full msg*(2) library." >&4
15489	val="$define"
15490else
15491	echo "You don't have the full msg*(2) library." >&4
15492	val="$undef"
15493fi
15494set d_msg
15495eval $setvar
15496
15497: Check for msghdr_s
15498echo " "
15499echo "Checking to see if your system supports struct msghdr..." >&4
15500set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15501eval $hasstruct
15502case "$d_msghdr_s" in
15503"$define")      echo "Yes, it does."   ;;
15504*)              echo "No, it doesn't." ;;
15505esac
15506
15507
15508: see if msync exists
15509set msync d_msync
15510eval $inlibc
15511
15512: see if munmap exists
15513set munmap d_munmap
15514eval $inlibc
15515
15516: see if nice exists
15517set nice d_nice
15518eval $inlibc
15519
15520: see if this is a langinfo.h system
15521set langinfo.h i_langinfo
15522eval $inhdr
15523
15524: see if nl_langinfo exists
15525set nl_langinfo d_nl_langinfo
15526eval $inlibc
15527
15528: check for volatile keyword
15529echo " "
15530echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15531$cat >try.c <<'EOCP'
15532int main()
15533{
15534	typedef struct _goo_struct goo_struct;
15535	goo_struct * volatile goo = ((goo_struct *)0);
15536	struct _goo_struct {
15537		long long_int;
15538		int reg_int;
15539		char char_var;
15540	};
15541	typedef unsigned short foo_t;
15542	char *volatile foo;
15543	volatile int bar;
15544	volatile foo_t blech;
15545	foo = foo;
15546}
15547EOCP
15548if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15549	val="$define"
15550	echo "Yup, it does."
15551else
15552	val="$undef"
15553	echo "Nope, it doesn't."
15554fi
15555set d_volatile
15556eval $setvar
15557$rm_try
15558
15559: Check basic sizes
15560echo " "
15561$echo "Choosing the C types to be used for Perl's internal types..." >&4
15562
15563case "$use64bitint:$d_quad:$quadtype" in
15564define:define:?*)
15565	ivtype="$quadtype"
15566	uvtype="$uquadtype"
15567	ivsize=8
15568	uvsize=8
15569	;;
15570*)	ivtype="long"
15571	uvtype="unsigned long"
15572	ivsize=$longsize
15573	uvsize=$longsize
15574	;;
15575esac
15576
15577case "$uselongdouble:$d_longdbl" in
15578define:define)
15579	nvtype="long double"
15580	nvsize=$longdblsize
15581	;;
15582*)	nvtype=double
15583	nvsize=$doublesize
15584	;;
15585esac
15586
15587$echo "(IV will be "$ivtype", $ivsize bytes)"
15588$echo "(UV will be "$uvtype", $uvsize bytes)"
15589$echo "(NV will be "$nvtype", $nvsize bytes)"
15590
15591$cat >try.c <<EOCP
15592#$i_inttypes I_INTTYPES
15593#ifdef I_INTTYPES
15594#include <inttypes.h>
15595#endif
15596#include <stdio.h>
15597int main() {
15598#ifdef INT8
15599   int8_t i =  INT8_MAX;
15600  uint8_t u = UINT8_MAX;
15601  printf("int8_t\n");
15602#endif
15603#ifdef INT16
15604   int16_t i =  INT16_MAX;
15605  uint16_t i = UINT16_MAX;
15606  printf("int16_t\n");
15607#endif
15608#ifdef INT32
15609   int32_t i =  INT32_MAX;
15610  uint32_t u = UINT32_MAX;
15611  printf("int32_t\n");
15612#endif
15613}
15614EOCP
15615
15616i8type="signed char"
15617u8type="unsigned char"
15618i8size=1
15619u8size=1
15620
15621case "$i16type" in
15622'')	case "$shortsize" in
15623	2)	i16type=short
15624		u16type="unsigned short"
15625		i16size=$shortsize
15626		u16size=$shortsize
15627		;;
15628	esac
15629	;;
15630esac
15631case "$i16type" in
15632'')	set try -DINT16
15633	if eval $compile; then
15634		case "`$run ./try`" in
15635		int16_t)
15636			i16type=int16_t
15637			u16type=uint16_t
15638			i16size=2
15639			u16size=2
15640			;;
15641		esac
15642	fi
15643	;;
15644esac
15645case "$i16type" in
15646'')	if $test $shortsize -ge 2; then
15647		i16type=short
15648		u16type="unsigned short"
15649		i16size=$shortsize
15650		u16size=$shortsize
15651	fi
15652	;;
15653esac
15654
15655case "$i32type" in
15656'')	case "$longsize" in
15657	4)	i32type=long
15658		u32type="unsigned long"
15659		i32size=$longsize
15660		u32size=$longsize
15661		;;
15662	*)	case "$intsize" in
15663		4)	i32type=int
15664			u32type="unsigned int"
15665			i32size=$intsize
15666			u32size=$intsize
15667			;;
15668		esac
15669		;;
15670	esac
15671	;;
15672esac
15673case "$i32type" in
15674'')	set try -DINT32
15675	if eval $compile; then
15676		case "`$run ./try`" in
15677		int32_t)
15678			i32type=int32_t
15679			u32type=uint32_t
15680			i32size=4
15681			u32size=4
15682			;;
15683		esac
15684	fi
15685	;;
15686esac
15687case "$i32type" in
15688'')	if $test $intsize -ge 4; then
15689		i32type=int
15690		u32type="unsigned int"
15691		i32size=$intsize
15692		u32size=$intsize
15693	fi
15694	;;
15695esac
15696
15697case "$i64type" in
15698'')	case "$d_quad:$quadtype" in
15699	define:?*)
15700		i64type="$quadtype"
15701		u64type="$uquadtype"
15702		i64size=8
15703		u64size=8
15704		;;
15705	esac
15706	;;
15707esac
15708
15709$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15710: volatile so that the compiler has to store it out to memory.
15711if test X"$d_volatile" = X"$define"; then
15712	volatile=volatile
15713fi
15714$cat <<EOP >try.c
15715#include <stdio.h>
15716#$i_stdlib I_STDLIB
15717#ifdef I_STDLIB
15718#include <stdlib.h>
15719#endif
15720#include <sys/types.h>
15721#include <signal.h>
15722#ifdef SIGFPE
15723$volatile int bletched = 0;
15724$signal_t blech(int s) { bletched = 1; }
15725#endif
15726int main() {
15727    $uvtype u = 0;
15728    $nvtype d;
15729    int     n = 8 * $uvsize;
15730    int     i;
15731#ifdef SIGFPE
15732    signal(SIGFPE, blech);
15733#endif
15734
15735    for (i = 0; i < n; i++) {
15736      u = u << 1 | ($uvtype)1;
15737      d = ($nvtype)u;
15738      if (($uvtype)d != u)
15739        break;
15740      if (d <= 0)
15741	break;
15742      d = ($nvtype)(u - 1);
15743      if (($uvtype)d != (u - 1))
15744        break;
15745#ifdef SIGFPE
15746      if (bletched)
15747	break;
15748#endif
15749    }
15750    printf("%d\n", ((i == n) ? -n : i));
15751    exit(0);
15752}
15753EOP
15754set try
15755
15756d_nv_preserves_uv="$undef"
15757if eval $compile; then
15758	nv_preserves_uv_bits="`$run ./try`"
15759fi
15760case "$nv_preserves_uv_bits" in
15761\-[1-9]*)
15762	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15763	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15764	d_nv_preserves_uv="$define"
15765	;;
15766[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15767	d_nv_preserves_uv="$undef" ;;
15768*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
15769	nv_preserves_uv_bits="0" ;;
15770esac
15771$rm_try
15772
15773$echo "Checking to find the largest integer value your NVs can hold..." >&4
15774: volatile so that the compiler has to store it out to memory.
15775if test X"$d_volatile" = X"$define"; then
15776	volatile=volatile
15777fi
15778$cat <<EOP >try.c
15779#include <stdio.h>
15780
15781typedef $nvtype NV;
15782
15783int
15784main() {
15785  NV value = 2;
15786  int count = 1;
15787
15788  while(count < 256) {
15789    $volatile NV up = value + 1.0;
15790    $volatile NV negated = -value;
15791    $volatile NV down = negated - 1.0;
15792    $volatile NV got_up = up - value;
15793    int up_good = got_up == 1.0;
15794    int got_down = down - negated;
15795    int down_good = got_down == -1.0;
15796
15797    if (down_good != up_good) {
15798      fprintf(stderr,
15799	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15800	      up_good, (double) got_up, down_good, (double) got_down,
15801	      count, (double) value);
15802      return 1;
15803    }
15804    if (!up_good) {
15805      while (1) {
15806	if (count > 8) {
15807	  count -= 8;
15808	  fputs("256.0", stdout);
15809	} else {
15810	  count--;
15811	  fputs("2.0", stdout);
15812	}
15813	if (!count) {
15814	  puts("");
15815	  return 0;
15816	}
15817	fputs("*", stdout);
15818      }
15819    }
15820    value *= 2;
15821    ++count;
15822  }
15823  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15824	  count, (double) value);
15825  return 1;
15826}
15827EOP
15828set try
15829
15830nv_overflows_integers_at='0'
15831if eval $compile; then
15832    xxx="`$run ./try`"
15833    case "$?" in
15834	0)
15835	    case "$xxx" in
15836		2*)  cat >&4 <<EOM
15837The largest integer your NVs can preserve is equal to $xxx
15838EOM
15839		    nv_overflows_integers_at="$xxx"
15840		    ;;
15841		*)  cat >&4 <<EOM
15842Cannot determine the largest integer value your NVs can hold, unexpected output
15843'$xxx'
15844EOM
15845		    ;;
15846	    esac
15847	    ;;
15848	*)  cat >&4 <<EOM
15849Cannot determine the largest integer value your NVs can hold
15850EOM
15851	    ;;
15852    esac
15853fi
15854$rm_try
15855
15856$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15857: volatile so that the compiler has to store it out to memory.
15858if test X"$d_volatile" = X"$define"; then
15859	volatile=volatile
15860fi
15861$cat <<EOP >try.c
15862#include <stdio.h>
15863#$i_stdlib I_STDLIB
15864#ifdef I_STDLIB
15865#include <stdlib.h>
15866#endif
15867#$i_string I_STRING
15868#ifdef I_STRING
15869#  include <string.h>
15870#else
15871#  include <strings.h>
15872#endif
15873#include <sys/types.h>
15874#include <signal.h>
15875#ifdef SIGFPE
15876$volatile int bletched = 0;
15877$signal_t blech(int s) { bletched = 1; }
15878#endif
15879
15880int checkit($nvtype d, char *where) {
15881    unsigned char *p = (char *)&d;
15882    unsigned char *end = p + sizeof(d);
15883    int fail = 0;
15884
15885    while (p < end)
15886	fail += *p++;
15887
15888    if (!fail)
15889	return 0;
15890
15891    p = (char *)&d;
15892    printf("No - %s: 0x", where);
15893    while (p < end)
15894	printf ("%02X", *p++);
15895    printf("\n");
15896    return 1;
15897}
15898
15899int main(int argc, char **argv) {
15900    $nvtype d = 0.0;
15901    int fail = 0;
15902    fail += checkit(d, "0.0");
15903
15904    /* The compiler shouldn't be assuming that bletched is 0  */
15905    d = bletched;
15906
15907    fail += checkit(d, "bleched");
15908
15909#ifdef SIGFPE
15910    signal(SIGFPE, blech);
15911#endif
15912
15913    /* Paranoia - the compiler should have no way of knowing that ANSI says
15914       that argv[argc] will always be NULL.  Actually, if it did assume this it
15915       would be buggy, as this is C and main() can be called from elsewhere in
15916       the program.  */
15917    d = argv[argc] ? 1 : 0;
15918
15919    if (d) {
15920	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15921    }
15922
15923    fail += checkit(d, "ternary");
15924
15925    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15926
15927    if (d != 0.0) {
15928	printf("No - memset doesn't give 0.0\n");
15929	/* This might just blow up:  */
15930	printf("(gives %g)\n", d);
15931	return 1;
15932    }
15933
15934#ifdef SIGFPE
15935    if (bletched) {
15936	printf("No - something bleched\n");
15937	return 1;
15938    }
15939#endif
15940    if (fail) {
15941      printf("No - %d fail(s)\n", fail);
15942      return 1;
15943    }
15944    printf("Yes\n");
15945    return 0;
15946}
15947EOP
15948set try
15949
15950d_nv_zero_is_allbits_zero="$undef"
15951if eval $compile; then
15952    xxx="`$run ./try`"
15953    case "$?" in
15954	0)
15955	    case "$xxx" in
15956		Yes)  cat >&4 <<EOM
159570.0 is represented as all bits zero in memory
15958EOM
15959		    d_nv_zero_is_allbits_zero="$define"
15960		    ;;
15961		*)  cat >&4 <<EOM
159620.0 is not represented as all bits zero in memory
15963EOM
15964		    d_nv_zero_is_allbits_zero="$undef"
15965		    ;;
15966	    esac
15967	    ;;
15968	*)  cat >&4 <<EOM
159690.0 is not represented as all bits zero in memory
15970EOM
15971	    d_nv_zero_is_allbits_zero="$undef"
15972	    ;;
15973    esac
15974fi
15975$rm_try
15976
15977: check for off64_t
15978echo " "
15979echo "Checking to see if you have off64_t..." >&4
15980$cat >try.c <<EOCP
15981#include <sys/types.h>
15982#include <unistd.h>
15983int main() { off64_t x = 7; }
15984EOCP
15985set try
15986if eval $compile; then
15987	val="$define"
15988	echo "You have off64_t."
15989else
15990	val="$undef"
15991	echo "You do not have off64_t."
15992	case "$lseeksize" in
15993	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15994	esac
15995fi
15996$rm_try
15997set d_off64_t
15998eval $setvar
15999
16000: how to create joinable pthreads
16001if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16002	echo " "
16003	echo "Checking what constant to use for creating joinable pthreads..." >&4
16004	$cat >try.c <<'EOCP'
16005#include <pthread.h>
16006int main() {
16007    int detachstate = JOINABLE;
16008}
16009EOCP
16010	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16011	if eval $compile; then
16012		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16013		val="$undef" # Yes, undef.
16014		set d_old_pthread_create_joinable
16015		eval $setvar
16016		val=""
16017		set old_pthread_create_joinable
16018		eval $setvar
16019	else
16020		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16021		if eval $compile; then
16022			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16023			val="$define"
16024			set d_old_pthread_create_joinable
16025			eval $setvar
16026			val=PTHREAD_CREATE_UNDETACHED
16027			set old_pthread_create_joinable
16028			eval $setvar
16029		else
16030			set try -DJOINABLE=__UNDETACHED
16031			if eval $compile; then
16032				echo "You seem to use __UNDETACHED." >&4
16033				val="$define"
16034				set d_old_pthread_create_joinable
16035				eval $setvar
16036				val=__UNDETACHED
16037				set old_pthread_create_joinable
16038				eval $setvar
16039			else
16040				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16041				val="$define"
16042				set d_old_pthread_create_joinable
16043				eval $setvar
16044				val=0
16045				set old_pthread_create_joinable
16046				eval $setvar
16047			fi
16048		fi
16049	fi
16050	$rm_try
16051else
16052    d_old_pthread_create_joinable="$undef"
16053    old_pthread_create_joinable=""
16054fi
16055
16056: see if pause exists
16057set pause d_pause
16058eval $inlibc
16059
16060: see if poll exists
16061set poll d_poll
16062eval $inlibc
16063
16064: see if readlink exists
16065set readlink d_readlink
16066eval $inlibc
16067
16068: Check if exe is symlink to abs path of executing program
16069echo " "
16070procselfexe=''
16071val="$undef"
16072case "$d_readlink" in
16073"$define")
16074	if $issymlink /proc/self/exe ; then
16075		$ls -l /proc/self/exe > reflect
16076		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16077			echo "You have Linux-like /proc/self/exe."
16078			procselfexe='"/proc/self/exe"'
16079			val="$define"
16080		fi
16081	fi
16082	if $issymlink /proc/curproc/file ; then
16083		$ls -l /proc/curproc/file > reflect
16084		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16085			echo "You have BSD-like /proc/curproc/file."
16086			procselfexe='"/proc/curproc/file"'
16087			val="$define"
16088		fi
16089	fi
16090	;;
16091esac
16092$rm -f reflect
16093set d_procselfexe
16094eval $setvar
16095
16096: backward compatibility for d_hvfork
16097if test X$d_hvfork != X; then
16098	d_vfork="$d_hvfork"
16099	d_hvfork=''
16100fi
16101: see if there is a vfork
16102val=''
16103set vfork val
16104eval $inlibc
16105
16106d_pseudofork=$undef
16107
16108: Ok, but do we want to use it. vfork is reportedly unreliable in
16109: perl on Solaris 2.x, and probably elsewhere.
16110case "$val" in
16111$define)
16112	echo " "
16113	case "$usevfork" in
16114	false) dflt='n';;
16115	*) dflt='y';;
16116	esac
16117	cat <<'EOM'
16118
16119Perl can only use a vfork() that doesn't suffer from strict
16120restrictions on calling functions or modifying global data in
16121the child.  For example, glibc-2.1 contains such a vfork()
16122that is unsuitable.  If your system provides a proper fork()
16123call, chances are that you do NOT want perl to use vfork().
16124
16125EOM
16126	rp="Do you still want to use vfork()?"
16127	. ./myread
16128	case "$ans" in
16129	y|Y) ;;
16130	*)
16131		echo "Ok, we won't use vfork()."
16132		val="$undef"
16133		;;
16134	esac
16135	;;
16136esac
16137set d_vfork
16138eval $setvar
16139case "$d_vfork" in
16140$define) usevfork='true';;
16141*) usevfork='false';;
16142esac
16143
16144: see whether the pthread_atfork exists
16145$cat >try.c <<EOP
16146#include <pthread.h>
16147#include <stdio.h>
16148int main() {
16149#ifdef  PTHREAD_ATFORK
16150        pthread_atfork(NULL,NULL,NULL);
16151#endif
16152}
16153EOP
16154
16155: see if pthread_atfork exists
16156set try -DPTHREAD_ATFORK
16157if eval $compile; then
16158    val="$define"
16159else
16160    val="$undef"
16161fi
16162case "$usethreads" in
16163$define)
16164        case "$val" in
16165        $define) echo 'pthread_atfork found.' >&4        ;;
16166        *)       echo 'pthread_atfork NOT found.' >&4    ;;
16167        esac
16168esac
16169set d_pthread_atfork
16170eval $setvar
16171
16172: see if pthread_attr_setscope exists
16173set pthread_attr_setscope d_pthread_attr_setscope
16174eval $inlibc
16175
16176: see whether the various POSIXish _yields exist
16177$cat >try.c <<EOP
16178#include <pthread.h>
16179#include <stdio.h>
16180int main() {
16181#ifdef SCHED_YIELD
16182	sched_yield();
16183#else
16184#ifdef PTHREAD_YIELD
16185	pthread_yield();
16186#else
16187#ifdef PTHREAD_YIELD_NULL
16188	pthread_yield(NULL);
16189#endif
16190#endif
16191#endif
16192}
16193EOP
16194: see if sched_yield exists
16195set try -DSCHED_YIELD
16196if eval $compile; then
16197    val="$define"
16198    sched_yield='sched_yield()'
16199else
16200    val="$undef"
16201fi
16202case "$usethreads" in
16203$define)
16204	case "$val" in
16205	$define) echo 'sched_yield() found.' >&4	;;
16206	*)	 echo 'sched_yield() NOT found.' >&4	;;
16207	esac
16208esac
16209set d_sched_yield
16210eval $setvar
16211
16212: see if pthread_yield exists
16213set try -DPTHREAD_YIELD
16214if eval $compile; then
16215    val="$define"
16216    case "$sched_yield" in
16217    '') sched_yield='pthread_yield()' ;;
16218    esac
16219else
16220    set try -DPTHREAD_YIELD_NULL
16221    if eval $compile; then
16222	val="$define"
16223	case "$sched_yield" in
16224	'') sched_yield='pthread_yield(NULL)' ;;
16225	esac
16226    else
16227	val="$undef"
16228    fi
16229fi
16230case "$usethreads" in
16231$define)
16232	case "$val" in
16233	$define) echo 'pthread_yield() found.' >&4	;;
16234	*)	 echo 'pthread_yield() NOT found.' >&4	;;
16235	esac
16236	;;
16237esac
16238set d_pthread_yield
16239eval $setvar
16240case "$sched_yield" in
16241'') sched_yield=undef ;;
16242esac
16243$rm_try
16244
16245: see if random_r exists
16246set random_r d_random_r
16247eval $inlibc
16248case "$d_random_r" in
16249"$define")
16250	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16251	case "$d_random_r_proto:$usethreads" in
16252	":define")	d_random_r_proto=define
16253		set d_random_r_proto random_r $hdrs
16254		eval $hasproto ;;
16255	*)	;;
16256	esac
16257	case "$d_random_r_proto" in
16258	define)
16259	case "$random_r_proto" in
16260	''|0) try='int random_r(int*, struct random_data*);'
16261	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16262	esac
16263	case "$random_r_proto" in
16264	''|0) try='int random_r(long*, struct random_data*);'
16265	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16266	esac
16267	case "$random_r_proto" in
16268	''|0) try='int random_r(struct random_data*, int32_t*);'
16269	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16270	esac
16271	case "$random_r_proto" in
16272	''|0)	d_random_r=undef
16273 	        random_r_proto=0
16274		echo "Disabling random_r, cannot determine prototype." >&4 ;;
16275	* )	case "$random_r_proto" in
16276		REENTRANT_PROTO*) ;;
16277		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16278		esac
16279		echo "Prototype: $try" ;;
16280	esac
16281	;;
16282	*)	case "$usethreads" in
16283		define) echo "random_r has no prototype, not using it." >&4 ;;
16284		esac
16285		d_random_r=undef
16286		random_r_proto=0
16287		;;
16288	esac
16289	;;
16290*)	random_r_proto=0
16291	;;
16292esac
16293
16294: see if readdir and friends exist
16295set readdir d_readdir
16296eval $inlibc
16297set seekdir d_seekdir
16298eval $inlibc
16299set telldir d_telldir
16300eval $inlibc
16301set rewinddir d_rewinddir
16302eval $inlibc
16303
16304: see if readdir64_r exists
16305set readdir64_r d_readdir64_r
16306eval $inlibc
16307case "$d_readdir64_r" in
16308"$define")
16309	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16310	case "$d_readdir64_r_proto:$usethreads" in
16311	":define")	d_readdir64_r_proto=define
16312		set d_readdir64_r_proto readdir64_r $hdrs
16313		eval $hasproto ;;
16314	*)	;;
16315	esac
16316	case "$d_readdir64_r_proto" in
16317	define)
16318	case "$readdir64_r_proto" in
16319	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16320	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16321	esac
16322	case "$readdir64_r_proto" in
16323	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16324	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16325	esac
16326	case "$readdir64_r_proto" in
16327	''|0)	d_readdir64_r=undef
16328 	        readdir64_r_proto=0
16329		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16330	* )	case "$readdir64_r_proto" in
16331		REENTRANT_PROTO*) ;;
16332		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16333		esac
16334		echo "Prototype: $try" ;;
16335	esac
16336	;;
16337	*)	case "$usethreads" in
16338		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16339		esac
16340		d_readdir64_r=undef
16341		readdir64_r_proto=0
16342		;;
16343	esac
16344	;;
16345*)	readdir64_r_proto=0
16346	;;
16347esac
16348
16349: see if readdir_r exists
16350set readdir_r d_readdir_r
16351eval $inlibc
16352case "$d_readdir_r" in
16353"$define")
16354	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16355	case "$d_readdir_r_proto:$usethreads" in
16356	":define")	d_readdir_r_proto=define
16357		set d_readdir_r_proto readdir_r $hdrs
16358		eval $hasproto ;;
16359	*)	;;
16360	esac
16361	case "$d_readdir_r_proto" in
16362	define)
16363	case "$readdir_r_proto" in
16364	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16365	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16366	esac
16367	case "$readdir_r_proto" in
16368	''|0) try='int readdir_r(DIR*, struct dirent*);'
16369	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16370	esac
16371	case "$readdir_r_proto" in
16372	''|0)	d_readdir_r=undef
16373 	        readdir_r_proto=0
16374		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16375	* )	case "$readdir_r_proto" in
16376		REENTRANT_PROTO*) ;;
16377		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16378		esac
16379		echo "Prototype: $try" ;;
16380	esac
16381	;;
16382	*)	case "$usethreads" in
16383		define) echo "readdir_r has no prototype, not using it." >&4 ;;
16384		esac
16385		d_readdir_r=undef
16386		readdir_r_proto=0
16387		;;
16388	esac
16389	;;
16390*)	readdir_r_proto=0
16391	;;
16392esac
16393
16394: see if readv exists
16395set readv d_readv
16396eval $inlibc
16397
16398: see if recvmsg exists
16399set recvmsg d_recvmsg
16400eval $inlibc
16401
16402: see if rename exists
16403set rename d_rename
16404eval $inlibc
16405
16406: see if rmdir exists
16407set rmdir d_rmdir
16408eval $inlibc
16409
16410: see if memory.h is available.
16411val=''
16412set memory.h val
16413eval $inhdr
16414
16415: See if it conflicts with string.h
16416case "$val" in
16417$define)
16418	case "$strings" in
16419	'') ;;
16420	*)
16421		$cppstdin $cppflags $cppminus < $strings > mem.h
16422		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16423			echo " "
16424			echo "We won't be including <memory.h>."
16425			val="$undef"
16426		fi
16427		$rm -f mem.h
16428		;;
16429	esac
16430esac
16431set i_memory
16432eval $setvar
16433
16434: can bcopy handle overlapping blocks?
16435echo " "
16436val="$undef"
16437case "$d_memmove" in
16438"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16439*)	case "$d_bcopy" in
16440	"$define")
16441		echo "Checking to see if bcopy() can do overlapping copies..." >&4
16442		$cat >try.c <<EOCP
16443#$i_memory I_MEMORY
16444#$i_stdlib I_STDLIB
16445#$i_string I_STRING
16446#$i_unistd I_UNISTD
16447EOCP
16448	$cat >>try.c <<'EOCP'
16449#include <stdio.h>
16450#ifdef I_MEMORY
16451#  include <memory.h>
16452#endif
16453#ifdef I_STDLIB
16454#  include <stdlib.h>
16455#endif
16456#ifdef I_STRING
16457#  include <string.h>
16458#else
16459#  include <strings.h>
16460#endif
16461#ifdef I_UNISTD
16462#  include <unistd.h>  /* Needed for NetBSD */
16463#endif
16464int main()
16465{
16466char buf[128], abc[128];
16467char *b;
16468int len;
16469int off;
16470int align;
16471
16472/* Copy "abcde..." string to char abc[] so that gcc doesn't
16473   try to store the string in read-only memory. */
16474bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16475
16476for (align = 7; align >= 0; align--) {
16477	for (len = 36; len; len--) {
16478		b = buf+align;
16479		bcopy(abc, b, len);
16480		for (off = 1; off <= len; off++) {
16481			bcopy(b, b+off, len);
16482			bcopy(b+off, b, len);
16483			if (bcmp(b, abc, len))
16484				exit(1);
16485		}
16486	}
16487}
16488exit(0);
16489}
16490EOCP
16491		set try
16492		if eval $compile_ok; then
16493			if $run ./try 2>/dev/null; then
16494				echo "Yes, it can."
16495				val="$define"
16496			else
16497				echo "It can't, sorry."
16498			fi
16499		else
16500			echo "(I can't compile the test program, so we'll assume not...)"
16501		fi
16502		;;
16503	esac
16504	$rm_try
16505	;;
16506esac
16507set d_safebcpy
16508eval $setvar
16509
16510: can memcpy handle overlapping blocks?
16511echo " "
16512val="$undef"
16513case "$d_memmove" in
16514"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16515*)	case "$d_memcpy" in
16516	"$define")
16517		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16518		$cat >try.c <<EOCP
16519#$i_memory I_MEMORY
16520#$i_stdlib I_STDLIB
16521#$i_string I_STRING
16522#$i_unistd I_UNISTD
16523EOCP
16524	$cat >>try.c <<'EOCP'
16525#include <stdio.h>
16526#ifdef I_MEMORY
16527#  include <memory.h>
16528#endif
16529#ifdef I_STDLIB
16530#  include <stdlib.h>
16531#endif
16532#ifdef I_STRING
16533#  include <string.h>
16534#else
16535#  include <strings.h>
16536#endif
16537#ifdef I_UNISTD
16538#  include <unistd.h>  /* Needed for NetBSD */
16539#endif
16540int main()
16541{
16542char buf[128], abc[128];
16543char *b;
16544int len;
16545int off;
16546int align;
16547
16548/* Copy "abcde..." string to char abc[] so that gcc doesn't
16549   try to store the string in read-only memory. */
16550memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16551
16552for (align = 7; align >= 0; align--) {
16553	for (len = 36; len; len--) {
16554		b = buf+align;
16555		memcpy(b, abc, len);
16556		for (off = 1; off <= len; off++) {
16557			memcpy(b+off, b, len);
16558			memcpy(b, b+off, len);
16559			if (memcmp(b, abc, len))
16560				exit(1);
16561		}
16562	}
16563}
16564exit(0);
16565}
16566EOCP
16567		set try
16568		if eval $compile_ok; then
16569			if $run ./try 2>/dev/null; then
16570				echo "Yes, it can."
16571				val="$define"
16572			else
16573				echo "It can't, sorry."
16574			fi
16575		else
16576			echo "(I can't compile the test program, so we'll assume not...)"
16577		fi
16578		;;
16579	esac
16580	$rm_try
16581	;;
16582esac
16583set d_safemcpy
16584eval $setvar
16585
16586: can memcmp be trusted to compare relative magnitude?
16587val="$undef"
16588case "$d_memcmp" in
16589"$define")
16590	echo " "
16591	echo "Checking if your memcmp() can compare relative magnitude..." >&4
16592	$cat >try.c <<EOCP
16593#$i_memory I_MEMORY
16594#$i_stdlib I_STDLIB
16595#$i_string I_STRING
16596#$i_unistd I_UNISTD
16597EOCP
16598	$cat >>try.c <<'EOCP'
16599#include <stdio.h>
16600#ifdef I_MEMORY
16601#  include <memory.h>
16602#endif
16603#ifdef I_STDLIB
16604#  include <stdlib.h>
16605#endif
16606#ifdef I_STRING
16607#  include <string.h>
16608#else
16609#  include <strings.h>
16610#endif
16611#ifdef I_UNISTD
16612#  include <unistd.h>  /* Needed for NetBSD */
16613#endif
16614int main()
16615{
16616char a = -1;
16617char b = 0;
16618if ((a < b) && memcmp(&a, &b, 1) < 0)
16619	exit(1);
16620exit(0);
16621}
16622EOCP
16623	set try
16624	if eval $compile_ok; then
16625		if $run ./try 2>/dev/null; then
16626			echo "Yes, it can."
16627			val="$define"
16628		else
16629			echo "No, it can't (it uses signed chars)."
16630		fi
16631	else
16632		echo "(I can't compile the test program, so we'll assume not...)"
16633	fi
16634	;;
16635esac
16636$rm_try
16637set d_sanemcmp
16638eval $setvar
16639
16640: see if prototype for sbrk is available
16641echo " "
16642set d_sbrkproto sbrk $i_unistd unistd.h
16643eval $hasproto
16644
16645: see if select exists
16646set select d_select
16647eval $inlibc
16648
16649: see if semctl exists
16650set semctl d_semctl
16651eval $inlibc
16652
16653: see if semget exists
16654set semget d_semget
16655eval $inlibc
16656
16657: see if semop exists
16658set semop d_semop
16659eval $inlibc
16660
16661: see how much of the 'sem*(2)' library is present.
16662h_sem=true
16663echo " "
16664case "$d_semctl$d_semget$d_semop" in
16665*"$undef"*) h_sem=false;;
16666esac
16667case "$osname" in
16668freebsd)
16669    case "`ipcs 2>&1`" in
16670    "SVID messages"*"not configured"*)
16671	echo "Your $osname does not have the sem*(2) configured." >&4
16672        h_sem=false
16673	val="$undef"
16674	set semctl d_semctl
16675	eval $setvar
16676	set semget d_semget
16677	eval $setvar
16678	set semop d_semop
16679	eval $setvar
16680	;;
16681    esac
16682    ;;
16683esac
16684: we could also check for sys/ipc.h ...
16685if $h_sem && $test `./findhdr sys/sem.h`; then
16686	echo "You have the full sem*(2) library." >&4
16687	val="$define"
16688else
16689	echo "You don't have the full sem*(2) library." >&4
16690	val="$undef"
16691fi
16692set d_sem
16693eval $setvar
16694
16695: see whether sys/sem.h defines union semun
16696echo " "
16697$cat > try.c <<'END'
16698#include <sys/types.h>
16699#include <sys/ipc.h>
16700#include <sys/sem.h>
16701int main () { union semun semun; semun.buf = 0; }
16702END
16703set try
16704if eval $compile; then
16705    echo "You have union semun in <sys/sem.h>." >&4
16706    val="$define"
16707else
16708    echo "You do not have union semun in <sys/sem.h>." >&4
16709    val="$undef"
16710fi
16711$rm_try
16712set d_union_semun
16713eval $setvar
16714
16715: see how to do semctl IPC_STAT
16716case "$d_sem" in
16717$define)
16718    echo " "
16719    $cat > tryh.h <<END
16720#ifndef S_IRUSR
16721#   ifdef S_IREAD
16722#	define S_IRUSR S_IREAD
16723#	define S_IWUSR S_IWRITE
16724#	define S_IXUSR S_IEXEC
16725#   else
16726#	define S_IRUSR 0400
16727#	define S_IWUSR 0200
16728#	define S_IXUSR 0100
16729#   endif
16730#   define S_IRGRP (S_IRUSR>>3)
16731#   define S_IWGRP (S_IWUSR>>3)
16732#   define S_IXGRP (S_IXUSR>>3)
16733#   define S_IROTH (S_IRUSR>>6)
16734#   define S_IWOTH (S_IWUSR>>6)
16735#   define S_IXOTH (S_IXUSR>>6)
16736#endif
16737#ifndef S_IRWXU
16738#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16739#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16740#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16741#endif
16742END
16743    : see whether semctl IPC_STAT can use union semun
16744    case "$d_semctl_semun" in
16745    '')
16746      val="$undef"
16747      $cat > try.c <<END
16748#include <sys/types.h>
16749#include <sys/ipc.h>
16750#include <sys/sem.h>
16751#include <sys/stat.h>
16752#include <stdio.h>
16753#include <errno.h>
16754#include "tryh.h"
16755#ifndef errno
16756extern int errno;
16757#endif
16758#$d_union_semun HAS_UNION_SEMUN
16759int main() {
16760    union semun
16761#ifndef HAS_UNION_SEMUN
16762    {
16763	int val;
16764	struct semid_ds *buf;
16765	unsigned short *array;
16766    }
16767#endif
16768    arg;
16769    int sem, st;
16770
16771#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16772    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16773    if (sem > -1) {
16774	struct semid_ds argbuf;
16775	arg.buf = &argbuf;
16776#	ifdef IPC_STAT
16777	st = semctl(sem, 0, IPC_STAT, arg);
16778	if (st == 0)
16779	    printf("semun\n");
16780	else
16781#	endif /* IPC_STAT */
16782	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16783#	ifdef IPC_RMID
16784	if (semctl(sem, 0, IPC_RMID, arg) != 0)
16785#	endif /* IPC_RMID */
16786	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16787    } else
16788#endif /* IPC_PRIVATE && ... */
16789	printf("semget failed: errno = %d\n", errno);
16790  return 0;
16791}
16792END
16793      set try
16794      if eval $compile; then
16795	  xxx=`$run ./try`
16796          case "$xxx" in
16797          semun) val="$define" ;;
16798          esac
16799      fi
16800      $rm_try
16801      set d_semctl_semun
16802      eval $setvar
16803      ;;
16804    esac
16805    case "$d_semctl_semun" in
16806    $define)
16807        echo "You can use union semun for semctl IPC_STAT." >&4
16808	also='also'
16809        ;;
16810    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16811	also=''
16812        ;;
16813    esac
16814
16815    : see whether semctl IPC_STAT can use struct semid_ds pointer
16816    case "$d_semctl_semid_ds" in
16817    '')
16818      val="$undef"
16819      $cat > try.c <<'END'
16820#include <sys/types.h>
16821#include <sys/ipc.h>
16822#include <sys/sem.h>
16823#include <sys/stat.h>
16824#include "tryh.h"
16825#include <stdio.h>
16826#include <errno.h>
16827#ifndef errno
16828extern int errno;
16829#endif
16830int main() {
16831    struct semid_ds arg;
16832    int sem, st;
16833
16834#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16835    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16836    if (sem > -1) {
16837#	ifdef IPC_STAT
16838	st = semctl(sem, 0, IPC_STAT, &arg);
16839	if (st == 0)
16840	    printf("semid_ds\n");
16841	else
16842#	endif /* IPC_STAT */
16843	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16844#	ifdef IPC_RMID
16845	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16846#	endif /* IPC_RMID */
16847	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16848    } else
16849#endif /* IPC_PRIVATE && ... */
16850	printf("semget failed: errno = %d\n", errno);
16851
16852    return 0;
16853}
16854END
16855      set try
16856      if eval $compile; then
16857          xxx=`$run ./try`
16858          case "$xxx" in
16859          semid_ds) val="$define" ;;
16860          esac
16861      fi
16862      $rm_try
16863      set d_semctl_semid_ds
16864      eval $setvar
16865      ;;
16866    esac
16867    case "$d_semctl_semid_ds" in
16868    $define)
16869        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16870        ;;
16871    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16872        ;;
16873    esac
16874    ;;
16875*)  val="$undef"
16876
16877    # We do not have the full sem*(2) library, so assume we can not
16878    # use either.
16879
16880    set d_semctl_semun
16881    eval $setvar
16882
16883    set d_semctl_semid_ds
16884    eval $setvar
16885    ;;
16886esac
16887$rm_try tryh.h
16888
16889: see if sendmsg exists
16890set sendmsg d_sendmsg
16891eval $inlibc
16892
16893: see if setegid exists
16894set setegid d_setegid
16895eval $inlibc
16896
16897: see if seteuid exists
16898set seteuid d_seteuid
16899eval $inlibc
16900
16901: see if setgrent exists
16902set setgrent d_setgrent
16903eval $inlibc
16904
16905: see if setgrent_r exists
16906set setgrent_r d_setgrent_r
16907eval $inlibc
16908case "$d_setgrent_r" in
16909"$define")
16910	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16911	case "$d_setgrent_r_proto:$usethreads" in
16912	":define")	d_setgrent_r_proto=define
16913		set d_setgrent_r_proto setgrent_r $hdrs
16914		eval $hasproto ;;
16915	*)	;;
16916	esac
16917	case "$d_setgrent_r_proto" in
16918	define)
16919	case "$setgrent_r_proto" in
16920	''|0) try='int setgrent_r(FILE**);'
16921	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16922	esac
16923	case "$setgrent_r_proto" in
16924	''|0) try='void setgrent_r(FILE**);'
16925	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16926	esac
16927	case "$setgrent_r_proto" in
16928	''|0)	d_setgrent_r=undef
16929 	        setgrent_r_proto=0
16930		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16931	* )	case "$setgrent_r_proto" in
16932		REENTRANT_PROTO*) ;;
16933		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16934		esac
16935		echo "Prototype: $try" ;;
16936	esac
16937	;;
16938	*)	case "$usethreads" in
16939		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16940		esac
16941		d_setgrent_r=undef
16942		setgrent_r_proto=0
16943		;;
16944	esac
16945	;;
16946*)	setgrent_r_proto=0
16947	;;
16948esac
16949
16950: see if sethostent exists
16951set sethostent d_sethent
16952eval $inlibc
16953
16954: see if sethostent_r exists
16955set sethostent_r d_sethostent_r
16956eval $inlibc
16957case "$d_sethostent_r" in
16958"$define")
16959	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16960	case "$d_sethostent_r_proto:$usethreads" in
16961	":define")	d_sethostent_r_proto=define
16962		set d_sethostent_r_proto sethostent_r $hdrs
16963		eval $hasproto ;;
16964	*)	;;
16965	esac
16966	case "$d_sethostent_r_proto" in
16967	define)
16968	case "$sethostent_r_proto" in
16969	''|0) try='int sethostent_r(int, struct hostent_data*);'
16970	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16971	esac
16972	case "$sethostent_r_proto" in
16973	''|0) try='void sethostent_r(int, struct hostent_data*);'
16974	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16975	esac
16976	case "$sethostent_r_proto" in
16977	''|0)	d_sethostent_r=undef
16978 	        sethostent_r_proto=0
16979		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16980	* )	case "$sethostent_r_proto" in
16981		REENTRANT_PROTO*) ;;
16982		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16983		esac
16984		echo "Prototype: $try" ;;
16985	esac
16986	;;
16987	*)	case "$usethreads" in
16988		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16989		esac
16990		d_sethostent_r=undef
16991		sethostent_r_proto=0
16992		;;
16993	esac
16994	;;
16995*)	sethostent_r_proto=0
16996	;;
16997esac
16998
16999: see if setitimer exists
17000set setitimer d_setitimer
17001eval $inlibc
17002
17003: see if setlinebuf exists
17004set setlinebuf d_setlinebuf
17005eval $inlibc
17006
17007: see if setlocale exists
17008set setlocale d_setlocale
17009eval $inlibc
17010
17011: see if locale.h is available
17012set locale.h i_locale
17013eval $inhdr
17014
17015: see if setlocale_r exists
17016set setlocale_r d_setlocale_r
17017eval $inlibc
17018case "$d_setlocale_r" in
17019"$define")
17020	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17021	case "$d_setlocale_r_proto:$usethreads" in
17022	":define")	d_setlocale_r_proto=define
17023		set d_setlocale_r_proto setlocale_r $hdrs
17024		eval $hasproto ;;
17025	*)	;;
17026	esac
17027	case "$d_setlocale_r_proto" in
17028	define)
17029	case "$setlocale_r_proto" in
17030	''|0) try='int setlocale_r(int, const char*, char*, int);'
17031	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17032	esac
17033	case "$setlocale_r_proto" in
17034	''|0)	d_setlocale_r=undef
17035 	        setlocale_r_proto=0
17036		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17037	* )	case "$setlocale_r_proto" in
17038		REENTRANT_PROTO*) ;;
17039		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17040		esac
17041		echo "Prototype: $try" ;;
17042	esac
17043	;;
17044	*)	case "$usethreads" in
17045		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17046		esac
17047		d_setlocale_r=undef
17048		setlocale_r_proto=0
17049		;;
17050	esac
17051	;;
17052*)	setlocale_r_proto=0
17053	;;
17054esac
17055
17056: see if setnetent exists
17057set setnetent d_setnent
17058eval $inlibc
17059
17060: see if setnetent_r exists
17061set setnetent_r d_setnetent_r
17062eval $inlibc
17063case "$d_setnetent_r" in
17064"$define")
17065	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17066	case "$d_setnetent_r_proto:$usethreads" in
17067	":define")	d_setnetent_r_proto=define
17068		set d_setnetent_r_proto setnetent_r $hdrs
17069		eval $hasproto ;;
17070	*)	;;
17071	esac
17072	case "$d_setnetent_r_proto" in
17073	define)
17074	case "$setnetent_r_proto" in
17075	''|0) try='int setnetent_r(int, struct netent_data*);'
17076	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17077	esac
17078	case "$setnetent_r_proto" in
17079	''|0) try='void setnetent_r(int, struct netent_data*);'
17080	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17081	esac
17082	case "$setnetent_r_proto" in
17083	''|0)	d_setnetent_r=undef
17084 	        setnetent_r_proto=0
17085		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17086	* )	case "$setnetent_r_proto" in
17087		REENTRANT_PROTO*) ;;
17088		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17089		esac
17090		echo "Prototype: $try" ;;
17091	esac
17092	;;
17093	*)	case "$usethreads" in
17094		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17095		esac
17096		d_setnetent_r=undef
17097		setnetent_r_proto=0
17098		;;
17099	esac
17100	;;
17101*)	setnetent_r_proto=0
17102	;;
17103esac
17104
17105: see if setprotoent exists
17106set setprotoent d_setpent
17107eval $inlibc
17108
17109: see if setpgid exists
17110set setpgid d_setpgid
17111eval $inlibc
17112
17113: see if setpgrp2 exists
17114set setpgrp2 d_setpgrp2
17115eval $inlibc
17116
17117: see if setpriority exists
17118set setpriority d_setprior
17119eval $inlibc
17120
17121: see if setproctitle exists
17122set setproctitle d_setproctitle
17123eval $inlibc
17124
17125: see if setprotoent_r exists
17126set setprotoent_r d_setprotoent_r
17127eval $inlibc
17128case "$d_setprotoent_r" in
17129"$define")
17130	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17131	case "$d_setprotoent_r_proto:$usethreads" in
17132	":define")	d_setprotoent_r_proto=define
17133		set d_setprotoent_r_proto setprotoent_r $hdrs
17134		eval $hasproto ;;
17135	*)	;;
17136	esac
17137	case "$d_setprotoent_r_proto" in
17138	define)
17139	case "$setprotoent_r_proto" in
17140	''|0) try='int setprotoent_r(int, struct protoent_data*);'
17141	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17142	esac
17143	case "$setprotoent_r_proto" in
17144	''|0) try='void setprotoent_r(int, struct protoent_data*);'
17145	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17146	esac
17147	case "$setprotoent_r_proto" in
17148	''|0)	d_setprotoent_r=undef
17149 	        setprotoent_r_proto=0
17150		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17151	* )	case "$setprotoent_r_proto" in
17152		REENTRANT_PROTO*) ;;
17153		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17154		esac
17155		echo "Prototype: $try" ;;
17156	esac
17157	;;
17158	*)	case "$usethreads" in
17159		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17160		esac
17161		d_setprotoent_r=undef
17162		setprotoent_r_proto=0
17163		;;
17164	esac
17165	;;
17166*)	setprotoent_r_proto=0
17167	;;
17168esac
17169
17170: see if setpwent exists
17171set setpwent d_setpwent
17172eval $inlibc
17173
17174: see if setpwent_r exists
17175set setpwent_r d_setpwent_r
17176eval $inlibc
17177case "$d_setpwent_r" in
17178"$define")
17179	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17180	case "$d_setpwent_r_proto:$usethreads" in
17181	":define")	d_setpwent_r_proto=define
17182		set d_setpwent_r_proto setpwent_r $hdrs
17183		eval $hasproto ;;
17184	*)	;;
17185	esac
17186	case "$d_setpwent_r_proto" in
17187	define)
17188	case "$setpwent_r_proto" in
17189	''|0) try='int setpwent_r(FILE**);'
17190	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17191	esac
17192	case "$setpwent_r_proto" in
17193	''|0) try='void setpwent_r(FILE**);'
17194	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17195	esac
17196	case "$setpwent_r_proto" in
17197	''|0)	d_setpwent_r=undef
17198 	        setpwent_r_proto=0
17199		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17200	* )	case "$setpwent_r_proto" in
17201		REENTRANT_PROTO*) ;;
17202		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17203		esac
17204		echo "Prototype: $try" ;;
17205	esac
17206	;;
17207	*)	case "$usethreads" in
17208		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17209		esac
17210		d_setpwent_r=undef
17211		setpwent_r_proto=0
17212		;;
17213	esac
17214	;;
17215*)	setpwent_r_proto=0
17216	;;
17217esac
17218
17219: see if setregid exists
17220set setregid d_setregid
17221eval $inlibc
17222set setresgid d_setresgid
17223eval $inlibc
17224
17225: see if setreuid exists
17226set setreuid d_setreuid
17227eval $inlibc
17228set setresuid d_setresuid
17229eval $inlibc
17230
17231: see if setrgid exists
17232set setrgid d_setrgid
17233eval $inlibc
17234
17235: see if setruid exists
17236set setruid d_setruid
17237eval $inlibc
17238
17239: see if setservent exists
17240set setservent d_setsent
17241eval $inlibc
17242
17243: see if setservent_r exists
17244set setservent_r d_setservent_r
17245eval $inlibc
17246case "$d_setservent_r" in
17247"$define")
17248	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17249	case "$d_setservent_r_proto:$usethreads" in
17250	":define")	d_setservent_r_proto=define
17251		set d_setservent_r_proto setservent_r $hdrs
17252		eval $hasproto ;;
17253	*)	;;
17254	esac
17255	case "$d_setservent_r_proto" in
17256	define)
17257	case "$setservent_r_proto" in
17258	''|0) try='int setservent_r(int, struct servent_data*);'
17259	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17260	esac
17261	case "$setservent_r_proto" in
17262	''|0) try='void setservent_r(int, struct servent_data*);'
17263	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17264	esac
17265	case "$setservent_r_proto" in
17266	''|0)	d_setservent_r=undef
17267 	        setservent_r_proto=0
17268		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17269	* )	case "$setservent_r_proto" in
17270		REENTRANT_PROTO*) ;;
17271		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17272		esac
17273		echo "Prototype: $try" ;;
17274	esac
17275	;;
17276	*)	case "$usethreads" in
17277		define) echo "setservent_r has no prototype, not using it." >&4 ;;
17278		esac
17279		d_setservent_r=undef
17280		setservent_r_proto=0
17281		;;
17282	esac
17283	;;
17284*)	setservent_r_proto=0
17285	;;
17286esac
17287
17288: see if setsid exists
17289set setsid d_setsid
17290eval $inlibc
17291
17292: see if setvbuf exists
17293set setvbuf d_setvbuf
17294eval $inlibc
17295
17296: see if sfio.h is available
17297set sfio.h i_sfio
17298eval $inhdr
17299
17300: see if sfio library is available
17301case "$i_sfio" in
17302$define)
17303	val=''
17304	set sfreserve val
17305	eval $inlibc
17306	;;
17307*)
17308	val="$undef"
17309	;;
17310esac
17311: Ok, but do we want to use it.
17312case "$val" in
17313$define)
17314	case "$usesfio" in
17315	true|$define|[yY]*) dflt='y';;
17316	*) dflt='n';;
17317	esac
17318	echo "$package can use the sfio library, but it is experimental."
17319	case "$useperlio" in
17320	"$undef")
17321	    echo "For sfio also the PerlIO abstraction layer is needed."
17322	    echo "Earlier you said you wouldn't want that."
17323	    ;;
17324	esac
17325	rp="You seem to have sfio available, do you want to try using it?"
17326	. ./myread
17327	case "$ans" in
17328	y|Y)	echo "Ok, turning on both sfio and PerlIO, then."
17329		useperlio="$define"
17330		val="$define"
17331		;;
17332	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17333		val="$undef"
17334		;;
17335	esac
17336	;;
17337*)	case "$usesfio" in
17338	true|$define|[yY]*)
17339		echo "Sorry, cannot find sfio on this machine." >&4
17340		echo "Ignoring your setting of usesfio=$usesfio." >&4
17341		val="$undef"
17342		;;
17343	esac
17344	;;
17345esac
17346set d_sfio
17347eval $setvar
17348case "$d_sfio" in
17349$define) usesfio='true';;
17350*) usesfio='false';;
17351esac
17352case "$d_sfio" in
17353$define) ;;
17354*)	: Remove sfio from list of libraries to use
17355	case "$libs" in
17356	*-lsfio*)
17357		echo "Removing unneeded -lsfio from library list" >&4
17358		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17359		shift
17360		libs="$*"
17361		echo "libs = $libs" >&4
17362		;;
17363	esac
17364;;
17365esac
17366
17367
17368: see if shmctl exists
17369set shmctl d_shmctl
17370eval $inlibc
17371
17372: see if shmget exists
17373set shmget d_shmget
17374eval $inlibc
17375
17376: see if shmat exists
17377set shmat d_shmat
17378eval $inlibc
17379: see what shmat returns
17380case "$d_shmat" in
17381"$define")
17382	$cat >shmat.c <<'END'
17383#include <sys/shm.h>
17384void *shmat();
17385END
17386	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17387		shmattype='void *'
17388	else
17389		shmattype='char *'
17390	fi
17391	echo "and it returns ($shmattype)." >&4
17392	: see if a prototype for shmat is available
17393	xxx=`./findhdr sys/shm.h`
17394	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17395	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17396		val="$define"
17397	else
17398		val="$undef"
17399	fi
17400	$rm -f shmat.[co]
17401	;;
17402*)
17403	val="$undef"
17404	;;
17405esac
17406set d_shmatprototype
17407eval $setvar
17408
17409: see if shmdt exists
17410set shmdt d_shmdt
17411eval $inlibc
17412
17413: see how much of the 'shm*(2)' library is present.
17414h_shm=true
17415echo " "
17416case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17417*"$undef"*) h_shm=false;;
17418esac
17419case "$osname" in
17420freebsd)
17421    case "`ipcs 2>&1`" in
17422    "SVID shared memory"*"not configured"*)
17423	echo "Your $osname does not have the shm*(2) configured." >&4
17424        h_shm=false
17425	val="$undef"
17426	set shmctl d_shmctl
17427	evat $setvar
17428	set shmget d_shmget
17429	evat $setvar
17430	set shmat d_shmat
17431	evat $setvar
17432	set shmdt d_shmdt
17433	evat $setvar
17434	;;
17435    esac
17436    ;;
17437esac
17438: we could also check for sys/ipc.h ...
17439if $h_shm && $test `./findhdr sys/shm.h`; then
17440	echo "You have the full shm*(2) library." >&4
17441	val="$define"
17442else
17443	echo "You don't have the full shm*(2) library." >&4
17444	val="$undef"
17445fi
17446set d_shm
17447eval $setvar
17448
17449: see if we have sigaction
17450echo " "
17451if set sigaction val -f d_sigaction; eval $csym; $val; then
17452	echo 'sigaction() found.' >&4
17453	$cat > try.c <<EOP
17454#include <stdio.h>
17455#include <sys/types.h>
17456#include <signal.h>
17457#$i_stdlib I_STDLIB
17458#ifdef I_STDLIB
17459#include <stdlib.h>
17460#endif
17461int main()
17462{
17463    struct sigaction act, oact;
17464    act.sa_flags = 0;
17465    oact.sa_handler = 0;
17466    /* so that act and oact are used */
17467    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17468}
17469EOP
17470	set try
17471	if eval $compile_ok; then
17472		val="$define"
17473	else
17474		echo "But you don't seem to have a useable struct sigaction." >&4
17475		val="$undef"
17476	fi
17477else
17478	echo 'sigaction NOT found.' >&4
17479	val="$undef"
17480fi
17481set d_sigaction; eval $setvar
17482$rm_try
17483
17484: see if this is a sunmath.h system
17485set sunmath.h i_sunmath
17486eval $inhdr
17487
17488: see if signbit exists
17489$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17490$cat >try.c <<EOCP
17491#$i_math I_MATH
17492#$i_sunmath I_SUNMATH
17493#ifdef I_MATH
17494#  include <math.h>
17495#endif
17496#ifdef I_SUNMATH  /* Solaris special math library */
17497#  include <sunmath.h>
17498#endif
17499#define NV $nvtype
17500int main(int argc, char **argv)
17501{
17502    NV x = 0.0;
17503    NV y = -0.0;
17504    if ((signbit(x) == 0) && (signbit(y) != 0))
17505	return 0;
17506    else
17507	return 1;
17508}
17509EOCP
17510val="$undef"
17511set try
17512if eval $compile; then
17513    if $run ./try; then
17514        $echo "Yes." >&4
17515	val="$define"
17516    else
17517        $echo "Signbit seems to be available, but doesn't work as I expected."
17518        $echo "I won't use it." >&4
17519	val="$undef"
17520    fi
17521else
17522    $echo "Nope." >&4
17523    dflt="$undef"
17524fi
17525set d_signbit
17526eval $setvar
17527$rm_try
17528
17529: see if sigprocmask exists
17530set sigprocmask d_sigprocmask
17531eval $inlibc
17532
17533: see if sigsetjmp exists
17534echo " "
17535case "$d_sigsetjmp" in
17536'')
17537	$cat >try.c <<EOP
17538#include <setjmp.h>
17539#$i_stdlib I_STDLIB
17540#ifdef I_STDLIB
17541#include <stdlib.h>
17542#endif
17543sigjmp_buf env;
17544int set = 1;
17545int main()
17546{
17547	if (sigsetjmp(env,1))
17548		exit(set);
17549	set = 0;
17550	siglongjmp(env, 1);
17551	exit(1);
17552}
17553EOP
17554	set try
17555	if eval $compile; then
17556		if $run ./try >/dev/null 2>&1; then
17557			echo "POSIX sigsetjmp found." >&4
17558			val="$define"
17559		else
17560			$cat >&4 <<EOM
17561Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17562I'll ignore them.
17563EOM
17564			val="$undef"
17565		fi
17566	else
17567		echo "sigsetjmp not found." >&4
17568		val="$undef"
17569	fi
17570	;;
17571*) val="$d_sigsetjmp"
17572	case "$d_sigsetjmp" in
17573	$define) echo "POSIX sigsetjmp found." >&4;;
17574	$undef) echo "sigsetjmp not found." >&4;;
17575	esac
17576	;;
17577esac
17578set d_sigsetjmp
17579eval $setvar
17580$rm_try
17581
17582: see if snprintf exists
17583set snprintf d_snprintf
17584eval $inlibc
17585
17586: see if vsnprintf exists
17587set vsnprintf d_vsnprintf
17588eval $inlibc
17589
17590case "$d_snprintf-$d_vsnprintf" in
17591"$define-$define")
17592    $cat <<EOM
17593Checking whether your snprintf() and vsnprintf() work okay...
17594EOM
17595    $cat >try.c <<'EOCP'
17596/* v?snprintf testing logic courtesy of Russ Allbery.
17597 * According to C99:
17598 * - if the buffer is too short it still must be \0-terminated
17599 * - if the buffer is too short the potentially required length
17600 *   must be returned and not -1
17601 * - if the buffer is NULL the potentially required length
17602 *   must be returned and not -1 or core dump
17603 */
17604#include <stdio.h>
17605#include <stdarg.h>
17606
17607char buf[2];
17608
17609int test (char *format, ...)
17610{
17611    va_list args;
17612    int count;
17613
17614    va_start (args, format);
17615    count = vsnprintf (buf, sizeof buf, format, args);
17616    va_end (args);
17617    return count;
17618}
17619
17620int main ()
17621{
17622    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17623             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17624}
17625EOCP
17626    set try
17627    if eval $compile; then
17628	`$run ./try`
17629	case "$?" in
17630	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17631	*) cat <<EOM >&4
17632Your snprintf() and snprintf() don't seem to be working okay.
17633EOM
17634	   d_snprintf="$undef"
17635	   d_vsnprintf="$undef"
17636	   ;;
17637	esac
17638    else
17639	echo "(I can't seem to compile the test program--assuming they don't)"
17640	d_snprintf="$undef"
17641	d_vsnprintf="$undef"
17642    fi
17643    $rm_try
17644    ;;
17645esac
17646
17647: see if sockatmark exists
17648set sockatmark d_sockatmark
17649eval $inlibc
17650
17651: see if prototype for sockatmark is available
17652echo " "
17653set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17654eval $hasproto
17655
17656: see if socks5_init exists
17657set socks5_init d_socks5_init
17658eval $inlibc
17659
17660: see if sprintf returns the length of the string in the buffer as per ANSI
17661$echo "Checking whether sprintf returns the length of the string..." >&4
17662$cat <<EOP >try.c
17663#include <stdio.h>
17664#$i_stdlib I_STDLIB
17665#ifdef I_STDLIB
17666#include <stdlib.h>
17667#endif
17668#$i_string I_STRING
17669#ifdef I_STRING
17670#  include <string.h>
17671#else
17672#  include <strings.h>
17673#endif
17674#$i_math I_MATH
17675#ifdef I_MATH
17676#include <math.h>
17677#endif
17678
17679char buffer[256];
17680
17681int check (size_t expect, int test) {
17682  size_t got = strlen(buffer);
17683  if (expect == got)
17684    return 0;
17685
17686  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17687       test, buffer);
17688  exit (test);
17689}
17690
17691int main(int argc, char **argv) {
17692  int test = 0;
17693
17694  check(sprintf(buffer, ""), ++test);
17695  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17696  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17697
17698  return 0;
17699}
17700EOP
17701set try
17702
17703if eval $compile; then
17704    xxx="`$run ./try`"
17705    case "$?" in
17706	0) cat >&4 <<EOM
17707sprintf returns the length of the string (as ANSI says it should)
17708EOM
17709	d_sprintf_returns_strlen="$define"
17710	;;
17711	*) cat >&4 <<EOM
17712sprintf does not return the length of the string (how old is this system?)
17713EOM
17714	d_sprintf_returns_strlen="$undef"
17715        ;;
17716    esac
17717else
17718    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17719    d_sprintf_returns_strlen="$undef"
17720fi
17721$rm_try
17722
17723: see if srand48_r exists
17724set srand48_r d_srand48_r
17725eval $inlibc
17726case "$d_srand48_r" in
17727"$define")
17728	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17729	case "$d_srand48_r_proto:$usethreads" in
17730	":define")	d_srand48_r_proto=define
17731		set d_srand48_r_proto srand48_r $hdrs
17732		eval $hasproto ;;
17733	*)	;;
17734	esac
17735	case "$d_srand48_r_proto" in
17736	define)
17737	case "$srand48_r_proto" in
17738	''|0) try='int srand48_r(long, struct drand48_data*);'
17739	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17740	esac
17741	case "$srand48_r_proto" in
17742	''|0)	d_srand48_r=undef
17743 	        srand48_r_proto=0
17744		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17745	* )	case "$srand48_r_proto" in
17746		REENTRANT_PROTO*) ;;
17747		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17748		esac
17749		echo "Prototype: $try" ;;
17750	esac
17751	;;
17752	*)	case "$usethreads" in
17753		define) echo "srand48_r has no prototype, not using it." >&4 ;;
17754		esac
17755		d_srand48_r=undef
17756		srand48_r_proto=0
17757		;;
17758	esac
17759	;;
17760*)	srand48_r_proto=0
17761	;;
17762esac
17763
17764: see if srandom_r exists
17765set srandom_r d_srandom_r
17766eval $inlibc
17767case "$d_srandom_r" in
17768"$define")
17769	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17770	case "$d_srandom_r_proto:$usethreads" in
17771	":define")	d_srandom_r_proto=define
17772		set d_srandom_r_proto srandom_r $hdrs
17773		eval $hasproto ;;
17774	*)	;;
17775	esac
17776	case "$d_srandom_r_proto" in
17777	define)
17778	case "$srandom_r_proto" in
17779	''|0) try='int srandom_r(unsigned int, struct random_data*);'
17780	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17781	esac
17782	case "$srandom_r_proto" in
17783	''|0)	d_srandom_r=undef
17784 	        srandom_r_proto=0
17785		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17786	* )	case "$srandom_r_proto" in
17787		REENTRANT_PROTO*) ;;
17788		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17789		esac
17790		echo "Prototype: $try" ;;
17791	esac
17792	;;
17793	*)	case "$usethreads" in
17794		define) echo "srandom_r has no prototype, not using it." >&4 ;;
17795		esac
17796		d_srandom_r=undef
17797		srandom_r_proto=0
17798		;;
17799	esac
17800	;;
17801*)	srandom_r_proto=0
17802	;;
17803esac
17804
17805: see if prototype for setresgid is available
17806echo " "
17807set d_sresgproto setresgid $i_unistd unistd.h
17808eval $hasproto
17809
17810: see if prototype for setresuid is available
17811echo " "
17812set d_sresuproto setresuid $i_unistd unistd.h
17813eval $hasproto
17814
17815: see if sys/stat.h is available
17816set sys/stat.h i_sysstat
17817eval $inhdr
17818
17819: see if stat knows about block sizes
17820echo " "
17821echo "Checking to see if your struct stat has st_blocks field..." >&4
17822set d_statblks stat st_blocks $i_sysstat sys/stat.h
17823eval $hasfield
17824
17825: see if this is a sys/vfs.h system
17826set sys/vfs.h i_sysvfs
17827eval $inhdr
17828
17829: see if this is a sys/statfs.h system
17830set sys/statfs.h i_sysstatfs
17831eval $inhdr
17832
17833: Check for statfs_s
17834echo " "
17835echo "Checking to see if your system supports struct statfs..." >&4
17836set 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
17837eval $hasstruct
17838case "$d_statfs_s" in
17839"$define")      echo "Yes, it does."   ;;
17840*)              echo "No, it doesn't." ;;
17841esac
17842
17843
17844: see if struct statfs knows about f_flags
17845case "$d_statfs_s" in
17846define)
17847	echo " "
17848	echo "Checking to see if your struct statfs has f_flags field..." >&4
17849	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
17850	eval $hasfield
17851	;;
17852*)	val="$undef"
17853	set d_statfs_f_flags
17854	eval $setvar
17855	;;
17856esac
17857case "$d_statfs_f_flags" in
17858"$define")      echo "Yes, it does."   ;;
17859*)              echo "No, it doesn't." ;;
17860esac
17861
17862: Check stream access
17863$cat >&4 <<EOM
17864Checking how to access stdio streams by file descriptor number...
17865EOM
17866case "$stdio_stream_array" in
17867'') 	$cat >try.c <<EOCP
17868#include <stdio.h>
17869int main() {
17870  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17871    printf("yes\n");
17872}
17873EOCP
17874	for s in _iob __iob __sF
17875	do
17876	        set try -DSTDIO_STREAM_ARRAY=$s
17877		if eval $compile; then
17878		    	case "`$run ./try`" in
17879			yes)	stdio_stream_array=$s; break ;;
17880			esac
17881		fi
17882	done
17883	$rm_try
17884esac
17885case "$stdio_stream_array" in
17886'')	$cat >&4 <<EOM
17887I can't figure out how to access stdio streams by file descriptor number.
17888EOM
17889	d_stdio_stream_array="$undef"
17890	;;
17891*)	$cat >&4 <<EOM
17892You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17893EOM
17894	d_stdio_stream_array="$define"
17895	;;
17896esac
17897
17898: see if strcoll exists
17899set strcoll d_strcoll
17900eval $inlibc
17901
17902: check for structure copying
17903echo " "
17904echo "Checking to see if your C compiler can copy structs..." >&4
17905$cat >try.c <<'EOCP'
17906int main()
17907{
17908	struct blurfl {
17909		int dyick;
17910	} foo, bar;
17911
17912	foo = bar;
17913}
17914EOCP
17915if $cc -c try.c >/dev/null 2>&1 ; then
17916	val="$define"
17917	echo "Yup, it can."
17918else
17919	val="$undef"
17920	echo "Nope, it can't."
17921fi
17922set d_strctcpy
17923eval $setvar
17924$rm_try
17925
17926: see if strerror and/or sys_errlist[] exist
17927echo " "
17928if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17929    if set strerror val -f d_strerror; eval $csym; $val; then
17930		echo 'strerror() found.' >&4
17931		d_strerror="$define"
17932		d_strerrm='strerror(e)'
17933		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17934			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17935			d_syserrlst="$define"
17936		else
17937			echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17938			d_syserrlst="$undef"
17939		fi
17940    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17941			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17942		echo 'strerror() found in string header.' >&4
17943		d_strerror="$define"
17944		d_strerrm='strerror(e)'
17945		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17946			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17947				d_syserrlst="$define"
17948		else
17949			echo "(You don't appear to have any sys_errlist[], how can this be?)"
17950			d_syserrlst="$undef"
17951		fi
17952    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17953		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17954		d_strerror="$undef"
17955		d_syserrlst="$define"
17956		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17957    else
17958		echo 'strerror() and sys_errlist[] NOT found.' >&4
17959		d_strerror="$undef"
17960		d_syserrlst="$undef"
17961		d_strerrm='"unknown"'
17962    fi
17963fi
17964
17965: see if strerror_r exists
17966set strerror_r d_strerror_r
17967eval $inlibc
17968case "$d_strerror_r" in
17969"$define")
17970	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17971	case "$d_strerror_r_proto:$usethreads" in
17972	":define")	d_strerror_r_proto=define
17973		set d_strerror_r_proto strerror_r $hdrs
17974		eval $hasproto ;;
17975	*)	;;
17976	esac
17977	case "$d_strerror_r_proto" in
17978	define)
17979	case "$strerror_r_proto" in
17980	''|0) try='int strerror_r(int, char*, size_t);'
17981	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17982	esac
17983	case "$strerror_r_proto" in
17984	''|0) try='int strerror_r(int, char*, int);'
17985	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17986	esac
17987	case "$strerror_r_proto" in
17988	''|0) try='char* strerror_r(int, char*, size_t);'
17989	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17990	esac
17991	case "$strerror_r_proto" in
17992	''|0)	d_strerror_r=undef
17993 	        strerror_r_proto=0
17994		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17995	* )	case "$strerror_r_proto" in
17996		REENTRANT_PROTO*) ;;
17997		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17998		esac
17999		echo "Prototype: $try" ;;
18000	esac
18001	;;
18002	*)	case "$usethreads" in
18003		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18004		esac
18005		d_strerror_r=undef
18006		strerror_r_proto=0
18007		;;
18008	esac
18009	;;
18010*)	strerror_r_proto=0
18011	;;
18012esac
18013
18014: see if strftime exists
18015set strftime d_strftime
18016eval $inlibc
18017
18018: see if strlcat exists
18019set strlcat d_strlcat
18020eval $inlibc
18021
18022: see if strlcpy exists
18023set strlcpy d_strlcpy
18024eval $inlibc
18025
18026: see if strtod exists
18027set strtod d_strtod
18028eval $inlibc
18029
18030: see if strtol exists
18031set strtol d_strtol
18032eval $inlibc
18033
18034: see if strtold exists
18035set strtold d_strtold
18036eval $inlibc
18037
18038: see if strtoll exists
18039set strtoll d_strtoll
18040eval $inlibc
18041
18042case "$d_longlong-$d_strtoll" in
18043"$define-$define")
18044	$cat <<EOM
18045Checking whether your strtoll() works okay...
18046EOM
18047	$cat >try.c <<'EOCP'
18048#include <errno.h>
18049#ifdef __hpux
18050#define strtoll __strtoll
18051#endif
18052#ifdef __EMX__
18053#define strtoll _strtoll
18054#endif
18055#include <stdio.h>
18056extern long long int strtoll(char *s, char **, int);
18057static int bad = 0;
18058int check(char *s, long long ell, int een) {
18059	long long gll;
18060	errno = 0;
18061	gll = strtoll(s, 0, 10);
18062	if (!((gll == ell) && (errno == een)))
18063		bad++;
18064}
18065int main() {
18066	check(" 1",                                      1LL, 0);
18067	check(" 0",                                      0LL, 0);
18068	check("-1",                                     -1LL, 0);
18069	check("-9223372036854775808", -9223372036854775808LL, 0);
18070	check("-9223372036854775808", -9223372036854775808LL, 0);
18071	check(" 9223372036854775807",  9223372036854775807LL, 0);
18072	check("-9223372036854775808", -9223372036854775808LL, 0);
18073	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18074	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18075	if (!bad)
18076		printf("ok\n");
18077}
18078EOCP
18079	set try
18080	if eval $compile; then
18081		yyy=`$run ./try`
18082		case "$yyy" in
18083		ok) echo "Your strtoll() seems to be working okay." ;;
18084		*) cat <<EOM >&4
18085Your strtoll() doesn't seem to be working okay.
18086EOM
18087		   d_strtoll="$undef"
18088		   ;;
18089		esac
18090	else
18091		echo "(I can't seem to compile the test program--assuming it doesn't)"
18092		d_strtoll="$undef"
18093	fi
18094	;;
18095esac
18096
18097: see if strtoq exists
18098set strtoq d_strtoq
18099eval $inlibc
18100
18101: see if strtoul exists
18102set strtoul d_strtoul
18103eval $inlibc
18104
18105case "$d_strtoul" in
18106"$define")
18107	$cat <<EOM
18108Checking whether your strtoul() works okay...
18109EOM
18110	$cat >try.c <<'EOCP'
18111#include <errno.h>
18112#include <stdio.h>
18113extern unsigned long int strtoul(char *s, char **, int);
18114static int bad = 0;
18115void check(char *s, unsigned long eul, int een) {
18116	unsigned long gul;
18117	errno = 0;
18118	gul = strtoul(s, 0, 10);
18119	if (!((gul == eul) && (errno == een)))
18120		bad++;
18121}
18122int main() {
18123	check(" 1", 1L, 0);
18124	check(" 0", 0L, 0);
18125EOCP
18126	case "$longsize" in
18127	8)
18128	    $cat >>try.c <<'EOCP'
18129	check("18446744073709551615", 18446744073709551615UL, 0);
18130	check("18446744073709551616", 18446744073709551615UL, ERANGE);
18131#if 0 /* strtoul() for /^-/ strings is undefined. */
18132	check("-1", 18446744073709551615UL, 0);
18133	check("-18446744073709551614", 2, 0);
18134	check("-18446744073709551615", 1, 0);
18135       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18136	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18137#endif
18138EOCP
18139		;;
18140	4)
18141		    $cat >>try.c <<'EOCP'
18142	check("4294967295", 4294967295UL, 0);
18143	check("4294967296", 4294967295UL, ERANGE);
18144#if 0 /* strtoul() for /^-/ strings is undefined. */
18145	check("-1", 4294967295UL, 0);
18146	check("-4294967294", 2, 0);
18147	check("-4294967295", 1, 0);
18148       	check("-4294967296", 4294967295UL, ERANGE);
18149	check("-4294967297", 4294967295UL, ERANGE);
18150#endif
18151EOCP
18152		;;
18153	*)
18154: Should we write these tests to be more portable by sprintf-ing
18155: ~0 and then manipulating that char string as input for strtol?
18156		;;
18157	esac
18158	$cat >>try.c <<'EOCP'
18159	if (!bad)
18160		printf("ok\n");
18161	return 0;
18162}
18163EOCP
18164	set try
18165	if eval $compile; then
18166		case "`$run ./try`" in
18167		ok) echo "Your strtoul() seems to be working okay." ;;
18168		*) cat <<EOM >&4
18169Your strtoul() doesn't seem to be working okay.
18170EOM
18171		   d_strtoul="$undef"
18172		   ;;
18173		esac
18174	else
18175		echo "(I can't seem to compile the test program--assuming it doesn't)"
18176		d_strtoul="$undef"
18177	fi
18178	;;
18179esac
18180
18181: see if strtoull exists
18182set strtoull d_strtoull
18183eval $inlibc
18184
18185case "$d_longlong-$d_strtoull" in
18186"$define-$define")
18187	$cat <<EOM
18188Checking whether your strtoull() works okay...
18189EOM
18190	$cat >try.c <<'EOCP'
18191#include <errno.h>
18192#ifdef __hpux
18193#define strtoull __strtoull
18194#endif
18195#include <stdio.h>
18196extern unsigned long long int strtoull(char *s, char **, int);
18197static int bad = 0;
18198int check(char *s, long long eull, int een) {
18199	long long gull;
18200	errno = 0;
18201	gull = strtoull(s, 0, 10);
18202	if (!((gull == eull) && (errno == een)))
18203		bad++;
18204}
18205int main() {
18206	check(" 1",                                        1LL, 0);
18207	check(" 0",                                        0LL, 0);
18208	check("18446744073709551615",  18446744073709551615ULL, 0);
18209	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18210#if 0 /* strtoull() for /^-/ strings is undefined. */
18211	check("-1",                    18446744073709551615ULL, 0);
18212	check("-18446744073709551614",                     2LL, 0);
18213	check("-18446744073709551615",                     1LL, 0);
18214       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18215	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18216#endif
18217	if (!bad)
18218		printf("ok\n");
18219}
18220EOCP
18221	set try
18222	if eval $compile; then
18223		case "`$run ./try`" in
18224		ok) echo "Your strtoull() seems to be working okay." ;;
18225		*) cat <<EOM >&4
18226Your strtoull() doesn't seem to be working okay.
18227EOM
18228		   d_strtoull="$undef"
18229		   ;;
18230		esac
18231	else
18232		echo "(I can't seem to compile the test program--assuming it doesn't)"
18233		d_strtoull="$undef"
18234	fi
18235	;;
18236esac
18237
18238: see if strtouq exists
18239set strtouq d_strtouq
18240eval $inlibc
18241
18242case "$d_strtouq" in
18243"$define")
18244	$cat <<EOM
18245Checking whether your strtouq() works okay...
18246EOM
18247	$cat >try.c <<'EOCP'
18248#include <errno.h>
18249#include <stdio.h>
18250extern unsigned long long int strtouq(char *s, char **, int);
18251static int bad = 0;
18252void check(char *s, unsigned long long eull, int een) {
18253	unsigned long long gull;
18254	errno = 0;
18255	gull = strtouq(s, 0, 10);
18256	if (!((gull == eull) && (errno == een)))
18257		bad++;
18258}
18259int main() {
18260	check(" 1",                                        1LL, 0);
18261	check(" 0",                                        0LL, 0);
18262	check("18446744073709551615",  18446744073709551615ULL, 0);
18263	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18264#if 0 /* strtouq() for /^-/ strings is undefined. */
18265	check("-1",                    18446744073709551615ULL, 0);
18266	check("-18446744073709551614",                     2LL, 0);
18267	check("-18446744073709551615",                     1LL, 0);
18268       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18269	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18270#endif
18271	if (!bad)
18272		printf("ok\n");
18273	return 0;
18274}
18275EOCP
18276	set try
18277	if eval $compile; then
18278		case "`$run ./try`" in
18279		ok) echo "Your strtouq() seems to be working okay." ;;
18280		*) cat <<EOM >&4
18281Your strtouq() doesn't seem to be working okay.
18282EOM
18283		   d_strtouq="$undef"
18284		   ;;
18285		esac
18286	else
18287		echo "(I can't seem to compile the test program--assuming it doesn't)"
18288		d_strtouq="$undef"
18289	fi
18290	;;
18291esac
18292
18293: see if strxfrm exists
18294set strxfrm d_strxfrm
18295eval $inlibc
18296
18297: see if symlink exists
18298set symlink d_symlink
18299eval $inlibc
18300
18301: see if syscall exists
18302set syscall d_syscall
18303eval $inlibc
18304
18305: see if prototype for syscall is available
18306echo " "
18307set d_syscallproto syscall $i_unistd unistd.h
18308eval $hasproto
18309
18310: see if sysconf exists
18311set sysconf d_sysconf
18312eval $inlibc
18313
18314: see if system exists
18315set system d_system
18316eval $inlibc
18317
18318: see if tcgetpgrp exists
18319set tcgetpgrp d_tcgetpgrp
18320eval $inlibc
18321
18322: see if tcsetpgrp exists
18323set tcsetpgrp d_tcsetpgrp
18324eval $inlibc
18325
18326: see if prototype for telldir is available
18327echo " "
18328set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18329eval $hasproto
18330
18331: see if time exists
18332echo " "
18333if test "X$d_time" = X -o X"$timetype" = X; then
18334    if set time val -f d_time; eval $csym; $val; then
18335		echo 'time() found.' >&4
18336		val="$define"
18337		rp="What is the type returned by time() on this system?"
18338		set time_t timetype long stdio.h sys/types.h
18339		eval $typedef_ask
18340    else
18341		echo 'time() not found, hope that will do.' >&4
18342		val="$undef"
18343		timetype='int';
18344    fi
18345    set d_time
18346    eval $setvar
18347fi
18348
18349: see if timegm exists
18350set timegm d_timegm
18351eval $inlibc
18352
18353: see if this is a sys/times.h system
18354set sys/times.h i_systimes
18355eval $inhdr
18356
18357: see if times exists
18358echo " "
18359if set times val -f d_times; eval $csym; $val; then
18360	echo 'times() found.' >&4
18361	d_times="$define"
18362	inc=''
18363	case "$i_systimes" in
18364	"$define") inc='sys/times.h';;
18365	esac
18366	rp="What is the type returned by times() on this system?"
18367	set clock_t clocktype long stdio.h sys/types.h $inc
18368	eval $typedef_ask
18369else
18370	echo 'times() NOT found, hope that will do.' >&4
18371	d_times="$undef"
18372	clocktype='int'
18373fi
18374
18375: see if tmpnam_r exists
18376set tmpnam_r d_tmpnam_r
18377eval $inlibc
18378case "$d_tmpnam_r" in
18379"$define")
18380	hdrs="$i_systypes sys/types.h define stdio.h "
18381	case "$d_tmpnam_r_proto:$usethreads" in
18382	":define")	d_tmpnam_r_proto=define
18383		set d_tmpnam_r_proto tmpnam_r $hdrs
18384		eval $hasproto ;;
18385	*)	;;
18386	esac
18387	case "$d_tmpnam_r_proto" in
18388	define)
18389	case "$tmpnam_r_proto" in
18390	''|0) try='char* tmpnam_r(char*);'
18391	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18392	esac
18393	case "$tmpnam_r_proto" in
18394	''|0)	d_tmpnam_r=undef
18395 	        tmpnam_r_proto=0
18396		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18397	* )	case "$tmpnam_r_proto" in
18398		REENTRANT_PROTO*) ;;
18399		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18400		esac
18401		echo "Prototype: $try" ;;
18402	esac
18403	;;
18404	*)	case "$usethreads" in
18405		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18406		esac
18407		d_tmpnam_r=undef
18408		tmpnam_r_proto=0
18409		;;
18410	esac
18411	;;
18412*)	tmpnam_r_proto=0
18413	;;
18414esac
18415
18416: see if truncate exists
18417set truncate d_truncate
18418eval $inlibc
18419
18420: see if ttyname_r exists
18421set ttyname_r d_ttyname_r
18422eval $inlibc
18423case "$d_ttyname_r" in
18424"$define")
18425	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18426	case "$d_ttyname_r_proto:$usethreads" in
18427	":define")	d_ttyname_r_proto=define
18428		set d_ttyname_r_proto ttyname_r $hdrs
18429		eval $hasproto ;;
18430	*)	;;
18431	esac
18432	case "$d_ttyname_r_proto" in
18433	define)
18434	case "$ttyname_r_proto" in
18435	''|0) try='int ttyname_r(int, char*, size_t);'
18436	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18437	esac
18438	case "$ttyname_r_proto" in
18439	''|0) try='int ttyname_r(int, char*, int);'
18440	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18441	esac
18442	case "$ttyname_r_proto" in
18443	''|0) try='char* ttyname_r(int, char*, int);'
18444	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18445	esac
18446	case "$ttyname_r_proto" in
18447	''|0)	d_ttyname_r=undef
18448 	        ttyname_r_proto=0
18449		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18450	* )	case "$ttyname_r_proto" in
18451		REENTRANT_PROTO*) ;;
18452		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18453		esac
18454		echo "Prototype: $try" ;;
18455	esac
18456	;;
18457	*)	case "$usethreads" in
18458		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18459		esac
18460		d_ttyname_r=undef
18461		ttyname_r_proto=0
18462		;;
18463	esac
18464	;;
18465*)	ttyname_r_proto=0
18466	;;
18467esac
18468
18469: see if tzname[] exists
18470echo " "
18471if set tzname val -a d_tzname; eval $csym; $val; then
18472	val="$define"
18473	echo 'tzname[] found.' >&4
18474else
18475	val="$undef"
18476	echo 'tzname[] NOT found.' >&4
18477fi
18478set d_tzname
18479eval $setvar
18480
18481: Check if is a multiplatform env
18482case "$osname" in
18483next|rhapsody|darwin) multiarch="$define" ;;
18484esac
18485case "$multiarch" in
18486''|[nN]*) multiarch="$undef" ;;
18487esac
18488
18489: check for ordering of bytes in a UV
18490echo " "
18491case "$usecrosscompile$multiarch" in
18492*$define*)
18493	$cat <<EOM
18494You seem to be either cross-compiling or doing a multiarchitecture build,
18495skipping the byteorder check.
18496
18497EOM
18498	byteorder='ffff'
18499	;;
18500*)
18501	case "$byteorder" in
18502	'')
18503		$cat <<'EOM'
18504In the following, larger digits indicate more significance.  A big-endian
18505machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18506little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18507machines may have weird orders like 3412.  A Cray will report 87654321,
18508an Alpha will report 12345678. If the test program works the default is
18509probably right.
18510I'm now running the test program...
18511EOM
18512		$cat >try.c <<EOCP
18513#include <stdio.h>
18514#$i_stdlib I_STDLIB
18515#ifdef I_STDLIB
18516#include <stdlib.h>
18517#endif
18518#include <sys/types.h>
18519typedef $uvtype UV;
18520int main()
18521{
18522	int i;
18523	union {
18524		UV l;
18525		char c[$uvsize];
18526	} u;
18527
18528	if ($uvsize > 4)
18529		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18530	else
18531		u.l = (UV)0x04030201;
18532	for (i = 0; i < $uvsize; i++)
18533		printf("%c", u.c[i]+'0');
18534	printf("\n");
18535	exit(0);
18536}
18537EOCP
18538		xxx_prompt=y
18539		set try
18540		if eval $compile && $run ./try > /dev/null; then
18541			dflt=`$run ./try`
18542			case "$dflt" in
18543			[1-4][1-4][1-4][1-4]|12345678|87654321)
18544				echo "(The test program ran ok.)"
18545				echo "byteorder=$dflt"
18546				xxx_prompt=n
18547			;;
18548			????|????????) echo "(The test program ran ok.)" ;;
18549			*) echo "(The test program didn't run right for some reason.)" ;;
18550			esac
18551		else
18552			dflt='4321'
18553			cat <<'EOM'
18554(I can't seem to compile the test program.  Guessing big-endian...)
18555EOM
18556		fi
18557		case "$xxx_prompt" in
18558		y)
18559			rp="What is the order of bytes in $uvtype?"
18560			. ./myread
18561			byteorder="$ans"
18562			;;
18563		*)	byteorder=$dflt
18564			;;
18565		esac
18566		;;
18567	esac
18568	$rm_try
18569	;;
18570esac
18571
18572: Checking 32bit aligndness
18573$cat <<EOM
18574
18575Checking to see whether you can access character data unalignedly...
18576EOM
18577case "$d_u32align" in
18578'')   $cat >try.c <<EOCP
18579#include <stdio.h>
18580#$i_stdlib I_STDLIB
18581#ifdef I_STDLIB
18582#include <stdlib.h>
18583#endif
18584#define U32 $u32type
18585#define BYTEORDER 0x$byteorder
18586#define U8 $u8type
18587#include <signal.h>
18588#ifdef SIGBUS
18589$signal_t bletch(int s) { exit(4); }
18590#endif
18591int main() {
18592#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18593    volatile U8 buf[8];
18594    volatile U32 *up;
18595    int i;
18596
18597    if (sizeof(U32) != 4) {
18598	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18599	exit(1);
18600    }
18601
18602    fflush(stdout);
18603
18604#ifdef SIGBUS
18605    signal(SIGBUS, bletch);
18606#endif
18607
18608    buf[0] = 0;
18609    buf[1] = 0;
18610    buf[2] = 0;
18611    buf[3] = 1;
18612    buf[4] = 0;
18613    buf[5] = 0;
18614    buf[6] = 0;
18615    buf[7] = 1;
18616
18617    for (i = 0; i < 4; i++) {
18618	up = (U32*)(buf + i);
18619	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18620	       (*up == 1 << (8*(3-i)))  /* little-endian */
18621	      )
18622	   )
18623	{
18624	    printf("read failed (%x)\n", *up);
18625	    exit(2);
18626	}
18627    }
18628
18629    /* write test */
18630    for (i = 0; i < 4; i++) {
18631	up = (U32*)(buf + i);
18632	*up = 0xBeef;
18633	if (*up != 0xBeef) {
18634	    printf("write failed (%x)\n", *up);
18635	    exit(3);
18636	}
18637    }
18638
18639    exit(0);
18640#else
18641    printf("1\n");
18642    exit(1);
18643#endif
18644    return 0;
18645}
18646EOCP
18647set try
18648if eval $compile_ok; then
18649	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18650	$run ./try 2>&1 >/dev/null
18651	case "$?" in
18652	0)	cat >&4 <<EOM
18653You can access character data pretty unalignedly.
18654EOM
18655		d_u32align="$undef"
18656		;;
18657	*)	cat >&4 <<EOM
18658It seems that you must access character data in an aligned manner.
18659EOM
18660		d_u32align="$define"
18661		;;
18662	esac
18663else
18664	rp='Can you access character data at unaligned addresses?'
18665	dflt='n'
18666	. ./myread
18667	case "$ans" in
18668	[yY]*)	d_u32align="$undef"  ;;
18669	*)	d_u32align="$define" ;;
18670	esac
18671fi
18672$rm_try
18673;;
18674esac
18675
18676: see if ualarm exists
18677set ualarm d_ualarm
18678eval $inlibc
18679
18680: see if umask exists
18681set umask d_umask
18682eval $inlibc
18683
18684: see if unordered exists
18685set unordered d_unordered
18686eval $inlibc
18687
18688: see if unsetenv exists
18689set unsetenv d_unsetenv
18690eval $inlibc
18691
18692: see if usleep exists
18693set usleep d_usleep
18694eval $inlibc
18695
18696: see if prototype for usleep is available
18697echo " "
18698set d_usleepproto usleep $i_unistd unistd.h
18699eval $hasproto
18700
18701: see if ustat exists
18702set ustat d_ustat
18703eval $inlibc
18704
18705: see if closedir exists
18706set closedir d_closedir
18707eval $inlibc
18708
18709case "$d_closedir" in
18710"$define")
18711	echo " "
18712	echo "Checking whether closedir() returns a status..." >&4
18713	cat > try.c <<EOM
18714#$i_dirent I_DIRENT		/**/
18715#$i_sysdir I_SYS_DIR		/**/
18716#$i_sysndir I_SYS_NDIR		/**/
18717#$i_systypes I_SYS_TYPES	/**/
18718
18719#if defined(I_SYS_TYPES)
18720#include <sys/types.h>
18721#endif
18722#if defined(I_DIRENT)
18723#include <dirent.h>
18724#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18725#include <sys/dir.h>
18726#endif
18727#else
18728#ifdef I_SYS_NDIR
18729#include <sys/ndir.h>
18730#else
18731#ifdef I_SYS_DIR
18732#ifdef hp9000s500
18733#include <ndir.h>	/* may be wrong in the future */
18734#else
18735#include <sys/dir.h>
18736#endif
18737#endif
18738#endif
18739#endif
18740int main() { return closedir(opendir(".")); }
18741EOM
18742	set try
18743	if eval $compile_ok; then
18744		if $run ./try > /dev/null 2>&1 ; then
18745			echo "Yes, it does."
18746			val="$undef"
18747		else
18748			echo "No, it doesn't."
18749			val="$define"
18750		fi
18751	else
18752		echo "(I can't seem to compile the test program--assuming it doesn't)"
18753		val="$define"
18754	fi
18755	;;
18756*)
18757	val="$undef";
18758	;;
18759esac
18760set d_void_closedir
18761eval $setvar
18762$rm_try
18763
18764: see if there is a wait4
18765set wait4 d_wait4
18766eval $inlibc
18767
18768: see if waitpid exists
18769set waitpid d_waitpid
18770eval $inlibc
18771
18772: see if wcstombs exists
18773set wcstombs d_wcstombs
18774eval $inlibc
18775
18776: see if wctomb exists
18777set wctomb d_wctomb
18778eval $inlibc
18779
18780: see if writev exists
18781set writev d_writev
18782eval $inlibc
18783
18784: preserve RCS keywords in files with variable substitution, grrr
18785Date='$Date'
18786Id='$Id'
18787Log='$Log'
18788RCSfile='$RCSfile'
18789Revision='$Revision'
18790
18791: check for alignment requirements
18792echo " "
18793case "$usecrosscompile$multiarch" in
18794*$define*)
18795	$cat <<EOM
18796You seem to be either cross-compiling or doing a multiarchitecture build,
18797skipping the memory alignment check.
18798
18799EOM
18800	case "$alignbytes" in
18801	'') alignbytes=8 ;;
18802	esac
18803	;;
18804*)
18805	case "$alignbytes" in
18806	'') echo "Checking alignment constraints..." >&4
18807		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18808			$cat >try.c <<'EOCP'
18809typedef long double NV;
18810EOCP
18811		else
18812			$cat >try.c <<'EOCP'
18813typedef double NV;
18814EOCP
18815		fi
18816		$cat >>try.c <<'EOCP'
18817#include <stdio.h>
18818struct foobar {
18819	char foo;
18820	NV bar;
18821} try_algn;
18822int main()
18823{
18824    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18825    return(0);
18826}
18827EOCP
18828		set try
18829		if eval $compile_ok; then
18830			dflt=`$run ./try`
18831		else
18832			dflt='8'
18833			echo "(I can't seem to compile the test program...)"
18834		fi
18835		;;
18836	*) dflt="$alignbytes"
18837		;;
18838	esac
18839	rp="Doubles must be aligned on a how-many-byte boundary?"
18840	. ./myread
18841	alignbytes="$ans"
18842	$rm_try
18843	;;
18844esac
18845
18846
18847: set the base revision
18848baserev=5.0
18849
18850: check for length of character
18851echo " "
18852case "$charsize" in
18853'')
18854	echo "Checking to see how big your characters are (hey, you never know)..." >&4
18855	$cat >try.c <<EOCP
18856#include <stdio.h>
18857#$i_stdlib I_STDLIB
18858#ifdef I_STDLIB
18859#include <stdlib.h>
18860#endif
18861int main()
18862{
18863    printf("%d\n", (int)sizeof(char));
18864    exit(0);
18865}
18866EOCP
18867	set try
18868	if eval $compile_ok; then
18869		dflt=`$run ./try`
18870	else
18871		dflt='1'
18872		echo "(I can't seem to compile the test program.  Guessing...)"
18873	fi
18874	;;
18875*)
18876	dflt="$charsize"
18877	;;
18878esac
18879rp="What is the size of a character (in bytes)?"
18880. ./myread
18881charsize="$ans"
18882$rm_try
18883
18884: Check for the number of bits in a character
18885case "$charbits" in
18886'')	echo "Checking how long a character is (in bits)..." >&4
18887	$cat >try.c <<EOCP
18888#include <stdio.h>
18889int main ()
18890{
18891    int n;
18892    unsigned char c;
18893    for (c = 1, n = 0; c; c <<= 1, n++) ;
18894    printf ("%d\n", n);
18895    return (0);
18896    }
18897EOCP
18898	set try
18899	if eval $compile_ok; then
18900		dflt=`$run ./try`
18901	else
18902		dflt='8'
18903		echo "(I can't seem to compile the test program.  Guessing...)"
18904	fi
18905	;;
18906*)
18907	dflt="$charbits"
18908	;;
18909esac
18910rp="What is the length of a character (in bits)?"
18911. ./myread
18912charbits="$ans"
18913$rm_try
18914case "$charbits" in
189158)	;;
18916*)	cat >&4 << EOM
18917Your system has an unsigned character size of $charbits bits, which
18918is rather unusual (normally it is 8 bits).  Perl likely will not work
18919correctly on your system, with subtle bugs in various places.
18920EOM
18921	rp='Do you really want to continue?'
18922	dflt='n'
18923	. ./myread
18924	case "$ans" in
18925		[yY])	echo >&4 "Okay, continuing."	;;
18926		*)	exit 1				;;
18927	esac
18928esac
18929
18930: how do we concatenate cpp tokens here?
18931echo " "
18932echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18933$cat >cpp_stuff.c <<'EOCP'
18934#define RCAT(a,b)a/**/b
18935#define ACAT(a,b)a ## b
18936RCAT(Rei,ser)
18937ACAT(Cir,cus)
18938EOCP
18939$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18940if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18941	echo "Oh!  Smells like ANSI's been here." >&4
18942	echo "We can catify or stringify, separately or together!"
18943	cpp_stuff=42
18944elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18945	echo "Ah, yes!  The good old days!" >&4
18946	echo "However, in the good old days we don't know how to stringify and"
18947	echo "catify at the same time."
18948	cpp_stuff=1
18949else
18950	$cat >&4 <<EOM
18951Hmm, I don't seem to be able to concatenate tokens with your cpp.
18952You're going to have to edit the values of CAT[2-5] in config.h...
18953EOM
18954	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18955fi
18956$rm -f cpp_stuff.*
18957
18958: see if this is a db.h system
18959set db.h i_db
18960eval $inhdr
18961
18962case "$i_db" in
18963$define)
18964	: Check db version.
18965	echo " "
18966	echo "Checking Berkeley DB version ..." >&4
18967	$cat >try.c <<EOCP
18968#$d_const HASCONST
18969#ifndef HASCONST
18970#define const
18971#endif
18972#include <sys/types.h>
18973#include <stdio.h>
18974#$i_stdlib I_STDLIB
18975#ifdef I_STDLIB
18976#include <stdlib.h>
18977#endif
18978#include <db.h>
18979int main(int argc, char *argv[])
18980{
18981#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
18982    int Major, Minor, Patch ;
18983    unsigned long Version ;
18984    (void)db_version(&Major, &Minor, &Patch) ;
18985    if (argc == 2) {
18986        printf("%d %d %d %d %d %d\n",
18987               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18988               Major, Minor, Patch);
18989        exit(0);
18990    }
18991    printf("You have Berkeley DB Version 2 or greater.\n");
18992
18993    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18994		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18995    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18996		Major, Minor, Patch) ;
18997
18998    /* check that db.h & libdb are compatible */
18999    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19000	printf("db.h and libdb are incompatible.\n") ;
19001        exit(3);
19002    }
19003
19004    printf("db.h and libdb are compatible.\n") ;
19005
19006    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19007		+ DB_VERSION_PATCH ;
19008
19009    /* needs to be >= 2.3.4 */
19010    if (Version < 2003004) {
19011    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19012	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19013        exit(2);
19014    }
19015
19016    exit(0);
19017#else
19018#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19019    if (argc == 2) {
19020        printf("1 0 0\n");
19021        exit(0);
19022    }
19023    printf("You have Berkeley DB Version 1.\n");
19024    exit(0);	/* DB version < 2: the coast is clear. */
19025#else
19026    exit(1);	/* <db.h> not Berkeley DB? */
19027#endif
19028#endif
19029}
19030EOCP
19031	set try
19032	if eval $compile_ok && $run ./try; then
19033		echo 'Looks OK.' >&4
19034		set `$run ./try 1`
19035		db_version_major=$1
19036		db_version_minor=$2
19037		db_version_patch=$3
19038	else
19039		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19040		i_db=$undef
19041		case " $libs " in
19042		*"-ldb "*)
19043			: Remove db from list of libraries to use
19044			echo "Removing unusable -ldb from library list" >&4
19045			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19046			shift
19047			libs="$*"
19048			echo "libs = $libs" >&4
19049			;;
19050		esac
19051	fi
19052	$rm_try
19053	;;
19054esac
19055
19056case "$i_db" in
19057define)
19058	: Check the return type needed for hash
19059	echo " "
19060	echo "Checking return type needed for hash for Berkeley DB ..." >&4
19061	$cat >try.c <<EOCP
19062#$d_const HASCONST
19063#ifndef HASCONST
19064#define const
19065#endif
19066#include <sys/types.h>
19067#include <db.h>
19068
19069#ifndef DB_VERSION_MAJOR
19070u_int32_t hash_cb (ptr, size)
19071const void *ptr;
19072size_t size;
19073{
19074}
19075HASHINFO info;
19076int main()
19077{
19078	info.hash = hash_cb;
19079}
19080#endif
19081EOCP
19082	if $cc $ccflags -c try.c >try.out 2>&1 ; then
19083		if $contains warning try.out >>/dev/null 2>&1 ; then
19084			db_hashtype='int'
19085		else
19086			db_hashtype='u_int32_t'
19087		fi
19088	else
19089		: XXX Maybe we should just give up here.
19090		db_hashtype=u_int32_t
19091		$cat try.out >&4
19092		echo "Help:  I can't seem to compile the db test program." >&4
19093		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19094	fi
19095	$rm_try
19096	echo "Your version of Berkeley DB uses $db_hashtype for hash."
19097	;;
19098*)	db_hashtype=u_int32_t
19099	;;
19100esac
19101case "$i_db" in
19102define)
19103	: Check the return type needed for prefix
19104	echo " "
19105	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19106	cat >try.c <<EOCP
19107#$d_const HASCONST
19108#ifndef HASCONST
19109#define const
19110#endif
19111#include <sys/types.h>
19112#include <db.h>
19113
19114#ifndef DB_VERSION_MAJOR
19115size_t prefix_cb (key1, key2)
19116const DBT *key1;
19117const DBT *key2;
19118{
19119}
19120BTREEINFO info;
19121int main()
19122{
19123	info.prefix = prefix_cb;
19124}
19125#endif
19126EOCP
19127	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19128		if $contains warning try.out >>/dev/null 2>&1 ; then
19129			db_prefixtype='int'
19130		else
19131			db_prefixtype='size_t'
19132		fi
19133	else
19134		db_prefixtype='size_t'
19135		: XXX Maybe we should just give up here.
19136		$cat try.out >&4
19137		echo "Help:  I can't seem to compile the db test program." >&4
19138		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19139	fi
19140	$rm_try
19141	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19142	;;
19143*)	db_prefixtype='size_t'
19144	;;
19145esac
19146
19147: How can we generate normalized random numbers ?
19148echo " "
19149echo "Looking for a random number function..." >&4
19150case "$randfunc" in
19151'')
19152	if set drand48 val -f; eval $csym; $val; then
19153		dflt="drand48"
19154		echo "Good, found drand48()." >&4
19155	elif set random val -f; eval $csym; $val; then
19156		dflt="random"
19157		echo "OK, found random()." >&4
19158	else
19159		dflt="rand"
19160		echo "Yick, looks like I have to use rand()." >&4
19161	fi
19162	echo " "
19163	;;
19164*)
19165	dflt="$randfunc"
19166	;;
19167esac
19168cont=true
19169
19170case "$ccflags" in
19171*-Dmy_rand=*|*-Dmy_srand=*)
19172	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19173	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19174	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19175	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19176	;;
19177esac
19178
19179while $test "$cont"; do
19180	rp="Use which function to generate random numbers?"
19181	. ./myread
19182	if $test "$ans" = "$dflt"; then
19183		: null
19184	else
19185		randbits=''
19186	fi
19187	randfunc="$ans"
19188	if set $ans val -f; eval $csym; $val; then
19189		cont=''
19190	else
19191		dflt=y
19192		rp="I cannot find function $ans. Use that name anyway?"
19193		. ./myread
19194		dflt=rand
19195		case "$ans" in
19196			[yY]*) cont='';;
19197		esac
19198	fi
19199	case "$cont" in
19200	'')
19201		case "$randfunc" in
19202		drand48)
19203			drand01="drand48()"
19204			seedfunc="srand48"
19205			randbits=48
19206			randseedtype=long
19207			;;
19208		rand|random)
19209			case "$randbits" in
19210			'')
19211echo "Checking to see how many bits your $randfunc() function produces..." >&4
19212				$cat >try.c <<EOCP
19213#$i_unistd I_UNISTD
19214#$i_stdlib I_STDLIB
19215#include <stdio.h>
19216#ifdef I_UNISTD
19217#  include <unistd.h>
19218#endif
19219#ifdef I_STDLIB
19220#  include <stdlib.h>
19221#endif
19222int main()
19223{
19224	register int i;
19225	register unsigned long tmp;
19226	register unsigned long max = 0L;
19227
19228	for (i = 1000; i; i--) {
19229		tmp = (unsigned long) $randfunc();
19230		if (tmp > max) max = tmp;
19231	}
19232	for (i = 0; max; i++)
19233		max /= 2;
19234	printf("%d\n",i);
19235}
19236EOCP
19237				set try
19238				if eval $compile_ok; then
19239					dflt=`try`
19240				else
19241					dflt='?'
19242					echo "(I can't seem to compile the test program...)"
19243				fi
19244				;;
19245			*)
19246				dflt="$randbits"
19247				;;
19248			esac
19249			rp="How many bits does your $randfunc() function produce?"
19250			. ./myread
19251			randbits="$ans"
19252			$rm_try
19253			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19254			seedfunc="s$randfunc"
19255			randseedtype=unsigned
19256			;;
19257		*)
19258			dflt="31"
19259			rp="How many bits does your $randfunc() function produce?"
19260			. ./myread
19261			randbits="$ans"
19262			seedfunc="s$randfunc"
19263			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19264			if set $seedfunc val -f; eval $csym; $val; then
19265				echo "(Using $seedfunc() to seed random generator)"
19266			else
19267				echo "(Warning: no $seedfunc() to seed random generator)"
19268				seedfunc=rand
19269			fi
19270			randseedtype=unsigned
19271			;;
19272		esac
19273		;;
19274	esac
19275done
19276
19277: Determine if this is an EBCDIC system
19278echo " "
19279echo "Determining whether or not we are on an EBCDIC system..." >&4
19280$cat >try.c <<'EOM'
19281int main()
19282{
19283  if ('M'==0xd4) return 0;
19284  return 1;
19285}
19286EOM
19287
19288val=$undef
19289set try
19290if eval $compile_ok; then
19291	if $run ./try; then
19292		echo "You seem to speak EBCDIC." >&4
19293		val="$define"
19294	else
19295		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19296	fi
19297else
19298	echo "I'm unable to compile the test program." >&4
19299	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19300fi
19301$rm_try
19302set ebcdic
19303eval $setvar
19304
19305: Check how to flush
19306echo " "
19307$cat >&4 <<EOM
19308Checking how to flush all pending stdio output...
19309EOM
19310# I only know how to find the first 32 possibly open files on SunOS.
19311# See also hints/sunos_4_1.sh and util.c  --AD
19312case "$osname" in
19313sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19314esac
19315$cat >>try.c <<EOCP
19316#include <stdio.h>
19317#$i_stdlib I_STDLIB
19318#ifdef I_STDLIB
19319#include <stdlib.h>
19320#endif
19321#$i_unistd I_UNISTD
19322#ifdef I_UNISTD
19323# include <unistd.h>
19324#endif
19325#$d_sysconf HAS_SYSCONF
19326#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19327#ifdef HAS_STDIO_STREAM_ARRAY
19328# define STDIO_STREAM_ARRAY $stdio_stream_array
19329#endif
19330int main() {
19331  FILE* p;
19332  unlink("try.out");
19333  p = fopen("try.out", "w");
19334#ifdef TRY_FPUTC
19335  fputc('x', p);
19336#else
19337# ifdef TRY_FPRINTF
19338  fprintf(p, "x");
19339# endif
19340#endif
19341#ifdef TRY_FFLUSH_NULL
19342  fflush(NULL);
19343#endif
19344#ifdef TRY_FFLUSH_ALL
19345  {
19346    long open_max = -1;
19347# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19348    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19349# else
19350#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19351    open_max = sysconf(_SC_OPEN_MAX);
19352#  else
19353#   ifdef FOPEN_MAX
19354    open_max = FOPEN_MAX;
19355#   else
19356#    ifdef OPEN_MAX
19357    open_max = OPEN_MAX;
19358#    else
19359#     ifdef _NFILE
19360    open_max = _NFILE;
19361#     endif
19362#    endif
19363#   endif
19364#  endif
19365# endif
19366# ifdef HAS_STDIO_STREAM_ARRAY
19367    if (open_max > 0) {
19368      long i;
19369      for (i = 0; i < open_max; i++)
19370	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19371		STDIO_STREAM_ARRAY[i]._file < open_max &&
19372		STDIO_STREAM_ARRAY[i]._flag)
19373		fflush(&STDIO_STREAM_ARRAY[i]);
19374    }
19375  }
19376# endif
19377#endif
19378  _exit(42);
19379}
19380EOCP
19381: first we have to find out how _not_ to flush
19382$to try.c
19383if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19384    output=''
19385    set try -DTRY_FPUTC
19386    if eval $compile; then
19387 	    $run ./try 2>/dev/null
19388	    code="$?"
19389	    $from try.out
19390	    if $test ! -s try.out -a "X$code" = X42; then
19391		output=-DTRY_FPUTC
19392	    fi
19393    fi
19394    case "$output" in
19395    '')
19396	    set try -DTRY_FPRINTF
19397	    if eval $compile; then
19398 		    $run ./try 2>/dev/null
19399		    code="$?"
19400		    $from try.out
19401		    if $test ! -s try.out -a "X$code" = X42; then
19402			output=-DTRY_FPRINTF
19403		    fi
19404	    fi
19405	;;
19406    esac
19407fi
19408: check for fflush NULL behaviour
19409case "$fflushNULL" in
19410'') 	set try -DTRY_FFLUSH_NULL $output
19411	if eval $compile; then
19412	    	$run ./try 2>/dev/null
19413		code="$?"
19414		$from try.out
19415		if $test -s try.out -a "X$code" = X42; then
19416			fflushNULL="`$cat try.out`"
19417		else
19418			if $test "X$code" != X42; then
19419				$cat >&4 <<EOM
19420(If this test failed, don't worry, we'll try another method shortly.)
19421EOM
19422			fi
19423		fi
19424	fi
19425	$rm -f core try.core core.try.*
19426	case "$fflushNULL" in
19427	x)	$cat >&4 <<EOM
19428Your fflush(NULL) works okay for output streams.
19429Let's see if it clobbers input pipes...
19430EOM
19431# As of mid-March 2000 all versions of Solaris appear to have a stdio
19432# bug that improperly flushes the input end of pipes.  So we avoid the
19433# autoflush on fork/system/exec support for now. :-(
19434$cat >tryp.c <<EOCP
19435#include <stdio.h>
19436int
19437main(int argc, char **argv)
19438{
19439    char buf[1024];
19440    int i;
19441    char *bp = buf;
19442    while (1) {
19443        while ((i = getc(stdin)) != -1
19444               && (*bp++ = i) != '\n'
19445               && bp < &buf[1024])
19446    	/* DO NOTHING */ ;
19447        *bp = '\0';
19448        fprintf(stdout, "%s", buf);
19449        fflush(NULL);
19450        if (i == -1)
19451	    return 0;
19452        bp = buf;
19453    }
19454}
19455EOCP
19456                fflushNULL="$define"
19457                set tryp
19458                if eval $compile; then
19459                    $rm -f tryp.out
19460                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19461                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19462                       $cat >&4 <<EOM
19463fflush(NULL) seems to behave okay with input streams.
19464EOM
19465			fflushNULL="$define"
19466                    else
19467			$cat >&4 <<EOM
19468Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19469EOM
19470                        fflushNULL="$undef"
19471                    fi
19472                fi
19473	        $rm -f core tryp.c tryp.core core.tryp.*
19474		;;
19475	'')	$cat >&4 <<EOM
19476Your fflush(NULL) isn't working (contrary to ANSI C).
19477EOM
19478		fflushNULL="$undef"
19479		;;
19480	*)	$cat >&4 <<EOM
19481Cannot figure out whether your fflush(NULL) works or not.
19482I'm assuming it doesn't (contrary to ANSI C).
19483EOM
19484		fflushNULL="$undef"
19485		;;
19486	esac
19487	;;
19488$define|true|[yY]*)
19489	fflushNULL="$define"
19490	;;
19491*)
19492	fflushNULL="$undef"
19493	;;
19494esac
19495: check explicit looping only if NULL did not work, and if the pipe
19496: bug does not show up on an explicit flush too
19497case "$fflushNULL" in
19498"$undef")
19499	$cat >tryp.c <<EOCP
19500#include <stdio.h>
19501int
19502main(int argc, char **argv)
19503{
19504    char buf[1024];
19505    int i;
19506    char *bp = buf;
19507    while (1) {
19508	while ((i = getc(stdin)) != -1
19509	       && (*bp++ = i) != '\n'
19510	       && bp < &buf[1024])
19511	/* DO NOTHING */ ;
19512	*bp = '\0';
19513	fprintf(stdout, "%s", buf);
19514	fflush(stdin);
19515	if (i == -1)
19516	    return 0;
19517	bp = buf;
19518    }
19519}
19520EOCP
19521	set tryp
19522	if eval $compile; then
19523	    $rm -f tryp.out
19524	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19525	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19526	       $cat >&4 <<EOM
19527Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19528EOM
19529		: now check for fflushall behaviour
19530		case "$fflushall" in
19531		'') 	set try -DTRY_FFLUSH_ALL $output
19532			if eval $compile; then
19533				$cat >&4 <<EOM
19534(Now testing the other method--but note that this also may fail.)
19535EOM
19536				$run ./try 2>/dev/null
19537				code=$?
19538				$from try.out
19539				if $test -s try.out -a "X$code" = X42; then
19540					fflushall="`$cat try.out`"
19541				fi
19542			fi
19543			$rm_try
19544			case "$fflushall" in
19545			x)	$cat >&4 <<EOM
19546Whew. Flushing explicitly all the stdio streams works.
19547EOM
19548				fflushall="$define"
19549				;;
19550			'')	$cat >&4 <<EOM
19551Sigh. Flushing explicitly all the stdio streams doesn't work.
19552EOM
19553				fflushall="$undef"
19554				;;
19555			*)	$cat >&4 <<EOM
19556Cannot figure out whether flushing stdio streams explicitly works or not.
19557I'm assuming it doesn't.
19558EOM
19559				fflushall="$undef"
19560				;;
19561			esac
19562			;;
19563		"$define"|true|[yY]*)
19564			fflushall="$define"
19565			;;
19566		*)
19567			fflushall="$undef"
19568			;;
19569		esac
19570	    else
19571		$cat >&4 <<EOM
19572All is futile.  Even fflush(stdin) clobbers input pipes!
19573EOM
19574		fflushall="$undef"
19575	    fi
19576	else
19577	    fflushall="$undef"
19578	fi
19579	$rm -f core tryp.c tryp.core core.tryp.*
19580	;;
19581*)	fflushall="$undef"
19582	;;
19583esac
19584
19585case "$fflushNULL$fflushall" in
19586undefundef)
19587	$cat <<EOM
19588OK, I give up.  I cannot figure out how to flush pending stdio output.
19589We won't be flushing handles at all before fork/exec/popen.
19590EOM
19591	;;
19592esac
19593$rm_try tryp
19594
19595: Store the full pathname to the ar program for use in the C program
19596: Respect a hint or command line value for full_ar.
19597case "$full_ar" in
19598'') full_ar=$ar ;;
19599esac
19600
19601: Store the full pathname to the sed program for use in the C program
19602full_sed=$sed
19603
19604: see what type gids are declared as in the kernel
19605echo " "
19606echo "Looking for the type for group ids returned by getgid()."
19607set gid_t gidtype xxx stdio.h sys/types.h
19608eval $typedef
19609case "$gidtype" in
19610xxx)
19611	xxx=`./findhdr sys/user.h`
19612	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19613	case $1 in
19614	unsigned) dflt="$1 $2" ;;
19615	*) dflt="$1" ;;
19616	esac
19617	;;
19618*) dflt="$gidtype";;
19619esac
19620case "$gidtype" in
19621gid_t) echo "gid_t found." ;;
19622*)	rp="What is the type for group ids returned by getgid()?"
19623	. ./myread
19624	gidtype="$ans"
19625	;;
19626esac
19627
19628: Check the size of GID
19629echo " "
19630case "$gidtype" in
19631*_t) zzz="$gidtype"	;;
19632*)   zzz="gid"		;;
19633esac
19634echo "Checking the size of $zzz..." >&4
19635cat > try.c <<EOCP
19636#include <sys/types.h>
19637#include <stdio.h>
19638#$i_stdlib I_STDLIB
19639#ifdef I_STDLIB
19640#include <stdlib.h>
19641#endif
19642int main() {
19643    printf("%d\n", (int)sizeof($gidtype));
19644    exit(0);
19645}
19646EOCP
19647set try
19648if eval $compile_ok; then
19649	yyy=`$run ./try`
19650	case "$yyy" in
19651	'')	gidsize=4
19652		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19653		;;
19654	*)	gidsize=$yyy
19655		echo "Your $zzz is $gidsize bytes long."
19656		;;
19657	esac
19658else
19659	gidsize=4
19660	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19661fi
19662
19663
19664: Check if GID is signed
19665echo " "
19666case "$gidtype" in
19667*_t) zzz="$gidtype"	;;
19668*)   zzz="gid"		;;
19669esac
19670echo "Checking the sign of $zzz..." >&4
19671cat > try.c <<EOCP
19672#include <sys/types.h>
19673#include <stdio.h>
19674int main() {
19675	$gidtype foo = -1;
19676	if (foo < 0)
19677		printf("-1\n");
19678	else
19679		printf("1\n");
19680}
19681EOCP
19682set try
19683if eval $compile; then
19684	yyy=`$run ./try`
19685	case "$yyy" in
19686	'')	gidsign=1
19687		echo "(I can't execute the test program--guessing unsigned.)" >&4
19688		;;
19689	*)	gidsign=$yyy
19690		case "$gidsign" in
19691		 1) echo "Your $zzz is unsigned." ;;
19692		-1) echo "Your $zzz is signed."   ;;
19693		esac
19694		;;
19695	esac
19696else
19697	gidsign=1
19698	echo "(I can't compile the test program--guessing unsigned.)" >&4
19699fi
19700
19701
19702: Check 64bit sizes
19703echo " "
19704
19705if $test X"$quadtype" != X; then
19706
19707echo "Checking how to print 64-bit integers..." >&4
19708
19709if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19710	$cat >try.c <<'EOCP'
19711#include <sys/types.h>
19712#include <stdio.h>
19713int main() {
19714  int q = 12345678901;
19715  printf("%ld\n", q);
19716}
19717EOCP
19718	set try
19719	if eval $compile; then
19720		yyy=`$run ./try`
19721		case "$yyy" in
19722		12345678901)
19723			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19724                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19725			echo "We will use %d."
19726			;;
19727		esac
19728	fi
19729fi
19730
19731if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19732	$cat >try.c <<'EOCP'
19733#include <sys/types.h>
19734#include <stdio.h>
19735int main() {
19736  long q = 12345678901;
19737  printf("%ld\n", q);
19738}
19739EOCP
19740	set try
19741	if eval $compile; then
19742		yyy=`$run ./try`
19743		case "$yyy" in
19744		12345678901)
19745			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19746                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19747			echo "We will use %ld."
19748			;;
19749		esac
19750	fi
19751fi
19752
19753if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19754	$cat >try.c <<'EOCP'
19755#include <sys/types.h>
19756#include <inttypes.h>
19757#include <stdio.h>
19758int main() {
19759  int64_t q = 12345678901;
19760  printf("%" PRId64 "\n", q);
19761}
19762EOCP
19763	set try
19764	if eval $compile; then
19765		yyy=`$run ./try`
19766		case "$yyy" in
19767		12345678901)
19768			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19769                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19770			echo "We will use the C9X style."
19771			;;
19772		esac
19773	fi
19774fi
19775
19776if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19777	$cat >try.c <<EOCP
19778#include <sys/types.h>
19779#include <stdio.h>
19780int main() {
19781  $quadtype q = 12345678901;
19782  printf("%Ld\n", q);
19783}
19784EOCP
19785	set try
19786	if eval $compile; then
19787		yyy=`$run ./try`
19788		case "$yyy" in
19789		12345678901)
19790			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19791                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19792			echo "We will use %Ld."
19793			;;
19794		esac
19795	fi
19796fi
19797
19798if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19799	$cat >try.c <<'EOCP'
19800#include <sys/types.h>
19801#include <stdio.h>
19802int main() {
19803  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19804  printf("%lld\n", q);
19805}
19806EOCP
19807	set try
19808	if eval $compile; then
19809		yyy=`$run ./try`
19810		case "$yyy" in
19811		12345678901)
19812			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19813                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19814			echo "We will use the %lld style."
19815			;;
19816		esac
19817	fi
19818fi
19819
19820if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19821	$cat >try.c <<EOCP
19822#include <sys/types.h>
19823#include <stdio.h>
19824int main() {
19825  $quadtype q = 12345678901;
19826  printf("%qd\n", q);
19827}
19828EOCP
19829	set try
19830	if eval $compile; then
19831		yyy=`$run ./try`
19832		case "$yyy" in
19833		12345678901)
19834			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19835                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19836			echo "We will use %qd."
19837			;;
19838		esac
19839	fi
19840fi
19841
19842if $test X"$sPRId64" = X; then
19843	echo "Cannot figure out how to print 64-bit integers." >&4
19844fi
19845$rm_try
19846
19847fi
19848
19849case "$sPRId64" in
19850'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19851	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19852	;;
19853*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19854	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19855	;;
19856esac
19857
19858: Check format strings for internal types
19859echo " "
19860$echo "Checking the format strings to be used for Perl's internal types..." >&4
19861
19862if $test X"$ivsize" = X8; then
19863	ivdformat="$sPRId64"
19864	uvuformat="$sPRIu64"
19865	uvoformat="$sPRIo64"
19866	uvxformat="$sPRIx64"
19867	uvXUformat="$sPRIXU64"
19868else
19869	if $test X"$ivsize" = X"$longsize"; then
19870		ivdformat='"ld"'
19871		uvuformat='"lu"'
19872		uvoformat='"lo"'
19873		uvxformat='"lx"'
19874		uvXUformat='"lX"'
19875	else
19876		if $test X"$ivsize" = X"$intsize"; then
19877			ivdformat='"d"'
19878			uvuformat='"u"'
19879			uvoformat='"o"'
19880			uvxformat='"x"'
19881			uvXUformat='"X"'
19882		else
19883			: far out
19884			if $test X"$ivsize" = X"$shortsize"; then
19885				ivdformat='"hd"'
19886				uvuformat='"hu"'
19887				uvoformat='"ho"'
19888				uvxformat='"hx"'
19889				uvXUformat='"hX"'
19890			fi
19891		fi
19892	fi
19893fi
19894
19895if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19896	nveformat="$sPRIeldbl"
19897	nvfformat="$sPRIfldbl"
19898	nvgformat="$sPRIgldbl"
19899	nvEUformat="$sPRIEUldbl"
19900	nvFUformat="$sPRIFUldbl"
19901	nvGUformat="$sPRIGUldbl"
19902else
19903	nveformat='"e"'
19904	nvfformat='"f"'
19905	nvgformat='"g"'
19906	nvEUformat='"E"'
19907	nvFUformat='"F"'
19908	nvGUformat='"G"'
19909fi
19910
19911case "$ivdformat" in
19912'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19913    exit 1
19914    ;;
19915esac
19916
19917: Check format string for GID
19918
19919echo " "
19920$echo "Checking the format string to be used for gids..." >&4
19921
19922case "$gidsign" in
19923-1)	if $test X"$gidsize" = X"$ivsize"; then
19924		gidformat="$ivdformat"
19925	else
19926		if $test X"$gidsize" = X"$longsize"; then
19927			gidformat='"ld"'
19928		else
19929			if $test X"$gidsize" = X"$intsize"; then
19930				gidformat='"d"'
19931			else
19932				if $test X"$gidsize" = X"$shortsize"; then
19933					gidformat='"hd"'
19934				fi
19935			fi
19936		fi
19937	fi
19938	;;
19939*)	if $test X"$gidsize" = X"$uvsize"; then
19940		gidformat="$uvuformat"
19941	else
19942		if $test X"$gidsize" = X"$longsize"; then
19943			gidformat='"lu"'
19944		else
19945			if $test X"$gidsize" = X"$intsize"; then
19946				gidformat='"u"'
19947			else
19948				if $test X"$gidsize" = X"$shortsize"; then
19949					gidformat='"hu"'
19950				fi
19951			fi
19952		fi
19953	fi
19954	;;
19955esac
19956
19957: see if getgroups exists
19958set getgroups d_getgrps
19959eval $inlibc
19960
19961: see if setgroups exists
19962set setgroups d_setgrps
19963eval $inlibc
19964
19965: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19966echo " "
19967case "$d_getgrps$d_setgrps" in
19968*define*)
19969	case "$groupstype" in
19970	'') dflt="$gidtype" ;;
19971	*)  dflt="$groupstype" ;;
19972	esac
19973	$cat <<EOM
19974What type of pointer is the second argument to getgroups() and setgroups()?
19975Usually this is the same as group ids, $gidtype, but not always.
19976
19977EOM
19978	rp='What type pointer is the second argument to getgroups() and setgroups()?'
19979	. ./myread
19980	groupstype="$ans"
19981	;;
19982*)  groupstype="$gidtype";;
19983esac
19984
19985: MAD = Misc Attribute Definition
19986
19987if $test $patchlevel -lt 9; then
19988: MAD is not available in 5.8.x or earlier.
19989    ans=n;
19990else
19991    case "$mad" in
19992    $define|true|[yY]*)	dflt='y' ;;
19993    *)			dflt='n' ;;
19994    esac
19995    cat <<EOM
19996
19997Would you like to build with Misc Attribute Decoration? This is development
19998work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19999overhead on the interpreter.
20000
20001If this doesn't make any sense to you, just accept the default '$dflt'.
20002EOM
20003    rp='Build Perl with MAD?'
20004    . ./myread
20005fi
20006case "$ans" in
20007y|Y)	val="$define"
20008	madlyh='madly.h madly.act madly.tab'
20009	madlysrc='madly.c'
20010	madlyobj="madly$_o" ;;
20011*)	val="$undef"
20012	madlyh=''
20013	madlysrc=''
20014	madlyobj='' ;;
20015esac
20016set mad
20017eval $setvar
20018
20019: check whether make sets MAKE
20020echo " "
20021echo "Checking if your $make program sets \$(MAKE)..." >&4
20022case "$make_set_make" in
20023'')
20024	$sed 's/^X //' > testmake.mak << 'EOF'
20025Xall:
20026X 	@echo 'maketemp="$(MAKE)"'
20027EOF
20028	case "`$make -f testmake.mak 2>/dev/null`" in
20029	*maketemp=*) make_set_make='#' ;;
20030	*)	make_set_make="MAKE=$make" ;;
20031	esac
20032	$rm -f testmake.mak
20033	;;
20034esac
20035case "$make_set_make" in
20036'#') echo "Yup, it does.";;
20037*) echo "Nope, it doesn't.";;
20038esac
20039
20040: see what type is used for mode_t
20041rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20042set mode_t modetype int stdio.h sys/types.h
20043eval $typedef_ask
20044
20045: see if we need va_copy
20046echo " "
20047case "$i_stdarg" in
20048"$define")
20049	$cat >try.c <<EOCP
20050#include <stdarg.h>
20051#include <stdio.h>
20052#$i_stdlib I_STDLIB
20053#ifdef I_STDLIB
20054#include <stdlib.h>
20055#endif
20056#include <signal.h>
20057
20058int
20059ivfprintf(FILE *f, const char *fmt, va_list *valp)
20060{
20061  return vfprintf(f, fmt, *valp);
20062}
20063
20064int
20065myvfprintf(FILE *f, const  char *fmt, va_list val)
20066{
20067  return ivfprintf(f, fmt, &val);
20068}
20069
20070int
20071myprintf(char *fmt, ...)
20072{
20073  va_list val;
20074  va_start(val, fmt);
20075  return myvfprintf(stdout, fmt, val);
20076}
20077
20078int
20079main(int ac, char **av)
20080{
20081  signal(SIGSEGV, exit);
20082
20083  myprintf("%s%cs all right, then\n", "that", '\'');
20084  exit(0);
20085}
20086EOCP
20087	set try
20088	if eval $compile && $run ./try 2>&1 >/dev/null; then
20089		case "`$run ./try`" in
20090		"that's all right, then")
20091			okay=yes
20092			;;
20093		esac
20094	fi
20095	case "$okay" in
20096	yes)	echo "It seems that you don't need va_copy()." >&4
20097		need_va_copy="$undef"
20098		;;
20099	*)	echo "It seems that va_copy() or similar will be needed." >&4
20100		need_va_copy="$define"
20101		;;
20102	esac
20103	$rm_try
20104	;;
20105*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20106	;;
20107esac
20108
20109: see what type is used for size_t
20110rp="What is the type used for the length parameter for string functions?"
20111set size_t sizetype 'unsigned int' stdio.h sys/types.h
20112eval $typedef_ask
20113
20114: check for type of arguments to gethostbyaddr.
20115if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20116	case "$d_gethbyaddr" in
20117	$define)
20118		$cat <<EOM
20119
20120Checking to see what type of arguments are accepted by gethostbyaddr().
20121EOM
20122		hdrs="$define sys/types.h
20123			$d_socket sys/socket.h
20124			$i_niin netinet/in.h
20125			$i_netdb netdb.h
20126			$i_unistd unistd.h"
20127		: The first arg can 'char *' or 'void *'
20128		: The second arg is some of integral type
20129		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20130			for yyy in size_t long int; do
20131				case "$netdb_host_type" in
20132				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20133					if ./protochk "$try" $hdrs; then
20134						echo "Your system accepts $xxx for the first arg."
20135						echo "...and $yyy for the second arg."
20136						netdb_host_type="$xxx"
20137						netdb_hlen_type="$yyy"
20138					fi
20139					;;
20140				esac
20141			done
20142		done
20143		: In case none of those worked, prompt the user.
20144		case "$netdb_host_type" in
20145		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
20146			dflt='char *'
20147			. ./myread
20148			netdb_host_type=$ans
20149			rp='What is the type for the 2nd argument to gethostbyaddr?'
20150			dflt="$sizetype"
20151			. ./myread
20152			netdb_hlen_type=$ans
20153			;;
20154		esac
20155		;;
20156	*)	: no gethostbyaddr, so pick harmless defaults
20157		netdb_host_type='char *'
20158		netdb_hlen_type="$sizetype"
20159		;;
20160	esac
20161	# Remove the "const" if needed. -- but then we'll have a
20162	# prototype clash!
20163	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20164fi
20165
20166: check for type of argument to gethostbyname.
20167if test "X$netdb_name_type" = X ; then
20168	case "$d_gethbyname" in
20169	$define)
20170		$cat <<EOM
20171
20172Checking to see what type of argument is accepted by gethostbyname().
20173EOM
20174		hdrs="$define sys/types.h
20175			$d_socket sys/socket.h
20176			$i_niin netinet/in.h
20177			$i_netdb netdb.h
20178			$i_unistd unistd.h"
20179		for xxx in "const char *" "char *"; do
20180			case "$netdb_name_type" in
20181			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
20182				if ./protochk "$try" $hdrs; then
20183					echo "Your system accepts $xxx."
20184					netdb_name_type="$xxx"
20185				fi
20186				;;
20187			esac
20188		done
20189		: In case none of those worked, prompt the user.
20190		case "$netdb_name_type" in
20191		'')	rp='What is the type for the 1st argument to gethostbyname?'
20192			dflt='char *'
20193			. ./myread
20194			netdb_name_type=$ans
20195			;;
20196		esac
20197		;;
20198	*)	: no gethostbyname, so pick harmless default
20199		netdb_name_type='char *'
20200		;;
20201	esac
20202fi
20203
20204: check for type of 1st argument to getnetbyaddr.
20205if test "X$netdb_net_type" = X ; then
20206	case "$d_getnbyaddr" in
20207	$define)
20208		$cat <<EOM
20209
20210Checking to see what type of 1st argument is accepted by getnetbyaddr().
20211EOM
20212		hdrs="$define sys/types.h
20213			$d_socket sys/socket.h
20214			$i_niin netinet/in.h
20215			$i_netdb netdb.h
20216			$i_unistd unistd.h"
20217		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20218			case "$netdb_net_type" in
20219			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20220				if ./protochk "$try" $hdrs; then
20221					echo "Your system accepts $xxx."
20222					netdb_net_type="$xxx"
20223				fi
20224				;;
20225			esac
20226		done
20227		: In case none of those worked, prompt the user.
20228		case "$netdb_net_type" in
20229		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
20230			dflt='long'
20231			. ./myread
20232			netdb_net_type=$ans
20233			;;
20234		esac
20235		;;
20236	*)	: no getnetbyaddr, so pick harmless default
20237		netdb_net_type='long'
20238		;;
20239	esac
20240fi
20241: locate the preferred pager for this system
20242fn=f/
20243case "$pager" in
20244'')
20245	dflt=''
20246	case "$pg" in
20247	/*) dflt=$pg;;
20248	[a-zA-Z]:/*) dflt=$pg;;
20249	esac
20250	case "$more" in
20251	/*) dflt=$more;;
20252	[a-zA-Z]:/*) dflt=$more;;
20253	esac
20254	case "$less" in
20255	/*) dflt=$less;;
20256	[a-zA-Z]:/*) dflt=$less;;
20257	esac
20258	case "$dflt" in
20259	'') dflt=/usr/ucb/more;;
20260	esac
20261	;;
20262*)	dflt="$pager"
20263	fn="f/($pager)"
20264	;;
20265esac
20266echo " "
20267rp='What pager is used on your system?'
20268. ./getfile
20269pager="$ans"
20270
20271: see what type pids are declared as in the kernel
20272rp="What is the type of process ids on this system?"
20273set pid_t pidtype int stdio.h sys/types.h
20274eval $typedef_ask
20275
20276: see if ar generates random libraries by itself
20277echo " "
20278echo "Checking how to generate random libraries on your machine..." >&4
20279echo 'int bar1() { return bar2(); }' > bar1.c
20280echo 'int bar2() { return 2; }' > bar2.c
20281$cat > foo.c <<EOP
20282#$i_stdlib I_STDLIB
20283#ifdef I_STDLIB
20284#include <stdlib.h>
20285#endif
20286int main() { printf("%d\n", bar1()); exit(0); }
20287EOP
20288$cc $ccflags -c bar1.c >/dev/null 2>&1
20289$cc $ccflags -c bar2.c >/dev/null 2>&1
20290$cc $ccflags -c foo.c >/dev/null 2>&1
20291$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20292if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20293	$run ./foobar >/dev/null 2>&1; then
20294	echo "$ar appears to generate random libraries itself."
20295	orderlib=false
20296	if [ "X$ranlib" = "X" ]; then
20297	    ranlib=":"
20298	fi
20299elif $ar s bar$_a >/dev/null 2>&1 &&
20300	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20301	$run ./foobar >/dev/null 2>&1; then
20302		echo "a table of contents needs to be added with '$ar s'."
20303		orderlib=false
20304		ranlib="$ar s"
20305elif $ar ts bar$_a >/dev/null 2>&1 &&
20306	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20307	$run ./foobar >/dev/null 2>&1; then
20308		echo "a table of contents needs to be added with '$ar ts'."
20309		orderlib=false
20310		ranlib="$ar ts"
20311else
20312	case "$ranlib" in
20313	:) ranlib='';;
20314	'')
20315		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20316		$test -f $ranlib || ranlib=''
20317		;;
20318	esac
20319	if $test -n "$ranlib"; then
20320		echo "your system has '$ranlib'; we'll use that."
20321		orderlib=false
20322	else
20323		echo "your system doesn't seem to support random libraries"
20324		echo "so we'll use lorder and tsort to order the libraries."
20325		orderlib=true
20326		ranlib=":"
20327	fi
20328fi
20329$rm -f foo* bar*
20330
20331: see if this is a values.h system
20332set values.h i_values
20333eval $inhdr
20334
20335: Check the max offset that gmtime and localtime accept
20336echo "Checking max offsets that gmtime () accepts"
20337
20338case $i_values in
20339    define) yyy="#include <values.h>" ;;
20340    *)      yyy="" ;;
20341    esac
20342
20343case "$sGMTIME_min/$sGMTIME_max" in
20344    0/0|/)
20345	$cat >try.c <<EOCP
20346#include <sys/types.h>
20347#include <stdio.h>
20348#include <time.h>
20349$yyy
20350
20351int i;
20352struct tm *tmp;
20353time_t pt;
20354
20355void gm_check (time_t t, int min_year, int max_year)
20356{
20357    tmp = gmtime (&t);
20358    if ( tmp == NULL ||
20359	/* Check tm_year overflow */
20360	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20361	tmp = NULL;
20362    else
20363	pt = t;
20364    } /* gm_check */
20365
20366int check_max ()
20367{
20368    tmp = NULL;
20369    pt  = 0;
20370#ifdef MAXLONG
20371    gm_check (MAXLONG, 69, 0x7fffffff);
20372#endif
20373    if (tmp == NULL || tmp->tm_year < 0) {
20374	for (i = 63; i >= 0; i--) {
20375	    time_t x = pt | ((time_t)1 << i);
20376	    if (x < 0 || x < pt) continue;
20377	    gm_check (x, 69, 0x7fffffff);
20378	    }
20379	}
20380    printf ("sGMTIME_max=%ld\n", pt);
20381    return (0);
20382    } /* check_max */
20383
20384int check_min ()
20385{
20386    tmp = NULL;
20387    pt  = 0;
20388#ifdef MINLONG
20389    gm_check (MINLONG, -1900, 70);
20390#endif
20391    if (tmp == NULL) {
20392	for (i = 36; i >= 0; i--) {
20393	    time_t x = pt - ((time_t)1 << i);
20394	    if (x > 0) continue;
20395	    gm_check (x, -1900, 70);
20396	    }
20397	}
20398    printf ("sGMTIME_min=%ld\n", pt);
20399    return (0);
20400    } /* check_min */
20401
20402int main (int argc, char *argv[])
20403{
20404    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20405    check_max ();
20406    check_min ();
20407    return (0);
20408    } /* main */
20409EOCP
20410	set try
20411	if eval $compile; then
20412	    eval `$run ./try`
20413	else
20414	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20415	    fi
20416	$rm_try
20417	;;
20418    esac
20419
20420echo "Checking max offsets that localtime () accepts"
20421
20422case "$sLOCALTIME_min/$sLOCALTIME_max" in
20423    0/0|/)
20424	$cat >try.c <<EOCP
20425#include <sys/types.h>
20426#include <stdio.h>
20427#include <time.h>
20428$yyy
20429
20430int i;
20431struct tm *tmp;
20432time_t pt;
20433
20434void local_check (time_t t, int min_year, int max_year)
20435{
20436    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20437	tmp = NULL;
20438    else
20439	tmp = localtime (&t);
20440    if ( tmp == NULL ||
20441	/* Check tm_year overflow */
20442	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20443	tmp = NULL;
20444    else
20445	pt = t;
20446    } /* local_check */
20447
20448int check_max ()
20449{
20450    tmp = NULL;
20451    pt  = 0;
20452#ifdef MAXLONG
20453    local_check (MAXLONG, 69, 0x7fffffff);
20454#endif
20455    if (tmp == NULL || tmp->tm_year < 0) {
20456	for (i = 63; i >= 0; i--) {
20457	    time_t x = pt | ((time_t)1 << i);
20458	    if (x < 0 || x < pt) continue;
20459	    local_check (x, 69, 0x7fffffff);
20460	    }
20461	}
20462    printf ("sLOCALTIME_max=%ld\n", pt);
20463    return (0);
20464   } /* check_max */
20465
20466int check_min ()
20467{
20468    tmp = NULL;
20469    pt  = 0;
20470#ifdef MINLONG
20471    local_check (MINLONG, -1900, 70);
20472#endif
20473    if (tmp == NULL) {
20474	for (i = 36; i >= 0; i--) {
20475	    time_t x = pt - ((time_t)1 << i);
20476	    if (x > 0) continue;
20477	    local_check (x, -1900, 70);
20478	    }
20479	}
20480    printf ("sLOCALTIME_min=%ld\n", pt);
20481    return (0);
20482    } /* check_min */
20483
20484int main (int argc, char *argv[])
20485{
20486    check_max ();
20487    check_min ();
20488    return (0);
20489    } /* main */
20490EOCP
20491	set try
20492	if eval $compile; then
20493	    eval `$run ./try`
20494	else
20495	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20496	    fi
20497	$rm_try
20498	;;
20499    esac
20500
20501: check for type of arguments to select.
20502case "$selecttype" in
20503'') case "$d_select" in
20504	$define)
20505		echo " "
20506		$cat <<EOM
20507Checking to see what type of arguments are accepted by select().
20508EOM
20509		hdrs="$define sys/types.h
20510			$i_systime sys/time.h
20511			$i_sysselct sys/select.h
20512			$d_socket sys/socket.h"
20513		: The first arg can be int, unsigned, or size_t
20514		: The last arg may or may not be 'const'
20515		val=''
20516		: void pointer has been seen but using that
20517		: breaks the selectminbits test
20518		for xxx in 'fd_set *' 'int *'; do
20519			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20520				for tmo in 'struct timeval *' 'const struct timeval *'; do
20521					case "$val" in
20522					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20523						if ./protochk "$try" $hdrs; then
20524							echo "Your system accepts $xxx."
20525							val="$xxx"
20526						fi
20527						;;
20528					esac
20529				done
20530			done
20531		done
20532		case "$val" in
20533		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20534			case "$d_fd_set" in
20535				$define) dflt="fd_set *" ;;
20536				*)		dflt="int *" ;;
20537			esac
20538			. ./myread
20539			val=$ans
20540			;;
20541		esac
20542		selecttype="$val"
20543		;;
20544	*)	: no select, so pick a harmless default
20545		selecttype='int *'
20546		;;
20547	esac
20548	;;
20549esac
20550
20551: check for the select 'width'
20552case "$selectminbits" in
20553'') safebits=`expr $ptrsize \* 8`
20554    case "$d_select" in
20555	$define)
20556		$cat <<EOM
20557
20558Checking to see on how many bits at a time your select() operates...
20559EOM
20560		$cat >try.c <<EOCP
20561#include <sys/types.h>
20562#$i_time I_TIME
20563#$i_systime I_SYS_TIME
20564#$i_systimek I_SYS_TIME_KERNEL
20565#ifdef I_TIME
20566#   include <time.h>
20567#endif
20568#ifdef I_SYS_TIME
20569#   ifdef I_SYS_TIME_KERNEL
20570#	define KERNEL
20571#   endif
20572#   include <sys/time.h>
20573#   ifdef I_SYS_TIME_KERNEL
20574#	undef KERNEL
20575#   endif
20576#endif
20577#$i_sysselct I_SYS_SELECT
20578#ifdef I_SYS_SELECT
20579#include <sys/select.h>
20580#endif
20581#$d_socket HAS_SOCKET
20582#ifdef HAS_SOCKET
20583#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20584#endif
20585#include <stdio.h>
20586#$i_stdlib I_STDLIB
20587#ifdef I_STDLIB
20588#include <stdlib.h>
20589#endif
20590$selecttype b;
20591#define S sizeof(*(b))
20592#define MINBITS	64
20593#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20594#define NBITS  (NBYTES * 8)
20595int main() {
20596    char *s = (char *)malloc(NBYTES);
20597    struct timeval t;
20598    int i;
20599    FILE* fp;
20600    int fd;
20601
20602    if (!s)
20603	exit(1);
20604    fclose(stdin);
20605    fp = fopen("try.c", "r");
20606    if (fp == 0)
20607      exit(2);
20608    fd = fileno(fp);
20609    if (fd < 0)
20610      exit(3);
20611    b = ($selecttype)s;
20612    for (i = 0; i < NBITS; i++)
20613	FD_SET(i, b);
20614    t.tv_sec  = 0;
20615    t.tv_usec = 0;
20616    select(fd + 1, b, 0, 0, &t);
20617    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20618    free(s);
20619    printf("%d\n", i + 1);
20620    return 0;
20621}
20622EOCP
20623		set try
20624		if eval $compile_ok; then
20625			selectminbits=`$run ./try`
20626			case "$selectminbits" in
20627			'')	cat >&4 <<EOM
20628Cannot figure out on how many bits at a time your select() operates.
20629I'll play safe and guess it is $safebits bits.
20630EOM
20631				selectminbits=$safebits
20632				bits="$safebits bits"
20633				;;
20634			1)	bits="1 bit" ;;
20635			*)	bits="$selectminbits bits" ;;
20636			esac
20637			echo "Your select() operates on $bits at a time." >&4
20638		else
20639			rp='What is the minimum number of bits your select() operates on?'
20640			case "$byteorder" in
20641			12345678)	dflt=64 ;;
20642			1234)		dflt=32 ;;
20643			*)		dflt=1	;;
20644			esac
20645			. ./myread
20646			val=$ans
20647			selectminbits="$val"
20648		fi
20649		$rm_try
20650		;;
20651	*)	: no select, so pick a harmless default
20652		selectminbits=$safebits
20653		;;
20654	esac
20655	;;
20656esac
20657
20658: Trace out the files included by signal.h, then look for SIGxxx names.
20659if [ "X$fieldn" = X ]; then
20660	: Just make some guesses.  We check them later.
20661	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20662else
20663	xxx=`echo '#include <signal.h>' |
20664	$cppstdin $cppminus $cppflags 2>/dev/null |
20665	$grep '^[ 	]*#.*include' |
20666	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20667		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20668fi
20669xxxfiles=''
20670for xx in $xxx /dev/null ; do
20671	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
20672done
20673case "$xxxfiles" in
20674'')	xxxfiles=`./findhdr signal.h` ;;
20675esac
20676xxx=`awk '
20677$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20678	print substr($2, 4, 20)
20679}
20680$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20681	print substr($3, 4, 20)
20682}' $xxxfiles`
20683: Append some common names just in case the awk scan failed.
20684xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20685xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20686xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20687xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20688xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20689
20690: generate a few handy files for later
20691$cat > signal.c <<EOCP
20692#include <sys/types.h>
20693#include <signal.h>
20694#$i_stdlib I_STDLIB
20695#ifdef I_STDLIB
20696#include <stdlib.h>
20697#endif
20698#include <stdio.h>
20699int main() {
20700
20701/* Strange style to avoid deeply-nested #if/#else/#endif */
20702#ifndef NSIG
20703#  ifdef _NSIG
20704#    define NSIG (_NSIG)
20705#  endif
20706#endif
20707
20708#ifndef NSIG
20709#  ifdef SIGMAX
20710#    define NSIG (SIGMAX+1)
20711#  endif
20712#endif
20713
20714#ifndef NSIG
20715#  ifdef SIG_MAX
20716#    define NSIG (SIG_MAX+1)
20717#  endif
20718#endif
20719
20720#ifndef NSIG
20721#  ifdef _SIG_MAX
20722#    define NSIG (_SIG_MAX+1)
20723#  endif
20724#endif
20725
20726#ifndef NSIG
20727#  ifdef MAXSIG
20728#    define NSIG (MAXSIG+1)
20729#  endif
20730#endif
20731
20732#ifndef NSIG
20733#  ifdef MAX_SIG
20734#    define NSIG (MAX_SIG+1)
20735#  endif
20736#endif
20737
20738#ifndef NSIG
20739#  ifdef SIGARRAYSIZE
20740#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20741#  endif
20742#endif
20743
20744#ifndef NSIG
20745#  ifdef _sys_nsig
20746#    define NSIG (_sys_nsig) /* Solaris 2.5 */
20747#  endif
20748#endif
20749
20750/* Default to some arbitrary number that's big enough to get most
20751   of the common signals.
20752*/
20753#ifndef NSIG
20754#    define NSIG 50
20755#endif
20756
20757printf("NSIG %d\n", NSIG);
20758
20759#ifndef JUST_NSIG
20760
20761EOCP
20762
20763echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20764{
20765	printf "#ifdef SIG"; printf $1; printf "\n"
20766	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20767	printf $1; printf ");\n"
20768	printf "#endif\n"
20769}
20770END {
20771	printf "#endif /* JUST_NSIG */\n";
20772	printf "exit(0);\n}\n";
20773}
20774' >>signal.c
20775$cat >signal.awk <<'EOP'
20776BEGIN { ndups = 0 }
20777$1 ~ /^NSIG$/ { nsig = $2 }
20778($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20779    if ($2 > maxsig) { maxsig = $2 }
20780    if (sig_name[$2]) {
20781	dup_name[ndups] = $1
20782	dup_num[ndups] = $2
20783	ndups++
20784    }
20785    else {
20786	sig_name[$2] = $1
20787	sig_num[$2] = $2
20788    }
20789}
20790END {
20791    if (nsig == 0) {
20792    	nsig = maxsig + 1
20793    }
20794    printf("NSIG %d\n", nsig);
20795    for (n = 1; n < nsig; n++) {
20796 	if (sig_name[n]) {
20797 	    printf("%s %d\n", sig_name[n], sig_num[n])
20798	}
20799 	else {
20800 	    printf("NUM%d %d\n", n, n)
20801 	}
20802    }
20803    for (n = 0; n < ndups; n++) {
20804 	printf("%s %d\n", dup_name[n], dup_num[n])
20805    }
20806}
20807EOP
20808$cat >signal_cmd <<EOS
20809$startsh
20810if $test -s signal.lst; then
20811    echo "Using your existing signal.lst file"
20812	exit 0
20813fi
20814xxx="$xxx"
20815EOS
20816$cat >>signal_cmd <<'EOS'
20817
20818set signal
20819if eval $compile_ok; then
20820	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20821		$uniq | $awk -f signal.awk >signal.lst
20822else
20823	echo "(I can't seem be able to compile the whole test program)" >&4
20824	echo "(I'll try it in little pieces.)" >&4
20825	set signal -DJUST_NSIG
20826	if eval $compile_ok; then
20827		$run ./signal$_exe > signal.nsg
20828		$cat signal.nsg
20829	else
20830		echo "I can't seem to figure out how many signals you have." >&4
20831		echo "Guessing 50." >&4
20832		echo 'NSIG 50' > signal.nsg
20833	fi
20834	: Now look at all the signal names, one at a time.
20835	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20836		$cat > signal.c <<EOCP
20837#include <sys/types.h>
20838#include <signal.h>
20839#include <stdio.h>
20840int main() {
20841printf("$xx %d\n", SIG${xx});
20842return 0;
20843}
20844EOCP
20845		set signal
20846		if eval $compile; then
20847			echo "SIG${xx} found."
20848			$run ./signal$_exe  >> signal.ls1
20849		else
20850			echo "SIG${xx} NOT found."
20851		fi
20852	done
20853	if $test -s signal.ls1; then
20854		$cat signal.nsg signal.ls1 |
20855			$sort -n | $uniq | $awk -f signal.awk >signal.lst
20856	fi
20857
20858fi
20859if $test -s signal.lst; then
20860	:
20861else
20862	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20863	echo 'kill -l' >signal
20864	set X `csh -f <signal`
20865	$rm -f signal
20866	shift
20867	case $# in
20868	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20869	esac
20870	echo $@ | $tr ' ' $trnl | \
20871 	    $awk '{ printf "%s %d\n", $1, ++s; }
20872 		  END { printf "NSIG %d\n", ++s }' >signal.lst
20873fi
20874$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20875EOS
20876chmod a+x signal_cmd
20877$eunicefix signal_cmd
20878
20879: generate list of signal names
20880echo " "
20881case "$sig_name_init" in
20882'') doinit=yes ;;
20883*)  case "$sig_num_init" in
20884    ''|*,*) doinit=yes ;;
20885    esac ;;
20886esac
20887case "$doinit" in
20888yes)
20889	echo "Generating a list of signal names and numbers..." >&4
20890	. ./signal_cmd
20891 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20892 	sig_name=`$awk 'BEGIN { printf "ZERO " }
20893 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
20894 	sig_num=`$awk  'BEGIN { printf "0 " }
20895 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
20896 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
20897 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
20898 			     END	{ printf "0\n" }' signal.lst`
20899 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
20900 			     !/^NSIG/	{ printf "%d, ", $2}
20901 			     END	{ printf "0\n"}' signal.lst`
20902	;;
20903esac
20904echo "The following $sig_count signals are available:"
20905echo " "
20906echo $sig_name | $awk \
20907'BEGIN { linelen = 0 }
20908{
20909	for (i = 1; i <= NF; i++) {
20910		name = "SIG" $i " "
20911		linelen = linelen + length(name)
20912		if (linelen > 70) {
20913			printf "\n"
20914			linelen = length(name)
20915		}
20916		printf "%s", name
20917	}
20918	printf "\n"
20919}'
20920sig_size=`echo $sig_name | awk '{print NF}'`
20921$rm -f signal signal.c signal.awk signal.lst signal_cmd
20922
20923: Check size of size
20924echo " "
20925case "$sizetype" in
20926*_t) zzz="$sizetype"	;;
20927*)   zzz="filesize"	;;
20928esac
20929echo "Checking the size of $zzz..." >&4
20930cat > try.c <<EOCP
20931#include <sys/types.h>
20932#include <stdio.h>
20933#$i_stdlib I_STDLIB
20934#ifdef I_STDLIB
20935#include <stdlib.h>
20936#endif
20937int main() {
20938    printf("%d\n", (int)sizeof($sizetype));
20939    exit(0);
20940}
20941EOCP
20942set try
20943if eval $compile_ok; then
20944	yyy=`$run ./try`
20945	case "$yyy" in
20946	'')	sizesize=4
20947		echo "(I can't execute the test program--guessing $sizesize.)" >&4
20948		;;
20949	*)	sizesize=$yyy
20950		echo "Your $zzz size is $sizesize bytes."
20951		;;
20952	esac
20953else
20954	sizesize=4
20955	echo "(I can't compile the test program--guessing $sizesize.)" >&4
20956fi
20957
20958
20959: check for socklen_t
20960echo " "
20961echo "Checking to see if you have socklen_t..." >&4
20962$cat >try.c <<EOCP
20963#include <sys/types.h>
20964#$d_socket HAS_SOCKET
20965#ifdef HAS_SOCKET
20966#include <sys/socket.h>
20967#endif
20968int main() { socklen_t x = 16; }
20969EOCP
20970set try
20971if eval $compile; then
20972	val="$define"
20973	echo "You have socklen_t."
20974else
20975	val="$undef"
20976	echo "You do not have socklen_t."
20977	case "$sizetype" in
20978	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20979	esac
20980fi
20981$rm_try
20982set d_socklen_t
20983eval $setvar
20984
20985: see if this is a socks.h system
20986set socks.h i_socks
20987eval $inhdr
20988
20989: check for type of the size argument to socket calls
20990case "$d_socket" in
20991"$define")
20992	$cat <<EOM
20993
20994Checking to see what type is the last argument of accept().
20995EOM
20996	yyy=''
20997	case "$d_socklen_t" in
20998	"$define") yyy="$yyy socklen_t"
20999	esac
21000	yyy="$yyy $sizetype int long unsigned"
21001	for xxx in $yyy; do
21002		case "$socksizetype" in
21003		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21004			case "$usesocks" in
21005			"$define")
21006				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21007					echo "Your system accepts '$xxx *' for the last argument of accept()."
21008					socksizetype="$xxx"
21009				fi
21010				;;
21011			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21012					echo "Your system accepts '$xxx *' for the last argument of accept()."
21013					socksizetype="$xxx"
21014				fi
21015				;;
21016			esac
21017			;;
21018		esac
21019	done
21020: In case none of those worked, prompt the user.
21021	case "$socksizetype" in
21022	'')	rp='What is the type for socket address structure sizes?'
21023		dflt='int'
21024		. ./myread
21025		socksizetype=$ans
21026		;;
21027	esac
21028	;;
21029*)	: no sockets, so pick relatively harmless default
21030	socksizetype='int'
21031	;;
21032esac
21033
21034: see what type is used for signed size_t
21035set ssize_t ssizetype int stdio.h sys/types.h
21036eval $typedef
21037dflt="$ssizetype"
21038$cat > try.c <<EOM
21039#include <stdio.h>
21040#$i_stdlib I_STDLIB
21041#ifdef I_STDLIB
21042#include <stdlib.h>
21043#endif
21044#include <sys/types.h>
21045#define Size_t $sizetype
21046#define SSize_t $dflt
21047int main()
21048{
21049	if (sizeof(Size_t) == sizeof(SSize_t))
21050		printf("$dflt\n");
21051	else if (sizeof(Size_t) == sizeof(int))
21052		printf("int\n");
21053	else
21054		printf("long\n");
21055	exit(0);
21056}
21057EOM
21058echo " "
21059set try
21060if eval $compile_ok && $run ./try > /dev/null; then
21061	ssizetype=`$run ./try`
21062	echo "I'll be using $ssizetype for functions returning a byte count." >&4
21063else
21064	$cat >&4 <<EOM
21065Help! I can't compile and run the ssize_t test program: please enlighten me!
21066(This is probably a misconfiguration in your system or libraries, and
21067you really ought to fix it.  Still, I'll try anyway.)
21068
21069I need a type that is the same size as $sizetype, but is guaranteed to
21070be signed.  Common values are ssize_t, int and long.
21071
21072EOM
21073	rp="What signed type is the same size as $sizetype?"
21074	. ./myread
21075	ssizetype="$ans"
21076fi
21077$rm_try
21078
21079: see what type of char stdio uses.
21080echo " "
21081echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21082if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21083	echo "Your stdio uses unsigned chars." >&4
21084	stdchar="unsigned char"
21085else
21086	echo "Your stdio uses signed chars." >&4
21087	stdchar="char"
21088fi
21089$rm -f stdioh
21090
21091: see what type uids are declared as in the kernel
21092echo " "
21093echo "Looking for the type for user ids returned by getuid()."
21094set uid_t uidtype xxx stdio.h sys/types.h
21095eval $typedef
21096case "$uidtype" in
21097xxx)
21098	xxx=`./findhdr sys/user.h`
21099	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21100	case $1 in
21101	unsigned) dflt="$1 $2" ;;
21102	*) dflt="$1" ;;
21103	esac
21104	;;
21105*) dflt="$uidtype";;
21106esac
21107case "$uidtype" in
21108uid_t)	echo "uid_t found." ;;
21109*)	rp="What is the type for user ids returned by getuid()?"
21110	. ./myread
21111	uidtype="$ans"
21112	;;
21113esac
21114
21115: Check size of UID
21116echo " "
21117case "$uidtype" in
21118*_t) zzz="$uidtype"	;;
21119*)   zzz="uid"		;;
21120esac
21121echo "Checking the size of $zzz..." >&4
21122cat > try.c <<EOCP
21123#include <sys/types.h>
21124#include <stdio.h>
21125#$i_stdlib I_STDLIB
21126#ifdef I_STDLIB
21127#include <stdlib.h>
21128#endif
21129int main() {
21130    printf("%d\n", (int)sizeof($uidtype));
21131    exit(0);
21132}
21133EOCP
21134set try
21135if eval $compile_ok; then
21136	yyy=`$run ./try`
21137	case "$yyy" in
21138	'')	uidsize=4
21139		echo "(I can't execute the test program--guessing $uidsize.)" >&4
21140		;;
21141	*)	uidsize=$yyy
21142		echo "Your $zzz is $uidsize bytes long."
21143		;;
21144	esac
21145else
21146	uidsize=4
21147	echo "(I can't compile the test program--guessing $uidsize.)" >&4
21148fi
21149
21150: Check if UID is signed
21151echo " "
21152case "$uidtype" in
21153*_t) zzz="$uidtype"	;;
21154*)   zzz="uid"		;;
21155esac
21156echo "Checking the sign of $zzz..." >&4
21157cat > try.c <<EOCP
21158#include <sys/types.h>
21159#include <stdio.h>
21160int main() {
21161	$uidtype foo = -1;
21162	if (foo < 0)
21163		printf("-1\n");
21164	else
21165		printf("1\n");
21166}
21167EOCP
21168set try
21169if eval $compile; then
21170	yyy=`$run ./try`
21171	case "$yyy" in
21172	'')	uidsign=1
21173		echo "(I can't execute the test program--guessing unsigned.)" >&4
21174		;;
21175	*)	uidsign=$yyy
21176		case "$uidsign" in
21177		 1) echo "Your $zzz is unsigned." ;;
21178		-1) echo "Your $zzz is signed."   ;;
21179		esac
21180		;;
21181	esac
21182else
21183	uidsign=1
21184	echo "(I can't compile the test program--guessing unsigned.)" >&4
21185fi
21186
21187
21188: Check format string for UID
21189echo " "
21190$echo "Checking the format string to be used for uids..." >&4
21191
21192case "$uidsign" in
21193-1)	if $test X"$uidsize" = X"$ivsize"; then
21194		uidformat="$ivdformat"
21195	else
21196		if $test X"$uidsize" = X"$longsize"; then
21197			uidformat='"ld"'
21198		else
21199			if $test X"$uidsize" = X"$intsize"; then
21200				uidformat='"d"'
21201			else
21202				if $test X"$uidsize" = X"$shortsize"; then
21203					uidformat='"hd"'
21204				fi
21205			fi
21206		fi
21207	fi
21208	;;
21209*)	if $test X"$uidsize" = X"$uvsize"; then
21210		uidformat="$uvuformat"
21211	else
21212		if $test X"$uidsize" = X"$longsize"; then
21213			uidformat='"lu"'
21214		else
21215			if $test X"$uidsize" = X"$intsize"; then
21216				uidformat='"u"'
21217			else
21218				if $test X"$uidsize" = X"$shortsize"; then
21219					uidformat='"hu"'
21220				fi
21221			fi
21222		fi
21223	fi
21224	;;
21225esac
21226
21227: Check if site customization support was requested
21228case "$usesitecustomize" in
21229    $define|true|[Yy]*)
21230	usesitecustomize="$define"
21231	;;
21232    *)
21233	usesitecustomize="$undef"
21234	;;
21235    esac
21236
21237: see if prototypes support variable argument declarations
21238echo " "
21239case "$prototype$i_stdarg" in
21240$define$define)
21241	echo "It appears we'll be able to prototype varargs functions." >&4
21242	val="$define"
21243	;;
21244*)
21245	echo "Too bad... We won't be using prototyped varargs functions..." >&4
21246	val="$undef"
21247	;;
21248esac
21249set vaproto
21250eval $setvar
21251
21252: determine compiler compiler
21253case "$yacc" in
21254'')
21255	dflt=yacc;;
21256*)
21257	dflt="$yacc";;
21258esac
21259echo " "
21260comp='yacc'
21261if $test -f "$byacc$_exe"; then
21262	dflt="$byacc"
21263	comp="byacc or $comp"
21264fi
21265if $test -f "$bison$_exe"; then
21266	comp="$comp or bison -y"
21267fi
21268rp="Which compiler compiler ($comp) shall I use?"
21269. ./myread
21270yacc="$ans"
21271case "$yacc" in
21272*bis*)
21273	case "$yacc" in
21274	*-y*) ;;
21275	*)
21276		yacc="$yacc -y"
21277		echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21278		;;
21279	esac
21280	;;
21281esac
21282
21283: see if this is a assert.h system
21284set assert.h i_assert
21285eval $inhdr
21286
21287: see if this is a fp.h system
21288set fp.h i_fp
21289eval $inhdr
21290
21291: see if this is a fp_class.h system
21292set fp_class.h i_fp_class
21293eval $inhdr
21294
21295: see if gdbm.h is available
21296set gdbm.h t_gdbm
21297eval $inhdr
21298case "$t_gdbm" in
21299$define)
21300	: see if gdbm_open exists
21301	set gdbm_open d_gdbm_open
21302	eval $inlibc
21303	case "$d_gdbm_open" in
21304	$undef)
21305		t_gdbm="$undef"
21306		echo "We won't be including <gdbm.h>"
21307		;;
21308	esac
21309	;;
21310esac
21311val="$t_gdbm"
21312set i_gdbm
21313eval $setvar
21314
21315: see if this is a ieeefp.h system
21316case "$i_ieeefp" in
21317'' ) set ieeefp.h i_ieeefp
21318     eval $inhdr
21319     ;;
21320esac
21321
21322: see if this is a libutil.h system
21323set libutil.h i_libutil
21324eval $inhdr
21325
21326: see if mach cthreads are available
21327if test "X$usethreads" = "X$define"; then
21328	set mach/cthreads.h i_machcthr
21329	eval $inhdr
21330else
21331	i_machcthr="$undef"
21332fi
21333
21334: see if this is a mntent.h system
21335set mntent.h i_mntent
21336eval $inhdr
21337
21338: see if net/errno.h is available
21339val=''
21340set net/errno.h val
21341eval $inhdr
21342
21343: Unfortunately, it causes problems on some systems.  Arrgh.
21344case "$val" in
21345$define)
21346	cat > try.c <<'EOM'
21347#include <stdio.h>
21348#include <errno.h>
21349#include <net/errno.h>
21350int func()
21351{
21352	return ENOTSOCK;
21353}
21354EOM
21355	if $cc $ccflags -c try.c >/dev/null 2>&1; then
21356		echo "We'll be including <net/errno.h>." >&4
21357	else
21358		echo "We won't be including <net/errno.h>." >&4
21359		val="$undef"
21360	fi
21361	$rm_try
21362	;;
21363esac
21364set i_neterrno
21365eval $setvar
21366
21367: see if netinet/tcp.h is available
21368set netinet/tcp.h i_netinettcp
21369eval $inhdr
21370
21371: see if this is a poll.h system
21372set poll.h i_poll
21373eval $inhdr
21374
21375: see if this is a prot.h system
21376set prot.h i_prot
21377eval $inhdr
21378
21379: Preprocessor symbols
21380echo " "
21381$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21382$cat <<'EOSH' > Cppsym.know
21383a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21384AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21385alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21386ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21387BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21388BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21389bull c cadmus clipper CMU COFF COMPILER_VERSION
21390concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21391CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21392Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21393FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21394GLIBC GLIBC_MINOR
21395GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21396H3050R H3050RX hbullx20 hcx host_mips
21397hp200 hp300 hp700 HP700 hp800 hp9000
21398hp9000s200 hp9000s300 hp9000s400 hp9000s500
21399hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21400i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21401IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21402INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21403LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21404LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21405LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21406LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21407M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21408M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21409M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21410MATH_HAS_NO_SIDE_EFFECTS
21411mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21412mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21413mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21414MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21415mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21416NetBSD news1500 news1700 news1800 news1900 news3700
21417news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21418ns32016 ns32332 ns32k nsc32000
21419OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21420pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21421pc532 pdp11 PGC PIC plexus PORTAR posix
21422POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21423POSIX_C_SOURCE POSIX_SOURCE POWER
21424PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21425riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21426SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21427sony sony_news sonyrisc sparc sparclite spectrum
21428stardent stdc STDC_EXT stratos sun sun3 sun386
21429Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21430SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21431SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21432sysV68 sysV88 Tek4132 Tek4300 titan
21433TM3200 TM5400 TM5600
21434tower tower32 tower32_200 tower32_600 tower32_700
21435tower32_800 tower32_850 tss
21436u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21437ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21438unix UNIX95 UNIX99 unixpc unos
21439USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21440USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21441USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21442USGr4 USGr4_2
21443Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21444XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21445XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21446z8000
21447EOSH
21448# Maybe put other stuff here too.
21449cat <<EOSH >>Cppsym.know
21450$osname
21451EOSH
21452./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21453./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21454$cat Cppsym.know > Cppsym.c
21455$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21456$rm -f Cppsym.a Cppsym.b Cppsym.c
21457cat <<EOSH > Cppsym
21458$startsh
21459if $test \$# -gt 0; then
21460    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21461    if $test -s Cppsym.got; then
21462        $rm -f Cppsym.got
21463        exit 0
21464    fi
21465    $rm -f Cppsym.got
21466    exit 1
21467else
21468    $tr " " "$trnl" | ./Cppsym.try
21469    exit 0
21470fi
21471EOSH
21472chmod +x Cppsym
21473$eunicefix Cppsym
21474cat <<EOSH > Cppsym.try
21475$startsh
21476cat <<'EOCP' > try.c
21477#include <stdio.h>
21478#if cpp_stuff == 1
21479#define STRINGIFY(a)    "a"
21480#endif
21481#if cpp_stuff == 42
21482#define StGiFy(a)  #a
21483#define STRINGIFY(a)    StGiFy(a)
21484#endif
21485#if $cpp_stuff != 1 && $cpp_stuff != 42
21486#   include "Bletch: How does this C preprocessor stringify macros?"
21487#endif
21488int main() {
21489EOCP
21490$awk \\
21491EOSH
21492cat <<'EOSH' >> Cppsym.try
21493'length($1) > 0 {
21494    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21495    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21496    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21497    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21498}'	 >> try.c
21499echo 'return 0;}' >> try.c
21500EOSH
21501cat <<EOSH >> Cppsym.try
21502ccflags="$ccflags"
21503case "$osname-$gccversion" in
21504irix-) ccflags="\$ccflags -woff 1178" ;;
21505os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21506esac
21507$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21508EOSH
21509chmod +x Cppsym.try
21510$eunicefix Cppsym.try
21511./Cppsym < Cppsym.know > Cppsym.true
21512: Add in any linux cpp "predefined macros":
21513case "$osname::$gccversion" in
21514  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21515    tHdrH=_tmpHdr
21516    rm -f $tHdrH'.h' $tHdrH
21517    touch $tHdrH'.h'
21518    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21519       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21520       if [ -s $tHdrH'_cppsym.real' ]; then
21521	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21522       fi
21523    fi
21524    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21525  ;;
21526esac
21527: now check the C compiler for additional symbols
21528postprocess_cc_v=''
21529case "$osname" in
21530aix) postprocess_cc_v="|$tr , ' '" ;;
21531esac
21532$cat >ccsym <<EOS
21533$startsh
21534$cat >tmp.c <<EOF
21535extern int foo;
21536EOF
21537for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21538do
21539	case "\$i" in
21540	-D*) echo "\$i" | $sed 's/^-D//';;
21541	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21542	esac
21543done
21544$rm_try
21545EOS
21546postprocess_cc_v=''
21547chmod +x ccsym
21548$eunicefix ccsym
21549./ccsym > ccsym1.raw
21550if $test -s ccsym1.raw; then
21551       $sort ccsym1.raw | $uniq >ccsym.raw
21552else
21553       mv ccsym1.raw ccsym.raw
21554fi
21555
21556$awk '/\=/ { print $0; next }
21557	{ print $0"=1" }' ccsym.raw >ccsym.list
21558$comm -13 Cppsym.true ccsym.list >ccsym.own
21559$comm -12 Cppsym.true ccsym.list >ccsym.com
21560$comm -23 Cppsym.true ccsym.list >ccsym.cpp
21561also=''
21562if $test -z ccsym.raw; then
21563	echo "Your C compiler doesn't seem to define any symbols!" >&4
21564	echo " "
21565	echo "However, your C preprocessor defines the following symbols:"
21566	$cat Cppsym.true
21567    	ccsymbols=''
21568	cppsymbols=`$cat Cppsym.true`
21569        cppsymbols=`echo $cppsymbols`
21570	cppccsymbols="$cppsymbols"
21571else
21572	if $test -s ccsym.com; then
21573		echo "Your C compiler and pre-processor define these symbols:"
21574		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
21575		also='also '
21576		symbols='ones'
21577		cppccsymbols=`$cat ccsym.com`
21578		cppccsymbols=`echo $cppccsymbols`
21579		$test "$silent" || sleep 1
21580	fi
21581	if $test -s ccsym.cpp; then
21582		$test "$also" && echo " "
21583		echo "Your C pre-processor ${also}defines the following symbols:"
21584		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21585		also='further '
21586		cppsymbols=`$cat ccsym.cpp`
21587		cppsymbols=`echo $cppsymbols`
21588		$test "$silent" || sleep 1
21589	fi
21590	if $test -s ccsym.own; then
21591		$test "$also" && echo " "
21592		echo "Your C compiler ${also}defines the following cpp symbols:"
21593		$sed -e 's/\(..*\)=1/\1/' ccsym.own
21594		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21595	        ccsymbols=`$cat ccsym.own`
21596	        ccsymbols=`echo $ccsymbols`
21597		$test "$silent" || sleep 1
21598	fi
21599fi
21600
21601: see if this is a termio system
21602val="$undef"
21603val2="$undef"
21604val3="$undef"
21605if $test `./findhdr termios.h`; then
21606	set tcsetattr i_termios
21607	eval $inlibc
21608	val3="$i_termios"
21609fi
21610echo " "
21611case "$val3" in
21612"$define") echo "You have POSIX termios.h... good!" >&4;;
21613*) if ./Cppsym pyr; then
21614		case "`/bin/universe`" in
21615		ucb) if $test `./findhdr sgtty.h`; then
21616				val2="$define"
21617				echo "<sgtty.h> found." >&4
21618			else
21619				echo "System is pyramid with BSD universe."
21620				./warn "<sgtty.h> not found--you could have problems."
21621			fi;;
21622		*) if $test `./findhdr termio.h`; then
21623				val="$define"
21624				echo "<termio.h> found." >&4
21625			else
21626				echo "System is pyramid with USG universe."
21627				./warn "<termio.h> not found--you could have problems."
21628			fi;;
21629		esac
21630	elif ./usg; then
21631		if $test `./findhdr termio.h`; then
21632			echo "<termio.h> found." >&4
21633			val="$define"
21634		elif $test `./findhdr sgtty.h`; then
21635			echo "<sgtty.h> found." >&4
21636			val2="$define"
21637		else
21638			./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21639		fi
21640	else
21641		if $test `./findhdr sgtty.h`; then
21642			echo "<sgtty.h> found." >&4
21643			val2="$define"
21644		elif $test `./findhdr termio.h`; then
21645			echo "<termio.h> found." >&4
21646			val="$define"
21647		else
21648			./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21649		fi
21650	fi;;
21651esac
21652set i_termio; eval $setvar
21653val=$val2; set i_sgtty; eval $setvar
21654val=$val3; set i_termios; eval $setvar
21655
21656: see if stddef is available
21657set stddef.h i_stddef
21658eval $inhdr
21659
21660: see if sys/access.h is available
21661set sys/access.h i_sysaccess
21662eval $inhdr
21663
21664: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21665set sys/filio.h i_sysfilio
21666eval $inhdr
21667echo " "
21668if $test `./findhdr sys/ioctl.h`; then
21669	val="$define"
21670	echo '<sys/ioctl.h> found.' >&4
21671else
21672	val="$undef"
21673	if $test $i_sysfilio = "$define"; then
21674	    echo '<sys/ioctl.h> NOT found.' >&4
21675	else
21676		$test $i_sgtty = "$define" && xxx="sgtty.h"
21677		$test $i_termio = "$define" && xxx="termio.h"
21678		$test $i_termios = "$define" && xxx="termios.h"
21679echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21680	fi
21681fi
21682set i_sysioctl
21683eval $setvar
21684
21685: see if socket ioctl defs are in sys/sockio.h
21686echo " "
21687xxx=`./findhdr sys/sockio.h`
21688if $test "$xxx"; then
21689	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21690		val="$define"
21691		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21692	else
21693		val="$undef"
21694		echo "No socket ioctls found in <sys/sockio.h>." >&4
21695	fi
21696else
21697	val="$undef"
21698	$cat <<EOM
21699<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21700EOM
21701fi
21702set i_syssockio
21703eval $setvar
21704
21705: see if this is a syslog.h system
21706set syslog.h i_syslog
21707eval $inhdr
21708
21709: see if this is a sys/mode.h system
21710set sys/mode.h i_sysmode
21711eval $inhdr
21712
21713: see if there is a sys/poll.h file
21714set sys/poll.h i_syspoll
21715eval $inhdr
21716
21717: see if sys/resource.h has to be included
21718set sys/resource.h i_sysresrc
21719eval $inhdr
21720
21721: see if sys/security.h is available
21722set sys/security.h i_syssecrt
21723eval $inhdr
21724
21725: see if this is a sys/statvfs.h system
21726set sys/statvfs.h i_sysstatvfs
21727eval $inhdr
21728
21729: see if this is a sys/un.h system
21730set sys/un.h i_sysun
21731eval $inhdr
21732
21733: see if this is a sys/utsname.h system
21734set sys/utsname.h i_sysutsname
21735eval $inhdr
21736
21737: see if this is a syswait system
21738set sys/wait.h i_syswait
21739eval $inhdr
21740
21741: see if this is a ustat.h system
21742set ustat.h i_ustat
21743eval $inhdr
21744
21745: see if this is an utime system
21746set utime.h i_utime
21747eval $inhdr
21748
21749: see if this is a vfork system
21750case "$d_vfork" in
21751"$define")
21752	set vfork.h i_vfork
21753	eval $inhdr
21754	;;
21755*)
21756	i_vfork="$undef"
21757	;;
21758esac
21759
21760: Check extensions
21761echo " "
21762echo "Looking for extensions..." >&4
21763: If we are using the old config.sh, known_extensions may contain
21764: old or inaccurate or duplicate values.
21765known_extensions=''
21766nonxs_extensions=''
21767: We do not use find because it might not be available.
21768: We do not just use MANIFEST because the user may have dropped
21769: some additional extensions into the source tree and expect them
21770: to be built.
21771
21772: Function to recursively find available extensions, ignoring DynaLoader
21773: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21774: In 5.10.1 and later, extensions are stored in directories
21775: like File-Glob instead of the older File/Glob/.
21776find_extensions='
21777    for xxx in *; do
21778	case "$xxx" in
21779	    DynaLoader|dynaload) ;;
21780	    *)
21781	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21782	    leaf=`echo $xxx | $sed -e s/.*-//`;
21783	    if $test -d File; then
21784		if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21785		    known_extensions="$known_extensions $1$this_ext";
21786		elif $test -f $xxx/Makefile.PL; then
21787		    nonxs_extensions="$nonxs_extensions $1$this_ext";
21788		else
21789		    if $test -d $xxx -a $# -lt 10; then
21790			set $1$xxx/ $*;
21791			cd "$xxx";
21792			eval $find_extensions;
21793			cd ..;
21794			shift;
21795		    fi;
21796		fi;
21797	    else
21798		$ls -1 $xxx > $$.tmp;
21799		if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21800		    known_extensions="$known_extensions $this_ext";
21801		elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21802		    known_extensions="$known_extensions $this_ext";
21803		elif $test -d $xxx; then
21804		    nonxs_extensions="$nonxs_extensions $this_ext";
21805		fi;
21806		$rm -f $$.tmp;
21807	    fi
21808	    ;;
21809	esac;
21810    done'
21811tdir=`pwd`
21812cd "$rsrc/cpan"
21813set X
21814shift
21815eval $find_extensions
21816cd "$rsrc/dist"
21817set X
21818shift
21819eval $find_extensions
21820cd "$rsrc/ext"
21821set X
21822shift
21823eval $find_extensions
21824if $test -d File-Glob; then
21825    : All ext/ flattened
21826else
21827    # Special case:  Add in modules that nest beyond the first level.
21828    # Currently threads/shared and Hash/Util/FieldHash, since they are
21829    # not picked up by the recursive find above (and adding in general
21830    # recursive finding breaks SDBM_File/sdbm).
21831    # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21832    known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21833fi
21834set X $known_extensions
21835shift
21836known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21837set X $nonxs_extensions
21838shift
21839nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21840cd "$tdir"
21841
21842: Now see which are supported on this system.
21843avail_ext=''
21844for xxx in $known_extensions ; do
21845	case "$xxx" in
21846	DB_File|db_file)
21847		case "$i_db" in
21848		$define) avail_ext="$avail_ext $xxx" ;;
21849		esac
21850		;;
21851	GDBM_File|gdbm_fil)
21852		case "$i_gdbm" in
21853		$define) avail_ext="$avail_ext $xxx" ;;
21854		esac
21855		;;
21856	I18N/Langinfo|i18n_lan)
21857		case "$i_langinfo$d_nl_langinfo" in
21858		$define$define) avail_ext="$avail_ext $xxx" ;;
21859		esac
21860		;;
21861	IPC/SysV|ipc/sysv)
21862		: XXX Do we need a useipcsysv variable here
21863		case "${d_msg}${d_sem}${d_shm}" in
21864		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
21865		esac
21866		;;
21867	NDBM_File|ndbm_fil)
21868		case "$d_ndbm" in
21869		$define)
21870		    case "$osname-$use64bitint" in
21871		    hpux-define)
21872			case "$libs" in
21873			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
21874			esac
21875			;;
21876		    *) avail_ext="$avail_ext $xxx" ;;
21877		    esac
21878		    ;;
21879		esac
21880		;;
21881	ODBM_File|odbm_fil)
21882		case "${i_dbm}${i_rpcsvcdbm}" in
21883		*"${define}"*)
21884		    case "$d_cplusplus" in
21885		    define) ;; # delete as a function name will not work
21886		    *)  case "$osname-$use64bitint" in
21887			hpux-define)
21888			    case "$libs" in
21889			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21890			    esac
21891			    ;;
21892			*) avail_ext="$avail_ext $xxx" ;;
21893			esac
21894			;;
21895		    esac
21896		    ;;
21897		esac
21898		;;
21899	Opcode|opcode)
21900		case "$useopcode" in
21901		true|define|y) avail_ext="$avail_ext $xxx" ;;
21902		esac
21903		;;
21904	POSIX|posix)
21905		case "$useposix" in
21906		true|define|y) avail_ext="$avail_ext $xxx" ;;
21907		esac
21908		;;
21909	Socket|socket)
21910		case "$d_socket" in
21911		true|$define|y)
21912		    case "$osname" in
21913		    beos) ;; # not unless BONE
21914		    *) avail_ext="$avail_ext $xxx" ;;
21915		    esac
21916		    ;;
21917		esac
21918		;;
21919	Sys/Syslog|sys/syslog)
21920		: XXX syslog requires socket
21921		case "$d_socket" in
21922		true|$define|y) avail_ext="$avail_ext $xxx" ;;
21923		esac
21924		;;
21925	Thread|thread)
21926                case "$usethreads" in
21927                true|$define|y)
21928                        case "$use5005threads" in
21929                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21930                        esac
21931		esac
21932		;;
21933	threads|threads/shared)
21934		# threads and threads::shared are special cases.
21935		# To stop people from asking "Perl 5.8.0 was supposed
21936		# to have this new fancy threads implementation but my
21937		# perl doesn't have it" and from people trying to
21938		# (re)install the threads module using CPAN.pm and
21939		# CPAN.pm then offering to reinstall Perl 5.8.0,
21940		# the threads.pm and threads/shared.pm will always be
21941		# there, croaking informatively ("you need to rebuild
21942		# all of Perl with threads, sorry") when threads haven't
21943		# been compiled in.
21944		# --jhi
21945		avail_ext="$avail_ext $xxx"
21946		;;
21947	VMS*)
21948		;;
21949	Win32*)
21950		case "$osname" in
21951		cygwin) avail_ext="$avail_ext $xxx" ;;
21952		esac
21953		;;
21954	XS/APItest|xs/apitest)
21955		# This is just for testing.  Skip it unless we have dynamic loading.
21956
21957		case "$usedl" in
21958		$define) avail_ext="$avail_ext $xxx" ;;
21959		esac
21960		;;
21961	XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21962		# This is just for testing.  Skip it unless we have dynamic loading.
21963
21964		case "$usedl" in
21965		$define) avail_ext="$avail_ext $xxx" ;;
21966		esac
21967		;;
21968	XS/Typemap|xs/typemap)
21969		# This is just for testing.  Skip it unless we have dynamic loading.
21970		case "$usedl" in
21971		$define) avail_ext="$avail_ext $xxx" ;;
21972		esac
21973		;;
21974	*)	avail_ext="$avail_ext $xxx"
21975		;;
21976	esac
21977done
21978
21979set X $avail_ext
21980shift
21981avail_ext="$*"
21982
21983case "$onlyextensions" in
21984'') ;;
21985*)  keepextensions=''
21986    echo "You have requested that only certains extensions be included..." >&4
21987    for i in $onlyextensions; do
21988        case " $avail_ext " in
21989        *" $i "*)
21990            echo "Keeping extension $i."
21991            keepextensions="$keepextensions $i"
21992            ;;
21993        *) echo "Ignoring extension $i." ;;
21994        esac
21995    done
21996    avail_ext="$keepextensions"
21997    ;;
21998esac
21999
22000case "$noextensions" in
22001'') ;;
22002*)  keepextensions=''
22003    echo "You have requested that certain extensions be ignored..." >&4
22004    for i in $avail_ext; do
22005        case " $noextensions " in
22006        *" $i "*) echo "Ignoring extension $i." ;;
22007        *) echo "Keeping extension $i.";
22008           keepextensions="$keepextensions $i"
22009           ;;
22010        esac
22011    done
22012    avail_ext="$keepextensions"
22013    ;;
22014esac
22015
22016: Now see which nonxs extensions are supported on this system.
22017: For now assume all are.
22018nonxs_ext=''
22019for xxx in $nonxs_extensions ; do
22020	case "$xxx" in
22021	CVS|RCS|SCCS|.svn)
22022		;;
22023	*)	nonxs_ext="$nonxs_ext $xxx"
22024		;;
22025	esac
22026done
22027
22028set X $nonxs_ext
22029shift
22030nonxs_ext="$*"
22031
22032case $usedl in
22033$define)
22034	$cat <<EOM
22035A number of extensions are supplied with $package.  You may choose to
22036compile these extensions for dynamic loading (the default), compile
22037them into the $package executable (static loading), or not include
22038them at all.  Answer "none" to include no extensions.
22039Note that DynaLoader is always built and need not be mentioned here.
22040
22041EOM
22042	case "$dynamic_ext" in
22043	'')
22044		: Exclude those listed in static_ext
22045		dflt=''
22046		for xxx in $avail_ext; do
22047			case " $static_ext " in
22048			*" $xxx "*) ;;
22049			*) dflt="$dflt $xxx" ;;
22050			esac
22051		done
22052		set X $dflt
22053		shift
22054		dflt="$*"
22055		;;
22056	*)	dflt="$dynamic_ext"
22057		# Perhaps we are reusing an old out-of-date config.sh.
22058		case "$hint" in
22059		previous)
22060			if test X"$dynamic_ext" != X"$avail_ext"; then
22061				$cat <<EOM
22062NOTICE:  Your previous config.sh list may be incorrect.
22063The extensions now available to you are
22064	${avail_ext}
22065but the default list from your previous config.sh is
22066	${dynamic_ext}
22067
22068EOM
22069			fi
22070			;;
22071		esac
22072		;;
22073	esac
22074	case "$dflt" in
22075	'')	dflt=none;;
22076	esac
22077	rp="What extensions do you wish to load dynamically?"
22078	. ./myread
22079	case "$ans" in
22080	none) dynamic_ext=' ' ;;
22081	*) dynamic_ext="$ans" ;;
22082	esac
22083
22084	case "$static_ext" in
22085	'')
22086		: Exclude those already listed in dynamic linking
22087		dflt=''
22088		for xxx in $avail_ext; do
22089			case " $dynamic_ext " in
22090			*" $xxx "*) ;;
22091			*) dflt="$dflt $xxx" ;;
22092			esac
22093		done
22094		set X $dflt
22095		shift
22096		dflt="$*"
22097		;;
22098	*)  dflt="$static_ext"
22099		;;
22100	esac
22101
22102	case "$dflt" in
22103	'')	dflt=none;;
22104	esac
22105	rp="What extensions do you wish to load statically?"
22106	. ./myread
22107	case "$ans" in
22108	none) static_ext=' ' ;;
22109	*) static_ext="$ans" ;;
22110	esac
22111	;;
22112*)
22113	$cat <<EOM
22114A number of extensions are supplied with $package.  Answer "none"
22115to include no extensions.
22116Note that DynaLoader is always built and need not be mentioned here.
22117
22118EOM
22119	case "$static_ext" in
22120	'') dflt="$avail_ext" ;;
22121	*)	dflt="$static_ext"
22122		# Perhaps we are reusing an old out-of-date config.sh.
22123		case "$hint" in
22124		previous)
22125			if test X"$static_ext" != X"$avail_ext"; then
22126				$cat <<EOM
22127NOTICE:  Your previous config.sh list may be incorrect.
22128The extensions now available to you are
22129	${avail_ext}
22130but the default list from your previous config.sh is
22131	${static_ext}
22132
22133EOM
22134			fi
22135			;;
22136		esac
22137		;;
22138	esac
22139	: Exclude those that are not xs extensions
22140	case "$dflt" in
22141	'')	dflt=none;;
22142	esac
22143	rp="What extensions do you wish to include?"
22144	. ./myread
22145	case "$ans" in
22146	none) static_ext=' ' ;;
22147	*) static_ext="$ans" ;;
22148	esac
22149	;;
22150esac
22151#
22152# Encode is a special case.  If we are building Encode as a static
22153# extension, we need to explicitly list its subextensions as well.
22154# For other nested extensions, this is handled automatically by
22155# the appropriate Makefile.PL.
22156case " $static_ext " in
22157	*" Encode "*) # Add the subextensions of Encode
22158	cd "$rsrc/ext"
22159	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22160		static_ext="$static_ext Encode/$xxx"
22161	done
22162	cd "$tdir"
22163	;;
22164esac
22165
22166set X $dynamic_ext $static_ext $nonxs_ext
22167shift
22168extensions="$*"
22169
22170# Sanity check:  We require an extension suitable for use with
22171# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22172# should show up as failures in the test suite, but it's helpful to
22173# catch them now.) The 'extensions' list is normally sorted
22174# alphabetically, so we need to accept either
22175#    DB_File ... Fcntl ... IO  ....
22176# or something like
22177#    Fcntl ... NDBM_File ... IO  ....
22178case " $extensions"  in
22179*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22180*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22181*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22182*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22183   echo "WARNING: The Perl you are building will be quite crippled." >& 4
22184   ;;
22185esac
22186
22187: Remove libraries needed only for extensions
22188: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22189: The exception is SunOS 4.x, which needs them.
22190case "${osname}X${osvers}" in
22191sunos*X4*)
22192    perllibs="$libs"
22193    ;;
22194*) case "$usedl" in
22195    $define|true|[yY]*)
22196	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22197	    shift
22198	    perllibs="$*"
22199	    ;;
22200    *)	perllibs="$libs"
22201	    ;;
22202    esac
22203    ;;
22204esac
22205
22206: Remove build directory name from cppstdin so it can be used from
22207: either the present location or the final installed location.
22208echo " "
22209: Get out of the UU directory to get correct path name.
22210cd ..
22211case "$cppstdin" in
22212`pwd`/cppstdin)
22213	echo "Stripping down cppstdin path name"
22214	cppstdin=cppstdin
22215	;;
22216esac
22217cd UU
22218
22219: end of configuration questions
22220echo " "
22221echo "End of configuration questions."
22222echo " "
22223
22224: back to where it started
22225if test -d ../UU; then
22226	cd ..
22227fi
22228
22229: configuration may be unconditionally patched via a 'config.arch' file
22230if $test -f config.arch; then
22231	echo "I see a config.arch file, loading it." >&4
22232	. ./config.arch
22233fi
22234
22235: configuration may be patched via a 'config.over' file
22236if $test -f config.over; then
22237	echo " "
22238	dflt=y
22239	rp='I see a config.over file.  Do you wish to load it?'
22240	. UU/myread
22241	case "$ans" in
22242	n*) echo "OK, I'll ignore it.";;
22243	*)	. ./config.over
22244		echo "Configuration override changes have been loaded."
22245		;;
22246	esac
22247fi
22248
22249: in case they want portability, strip down executable paths
22250case "$d_portable" in
22251"$define")
22252	echo " "
22253	echo "Stripping down executable paths..." >&4
22254	for file in $loclist $trylist; do
22255		eval temp=\$$file
22256		eval $file=`basename $temp`
22257	done
22258	;;
22259esac
22260
22261: create config.sh file
22262echo " "
22263echo "Creating config.sh..." >&4
22264$spitshell <<EOT >config.sh
22265$startsh
22266#
22267# This file was produced by running the Configure script. It holds all the
22268# definitions figured out by Configure. Should you modify one of these values,
22269# do not forget to propagate your changes by running "Configure -der". You may
22270# instead choose to run each of the .SH files by yourself, or "Configure -S".
22271#
22272
22273# Package name      : $package
22274# Source directory  : $src
22275# Configuration time: $cf_time
22276# Configured by     : $cf_by
22277# Target system     : $myuname
22278
22279EOT
22280: Add in command line options if available
22281$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22282
22283$spitshell <<EOT >>config.sh
22284
22285Author='$Author'
22286Date='$Date'
22287Header='$Header'
22288Id='$Id'
22289Locker='$Locker'
22290Log='$Log'
22291RCSfile='$RCSfile'
22292Revision='$Revision'
22293Source='$Source'
22294State='$State'
22295_a='$_a'
22296_exe='$_exe'
22297_o='$_o'
22298afs='$afs'
22299afsroot='$afsroot'
22300alignbytes='$alignbytes'
22301ansi2knr='$ansi2knr'
22302aphostname='$aphostname'
22303api_revision='$api_revision'
22304api_subversion='$api_subversion'
22305api_version='$api_version'
22306api_versionstring='$api_versionstring'
22307ar='$ar'
22308archlib='$archlib'
22309archlibexp='$archlibexp'
22310archname64='$archname64'
22311archname='$archname'
22312archobjs='$archobjs'
22313asctime_r_proto='$asctime_r_proto'
22314awk='$awk'
22315baserev='$baserev'
22316bash='$bash'
22317bin='$bin'
22318bin_ELF='$bin_ELF'
22319binexp='$binexp'
22320bison='$bison'
22321byacc='$byacc'
22322byteorder='$byteorder'
22323c='$c'
22324castflags='$castflags'
22325cat='$cat'
22326cc='$cc'
22327cccdlflags='$cccdlflags'
22328ccdlflags='$ccdlflags'
22329ccflags='$ccflags'
22330ccflags_uselargefiles='$ccflags_uselargefiles'
22331ccname='$ccname'
22332ccsymbols='$ccsymbols'
22333ccversion='$ccversion'
22334cf_by='$cf_by'
22335cf_email='$cf_email'
22336cf_time='$cf_time'
22337charbits='$charbits'
22338charsize='$charsize'
22339chgrp='$chgrp'
22340chmod='$chmod'
22341chown='$chown'
22342clocktype='$clocktype'
22343comm='$comm'
22344compress='$compress'
22345contains='$contains'
22346cp='$cp'
22347cpio='$cpio'
22348cpp='$cpp'
22349cpp_stuff='$cpp_stuff'
22350cppccsymbols='$cppccsymbols'
22351cppflags='$cppflags'
22352cpplast='$cpplast'
22353cppminus='$cppminus'
22354cpprun='$cpprun'
22355cppstdin='$cppstdin'
22356cppsymbols='$cppsymbols'
22357crypt_r_proto='$crypt_r_proto'
22358cryptlib='$cryptlib'
22359csh='$csh'
22360ctermid_r_proto='$ctermid_r_proto'
22361ctime_r_proto='$ctime_r_proto'
22362d_Gconvert='$d_Gconvert'
22363d_PRIEUldbl='$d_PRIEUldbl'
22364d_PRIFUldbl='$d_PRIFUldbl'
22365d_PRIGUldbl='$d_PRIGUldbl'
22366d_PRIXU64='$d_PRIXU64'
22367d_PRId64='$d_PRId64'
22368d_PRIeldbl='$d_PRIeldbl'
22369d_PRIfldbl='$d_PRIfldbl'
22370d_PRIgldbl='$d_PRIgldbl'
22371d_PRIi64='$d_PRIi64'
22372d_PRIo64='$d_PRIo64'
22373d_PRIu64='$d_PRIu64'
22374d_PRIx64='$d_PRIx64'
22375d_SCNfldbl='$d_SCNfldbl'
22376d__fwalk='$d__fwalk'
22377d_access='$d_access'
22378d_accessx='$d_accessx'
22379d_aintl='$d_aintl'
22380d_alarm='$d_alarm'
22381d_archlib='$d_archlib'
22382d_asctime64='$d_asctime64'
22383d_asctime_r='$d_asctime_r'
22384d_atolf='$d_atolf'
22385d_atoll='$d_atoll'
22386d_attribute_deprecated='$d_attribute_deprecated'
22387d_attribute_format='$d_attribute_format'
22388d_attribute_malloc='$d_attribute_malloc'
22389d_attribute_nonnull='$d_attribute_nonnull'
22390d_attribute_noreturn='$d_attribute_noreturn'
22391d_attribute_pure='$d_attribute_pure'
22392d_attribute_unused='$d_attribute_unused'
22393d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22394d_bcmp='$d_bcmp'
22395d_bcopy='$d_bcopy'
22396d_bsd='$d_bsd'
22397d_bsdgetpgrp='$d_bsdgetpgrp'
22398d_bsdsetpgrp='$d_bsdsetpgrp'
22399d_builtin_choose_expr='$d_builtin_choose_expr'
22400d_builtin_expect='$d_builtin_expect'
22401d_bzero='$d_bzero'
22402d_c99_variadic_macros='$d_c99_variadic_macros'
22403d_casti32='$d_casti32'
22404d_castneg='$d_castneg'
22405d_charvspr='$d_charvspr'
22406d_chown='$d_chown'
22407d_chroot='$d_chroot'
22408d_chsize='$d_chsize'
22409d_class='$d_class'
22410d_clearenv='$d_clearenv'
22411d_closedir='$d_closedir'
22412d_cmsghdr_s='$d_cmsghdr_s'
22413d_const='$d_const'
22414d_copysignl='$d_copysignl'
22415d_cplusplus='$d_cplusplus'
22416d_crypt='$d_crypt'
22417d_crypt_r='$d_crypt_r'
22418d_csh='$d_csh'
22419d_ctermid='$d_ctermid'
22420d_ctermid_r='$d_ctermid_r'
22421d_ctime64='$d_ctime64'
22422d_ctime_r='$d_ctime_r'
22423d_cuserid='$d_cuserid'
22424d_dbl_dig='$d_dbl_dig'
22425d_dbminitproto='$d_dbminitproto'
22426d_difftime64='$d_difftime64'
22427d_difftime='$d_difftime'
22428d_dir_dd_fd='$d_dir_dd_fd'
22429d_dirfd='$d_dirfd'
22430d_dirnamlen='$d_dirnamlen'
22431d_dlerror='$d_dlerror'
22432d_dlopen='$d_dlopen'
22433d_dlsymun='$d_dlsymun'
22434d_dosuid='$d_dosuid'
22435d_drand48_r='$d_drand48_r'
22436d_drand48proto='$d_drand48proto'
22437d_dup2='$d_dup2'
22438d_eaccess='$d_eaccess'
22439d_endgrent='$d_endgrent'
22440d_endgrent_r='$d_endgrent_r'
22441d_endhent='$d_endhent'
22442d_endhostent_r='$d_endhostent_r'
22443d_endnent='$d_endnent'
22444d_endnetent_r='$d_endnetent_r'
22445d_endpent='$d_endpent'
22446d_endprotoent_r='$d_endprotoent_r'
22447d_endpwent='$d_endpwent'
22448d_endpwent_r='$d_endpwent_r'
22449d_endsent='$d_endsent'
22450d_endservent_r='$d_endservent_r'
22451d_eofnblk='$d_eofnblk'
22452d_eunice='$d_eunice'
22453d_faststdio='$d_faststdio'
22454d_fchdir='$d_fchdir'
22455d_fchmod='$d_fchmod'
22456d_fchown='$d_fchown'
22457d_fcntl='$d_fcntl'
22458d_fcntl_can_lock='$d_fcntl_can_lock'
22459d_fd_macros='$d_fd_macros'
22460d_fd_set='$d_fd_set'
22461d_fds_bits='$d_fds_bits'
22462d_fgetpos='$d_fgetpos'
22463d_finite='$d_finite'
22464d_finitel='$d_finitel'
22465d_flexfnam='$d_flexfnam'
22466d_flock='$d_flock'
22467d_flockproto='$d_flockproto'
22468d_fork='$d_fork'
22469d_fp_class='$d_fp_class'
22470d_fpathconf='$d_fpathconf'
22471d_fpclass='$d_fpclass'
22472d_fpclassify='$d_fpclassify'
22473d_fpclassl='$d_fpclassl'
22474d_fpos64_t='$d_fpos64_t'
22475d_frexpl='$d_frexpl'
22476d_fs_data_s='$d_fs_data_s'
22477d_fseeko='$d_fseeko'
22478d_fsetpos='$d_fsetpos'
22479d_fstatfs='$d_fstatfs'
22480d_fstatvfs='$d_fstatvfs'
22481d_fsync='$d_fsync'
22482d_ftello='$d_ftello'
22483d_ftime='$d_ftime'
22484d_futimes='$d_futimes'
22485d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22486d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22487d_getaddrinfo='$d_getaddrinfo'
22488d_getcwd='$d_getcwd'
22489d_getespwnam='$d_getespwnam'
22490d_getfsstat='$d_getfsstat'
22491d_getgrent='$d_getgrent'
22492d_getgrent_r='$d_getgrent_r'
22493d_getgrgid_r='$d_getgrgid_r'
22494d_getgrnam_r='$d_getgrnam_r'
22495d_getgrps='$d_getgrps'
22496d_gethbyaddr='$d_gethbyaddr'
22497d_gethbyname='$d_gethbyname'
22498d_gethent='$d_gethent'
22499d_gethname='$d_gethname'
22500d_gethostbyaddr_r='$d_gethostbyaddr_r'
22501d_gethostbyname_r='$d_gethostbyname_r'
22502d_gethostent_r='$d_gethostent_r'
22503d_gethostprotos='$d_gethostprotos'
22504d_getitimer='$d_getitimer'
22505d_getlogin='$d_getlogin'
22506d_getlogin_r='$d_getlogin_r'
22507d_getmnt='$d_getmnt'
22508d_getmntent='$d_getmntent'
22509d_getnameinfo='$d_getnameinfo'
22510d_getnbyaddr='$d_getnbyaddr'
22511d_getnbyname='$d_getnbyname'
22512d_getnent='$d_getnent'
22513d_getnetbyaddr_r='$d_getnetbyaddr_r'
22514d_getnetbyname_r='$d_getnetbyname_r'
22515d_getnetent_r='$d_getnetent_r'
22516d_getnetprotos='$d_getnetprotos'
22517d_getpagsz='$d_getpagsz'
22518d_getpbyname='$d_getpbyname'
22519d_getpbynumber='$d_getpbynumber'
22520d_getpent='$d_getpent'
22521d_getpgid='$d_getpgid'
22522d_getpgrp2='$d_getpgrp2'
22523d_getpgrp='$d_getpgrp'
22524d_getppid='$d_getppid'
22525d_getprior='$d_getprior'
22526d_getprotobyname_r='$d_getprotobyname_r'
22527d_getprotobynumber_r='$d_getprotobynumber_r'
22528d_getprotoent_r='$d_getprotoent_r'
22529d_getprotoprotos='$d_getprotoprotos'
22530d_getprpwnam='$d_getprpwnam'
22531d_getpwent='$d_getpwent'
22532d_getpwent_r='$d_getpwent_r'
22533d_getpwnam_r='$d_getpwnam_r'
22534d_getpwuid_r='$d_getpwuid_r'
22535d_getsbyname='$d_getsbyname'
22536d_getsbyport='$d_getsbyport'
22537d_getsent='$d_getsent'
22538d_getservbyname_r='$d_getservbyname_r'
22539d_getservbyport_r='$d_getservbyport_r'
22540d_getservent_r='$d_getservent_r'
22541d_getservprotos='$d_getservprotos'
22542d_getspnam='$d_getspnam'
22543d_getspnam_r='$d_getspnam_r'
22544d_gettimeod='$d_gettimeod'
22545d_gmtime64='$d_gmtime64'
22546d_gmtime_r='$d_gmtime_r'
22547d_gnulibc='$d_gnulibc'
22548d_grpasswd='$d_grpasswd'
22549d_hasmntopt='$d_hasmntopt'
22550d_htonl='$d_htonl'
22551d_ilogbl='$d_ilogbl'
22552d_inc_version_list='$d_inc_version_list'
22553d_index='$d_index'
22554d_inetaton='$d_inetaton'
22555d_inetntop='$d_inetntop'
22556d_inetpton='$d_inetpton'
22557d_int64_t='$d_int64_t'
22558d_isascii='$d_isascii'
22559d_isfinite='$d_isfinite'
22560d_isinf='$d_isinf'
22561d_isnan='$d_isnan'
22562d_isnanl='$d_isnanl'
22563d_killpg='$d_killpg'
22564d_lchown='$d_lchown'
22565d_ldbl_dig='$d_ldbl_dig'
22566d_libm_lib_version='$d_libm_lib_version'
22567d_link='$d_link'
22568d_localtime64='$d_localtime64'
22569d_localtime_r='$d_localtime_r'
22570d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22571d_locconv='$d_locconv'
22572d_lockf='$d_lockf'
22573d_longdbl='$d_longdbl'
22574d_longlong='$d_longlong'
22575d_lseekproto='$d_lseekproto'
22576d_lstat='$d_lstat'
22577d_madvise='$d_madvise'
22578d_malloc_good_size='$d_malloc_good_size'
22579d_malloc_size='$d_malloc_size'
22580d_mblen='$d_mblen'
22581d_mbstowcs='$d_mbstowcs'
22582d_mbtowc='$d_mbtowc'
22583d_memchr='$d_memchr'
22584d_memcmp='$d_memcmp'
22585d_memcpy='$d_memcpy'
22586d_memmove='$d_memmove'
22587d_memset='$d_memset'
22588d_mkdir='$d_mkdir'
22589d_mkdtemp='$d_mkdtemp'
22590d_mkfifo='$d_mkfifo'
22591d_mkstemp='$d_mkstemp'
22592d_mkstemps='$d_mkstemps'
22593d_mktime64='$d_mktime64'
22594d_mktime='$d_mktime'
22595d_mmap='$d_mmap'
22596d_modfl='$d_modfl'
22597d_modfl_pow32_bug='$d_modfl_pow32_bug'
22598d_modflproto='$d_modflproto'
22599d_mprotect='$d_mprotect'
22600d_msg='$d_msg'
22601d_msg_ctrunc='$d_msg_ctrunc'
22602d_msg_dontroute='$d_msg_dontroute'
22603d_msg_oob='$d_msg_oob'
22604d_msg_peek='$d_msg_peek'
22605d_msg_proxy='$d_msg_proxy'
22606d_msgctl='$d_msgctl'
22607d_msgget='$d_msgget'
22608d_msghdr_s='$d_msghdr_s'
22609d_msgrcv='$d_msgrcv'
22610d_msgsnd='$d_msgsnd'
22611d_msync='$d_msync'
22612d_munmap='$d_munmap'
22613d_mymalloc='$d_mymalloc'
22614d_ndbm='$d_ndbm'
22615d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22616d_nice='$d_nice'
22617d_nl_langinfo='$d_nl_langinfo'
22618d_nv_preserves_uv='$d_nv_preserves_uv'
22619d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22620d_off64_t='$d_off64_t'
22621d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22622d_oldpthreads='$d_oldpthreads'
22623d_oldsock='$d_oldsock'
22624d_open3='$d_open3'
22625d_pathconf='$d_pathconf'
22626d_pause='$d_pause'
22627d_perl_otherlibdirs='$d_perl_otherlibdirs'
22628d_phostname='$d_phostname'
22629d_pipe='$d_pipe'
22630d_poll='$d_poll'
22631d_portable='$d_portable'
22632d_printf_format_null='$d_printf_format_null'
22633d_procselfexe='$d_procselfexe'
22634d_pseudofork='$d_pseudofork'
22635d_pthread_atfork='$d_pthread_atfork'
22636d_pthread_attr_setscope='$d_pthread_attr_setscope'
22637d_pthread_yield='$d_pthread_yield'
22638d_pwage='$d_pwage'
22639d_pwchange='$d_pwchange'
22640d_pwclass='$d_pwclass'
22641d_pwcomment='$d_pwcomment'
22642d_pwexpire='$d_pwexpire'
22643d_pwgecos='$d_pwgecos'
22644d_pwpasswd='$d_pwpasswd'
22645d_pwquota='$d_pwquota'
22646d_qgcvt='$d_qgcvt'
22647d_quad='$d_quad'
22648d_random_r='$d_random_r'
22649d_readdir64_r='$d_readdir64_r'
22650d_readdir='$d_readdir'
22651d_readdir_r='$d_readdir_r'
22652d_readlink='$d_readlink'
22653d_readv='$d_readv'
22654d_recvmsg='$d_recvmsg'
22655d_rename='$d_rename'
22656d_rewinddir='$d_rewinddir'
22657d_rmdir='$d_rmdir'
22658d_safebcpy='$d_safebcpy'
22659d_safemcpy='$d_safemcpy'
22660d_sanemcmp='$d_sanemcmp'
22661d_sbrkproto='$d_sbrkproto'
22662d_scalbnl='$d_scalbnl'
22663d_sched_yield='$d_sched_yield'
22664d_scm_rights='$d_scm_rights'
22665d_seekdir='$d_seekdir'
22666d_select='$d_select'
22667d_sem='$d_sem'
22668d_semctl='$d_semctl'
22669d_semctl_semid_ds='$d_semctl_semid_ds'
22670d_semctl_semun='$d_semctl_semun'
22671d_semget='$d_semget'
22672d_semop='$d_semop'
22673d_sendmsg='$d_sendmsg'
22674d_setegid='$d_setegid'
22675d_seteuid='$d_seteuid'
22676d_setgrent='$d_setgrent'
22677d_setgrent_r='$d_setgrent_r'
22678d_setgrps='$d_setgrps'
22679d_sethent='$d_sethent'
22680d_sethostent_r='$d_sethostent_r'
22681d_setitimer='$d_setitimer'
22682d_setlinebuf='$d_setlinebuf'
22683d_setlocale='$d_setlocale'
22684d_setlocale_r='$d_setlocale_r'
22685d_setnent='$d_setnent'
22686d_setnetent_r='$d_setnetent_r'
22687d_setpent='$d_setpent'
22688d_setpgid='$d_setpgid'
22689d_setpgrp2='$d_setpgrp2'
22690d_setpgrp='$d_setpgrp'
22691d_setprior='$d_setprior'
22692d_setproctitle='$d_setproctitle'
22693d_setprotoent_r='$d_setprotoent_r'
22694d_setpwent='$d_setpwent'
22695d_setpwent_r='$d_setpwent_r'
22696d_setregid='$d_setregid'
22697d_setresgid='$d_setresgid'
22698d_setresuid='$d_setresuid'
22699d_setreuid='$d_setreuid'
22700d_setrgid='$d_setrgid'
22701d_setruid='$d_setruid'
22702d_setsent='$d_setsent'
22703d_setservent_r='$d_setservent_r'
22704d_setsid='$d_setsid'
22705d_setvbuf='$d_setvbuf'
22706d_sfio='$d_sfio'
22707d_shm='$d_shm'
22708d_shmat='$d_shmat'
22709d_shmatprototype='$d_shmatprototype'
22710d_shmctl='$d_shmctl'
22711d_shmdt='$d_shmdt'
22712d_shmget='$d_shmget'
22713d_sigaction='$d_sigaction'
22714d_signbit='$d_signbit'
22715d_sigprocmask='$d_sigprocmask'
22716d_sigsetjmp='$d_sigsetjmp'
22717d_sitearch='$d_sitearch'
22718d_snprintf='$d_snprintf'
22719d_sockatmark='$d_sockatmark'
22720d_sockatmarkproto='$d_sockatmarkproto'
22721d_socket='$d_socket'
22722d_socklen_t='$d_socklen_t'
22723d_sockpair='$d_sockpair'
22724d_socks5_init='$d_socks5_init'
22725d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22726d_sqrtl='$d_sqrtl'
22727d_srand48_r='$d_srand48_r'
22728d_srandom_r='$d_srandom_r'
22729d_sresgproto='$d_sresgproto'
22730d_sresuproto='$d_sresuproto'
22731d_statblks='$d_statblks'
22732d_statfs_f_flags='$d_statfs_f_flags'
22733d_statfs_s='$d_statfs_s'
22734d_statvfs='$d_statvfs'
22735d_stdio_cnt_lval='$d_stdio_cnt_lval'
22736d_stdio_ptr_lval='$d_stdio_ptr_lval'
22737d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22738d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22739d_stdio_stream_array='$d_stdio_stream_array'
22740d_stdiobase='$d_stdiobase'
22741d_stdstdio='$d_stdstdio'
22742d_strchr='$d_strchr'
22743d_strcoll='$d_strcoll'
22744d_strctcpy='$d_strctcpy'
22745d_strerrm='$d_strerrm'
22746d_strerror='$d_strerror'
22747d_strerror_r='$d_strerror_r'
22748d_strftime='$d_strftime'
22749d_strlcat='$d_strlcat'
22750d_strlcpy='$d_strlcpy'
22751d_strtod='$d_strtod'
22752d_strtol='$d_strtol'
22753d_strtold='$d_strtold'
22754d_strtoll='$d_strtoll'
22755d_strtoq='$d_strtoq'
22756d_strtoul='$d_strtoul'
22757d_strtoull='$d_strtoull'
22758d_strtouq='$d_strtouq'
22759d_strxfrm='$d_strxfrm'
22760d_suidsafe='$d_suidsafe'
22761d_symlink='$d_symlink'
22762d_syscall='$d_syscall'
22763d_syscallproto='$d_syscallproto'
22764d_sysconf='$d_sysconf'
22765d_sysernlst='$d_sysernlst'
22766d_syserrlst='$d_syserrlst'
22767d_system='$d_system'
22768d_tcgetpgrp='$d_tcgetpgrp'
22769d_tcsetpgrp='$d_tcsetpgrp'
22770d_telldir='$d_telldir'
22771d_telldirproto='$d_telldirproto'
22772d_time='$d_time'
22773d_timegm='$d_timegm'
22774d_times='$d_times'
22775d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22776d_tm_tm_zone='$d_tm_tm_zone'
22777d_tmpnam_r='$d_tmpnam_r'
22778d_truncate='$d_truncate'
22779d_ttyname_r='$d_ttyname_r'
22780d_tzname='$d_tzname'
22781d_u32align='$d_u32align'
22782d_ualarm='$d_ualarm'
22783d_umask='$d_umask'
22784d_uname='$d_uname'
22785d_union_semun='$d_union_semun'
22786d_unordered='$d_unordered'
22787d_unsetenv='$d_unsetenv'
22788d_usleep='$d_usleep'
22789d_usleepproto='$d_usleepproto'
22790d_ustat='$d_ustat'
22791d_vendorarch='$d_vendorarch'
22792d_vendorbin='$d_vendorbin'
22793d_vendorlib='$d_vendorlib'
22794d_vendorscript='$d_vendorscript'
22795d_vfork='$d_vfork'
22796d_void_closedir='$d_void_closedir'
22797d_voidsig='$d_voidsig'
22798d_voidtty='$d_voidtty'
22799d_volatile='$d_volatile'
22800d_vprintf='$d_vprintf'
22801d_vsnprintf='$d_vsnprintf'
22802d_wait4='$d_wait4'
22803d_waitpid='$d_waitpid'
22804d_wcstombs='$d_wcstombs'
22805d_wctomb='$d_wctomb'
22806d_writev='$d_writev'
22807d_xenix='$d_xenix'
22808date='$date'
22809db_hashtype='$db_hashtype'
22810db_prefixtype='$db_prefixtype'
22811db_version_major='$db_version_major'
22812db_version_minor='$db_version_minor'
22813db_version_patch='$db_version_patch'
22814defvoidused='$defvoidused'
22815direntrytype='$direntrytype'
22816dlext='$dlext'
22817dlsrc='$dlsrc'
22818doublesize='$doublesize'
22819drand01='$drand01'
22820drand48_r_proto='$drand48_r_proto'
22821dtrace='$dtrace'
22822dynamic_ext='$dynamic_ext'
22823eagain='$eagain'
22824ebcdic='$ebcdic'
22825echo='$echo'
22826egrep='$egrep'
22827emacs='$emacs'
22828endgrent_r_proto='$endgrent_r_proto'
22829endhostent_r_proto='$endhostent_r_proto'
22830endnetent_r_proto='$endnetent_r_proto'
22831endprotoent_r_proto='$endprotoent_r_proto'
22832endpwent_r_proto='$endpwent_r_proto'
22833endservent_r_proto='$endservent_r_proto'
22834eunicefix='$eunicefix'
22835exe_ext='$exe_ext'
22836expr='$expr'
22837extensions='$extensions'
22838extern_C='$extern_C'
22839extras='$extras'
22840fflushNULL='$fflushNULL'
22841fflushall='$fflushall'
22842find='$find'
22843firstmakefile='$firstmakefile'
22844flex='$flex'
22845fpossize='$fpossize'
22846fpostype='$fpostype'
22847freetype='$freetype'
22848from='$from'
22849full_ar='$full_ar'
22850full_csh='$full_csh'
22851full_sed='$full_sed'
22852gccansipedantic='$gccansipedantic'
22853gccosandvers='$gccosandvers'
22854gccversion='$gccversion'
22855getgrent_r_proto='$getgrent_r_proto'
22856getgrgid_r_proto='$getgrgid_r_proto'
22857getgrnam_r_proto='$getgrnam_r_proto'
22858gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22859gethostbyname_r_proto='$gethostbyname_r_proto'
22860gethostent_r_proto='$gethostent_r_proto'
22861getlogin_r_proto='$getlogin_r_proto'
22862getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22863getnetbyname_r_proto='$getnetbyname_r_proto'
22864getnetent_r_proto='$getnetent_r_proto'
22865getprotobyname_r_proto='$getprotobyname_r_proto'
22866getprotobynumber_r_proto='$getprotobynumber_r_proto'
22867getprotoent_r_proto='$getprotoent_r_proto'
22868getpwent_r_proto='$getpwent_r_proto'
22869getpwnam_r_proto='$getpwnam_r_proto'
22870getpwuid_r_proto='$getpwuid_r_proto'
22871getservbyname_r_proto='$getservbyname_r_proto'
22872getservbyport_r_proto='$getservbyport_r_proto'
22873getservent_r_proto='$getservent_r_proto'
22874getspnam_r_proto='$getspnam_r_proto'
22875gidformat='$gidformat'
22876gidsign='$gidsign'
22877gidsize='$gidsize'
22878gidtype='$gidtype'
22879glibpth='$glibpth'
22880gmake='$gmake'
22881gmtime_r_proto='$gmtime_r_proto'
22882gnulibc_version='$gnulibc_version'
22883grep='$grep'
22884groupcat='$groupcat'
22885groupstype='$groupstype'
22886gzip='$gzip'
22887h_fcntl='$h_fcntl'
22888h_sysfile='$h_sysfile'
22889hint='$hint'
22890hostcat='$hostcat'
22891html1dir='$html1dir'
22892html1direxp='$html1direxp'
22893html3dir='$html3dir'
22894html3direxp='$html3direxp'
22895i16size='$i16size'
22896i16type='$i16type'
22897i32size='$i32size'
22898i32type='$i32type'
22899i64size='$i64size'
22900i64type='$i64type'
22901i8size='$i8size'
22902i8type='$i8type'
22903i_arpainet='$i_arpainet'
22904i_assert='$i_assert'
22905i_bsdioctl='$i_bsdioctl'
22906i_crypt='$i_crypt'
22907i_db='$i_db'
22908i_dbm='$i_dbm'
22909i_dirent='$i_dirent'
22910i_dld='$i_dld'
22911i_dlfcn='$i_dlfcn'
22912i_fcntl='$i_fcntl'
22913i_float='$i_float'
22914i_fp='$i_fp'
22915i_fp_class='$i_fp_class'
22916i_gdbm='$i_gdbm'
22917i_gdbm_ndbm='$i_gdbm_ndbm'
22918i_gdbmndbm='$i_gdbmndbm'
22919i_grp='$i_grp'
22920i_ieeefp='$i_ieeefp'
22921i_inttypes='$i_inttypes'
22922i_langinfo='$i_langinfo'
22923i_libutil='$i_libutil'
22924i_limits='$i_limits'
22925i_locale='$i_locale'
22926i_machcthr='$i_machcthr'
22927i_malloc='$i_malloc'
22928i_mallocmalloc='$i_mallocmalloc'
22929i_math='$i_math'
22930i_memory='$i_memory'
22931i_mntent='$i_mntent'
22932i_ndbm='$i_ndbm'
22933i_netdb='$i_netdb'
22934i_neterrno='$i_neterrno'
22935i_netinettcp='$i_netinettcp'
22936i_niin='$i_niin'
22937i_poll='$i_poll'
22938i_prot='$i_prot'
22939i_pthread='$i_pthread'
22940i_pwd='$i_pwd'
22941i_rpcsvcdbm='$i_rpcsvcdbm'
22942i_sfio='$i_sfio'
22943i_sgtty='$i_sgtty'
22944i_shadow='$i_shadow'
22945i_socks='$i_socks'
22946i_stdarg='$i_stdarg'
22947i_stddef='$i_stddef'
22948i_stdlib='$i_stdlib'
22949i_string='$i_string'
22950i_sunmath='$i_sunmath'
22951i_sysaccess='$i_sysaccess'
22952i_sysdir='$i_sysdir'
22953i_sysfile='$i_sysfile'
22954i_sysfilio='$i_sysfilio'
22955i_sysin='$i_sysin'
22956i_sysioctl='$i_sysioctl'
22957i_syslog='$i_syslog'
22958i_sysmman='$i_sysmman'
22959i_sysmode='$i_sysmode'
22960i_sysmount='$i_sysmount'
22961i_sysndir='$i_sysndir'
22962i_sysparam='$i_sysparam'
22963i_syspoll='$i_syspoll'
22964i_sysresrc='$i_sysresrc'
22965i_syssecrt='$i_syssecrt'
22966i_sysselct='$i_sysselct'
22967i_syssockio='$i_syssockio'
22968i_sysstat='$i_sysstat'
22969i_sysstatfs='$i_sysstatfs'
22970i_sysstatvfs='$i_sysstatvfs'
22971i_systime='$i_systime'
22972i_systimek='$i_systimek'
22973i_systimes='$i_systimes'
22974i_systypes='$i_systypes'
22975i_sysuio='$i_sysuio'
22976i_sysun='$i_sysun'
22977i_sysutsname='$i_sysutsname'
22978i_sysvfs='$i_sysvfs'
22979i_syswait='$i_syswait'
22980i_termio='$i_termio'
22981i_termios='$i_termios'
22982i_time='$i_time'
22983i_unistd='$i_unistd'
22984i_ustat='$i_ustat'
22985i_utime='$i_utime'
22986i_values='$i_values'
22987i_varargs='$i_varargs'
22988i_varhdr='$i_varhdr'
22989i_vfork='$i_vfork'
22990ignore_versioned_solibs='$ignore_versioned_solibs'
22991inc_version_list='$inc_version_list'
22992inc_version_list_init='$inc_version_list_init'
22993incpath='$incpath'
22994inews='$inews'
22995initialinstalllocation='$initialinstalllocation'
22996installarchlib='$installarchlib'
22997installbin='$installbin'
22998installhtml1dir='$installhtml1dir'
22999installhtml3dir='$installhtml3dir'
23000installman1dir='$installman1dir'
23001installman3dir='$installman3dir'
23002installprefix='$installprefix'
23003installprefixexp='$installprefixexp'
23004installprivlib='$installprivlib'
23005installscript='$installscript'
23006installsitearch='$installsitearch'
23007installsitebin='$installsitebin'
23008installsitehtml1dir='$installsitehtml1dir'
23009installsitehtml3dir='$installsitehtml3dir'
23010installsitelib='$installsitelib'
23011installsiteman1dir='$installsiteman1dir'
23012installsiteman3dir='$installsiteman3dir'
23013installsitescript='$installsitescript'
23014installstyle='$installstyle'
23015installusrbinperl='$installusrbinperl'
23016installvendorarch='$installvendorarch'
23017installvendorbin='$installvendorbin'
23018installvendorhtml1dir='$installvendorhtml1dir'
23019installvendorhtml3dir='$installvendorhtml3dir'
23020installvendorlib='$installvendorlib'
23021installvendorman1dir='$installvendorman1dir'
23022installvendorman3dir='$installvendorman3dir'
23023installvendorscript='$installvendorscript'
23024intsize='$intsize'
23025issymlink='$issymlink'
23026ivdformat='$ivdformat'
23027ivsize='$ivsize'
23028ivtype='$ivtype'
23029known_extensions='$known_extensions'
23030ksh='$ksh'
23031ld='$ld'
23032lddlflags='$lddlflags'
23033ldflags='$ldflags'
23034ldflags_uselargefiles='$ldflags_uselargefiles'
23035ldlibpthname='$ldlibpthname'
23036less='$less'
23037lib_ext='$lib_ext'
23038libc='$libc'
23039libperl='$libperl'
23040libpth='$libpth'
23041libs='$libs'
23042libsdirs='$libsdirs'
23043libsfiles='$libsfiles'
23044libsfound='$libsfound'
23045libspath='$libspath'
23046libswanted='$libswanted'
23047libswanted_uselargefiles='$libswanted_uselargefiles'
23048line='$line'
23049lint='$lint'
23050lkflags='$lkflags'
23051ln='$ln'
23052lns='$lns'
23053localtime_r_proto='$localtime_r_proto'
23054locincpth='$locincpth'
23055loclibpth='$loclibpth'
23056longdblsize='$longdblsize'
23057longlongsize='$longlongsize'
23058longsize='$longsize'
23059lp='$lp'
23060lpr='$lpr'
23061ls='$ls'
23062lseeksize='$lseeksize'
23063lseektype='$lseektype'
23064mad='$mad'
23065madlyh='$madlyh'
23066madlyobj='$madlyobj'
23067madlysrc='$madlysrc'
23068mail='$mail'
23069mailx='$mailx'
23070make='$make'
23071make_set_make='$make_set_make'
23072mallocobj='$mallocobj'
23073mallocsrc='$mallocsrc'
23074malloctype='$malloctype'
23075man1dir='$man1dir'
23076man1direxp='$man1direxp'
23077man1ext='$man1ext'
23078man3dir='$man3dir'
23079man3direxp='$man3direxp'
23080man3ext='$man3ext'
23081mips_type='$mips_type'
23082mistrustnm='$mistrustnm'
23083mkdir='$mkdir'
23084mmaptype='$mmaptype'
23085modetype='$modetype'
23086more='$more'
23087multiarch='$multiarch'
23088mv='$mv'
23089myarchname='$myarchname'
23090mydomain='$mydomain'
23091myhostname='$myhostname'
23092myuname='$myuname'
23093n='$n'
23094need_va_copy='$need_va_copy'
23095netdb_hlen_type='$netdb_hlen_type'
23096netdb_host_type='$netdb_host_type'
23097netdb_name_type='$netdb_name_type'
23098netdb_net_type='$netdb_net_type'
23099nm='$nm'
23100nm_opt='$nm_opt'
23101nm_so_opt='$nm_so_opt'
23102nonxs_ext='$nonxs_ext'
23103nroff='$nroff'
23104nvEUformat='$nvEUformat'
23105nvFUformat='$nvFUformat'
23106nvGUformat='$nvGUformat'
23107nv_overflows_integers_at='$nv_overflows_integers_at'
23108nv_preserves_uv_bits='$nv_preserves_uv_bits'
23109nveformat='$nveformat'
23110nvfformat='$nvfformat'
23111nvgformat='$nvgformat'
23112nvsize='$nvsize'
23113nvtype='$nvtype'
23114o_nonblock='$o_nonblock'
23115obj_ext='$obj_ext'
23116old_pthread_create_joinable='$old_pthread_create_joinable'
23117optimize='$optimize'
23118orderlib='$orderlib'
23119osname='$osname'
23120osvers='$osvers'
23121otherlibdirs='$otherlibdirs'
23122package='$package'
23123pager='$pager'
23124passcat='$passcat'
23125patchlevel='$patchlevel'
23126path_sep='$path_sep'
23127perl5='$perl5'
23128perl='$perl'
23129perl_patchlevel='$perl_patchlevel'
23130perladmin='$perladmin'
23131perllibs='$perllibs'
23132perlpath='$perlpath'
23133pg='$pg'
23134phostname='$phostname'
23135pidtype='$pidtype'
23136plibpth='$plibpth'
23137pmake='$pmake'
23138pr='$pr'
23139prefix='$prefix'
23140prefixexp='$prefixexp'
23141privlib='$privlib'
23142privlibexp='$privlibexp'
23143procselfexe='$procselfexe'
23144prototype='$prototype'
23145ptrsize='$ptrsize'
23146quadkind='$quadkind'
23147quadtype='$quadtype'
23148randbits='$randbits'
23149randfunc='$randfunc'
23150random_r_proto='$random_r_proto'
23151randseedtype='$randseedtype'
23152ranlib='$ranlib'
23153rd_nodata='$rd_nodata'
23154readdir64_r_proto='$readdir64_r_proto'
23155readdir_r_proto='$readdir_r_proto'
23156revision='$revision'
23157rm='$rm'
23158rm_try='$rm_try'
23159rmail='$rmail'
23160run='$run'
23161runnm='$runnm'
23162sGMTIME_max='$sGMTIME_max'
23163sGMTIME_min='$sGMTIME_min'
23164sLOCALTIME_max='$sLOCALTIME_max'
23165sLOCALTIME_min='$sLOCALTIME_min'
23166sPRIEUldbl='$sPRIEUldbl'
23167sPRIFUldbl='$sPRIFUldbl'
23168sPRIGUldbl='$sPRIGUldbl'
23169sPRIXU64='$sPRIXU64'
23170sPRId64='$sPRId64'
23171sPRIeldbl='$sPRIeldbl'
23172sPRIfldbl='$sPRIfldbl'
23173sPRIgldbl='$sPRIgldbl'
23174sPRIi64='$sPRIi64'
23175sPRIo64='$sPRIo64'
23176sPRIu64='$sPRIu64'
23177sPRIx64='$sPRIx64'
23178sSCNfldbl='$sSCNfldbl'
23179sched_yield='$sched_yield'
23180scriptdir='$scriptdir'
23181scriptdirexp='$scriptdirexp'
23182sed='$sed'
23183seedfunc='$seedfunc'
23184selectminbits='$selectminbits'
23185selecttype='$selecttype'
23186sendmail='$sendmail'
23187setgrent_r_proto='$setgrent_r_proto'
23188sethostent_r_proto='$sethostent_r_proto'
23189setlocale_r_proto='$setlocale_r_proto'
23190setnetent_r_proto='$setnetent_r_proto'
23191setprotoent_r_proto='$setprotoent_r_proto'
23192setpwent_r_proto='$setpwent_r_proto'
23193setservent_r_proto='$setservent_r_proto'
23194sh='$sh'
23195shar='$shar'
23196sharpbang='$sharpbang'
23197shmattype='$shmattype'
23198shortsize='$shortsize'
23199shrpenv='$shrpenv'
23200shsharp='$shsharp'
23201sig_count='$sig_count'
23202sig_name='$sig_name'
23203sig_name_init='$sig_name_init'
23204sig_num='$sig_num'
23205sig_num_init='$sig_num_init'
23206sig_size='$sig_size'
23207signal_t='$signal_t'
23208sitearch='$sitearch'
23209sitearchexp='$sitearchexp'
23210sitebin='$sitebin'
23211sitebinexp='$sitebinexp'
23212sitehtml1dir='$sitehtml1dir'
23213sitehtml1direxp='$sitehtml1direxp'
23214sitehtml3dir='$sitehtml3dir'
23215sitehtml3direxp='$sitehtml3direxp'
23216sitelib='$sitelib'
23217sitelib_stem='$sitelib_stem'
23218sitelibexp='$sitelibexp'
23219siteman1dir='$siteman1dir'
23220siteman1direxp='$siteman1direxp'
23221siteman3dir='$siteman3dir'
23222siteman3direxp='$siteman3direxp'
23223siteprefix='$siteprefix'
23224siteprefixexp='$siteprefixexp'
23225sitescript='$sitescript'
23226sitescriptexp='$sitescriptexp'
23227sizesize='$sizesize'
23228sizetype='$sizetype'
23229sleep='$sleep'
23230smail='$smail'
23231so='$so'
23232sockethdr='$sockethdr'
23233socketlib='$socketlib'
23234socksizetype='$socksizetype'
23235sort='$sort'
23236spackage='$spackage'
23237spitshell='$spitshell'
23238srand48_r_proto='$srand48_r_proto'
23239srandom_r_proto='$srandom_r_proto'
23240src='$src'
23241ssizetype='$ssizetype'
23242startperl='$startperl'
23243startsh='$startsh'
23244static_ext='$static_ext'
23245stdchar='$stdchar'
23246stdio_base='$stdio_base'
23247stdio_bufsiz='$stdio_bufsiz'
23248stdio_cnt='$stdio_cnt'
23249stdio_filbuf='$stdio_filbuf'
23250stdio_ptr='$stdio_ptr'
23251stdio_stream_array='$stdio_stream_array'
23252strerror_r_proto='$strerror_r_proto'
23253strings='$strings'
23254submit='$submit'
23255subversion='$subversion'
23256sysman='$sysman'
23257tail='$tail'
23258tar='$tar'
23259targetarch='$targetarch'
23260tbl='$tbl'
23261tee='$tee'
23262test='$test'
23263timeincl='$timeincl'
23264timetype='$timetype'
23265tmpnam_r_proto='$tmpnam_r_proto'
23266to='$to'
23267touch='$touch'
23268tr='$tr'
23269trnl='$trnl'
23270troff='$troff'
23271ttyname_r_proto='$ttyname_r_proto'
23272u16size='$u16size'
23273u16type='$u16type'
23274u32size='$u32size'
23275u32type='$u32type'
23276u64size='$u64size'
23277u64type='$u64type'
23278u8size='$u8size'
23279u8type='$u8type'
23280uidformat='$uidformat'
23281uidsign='$uidsign'
23282uidsize='$uidsize'
23283uidtype='$uidtype'
23284uname='$uname'
23285uniq='$uniq'
23286uquadtype='$uquadtype'
23287use5005threads='$use5005threads'
23288use64bitall='$use64bitall'
23289use64bitint='$use64bitint'
23290usecrosscompile='$usecrosscompile'
23291usedevel='$usedevel'
23292usedl='$usedl'
23293usedtrace='$usedtrace'
23294usefaststdio='$usefaststdio'
23295useithreads='$useithreads'
23296uselargefiles='$uselargefiles'
23297uselongdouble='$uselongdouble'
23298usemallocwrap='$usemallocwrap'
23299usemorebits='$usemorebits'
23300usemultiplicity='$usemultiplicity'
23301usemymalloc='$usemymalloc'
23302usenm='$usenm'
23303useopcode='$useopcode'
23304useperlio='$useperlio'
23305useposix='$useposix'
23306usereentrant='$usereentrant'
23307userelocatableinc='$userelocatableinc'
23308usesfio='$usesfio'
23309useshrplib='$useshrplib'
23310usesitecustomize='$usesitecustomize'
23311usesocks='$usesocks'
23312usethreads='$usethreads'
23313usevendorprefix='$usevendorprefix'
23314usevfork='$usevfork'
23315usrinc='$usrinc'
23316uuname='$uuname'
23317uvXUformat='$uvXUformat'
23318uvoformat='$uvoformat'
23319uvsize='$uvsize'
23320uvtype='$uvtype'
23321uvuformat='$uvuformat'
23322uvxformat='$uvxformat'
23323vaproto='$vaproto'
23324vendorarch='$vendorarch'
23325vendorarchexp='$vendorarchexp'
23326vendorbin='$vendorbin'
23327vendorbinexp='$vendorbinexp'
23328vendorhtml1dir='$vendorhtml1dir'
23329vendorhtml1direxp='$vendorhtml1direxp'
23330vendorhtml3dir='$vendorhtml3dir'
23331vendorhtml3direxp='$vendorhtml3direxp'
23332vendorlib='$vendorlib'
23333vendorlib_stem='$vendorlib_stem'
23334vendorlibexp='$vendorlibexp'
23335vendorman1dir='$vendorman1dir'
23336vendorman1direxp='$vendorman1direxp'
23337vendorman3dir='$vendorman3dir'
23338vendorman3direxp='$vendorman3direxp'
23339vendorprefix='$vendorprefix'
23340vendorprefixexp='$vendorprefixexp'
23341vendorscript='$vendorscript'
23342vendorscriptexp='$vendorscriptexp'
23343version='$version'
23344version_patchlevel_string='$version_patchlevel_string'
23345versiononly='$versiononly'
23346vi='$vi'
23347voidflags='$voidflags'
23348xlibpth='$xlibpth'
23349yacc='$yacc'
23350yaccflags='$yaccflags'
23351zcat='$zcat'
23352zip='$zip'
23353EOT
23354
23355: add special variables
23356$test -f $src/patchlevel.h && \
23357awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23358echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23359echo "PERL_CONFIG_SH=true" >>config.sh
23360
23361: propagate old symbols
23362if $test -f UU/config.sh; then
23363	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
23364	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23365		config.sh config.sh UU/oldconfig.sh |\
23366		$sort | $uniq -u >UU/oldsyms
23367	set X `cat UU/oldsyms`
23368	shift
23369	case $# in
23370	0) ;;
23371	*)
23372		cat <<EOM
23373Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23374EOM
23375		echo ": Variables propagated from previous config.sh file." >>config.sh
23376		for sym in `cat UU/oldsyms`; do
23377			echo "    Propagating $hint variable "'$'"$sym..."
23378			eval 'tmp="$'"${sym}"'"'
23379			echo "$tmp" | \
23380				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23381		done
23382		;;
23383	esac
23384fi
23385
23386: Finish up by extracting the .SH files
23387case "$alldone" in
23388exit)
23389	$rm -rf UU
23390	echo "Extraction done."
23391	exit 0
23392	;;
23393cont)
23394	;;
23395'')
23396	dflt=''
23397	nostick=true
23398	$cat <<EOM
23399
23400If you'd like to make any changes to the config.sh file before I begin
23401to configure things, do it as a shell escape now (e.g. !vi config.sh).
23402
23403EOM
23404	rp="Press return or use a shell escape to edit config.sh:"
23405	. UU/myread
23406	nostick=''
23407	case "$ans" in
23408	'') ;;
23409	*) : in case they cannot read
23410		sh 1>&4 -c "$ans";;
23411	esac
23412	;;
23413esac
23414
23415: if this fails, just run all the .SH files by hand
23416. ./config.sh
23417
23418echo " "
23419exec 1>&4
23420pwd=`pwd`
23421. ./UU/extract
23422cd "$pwd"
23423
23424if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23425	dflt=y
23426	case "$silent" in
23427	true) ;;
23428	*)
23429		$cat <<EOM
23430
23431Now you need to generate make dependencies by running "$make depend".
23432You might prefer to run it in background: "$make depend > makedepend.out &"
23433It can take a while, so you might not want to run it right now.
23434
23435EOM
23436		;;
23437	esac
23438	rp="Run $make depend now?"
23439	. UU/myread
23440	case "$ans" in
23441	y*)
23442		$make depend && echo "Now you must run '$make'."
23443		;;
23444	*)
23445		echo "You must run '$make depend' then '$make'."
23446		;;
23447	esac
23448elif test -f [Mm]akefile; then
23449	echo " "
23450	echo "Now you must run a $make."
23451else
23452	echo "Configure done."
23453fi
23454
23455if $test -f Policy.sh; then
23456    $cat <<EOM
23457
23458If you compile $package on a different machine or from a different object
23459directory, copy the Policy.sh file from this object directory to the
23460new one before you run Configure -- this will help you with most of
23461the policy defaults.
23462
23463EOM
23464fi
23465if $test -f config.msg; then
23466    echo "Hmm.  I also noted the following information while running:"
23467    echo " "
23468    $cat config.msg >&4
23469    $rm -f config.msg
23470fi
23471$rm -f kit*isdone ark*isdone
23472$rm -rf UU
23473
23474: End of Configure
23475
23476