xref: /openbsd/gnu/usr.bin/perl/Configure (revision db3296cf)
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-3.0 package (which contains metaconfig) was posted in
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
19#
20
21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22#
23# Generated on Fri Jul 19 01:54:37 EET DST 2002 [metaconfig 3.0 PL70]
24# (with additional metaconfig patches by perlbug@perl.org)
25
26cat >c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false.  Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >c2$$ <<EOF
38
39OOPS!  You naughty creature!  You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat c1$$ c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f c1$$ c2$$
49
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55	test "$me" || me=$0
56	;;
57esac
58
59: Proper separator for the PATH environment variable
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
62if test -d c:/. ; then
63    if test -n "$OS2_SHELL"; then
64		p_=\;
65		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67	elif test -n "$DJGPP"; then
68		case "X${MACHTYPE:-nonesuchmach}" in
69		*cygwin) ;;
70		*) p_=\; ;;
71		esac
72	fi
73fi
74
75: Proper PATH setting
76paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83paths="$paths /sbin /usr/sbin /usr/libexec"
84paths="$paths /system/gnu_library/bin"
85
86for p in $paths
87do
88	case "$p_$PATH$p_" in
89	*$p_$p$p_*) ;;
90	*) test -d $p && PATH=$PATH$p_$p ;;
91	esac
92done
93
94PATH=.$p_$PATH
95export PATH
96
97: shall we be using ksh?
98inksh=''
99needksh=''
100avoidksh=''
101newsh=/bin/ksh
102changesh=''
103if (PATH=.; alias -x) >/dev/null 2>&1; then
104		inksh=true
105fi
106if test -f /hp-ux -a -f /bin/ksh; then
107	needksh='to avoid sh bug in "here document" expansion'
108fi
109if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110	if test X`/usr/bin/uname -v` = X4; then
111		avoidksh="to avoid AIX 4's /bin/sh"
112		newsh=/usr/bin/bsh
113	fi
114fi
115if test -f /osf_boot -a -f /usr/sbin/setld; then
116	if test X`/usr/bin/uname -s` = XOSF1; then
117	        avoidksh="to avoid Digital UNIX' ksh"
118	        newsh=/bin/sh
119	        unset BIN_SH # if this is 'xpg4' sh will start up ksh
120	fi
121fi
122case "$inksh/$needksh" in
123/[a-z]*)
124		ENV=''
125		changesh=true
126		reason="$needksh"
127	;;
128esac
129case "$inksh/$avoidksh" in
130true/[a-z]*)
131	changesh=true
132	reason="$avoidksh"
133	;;
134esac
135case "$inksh/$needksh-$avoidksh-" in
136true/--)
137		cat <<EOM
138(I see you are using the Korn shell.  Some ksh's blow up on $me,
139mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140EOM
141	;;
142esac
143case "$changesh" in
144true)
145	export newsh
146	echo "(Feeding myself to $newsh $reason.)"
147	case "$0" in
148	Configure|*/Configure) exec $newsh $0 "$@";;
149	*) exec $newsh Configure "$@";;
150	esac
151	;;
152esac
153
154: if needed set CDPATH to a harmless value that is not chatty
155: avoid bash 2.02 problems with empty CDPATH.
156case "$CDPATH" in
157'')	;;
158*)	case "$SHELL" in
159	*bash*)	CDPATH='.' ;;
160	*)		CDPATH='' ;;
161	esac
162	;;
163esac
164: Configure runs within the UU subdirectory
165test -d UU || mkdir UU
166cd UU && rm -f ./*
167
168
169ccname=''
170ccversion=''
171ccsymbols=''
172cppccsymbols=''
173cppsymbols=''
174from=''
175run=''
176targetarch=''
177to=''
178usecrosscompile=''
179perllibs=''
180dynamic_ext=''
181extensions=''
182known_extensions=''
183nonxs_ext=''
184static_ext=''
185useopcode=''
186useposix=''
187extras=''
188d_bsd=''
189d_eunice=''
190d_xenix=''
191eunicefix=''
192Mcc=''
193ar=''
194awk=''
195bash=''
196bison=''
197byacc=''
198cat=''
199chgrp=''
200chmod=''
201chown=''
202comm=''
203compress=''
204cp=''
205cpio=''
206cpp=''
207csh=''
208date=''
209echo=''
210egrep=''
211emacs=''
212expr=''
213find=''
214flex=''
215gmake=''
216grep=''
217gzip=''
218inews=''
219ksh=''
220less=''
221line=''
222lint=''
223ln=''
224lp=''
225lpr=''
226ls=''
227mail=''
228mailx=''
229make=''
230mkdir=''
231more=''
232mv=''
233nm=''
234nroff=''
235perl=''
236pg=''
237pmake=''
238pr=''
239rm=''
240rmail=''
241sed=''
242sendmail=''
243shar=''
244sleep=''
245smail=''
246sort=''
247submit=''
248tail=''
249tar=''
250tbl=''
251tee=''
252test=''
253touch=''
254tr=''
255troff=''
256uname=''
257uniq=''
258uuname=''
259vi=''
260zcat=''
261zip=''
262full_ar=''
263full_sed=''
264libswanted=''
265hint=''
266myuname=''
267osname=''
268osvers=''
269Author=''
270Date=''
271Header=''
272Id=''
273Locker=''
274Log=''
275RCSfile=''
276Revision=''
277Source=''
278State=''
279_a=''
280_exe=''
281_o=''
282archobjs=''
283exe_ext=''
284firstmakefile=''
285lib_ext=''
286obj_ext=''
287path_sep=''
288afs=''
289afsroot=''
290alignbytes=''
291ansi2knr=''
292archlib=''
293archlibexp=''
294d_archlib=''
295installarchlib=''
296archname=''
297myarchname=''
298d_atolf=''
299d_atoll=''
300baserev=''
301bin=''
302binexp=''
303installbin=''
304byteorder=''
305cc=''
306ccflags=''
307cppflags=''
308ldflags=''
309lkflags=''
310locincpth=''
311optimize=''
312cf_email=''
313cf_by=''
314cf_time=''
315charsize=''
316contains=''
317cpp_stuff=''
318cpplast=''
319cppminus=''
320cpprun=''
321cppstdin=''
322d__fwalk=''
323d_access=''
324d_accessx=''
325d_alarm=''
326asctime_r_proto=''
327d_asctime_r=''
328d_attribut=''
329d_bcmp=''
330d_bcopy=''
331d_bzero=''
332d_casti32=''
333castflags=''
334d_castneg=''
335d_chown=''
336d_chroot=''
337d_chsize=''
338d_class=''
339d_closedir=''
340d_void_closedir=''
341d_cmsghdr_s=''
342d_const=''
343cryptlib=''
344d_crypt=''
345crypt_r_proto=''
346d_crypt_r=''
347d_csh=''
348full_csh=''
349ctermid_r_proto=''
350d_ctermid_r=''
351ctime_r_proto=''
352d_ctime_r=''
353d_cuserid=''
354d_dbl_dig=''
355d_dbminitproto=''
356d_difftime=''
357d_dirfd=''
358d_dlerror=''
359d_dlopen=''
360d_dlsymun=''
361d_dosuid=''
362d_suidsafe=''
363d_drand48_r=''
364drand48_r_proto=''
365d_drand48proto=''
366d_dup2=''
367d_eaccess=''
368d_endgrent=''
369d_endgrent_r=''
370endgrent_r_proto=''
371d_endhent=''
372d_endhostent_r=''
373endhostent_r_proto=''
374d_endnent=''
375d_endnetent_r=''
376endnetent_r_proto=''
377d_endpent=''
378d_endprotoent_r=''
379endprotoent_r_proto=''
380d_endpwent=''
381d_endpwent_r=''
382endpwent_r_proto=''
383d_endsent=''
384d_endservent_r=''
385endservent_r_proto=''
386d_fchdir=''
387d_fchmod=''
388d_fchown=''
389d_fcntl=''
390d_fcntl_can_lock=''
391d_fd_macros=''
392d_fd_set=''
393d_fds_bits=''
394d_fgetpos=''
395d_finite=''
396d_finitel=''
397d_flexfnam=''
398d_flock=''
399d_flockproto=''
400d_fork=''
401d_fp_class=''
402d_fpclass=''
403d_fpclassify=''
404d_fpclassl=''
405d_fpos64_t=''
406d_frexpl=''
407d_fs_data_s=''
408d_fseeko=''
409d_fsetpos=''
410d_fstatfs=''
411d_fsync=''
412d_ftello=''
413d_ftime=''
414d_gettimeod=''
415d_Gconvert=''
416d_getcwd=''
417d_getespwnam=''
418d_getfsstat=''
419d_getgrent=''
420d_getgrent_r=''
421getgrent_r_proto=''
422d_getgrgid_r=''
423getgrgid_r_proto=''
424d_getgrnam_r=''
425getgrnam_r_proto=''
426d_getgrps=''
427d_gethbyaddr=''
428d_gethbyname=''
429d_gethent=''
430aphostname=''
431d_gethname=''
432d_phostname=''
433d_uname=''
434d_gethostbyaddr_r=''
435gethostbyaddr_r_proto=''
436d_gethostbyname_r=''
437gethostbyname_r_proto=''
438d_gethostent_r=''
439gethostent_r_proto=''
440d_gethostprotos=''
441d_getitimer=''
442d_getlogin=''
443d_getlogin_r=''
444getlogin_r_proto=''
445d_getmnt=''
446d_getmntent=''
447d_getnbyaddr=''
448d_getnbyname=''
449d_getnent=''
450d_getnetbyaddr_r=''
451getnetbyaddr_r_proto=''
452d_getnetbyname_r=''
453getnetbyname_r_proto=''
454d_getnetent_r=''
455getnetent_r_proto=''
456d_getnetprotos=''
457d_getpagsz=''
458d_getpent=''
459d_getpgid=''
460d_getpgrp2=''
461d_bsdgetpgrp=''
462d_getpgrp=''
463d_getppid=''
464d_getprior=''
465d_getpbyname=''
466d_getpbynumber=''
467d_getprotobyname_r=''
468getprotobyname_r_proto=''
469d_getprotobynumber_r=''
470getprotobynumber_r_proto=''
471d_getprotoent_r=''
472getprotoent_r_proto=''
473d_getprotoprotos=''
474d_getprpwnam=''
475d_getpwent=''
476d_getpwent_r=''
477getpwent_r_proto=''
478d_getpwnam_r=''
479getpwnam_r_proto=''
480d_getpwuid_r=''
481getpwuid_r_proto=''
482d_getsent=''
483d_getservbyname_r=''
484getservbyname_r_proto=''
485d_getservbyport_r=''
486getservbyport_r_proto=''
487d_getservent_r=''
488getservent_r_proto=''
489d_getservprotos=''
490d_getspnam=''
491d_getspnam_r=''
492getspnam_r_proto=''
493d_getsbyname=''
494d_getsbyport=''
495d_gmtime_r=''
496gmtime_r_proto=''
497d_gnulibc=''
498gnulibc_version=''
499d_hasmntopt=''
500d_htonl=''
501d_inetaton=''
502d_int64_t=''
503d_isascii=''
504d_isfinite=''
505d_isinf=''
506d_isnan=''
507d_isnanl=''
508d_killpg=''
509d_lchown=''
510d_ldbl_dig=''
511d_link=''
512d_localtime_r=''
513localtime_r_proto=''
514d_locconv=''
515d_lockf=''
516d_longdbl=''
517longdblsize=''
518d_longlong=''
519longlongsize=''
520d_lseekproto=''
521d_lstat=''
522d_madvise=''
523d_mblen=''
524d_mbstowcs=''
525d_mbtowc=''
526d_memchr=''
527d_memcmp=''
528d_memcpy=''
529d_memmove=''
530d_memset=''
531d_mkdir=''
532d_mkdtemp=''
533d_mkfifo=''
534d_mkstemp=''
535d_mkstemps=''
536d_mktime=''
537d_mmap=''
538mmaptype=''
539d_modfl=''
540d_modfl_pow32_bug=''
541d_mprotect=''
542d_msg=''
543d_msgctl=''
544d_msgget=''
545d_msghdr_s=''
546d_msgrcv=''
547d_msgsnd=''
548d_msync=''
549d_munmap=''
550d_nice=''
551d_nl_langinfo=''
552d_off64_t=''
553d_open3=''
554d_fpathconf=''
555d_pathconf=''
556d_pause=''
557d_pipe=''
558d_poll=''
559d_portable=''
560d_procselfexe=''
561procselfexe=''
562d_old_pthread_create_joinable=''
563old_pthread_create_joinable=''
564d_pthread_atfork=''
565d_pthread_yield=''
566d_sched_yield=''
567sched_yield=''
568d_qgcvt=''
569d_random_r=''
570random_r_proto=''
571d_readdir64_r=''
572readdir64_r_proto=''
573d_readdir=''
574d_rewinddir=''
575d_seekdir=''
576d_telldir=''
577d_readdir_r=''
578readdir_r_proto=''
579d_readlink=''
580d_readv=''
581d_recvmsg=''
582d_rename=''
583d_rmdir=''
584d_safebcpy=''
585d_safemcpy=''
586d_sanemcmp=''
587d_sbrkproto=''
588d_select=''
589d_sem=''
590d_semctl=''
591d_semget=''
592d_semop=''
593d_sendmsg=''
594d_setegid=''
595d_seteuid=''
596d_setgrent=''
597d_setgrent_r=''
598setgrent_r_proto=''
599d_setgrps=''
600d_sethent=''
601d_sethostent_r=''
602sethostent_r_proto=''
603d_setitimer=''
604d_setlinebuf=''
605d_setlocale=''
606d_setlocale_r=''
607setlocale_r_proto=''
608d_setnent=''
609d_setnetent_r=''
610setnetent_r_proto=''
611d_setpent=''
612d_setpgid=''
613d_setpgrp2=''
614d_bsdsetpgrp=''
615d_setpgrp=''
616d_setprior=''
617d_setproctitle=''
618d_setprotoent_r=''
619setprotoent_r_proto=''
620d_setpwent=''
621d_setpwent_r=''
622setpwent_r_proto=''
623d_setregid=''
624d_setresgid=''
625d_setresuid=''
626d_setreuid=''
627d_setrgid=''
628d_setruid=''
629d_setsent=''
630d_setservent_r=''
631setservent_r_proto=''
632d_setsid=''
633d_setvbuf=''
634d_sfio=''
635usesfio=''
636d_shm=''
637d_shmat=''
638d_shmatprototype=''
639shmattype=''
640d_shmctl=''
641d_shmdt=''
642d_shmget=''
643d_sigaction=''
644d_sigprocmask=''
645d_sigsetjmp=''
646d_sockatmark=''
647d_sockatmarkproto=''
648d_msg_ctrunc=''
649d_msg_dontroute=''
650d_msg_oob=''
651d_msg_peek=''
652d_msg_proxy=''
653d_oldsock=''
654d_scm_rights=''
655d_socket=''
656d_sockpair=''
657sockethdr=''
658socketlib=''
659d_socklen_t=''
660d_socks5_init=''
661d_sqrtl=''
662d_srand48_r=''
663srand48_r_proto=''
664d_srandom_r=''
665srandom_r_proto=''
666d_sresgproto=''
667d_sresuproto=''
668d_statblks=''
669d_statfs_f_flags=''
670d_statfs_s=''
671d_fstatvfs=''
672d_statvfs=''
673d_stdio_cnt_lval=''
674d_stdio_ptr_lval=''
675d_stdio_ptr_lval_nochange_cnt=''
676d_stdio_ptr_lval_sets_cnt=''
677d_stdiobase=''
678d_stdstdio=''
679stdio_base=''
680stdio_bufsiz=''
681stdio_cnt=''
682stdio_filbuf=''
683stdio_ptr=''
684d_index=''
685d_strchr=''
686d_strcoll=''
687d_strctcpy=''
688d_strerrm=''
689d_strerror=''
690d_sysernlst=''
691d_syserrlst=''
692d_strerror_r=''
693strerror_r_proto=''
694d_strftime=''
695d_strtod=''
696d_strtol=''
697d_strtold=''
698d_strtoll=''
699d_strtoq=''
700d_strtoul=''
701d_strtoull=''
702d_strtouq=''
703d_strxfrm=''
704d_symlink=''
705d_syscall=''
706d_syscallproto=''
707d_sysconf=''
708d_system=''
709d_tcgetpgrp=''
710d_tcsetpgrp=''
711d_telldirproto=''
712d_time=''
713timetype=''
714clocktype=''
715d_times=''
716d_tmpnam_r=''
717tmpnam_r_proto=''
718d_truncate=''
719d_ttyname_r=''
720ttyname_r_proto=''
721d_tzname=''
722d_u32align=''
723d_ualarm=''
724d_umask=''
725d_semctl_semid_ds=''
726d_semctl_semun=''
727d_union_semun=''
728d_unordered=''
729d_usleep=''
730d_usleepproto=''
731d_ustat=''
732d_vfork=''
733usevfork=''
734d_voidsig=''
735signal_t=''
736d_volatile=''
737d_charvspr=''
738d_vprintf=''
739d_wait4=''
740d_waitpid=''
741d_wcstombs=''
742d_wctomb=''
743d_writev=''
744dlext=''
745cccdlflags=''
746ccdlflags=''
747dlsrc=''
748ld=''
749lddlflags=''
750usedl=''
751doublesize=''
752ebcdic=''
753fflushNULL=''
754fflushall=''
755fpossize=''
756fpostype=''
757gccosandvers=''
758gccversion=''
759gidformat=''
760gidsign=''
761gidsize=''
762gidtype=''
763groupstype=''
764h_fcntl=''
765h_sysfile=''
766i_arpainet=''
767i_crypt=''
768db_hashtype=''
769db_prefixtype=''
770db_version_major=''
771db_version_minor=''
772db_version_patch=''
773i_db=''
774i_dbm=''
775i_rpcsvcdbm=''
776d_dirnamlen=''
777direntrytype=''
778i_dirent=''
779i_dld=''
780i_dlfcn=''
781i_fcntl=''
782i_float=''
783i_fp=''
784i_fp_class=''
785i_gdbm=''
786d_grpasswd=''
787i_grp=''
788i_ieeefp=''
789i_inttypes=''
790i_langinfo=''
791i_libutil=''
792i_limits=''
793i_locale=''
794i_machcthr=''
795i_malloc=''
796i_math=''
797i_memory=''
798i_mntent=''
799i_ndbm=''
800i_netdb=''
801i_neterrno=''
802i_netinettcp=''
803i_niin=''
804i_sysin=''
805i_poll=''
806i_prot=''
807i_pthread=''
808d_pwage=''
809d_pwchange=''
810d_pwclass=''
811d_pwcomment=''
812d_pwexpire=''
813d_pwgecos=''
814d_pwpasswd=''
815d_pwquota=''
816i_pwd=''
817i_sfio=''
818i_shadow=''
819i_socks=''
820i_stddef=''
821i_stdlib=''
822i_string=''
823strings=''
824i_sunmath=''
825i_sysaccess=''
826i_sysdir=''
827i_sysfile=''
828d_voidtty=''
829i_bsdioctl=''
830i_sysfilio=''
831i_sysioctl=''
832i_syssockio=''
833i_syslog=''
834i_sysmman=''
835i_sysmode=''
836i_sysmount=''
837i_sysndir=''
838i_sysparam=''
839i_sysresrc=''
840i_syssecrt=''
841i_sysselct=''
842i_sysstat=''
843i_sysstatfs=''
844i_sysstatvfs=''
845i_systimes=''
846i_systypes=''
847i_sysuio=''
848i_sysun=''
849i_sysutsname=''
850i_sysvfs=''
851i_syswait=''
852i_sgtty=''
853i_termio=''
854i_termios=''
855d_tm_tm_gmtoff=''
856d_tm_tm_zone=''
857i_systime=''
858i_systimek=''
859i_time=''
860timeincl=''
861i_unistd=''
862i_ustat=''
863i_utime=''
864i_values=''
865i_stdarg=''
866i_varargs=''
867i_varhdr=''
868i_vfork=''
869inc_version_list=''
870inc_version_list_init=''
871installprefix=''
872installprefixexp=''
873installstyle=''
874installusrbinperl=''
875intsize=''
876longsize=''
877shortsize=''
878issymlink=''
879libc=''
880ldlibpthname=''
881libperl=''
882shrpenv=''
883useshrplib=''
884glibpth=''
885libpth=''
886loclibpth=''
887plibpth=''
888xlibpth=''
889ignore_versioned_solibs=''
890libs=''
891libsdirs=''
892libsfiles=''
893libsfound=''
894libspath=''
895lns=''
896d_PRIEUldbl=''
897d_PRIFUldbl=''
898d_PRIGUldbl=''
899d_PRIeldbl=''
900d_PRIfldbl=''
901d_PRIgldbl=''
902d_SCNfldbl=''
903sPRIEUldbl=''
904sPRIFUldbl=''
905sPRIGUldbl=''
906sPRIeldbl=''
907sPRIfldbl=''
908sPRIgldbl=''
909sSCNfldbl=''
910lseeksize=''
911lseektype=''
912make_set_make=''
913d_mymalloc=''
914freetype=''
915mallocobj=''
916mallocsrc=''
917malloctype=''
918usemymalloc=''
919installman1dir=''
920man1dir=''
921man1direxp=''
922man1ext=''
923installman3dir=''
924man3dir=''
925man3direxp=''
926man3ext=''
927modetype=''
928multiarch=''
929mydomain=''
930myhostname=''
931phostname=''
932c=''
933n=''
934d_eofnblk=''
935eagain=''
936o_nonblock=''
937rd_nodata=''
938need_va_copy=''
939netdb_hlen_type=''
940netdb_host_type=''
941netdb_name_type=''
942netdb_net_type=''
943groupcat=''
944hostcat=''
945passcat=''
946orderlib=''
947ranlib=''
948d_perl_otherlibdirs=''
949otherlibdirs=''
950package=''
951spackage=''
952pager=''
953api_revision=''
954api_subversion=''
955api_version=''
956api_versionstring=''
957patchlevel=''
958perl_patchlevel=''
959revision=''
960subversion=''
961version=''
962version_patchlevel_string=''
963perl5=''
964perladmin=''
965perlpath=''
966d_nv_preserves_uv=''
967i16size=''
968i16type=''
969i32size=''
970i32type=''
971i64size=''
972i64type=''
973i8size=''
974i8type=''
975ivsize=''
976ivtype=''
977nv_preserves_uv_bits=''
978nvsize=''
979nvtype=''
980u16size=''
981u16type=''
982u32size=''
983u32type=''
984u64size=''
985u64type=''
986u8size=''
987u8type=''
988uvsize=''
989uvtype=''
990ivdformat=''
991nvEUformat=''
992nvFUformat=''
993nvGUformat=''
994nveformat=''
995nvfformat=''
996nvgformat=''
997uvXUformat=''
998uvoformat=''
999uvuformat=''
1000uvxformat=''
1001pidtype=''
1002prefix=''
1003prefixexp=''
1004installprivlib=''
1005privlib=''
1006privlibexp=''
1007prototype=''
1008ptrsize=''
1009d_PRIXU64=''
1010d_PRId64=''
1011d_PRIi64=''
1012d_PRIo64=''
1013d_PRIu64=''
1014d_PRIx64=''
1015sPRIXU64=''
1016sPRId64=''
1017sPRIi64=''
1018sPRIo64=''
1019sPRIu64=''
1020sPRIx64=''
1021d_quad=''
1022quadkind=''
1023quadtype=''
1024uquadtype=''
1025drand01=''
1026randbits=''
1027randfunc=''
1028randseedtype=''
1029seedfunc=''
1030installscript=''
1031scriptdir=''
1032scriptdirexp=''
1033selectminbits=''
1034selecttype=''
1035sh=''
1036sig_count=''
1037sig_name=''
1038sig_name_init=''
1039sig_num=''
1040sig_num_init=''
1041sig_size=''
1042installsitearch=''
1043sitearch=''
1044sitearchexp=''
1045installsitebin=''
1046sitebin=''
1047sitebinexp=''
1048installsitelib=''
1049sitelib=''
1050sitelib_stem=''
1051sitelibexp=''
1052siteprefix=''
1053siteprefixexp=''
1054sizesize=''
1055sizetype=''
1056so=''
1057socksizetype=''
1058sharpbang=''
1059shsharp=''
1060spitshell=''
1061src=''
1062ssizetype=''
1063startperl=''
1064startsh=''
1065stdchar=''
1066d_stdio_stream_array=''
1067stdio_stream_array=''
1068sysman=''
1069trnl=''
1070uidformat=''
1071uidsign=''
1072uidsize=''
1073uidtype=''
1074archname64=''
1075use64bitall=''
1076use64bitint=''
1077ccflags_uselargefiles=''
1078ldflags_uselargefiles=''
1079libswanted_uselargefiles=''
1080uselargefiles=''
1081uselongdouble=''
1082usemorebits=''
1083usemultiplicity=''
1084nm_opt=''
1085nm_so_opt=''
1086runnm=''
1087usenm=''
1088useperlio=''
1089usesocks=''
1090d_oldpthreads=''
1091use5005threads=''
1092useithreads=''
1093usereentrant=''
1094usethreads=''
1095incpath=''
1096mips_type=''
1097usrinc=''
1098d_vendorarch=''
1099installvendorarch=''
1100vendorarch=''
1101vendorarchexp=''
1102d_vendorbin=''
1103installvendorbin=''
1104vendorbin=''
1105vendorbinexp=''
1106d_vendorlib=''
1107installvendorlib=''
1108vendorlib=''
1109vendorlib_stem=''
1110vendorlibexp=''
1111usevendorprefix=''
1112vendorprefix=''
1113vendorprefixexp=''
1114versiononly=''
1115defvoidused=''
1116voidflags=''
1117pm_apiversion=''
1118xs_apiversion=''
1119yacc=''
1120yaccflags=''
1121CONFIG=''
1122
1123define='define'
1124undef='undef'
1125smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1126rmlist=''
1127
1128: We must find out about Eunice early
1129eunicefix=':'
1130if test -f /etc/unixtovms; then
1131	eunicefix=/etc/unixtovms
1132fi
1133if test -f /etc/unixtovms.exe; then
1134	eunicefix=/etc/unixtovms.exe
1135fi
1136
1137: Set executable suffix now -- needed before hints available
1138if test -f "/libs/version.library"; then
1139: Amiga OS
1140    _exe=""
1141elif test -f "/system/gnu_library/bin/ar.pm"; then
1142: Stratus VOS
1143    _exe=".pm"
1144elif test -n "$DJGPP"; then
1145: DOS DJGPP
1146    _exe=".exe"
1147elif test -d c:/. ; then
1148: OS/2 or cygwin
1149    _exe=".exe"
1150fi
1151
1152i_whoami=''
1153ccname=''
1154ccversion=''
1155perllibs=''
1156: set useposix=false in your hint file to disable the POSIX extension.
1157useposix=true
1158: set useopcode=false in your hint file to disable the Opcode extension.
1159useopcode=true
1160: Trailing extension.  Override this in a hint file, if needed.
1161: Extra object files, if any, needed on this platform.
1162archobjs=''
1163archname=''
1164: Possible local include directories to search.
1165: Set locincpth to "" in a hint file to defeat local include searches.
1166locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1167locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1168:
1169: no include file wanted by default
1170inclwanted=''
1171
1172groupstype=''
1173libnames=''
1174: change the next line if compiling for Xenix/286 on Xenix/386
1175xlibpth='/usr/lib/386 /lib/386'
1176: Possible local library directories to search.
1177loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1178loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1179
1180: general looking path for locating libraries
1181glibpth="/lib /usr/lib $xlibpth"
1182glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1183test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1184test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1185
1186: Private path used by Configure to find libraries.  Its value
1187: is prepended to libpth. This variable takes care of special
1188: machines, like the mips.  Usually, it should be empty.
1189plibpth=''
1190
1191: default library list
1192libswanted=''
1193: some systems want to use only the non-versioned libso:s
1194ignore_versioned_solibs=''
1195archname64=''
1196ccflags_uselargefiles=''
1197ldflags_uselargefiles=''
1198libswanted_uselargefiles=''
1199: set usemultiplicity on the Configure command line to enable multiplicity.
1200: set usesocks on the Configure command line to enable socks.
1201: set usethreads on the Configure command line to enable threads.
1202usereentrant='undef'
1203: full support for void wanted by default
1204defvoidused=15
1205
1206: List of libraries we want.
1207: If anyone needs -lnet, put it in a hint file.
1208libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1209libswanted="$libswanted dld ld sun m c cposix posix"
1210libswanted="$libswanted ndir dir crypt sec"
1211libswanted="$libswanted ucb bsd BSD PW x util"
1212: We probably want to search /usr/shlib before most other libraries.
1213: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1214glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1215glibpth="/usr/shlib $glibpth"
1216: Do not use vfork unless overridden by a hint file.
1217usevfork=false
1218
1219: Find the basic shell for Bourne shell scripts
1220case "$sh" in
1221'')
1222	case "$SYSTYPE" in
1223	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1224	*) xxx='/bin/sh';;
1225	esac
1226	if test -f "$xxx"; then
1227		sh="$xxx"
1228	else
1229		: Build up a list and do a single loop so we can 'break' out.
1230		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1231		for xxx in sh bash ksh pdksh ash; do
1232			for p in $pth; do
1233				try="$try ${p}/${xxx}"
1234			done
1235		done
1236		for xxx in $try; do
1237			if test -f "$xxx"; then
1238				sh="$xxx";
1239				break
1240			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1241				sh="$xxx";
1242				break
1243			elif test -f "$xxx.exe"; then
1244				sh="$xxx";
1245				break
1246			fi
1247		done
1248	fi
1249	;;
1250esac
1251
1252case "$sh" in
1253'')	cat >&2 <<EOM
1254$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1255
1256Usually it's in /bin/sh.  How did you even get this far?
1257Please contact me (Perl Maintainers) at perlbug@perl.org and 
1258we'll try to straighten this all out.
1259EOM
1260	exit 1
1261	;;
1262esac
1263
1264: see if sh knows # comments
1265if `$sh -c '#' >/dev/null 2>&1`; then
1266	shsharp=true
1267	spitshell=cat
1268	xcat=/bin/cat
1269	test -f $xcat$_exe || xcat=/usr/bin/cat
1270	if test ! -f $xcat$_exe; then
1271		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1272			if test -f $p/cat$_exe; then
1273				xcat=$p/cat
1274				break
1275			fi
1276		done
1277		if test ! -f $xcat$_exe; then
1278			echo "Can't find cat anywhere!"
1279			exit 1
1280		fi
1281	fi
1282	echo "#!$xcat" >sharp
1283	$eunicefix sharp
1284	chmod +x sharp
1285	./sharp > today
1286	if test -s today; then
1287		sharpbang='#!'
1288	else
1289		echo "#! $xcat" > sharp
1290		$eunicefix sharp
1291		chmod +x sharp
1292		./sharp > today
1293		if test -s today; then
1294			sharpbang='#! '
1295		else
1296			sharpbang=': use '
1297		fi
1298	fi
1299else
1300	echo " "
1301	echo "Your $sh doesn't grok # comments--I will strip them later on."
1302	shsharp=false
1303	cd ..
1304	echo "exec grep -v '^[ 	]*#'" >spitshell
1305	chmod +x spitshell
1306	$eunicefix spitshell
1307	spitshell=`pwd`/spitshell
1308	cd UU
1309	echo "I presume that if # doesn't work, #! won't work either!"
1310	sharpbang=': use '
1311fi
1312rm -f sharp today
1313
1314: figure out how to guarantee sh startup
1315case "$startsh" in
1316'') startsh=${sharpbang}${sh} ;;
1317*)
1318esac
1319cat >sharp <<EOSS
1320$startsh
1321set abc
1322test "$?abc" != 1
1323EOSS
1324
1325chmod +x sharp
1326$eunicefix sharp
1327if ./sharp; then
1328	: echo "Yup, it does."
1329else
1330	echo "Hmm... '$startsh' does not guarantee sh startup..."
1331	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1332fi
1333rm -f sharp
1334
1335
1336: Save command line options in file UU/cmdline.opt for later use in
1337: generating config.sh.
1338cat > cmdline.opt <<EOSH
1339# Configure command line arguments.
1340config_arg0='$0'
1341config_args='$*'
1342config_argc=$#
1343EOSH
1344argn=1
1345args_exp=''
1346args_sep=''
1347for arg in "$@"; do
1348	cat >>cmdline.opt <<EOSH
1349config_arg$argn='$arg'
1350EOSH
1351	# Extreme backslashitis: replace each ' by '"'"'
1352	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1353$arg
1354EOC
1355	arg_exp=`cat cmdl.opt`
1356	args_exp="$args_exp$args_sep'$arg_exp'"
1357	argn=`expr $argn + 1`
1358	args_sep=' '
1359done
1360# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1361# used by ./hints/os2.sh
1362rm -f cmdl.opt
1363
1364: produce awk script to parse command line options
1365cat >options.awk <<'EOF'
1366BEGIN {
1367	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1368
1369	len = length(optstr);
1370	for (i = 1; i <= len; i++) {
1371		c = substr(optstr, i, 1);
1372		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1373		if (a == ":") {
1374			arg[c] = 1;
1375			i++;
1376		}
1377		opt[c] = 1;
1378	}
1379}
1380{
1381	expect = 0;
1382	str = $0;
1383	if (substr(str, 1, 1) != "-") {
1384		printf("'%s'\n", str);
1385		next;
1386	}
1387	len = length($0);
1388	for (i = 2; i <= len; i++) {
1389		c = substr(str, i, 1);
1390		if (!opt[c]) {
1391			printf("-%s\n", substr(str, i));
1392			next;
1393		}
1394		printf("-%s\n", c);
1395		if (arg[c]) {
1396			if (i < len)
1397				printf("'%s'\n", substr(str, i + 1));
1398			else
1399				expect = 1;
1400			next;
1401		}
1402	}
1403}
1404END {
1405	if (expect)
1406		print "?";
1407}
1408EOF
1409
1410: process the command line options
1411set X `for arg in "$@"; do echo "X$arg"; done |
1412	sed -e s/X// | awk -f options.awk`
1413eval "set $*"
1414shift
1415rm -f options.awk
1416
1417: set up default values
1418fastread=''
1419reuseval=false
1420config_sh=''
1421alldone=''
1422error=''
1423silent=''
1424extractsh=''
1425override=''
1426knowitall=''
1427rm -f optdef.sh posthint.sh
1428cat >optdef.sh <<EOS
1429$startsh
1430EOS
1431
1432
1433: option parsing
1434while test $# -gt 0; do
1435	case "$1" in
1436	-d) shift; fastread=yes;;
1437	-e) shift; alldone=cont;;
1438	-f)
1439		shift
1440		cd ..
1441		if test -r "$1"; then
1442			config_sh="$1"
1443		else
1444			echo "$me: cannot read config file $1." >&2
1445			error=true
1446		fi
1447		cd UU
1448		shift;;
1449	-h) shift; error=true;;
1450	-r) shift; reuseval=true;;
1451	-s) shift; silent=true; realsilent=true;;
1452	-E) shift; alldone=exit;;
1453	-K) shift; knowitall=true;;
1454	-O) shift; override=true;;
1455	-S) shift; silent=true; extractsh=true;;
1456	-D)
1457		shift
1458		case "$1" in
1459		*=)
1460			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1461			echo "$me: ignoring -D $1" >&2
1462			;;
1463		*=*) echo "$1" | \
1464				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1465		*) echo "$1='define'" >> optdef.sh;;
1466		esac
1467		shift
1468		;;
1469	-U)
1470		shift
1471		case "$1" in
1472		*=) echo "$1" >> optdef.sh;;
1473		*=*)
1474			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1475			echo "$me: ignoring -U $1" >&2
1476			;;
1477		*) echo "$1='undef'" >> optdef.sh;;
1478		esac
1479		shift
1480		;;
1481	-A)
1482	    shift
1483	    xxx=''
1484	    yyy="$1"
1485	    zzz=''
1486	    uuu=undef
1487	    case "$yyy" in
1488            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1489                 case "$zzz" in
1490                 *:*) zzz='' ;;
1491                 *)   xxx=append
1492                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1493                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1494                 esac
1495                 ;;
1496            esac
1497            case "$xxx" in
1498            '')  case "$yyy" in
1499                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1500                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1501                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1502                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1503                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1504                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1505                 esac
1506                 ;;
1507            esac
1508	    case "$xxx" in
1509	    append)
1510		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1511	    clear)
1512		echo "$yyy=''"			>> posthint.sh ;;
1513	    define)
1514	        case "$zzz" in
1515		'') zzz=define ;;
1516		esac
1517		echo "$yyy='$zzz'"		>> posthint.sh ;;
1518	    eval)
1519		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1520	    prepend)
1521		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1522	    undef)
1523	        case "$zzz" in
1524		'') zzz="$uuu" ;;
1525		esac
1526		echo "$yyy=$zzz"		>> posthint.sh ;;
1527            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1528	    esac
1529	    shift
1530	    ;;
1531	-V) echo "$me generated by metaconfig 3.0 PL70." >&2
1532	    exit 0;;
1533	--) break;;
1534	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1535	*) break;;
1536	esac
1537done
1538
1539case "$error" in
1540true)
1541	cat >&2 <<EOM
1542Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1543                 [-U symbol] [-U symbol=] [-A command:symbol...]
1544  -d : use defaults for all answers.
1545  -e : go on without questioning past the production of config.sh.
1546  -f : specify an alternate default configuration file.
1547  -h : print this help message and exit (with an error status).
1548  -r : reuse C symbols value if possible (skips costly nm extraction).
1549  -s : silent mode, only echoes questions and essential information.
1550  -D : define symbol to have some value:
1551         -D symbol         symbol gets the value 'define'
1552         -D symbol=value   symbol gets the value 'value'
1553  -E : stop at the end of questions, after having produced config.sh.
1554  -K : do not use unless you know what you are doing.
1555  -O : let -D and -U override definitions from loaded configuration file.
1556  -S : perform variable substitutions on all .SH files (can mix with -f)
1557  -U : undefine symbol:
1558         -U symbol    symbol gets the value 'undef'
1559         -U symbol=   symbol gets completely empty
1560  -A : manipulate symbol after the platform specific hints have been applied:
1561	 -A symbol=value		append " "value to symbol
1562	 -A append:symbol=value		append value to symbol
1563	 -A define:symbol=value		define symbol to have value
1564         -A clear:symbol		define symbol to be ''
1565	 -A define:symbol		define symbol to be 'define'
1566	 -A eval:symbol=value		define symbol to be eval of value
1567	 -A prepend:symbol=value	prepend value to symbol
1568	 -A undef:symbol		define symbol to be 'undef'
1569	 -A undef:symbol=		define symbol to be ''
1570  -V : print version number and exit (with a zero status).
1571EOM
1572	exit 1
1573	;;
1574esac
1575
1576: Sanity checks
1577case "$fastread$alldone" in
1578yescont|yesexit) ;;
1579*)
1580	case "$extractsh" in
1581	true) ;;
1582	*)
1583		if test ! -t 0; then
1584			echo "Say 'sh Configure', not 'sh <Configure'"
1585			exit 1
1586		fi
1587		;;
1588	esac
1589	;;
1590esac
1591
1592exec 4>&1
1593case "$silent" in
1594true) exec 1>/dev/null;;
1595esac
1596
1597: run the defines and the undefines, if any, but leave the file out there...
1598touch optdef.sh
1599. ./optdef.sh
1600: create the posthint manipulation script and leave the file out there...
1601touch posthint.sh
1602
1603: set package name
1604package=perl5
1605first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1606last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1607case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1608ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1609*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1610esac
1611
1612: Some greps do not return status, grrr.
1613echo "grimblepritz" >grimble
1614if grep blurfldyick grimble >/dev/null 2>&1 ; then
1615	contains=contains
1616elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1617	contains=grep
1618else
1619	contains=contains
1620fi
1621rm -f grimble
1622: the following should work in any shell
1623case "$contains" in
1624contains*)
1625	echo " "
1626	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1627	cat >contains <<'EOSS'
1628grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1629EOSS
1630chmod +x contains
1631esac
1632
1633: Find the path to the source tree
1634case "$src" in
1635'') case "$0" in
1636    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1637         case "$src" in
1638	 /*)	;;
1639	 .)	;;
1640         *)	src=`cd ../$src && pwd` ;;
1641	 esac
1642         ;;
1643    *)   src='.';;
1644    esac;;
1645esac
1646case "$src" in
1647'')	src=/
1648	rsrc=/
1649	;;
1650/*) rsrc="$src";;
1651*) rsrc="../$src";;
1652esac
1653if test -f $rsrc/Configure && \
1654	$contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1655then
1656   : found it, so we are ok.
1657else
1658	rsrc=''
1659	for src in . .. ../.. ../../.. ../../../..; do
1660		if test -f ../$src/Configure && \
1661			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1662		then
1663			rsrc=../$src
1664			break
1665		fi
1666	done
1667fi
1668case "$rsrc" in
1669'')
1670	cat <<EOM >&4
1671
1672Sorry, I can't seem to locate the source dir for $package.  Please start
1673Configure with an explicit path -- i.e. /some/path/Configure.
1674
1675EOM
1676	exit 1
1677	;;
1678../.)	rsrc='..';;
1679*)
1680	echo " "
1681	echo "Sources for $package found in \"$src\"." >&4
1682	;;
1683esac
1684
1685: script used to extract .SH files with variable substitutions
1686cat >extract <<'EOS'
1687PERL_CONFIG_SH=true
1688echo "Doing variable substitutions on .SH files..."
1689if test -f MANIFEST; then
1690	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1691else
1692	echo "(Looking for .SH files under the source directory.)"
1693	set x `(cd "$src"; find . -name "*.SH" -print)`
1694fi
1695shift
1696case $# in
16970) set x `(cd "$src"; echo *.SH)`; shift;;
1698esac
1699if test ! -f "$src/$1"; then
1700	shift
1701fi
1702mkdir_p='
1703name=$1;
1704create="";
1705while test $name; do
1706	if test ! -d "$name"; then
1707		create="$name $create";
1708		name=`echo $name | sed -e "s|^[^/]*$||"`;
1709		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1710	else
1711		name="";
1712	fi;
1713done;
1714for file in $create; do
1715	mkdir $file;
1716done
1717'
1718for file in $*; do
1719	case "$src" in
1720	".")
1721		case "$file" in
1722		*/*)
1723			dir=`expr X$file : 'X\(.*\)/'`
1724			file=`expr X$file : 'X.*/\(.*\)'`
1725			(cd "$dir" && . ./$file)
1726			;;
1727		*)
1728			. ./$file
1729			;;
1730		esac
1731		;;
1732	*)
1733		case "$file" in
1734		*/*)
1735			dir=`expr X$file : 'X\(.*\)/'`
1736			file=`expr X$file : 'X.*/\(.*\)'`
1737			(set x $dir; shift; eval $mkdir_p)
1738			sh <"$src/$dir/$file"
1739			;;
1740		*)
1741			sh <"$src/$file"
1742			;;
1743		esac
1744		;;
1745	esac
1746done
1747if test -f "$src/config_h.SH"; then
1748	if test ! -f config.h; then
1749	: oops, they left it out of MANIFEST, probably, so do it anyway.
1750	. "$src/config_h.SH"
1751	fi
1752fi
1753EOS
1754
1755: extract files and exit if asked to do so
1756case "$extractsh" in
1757true)
1758	case "$realsilent" in
1759	true) ;;
1760	*) exec 1>&4;;
1761	esac
1762	case "$config_sh" in
1763	'') config_sh='config.sh';;
1764	esac
1765	echo " "
1766	echo "Fetching answers from $config_sh..."
1767	cd ..
1768	. $config_sh
1769	test "$override" && . ./optdef.sh
1770	echo " "
1771	. UU/extract
1772	rm -rf UU
1773	echo "Extraction done."
1774	exit 0
1775	;;
1776esac
1777
1778: Eunice requires " " instead of "", can you believe it
1779echo " "
1780: Here we go...
1781echo "Beginning of configuration questions for $package."
1782
1783trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1784
1785: first determine how to suppress newline on echo command
1786echo " "
1787echo "Checking echo to see how to suppress newlines..."
1788(echo "hi there\c" ; echo " ") >.echotmp
1789if $contains c .echotmp >/dev/null 2>&1 ; then
1790	echo "...using -n."
1791	n='-n'
1792	c=''
1793else
1794	cat <<'EOM'
1795...using \c
1796EOM
1797	n=''
1798	c='\c'
1799fi
1800echo $n "The star should be here-->$c"
1801echo '*'
1802rm -f .echotmp
1803
1804: Now test for existence of everything in MANIFEST
1805echo " "
1806if test -f "$rsrc/MANIFEST"; then
1807	echo "First let's make sure your kit is complete.  Checking..." >&4
1808	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1809	rm -f missing
1810	tmppwd=`pwd`
1811	for filelist in x??; do
1812		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1813	done
1814	if test -s missing; then
1815		cat missing >&4
1816		cat >&4 <<'EOM'
1817
1818THIS PACKAGE SEEMS TO BE INCOMPLETE.
1819
1820You have the option of continuing the configuration process, despite the
1821distinct possibility that your kit is damaged, by typing 'y'es.  If you
1822do, don't blame me if something goes wrong.  I advise you to type 'n'o
1823and contact the author (perlbug@perl.org).
1824
1825EOM
1826		echo $n "Continue? [n] $c" >&4
1827		read ans
1828		case "$ans" in
1829		y*)
1830			echo "Continuing..." >&4
1831			rm -f missing
1832			;;
1833		*)
1834			echo "ABORTING..." >&4
1835			kill $$
1836			;;
1837		esac
1838	else
1839		echo "Looks good..."
1840	fi
1841else
1842	echo "There is no MANIFEST file.  I hope your kit is complete !"
1843fi
1844rm -f missing x??
1845
1846echo " "
1847: Find the appropriate value for a newline for tr
1848if test -n "$DJGPP"; then
1849       trnl='\012'
1850fi
1851if test X"$trnl" = X; then
1852	case "`echo foo|tr '\n' x 2>/dev/null`" in
1853	foox) trnl='\n' ;;
1854	esac
1855fi
1856if test X"$trnl" = X; then
1857	case "`echo foo|tr '\012' x 2>/dev/null`" in
1858	foox) trnl='\012' ;;
1859	esac
1860fi
1861if test X"$trnl" = X; then
1862       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1863       fooxy) trnl='\n\r' ;;
1864       esac
1865fi
1866if test X"$trnl" = X; then
1867	cat <<EOM >&2
1868
1869$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1870
1871EOM
1872	exit 1
1873fi
1874
1875: compute the number of columns on the terminal for proper question formatting
1876case "$COLUMNS" in
1877'') COLUMNS='80';;
1878esac
1879
1880: set up the echo used in my read
1881myecho="case \"\$xxxm\" in
1882'') echo $n \"\$rp $c\" >&4;;
1883*) case \"\$rp\" in
1884	'') echo $n \"[\$xxxm] $c\";;
1885	*)
1886		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1887			echo \"\$rp\" >&4
1888			echo $n \"[\$xxxm] $c\" >&4
1889		else
1890			echo $n \"\$rp [\$xxxm] $c\" >&4
1891		fi
1892		;;
1893	esac;;
1894esac"
1895
1896: now set up to do reads with possible shell escape and default assignment
1897cat <<EOSC >myread
1898$startsh
1899xxxm=\$dflt
1900$myecho
1901ans='!'
1902case "\$fastread" in
1903yes) case "\$dflt" in
1904	'') ;;
1905	*) ans='';
1906		case "\$silent-\$rp" in
1907		true-) ;;
1908		*) echo " " >&4;;
1909		esac;;
1910	esac;;
1911*) case "\$silent" in
1912	true) case "\$rp" in
1913		'') ans='';;
1914		esac;;
1915	esac;;
1916esac
1917while expr "X\$ans" : "X!" >/dev/null; do
1918	read answ
1919	set x \$xxxm
1920	shift
1921	aok=''; eval "ans=\\"\$answ\\"" && aok=y
1922	case  "\$answ" in
1923	"!")
1924		sh 1>&4
1925		echo " "
1926		$myecho
1927		;;
1928	!*)
1929		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1930		shift
1931		sh 1>&4 -c "\$*"
1932		echo " "
1933		$myecho
1934		;;
1935	"\$ans")
1936		case "\$ans" in
1937		\\&*)
1938			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1939			shift
1940			case "\$1" in
1941			-d)
1942				fastread=yes
1943				echo "(OK, I'll run with -d after this question.)" >&4
1944				;;
1945			-*)
1946				echo "*** Sorry, \$1 not supported yet." >&4
1947				;;
1948			esac
1949			$myecho
1950			ans=!
1951			;;
1952		esac;;
1953	*)
1954		case "\$aok" in
1955		y)
1956			echo "*** Substitution done -- please confirm."
1957			xxxm="\$ans"
1958			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1959			xxxm="\$ans"
1960			ans=!
1961			;;
1962		*)
1963			echo "*** Error -- try again."
1964			ans=!
1965			;;
1966		esac
1967		$myecho
1968		;;
1969	esac
1970	case "\$ans\$xxxm\$nostick" in
1971	'')
1972		ans=!
1973		$myecho
1974		;;
1975	esac
1976done
1977case "\$ans" in
1978'') ans="\$xxxm";;
1979esac
1980EOSC
1981
1982: create .config dir to save info across Configure sessions
1983test -d ../.config || mkdir ../.config
1984cat >../.config/README <<EOF
1985This directory created by Configure to save information that should
1986persist across sessions for $package.
1987
1988You may safely delete it if you wish.
1989EOF
1990
1991xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1992case "$usedevel" in
1993$define|true|[yY]*) ;;
1994*) case "$xversion" in
1995   *[13579])
1996	cat >&4 <<EOH
1997*** WHOA THERE!!! ***
1998
1999    This is an UNSTABLE DEVELOPMENT release.
2000    The version of this $package distribution is $xversion, that is, odd,
2001    (as opposed to even) and that signifies a development release.
2002    If you want a maintenance release, you want an even-numbered version.
2003
2004    Do ***NOT*** install this into production use.
2005    Data corruption and crashes are possible.
2006
2007    It is most seriously suggested that you do not continue any further
2008    unless you want to help in developing and debugging Perl.
2009
2010    If you *still* want to build perl, you can answer 'y' now,
2011    or pass -Dusedevel to Configure.
2012
2013EOH
2014	rp='Do you really want to continue?'
2015	dflt='n'
2016	. ./myread
2017	case "$ans" in
2018	[yY]) echo >&4 "Okay, continuing."
2019	      usedevel="$define" ;;
2020	*) echo >&4 "Okay, bye."
2021	   exit 1
2022	   ;;
2023	esac
2024	;;
2025    esac
2026    ;;
2027esac
2028case "$usedevel" in
2029$define|true|[yY]*)
2030	case "$versiononly" in
2031	'') versiononly="$define" ;;
2032	esac
2033	case "$installusrbinperl" in
2034	'') installusrbinperl="$undef" ;;
2035	esac
2036	;;
2037esac
2038
2039: general instructions
2040needman=true
2041firsttime=true
2042user=`(logname) 2>/dev/null`
2043case "$user" in
2044'') user=`whoami 2>&1`;;
2045esac
2046if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2047	firsttime=false
2048	echo " "
2049	rp='Would you like to see the instructions?'
2050	dflt=n
2051	. ./myread
2052	case "$ans" in
2053	[yY]*) ;;
2054	*) needman=false;;
2055	esac
2056fi
2057if $needman; then
2058	cat <<EOH
2059
2060This installation shell script will examine your system and ask you questions
2061to determine how the perl5 package should be installed. If you get
2062stuck on a question, you may use a ! shell escape to start a subshell or
2063execute a command.  Many of the questions will have default answers in square
2064brackets; typing carriage return will give you the default.
2065
2066On some of the questions which ask for file or directory names you are allowed
2067to use the ~name construct to specify the login directory belonging to "name",
2068even if you don't have a shell which knows about that.  Questions where this is
2069allowed will be marked "(~name ok)".
2070
2071EOH
2072	rp=''
2073	dflt='Type carriage return to continue'
2074	. ./myread
2075	cat <<'EOH'
2076
2077The prompter used in this script allows you to use shell variables and
2078backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2079in the default answer, as if the default line was a set of arguments given to a
2080script shell.  This means you may also use $* to repeat the whole default line,
2081so you do not have to re-type everything to add something to the default.
2082
2083Everytime there is a substitution, you will have to confirm.  If there is an
2084error (e.g. an unmatched backtick), the default answer will remain unchanged
2085and you will be prompted again.
2086
2087If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2088the questions and use the computed defaults (or the previous answers if there
2089was already a config.sh file). Type 'Configure -h' for a list of options.
2090You may also start interactively and then answer '& -d' at any prompt to turn
2091on the non-interactive behaviour for the remainder of the execution.
2092
2093EOH
2094	. ./myread
2095	cat <<EOH
2096
2097Much effort has been expended to ensure that this shell script will run on any
2098Unix system.  If despite that it blows up on yours, your best bet is to edit
2099Configure and run it again.  If you can't run Configure for some reason,
2100you'll have to generate a config.sh file by hand.  Whatever problems you
2101have, let me (perlbug@perl.org) know how I blew it.
2102
2103This installation script affects things in two ways:
2104
21051) it may do direct variable substitutions on some of the files included
2106   in this kit.
21072) it builds a config.h file for inclusion in C programs.  You may edit
2108   any of these files as the need arises after running this script.
2109
2110If you make a mistake on a question, there is no easy way to back up to it
2111currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2112files.  Configure will offer to let you do this before it runs the SH files.
2113
2114EOH
2115	dflt='Type carriage return to continue'
2116	. ./myread
2117	case "$firsttime" in
2118	true) echo $user >>../.config/instruct;;
2119	esac
2120fi
2121
2122: find out where common programs are
2123echo " "
2124echo "Locating common programs..." >&4
2125cat <<EOSC >loc
2126$startsh
2127case \$# in
21280) exit 1;;
2129esac
2130thing=\$1
2131shift
2132dflt=\$1
2133shift
2134for dir in \$*; do
2135	case "\$thing" in
2136	.)
2137	if test -d \$dir/\$thing; then
2138		echo \$dir
2139		exit 0
2140	fi
2141	;;
2142	*)
2143	for thisthing in \$dir/\$thing; do
2144		: just loop through to pick last item
2145	done
2146	if test -f \$thisthing; then
2147		echo \$thisthing
2148		exit 0
2149	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2150		echo \$thisthing
2151        	exit 0
2152	elif test -f \$dir/\$thing.exe; then
2153		if test -n "$DJGPP"; then
2154			echo \$dir/\$thing.exe
2155		else
2156			: on Eunice apparently
2157			echo \$dir/\$thing
2158		fi
2159		exit 0
2160	fi
2161	;;
2162	esac
2163done
2164echo \$dflt
2165exit 1
2166EOSC
2167chmod +x loc
2168$eunicefix loc
2169loclist="
2170awk
2171cat
2172chmod
2173comm
2174cp
2175echo
2176expr
2177grep
2178ls
2179mkdir
2180rm
2181sed
2182sort
2183touch
2184tr
2185uniq
2186"
2187trylist="
2188Mcc
2189ar
2190bison
2191byacc
2192cpp
2193csh
2194date
2195egrep
2196gmake
2197gzip
2198less
2199ln
2200make
2201more
2202nm
2203nroff
2204pg
2205test
2206uname
2207zip
2208"
2209pth=`echo $PATH | sed -e "s/$p_/ /g"`
2210pth="$pth /lib /usr/lib"
2211for file in $loclist; do
2212	eval xxx=\$$file
2213	case "$xxx" in
2214	/*|?:[\\/]*)
2215		if test -f "$xxx"; then
2216			: ok
2217		else
2218			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2219			xxx=`./loc $file $file $pth`
2220		fi
2221		;;
2222	'') xxx=`./loc $file $file $pth`;;
2223	*) xxx=`./loc $xxx $xxx $pth`;;
2224	esac
2225	eval $file=$xxx$_exe
2226	eval _$file=$xxx
2227	case "$xxx" in
2228	/*)
2229		echo $file is in $xxx.
2230		;;
2231	?:[\\/]*)
2232		echo $file is in $xxx.
2233		;;
2234	*)
2235		echo "I don't know where '$file' is, and my life depends on it." >&4
2236		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2237		exit 1
2238		;;
2239	esac
2240done
2241echo " "
2242echo "Don't worry if any of the following aren't found..."
2243say=offhand
2244for file in $trylist; do
2245	eval xxx=\$$file
2246	case "$xxx" in
2247	/*|?:[\\/]*)
2248		if test -f "$xxx"; then
2249			: ok
2250		else
2251			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2252			xxx=`./loc $file $file $pth`
2253		fi
2254		;;
2255	'') xxx=`./loc $file $file $pth`;;
2256	*) xxx=`./loc $xxx $xxx $pth`;;
2257	esac
2258	eval $file=$xxx$_exe
2259	eval _$file=$xxx
2260	case "$xxx" in
2261	/*)
2262		echo $file is in $xxx.
2263		;;
2264	?:[\\/]*)
2265		echo $file is in $xxx.
2266		;;
2267	*)
2268		echo "I don't see $file out there, $say."
2269		say=either
2270		;;
2271	esac
2272done
2273case "$egrep" in
2274egrep)
2275	echo "Substituting grep for egrep."
2276	egrep=$grep
2277	_egrep=$grep
2278	;;
2279esac
2280case "$ln" in
2281ln)
2282	echo "Substituting cp for ln."
2283	ln=$cp
2284	_ln=$cp
2285	;;
2286esac
2287case "$make" in
2288make)
2289	case "$gmake" in
2290	gmake)
2291	echo "I can't find make or gmake, and my life depends on it." >&4
2292	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2293	exit 1
2294	;;
2295	esac
2296	;;
2297esac
2298case "$gmake" in
2299gmake)	;;
2300*)	# We can't have osname yet.
2301	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2302		# Assume that gmake, if found, is definitely GNU make
2303		# and prefer it over the system make.
2304		echo "Substituting gmake for make."
2305		make=$gmake
2306		_make=$gmake
2307	fi
2308	;;
2309esac
2310case "$test" in
2311test)
2312	echo "Hopefully test is built into your sh."
2313	;;
2314*)
2315	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2316		echo "Using the test built into your sh."
2317		test=test
2318		_test=test
2319	fi
2320	;;
2321esac
2322case "$echo" in
2323echo)
2324	echo "Hopefully echo is built into your sh."
2325	;;
2326'') ;;
2327*)
2328	echo " "
2329echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2330	$echo $n "hi there$c" >foo1
2331	echo $n "hi there$c" >foo2
2332	if cmp foo1 foo2 >/dev/null 2>&1; then
2333		echo "They are compatible.  In fact, they may be identical."
2334	else
2335		case "$n" in
2336		'-n') n='' c='\c';;
2337		*) n='-n' c='';;
2338		esac
2339		cat <<FOO
2340They are not compatible!  You are probably running ksh on a non-USG system.
2341I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2342have echo built in and we may have to run some Bourne shell scripts.  That
2343means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2344
2345FOO
2346		$echo $n "The star should be here-->$c"
2347		$echo "*"
2348	fi
2349	$rm -f foo1 foo2
2350	;;
2351esac
2352
2353cat <<EOS >trygcc
2354$startsh
2355EOS
2356cat <<'EOSC' >>trygcc
2357case "$cc" in
2358'') ;;
2359*)  $rm -f try try.*
2360    $cat >try.c <<EOM
2361int main(int argc, char *argv[]) {
2362  return 0;
2363}
2364EOM
2365    if $cc -o try $ccflags $ldflags try.c; then
2366       :
2367    else
2368        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2369        despair=yes
2370        trygcc=yes
2371        case "$cc" in
2372        *gcc*) trygcc=no ;;
2373        esac
2374        case "`$cc -v -c try.c 2>&1`" in
2375        *gcc*) trygcc=no ;;
2376        esac
2377        if $test X"$trygcc" = Xyes; then
2378            if gcc -o try -c try.c; then
2379                echo " "
2380                echo "You seem to have a working gcc, though." >&4
2381                rp="Would you like to use it?"
2382                dflt=y
2383                if $test -f myread; then
2384                    . ./myread
2385                else
2386                    if $test -f UU/myread; then
2387                        . ./UU/myread
2388                    else
2389                        echo "Cannot find myread, sorry.  Aborting." >&2
2390                        exit 1
2391                    fi
2392                fi
2393                case "$ans" in
2394                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2395                       if $test -f usethreads.cbu; then
2396                           $cat >&4 <<EOM 
2397
2398*** However, any setting of the C compiler flags (e.g. for thread support)
2399*** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2400*** (together with e.g. -Dusethreads).
2401
2402EOM
2403                       fi;;
2404                esac
2405            fi
2406        fi
2407    fi
2408    $rm -f try try.*
2409    ;;
2410esac
2411EOSC
2412
2413cat <<EOS >checkcc
2414$startsh
2415EOS
2416cat <<'EOSC' >>checkcc
2417case "$cc" in
2418'') ;;
2419*)  $rm -f try try.*
2420    $cat >try.c <<EOM
2421int main(int argc, char *argv[]) {
2422  return 0;
2423}
2424EOM
2425    if $cc -o try $ccflags $ldflags try.c; then
2426       :
2427    else
2428        if $test X"$despair" = Xyes; then
2429           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2430        fi
2431        $cat >&4 <<EOM         
2432You need to find a working C compiler.
2433Either (purchase and) install the C compiler supplied by your OS vendor,
2434or for a free C compiler try http://gcc.gnu.org/
2435I cannot continue any further, aborting.
2436EOM
2437        exit 1
2438    fi
2439    $rm -f try try.*
2440    ;;
2441esac
2442EOSC
2443
2444: determine whether symbolic links are supported
2445echo " "
2446$touch blurfl
2447if $ln -s blurfl sym > /dev/null 2>&1 ; then
2448	echo "Symbolic links are supported." >&4
2449	lns="$ln -s"
2450else
2451	echo "Symbolic links are NOT supported." >&4
2452	lns="$ln"
2453fi
2454$rm -f blurfl sym
2455
2456: determine whether symbolic links are supported
2457echo " "
2458case "$lns" in
2459*"ln"*" -s")
2460	echo "Checking how to test for symbolic links..." >&4
2461	$lns blurfl sym
2462	if $test "X$issymlink" = X; then
2463		case "$newsh" in
2464		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2466		esac
2467		if test $? = 0; then
2468			issymlink="test -h"
2469		else
2470			echo "Your builtin 'test -h' may be broken." >&4
2471			case "$test" in
2472			/*)	;;
2473			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2474				for p in $pth
2475				do
2476					if test -f "$p/$test"; then
2477						test="$p/$test"
2478						break
2479					fi
2480				done
2481				;;
2482			esac
2483			case "$test" in
2484			/*)
2485				echo "Trying external '$test -h'." >&4
2486				issymlink="$test -h"
2487				if $test ! -h sym >/dev/null 2>&1; then
2488					echo "External '$test -h' is broken, too." >&4
2489					issymlink=''
2490				fi
2491				;;
2492			*)	issymlink='' ;;
2493			esac
2494		fi
2495	fi
2496	if $test "X$issymlink" = X; then
2497		if $test -L sym 2>/dev/null; then
2498			issymlink="$test -L"
2499			echo "The builtin '$test -L' worked." >&4
2500		fi
2501	fi
2502	if $test "X$issymlink" != X; then
2503		echo "You can test for symbolic links with '$issymlink'." >&4
2504	else
2505		echo "I do not know how you can test for symbolic links." >&4
2506	fi
2507	$rm -f blurfl sym
2508	;;
2509*)	echo "No symbolic links, so not testing for their testing..." >&4
2510	;;
2511esac
2512echo " "
2513
2514
2515case "$mksymlinks" in
2516$define|true|[yY]*)
2517	case "$src" in
2518	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2519		exit 1
2520		;;
2521	*)	case "$lns:$issymlink" in
2522		*"ln"*" -s:"*"test -"?)
2523			echo "Creating the symbolic links..." >&4
2524			echo "(First creating the subdirectories...)" >&4
2525			cd ..
2526			awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2527				read directory
2528				test -z "$directory" && break
2529				mkdir -p $directory
2530			done
2531			# Sanity check 1.
2532			if test ! -d t/base; then
2533				echo "Failed to create the subdirectories.  Aborting." >&4
2534				exit 1
2535			fi
2536			echo "(Then creating the symlinks...)" >&4
2537			awk '{print $1}' $src/MANIFEST | while true; do
2538				read filename
2539				test -z "$filename" && break
2540				if test -f $filename; then
2541					if $issymlink $filename; then
2542						rm -f $filename
2543					fi
2544				fi
2545				if test -f $filename; then
2546					echo "$filename already exists, not symlinking."
2547				else
2548					ln -s $src/$filename $filename
2549				fi
2550			done
2551			# Sanity check 2.
2552			if test ! -f t/base/lex.t; then
2553				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2554				exit 1
2555			fi
2556			cd UU
2557			;;
2558		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2559			;;
2560		esac
2561		;;
2562	esac
2563	;;
2564esac
2565
2566
2567case "$usecrosscompile" in
2568$define|true|[yY]*)
2569	$echo "Cross-compiling..."
2570        croak=''
2571    	case "$cc" in
2572	*-*-gcc) # A cross-compiling gcc, probably.
2573	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2574	    ar=$targetarch-ar
2575	    # leave out ld, choosing it is more complex
2576	    nm=$targetarch-nm
2577	    ranlib=$targetarch-ranlib
2578	    $echo 'extern int foo;' > try.c
2579	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2580	    shift
2581            if $test $# -gt 0; then
2582	        incpth="$incpth $*"
2583		incpth="`$echo $incpth|$sed 's/^ //'`"
2584                echo "Guessing incpth '$incpth'." >&4
2585                for i in $*; do
2586		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2587		    if $test -d $j; then
2588			libpth="$libpth $j"
2589		    fi
2590                done
2591		libpth="`$echo $libpth|$sed 's/^ //'`"
2592                echo "Guessing libpth '$libpth'." >&4
2593	    fi
2594	    $rm -f try.c
2595	    ;;
2596	esac
2597	case "$targetarch" in
2598	'') echo "Targetarch not defined." >&4; croak=y ;;
2599        *)  echo "Using targetarch $targetarch." >&4 ;;
2600	esac
2601	case "$incpth" in
2602	'') echo "Incpth not defined." >&4; croak=y ;;
2603        *)  echo "Using incpth '$incpth'." >&4 ;;
2604	esac
2605	case "$libpth" in
2606	'') echo "Libpth not defined." >&4; croak=y ;;
2607        *)  echo "Using libpth '$libpth'." >&4 ;;
2608	esac
2609	case "$usrinc" in
2610	'') for i in $incpth; do
2611	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2612		    usrinc=$i
2613	            echo "Guessing usrinc $usrinc." >&4
2614		    break
2615		fi
2616	    done
2617	    case "$usrinc" in
2618	    '') echo "Usrinc not defined." >&4; croak=y ;;
2619	    esac
2620            ;;
2621        *)  echo "Using usrinc $usrinc." >&4 ;;
2622	esac
2623	case "$targethost" in
2624	'') echo "Targethost not defined." >&4; croak=y ;;
2625        *)  echo "Using targethost $targethost." >&4
2626	esac
2627	locincpth=' '
2628	loclibpth=' '
2629	case "$croak" in
2630	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2631	esac
2632	case "$src" in
2633	/*) run=$src/Cross/run
2634	    targetmkdir=$src/Cross/mkdir
2635	    to=$src/Cross/to
2636	    from=$src/Cross/from
2637	    ;;
2638	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2639	    run=$pwd/Cross/run
2640	    targetmkdir=$pwd/Cross/mkdir
2641	    to=$pwd/Cross/to
2642	    from=$pwd/Cross/from
2643	    ;;
2644	esac
2645	case "$targetrun" in
2646	'') targetrun=ssh ;;
2647	esac
2648	case "$targetto" in
2649	'') targetto=scp ;;
2650	esac
2651	case "$targetfrom" in
2652	'') targetfrom=scp ;;
2653	esac
2654    	run=$run-$targetrun
2655    	to=$to-$targetto
2656    	from=$from-$targetfrom
2657	case "$targetdir" in
2658	'')  targetdir=/tmp
2659             echo "Guessing targetdir $targetdir." >&4
2660             ;;
2661	esac
2662	case "$targetuser" in
2663	'')  targetuser=root
2664             echo "Guessing targetuser $targetuser." >&4
2665             ;;
2666	esac
2667	case "$targetfrom" in
2668	scp)	q=-q ;;
2669	*)	q='' ;;
2670	esac
2671	case "$targetrun" in
2672	ssh|rsh)
2673	    cat >$run <<EOF
2674#!/bin/sh
2675case "\$1" in
2676-cwd)
2677  shift
2678  cwd=\$1
2679  shift
2680  ;;
2681esac
2682case "\$cwd" in
2683'') cwd=$targetdir ;;
2684esac
2685exe=\$1
2686shift
2687if $test ! -f \$exe.xok; then
2688  $to \$exe
2689  $touch \$exe.xok
2690fi
2691$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2692EOF
2693	    ;;
2694	*)  echo "Unknown targetrun '$targetrun'" >&4
2695	    exit 1
2696	    ;;
2697	esac
2698	case "$targetmkdir" in
2699	*/Cross/mkdir)
2700	    cat >$targetmkdir <<EOF
2701#!/bin/sh
2702$targetrun -l $targetuser $targethost "mkdir -p \$@"
2703EOF
2704	    $chmod a+rx $targetmkdir
2705	    ;;
2706	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2707	    exit 1
2708	    ;;
2709	esac
2710	case "$targetto" in
2711	scp|rcp)
2712	    cat >$to <<EOF
2713#!/bin/sh
2714for f in \$@
2715do
2716  case "\$f" in
2717  /*)
2718    $targetmkdir \`dirname \$f\`
2719    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2720    ;;
2721  *)
2722    $targetmkdir $targetdir/\`dirname \$f\`
2723    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2724    ;;
2725  esac
2726done
2727exit 0
2728EOF
2729	    ;;
2730	cp) cat >$to <<EOF
2731#!/bin/sh
2732for f in \$@
2733do
2734  case "\$f" in
2735  /*)
2736    $mkdir -p $targetdir/\`dirname \$f\`
2737    $cp \$f $targetdir/\$f || exit 1
2738    ;;
2739  *)
2740    $targetmkdir $targetdir/\`dirname \$f\`
2741    $cp \$f $targetdir/\$f || exit 1
2742    ;;
2743  esac
2744done
2745exit 0
2746EOF
2747	    ;;
2748	*)  echo "Unknown targetto '$targetto'" >&4
2749	    exit 1
2750	    ;;
2751	esac
2752	case "$targetfrom" in
2753	scp|rcp)
2754	  cat >$from <<EOF
2755#!/bin/sh
2756for f in \$@
2757do
2758  $rm -f \$f
2759  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2760done
2761exit 0
2762EOF
2763	    ;;
2764	cp) cat >$from <<EOF
2765#!/bin/sh
2766for f in \$@
2767do
2768  $rm -f \$f
2769  cp $targetdir/\$f . || exit 1
2770done
2771exit 0
2772EOF
2773	    ;;
2774	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2775	    exit 1
2776	    ;;
2777	esac
2778	if $test ! -f $run; then
2779	    echo "Target 'run' script '$run' not found." >&4
2780	else
2781	    $chmod a+rx $run
2782	fi
2783	if $test ! -f $to; then
2784	    echo "Target 'to' script '$to' not found." >&4
2785	else
2786	    $chmod a+rx $to
2787	fi
2788	if $test ! -f $from; then
2789	    echo "Target 'from' script '$from' not found." >&4
2790	else
2791	    $chmod a+rx $from
2792	fi
2793	if $test ! -f $run -o ! -f $to -o ! -f $from; then
2794	    exit 1
2795	fi
2796	cat >&4 <<EOF
2797Using '$run' for remote execution,
2798and '$from' and '$to'
2799for remote file transfer.
2800EOF
2801	;;
2802*)	run=''
2803	to=:
2804	from=:
2805	usecrosscompile='undef'
2806	targetarch=''
2807	;;
2808esac
2809
2810: see whether [:lower:] and [:upper:] are supported character classes
2811echo " "
2812case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2813ABYZ)
2814	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2815	up='[:upper:]'
2816	low='[:lower:]'
2817	;;
2818*)	# There is a discontinuity in EBCDIC between 'I' and 'J'
2819        # (0xc9 and 0xd1), therefore that is a nice testing point.
2820        if test "X$up" = X -o "X$low" = X; then
2821	    case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2822	    ij) up='[A-Z]'
2823	        low='[a-z]'
2824		;;
2825	    esac
2826        fi
2827	if test "X$up" = X -o "X$low" = X; then
2828	    case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2829	    ij) up='A-Z'
2830		low='a-z'
2831		;;
2832	    esac
2833        fi
2834	if test "X$up" = X -o "X$low" = X; then
2835	    case "`echo IJ | od -x 2>/dev/null`" in
2836	    *C9D1*|*c9d1*)
2837		echo "Hey, this might be EBCDIC." >&4
2838		if test "X$up" = X -o "X$low" = X; then
2839		    case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2840		    ij) up='[A-IJ-RS-Z]'
2841		        low='[a-ij-rs-z]'
2842			;;
2843		    esac
2844		fi
2845		if test "X$up" = X -o "X$low" = X; then
2846		    case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2847		    ij) up='A-IJ-RS-Z'
2848		        low='a-ij-rs-z'
2849			;;
2850		    esac
2851		fi
2852		;;
2853	    esac
2854	fi
2855esac
2856case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2857ij)
2858    echo "Using $up and $low to convert case." >&4
2859    ;;
2860*)
2861    echo "I don't know how to translate letters from upper to lower case." >&4
2862    echo "Your tr is not acting any way I know of." >&4
2863    exit 1
2864    ;;
2865esac
2866: set up the translation script tr, must be called with ./tr of course
2867cat >tr <<EOSC
2868$startsh
2869case "\$1\$2" in
2870'[A-Z][a-z]') exec $tr '$up' '$low';;
2871'[a-z][A-Z]') exec $tr '$low' '$up';;
2872esac
2873exec $tr "\$@"
2874EOSC
2875chmod +x tr
2876$eunicefix tr
2877
2878: Try to determine whether config.sh was made on this system
2879case "$config_sh" in
2880'')
2881myuname=`$uname -a 2>/dev/null`
2882$test -z "$myuname" && myuname=`hostname 2>/dev/null`
2883# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2884# because the A-Z/a-z are not consecutive.
2885myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2886	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2887newmyuname="$myuname"
2888dflt=n
2889case "$knowitall" in
2890'')
2891	if test -f ../config.sh; then
2892		if $contains myuname= ../config.sh >/dev/null 2>&1; then
2893			eval "`grep myuname= ../config.sh`"
2894		fi
2895		if test "X$myuname" = "X$newmyuname"; then
2896			dflt=y
2897		fi
2898	fi
2899	;;
2900*) dflt=y;;
2901esac
2902
2903: Get old answers from old config file if Configure was run on the
2904: same system, otherwise use the hints.
2905hint=default
2906cd ..
2907if test -f config.sh; then
2908	echo " "
2909	rp="I see a config.sh file.  Shall I use it to set the defaults?"
2910	. UU/myread
2911	case "$ans" in
2912	n*|N*) echo "OK, I'll ignore it."
2913		mv config.sh config.sh.old
2914		myuname="$newmyuname"
2915		;;
2916	*)  echo "Fetching default answers from your old config.sh file..." >&4
2917		tmp_n="$n"
2918		tmp_c="$c"
2919		tmp_sh="$sh"
2920		. ./config.sh
2921		cp config.sh UU
2922		n="$tmp_n"
2923		c="$tmp_c"
2924		: Older versions did not always set $sh.  Catch re-use of such
2925		: an old config.sh.
2926		case "$sh" in
2927		'') sh="$tmp_sh" ;;
2928		esac
2929		hint=previous
2930		;;
2931	esac
2932fi
2933. ./UU/checkcc
2934if test ! -f config.sh; then
2935	$cat <<EOM
2936
2937First time through, eh?  I have some defaults handy for some systems
2938that need some extra help getting the Configure answers right:
2939
2940EOM
2941	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2942	dflt=''
2943	: Half the following guesses are probably wrong... If you have better
2944	: tests or hints, please send them to perlbug@perl.org
2945	: The metaconfig authors would also appreciate a copy...
2946	$test -f /irix && osname=irix
2947	$test -f /xenix && osname=sco_xenix
2948	$test -f /dynix && osname=dynix
2949	$test -f /dnix && osname=dnix
2950	$test -f /lynx.os && osname=lynxos
2951	$test -f /unicos && osname=unicos && osvers=`$uname -r`
2952	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2953	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2954	$test -f /bin/mips && /bin/mips && osname=mips
2955	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2956		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2957	$test -d /usr/apollo/bin && osname=apollo
2958	$test -f /etc/saf/_sactab && osname=svr4
2959	$test -d /usr/include/minix && osname=minix
2960	$test -f /system/gnu_library/bin/ar.pm && osname=vos
2961	if $test -d /MachTen -o -d /MachTen_Folder; then
2962		osname=machten
2963		if $test -x /sbin/version; then
2964			osvers=`/sbin/version | $awk '{print $2}' |
2965			$sed -e 's/[A-Za-z]$//'`
2966		elif $test -x /usr/etc/version; then
2967			osvers=`/usr/etc/version | $awk '{print $2}' |
2968			$sed -e 's/[A-Za-z]$//'`
2969		else
2970			osvers="$2.$3"
2971		fi
2972	fi
2973
2974	$test -f /sys/posix.dll &&
2975		$test -f /usr/bin/what &&
2976		set X `/usr/bin/what /sys/posix.dll` &&
2977		$test "$3" = UWIN &&
2978		osname=uwin &&
2979		osvers="$5"
2980
2981	if $test -f $uname; then
2982		set X $myuname
2983		shift
2984
2985		case "$5" in
2986		fps*) osname=fps ;;
2987		mips*)
2988			case "$4" in
2989			umips) osname=umips ;;
2990			*) osname=mips ;;
2991			esac;;
2992		[23]100) osname=mips ;;
2993		next*) osname=next ;;
2994		i386*)
2995			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2996			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2997				osname='sco'
2998				osvers=$tmp
2999			elif $test -f /etc/kconfig; then
3000				osname=isc
3001				if test "$lns" = "$ln -s"; then
3002					osvers=4
3003				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3004					osvers=3
3005				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3006					osvers=2
3007				fi
3008			fi
3009			tmp=''
3010			;;
3011		pc*)
3012			if test -n "$DJGPP"; then
3013				osname=dos
3014				osvers=djgpp
3015			fi
3016			;;
3017		esac
3018
3019		case "$1" in
3020		aix) osname=aix
3021			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3022			case "$tmp" in
3023			'not found') osvers="$4"."$3" ;;
3024			'<3240'|'<>3240') osvers=3.2.0 ;;
3025			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3026			'=3250'|'>3250') osvers=3.2.5 ;;
3027			*) osvers=$tmp;;
3028			esac
3029			;;
3030		bsd386) osname=bsd386
3031			osvers=`$uname -r`
3032			;;
3033		cygwin*) osname=cygwin
3034			osvers="$3"
3035			;;
3036		*dc.osx) osname=dcosx
3037			osvers="$3"
3038			;;
3039		dnix) osname=dnix
3040			osvers="$3"
3041			;;
3042		domainos) osname=apollo
3043			osvers="$3"
3044			;;
3045		dgux) osname=dgux
3046			osvers="$3"
3047			;;
3048		dynixptx*) osname=dynixptx
3049			osvers=`echo "$4"|sed 's/^v//'`
3050			;;
3051		freebsd) osname=freebsd
3052			osvers="$3" ;;
3053		genix) osname=genix ;;
3054		hp*) osname=hpux
3055			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3056			;;
3057		irix*) osname=irix
3058			case "$3" in
3059			4*) osvers=4 ;;
3060			5*) osvers=5 ;;
3061			*)	osvers="$3" ;;
3062			esac
3063			;;
3064		linux) osname=linux
3065			case "$3" in
3066			*)	osvers="$3" ;;
3067			esac
3068			;;
3069		MiNT) osname=mint
3070			;;
3071		netbsd*) osname=netbsd
3072			osvers="$3"
3073			;;
3074		news-os) osvers="$3"
3075			case "$3" in
3076			4*) osname=newsos4 ;;
3077			*) osname=newsos ;;
3078			esac
3079			;;
3080		next*) osname=next ;;
3081		nonstop-ux) osname=nonstopux ;;
3082		openbsd) osname=openbsd
3083                	osvers="$3"
3084                	;;
3085		POSIX-BC | posix-bc ) osname=posix-bc
3086			osvers="$3"
3087			;;
3088		powerux | power_ux | powermax_os | powermaxos | \
3089		powerunix | power_unix) osname=powerux
3090			osvers="$3"
3091			;;
3092		qnx) osname=qnx
3093			osvers="$4"
3094			;;
3095		solaris) osname=solaris
3096			case "$3" in
3097			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3098			*)	osvers="$3" ;;
3099			esac
3100			;;
3101		sunos) osname=sunos
3102			case "$3" in
3103			5*) osname=solaris
3104				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3105			*)	osvers="$3" ;;
3106			esac
3107			;;
3108		titanos) osname=titanos
3109			case "$3" in
3110			1*) osvers=1 ;;
3111			2*) osvers=2 ;;
3112			3*) osvers=3 ;;
3113			4*) osvers=4 ;;
3114			*)	osvers="$3" ;;
3115			esac
3116			;;
3117		ultrix) osname=ultrix
3118			osvers="$3"
3119			;;
3120		osf1|mls+)	case "$5" in
3121				alpha)
3122					osname=dec_osf
3123					osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3124					case "$osvers" in
3125					[1-9].[0-9]*) ;;
3126					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3127					esac
3128					;;
3129			hp*)	osname=hp_osf1	;;
3130			mips)	osname=mips_osf1 ;;
3131			esac
3132			;;
3133		unixware) osname=svr5
3134			osvers="$4"
3135			;;
3136		uts)	osname=uts
3137			osvers="$3"
3138			;;
3139		vos) osvers="$3"
3140			;;
3141		$2) case "$osname" in
3142			*isc*) ;;
3143			*freebsd*) ;;
3144			svr*)
3145				: svr4.x or possibly later
3146				case "svr$3" in
3147				${osname}*)
3148					osname=svr$3
3149					osvers=$4
3150					;;
3151				esac
3152				case "$osname" in
3153				svr4.0)
3154					: Check for ESIX
3155					if test -f /stand/boot ; then
3156						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3157						if test -n "$INITPROG" -a -f "$INITPROG"; then
3158			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3159							if test -n "$isesix"; then
3160								osname=esix4
3161							fi
3162						fi
3163					fi
3164					;;
3165				esac
3166				;;
3167			*)	if test -f /etc/systemid; then
3168					osname=sco
3169					set `echo $3 | $sed 's/\./ /g'` $4
3170					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3171						osvers=$1.$2.$3
3172					elif $test -f $src/hints/sco_$1_$2.sh; then
3173						osvers=$1.$2
3174					elif $test -f $src/hints/sco_$1.sh; then
3175						osvers=$1
3176					fi
3177				else
3178					case "$osname" in
3179					'') : Still unknown.  Probably a generic Sys V.
3180						osname="sysv"
3181						osvers="$3"
3182						;;
3183					esac
3184				fi
3185				;;
3186			esac
3187			;;
3188		*)	case "$osname" in
3189			'') : Still unknown.  Probably a generic BSD.
3190				osname="$1"
3191				osvers="$3"
3192				;;
3193			esac
3194			;;
3195		esac
3196	else
3197		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3198			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3199			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3200				osname=news_os
3201			fi
3202			$rm -f UU/kernel.what
3203		elif test -d c:/.; then
3204			set X $myuname
3205			osname=os2
3206			osvers="$5"
3207		fi
3208	fi
3209
3210        case "$targetarch" in
3211        '') ;;
3212        *)  hostarch=$osname
3213            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3214            osvers=''
3215            ;;
3216        esac
3217
3218	: Now look for a hint file osname_osvers, unless one has been
3219	: specified already.
3220	case "$hintfile" in
3221	''|' ')
3222		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3223		: Also try without trailing minor version numbers.
3224		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3225		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3226		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3227		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3228		case "$file" in
3229		'') dflt=none ;;
3230		*)  case "$osvers" in
3231			'') dflt=$file
3232				;;
3233			*)  if $test -f $src/hints/$file.sh ; then
3234					dflt=$file
3235				elif $test -f $src/hints/$xfile.sh ; then
3236					dflt=$xfile
3237				elif $test -f $src/hints/$xxfile.sh ; then
3238					dflt=$xxfile
3239				elif $test -f $src/hints/$xxxfile.sh ; then
3240					dflt=$xxxfile
3241				elif $test -f $src/hints/$xxxxfile.sh ; then
3242					dflt=$xxxxfile
3243				elif $test -f "$src/hints/${osname}.sh" ; then
3244					dflt="${osname}"
3245				else
3246					dflt=none
3247				fi
3248				;;
3249			esac
3250			;;
3251		esac
3252		if $test -f Policy.sh ; then
3253			case "$dflt" in
3254			*Policy*) ;;
3255			none) dflt="Policy" ;;
3256			*) dflt="Policy $dflt" ;;
3257			esac
3258		fi
3259		;;
3260	*)
3261		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3262		;;
3263	esac
3264
3265	if $test -f Policy.sh ; then
3266		$cat <<EOM
3267
3268There's also a Policy hint file available, which should make the
3269site-specific (policy) questions easier to answer.
3270EOM
3271
3272	fi
3273
3274	$cat <<EOM
3275
3276You may give one or more space-separated answers, or "none" if appropriate.
3277A well-behaved OS will have no hints, so answering "none" or just "Policy"
3278is a good thing.  DO NOT give a wrong version or a wrong OS.
3279
3280EOM
3281
3282	rp="Which of these apply, if any?"
3283	. UU/myread
3284	tans=$ans
3285	for file in $tans; do
3286		if $test X$file = XPolicy -a -f Policy.sh; then
3287			. Policy.sh
3288			$cat Policy.sh >> UU/config.sh
3289		elif $test -f $src/hints/$file.sh; then
3290			. $src/hints/$file.sh
3291			$cat $src/hints/$file.sh >> UU/config.sh
3292		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3293			: nothing
3294		else
3295			: Give one chance to correct a possible typo.
3296			echo "$file.sh does not exist"
3297			dflt=$file
3298			rp="hint to use instead?"
3299			. UU/myread
3300			for file in $ans; do
3301				if $test -f "$src/hints/$file.sh"; then
3302					. $src/hints/$file.sh
3303					$cat $src/hints/$file.sh >> UU/config.sh
3304				elif $test X$ans = X -o X$ans = Xnone ; then
3305					: nothing
3306				else
3307					echo "$file.sh does not exist -- ignored."
3308				fi
3309			done
3310		fi
3311	done
3312
3313	hint=recommended
3314	: Remember our hint file for later.
3315	if $test -f "$src/hints/$file.sh" ; then
3316		hintfile="$file"
3317	else
3318		hintfile=''
3319	fi
3320fi
3321cd UU
3322;;
3323*)
3324	echo " "
3325	echo "Fetching default answers from $config_sh..." >&4
3326	tmp_n="$n"
3327	tmp_c="$c"
3328	cd ..
3329	cp $config_sh config.sh 2>/dev/null
3330	chmod +w config.sh
3331	. ./config.sh
3332	cd UU
3333	cp ../config.sh .
3334	n="$tmp_n"
3335	c="$tmp_c"
3336	hint=previous
3337	;;
3338esac
3339test "$override" && . ./optdef.sh
3340
3341: Restore computed paths
3342for file in $loclist $trylist; do
3343	eval $file="\$_$file"
3344done
3345
3346cat << EOM
3347
3348Configure uses the operating system name and version to set some defaults.
3349The default value is probably right if the name rings a bell. Otherwise,
3350since spelling matters for me, either accept the default or answer "none"
3351to leave it blank.
3352
3353EOM
3354case "$osname" in
3355	''|' ')
3356		case "$hintfile" in
3357		''|' '|none) dflt=none ;;
3358		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3359		esac
3360		;;
3361	*) dflt="$osname" ;;
3362esac
3363rp="Operating system name?"
3364. ./myread
3365case "$ans" in
3366none)  osname='' ;;
3367*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3368esac
3369echo " "
3370case "$osvers" in
3371	''|' ')
3372		case "$hintfile" in
3373		''|' '|none) dflt=none ;;
3374		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3375			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3376			case "$dflt" in
3377			''|' ') dflt=none ;;
3378			esac
3379			;;
3380		esac
3381		;;
3382	*) dflt="$osvers" ;;
3383esac
3384rp="Operating system version?"
3385. ./myread
3386case "$ans" in
3387none)  osvers='' ;;
3388*) osvers="$ans" ;;
3389esac
3390
3391
3392. ./posthint.sh
3393
3394: who configured the system
3395cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3396cf_by=`(logname) 2>/dev/null`
3397case "$cf_by" in
3398"")
3399	cf_by=`(whoami) 2>/dev/null`
3400	case "$cf_by" in
3401	"") cf_by=unknown ;;
3402	esac ;;
3403esac
3404
3405: set up the script used to warn in case of inconsistency
3406cat <<EOS >whoa
3407$startsh
3408EOS
3409cat <<'EOSC' >>whoa
3410dflt=y
3411echo " "
3412echo "*** WHOA THERE!!! ***" >&4
3413echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3414rp="    Keep the $hint value?"
3415. ./myread
3416case "$ans" in
3417y) td=$was; tu=$was;;
3418esac
3419EOSC
3420
3421: function used to set $1 to $val
3422setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3423case "$val$was" in
3424$define$undef) . ./whoa; eval "$var=\$td";;
3425$undef$define) . ./whoa; eval "$var=\$tu";;
3426*) eval "$var=$val";;
3427esac'
3428
3429case "$usesocks" in
3430$define|true|[yY]*)	dflt='y';;
3431*) dflt='n';;
3432esac
3433cat <<EOM
3434
3435Perl can be built to use the SOCKS proxy protocol library.  To do so,
3436Configure must be run with -Dusesocks.  If you use SOCKS you also need
3437to use the PerlIO abstraction layer, this will be implicitly selected.
3438
3439If this doesn't make any sense to you, just accept the default '$dflt'.
3440EOM
3441rp='Build Perl for SOCKS?'
3442. ./myread
3443case "$ans" in
3444y|Y)	val="$define" ;;
3445*)      val="$undef" ;;
3446esac
3447set usesocks
3448eval $setvar
3449
3450case "$usesocks" in
3451$define|true|[yY]*) useperlio="$define";;
3452esac
3453
3454case "$useperlio" in
3455$define|true|[yY]*|'')	dflt='y';;
3456*) dflt='n';;
3457esac
3458cat <<EOM
3459
3460Previous version of $package used the standard IO mechanisms as
3461defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3462alternate IO mechanisms via the PerlIO abstraction layer, but the
3463stdio mechanism is still available if needed.  The abstraction layer
3464can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3465Using PerlIO with sfio may cause problems with some extension modules.
3466
3467If this doesn't make any sense to you, just accept the default '$dflt'.
3468EOM
3469rp='Use the PerlIO abstraction layer?'
3470. ./myread
3471case "$ans" in
3472y|Y)
3473	val="$define"
3474	;;
3475*)
3476	echo "Ok, doing things the stdio way."
3477	val="$undef"
3478	;;
3479esac
3480set useperlio
3481eval $setvar
3482
3483case "$usesocks" in
3484$define|true|[yY]*)
3485	case "$useperlio" in
3486	$define|true|[yY]*) ;;
3487	*)	cat >&4 <<EOM
3488
3489You are using the SOCKS proxy protocol library which means that you
3490should also use the PerlIO layer.  You may be headed for trouble.
3491
3492EOM
3493		;;
3494	esac
3495	;;
3496esac
3497
3498
3499case "$usethreads" in
3500$define|true|[yY]*)     dflt='y';;
3501*)     # Catch case where user specified ithreads or 5005threads but
3502       # forgot -Dusethreads (A.D. 4/2002)
3503       case "$useithreads$use5005threads" in
3504       *$define*)
3505		case "$useperlio" in
3506		"$define")	dflt='y' ;;
3507		*)		dflt='n' ;;
3508		esac
3509		;;
3510       *)	dflt='n';;
3511       esac
3512       ;;
3513esac
3514cat <<EOM
3515
3516Perl can be built to take advantage of threads on some systems.
3517To do so, Configure can be run with -Dusethreads.
3518
3519Note that Perl built with threading support runs slightly slower
3520and uses more memory than plain Perl. The current implementation
3521is believed to be stable, but it is fairly new, and so should be
3522treated with caution.
3523
3524If this doesn't make any sense to you, just accept the default '$dflt'.
3525EOM
3526rp='Build a threading Perl?'
3527. ./myread
3528case "$ans" in
3529y|Y)    val="$define" ;;
3530*)      val="$undef" ;;
3531esac
3532set usethreads
3533eval $setvar
3534
3535case "$usethreads" in
3536$define)
3537	$cat <<EOM
3538
3539Since release 5.6, Perl has had two different threading implementations,
3540the newer interpreter-based version (ithreads) with one interpreter per
3541thread, and the older 5.005 version (5005threads).
3542The 5005threads version is effectively unmaintained and will probably be
3543removed in Perl 5.10, so there should be no need to build a Perl using it
3544unless needed for backwards compatibility with some existing 5.005threads
3545code.
3546
3547EOM
3548	: Default to ithreads unless overridden on command line or with
3549	: old config.sh
3550	dflt='y'
3551	case "$use5005threads" in
3552		$define|true|[yY]*) dflt='n';;
3553	esac
3554	case "$useithreads" in
3555		$undef|false|[nN]*) dflt='n';;
3556	esac
3557	rp='Use the newer interpreter-based ithreads?'
3558	. ./myread
3559	case "$ans" in
3560	y|Y)    val="$define" ;;
3561	*)      val="$undef" ;;
3562	esac
3563	set useithreads
3564	eval $setvar
3565	: Now set use5005threads to the opposite value.
3566	case "$useithreads" in
3567	$define) val="$undef" ;;
3568	*) val="$define" ;;
3569	esac
3570	set use5005threads
3571	eval $setvar
3572	;;
3573*)
3574	useithreads="$undef"
3575	use5005threads="$undef"
3576	;;
3577esac
3578
3579case "$useithreads$use5005threads" in
3580"$define$define")
3581	$cat >&4 <<EOM
3582
3583You cannot have both the ithreads and the 5.005 threads enabled
3584at the same time.  Disabling the 5.005 threads since they are
3585much less stable than the ithreads.
3586
3587EOM
3588	use5005threads="$undef"
3589	;;
3590esac
3591
3592if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3593	cat >&4 <<EOF
3594***
3595*** To build with ithreads you must also use the PerlIO layer.
3596*** Cannot continue, aborting.
3597***
3598EOF
3599	exit 1
3600fi
3601
3602case "$d_oldpthreads" in
3603'')	: Configure tests would be welcome here.  For now, assume undef.
3604	val="$undef" ;;
3605*)	val="$d_oldpthreads" ;;
3606esac
3607set d_oldpthreads
3608eval $setvar
3609
3610
3611case "$usethreads" in
3612"$define"|true|[yY]*)
3613: Look for a hint-file generated 'call-back-unit'.  If the
3614: user has specified that a threading perl is to be built,
3615: we may need to set or change some other defaults.
3616	if $test -f usethreads.cbu; then
3617		echo "Your platform has some specific hints for threaded builds, using them..."
3618		. ./usethreads.cbu
3619	else
3620		$cat <<EOM
3621(Your platform doesn't have any specific hints for threaded builds.
3622 Assuming POSIX threads, then.)
3623EOM
3624	fi
3625	;;
3626esac
3627
3628cat <<EOM
3629
3630Perl can be built so that multiple Perl interpreters can coexist
3631within the same Perl executable.
3632EOM
3633
3634case "$useithreads" in
3635$define)
3636	cat <<EOM
3637This multiple interpreter support is required for interpreter-based threads.
3638EOM
3639	val="$define"
3640	;;
3641*)	case "$usemultiplicity" in
3642	$define|true|[yY]*)	dflt='y';;
3643	*) dflt='n';;
3644	esac
3645	echo " "
3646	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3647	rp='Build Perl for multiplicity?'
3648	. ./myread
3649	case "$ans" in
3650	y|Y)	val="$define" ;;
3651	*)      val="$undef" ;;
3652	esac
3653	;;
3654esac
3655set usemultiplicity
3656eval $setvar
3657
3658
3659case "$usemorebits" in
3660"$define"|true|[yY]*)
3661	use64bitint="$define"
3662	uselongdouble="$define"
3663	usemorebits="$define"
3664	;;
3665*)	usemorebits="$undef"
3666	;;
3667esac
3668
3669: make some quick guesses about what we are up against
3670echo " "
3671$echo $n "Hmm...  $c"
3672echo exit 1 >bsd
3673echo exit 1 >usg
3674echo exit 1 >v7
3675echo exit 1 >osf1
3676echo exit 1 >eunice
3677echo exit 1 >xenix
3678echo exit 1 >venix
3679echo exit 1 >os2
3680d_bsd="$undef"
3681$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3682if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3683then
3684	echo "Looks kind of like an OSF/1 system, but we'll see..."
3685	echo exit 0 >osf1
3686elif test `echo abc | $tr a-z A-Z` = Abc ; then
3687	xxx=`./loc addbib blurfl $pth`
3688	if $test -f $xxx; then
3689	echo "Looks kind of like a USG system with BSD features, but we'll see..."
3690		echo exit 0 >bsd
3691		echo exit 0 >usg
3692	else
3693		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3694			echo "Looks kind of like an extended USG system, but we'll see..."
3695		else
3696			echo "Looks kind of like a USG system, but we'll see..."
3697		fi
3698		echo exit 0 >usg
3699	fi
3700elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3701	echo "Looks kind of like a BSD system, but we'll see..."
3702	d_bsd="$define"
3703	echo exit 0 >bsd
3704else
3705	echo "Looks kind of like a Version 7 system, but we'll see..."
3706	echo exit 0 >v7
3707fi
3708case "$eunicefix" in
3709*unixtovms*)
3710	$cat <<'EOI'
3711There is, however, a strange, musty smell in the air that reminds me of
3712something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3713EOI
3714	echo exit 0 >eunice
3715	d_eunice="$define"
3716: it so happens the Eunice I know will not run shell scripts in Unix format
3717	;;
3718*)
3719	echo " "
3720	echo "Congratulations.  You aren't running Eunice."
3721	d_eunice="$undef"
3722	;;
3723esac
3724: Detect OS2.  The p_ variable is set above in the Head.U unit.
3725: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3726: semicolon as a patch separator
3727case "$p_" in
3728:) ;;
3729*)
3730	$cat <<'EOI'
3731I have the feeling something is not exactly right, however...don't tell me...
3732lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3733(Or you may be running DOS with DJGPP.)
3734EOI
3735	echo exit 0 >os2
3736	;;
3737esac
3738if test -f /xenix; then
3739	echo "Actually, this looks more like a XENIX system..."
3740	echo exit 0 >xenix
3741	d_xenix="$define"
3742else
3743	echo " "
3744	echo "It's not Xenix..."
3745	d_xenix="$undef"
3746fi
3747chmod +x xenix
3748$eunicefix xenix
3749if test -f /venix; then
3750	echo "Actually, this looks more like a VENIX system..."
3751	echo exit 0 >venix
3752else
3753	echo " "
3754	if ./xenix; then
3755		: null
3756	else
3757		echo "Nor is it Venix..."
3758	fi
3759fi
3760chmod +x bsd usg v7 osf1 eunice xenix venix os2
3761$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3762$rm -f foo
3763
3764case "$cc" in
3765'') dflt=cc;;
3766*) dflt="$cc";;
3767esac
3768rp="Use which C compiler?"
3769. ./myread
3770cc="$ans"
3771
3772: See if they have not cc but they do have gcc
3773. ./trygcc
3774: Look for a hint-file generated 'call-back-unit'.  Now that the
3775: user has specified the compiler, we may need to set or change some
3776: other defaults.
3777if $test -f cc.cbu; then
3778    . ./cc.cbu
3779fi
3780. ./checkcc
3781
3782echo " "
3783echo "Checking for GNU cc in disguise and/or its version number..." >&4
3784$cat >try.c <<EOM
3785#include <stdio.h>
3786int main() {
3787#ifdef __GNUC__
3788#ifdef __VERSION__
3789	printf("%s\n", __VERSION__);
3790#else
3791	printf("%s\n", "1");
3792#endif
3793#endif
3794	exit(0);
3795}
3796EOM
3797if $cc -o try $ccflags $ldflags try.c; then
3798	gccversion=`$run ./try`
3799	case "$gccversion" in
3800	'') echo "You are not using GNU cc." ;;
3801	*)  echo "You are using GNU cc $gccversion."
3802	    ccname=gcc
3803	    ;;
3804	esac
3805else
3806	echo " "
3807	echo "*** WHOA THERE!!! ***" >&4
3808	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3809	case "$knowitall" in
3810	'')
3811	echo "    You'd better start hunting for one and let me know about it." >&4
3812		exit 1
3813		;;
3814	esac
3815fi
3816$rm -f try try.*
3817case "$gccversion" in
38181*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3819esac
3820case "$gccversion" in
3821'') gccosandvers='' ;;
3822*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3823   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3824   gccshortvers=''
3825   case "$gccosandvers" in
3826   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3827   $osname$osvers) ;; # looking good
3828   $osname*) cat <<EOM >&4
3829
3830*** WHOA THERE!!! ***
3831
3832    Your gcc has not been compiled for the exact release of
3833    your operating system ($gccosandvers versus $osname$osvers).
3834
3835    In general it is a good idea to keep gcc synchronized with
3836    the operating system because otherwise serious problems
3837    may ensue when trying to compile software, like Perl.
3838
3839    I'm trying to be optimistic here, though, and will continue.
3840    If later during the configuration and build icky compilation
3841    problems appear (headerfile conflicts being the most common
3842    manifestation), I suggest reinstalling the gcc to match
3843    your operating system release.
3844
3845EOM
3846      ;;
3847   *) gccosandvers='' ;; # failed to parse, better be silent
3848   esac
3849   ;;
3850esac
3851case "$ccname" in
3852'') ccname="$cc" ;;
3853esac
3854
3855# gcc 3.1 complains about adding -Idirectories that it already knows about,
3856# so we will take those off from locincpth.
3857case "$gccversion" in
38583*)
3859    echo "main(){}">try.c
3860    for incdir in `$cc -v -c try.c 2>&1 | \
3861       sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3862       locincpth=`echo $locincpth | sed s!$incdir!!`
3863    done
3864    $rm -f try try.*
3865esac
3866
3867: decide how portable to be.  Allow command line overrides.
3868case "$d_portable" in
3869"$undef") ;;
3870*)	d_portable="$define" ;;
3871esac
3872
3873: set up shell script to do ~ expansion
3874cat >filexp <<EOSS
3875$startsh
3876: expand filename
3877case "\$1" in
3878 ~/*|~)
3879	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3880	;;
3881 ~*)
3882	if $test -f /bin/csh; then
3883		/bin/csh -f -c "glob \$1"
3884		failed=\$?
3885		echo ""
3886		exit \$failed
3887	else
3888		name=\`$expr x\$1 : '..\([^/]*\)'\`
3889		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3890		if $test ! -d "\$dir"; then
3891			me=\`basename \$0\`
3892			echo "\$me: can't locate home directory for: \$name" >&2
3893			exit 1
3894		fi
3895		case "\$1" in
3896		*/*)
3897			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3898			;;
3899		*)
3900			echo \$dir
3901			;;
3902		esac
3903	fi
3904	;;
3905*)
3906	echo \$1
3907	;;
3908esac
3909EOSS
3910chmod +x filexp
3911$eunicefix filexp
3912
3913: now set up to get a file name
3914cat <<EOS >getfile
3915$startsh
3916EOS
3917cat <<'EOSC' >>getfile
3918tilde=''
3919fullpath=''
3920already=''
3921skip=''
3922none_ok=''
3923exp_file=''
3924nopath_ok=''
3925orig_rp="$rp"
3926orig_dflt="$dflt"
3927case "$gfpth" in
3928'') gfpth='.' ;;
3929esac
3930
3931case "$fn" in
3932*\(*)
3933	: getfile will accept an answer from the comma-separated list
3934	: enclosed in parentheses even if it does not meet other criteria.
3935	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3936	fn=`echo $fn | sed 's/(.*)//'`
3937	;;
3938esac
3939
3940case "$fn" in
3941*:*)
3942	loc_file=`expr $fn : '.*:\(.*\)'`
3943	fn=`expr $fn : '\(.*\):.*'`
3944	;;
3945esac
3946
3947case "$fn" in
3948*~*) tilde=true;;
3949esac
3950case "$fn" in
3951*/*) fullpath=true;;
3952esac
3953case "$fn" in
3954*+*) skip=true;;
3955esac
3956case "$fn" in
3957*n*) none_ok=true;;
3958esac
3959case "$fn" in
3960*e*) exp_file=true;;
3961esac
3962case "$fn" in
3963*p*) nopath_ok=true;;
3964esac
3965
3966case "$fn" in
3967*f*) type='File';;
3968*d*) type='Directory';;
3969*l*) type='Locate';;
3970esac
3971
3972what="$type"
3973case "$what" in
3974Locate) what='File';;
3975esac
3976
3977case "$exp_file" in
3978'')
3979	case "$d_portable" in
3980	"$define") ;;
3981	*) exp_file=true;;
3982	esac
3983	;;
3984esac
3985
3986cd ..
3987while test "$type"; do
3988	redo=''
3989	rp="$orig_rp"
3990	dflt="$orig_dflt"
3991	case "$tilde" in
3992	true) rp="$rp (~name ok)";;
3993	esac
3994	. UU/myread
3995	if test -f UU/getfile.ok && \
3996		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3997	then
3998		value="$ans"
3999		ansexp="$ans"
4000		break
4001	fi
4002	case "$ans" in
4003	none)
4004		value=''
4005		ansexp=''
4006		case "$none_ok" in
4007		true) type='';;
4008		esac
4009		;;
4010	*)
4011		case "$tilde" in
4012		'') value="$ans"
4013			ansexp="$ans";;
4014		*)
4015			value=`UU/filexp $ans`
4016			case $? in
4017			0)
4018				if test "$ans" != "$value"; then
4019					echo "(That expands to $value on this system.)"
4020				fi
4021				;;
4022			*) value="$ans";;
4023			esac
4024			ansexp="$value"
4025			case "$exp_file" in
4026			'') value="$ans";;
4027			esac
4028			;;
4029		esac
4030		case "$fullpath" in
4031		true)
4032			case "$ansexp" in
4033			/*) value="$ansexp" ;;
4034			[a-zA-Z]:/*) value="$ansexp" ;;
4035			*)
4036				redo=true
4037				case "$already" in
4038				true)
4039				echo "I shall only accept a full path name, as in /bin/ls." >&4
4040				echo "Use a ! shell escape if you wish to check pathnames." >&4
4041					;;
4042				*)
4043				echo "Please give a full path name, starting with slash." >&4
4044					case "$tilde" in
4045					true)
4046				echo "Note that using ~name is ok provided it expands well." >&4
4047						already=true
4048						;;
4049					esac
4050				esac
4051				;;
4052			esac
4053			;;
4054		esac
4055		case "$redo" in
4056		'')
4057			case "$type" in
4058			File)
4059				for fp in $gfpth; do
4060					if test "X$fp" = X.; then
4061					    pf="$ansexp"
4062					else
4063					    pf="$fp/$ansexp"
4064					fi
4065					if test -f "$pf"; then
4066						type=''
4067					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4068					then
4069						echo "($value is not a plain file, but that's ok.)"
4070						type=''
4071					fi
4072					if test X"$type" = X; then
4073					    value="$pf"
4074					    break
4075					fi
4076				done
4077				;;
4078			Directory)
4079				for fp in $gfpth; do
4080					if test "X$fp" = X.; then
4081					    dir="$ans"
4082					    direxp="$ansexp"
4083					else
4084					    dir="$fp/$ansexp"
4085					    direxp="$fp/$ansexp"
4086					fi
4087					if test -d "$direxp"; then
4088						type=''
4089						value="$dir"
4090						break
4091					fi
4092				done
4093				;;
4094			Locate)
4095				if test -d "$ansexp"; then
4096					echo "(Looking for $loc_file in directory $value.)"
4097					value="$value/$loc_file"
4098					ansexp="$ansexp/$loc_file"
4099				fi
4100				if test -f "$ansexp"; then
4101					type=''
4102				fi
4103				case "$nopath_ok" in
4104				true)	case "$value" in
4105					*/*) ;;
4106					*)	echo "Assuming $value will be in people's path."
4107						type=''
4108						;;
4109					esac
4110					;;
4111				esac
4112				;;
4113			esac
4114
4115			case "$skip" in
4116			true) type='';
4117			esac
4118
4119			case "$type" in
4120			'') ;;
4121			*)
4122				if test "$fastread" = yes; then
4123					dflt=y
4124				else
4125					dflt=n
4126				fi
4127				rp="$what $value doesn't exist.  Use that name anyway?"
4128				. UU/myread
4129				dflt=''
4130				case "$ans" in
4131				y*) type='';;
4132				*) echo " ";;
4133				esac
4134				;;
4135			esac
4136			;;
4137		esac
4138		;;
4139	esac
4140done
4141cd UU
4142ans="$value"
4143rp="$orig_rp"
4144dflt="$orig_dflt"
4145rm -f getfile.ok
4146test "X$gfpthkeep" != Xy && gfpth=""
4147EOSC
4148
4149: What should the include directory be ?
4150echo " "
4151$echo $n "Hmm...  $c"
4152dflt='/usr/include'
4153incpath=''
4154mips_type=''
4155if $test -f /bin/mips && /bin/mips; then
4156	echo "Looks like a MIPS system..."
4157	$cat >usr.c <<'EOCP'
4158#ifdef SYSTYPE_BSD43
4159/bsd43
4160#endif
4161EOCP
4162	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4163		dflt='/bsd43/usr/include'
4164		incpath='/bsd43'
4165		mips_type='BSD 4.3'
4166	else
4167		mips_type='System V'
4168	fi
4169	$rm -f usr.c usr.out
4170	echo "and you're compiling with the $mips_type compiler and libraries."
4171	xxx_prompt=y
4172	echo "exit 0" >mips
4173else
4174	echo "Doesn't look like a MIPS system."
4175	xxx_prompt=n
4176	echo "exit 1" >mips
4177fi
4178chmod +x mips
4179$eunicefix mips
4180case "$usrinc" in
4181'') ;;
4182*) dflt="$usrinc";;
4183esac
4184case "$xxx_prompt" in
4185y)	fn=d/
4186	echo " "
4187	rp='Where are the include files you want to use?'
4188	. ./getfile
4189	usrinc="$ans"
4190	;;
4191*)	usrinc="$dflt"
4192	;;
4193esac
4194
4195: see how we invoke the C preprocessor
4196echo " "
4197echo "Now, how can we feed standard input to your C preprocessor..." >&4
4198cat <<'EOT' >testcpp.c
4199#define ABC abc
4200#define XYZ xyz
4201ABC.XYZ
4202EOT
4203cd ..
4204if test ! -f cppstdin; then
4205	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4206		# AIX cc -E doesn't show the absolute headerfile
4207		# locations but we'll cheat by using the -M flag.
4208		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
4209	else
4210		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4211	fi
4212else
4213	echo "Keeping your $hint cppstdin wrapper."
4214fi
4215chmod 755 cppstdin
4216wrapper=`pwd`/cppstdin
4217ok='false'
4218cd UU
4219
4220if $test "X$cppstdin" != "X" && \
4221	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4222	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4223then
4224	echo "You used to use $cppstdin $cppminus so we'll use that again."
4225	case "$cpprun" in
4226	'') echo "But let's see if we can live without a wrapper..." ;;
4227	*)
4228		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4229			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4230		then
4231			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4232			ok='true'
4233		else
4234			echo "(However, $cpprun $cpplast does not work, let's see...)"
4235		fi
4236		;;
4237	esac
4238else
4239	case "$cppstdin" in
4240	'') ;;
4241	*)
4242		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4243		;;
4244	esac
4245fi
4246
4247if $ok; then
4248	: nothing
4249elif echo 'Maybe "'"$cc"' -E" will work...'; \
4250	$cc -E <testcpp.c >testcpp.out 2>&1; \
4251	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4252	echo "Yup, it does."
4253	x_cpp="$cc -E"
4254	x_minus='';
4255elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4256	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4257	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4258	echo "Yup, it does."
4259	x_cpp="$cc -E"
4260	x_minus='-';
4261elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4262	$cc -P <testcpp.c >testcpp.out 2>&1; \
4263	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4264	echo "Yipee, that works!"
4265	x_cpp="$cc -P"
4266	x_minus='';
4267elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4268	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4269	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4270	echo "At long last!"
4271	x_cpp="$cc -P"
4272	x_minus='-';
4273elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4274	$cpp <testcpp.c >testcpp.out 2>&1; \
4275	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4276	echo "It works!"
4277	x_cpp="$cpp"
4278	x_minus='';
4279elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4280	$cpp - <testcpp.c >testcpp.out 2>&1; \
4281	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4282	echo "Hooray, it works!  I was beginning to wonder."
4283	x_cpp="$cpp"
4284	x_minus='-';
4285elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4286	$wrapper <testcpp.c >testcpp.out 2>&1; \
4287	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4288	x_cpp="$wrapper"
4289	x_minus=''
4290	echo "Eureka!"
4291else
4292	dflt=''
4293	rp="No dice.  I can't find a C preprocessor.  Name one:"
4294	. ./myread
4295	x_cpp="$ans"
4296	x_minus=''
4297	$x_cpp <testcpp.c >testcpp.out 2>&1
4298	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4299		echo "OK, that will do." >&4
4300	else
4301echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4302		exit 1
4303	fi
4304fi
4305
4306case "$ok" in
4307false)
4308	cppstdin="$x_cpp"
4309	cppminus="$x_minus"
4310	cpprun="$x_cpp"
4311	cpplast="$x_minus"
4312	set X $x_cpp
4313	shift
4314	case "$1" in
4315	"$cpp")
4316		echo "Perhaps can we force $cc -E using a wrapper..."
4317		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4318			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4319		then
4320			echo "Yup, we can."
4321			cppstdin="$wrapper"
4322			cppminus='';
4323		else
4324			echo "Nope, we'll have to live without it..."
4325		fi
4326		;;
4327	esac
4328	case "$cpprun" in
4329	"$wrapper")
4330		cpprun=''
4331		cpplast=''
4332		;;
4333	esac
4334	;;
4335esac
4336
4337case "$cppstdin" in
4338"$wrapper"|'cppstdin') ;;
4339*) $rm -f $wrapper;;
4340esac
4341$rm -f testcpp.c testcpp.out
4342
4343: Set private lib path
4344case "$plibpth" in
4345'') if ./mips; then
4346		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4347	fi;;
4348esac
4349case "$libpth" in
4350' ') dlist='';;
4351'') dlist="$loclibpth $plibpth $glibpth";;
4352*) dlist="$libpth";;
4353esac
4354
4355: Now check and see which directories actually exist, avoiding duplicates
4356libpth=''
4357for xxx in $dlist
4358do
4359    if $test -d $xxx; then
4360		case " $libpth " in
4361		*" $xxx "*) ;;
4362		*) libpth="$libpth $xxx";;
4363		esac
4364    fi
4365done
4366$cat <<'EOM'
4367
4368Some systems have incompatible or broken versions of libraries.  Among
4369the directories listed in the question below, please remove any you
4370know not to be holding relevant libraries, and add any that are needed.
4371Say "none" for none.
4372
4373EOM
4374case "$libpth" in
4375'') dflt='none';;
4376*)
4377	set X $libpth
4378	shift
4379	dflt=${1+"$@"}
4380	;;
4381esac
4382rp="Directories to use for library searches?"
4383. ./myread
4384case "$ans" in
4385none) libpth=' ';;
4386*) libpth="$ans";;
4387esac
4388
4389: compute shared library extension
4390case "$so" in
4391'')
4392	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4393		dflt='sl'
4394	else
4395		dflt='so'
4396	fi
4397	;;
4398*) dflt="$so";;
4399esac
4400$cat <<EOM
4401
4402On some systems, shared libraries may be available.  Answer 'none' if
4403you want to suppress searching of shared libraries for the remainder
4404of this configuration.
4405
4406EOM
4407rp='What is the file extension used for shared libraries?'
4408. ./myread
4409so="$ans"
4410
4411: Define several unixisms.
4412: Hints files or command line option can be used to override them.
4413: The convoluted testing is in case hints files set either the old
4414: or the new name.
4415case "$_exe" in
4416'')	case "$exe_ext" in
4417	'')	;;
4418	*)	_exe="$exe_ext" ;;
4419	esac
4420	;;
4421esac
4422case "$_a" in
4423'')	case "$lib_ext" in
4424    '')	_a='.a';;
4425	*)	_a="$lib_ext" ;;
4426	esac
4427	;;
4428esac
4429case "$_o" in
4430'') case "$obj_ext" in
4431	'')	_o='.o';;
4432	*)	_o="$obj_ext";;
4433	esac
4434	;;
4435esac
4436case "$p_" in
4437'') case "$path_sep" in
4438	'')	p_=':';;
4439	*)	p_="$path_sep";;
4440	esac
4441	;;
4442esac
4443exe_ext=$_exe
4444lib_ext=$_a
4445obj_ext=$_o
4446path_sep=$p_
4447
4448: Which makefile gets called first.  This is used by make depend.
4449case "$firstmakefile" in
4450'') firstmakefile='makefile';;
4451esac
4452
4453: Looking for optional libraries
4454echo " "
4455echo "Checking for optional libraries..." >&4
4456case "$libs" in
4457' '|'') dflt='';;
4458*) dflt="$libs";;
4459esac
4460case "$libswanted" in
4461'') libswanted='c_s';;
4462esac
4463case "$usesocks" in
4464"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4465esac
4466libsfound=''
4467libsfiles=''
4468libsdirs=''
4469libspath=''
4470for thisdir in $libpth $xlibpth; do
4471  test -d $thisdir && libspath="$libspath $thisdir"
4472done
4473for thislib in $libswanted; do
4474	for thisdir in $libspath; do
4475	    xxx=''
4476	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4477		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4478	        $test -f "$xxx" && eval $libscheck
4479		$test -f "$xxx" && libstyle=shared
4480	    fi
4481	    if test ! -f "$xxx"; then
4482		xxx=$thisdir/lib$thislib.$so
4483	        $test -f "$xxx" && eval $libscheck
4484		$test -f "$xxx" && libstyle=shared
4485	    fi
4486	    if test ! -f "$xxx"; then
4487		xxx=$thisdir/lib$thislib$_a
4488	        $test -f "$xxx" && eval $libscheck
4489		$test -f "$xxx" && libstyle=static
4490	    fi
4491	    if test ! -f "$xxx"; then
4492		xxx=$thisdir/$thislib$_a
4493	        $test -f "$xxx" && eval $libscheck
4494		$test -f "$xxx" && libstyle=static
4495	    fi
4496	    if test ! -f "$xxx"; then
4497		xxx=$thisdir/lib${thislib}_s$_a
4498	        $test -f "$xxx" && eval $libscheck
4499		$test -f "$xxx" && libstyle=static
4500		$test -f "$xxx" && thislib=${thislib}_s
4501	    fi
4502	    if test ! -f "$xxx"; then
4503		xxx=$thisdir/Slib$thislib$_a
4504	        $test -f "$xxx" && eval $libscheck
4505		$test -f "$xxx" && libstyle=static
4506	    fi
4507	    if $test -f "$xxx"; then
4508		case "$libstyle" in
4509		shared) echo "Found -l$thislib (shared)." ;;
4510		static) echo "Found -l$thislib." ;;
4511		*)      echo "Found -l$thislib ($libstyle)." ;;
4512		esac
4513		case " $dflt " in
4514		*"-l$thislib "*);;
4515		*) dflt="$dflt -l$thislib"
4516                   libsfound="$libsfound $xxx"
4517                   yyy=`basename $xxx`
4518                   libsfiles="$libsfiles $yyy"
4519                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4520                   case " $libsdirs " in
4521                   *" $yyy "*) ;;
4522                   *) libsdirs="$libsdirs $yyy" ;;
4523                   esac
4524		   ;;
4525		esac
4526		break
4527	    fi
4528	done
4529	if $test ! -f "$xxx"; then
4530	    echo "No -l$thislib."
4531	fi
4532done
4533set X $dflt
4534shift
4535dflt="$*"
4536case "$libs" in
4537'') dflt="$dflt";;
4538*) dflt="$libs";;
4539esac
4540case "$dflt" in
4541' '|'') dflt='none';;
4542esac
4543
4544$cat <<EOM
4545
4546In order to compile $package on your machine, a number of libraries
4547are usually needed.  Include any other special libraries here as well.
4548Say "none" for none.  The default list is almost always right.
4549EOM
4550
4551echo " "
4552rp="What libraries to use?"
4553. ./myread
4554case "$ans" in
4555none) libs=' ';;
4556*) libs="$ans";;
4557esac
4558
4559: determine optimization, if desired, or use for debug flag also
4560case "$optimize" in
4561' '|$undef) dflt='none';;
4562'') dflt='-O';;
4563*) dflt="$optimize";;
4564esac
4565$cat <<EOH
4566
4567By default, $package compiles with the -O flag to use the optimizer.
4568Alternately, you might want to use the symbolic debugger, which uses
4569the -g flag (on traditional Unix systems).  Either flag can be
4570specified here.  To use neither flag, specify the word "none".
4571
4572EOH
4573rp="What optimizer/debugger flag should be used?"
4574. ./myread
4575optimize="$ans"
4576case "$optimize" in
4577'none') optimize=" ";;
4578esac
4579
4580dflt=''
4581: We will not override a previous value, but we might want to
4582: augment a hint file
4583case "$hint" in
4584default|recommended)
4585	case "$gccversion" in
4586	1*) dflt='-fpcc-struct-return' ;;
4587	esac
4588	case "$optimize" in
4589	*-g*) dflt="$dflt -DDEBUGGING";;
4590	esac
4591	case "$gccversion" in
4592	2*) if test -d /etc/conf/kconfig.d &&
4593			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4594		then
4595			dflt="$dflt -posix"
4596		fi
4597		;;
4598	esac
4599	case "$gccversion" in
4600	1*) ;;
4601	2.[0-8]*) ;;
4602	?*) 	echo " "
4603		echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4604		echo 'int main(void) { return 0; }' > gcctest.c
4605		if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4606			echo "Yes, it does." 2>&1
4607			case "$ccflags" in
4608			*strict-aliasing*)
4609				echo "Leaving current flags $ccflags alone." 2>&1
4610				;;
4611			*) dflt="$dflt -fno-strict-aliasing" ;;
4612			esac
4613		else
4614			echo "Nope, it doesn't, but that's ok." 2>&1
4615		fi
4616		;;
4617	esac
4618	;;
4619esac
4620
4621case "$mips_type" in
4622*BSD*|'') inclwanted="$locincpth $usrinc";;
4623*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4624esac
4625for thisincl in $inclwanted; do
4626	if $test -d $thisincl; then
4627		if $test x$thisincl != x$usrinc; then
4628			case "$dflt" in
4629                        *" -I$thisincl "*);;
4630                        *) dflt="$dflt -I$thisincl ";;
4631			esac
4632		fi
4633	fi
4634done
4635
4636inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4637	xxx=true;
4638elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4639	xxx=true;
4640else
4641	xxx=false;
4642fi;
4643if $xxx; then
4644	case "$dflt" in
4645	*$2*);;
4646	*) dflt="$dflt -D$2";;
4647	esac;
4648fi'
4649
4650set signal.h LANGUAGE_C; eval $inctest
4651
4652case "$usesocks" in
4653$define)
4654	ccflags="$ccflags -DSOCKS"
4655	;;
4656esac
4657
4658case "$hint" in
4659default|recommended) dflt="$ccflags $dflt" ;;
4660*) dflt="$ccflags";;
4661esac
4662
4663case "$dflt" in
4664''|' ') dflt=none;;
4665esac
4666
4667$cat <<EOH
4668
4669Your C compiler may want other flags.  For this question you should include
4670-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4671but you should NOT include libraries or ld flags like -lwhatever.  If you
4672want $package to honor its debug switch, you should include -DDEBUGGING here.
4673Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4674
4675To use no flags, specify the word "none".
4676
4677EOH
4678set X $dflt
4679shift
4680dflt=${1+"$@"}
4681rp="Any additional cc flags?"
4682. ./myread
4683case "$ans" in
4684none) ccflags='';;
4685*) ccflags="$ans";;
4686esac
4687
4688: the following weeds options from ccflags that are of no interest to cpp
4689case "$cppflags" in
4690'') cppflags="$ccflags" ;;
4691*)  cppflags="$cppflags $ccflags" ;;
4692esac
4693case "$gccversion" in
46941*) cppflags="$cppflags -D__GNUC__"
4695esac
4696case "$mips_type" in
4697'');;
4698*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4699esac
4700case "$cppflags" in
4701'');;
4702*)
4703	echo " "
4704	echo "Let me guess what the preprocessor flags are..." >&4
4705	set X $cppflags
4706	shift
4707	cppflags=''
4708	$cat >cpp.c <<'EOM'
4709#define BLURFL foo
4710
4711BLURFL xx LFRULB
4712EOM
4713	previous=''
4714	for flag in $*
4715	do
4716		case "$flag" in
4717		-*) ftry="$flag";;
4718		*) ftry="$previous $flag";;
4719		esac
4720		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4721			>cpp1.out 2>/dev/null && \
4722			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4723			>cpp2.out 2>/dev/null && \
4724			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4725			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4726		then
4727			cppflags="$cppflags $ftry"
4728			previous=''
4729		else
4730			previous="$flag"
4731		fi
4732	done
4733	set X $cppflags
4734	shift
4735	cppflags=${1+"$@"}
4736	case "$cppflags" in
4737	*-*)  echo "They appear to be: $cppflags";;
4738	esac
4739	$rm -f cpp.c cpp?.out
4740	;;
4741esac
4742
4743: flags used in final linking phase
4744case "$ldflags" in
4745'') if ./venix; then
4746		dflt='-i -z'
4747	else
4748		dflt=''
4749	fi
4750	case "$ccflags" in
4751	*-posix*) dflt="$dflt -posix" ;;
4752	esac
4753	;;
4754*) dflt="$ldflags";;
4755esac
4756
4757: Try to guess additional flags to pick up local libraries.
4758for thislibdir in $libpth; do
4759	case " $loclibpth " in
4760	*" $thislibdir "*)
4761		case "$dflt " in
4762		*"-L$thislibdir "*) ;;
4763		*)  dflt="$dflt -L$thislibdir" ;;
4764		esac
4765		;;
4766	esac
4767done
4768
4769case "$dflt" in
4770'') dflt='none' ;;
4771esac
4772
4773$cat <<EOH
4774
4775Your C linker may need flags.  For this question you should
4776include -L/whatever and any other flags used by the C linker, but you
4777should NOT include libraries like -lwhatever.
4778
4779Make sure you include the appropriate -L/path flags if your C linker
4780does not normally search all of the directories you specified above,
4781namely
4782	$libpth
4783To use no flags, specify the word "none".
4784
4785EOH
4786
4787rp="Any additional ld flags (NOT including libraries)?"
4788. ./myread
4789case "$ans" in
4790none) ldflags='';;
4791*) ldflags="$ans";;
4792esac
4793rmlist="$rmlist pdp11"
4794
4795: coherency check
4796echo " "
4797echo "Checking your choice of C compiler and flags for coherency..." >&4
4798$cat > try.c <<'EOF'
4799#include <stdio.h>
4800int main() { printf("Ok\n"); exit(0); }
4801EOF
4802set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4803shift
4804$cat >try.msg <<'EOM'
4805I've tried to compile and run the following simple program:
4806
4807EOM
4808$cat try.c >> try.msg
4809
4810$cat >> try.msg <<EOM
4811
4812I used the command:
4813
4814	$*
4815	$run ./try
4816
4817and I got the following output:
4818
4819EOM
4820dflt=y
4821if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4822	if $sh -c "$run ./try" >>try.msg 2>&1; then
4823		xxx=`$run ./try`
4824		case "$xxx" in
4825		"Ok") dflt=n ;;
4826		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
4827			case " $libs " in
4828			*" -lsfio "*)
4829				cat >> try.msg <<'EOQS'
4830If $libs contains -lsfio, and sfio is mis-configured, then it
4831sometimes (apparently) runs and exits with a 0 status, but with no
4832output!  It may have to do with sfio's use of _exit vs. exit.
4833
4834EOQS
4835				rp="You have a big problem.  Shall I abort Configure"
4836				dflt=y
4837				;;
4838			esac
4839			;;
4840		esac
4841	else
4842		echo "The program compiled OK, but exited with status $?." >>try.msg
4843		rp="You have a problem.  Shall I abort Configure"
4844		dflt=y
4845	fi
4846else
4847	echo "I can't compile the test program." >>try.msg
4848	rp="You have a BIG problem.  Shall I abort Configure"
4849	dflt=y
4850fi
4851case "$dflt" in
4852y)
4853	$cat try.msg >&4
4854	case "$knowitall" in
4855	'')
4856		echo "(The supplied flags or libraries might be incorrect.)"
4857		;;
4858	*) dflt=n;;
4859	esac
4860	echo " "
4861	. ./myread
4862	case "$ans" in
4863	n*|N*) ;;
4864	*)	echo "Ok.  Stopping Configure." >&4
4865		exit 1
4866		;;
4867	esac
4868	;;
4869n) echo "OK, that should do.";;
4870esac
4871$rm -f try try.* core
4872
4873: define a shorthand compile call
4874compile='
4875mc_file=$1;
4876shift;
4877$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4878: define a shorthand compile call for compilations that should be ok.
4879compile_ok='
4880mc_file=$1;
4881shift;
4882$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4883
4884: check for lengths of integral types
4885echo " "
4886case "$intsize" in
4887'')
4888	echo "Checking to see how big your integers are..." >&4
4889	$cat >try.c <<'EOCP'
4890#include <stdio.h>
4891int main()
4892{
4893	printf("intsize=%d;\n", (int)sizeof(int));
4894	printf("longsize=%d;\n", (int)sizeof(long));
4895	printf("shortsize=%d;\n", (int)sizeof(short));
4896	exit(0);
4897}
4898EOCP
4899	set try
4900	if eval $compile_ok && $run ./try > /dev/null; then
4901		eval `$run ./try`
4902		echo "Your integers are $intsize bytes long."
4903		echo "Your long integers are $longsize bytes long."
4904		echo "Your short integers are $shortsize bytes long."
4905	else
4906		$cat >&4 <<EOM
4907!
4908Help! I can't compile and run the intsize test program: please enlighten me!
4909(This is probably a misconfiguration in your system or libraries, and
4910you really ought to fix it.  Still, I'll try anyway.)
4911!
4912EOM
4913		dflt=4
4914		rp="What is the size of an integer (in bytes)?"
4915		. ./myread
4916		intsize="$ans"
4917		dflt=$intsize
4918		rp="What is the size of a long integer (in bytes)?"
4919		. ./myread
4920		longsize="$ans"
4921		dflt=2
4922		rp="What is the size of a short integer (in bytes)?"
4923		. ./myread
4924		shortsize="$ans"
4925	fi
4926	;;
4927esac
4928$rm -f try try.*
4929
4930: check for long long
4931echo " "
4932echo "Checking to see if you have long long..." >&4
4933echo 'int main() { long long x = 7; return 0; }' > try.c
4934set try
4935if eval $compile; then
4936	val="$define"
4937	echo "You have long long."
4938else
4939	val="$undef"
4940	echo "You do not have long long."
4941fi
4942$rm try.*
4943set d_longlong
4944eval $setvar
4945
4946: check for length of long long
4947case "${d_longlong}${longlongsize}" in
4948$define)
4949	echo " "
4950	echo "Checking to see how big your long longs are..." >&4
4951	$cat >try.c <<'EOCP'
4952#include <stdio.h>
4953int main()
4954{
4955    printf("%d\n", (int)sizeof(long long));
4956    return(0);
4957}
4958EOCP
4959	set try
4960	if eval $compile_ok; then
4961		longlongsize=`$run ./try`
4962		echo "Your long longs are $longlongsize bytes long."
4963	else
4964		dflt='8'
4965		echo " "
4966		echo "(I can't seem to compile the test program.  Guessing...)"
4967		rp="What is the size of a long long (in bytes)?"
4968		. ./myread
4969		longlongsize="$ans"
4970	fi
4971	if $test "X$longsize" = "X$longlongsize"; then
4972		echo "(That isn't any different from an ordinary long.)"
4973	fi
4974	;;
4975esac
4976$rm -f try.* try
4977
4978: determine filename position in cpp output
4979echo " "
4980echo "Computing filename position in cpp output for #include directives..." >&4
4981case "$osname" in
4982vos) testaccess=-e ;;
4983*)   testaccess=-r ;;
4984esac
4985echo '#include <stdio.h>' > foo.c
4986$cat >fieldn <<EOF
4987$startsh
4988$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4989$grep '^[ 	]*#.*stdio\.h' | \
4990while read cline; do
4991	pos=1
4992	set \$cline
4993	while $test \$# -gt 0; do
4994		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4995			echo "\$pos"
4996			exit 0
4997		fi
4998		shift
4999		pos=\`expr \$pos + 1\`
5000	done
5001done
5002EOF
5003chmod +x fieldn
5004fieldn=`./fieldn`
5005$rm -f foo.c fieldn
5006case $fieldn in
5007'') pos='???';;
50081) pos=first;;
50092) pos=second;;
50103) pos=third;;
5011*) pos="${fieldn}th";;
5012esac
5013echo "Your cpp writes the filename in the $pos field of the line."
5014
5015case "$osname" in
5016vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5017*)   cppfilter='' ;;
5018esac
5019: locate header file
5020$cat >findhdr <<EOF
5021$startsh
5022wanted=\$1
5023name=''
5024for usrincdir in $usrinc
5025do
5026	if test -f \$usrincdir/\$wanted; then
5027		echo "\$usrincdir/\$wanted"
5028		exit 0
5029	fi
5030done
5031awkprg='{ print \$$fieldn }'
5032echo "#include <\$wanted>" > foo\$\$.c
5033$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5034$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5035while read cline; do
5036	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5037	case "\$name" in
5038	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5039	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5040	*) exit 2;;
5041	esac;
5042done;
5043#
5044# status = 0: grep returned 0 lines, case statement not executed
5045# status = 1: headerfile found
5046# status = 2: while loop executed, no headerfile found
5047#
5048status=\$?
5049$rm -f foo\$\$.c;
5050if test \$status -eq 1; then
5051	exit 0;
5052fi
5053exit 1
5054EOF
5055chmod +x findhdr
5056
5057: define an alternate in-header-list? function
5058inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5059cont=true; xxf="echo \"<\$1> found.\" >&4";
5060case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5061*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5062esac;
5063case $# in 4) instead=instead;; *) instead="at last";; esac;
5064while $test "$cont"; do
5065	xxx=`./findhdr $1`
5066	var=$2; eval "was=\$$2";
5067	if $test "$xxx" && $test -r "$xxx";
5068	then eval $xxf;
5069	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5070		cont="";
5071	else eval $xxnf;
5072	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5073	set $yyy; shift; shift; yyy=$@;
5074	case $# in 0) cont="";;
5075	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5076		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5077	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5078		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5079	esac;
5080done;
5081while $test "$yyy";
5082do set $yyy; var=$2; eval "was=\$$2";
5083	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5084	set $yyy; shift; shift; yyy=$@;
5085done'
5086
5087: see if inttypes.h is available
5088: we want a real compile instead of Inhdr because some systems
5089: have an inttypes.h which includes non-existent headers
5090echo " "
5091$cat >try.c <<EOCP
5092#include <inttypes.h>
5093int main() {
5094	static int32_t foo32 = 0x12345678;
5095}
5096EOCP
5097set try
5098if eval $compile; then
5099	echo "<inttypes.h> found." >&4
5100	val="$define"
5101else
5102	echo "<inttypes.h> NOT found." >&4
5103	val="$undef"
5104fi
5105$rm -f try.c try
5106set i_inttypes
5107eval $setvar
5108
5109: check for int64_t
5110echo " "
5111echo "Checking to see if you have int64_t..." >&4
5112$cat >try.c <<EOCP
5113#include <sys/types.h>
5114#$i_inttypes I_INTTYPES
5115#ifdef I_INTTYPES
5116#include <inttypes.h>
5117#endif
5118int main() { int64_t x = 7; }
5119EOCP
5120set try
5121if eval $compile; then
5122	val="$define"
5123	echo "You have int64_t."
5124else
5125	val="$undef"
5126	echo "You do not have int64_t."
5127fi
5128$rm -f try try.*
5129set d_int64_t
5130eval $setvar
5131
5132
5133echo " "
5134echo "Checking which 64-bit integer type we could use..." >&4
5135
5136case "$intsize" in
51378) val=int
5138   set quadtype
5139   eval $setvar
5140   val='"unsigned int"'
5141   set uquadtype
5142   eval $setvar
5143   quadkind=1
5144   ;;
5145*) case "$longsize" in
5146   8) val=long
5147      set quadtype
5148      eval $setvar
5149      val='"unsigned long"'
5150      set uquadtype
5151      eval $setvar
5152      quadkind=2
5153      ;;
5154   *) case "$d_longlong:$longlongsize" in
5155      define:8)
5156        val='"long long"'
5157        set quadtype
5158        eval $setvar
5159        val='"unsigned long long"'
5160        set uquadtype
5161        eval $setvar
5162        quadkind=3
5163        ;;
5164      *) case "$d_int64_t" in
5165         define)
5166           val=int64_t
5167           set quadtype
5168           eval $setvar
5169           val=uint64_t
5170           set uquadtype
5171           eval $setvar
5172           quadkind=4
5173           ;;
5174         esac
5175         ;;
5176      esac
5177      ;;
5178   esac
5179   ;;
5180esac
5181
5182case "$quadtype" in
5183'')	echo "Alas, no 64-bit integer types in sight." >&4
5184	d_quad="$undef"
5185	;;
5186*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5187	d_quad="$define"
5188	;;
5189esac
5190
5191
5192case "$uselonglong" in
5193"$define"|true|[yY]*)
5194	cat <<EOM >&4
5195
5196*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5197EOM
5198	use64bitint="$define"
5199	;;
5200esac
5201case "$use64bits" in
5202"$define"|true|[yY]*)
5203	cat <<EOM >&4
5204
5205*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5206EOM
5207	use64bitint="$define"
5208	;;
5209esac
5210case "$use64bitints" in
5211"$define"|true|[yY]*)
5212	cat <<EOM >&4
5213
5214*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5215EOM
5216	use64bitint="$define"
5217	;;
5218esac
5219case "$use64bitsint" in
5220"$define"|true|[yY]*)
5221	cat <<EOM >&4
5222
5223*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5224EOM
5225	use64bitint="$define"
5226	;;
5227esac
5228case "$uselonglongs" in
5229"$define"|true|[yY]*)
5230	cat <<EOM >&4
5231
5232*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5233EOM
5234	use64bitint="$define"
5235	;;
5236esac
5237case "$use64bitsall" in
5238"$define"|true|[yY]*)
5239	cat <<EOM >&4
5240
5241*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5242EOM
5243	use64bitall="$define"
5244	;;
5245esac
5246
5247case "$ccflags" in
5248*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5249esac
5250case "$use64bitall" in
5251"$define"|true|[yY]*) use64bitint="$define" ;;
5252esac
5253
5254case "$longsize" in
52558) cat <<EOM
5256
5257You have natively 64-bit long integers.
5258EOM
5259   val="$define"
5260   ;;
5261*) case "$use64bitint" in
5262   "$define"|true|[yY]*) dflt='y';;
5263   *) dflt='n';;
5264   esac
5265   case "$d_quad" in
5266   "$define") ;;
5267   *) dflt='n' ;;
5268   esac
5269   cat <<EOM
5270
5271Perl can be built to take advantage of 64-bit integer types
5272on some systems.  To do so, Configure can be run with -Duse64bitint.
5273Choosing this option will most probably introduce binary incompatibilities.
5274
5275If this doesn't make any sense to you, just accept the default '$dflt'.
5276(The default has been chosen based on your configuration.)
5277EOM
5278   rp='Try to use 64-bit integers, if available?'
5279   . ./myread
5280   case "$ans" in
5281   [yY]*) val="$define" ;;
5282   *)     val="$undef"  ;;
5283   esac
5284   ;;
5285esac
5286set use64bitint
5287eval $setvar
5288
5289case "$use64bitall" in
5290"$define"|true|[yY]*) dflt='y' ;;
5291*) case "$longsize" in
5292   8) dflt='y' ;;
5293   *) dflt='n' ;;
5294   esac
5295   ;;
5296esac
5297cat <<EOM
5298
5299You may also choose to try maximal 64-bitness.  It means using as much
530064-bitness as possible on the platform.  This in turn means even more
5301binary incompatibilities.  On the other hand, your platform may not
5302have any more 64-bitness available than what you already have chosen.
5303
5304If this doesn't make any sense to you, just accept the default '$dflt'.
5305(The default has been chosen based on your configuration.)
5306EOM
5307rp='Try to use maximal 64-bit support, if available?'
5308. ./myread
5309case "$ans" in
5310[yY]*) val="$define" ;;
5311*)     val="$undef"  ;;
5312esac
5313set use64bitall
5314eval $setvar
5315case "$use64bitall" in
5316"$define")
5317	case "$use64bitint" in
5318	"$undef")
5319		cat <<EOM
5320
5321Since you have chosen a maximally 64-bit build, I'm also turning on
5322the use of 64-bit integers.
5323EOM
5324		use64bitint="$define" ;;
5325	esac
5326	;;
5327esac
5328
5329case "$use64bitint" in
5330"$define"|true|[yY]*)
5331: Look for a hint-file generated 'call-back-unit'.  If the
5332: user has specified that a 64-bit perl is to be built,
5333: we may need to set or change some other defaults.
5334	if $test -f use64bitint.cbu; then
5335		echo "Your platform has some specific hints for 64-bit integers, using them..."
5336		. ./use64bitint.cbu
5337	fi
5338	case "$longsize" in
5339	4) case "$archname64" in
5340	   '') archname64=64int ;;
5341	   esac
5342	   ;;
5343	esac
5344	;;
5345esac
5346
5347case "$use64bitall" in
5348"$define"|true|[yY]*)
5349: Look for a hint-file generated 'call-back-unit'.  If the
5350: user has specified that a maximally 64-bit perl is to be built,
5351: we may need to set or change some other defaults.
5352	if $test -f use64bitall.cbu; then
5353		echo "Your platform has some specific hints for 64-bit builds, using them..."
5354		. ./use64bitall.cbu
5355	fi
5356	case "$longsize" in
5357	4) case "$archname64" in
5358	   ''|64int) archname64=64all ;;
5359	   esac
5360	   ;;
5361	esac
5362	;;
5363esac
5364
5365echo " "
5366echo "Checking for GNU C Library..." >&4
5367cat >try.c <<'EOCP'
5368/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5369   alone are insufficient to distinguish different versions, such as
5370   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5371   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5372*/
5373#include <stdio.h>
5374int main(void)
5375{
5376#ifdef __GLIBC__
5377#   ifdef __GLIBC_MINOR__
5378#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5379#           include <gnu/libc-version.h>
5380	    printf("%s\n",  gnu_get_libc_version());
5381#       else
5382	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5383#       endif
5384#   else
5385	printf("%d\n",  __GLIBC__);
5386#   endif
5387    return 0;
5388#else
5389    return 1;
5390#endif
5391}
5392EOCP
5393set try
5394if eval $compile_ok && $run ./try > glibc.ver; then
5395	val="$define"
5396	gnulibc_version=`$cat glibc.ver`
5397	echo "You are using the GNU C Library version $gnulibc_version"
5398else
5399	val="$undef"
5400	gnulibc_version=''
5401	echo "You are not using the GNU C Library"
5402fi
5403$rm -f try try.* glibc.ver
5404set d_gnulibc
5405eval $setvar
5406
5407: see if nm is to be used to determine whether a symbol is defined or not
5408case "$usenm" in
5409'')
5410	dflt=''
5411	case "$d_gnulibc" in
5412	"$define")
5413		echo " "
5414		echo "nm probably won't work on the GNU C Library." >&4
5415		dflt=n
5416		;;
5417	esac
5418	case "$dflt" in
5419	'')
5420		if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5421			echo " "
5422			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5423			echo "'nm' won't be sufficient on this sytem." >&4
5424			dflt=n
5425		fi
5426		;;
5427	esac
5428	case "$dflt" in
5429	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5430		if $test $dflt -gt 20; then
5431			dflt=y
5432		else
5433			dflt=n
5434		fi
5435		;;
5436	esac
5437	;;
5438*)
5439	case "$usenm" in
5440	true|$define) dflt=y;;
5441	*) dflt=n;;
5442	esac
5443	;;
5444esac
5445$cat <<EOM
5446
5447I can use $nm to extract the symbols from your C libraries. This
5448is a time consuming task which may generate huge output on the disk (up
5449to 3 megabytes) but that should make the symbols extraction faster. The
5450alternative is to skip the 'nm' extraction part and to compile a small
5451test program instead to determine whether each symbol is present. If
5452you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5453this may be the best solution.
5454
5455You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5456
5457EOM
5458rp="Shall I use $nm to extract C symbols from the libraries?"
5459. ./myread
5460case "$ans" in
5461[Nn]*) usenm=false;;
5462*) usenm=true;;
5463esac
5464
5465runnm=$usenm
5466case "$reuseval" in
5467true) runnm=false;;
5468esac
5469
5470: nm options which may be necessary
5471case "$nm_opt" in
5472'') if $test -f /mach_boot; then
5473		nm_opt=''	# Mach
5474	elif $test -d /usr/ccs/lib; then
5475		nm_opt='-p'	# Solaris (and SunOS?)
5476	elif $test -f /dgux; then
5477		nm_opt='-p'	# DG-UX
5478	elif $test -f /lib64/rld; then
5479		nm_opt='-p'	# 64-bit Irix
5480	else
5481		nm_opt=''
5482	fi;;
5483esac
5484
5485: nm options which may be necessary for shared libraries but illegal
5486: for archive libraries.  Thank you, Linux.
5487case "$nm_so_opt" in
5488'')	case "$myuname" in
5489	*linux*)
5490		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5491			nm_so_opt='--dynamic'
5492		fi
5493		;;
5494	esac
5495	;;
5496esac
5497
5498case "$runnm" in
5499true)
5500: get list of predefined functions in a handy place
5501echo " "
5502case "$libc" in
5503'') libc=unknown
5504	case "$libs" in
5505	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5506	esac
5507	;;
5508esac
5509case "$libs" in
5510'') ;;
5511*)  for thislib in $libs; do
5512	case "$thislib" in
5513	-lc|-lc_s)
5514		: Handle C library specially below.
5515		;;
5516	-l*)
5517		thislib=`echo $thislib | $sed -e 's/^-l//'`
5518		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5519			:
5520		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5521			:
5522		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5523			:
5524		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5525			:
5526		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5527			:
5528		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5529			:
5530		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5531			:
5532		else
5533			try=''
5534		fi
5535		libnames="$libnames $try"
5536		;;
5537	*) libnames="$libnames $thislib" ;;
5538	esac
5539	done
5540	;;
5541esac
5542xxx=normal
5543case "$libc" in
5544unknown)
5545	set /lib/libc.$so
5546	for xxx in $libpth; do
5547		$test -r $1 || set $xxx/libc.$so
5548		: The messy sed command sorts on library version numbers.
5549		$test -r $1 || \
5550			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5551			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5552				h
5553				s/[0-9][0-9]*/0000&/g
5554				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5555				G
5556				s/\n/ /' | \
5557			 $sort | $sed -e 's/^.* //'`
5558		eval set \$$#
5559	done
5560	$test -r $1 || set /usr/ccs/lib/libc.$so
5561	$test -r $1 || set /lib/libsys_s$_a
5562	;;
5563*)
5564	set blurfl
5565	;;
5566esac
5567if $test -r "$1"; then
5568	echo "Your (shared) C library seems to be in $1."
5569	libc="$1"
5570elif $test -r /lib/libc && $test -r /lib/clib; then
5571	echo "Your C library seems to be in both /lib/clib and /lib/libc."
5572	xxx=apollo
5573	libc='/lib/clib /lib/libc'
5574	if $test -r /lib/syslib; then
5575		echo "(Your math library is in /lib/syslib.)"
5576		libc="$libc /lib/syslib"
5577	fi
5578elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5579	echo "Your C library seems to be in $libc, as you said before."
5580elif $test -r $incpath/usr/lib/libc$_a; then
5581	libc=$incpath/usr/lib/libc$_a;
5582	echo "Your C library seems to be in $libc.  That's fine."
5583elif $test -r /lib/libc$_a; then
5584	libc=/lib/libc$_a;
5585	echo "Your C library seems to be in $libc.  You're normal."
5586else
5587	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5588		:
5589	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5590		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5591	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5592		:
5593	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5594		:
5595	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5596		:
5597	else
5598		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5599	fi
5600	if $test -r "$tans"; then
5601		echo "Your C library seems to be in $tans, of all places."
5602		libc=$tans
5603	else
5604		libc='blurfl'
5605	fi
5606fi
5607if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5608	dflt="$libc"
5609	cat <<EOM
5610
5611If the guess above is wrong (which it might be if you're using a strange
5612compiler, or your machine supports multiple models), you can override it here.
5613
5614EOM
5615else
5616	dflt=''
5617	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5618	cat >&4 <<EOM
5619I can't seem to find your C library.  I've looked in the following places:
5620
5621EOM
5622	$sed 's/^/	/' libpath
5623	cat <<EOM
5624
5625None of these seems to contain your C library. I need to get its name...
5626
5627EOM
5628fi
5629fn=f
5630rp='Where is your C library?'
5631. ./getfile
5632libc="$ans"
5633
5634echo " "
5635echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5636set X `cat libnames`
5637shift
5638xxx=files
5639case $# in 1) xxx=file; esac
5640echo "Extracting names from the following $xxx for later perusal:" >&4
5641echo " "
5642$sed 's/^/	/' libnames >&4
5643echo " "
5644$echo $n "This may take a while...$c" >&4
5645
5646for file in $*; do
5647	case $file in
5648	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5649	*) $nm $nm_opt $file 2>/dev/null;;
5650	esac
5651done >libc.tmp
5652
5653$echo $n ".$c"
5654$grep fprintf libc.tmp > libc.ptf
5655xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5656xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5657xxx='[ADTSIW]'
5658if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5659	eval $xscan;\
5660	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5661		eval $xrun
5662elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5663	eval $xscan;\
5664	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5665		eval $xrun
5666elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5667	eval $xscan;\
5668	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5669		eval $xrun
5670elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5671	eval $xscan;\
5672	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5673		eval $xrun
5674elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5675	eval $xscan;\
5676	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5677		eval $xrun
5678elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5679	eval $xscan;\
5680	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5681		eval $xrun
5682elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5683				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
5684	eval $xscan;\
5685	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5686		eval $xrun
5687elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5688	eval $xscan;\
5689	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5690		eval $xrun
5691elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5692	eval $xscan;\
5693	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5694		eval $xrun
5695elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5696	eval $xscan;\
5697	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5698		eval $xrun
5699elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5700	eval $xscan;\
5701	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702		eval $xrun
5703elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5704	eval $xscan;\
5705	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706		eval $xrun
5707elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5708	eval $xscan;\
5709	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710		eval $xrun
5711elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5712	eval $xscan;\
5713	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714		eval $xrun
5715else
5716	$nm -p $* 2>/dev/null >libc.tmp
5717	$grep fprintf libc.tmp > libc.ptf
5718	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5719		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5720	then
5721		nm_opt='-p'
5722		eval $xrun
5723	else
5724		echo " "
5725		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5726		com=''
5727		if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5728			for thisname in $libnames $libc; do
5729				$ar t $thisname >>libc.tmp
5730			done
5731			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5732			echo "Ok." >&4
5733		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5734			# Repeat libc to extract forwarders to DLL entries too
5735			for thisname in $libnames $libc; do
5736				$ar tv $thisname >>libc.tmp
5737				# Revision 50 of EMX has bug in $ar.
5738				# it will not extract forwarders to DLL entries
5739				# Use emximp which will extract exactly them.
5740				emximp -o tmp.imp $thisname \
5741				    2>/dev/null && \
5742				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5743				    < tmp.imp >>libc.tmp
5744				$rm tmp.imp
5745			done
5746			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5747			echo "Ok." >&4
5748		else
5749			echo "$ar didn't seem to work right." >&4
5750			echo "Maybe this is a Cray...trying bld instead..." >&4
5751			if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5752			then
5753				for thisname in $libnames; do
5754					bld t $libnames | \
5755					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5756					$ar t $thisname >>libc.tmp
5757				done
5758				echo "Ok." >&4
5759			else
5760				echo "That didn't work either.  Giving up." >&4
5761				exit 1
5762			fi
5763		fi
5764	fi
5765fi
5766nm_extract="$com"
5767if $test -f /lib/syscalls.exp; then
5768	echo " "
5769	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5770	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' /lib/syscalls.exp >>libc.list
5771fi
5772;;
5773esac
5774$rm -f libnames libpath
5775
5776: is a C symbol defined?
5777csym='tlook=$1;
5778case "$3" in
5779-v) tf=libc.tmp; tc=""; tdc="";;
5780-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5781*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5782esac;
5783tx=yes;
5784case "$reuseval-$4" in
5785true-) ;;
5786true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5787esac;
5788case "$tx" in
5789yes)
5790	case "$runnm" in
5791	true)
5792		if $contains $tlook $tf >/dev/null 2>&1;
5793		then tval=true;
5794		else tval=false;
5795		fi;;
5796	*)
5797		echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5798		if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5799		then tval=true;
5800		else tval=false;
5801		fi;
5802		$rm -f t t.c;;
5803	esac;;
5804*)
5805	case "$tval" in
5806	$define) tval=true;;
5807	*) tval=false;;
5808	esac;;
5809esac;
5810eval "$2=$tval"'
5811
5812: define an is-in-libc? function
5813inlibc='echo " "; td=$define; tu=$undef;
5814sym=$1; var=$2; eval "was=\$$2";
5815tx=yes;
5816case "$reuseval$was" in
5817true) ;;
5818true*) tx=no;;
5819esac;
5820case "$tx" in
5821yes)
5822	set $sym tres -f;
5823	eval $csym;
5824	case "$tres" in
5825	true)
5826		echo "$sym() found." >&4;
5827		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5828	*)
5829		echo "$sym() NOT found." >&4;
5830		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5831	esac;;
5832*)
5833	case "$was" in
5834	$define) echo "$sym() found." >&4;;
5835	*) echo "$sym() NOT found." >&4;;
5836	esac;;
5837esac'
5838
5839: see if sqrtl exists
5840set sqrtl d_sqrtl
5841eval $inlibc
5842
5843: check for length of double
5844echo " "
5845case "$doublesize" in
5846'')
5847	echo "Checking to see how big your double precision numbers are..." >&4
5848	$cat >try.c <<'EOCP'
5849#include <stdio.h>
5850int main()
5851{
5852    printf("%d\n", (int)sizeof(double));
5853    exit(0);
5854}
5855EOCP
5856	set try
5857	if eval $compile_ok; then
5858		doublesize=`$run ./try`
5859		echo "Your double is $doublesize bytes long."
5860	else
5861		dflt='8'
5862		echo "(I can't seem to compile the test program.  Guessing...)"
5863		rp="What is the size of a double precision number (in bytes)?"
5864		. ./myread
5865		doublesize="$ans"
5866	fi
5867	;;
5868esac
5869$rm -f try.c try
5870
5871: check for long doubles
5872echo " "
5873echo "Checking to see if you have long double..." >&4
5874echo 'int main() { long double x = 7.0; }' > try.c
5875set try
5876if eval $compile; then
5877	val="$define"
5878	echo "You have long double."
5879else
5880	val="$undef"
5881	echo "You do not have long double."
5882fi
5883$rm try.*
5884set d_longdbl
5885eval $setvar
5886
5887: check for length of long double
5888case "${d_longdbl}${longdblsize}" in
5889$define)
5890	echo " "
5891	echo "Checking to see how big your long doubles are..." >&4
5892	$cat >try.c <<'EOCP'
5893#include <stdio.h>
5894int main()
5895{
5896	printf("%d\n", sizeof(long double));
5897}
5898EOCP
5899	set try
5900	set try
5901	if eval $compile; then
5902		longdblsize=`$run ./try`
5903		echo "Your long doubles are $longdblsize bytes long."
5904	else
5905		dflt='8'
5906		echo " "
5907		echo "(I can't seem to compile the test program.  Guessing...)" >&4
5908		rp="What is the size of a long double (in bytes)?"
5909		. ./myread
5910		longdblsize="$ans"
5911	fi
5912	if $test "X$doublesize" = "X$longdblsize"; then
5913		echo "(That isn't any different from an ordinary double.)"
5914	fi
5915	;;
5916esac
5917$rm -f try.* try
5918
5919echo " "
5920
5921if $test X"$d_longdbl" = X"$define"; then
5922
5923echo "Checking how to print long doubles..." >&4
5924
5925if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5926	$cat >try.c <<'EOCP'
5927#include <sys/types.h>
5928#include <stdio.h>
5929int main() {
5930  double d = 123.456;
5931  printf("%.3f\n", d);
5932}
5933EOCP
5934	set try
5935	if eval $compile; then
5936		yyy=`$run ./try`
5937		case "$yyy" in
5938		123.456)
5939			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5940                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5941			echo "We will use %f."
5942			;;
5943		esac
5944	fi
5945fi
5946
5947if $test X"$sPRIfldbl" = X; then
5948	$cat >try.c <<'EOCP'
5949#include <sys/types.h>
5950#include <stdio.h>
5951int main() {
5952  long double d = 123.456;
5953  printf("%.3Lf\n", d);
5954}
5955EOCP
5956	set try
5957	if eval $compile; then
5958		yyy=`$run ./try`
5959		case "$yyy" in
5960		123.456)
5961			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5962                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5963			echo "We will use %Lf."
5964			;;
5965		esac
5966	fi
5967fi
5968
5969if $test X"$sPRIfldbl" = X; then
5970	$cat >try.c <<'EOCP'
5971#include <sys/types.h>
5972#include <stdio.h>
5973int main() {
5974  long double d = 123.456;
5975  printf("%.3llf\n", d);
5976}
5977EOCP
5978	set try
5979	if eval $compile; then
5980		yyy=`$run ./try`
5981		case "$yyy" in
5982		123.456)
5983			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5984                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5985			echo "We will use %llf."
5986			;;
5987		esac
5988	fi
5989fi
5990
5991if $test X"$sPRIfldbl" = X; then
5992	$cat >try.c <<'EOCP'
5993#include <sys/types.h>
5994#include <stdio.h>
5995int main() {
5996  long double d = 123.456;
5997  printf("%.3lf\n", d);
5998}
5999EOCP
6000	set try
6001	if eval $compile; then
6002		yyy=`$run ./try`
6003		case "$yyy" in
6004		123.456)
6005			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6006                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6007			echo "We will use %lf."
6008			;;
6009		esac
6010	fi
6011fi
6012
6013if $test X"$sPRIfldbl" = X; then
6014	echo "Cannot figure out how to print long doubles." >&4
6015else
6016	sSCNfldbl=$sPRIfldbl	# expect consistency
6017fi
6018
6019$rm -f try try.*
6020
6021fi # d_longdbl
6022
6023case "$sPRIfldbl" in
6024'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
6025	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
6026	d_SCNfldbl="$undef";
6027	;;
6028*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
6029	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
6030	d_SCNfldbl="$define";
6031	;;
6032esac
6033
6034: see if modfl exists
6035set modfl d_modfl
6036eval $inlibc
6037
6038d_modfl_pow32_bug="$undef"
6039
6040case "$d_longdbl$d_modfl" in
6041$define$define)
6042	$cat <<EOM
6043Checking to see whether your modfl() is okay for large values...
6044EOM
6045$cat >try.c <<EOCP
6046#include <math.h> 
6047#include <stdio.h>
6048int main() {
6049    long double nv = 4294967303.15;
6050    long double v, w;
6051    v = modfl(nv, &w);         
6052#ifdef __GLIBC__
6053    printf("glibc");
6054#endif
6055    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6056    return 0;
6057}
6058EOCP
6059	case "$osname:$gccversion" in
6060	aix:)	saveccflags="$ccflags"
6061		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6062	esac
6063	set try
6064	if eval $compile; then
6065		foo=`$run ./try`
6066		case "$foo" in
6067		*" 4294967303.150000 1.150000 4294967302.000000")
6068			echo >&4 "Your modfl() is broken for large values."
6069			d_modfl_pow32_bug="$define"
6070			case "$foo" in
6071			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6072			;;
6073			esac
6074			;;
6075		*" 4294967303.150000 0.150000 4294967303.000000")
6076			echo >&4 "Your modfl() seems okay for large values."
6077			;;
6078		*)	echo >&4 "I don't understand your modfl() at all."
6079			d_modfl="$undef"
6080			;;
6081		esac
6082		$rm -f try.* try core core.try.*
6083	else
6084		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6085		d_modfl="$undef"
6086	fi
6087	case "$osname:$gccversion" in
6088	aix:)	ccflags="$saveccflags" ;; # restore
6089	esac
6090	;;
6091esac
6092
6093case "$ccflags" in
6094*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6095esac
6096
6097case "$uselongdouble" in
6098$define|true|[yY]*)	dflt='y';;
6099*) dflt='n';;
6100esac
6101cat <<EOM
6102
6103Perl can be built to take advantage of long doubles which
6104(if available) may give more accuracy and range for floating point numbers.
6105
6106If this doesn't make any sense to you, just accept the default '$dflt'.
6107EOM
6108rp='Try to use long doubles if available?'
6109. ./myread
6110case "$ans" in
6111y|Y) 	val="$define"	;;
6112*)      val="$undef"	;;
6113esac
6114set uselongdouble
6115eval $setvar
6116
6117case "$uselongdouble" in
6118true|[yY]*) uselongdouble="$define" ;;
6119esac
6120
6121case "$uselongdouble" in
6122$define)
6123: Look for a hint-file generated 'call-back-unit'.  If the
6124: user has specified that long doubles should be used,
6125: we may need to set or change some other defaults.
6126	if $test -f uselongdouble.cbu; then
6127		echo "Your platform has some specific hints for long doubles, using them..."
6128		. ./uselongdouble.cbu
6129	else
6130		$cat <<EOM
6131(Your platform doesn't have any specific hints for long doubles.)
6132EOM
6133	fi
6134	;;
6135esac
6136
6137message=X
6138case "$uselongdouble:$d_sqrtl:$d_modfl" in
6139$define:$define:$define)
6140	: You have both
6141	;;
6142$define:$define:$undef)
6143	message="I could not find modfl"
6144	;;
6145$define:$undef:$define)
6146	message="I could not find sqrtl"
6147	;;
6148$define:$undef:$undef)
6149	message="I found neither sqrtl nor modfl"
6150	;;
6151esac
6152
6153if $test "$message" != X; then
6154	$cat <<EOM >&4
6155
6156*** You requested the use of long doubles but you do not seem to have
6157*** the mathematic functions for long doubles.
6158*** ($message)
6159*** I'm disabling the use of long doubles.
6160
6161EOM
6162
6163	uselongdouble=$undef
6164fi
6165
6166: determine the architecture name
6167echo " "
6168if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6169	tarch=`arch`"-$osname"
6170elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6171	if uname -m > tmparch 2>&1 ; then
6172		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6173			-e 's/$/'"-$osname/" tmparch`
6174	else
6175		tarch="$osname"
6176	fi
6177	$rm -f tmparch
6178else
6179	tarch="$osname"
6180fi
6181case "$myarchname" in
6182''|"$tarch") ;;
6183*)
6184	echo "(Your architecture name used to be $myarchname.)"
6185	archname=''
6186	;;
6187esac
6188case "$targetarch" in
6189'') ;;
6190*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6191esac
6192myarchname="$tarch"
6193case "$archname" in
6194'') dflt="$tarch";;
6195*) dflt="$archname";;
6196esac
6197rp='What is your architecture name'
6198. ./myread
6199archname="$ans"
6200case "$usethreads" in
6201$define)
6202	echo "Threads selected." >&4
6203	case "$archname" in
6204        *-thread*) echo "...and architecture name already has -thread." >&4
6205                ;;
6206        *)      archname="$archname-thread"
6207                echo "...setting architecture name to $archname." >&4
6208                ;;
6209        esac
6210	;;
6211esac
6212case "$usemultiplicity" in
6213$define)
6214	echo "Multiplicity selected." >&4
6215	case "$archname" in
6216        *-multi*) echo "...and architecture name already has -multi." >&4
6217                ;;
6218        *)      archname="$archname-multi"
6219                echo "...setting architecture name to $archname." >&4
6220                ;;
6221        esac
6222	;;
6223esac
6224case "$use64bitint$use64bitall" in
6225*"$define"*)
6226	case "$archname64" in
6227	'')
6228		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6229		;;
6230	*)
6231		case "$use64bitint" in
6232		"$define") echo "64 bit integers selected." >&4 ;;
6233		esac
6234		case "$use64bitall" in
6235		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6236		esac
6237		case "$archname" in
6238	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6239	                ;;
6240	        *)      archname="$archname-$archname64"
6241	                echo "...setting architecture name to $archname." >&4
6242	                ;;
6243	        esac
6244		;;
6245	esac
6246esac
6247case "$uselongdouble" in
6248$define)
6249	echo "Long doubles selected." >&4
6250	case "$longdblsize" in
6251	$doublesize)
6252		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6253		;;
6254	*)
6255		case "$archname" in
6256	        *-ld*) echo "...and architecture name already has -ld." >&4
6257	                ;;
6258	        *)      archname="$archname-ld"
6259	                echo "...setting architecture name to $archname." >&4
6260        	        ;;
6261	        esac
6262		;;
6263	esac
6264	;;
6265esac
6266case "$useperlio" in
6267$define)
6268	echo "Perlio selected." >&4
6269	;;
6270*)
6271	echo "Perlio not selected, using stdio." >&4
6272	case "$archname" in
6273        *-stdio*) echo "...and architecture name already has -stdio." >&4
6274                ;;
6275        *)      archname="$archname-stdio"
6276                echo "...setting architecture name to $archname." >&4
6277                ;;
6278        esac
6279	;;
6280esac
6281
6282: determine root of directory hierarchy where package will be installed.
6283case "$prefix" in
6284'')
6285	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6286	;;
6287*)
6288	dflt="$prefix"
6289	;;
6290esac
6291$cat <<EOM
6292
6293By default, $package will be installed in $dflt/bin, manual pages
6294under $dflt/man, etc..., i.e. with $dflt as prefix for all
6295installation directories. Typically this is something like /usr/local.
6296If you wish to have binaries under /usr/bin but other parts of the
6297installation under /usr/local, that's ok: you will be prompted
6298separately for each of the installation directories, the prefix being
6299only used to set the defaults.
6300
6301EOM
6302fn=d~
6303rp='Installation prefix to use?'
6304. ./getfile
6305oldprefix=''
6306case "$prefix" in
6307'') ;;
6308*)
6309	case "$ans" in
6310	"$prefix") ;;
6311	*) oldprefix="$prefix";;
6312	esac
6313	;;
6314esac
6315prefix="$ans"
6316prefixexp="$ansexp"
6317
6318case "$afsroot" in
6319'')	afsroot=/afs ;;
6320*)	afsroot=$afsroot ;;
6321esac
6322
6323: is AFS running?
6324echo " "
6325case "$afs" in
6326$define|true)	afs=true ;;
6327$undef|false)	afs=false ;;
6328*)	if test -d $afsroot; then
6329		afs=true
6330	else
6331		afs=false
6332	fi
6333	;;
6334esac
6335if test $afs = "true"; then
6336	echo "AFS may be running... I'll be extra cautious then..." >&4
6337else
6338	echo "AFS does not seem to be running..." >&4
6339fi
6340
6341: determine installation prefix for where package is to be installed.
6342if $afs; then
6343$cat <<EOM
6344
6345Since you are running AFS, I need to distinguish the directory in which
6346files will reside from the directory in which they are installed (and from
6347which they are presumably copied to the former directory by occult means).
6348
6349EOM
6350	case "$installprefix" in
6351	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6352	*) dflt="$installprefix";;
6353	esac
6354else
6355$cat <<EOM
6356
6357In some special cases, particularly when building $package for distribution,
6358it is convenient to distinguish between the directory in which files should 
6359be installed from the directory ($prefix) in which they 
6360will eventually reside.  For most users, these two directories are the same.
6361
6362EOM
6363	case "$installprefix" in
6364	'') dflt=$prefix ;;
6365	*) dflt=$installprefix;;
6366	esac
6367fi
6368fn=d~
6369rp='What installation prefix should I use for installing files?'
6370. ./getfile
6371installprefix="$ans"
6372installprefixexp="$ansexp"
6373
6374: set the prefixit variable, to compute a suitable default value
6375prefixit='case "$3" in
6376""|none)
6377	case "$oldprefix" in
6378	"") eval "$1=\"\$$2\"";;
6379	*)
6380		case "$3" in
6381		"") eval "$1=";;
6382		none)
6383			eval "tp=\"\$$2\"";
6384			case "$tp" in
6385			""|" ") eval "$1=\"\$$2\"";;
6386			*) eval "$1=";;
6387			esac;;
6388		esac;;
6389	esac;;
6390*)
6391	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6392	case "$tp" in
6393	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6394	/*-$oldprefix/*|\~*-$oldprefix/*)
6395		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6396	*) eval "$1=\"\$$2\"";;
6397	esac;;
6398esac'
6399
6400: get the patchlevel
6401echo " "
6402echo "Getting the current patchlevel..." >&4
6403if $test -r $rsrc/patchlevel.h;then
6404	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6405	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6406	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6407	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6408	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6409	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6410       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6411else
6412	revision=0
6413	patchlevel=0
6414	subversion=0
6415	api_revision=0
6416	api_version=0
6417	api_subversion=0
6418	perl_patchlevel=0
6419	$echo "(You do not have patchlevel.h.  Eek.)"
6420fi
6421if $test -r $rsrc/.patch ; then
6422	if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6423		perl_patchlevel=`cat $rsrc/.patch`
6424	fi
6425fi
6426: Define a handy string here to avoid duplication in myconfig.SH and configpm.
6427version_patchlevel_string="version $patchlevel subversion $subversion"
6428case "$perl_patchlevel" in
64290|'') ;;
6430*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6431esac
6432
6433$echo "(You have $package $version_patchlevel_string.)"
6434
6435case "$osname" in
6436dos|vms)
6437	: XXX Should be a Configure test for double-dots in filenames.
6438	version=`echo $revision $patchlevel $subversion | \
6439		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6440	api_versionstring=`echo $api_revision $api_version $api_subversion | \
6441		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6442	;;
6443*)
6444	version=`echo $revision $patchlevel $subversion | \
6445		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6446	api_versionstring=`echo $api_revision $api_version $api_subversion | \
6447		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6448	;;
6449esac
6450: Special case the 5.005_xx maintenance series, which used 5.005
6451: without any subversion label as a subdirectory in $sitelib
6452if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6453	api_versionstring='5.005'
6454fi
6455
6456: determine installation style
6457: For now, try to deduce it from prefix unless it is already set.
6458: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6459case "$installstyle" in
6460'')	case "$prefix" in
6461		*perl*) dflt='lib';;
6462		*) dflt='lib/perl5' ;;
6463	esac
6464	;;
6465*)	dflt="$installstyle" ;;
6466esac
6467: Probably not worth prompting for this since we prompt for all
6468: the directories individually, and the prompt would be too long and
6469: confusing anyway.
6470installstyle=$dflt
6471
6472: determine where private library files go
6473: Usual default is /usr/local/lib/perl5/$version.
6474: Also allow things like /opt/perl/lib/$version, since
6475: /opt/perl/lib/perl5... would be redundant.
6476: The default "style" setting is made in installstyle.U
6477case "$installstyle" in
6478*lib/perl5*) set dflt privlib lib/$package/$version ;;
6479*)	 set dflt privlib lib/$version ;;
6480esac
6481eval $prefixit
6482$cat <<EOM
6483
6484There are some auxiliary files for $package that need to be put into a
6485private library directory that is accessible by everyone.
6486
6487EOM
6488fn=d~+
6489rp='Pathname where the private library files will reside?'
6490. ./getfile
6491privlib="$ans"
6492privlibexp="$ansexp"
6493: Change installation prefix, if necessary.
6494if $test X"$prefix" != X"$installprefix"; then
6495	installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6496else
6497	installprivlib="$privlibexp"
6498fi
6499
6500: set the prefixup variable, to restore leading tilda escape
6501prefixup='case "$prefixexp" in
6502"$prefix") ;;
6503*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6504esac'
6505
6506: determine where public architecture dependent libraries go
6507set archlib archlib
6508eval $prefixit
6509: privlib default is /usr/local/lib/$package/$version
6510: archlib default is /usr/local/lib/$package/$version/$archname
6511: privlib may have an optional trailing /share.
6512tdflt=`echo $privlib | $sed 's,/share$,,'`
6513tdflt=$tdflt/$archname
6514case "$archlib" in
6515'')	dflt=$tdflt
6516	;;
6517*)	dflt="$archlib"
6518    ;;
6519esac
6520$cat <<EOM
6521
6522$spackage contains architecture-dependent library files.  If you are
6523sharing libraries in a heterogeneous environment, you might store
6524these files in a separate location.  Otherwise, you can just include
6525them with the rest of the public library files.
6526
6527EOM
6528fn=d+~
6529rp='Where do you want to put the public architecture-dependent libraries?'
6530. ./getfile
6531archlib="$ans"
6532archlibexp="$ansexp"
6533if $test X"$archlib" = X"$privlib"; then
6534	d_archlib="$undef"
6535else
6536	d_archlib="$define"
6537fi
6538: Change installation prefix, if necessary.
6539if $test X"$prefix" != X"$installprefix"; then
6540	installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6541else
6542	installarchlib="$archlibexp"
6543fi
6544
6545: see if setuid scripts can be secure
6546$cat <<EOM
6547
6548Some kernels have a bug that prevents setuid #! scripts from being
6549secure.  Some sites have disabled setuid #! scripts because of this.
6550
6551First let's decide if your kernel supports secure setuid #! scripts.
6552(If setuid #! scripts would be secure but have been disabled anyway,
6553don't say that they are secure if asked.)
6554
6555EOM
6556
6557val="$undef"
6558if $test -d /dev/fd; then
6559	echo "#!$ls" >reflect
6560	chmod +x,u+s reflect
6561	./reflect >flect 2>&1
6562	if $contains "/dev/fd" flect >/dev/null; then
6563		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6564		val="$define"
6565	else
6566		$cat <<EOM
6567If you are not sure if they are secure, I can check but I'll need a
6568username and password different from the one you are using right now.
6569If you don't have such a username or don't want me to test, simply
6570enter 'none'.
6571
6572EOM
6573		rp='Other username to test security of setuid scripts with?'
6574		dflt='none'
6575		. ./myread
6576		case "$ans" in
6577		n|none)
6578			case "$d_suidsafe" in
6579			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6580				dflt=n;;
6581			"$undef")
6582				echo "Well, the $hint value is *not* secure." >&4
6583				dflt=n;;
6584			*)	echo "Well, the $hint value *is* secure." >&4
6585				dflt=y;;
6586			esac
6587			;;
6588		*)
6589			$rm -f reflect flect
6590			echo "#!$ls" >reflect
6591			chmod +x,u+s reflect
6592			echo >flect
6593			chmod a+w flect
6594			echo '"su" will (probably) prompt you for '"$ans's password."
6595			su $ans -c './reflect >flect'
6596			if $contains "/dev/fd" flect >/dev/null; then
6597				echo "Okay, it looks like setuid scripts are secure." >&4
6598				dflt=y
6599			else
6600				echo "I don't think setuid scripts are secure." >&4
6601				dflt=n
6602			fi
6603			;;
6604		esac
6605		rp='Does your kernel have *secure* setuid scripts?'
6606		. ./myread
6607		case "$ans" in
6608		[yY]*)	val="$define";;
6609		*)	val="$undef";;
6610		esac
6611	fi
6612else
6613	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6614	echo "(That's for file descriptors, not floppy disks.)"
6615	val="$undef"
6616fi
6617set d_suidsafe
6618eval $setvar
6619
6620$rm -f reflect flect
6621
6622: now see if they want to do setuid emulation
6623echo " "
6624val="$undef"
6625case "$d_suidsafe" in
6626"$define")
6627	val="$undef"
6628	echo "No need to emulate SUID scripts since they are secure here." >&4
6629	;;
6630*)
6631	$cat <<EOM
6632Some systems have disabled setuid scripts, especially systems where
6633setuid scripts cannot be secure.  On systems where setuid scripts have
6634been disabled, the setuid/setgid bits on scripts are currently
6635useless.  It is possible for $package to detect those bits and emulate
6636setuid/setgid in a secure fashion.  This emulation will only work if
6637setuid scripts have been disabled in your kernel.
6638
6639EOM
6640	case "$d_dosuid" in
6641	"$define") dflt=y ;;
6642	*) dflt=n ;;
6643	esac
6644	rp="Do you want to do setuid/setgid emulation?"
6645	. ./myread
6646	case "$ans" in
6647	[yY]*)	val="$define";;
6648	*)	val="$undef";;
6649	esac
6650	;;
6651esac
6652set d_dosuid
6653eval $setvar
6654
6655: see if this is a malloc.h system
6656set malloc.h i_malloc
6657eval $inhdr
6658
6659: see if stdlib is available
6660set stdlib.h i_stdlib
6661eval $inhdr
6662
6663: check for void type
6664echo " "
6665echo "Checking to see how well your C compiler groks the void type..." >&4
6666case "$voidflags" in
6667'')
6668	$cat >try.c <<'EOCP'
6669#if TRY & 1
6670void sub() {
6671#else
6672sub() {
6673#endif
6674	extern void moo();	/* function returning void */
6675	void (*goo)();		/* ptr to func returning void */
6676#if TRY & 8
6677	void *hue;		/* generic ptr */
6678#endif
6679#if TRY & 2
6680	void (*foo[10])();
6681#endif
6682
6683#if TRY & 4
6684	if(goo == moo) {
6685		exit(0);
6686	}
6687#endif
6688	exit(0);
6689}
6690int main() { sub(); }
6691EOCP
6692	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6693		voidflags=$defvoidused
6694	echo "Good.  It appears to support void to the level $package wants.">&4
6695		if $contains warning .out >/dev/null 2>&1; then
6696			echo "However, you might get some warnings that look like this:"
6697			$cat .out
6698		fi
6699	else
6700echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6701		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6702			echo "It supports 1..."
6703			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6704				echo "It also supports 2..."
6705				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6706					voidflags=7
6707					echo "And it supports 4 but not 8 definitely."
6708				else
6709					echo "It doesn't support 4..."
6710					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6711						voidflags=11
6712						echo "But it supports 8."
6713					else
6714						voidflags=3
6715						echo "Neither does it support 8."
6716					fi
6717				fi
6718			else
6719				echo "It does not support 2..."
6720				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6721					voidflags=13
6722					echo "But it supports 4 and 8."
6723				else
6724					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6725						voidflags=5
6726						echo "And it supports 4 but has not heard about 8."
6727					else
6728						echo "However it supports 8 but not 4."
6729					fi
6730				fi
6731			fi
6732		else
6733			echo "There is no support at all for void."
6734			voidflags=0
6735		fi
6736	fi
6737esac
6738case "$voidflags" in
6739"$defvoidused") ;;
6740*)	$cat >&4 <<'EOM'
6741  Support flag bits are:
6742    1: basic void declarations.
6743    2: arrays of pointers to functions returning void.
6744    4: operations between pointers to and addresses of void functions.
6745    8: generic void pointers.
6746EOM
6747	dflt="$voidflags";
6748	rp="Your void support flags add up to what?"
6749	. ./myread
6750	voidflags="$ans"
6751	;;
6752esac
6753$rm -f try.* .out
6754
6755: check for length of pointer
6756echo " "
6757case "$ptrsize" in
6758'')
6759	echo "Checking to see how big your pointers are..." >&4
6760	if test "$voidflags" -gt 7; then
6761		echo '#define VOID_PTR char *' > try.c
6762	else
6763		echo '#define VOID_PTR void *' > try.c
6764	fi
6765	$cat >>try.c <<'EOCP'
6766#include <stdio.h>
6767int main()
6768{
6769    printf("%d\n", (int)sizeof(VOID_PTR));
6770    exit(0);
6771}
6772EOCP
6773	set try
6774	if eval $compile_ok; then
6775		ptrsize=`$run ./try`
6776		echo "Your pointers are $ptrsize bytes long."
6777	else
6778		dflt='4'
6779		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6780		rp="What is the size of a pointer (in bytes)?"
6781		. ./myread
6782		ptrsize="$ans"
6783	fi
6784	;;
6785esac
6786$rm -f try.c try
6787case "$use64bitall" in
6788"$define"|true|[yY]*)
6789	case "$ptrsize" in
6790	4)	cat <<EOM >&4
6791
6792*** You have chosen a maximally 64-bit build, but your pointers
6793*** are only 4 bytes wide, disabling maximal 64-bitness.
6794
6795EOM
6796		use64bitall="$undef"
6797		case "$use64bitint" in
6798		"$define"|true|[yY]*) ;;
6799		*)	cat <<EOM >&4
6800
6801*** Downgrading from maximal 64-bitness to using 64-bit integers.
6802
6803EOM
6804			use64bitint="$define"
6805			;;
6806		esac
6807		;;
6808	esac
6809	;;
6810esac
6811
6812
6813: determine which malloc to compile in
6814echo " "
6815case "$usemymalloc" in
6816[yY]*|true|$define)	dflt='y' ;;
6817[nN]*|false|$undef)	dflt='n' ;;
6818*)	case "$ptrsize" in
6819	4) dflt='y' ;;
6820	*) dflt='n' ;;
6821	esac
6822	;;
6823esac
6824rp="Do you wish to attempt to use the malloc that comes with $package?"
6825. ./myread
6826usemymalloc="$ans"
6827case "$ans" in
6828y*|true)
6829	usemymalloc='y'
6830	mallocsrc='malloc.c'
6831	mallocobj="malloc$_o"
6832	d_mymalloc="$define"
6833	case "$libs" in
6834	*-lmalloc*)
6835		: Remove malloc from list of libraries to use
6836		echo "Removing unneeded -lmalloc from library list" >&4
6837		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6838		shift
6839		libs="$*"
6840		echo "libs = $libs" >&4
6841		;;
6842	esac
6843	;;
6844*)
6845	usemymalloc='n'
6846	mallocsrc=''
6847	mallocobj=''
6848	d_mymalloc="$undef"
6849	;;
6850esac
6851
6852: compute the return types of malloc and free
6853echo " "
6854$cat >malloc.c <<END
6855#$i_malloc I_MALLOC
6856#$i_stdlib I_STDLIB
6857#include <stdio.h>
6858#include <sys/types.h>
6859#ifdef I_MALLOC
6860#include <malloc.h>
6861#endif
6862#ifdef I_STDLIB
6863#include <stdlib.h>
6864#endif
6865#ifdef TRY_MALLOC
6866void *malloc();
6867#endif
6868#ifdef TRY_FREE
6869void free();
6870#endif
6871END
6872case "$malloctype" in
6873'')
6874	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6875		malloctype='void *'
6876	else
6877		malloctype='char *'
6878	fi
6879	;;
6880esac
6881echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6882
6883case "$freetype" in
6884'')
6885	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6886		freetype='void'
6887	else
6888		freetype='int'
6889	fi
6890	;;
6891esac
6892echo "Your system uses $freetype free(), it would seem." >&4
6893$rm -f malloc.[co]
6894$cat <<EOM
6895
6896After $package is installed, you may wish to install various
6897add-on modules and utilities.  Typically, these add-ons will
6898be installed under $prefix with the rest
6899of this package.  However, you may wish to install such add-ons
6900elsewhere under a different prefix.
6901
6902If you do not wish to put everything under a single prefix, that's
6903ok.  You will be prompted for the individual locations; this siteprefix
6904is only used to suggest the defaults.
6905
6906The default should be fine for most people.
6907
6908EOM
6909fn=d~+
6910rp='Installation prefix to use for add-on modules and utilities?'
6911: XXX Here might be another good place for an installstyle setting.
6912case "$siteprefix" in
6913'') dflt=$prefix ;;
6914*)  dflt=$siteprefix ;;
6915esac
6916. ./getfile
6917: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6918oldsiteprefix=''
6919case "$siteprefix" in
6920'') ;;
6921*)	case "$ans" in
6922	"$prefix") ;;
6923	*) oldsiteprefix="$prefix";;
6924	esac
6925	;;
6926esac
6927siteprefix="$ans"
6928siteprefixexp="$ansexp"
6929
6930: determine where site specific libraries go.
6931: Usual default is /usr/local/lib/perl5/site_perl/$version
6932: The default "style" setting is made in installstyle.U
6933: XXX No longer works with Prefixit stuff.
6934prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6935case "$sitelib" in
6936'') case "$installstyle" in
6937	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6938	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6939	esac
6940	;;
6941*)	dflt="$sitelib"
6942	;;
6943esac
6944$cat <<EOM
6945
6946The installation process will create a directory for
6947site-specific extensions and modules.  Most users find it convenient
6948to place all site-specific files in this directory rather than in the
6949main distribution directory.
6950
6951EOM
6952fn=d~+
6953rp='Pathname for the site-specific library files?'
6954. ./getfile
6955sitelib="$ans"
6956sitelibexp="$ansexp"
6957sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6958: Change installation prefix, if necessary.
6959if $test X"$prefix" != X"$installprefix"; then
6960	installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6961else
6962	installsitelib="$sitelibexp"
6963fi
6964
6965: determine where site specific architecture-dependent libraries go.
6966: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6967: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6968: sitelib may have an optional trailing /share.
6969case "$sitearch" in
6970'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6971	dflt="$dflt/$archname"
6972	;;
6973*)	dflt="$sitearch"
6974	;;
6975esac
6976set sitearch sitearch none
6977eval $prefixit
6978$cat <<EOM
6979
6980The installation process will also create a directory for
6981architecture-dependent site-specific extensions and modules.
6982
6983EOM
6984fn=d~+
6985rp='Pathname for the site-specific architecture-dependent library files?'
6986. ./getfile
6987sitearch="$ans"
6988sitearchexp="$ansexp"
6989: Change installation prefix, if necessary.
6990if $test X"$prefix" != X"$installprefix"; then
6991	installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6992else
6993	installsitearch="$sitearchexp"
6994fi
6995
6996$cat <<EOM
6997
6998The installation process will also create a directory for
6999vendor-supplied add-ons.  Vendors who supply perl with their system
7000may find it convenient to place all vendor-supplied files in this
7001directory rather than in the main distribution directory.  This will
7002ease upgrades between binary-compatible maintenance versions of perl.
7003
7004Of course you may also use these directories in whatever way you see
7005fit.  For example, you might use them to access modules shared over a
7006company-wide network.
7007
7008The default answer should be fine for most people.
7009This causes further questions about vendor add-ons to be skipped
7010and no vendor-specific directories will be configured for perl.
7011
7012EOM
7013rp='Do you want to configure vendor-specific add-on directories?'
7014case "$usevendorprefix" in
7015define|true|[yY]*) dflt=y ;;
7016*)	: User may have set vendorprefix directly on Configure command line.
7017	case "$vendorprefix" in
7018	''|' ') dflt=n ;;
7019	*)	dflt=y ;;
7020	esac
7021	;;
7022esac
7023. ./myread
7024case "$ans" in
7025[yY]*)	fn=d~+
7026	rp='Installation prefix to use for vendor-supplied add-ons?'
7027	case "$vendorprefix" in
7028	'') dflt='' ;;
7029	*)  dflt=$vendorprefix ;;
7030	esac
7031	. ./getfile
7032	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7033	oldvendorprefix=''
7034	case "$vendorprefix" in
7035	'') ;;
7036	*)	case "$ans" in
7037		"$prefix") ;;
7038		*) oldvendorprefix="$prefix";;
7039		esac
7040		;;
7041	esac
7042	usevendorprefix="$define"
7043	vendorprefix="$ans"
7044	vendorprefixexp="$ansexp"
7045	;;
7046*)	usevendorprefix="$undef"
7047	vendorprefix=''
7048	vendorprefixexp=''
7049	;;
7050esac
7051
7052case "$vendorprefix" in
7053'')	d_vendorlib="$undef"
7054	vendorlib=''
7055	vendorlibexp=''
7056	;;
7057*)	d_vendorlib="$define"
7058	: determine where vendor-supplied modules go.
7059	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
7060	case "$vendorlib" in
7061	'')
7062		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7063		case "$installstyle" in
7064		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7065		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7066		esac
7067		;;
7068	*)	dflt="$vendorlib"
7069		;;
7070	esac
7071	fn=d~+
7072	rp='Pathname for the vendor-supplied library files?'
7073	. ./getfile
7074	vendorlib="$ans"
7075	vendorlibexp="$ansexp"
7076	;;
7077esac
7078vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7079: Change installation prefix, if necessary.
7080if $test X"$prefix" != X"$installprefix"; then
7081	installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7082else
7083	installvendorlib="$vendorlibexp"
7084fi
7085
7086case "$vendorprefix" in
7087'')	d_vendorarch="$undef"
7088	vendorarch=''
7089	vendorarchexp=''
7090	;;
7091*)	d_vendorarch="$define"
7092	: determine where vendor-supplied architecture-dependent libraries go.
7093	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7094	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7095	: vendorlib may have an optional trailing /share.
7096	case "$vendorarch" in
7097	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
7098		dflt="$dflt/$archname"
7099		;;
7100	*)	dflt="$vendorarch" ;;
7101	esac
7102	fn=d~+
7103	rp='Pathname for vendor-supplied architecture-dependent files?'
7104	. ./getfile
7105	vendorarch="$ans"
7106	vendorarchexp="$ansexp"
7107	;;
7108esac
7109: Change installation prefix, if necessary.
7110if $test X"$prefix" != X"$installprefix"; then
7111	installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7112else
7113	installvendorarch="$vendorarchexp"
7114fi
7115
7116: Final catch-all directories to search
7117$cat <<EOM
7118
7119Lastly, you can have perl look in other directories for extensions and
7120modules in addition to those already specified.
7121These directories will be searched after 
7122	$sitearch 
7123	$sitelib 
7124EOM
7125test X"$vendorlib" != "X" && echo '	' $vendorlib
7126test X"$vendorarch" != "X" && echo '	' $vendorarch
7127echo ' '
7128case "$otherlibdirs" in
7129''|' ') dflt='none' ;;
7130*)	dflt="$otherlibdirs" ;;
7131esac
7132$cat <<EOM
7133Enter a colon-separated set of extra paths to include in perl's @INC
7134search path, or enter 'none' for no extra paths.
7135
7136EOM
7137
7138rp='Colon-separated list of additional directories for perl to search?'
7139. ./myread
7140case "$ans" in
7141' '|''|none)	otherlibdirs=' ' ;;
7142*)	otherlibdirs="$ans" ;;
7143esac
7144case "$otherlibdirs" in
7145' ') val=$undef ;;
7146*)	val=$define ;;
7147esac
7148set d_perl_otherlibdirs
7149eval $setvar
7150
7151: Cruising for prototypes
7152echo " "
7153echo "Checking out function prototypes..." >&4
7154$cat >prototype.c <<'EOCP'
7155int main(int argc, char *argv[]) {
7156	exit(0);}
7157EOCP
7158if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7159	echo "Your C compiler appears to support function prototypes."
7160	val="$define"
7161else
7162	echo "Your C compiler doesn't seem to understand function prototypes."
7163	val="$undef"
7164fi
7165set prototype
7166eval $setvar
7167$rm -f prototype*
7168
7169case "$prototype" in
7170"$define") ;;
7171*)	ansi2knr='ansi2knr'
7172	echo " "
7173	cat <<EOM >&4
7174
7175$me:  FATAL ERROR:
7176This version of $package can only be compiled by a compiler that 
7177understands function prototypes.  Unfortunately, your C compiler 
7178	$cc $ccflags
7179doesn't seem to understand them.  Sorry about that.
7180
7181If GNU cc is available for your system, perhaps you could try that instead.  
7182
7183Eventually, we hope to support building Perl with pre-ANSI compilers.
7184If you would like to help in that effort, please contact <perlbug@perl.org>.
7185
7186Aborting Configure now.
7187EOM
7188	exit 2
7189	;;
7190esac
7191
7192: determine where public executables go
7193echo " "
7194set dflt bin bin
7195eval $prefixit
7196fn=d~
7197rp='Pathname where the public executables will reside?'
7198. ./getfile
7199if $test "X$ansexp" != "X$binexp"; then
7200	installbin=''
7201fi
7202bin="$ans"
7203binexp="$ansexp"
7204: Change installation prefix, if necessary.
7205: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7206if $test X"$prefix" != X"$installprefix"; then
7207	installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7208else
7209	installbin="$binexp"
7210fi
7211
7212echo " "
7213case "$extras" in
7214'') dflt='n';;
7215*) dflt='y';;
7216esac
7217cat <<EOM
7218Perl can be built with extra modules or bundles of modules which
7219will be fetched from the CPAN and installed alongside Perl.
7220
7221Notice that you will need access to the CPAN; either via the Internet,
7222or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7223be asked later to configure the CPAN.pm module which will in turn do
7224the installation of the rest of the extra modules or bundles.)
7225
7226Notice also that if the modules require any external software such as
7227libraries and headers (the libz library and the zlib.h header for the
7228Compress::Zlib module, for example) you MUST have any such software
7229already installed, this configuration process will NOT install such
7230things for you.
7231
7232If this doesn't make any sense to you, just accept the default '$dflt'.
7233EOM
7234rp='Install any extra modules (y or n)?'
7235. ./myread
7236case "$ans" in
7237y|Y)
7238	cat <<EOM
7239
7240Please list any extra modules or bundles to be installed from CPAN,
7241with spaces between the names.  The names can be in any format the
7242'install' command of CPAN.pm will understand.  (Answer 'none',
7243without the quotes, to install no extra modules or bundles.)
7244EOM
7245	rp='Extras?'
7246	dflt="$extras"
7247	. ./myread
7248	extras="$ans"
7249esac
7250case "$extras" in
7251''|'none')
7252	val=''
7253	$rm -f ../extras.lst
7254	;;
7255*)	echo "(Saving the list of extras for later...)"
7256	echo "$extras" > ../extras.lst
7257	val="'$extras'"
7258	;;
7259esac
7260set extras
7261eval $setvar
7262echo " "
7263
7264: Find perl5.005 or later.
7265echo "Looking for a previously installed perl5.005 or later... "
7266case "$perl5" in
7267'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7268		: Check if this perl is recent and can load a simple module
7269		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7270			perl5=$tdir/perl
7271			break;
7272		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7273			perl5=$tdir/perl5
7274			break;
7275		fi
7276	done
7277	;;
7278*)	perl5="$perl5"
7279	;;
7280esac
7281case "$perl5" in
7282'')	echo "None found.  That's ok.";;
7283*)	echo "Using $perl5." ;;
7284esac
7285
7286: Determine list of previous versions to include in @INC
7287$cat > getverlist <<EOPL
7288#!$perl5 -w
7289use File::Basename;
7290\$api_versionstring = "$api_versionstring";
7291\$version = "$version";
7292\$stem = "$sitelib_stem";
7293\$archname = "$archname";
7294EOPL
7295	$cat >> getverlist <<'EOPL'
7296# Can't have leading @ because metaconfig interprets it as a command!
7297;@inc_version_list=();
7298# XXX Redo to do opendir/readdir?
7299if (-d $stem) {
7300    chdir($stem);
7301    ;@candidates = glob("5.*");
7302}
7303else {
7304    ;@candidates = ();
7305}
7306
7307# XXX ToDo:  These comparisons must be reworked when two-digit
7308# subversions come along, so that 5.7.10 compares as greater than
7309# 5.7.3!  By that time, hope that 5.6.x is sufficiently
7310# widespread that we can use the built-in version vectors rather
7311# than reinventing them here.  For 5.6.0, however, we must
7312# assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7313foreach $d (@candidates) {
7314    if ($d lt $version) {
7315	if ($d ge $api_versionstring) {
7316	    unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7317	}
7318	elsif ($d ge "5.005") {
7319	    unshift(@inc_version_list, grep { -d } $d);
7320	}
7321    }
7322    else {
7323	# Skip newer version.  I.e. don't look in
7324	# 5.7.0 if we're installing 5.6.1.
7325    }
7326}
7327
7328if (@inc_version_list) {
7329    print join(' ', @inc_version_list);
7330}
7331else {
7332    # Blank space to preserve value for next Configure run.
7333    print " ";
7334}
7335EOPL
7336chmod +x getverlist
7337case "$inc_version_list" in
7338'')	if test -x "$perl5$exe_ext"; then
7339		dflt=`$perl5 getverlist`
7340	else
7341		dflt='none'
7342	fi
7343	;;
7344$undef) dflt='none' ;;
7345*)  eval dflt=\"$inc_version_list\" ;;
7346esac
7347case "$dflt" in
7348''|' ') dflt=none ;;
7349esac
7350case "$dflt" in
73515.005) dflt=none ;;
7352esac
7353$cat <<EOM
7354
7355In order to ease the process of upgrading, this version of perl 
7356can be configured to use modules built and installed with earlier 
7357versions of perl that were installed under $prefix.  Specify here
7358the list of earlier versions that this version of perl should check.
7359If Configure detected no earlier versions of perl installed under
7360$prefix, then the list will be empty.  Answer 'none' to tell perl
7361to not search earlier versions.
7362
7363The default should almost always be sensible, so if you're not sure,
7364just accept the default.
7365EOM
7366
7367rp='List of earlier versions to include in @INC?'
7368. ./myread
7369case "$ans" in
7370[Nn]one|''|' ') inc_version_list=' ' ;;
7371*) inc_version_list="$ans" ;;
7372esac
7373case "$inc_version_list" in
7374''|' ')
7375	inc_version_list_init='0';;
7376*)	inc_version_list_init=`echo $inc_version_list |
7377		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7378	;;
7379esac
7380$rm -f getverlist
7381
7382: determine whether to install perl also as /usr/bin/perl
7383
7384echo " "
7385if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7386	$cat <<EOM
7387Many scripts expect perl to be installed as /usr/bin/perl.
7388I can install the perl you are about to compile also as /usr/bin/perl
7389(in addition to $installbin/perl).
7390EOM
7391	case "$installusrbinperl" in
7392	"$undef"|[nN]*)	dflt='n';;
7393	*)		dflt='y';;
7394	esac
7395	rp="Do you want to install perl as /usr/bin/perl?"
7396	. ./myread
7397	case "$ans" in
7398	[yY]*)	val="$define";;
7399	*)	val="$undef" ;;
7400	esac
7401else
7402	val="$undef"
7403fi
7404set installusrbinperl
7405eval $setvar
7406
7407: see if dld is available
7408set dld.h i_dld
7409eval $inhdr
7410
7411: see if dlopen exists
7412xxx_runnm="$runnm"
7413runnm=false
7414set dlopen d_dlopen
7415eval $inlibc
7416runnm="$xxx_runnm"
7417
7418: determine which dynamic loading, if any, to compile in
7419echo " "
7420dldir="ext/DynaLoader"
7421case "$usedl" in
7422$define|y|true)
7423	dflt='y'
7424	usedl="$define"
7425	;;
7426$undef|n|false)
7427	dflt='n'
7428	usedl="$undef"
7429	;;
7430*)
7431	dflt='n'
7432	case "$d_dlopen" in
7433	    $define) dflt='y' ;;
7434	esac
7435	case "$i_dld" in
7436	    $define) dflt='y' ;;
7437	esac
7438	: Does a dl_xxx.xs file exist for this operating system
7439	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7440	;;
7441esac
7442rp="Do you wish to use dynamic loading?"
7443. ./myread
7444usedl="$ans"
7445case "$ans" in
7446y*) usedl="$define"
7447	case "$dlsrc" in
7448	'')
7449		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7450			dflt="$dldir/dl_${osname}.xs"
7451		elif $test "$d_dlopen" = "$define" ; then
7452			dflt="$dldir/dl_dlopen.xs"
7453		elif $test "$i_dld" = "$define" ; then
7454			dflt="$dldir/dl_dld.xs"
7455		else
7456			dflt=''
7457		fi
7458		;;
7459	*)	dflt="$dldir/$dlsrc"
7460		;;
7461	esac
7462    echo "The following dynamic loading files are available:"
7463	: Can not go over to $dldir because getfile has path hard-coded in.
7464	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7465	rp="Source file to use for dynamic loading"
7466	fn="fne"
7467	gfpth="$src"
7468	. ./getfile
7469	usedl="$define"
7470	: emulate basename
7471	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7472
7473	$cat << EOM
7474
7475Some systems may require passing special flags to $cc -c to
7476compile modules that will be used to create a shared library.
7477To use no flags, say "none".
7478
7479EOM
7480    case "$cccdlflags" in
7481    '')	case "$gccversion" in
7482		'') case "$osname" in
7483			hpux)	dflt='+z' ;;
7484			next)	dflt='none' ;;
7485			irix*)	dflt='-KPIC' ;;
7486			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7487			sunos)	dflt='-pic' ;;
7488			*)	dflt='none' ;;
7489		    esac
7490			;;
7491		*)  case "$osname" in
7492	                darwin) dflt='none' ;;
7493			svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7494			*)	dflt='-fpic' ;;
7495		    esac ;;
7496	    esac ;;
7497	' ') dflt='none' ;;
7498    *)	dflt="$cccdlflags" ;;
7499    esac
7500    rp="Any special flags to pass to $cc -c to compile shared library modules?"
7501    . ./myread
7502    case "$ans" in
7503    none) cccdlflags=' ' ;;
7504    *) cccdlflags="$ans" ;;
7505    esac
7506
7507    cat << EOM
7508
7509Some systems use ld to create libraries that can be dynamically loaded,
7510while other systems (such as those using ELF) use $cc.
7511
7512EOM
7513	case "$ld" in
7514	'')	$cat >try.c <<'EOM'
7515/* Test for whether ELF binaries are produced */
7516#include <fcntl.h>
7517#include <stdlib.h>
7518int main() {
7519	char b[4];
7520	int i = open("a.out",O_RDONLY);
7521	if(i == -1)
7522		exit(1); /* fail */
7523	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7524		exit(0); /* succeed (yes, it's ELF) */
7525	else
7526		exit(1); /* fail */
7527}
7528EOM
7529		if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7530			cat <<EOM
7531You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7532EOM
7533			dflt="$cc"
7534		else
7535			echo "I'll use ld to build dynamic libraries."
7536			dflt='ld'
7537		fi
7538		rm -f try.c a.out
7539		;;
7540	*)	dflt="$ld"
7541		;;
7542	esac
7543
7544    rp="What command should be used to create dynamic libraries?"
7545    . ./myread
7546	ld="$ans"
7547
7548    cat << EOM
7549
7550Some systems may require passing special flags to $ld to create a
7551library that can be dynamically loaded.  If your ld flags include
7552-L/other/path options to locate libraries outside your loader's normal
7553search path, you may need to specify those -L options here as well.  To
7554use no flags, say "none".
7555
7556EOM
7557    case "$lddlflags" in
7558    '') case "$osname" in
7559  			beos) dflt='-nostart' ;;
7560			hpux) dflt='-b';
7561			      case "$gccversion" in
7562			      '') dflt="$dflt +vnocompatwarnings" ;;
7563			      esac
7564			      ;;
7565			linux|irix*)	dflt='-shared' ;;
7566			next)  dflt='none' ;;
7567			solaris) dflt='-G' ;;
7568			sunos) dflt='-assert nodefinitions' ;;
7569			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7570	        *)     dflt='none' ;;
7571			esac
7572			;;
7573    *) dflt="$lddlflags" ;;
7574    esac
7575
7576	: Try to guess additional flags to pick up local libraries.
7577	: Be careful not to append to a plain 'none'
7578	case "$dflt" in
7579	none) dflt='' ;;
7580	esac
7581	for thisflag in $ldflags; do
7582		case "$thisflag" in
7583		-L*|-R*|-Wl,-R*)
7584			case " $dflt " in
7585			*" $thisflag "*) ;;
7586			*) dflt="$dflt $thisflag" ;;
7587			esac
7588			;;
7589		esac
7590	done
7591
7592	case "$dflt" in
7593	''|' ') dflt='none' ;;
7594	esac
7595
7596    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7597    . ./myread
7598    case "$ans" in
7599    none) lddlflags=' ' ;;
7600    *) lddlflags="$ans" ;;
7601    esac
7602
7603	cat <<EOM
7604
7605Some systems may require passing special flags to $cc to indicate that
7606the resulting executable will use dynamic linking.  To use no flags,
7607say "none".
7608
7609EOM
7610    case "$ccdlflags" in
7611    '') case "$osname" in
7612		hpux)	dflt='-Wl,-E' ;;
7613		linux)	dflt='-rdynamic' ;;
7614		next)	dflt='none' ;;
7615		sunos)	dflt='none' ;;
7616		*)	dflt='none' ;;
7617	    esac ;;
7618    ' ')  dflt='none' ;;
7619    *)  dflt="$ccdlflags" ;;
7620    esac
7621    rp="Any special flags to pass to $cc to use dynamic linking?"
7622    . ./myread
7623    case "$ans" in
7624    none) ccdlflags=' ' ;;
7625    *) ccdlflags="$ans" ;;
7626    esac
7627    ;;
7628*)  usedl="$undef"
7629	ld='ld'
7630    dlsrc='dl_none.xs'
7631    lddlflags=''
7632    ccdlflags=''
7633    ;;
7634esac
7635
7636also=''
7637case "$usedl" in
7638$undef)
7639	# No dynamic loading being used, so don't bother even to prompt.
7640	useshrplib='false'
7641	;;
7642*)	case "$useshrplib" in
7643	'')	case "$osname" in
7644		svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7645			dflt=y
7646			also='Building a shared libperl is required for dynamic loading to work on your system.'
7647			;;
7648		next*)
7649			case "$osvers" in
7650			4*)	dflt=y
7651				also='Building a shared libperl is needed for MAB support.'
7652				;;
7653			*)	dflt=n
7654				;;
7655			esac
7656			;;
7657		*)	dflt=n
7658			;;
7659		esac
7660		;;
7661	$define|true|[Yy]*)
7662		dflt=y
7663		;;
7664	*)	dflt=n
7665		;;
7666	esac
7667	$cat << EOM
7668
7669The perl executable is normally obtained by linking perlmain.c with
7670libperl${_a}, any static extensions (usually just DynaLoader), and
7671any other libraries needed on this system (such as -lm, etc.).  Since
7672your system supports dynamic loading, it is probably possible to build
7673a shared libperl.$so.  If you will have more than one executable linked
7674to libperl.$so, this will significantly reduce the size of each
7675executable, but it may have a noticeable affect on performance.  The
7676default is probably sensible for your system.
7677$also
7678
7679EOM
7680	rp="Build a shared libperl.$so (y/n)"
7681	. ./myread
7682	case "$ans" in
7683	true|$define|[Yy]*)
7684		useshrplib='true'  ;;
7685	*)	useshrplib='false' ;;
7686	esac
7687	;;
7688esac
7689
7690case "$useshrplib" in
7691true)
7692	case "$libperl" in
7693	'')
7694		# Figure out a good name for libperl.so.  Since it gets stored in
7695		# a version-specific architecture-dependent library, the version
7696		# number isn't really that important, except for making cc/ld happy.
7697		#
7698		# A name such as libperl.so.3.1
7699		majmin="libperl.$so.$patchlevel.$subversion"
7700		# A name such as libperl.so.301
7701		majonly=`echo $patchlevel $subversion |
7702			$awk '{printf "%d%02d", $1, $2}'`
7703		majonly=libperl.$so.$majonly
7704		# I'd prefer to keep the os-specific stuff here to a minimum, and
7705		# rely on figuring it out from the naming of libc.
7706		case "${osname}${osvers}" in
7707		next4*)
7708			dflt=libperl.5.$so
7709			# XXX How handle the --version stuff for MAB?
7710			;;
7711		linux*)  # ld won't link with a bare -lperl otherwise.
7712			dflt=libperl.$so
7713			;;
7714		cygwin*) # ld links against an importlib
7715			dflt=libperl$lib_ext
7716			;;
7717		*)	# Try to guess based on whether libc has major.minor.
7718			case "$libc" in
7719			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7720			*libc.$so.[0-9]*) dflt=$majonly ;;
7721			*)	dflt=libperl.$so ;;
7722			esac
7723			;;
7724		esac
7725		;;
7726	*)	dflt=$libperl
7727		;;
7728	esac
7729	cat << EOM
7730
7731I need to select a good name for the shared libperl.  If your system uses
7732library names with major and minor numbers, then you might want something
7733like $majmin.  Alternatively, if your system uses a single version
7734number for shared libraries, then you might want to use $majonly.
7735Or, your system might be quite happy with a simple libperl.$so.
7736
7737Since the shared libperl will get installed into a version-specific
7738architecture-dependent directory, the version number of the shared perl
7739library probably isn't important, so the default should be o.k.
7740
7741EOM
7742	rp='What name do you want to give to the shared libperl?'
7743	. ./myread
7744	libperl=$ans
7745	echo "Ok, I'll use $libperl"
7746	;;
7747*)
7748	libperl="libperl${_a}"
7749	;;
7750esac
7751
7752# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7753case "$shrpdir" in
7754'') ;;
7755*)	$cat >&4 <<EOM
7756WARNING:  Use of the shrpdir variable for the installation location of
7757the shared $libperl is not supported.  It was never documented and
7758will not work in this version.  Let me (perlbug@perl.org)
7759know of any problems this may cause.
7760
7761EOM
7762	case "$shrpdir" in
7763	"$archlibexp/CORE")
7764		$cat >&4 <<EOM
7765But your current setting of $shrpdir is
7766the default anyway, so it's harmless.
7767EOM
7768		;;
7769	*)
7770		$cat >&4 <<EOM
7771Further, your current attempted setting of $shrpdir
7772conflicts with the value of $archlibexp/CORE
7773that installperl will use.
7774EOM
7775		;;
7776	esac
7777	;;
7778esac
7779
7780# How will the perl executable find the installed shared $libperl?
7781# Add $xxx to ccdlflags.
7782# If we can't figure out a command-line option, use $shrpenv to
7783# set env LD_RUN_PATH.  The main perl makefile uses this.
7784shrpdir=$archlibexp/CORE
7785xxx=''
7786tmp_shrpenv=''
7787if "$useshrplib"; then
7788    case "$osname" in
7789	aix)
7790		# We'll set it in Makefile.SH...
7791		;;
7792	solaris)
7793		xxx="-R $shrpdir"
7794		;;
7795	freebsd|netbsd|openbsd)
7796		xxx="-Wl,-R$shrpdir"
7797		;;
7798	bsdos|linux|irix*|dec_osf)
7799		xxx="-Wl,-rpath,$shrpdir"
7800		;;
7801	next)
7802		# next doesn't like the default...
7803		;;
7804	beos)
7805		# beos doesn't like the default, either.
7806		;;
7807	hpux*)
7808		# hpux doesn't like the default, either.
7809		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7810		;;
7811	*)
7812		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7813		;;
7814	esac
7815	case "$xxx" in
7816	'') ;;
7817	*)
7818		# Only add $xxx if it isn't already in ccdlflags.
7819		case " $ccdlflags " in
7820		*" $xxx "*)	;;
7821		*)	ccdlflags="$ccdlflags $xxx"
7822			cat <<EOM >&4
7823
7824Adding $xxx to the flags
7825passed to $ld so that the perl executable will find the 
7826installed shared $libperl.
7827
7828EOM
7829			;;
7830		esac
7831		;;
7832	esac
7833fi
7834# Fix ccdlflags in AIX for building external extensions.
7835# (For building Perl itself bare -bE:perl.exp is needed,
7836#  Makefile.SH takes care of this.)
7837case "$osname" in
7838aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7839esac
7840# Respect a hint or command-line value.
7841case "$shrpenv" in
7842'') shrpenv="$tmp_shrpenv" ;;
7843esac
7844case "$ldlibpthname" in
7845'')	ldlibpthname=LD_LIBRARY_PATH ;;
7846none)	ldlibpthname='' ;;
7847esac
7848
7849: determine where manual pages are on this system
7850echo " "
7851case "$sysman" in
7852'')
7853	syspath='/usr/share/man/man1 /usr/man/man1'
7854	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7855	syspath="$syspath /usr/man/u_man/man1"
7856	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7857	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7858	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7859	sysman=`./loc . /usr/man/man1 $syspath`
7860	;;
7861esac
7862if $test -d "$sysman"; then
7863	echo "System manual is in $sysman." >&4
7864else
7865	echo "Could not find manual pages in source form." >&4
7866fi
7867
7868: determine where manual pages go
7869set man1dir man1dir none
7870eval $prefixit
7871$cat <<EOM
7872
7873$spackage has manual pages available in source form.
7874EOM
7875case "$nroff" in
7876nroff)
7877	echo "However, you don't have nroff, so they're probably useless to you."
7878	case "$man1dir" in
7879	'') man1dir="none";;
7880	esac;;
7881esac
7882echo "If you don't want the manual sources installed, answer 'none'."
7883case "$man1dir" in
7884' ') dflt=none
7885	;;
7886'')
7887	lookpath="$prefixexp/share/man/man1"
7888	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7889	lookpath="$lookpath $prefixexp/man/p_man/man1"
7890	lookpath="$lookpath $prefixexp/man/u_man/man1"
7891	lookpath="$lookpath $prefixexp/man/man.1"
7892	case "$sysman" in
7893	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7894	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7895	esac
7896	set dflt
7897	eval $prefixup
7898	;;
7899*)  dflt="$man1dir"
7900	;;
7901esac
7902echo " "
7903fn=dn+~
7904rp="Where do the main $spackage manual pages (source) go?"
7905. ./getfile
7906if $test "X$man1direxp" != "X$ansexp"; then
7907	installman1dir=''
7908fi
7909man1dir="$ans"
7910man1direxp="$ansexp"
7911case "$man1dir" in
7912'')	man1dir=' '
7913	installman1dir='';;
7914esac
7915
7916: Change installation prefix, if necessary.
7917if $test X"$prefix" != X"$installprefix"; then
7918	installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7919else
7920	installman1dir="$man1direxp"
7921fi
7922
7923: What suffix to use on installed man pages
7924
7925case "$man1dir" in
7926' ')
7927	man1ext='0'
7928	;;
7929*)
7930	rp="What suffix should be used for the main $spackage man pages?"
7931	case "$man1ext" in
7932	'')	case "$man1dir" in
7933		*1)  dflt=1 ;;
7934		*1p) dflt=1p ;;
7935		*1pm) dflt=1pm ;;
7936		*l) dflt=l;;
7937		*n) dflt=n;;
7938		*o) dflt=o;;
7939		*p) dflt=p;;
7940		*C) dflt=C;;
7941		*L) dflt=L;;
7942		*L1) dflt=L1;;
7943		*) dflt=1;;
7944		esac
7945		;;
7946	*)	dflt="$man1ext";;
7947	esac
7948	. ./myread
7949	man1ext="$ans"
7950	;;
7951esac
7952
7953: see if we can have long filenames
7954echo " "
7955first=123456789abcdef
7956$rm -f $first
7957if (echo hi >$first) 2>/dev/null; then
7958	if $test -f 123456789abcde; then
7959		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7960		val="$undef"
7961	else
7962 		echo 'You can have filenames longer than 14 characters.'>&4
7963 		val="$define"
7964	fi
7965else
7966	$cat <<'EOM'
7967You can't have filenames longer than 14 chars.
7968You can't even think about them!
7969EOM
7970	val="$undef"
7971fi
7972set d_flexfnam
7973eval $setvar
7974$rm -rf 123456789abcde*
7975
7976: determine where library module manual pages go
7977set man3dir man3dir none
7978eval $prefixit
7979$cat <<EOM
7980
7981$spackage has manual pages for many of the library modules.
7982EOM
7983
7984case "$nroff" in
7985nroff)
7986	$cat <<'EOM'
7987However, you don't have nroff, so they're probably useless to you.
7988EOM
7989	case "$man3dir" in
7990	'') man3dir="none";;
7991	esac;;
7992esac
7993
7994case "$d_flexfnam" in
7995undef)
7996	$cat <<'EOM'
7997However, your system can't handle the long file names like File::Basename.3.
7998EOM
7999	case "$man3dir" in
8000	'') man3dir="none";;
8001	esac;;
8002esac
8003
8004echo "If you don't want the manual sources installed, answer 'none'."
8005prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8006case "$man3dir" in
8007'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8008	if $test -d "$privlib/man/man3"; then
8009		cat <<EOM >&4
8010
8011WARNING:  Previous versions of perl installed man3 pages into
8012$privlib/man/man3.  This version will suggest a
8013new default of $dflt.
8014EOM
8015		tdflt=$dflt
8016		dflt='n'
8017		rp='Do you wish to preserve the old behavior?(y/n)'
8018		. ./myread
8019		case "$ans" in
8020		y*) dflt="$privlib/man/man3" ;;
8021		*)  dflt=$tdflt ;;
8022		esac
8023    fi
8024	;;
8025*)	dflt="$man3dir" ;;
8026esac
8027case "$dflt" in
8028' ') dflt=none ;;
8029esac
8030echo " "
8031fn=dn+~
8032rp="Where do the $package library man pages (source) go?"
8033. ./getfile
8034man3dir="$ans"
8035man3direxp="$ansexp"
8036case "$man3dir" in
8037'')	man3dir=' '
8038	installman3dir='';;
8039esac
8040
8041: Change installation prefix, if necessary.
8042if $test X"$prefix" != X"$installprefix"; then
8043	installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8044else
8045	installman3dir="$man3direxp"
8046fi
8047
8048: What suffix to use on installed man pages
8049case "$man3dir" in
8050' ')
8051	man3ext='0'
8052	;;
8053*)
8054	rp="What suffix should be used for the $package library man pages?"
8055	case "$man3ext" in
8056	'')	case "$man3dir" in
8057		*3)  dflt=3 ;;
8058		*3p) dflt=3p ;;
8059		*3pm) dflt=3pm ;;
8060		*l) dflt=l;;
8061		*n) dflt=n;;
8062		*o) dflt=o;;
8063		*p) dflt=p;;
8064		*C) dflt=C;;
8065		*L) dflt=L;;
8066		*L3) dflt=L3;;
8067		*) dflt=3;;
8068		esac
8069		;;
8070	*)	dflt="$man3ext";;
8071	esac
8072	. ./myread
8073	man3ext="$ans"
8074	;;
8075esac
8076
8077: see if we have to deal with yellow pages, now NIS.
8078if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8079	if $test -f /usr/etc/nibindd; then
8080		echo " "
8081		echo "I'm fairly confident you're on a NeXT."
8082		echo " "
8083		rp='Do you get the hosts file via NetInfo?'
8084		dflt=y
8085		case "$hostcat" in
8086		nidump*) ;;
8087		'') ;;
8088		*) dflt=n;;
8089		esac
8090		. ./myread
8091		case "$ans" in
8092		y*) hostcat='nidump hosts .';;
8093		*)	case "$hostcat" in
8094			nidump*) hostcat='';;
8095			esac
8096			;;
8097		esac
8098	fi
8099	case "$hostcat" in
8100	nidump*) ;;
8101	*)
8102		case "$hostcat" in
8103		*ypcat*) dflt=y;;
8104		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8105				dflt=y
8106			else
8107				dflt=n
8108			fi;;
8109		*) dflt=n;;
8110		esac
8111		echo " "
8112		rp='Are you getting the hosts file via yellow pages?'
8113		. ./myread
8114		case "$ans" in
8115		y*) hostcat='ypcat hosts';;
8116		*) hostcat='cat /etc/hosts';;
8117		esac
8118		;;
8119	esac
8120fi
8121case "$hostcat" in
8122'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8123esac
8124case "$groupcat" in
8125'') test -f /etc/group && groupcat='cat /etc/group';;
8126esac
8127case "$passcat" in
8128'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8129esac
8130
8131: now get the host name
8132echo " "
8133echo "Figuring out host name..." >&4
8134case "$myhostname" in
8135'') cont=true
8136	echo 'Maybe "hostname" will work...'
8137	if tans=`sh -c hostname 2>&1` ; then
8138		myhostname=$tans
8139		phostname=hostname
8140		cont=''
8141	fi
8142	;;
8143*) cont='';;
8144esac
8145if $test "$cont"; then
8146	if ./xenix; then
8147		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8148		if tans=`cat /etc/systemid 2>&1` ; then
8149			myhostname=$tans
8150			phostname='cat /etc/systemid'
8151			echo "Whadyaknow.  Xenix always was a bit strange..."
8152			cont=''
8153		fi
8154	elif $test -r /etc/systemid; then
8155		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8156	fi
8157fi
8158if $test "$cont"; then
8159	echo 'No, maybe "uuname -l" will work...'
8160	if tans=`sh -c 'uuname -l' 2>&1` ; then
8161		myhostname=$tans
8162		phostname='uuname -l'
8163	else
8164		echo 'Strange.  Maybe "uname -n" will work...'
8165		if tans=`sh -c 'uname -n' 2>&1` ; then
8166			myhostname=$tans
8167			phostname='uname -n'
8168		else
8169			echo 'Oh well, maybe I can mine it out of whoami.h...'
8170			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8171				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8172				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8173			else
8174				case "$myhostname" in
8175				'') echo "Does this machine have an identity crisis or something?"
8176					phostname='';;
8177				*)
8178					echo "Well, you said $myhostname before..."
8179					phostname='echo $myhostname';;
8180				esac
8181			fi
8182		fi
8183	fi
8184fi
8185case "$myhostname" in
8186'') myhostname=noname ;;
8187esac
8188: you do not want to know about this
8189set $myhostname
8190myhostname=$1
8191
8192: verify guess
8193if $test "$myhostname" ; then
8194	dflt=y
8195	rp='Your host name appears to be "'$myhostname'".'" Right?"
8196	. ./myread
8197	case "$ans" in
8198	y*) ;;
8199	*) myhostname='';;
8200	esac
8201fi
8202
8203: bad guess or no guess
8204while $test "X$myhostname" = X ; do
8205	dflt=''
8206	rp="Please type the (one word) name of your host:"
8207	. ./myread
8208	myhostname="$ans"
8209done
8210
8211: translate upper to lower if necessary
8212case "$myhostname" in
8213*[A-Z]*)
8214	echo "(Normalizing case in your host name)"
8215	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8216	;;
8217esac
8218
8219case "$myhostname" in
8220*.*)
8221	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8222	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8223	echo "(Trimming domain name from host name--host name is now $myhostname)"
8224	;;
8225*) case "$mydomain" in
8226	'')
8227		{
8228			test "X$hostcat" = "Xypcat hosts" &&
8229			ypmatch "$myhostname" hosts 2>/dev/null |\
8230				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8231			$test -s hosts
8232		} || {
8233			test "X$hostcat" != "X" &&
8234		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8235					/[	 ]$myhostname[	. ]/p" > hosts
8236		}
8237		tmp_re="[	. ]"
8238		if $test -f hosts; then
8239			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8240			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8241			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8242				hosts | $sort | $uniq | \
8243				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8244			case `$echo X$dflt` in
8245			X*\ *)	echo "(Several hosts in the database matched hostname)"
8246				dflt=.
8247				;;
8248			X.) echo "(You do not have fully-qualified names in the hosts database)"
8249				;;
8250			esac
8251		else
8252			echo "(I cannot locate a hosts database anywhere)"
8253			dflt=.
8254		fi
8255		case "$dflt" in
8256		.)
8257			tans=`./loc resolv.conf X /etc /usr/etc`
8258			if $test -f "$tans"; then
8259				echo "(Attempting domain name extraction from $tans)"
8260				dflt=.`$sed -n -e 's/	/ /g' \
8261				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8262				  | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8263				case "$dflt" in
8264				.) dflt=.`$sed -n -e 's/	/ /g' \
8265				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8266				     | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8267  					;;
8268				esac
8269			fi
8270			;;
8271		esac
8272		case "$dflt" in
8273		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8274			dflt=.`sh -c domainname 2>/dev/null`
8275			case "$dflt" in
8276			'') dflt='.';;
8277			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8278			esac
8279			;;
8280		esac
8281		case "$dflt$osname" in
8282		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8283			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8284			;;
8285		esac
8286		case "$dflt" in
8287		.) echo "(Lost all hope -- silly guess then)"
8288			dflt='.nonet'
8289			;;
8290		esac
8291		$rm -f hosts
8292		;;
8293	*) dflt="$mydomain";;
8294	esac;;
8295esac
8296echo " "
8297rp="What is your domain name?"
8298. ./myread
8299tans="$ans"
8300case "$ans" in
8301'') ;;
8302.*) ;;
8303*) tans=".$tans";;
8304esac
8305mydomain="$tans"
8306
8307: translate upper to lower if necessary
8308case "$mydomain" in
8309*[A-Z]*)
8310	echo "(Normalizing case in your domain name)"
8311	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8312	;;
8313esac
8314
8315: a little sanity check here
8316case "$phostname" in
8317'') ;;
8318*)
8319	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8320	$myhostname$mydomain|$myhostname) ;;
8321	*)
8322		case "$phostname" in
8323		sed*)
8324			echo "(That doesn't agree with your whoami.h file, by the way.)"
8325			;;
8326		*)
8327			echo "(That doesn't agree with your $phostname command, by the way.)"
8328			;;
8329		esac
8330	;;
8331	esac
8332	;;
8333esac
8334
8335$cat <<EOM
8336
8337I need to get your e-mail address in Internet format if possible, i.e.
8338something like user@host.domain. Please answer accurately since I have
8339no easy means to double check it. The default value provided below
8340is most probably close to reality but may not be valid from outside
8341your organization...
8342
8343EOM
8344cont=x
8345while test "$cont"; do
8346	case "$cf_email" in
8347	'') dflt="$cf_by@$myhostname$mydomain";;
8348	*) dflt="$cf_email";;
8349	esac
8350	rp='What is your e-mail address?'
8351	. ./myread
8352	cf_email="$ans"
8353	case "$cf_email" in
8354	*@*.*) cont='' ;;
8355	*)
8356		rp='Address does not look like an Internet one.  Use it anyway?'
8357		case "$fastread" in
8358		yes) dflt=y ;;
8359		*) dflt=n ;;
8360		esac
8361		. ./myread
8362		case "$ans" in
8363		y*) cont='' ;;
8364		*) echo " " ;;
8365		esac
8366		;;
8367	esac
8368done
8369
8370$cat <<EOM
8371
8372If you or somebody else will be maintaining perl at your site, please
8373fill in the correct e-mail address here so that they may be contacted
8374if necessary. Currently, the "perlbug" program included with perl
8375will send mail to this address in addition to perlbug@perl.org. You may
8376enter "none" for no administrator.
8377
8378EOM
8379case "$perladmin" in
8380'') dflt="$cf_email";;
8381*) dflt="$perladmin";;
8382esac
8383rp='Perl administrator e-mail address'
8384. ./myread
8385perladmin="$ans"
8386
8387: determine whether to only install version-specific parts.
8388echo " "
8389$cat <<EOM
8390Do you want to install only the version-specific parts of the perl
8391distribution?  Usually you do *not* want to do this.
8392EOM
8393case "$versiononly" in
8394"$define"|[Yy]*|true) dflt='y' ;;
8395*) dflt='n';
8396esac
8397rp="Do you want to install only the version-specific parts of perl?"
8398. ./myread
8399case "$ans" in
8400[yY]*)	val="$define";;
8401*)	val="$undef" ;;
8402esac
8403set versiononly
8404eval $setvar
8405
8406case "$versiononly" in
8407"$define") inc_version_list=''
8408           inc_version_list_init=0
8409           ;;
8410esac
8411
8412: figure out how to guarantee perl startup
8413case "$startperl" in
8414'')
8415	case "$sharpbang" in
8416	*!)
8417		$cat <<EOH
8418
8419I can use the #! construct to start perl on your system. This will
8420make startup of perl scripts faster, but may cause problems if you
8421want to share those scripts and perl is not in a standard place
8422($binexp/perl) on all your platforms. The alternative is to force
8423a shell by starting the script with a single ':' character.
8424
8425EOH
8426		case "$versiononly" in
8427		"$define")      dflt="$binexp/perl$version";;
8428		*)              dflt="$binexp/perl";;
8429		esac
8430		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8431		. ./myread
8432		case "$ans" in
8433		none)	startperl=": # use perl";;
8434		*)	startperl="#!$ans"
8435			if $test 30 -lt `echo "$ans" | wc -c`; then
8436				$cat >&4 <<EOM
8437
8438WARNING:  Some systems limit the #! command to 32 characters.
8439If you experience difficulty running Perl scripts with #!, try
8440installing Perl in a directory with a shorter pathname.
8441
8442EOM
8443			fi ;;
8444		esac
8445		;;
8446	*) startperl=": # use perl"
8447		;;
8448	esac
8449	;;
8450esac
8451echo "I'll use $startperl to start perl scripts."
8452
8453: figure best path for perl in scripts
8454case "$perlpath" in
8455'')
8456	case "$versiononly" in
8457	"$define")	perlpath="$binexp/perl$version";;
8458	*)		perlpath="$binexp/perl";;
8459	esac
8460	case "$startperl" in
8461	*!*) ;;
8462	*)
8463		$cat <<EOH
8464
8465I will use the "eval 'exec'" idiom to start Perl on your system.
8466I can use the full path of your Perl binary for this purpose, but
8467doing so may cause problems if you want to share those scripts and
8468Perl is not always in a standard place ($binexp/perl).
8469
8470EOH
8471		dflt="$binexp/perl"
8472		rp="What path shall I use in \"eval 'exec'\"?"
8473		. ./myread
8474		perlpath="$ans"
8475		;;
8476	esac
8477	;;
8478esac
8479case "$startperl" in
8480*!*)	;;
8481*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8482esac
8483
8484: determine where public executable scripts go
8485set scriptdir scriptdir
8486eval $prefixit
8487case "$scriptdir" in
8488'')
8489	dflt="$bin"
8490	: guess some guesses
8491	$test -d /usr/share/scripts && dflt=/usr/share/scripts
8492	$test -d /usr/share/bin     && dflt=/usr/share/bin
8493	$test -d /usr/local/script  && dflt=/usr/local/script
8494	$test -d /usr/local/scripts && dflt=/usr/local/scripts
8495	$test -d $prefixexp/script  && dflt=$prefixexp/script
8496	set dflt
8497	eval $prefixup
8498	;;
8499*)  dflt="$scriptdir"
8500	;;
8501esac
8502$cat <<EOM
8503 
8504Some installations have a separate directory just for executable scripts so
8505that they can mount it across multiple architectures but keep the scripts in
8506one spot.  You might, for example, have a subdirectory of /usr/share for this.
8507Or you might just lump your scripts in with all your other executables.
8508 
8509EOM
8510fn=d~
8511rp='Where do you keep publicly executable scripts?'
8512. ./getfile
8513if $test "X$ansexp" != "X$scriptdirexp"; then
8514	installscript=''
8515fi
8516scriptdir="$ans"
8517scriptdirexp="$ansexp"
8518: Change installation prefix, if necessary.
8519if $test X"$prefix" != X"$installprefix"; then
8520	installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8521else
8522	installscript="$scriptdirexp"
8523fi
8524
8525: determine where add-on public executables go
8526case "$sitebin" in
8527'')	dflt=$siteprefix/bin ;;
8528*)	dflt=$sitebin ;;
8529esac
8530fn=d~
8531rp='Pathname where the add-on public executables should be installed?'
8532. ./getfile
8533sitebin="$ans"
8534sitebinexp="$ansexp"
8535: Change installation prefix, if necessary.
8536if $test X"$prefix" != X"$installprefix"; then
8537	installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8538else
8539	installsitebin="$sitebinexp"
8540fi
8541
8542: define an is-a-typedef? function
8543typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8544case "$inclist" in
8545"") inclist="sys/types.h";;
8546esac;
8547eval "varval=\$$var";
8548case "$varval" in
8549"")
8550	$rm -f temp.c;
8551	for inc in $inclist; do
8552		echo "#include <$inc>" >>temp.c;
8553	done;
8554	echo "#ifdef $type" >> temp.c;
8555	echo "printf(\"We have $type\");" >> temp.c;
8556	echo "#endif" >> temp.c;
8557	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8558	if $contains $type temp.E >/dev/null 2>&1; then
8559		eval "$var=\$type";
8560	else
8561		eval "$var=\$def";
8562	fi;
8563	$rm -f temp.?;;
8564*) eval "$var=\$varval";;
8565esac'
8566
8567: define an is-a-typedef? function that prompts if the type is not available.
8568typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8569case "$inclist" in
8570"") inclist="sys/types.h";;
8571esac;
8572eval "varval=\$$var";
8573case "$varval" in
8574"")
8575	$rm -f temp.c;
8576	for inc in $inclist; do
8577		echo "#include <$inc>" >>temp.c;
8578	done;
8579	echo "#ifdef $type" >> temp.c;
8580	echo "printf(\"We have $type\");" >> temp.c;
8581	echo "#endif" >> temp.c;
8582	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8583	echo " " ;
8584	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8585	if $contains $type temp.E >/dev/null 2>&1; then
8586		echo "$type found." >&4;
8587		eval "$var=\$type";
8588	else
8589		echo "$type NOT found." >&4;
8590		dflt="$def";
8591		. ./myread ;
8592		eval "$var=\$ans";
8593	fi;
8594	$rm -f temp.?;;
8595*) eval "$var=\$varval";;
8596esac'
8597
8598: see what type lseek is declared as in the kernel
8599rp="What is the type used for lseek's offset on this system?"
8600set off_t lseektype long stdio.h sys/types.h
8601eval $typedef_ask
8602
8603echo " "
8604echo "Checking to see how big your file offsets are..." >&4
8605$cat >try.c <<EOCP
8606#include <sys/types.h>
8607#include <stdio.h>
8608int main()
8609{
8610    printf("%d\n", (int)sizeof($lseektype));
8611    return(0); 
8612}
8613EOCP
8614set try
8615if eval $compile_ok; then
8616	lseeksize=`$run ./try`
8617	echo "Your file offsets are $lseeksize bytes long."
8618else
8619	dflt=$longsize
8620	echo " "
8621	echo "(I can't seem to compile the test program.  Guessing...)"
8622	rp="What is the size of your file offsets (in bytes)?"
8623	. ./myread
8624	lseeksize="$ans"
8625fi
8626$rm -f try.c try
8627
8628: see what type file positions are declared as in the library
8629rp="What is the type for file position used by fsetpos()?"
8630set fpos_t fpostype long stdio.h sys/types.h
8631eval $typedef_ask
8632
8633echo " "
8634case "$fpostype" in
8635*_t) zzz="$fpostype"	;;
8636*)   zzz="fpos_t"	;;
8637esac
8638echo "Checking the size of $zzz..." >&4
8639cat > try.c <<EOCP
8640#include <sys/types.h>
8641#include <stdio.h>
8642int main() {
8643    printf("%d\n", (int)sizeof($fpostype));
8644    exit(0);
8645}
8646EOCP
8647set try
8648if eval $compile_ok; then
8649	yyy=`$run ./try`
8650	case "$yyy" in
8651	'')	fpossize=4
8652		echo "(I can't execute the test program--guessing $fpossize.)" >&4
8653		;;
8654	*)	fpossize=$yyy
8655		echo "Your $zzz is $fpossize bytes long."
8656		;;
8657	esac
8658else
8659	dflt="$longsize"
8660	echo " " >&4
8661	echo "(I can't compile the test program.  Guessing...)" >&4
8662	rp="What is the size of your file positions (in bytes)?"
8663	. ./myread
8664	fpossize="$ans"
8665fi
8666
8667
8668
8669# Backward compatibility (uselfs is deprecated).
8670case "$uselfs" in
8671"$define"|true|[yY]*)
8672	cat <<EOM >&4
8673
8674*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8675EOM
8676	uselargefiles="$define"
8677	;;
8678esac
8679
8680case "$lseeksize:$fpossize" in
86818:8) cat <<EOM
8682
8683You can have files larger than 2 gigabytes.
8684EOM
8685   val="$define" ;;
8686*)    case "$uselargefiles" in
8687   "$undef"|false|[nN]*) dflt='n' ;;
8688   *)	dflt='y' ;;
8689   esac
8690   cat <<EOM
8691
8692Perl can be built to understand large files (files larger than 2 gigabytes)
8693on some systems.  To do so, Configure can be run with -Duselargefiles.
8694
8695If this doesn't make any sense to you, just accept the default '$dflt'.
8696EOM
8697   rp='Try to understand large files, if available?'
8698   . ./myread
8699   case "$ans" in
8700   y|Y) 	val="$define" ;;
8701   *)   	val="$undef"  ;;
8702   esac
8703   ;;
8704esac
8705set uselargefiles
8706eval $setvar
8707case "$uselargefiles" in
8708"$define")
8709: Look for a hint-file generated 'call-back-unit'.  If the
8710: user has specified that a large files perl is to be built,
8711: we may need to set or change some other defaults.
8712	if $test -f uselargefiles.cbu; then
8713		echo "Your platform has some specific hints for large file builds, using them..."
8714		. ./uselargefiles.cbu
8715		echo " "
8716		echo "Rechecking to see how big your file offsets are..." >&4
8717		$cat >try.c <<EOCP
8718#include <sys/types.h>
8719#include <stdio.h>
8720int main()
8721{
8722    printf("%d\n", (int)sizeof($lseektype));
8723    return(0); 
8724}
8725EOCP
8726		set try
8727		if eval $compile_ok; then
8728			lseeksize=`$run ./try`
8729			$echo "Your file offsets are now $lseeksize bytes long."
8730		else
8731			dflt="$lseeksize"
8732			echo " "
8733			echo "(I can't seem to compile the test program.  Guessing...)"
8734			rp="What is the size of your file offsets (in bytes)?"
8735			. ./myread
8736			lseeksize="$ans"
8737		fi
8738		case "$fpostype" in
8739		*_t) zzz="$fpostype"	;;
8740		*)   zzz="fpos_t"	;;
8741		esac
8742		$echo $n "Rechecking the size of $zzz...$c" >&4
8743		$cat > try.c <<EOCP
8744#include <sys/types.h>
8745#include <stdio.h>
8746int main() {
8747    printf("%d\n", (int)sizeof($fpostype));
8748    exit(0);
8749}
8750EOCP
8751		set try
8752		if eval $compile_ok; then
8753			yyy=`$run ./try`
8754			dflt="$lseeksize"
8755			case "$yyy" in
8756			'')	echo " "
8757				echo "(I can't execute the test program--guessing $fpossize.)" >&4
8758				;;
8759			*)	fpossize=$yyy
8760				echo " $fpossize bytes." >&4
8761				;;
8762			esac
8763		else
8764			dflt="$fpossize"
8765			echo " "
8766			echo "(I can't compile the test program.  Guessing...)" >&4
8767			rp="What is the size of your file positions (in bytes)?"
8768			. ./myread
8769			fpossize="$ans"
8770		fi
8771		$rm -f try.c try
8772	fi
8773	;;
8774esac
8775
8776case "$vendorprefix" in
8777'')	d_vendorbin="$undef"
8778	vendorbin=''
8779	vendorbinexp=''
8780	;;
8781*)	d_vendorbin="$define"
8782	: determine where vendor-supplied executables go.
8783	case "$vendorbin" in
8784	'') dflt=$vendorprefix/bin ;;
8785	*)	dflt="$vendorbin" ;;
8786	esac
8787	fn=d~+
8788	rp='Pathname for the vendor-supplied executables directory?'
8789	. ./getfile
8790	vendorbin="$ans"
8791	vendorbinexp="$ansexp"
8792	;;
8793esac
8794: Change installation prefix, if necessary.
8795if $test X"$prefix" != X"$installprefix"; then
8796	installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8797else
8798	installvendorbin="$vendorbinexp"
8799fi
8800
8801: see if qgcvt exists
8802set qgcvt d_qgcvt
8803eval $inlibc
8804
8805: Check how to convert floats to strings.
8806
8807if test "X$d_Gconvert" = X; then
8808
8809echo " "
8810echo "Checking for an efficient way to convert floats to strings."
8811echo " " > try.c
8812case "$uselongdouble" in
8813"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8814esac
8815case "$d_longdbl" in
8816"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8817esac
8818case "$d_PRIgldbl" in
8819"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8820esac
8821$cat >>try.c <<EOP
8822#ifdef TRY_gconvert
8823#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8824char *myname = "gconvert";
8825#endif
8826#ifdef TRY_gcvt
8827#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8828char *myname = "gcvt";
8829#endif
8830#ifdef TRY_qgcvt
8831#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8832char *myname = "qgcvt";
8833#define DOUBLETYPE long double
8834#endif
8835#ifdef TRY_sprintf
8836#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8837#ifdef HAS_PRIgldbl
8838#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8839#else
8840#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8841#endif
8842#else
8843#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8844#endif
8845char *myname = "sprintf";
8846#endif
8847
8848#ifndef DOUBLETYPE
8849#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8850#define DOUBLETYPE long double
8851#else
8852#define DOUBLETYPE double
8853#endif
8854#endif
8855
8856#include <stdio.h>
8857
8858#define I_STDLIB $i_stdlib
8859#ifdef I_STDLIB
8860#include <stdlib.h>
8861#endif
8862
8863int
8864checkit(expect, got)
8865char *expect;
8866char *got;
8867{
8868    if (strcmp(expect, got)) {
8869		printf("%s oddity:  Expected %s, got %s\n",
8870			myname, expect, got);
8871		exit(1);
8872	}
8873}
8874
8875int main()
8876{ 
8877	char buf[64]; 
8878	buf[63] = '\0';
8879
8880	/* This must be 1st test on (which?) platform */
8881	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8882	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8883	checkit("0.1", buf);
8884
8885	Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8886	checkit("0.01", buf);
8887
8888	Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8889	checkit("0.001", buf);
8890
8891	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8892	checkit("0.0001", buf);
8893
8894	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8895	if (strlen(buf) > 5)
8896	    checkit("9e-005", buf); /* for Microsoft ?? */
8897	else
8898	    checkit("9e-05", buf);
8899
8900	Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8901	checkit("1", buf);
8902
8903	Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8904	checkit("1.1", buf);
8905
8906	Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8907	checkit("1.01", buf);
8908
8909	Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8910	checkit("1.001", buf);
8911
8912	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8913	checkit("1.0001", buf);
8914
8915	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8916	checkit("1.00001", buf);
8917
8918	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8919	checkit("1.000001", buf);
8920
8921	Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8922	checkit("0", buf);
8923
8924	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8925	checkit("-1", buf);
8926
8927	/* Some Linux gcvt's give 1.e+5 here. */
8928	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8929	checkit("100000", buf);
8930	
8931	/* Some Linux gcvt's give -1.e+5 here. */
8932	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8933	checkit("-100000", buf);
8934
8935	Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8936	checkit("123.456", buf);
8937
8938	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8939	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8940	/* 34 should be enough to scare even long double
8941	 * places into using the e notation. */
8942	if (strlen(buf) > 5)
8943	    checkit("1e+034", buf); /* for Microsoft */
8944	else
8945	    checkit("1e+34", buf);
8946
8947	/* For Perl, if you add additional tests here, also add them to
8948	 * t/base/num.t for benefit of platforms not using Configure or
8949	 * overriding d_Gconvert */
8950
8951	exit(0);
8952}
8953EOP
8954: first add preferred functions to our list
8955xxx_list=""
8956for xxx_convert in $gconvert_preference; do
8957    case $xxx_convert in
8958    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8959    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8960    esac
8961done
8962: then add any others
8963for xxx_convert in gconvert gcvt sprintf; do
8964    case "$xxx_list" in
8965    *$xxx_convert*) ;;
8966    *) xxx_list="$xxx_list $xxx_convert" ;;
8967    esac
8968done
8969
8970case "$d_longdbl$uselongdouble" in
8971"$define$define")
8972    : again, add prefered functions to our list first
8973    xxx_ld_list=""
8974    for xxx_convert in $gconvert_ld_preference; do
8975        case $xxx_convert in
8976        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8977        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8978        esac
8979    done
8980    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8981    for xxx_convert in qgcvt sprintf $xxx_list; do
8982        case "$xxx_ld_list" in
8983        $xxx_convert*|*" $xxx_convert"*) ;;
8984        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8985        esac
8986    done
8987    : if sprintf cannot do long doubles, move it to the end
8988    if test "$d_PRIgldbl" != "$define"; then
8989        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8990    fi
8991    : if no qgcvt, remove it
8992    if test "$d_qgcvt" != "$define"; then
8993        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8994    fi
8995    : use the ld_list
8996    xxx_list="$xxx_ld_list"
8997    ;;
8998esac
8999
9000for xxx_convert in $xxx_list; do
9001	echo "Trying $xxx_convert..."
9002	$rm -f try try$_o
9003	set try -DTRY_$xxx_convert
9004	if eval $compile; then
9005		echo "$xxx_convert() found." >&4
9006		if $run ./try; then
9007			echo "I'll use $xxx_convert to convert floats into a string." >&4
9008			break;
9009		else
9010			echo "...But $xxx_convert didn't work as I expected."
9011			xxx_convert=''
9012		fi
9013	else
9014		echo "$xxx_convert NOT found." >&4
9015	fi
9016done
9017
9018if test X$xxx_convert = X; then
9019    echo "*** WHOA THERE!!! ***" >&4
9020    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9021    xxx_convert=sprintf
9022fi
9023
9024case "$xxx_convert" in
9025gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9026gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9027qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9028*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9029   "$define$define$define")
9030      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9031   "$define$define$undef")
9032      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9033   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9034   esac
9035   ;;
9036esac
9037
9038fi
9039
9040: see if _fwalk exists
9041set fwalk d__fwalk
9042eval $inlibc
9043
9044: Initialize h_fcntl
9045h_fcntl=false
9046
9047: Initialize h_sysfile
9048h_sysfile=false
9049
9050: access call always available on UNIX
9051set access d_access
9052eval $inlibc
9053
9054: locate the flags for 'access()'
9055case "$d_access" in
9056"$define")
9057	echo " "
9058	$cat >access.c <<'EOCP'
9059#include <sys/types.h>
9060#ifdef I_FCNTL
9061#include <fcntl.h>
9062#endif
9063#ifdef I_SYS_FILE
9064#include <sys/file.h>
9065#endif
9066#ifdef I_UNISTD
9067#include <unistd.h>
9068#endif
9069int main() {
9070	exit(R_OK);
9071}
9072EOCP
9073	: check sys/file.h first, no particular reason here
9074	if $test `./findhdr sys/file.h` && \
9075		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9076		h_sysfile=true;
9077		echo "<sys/file.h> defines the *_OK access constants." >&4
9078	elif $test `./findhdr fcntl.h` && \
9079		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9080		h_fcntl=true;
9081		echo "<fcntl.h> defines the *_OK access constants." >&4
9082	elif $test `./findhdr unistd.h` && \
9083		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9084		echo "<unistd.h> defines the *_OK access constants." >&4
9085	else
9086		echo "I can't find the four *_OK access constants--I'll use mine." >&4
9087	fi
9088	;;
9089esac
9090$rm -f access*
9091
9092: see if accessx exists
9093set accessx d_accessx
9094eval $inlibc
9095
9096: see if alarm exists
9097set alarm d_alarm
9098eval $inlibc
9099
9100: see if POSIX threads are available
9101set pthread.h i_pthread
9102eval $inhdr
9103
9104: define a fucntion to check prototypes
9105$cat > protochk <<EOSH
9106$startsh
9107cc="$cc"
9108optimize="$optimize"
9109ccflags="$ccflags"
9110prototype="$prototype"
9111define="$define"
9112rm=$rm
9113usethreads=$usethreads
9114i_pthread=$i_pthread
9115pthread_h_first=$pthread_h_first
9116EOSH
9117
9118$cat >> protochk <<'EOSH'
9119
9120$rm -f try.c
9121foo="$1"
9122shift
9123while test $# -ge 2; do
9124	case "$1" in
9125		$define) echo "#include <$2>" >> try.c ;;
9126		literal) echo "$2" >> try.c ;;
9127	esac
9128    # Extra magic for the benefit of systems that need pthread.h
9129    # to be included early to correctly detect threadsafe functions.
9130    # Such functions must guarantee themselves, though, that the usethreads
9131    # and i_pthread have been defined, before calling protochk.
9132    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9133	echo "#include <pthread.h>" >> try.c
9134	pthread_h_done=yes
9135    fi
9136    shift 2
9137done
9138test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9139cat >> try.c <<'EOCP'
9140#ifdef CAN_PROTOTYPE
9141#define	_(args) args
9142#else
9143#define	_(args) ()
9144#endif
9145EOCP
9146echo "$foo" >> try.c
9147echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9148$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9149status=$?
9150$rm -f try.[co]
9151exit $status
9152EOSH
9153chmod +x protochk
9154$eunicefix protochk
9155
9156hasproto='varname=$1; func=$2; shift; shift;
9157while $test $# -ge 2; do
9158	case "$1" in
9159	$define) echo "#include <$2>";;
9160	esac ;
9161    shift 2;
9162done > try.c;
9163$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9164if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9165	echo "$func() prototype found.";
9166	val="$define";
9167else
9168	echo "$func() prototype NOT found.";
9169	val="$undef";
9170fi;
9171set $varname;
9172eval $setvar;
9173$rm -f try.c tryout.c'
9174
9175: see if sys/types.h has to be included
9176set sys/types.h i_systypes
9177eval $inhdr
9178
9179: see if sys/select.h has to be included
9180set sys/select.h i_sysselct
9181eval $inhdr
9182
9183hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9184while $test $# -ge 2; do
9185	case "$1" in
9186	$define) echo "#include <$2>";;
9187	esac ;
9188    shift 2;
9189done > try.c;
9190echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9191set try;
9192if eval $compile; then
9193	val="$define";
9194else
9195	val="$undef";
9196fi;
9197set $varname;
9198eval $setvar;
9199$rm -f try.c try.o'
9200
9201: see if we should include time.h, sys/time.h, or both
9202echo " "
9203if test "X$timeincl" = X; then
9204	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9205	$echo $n "I'm now running the test program...$c"
9206	$cat >try.c <<'EOCP'
9207#include <sys/types.h>
9208#ifdef I_TIME
9209#include <time.h>
9210#endif
9211#ifdef I_SYSTIME
9212#ifdef SYSTIMEKERNEL
9213#define KERNEL
9214#endif
9215#include <sys/time.h>
9216#endif
9217#ifdef I_SYSSELECT
9218#include <sys/select.h>
9219#endif
9220int main()
9221{
9222	struct tm foo;
9223#ifdef S_TIMEVAL
9224	struct timeval bar;
9225#endif
9226#ifdef S_TIMEZONE
9227	struct timezone tzp;
9228#endif
9229	if (foo.tm_sec == foo.tm_sec)
9230		exit(0);
9231#ifdef S_TIMEVAL
9232	if (bar.tv_sec == bar.tv_sec)
9233		exit(0);
9234#endif
9235	exit(1);
9236}
9237EOCP
9238	flags=''
9239	for s_timezone in '-DS_TIMEZONE' ''; do
9240	sysselect=''
9241	for s_timeval in '-DS_TIMEVAL' ''; do
9242	for i_systimek in '' '-DSYSTIMEKERNEL'; do
9243	for i_time in '' '-DI_TIME'; do
9244	for i_systime in '-DI_SYSTIME' ''; do
9245		case "$flags" in
9246		'') $echo $n ".$c"
9247			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9248			if eval $compile; then
9249				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9250				shift
9251				flags="$*"
9252				echo " "
9253				$echo $n "Succeeded with $flags$c"
9254			fi
9255			;;
9256		esac
9257	done
9258	done
9259	done
9260	done
9261	done
9262	timeincl=''
9263	echo " "
9264	case "$flags" in
9265	*SYSTIMEKERNEL*) i_systimek="$define"
9266		timeincl=`./findhdr sys/time.h`
9267		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9268	*) i_systimek="$undef";;
9269	esac
9270	case "$flags" in
9271	*I_TIME*) i_time="$define"
9272		timeincl=`./findhdr time.h`" $timeincl"
9273		echo "We'll include <time.h>." >&4;;
9274	*) i_time="$undef";;
9275	esac
9276	case "$flags" in
9277	*I_SYSTIME*) i_systime="$define"
9278		timeincl=`./findhdr sys/time.h`" $timeincl"
9279		echo "We'll include <sys/time.h>." >&4;;
9280	*) i_systime="$undef";;
9281	esac
9282	$rm -f try.c try
9283fi
9284: see if struct tm knows about tm_zone
9285case "$i_systime$i_time" in
9286*$define*)
9287        echo " "
9288        echo "Checking to see if your struct tm has tm_zone field..." >&4
9289        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9290        eval $hasfield
9291        ;;
9292*)      val="$undef"
9293        set d_tm_tm_zone
9294        eval $setvar
9295        ;;
9296esac
9297case "$d_tm_tm_zone" in
9298"$define")      echo "Yes, it does."   ;;
9299*)              echo "No, it doesn't." ;;
9300esac
9301: see if struct tm knows about tm_gmtoff
9302case "$i_systime$i_time" in
9303*$define*)
9304        echo " "
9305        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9306        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9307        eval $hasfield
9308        ;;
9309*)      val="$undef"
9310        set d_tm_tm_gmtoff
9311        eval $setvar
9312        ;;
9313esac
9314case "$d_tm_tm_gmtoff" in
9315"$define")      echo "Yes, it does."   ;;
9316*)              echo "No, it doesn't." ;;
9317esac
9318
9319: see if asctime_r exists
9320set asctime_r d_asctime_r
9321eval $inlibc
9322case "$d_asctime_r" in
9323"$define")
9324	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9325	case "$d_asctime_r_proto:$usethreads" in
9326	":define")	d_asctime_r_proto=define
9327		set d_asctime_r_proto asctime_r $hdrs
9328		eval $hasproto ;;
9329	*)	;;
9330	esac
9331	case "$d_asctime_r_proto" in
9332	define)
9333	case "$asctime_r_proto" in
9334	''|0) try='char* asctime_r(const struct tm*, char*);'
9335	./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9336	esac
9337	case "$asctime_r_proto" in
9338	''|0) try='char* asctime_r(const struct tm*, char*, int);'
9339	./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9340	esac
9341	case "$asctime_r_proto" in
9342	''|0) try='int asctime_r(const struct tm*, char*);'
9343	./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9344	esac
9345	case "$asctime_r_proto" in
9346	''|0) try='int asctime_r(const struct tm*, char*, int);'
9347	./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9348	esac
9349	case "$asctime_r_proto" in
9350	''|0)	d_asctime_r=undef
9351 	        asctime_r_proto=0
9352		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9353	* )	case "$asctime_r_proto" in
9354		REENTRANT_PROTO*) ;;
9355		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9356		esac
9357		echo "Prototype: $try" ;;
9358	esac
9359	;;
9360	*)	case "$usethreads" in
9361		define) echo "asctime_r has no prototype, not using it." >&4 ;;
9362		esac
9363		d_asctime_r=undef
9364		asctime_r_proto=0
9365		;;
9366	esac
9367	;;
9368*)	asctime_r_proto=0
9369	;;
9370esac
9371
9372: see if atolf exists
9373set atolf d_atolf
9374eval $inlibc
9375
9376: see if atoll exists
9377set atoll d_atoll
9378eval $inlibc
9379
9380: Look for GNU-cc style attribute checking
9381echo " "
9382echo "Checking whether your compiler can handle __attribute__ ..." >&4
9383$cat >attrib.c <<'EOCP'
9384#include <stdio.h>
9385void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9386EOCP
9387if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9388	if $contains 'warning' attrib.out >/dev/null 2>&1; then
9389		echo "Your C compiler doesn't fully support __attribute__."
9390		val="$undef"
9391	else
9392		echo "Your C compiler supports __attribute__."
9393		val="$define"
9394	fi
9395else
9396	echo "Your C compiler doesn't seem to understand __attribute__ at all."
9397	val="$undef"
9398fi
9399set d_attribut
9400eval $setvar
9401$rm -f attrib*
9402
9403: see if bcmp exists
9404set bcmp d_bcmp
9405eval $inlibc
9406
9407: see if bcopy exists
9408set bcopy d_bcopy
9409eval $inlibc
9410
9411: see if this is a unistd.h system
9412set unistd.h i_unistd
9413eval $inhdr
9414
9415: see if getpgrp exists
9416set getpgrp d_getpgrp
9417eval $inlibc
9418
9419case "$d_getpgrp" in
9420"$define")
9421	echo " "
9422	echo "Checking to see which flavor of getpgrp is in use..."
9423	$cat >try.c <<EOP
9424#$i_unistd I_UNISTD
9425#include <sys/types.h>
9426#ifdef I_UNISTD
9427#  include <unistd.h>
9428#endif
9429int main()
9430{
9431	if (getuid() == 0) {
9432		printf("(I see you are running Configure as super-user...)\n");
9433		setuid(1);
9434	}
9435#ifdef TRY_BSD_PGRP
9436	if (getpgrp(1) == 0)
9437		exit(0);
9438#else
9439	if (getpgrp() > 0)
9440		exit(0);
9441#endif
9442	exit(1);
9443}
9444EOP
9445	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9446		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9447		val="$define"
9448	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9449		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9450		val="$undef"
9451	else
9452		echo "I can't seem to compile and run the test program."
9453		if ./usg; then
9454			xxx="a USG one, i.e. you use getpgrp()."
9455		else
9456			# SVR4 systems can appear rather BSD-ish.
9457			case "$i_unistd" in
9458			$undef)
9459				xxx="a BSD one, i.e. you use getpgrp(pid)."
9460				val="$define"
9461				;;
9462			$define)
9463				xxx="probably a USG one, i.e. you use getpgrp()."
9464				val="$undef"
9465				;;
9466			esac
9467		fi
9468		echo "Assuming your getpgrp is $xxx" >&4
9469	fi
9470	;;
9471*) val="$undef";;
9472esac
9473set d_bsdgetpgrp
9474eval $setvar
9475$rm -f try try.*
9476
9477: see if setpgrp exists
9478set setpgrp d_setpgrp
9479eval $inlibc
9480
9481case "$d_setpgrp" in
9482"$define")
9483	echo " "
9484	echo "Checking to see which flavor of setpgrp is in use..."
9485	$cat >try.c <<EOP
9486#$i_unistd I_UNISTD
9487#include <sys/types.h>
9488#ifdef I_UNISTD
9489#  include <unistd.h>
9490#endif
9491int main()
9492{
9493	if (getuid() == 0) {
9494		printf("(I see you are running Configure as super-user...)\n");
9495		setuid(1);
9496	}
9497#ifdef TRY_BSD_PGRP
9498	if (-1 == setpgrp(1, 1))
9499		exit(0);
9500#else
9501	if (setpgrp() != -1)
9502		exit(0);
9503#endif
9504	exit(1);
9505}
9506EOP
9507	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9508		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9509		val="$define"
9510	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9511		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9512		val="$undef"
9513	else
9514		echo "(I can't seem to compile and run the test program.)"
9515		if ./usg; then
9516			xxx="a USG one, i.e. you use setpgrp()."
9517		else
9518			# SVR4 systems can appear rather BSD-ish.
9519			case "$i_unistd" in
9520			$undef)
9521				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9522				val="$define"
9523				;;
9524			$define)
9525				xxx="probably a USG one, i.e. you use setpgrp()."
9526				val="$undef"
9527				;;
9528			esac
9529		fi
9530		echo "Assuming your setpgrp is $xxx" >&4
9531	fi
9532	;;
9533*) val="$undef";;
9534esac
9535set d_bsdsetpgrp
9536eval $setvar
9537$rm -f try try.*
9538: see if bzero exists
9539set bzero d_bzero
9540eval $inlibc
9541
9542: see if signal is declared as pointer to function returning int or void
9543echo " "
9544xxx=`./findhdr signal.h`
9545$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9546if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
9547	echo "You have int (*signal())() instead of void." >&4
9548	val="$undef"
9549elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
9550	echo "You have void (*signal())()." >&4
9551	val="$define"
9552elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9553	echo "You have int (*signal())() instead of void." >&4
9554	val="$undef"
9555elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9556	echo "You have void (*signal())()." >&4
9557	val="$define"
9558else
9559	case "$d_voidsig" in
9560	'')
9561	echo "I can't determine whether signal handler returns void or int..." >&4
9562		dflt=void
9563		rp="What type does your signal handler return?"
9564		. ./myread
9565		case "$ans" in
9566		v*) val="$define";;
9567		*) val="$undef";;
9568		esac;;
9569	"$define")
9570		echo "As you already told me, signal handler returns void." >&4
9571		val="$define"
9572		;;
9573	*)	echo "As you already told me, signal handler returns int." >&4
9574		val="$undef"
9575		;;
9576	esac
9577fi
9578set d_voidsig
9579eval $setvar
9580case "$d_voidsig" in
9581"$define") signal_t="void";;
9582*) signal_t="int";;
9583esac
9584$rm -f $$.tmp
9585
9586: check for ability to cast large floats to 32-bit ints.
9587echo " "
9588echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9589if $test "$intsize" -ge 4; then
9590	xxx=int
9591else
9592	xxx=long
9593fi
9594$cat >try.c <<EOCP
9595#include <stdio.h>
9596#include <sys/types.h>
9597#include <signal.h>
9598$signal_t blech(s) int s; { exit(3); }
9599int main()
9600{
9601	$xxx i32;
9602	double f, g;
9603	int result = 0;
9604	char str[16];
9605	signal(SIGFPE, blech);
9606
9607	/* Don't let compiler optimize the test away.  Store the number 
9608	   in a writable string for gcc to pass to sscanf under HP/UX.
9609	*/
9610	sprintf(str, "2147483647");
9611	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9612	g = 10 * f;
9613	i32  = ($xxx) g;
9614
9615	/* x86 processors will probably give 0x8000 0000, which is a
9616       sign change.  We don't want that.  We want to mimic SPARC
9617	   behavior here, which is to preserve the sign and give
9618	   back 0x7fff ffff.
9619	*/
9620	if (i32 != ($xxx) f)
9621		result |= 1;
9622	exit(result);
9623}
9624EOCP
9625set try
9626if eval $compile_ok; then
9627	$run ./try
9628	yyy=$?
9629else
9630	echo "(I can't seem to compile the test program--assuming it can't)"
9631	yyy=1
9632fi
9633case "$yyy" in
96340)	val="$define"
9635	echo "Yup, it can."
9636	;;
9637*)	val="$undef"
9638	echo "Nope, it can't."
9639	;;
9640esac
9641set d_casti32
9642eval $setvar
9643$rm -f try try.*
9644
9645: check for ability to cast negative floats to unsigned
9646echo " "
9647echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9648$cat >try.c <<EOCP
9649#include <stdio.h>
9650#include <sys/types.h>
9651#include <signal.h>
9652$signal_t blech(s) int s; { exit(7); }
9653$signal_t blech_in_list(s) int s; { exit(4); }
9654unsigned long dummy_long(p) unsigned long p; { return p; }
9655unsigned int dummy_int(p) unsigned int p; { return p; }
9656unsigned short dummy_short(p) unsigned short p; { return p; }
9657int main()
9658{
9659	double f;
9660	unsigned long along;
9661	unsigned int aint;
9662	unsigned short ashort;
9663	int result = 0;
9664	char str[16];
9665	
9666	/* Frustrate gcc-2.7.2's optimizer which failed this test with
9667	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
9668	   optimized the whole file away
9669	*/
9670	/* Store the number in a writable string for gcc to pass to 
9671	   sscanf under HP/UX.
9672	*/
9673	sprintf(str, "-123");
9674	sscanf(str, "%lf", &f);  /* f = -123.; */
9675
9676	signal(SIGFPE, blech);
9677	along = (unsigned long)f;
9678	aint = (unsigned int)f;
9679	ashort = (unsigned short)f;
9680	if (along != (unsigned long)-123)
9681		result |= 1;
9682	if (aint != (unsigned int)-123)
9683		result |= 1;
9684	if (ashort != (unsigned short)-123)
9685		result |= 1;
9686	sprintf(str, "1073741824.");
9687	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9688	f = f + f;
9689	along = 0;
9690	along = (unsigned long)f;
9691	if (along != 0x80000000)
9692		result |= 2;
9693	f -= 1.;
9694	along = 0;
9695	along = (unsigned long)f;
9696	if (along != 0x7fffffff)
9697		result |= 1;
9698	f += 2.;
9699	along = 0;
9700	along = (unsigned long)f;
9701	if (along != 0x80000001)
9702		result |= 2;
9703	if (result)
9704		exit(result);
9705	signal(SIGFPE, blech_in_list);
9706	sprintf(str, "123.");
9707	sscanf(str, "%lf", &f);  /* f = 123.; */
9708	along = dummy_long((unsigned long)f);
9709	aint = dummy_int((unsigned int)f);
9710	ashort = dummy_short((unsigned short)f);
9711	if (along != (unsigned long)123)
9712		result |= 4;
9713	if (aint != (unsigned int)123)
9714		result |= 4;
9715	if (ashort != (unsigned short)123)
9716		result |= 4;
9717	exit(result);
9718
9719}
9720EOCP
9721set try
9722if eval $compile_ok; then
9723	$run ./try
9724	castflags=$?
9725else
9726	echo "(I can't seem to compile the test program--assuming it can't)"
9727	castflags=7
9728fi
9729case "$castflags" in
97300)	val="$define"
9731	echo "Yup, it can."
9732	;;
9733*)	val="$undef"
9734	echo "Nope, it can't."
9735	;;
9736esac
9737set d_castneg
9738eval $setvar
9739$rm -f try.*
9740
9741: see if vprintf exists
9742echo " "
9743if set vprintf val -f d_vprintf; eval $csym; $val; then
9744	echo 'vprintf() found.' >&4
9745	val="$define"
9746	$cat >try.c <<'EOF'
9747#include <varargs.h>
9748
9749int main() { xxx("foo"); }
9750
9751xxx(va_alist)
9752va_dcl
9753{
9754	va_list args;
9755	char buf[10];
9756
9757	va_start(args);
9758	exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9759}
9760EOF
9761	set try
9762	if eval $compile && $run ./try; then
9763		echo "Your vsprintf() returns (int)." >&4
9764		val2="$undef"
9765	else
9766		echo "Your vsprintf() returns (char*)." >&4
9767		val2="$define"
9768	fi
9769else
9770	echo 'vprintf() NOT found.' >&4
9771		val="$undef"
9772		val2="$undef"
9773fi
9774$rm -f try try.*
9775set d_vprintf
9776eval $setvar
9777val=$val2
9778set d_charvspr
9779eval $setvar
9780
9781: see if chown exists
9782set chown d_chown
9783eval $inlibc
9784
9785: see if chroot exists
9786set chroot d_chroot
9787eval $inlibc
9788
9789: see if chsize exists
9790set chsize d_chsize
9791eval $inlibc
9792
9793: see if class exists
9794set class d_class
9795eval $inlibc
9796
9797hasstruct='varname=$1; struct=$2; shift; shift;
9798while $test $# -ge 2; do
9799	case "$1" in
9800	$define) echo "#include <$2>";;
9801	esac ;
9802    shift 2;
9803done > try.c;
9804echo "int main () { struct $struct foo; }" >> try.c;
9805set try;
9806if eval $compile; then
9807	val="$define";
9808else
9809	val="$undef";
9810fi;
9811set $varname;
9812eval $setvar;
9813$rm -f try.c try.o'
9814
9815socketlib=''
9816sockethdr=''
9817: see whether socket exists
9818echo " "
9819$echo $n "Hmm... $c" >&4
9820if set socket val -f d_socket; eval $csym; $val; then
9821	echo "Looks like you have Berkeley networking support." >&4
9822	d_socket="$define"
9823	if set setsockopt val -f; eval $csym; $val; then
9824		d_oldsock="$undef"
9825	else
9826		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9827		d_oldsock="$define"
9828	fi
9829else
9830	if $contains socklib libc.list >/dev/null 2>&1; then
9831		echo "Looks like you have Berkeley networking support." >&4
9832		d_socket="$define"
9833		: we will have to assume that it supports the 4.2 BSD interface
9834		d_oldsock="$undef"
9835	else
9836		echo "You don't have Berkeley networking in libc$_a..." >&4
9837		if test "X$d_socket" = "X$define"; then
9838		   echo "...but you seem to believe that you have sockets." >&4
9839		else
9840			for net in net socket
9841			do
9842				if test -f /usr/lib/lib$net$_a; then
9843					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9844					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9845					if $contains socket libc.list >/dev/null 2>&1; then
9846						d_socket="$define"
9847						socketlib="-l$net"
9848						case "$net" in
9849						net)
9850							echo "...but the Wollongong group seems to have hacked it in." >&4
9851							sockethdr="-I/usr/netinclude"
9852							;;
9853						esac
9854						echo "Found Berkeley sockets interface in lib$net." >&4
9855						if $contains setsockopt libc.list >/dev/null 2>&1; then
9856							d_oldsock="$undef"
9857						else
9858							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9859							d_oldsock="$define"
9860						fi
9861						break
9862					fi
9863				fi
9864			done
9865			if test "X$d_socket" != "X$define"; then
9866			   echo "or anywhere else I see." >&4
9867			   d_socket="$undef"
9868			   d_oldsock="$undef"
9869			fi
9870		fi
9871	fi
9872fi
9873
9874: see if socketpair exists
9875set socketpair d_sockpair
9876eval $inlibc
9877
9878
9879echo " "
9880echo "Checking the availability of certain socket constants..." >&4
9881for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9882	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9883	$cat >try.c <<EOF
9884#include <sys/types.h>
9885#include <sys/socket.h>
9886int main() {
9887    int i = $ENUM;
9888}
9889EOF
9890	val="$undef"
9891	set try; if eval $compile; then
9892		val="$define"
9893	fi
9894	set d_${enum}; eval $setvar
9895	$rm -f try.c try
9896done
9897
9898: see if this is a sys/uio.h system
9899set sys/uio.h i_sysuio
9900eval $inhdr
9901
9902
9903echo " "
9904echo "Checking to see if your system supports struct cmsghdr..." >&4
9905set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9906eval $hasstruct
9907case "$d_cmsghdr_s" in
9908"$define")      echo "Yes, it does."   ;;
9909*)              echo "No, it doesn't." ;;
9910esac
9911
9912
9913: check for const keyword
9914echo " "
9915echo 'Checking to see if your C compiler knows about "const"...' >&4
9916$cat >const.c <<'EOCP'
9917typedef struct spug { int drokk; } spug;
9918int main()
9919{
9920	const char *foo;
9921	const spug y;
9922}
9923EOCP
9924if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9925	val="$define"
9926	echo "Yup, it does."
9927else
9928	val="$undef"
9929	echo "Nope, it doesn't."
9930fi
9931set d_const
9932eval $setvar
9933
9934: see if crypt exists
9935echo " "
9936set crypt d_crypt
9937eval $inlibc
9938case "$d_crypt" in
9939$define) cryptlib='' ;;
9940*)	if set crypt val -f d_crypt; eval $csym; $val; then
9941		echo 'crypt() found.' >&4
9942		val="$define"
9943		cryptlib=''
9944	else
9945		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9946		if $test -z "$cryptlib"; then
9947			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9948		else
9949			cryptlib=-lcrypt
9950		fi
9951		if $test -z "$cryptlib"; then
9952			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9953		else
9954			cryptlib=-lcrypt
9955		fi
9956		if $test -z "$cryptlib"; then
9957			cryptlib=`./loc libcrypt$_a "" $libpth`
9958		else
9959			cryptlib=-lcrypt
9960		fi
9961		if $test -z "$cryptlib"; then
9962			echo 'crypt() NOT found.' >&4
9963			val="$undef"
9964		else
9965			val="$define"
9966		fi
9967	fi
9968	set d_crypt
9969	eval $setvar
9970	;;
9971esac
9972
9973: see if this is a crypt.h system
9974set crypt.h i_crypt
9975eval $inhdr
9976
9977: see if crypt_r exists
9978set crypt_r d_crypt_r
9979eval $inlibc
9980case "$d_crypt_r" in
9981"$define")
9982	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9983	case "$d_crypt_r_proto:$usethreads" in
9984	":define")	d_crypt_r_proto=define
9985		set d_crypt_r_proto crypt_r $hdrs
9986		eval $hasproto ;;
9987	*)	;;
9988	esac
9989	case "$d_crypt_r_proto" in
9990	define)
9991	case "$crypt_r_proto" in
9992	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9993	./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9994	esac
9995	case "$crypt_r_proto" in
9996	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9997	./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9998	esac
9999	case "$crypt_r_proto" in
10000	''|0)	d_crypt_r=undef
10001 	        crypt_r_proto=0
10002		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10003	* )	case "$crypt_r_proto" in
10004		REENTRANT_PROTO*) ;;
10005		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10006		esac
10007		echo "Prototype: $try" ;;
10008	esac
10009	;;
10010	*)	case "$usethreads" in
10011		define) echo "crypt_r has no prototype, not using it." >&4 ;;
10012		esac
10013		d_crypt_r=undef
10014		crypt_r_proto=0
10015		;;
10016	esac
10017	;;
10018*)	crypt_r_proto=0
10019	;;
10020esac
10021
10022: get csh whereabouts
10023case "$csh" in
10024'csh') val="$undef" ;;
10025*) val="$define" ;;
10026esac
10027set d_csh
10028eval $setvar
10029: Respect a hint or command line value for full_csh.
10030case "$full_csh" in
10031'') full_csh=$csh ;;
10032esac
10033
10034: see if ctermid_r exists
10035set ctermid_r d_ctermid_r
10036eval $inlibc
10037case "$d_ctermid_r" in
10038"$define")
10039	hdrs="$i_systypes sys/types.h define stdio.h "
10040	case "$d_ctermid_r_proto:$usethreads" in
10041	":define")	d_ctermid_r_proto=define
10042		set d_ctermid_r_proto ctermid_r $hdrs
10043		eval $hasproto ;;
10044	*)	;;
10045	esac
10046	case "$d_ctermid_r_proto" in
10047	define)
10048	case "$ctermid_r_proto" in
10049	''|0) try='char* ctermid_r(char*);'
10050	./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10051	esac
10052	case "$ctermid_r_proto" in
10053	''|0)	d_ctermid_r=undef
10054 	        ctermid_r_proto=0
10055		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10056	* )	case "$ctermid_r_proto" in
10057		REENTRANT_PROTO*) ;;
10058		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10059		esac
10060		echo "Prototype: $try" ;;
10061	esac
10062	;;
10063	*)	case "$usethreads" in
10064		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10065		esac
10066		d_ctermid_r=undef
10067		ctermid_r_proto=0
10068		;;
10069	esac
10070	;;
10071*)	ctermid_r_proto=0
10072	;;
10073esac
10074
10075: see if ctime_r exists
10076set ctime_r d_ctime_r
10077eval $inlibc
10078case "$d_ctime_r" in
10079"$define")
10080	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10081	case "$d_ctime_r_proto:$usethreads" in
10082	":define")	d_ctime_r_proto=define
10083		set d_ctime_r_proto ctime_r $hdrs
10084		eval $hasproto ;;
10085	*)	;;
10086	esac
10087	case "$d_ctime_r_proto" in
10088	define)
10089	case "$ctime_r_proto" in
10090	''|0) try='char* ctime_r(const time_t*, char*);'
10091	./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10092	esac
10093	case "$ctime_r_proto" in
10094	''|0) try='char* ctime_r(const time_t*, char*, int);'
10095	./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10096	esac
10097	case "$ctime_r_proto" in
10098	''|0) try='int ctime_r(const time_t*, char*);'
10099	./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10100	esac
10101	case "$ctime_r_proto" in
10102	''|0) try='int ctime_r(const time_t*, char*, int);'
10103	./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10104	esac
10105	case "$ctime_r_proto" in
10106	''|0)	d_ctime_r=undef
10107 	        ctime_r_proto=0
10108		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10109	* )	case "$ctime_r_proto" in
10110		REENTRANT_PROTO*) ;;
10111		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10112		esac
10113		echo "Prototype: $try" ;;
10114	esac
10115	;;
10116	*)	case "$usethreads" in
10117		define) echo "ctime_r has no prototype, not using it." >&4 ;;
10118		esac
10119		d_ctime_r=undef
10120		ctime_r_proto=0
10121		;;
10122	esac
10123	;;
10124*)	ctime_r_proto=0
10125	;;
10126esac
10127
10128: see if cuserid exists
10129set cuserid d_cuserid
10130eval $inlibc
10131
10132: see if this is a limits.h system
10133set limits.h i_limits
10134eval $inhdr
10135
10136: see if this is a float.h system
10137set float.h i_float
10138eval $inhdr
10139
10140: See if number of significant digits in a double precision number is known
10141echo " "
10142$cat >dbl_dig.c <<EOM
10143#$i_limits I_LIMITS
10144#$i_float I_FLOAT
10145#ifdef I_LIMITS
10146#include <limits.h>
10147#endif
10148#ifdef I_FLOAT
10149#include <float.h>
10150#endif
10151#ifdef DBL_DIG
10152printf("Contains DBL_DIG");
10153#endif
10154EOM
10155$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10156if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10157	echo "DBL_DIG found." >&4
10158	val="$define"
10159else
10160	echo "DBL_DIG NOT found." >&4
10161	val="$undef"
10162fi
10163$rm -f dbl_dig.?
10164set d_dbl_dig
10165eval $setvar
10166
10167: see if dbm.h is available
10168: see if dbmclose exists
10169set dbmclose d_dbmclose
10170eval $inlibc
10171
10172case "$d_dbmclose" in
10173$define)
10174	set dbm.h i_dbm
10175	eval $inhdr
10176	case "$i_dbm" in
10177	$define)
10178		val="$undef"
10179		set i_rpcsvcdbm
10180		eval $setvar
10181		;;
10182	*)	set rpcsvc/dbm.h i_rpcsvcdbm
10183		eval $inhdr
10184		;;
10185	esac
10186	;;
10187*)	echo "We won't be including <dbm.h>"
10188	val="$undef"
10189	set i_dbm
10190	eval $setvar
10191	val="$undef"
10192	set i_rpcsvcdbm
10193	eval $setvar
10194	;;
10195esac
10196
10197: see if prototype for dbminit is available
10198echo " "
10199set d_dbminitproto dbminit $i_dbm dbm.h
10200eval $hasproto
10201
10202: see if difftime exists
10203set difftime d_difftime
10204eval $inlibc
10205
10206: see if this is a dirent system
10207echo " "
10208if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10209	val="$define"
10210	echo "<dirent.h> found." >&4
10211else
10212	val="$undef"
10213	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10214		echo "<sys/dir.h> found." >&4
10215		echo " "
10216	else
10217		xinc=`./findhdr sys/ndir.h`
10218	fi
10219	echo "<dirent.h> NOT found." >&4
10220fi
10221set i_dirent
10222eval $setvar
10223
10224: Look for type of directory structure.
10225echo " "
10226$cppstdin $cppflags $cppminus < "$xinc" > try.c
10227
10228case "$direntrytype" in
10229''|' ')
10230	case "$i_dirent" in
10231	$define) guess1='struct dirent' ;;
10232	*) guess1='struct direct'  ;;
10233	esac
10234	;;
10235*)	guess1="$direntrytype"
10236	;;
10237esac
10238
10239case "$guess1" in
10240'struct dirent') guess2='struct direct' ;;
10241*) guess2='struct dirent' ;;
10242esac
10243
10244if $contains "$guess1" try.c >/dev/null 2>&1; then
10245	direntrytype="$guess1"
10246	echo "Your directory entries are $direntrytype." >&4
10247elif $contains "$guess2" try.c >/dev/null 2>&1; then
10248	direntrytype="$guess2"
10249	echo "Your directory entries seem to be $direntrytype." >&4
10250else
10251	echo "I don't recognize your system's directory entries." >&4
10252	rp="What type is used for directory entries on this system?"
10253	dflt="$guess1"
10254	. ./myread
10255	direntrytype="$ans"
10256fi
10257$rm -f try.c
10258
10259
10260: see if the directory entry stores field length
10261echo " "
10262$cppstdin $cppflags $cppminus < "$xinc" > try.c
10263if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10264	echo "Good, your directory entry keeps length information in d_namlen." >&4
10265	val="$define"
10266else
10267	echo "Your directory entry does not know about the d_namlen field." >&4
10268	val="$undef"
10269fi
10270set d_dirnamlen
10271eval $setvar
10272$rm -f try.c
10273
10274: see if this is an sysdir system
10275set sys/dir.h i_sysdir
10276eval $inhdr
10277
10278: see if this is an sysndir system
10279set sys/ndir.h i_sysndir
10280eval $inhdr
10281
10282: Look for dirfd
10283echo " "
10284$cat >dirfd.c <<EOM
10285#include <stdio.h>
10286#$i_dirent I_DIRENT		/**/
10287#$i_sysdir I_SYS_DIR		/**/
10288#$i_sysndir I_SYS_NDIR		/**/
10289#$i_systypes I_SYS_TYPES	/**/
10290#if defined(I_SYS_TYPES)
10291#include <sys/types.h>
10292#endif
10293#if defined(I_DIRENT)
10294#include <dirent.h>
10295#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10296#include <sys/dir.h>
10297#endif
10298#else
10299#ifdef I_SYS_NDIR
10300#include <sys/ndir.h>
10301#else
10302#ifdef I_SYS_DIR
10303#ifdef hp9000s500
10304#include <ndir.h>	/* may be wrong in the future */
10305#else
10306#include <sys/dir.h>
10307#endif
10308#endif
10309#endif
10310#endif 
10311int main() {
10312	DIR *dirp = opendir(".");
10313	if (dirfd(dirp) >= 0)
10314		exit(0);
10315	else
10316		exit(1);
10317}
10318EOM
10319set dirfd
10320if eval $compile; then
10321	val="$define"
10322fi
10323case "$val" in
10324$define)	echo "dirfd() found." >&4	;;
10325*)		echo "dirfd() NOT found." >&4	;;
10326esac
10327set d_dirfd
10328eval $setvar
10329$rm -f dirfd*
10330
10331: see if dlerror exists
10332xxx_runnm="$runnm"
10333runnm=false
10334set dlerror d_dlerror
10335eval $inlibc
10336runnm="$xxx_runnm"
10337
10338: see if dlfcn is available
10339set dlfcn.h i_dlfcn
10340eval $inhdr
10341
10342case "$usedl" in
10343$define|y|true)
10344	$cat << EOM
10345
10346On a few systems, the dynamically loaded modules that perl generates and uses
10347will need a different extension than shared libs. The default will probably
10348be appropriate.
10349
10350EOM
10351	case "$dlext" in
10352	'')	dflt="$so" ;;
10353	*)	dflt="$dlext" ;;
10354	esac
10355	rp='What is the extension of dynamically loaded modules'
10356	. ./myread
10357	dlext="$ans"
10358	;;
10359*)
10360	dlext="none"
10361	;;
10362esac
10363
10364: Check if dlsym need a leading underscore
10365echo " "
10366val="$undef"
10367
10368case "$dlsrc" in
10369dl_dlopen.xs)
10370	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10371	$cat >dyna.c <<'EOM'
10372fred () { }
10373EOM
10374
10375$cat >fred.c<<EOM
10376
10377#include <stdio.h>
10378#$i_dlfcn I_DLFCN
10379#ifdef I_DLFCN
10380#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10381#else
10382#include <sys/types.h>
10383#include <nlist.h>
10384#include <link.h>
10385#endif
10386
10387extern int fred() ;
10388
10389int main()
10390{
10391    void * handle ;
10392    void * symbol ;
10393#ifndef RTLD_LAZY
10394    int mode = 1 ;
10395#else
10396    int mode = RTLD_LAZY ;
10397#endif
10398    handle = dlopen("./dyna.$dlext", mode) ;
10399    if (handle == NULL) {
10400	printf ("1\n") ;
10401	fflush (stdout) ;
10402	exit(0);
10403    }
10404    symbol = dlsym(handle, "fred") ;
10405    if (symbol == NULL) {
10406	/* try putting a leading underscore */
10407	symbol = dlsym(handle, "_fred") ;
10408	if (symbol == NULL) {
10409	    printf ("2\n") ;
10410	    fflush (stdout) ;
10411	    exit(0);
10412	}
10413	printf ("3\n") ;
10414    }
10415    else
10416	printf ("4\n") ;
10417    fflush (stdout) ;
10418    exit(0);
10419}
10420EOM
10421	: Call the object file tmp-dyna.o in case dlext=o.
10422	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10423		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
10424		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
10425		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10426		xxx=`$run ./fred`
10427		case $xxx in
10428		1)	echo "Test program failed using dlopen." >&4
10429			echo "Perhaps you should not use dynamic loading." >&4;;
10430		2)	echo "Test program failed using dlsym." >&4
10431			echo "Perhaps you should not use dynamic loading." >&4;;
10432		3)	echo "dlsym needs a leading underscore" >&4
10433			val="$define" ;;
10434		4)	echo "dlsym doesn't need a leading underscore." >&4;;
10435		esac
10436	else
10437		echo "I can't compile and run the test program." >&4
10438                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10439	fi
10440	;;
10441esac
10442
10443$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10444
10445set d_dlsymun
10446eval $setvar
10447
10448: see if drand48_r exists
10449set drand48_r d_drand48_r
10450eval $inlibc
10451case "$d_drand48_r" in
10452"$define")
10453	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10454	case "$d_drand48_r_proto:$usethreads" in
10455	":define")	d_drand48_r_proto=define
10456		set d_drand48_r_proto drand48_r $hdrs
10457		eval $hasproto ;;
10458	*)	;;
10459	esac
10460	case "$d_drand48_r_proto" in
10461	define)
10462	case "$drand48_r_proto" in
10463	''|0) try='int drand48_r(struct drand48_data*, double*);'
10464	./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10465	esac
10466	case "$drand48_r_proto" in
10467	''|0)	d_drand48_r=undef
10468 	        drand48_r_proto=0
10469		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10470	* )	case "$drand48_r_proto" in
10471		REENTRANT_PROTO*) ;;
10472		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10473		esac
10474		echo "Prototype: $try" ;;
10475	esac
10476	;;
10477	*)	case "$usethreads" in
10478		define) echo "drand48_r has no prototype, not using it." >&4 ;;
10479		esac
10480		d_drand48_r=undef
10481		drand48_r_proto=0
10482		;;
10483	esac
10484	;;
10485*)	drand48_r_proto=0
10486	;;
10487esac
10488
10489: see if prototype for drand48 is available
10490echo " "
10491set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10492eval $hasproto
10493
10494: see if dup2 exists
10495set dup2 d_dup2
10496eval $inlibc
10497
10498: see if eaccess exists
10499set eaccess d_eaccess
10500eval $inlibc
10501
10502: see if endgrent exists
10503set endgrent d_endgrent
10504eval $inlibc
10505
10506: see if this is an grp system
10507set grp.h i_grp
10508eval $inhdr
10509
10510case "$i_grp" in
10511$define)
10512	xxx=`./findhdr grp.h`
10513	$cppstdin $cppflags $cppminus < $xxx >$$.h
10514
10515	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10516		val="$define"
10517	else
10518		val="$undef"
10519	fi
10520	set d_grpasswd
10521	eval $setvar
10522
10523	$rm -f $$.h
10524	;;
10525*)
10526	val="$undef";
10527	set d_grpasswd; eval $setvar
10528	;;
10529esac
10530
10531: see if endgrent_r exists
10532set endgrent_r d_endgrent_r
10533eval $inlibc
10534case "$d_endgrent_r" in
10535"$define")
10536	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10537	case "$d_endgrent_r_proto:$usethreads" in
10538	":define")	d_endgrent_r_proto=define
10539		set d_endgrent_r_proto endgrent_r $hdrs
10540		eval $hasproto ;;
10541	*)	;;
10542	esac
10543	case "$d_endgrent_r_proto" in
10544	define)
10545	case "$endgrent_r_proto" in
10546	''|0) try='int endgrent_r(FILE**);'
10547	./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10548	esac
10549	case "$endgrent_r_proto" in
10550	''|0) try='void endgrent_r(FILE**);'
10551	./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10552	esac
10553	case "$endgrent_r_proto" in
10554	''|0)	d_endgrent_r=undef
10555 	        endgrent_r_proto=0
10556		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10557	* )	case "$endgrent_r_proto" in
10558		REENTRANT_PROTO*) ;;
10559		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10560		esac
10561		echo "Prototype: $try" ;;
10562	esac
10563	;;
10564	*)	case "$usethreads" in
10565		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10566		esac
10567		d_endgrent_r=undef
10568		endgrent_r_proto=0
10569		;;
10570	esac
10571	;;
10572*)	endgrent_r_proto=0
10573	;;
10574esac
10575
10576: see if endhostent exists
10577set endhostent d_endhent
10578eval $inlibc
10579
10580: see if this is a netdb.h system
10581set netdb.h i_netdb
10582eval $inhdr
10583
10584: see if endhostent_r exists
10585set endhostent_r d_endhostent_r
10586eval $inlibc
10587case "$d_endhostent_r" in
10588"$define")
10589	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10590	case "$d_endhostent_r_proto:$usethreads" in
10591	":define")	d_endhostent_r_proto=define
10592		set d_endhostent_r_proto endhostent_r $hdrs
10593		eval $hasproto ;;
10594	*)	;;
10595	esac
10596	case "$d_endhostent_r_proto" in
10597	define)
10598	case "$endhostent_r_proto" in
10599	''|0) try='int endhostent_r(struct hostent_data*);'
10600	./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10601	esac
10602	case "$endhostent_r_proto" in
10603	''|0) try='void endhostent_r(struct hostent_data*);'
10604	./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10605	esac
10606	case "$endhostent_r_proto" in
10607	''|0)	d_endhostent_r=undef
10608 	        endhostent_r_proto=0
10609		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10610	* )	case "$endhostent_r_proto" in
10611		REENTRANT_PROTO*) ;;
10612		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10613		esac
10614		echo "Prototype: $try" ;;
10615	esac
10616	;;
10617	*)	case "$usethreads" in
10618		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10619		esac
10620		d_endhostent_r=undef
10621		endhostent_r_proto=0
10622		;;
10623	esac
10624	;;
10625*)	endhostent_r_proto=0
10626	;;
10627esac
10628
10629: see if endnetent exists
10630set endnetent d_endnent
10631eval $inlibc
10632
10633: see if endnetent_r exists
10634set endnetent_r d_endnetent_r
10635eval $inlibc
10636case "$d_endnetent_r" in
10637"$define")
10638	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10639	case "$d_endnetent_r_proto:$usethreads" in
10640	":define")	d_endnetent_r_proto=define
10641		set d_endnetent_r_proto endnetent_r $hdrs
10642		eval $hasproto ;;
10643	*)	;;
10644	esac
10645	case "$d_endnetent_r_proto" in
10646	define)
10647	case "$endnetent_r_proto" in
10648	''|0) try='int endnetent_r(struct netent_data*);'
10649	./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10650	esac
10651	case "$endnetent_r_proto" in
10652	''|0) try='void endnetent_r(struct netent_data*);'
10653	./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10654	esac
10655	case "$endnetent_r_proto" in
10656	''|0)	d_endnetent_r=undef
10657 	        endnetent_r_proto=0
10658		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10659	* )	case "$endnetent_r_proto" in
10660		REENTRANT_PROTO*) ;;
10661		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10662		esac
10663		echo "Prototype: $try" ;;
10664	esac
10665	;;
10666	*)	case "$usethreads" in
10667		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10668		esac
10669		d_endnetent_r=undef
10670		endnetent_r_proto=0
10671		;;
10672	esac
10673	;;
10674*)	endnetent_r_proto=0
10675	;;
10676esac
10677
10678: see if endprotoent exists
10679set endprotoent d_endpent
10680eval $inlibc
10681
10682: see if endprotoent_r exists
10683set endprotoent_r d_endprotoent_r
10684eval $inlibc
10685case "$d_endprotoent_r" in
10686"$define")
10687	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10688	case "$d_endprotoent_r_proto:$usethreads" in
10689	":define")	d_endprotoent_r_proto=define
10690		set d_endprotoent_r_proto endprotoent_r $hdrs
10691		eval $hasproto ;;
10692	*)	;;
10693	esac
10694	case "$d_endprotoent_r_proto" in
10695	define)
10696	case "$endprotoent_r_proto" in
10697	''|0) try='int endprotoent_r(struct protoent_data*);'
10698	./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10699	esac
10700	case "$endprotoent_r_proto" in
10701	''|0) try='void endprotoent_r(struct protoent_data*);'
10702	./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10703	esac
10704	case "$endprotoent_r_proto" in
10705	''|0)	d_endprotoent_r=undef
10706 	        endprotoent_r_proto=0
10707		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10708	* )	case "$endprotoent_r_proto" in
10709		REENTRANT_PROTO*) ;;
10710		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10711		esac
10712		echo "Prototype: $try" ;;
10713	esac
10714	;;
10715	*)	case "$usethreads" in
10716		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10717		esac
10718		d_endprotoent_r=undef
10719		endprotoent_r_proto=0
10720		;;
10721	esac
10722	;;
10723*)	endprotoent_r_proto=0
10724	;;
10725esac
10726
10727: see if endpwent exists
10728set endpwent d_endpwent
10729eval $inlibc
10730
10731: see if this is a pwd.h system
10732set pwd.h i_pwd
10733eval $inhdr
10734
10735case "$i_pwd" in
10736$define)
10737	xxx=`./findhdr pwd.h`
10738	$cppstdin $cppflags $cppminus < $xxx >$$.h
10739
10740	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10741		val="$define"
10742	else
10743		val="$undef"
10744	fi
10745	set d_pwquota
10746	eval $setvar
10747
10748	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10749		val="$define"
10750	else
10751		val="$undef"
10752	fi
10753	set d_pwage
10754	eval $setvar
10755
10756	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10757		val="$define"
10758	else
10759		val="$undef"
10760	fi
10761	set d_pwchange
10762	eval $setvar
10763
10764	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10765		val="$define"
10766	else
10767		val="$undef"
10768	fi
10769	set d_pwclass
10770	eval $setvar
10771
10772	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10773		val="$define"
10774	else
10775		val="$undef"
10776	fi
10777	set d_pwexpire
10778	eval $setvar
10779
10780	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10781		val="$define"
10782	else
10783		val="$undef"
10784	fi
10785	set d_pwcomment
10786	eval $setvar
10787
10788	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10789		val="$define"
10790	else
10791		val="$undef"
10792	fi
10793	set d_pwgecos
10794	eval $setvar
10795
10796	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10797		val="$define"
10798	else
10799		val="$undef"
10800	fi
10801	set d_pwpasswd
10802	eval $setvar
10803
10804	$rm -f $$.h
10805	;;
10806*)
10807	val="$undef";
10808	set d_pwquota; eval $setvar
10809	set d_pwage; eval $setvar
10810	set d_pwchange; eval $setvar
10811	set d_pwclass; eval $setvar
10812	set d_pwexpire; eval $setvar
10813	set d_pwcomment; eval $setvar
10814	set d_pwgecos; eval $setvar
10815	set d_pwpasswd; eval $setvar
10816	;;
10817esac
10818
10819: see if endpwent_r exists
10820set endpwent_r d_endpwent_r
10821eval $inlibc
10822case "$d_endpwent_r" in
10823"$define")
10824	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10825	case "$d_endpwent_r_proto:$usethreads" in
10826	":define")	d_endpwent_r_proto=define
10827		set d_endpwent_r_proto endpwent_r $hdrs
10828		eval $hasproto ;;
10829	*)	;;
10830	esac
10831	case "$d_endpwent_r_proto" in
10832	define)
10833	case "$endpwent_r_proto" in
10834	''|0) try='int endpwent_r(FILE**);'
10835	./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10836	esac
10837	case "$endpwent_r_proto" in
10838	''|0) try='void endpwent_r(FILE**);'
10839	./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10840	esac
10841	case "$endpwent_r_proto" in
10842	''|0)	d_endpwent_r=undef
10843 	        endpwent_r_proto=0
10844		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10845	* )	case "$endpwent_r_proto" in
10846		REENTRANT_PROTO*) ;;
10847		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10848		esac
10849		echo "Prototype: $try" ;;
10850	esac
10851	;;
10852	*)	case "$usethreads" in
10853		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10854		esac
10855		d_endpwent_r=undef
10856		endpwent_r_proto=0
10857		;;
10858	esac
10859	;;
10860*)	endpwent_r_proto=0
10861	;;
10862esac
10863
10864: see if endservent exists
10865set endservent d_endsent
10866eval $inlibc
10867
10868: see if endservent_r exists
10869set endservent_r d_endservent_r
10870eval $inlibc
10871case "$d_endservent_r" in
10872"$define")
10873	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10874	case "$d_endservent_r_proto:$usethreads" in
10875	":define")	d_endservent_r_proto=define
10876		set d_endservent_r_proto endservent_r $hdrs
10877		eval $hasproto ;;
10878	*)	;;
10879	esac
10880	case "$d_endservent_r_proto" in
10881	define)
10882	case "$endservent_r_proto" in
10883	''|0) try='int endservent_r(struct servent_data*);'
10884	./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10885	esac
10886	case "$endservent_r_proto" in
10887	''|0) try='void endservent_r(struct servent_data*);'
10888	./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10889	esac
10890	case "$endservent_r_proto" in
10891	''|0)	d_endservent_r=undef
10892 	        endservent_r_proto=0
10893		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10894	* )	case "$endservent_r_proto" in
10895		REENTRANT_PROTO*) ;;
10896		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10897		esac
10898		echo "Prototype: $try" ;;
10899	esac
10900	;;
10901	*)	case "$usethreads" in
10902		define) echo "endservent_r has no prototype, not using it." >&4 ;;
10903		esac
10904		d_endservent_r=undef
10905		endservent_r_proto=0
10906		;;
10907	esac
10908	;;
10909*)	endservent_r_proto=0
10910	;;
10911esac
10912
10913: Locate the flags for 'open()'
10914echo " "
10915$cat >try.c <<'EOCP'
10916#include <sys/types.h>
10917#ifdef I_FCNTL
10918#include <fcntl.h>
10919#endif
10920#ifdef I_SYS_FILE
10921#include <sys/file.h>
10922#endif
10923int main() {
10924	if(O_RDONLY);
10925#ifdef O_TRUNC
10926	exit(0);
10927#else
10928	exit(1);
10929#endif
10930}
10931EOCP
10932: check sys/file.h first to get FREAD on Sun
10933if $test `./findhdr sys/file.h` && \
10934		set try -DI_SYS_FILE && eval $compile; then
10935	h_sysfile=true;
10936	echo "<sys/file.h> defines the O_* constants..." >&4
10937	if $run ./try; then
10938		echo "and you have the 3 argument form of open()." >&4
10939		val="$define"
10940	else
10941		echo "but not the 3 argument form of open().  Oh, well." >&4
10942		val="$undef"
10943	fi
10944elif $test `./findhdr fcntl.h` && \
10945		set try -DI_FCNTL && eval $compile; then
10946	h_fcntl=true;
10947	echo "<fcntl.h> defines the O_* constants..." >&4
10948	if $run ./try; then
10949		echo "and you have the 3 argument form of open()." >&4
10950		val="$define"
10951	else
10952		echo "but not the 3 argument form of open().  Oh, well." >&4
10953		val="$undef"
10954	fi
10955else
10956	val="$undef"
10957	echo "I can't find the O_* constant definitions!  You got problems." >&4
10958fi
10959set d_open3
10960eval $setvar
10961$rm -f try try.*
10962
10963: see which of string.h or strings.h is needed
10964echo " "
10965strings=`./findhdr string.h`
10966if $test "$strings" && $test -r "$strings"; then
10967	echo "Using <string.h> instead of <strings.h>." >&4
10968	val="$define"
10969else
10970	val="$undef"
10971	strings=`./findhdr strings.h`
10972	if $test "$strings" && $test -r "$strings"; then
10973		echo "Using <strings.h> instead of <string.h>." >&4
10974	else
10975		echo "No string header found -- You'll surely have problems." >&4
10976	fi
10977fi
10978set i_string
10979eval $setvar
10980case "$i_string" in
10981"$undef") strings=`./findhdr strings.h`;;
10982*)	  strings=`./findhdr string.h`;;
10983esac
10984
10985: see if this is a sys/file.h system
10986val=''
10987set sys/file.h val
10988eval $inhdr
10989
10990: do we need to include sys/file.h ?
10991case "$val" in
10992"$define")
10993	echo " "
10994	if $h_sysfile; then
10995		val="$define"
10996		echo "We'll be including <sys/file.h>." >&4
10997	else
10998		val="$undef"
10999		echo "We won't be including <sys/file.h>." >&4
11000	fi
11001	;;
11002*)
11003	h_sysfile=false
11004	;;
11005esac
11006set i_sysfile
11007eval $setvar
11008
11009: see if fcntl.h is there
11010val=''
11011set fcntl.h val
11012eval $inhdr
11013
11014: see if we can include fcntl.h
11015case "$val" in
11016"$define")
11017	echo " "
11018	if $h_fcntl; then
11019		val="$define"
11020		echo "We'll be including <fcntl.h>." >&4
11021	else
11022		val="$undef"
11023		if $h_sysfile; then
11024	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11025		else
11026			echo "We won't be including <fcntl.h>." >&4
11027		fi
11028	fi
11029	;;
11030*)
11031	h_fcntl=false
11032	val="$undef"
11033	;;
11034esac
11035set i_fcntl
11036eval $setvar
11037
11038: check for non-blocking I/O stuff
11039case "$h_sysfile" in
11040true) echo "#include <sys/file.h>" > head.c;;
11041*)
11042       case "$h_fcntl" in
11043       true) echo "#include <fcntl.h>" > head.c;;
11044       *) echo "#include <sys/fcntl.h>" > head.c;;
11045       esac
11046       ;;
11047esac
11048echo " "
11049echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11050case "$o_nonblock" in
11051'')
11052	$cat head.c > try.c
11053	$cat >>try.c <<EOCP
11054#include <stdio.h>
11055#include <stdlib.h>
11056#$i_fcntl I_FCNTL
11057#ifdef I_FCNTL
11058#include <fcntl.h>
11059#endif
11060int main() {
11061#ifdef O_NONBLOCK
11062	printf("O_NONBLOCK\n");
11063	exit(0);
11064#endif
11065#ifdef O_NDELAY
11066	printf("O_NDELAY\n");
11067	exit(0);
11068#endif
11069#ifdef FNDELAY
11070	printf("FNDELAY\n");
11071	exit(0);
11072#endif
11073	exit(0);
11074}
11075EOCP
11076	set try
11077	if eval $compile_ok; then
11078		o_nonblock=`$run ./try`
11079		case "$o_nonblock" in
11080		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11081		*) echo "Seems like we can use $o_nonblock.";;
11082		esac
11083	else
11084		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11085	fi
11086	;;
11087*) echo "Using $hint value $o_nonblock.";;
11088esac
11089$rm -f try try.* .out core
11090
11091echo " "
11092echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11093case "$eagain" in
11094'')
11095	$cat head.c > try.c
11096	$cat >>try.c <<EOCP
11097#include <errno.h>
11098#include <sys/types.h>
11099#include <signal.h>
11100#include <stdio.h> 
11101#include <stdlib.h> 
11102#$i_fcntl I_FCNTL
11103#ifdef I_FCNTL
11104#include <fcntl.h>
11105#endif
11106#define MY_O_NONBLOCK $o_nonblock
11107#ifndef errno  /* XXX need better Configure test */
11108extern int errno;
11109#endif
11110#$i_unistd I_UNISTD
11111#ifdef I_UNISTD
11112#include <unistd.h>
11113#endif
11114#$i_string I_STRING
11115#ifdef I_STRING
11116#include <string.h>
11117#else
11118#include <strings.h>
11119#endif
11120$signal_t blech(x) int x; { exit(3); }
11121EOCP
11122	$cat >> try.c <<'EOCP'
11123int main()
11124{
11125	int pd[2];
11126	int pu[2];
11127	char buf[1];
11128	char string[100];
11129
11130	pipe(pd);	/* Down: child -> parent */
11131	pipe(pu);	/* Up: parent -> child */
11132	if (0 != fork()) {
11133		int ret;
11134		close(pd[1]);	/* Parent reads from pd[0] */
11135		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
11136#ifdef F_SETFL
11137		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11138			exit(1);
11139#else
11140		exit(4);
11141#endif
11142		signal(SIGALRM, blech);
11143		alarm(5);
11144		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
11145			exit(2);
11146		sprintf(string, "%d\n", ret);
11147		write(2, string, strlen(string));
11148		alarm(0);
11149#ifdef EAGAIN
11150		if (errno == EAGAIN) {
11151			printf("EAGAIN\n");
11152			goto ok;
11153		}
11154#endif
11155#ifdef EWOULDBLOCK
11156		if (errno == EWOULDBLOCK)
11157			printf("EWOULDBLOCK\n");
11158#endif
11159	ok:
11160		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
11161		sleep(2);				/* Give it time to close our pipe */
11162		alarm(5);
11163		ret = read(pd[0], buf, 1);	/* Should read EOF */
11164		alarm(0);
11165		sprintf(string, "%d\n", ret);
11166		write(4, string, strlen(string));
11167		exit(0);
11168	}
11169
11170	close(pd[0]);			/* We write to pd[1] */
11171	close(pu[1]);			/* We read from pu[0] */
11172	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
11173	close(pd[1]);			/* Pipe pd is now fully closed! */
11174	exit(0);				/* Bye bye, thank you for playing! */
11175}
11176EOCP
11177	set try
11178	if eval $compile_ok; then
11179		echo "$startsh" >mtry
11180		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11181		chmod +x mtry
11182		./mtry >/dev/null 2>&1
11183		case $? in
11184		0) eagain=`$cat try.out`;;
11185		1) echo "Could not perform non-blocking setting!";;
11186		2) echo "I did a successful read() for something that was not there!";;
11187		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11188		4) echo "Could not find F_SETFL!";;
11189		*) echo "Something terribly wrong happened during testing.";;
11190		esac
11191		rd_nodata=`$cat try.ret`
11192		echo "A read() system call with no data present returns $rd_nodata."
11193		case "$rd_nodata" in
11194		0|-1) ;;
11195		*)
11196			echo "(That's peculiar, fixing that to be -1.)"
11197			rd_nodata=-1
11198			;;
11199		esac
11200		case "$eagain" in
11201		'')
11202			echo "Forcing errno EAGAIN on read() with no data available."
11203			eagain=EAGAIN
11204			;;
11205		*)
11206			echo "Your read() sets errno to $eagain when no data is available."
11207			;;
11208		esac
11209		status=`$cat try.err`
11210		case "$status" in
11211		0) echo "And it correctly returns 0 to signal EOF.";;
11212		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
11213		*) echo "However, your read() returns '$status' on EOF??";;
11214		esac
11215		val="$define"
11216		if test "$status" = "$rd_nodata"; then
11217			echo "WARNING: you can't distinguish between EOF and no data!"
11218			val="$undef"
11219		fi
11220	else
11221		echo "I can't compile the test program--assuming errno EAGAIN will do."
11222		eagain=EAGAIN
11223	fi
11224	set d_eofnblk
11225	eval $setvar
11226	;;
11227*)
11228	echo "Using $hint value $eagain."
11229	echo "Your read() returns $rd_nodata when no data is present."
11230	case "$d_eofnblk" in
11231	"$define") echo "And you can see EOF because read() returns 0.";;
11232	"$undef") echo "But you can't see EOF status from read() returned value.";;
11233	*)
11234		echo "(Assuming you can't see EOF status from read anyway.)"
11235		d_eofnblk=$undef
11236		;;
11237	esac
11238	;;
11239esac
11240$rm -f try try.* .out core head.c mtry
11241
11242: see if fchdir exists
11243set fchdir d_fchdir
11244eval $inlibc
11245
11246: see if fchmod exists
11247set fchmod d_fchmod
11248eval $inlibc
11249
11250: see if fchown exists
11251set fchown d_fchown
11252eval $inlibc
11253
11254: see if this is an fcntl system
11255set fcntl d_fcntl
11256eval $inlibc
11257
11258echo " "
11259: See if fcntl-based locking works.
11260$cat >try.c <<EOCP
11261#include <stdlib.h>
11262#include <unistd.h>
11263#include <fcntl.h>
11264#include <signal.h>
11265$signal_t blech(x) int x; { exit(3); }
11266int main() {
11267#if defined(F_SETLK) && defined(F_SETLKW)
11268     struct flock flock;
11269     int retval, fd;
11270     fd = open("try.c", O_RDONLY);
11271     flock.l_type = F_RDLCK;
11272     flock.l_whence = SEEK_SET;
11273     flock.l_start = flock.l_len = 0;
11274     signal(SIGALRM, blech);
11275     alarm(10);
11276     retval = fcntl(fd, F_SETLK, &flock);
11277     close(fd);
11278     (retval < 0 ? exit(2) : exit(0));
11279#else
11280     exit(2);
11281#endif
11282}
11283EOCP
11284echo "Checking if fcntl-based file locking works... "
11285case "$d_fcntl" in
11286"$define")
11287	set try
11288	if eval $compile_ok; then
11289		if $run ./try; then
11290			echo "Yes, it seems to work."
11291			val="$define"
11292		else
11293			echo "Nope, it didn't work."
11294			val="$undef"
11295			case "$?" in
11296			3) $cat >&4 <<EOM
11297***
11298*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11299*** This is (almost) impossible.
11300*** If your NFS lock daemons are not feeling well, something like
11301*** this may happen, please investigate.  Cannot continue, aborting.
11302***
11303EOM
11304				exit 1
11305				;;
11306			esac
11307		fi
11308	else
11309		echo "I'm unable to compile the test program, so I'll assume not."
11310		val="$undef"
11311	fi
11312	;;
11313*) val="$undef";
11314	echo "Nope, since you don't even have fcntl()."
11315	;;
11316esac
11317set d_fcntl_can_lock
11318eval $setvar
11319$rm -f try*
11320
11321
11322: check for fd_set items
11323$cat <<EOM
11324
11325Checking to see how well your C compiler handles fd_set and friends ...
11326EOM
11327$cat >try.c <<EOCP
11328#$i_systime I_SYS_TIME
11329#$i_sysselct I_SYS_SELECT
11330#$d_socket HAS_SOCKET
11331#include <sys/types.h>
11332#ifdef HAS_SOCKET
11333#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11334#endif
11335#ifdef I_SYS_TIME
11336#include <sys/time.h>
11337#endif
11338#ifdef I_SYS_SELECT
11339#include <sys/select.h>
11340#endif
11341int main() {
11342	fd_set fds;
11343
11344#ifdef TRYBITS
11345	if(fds.fds_bits);
11346#endif
11347
11348#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11349	exit(0);
11350#else
11351	exit(1);
11352#endif
11353}
11354EOCP
11355set try -DTRYBITS
11356if eval $compile; then
11357	d_fds_bits="$define"
11358	d_fd_set="$define"
11359	echo "Well, your system knows about the normal fd_set typedef..." >&4
11360	if $run ./try; then
11361		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11362		d_fd_macros="$define"
11363	else
11364		$cat >&4 <<'EOM'
11365but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11366EOM
11367		d_fd_macros="$undef"
11368	fi
11369else
11370	$cat <<'EOM'
11371Hmm, your compiler has some difficulty with fd_set.  Checking further...
11372EOM
11373	set try
11374	if eval $compile; then
11375		d_fds_bits="$undef"
11376		d_fd_set="$define"
11377		echo "Well, your system has some sort of fd_set available..." >&4
11378		if $run ./try; then
11379			echo "and you have the normal fd_set macros." >&4
11380			d_fd_macros="$define"
11381		else
11382			$cat <<'EOM'
11383but not the normal fd_set macros!  Gross!  More work for me...
11384EOM
11385			d_fd_macros="$undef"
11386		fi
11387	else
11388	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11389		d_fd_set="$undef"
11390		d_fds_bits="$undef"
11391		d_fd_macros="$undef"
11392	fi
11393fi
11394$rm -f try try.*
11395
11396: see if fgetpos exists
11397set fgetpos d_fgetpos
11398eval $inlibc
11399
11400: see if finite exists
11401set finite d_finite
11402eval $inlibc
11403
11404: see if finitel exists
11405set finitel d_finitel
11406eval $inlibc
11407
11408: see if flock exists
11409set flock d_flock
11410eval $inlibc
11411
11412: see if prototype for flock is available
11413echo " "
11414set d_flockproto flock $i_sysfile sys/file.h
11415eval $hasproto
11416
11417: see if fork exists
11418set fork d_fork
11419eval $inlibc
11420
11421: see if fp_class exists
11422set fp_class d_fp_class
11423eval $inlibc
11424
11425: see if pathconf exists
11426set pathconf d_pathconf
11427eval $inlibc
11428
11429: see if fpathconf exists
11430set fpathconf d_fpathconf
11431eval $inlibc
11432
11433: see if fpclass exists
11434set fpclass d_fpclass
11435eval $inlibc
11436
11437: see if fpclassify exists
11438set fpclassify d_fpclassify
11439eval $inlibc
11440
11441: see if fpclassl exists
11442set fpclassl d_fpclassl
11443eval $inlibc
11444
11445
11446: check for fpos64_t
11447echo " "
11448echo "Checking to see if you have fpos64_t..." >&4
11449$cat >try.c <<EOCP
11450#include <stdio.h>
11451int main() { fpos64_t x = 7; }
11452EOCP
11453set try
11454if eval $compile; then
11455	val="$define"
11456	echo "You have fpos64_t."
11457else
11458	val="$undef"
11459	echo "You do not have fpos64_t."
11460	case "$fpossize" in
11461	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11462	esac
11463fi
11464$rm -f try.* try
11465set d_fpos64_t
11466eval $setvar
11467
11468: see if frexpl exists
11469set frexpl d_frexpl
11470eval $inlibc
11471
11472: see if this is a sys/param system
11473set sys/param.h i_sysparam
11474eval $inhdr
11475
11476: see if this is a sys/mount.h system
11477set sys/mount.h i_sysmount
11478eval $inhdr
11479
11480
11481echo " "
11482echo "Checking to see if your system supports struct fs_data..." >&4
11483set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11484eval $hasstruct
11485case "$d_fs_data_s" in
11486"$define")      echo "Yes, it does."   ;;
11487*)              echo "No, it doesn't." ;;
11488esac
11489
11490: see if fseeko exists
11491set fseeko d_fseeko
11492eval $inlibc
11493case "$longsize" in
114948) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11495esac
11496
11497: see if fsetpos exists
11498set fsetpos d_fsetpos
11499eval $inlibc
11500
11501
11502: see if fstatfs exists
11503set fstatfs d_fstatfs
11504eval $inlibc
11505
11506
11507: see if statvfs exists
11508set statvfs d_statvfs
11509eval $inlibc
11510
11511: see if fstatvfs exists
11512set fstatvfs d_fstatvfs
11513eval $inlibc
11514
11515
11516: see if fsync exists
11517set fsync d_fsync
11518eval $inlibc
11519
11520: see if ftello exists
11521set ftello d_ftello
11522eval $inlibc
11523case "$longsize" in
115248) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11525esac
11526
11527: see if getcwd exists
11528set getcwd d_getcwd
11529eval $inlibc
11530
11531: see if getespwnam exists
11532set getespwnam d_getespwnam
11533eval $inlibc
11534
11535
11536: see if getfsstat exists
11537set getfsstat d_getfsstat
11538eval $inlibc
11539
11540: see if getgrent exists
11541set getgrent d_getgrent
11542eval $inlibc
11543
11544: see if getgrent_r exists
11545set getgrent_r d_getgrent_r
11546eval $inlibc
11547case "$d_getgrent_r" in
11548"$define")
11549	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11550	case "$d_getgrent_r_proto:$usethreads" in
11551	":define")	d_getgrent_r_proto=define
11552		set d_getgrent_r_proto getgrent_r $hdrs
11553		eval $hasproto ;;
11554	*)	;;
11555	esac
11556	case "$d_getgrent_r_proto" in
11557	define)
11558	case "$getgrent_r_proto" in
11559	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11560	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11561	esac
11562	case "$getgrent_r_proto" in
11563	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11564	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11565	esac
11566	case "$getgrent_r_proto" in
11567	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11568	./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11569	esac
11570	case "$getgrent_r_proto" in
11571	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11572	./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11573	esac
11574	case "$getgrent_r_proto" in
11575	''|0) try='int getgrent_r(struct group*, char*, int);'
11576	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11577	esac
11578	case "$getgrent_r_proto" in
11579	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11580	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11581	esac
11582	case "$getgrent_r_proto" in
11583	''|0)	d_getgrent_r=undef
11584 	        getgrent_r_proto=0
11585		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11586	* )	case "$getgrent_r_proto" in
11587		REENTRANT_PROTO*) ;;
11588		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11589		esac
11590		echo "Prototype: $try" ;;
11591	esac
11592	;;
11593	*)	case "$usethreads" in
11594		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11595		esac
11596		d_getgrent_r=undef
11597		getgrent_r_proto=0
11598		;;
11599	esac
11600	;;
11601*)	getgrent_r_proto=0
11602	;;
11603esac
11604
11605: see if getgrgid_r exists
11606set getgrgid_r d_getgrgid_r
11607eval $inlibc
11608case "$d_getgrgid_r" in
11609"$define")
11610	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11611	case "$d_getgrgid_r_proto:$usethreads" in
11612	":define")	d_getgrgid_r_proto=define
11613		set d_getgrgid_r_proto getgrgid_r $hdrs
11614		eval $hasproto ;;
11615	*)	;;
11616	esac
11617	case "$d_getgrgid_r_proto" in
11618	define)
11619	case "$getgrgid_r_proto" in
11620	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11621	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11622	esac
11623	case "$getgrgid_r_proto" in
11624	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11625	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11626	esac
11627	case "$getgrgid_r_proto" in
11628	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11629	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11630	esac
11631	case "$getgrgid_r_proto" in
11632	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11633	./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11634	esac
11635	case "$getgrgid_r_proto" in
11636	''|0)	d_getgrgid_r=undef
11637 	        getgrgid_r_proto=0
11638		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11639	* )	case "$getgrgid_r_proto" in
11640		REENTRANT_PROTO*) ;;
11641		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11642		esac
11643		echo "Prototype: $try" ;;
11644	esac
11645	;;
11646	*)	case "$usethreads" in
11647		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11648		esac
11649		d_getgrgid_r=undef
11650		getgrgid_r_proto=0
11651		;;
11652	esac
11653	;;
11654*)	getgrgid_r_proto=0
11655	;;
11656esac
11657
11658: see if getgrnam_r exists
11659set getgrnam_r d_getgrnam_r
11660eval $inlibc
11661case "$d_getgrnam_r" in
11662"$define")
11663	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11664	case "$d_getgrnam_r_proto:$usethreads" in
11665	":define")	d_getgrnam_r_proto=define
11666		set d_getgrnam_r_proto getgrnam_r $hdrs
11667		eval $hasproto ;;
11668	*)	;;
11669	esac
11670	case "$d_getgrnam_r_proto" in
11671	define)
11672	case "$getgrnam_r_proto" in
11673	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11674	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11675	esac
11676	case "$getgrnam_r_proto" in
11677	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11678	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11679	esac
11680	case "$getgrnam_r_proto" in
11681	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11682	./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11683	esac
11684	case "$getgrnam_r_proto" in
11685	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11686	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11687	esac
11688	case "$getgrnam_r_proto" in
11689	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11690	./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11691	esac
11692	case "$getgrnam_r_proto" in
11693	''|0)	d_getgrnam_r=undef
11694 	        getgrnam_r_proto=0
11695		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11696	* )	case "$getgrnam_r_proto" in
11697		REENTRANT_PROTO*) ;;
11698		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11699		esac
11700		echo "Prototype: $try" ;;
11701	esac
11702	;;
11703	*)	case "$usethreads" in
11704		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11705		esac
11706		d_getgrnam_r=undef
11707		getgrnam_r_proto=0
11708		;;
11709	esac
11710	;;
11711*)	getgrnam_r_proto=0
11712	;;
11713esac
11714
11715: see if gethostbyaddr exists
11716set gethostbyaddr d_gethbyaddr
11717eval $inlibc
11718
11719: see if gethostbyname exists
11720set gethostbyname d_gethbyname
11721eval $inlibc
11722
11723: see if gethostent exists
11724set gethostent d_gethent
11725eval $inlibc
11726
11727: see how we will look up host name
11728echo " "
11729call=''
11730if set gethostname val -f d_gethname; eval $csym; $val; then
11731	echo 'gethostname() found.' >&4
11732	d_gethname="$define"
11733	call=gethostname
11734fi
11735if set uname val -f d_uname; eval $csym; $val; then
11736	if ./xenix; then
11737		$cat <<'EOM'
11738uname() was found, but you're running xenix, and older versions of xenix
11739have a broken uname(). If you don't really know whether your xenix is old
11740enough to have a broken system call, use the default answer.
11741
11742EOM
11743		dflt=y
11744		case "$d_uname" in
11745		"$define") dflt=n;;
11746		esac
11747		rp='Is your uname() broken?'
11748		. ./myread
11749		case "$ans" in
11750		n*) d_uname="$define"; call=uname;;
11751		esac
11752	else
11753		echo 'uname() found.' >&4
11754		d_uname="$define"
11755		case "$call" in
11756		'') call=uname ;;
11757		esac
11758	fi
11759fi
11760case "$d_gethname" in
11761'') d_gethname="$undef";;
11762esac
11763case "$d_uname" in
11764'') d_uname="$undef";;
11765esac
11766case "$d_uname$d_gethname" in
11767*define*)
11768	dflt=n
11769	cat <<EOM
11770
11771Every now and then someone has a $call() that lies about the hostname
11772but can't be fixed for political or economic reasons.  If you wish, I can
11773pretend $call() isn't there and maybe compute hostname at run-time
11774thanks to the '$phostname' command.
11775
11776EOM
11777	rp="Shall I ignore $call() from now on?"
11778	. ./myread
11779	case "$ans" in
11780	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11781	esac;;
11782esac
11783case "$phostname" in
11784'') aphostname='';;
11785*) case "$aphostname" in
11786	/*) ;;
11787	*) set X $phostname
11788		shift
11789		file=$1
11790		shift
11791		file=`./loc $file $file $pth`
11792		aphostname=`echo $file $*`
11793		;;
11794	esac
11795	;;
11796esac
11797case "$d_uname$d_gethname" in
11798*define*) ;;
11799*)
11800	case "$phostname" in
11801	'')
11802		echo "There will be no way for $package to get your hostname." >&4;;
11803	*)
11804	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11805		;;
11806	esac;;
11807esac
11808case "$d_phostname" in
11809'') d_phostname="$undef";;
11810esac
11811
11812: see if gethostbyaddr_r exists
11813set gethostbyaddr_r d_gethostbyaddr_r
11814eval $inlibc
11815case "$d_gethostbyaddr_r" in
11816"$define")
11817	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11818	case "$d_gethostbyaddr_r_proto:$usethreads" in
11819	":define")	d_gethostbyaddr_r_proto=define
11820		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11821		eval $hasproto ;;
11822	*)	;;
11823	esac
11824	case "$d_gethostbyaddr_r_proto" in
11825	define)
11826	case "$gethostbyaddr_r_proto" in
11827	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11828	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11829	esac
11830	case "$gethostbyaddr_r_proto" in
11831	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11832	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11833	esac
11834	case "$gethostbyaddr_r_proto" in
11835	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11836	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11837	esac
11838	case "$gethostbyaddr_r_proto" in
11839	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11840	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11841	esac
11842	case "$gethostbyaddr_r_proto" in
11843	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11844	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11845	esac
11846	case "$gethostbyaddr_r_proto" in
11847	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11848	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11849	esac
11850	case "$gethostbyaddr_r_proto" in
11851	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11852	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11853	esac
11854	case "$gethostbyaddr_r_proto" in
11855	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11856	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11857	esac
11858	case "$gethostbyaddr_r_proto" in
11859	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11860	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11861	esac
11862	case "$gethostbyaddr_r_proto" in
11863	''|0) try='int gethostbyaddr_r(const char*, int, int);'
11864	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11865	esac
11866	case "$gethostbyaddr_r_proto" in
11867	''|0)	d_gethostbyaddr_r=undef
11868 	        gethostbyaddr_r_proto=0
11869		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11870	* )	case "$gethostbyaddr_r_proto" in
11871		REENTRANT_PROTO*) ;;
11872		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11873		esac
11874		echo "Prototype: $try" ;;
11875	esac
11876	;;
11877	*)	case "$usethreads" in
11878		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11879		esac
11880		d_gethostbyaddr_r=undef
11881		gethostbyaddr_r_proto=0
11882		;;
11883	esac
11884	;;
11885*)	gethostbyaddr_r_proto=0
11886	;;
11887esac
11888
11889: see if gethostbyname_r exists
11890set gethostbyname_r d_gethostbyname_r
11891eval $inlibc
11892case "$d_gethostbyname_r" in
11893"$define")
11894	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11895	case "$d_gethostbyname_r_proto:$usethreads" in
11896	":define")	d_gethostbyname_r_proto=define
11897		set d_gethostbyname_r_proto gethostbyname_r $hdrs
11898		eval $hasproto ;;
11899	*)	;;
11900	esac
11901	case "$d_gethostbyname_r_proto" in
11902	define)
11903	case "$gethostbyname_r_proto" in
11904	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11905	./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11906	esac
11907	case "$gethostbyname_r_proto" in
11908	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11909	./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11910	esac
11911	case "$gethostbyname_r_proto" in
11912	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11913	./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11914	esac
11915	case "$gethostbyname_r_proto" in
11916	''|0)	d_gethostbyname_r=undef
11917 	        gethostbyname_r_proto=0
11918		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11919	* )	case "$gethostbyname_r_proto" in
11920		REENTRANT_PROTO*) ;;
11921		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11922		esac
11923		echo "Prototype: $try" ;;
11924	esac
11925	;;
11926	*)	case "$usethreads" in
11927		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11928		esac
11929		d_gethostbyname_r=undef
11930		gethostbyname_r_proto=0
11931		;;
11932	esac
11933	;;
11934*)	gethostbyname_r_proto=0
11935	;;
11936esac
11937
11938: see if gethostent_r exists
11939set gethostent_r d_gethostent_r
11940eval $inlibc
11941case "$d_gethostent_r" in
11942"$define")
11943	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11944	case "$d_gethostent_r_proto:$usethreads" in
11945	":define")	d_gethostent_r_proto=define
11946		set d_gethostent_r_proto gethostent_r $hdrs
11947		eval $hasproto ;;
11948	*)	;;
11949	esac
11950	case "$d_gethostent_r_proto" in
11951	define)
11952	case "$gethostent_r_proto" in
11953	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11954	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11955	esac
11956	case "$gethostent_r_proto" in
11957	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11958	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11959	esac
11960	case "$gethostent_r_proto" in
11961	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11962	./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11963	esac
11964	case "$gethostent_r_proto" in
11965	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11966	./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11967	esac
11968	case "$gethostent_r_proto" in
11969	''|0) try='int gethostent_r(struct hostent*, char*, int);'
11970	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11971	esac
11972	case "$gethostent_r_proto" in
11973	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11974	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11975	esac
11976	case "$gethostent_r_proto" in
11977	''|0)	d_gethostent_r=undef
11978 	        gethostent_r_proto=0
11979		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11980	* )	case "$gethostent_r_proto" in
11981		REENTRANT_PROTO*) ;;
11982		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11983		esac
11984		echo "Prototype: $try" ;;
11985	esac
11986	;;
11987	*)	case "$usethreads" in
11988		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11989		esac
11990		d_gethostent_r=undef
11991		gethostent_r_proto=0
11992		;;
11993	esac
11994	;;
11995*)	gethostent_r_proto=0
11996	;;
11997esac
11998
11999: see if prototypes for various gethostxxx netdb.h functions are available
12000echo " "
12001set d_gethostprotos gethostent $i_netdb netdb.h
12002eval $hasproto
12003
12004: see if getitimer exists
12005set getitimer d_getitimer
12006eval $inlibc
12007
12008: see if getlogin exists
12009set getlogin d_getlogin
12010eval $inlibc
12011
12012: see if getlogin_r exists
12013set getlogin_r d_getlogin_r
12014eval $inlibc
12015case "$d_getlogin_r" in
12016"$define")
12017	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12018	case "$d_getlogin_r_proto:$usethreads" in
12019	":define")	d_getlogin_r_proto=define
12020		set d_getlogin_r_proto getlogin_r $hdrs
12021		eval $hasproto ;;
12022	*)	;;
12023	esac
12024	case "$d_getlogin_r_proto" in
12025	define)
12026	case "$getlogin_r_proto" in
12027	''|0) try='int getlogin_r(char*, size_t);'
12028	./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12029	esac
12030	case "$getlogin_r_proto" in
12031	''|0) try='int getlogin_r(char*, int);'
12032	./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12033	esac
12034	case "$getlogin_r_proto" in
12035	''|0) try='char* getlogin_r(char*, size_t);'
12036	./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12037	esac
12038	case "$getlogin_r_proto" in
12039	''|0) try='char* getlogin_r(char*, int);'
12040	./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12041	esac
12042	case "$getlogin_r_proto" in
12043	''|0)	d_getlogin_r=undef
12044 	        getlogin_r_proto=0
12045		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12046	* )	case "$getlogin_r_proto" in
12047		REENTRANT_PROTO*) ;;
12048		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12049		esac
12050		echo "Prototype: $try" ;;
12051	esac
12052	;;
12053	*)	case "$usethreads" in
12054		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12055		esac
12056		d_getlogin_r=undef
12057		getlogin_r_proto=0
12058		;;
12059	esac
12060	;;
12061*)	getlogin_r_proto=0
12062	;;
12063esac
12064
12065: see if getmnt exists
12066set getmnt d_getmnt
12067eval $inlibc
12068
12069: see if getmntent exists
12070set getmntent d_getmntent
12071eval $inlibc
12072
12073: see if getnetbyaddr exists
12074set getnetbyaddr d_getnbyaddr
12075eval $inlibc
12076
12077: see if getnetbyname exists
12078set getnetbyname d_getnbyname
12079eval $inlibc
12080
12081: see if getnetent exists
12082set getnetent d_getnent
12083eval $inlibc
12084
12085: see if getnetbyaddr_r exists
12086set getnetbyaddr_r d_getnetbyaddr_r
12087eval $inlibc
12088case "$d_getnetbyaddr_r" in
12089"$define")
12090	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12091	case "$d_getnetbyaddr_r_proto:$usethreads" in
12092	":define")	d_getnetbyaddr_r_proto=define
12093		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12094		eval $hasproto ;;
12095	*)	;;
12096	esac
12097	case "$d_getnetbyaddr_r_proto" in
12098	define)
12099	case "$getnetbyaddr_r_proto" in
12100	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12101	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12102	esac
12103	case "$getnetbyaddr_r_proto" in
12104	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12105	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12106	esac
12107	case "$getnetbyaddr_r_proto" in
12108	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12109	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12110	esac
12111	case "$getnetbyaddr_r_proto" in
12112	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12113	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12114	esac
12115	case "$getnetbyaddr_r_proto" in
12116	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12117	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12118	esac
12119	case "$getnetbyaddr_r_proto" in
12120	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12121	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12122	esac
12123	case "$getnetbyaddr_r_proto" in
12124	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12125	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12126	esac
12127	case "$getnetbyaddr_r_proto" in
12128	''|0)	d_getnetbyaddr_r=undef
12129 	        getnetbyaddr_r_proto=0
12130		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12131	* )	case "$getnetbyaddr_r_proto" in
12132		REENTRANT_PROTO*) ;;
12133		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12134		esac
12135		echo "Prototype: $try" ;;
12136	esac
12137	;;
12138	*)	case "$usethreads" in
12139		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12140		esac
12141		d_getnetbyaddr_r=undef
12142		getnetbyaddr_r_proto=0
12143		;;
12144	esac
12145	;;
12146*)	getnetbyaddr_r_proto=0
12147	;;
12148esac
12149
12150: see if getnetbyname_r exists
12151set getnetbyname_r d_getnetbyname_r
12152eval $inlibc
12153case "$d_getnetbyname_r" in
12154"$define")
12155	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12156	case "$d_getnetbyname_r_proto:$usethreads" in
12157	":define")	d_getnetbyname_r_proto=define
12158		set d_getnetbyname_r_proto getnetbyname_r $hdrs
12159		eval $hasproto ;;
12160	*)	;;
12161	esac
12162	case "$d_getnetbyname_r_proto" in
12163	define)
12164	case "$getnetbyname_r_proto" in
12165	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12166	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12167	esac
12168	case "$getnetbyname_r_proto" in
12169	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12170	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12171	esac
12172	case "$getnetbyname_r_proto" in
12173	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12174	./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12175	esac
12176	case "$getnetbyname_r_proto" in
12177	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12178	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12179	esac
12180	case "$getnetbyname_r_proto" in
12181	''|0)	d_getnetbyname_r=undef
12182 	        getnetbyname_r_proto=0
12183		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12184	* )	case "$getnetbyname_r_proto" in
12185		REENTRANT_PROTO*) ;;
12186		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12187		esac
12188		echo "Prototype: $try" ;;
12189	esac
12190	;;
12191	*)	case "$usethreads" in
12192		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12193		esac
12194		d_getnetbyname_r=undef
12195		getnetbyname_r_proto=0
12196		;;
12197	esac
12198	;;
12199*)	getnetbyname_r_proto=0
12200	;;
12201esac
12202
12203: see if getnetent_r exists
12204set getnetent_r d_getnetent_r
12205eval $inlibc
12206case "$d_getnetent_r" in
12207"$define")
12208	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12209	case "$d_getnetent_r_proto:$usethreads" in
12210	":define")	d_getnetent_r_proto=define
12211		set d_getnetent_r_proto getnetent_r $hdrs
12212		eval $hasproto ;;
12213	*)	;;
12214	esac
12215	case "$d_getnetent_r_proto" in
12216	define)
12217	case "$getnetent_r_proto" in
12218	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12219	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12220	esac
12221	case "$getnetent_r_proto" in
12222	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12223	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12224	esac
12225	case "$getnetent_r_proto" in
12226	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12227	./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12228	esac
12229	case "$getnetent_r_proto" in
12230	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12231	./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12232	esac
12233	case "$getnetent_r_proto" in
12234	''|0) try='int getnetent_r(struct netent*, char*, int);'
12235	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12236	esac
12237	case "$getnetent_r_proto" in
12238	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12239	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12240	esac
12241	case "$getnetent_r_proto" in
12242	''|0)	d_getnetent_r=undef
12243 	        getnetent_r_proto=0
12244		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12245	* )	case "$getnetent_r_proto" in
12246		REENTRANT_PROTO*) ;;
12247		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12248		esac
12249		echo "Prototype: $try" ;;
12250	esac
12251	;;
12252	*)	case "$usethreads" in
12253		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12254		esac
12255		d_getnetent_r=undef
12256		getnetent_r_proto=0
12257		;;
12258	esac
12259	;;
12260*)	getnetent_r_proto=0
12261	;;
12262esac
12263
12264: see if prototypes for various getnetxxx netdb.h functions are available
12265echo " "
12266set d_getnetprotos getnetent $i_netdb netdb.h
12267eval $hasproto
12268
12269: see if getpagesize exists
12270set getpagesize d_getpagsz
12271eval $inlibc
12272
12273
12274: see if getprotobyname exists
12275set getprotobyname d_getpbyname
12276eval $inlibc
12277
12278: see if getprotobynumber exists
12279set getprotobynumber d_getpbynumber
12280eval $inlibc
12281
12282: see if getprotoent exists
12283set getprotoent d_getpent
12284eval $inlibc
12285
12286: see if getpgid exists
12287set getpgid d_getpgid
12288eval $inlibc
12289
12290: see if getpgrp2 exists
12291set getpgrp2 d_getpgrp2
12292eval $inlibc
12293
12294: see if getppid exists
12295set getppid d_getppid
12296eval $inlibc
12297
12298: see if getpriority exists
12299set getpriority d_getprior
12300eval $inlibc
12301
12302: see if getprotobyname_r exists
12303set getprotobyname_r d_getprotobyname_r
12304eval $inlibc
12305case "$d_getprotobyname_r" in
12306"$define")
12307	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12308	case "$d_getprotobyname_r_proto:$usethreads" in
12309	":define")	d_getprotobyname_r_proto=define
12310		set d_getprotobyname_r_proto getprotobyname_r $hdrs
12311		eval $hasproto ;;
12312	*)	;;
12313	esac
12314	case "$d_getprotobyname_r_proto" in
12315	define)
12316	case "$getprotobyname_r_proto" in
12317	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12318	./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12319	esac
12320	case "$getprotobyname_r_proto" in
12321	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12322	./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12323	esac
12324	case "$getprotobyname_r_proto" in
12325	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12326	./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12327	esac
12328	case "$getprotobyname_r_proto" in
12329	''|0)	d_getprotobyname_r=undef
12330 	        getprotobyname_r_proto=0
12331		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12332	* )	case "$getprotobyname_r_proto" in
12333		REENTRANT_PROTO*) ;;
12334		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12335		esac
12336		echo "Prototype: $try" ;;
12337	esac
12338	;;
12339	*)	case "$usethreads" in
12340		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12341		esac
12342		d_getprotobyname_r=undef
12343		getprotobyname_r_proto=0
12344		;;
12345	esac
12346	;;
12347*)	getprotobyname_r_proto=0
12348	;;
12349esac
12350
12351: see if getprotobynumber_r exists
12352set getprotobynumber_r d_getprotobynumber_r
12353eval $inlibc
12354case "$d_getprotobynumber_r" in
12355"$define")
12356	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12357	case "$d_getprotobynumber_r_proto:$usethreads" in
12358	":define")	d_getprotobynumber_r_proto=define
12359		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12360		eval $hasproto ;;
12361	*)	;;
12362	esac
12363	case "$d_getprotobynumber_r_proto" in
12364	define)
12365	case "$getprotobynumber_r_proto" in
12366	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12367	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12368	esac
12369	case "$getprotobynumber_r_proto" in
12370	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12371	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12372	esac
12373	case "$getprotobynumber_r_proto" in
12374	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12375	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12376	esac
12377	case "$getprotobynumber_r_proto" in
12378	''|0)	d_getprotobynumber_r=undef
12379 	        getprotobynumber_r_proto=0
12380		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12381	* )	case "$getprotobynumber_r_proto" in
12382		REENTRANT_PROTO*) ;;
12383		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12384		esac
12385		echo "Prototype: $try" ;;
12386	esac
12387	;;
12388	*)	case "$usethreads" in
12389		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12390		esac
12391		d_getprotobynumber_r=undef
12392		getprotobynumber_r_proto=0
12393		;;
12394	esac
12395	;;
12396*)	getprotobynumber_r_proto=0
12397	;;
12398esac
12399
12400: see if getprotoent_r exists
12401set getprotoent_r d_getprotoent_r
12402eval $inlibc
12403case "$d_getprotoent_r" in
12404"$define")
12405	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12406	case "$d_getprotoent_r_proto:$usethreads" in
12407	":define")	d_getprotoent_r_proto=define
12408		set d_getprotoent_r_proto getprotoent_r $hdrs
12409		eval $hasproto ;;
12410	*)	;;
12411	esac
12412	case "$d_getprotoent_r_proto" in
12413	define)
12414	case "$getprotoent_r_proto" in
12415	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12416	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12417	esac
12418	case "$getprotoent_r_proto" in
12419	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12420	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12421	esac
12422	case "$getprotoent_r_proto" in
12423	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12424	./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12425	esac
12426	case "$getprotoent_r_proto" in
12427	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12428	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12429	esac
12430	case "$getprotoent_r_proto" in
12431	''|0)	d_getprotoent_r=undef
12432 	        getprotoent_r_proto=0
12433		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12434	* )	case "$getprotoent_r_proto" in
12435		REENTRANT_PROTO*) ;;
12436		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12437		esac
12438		echo "Prototype: $try" ;;
12439	esac
12440	;;
12441	*)	case "$usethreads" in
12442		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12443		esac
12444		d_getprotoent_r=undef
12445		getprotoent_r_proto=0
12446		;;
12447	esac
12448	;;
12449*)	getprotoent_r_proto=0
12450	;;
12451esac
12452
12453: see if prototypes for various getprotoxxx netdb.h functions are available
12454echo " "
12455set d_getprotoprotos getprotoent $i_netdb netdb.h
12456eval $hasproto
12457
12458: see if getprpwnam exists
12459set getprpwnam d_getprpwnam
12460eval $inlibc
12461
12462: see if getpwent exists
12463set getpwent d_getpwent
12464eval $inlibc
12465
12466: see if getpwent_r exists
12467set getpwent_r d_getpwent_r
12468eval $inlibc
12469case "$d_getpwent_r" in
12470"$define")
12471	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12472	case "$d_getpwent_r_proto:$usethreads" in
12473	":define")	d_getpwent_r_proto=define
12474		set d_getpwent_r_proto getpwent_r $hdrs
12475		eval $hasproto ;;
12476	*)	;;
12477	esac
12478	case "$d_getpwent_r_proto" in
12479	define)
12480	case "$getpwent_r_proto" in
12481	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12482	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12483	esac
12484	case "$getpwent_r_proto" in
12485	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12486	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12487	esac
12488	case "$getpwent_r_proto" in
12489	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12490	./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12491	esac
12492	case "$getpwent_r_proto" in
12493	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12494	./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12495	esac
12496	case "$getpwent_r_proto" in
12497	''|0) try='int getpwent_r(struct passwd*, char*, int);'
12498	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12499	esac
12500	case "$getpwent_r_proto" in
12501	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12502	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12503	esac
12504	case "$getpwent_r_proto" in
12505	''|0)	d_getpwent_r=undef
12506 	        getpwent_r_proto=0
12507		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12508	* )	case "$getpwent_r_proto" in
12509		REENTRANT_PROTO*) ;;
12510		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12511		esac
12512		echo "Prototype: $try" ;;
12513	esac
12514	;;
12515	*)	case "$usethreads" in
12516		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12517		esac
12518		d_getpwent_r=undef
12519		getpwent_r_proto=0
12520		;;
12521	esac
12522	;;
12523*)	getpwent_r_proto=0
12524	;;
12525esac
12526
12527: see if getpwnam_r exists
12528set getpwnam_r d_getpwnam_r
12529eval $inlibc
12530case "$d_getpwnam_r" in
12531"$define")
12532	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12533	case "$d_getpwnam_r_proto:$usethreads" in
12534	":define")	d_getpwnam_r_proto=define
12535		set d_getpwnam_r_proto getpwnam_r $hdrs
12536		eval $hasproto ;;
12537	*)	;;
12538	esac
12539	case "$d_getpwnam_r_proto" in
12540	define)
12541	case "$getpwnam_r_proto" in
12542	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12543	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12544	esac
12545	case "$getpwnam_r_proto" in
12546	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12547	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12548	esac
12549	case "$getpwnam_r_proto" in
12550	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12551	./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12552	esac
12553	case "$getpwnam_r_proto" in
12554	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12555	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12556	esac
12557	case "$getpwnam_r_proto" in
12558	''|0)	d_getpwnam_r=undef
12559 	        getpwnam_r_proto=0
12560		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12561	* )	case "$getpwnam_r_proto" in
12562		REENTRANT_PROTO*) ;;
12563		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12564		esac
12565		echo "Prototype: $try" ;;
12566	esac
12567	;;
12568	*)	case "$usethreads" in
12569		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12570		esac
12571		d_getpwnam_r=undef
12572		getpwnam_r_proto=0
12573		;;
12574	esac
12575	;;
12576*)	getpwnam_r_proto=0
12577	;;
12578esac
12579
12580: see if getpwuid_r exists
12581set getpwuid_r d_getpwuid_r
12582eval $inlibc
12583case "$d_getpwuid_r" in
12584"$define")
12585	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12586	case "$d_getpwuid_r_proto:$usethreads" in
12587	":define")	d_getpwuid_r_proto=define
12588		set d_getpwuid_r_proto getpwuid_r $hdrs
12589		eval $hasproto ;;
12590	*)	;;
12591	esac
12592	case "$d_getpwuid_r_proto" in
12593	define)
12594	case "$getpwuid_r_proto" in
12595	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12596	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12597	esac
12598	case "$getpwuid_r_proto" in
12599	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12600	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12601	esac
12602	case "$getpwuid_r_proto" in
12603	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12604	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12605	esac
12606	case "$getpwuid_r_proto" in
12607	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12608	./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12609	esac
12610	case "$getpwuid_r_proto" in
12611	''|0)	d_getpwuid_r=undef
12612 	        getpwuid_r_proto=0
12613		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12614	* )	case "$getpwuid_r_proto" in
12615		REENTRANT_PROTO*) ;;
12616		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12617		esac
12618		echo "Prototype: $try" ;;
12619	esac
12620	;;
12621	*)	case "$usethreads" in
12622		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12623		esac
12624		d_getpwuid_r=undef
12625		getpwuid_r_proto=0
12626		;;
12627	esac
12628	;;
12629*)	getpwuid_r_proto=0
12630	;;
12631esac
12632
12633
12634: see if getservbyname exists
12635set getservbyname d_getsbyname
12636eval $inlibc
12637
12638: see if getservbyport exists
12639set getservbyport d_getsbyport
12640eval $inlibc
12641
12642: see if getservent exists
12643set getservent d_getsent
12644eval $inlibc
12645
12646: see if getservbyname_r exists
12647set getservbyname_r d_getservbyname_r
12648eval $inlibc
12649case "$d_getservbyname_r" in
12650"$define")
12651	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12652	case "$d_getservbyname_r_proto:$usethreads" in
12653	":define")	d_getservbyname_r_proto=define
12654		set d_getservbyname_r_proto getservbyname_r $hdrs
12655		eval $hasproto ;;
12656	*)	;;
12657	esac
12658	case "$d_getservbyname_r_proto" in
12659	define)
12660	case "$getservbyname_r_proto" in
12661	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12662	./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12663	esac
12664	case "$getservbyname_r_proto" in
12665	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12666	./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12667	esac
12668	case "$getservbyname_r_proto" in
12669	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12670	./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12671	esac
12672	case "$getservbyname_r_proto" in
12673	''|0)	d_getservbyname_r=undef
12674 	        getservbyname_r_proto=0
12675		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12676	* )	case "$getservbyname_r_proto" in
12677		REENTRANT_PROTO*) ;;
12678		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12679		esac
12680		echo "Prototype: $try" ;;
12681	esac
12682	;;
12683	*)	case "$usethreads" in
12684		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12685		esac
12686		d_getservbyname_r=undef
12687		getservbyname_r_proto=0
12688		;;
12689	esac
12690	;;
12691*)	getservbyname_r_proto=0
12692	;;
12693esac
12694
12695: see if getservbyport_r exists
12696set getservbyport_r d_getservbyport_r
12697eval $inlibc
12698case "$d_getservbyport_r" in
12699"$define")
12700	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12701	case "$d_getservbyport_r_proto:$usethreads" in
12702	":define")	d_getservbyport_r_proto=define
12703		set d_getservbyport_r_proto getservbyport_r $hdrs
12704		eval $hasproto ;;
12705	*)	;;
12706	esac
12707	case "$d_getservbyport_r_proto" in
12708	define)
12709	case "$getservbyport_r_proto" in
12710	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12711	./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12712	esac
12713	case "$getservbyport_r_proto" in
12714	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12715	./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12716	esac
12717	case "$getservbyport_r_proto" in
12718	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12719	./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12720	esac
12721	case "$getservbyport_r_proto" in
12722	''|0)	d_getservbyport_r=undef
12723 	        getservbyport_r_proto=0
12724		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12725	* )	case "$getservbyport_r_proto" in
12726		REENTRANT_PROTO*) ;;
12727		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12728		esac
12729		echo "Prototype: $try" ;;
12730	esac
12731	;;
12732	*)	case "$usethreads" in
12733		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12734		esac
12735		d_getservbyport_r=undef
12736		getservbyport_r_proto=0
12737		;;
12738	esac
12739	;;
12740*)	getservbyport_r_proto=0
12741	;;
12742esac
12743
12744: see if getservent_r exists
12745set getservent_r d_getservent_r
12746eval $inlibc
12747case "$d_getservent_r" in
12748"$define")
12749	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12750	case "$d_getservent_r_proto:$usethreads" in
12751	":define")	d_getservent_r_proto=define
12752		set d_getservent_r_proto getservent_r $hdrs
12753		eval $hasproto ;;
12754	*)	;;
12755	esac
12756	case "$d_getservent_r_proto" in
12757	define)
12758	case "$getservent_r_proto" in
12759	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12760	./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12761	esac
12762	case "$getservent_r_proto" in
12763	''|0) try='int getservent_r(struct servent*, char*, int);'
12764	./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12765	esac
12766	case "$getservent_r_proto" in
12767	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12768	./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12769	esac
12770	case "$getservent_r_proto" in
12771	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12772	./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12773	esac
12774	case "$getservent_r_proto" in
12775	''|0)	d_getservent_r=undef
12776 	        getservent_r_proto=0
12777		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12778	* )	case "$getservent_r_proto" in
12779		REENTRANT_PROTO*) ;;
12780		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12781		esac
12782		echo "Prototype: $try" ;;
12783	esac
12784	;;
12785	*)	case "$usethreads" in
12786		define) echo "getservent_r has no prototype, not using it." >&4 ;;
12787		esac
12788		d_getservent_r=undef
12789		getservent_r_proto=0
12790		;;
12791	esac
12792	;;
12793*)	getservent_r_proto=0
12794	;;
12795esac
12796
12797: see if prototypes for various getservxxx netdb.h functions are available
12798echo " "
12799set d_getservprotos getservent $i_netdb netdb.h
12800eval $hasproto
12801
12802: see if getspnam exists
12803set getspnam d_getspnam
12804eval $inlibc
12805
12806: see if this is a shadow.h system
12807set shadow.h i_shadow
12808eval $inhdr
12809
12810: see if getspnam_r exists
12811set getspnam_r d_getspnam_r
12812eval $inlibc
12813case "$d_getspnam_r" in
12814"$define")
12815	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12816	case "$d_getspnam_r_proto:$usethreads" in
12817	":define")	d_getspnam_r_proto=define
12818		set d_getspnam_r_proto getspnam_r $hdrs
12819		eval $hasproto ;;
12820	*)	;;
12821	esac
12822	case "$d_getspnam_r_proto" in
12823	define)
12824	case "$getspnam_r_proto" in
12825	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12826	./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12827	esac
12828	case "$getspnam_r_proto" in
12829	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12830	./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12831	esac
12832	case "$getspnam_r_proto" in
12833	''|0)	d_getspnam_r=undef
12834 	        getspnam_r_proto=0
12835		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12836	* )	case "$getspnam_r_proto" in
12837		REENTRANT_PROTO*) ;;
12838		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12839		esac
12840		echo "Prototype: $try" ;;
12841	esac
12842	;;
12843	*)	case "$usethreads" in
12844		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12845		esac
12846		d_getspnam_r=undef
12847		getspnam_r_proto=0
12848		;;
12849	esac
12850	;;
12851*)	getspnam_r_proto=0
12852	;;
12853esac
12854
12855: see if gettimeofday or ftime exists
12856set gettimeofday d_gettimeod
12857eval $inlibc
12858case "$d_gettimeod" in
12859"$undef")
12860	set ftime d_ftime
12861	eval $inlibc
12862	;;
12863*)
12864	val="$undef"; set d_ftime; eval $setvar
12865	;;
12866esac
12867case "$d_gettimeod$d_ftime" in
12868"$undef$undef")
12869	echo " "
12870	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12871	;;
12872esac
12873
12874: see if gmtime_r exists
12875set gmtime_r d_gmtime_r
12876eval $inlibc
12877case "$d_gmtime_r" in
12878"$define")
12879	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12880	case "$d_gmtime_r_proto:$usethreads" in
12881	":define")	d_gmtime_r_proto=define
12882		set d_gmtime_r_proto gmtime_r $hdrs
12883		eval $hasproto ;;
12884	*)	;;
12885	esac
12886	case "$d_gmtime_r_proto" in
12887	define)
12888	case "$gmtime_r_proto" in
12889	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12890	./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12891	esac
12892	case "$gmtime_r_proto" in
12893	''|0) try='int gmtime_r(const time_t*, struct tm*);'
12894	./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12895	esac
12896	case "$gmtime_r_proto" in
12897	''|0)	d_gmtime_r=undef
12898 	        gmtime_r_proto=0
12899		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12900	* )	case "$gmtime_r_proto" in
12901		REENTRANT_PROTO*) ;;
12902		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12903		esac
12904		echo "Prototype: $try" ;;
12905	esac
12906	;;
12907	*)	case "$usethreads" in
12908		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12909		esac
12910		d_gmtime_r=undef
12911		gmtime_r_proto=0
12912		;;
12913	esac
12914	;;
12915*)	gmtime_r_proto=0
12916	;;
12917esac
12918
12919: see if hasmntopt exists
12920set hasmntopt d_hasmntopt
12921eval $inlibc
12922
12923: see if this is a netinet/in.h or sys/in.h system
12924set netinet/in.h i_niin sys/in.h i_sysin
12925eval $inhdr
12926
12927: see if arpa/inet.h has to be included
12928set arpa/inet.h i_arpainet
12929eval $inhdr
12930
12931: see if htonl --and friends-- exists
12932val=''
12933set htonl val
12934eval $inlibc
12935
12936: Maybe they are macros.
12937case "$val" in
12938$undef)
12939	$cat >htonl.c <<EOM
12940#include <stdio.h>
12941#include <sys/types.h>
12942#$i_niin I_NETINET_IN
12943#$i_sysin I_SYS_IN
12944#$i_arpainet I_ARPA_INET
12945#ifdef I_NETINET_IN
12946#include <netinet/in.h>
12947#endif
12948#ifdef I_SYS_IN
12949#include <sys/in.h>
12950#endif
12951#ifdef I_ARPA_INET
12952#include <arpa/inet.h>
12953#endif
12954#ifdef htonl
12955printf("Defined as a macro.");
12956#endif
12957EOM
12958	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12959	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12960		val="$define"
12961		echo "But it seems to be defined as a macro." >&4
12962	fi
12963	$rm -f htonl.?
12964	;;
12965esac
12966set d_htonl
12967eval $setvar
12968
12969: index or strchr
12970echo " "
12971if set index val -f; eval $csym; $val; then
12972	if set strchr val -f d_strchr; eval $csym; $val; then
12973		if $contains strchr "$strings" >/dev/null 2>&1 ; then
12974			val="$define"
12975			vali="$undef"
12976			echo "strchr() found." >&4
12977		else
12978			val="$undef"
12979			vali="$define"
12980			echo "index() found." >&4
12981		fi
12982	else
12983		val="$undef"
12984		vali="$define"
12985		echo "index() found." >&4
12986	fi
12987else
12988	if set strchr val -f d_strchr; eval $csym; $val; then
12989		val="$define"
12990		vali="$undef"
12991		echo "strchr() found." >&4
12992	else
12993		echo "No index() or strchr() found!" >&4
12994		val="$undef"
12995		vali="$undef"
12996	fi
12997fi
12998set d_strchr; eval $setvar
12999val="$vali"
13000set d_index; eval $setvar
13001
13002: check whether inet_aton exists
13003set inet_aton d_inetaton
13004eval $inlibc
13005
13006: Look for isascii
13007echo " "
13008$cat >isascii.c <<'EOCP'
13009#include <stdio.h>
13010#include <ctype.h>
13011int main() {
13012	int c = 'A';
13013	if (isascii(c))
13014		exit(0);
13015	else
13016		exit(1);
13017}
13018EOCP
13019set isascii
13020if eval $compile; then
13021	echo "isascii() found." >&4
13022	val="$define"
13023else
13024	echo "isascii() NOT found." >&4
13025	val="$undef"
13026fi
13027set d_isascii
13028eval $setvar
13029$rm -f isascii*
13030
13031: see if isfinite exists
13032set isfinite d_isfinite
13033eval $inlibc
13034
13035: see if isinf exists
13036set isinf d_isinf
13037eval $inlibc
13038
13039: see if isnan exists
13040set isnan d_isnan
13041eval $inlibc
13042
13043: see if isnanl exists
13044set isnanl d_isnanl
13045eval $inlibc
13046
13047: see if killpg exists
13048set killpg d_killpg
13049eval $inlibc
13050
13051: see if lchown exists
13052echo " "
13053$cat > try.c <<'EOCP'
13054/* System header to define __stub macros and hopefully few prototypes,
13055    which can conflict with char lchown(); below.  */
13056#include <assert.h>
13057/* Override any gcc2 internal prototype to avoid an error.  */
13058/* We use char because int might match the return type of a gcc2
13059   builtin and then its argument prototype would still apply.  */
13060char lchown();
13061int main() {
13062    /*  The GNU C library defines this for functions which it implements
13063        to always fail with ENOSYS.  Some functions are actually named
13064	something starting with __ and the normal name is an alias.  */
13065#if defined (__stub_lchown) || defined (__stub___lchown)
13066choke me
13067#else
13068lchown();
13069#endif
13070; return 0; }
13071EOCP
13072set try
13073if eval $compile; then
13074    $echo "lchown() found." >&4
13075    val="$define"
13076else
13077    $echo "lchown() NOT found." >&4
13078    val="$undef"
13079fi
13080set d_lchown
13081eval $setvar
13082
13083: See if number of significant digits in a double precision number is known
13084echo " "
13085$cat >ldbl_dig.c <<EOM
13086#$i_limits I_LIMITS
13087#$i_float I_FLOAT
13088#ifdef I_LIMITS
13089#include <limits.h>
13090#endif
13091#ifdef I_FLOAT
13092#include <float.h>
13093#endif
13094#ifdef LDBL_DIG
13095printf("Contains LDBL_DIG");
13096#endif
13097EOM
13098$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13099if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13100	echo "LDBL_DIG found." >&4
13101	val="$define"
13102else
13103	echo "LDBL_DIG NOT found." >&4
13104	val="$undef"
13105fi
13106$rm -f ldbl_dig.?
13107set d_ldbl_dig
13108eval $setvar
13109
13110: see if link exists
13111set link d_link
13112eval $inlibc
13113
13114: see if localtime_r exists
13115set localtime_r d_localtime_r
13116eval $inlibc
13117case "$d_localtime_r" in
13118"$define")
13119	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13120	case "$d_localtime_r_proto:$usethreads" in
13121	":define")	d_localtime_r_proto=define
13122		set d_localtime_r_proto localtime_r $hdrs
13123		eval $hasproto ;;
13124	*)	;;
13125	esac
13126	case "$d_localtime_r_proto" in
13127	define)
13128	case "$localtime_r_proto" in
13129	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13130	./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13131	esac
13132	case "$localtime_r_proto" in
13133	''|0) try='int localtime_r(const time_t*, struct tm*);'
13134	./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13135	esac
13136	case "$localtime_r_proto" in
13137	''|0)	d_localtime_r=undef
13138 	        localtime_r_proto=0
13139		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13140	* )	case "$localtime_r_proto" in
13141		REENTRANT_PROTO*) ;;
13142		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13143		esac
13144		echo "Prototype: $try" ;;
13145	esac
13146	;;
13147	*)	case "$usethreads" in
13148		define) echo "localtime_r has no prototype, not using it." >&4 ;;
13149		esac
13150		d_localtime_r=undef
13151		localtime_r_proto=0
13152		;;
13153	esac
13154	;;
13155*)	localtime_r_proto=0
13156	;;
13157esac
13158
13159: see if localeconv exists
13160set localeconv d_locconv
13161eval $inlibc
13162
13163: see if lockf exists
13164set lockf d_lockf
13165eval $inlibc
13166
13167: see if prototype for lseek is available
13168echo " "
13169set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13170eval $hasproto
13171
13172: see if lstat exists
13173set lstat d_lstat
13174eval $inlibc
13175
13176: see if madvise exists
13177set madvise d_madvise
13178eval $inlibc
13179
13180: see if mblen exists
13181set mblen d_mblen
13182eval $inlibc
13183
13184: see if mbstowcs exists
13185set mbstowcs d_mbstowcs
13186eval $inlibc
13187
13188: see if mbtowc exists
13189set mbtowc d_mbtowc
13190eval $inlibc
13191
13192: see if memchr exists
13193set memchr d_memchr
13194eval $inlibc
13195
13196: see if memcmp exists
13197set memcmp d_memcmp
13198eval $inlibc
13199
13200: see if memcpy exists
13201set memcpy d_memcpy
13202eval $inlibc
13203
13204: see if memmove exists
13205set memmove d_memmove
13206eval $inlibc
13207
13208: see if memset exists
13209set memset d_memset
13210eval $inlibc
13211
13212: see if mkdir exists
13213set mkdir d_mkdir
13214eval $inlibc
13215
13216: see if mkdtemp exists
13217set mkdtemp d_mkdtemp
13218eval $inlibc
13219
13220: see if mkfifo exists
13221set mkfifo d_mkfifo
13222eval $inlibc
13223
13224: see if mkstemp exists
13225set mkstemp d_mkstemp
13226eval $inlibc
13227
13228: see if mkstemps exists
13229set mkstemps d_mkstemps
13230eval $inlibc
13231
13232: see if mktime exists
13233set mktime d_mktime
13234eval $inlibc
13235
13236: see if this is a sys/mman.h system
13237set sys/mman.h i_sysmman
13238eval $inhdr
13239
13240: see if mmap exists
13241set mmap d_mmap
13242eval $inlibc
13243: see what shmat returns
13244: default to something harmless
13245mmaptype='void *'
13246case "$i_sysmman$d_mmap" in
13247"$define$define")
13248	$cat >mmap.c <<'END'
13249#include <sys/mman.h>
13250void *mmap();
13251END
13252	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13253		mmaptype='void *'
13254	else
13255		mmaptype='caddr_t'
13256	fi
13257	echo "and it returns ($mmaptype)." >&4
13258	;;
13259esac
13260
13261
13262
13263: see if mprotect exists
13264set mprotect d_mprotect
13265eval $inlibc
13266
13267: see if msgctl exists
13268set msgctl d_msgctl
13269eval $inlibc
13270
13271: see if msgget exists
13272set msgget d_msgget
13273eval $inlibc
13274
13275: see if msgsnd exists
13276set msgsnd d_msgsnd
13277eval $inlibc
13278
13279: see if msgrcv exists
13280set msgrcv d_msgrcv
13281eval $inlibc
13282
13283: see how much of the 'msg*(2)' library is present.
13284h_msg=true
13285echo " "
13286case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13287*"$undef"*) h_msg=false;;
13288esac
13289case "$osname" in
13290freebsd)
13291    case "`ipcs 2>&1`" in
13292    "SVID messages"*"not configured"*)
13293	echo "Your $osname does not have the msg*(2) configured." >&4
13294        h_msg=false
13295	val="$undef"
13296	set msgctl d_msgctl
13297	eval $setvar
13298	set msgget d_msgget
13299	eval $setvar
13300	set msgsnd d_msgsnd
13301	eval $setvar
13302	set msgrcv d_msgrcv
13303	eval $setvar
13304	;;
13305    esac
13306    ;;
13307esac
13308: we could also check for sys/ipc.h ...
13309if $h_msg && $test `./findhdr sys/msg.h`; then
13310	echo "You have the full msg*(2) library." >&4
13311	val="$define"
13312else
13313	echo "You don't have the full msg*(2) library." >&4
13314	val="$undef"
13315fi
13316set d_msg
13317eval $setvar
13318
13319
13320echo " "
13321echo "Checking to see if your system supports struct msghdr..." >&4
13322set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13323eval $hasstruct
13324case "$d_msghdr_s" in
13325"$define")      echo "Yes, it does."   ;;
13326*)              echo "No, it doesn't." ;;
13327esac
13328
13329
13330: see if msync exists
13331set msync d_msync
13332eval $inlibc
13333
13334: see if munmap exists
13335set munmap d_munmap
13336eval $inlibc
13337
13338: see if nice exists
13339set nice d_nice
13340eval $inlibc
13341
13342: see if this is a langinfo.h system
13343set langinfo.h i_langinfo
13344eval $inhdr
13345
13346: see if nl_langinfo exists
13347set nl_langinfo d_nl_langinfo
13348eval $inlibc
13349
13350: check for length of character
13351echo " "
13352case "$charsize" in
13353'')
13354	echo "Checking to see how big your characters are (hey, you never know)..." >&4
13355	$cat >try.c <<'EOCP'
13356#include <stdio.h>
13357int main()
13358{
13359    printf("%d\n", (int)sizeof(char));
13360    exit(0);
13361}
13362EOCP
13363	set try
13364	if eval $compile_ok; then
13365		dflt=`$run ./try`
13366	else
13367		dflt='1'
13368		echo "(I can't seem to compile the test program.  Guessing...)"
13369	fi
13370	;;
13371*)
13372	dflt="$charsize"
13373	;;
13374esac
13375rp="What is the size of a character (in bytes)?"
13376. ./myread
13377charsize="$ans"
13378$rm -f try.c try
13379
13380: check for volatile keyword
13381echo " "
13382echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13383$cat >try.c <<'EOCP'
13384int main()
13385{
13386	typedef struct _goo_struct goo_struct;
13387	goo_struct * volatile goo = ((goo_struct *)0);
13388	struct _goo_struct {
13389		long long_int;
13390		int reg_int;
13391		char char_var;
13392	};
13393	typedef unsigned short foo_t;
13394	char *volatile foo;
13395	volatile int bar;
13396	volatile foo_t blech;
13397	foo = foo;
13398}
13399EOCP
13400if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13401	val="$define"
13402	echo "Yup, it does."
13403else
13404	val="$undef"
13405	echo "Nope, it doesn't."
13406fi
13407set d_volatile
13408eval $setvar
13409$rm -f try.*
13410
13411
13412echo " "
13413$echo "Choosing the C types to be used for Perl's internal types..." >&4
13414
13415case "$use64bitint:$d_quad:$quadtype" in
13416define:define:?*)
13417	ivtype="$quadtype"
13418	uvtype="$uquadtype"
13419	ivsize=8
13420	uvsize=8
13421	;;
13422*)	ivtype="long"
13423	uvtype="unsigned long"
13424	ivsize=$longsize
13425	uvsize=$longsize
13426	;;
13427esac
13428
13429case "$uselongdouble:$d_longdbl" in
13430define:define)
13431	nvtype="long double"
13432	nvsize=$longdblsize
13433	;;
13434*)	nvtype=double
13435	nvsize=$doublesize
13436	;;
13437esac
13438
13439$echo "(IV will be "$ivtype", $ivsize bytes)"
13440$echo "(UV will be "$uvtype", $uvsize bytes)"
13441$echo "(NV will be "$nvtype", $nvsize bytes)"
13442
13443$cat >try.c <<EOCP
13444#$i_inttypes I_INTTYPES
13445#ifdef I_INTTYPES
13446#include <inttypes.h>
13447#endif
13448#include <stdio.h>
13449int main() {
13450#ifdef INT8
13451   int8_t i =  INT8_MAX;
13452  uint8_t u = UINT8_MAX;
13453  printf("int8_t\n");
13454#endif
13455#ifdef INT16
13456   int16_t i =  INT16_MAX;
13457  uint16_t i = UINT16_MAX;
13458  printf("int16_t\n");
13459#endif
13460#ifdef INT32
13461   int32_t i =  INT32_MAX;
13462  uint32_t u = UINT32_MAX;
13463  printf("int32_t\n");
13464#endif
13465}
13466EOCP
13467
13468case "$i8type" in
13469'')	case "$charsize" in
13470	1)	i8type=char
13471		u8type="unsigned char"
13472		i8size=$charsize
13473		u8size=$charsize
13474		;;
13475	esac
13476	;;
13477esac
13478case "$i8type" in
13479'')	set try -DINT8
13480	if eval $compile; then
13481		case "`$run ./try`" in
13482		int8_t)	i8type=int8_t
13483			u8type=uint8_t
13484			i8size=1
13485			u8size=1
13486			;;
13487		esac
13488	fi
13489	;;
13490esac
13491case "$i8type" in
13492'')	if $test $charsize -ge 1; then
13493		i8type=char
13494		u8type="unsigned char"
13495		i8size=$charsize
13496		u8size=$charsize
13497	fi
13498	;;
13499esac
13500
13501case "$i16type" in
13502'')	case "$shortsize" in
13503	2)	i16type=short
13504		u16type="unsigned short"
13505		i16size=$shortsize
13506		u16size=$shortsize
13507		;;
13508	esac
13509	;;
13510esac
13511case "$i16type" in
13512'')	set try -DINT16
13513	if eval $compile; then
13514		case "`$run ./try`" in
13515		int16_t)
13516			i16type=int16_t
13517			u16type=uint16_t
13518			i16size=2
13519			u16size=2
13520			;;
13521		esac
13522	fi
13523	;;
13524esac
13525case "$i16type" in
13526'')	if $test $shortsize -ge 2; then
13527		i16type=short
13528		u16type="unsigned short"
13529		i16size=$shortsize
13530		u16size=$shortsize
13531	fi
13532	;;
13533esac
13534
13535case "$i32type" in
13536'')	case "$longsize" in
13537	4)	i32type=long
13538		u32type="unsigned long"
13539		i32size=$longsize
13540		u32size=$longsize
13541		;;
13542	*)	case "$intsize" in
13543		4)	i32type=int
13544			u32type="unsigned int"
13545			i32size=$intsize
13546			u32size=$intsize
13547			;;
13548		esac
13549		;;
13550	esac
13551	;;
13552esac
13553case "$i32type" in
13554'')	set try -DINT32
13555	if eval $compile; then
13556		case "`$run ./try`" in
13557		int32_t)
13558			i32type=int32_t
13559			u32type=uint32_t
13560			i32size=4
13561			u32size=4
13562			;;
13563		esac
13564	fi
13565	;;
13566esac
13567case "$i32type" in
13568'')	if $test $intsize -ge 4; then
13569		i32type=int
13570		u32type="unsigned int"
13571		i32size=$intsize
13572		u32size=$intsize
13573	fi
13574	;;
13575esac
13576
13577case "$i64type" in
13578'')	case "$d_quad:$quadtype" in
13579	define:?*)
13580		i64type="$quadtype"
13581		u64type="$uquadtype"
13582		i64size=8
13583		u64size=8
13584		;;
13585	esac
13586	;;
13587esac
13588
13589$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13590: volatile so that the compiler has to store it out to memory.
13591if test X"$d_volatile" = X"$define"; then
13592	volatile=volatile
13593fi
13594$cat <<EOP >try.c
13595#include <stdio.h>
13596#include <sys/types.h>
13597#include <signal.h>
13598#ifdef SIGFPE
13599$volatile int bletched = 0;
13600$signal_t blech(s) int s; { bletched = 1; }
13601#endif
13602int main() {
13603    $uvtype u = 0;
13604    $nvtype d;
13605    int     n = 8 * $uvsize;
13606    int     i;
13607#ifdef SIGFPE
13608    signal(SIGFPE, blech);
13609#endif
13610
13611    for (i = 0; i < n; i++) {
13612      u = u << 1 | ($uvtype)1;
13613      d = ($nvtype)u;
13614      if (($uvtype)d != u)
13615        break;
13616      if (d <= 0)
13617	break;
13618      d = ($nvtype)(u - 1);
13619      if (($uvtype)d != (u - 1))
13620        break;
13621#ifdef SIGFPE
13622      if (bletched) {
13623	break;
13624#endif
13625      }
13626    }
13627    printf("%d\n", ((i == n) ? -n : i));
13628    exit(0);
13629}
13630EOP
13631set try
13632
13633d_nv_preserves_uv="$undef"
13634if eval $compile; then
13635	nv_preserves_uv_bits="`$run ./try`"
13636fi
13637case "$nv_preserves_uv_bits" in
13638\-[1-9]*)
13639	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13640	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13641	d_nv_preserves_uv="$define"
13642	;;
13643[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13644	d_nv_preserves_uv="$undef" ;;
13645*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
13646	nv_preserves_uv_bits="$undef" ;;
13647esac
13648
13649$rm -f try.* try
13650
13651
13652: check for off64_t
13653echo " "
13654echo "Checking to see if you have off64_t..." >&4
13655$cat >try.c <<EOCP
13656#include <sys/types.h>
13657#include <unistd.h>
13658int main() { off64_t x = 7; }
13659EOCP
13660set try
13661if eval $compile; then
13662	val="$define"
13663	echo "You have off64_t."
13664else
13665	val="$undef"
13666	echo "You do not have off64_t."
13667	case "$lseeksize" in
13668	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13669	esac
13670fi
13671$rm -f try.* try
13672set d_off64_t
13673eval $setvar
13674
13675: how to create joinable pthreads
13676if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13677	echo " "
13678	echo "Checking what constant to use for creating joinable pthreads..." >&4
13679	$cat >try.c <<'EOCP'
13680#include <pthread.h>
13681int main() {
13682    int detachstate = JOINABLE;
13683}
13684EOCP
13685	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13686	if eval $compile; then
13687		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13688		val="$undef" # Yes, undef.
13689		set d_old_pthread_create_joinable
13690		eval $setvar
13691		val=""
13692		set old_pthread_create_joinable
13693		eval $setvar
13694	else
13695		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13696		if eval $compile; then
13697			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13698			val="$define"
13699			set d_old_pthread_create_joinable
13700			eval $setvar
13701			val=PTHREAD_CREATE_UNDETACHED
13702			set old_pthread_create_joinable
13703			eval $setvar
13704		else
13705			set try -DJOINABLE=__UNDETACHED
13706			if eval $compile; then
13707				echo "You seem to use __UNDETACHED." >&4
13708				val="$define"
13709				set d_old_pthread_create_joinable
13710				eval $setvar
13711				val=__UNDETACHED
13712				set old_pthread_create_joinable
13713				eval $setvar
13714			else
13715				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13716				val="$define"
13717				set d_old_pthread_create_joinable
13718				eval $setvar
13719				val=0
13720				set old_pthread_create_joinable
13721				eval $setvar
13722			fi
13723		fi
13724	fi
13725	$rm -f try try.*
13726else
13727    d_old_pthread_create_joinable="$undef"
13728    old_pthread_create_joinable=""
13729fi
13730
13731: see if pause exists
13732set pause d_pause
13733eval $inlibc
13734
13735: see if pipe exists
13736set pipe d_pipe
13737eval $inlibc
13738
13739: see if poll exists
13740set poll d_poll
13741eval $inlibc
13742
13743: see if readlink exists
13744set readlink d_readlink
13745eval $inlibc
13746
13747echo " "
13748procselfexe=''
13749val="$undef"
13750case "$d_readlink" in
13751"$define")
13752	if $issymlink /proc/self/exe ; then
13753		$ls -l /proc/self/exe > reflect
13754		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13755			echo "You have Linux-like /proc/self/exe."
13756			procselfexe='"/proc/self/exe"'
13757			val="$define"
13758		fi
13759	fi
13760	if $issymlink /proc/curproc/file ; then
13761		$ls -l /proc/curproc/file > reflect
13762		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13763			echo "You have BSD-like /proc/curproc/file."
13764			procselfexe='"/proc/curproc/file"'
13765			val="$define"
13766		fi
13767	fi
13768	;;
13769esac
13770$rm -f reflect
13771set d_procselfexe
13772eval $setvar
13773
13774: see whether the pthread_atfork exists
13775$cat >try.c <<EOP
13776#include <pthread.h>
13777#include <stdio.h>
13778int main() {
13779#ifdef  PTHREAD_ATFORK
13780        pthread_atfork(NULL,NULL,NULL);
13781#endif
13782}
13783EOP
13784
13785: see if pthread_atfork exists
13786set try -DPTHREAD_ATFORK
13787if eval $compile; then
13788    val="$define"
13789else
13790    val="$undef"
13791fi
13792case "$usethreads" in
13793$define)
13794        case "$val" in
13795        $define) echo 'pthread_atfork found.' >&4        ;;
13796        *)       echo 'pthread_atfork NOT found.' >&4    ;;
13797        esac
13798esac
13799set d_pthread_atfork
13800eval $setvar
13801
13802
13803: see whether the various POSIXish _yields exist
13804$cat >try.c <<EOP
13805#include <pthread.h>
13806#include <stdio.h>
13807int main() {
13808#ifdef SCHED_YIELD
13809	sched_yield();
13810#else
13811#ifdef PTHREAD_YIELD
13812	pthread_yield();
13813#else
13814#ifdef PTHREAD_YIELD_NULL
13815	pthread_yield(NULL);
13816#endif
13817#endif
13818#endif
13819}
13820EOP
13821: see if sched_yield exists
13822set try -DSCHED_YIELD
13823if eval $compile; then
13824    val="$define"
13825    sched_yield='sched_yield()'
13826else
13827    val="$undef"
13828fi
13829case "$usethreads" in
13830$define)
13831	case "$val" in
13832	$define) echo 'sched_yield() found.' >&4	;;
13833	*)	 echo 'sched_yield() NOT found.' >&4	;;
13834	esac
13835esac
13836set d_sched_yield
13837eval $setvar
13838
13839: see if pthread_yield exists
13840set try -DPTHREAD_YIELD
13841if eval $compile; then
13842    val="$define"
13843    case "$sched_yield" in
13844    '') sched_yield='pthread_yield()' ;;
13845    esac
13846else
13847    set try -DPTHREAD_YIELD_NULL
13848    if eval $compile; then
13849	val="$define"
13850	case "$sched_yield" in
13851	'') sched_yield='pthread_yield(NULL)' ;;
13852	esac
13853    else
13854	val="$undef"
13855    fi
13856fi
13857case "$usethreads" in
13858$define)
13859	case "$val" in
13860	$define) echo 'pthread_yield() found.' >&4	;;
13861	*)	 echo 'pthread_yield() NOT found.' >&4	;;
13862	esac
13863	;;
13864esac
13865set d_pthread_yield
13866eval $setvar
13867
13868case "$sched_yield" in
13869'') sched_yield=undef ;;
13870esac
13871
13872$rm -f try try.*
13873
13874: see if random_r exists
13875set random_r d_random_r
13876eval $inlibc
13877case "$d_random_r" in
13878"$define")
13879	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13880	case "$d_random_r_proto:$usethreads" in
13881	":define")	d_random_r_proto=define
13882		set d_random_r_proto random_r $hdrs
13883		eval $hasproto ;;
13884	*)	;;
13885	esac
13886	case "$d_random_r_proto" in
13887	define)
13888	case "$random_r_proto" in
13889	''|0) try='int random_r(int*, struct random_data*);'
13890	./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13891	esac
13892	case "$random_r_proto" in
13893	''|0)	d_random_r=undef
13894 	        random_r_proto=0
13895		echo "Disabling random_r, cannot determine prototype." >&4 ;;
13896	* )	case "$random_r_proto" in
13897		REENTRANT_PROTO*) ;;
13898		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13899		esac
13900		echo "Prototype: $try" ;;
13901	esac
13902	;;
13903	*)	case "$usethreads" in
13904		define) echo "random_r has no prototype, not using it." >&4 ;;
13905		esac
13906		d_random_r=undef
13907		random_r_proto=0
13908		;;
13909	esac
13910	;;
13911*)	random_r_proto=0
13912	;;
13913esac
13914
13915: see if readdir and friends exist
13916set readdir d_readdir
13917eval $inlibc
13918set seekdir d_seekdir
13919eval $inlibc
13920set telldir d_telldir
13921eval $inlibc
13922set rewinddir d_rewinddir
13923eval $inlibc
13924
13925: see if readdir64_r exists
13926set readdir64_r d_readdir64_r
13927eval $inlibc
13928case "$d_readdir64_r" in
13929"$define")
13930	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13931	case "$d_readdir64_r_proto:$usethreads" in
13932	":define")	d_readdir64_r_proto=define
13933		set d_readdir64_r_proto readdir64_r $hdrs
13934		eval $hasproto ;;
13935	*)	;;
13936	esac
13937	case "$d_readdir64_r_proto" in
13938	define)
13939	case "$readdir64_r_proto" in
13940	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13941	./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13942	esac
13943	case "$readdir64_r_proto" in
13944	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13945	./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13946	esac
13947	case "$readdir64_r_proto" in
13948	''|0)	d_readdir64_r=undef
13949 	        readdir64_r_proto=0
13950		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13951	* )	case "$readdir64_r_proto" in
13952		REENTRANT_PROTO*) ;;
13953		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13954		esac
13955		echo "Prototype: $try" ;;
13956	esac
13957	;;
13958	*)	case "$usethreads" in
13959		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13960		esac
13961		d_readdir64_r=undef
13962		readdir64_r_proto=0
13963		;;
13964	esac
13965	;;
13966*)	readdir64_r_proto=0
13967	;;
13968esac
13969
13970: see if readdir_r exists
13971set readdir_r d_readdir_r
13972eval $inlibc
13973case "$d_readdir_r" in
13974"$define")
13975	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13976	case "$d_readdir_r_proto:$usethreads" in
13977	":define")	d_readdir_r_proto=define
13978		set d_readdir_r_proto readdir_r $hdrs
13979		eval $hasproto ;;
13980	*)	;;
13981	esac
13982	case "$d_readdir_r_proto" in
13983	define)
13984	case "$readdir_r_proto" in
13985	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13986	./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13987	esac
13988	case "$readdir_r_proto" in
13989	''|0) try='int readdir_r(DIR*, struct dirent*);'
13990	./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13991	esac
13992	case "$readdir_r_proto" in
13993	''|0)	d_readdir_r=undef
13994 	        readdir_r_proto=0
13995		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13996	* )	case "$readdir_r_proto" in
13997		REENTRANT_PROTO*) ;;
13998		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13999		esac
14000		echo "Prototype: $try" ;;
14001	esac
14002	;;
14003	*)	case "$usethreads" in
14004		define) echo "readdir_r has no prototype, not using it." >&4 ;;
14005		esac
14006		d_readdir_r=undef
14007		readdir_r_proto=0
14008		;;
14009	esac
14010	;;
14011*)	readdir_r_proto=0
14012	;;
14013esac
14014
14015: see if readv exists
14016set readv d_readv
14017eval $inlibc
14018
14019: see if recvmsg exists
14020set recvmsg d_recvmsg
14021eval $inlibc
14022
14023: see if rename exists
14024set rename d_rename
14025eval $inlibc
14026
14027: see if rmdir exists
14028set rmdir d_rmdir
14029eval $inlibc
14030
14031: see if memory.h is available.
14032val=''
14033set memory.h val
14034eval $inhdr
14035
14036: See if it conflicts with string.h
14037case "$val" in
14038$define)
14039	case "$strings" in
14040	'') ;;
14041	*)
14042		$cppstdin $cppflags $cppminus < $strings > mem.h
14043		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14044			echo " "
14045			echo "We won't be including <memory.h>."
14046			val="$undef"
14047		fi
14048		$rm -f mem.h
14049		;;
14050	esac
14051esac
14052set i_memory
14053eval $setvar
14054
14055: can bcopy handle overlapping blocks?
14056echo " "
14057val="$undef"
14058case "$d_memmove" in
14059"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14060*)	case "$d_bcopy" in
14061	"$define")
14062		echo "Checking to see if bcopy() can do overlapping copies..." >&4
14063		$cat >try.c <<EOCP
14064#$i_memory I_MEMORY
14065#$i_stdlib I_STDLIB
14066#$i_string I_STRING
14067#$i_unistd I_UNISTD
14068EOCP
14069	$cat >>try.c <<'EOCP'
14070#include <stdio.h>
14071#ifdef I_MEMORY
14072#  include <memory.h>
14073#endif
14074#ifdef I_STDLIB
14075#  include <stdlib.h>
14076#endif
14077#ifdef I_STRING
14078#  include <string.h>
14079#else
14080#  include <strings.h>
14081#endif
14082#ifdef I_UNISTD
14083#  include <unistd.h>  /* Needed for NetBSD */
14084#endif
14085int main()
14086{
14087char buf[128], abc[128];
14088char *b;
14089int len;
14090int off;
14091int align;
14092
14093/* Copy "abcde..." string to char abc[] so that gcc doesn't
14094   try to store the string in read-only memory. */
14095bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14096
14097for (align = 7; align >= 0; align--) {
14098	for (len = 36; len; len--) {
14099		b = buf+align;
14100		bcopy(abc, b, len);
14101		for (off = 1; off <= len; off++) {
14102			bcopy(b, b+off, len);
14103			bcopy(b+off, b, len);
14104			if (bcmp(b, abc, len))
14105				exit(1);
14106		}
14107	}
14108}
14109exit(0);
14110}
14111EOCP
14112		set try
14113		if eval $compile_ok; then
14114			if ./try 2>/dev/null; then
14115				echo "Yes, it can."
14116				val="$define"
14117			else
14118				echo "It can't, sorry."
14119			fi
14120		else
14121			echo "(I can't compile the test program, so we'll assume not...)"
14122		fi
14123		;;
14124	esac
14125	$rm -f try.* try core
14126	;;
14127esac
14128set d_safebcpy
14129eval $setvar
14130
14131: can memcpy handle overlapping blocks?
14132echo " "
14133val="$undef"
14134case "$d_memmove" in
14135"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14136*)	case "$d_memcpy" in
14137	"$define")
14138		echo "Checking to see if memcpy() can do overlapping copies..." >&4
14139		$cat >try.c <<EOCP
14140#$i_memory I_MEMORY
14141#$i_stdlib I_STDLIB
14142#$i_string I_STRING
14143#$i_unistd I_UNISTD
14144EOCP
14145	$cat >>try.c <<'EOCP'
14146#include <stdio.h>
14147#ifdef I_MEMORY
14148#  include <memory.h>
14149#endif
14150#ifdef I_STDLIB
14151#  include <stdlib.h>
14152#endif
14153#ifdef I_STRING
14154#  include <string.h>
14155#else
14156#  include <strings.h>
14157#endif
14158#ifdef I_UNISTD
14159#  include <unistd.h>  /* Needed for NetBSD */
14160#endif
14161int main()
14162{
14163char buf[128], abc[128];
14164char *b;
14165int len;
14166int off;
14167int align;
14168
14169/* Copy "abcde..." string to char abc[] so that gcc doesn't
14170   try to store the string in read-only memory. */
14171memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14172
14173for (align = 7; align >= 0; align--) {
14174	for (len = 36; len; len--) {
14175		b = buf+align;
14176		memcpy(b, abc, len);
14177		for (off = 1; off <= len; off++) {
14178			memcpy(b+off, b, len);
14179			memcpy(b, b+off, len);
14180			if (memcmp(b, abc, len))
14181				exit(1);
14182		}
14183	}
14184}
14185exit(0);
14186}
14187EOCP
14188		set try
14189		if eval $compile_ok; then
14190			if ./try 2>/dev/null; then
14191				echo "Yes, it can."
14192				val="$define"
14193			else
14194				echo "It can't, sorry."
14195			fi
14196		else
14197			echo "(I can't compile the test program, so we'll assume not...)"
14198		fi
14199		;;
14200	esac
14201	$rm -f try.* try core
14202	;;
14203esac
14204set d_safemcpy
14205eval $setvar
14206
14207: can memcmp be trusted to compare relative magnitude?
14208val="$undef"
14209case "$d_memcmp" in
14210"$define")
14211	echo " "
14212	echo "Checking if your memcmp() can compare relative magnitude..." >&4
14213	$cat >try.c <<EOCP
14214#$i_memory I_MEMORY
14215#$i_stdlib I_STDLIB
14216#$i_string I_STRING
14217#$i_unistd I_UNISTD
14218EOCP
14219	$cat >>try.c <<'EOCP'
14220#include <stdio.h>
14221#ifdef I_MEMORY
14222#  include <memory.h>
14223#endif
14224#ifdef I_STDLIB
14225#  include <stdlib.h>
14226#endif
14227#ifdef I_STRING
14228#  include <string.h>
14229#else
14230#  include <strings.h>
14231#endif
14232#ifdef I_UNISTD
14233#  include <unistd.h>  /* Needed for NetBSD */
14234#endif
14235int main()
14236{
14237char a = -1;
14238char b = 0;
14239if ((a < b) && memcmp(&a, &b, 1) < 0)
14240	exit(1);
14241exit(0);
14242}
14243EOCP
14244	set try
14245	if eval $compile_ok; then
14246		if $run ./try 2>/dev/null; then
14247			echo "Yes, it can."
14248			val="$define"
14249		else
14250			echo "No, it can't (it uses signed chars)."
14251		fi
14252	else
14253		echo "(I can't compile the test program, so we'll assume not...)"
14254	fi
14255	;;
14256esac
14257$rm -f try.* try core
14258set d_sanemcmp
14259eval $setvar
14260
14261: see if prototype for sbrk is available
14262echo " "
14263set d_sbrkproto sbrk $i_unistd unistd.h
14264eval $hasproto
14265
14266: see if select exists
14267set select d_select
14268eval $inlibc
14269
14270: see if semctl exists
14271set semctl d_semctl
14272eval $inlibc
14273
14274: see if semget exists
14275set semget d_semget
14276eval $inlibc
14277
14278: see if semop exists
14279set semop d_semop
14280eval $inlibc
14281
14282: see how much of the 'sem*(2)' library is present.
14283h_sem=true
14284echo " "
14285case "$d_semctl$d_semget$d_semop" in
14286*"$undef"*) h_sem=false;;
14287esac
14288case "$osname" in
14289freebsd)
14290    case "`ipcs 2>&1`" in
14291    "SVID messages"*"not configured"*)
14292	echo "Your $osname does not have the sem*(2) configured." >&4
14293        h_sem=false
14294	val="$undef"
14295	set semctl d_semctl
14296	eval $setvar
14297	set semget d_semget
14298	eval $setvar
14299	set semop d_semop
14300	eval $setvar
14301	;;
14302    esac
14303    ;;
14304esac
14305: we could also check for sys/ipc.h ...
14306if $h_sem && $test `./findhdr sys/sem.h`; then
14307	echo "You have the full sem*(2) library." >&4
14308	val="$define"
14309else
14310	echo "You don't have the full sem*(2) library." >&4
14311	val="$undef"
14312fi
14313set d_sem
14314eval $setvar
14315
14316: see whether sys/sem.h defines union semun
14317echo " "
14318$cat > try.c <<'END'
14319#include <sys/types.h>
14320#include <sys/ipc.h>
14321#include <sys/sem.h>
14322int main () { union semun semun; semun.buf = 0; }
14323END
14324set try
14325if eval $compile; then
14326    echo "You have union semun in <sys/sem.h>." >&4
14327    val="$define"
14328else
14329    echo "You do not have union semun in <sys/sem.h>." >&4
14330    val="$undef"
14331fi
14332$rm -f try try.c try.h
14333set d_union_semun
14334eval $setvar
14335
14336: see how to do semctl IPC_STAT
14337case "$d_sem" in
14338$define)
14339    : see whether semctl IPC_STAT can use union semun
14340    echo " "
14341    $cat > try.h <<END
14342#ifndef S_IRUSR
14343#   ifdef S_IREAD
14344#	define S_IRUSR S_IREAD
14345#	define S_IWUSR S_IWRITE
14346#	define S_IXUSR S_IEXEC
14347#   else
14348#	define S_IRUSR 0400
14349#	define S_IWUSR 0200
14350#	define S_IXUSR 0100
14351#   endif
14352#   define S_IRGRP (S_IRUSR>>3)
14353#   define S_IWGRP (S_IWUSR>>3)
14354#   define S_IXGRP (S_IXUSR>>3)
14355#   define S_IROTH (S_IRUSR>>6)
14356#   define S_IWOTH (S_IWUSR>>6)
14357#   define S_IXOTH (S_IXUSR>>6)
14358#endif
14359#ifndef S_IRWXU
14360#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14361#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14362#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14363#endif
14364END
14365
14366    $cat > try.c <<END
14367#include <sys/types.h>
14368#include <sys/ipc.h>
14369#include <sys/sem.h>
14370#include <sys/stat.h>
14371#include <stdio.h>
14372#include <errno.h>
14373#include "try.h"
14374#ifndef errno
14375extern int errno;
14376#endif
14377#$d_union_semun HAS_UNION_SEMUN
14378int main() {
14379    union semun
14380#ifndef HAS_UNION_SEMUN
14381    {
14382	int val;
14383	struct semid_ds *buf;
14384	unsigned short *array;
14385    }
14386#endif
14387    arg;
14388    int sem, st;
14389
14390#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14391    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14392    if (sem > -1) {
14393	struct semid_ds argbuf;
14394	arg.buf = &argbuf;
14395#	ifdef IPC_STAT
14396	st = semctl(sem, 0, IPC_STAT, arg);
14397	if (st == 0)
14398	    printf("semun\n");
14399	else
14400#	endif /* IPC_STAT */
14401	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
14402#	ifdef IPC_RMID
14403	if (semctl(sem, 0, IPC_RMID, arg) != 0)
14404#   	endif /* IPC_RMID */
14405	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
14406    } else
14407#endif /* IPC_PRIVATE && ... */
14408	printf("semget failed: errno = %d\n", errno);
14409  return 0;
14410}
14411END
14412    val="$undef"
14413    set try
14414    if eval $compile; then
14415	xxx=`$run ./try`
14416        case "$xxx" in
14417        semun) val="$define" ;;
14418        esac
14419    fi
14420    $rm -f try try.c
14421    set d_semctl_semun
14422    eval $setvar
14423    case "$d_semctl_semun" in
14424    $define)
14425        echo "You can use union semun for semctl IPC_STAT." >&4
14426	also='also'
14427        ;;
14428    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14429	also=''
14430        ;;
14431    esac
14432
14433    : see whether semctl IPC_STAT can use struct semid_ds pointer
14434    $cat > try.c <<'END'
14435#include <sys/types.h>
14436#include <sys/ipc.h>
14437#include <sys/sem.h>
14438#include <sys/stat.h>
14439#include "try.h"
14440#include <stdio.h>
14441#include <errno.h>
14442#ifndef errno
14443extern int errno;
14444#endif
14445int main() {
14446    struct semid_ds arg;
14447    int sem, st;
14448
14449#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14450    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14451    if (sem > -1) {
14452#	ifdef IPC_STAT
14453	st = semctl(sem, 0, IPC_STAT, &arg);
14454	if (st == 0)
14455	    printf("semid_ds\n");
14456	else
14457#	endif /* IPC_STAT */
14458	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
14459#	ifdef IPC_RMID
14460	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14461#	endif /* IPC_RMID */
14462	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
14463    } else
14464#endif /* IPC_PRIVATE && ... */
14465	printf("semget failed: errno = %d\n", errno);
14466
14467    return 0;
14468}
14469END
14470    val="$undef"
14471    set try
14472    if eval $compile; then
14473        xxx=`$run ./try`
14474        case "$xxx" in
14475        semid_ds) val="$define" ;;
14476        esac
14477    fi
14478    $rm -f try try.c
14479    set d_semctl_semid_ds
14480    eval $setvar
14481    case "$d_semctl_semid_ds" in
14482    $define)
14483        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14484        ;;
14485    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14486        ;;
14487    esac
14488    $rm -f try.h
14489    ;;
14490*)  val="$undef"
14491
14492    # We do not have the full sem*(2) library, so assume we can not
14493    # use either.
14494
14495    set d_semctl_semun
14496    eval $setvar
14497
14498    set d_semctl_semid_ds
14499    eval $setvar
14500    ;;
14501esac
14502
14503: see if sendmsg exists
14504set sendmsg d_sendmsg
14505eval $inlibc
14506
14507: see if setegid exists
14508set setegid d_setegid
14509eval $inlibc
14510
14511: see if seteuid exists
14512set seteuid d_seteuid
14513eval $inlibc
14514
14515: see if setgrent exists
14516set setgrent d_setgrent
14517eval $inlibc
14518
14519: see if setgrent_r exists
14520set setgrent_r d_setgrent_r
14521eval $inlibc
14522case "$d_setgrent_r" in
14523"$define")
14524	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14525	case "$d_setgrent_r_proto:$usethreads" in
14526	":define")	d_setgrent_r_proto=define
14527		set d_setgrent_r_proto setgrent_r $hdrs
14528		eval $hasproto ;;
14529	*)	;;
14530	esac
14531	case "$d_setgrent_r_proto" in
14532	define)
14533	case "$setgrent_r_proto" in
14534	''|0) try='int setgrent_r(FILE**);'
14535	./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14536	esac
14537	case "$setgrent_r_proto" in
14538	''|0) try='void setgrent_r(FILE**);'
14539	./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14540	esac
14541	case "$setgrent_r_proto" in
14542	''|0)	d_setgrent_r=undef
14543 	        setgrent_r_proto=0
14544		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14545	* )	case "$setgrent_r_proto" in
14546		REENTRANT_PROTO*) ;;
14547		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14548		esac
14549		echo "Prototype: $try" ;;
14550	esac
14551	;;
14552	*)	case "$usethreads" in
14553		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14554		esac
14555		d_setgrent_r=undef
14556		setgrent_r_proto=0
14557		;;
14558	esac
14559	;;
14560*)	setgrent_r_proto=0
14561	;;
14562esac
14563
14564: see if sethostent exists
14565set sethostent d_sethent
14566eval $inlibc
14567
14568: see if sethostent_r exists
14569set sethostent_r d_sethostent_r
14570eval $inlibc
14571case "$d_sethostent_r" in
14572"$define")
14573	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14574	case "$d_sethostent_r_proto:$usethreads" in
14575	":define")	d_sethostent_r_proto=define
14576		set d_sethostent_r_proto sethostent_r $hdrs
14577		eval $hasproto ;;
14578	*)	;;
14579	esac
14580	case "$d_sethostent_r_proto" in
14581	define)
14582	case "$sethostent_r_proto" in
14583	''|0) try='int sethostent_r(int, struct hostent_data*);'
14584	./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14585	esac
14586	case "$sethostent_r_proto" in
14587	''|0) try='void sethostent_r(int, struct hostent_data*);'
14588	./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14589	esac
14590	case "$sethostent_r_proto" in
14591	''|0)	d_sethostent_r=undef
14592 	        sethostent_r_proto=0
14593		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14594	* )	case "$sethostent_r_proto" in
14595		REENTRANT_PROTO*) ;;
14596		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14597		esac
14598		echo "Prototype: $try" ;;
14599	esac
14600	;;
14601	*)	case "$usethreads" in
14602		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14603		esac
14604		d_sethostent_r=undef
14605		sethostent_r_proto=0
14606		;;
14607	esac
14608	;;
14609*)	sethostent_r_proto=0
14610	;;
14611esac
14612
14613: see if setitimer exists
14614set setitimer d_setitimer
14615eval $inlibc
14616
14617: see if setlinebuf exists
14618set setlinebuf d_setlinebuf
14619eval $inlibc
14620
14621: see if setlocale exists
14622set setlocale d_setlocale
14623eval $inlibc
14624
14625: see if locale.h is available
14626set locale.h i_locale
14627eval $inhdr
14628
14629: see if setlocale_r exists
14630set setlocale_r d_setlocale_r
14631eval $inlibc
14632case "$d_setlocale_r" in
14633"$define")
14634	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14635	case "$d_setlocale_r_proto:$usethreads" in
14636	":define")	d_setlocale_r_proto=define
14637		set d_setlocale_r_proto setlocale_r $hdrs
14638		eval $hasproto ;;
14639	*)	;;
14640	esac
14641	case "$d_setlocale_r_proto" in
14642	define)
14643	case "$setlocale_r_proto" in
14644	''|0) try='int setlocale_r(int, const char*, char*, int);'
14645	./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14646	esac
14647	case "$setlocale_r_proto" in
14648	''|0)	d_setlocale_r=undef
14649 	        setlocale_r_proto=0
14650		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14651	* )	case "$setlocale_r_proto" in
14652		REENTRANT_PROTO*) ;;
14653		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14654		esac
14655		echo "Prototype: $try" ;;
14656	esac
14657	;;
14658	*)	case "$usethreads" in
14659		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14660		esac
14661		d_setlocale_r=undef
14662		setlocale_r_proto=0
14663		;;
14664	esac
14665	;;
14666*)	setlocale_r_proto=0
14667	;;
14668esac
14669
14670: see if setnetent exists
14671set setnetent d_setnent
14672eval $inlibc
14673
14674: see if setnetent_r exists
14675set setnetent_r d_setnetent_r
14676eval $inlibc
14677case "$d_setnetent_r" in
14678"$define")
14679	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14680	case "$d_setnetent_r_proto:$usethreads" in
14681	":define")	d_setnetent_r_proto=define
14682		set d_setnetent_r_proto setnetent_r $hdrs
14683		eval $hasproto ;;
14684	*)	;;
14685	esac
14686	case "$d_setnetent_r_proto" in
14687	define)
14688	case "$setnetent_r_proto" in
14689	''|0) try='int setnetent_r(int, struct netent_data*);'
14690	./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14691	esac
14692	case "$setnetent_r_proto" in
14693	''|0) try='void setnetent_r(int, struct netent_data*);'
14694	./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14695	esac
14696	case "$setnetent_r_proto" in
14697	''|0)	d_setnetent_r=undef
14698 	        setnetent_r_proto=0
14699		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14700	* )	case "$setnetent_r_proto" in
14701		REENTRANT_PROTO*) ;;
14702		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14703		esac
14704		echo "Prototype: $try" ;;
14705	esac
14706	;;
14707	*)	case "$usethreads" in
14708		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14709		esac
14710		d_setnetent_r=undef
14711		setnetent_r_proto=0
14712		;;
14713	esac
14714	;;
14715*)	setnetent_r_proto=0
14716	;;
14717esac
14718
14719: see if setprotoent exists
14720set setprotoent d_setpent
14721eval $inlibc
14722
14723: see if setpgid exists
14724set setpgid d_setpgid
14725eval $inlibc
14726
14727: see if setpgrp2 exists
14728set setpgrp2 d_setpgrp2
14729eval $inlibc
14730
14731: see if setpriority exists
14732set setpriority d_setprior
14733eval $inlibc
14734
14735: see if setproctitle exists
14736set setproctitle d_setproctitle
14737eval $inlibc
14738
14739: see if setprotoent_r exists
14740set setprotoent_r d_setprotoent_r
14741eval $inlibc
14742case "$d_setprotoent_r" in
14743"$define")
14744	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14745	case "$d_setprotoent_r_proto:$usethreads" in
14746	":define")	d_setprotoent_r_proto=define
14747		set d_setprotoent_r_proto setprotoent_r $hdrs
14748		eval $hasproto ;;
14749	*)	;;
14750	esac
14751	case "$d_setprotoent_r_proto" in
14752	define)
14753	case "$setprotoent_r_proto" in
14754	''|0) try='int setprotoent_r(int, struct protoent_data*);'
14755	./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14756	esac
14757	case "$setprotoent_r_proto" in
14758	''|0) try='void setprotoent_r(int, struct protoent_data*);'
14759	./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14760	esac
14761	case "$setprotoent_r_proto" in
14762	''|0)	d_setprotoent_r=undef
14763 	        setprotoent_r_proto=0
14764		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14765	* )	case "$setprotoent_r_proto" in
14766		REENTRANT_PROTO*) ;;
14767		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14768		esac
14769		echo "Prototype: $try" ;;
14770	esac
14771	;;
14772	*)	case "$usethreads" in
14773		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14774		esac
14775		d_setprotoent_r=undef
14776		setprotoent_r_proto=0
14777		;;
14778	esac
14779	;;
14780*)	setprotoent_r_proto=0
14781	;;
14782esac
14783
14784: see if setpwent exists
14785set setpwent d_setpwent
14786eval $inlibc
14787
14788: see if setpwent_r exists
14789set setpwent_r d_setpwent_r
14790eval $inlibc
14791case "$d_setpwent_r" in
14792"$define")
14793	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14794	case "$d_setpwent_r_proto:$usethreads" in
14795	":define")	d_setpwent_r_proto=define
14796		set d_setpwent_r_proto setpwent_r $hdrs
14797		eval $hasproto ;;
14798	*)	;;
14799	esac
14800	case "$d_setpwent_r_proto" in
14801	define)
14802	case "$setpwent_r_proto" in
14803	''|0) try='int setpwent_r(FILE**);'
14804	./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14805	esac
14806	case "$setpwent_r_proto" in
14807	''|0) try='void setpwent_r(FILE**);'
14808	./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14809	esac
14810	case "$setpwent_r_proto" in
14811	''|0)	d_setpwent_r=undef
14812 	        setpwent_r_proto=0
14813		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14814	* )	case "$setpwent_r_proto" in
14815		REENTRANT_PROTO*) ;;
14816		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14817		esac
14818		echo "Prototype: $try" ;;
14819	esac
14820	;;
14821	*)	case "$usethreads" in
14822		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14823		esac
14824		d_setpwent_r=undef
14825		setpwent_r_proto=0
14826		;;
14827	esac
14828	;;
14829*)	setpwent_r_proto=0
14830	;;
14831esac
14832
14833: see if setregid exists
14834set setregid d_setregid
14835eval $inlibc
14836set setresgid d_setresgid
14837eval $inlibc
14838
14839: see if setreuid exists
14840set setreuid d_setreuid
14841eval $inlibc
14842set setresuid d_setresuid
14843eval $inlibc
14844
14845: see if setrgid exists
14846set setrgid d_setrgid
14847eval $inlibc
14848
14849: see if setruid exists
14850set setruid d_setruid
14851eval $inlibc
14852
14853: see if setservent exists
14854set setservent d_setsent
14855eval $inlibc
14856
14857: see if setservent_r exists
14858set setservent_r d_setservent_r
14859eval $inlibc
14860case "$d_setservent_r" in
14861"$define")
14862	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14863	case "$d_setservent_r_proto:$usethreads" in
14864	":define")	d_setservent_r_proto=define
14865		set d_setservent_r_proto setservent_r $hdrs
14866		eval $hasproto ;;
14867	*)	;;
14868	esac
14869	case "$d_setservent_r_proto" in
14870	define)
14871	case "$setservent_r_proto" in
14872	''|0) try='int setservent_r(int, struct servent_data*);'
14873	./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14874	esac
14875	case "$setservent_r_proto" in
14876	''|0) try='void setservent_r(int, struct servent_data*);'
14877	./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14878	esac
14879	case "$setservent_r_proto" in
14880	''|0)	d_setservent_r=undef
14881 	        setservent_r_proto=0
14882		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14883	* )	case "$setservent_r_proto" in
14884		REENTRANT_PROTO*) ;;
14885		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14886		esac
14887		echo "Prototype: $try" ;;
14888	esac
14889	;;
14890	*)	case "$usethreads" in
14891		define) echo "setservent_r has no prototype, not using it." >&4 ;;
14892		esac
14893		d_setservent_r=undef
14894		setservent_r_proto=0
14895		;;
14896	esac
14897	;;
14898*)	setservent_r_proto=0
14899	;;
14900esac
14901
14902: see if setsid exists
14903set setsid d_setsid
14904eval $inlibc
14905
14906: see if setvbuf exists
14907set setvbuf d_setvbuf
14908eval $inlibc
14909
14910: see if sfio.h is available
14911set sfio.h i_sfio
14912eval $inhdr
14913
14914
14915: see if sfio library is available
14916case "$i_sfio" in
14917$define)
14918	val=''
14919	set sfreserve val
14920	eval $inlibc
14921	;;
14922*)
14923	val="$undef"
14924	;;
14925esac
14926: Ok, but do we want to use it.
14927case "$val" in
14928$define)
14929	case "$usesfio" in
14930	true|$define|[yY]*) dflt='y';;
14931	*) dflt='n';;
14932	esac
14933	echo "$package can use the sfio library, but it is experimental."
14934	case "$useperlio" in
14935	"$undef")
14936	    echo "For sfio also the PerlIO abstraction layer is needed."
14937	    echo "Earlier you said you wouldn't want that."
14938	    ;;
14939	esac
14940	rp="You seem to have sfio available, do you want to try using it?"
14941	. ./myread
14942	case "$ans" in
14943	y|Y)	echo "Ok, turning on both sfio and PerlIO, then."
14944		useperlio="$define"
14945		val="$define"
14946		;;
14947	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14948		val="$undef"
14949		;;
14950	esac
14951	;;
14952*)	case "$usesfio" in
14953	true|$define|[yY]*)
14954		echo "Sorry, cannot find sfio on this machine." >&4
14955		echo "Ignoring your setting of usesfio=$usesfio." >&4
14956		val="$undef"
14957		;;
14958	esac
14959	;;
14960esac
14961set d_sfio
14962eval $setvar
14963case "$d_sfio" in
14964$define) usesfio='true';;
14965*) usesfio='false';;
14966esac
14967case "$d_sfio" in
14968$define) ;;
14969*)	: Remove sfio from list of libraries to use
14970	case "$libs" in
14971	*-lsfio*)
14972		echo "Removing unneeded -lsfio from library list" >&4
14973		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14974		shift
14975		libs="$*"
14976		echo "libs = $libs" >&4
14977		;;
14978	esac
14979;;
14980esac
14981
14982
14983: see if shmctl exists
14984set shmctl d_shmctl
14985eval $inlibc
14986
14987: see if shmget exists
14988set shmget d_shmget
14989eval $inlibc
14990
14991: see if shmat exists
14992set shmat d_shmat
14993eval $inlibc
14994: see what shmat returns
14995case "$d_shmat" in
14996"$define")
14997	$cat >shmat.c <<'END'
14998#include <sys/shm.h>
14999void *shmat();
15000END
15001	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15002		shmattype='void *'
15003	else
15004		shmattype='char *'
15005	fi
15006	echo "and it returns ($shmattype)." >&4
15007	: see if a prototype for shmat is available
15008	xxx=`./findhdr sys/shm.h`
15009	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15010	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15011		val="$define"
15012	else
15013		val="$undef"
15014	fi
15015	$rm -f shmat.[co]
15016	;;
15017*)
15018	val="$undef"
15019	;;
15020esac
15021set d_shmatprototype
15022eval $setvar
15023
15024: see if shmdt exists
15025set shmdt d_shmdt
15026eval $inlibc
15027
15028: see how much of the 'shm*(2)' library is present.
15029h_shm=true
15030echo " "
15031case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15032*"$undef"*) h_shm=false;;
15033esac
15034case "$osname" in
15035freebsd)
15036    case "`ipcs 2>&1`" in
15037    "SVID shared memory"*"not configured"*)
15038	echo "Your $osname does not have the shm*(2) configured." >&4
15039        h_shm=false
15040	val="$undef"
15041	set shmctl d_shmctl
15042	evat $setvar
15043	set shmget d_shmget
15044	evat $setvar
15045	set shmat d_shmat
15046	evat $setvar
15047	set shmdt d_shmdt
15048	evat $setvar
15049	;;
15050    esac
15051    ;;
15052esac
15053: we could also check for sys/ipc.h ...
15054if $h_shm && $test `./findhdr sys/shm.h`; then
15055	echo "You have the full shm*(2) library." >&4
15056	val="$define"
15057else
15058	echo "You don't have the full shm*(2) library." >&4
15059	val="$undef"
15060fi
15061set d_shm
15062eval $setvar
15063
15064echo " "
15065: see if we have sigaction
15066if set sigaction val -f d_sigaction; eval $csym; $val; then
15067	echo 'sigaction() found.' >&4
15068	$cat > try.c <<'EOP'
15069#include <stdio.h>
15070#include <sys/types.h>
15071#include <signal.h>
15072int main()
15073{
15074    struct sigaction act, oact;
15075    act.sa_flags = 0;
15076    oact.sa_handler = 0;
15077    /* so that act and oact are used */
15078    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15079}
15080EOP
15081	set try
15082	if eval $compile_ok; then
15083		val="$define"
15084	else
15085		echo "But you don't seem to have a useable struct sigaction." >&4
15086		val="$undef"
15087	fi
15088else
15089	echo 'sigaction NOT found.' >&4
15090	val="$undef"
15091fi
15092set d_sigaction; eval $setvar
15093$rm -f try try$_o try.c
15094
15095: see if sigprocmask exists
15096set sigprocmask d_sigprocmask
15097eval $inlibc
15098
15099: see if sigsetjmp exists
15100echo " "
15101case "$d_sigsetjmp" in
15102'')
15103	$cat >try.c <<'EOP'
15104#include <setjmp.h>
15105sigjmp_buf env;
15106int set = 1;
15107int main()
15108{
15109	if (sigsetjmp(env,1))
15110		exit(set);
15111	set = 0;
15112	siglongjmp(env, 1);
15113	exit(1);
15114}
15115EOP
15116	set try
15117	if eval $compile; then
15118		if $run ./try >/dev/null 2>&1; then
15119			echo "POSIX sigsetjmp found." >&4
15120			val="$define"
15121		else
15122			$cat >&4 <<EOM
15123Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15124I'll ignore them.
15125EOM
15126			val="$undef"
15127		fi
15128	else
15129		echo "sigsetjmp not found." >&4
15130		val="$undef"
15131	fi
15132	;;
15133*) val="$d_sigsetjmp"
15134	case "$d_sigsetjmp" in
15135	$define) echo "POSIX sigsetjmp found." >&4;;
15136	$undef) echo "sigsetjmp not found." >&4;;
15137	esac
15138	;;
15139esac
15140set d_sigsetjmp
15141eval $setvar
15142$rm -f try.c try
15143
15144: see if sockatmark exists
15145set sockatmark d_sockatmark
15146eval $inlibc
15147
15148: see if prototype for sockatmark is available
15149echo " "
15150set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15151eval $hasproto
15152
15153: see if socks5_init exists
15154set socks5_init d_socks5_init
15155eval $inlibc
15156
15157: see if srand48_r exists
15158set srand48_r d_srand48_r
15159eval $inlibc
15160case "$d_srand48_r" in
15161"$define")
15162	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15163	case "$d_srand48_r_proto:$usethreads" in
15164	":define")	d_srand48_r_proto=define
15165		set d_srand48_r_proto srand48_r $hdrs
15166		eval $hasproto ;;
15167	*)	;;
15168	esac
15169	case "$d_srand48_r_proto" in
15170	define)
15171	case "$srand48_r_proto" in
15172	''|0) try='int srand48_r(long, struct drand48_data*);'
15173	./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15174	esac
15175	case "$srand48_r_proto" in
15176	''|0)	d_srand48_r=undef
15177 	        srand48_r_proto=0
15178		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15179	* )	case "$srand48_r_proto" in
15180		REENTRANT_PROTO*) ;;
15181		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15182		esac
15183		echo "Prototype: $try" ;;
15184	esac
15185	;;
15186	*)	case "$usethreads" in
15187		define) echo "srand48_r has no prototype, not using it." >&4 ;;
15188		esac
15189		d_srand48_r=undef
15190		srand48_r_proto=0
15191		;;
15192	esac
15193	;;
15194*)	srand48_r_proto=0
15195	;;
15196esac
15197
15198: see if srandom_r exists
15199set srandom_r d_srandom_r
15200eval $inlibc
15201case "$d_srandom_r" in
15202"$define")
15203	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15204	case "$d_srandom_r_proto:$usethreads" in
15205	":define")	d_srandom_r_proto=define
15206		set d_srandom_r_proto srandom_r $hdrs
15207		eval $hasproto ;;
15208	*)	;;
15209	esac
15210	case "$d_srandom_r_proto" in
15211	define)
15212	case "$srandom_r_proto" in
15213	''|0) try='int srandom_r(unsigned int, struct random_data*);'
15214	./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15215	esac
15216	case "$srandom_r_proto" in
15217	''|0)	d_srandom_r=undef
15218 	        srandom_r_proto=0
15219		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15220	* )	case "$srandom_r_proto" in
15221		REENTRANT_PROTO*) ;;
15222		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15223		esac
15224		echo "Prototype: $try" ;;
15225	esac
15226	;;
15227	*)	case "$usethreads" in
15228		define) echo "srandom_r has no prototype, not using it." >&4 ;;
15229		esac
15230		d_srandom_r=undef
15231		srandom_r_proto=0
15232		;;
15233	esac
15234	;;
15235*)	srandom_r_proto=0
15236	;;
15237esac
15238
15239: see if prototype for setresgid is available
15240echo " "
15241set d_sresgproto setresgid $i_unistd unistd.h
15242eval $hasproto
15243
15244: see if prototype for setresuid is available
15245echo " "
15246set d_sresuproto setresuid $i_unistd unistd.h
15247eval $hasproto
15248
15249: see if sys/stat.h is available
15250set sys/stat.h i_sysstat
15251eval $inhdr
15252
15253
15254: see if stat knows about block sizes
15255echo " "
15256echo "Checking to see if your struct stat has st_blocks field..." >&4
15257set d_statblks stat st_blocks $i_sysstat sys/stat.h
15258eval $hasfield
15259
15260
15261: see if this is a sys/vfs.h system
15262set sys/vfs.h i_sysvfs
15263eval $inhdr
15264
15265
15266: see if this is a sys/statfs.h system
15267set sys/statfs.h i_sysstatfs
15268eval $inhdr
15269
15270
15271echo " "
15272echo "Checking to see if your system supports struct statfs..." >&4
15273set 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
15274eval $hasstruct
15275case "$d_statfs_s" in
15276"$define")      echo "Yes, it does."   ;;
15277*)              echo "No, it doesn't." ;;
15278esac
15279
15280
15281
15282: see if struct statfs knows about f_flags
15283case "$d_statfs_s" in
15284define)
15285	echo " "
15286	echo "Checking to see if your struct statfs has f_flags field..." >&4
15287	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
15288	eval $hasfield
15289	;;
15290*)	val="$undef"
15291	set d_statfs_f_flags
15292	eval $setvar
15293	;;
15294esac
15295case "$d_statfs_f_flags" in
15296"$define")      echo "Yes, it does."   ;;
15297*)              echo "No, it doesn't." ;;
15298esac
15299
15300: see if _ptr and _cnt from stdio act std
15301echo " "
15302
15303if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15304	echo "(Looks like you have stdio.h from BSD.)"
15305	case "$stdio_ptr" in
15306	'') stdio_ptr='((fp)->_p)'
15307		ptr_lval=$define
15308		;;
15309	*)	ptr_lval=$d_stdio_ptr_lval;;
15310	esac
15311	case "$stdio_cnt" in
15312	'') stdio_cnt='((fp)->_r)'
15313		cnt_lval=$define
15314		;;
15315	*)	cnt_lval=$d_stdio_cnt_lval;;
15316	esac
15317	case "$stdio_base" in
15318	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15319	esac
15320	case "$stdio_bufsiz" in
15321	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15322	esac
15323elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15324	echo "(Looks like you have stdio.h from Linux.)"
15325	case "$stdio_ptr" in
15326	'') stdio_ptr='((fp)->_IO_read_ptr)'
15327		ptr_lval=$define
15328		;;
15329	*)	ptr_lval=$d_stdio_ptr_lval;;
15330	esac
15331	case "$stdio_cnt" in
15332	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15333		cnt_lval=$undef
15334		;;
15335	*)	cnt_lval=$d_stdio_cnt_lval;;
15336	esac
15337	case "$stdio_base" in
15338	'') stdio_base='((fp)->_IO_read_base)';;
15339	esac
15340	case "$stdio_bufsiz" in
15341	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15342	esac
15343else
15344	case "$stdio_ptr" in
15345	'') stdio_ptr='((fp)->_ptr)'
15346		ptr_lval=$define
15347		;;
15348	*)	ptr_lval=$d_stdio_ptr_lval;;
15349	esac
15350	case "$stdio_cnt" in
15351	'') stdio_cnt='((fp)->_cnt)'
15352		cnt_lval=$define
15353		;;
15354	*)	cnt_lval=$d_stdio_cnt_lval;;
15355	esac
15356	case "$stdio_base" in
15357	'') stdio_base='((fp)->_base)';;
15358	esac
15359	case "$stdio_bufsiz" in
15360	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15361	esac
15362fi
15363
15364: test whether _ptr and _cnt really work
15365echo "Checking how std your stdio is..." >&4
15366$cat >try.c <<EOP
15367#include <stdio.h>
15368#define FILE_ptr(fp)	$stdio_ptr
15369#define FILE_cnt(fp)	$stdio_cnt
15370int main() {
15371	FILE *fp = fopen("try.c", "r");
15372	char c = getc(fp);
15373	if (
15374		18 <= FILE_cnt(fp) &&
15375		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15376	)
15377		exit(0);
15378	exit(1);
15379}
15380EOP
15381val="$undef"
15382set try
15383if eval $compile && $to try.c; then
15384	if $run ./try; then
15385		echo "Your stdio acts pretty std."
15386		val="$define"
15387	else
15388		echo "Your stdio isn't very std."
15389	fi
15390else
15391	echo "Your stdio doesn't appear very std."
15392fi
15393$rm -f try.c try
15394
15395# glibc 2.2.90 and above apparently change stdio streams so Perl's
15396# direct buffer manipulation no longer works.  The Configure tests
15397# should be changed to correctly detect this, but until then,
15398# the following check should at least let perl compile and run.
15399# (This quick fix should be updated before 5.8.1.)
15400# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15401# A. Dougherty, June 3, 2002.
15402case "$d_gnulibc" in
15403$define)
15404	case "$gnulibc_version" in
15405	2.[01]*)  ;;
15406	2.2) ;;
15407	2.2.[0-9]) ;;
15408	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15409		val="$undef"
15410		;;
15411	esac
15412	;;
15413esac
15414set d_stdstdio
15415eval $setvar
15416
15417: Can _ptr be used as an lvalue?
15418case "$d_stdstdio$ptr_lval" in
15419$define$define) val=$define ;;
15420*) val=$undef ;;
15421esac
15422set d_stdio_ptr_lval
15423eval $setvar
15424
15425: Can _cnt be used as an lvalue?
15426case "$d_stdstdio$cnt_lval" in
15427$define$define) val=$define ;;
15428*) val=$undef ;;
15429esac
15430set d_stdio_cnt_lval
15431eval $setvar
15432
15433
15434: test whether setting _ptr sets _cnt as a side effect
15435d_stdio_ptr_lval_sets_cnt="$undef"
15436d_stdio_ptr_lval_nochange_cnt="$undef"
15437case "$d_stdio_ptr_lval$d_stdstdio" in
15438$define$define)
15439	echo "Checking to see what happens if we set the stdio ptr..." >&4
15440$cat >try.c <<EOP
15441#include <stdio.h>
15442/* Can we scream? */
15443/* Eat dust sed :-) */
15444/* In the buffer space, no one can hear you scream. */
15445#define FILE_ptr(fp)	$stdio_ptr
15446#define FILE_cnt(fp)	$stdio_cnt
15447#include <sys/types.h>
15448int main() {
15449	FILE *fp = fopen("try.c", "r");
15450	int c;
15451	char *ptr;
15452	size_t cnt;
15453	if (!fp) {
15454	    puts("Fail even to read");
15455	    exit(1);
15456	}
15457	c = getc(fp); /* Read away the first # */
15458	if (c == EOF) {
15459	    puts("Fail even to read");
15460	    exit(1);
15461	}
15462	if (!(
15463		18 <= FILE_cnt(fp) &&
15464		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15465	)) {
15466		puts("Fail even to read");
15467		exit (1);
15468	}
15469	ptr = (char*) FILE_ptr(fp);
15470	cnt = (size_t)FILE_cnt(fp);
15471
15472	FILE_ptr(fp) += 42;
15473
15474	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15475		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15476		exit (1);
15477	}
15478	if (FILE_cnt(fp) <= 20) {
15479		printf ("Fail (<20 chars to test)");
15480		exit (1);
15481	}
15482	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15483		puts("Fail compare");
15484		exit (1);
15485	}
15486	if (cnt == FILE_cnt(fp)) {
15487		puts("Pass_unchanged");
15488		exit (0);
15489	}	
15490	if (FILE_cnt(fp) == (cnt - 42)) {
15491		puts("Pass_changed");
15492		exit (0);
15493	}
15494	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15495	return 1;
15496
15497}
15498EOP
15499	set try
15500	if eval $compile && $to try.c; then
15501 		case `$run ./try` in
15502		Pass_changed)
15503			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15504			d_stdio_ptr_lval_sets_cnt="$define" ;;
15505		Pass_unchanged)
15506			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15507			d_stdio_ptr_lval_nochange_cnt="$define" ;;
15508		Fail*)
15509			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15510		*)
15511			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15512	esac
15513	else
15514		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15515	fi
15516	$rm -f try.c try
15517	;;
15518esac
15519
15520: see if _base is also standard
15521val="$undef"
15522case "$d_stdstdio" in
15523$define)
15524	$cat >try.c <<EOP
15525#include <stdio.h>
15526#define FILE_base(fp)	$stdio_base
15527#define FILE_bufsiz(fp)	$stdio_bufsiz
15528int main() {
15529	FILE *fp = fopen("try.c", "r");
15530	char c = getc(fp);
15531	if (
15532		19 <= FILE_bufsiz(fp) &&
15533		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15534	)
15535		exit(0);
15536	exit(1);
15537}
15538EOP
15539	set try
15540	if eval $compile && $to try.c; then
15541		if $run ./try; then
15542			echo "And its _base field acts std."
15543			val="$define"
15544		else
15545			echo "But its _base field isn't std."
15546		fi
15547	else
15548		echo "However, it seems to be lacking the _base field."
15549	fi
15550	$rm -f try.c try
15551	;;
15552esac
15553set d_stdiobase
15554eval $setvar
15555
15556$cat >&4 <<EOM
15557Checking how to access stdio streams by file descriptor number...
15558EOM
15559case "$stdio_stream_array" in
15560'') 	$cat >try.c <<EOCP
15561#include <stdio.h>
15562int main() {
15563  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15564    printf("yes\n");
15565}
15566EOCP
15567	for s in _iob __iob __sF
15568	do
15569	        set try -DSTDIO_STREAM_ARRAY=$s
15570		if eval $compile; then
15571		    	case "`$run ./try`" in
15572			yes)	stdio_stream_array=$s; break ;;
15573			esac
15574		fi
15575	done
15576	$rm -f try.* try$exe_ext
15577esac
15578case "$stdio_stream_array" in
15579'')	$cat >&4 <<EOM
15580I can't figure out how to access stdio streams by file descriptor number.
15581EOM
15582	d_stdio_stream_array="$undef"
15583	;;
15584*)	$cat >&4 <<EOM
15585You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15586EOM
15587	d_stdio_stream_array="$define"
15588	;;
15589esac
15590
15591: see if strcoll exists
15592set strcoll d_strcoll
15593eval $inlibc
15594
15595: check for structure copying
15596echo " "
15597echo "Checking to see if your C compiler can copy structs..." >&4
15598$cat >try.c <<'EOCP'
15599int main()
15600{
15601	struct blurfl {
15602		int dyick;
15603	} foo, bar;
15604
15605	foo = bar;
15606}
15607EOCP
15608if $cc -c try.c >/dev/null 2>&1 ; then
15609	val="$define"
15610	echo "Yup, it can."
15611else
15612	val="$undef"
15613	echo "Nope, it can't."
15614fi
15615set d_strctcpy
15616eval $setvar
15617$rm -f try.*
15618
15619: see if strerror and/or sys_errlist[] exist
15620echo " "
15621if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15622    if set strerror val -f d_strerror; eval $csym; $val; then
15623		echo 'strerror() found.' >&4
15624		d_strerror="$define"
15625		d_strerrm='strerror(e)'
15626		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15627			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
15628			d_syserrlst="$define"
15629		else
15630			echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15631			d_syserrlst="$undef"
15632		fi
15633    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15634			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15635		echo 'strerror() found in string header.' >&4
15636		d_strerror="$define"
15637		d_strerrm='strerror(e)'
15638		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15639			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15640				d_syserrlst="$define"
15641		else
15642			echo "(You don't appear to have any sys_errlist[], how can this be?)"
15643			d_syserrlst="$undef"
15644		fi
15645    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15646		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15647		d_strerror="$undef"
15648		d_syserrlst="$define"
15649		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15650    else
15651		echo 'strerror() and sys_errlist[] NOT found.' >&4
15652		d_strerror="$undef"
15653		d_syserrlst="$undef"
15654		d_strerrm='"unknown"'
15655    fi
15656fi
15657
15658: see if strerror_r exists
15659set strerror_r d_strerror_r
15660eval $inlibc
15661case "$d_strerror_r" in
15662"$define")
15663	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15664	case "$d_strerror_r_proto:$usethreads" in
15665	":define")	d_strerror_r_proto=define
15666		set d_strerror_r_proto strerror_r $hdrs
15667		eval $hasproto ;;
15668	*)	;;
15669	esac
15670	case "$d_strerror_r_proto" in
15671	define)
15672	case "$strerror_r_proto" in
15673	''|0) try='int strerror_r(int, char*, size_t);'
15674	./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15675	esac
15676	case "$strerror_r_proto" in
15677	''|0) try='int strerror_r(int, char*, int);'
15678	./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15679	esac
15680	case "$strerror_r_proto" in
15681	''|0) try='char* strerror_r(int, char*, size_t);'
15682	./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15683	esac
15684	case "$strerror_r_proto" in
15685	''|0)	d_strerror_r=undef
15686 	        strerror_r_proto=0
15687		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15688	* )	case "$strerror_r_proto" in
15689		REENTRANT_PROTO*) ;;
15690		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15691		esac
15692		echo "Prototype: $try" ;;
15693	esac
15694	;;
15695	*)	case "$usethreads" in
15696		define) echo "strerror_r has no prototype, not using it." >&4 ;;
15697		esac
15698		d_strerror_r=undef
15699		strerror_r_proto=0
15700		;;
15701	esac
15702	;;
15703*)	strerror_r_proto=0
15704	;;
15705esac
15706
15707: see if strftime exists
15708set strftime d_strftime
15709eval $inlibc
15710
15711: see if strtod exists
15712set strtod d_strtod
15713eval $inlibc
15714
15715: see if strtol exists
15716set strtol d_strtol
15717eval $inlibc
15718
15719: see if strtold exists
15720set strtold d_strtold
15721eval $inlibc
15722
15723: see if strtoll exists
15724set strtoll d_strtoll
15725eval $inlibc
15726
15727case "$d_longlong-$d_strtoll" in
15728"$define-$define")
15729	$cat <<EOM
15730Checking whether your strtoll() works okay...
15731EOM
15732	$cat >try.c <<'EOCP'
15733#include <errno.h>
15734#ifdef __hpux
15735#define strtoll __strtoll
15736#endif
15737#ifdef __EMX__
15738#define strtoll _strtoll
15739#endif
15740#include <stdio.h>
15741extern long long int strtoll(char *s, char **, int);
15742static int bad = 0;
15743int check(char *s, long long ell, int een) {
15744	long long gll;
15745	errno = 0;
15746	gll = strtoll(s, 0, 10);
15747	if (!((gll == ell) && (errno == een)))
15748		bad++;
15749}
15750int main() {
15751	check(" 1",                                      1LL, 0);
15752	check(" 0",                                      0LL, 0);
15753	check("-1",                                     -1LL, 0);
15754	check("-9223372036854775808", -9223372036854775808LL, 0);
15755	check("-9223372036854775808", -9223372036854775808LL, 0);
15756	check(" 9223372036854775807",  9223372036854775807LL, 0);
15757	check("-9223372036854775808", -9223372036854775808LL, 0);
15758	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15759	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15760	if (!bad)
15761		printf("ok\n");
15762}
15763EOCP
15764	set try
15765	if eval $compile; then
15766		yyy=`$run ./try`
15767		case "$yyy" in
15768		ok) echo "Your strtoll() seems to be working okay." ;;
15769		*) cat <<EOM >&4
15770Your strtoll() doesn't seem to be working okay.
15771EOM
15772		   d_strtoll="$undef"
15773		   ;;
15774		esac
15775	else
15776		echo "(I can't seem to compile the test program--assuming it doesn't)"
15777		d_strtoll="$undef"
15778	fi
15779	;;
15780esac
15781
15782: see if strtoq exists
15783set strtoq d_strtoq
15784eval $inlibc
15785
15786: see if strtoul exists
15787set strtoul d_strtoul
15788eval $inlibc
15789
15790case "$d_strtoul" in
15791"$define")
15792	$cat <<EOM
15793Checking whether your strtoul() works okay...
15794EOM
15795	$cat >try.c <<'EOCP'
15796#include <errno.h>
15797#include <stdio.h>
15798extern unsigned long int strtoul(char *s, char **, int);
15799static int bad = 0;
15800void check(char *s, unsigned long eul, int een) {
15801	unsigned long gul;
15802	errno = 0;
15803	gul = strtoul(s, 0, 10);
15804	if (!((gul == eul) && (errno == een)))
15805		bad++;
15806}
15807int main() {
15808	check(" 1", 1L, 0);
15809	check(" 0", 0L, 0);
15810EOCP
15811	case "$longsize" in
15812	8)
15813	    $cat >>try.c <<'EOCP'
15814	check("18446744073709551615", 18446744073709551615UL, 0);
15815	check("18446744073709551616", 18446744073709551615UL, ERANGE);
15816#if 0 /* strtoul() for /^-/ strings is undefined. */
15817	check("-1", 18446744073709551615UL, 0);
15818	check("-18446744073709551614", 2, 0);
15819	check("-18446744073709551615", 1, 0);
15820       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15821	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15822#endif
15823EOCP
15824		;;
15825	4)
15826		    $cat >>try.c <<'EOCP'
15827	check("4294967295", 4294967295UL, 0);
15828	check("4294967296", 4294967295UL, ERANGE);
15829#if 0 /* strtoul() for /^-/ strings is undefined. */
15830	check("-1", 4294967295UL, 0);
15831	check("-4294967294", 2, 0);
15832	check("-4294967295", 1, 0);
15833       	check("-4294967296", 4294967295UL, ERANGE);
15834	check("-4294967297", 4294967295UL, ERANGE);
15835#endif
15836EOCP
15837		;;
15838	*)
15839: Should we write these tests to be more portable by sprintf-ing
15840: ~0 and then manipulating that char string as input for strtol?
15841		;;
15842	esac
15843	$cat >>try.c <<'EOCP'
15844	if (!bad)
15845		printf("ok\n");
15846	return 0;
15847}
15848EOCP
15849	set try
15850	if eval $compile; then
15851		case "`$run ./try`" in
15852		ok) echo "Your strtoul() seems to be working okay." ;;
15853		*) cat <<EOM >&4
15854Your strtoul() doesn't seem to be working okay.
15855EOM
15856		   d_strtoul="$undef"
15857		   ;;
15858		esac
15859	fi
15860	;;
15861esac
15862
15863: see if strtoull exists
15864set strtoull d_strtoull
15865eval $inlibc
15866
15867case "$d_longlong-$d_strtoull" in
15868"$define-$define")
15869	$cat <<EOM
15870Checking whether your strtoull() works okay...
15871EOM
15872	$cat >try.c <<'EOCP'
15873#include <errno.h>
15874#ifdef __hpux
15875#define strtoull __strtoull
15876#endif
15877#include <stdio.h>
15878extern unsigned long long int strtoull(char *s, char **, int);
15879static int bad = 0;
15880int check(char *s, long long eull, int een) {
15881	long long gull;
15882	errno = 0;
15883	gull = strtoull(s, 0, 10);
15884	if (!((gull == eull) && (errno == een)))
15885		bad++;
15886}
15887int main() {
15888	check(" 1",                                        1LL, 0);
15889	check(" 0",                                        0LL, 0);
15890	check("18446744073709551615",  18446744073709551615ULL, 0);
15891	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15892#if 0 /* strtoull() for /^-/ strings is undefined. */
15893	check("-1",                    18446744073709551615ULL, 0);
15894	check("-18446744073709551614",                     2LL, 0);
15895	check("-18446744073709551615",                     1LL, 0);
15896       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15897	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15898#endif
15899	if (!bad)
15900		printf("ok\n");
15901}
15902EOCP
15903	set try
15904	if eval $compile; then
15905		case "`$run ./try`" in
15906		ok) echo "Your strtoull() seems to be working okay." ;;
15907		*) cat <<EOM >&4
15908Your strtoull() doesn't seem to be working okay.
15909EOM
15910		   d_strtoull="$undef"
15911		   ;;
15912		esac
15913	fi
15914	;;
15915esac
15916
15917: see if strtouq exists
15918set strtouq d_strtouq
15919eval $inlibc
15920
15921case "$d_strtouq" in
15922"$define")
15923	$cat <<EOM
15924Checking whether your strtouq() works okay...
15925EOM
15926	$cat >try.c <<'EOCP'
15927#include <errno.h>
15928#include <stdio.h>
15929extern unsigned long long int strtouq(char *s, char **, int);
15930static int bad = 0;
15931void check(char *s, unsigned long long eull, int een) {
15932	unsigned long long gull;
15933	errno = 0;
15934	gull = strtouq(s, 0, 10);
15935	if (!((gull == eull) && (errno == een)))
15936		bad++;
15937}
15938int main() {
15939	check(" 1",                                        1LL, 0);
15940	check(" 0",                                        0LL, 0);
15941	check("18446744073709551615",  18446744073709551615ULL, 0);
15942	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15943#if 0 /* strtouq() for /^-/ strings is undefined. */
15944	check("-1",                    18446744073709551615ULL, 0);
15945	check("-18446744073709551614",                     2LL, 0);
15946	check("-18446744073709551615",                     1LL, 0);
15947       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15948	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15949#endif
15950	if (!bad)
15951		printf("ok\n");
15952	return 0;
15953}
15954EOCP
15955	set try
15956	if eval $compile; then
15957		case "`$run ./try`" in
15958		ok) echo "Your strtouq() seems to be working okay." ;;
15959		*) cat <<EOM >&4
15960Your strtouq() doesn't seem to be working okay.
15961EOM
15962		   d_strtouq="$undef"
15963		   ;;
15964		esac
15965	fi
15966	;;
15967esac
15968
15969: see if strxfrm exists
15970set strxfrm d_strxfrm
15971eval $inlibc
15972
15973: see if symlink exists
15974set symlink d_symlink
15975eval $inlibc
15976
15977: see if syscall exists
15978set syscall d_syscall
15979eval $inlibc
15980
15981: see if prototype for syscall is available
15982echo " "
15983set d_syscallproto syscall $i_unistd unistd.h
15984eval $hasproto
15985
15986: see if sysconf exists
15987set sysconf d_sysconf
15988eval $inlibc
15989
15990: see if system exists
15991set system d_system
15992eval $inlibc
15993
15994: see if tcgetpgrp exists
15995set tcgetpgrp d_tcgetpgrp
15996eval $inlibc
15997
15998: see if tcsetpgrp exists
15999set tcsetpgrp d_tcsetpgrp
16000eval $inlibc
16001
16002: see if prototype for telldir is available
16003echo " "
16004set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16005eval $hasproto
16006
16007: see if time exists
16008echo " "
16009if test "X$d_time" = X -o X"$timetype" = X; then
16010    if set time val -f d_time; eval $csym; $val; then
16011		echo 'time() found.' >&4
16012		val="$define"
16013		rp="What is the type returned by time() on this system?"
16014		set time_t timetype long stdio.h sys/types.h
16015		eval $typedef_ask
16016    else
16017		echo 'time() not found, hope that will do.' >&4
16018		val="$undef"
16019		timetype='int';
16020    fi
16021    set d_time
16022    eval $setvar
16023fi
16024
16025: see if this is a sys/times.h system
16026set sys/times.h i_systimes
16027eval $inhdr
16028
16029: see if times exists
16030echo " "
16031if set times val -f d_times; eval $csym; $val; then
16032	echo 'times() found.' >&4
16033	d_times="$define"
16034	inc=''
16035	case "$i_systimes" in
16036	"$define") inc='sys/times.h';;
16037	esac
16038	rp="What is the type returned by times() on this system?"
16039	set clock_t clocktype long stdio.h sys/types.h $inc
16040	eval $typedef_ask
16041else
16042	echo 'times() NOT found, hope that will do.' >&4
16043	d_times="$undef"
16044	clocktype='int'
16045fi
16046
16047: see if tmpnam_r exists
16048set tmpnam_r d_tmpnam_r
16049eval $inlibc
16050case "$d_tmpnam_r" in
16051"$define")
16052	hdrs="$i_systypes sys/types.h define stdio.h "
16053	case "$d_tmpnam_r_proto:$usethreads" in
16054	":define")	d_tmpnam_r_proto=define
16055		set d_tmpnam_r_proto tmpnam_r $hdrs
16056		eval $hasproto ;;
16057	*)	;;
16058	esac
16059	case "$d_tmpnam_r_proto" in
16060	define)
16061	case "$tmpnam_r_proto" in
16062	''|0) try='char* tmpnam_r(char*);'
16063	./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16064	esac
16065	case "$tmpnam_r_proto" in
16066	''|0)	d_tmpnam_r=undef
16067 	        tmpnam_r_proto=0
16068		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16069	* )	case "$tmpnam_r_proto" in
16070		REENTRANT_PROTO*) ;;
16071		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16072		esac
16073		echo "Prototype: $try" ;;
16074	esac
16075	;;
16076	*)	case "$usethreads" in
16077		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16078		esac
16079		d_tmpnam_r=undef
16080		tmpnam_r_proto=0
16081		;;
16082	esac
16083	;;
16084*)	tmpnam_r_proto=0
16085	;;
16086esac
16087
16088: see if truncate exists
16089set truncate d_truncate
16090eval $inlibc
16091
16092: see if ttyname_r exists
16093set ttyname_r d_ttyname_r
16094eval $inlibc
16095case "$d_ttyname_r" in
16096"$define")
16097	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16098	case "$d_ttyname_r_proto:$usethreads" in
16099	":define")	d_ttyname_r_proto=define
16100		set d_ttyname_r_proto ttyname_r $hdrs
16101		eval $hasproto ;;
16102	*)	;;
16103	esac
16104	case "$d_ttyname_r_proto" in
16105	define)
16106	case "$ttyname_r_proto" in
16107	''|0) try='int ttyname_r(int, char*, size_t);'
16108	./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16109	esac
16110	case "$ttyname_r_proto" in
16111	''|0) try='int ttyname_r(int, char*, int);'
16112	./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16113	esac
16114	case "$ttyname_r_proto" in
16115	''|0) try='char* ttyname_r(int, char*, int);'
16116	./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16117	esac
16118	case "$ttyname_r_proto" in
16119	''|0)	d_ttyname_r=undef
16120 	        ttyname_r_proto=0
16121		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16122	* )	case "$ttyname_r_proto" in
16123		REENTRANT_PROTO*) ;;
16124		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16125		esac
16126		echo "Prototype: $try" ;;
16127	esac
16128	;;
16129	*)	case "$usethreads" in
16130		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16131		esac
16132		d_ttyname_r=undef
16133		ttyname_r_proto=0
16134		;;
16135	esac
16136	;;
16137*)	ttyname_r_proto=0
16138	;;
16139esac
16140
16141: see if tzname[] exists
16142echo " "
16143if set tzname val -a d_tzname; eval $csym; $val; then
16144	val="$define"
16145	echo 'tzname[] found.' >&4
16146else
16147	val="$undef"
16148	echo 'tzname[] NOT found.' >&4
16149fi
16150set d_tzname
16151eval $setvar
16152
16153case "$osname" in
16154next|rhapsody|darwin) multiarch="$define" ;;
16155esac
16156case "$multiarch" in
16157''|[nN]*) multiarch="$undef" ;;
16158esac
16159
16160: check for ordering of bytes in a UV
16161echo " "
16162case "$usecrosscompile$multiarch" in
16163*$define*)
16164	$cat <<EOM
16165You seem to be either cross-compiling or doing a multiarchitecture build,
16166skipping the byteorder check.
16167
16168EOM
16169	byteorder='ffff'
16170	;;
16171*)
16172	case "$byteorder" in
16173	'')
16174		$cat <<'EOM'
16175In the following, larger digits indicate more significance.  A big-endian
16176machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16177little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16178machines may have weird orders like 3412.  A Cray will report 87654321,
16179an Alpha will report 12345678. If the test program works the default is
16180probably right.
16181I'm now running the test program...
16182EOM
16183		$cat >try.c <<EOCP
16184#include <stdio.h>
16185#include <sys/types.h>
16186typedef $uvtype UV;
16187int main()
16188{
16189	int i;
16190	union {
16191		UV l;
16192		char c[$uvsize];
16193	} u;
16194
16195	if ($uvsize > 4)
16196		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16197	else
16198		u.l = (UV)0x04030201;
16199	for (i = 0; i < $uvsize; i++)
16200		printf("%c", u.c[i]+'0');
16201	printf("\n");
16202	exit(0);
16203}
16204EOCP
16205		xxx_prompt=y
16206		set try
16207		if eval $compile && ./try > /dev/null; then
16208			dflt=`$run ./try`
16209			case "$dflt" in
16210			[1-4][1-4][1-4][1-4]|12345678|87654321)
16211				echo "(The test program ran ok.)"
16212				echo "byteorder=$dflt"
16213				xxx_prompt=n
16214			;;
16215			????|????????) echo "(The test program ran ok.)" ;;
16216			*) echo "(The test program didn't run right for some reason.)" ;;
16217			esac
16218		else
16219			dflt='4321'
16220			cat <<'EOM'
16221(I can't seem to compile the test program.  Guessing big-endian...)
16222EOM
16223		fi
16224		case "$xxx_prompt" in
16225		y)
16226			rp="What is the order of bytes in $uvtype?"
16227			. ./myread
16228			byteorder="$ans"
16229			;;
16230		*)	byteorder=$dflt
16231			;;
16232		esac
16233		;;
16234	esac
16235	$rm -f try.c try
16236	;;
16237esac
16238
16239
16240$cat <<EOM
16241
16242Checking to see whether you can access character data unalignedly...
16243EOM
16244case "$d_u32align" in
16245'')   $cat >try.c <<EOCP
16246#include <stdio.h>
16247#define U32 $u32type
16248#define BYTEORDER 0x$byteorder
16249#define U8 $u8type
16250#include <signal.h>
16251#ifdef SIGBUS
16252$signal_t bletch(s) int s; { exit(4); }
16253#endif
16254int main() {
16255#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16256    U8 buf[8];
16257    U32 *up;
16258    int i;
16259
16260    if (sizeof(U32) != 4) {
16261	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16262	exit(1);
16263    }
16264
16265    fflush(stdout);
16266
16267#ifdef SIGBUS
16268    signal(SIGBUS, bletch);
16269#endif
16270
16271    buf[0] = 0;
16272    buf[1] = 0;
16273    buf[2] = 0;
16274    buf[3] = 1;
16275    buf[5] = 0;
16276    buf[6] = 0;
16277    buf[7] = 0;
16278    buf[8] = 1;
16279
16280    for (i = 0; i < 4; i++) {
16281	up = (U32*)(buf + i);
16282	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16283	       (*up == 1 << (8*(3-i)))  /* little-endian */
16284	      )
16285	   )
16286	{
16287	    printf("read failed (%x)\n", *up);
16288	    exit(2);
16289	}
16290    }
16291
16292    /* write test */
16293    for (i = 0; i < 4; i++) {
16294	up = (U32*)(buf + i);
16295	*up = 0xBeef;
16296	if (*up != 0xBeef) {
16297	    printf("write failed (%x)\n", *up);
16298	    exit(3);
16299	}
16300    }
16301
16302    exit(0);
16303#else
16304    printf("1\n");
16305    exit(1);
16306#endif
16307    return 0;
16308}
16309EOCP
16310set try
16311if eval $compile_ok; then
16312	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16313	$run ./try 2>&1 >/dev/null
16314	case "$?" in
16315	0)	cat >&4 <<EOM
16316You can access character data pretty unalignedly.
16317EOM
16318		d_u32align="$undef"
16319		;;
16320	*)	cat >&4 <<EOM
16321It seems that you must access character data in an aligned manner.
16322EOM
16323		d_u32align="$define"
16324		;;
16325	esac
16326else
16327	rp='Can you access character data at unaligned addresses?'
16328	dflt='n'
16329	. ./myread
16330	case "$ans" in
16331	[yY]*)	d_u32align="$undef"  ;;
16332	*)	d_u32align="$define" ;;
16333	esac
16334fi
16335$rm -f core core.try.* try.core
16336;;
16337esac
16338
16339: see if ualarm exists
16340set ualarm d_ualarm
16341eval $inlibc
16342
16343: see if umask exists
16344set umask d_umask
16345eval $inlibc
16346
16347: see if unordered exists
16348set unordered d_unordered
16349eval $inlibc
16350
16351: see if usleep exists
16352set usleep d_usleep
16353eval $inlibc
16354
16355: see if prototype for usleep is available
16356echo " "
16357set d_usleepproto usleep $i_unistd unistd.h
16358eval $hasproto
16359
16360: see if ustat exists
16361set ustat d_ustat
16362eval $inlibc
16363
16364: backward compatibility for d_hvfork
16365if test X$d_hvfork != X; then
16366	d_vfork="$d_hvfork"
16367	d_hvfork=''
16368fi
16369: see if there is a vfork
16370val=''
16371set vfork val
16372eval $inlibc
16373
16374: Ok, but do we want to use it. vfork is reportedly unreliable in
16375: perl on Solaris 2.x, and probably elsewhere.
16376case "$val" in
16377$define)
16378	echo " "
16379	case "$usevfork" in
16380	false) dflt='n';;
16381	*) dflt='y';;
16382	esac
16383	cat <<'EOM'
16384
16385Perl can only use a vfork() that doesn't suffer from strict
16386restrictions on calling functions or modifying global data in
16387the child.  For example, glibc-2.1 contains such a vfork()
16388that is unsuitable.  If your system provides a proper fork()
16389call, chances are that you do NOT want perl to use vfork().
16390
16391EOM
16392	rp="Do you still want to use vfork()?"
16393	. ./myread
16394	case "$ans" in
16395	y|Y) ;;
16396	*)
16397		echo "Ok, we won't use vfork()."
16398		val="$undef"
16399		;;
16400	esac
16401	;;
16402esac
16403set d_vfork
16404eval $setvar
16405case "$d_vfork" in
16406$define) usevfork='true';;
16407*) usevfork='false';;
16408esac
16409
16410: see if closedir exists
16411set closedir d_closedir
16412eval $inlibc
16413
16414case "$d_closedir" in
16415"$define")
16416	echo " "
16417	echo "Checking whether closedir() returns a status..." >&4
16418	cat > try.c <<EOM
16419#$i_dirent I_DIRENT		/**/
16420#$i_sysdir I_SYS_DIR		/**/
16421#$i_sysndir I_SYS_NDIR		/**/
16422#$i_systypes I_SYS_TYPES	/**/
16423
16424#if defined(I_SYS_TYPES)
16425#include <sys/types.h>
16426#endif
16427#if defined(I_DIRENT)
16428#include <dirent.h>
16429#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16430#include <sys/dir.h>
16431#endif
16432#else
16433#ifdef I_SYS_NDIR
16434#include <sys/ndir.h>
16435#else
16436#ifdef I_SYS_DIR
16437#ifdef hp9000s500
16438#include <ndir.h>	/* may be wrong in the future */
16439#else
16440#include <sys/dir.h>
16441#endif
16442#endif
16443#endif
16444#endif 
16445int main() { return closedir(opendir(".")); }
16446EOM
16447	set try
16448	if eval $compile_ok; then
16449		if $run ./try > /dev/null 2>&1 ; then
16450			echo "Yes, it does."
16451			val="$undef"
16452		else
16453			echo "No, it doesn't."
16454			val="$define"
16455		fi
16456	else
16457		echo "(I can't seem to compile the test program--assuming it doesn't)"
16458		val="$define"
16459	fi
16460	;;
16461*)
16462	val="$undef";
16463	;;
16464esac
16465set d_void_closedir
16466eval $setvar
16467$rm -f try try.*
16468: see if there is a wait4
16469set wait4 d_wait4
16470eval $inlibc
16471
16472: see if waitpid exists
16473set waitpid d_waitpid
16474eval $inlibc
16475
16476: see if wcstombs exists
16477set wcstombs d_wcstombs
16478eval $inlibc
16479
16480: see if wctomb exists
16481set wctomb d_wctomb
16482eval $inlibc
16483
16484: see if writev exists
16485set writev d_writev
16486eval $inlibc
16487
16488: preserve RCS keywords in files with variable substitution, grrr
16489Date='$Date'
16490Id='$Id'
16491Log='$Log'
16492RCSfile='$RCSfile'
16493Revision='$Revision'
16494
16495: check for alignment requirements
16496echo " "
16497case "$usecrosscompile$multiarch" in
16498*$define*)
16499	$cat <<EOM
16500You seem to be either cross-compiling or doing a multiarchitecture build,
16501skipping the memory alignment check.
16502
16503EOM
16504	case "$alignbytes" in
16505	'') alignbytes=8 ;;
16506	esac
16507	;;
16508*)
16509	case "$alignbytes" in
16510	'') echo "Checking alignment constraints..." >&4
16511		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16512			$cat >try.c <<'EOCP'
16513typedef long double NV;
16514EOCP
16515		else
16516			$cat >try.c <<'EOCP'
16517typedef double NV;
16518EOCP
16519		fi
16520		$cat >>try.c <<'EOCP'
16521#include <stdio.h>
16522struct foobar {
16523	char foo;
16524	NV bar;
16525} try_algn;
16526int main()
16527{
16528    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16529    return(0);
16530}
16531EOCP
16532		set try
16533		if eval $compile_ok; then
16534			dflt=`$run ./try`
16535		else
16536			dflt='8'
16537			echo "(I can't seem to compile the test program...)"
16538		fi
16539		;;
16540	*) dflt="$alignbytes"
16541		;;
16542	esac
16543	rp="Doubles must be aligned on a how-many-byte boundary?"
16544	. ./myread
16545	alignbytes="$ans"
16546	$rm -f try.c try
16547	;;
16548esac
16549
16550
16551: set the base revision
16552baserev=5.0
16553
16554: how do we catenate cpp tokens here?
16555echo " "
16556echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16557$cat >cpp_stuff.c <<'EOCP'
16558#define RCAT(a,b)a/**/b
16559#define ACAT(a,b)a ## b
16560RCAT(Rei,ser)
16561ACAT(Cir,cus)
16562EOCP
16563$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16564if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16565	echo "Oh!  Smells like ANSI's been here." >&4
16566	echo "We can catify or stringify, separately or together!"
16567	cpp_stuff=42
16568elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16569	echo "Ah, yes!  The good old days!" >&4
16570	echo "However, in the good old days we don't know how to stringify and"
16571	echo "catify at the same time."
16572	cpp_stuff=1
16573else
16574	$cat >&4 <<EOM
16575Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16576to have to edit the values of CAT[2-5] in config.h...
16577EOM
16578	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16579fi
16580$rm -f cpp_stuff.*
16581
16582: see if this is a db.h system
16583set db.h i_db
16584eval $inhdr
16585
16586case "$i_db" in
16587$define)
16588	: Check db version.
16589	echo " "
16590	echo "Checking Berkeley DB version ..." >&4
16591	$cat >try.c <<EOCP
16592#$d_const HASCONST
16593#ifndef HASCONST
16594#define const
16595#endif
16596#include <sys/types.h>
16597#include <stdio.h>
16598#include <db.h>
16599int main(int argc, char *argv[])
16600{
16601#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
16602    int Major, Minor, Patch ;
16603    unsigned long Version ;
16604    (void)db_version(&Major, &Minor, &Patch) ;
16605    if (argc == 2) {
16606        printf("%d %d %d %d %d %d\n",
16607               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16608               Major, Minor, Patch);
16609        exit(0);
16610    }
16611    printf("You have Berkeley DB Version 2 or greater.\n");
16612
16613    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16614		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16615    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16616		Major, Minor, Patch) ;
16617
16618    /* check that db.h & libdb are compatible */
16619    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16620	printf("db.h and libdb are incompatible.\n") ;
16621        exit(3);	
16622    }
16623
16624    printf("db.h and libdb are compatible.\n") ;
16625
16626    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16627		+ DB_VERSION_PATCH ;
16628
16629    /* needs to be >= 2.3.4 */
16630    if (Version < 2003004) {
16631    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16632	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16633        exit(2);	
16634    }
16635
16636    exit(0);
16637#else
16638#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16639    if (argc == 2) {
16640        printf("1 0 0\n");
16641        exit(0);
16642    }
16643    printf("You have Berkeley DB Version 1.\n");
16644    exit(0);	/* DB version < 2: the coast is clear. */
16645#else
16646    exit(1);	/* <db.h> not Berkeley DB? */
16647#endif
16648#endif
16649}
16650EOCP
16651	set try
16652	if eval $compile_ok && $run ./try; then
16653		echo 'Looks OK.' >&4
16654		set `$run ./try 1`
16655		db_version_major=$1
16656		db_version_minor=$2
16657		db_version_patch=$3
16658	else
16659		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16660		i_db=$undef
16661		case " $libs " in
16662		*"-ldb "*)
16663			: Remove db from list of libraries to use
16664			echo "Removing unusable -ldb from library list" >&4
16665			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16666			shift
16667			libs="$*"
16668			echo "libs = $libs" >&4
16669			;;
16670		esac
16671	fi
16672	$rm -f try.*
16673	;;
16674esac
16675
16676case "$i_db" in
16677define)
16678	: Check the return type needed for hash
16679	echo " "
16680	echo "Checking return type needed for hash for Berkeley DB ..." >&4
16681	$cat >try.c <<EOCP
16682#$d_const HASCONST
16683#ifndef HASCONST
16684#define const
16685#endif
16686#include <sys/types.h>
16687#include <db.h>
16688
16689#ifndef DB_VERSION_MAJOR
16690u_int32_t hash_cb (ptr, size)
16691const void *ptr;
16692size_t size;
16693{
16694}
16695HASHINFO info;
16696int main()
16697{
16698	info.hash = hash_cb;
16699}
16700#endif
16701EOCP
16702	if $cc $ccflags -c try.c >try.out 2>&1 ; then
16703		if $contains warning try.out >>/dev/null 2>&1 ; then
16704			db_hashtype='int'
16705		else
16706			db_hashtype='u_int32_t'
16707		fi
16708	else
16709		: XXX Maybe we should just give up here.
16710		db_hashtype=u_int32_t
16711		$cat try.out >&4
16712		echo "Help:  I can't seem to compile the db test program." >&4
16713		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16714	fi
16715	$rm -f try.*
16716	echo "Your version of Berkeley DB uses $db_hashtype for hash."
16717	;;
16718*)	db_hashtype=u_int32_t
16719	;;
16720esac
16721case "$i_db" in
16722define)
16723	: Check the return type needed for prefix
16724	echo " "
16725	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16726	cat >try.c <<EOCP
16727#$d_const HASCONST
16728#ifndef HASCONST
16729#define const
16730#endif
16731#include <sys/types.h>
16732#include <db.h>
16733
16734#ifndef DB_VERSION_MAJOR
16735size_t prefix_cb (key1, key2)
16736const DBT *key1;
16737const DBT *key2;
16738{
16739}
16740BTREEINFO info;
16741int main()
16742{
16743	info.prefix = prefix_cb;
16744}
16745#endif
16746EOCP
16747	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16748		if $contains warning try.out >>/dev/null 2>&1 ; then
16749			db_prefixtype='int'
16750		else
16751			db_prefixtype='size_t'
16752		fi
16753	else
16754		db_prefixtype='size_t'
16755		: XXX Maybe we should just give up here.
16756		$cat try.out >&4
16757		echo "Help:  I can't seem to compile the db test program." >&4
16758		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16759	fi
16760	$rm -f try.*
16761	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16762	;;
16763*)	db_prefixtype='size_t'
16764	;;
16765esac
16766
16767
16768: How can we generate normalized random numbers ?
16769echo " "
16770echo "Looking for a random number function..." >&4
16771case "$randfunc" in
16772'')
16773	if set drand48 val -f; eval $csym; $val; then
16774		dflt="drand48"
16775		echo "Good, found drand48()." >&4
16776	elif set random val -f; eval $csym; $val; then
16777		dflt="random"
16778		echo "OK, found random()." >&4
16779	else
16780		dflt="rand"
16781		echo "Yick, looks like I have to use rand()." >&4
16782	fi
16783	echo " "
16784	;;
16785*)
16786	dflt="$randfunc"
16787	;;
16788esac
16789cont=true
16790
16791case "$ccflags" in
16792*-Dmy_rand=*|*-Dmy_srand=*)
16793	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16794	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16795	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16796	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16797	;;
16798esac
16799
16800while $test "$cont"; do
16801	rp="Use which function to generate random numbers?"
16802	. ./myread
16803	if $test "$ans" = "$dflt"; then
16804		: null
16805	else
16806		randbits=''
16807	fi
16808	randfunc="$ans"
16809	if set $ans val -f; eval $csym; $val; then
16810		cont=''
16811	else
16812		dflt=y
16813		rp="I cannot find function $ans. Use that name anyway?"
16814		. ./myread
16815		dflt=rand
16816		case "$ans" in
16817			[yY]*) cont='';;
16818		esac
16819	fi
16820	case "$cont" in
16821	'')
16822		case "$randfunc" in
16823		drand48)
16824			drand01="drand48()"
16825			seedfunc="srand48"
16826			randbits=48
16827			randseedtype=long
16828			;;
16829		rand|random)
16830			case "$randbits" in
16831			'')
16832echo "Checking to see how many bits your $randfunc() function produces..." >&4
16833				$cat >try.c <<EOCP
16834#$i_unistd I_UNISTD
16835#$i_stdlib I_STDLIB
16836#include <stdio.h>
16837#ifdef I_UNISTD
16838#  include <unistd.h>
16839#endif
16840#ifdef I_STDLIB
16841#  include <stdlib.h>
16842#endif
16843int main()
16844{
16845	register int i;
16846	register unsigned long tmp;
16847	register unsigned long max = 0L;
16848
16849	for (i = 1000; i; i--) {
16850		tmp = (unsigned long) $randfunc();
16851		if (tmp > max) max = tmp;
16852	}
16853	for (i = 0; max; i++)
16854		max /= 2;
16855	printf("%d\n",i);
16856}
16857EOCP
16858				set try
16859				if eval $compile_ok; then
16860					dflt=`try`
16861				else
16862					dflt='?'
16863					echo "(I can't seem to compile the test program...)"
16864				fi
16865				;;
16866			*)
16867				dflt="$randbits"
16868				;;
16869			esac
16870			rp="How many bits does your $randfunc() function produce?"
16871			. ./myread
16872			randbits="$ans"
16873			$rm -f try.c try
16874			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16875			seedfunc="s$randfunc"
16876			randseedtype=unsigned
16877			;;
16878		*)
16879			dflt="31"
16880			rp="How many bits does your $randfunc() function produce?"
16881			. ./myread
16882			randbits="$ans"
16883			seedfunc="s$randfunc"
16884			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16885			if set $seedfunc val -f; eval $csym; $val; then
16886				echo "(Using $seedfunc() to seed random generator)"
16887			else
16888				echo "(Warning: no $seedfunc() to seed random generator)"
16889				seedfunc=rand
16890			fi
16891			randseedtype=unsigned
16892			;;
16893		esac
16894		;;
16895	esac
16896done
16897
16898echo " "
16899echo "Determining whether or not we are on an EBCDIC system..." >&4
16900$cat >try.c <<'EOM'
16901int main()
16902{
16903  if ('M'==0xd4) return 0;
16904  return 1;
16905}
16906EOM
16907
16908val=$undef
16909set try
16910if eval $compile_ok; then
16911	if $run ./try; then
16912		echo "You seem to speak EBCDIC." >&4
16913		val="$define"
16914	else
16915		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16916	fi
16917else
16918	echo "I'm unable to compile the test program." >&4
16919	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16920fi
16921$rm -f try try.*
16922set ebcdic
16923eval $setvar
16924
16925echo " "
16926$cat >&4 <<EOM
16927Checking how to flush all pending stdio output...
16928EOM
16929# I only know how to find the first 32 possibly open files on SunOS.
16930# See also hints/sunos_4_1.sh and util.c  --AD
16931case "$osname" in
16932sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16933esac
16934$cat >>try.c <<EOCP
16935#include <stdio.h>
16936#$i_unistd I_UNISTD
16937#ifdef I_UNISTD
16938# include <unistd.h>
16939#endif
16940#$d_sysconf HAS_SYSCONF
16941#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16942#ifdef HAS_STDIO_STREAM_ARRAY
16943# define STDIO_STREAM_ARRAY $stdio_stream_array
16944#endif
16945int main() {
16946  FILE* p;
16947  unlink("try.out");
16948  p = fopen("try.out", "w");
16949#ifdef TRY_FPUTC
16950  fputc('x', p);
16951#else
16952# ifdef TRY_FPRINTF
16953  fprintf(p, "x");
16954# endif
16955#endif
16956#ifdef TRY_FFLUSH_NULL
16957  fflush(NULL);
16958#endif
16959#ifdef TRY_FFLUSH_ALL
16960  {
16961    long open_max = -1;
16962# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16963    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16964# else
16965#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16966    open_max = sysconf(_SC_OPEN_MAX);
16967#  else
16968#   ifdef FOPEN_MAX
16969    open_max = FOPEN_MAX;
16970#   else
16971#    ifdef OPEN_MAX
16972    open_max = OPEN_MAX;
16973#    else
16974#     ifdef _NFILE
16975    open_max = _NFILE;
16976#     endif
16977#    endif
16978#   endif
16979#  endif
16980# endif 
16981# ifdef HAS_STDIO_STREAM_ARRAY
16982    if (open_max > 0) {
16983      long i;
16984      for (i = 0; i < open_max; i++)
16985	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16986		STDIO_STREAM_ARRAY[i]._file < open_max &&
16987		STDIO_STREAM_ARRAY[i]._flag)
16988		fflush(&STDIO_STREAM_ARRAY[i]);
16989    }	
16990  }
16991# endif
16992#endif
16993  _exit(42);
16994}
16995EOCP
16996: first we have to find out how _not_ to flush
16997$to try.c
16998if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16999    output=''
17000    set try -DTRY_FPUTC
17001    if eval $compile; then
17002 	    $run ./try 2>/dev/null
17003	    code="$?"
17004	    $from try.out
17005	    if $test ! -s try.out -a "X$code" = X42; then
17006		output=-DTRY_FPUTC
17007	    fi
17008    fi
17009    case "$output" in
17010    '')
17011	    set try -DTRY_FPRINTF
17012	    if eval $compile; then
17013 		    $run ./try 2>/dev/null
17014		    code="$?"
17015		    $from try.out
17016		    if $test ! -s try.out -a "X$code" = X42; then
17017			output=-DTRY_FPRINTF
17018		    fi
17019	    fi
17020	;;
17021    esac
17022fi
17023: check for fflush NULL behaviour
17024case "$fflushNULL" in
17025'') 	set try -DTRY_FFLUSH_NULL $output
17026	if eval $compile; then
17027	    	$run ./try 2>/dev/null
17028		code="$?"
17029		$from try.out
17030		if $test -s try.out -a "X$code" = X42; then
17031			fflushNULL="`$cat try.out`"
17032		else
17033			if $test "X$code" != X42; then
17034				$cat >&4 <<EOM
17035(If this test failed, don't worry, we'll try another method shortly.)
17036EOM
17037			fi
17038		fi
17039	fi
17040	$rm -f core try.core core.try.*
17041	case "$fflushNULL" in
17042	x)	$cat >&4 <<EOM
17043Your fflush(NULL) works okay for output streams.
17044Let's see if it clobbers input pipes...
17045EOM
17046# As of mid-March 2000 all versions of Solaris appear to have a stdio
17047# bug that improperly flushes the input end of pipes.  So we avoid the
17048# autoflush on fork/system/exec support for now. :-(
17049$cat >tryp.c <<EOCP
17050#include <stdio.h>
17051int
17052main(int argc, char **argv)
17053{
17054    char buf[1024];
17055    int i;
17056    char *bp = buf;
17057    while (1) {
17058        while ((i = getc(stdin)) != -1
17059               && (*bp++ = i) != '\n'
17060               && bp < &buf[1024])
17061    	/* DO NOTHING */ ;
17062        *bp = '\0';
17063        fprintf(stdout, "%s", buf);
17064        fflush(NULL);
17065        if (i == -1)
17066	    return 0;
17067        bp = buf;
17068    }
17069}
17070EOCP
17071                fflushNULL="$define"
17072                set tryp
17073                if eval $compile; then
17074                    $rm -f tryp.out
17075                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17076                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
17077                       $cat >&4 <<EOM
17078fflush(NULL) seems to behave okay with input streams.
17079EOM
17080			fflushNULL="$define"
17081                    else
17082			$cat >&4 <<EOM
17083Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17084EOM
17085                        fflushNULL="$undef"
17086                    fi
17087                fi
17088	        $rm -f core tryp.c tryp.core core.tryp.*
17089		;;
17090	'')	$cat >&4 <<EOM
17091Your fflush(NULL) isn't working (contrary to ANSI C).
17092EOM
17093		fflushNULL="$undef"
17094		;;
17095	*)	$cat >&4 <<EOM
17096Cannot figure out whether your fflush(NULL) works or not.
17097I'm assuming it doesn't (contrary to ANSI C).
17098EOM
17099		fflushNULL="$undef"
17100		;;
17101	esac
17102	;;
17103$define|true|[yY]*)
17104	fflushNULL="$define"
17105	;;
17106*)
17107	fflushNULL="$undef"
17108	;;
17109esac
17110: check explicit looping only if NULL did not work, and if the pipe
17111: bug does not show up on an explicit flush too
17112case "$fflushNULL" in
17113"$undef")
17114	$cat >tryp.c <<EOCP
17115#include <stdio.h>
17116int
17117main(int argc, char **argv)
17118{
17119    char buf[1024];
17120    int i;
17121    char *bp = buf;
17122    while (1) {
17123	while ((i = getc(stdin)) != -1
17124	       && (*bp++ = i) != '\n'
17125	       && bp < &buf[1024])
17126	/* DO NOTHING */ ;
17127	*bp = '\0';
17128	fprintf(stdout, "%s", buf);
17129	fflush(stdin);
17130	if (i == -1)
17131	    return 0;
17132	bp = buf;
17133    }
17134}
17135EOCP
17136	set tryp
17137	if eval $compile; then
17138	    $rm -f tryp.out
17139	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17140	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
17141	       $cat >&4 <<EOM
17142Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17143EOM
17144		: now check for fflushall behaviour
17145		case "$fflushall" in
17146		'') 	set try -DTRY_FFLUSH_ALL $output
17147			if eval $compile; then
17148				$cat >&4 <<EOM
17149(Now testing the other method--but note that this also may fail.)
17150EOM
17151				$run ./try 2>/dev/null
17152				code=$?
17153				$from try.out
17154				if $test -s try.out -a "X$code" = X42; then
17155					fflushall="`$cat try.out`"
17156				fi
17157			fi
17158			$rm -f core try.core core.try.*
17159			case "$fflushall" in
17160			x)	$cat >&4 <<EOM
17161Whew. Flushing explicitly all the stdio streams works.
17162EOM
17163				fflushall="$define"
17164				;;
17165			'')	$cat >&4 <<EOM
17166Sigh. Flushing explicitly all the stdio streams doesn't work.
17167EOM
17168				fflushall="$undef"
17169				;;
17170			*)	$cat >&4 <<EOM
17171Cannot figure out whether flushing stdio streams explicitly works or not.
17172I'm assuming it doesn't.
17173EOM
17174				fflushall="$undef"
17175				;;
17176			esac
17177			;;
17178		"$define"|true|[yY]*)
17179			fflushall="$define"
17180			;;
17181		*)
17182			fflushall="$undef"
17183			;;
17184		esac
17185	    else
17186		$cat >&4 <<EOM
17187All is futile.  Even fflush(stdin) clobbers input pipes!
17188EOM
17189		fflushall="$undef"
17190	    fi
17191	else
17192	    fflushall="$undef"
17193	fi
17194	$rm -f core tryp.c tryp.core core.tryp.*
17195	;;
17196*)	fflushall="$undef"
17197	;;
17198esac
17199
17200case "$fflushNULL$fflushall" in
17201undefundef)
17202	$cat <<EOM
17203OK, I give up.  I cannot figure out how to flush pending stdio output.
17204We won't be flushing handles at all before fork/exec/popen.
17205EOM
17206	;;
17207esac
17208$rm -f try.* try$exe_ext
17209
17210: Store the full pathname to the ar program for use in the C program
17211: Respect a hint or command line value for full_ar.
17212case "$full_ar" in
17213'') full_ar=$ar ;;
17214esac
17215
17216: Store the full pathname to the sed program for use in the C program
17217full_sed=$sed
17218
17219: see what type gids are declared as in the kernel
17220echo " "
17221echo "Looking for the type for group ids returned by getgid()."
17222set gid_t gidtype xxx stdio.h sys/types.h
17223eval $typedef
17224case "$gidtype" in
17225xxx)
17226	xxx=`./findhdr sys/user.h`
17227	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17228	case $1 in
17229	unsigned) dflt="$1 $2" ;;
17230	*) dflt="$1" ;;
17231	esac
17232	;;
17233*) dflt="$gidtype";;
17234esac
17235case "$gidtype" in
17236gid_t) echo "gid_t found." ;;
17237*)	rp="What is the type for group ids returned by getgid()?"
17238	. ./myread
17239	gidtype="$ans"
17240	;;
17241esac
17242
17243echo " "
17244case "$gidtype" in
17245*_t) zzz="$gidtype"	;;
17246*)   zzz="gid"		;;
17247esac
17248echo "Checking the size of $zzz..." >&4
17249cat > try.c <<EOCP
17250#include <sys/types.h>
17251#include <stdio.h>
17252int main() {
17253    printf("%d\n", (int)sizeof($gidtype));
17254    exit(0);
17255}
17256EOCP
17257set try
17258if eval $compile_ok; then
17259	yyy=`$run ./try`
17260	case "$yyy" in
17261	'')	gidsize=4
17262		echo "(I can't execute the test program--guessing $gidsize.)" >&4
17263		;;
17264	*)	gidsize=$yyy
17265		echo "Your $zzz is $gidsize bytes long."
17266		;;
17267	esac
17268else
17269	gidsize=4
17270	echo "(I can't compile the test program--guessing $gidsize.)" >&4
17271fi
17272
17273
17274echo " "
17275case "$gidtype" in
17276*_t) zzz="$gidtype"	;;
17277*)   zzz="gid"		;;
17278esac
17279echo "Checking the sign of $zzz..." >&4
17280cat > try.c <<EOCP
17281#include <sys/types.h>
17282#include <stdio.h>
17283int main() {
17284	$gidtype foo = -1;
17285	if (foo < 0)
17286		printf("-1\n");
17287	else
17288		printf("1\n");
17289}
17290EOCP
17291set try
17292if eval $compile; then
17293	yyy=`$run ./try`
17294	case "$yyy" in
17295	'')	gidsign=1
17296		echo "(I can't execute the test program--guessing unsigned.)" >&4
17297		;;
17298	*)	gidsign=$yyy
17299		case "$gidsign" in
17300		 1) echo "Your $zzz is unsigned." ;;
17301		-1) echo "Your $zzz is signed."   ;;
17302		esac
17303		;;
17304	esac
17305else
17306	gidsign=1
17307	echo "(I can't compile the test program--guessing unsigned.)" >&4
17308fi
17309
17310
17311echo " "
17312
17313if $test X"$quadtype" != X; then
17314
17315echo "Checking how to print 64-bit integers..." >&4
17316
17317if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17318	$cat >try.c <<'EOCP'
17319#include <sys/types.h>
17320#include <stdio.h>
17321int main() {
17322  int q = 12345678901;
17323  printf("%ld\n", q);
17324}
17325EOCP
17326	set try
17327	if eval $compile; then
17328		yyy=`$run ./try`
17329		case "$yyy" in
17330		12345678901)
17331			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17332                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17333			echo "We will use %d."
17334			;;
17335		esac
17336	fi
17337fi
17338
17339if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17340	$cat >try.c <<'EOCP'
17341#include <sys/types.h>
17342#include <stdio.h>
17343int main() {
17344  long q = 12345678901;
17345  printf("%ld\n", q);
17346}
17347EOCP
17348	set try
17349	if eval $compile; then
17350		yyy=`$run ./try`
17351		case "$yyy" in
17352		12345678901)
17353			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17354                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17355			echo "We will use %ld."
17356			;;
17357		esac
17358	fi
17359fi
17360
17361if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17362	$cat >try.c <<'EOCP'
17363#include <sys/types.h>
17364#include <inttypes.h>
17365#include <stdio.h>
17366int main() {
17367  int64_t q = 12345678901;
17368  printf("%" PRId64 "\n", q);
17369}
17370EOCP
17371	set try
17372	if eval $compile; then
17373		yyy=`$run ./try`
17374		case "$yyy" in
17375		12345678901)
17376			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17377                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17378			echo "We will use the C9X style."
17379			;;
17380		esac
17381	fi
17382fi
17383
17384if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17385	$cat >try.c <<EOCP
17386#include <sys/types.h>
17387#include <stdio.h>
17388int main() {
17389  $quadtype q = 12345678901;
17390  printf("%Ld\n", q);
17391}
17392EOCP
17393	set try
17394	if eval $compile; then
17395		yyy=`$run ./try`
17396		case "$yyy" in
17397		12345678901)
17398			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17399                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17400			echo "We will use %Ld."
17401			;;
17402		esac
17403	fi
17404fi
17405
17406if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17407	$cat >try.c <<'EOCP'
17408#include <sys/types.h>
17409#include <stdio.h>
17410int main() {
17411  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17412  printf("%lld\n", q);
17413}
17414EOCP
17415	set try
17416	if eval $compile; then
17417		yyy=`$run ./try`
17418		case "$yyy" in
17419		12345678901)
17420			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17421                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17422			echo "We will use the %lld style."
17423			;;
17424		esac
17425	fi
17426fi
17427
17428if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17429	$cat >try.c <<EOCP
17430#include <sys/types.h>
17431#include <stdio.h>
17432int main() {
17433  $quadtype q = 12345678901;
17434  printf("%qd\n", q);
17435}
17436EOCP
17437	set try
17438	if eval $compile; then
17439		yyy=`$run ./try`
17440		case "$yyy" in
17441		12345678901)
17442			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17443                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17444			echo "We will use %qd."
17445			;;
17446		esac
17447	fi
17448fi
17449
17450if $test X"$sPRId64" = X; then
17451	echo "Cannot figure out how to print 64-bit integers." >&4
17452fi
17453
17454$rm -f try try.*
17455
17456fi
17457
17458case "$sPRId64" in
17459'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
17460	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
17461	;;
17462*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
17463	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
17464	;;
17465esac
17466
17467
17468echo " "
17469$echo "Checking the format strings to be used for Perl's internal types..." >&4
17470
17471if $test X"$ivsize" = X8; then
17472	ivdformat="$sPRId64"
17473	uvuformat="$sPRIu64"
17474	uvoformat="$sPRIo64"
17475	uvxformat="$sPRIx64"
17476	uvXUformat="$sPRIXU64"
17477else
17478	if $test X"$ivsize" = X"$longsize"; then
17479		ivdformat='"ld"'
17480		uvuformat='"lu"'
17481		uvoformat='"lo"'
17482		uvxformat='"lx"'
17483		uvXUformat='"lX"'
17484	else
17485		if $test X"$ivsize" = X"$intsize"; then
17486			ivdformat='"d"'
17487			uvuformat='"u"'
17488			uvoformat='"o"'
17489			uvxformat='"x"'
17490			uvXUformat='"X"'
17491		else
17492			: far out
17493			if $test X"$ivsize" = X"$shortsize"; then
17494				ivdformat='"hd"'
17495				uvuformat='"hu"'
17496				uvoformat='"ho"'
17497				uvxformat='"hx"'
17498				uvXUformat='"hX"'
17499			fi
17500		fi
17501	fi
17502fi
17503
17504if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17505	nveformat="$sPRIeldbl"
17506	nvfformat="$sPRIfldbl"
17507	nvgformat="$sPRIgldbl"
17508	nvEUformat="$sPRIEUldbl"
17509	nvFUformat="$sPRIFUldbl"
17510	nvGUformat="$sPRIGUldbl"
17511else
17512	nveformat='"e"'
17513	nvfformat='"f"'
17514	nvgformat='"g"'
17515	nvEUformat='"E"'
17516	nvFUformat='"F"'
17517	nvGUformat='"G"'
17518fi
17519
17520case "$ivdformat" in
17521'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17522    exit 1
17523    ;;
17524esac
17525
17526
17527echo " "
17528$echo "Checking the format string to be used for gids..." >&4
17529
17530case "$gidsign" in
17531-1)	if $test X"$gidsize" = X"$ivsize"; then
17532		gidformat="$ivdformat"
17533	else
17534		if $test X"$gidsize" = X"$longsize"; then
17535			gidformat='"ld"'
17536		else
17537			if $test X"$gidsize" = X"$intsize"; then
17538				gidformat='"d"'
17539			else
17540				if $test X"$gidsize" = X"$shortsize"; then
17541					gidformat='"hd"'
17542				fi
17543			fi
17544		fi
17545	fi
17546	;;
17547*)	if $test X"$gidsize" = X"$uvsize"; then
17548		gidformat="$uvuformat"
17549	else
17550		if $test X"$gidsize" = X"$longsize"; then
17551			gidformat='"lu"'
17552		else
17553			if $test X"$gidsize" = X"$intsize"; then
17554				gidformat='"u"'
17555			else
17556				if $test X"$gidsize" = X"$shortsize"; then
17557					gidformat='"hu"'
17558				fi
17559			fi
17560		fi
17561	fi
17562	;;
17563esac
17564
17565: see if getgroups exists
17566set getgroups d_getgrps
17567eval $inlibc
17568
17569: see if setgroups exists
17570set setgroups d_setgrps
17571eval $inlibc
17572
17573
17574: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17575echo " "
17576case "$d_getgrps$d_setgrps" in
17577*define*)
17578	case "$groupstype" in
17579	'') dflt="$gidtype" ;;
17580	*)  dflt="$groupstype" ;;
17581	esac
17582	$cat <<EOM
17583What type of pointer is the second argument to getgroups() and setgroups()?
17584Usually this is the same as group ids, $gidtype, but not always.
17585
17586EOM
17587	rp='What type pointer is the second argument to getgroups() and setgroups()?'
17588	. ./myread
17589	groupstype="$ans"
17590	;;
17591*)  groupstype="$gidtype";;
17592esac
17593
17594echo " "
17595echo "Checking if your $make program sets \$(MAKE)..." >&4
17596case "$make_set_make" in
17597'')
17598	$sed 's/^X //' > testmake.mak << 'EOF'
17599Xall:
17600X 	@echo 'maketemp="$(MAKE)"'
17601EOF
17602	case "`$make -f testmake.mak 2>/dev/null`" in
17603	*maketemp=*) make_set_make='#' ;;
17604	*)	make_set_make="MAKE=$make" ;;
17605	esac
17606	$rm -f testmake.mak
17607	;;
17608esac
17609case "$make_set_make" in
17610'#') echo "Yup, it does.";;
17611*) echo "Nope, it doesn't.";;
17612esac
17613
17614: see what type is used for mode_t
17615rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17616set mode_t modetype int stdio.h sys/types.h
17617eval $typedef_ask
17618
17619: see if stdarg is available
17620echo " "
17621if $test `./findhdr stdarg.h`; then
17622	echo "<stdarg.h> found." >&4
17623	valstd="$define"
17624else
17625	echo "<stdarg.h> NOT found." >&4
17626	valstd="$undef"
17627fi
17628
17629: see if varags is available
17630echo " "
17631if $test `./findhdr varargs.h`; then
17632	echo "<varargs.h> found." >&4
17633else
17634	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17635fi
17636
17637: set up the varargs testing programs
17638$cat > varargs.c <<EOP
17639#ifdef I_STDARG
17640#include <stdarg.h>
17641#endif
17642#ifdef I_VARARGS
17643#include <varargs.h>
17644#endif
17645
17646#ifdef I_STDARG
17647int f(char *p, ...)
17648#else
17649int f(va_alist)
17650va_dcl
17651#endif
17652{
17653	va_list ap;
17654#ifndef I_STDARG
17655	char *p;
17656#endif
17657#ifdef I_STDARG
17658	va_start(ap,p);
17659#else
17660	va_start(ap);
17661	p = va_arg(ap, char *);
17662#endif
17663	va_end(ap);
17664}
17665EOP
17666$cat > varargs <<EOP
17667$startsh
17668if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17669	echo "true"
17670else
17671	echo "false"
17672fi
17673$rm -f varargs$_o
17674EOP
17675chmod +x varargs
17676
17677: now check which varargs header should be included
17678echo " "
17679i_varhdr=''
17680case "$valstd" in
17681"$define")
17682	if `./varargs I_STDARG`; then
17683		val='stdarg.h'
17684	elif `./varargs I_VARARGS`; then
17685		val='varargs.h'
17686	fi
17687	;;
17688*)
17689	if `./varargs I_VARARGS`; then
17690		val='varargs.h'
17691	fi
17692	;;
17693esac
17694case "$val" in
17695'')
17696echo "I could not find the definition for va_dcl... You have problems..." >&4
17697	val="$undef"; set i_stdarg; eval $setvar
17698	val="$undef"; set i_varargs; eval $setvar
17699	;;
17700*)
17701	set i_varhdr
17702	eval $setvar
17703	case "$i_varhdr" in
17704	stdarg.h)
17705		val="$define"; set i_stdarg; eval $setvar
17706		val="$undef"; set i_varargs; eval $setvar
17707		;;
17708	varargs.h)
17709		val="$undef"; set i_stdarg; eval $setvar
17710		val="$define"; set i_varargs; eval $setvar
17711		;;
17712	esac
17713	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17714esac
17715$rm -f varargs*
17716
17717: see if we need va_copy
17718echo " "
17719case "$i_stdarg" in
17720"$define")
17721	$cat >try.c <<EOCP
17722#include <stdarg.h>
17723#include <stdio.h>
17724#$i_stdlib I_STDLIB
17725#ifdef I_STDLIB
17726#include <stdlib.h>
17727#endif
17728#include <signal.h>
17729
17730int
17731ivfprintf(FILE *f, const char *fmt, va_list *valp)
17732{
17733  return vfprintf(f, fmt, *valp);
17734}
17735 
17736int    
17737myvfprintf(FILE *f, const  char *fmt, va_list val)
17738{
17739  return ivfprintf(f, fmt, &val);
17740}
17741      
17742int
17743myprintf(char *fmt, ...) 
17744{
17745  va_list val;
17746  va_start(val, fmt);
17747  return myvfprintf(stdout, fmt, val); 
17748}         
17749
17750int
17751main(int ac, char **av)
17752{
17753  signal(SIGSEGV, exit);
17754
17755  myprintf("%s%cs all right, then\n", "that", '\'');                            
17756  exit(0);      
17757}
17758EOCP
17759	set try
17760	if eval $compile && $run ./try 2>&1 >/dev/null; then
17761		case "`$run ./try`" in
17762		"that's all right, then")
17763			okay=yes
17764			;;
17765		esac
17766	fi
17767	case "$okay" in
17768	yes)	echo "It seems that you don't need va_copy()." >&4
17769		need_va_copy="$undef"
17770		;;
17771	*)	echo "It seems that va_copy() or similar will be needed." >&4
17772		need_va_copy="$define"
17773		;;
17774	esac
17775	$rm -f try.* core core.* *.core *.core.*
17776	;;
17777*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17778	;;
17779esac
17780
17781: see what type is used for size_t
17782rp="What is the type used for the length parameter for string functions?"
17783set size_t sizetype 'unsigned int' stdio.h sys/types.h
17784eval $typedef_ask
17785
17786: check for type of arguments to gethostbyaddr.
17787if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17788	case "$d_gethbyaddr" in
17789	$define)
17790		$cat <<EOM
17791
17792Checking to see what type of arguments are accepted by gethostbyaddr().
17793EOM
17794		hdrs="$define sys/types.h
17795			$d_socket sys/socket.h
17796			$i_niin netinet/in.h
17797			$i_netdb netdb.h
17798			$i_unistd unistd.h"
17799		: The first arg can 'char *' or 'void *'
17800		: The second arg is some of integral type
17801		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17802			for yyy in size_t long int; do
17803				case "$netdb_host_type" in
17804				'')	try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17805					if ./protochk "$try" $hdrs; then
17806						echo "Your system accepts $xxx for the first arg."
17807						echo "...and $yyy for the second arg."
17808						netdb_host_type="$xxx"
17809						netdb_hlen_type="$yyy"
17810					fi
17811					;;
17812				esac
17813			done
17814		done
17815		: In case none of those worked, prompt the user.
17816		case "$netdb_host_type" in
17817		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
17818			dflt='char *'
17819			. ./myread
17820			netdb_host_type=$ans
17821			rp='What is the type for the 2nd argument to gethostbyaddr?'
17822			dflt="$sizetype"
17823			. ./myread
17824			netdb_hlen_type=$ans
17825			;;
17826		esac
17827		;;
17828	*)	: no gethostbyaddr, so pick harmless defaults
17829		netdb_host_type='char *'
17830		netdb_hlen_type="$sizetype"
17831		;;
17832	esac
17833	# Remove the "const" if needed. -- but then we'll have a
17834	# prototype clash!
17835	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17836fi
17837
17838: check for type of argument to gethostbyname.
17839if test "X$netdb_name_type" = X ; then
17840	case "$d_gethbyname" in
17841	$define)
17842		$cat <<EOM
17843
17844Checking to see what type of argument is accepted by gethostbyname().
17845EOM
17846		hdrs="$define sys/types.h
17847			$d_socket sys/socket.h
17848			$i_niin netinet/in.h
17849			$i_netdb netdb.h
17850			$i_unistd unistd.h"
17851		for xxx in "const char *" "char *"; do
17852			case "$netdb_name_type" in
17853			'')	try="extern struct hostent *gethostbyname($xxx);"
17854				if ./protochk "$try" $hdrs; then
17855					echo "Your system accepts $xxx."
17856					netdb_name_type="$xxx"
17857				fi
17858				;;
17859			esac
17860		done
17861		: In case none of those worked, prompt the user.
17862		case "$netdb_name_type" in
17863		'')	rp='What is the type for the 1st argument to gethostbyname?'
17864			dflt='char *'
17865			. ./myread
17866			netdb_name_type=$ans
17867			;;
17868		esac
17869		;;
17870	*)	: no gethostbyname, so pick harmless default
17871		netdb_name_type='char *'
17872		;;
17873	esac
17874fi
17875
17876: check for type of 1st argument to getnetbyaddr.
17877if test "X$netdb_net_type" = X ; then
17878	case "$d_getnbyaddr" in
17879	$define)
17880		$cat <<EOM
17881
17882Checking to see what type of 1st argument is accepted by getnetbyaddr().
17883EOM
17884		hdrs="$define sys/types.h
17885			$d_socket sys/socket.h
17886			$i_niin netinet/in.h
17887			$i_netdb netdb.h
17888			$i_unistd unistd.h"
17889		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17890			case "$netdb_net_type" in
17891			'')	try="extern struct netent *getnetbyaddr($xxx, int);"
17892				if ./protochk "$try" $hdrs; then
17893					echo "Your system accepts $xxx."
17894					netdb_net_type="$xxx"
17895				fi
17896				;;
17897			esac
17898		done
17899		: In case none of those worked, prompt the user.
17900		case "$netdb_net_type" in
17901		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
17902			dflt='long'
17903			. ./myread
17904			netdb_net_type=$ans
17905			;;
17906		esac
17907		;;
17908	*)	: no getnetbyaddr, so pick harmless default
17909		netdb_net_type='long'
17910		;;
17911	esac
17912fi
17913: locate the preferred pager for this system
17914fn=f/
17915case "$pager" in
17916'')
17917	dflt=''
17918	case "$pg" in
17919	/*) dflt=$pg;;
17920	[a-zA-Z]:/*) dflt=$pg;;
17921	esac
17922	case "$more" in
17923	/*) dflt=$more;;
17924	[a-zA-Z]:/*) dflt=$more;;
17925	esac
17926	case "$less" in
17927	/*) dflt=$less;;
17928	[a-zA-Z]:/*) dflt=$less;;
17929	esac
17930	case "$dflt" in
17931	'') dflt=/usr/ucb/more;;
17932	esac
17933	;;
17934*)	dflt="$pager"
17935	: Instruct ./getfile to trust the hinted or previous pager value,
17936	: even if it does not begin with a slash.  For example, on os2,
17937	: pager might be cmd /c more.  See comments in UU/getfile.
17938	fn="f/($pager)"
17939	;;
17940esac
17941echo " "
17942rp='What pager is used on your system?'
17943. ./getfile
17944pager="$ans"
17945
17946: see what type pids are declared as in the kernel
17947rp="What is the type of process ids on this system?"
17948set pid_t pidtype int stdio.h sys/types.h
17949eval $typedef_ask
17950
17951: Find earliest binary compatible site_perl subdirectory perl can use.
17952xs_apiversion=$version # The current site_perl version.
17953: Find earliest pure perl site_perl subdirectory perl can use.
17954: The versioned directories started at 5.005.
17955pm_apiversion='5.005'
17956
17957: see if ar generates random libraries by itself
17958echo " "
17959echo "Checking how to generate random libraries on your machine..." >&4
17960echo 'int bar1() { return bar2(); }' > bar1.c
17961echo 'int bar2() { return 2; }' > bar2.c
17962$cat > foo.c <<'EOP'
17963int main() { printf("%d\n", bar1()); exit(0); }
17964EOP
17965$cc $ccflags -c bar1.c >/dev/null 2>&1
17966$cc $ccflags -c bar2.c >/dev/null 2>&1
17967$cc $ccflags -c foo.c >/dev/null 2>&1
17968$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17969if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17970	$run ./foobar >/dev/null 2>&1; then
17971	echo "$ar appears to generate random libraries itself."
17972	orderlib=false
17973	ranlib=":"
17974elif $ar ts bar$_a >/dev/null 2>&1 &&
17975	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17976	$run ./foobar >/dev/null 2>&1; then
17977		echo "a table of contents needs to be added with '$ar ts'."
17978		orderlib=false
17979		ranlib="$ar ts"
17980else
17981	case "$ranlib" in
17982	:) ranlib='';;
17983	'')
17984		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17985		$test -f $ranlib || ranlib=''
17986		;;
17987	esac
17988	if $test -n "$ranlib"; then
17989		echo "your system has '$ranlib'; we'll use that."
17990		orderlib=false
17991	else
17992		echo "your system doesn't seem to support random libraries"
17993		echo "so we'll use lorder and tsort to order the libraries."
17994		orderlib=true
17995		ranlib=":"
17996	fi
17997fi
17998$rm -f foo* bar*
17999
18000: check for type of arguments to select.
18001case "$selecttype" in
18002'') case "$d_select" in
18003	$define)
18004		echo " "
18005		$cat <<EOM
18006Checking to see what type of arguments are accepted by select().
18007EOM
18008		hdrs="$define sys/types.h
18009			$i_systime sys/time.h
18010			$i_sysselct sys/select.h
18011			$d_socket sys/socket.h"
18012		: The first arg can be int, unsigned, or size_t
18013		: The last arg may or may not be 'const'
18014		val=''
18015		: void pointer has been seen but using that
18016		: breaks the selectminbits test
18017		for xxx in 'fd_set *' 'int *'; do
18018			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18019				for tmo in 'struct timeval *' 'const struct timeval *'; do
18020					case "$val" in
18021					'')	try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18022						if ./protochk "$try" $hdrs; then
18023							echo "Your system accepts $xxx."
18024							val="$xxx"
18025						fi
18026						;;
18027					esac
18028				done
18029			done
18030		done
18031		case "$val" in
18032		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18033			case "$d_fd_set" in
18034				$define) dflt="fd_set *" ;;
18035				*)		dflt="int *" ;;
18036			esac
18037			. ./myread
18038			val=$ans
18039			;;
18040		esac
18041		selecttype="$val"
18042		;;
18043	*)	: no select, so pick a harmless default
18044		selecttype='int *'
18045		;;
18046	esac
18047	;;
18048esac
18049
18050: check for the select 'width'
18051case "$selectminbits" in
18052'') case "$d_select" in
18053	$define)
18054		$cat <<EOM
18055
18056Checking to see on how many bits at a time your select() operates...
18057EOM
18058		$cat >try.c <<EOCP
18059#include <sys/types.h>
18060#$i_time I_TIME
18061#$i_systime I_SYS_TIME
18062#$i_systimek I_SYS_TIME_KERNEL
18063#ifdef I_TIME
18064#   include <time.h>
18065#endif
18066#ifdef I_SYS_TIME
18067#   ifdef I_SYS_TIME_KERNEL
18068#	define KERNEL
18069#   endif
18070#   include <sys/time.h>
18071#   ifdef I_SYS_TIME_KERNEL
18072#	undef KERNEL
18073#   endif
18074#endif
18075#$i_sysselct I_SYS_SELECT
18076#ifdef I_SYS_SELECT
18077#include <sys/select.h>
18078#endif
18079#$d_socket HAS_SOCKET
18080#ifdef HAS_SOCKET
18081#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18082#endif
18083#include <stdio.h>
18084$selecttype b;
18085#define S sizeof(*(b))
18086#define MINBITS	64
18087#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18088#define NBITS  (NBYTES * 8)
18089int main() {
18090    char s[NBYTES];
18091    struct timeval t;
18092    int i;
18093    FILE* fp;
18094    int fd;
18095
18096    fclose(stdin);
18097    fp = fopen("try.c", "r");
18098    if (fp == 0)
18099      exit(1);
18100    fd = fileno(fp);
18101    if (fd < 0)
18102      exit(2);
18103    b = ($selecttype)s;
18104    for (i = 0; i < NBITS; i++)
18105	FD_SET(i, b);
18106    t.tv_sec  = 0;
18107    t.tv_usec = 0;
18108    select(fd + 1, b, 0, 0, &t);
18109    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18110    printf("%d\n", i + 1);
18111    return 0;
18112}
18113EOCP
18114		set try
18115		if eval $compile_ok; then
18116			selectminbits=`$run ./try`
18117			case "$selectminbits" in
18118			'')	cat >&4 <<EOM
18119Cannot figure out on how many bits at a time your select() operates.
18120I'll play safe and guess it is 32 bits.
18121EOM
18122				selectminbits=32
18123				bits="32 bits"
18124				;;
18125			1)	bits="1 bit" ;;
18126			*)	bits="$selectminbits bits" ;;
18127			esac
18128			echo "Your select() operates on $bits at a time." >&4
18129		else
18130			rp='What is the minimum number of bits your select() operates on?'
18131			case "$byteorder" in
18132			1234|12345678)	dflt=32 ;;
18133			*)		dflt=1	;;
18134			esac
18135			. ./myread
18136			val=$ans
18137			selectminbits="$val"
18138		fi
18139		$rm -f try.* try
18140		;;
18141	*)	: no select, so pick a harmless default
18142		selectminbits='32'
18143		;;
18144	esac
18145	;;
18146esac
18147
18148: Trace out the files included by signal.h, then look for SIGxxx names.
18149: Remove SIGARRAYSIZE used by HPUX.
18150: Remove SIGSTKSIZE used by Linux.
18151: Remove SIGSTKSZ used by Posix.
18152: Remove SIGTYP void lines used by OS2.
18153: Some cpps, like os390, dont give the file name anywhere
18154if [ "X$fieldn" = X ]; then
18155	: Just make some guesses.  We check them later.
18156	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18157else
18158	xxx=`echo '#include <signal.h>' |
18159	$cppstdin $cppminus $cppflags 2>/dev/null |
18160	$grep '^[ 	]*#.*include' |
18161	$awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18162fi
18163: Check this list of files to be sure we have parsed the cpp output ok.
18164: This will also avoid potentially non-existent files, such
18165: as ../foo/bar.h
18166xxxfiles=''
18167for xx in $xxx /dev/null ; do
18168	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
18169done
18170: If we have found no files, at least try signal.h
18171case "$xxxfiles" in
18172'')	xxxfiles=`./findhdr signal.h` ;;
18173esac
18174xxx=`awk '
18175$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18176	print substr($2, 4, 20)
18177}
18178$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18179	print substr($3, 4, 20)
18180}' $xxxfiles`
18181: Append some common names just in case the awk scan failed.
18182xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18183xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18184xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18185xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18186xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18187
18188: generate a few handy files for later
18189$cat > signal.c <<'EOCP'
18190#include <sys/types.h>
18191#include <signal.h>
18192#include <stdio.h>
18193int main() {
18194
18195/* Strange style to avoid deeply-nested #if/#else/#endif */
18196#ifndef NSIG
18197#  ifdef _NSIG
18198#    define NSIG (_NSIG)
18199#  endif
18200#endif
18201
18202#ifndef NSIG
18203#  ifdef SIGMAX
18204#    define NSIG (SIGMAX+1)
18205#  endif
18206#endif
18207
18208#ifndef NSIG
18209#  ifdef SIG_MAX
18210#    define NSIG (SIG_MAX+1)
18211#  endif
18212#endif
18213
18214#ifndef NSIG
18215#  ifdef MAXSIG
18216#    define NSIG (MAXSIG+1)
18217#  endif
18218#endif
18219
18220#ifndef NSIG
18221#  ifdef MAX_SIG
18222#    define NSIG (MAX_SIG+1)
18223#  endif
18224#endif
18225
18226#ifndef NSIG
18227#  ifdef SIGARRAYSIZE
18228#    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18229#  endif
18230#endif
18231
18232#ifndef NSIG
18233#  ifdef _sys_nsig
18234#    define NSIG (_sys_nsig) /* Solaris 2.5 */
18235#  endif
18236#endif
18237
18238/* Default to some arbitrary number that's big enough to get most
18239   of the common signals.
18240*/
18241#ifndef NSIG
18242#    define NSIG 50
18243#endif
18244
18245printf("NSIG %d\n", NSIG);
18246
18247#ifndef JUST_NSIG
18248
18249EOCP
18250
18251echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18252{
18253	printf "#ifdef SIG"; printf $1; printf "\n"
18254	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18255	printf $1; printf ");\n"
18256	printf "#endif\n"
18257}
18258END {
18259	printf "#endif /* JUST_NSIG */\n";
18260	printf "exit(0);\n}\n";
18261}
18262' >>signal.c
18263$cat >signal.awk <<'EOP'
18264BEGIN { ndups = 0 }
18265$1 ~ /^NSIG$/ { nsig = $2 }
18266($1 !~ /^NSIG$/) && (NF == 2) {
18267    if ($2 > maxsig) { maxsig = $2 }
18268    if (sig_name[$2]) {
18269	dup_name[ndups] = $1
18270	dup_num[ndups] = $2
18271	ndups++
18272    }
18273    else {
18274	sig_name[$2] = $1
18275	sig_num[$2] = $2
18276    }
18277}
18278END {
18279    if (nsig == 0) {
18280    	nsig = maxsig + 1
18281    }
18282    printf("NSIG %d\n", nsig);
18283    for (n = 1; n < nsig; n++) {
18284 	if (sig_name[n]) {
18285 	    printf("%s %d\n", sig_name[n], sig_num[n])
18286	}
18287 	else {
18288 	    printf("NUM%d %d\n", n, n)
18289 	}
18290    }
18291    for (n = 0; n < ndups; n++) {
18292 	printf("%s %d\n", dup_name[n], dup_num[n])
18293    }
18294}
18295EOP
18296$cat >signal_cmd <<EOS
18297$startsh
18298if $test -s signal.lst; then
18299    echo "Using your existing signal.lst file"
18300	exit 0
18301fi
18302xxx="$xxx"
18303EOS
18304$cat >>signal_cmd <<'EOS'
18305
18306set signal
18307if eval $compile_ok; then
18308	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18309else
18310	echo "(I can't seem be able to compile the whole test program)" >&4
18311	echo "(I'll try it in little pieces.)" >&4
18312	set signal -DJUST_NSIG
18313	if eval $compile_ok; then
18314		$run ./signal$_exe > signal.nsg
18315		$cat signal.nsg
18316	else
18317		echo "I can't seem to figure out how many signals you have." >&4
18318		echo "Guessing 50." >&4
18319		echo 'NSIG 50' > signal.nsg
18320	fi
18321	: Now look at all the signal names, one at a time.
18322	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18323		$cat > signal.c <<EOCP
18324#include <sys/types.h>
18325#include <signal.h>
18326#include <stdio.h>
18327int main() {
18328printf("$xx %d\n", SIG${xx});
18329return 0;
18330}
18331EOCP
18332		set signal
18333		if eval $compile; then
18334			echo "SIG${xx} found."
18335			$run ./signal$_exe  >> signal.ls1
18336		else
18337			echo "SIG${xx} NOT found."
18338		fi
18339	done
18340	if $test -s signal.ls1; then
18341		$cat signal.nsg signal.ls1 |
18342			$sort -n | $uniq | $awk -f signal.awk >signal.lst
18343	fi
18344
18345fi
18346if $test -s signal.lst; then
18347	:
18348else
18349	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18350	echo 'kill -l' >signal
18351	set X `csh -f <signal`
18352	$rm -f signal
18353	shift
18354	case $# in
18355	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18356	esac
18357	echo $@ | $tr ' ' $trnl | \
18358 	    $awk '{ printf "%s %d\n", $1, ++s; }
18359 		  END { printf "NSIG %d\n", ++s }' >signal.lst
18360fi
18361$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18362EOS
18363chmod a+x signal_cmd
18364$eunicefix signal_cmd
18365
18366: generate list of signal names
18367echo " "
18368case "$sig_name_init" in
18369'') doinit=yes ;;
18370*)  case "$sig_num_init" in
18371    ''|*,*) doinit=yes ;;
18372    esac ;;
18373esac
18374case "$doinit" in
18375yes)
18376	echo "Generating a list of signal names and numbers..." >&4
18377	. ./signal_cmd
18378 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18379 	sig_name=`$awk 'BEGIN { printf "ZERO " }
18380 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
18381 	sig_num=`$awk  'BEGIN { printf "0 " }
18382 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
18383 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
18384 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
18385 			     END	{ printf "0\n" }' signal.lst`
18386 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
18387 			     !/^NSIG/	{ printf "%d, ", $2}
18388 			     END	{ printf "0\n"}' signal.lst`
18389	;;
18390esac
18391echo "The following $sig_count signals are available:"
18392echo " "
18393echo $sig_name | $awk \
18394'BEGIN { linelen = 0 }
18395{
18396	for (i = 1; i <= NF; i++) {
18397		name = "SIG" $i " "
18398		linelen = linelen + length(name)
18399		if (linelen > 70) {
18400			printf "\n"
18401			linelen = length(name)
18402		}
18403		printf "%s", name
18404	}
18405	printf "\n"
18406}'
18407sig_size=`echo $sig_name | awk '{print NF}'`
18408$rm -f signal signal.c signal.awk signal.lst signal_cmd
18409
18410echo " "
18411case "$sizetype" in
18412*_t) zzz="$sizetype"	;;
18413*)   zzz="filesize"	;;
18414esac
18415echo "Checking the size of $zzz..." >&4
18416cat > try.c <<EOCP
18417#include <sys/types.h>
18418#include <stdio.h>
18419int main() {
18420    printf("%d\n", (int)sizeof($sizetype));
18421    exit(0);
18422}
18423EOCP
18424set try
18425if eval $compile_ok; then
18426	yyy=`$run ./try`
18427	case "$yyy" in
18428	'')	sizesize=4
18429		echo "(I can't execute the test program--guessing $sizesize.)" >&4
18430		;;
18431	*)	sizesize=$yyy
18432		echo "Your $zzz size is $sizesize bytes."
18433		;;
18434	esac
18435else
18436	sizesize=4
18437	echo "(I can't compile the test program--guessing $sizesize.)" >&4
18438fi
18439
18440
18441: check for socklen_t
18442echo " "
18443echo "Checking to see if you have socklen_t..." >&4
18444$cat >try.c <<EOCP
18445#include <sys/types.h>
18446#$d_socket HAS_SOCKET
18447#ifdef HAS_SOCKET
18448#include <sys/socket.h>
18449#endif
18450int main() { socklen_t x = 16; }
18451EOCP
18452set try
18453if eval $compile; then
18454	val="$define"
18455	echo "You have socklen_t."
18456else
18457	val="$undef"
18458	echo "You do not have socklen_t."
18459	case "$sizetype" in
18460	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18461	esac
18462fi
18463$rm -f try try.*
18464set d_socklen_t
18465eval $setvar
18466
18467: see if this is a socks.h system
18468set socks.h i_socks
18469eval $inhdr
18470
18471: check for type of the size argument to socket calls
18472case "$d_socket" in
18473"$define")
18474	$cat <<EOM
18475
18476Checking to see what type is the last argument of accept().
18477EOM
18478	yyy=''
18479	case "$d_socklen_t" in
18480	"$define") yyy="$yyy socklen_t"
18481	esac
18482	yyy="$yyy $sizetype int long unsigned"
18483	for xxx in $yyy; do
18484		case "$socksizetype" in
18485		'')	try="extern int accept(int, struct sockaddr *, $xxx *);"
18486			case "$usesocks" in
18487			"$define")
18488				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18489					echo "Your system accepts '$xxx *' for the last argument of accept()."
18490					socksizetype="$xxx"
18491				fi
18492				;;
18493			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18494					echo "Your system accepts '$xxx *' for the last argument of accept()."
18495					socksizetype="$xxx"
18496				fi
18497				;;
18498			esac
18499			;;
18500		esac
18501	done
18502: In case none of those worked, prompt the user.
18503	case "$socksizetype" in
18504	'')	rp='What is the type for socket address structure sizes?'
18505		dflt='int'
18506		. ./myread
18507		socksizetype=$ans
18508		;;
18509	esac
18510	;;
18511*)	: no sockets, so pick relatively harmless default
18512	socksizetype='int'
18513	;;
18514esac
18515
18516: see what type is used for signed size_t
18517set ssize_t ssizetype int stdio.h sys/types.h
18518eval $typedef
18519dflt="$ssizetype"
18520$cat > try.c <<EOM
18521#include <stdio.h>
18522#include <sys/types.h>
18523#define Size_t $sizetype
18524#define SSize_t $dflt
18525int main()
18526{
18527	if (sizeof(Size_t) == sizeof(SSize_t))
18528		printf("$dflt\n");
18529	else if (sizeof(Size_t) == sizeof(int))
18530		printf("int\n");
18531	else 
18532		printf("long\n");
18533	exit(0);
18534}
18535EOM
18536echo " "
18537set try
18538if eval $compile_ok && $run ./try > /dev/null; then
18539	ssizetype=`$run ./try`
18540	echo "I'll be using $ssizetype for functions returning a byte count." >&4
18541else
18542	$cat >&4 <<EOM
18543Help! I can't compile and run the ssize_t test program: please enlighten me!
18544(This is probably a misconfiguration in your system or libraries, and
18545you really ought to fix it.  Still, I'll try anyway.)
18546
18547I need a type that is the same size as $sizetype, but is guaranteed to
18548be signed.  Common values are ssize_t, int and long.
18549
18550EOM
18551	rp="What signed type is the same size as $sizetype?"
18552	. ./myread
18553	ssizetype="$ans"
18554fi
18555$rm -f try try.*
18556
18557: see what type of char stdio uses.
18558echo " "
18559echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18560if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18561	echo "Your stdio uses unsigned chars." >&4
18562	stdchar="unsigned char"
18563else
18564	echo "Your stdio uses signed chars." >&4
18565	stdchar="char"
18566fi
18567$rm -f stdioh
18568
18569
18570
18571: see what type uids are declared as in the kernel
18572echo " "
18573echo "Looking for the type for user ids returned by getuid()."
18574set uid_t uidtype xxx stdio.h sys/types.h
18575eval $typedef
18576case "$uidtype" in
18577xxx)
18578	xxx=`./findhdr sys/user.h`
18579	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18580	case $1 in
18581	unsigned) dflt="$1 $2" ;;
18582	*) dflt="$1" ;;
18583	esac
18584	;;
18585*) dflt="$uidtype";;
18586esac
18587case "$uidtype" in
18588uid_t)	echo "uid_t found." ;;
18589*)	rp="What is the type for user ids returned by getuid()?"
18590	. ./myread
18591	uidtype="$ans"
18592	;;
18593esac
18594
18595echo " "
18596case "$uidtype" in
18597*_t) zzz="$uidtype"	;;
18598*)   zzz="uid"		;;
18599esac
18600echo "Checking the size of $zzz..." >&4
18601cat > try.c <<EOCP
18602#include <sys/types.h>
18603#include <stdio.h>
18604int main() {
18605    printf("%d\n", (int)sizeof($uidtype));
18606    exit(0);
18607}
18608EOCP
18609set try
18610if eval $compile_ok; then
18611	yyy=`$run ./try`
18612	case "$yyy" in
18613	'')	uidsize=4
18614		echo "(I can't execute the test program--guessing $uidsize.)" >&4
18615		;;
18616	*)	uidsize=$yyy
18617		echo "Your $zzz is $uidsize bytes long."
18618		;;
18619	esac
18620else
18621	uidsize=4
18622	echo "(I can't compile the test program--guessing $uidsize.)" >&4
18623fi
18624
18625echo " "
18626case "$uidtype" in
18627*_t) zzz="$uidtype"	;;
18628*)   zzz="uid"		;;
18629esac
18630echo "Checking the sign of $zzz..." >&4
18631cat > try.c <<EOCP
18632#include <sys/types.h>
18633#include <stdio.h>
18634int main() {
18635	$uidtype foo = -1;
18636	if (foo < 0)
18637		printf("-1\n");
18638	else
18639		printf("1\n");
18640}
18641EOCP
18642set try
18643if eval $compile; then
18644	yyy=`$run ./try`
18645	case "$yyy" in
18646	'')	uidsign=1
18647		echo "(I can't execute the test program--guessing unsigned.)" >&4
18648		;;
18649	*)	uidsign=$yyy
18650		case "$uidsign" in
18651		 1) echo "Your $zzz is unsigned." ;;
18652		-1) echo "Your $zzz is signed."   ;;
18653		esac
18654		;;
18655	esac
18656else
18657	uidsign=1
18658	echo "(I can't compile the test program--guessing unsigned.)" >&4
18659fi
18660
18661
18662
18663echo " "
18664$echo "Checking the format string to be used for uids..." >&4
18665
18666case "$uidsign" in
18667-1)	if $test X"$uidsize" = X"$ivsize"; then
18668		uidformat="$ivdformat"
18669	else
18670		if $test X"$uidsize" = X"$longsize"; then
18671			uidformat='"ld"'
18672		else
18673			if $test X"$uidsize" = X"$intsize"; then
18674				uidformat='"d"'
18675			else
18676				if $test X"$uidsize" = X"$shortsize"; then
18677					uidformat='"hd"'
18678				fi
18679			fi
18680		fi
18681	fi
18682	;;
18683*)	if $test X"$uidsize" = X"$uvsize"; then
18684		uidformat="$uvuformat"
18685	else
18686		if $test X"$uidsize" = X"$longsize"; then
18687			uidformat='"lu"'
18688		else
18689			if $test X"$uidsize" = X"$intsize"; then
18690				uidformat='"u"'
18691			else
18692				if $test X"$uidsize" = X"$shortsize"; then
18693					uidformat='"hu"'
18694				fi
18695			fi
18696		fi
18697	fi
18698	;;
18699esac
18700
18701: determine compiler compiler
18702case "$yacc" in
18703'')
18704	dflt=yacc;;
18705*)
18706	dflt="$yacc";;
18707esac
18708echo " "
18709comp='yacc'
18710if $test -f "$byacc$_exe"; then
18711	dflt="$byacc"
18712	comp="byacc or $comp"
18713fi
18714if $test -f "$bison$_exe"; then
18715	comp="$comp or bison -y"
18716fi
18717rp="Which compiler compiler ($comp) shall I use?"
18718. ./myread
18719yacc="$ans"
18720case "$yacc" in
18721*bis*)
18722	case "$yacc" in
18723	*-y*) ;;
18724	*)
18725		yacc="$yacc -y"
18726		echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18727		;;
18728	esac
18729	;;
18730esac
18731
18732: see if this is a fp.h system
18733set fp.h i_fp
18734eval $inhdr
18735
18736: see if this is a fp_class.h system
18737set fp_class.h i_fp_class
18738eval $inhdr
18739
18740: see if this is a ieeefp.h system
18741case "$i_ieeefp" in
18742'' ) set ieeefp.h i_ieeefp
18743     eval $inhdr
18744     ;;
18745esac
18746
18747: see if this is a libutil.h system
18748set libutil.h i_libutil
18749eval $inhdr
18750
18751: see if mach cthreads are available
18752if test "X$usethreads" = "X$define"; then
18753	set mach/cthreads.h i_machcthr
18754	eval $inhdr
18755else
18756	i_machcthr="$undef"
18757fi
18758
18759
18760
18761: see if this is a math.h system
18762set math.h i_math
18763eval $inhdr
18764
18765: see if this is a mntent.h system
18766set mntent.h i_mntent
18767eval $inhdr
18768
18769: see if ndbm.h is available
18770set ndbm.h t_ndbm
18771eval $inhdr
18772
18773case "$t_ndbm" in
18774$undef)
18775    # Some Linux distributions such as RedHat 7.1 put the
18776    # ndbm.h header in /usr/include/gdbm/ndbm.h.
18777    if $test -f /usr/include/gdbm/ndbm.h; then
18778	echo '<gdbm/ndbm.h> found.'
18779        ccflags="$ccflags -I/usr/include/gdbm"
18780        cppflags="$cppflags -I/usr/include/gdbm"
18781        t_ndbm=$define
18782    fi
18783    ;;
18784esac
18785
18786case "$t_ndbm" in
18787$define)
18788	: see if dbm_open exists
18789	set dbm_open d_dbm_open
18790	eval $inlibc
18791	case "$d_dbm_open" in
18792	$undef)
18793		t_ndbm="$undef"
18794		echo "We won't be including <ndbm.h>"
18795		;;
18796	esac
18797	;;
18798esac
18799val="$t_ndbm"
18800set i_ndbm
18801eval $setvar
18802
18803: see if net/errno.h is available
18804val=''
18805set net/errno.h val
18806eval $inhdr
18807
18808: Unfortunately, it causes problems on some systems.  Arrgh.
18809case "$val" in
18810$define)
18811	cat > try.c <<'EOM'
18812#include <stdio.h>
18813#include <errno.h>
18814#include <net/errno.h>
18815int func()
18816{
18817	return ENOTSOCK;
18818}
18819EOM
18820	if $cc $ccflags -c try.c >/dev/null 2>&1; then
18821		echo "We'll be including <net/errno.h>." >&4
18822	else
18823		echo "We won't be including <net/errno.h>." >&4
18824		val="$undef"
18825	fi
18826	$rm -f try.* try
18827	;;
18828esac
18829set i_neterrno
18830eval $setvar
18831
18832: see if netinet/tcp.h is available
18833set netinet/tcp.h i_netinettcp
18834eval $inhdr
18835
18836: see if this is a poll.h system
18837set poll.h i_poll
18838eval $inhdr
18839
18840: see if this is a prot.h system
18841set prot.h i_prot
18842eval $inhdr
18843
18844echo " "
18845$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
18846$cat <<'EOSH' > Cppsym.know
18847a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18848AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18849alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18850ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18851BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18852BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18853bull c cadmus clipper CMU COFF COMPILER_VERSION
18854concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18855CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18856Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18857FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18858GLIBC GLIBC_MINOR
18859GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18860H3050R H3050RX hbullx20 hcx host_mips
18861hp200 hp300 hp700 HP700 hp800 hp9000
18862hp9000s200 hp9000s300 hp9000s400 hp9000s500
18863hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18864i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18865IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18866INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18867LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18868LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18869Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18870LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18871M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18872M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18873M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18874MATH_HAS_NO_SIDE_EFFECTS
18875mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18876mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18877mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18878MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18879mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18880NetBSD news1500 news1700 news1800 news1900 news3700
18881news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18882ns32016 ns32332 ns32k nsc32000
18883OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18884pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18885pc532 pdp11 PGC PIC plexus PORTAR posix
18886POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18887POSIX_C_SOURCE POSIX_SOURCE POWER
18888PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18889riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18890SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18891sony sony_news sonyrisc sparc sparclite spectrum
18892stardent stdc STDC_EXT stratos sun sun3 sun386
18893Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18894SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18895SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18896sysV68 sysV88 Tek4132 Tek4300 titan
18897TM3200 TM5400 TM5600
18898tower tower32 tower32_200 tower32_600 tower32_700
18899tower32_800 tower32_850 tss
18900u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18901ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18902unix UNIX95 UNIX99 unixpc unos
18903USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18904USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18905USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18906USGr4 USGr4_2
18907Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18908XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18909XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18910z8000
18911EOSH
18912# Maybe put other stuff here too.
18913cat <<EOSH >>Cppsym.know
18914$osname
18915EOSH
18916./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18917./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18918$cat Cppsym.know > Cppsym.c
18919$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18920$rm -f Cppsym.a Cppsym.b Cppsym.c
18921cat <<EOSH > Cppsym
18922$startsh
18923if $test \$# -gt 0; then
18924    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18925    if $test -s Cppsym.got; then
18926        $rm -f Cppsym.got
18927        exit 0
18928    fi
18929    $rm -f Cppsym.got
18930    exit 1
18931else
18932    $tr " " "$trnl" | ./Cppsym.try
18933    exit 0
18934fi
18935EOSH
18936chmod +x Cppsym
18937$eunicefix Cppsym
18938cat <<EOSH > Cppsym.try
18939$startsh
18940cat <<'EOCP' > try.c
18941#include <stdio.h>
18942int main() {
18943EOCP
18944$awk \\
18945EOSH
18946cat <<'EOSH' >> Cppsym.try
18947'length($1) > 0 {
18948    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18949    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18950    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18951    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18952}'	 >> try.c
18953echo 'return 0;}' >> try.c
18954EOSH
18955cat <<EOSH >> Cppsym.try
18956ccflags="$ccflags"
18957case "$osname-$gccversion" in
18958irix-) ccflags="\$ccflags -woff 1178" ;;
18959os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18960esac
18961$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18962EOSH
18963chmod +x Cppsym.try
18964$eunicefix Cppsym.try
18965./Cppsym < Cppsym.know > Cppsym.true
18966: now check the C compiler for additional symbols
18967postprocess_cc_v=''
18968case "$osname" in
18969aix) postprocess_cc_v="|$tr , ' '" ;;
18970esac
18971$cat >ccsym <<EOS
18972$startsh
18973$cat >tmp.c <<EOF
18974extern int foo;
18975EOF
18976for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18977do
18978	case "\$i" in
18979	-D*) echo "\$i" | $sed 's/^-D//';;
18980	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18981	esac
18982done
18983$rm -f try.c
18984EOS
18985postprocess_cc_v=''
18986chmod +x ccsym
18987$eunicefix ccsym
18988./ccsym > ccsym1.raw
18989if $test -s ccsym1.raw; then
18990       $sort ccsym1.raw | $uniq >ccsym.raw
18991else
18992       mv ccsym1.raw ccsym.raw
18993fi
18994
18995$awk '/\=/ { print $0; next }
18996	{ print $0"=1" }' ccsym.raw >ccsym.list
18997$awk '/\=/ { print $0; next }
18998	{ print $0"=1" }' Cppsym.true >ccsym.true
18999$comm -13 ccsym.true ccsym.list >ccsym.own
19000$comm -12 ccsym.true ccsym.list >ccsym.com
19001$comm -23 ccsym.true ccsym.list >ccsym.cpp
19002also=''
19003if $test -z ccsym.raw; then
19004	echo "Your C compiler doesn't seem to define any symbols!" >&4
19005	echo " "
19006	echo "However, your C preprocessor defines the following symbols:"
19007	$cat Cppsym.true
19008    	ccsymbols=''
19009	cppsymbols=`$cat Cppsym.true`
19010        cppsymbols=`echo $cppsymbols`
19011	cppccsymbols="$cppsymbols"
19012else
19013	if $test -s ccsym.com; then
19014		echo "Your C compiler and pre-processor define these symbols:"
19015		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
19016		also='also '
19017		symbols='ones'
19018		cppccsymbols=`$cat ccsym.com`
19019		cppccsymbols=`echo $cppccsymbols`
19020		$test "$silent" || sleep 1
19021	fi
19022	if $test -s ccsym.cpp; then
19023		$test "$also" && echo " "
19024		echo "Your C pre-processor ${also}defines the following symbols:"
19025		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19026		also='further '
19027		cppsymbols=`$cat ccsym.cpp`
19028		cppsymbols=`echo $cppsymbols`
19029		$test "$silent" || sleep 1
19030	fi
19031	if $test -s ccsym.own; then
19032		$test "$also" && echo " "
19033		echo "Your C compiler ${also}defines the following cpp symbols:"
19034		$sed -e 's/\(..*\)=1/\1/' ccsym.own
19035		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19036	        ccsymbols=`$cat ccsym.own`
19037	        ccsymbols=`echo $ccsymbols`
19038		$test "$silent" || sleep 1
19039	fi
19040fi
19041
19042: see if this is a termio system
19043val="$undef"
19044val2="$undef"
19045val3="$undef"
19046if $test `./findhdr termios.h`; then
19047	set tcsetattr i_termios
19048	eval $inlibc
19049	val3="$i_termios"
19050fi
19051echo " "
19052case "$val3" in
19053"$define") echo "You have POSIX termios.h... good!" >&4;;
19054*) if ./Cppsym pyr; then
19055		case "`/bin/universe`" in
19056		ucb) if $test `./findhdr sgtty.h`; then
19057				val2="$define"
19058				echo "<sgtty.h> found." >&4
19059			else
19060				echo "System is pyramid with BSD universe."
19061				echo "<sgtty.h> not found--you could have problems." >&4
19062			fi;;
19063		*) if $test `./findhdr termio.h`; then
19064				val="$define"
19065				echo "<termio.h> found." >&4
19066			else
19067				echo "System is pyramid with USG universe."
19068				echo "<termio.h> not found--you could have problems." >&4
19069			fi;;
19070		esac
19071	elif ./usg; then
19072		if $test `./findhdr termio.h`; then
19073			echo "<termio.h> found." >&4
19074			val="$define"
19075		elif $test `./findhdr sgtty.h`; then
19076			echo "<sgtty.h> found." >&4
19077			val2="$define"
19078		else
19079echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19080		fi
19081	else
19082		if $test `./findhdr sgtty.h`; then
19083			echo "<sgtty.h> found." >&4
19084			val2="$define"
19085		elif $test `./findhdr termio.h`; then
19086			echo "<termio.h> found." >&4
19087			val="$define"
19088		else
19089echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19090		fi
19091	fi;;
19092esac
19093set i_termio; eval $setvar
19094val=$val2; set i_sgtty; eval $setvar
19095val=$val3; set i_termios; eval $setvar
19096
19097: see if stddef is available
19098set stddef.h i_stddef
19099eval $inhdr
19100
19101: see if this is a sunmath.h system
19102set sunmath.h i_sunmath
19103eval $inhdr
19104
19105: see if sys/access.h is available
19106set sys/access.h i_sysaccess
19107eval $inhdr
19108
19109: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19110set sys/filio.h i_sysfilio
19111eval $inhdr
19112echo " "
19113if $test `./findhdr sys/ioctl.h`; then
19114	val="$define"
19115	echo '<sys/ioctl.h> found.' >&4
19116else
19117	val="$undef"
19118	if $test $i_sysfilio = "$define"; then
19119	    echo '<sys/ioctl.h> NOT found.' >&4
19120	else
19121		$test $i_sgtty = "$define" && xxx="sgtty.h"
19122		$test $i_termio = "$define" && xxx="termio.h"
19123		$test $i_termios = "$define" && xxx="termios.h"
19124echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19125	fi
19126fi
19127set i_sysioctl
19128eval $setvar
19129
19130: see if socket ioctl defs are in sys/sockio.h
19131echo " "
19132xxx=`./findhdr sys/sockio.h`
19133if $test "$xxx"; then
19134	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19135		val="$define"
19136		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19137	else
19138		val="$undef"
19139		echo "No socket ioctls found in <sys/sockio.h>." >&4
19140	fi
19141else
19142	val="$undef"
19143	$cat <<EOM
19144<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19145EOM
19146fi
19147set i_syssockio
19148eval $setvar
19149
19150
19151: see if this is a syslog.h system
19152set syslog.h i_syslog
19153eval $inhdr
19154
19155
19156: see if this is a sys/mode.h system
19157set sys/mode.h i_sysmode
19158eval $inhdr
19159
19160: see if sys/resource.h has to be included
19161set sys/resource.h i_sysresrc
19162eval $inhdr
19163
19164: see if sys/security.h is available
19165set sys/security.h i_syssecrt
19166eval $inhdr
19167
19168: see if this is a sys/statvfs.h system
19169set sys/statvfs.h i_sysstatvfs
19170eval $inhdr
19171
19172: see if this is a sys/un.h system
19173set sys/un.h i_sysun
19174eval $inhdr
19175
19176
19177: see if this is a sys/utsname.h system
19178set sys/utsname.h i_sysutsname
19179eval $inhdr
19180
19181: see if this is a syswait system
19182set sys/wait.h i_syswait
19183eval $inhdr
19184
19185: see if this is a ustat.h system
19186set ustat.h i_ustat
19187eval $inhdr
19188
19189: see if this is an utime system
19190set utime.h i_utime
19191eval $inhdr
19192
19193: see if this is a values.h system
19194set values.h i_values
19195eval $inhdr
19196
19197: see if this is a vfork system
19198case "$d_vfork" in
19199"$define")
19200	set vfork.h i_vfork
19201	eval $inhdr
19202	;;
19203*)
19204	i_vfork="$undef"
19205	;;
19206esac
19207
19208: see if gdbm.h is available
19209set gdbm.h t_gdbm
19210eval $inhdr
19211case "$t_gdbm" in
19212$define)
19213	: see if gdbm_open exists
19214	set gdbm_open d_gdbm_open
19215	eval $inlibc
19216	case "$d_gdbm_open" in
19217	$undef)
19218		t_gdbm="$undef"
19219		echo "We won't be including <gdbm.h>"
19220		;;
19221	esac
19222	;;
19223esac
19224val="$t_gdbm"
19225set i_gdbm
19226eval $setvar
19227
19228echo " "
19229echo "Looking for extensions..." >&4
19230: If we are using the old config.sh, known_extensions may contain
19231: old or inaccurate or duplicate values.
19232known_extensions=''
19233nonxs_extensions=''
19234: We do not use find because it might not be available.
19235: We do not just use MANIFEST because the user may have dropped
19236: some additional extensions into the source tree and expect them
19237: to be built.
19238
19239: Function to recursively find available extensions, ignoring DynaLoader
19240: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19241find_extensions='
19242    for xxx in *; do
19243       case "$xxx" in
19244           DynaLoader|dynaload) ;;
19245           *)
19246           if $test -f $xxx/$xxx.xs; then
19247               known_extensions="$known_extensions $1$xxx";
19248           elif $test -f $xxx/Makefile.PL; then
19249               nonxs_extensions="$nonxs_extensions $1$xxx";
19250           else
19251               if $test -d $xxx -a $# -lt 10; then
19252                   set $1$xxx/ $*;
19253                   cd "$xxx";
19254                   eval $find_extensions;
19255                   cd ..;
19256                   shift;
19257               fi;
19258           fi
19259           ;;
19260       esac;
19261    done'
19262tdir=`pwd`
19263cd "$rsrc/ext"
19264set X
19265shift
19266eval $find_extensions
19267# Special case:  Add in threads/shared since it is not picked up by the
19268# recursive find above (and adding in general recursive finding breaks
19269# SDBM_File/sdbm).  A.D.  10/25/2001.
19270known_extensions="$known_extensions threads/shared"
19271set X $nonxs_extensions
19272shift
19273nonxs_extensions="$*"
19274set X $known_extensions
19275shift
19276known_extensions="$*"
19277cd "$tdir"
19278
19279: Now see which are supported on this system.
19280avail_ext=''
19281for xxx in $known_extensions ; do
19282	case "$xxx" in
19283	DB_File|db_file)
19284		case "$i_db" in
19285		$define) avail_ext="$avail_ext $xxx" ;;
19286		esac
19287		;;
19288	GDBM_File|gdbm_fil)
19289		case "$i_gdbm" in
19290		$define) avail_ext="$avail_ext $xxx" ;;
19291		esac
19292		;;
19293	I18N/Langinfo|i18n_lan)
19294		case "$i_langinfo$d_nl_langinfo" in
19295		$define$define) avail_ext="$avail_ext $xxx" ;;
19296		esac
19297		;;
19298	NDBM_File|ndbm_fil)
19299		case "$i_ndbm" in
19300		$define)
19301		    case "$osname-$use64bitint" in
19302		    hpux-define)
19303			case "$libs" in
19304			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
19305			esac
19306			;;
19307		    *) avail_ext="$avail_ext $xxx" ;;
19308		    esac
19309		    ;;
19310		esac
19311		;;
19312	ODBM_File|odbm_fil)
19313		case "${i_dbm}${i_rpcsvcdbm}" in
19314		*"${define}"*)
19315		    case "$osname-$use64bitint" in
19316		    hpux-define)
19317			case "$libs" in
19318			*-ldbm*) avail_ext="$avail_ext $xxx" ;;
19319			esac
19320			;;
19321		    *) avail_ext="$avail_ext $xxx" ;;
19322		    esac
19323		    ;;
19324		esac
19325		;;
19326	POSIX|posix)
19327		case "$useposix" in
19328		true|define|y) avail_ext="$avail_ext $xxx" ;;
19329		esac
19330		;;
19331	Opcode|opcode)
19332		case "$useopcode" in
19333		true|define|y) avail_ext="$avail_ext $xxx" ;;
19334		esac
19335		;;
19336	Socket|socket)
19337		case "$d_socket" in
19338		true|$define|y)
19339		    case "$osname" in
19340		    beos) ;; # not unless BONE
19341		    *) avail_ext="$avail_ext $xxx" ;;
19342		    esac
19343		    ;;
19344		esac
19345		;;
19346	Sys/Syslog|sys/syslog)
19347		: XXX syslog requires socket
19348		case "$d_socket" in
19349		true|$define|y) avail_ext="$avail_ext $xxx" ;;
19350		esac
19351		;;
19352	Thread|thread)
19353                case "$usethreads" in
19354                true|$define|y)
19355                        case "$useithreads" in
19356                        $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19357                        esac
19358		esac
19359		;;
19360	XS/APItest|xs/apitest)
19361		# This is just for testing.  Skip it unless we have dynamic loading.
19362
19363		case "$usedl" in
19364		$define) avail_ext="$avail_ext $xxx" ;;
19365		esac
19366		;;
19367	XS/Typemap|xs/typemap)
19368		# This is just for testing.  Skip it unless we have dynamic loading.
19369		case "$usedl" in
19370		$define) avail_ext="$avail_ext $xxx" ;;
19371		esac
19372		;;
19373	threads|threads/shared)
19374		# threads and threads::shared are special cases.
19375		# To stop people from asking "Perl 5.8.0 was supposed
19376		# to have this new fancy threads implementation but my
19377		# perl doesn't have it" and from people trying to
19378		# (re)install the threads module using CPAN.pm and
19379		# CPAN.pm then offering to reinstall Perl 5.8.0,
19380		# the threads.pm and threads/shared.pm will always be
19381		# there, croaking informatively ("you need to rebuild
19382		# all of Perl with threads, sorry") when threads haven't
19383		# been compiled in.
19384		# --jhi
19385		avail_ext="$avail_ext $xxx"
19386		;;
19387	IPC/SysV|ipc/sysv)
19388		: XXX Do we need a useipcsysv variable here
19389		case "${d_msg}${d_sem}${d_shm}" in
19390		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
19391		esac
19392		;;
19393	*)	avail_ext="$avail_ext $xxx"
19394		;;
19395	esac
19396done
19397
19398set X $avail_ext
19399shift
19400avail_ext="$*"
19401
19402: Now see which nonxs extensions are supported on this system.
19403: For now assume all are.
19404nonxs_ext=''
19405for xxx in $nonxs_extensions ; do
19406	case "$xxx" in
19407	*)	nonxs_ext="$nonxs_ext $xxx"
19408		;;
19409	esac
19410done
19411
19412set X $nonxs_ext
19413shift
19414nonxs_ext="$*"
19415
19416case $usedl in
19417$define)
19418	$cat <<EOM
19419A number of extensions are supplied with $package.  You may choose to
19420compile these extensions for dynamic loading (the default), compile
19421them into the $package executable (static loading), or not include
19422them at all.  Answer "none" to include no extensions.
19423Note that DynaLoader is always built and need not be mentioned here.
19424
19425EOM
19426	case "$dynamic_ext" in
19427	'') dflt="$avail_ext" ;;
19428	*)	dflt="$dynamic_ext"
19429		# Perhaps we are reusing an old out-of-date config.sh.
19430		case "$hint" in
19431		previous)
19432			if test X"$dynamic_ext" != X"$avail_ext"; then
19433				$cat <<EOM
19434NOTICE:  Your previous config.sh list may be incorrect. 
19435The extensions now available to you are 
19436	${avail_ext}
19437but the default list from your previous config.sh is
19438	${dynamic_ext} 
19439
19440EOM
19441			fi
19442			;;
19443		esac
19444		;;
19445	esac
19446	case "$dflt" in
19447	'')	dflt=none;;
19448	esac
19449	rp="What extensions do you wish to load dynamically?"
19450	. ./myread
19451	case "$ans" in
19452	none) dynamic_ext=' ' ;;
19453	*) dynamic_ext="$ans" ;;
19454	esac
19455
19456	case "$static_ext" in
19457	'')
19458		: Exclude those already listed in dynamic linking
19459		dflt=''
19460		for xxx in $avail_ext; do
19461			case " $dynamic_ext " in
19462			*" $xxx "*) ;;
19463			*) dflt="$dflt $xxx" ;;
19464			esac
19465		done
19466		set X $dflt
19467		shift
19468		dflt="$*"
19469		;;
19470	*)  dflt="$static_ext"
19471		;;
19472	esac
19473
19474	case "$dflt" in
19475	'')	dflt=none;;
19476	esac
19477	rp="What extensions do you wish to load statically?"
19478	. ./myread
19479	case "$ans" in
19480	none) static_ext=' ' ;;
19481	*) static_ext="$ans" ;;
19482	esac
19483	;;
19484*)
19485	$cat <<EOM
19486A number of extensions are supplied with $package.  Answer "none" 
19487to include no extensions. 
19488Note that DynaLoader is always built and need not be mentioned here.
19489
19490EOM
19491	case "$static_ext" in
19492	'') dflt="$avail_ext" ;;
19493	*)	dflt="$static_ext"
19494		# Perhaps we are reusing an old out-of-date config.sh.
19495		case "$hint" in
19496		previous)
19497			if test X"$static_ext" != X"$avail_ext"; then
19498				$cat <<EOM
19499NOTICE:  Your previous config.sh list may be incorrect. 
19500The extensions now available to you are 
19501	${avail_ext}
19502but the default list from your previous config.sh is
19503	${static_ext} 
19504
19505EOM
19506			fi
19507			;;
19508		esac
19509		;;
19510	esac
19511	: Exclude those that are not xs extensions
19512	case "$dflt" in
19513	'')	dflt=none;;
19514	esac
19515	rp="What extensions do you wish to include?"
19516	. ./myread
19517	case "$ans" in
19518	none) static_ext=' ' ;;
19519	*) static_ext="$ans" ;;
19520	esac
19521	;;
19522esac
19523#
19524# Encode is a special case.  If we are building Encode as a static
19525# extension, we need to explicitly list its subextensions as well.
19526# For other nested extensions, this is handled automatically by
19527# the appropriate Makefile.PL.
19528case " $static_ext " in
19529	*" Encode "*) # Add the subextensions of Encode
19530	cd "$rsrc/ext"
19531	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19532		static_ext="$static_ext Encode/$xxx"
19533	done
19534	cd "$tdir"
19535	;;
19536esac
19537
19538set X $dynamic_ext $static_ext $nonxs_ext
19539shift
19540extensions="$*"
19541
19542: Remove libraries needed only for extensions
19543: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19544: The exception is SunOS 4.x, which needs them.
19545case "${osname}X${osvers}" in
19546sunos*X4*)
19547    perllibs="$libs"
19548    ;;
19549*) case "$usedl" in
19550    $define|true|[yY]*)
19551	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
19552	    shift
19553	    perllibs="$*"
19554	    ;;
19555    *)	perllibs="$libs"
19556	    ;;
19557    esac
19558    ;;
19559esac
19560
19561: Remove build directory name from cppstdin so it can be used from
19562: either the present location or the final installed location.
19563echo " "
19564: Get out of the UU directory to get correct path name.
19565cd ..
19566case "$cppstdin" in
19567`pwd`/cppstdin)
19568	echo "Stripping down cppstdin path name"
19569	cppstdin=cppstdin
19570	;;
19571esac
19572cd UU
19573
19574: end of configuration questions
19575echo " "
19576echo "End of configuration questions."
19577echo " "
19578
19579: back to where it started
19580if test -d ../UU; then
19581	cd ..
19582fi
19583
19584: configuration may be patched via a 'config.arch' file
19585if $test -f config.arch; then
19586	echo "I see a config.arch file, loading it."
19587	. ./config.arch
19588fi
19589
19590: configuration may be patched via a 'config.over' file
19591if $test -f config.over; then
19592	echo " "
19593	dflt=y
19594	rp='I see a config.over file.  Do you wish to load it?'
19595	. UU/myread
19596	case "$ans" in
19597	n*) echo "OK, I'll ignore it.";;
19598	*)	. ./config.over
19599		echo "Configuration override changes have been loaded."
19600		;;
19601	esac
19602fi
19603
19604: in case they want portability, strip down executable paths
19605case "$d_portable" in
19606"$define")
19607	echo " "
19608	echo "Stripping down executable paths..." >&4
19609	for file in $loclist $trylist; do
19610		eval temp=\$$file
19611		eval $file=`basename $temp`
19612	done
19613	;;
19614esac
19615
19616: create config.sh file
19617echo " "
19618echo "Creating config.sh..." >&4
19619$spitshell <<EOT >config.sh
19620$startsh
19621#
19622# This file was produced by running the Configure script. It holds all the
19623# definitions figured out by Configure. Should you modify one of these values,
19624# do not forget to propagate your changes by running "Configure -der". You may
19625# instead choose to run each of the .SH files by yourself, or "Configure -S".
19626#
19627
19628# Package name      : $package
19629# Source directory  : $src
19630# Configuration time: $cf_time
19631# Configured by     : $cf_by
19632# Target system     : $myuname
19633
19634Author='$Author'
19635Date='$Date'
19636Header='$Header'
19637Id='$Id'
19638Locker='$Locker'
19639Log='$Log'
19640Mcc='$Mcc'
19641RCSfile='$RCSfile'
19642Revision='$Revision'
19643Source='$Source'
19644State='$State'
19645_a='$_a'
19646_exe='$_exe'
19647_o='$_o'
19648afs='$afs'
19649afsroot='$afsroot'
19650alignbytes='$alignbytes'
19651ansi2knr='$ansi2knr'
19652aphostname='$aphostname'
19653api_revision='$api_revision'
19654api_subversion='$api_subversion'
19655api_version='$api_version'
19656api_versionstring='$api_versionstring'
19657ar='$ar'
19658archlib='$archlib'
19659archlibexp='$archlibexp'
19660archname64='$archname64'
19661archname='$archname'
19662archobjs='$archobjs'
19663asctime_r_proto='$asctime_r_proto'
19664awk='$awk'
19665baserev='$baserev'
19666bash='$bash'
19667bin='$bin'
19668binexp='$binexp'
19669bison='$bison'
19670byacc='$byacc'
19671byteorder='$byteorder'
19672c='$c'
19673castflags='$castflags'
19674cat='$cat'
19675cc='$cc'
19676cccdlflags='$cccdlflags'
19677ccdlflags='$ccdlflags'
19678ccflags='$ccflags'
19679ccflags_uselargefiles='$ccflags_uselargefiles'
19680ccname='$ccname'
19681ccsymbols='$ccsymbols'
19682ccversion='$ccversion'
19683cf_by='$cf_by'
19684cf_email='$cf_email'
19685cf_time='$cf_time'
19686charsize='$charsize'
19687chgrp='$chgrp'
19688chmod='$chmod'
19689chown='$chown'
19690clocktype='$clocktype'
19691comm='$comm'
19692compress='$compress'
19693contains='$contains'
19694cp='$cp'
19695cpio='$cpio'
19696cpp='$cpp'
19697cpp_stuff='$cpp_stuff'
19698cppccsymbols='$cppccsymbols'
19699cppflags='$cppflags'
19700cpplast='$cpplast'
19701cppminus='$cppminus'
19702cpprun='$cpprun'
19703cppstdin='$cppstdin'
19704cppsymbols='$cppsymbols'
19705crypt_r_proto='$crypt_r_proto'
19706cryptlib='$cryptlib'
19707csh='$csh'
19708ctermid_r_proto='$ctermid_r_proto'
19709ctime_r_proto='$ctime_r_proto'
19710d_Gconvert='$d_Gconvert'
19711d_PRIEUldbl='$d_PRIEUldbl'
19712d_PRIFUldbl='$d_PRIFUldbl'
19713d_PRIGUldbl='$d_PRIGUldbl'
19714d_PRIXU64='$d_PRIXU64'
19715d_PRId64='$d_PRId64'
19716d_PRIeldbl='$d_PRIeldbl'
19717d_PRIfldbl='$d_PRIfldbl'
19718d_PRIgldbl='$d_PRIgldbl'
19719d_PRIi64='$d_PRIi64'
19720d_PRIo64='$d_PRIo64'
19721d_PRIu64='$d_PRIu64'
19722d_PRIx64='$d_PRIx64'
19723d_SCNfldbl='$d_SCNfldbl'
19724d__fwalk='$d__fwalk'
19725d_access='$d_access'
19726d_accessx='$d_accessx'
19727d_alarm='$d_alarm'
19728d_archlib='$d_archlib'
19729d_asctime_r='$d_asctime_r'
19730d_atolf='$d_atolf'
19731d_atoll='$d_atoll'
19732d_attribut='$d_attribut'
19733d_bcmp='$d_bcmp'
19734d_bcopy='$d_bcopy'
19735d_bsd='$d_bsd'
19736d_bsdgetpgrp='$d_bsdgetpgrp'
19737d_bsdsetpgrp='$d_bsdsetpgrp'
19738d_bzero='$d_bzero'
19739d_casti32='$d_casti32'
19740d_castneg='$d_castneg'
19741d_charvspr='$d_charvspr'
19742d_chown='$d_chown'
19743d_chroot='$d_chroot'
19744d_chsize='$d_chsize'
19745d_class='$d_class'
19746d_closedir='$d_closedir'
19747d_cmsghdr_s='$d_cmsghdr_s'
19748d_const='$d_const'
19749d_crypt='$d_crypt'
19750d_crypt_r='$d_crypt_r'
19751d_csh='$d_csh'
19752d_ctermid_r='$d_ctermid_r'
19753d_ctime_r='$d_ctime_r'
19754d_cuserid='$d_cuserid'
19755d_dbl_dig='$d_dbl_dig'
19756d_dbminitproto='$d_dbminitproto'
19757d_difftime='$d_difftime'
19758d_dirfd='$d_dirfd'
19759d_dirnamlen='$d_dirnamlen'
19760d_dlerror='$d_dlerror'
19761d_dlopen='$d_dlopen'
19762d_dlsymun='$d_dlsymun'
19763d_dosuid='$d_dosuid'
19764d_drand48_r='$d_drand48_r'
19765d_drand48proto='$d_drand48proto'
19766d_dup2='$d_dup2'
19767d_eaccess='$d_eaccess'
19768d_endgrent='$d_endgrent'
19769d_endgrent_r='$d_endgrent_r'
19770d_endhent='$d_endhent'
19771d_endhostent_r='$d_endhostent_r'
19772d_endnent='$d_endnent'
19773d_endnetent_r='$d_endnetent_r'
19774d_endpent='$d_endpent'
19775d_endprotoent_r='$d_endprotoent_r'
19776d_endpwent='$d_endpwent'
19777d_endpwent_r='$d_endpwent_r'
19778d_endsent='$d_endsent'
19779d_endservent_r='$d_endservent_r'
19780d_eofnblk='$d_eofnblk'
19781d_eunice='$d_eunice'
19782d_fchdir='$d_fchdir'
19783d_fchmod='$d_fchmod'
19784d_fchown='$d_fchown'
19785d_fcntl='$d_fcntl'
19786d_fcntl_can_lock='$d_fcntl_can_lock'
19787d_fd_macros='$d_fd_macros'
19788d_fd_set='$d_fd_set'
19789d_fds_bits='$d_fds_bits'
19790d_fgetpos='$d_fgetpos'
19791d_finite='$d_finite'
19792d_finitel='$d_finitel'
19793d_flexfnam='$d_flexfnam'
19794d_flock='$d_flock'
19795d_flockproto='$d_flockproto'
19796d_fork='$d_fork'
19797d_fp_class='$d_fp_class'
19798d_fpathconf='$d_fpathconf'
19799d_fpclass='$d_fpclass'
19800d_fpclassify='$d_fpclassify'
19801d_fpclassl='$d_fpclassl'
19802d_fpos64_t='$d_fpos64_t'
19803d_frexpl='$d_frexpl'
19804d_fs_data_s='$d_fs_data_s'
19805d_fseeko='$d_fseeko'
19806d_fsetpos='$d_fsetpos'
19807d_fstatfs='$d_fstatfs'
19808d_fstatvfs='$d_fstatvfs'
19809d_fsync='$d_fsync'
19810d_ftello='$d_ftello'
19811d_ftime='$d_ftime'
19812d_getcwd='$d_getcwd'
19813d_getespwnam='$d_getespwnam'
19814d_getfsstat='$d_getfsstat'
19815d_getgrent='$d_getgrent'
19816d_getgrent_r='$d_getgrent_r'
19817d_getgrgid_r='$d_getgrgid_r'
19818d_getgrnam_r='$d_getgrnam_r'
19819d_getgrps='$d_getgrps'
19820d_gethbyaddr='$d_gethbyaddr'
19821d_gethbyname='$d_gethbyname'
19822d_gethent='$d_gethent'
19823d_gethname='$d_gethname'
19824d_gethostbyaddr_r='$d_gethostbyaddr_r'
19825d_gethostbyname_r='$d_gethostbyname_r'
19826d_gethostent_r='$d_gethostent_r'
19827d_gethostprotos='$d_gethostprotos'
19828d_getitimer='$d_getitimer'
19829d_getlogin='$d_getlogin'
19830d_getlogin_r='$d_getlogin_r'
19831d_getmnt='$d_getmnt'
19832d_getmntent='$d_getmntent'
19833d_getnbyaddr='$d_getnbyaddr'
19834d_getnbyname='$d_getnbyname'
19835d_getnent='$d_getnent'
19836d_getnetbyaddr_r='$d_getnetbyaddr_r'
19837d_getnetbyname_r='$d_getnetbyname_r'
19838d_getnetent_r='$d_getnetent_r'
19839d_getnetprotos='$d_getnetprotos'
19840d_getpagsz='$d_getpagsz'
19841d_getpbyname='$d_getpbyname'
19842d_getpbynumber='$d_getpbynumber'
19843d_getpent='$d_getpent'
19844d_getpgid='$d_getpgid'
19845d_getpgrp2='$d_getpgrp2'
19846d_getpgrp='$d_getpgrp'
19847d_getppid='$d_getppid'
19848d_getprior='$d_getprior'
19849d_getprotobyname_r='$d_getprotobyname_r'
19850d_getprotobynumber_r='$d_getprotobynumber_r'
19851d_getprotoent_r='$d_getprotoent_r'
19852d_getprotoprotos='$d_getprotoprotos'
19853d_getprpwnam='$d_getprpwnam'
19854d_getpwent='$d_getpwent'
19855d_getpwent_r='$d_getpwent_r'
19856d_getpwnam_r='$d_getpwnam_r'
19857d_getpwuid_r='$d_getpwuid_r'
19858d_getsbyname='$d_getsbyname'
19859d_getsbyport='$d_getsbyport'
19860d_getsent='$d_getsent'
19861d_getservbyname_r='$d_getservbyname_r'
19862d_getservbyport_r='$d_getservbyport_r'
19863d_getservent_r='$d_getservent_r'
19864d_getservprotos='$d_getservprotos'
19865d_getspnam='$d_getspnam'
19866d_getspnam_r='$d_getspnam_r'
19867d_gettimeod='$d_gettimeod'
19868d_gmtime_r='$d_gmtime_r'
19869d_gnulibc='$d_gnulibc'
19870d_grpasswd='$d_grpasswd'
19871d_hasmntopt='$d_hasmntopt'
19872d_htonl='$d_htonl'
19873d_index='$d_index'
19874d_inetaton='$d_inetaton'
19875d_int64_t='$d_int64_t'
19876d_isascii='$d_isascii'
19877d_isfinite='$d_isfinite'
19878d_isinf='$d_isinf'
19879d_isnan='$d_isnan'
19880d_isnanl='$d_isnanl'
19881d_killpg='$d_killpg'
19882d_lchown='$d_lchown'
19883d_ldbl_dig='$d_ldbl_dig'
19884d_link='$d_link'
19885d_localtime_r='$d_localtime_r'
19886d_locconv='$d_locconv'
19887d_lockf='$d_lockf'
19888d_longdbl='$d_longdbl'
19889d_longlong='$d_longlong'
19890d_lseekproto='$d_lseekproto'
19891d_lstat='$d_lstat'
19892d_madvise='$d_madvise'
19893d_mblen='$d_mblen'
19894d_mbstowcs='$d_mbstowcs'
19895d_mbtowc='$d_mbtowc'
19896d_memchr='$d_memchr'
19897d_memcmp='$d_memcmp'
19898d_memcpy='$d_memcpy'
19899d_memmove='$d_memmove'
19900d_memset='$d_memset'
19901d_mkdir='$d_mkdir'
19902d_mkdtemp='$d_mkdtemp'
19903d_mkfifo='$d_mkfifo'
19904d_mkstemp='$d_mkstemp'
19905d_mkstemps='$d_mkstemps'
19906d_mktime='$d_mktime'
19907d_mmap='$d_mmap'
19908d_modfl='$d_modfl'
19909d_modfl_pow32_bug='$d_modfl_pow32_bug'
19910d_mprotect='$d_mprotect'
19911d_msg='$d_msg'
19912d_msg_ctrunc='$d_msg_ctrunc'
19913d_msg_dontroute='$d_msg_dontroute'
19914d_msg_oob='$d_msg_oob'
19915d_msg_peek='$d_msg_peek'
19916d_msg_proxy='$d_msg_proxy'
19917d_msgctl='$d_msgctl'
19918d_msgget='$d_msgget'
19919d_msghdr_s='$d_msghdr_s'
19920d_msgrcv='$d_msgrcv'
19921d_msgsnd='$d_msgsnd'
19922d_msync='$d_msync'
19923d_munmap='$d_munmap'
19924d_mymalloc='$d_mymalloc'
19925d_nice='$d_nice'
19926d_nl_langinfo='$d_nl_langinfo'
19927d_nv_preserves_uv='$d_nv_preserves_uv'
19928d_off64_t='$d_off64_t'
19929d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19930d_oldpthreads='$d_oldpthreads'
19931d_oldsock='$d_oldsock'
19932d_open3='$d_open3'
19933d_pathconf='$d_pathconf'
19934d_pause='$d_pause'
19935d_perl_otherlibdirs='$d_perl_otherlibdirs'
19936d_phostname='$d_phostname'
19937d_pipe='$d_pipe'
19938d_poll='$d_poll'
19939d_portable='$d_portable'
19940d_procselfexe='$d_procselfexe'
19941d_pthread_atfork='$d_pthread_atfork'
19942d_pthread_yield='$d_pthread_yield'
19943d_pwage='$d_pwage'
19944d_pwchange='$d_pwchange'
19945d_pwclass='$d_pwclass'
19946d_pwcomment='$d_pwcomment'
19947d_pwexpire='$d_pwexpire'
19948d_pwgecos='$d_pwgecos'
19949d_pwpasswd='$d_pwpasswd'
19950d_pwquota='$d_pwquota'
19951d_qgcvt='$d_qgcvt'
19952d_quad='$d_quad'
19953d_random_r='$d_random_r'
19954d_readdir64_r='$d_readdir64_r'
19955d_readdir='$d_readdir'
19956d_readdir_r='$d_readdir_r'
19957d_readlink='$d_readlink'
19958d_readv='$d_readv'
19959d_recvmsg='$d_recvmsg'
19960d_rename='$d_rename'
19961d_rewinddir='$d_rewinddir'
19962d_rmdir='$d_rmdir'
19963d_safebcpy='$d_safebcpy'
19964d_safemcpy='$d_safemcpy'
19965d_sanemcmp='$d_sanemcmp'
19966d_sbrkproto='$d_sbrkproto'
19967d_sched_yield='$d_sched_yield'
19968d_scm_rights='$d_scm_rights'
19969d_seekdir='$d_seekdir'
19970d_select='$d_select'
19971d_sem='$d_sem'
19972d_semctl='$d_semctl'
19973d_semctl_semid_ds='$d_semctl_semid_ds'
19974d_semctl_semun='$d_semctl_semun'
19975d_semget='$d_semget'
19976d_semop='$d_semop'
19977d_sendmsg='$d_sendmsg'
19978d_setegid='$d_setegid'
19979d_seteuid='$d_seteuid'
19980d_setgrent='$d_setgrent'
19981d_setgrent_r='$d_setgrent_r'
19982d_setgrps='$d_setgrps'
19983d_sethent='$d_sethent'
19984d_sethostent_r='$d_sethostent_r'
19985d_setitimer='$d_setitimer'
19986d_setlinebuf='$d_setlinebuf'
19987d_setlocale='$d_setlocale'
19988d_setlocale_r='$d_setlocale_r'
19989d_setnent='$d_setnent'
19990d_setnetent_r='$d_setnetent_r'
19991d_setpent='$d_setpent'
19992d_setpgid='$d_setpgid'
19993d_setpgrp2='$d_setpgrp2'
19994d_setpgrp='$d_setpgrp'
19995d_setprior='$d_setprior'
19996d_setproctitle='$d_setproctitle'
19997d_setprotoent_r='$d_setprotoent_r'
19998d_setpwent='$d_setpwent'
19999d_setpwent_r='$d_setpwent_r'
20000d_setregid='$d_setregid'
20001d_setresgid='$d_setresgid'
20002d_setresuid='$d_setresuid'
20003d_setreuid='$d_setreuid'
20004d_setrgid='$d_setrgid'
20005d_setruid='$d_setruid'
20006d_setsent='$d_setsent'
20007d_setservent_r='$d_setservent_r'
20008d_setsid='$d_setsid'
20009d_setvbuf='$d_setvbuf'
20010d_sfio='$d_sfio'
20011d_shm='$d_shm'
20012d_shmat='$d_shmat'
20013d_shmatprototype='$d_shmatprototype'
20014d_shmctl='$d_shmctl'
20015d_shmdt='$d_shmdt'
20016d_shmget='$d_shmget'
20017d_sigaction='$d_sigaction'
20018d_sigprocmask='$d_sigprocmask'
20019d_sigsetjmp='$d_sigsetjmp'
20020d_sockatmark='$d_sockatmark'
20021d_sockatmarkproto='$d_sockatmarkproto'
20022d_socket='$d_socket'
20023d_socklen_t='$d_socklen_t'
20024d_sockpair='$d_sockpair'
20025d_socks5_init='$d_socks5_init'
20026d_sqrtl='$d_sqrtl'
20027d_srand48_r='$d_srand48_r'
20028d_srandom_r='$d_srandom_r'
20029d_sresgproto='$d_sresgproto'
20030d_sresuproto='$d_sresuproto'
20031d_statblks='$d_statblks'
20032d_statfs_f_flags='$d_statfs_f_flags'
20033d_statfs_s='$d_statfs_s'
20034d_statvfs='$d_statvfs'
20035d_stdio_cnt_lval='$d_stdio_cnt_lval'
20036d_stdio_ptr_lval='$d_stdio_ptr_lval'
20037d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20038d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20039d_stdio_stream_array='$d_stdio_stream_array'
20040d_stdiobase='$d_stdiobase'
20041d_stdstdio='$d_stdstdio'
20042d_strchr='$d_strchr'
20043d_strcoll='$d_strcoll'
20044d_strctcpy='$d_strctcpy'
20045d_strerrm='$d_strerrm'
20046d_strerror='$d_strerror'
20047d_strerror_r='$d_strerror_r'
20048d_strftime='$d_strftime'
20049d_strtod='$d_strtod'
20050d_strtol='$d_strtol'
20051d_strtold='$d_strtold'
20052d_strtoll='$d_strtoll'
20053d_strtoq='$d_strtoq'
20054d_strtoul='$d_strtoul'
20055d_strtoull='$d_strtoull'
20056d_strtouq='$d_strtouq'
20057d_strxfrm='$d_strxfrm'
20058d_suidsafe='$d_suidsafe'
20059d_symlink='$d_symlink'
20060d_syscall='$d_syscall'
20061d_syscallproto='$d_syscallproto'
20062d_sysconf='$d_sysconf'
20063d_sysernlst='$d_sysernlst'
20064d_syserrlst='$d_syserrlst'
20065d_system='$d_system'
20066d_tcgetpgrp='$d_tcgetpgrp'
20067d_tcsetpgrp='$d_tcsetpgrp'
20068d_telldir='$d_telldir'
20069d_telldirproto='$d_telldirproto'
20070d_time='$d_time'
20071d_times='$d_times'
20072d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20073d_tm_tm_zone='$d_tm_tm_zone'
20074d_tmpnam_r='$d_tmpnam_r'
20075d_truncate='$d_truncate'
20076d_ttyname_r='$d_ttyname_r'
20077d_tzname='$d_tzname'
20078d_u32align='$d_u32align'
20079d_ualarm='$d_ualarm'
20080d_umask='$d_umask'
20081d_uname='$d_uname'
20082d_union_semun='$d_union_semun'
20083d_unordered='$d_unordered'
20084d_usleep='$d_usleep'
20085d_usleepproto='$d_usleepproto'
20086d_ustat='$d_ustat'
20087d_vendorarch='$d_vendorarch'
20088d_vendorbin='$d_vendorbin'
20089d_vendorlib='$d_vendorlib'
20090d_vfork='$d_vfork'
20091d_void_closedir='$d_void_closedir'
20092d_voidsig='$d_voidsig'
20093d_voidtty='$d_voidtty'
20094d_volatile='$d_volatile'
20095d_vprintf='$d_vprintf'
20096d_wait4='$d_wait4'
20097d_waitpid='$d_waitpid'
20098d_wcstombs='$d_wcstombs'
20099d_wctomb='$d_wctomb'
20100d_writev='$d_writev'
20101d_xenix='$d_xenix'
20102date='$date'
20103db_hashtype='$db_hashtype'
20104db_prefixtype='$db_prefixtype'
20105db_version_major='$db_version_major'
20106db_version_minor='$db_version_minor'
20107db_version_patch='$db_version_patch'
20108defvoidused='$defvoidused'
20109direntrytype='$direntrytype'
20110dlext='$dlext'
20111dlsrc='$dlsrc'
20112doublesize='$doublesize'
20113drand01='$drand01'
20114drand48_r_proto='$drand48_r_proto'
20115dynamic_ext='$dynamic_ext'
20116eagain='$eagain'
20117ebcdic='$ebcdic'
20118echo='$echo'
20119egrep='$egrep'
20120emacs='$emacs'
20121endgrent_r_proto='$endgrent_r_proto'
20122endhostent_r_proto='$endhostent_r_proto'
20123endnetent_r_proto='$endnetent_r_proto'
20124endprotoent_r_proto='$endprotoent_r_proto'
20125endpwent_r_proto='$endpwent_r_proto'
20126endservent_r_proto='$endservent_r_proto'
20127eunicefix='$eunicefix'
20128exe_ext='$exe_ext'
20129expr='$expr'
20130extensions='$extensions'
20131extras='$extras'
20132fflushNULL='$fflushNULL'
20133fflushall='$fflushall'
20134find='$find'
20135firstmakefile='$firstmakefile'
20136flex='$flex'
20137fpossize='$fpossize'
20138fpostype='$fpostype'
20139freetype='$freetype'
20140from='$from'
20141full_ar='$full_ar'
20142full_csh='$full_csh'
20143full_sed='$full_sed'
20144gccosandvers='$gccosandvers'
20145gccversion='$gccversion'
20146getgrent_r_proto='$getgrent_r_proto'
20147getgrgid_r_proto='$getgrgid_r_proto'
20148getgrnam_r_proto='$getgrnam_r_proto'
20149gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20150gethostbyname_r_proto='$gethostbyname_r_proto'
20151gethostent_r_proto='$gethostent_r_proto'
20152getlogin_r_proto='$getlogin_r_proto'
20153getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20154getnetbyname_r_proto='$getnetbyname_r_proto'
20155getnetent_r_proto='$getnetent_r_proto'
20156getprotobyname_r_proto='$getprotobyname_r_proto'
20157getprotobynumber_r_proto='$getprotobynumber_r_proto'
20158getprotoent_r_proto='$getprotoent_r_proto'
20159getpwent_r_proto='$getpwent_r_proto'
20160getpwnam_r_proto='$getpwnam_r_proto'
20161getpwuid_r_proto='$getpwuid_r_proto'
20162getservbyname_r_proto='$getservbyname_r_proto'
20163getservbyport_r_proto='$getservbyport_r_proto'
20164getservent_r_proto='$getservent_r_proto'
20165getspnam_r_proto='$getspnam_r_proto'
20166gidformat='$gidformat'
20167gidsign='$gidsign'
20168gidsize='$gidsize'
20169gidtype='$gidtype'
20170glibpth='$glibpth'
20171gmake='$gmake'
20172gmtime_r_proto='$gmtime_r_proto'
20173gnulibc_version='$gnulibc_version'
20174grep='$grep'
20175groupcat='$groupcat'
20176groupstype='$groupstype'
20177gzip='$gzip'
20178h_fcntl='$h_fcntl'
20179h_sysfile='$h_sysfile'
20180hint='$hint'
20181hostcat='$hostcat'
20182i16size='$i16size'
20183i16type='$i16type'
20184i32size='$i32size'
20185i32type='$i32type'
20186i64size='$i64size'
20187i64type='$i64type'
20188i8size='$i8size'
20189i8type='$i8type'
20190i_arpainet='$i_arpainet'
20191i_bsdioctl='$i_bsdioctl'
20192i_crypt='$i_crypt'
20193i_db='$i_db'
20194i_dbm='$i_dbm'
20195i_dirent='$i_dirent'
20196i_dld='$i_dld'
20197i_dlfcn='$i_dlfcn'
20198i_fcntl='$i_fcntl'
20199i_float='$i_float'
20200i_fp='$i_fp'
20201i_fp_class='$i_fp_class'
20202i_gdbm='$i_gdbm'
20203i_grp='$i_grp'
20204i_ieeefp='$i_ieeefp'
20205i_inttypes='$i_inttypes'
20206i_langinfo='$i_langinfo'
20207i_libutil='$i_libutil'
20208i_limits='$i_limits'
20209i_locale='$i_locale'
20210i_machcthr='$i_machcthr'
20211i_malloc='$i_malloc'
20212i_math='$i_math'
20213i_memory='$i_memory'
20214i_mntent='$i_mntent'
20215i_ndbm='$i_ndbm'
20216i_netdb='$i_netdb'
20217i_neterrno='$i_neterrno'
20218i_netinettcp='$i_netinettcp'
20219i_niin='$i_niin'
20220i_poll='$i_poll'
20221i_prot='$i_prot'
20222i_pthread='$i_pthread'
20223i_pwd='$i_pwd'
20224i_rpcsvcdbm='$i_rpcsvcdbm'
20225i_sfio='$i_sfio'
20226i_sgtty='$i_sgtty'
20227i_shadow='$i_shadow'
20228i_socks='$i_socks'
20229i_stdarg='$i_stdarg'
20230i_stddef='$i_stddef'
20231i_stdlib='$i_stdlib'
20232i_string='$i_string'
20233i_sunmath='$i_sunmath'
20234i_sysaccess='$i_sysaccess'
20235i_sysdir='$i_sysdir'
20236i_sysfile='$i_sysfile'
20237i_sysfilio='$i_sysfilio'
20238i_sysin='$i_sysin'
20239i_sysioctl='$i_sysioctl'
20240i_syslog='$i_syslog'
20241i_sysmman='$i_sysmman'
20242i_sysmode='$i_sysmode'
20243i_sysmount='$i_sysmount'
20244i_sysndir='$i_sysndir'
20245i_sysparam='$i_sysparam'
20246i_sysresrc='$i_sysresrc'
20247i_syssecrt='$i_syssecrt'
20248i_sysselct='$i_sysselct'
20249i_syssockio='$i_syssockio'
20250i_sysstat='$i_sysstat'
20251i_sysstatfs='$i_sysstatfs'
20252i_sysstatvfs='$i_sysstatvfs'
20253i_systime='$i_systime'
20254i_systimek='$i_systimek'
20255i_systimes='$i_systimes'
20256i_systypes='$i_systypes'
20257i_sysuio='$i_sysuio'
20258i_sysun='$i_sysun'
20259i_sysutsname='$i_sysutsname'
20260i_sysvfs='$i_sysvfs'
20261i_syswait='$i_syswait'
20262i_termio='$i_termio'
20263i_termios='$i_termios'
20264i_time='$i_time'
20265i_unistd='$i_unistd'
20266i_ustat='$i_ustat'
20267i_utime='$i_utime'
20268i_values='$i_values'
20269i_varargs='$i_varargs'
20270i_varhdr='$i_varhdr'
20271i_vfork='$i_vfork'
20272ignore_versioned_solibs='$ignore_versioned_solibs'
20273inc_version_list='$inc_version_list'
20274inc_version_list_init='$inc_version_list_init'
20275incpath='$incpath'
20276inews='$inews'
20277installarchlib='$installarchlib'
20278installbin='$installbin'
20279installman1dir='$installman1dir'
20280installman3dir='$installman3dir'
20281installprefix='$installprefix'
20282installprefixexp='$installprefixexp'
20283installprivlib='$installprivlib'
20284installscript='$installscript'
20285installsitearch='$installsitearch'
20286installsitebin='$installsitebin'
20287installsitelib='$installsitelib'
20288installstyle='$installstyle'
20289installusrbinperl='$installusrbinperl'
20290installvendorarch='$installvendorarch'
20291installvendorbin='$installvendorbin'
20292installvendorlib='$installvendorlib'
20293intsize='$intsize'
20294issymlink='$issymlink'
20295ivdformat='$ivdformat'
20296ivsize='$ivsize'
20297ivtype='$ivtype'
20298known_extensions='$known_extensions'
20299ksh='$ksh'
20300ld='$ld'
20301lddlflags='$lddlflags'
20302ldflags='$ldflags'
20303ldflags_uselargefiles='$ldflags_uselargefiles'
20304ldlibpthname='$ldlibpthname'
20305less='$less'
20306lib_ext='$lib_ext'
20307libc='$libc'
20308libperl='$libperl'
20309libpth='$libpth'
20310libs='$libs'
20311libsdirs='$libsdirs'
20312libsfiles='$libsfiles'
20313libsfound='$libsfound'
20314libspath='$libspath'
20315libswanted='$libswanted'
20316libswanted_uselargefiles='$libswanted_uselargefiles'
20317line='$line'
20318lint='$lint'
20319lkflags='$lkflags'
20320ln='$ln'
20321lns='$lns'
20322localtime_r_proto='$localtime_r_proto'
20323locincpth='$locincpth'
20324loclibpth='$loclibpth'
20325longdblsize='$longdblsize'
20326longlongsize='$longlongsize'
20327longsize='$longsize'
20328lp='$lp'
20329lpr='$lpr'
20330ls='$ls'
20331lseeksize='$lseeksize'
20332lseektype='$lseektype'
20333mail='$mail'
20334mailx='$mailx'
20335make='$make'
20336make_set_make='$make_set_make'
20337mallocobj='$mallocobj'
20338mallocsrc='$mallocsrc'
20339malloctype='$malloctype'
20340man1dir='$man1dir'
20341man1direxp='$man1direxp'
20342man1ext='$man1ext'
20343man3dir='$man3dir'
20344man3direxp='$man3direxp'
20345man3ext='$man3ext'
20346mips_type='$mips_type'
20347mkdir='$mkdir'
20348mmaptype='$mmaptype'
20349modetype='$modetype'
20350more='$more'
20351multiarch='$multiarch'
20352mv='$mv'
20353myarchname='$myarchname'
20354mydomain='$mydomain'
20355myhostname='$myhostname'
20356myuname='$myuname'
20357n='$n'
20358need_va_copy='$need_va_copy'
20359netdb_hlen_type='$netdb_hlen_type'
20360netdb_host_type='$netdb_host_type'
20361netdb_name_type='$netdb_name_type'
20362netdb_net_type='$netdb_net_type'
20363nm='$nm'
20364nm_opt='$nm_opt'
20365nm_so_opt='$nm_so_opt'
20366nonxs_ext='$nonxs_ext'
20367nroff='$nroff'
20368nvEUformat='$nvEUformat'
20369nvFUformat='$nvFUformat'
20370nvGUformat='$nvGUformat'
20371nv_preserves_uv_bits='$nv_preserves_uv_bits'
20372nveformat='$nveformat'
20373nvfformat='$nvfformat'
20374nvgformat='$nvgformat'
20375nvsize='$nvsize'
20376nvtype='$nvtype'
20377o_nonblock='$o_nonblock'
20378obj_ext='$obj_ext'
20379old_pthread_create_joinable='$old_pthread_create_joinable'
20380optimize='$optimize'
20381orderlib='$orderlib'
20382osname='$osname'
20383osvers='$osvers'
20384otherlibdirs='$otherlibdirs'
20385package='$package'
20386pager='$pager'
20387passcat='$passcat'
20388patchlevel='$patchlevel'
20389path_sep='$path_sep'
20390perl5='$perl5'
20391perl='$perl'
20392perl_patchlevel='$perl_patchlevel'
20393perladmin='$perladmin'
20394perllibs='$perllibs'
20395perlpath='$perlpath'
20396pg='$pg'
20397phostname='$phostname'
20398pidtype='$pidtype'
20399plibpth='$plibpth'
20400pm_apiversion='$pm_apiversion'
20401pmake='$pmake'
20402pr='$pr'
20403prefix='$prefix'
20404prefixexp='$prefixexp'
20405privlib='$privlib'
20406privlibexp='$privlibexp'
20407procselfexe='$procselfexe'
20408prototype='$prototype'
20409ptrsize='$ptrsize'
20410quadkind='$quadkind'
20411quadtype='$quadtype'
20412randbits='$randbits'
20413randfunc='$randfunc'
20414random_r_proto='$random_r_proto'
20415randseedtype='$randseedtype'
20416ranlib='$ranlib'
20417rd_nodata='$rd_nodata'
20418readdir64_r_proto='$readdir64_r_proto'
20419readdir_r_proto='$readdir_r_proto'
20420revision='$revision'
20421rm='$rm'
20422rmail='$rmail'
20423run='$run'
20424runnm='$runnm'
20425sPRIEUldbl='$sPRIEUldbl'
20426sPRIFUldbl='$sPRIFUldbl'
20427sPRIGUldbl='$sPRIGUldbl'
20428sPRIXU64='$sPRIXU64'
20429sPRId64='$sPRId64'
20430sPRIeldbl='$sPRIeldbl'
20431sPRIfldbl='$sPRIfldbl'
20432sPRIgldbl='$sPRIgldbl'
20433sPRIi64='$sPRIi64'
20434sPRIo64='$sPRIo64'
20435sPRIu64='$sPRIu64'
20436sPRIx64='$sPRIx64'
20437sSCNfldbl='$sSCNfldbl'
20438sched_yield='$sched_yield'
20439scriptdir='$scriptdir'
20440scriptdirexp='$scriptdirexp'
20441sed='$sed'
20442seedfunc='$seedfunc'
20443selectminbits='$selectminbits'
20444selecttype='$selecttype'
20445sendmail='$sendmail'
20446setgrent_r_proto='$setgrent_r_proto'
20447sethostent_r_proto='$sethostent_r_proto'
20448setlocale_r_proto='$setlocale_r_proto'
20449setnetent_r_proto='$setnetent_r_proto'
20450setprotoent_r_proto='$setprotoent_r_proto'
20451setpwent_r_proto='$setpwent_r_proto'
20452setservent_r_proto='$setservent_r_proto'
20453sh='$sh'
20454shar='$shar'
20455sharpbang='$sharpbang'
20456shmattype='$shmattype'
20457shortsize='$shortsize'
20458shrpenv='$shrpenv'
20459shsharp='$shsharp'
20460sig_count='$sig_count'
20461sig_name='$sig_name'
20462sig_name_init='$sig_name_init'
20463sig_num='$sig_num'
20464sig_num_init='$sig_num_init'
20465sig_size='$sig_size'
20466signal_t='$signal_t'
20467sitearch='$sitearch'
20468sitearchexp='$sitearchexp'
20469sitebin='$sitebin'
20470sitebinexp='$sitebinexp'
20471sitelib='$sitelib'
20472sitelib_stem='$sitelib_stem'
20473sitelibexp='$sitelibexp'
20474siteprefix='$siteprefix'
20475siteprefixexp='$siteprefixexp'
20476sizesize='$sizesize'
20477sizetype='$sizetype'
20478sleep='$sleep'
20479smail='$smail'
20480so='$so'
20481sockethdr='$sockethdr'
20482socketlib='$socketlib'
20483socksizetype='$socksizetype'
20484sort='$sort'
20485spackage='$spackage'
20486spitshell='$spitshell'
20487srand48_r_proto='$srand48_r_proto'
20488srandom_r_proto='$srandom_r_proto'
20489src='$src'
20490ssizetype='$ssizetype'
20491startperl='$startperl'
20492startsh='$startsh'
20493static_ext='$static_ext'
20494stdchar='$stdchar'
20495stdio_base='$stdio_base'
20496stdio_bufsiz='$stdio_bufsiz'
20497stdio_cnt='$stdio_cnt'
20498stdio_filbuf='$stdio_filbuf'
20499stdio_ptr='$stdio_ptr'
20500stdio_stream_array='$stdio_stream_array'
20501strerror_r_proto='$strerror_r_proto'
20502strings='$strings'
20503submit='$submit'
20504subversion='$subversion'
20505sysman='$sysman'
20506tail='$tail'
20507tar='$tar'
20508targetarch='$targetarch'
20509tbl='$tbl'
20510tee='$tee'
20511test='$test'
20512timeincl='$timeincl'
20513timetype='$timetype'
20514tmpnam_r_proto='$tmpnam_r_proto'
20515to='$to'
20516touch='$touch'
20517tr='$tr'
20518trnl='$trnl'
20519troff='$troff'
20520ttyname_r_proto='$ttyname_r_proto'
20521u16size='$u16size'
20522u16type='$u16type'
20523u32size='$u32size'
20524u32type='$u32type'
20525u64size='$u64size'
20526u64type='$u64type'
20527u8size='$u8size'
20528u8type='$u8type'
20529uidformat='$uidformat'
20530uidsign='$uidsign'
20531uidsize='$uidsize'
20532uidtype='$uidtype'
20533uname='$uname'
20534uniq='$uniq'
20535uquadtype='$uquadtype'
20536use5005threads='$use5005threads'
20537use64bitall='$use64bitall'
20538use64bitint='$use64bitint'
20539usecrosscompile='$usecrosscompile'
20540usedl='$usedl'
20541useithreads='$useithreads'
20542uselargefiles='$uselargefiles'
20543uselongdouble='$uselongdouble'
20544usemorebits='$usemorebits'
20545usemultiplicity='$usemultiplicity'
20546usemymalloc='$usemymalloc'
20547usenm='$usenm'
20548useopcode='$useopcode'
20549useperlio='$useperlio'
20550useposix='$useposix'
20551usereentrant='$usereentrant'
20552usesfio='$usesfio'
20553useshrplib='$useshrplib'
20554usesocks='$usesocks'
20555usethreads='$usethreads'
20556usevendorprefix='$usevendorprefix'
20557usevfork='$usevfork'
20558usrinc='$usrinc'
20559uuname='$uuname'
20560uvXUformat='$uvXUformat'
20561uvoformat='$uvoformat'
20562uvsize='$uvsize'
20563uvtype='$uvtype'
20564uvuformat='$uvuformat'
20565uvxformat='$uvxformat'
20566vendorarch='$vendorarch'
20567vendorarchexp='$vendorarchexp'
20568vendorbin='$vendorbin'
20569vendorbinexp='$vendorbinexp'
20570vendorlib='$vendorlib'
20571vendorlib_stem='$vendorlib_stem'
20572vendorlibexp='$vendorlibexp'
20573vendorprefix='$vendorprefix'
20574vendorprefixexp='$vendorprefixexp'
20575version='$version'
20576version_patchlevel_string='$version_patchlevel_string'
20577versiononly='$versiononly'
20578vi='$vi'
20579voidflags='$voidflags'
20580xlibpth='$xlibpth'
20581xs_apiversion='$xs_apiversion'
20582yacc='$yacc'
20583yaccflags='$yaccflags'
20584zcat='$zcat'
20585zip='$zip'
20586EOT
20587
20588: Add in command line options if available
20589$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20590
20591: add special variables
20592$test -f $src/patchlevel.h && \
20593awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20594echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20595echo "PERL_CONFIG_SH=true" >>config.sh
20596
20597: propagate old symbols
20598if $test -f UU/config.sh; then
20599	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
20600	sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20601	$sort | $uniq -u >UU/oldsyms
20602	set X `cat UU/oldsyms`
20603	shift
20604	case $# in
20605	0) ;;
20606	*)
20607		cat <<EOM
20608Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20609EOM
20610		echo "# Variables propagated from previous config.sh file." >>config.sh
20611		for sym in `cat UU/oldsyms`; do
20612			echo "    Propagating $hint variable "'$'"$sym..."
20613			eval 'tmp="$'"${sym}"'"'
20614			echo "$tmp" | \
20615				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20616		done
20617		;;
20618	esac
20619fi
20620
20621: Finish up by extracting the .SH files
20622case "$alldone" in
20623exit)
20624	$rm -rf UU
20625	echo "Extraction done."
20626	exit 0
20627	;;
20628cont)
20629	;;
20630'')
20631	dflt=''
20632	nostick=true
20633	$cat <<EOM
20634
20635If you'd like to make any changes to the config.sh file before I begin
20636to configure things, do it as a shell escape now (e.g. !vi config.sh).
20637
20638EOM
20639	rp="Press return or use a shell escape to edit config.sh:"
20640	. UU/myread
20641	nostick=''
20642	case "$ans" in
20643	'') ;;
20644	*) : in case they cannot read
20645		sh 1>&4 -c "$ans";;
20646	esac
20647	;;
20648esac
20649
20650: if this fails, just run all the .SH files by hand
20651. ./config.sh
20652
20653echo " "
20654exec 1>&4
20655pwd=`pwd`
20656. ./UU/extract
20657cd "$pwd"
20658
20659if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20660	dflt=y
20661	case "$silent" in
20662	true) ;;
20663	*)
20664		$cat <<EOM
20665
20666Now you need to generate make dependencies by running "$make depend".
20667You might prefer to run it in background: "$make depend > makedepend.out &"
20668It can take a while, so you might not want to run it right now.
20669
20670EOM
20671		;;
20672	esac
20673	rp="Run $make depend now?"
20674	. UU/myread
20675	case "$ans" in
20676	y*)
20677		$make depend && echo "Now you must run '$make'."
20678		;;
20679	*)
20680		echo "You must run '$make depend' then '$make'."
20681		;;
20682	esac
20683elif test -f [Mm]akefile; then
20684	echo " "
20685	echo "Now you must run a $make."
20686else
20687	echo "Configure done."
20688fi
20689
20690if $test -f Policy.sh; then
20691    $cat <<EOM
20692
20693If you compile $package on a different machine or from a different object
20694directory, copy the Policy.sh file from this object directory to the
20695new one before you run Configure -- this will help you with most of
20696the policy defaults.
20697
20698EOM
20699fi
20700if $test -f config.msg; then
20701    echo "Hmm.  I also noted the following information while running:"
20702    echo " "
20703    $cat config.msg >&4
20704    $rm -f config.msg
20705fi
20706$rm -f kit*isdone ark*isdone
20707$rm -rf UU
20708
20709: End of Configure
20710
20711