xref: /openbsd-src/gnu/usr.bin/perl/Configure (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist package (which contains metaconfig) is available via SVN:
17#     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18#
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
22# For more information on patching Configure, see pod/perlhack.pod
23#
24# The metaunits are also available from the public git repository:
25#     http://perl5.git.perl.org/metaconfig.git/ or
26#     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27#
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
30
31# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32#
33# Generated on Wed Jun 23 16:03:55 CEST 2010 [metaconfig 3.5 PL0]
34# (with additional metaconfig patches by perlbug@perl.org)
35
36cat >c1$$ <<EOF
37ARGGGHHHH!!!!!
38
39SCO csh still thinks true is false.  Write to SCO today and tell them that next
40year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45[End of diatribe. We now return you to your regularly scheduled programming...]
46EOF
47cat >c2$$ <<EOF
48
49OOPS!  You naughty creature!  You didn't run Configure with sh!
50I will attempt to remedy the situation by running sh for you...
51EOF
52
53true || cat c1$$ c2$$
54true || exec sh $0 $argv:q
55
56(exit $?0) || cat c2$$
57(exit $?0) || exec sh $0 $argv:q
58rm -f c1$$ c2$$
59
60if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61	cat <<EOF
62***
63*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65*** Please read the README.plan9 for further instructions.
66*** Cannot continue, aborting.
67***
68EOF
69	exit 1
70fi
71
72if test ! -c /dev/null ; then
73	cat <<EOF
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81	exit 1
82fi
83
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89	test "$me" || me=$0
90	;;
91esac
92
93: Proper separator for the PATH environment variable
94p_=:
95: On OS/2 this directory should exist if this is not floppy only system ":-]"
96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97	if test -n "$OS2_SHELL"; then
98		p_=\;
99		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101		is_os2=yes
102	elif test -n "$DJGPP"; then
103		case "X${MACHTYPE:-nonesuchmach}" in
104		*cygwin) ;;
105		*) p_=\; ;;
106		esac
107	fi
108fi
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
119paths="$paths /system/gnu_library/bin"
120
121for p in $paths
122do
123	case "$p_$PATH$p_" in
124	*$p_$p$p_*) ;;
125	*) test -d $p && PATH=$PATH$p_$p ;;
126	esac
127done
128
129PATH=.$p_$PATH
130export PATH
131
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
138if (PATH=.; alias -x) >/dev/null 2>&1; then
139		inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142	needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145	if test X`/usr/bin/uname -v` = X4; then
146		avoidksh="to avoid AIX 4's /bin/sh"
147		newsh=/usr/bin/bsh
148	fi
149fi
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151	if test X`/usr/bin/uname -s` = XOSF1; then
152		avoidksh="to avoid Digital UNIX' ksh"
153		newsh=/bin/sh
154		unset BIN_SH
155	fi
156fi
157case "$inksh/$needksh" in
158/[a-z]*)
159		ENV=''
160		changesh=true
161		reason="$needksh"
162	;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166	changesh=true
167	reason="$avoidksh"
168	;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
172		cat <<EOM
173(I see you are using the Korn shell.  Some ksh's blow up on $me,
174mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175EOM
176	;;
177esac
178case "$changesh" in
179true)
180	export newsh
181	echo "(Feeding myself to $newsh $reason.)"
182	case "$0" in
183	Configure|*/Configure) exec $newsh $0 "$@";;
184	*) exec $newsh Configure "$@";;
185	esac
186	;;
187esac
188test -x "${newsh}" || unset newsh
189
190: if needed, set CDPATH to a harmless value that is not chatty
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'')	;;
194*)	case "$SHELL" in
195	*bash*) CDPATH='.' ;;
196	*) CDPATH='' ;;
197	esac
198	;;
199esac
200
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
203cd UU && rm -f ./*
204
205ccname=''
206ccversion=''
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
210from=''
211run=''
212targetarch=''
213to=''
214usecrosscompile=''
215extern_C=''
216mistrustnm=''
217usedevel=''
218perllibs=''
219dynamic_ext=''
220extensions=''
221known_extensions=''
222nonxs_ext=''
223static_ext=''
224useopcode=''
225useposix=''
226extras=''
227d_bsd=''
228d_eunice=''
229d_xenix=''
230eunicefix=''
231ar=''
232awk=''
233bash=''
234bison=''
235byacc=''
236cat=''
237chgrp=''
238chmod=''
239chown=''
240comm=''
241compress=''
242cp=''
243cpio=''
244cpp=''
245csh=''
246date=''
247echo=''
248egrep=''
249emacs=''
250expr=''
251find=''
252flex=''
253gmake=''
254grep=''
255gzip=''
256inews=''
257ksh=''
258less=''
259line=''
260lint=''
261ln=''
262lp=''
263lpr=''
264ls=''
265mail=''
266mailx=''
267make=''
268mkdir=''
269more=''
270mv=''
271nm=''
272nroff=''
273perl=''
274pg=''
275pmake=''
276pr=''
277rm=''
278rmail=''
279sed=''
280sendmail=''
281shar=''
282sleep=''
283smail=''
284sort=''
285submit=''
286tail=''
287tar=''
288tbl=''
289tee=''
290test=''
291touch=''
292tr=''
293troff=''
294uname=''
295uniq=''
296uuname=''
297vi=''
298zcat=''
299zip=''
300full_ar=''
301full_sed=''
302libswanted=''
303hint=''
304myuname=''
305osname=''
306osvers=''
307Author=''
308Date=''
309Header=''
310Id=''
311Locker=''
312Log=''
313RCSfile=''
314Revision=''
315Source=''
316State=''
317_a=''
318_exe=''
319_o=''
320archobjs=''
321exe_ext=''
322firstmakefile=''
323lib_ext=''
324obj_ext=''
325path_sep=''
326rm_try=''
327afs=''
328afsroot=''
329alignbytes=''
330ansi2knr=''
331archlib=''
332archlibexp=''
333d_archlib=''
334installarchlib=''
335archname=''
336myarchname=''
337d_atolf=''
338d_atoll=''
339baserev=''
340bin=''
341binexp=''
342initialinstalllocation=''
343installbin=''
344userelocatableinc=''
345byteorder=''
346cc=''
347ccflags=''
348cppflags=''
349ldflags=''
350lkflags=''
351locincpth=''
352optimize=''
353cf_email=''
354cf_by=''
355cf_time=''
356charbits=''
357charsize=''
358contains=''
359cpp_stuff=''
360cpplast=''
361cppminus=''
362cpprun=''
363cppstdin=''
364d__fwalk=''
365d_access=''
366d_accessx=''
367d_aintl=''
368d_alarm=''
369asctime_r_proto=''
370d_asctime_r=''
371d_attribute_deprecated=''
372d_attribute_format=''
373d_attribute_malloc=''
374d_attribute_nonnull=''
375d_attribute_noreturn=''
376d_attribute_pure=''
377d_attribute_unused=''
378d_attribute_warn_unused_result=''
379d_printf_format_null=''
380d_bcmp=''
381d_bcopy=''
382d_builtin_choose_expr=''
383d_builtin_expect=''
384d_bzero=''
385d_c99_variadic_macros=''
386d_casti32=''
387castflags=''
388d_castneg=''
389d_chown=''
390d_chroot=''
391d_chsize=''
392d_class=''
393d_clearenv=''
394d_closedir=''
395d_void_closedir=''
396d_cmsghdr_s=''
397d_const=''
398d_copysignl=''
399d_cplusplus=''
400cryptlib=''
401d_crypt=''
402crypt_r_proto=''
403d_crypt_r=''
404d_csh=''
405full_csh=''
406d_ctermid=''
407ctermid_r_proto=''
408d_ctermid_r=''
409ctime_r_proto=''
410d_ctime_r=''
411d_cuserid=''
412d_dbl_dig=''
413d_dbminitproto=''
414d_difftime=''
415d_dir_dd_fd=''
416d_dirfd=''
417d_dlerror=''
418d_dlopen=''
419d_dlsymun=''
420d_dosuid=''
421d_suidsafe=''
422d_drand48_r=''
423drand48_r_proto=''
424d_drand48proto=''
425d_dup2=''
426d_eaccess=''
427d_endgrent=''
428d_endgrent_r=''
429endgrent_r_proto=''
430d_endhent=''
431d_endhostent_r=''
432endhostent_r_proto=''
433d_endnent=''
434d_endnetent_r=''
435endnetent_r_proto=''
436d_endpent=''
437d_endprotoent_r=''
438endprotoent_r_proto=''
439d_endpwent=''
440d_endpwent_r=''
441endpwent_r_proto=''
442d_endsent=''
443d_endservent_r=''
444endservent_r_proto=''
445d_faststdio=''
446d_fchdir=''
447d_fchmod=''
448d_fchown=''
449d_fcntl=''
450d_fcntl_can_lock=''
451d_fd_macros=''
452d_fd_set=''
453d_fds_bits=''
454d_fgetpos=''
455d_finite=''
456d_finitel=''
457d_flexfnam=''
458d_flock=''
459d_flockproto=''
460d_fork=''
461d_fp_class=''
462d_fpclass=''
463d_fpclassify=''
464d_fpclassl=''
465d_fpos64_t=''
466d_frexpl=''
467d_fs_data_s=''
468d_fseeko=''
469d_fsetpos=''
470d_fstatfs=''
471d_fsync=''
472d_ftello=''
473d_ftime=''
474d_gettimeod=''
475d_futimes=''
476d_Gconvert=''
477d_getaddrinfo=''
478d_getcwd=''
479d_getespwnam=''
480d_getfsstat=''
481d_getgrent=''
482d_getgrent_r=''
483getgrent_r_proto=''
484d_getgrgid_r=''
485getgrgid_r_proto=''
486d_getgrnam_r=''
487getgrnam_r_proto=''
488d_getgrps=''
489d_gethbyaddr=''
490d_gethbyname=''
491d_gethent=''
492aphostname=''
493d_gethname=''
494d_phostname=''
495d_uname=''
496d_gethostbyaddr_r=''
497gethostbyaddr_r_proto=''
498d_gethostbyname_r=''
499gethostbyname_r_proto=''
500d_gethostent_r=''
501gethostent_r_proto=''
502d_gethostprotos=''
503d_getitimer=''
504d_getlogin=''
505d_getlogin_r=''
506getlogin_r_proto=''
507d_getmnt=''
508d_getmntent=''
509d_getnameinfo=''
510d_getnbyaddr=''
511d_getnbyname=''
512d_getnent=''
513d_getnetbyaddr_r=''
514getnetbyaddr_r_proto=''
515d_getnetbyname_r=''
516getnetbyname_r_proto=''
517d_getnetent_r=''
518getnetent_r_proto=''
519d_getnetprotos=''
520d_getpagsz=''
521d_getpent=''
522d_getpgid=''
523d_getpgrp2=''
524d_bsdgetpgrp=''
525d_getpgrp=''
526d_getppid=''
527d_getprior=''
528d_getpbyname=''
529d_getpbynumber=''
530d_getprotobyname_r=''
531getprotobyname_r_proto=''
532d_getprotobynumber_r=''
533getprotobynumber_r_proto=''
534d_getprotoent_r=''
535getprotoent_r_proto=''
536d_getprotoprotos=''
537d_getprpwnam=''
538d_getpwent=''
539d_getpwent_r=''
540getpwent_r_proto=''
541d_getpwnam_r=''
542getpwnam_r_proto=''
543d_getpwuid_r=''
544getpwuid_r_proto=''
545d_getsent=''
546d_getservbyname_r=''
547getservbyname_r_proto=''
548d_getservbyport_r=''
549getservbyport_r_proto=''
550d_getservent_r=''
551getservent_r_proto=''
552d_getservprotos=''
553d_getspnam=''
554d_getspnam_r=''
555getspnam_r_proto=''
556d_getsbyname=''
557d_getsbyport=''
558d_gmtime_r=''
559gmtime_r_proto=''
560d_gnulibc=''
561gnulibc_version=''
562d_hasmntopt=''
563d_htonl=''
564d_ilogbl=''
565d_inetaton=''
566d_inetntop=''
567d_inetpton=''
568d_int64_t=''
569d_isascii=''
570d_isfinite=''
571d_isinf=''
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
577d_libm_lib_version=''
578d_link=''
579d_localtime_r=''
580d_localtime_r_needs_tzset=''
581localtime_r_proto=''
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
591d_malloc_good_size=''
592d_malloc_size=''
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
610d_modfl_pow32_bug=''
611d_modflproto=''
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
616d_msghdr_s=''
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
622d_nl_langinfo=''
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
630d_portable=''
631d_procselfexe=''
632procselfexe=''
633d_old_pthread_create_joinable=''
634old_pthread_create_joinable=''
635d_pthread_atfork=''
636d_pthread_attr_setscope=''
637d_pthread_yield=''
638d_sched_yield=''
639sched_yield=''
640d_qgcvt=''
641d_random_r=''
642random_r_proto=''
643d_readdir64_r=''
644readdir64_r_proto=''
645d_readdir=''
646d_rewinddir=''
647d_seekdir=''
648d_telldir=''
649d_readdir_r=''
650readdir_r_proto=''
651d_readlink=''
652d_readv=''
653d_recvmsg=''
654d_rename=''
655d_rmdir=''
656d_safebcpy=''
657d_safemcpy=''
658d_sanemcmp=''
659d_sbrkproto=''
660d_scalbnl=''
661d_select=''
662d_sem=''
663d_semctl=''
664d_semget=''
665d_semop=''
666d_sendmsg=''
667d_setegid=''
668d_seteuid=''
669d_setgrent=''
670d_setgrent_r=''
671setgrent_r_proto=''
672d_setgrps=''
673d_sethent=''
674d_sethostent_r=''
675sethostent_r_proto=''
676d_setitimer=''
677d_setlinebuf=''
678d_setlocale=''
679d_setlocale_r=''
680setlocale_r_proto=''
681d_setnent=''
682d_setnetent_r=''
683setnetent_r_proto=''
684d_setpent=''
685d_setpgid=''
686d_setpgrp2=''
687d_bsdsetpgrp=''
688d_setpgrp=''
689d_setprior=''
690d_setproctitle=''
691d_setprotoent_r=''
692setprotoent_r_proto=''
693d_setpwent=''
694d_setpwent_r=''
695setpwent_r_proto=''
696d_setregid=''
697d_setresgid=''
698d_setresuid=''
699d_setreuid=''
700d_setrgid=''
701d_setruid=''
702d_setsent=''
703d_setservent_r=''
704setservent_r_proto=''
705d_setsid=''
706d_setvbuf=''
707d_sfio=''
708usesfio=''
709d_shm=''
710d_shmat=''
711d_shmatprototype=''
712shmattype=''
713d_shmctl=''
714d_shmdt=''
715d_shmget=''
716d_sigaction=''
717d_signbit=''
718d_sigprocmask=''
719d_sigsetjmp=''
720usesitecustomize=''
721d_snprintf=''
722d_vsnprintf=''
723d_sockatmark=''
724d_sockatmarkproto=''
725d_msg_ctrunc=''
726d_msg_dontroute=''
727d_msg_oob=''
728d_msg_peek=''
729d_msg_proxy=''
730d_oldsock=''
731d_scm_rights=''
732d_socket=''
733d_sockpair=''
734sockethdr=''
735socketlib=''
736d_socklen_t=''
737d_socks5_init=''
738d_sprintf_returns_strlen=''
739d_sqrtl=''
740d_srand48_r=''
741srand48_r_proto=''
742d_srandom_r=''
743srandom_r_proto=''
744d_sresgproto=''
745d_sresuproto=''
746d_statblks=''
747d_statfs_f_flags=''
748d_statfs_s=''
749d_fstatvfs=''
750d_statvfs=''
751d_stdio_cnt_lval=''
752d_stdio_ptr_lval=''
753d_stdio_ptr_lval_nochange_cnt=''
754d_stdio_ptr_lval_sets_cnt=''
755d_stdiobase=''
756d_stdstdio=''
757stdio_base=''
758stdio_bufsiz=''
759stdio_cnt=''
760stdio_filbuf=''
761stdio_ptr=''
762d_index=''
763d_strchr=''
764d_strcoll=''
765d_strctcpy=''
766d_strerrm=''
767d_strerror=''
768d_sysernlst=''
769d_syserrlst=''
770d_strerror_r=''
771strerror_r_proto=''
772d_strftime=''
773d_strlcat=''
774d_strlcpy=''
775d_strtod=''
776d_strtol=''
777d_strtold=''
778d_strtoll=''
779d_strtoq=''
780d_strtoul=''
781d_strtoull=''
782d_strtouq=''
783d_strxfrm=''
784d_symlink=''
785d_syscall=''
786d_syscallproto=''
787d_sysconf=''
788d_system=''
789d_tcgetpgrp=''
790d_tcsetpgrp=''
791d_telldirproto=''
792d_time=''
793timetype=''
794d_asctime64=''
795d_ctime64=''
796d_difftime64=''
797d_gmtime64=''
798d_localtime64=''
799d_mktime64=''
800d_timegm=''
801clocktype=''
802d_times=''
803d_tmpnam_r=''
804tmpnam_r_proto=''
805d_truncate=''
806d_ttyname_r=''
807ttyname_r_proto=''
808d_tzname=''
809d_u32align=''
810d_ualarm=''
811d_umask=''
812d_semctl_semid_ds=''
813d_semctl_semun=''
814d_union_semun=''
815d_unordered=''
816d_unsetenv=''
817d_usleep=''
818d_usleepproto=''
819d_ustat=''
820d_pseudofork=''
821d_vfork=''
822usevfork=''
823d_voidsig=''
824signal_t=''
825d_volatile=''
826d_charvspr=''
827d_vprintf=''
828d_wait4=''
829d_waitpid=''
830d_wcstombs=''
831d_wctomb=''
832d_writev=''
833dlext=''
834bin_ELF=''
835cccdlflags=''
836ccdlflags=''
837dlsrc=''
838ld=''
839lddlflags=''
840usedl=''
841doublesize=''
842ebcdic=''
843fflushNULL=''
844fflushall=''
845fpossize=''
846fpostype=''
847gccansipedantic=''
848gccosandvers=''
849gccversion=''
850gidformat=''
851gidsign=''
852gidsize=''
853gidtype=''
854groupstype=''
855h_fcntl=''
856h_sysfile=''
857html1dir=''
858html1direxp=''
859installhtml1dir=''
860html3dir=''
861html3direxp=''
862installhtml3dir=''
863i_arpainet=''
864i_assert=''
865i_crypt=''
866db_hashtype=''
867db_prefixtype=''
868db_version_major=''
869db_version_minor=''
870db_version_patch=''
871i_db=''
872i_dbm=''
873i_rpcsvcdbm=''
874d_dirnamlen=''
875direntrytype=''
876i_dirent=''
877i_dld=''
878i_dlfcn=''
879i_fcntl=''
880i_float=''
881i_fp=''
882i_fp_class=''
883i_gdbm=''
884d_grpasswd=''
885i_grp=''
886i_ieeefp=''
887i_inttypes=''
888i_langinfo=''
889i_libutil=''
890i_limits=''
891i_locale=''
892i_machcthr=''
893i_malloc=''
894i_mallocmalloc=''
895i_math=''
896i_memory=''
897i_mntent=''
898d_gdbm_ndbm_h_uses_prototypes=''
899d_gdbmndbm_h_uses_prototypes=''
900d_ndbm=''
901d_ndbm_h_uses_prototypes=''
902i_gdbm_ndbm=''
903i_gdbmndbm=''
904i_ndbm=''
905i_netdb=''
906i_neterrno=''
907i_netinettcp=''
908i_niin=''
909i_sysin=''
910i_poll=''
911i_prot=''
912i_pthread=''
913d_pwage=''
914d_pwchange=''
915d_pwclass=''
916d_pwcomment=''
917d_pwexpire=''
918d_pwgecos=''
919d_pwpasswd=''
920d_pwquota=''
921i_pwd=''
922i_sfio=''
923i_shadow=''
924i_socks=''
925i_stddef=''
926i_stdlib=''
927i_string=''
928strings=''
929i_sunmath=''
930i_sysaccess=''
931i_sysdir=''
932i_sysfile=''
933d_voidtty=''
934i_bsdioctl=''
935i_sysfilio=''
936i_sysioctl=''
937i_syssockio=''
938i_syslog=''
939i_sysmman=''
940i_sysmode=''
941i_sysmount=''
942i_sysndir=''
943i_sysparam=''
944i_syspoll=''
945i_sysresrc=''
946i_syssecrt=''
947i_sysselct=''
948i_sysstat=''
949i_sysstatfs=''
950i_sysstatvfs=''
951i_systimes=''
952i_systypes=''
953i_sysuio=''
954i_sysun=''
955i_sysutsname=''
956i_sysvfs=''
957i_syswait=''
958i_sgtty=''
959i_termio=''
960i_termios=''
961d_tm_tm_gmtoff=''
962d_tm_tm_zone=''
963i_systime=''
964i_systimek=''
965i_time=''
966timeincl=''
967i_unistd=''
968i_ustat=''
969i_utime=''
970i_values=''
971i_stdarg=''
972i_varargs=''
973i_varhdr=''
974i_vfork=''
975d_inc_version_list=''
976inc_version_list=''
977inc_version_list_init=''
978installprefix=''
979installprefixexp=''
980installstyle=''
981installusrbinperl=''
982intsize=''
983longsize=''
984shortsize=''
985issymlink=''
986libc=''
987ldlibpthname=''
988libperl=''
989shrpenv=''
990useshrplib=''
991glibpth=''
992libpth=''
993loclibpth=''
994plibpth=''
995xlibpth=''
996ignore_versioned_solibs=''
997libs=''
998libsdirs=''
999libsfiles=''
1000libsfound=''
1001libspath=''
1002lns=''
1003d_PRIEUldbl=''
1004d_PRIFUldbl=''
1005d_PRIGUldbl=''
1006d_PRIeldbl=''
1007d_PRIfldbl=''
1008d_PRIgldbl=''
1009d_SCNfldbl=''
1010sPRIEUldbl=''
1011sPRIFUldbl=''
1012sPRIGUldbl=''
1013sPRIeldbl=''
1014sPRIfldbl=''
1015sPRIgldbl=''
1016sSCNfldbl=''
1017lseeksize=''
1018lseektype=''
1019mad=''
1020madlyh=''
1021madlyobj=''
1022madlysrc=''
1023make_set_make=''
1024d_mymalloc=''
1025freetype=''
1026mallocobj=''
1027mallocsrc=''
1028malloctype=''
1029usemallocwrap=''
1030usemymalloc=''
1031installman1dir=''
1032man1dir=''
1033man1direxp=''
1034man1ext=''
1035installman3dir=''
1036man3dir=''
1037man3direxp=''
1038man3ext=''
1039modetype=''
1040multiarch=''
1041mydomain=''
1042myhostname=''
1043phostname=''
1044c=''
1045n=''
1046d_eofnblk=''
1047eagain=''
1048o_nonblock=''
1049rd_nodata=''
1050need_va_copy=''
1051netdb_hlen_type=''
1052netdb_host_type=''
1053netdb_name_type=''
1054netdb_net_type=''
1055groupcat=''
1056hostcat=''
1057passcat=''
1058orderlib=''
1059ranlib=''
1060d_perl_otherlibdirs=''
1061otherlibdirs=''
1062package=''
1063spackage=''
1064pager=''
1065api_revision=''
1066api_subversion=''
1067api_version=''
1068api_versionstring=''
1069patchlevel=''
1070perl_patchlevel=''
1071revision=''
1072subversion=''
1073version=''
1074version_patchlevel_string=''
1075perl5=''
1076perladmin=''
1077perlpath=''
1078d_nv_preserves_uv=''
1079d_nv_zero_is_allbits_zero=''
1080i16size=''
1081i16type=''
1082i32size=''
1083i32type=''
1084i64size=''
1085i64type=''
1086i8size=''
1087i8type=''
1088ivsize=''
1089ivtype=''
1090nv_overflows_integers_at=''
1091nv_preserves_uv_bits=''
1092nvsize=''
1093nvtype=''
1094u16size=''
1095u16type=''
1096u32size=''
1097u32type=''
1098u64size=''
1099u64type=''
1100u8size=''
1101u8type=''
1102uvsize=''
1103uvtype=''
1104ivdformat=''
1105nvEUformat=''
1106nvFUformat=''
1107nvGUformat=''
1108nveformat=''
1109nvfformat=''
1110nvgformat=''
1111uvXUformat=''
1112uvoformat=''
1113uvuformat=''
1114uvxformat=''
1115pidtype=''
1116prefix=''
1117prefixexp=''
1118installprivlib=''
1119privlib=''
1120privlibexp=''
1121prototype=''
1122ptrsize=''
1123d_PRIXU64=''
1124d_PRId64=''
1125d_PRIi64=''
1126d_PRIo64=''
1127d_PRIu64=''
1128d_PRIx64=''
1129sPRIXU64=''
1130sPRId64=''
1131sPRIi64=''
1132sPRIo64=''
1133sPRIu64=''
1134sPRIx64=''
1135d_quad=''
1136quadkind=''
1137quadtype=''
1138uquadtype=''
1139drand01=''
1140randbits=''
1141randfunc=''
1142randseedtype=''
1143seedfunc=''
1144installscript=''
1145scriptdir=''
1146scriptdirexp=''
1147selectminbits=''
1148selecttype=''
1149sh=''
1150sig_count=''
1151sig_name=''
1152sig_name_init=''
1153sig_num=''
1154sig_num_init=''
1155sig_size=''
1156d_sitearch=''
1157installsitearch=''
1158sitearch=''
1159sitearchexp=''
1160installsitebin=''
1161sitebin=''
1162sitebinexp=''
1163installsitehtml1dir=''
1164sitehtml1dir=''
1165sitehtml1direxp=''
1166installsitehtml3dir=''
1167sitehtml3dir=''
1168sitehtml3direxp=''
1169installsitelib=''
1170sitelib=''
1171sitelib_stem=''
1172sitelibexp=''
1173installsiteman1dir=''
1174siteman1dir=''
1175siteman1direxp=''
1176installsiteman3dir=''
1177siteman3dir=''
1178siteman3direxp=''
1179siteprefix=''
1180siteprefixexp=''
1181installsitescript=''
1182sitescript=''
1183sitescriptexp=''
1184sizesize=''
1185sizetype=''
1186so=''
1187socksizetype=''
1188sharpbang=''
1189shsharp=''
1190spitshell=''
1191src=''
1192ssizetype=''
1193startperl=''
1194startsh=''
1195stdchar=''
1196d_stdio_stream_array=''
1197stdio_stream_array=''
1198sysman=''
1199sGMTIME_max=''
1200sGMTIME_min=''
1201sLOCALTIME_max=''
1202sLOCALTIME_min=''
1203trnl=''
1204uidformat=''
1205uidsign=''
1206uidsize=''
1207uidtype=''
1208archname64=''
1209use64bitall=''
1210use64bitint=''
1211dtrace=''
1212usedtrace=''
1213usefaststdio=''
1214ccflags_uselargefiles=''
1215ldflags_uselargefiles=''
1216libswanted_uselargefiles=''
1217uselargefiles=''
1218uselongdouble=''
1219usemorebits=''
1220usemultiplicity=''
1221nm_opt=''
1222nm_so_opt=''
1223runnm=''
1224usenm=''
1225useperlio=''
1226usesocks=''
1227d_oldpthreads=''
1228use5005threads=''
1229useithreads=''
1230usereentrant=''
1231usethreads=''
1232incpath=''
1233mips_type=''
1234usrinc=''
1235vaproto=''
1236d_vendorarch=''
1237installvendorarch=''
1238vendorarch=''
1239vendorarchexp=''
1240d_vendorbin=''
1241installvendorbin=''
1242vendorbin=''
1243vendorbinexp=''
1244installvendorhtml1dir=''
1245vendorhtml1dir=''
1246vendorhtml1direxp=''
1247installvendorhtml3dir=''
1248vendorhtml3dir=''
1249vendorhtml3direxp=''
1250d_vendorlib=''
1251installvendorlib=''
1252vendorlib=''
1253vendorlib_stem=''
1254vendorlibexp=''
1255installvendorman1dir=''
1256vendorman1dir=''
1257vendorman1direxp=''
1258installvendorman3dir=''
1259vendorman3dir=''
1260vendorman3direxp=''
1261usevendorprefix=''
1262vendorprefix=''
1263vendorprefixexp=''
1264d_vendorscript=''
1265installvendorscript=''
1266vendorscript=''
1267vendorscriptexp=''
1268versiononly=''
1269defvoidused=''
1270voidflags=''
1271yacc=''
1272yaccflags=''
1273CONFIG=''
1274
1275: Detect odd OSs
1276define='define'
1277undef='undef'
1278smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1279rmlist=''
1280
1281: We must find out about Eunice early
1282eunicefix=':'
1283if test -f /etc/unixtovms; then
1284	eunicefix=/etc/unixtovms
1285fi
1286if test -f /etc/unixtovms.exe; then
1287	eunicefix=/etc/unixtovms.exe
1288fi
1289
1290: Set executable suffix now -- needed before hints available
1291if test -f "/libs/version.library"; then
1292: Amiga OS
1293    _exe=""
1294elif test -f "/system/gnu_library/bin/ar.pm"; then
1295: Stratus VOS
1296    _exe=".pm"
1297elif test -n "$DJGPP"; then
1298: DOS DJGPP
1299    _exe=".exe"
1300elif test -d c:/. -o -n "$is_os2" ; then
1301: OS/2 or cygwin
1302    _exe=".exe"
1303fi
1304
1305groupstype=''
1306i_whoami=''
1307: Trailing extension.  Override this in a hint file, if needed.
1308: Extra object files, if any, needed on this platform.
1309archobjs=''
1310archname=''
1311libnames=''
1312: change the next line if compiling for Xenix/286 on Xenix/386
1313xlibpth='/usr/lib/386 /lib/386'
1314: Possible local library directories to search.
1315loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1316loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1317
1318: general looking path for locating libraries
1319glibpth="/lib /usr/lib $xlibpth"
1320glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1321test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1322test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1323test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1324
1325: Private path used by Configure to find libraries.  Its value
1326: is prepended to libpth. This variable takes care of special
1327: machines, like the mips.  Usually, it should be empty.
1328plibpth=''
1329
1330: default library list
1331libswanted=''
1332: some systems want to use only the non-versioned libso:s
1333ignore_versioned_solibs=''
1334: set usethreads on the Configure command line to enable threads.
1335usereentrant='undef'
1336: full support for void wanted by default
1337defvoidused=15
1338
1339: Possible local include directories to search.
1340: Set locincpth to "" in a hint file to defeat local include searches.
1341locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343:
1344: no include file wanted by default
1345inclwanted=''
1346
1347: Enable -DEBUGGING and -DDEBUGGING from the command line
1348EBUGGING=''
1349DEBUGGING=old
1350
1351ccname=''
1352ccversion=''
1353perllibs=''
1354: set useposix=false in your hint file to disable the POSIX extension.
1355useposix=true
1356: set useopcode=false in your hint file to disable the Opcode extension.
1357useopcode=true
1358archname64=''
1359ccflags_uselargefiles=''
1360ldflags_uselargefiles=''
1361libswanted_uselargefiles=''
1362: set usemultiplicity on the Configure command line to enable multiplicity.
1363: set usesocks on the Configure command line to enable socks.
1364: List of libraries we want.
1365: If anyone needs extra -lxxx, put those in a hint file.
1366libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1367libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1368: We probably want to search /usr/shlib before most other libraries.
1369: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1370glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1371glibpth="/usr/shlib $glibpth"
1372: Do not use vfork unless overridden by a hint file.
1373usevfork=false
1374
1375: Find the basic shell for Bourne shell scripts
1376case "$sh" in
1377'')
1378	case "$SYSTYPE" in
1379	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1380	*) xxx='/bin/sh';;
1381	esac
1382	if test -f "$xxx"; then
1383		sh="$xxx"
1384	else
1385		: Build up a list and do a single loop so we can 'break' out.
1386		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1387		for xxx in sh bash ksh pdksh ash; do
1388			for p in $pth; do
1389				try="$try ${p}/${xxx}"
1390			done
1391		done
1392		for xxx in $try; do
1393			if test -f "$xxx"; then
1394				sh="$xxx";
1395				break
1396			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1397				sh="$xxx";
1398				break
1399			elif test -f "$xxx.exe"; then
1400				sh="$xxx";
1401				break
1402			fi
1403		done
1404	fi
1405	;;
1406esac
1407
1408case "$sh" in
1409'')	cat >&2 <<EOM
1410$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1411
1412Usually it's in /bin/sh.  How did you even get this far?
1413Please contact me (Perl Maintainers) at perlbug@perl.org and 
1414we'll try to straighten this all out.
1415EOM
1416	exit 1
1417	;;
1418esac
1419
1420: see if sh knows # comments
1421if `$sh -c '#' >/dev/null 2>&1`; then
1422	shsharp=true
1423	spitshell=cat
1424	xcat=/bin/cat
1425	test -f $xcat$_exe || xcat=/usr/bin/cat
1426	if test ! -f $xcat$_exe; then
1427		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1428			if test -f $p/cat$_exe; then
1429				xcat=$p/cat
1430				break
1431			fi
1432		done
1433		if test ! -f $xcat$_exe; then
1434			echo "Can't find cat anywhere!"
1435			exit 1
1436		fi
1437	fi
1438	echo "#!$xcat" >sharp
1439	$eunicefix sharp
1440	chmod +x sharp
1441	./sharp > today 2>/dev/null
1442	if test -s today; then
1443		sharpbang='#!'
1444	else
1445		echo "#! $xcat" > sharp
1446		$eunicefix sharp
1447		chmod +x sharp
1448		./sharp > today 2>/dev/null
1449		if test -s today; then
1450			sharpbang='#! '
1451		else
1452			sharpbang=': use '
1453		fi
1454	fi
1455else
1456	echo " "
1457	echo "Your $sh doesn't grok # comments--I will strip them later on."
1458	shsharp=false
1459	cd ..
1460	echo "exec grep -v '^[ 	]*#'" >spitshell
1461	chmod +x spitshell
1462	$eunicefix spitshell
1463	spitshell=`pwd`/spitshell
1464	cd UU
1465	echo "I presume that if # doesn't work, #! won't work either!"
1466	sharpbang=': use '
1467fi
1468rm -f sharp today
1469
1470: figure out how to guarantee sh startup
1471case "$startsh" in
1472'') startsh=${sharpbang}${sh} ;;
1473*)
1474esac
1475cat >sharp <<EOSS
1476$startsh
1477set abc
1478test "$?abc" != 1
1479EOSS
1480
1481chmod +x sharp
1482$eunicefix sharp
1483if ./sharp; then
1484	: echo "Yup, it does."
1485else
1486	echo "Hmm... '$startsh' does not guarantee sh startup..."
1487	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1488fi
1489rm -f sharp
1490
1491: Save command line options in file UU/cmdline.opt for later use in
1492: generating config.sh.
1493cat > cmdline.opt <<EOSH
1494: Configure command line arguments.
1495config_arg0='$0'
1496config_args='$*'
1497config_argc=$#
1498EOSH
1499argn=1
1500args_exp=''
1501args_sep=''
1502for arg in "$@"; do
1503	cat >>cmdline.opt <<EOSH
1504config_arg$argn='$arg'
1505EOSH
1506	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1507$arg
1508EOC
1509	arg_exp=`cat cmdl.opt`
1510	args_exp="$args_exp$args_sep'$arg_exp'"
1511	argn=`expr $argn + 1`
1512	args_sep=' '
1513done
1514rm -f cmdl.opt
1515
1516: produce awk script to parse command line options
1517cat >options.awk <<'EOF'
1518BEGIN {
1519	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1520
1521	len = length(optstr);
1522	for (i = 1; i <= len; i++) {
1523		c = substr(optstr, i, 1);
1524		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1525		if (a == ":") {
1526			arg[c] = 1;
1527			i++;
1528		}
1529		opt[c] = 1;
1530	}
1531}
1532{
1533	expect = 0;
1534	str = $0;
1535	if (substr(str, 1, 1) != "-") {
1536		printf("'%s'\n", str);
1537		next;
1538	}
1539	len = length($0);
1540	for (i = 2; i <= len; i++) {
1541		c = substr(str, i, 1);
1542		if (!opt[c]) {
1543			printf("-%s\n", substr(str, i));
1544			next;
1545		}
1546		printf("-%s\n", c);
1547		if (arg[c]) {
1548			if (i < len)
1549				printf("'%s'\n", substr(str, i + 1));
1550			else
1551				expect = 1;
1552			next;
1553		}
1554	}
1555}
1556END {
1557	if (expect)
1558		print "?";
1559}
1560EOF
1561
1562: process the command line options
1563set X `for arg in "$@"; do echo "X$arg"; done |
1564	sed -e s/X// | awk -f options.awk`
1565eval "set $*"
1566shift
1567rm -f options.awk
1568
1569: set up default values
1570fastread=''
1571reuseval=false
1572config_sh=''
1573alldone=''
1574error=''
1575silent=''
1576extractsh=''
1577override=''
1578knowitall=''
1579rm -f optdef.sh posthint.sh
1580cat >optdef.sh <<EOS
1581$startsh
1582EOS
1583
1584
1585: option parsing
1586while test $# -gt 0; do
1587	case "$1" in
1588	-d) shift; fastread=yes;;
1589	-e) shift; alldone=cont;;
1590	-f)
1591		shift
1592		cd ..
1593		if test -r "$1"; then
1594			config_sh="$1"
1595		else
1596			echo "$me: cannot read config file $1." >&2
1597			error=true
1598		fi
1599		cd UU
1600		shift;;
1601	--help|\
1602	-h) shift; error=true;;
1603	-r) shift; reuseval=true;;
1604	-s) shift; silent=true; realsilent=true;;
1605	-E) shift; alldone=exit;;
1606	-K) shift; knowitall=true;;
1607	-O) shift; override=true;;
1608	-S) shift; silent=true; extractsh=true;;
1609	-D)
1610		shift
1611		case "$1" in
1612		*=)
1613			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1614			echo "$me: ignoring -D $1" >&2
1615			;;
1616		*=*) echo "$1" | \
1617				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1618		*) echo "$1='define'" >> optdef.sh;;
1619		esac
1620		shift
1621		;;
1622	-U)
1623		shift
1624		case "$1" in
1625		*=) echo "$1" >> optdef.sh;;
1626		*=*)
1627			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1628			echo "$me: ignoring -U $1" >&2
1629			;;
1630		*) echo "$1='undef'" >> optdef.sh;;
1631		esac
1632		shift
1633		;;
1634	-A)
1635	    shift
1636	    xxx=''
1637	    yyy="$1"
1638	    zzz=''
1639	    uuu=undef
1640	    case "$yyy" in
1641            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1642                 case "$zzz" in
1643                 *:*) zzz='' ;;
1644                 *)   xxx=append
1645                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                 esac
1648                 ;;
1649            esac
1650            case "$xxx" in
1651            '')  case "$yyy" in
1652                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1653                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1654                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1655                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1658                 esac
1659                 ;;
1660            esac
1661	    case "$xxx" in
1662	    append)
1663		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1664	    clear)
1665		echo "$yyy=''"			>> posthint.sh ;;
1666	    define)
1667	        case "$zzz" in
1668		'') zzz=define ;;
1669		esac
1670		echo "$yyy='$zzz'"		>> posthint.sh ;;
1671	    eval)
1672		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1673	    prepend)
1674		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1675	    undef)
1676	        case "$zzz" in
1677		'') zzz="$uuu" ;;
1678		esac
1679		echo "$yyy=$zzz"		>> posthint.sh ;;
1680            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1681	    esac
1682	    shift
1683	    ;;
1684	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1685	    exit 0;;
1686	--) break;;
1687	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1688	*) break;;
1689	esac
1690done
1691
1692case "$error" in
1693true)
1694	cat >&2 <<EOM
1695Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1696                 [-U symbol] [-U symbol=] [-A command:symbol...]
1697  -d : use defaults for all answers.
1698  -e : go on without questioning past the production of config.sh.
1699  -f : specify an alternate default configuration file.
1700  -h : print this help message and exit (with an error status).
1701  -r : reuse C symbols value if possible (skips costly nm extraction).
1702  -s : silent mode, only echoes questions and essential information.
1703  -D : define symbol to have some value:
1704         -D symbol         symbol gets the value 'define'
1705         -D symbol=value   symbol gets the value 'value'
1706       common used examples (see INSTALL for more info):
1707         -Duse64bitint            use 64bit integers
1708         -Duse64bitall            use 64bit integers and pointers
1709         -Dusethreads             use thread support
1710         -Dinc_version_list=none  do not include older perl trees in @INC
1711         -DEBUGGING=none          DEBUGGING options
1712         -Dcc=gcc                 choose your compiler
1713         -Dprefix=/opt/perl5      choose your destination
1714  -E : stop at the end of questions, after having produced config.sh.
1715  -K : do not use unless you know what you are doing.
1716  -O : let -D and -U override definitions from loaded configuration file.
1717  -S : perform variable substitutions on all .SH files (can mix with -f)
1718  -U : undefine symbol:
1719         -U symbol    symbol gets the value 'undef'
1720         -U symbol=   symbol gets completely empty
1721       e.g.:  -Uversiononly
1722  -A : manipulate symbol after the platform specific hints have been applied:
1723         -A append:symbol=value   append value to symbol
1724         -A symbol=value          like append:, but with a separating space
1725         -A define:symbol=value   define symbol to have value
1726         -A clear:symbol          define symbol to be ''
1727         -A define:symbol         define symbol to be 'define'
1728         -A eval:symbol=value     define symbol to be eval of value
1729         -A prepend:symbol=value  prepend value to symbol
1730         -A undef:symbol          define symbol to be 'undef'
1731         -A undef:symbol=         define symbol to be ''
1732       e.g.:  -A prepend:libswanted='cl pthread '
1733              -A ccflags=-DSOME_MACRO
1734  -V : print version number and exit (with a zero status).
1735EOM
1736	exit 1
1737	;;
1738esac
1739
1740: Sanity checks
1741case "$fastread$alldone" in
1742yescont|yesexit) ;;
1743*)
1744	case "$extractsh" in
1745	true) ;;
1746	*)
1747		if test ! -t 0; then
1748			echo "Say 'sh Configure', not 'sh <Configure'"
1749			exit 1
1750		fi
1751		;;
1752	esac
1753	;;
1754esac
1755
1756exec 4>&1
1757case "$silent" in
1758true) exec 1>/dev/null;;
1759esac
1760
1761: run the defines and the undefines, if any, but leave the file out there...
1762touch optdef.sh
1763. ./optdef.sh
1764: create the posthint manipulation script and leave the file out there...
1765touch posthint.sh
1766
1767: set package name
1768package='perl5'
1769first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1770last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1771case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1772ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1773*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1774esac
1775
1776: Some greps do not return status, grrr.
1777echo "grimblepritz" >grimble
1778if grep blurfldyick grimble >/dev/null 2>&1 ; then
1779	contains=contains
1780elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1781	contains=grep
1782else
1783	contains=contains
1784fi
1785rm -f grimble
1786: the following should work in any shell
1787case "$contains" in
1788contains*)
1789	echo " "
1790	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1791	cat >contains <<'EOSS'
1792grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1793EOSS
1794chmod +x contains
1795esac
1796
1797: Find the path to the source tree
1798case "$src" in
1799'') case "$0" in
1800    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1801         case "$src" in
1802	 /*)	;;
1803	 .)	;;
1804         *)	src=`cd ../$src && pwd` ;;
1805	 esac
1806         ;;
1807    *)   src='.';;
1808    esac;;
1809esac
1810case "$src" in
1811'')	src=/
1812	rsrc=/
1813	;;
1814/*)	rsrc="$src";;
1815*)	rsrc="../$src";;
1816esac
1817if test -f $rsrc/Configure && \
1818	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1819then
1820   : found it, so we are ok.
1821else
1822	rsrc=''
1823	for src in . .. ../.. ../../.. ../../../..; do
1824		if test -f ../$src/Configure && \
1825			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1826		then
1827			rsrc=../$src
1828			break
1829		fi
1830	done
1831fi
1832case "$rsrc" in
1833'')
1834	cat <<EOM >&4
1835
1836Sorry, I can't seem to locate the source dir for $package.  Please start
1837Configure with an explicit path -- i.e. /some/path/Configure.
1838
1839EOM
1840	exit 1
1841	;;
1842../.)	rsrc='..';;
1843*)
1844	echo " "
1845	echo "Sources for $package found in \"$src\"." >&4
1846	;;
1847esac
1848
1849: script used to extract .SH files with variable substitutions
1850cat >extract <<'EOS'
1851PERL_CONFIG_SH=true
1852echo "Doing variable substitutions on .SH files..."
1853if test -f MANIFEST; then
1854	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1855else
1856	echo "(Looking for .SH files under the source directory.)"
1857	set x `(cd "$src"; find . -name "*.SH" -print)`
1858fi
1859shift
1860case $# in
18610) set x `(cd "$src"; echo *.SH)`; shift;;
1862esac
1863if test ! -f "$src/$1"; then
1864	shift
1865fi
1866mkdir_p='
1867name=$1;
1868create="";
1869while test $name; do
1870	if test ! -d "$name"; then
1871		create="$name $create";
1872		name=`echo $name | sed -e "s|^[^/]*$||"`;
1873		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1874	else
1875		name="";
1876	fi;
1877done;
1878for file in $create; do
1879	mkdir $file;
1880done
1881'
1882for file in $*; do
1883	case "$src" in
1884	".")
1885		case "$file" in
1886		*/*)
1887			dir=`expr X$file : 'X\(.*\)/'`
1888			file=`expr X$file : 'X.*/\(.*\)'`
1889			(cd "$dir" && . ./$file)
1890			;;
1891		*)
1892			. ./$file
1893			;;
1894		esac
1895		;;
1896	*)
1897		case "$file" in
1898		*/*)
1899			dir=`expr X$file : 'X\(.*\)/'`
1900			file=`expr X$file : 'X.*/\(.*\)'`
1901			(set x $dir; shift; eval $mkdir_p)
1902			sh <"$src/$dir/$file"
1903			;;
1904		*)
1905			sh <"$src/$file"
1906			;;
1907		esac
1908		;;
1909	esac
1910done
1911if test -f "$src/config_h.SH"; then
1912	if test ! -f config.h; then
1913	: oops, they left it out of MANIFEST, probably, so do it anyway.
1914	. "$src/config_h.SH"
1915	fi
1916fi
1917EOS
1918
1919: extract files and exit if asked to do so
1920case "$extractsh" in
1921true)
1922	case "$realsilent" in
1923	true) ;;
1924	*) exec 1>&4;;
1925	esac
1926	case "$config_sh" in
1927	'') config_sh='config.sh';;
1928	esac
1929	echo " "
1930	echo "Fetching answers from $config_sh..."
1931	cd ..
1932	. $config_sh
1933	test "$override" && . ./optdef.sh
1934	echo " "
1935	. UU/extract
1936	rm -rf UU
1937	echo "Extraction done."
1938	exit 0
1939	;;
1940esac
1941
1942: Eunice requires " " instead of "", can you believe it
1943echo " "
1944: Here we go...
1945echo "Beginning of configuration questions for $package."
1946
1947trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1948
1949: first determine how to suppress newline on echo command
1950echo " "
1951echo "Checking echo to see how to suppress newlines..."
1952(echo "hi there\c" ; echo " ") >.echotmp
1953if $contains c .echotmp >/dev/null 2>&1 ; then
1954	echo "...using -n."
1955	n='-n'
1956	c=''
1957else
1958	cat <<'EOM'
1959...using \c
1960EOM
1961	n=''
1962	c='\c'
1963fi
1964echo $n "The star should be here-->$c"
1965echo '*'
1966rm -f .echotmp
1967
1968: Now test for existence of everything in MANIFEST
1969echo " "
1970if test -f "$rsrc/MANIFEST"; then
1971	echo "First let's make sure your kit is complete.  Checking..." >&4
1972	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1973		(split -l 50 2>/dev/null || split -50)
1974	rm -f missing
1975	tmppwd=`pwd`
1976	for filelist in x??; do
1977		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1978			>/dev/null 2>>"$tmppwd/missing")
1979	done
1980	if test -s missing; then
1981		cat missing >&4
1982		cat >&4 <<'EOM'
1983
1984THIS PACKAGE SEEMS TO BE INCOMPLETE.
1985
1986You have the option of continuing the configuration process, despite the
1987distinct possibility that your kit is damaged, by typing 'y'es.  If you
1988do, don't blame me if something goes wrong.  I advise you to type 'n'o
1989and contact the author (perlbug@perl.org).
1990
1991EOM
1992		echo $n "Continue? [n] $c" >&4
1993		read ans
1994		case "$ans" in
1995		y*)
1996			echo "Continuing..." >&4
1997			rm -f missing
1998			;;
1999		*)
2000			echo "ABORTING..." >&4
2001			kill $$
2002			;;
2003		esac
2004	else
2005		echo "Looks good..."
2006	fi
2007else
2008	echo "There is no MANIFEST file.  I hope your kit is complete !"
2009fi
2010rm -f missing x??
2011
2012: Find the appropriate value for a newline for tr
2013echo " "
2014if test -n "$DJGPP"; then
2015       trnl='\012'
2016fi
2017if test X"$trnl" = X; then
2018	case "`echo foo|tr '\n' x 2>/dev/null`" in
2019	foox) trnl='\n' ;;
2020	esac
2021fi
2022if test X"$trnl" = X; then
2023	case "`echo foo|tr '\012' x 2>/dev/null`" in
2024	foox) trnl='\012' ;;
2025	esac
2026fi
2027if test X"$trnl" = X; then
2028       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2029       fooxy) trnl='\n\r' ;;
2030       esac
2031fi
2032if test X"$trnl" = X; then
2033	cat <<EOM >&2
2034
2035$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2036
2037EOM
2038	exit 1
2039fi
2040
2041: compute the number of columns on the terminal for proper question formatting
2042case "$COLUMNS" in
2043'') COLUMNS='80';;
2044esac
2045
2046: set up the echo used in my read
2047myecho="case \"\$xxxm\" in
2048'') echo $n \"\$rp $c\" >&4;;
2049*) case \"\$rp\" in
2050	'') echo $n \"[\$xxxm] $c\";;
2051	*)
2052		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2053			echo \"\$rp\" >&4
2054			echo $n \"[\$xxxm] $c\" >&4
2055		else
2056			echo $n \"\$rp [\$xxxm] $c\" >&4
2057		fi
2058		;;
2059	esac;;
2060esac"
2061
2062: now set up to do reads with possible shell escape and default assignment
2063cat <<EOSC >myread
2064$startsh
2065xxxm=\$dflt
2066$myecho
2067ans='!'
2068case "\$fastread" in
2069yes) case "\$dflt" in
2070	'') ;;
2071	*) ans='';
2072		case "\$silent-\$rp" in
2073		true-) ;;
2074		*) echo " " >&4;;
2075		esac;;
2076	esac;;
2077*) case "\$silent" in
2078	true) case "\$rp" in
2079		'') ans='';;
2080		esac;;
2081	esac;;
2082esac
2083while expr "X\$ans" : "X!" >/dev/null; do
2084	read answ
2085	set x \$xxxm
2086	shift
2087	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2088	case  "\$answ" in
2089	"!")
2090		sh 1>&4
2091		echo " "
2092		$myecho
2093		;;
2094	!*)
2095		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2096		shift
2097		sh 1>&4 -c "\$*"
2098		echo " "
2099		$myecho
2100		;;
2101	"\$ans")
2102		case "\$ans" in
2103		\\&*)
2104			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2105			shift
2106			case "\$1" in
2107			-d)
2108				fastread=yes
2109				echo "(OK, I'll run with -d after this question.)" >&4
2110				;;
2111			-*)
2112				echo "*** Sorry, \$1 not supported yet." >&4
2113				;;
2114			esac
2115			$myecho
2116			ans=!
2117			;;
2118		esac;;
2119	*)
2120		case "\$aok" in
2121		y)
2122			echo "*** Substitution done -- please confirm."
2123			xxxm="\$ans"
2124			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2125			xxxm="\$ans"
2126			ans=!
2127			;;
2128		*)
2129			echo "*** Error -- try again."
2130			ans=!
2131			;;
2132		esac
2133		$myecho
2134		;;
2135	esac
2136	case "\$ans\$xxxm\$nostick" in
2137	'')
2138		ans=!
2139		$myecho
2140		;;
2141	esac
2142done
2143case "\$ans" in
2144'') ans="\$xxxm";;
2145esac
2146EOSC
2147
2148: create .config dir to save info across Configure sessions
2149test -d ../.config || mkdir ../.config
2150cat >../.config/README <<EOF
2151This directory created by Configure to save information that should
2152persist across sessions for $package.
2153
2154You may safely delete it if you wish.
2155EOF
2156
2157: See if we are using a devel version and want that
2158xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2159case "$usedevel" in
2160$define|true|[yY]*)
2161    usedevel="$define" ;;
2162*) case "$xversion" in
2163   *[13579])
2164	cat >&4 <<EOH
2165*** WHOA THERE!!! ***
2166
2167    This is an UNSTABLE DEVELOPMENT release.
2168    The version of this $package distribution is $xversion, that is, odd,
2169    (as opposed to even) and that signifies a development release.
2170    If you want a maintenance release, you want an even-numbered version.
2171
2172    Do ***NOT*** install this into production use.
2173    Data corruption and crashes are possible.
2174
2175    It is most seriously suggested that you do not continue any further
2176    unless you want to help in developing and debugging Perl.
2177
2178    If you *still* want to build perl, you can answer 'y' now,
2179    or pass -Dusedevel to Configure.
2180
2181EOH
2182	rp='Do you really want to continue?'
2183	dflt='n'
2184	. ./myread
2185	case "$ans" in
2186	[yY]) echo >&4 "Okay, continuing."
2187	      usedevel="$define" ;;
2188	*) echo >&4 "Okay, bye."
2189	   exit 1
2190	   ;;
2191	esac
2192	;;
2193    esac
2194    usedevel="$undef"
2195    ;;
2196esac
2197case "$usedevel" in
2198$define|true|[yY]*)
2199	case "$versiononly" in
2200	'') versiononly="$define" ;;
2201	esac
2202	case "$installusrbinperl" in
2203	'') installusrbinperl="$undef" ;;
2204	esac
2205	;;
2206esac
2207
2208: general instructions
2209needman=true
2210firsttime=true
2211user=`(logname) 2>/dev/null`
2212case "$user" in
2213'') user=`whoami 2>&1`;;
2214esac
2215if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2216	firsttime=false
2217	echo " "
2218	rp='Would you like to see the instructions?'
2219	dflt=n
2220	. ./myread
2221	case "$ans" in
2222	[yY]*) ;;
2223	*) needman=false;;
2224	esac
2225fi
2226if $needman; then
2227	cat <<EOH
2228
2229This installation shell script will examine your system and ask you questions
2230to determine how the perl5 package should be installed. If you get
2231stuck on a question, you may use a ! shell escape to start a subshell or
2232execute a command.  Many of the questions will have default answers in square
2233brackets; typing carriage return will give you the default.
2234
2235On some of the questions which ask for file or directory names you are allowed
2236to use the ~name construct to specify the login directory belonging to "name",
2237even if you don't have a shell which knows about that.  Questions where this is
2238allowed will be marked "(~name ok)".
2239
2240EOH
2241	rp=''
2242	dflt='Type carriage return to continue'
2243	. ./myread
2244	cat <<'EOH'
2245
2246The prompter used in this script allows you to use shell variables and
2247backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2248in the default answer, as if the default line was a set of arguments given to a
2249script shell.  This means you may also use $* to repeat the whole default line,
2250so you do not have to re-type everything to add something to the default.
2251
2252Everytime there is a substitution, you will have to confirm.  If there is an
2253error (e.g. an unmatched backtick), the default answer will remain unchanged
2254and you will be prompted again.
2255
2256If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2257the questions and use the computed defaults (or the previous answers if there
2258was already a config.sh file). Type 'Configure -h' for a list of options.
2259You may also start interactively and then answer '& -d' at any prompt to turn
2260on the non-interactive behaviour for the remainder of the execution.
2261
2262EOH
2263	. ./myread
2264	cat <<EOH
2265
2266Much effort has been expended to ensure that this shell script will run on any
2267Unix system.  If despite that it blows up on yours, your best bet is to edit
2268Configure and run it again.  If you can't run Configure for some reason,
2269you'll have to generate a config.sh file by hand.  Whatever problems you
2270have, let me (perlbug@perl.org) know how I blew it.
2271
2272This installation script affects things in two ways:
2273
22741) it may do direct variable substitutions on some of the files included
2275   in this kit.
22762) it builds a config.h file for inclusion in C programs.  You may edit
2277   any of these files as the need arises after running this script.
2278
2279If you make a mistake on a question, there is no easy way to back up to it
2280currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2281files.  Configure will offer to let you do this before it runs the SH files.
2282
2283EOH
2284	dflt='Type carriage return to continue'
2285	. ./myread
2286	case "$firsttime" in
2287	true) echo $user >>../.config/instruct;;
2288	esac
2289fi
2290
2291: find out where common programs are
2292echo " "
2293echo "Locating common programs..." >&4
2294cat <<EOSC >loc
2295$startsh
2296case \$# in
22970) exit 1;;
2298esac
2299thing=\$1
2300shift
2301dflt=\$1
2302shift
2303for dir in \$*; do
2304	case "\$thing" in
2305	.)
2306	if test -d \$dir/\$thing; then
2307		echo \$dir
2308		exit 0
2309	fi
2310	;;
2311	*)
2312	for thisthing in \$dir/\$thing; do
2313		: just loop through to pick last item
2314	done
2315	if test -f \$thisthing; then
2316		echo \$thisthing
2317		exit 0
2318	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2319		echo \$thisthing
2320		exit 0
2321	elif test -f \$dir/\$thing.exe; then
2322		if test -n "$DJGPP"; then
2323			echo \$dir/\$thing.exe
2324		elif test "$eunicefix" != ":"; then
2325			: on Eunice apparently
2326			echo \$dir/\$thing
2327		fi
2328		exit 0
2329	fi
2330	;;
2331	esac
2332done
2333echo \$dflt
2334exit 1
2335EOSC
2336chmod +x loc
2337$eunicefix loc
2338loclist="
2339awk
2340cat
2341chmod
2342comm
2343cp
2344echo
2345expr
2346grep
2347ls
2348mkdir
2349rm
2350sed
2351sort
2352touch
2353tr
2354uniq
2355"
2356trylist="
2357ar
2358bison
2359byacc
2360cpp
2361csh
2362date
2363egrep
2364gmake
2365gzip
2366less
2367ln
2368make
2369more
2370nm
2371nroff
2372pg
2373test
2374uname
2375zip
2376"
2377pth=`echo $PATH | sed -e "s/$p_/ /g"`
2378pth="$pth /lib /usr/lib"
2379for file in $loclist; do
2380	eval xxx=\$$file
2381	case "$xxx" in
2382	/*|?:[\\/]*)
2383		if test -f "$xxx"; then
2384			: ok
2385		else
2386			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2387			xxx=`./loc $file $file $pth`
2388		fi
2389		;;
2390	'') xxx=`./loc $file $file $pth`;;
2391	*) xxx=`./loc $xxx $xxx $pth`;;
2392	esac
2393	eval $file=$xxx$_exe
2394	eval _$file=$xxx
2395	case "$xxx" in
2396	/*)
2397		echo $file is in $xxx.
2398		;;
2399	?:[\\/]*)
2400		echo $file is in $xxx.
2401		;;
2402	*)
2403		echo "I don't know where '$file' is, and my life depends on it." >&4
2404		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2405		exit 1
2406		;;
2407	esac
2408done
2409echo " "
2410echo "Don't worry if any of the following aren't found..."
2411say=offhand
2412for file in $trylist; do
2413	eval xxx=\$$file
2414	case "$xxx" in
2415	/*|?:[\\/]*)
2416		if test -f "$xxx"; then
2417			: ok
2418		else
2419			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2420			xxx=`./loc $file $file $pth`
2421		fi
2422		;;
2423	'') xxx=`./loc $file $file $pth`;;
2424	*) xxx=`./loc $xxx $xxx $pth`;;
2425	esac
2426	eval $file=$xxx$_exe
2427	eval _$file=$xxx
2428	case "$xxx" in
2429	/*)
2430		echo $file is in $xxx.
2431		;;
2432	?:[\\/]*)
2433		echo $file is in $xxx.
2434		;;
2435	*)
2436		echo "I don't see $file out there, $say."
2437		say=either
2438		;;
2439	esac
2440done
2441case "$egrep" in
2442egrep)
2443	echo "Substituting grep for egrep."
2444	egrep=$grep
2445	_egrep=$grep
2446	;;
2447esac
2448case "$less" in
2449'')	;;
2450*)	if $less -R </dev/null >/dev/null; then
2451	       echo "Substituting less -R for less."
2452	       less="$less -R"
2453	       _less=$less
2454	fi
2455	;;
2456esac
2457case "$ln" in
2458ln)
2459	echo "Substituting cp for ln."
2460	ln=$cp
2461	_ln=$cp
2462	;;
2463esac
2464case "$make" in
2465make)
2466	case "$gmake" in
2467	gmake)
2468	echo "I can't find make or gmake, and my life depends on it." >&4
2469	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2470	exit 1
2471	;;
2472	esac
2473	;;
2474esac
2475case "$gmake" in
2476gmake)	;;
2477*)	# We can't have osname yet.
2478	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2479		# Assume that gmake, if found, is definitely GNU make
2480		# and prefer it over the system make.
2481		echo "Substituting gmake for make."
2482		make=$gmake
2483		_make=$gmake
2484	fi
2485	;;
2486esac
2487case "$test" in
2488test)
2489	echo "Hopefully test is built into your sh."
2490	;;
2491*)
2492	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2493		echo "Using the test built into your sh."
2494		test=test
2495		_test=test
2496	fi
2497	;;
2498esac
2499case "$echo" in
2500echo)
2501	echo "Hopefully echo is built into your sh."
2502	;;
2503'') ;;
2504*)
2505	echo " "
2506echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2507	$echo $n "hi there$c" >foo1
2508	echo $n "hi there$c" >foo2
2509	if cmp foo1 foo2 >/dev/null 2>&1; then
2510		echo "They are compatible.  In fact, they may be identical."
2511	else
2512		case "$n" in
2513		'-n') n='' c='\c';;
2514		*) n='-n' c='';;
2515		esac
2516		cat <<FOO
2517They are not compatible!  You are probably running ksh on a non-USG system.
2518I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2519have echo built in and we may have to run some Bourne shell scripts.  That
2520means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2521
2522FOO
2523		$echo $n "The star should be here-->$c"
2524		$echo "*"
2525	fi
2526	$rm -f foo1 foo2
2527	;;
2528esac
2529
2530# This question was auctioned at YAPC::Europe-2007 in Vienna
2531# I never promised you could answer it. I only auctioned the question.
2532cat <<FOO
2533The following message is sponsored by
2534
2535  Dresden.pm<--The stars should be here.
2536
2537Dear Perl user, system administrator or package
2538maintainer, the Perl community sends greetings to
2539you. Do you (emblematical) greet back [Y/n]? n
2540
2541FOO
2542
2543: Check what type of C compiler we use
2544cat <<EOS >trygcc
2545$startsh
2546EOS
2547cat <<'EOSC' >>trygcc
2548case "$cc" in
2549'') ;;
2550*)  $rm -f try try.*
2551    $cat >try.c <<EOM
2552int main(int argc, char *argv[]) {
2553  return 0;
2554}
2555EOM
2556    if $cc -o try $ccflags $ldflags try.c; then
2557       :
2558    else
2559        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2560        despair=yes
2561        trygcc=yes
2562        case "$cc" in
2563        *gcc*) trygcc=no ;;
2564        esac
2565	# Skip this test because it gives a false match on output like:
2566	#    ./trygcc: line 23: cc: command not found
2567        # case "`$cc -v -c try.c 2>&1`" in
2568        # *gcc*) trygcc=no ;;
2569        # esac
2570        if $test X"$trygcc" = Xyes; then
2571            if gcc -o try -c try.c; then
2572                echo " "
2573                echo "You seem to have a working gcc, though." >&4
2574		# Switching compilers may undo the work of hints files.
2575		# The most common problem is -D_REENTRANT for threads.
2576		# This heuristic catches that case, but gets false positives
2577		# if -Dusethreads was not actually specified.  Better to
2578		# bail out here with a useful message than fail
2579		# mysteriously later. Should we perhaps just try to
2580		# re-invoke Configure -Dcc=gcc config_args ?
2581		if $test -f usethreads.cbu; then
2582			$cat >&4 <<EOM 
2583
2584*** However, any setting of the C compiler flags (e.g. for thread support)
2585*** will be lost.  It may be necessary for you to restart Configure and
2586*** add -Dcc=gcc to your Configure command line.
2587
2588EOM
2589			rp="Would you like to go ahead and try gcc anyway?"
2590			dflt=n
2591		else
2592			rp="Would you like to use it?"
2593			dflt=y
2594		fi
2595                if $test -f myread; then
2596                    . ./myread
2597                else
2598                    if $test -f UU/myread; then
2599                        . ./UU/myread
2600                    else
2601                        echo "Cannot find myread, sorry.  Aborting." >&2
2602                        exit 1
2603                    fi
2604                fi
2605                case "$ans" in
2606                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2607                esac
2608            fi
2609        fi
2610    fi
2611    $rm -f try try.*
2612    ;;
2613esac
2614EOSC
2615
2616cat <<EOS >checkcc
2617$startsh
2618EOS
2619cat <<'EOSC' >>checkcc
2620case "$cc" in
2621'') ;;
2622*)  $rm -f try try.*
2623    $cat >try.c <<EOM
2624int main(int argc, char *argv[]) {
2625  return 0;
2626}
2627EOM
2628    if $cc -o try $ccflags $ldflags try.c; then
2629       :
2630    else
2631        if $test X"$despair" = Xyes; then
2632           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2633        fi
2634        $cat >&4 <<EOM         
2635You need to find a working C compiler.
2636Either (purchase and) install the C compiler supplied by your OS vendor,
2637or for a free C compiler try http://gcc.gnu.org/
2638I cannot continue any further, aborting.
2639EOM
2640        exit 1
2641    fi
2642    $rm -f try try.*
2643    ;;
2644esac
2645EOSC
2646
2647: determine whether symbolic links are supported
2648echo " "
2649$touch blurfl
2650if $ln -s blurfl sym > /dev/null 2>&1 ; then
2651	echo "Symbolic links are supported." >&4
2652	lns="$ln -s"
2653else
2654	echo "Symbolic links are NOT supported." >&4
2655	lns="$ln"
2656fi
2657$rm -f blurfl sym
2658
2659: determine whether symbolic links are supported
2660echo " "
2661case "$lns" in
2662*"ln"*" -s")
2663	echo "Checking how to test for symbolic links..." >&4
2664	$lns blurfl sym
2665	if $test "X$issymlink" = X; then
2666		case "$newsh" in
2667		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2668		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2669		esac
2670		if test $? = 0; then
2671			issymlink="test -h"
2672		else
2673			echo "Your builtin 'test -h' may be broken." >&4
2674			case "$test" in
2675			/*)	;;
2676			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2677				for p in $pth
2678				do
2679					if test -f "$p/$test"; then
2680						test="$p/$test"
2681						break
2682					fi
2683				done
2684				;;
2685			esac
2686			case "$test" in
2687			/*)
2688				echo "Trying external '$test -h'." >&4
2689				issymlink="$test -h"
2690				if $test ! -h sym >/dev/null 2>&1; then
2691					echo "External '$test -h' is broken, too." >&4
2692					issymlink=''
2693				fi
2694				;;
2695			*)	issymlink='' ;;
2696			esac
2697		fi
2698	fi
2699	if $test "X$issymlink" = X; then
2700		if $test -L sym 2>/dev/null; then
2701			issymlink="$test -L"
2702			echo "The builtin '$test -L' worked." >&4
2703		fi
2704	fi
2705	if $test "X$issymlink" != X; then
2706		echo "You can test for symbolic links with '$issymlink'." >&4
2707	else
2708		echo "I do not know how you can test for symbolic links." >&4
2709	fi
2710	$rm -f blurfl sym
2711	;;
2712*)	echo "No symbolic links, so not testing for their testing..." >&4
2713	;;
2714esac
2715echo " "
2716
2717: Make symlinks util
2718case "$mksymlinks" in
2719$define|true|[yY]*)
2720	case "$src" in
2721	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2722		exit 1
2723		;;
2724	*)	case "$lns:$issymlink" in
2725		*"ln"*" -s:"*"test -"?)
2726			echo "Creating the symbolic links..." >&4
2727			echo "(First creating the subdirectories...)" >&4
2728			cd ..
2729			awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2730				read directory
2731				test -z "$directory" && break
2732				mkdir -p $directory
2733			done
2734			# Sanity check 1.
2735			if test ! -d t/base; then
2736				echo "Failed to create the subdirectories.  Aborting." >&4
2737				exit 1
2738			fi
2739			echo "(Then creating the symlinks...)" >&4
2740			awk '{print $1}' $src/MANIFEST | while true; do
2741				read filename
2742				test -z "$filename" && break
2743				if test -f $filename; then
2744					if $issymlink $filename; then
2745						rm -f $filename
2746					fi
2747				fi
2748				if test -f $filename; then
2749					echo "$filename already exists, not symlinking."
2750				else
2751					ln -s $src/$filename $filename
2752				fi
2753			done
2754			# Sanity check 2.
2755			if test ! -f t/base/lex.t; then
2756				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2757				exit 1
2758			fi
2759			if test ! -f x2p/walk.c; then
2760				echo "Failed to create the symlinks (x2p/walk.c missing).  Aborting." >&4
2761				exit 1
2762			fi
2763			cd UU
2764			;;
2765		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2766			;;
2767		esac
2768		;;
2769	esac
2770	;;
2771esac
2772
2773: Check for Cross-Compilation
2774case "$usecrosscompile" in
2775$define|true|[yY]*)
2776	$echo "Cross-compiling..."
2777        croak=''
2778    	case "$cc" in
2779	*-*-gcc) # A cross-compiling gcc, probably.
2780	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2781	    ar=$targetarch-ar
2782	    # leave out ld, choosing it is more complex
2783	    nm=$targetarch-nm
2784	    ranlib=$targetarch-ranlib
2785	    $echo 'extern int foo;' > try.c
2786	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2787	    shift
2788            if $test $# -gt 0; then
2789	        incpth="$incpth $*"
2790		incpth="`$echo $incpth|$sed 's/^ //'`"
2791                echo "Guessing incpth '$incpth'." >&4
2792                for i in $*; do
2793		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2794		    if $test -d $j; then
2795			libpth="$libpth $j"
2796		    fi
2797                done
2798		libpth="`$echo $libpth|$sed 's/^ //'`"
2799                echo "Guessing libpth '$libpth'." >&4
2800	    fi
2801	    $rm -f try.c
2802	    ;;
2803	esac
2804	case "$targetarch" in
2805	'') echo "Targetarch not defined." >&4; croak=y ;;
2806        *)  echo "Using targetarch $targetarch." >&4 ;;
2807	esac
2808	case "$incpth" in
2809	'') echo "Incpth not defined." >&4; croak=y ;;
2810        *)  echo "Using incpth '$incpth'." >&4 ;;
2811	esac
2812	case "$libpth" in
2813	'') echo "Libpth not defined." >&4; croak=y ;;
2814        *)  echo "Using libpth '$libpth'." >&4 ;;
2815	esac
2816	case "$usrinc" in
2817	'') for i in $incpth; do
2818	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2819		    usrinc=$i
2820	            echo "Guessing usrinc $usrinc." >&4
2821		    break
2822		fi
2823	    done
2824	    case "$usrinc" in
2825	    '') echo "Usrinc not defined." >&4; croak=y ;;
2826	    esac
2827            ;;
2828        *)  echo "Using usrinc $usrinc." >&4 ;;
2829	esac
2830	case "$targethost" in
2831	'') echo "Targethost not defined." >&4; croak=y ;;
2832        *)  echo "Using targethost $targethost." >&4
2833	esac
2834	locincpth=' '
2835	loclibpth=' '
2836	case "$croak" in
2837	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2838	esac
2839	case "$src" in
2840	/*) run=$src/Cross/run
2841	    targetmkdir=$src/Cross/mkdir
2842	    to=$src/Cross/to
2843	    from=$src/Cross/from
2844	    ;;
2845	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2846	    run=$pwd/Cross/run
2847	    targetmkdir=$pwd/Cross/mkdir
2848	    to=$pwd/Cross/to
2849	    from=$pwd/Cross/from
2850	    ;;
2851	esac
2852	case "$targetrun" in
2853	'') targetrun=ssh ;;
2854	esac
2855	case "$targetto" in
2856	'') targetto=scp ;;
2857	esac
2858	case "$targetfrom" in
2859	'') targetfrom=scp ;;
2860	esac
2861    	run=$run-$targetrun
2862    	to=$to-$targetto
2863    	from=$from-$targetfrom
2864	case "$targetdir" in
2865	'')  targetdir=/tmp
2866             echo "Guessing targetdir $targetdir." >&4
2867             ;;
2868	esac
2869	case "$targetuser" in
2870	'')  targetuser=root
2871             echo "Guessing targetuser $targetuser." >&4
2872             ;;
2873	esac
2874	case "$targetfrom" in
2875	scp)	q=-q ;;
2876	*)	q='' ;;
2877	esac
2878	case "$targetrun" in
2879	ssh|rsh)
2880	    cat >$run <<EOF
2881#!/bin/sh
2882case "\$1" in
2883-cwd)
2884  shift
2885  cwd=\$1
2886  shift
2887  ;;
2888esac
2889case "\$cwd" in
2890'') cwd=$targetdir ;;
2891esac
2892exe=\$1
2893shift
2894if $test ! -f \$exe.xok; then
2895  $to \$exe
2896  $touch \$exe.xok
2897fi
2898$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2899EOF
2900	    ;;
2901	*)  echo "Unknown targetrun '$targetrun'" >&4
2902	    exit 1
2903	    ;;
2904	esac
2905	case "$targetmkdir" in
2906	*/Cross/mkdir)
2907	    cat >$targetmkdir <<EOF
2908#!/bin/sh
2909$targetrun -l $targetuser $targethost "mkdir -p \$@"
2910EOF
2911	    $chmod a+rx $targetmkdir
2912	    ;;
2913	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2914	    exit 1
2915	    ;;
2916	esac
2917	case "$targetto" in
2918	scp|rcp)
2919	    cat >$to <<EOF
2920#!/bin/sh
2921for f in \$@
2922do
2923  case "\$f" in
2924  /*)
2925    $targetmkdir \`dirname \$f\`
2926    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2927    ;;
2928  *)
2929    $targetmkdir $targetdir/\`dirname \$f\`
2930    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2931    ;;
2932  esac
2933done
2934exit 0
2935EOF
2936	    ;;
2937	cp) cat >$to <<EOF
2938#!/bin/sh
2939for f in \$@
2940do
2941  case "\$f" in
2942  /*)
2943    $mkdir -p $targetdir/\`dirname \$f\`
2944    $cp \$f $targetdir/\$f || exit 1
2945    ;;
2946  *)
2947    $targetmkdir $targetdir/\`dirname \$f\`
2948    $cp \$f $targetdir/\$f || exit 1
2949    ;;
2950  esac
2951done
2952exit 0
2953EOF
2954	    ;;
2955	*)  echo "Unknown targetto '$targetto'" >&4
2956	    exit 1
2957	    ;;
2958	esac
2959	case "$targetfrom" in
2960	scp|rcp)
2961	  cat >$from <<EOF
2962#!/bin/sh
2963for f in \$@
2964do
2965  $rm -f \$f
2966  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2967done
2968exit 0
2969EOF
2970	    ;;
2971	cp) cat >$from <<EOF
2972#!/bin/sh
2973for f in \$@
2974do
2975  $rm -f \$f
2976  cp $targetdir/\$f . || exit 1
2977done
2978exit 0
2979EOF
2980	    ;;
2981	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2982	    exit 1
2983	    ;;
2984	esac
2985	if $test ! -f $run; then
2986	    echo "Target 'run' script '$run' not found." >&4
2987	else
2988	    $chmod a+rx $run
2989	fi
2990	if $test ! -f $to; then
2991	    echo "Target 'to' script '$to' not found." >&4
2992	else
2993	    $chmod a+rx $to
2994	fi
2995	if $test ! -f $from; then
2996	    echo "Target 'from' script '$from' not found." >&4
2997	else
2998	    $chmod a+rx $from
2999	fi
3000	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3001	    exit 1
3002	fi
3003	cat >&4 <<EOF
3004Using '$run' for remote execution,
3005and '$from' and '$to'
3006for remote file transfer.
3007EOF
3008	;;
3009*)	run=''
3010	to=:
3011	from=:
3012	usecrosscompile='undef'
3013	targetarch=''
3014	;;
3015esac
3016
3017: see whether [:lower:] and [:upper:] are supported character classes
3018echo " "
3019case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3020ABYZ)
3021	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3022	up='[:upper:]'
3023	low='[:lower:]'
3024	;;
3025*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3026	# (0xd9 and 0xe2), therefore that is a nice testing point.
3027	if test "X$up" = X -o "X$low" = X; then
3028	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3029	    rs) up='[A-Z]'
3030		low='[a-z]'
3031		;;
3032	    esac
3033	fi
3034	if test "X$up" = X -o "X$low" = X; then
3035	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3036	    rs) up='A-Z'
3037		low='a-z'
3038		;;
3039	    esac
3040	fi
3041	if test "X$up" = X -o "X$low" = X; then
3042	    case "`echo RS | od -x 2>/dev/null`" in
3043	    *D9E2*|*d9e2*)
3044		echo "Hey, this might be EBCDIC." >&4
3045		if test "X$up" = X -o "X$low" = X; then
3046		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3047		    rs) up='[A-IJ-RS-Z]'
3048			low='[a-ij-rs-z]'
3049			;;
3050		    esac
3051		fi
3052		if test "X$up" = X -o "X$low" = X; then
3053		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3054		    rs) up='A-IJ-RS-Z'
3055			low='a-ij-rs-z'
3056			;;
3057		    esac
3058		fi
3059		;;
3060	    esac
3061	fi
3062esac
3063case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3064rs)
3065    echo "Using $up and $low to convert case." >&4
3066    ;;
3067*)
3068    echo "I don't know how to translate letters from upper to lower case." >&4
3069    echo "Your tr is not acting any way I know of." >&4
3070    exit 1
3071    ;;
3072esac
3073: set up the translation script tr, must be called with ./tr of course
3074cat >tr <<EOSC
3075$startsh
3076case "\$1\$2" in
3077'[A-Z][a-z]') exec $tr '$up' '$low';;
3078'[a-z][A-Z]') exec $tr '$low' '$up';;
3079esac
3080exec $tr "\$@"
3081EOSC
3082chmod +x tr
3083$eunicefix tr
3084
3085: Try to determine whether config.sh was made on this system
3086case "$config_sh" in
3087'')
3088myuname=`$uname -a 2>/dev/null`
3089$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3090# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3091# because the A-Z/a-z are not consecutive.
3092myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3093	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3094newmyuname="$myuname"
3095dflt=n
3096case "$knowitall" in
3097'')
3098	if test -f ../config.sh; then
3099		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3100			eval "`grep myuname= ../config.sh`"
3101		fi
3102		if test "X$myuname" = "X$newmyuname"; then
3103			dflt=y
3104		fi
3105	fi
3106	;;
3107*) dflt=y;;
3108esac
3109
3110: Get old answers from old config file if Configure was run on the
3111: same system, otherwise use the hints.
3112hint=default
3113cd ..
3114if test -f config.sh; then
3115	echo " "
3116	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3117	. UU/myread
3118	case "$ans" in
3119	n*|N*) echo "OK, I'll ignore it."
3120		mv config.sh config.sh.old
3121		myuname="$newmyuname"
3122		;;
3123	*)  echo "Fetching default answers from your old config.sh file..." >&4
3124		tmp_n="$n"
3125		tmp_c="$c"
3126		tmp_sh="$sh"
3127		. ./config.sh
3128		cp config.sh UU
3129		n="$tmp_n"
3130		c="$tmp_c"
3131		: Older versions did not always set $sh.  Catch re-use of such
3132		: an old config.sh.
3133		case "$sh" in
3134		'') sh="$tmp_sh" ;;
3135		esac
3136		hint=previous
3137		;;
3138	esac
3139fi
3140. ./UU/checkcc
3141if test ! -f config.sh; then
3142	$cat <<EOM
3143
3144First time through, eh?  I have some defaults handy for some systems
3145that need some extra help getting the Configure answers right:
3146
3147EOM
3148	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3149	dflt=''
3150	: Half the following guesses are probably wrong... If you have better
3151	: tests or hints, please send them to perlbug@perl.org
3152	: The metaconfig authors would also appreciate a copy...
3153	$test -f /irix && osname=irix
3154	$test -f /xenix && osname=sco_xenix
3155	$test -f /dynix && osname=dynix
3156	$test -f /dnix && osname=dnix
3157	$test -f /lynx.os && osname=lynxos
3158	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3159	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3160	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3161	$test -f /bin/mips && /bin/mips && osname=mips
3162	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3163		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3164	$test -d /usr/apollo/bin && osname=apollo
3165	$test -f /etc/saf/_sactab && osname=svr4
3166	$test -d /usr/include/minix && osname=minix
3167	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3168	if $test -d /MachTen -o -d /MachTen_Folder; then
3169		osname=machten
3170		if $test -x /sbin/version; then
3171			osvers=`/sbin/version | $awk '{print $2}' |
3172			$sed -e 's/[A-Za-z]$//'`
3173		elif $test -x /usr/etc/version; then
3174			osvers=`/usr/etc/version | $awk '{print $2}' |
3175			$sed -e 's/[A-Za-z]$//'`
3176		else
3177			osvers="$2.$3"
3178		fi
3179	fi
3180
3181	$test -f /sys/posix.dll &&
3182		$test -f /usr/bin/what &&
3183		set X `/usr/bin/what /sys/posix.dll` &&
3184		$test "$3" = UWIN &&
3185		osname=uwin &&
3186		osvers="$5"
3187
3188	if $test -f $uname; then
3189		set X $myuname
3190		shift
3191
3192		case "$5" in
3193		fps*) osname=fps ;;
3194		mips*)
3195			case "$4" in
3196			umips) osname=umips ;;
3197			*) osname=mips ;;
3198			esac;;
3199		[23]100) osname=mips ;;
3200		next*) osname=next ;;
3201		i386*)
3202			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3203			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3204				osname='sco'
3205				osvers=$tmp
3206			elif $test -f /etc/kconfig; then
3207				osname=isc
3208				if test "$lns" = "$ln -s"; then
3209					osvers=4
3210				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3211					osvers=3
3212				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3213					osvers=2
3214				fi
3215			fi
3216			tmp=''
3217			;;
3218		pc*)
3219			if test -n "$DJGPP"; then
3220				osname=dos
3221				osvers=djgpp
3222			fi
3223			;;
3224		esac
3225
3226		case "$1" in
3227		aix) osname=aix
3228			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3229			case "$tmp" in
3230			# oslevel can fail with:
3231			# oslevel: Unable to acquire lock.
3232			*not\ found) osvers="$4"."$3" ;;
3233			'<3240'|'<>3240') osvers=3.2.0 ;;
3234			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3235			'=3250'|'>3250') osvers=3.2.5 ;;
3236			*) osvers=$tmp;;
3237			esac
3238			;;
3239		bsd386) osname=bsd386
3240			osvers=`$uname -r`
3241			;;
3242		cygwin*) osname=cygwin
3243			osvers="$3"
3244			;;
3245		*dc.osx) osname=dcosx
3246			osvers="$3"
3247			;;
3248		dnix) osname=dnix
3249			osvers="$3"
3250			;;
3251		domainos) osname=apollo
3252			osvers="$3"
3253			;;
3254		dgux)	osname=dgux
3255			osvers="$3"
3256			;;
3257		dragonfly) osname=dragonfly
3258			osvers="$3"
3259			;;
3260		dynixptx*) osname=dynixptx
3261			osvers=`echo "$4"|sed 's/^v//'`
3262			;;
3263		freebsd) osname=freebsd
3264			osvers="$3" ;;
3265		genix)	osname=genix ;;
3266		gnu)	osname=gnu
3267			osvers="$3" ;;
3268		hp*)	osname=hpux
3269			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3270			;;
3271		irix*)	osname=irix
3272			case "$3" in
3273			4*) osvers=4 ;;
3274			5*) osvers=5 ;;
3275			*)	osvers="$3" ;;
3276			esac
3277			;;
3278		linux)	osname=linux
3279			case "$3" in
3280			*)	osvers="$3" ;;
3281			esac
3282			;;
3283		MiNT)	osname=mint
3284			;;
3285		netbsd*) osname=netbsd
3286			osvers="$3"
3287			;;
3288		news-os) osvers="$3"
3289			case "$3" in
3290			4*) osname=newsos4 ;;
3291			*) osname=newsos ;;
3292			esac
3293			;;
3294		next*) osname=next ;;
3295		nonstop-ux) osname=nonstopux ;;
3296		openbsd) osname=openbsd
3297                	osvers="$3"
3298                	;;
3299		os2)	osname=os2
3300			osvers="$4"
3301			;;
3302		POSIX-BC | posix-bc ) osname=posix-bc
3303			osvers="$3"
3304			;;
3305		powerux | power_ux | powermax_os | powermaxos | \
3306		powerunix | power_unix) osname=powerux
3307			osvers="$3"
3308			;;
3309		qnx) osname=qnx
3310			osvers="$4"
3311			;;
3312		solaris) osname=solaris
3313			case "$3" in
3314			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3315			*)	osvers="$3" ;;
3316			esac
3317			;;
3318		sunos) osname=sunos
3319			case "$3" in
3320			5*) osname=solaris
3321				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3322			*)	osvers="$3" ;;
3323			esac
3324			;;
3325		titanos) osname=titanos
3326			case "$3" in
3327			1*) osvers=1 ;;
3328			2*) osvers=2 ;;
3329			3*) osvers=3 ;;
3330			4*) osvers=4 ;;
3331			*)	osvers="$3" ;;
3332			esac
3333			;;
3334		ultrix) osname=ultrix
3335			osvers="$3"
3336			;;
3337		osf1|mls+)	case "$5" in
3338				alpha)
3339					osname=dec_osf
3340					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3341					case "$osvers" in
3342					[1-9].[0-9]*) ;;
3343					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3344					esac
3345					;;
3346			hp*)	osname=hp_osf1	;;
3347			mips)	osname=mips_osf1 ;;
3348			esac
3349			;;
3350		# UnixWare 7.1.2 is known as Open UNIX 8
3351		openunix|unixware) osname=svr5
3352			osvers="$4"
3353			;;
3354		uts)	osname=uts
3355			osvers="$3"
3356			;;
3357		vos) osvers="$3"
3358			;;
3359		$2) case "$osname" in
3360			*isc*) ;;
3361			*freebsd*) ;;
3362			svr*)
3363				: svr4.x or possibly later
3364				case "svr$3" in
3365				${osname}*)
3366					osname=svr$3
3367					osvers=$4
3368					;;
3369				esac
3370				case "$osname" in
3371				svr4.0)
3372					: Check for ESIX
3373					if test -f /stand/boot ; then
3374						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3375						if test -n "$INITPROG" -a -f "$INITPROG"; then
3376			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3377							if test -n "$isesix"; then
3378								osname=esix4
3379							fi
3380						fi
3381					fi
3382					;;
3383				esac
3384				;;
3385			*)	if test -f /etc/systemid; then
3386					osname=sco
3387					set `echo $3 | $sed 's/\./ /g'` $4
3388					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3389						osvers=$1.$2.$3
3390					elif $test -f $src/hints/sco_$1_$2.sh; then
3391						osvers=$1.$2
3392					elif $test -f $src/hints/sco_$1.sh; then
3393						osvers=$1
3394					fi
3395				else
3396					case "$osname" in
3397					'') : Still unknown.  Probably a generic Sys V.
3398						osname="sysv"
3399						osvers="$3"
3400						;;
3401					esac
3402				fi
3403				;;
3404			esac
3405			;;
3406		*)	case "$osname" in
3407			'') : Still unknown.  Probably a generic BSD.
3408				osname="$1"
3409				osvers="$3"
3410				;;
3411			esac
3412			;;
3413		esac
3414	else
3415		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3416			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3417			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3418				osname=news_os
3419			fi
3420			$rm -f UU/kernel.what
3421		elif test -d c:/. -o -n "$is_os2" ; then
3422			set X $myuname
3423			osname=os2
3424			osvers="$5"
3425		fi
3426	fi
3427
3428        case "$targetarch" in
3429        '') ;;
3430        *)  hostarch=$osname
3431            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3432            osvers=''
3433            ;;
3434        esac
3435
3436	: Now look for a hint file osname_osvers, unless one has been
3437	: specified already.
3438	case "$hintfile" in
3439	''|' ')
3440		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3441		: Also try without trailing minor version numbers.
3442		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3443		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3444		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3445		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3446		case "$file" in
3447		'') dflt=none ;;
3448		*)  case "$osvers" in
3449			'') dflt=$file
3450				;;
3451			*)  if $test -f $src/hints/$file.sh ; then
3452					dflt=$file
3453				elif $test -f $src/hints/$xfile.sh ; then
3454					dflt=$xfile
3455				elif $test -f $src/hints/$xxfile.sh ; then
3456					dflt=$xxfile
3457				elif $test -f $src/hints/$xxxfile.sh ; then
3458					dflt=$xxxfile
3459				elif $test -f $src/hints/$xxxxfile.sh ; then
3460					dflt=$xxxxfile
3461				elif $test -f "$src/hints/${osname}.sh" ; then
3462					dflt="${osname}"
3463				else
3464					dflt=none
3465				fi
3466				;;
3467			esac
3468			;;
3469		esac
3470		if $test -f Policy.sh ; then
3471			case "$dflt" in
3472			*Policy*) ;;
3473			none) dflt="Policy" ;;
3474			*) dflt="Policy $dflt" ;;
3475			esac
3476		fi
3477		;;
3478	*)
3479		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3480		;;
3481	esac
3482
3483	if $test -f Policy.sh ; then
3484		$cat <<EOM
3485
3486There's also a Policy hint file available, which should make the
3487site-specific (policy) questions easier to answer.
3488EOM
3489
3490	fi
3491
3492	$cat <<EOM
3493
3494You may give one or more space-separated answers, or "none" if appropriate.
3495If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3496previous run of Configure, you may specify it as well as or instead of
3497OS-specific hints.  If hints are provided for your OS, you should use them:
3498although Perl can probably be built without hints on many platforms, using
3499hints often improve performance and may enable features that Configure can't
3500set up on its own. If there are no hints that match your OS, specify "none";
3501DO NOT give a wrong version or a wrong OS.
3502
3503EOM
3504
3505	rp="Which of these apply, if any?"
3506	. UU/myread
3507	tans=$ans
3508	for file in $tans; do
3509		if $test X$file = XPolicy -a -f Policy.sh; then
3510			. Policy.sh
3511			$cat Policy.sh >> UU/config.sh
3512		elif $test -f $src/hints/$file.sh; then
3513			. $src/hints/$file.sh
3514			$cat $src/hints/$file.sh >> UU/config.sh
3515		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3516			: nothing
3517		else
3518			: Give one chance to correct a possible typo.
3519			echo "$file.sh does not exist"
3520			dflt=$file
3521			rp="hint to use instead?"
3522			. UU/myread
3523			for file in $ans; do
3524				if $test -f "$src/hints/$file.sh"; then
3525					. $src/hints/$file.sh
3526					$cat $src/hints/$file.sh >> UU/config.sh
3527				elif $test X$ans = X -o X$ans = Xnone ; then
3528					: nothing
3529				else
3530					echo "$file.sh does not exist -- ignored."
3531				fi
3532			done
3533		fi
3534	done
3535
3536	hint=recommended
3537	: Remember our hint file for later.
3538	if $test -f "$src/hints/$file.sh" ; then
3539		hintfile="$file"
3540	else
3541		hintfile=''
3542	fi
3543fi
3544cd UU
3545;;
3546*)
3547	echo " "
3548	echo "Fetching default answers from $config_sh..." >&4
3549	tmp_n="$n"
3550	tmp_c="$c"
3551	cd ..
3552	cp $config_sh config.sh 2>/dev/null
3553	chmod +w config.sh
3554	. ./config.sh
3555	cd UU
3556	cp ../config.sh .
3557	n="$tmp_n"
3558	c="$tmp_c"
3559	hint=previous
3560	;;
3561esac
3562test "$override" && . ./optdef.sh
3563
3564: Restore computed paths
3565for file in $loclist $trylist; do
3566	eval $file="\$_$file"
3567done
3568
3569cat << EOM
3570
3571Configure uses the operating system name and version to set some defaults.
3572The default value is probably right if the name rings a bell. Otherwise,
3573since spelling matters for me, either accept the default or answer "none"
3574to leave it blank.
3575
3576EOM
3577case "$osname" in
3578	''|' ')
3579		case "$hintfile" in
3580		''|' '|none) dflt=none ;;
3581		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3582		esac
3583		;;
3584	*) dflt="$osname" ;;
3585esac
3586rp="Operating system name?"
3587. ./myread
3588case "$ans" in
3589none)  osname='' ;;
3590*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3591esac
3592echo " "
3593case "$osvers" in
3594	''|' ')
3595		case "$hintfile" in
3596		''|' '|none) dflt=none ;;
3597		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3598			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3599			case "$dflt" in
3600			''|' ') dflt=none ;;
3601			esac
3602			;;
3603		esac
3604		;;
3605	*) dflt="$osvers" ;;
3606esac
3607rp="Operating system version?"
3608. ./myread
3609case "$ans" in
3610none)  osvers='' ;;
3611*) osvers="$ans" ;;
3612esac
3613
3614
3615. ./posthint.sh
3616
3617: who configured the system
3618cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3619case "$cf_by" in
3620"")
3621	cf_by=`(logname) 2>/dev/null`
3622	case "$cf_by" in
3623	"")
3624		cf_by=`(whoami) 2>/dev/null`
3625		case "$cf_by" in
3626		"") cf_by=unknown ;;
3627		esac ;;
3628	esac ;;
3629esac
3630
3631: decide how portable to be.  Allow command line overrides.
3632case "$d_portable" in
3633"$undef") ;;
3634*)	d_portable="$define" ;;
3635esac
3636
3637: set up shell script to do ~ expansion
3638cat >filexp <<EOSS
3639$startsh
3640: expand filename
3641case "\$1" in
3642 \~/*|\~)
3643	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3644	;;
3645 \~*)
3646	if $test -f /bin/csh; then
3647		/bin/csh -f -c "glob \$1"
3648		failed=\$?
3649		echo ""
3650		exit \$failed
3651	else
3652		name=\`$expr x\$1 : '..\([^/]*\)'\`
3653		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3654		if $test ! -d "\$dir"; then
3655			me=\`basename \$0\`
3656			echo "\$me: can't locate home directory for: \$name" >&2
3657			exit 1
3658		fi
3659		case "\$1" in
3660		*/*)
3661			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3662			;;
3663		*)
3664			echo \$dir
3665			;;
3666		esac
3667	fi
3668	;;
3669*)
3670	echo \$1
3671	;;
3672esac
3673EOSS
3674chmod +x filexp
3675$eunicefix filexp
3676
3677: now set up to get a file name
3678cat <<EOS >getfile
3679$startsh
3680EOS
3681cat <<'EOSC' >>getfile
3682tilde=''
3683fullpath=''
3684already=''
3685skip=''
3686none_ok=''
3687exp_file=''
3688nopath_ok=''
3689orig_rp="$rp"
3690orig_dflt="$dflt"
3691case "$gfpth" in
3692'') gfpth='.' ;;
3693esac
3694
3695case "$fn" in
3696*\(*)
3697	: getfile will accept an answer from the comma-separated list
3698	: enclosed in parentheses even if it does not meet other criteria.
3699	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3700	fn=`echo $fn | sed 's/(.*)//'`
3701	;;
3702esac
3703
3704case "$fn" in
3705*:*)
3706	loc_file=`expr $fn : '.*:\(.*\)'`
3707	fn=`expr $fn : '\(.*\):.*'`
3708	;;
3709esac
3710
3711case "$fn" in
3712*~*) tilde=true;;
3713esac
3714case "$fn" in
3715*/*) fullpath=true;;
3716esac
3717case "$fn" in
3718*+*) skip=true;;
3719esac
3720case "$fn" in
3721*n*) none_ok=true;;
3722esac
3723case "$fn" in
3724*e*) exp_file=true;;
3725esac
3726case "$fn" in
3727*p*) nopath_ok=true;;
3728esac
3729
3730case "$fn" in
3731*f*) type='File';;
3732*d*) type='Directory';;
3733*l*) type='Locate';;
3734esac
3735
3736what="$type"
3737case "$what" in
3738Locate) what='File';;
3739esac
3740
3741case "$exp_file" in
3742'')
3743	case "$d_portable" in
3744	"$define") ;;
3745	*) exp_file=true;;
3746	esac
3747	;;
3748esac
3749
3750cd ..
3751while test "$type"; do
3752	redo=''
3753	rp="$orig_rp"
3754	dflt="$orig_dflt"
3755	case "$tilde" in
3756	true) rp="$rp (~name ok)";;
3757	esac
3758	. UU/myread
3759	if test -f UU/getfile.ok && \
3760		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3761	then
3762		value="$ans"
3763		ansexp="$ans"
3764		break
3765	fi
3766	case "$ans" in
3767	none)
3768		value=''
3769		ansexp=''
3770		case "$none_ok" in
3771		true) type='';;
3772		esac
3773		;;
3774	*)
3775		case "$tilde" in
3776		'') value="$ans"
3777			ansexp="$ans";;
3778		*)
3779			value=`UU/filexp $ans`
3780			case $? in
3781			0)
3782				if test "$ans" != "$value"; then
3783					echo "(That expands to $value on this system.)"
3784				fi
3785				;;
3786			*) value="$ans";;
3787			esac
3788			ansexp="$value"
3789			case "$exp_file" in
3790			'') value="$ans";;
3791			esac
3792			;;
3793		esac
3794		case "$fullpath" in
3795		true)
3796			case "$ansexp" in
3797			/*) value="$ansexp" ;;
3798			[a-zA-Z]:/*) value="$ansexp" ;;
3799			*)
3800				redo=true
3801				case "$already" in
3802				true)
3803				echo "I shall only accept a full path name, as in /bin/ls." >&4
3804				echo "Use a ! shell escape if you wish to check pathnames." >&4
3805					;;
3806				*)
3807				echo "Please give a full path name, starting with slash." >&4
3808					case "$tilde" in
3809					true)
3810				echo "Note that using ~name is ok provided it expands well." >&4
3811						already=true
3812						;;
3813					esac
3814				esac
3815				;;
3816			esac
3817			;;
3818		esac
3819		case "$redo" in
3820		'')
3821			case "$type" in
3822			File)
3823				for fp in $gfpth; do
3824					if test "X$fp" = X.; then
3825					    pf="$ansexp"
3826					else
3827					    pf="$fp/$ansexp"
3828					fi
3829					if test -f "$pf"; then
3830						type=''
3831					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3832					then
3833						echo "($value is not a plain file, but that's ok.)"
3834						type=''
3835					fi
3836					if test X"$type" = X; then
3837					    value="$pf"
3838					    break
3839					fi
3840				done
3841				;;
3842			Directory)
3843				for fp in $gfpth; do
3844					if test "X$fp" = X.; then
3845					    dir="$ans"
3846					    direxp="$ansexp"
3847					else
3848					    dir="$fp/$ansexp"
3849					    direxp="$fp/$ansexp"
3850					fi
3851					if test -d "$direxp"; then
3852						type=''
3853						value="$dir"
3854						break
3855					fi
3856				done
3857				;;
3858			Locate)
3859				if test -d "$ansexp"; then
3860					echo "(Looking for $loc_file in directory $value.)"
3861					value="$value/$loc_file"
3862					ansexp="$ansexp/$loc_file"
3863				fi
3864				if test -f "$ansexp"; then
3865					type=''
3866				fi
3867				case "$nopath_ok" in
3868				true)	case "$value" in
3869					*/*) ;;
3870					*)	echo "Assuming $value will be in people's path."
3871						type=''
3872						;;
3873					esac
3874					;;
3875				esac
3876				;;
3877			esac
3878
3879			case "$skip" in
3880			true) type='';
3881			esac
3882
3883			case "$type" in
3884			'') ;;
3885			*)
3886				if test "$fastread" = yes; then
3887					dflt=y
3888				else
3889					dflt=n
3890				fi
3891				rp="$what $value doesn't exist.  Use that name anyway?"
3892				. UU/myread
3893				dflt=''
3894				case "$ans" in
3895				y*) type='';;
3896				*) echo " ";;
3897				esac
3898				;;
3899			esac
3900			;;
3901		esac
3902		;;
3903	esac
3904done
3905cd UU
3906ans="$value"
3907rp="$orig_rp"
3908dflt="$orig_dflt"
3909rm -f getfile.ok
3910test "X$gfpthkeep" != Xy && gfpth=""
3911EOSC
3912
3913: determine root of directory hierarchy where package will be installed.
3914case "$prefix" in
3915'')
3916	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3917	;;
3918*?/)
3919	dflt=`echo "$prefix" | sed 's/.$//'`
3920	;;
3921*)
3922	dflt="$prefix"
3923	;;
3924esac
3925$cat <<EOM
3926
3927By default, $package will be installed in $dflt/bin, manual pages
3928under $dflt/man, etc..., i.e. with $dflt as prefix for all
3929installation directories. Typically this is something like /usr/local.
3930If you wish to have binaries under /usr/bin but other parts of the
3931installation under /usr/local, that's ok: you will be prompted
3932separately for each of the installation directories, the prefix being
3933only used to set the defaults.
3934
3935EOM
3936fn=d~
3937rp='Installation prefix to use?'
3938. ./getfile
3939oldprefix=''
3940case "$prefix" in
3941'') ;;
3942*)
3943	case "$ans" in
3944	"$prefix") ;;
3945	*) oldprefix="$prefix";;
3946	esac
3947	;;
3948esac
3949prefix="$ans"
3950prefixexp="$ansexp"
3951
3952: allow them to override the AFS root
3953case "$afsroot" in
3954'')	afsroot=/afs ;;
3955*)	afsroot=$afsroot ;;
3956esac
3957
3958: is AFS running?
3959echo " "
3960case "$afs" in
3961$define|true)	afs=true ;;
3962$undef|false)	afs=false ;;
3963*)	if $test -d $afsroot; then
3964		afs=true
3965	else
3966		afs=false
3967	fi
3968	;;
3969esac
3970if $afs; then
3971	echo "AFS may be running... I'll be extra cautious then..." >&4
3972else
3973	echo "AFS does not seem to be running..." >&4
3974fi
3975
3976: determine installation prefix for where package is to be installed.
3977if $afs; then
3978$cat <<EOM
3979
3980Since you are running AFS, I need to distinguish the directory in which
3981files will reside from the directory in which they are installed (and from
3982which they are presumably copied to the former directory by occult means).
3983
3984EOM
3985	case "$installprefix" in
3986	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3987	*) dflt="$installprefix";;
3988	esac
3989else
3990$cat <<EOM
3991
3992In some special cases, particularly when building $package for distribution,
3993it is convenient to distinguish the directory in which files should be
3994installed from the directory ($prefix) in which they will
3995eventually reside.  For most users, these two directories are the same.
3996
3997EOM
3998	case "$installprefix" in
3999	'') dflt=$prefix ;;
4000	*) dflt=$installprefix;;
4001	esac
4002fi
4003fn=d~
4004rp='What installation prefix should I use for installing files?'
4005. ./getfile
4006installprefix="$ans"
4007installprefixexp="$ansexp"
4008
4009: Perform the prefixexp/installprefixexp correction if necessary
4010cat <<EOS >installprefix
4011$startsh
4012EOS
4013cat <<'EOSC' >>installprefix
4014: Change installation prefix, if necessary.
4015if $test X"$prefix" != X"$installprefix"; then
4016    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4017else
4018    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4019fi
4020EOSC
4021chmod +x installprefix
4022$eunicefix installprefix
4023
4024: Set variables such as privlib and privlibexp from the output of ./getfile
4025: performing the prefixexp/installprefixexp correction if necessary.
4026cat <<EOS >setprefixvar
4027$startsh
4028EOS
4029cat <<'EOSC' >>setprefixvar
4030eval "${prefixvar}=\"\$ans\""
4031eval "${prefixvar}exp=\"\$ansexp\""
4032. ./installprefix
4033EOSC
4034chmod +x setprefixvar
4035$eunicefix setprefixvar
4036
4037: set up the script used to warn in case of inconsistency
4038cat <<EOS >whoa
4039$startsh
4040EOS
4041cat <<'EOSC' >>whoa
4042dflt=y
4043case "$hint" in
4044    recommended)
4045	case "$hintfile" in
4046	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4047		;;
4048	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4049		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4050		;;
4051	esac
4052	;;
4053    *)	echo " "
4054	echo "*** WHOA THERE!!! ***" >&4
4055	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4056	;;
4057esac
4058rp="    Keep the $hint value?"
4059. ./myread
4060case "$ans" in
4061y) td=$was; tu=$was;;
4062esac
4063EOSC
4064
4065: function used to set '$1' to '$val'
4066setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4067case "$val$was" in
4068$define$undef) . ./whoa; eval "$var=\$td";;
4069$undef$define) . ./whoa; eval "$var=\$tu";;
4070*) eval "$var=$val";;
4071esac'
4072
4073: Check is we will use socks
4074case "$usesocks" in
4075$define|true|[yY]*)	dflt='y';;
4076*) dflt='n';;
4077esac
4078cat <<EOM
4079
4080Perl can be built to use the SOCKS proxy protocol library.  To do so,
4081Configure must be run with -Dusesocks.  If you use SOCKS you also need
4082to use the PerlIO abstraction layer, this will be implicitly selected.
4083
4084If this doesn't make any sense to you, just accept the default '$dflt'.
4085EOM
4086rp='Build Perl for SOCKS?'
4087. ./myread
4088case "$ans" in
4089y|Y)	val="$define" ;;
4090*)      val="$undef" ;;
4091esac
4092set usesocks
4093eval $setvar
4094
4095case "$usesocks" in
4096$define|true|[yY]*) useperlio="$define";;
4097esac
4098
4099: Check if we want perlio
4100case "$useperlio" in
4101$define|true|[yY]*|'')	dflt='y';;
4102*) dflt='n';;
4103esac
4104cat <<EOM
4105
4106Previous version of $package used the standard IO mechanisms as
4107defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4108alternate IO mechanisms via the PerlIO abstraction layer, but the
4109stdio mechanism is still available if needed.  The abstraction layer
4110can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4111Using PerlIO with sfio may cause problems with some extension modules.
4112
4113If this doesn't make any sense to you, just accept the default '$dflt'.
4114EOM
4115rp='Use the PerlIO abstraction layer?'
4116. ./myread
4117case "$ans" in
4118y|Y)
4119	val="$define"
4120	;;
4121*)
4122	echo "Ok, doing things the stdio way."
4123	val="$undef"
4124	;;
4125esac
4126set useperlio
4127eval $setvar
4128
4129case "$usesocks" in
4130$define|true|[yY]*)
4131	case "$useperlio" in
4132	$define|true|[yY]*) ;;
4133	*)	cat >&4 <<EOM
4134
4135You are using the SOCKS proxy protocol library which means that you
4136should also use the PerlIO layer.  You may be headed for trouble.
4137
4138EOM
4139		;;
4140	esac
4141	;;
4142esac
4143
4144: get the patchlevel
4145echo " "
4146echo "Getting the current patchlevel..." >&4
4147if $test -r $rsrc/patchlevel.h;then
4148	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4149	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4150	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4151	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4152	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4153	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4154	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4155else
4156	revision=0
4157	patchlevel=0
4158	subversion=0
4159	api_revision=0
4160	api_version=0
4161	api_subversion=0
4162	perl_patchlevel=0
4163	$echo "(You do not have patchlevel.h.  Eek.)"
4164fi
4165if $test -r $rsrc/.patch ; then
4166	if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4167		perl_patchlevel=`cat $rsrc/.patch`
4168	fi
4169fi
4170: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4171version_patchlevel_string="version $patchlevel subversion $subversion"
4172case "$perl_patchlevel" in
41730|'') ;;
4174*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4175    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4176    ;;
4177esac
4178
4179$echo "(You have $package $version_patchlevel_string.)"
4180
4181case "$osname" in
4182dos|vms)
4183	: XXX Should be a Configure test for double-dots in filenames.
4184	version=`echo $revision $patchlevel $subversion | \
4185		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4186	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4187		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4188	;;
4189*)
4190	version=`echo $revision $patchlevel $subversion | \
4191		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4192	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4193		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4194	;;
4195esac
4196: Special case the 5.005_xx maintenance series, which used 5.005
4197: without any subversion label as a subdirectory in $sitelib
4198if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4199	api_versionstring='5.005'
4200fi
4201
4202: Do we want threads support and if so, what type
4203case "$usethreads" in
4204$define|true|[yY]*)     dflt='y';;
4205*)     # Catch case where user specified ithreads or 5005threads but
4206       # forgot -Dusethreads (A.D. 4/2002)
4207       case "$useithreads$use5005threads" in
4208       *$define*)
4209		case "$useperlio" in
4210		"$define")	dflt='y' ;;
4211		*)		dflt='n' ;;
4212		esac
4213		;;
4214       *)	dflt='n';;
4215       esac
4216       ;;
4217esac
4218cat <<EOM
4219
4220Perl can be built to take advantage of threads on some systems.
4221To do so, Configure can be run with -Dusethreads.
4222
4223Note that Perl built with threading support runs slightly slower
4224and uses more memory than plain Perl. The current implementation
4225is believed to be stable, but it is fairly new, and so should be
4226treated with caution.
4227
4228If this doesn't make any sense to you, just accept the default '$dflt'.
4229EOM
4230rp='Build a threading Perl?'
4231. ./myread
4232case "$ans" in
4233y|Y)    val="$define" ;;
4234*)      val="$undef" ;;
4235esac
4236set usethreads
4237eval $setvar
4238
4239if $test $patchlevel -lt 9; then
4240    case "$usethreads" in
4241    $define)
4242	$cat <<EOM
4243
4244Since release 5.6, Perl has had two different threading implementations,
4245the newer interpreter-based version (ithreads) with one interpreter per
4246thread, and the older 5.005 version (5005threads).
4247The 5005threads version is effectively unmaintained and will probably be
4248removed in Perl 5.10, so there should be no need to build a Perl using it
4249unless needed for backwards compatibility with some existing 5.005threads
4250code.
4251
4252EOM
4253	: Default to ithreads unless overridden on command line or with
4254	: old config.sh
4255	dflt='y'
4256	case "$use5005threads" in
4257		$define|true|[yY]*) dflt='n';;
4258	esac
4259	case "$useithreads" in
4260		$undef|false|[nN]*) dflt='n';;
4261	esac
4262	rp='Use the newer interpreter-based ithreads?'
4263	. ./myread
4264	case "$ans" in
4265	y|Y)    val="$define" ;;
4266	*)      val="$undef" ;;
4267	esac
4268	set useithreads
4269	eval $setvar
4270	: Now set use5005threads to the opposite value.
4271	case "$useithreads" in
4272	$define) val="$undef" ;;
4273	*) val="$define" ;;
4274	esac
4275	set use5005threads
4276	eval $setvar
4277	;;
4278    *)
4279	useithreads="$undef"
4280	use5005threads="$undef"
4281	;;
4282    esac
4283
4284    case "$useithreads$use5005threads" in
4285    "$define$define")
4286	$cat >&4 <<EOM
4287
4288You cannot have both the ithreads and the 5.005 threads enabled
4289at the same time.  Disabling the 5.005 threads since they are
4290much less stable than the ithreads.
4291
4292EOM
4293	use5005threads="$undef"
4294	;;
4295    esac
4296
4297else
4298: perl-5.9.x and later
4299
4300    if test X"$usethreads" = "X$define"; then
4301	case "$use5005threads" in
4302	    $define|true|[yY]*)
4303		$cat >&4 <<EOM
4304
43055.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4306
4307EOM
4308	    ;;
4309	esac
4310    fi
4311
4312    use5005threads="$undef"
4313    useithreads="$usethreads"
4314fi
4315
4316if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4317	cat >&4 <<EOF
4318***
4319*** To build with ithreads you must also use the PerlIO layer.
4320*** Cannot continue, aborting.
4321***
4322EOF
4323	exit 1
4324fi
4325
4326case "$d_oldpthreads" in
4327'')	: Configure tests would be welcome here.  For now, assume undef.
4328	val="$undef" ;;
4329*)	val="$d_oldpthreads" ;;
4330esac
4331set d_oldpthreads
4332eval $setvar
4333
4334
4335: Look for a hint-file generated 'call-back-unit'.  If the
4336: user has specified that a threading perl is to be built,
4337: we may need to set or change some other defaults.
4338if $test -f usethreads.cbu; then
4339    echo "Your platform has some specific hints regarding threaded builds, using them..."
4340    . ./usethreads.cbu
4341else
4342    case "$usethreads" in
4343	"$define"|true|[yY]*)
4344		$cat <<EOM
4345(Your platform does not have any specific hints for threaded builds.
4346 Assuming POSIX threads, then.)
4347EOM
4348	;;
4349    esac
4350fi
4351
4352: Check if multiplicity is required
4353cat <<EOM
4354
4355Perl can be built so that multiple Perl interpreters can coexist
4356within the same Perl executable.
4357EOM
4358
4359case "$useithreads" in
4360$define)
4361	cat <<EOM
4362This multiple interpreter support is required for interpreter-based threads.
4363EOM
4364	val="$define"
4365	;;
4366*)	case "$usemultiplicity" in
4367	$define|true|[yY]*)	dflt='y';;
4368	*) dflt='n';;
4369	esac
4370	echo " "
4371	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4372	rp='Build Perl for multiplicity?'
4373	. ./myread
4374	case "$ans" in
4375	y|Y)	val="$define" ;;
4376	*)      val="$undef" ;;
4377	esac
4378	;;
4379esac
4380set usemultiplicity
4381eval $setvar
4382
4383: Check if morebits is requested
4384case "$usemorebits" in
4385"$define"|true|[yY]*)
4386	use64bitint="$define"
4387	uselongdouble="$define"
4388	usemorebits="$define"
4389	;;
4390*)	usemorebits="$undef"
4391	;;
4392esac
4393
4394: Determine the C compiler to be used
4395echo " "
4396case "$cc" in
4397'') dflt=cc;;
4398*) dflt="$cc";;
4399esac
4400rp="Use which C compiler?"
4401. ./myread
4402cc="$ans"
4403
4404: See whether they have no cc but they do have gcc
4405. ./trygcc
4406if $test -f cc.cbu; then
4407    . ./cc.cbu
4408fi
4409. ./checkcc
4410
4411: make some quick guesses about what we are up against
4412echo " "
4413$echo $n "Hmm...  $c"
4414echo exit 1 >bsd
4415echo exit 1 >usg
4416echo exit 1 >v7
4417echo exit 1 >osf1
4418echo exit 1 >eunice
4419echo exit 1 >xenix
4420echo exit 1 >venix
4421echo exit 1 >os2
4422d_bsd="$undef"
4423$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4424if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4425then
4426	echo "Looks kind of like an OSF/1 system, but we'll see..."
4427	echo exit 0 >osf1
4428elif test `echo abc | $tr a-z A-Z` = Abc ; then
4429	xxx=`./loc addbib blurfl $pth`
4430	if $test -f $xxx; then
4431	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4432		echo exit 0 >bsd
4433		echo exit 0 >usg
4434	else
4435		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4436			echo "Looks kind of like an extended USG system, but we'll see..."
4437		else
4438			echo "Looks kind of like a USG system, but we'll see..."
4439		fi
4440		echo exit 0 >usg
4441	fi
4442elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4443	echo "Looks kind of like a BSD system, but we'll see..."
4444	d_bsd="$define"
4445	echo exit 0 >bsd
4446else
4447	echo "Looks kind of like a Version 7 system, but we'll see..."
4448	echo exit 0 >v7
4449fi
4450case "$eunicefix" in
4451*unixtovms*)
4452	$cat <<'EOI'
4453There is, however, a strange, musty smell in the air that reminds me of
4454something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4455EOI
4456	echo exit 0 >eunice
4457	d_eunice="$define"
4458: it so happens the Eunice I know will not run shell scripts in Unix format
4459	;;
4460*)
4461	echo " "
4462	echo "Congratulations.  You aren't running Eunice."
4463	d_eunice="$undef"
4464	;;
4465esac
4466: Detect OS2.  The p_ variable is set above in the Head.U unit.
4467: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4468: semicolon as a patch separator
4469case "$p_" in
4470:) ;;
4471*)
4472	$cat <<'EOI'
4473I have the feeling something is not exactly right, however...don't tell me...
4474lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4475(Or you may be running DOS with DJGPP.)
4476EOI
4477	echo exit 0 >os2
4478	;;
4479esac
4480if test -f /xenix; then
4481	echo "Actually, this looks more like a XENIX system..."
4482	echo exit 0 >xenix
4483	d_xenix="$define"
4484else
4485	echo " "
4486	echo "It's not Xenix..."
4487	d_xenix="$undef"
4488fi
4489chmod +x xenix
4490$eunicefix xenix
4491if test -f /venix; then
4492	echo "Actually, this looks more like a VENIX system..."
4493	echo exit 0 >venix
4494else
4495	echo " "
4496	if ./xenix; then
4497		: null
4498	else
4499		echo "Nor is it Venix..."
4500	fi
4501fi
4502chmod +x bsd usg v7 osf1 eunice xenix venix os2
4503$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4504$rm -f foo
4505
4506: Check if we are using GNU gcc and what its version is
4507echo " "
4508echo "Checking for GNU cc in disguise and/or its version number..." >&4
4509$cat >try.c <<EOM
4510#include <stdio.h>
4511int main() {
4512#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4513#ifdef __VERSION__
4514	printf("%s\n", __VERSION__);
4515#else
4516	printf("%s\n", "1");
4517#endif
4518#endif
4519	return(0);
4520}
4521EOM
4522if $cc -o try $ccflags $ldflags try.c; then
4523	gccversion=`$run ./try`
4524	case "$gccversion" in
4525	'') echo "You are not using GNU cc." ;;
4526	*)  echo "You are using GNU cc $gccversion."
4527	    ccname=gcc
4528	    ;;
4529	esac
4530else
4531	echo " "
4532	echo "*** WHOA THERE!!! ***" >&4
4533	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4534	case "$knowitall" in
4535	'')
4536	echo "    You'd better start hunting for one and let me know about it." >&4
4537		exit 1
4538		;;
4539	esac
4540fi
4541$rm -f try try.*
4542case "$gccversion" in
45431*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4544esac
4545case "$gccversion" in
4546'') gccosandvers='' ;;
4547*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4548   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4549   gccshortvers=''
4550   case "$gccosandvers" in
4551   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4552   $osname$osvers) ;; # looking good
4553   $osname*) cat <<EOM >&4
4554
4555*** WHOA THERE!!! ***
4556
4557    Your gcc has not been compiled for the exact release of
4558    your operating system ($gccosandvers versus $osname$osvers).
4559
4560    In general it is a good idea to keep gcc synchronized with
4561    the operating system because otherwise serious problems
4562    may ensue when trying to compile software, like Perl.
4563
4564    I'm trying to be optimistic here, though, and will continue.
4565    If later during the configuration and build icky compilation
4566    problems appear (headerfile conflicts being the most common
4567    manifestation), I suggest reinstalling the gcc to match
4568    your operating system release.
4569
4570EOM
4571      ;;
4572   *) gccosandvers='' ;; # failed to parse, better be silent
4573   esac
4574   ;;
4575esac
4576case "$ccname" in
4577'') ccname="$cc" ;;
4578esac
4579
4580# gcc 3.* complain about adding -Idirectories that they already know about,
4581# so we will take those off from locincpth.
4582case "$gccversion" in
45833*)
4584    echo "main(){}">try.c
4585    for incdir in $locincpth; do
4586       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4587	     grep '^c[cp]p*[01]: warning: changing search order '`
4588       if test "X$warn" != X; then
4589	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4590       fi
4591    done
4592    $rm -f try try.*
4593esac
4594
4595: What should the include directory be ?
4596echo " "
4597$echo $n "Hmm...  $c"
4598dflt='/usr/include'
4599incpath=''
4600mips_type=''
4601if $test -f /bin/mips && /bin/mips; then
4602	echo "Looks like a MIPS system..."
4603	$cat >usr.c <<'EOCP'
4604#ifdef SYSTYPE_BSD43
4605/bsd43
4606#endif
4607EOCP
4608	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4609		dflt='/bsd43/usr/include'
4610		incpath='/bsd43'
4611		mips_type='BSD 4.3'
4612	else
4613		mips_type='System V'
4614	fi
4615	$rm -f usr.c usr.out
4616	echo "and you're compiling with the $mips_type compiler and libraries."
4617	xxx_prompt=y
4618	echo "exit 0" >mips
4619else
4620	echo "Doesn't look like a MIPS system."
4621	xxx_prompt=n
4622	echo "exit 1" >mips
4623fi
4624chmod +x mips
4625$eunicefix mips
4626case "$usrinc" in
4627'') ;;
4628*) dflt="$usrinc";;
4629esac
4630case "$xxx_prompt" in
4631y)	fn=d/
4632	echo " "
4633	rp='Where are the include files you want to use?'
4634	. ./getfile
4635	usrinc="$ans"
4636	;;
4637*)	usrinc="$dflt"
4638	;;
4639esac
4640
4641: see how we invoke the C preprocessor
4642echo " "
4643echo "Now, how can we feed standard input to your C preprocessor..." >&4
4644cat <<'EOT' >testcpp.c
4645#define ABC abc
4646#define XYZ xyz
4647ABC.XYZ
4648EOT
4649cd ..
4650if test ! -f cppstdin; then
4651	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4652		# AIX cc -E doesn't show the absolute headerfile
4653		# locations but we'll cheat by using the -M flag.
4654		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
4655	else
4656		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4657	fi
4658else
4659	echo "Keeping your $hint cppstdin wrapper."
4660fi
4661chmod 755 cppstdin
4662wrapper=`pwd`/cppstdin
4663ok='false'
4664cd UU
4665
4666if $test "X$cppstdin" != "X" && \
4667	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4668	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4669then
4670	echo "You used to use $cppstdin $cppminus so we'll use that again."
4671	case "$cpprun" in
4672	'') echo "But let's see if we can live without a wrapper..." ;;
4673	*)
4674		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4675			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4676		then
4677			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4678			ok='true'
4679		else
4680			echo "(However, $cpprun $cpplast does not work, let's see...)"
4681		fi
4682		;;
4683	esac
4684else
4685	case "$cppstdin" in
4686	'') ;;
4687	*)
4688		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4689		;;
4690	esac
4691fi
4692
4693if $ok; then
4694	: nothing
4695elif echo 'Maybe "'"$cc"' -E" will work...'; \
4696	$cc -E <testcpp.c >testcpp.out 2>&1; \
4697	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4698	echo "Yup, it does."
4699	x_cpp="$cc -E"
4700	x_minus='';
4701elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4702	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4703	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4704	echo "Yup, it does."
4705	x_cpp="$cc -E"
4706	x_minus='-';
4707elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4708	$cc -P <testcpp.c >testcpp.out 2>&1; \
4709	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4710	echo "Yipee, that works!"
4711	x_cpp="$cc -P"
4712	x_minus='';
4713elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4714	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4715	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4716	echo "At long last!"
4717	x_cpp="$cc -P"
4718	x_minus='-';
4719elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4720	$cpp <testcpp.c >testcpp.out 2>&1; \
4721	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4722	echo "It works!"
4723	x_cpp="$cpp"
4724	x_minus='';
4725elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4726	$cpp - <testcpp.c >testcpp.out 2>&1; \
4727	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4728	echo "Hooray, it works!  I was beginning to wonder."
4729	x_cpp="$cpp"
4730	x_minus='-';
4731elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4732	$wrapper <testcpp.c >testcpp.out 2>&1; \
4733	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4734	x_cpp="$wrapper"
4735	x_minus=''
4736	echo "Eureka!"
4737else
4738	dflt=''
4739	rp="No dice.  I can't find a C preprocessor.  Name one:"
4740	. ./myread
4741	x_cpp="$ans"
4742	x_minus=''
4743	$x_cpp <testcpp.c >testcpp.out 2>&1
4744	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4745		echo "OK, that will do." >&4
4746	else
4747echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4748		exit 1
4749	fi
4750fi
4751
4752case "$ok" in
4753false)
4754	cppstdin="$x_cpp"
4755	cppminus="$x_minus"
4756	cpprun="$x_cpp"
4757	cpplast="$x_minus"
4758	set X $x_cpp
4759	shift
4760	case "$1" in
4761	"$cpp")
4762		echo "Perhaps can we force $cc -E using a wrapper..."
4763		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4764			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4765		then
4766			echo "Yup, we can."
4767			cppstdin="$wrapper"
4768			cppminus='';
4769		else
4770			echo "Nope, we'll have to live without it..."
4771		fi
4772		;;
4773	esac
4774	case "$cpprun" in
4775	"$wrapper")
4776		cpprun=''
4777		cpplast=''
4778		;;
4779	esac
4780	;;
4781esac
4782
4783case "$cppstdin" in
4784"$wrapper"|'cppstdin') ;;
4785*) $rm -f $wrapper;;
4786esac
4787$rm -f testcpp.c testcpp.out
4788
4789: Set private lib path
4790case "$plibpth" in
4791'') if ./mips; then
4792		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4793	fi;;
4794esac
4795case "$libpth" in
4796' ') dlist='';;
4797'') dlist="$loclibpth $plibpth $glibpth";;
4798*) dlist="$libpth";;
4799esac
4800
4801: Now check and see which directories actually exist, avoiding duplicates
4802libpth=''
4803for xxx in $dlist
4804do
4805    if $test -d $xxx; then
4806		case " $libpth " in
4807		*" $xxx "*) ;;
4808		*) libpth="$libpth $xxx";;
4809		esac
4810    fi
4811done
4812$cat <<'EOM'
4813
4814Some systems have incompatible or broken versions of libraries.  Among
4815the directories listed in the question below, please remove any you
4816know not to be holding relevant libraries, and add any that are needed.
4817Say "none" for none.
4818
4819EOM
4820case "$libpth" in
4821'') dflt='none';;
4822*)
4823	set X $libpth
4824	shift
4825	dflt=${1+"$@"}
4826	;;
4827esac
4828rp="Directories to use for library searches?"
4829. ./myread
4830case "$ans" in
4831none) libpth=' ';;
4832*) libpth="$ans";;
4833esac
4834
4835: compute shared library extension
4836case "$so" in
4837'')
4838	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4839		dflt='sl'
4840	else
4841		dflt='so'
4842	fi
4843	;;
4844*) dflt="$so";;
4845esac
4846$cat <<EOM
4847
4848On some systems, shared libraries may be available.  Answer 'none' if
4849you want to suppress searching of shared libraries for the remainder
4850of this configuration.
4851
4852EOM
4853rp='What is the file extension used for shared libraries?'
4854. ./myread
4855so="$ans"
4856
4857: Define several unixisms.
4858: Hints files or command line option can be used to override them.
4859: The convoluted testing is in case hints files set either the old
4860: or the new name.
4861case "$_exe" in
4862'')	case "$exe_ext" in
4863	'')	;;
4864	*)	_exe="$exe_ext" ;;
4865	esac
4866	;;
4867esac
4868case "$_a" in
4869'')	case "$lib_ext" in
4870    '')	_a='.a';;
4871	*)	_a="$lib_ext" ;;
4872	esac
4873	;;
4874esac
4875case "$_o" in
4876'') case "$obj_ext" in
4877	'')	_o='.o';;
4878	*)	_o="$obj_ext";;
4879	esac
4880	;;
4881esac
4882case "$p_" in
4883'') case "$path_sep" in
4884	'')	p_=':';;
4885	*)	p_="$path_sep";;
4886	esac
4887	;;
4888esac
4889exe_ext=$_exe
4890lib_ext=$_a
4891obj_ext=$_o
4892path_sep=$p_
4893
4894rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4895
4896: Which makefile gets called first.  This is used by make depend.
4897case "$firstmakefile" in
4898'') firstmakefile='makefile';;
4899esac
4900
4901: Check for uselongdouble support
4902case "$ccflags" in
4903*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4904esac
4905
4906case "$uselongdouble" in
4907$define|true|[yY]*)	dflt='y';;
4908*) dflt='n';;
4909esac
4910cat <<EOM
4911
4912Perl can be built to take advantage of long doubles which
4913(if available) may give more accuracy and range for floating point numbers.
4914
4915If this doesn't make any sense to you, just accept the default '$dflt'.
4916EOM
4917rp='Try to use long doubles if available?'
4918. ./myread
4919case "$ans" in
4920y|Y) 	val="$define"	;;
4921*)      val="$undef"	;;
4922esac
4923set uselongdouble
4924eval $setvar
4925
4926case "$uselongdouble" in
4927true|[yY]*) uselongdouble="$define" ;;
4928esac
4929
4930: Look for a hint-file generated 'call-back-unit'.  If the
4931: user has specified that long doubles should be used,
4932: we may need to set or change some other defaults.
4933if $test -f uselongdouble.cbu; then
4934    echo "Your platform has some specific hints regarding long doubles, using them..."
4935    . ./uselongdouble.cbu
4936else
4937    case "$uselongdouble" in
4938	$define)
4939		$cat <<EOM
4940(Your platform does not have any specific hints for long doubles.)
4941EOM
4942	;;
4943    esac
4944fi
4945
4946: Looking for optional libraries
4947echo " "
4948echo "Checking for optional libraries..." >&4
4949case "$libs" in
4950' '|'') dflt='';;
4951*) dflt="$libs";;
4952esac
4953case "$libswanted" in
4954'') libswanted='c_s';;
4955esac
4956case "$usesocks" in
4957"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4958esac
4959libsfound=''
4960libsfiles=''
4961libsdirs=''
4962libspath=''
4963for thisdir in $libpth $xlibpth; do
4964  test -d $thisdir && libspath="$libspath $thisdir"
4965done
4966for thislib in $libswanted; do
4967	for thisdir in $libspath; do
4968	    xxx=''
4969	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4970		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4971	        $test -f "$xxx" && eval $libscheck
4972		$test -f "$xxx" && libstyle=shared
4973	    fi
4974	    if test ! -f "$xxx"; then
4975		xxx=$thisdir/lib$thislib.$so
4976	        $test -f "$xxx" && eval $libscheck
4977		$test -f "$xxx" && libstyle=shared
4978	    fi
4979	    if test ! -f "$xxx"; then
4980		xxx=$thisdir/lib$thislib$_a
4981	        $test -f "$xxx" && eval $libscheck
4982		$test -f "$xxx" && libstyle=static
4983	    fi
4984	    if test ! -f "$xxx"; then
4985		xxx=$thisdir/$thislib$_a
4986	        $test -f "$xxx" && eval $libscheck
4987		$test -f "$xxx" && libstyle=static
4988	    fi
4989	    if test ! -f "$xxx"; then
4990		xxx=$thisdir/lib${thislib}_s$_a
4991	        $test -f "$xxx" && eval $libscheck
4992		$test -f "$xxx" && libstyle=static
4993		$test -f "$xxx" && thislib=${thislib}_s
4994	    fi
4995	    if test ! -f "$xxx"; then
4996		xxx=$thisdir/Slib$thislib$_a
4997	        $test -f "$xxx" && eval $libscheck
4998		$test -f "$xxx" && libstyle=static
4999	    fi
5000	    if $test -f "$xxx"; then
5001		case "$libstyle" in
5002		shared) echo "Found -l$thislib (shared)." ;;
5003		static) echo "Found -l$thislib." ;;
5004		*)      echo "Found -l$thislib ($libstyle)." ;;
5005		esac
5006		case " $dflt " in
5007		*"-l$thislib "*);;
5008		*) dflt="$dflt -l$thislib"
5009                   libsfound="$libsfound $xxx"
5010                   yyy=`basename $xxx`
5011                   libsfiles="$libsfiles $yyy"
5012                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5013                   case " $libsdirs " in
5014                   *" $yyy "*) ;;
5015                   *) libsdirs="$libsdirs $yyy" ;;
5016                   esac
5017		   ;;
5018		esac
5019		break
5020	    fi
5021	done
5022	if $test ! -f "$xxx"; then
5023	    echo "No -l$thislib."
5024	fi
5025done
5026set X $dflt
5027shift
5028dflt="$*"
5029case "$libs" in
5030'') dflt="$dflt";;
5031*) dflt="$libs";;
5032esac
5033case "$dflt" in
5034' '|'') dflt='none';;
5035esac
5036
5037$cat <<EOM
5038
5039In order to compile $package on your machine, a number of libraries
5040are usually needed.  Include any other special libraries here as well.
5041Say "none" for none.  The default list is almost always right.
5042EOM
5043
5044echo " "
5045rp="What libraries to use?"
5046. ./myread
5047case "$ans" in
5048none) libs=' ';;
5049*) libs="$ans";;
5050esac
5051
5052: determine optimization, if desired, or use for debug flag also
5053case "$optimize" in
5054' '|$undef) dflt='none';;
5055'') dflt='-O';;
5056*) dflt="$optimize";;
5057esac
5058$cat <<EOH
5059
5060By default, $package compiles with the -O flag to use the optimizer.
5061Alternately, you might want to use the symbolic debugger, which uses
5062the -g flag (on traditional Unix systems).  Either flag can be
5063specified here.  To use neither flag, specify the word "none".
5064
5065EOH
5066rp="What optimizer/debugger flag should be used?"
5067. ./myread
5068optimize="$ans"
5069case "$optimize" in
5070'none') optimize=" ";;
5071esac
5072
5073: Check what DEBUGGING is required from the command line
5074: -DEBUGGING      or -DDEBUGGING or
5075: -DEBUGGING=both			= -g + -DDEBUGGING
5076: -DEBUGGING=-g   or -Doptimize=-g	= -g
5077: -DEBUGGING=none or -UDEBUGGING	=
5078: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5079case "$EBUGGING" in
5080'')	;;
5081*)	DEBUGGING=$EBUGGING ;;
5082esac
5083
5084case "$DEBUGGING" in
5085-g|both|$define)
5086    case "$optimize" in
5087	*-g*) ;;
5088	*)    optimize="$optimize -g" ;;
5089    esac ;;
5090none|$undef)
5091    case "$optimize" in
5092	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5093		shift
5094		optimize="$*"
5095		;;
5096    esac ;;
5097esac
5098
5099dflt=''
5100case "$DEBUGGING" in
5101both|$define) dflt='-DDEBUGGING'
5102esac
5103
5104: argument order is deliberate, as the flag will start with - which set could
5105: think is an option
5106checkccflag='check=$1; flag=$2; callback=$3;
5107echo " ";
5108echo "Checking if your compiler accepts $flag" 2>&1;
5109echo "int main(void) { return 0; }" > gcctest.c;
5110if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5111    echo "Yes, it does." 2>&1;
5112    if $test -s gcctest.out ; then
5113        echo "But your platform does not like it:";
5114        cat gcctest.out;
5115    else
5116	case "$ccflags" in
5117	*$check*)
5118	    echo "Leaving current flags $ccflags alone." 2>&1
5119	    ;;
5120	*) dflt="$dflt $flag";
5121	    eval $callback
5122	    ;;
5123	esac
5124    fi
5125else
5126    echo "Nope, it does not, but that is ok." 2>&1;
5127fi
5128'
5129
5130: We will not override a previous value, but we might want to
5131: augment a hint file
5132case "$hint" in
5133default|recommended)
5134	case "$gccversion" in
5135	1*) dflt="$dflt -fpcc-struct-return" ;;
5136	esac
5137	case "$optimize:$DEBUGGING" in
5138	*-g*:old) dflt="$dflt -DDEBUGGING";;
5139	esac
5140	case "$gccversion" in
5141	2*) if $test -d /etc/conf/kconfig.d &&
5142			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5143		then
5144			# Interactive Systems (ISC) POSIX mode.
5145			dflt="$dflt -posix"
5146		fi
5147		;;
5148	esac
5149	case "$gccversion" in
5150	1*) ;;
5151	2.[0-8]*) ;;
5152	?*)	set strict-aliasing -fno-strict-aliasing
5153		eval $checkccflag
5154		;;
5155	esac
5156	case "$gccversion" in
5157	1*) ;;
5158	2*) ;;
5159	?*) 	echo " "
5160		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5161		echo 'int main(void) { return 0; }' > gcctest.c
5162		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5163			echo "Yes, it does." 2>&1
5164			case "$ccflags" in
5165			*delete-null-pointer-checks*)
5166				echo "Leaving current flags $ccflags alone." 2>&1
5167				;;
5168			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5169			esac
5170		else
5171			echo "Nope, it doesn't, but that's ok." 2>&1
5172		fi
5173		;;
5174	esac
5175	# For gcc, adding -pipe speeds up compilations for some, but apparently
5176	# some assemblers can't read from stdin.  (It also slows down compilations
5177	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5178	case "$gccversion" in
5179	?*)	set pipe -pipe
5180		eval $checkccflag
5181		;;
5182	esac
5183
5184	# on x86_64 (at least) we require an extra library (libssp) in the
5185	# link command line. This library is not named, so I infer that it is
5186	# an implementation detail that may change. Hence the safest approach
5187	# is to add the flag to the flags passed to the compiler at link time,
5188	# as that way the compiler can do the right implementation dependant
5189	# thing. (NWC)
5190	case "$gccversion" in
5191	?*)	set stack-protector -fstack-protector
5192		eval $checkccflag
5193		;;
5194	esac
5195	;;
5196esac
5197
5198case "$mips_type" in
5199*BSD*|'') inclwanted="$locincpth $usrinc";;
5200*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5201esac
5202for thisincl in $inclwanted; do
5203	if $test -d $thisincl; then
5204		if $test x$thisincl != x$usrinc; then
5205			case "$dflt" in
5206			*" -I$thisincl "*);;
5207			*) dflt="$dflt -I$thisincl ";;
5208			esac
5209		fi
5210	fi
5211done
5212
5213inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5214	xxx=true;
5215elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5216	xxx=true;
5217else
5218	xxx=false;
5219fi;
5220if $xxx; then
5221	case "$dflt" in
5222	*$2*);;
5223	*) dflt="$dflt -D$2";;
5224	esac;
5225fi'
5226
5227set signal.h LANGUAGE_C; eval $inctest
5228
5229case "$usesocks" in
5230$define)
5231	ccflags="$ccflags -DSOCKS"
5232	;;
5233esac
5234
5235case "$hint" in
5236default|recommended) dflt="$ccflags $dflt" ;;
5237*) dflt="$ccflags";;
5238esac
5239
5240case "$dflt" in
5241''|' ') dflt=none;;
5242esac
5243
5244$cat <<EOH
5245
5246Your C compiler may want other flags.  For this question you should include
5247-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5248but you should NOT include libraries or ld flags like -lwhatever.  If you
5249want $package to honor its debug switch, you should include -DDEBUGGING here.
5250Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5251
5252To use no flags, specify the word "none".
5253
5254EOH
5255set X $dflt
5256shift
5257dflt=${1+"$@"}
5258rp="Any additional cc flags?"
5259. ./myread
5260case "$ans" in
5261none) ccflags='';;
5262*) ccflags="$ans";;
5263esac
5264
5265: the following weeds options from ccflags that are of no interest to cpp
5266case "$cppflags" in
5267'') cppflags="$ccflags" ;;
5268*)  cppflags="$cppflags $ccflags" ;;
5269esac
5270case "$gccversion" in
52711*) cppflags="$cppflags -D__GNUC__"
5272esac
5273case "$mips_type" in
5274'');;
5275*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5276esac
5277case "$cppflags" in
5278'');;
5279*)
5280	echo " "
5281	echo "Let me guess what the preprocessor flags are..." >&4
5282	set X $cppflags
5283	shift
5284	cppflags=''
5285	$cat >cpp.c <<'EOM'
5286#define BLURFL foo
5287
5288BLURFL xx LFRULB
5289EOM
5290	previous=''
5291	for flag in $*
5292	do
5293		case "$flag" in
5294		-*) ftry="$flag";;
5295		*) ftry="$previous $flag";;
5296		esac
5297		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5298			>cpp1.out 2>/dev/null && \
5299			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5300			>cpp2.out 2>/dev/null && \
5301			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5302			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5303		then
5304			cppflags="$cppflags $ftry"
5305			previous=''
5306		else
5307			previous="$flag"
5308		fi
5309	done
5310	set X $cppflags
5311	shift
5312	cppflags=${1+"$@"}
5313	case "$cppflags" in
5314	*-*)  echo "They appear to be: $cppflags";;
5315	esac
5316	$rm -f cpp.c cpp?.out
5317	;;
5318esac
5319
5320: flags used in final linking phase
5321case "$ldflags" in
5322'') if ./venix; then
5323		dflt='-i -z'
5324	else
5325		dflt=''
5326	fi
5327	case "$ccflags" in
5328	*-posix*) dflt="$dflt -posix" ;;
5329	esac
5330	;;
5331*) dflt="$ldflags";;
5332esac
5333# See note above about -fstack-protector
5334case "$ccflags" in
5335*-fstack-protector*)
5336	case "$dflt" in
5337	*-fstack-protector*) ;; # Don't add it again
5338	*) dflt="$dflt -fstack-protector" ;;
5339	esac
5340	;;
5341esac
5342
5343: Try to guess additional flags to pick up local libraries.
5344for thislibdir in $libpth; do
5345	case " $loclibpth " in
5346	*" $thislibdir "*)
5347		case "$dflt " in
5348		*"-L$thislibdir "*) ;;
5349		*)  dflt="$dflt -L$thislibdir" ;;
5350		esac
5351		;;
5352	esac
5353done
5354
5355case "$dflt" in
5356'') dflt='none' ;;
5357esac
5358
5359$cat <<EOH
5360
5361Your C linker may need flags.  For this question you should
5362include -L/whatever and any other flags used by the C linker, but you
5363should NOT include libraries like -lwhatever.
5364
5365Make sure you include the appropriate -L/path flags if your C linker
5366does not normally search all of the directories you specified above,
5367namely
5368	$libpth
5369To use no flags, specify the word "none".
5370
5371EOH
5372
5373rp="Any additional ld flags (NOT including libraries)?"
5374. ./myread
5375case "$ans" in
5376none) ldflags='';;
5377*) ldflags="$ans";;
5378esac
5379rmlist="$rmlist pdp11"
5380
5381: coherency check
5382echo " "
5383echo "Checking your choice of C compiler and flags for coherency..." >&4
5384$cat > try.c <<'EOF'
5385#include <stdio.h>
5386int main() { printf("Ok\n"); return(0); }
5387EOF
5388set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5389shift
5390$cat >try.msg <<'EOM'
5391I've tried to compile and run the following simple program:
5392
5393EOM
5394$cat try.c >> try.msg
5395
5396$cat >> try.msg <<EOM
5397
5398I used the command:
5399
5400	$*
5401	$run ./try
5402
5403and I got the following output:
5404
5405EOM
5406dflt=y
5407if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5408	if $sh -c "$run ./try " >>try.msg 2>&1; then
5409		xxx=`$run ./try`
5410		case "$xxx" in
5411		"Ok") dflt=n ;;
5412		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
5413			case " $libs " in
5414			*" -lsfio "*)
5415				cat >> try.msg <<'EOQS'
5416If $libs contains -lsfio, and sfio is mis-configured, then it
5417sometimes (apparently) runs and exits with a 0 status, but with no
5418output!  It may have to do with sfio's use of _exit vs. exit.
5419
5420EOQS
5421				rp="You have a big problem.  Shall I abort Configure"
5422				dflt=y
5423				;;
5424			esac
5425			;;
5426		esac
5427	else
5428		echo "The program compiled OK, but exited with status $?." >>try.msg
5429		rp="You have a problem.  Shall I abort Configure"
5430		dflt=y
5431	fi
5432else
5433	echo "I can't compile the test program." >>try.msg
5434	rp="You have a BIG problem.  Shall I abort Configure"
5435	dflt=y
5436fi
5437case "$dflt" in
5438y)
5439	$cat try.msg >&4
5440	case "$knowitall" in
5441	'')
5442		echo "(The supplied flags or libraries might be incorrect.)"
5443		;;
5444	*) dflt=n;;
5445	esac
5446	echo " "
5447	. ./myread
5448	case "$ans" in
5449	n*|N*) ;;
5450	*)	echo "Ok.  Stopping Configure." >&4
5451		exit 1
5452		;;
5453	esac
5454	;;
5455n) echo "OK, that should do.";;
5456esac
5457$rm_try gcctest gcctest.out
5458
5459: define a shorthand compile call
5460compile='
5461mc_file=$1;
5462shift;
5463case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5464echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5465exit 1;
5466fi;
5467esac;
5468$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5469: define a shorthand compile call for compilations that should be ok.
5470compile_ok='
5471mc_file=$1;
5472shift;
5473$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5474
5475: determine filename position in cpp output
5476echo " "
5477echo "Computing filename position in cpp output for #include directives..." >&4
5478case "$osname" in
5479vos) testaccess=-e ;;
5480*)   testaccess=-r ;;
5481esac
5482echo '#include <stdio.h>' > foo.c
5483$cat >fieldn <<EOF
5484$startsh
5485$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5486$grep '^[ 	]*#.*stdio\.h' | \
5487while read cline; do
5488	pos=1
5489	set \$cline
5490	while $test \$# -gt 0; do
5491		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5492			echo "\$pos"
5493			exit 0
5494		fi
5495		shift
5496		pos=\`expr \$pos + 1\`
5497	done
5498done
5499EOF
5500chmod +x fieldn
5501fieldn=`./fieldn`
5502$rm -f foo.c fieldn
5503case $fieldn in
5504'') pos='???';;
55051) pos=first;;
55062) pos=second;;
55073) pos=third;;
5508*) pos="${fieldn}th";;
5509esac
5510echo "Your cpp writes the filename in the $pos field of the line."
5511
5512case "$osname" in
5513vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5514os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5515*)   cppfilter='' ;;
5516esac
5517: locate header file
5518$cat >findhdr <<EOF
5519$startsh
5520wanted=\$1
5521name=''
5522for usrincdir in $usrinc
5523do
5524	if test -f \$usrincdir/\$wanted; then
5525		echo "\$usrincdir/\$wanted"
5526		exit 0
5527	fi
5528done
5529awkprg='{ print \$$fieldn }'
5530echo "#include <\$wanted>" > foo\$\$.c
5531$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5532$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5533while read cline; do
5534	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5535	case "\$name" in
5536	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5537	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5538	*) exit 2;;
5539	esac;
5540done;
5541#
5542# status = 0: grep returned 0 lines, case statement not executed
5543# status = 1: headerfile found
5544# status = 2: while loop executed, no headerfile found
5545#
5546status=\$?
5547$rm -f foo\$\$.c;
5548if test \$status -eq 1; then
5549	exit 0;
5550fi
5551exit 1
5552EOF
5553chmod +x findhdr
5554
5555: define an alternate in-header-list? function
5556inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5557cont=true; xxf="echo \"<\$1> found.\" >&4";
5558case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5559*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5560esac;
5561case $# in 4) instead=instead;; *) instead="at last";; esac;
5562while $test "$cont"; do
5563	xxx=`./findhdr $1`
5564	var=$2; eval "was=\$$2";
5565	if $test "$xxx" && $test -r "$xxx";
5566	then eval $xxf;
5567	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5568		cont="";
5569	else eval $xxnf;
5570	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5571	set $yyy; shift; shift; yyy=$@;
5572	case $# in 0) cont="";;
5573	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5574		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5575	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5576		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5577	esac;
5578done;
5579while $test "$yyy";
5580do set $yyy; var=$2; eval "was=\$$2";
5581	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5582	set $yyy; shift; shift; yyy=$@;
5583done'
5584
5585: see if stdlib is available
5586set stdlib.h i_stdlib
5587eval $inhdr
5588
5589: check for lengths of integral types
5590echo " "
5591case "$intsize" in
5592'')
5593	echo "Checking to see how big your integers are..." >&4
5594	$cat >try.c <<EOCP
5595#include <stdio.h>
5596#$i_stdlib I_STDLIB
5597#ifdef I_STDLIB
5598#include <stdlib.h>
5599#endif
5600int main()
5601{
5602	printf("intsize=%d;\n", (int)sizeof(int));
5603	printf("longsize=%d;\n", (int)sizeof(long));
5604	printf("shortsize=%d;\n", (int)sizeof(short));
5605	exit(0);
5606}
5607EOCP
5608	set try
5609	if eval $compile_ok && $run ./try > /dev/null; then
5610		eval `$run ./try`
5611		echo "Your integers are $intsize bytes long."
5612		echo "Your long integers are $longsize bytes long."
5613		echo "Your short integers are $shortsize bytes long."
5614	else
5615		$cat >&4 <<EOM
5616!
5617Help! I can't compile and run the intsize test program: please enlighten me!
5618(This is probably a misconfiguration in your system or libraries, and
5619you really ought to fix it.  Still, I'll try anyway.)
5620!
5621EOM
5622		dflt=4
5623		rp="What is the size of an integer (in bytes)?"
5624		. ./myread
5625		intsize="$ans"
5626		dflt=$intsize
5627		rp="What is the size of a long integer (in bytes)?"
5628		. ./myread
5629		longsize="$ans"
5630		dflt=2
5631		rp="What is the size of a short integer (in bytes)?"
5632		. ./myread
5633		shortsize="$ans"
5634	fi
5635	;;
5636esac
5637$rm_try
5638
5639: check for long long
5640echo " "
5641echo "Checking to see if you have long long..." >&4
5642echo 'int main() { long long x = 7; return 0; }' > try.c
5643set try
5644if eval $compile; then
5645	val="$define"
5646	echo "You have long long."
5647else
5648	val="$undef"
5649	echo "You do not have long long."
5650fi
5651$rm_try
5652set d_longlong
5653eval $setvar
5654
5655: check for length of long long
5656case "${d_longlong}${longlongsize}" in
5657$define)
5658	echo " "
5659	echo "Checking to see how big your long longs are..." >&4
5660	$cat >try.c <<'EOCP'
5661#include <stdio.h>
5662int main()
5663{
5664    printf("%d\n", (int)sizeof(long long));
5665    return(0);
5666}
5667EOCP
5668	set try
5669	if eval $compile_ok; then
5670		longlongsize=`$run ./try`
5671		echo "Your long longs are $longlongsize bytes long."
5672	else
5673		dflt='8'
5674		echo " "
5675		echo "(I can't seem to compile the test program.  Guessing...)"
5676		rp="What is the size of a long long (in bytes)?"
5677		. ./myread
5678		longlongsize="$ans"
5679	fi
5680	if $test "X$longsize" = "X$longlongsize"; then
5681		echo "(That isn't any different from an ordinary long.)"
5682	fi
5683	;;
5684esac
5685$rm_try
5686
5687: see if inttypes.h is available
5688: we want a real compile instead of Inhdr because some systems
5689: have an inttypes.h which includes non-existent headers
5690echo " "
5691$cat >try.c <<EOCP
5692#include <inttypes.h>
5693int main() {
5694	static int32_t foo32 = 0x12345678;
5695}
5696EOCP
5697set try
5698if eval $compile; then
5699	echo "<inttypes.h> found." >&4
5700	val="$define"
5701else
5702	echo "<inttypes.h> NOT found." >&4
5703	val="$undef"
5704fi
5705$rm_try
5706set i_inttypes
5707eval $setvar
5708
5709: check for int64_t
5710echo " "
5711echo "Checking to see if you have int64_t..." >&4
5712$cat >try.c <<EOCP
5713#include <sys/types.h>
5714#$i_inttypes I_INTTYPES
5715#ifdef I_INTTYPES
5716#include <inttypes.h>
5717#endif
5718int main() { int64_t x = 7; }
5719EOCP
5720set try
5721if eval $compile; then
5722	val="$define"
5723	echo "You have int64_t."
5724else
5725	val="$undef"
5726	echo "You do not have int64_t."
5727fi
5728$rm_try
5729set d_int64_t
5730eval $setvar
5731
5732: Check if 64bit ints have a quad type
5733echo " "
5734echo "Checking which 64-bit integer type we could use..." >&4
5735
5736case "$intsize" in
57378) val=int
5738   set quadtype
5739   eval $setvar
5740   val='"unsigned int"'
5741   set uquadtype
5742   eval $setvar
5743   quadkind=1
5744   ;;
5745*) case "$longsize" in
5746   8) val=long
5747      set quadtype
5748      eval $setvar
5749      val='"unsigned long"'
5750      set uquadtype
5751      eval $setvar
5752      quadkind=2
5753      ;;
5754   *) case "$d_longlong:$longlongsize" in
5755      define:8)
5756        val='"long long"'
5757        set quadtype
5758        eval $setvar
5759        val='"unsigned long long"'
5760        set uquadtype
5761        eval $setvar
5762        quadkind=3
5763        ;;
5764      *) case "$d_int64_t" in
5765         define)
5766           val=int64_t
5767           set quadtype
5768           eval $setvar
5769           val=uint64_t
5770           set uquadtype
5771           eval $setvar
5772           quadkind=4
5773           ;;
5774         esac
5775         ;;
5776      esac
5777      ;;
5778   esac
5779   ;;
5780esac
5781
5782case "$quadtype" in
5783'')	echo "Alas, no 64-bit integer types in sight." >&4
5784	d_quad="$undef"
5785	;;
5786*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5787	d_quad="$define"
5788	;;
5789esac
5790
5791: Do we want 64bit support
5792case "$uselonglong" in
5793"$define"|true|[yY]*)
5794	cat <<EOM >&4
5795
5796*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5797EOM
5798	use64bitint="$define"
5799	;;
5800esac
5801case "$use64bits" in
5802"$define"|true|[yY]*)
5803	cat <<EOM >&4
5804
5805*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5806EOM
5807	use64bitint="$define"
5808	;;
5809esac
5810case "$use64bitints" in
5811"$define"|true|[yY]*)
5812	cat <<EOM >&4
5813
5814*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5815EOM
5816	use64bitint="$define"
5817	;;
5818esac
5819case "$use64bitsint" in
5820"$define"|true|[yY]*)
5821	cat <<EOM >&4
5822
5823*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5824EOM
5825	use64bitint="$define"
5826	;;
5827esac
5828case "$uselonglongs" in
5829"$define"|true|[yY]*)
5830	cat <<EOM >&4
5831
5832*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5833EOM
5834	use64bitint="$define"
5835	;;
5836esac
5837case "$use64bitsall" in
5838"$define"|true|[yY]*)
5839	cat <<EOM >&4
5840
5841*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5842EOM
5843	use64bitall="$define"
5844	;;
5845esac
5846
5847case "$ccflags" in
5848*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5849esac
5850case "$use64bitall" in
5851"$define"|true|[yY]*) use64bitint="$define" ;;
5852esac
5853
5854case "$longsize" in
58558) cat <<EOM
5856
5857You have natively 64-bit long integers.
5858EOM
5859   val="$define"
5860   ;;
5861*) case "$use64bitint" in
5862   "$define"|true|[yY]*) dflt='y';;
5863   *) dflt='n';;
5864   esac
5865   case "$d_quad" in
5866   "$define") ;;
5867   *) dflt='n' ;;
5868   esac
5869   cat <<EOM
5870
5871Perl can be built to take advantage of 64-bit integer types
5872on some systems.  To do so, Configure can be run with -Duse64bitint.
5873Choosing this option will most probably introduce binary incompatibilities.
5874
5875If this doesn't make any sense to you, just accept the default '$dflt'.
5876(The default has been chosen based on your configuration.)
5877EOM
5878   rp='Try to use 64-bit integers, if available?'
5879   . ./myread
5880   case "$ans" in
5881   [yY]*) val="$define" ;;
5882   *)     val="$undef"  ;;
5883   esac
5884   ;;
5885esac
5886set use64bitint
5887eval $setvar
5888
5889case "$use64bitall" in
5890"$define"|true|[yY]*) dflt='y' ;;
5891*) case "$longsize" in
5892   8) dflt='y' ;;
5893   *) dflt='n' ;;
5894   esac
5895   ;;
5896esac
5897cat <<EOM
5898
5899You may also choose to try maximal 64-bitness.  It means using as much
590064-bitness as possible on the platform.  This in turn means even more
5901binary incompatibilities.  On the other hand, your platform may not
5902have any more 64-bitness available than what you already have chosen.
5903
5904If this doesn't make any sense to you, just accept the default '$dflt'.
5905(The default has been chosen based on your configuration.)
5906EOM
5907rp='Try to use maximal 64-bit support, if available?'
5908. ./myread
5909case "$ans" in
5910[yY]*) val="$define" ;;
5911*)     val="$undef"  ;;
5912esac
5913set use64bitall
5914eval $setvar
5915case "$use64bitall" in
5916"$define")
5917	case "$use64bitint" in
5918	"$undef")
5919		cat <<EOM
5920
5921Since you have chosen a maximally 64-bit build, I'm also turning on
5922the use of 64-bit integers.
5923EOM
5924		use64bitint="$define" ;;
5925	esac
5926	;;
5927esac
5928
5929: Look for a hint-file generated 'call-back-unit'.  If the
5930: user has specified that a 64-bit perl is to be built,
5931: we may need to set or change some other defaults.
5932if $test -f use64bitint.cbu; then
5933	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5934	. ./use64bitint.cbu
5935fi
5936case "$use64bitint" in
5937"$define"|true|[yY]*)
5938	case "$longsize" in
5939	4) case "$archname64" in
5940	   '') archname64=64int ;;
5941	   esac
5942	   ;;
5943	esac
5944	;;
5945esac
5946
5947: Look for a hint-file generated 'call-back-unit'.  If the
5948: user has specified that a maximally 64-bit perl is to be built,
5949: we may need to set or change some other defaults.
5950if $test -f use64bitall.cbu; then
5951	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5952	. ./use64bitall.cbu
5953fi
5954case "$use64bitall" in
5955"$define"|true|[yY]*)
5956	case "$longsize" in
5957	4) case "$archname64" in
5958	   ''|64int) archname64=64all ;;
5959	   esac
5960	   ;;
5961	esac
5962	;;
5963esac
5964
5965case "$d_quad:$use64bitint" in
5966$undef:$define)
5967	cat >&4 <<EOF
5968
5969*** You have chosen to use 64-bit integers,
5970*** but none can be found.
5971*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5972*** Cannot continue, aborting.
5973
5974EOF
5975	exit 1
5976	;;
5977esac
5978
5979: check for length of double
5980echo " "
5981case "$doublesize" in
5982'')
5983	echo "Checking to see how big your double precision numbers are..." >&4
5984	$cat >try.c <<EOCP
5985#include <stdio.h>
5986#$i_stdlib I_STDLIB
5987#ifdef I_STDLIB
5988#include <stdlib.h>
5989#endif
5990int main()
5991{
5992    printf("%d\n", (int)sizeof(double));
5993    exit(0);
5994}
5995EOCP
5996	set try
5997	if eval $compile_ok; then
5998		doublesize=`$run ./try`
5999		echo "Your double is $doublesize bytes long."
6000	else
6001		dflt='8'
6002		echo "(I can't seem to compile the test program.  Guessing...)"
6003		rp="What is the size of a double precision number (in bytes)?"
6004		. ./myread
6005		doublesize="$ans"
6006	fi
6007	;;
6008esac
6009$rm_try
6010
6011: check for long doubles
6012echo " "
6013echo "Checking to see if you have long double..." >&4
6014echo 'int main() { long double x = 7.0; }' > try.c
6015set try
6016if eval $compile; then
6017	val="$define"
6018	echo "You have long double."
6019else
6020	val="$undef"
6021	echo "You do not have long double."
6022fi
6023$rm_try
6024set d_longdbl
6025eval $setvar
6026
6027: check for length of long double
6028case "${d_longdbl}${longdblsize}" in
6029$define)
6030	echo " "
6031	echo "Checking to see how big your long doubles are..." >&4
6032	$cat >try.c <<'EOCP'
6033#include <stdio.h>
6034int main()
6035{
6036	printf("%d\n", sizeof(long double));
6037}
6038EOCP
6039	set try
6040	set try
6041	if eval $compile; then
6042		longdblsize=`$run ./try`
6043		echo "Your long doubles are $longdblsize bytes long."
6044	else
6045		dflt='8'
6046		echo " "
6047		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6048		rp="What is the size of a long double (in bytes)?"
6049		. ./myread
6050		longdblsize="$ans"
6051	fi
6052	if $test "X$doublesize" = "X$longdblsize"; then
6053		echo "That isn't any different from an ordinary double."
6054		echo "I'll keep your setting anyway, but you may see some"
6055		echo "harmless compilation warnings."
6056	fi
6057	;;
6058esac
6059$rm_try
6060
6061: determine the architecture name
6062echo " "
6063if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6064	tarch=`arch`"-$osname"
6065elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6066	if uname -m > tmparch 2>&1 ; then
6067		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6068			-e 's/$/'"-$osname/" tmparch`
6069	else
6070		tarch="$osname"
6071	fi
6072	$rm -f tmparch
6073else
6074	tarch="$osname"
6075fi
6076case "$myarchname" in
6077''|"$tarch") ;;
6078*)
6079	echo "(Your architecture name used to be $myarchname.)"
6080	archname=''
6081	;;
6082esac
6083case "$targetarch" in
6084'') ;;
6085*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6086esac
6087myarchname="$tarch"
6088case "$archname" in
6089'') dflt="$tarch";;
6090*) dflt="$archname";;
6091esac
6092rp='What is your architecture name'
6093. ./myread
6094archname="$ans"
6095case "$usethreads" in
6096$define)
6097	echo "Threads selected." >&4
6098	case "$archname" in
6099        *-thread*) echo "...and architecture name already has -thread." >&4
6100                ;;
6101        *)      archname="$archname-thread"
6102                echo "...setting architecture name to $archname." >&4
6103                ;;
6104        esac
6105	;;
6106esac
6107case "$usemultiplicity" in
6108$define)
6109	echo "Multiplicity selected." >&4
6110	case "$archname" in
6111        *-multi*) echo "...and architecture name already has -multi." >&4
6112                ;;
6113        *)      archname="$archname-multi"
6114                echo "...setting architecture name to $archname." >&4
6115                ;;
6116        esac
6117	;;
6118esac
6119case "$use64bitint$use64bitall" in
6120*"$define"*)
6121	case "$archname64" in
6122	'')
6123		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6124		;;
6125	*)
6126		case "$use64bitint" in
6127		"$define") echo "64 bit integers selected." >&4 ;;
6128		esac
6129		case "$use64bitall" in
6130		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6131		esac
6132		case "$archname" in
6133	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6134	                ;;
6135	        *)      archname="$archname-$archname64"
6136	                echo "...setting architecture name to $archname." >&4
6137	                ;;
6138	        esac
6139		;;
6140	esac
6141esac
6142case "$uselongdouble" in
6143$define)
6144	echo "Long doubles selected." >&4
6145	case "$longdblsize" in
6146	$doublesize)
6147		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6148		;;
6149	*)
6150		case "$archname" in
6151	        *-ld*) echo "...and architecture name already has -ld." >&4
6152	                ;;
6153	        *)      archname="$archname-ld"
6154	                echo "...setting architecture name to $archname." >&4
6155        	        ;;
6156	        esac
6157		;;
6158	esac
6159	;;
6160esac
6161case "$useperlio" in
6162$define)
6163	echo "Perlio selected." >&4
6164	;;
6165*)
6166	echo "Perlio not selected, using stdio." >&4
6167	case "$archname" in
6168        *-stdio*) echo "...and architecture name already has -stdio." >&4
6169                ;;
6170        *)      archname="$archname-stdio"
6171                echo "...setting architecture name to $archname." >&4
6172                ;;
6173        esac
6174	;;
6175esac
6176if $test -f archname.cbu; then
6177	echo "Your platform has some specific hints for architecture name, using them..."
6178	. ./archname.cbu
6179fi
6180
6181: set the prefixit variable, to compute a suitable default value
6182prefixit='case "$3" in
6183""|none)
6184	case "$oldprefix" in
6185	"") eval "$1=\"\$$2\"";;
6186	*)
6187		case "$3" in
6188		"") eval "$1=";;
6189		none)
6190			eval "tp=\"\$$2\"";
6191			case "$tp" in
6192			""|" ") eval "$1=\"\$$2\"";;
6193			*) eval "$1=";;
6194			esac;;
6195		esac;;
6196	esac;;
6197*)
6198	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6199	case "$tp" in
6200	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6201	/*-$oldprefix/*|\~*-$oldprefix/*)
6202		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6203	*) eval "$1=\"\$$2\"";;
6204	esac;;
6205esac'
6206
6207: determine installation style
6208: For now, try to deduce it from prefix unless it is already set.
6209: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6210case "$installstyle" in
6211'')	case "$prefix" in
6212		*perl*) dflt='lib';;
6213		*) dflt='lib/perl5' ;;
6214	esac
6215	;;
6216*)	dflt="$installstyle" ;;
6217esac
6218: Probably not worth prompting for this since we prompt for all
6219: the directories individually, and the prompt would be too long and
6220: confusing anyway.
6221installstyle=$dflt
6222
6223: determine where public executables go
6224echo " "
6225set dflt bin bin
6226eval $prefixit
6227fn=d~
6228rp='Pathname where the public executables will reside?'
6229. ./getfile
6230if $test "X$ansexp" != "X$binexp"; then
6231	installbin=''
6232fi
6233prefixvar=bin
6234: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6235: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6236:     this via initialinstalllocation
6237. ./setprefixvar
6238
6239case "$userelocatableinc" in
6240$define|true|[yY]*)	dflt='y' ;;
6241*)			dflt='n' ;;
6242esac
6243cat <<EOM
6244
6245Would you like to build Perl so that the installation is relocatable, so that
6246library paths in @INC are determined relative to the path of the perl binary?
6247This is not advised for system Perl installs, or if you need to run setid
6248scripts or scripts under taint mode.
6249
6250If this doesn't make any sense to you, just accept the default '$dflt'.
6251EOM
6252rp='Use relocatable @INC?'
6253. ./myread
6254case "$ans" in
6255y|Y)	val="$define" ;;
6256*)	val="$undef"  ;;
6257esac
6258set userelocatableinc
6259eval $setvar
6260
6261initialinstalllocation="$binexp"
6262: Default prefix is now "up one level from where the binaries are"
6263case "$userelocatableinc" in
6264$define|true|[yY]*)
6265    bin=".../"
6266    binexp=".../"
6267    prefix=".../.."
6268    prefixexp=".../.."
6269    installprefixexp=".../.."
6270    ;;
6271esac
6272
6273: determine where private library files go
6274: Usual default is /usr/local/lib/perl5/$version.
6275: Also allow things like /opt/perl/lib/$version, since
6276: /opt/perl/lib/perl5... would be redundant.
6277: The default "style" setting is made in installstyle.U
6278case "$installstyle" in
6279*lib/perl5*) set dflt privlib lib/$package/$version ;;
6280*)	 set dflt privlib lib/$version ;;
6281esac
6282eval $prefixit
6283$cat <<EOM
6284
6285There are some auxiliary files for $package that need to be put into a
6286private library directory that is accessible by everyone.
6287
6288EOM
6289fn=$binexp
6290fn=d~+
6291rp='Pathname where the private library files will reside?'
6292. ./getfile
6293prefixvar=privlib
6294. ./setprefixvar
6295
6296: set the prefixup variable, to restore leading tilda escape
6297prefixup='case "$prefixexp" in
6298"$prefix") ;;
6299*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6300esac'
6301
6302: determine where public architecture dependent libraries go
6303set archlib archlib
6304eval $prefixit
6305: privlib default is /usr/local/lib/$package/$version
6306: archlib default is /usr/local/lib/$package/$version/$archname
6307: privlib may have an optional trailing /share.
6308tdflt=`echo $privlib | $sed 's,/share$,,'`
6309tdflt=$tdflt/$archname
6310case "$archlib" in
6311'')	dflt=$tdflt
6312	;;
6313*)	dflt="$archlib"
6314    ;;
6315esac
6316$cat <<EOM
6317
6318$spackage contains architecture-dependent library files.  If you are
6319sharing libraries in a heterogeneous environment, you might store
6320these files in a separate location.  Otherwise, you can just include
6321them with the rest of the public library files.
6322
6323EOM
6324fn=$binexp
6325fn=d+~
6326rp='Where do you want to put the public architecture-dependent libraries?'
6327. ./getfile
6328prefixvar=archlib
6329. ./setprefixvar
6330if $test X"$archlib" = X"$privlib"; then
6331	d_archlib="$undef"
6332else
6333	d_archlib="$define"
6334fi
6335
6336: see if setuid scripts can be secure
6337$cat <<EOM
6338
6339Some kernels have a bug that prevents setuid #! scripts from being
6340secure.  Some sites have disabled setuid #! scripts because of this.
6341
6342First let's decide if your kernel supports secure setuid #! scripts.
6343(If setuid #! scripts would be secure but have been disabled anyway,
6344don't say that they are secure if asked.)
6345
6346EOM
6347
6348val="$undef"
6349if $test -d /dev/fd; then
6350	echo "#!$ls" >reflect
6351	chmod +x,u+s reflect
6352	./reflect >flect 2>&1
6353	if $contains "/dev/fd" flect >/dev/null; then
6354		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6355		val="$define"
6356	else
6357		$cat <<EOM
6358If you are not sure if they are secure, I can check but I'll need a
6359username and password different from the one you are using right now.
6360If you don't have such a username or don't want me to test, simply
6361enter 'none'.
6362
6363EOM
6364		rp='Other username to test security of setuid scripts with?'
6365		dflt='none'
6366		. ./myread
6367		case "$ans" in
6368		n|none)
6369			case "$d_suidsafe" in
6370			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6371				dflt=n;;
6372			"$undef")
6373				echo "Well, the $hint value is *not* secure." >&4
6374				dflt=n;;
6375			*)	echo "Well, the $hint value *is* secure." >&4
6376				dflt=y;;
6377			esac
6378			;;
6379		*)
6380			$rm -f reflect flect
6381			echo "#!$ls" >reflect
6382			chmod +x,u+s reflect
6383			echo >flect
6384			chmod a+w flect
6385			echo '"su" will (probably) prompt you for '"$ans's password."
6386			su $ans -c './reflect >flect'
6387			if $contains "/dev/fd" flect >/dev/null; then
6388				echo "Okay, it looks like setuid scripts are secure." >&4
6389				dflt=y
6390			else
6391				echo "I don't think setuid scripts are secure." >&4
6392				dflt=n
6393			fi
6394			;;
6395		esac
6396		rp='Does your kernel have *secure* setuid scripts?'
6397		. ./myread
6398		case "$ans" in
6399		[yY]*)	val="$define";;
6400		*)	val="$undef";;
6401		esac
6402	fi
6403else
6404	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6405	echo "(That's for file descriptors, not floppy disks.)"
6406	val="$undef"
6407fi
6408set d_suidsafe
6409eval $setvar
6410
6411$rm -f reflect flect
6412
6413: now see if they want to do setuid emulation
6414if $test $patchlevel -lt 11; then
6415echo " "
6416val="$undef"
6417case "$d_suidsafe" in
6418"$define")
6419	val="$undef"
6420	echo "No need to emulate SUID scripts since they are secure here." >&4
6421	;;
6422*)
6423	$cat <<EOM
6424Some systems have disabled setuid scripts, especially systems where
6425setuid scripts cannot be secure.  On systems where setuid scripts have
6426been disabled, the setuid/setgid bits on scripts are currently
6427useless.  It is possible for $package to detect those bits and emulate
6428setuid/setgid in a secure fashion.  This emulation will only work if
6429setuid scripts have been disabled in your kernel.
6430
6431EOM
6432	case "$d_dosuid" in
6433	"$define") dflt=y ;;
6434	*) dflt=n ;;
6435	esac
6436	rp="Do you want to do setuid/setgid emulation?"
6437	. ./myread
6438	case "$ans" in
6439	[yY]*)	val="$define";;
6440	*)	val="$undef";;
6441	esac
6442	;;
6443esac
6444set d_dosuid
6445eval $setvar
6446else
6447    case "$d_dosuid" in
6448	"$define")
6449	cat >&4 <<EOH
6450
6451SUID emulation has been removed for 5.12
6452Please re-run Configure without -Dd_dosuid
6453
6454EOH
6455	exit 1;
6456	;;
6457    esac
6458    d_dosuid=undef
6459fi
6460
6461: Find perl5.005 or later.
6462echo "Looking for a previously installed perl5.005 or later... "
6463case "$perl5" in
6464'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6465		: Check if this perl is recent and can load a simple module
6466		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6467			perl5=$tdir/perl
6468			break;
6469		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6470			perl5=$tdir/perl5
6471			break;
6472		fi
6473	done
6474	;;
6475*)	perl5="$perl5"
6476	;;
6477esac
6478case "$perl5" in
6479'')	echo "None found.  That's ok.";;
6480*)	echo "Using $perl5." ;;
6481esac
6482
6483: Set the siteprefix variables
6484$cat <<EOM
6485
6486After $package is installed, you may wish to install various
6487add-on modules and utilities.  Typically, these add-ons will
6488be installed under $prefix with the rest
6489of this package.  However, you may wish to install such add-ons
6490elsewhere under a different prefix.
6491
6492If you do not wish to put everything under a single prefix, that's
6493ok.  You will be prompted for the individual locations; this siteprefix
6494is only used to suggest the defaults.
6495
6496The default should be fine for most people.
6497
6498EOM
6499fn=d~+
6500rp='Installation prefix to use for add-on modules and utilities?'
6501: XXX Here might be another good place for an installstyle setting.
6502case "$siteprefix" in
6503'') dflt=$prefix ;;
6504*)  dflt=$siteprefix ;;
6505esac
6506. ./getfile
6507: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6508oldsiteprefix=''
6509case "$siteprefix" in
6510'') ;;
6511*)	case "$ans" in
6512	"$prefix") ;;
6513	*) oldsiteprefix="$prefix";;
6514	esac
6515	;;
6516esac
6517siteprefix="$ans"
6518siteprefixexp="$ansexp"
6519
6520: determine where site specific libraries go.
6521: Usual default is /usr/local/lib/perl5/site_perl/$version
6522: The default "style" setting is made in installstyle.U
6523: XXX No longer works with Prefixit stuff.
6524prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6525case "$sitelib" in
6526'') case "$installstyle" in
6527	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6528	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6529	esac
6530	;;
6531*)	dflt="$sitelib"
6532	;;
6533esac
6534$cat <<EOM
6535
6536The installation process will create a directory for
6537site-specific extensions and modules.  Most users find it convenient
6538to place all site-specific files in this directory rather than in the
6539main distribution directory.
6540
6541EOM
6542fn=d~+
6543rp='Pathname for the site-specific library files?'
6544. ./getfile
6545prefixvar=sitelib
6546. ./setprefixvar
6547sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6548
6549: Determine list of previous versions to include in @INC
6550$cat > getverlist <<EOPL
6551#!$perl5 -w
6552use File::Basename;
6553\$api_versionstring = "$api_versionstring";
6554\$version = "$version";
6555\$stem = "$sitelib_stem";
6556\$archname = "$archname";
6557EOPL
6558	$cat >> getverlist <<'EOPL'
6559# The list found is store twice for each entry: the original name, and
6560# the binary broken down version as pack "sss", so sorting is easy and
6561# unambiguous. This will work for all versions that have a maximum of
6562# three digit groups, separate by '.'s or '_'s. Names are extended with
6563# ".0.0" to ensure at least three elements for the pack.
6564#					-- H.Merijn Brand (m)'06 23-10-2006
6565
6566# Can't have leading @ because metaconfig interprets it as a command!
6567;@inc_version_list=();
6568# XXX Redo to do opendir/readdir?
6569if (-d $stem) {
6570    chdir($stem);
6571    ;@candidates = map {
6572	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6573    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6574}
6575else {
6576    ;@candidates = ();
6577}
6578
6579($pversion, $aversion, $vsn5005) = map {
6580    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6581foreach $d (@candidates) {
6582    if ($d->[1] lt $pversion) {
6583	if ($d->[1] ge $aversion) {
6584	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6585	}
6586	elsif ($d->[1] ge $vsn5005) {
6587	    unshift(@inc_version_list, grep { -d } $d->[0]);
6588	}
6589    }
6590    else {
6591	# Skip newer version.  I.e. don't look in
6592	# 5.7.0 if we're installing 5.6.1.
6593    }
6594}
6595
6596if (@inc_version_list) {
6597    print join(' ', @inc_version_list);
6598}
6599else {
6600    # Blank space to preserve value for next Configure run.
6601    print " ";
6602}
6603EOPL
6604chmod +x getverlist
6605case "$inc_version_list" in
6606'')	if test -x "$perl5$exe_ext"; then
6607		dflt=`$perl5 getverlist`
6608	else
6609		dflt='none'
6610	fi
6611	;;
6612$undef) dflt='none' ;;
6613*)  eval dflt=\"$inc_version_list\" ;;
6614esac
6615case "$dflt" in
6616''|' ') dflt=none ;;
6617esac
6618case "$dflt" in
66195.005) dflt=none ;;
6620esac
6621$cat <<EOM
6622
6623In order to ease the process of upgrading, this version of perl
6624can be configured to use modules built and installed with earlier
6625versions of perl that were installed under $prefix.  Specify here
6626the list of earlier versions that this version of perl should check.
6627If Configure detected no earlier versions of perl installed under
6628$prefix, then the list will be empty.  Answer 'none' to tell perl
6629to not search earlier versions.
6630
6631The default should almost always be sensible, so if you're not sure,
6632just accept the default.
6633EOM
6634
6635rp='List of earlier versions to include in @INC?'
6636. ./myread
6637case "$ans" in
6638[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6639*) inc_version_list="$ans" ;;
6640esac
6641case "$inc_version_list" in
6642''|' ')
6643	inc_version_list_init='0'
6644	d_inc_version_list="$undef"
6645	;;
6646*)	inc_version_list_init=`echo $inc_version_list |
6647		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6648	d_inc_version_list="$define"
6649	;;
6650esac
6651$rm -f getverlist
6652
6653: see if malloc/malloc.h has to be included
6654set malloc/malloc.h i_mallocmalloc
6655eval $inhdr
6656
6657: see if this is a malloc.h system
6658: we want a real compile instead of Inhdr because some systems have a
6659: malloc.h that just gives a compile error saying to use stdlib.h instead
6660echo " "
6661$cat >try.c <<EOCP
6662#include <stdlib.h>
6663#include <malloc.h>
6664#$i_mallocmalloc I_MALLOCMALLOC
6665#ifdef I_MALLOCMALLOC
6666# include <malloc/malloc.h>
6667#endif
6668
6669int main () { return 0; }
6670EOCP
6671set try
6672if eval $compile; then
6673    echo "<malloc.h> found." >&4
6674    val="$define"
6675else
6676    echo "<malloc.h> NOT found." >&4
6677    val="$undef"
6678fi
6679$rm_try
6680set i_malloc
6681eval $setvar
6682
6683: check for void type
6684echo " "
6685echo "Checking to see how well your C compiler groks the void type..." >&4
6686case "$voidflags" in
6687'')
6688	$cat >try.c <<EOCP
6689#$i_stdlib I_STDLIB
6690#ifdef I_STDLIB
6691#include <stdlib.h>
6692#endif
6693#if TRY & 1
6694void sub() {
6695#else
6696sub() {
6697#endif
6698	extern void moo();	/* function returning void */
6699	void (*goo)();		/* ptr to func returning void */
6700#if TRY & 8
6701	void *hue;		/* generic ptr */
6702#endif
6703#if TRY & 2
6704	void (*foo[10])();
6705#endif
6706
6707#if TRY & 4
6708	if(goo == moo) {
6709		exit(0);
6710	}
6711#endif
6712	exit(0);
6713}
6714int main() { sub(); }
6715EOCP
6716	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6717		voidflags=$defvoidused
6718	echo "Good.  It appears to support void to the level $package wants.">&4
6719		if $contains warning .out >/dev/null 2>&1; then
6720			echo "However, you might get some warnings that look like this:"
6721			$cat .out
6722		fi
6723	else
6724echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6725		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6726			echo "It supports 1..."
6727			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6728				echo "It also supports 2..."
6729				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6730					voidflags=7
6731					echo "And it supports 4 but not 8 definitely."
6732				else
6733					echo "It doesn't support 4..."
6734					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6735						voidflags=11
6736						echo "But it supports 8."
6737					else
6738						voidflags=3
6739						echo "Neither does it support 8."
6740					fi
6741				fi
6742			else
6743				echo "It does not support 2..."
6744				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6745					voidflags=13
6746					echo "But it supports 4 and 8."
6747				else
6748					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6749						voidflags=5
6750						echo "And it supports 4 but has not heard about 8."
6751					else
6752						echo "However it supports 8 but not 4."
6753					fi
6754				fi
6755			fi
6756		else
6757			echo "There is no support at all for void."
6758			voidflags=0
6759		fi
6760	fi
6761esac
6762case "$voidflags" in
6763"$defvoidused") ;;
6764*)	$cat >&4 <<'EOM'
6765  Support flag bits are:
6766    1: basic void declarations.
6767    2: arrays of pointers to functions returning void.
6768    4: operations between pointers to and addresses of void functions.
6769    8: generic void pointers.
6770EOM
6771	dflt="$voidflags";
6772	rp="Your void support flags add up to what?"
6773	. ./myread
6774	voidflags="$ans"
6775	;;
6776esac
6777$rm_try
6778
6779: check for length of pointer
6780echo " "
6781case "$ptrsize" in
6782'')
6783	echo "Checking to see how big your pointers are..." >&4
6784	if test "$voidflags" -gt 7; then
6785		echo '#define VOID_PTR char *' > try.c
6786	else
6787		echo '#define VOID_PTR void *' > try.c
6788	fi
6789	$cat >>try.c <<EOCP
6790#include <stdio.h>
6791#$i_stdlib I_STDLIB
6792#ifdef I_STDLIB
6793#include <stdlib.h>
6794#endif
6795int main()
6796{
6797    printf("%d\n", (int)sizeof(VOID_PTR));
6798    exit(0);
6799}
6800EOCP
6801	set try
6802	if eval $compile_ok; then
6803		ptrsize=`$run ./try`
6804		echo "Your pointers are $ptrsize bytes long."
6805	else
6806		dflt='4'
6807		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6808		rp="What is the size of a pointer (in bytes)?"
6809		. ./myread
6810		ptrsize="$ans"
6811	fi
6812	;;
6813esac
6814$rm_try
6815case "$use64bitall" in
6816"$define"|true|[yY]*)
6817	case "$ptrsize" in
6818	4)	cat <<EOM >&4
6819
6820*** You have chosen a maximally 64-bit build,
6821*** but your pointers are only 4 bytes wide.
6822*** Please rerun Configure without -Duse64bitall.
6823EOM
6824		case "$d_quad" in
6825		define)
6826			cat <<EOM >&4
6827*** Since you have quads, you could possibly try with -Duse64bitint.
6828EOM
6829			;;
6830		esac
6831		cat <<EOM >&4
6832*** Cannot continue, aborting.
6833
6834EOM
6835
6836		exit 1
6837		;;
6838	esac
6839	;;
6840esac
6841
6842
6843: determine whether to use malloc wrapping
6844echo " "
6845case "$usemallocwrap" in
6846[yY]*|true|$define)	dflt='y' ;;
6847[nN]*|false|$undef)	dflt='n' ;;
6848*)	case "$usedevel" in
6849	[yY]*|true|$define)	dflt='y' ;;
6850	*) dflt='n' ;;
6851	esac
6852	;;
6853esac
6854rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6855. ./myread
6856usemallocwrap="$ans"
6857case "$ans" in
6858y*|true)
6859	usemallocwrap="$define" ;;
6860*)
6861	usemallocwrap="$undef" ;;
6862esac
6863
6864: determine which malloc to compile in
6865echo " "
6866case "$usemymalloc" in
6867[yY]*|true|$define)	dflt='y' ;;
6868[nN]*|false|$undef)	dflt='n' ;;
6869*)	case "$ptrsize" in
6870	4) dflt='y' ;;
6871	*) dflt='n' ;;
6872	esac
6873	;;
6874esac
6875rp="Do you wish to attempt to use the malloc that comes with $package?"
6876. ./myread
6877usemymalloc="$ans"
6878case "$ans" in
6879y*|true)
6880	usemymalloc='y'
6881	mallocsrc='malloc.c'
6882	mallocobj="malloc$_o"
6883	d_mymalloc="$define"
6884	case "$libs" in
6885	*-lmalloc*)
6886		: Remove malloc from list of libraries to use
6887		echo "Removing unneeded -lmalloc from library list" >&4
6888		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6889		shift
6890		libs="$*"
6891		echo "libs = $libs" >&4
6892		;;
6893	esac
6894	;;
6895*)
6896	usemymalloc='n'
6897	mallocsrc=''
6898	mallocobj=''
6899	d_mymalloc="$undef"
6900	;;
6901esac
6902
6903: compute the return types of malloc and free
6904echo " "
6905$cat >malloc.c <<END
6906#$i_malloc I_MALLOC
6907#$i_stdlib I_STDLIB
6908#include <stdio.h>
6909#include <sys/types.h>
6910#ifdef I_MALLOC
6911#include <malloc.h>
6912#endif
6913#ifdef I_STDLIB
6914#include <stdlib.h>
6915#endif
6916#ifdef TRY_MALLOC
6917void *malloc();
6918#endif
6919#ifdef TRY_FREE
6920void free();
6921#endif
6922END
6923case "$malloctype" in
6924'')
6925	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6926		malloctype='void *'
6927	else
6928		malloctype='char *'
6929	fi
6930	;;
6931esac
6932echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6933
6934case "$freetype" in
6935'')
6936	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6937		freetype='void'
6938	else
6939		freetype='int'
6940	fi
6941	;;
6942esac
6943echo "Your system uses $freetype free(), it would seem." >&4
6944$rm -f malloc.[co]
6945: determine where site specific architecture-dependent libraries go.
6946: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6947: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6948: sitelib may have an optional trailing /share.
6949case "$sitearch" in
6950'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6951	dflt="$dflt/$archname"
6952	;;
6953*)	dflt="$sitearch"
6954	;;
6955esac
6956set sitearch sitearch none
6957eval $prefixit
6958$cat <<EOM
6959
6960The installation process will also create a directory for
6961architecture-dependent site-specific extensions and modules.
6962
6963EOM
6964fn=d~+
6965rp='Pathname for the site-specific architecture-dependent library files?'
6966. ./getfile
6967prefixvar=sitearch
6968. ./setprefixvar
6969if $test X"$sitearch" = X"$sitelib"; then
6970	d_sitearch="$undef"
6971else
6972	d_sitearch="$define"
6973fi
6974
6975: Set the vendorprefix variables
6976$cat <<EOM
6977
6978The installation process will also create a directory for
6979vendor-supplied add-ons.  Vendors who supply perl with their system
6980may find it convenient to place all vendor-supplied files in this
6981directory rather than in the main distribution directory.  This will
6982ease upgrades between binary-compatible maintenance versions of perl.
6983
6984Of course you may also use these directories in whatever way you see
6985fit.  For example, you might use them to access modules shared over a
6986company-wide network.
6987
6988The default answer should be fine for most people.
6989This causes further questions about vendor add-ons to be skipped
6990and no vendor-specific directories will be configured for perl.
6991
6992EOM
6993rp='Do you want to configure vendor-specific add-on directories?'
6994case "$usevendorprefix" in
6995define|true|[yY]*) dflt=y ;;
6996*)	: User may have set vendorprefix directly on Configure command line.
6997	case "$vendorprefix" in
6998	''|' ') dflt=n ;;
6999	*)	dflt=y ;;
7000	esac
7001	;;
7002esac
7003. ./myread
7004case "$ans" in
7005[yY]*)	fn=d~+
7006	rp='Installation prefix to use for vendor-supplied add-ons?'
7007	case "$vendorprefix" in
7008	'') dflt='' ;;
7009	*)  dflt=$vendorprefix ;;
7010	esac
7011	. ./getfile
7012	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7013	oldvendorprefix=''
7014	case "$vendorprefix" in
7015	'') ;;
7016	*)	case "$ans" in
7017		"$prefix") ;;
7018		*) oldvendorprefix="$prefix";;
7019		esac
7020		;;
7021	esac
7022	usevendorprefix="$define"
7023	vendorprefix="$ans"
7024	vendorprefixexp="$ansexp"
7025	;;
7026*)	usevendorprefix="$undef"
7027	vendorprefix=''
7028	vendorprefixexp=''
7029	;;
7030esac
7031
7032: Set the vendorlib variables
7033case "$vendorprefix" in
7034'')	d_vendorlib="$undef"
7035	vendorlib=''
7036	vendorlibexp=''
7037	;;
7038*)	d_vendorlib="$define"
7039	: determine where vendor-supplied modules go.
7040	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
7041	case "$vendorlib" in
7042	'')
7043		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7044		case "$installstyle" in
7045		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7046		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7047		esac
7048		;;
7049	*)	dflt="$vendorlib"
7050		;;
7051	esac
7052	fn=d~+
7053	rp='Pathname for the vendor-supplied library files?'
7054	. ./getfile
7055	vendorlib="$ans"
7056	vendorlibexp="$ansexp"
7057	;;
7058esac
7059vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7060prefixvar=vendorlib
7061. ./installprefix
7062
7063: Set the vendorarch variables
7064case "$vendorprefix" in
7065'')	d_vendorarch="$undef"
7066	vendorarch=''
7067	vendorarchexp=''
7068	;;
7069*)	d_vendorarch="$define"
7070	: determine where vendor-supplied architecture-dependent libraries go.
7071	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7072	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7073	: vendorlib may have an optional trailing /share.
7074	case "$vendorarch" in
7075	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
7076		dflt="$dflt/$archname"
7077		;;
7078	*)	dflt="$vendorarch" ;;
7079	esac
7080	fn=d~+
7081	rp='Pathname for vendor-supplied architecture-dependent files?'
7082	. ./getfile
7083	vendorarch="$ans"
7084	vendorarchexp="$ansexp"
7085	;;
7086esac
7087prefixvar=vendorarch
7088. ./installprefix
7089if $test X"$vendorarch" = X"$vendorlib"; then
7090	d_vendorarch="$undef"
7091else
7092	d_vendorarch="$define"
7093fi
7094
7095: Final catch-all directories to search
7096$cat <<EOM
7097
7098Lastly, you can have perl look in other directories for extensions and
7099modules in addition to those already specified.
7100These directories will be searched after 
7101	$sitearch 
7102	$sitelib 
7103EOM
7104test X"$vendorlib" != "X" && echo '	' $vendorlib
7105test X"$vendorarch" != "X" && echo '	' $vendorarch
7106echo ' '
7107case "$otherlibdirs" in
7108''|' ') dflt='none' ;;
7109*)	dflt="$otherlibdirs" ;;
7110esac
7111$cat <<EOM
7112Enter a colon-separated set of extra paths to include in perl's @INC
7113search path, or enter 'none' for no extra paths.
7114
7115EOM
7116
7117rp='Colon-separated list of additional directories for perl to search?'
7118. ./myread
7119case "$ans" in
7120' '|''|none)	otherlibdirs=' ' ;;
7121*)	otherlibdirs="$ans" ;;
7122esac
7123case "$otherlibdirs" in
7124' ') val=$undef ;;
7125*)	val=$define ;;
7126esac
7127set d_perl_otherlibdirs
7128eval $setvar
7129
7130: Cruising for prototypes
7131echo " "
7132echo "Checking out function prototypes..." >&4
7133$cat >prototype.c <<EOCP
7134#$i_stdlib I_STDLIB
7135#ifdef I_STDLIB
7136#include <stdlib.h>
7137#endif
7138int main(int argc, char *argv[]) {
7139	exit(0);}
7140EOCP
7141if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7142	echo "Your C compiler appears to support function prototypes."
7143	val="$define"
7144else
7145	echo "Your C compiler doesn't seem to understand function prototypes."
7146	val="$undef"
7147fi
7148set prototype
7149eval $setvar
7150$rm -f prototype*
7151
7152: Check if ansi2knr is required
7153case "$prototype" in
7154"$define") ;;
7155*)	ansi2knr='ansi2knr'
7156	echo " "
7157	cat <<EOM >&4
7158
7159$me:  FATAL ERROR:
7160This version of $package can only be compiled by a compiler that 
7161understands function prototypes.  Unfortunately, your C compiler 
7162	$cc $ccflags
7163doesn't seem to understand them.  Sorry about that.
7164
7165If GNU cc is available for your system, perhaps you could try that instead.  
7166
7167Eventually, we hope to support building Perl with pre-ANSI compilers.
7168If you would like to help in that effort, please contact <perlbug@perl.org>.
7169
7170Aborting Configure now.
7171EOM
7172	exit 2
7173	;;
7174esac
7175
7176: DTrace support
7177dflt_dtrace='/usr/sbin/dtrace'
7178$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7179
7180cat <<EOM
7181
7182Perl can be built to support DTrace on platforms that support it.
7183DTrace is a diagnosis and performance analysis tool from Sun.
7184
7185If this doesn't make any sense to you, just accept the default '$dflt'.
7186EOM
7187
7188while $test 1 ; do
7189	case "$usedtrace" in
7190	$define|true|[yY]*)
7191		dflt='y'
7192		;;
7193	?*)
7194		dflt='y'
7195		dflt_dtrace=$usedtrace
7196		;;
7197	*)
7198		dflt='n'
7199		;;
7200	esac
7201
7202	rp='Support DTrace if available?'
7203	. ./myread
7204	case "$ans" in
7205	y|Y)	val="$define" ;;
7206	*)      val="$undef" ;;
7207	esac
7208	set usedtrace
7209	eval $setvar
7210
7211	test "X$usedtrace" != "X$define" && break
7212
7213	echo " "
7214	rp='Where is the dtrace executable?'
7215	dflt=$dflt_dtrace
7216	. ./getfile
7217	val="$ans"
7218	set dtrace
7219	eval $setvar
7220
7221	if $test -f $dtrace
7222	then
7223		if $dtrace -h -s ../perldtrace.d \
7224			-o perldtrace.tmp >/dev/null 2>&1 \
7225			&& rm -f perldtrace.tmp
7226		then
7227			echo " "
7228			echo "Good: your $dtrace knows about the -h flag."
7229		else
7230			cat >&2 <<EOM
7231
7232*** $me:  Fatal Error:  $dtrace doesn't support -h flag
7233***
7234*** Your installed dtrace doesn't support the -h switch to compile a D
7235*** program into a C header. Can't continue.
7236
7237EOM
7238			exit 1
7239		fi
7240		break;
7241	fi
7242
7243	case "$fastread" in
7244	yes)
7245		cat >&2 <<EOM
7246
7247*** $me:  Fatal Error:  $dtrace not found.
7248*** Can't continue.
7249
7250EOM
7251		exit 1
7252		;;
7253	*)
7254		echo "*** $dtrace was not found."
7255		echo " "
7256		;;
7257	esac
7258done
7259
7260: See if we want extra modules installed
7261echo " "
7262case "$extras" in
7263'') dflt='n';;
7264*) dflt='y';;
7265esac
7266cat <<EOM
7267Perl can be built with extra modules or bundles of modules which
7268will be fetched from the CPAN and installed alongside Perl.
7269
7270Notice that you will need access to the CPAN; either via the Internet,
7271or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7272be asked later to configure the CPAN.pm module which will in turn do
7273the installation of the rest of the extra modules or bundles.)
7274
7275Notice also that if the modules require any external software such as
7276libraries and headers (the libz library and the zlib.h header for the
7277Compress::Zlib module, for example) you MUST have any such software
7278already installed, this configuration process will NOT install such
7279things for you.
7280
7281If this doesn't make any sense to you, just accept the default '$dflt'.
7282EOM
7283rp='Install any extra modules (y or n)?'
7284. ./myread
7285case "$ans" in
7286y|Y)
7287	cat <<EOM
7288
7289Please list any extra modules or bundles to be installed from CPAN,
7290with spaces between the names.  The names can be in any format the
7291'install' command of CPAN.pm will understand.  (Answer 'none',
7292without the quotes, to install no extra modules or bundles.)
7293EOM
7294	rp='Extras?'
7295	dflt="$extras"
7296	. ./myread
7297	extras="$ans"
7298esac
7299case "$extras" in
7300''|'none')
7301	val=''
7302	$rm -f ../extras.lst
7303	;;
7304*)	echo "(Saving the list of extras for later...)"
7305	echo "$extras" > ../extras.lst
7306	val="'$extras'"
7307	;;
7308esac
7309set extras
7310eval $setvar
7311echo " "
7312
7313: determine where html pages for programs go
7314set html1dir html1dir none
7315eval $prefixit
7316$cat <<EOM
7317
7318If you wish to install html files for programs in $spackage, indicate
7319the appropriate directory here.  To skip installing html files,
7320answer "none".
7321EOM
7322case "$html1dir" in
7323''|none|$undef|' ') dflt=none ;;
7324*) dflt=$html1dir ;;
7325esac
7326fn=dn+~
7327rp="Directory for the main $spackage html pages?"
7328. ./getfile
7329prefixvar=html1dir
7330. ./setprefixvar
7331: Use ' ' for none so value is preserved next time through Configure
7332$test X"$html1dir" = "X" && html1dir=' '
7333
7334: determine where html pages for libraries and modules go
7335set html3dir html3dir none
7336eval $prefixit
7337$cat <<EOM
7338
7339If you wish to install html files for modules associated with $spackage,
7340indicate the appropriate directory here.  To skip installing html files,
7341answer "none".
7342EOM
7343: There is no obvious default.  If they have specified html1dir, then
7344: try to key off that, possibly changing .../html1 into .../html3.
7345case "$html3dir" in
7346'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7347*) dflt=$html3dir ;;
7348esac
7349fn=dn+~
7350rp="Directory for the $spackage module html pages?"
7351. ./getfile
7352prefixvar=html3dir
7353. ./setprefixvar
7354: Use ' ' for none so value is preserved next time through Configure
7355$test X"$html3dir" = "X" && html3dir=' '
7356
7357: determine whether to install perl also as /usr/bin/perl
7358
7359echo " "
7360if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7361	$cat <<EOM
7362Many scripts expect perl to be installed as /usr/bin/perl.
7363
7364If you want to, I can install the perl you are about to compile
7365as /usr/bin/perl (in addition to $bin/perl).
7366EOM
7367	if test -f /usr/bin/perl; then
7368	    $cat <<EOM
7369
7370However, please note that because you already have a /usr/bin/perl,
7371overwriting that with a new Perl would very probably cause problems.
7372Therefore I'm assuming you don't want to do that (unless you insist).
7373
7374EOM
7375	    case "$installusrbinperl" in
7376	    "$define"|[yY]*)	dflt='y';;
7377	    *)			dflt='n';;
7378	    esac
7379	else
7380	    $cat <<EOM
7381
7382Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7383
7384EOM
7385	    case "$installusrbinperl" in
7386	    "$undef"|[nN]*)	dflt='n';;
7387	    *)			dflt='y';;
7388	    esac
7389	fi
7390	rp="Do you want to install perl as /usr/bin/perl?"
7391	. ./myread
7392	case "$ans" in
7393	[yY]*)	val="$define";;
7394	*)	val="$undef" ;;
7395	esac
7396else
7397	val="$undef"
7398fi
7399set installusrbinperl
7400eval $setvar
7401
7402: Check if we are using the GNU C library
7403echo " "
7404echo "Checking for GNU C Library..." >&4
7405cat >try.c <<'EOCP'
7406/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7407   alone are insufficient to distinguish different versions, such as
7408   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7409   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7410*/
7411#include <stdio.h>
7412int main(void)
7413{
7414#ifdef __GLIBC__
7415#   ifdef __GLIBC_MINOR__
7416#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7417#           include <gnu/libc-version.h>
7418	    printf("%s\n",  gnu_get_libc_version());
7419#       else
7420	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7421#       endif
7422#   else
7423	printf("%d\n",  __GLIBC__);
7424#   endif
7425    return 0;
7426#else
7427    return 1;
7428#endif
7429}
7430EOCP
7431set try
7432if eval $compile_ok && $run ./try > glibc.ver; then
7433	val="$define"
7434	gnulibc_version=`$cat glibc.ver`
7435	echo "You are using the GNU C Library version $gnulibc_version"
7436else
7437	val="$undef"
7438	gnulibc_version=''
7439	echo "You are not using the GNU C Library"
7440fi
7441$rm_try glibc.ver
7442set d_gnulibc
7443eval $setvar
7444
7445: see if nm is to be used to determine whether a symbol is defined or not
7446case "$usenm" in
7447'')
7448	dflt=''
7449	case "$d_gnulibc" in
7450	"$define")
7451		echo " "
7452		echo "nm probably won't work on the GNU C Library." >&4
7453		dflt=n
7454		;;
7455	esac
7456	case "$dflt" in
7457	'')
7458		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7459			echo " "
7460			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7461			echo "'nm' won't be sufficient on this sytem." >&4
7462			dflt=n
7463		fi
7464		;;
7465	esac
7466	case "$dflt" in
7467	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7468		if $test $dflt -gt 20; then
7469			dflt=y
7470		else
7471			dflt=n
7472		fi
7473		;;
7474	esac
7475	;;
7476*)
7477	case "$usenm" in
7478	true|$define) dflt=y;;
7479	*) dflt=n;;
7480	esac
7481	;;
7482esac
7483$cat <<EOM
7484
7485I can use $nm to extract the symbols from your C libraries. This
7486is a time consuming task which may generate huge output on the disk (up
7487to 3 megabytes) but that should make the symbols extraction faster. The
7488alternative is to skip the 'nm' extraction part and to compile a small
7489test program instead to determine whether each symbol is present. If
7490you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7491this may be the best solution.
7492
7493You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7494
7495EOM
7496rp="Shall I use $nm to extract C symbols from the libraries?"
7497. ./myread
7498case "$ans" in
7499[Nn]*) usenm=false;;
7500*) usenm=true;;
7501esac
7502
7503runnm=$usenm
7504case "$reuseval" in
7505true) runnm=false;;
7506esac
7507
7508: nm options which may be necessary
7509case "$nm_opt" in
7510'') if $test -f /mach_boot; then
7511		nm_opt=''	# Mach
7512	elif $test -d /usr/ccs/lib; then
7513		nm_opt='-p'	# Solaris (and SunOS?)
7514	elif $test -f /dgux; then
7515		nm_opt='-p'	# DG-UX
7516	elif $test -f /lib64/rld; then
7517		nm_opt='-p'	# 64-bit Irix
7518	else
7519		nm_opt=''
7520	fi;;
7521esac
7522
7523: nm options which may be necessary for shared libraries but illegal
7524: for archive libraries.  Thank you, Linux.
7525case "$nm_so_opt" in
7526'')	case "$myuname" in
7527	*linux*|gnu*)
7528		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7529			nm_so_opt='--dynamic'
7530		fi
7531		;;
7532	esac
7533	;;
7534esac
7535
7536: Figure out where the libc is located
7537case "$runnm" in
7538true)
7539: get list of predefined functions in a handy place
7540echo " "
7541case "$libc" in
7542'') libc=unknown
7543	case "$libs" in
7544	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7545	esac
7546	;;
7547esac
7548case "$libs" in
7549'') ;;
7550*)  for thislib in $libs; do
7551	case "$thislib" in
7552	-lc|-lc_s)
7553		: Handle C library specially below.
7554		;;
7555	-l*)
7556		thislib=`echo $thislib | $sed -e 's/^-l//'`
7557		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7558			:
7559		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7560			:
7561		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7562			:
7563		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7564			:
7565		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7566			:
7567		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7568			:
7569		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7570			:
7571		else
7572			try=''
7573		fi
7574		libnames="$libnames $try"
7575		;;
7576	*) libnames="$libnames $thislib" ;;
7577	esac
7578	done
7579	;;
7580esac
7581xxx=normal
7582case "$libc" in
7583unknown)
7584	set /lib/libc.$so
7585	for xxx in $libpth; do
7586		$test -r $1 || set $xxx/libc.$so
7587		: The messy sed command sorts on library version numbers.
7588		$test -r $1 || \
7589			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7590			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7591				h
7592				s/[0-9][0-9]*/0000&/g
7593				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7594				G
7595				s/\n/ /' | \
7596			 $sort | $sed -e 's/^.* //'`
7597		eval set \$$#
7598	done
7599	$test -r $1 || set /usr/ccs/lib/libc.$so
7600	$test -r $1 || set /lib/libsys_s$_a
7601	;;
7602*)
7603	set blurfl
7604	;;
7605esac
7606if $test -r "$1"; then
7607	echo "Your (shared) C library seems to be in $1."
7608	libc="$1"
7609elif $test -r /lib/libc && $test -r /lib/clib; then
7610	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7611	xxx=apollo
7612	libc='/lib/clib /lib/libc'
7613	if $test -r /lib/syslib; then
7614		echo "(Your math library is in /lib/syslib.)"
7615		libc="$libc /lib/syslib"
7616	fi
7617elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7618	echo "Your C library seems to be in $libc, as you said before."
7619elif $test -r $incpath/usr/lib/libc$_a; then
7620	libc=$incpath/usr/lib/libc$_a;
7621	echo "Your C library seems to be in $libc.  That's fine."
7622elif $test -r /lib/libc$_a; then
7623	libc=/lib/libc$_a;
7624	echo "Your C library seems to be in $libc.  You're normal."
7625else
7626	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7627		:
7628	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7629		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7630	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7631		:
7632	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7633		:
7634	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7635		:
7636	else
7637		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7638	fi
7639	if $test -r "$tans"; then
7640		echo "Your C library seems to be in $tans, of all places."
7641		libc=$tans
7642	else
7643		libc='blurfl'
7644	fi
7645fi
7646if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7647	dflt="$libc"
7648	cat <<EOM
7649
7650If the guess above is wrong (which it might be if you're using a strange
7651compiler, or your machine supports multiple models), you can override it here.
7652
7653EOM
7654else
7655	dflt=''
7656	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7657	cat >&4 <<EOM
7658I can't seem to find your C library.  I've looked in the following places:
7659
7660EOM
7661	$sed 's/^/	/' libpath
7662	cat <<EOM
7663
7664None of these seems to contain your C library. I need to get its name...
7665
7666EOM
7667fi
7668fn=f
7669rp='Where is your C library?'
7670. ./getfile
7671libc="$ans"
7672
7673echo " "
7674echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7675set X `cat libnames`
7676shift
7677xxx=files
7678case $# in 1) xxx=file; esac
7679echo "Extracting names from the following $xxx for later perusal:" >&4
7680echo " "
7681$sed 's/^/	/' libnames >&4
7682echo " "
7683$echo $n "This may take a while...$c" >&4
7684
7685for file in $*; do
7686	case $file in
7687	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7688	*) $nm $nm_opt $file 2>/dev/null;;
7689	esac
7690done >libc.tmp
7691
7692$echo $n ".$c"
7693$grep fprintf libc.tmp > libc.ptf
7694xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7695xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7696xxx='[ADTSIW]'
7697if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7698	eval $xscan;\
7699	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7700		eval $xrun
7701elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7702	eval $xscan;\
7703	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7704		eval $xrun
7705elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7706	eval $xscan;\
7707	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7708		eval $xrun
7709elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7710	eval $xscan;\
7711	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7712		eval $xrun
7713elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7714	eval $xscan;\
7715	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7716		eval $xrun
7717elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7718	eval $xscan;\
7719	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7720		eval $xrun
7721elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7722				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7723	eval $xscan;\
7724	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7725		eval $xrun
7726elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7727	eval $xscan;\
7728	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7729		eval $xrun
7730elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7731	eval $xscan;\
7732	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7733		eval $xrun
7734elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7735	eval $xscan;\
7736	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7737		eval $xrun
7738elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7739	eval $xscan;\
7740	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7741		eval $xrun
7742elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7743	eval $xscan;\
7744	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7745		eval $xrun
7746elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7747	eval $xscan;\
7748	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7749		eval $xrun
7750elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7751	eval $xscan;\
7752	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7753		eval $xrun
7754else
7755	$nm -p $* 2>/dev/null >libc.tmp
7756	$grep fprintf libc.tmp > libc.ptf
7757	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7758		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7759	then
7760		nm_opt='-p'
7761		eval $xrun
7762	else
7763		echo " "
7764		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7765		com=''
7766		if $ar t $libc > libc.tmp && \
7767			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
7768		then
7769			for thisname in $libnames $libc; do
7770				$ar t $thisname >>libc.tmp
7771			done
7772			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7773			echo "Ok." >&4
7774		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7775			for thisname in $libnames $libc; do
7776				$ar tv $thisname >>libc.tmp
7777				emximp -o tmp.imp $thisname \
7778				    2>/dev/null && \
7779				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7780				    < tmp.imp >>libc.tmp
7781				$rm -f tmp.imp
7782			done
7783			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7784			echo "Ok." >&4
7785		else
7786			echo "$ar didn't seem to work right." >&4
7787			echo "Maybe this is a Cray...trying bld instead..." >&4
7788			if  bld t $libc | \
7789				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7790				$test -s libc.list
7791			then
7792				for thisname in $libnames; do
7793					bld t $libnames | \
7794					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7795					$ar t $thisname >>libc.tmp
7796				done
7797				echo "Ok." >&4
7798			else
7799				echo "That didn't work either.  Giving up." >&4
7800				exit 1
7801			fi
7802		fi
7803	fi
7804fi
7805nm_extract="$com"
7806case "$PASE" in
7807define)
7808    echo " "
7809    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7810    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7811    ;;
7812*)  if $test -f /lib/syscalls.exp; then
7813	echo " "
7814	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7815	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
7816		/lib/syscalls.exp >>libc.list
7817    fi
7818    ;;
7819esac
7820;;
7821esac
7822$rm -f libnames libpath
7823
7824: see if dld is available
7825set dld.h i_dld
7826eval $inhdr
7827
7828: Check if we are using C++
7829echo " "
7830echo "Checking for C++..." >&4
7831$cat >try.c <<'EOCP'
7832#include <stdio.h>
7833int main(void)
7834{
7835#ifdef __cplusplus
7836    return 0;
7837#else
7838    return 1;
7839#endif
7840}
7841EOCP
7842set try
7843if eval $compile_ok && $run ./try; then
7844	val="$define"
7845	echo "You are using a C++ compiler."
7846else
7847	val="$undef"
7848	echo "You are not using a C++ compiler."
7849fi
7850$rm_try cplusplus$$
7851set d_cplusplus
7852eval $setvar
7853
7854: is a C symbol defined?
7855csym='tlook=$1;
7856case "$3" in
7857-v) tf=libc.tmp; tdc="";;
7858-a) tf=libc.tmp; tdc="[]";;
7859*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7860esac;
7861case "$d_cplusplus" in
7862    $define)	extern_C="extern \"C\""	;;
7863    *)		extern_C="extern"	;;
7864esac;
7865tx=yes;
7866case "$reuseval-$4" in
7867true-) ;;
7868true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7869esac;
7870case "$tx" in
7871yes)
7872	tval=false;
7873	if $test "$runnm" = true; then
7874		if $contains $tlook $tf >/dev/null 2>&1; then
7875			tval=true;
7876		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7877			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7878			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7879			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7880			$rm_try;
7881		fi;
7882	else
7883		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7884		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7885		$rm_try;
7886	fi;
7887	;;
7888*)
7889	case "$tval" in
7890	$define) tval=true;;
7891	*) tval=false;;
7892	esac;
7893	;;
7894esac;
7895eval "$2=$tval"'
7896
7897: define an is-in-libc? function
7898inlibc='echo " "; td=$define; tu=$undef;
7899sym=$1; var=$2; eval "was=\$$2";
7900tx=yes;
7901case "$reuseval$was" in
7902true) ;;
7903true*) tx=no;;
7904esac;
7905case "$tx" in
7906yes)
7907	set $sym tres -f;
7908	eval $csym;
7909	case "$tres" in
7910	true)
7911		echo "$sym() found." >&4;
7912		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7913	*)
7914		echo "$sym() NOT found." >&4;
7915		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7916	esac;;
7917*)
7918	case "$was" in
7919	$define) echo "$sym() found." >&4;;
7920	*) echo "$sym() NOT found." >&4;;
7921	esac;;
7922esac'
7923
7924: see if dlopen exists
7925xxx_runnm="$runnm"
7926xxx_ccflags="$ccflags"
7927runnm=false
7928: with g++ one needs -shared to get is-in-libc to work for dlopen
7929case "$gccversion" in
7930'')	;;
7931*)	case "$d_cplusplus" in
7932	"$define") ccflags="$ccflags -shared" ;;
7933	esac
7934	;;
7935esac
7936set dlopen d_dlopen
7937eval $inlibc
7938runnm="$xxx_runnm"
7939ccflags="$xxx_ccflags"
7940
7941: see if this is a unistd.h system
7942set unistd.h i_unistd
7943eval $inhdr
7944
7945: determine which dynamic loading, if any, to compile in
7946echo " "
7947dldir="ext/DynaLoader"
7948case "$usedl" in
7949$define|y|true)
7950	dflt='y'
7951	usedl="$define"
7952	;;
7953$undef|n|false)
7954	dflt='n'
7955	usedl="$undef"
7956	;;
7957*)
7958	dflt='n'
7959	case "$d_dlopen" in
7960	    $define) dflt='y' ;;
7961	esac
7962	case "$i_dld" in
7963	    $define) dflt='y' ;;
7964	esac
7965	: Does a dl_xxx.xs file exist for this operating system
7966	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7967	;;
7968esac
7969rp="Do you wish to use dynamic loading?"
7970. ./myread
7971usedl="$ans"
7972bin_ELF="$undef"
7973case "$ans" in
7974y*) usedl="$define"
7975	case "$dlsrc" in
7976	'')
7977		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7978			dflt="$dldir/dl_${osname}.xs"
7979		elif $test "$d_dlopen" = "$define" ; then
7980			dflt="$dldir/dl_dlopen.xs"
7981		elif $test "$i_dld" = "$define" ; then
7982			dflt="$dldir/dl_dld.xs"
7983		else
7984			dflt=''
7985		fi
7986		;;
7987	*)	dflt="$dldir/$dlsrc"
7988		;;
7989	esac
7990    echo "The following dynamic loading files are available:"
7991	: Can not go over to $dldir because getfile has path hard-coded in.
7992	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7993	rp="Source file to use for dynamic loading"
7994	fn="fne"
7995	gfpth="$src"
7996	. ./getfile
7997	usedl="$define"
7998	: emulate basename
7999	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8000
8001	$cat << EOM
8002
8003Some systems may require passing special flags to $cc -c to
8004compile modules that will be used to create a shared library.
8005To use no flags, say "none".
8006
8007EOM
8008    case "$cccdlflags" in
8009    '')	case "$gccversion" in
8010		'') case "$osname" in
8011			hpux)	dflt='+z' ;;
8012			next)	dflt='none' ;;
8013			irix*)	dflt='-KPIC' ;;
8014			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8015			sunos)	dflt='-pic' ;;
8016			*)	dflt='none' ;;
8017		    esac
8018			;;
8019		*)  case "$osname" in
8020	                darwin) dflt='none' ;;
8021			linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8022			*)	dflt='-fpic' ;;
8023		    esac ;;
8024	    esac ;;
8025	' ') dflt='none' ;;
8026    *)	dflt="$cccdlflags" ;;
8027    esac
8028    rp="Any special flags to pass to $cc -c to compile shared library modules?"
8029    . ./myread
8030    case "$ans" in
8031    none) cccdlflags=' ' ;;
8032    *) cccdlflags="$ans" ;;
8033    esac
8034
8035    cat << EOM
8036
8037Some systems use ld to create libraries that can be dynamically loaded,
8038while other systems (such as those using ELF) use $cc.
8039
8040EOM
8041	case "$ld" in
8042	'')	$cat >try.c <<EOM
8043/* Test for whether ELF binaries are produced */
8044#include <fcntl.h>
8045#$i_stdlib I_STDLIB
8046#ifdef I_STDLIB
8047#include <stdlib.h>
8048#endif
8049#$i_unistd I_UNISTD
8050#ifdef I_UNISTD
8051#include <unistd.h>
8052#endif
8053int main() {
8054	char b[4];
8055	int i = open("a.out",O_RDONLY);
8056	if(i == -1)
8057		exit(1); /* fail */
8058	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8059		exit(0); /* succeed (yes, it's ELF) */
8060	else
8061		exit(1); /* fail */
8062}
8063EOM
8064		if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8065			cat <<EOM
8066You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8067EOM
8068			dflt="$cc"
8069			bin_ELF="$define"
8070		else
8071			echo "I'll use ld to build dynamic libraries."
8072			dflt='ld'
8073		fi
8074		$rm_try
8075		;;
8076	*)	dflt="$ld"
8077		;;
8078	esac
8079
8080    rp="What command should be used to create dynamic libraries?"
8081    . ./myread
8082	ld="$ans"
8083
8084    cat << EOM
8085
8086Some systems may require passing special flags to $ld to create a
8087library that can be dynamically loaded.  If your ld flags include
8088-L/other/path options to locate libraries outside your loader's normal
8089search path, you may need to specify those -L options here as well.  To
8090use no flags, say "none".
8091
8092EOM
8093    case "$lddlflags" in
8094    '') case "$osname" in
8095  			beos) dflt='-nostart' ;;
8096  			haiku) dflt='-shared' ;;
8097			hpux) dflt='-b';
8098			      case "$gccversion" in
8099			      '') dflt="$dflt +vnocompatwarnings" ;;
8100			      esac
8101			      ;;
8102			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8103			next)  dflt='none' ;;
8104			solaris) dflt='-G' ;;
8105			sunos) dflt='-assert nodefinitions' ;;
8106			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8107	        *)     dflt='none' ;;
8108			esac
8109			;;
8110    *) dflt="$lddlflags" ;;
8111    esac
8112
8113	: Try to guess additional flags to pick up local libraries.
8114	: Be careful not to append to a plain 'none'
8115	case "$dflt" in
8116	none) dflt='' ;;
8117	esac
8118	for thisflag in $ldflags; do
8119		case "$thisflag" in
8120		-L*|-R*|-Wl,-R*)
8121			case " $dflt " in
8122			*" $thisflag "*) ;;
8123			*) dflt="$dflt $thisflag" ;;
8124			esac
8125			;;
8126		esac
8127	done
8128
8129	case "$dflt" in
8130	''|' ') dflt='none' ;;
8131	esac
8132
8133	case "$ldflags" in
8134	*-fstack-protector*)
8135	    case "$dflt" in
8136			*-fstack-protector*) ;; # Don't add it again
8137			*) dflt="$dflt -fstack-protector" ;;
8138		esac
8139		;;
8140	esac
8141
8142
8143    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8144    . ./myread
8145    case "$ans" in
8146    none) lddlflags=' ' ;;
8147    *) lddlflags="$ans" ;;
8148    esac
8149
8150	cat <<EOM
8151
8152Some systems may require passing special flags to $cc to indicate that
8153the resulting executable will use dynamic linking.  To use no flags,
8154say "none".
8155
8156EOM
8157    case "$ccdlflags" in
8158    '') case "$osname" in
8159	    linux|hpux|gnu*)	dflt='-Wl,-E' ;;
8160	    next|sunos)	dflt='none' ;;
8161	    *)		dflt='none' ;;
8162	    esac ;;
8163    ' ')  dflt='none' ;;
8164    *)  dflt="$ccdlflags" ;;
8165    esac
8166    rp="Any special flags to pass to $cc to use dynamic linking?"
8167    . ./myread
8168    case "$ans" in
8169    none) ccdlflags=' ' ;;
8170    *) ccdlflags="$ans" ;;
8171    esac
8172    ;;
8173*)  usedl="$undef"
8174	ld='ld'
8175    dlsrc='dl_none.xs'
8176    lddlflags=''
8177    ccdlflags=''
8178    ;;
8179esac
8180
8181: Do we want a shared libperl?
8182also=''
8183case "$usedl" in
8184$undef)
8185	# No dynamic loading being used, so don't bother even to prompt.
8186	useshrplib='false'
8187	;;
8188*)	case "$useshrplib" in
8189	'')	case "$osname" in
8190		svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8191			dflt=y
8192			also='Building a shared libperl is required for dynamic loading to work on your system.'
8193			;;
8194		next*)
8195			case "$osvers" in
8196			4*)	dflt=y
8197				also='Building a shared libperl is needed for MAB support.'
8198				;;
8199			*)	dflt=n
8200				;;
8201			esac
8202			;;
8203		*)	dflt=n
8204			;;
8205		esac
8206		;;
8207	$define|true|[Yy]*)
8208		dflt=y
8209		;;
8210	*)	dflt=n
8211		;;
8212	esac
8213	$cat << EOM
8214
8215The perl executable is normally obtained by linking perlmain.c with
8216libperl${_a}, any static extensions (usually just DynaLoader), and
8217any other libraries needed on this system (such as -lm, etc.).  Since
8218your system supports dynamic loading, it is probably possible to build
8219a shared libperl.$so.  If you will have more than one executable linked
8220to libperl.$so, this will significantly reduce the size of each
8221executable, but it may have a noticeable effect on performance.  The
8222default is probably sensible for your system.
8223$also
8224
8225EOM
8226	rp="Build a shared libperl.$so (y/n)"
8227	. ./myread
8228	case "$ans" in
8229	true|$define|[Yy]*)
8230		useshrplib='true'  ;;
8231	*)	useshrplib='false' ;;
8232	esac
8233	;;
8234esac
8235
8236case "$useshrplib" in
8237true)
8238	case "$userelocatableinc" in
8239	true|define)
8240		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8241		echo "See INSTALL for an explanation why that won't work." >&4
8242		exit 4
8243		;;
8244	esac
8245	case "$libperl" in
8246	'')
8247		# Figure out a good name for libperl.so.  Since it gets stored in
8248		# a version-specific architecture-dependent library, the version
8249		# number isn't really that important, except for making cc/ld happy.
8250		#
8251		# A name such as libperl.so.10.1
8252		majmin="libperl.$so.$patchlevel.$subversion"
8253		# A name such as libperl.so.100
8254		majonly=`echo $patchlevel $subversion |
8255			$awk '{printf "%d%02d", $1, $2}'`
8256		majonly=libperl.$so.$majonly
8257		# I'd prefer to keep the os-specific stuff here to a minimum, and
8258		# rely on figuring it out from the naming of libc.
8259		case "${osname}${osvers}" in
8260		next4*)
8261			dflt=libperl.5.$so
8262			# XXX How handle the --version stuff for MAB?
8263			;;
8264		linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8265			dflt=libperl.$so
8266			;;
8267		cygwin*) # ld links now against the dll directly
8268			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8269			majonly=`echo $patchlevel $subversion |
8270				$awk '{printf "%03d%03d", $1, $2}'`
8271			majonly=cygperl5.$majonly.$so
8272			dflt=$majmin
8273			;;
8274		*)	# Try to guess based on whether libc has major.minor.
8275			case "$libc" in
8276			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8277			*libc.$so.[0-9]*) dflt=$majonly ;;
8278			*)	dflt=libperl.$so ;;
8279			esac
8280			;;
8281		esac
8282		;;
8283	*)	dflt=$libperl
8284		;;
8285	esac
8286	cat << EOM
8287
8288I need to select a good name for the shared libperl.  If your system uses
8289library names with major and minor numbers, then you might want something
8290like $majmin.  Alternatively, if your system uses a single version
8291number for shared libraries, then you might want to use $majonly.
8292Or, your system might be quite happy with a simple libperl.$so.
8293
8294Since the shared libperl will get installed into a version-specific
8295architecture-dependent directory, the version number of the shared perl
8296library probably isn't important, so the default should be o.k.
8297
8298EOM
8299	rp='What name do you want to give to the shared libperl?'
8300	. ./myread
8301	libperl=$ans
8302	echo "Ok, I'll use $libperl"
8303	;;
8304*)
8305	libperl="libperl${_a}"
8306	;;
8307esac
8308
8309# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8310case "$shrpdir" in
8311'') ;;
8312*)	$cat >&4 <<EOM
8313WARNING:  Use of the shrpdir variable for the installation location of
8314the shared $libperl is not supported.  It was never documented and
8315will not work in this version.  Let me (perlbug@perl.org)
8316know of any problems this may cause.
8317
8318EOM
8319	case "$shrpdir" in
8320	"$archlibexp/CORE")
8321		$cat >&4 <<EOM
8322But your current setting of $shrpdir is
8323the default anyway, so it's harmless.
8324EOM
8325		;;
8326	*)
8327		$cat >&4 <<EOM
8328Further, your current attempted setting of $shrpdir
8329conflicts with the value of $archlibexp/CORE
8330that installperl will use.
8331EOM
8332		;;
8333	esac
8334	;;
8335esac
8336
8337# How will the perl executable find the installed shared $libperl?
8338# Add $xxx to ccdlflags.
8339# If we can't figure out a command-line option, use $shrpenv to
8340# set env LD_RUN_PATH.  The main perl makefile uses this.
8341shrpdir=$archlibexp/CORE
8342xxx=''
8343tmp_shrpenv=''
8344if "$useshrplib"; then
8345    case "$osname" in
8346	aix)
8347		# We'll set it in Makefile.SH...
8348		;;
8349	solaris)
8350		xxx="-R $shrpdir"
8351		;;
8352	freebsd|netbsd|openbsd|interix|dragonfly)
8353		xxx="-Wl,-R$shrpdir"
8354		;;
8355	bsdos|linux|irix*|dec_osf|gnu*)
8356		xxx="-Wl,-rpath,$shrpdir"
8357		;;
8358	next)
8359		# next doesn't like the default...
8360		;;
8361	beos)
8362		# beos doesn't like the default, either.
8363		;;
8364	haiku)
8365		# Haiku doesn't like the default, either.
8366		;;
8367	hpux*)
8368		# hpux doesn't like the default, either.
8369		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8370		;;
8371	cygwin)
8372		# cygwin needs only ldlibpth
8373		;;
8374	*)
8375		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8376		;;
8377	esac
8378	case "$xxx" in
8379	'') ;;
8380	*)
8381		# Only add $xxx if it isn't already in ccdlflags.
8382		case " $ccdlflags " in
8383		*" $xxx "*)	;;
8384		*)	ccdlflags="$ccdlflags $xxx"
8385			cat <<EOM >&4
8386
8387Adding $xxx to the flags
8388passed to $ld so that the perl executable will find the
8389installed shared $libperl.
8390
8391EOM
8392			;;
8393		esac
8394		;;
8395	esac
8396fi
8397# Fix ccdlflags in AIX for building external extensions.
8398# (For building Perl itself bare -bE:perl.exp is needed,
8399#  Makefile.SH takes care of this.)
8400case "$osname" in
8401aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8402esac
8403# Respect a hint or command-line value.
8404case "$shrpenv" in
8405'') shrpenv="$tmp_shrpenv" ;;
8406esac
8407case "$ldlibpthname" in
8408'')	ldlibpthname=LD_LIBRARY_PATH ;;
8409none)	ldlibpthname='' ;;
8410esac
8411
8412: determine where manual pages are on this system
8413echo " "
8414case "$sysman" in
8415'')
8416	syspath='/usr/share/man/man1 /usr/man/man1'
8417	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8418	syspath="$syspath /usr/man/u_man/man1"
8419	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8420	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8421	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8422	sysman=`./loc . /usr/man/man1 $syspath`
8423	;;
8424esac
8425if $test -d "$sysman"; then
8426	echo "System manual is in $sysman." >&4
8427else
8428	echo "Could not find manual pages in source form." >&4
8429fi
8430
8431: determine where manual pages go
8432set man1dir man1dir none
8433eval $prefixit
8434$cat <<EOM
8435
8436$spackage has manual pages available in source form.
8437EOM
8438case "$nroff" in
8439nroff)
8440	echo "However, you don't have nroff, so they're probably useless to you."
8441	case "$man1dir" in
8442	'') man1dir="none";;
8443	esac;;
8444esac
8445echo "If you don't want the manual sources installed, answer 'none'."
8446case "$man1dir" in
8447' ') dflt=none
8448	;;
8449'')
8450	lookpath="$prefixexp/share/man/man1"
8451	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8452	lookpath="$lookpath $prefixexp/man/p_man/man1"
8453	lookpath="$lookpath $prefixexp/man/u_man/man1"
8454	lookpath="$lookpath $prefixexp/man/man.1"
8455	case "$sysman" in
8456	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8457	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8458	esac
8459	set dflt
8460	eval $prefixup
8461	;;
8462*)  dflt="$man1dir"
8463	;;
8464esac
8465echo " "
8466fn=dn+~
8467rp="Where do the main $spackage manual pages (source) go?"
8468. ./getfile
8469if $test "X$man1direxp" != "X$ansexp"; then
8470	installman1dir=''
8471fi
8472prefixvar=man1dir
8473. ./setprefixvar
8474
8475case "$man1dir" in
8476'')	man1dir=' '
8477	installman1dir='';;
8478esac
8479
8480: What suffix to use on installed man pages
8481
8482case "$man1dir" in
8483' ')
8484	man1ext='0'
8485	;;
8486*)
8487	rp="What suffix should be used for the main $spackage man pages?"
8488	case "$man1ext" in
8489	'')	case "$man1dir" in
8490		*1)  dflt=1 ;;
8491		*1p) dflt=1p ;;
8492		*1pm) dflt=1pm ;;
8493		*l) dflt=l;;
8494		*n) dflt=n;;
8495		*o) dflt=o;;
8496		*p) dflt=p;;
8497		*C) dflt=C;;
8498		*L) dflt=L;;
8499		*L1) dflt=L1;;
8500		*) dflt=1;;
8501		esac
8502		;;
8503	*)	dflt="$man1ext";;
8504	esac
8505	. ./myread
8506	man1ext="$ans"
8507	;;
8508esac
8509
8510: see if we can have long filenames
8511echo " "
8512first=123456789abcdef
8513$rm -f $first
8514if (echo hi >$first) 2>/dev/null; then
8515	if $test -f 123456789abcde; then
8516		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8517		val="$undef"
8518	else
8519 		echo 'You can have filenames longer than 14 characters.'>&4
8520 		val="$define"
8521	fi
8522else
8523	$cat <<'EOM'
8524You can't have filenames longer than 14 chars.
8525You can't even think about them!
8526EOM
8527	val="$undef"
8528fi
8529set d_flexfnam
8530eval $setvar
8531$rm -rf 123456789abcde*
8532
8533: determine where library module manual pages go
8534set man3dir man3dir none
8535eval $prefixit
8536$cat <<EOM
8537
8538$spackage has manual pages for many of the library modules.
8539EOM
8540
8541case "$nroff" in
8542nroff)
8543	$cat <<'EOM'
8544However, you don't have nroff, so they're probably useless to you.
8545EOM
8546	case "$man3dir" in
8547	'') man3dir="none";;
8548	esac;;
8549esac
8550
8551case "$d_flexfnam" in
8552undef)
8553	$cat <<'EOM'
8554However, your system can't handle the long file names like File::Basename.3.
8555EOM
8556	case "$man3dir" in
8557	'') man3dir="none";;
8558	esac;;
8559esac
8560
8561echo "If you don't want the manual sources installed, answer 'none'."
8562prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8563case "$man3dir" in
8564'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8565	if $test -d "$privlib/man/man3"; then
8566		cat <<EOM >&4
8567
8568WARNING:  Previous versions of perl installed man3 pages into
8569$privlib/man/man3.  This version will suggest a
8570new default of $dflt.
8571EOM
8572		tdflt=$dflt
8573		dflt='n'
8574		rp='Do you wish to preserve the old behavior?(y/n)'
8575		. ./myread
8576		case "$ans" in
8577		y*) dflt="$privlib/man/man3" ;;
8578		*)  dflt=$tdflt ;;
8579		esac
8580    fi
8581	;;
8582*)	dflt="$man3dir" ;;
8583esac
8584case "$dflt" in
8585' ') dflt=none ;;
8586esac
8587echo " "
8588fn=dn+~
8589rp="Where do the $package library man pages (source) go?"
8590. ./getfile
8591prefixvar=man3dir
8592. ./setprefixvar
8593
8594case "$man3dir" in
8595'')	man3dir=' '
8596	installman3dir='';;
8597esac
8598
8599: What suffix to use on installed man pages
8600case "$man3dir" in
8601' ')
8602	man3ext='0'
8603	;;
8604*)
8605	rp="What suffix should be used for the $package library man pages?"
8606	case "$man3ext" in
8607	'')	case "$man3dir" in
8608		*3)  dflt=3 ;;
8609		*3p) dflt=3p ;;
8610		*3pm) dflt=3pm ;;
8611		*l) dflt=l;;
8612		*n) dflt=n;;
8613		*o) dflt=o;;
8614		*p) dflt=p;;
8615		*C) dflt=C;;
8616		*L) dflt=L;;
8617		*L3) dflt=L3;;
8618		*) dflt=3;;
8619		esac
8620		;;
8621	*)	dflt="$man3ext";;
8622	esac
8623	. ./myread
8624	man3ext="$ans"
8625	;;
8626esac
8627
8628: see if we have to deal with yellow pages, now NIS.
8629if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8630	if $test -f /usr/etc/nibindd; then
8631		echo " "
8632		echo "I'm fairly confident you're on a NeXT."
8633		echo " "
8634		rp='Do you get the hosts file via NetInfo?'
8635		dflt=y
8636		case "$hostcat" in
8637		nidump*) ;;
8638		'') ;;
8639		*) dflt=n;;
8640		esac
8641		. ./myread
8642		case "$ans" in
8643		y*) hostcat='nidump hosts .';;
8644		*)	case "$hostcat" in
8645			nidump*) hostcat='';;
8646			esac
8647			;;
8648		esac
8649	fi
8650	case "$hostcat" in
8651	nidump*) ;;
8652	*)
8653		case "$hostcat" in
8654		*ypcat*) dflt=y;;
8655		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8656				dflt=y
8657			else
8658				dflt=n
8659			fi;;
8660		*) dflt=n;;
8661		esac
8662		echo " "
8663		rp='Are you getting the hosts file via yellow pages?'
8664		. ./myread
8665		case "$ans" in
8666		y*) hostcat='ypcat hosts';;
8667		*) hostcat='cat /etc/hosts';;
8668		esac
8669		;;
8670	esac
8671fi
8672case "$hostcat" in
8673'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8674esac
8675case "$groupcat" in
8676'') test -f /etc/group && groupcat='cat /etc/group';;
8677esac
8678case "$passcat" in
8679'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8680esac
8681
8682: now get the host name
8683echo " "
8684echo "Figuring out host name..." >&4
8685case "$myhostname" in
8686'') cont=true
8687	echo 'Maybe "hostname" will work...'
8688	if tans=`sh -c hostname 2>&1` ; then
8689		myhostname=$tans
8690		phostname=hostname
8691		cont=''
8692	fi
8693	;;
8694*) cont='';;
8695esac
8696if $test "$cont"; then
8697	if ./xenix; then
8698		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8699		if tans=`cat /etc/systemid 2>&1` ; then
8700			myhostname=$tans
8701			phostname='cat /etc/systemid'
8702			echo "Whadyaknow.  Xenix always was a bit strange..."
8703			cont=''
8704		fi
8705	elif $test -r /etc/systemid; then
8706		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8707	fi
8708fi
8709if $test "$cont"; then
8710	echo 'No, maybe "uuname -l" will work...'
8711	if tans=`sh -c 'uuname -l' 2>&1` ; then
8712		myhostname=$tans
8713		phostname='uuname -l'
8714	else
8715		echo 'Strange.  Maybe "uname -n" will work...'
8716		if tans=`sh -c 'uname -n' 2>&1` ; then
8717			myhostname=$tans
8718			phostname='uname -n'
8719		else
8720			echo 'Oh well, maybe I can mine it out of whoami.h...'
8721			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8722				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8723				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8724			else
8725				case "$myhostname" in
8726				'') echo "Does this machine have an identity crisis or something?"
8727					phostname='';;
8728				*)
8729					echo "Well, you said $myhostname before..."
8730					phostname='echo $myhostname';;
8731				esac
8732			fi
8733		fi
8734	fi
8735fi
8736case "$myhostname" in
8737'') myhostname=noname ;;
8738esac
8739: you do not want to know about this
8740set $myhostname
8741myhostname=$1
8742
8743: verify guess
8744if $test "$myhostname" ; then
8745	dflt=y
8746	rp='Your host name appears to be "'$myhostname'".'" Right?"
8747	. ./myread
8748	case "$ans" in
8749	y*) ;;
8750	*) myhostname='';;
8751	esac
8752fi
8753
8754: bad guess or no guess
8755while $test "X$myhostname" = X ; do
8756	dflt=''
8757	rp="Please type the (one word) name of your host:"
8758	. ./myread
8759	myhostname="$ans"
8760done
8761
8762: translate upper to lower if necessary
8763case "$myhostname" in
8764*[A-Z]*)
8765	echo "(Normalizing case in your host name)"
8766	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8767	;;
8768esac
8769
8770case "$myhostname" in
8771*.*)
8772	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8773	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8774	echo "(Trimming domain name from host name--host name is now $myhostname)"
8775	;;
8776*) case "$mydomain" in
8777	'')
8778		{
8779			test "X$hostcat" = "Xypcat hosts" &&
8780			ypmatch "$myhostname" hosts 2>/dev/null |\
8781				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8782			$test -s hosts
8783		} || {
8784			test "X$hostcat" != "X" &&
8785		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8786					/[	 ]$myhostname[	. ]/p" > hosts
8787		}
8788		tmp_re="[	. ]"
8789		if $test -f hosts; then
8790			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8791			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8792			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8793				hosts | $sort | $uniq | \
8794				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8795			case `$echo X$dflt` in
8796			X*\ *)	echo "(Several hosts in the database matched hostname)"
8797				dflt=.
8798				;;
8799			X.) echo "(You do not have fully-qualified names in the hosts database)"
8800				;;
8801			esac
8802		else
8803			echo "(I cannot locate a hosts database anywhere)"
8804			dflt=.
8805		fi
8806		case "$dflt" in
8807		.)
8808			tans=`./loc resolv.conf X /etc /usr/etc`
8809			if $test -f "$tans"; then
8810				echo "(Attempting domain name extraction from $tans)"
8811				dflt=.`$sed -n -e 's/	/ /g' \
8812				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8813				  -e 1q 2>/dev/null`
8814				case "$dflt" in
8815				.) dflt=.`$sed -n -e 's/	/ /g' \
8816				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8817				     -e 1q 2>/dev/null`
8818  					;;
8819				esac
8820			fi
8821			;;
8822		esac
8823		case "$dflt" in
8824		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8825			dflt=.`sh -c domainname 2>/dev/null`
8826			case "$dflt" in
8827			'') dflt='.';;
8828			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8829			esac
8830			;;
8831		esac
8832		case "$dflt$osname" in
8833		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8834			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8835			;;
8836		esac
8837		case "$dflt" in
8838		.) echo "(Lost all hope -- silly guess then)"
8839			dflt='.nonet'
8840			;;
8841		esac
8842		$rm -f hosts
8843		;;
8844	*) dflt="$mydomain";;
8845	esac;;
8846esac
8847echo " "
8848rp="What is your domain name?"
8849. ./myread
8850tans="$ans"
8851case "$ans" in
8852'') ;;
8853.*) ;;
8854*) tans=".$tans";;
8855esac
8856mydomain="$tans"
8857
8858: translate upper to lower if necessary
8859case "$mydomain" in
8860*[A-Z]*)
8861	echo "(Normalizing case in your domain name)"
8862	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8863	;;
8864esac
8865
8866: a little sanity check here
8867case "$phostname" in
8868'') ;;
8869*)
8870	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8871	$myhostname$mydomain|$myhostname) ;;
8872	*)
8873		case "$phostname" in
8874		sed*)
8875			echo "(That doesn't agree with your whoami.h file, by the way.)"
8876			;;
8877		*)
8878			echo "(That doesn't agree with your $phostname command, by the way.)"
8879			;;
8880		esac
8881	;;
8882	esac
8883	;;
8884esac
8885
8886: determine the e-mail address of the user who is running us
8887$cat <<EOM
8888
8889I need to get your e-mail address in Internet format if possible, i.e.
8890something like user@host.domain. Please answer accurately since I have
8891no easy means to double check it. The default value provided below
8892is most probably close to reality but may not be valid from outside
8893your organization...
8894
8895EOM
8896cont=x
8897while test "$cont"; do
8898	case "$cf_email" in
8899	'') dflt="$cf_by@$myhostname$mydomain";;
8900	*) dflt="$cf_email";;
8901	esac
8902	rp='What is your e-mail address?'
8903	. ./myread
8904	cf_email="$ans"
8905	case "$cf_email" in
8906	*@*.*) cont='' ;;
8907	*)
8908		rp='Address does not look like an Internet one.  Use it anyway?'
8909		case "$fastread" in
8910		yes) dflt=y ;;
8911		*) dflt=n ;;
8912		esac
8913		. ./myread
8914		case "$ans" in
8915		y*) cont='' ;;
8916		*) echo " " ;;
8917		esac
8918		;;
8919	esac
8920done
8921
8922: Ask e-mail of administrator
8923$cat <<EOM
8924
8925If you or somebody else will be maintaining perl at your site, please
8926fill in the correct e-mail address here so that they may be contacted
8927if necessary. Currently, the "perlbug" program included with perl
8928will send mail to this address in addition to perlbug@perl.org. You may
8929enter "none" for no administrator.
8930
8931EOM
8932case "$perladmin" in
8933'') dflt="$cf_email";;
8934*) dflt="$perladmin";;
8935esac
8936rp='Perl administrator e-mail address'
8937. ./myread
8938perladmin="$ans"
8939
8940: determine whether to only install version-specific parts.
8941echo " "
8942$cat <<EOM
8943Do you want to install only the version-specific parts of the perl
8944distribution?  Usually you do *not* want to do this.
8945EOM
8946case "$versiononly" in
8947"$define"|[Yy]*|true) dflt='y' ;;
8948*) dflt='n';
8949esac
8950rp="Do you want to install only the version-specific parts of perl?"
8951. ./myread
8952case "$ans" in
8953[yY]*)	val="$define";;
8954*)	val="$undef" ;;
8955esac
8956set versiononly
8957eval $setvar
8958
8959case "$versiononly" in
8960"$define") inc_version_list=''
8961           inc_version_list_init=0
8962           ;;
8963esac
8964
8965: figure out how to guarantee perl startup
8966: XXX Note that this currently takes advantage of the bug that binexp ignores
8967:     the Configure -Dinstallprefix setting, which in turn means that under
8968:     relocatable @INC, initialinstalllocation is what binexp started as.
8969case "$startperl" in
8970'')
8971	case "$sharpbang" in
8972	*!)
8973		$cat <<EOH
8974
8975I can use the #! construct to start perl on your system. This will
8976make startup of perl scripts faster, but may cause problems if you
8977want to share those scripts and perl is not in a standard place
8978($initialinstalllocation/perl) on all your platforms. The alternative
8979is to force a shell by starting the script with a single ':' character.
8980
8981EOH
8982		case "$versiononly" in
8983		"$define")      dflt="$initialinstalllocation/perl$version";;
8984		*)              dflt="$initialinstalllocation/perl";;
8985		esac
8986		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8987		. ./myread
8988		case "$ans" in
8989		none)	startperl=": # use perl";;
8990		*)	startperl="#!$ans"
8991			if $test 30 -lt `echo "$ans" | wc -c`; then
8992				$cat >&4 <<EOM
8993
8994WARNING:  Some systems limit the #! command to 32 characters.
8995If you experience difficulty running Perl scripts with #!, try
8996installing Perl in a directory with a shorter pathname.
8997
8998EOM
8999			fi ;;
9000		esac
9001		;;
9002	*) startperl=": # use perl"
9003		;;
9004	esac
9005	;;
9006esac
9007echo "I'll use $startperl to start perl scripts."
9008
9009: figure best path for perl in scripts
9010case "$perlpath" in
9011'')
9012	case "$versiononly" in
9013	"$define")	perlpath="$initialinstalllocation/perl$version";;
9014	*)		perlpath="$initialinstalllocation/perl";;
9015	esac
9016	case "$startperl" in
9017	*!*) ;;
9018	*)
9019		$cat <<EOH
9020
9021I will use the "eval 'exec'" idiom to start Perl on your system.
9022I can use the full path of your Perl binary for this purpose, but
9023doing so may cause problems if you want to share those scripts and
9024Perl is not always in a standard place ($initialinstalllocation/perl).
9025
9026EOH
9027		dflt="$initialinstalllocation/perl"
9028		rp="What path shall I use in \"eval 'exec'\"?"
9029		. ./myread
9030		perlpath="$ans"
9031		;;
9032	esac
9033	;;
9034esac
9035case "$startperl" in
9036*!*)	;;
9037*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9038esac
9039
9040: determine where public executable scripts go
9041set scriptdir scriptdir
9042eval $prefixit
9043case "$scriptdir" in
9044'')
9045	dflt="$bin"
9046	: guess some guesses
9047	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9048	$test -d /usr/share/bin     && dflt=/usr/share/bin
9049	$test -d /usr/local/script  && dflt=/usr/local/script
9050	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9051	$test -d $prefixexp/script  && dflt=$prefixexp/script
9052	set dflt
9053	eval $prefixup
9054	;;
9055*)  dflt="$scriptdir"
9056	;;
9057esac
9058$cat <<EOM
9059
9060Some installations have a separate directory just for executable scripts so
9061that they can mount it across multiple architectures but keep the scripts in
9062one spot.  You might, for example, have a subdirectory of /usr/share for this.
9063Or you might just lump your scripts in with all your other executables.
9064
9065EOM
9066fn=d~
9067rp='Where do you keep publicly executable scripts?'
9068. ./getfile
9069if $test "X$ansexp" != "X$scriptdirexp"; then
9070	installscript=''
9071fi
9072installscriptdir=''
9073prefixvar=scriptdir
9074. ./setprefixvar
9075: A little fix up for an irregularly named variable.
9076installscript="$installscriptdir"
9077
9078: determine where add-on public executables go
9079case "$sitebin" in
9080'')	dflt=$siteprefix/bin ;;
9081*)	dflt=$sitebin ;;
9082esac
9083fn=d~
9084rp='Pathname where the add-on public executables should be installed?'
9085. ./getfile
9086prefixvar=sitebin
9087. ./setprefixvar
9088
9089: determine where add-on html pages go
9090: There is no standard location, so try to copy the previously-selected
9091: directory structure for the core html pages.
9092case "$sitehtml1dir" in
9093'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9094*)     dflt=$sitehtml1dir ;;
9095esac
9096case "$dflt" in
9097''|' ') dflt=none ;;
9098esac
9099fn=dn+~
9100rp='Pathname where the site-specific html pages should be installed?'
9101. ./getfile
9102prefixvar=sitehtml1dir
9103. ./setprefixvar
9104
9105: determine where add-on library html pages go
9106: There is no standard location, so try to copy the previously-selected
9107: directory structure for the core html pages.
9108case "$sitehtml3dir" in
9109'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9110*)     dflt=$sitehtml3dir ;;
9111esac
9112case "$dflt" in
9113''|' ') dflt=none ;;
9114esac
9115fn=dn+~
9116rp='Pathname where the site-specific library html pages should be installed?'
9117. ./getfile
9118prefixvar=sitehtml3dir
9119. ./setprefixvar
9120
9121: determine where add-on manual pages go
9122case "$siteman1dir" in
9123'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9124*)	dflt=$siteman1dir ;;
9125esac
9126case "$dflt" in
9127''|' ') dflt=none ;;
9128esac
9129fn=dn+~
9130rp='Pathname where the site-specific manual pages should be installed?'
9131. ./getfile
9132prefixvar=siteman1dir
9133. ./setprefixvar
9134
9135: determine where add-on library man pages go
9136case "$siteman3dir" in
9137'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9138*)	dflt=$siteman3dir ;;
9139esac
9140case "$dflt" in
9141''|' ') dflt=none ;;
9142esac
9143fn=dn+~
9144rp='Pathname where the site-specific library manual pages should be installed?'
9145. ./getfile
9146prefixvar=siteman3dir
9147. ./setprefixvar
9148
9149: determine where add-on public executable scripts go
9150case "$sitescript" in
9151'')	dflt=$siteprefix/script
9152	$test -d $dflt || dflt=$sitebin ;;
9153*)  dflt="$sitescript" ;;
9154esac
9155fn=d~+
9156rp='Pathname where add-on public executable scripts should be installed?'
9157. ./getfile
9158prefixvar=sitescript
9159. ./setprefixvar
9160
9161: Check if faststdio is requested and available
9162case "$usefaststdio" in
9163$define|true|[yY]*|'')
9164	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9165	case "$xversion" in
9166	[68])	dflt='y' ;;
9167	*)	dflt='n' ;;
9168	esac
9169	;;
9170*) dflt='n';;
9171esac
9172cat <<EOM
9173
9174Perl can be built to use 'fast stdio', which means using the stdio
9175library but also directly manipulating the stdio buffers to enable
9176faster I/O.  Using stdio is better for backward compatibility (especially
9177for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9178interface has been preferred instead of stdio.
9179
9180If this doesn't make any sense to you, just accept the default '$dflt'.
9181EOM
9182rp='Use the "fast stdio" if available?'
9183. ./myread
9184case "$ans" in
9185y|Y)	val="$define" ;;
9186*)      val="$undef" ;;
9187esac
9188set usefaststdio
9189eval $setvar
9190
9191
9192: define an is-a-typedef? function
9193typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9194case "$inclist" in
9195"") inclist="sys/types.h";;
9196esac;
9197eval "varval=\$$var";
9198case "$varval" in
9199"")
9200	$rm -f temp.c;
9201	for inc in $inclist; do
9202		echo "#include <$inc>" >>temp.c;
9203	done;
9204	echo "#ifdef $type" >> temp.c;
9205	echo "printf(\"We have $type\");" >> temp.c;
9206	echo "#endif" >> temp.c;
9207	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9208	if $contains $type temp.E >/dev/null 2>&1; then
9209		eval "$var=\$type";
9210	else
9211		eval "$var=\$def";
9212	fi;
9213	$rm -f temp.?;;
9214*) eval "$var=\$varval";;
9215esac'
9216
9217: define an is-a-typedef? function that prompts if the type is not available.
9218typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9219case "$inclist" in
9220"") inclist="sys/types.h";;
9221esac;
9222eval "varval=\$$var";
9223case "$varval" in
9224"")
9225	$rm -f temp.c;
9226	for inc in $inclist; do
9227		echo "#include <$inc>" >>temp.c;
9228	done;
9229	echo "#ifdef $type" >> temp.c;
9230	echo "printf(\"We have $type\");" >> temp.c;
9231	echo "#endif" >> temp.c;
9232	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9233	echo " " ;
9234	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9235	if $contains $type temp.E >/dev/null 2>&1; then
9236		echo "$type found." >&4;
9237		eval "$var=\$type";
9238	else
9239		echo "$type NOT found." >&4;
9240		dflt="$def";
9241		. ./myread ;
9242		eval "$var=\$ans";
9243	fi;
9244	$rm -f temp.?;;
9245*) eval "$var=\$varval";;
9246esac'
9247
9248: see what type lseek is declared as in the kernel
9249rp="What is the type used for lseek's offset on this system?"
9250set off_t lseektype long stdio.h sys/types.h
9251eval $typedef_ask
9252
9253echo " "
9254echo "Checking to see how big your file offsets are..." >&4
9255$cat >try.c <<EOCP
9256#include <sys/types.h>
9257#include <stdio.h>
9258int main()
9259{
9260    printf("%d\n", (int)sizeof($lseektype));
9261    return(0);
9262}
9263EOCP
9264set try
9265if eval $compile_ok; then
9266	lseeksize=`$run ./try`
9267	echo "Your file offsets are $lseeksize bytes long."
9268else
9269	dflt=$longsize
9270	echo " "
9271	echo "(I can't seem to compile the test program.  Guessing...)"
9272	rp="What is the size of your file offsets (in bytes)?"
9273	. ./myread
9274	lseeksize="$ans"
9275fi
9276$rm_try
9277
9278: see what type file positions are declared as in the library
9279rp="What is the type for file position used by fsetpos()?"
9280set fpos_t fpostype long stdio.h sys/types.h
9281eval $typedef_ask
9282
9283: Check size for Fpos_t
9284echo " "
9285case "$fpostype" in
9286*_t) zzz="$fpostype"	;;
9287*)   zzz="fpos_t"	;;
9288esac
9289echo "Checking the size of $zzz..." >&4
9290cat > try.c <<EOCP
9291#include <sys/types.h>
9292#include <stdio.h>
9293#$i_stdlib I_STDLIB
9294#ifdef I_STDLIB
9295#include <stdlib.h>
9296#endif
9297int main() {
9298    printf("%d\n", (int)sizeof($fpostype));
9299    exit(0);
9300}
9301EOCP
9302set try
9303if eval $compile_ok; then
9304	yyy=`$run ./try`
9305	case "$yyy" in
9306	'')	fpossize=4
9307		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9308		;;
9309	*)	fpossize=$yyy
9310		echo "Your $zzz is $fpossize bytes long."
9311		;;
9312	esac
9313else
9314	dflt="$longsize"
9315	echo " " >&4
9316	echo "(I can't compile the test program.  Guessing...)" >&4
9317	rp="What is the size of your file positions (in bytes)?"
9318	. ./myread
9319	fpossize="$ans"
9320fi
9321
9322: Check for large file support
9323# Backward compatibility (uselfs is deprecated).
9324case "$uselfs" in
9325"$define"|true|[yY]*)
9326	cat <<EOM >&4
9327
9328*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9329EOM
9330	uselargefiles="$define"
9331	;;
9332esac
9333
9334case "$lseeksize:$fpossize" in
93358:8) cat <<EOM
9336
9337You can have files larger than 2 gigabytes.
9338EOM
9339   val="$define" ;;
9340*)    case "$uselargefiles" in
9341   "$undef"|false|[nN]*) dflt='n' ;;
9342   *)	dflt='y' ;;
9343   esac
9344   cat <<EOM
9345
9346Perl can be built to understand large files (files larger than 2 gigabytes)
9347on some systems.  To do so, Configure can be run with -Duselargefiles.
9348
9349If this doesn't make any sense to you, just accept the default '$dflt'.
9350EOM
9351   rp='Try to understand large files, if available?'
9352   . ./myread
9353   case "$ans" in
9354   y|Y) 	val="$define" ;;
9355   *)   	val="$undef"  ;;
9356   esac
9357   ;;
9358esac
9359set uselargefiles
9360eval $setvar
9361: Look for a hint-file generated 'call-back-unit'.  If the
9362: user has specified that a large files perl is to be built,
9363: we may need to set or change some other defaults.
9364if $test -f uselargefiles.cbu; then
9365	echo "Your platform has some specific hints regarding large file builds, using them..."
9366	. ./uselargefiles.cbu
9367fi
9368case "$uselargefiles" in
9369"$define")
9370	if $test -f uselargefiles.cbu; then
9371		echo " "
9372		echo "Rechecking to see how big your file offsets are..." >&4
9373		$cat >try.c <<EOCP
9374#include <sys/types.h>
9375#include <stdio.h>
9376int main()
9377{
9378    printf("%d\n", (int)sizeof($lseektype));
9379    return(0);
9380}
9381EOCP
9382		set try
9383		if eval $compile_ok; then
9384			lseeksize=`$run ./try`
9385			$echo "Your file offsets are now $lseeksize bytes long."
9386		else
9387			dflt="$lseeksize"
9388			echo " "
9389			echo "(I can't seem to compile the test program.  Guessing...)"
9390			rp="What is the size of your file offsets (in bytes)?"
9391			. ./myread
9392			lseeksize="$ans"
9393		fi
9394		case "$fpostype" in
9395		*_t) zzz="$fpostype"	;;
9396		*)   zzz="fpos_t"	;;
9397		esac
9398		$echo $n "Rechecking the size of $zzz...$c" >&4
9399		$cat > try.c <<EOCP
9400#include <sys/types.h>
9401#include <stdio.h>
9402#$i_stdlib I_STDLIB
9403#ifdef I_STDLIB
9404#include <stdlib.h>
9405#endif
9406int main() {
9407    printf("%d\n", (int)sizeof($fpostype));
9408    return(0);
9409}
9410EOCP
9411		set try
9412		if eval $compile_ok; then
9413			yyy=`$run ./try`
9414			dflt="$lseeksize"
9415			case "$yyy" in
9416			'')	echo " "
9417				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9418				;;
9419			*)	fpossize=$yyy
9420				echo " $fpossize bytes." >&4
9421				;;
9422			esac
9423		else
9424			dflt="$fpossize"
9425			echo " "
9426			echo "(I can't compile the test program.  Guessing...)" >&4
9427			rp="What is the size of your file positions (in bytes)?"
9428			. ./myread
9429			fpossize="$ans"
9430		fi
9431		$rm_try
9432	fi
9433	;;
9434esac
9435
9436: Set the vendorbin variables
9437case "$vendorprefix" in
9438'')	d_vendorbin="$undef"
9439	vendorbin=''
9440	vendorbinexp=''
9441	;;
9442*)	d_vendorbin="$define"
9443	: determine where vendor-supplied executables go.
9444	case "$vendorbin" in
9445	'') dflt=$vendorprefix/bin ;;
9446	*)	dflt="$vendorbin" ;;
9447	esac
9448	fn=d~+
9449	rp='Pathname for the vendor-supplied executables directory?'
9450	. ./getfile
9451	vendorbin="$ans"
9452	vendorbinexp="$ansexp"
9453	;;
9454esac
9455prefixvar=vendorbin
9456. ./installprefix
9457
9458: Set the vendorhtml1dir variables
9459case "$vendorprefix" in
9460'')	vendorhtml1dir=''
9461	vendorhtml1direxp=''
9462	;;
9463*)	: determine where vendor-supplied html pages go.
9464	: There is no standard location, so try to copy the previously-selected
9465	: directory structure for the core html pages.
9466	: XXX Better default suggestions would be welcome.
9467	case "$vendorhtml1dir" in
9468	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9469	*)	dflt=$vendorhtml1dir ;;
9470	esac
9471	case "$dflt" in
9472	''|' ') dflt=none ;;
9473	esac
9474	fn=dn+~
9475	rp='Pathname for the vendor-supplied html pages?'
9476	. ./getfile
9477	vendorhtml1dir="$ans"
9478	vendorhtml1direxp="$ansexp"
9479	;;
9480esac
9481: Use ' ' for none so value is preserved next time through Configure
9482$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9483prefixvar=vendorhtml1dir
9484. ./installprefix
9485
9486: Set the vendorhtml3dir variables
9487case "$vendorprefix" in
9488'')	vendorhtml3dir=''
9489	vendorhtml3direxp=''
9490	;;
9491*)	: determine where vendor-supplied module html pages go.
9492	: There is no standard location, so try to copy the previously-selected
9493	: directory structure for the core html pages.
9494	: XXX Better default suggestions would be welcome.
9495	case "$vendorhtml3dir" in
9496	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9497	*)	dflt=$vendorhtml3dir ;;
9498	esac
9499	case "$dflt" in
9500	''|' ') dflt=none ;;
9501	esac
9502	fn=dn+~
9503	rp='Pathname for the vendor-supplied html pages?'
9504	. ./getfile
9505	vendorhtml3dir="$ans"
9506	vendorhtml3direxp="$ansexp"
9507	;;
9508esac
9509: Use ' ' for none so value is preserved next time through Configure
9510$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9511prefixvar=vendorhtml3dir
9512. ./installprefix
9513
9514: Set the vendorman1dir variables
9515case "$vendorprefix" in
9516'')	vendorman1dir=''
9517	vendorman1direxp=''
9518	;;
9519*)	: determine where vendor-supplied manual pages go.
9520	case "$vendorman1dir" in
9521	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9522	*)	dflt=$vendorman1dir ;;
9523	esac
9524	case "$dflt" in
9525	''|' ') dflt=none ;;
9526	esac
9527	fn=nd~+
9528	rp='Pathname for the vendor-supplied manual section 1 pages?'
9529	. ./getfile
9530	vendorman1dir="$ans"
9531	vendorman1direxp="$ansexp"
9532	;;
9533esac
9534: Use ' ' for none so value is preserved next time through Configure
9535$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9536prefixvar=vendorman1dir
9537. ./installprefix
9538
9539: Set the vendorman3dir variables
9540case "$vendorprefix" in
9541'')	vendorman3dir=''
9542	vendorman3direxp=''
9543	;;
9544*)	: determine where vendor-supplied module manual pages go.
9545	case "$vendorman3dir" in
9546	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9547	*)	dflt=$vendorman3dir ;;
9548	esac
9549	case "$dflt" in
9550	''|' ') dflt=none ;;
9551	esac
9552	fn=nd~+
9553	rp='Pathname for the vendor-supplied manual section 3 pages?'
9554	. ./getfile
9555	vendorman3dir="$ans"
9556	vendorman3direxp="$ansexp"
9557	;;
9558esac
9559: Use ' ' for none so value is preserved next time through Configure
9560$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9561prefixvar=vendorman3dir
9562. ./installprefix
9563
9564: Set the vendorscript variables
9565case "$vendorprefix" in
9566'')	d_vendorscript="$undef"
9567	vendorscript=''
9568	vendorscriptexp=''
9569	;;
9570*)	d_vendorscript="$define"
9571	: determine where vendor-supplied scripts go.
9572	case "$vendorscript" in
9573	'')	dflt=$vendorprefix/script
9574		$test -d $dflt || dflt=$vendorbin ;;
9575	*)  dflt="$vendorscript" ;;
9576	esac
9577	$cat <<EOM
9578
9579The installation process will create a directory for
9580vendor-supplied scripts.
9581
9582EOM
9583	fn=d~+
9584	rp='Pathname for the vendor-supplied scripts directory?'
9585	. ./getfile
9586	vendorscript="$ans"
9587	vendorscriptexp="$ansexp"
9588	;;
9589esac
9590prefixvar=vendorscript
9591. ./installprefix
9592
9593: script used to emit important warnings
9594cat >warn <<EOS
9595$startsh
9596if test \$# -gt 0; then
9597	echo "\$@" >msg
9598else
9599	cat >msg
9600fi
9601echo "*** WARNING:" >&4
9602sed -e 's/^/*** /' <msg >&4
9603echo "*** " >&4
9604cat msg >>config.msg
9605echo " " >>config.msg
9606rm -f msg
9607EOS
9608chmod +x warn
9609$eunicefix warn
9610
9611: see which of string.h or strings.h is needed
9612echo " "
9613strings=`./findhdr string.h`
9614if $test "$strings" && $test -r "$strings"; then
9615	echo "Using <string.h> instead of <strings.h>." >&4
9616	val="$define"
9617else
9618	val="$undef"
9619	strings=`./findhdr strings.h`
9620	if $test "$strings" && $test -r "$strings"; then
9621		echo "Using <strings.h> instead of <string.h>." >&4
9622	else
9623		./warn "No string header found -- You'll surely have problems."
9624	fi
9625fi
9626set i_string
9627eval $setvar
9628case "$i_string" in
9629"$undef") strings=`./findhdr strings.h`;;
9630*)	  strings=`./findhdr string.h`;;
9631esac
9632
9633: see if qgcvt exists
9634set qgcvt d_qgcvt
9635eval $inlibc
9636
9637: Check print/scan long double stuff
9638echo " "
9639
9640if $test X"$d_longdbl" = X"$define"; then
9641
9642echo "Checking how to print long doubles..." >&4
9643
9644if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9645	$cat >try.c <<'EOCP'
9646#include <sys/types.h>
9647#include <stdio.h>
9648int main() {
9649  double d = 123.456;
9650  printf("%.3f\n", d);
9651}
9652EOCP
9653	set try
9654	if eval $compile; then
9655		yyy=`$run ./try`
9656		case "$yyy" in
9657		123.456)
9658			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9659                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9660			echo "We will use %f."
9661			;;
9662		esac
9663	fi
9664fi
9665
9666if $test X"$sPRIfldbl" = X; then
9667	$cat >try.c <<'EOCP'
9668#include <sys/types.h>
9669#include <stdio.h>
9670int main() {
9671  long double d = 123.456;
9672  printf("%.3Lf\n", d);
9673}
9674EOCP
9675	set try
9676	if eval $compile; then
9677		yyy=`$run ./try`
9678		case "$yyy" in
9679		123.456)
9680			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9681                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9682			echo "We will use %Lf."
9683			;;
9684		esac
9685	fi
9686fi
9687
9688if $test X"$sPRIfldbl" = X; then
9689	$cat >try.c <<'EOCP'
9690#include <sys/types.h>
9691#include <stdio.h>
9692int main() {
9693  long double d = 123.456;
9694  printf("%.3llf\n", d);
9695}
9696EOCP
9697	set try
9698	if eval $compile; then
9699		yyy=`$run ./try`
9700		case "$yyy" in
9701		123.456)
9702			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9703                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9704			echo "We will use %llf."
9705			;;
9706		esac
9707	fi
9708fi
9709
9710if $test X"$sPRIfldbl" = X; then
9711	$cat >try.c <<'EOCP'
9712#include <sys/types.h>
9713#include <stdio.h>
9714int main() {
9715  long double d = 123.456;
9716  printf("%.3lf\n", d);
9717}
9718EOCP
9719	set try
9720	if eval $compile; then
9721		yyy=`$run ./try`
9722		case "$yyy" in
9723		123.456)
9724			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9725                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9726			echo "We will use %lf."
9727			;;
9728		esac
9729	fi
9730fi
9731
9732if $test X"$sPRIfldbl" = X; then
9733	echo "Cannot figure out how to print long doubles." >&4
9734else
9735	sSCNfldbl=$sPRIfldbl	# expect consistency
9736fi
9737
9738$rm_try
9739
9740fi # d_longdbl
9741
9742case "$sPRIfldbl" in
9743'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9744	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9745	d_SCNfldbl="$undef";
9746	;;
9747*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9748	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9749	d_SCNfldbl="$define";
9750	;;
9751esac
9752
9753: Check how to convert floats to strings.
9754
9755if test "X$d_Gconvert" = X; then
9756
9757echo " "
9758echo "Checking for an efficient way to convert floats to strings."
9759echo " " > try.c
9760case "$uselongdouble" in
9761"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9762esac
9763case "$d_longdbl" in
9764"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9765esac
9766case "$d_PRIgldbl" in
9767"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9768esac
9769$cat >>try.c <<EOP
9770#ifdef TRY_gconvert
9771#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9772char *myname = "gconvert";
9773#endif
9774#ifdef TRY_gcvt
9775#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9776char *myname = "gcvt";
9777#endif
9778#ifdef TRY_qgcvt
9779#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9780char *myname = "qgcvt";
9781#define DOUBLETYPE long double
9782#endif
9783#ifdef TRY_sprintf
9784#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9785#ifdef HAS_PRIgldbl
9786#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9787#else
9788#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9789#endif
9790#else
9791#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9792#endif
9793char *myname = "sprintf";
9794#endif
9795
9796#ifndef DOUBLETYPE
9797#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9798#define DOUBLETYPE long double
9799#else
9800#define DOUBLETYPE double
9801#endif
9802#endif
9803
9804#include <stdio.h>
9805
9806#$i_stdlib I_STDLIB
9807#ifdef I_STDLIB
9808#include <stdlib.h>
9809#endif
9810#$i_string I_STRING
9811#ifdef I_STRING
9812#  include <string.h>
9813#else
9814#  include <strings.h>
9815#endif
9816
9817int checkit(char *expect, char *got)
9818{
9819    if (strcmp(expect, got)) {
9820		printf("%s oddity:  Expected %s, got %s\n",
9821			myname, expect, got);
9822		exit(1);
9823	}
9824}
9825
9826int main()
9827{
9828	char buf[64];
9829	buf[63] = '\0';
9830
9831	/* This must be 1st test on (which?) platform */
9832	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9833	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9834	checkit("0.1", buf);
9835
9836	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9837	checkit("0.01", buf);
9838
9839	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9840	checkit("0.001", buf);
9841
9842	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9843	checkit("0.0001", buf);
9844
9845	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9846	if (strlen(buf) > 5)
9847	    checkit("9e-005", buf); /* for Microsoft ?? */
9848	else
9849	    checkit("9e-05", buf);
9850
9851	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9852	checkit("1", buf);
9853
9854	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9855	checkit("1.1", buf);
9856
9857	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9858	checkit("1.01", buf);
9859
9860	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9861	checkit("1.001", buf);
9862
9863	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9864	checkit("1.0001", buf);
9865
9866	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9867	checkit("1.00001", buf);
9868
9869	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9870	checkit("1.000001", buf);
9871
9872	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9873	checkit("0", buf);
9874
9875	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9876	checkit("-1", buf);
9877
9878	/* Some Linux gcvt's give 1.e+5 here. */
9879	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9880	checkit("100000", buf);
9881
9882	/* Some Linux gcvt's give -1.e+5 here. */
9883	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9884	checkit("-100000", buf);
9885
9886	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9887	checkit("123.456", buf);
9888
9889	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9890	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9891	/* 34 should be enough to scare even long double
9892	 * places into using the e notation. */
9893	if (strlen(buf) > 5)
9894	    checkit("1e+034", buf); /* for Microsoft */
9895	else
9896	    checkit("1e+34", buf);
9897
9898	/* For Perl, if you add additional tests here, also add them to
9899	 * t/base/num.t for benefit of platforms not using Configure or
9900	 * overriding d_Gconvert */
9901
9902	exit(0);
9903}
9904EOP
9905: first add preferred functions to our list
9906xxx_list=""
9907for xxx_convert in $gconvert_preference; do
9908    case $xxx_convert in
9909    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9910    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9911    esac
9912done
9913: then add any others
9914for xxx_convert in gconvert gcvt sprintf; do
9915    case "$xxx_list" in
9916    *$xxx_convert*) ;;
9917    *) xxx_list="$xxx_list $xxx_convert" ;;
9918    esac
9919done
9920
9921case "$d_longdbl$uselongdouble" in
9922"$define$define")
9923    : again, add prefered functions to our list first
9924    xxx_ld_list=""
9925    for xxx_convert in $gconvert_ld_preference; do
9926        case $xxx_convert in
9927        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9928        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9929        esac
9930    done
9931    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9932    for xxx_convert in qgcvt sprintf $xxx_list; do
9933        case "$xxx_ld_list" in
9934        $xxx_convert*|*" $xxx_convert"*) ;;
9935        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9936        esac
9937    done
9938    : if sprintf cannot do long doubles, move it to the end
9939    if test "$d_PRIgldbl" != "$define"; then
9940        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9941    fi
9942    : if no qgcvt, remove it
9943    if test "$d_qgcvt" != "$define"; then
9944        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9945    fi
9946    : use the ld_list
9947    xxx_list="$xxx_ld_list"
9948    ;;
9949esac
9950
9951for xxx_convert in $xxx_list; do
9952	echo "Trying $xxx_convert..."
9953	$rm -f try try$_o core
9954	set try -DTRY_$xxx_convert
9955	if eval $compile; then
9956		echo "$xxx_convert() found." >&4
9957		if $run ./try; then
9958			echo "I'll use $xxx_convert to convert floats into a string." >&4
9959			break;
9960		else
9961			echo "...But $xxx_convert didn't work as I expected."
9962			xxx_convert=''
9963		fi
9964	else
9965		echo "$xxx_convert NOT found." >&4
9966	fi
9967done
9968
9969if test X$xxx_convert = X; then
9970    echo "*** WHOA THERE!!! ***" >&4
9971    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9972    xxx_convert=sprintf
9973fi
9974
9975case "$xxx_convert" in
9976gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9977gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9978qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9979*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9980   "$define$define$define")
9981      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9982   "$define$define$undef")
9983      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9984   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9985   esac
9986   ;;
9987esac
9988
9989fi
9990$rm_try
9991
9992: see if _fwalk exists
9993set fwalk d__fwalk
9994eval $inlibc
9995
9996: Initialize h_fcntl
9997h_fcntl=false
9998
9999: Initialize h_sysfile
10000h_sysfile=false
10001
10002: access call always available on UNIX
10003set access d_access
10004eval $inlibc
10005
10006: locate the flags for 'access()'
10007case "$d_access" in
10008"$define")
10009	echo " "
10010	$cat >access.c <<EOCP
10011#include <sys/types.h>
10012#ifdef I_FCNTL
10013#include <fcntl.h>
10014#endif
10015#ifdef I_SYS_FILE
10016#include <sys/file.h>
10017#endif
10018#ifdef I_UNISTD
10019#include <unistd.h>
10020#endif
10021#$i_stdlib I_STDLIB
10022#ifdef I_STDLIB
10023#include <stdlib.h>
10024#endif
10025int main() {
10026	exit(R_OK);
10027}
10028EOCP
10029	: check sys/file.h first, no particular reason here
10030	if $test `./findhdr sys/file.h` && \
10031		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10032		h_sysfile=true;
10033		echo "<sys/file.h> defines the *_OK access constants." >&4
10034	elif $test `./findhdr fcntl.h` && \
10035		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10036		h_fcntl=true;
10037		echo "<fcntl.h> defines the *_OK access constants." >&4
10038	elif $test `./findhdr unistd.h` && \
10039		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10040		echo "<unistd.h> defines the *_OK access constants." >&4
10041	else
10042		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10043	fi
10044	;;
10045esac
10046$rm -f access*
10047
10048: see if accessx exists
10049set accessx d_accessx
10050eval $inlibc
10051
10052: see if aintl exists
10053set aintl d_aintl
10054eval $inlibc
10055
10056: see if alarm exists
10057set alarm d_alarm
10058eval $inlibc
10059
10060: see if 64bit time functions exists
10061
10062set ctime64 d_ctime64
10063eval $inlibc
10064
10065set localtime64 d_localtime64
10066eval $inlibc
10067
10068set gmtime64 d_gmtime64
10069eval $inlibc
10070
10071set mktime64 d_mktime64
10072eval $inlibc
10073
10074set difftime64 d_difftime64
10075eval $inlibc
10076
10077set asctime64 d_asctime64
10078eval $inlibc
10079
10080: see if POSIX threads are available
10081set pthread.h i_pthread
10082eval $inhdr
10083
10084: define a fucntion to check prototypes
10085$cat > protochk <<EOSH
10086$startsh
10087cc="$cc"
10088optimize="$optimize"
10089ccflags="$ccflags"
10090prototype="$prototype"
10091define="$define"
10092rm_try="$rm_try"
10093usethreads=$usethreads
10094i_pthread=$i_pthread
10095pthread_h_first=$pthread_h_first
10096EOSH
10097
10098$cat >> protochk <<'EOSH'
10099
10100$rm_try
10101foo="$1"
10102shift
10103while test $# -ge 2; do
10104	case "$1" in
10105		$define) echo "#include <$2>" >> try.c ;;
10106		literal) echo "$2" >> try.c ;;
10107	esac
10108    # Extra magic for the benefit of systems that need pthread.h
10109    # to be included early to correctly detect threadsafe functions.
10110    # Such functions must guarantee themselves, though, that the usethreads
10111    # and i_pthread have been defined, before calling protochk.
10112    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10113	echo "#include <pthread.h>" >> try.c
10114	pthread_h_done=yes
10115    fi
10116    shift 2
10117done
10118test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10119cat >> try.c <<'EOCP'
10120#ifdef CAN_PROTOTYPE
10121#define	_(args) args
10122#else
10123#define	_(args) ()
10124#endif
10125EOCP
10126echo "$foo" >> try.c
10127echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10128$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10129status=$?
10130$rm_try
10131exit $status
10132EOSH
10133chmod +x protochk
10134$eunicefix protochk
10135
10136: Define hasproto macro for Configure internal use
10137hasproto='varname=$1; func=$2; shift; shift;
10138while $test $# -ge 2; do
10139	case "$1" in
10140	$define) echo "#include <$2>";;
10141	esac ;
10142    shift 2;
10143done > try.c;
10144$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10145if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10146	echo "$func() prototype found.";
10147	val="$define";
10148else
10149	echo "$func() prototype NOT found.";
10150	val="$undef";
10151fi;
10152set $varname;
10153eval $setvar;
10154$rm_try tryout.c'
10155
10156: see if sys/types.h has to be included
10157set sys/types.h i_systypes
10158eval $inhdr
10159
10160: see if sys/select.h has to be included
10161set sys/select.h i_sysselct
10162eval $inhdr
10163
10164: Define hasfield macro for Configure internal use
10165hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10166while $test $# -ge 2; do
10167	case "$1" in
10168	$define) echo "#include <$2>";;
10169	esac ;
10170    shift 2;
10171done > try.c;
10172echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10173set try;
10174if eval $compile; then
10175	val="$define";
10176else
10177	val="$undef";
10178fi;
10179set $varname;
10180eval $setvar;
10181$rm_try'
10182
10183: see if we should include time.h, sys/time.h, or both
10184echo " "
10185if test "X$timeincl" = X; then
10186	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10187	$echo $n "I'm now running the test program...$c"
10188	$cat >try.c <<EOCP
10189#include <sys/types.h>
10190#ifdef I_TIME
10191#include <time.h>
10192#endif
10193#ifdef I_SYSTIME
10194#ifdef SYSTIMEKERNEL
10195#define KERNEL
10196#endif
10197#include <sys/time.h>
10198#endif
10199#ifdef I_SYSSELECT
10200#include <sys/select.h>
10201#endif
10202#$i_stdlib I_STDLIB
10203#ifdef I_STDLIB
10204#include <stdlib.h>
10205#endif
10206int main()
10207{
10208	struct tm foo;
10209#ifdef S_TIMEVAL
10210	struct timeval bar;
10211#endif
10212#ifdef S_TIMEZONE
10213	struct timezone tzp;
10214#endif
10215	if (foo.tm_sec == foo.tm_sec)
10216		exit(0);
10217#ifdef S_TIMEVAL
10218	if (bar.tv_sec == bar.tv_sec)
10219		exit(0);
10220#endif
10221	exit(1);
10222}
10223EOCP
10224	flags=''
10225	for s_timezone in '-DS_TIMEZONE' ''; do
10226	sysselect=''
10227	for s_timeval in '-DS_TIMEVAL' ''; do
10228	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10229	for i_time in '' '-DI_TIME'; do
10230	for i_systime in '-DI_SYSTIME' ''; do
10231		case "$flags" in
10232		'') $echo $n ".$c"
10233			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10234			if eval $compile; then
10235				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10236				shift
10237				flags="$*"
10238				echo " "
10239				$echo $n "Succeeded with $flags$c"
10240			fi
10241			;;
10242		esac
10243	done
10244	done
10245	done
10246	done
10247	done
10248	timeincl=''
10249	echo " "
10250	case "$flags" in
10251	*SYSTIMEKERNEL*) i_systimek="$define"
10252		timeincl=`./findhdr sys/time.h`
10253		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10254	*) i_systimek="$undef";;
10255	esac
10256	case "$flags" in
10257	*I_TIME*) i_time="$define"
10258		timeincl=`./findhdr time.h`" $timeincl"
10259		echo "We'll include <time.h>." >&4;;
10260	*) i_time="$undef";;
10261	esac
10262	case "$flags" in
10263	*I_SYSTIME*) i_systime="$define"
10264		timeincl=`./findhdr sys/time.h`" $timeincl"
10265		echo "We'll include <sys/time.h>." >&4;;
10266	*) i_systime="$undef";;
10267	esac
10268	$rm_try
10269fi
10270: see if struct tm knows about tm_zone
10271case "$i_systime$i_time" in
10272*$define*)
10273        echo " "
10274        echo "Checking to see if your struct tm has tm_zone field..." >&4
10275        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10276        eval $hasfield
10277        ;;
10278*)      val="$undef"
10279        set d_tm_tm_zone
10280        eval $setvar
10281        ;;
10282esac
10283case "$d_tm_tm_zone" in
10284"$define")      echo "Yes, it does."   ;;
10285*)              echo "No, it doesn't." ;;
10286esac
10287: see if struct tm knows about tm_gmtoff
10288case "$i_systime$i_time" in
10289*$define*)
10290        echo " "
10291        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10292        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10293        eval $hasfield
10294        ;;
10295*)      val="$undef"
10296        set d_tm_tm_gmtoff
10297        eval $setvar
10298        ;;
10299esac
10300case "$d_tm_tm_gmtoff" in
10301"$define")      echo "Yes, it does."   ;;
10302*)              echo "No, it doesn't." ;;
10303esac
10304
10305: see if asctime_r exists
10306set asctime_r d_asctime_r
10307eval $inlibc
10308case "$d_asctime_r" in
10309"$define")
10310	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10311	case "$d_asctime_r_proto:$usethreads" in
10312	":define")	d_asctime_r_proto=define
10313		set d_asctime_r_proto asctime_r $hdrs
10314		eval $hasproto ;;
10315	*)	;;
10316	esac
10317	case "$d_asctime_r_proto" in
10318	define)
10319	case "$asctime_r_proto" in
10320	''|0) try='char* asctime_r(const struct tm*, char*);'
10321	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10322	esac
10323	case "$asctime_r_proto" in
10324	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10325	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10326	esac
10327	case "$asctime_r_proto" in
10328	''|0) try='int asctime_r(const struct tm*, char*);'
10329	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10330	esac
10331	case "$asctime_r_proto" in
10332	''|0) try='int asctime_r(const struct tm*, char*, int);'
10333	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10334	esac
10335	case "$asctime_r_proto" in
10336	''|0)	d_asctime_r=undef
10337 	        asctime_r_proto=0
10338		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10339	* )	case "$asctime_r_proto" in
10340		REENTRANT_PROTO*) ;;
10341		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10342		esac
10343		echo "Prototype: $try" ;;
10344	esac
10345	;;
10346	*)	case "$usethreads" in
10347		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10348		esac
10349		d_asctime_r=undef
10350		asctime_r_proto=0
10351		;;
10352	esac
10353	;;
10354*)	asctime_r_proto=0
10355	;;
10356esac
10357
10358: see if atolf exists
10359set atolf d_atolf
10360eval $inlibc
10361
10362: see if atoll exists
10363set atoll d_atoll
10364eval $inlibc
10365
10366: Look for GCC-style attribute format
10367case "$d_attribute_format" in
10368'')
10369echo " "
10370echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10371$cat >attrib.c <<'EOCP'
10372#include <stdio.h>
10373void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10374EOCP
10375if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10376	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10377		echo "Your C compiler doesn't support __attribute__((format))."
10378		val="$undef"
10379	else
10380		echo "Your C compiler supports __attribute__((format))."
10381		val="$define"
10382	fi
10383else
10384	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10385	val="$undef"
10386fi
10387;;
10388*) val="$d_attribute_format" ;;
10389esac
10390set d_attribute_format
10391eval $setvar
10392$rm -f attrib*
10393
10394: Look for GCC-style attribute format with null format allowed
10395case "$d_printf_format_null" in
10396'') case "$d_attribute_format" in
10397    $define)
10398	echo " "
10399	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10400$cat >attrib.c <<EOCP
10401#include <stdio.h>
10402#$i_stdlib I_STDLIB
10403#ifdef I_STDLIB
10404#include <stdlib.h>
10405#endif
10406int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10407int null_printf (char* pat,...) { return (int)pat; }
10408int main () { exit(null_printf(NULL)); }
10409EOCP
10410	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10411	    : run the executable in case it produces a run-time warning
10412	    if $run ./attrib >>attrib.out 2>&1; then
10413		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10414		    echo "Your C compiler doesn't allow __printf__ format to be null."
10415		    val="$undef"
10416		else
10417		    echo "Your C compiler allows __printf__ format to be null."
10418		    val="$define"
10419		fi
10420	    else
10421	    echo "Your C compiler executable failed with __printf__ format null."
10422	    val="$undef"
10423	fi
10424    else
10425	echo "Your C compiler fails with __printf__ format null."
10426	val="$undef"
10427    fi
10428    ;;
10429    *)  val="$undef" ;;
10430    esac
10431;;
10432*)  val="$d_printf_format_null" ;;
10433esac
10434set d_printf_format_null
10435eval $setvar
10436$rm -f attrib*
10437
10438: Look for GCC-style attribute malloc
10439case "$d_attribute_malloc" in
10440'')
10441echo " "
10442echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10443$cat >attrib.c <<'EOCP'
10444#include <stdio.h>
10445char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10446EOCP
10447if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10448	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10449		echo "Your C compiler doesn't support __attribute__((malloc))."
10450		val="$undef"
10451	else
10452		echo "Your C compiler supports __attribute__((malloc))."
10453		val="$define"
10454	fi
10455else
10456	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10457	val="$undef"
10458fi
10459;;
10460*) val="$d_attribute_malloc" ;;
10461esac
10462set d_attribute_malloc
10463eval $setvar
10464$rm -f attrib*
10465
10466: Look for GCC-style attribute nonnull
10467case "$d_attribute_nonnull" in
10468'')
10469echo " "
10470echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10471$cat >attrib.c <<'EOCP'
10472#include <stdio.h>
10473void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10474EOCP
10475if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10476	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10477		echo "Your C compiler doesn't support __attribute__((nonnull))."
10478		val="$undef"
10479	else
10480		echo "Your C compiler supports __attribute__((nonnull))."
10481		val="$define"
10482	fi
10483else
10484	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10485	val="$undef"
10486fi
10487;;
10488*) val="$d_attribute_nonnull" ;;
10489esac
10490set d_attribute_nonnull
10491eval $setvar
10492$rm -f attrib*
10493
10494: Look for GCC-style attribute noreturn
10495case "$d_attribute_noreturn" in
10496'')
10497echo " "
10498echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10499$cat >attrib.c <<'EOCP'
10500#include <stdio.h>
10501void fall_over_dead( void ) __attribute__((noreturn));
10502EOCP
10503if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10504	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10505		echo "Your C compiler doesn't support __attribute__((noreturn))."
10506		val="$undef"
10507	else
10508		echo "Your C compiler supports __attribute__((noreturn))."
10509		val="$define"
10510	fi
10511else
10512	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10513	val="$undef"
10514fi
10515;;
10516*) val="$d_attribute_noreturn" ;;
10517esac
10518set d_attribute_noreturn
10519eval $setvar
10520$rm -f attrib*
10521
10522: Look for GCC-style attribute pure
10523case "$d_attribute_pure" in
10524'')
10525echo " "
10526echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10527$cat >attrib.c <<'EOCP'
10528#include <stdio.h>
10529int square( int n ) __attribute__((pure));
10530EOCP
10531if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10532	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10533		echo "Your C compiler doesn't support __attribute__((pure))."
10534		val="$undef"
10535	else
10536		echo "Your C compiler supports __attribute__((pure))."
10537		val="$define"
10538	fi
10539else
10540	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10541	val="$undef"
10542fi
10543;;
10544*) val="$d_attribute_pure" ;;
10545esac
10546set d_attribute_pure
10547eval $setvar
10548$rm -f attrib*
10549
10550: Look for GCC-style attribute unused
10551case "$d_attribute_unused" in
10552'')
10553echo " "
10554echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10555$cat >attrib.c <<'EOCP'
10556#include <stdio.h>
10557int do_something( int dummy __attribute__((unused)), int n );
10558EOCP
10559if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10560	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10561		echo "Your C compiler doesn't support __attribute__((unused))."
10562		val="$undef"
10563	else
10564		echo "Your C compiler supports __attribute__((unused))."
10565		val="$define"
10566	fi
10567else
10568	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10569	val="$undef"
10570fi
10571;;
10572*) val="$d_attribute_unused" ;;
10573esac
10574set d_attribute_unused
10575eval $setvar
10576$rm -f attrib*
10577
10578: Look for GCC-style attribute deprecated
10579case "$d_attribute_deprecated" in
10580'')
10581echo " "
10582echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10583$cat >attrib.c <<'EOCP'
10584#include <stdio.h>
10585int I_am_deprecated(void) __attribute__((deprecated));
10586EOCP
10587if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10588	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10589		echo "Your C compiler doesn't support __attribute__((deprecated))."
10590		val="$undef"
10591	else
10592		echo "Your C compiler supports __attribute__((deprecated))."
10593		val="$define"
10594	fi
10595else
10596	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10597	val="$undef"
10598fi
10599;;
10600*) val="$d_attribute_deprecated" ;;
10601esac
10602set d_attribute_deprecated
10603eval $setvar
10604$rm -f attrib*
10605
10606: Look for GCC-style attribute warn_unused_result
10607case "$d_attribute_warn_unused_result" in
10608'')
10609echo " "
10610echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10611$cat >attrib.c <<'EOCP'
10612#include <stdio.h>
10613int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10614EOCP
10615if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10616	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10617		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10618		val="$undef"
10619	else
10620		echo "Your C compiler supports __attribute__((warn_unused_result))."
10621		val="$define"
10622	fi
10623else
10624	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10625	val="$undef"
10626fi
10627;;
10628*) val="$d_attribute_warn_unused_result" ;;
10629esac
10630set d_attribute_warn_unused_result
10631eval $setvar
10632$rm -f attrib*
10633
10634: see if bcmp exists
10635set bcmp d_bcmp
10636eval $inlibc
10637
10638: see if bcopy exists
10639set bcopy d_bcopy
10640eval $inlibc
10641
10642: see if getpgrp exists
10643set getpgrp d_getpgrp
10644eval $inlibc
10645
10646case "$d_getpgrp" in
10647"$define")
10648	echo " "
10649	echo "Checking to see which flavor of getpgrp is in use..."
10650	$cat >try.c <<EOP
10651#$i_unistd I_UNISTD
10652#include <sys/types.h>
10653#ifdef I_UNISTD
10654#  include <unistd.h>
10655#endif
10656#$i_stdlib I_STDLIB
10657#ifdef I_STDLIB
10658#include <stdlib.h>
10659#endif
10660int main()
10661{
10662	if (getuid() == 0) {
10663		printf("(I see you are running Configure as super-user...)\n");
10664		setuid(1);
10665	}
10666#ifdef TRY_BSD_PGRP
10667	if (getpgrp(1) == 0)
10668		exit(0);
10669#else
10670	if (getpgrp() > 0)
10671		exit(0);
10672#endif
10673	exit(1);
10674}
10675EOP
10676	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10677		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10678		val="$define"
10679	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10680		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10681		val="$undef"
10682	else
10683		echo "I can't seem to compile and run the test program."
10684		if ./usg; then
10685			xxx="a USG one, i.e. you use getpgrp()."
10686		else
10687			# SVR4 systems can appear rather BSD-ish.
10688			case "$i_unistd" in
10689			$undef)
10690				xxx="a BSD one, i.e. you use getpgrp(pid)."
10691				val="$define"
10692				;;
10693			$define)
10694				xxx="probably a USG one, i.e. you use getpgrp()."
10695				val="$undef"
10696				;;
10697			esac
10698		fi
10699		echo "Assuming your getpgrp is $xxx" >&4
10700	fi
10701	;;
10702*) val="$undef";;
10703esac
10704set d_bsdgetpgrp
10705eval $setvar
10706$rm_try
10707
10708: see if setpgrp exists
10709set setpgrp d_setpgrp
10710eval $inlibc
10711
10712case "$d_setpgrp" in
10713"$define")
10714	echo " "
10715	echo "Checking to see which flavor of setpgrp is in use..."
10716	$cat >try.c <<EOP
10717#$i_unistd I_UNISTD
10718#include <sys/types.h>
10719#ifdef I_UNISTD
10720#  include <unistd.h>
10721#endif
10722#$i_stdlib I_STDLIB
10723#ifdef I_STDLIB
10724#include <stdlib.h>
10725#endif
10726int main()
10727{
10728	if (getuid() == 0) {
10729		printf("(I see you are running Configure as super-user...)\n");
10730		setuid(1);
10731	}
10732#ifdef TRY_BSD_PGRP
10733	if (-1 == setpgrp(1, 1))
10734		exit(0);
10735#else
10736	if (setpgrp() != -1)
10737		exit(0);
10738#endif
10739	exit(1);
10740}
10741EOP
10742	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10743		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10744		val="$define"
10745	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10746		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10747		val="$undef"
10748	else
10749		echo "(I can't seem to compile and run the test program.)"
10750		if ./usg; then
10751			xxx="a USG one, i.e. you use setpgrp()."
10752		else
10753			# SVR4 systems can appear rather BSD-ish.
10754			case "$i_unistd" in
10755			$undef)
10756				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10757				val="$define"
10758				;;
10759			$define)
10760				xxx="probably a USG one, i.e. you use setpgrp()."
10761				val="$undef"
10762				;;
10763			esac
10764		fi
10765		echo "Assuming your setpgrp is $xxx" >&4
10766	fi
10767	;;
10768*) val="$undef";;
10769esac
10770set d_bsdsetpgrp
10771eval $setvar
10772$rm_try
10773
10774: Look for GCC-style __builtin_choose_expr
10775case "$d_builtin_choose_expr" in
10776'')
10777    echo " "
10778    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10779    $cat >try.c <<'EOCP'
10780#include <assert.h>
10781#include <stdlib.h>
10782#include <stdio.h>
10783
10784#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10785
10786int main(void) {
10787    assert( SYRINX(1) == 2112 );
10788    assert( SYRINX(1) != 5150 );
10789    assert( SYRINX(0) == 5150 );
10790    assert( SYRINX(0) != 2112 );
10791    puts( "All good!" );
10792    exit(0);
10793}
10794
10795EOCP
10796    set try
10797    if eval $compile && $run ./try; then
10798	echo "Your C compiler supports __builtin_choose_expr."
10799	val="$define"
10800    else
10801	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10802	val="$undef"
10803    fi
10804;;
10805*) val="$d_builtin_choose_expr" ;;
10806esac
10807
10808set d_builtin_choose_expr
10809eval $setvar
10810$rm_try
10811
10812: Look for GCC-style __builtin_expect
10813case "$d_builtin_expect" in
10814'')
10815    echo " "
10816    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10817    $cat >try.c <<'EOCP'
10818int main(void) {
10819    int n = 50;
10820    if ( __builtin_expect(n, 0) ) n = 1;
10821    /* Remember shell exit code truth is 0, C truth is non-zero */
10822    return !(n == 1);
10823}
10824EOCP
10825    set try
10826    if eval $compile && $run ./try; then
10827	echo "Your C compiler supports __builtin_expect."
10828	val="$define"
10829    else
10830	echo "Your C compiler doesn't seem to understand __builtin_expect."
10831	val="$undef"
10832    fi
10833    ;;
10834*) val="$d_builtin_expect" ;;
10835esac
10836
10837set d_builtin_expect
10838eval $setvar
10839$rm_try
10840
10841: see if bzero exists
10842set bzero d_bzero
10843eval $inlibc
10844
10845: see if stdarg is available
10846echo " "
10847if $test `./findhdr stdarg.h`; then
10848	echo "<stdarg.h> found." >&4
10849	valstd="$define"
10850else
10851	echo "<stdarg.h> NOT found." >&4
10852	valstd="$undef"
10853fi
10854
10855: see if varags is available
10856echo " "
10857if $test `./findhdr varargs.h`; then
10858	echo "<varargs.h> found." >&4
10859else
10860	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10861fi
10862
10863: set up the varargs testing programs
10864$cat > varargs.c <<EOP
10865#ifdef I_STDARG
10866#include <stdarg.h>
10867#endif
10868#ifdef I_VARARGS
10869#include <varargs.h>
10870#endif
10871
10872#ifdef I_STDARG
10873int f(char *p, ...)
10874#else
10875int f(va_alist)
10876va_dcl
10877#endif
10878{
10879	va_list ap;
10880#ifndef I_STDARG
10881	char *p;
10882#endif
10883#ifdef I_STDARG
10884	va_start(ap,p);
10885#else
10886	va_start(ap);
10887	p = va_arg(ap, char *);
10888#endif
10889	va_end(ap);
10890	return 0;
10891}
10892EOP
10893$cat > varargs <<EOP
10894$startsh
10895if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10896	echo "true"
10897else
10898	echo "false"
10899fi
10900$rm -f varargs$_o
10901EOP
10902chmod +x varargs
10903
10904: now check which varargs header should be included
10905echo " "
10906i_varhdr=''
10907case "$valstd" in
10908"$define")
10909	if `./varargs I_STDARG`; then
10910		val='stdarg.h'
10911	elif `./varargs I_VARARGS`; then
10912		val='varargs.h'
10913	fi
10914	;;
10915*)
10916	if `./varargs I_VARARGS`; then
10917		val='varargs.h'
10918	fi
10919	;;
10920esac
10921case "$val" in
10922'')
10923echo "I could not find the definition for va_dcl... You have problems..." >&4
10924	val="$undef"; set i_stdarg; eval $setvar
10925	val="$undef"; set i_varargs; eval $setvar
10926	;;
10927*)
10928	set i_varhdr
10929	eval $setvar
10930	case "$i_varhdr" in
10931	stdarg.h)
10932		val="$define"; set i_stdarg; eval $setvar
10933		val="$undef"; set i_varargs; eval $setvar
10934		;;
10935	varargs.h)
10936		val="$undef"; set i_stdarg; eval $setvar
10937		val="$define"; set i_varargs; eval $setvar
10938		;;
10939	esac
10940	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10941esac
10942$rm -f varargs*
10943
10944: see if the Compiler supports C99 variadic macros
10945case "$i_stdarg$i_stdlib" in
10946    "$define$define")
10947    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10948    $cat >try.c <<EOCP
10949#include <stdio.h>
10950#include <stdarg.h>
10951
10952#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10953
10954int main() {
10955  char buf[20];
10956  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10957  puts(buf);
10958  return 0;
10959}
10960EOCP
10961    set try
10962    if eval $compile && $run ./try 2>&1 >/dev/null; then
10963	case "`$run ./try`" in
10964	    "123 456 789")
10965	    echo "You have C99 variadic macros." >&4
10966	    d_c99_variadic_macros="$define"
10967	    ;;
10968	    *)
10969	    echo "You don't have functional C99 variadic macros." >&4
10970	    d_c99_variadic_macros="$undef"
10971	    ;;
10972	esac
10973    else
10974	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10975	d_c99_variadic_macros="$undef"
10976    fi
10977    $rm_try
10978    ;;
10979    *)
10980    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10981    d_c99_variadic_macros="$undef"
10982    ;;
10983esac
10984
10985: see if signal is declared as pointer to function returning int or void
10986echo " "
10987xxx=`./findhdr signal.h`
10988$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10989if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10990	echo "You have int (*signal())() instead of void." >&4
10991	val="$undef"
10992elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10993	echo "You have void (*signal())()." >&4
10994	val="$define"
10995elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10996	echo "You have int (*signal())() instead of void." >&4
10997	val="$undef"
10998elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10999	echo "You have void (*signal())()." >&4
11000	val="$define"
11001else
11002	case "$d_voidsig" in
11003	'')
11004	echo "I can't determine whether signal handler returns void or int..." >&4
11005		dflt=void
11006		rp="What type does your signal handler return?"
11007		. ./myread
11008		case "$ans" in
11009		v*) val="$define";;
11010		*) val="$undef";;
11011		esac;;
11012	"$define")
11013		echo "As you already told me, signal handler returns void." >&4
11014		val="$define"
11015		;;
11016	*)	echo "As you already told me, signal handler returns int." >&4
11017		val="$undef"
11018		;;
11019	esac
11020fi
11021set d_voidsig
11022eval $setvar
11023case "$d_voidsig" in
11024"$define") signal_t="void";;
11025*) signal_t="int";;
11026esac
11027$rm -f $$.tmp
11028
11029: check for ability to cast large floats to 32-bit ints.
11030echo " "
11031echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11032if $test "$intsize" -ge 4; then
11033	xxx=int
11034else
11035	xxx=long
11036fi
11037$cat >try.c <<EOCP
11038#include <stdio.h>
11039#$i_stdlib I_STDLIB
11040#ifdef I_STDLIB
11041#include <stdlib.h>
11042#endif
11043#include <sys/types.h>
11044#include <signal.h>
11045$signal_t blech(int s) { exit(3); }
11046int main()
11047{
11048	$xxx i32;
11049	double f, g;
11050	int result = 0;
11051	char str[16];
11052	signal(SIGFPE, blech);
11053
11054	/* Don't let compiler optimize the test away.  Store the number
11055	   in a writable string for gcc to pass to sscanf under HP-UX.
11056	*/
11057	sprintf(str, "2147483647");
11058	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11059	g = 10 * f;
11060	i32  = ($xxx) g;
11061
11062	/* x86 processors will probably give 0x8000 0000, which is a
11063	   sign change.  We don't want that.  We want to mimic SPARC
11064	   behavior here, which is to preserve the sign and give
11065	   back 0x7fff ffff.
11066	*/
11067	if (i32 != ($xxx) f)
11068		result |= 1;
11069	exit(result);
11070}
11071EOCP
11072set try
11073if eval $compile_ok; then
11074	$run ./try
11075	yyy=$?
11076else
11077	echo "(I can't seem to compile the test program--assuming it can't)"
11078	yyy=1
11079fi
11080case "$yyy" in
110810)	val="$define"
11082	echo "Yup, it can."
11083	;;
11084*)	val="$undef"
11085	echo "Nope, it can't."
11086	;;
11087esac
11088set d_casti32
11089eval $setvar
11090$rm_try
11091
11092: check for ability to cast negative floats to unsigned
11093echo " "
11094echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11095$cat >try.c <<EOCP
11096#include <stdio.h>
11097#$i_stdlib I_STDLIB
11098#ifdef I_STDLIB
11099#include <stdlib.h>
11100#endif
11101#include <sys/types.h>
11102#include <signal.h>
11103$signal_t blech(int s) { exit(7); }
11104$signal_t blech_in_list(int s) { exit(4); }
11105unsigned long dummy_long(unsigned long p) { return p; }
11106unsigned int dummy_int(unsigned int p) { return p; }
11107unsigned short dummy_short(unsigned short p) { return p; }
11108int main()
11109{
11110	double f;
11111	unsigned long along;
11112	unsigned int aint;
11113	unsigned short ashort;
11114	int result = 0;
11115	char str[16];
11116
11117	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11118	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11119	   optimized the whole file away
11120	*/
11121	/* Store the number in a writable string for gcc to pass to
11122	   sscanf under HP-UX.
11123	*/
11124	sprintf(str, "-123");
11125	sscanf(str, "%lf", &f);  /* f = -123.; */
11126
11127	signal(SIGFPE, blech);
11128	along = (unsigned long)f;
11129	aint = (unsigned int)f;
11130	ashort = (unsigned short)f;
11131	if (along != (unsigned long)-123)
11132		result |= 1;
11133	if (aint != (unsigned int)-123)
11134		result |= 1;
11135	if (ashort != (unsigned short)-123)
11136		result |= 1;
11137	sprintf(str, "1073741824.");
11138	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11139	f = f + f;
11140	along = 0;
11141	along = (unsigned long)f;
11142	if (along != 0x80000000)
11143		result |= 2;
11144	f -= 1.;
11145	along = 0;
11146	along = (unsigned long)f;
11147	if (along != 0x7fffffff)
11148		result |= 1;
11149	f += 2.;
11150	along = 0;
11151	along = (unsigned long)f;
11152	if (along != 0x80000001)
11153		result |= 2;
11154	if (result)
11155		exit(result);
11156	signal(SIGFPE, blech_in_list);
11157	sprintf(str, "123.");
11158	sscanf(str, "%lf", &f);  /* f = 123.; */
11159	along = dummy_long((unsigned long)f);
11160	aint = dummy_int((unsigned int)f);
11161	ashort = dummy_short((unsigned short)f);
11162	if (along != (unsigned long)123)
11163		result |= 4;
11164	if (aint != (unsigned int)123)
11165		result |= 4;
11166	if (ashort != (unsigned short)123)
11167		result |= 4;
11168	exit(result);
11169
11170}
11171EOCP
11172set try
11173if eval $compile_ok; then
11174	$run ./try
11175	castflags=$?
11176else
11177	echo "(I can't seem to compile the test program--assuming it can't)"
11178	castflags=7
11179fi
11180case "$castflags" in
111810)	val="$define"
11182	echo "Yup, it can."
11183	;;
11184*)	val="$undef"
11185	echo "Nope, it can't."
11186	;;
11187esac
11188set d_castneg
11189eval $setvar
11190$rm_try
11191
11192: see if vprintf exists
11193echo " "
11194if set vprintf val -f d_vprintf; eval $csym; $val; then
11195	echo 'vprintf() found.' >&4
11196	val="$define"
11197	$cat >try.c <<EOF
11198#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11199#$i_varargs I_VARARGS
11200
11201#$i_stdlib I_STDLIB
11202#$i_unistd I_UNISTD
11203
11204#ifdef I_STDARG
11205#  include <stdarg.h>
11206#else /* I_VARARGS */
11207#  include <varargs.h>
11208#endif
11209
11210#ifdef I_UNISTD
11211#  include <unistd.h>
11212#endif
11213
11214#ifdef I_STDLIB
11215#  include <stdlib.h>
11216#endif
11217
11218#include <stdio.h> /* vsprintf prototype */
11219
11220#ifdef I_STDARG
11221void xxx(int n, ...)
11222{
11223    va_list args;
11224    char buf[10];
11225    va_start(args, n);
11226    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11227}
11228int main() { xxx(1, "foo"); }
11229
11230#else /* I_VARARGS */
11231
11232xxx(va_alist)
11233va_dcl
11234{
11235    va_list args;
11236    char buf[10];
11237    va_start(args);
11238    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11239}
11240int main() { xxx("foo"); }
11241
11242#endif
11243
11244EOF
11245	set try
11246	if eval $compile_ok; then
11247		if $run ./try; then
11248			echo "Your vsprintf() returns (int)." >&4
11249			val2="$undef"
11250		else
11251			echo "Your vsprintf() returns (char*)." >&4
11252			val2="$define"
11253		fi
11254	else
11255		echo 'I am unable to compile the vsprintf() test program.' >&4
11256		# We shouldn't get here.  If we do, assume the standard signature,
11257		# not the old BSD one.
11258		echo 'Guessing that vsprintf() returns (int).' >&4
11259		val2="$undef"
11260	fi
11261else
11262	echo 'vprintf() NOT found.' >&4
11263	val="$undef"
11264	val2="$undef"
11265fi
11266$rm_try
11267set d_vprintf
11268eval $setvar
11269val=$val2
11270set d_charvspr
11271eval $setvar
11272
11273: see if chown exists
11274set chown d_chown
11275eval $inlibc
11276
11277: see if chroot exists
11278set chroot d_chroot
11279eval $inlibc
11280
11281: see if chsize exists
11282set chsize d_chsize
11283eval $inlibc
11284
11285: see if class exists
11286set class d_class
11287eval $inlibc
11288
11289: see if clearenv exists
11290set clearenv d_clearenv
11291eval $inlibc
11292
11293: Define hasstruct macro for Configure internal use
11294hasstruct='varname=$1; struct=$2; shift; shift;
11295while $test $# -ge 2; do
11296	case "$1" in
11297	$define) echo "#include <$2>";;
11298	esac ;
11299    shift 2;
11300done > try.c;
11301echo "int main () { struct $struct foo; }" >> try.c;
11302set try;
11303if eval $compile; then
11304	val="$define";
11305else
11306	val="$undef";
11307fi;
11308set $varname;
11309eval $setvar;
11310$rm_try'
11311
11312: see whether socket exists
11313socketlib=''
11314sockethdr=''
11315echo " "
11316$echo $n "Hmm... $c" >&4
11317if set socket val -f d_socket; eval $csym; $val; then
11318	echo "Looks like you have Berkeley networking support." >&4
11319	d_socket="$define"
11320	if set setsockopt val -f; eval $csym; $val; then
11321		d_oldsock="$undef"
11322	else
11323		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11324		d_oldsock="$define"
11325	fi
11326else
11327	if $contains socklib libc.list >/dev/null 2>&1; then
11328		echo "Looks like you have Berkeley networking support." >&4
11329		d_socket="$define"
11330		: we will have to assume that it supports the 4.2 BSD interface
11331		d_oldsock="$undef"
11332	else
11333		echo "You don't have Berkeley networking in libc$_a..." >&4
11334		if test "X$d_socket" = "X$define"; then
11335		   echo "...but you seem to believe that you have sockets." >&4
11336		else
11337			for net in net socket
11338			do
11339				if test -f /usr/lib/lib$net$_a; then
11340					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11341					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11342					if $contains socket libc.list >/dev/null 2>&1; then
11343						d_socket="$define"
11344						socketlib="-l$net"
11345						case "$net" in
11346						net)
11347							echo "...but the Wollongong group seems to have hacked it in." >&4
11348							sockethdr="-I/usr/netinclude"
11349							;;
11350						esac
11351						echo "Found Berkeley sockets interface in lib$net." >&4
11352						if $contains setsockopt libc.list >/dev/null 2>&1; then
11353							d_oldsock="$undef"
11354						else
11355							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11356							d_oldsock="$define"
11357						fi
11358						break
11359					fi
11360				fi
11361			done
11362			if test "X$d_socket" != "X$define"; then
11363			   echo "or anywhere else I see." >&4
11364			   d_socket="$undef"
11365			   d_oldsock="$undef"
11366			fi
11367		fi
11368	fi
11369fi
11370
11371: see if socketpair exists
11372set socketpair d_sockpair
11373eval $inlibc
11374
11375
11376echo " "
11377echo "Checking the availability of certain socket constants..." >&4
11378for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11379	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11380	$cat >try.c <<EOF
11381#include <sys/types.h>
11382#include <sys/socket.h>
11383int main() {
11384    int i = $ENUM;
11385}
11386EOF
11387	val="$undef"
11388	set try; if eval $compile; then
11389		val="$define"
11390	fi
11391	set d_${enum}; eval $setvar
11392	$rm_try
11393done
11394
11395: see if this is a sys/uio.h system
11396set sys/uio.h i_sysuio
11397eval $inhdr
11398
11399: Check for cmsghdr support
11400echo " "
11401echo "Checking to see if your system supports struct cmsghdr..." >&4
11402set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11403eval $hasstruct
11404case "$d_cmsghdr_s" in
11405"$define")      echo "Yes, it does."   ;;
11406*)              echo "No, it doesn't." ;;
11407esac
11408
11409
11410: check for const keyword
11411echo " "
11412echo 'Checking to see if your C compiler knows about "const"...' >&4
11413$cat >const.c <<'EOCP'
11414typedef struct spug { int drokk; } spug;
11415int main()
11416{
11417	const char *foo;
11418	const spug y = { 0 };
11419}
11420EOCP
11421if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11422	val="$define"
11423	echo "Yup, it does."
11424else
11425	val="$undef"
11426	echo "Nope, it doesn't."
11427fi
11428set d_const
11429eval $setvar
11430
11431: see if copysignl exists
11432set copysignl d_copysignl
11433eval $inlibc
11434
11435: see if crypt exists
11436echo " "
11437set crypt d_crypt
11438eval $inlibc
11439case "$d_crypt" in
11440$define) cryptlib='' ;;
11441*)	if set crypt val -f d_crypt; eval $csym; $val; then
11442		echo 'crypt() found.' >&4
11443		val="$define"
11444		cryptlib=''
11445	else
11446		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11447		if $test -z "$cryptlib"; then
11448			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11449		else
11450			cryptlib=-lcrypt
11451		fi
11452		if $test -z "$cryptlib"; then
11453			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11454		else
11455			cryptlib=-lcrypt
11456		fi
11457		if $test -z "$cryptlib"; then
11458			cryptlib=`./loc libcrypt$_a "" $libpth`
11459		else
11460			cryptlib=-lcrypt
11461		fi
11462		if $test -z "$cryptlib"; then
11463			echo 'crypt() NOT found.' >&4
11464			val="$undef"
11465		else
11466			val="$define"
11467		fi
11468	fi
11469	set d_crypt
11470	eval $setvar
11471	;;
11472esac
11473
11474: see if this is a crypt.h system
11475set crypt.h i_crypt
11476eval $inhdr
11477
11478: see if crypt_r exists
11479set crypt_r d_crypt_r
11480eval $inlibc
11481case "$d_crypt_r" in
11482"$define")
11483	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11484	case "$d_crypt_r_proto:$usethreads" in
11485	":define")	d_crypt_r_proto=define
11486		set d_crypt_r_proto crypt_r $hdrs
11487		eval $hasproto ;;
11488	*)	;;
11489	esac
11490	case "$d_crypt_r_proto" in
11491	define)
11492	case "$crypt_r_proto" in
11493	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11494	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11495	esac
11496	case "$crypt_r_proto" in
11497	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11498	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11499	esac
11500	case "$crypt_r_proto" in
11501	''|0)	d_crypt_r=undef
11502 	        crypt_r_proto=0
11503		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11504	* )	case "$crypt_r_proto" in
11505		REENTRANT_PROTO*) ;;
11506		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11507		esac
11508		echo "Prototype: $try" ;;
11509	esac
11510	;;
11511	*)	case "$usethreads" in
11512		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11513		esac
11514		d_crypt_r=undef
11515		crypt_r_proto=0
11516		;;
11517	esac
11518	;;
11519*)	crypt_r_proto=0
11520	;;
11521esac
11522
11523: get csh whereabouts
11524case "$csh" in
11525'csh') val="$undef" ;;
11526*) val="$define" ;;
11527esac
11528set d_csh
11529eval $setvar
11530: Respect a hint or command line value for full_csh.
11531case "$full_csh" in
11532'') full_csh=$csh ;;
11533esac
11534
11535: see if ctermid exists
11536set ctermid d_ctermid
11537eval $inlibc
11538
11539: see if ctermid_r exists
11540set ctermid_r d_ctermid_r
11541eval $inlibc
11542case "$d_ctermid_r" in
11543"$define")
11544	hdrs="$i_systypes sys/types.h define stdio.h "
11545	case "$d_ctermid_r_proto:$usethreads" in
11546	":define")	d_ctermid_r_proto=define
11547		set d_ctermid_r_proto ctermid_r $hdrs
11548		eval $hasproto ;;
11549	*)	;;
11550	esac
11551	case "$d_ctermid_r_proto" in
11552	define)
11553	case "$ctermid_r_proto" in
11554	''|0) try='char* ctermid_r(char*);'
11555	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11556	esac
11557	case "$ctermid_r_proto" in
11558	''|0)	d_ctermid_r=undef
11559 	        ctermid_r_proto=0
11560		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11561	* )	case "$ctermid_r_proto" in
11562		REENTRANT_PROTO*) ;;
11563		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11564		esac
11565		echo "Prototype: $try" ;;
11566	esac
11567	;;
11568	*)	case "$usethreads" in
11569		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11570		esac
11571		d_ctermid_r=undef
11572		ctermid_r_proto=0
11573		;;
11574	esac
11575	;;
11576*)	ctermid_r_proto=0
11577	;;
11578esac
11579
11580: see if ctime_r exists
11581set ctime_r d_ctime_r
11582eval $inlibc
11583case "$d_ctime_r" in
11584"$define")
11585	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11586	case "$d_ctime_r_proto:$usethreads" in
11587	":define")	d_ctime_r_proto=define
11588		set d_ctime_r_proto ctime_r $hdrs
11589		eval $hasproto ;;
11590	*)	;;
11591	esac
11592	case "$d_ctime_r_proto" in
11593	define)
11594	case "$ctime_r_proto" in
11595	''|0) try='char* ctime_r(const time_t*, char*);'
11596	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11597	esac
11598	case "$ctime_r_proto" in
11599	''|0) try='char* ctime_r(const time_t*, char*, int);'
11600	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11601	esac
11602	case "$ctime_r_proto" in
11603	''|0) try='int ctime_r(const time_t*, char*);'
11604	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11605	esac
11606	case "$ctime_r_proto" in
11607	''|0) try='int ctime_r(const time_t*, char*, int);'
11608	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11609	esac
11610	case "$ctime_r_proto" in
11611	''|0)	d_ctime_r=undef
11612 	        ctime_r_proto=0
11613		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11614	* )	case "$ctime_r_proto" in
11615		REENTRANT_PROTO*) ;;
11616		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11617		esac
11618		echo "Prototype: $try" ;;
11619	esac
11620	;;
11621	*)	case "$usethreads" in
11622		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11623		esac
11624		d_ctime_r=undef
11625		ctime_r_proto=0
11626		;;
11627	esac
11628	;;
11629*)	ctime_r_proto=0
11630	;;
11631esac
11632
11633: see if cuserid exists
11634set cuserid d_cuserid
11635eval $inlibc
11636
11637: see if this is a limits.h system
11638set limits.h i_limits
11639eval $inhdr
11640
11641: see if this is a float.h system
11642set float.h i_float
11643eval $inhdr
11644
11645: See if number of significant digits in a double precision number is known
11646echo " "
11647$cat >dbl_dig.c <<EOM
11648#$i_limits I_LIMITS
11649#$i_float I_FLOAT
11650#ifdef I_LIMITS
11651#include <limits.h>
11652#endif
11653#ifdef I_FLOAT
11654#include <float.h>
11655#endif
11656#ifdef DBL_DIG
11657printf("Contains DBL_DIG");
11658#endif
11659EOM
11660$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11661if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11662	echo "DBL_DIG found." >&4
11663	val="$define"
11664else
11665	echo "DBL_DIG NOT found." >&4
11666	val="$undef"
11667fi
11668$rm -f dbl_dig.?
11669set d_dbl_dig
11670eval $setvar
11671
11672: see if dbm.h is available
11673: see if dbmclose exists
11674set dbmclose d_dbmclose
11675eval $inlibc
11676
11677case "$d_dbmclose" in
11678$define)
11679	set dbm.h i_dbm
11680	eval $inhdr
11681	case "$i_dbm" in
11682	$define)
11683		val="$undef"
11684		set i_rpcsvcdbm
11685		eval $setvar
11686		;;
11687	*)	set rpcsvc/dbm.h i_rpcsvcdbm
11688		eval $inhdr
11689		;;
11690	esac
11691	;;
11692*)	echo "We won't be including <dbm.h>"
11693	val="$undef"
11694	set i_dbm
11695	eval $setvar
11696	val="$undef"
11697	set i_rpcsvcdbm
11698	eval $setvar
11699	;;
11700esac
11701
11702: see if prototype for dbminit is available
11703echo " "
11704set d_dbminitproto dbminit $i_dbm dbm.h
11705eval $hasproto
11706
11707: see if difftime exists
11708set difftime d_difftime
11709eval $inlibc
11710
11711: see if this is a dirent system
11712echo " "
11713if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11714	val="$define"
11715	echo "<dirent.h> found." >&4
11716else
11717	val="$undef"
11718	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11719		echo "<sys/dir.h> found." >&4
11720		echo " "
11721	else
11722		xinc=`./findhdr sys/ndir.h`
11723	fi
11724	echo "<dirent.h> NOT found." >&4
11725fi
11726set i_dirent
11727eval $setvar
11728
11729: Look for type of directory structure.
11730echo " "
11731$cppstdin $cppflags $cppminus < "$xinc" > try.c
11732
11733case "$direntrytype" in
11734''|' ')
11735	case "$i_dirent" in
11736	$define) guess1='struct dirent' ;;
11737	*) guess1='struct direct'  ;;
11738	esac
11739	;;
11740*)	guess1="$direntrytype"
11741	;;
11742esac
11743
11744case "$guess1" in
11745'struct dirent') guess2='struct direct' ;;
11746*) guess2='struct dirent' ;;
11747esac
11748
11749if $contains "$guess1" try.c >/dev/null 2>&1; then
11750	direntrytype="$guess1"
11751	echo "Your directory entries are $direntrytype." >&4
11752elif $contains "$guess2" try.c >/dev/null 2>&1; then
11753	direntrytype="$guess2"
11754	echo "Your directory entries seem to be $direntrytype." >&4
11755else
11756	echo "I don't recognize your system's directory entries." >&4
11757	rp="What type is used for directory entries on this system?"
11758	dflt="$guess1"
11759	. ./myread
11760	direntrytype="$ans"
11761fi
11762$rm_try
11763
11764: see if the directory entry stores field length
11765echo " "
11766$cppstdin $cppflags $cppminus < "$xinc" > try.c
11767if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11768	echo "Good, your directory entry keeps length information in d_namlen." >&4
11769	val="$define"
11770else
11771	echo "Your directory entry does not know about the d_namlen field." >&4
11772	val="$undef"
11773fi
11774set d_dirnamlen
11775eval $setvar
11776$rm_try
11777
11778: Look for DIR.dd_fd
11779case "$i_dirent" in
11780"$define")
11781    echo "Checking to see if DIR has a dd_fd member variable" >&4
11782    $cat >try.c <<EOCP
11783#$i_stdlib I_STDLIB
11784#ifdef I_STDLIB
11785#include <stdlib.h>
11786#endif
11787#include <dirent.h>
11788
11789int main() {
11790    DIR dir;
11791    dir.dd_fd = 1;
11792    return 0;
11793}
11794EOCP
11795    val=$undef
11796    set try
11797    if eval $compile; then
11798        echo "Yes, it does."
11799        val="$define"
11800    else
11801        echo "No, it does not."
11802        val="$undef"
11803    fi
11804    ;;
11805*)
11806    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11807    val="$undef"
11808    ;;
11809esac
11810set d_dir_dd_fd
11811eval $setvar
11812$rm_try
11813
11814: see if this is an sysdir system
11815set sys/dir.h i_sysdir
11816eval $inhdr
11817
11818: see if this is an sysndir system
11819set sys/ndir.h i_sysndir
11820eval $inhdr
11821
11822: Look for dirfd
11823echo " "
11824$cat >dirfd.c <<EOM
11825#include <stdio.h>
11826#$i_stdlib I_STDLIB
11827#ifdef I_STDLIB
11828#include <stdlib.h>
11829#endif
11830#$i_dirent I_DIRENT		/**/
11831#$i_sysdir I_SYS_DIR		/**/
11832#$i_sysndir I_SYS_NDIR		/**/
11833#$i_systypes I_SYS_TYPES	/**/
11834#if defined(I_SYS_TYPES)
11835#include <sys/types.h>
11836#endif
11837#if defined(I_DIRENT)
11838#include <dirent.h>
11839#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11840#include <sys/dir.h>
11841#endif
11842#else
11843#ifdef I_SYS_NDIR
11844#include <sys/ndir.h>
11845#else
11846#ifdef I_SYS_DIR
11847#ifdef hp9000s500
11848#include <ndir.h>	/* may be wrong in the future */
11849#else
11850#include <sys/dir.h>
11851#endif
11852#endif
11853#endif
11854#endif 
11855int main() {
11856	DIR *dirp = opendir(".");
11857	if (dirfd(dirp) >= 0)
11858		exit(0);
11859	else
11860		exit(1);
11861}
11862EOM
11863val=$undef
11864set dirfd
11865if eval $compile; then
11866	val="$define"
11867fi
11868case "$val" in
11869$define)	echo "dirfd() found." >&4	;;
11870*)		echo "dirfd() NOT found." >&4	;;
11871esac
11872set d_dirfd
11873eval $setvar
11874$rm -f dirfd*
11875
11876: see if dlerror exists
11877xxx_runnm="$runnm"
11878runnm=false
11879set dlerror d_dlerror
11880eval $inlibc
11881runnm="$xxx_runnm"
11882
11883: see if dlfcn is available
11884set dlfcn.h i_dlfcn
11885eval $inhdr
11886
11887: Check what extension to use for shared libs
11888case "$usedl" in
11889$define|y|true)
11890	$cat << EOM
11891
11892On a few systems, the dynamically loaded modules that perl generates and uses
11893will need a different extension than shared libs. The default will probably
11894be appropriate.
11895
11896EOM
11897	case "$dlext" in
11898	'')	dflt="$so" ;;
11899	*)	dflt="$dlext" ;;
11900	esac
11901	rp='What is the extension of dynamically loaded modules'
11902	. ./myread
11903	dlext="$ans"
11904	;;
11905*)
11906	dlext="none"
11907	;;
11908esac
11909
11910: Check if dlsym need a leading underscore
11911echo " "
11912val="$undef"
11913
11914case "$dlsrc" in
11915dl_dlopen.xs)
11916	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11917	$cat >dyna.c <<'EOM'
11918fred () { }
11919EOM
11920
11921$cat >fred.c<<EOM
11922
11923#include <stdio.h>
11924#$i_stdlib I_STDLIB
11925#ifdef I_STDLIB
11926#include <stdlib.h>
11927#endif
11928#$i_dlfcn I_DLFCN
11929#ifdef I_DLFCN
11930#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11931#else
11932#include <sys/types.h>
11933#include <nlist.h>
11934#include <link.h>
11935#endif
11936
11937extern int fred() ;
11938
11939int main()
11940{
11941    void * handle ;
11942    void * symbol ;
11943#ifndef RTLD_LAZY
11944    int mode = 1 ;
11945#else
11946    int mode = RTLD_LAZY ;
11947#endif
11948    handle = dlopen("./dyna.$dlext", mode) ;
11949    if (handle == NULL) {
11950	printf ("1\n") ;
11951	fflush (stdout) ;
11952	exit(0);
11953    }
11954    symbol = dlsym(handle, "fred") ;
11955    if (symbol == NULL) {
11956	/* try putting a leading underscore */
11957	symbol = dlsym(handle, "_fred") ;
11958	if (symbol == NULL) {
11959	    printf ("2\n") ;
11960	    fflush (stdout) ;
11961	    exit(0);
11962	}
11963	printf ("3\n") ;
11964    }
11965    else
11966	printf ("4\n") ;
11967    fflush (stdout) ;
11968    exit(0);
11969}
11970EOM
11971	: Call the object file tmp-dyna.o in case dlext=o.
11972	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11973		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11974		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11975		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11976		xxx=`$run ./fred`
11977		case $xxx in
11978		1)	echo "Test program failed using dlopen." >&4
11979			echo "Perhaps you should not use dynamic loading." >&4;;
11980		2)	echo "Test program failed using dlsym." >&4
11981			echo "Perhaps you should not use dynamic loading." >&4;;
11982		3)	echo "dlsym needs a leading underscore" >&4
11983			val="$define" ;;
11984		4)	echo "dlsym doesn't need a leading underscore." >&4;;
11985		esac
11986	else
11987		echo "I can't compile and run the test program." >&4
11988                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11989	fi
11990	;;
11991esac
11992
11993$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11994
11995set d_dlsymun
11996eval $setvar
11997
11998: see if drand48_r exists
11999set drand48_r d_drand48_r
12000eval $inlibc
12001case "$d_drand48_r" in
12002"$define")
12003	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12004	case "$d_drand48_r_proto:$usethreads" in
12005	":define")	d_drand48_r_proto=define
12006		set d_drand48_r_proto drand48_r $hdrs
12007		eval $hasproto ;;
12008	*)	;;
12009	esac
12010	case "$d_drand48_r_proto" in
12011	define)
12012	case "$drand48_r_proto" in
12013	''|0) try='int drand48_r(struct drand48_data*, double*);'
12014	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12015	esac
12016	case "$drand48_r_proto" in
12017	''|0)	d_drand48_r=undef
12018 	        drand48_r_proto=0
12019		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12020	* )	case "$drand48_r_proto" in
12021		REENTRANT_PROTO*) ;;
12022		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12023		esac
12024		echo "Prototype: $try" ;;
12025	esac
12026	;;
12027	*)	case "$usethreads" in
12028		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12029		esac
12030		d_drand48_r=undef
12031		drand48_r_proto=0
12032		;;
12033	esac
12034	;;
12035*)	drand48_r_proto=0
12036	;;
12037esac
12038
12039: see if prototype for drand48 is available
12040echo " "
12041set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12042eval $hasproto
12043
12044: see if dup2 exists
12045set dup2 d_dup2
12046eval $inlibc
12047
12048: see if eaccess exists
12049set eaccess d_eaccess
12050eval $inlibc
12051
12052: see if endgrent exists
12053set endgrent d_endgrent
12054eval $inlibc
12055
12056: see if this is an grp system
12057set grp.h i_grp
12058eval $inhdr
12059
12060case "$i_grp" in
12061$define)
12062	xxx=`./findhdr grp.h`
12063	$cppstdin $cppflags $cppminus < $xxx >$$.h
12064
12065	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12066		val="$define"
12067	else
12068		val="$undef"
12069	fi
12070	set d_grpasswd
12071	eval $setvar
12072
12073	$rm -f $$.h
12074	;;
12075*)
12076	val="$undef";
12077	set d_grpasswd; eval $setvar
12078	;;
12079esac
12080
12081: see if endgrent_r exists
12082set endgrent_r d_endgrent_r
12083eval $inlibc
12084case "$d_endgrent_r" in
12085"$define")
12086	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12087	case "$d_endgrent_r_proto:$usethreads" in
12088	":define")	d_endgrent_r_proto=define
12089		set d_endgrent_r_proto endgrent_r $hdrs
12090		eval $hasproto ;;
12091	*)	;;
12092	esac
12093	case "$d_endgrent_r_proto" in
12094	define)
12095	case "$endgrent_r_proto" in
12096	''|0) try='int endgrent_r(FILE**);'
12097	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12098	esac
12099	case "$endgrent_r_proto" in
12100	''|0) try='void endgrent_r(FILE**);'
12101	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12102	esac
12103	case "$endgrent_r_proto" in
12104	''|0)	d_endgrent_r=undef
12105 	        endgrent_r_proto=0
12106		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12107	* )	case "$endgrent_r_proto" in
12108		REENTRANT_PROTO*) ;;
12109		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12110		esac
12111		echo "Prototype: $try" ;;
12112	esac
12113	;;
12114	*)	case "$usethreads" in
12115		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12116		esac
12117		d_endgrent_r=undef
12118		endgrent_r_proto=0
12119		;;
12120	esac
12121	;;
12122*)	endgrent_r_proto=0
12123	;;
12124esac
12125
12126: see if endhostent exists
12127set endhostent d_endhent
12128eval $inlibc
12129
12130: see if this is a netdb.h system
12131set netdb.h i_netdb
12132eval $inhdr
12133
12134: see if endhostent_r exists
12135set endhostent_r d_endhostent_r
12136eval $inlibc
12137case "$d_endhostent_r" in
12138"$define")
12139	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12140	case "$d_endhostent_r_proto:$usethreads" in
12141	":define")	d_endhostent_r_proto=define
12142		set d_endhostent_r_proto endhostent_r $hdrs
12143		eval $hasproto ;;
12144	*)	;;
12145	esac
12146	case "$d_endhostent_r_proto" in
12147	define)
12148	case "$endhostent_r_proto" in
12149	''|0) try='int endhostent_r(struct hostent_data*);'
12150	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12151	esac
12152	case "$endhostent_r_proto" in
12153	''|0) try='void endhostent_r(struct hostent_data*);'
12154	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12155	esac
12156	case "$endhostent_r_proto" in
12157	''|0)	d_endhostent_r=undef
12158 	        endhostent_r_proto=0
12159		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12160	* )	case "$endhostent_r_proto" in
12161		REENTRANT_PROTO*) ;;
12162		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12163		esac
12164		echo "Prototype: $try" ;;
12165	esac
12166	;;
12167	*)	case "$usethreads" in
12168		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12169		esac
12170		d_endhostent_r=undef
12171		endhostent_r_proto=0
12172		;;
12173	esac
12174	;;
12175*)	endhostent_r_proto=0
12176	;;
12177esac
12178
12179: see if endnetent exists
12180set endnetent d_endnent
12181eval $inlibc
12182
12183: see if endnetent_r exists
12184set endnetent_r d_endnetent_r
12185eval $inlibc
12186case "$d_endnetent_r" in
12187"$define")
12188	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12189	case "$d_endnetent_r_proto:$usethreads" in
12190	":define")	d_endnetent_r_proto=define
12191		set d_endnetent_r_proto endnetent_r $hdrs
12192		eval $hasproto ;;
12193	*)	;;
12194	esac
12195	case "$d_endnetent_r_proto" in
12196	define)
12197	case "$endnetent_r_proto" in
12198	''|0) try='int endnetent_r(struct netent_data*);'
12199	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12200	esac
12201	case "$endnetent_r_proto" in
12202	''|0) try='void endnetent_r(struct netent_data*);'
12203	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12204	esac
12205	case "$endnetent_r_proto" in
12206	''|0)	d_endnetent_r=undef
12207 	        endnetent_r_proto=0
12208		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12209	* )	case "$endnetent_r_proto" in
12210		REENTRANT_PROTO*) ;;
12211		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12212		esac
12213		echo "Prototype: $try" ;;
12214	esac
12215	;;
12216	*)	case "$usethreads" in
12217		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12218		esac
12219		d_endnetent_r=undef
12220		endnetent_r_proto=0
12221		;;
12222	esac
12223	;;
12224*)	endnetent_r_proto=0
12225	;;
12226esac
12227
12228: see if endprotoent exists
12229set endprotoent d_endpent
12230eval $inlibc
12231
12232: see if endprotoent_r exists
12233set endprotoent_r d_endprotoent_r
12234eval $inlibc
12235case "$d_endprotoent_r" in
12236"$define")
12237	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12238	case "$d_endprotoent_r_proto:$usethreads" in
12239	":define")	d_endprotoent_r_proto=define
12240		set d_endprotoent_r_proto endprotoent_r $hdrs
12241		eval $hasproto ;;
12242	*)	;;
12243	esac
12244	case "$d_endprotoent_r_proto" in
12245	define)
12246	case "$endprotoent_r_proto" in
12247	''|0) try='int endprotoent_r(struct protoent_data*);'
12248	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12249	esac
12250	case "$endprotoent_r_proto" in
12251	''|0) try='void endprotoent_r(struct protoent_data*);'
12252	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12253	esac
12254	case "$endprotoent_r_proto" in
12255	''|0)	d_endprotoent_r=undef
12256 	        endprotoent_r_proto=0
12257		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12258	* )	case "$endprotoent_r_proto" in
12259		REENTRANT_PROTO*) ;;
12260		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12261		esac
12262		echo "Prototype: $try" ;;
12263	esac
12264	;;
12265	*)	case "$usethreads" in
12266		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12267		esac
12268		d_endprotoent_r=undef
12269		endprotoent_r_proto=0
12270		;;
12271	esac
12272	;;
12273*)	endprotoent_r_proto=0
12274	;;
12275esac
12276
12277: see if endpwent exists
12278set endpwent d_endpwent
12279eval $inlibc
12280
12281: see if this is a pwd.h system
12282set pwd.h i_pwd
12283eval $inhdr
12284
12285case "$i_pwd" in
12286$define)
12287	xxx=`./findhdr pwd.h`
12288	$cppstdin $cppflags $cppminus < $xxx >$$.h
12289
12290	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12291		val="$define"
12292	else
12293		val="$undef"
12294	fi
12295	set d_pwquota
12296	eval $setvar
12297
12298	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12299		val="$define"
12300	else
12301		val="$undef"
12302	fi
12303	set d_pwage
12304	eval $setvar
12305
12306	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12307		val="$define"
12308	else
12309		val="$undef"
12310	fi
12311	set d_pwchange
12312	eval $setvar
12313
12314	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12315		val="$define"
12316	else
12317		val="$undef"
12318	fi
12319	set d_pwclass
12320	eval $setvar
12321
12322	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12323		val="$define"
12324	else
12325		val="$undef"
12326	fi
12327	set d_pwexpire
12328	eval $setvar
12329
12330	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12331		val="$define"
12332	else
12333		val="$undef"
12334	fi
12335	set d_pwcomment
12336	eval $setvar
12337
12338	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12339		val="$define"
12340	else
12341		val="$undef"
12342	fi
12343	set d_pwgecos
12344	eval $setvar
12345
12346	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12347		val="$define"
12348	else
12349		val="$undef"
12350	fi
12351	set d_pwpasswd
12352	eval $setvar
12353
12354	$rm -f $$.h
12355	;;
12356*)
12357	val="$undef";
12358	set d_pwquota; eval $setvar
12359	set d_pwage; eval $setvar
12360	set d_pwchange; eval $setvar
12361	set d_pwclass; eval $setvar
12362	set d_pwexpire; eval $setvar
12363	set d_pwcomment; eval $setvar
12364	set d_pwgecos; eval $setvar
12365	set d_pwpasswd; eval $setvar
12366	;;
12367esac
12368
12369: see if endpwent_r exists
12370set endpwent_r d_endpwent_r
12371eval $inlibc
12372case "$d_endpwent_r" in
12373"$define")
12374	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12375	case "$d_endpwent_r_proto:$usethreads" in
12376	":define")	d_endpwent_r_proto=define
12377		set d_endpwent_r_proto endpwent_r $hdrs
12378		eval $hasproto ;;
12379	*)	;;
12380	esac
12381	case "$d_endpwent_r_proto" in
12382	define)
12383	case "$endpwent_r_proto" in
12384	''|0) try='int endpwent_r(FILE**);'
12385	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12386	esac
12387	case "$endpwent_r_proto" in
12388	''|0) try='void endpwent_r(FILE**);'
12389	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12390	esac
12391	case "$endpwent_r_proto" in
12392	''|0)	d_endpwent_r=undef
12393 	        endpwent_r_proto=0
12394		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12395	* )	case "$endpwent_r_proto" in
12396		REENTRANT_PROTO*) ;;
12397		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12398		esac
12399		echo "Prototype: $try" ;;
12400	esac
12401	;;
12402	*)	case "$usethreads" in
12403		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12404		esac
12405		d_endpwent_r=undef
12406		endpwent_r_proto=0
12407		;;
12408	esac
12409	;;
12410*)	endpwent_r_proto=0
12411	;;
12412esac
12413
12414: see if endservent exists
12415set endservent d_endsent
12416eval $inlibc
12417
12418: see if endservent_r exists
12419set endservent_r d_endservent_r
12420eval $inlibc
12421case "$d_endservent_r" in
12422"$define")
12423	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12424	case "$d_endservent_r_proto:$usethreads" in
12425	":define")	d_endservent_r_proto=define
12426		set d_endservent_r_proto endservent_r $hdrs
12427		eval $hasproto ;;
12428	*)	;;
12429	esac
12430	case "$d_endservent_r_proto" in
12431	define)
12432	case "$endservent_r_proto" in
12433	''|0) try='int endservent_r(struct servent_data*);'
12434	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12435	esac
12436	case "$endservent_r_proto" in
12437	''|0) try='void endservent_r(struct servent_data*);'
12438	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12439	esac
12440	case "$endservent_r_proto" in
12441	''|0)	d_endservent_r=undef
12442 	        endservent_r_proto=0
12443		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12444	* )	case "$endservent_r_proto" in
12445		REENTRANT_PROTO*) ;;
12446		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12447		esac
12448		echo "Prototype: $try" ;;
12449	esac
12450	;;
12451	*)	case "$usethreads" in
12452		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12453		esac
12454		d_endservent_r=undef
12455		endservent_r_proto=0
12456		;;
12457	esac
12458	;;
12459*)	endservent_r_proto=0
12460	;;
12461esac
12462
12463: Locate the flags for 'open()'
12464echo " "
12465$cat >try.c <<EOCP
12466#include <sys/types.h>
12467#ifdef I_FCNTL
12468#include <fcntl.h>
12469#endif
12470#ifdef I_SYS_FILE
12471#include <sys/file.h>
12472#endif
12473#$i_stdlib I_STDLIB
12474#ifdef I_STDLIB
12475#include <stdlib.h>
12476#endif
12477int main() {
12478	if(O_RDONLY);
12479#ifdef O_TRUNC
12480	exit(0);
12481#else
12482	exit(1);
12483#endif
12484}
12485EOCP
12486: check sys/file.h first to get FREAD on Sun
12487if $test `./findhdr sys/file.h` && \
12488		set try -DI_SYS_FILE && eval $compile; then
12489	h_sysfile=true;
12490	echo "<sys/file.h> defines the O_* constants..." >&4
12491	if $run ./try; then
12492		echo "and you have the 3 argument form of open()." >&4
12493		val="$define"
12494	else
12495		echo "but not the 3 argument form of open().  Oh, well." >&4
12496		val="$undef"
12497	fi
12498elif $test `./findhdr fcntl.h` && \
12499		set try -DI_FCNTL && eval $compile; then
12500	h_fcntl=true;
12501	echo "<fcntl.h> defines the O_* constants..." >&4
12502	if $run ./try; then
12503		echo "and you have the 3 argument form of open()." >&4
12504		val="$define"
12505	else
12506		echo "but not the 3 argument form of open().  Oh, well." >&4
12507		val="$undef"
12508	fi
12509else
12510	val="$undef"
12511	echo "I can't find the O_* constant definitions!  You got problems." >&4
12512fi
12513set d_open3
12514eval $setvar
12515$rm_try
12516
12517: see if this is a sys/file.h system
12518val=''
12519set sys/file.h val
12520eval $inhdr
12521
12522: do we need to include sys/file.h ?
12523case "$val" in
12524"$define")
12525	echo " "
12526	if $h_sysfile; then
12527		val="$define"
12528		echo "We'll be including <sys/file.h>." >&4
12529	else
12530		val="$undef"
12531		echo "We won't be including <sys/file.h>." >&4
12532	fi
12533	;;
12534*)
12535	h_sysfile=false
12536	;;
12537esac
12538set i_sysfile
12539eval $setvar
12540
12541: see if fcntl.h is there
12542val=''
12543set fcntl.h val
12544eval $inhdr
12545
12546: see if we can include fcntl.h
12547case "$val" in
12548"$define")
12549	echo " "
12550	if $h_fcntl; then
12551		val="$define"
12552		echo "We'll be including <fcntl.h>." >&4
12553	else
12554		val="$undef"
12555		if $h_sysfile; then
12556	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12557		else
12558			echo "We won't be including <fcntl.h>." >&4
12559		fi
12560	fi
12561	;;
12562*)
12563	h_fcntl=false
12564	val="$undef"
12565	;;
12566esac
12567set i_fcntl
12568eval $setvar
12569
12570: see if fork exists
12571set fork d_fork
12572eval $inlibc
12573
12574: see if pipe exists
12575set pipe d_pipe
12576eval $inlibc
12577
12578: check for non-blocking I/O stuff
12579case "$h_sysfile" in
12580true) echo "#include <sys/file.h>" > head.c;;
12581*)
12582       case "$h_fcntl" in
12583       true) echo "#include <fcntl.h>" > head.c;;
12584       *) echo "#include <sys/fcntl.h>" > head.c;;
12585       esac
12586       ;;
12587esac
12588echo " "
12589echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12590case "$o_nonblock" in
12591'')
12592	$cat head.c > try.c
12593	$cat >>try.c <<EOCP
12594#include <stdio.h>
12595#$i_stdlib I_STDLIB
12596#ifdef I_STDLIB
12597#include <stdlib.h>
12598#endif
12599#$i_fcntl I_FCNTL
12600#ifdef I_FCNTL
12601#include <fcntl.h>
12602#endif
12603int main() {
12604#ifdef O_NONBLOCK
12605	printf("O_NONBLOCK\n");
12606	exit(0);
12607#endif
12608#ifdef O_NDELAY
12609	printf("O_NDELAY\n");
12610	exit(0);
12611#endif
12612#ifdef FNDELAY
12613	printf("FNDELAY\n");
12614	exit(0);
12615#endif
12616	exit(0);
12617}
12618EOCP
12619	set try
12620	if eval $compile_ok; then
12621		o_nonblock=`$run ./try`
12622		case "$o_nonblock" in
12623		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12624		*) echo "Seems like we can use $o_nonblock.";;
12625		esac
12626	else
12627		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12628	fi
12629	;;
12630*) echo "Using $hint value $o_nonblock.";;
12631esac
12632$rm_try
12633
12634echo " "
12635echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12636case "$eagain" in
12637'')
12638	case "$d_fork:$d_pipe" in
12639	define:define)
12640	$cat head.c > try.c
12641	$cat >>try.c <<EOCP
12642#include <errno.h>
12643#include <sys/types.h>
12644#include <signal.h>
12645#include <stdio.h>
12646#$i_stdlib I_STDLIB
12647#ifdef I_STDLIB
12648#include <stdlib.h>
12649#endif
12650#$i_fcntl I_FCNTL
12651#ifdef I_FCNTL
12652#include <fcntl.h>
12653#endif
12654#define MY_O_NONBLOCK $o_nonblock
12655#ifndef errno  /* XXX need better Configure test */
12656extern int errno;
12657#endif
12658#$i_unistd I_UNISTD
12659#ifdef I_UNISTD
12660#include <unistd.h>
12661#endif
12662#$i_string I_STRING
12663#ifdef I_STRING
12664#include <string.h>
12665#else
12666#include <strings.h>
12667#endif
12668$signal_t blech(int x) { exit(3); }
12669EOCP
12670	$cat >> try.c <<'EOCP'
12671int main()
12672{
12673	int pd[2];
12674	int pu[2];
12675	char buf[1];
12676	char string[100];
12677
12678	pipe(pd);	/* Down: child -> parent */
12679	pipe(pu);	/* Up: parent -> child */
12680	if (0 != fork()) {
12681		int ret;
12682		close(pd[1]);	/* Parent reads from pd[0] */
12683		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
12684#ifdef F_SETFL
12685		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12686			exit(1);
12687#else
12688		exit(4);
12689#endif
12690		signal(SIGALRM, blech);
12691		alarm(5);
12692		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
12693			exit(2);
12694		sprintf(string, "%d\n", ret);
12695		write(2, string, strlen(string));
12696		alarm(0);
12697#ifdef EAGAIN
12698		if (errno == EAGAIN) {
12699			printf("EAGAIN\n");
12700			goto ok;
12701		}
12702#endif
12703#ifdef EWOULDBLOCK
12704		if (errno == EWOULDBLOCK)
12705			printf("EWOULDBLOCK\n");
12706#endif
12707	ok:
12708		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
12709		sleep(2);				/* Give it time to close our pipe */
12710		alarm(5);
12711		ret = read(pd[0], buf, 1);	/* Should read EOF */
12712		alarm(0);
12713		sprintf(string, "%d\n", ret);
12714		write(4, string, strlen(string));
12715		exit(0);
12716	}
12717
12718	close(pd[0]);			/* We write to pd[1] */
12719	close(pu[1]);			/* We read from pu[0] */
12720	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
12721	close(pd[1]);			/* Pipe pd is now fully closed! */
12722	exit(0);				/* Bye bye, thank you for playing! */
12723}
12724EOCP
12725	set try
12726	if eval $compile_ok; then
12727		echo "$startsh" >mtry
12728		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12729		chmod +x mtry
12730		./mtry >/dev/null 2>&1
12731		case $? in
12732		0) eagain=`$cat try.out`;;
12733		1) echo "Could not perform non-blocking setting!";;
12734		2) echo "I did a successful read() for something that was not there!";;
12735		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12736		4) echo "Could not find F_SETFL!";;
12737		*) echo "Something terribly wrong happened during testing.";;
12738		esac
12739		rd_nodata=`$cat try.ret`
12740		echo "A read() system call with no data present returns $rd_nodata."
12741		case "$rd_nodata" in
12742		0|-1) ;;
12743		*)
12744			echo "(That's peculiar, fixing that to be -1.)"
12745			rd_nodata=-1
12746			;;
12747		esac
12748		case "$eagain" in
12749		'')
12750			echo "Forcing errno EAGAIN on read() with no data available."
12751			eagain=EAGAIN
12752			;;
12753		*)
12754			echo "Your read() sets errno to $eagain when no data is available."
12755			;;
12756		esac
12757		status=`$cat try.err`
12758		case "$status" in
12759		0) echo "And it correctly returns 0 to signal EOF.";;
12760		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
12761		*) echo "However, your read() returns '$status' on EOF??";;
12762		esac
12763		val="$define"
12764		if test "$status" = "$rd_nodata"; then
12765			echo "WARNING: you can't distinguish between EOF and no data!"
12766			val="$undef"
12767		fi
12768	else
12769		echo "I can't compile the test program--assuming errno EAGAIN will do."
12770		eagain=EAGAIN
12771	fi
12772	;;
12773	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12774		eagain=EAGAIN
12775		val="$define"
12776		;;
12777	esac
12778	set d_eofnblk
12779	eval $setvar
12780	;;
12781*)
12782	echo "Using $hint value $eagain."
12783	echo "Your read() returns $rd_nodata when no data is present."
12784	case "$d_eofnblk" in
12785	"$define") echo "And you can see EOF because read() returns 0.";;
12786	"$undef") echo "But you can't see EOF status from read() returned value.";;
12787	*)
12788		echo "(Assuming you can't see EOF status from read anyway.)"
12789		d_eofnblk=$undef
12790		;;
12791	esac
12792	;;
12793esac
12794$rm_try head.c mtry
12795
12796: see if _ptr and _cnt from stdio act std
12797echo " "
12798
12799if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12800	echo "(Looks like you have stdio.h from BSD.)"
12801	case "$stdio_ptr" in
12802	'') stdio_ptr='((fp)->_p)'
12803		ptr_lval=$define
12804		;;
12805	*)	ptr_lval=$d_stdio_ptr_lval;;
12806	esac
12807	case "$stdio_cnt" in
12808	'') stdio_cnt='((fp)->_r)'
12809		cnt_lval=$define
12810		;;
12811	*)	cnt_lval=$d_stdio_cnt_lval;;
12812	esac
12813	case "$stdio_base" in
12814	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12815	esac
12816	case "$stdio_bufsiz" in
12817	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12818	esac
12819elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12820	echo "(Looks like you have stdio.h from Linux.)"
12821	case "$stdio_ptr" in
12822	'') stdio_ptr='((fp)->_IO_read_ptr)'
12823		ptr_lval=$define
12824		;;
12825	*)	ptr_lval=$d_stdio_ptr_lval;;
12826	esac
12827	case "$stdio_cnt" in
12828	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12829		cnt_lval=$undef
12830		;;
12831	*)	cnt_lval=$d_stdio_cnt_lval;;
12832	esac
12833	case "$stdio_base" in
12834	'') stdio_base='((fp)->_IO_read_base)';;
12835	esac
12836	case "$stdio_bufsiz" in
12837	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12838	esac
12839else
12840	case "$stdio_ptr" in
12841	'') stdio_ptr='((fp)->_ptr)'
12842		ptr_lval=$define
12843		;;
12844	*)	ptr_lval=$d_stdio_ptr_lval;;
12845	esac
12846	case "$stdio_cnt" in
12847	'') stdio_cnt='((fp)->_cnt)'
12848		cnt_lval=$define
12849		;;
12850	*)	cnt_lval=$d_stdio_cnt_lval;;
12851	esac
12852	case "$stdio_base" in
12853	'') stdio_base='((fp)->_base)';;
12854	esac
12855	case "$stdio_bufsiz" in
12856	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12857	esac
12858fi
12859
12860: test whether _ptr and _cnt really work
12861echo "Checking how std your stdio is..." >&4
12862$cat >try.c <<EOP
12863#include <stdio.h>
12864#$i_stdlib I_STDLIB
12865#ifdef I_STDLIB
12866#include <stdlib.h>
12867#endif
12868#define FILE_ptr(fp)	$stdio_ptr
12869#define FILE_cnt(fp)	$stdio_cnt
12870int main() {
12871	FILE *fp = fopen("try.c", "r");
12872	char c = getc(fp);
12873	if (
12874		18 <= FILE_cnt(fp) &&
12875		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12876	)
12877		exit(0);
12878	exit(1);
12879}
12880EOP
12881val="$undef"
12882set try
12883if eval $compile && $to try.c; then
12884	if $run ./try; then
12885		echo "Your stdio acts pretty std."
12886		val="$define"
12887	else
12888		echo "Your stdio isn't very std."
12889	fi
12890else
12891	echo "Your stdio doesn't appear very std."
12892fi
12893$rm_try
12894
12895# glibc 2.2.90 and above apparently change stdio streams so Perl's
12896# direct buffer manipulation no longer works.  The Configure tests
12897# should be changed to correctly detect this, but until then,
12898# the following check should at least let perl compile and run.
12899# (This quick fix should be updated before 5.8.1.)
12900# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12901# A. Dougherty, June 3, 2002.
12902case "$d_gnulibc" in
12903$define)
12904	case "$gnulibc_version" in
12905	2.[01]*)  ;;
12906	2.2) ;;
12907	2.2.[0-9]) ;;
12908	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12909		val="$undef"
12910		;;
12911	esac
12912	;;
12913esac
12914set d_stdstdio
12915eval $setvar
12916
12917: Can _ptr be used as an lvalue?
12918case "$d_stdstdio$ptr_lval" in
12919$define$define) val=$define ;;
12920*) val=$undef ;;
12921esac
12922set d_stdio_ptr_lval
12923eval $setvar
12924
12925: Can _cnt be used as an lvalue?
12926case "$d_stdstdio$cnt_lval" in
12927$define$define) val=$define ;;
12928*) val=$undef ;;
12929esac
12930set d_stdio_cnt_lval
12931eval $setvar
12932
12933
12934: test whether setting _ptr sets _cnt as a side effect
12935d_stdio_ptr_lval_sets_cnt="$undef"
12936d_stdio_ptr_lval_nochange_cnt="$undef"
12937case "$d_stdio_ptr_lval$d_stdstdio" in
12938$define$define)
12939	echo "Checking to see what happens if we set the stdio ptr..." >&4
12940$cat >try.c <<EOP
12941#include <stdio.h>
12942/* Can we scream? */
12943/* Eat dust sed :-) */
12944/* In the buffer space, no one can hear you scream. */
12945#$i_stdlib I_STDLIB
12946#ifdef I_STDLIB
12947#include <stdlib.h>
12948#endif
12949#define FILE_ptr(fp)	$stdio_ptr
12950#define FILE_cnt(fp)	$stdio_cnt
12951#include <sys/types.h>
12952int main() {
12953	FILE *fp = fopen("try.c", "r");
12954	int c;
12955	char *ptr;
12956	size_t cnt;
12957	if (!fp) {
12958	    puts("Fail even to read");
12959	    exit(1);
12960	}
12961	c = getc(fp); /* Read away the first # */
12962	if (c == EOF) {
12963	    puts("Fail even to read");
12964	    exit(1);
12965	}
12966	if (!(
12967		18 <= FILE_cnt(fp) &&
12968		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12969	)) {
12970		puts("Fail even to read");
12971		exit (1);
12972	}
12973	ptr = (char*) FILE_ptr(fp);
12974	cnt = (size_t)FILE_cnt(fp);
12975
12976	FILE_ptr(fp) += 42;
12977
12978	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12979		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12980		exit (1);
12981	}
12982	if (FILE_cnt(fp) <= 20) {
12983		printf ("Fail (<20 chars to test)");
12984		exit (1);
12985	}
12986	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12987		puts("Fail compare");
12988		exit (1);
12989	}
12990	if (cnt == FILE_cnt(fp)) {
12991		puts("Pass_unchanged");
12992		exit (0);
12993	}
12994	if (FILE_cnt(fp) == (cnt - 42)) {
12995		puts("Pass_changed");
12996		exit (0);
12997	}
12998	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12999	return 1;
13000
13001}
13002EOP
13003	set try
13004	if eval $compile && $to try.c; then
13005 		case `$run ./try` in
13006		Pass_changed)
13007			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13008			d_stdio_ptr_lval_sets_cnt="$define" ;;
13009		Pass_unchanged)
13010			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13011			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13012		Fail*)
13013			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13014		*)
13015			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13016	esac
13017	else
13018		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13019	fi
13020	$rm_try
13021	;;
13022esac
13023
13024: see if _base is also standard
13025val="$undef"
13026case "$d_stdstdio" in
13027$define)
13028	$cat >try.c <<EOP
13029#include <stdio.h>
13030#$i_stdlib I_STDLIB
13031#ifdef I_STDLIB
13032#include <stdlib.h>
13033#endif
13034#define FILE_base(fp)	$stdio_base
13035#define FILE_bufsiz(fp)	$stdio_bufsiz
13036int main() {
13037	FILE *fp = fopen("try.c", "r");
13038	char c = getc(fp);
13039	if (
13040		19 <= FILE_bufsiz(fp) &&
13041		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13042	)
13043		exit(0);
13044	exit(1);
13045}
13046EOP
13047	set try
13048	if eval $compile && $to try.c; then
13049		if $run ./try; then
13050			echo "And its _base field acts std."
13051			val="$define"
13052		else
13053			echo "But its _base field isn't std."
13054		fi
13055	else
13056		echo "However, it seems to be lacking the _base field."
13057	fi
13058	$rm_try
13059	;;
13060esac
13061set d_stdiobase
13062eval $setvar
13063
13064: see if fast_stdio exists
13065val="$undef"
13066case "$d_stdstdio:$d_stdio_ptr_lval" in
13067"$define:$define")
13068	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13069	*$define*)
13070		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13071		val="$define"
13072		;;
13073	esac
13074	;;
13075esac
13076set d_faststdio
13077eval $setvar
13078
13079
13080
13081: see if fchdir exists
13082set fchdir d_fchdir
13083eval $inlibc
13084
13085: see if fchmod exists
13086set fchmod d_fchmod
13087eval $inlibc
13088
13089: see if fchown exists
13090set fchown d_fchown
13091eval $inlibc
13092
13093: see if this is an fcntl system
13094set fcntl d_fcntl
13095eval $inlibc
13096
13097: See if fcntl-based locking works.
13098echo " "
13099$cat >try.c <<EOCP
13100#$i_stdlib I_STDLIB
13101#ifdef I_STDLIB
13102#include <stdlib.h>
13103#endif
13104#include <unistd.h>
13105#include <fcntl.h>
13106#include <signal.h>
13107$signal_t blech(int x) { exit(3); }
13108int main() {
13109#if defined(F_SETLK) && defined(F_SETLKW)
13110     struct flock flock;
13111     int retval, fd;
13112     fd = open("try.c", O_RDONLY);
13113     flock.l_type = F_RDLCK;
13114     flock.l_whence = SEEK_SET;
13115     flock.l_start = flock.l_len = 0;
13116     signal(SIGALRM, blech);
13117     alarm(10);
13118     retval = fcntl(fd, F_SETLK, &flock);
13119     close(fd);
13120     (retval < 0 ? exit(2) : exit(0));
13121#else
13122     exit(2);
13123#endif
13124}
13125EOCP
13126echo "Checking if fcntl-based file locking works... "
13127case "$d_fcntl" in
13128"$define")
13129	set try
13130	if eval $compile_ok; then
13131		if $run ./try; then
13132			echo "Yes, it seems to work."
13133			val="$define"
13134		else
13135			echo "Nope, it didn't work."
13136			val="$undef"
13137			case "$?" in
13138			3) $cat >&4 <<EOM
13139***
13140*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13141*** This is (almost) impossible.
13142*** If your NFS lock daemons are not feeling well, something like
13143*** this may happen, please investigate.  Cannot continue, aborting.
13144***
13145EOM
13146				exit 1
13147				;;
13148			esac
13149		fi
13150	else
13151		echo "I'm unable to compile the test program, so I'll assume not."
13152		val="$undef"
13153	fi
13154	;;
13155*) val="$undef";
13156	echo "Nope, since you don't even have fcntl()."
13157	;;
13158esac
13159set d_fcntl_can_lock
13160eval $setvar
13161$rm_try
13162
13163: check for fd_set items
13164$cat <<EOM
13165
13166Checking to see how well your C compiler handles fd_set and friends ...
13167EOM
13168$cat >try.c <<EOCP
13169#$i_stdlib I_STDLIB
13170#ifdef I_STDLIB
13171#include <stdlib.h>
13172#endif
13173#$i_systime I_SYS_TIME
13174#$i_sysselct I_SYS_SELECT
13175#$d_socket HAS_SOCKET
13176#include <sys/types.h>
13177#ifdef HAS_SOCKET
13178#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13179#endif
13180#ifdef I_SYS_TIME
13181#include <sys/time.h>
13182#endif
13183#ifdef I_SYS_SELECT
13184#include <sys/select.h>
13185#endif
13186int main() {
13187	fd_set fds;
13188
13189#ifdef TRYBITS
13190	if(fds.fds_bits);
13191#endif
13192
13193#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13194	exit(0);
13195#else
13196	exit(1);
13197#endif
13198}
13199EOCP
13200set try -DTRYBITS
13201if eval $compile; then
13202	d_fds_bits="$define"
13203	d_fd_set="$define"
13204	echo "Well, your system knows about the normal fd_set typedef..." >&4
13205	if $run ./try; then
13206		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13207		d_fd_macros="$define"
13208	else
13209		$cat >&4 <<'EOM'
13210but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13211EOM
13212		d_fd_macros="$undef"
13213	fi
13214else
13215	$cat <<'EOM'
13216Hmm, your compiler has some difficulty with fd_set.  Checking further...
13217EOM
13218	set try
13219	if eval $compile; then
13220		d_fds_bits="$undef"
13221		d_fd_set="$define"
13222		echo "Well, your system has some sort of fd_set available..." >&4
13223		if $run ./try; then
13224			echo "and you have the normal fd_set macros." >&4
13225			d_fd_macros="$define"
13226		else
13227			$cat <<'EOM'
13228but not the normal fd_set macros!  Gross!  More work for me...
13229EOM
13230			d_fd_macros="$undef"
13231		fi
13232	else
13233	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13234		d_fd_set="$undef"
13235		d_fds_bits="$undef"
13236		d_fd_macros="$undef"
13237	fi
13238fi
13239$rm_try
13240
13241: see if fgetpos exists
13242set fgetpos d_fgetpos
13243eval $inlibc
13244
13245: see if finite exists
13246set finite d_finite
13247eval $inlibc
13248
13249: see if finitel exists
13250set finitel d_finitel
13251eval $inlibc
13252
13253: see if flock exists
13254set flock d_flock
13255eval $inlibc
13256
13257: see if prototype for flock is available
13258echo " "
13259set d_flockproto flock $i_sysfile sys/file.h
13260eval $hasproto
13261
13262: see if fp_class exists
13263set fp_class d_fp_class
13264eval $inlibc
13265
13266: see if pathconf exists
13267set pathconf d_pathconf
13268eval $inlibc
13269
13270: see if fpathconf exists
13271set fpathconf d_fpathconf
13272eval $inlibc
13273
13274: see if fpclass exists
13275set fpclass d_fpclass
13276eval $inlibc
13277
13278: see if fpclassify exists
13279set fpclassify d_fpclassify
13280eval $inlibc
13281
13282: see if fpclassl exists
13283set fpclassl d_fpclassl
13284eval $inlibc
13285
13286: check for fpos64_t
13287echo " "
13288echo "Checking to see if you have fpos64_t..." >&4
13289$cat >try.c <<EOCP
13290#include <stdio.h>
13291int main() { fpos64_t x = 7; }
13292EOCP
13293set try
13294if eval $compile; then
13295	val="$define"
13296	echo "You have fpos64_t."
13297else
13298	val="$undef"
13299	echo "You do not have fpos64_t."
13300	case "$fpossize" in
13301	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13302	esac
13303fi
13304$rm_try
13305set d_fpos64_t
13306eval $setvar
13307
13308: see if frexpl exists
13309set frexpl d_frexpl
13310eval $inlibc
13311
13312: see if this is a sys/param system
13313set sys/param.h i_sysparam
13314eval $inhdr
13315
13316: see if this is a sys/mount.h system
13317set sys/mount.h i_sysmount
13318eval $inhdr
13319
13320: Check for fs_data_s
13321echo " "
13322echo "Checking to see if your system supports struct fs_data..." >&4
13323set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13324eval $hasstruct
13325case "$d_fs_data_s" in
13326"$define")      echo "Yes, it does."   ;;
13327*)              echo "No, it doesn't." ;;
13328esac
13329
13330: see if fseeko exists
13331set fseeko d_fseeko
13332eval $inlibc
13333case "$longsize" in
133348) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13335esac
13336
13337: see if fsetpos exists
13338set fsetpos d_fsetpos
13339eval $inlibc
13340
13341: see if fstatfs exists
13342set fstatfs d_fstatfs
13343eval $inlibc
13344
13345: see if statvfs exists
13346set statvfs d_statvfs
13347eval $inlibc
13348
13349: see if fstatvfs exists
13350set fstatvfs d_fstatvfs
13351eval $inlibc
13352
13353
13354: see if fsync exists
13355set fsync d_fsync
13356eval $inlibc
13357
13358: see if ftello exists
13359set ftello d_ftello
13360eval $inlibc
13361case "$longsize" in
133628) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13363esac
13364
13365: check for a working futimes
13366d_futimes="$undef"
13367echo " "
13368echo "Checking if you have a working futimes()" >&4
13369$cat >try.c <<EOCP
13370#include <stdio.h>
13371#include <sys/time.h>
13372#include <errno.h>
13373#include <fcntl.h>
13374
13375int main ()
13376{
13377    int fd, rv;
13378    fd = open ("try.c", O_RDWR);
13379    if (-1 == fd) exit (1);
13380    rv = futimes (fd, NULL);
13381    exit (rv == -1 ? errno : 0);
13382}
13383EOCP
13384set try
13385if eval $compile; then
13386    `$run ./try`
13387    rc=$?
13388    case "$rc" in
13389	0)  echo "Yes, you have" >&4
13390	    d_futimes="$define"
13391	    ;;
13392	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13393	    ;;
13394    esac
13395else
13396    echo "No, it does not (probably harmless)" >&4
13397fi
13398$rm_try
13399
13400: see if ndbm.h is available
13401set ndbm.h i_ndbm
13402eval $inhdr
13403: Compatibility location for RedHat 7.1
13404set gdbm/ndbm.h i_gdbmndbm
13405eval $inhdr
13406: Compatibility location for Debian 4.0
13407set gdbm-ndbm.h i_gdbm_ndbm
13408eval $inhdr
13409
13410val="$undef"
13411if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13412	: see if dbm_open exists
13413	set dbm_open d_dbm_open
13414	eval $inlibc
13415	case "$d_dbm_open" in
13416	$undef)
13417		i_ndbm="$undef"
13418		i_gdbmndbm="$undef"
13419		i_gdbm_ndbm="$undef"
13420		echo "We won't be including <ndbm.h>"
13421		val="$undef"
13422		;;
13423	*) val="$define"
13424	   ;;
13425	esac
13426fi
13427set d_ndbm
13428eval $setvar
13429
13430ndbm_hdr_protochk='name=$1; hdr=$2;
13431eval "ihdr=\$""i_$name";
13432val="$undef";
13433if $test "$ihdr" = "$define"; then
13434	$echo "Checking if your <$hdr> uses prototypes..." >&4;
13435	case "$d_cplusplus" in
13436	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13437	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13438	esac;
13439	case "$val" in
13440	$define) $echo "Your <$hdr> seems to have prototypes";;
13441	*) $echo "Your <$hdr> does not seem to have prototypes";;
13442	esac;
13443fi;
13444set "d_${name}_h_uses_prototypes";
13445eval $setvar'
13446
13447set ndbm ndbm.h
13448eval $ndbm_hdr_protochk
13449set gdbmndbm gdbm/ndbm.h
13450eval $ndbm_hdr_protochk
13451set gdbm_ndbm gdbm-ndbm.h
13452eval $ndbm_hdr_protochk
13453
13454: see if getaddrinfo exists
13455set getaddrinfo d_getaddrinfo
13456eval $inlibc
13457
13458: see if getcwd exists
13459set getcwd d_getcwd
13460eval $inlibc
13461
13462: see if getespwnam exists
13463set getespwnam d_getespwnam
13464eval $inlibc
13465
13466: see if getfsstat exists
13467set getfsstat d_getfsstat
13468eval $inlibc
13469
13470: see if getgrent exists
13471set getgrent d_getgrent
13472eval $inlibc
13473
13474: see if getgrent_r exists
13475set getgrent_r d_getgrent_r
13476eval $inlibc
13477case "$d_getgrent_r" in
13478"$define")
13479	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13480	case "$d_getgrent_r_proto:$usethreads" in
13481	":define")	d_getgrent_r_proto=define
13482		set d_getgrent_r_proto getgrent_r $hdrs
13483		eval $hasproto ;;
13484	*)	;;
13485	esac
13486	case "$d_getgrent_r_proto" in
13487	define)
13488	case "$getgrent_r_proto" in
13489	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13490	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13491	esac
13492	case "$getgrent_r_proto" in
13493	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13494	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13495	esac
13496	case "$getgrent_r_proto" in
13497	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13498	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13499	esac
13500	case "$getgrent_r_proto" in
13501	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13502	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13503	esac
13504	case "$getgrent_r_proto" in
13505	''|0) try='int getgrent_r(struct group*, char*, int);'
13506	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13507	esac
13508	case "$getgrent_r_proto" in
13509	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13510	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13511	esac
13512	case "$getgrent_r_proto" in
13513	''|0)	d_getgrent_r=undef
13514 	        getgrent_r_proto=0
13515		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13516	* )	case "$getgrent_r_proto" in
13517		REENTRANT_PROTO*) ;;
13518		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13519		esac
13520		echo "Prototype: $try" ;;
13521	esac
13522	;;
13523	*)	case "$usethreads" in
13524		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13525		esac
13526		d_getgrent_r=undef
13527		getgrent_r_proto=0
13528		;;
13529	esac
13530	;;
13531*)	getgrent_r_proto=0
13532	;;
13533esac
13534
13535: see if getgrgid_r exists
13536set getgrgid_r d_getgrgid_r
13537eval $inlibc
13538case "$d_getgrgid_r" in
13539"$define")
13540	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13541	case "$d_getgrgid_r_proto:$usethreads" in
13542	":define")	d_getgrgid_r_proto=define
13543		set d_getgrgid_r_proto getgrgid_r $hdrs
13544		eval $hasproto ;;
13545	*)	;;
13546	esac
13547	case "$d_getgrgid_r_proto" in
13548	define)
13549	case "$getgrgid_r_proto" in
13550	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13551	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13552	esac
13553	case "$getgrgid_r_proto" in
13554	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13555	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13556	esac
13557	case "$getgrgid_r_proto" in
13558	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13559	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13560	esac
13561	case "$getgrgid_r_proto" in
13562	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13563	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13564	esac
13565	case "$getgrgid_r_proto" in
13566	''|0)	d_getgrgid_r=undef
13567 	        getgrgid_r_proto=0
13568		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13569	* )	case "$getgrgid_r_proto" in
13570		REENTRANT_PROTO*) ;;
13571		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13572		esac
13573		echo "Prototype: $try" ;;
13574	esac
13575	;;
13576	*)	case "$usethreads" in
13577		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13578		esac
13579		d_getgrgid_r=undef
13580		getgrgid_r_proto=0
13581		;;
13582	esac
13583	;;
13584*)	getgrgid_r_proto=0
13585	;;
13586esac
13587
13588: see if getgrnam_r exists
13589set getgrnam_r d_getgrnam_r
13590eval $inlibc
13591case "$d_getgrnam_r" in
13592"$define")
13593	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13594	case "$d_getgrnam_r_proto:$usethreads" in
13595	":define")	d_getgrnam_r_proto=define
13596		set d_getgrnam_r_proto getgrnam_r $hdrs
13597		eval $hasproto ;;
13598	*)	;;
13599	esac
13600	case "$d_getgrnam_r_proto" in
13601	define)
13602	case "$getgrnam_r_proto" in
13603	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13604	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13605	esac
13606	case "$getgrnam_r_proto" in
13607	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13608	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13609	esac
13610	case "$getgrnam_r_proto" in
13611	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13612	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13613	esac
13614	case "$getgrnam_r_proto" in
13615	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13616	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13617	esac
13618	case "$getgrnam_r_proto" in
13619	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13620	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13621	esac
13622	case "$getgrnam_r_proto" in
13623	''|0)	d_getgrnam_r=undef
13624 	        getgrnam_r_proto=0
13625		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13626	* )	case "$getgrnam_r_proto" in
13627		REENTRANT_PROTO*) ;;
13628		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13629		esac
13630		echo "Prototype: $try" ;;
13631	esac
13632	;;
13633	*)	case "$usethreads" in
13634		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13635		esac
13636		d_getgrnam_r=undef
13637		getgrnam_r_proto=0
13638		;;
13639	esac
13640	;;
13641*)	getgrnam_r_proto=0
13642	;;
13643esac
13644
13645: see if gethostbyaddr exists
13646set gethostbyaddr d_gethbyaddr
13647eval $inlibc
13648
13649: see if gethostbyname exists
13650set gethostbyname d_gethbyname
13651eval $inlibc
13652
13653: see if gethostent exists
13654set gethostent d_gethent
13655eval $inlibc
13656
13657: see how we will look up host name
13658echo " "
13659call=''
13660if set gethostname val -f d_gethname; eval $csym; $val; then
13661	echo 'gethostname() found.' >&4
13662	d_gethname="$define"
13663	call=gethostname
13664fi
13665if set uname val -f d_uname; eval $csym; $val; then
13666	if ./xenix; then
13667		$cat <<'EOM'
13668uname() was found, but you're running xenix, and older versions of xenix
13669have a broken uname(). If you don't really know whether your xenix is old
13670enough to have a broken system call, use the default answer.
13671
13672EOM
13673		dflt=y
13674		case "$d_uname" in
13675		"$define") dflt=n;;
13676		esac
13677		rp='Is your uname() broken?'
13678		. ./myread
13679		case "$ans" in
13680		n*) d_uname="$define"; call=uname;;
13681		esac
13682	else
13683		echo 'uname() found.' >&4
13684		d_uname="$define"
13685		case "$call" in
13686		'') call=uname ;;
13687		esac
13688	fi
13689fi
13690case "$d_gethname" in
13691'') d_gethname="$undef";;
13692esac
13693case "$d_uname" in
13694'') d_uname="$undef";;
13695esac
13696case "$d_uname$d_gethname" in
13697*define*)
13698	dflt=n
13699	cat <<EOM
13700
13701Every now and then someone has a $call() that lies about the hostname
13702but can't be fixed for political or economic reasons.  If you wish, I can
13703pretend $call() isn't there and maybe compute hostname at run-time
13704thanks to the '$phostname' command.
13705
13706EOM
13707	rp="Shall I ignore $call() from now on?"
13708	. ./myread
13709	case "$ans" in
13710	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13711	esac;;
13712esac
13713case "$phostname" in
13714'') aphostname='';;
13715*) case "$aphostname" in
13716	/*) ;;
13717	*) set X $phostname
13718		shift
13719		file=$1
13720		shift
13721		file=`./loc $file $file $pth`
13722		aphostname=`echo $file $*`
13723		;;
13724	esac
13725	;;
13726esac
13727case "$d_uname$d_gethname" in
13728*define*) ;;
13729*)
13730	case "$phostname" in
13731	'')
13732		echo "There will be no way for $package to get your hostname." >&4;;
13733	*)
13734	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13735		;;
13736	esac;;
13737esac
13738case "$d_phostname" in
13739'') d_phostname="$undef";;
13740esac
13741
13742: see if gethostbyaddr_r exists
13743set gethostbyaddr_r d_gethostbyaddr_r
13744eval $inlibc
13745case "$d_gethostbyaddr_r" in
13746"$define")
13747	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13748	case "$d_gethostbyaddr_r_proto:$usethreads" in
13749	":define")	d_gethostbyaddr_r_proto=define
13750		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13751		eval $hasproto ;;
13752	*)	;;
13753	esac
13754	case "$d_gethostbyaddr_r_proto" in
13755	define)
13756	case "$gethostbyaddr_r_proto" in
13757	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13758	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13759	esac
13760	case "$gethostbyaddr_r_proto" in
13761	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13762	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13763	esac
13764	case "$gethostbyaddr_r_proto" in
13765	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13766	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13767	esac
13768	case "$gethostbyaddr_r_proto" in
13769	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13770	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13771	esac
13772	case "$gethostbyaddr_r_proto" in
13773	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13774	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13775	esac
13776	case "$gethostbyaddr_r_proto" in
13777	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13778	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13779	esac
13780	case "$gethostbyaddr_r_proto" in
13781	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13782	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13783	esac
13784	case "$gethostbyaddr_r_proto" in
13785	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13786	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13787	esac
13788	case "$gethostbyaddr_r_proto" in
13789	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13790	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13791	esac
13792	case "$gethostbyaddr_r_proto" in
13793	''|0) try='int gethostbyaddr_r(const char*, int, int);'
13794	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13795	esac
13796	case "$gethostbyaddr_r_proto" in
13797	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13798	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13799	esac
13800	case "$gethostbyaddr_r_proto" in
13801	''|0)	d_gethostbyaddr_r=undef
13802 	        gethostbyaddr_r_proto=0
13803		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13804	* )	case "$gethostbyaddr_r_proto" in
13805		REENTRANT_PROTO*) ;;
13806		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13807		esac
13808		echo "Prototype: $try" ;;
13809	esac
13810	;;
13811	*)	case "$usethreads" in
13812		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13813		esac
13814		d_gethostbyaddr_r=undef
13815		gethostbyaddr_r_proto=0
13816		;;
13817	esac
13818	;;
13819*)	gethostbyaddr_r_proto=0
13820	;;
13821esac
13822
13823: see if gethostbyname_r exists
13824set gethostbyname_r d_gethostbyname_r
13825eval $inlibc
13826case "$d_gethostbyname_r" in
13827"$define")
13828	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13829	case "$d_gethostbyname_r_proto:$usethreads" in
13830	":define")	d_gethostbyname_r_proto=define
13831		set d_gethostbyname_r_proto gethostbyname_r $hdrs
13832		eval $hasproto ;;
13833	*)	;;
13834	esac
13835	case "$d_gethostbyname_r_proto" in
13836	define)
13837	case "$gethostbyname_r_proto" in
13838	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13839	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13840	esac
13841	case "$gethostbyname_r_proto" in
13842	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13843	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13844	esac
13845	case "$gethostbyname_r_proto" in
13846	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13847	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13848	esac
13849	case "$gethostbyname_r_proto" in
13850	''|0)	d_gethostbyname_r=undef
13851 	        gethostbyname_r_proto=0
13852		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13853	* )	case "$gethostbyname_r_proto" in
13854		REENTRANT_PROTO*) ;;
13855		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13856		esac
13857		echo "Prototype: $try" ;;
13858	esac
13859	;;
13860	*)	case "$usethreads" in
13861		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13862		esac
13863		d_gethostbyname_r=undef
13864		gethostbyname_r_proto=0
13865		;;
13866	esac
13867	;;
13868*)	gethostbyname_r_proto=0
13869	;;
13870esac
13871
13872: see if gethostent_r exists
13873set gethostent_r d_gethostent_r
13874eval $inlibc
13875case "$d_gethostent_r" in
13876"$define")
13877	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13878	case "$d_gethostent_r_proto:$usethreads" in
13879	":define")	d_gethostent_r_proto=define
13880		set d_gethostent_r_proto gethostent_r $hdrs
13881		eval $hasproto ;;
13882	*)	;;
13883	esac
13884	case "$d_gethostent_r_proto" in
13885	define)
13886	case "$gethostent_r_proto" in
13887	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13888	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13889	esac
13890	case "$gethostent_r_proto" in
13891	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13892	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13893	esac
13894	case "$gethostent_r_proto" in
13895	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13896	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13897	esac
13898	case "$gethostent_r_proto" in
13899	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13900	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13901	esac
13902	case "$gethostent_r_proto" in
13903	''|0) try='int gethostent_r(struct hostent*, char*, int);'
13904	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13905	esac
13906	case "$gethostent_r_proto" in
13907	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13908	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13909	esac
13910	case "$gethostent_r_proto" in
13911	''|0)	d_gethostent_r=undef
13912 	        gethostent_r_proto=0
13913		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13914	* )	case "$gethostent_r_proto" in
13915		REENTRANT_PROTO*) ;;
13916		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13917		esac
13918		echo "Prototype: $try" ;;
13919	esac
13920	;;
13921	*)	case "$usethreads" in
13922		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13923		esac
13924		d_gethostent_r=undef
13925		gethostent_r_proto=0
13926		;;
13927	esac
13928	;;
13929*)	gethostent_r_proto=0
13930	;;
13931esac
13932
13933: see if prototypes for various gethostxxx netdb.h functions are available
13934echo " "
13935set d_gethostprotos gethostent $i_netdb netdb.h
13936eval $hasproto
13937
13938: see if getitimer exists
13939set getitimer d_getitimer
13940eval $inlibc
13941
13942: see if getlogin exists
13943set getlogin d_getlogin
13944eval $inlibc
13945
13946: see if getlogin_r exists
13947set getlogin_r d_getlogin_r
13948eval $inlibc
13949case "$d_getlogin_r" in
13950"$define")
13951	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13952	case "$d_getlogin_r_proto:$usethreads" in
13953	":define")	d_getlogin_r_proto=define
13954		set d_getlogin_r_proto getlogin_r $hdrs
13955		eval $hasproto ;;
13956	*)	;;
13957	esac
13958	case "$d_getlogin_r_proto" in
13959	define)
13960	case "$getlogin_r_proto" in
13961	''|0) try='int getlogin_r(char*, size_t);'
13962	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13963	esac
13964	case "$getlogin_r_proto" in
13965	''|0) try='int getlogin_r(char*, int);'
13966	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13967	esac
13968	case "$getlogin_r_proto" in
13969	''|0) try='char* getlogin_r(char*, size_t);'
13970	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13971	esac
13972	case "$getlogin_r_proto" in
13973	''|0) try='char* getlogin_r(char*, int);'
13974	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13975	esac
13976	case "$getlogin_r_proto" in
13977	''|0)	d_getlogin_r=undef
13978 	        getlogin_r_proto=0
13979		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13980	* )	case "$getlogin_r_proto" in
13981		REENTRANT_PROTO*) ;;
13982		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13983		esac
13984		echo "Prototype: $try" ;;
13985	esac
13986	;;
13987	*)	case "$usethreads" in
13988		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13989		esac
13990		d_getlogin_r=undef
13991		getlogin_r_proto=0
13992		;;
13993	esac
13994	;;
13995*)	getlogin_r_proto=0
13996	;;
13997esac
13998
13999: see if getmnt exists
14000set getmnt d_getmnt
14001eval $inlibc
14002
14003: see if getmntent exists
14004set getmntent d_getmntent
14005eval $inlibc
14006
14007: see if getnameinfo exists
14008set getnameinfo d_getnameinfo
14009eval $inlibc
14010
14011: see if getnetbyaddr exists
14012set getnetbyaddr d_getnbyaddr
14013eval $inlibc
14014
14015: see if getnetbyname exists
14016set getnetbyname d_getnbyname
14017eval $inlibc
14018
14019: see if getnetent exists
14020set getnetent d_getnent
14021eval $inlibc
14022
14023: see if getnetbyaddr_r exists
14024set getnetbyaddr_r d_getnetbyaddr_r
14025eval $inlibc
14026case "$d_getnetbyaddr_r" in
14027"$define")
14028	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14029	case "$d_getnetbyaddr_r_proto:$usethreads" in
14030	":define")	d_getnetbyaddr_r_proto=define
14031		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14032		eval $hasproto ;;
14033	*)	;;
14034	esac
14035	case "$d_getnetbyaddr_r_proto" in
14036	define)
14037	case "$getnetbyaddr_r_proto" in
14038	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14039	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14040	esac
14041	case "$getnetbyaddr_r_proto" in
14042	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14043	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14044	esac
14045	case "$getnetbyaddr_r_proto" in
14046	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14047	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14048	esac
14049	case "$getnetbyaddr_r_proto" in
14050	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14051	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14052	esac
14053	case "$getnetbyaddr_r_proto" in
14054	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14055	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14056	esac
14057	case "$getnetbyaddr_r_proto" in
14058	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14059	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14060	esac
14061	case "$getnetbyaddr_r_proto" in
14062	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14063	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14064	esac
14065	case "$getnetbyaddr_r_proto" in
14066	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14067	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14068	esac
14069	case "$getnetbyaddr_r_proto" in
14070	''|0)	d_getnetbyaddr_r=undef
14071 	        getnetbyaddr_r_proto=0
14072		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14073	* )	case "$getnetbyaddr_r_proto" in
14074		REENTRANT_PROTO*) ;;
14075		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14076		esac
14077		echo "Prototype: $try" ;;
14078	esac
14079	;;
14080	*)	case "$usethreads" in
14081		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14082		esac
14083		d_getnetbyaddr_r=undef
14084		getnetbyaddr_r_proto=0
14085		;;
14086	esac
14087	;;
14088*)	getnetbyaddr_r_proto=0
14089	;;
14090esac
14091
14092: see if getnetbyname_r exists
14093set getnetbyname_r d_getnetbyname_r
14094eval $inlibc
14095case "$d_getnetbyname_r" in
14096"$define")
14097	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14098	case "$d_getnetbyname_r_proto:$usethreads" in
14099	":define")	d_getnetbyname_r_proto=define
14100		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14101		eval $hasproto ;;
14102	*)	;;
14103	esac
14104	case "$d_getnetbyname_r_proto" in
14105	define)
14106	case "$getnetbyname_r_proto" in
14107	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14108	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14109	esac
14110	case "$getnetbyname_r_proto" in
14111	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14112	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14113	esac
14114	case "$getnetbyname_r_proto" in
14115	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14116	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14117	esac
14118	case "$getnetbyname_r_proto" in
14119	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14120	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14121	esac
14122	case "$getnetbyname_r_proto" in
14123	''|0)	d_getnetbyname_r=undef
14124 	        getnetbyname_r_proto=0
14125		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14126	* )	case "$getnetbyname_r_proto" in
14127		REENTRANT_PROTO*) ;;
14128		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14129		esac
14130		echo "Prototype: $try" ;;
14131	esac
14132	;;
14133	*)	case "$usethreads" in
14134		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14135		esac
14136		d_getnetbyname_r=undef
14137		getnetbyname_r_proto=0
14138		;;
14139	esac
14140	;;
14141*)	getnetbyname_r_proto=0
14142	;;
14143esac
14144
14145: see if getnetent_r exists
14146set getnetent_r d_getnetent_r
14147eval $inlibc
14148case "$d_getnetent_r" in
14149"$define")
14150	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14151	case "$d_getnetent_r_proto:$usethreads" in
14152	":define")	d_getnetent_r_proto=define
14153		set d_getnetent_r_proto getnetent_r $hdrs
14154		eval $hasproto ;;
14155	*)	;;
14156	esac
14157	case "$d_getnetent_r_proto" in
14158	define)
14159	case "$getnetent_r_proto" in
14160	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14161	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14162	esac
14163	case "$getnetent_r_proto" in
14164	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14165	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14166	esac
14167	case "$getnetent_r_proto" in
14168	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14169	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14170	esac
14171	case "$getnetent_r_proto" in
14172	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14173	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14174	esac
14175	case "$getnetent_r_proto" in
14176	''|0) try='int getnetent_r(struct netent*, char*, int);'
14177	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14178	esac
14179	case "$getnetent_r_proto" in
14180	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14181	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14182	esac
14183	case "$getnetent_r_proto" in
14184	''|0)	d_getnetent_r=undef
14185 	        getnetent_r_proto=0
14186		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14187	* )	case "$getnetent_r_proto" in
14188		REENTRANT_PROTO*) ;;
14189		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14190		esac
14191		echo "Prototype: $try" ;;
14192	esac
14193	;;
14194	*)	case "$usethreads" in
14195		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14196		esac
14197		d_getnetent_r=undef
14198		getnetent_r_proto=0
14199		;;
14200	esac
14201	;;
14202*)	getnetent_r_proto=0
14203	;;
14204esac
14205
14206: see if prototypes for various getnetxxx netdb.h functions are available
14207echo " "
14208set d_getnetprotos getnetent $i_netdb netdb.h
14209eval $hasproto
14210
14211: see if getpagesize exists
14212set getpagesize d_getpagsz
14213eval $inlibc
14214
14215: Optional checks for getprotobyname and getprotobynumber
14216
14217: see if getprotobyname exists
14218set getprotobyname d_getpbyname
14219eval $inlibc
14220
14221: see if getprotobynumber exists
14222set getprotobynumber d_getpbynumber
14223eval $inlibc
14224
14225: see if getprotoent exists
14226set getprotoent d_getpent
14227eval $inlibc
14228
14229: see if getpgid exists
14230set getpgid d_getpgid
14231eval $inlibc
14232
14233: see if getpgrp2 exists
14234set getpgrp2 d_getpgrp2
14235eval $inlibc
14236
14237: see if getppid exists
14238set getppid d_getppid
14239eval $inlibc
14240
14241: see if getpriority exists
14242set getpriority d_getprior
14243eval $inlibc
14244
14245: see if getprotobyname_r exists
14246set getprotobyname_r d_getprotobyname_r
14247eval $inlibc
14248case "$d_getprotobyname_r" in
14249"$define")
14250	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14251	case "$d_getprotobyname_r_proto:$usethreads" in
14252	":define")	d_getprotobyname_r_proto=define
14253		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14254		eval $hasproto ;;
14255	*)	;;
14256	esac
14257	case "$d_getprotobyname_r_proto" in
14258	define)
14259	case "$getprotobyname_r_proto" in
14260	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14261	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14262	esac
14263	case "$getprotobyname_r_proto" in
14264	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14265	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14266	esac
14267	case "$getprotobyname_r_proto" in
14268	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14269	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14270	esac
14271	case "$getprotobyname_r_proto" in
14272	''|0)	d_getprotobyname_r=undef
14273 	        getprotobyname_r_proto=0
14274		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14275	* )	case "$getprotobyname_r_proto" in
14276		REENTRANT_PROTO*) ;;
14277		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14278		esac
14279		echo "Prototype: $try" ;;
14280	esac
14281	;;
14282	*)	case "$usethreads" in
14283		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14284		esac
14285		d_getprotobyname_r=undef
14286		getprotobyname_r_proto=0
14287		;;
14288	esac
14289	;;
14290*)	getprotobyname_r_proto=0
14291	;;
14292esac
14293
14294: see if getprotobynumber_r exists
14295set getprotobynumber_r d_getprotobynumber_r
14296eval $inlibc
14297case "$d_getprotobynumber_r" in
14298"$define")
14299	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14300	case "$d_getprotobynumber_r_proto:$usethreads" in
14301	":define")	d_getprotobynumber_r_proto=define
14302		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14303		eval $hasproto ;;
14304	*)	;;
14305	esac
14306	case "$d_getprotobynumber_r_proto" in
14307	define)
14308	case "$getprotobynumber_r_proto" in
14309	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14310	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14311	esac
14312	case "$getprotobynumber_r_proto" in
14313	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14314	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14315	esac
14316	case "$getprotobynumber_r_proto" in
14317	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14318	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14319	esac
14320	case "$getprotobynumber_r_proto" in
14321	''|0)	d_getprotobynumber_r=undef
14322 	        getprotobynumber_r_proto=0
14323		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14324	* )	case "$getprotobynumber_r_proto" in
14325		REENTRANT_PROTO*) ;;
14326		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14327		esac
14328		echo "Prototype: $try" ;;
14329	esac
14330	;;
14331	*)	case "$usethreads" in
14332		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14333		esac
14334		d_getprotobynumber_r=undef
14335		getprotobynumber_r_proto=0
14336		;;
14337	esac
14338	;;
14339*)	getprotobynumber_r_proto=0
14340	;;
14341esac
14342
14343: see if getprotoent_r exists
14344set getprotoent_r d_getprotoent_r
14345eval $inlibc
14346case "$d_getprotoent_r" in
14347"$define")
14348	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14349	case "$d_getprotoent_r_proto:$usethreads" in
14350	":define")	d_getprotoent_r_proto=define
14351		set d_getprotoent_r_proto getprotoent_r $hdrs
14352		eval $hasproto ;;
14353	*)	;;
14354	esac
14355	case "$d_getprotoent_r_proto" in
14356	define)
14357	case "$getprotoent_r_proto" in
14358	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14359	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14360	esac
14361	case "$getprotoent_r_proto" in
14362	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14363	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14364	esac
14365	case "$getprotoent_r_proto" in
14366	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14367	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14368	esac
14369	case "$getprotoent_r_proto" in
14370	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14371	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14372	esac
14373	case "$getprotoent_r_proto" in
14374	''|0)	d_getprotoent_r=undef
14375 	        getprotoent_r_proto=0
14376		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14377	* )	case "$getprotoent_r_proto" in
14378		REENTRANT_PROTO*) ;;
14379		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14380		esac
14381		echo "Prototype: $try" ;;
14382	esac
14383	;;
14384	*)	case "$usethreads" in
14385		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14386		esac
14387		d_getprotoent_r=undef
14388		getprotoent_r_proto=0
14389		;;
14390	esac
14391	;;
14392*)	getprotoent_r_proto=0
14393	;;
14394esac
14395
14396: see if prototypes for various getprotoxxx netdb.h functions are available
14397echo " "
14398set d_getprotoprotos getprotoent $i_netdb netdb.h
14399eval $hasproto
14400
14401: see if getprpwnam exists
14402set getprpwnam d_getprpwnam
14403eval $inlibc
14404
14405: see if getpwent exists
14406set getpwent d_getpwent
14407eval $inlibc
14408
14409: see if getpwent_r exists
14410set getpwent_r d_getpwent_r
14411eval $inlibc
14412case "$d_getpwent_r" in
14413"$define")
14414	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14415	case "$d_getpwent_r_proto:$usethreads" in
14416	":define")	d_getpwent_r_proto=define
14417		set d_getpwent_r_proto getpwent_r $hdrs
14418		eval $hasproto ;;
14419	*)	;;
14420	esac
14421	case "$d_getpwent_r_proto" in
14422	define)
14423	case "$getpwent_r_proto" in
14424	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14425	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14426	esac
14427	case "$getpwent_r_proto" in
14428	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14429	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14430	esac
14431	case "$getpwent_r_proto" in
14432	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14433	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14434	esac
14435	case "$getpwent_r_proto" in
14436	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14437	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14438	esac
14439	case "$getpwent_r_proto" in
14440	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14441	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14442	esac
14443	case "$getpwent_r_proto" in
14444	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14445	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14446	esac
14447	case "$getpwent_r_proto" in
14448	''|0)	d_getpwent_r=undef
14449 	        getpwent_r_proto=0
14450		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14451	* )	case "$getpwent_r_proto" in
14452		REENTRANT_PROTO*) ;;
14453		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14454		esac
14455		echo "Prototype: $try" ;;
14456	esac
14457	;;
14458	*)	case "$usethreads" in
14459		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14460		esac
14461		d_getpwent_r=undef
14462		getpwent_r_proto=0
14463		;;
14464	esac
14465	;;
14466*)	getpwent_r_proto=0
14467	;;
14468esac
14469
14470: see if getpwnam_r exists
14471set getpwnam_r d_getpwnam_r
14472eval $inlibc
14473case "$d_getpwnam_r" in
14474"$define")
14475	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14476	case "$d_getpwnam_r_proto:$usethreads" in
14477	":define")	d_getpwnam_r_proto=define
14478		set d_getpwnam_r_proto getpwnam_r $hdrs
14479		eval $hasproto ;;
14480	*)	;;
14481	esac
14482	case "$d_getpwnam_r_proto" in
14483	define)
14484	case "$getpwnam_r_proto" in
14485	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14486	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14487	esac
14488	case "$getpwnam_r_proto" in
14489	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14490	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14491	esac
14492	case "$getpwnam_r_proto" in
14493	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14494	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14495	esac
14496	case "$getpwnam_r_proto" in
14497	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14498	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14499	esac
14500	case "$getpwnam_r_proto" in
14501	''|0)	d_getpwnam_r=undef
14502 	        getpwnam_r_proto=0
14503		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14504	* )	case "$getpwnam_r_proto" in
14505		REENTRANT_PROTO*) ;;
14506		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14507		esac
14508		echo "Prototype: $try" ;;
14509	esac
14510	;;
14511	*)	case "$usethreads" in
14512		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14513		esac
14514		d_getpwnam_r=undef
14515		getpwnam_r_proto=0
14516		;;
14517	esac
14518	;;
14519*)	getpwnam_r_proto=0
14520	;;
14521esac
14522
14523: see if getpwuid_r exists
14524set getpwuid_r d_getpwuid_r
14525eval $inlibc
14526case "$d_getpwuid_r" in
14527"$define")
14528	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14529	case "$d_getpwuid_r_proto:$usethreads" in
14530	":define")	d_getpwuid_r_proto=define
14531		set d_getpwuid_r_proto getpwuid_r $hdrs
14532		eval $hasproto ;;
14533	*)	;;
14534	esac
14535	case "$d_getpwuid_r_proto" in
14536	define)
14537	case "$getpwuid_r_proto" in
14538	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14539	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14540	esac
14541	case "$getpwuid_r_proto" in
14542	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14543	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14544	esac
14545	case "$getpwuid_r_proto" in
14546	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14547	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14548	esac
14549	case "$getpwuid_r_proto" in
14550	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14551	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14552	esac
14553	case "$getpwuid_r_proto" in
14554	''|0)	d_getpwuid_r=undef
14555 	        getpwuid_r_proto=0
14556		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14557	* )	case "$getpwuid_r_proto" in
14558		REENTRANT_PROTO*) ;;
14559		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14560		esac
14561		echo "Prototype: $try" ;;
14562	esac
14563	;;
14564	*)	case "$usethreads" in
14565		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14566		esac
14567		d_getpwuid_r=undef
14568		getpwuid_r_proto=0
14569		;;
14570	esac
14571	;;
14572*)	getpwuid_r_proto=0
14573	;;
14574esac
14575
14576: Optional checks for getsbyname and getsbyport
14577
14578: see if getservbyname exists
14579set getservbyname d_getsbyname
14580eval $inlibc
14581
14582: see if getservbyport exists
14583set getservbyport d_getsbyport
14584eval $inlibc
14585
14586: see if getservent exists
14587set getservent d_getsent
14588eval $inlibc
14589
14590: see if getservbyname_r exists
14591set getservbyname_r d_getservbyname_r
14592eval $inlibc
14593case "$d_getservbyname_r" in
14594"$define")
14595	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14596	case "$d_getservbyname_r_proto:$usethreads" in
14597	":define")	d_getservbyname_r_proto=define
14598		set d_getservbyname_r_proto getservbyname_r $hdrs
14599		eval $hasproto ;;
14600	*)	;;
14601	esac
14602	case "$d_getservbyname_r_proto" in
14603	define)
14604	case "$getservbyname_r_proto" in
14605	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14606	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14607	esac
14608	case "$getservbyname_r_proto" in
14609	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14610	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14611	esac
14612	case "$getservbyname_r_proto" in
14613	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14614	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14615	esac
14616	case "$getservbyname_r_proto" in
14617	''|0)	d_getservbyname_r=undef
14618 	        getservbyname_r_proto=0
14619		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14620	* )	case "$getservbyname_r_proto" in
14621		REENTRANT_PROTO*) ;;
14622		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14623		esac
14624		echo "Prototype: $try" ;;
14625	esac
14626	;;
14627	*)	case "$usethreads" in
14628		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14629		esac
14630		d_getservbyname_r=undef
14631		getservbyname_r_proto=0
14632		;;
14633	esac
14634	;;
14635*)	getservbyname_r_proto=0
14636	;;
14637esac
14638
14639: see if getservbyport_r exists
14640set getservbyport_r d_getservbyport_r
14641eval $inlibc
14642case "$d_getservbyport_r" in
14643"$define")
14644	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14645	case "$d_getservbyport_r_proto:$usethreads" in
14646	":define")	d_getservbyport_r_proto=define
14647		set d_getservbyport_r_proto getservbyport_r $hdrs
14648		eval $hasproto ;;
14649	*)	;;
14650	esac
14651	case "$d_getservbyport_r_proto" in
14652	define)
14653	case "$getservbyport_r_proto" in
14654	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14655	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14656	esac
14657	case "$getservbyport_r_proto" in
14658	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14659	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14660	esac
14661	case "$getservbyport_r_proto" in
14662	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14663	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14664	esac
14665	case "$getservbyport_r_proto" in
14666	''|0)	d_getservbyport_r=undef
14667 	        getservbyport_r_proto=0
14668		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14669	* )	case "$getservbyport_r_proto" in
14670		REENTRANT_PROTO*) ;;
14671		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14672		esac
14673		echo "Prototype: $try" ;;
14674	esac
14675	;;
14676	*)	case "$usethreads" in
14677		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14678		esac
14679		d_getservbyport_r=undef
14680		getservbyport_r_proto=0
14681		;;
14682	esac
14683	;;
14684*)	getservbyport_r_proto=0
14685	;;
14686esac
14687
14688: see if getservent_r exists
14689set getservent_r d_getservent_r
14690eval $inlibc
14691case "$d_getservent_r" in
14692"$define")
14693	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14694	case "$d_getservent_r_proto:$usethreads" in
14695	":define")	d_getservent_r_proto=define
14696		set d_getservent_r_proto getservent_r $hdrs
14697		eval $hasproto ;;
14698	*)	;;
14699	esac
14700	case "$d_getservent_r_proto" in
14701	define)
14702	case "$getservent_r_proto" in
14703	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14704	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14705	esac
14706	case "$getservent_r_proto" in
14707	''|0) try='int getservent_r(struct servent*, char*, int);'
14708	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14709	esac
14710	case "$getservent_r_proto" in
14711	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14712	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14713	esac
14714	case "$getservent_r_proto" in
14715	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14716	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14717	esac
14718	case "$getservent_r_proto" in
14719	''|0)	d_getservent_r=undef
14720 	        getservent_r_proto=0
14721		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14722	* )	case "$getservent_r_proto" in
14723		REENTRANT_PROTO*) ;;
14724		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14725		esac
14726		echo "Prototype: $try" ;;
14727	esac
14728	;;
14729	*)	case "$usethreads" in
14730		define) echo "getservent_r has no prototype, not using it." >&4 ;;
14731		esac
14732		d_getservent_r=undef
14733		getservent_r_proto=0
14734		;;
14735	esac
14736	;;
14737*)	getservent_r_proto=0
14738	;;
14739esac
14740
14741: see if prototypes for various getservxxx netdb.h functions are available
14742echo " "
14743set d_getservprotos getservent $i_netdb netdb.h
14744eval $hasproto
14745
14746: see if getspnam exists
14747set getspnam d_getspnam
14748eval $inlibc
14749
14750: see if this is a shadow.h system
14751set shadow.h i_shadow
14752eval $inhdr
14753
14754: see if getspnam_r exists
14755set getspnam_r d_getspnam_r
14756eval $inlibc
14757case "$d_getspnam_r" in
14758"$define")
14759	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14760	case "$d_getspnam_r_proto:$usethreads" in
14761	":define")	d_getspnam_r_proto=define
14762		set d_getspnam_r_proto getspnam_r $hdrs
14763		eval $hasproto ;;
14764	*)	;;
14765	esac
14766	case "$d_getspnam_r_proto" in
14767	define)
14768	case "$getspnam_r_proto" in
14769	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14770	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14771	esac
14772	case "$getspnam_r_proto" in
14773	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14774	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14775	esac
14776	case "$getspnam_r_proto" in
14777	''|0)	d_getspnam_r=undef
14778 	        getspnam_r_proto=0
14779		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14780	* )	case "$getspnam_r_proto" in
14781		REENTRANT_PROTO*) ;;
14782		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14783		esac
14784		echo "Prototype: $try" ;;
14785	esac
14786	;;
14787	*)	case "$usethreads" in
14788		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14789		esac
14790		d_getspnam_r=undef
14791		getspnam_r_proto=0
14792		;;
14793	esac
14794	;;
14795*)	getspnam_r_proto=0
14796	;;
14797esac
14798
14799: see if gettimeofday or ftime exists
14800set gettimeofday d_gettimeod
14801eval $inlibc
14802case "$d_gettimeod" in
14803"$undef")
14804	set ftime d_ftime
14805	eval $inlibc
14806	;;
14807*)
14808	val="$undef"; set d_ftime; eval $setvar
14809	;;
14810esac
14811case "$d_gettimeod$d_ftime" in
14812"$undef$undef")
14813	echo " "
14814	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14815	;;
14816esac
14817
14818: see if gmtime_r exists
14819set gmtime_r d_gmtime_r
14820eval $inlibc
14821case "$d_gmtime_r" in
14822"$define")
14823	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14824	case "$d_gmtime_r_proto:$usethreads" in
14825	":define")	d_gmtime_r_proto=define
14826		set d_gmtime_r_proto gmtime_r $hdrs
14827		eval $hasproto ;;
14828	*)	;;
14829	esac
14830	case "$d_gmtime_r_proto" in
14831	define)
14832	case "$gmtime_r_proto" in
14833	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14834	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14835	esac
14836	case "$gmtime_r_proto" in
14837	''|0) try='int gmtime_r(const time_t*, struct tm*);'
14838	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14839	esac
14840	case "$gmtime_r_proto" in
14841	''|0)	d_gmtime_r=undef
14842 	        gmtime_r_proto=0
14843		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14844	* )	case "$gmtime_r_proto" in
14845		REENTRANT_PROTO*) ;;
14846		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14847		esac
14848		echo "Prototype: $try" ;;
14849	esac
14850	;;
14851	*)	case "$usethreads" in
14852		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14853		esac
14854		d_gmtime_r=undef
14855		gmtime_r_proto=0
14856		;;
14857	esac
14858	;;
14859*)	gmtime_r_proto=0
14860	;;
14861esac
14862
14863: see if hasmntopt exists
14864set hasmntopt d_hasmntopt
14865eval $inlibc
14866
14867: see if this is a netinet/in.h or sys/in.h system
14868set netinet/in.h i_niin sys/in.h i_sysin
14869eval $inhdr
14870
14871: see if arpa/inet.h has to be included
14872set arpa/inet.h i_arpainet
14873eval $inhdr
14874
14875: see if htonl --and friends-- exists
14876val=''
14877set htonl val
14878eval $inlibc
14879
14880: Maybe they are macros.
14881case "$val" in
14882$undef)
14883	$cat >htonl.c <<EOM
14884#include <stdio.h>
14885#include <sys/types.h>
14886#$i_niin I_NETINET_IN
14887#$i_sysin I_SYS_IN
14888#$i_arpainet I_ARPA_INET
14889#ifdef I_NETINET_IN
14890#include <netinet/in.h>
14891#endif
14892#ifdef I_SYS_IN
14893#include <sys/in.h>
14894#endif
14895#ifdef I_ARPA_INET
14896#include <arpa/inet.h>
14897#endif
14898#ifdef htonl
14899printf("Defined as a macro.");
14900#endif
14901EOM
14902	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14903	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14904		val="$define"
14905		echo "But it seems to be defined as a macro." >&4
14906	fi
14907	$rm -f htonl.?
14908	;;
14909esac
14910set d_htonl
14911eval $setvar
14912
14913: see if ilogbl exists
14914set ilogbl d_ilogbl
14915eval $inlibc
14916
14917: index or strchr
14918echo " "
14919if set index val -f; eval $csym; $val; then
14920	if set strchr val -f d_strchr; eval $csym; $val; then
14921		if $contains strchr "$strings" >/dev/null 2>&1 ; then
14922			val="$define"
14923			vali="$undef"
14924			echo "strchr() found." >&4
14925		else
14926			val="$undef"
14927			vali="$define"
14928			echo "index() found." >&4
14929		fi
14930	else
14931		val="$undef"
14932		vali="$define"
14933		echo "index() found." >&4
14934	fi
14935else
14936	if set strchr val -f d_strchr; eval $csym; $val; then
14937		val="$define"
14938		vali="$undef"
14939		echo "strchr() found." >&4
14940	else
14941		echo "No index() or strchr() found!" >&4
14942		val="$undef"
14943		vali="$undef"
14944	fi
14945fi
14946set d_strchr; eval $setvar
14947val="$vali"
14948set d_index; eval $setvar
14949
14950: check whether inet_aton exists
14951set inet_aton d_inetaton
14952eval $inlibc
14953
14954: see if inet_ntop exists
14955set inet_ntop d_inetntop
14956eval $inlibc
14957
14958: see if inet_pton exists
14959set inet_pton d_inetpton
14960eval $inlibc
14961
14962: Look for isascii
14963echo " "
14964$cat >isascii.c <<EOCP
14965#include <stdio.h>
14966#include <ctype.h>
14967#$i_stdlib I_STDLIB
14968#ifdef I_STDLIB
14969#include <stdlib.h>
14970#endif
14971int main() {
14972	int c = 'A';
14973	if (isascii(c))
14974		exit(0);
14975	else
14976		exit(1);
14977}
14978EOCP
14979set isascii
14980if eval $compile; then
14981	echo "isascii() found." >&4
14982	val="$define"
14983else
14984	echo "isascii() NOT found." >&4
14985	val="$undef"
14986fi
14987set d_isascii
14988eval $setvar
14989$rm -f isascii*
14990
14991: see if isfinite exists
14992set isfinite d_isfinite
14993eval $inlibc
14994
14995: see if isinf exists
14996set isinf d_isinf
14997eval $inlibc
14998
14999: see if isnan exists
15000set isnan d_isnan
15001eval $inlibc
15002
15003: see if isnanl exists
15004set isnanl d_isnanl
15005eval $inlibc
15006
15007: see if killpg exists
15008set killpg d_killpg
15009eval $inlibc
15010
15011: see if lchown exists
15012echo " "
15013$cat > try.c <<'EOCP'
15014/* System header to define __stub macros and hopefully few prototypes,
15015    which can conflict with char lchown(); below.  */
15016#include <assert.h>
15017/* Override any gcc2 internal prototype to avoid an error.  */
15018/* We use char because int might match the return type of a gcc2
15019   builtin and then its argument prototype would still apply.  */
15020char lchown();
15021int main() {
15022    /*  The GNU C library defines this for functions which it implements
15023        to always fail with ENOSYS.  Some functions are actually named
15024	something starting with __ and the normal name is an alias.  */
15025#if defined (__stub_lchown) || defined (__stub___lchown)
15026choke me
15027#else
15028lchown();
15029#endif
15030; return 0; }
15031EOCP
15032set try
15033if eval $compile; then
15034    $echo "lchown() found." >&4
15035    val="$define"
15036else
15037    $echo "lchown() NOT found." >&4
15038    val="$undef"
15039fi
15040set d_lchown
15041eval $setvar
15042
15043: See if number of significant digits in a double precision number is known
15044echo " "
15045$cat >ldbl_dig.c <<EOM
15046#$i_limits I_LIMITS
15047#$i_float I_FLOAT
15048#ifdef I_LIMITS
15049#include <limits.h>
15050#endif
15051#ifdef I_FLOAT
15052#include <float.h>
15053#endif
15054#ifdef LDBL_DIG
15055printf("Contains LDBL_DIG");
15056#endif
15057EOM
15058$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15059if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15060	echo "LDBL_DIG found." >&4
15061	val="$define"
15062else
15063	echo "LDBL_DIG NOT found." >&4
15064	val="$undef"
15065fi
15066$rm -f ldbl_dig.?
15067set d_ldbl_dig
15068eval $setvar
15069
15070: see if this is a math.h system
15071set math.h i_math
15072eval $inhdr
15073
15074: check to see if math.h defines _LIB_VERSION
15075d_libm_lib_version="$undef"
15076case $i_math in
15077    $define)
15078	echo " "
15079	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15080	$cat >try.c <<EOCP
15081#include <unistd.h>
15082#include <math.h>
15083int main (int argc, char *argv[])
15084{
15085    printf ("%d\n", _LIB_VERSION);
15086    return (0);
15087    } /* main */
15088EOCP
15089	set try
15090	if eval $compile; then
15091	    foo=`$run ./try`
15092	    echo "Yes, it does ($foo)" >&4
15093	    d_libm_lib_version="$define"
15094	else
15095	    echo "No, it does not (probably harmless)" >&4
15096	    fi
15097	$rm_try
15098	;;
15099
15100    esac
15101
15102: see if link exists
15103set link d_link
15104eval $inlibc
15105
15106: see if localtime_r exists
15107set localtime_r d_localtime_r
15108eval $inlibc
15109case "$d_localtime_r" in
15110"$define")
15111	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15112	case "$d_localtime_r_proto:$usethreads" in
15113	":define")	d_localtime_r_proto=define
15114		set d_localtime_r_proto localtime_r $hdrs
15115		eval $hasproto ;;
15116	*)	;;
15117	esac
15118	case "$d_localtime_r_proto" in
15119	define)
15120	case "$localtime_r_proto" in
15121	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15122	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15123	esac
15124	case "$localtime_r_proto" in
15125	''|0) try='int localtime_r(const time_t*, struct tm*);'
15126	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15127	esac
15128	case "$localtime_r_proto" in
15129	''|0)	d_localtime_r=undef
15130 	        localtime_r_proto=0
15131		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15132	* )	case "$localtime_r_proto" in
15133		REENTRANT_PROTO*) ;;
15134		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15135		esac
15136		echo "Prototype: $try" ;;
15137	esac
15138	;;
15139	*)	case "$usethreads" in
15140		define) echo "localtime_r has no prototype, not using it." >&4 ;;
15141		esac
15142		d_localtime_r=undef
15143		localtime_r_proto=0
15144		;;
15145	esac
15146	;;
15147*)	localtime_r_proto=0
15148	;;
15149esac
15150
15151: see if localtime_r calls tzset
15152case "$localtime_r_proto" in
15153REENTRANT_PROTO*)
15154	$cat >try.c <<EOCP
15155/*  Does our libc's localtime_r call tzset ?
15156 *  return 0 if so, 1 otherwise.
15157 */
15158#$i_systypes	I_SYS_TYPES
15159#$i_unistd	I_UNISTD
15160#$i_time	I_TIME
15161#$i_stdlib	I_STDLIB
15162#$i_string	I_STRING
15163#$i_malloc	I_MALLOC
15164#ifdef I_SYS_TYPES
15165#  include <sys/types.h>
15166#endif
15167#ifdef I_UNISTD
15168#  include <unistd.h>
15169#endif
15170#ifdef I_TIME
15171#  include <time.h>
15172#endif
15173#ifdef I_STDLIB
15174#include <stdlib.h>
15175#endif
15176#ifdef I_STRING
15177#  include <string.h>
15178#else
15179#  include <strings.h>
15180#endif
15181#ifdef I_MALLOC
15182#  include <malloc.h>
15183#endif
15184int main()
15185{
15186    time_t t = time(0L);
15187    char w_tz[]="TZ" "=GMT+5",
15188	 e_tz[]="TZ" "=GMT-5",
15189	*tz_e = (char*)malloc(16),
15190	*tz_w = (char*)malloc(16);
15191    struct tm tm_e, tm_w;
15192    memset(&tm_e,'\0',sizeof(struct tm));
15193    memset(&tm_w,'\0',sizeof(struct tm));
15194    strcpy(tz_e,e_tz);
15195    strcpy(tz_w,w_tz);
15196
15197    putenv(tz_e);
15198    localtime_r(&t, &tm_e);
15199
15200    putenv(tz_w);
15201    localtime_r(&t, &tm_w);
15202
15203    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15204	return 1;
15205    return 0;
15206}
15207EOCP
15208	set try
15209	if eval $compile; then
15210	    if $run ./try; then
15211		d_localtime_r_needs_tzset=undef;
15212	    else
15213		d_localtime_r_needs_tzset=define;
15214	    fi;
15215	else
15216	    d_localtime_r_needs_tzset=undef;
15217	fi;
15218     ;;
15219  *)
15220     d_localtime_r_needs_tzset=undef;
15221     ;;
15222esac
15223$rm_try
15224
15225: see if localeconv exists
15226set localeconv d_locconv
15227eval $inlibc
15228
15229: see if lockf exists
15230set lockf d_lockf
15231eval $inlibc
15232
15233: see if prototype for lseek is available
15234echo " "
15235set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15236eval $hasproto
15237
15238: see if lstat exists
15239set lstat d_lstat
15240eval $inlibc
15241
15242: see if madvise exists
15243set madvise d_madvise
15244eval $inlibc
15245
15246: see if malloc_size exists
15247set malloc_size d_malloc_size
15248eval $inlibc
15249
15250: see if malloc_size_good exists
15251set malloc_good_size d_malloc_good_size
15252eval $inlibc
15253
15254: see if mblen exists
15255set mblen d_mblen
15256eval $inlibc
15257
15258: see if mbstowcs exists
15259set mbstowcs d_mbstowcs
15260eval $inlibc
15261
15262: see if mbtowc exists
15263set mbtowc d_mbtowc
15264eval $inlibc
15265
15266: see if memchr exists
15267set memchr d_memchr
15268eval $inlibc
15269
15270: see if memcmp exists
15271set memcmp d_memcmp
15272eval $inlibc
15273
15274: see if memcpy exists
15275set memcpy d_memcpy
15276eval $inlibc
15277
15278: see if memmove exists
15279set memmove d_memmove
15280eval $inlibc
15281
15282: see if memset exists
15283set memset d_memset
15284eval $inlibc
15285
15286: see if mkdir exists
15287set mkdir d_mkdir
15288eval $inlibc
15289
15290: see if mkdtemp exists
15291set mkdtemp d_mkdtemp
15292eval $inlibc
15293
15294: see if mkfifo exists
15295set mkfifo d_mkfifo
15296eval $inlibc
15297
15298: see if mkstemp exists
15299set mkstemp d_mkstemp
15300eval $inlibc
15301
15302: see if mkstemps exists
15303set mkstemps d_mkstemps
15304eval $inlibc
15305
15306: see if mktime exists
15307set mktime d_mktime
15308eval $inlibc
15309
15310: see if this is a sys/mman.h system
15311set sys/mman.h i_sysmman
15312eval $inhdr
15313
15314: see if mmap exists
15315set mmap d_mmap
15316eval $inlibc
15317: see what shmat returns
15318: default to something harmless
15319mmaptype='void *'
15320case "$i_sysmman$d_mmap" in
15321"$define$define")
15322	$cat >mmap.c <<'END'
15323#include <sys/mman.h>
15324void *mmap();
15325END
15326	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15327		mmaptype='void *'
15328	else
15329		mmaptype='caddr_t'
15330	fi
15331	echo "and it returns ($mmaptype)." >&4
15332	;;
15333esac
15334
15335
15336
15337: see if sqrtl exists
15338set sqrtl d_sqrtl
15339eval $inlibc
15340
15341: see if scalbnl exists
15342set scalbnl d_scalbnl
15343eval $inlibc
15344
15345: see if modfl exists
15346set modfl d_modfl
15347eval $inlibc
15348
15349: see if prototype for modfl is available
15350echo " "
15351set d_modflproto modfl $i_math math.h
15352eval $hasproto
15353
15354d_modfl_pow32_bug="$undef"
15355
15356case "$d_longdbl$d_modfl" in
15357$define$define)
15358	$cat <<EOM
15359Checking to see whether your modfl() is okay for large values...
15360EOM
15361$cat >try.c <<EOCP
15362#include <math.h>
15363#include <stdio.h>
15364EOCP
15365if $test "X$d_modflproto" != "X$define"; then
15366	$cat >>try.c <<EOCP
15367/* Sigh. many current glibcs provide the function, but do not prototype it. */
15368long double modfl (long double, long double *);
15369EOCP
15370fi
15371$cat >>try.c <<EOCP
15372int main() {
15373    long double nv = 4294967303.15;
15374    long double v, w;
15375    v = modfl(nv, &w);
15376#ifdef __GLIBC__
15377    printf("glibc");
15378#endif
15379    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15380    return 0;
15381}
15382EOCP
15383	case "$osname:$gccversion" in
15384	aix:)	saveccflags="$ccflags"
15385		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15386	esac
15387	set try
15388	if eval $compile; then
15389		foo=`$run ./try`
15390		case "$foo" in
15391		*" 4294967303.150000 1.150000 4294967302.000000")
15392			echo >&4 "Your modfl() is broken for large values."
15393			d_modfl_pow32_bug="$define"
15394			case "$foo" in
15395			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15396			;;
15397			esac
15398			;;
15399		*" 4294967303.150000 0.150000 4294967303.000000")
15400			echo >&4 "Your modfl() seems okay for large values."
15401			;;
15402		*)	echo >&4 "I don't understand your modfl() at all."
15403			d_modfl="$undef"
15404			;;
15405		esac
15406		$rm_try
15407	else
15408		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15409		d_modfl="$undef"
15410	fi
15411	case "$osname:$gccversion" in
15412	aix:)	ccflags="$saveccflags" ;; # restore
15413	esac
15414	;;
15415esac
15416
15417if $test "$uselongdouble" = "$define"; then
15418    message=""
15419    if $test "$d_sqrtl" != "$define"; then
15420	message="$message sqrtl"
15421    fi
15422    if $test "$d_modfl" != "$define"; then
15423	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15424	    echo "You have both aintl and copysignl, so I can emulate modfl."
15425	else
15426	    message="$message modfl"
15427	fi
15428    fi
15429    if $test "$d_frexpl" != "$define"; then
15430	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15431	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15432	else
15433	    message="$message frexpl"
15434	fi
15435    fi
15436
15437    if $test "$message" != ""; then
15438	$cat <<EOM >&4
15439
15440*** You requested the use of long doubles but you do not seem to have
15441*** the following mathematical functions needed for long double support:
15442***    $message
15443*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15444*** Cannot continue, aborting.
15445
15446EOM
15447
15448	exit 1
15449    fi
15450fi
15451
15452: see if mprotect exists
15453set mprotect d_mprotect
15454eval $inlibc
15455
15456: see if msgctl exists
15457set msgctl d_msgctl
15458eval $inlibc
15459
15460: see if msgget exists
15461set msgget d_msgget
15462eval $inlibc
15463
15464: see if msgsnd exists
15465set msgsnd d_msgsnd
15466eval $inlibc
15467
15468: see if msgrcv exists
15469set msgrcv d_msgrcv
15470eval $inlibc
15471
15472: see how much of the 'msg*(2)' library is present.
15473h_msg=true
15474echo " "
15475case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15476*"$undef"*) h_msg=false;;
15477esac
15478case "$osname" in
15479freebsd)
15480    case "`ipcs 2>&1`" in
15481    "SVID messages"*"not configured"*)
15482	echo "Your $osname does not have the msg*(2) configured." >&4
15483        h_msg=false
15484	val="$undef"
15485	set msgctl d_msgctl
15486	eval $setvar
15487	set msgget d_msgget
15488	eval $setvar
15489	set msgsnd d_msgsnd
15490	eval $setvar
15491	set msgrcv d_msgrcv
15492	eval $setvar
15493	;;
15494    esac
15495    ;;
15496esac
15497: we could also check for sys/ipc.h ...
15498if $h_msg && $test `./findhdr sys/msg.h`; then
15499	echo "You have the full msg*(2) library." >&4
15500	val="$define"
15501else
15502	echo "You don't have the full msg*(2) library." >&4
15503	val="$undef"
15504fi
15505set d_msg
15506eval $setvar
15507
15508: Check for msghdr_s
15509echo " "
15510echo "Checking to see if your system supports struct msghdr..." >&4
15511set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15512eval $hasstruct
15513case "$d_msghdr_s" in
15514"$define")      echo "Yes, it does."   ;;
15515*)              echo "No, it doesn't." ;;
15516esac
15517
15518
15519: see if msync exists
15520set msync d_msync
15521eval $inlibc
15522
15523: see if munmap exists
15524set munmap d_munmap
15525eval $inlibc
15526
15527: see if nice exists
15528set nice d_nice
15529eval $inlibc
15530
15531: see if this is a langinfo.h system
15532set langinfo.h i_langinfo
15533eval $inhdr
15534
15535: see if nl_langinfo exists
15536set nl_langinfo d_nl_langinfo
15537eval $inlibc
15538
15539: check for volatile keyword
15540echo " "
15541echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15542$cat >try.c <<'EOCP'
15543int main()
15544{
15545	typedef struct _goo_struct goo_struct;
15546	goo_struct * volatile goo = ((goo_struct *)0);
15547	struct _goo_struct {
15548		long long_int;
15549		int reg_int;
15550		char char_var;
15551	};
15552	typedef unsigned short foo_t;
15553	char *volatile foo;
15554	volatile int bar;
15555	volatile foo_t blech;
15556	foo = foo;
15557}
15558EOCP
15559if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15560	val="$define"
15561	echo "Yup, it does."
15562else
15563	val="$undef"
15564	echo "Nope, it doesn't."
15565fi
15566set d_volatile
15567eval $setvar
15568$rm_try
15569
15570: Check basic sizes
15571echo " "
15572$echo "Choosing the C types to be used for Perl's internal types..." >&4
15573
15574case "$use64bitint:$d_quad:$quadtype" in
15575define:define:?*)
15576	ivtype="$quadtype"
15577	uvtype="$uquadtype"
15578	ivsize=8
15579	uvsize=8
15580	;;
15581*)	ivtype="long"
15582	uvtype="unsigned long"
15583	ivsize=$longsize
15584	uvsize=$longsize
15585	;;
15586esac
15587
15588case "$uselongdouble:$d_longdbl" in
15589define:define)
15590	nvtype="long double"
15591	nvsize=$longdblsize
15592	;;
15593*)	nvtype=double
15594	nvsize=$doublesize
15595	;;
15596esac
15597
15598$echo "(IV will be "$ivtype", $ivsize bytes)"
15599$echo "(UV will be "$uvtype", $uvsize bytes)"
15600$echo "(NV will be "$nvtype", $nvsize bytes)"
15601
15602$cat >try.c <<EOCP
15603#$i_inttypes I_INTTYPES
15604#ifdef I_INTTYPES
15605#include <inttypes.h>
15606#endif
15607#include <stdio.h>
15608int main() {
15609#ifdef INT8
15610   int8_t i =  INT8_MAX;
15611  uint8_t u = UINT8_MAX;
15612  printf("int8_t\n");
15613#endif
15614#ifdef INT16
15615   int16_t i =  INT16_MAX;
15616  uint16_t i = UINT16_MAX;
15617  printf("int16_t\n");
15618#endif
15619#ifdef INT32
15620   int32_t i =  INT32_MAX;
15621  uint32_t u = UINT32_MAX;
15622  printf("int32_t\n");
15623#endif
15624}
15625EOCP
15626
15627i8type="signed char"
15628u8type="unsigned char"
15629i8size=1
15630u8size=1
15631
15632case "$i16type" in
15633'')	case "$shortsize" in
15634	2)	i16type=short
15635		u16type="unsigned short"
15636		i16size=$shortsize
15637		u16size=$shortsize
15638		;;
15639	esac
15640	;;
15641esac
15642case "$i16type" in
15643'')	set try -DINT16
15644	if eval $compile; then
15645		case "`$run ./try`" in
15646		int16_t)
15647			i16type=int16_t
15648			u16type=uint16_t
15649			i16size=2
15650			u16size=2
15651			;;
15652		esac
15653	fi
15654	;;
15655esac
15656case "$i16type" in
15657'')	if $test $shortsize -ge 2; then
15658		i16type=short
15659		u16type="unsigned short"
15660		i16size=$shortsize
15661		u16size=$shortsize
15662	fi
15663	;;
15664esac
15665
15666case "$i32type" in
15667'')	case "$longsize" in
15668	4)	i32type=long
15669		u32type="unsigned long"
15670		i32size=$longsize
15671		u32size=$longsize
15672		;;
15673	*)	case "$intsize" in
15674		4)	i32type=int
15675			u32type="unsigned int"
15676			i32size=$intsize
15677			u32size=$intsize
15678			;;
15679		esac
15680		;;
15681	esac
15682	;;
15683esac
15684case "$i32type" in
15685'')	set try -DINT32
15686	if eval $compile; then
15687		case "`$run ./try`" in
15688		int32_t)
15689			i32type=int32_t
15690			u32type=uint32_t
15691			i32size=4
15692			u32size=4
15693			;;
15694		esac
15695	fi
15696	;;
15697esac
15698case "$i32type" in
15699'')	if $test $intsize -ge 4; then
15700		i32type=int
15701		u32type="unsigned int"
15702		i32size=$intsize
15703		u32size=$intsize
15704	fi
15705	;;
15706esac
15707
15708case "$i64type" in
15709'')	case "$d_quad:$quadtype" in
15710	define:?*)
15711		i64type="$quadtype"
15712		u64type="$uquadtype"
15713		i64size=8
15714		u64size=8
15715		;;
15716	esac
15717	;;
15718esac
15719
15720$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15721: volatile so that the compiler has to store it out to memory.
15722if test X"$d_volatile" = X"$define"; then
15723	volatile=volatile
15724fi
15725$cat <<EOP >try.c
15726#include <stdio.h>
15727#$i_stdlib I_STDLIB
15728#ifdef I_STDLIB
15729#include <stdlib.h>
15730#endif
15731#include <sys/types.h>
15732#include <signal.h>
15733#ifdef SIGFPE
15734$volatile int bletched = 0;
15735$signal_t blech(int s) { bletched = 1; }
15736#endif
15737int main() {
15738    $uvtype u = 0;
15739    $nvtype d;
15740    int     n = 8 * $uvsize;
15741    int     i;
15742#ifdef SIGFPE
15743    signal(SIGFPE, blech);
15744#endif
15745
15746    for (i = 0; i < n; i++) {
15747      u = u << 1 | ($uvtype)1;
15748      d = ($nvtype)u;
15749      if (($uvtype)d != u)
15750        break;
15751      if (d <= 0)
15752	break;
15753      d = ($nvtype)(u - 1);
15754      if (($uvtype)d != (u - 1))
15755        break;
15756#ifdef SIGFPE
15757      if (bletched)
15758	break;
15759#endif
15760    }
15761    printf("%d\n", ((i == n) ? -n : i));
15762    exit(0);
15763}
15764EOP
15765set try
15766
15767d_nv_preserves_uv="$undef"
15768if eval $compile; then
15769	nv_preserves_uv_bits="`$run ./try`"
15770fi
15771case "$nv_preserves_uv_bits" in
15772\-[1-9]*)
15773	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15774	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15775	d_nv_preserves_uv="$define"
15776	;;
15777[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15778	d_nv_preserves_uv="$undef" ;;
15779*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
15780	nv_preserves_uv_bits="0" ;;
15781esac
15782$rm_try
15783
15784$echo "Checking to find the largest integer value your NVs can hold..." >&4
15785: volatile so that the compiler has to store it out to memory.
15786if test X"$d_volatile" = X"$define"; then
15787	volatile=volatile
15788fi
15789$cat <<EOP >try.c
15790#include <stdio.h>
15791
15792typedef $nvtype NV;
15793
15794int
15795main() {
15796  NV value = 2;
15797  int count = 1;
15798
15799  while(count < 256) {
15800    $volatile NV up = value + 1.0;
15801    $volatile NV negated = -value;
15802    $volatile NV down = negated - 1.0;
15803    $volatile NV got_up = up - value;
15804    int up_good = got_up == 1.0;
15805    int got_down = down - negated;
15806    int down_good = got_down == -1.0;
15807
15808    if (down_good != up_good) {
15809      fprintf(stderr,
15810	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15811	      up_good, (double) got_up, down_good, (double) got_down,
15812	      count, (double) value);
15813      return 1;
15814    }
15815    if (!up_good) {
15816      while (1) {
15817	if (count > 8) {
15818	  count -= 8;
15819	  fputs("256.0", stdout);
15820	} else {
15821	  count--;
15822	  fputs("2.0", stdout);
15823	}
15824	if (!count) {
15825	  puts("");
15826	  return 0;
15827	}
15828	fputs("*", stdout);
15829      }
15830    }
15831    value *= 2;
15832    ++count;
15833  }
15834  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15835	  count, (double) value);
15836  return 1;
15837}
15838EOP
15839set try
15840
15841nv_overflows_integers_at='0'
15842if eval $compile; then
15843    xxx="`$run ./try`"
15844    case "$?" in
15845	0)
15846	    case "$xxx" in
15847		2*)  cat >&4 <<EOM
15848The largest integer your NVs can preserve is equal to $xxx
15849EOM
15850		    nv_overflows_integers_at="$xxx"
15851		    ;;
15852		*)  cat >&4 <<EOM
15853Cannot determine the largest integer value your NVs can hold, unexpected output
15854'$xxx'
15855EOM
15856		    ;;
15857	    esac
15858	    ;;
15859	*)  cat >&4 <<EOM
15860Cannot determine the largest integer value your NVs can hold
15861EOM
15862	    ;;
15863    esac
15864fi
15865$rm_try
15866
15867$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15868: volatile so that the compiler has to store it out to memory.
15869if test X"$d_volatile" = X"$define"; then
15870	volatile=volatile
15871fi
15872$cat <<EOP >try.c
15873#include <stdio.h>
15874#$i_stdlib I_STDLIB
15875#ifdef I_STDLIB
15876#include <stdlib.h>
15877#endif
15878#$i_string I_STRING
15879#ifdef I_STRING
15880#  include <string.h>
15881#else
15882#  include <strings.h>
15883#endif
15884#include <sys/types.h>
15885#include <signal.h>
15886#ifdef SIGFPE
15887$volatile int bletched = 0;
15888$signal_t blech(int s) { bletched = 1; }
15889#endif
15890
15891int checkit($nvtype d, char *where) {
15892    unsigned char *p = (char *)&d;
15893    unsigned char *end = p + sizeof(d);
15894    int fail = 0;
15895
15896    while (p < end)
15897	fail += *p++;
15898
15899    if (!fail)
15900	return 0;
15901
15902    p = (char *)&d;
15903    printf("No - %s: 0x", where);
15904    while (p < end)
15905	printf ("%02X", *p++);
15906    printf("\n");
15907    return 1;
15908}
15909
15910int main(int argc, char **argv) {
15911    $nvtype d = 0.0;
15912    int fail = 0;
15913    fail += checkit(d, "0.0");
15914
15915    /* The compiler shouldn't be assuming that bletched is 0  */
15916    d = bletched;
15917
15918    fail += checkit(d, "bleched");
15919
15920#ifdef SIGFPE
15921    signal(SIGFPE, blech);
15922#endif
15923
15924    /* Paranoia - the compiler should have no way of knowing that ANSI says
15925       that argv[argc] will always be NULL.  Actually, if it did assume this it
15926       would be buggy, as this is C and main() can be called from elsewhere in
15927       the program.  */
15928    d = argv[argc] ? 1 : 0;
15929
15930    if (d) {
15931	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15932    }
15933
15934    fail += checkit(d, "ternary");
15935
15936    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15937
15938    if (d != 0.0) {
15939	printf("No - memset doesn't give 0.0\n");
15940	/* This might just blow up:  */
15941	printf("(gives %g)\n", d);
15942	return 1;
15943    }
15944
15945#ifdef SIGFPE
15946    if (bletched) {
15947	printf("No - something bleched\n");
15948	return 1;
15949    }
15950#endif
15951    if (fail) {
15952      printf("No - %d fail(s)\n", fail);
15953      return 1;
15954    }
15955    printf("Yes\n");
15956    return 0;
15957}
15958EOP
15959set try
15960
15961d_nv_zero_is_allbits_zero="$undef"
15962if eval $compile; then
15963    xxx="`$run ./try`"
15964    case "$?" in
15965	0)
15966	    case "$xxx" in
15967		Yes)  cat >&4 <<EOM
159680.0 is represented as all bits zero in memory
15969EOM
15970		    d_nv_zero_is_allbits_zero="$define"
15971		    ;;
15972		*)  cat >&4 <<EOM
159730.0 is not represented as all bits zero in memory
15974EOM
15975		    d_nv_zero_is_allbits_zero="$undef"
15976		    ;;
15977	    esac
15978	    ;;
15979	*)  cat >&4 <<EOM
159800.0 is not represented as all bits zero in memory
15981EOM
15982	    d_nv_zero_is_allbits_zero="$undef"
15983	    ;;
15984    esac
15985fi
15986$rm_try
15987
15988: check for off64_t
15989echo " "
15990echo "Checking to see if you have off64_t..." >&4
15991$cat >try.c <<EOCP
15992#include <sys/types.h>
15993#include <unistd.h>
15994int main() { off64_t x = 7; }
15995EOCP
15996set try
15997if eval $compile; then
15998	val="$define"
15999	echo "You have off64_t."
16000else
16001	val="$undef"
16002	echo "You do not have off64_t."
16003	case "$lseeksize" in
16004	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16005	esac
16006fi
16007$rm_try
16008set d_off64_t
16009eval $setvar
16010
16011: how to create joinable pthreads
16012if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16013	echo " "
16014	echo "Checking what constant to use for creating joinable pthreads..." >&4
16015	$cat >try.c <<'EOCP'
16016#include <pthread.h>
16017int main() {
16018    int detachstate = JOINABLE;
16019}
16020EOCP
16021	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16022	if eval $compile; then
16023		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16024		val="$undef" # Yes, undef.
16025		set d_old_pthread_create_joinable
16026		eval $setvar
16027		val=""
16028		set old_pthread_create_joinable
16029		eval $setvar
16030	else
16031		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16032		if eval $compile; then
16033			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16034			val="$define"
16035			set d_old_pthread_create_joinable
16036			eval $setvar
16037			val=PTHREAD_CREATE_UNDETACHED
16038			set old_pthread_create_joinable
16039			eval $setvar
16040		else
16041			set try -DJOINABLE=__UNDETACHED
16042			if eval $compile; then
16043				echo "You seem to use __UNDETACHED." >&4
16044				val="$define"
16045				set d_old_pthread_create_joinable
16046				eval $setvar
16047				val=__UNDETACHED
16048				set old_pthread_create_joinable
16049				eval $setvar
16050			else
16051				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16052				val="$define"
16053				set d_old_pthread_create_joinable
16054				eval $setvar
16055				val=0
16056				set old_pthread_create_joinable
16057				eval $setvar
16058			fi
16059		fi
16060	fi
16061	$rm_try
16062else
16063    d_old_pthread_create_joinable="$undef"
16064    old_pthread_create_joinable=""
16065fi
16066
16067: see if pause exists
16068set pause d_pause
16069eval $inlibc
16070
16071: see if poll exists
16072set poll d_poll
16073eval $inlibc
16074
16075: see if readlink exists
16076set readlink d_readlink
16077eval $inlibc
16078
16079: Check if exe is symlink to abs path of executing program
16080echo " "
16081procselfexe=''
16082val="$undef"
16083case "$d_readlink" in
16084"$define")
16085	if $issymlink /proc/self/exe ; then
16086		$ls -l /proc/self/exe > reflect
16087		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16088			echo "You have Linux-like /proc/self/exe."
16089			procselfexe='"/proc/self/exe"'
16090			val="$define"
16091		fi
16092	fi
16093	if $issymlink /proc/curproc/file ; then
16094		$ls -l /proc/curproc/file > reflect
16095		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16096			echo "You have BSD-like /proc/curproc/file."
16097			procselfexe='"/proc/curproc/file"'
16098			val="$define"
16099		fi
16100	fi
16101	;;
16102esac
16103$rm -f reflect
16104set d_procselfexe
16105eval $setvar
16106
16107: backward compatibility for d_hvfork
16108if test X$d_hvfork != X; then
16109	d_vfork="$d_hvfork"
16110	d_hvfork=''
16111fi
16112: see if there is a vfork
16113val=''
16114set vfork val
16115eval $inlibc
16116
16117d_pseudofork=$undef
16118
16119: Ok, but do we want to use it. vfork is reportedly unreliable in
16120: perl on Solaris 2.x, and probably elsewhere.
16121case "$val" in
16122$define)
16123	echo " "
16124	case "$usevfork" in
16125	false) dflt='n';;
16126	*) dflt='y';;
16127	esac
16128	cat <<'EOM'
16129
16130Perl can only use a vfork() that doesn't suffer from strict
16131restrictions on calling functions or modifying global data in
16132the child.  For example, glibc-2.1 contains such a vfork()
16133that is unsuitable.  If your system provides a proper fork()
16134call, chances are that you do NOT want perl to use vfork().
16135
16136EOM
16137	rp="Do you still want to use vfork()?"
16138	. ./myread
16139	case "$ans" in
16140	y|Y) ;;
16141	*)
16142		echo "Ok, we won't use vfork()."
16143		val="$undef"
16144		;;
16145	esac
16146	;;
16147esac
16148set d_vfork
16149eval $setvar
16150case "$d_vfork" in
16151$define) usevfork='true';;
16152*) usevfork='false';;
16153esac
16154
16155: see whether the pthread_atfork exists
16156$cat >try.c <<EOP
16157#include <pthread.h>
16158#include <stdio.h>
16159int main() {
16160#ifdef  PTHREAD_ATFORK
16161        pthread_atfork(NULL,NULL,NULL);
16162#endif
16163}
16164EOP
16165
16166: see if pthread_atfork exists
16167set try -DPTHREAD_ATFORK
16168if eval $compile; then
16169    val="$define"
16170else
16171    val="$undef"
16172fi
16173case "$usethreads" in
16174$define)
16175        case "$val" in
16176        $define) echo 'pthread_atfork found.' >&4        ;;
16177        *)       echo 'pthread_atfork NOT found.' >&4    ;;
16178        esac
16179esac
16180set d_pthread_atfork
16181eval $setvar
16182
16183: see if pthread_attr_setscope exists
16184set pthread_attr_setscope d_pthread_attr_setscope
16185eval $inlibc
16186
16187: see whether the various POSIXish _yields exist
16188$cat >try.c <<EOP
16189#include <pthread.h>
16190#include <stdio.h>
16191int main() {
16192#ifdef SCHED_YIELD
16193	sched_yield();
16194#else
16195#ifdef PTHREAD_YIELD
16196	pthread_yield();
16197#else
16198#ifdef PTHREAD_YIELD_NULL
16199	pthread_yield(NULL);
16200#endif
16201#endif
16202#endif
16203}
16204EOP
16205: see if sched_yield exists
16206set try -DSCHED_YIELD
16207if eval $compile; then
16208    val="$define"
16209    sched_yield='sched_yield()'
16210else
16211    val="$undef"
16212fi
16213case "$usethreads" in
16214$define)
16215	case "$val" in
16216	$define) echo 'sched_yield() found.' >&4	;;
16217	*)	 echo 'sched_yield() NOT found.' >&4	;;
16218	esac
16219esac
16220set d_sched_yield
16221eval $setvar
16222
16223: see if pthread_yield exists
16224set try -DPTHREAD_YIELD
16225if eval $compile; then
16226    val="$define"
16227    case "$sched_yield" in
16228    '') sched_yield='pthread_yield()' ;;
16229    esac
16230else
16231    set try -DPTHREAD_YIELD_NULL
16232    if eval $compile; then
16233	val="$define"
16234	case "$sched_yield" in
16235	'') sched_yield='pthread_yield(NULL)' ;;
16236	esac
16237    else
16238	val="$undef"
16239    fi
16240fi
16241case "$usethreads" in
16242$define)
16243	case "$val" in
16244	$define) echo 'pthread_yield() found.' >&4	;;
16245	*)	 echo 'pthread_yield() NOT found.' >&4	;;
16246	esac
16247	;;
16248esac
16249set d_pthread_yield
16250eval $setvar
16251case "$sched_yield" in
16252'') sched_yield=undef ;;
16253esac
16254$rm_try
16255
16256: see if random_r exists
16257set random_r d_random_r
16258eval $inlibc
16259case "$d_random_r" in
16260"$define")
16261	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16262	case "$d_random_r_proto:$usethreads" in
16263	":define")	d_random_r_proto=define
16264		set d_random_r_proto random_r $hdrs
16265		eval $hasproto ;;
16266	*)	;;
16267	esac
16268	case "$d_random_r_proto" in
16269	define)
16270	case "$random_r_proto" in
16271	''|0) try='int random_r(int*, struct random_data*);'
16272	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16273	esac
16274	case "$random_r_proto" in
16275	''|0) try='int random_r(long*, struct random_data*);'
16276	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16277	esac
16278	case "$random_r_proto" in
16279	''|0) try='int random_r(struct random_data*, int32_t*);'
16280	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16281	esac
16282	case "$random_r_proto" in
16283	''|0)	d_random_r=undef
16284 	        random_r_proto=0
16285		echo "Disabling random_r, cannot determine prototype." >&4 ;;
16286	* )	case "$random_r_proto" in
16287		REENTRANT_PROTO*) ;;
16288		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16289		esac
16290		echo "Prototype: $try" ;;
16291	esac
16292	;;
16293	*)	case "$usethreads" in
16294		define) echo "random_r has no prototype, not using it." >&4 ;;
16295		esac
16296		d_random_r=undef
16297		random_r_proto=0
16298		;;
16299	esac
16300	;;
16301*)	random_r_proto=0
16302	;;
16303esac
16304
16305: see if readdir and friends exist
16306set readdir d_readdir
16307eval $inlibc
16308set seekdir d_seekdir
16309eval $inlibc
16310set telldir d_telldir
16311eval $inlibc
16312set rewinddir d_rewinddir
16313eval $inlibc
16314
16315: see if readdir64_r exists
16316set readdir64_r d_readdir64_r
16317eval $inlibc
16318case "$d_readdir64_r" in
16319"$define")
16320	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16321	case "$d_readdir64_r_proto:$usethreads" in
16322	":define")	d_readdir64_r_proto=define
16323		set d_readdir64_r_proto readdir64_r $hdrs
16324		eval $hasproto ;;
16325	*)	;;
16326	esac
16327	case "$d_readdir64_r_proto" in
16328	define)
16329	case "$readdir64_r_proto" in
16330	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16331	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16332	esac
16333	case "$readdir64_r_proto" in
16334	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16335	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16336	esac
16337	case "$readdir64_r_proto" in
16338	''|0)	d_readdir64_r=undef
16339 	        readdir64_r_proto=0
16340		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16341	* )	case "$readdir64_r_proto" in
16342		REENTRANT_PROTO*) ;;
16343		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16344		esac
16345		echo "Prototype: $try" ;;
16346	esac
16347	;;
16348	*)	case "$usethreads" in
16349		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16350		esac
16351		d_readdir64_r=undef
16352		readdir64_r_proto=0
16353		;;
16354	esac
16355	;;
16356*)	readdir64_r_proto=0
16357	;;
16358esac
16359
16360: see if readdir_r exists
16361set readdir_r d_readdir_r
16362eval $inlibc
16363case "$d_readdir_r" in
16364"$define")
16365	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16366	case "$d_readdir_r_proto:$usethreads" in
16367	":define")	d_readdir_r_proto=define
16368		set d_readdir_r_proto readdir_r $hdrs
16369		eval $hasproto ;;
16370	*)	;;
16371	esac
16372	case "$d_readdir_r_proto" in
16373	define)
16374	case "$readdir_r_proto" in
16375	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16376	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16377	esac
16378	case "$readdir_r_proto" in
16379	''|0) try='int readdir_r(DIR*, struct dirent*);'
16380	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16381	esac
16382	case "$readdir_r_proto" in
16383	''|0)	d_readdir_r=undef
16384 	        readdir_r_proto=0
16385		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16386	* )	case "$readdir_r_proto" in
16387		REENTRANT_PROTO*) ;;
16388		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16389		esac
16390		echo "Prototype: $try" ;;
16391	esac
16392	;;
16393	*)	case "$usethreads" in
16394		define) echo "readdir_r has no prototype, not using it." >&4 ;;
16395		esac
16396		d_readdir_r=undef
16397		readdir_r_proto=0
16398		;;
16399	esac
16400	;;
16401*)	readdir_r_proto=0
16402	;;
16403esac
16404
16405: see if readv exists
16406set readv d_readv
16407eval $inlibc
16408
16409: see if recvmsg exists
16410set recvmsg d_recvmsg
16411eval $inlibc
16412
16413: see if rename exists
16414set rename d_rename
16415eval $inlibc
16416
16417: see if rmdir exists
16418set rmdir d_rmdir
16419eval $inlibc
16420
16421: see if memory.h is available.
16422val=''
16423set memory.h val
16424eval $inhdr
16425
16426: See if it conflicts with string.h
16427case "$val" in
16428$define)
16429	case "$strings" in
16430	'') ;;
16431	*)
16432		$cppstdin $cppflags $cppminus < $strings > mem.h
16433		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16434			echo " "
16435			echo "We won't be including <memory.h>."
16436			val="$undef"
16437		fi
16438		$rm -f mem.h
16439		;;
16440	esac
16441esac
16442set i_memory
16443eval $setvar
16444
16445: can bcopy handle overlapping blocks?
16446echo " "
16447val="$undef"
16448case "$d_memmove" in
16449"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16450*)	case "$d_bcopy" in
16451	"$define")
16452		echo "Checking to see if bcopy() can do overlapping copies..." >&4
16453		$cat >try.c <<EOCP
16454#$i_memory I_MEMORY
16455#$i_stdlib I_STDLIB
16456#$i_string I_STRING
16457#$i_unistd I_UNISTD
16458EOCP
16459	$cat >>try.c <<'EOCP'
16460#include <stdio.h>
16461#ifdef I_MEMORY
16462#  include <memory.h>
16463#endif
16464#ifdef I_STDLIB
16465#  include <stdlib.h>
16466#endif
16467#ifdef I_STRING
16468#  include <string.h>
16469#else
16470#  include <strings.h>
16471#endif
16472#ifdef I_UNISTD
16473#  include <unistd.h>  /* Needed for NetBSD */
16474#endif
16475int main()
16476{
16477char buf[128], abc[128];
16478char *b;
16479int len;
16480int off;
16481int align;
16482
16483/* Copy "abcde..." string to char abc[] so that gcc doesn't
16484   try to store the string in read-only memory. */
16485bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16486
16487for (align = 7; align >= 0; align--) {
16488	for (len = 36; len; len--) {
16489		b = buf+align;
16490		bcopy(abc, b, len);
16491		for (off = 1; off <= len; off++) {
16492			bcopy(b, b+off, len);
16493			bcopy(b+off, b, len);
16494			if (bcmp(b, abc, len))
16495				exit(1);
16496		}
16497	}
16498}
16499exit(0);
16500}
16501EOCP
16502		set try
16503		if eval $compile_ok; then
16504			if $run ./try 2>/dev/null; then
16505				echo "Yes, it can."
16506				val="$define"
16507			else
16508				echo "It can't, sorry."
16509			fi
16510		else
16511			echo "(I can't compile the test program, so we'll assume not...)"
16512		fi
16513		;;
16514	esac
16515	$rm_try
16516	;;
16517esac
16518set d_safebcpy
16519eval $setvar
16520
16521: can memcpy handle overlapping blocks?
16522echo " "
16523val="$undef"
16524case "$d_memmove" in
16525"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16526*)	case "$d_memcpy" in
16527	"$define")
16528		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16529		$cat >try.c <<EOCP
16530#$i_memory I_MEMORY
16531#$i_stdlib I_STDLIB
16532#$i_string I_STRING
16533#$i_unistd I_UNISTD
16534EOCP
16535	$cat >>try.c <<'EOCP'
16536#include <stdio.h>
16537#ifdef I_MEMORY
16538#  include <memory.h>
16539#endif
16540#ifdef I_STDLIB
16541#  include <stdlib.h>
16542#endif
16543#ifdef I_STRING
16544#  include <string.h>
16545#else
16546#  include <strings.h>
16547#endif
16548#ifdef I_UNISTD
16549#  include <unistd.h>  /* Needed for NetBSD */
16550#endif
16551int main()
16552{
16553char buf[128], abc[128];
16554char *b;
16555int len;
16556int off;
16557int align;
16558
16559/* Copy "abcde..." string to char abc[] so that gcc doesn't
16560   try to store the string in read-only memory. */
16561memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16562
16563for (align = 7; align >= 0; align--) {
16564	for (len = 36; len; len--) {
16565		b = buf+align;
16566		memcpy(b, abc, len);
16567		for (off = 1; off <= len; off++) {
16568			memcpy(b+off, b, len);
16569			memcpy(b, b+off, len);
16570			if (memcmp(b, abc, len))
16571				exit(1);
16572		}
16573	}
16574}
16575exit(0);
16576}
16577EOCP
16578		set try
16579		if eval $compile_ok; then
16580			if $run ./try 2>/dev/null; then
16581				echo "Yes, it can."
16582				val="$define"
16583			else
16584				echo "It can't, sorry."
16585			fi
16586		else
16587			echo "(I can't compile the test program, so we'll assume not...)"
16588		fi
16589		;;
16590	esac
16591	$rm_try
16592	;;
16593esac
16594set d_safemcpy
16595eval $setvar
16596
16597: can memcmp be trusted to compare relative magnitude?
16598val="$undef"
16599case "$d_memcmp" in
16600"$define")
16601	echo " "
16602	echo "Checking if your memcmp() can compare relative magnitude..." >&4
16603	$cat >try.c <<EOCP
16604#$i_memory I_MEMORY
16605#$i_stdlib I_STDLIB
16606#$i_string I_STRING
16607#$i_unistd I_UNISTD
16608EOCP
16609	$cat >>try.c <<'EOCP'
16610#include <stdio.h>
16611#ifdef I_MEMORY
16612#  include <memory.h>
16613#endif
16614#ifdef I_STDLIB
16615#  include <stdlib.h>
16616#endif
16617#ifdef I_STRING
16618#  include <string.h>
16619#else
16620#  include <strings.h>
16621#endif
16622#ifdef I_UNISTD
16623#  include <unistd.h>  /* Needed for NetBSD */
16624#endif
16625int main()
16626{
16627char a = -1;
16628char b = 0;
16629if ((a < b) && memcmp(&a, &b, 1) < 0)
16630	exit(1);
16631exit(0);
16632}
16633EOCP
16634	set try
16635	if eval $compile_ok; then
16636		if $run ./try 2>/dev/null; then
16637			echo "Yes, it can."
16638			val="$define"
16639		else
16640			echo "No, it can't (it uses signed chars)."
16641		fi
16642	else
16643		echo "(I can't compile the test program, so we'll assume not...)"
16644	fi
16645	;;
16646esac
16647$rm_try
16648set d_sanemcmp
16649eval $setvar
16650
16651: see if prototype for sbrk is available
16652echo " "
16653set d_sbrkproto sbrk $i_unistd unistd.h
16654eval $hasproto
16655
16656: see if select exists
16657set select d_select
16658eval $inlibc
16659
16660: see if semctl exists
16661set semctl d_semctl
16662eval $inlibc
16663
16664: see if semget exists
16665set semget d_semget
16666eval $inlibc
16667
16668: see if semop exists
16669set semop d_semop
16670eval $inlibc
16671
16672: see how much of the 'sem*(2)' library is present.
16673h_sem=true
16674echo " "
16675case "$d_semctl$d_semget$d_semop" in
16676*"$undef"*) h_sem=false;;
16677esac
16678case "$osname" in
16679freebsd)
16680    case "`ipcs 2>&1`" in
16681    "SVID messages"*"not configured"*)
16682	echo "Your $osname does not have the sem*(2) configured." >&4
16683        h_sem=false
16684	val="$undef"
16685	set semctl d_semctl
16686	eval $setvar
16687	set semget d_semget
16688	eval $setvar
16689	set semop d_semop
16690	eval $setvar
16691	;;
16692    esac
16693    ;;
16694esac
16695: we could also check for sys/ipc.h ...
16696if $h_sem && $test `./findhdr sys/sem.h`; then
16697	echo "You have the full sem*(2) library." >&4
16698	val="$define"
16699else
16700	echo "You don't have the full sem*(2) library." >&4
16701	val="$undef"
16702fi
16703set d_sem
16704eval $setvar
16705
16706: see whether sys/sem.h defines union semun
16707echo " "
16708$cat > try.c <<'END'
16709#include <sys/types.h>
16710#include <sys/ipc.h>
16711#include <sys/sem.h>
16712int main () { union semun semun; semun.buf = 0; }
16713END
16714set try
16715if eval $compile; then
16716    echo "You have union semun in <sys/sem.h>." >&4
16717    val="$define"
16718else
16719    echo "You do not have union semun in <sys/sem.h>." >&4
16720    val="$undef"
16721fi
16722$rm_try
16723set d_union_semun
16724eval $setvar
16725
16726: see how to do semctl IPC_STAT
16727case "$d_sem" in
16728$define)
16729    echo " "
16730    $cat > tryh.h <<END
16731#ifndef S_IRUSR
16732#   ifdef S_IREAD
16733#	define S_IRUSR S_IREAD
16734#	define S_IWUSR S_IWRITE
16735#	define S_IXUSR S_IEXEC
16736#   else
16737#	define S_IRUSR 0400
16738#	define S_IWUSR 0200
16739#	define S_IXUSR 0100
16740#   endif
16741#   define S_IRGRP (S_IRUSR>>3)
16742#   define S_IWGRP (S_IWUSR>>3)
16743#   define S_IXGRP (S_IXUSR>>3)
16744#   define S_IROTH (S_IRUSR>>6)
16745#   define S_IWOTH (S_IWUSR>>6)
16746#   define S_IXOTH (S_IXUSR>>6)
16747#endif
16748#ifndef S_IRWXU
16749#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16750#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16751#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16752#endif
16753END
16754    : see whether semctl IPC_STAT can use union semun
16755    case "$d_semctl_semun" in
16756    '')
16757      val="$undef"
16758      $cat > try.c <<END
16759#include <sys/types.h>
16760#include <sys/ipc.h>
16761#include <sys/sem.h>
16762#include <sys/stat.h>
16763#include <stdio.h>
16764#include <errno.h>
16765#include "tryh.h"
16766#ifndef errno
16767extern int errno;
16768#endif
16769#$d_union_semun HAS_UNION_SEMUN
16770int main() {
16771    union semun
16772#ifndef HAS_UNION_SEMUN
16773    {
16774	int val;
16775	struct semid_ds *buf;
16776	unsigned short *array;
16777    }
16778#endif
16779    arg;
16780    int sem, st;
16781
16782#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16783    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16784    if (sem > -1) {
16785	struct semid_ds argbuf;
16786	arg.buf = &argbuf;
16787#	ifdef IPC_STAT
16788	st = semctl(sem, 0, IPC_STAT, arg);
16789	if (st == 0)
16790	    printf("semun\n");
16791	else
16792#	endif /* IPC_STAT */
16793	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16794#	ifdef IPC_RMID
16795	if (semctl(sem, 0, IPC_RMID, arg) != 0)
16796#	endif /* IPC_RMID */
16797	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16798    } else
16799#endif /* IPC_PRIVATE && ... */
16800	printf("semget failed: errno = %d\n", errno);
16801  return 0;
16802}
16803END
16804      set try
16805      if eval $compile; then
16806	  xxx=`$run ./try`
16807          case "$xxx" in
16808          semun) val="$define" ;;
16809          esac
16810      fi
16811      $rm_try
16812      set d_semctl_semun
16813      eval $setvar
16814      ;;
16815    esac
16816    case "$d_semctl_semun" in
16817    $define)
16818        echo "You can use union semun for semctl IPC_STAT." >&4
16819	also='also'
16820        ;;
16821    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16822	also=''
16823        ;;
16824    esac
16825
16826    : see whether semctl IPC_STAT can use struct semid_ds pointer
16827    case "$d_semctl_semid_ds" in
16828    '')
16829      val="$undef"
16830      $cat > try.c <<'END'
16831#include <sys/types.h>
16832#include <sys/ipc.h>
16833#include <sys/sem.h>
16834#include <sys/stat.h>
16835#include "tryh.h"
16836#include <stdio.h>
16837#include <errno.h>
16838#ifndef errno
16839extern int errno;
16840#endif
16841int main() {
16842    struct semid_ds arg;
16843    int sem, st;
16844
16845#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16846    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16847    if (sem > -1) {
16848#	ifdef IPC_STAT
16849	st = semctl(sem, 0, IPC_STAT, &arg);
16850	if (st == 0)
16851	    printf("semid_ds\n");
16852	else
16853#	endif /* IPC_STAT */
16854	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16855#	ifdef IPC_RMID
16856	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16857#	endif /* IPC_RMID */
16858	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16859    } else
16860#endif /* IPC_PRIVATE && ... */
16861	printf("semget failed: errno = %d\n", errno);
16862
16863    return 0;
16864}
16865END
16866      set try
16867      if eval $compile; then
16868          xxx=`$run ./try`
16869          case "$xxx" in
16870          semid_ds) val="$define" ;;
16871          esac
16872      fi
16873      $rm_try
16874      set d_semctl_semid_ds
16875      eval $setvar
16876      ;;
16877    esac
16878    case "$d_semctl_semid_ds" in
16879    $define)
16880        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16881        ;;
16882    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16883        ;;
16884    esac
16885    ;;
16886*)  val="$undef"
16887
16888    # We do not have the full sem*(2) library, so assume we can not
16889    # use either.
16890
16891    set d_semctl_semun
16892    eval $setvar
16893
16894    set d_semctl_semid_ds
16895    eval $setvar
16896    ;;
16897esac
16898$rm_try tryh.h
16899
16900: see if sendmsg exists
16901set sendmsg d_sendmsg
16902eval $inlibc
16903
16904: see if setegid exists
16905set setegid d_setegid
16906eval $inlibc
16907
16908: see if seteuid exists
16909set seteuid d_seteuid
16910eval $inlibc
16911
16912: see if setgrent exists
16913set setgrent d_setgrent
16914eval $inlibc
16915
16916: see if setgrent_r exists
16917set setgrent_r d_setgrent_r
16918eval $inlibc
16919case "$d_setgrent_r" in
16920"$define")
16921	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16922	case "$d_setgrent_r_proto:$usethreads" in
16923	":define")	d_setgrent_r_proto=define
16924		set d_setgrent_r_proto setgrent_r $hdrs
16925		eval $hasproto ;;
16926	*)	;;
16927	esac
16928	case "$d_setgrent_r_proto" in
16929	define)
16930	case "$setgrent_r_proto" in
16931	''|0) try='int setgrent_r(FILE**);'
16932	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16933	esac
16934	case "$setgrent_r_proto" in
16935	''|0) try='void setgrent_r(FILE**);'
16936	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16937	esac
16938	case "$setgrent_r_proto" in
16939	''|0)	d_setgrent_r=undef
16940 	        setgrent_r_proto=0
16941		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16942	* )	case "$setgrent_r_proto" in
16943		REENTRANT_PROTO*) ;;
16944		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16945		esac
16946		echo "Prototype: $try" ;;
16947	esac
16948	;;
16949	*)	case "$usethreads" in
16950		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16951		esac
16952		d_setgrent_r=undef
16953		setgrent_r_proto=0
16954		;;
16955	esac
16956	;;
16957*)	setgrent_r_proto=0
16958	;;
16959esac
16960
16961: see if sethostent exists
16962set sethostent d_sethent
16963eval $inlibc
16964
16965: see if sethostent_r exists
16966set sethostent_r d_sethostent_r
16967eval $inlibc
16968case "$d_sethostent_r" in
16969"$define")
16970	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16971	case "$d_sethostent_r_proto:$usethreads" in
16972	":define")	d_sethostent_r_proto=define
16973		set d_sethostent_r_proto sethostent_r $hdrs
16974		eval $hasproto ;;
16975	*)	;;
16976	esac
16977	case "$d_sethostent_r_proto" in
16978	define)
16979	case "$sethostent_r_proto" in
16980	''|0) try='int sethostent_r(int, struct hostent_data*);'
16981	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16982	esac
16983	case "$sethostent_r_proto" in
16984	''|0) try='void sethostent_r(int, struct hostent_data*);'
16985	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16986	esac
16987	case "$sethostent_r_proto" in
16988	''|0)	d_sethostent_r=undef
16989 	        sethostent_r_proto=0
16990		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16991	* )	case "$sethostent_r_proto" in
16992		REENTRANT_PROTO*) ;;
16993		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16994		esac
16995		echo "Prototype: $try" ;;
16996	esac
16997	;;
16998	*)	case "$usethreads" in
16999		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17000		esac
17001		d_sethostent_r=undef
17002		sethostent_r_proto=0
17003		;;
17004	esac
17005	;;
17006*)	sethostent_r_proto=0
17007	;;
17008esac
17009
17010: see if setitimer exists
17011set setitimer d_setitimer
17012eval $inlibc
17013
17014: see if setlinebuf exists
17015set setlinebuf d_setlinebuf
17016eval $inlibc
17017
17018: see if setlocale exists
17019set setlocale d_setlocale
17020eval $inlibc
17021
17022: see if locale.h is available
17023set locale.h i_locale
17024eval $inhdr
17025
17026: see if setlocale_r exists
17027set setlocale_r d_setlocale_r
17028eval $inlibc
17029case "$d_setlocale_r" in
17030"$define")
17031	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17032	case "$d_setlocale_r_proto:$usethreads" in
17033	":define")	d_setlocale_r_proto=define
17034		set d_setlocale_r_proto setlocale_r $hdrs
17035		eval $hasproto ;;
17036	*)	;;
17037	esac
17038	case "$d_setlocale_r_proto" in
17039	define)
17040	case "$setlocale_r_proto" in
17041	''|0) try='int setlocale_r(int, const char*, char*, int);'
17042	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17043	esac
17044	case "$setlocale_r_proto" in
17045	''|0)	d_setlocale_r=undef
17046 	        setlocale_r_proto=0
17047		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17048	* )	case "$setlocale_r_proto" in
17049		REENTRANT_PROTO*) ;;
17050		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17051		esac
17052		echo "Prototype: $try" ;;
17053	esac
17054	;;
17055	*)	case "$usethreads" in
17056		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17057		esac
17058		d_setlocale_r=undef
17059		setlocale_r_proto=0
17060		;;
17061	esac
17062	;;
17063*)	setlocale_r_proto=0
17064	;;
17065esac
17066
17067: see if setnetent exists
17068set setnetent d_setnent
17069eval $inlibc
17070
17071: see if setnetent_r exists
17072set setnetent_r d_setnetent_r
17073eval $inlibc
17074case "$d_setnetent_r" in
17075"$define")
17076	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17077	case "$d_setnetent_r_proto:$usethreads" in
17078	":define")	d_setnetent_r_proto=define
17079		set d_setnetent_r_proto setnetent_r $hdrs
17080		eval $hasproto ;;
17081	*)	;;
17082	esac
17083	case "$d_setnetent_r_proto" in
17084	define)
17085	case "$setnetent_r_proto" in
17086	''|0) try='int setnetent_r(int, struct netent_data*);'
17087	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17088	esac
17089	case "$setnetent_r_proto" in
17090	''|0) try='void setnetent_r(int, struct netent_data*);'
17091	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17092	esac
17093	case "$setnetent_r_proto" in
17094	''|0)	d_setnetent_r=undef
17095 	        setnetent_r_proto=0
17096		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17097	* )	case "$setnetent_r_proto" in
17098		REENTRANT_PROTO*) ;;
17099		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17100		esac
17101		echo "Prototype: $try" ;;
17102	esac
17103	;;
17104	*)	case "$usethreads" in
17105		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17106		esac
17107		d_setnetent_r=undef
17108		setnetent_r_proto=0
17109		;;
17110	esac
17111	;;
17112*)	setnetent_r_proto=0
17113	;;
17114esac
17115
17116: see if setprotoent exists
17117set setprotoent d_setpent
17118eval $inlibc
17119
17120: see if setpgid exists
17121set setpgid d_setpgid
17122eval $inlibc
17123
17124: see if setpgrp2 exists
17125set setpgrp2 d_setpgrp2
17126eval $inlibc
17127
17128: see if setpriority exists
17129set setpriority d_setprior
17130eval $inlibc
17131
17132: see if setproctitle exists
17133set setproctitle d_setproctitle
17134eval $inlibc
17135
17136: see if setprotoent_r exists
17137set setprotoent_r d_setprotoent_r
17138eval $inlibc
17139case "$d_setprotoent_r" in
17140"$define")
17141	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17142	case "$d_setprotoent_r_proto:$usethreads" in
17143	":define")	d_setprotoent_r_proto=define
17144		set d_setprotoent_r_proto setprotoent_r $hdrs
17145		eval $hasproto ;;
17146	*)	;;
17147	esac
17148	case "$d_setprotoent_r_proto" in
17149	define)
17150	case "$setprotoent_r_proto" in
17151	''|0) try='int setprotoent_r(int, struct protoent_data*);'
17152	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17153	esac
17154	case "$setprotoent_r_proto" in
17155	''|0) try='void setprotoent_r(int, struct protoent_data*);'
17156	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17157	esac
17158	case "$setprotoent_r_proto" in
17159	''|0)	d_setprotoent_r=undef
17160 	        setprotoent_r_proto=0
17161		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17162	* )	case "$setprotoent_r_proto" in
17163		REENTRANT_PROTO*) ;;
17164		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17165		esac
17166		echo "Prototype: $try" ;;
17167	esac
17168	;;
17169	*)	case "$usethreads" in
17170		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17171		esac
17172		d_setprotoent_r=undef
17173		setprotoent_r_proto=0
17174		;;
17175	esac
17176	;;
17177*)	setprotoent_r_proto=0
17178	;;
17179esac
17180
17181: see if setpwent exists
17182set setpwent d_setpwent
17183eval $inlibc
17184
17185: see if setpwent_r exists
17186set setpwent_r d_setpwent_r
17187eval $inlibc
17188case "$d_setpwent_r" in
17189"$define")
17190	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17191	case "$d_setpwent_r_proto:$usethreads" in
17192	":define")	d_setpwent_r_proto=define
17193		set d_setpwent_r_proto setpwent_r $hdrs
17194		eval $hasproto ;;
17195	*)	;;
17196	esac
17197	case "$d_setpwent_r_proto" in
17198	define)
17199	case "$setpwent_r_proto" in
17200	''|0) try='int setpwent_r(FILE**);'
17201	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17202	esac
17203	case "$setpwent_r_proto" in
17204	''|0) try='void setpwent_r(FILE**);'
17205	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17206	esac
17207	case "$setpwent_r_proto" in
17208	''|0)	d_setpwent_r=undef
17209 	        setpwent_r_proto=0
17210		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17211	* )	case "$setpwent_r_proto" in
17212		REENTRANT_PROTO*) ;;
17213		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17214		esac
17215		echo "Prototype: $try" ;;
17216	esac
17217	;;
17218	*)	case "$usethreads" in
17219		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17220		esac
17221		d_setpwent_r=undef
17222		setpwent_r_proto=0
17223		;;
17224	esac
17225	;;
17226*)	setpwent_r_proto=0
17227	;;
17228esac
17229
17230: see if setregid exists
17231set setregid d_setregid
17232eval $inlibc
17233set setresgid d_setresgid
17234eval $inlibc
17235
17236: see if setreuid exists
17237set setreuid d_setreuid
17238eval $inlibc
17239set setresuid d_setresuid
17240eval $inlibc
17241
17242: see if setrgid exists
17243set setrgid d_setrgid
17244eval $inlibc
17245
17246: see if setruid exists
17247set setruid d_setruid
17248eval $inlibc
17249
17250: see if setservent exists
17251set setservent d_setsent
17252eval $inlibc
17253
17254: see if setservent_r exists
17255set setservent_r d_setservent_r
17256eval $inlibc
17257case "$d_setservent_r" in
17258"$define")
17259	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17260	case "$d_setservent_r_proto:$usethreads" in
17261	":define")	d_setservent_r_proto=define
17262		set d_setservent_r_proto setservent_r $hdrs
17263		eval $hasproto ;;
17264	*)	;;
17265	esac
17266	case "$d_setservent_r_proto" in
17267	define)
17268	case "$setservent_r_proto" in
17269	''|0) try='int setservent_r(int, struct servent_data*);'
17270	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17271	esac
17272	case "$setservent_r_proto" in
17273	''|0) try='void setservent_r(int, struct servent_data*);'
17274	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17275	esac
17276	case "$setservent_r_proto" in
17277	''|0)	d_setservent_r=undef
17278 	        setservent_r_proto=0
17279		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17280	* )	case "$setservent_r_proto" in
17281		REENTRANT_PROTO*) ;;
17282		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17283		esac
17284		echo "Prototype: $try" ;;
17285	esac
17286	;;
17287	*)	case "$usethreads" in
17288		define) echo "setservent_r has no prototype, not using it." >&4 ;;
17289		esac
17290		d_setservent_r=undef
17291		setservent_r_proto=0
17292		;;
17293	esac
17294	;;
17295*)	setservent_r_proto=0
17296	;;
17297esac
17298
17299: see if setsid exists
17300set setsid d_setsid
17301eval $inlibc
17302
17303: see if setvbuf exists
17304set setvbuf d_setvbuf
17305eval $inlibc
17306
17307: see if sfio.h is available
17308set sfio.h i_sfio
17309eval $inhdr
17310
17311: see if sfio library is available
17312case "$i_sfio" in
17313$define)
17314	val=''
17315	set sfreserve val
17316	eval $inlibc
17317	;;
17318*)
17319	val="$undef"
17320	;;
17321esac
17322: Ok, but do we want to use it.
17323case "$val" in
17324$define)
17325	case "$usesfio" in
17326	true|$define|[yY]*) dflt='y';;
17327	*) dflt='n';;
17328	esac
17329	echo "$package can use the sfio library, but it is experimental."
17330	case "$useperlio" in
17331	"$undef")
17332	    echo "For sfio also the PerlIO abstraction layer is needed."
17333	    echo "Earlier you said you wouldn't want that."
17334	    ;;
17335	esac
17336	rp="You seem to have sfio available, do you want to try using it?"
17337	. ./myread
17338	case "$ans" in
17339	y|Y)	echo "Ok, turning on both sfio and PerlIO, then."
17340		useperlio="$define"
17341		val="$define"
17342		;;
17343	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17344		val="$undef"
17345		;;
17346	esac
17347	;;
17348*)	case "$usesfio" in
17349	true|$define|[yY]*)
17350		echo "Sorry, cannot find sfio on this machine." >&4
17351		echo "Ignoring your setting of usesfio=$usesfio." >&4
17352		val="$undef"
17353		;;
17354	esac
17355	;;
17356esac
17357set d_sfio
17358eval $setvar
17359case "$d_sfio" in
17360$define) usesfio='true';;
17361*) usesfio='false';;
17362esac
17363case "$d_sfio" in
17364$define) ;;
17365*)	: Remove sfio from list of libraries to use
17366	case "$libs" in
17367	*-lsfio*)
17368		echo "Removing unneeded -lsfio from library list" >&4
17369		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17370		shift
17371		libs="$*"
17372		echo "libs = $libs" >&4
17373		;;
17374	esac
17375;;
17376esac
17377
17378
17379: see if shmctl exists
17380set shmctl d_shmctl
17381eval $inlibc
17382
17383: see if shmget exists
17384set shmget d_shmget
17385eval $inlibc
17386
17387: see if shmat exists
17388set shmat d_shmat
17389eval $inlibc
17390: see what shmat returns
17391case "$d_shmat" in
17392"$define")
17393	$cat >shmat.c <<'END'
17394#include <sys/shm.h>
17395void *shmat();
17396END
17397	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17398		shmattype='void *'
17399	else
17400		shmattype='char *'
17401	fi
17402	echo "and it returns ($shmattype)." >&4
17403	: see if a prototype for shmat is available
17404	xxx=`./findhdr sys/shm.h`
17405	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17406	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17407		val="$define"
17408	else
17409		val="$undef"
17410	fi
17411	$rm -f shmat.[co]
17412	;;
17413*)
17414	val="$undef"
17415	;;
17416esac
17417set d_shmatprototype
17418eval $setvar
17419
17420: see if shmdt exists
17421set shmdt d_shmdt
17422eval $inlibc
17423
17424: see how much of the 'shm*(2)' library is present.
17425h_shm=true
17426echo " "
17427case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17428*"$undef"*) h_shm=false;;
17429esac
17430case "$osname" in
17431freebsd)
17432    case "`ipcs 2>&1`" in
17433    "SVID shared memory"*"not configured"*)
17434	echo "Your $osname does not have the shm*(2) configured." >&4
17435        h_shm=false
17436	val="$undef"
17437	set shmctl d_shmctl
17438	evat $setvar
17439	set shmget d_shmget
17440	evat $setvar
17441	set shmat d_shmat
17442	evat $setvar
17443	set shmdt d_shmdt
17444	evat $setvar
17445	;;
17446    esac
17447    ;;
17448esac
17449: we could also check for sys/ipc.h ...
17450if $h_shm && $test `./findhdr sys/shm.h`; then
17451	echo "You have the full shm*(2) library." >&4
17452	val="$define"
17453else
17454	echo "You don't have the full shm*(2) library." >&4
17455	val="$undef"
17456fi
17457set d_shm
17458eval $setvar
17459
17460: see if we have sigaction
17461echo " "
17462if set sigaction val -f d_sigaction; eval $csym; $val; then
17463	echo 'sigaction() found.' >&4
17464	$cat > try.c <<EOP
17465#include <stdio.h>
17466#include <sys/types.h>
17467#include <signal.h>
17468#$i_stdlib I_STDLIB
17469#ifdef I_STDLIB
17470#include <stdlib.h>
17471#endif
17472int main()
17473{
17474    struct sigaction act, oact;
17475    act.sa_flags = 0;
17476    oact.sa_handler = 0;
17477    /* so that act and oact are used */
17478    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17479}
17480EOP
17481	set try
17482	if eval $compile_ok; then
17483		val="$define"
17484	else
17485		echo "But you don't seem to have a useable struct sigaction." >&4
17486		val="$undef"
17487	fi
17488else
17489	echo 'sigaction NOT found.' >&4
17490	val="$undef"
17491fi
17492set d_sigaction; eval $setvar
17493$rm_try
17494
17495: see if this is a sunmath.h system
17496set sunmath.h i_sunmath
17497eval $inhdr
17498
17499: see if signbit exists
17500$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17501$cat >try.c <<EOCP
17502#$i_math I_MATH
17503#$i_sunmath I_SUNMATH
17504#ifdef I_MATH
17505#  include <math.h>
17506#endif
17507#ifdef I_SUNMATH  /* Solaris special math library */
17508#  include <sunmath.h>
17509#endif
17510#define NV $nvtype
17511int main(int argc, char **argv)
17512{
17513    NV x = 0.0;
17514    NV y = -0.0;
17515    if ((signbit(x) == 0) && (signbit(y) != 0))
17516	return 0;
17517    else
17518	return 1;
17519}
17520EOCP
17521val="$undef"
17522set try
17523if eval $compile; then
17524    if $run ./try; then
17525        $echo "Yes." >&4
17526	val="$define"
17527    else
17528        $echo "Signbit seems to be available, but doesn't work as I expected."
17529        $echo "I won't use it." >&4
17530	val="$undef"
17531    fi
17532else
17533    $echo "Nope." >&4
17534    dflt="$undef"
17535fi
17536set d_signbit
17537eval $setvar
17538$rm_try
17539
17540: see if sigprocmask exists
17541set sigprocmask d_sigprocmask
17542eval $inlibc
17543
17544: see if sigsetjmp exists
17545echo " "
17546case "$d_sigsetjmp" in
17547'')
17548	$cat >try.c <<EOP
17549#include <setjmp.h>
17550#$i_stdlib I_STDLIB
17551#ifdef I_STDLIB
17552#include <stdlib.h>
17553#endif
17554sigjmp_buf env;
17555int set = 1;
17556int main()
17557{
17558	if (sigsetjmp(env,1))
17559		exit(set);
17560	set = 0;
17561	siglongjmp(env, 1);
17562	exit(1);
17563}
17564EOP
17565	set try
17566	if eval $compile; then
17567		if $run ./try >/dev/null 2>&1; then
17568			echo "POSIX sigsetjmp found." >&4
17569			val="$define"
17570		else
17571			$cat >&4 <<EOM
17572Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17573I'll ignore them.
17574EOM
17575			val="$undef"
17576		fi
17577	else
17578		echo "sigsetjmp not found." >&4
17579		val="$undef"
17580	fi
17581	;;
17582*) val="$d_sigsetjmp"
17583	case "$d_sigsetjmp" in
17584	$define) echo "POSIX sigsetjmp found." >&4;;
17585	$undef) echo "sigsetjmp not found." >&4;;
17586	esac
17587	;;
17588esac
17589set d_sigsetjmp
17590eval $setvar
17591$rm_try
17592
17593: see if snprintf exists
17594set snprintf d_snprintf
17595eval $inlibc
17596
17597: see if vsnprintf exists
17598set vsnprintf d_vsnprintf
17599eval $inlibc
17600
17601case "$d_snprintf-$d_vsnprintf" in
17602"$define-$define")
17603    $cat <<EOM
17604Checking whether your snprintf() and vsnprintf() work okay...
17605EOM
17606    $cat >try.c <<'EOCP'
17607/* v?snprintf testing logic courtesy of Russ Allbery.
17608 * According to C99:
17609 * - if the buffer is too short it still must be \0-terminated
17610 * - if the buffer is too short the potentially required length
17611 *   must be returned and not -1
17612 * - if the buffer is NULL the potentially required length
17613 *   must be returned and not -1 or core dump
17614 */
17615#include <stdio.h>
17616#include <stdarg.h>
17617
17618char buf[2];
17619
17620int test (char *format, ...)
17621{
17622    va_list args;
17623    int count;
17624
17625    va_start (args, format);
17626    count = vsnprintf (buf, sizeof buf, format, args);
17627    va_end (args);
17628    return count;
17629}
17630
17631int main ()
17632{
17633    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17634             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17635}
17636EOCP
17637    set try
17638    if eval $compile; then
17639	`$run ./try`
17640	case "$?" in
17641	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17642	*) cat <<EOM >&4
17643Your snprintf() and snprintf() don't seem to be working okay.
17644EOM
17645	   d_snprintf="$undef"
17646	   d_vsnprintf="$undef"
17647	   ;;
17648	esac
17649    else
17650	echo "(I can't seem to compile the test program--assuming they don't)"
17651	d_snprintf="$undef"
17652	d_vsnprintf="$undef"
17653    fi
17654    $rm_try
17655    ;;
17656esac
17657
17658: see if sockatmark exists
17659set sockatmark d_sockatmark
17660eval $inlibc
17661
17662: see if prototype for sockatmark is available
17663echo " "
17664set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17665eval $hasproto
17666
17667: see if socks5_init exists
17668set socks5_init d_socks5_init
17669eval $inlibc
17670
17671: see if sprintf returns the length of the string in the buffer as per ANSI
17672$echo "Checking whether sprintf returns the length of the string..." >&4
17673$cat <<EOP >try.c
17674#include <stdio.h>
17675#$i_stdlib I_STDLIB
17676#ifdef I_STDLIB
17677#include <stdlib.h>
17678#endif
17679#$i_string I_STRING
17680#ifdef I_STRING
17681#  include <string.h>
17682#else
17683#  include <strings.h>
17684#endif
17685#$i_math I_MATH
17686#ifdef I_MATH
17687#include <math.h>
17688#endif
17689
17690char buffer[256];
17691
17692int check (size_t expect, int test) {
17693  size_t got = strlen(buffer);
17694  if (expect == got)
17695    return 0;
17696
17697  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17698       test, buffer);
17699  exit (test);
17700}
17701
17702int main(int argc, char **argv) {
17703  int test = 0;
17704
17705  check(sprintf(buffer, ""), ++test);
17706  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17707  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17708
17709  return 0;
17710}
17711EOP
17712set try
17713
17714if eval $compile; then
17715    xxx="`$run ./try`"
17716    case "$?" in
17717	0) cat >&4 <<EOM
17718sprintf returns the length of the string (as ANSI says it should)
17719EOM
17720	d_sprintf_returns_strlen="$define"
17721	;;
17722	*) cat >&4 <<EOM
17723sprintf does not return the length of the string (how old is this system?)
17724EOM
17725	d_sprintf_returns_strlen="$undef"
17726        ;;
17727    esac
17728else
17729    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17730    d_sprintf_returns_strlen="$undef"
17731fi
17732$rm_try
17733
17734: see if srand48_r exists
17735set srand48_r d_srand48_r
17736eval $inlibc
17737case "$d_srand48_r" in
17738"$define")
17739	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17740	case "$d_srand48_r_proto:$usethreads" in
17741	":define")	d_srand48_r_proto=define
17742		set d_srand48_r_proto srand48_r $hdrs
17743		eval $hasproto ;;
17744	*)	;;
17745	esac
17746	case "$d_srand48_r_proto" in
17747	define)
17748	case "$srand48_r_proto" in
17749	''|0) try='int srand48_r(long, struct drand48_data*);'
17750	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17751	esac
17752	case "$srand48_r_proto" in
17753	''|0)	d_srand48_r=undef
17754 	        srand48_r_proto=0
17755		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17756	* )	case "$srand48_r_proto" in
17757		REENTRANT_PROTO*) ;;
17758		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17759		esac
17760		echo "Prototype: $try" ;;
17761	esac
17762	;;
17763	*)	case "$usethreads" in
17764		define) echo "srand48_r has no prototype, not using it." >&4 ;;
17765		esac
17766		d_srand48_r=undef
17767		srand48_r_proto=0
17768		;;
17769	esac
17770	;;
17771*)	srand48_r_proto=0
17772	;;
17773esac
17774
17775: see if srandom_r exists
17776set srandom_r d_srandom_r
17777eval $inlibc
17778case "$d_srandom_r" in
17779"$define")
17780	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17781	case "$d_srandom_r_proto:$usethreads" in
17782	":define")	d_srandom_r_proto=define
17783		set d_srandom_r_proto srandom_r $hdrs
17784		eval $hasproto ;;
17785	*)	;;
17786	esac
17787	case "$d_srandom_r_proto" in
17788	define)
17789	case "$srandom_r_proto" in
17790	''|0) try='int srandom_r(unsigned int, struct random_data*);'
17791	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17792	esac
17793	case "$srandom_r_proto" in
17794	''|0)	d_srandom_r=undef
17795 	        srandom_r_proto=0
17796		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17797	* )	case "$srandom_r_proto" in
17798		REENTRANT_PROTO*) ;;
17799		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17800		esac
17801		echo "Prototype: $try" ;;
17802	esac
17803	;;
17804	*)	case "$usethreads" in
17805		define) echo "srandom_r has no prototype, not using it." >&4 ;;
17806		esac
17807		d_srandom_r=undef
17808		srandom_r_proto=0
17809		;;
17810	esac
17811	;;
17812*)	srandom_r_proto=0
17813	;;
17814esac
17815
17816: see if prototype for setresgid is available
17817echo " "
17818set d_sresgproto setresgid $i_unistd unistd.h
17819eval $hasproto
17820
17821: see if prototype for setresuid is available
17822echo " "
17823set d_sresuproto setresuid $i_unistd unistd.h
17824eval $hasproto
17825
17826: see if sys/stat.h is available
17827set sys/stat.h i_sysstat
17828eval $inhdr
17829
17830: see if stat knows about block sizes
17831echo " "
17832echo "Checking to see if your struct stat has st_blocks field..." >&4
17833set d_statblks stat st_blocks $i_sysstat sys/stat.h
17834eval $hasfield
17835
17836: see if this is a sys/vfs.h system
17837set sys/vfs.h i_sysvfs
17838eval $inhdr
17839
17840: see if this is a sys/statfs.h system
17841set sys/statfs.h i_sysstatfs
17842eval $inhdr
17843
17844: Check for statfs_s
17845echo " "
17846echo "Checking to see if your system supports struct statfs..." >&4
17847set 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
17848eval $hasstruct
17849case "$d_statfs_s" in
17850"$define")      echo "Yes, it does."   ;;
17851*)              echo "No, it doesn't." ;;
17852esac
17853
17854
17855: see if struct statfs knows about f_flags
17856case "$d_statfs_s" in
17857define)
17858	echo " "
17859	echo "Checking to see if your struct statfs has f_flags field..." >&4
17860	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
17861	eval $hasfield
17862	;;
17863*)	val="$undef"
17864	set d_statfs_f_flags
17865	eval $setvar
17866	;;
17867esac
17868case "$d_statfs_f_flags" in
17869"$define")      echo "Yes, it does."   ;;
17870*)              echo "No, it doesn't." ;;
17871esac
17872
17873: Check stream access
17874$cat >&4 <<EOM
17875Checking how to access stdio streams by file descriptor number...
17876EOM
17877case "$stdio_stream_array" in
17878'') 	$cat >try.c <<EOCP
17879#include <stdio.h>
17880int main() {
17881  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17882    printf("yes\n");
17883}
17884EOCP
17885	for s in _iob __iob __sF
17886	do
17887	        set try -DSTDIO_STREAM_ARRAY=$s
17888		if eval $compile; then
17889		    	case "`$run ./try`" in
17890			yes)	stdio_stream_array=$s; break ;;
17891			esac
17892		fi
17893	done
17894	$rm_try
17895esac
17896case "$stdio_stream_array" in
17897'')	$cat >&4 <<EOM
17898I can't figure out how to access stdio streams by file descriptor number.
17899EOM
17900	d_stdio_stream_array="$undef"
17901	;;
17902*)	$cat >&4 <<EOM
17903You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17904EOM
17905	d_stdio_stream_array="$define"
17906	;;
17907esac
17908
17909: see if strcoll exists
17910set strcoll d_strcoll
17911eval $inlibc
17912
17913: check for structure copying
17914echo " "
17915echo "Checking to see if your C compiler can copy structs..." >&4
17916$cat >try.c <<'EOCP'
17917int main()
17918{
17919	struct blurfl {
17920		int dyick;
17921	} foo, bar;
17922
17923	foo = bar;
17924}
17925EOCP
17926if $cc -c try.c >/dev/null 2>&1 ; then
17927	val="$define"
17928	echo "Yup, it can."
17929else
17930	val="$undef"
17931	echo "Nope, it can't."
17932fi
17933set d_strctcpy
17934eval $setvar
17935$rm_try
17936
17937: see if strerror and/or sys_errlist[] exist
17938echo " "
17939if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17940    if set strerror val -f d_strerror; eval $csym; $val; then
17941		echo 'strerror() found.' >&4
17942		d_strerror="$define"
17943		d_strerrm='strerror(e)'
17944		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17945			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17946			d_syserrlst="$define"
17947		else
17948			echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17949			d_syserrlst="$undef"
17950		fi
17951    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17952			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17953		echo 'strerror() found in string header.' >&4
17954		d_strerror="$define"
17955		d_strerrm='strerror(e)'
17956		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17957			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17958				d_syserrlst="$define"
17959		else
17960			echo "(You don't appear to have any sys_errlist[], how can this be?)"
17961			d_syserrlst="$undef"
17962		fi
17963    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17964		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17965		d_strerror="$undef"
17966		d_syserrlst="$define"
17967		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17968    else
17969		echo 'strerror() and sys_errlist[] NOT found.' >&4
17970		d_strerror="$undef"
17971		d_syserrlst="$undef"
17972		d_strerrm='"unknown"'
17973    fi
17974fi
17975
17976: see if strerror_r exists
17977set strerror_r d_strerror_r
17978eval $inlibc
17979case "$d_strerror_r" in
17980"$define")
17981	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17982	case "$d_strerror_r_proto:$usethreads" in
17983	":define")	d_strerror_r_proto=define
17984		set d_strerror_r_proto strerror_r $hdrs
17985		eval $hasproto ;;
17986	*)	;;
17987	esac
17988	case "$d_strerror_r_proto" in
17989	define)
17990	case "$strerror_r_proto" in
17991	''|0) try='int strerror_r(int, char*, size_t);'
17992	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17993	esac
17994	case "$strerror_r_proto" in
17995	''|0) try='int strerror_r(int, char*, int);'
17996	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17997	esac
17998	case "$strerror_r_proto" in
17999	''|0) try='char* strerror_r(int, char*, size_t);'
18000	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18001	esac
18002	case "$strerror_r_proto" in
18003	''|0)	d_strerror_r=undef
18004 	        strerror_r_proto=0
18005		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18006	* )	case "$strerror_r_proto" in
18007		REENTRANT_PROTO*) ;;
18008		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18009		esac
18010		echo "Prototype: $try" ;;
18011	esac
18012	;;
18013	*)	case "$usethreads" in
18014		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18015		esac
18016		d_strerror_r=undef
18017		strerror_r_proto=0
18018		;;
18019	esac
18020	;;
18021*)	strerror_r_proto=0
18022	;;
18023esac
18024
18025: see if strftime exists
18026set strftime d_strftime
18027eval $inlibc
18028
18029: see if strlcat exists
18030set strlcat d_strlcat
18031eval $inlibc
18032
18033: see if strlcpy exists
18034set strlcpy d_strlcpy
18035eval $inlibc
18036
18037: see if strtod exists
18038set strtod d_strtod
18039eval $inlibc
18040
18041: see if strtol exists
18042set strtol d_strtol
18043eval $inlibc
18044
18045: see if strtold exists
18046set strtold d_strtold
18047eval $inlibc
18048
18049: see if strtoll exists
18050set strtoll d_strtoll
18051eval $inlibc
18052
18053case "$d_longlong-$d_strtoll" in
18054"$define-$define")
18055	$cat <<EOM
18056Checking whether your strtoll() works okay...
18057EOM
18058	$cat >try.c <<'EOCP'
18059#include <errno.h>
18060#ifdef __hpux
18061#define strtoll __strtoll
18062#endif
18063#ifdef __EMX__
18064#define strtoll _strtoll
18065#endif
18066#include <stdio.h>
18067extern long long int strtoll(char *s, char **, int);
18068static int bad = 0;
18069int check(char *s, long long ell, int een) {
18070	long long gll;
18071	errno = 0;
18072	gll = strtoll(s, 0, 10);
18073	if (!((gll == ell) && (errno == een)))
18074		bad++;
18075}
18076int main() {
18077	check(" 1",                                      1LL, 0);
18078	check(" 0",                                      0LL, 0);
18079	check("-1",                                     -1LL, 0);
18080	check("-9223372036854775808", -9223372036854775808LL, 0);
18081	check("-9223372036854775808", -9223372036854775808LL, 0);
18082	check(" 9223372036854775807",  9223372036854775807LL, 0);
18083	check("-9223372036854775808", -9223372036854775808LL, 0);
18084	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18085	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18086	if (!bad)
18087		printf("ok\n");
18088}
18089EOCP
18090	set try
18091	if eval $compile; then
18092		yyy=`$run ./try`
18093		case "$yyy" in
18094		ok) echo "Your strtoll() seems to be working okay." ;;
18095		*) cat <<EOM >&4
18096Your strtoll() doesn't seem to be working okay.
18097EOM
18098		   d_strtoll="$undef"
18099		   ;;
18100		esac
18101	else
18102		echo "(I can't seem to compile the test program--assuming it doesn't)"
18103		d_strtoll="$undef"
18104	fi
18105	;;
18106esac
18107
18108: see if strtoq exists
18109set strtoq d_strtoq
18110eval $inlibc
18111
18112: see if strtoul exists
18113set strtoul d_strtoul
18114eval $inlibc
18115
18116case "$d_strtoul" in
18117"$define")
18118	$cat <<EOM
18119Checking whether your strtoul() works okay...
18120EOM
18121	$cat >try.c <<'EOCP'
18122#include <errno.h>
18123#include <stdio.h>
18124extern unsigned long int strtoul(char *s, char **, int);
18125static int bad = 0;
18126void check(char *s, unsigned long eul, int een) {
18127	unsigned long gul;
18128	errno = 0;
18129	gul = strtoul(s, 0, 10);
18130	if (!((gul == eul) && (errno == een)))
18131		bad++;
18132}
18133int main() {
18134	check(" 1", 1L, 0);
18135	check(" 0", 0L, 0);
18136EOCP
18137	case "$longsize" in
18138	8)
18139	    $cat >>try.c <<'EOCP'
18140	check("18446744073709551615", 18446744073709551615UL, 0);
18141	check("18446744073709551616", 18446744073709551615UL, ERANGE);
18142#if 0 /* strtoul() for /^-/ strings is undefined. */
18143	check("-1", 18446744073709551615UL, 0);
18144	check("-18446744073709551614", 2, 0);
18145	check("-18446744073709551615", 1, 0);
18146       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18147	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18148#endif
18149EOCP
18150		;;
18151	4)
18152		    $cat >>try.c <<'EOCP'
18153	check("4294967295", 4294967295UL, 0);
18154	check("4294967296", 4294967295UL, ERANGE);
18155#if 0 /* strtoul() for /^-/ strings is undefined. */
18156	check("-1", 4294967295UL, 0);
18157	check("-4294967294", 2, 0);
18158	check("-4294967295", 1, 0);
18159       	check("-4294967296", 4294967295UL, ERANGE);
18160	check("-4294967297", 4294967295UL, ERANGE);
18161#endif
18162EOCP
18163		;;
18164	*)
18165: Should we write these tests to be more portable by sprintf-ing
18166: ~0 and then manipulating that char string as input for strtol?
18167		;;
18168	esac
18169	$cat >>try.c <<'EOCP'
18170	if (!bad)
18171		printf("ok\n");
18172	return 0;
18173}
18174EOCP
18175	set try
18176	if eval $compile; then
18177		case "`$run ./try`" in
18178		ok) echo "Your strtoul() seems to be working okay." ;;
18179		*) cat <<EOM >&4
18180Your strtoul() doesn't seem to be working okay.
18181EOM
18182		   d_strtoul="$undef"
18183		   ;;
18184		esac
18185	else
18186		echo "(I can't seem to compile the test program--assuming it doesn't)"
18187		d_strtoul="$undef"
18188	fi
18189	;;
18190esac
18191
18192: see if strtoull exists
18193set strtoull d_strtoull
18194eval $inlibc
18195
18196case "$d_longlong-$d_strtoull" in
18197"$define-$define")
18198	$cat <<EOM
18199Checking whether your strtoull() works okay...
18200EOM
18201	$cat >try.c <<'EOCP'
18202#include <errno.h>
18203#ifdef __hpux
18204#define strtoull __strtoull
18205#endif
18206#include <stdio.h>
18207extern unsigned long long int strtoull(char *s, char **, int);
18208static int bad = 0;
18209int check(char *s, long long eull, int een) {
18210	long long gull;
18211	errno = 0;
18212	gull = strtoull(s, 0, 10);
18213	if (!((gull == eull) && (errno == een)))
18214		bad++;
18215}
18216int main() {
18217	check(" 1",                                        1LL, 0);
18218	check(" 0",                                        0LL, 0);
18219	check("18446744073709551615",  18446744073709551615ULL, 0);
18220	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18221#if 0 /* strtoull() for /^-/ strings is undefined. */
18222	check("-1",                    18446744073709551615ULL, 0);
18223	check("-18446744073709551614",                     2LL, 0);
18224	check("-18446744073709551615",                     1LL, 0);
18225       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18226	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18227#endif
18228	if (!bad)
18229		printf("ok\n");
18230}
18231EOCP
18232	set try
18233	if eval $compile; then
18234		case "`$run ./try`" in
18235		ok) echo "Your strtoull() seems to be working okay." ;;
18236		*) cat <<EOM >&4
18237Your strtoull() doesn't seem to be working okay.
18238EOM
18239		   d_strtoull="$undef"
18240		   ;;
18241		esac
18242	else
18243		echo "(I can't seem to compile the test program--assuming it doesn't)"
18244		d_strtoull="$undef"
18245	fi
18246	;;
18247esac
18248
18249: see if strtouq exists
18250set strtouq d_strtouq
18251eval $inlibc
18252
18253case "$d_strtouq" in
18254"$define")
18255	$cat <<EOM
18256Checking whether your strtouq() works okay...
18257EOM
18258	$cat >try.c <<'EOCP'
18259#include <errno.h>
18260#include <stdio.h>
18261extern unsigned long long int strtouq(char *s, char **, int);
18262static int bad = 0;
18263void check(char *s, unsigned long long eull, int een) {
18264	unsigned long long gull;
18265	errno = 0;
18266	gull = strtouq(s, 0, 10);
18267	if (!((gull == eull) && (errno == een)))
18268		bad++;
18269}
18270int main() {
18271	check(" 1",                                        1LL, 0);
18272	check(" 0",                                        0LL, 0);
18273	check("18446744073709551615",  18446744073709551615ULL, 0);
18274	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18275#if 0 /* strtouq() for /^-/ strings is undefined. */
18276	check("-1",                    18446744073709551615ULL, 0);
18277	check("-18446744073709551614",                     2LL, 0);
18278	check("-18446744073709551615",                     1LL, 0);
18279       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18280	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18281#endif
18282	if (!bad)
18283		printf("ok\n");
18284	return 0;
18285}
18286EOCP
18287	set try
18288	if eval $compile; then
18289		case "`$run ./try`" in
18290		ok) echo "Your strtouq() seems to be working okay." ;;
18291		*) cat <<EOM >&4
18292Your strtouq() doesn't seem to be working okay.
18293EOM
18294		   d_strtouq="$undef"
18295		   ;;
18296		esac
18297	else
18298		echo "(I can't seem to compile the test program--assuming it doesn't)"
18299		d_strtouq="$undef"
18300	fi
18301	;;
18302esac
18303
18304: see if strxfrm exists
18305set strxfrm d_strxfrm
18306eval $inlibc
18307
18308: see if symlink exists
18309set symlink d_symlink
18310eval $inlibc
18311
18312: see if syscall exists
18313set syscall d_syscall
18314eval $inlibc
18315
18316: see if prototype for syscall is available
18317echo " "
18318set d_syscallproto syscall $i_unistd unistd.h
18319eval $hasproto
18320
18321: see if sysconf exists
18322set sysconf d_sysconf
18323eval $inlibc
18324
18325: see if system exists
18326set system d_system
18327eval $inlibc
18328
18329: see if tcgetpgrp exists
18330set tcgetpgrp d_tcgetpgrp
18331eval $inlibc
18332
18333: see if tcsetpgrp exists
18334set tcsetpgrp d_tcsetpgrp
18335eval $inlibc
18336
18337: see if prototype for telldir is available
18338echo " "
18339set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18340eval $hasproto
18341
18342: see if time exists
18343echo " "
18344if test "X$d_time" = X -o X"$timetype" = X; then
18345    if set time val -f d_time; eval $csym; $val; then
18346		echo 'time() found.' >&4
18347		val="$define"
18348		rp="What is the type returned by time() on this system?"
18349		set time_t timetype long stdio.h sys/types.h
18350		eval $typedef_ask
18351    else
18352		echo 'time() not found, hope that will do.' >&4
18353		val="$undef"
18354		timetype='int';
18355    fi
18356    set d_time
18357    eval $setvar
18358fi
18359
18360: see if timegm exists
18361set timegm d_timegm
18362eval $inlibc
18363
18364: see if this is a sys/times.h system
18365set sys/times.h i_systimes
18366eval $inhdr
18367
18368: see if times exists
18369echo " "
18370if set times val -f d_times; eval $csym; $val; then
18371	echo 'times() found.' >&4
18372	d_times="$define"
18373	inc=''
18374	case "$i_systimes" in
18375	"$define") inc='sys/times.h';;
18376	esac
18377	rp="What is the type returned by times() on this system?"
18378	set clock_t clocktype long stdio.h sys/types.h $inc
18379	eval $typedef_ask
18380else
18381	echo 'times() NOT found, hope that will do.' >&4
18382	d_times="$undef"
18383	clocktype='int'
18384fi
18385
18386: see if tmpnam_r exists
18387set tmpnam_r d_tmpnam_r
18388eval $inlibc
18389case "$d_tmpnam_r" in
18390"$define")
18391	hdrs="$i_systypes sys/types.h define stdio.h "
18392	case "$d_tmpnam_r_proto:$usethreads" in
18393	":define")	d_tmpnam_r_proto=define
18394		set d_tmpnam_r_proto tmpnam_r $hdrs
18395		eval $hasproto ;;
18396	*)	;;
18397	esac
18398	case "$d_tmpnam_r_proto" in
18399	define)
18400	case "$tmpnam_r_proto" in
18401	''|0) try='char* tmpnam_r(char*);'
18402	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18403	esac
18404	case "$tmpnam_r_proto" in
18405	''|0)	d_tmpnam_r=undef
18406 	        tmpnam_r_proto=0
18407		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18408	* )	case "$tmpnam_r_proto" in
18409		REENTRANT_PROTO*) ;;
18410		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18411		esac
18412		echo "Prototype: $try" ;;
18413	esac
18414	;;
18415	*)	case "$usethreads" in
18416		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18417		esac
18418		d_tmpnam_r=undef
18419		tmpnam_r_proto=0
18420		;;
18421	esac
18422	;;
18423*)	tmpnam_r_proto=0
18424	;;
18425esac
18426
18427: see if truncate exists
18428set truncate d_truncate
18429eval $inlibc
18430
18431: see if ttyname_r exists
18432set ttyname_r d_ttyname_r
18433eval $inlibc
18434case "$d_ttyname_r" in
18435"$define")
18436	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18437	case "$d_ttyname_r_proto:$usethreads" in
18438	":define")	d_ttyname_r_proto=define
18439		set d_ttyname_r_proto ttyname_r $hdrs
18440		eval $hasproto ;;
18441	*)	;;
18442	esac
18443	case "$d_ttyname_r_proto" in
18444	define)
18445	case "$ttyname_r_proto" in
18446	''|0) try='int ttyname_r(int, char*, size_t);'
18447	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18448	esac
18449	case "$ttyname_r_proto" in
18450	''|0) try='int ttyname_r(int, char*, int);'
18451	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18452	esac
18453	case "$ttyname_r_proto" in
18454	''|0) try='char* ttyname_r(int, char*, int);'
18455	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18456	esac
18457	case "$ttyname_r_proto" in
18458	''|0)	d_ttyname_r=undef
18459 	        ttyname_r_proto=0
18460		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18461	* )	case "$ttyname_r_proto" in
18462		REENTRANT_PROTO*) ;;
18463		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18464		esac
18465		echo "Prototype: $try" ;;
18466	esac
18467	;;
18468	*)	case "$usethreads" in
18469		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18470		esac
18471		d_ttyname_r=undef
18472		ttyname_r_proto=0
18473		;;
18474	esac
18475	;;
18476*)	ttyname_r_proto=0
18477	;;
18478esac
18479
18480: see if tzname[] exists
18481echo " "
18482if set tzname val -a d_tzname; eval $csym; $val; then
18483	val="$define"
18484	echo 'tzname[] found.' >&4
18485else
18486	val="$undef"
18487	echo 'tzname[] NOT found.' >&4
18488fi
18489set d_tzname
18490eval $setvar
18491
18492: Check if is a multiplatform env
18493case "$osname" in
18494next|rhapsody|darwin) multiarch="$define" ;;
18495esac
18496case "$multiarch" in
18497''|[nN]*) multiarch="$undef" ;;
18498esac
18499
18500: check for ordering of bytes in a UV
18501echo " "
18502case "$usecrosscompile$multiarch" in
18503*$define*)
18504	$cat <<EOM
18505You seem to be either cross-compiling or doing a multiarchitecture build,
18506skipping the byteorder check.
18507
18508EOM
18509	byteorder='ffff'
18510	;;
18511*)
18512	case "$byteorder" in
18513	'')
18514		$cat <<'EOM'
18515In the following, larger digits indicate more significance.  A big-endian
18516machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18517little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18518machines may have weird orders like 3412.  A Cray will report 87654321,
18519an Alpha will report 12345678. If the test program works the default is
18520probably right.
18521I'm now running the test program...
18522EOM
18523		$cat >try.c <<EOCP
18524#include <stdio.h>
18525#$i_stdlib I_STDLIB
18526#ifdef I_STDLIB
18527#include <stdlib.h>
18528#endif
18529#include <sys/types.h>
18530typedef $uvtype UV;
18531int main()
18532{
18533	int i;
18534	union {
18535		UV l;
18536		char c[$uvsize];
18537	} u;
18538
18539	if ($uvsize > 4)
18540		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18541	else
18542		u.l = (UV)0x04030201;
18543	for (i = 0; i < $uvsize; i++)
18544		printf("%c", u.c[i]+'0');
18545	printf("\n");
18546	exit(0);
18547}
18548EOCP
18549		xxx_prompt=y
18550		set try
18551		if eval $compile && $run ./try > /dev/null; then
18552			dflt=`$run ./try`
18553			case "$dflt" in
18554			[1-4][1-4][1-4][1-4]|12345678|87654321)
18555				echo "(The test program ran ok.)"
18556				echo "byteorder=$dflt"
18557				xxx_prompt=n
18558			;;
18559			????|????????) echo "(The test program ran ok.)" ;;
18560			*) echo "(The test program didn't run right for some reason.)" ;;
18561			esac
18562		else
18563			dflt='4321'
18564			cat <<'EOM'
18565(I can't seem to compile the test program.  Guessing big-endian...)
18566EOM
18567		fi
18568		case "$xxx_prompt" in
18569		y)
18570			rp="What is the order of bytes in $uvtype?"
18571			. ./myread
18572			byteorder="$ans"
18573			;;
18574		*)	byteorder=$dflt
18575			;;
18576		esac
18577		;;
18578	esac
18579	$rm_try
18580	;;
18581esac
18582
18583: Checking 32bit aligndness
18584$cat <<EOM
18585
18586Checking to see whether you can access character data unalignedly...
18587EOM
18588case "$d_u32align" in
18589'')   $cat >try.c <<EOCP
18590#include <stdio.h>
18591#$i_stdlib I_STDLIB
18592#ifdef I_STDLIB
18593#include <stdlib.h>
18594#endif
18595#define U32 $u32type
18596#define BYTEORDER 0x$byteorder
18597#define U8 $u8type
18598#include <signal.h>
18599#ifdef SIGBUS
18600$signal_t bletch(int s) { exit(4); }
18601#endif
18602int main() {
18603#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18604    volatile U8 buf[8];
18605    volatile U32 *up;
18606    int i;
18607
18608    if (sizeof(U32) != 4) {
18609	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18610	exit(1);
18611    }
18612
18613    fflush(stdout);
18614
18615#ifdef SIGBUS
18616    signal(SIGBUS, bletch);
18617#endif
18618
18619    buf[0] = 0;
18620    buf[1] = 0;
18621    buf[2] = 0;
18622    buf[3] = 1;
18623    buf[4] = 0;
18624    buf[5] = 0;
18625    buf[6] = 0;
18626    buf[7] = 1;
18627
18628    for (i = 0; i < 4; i++) {
18629	up = (U32*)(buf + i);
18630	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18631	       (*up == 1 << (8*(3-i)))  /* little-endian */
18632	      )
18633	   )
18634	{
18635	    printf("read failed (%x)\n", *up);
18636	    exit(2);
18637	}
18638    }
18639
18640    /* write test */
18641    for (i = 0; i < 4; i++) {
18642	up = (U32*)(buf + i);
18643	*up = 0xBeef;
18644	if (*up != 0xBeef) {
18645	    printf("write failed (%x)\n", *up);
18646	    exit(3);
18647	}
18648    }
18649
18650    exit(0);
18651#else
18652    printf("1\n");
18653    exit(1);
18654#endif
18655    return 0;
18656}
18657EOCP
18658set try
18659if eval $compile_ok; then
18660	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18661	$run ./try 2>&1 >/dev/null
18662	case "$?" in
18663	0)	cat >&4 <<EOM
18664You can access character data pretty unalignedly.
18665EOM
18666		d_u32align="$undef"
18667		;;
18668	*)	cat >&4 <<EOM
18669It seems that you must access character data in an aligned manner.
18670EOM
18671		d_u32align="$define"
18672		;;
18673	esac
18674else
18675	rp='Can you access character data at unaligned addresses?'
18676	dflt='n'
18677	. ./myread
18678	case "$ans" in
18679	[yY]*)	d_u32align="$undef"  ;;
18680	*)	d_u32align="$define" ;;
18681	esac
18682fi
18683$rm_try
18684;;
18685esac
18686
18687: see if ualarm exists
18688set ualarm d_ualarm
18689eval $inlibc
18690
18691: see if umask exists
18692set umask d_umask
18693eval $inlibc
18694
18695: see if unordered exists
18696set unordered d_unordered
18697eval $inlibc
18698
18699: see if unsetenv exists
18700set unsetenv d_unsetenv
18701eval $inlibc
18702
18703: see if usleep exists
18704set usleep d_usleep
18705eval $inlibc
18706
18707: see if prototype for usleep is available
18708echo " "
18709set d_usleepproto usleep $i_unistd unistd.h
18710eval $hasproto
18711
18712: see if ustat exists
18713set ustat d_ustat
18714eval $inlibc
18715
18716: see if closedir exists
18717set closedir d_closedir
18718eval $inlibc
18719
18720case "$d_closedir" in
18721"$define")
18722	echo " "
18723	echo "Checking whether closedir() returns a status..." >&4
18724	cat > try.c <<EOM
18725#$i_dirent I_DIRENT		/**/
18726#$i_sysdir I_SYS_DIR		/**/
18727#$i_sysndir I_SYS_NDIR		/**/
18728#$i_systypes I_SYS_TYPES	/**/
18729
18730#if defined(I_SYS_TYPES)
18731#include <sys/types.h>
18732#endif
18733#if defined(I_DIRENT)
18734#include <dirent.h>
18735#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18736#include <sys/dir.h>
18737#endif
18738#else
18739#ifdef I_SYS_NDIR
18740#include <sys/ndir.h>
18741#else
18742#ifdef I_SYS_DIR
18743#ifdef hp9000s500
18744#include <ndir.h>	/* may be wrong in the future */
18745#else
18746#include <sys/dir.h>
18747#endif
18748#endif
18749#endif
18750#endif
18751int main() { return closedir(opendir(".")); }
18752EOM
18753	set try
18754	if eval $compile_ok; then
18755		if $run ./try > /dev/null 2>&1 ; then
18756			echo "Yes, it does."
18757			val="$undef"
18758		else
18759			echo "No, it doesn't."
18760			val="$define"
18761		fi
18762	else
18763		echo "(I can't seem to compile the test program--assuming it doesn't)"
18764		val="$define"
18765	fi
18766	;;
18767*)
18768	val="$undef";
18769	;;
18770esac
18771set d_void_closedir
18772eval $setvar
18773$rm_try
18774
18775: see if there is a wait4
18776set wait4 d_wait4
18777eval $inlibc
18778
18779: see if waitpid exists
18780set waitpid d_waitpid
18781eval $inlibc
18782
18783: see if wcstombs exists
18784set wcstombs d_wcstombs
18785eval $inlibc
18786
18787: see if wctomb exists
18788set wctomb d_wctomb
18789eval $inlibc
18790
18791: see if writev exists
18792set writev d_writev
18793eval $inlibc
18794
18795: preserve RCS keywords in files with variable substitution, grrr
18796Date='$Date'
18797Id='$Id'
18798Log='$Log'
18799RCSfile='$RCSfile'
18800Revision='$Revision'
18801
18802: check for alignment requirements
18803echo " "
18804case "$usecrosscompile$multiarch" in
18805*$define*)
18806	$cat <<EOM
18807You seem to be either cross-compiling or doing a multiarchitecture build,
18808skipping the memory alignment check.
18809
18810EOM
18811	case "$alignbytes" in
18812	'') alignbytes=8 ;;
18813	esac
18814	;;
18815*)
18816	case "$alignbytes" in
18817	'') echo "Checking alignment constraints..." >&4
18818		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18819			$cat >try.c <<'EOCP'
18820typedef long double NV;
18821EOCP
18822		else
18823			$cat >try.c <<'EOCP'
18824typedef double NV;
18825EOCP
18826		fi
18827		$cat >>try.c <<'EOCP'
18828#include <stdio.h>
18829struct foobar {
18830	char foo;
18831	NV bar;
18832} try_algn;
18833int main()
18834{
18835    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18836    return(0);
18837}
18838EOCP
18839		set try
18840		if eval $compile_ok; then
18841			dflt=`$run ./try`
18842		else
18843			dflt='8'
18844			echo "(I can't seem to compile the test program...)"
18845		fi
18846		;;
18847	*) dflt="$alignbytes"
18848		;;
18849	esac
18850	rp="Doubles must be aligned on a how-many-byte boundary?"
18851	. ./myread
18852	alignbytes="$ans"
18853	$rm_try
18854	;;
18855esac
18856
18857
18858: set the base revision
18859baserev=5.0
18860
18861: check for length of character
18862echo " "
18863case "$charsize" in
18864'')
18865	echo "Checking to see how big your characters are (hey, you never know)..." >&4
18866	$cat >try.c <<EOCP
18867#include <stdio.h>
18868#$i_stdlib I_STDLIB
18869#ifdef I_STDLIB
18870#include <stdlib.h>
18871#endif
18872int main()
18873{
18874    printf("%d\n", (int)sizeof(char));
18875    exit(0);
18876}
18877EOCP
18878	set try
18879	if eval $compile_ok; then
18880		dflt=`$run ./try`
18881	else
18882		dflt='1'
18883		echo "(I can't seem to compile the test program.  Guessing...)"
18884	fi
18885	;;
18886*)
18887	dflt="$charsize"
18888	;;
18889esac
18890rp="What is the size of a character (in bytes)?"
18891. ./myread
18892charsize="$ans"
18893$rm_try
18894
18895: Check for the number of bits in a character
18896case "$charbits" in
18897'')	echo "Checking how long a character is (in bits)..." >&4
18898	$cat >try.c <<EOCP
18899#include <stdio.h>
18900int main ()
18901{
18902    int n;
18903    unsigned char c;
18904    for (c = 1, n = 0; c; c <<= 1, n++) ;
18905    printf ("%d\n", n);
18906    return (0);
18907    }
18908EOCP
18909	set try
18910	if eval $compile_ok; then
18911		dflt=`$run ./try`
18912	else
18913		dflt='8'
18914		echo "(I can't seem to compile the test program.  Guessing...)"
18915	fi
18916	;;
18917*)
18918	dflt="$charbits"
18919	;;
18920esac
18921rp="What is the length of a character (in bits)?"
18922. ./myread
18923charbits="$ans"
18924$rm_try
18925case "$charbits" in
189268)	;;
18927*)	cat >&4 << EOM
18928Your system has an unsigned character size of $charbits bits, which
18929is rather unusual (normally it is 8 bits).  Perl likely will not work
18930correctly on your system, with subtle bugs in various places.
18931EOM
18932	rp='Do you really want to continue?'
18933	dflt='n'
18934	. ./myread
18935	case "$ans" in
18936		[yY])	echo >&4 "Okay, continuing."	;;
18937		*)	exit 1				;;
18938	esac
18939esac
18940
18941: how do we concatenate cpp tokens here?
18942echo " "
18943echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18944$cat >cpp_stuff.c <<'EOCP'
18945#define RCAT(a,b)a/**/b
18946#define ACAT(a,b)a ## b
18947RCAT(Rei,ser)
18948ACAT(Cir,cus)
18949EOCP
18950$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18951if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18952	echo "Oh!  Smells like ANSI's been here." >&4
18953	echo "We can catify or stringify, separately or together!"
18954	cpp_stuff=42
18955elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18956	echo "Ah, yes!  The good old days!" >&4
18957	echo "However, in the good old days we don't know how to stringify and"
18958	echo "catify at the same time."
18959	cpp_stuff=1
18960else
18961	$cat >&4 <<EOM
18962Hmm, I don't seem to be able to concatenate tokens with your cpp.
18963You're going to have to edit the values of CAT[2-5] in config.h...
18964EOM
18965	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18966fi
18967$rm -f cpp_stuff.*
18968
18969: see if this is a db.h system
18970set db.h i_db
18971eval $inhdr
18972
18973case "$i_db" in
18974$define)
18975	: Check db version.
18976	echo " "
18977	echo "Checking Berkeley DB version ..." >&4
18978	$cat >try.c <<EOCP
18979#$d_const HASCONST
18980#ifndef HASCONST
18981#define const
18982#endif
18983#include <sys/types.h>
18984#include <stdio.h>
18985#$i_stdlib I_STDLIB
18986#ifdef I_STDLIB
18987#include <stdlib.h>
18988#endif
18989#include <db.h>
18990int main(int argc, char *argv[])
18991{
18992#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
18993    int Major, Minor, Patch ;
18994    unsigned long Version ;
18995    (void)db_version(&Major, &Minor, &Patch) ;
18996    if (argc == 2) {
18997        printf("%d %d %d %d %d %d\n",
18998               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18999               Major, Minor, Patch);
19000        exit(0);
19001    }
19002    printf("You have Berkeley DB Version 2 or greater.\n");
19003
19004    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19005		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19006    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19007		Major, Minor, Patch) ;
19008
19009    /* check that db.h & libdb are compatible */
19010    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19011	printf("db.h and libdb are incompatible.\n") ;
19012        exit(3);
19013    }
19014
19015    printf("db.h and libdb are compatible.\n") ;
19016
19017    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19018		+ DB_VERSION_PATCH ;
19019
19020    /* needs to be >= 2.3.4 */
19021    if (Version < 2003004) {
19022    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19023	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19024        exit(2);
19025    }
19026
19027    exit(0);
19028#else
19029#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19030    if (argc == 2) {
19031        printf("1 0 0\n");
19032        exit(0);
19033    }
19034    printf("You have Berkeley DB Version 1.\n");
19035    exit(0);	/* DB version < 2: the coast is clear. */
19036#else
19037    exit(1);	/* <db.h> not Berkeley DB? */
19038#endif
19039#endif
19040}
19041EOCP
19042	set try
19043	if eval $compile_ok && $run ./try; then
19044		echo 'Looks OK.' >&4
19045		set `$run ./try 1`
19046		db_version_major=$1
19047		db_version_minor=$2
19048		db_version_patch=$3
19049	else
19050		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19051		i_db=$undef
19052		case " $libs " in
19053		*"-ldb "*)
19054			: Remove db from list of libraries to use
19055			echo "Removing unusable -ldb from library list" >&4
19056			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19057			shift
19058			libs="$*"
19059			echo "libs = $libs" >&4
19060			;;
19061		esac
19062	fi
19063	$rm_try
19064	;;
19065esac
19066
19067case "$i_db" in
19068define)
19069	: Check the return type needed for hash
19070	echo " "
19071	echo "Checking return type needed for hash for Berkeley DB ..." >&4
19072	$cat >try.c <<EOCP
19073#$d_const HASCONST
19074#ifndef HASCONST
19075#define const
19076#endif
19077#include <sys/types.h>
19078#include <db.h>
19079
19080#ifndef DB_VERSION_MAJOR
19081u_int32_t hash_cb (ptr, size)
19082const void *ptr;
19083size_t size;
19084{
19085}
19086HASHINFO info;
19087int main()
19088{
19089	info.hash = hash_cb;
19090}
19091#endif
19092EOCP
19093	if $cc $ccflags -c try.c >try.out 2>&1 ; then
19094		if $contains warning try.out >>/dev/null 2>&1 ; then
19095			db_hashtype='int'
19096		else
19097			db_hashtype='u_int32_t'
19098		fi
19099	else
19100		: XXX Maybe we should just give up here.
19101		db_hashtype=u_int32_t
19102		$cat try.out >&4
19103		echo "Help:  I can't seem to compile the db test program." >&4
19104		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19105	fi
19106	$rm_try
19107	echo "Your version of Berkeley DB uses $db_hashtype for hash."
19108	;;
19109*)	db_hashtype=u_int32_t
19110	;;
19111esac
19112case "$i_db" in
19113define)
19114	: Check the return type needed for prefix
19115	echo " "
19116	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19117	cat >try.c <<EOCP
19118#$d_const HASCONST
19119#ifndef HASCONST
19120#define const
19121#endif
19122#include <sys/types.h>
19123#include <db.h>
19124
19125#ifndef DB_VERSION_MAJOR
19126size_t prefix_cb (key1, key2)
19127const DBT *key1;
19128const DBT *key2;
19129{
19130}
19131BTREEINFO info;
19132int main()
19133{
19134	info.prefix = prefix_cb;
19135}
19136#endif
19137EOCP
19138	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19139		if $contains warning try.out >>/dev/null 2>&1 ; then
19140			db_prefixtype='int'
19141		else
19142			db_prefixtype='size_t'
19143		fi
19144	else
19145		db_prefixtype='size_t'
19146		: XXX Maybe we should just give up here.
19147		$cat try.out >&4
19148		echo "Help:  I can't seem to compile the db test program." >&4
19149		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19150	fi
19151	$rm_try
19152	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19153	;;
19154*)	db_prefixtype='size_t'
19155	;;
19156esac
19157
19158: How can we generate normalized random numbers ?
19159echo " "
19160echo "Looking for a random number function..." >&4
19161case "$randfunc" in
19162'')
19163	if set drand48 val -f; eval $csym; $val; then
19164		dflt="drand48"
19165		echo "Good, found drand48()." >&4
19166	elif set random val -f; eval $csym; $val; then
19167		dflt="random"
19168		echo "OK, found random()." >&4
19169	else
19170		dflt="rand"
19171		echo "Yick, looks like I have to use rand()." >&4
19172	fi
19173	echo " "
19174	;;
19175*)
19176	dflt="$randfunc"
19177	;;
19178esac
19179cont=true
19180
19181case "$ccflags" in
19182*-Dmy_rand=*|*-Dmy_srand=*)
19183	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19184	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19185	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19186	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19187	;;
19188esac
19189
19190while $test "$cont"; do
19191	rp="Use which function to generate random numbers?"
19192	. ./myread
19193	if $test "$ans" = "$dflt"; then
19194		: null
19195	else
19196		randbits=''
19197	fi
19198	randfunc="$ans"
19199	if set $ans val -f; eval $csym; $val; then
19200		cont=''
19201	else
19202		dflt=y
19203		rp="I cannot find function $ans. Use that name anyway?"
19204		. ./myread
19205		dflt=rand
19206		case "$ans" in
19207			[yY]*) cont='';;
19208		esac
19209	fi
19210	case "$cont" in
19211	'')
19212		case "$randfunc" in
19213		drand48)
19214			drand01="drand48()"
19215			seedfunc="srand48"
19216			randbits=48
19217			randseedtype=long
19218			;;
19219		rand|random)
19220			case "$randbits" in
19221			'')
19222echo "Checking to see how many bits your $randfunc() function produces..." >&4
19223				$cat >try.c <<EOCP
19224#$i_unistd I_UNISTD
19225#$i_stdlib I_STDLIB
19226#include <stdio.h>
19227#ifdef I_UNISTD
19228#  include <unistd.h>
19229#endif
19230#ifdef I_STDLIB
19231#  include <stdlib.h>
19232#endif
19233int main()
19234{
19235	register int i;
19236	register unsigned long tmp;
19237	register unsigned long max = 0L;
19238
19239	for (i = 1000; i; i--) {
19240		tmp = (unsigned long) $randfunc();
19241		if (tmp > max) max = tmp;
19242	}
19243	for (i = 0; max; i++)
19244		max /= 2;
19245	printf("%d\n",i);
19246}
19247EOCP
19248				set try
19249				if eval $compile_ok; then
19250					dflt=`try`
19251				else
19252					dflt='?'
19253					echo "(I can't seem to compile the test program...)"
19254				fi
19255				;;
19256			*)
19257				dflt="$randbits"
19258				;;
19259			esac
19260			rp="How many bits does your $randfunc() function produce?"
19261			. ./myread
19262			randbits="$ans"
19263			$rm_try
19264			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19265			seedfunc="s$randfunc"
19266			randseedtype=unsigned
19267			;;
19268		*)
19269			dflt="31"
19270			rp="How many bits does your $randfunc() function produce?"
19271			. ./myread
19272			randbits="$ans"
19273			seedfunc="s$randfunc"
19274			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19275			if set $seedfunc val -f; eval $csym; $val; then
19276				echo "(Using $seedfunc() to seed random generator)"
19277			else
19278				echo "(Warning: no $seedfunc() to seed random generator)"
19279				seedfunc=rand
19280			fi
19281			randseedtype=unsigned
19282			;;
19283		esac
19284		;;
19285	esac
19286done
19287
19288: Determine if this is an EBCDIC system
19289echo " "
19290echo "Determining whether or not we are on an EBCDIC system..." >&4
19291$cat >try.c <<'EOM'
19292int main()
19293{
19294  if ('M'==0xd4) return 0;
19295  return 1;
19296}
19297EOM
19298
19299val=$undef
19300set try
19301if eval $compile_ok; then
19302	if $run ./try; then
19303		echo "You seem to speak EBCDIC." >&4
19304		val="$define"
19305	else
19306		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19307	fi
19308else
19309	echo "I'm unable to compile the test program." >&4
19310	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19311fi
19312$rm_try
19313set ebcdic
19314eval $setvar
19315
19316: Check how to flush
19317echo " "
19318$cat >&4 <<EOM
19319Checking how to flush all pending stdio output...
19320EOM
19321# I only know how to find the first 32 possibly open files on SunOS.
19322# See also hints/sunos_4_1.sh and util.c  --AD
19323case "$osname" in
19324sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19325esac
19326$cat >>try.c <<EOCP
19327#include <stdio.h>
19328#$i_stdlib I_STDLIB
19329#ifdef I_STDLIB
19330#include <stdlib.h>
19331#endif
19332#$i_unistd I_UNISTD
19333#ifdef I_UNISTD
19334# include <unistd.h>
19335#endif
19336#$d_sysconf HAS_SYSCONF
19337#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19338#ifdef HAS_STDIO_STREAM_ARRAY
19339# define STDIO_STREAM_ARRAY $stdio_stream_array
19340#endif
19341int main() {
19342  FILE* p;
19343  unlink("try.out");
19344  p = fopen("try.out", "w");
19345#ifdef TRY_FPUTC
19346  fputc('x', p);
19347#else
19348# ifdef TRY_FPRINTF
19349  fprintf(p, "x");
19350# endif
19351#endif
19352#ifdef TRY_FFLUSH_NULL
19353  fflush(NULL);
19354#endif
19355#ifdef TRY_FFLUSH_ALL
19356  {
19357    long open_max = -1;
19358# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19359    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19360# else
19361#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19362    open_max = sysconf(_SC_OPEN_MAX);
19363#  else
19364#   ifdef FOPEN_MAX
19365    open_max = FOPEN_MAX;
19366#   else
19367#    ifdef OPEN_MAX
19368    open_max = OPEN_MAX;
19369#    else
19370#     ifdef _NFILE
19371    open_max = _NFILE;
19372#     endif
19373#    endif
19374#   endif
19375#  endif
19376# endif
19377# ifdef HAS_STDIO_STREAM_ARRAY
19378    if (open_max > 0) {
19379      long i;
19380      for (i = 0; i < open_max; i++)
19381	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19382		STDIO_STREAM_ARRAY[i]._file < open_max &&
19383		STDIO_STREAM_ARRAY[i]._flag)
19384		fflush(&STDIO_STREAM_ARRAY[i]);
19385    }
19386  }
19387# endif
19388#endif
19389  _exit(42);
19390}
19391EOCP
19392: first we have to find out how _not_ to flush
19393$to try.c
19394if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19395    output=''
19396    set try -DTRY_FPUTC
19397    if eval $compile; then
19398 	    $run ./try 2>/dev/null
19399	    code="$?"
19400	    $from try.out
19401	    if $test ! -s try.out -a "X$code" = X42; then
19402		output=-DTRY_FPUTC
19403	    fi
19404    fi
19405    case "$output" in
19406    '')
19407	    set try -DTRY_FPRINTF
19408	    if eval $compile; then
19409 		    $run ./try 2>/dev/null
19410		    code="$?"
19411		    $from try.out
19412		    if $test ! -s try.out -a "X$code" = X42; then
19413			output=-DTRY_FPRINTF
19414		    fi
19415	    fi
19416	;;
19417    esac
19418fi
19419: check for fflush NULL behaviour
19420case "$fflushNULL" in
19421'') 	set try -DTRY_FFLUSH_NULL $output
19422	if eval $compile; then
19423	    	$run ./try 2>/dev/null
19424		code="$?"
19425		$from try.out
19426		if $test -s try.out -a "X$code" = X42; then
19427			fflushNULL="`$cat try.out`"
19428		else
19429			if $test "X$code" != X42; then
19430				$cat >&4 <<EOM
19431(If this test failed, don't worry, we'll try another method shortly.)
19432EOM
19433			fi
19434		fi
19435	fi
19436	$rm -f core try.core core.try.*
19437	case "$fflushNULL" in
19438	x)	$cat >&4 <<EOM
19439Your fflush(NULL) works okay for output streams.
19440Let's see if it clobbers input pipes...
19441EOM
19442# As of mid-March 2000 all versions of Solaris appear to have a stdio
19443# bug that improperly flushes the input end of pipes.  So we avoid the
19444# autoflush on fork/system/exec support for now. :-(
19445$cat >tryp.c <<EOCP
19446#include <stdio.h>
19447int
19448main(int argc, char **argv)
19449{
19450    char buf[1024];
19451    int i;
19452    char *bp = buf;
19453    while (1) {
19454        while ((i = getc(stdin)) != -1
19455               && (*bp++ = i) != '\n'
19456               && bp < &buf[1024])
19457    	/* DO NOTHING */ ;
19458        *bp = '\0';
19459        fprintf(stdout, "%s", buf);
19460        fflush(NULL);
19461        if (i == -1)
19462	    return 0;
19463        bp = buf;
19464    }
19465}
19466EOCP
19467                fflushNULL="$define"
19468                set tryp
19469                if eval $compile; then
19470                    $rm -f tryp.out
19471                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19472                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19473                       $cat >&4 <<EOM
19474fflush(NULL) seems to behave okay with input streams.
19475EOM
19476			fflushNULL="$define"
19477                    else
19478			$cat >&4 <<EOM
19479Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19480EOM
19481                        fflushNULL="$undef"
19482                    fi
19483                fi
19484	        $rm -f core tryp.c tryp.core core.tryp.*
19485		;;
19486	'')	$cat >&4 <<EOM
19487Your fflush(NULL) isn't working (contrary to ANSI C).
19488EOM
19489		fflushNULL="$undef"
19490		;;
19491	*)	$cat >&4 <<EOM
19492Cannot figure out whether your fflush(NULL) works or not.
19493I'm assuming it doesn't (contrary to ANSI C).
19494EOM
19495		fflushNULL="$undef"
19496		;;
19497	esac
19498	;;
19499$define|true|[yY]*)
19500	fflushNULL="$define"
19501	;;
19502*)
19503	fflushNULL="$undef"
19504	;;
19505esac
19506: check explicit looping only if NULL did not work, and if the pipe
19507: bug does not show up on an explicit flush too
19508case "$fflushNULL" in
19509"$undef")
19510	$cat >tryp.c <<EOCP
19511#include <stdio.h>
19512int
19513main(int argc, char **argv)
19514{
19515    char buf[1024];
19516    int i;
19517    char *bp = buf;
19518    while (1) {
19519	while ((i = getc(stdin)) != -1
19520	       && (*bp++ = i) != '\n'
19521	       && bp < &buf[1024])
19522	/* DO NOTHING */ ;
19523	*bp = '\0';
19524	fprintf(stdout, "%s", buf);
19525	fflush(stdin);
19526	if (i == -1)
19527	    return 0;
19528	bp = buf;
19529    }
19530}
19531EOCP
19532	set tryp
19533	if eval $compile; then
19534	    $rm -f tryp.out
19535	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19536	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19537	       $cat >&4 <<EOM
19538Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19539EOM
19540		: now check for fflushall behaviour
19541		case "$fflushall" in
19542		'') 	set try -DTRY_FFLUSH_ALL $output
19543			if eval $compile; then
19544				$cat >&4 <<EOM
19545(Now testing the other method--but note that this also may fail.)
19546EOM
19547				$run ./try 2>/dev/null
19548				code=$?
19549				$from try.out
19550				if $test -s try.out -a "X$code" = X42; then
19551					fflushall="`$cat try.out`"
19552				fi
19553			fi
19554			$rm_try
19555			case "$fflushall" in
19556			x)	$cat >&4 <<EOM
19557Whew. Flushing explicitly all the stdio streams works.
19558EOM
19559				fflushall="$define"
19560				;;
19561			'')	$cat >&4 <<EOM
19562Sigh. Flushing explicitly all the stdio streams doesn't work.
19563EOM
19564				fflushall="$undef"
19565				;;
19566			*)	$cat >&4 <<EOM
19567Cannot figure out whether flushing stdio streams explicitly works or not.
19568I'm assuming it doesn't.
19569EOM
19570				fflushall="$undef"
19571				;;
19572			esac
19573			;;
19574		"$define"|true|[yY]*)
19575			fflushall="$define"
19576			;;
19577		*)
19578			fflushall="$undef"
19579			;;
19580		esac
19581	    else
19582		$cat >&4 <<EOM
19583All is futile.  Even fflush(stdin) clobbers input pipes!
19584EOM
19585		fflushall="$undef"
19586	    fi
19587	else
19588	    fflushall="$undef"
19589	fi
19590	$rm -f core tryp.c tryp.core core.tryp.*
19591	;;
19592*)	fflushall="$undef"
19593	;;
19594esac
19595
19596case "$fflushNULL$fflushall" in
19597undefundef)
19598	$cat <<EOM
19599OK, I give up.  I cannot figure out how to flush pending stdio output.
19600We won't be flushing handles at all before fork/exec/popen.
19601EOM
19602	;;
19603esac
19604$rm_try tryp
19605
19606: Store the full pathname to the ar program for use in the C program
19607: Respect a hint or command line value for full_ar.
19608case "$full_ar" in
19609'') full_ar=$ar ;;
19610esac
19611
19612: Store the full pathname to the sed program for use in the C program
19613full_sed=$sed
19614
19615: see what type gids are declared as in the kernel
19616echo " "
19617echo "Looking for the type for group ids returned by getgid()."
19618set gid_t gidtype xxx stdio.h sys/types.h
19619eval $typedef
19620case "$gidtype" in
19621xxx)
19622	xxx=`./findhdr sys/user.h`
19623	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19624	case $1 in
19625	unsigned) dflt="$1 $2" ;;
19626	*) dflt="$1" ;;
19627	esac
19628	;;
19629*) dflt="$gidtype";;
19630esac
19631case "$gidtype" in
19632gid_t) echo "gid_t found." ;;
19633*)	rp="What is the type for group ids returned by getgid()?"
19634	. ./myread
19635	gidtype="$ans"
19636	;;
19637esac
19638
19639: Check the size of GID
19640echo " "
19641case "$gidtype" in
19642*_t) zzz="$gidtype"	;;
19643*)   zzz="gid"		;;
19644esac
19645echo "Checking the size of $zzz..." >&4
19646cat > try.c <<EOCP
19647#include <sys/types.h>
19648#include <stdio.h>
19649#$i_stdlib I_STDLIB
19650#ifdef I_STDLIB
19651#include <stdlib.h>
19652#endif
19653int main() {
19654    printf("%d\n", (int)sizeof($gidtype));
19655    exit(0);
19656}
19657EOCP
19658set try
19659if eval $compile_ok; then
19660	yyy=`$run ./try`
19661	case "$yyy" in
19662	'')	gidsize=4
19663		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19664		;;
19665	*)	gidsize=$yyy
19666		echo "Your $zzz is $gidsize bytes long."
19667		;;
19668	esac
19669else
19670	gidsize=4
19671	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19672fi
19673
19674
19675: Check if GID is signed
19676echo " "
19677case "$gidtype" in
19678*_t) zzz="$gidtype"	;;
19679*)   zzz="gid"		;;
19680esac
19681echo "Checking the sign of $zzz..." >&4
19682cat > try.c <<EOCP
19683#include <sys/types.h>
19684#include <stdio.h>
19685int main() {
19686	$gidtype foo = -1;
19687	if (foo < 0)
19688		printf("-1\n");
19689	else
19690		printf("1\n");
19691}
19692EOCP
19693set try
19694if eval $compile; then
19695	yyy=`$run ./try`
19696	case "$yyy" in
19697	'')	gidsign=1
19698		echo "(I can't execute the test program--guessing unsigned.)" >&4
19699		;;
19700	*)	gidsign=$yyy
19701		case "$gidsign" in
19702		 1) echo "Your $zzz is unsigned." ;;
19703		-1) echo "Your $zzz is signed."   ;;
19704		esac
19705		;;
19706	esac
19707else
19708	gidsign=1
19709	echo "(I can't compile the test program--guessing unsigned.)" >&4
19710fi
19711
19712
19713: Check 64bit sizes
19714echo " "
19715
19716if $test X"$quadtype" != X; then
19717
19718echo "Checking how to print 64-bit integers..." >&4
19719
19720if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19721	$cat >try.c <<'EOCP'
19722#include <sys/types.h>
19723#include <stdio.h>
19724int main() {
19725  int q = 12345678901;
19726  printf("%ld\n", q);
19727}
19728EOCP
19729	set try
19730	if eval $compile; then
19731		yyy=`$run ./try`
19732		case "$yyy" in
19733		12345678901)
19734			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19735                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19736			echo "We will use %d."
19737			;;
19738		esac
19739	fi
19740fi
19741
19742if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19743	$cat >try.c <<'EOCP'
19744#include <sys/types.h>
19745#include <stdio.h>
19746int main() {
19747  long q = 12345678901;
19748  printf("%ld\n", q);
19749}
19750EOCP
19751	set try
19752	if eval $compile; then
19753		yyy=`$run ./try`
19754		case "$yyy" in
19755		12345678901)
19756			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19757                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19758			echo "We will use %ld."
19759			;;
19760		esac
19761	fi
19762fi
19763
19764if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19765	$cat >try.c <<'EOCP'
19766#include <sys/types.h>
19767#include <inttypes.h>
19768#include <stdio.h>
19769int main() {
19770  int64_t q = 12345678901;
19771  printf("%" PRId64 "\n", q);
19772}
19773EOCP
19774	set try
19775	if eval $compile; then
19776		yyy=`$run ./try`
19777		case "$yyy" in
19778		12345678901)
19779			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19780                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19781			echo "We will use the C9X style."
19782			;;
19783		esac
19784	fi
19785fi
19786
19787if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19788	$cat >try.c <<EOCP
19789#include <sys/types.h>
19790#include <stdio.h>
19791int main() {
19792  $quadtype q = 12345678901;
19793  printf("%Ld\n", q);
19794}
19795EOCP
19796	set try
19797	if eval $compile; then
19798		yyy=`$run ./try`
19799		case "$yyy" in
19800		12345678901)
19801			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19802                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19803			echo "We will use %Ld."
19804			;;
19805		esac
19806	fi
19807fi
19808
19809if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19810	$cat >try.c <<'EOCP'
19811#include <sys/types.h>
19812#include <stdio.h>
19813int main() {
19814  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19815  printf("%lld\n", q);
19816}
19817EOCP
19818	set try
19819	if eval $compile; then
19820		yyy=`$run ./try`
19821		case "$yyy" in
19822		12345678901)
19823			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19824                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19825			echo "We will use the %lld style."
19826			;;
19827		esac
19828	fi
19829fi
19830
19831if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19832	$cat >try.c <<EOCP
19833#include <sys/types.h>
19834#include <stdio.h>
19835int main() {
19836  $quadtype q = 12345678901;
19837  printf("%qd\n", q);
19838}
19839EOCP
19840	set try
19841	if eval $compile; then
19842		yyy=`$run ./try`
19843		case "$yyy" in
19844		12345678901)
19845			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19846                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19847			echo "We will use %qd."
19848			;;
19849		esac
19850	fi
19851fi
19852
19853if $test X"$sPRId64" = X; then
19854	echo "Cannot figure out how to print 64-bit integers." >&4
19855fi
19856$rm_try
19857
19858fi
19859
19860case "$sPRId64" in
19861'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19862	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19863	;;
19864*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19865	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19866	;;
19867esac
19868
19869: Check format strings for internal types
19870echo " "
19871$echo "Checking the format strings to be used for Perl's internal types..." >&4
19872
19873if $test X"$ivsize" = X8; then
19874	ivdformat="$sPRId64"
19875	uvuformat="$sPRIu64"
19876	uvoformat="$sPRIo64"
19877	uvxformat="$sPRIx64"
19878	uvXUformat="$sPRIXU64"
19879else
19880	if $test X"$ivsize" = X"$longsize"; then
19881		ivdformat='"ld"'
19882		uvuformat='"lu"'
19883		uvoformat='"lo"'
19884		uvxformat='"lx"'
19885		uvXUformat='"lX"'
19886	else
19887		if $test X"$ivsize" = X"$intsize"; then
19888			ivdformat='"d"'
19889			uvuformat='"u"'
19890			uvoformat='"o"'
19891			uvxformat='"x"'
19892			uvXUformat='"X"'
19893		else
19894			: far out
19895			if $test X"$ivsize" = X"$shortsize"; then
19896				ivdformat='"hd"'
19897				uvuformat='"hu"'
19898				uvoformat='"ho"'
19899				uvxformat='"hx"'
19900				uvXUformat='"hX"'
19901			fi
19902		fi
19903	fi
19904fi
19905
19906if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19907	nveformat="$sPRIeldbl"
19908	nvfformat="$sPRIfldbl"
19909	nvgformat="$sPRIgldbl"
19910	nvEUformat="$sPRIEUldbl"
19911	nvFUformat="$sPRIFUldbl"
19912	nvGUformat="$sPRIGUldbl"
19913else
19914	nveformat='"e"'
19915	nvfformat='"f"'
19916	nvgformat='"g"'
19917	nvEUformat='"E"'
19918	nvFUformat='"F"'
19919	nvGUformat='"G"'
19920fi
19921
19922case "$ivdformat" in
19923'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19924    exit 1
19925    ;;
19926esac
19927
19928: Check format string for GID
19929
19930echo " "
19931$echo "Checking the format string to be used for gids..." >&4
19932
19933case "$gidsign" in
19934-1)	if $test X"$gidsize" = X"$ivsize"; then
19935		gidformat="$ivdformat"
19936	else
19937		if $test X"$gidsize" = X"$longsize"; then
19938			gidformat='"ld"'
19939		else
19940			if $test X"$gidsize" = X"$intsize"; then
19941				gidformat='"d"'
19942			else
19943				if $test X"$gidsize" = X"$shortsize"; then
19944					gidformat='"hd"'
19945				fi
19946			fi
19947		fi
19948	fi
19949	;;
19950*)	if $test X"$gidsize" = X"$uvsize"; then
19951		gidformat="$uvuformat"
19952	else
19953		if $test X"$gidsize" = X"$longsize"; then
19954			gidformat='"lu"'
19955		else
19956			if $test X"$gidsize" = X"$intsize"; then
19957				gidformat='"u"'
19958			else
19959				if $test X"$gidsize" = X"$shortsize"; then
19960					gidformat='"hu"'
19961				fi
19962			fi
19963		fi
19964	fi
19965	;;
19966esac
19967
19968: see if getgroups exists
19969set getgroups d_getgrps
19970eval $inlibc
19971
19972: see if setgroups exists
19973set setgroups d_setgrps
19974eval $inlibc
19975
19976: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19977echo " "
19978case "$d_getgrps$d_setgrps" in
19979*define*)
19980	case "$groupstype" in
19981	'') dflt="$gidtype" ;;
19982	*)  dflt="$groupstype" ;;
19983	esac
19984	$cat <<EOM
19985What type of pointer is the second argument to getgroups() and setgroups()?
19986Usually this is the same as group ids, $gidtype, but not always.
19987
19988EOM
19989	rp='What type pointer is the second argument to getgroups() and setgroups()?'
19990	. ./myread
19991	groupstype="$ans"
19992	;;
19993*)  groupstype="$gidtype";;
19994esac
19995
19996: MAD = Misc Attribute Definition
19997
19998if $test $patchlevel -lt 9; then
19999: MAD is not available in 5.8.x or earlier.
20000    ans=n;
20001else
20002    case "$mad" in
20003    $define|true|[yY]*)	dflt='y' ;;
20004    *)			dflt='n' ;;
20005    esac
20006    cat <<EOM
20007
20008Would you like to build with Misc Attribute Decoration? This is development
20009work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20010overhead on the interpreter.
20011
20012If this doesn't make any sense to you, just accept the default '$dflt'.
20013EOM
20014    rp='Build Perl with MAD?'
20015    . ./myread
20016fi
20017case "$ans" in
20018y|Y)	val="$define"
20019	madlyh='madly.h madly.act madly.tab'
20020	madlysrc='madly.c'
20021	madlyobj="madly$_o" ;;
20022*)	val="$undef"
20023	madlyh=''
20024	madlysrc=''
20025	madlyobj='' ;;
20026esac
20027set mad
20028eval $setvar
20029
20030: check whether make sets MAKE
20031echo " "
20032echo "Checking if your $make program sets \$(MAKE)..." >&4
20033case "$make_set_make" in
20034'')
20035	$sed 's/^X //' > testmake.mak << 'EOF'
20036Xall:
20037X 	@echo 'maketemp="$(MAKE)"'
20038EOF
20039	case "`$make -f testmake.mak 2>/dev/null`" in
20040	*maketemp=*) make_set_make='#' ;;
20041	*)	make_set_make="MAKE=$make" ;;
20042	esac
20043	$rm -f testmake.mak
20044	;;
20045esac
20046case "$make_set_make" in
20047'#') echo "Yup, it does.";;
20048*) echo "Nope, it doesn't.";;
20049esac
20050
20051: see what type is used for mode_t
20052rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20053set mode_t modetype int stdio.h sys/types.h
20054eval $typedef_ask
20055
20056: see if we need va_copy
20057echo " "
20058case "$i_stdarg" in
20059"$define")
20060	$cat >try.c <<EOCP
20061#include <stdarg.h>
20062#include <stdio.h>
20063#$i_stdlib I_STDLIB
20064#ifdef I_STDLIB
20065#include <stdlib.h>
20066#endif
20067#include <signal.h>
20068
20069int
20070ivfprintf(FILE *f, const char *fmt, va_list *valp)
20071{
20072  return vfprintf(f, fmt, *valp);
20073}
20074
20075int
20076myvfprintf(FILE *f, const  char *fmt, va_list val)
20077{
20078  return ivfprintf(f, fmt, &val);
20079}
20080
20081int
20082myprintf(char *fmt, ...)
20083{
20084  va_list val;
20085  va_start(val, fmt);
20086  return myvfprintf(stdout, fmt, val);
20087}
20088
20089int
20090main(int ac, char **av)
20091{
20092  signal(SIGSEGV, exit);
20093
20094  myprintf("%s%cs all right, then\n", "that", '\'');
20095  exit(0);
20096}
20097EOCP
20098	set try
20099	if eval $compile && $run ./try 2>&1 >/dev/null; then
20100		case "`$run ./try`" in
20101		"that's all right, then")
20102			okay=yes
20103			;;
20104		esac
20105	fi
20106	case "$okay" in
20107	yes)	echo "It seems that you don't need va_copy()." >&4
20108		need_va_copy="$undef"
20109		;;
20110	*)	echo "It seems that va_copy() or similar will be needed." >&4
20111		need_va_copy="$define"
20112		;;
20113	esac
20114	$rm_try
20115	;;
20116*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20117	;;
20118esac
20119
20120: see what type is used for size_t
20121rp="What is the type used for the length parameter for string functions?"
20122set size_t sizetype 'unsigned int' stdio.h sys/types.h
20123eval $typedef_ask
20124
20125: check for type of arguments to gethostbyaddr.
20126if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20127	case "$d_gethbyaddr" in
20128	$define)
20129		$cat <<EOM
20130
20131Checking to see what type of arguments are accepted by gethostbyaddr().
20132EOM
20133		hdrs="$define sys/types.h
20134			$d_socket sys/socket.h
20135			$i_niin netinet/in.h
20136			$i_netdb netdb.h
20137			$i_unistd unistd.h"
20138		: The first arg can 'char *' or 'void *'
20139		: The second arg is some of integral type
20140		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20141			for yyy in size_t long int; do
20142				case "$netdb_host_type" in
20143				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20144					if ./protochk "$try" $hdrs; then
20145						echo "Your system accepts $xxx for the first arg."
20146						echo "...and $yyy for the second arg."
20147						netdb_host_type="$xxx"
20148						netdb_hlen_type="$yyy"
20149					fi
20150					;;
20151				esac
20152			done
20153		done
20154		: In case none of those worked, prompt the user.
20155		case "$netdb_host_type" in
20156		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
20157			dflt='char *'
20158			. ./myread
20159			netdb_host_type=$ans
20160			rp='What is the type for the 2nd argument to gethostbyaddr?'
20161			dflt="$sizetype"
20162			. ./myread
20163			netdb_hlen_type=$ans
20164			;;
20165		esac
20166		;;
20167	*)	: no gethostbyaddr, so pick harmless defaults
20168		netdb_host_type='char *'
20169		netdb_hlen_type="$sizetype"
20170		;;
20171	esac
20172	# Remove the "const" if needed. -- but then we'll have a
20173	# prototype clash!
20174	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20175fi
20176
20177: check for type of argument to gethostbyname.
20178if test "X$netdb_name_type" = X ; then
20179	case "$d_gethbyname" in
20180	$define)
20181		$cat <<EOM
20182
20183Checking to see what type of argument is accepted by gethostbyname().
20184EOM
20185		hdrs="$define sys/types.h
20186			$d_socket sys/socket.h
20187			$i_niin netinet/in.h
20188			$i_netdb netdb.h
20189			$i_unistd unistd.h"
20190		for xxx in "const char *" "char *"; do
20191			case "$netdb_name_type" in
20192			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
20193				if ./protochk "$try" $hdrs; then
20194					echo "Your system accepts $xxx."
20195					netdb_name_type="$xxx"
20196				fi
20197				;;
20198			esac
20199		done
20200		: In case none of those worked, prompt the user.
20201		case "$netdb_name_type" in
20202		'')	rp='What is the type for the 1st argument to gethostbyname?'
20203			dflt='char *'
20204			. ./myread
20205			netdb_name_type=$ans
20206			;;
20207		esac
20208		;;
20209	*)	: no gethostbyname, so pick harmless default
20210		netdb_name_type='char *'
20211		;;
20212	esac
20213fi
20214
20215: check for type of 1st argument to getnetbyaddr.
20216if test "X$netdb_net_type" = X ; then
20217	case "$d_getnbyaddr" in
20218	$define)
20219		$cat <<EOM
20220
20221Checking to see what type of 1st argument is accepted by getnetbyaddr().
20222EOM
20223		hdrs="$define sys/types.h
20224			$d_socket sys/socket.h
20225			$i_niin netinet/in.h
20226			$i_netdb netdb.h
20227			$i_unistd unistd.h"
20228		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20229			case "$netdb_net_type" in
20230			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20231				if ./protochk "$try" $hdrs; then
20232					echo "Your system accepts $xxx."
20233					netdb_net_type="$xxx"
20234				fi
20235				;;
20236			esac
20237		done
20238		: In case none of those worked, prompt the user.
20239		case "$netdb_net_type" in
20240		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
20241			dflt='long'
20242			. ./myread
20243			netdb_net_type=$ans
20244			;;
20245		esac
20246		;;
20247	*)	: no getnetbyaddr, so pick harmless default
20248		netdb_net_type='long'
20249		;;
20250	esac
20251fi
20252: locate the preferred pager for this system
20253fn=f/
20254case "$pager" in
20255'')
20256	dflt=''
20257	case "$pg" in
20258	/*) dflt=$pg;;
20259	[a-zA-Z]:/*) dflt=$pg;;
20260	esac
20261	case "$more" in
20262	/*) dflt=$more;;
20263	[a-zA-Z]:/*) dflt=$more;;
20264	esac
20265	case "$less" in
20266	/*) dflt=$less;;
20267	[a-zA-Z]:/*) dflt=$less;;
20268	esac
20269	case "$dflt" in
20270	'') dflt=/usr/ucb/more;;
20271	esac
20272	;;
20273*)	dflt="$pager"
20274	fn="f/($pager)"
20275	;;
20276esac
20277echo " "
20278rp='What pager is used on your system?'
20279. ./getfile
20280pager="$ans"
20281
20282: see what type pids are declared as in the kernel
20283rp="What is the type of process ids on this system?"
20284set pid_t pidtype int stdio.h sys/types.h
20285eval $typedef_ask
20286
20287: see if ar generates random libraries by itself
20288echo " "
20289echo "Checking how to generate random libraries on your machine..." >&4
20290echo 'int bar1() { return bar2(); }' > bar1.c
20291echo 'int bar2() { return 2; }' > bar2.c
20292$cat > foo.c <<EOP
20293#$i_stdlib I_STDLIB
20294#ifdef I_STDLIB
20295#include <stdlib.h>
20296#endif
20297int main() { printf("%d\n", bar1()); exit(0); }
20298EOP
20299$cc $ccflags -c bar1.c >/dev/null 2>&1
20300$cc $ccflags -c bar2.c >/dev/null 2>&1
20301$cc $ccflags -c foo.c >/dev/null 2>&1
20302$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20303if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20304	$run ./foobar >/dev/null 2>&1; then
20305	echo "$ar appears to generate random libraries itself."
20306	orderlib=false
20307	if [ "X$ranlib" = "X" ]; then
20308	    ranlib=":"
20309	fi
20310elif $ar s bar$_a >/dev/null 2>&1 &&
20311	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20312	$run ./foobar >/dev/null 2>&1; then
20313		echo "a table of contents needs to be added with '$ar s'."
20314		orderlib=false
20315		ranlib="$ar s"
20316elif $ar ts bar$_a >/dev/null 2>&1 &&
20317	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20318	$run ./foobar >/dev/null 2>&1; then
20319		echo "a table of contents needs to be added with '$ar ts'."
20320		orderlib=false
20321		ranlib="$ar ts"
20322else
20323	case "$ranlib" in
20324	:) ranlib='';;
20325	'')
20326		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20327		$test -f $ranlib || ranlib=''
20328		;;
20329	esac
20330	if $test -n "$ranlib"; then
20331		echo "your system has '$ranlib'; we'll use that."
20332		orderlib=false
20333	else
20334		echo "your system doesn't seem to support random libraries"
20335		echo "so we'll use lorder and tsort to order the libraries."
20336		orderlib=true
20337		ranlib=":"
20338	fi
20339fi
20340$rm -f foo* bar*
20341
20342: see if this is a values.h system
20343set values.h i_values
20344eval $inhdr
20345
20346: Check the max offset that gmtime and localtime accept
20347echo "Checking max offsets that gmtime () accepts"
20348
20349case $i_values in
20350    define) yyy="#include <values.h>" ;;
20351    *)      yyy="" ;;
20352    esac
20353
20354case "$sGMTIME_min/$sGMTIME_max" in
20355    0/0|/)
20356	$cat >try.c <<EOCP
20357#include <sys/types.h>
20358#include <stdio.h>
20359#include <time.h>
20360$yyy
20361
20362int i;
20363struct tm *tmp;
20364time_t pt;
20365
20366void gm_check (time_t t, int min_year, int max_year)
20367{
20368    tmp = gmtime (&t);
20369    if ( tmp == NULL ||
20370	/* Check tm_year overflow */
20371	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20372	tmp = NULL;
20373    else
20374	pt = t;
20375    } /* gm_check */
20376
20377int check_max ()
20378{
20379    tmp = NULL;
20380    pt  = 0;
20381#ifdef MAXLONG
20382    gm_check (MAXLONG, 69, 0x7fffffff);
20383#endif
20384    if (tmp == NULL || tmp->tm_year < 0) {
20385	for (i = 63; i >= 0; i--) {
20386	    time_t x = pt | ((time_t)1 << i);
20387	    if (x < 0 || x < pt) continue;
20388	    gm_check (x, 69, 0x7fffffff);
20389	    }
20390	}
20391    printf ("sGMTIME_max=%ld\n", pt);
20392    return (0);
20393    } /* check_max */
20394
20395int check_min ()
20396{
20397    tmp = NULL;
20398    pt  = 0;
20399#ifdef MINLONG
20400    gm_check (MINLONG, -1900, 70);
20401#endif
20402    if (tmp == NULL) {
20403	for (i = 36; i >= 0; i--) {
20404	    time_t x = pt - ((time_t)1 << i);
20405	    if (x > 0) continue;
20406	    gm_check (x, -1900, 70);
20407	    }
20408	}
20409    printf ("sGMTIME_min=%ld\n", pt);
20410    return (0);
20411    } /* check_min */
20412
20413int main (int argc, char *argv[])
20414{
20415    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20416    check_max ();
20417    check_min ();
20418    return (0);
20419    } /* main */
20420EOCP
20421	set try
20422	if eval $compile; then
20423	    eval `$run ./try`
20424	else
20425	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20426	    fi
20427	$rm_try
20428	;;
20429    esac
20430
20431echo "Checking max offsets that localtime () accepts"
20432
20433case "$sLOCALTIME_min/$sLOCALTIME_max" in
20434    0/0|/)
20435	$cat >try.c <<EOCP
20436#include <sys/types.h>
20437#include <stdio.h>
20438#include <time.h>
20439$yyy
20440
20441int i;
20442struct tm *tmp;
20443time_t pt;
20444
20445void local_check (time_t t, int min_year, int max_year)
20446{
20447    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20448	tmp = NULL;
20449    else
20450	tmp = localtime (&t);
20451    if ( tmp == NULL ||
20452	/* Check tm_year overflow */
20453	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20454	tmp = NULL;
20455    else
20456	pt = t;
20457    } /* local_check */
20458
20459int check_max ()
20460{
20461    tmp = NULL;
20462    pt  = 0;
20463#ifdef MAXLONG
20464    local_check (MAXLONG, 69, 0x7fffffff);
20465#endif
20466    if (tmp == NULL || tmp->tm_year < 0) {
20467	for (i = 63; i >= 0; i--) {
20468	    time_t x = pt | ((time_t)1 << i);
20469	    if (x < 0 || x < pt) continue;
20470	    local_check (x, 69, 0x7fffffff);
20471	    }
20472	}
20473    printf ("sLOCALTIME_max=%ld\n", pt);
20474    return (0);
20475   } /* check_max */
20476
20477int check_min ()
20478{
20479    tmp = NULL;
20480    pt  = 0;
20481#ifdef MINLONG
20482    local_check (MINLONG, -1900, 70);
20483#endif
20484    if (tmp == NULL) {
20485	for (i = 36; i >= 0; i--) {
20486	    time_t x = pt - ((time_t)1 << i);
20487	    if (x > 0) continue;
20488	    local_check (x, -1900, 70);
20489	    }
20490	}
20491    printf ("sLOCALTIME_min=%ld\n", pt);
20492    return (0);
20493    } /* check_min */
20494
20495int main (int argc, char *argv[])
20496{
20497    check_max ();
20498    check_min ();
20499    return (0);
20500    } /* main */
20501EOCP
20502	set try
20503	if eval $compile; then
20504	    eval `$run ./try`
20505	else
20506	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20507	    fi
20508	$rm_try
20509	;;
20510    esac
20511
20512: check for type of arguments to select.
20513case "$selecttype" in
20514'') case "$d_select" in
20515	$define)
20516		echo " "
20517		$cat <<EOM
20518Checking to see what type of arguments are accepted by select().
20519EOM
20520		hdrs="$define sys/types.h
20521			$i_systime sys/time.h
20522			$i_sysselct sys/select.h
20523			$d_socket sys/socket.h"
20524		: The first arg can be int, unsigned, or size_t
20525		: The last arg may or may not be 'const'
20526		val=''
20527		: void pointer has been seen but using that
20528		: breaks the selectminbits test
20529		for xxx in 'fd_set *' 'int *'; do
20530			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20531				for tmo in 'struct timeval *' 'const struct timeval *'; do
20532					case "$val" in
20533					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20534						if ./protochk "$try" $hdrs; then
20535							echo "Your system accepts $xxx."
20536							val="$xxx"
20537						fi
20538						;;
20539					esac
20540				done
20541			done
20542		done
20543		case "$val" in
20544		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20545			case "$d_fd_set" in
20546				$define) dflt="fd_set *" ;;
20547				*)		dflt="int *" ;;
20548			esac
20549			. ./myread
20550			val=$ans
20551			;;
20552		esac
20553		selecttype="$val"
20554		;;
20555	*)	: no select, so pick a harmless default
20556		selecttype='int *'
20557		;;
20558	esac
20559	;;
20560esac
20561
20562: check for the select 'width'
20563case "$selectminbits" in
20564'') safebits=`expr $ptrsize \* 8`
20565    case "$d_select" in
20566	$define)
20567		$cat <<EOM
20568
20569Checking to see on how many bits at a time your select() operates...
20570EOM
20571		$cat >try.c <<EOCP
20572#include <sys/types.h>
20573#$i_time I_TIME
20574#$i_systime I_SYS_TIME
20575#$i_systimek I_SYS_TIME_KERNEL
20576#ifdef I_TIME
20577#   include <time.h>
20578#endif
20579#ifdef I_SYS_TIME
20580#   ifdef I_SYS_TIME_KERNEL
20581#	define KERNEL
20582#   endif
20583#   include <sys/time.h>
20584#   ifdef I_SYS_TIME_KERNEL
20585#	undef KERNEL
20586#   endif
20587#endif
20588#$i_sysselct I_SYS_SELECT
20589#ifdef I_SYS_SELECT
20590#include <sys/select.h>
20591#endif
20592#$d_socket HAS_SOCKET
20593#ifdef HAS_SOCKET
20594#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20595#endif
20596#include <stdio.h>
20597#$i_stdlib I_STDLIB
20598#ifdef I_STDLIB
20599#include <stdlib.h>
20600#endif
20601$selecttype b;
20602#define S sizeof(*(b))
20603#define MINBITS	64
20604#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20605#define NBITS  (NBYTES * 8)
20606int main() {
20607    char *s = (char *)malloc(NBYTES);
20608    struct timeval t;
20609    int i;
20610    FILE* fp;
20611    int fd;
20612
20613    if (!s)
20614	exit(1);
20615    fclose(stdin);
20616    fp = fopen("try.c", "r");
20617    if (fp == 0)
20618      exit(2);
20619    fd = fileno(fp);
20620    if (fd < 0)
20621      exit(3);
20622    b = ($selecttype)s;
20623    for (i = 0; i < NBITS; i++)
20624	FD_SET(i, b);
20625    t.tv_sec  = 0;
20626    t.tv_usec = 0;
20627    select(fd + 1, b, 0, 0, &t);
20628    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20629    free(s);
20630    printf("%d\n", i + 1);
20631    return 0;
20632}
20633EOCP
20634		set try
20635		if eval $compile_ok; then
20636			selectminbits=`$run ./try`
20637			case "$selectminbits" in
20638			'')	cat >&4 <<EOM
20639Cannot figure out on how many bits at a time your select() operates.
20640I'll play safe and guess it is $safebits bits.
20641EOM
20642				selectminbits=$safebits
20643				bits="$safebits bits"
20644				;;
20645			1)	bits="1 bit" ;;
20646			*)	bits="$selectminbits bits" ;;
20647			esac
20648			echo "Your select() operates on $bits at a time." >&4
20649		else
20650			rp='What is the minimum number of bits your select() operates on?'
20651			case "$byteorder" in
20652			12345678)	dflt=64 ;;
20653			1234)		dflt=32 ;;
20654			*)		dflt=1	;;
20655			esac
20656			. ./myread
20657			val=$ans
20658			selectminbits="$val"
20659		fi
20660		$rm_try
20661		;;
20662	*)	: no select, so pick a harmless default
20663		selectminbits=$safebits
20664		;;
20665	esac
20666	;;
20667esac
20668
20669: Trace out the files included by signal.h, then look for SIGxxx names.
20670if [ "X$fieldn" = X ]; then
20671	: Just make some guesses.  We check them later.
20672	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20673else
20674	xxx=`echo '#include <signal.h>' |
20675	$cppstdin $cppminus $cppflags 2>/dev/null |
20676	$grep '^[ 	]*#.*include' |
20677	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20678		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20679fi
20680xxxfiles=''
20681for xx in $xxx /dev/null ; do
20682	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
20683done
20684case "$xxxfiles" in
20685'')	xxxfiles=`./findhdr signal.h` ;;
20686esac
20687xxx=`awk '
20688$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20689	print substr($2, 4, 20)
20690}
20691$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20692	print substr($3, 4, 20)
20693}' $xxxfiles`
20694: Append some common names just in case the awk scan failed.
20695xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20696xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20697xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20698xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20699xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20700
20701: generate a few handy files for later
20702$cat > signal.c <<EOCP
20703#include <sys/types.h>
20704#include <signal.h>
20705#$i_stdlib I_STDLIB
20706#ifdef I_STDLIB
20707#include <stdlib.h>
20708#endif
20709#include <stdio.h>
20710int main() {
20711
20712/* Strange style to avoid deeply-nested #if/#else/#endif */
20713#ifndef NSIG
20714#  ifdef _NSIG
20715#    define NSIG (_NSIG)
20716#  endif
20717#endif
20718
20719#ifndef NSIG
20720#  ifdef SIGMAX
20721#    define NSIG (SIGMAX+1)
20722#  endif
20723#endif
20724
20725#ifndef NSIG
20726#  ifdef SIG_MAX
20727#    define NSIG (SIG_MAX+1)
20728#  endif
20729#endif
20730
20731#ifndef NSIG
20732#  ifdef _SIG_MAX
20733#    define NSIG (_SIG_MAX+1)
20734#  endif
20735#endif
20736
20737#ifndef NSIG
20738#  ifdef MAXSIG
20739#    define NSIG (MAXSIG+1)
20740#  endif
20741#endif
20742
20743#ifndef NSIG
20744#  ifdef MAX_SIG
20745#    define NSIG (MAX_SIG+1)
20746#  endif
20747#endif
20748
20749#ifndef NSIG
20750#  ifdef SIGARRAYSIZE
20751#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20752#  endif
20753#endif
20754
20755#ifndef NSIG
20756#  ifdef _sys_nsig
20757#    define NSIG (_sys_nsig) /* Solaris 2.5 */
20758#  endif
20759#endif
20760
20761/* Default to some arbitrary number that's big enough to get most
20762   of the common signals.
20763*/
20764#ifndef NSIG
20765#    define NSIG 50
20766#endif
20767
20768printf("NSIG %d\n", NSIG);
20769
20770#ifndef JUST_NSIG
20771
20772EOCP
20773
20774echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20775{
20776	printf "#ifdef SIG"; printf $1; printf "\n"
20777	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20778	printf $1; printf ");\n"
20779	printf "#endif\n"
20780}
20781END {
20782	printf "#endif /* JUST_NSIG */\n";
20783	printf "exit(0);\n}\n";
20784}
20785' >>signal.c
20786$cat >signal.awk <<'EOP'
20787BEGIN { ndups = 0 }
20788$1 ~ /^NSIG$/ { nsig = $2 }
20789($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20790    if ($2 > maxsig) { maxsig = $2 }
20791    if (sig_name[$2]) {
20792	dup_name[ndups] = $1
20793	dup_num[ndups] = $2
20794	ndups++
20795    }
20796    else {
20797	sig_name[$2] = $1
20798	sig_num[$2] = $2
20799    }
20800}
20801END {
20802    if (nsig == 0) {
20803    	nsig = maxsig + 1
20804    }
20805    printf("NSIG %d\n", nsig);
20806    for (n = 1; n < nsig; n++) {
20807 	if (sig_name[n]) {
20808 	    printf("%s %d\n", sig_name[n], sig_num[n])
20809	}
20810 	else {
20811 	    printf("NUM%d %d\n", n, n)
20812 	}
20813    }
20814    for (n = 0; n < ndups; n++) {
20815 	printf("%s %d\n", dup_name[n], dup_num[n])
20816    }
20817}
20818EOP
20819$cat >signal_cmd <<EOS
20820$startsh
20821if $test -s signal.lst; then
20822    echo "Using your existing signal.lst file"
20823	exit 0
20824fi
20825xxx="$xxx"
20826EOS
20827$cat >>signal_cmd <<'EOS'
20828
20829set signal
20830if eval $compile_ok; then
20831	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20832		$uniq | $awk -f signal.awk >signal.lst
20833else
20834	echo "(I can't seem be able to compile the whole test program)" >&4
20835	echo "(I'll try it in little pieces.)" >&4
20836	set signal -DJUST_NSIG
20837	if eval $compile_ok; then
20838		$run ./signal$_exe > signal.nsg
20839		$cat signal.nsg
20840	else
20841		echo "I can't seem to figure out how many signals you have." >&4
20842		echo "Guessing 50." >&4
20843		echo 'NSIG 50' > signal.nsg
20844	fi
20845	: Now look at all the signal names, one at a time.
20846	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20847		$cat > signal.c <<EOCP
20848#include <sys/types.h>
20849#include <signal.h>
20850#include <stdio.h>
20851int main() {
20852printf("$xx %d\n", SIG${xx});
20853return 0;
20854}
20855EOCP
20856		set signal
20857		if eval $compile; then
20858			echo "SIG${xx} found."
20859			$run ./signal$_exe  >> signal.ls1
20860		else
20861			echo "SIG${xx} NOT found."
20862		fi
20863	done
20864	if $test -s signal.ls1; then
20865		$cat signal.nsg signal.ls1 |
20866			$sort -n | $uniq | $awk -f signal.awk >signal.lst
20867	fi
20868
20869fi
20870if $test -s signal.lst; then
20871	:
20872else
20873	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20874	echo 'kill -l' >signal
20875	set X `csh -f <signal`
20876	$rm -f signal
20877	shift
20878	case $# in
20879	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20880	esac
20881	echo $@ | $tr ' ' $trnl | \
20882 	    $awk '{ printf "%s %d\n", $1, ++s; }
20883 		  END { printf "NSIG %d\n", ++s }' >signal.lst
20884fi
20885$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20886EOS
20887chmod a+x signal_cmd
20888$eunicefix signal_cmd
20889
20890: generate list of signal names
20891echo " "
20892case "$sig_name_init" in
20893'') doinit=yes ;;
20894*)  case "$sig_num_init" in
20895    ''|*,*) doinit=yes ;;
20896    esac ;;
20897esac
20898case "$doinit" in
20899yes)
20900	echo "Generating a list of signal names and numbers..." >&4
20901	. ./signal_cmd
20902 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20903 	sig_name=`$awk 'BEGIN { printf "ZERO " }
20904 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
20905 	sig_num=`$awk  'BEGIN { printf "0 " }
20906 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
20907 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
20908 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
20909 			     END	{ printf "0\n" }' signal.lst`
20910 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
20911 			     !/^NSIG/	{ printf "%d, ", $2}
20912 			     END	{ printf "0\n"}' signal.lst`
20913	;;
20914esac
20915echo "The following $sig_count signals are available:"
20916echo " "
20917echo $sig_name | $awk \
20918'BEGIN { linelen = 0 }
20919{
20920	for (i = 1; i <= NF; i++) {
20921		name = "SIG" $i " "
20922		linelen = linelen + length(name)
20923		if (linelen > 70) {
20924			printf "\n"
20925			linelen = length(name)
20926		}
20927		printf "%s", name
20928	}
20929	printf "\n"
20930}'
20931sig_size=`echo $sig_name | awk '{print NF}'`
20932$rm -f signal signal.c signal.awk signal.lst signal_cmd
20933
20934: Check size of size
20935echo " "
20936case "$sizetype" in
20937*_t) zzz="$sizetype"	;;
20938*)   zzz="filesize"	;;
20939esac
20940echo "Checking the size of $zzz..." >&4
20941cat > try.c <<EOCP
20942#include <sys/types.h>
20943#include <stdio.h>
20944#$i_stdlib I_STDLIB
20945#ifdef I_STDLIB
20946#include <stdlib.h>
20947#endif
20948int main() {
20949    printf("%d\n", (int)sizeof($sizetype));
20950    exit(0);
20951}
20952EOCP
20953set try
20954if eval $compile_ok; then
20955	yyy=`$run ./try`
20956	case "$yyy" in
20957	'')	sizesize=4
20958		echo "(I can't execute the test program--guessing $sizesize.)" >&4
20959		;;
20960	*)	sizesize=$yyy
20961		echo "Your $zzz size is $sizesize bytes."
20962		;;
20963	esac
20964else
20965	sizesize=4
20966	echo "(I can't compile the test program--guessing $sizesize.)" >&4
20967fi
20968
20969
20970: check for socklen_t
20971echo " "
20972echo "Checking to see if you have socklen_t..." >&4
20973$cat >try.c <<EOCP
20974#include <sys/types.h>
20975#$d_socket HAS_SOCKET
20976#ifdef HAS_SOCKET
20977#include <sys/socket.h>
20978#endif
20979int main() { socklen_t x = 16; }
20980EOCP
20981set try
20982if eval $compile; then
20983	val="$define"
20984	echo "You have socklen_t."
20985else
20986	val="$undef"
20987	echo "You do not have socklen_t."
20988	case "$sizetype" in
20989	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20990	esac
20991fi
20992$rm_try
20993set d_socklen_t
20994eval $setvar
20995
20996: see if this is a socks.h system
20997set socks.h i_socks
20998eval $inhdr
20999
21000: check for type of the size argument to socket calls
21001case "$d_socket" in
21002"$define")
21003	$cat <<EOM
21004
21005Checking to see what type is the last argument of accept().
21006EOM
21007	yyy=''
21008	case "$d_socklen_t" in
21009	"$define") yyy="$yyy socklen_t"
21010	esac
21011	yyy="$yyy $sizetype int long unsigned"
21012	for xxx in $yyy; do
21013		case "$socksizetype" in
21014		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21015			case "$usesocks" in
21016			"$define")
21017				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21018					echo "Your system accepts '$xxx *' for the last argument of accept()."
21019					socksizetype="$xxx"
21020				fi
21021				;;
21022			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21023					echo "Your system accepts '$xxx *' for the last argument of accept()."
21024					socksizetype="$xxx"
21025				fi
21026				;;
21027			esac
21028			;;
21029		esac
21030	done
21031: In case none of those worked, prompt the user.
21032	case "$socksizetype" in
21033	'')	rp='What is the type for socket address structure sizes?'
21034		dflt='int'
21035		. ./myread
21036		socksizetype=$ans
21037		;;
21038	esac
21039	;;
21040*)	: no sockets, so pick relatively harmless default
21041	socksizetype='int'
21042	;;
21043esac
21044
21045: see what type is used for signed size_t
21046set ssize_t ssizetype int stdio.h sys/types.h
21047eval $typedef
21048dflt="$ssizetype"
21049$cat > try.c <<EOM
21050#include <stdio.h>
21051#$i_stdlib I_STDLIB
21052#ifdef I_STDLIB
21053#include <stdlib.h>
21054#endif
21055#include <sys/types.h>
21056#define Size_t $sizetype
21057#define SSize_t $dflt
21058int main()
21059{
21060	if (sizeof(Size_t) == sizeof(SSize_t))
21061		printf("$dflt\n");
21062	else if (sizeof(Size_t) == sizeof(int))
21063		printf("int\n");
21064	else
21065		printf("long\n");
21066	exit(0);
21067}
21068EOM
21069echo " "
21070set try
21071if eval $compile_ok && $run ./try > /dev/null; then
21072	ssizetype=`$run ./try`
21073	echo "I'll be using $ssizetype for functions returning a byte count." >&4
21074else
21075	$cat >&4 <<EOM
21076Help! I can't compile and run the ssize_t test program: please enlighten me!
21077(This is probably a misconfiguration in your system or libraries, and
21078you really ought to fix it.  Still, I'll try anyway.)
21079
21080I need a type that is the same size as $sizetype, but is guaranteed to
21081be signed.  Common values are ssize_t, int and long.
21082
21083EOM
21084	rp="What signed type is the same size as $sizetype?"
21085	. ./myread
21086	ssizetype="$ans"
21087fi
21088$rm_try
21089
21090: see what type of char stdio uses.
21091echo " "
21092echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21093if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21094	echo "Your stdio uses unsigned chars." >&4
21095	stdchar="unsigned char"
21096else
21097	echo "Your stdio uses signed chars." >&4
21098	stdchar="char"
21099fi
21100$rm -f stdioh
21101
21102: see what type uids are declared as in the kernel
21103echo " "
21104echo "Looking for the type for user ids returned by getuid()."
21105set uid_t uidtype xxx stdio.h sys/types.h
21106eval $typedef
21107case "$uidtype" in
21108xxx)
21109	xxx=`./findhdr sys/user.h`
21110	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21111	case $1 in
21112	unsigned) dflt="$1 $2" ;;
21113	*) dflt="$1" ;;
21114	esac
21115	;;
21116*) dflt="$uidtype";;
21117esac
21118case "$uidtype" in
21119uid_t)	echo "uid_t found." ;;
21120*)	rp="What is the type for user ids returned by getuid()?"
21121	. ./myread
21122	uidtype="$ans"
21123	;;
21124esac
21125
21126: Check size of UID
21127echo " "
21128case "$uidtype" in
21129*_t) zzz="$uidtype"	;;
21130*)   zzz="uid"		;;
21131esac
21132echo "Checking the size of $zzz..." >&4
21133cat > try.c <<EOCP
21134#include <sys/types.h>
21135#include <stdio.h>
21136#$i_stdlib I_STDLIB
21137#ifdef I_STDLIB
21138#include <stdlib.h>
21139#endif
21140int main() {
21141    printf("%d\n", (int)sizeof($uidtype));
21142    exit(0);
21143}
21144EOCP
21145set try
21146if eval $compile_ok; then
21147	yyy=`$run ./try`
21148	case "$yyy" in
21149	'')	uidsize=4
21150		echo "(I can't execute the test program--guessing $uidsize.)" >&4
21151		;;
21152	*)	uidsize=$yyy
21153		echo "Your $zzz is $uidsize bytes long."
21154		;;
21155	esac
21156else
21157	uidsize=4
21158	echo "(I can't compile the test program--guessing $uidsize.)" >&4
21159fi
21160
21161: Check if UID is signed
21162echo " "
21163case "$uidtype" in
21164*_t) zzz="$uidtype"	;;
21165*)   zzz="uid"		;;
21166esac
21167echo "Checking the sign of $zzz..." >&4
21168cat > try.c <<EOCP
21169#include <sys/types.h>
21170#include <stdio.h>
21171int main() {
21172	$uidtype foo = -1;
21173	if (foo < 0)
21174		printf("-1\n");
21175	else
21176		printf("1\n");
21177}
21178EOCP
21179set try
21180if eval $compile; then
21181	yyy=`$run ./try`
21182	case "$yyy" in
21183	'')	uidsign=1
21184		echo "(I can't execute the test program--guessing unsigned.)" >&4
21185		;;
21186	*)	uidsign=$yyy
21187		case "$uidsign" in
21188		 1) echo "Your $zzz is unsigned." ;;
21189		-1) echo "Your $zzz is signed."   ;;
21190		esac
21191		;;
21192	esac
21193else
21194	uidsign=1
21195	echo "(I can't compile the test program--guessing unsigned.)" >&4
21196fi
21197
21198
21199: Check format string for UID
21200echo " "
21201$echo "Checking the format string to be used for uids..." >&4
21202
21203case "$uidsign" in
21204-1)	if $test X"$uidsize" = X"$ivsize"; then
21205		uidformat="$ivdformat"
21206	else
21207		if $test X"$uidsize" = X"$longsize"; then
21208			uidformat='"ld"'
21209		else
21210			if $test X"$uidsize" = X"$intsize"; then
21211				uidformat='"d"'
21212			else
21213				if $test X"$uidsize" = X"$shortsize"; then
21214					uidformat='"hd"'
21215				fi
21216			fi
21217		fi
21218	fi
21219	;;
21220*)	if $test X"$uidsize" = X"$uvsize"; then
21221		uidformat="$uvuformat"
21222	else
21223		if $test X"$uidsize" = X"$longsize"; then
21224			uidformat='"lu"'
21225		else
21226			if $test X"$uidsize" = X"$intsize"; then
21227				uidformat='"u"'
21228			else
21229				if $test X"$uidsize" = X"$shortsize"; then
21230					uidformat='"hu"'
21231				fi
21232			fi
21233		fi
21234	fi
21235	;;
21236esac
21237
21238: Check if site customization support was requested
21239case "$usesitecustomize" in
21240    $define|true|[Yy]*)
21241	usesitecustomize="$define"
21242	;;
21243    *)
21244	usesitecustomize="$undef"
21245	;;
21246    esac
21247
21248: see if prototypes support variable argument declarations
21249echo " "
21250case "$prototype$i_stdarg" in
21251$define$define)
21252	echo "It appears we'll be able to prototype varargs functions." >&4
21253	val="$define"
21254	;;
21255*)
21256	echo "Too bad... We won't be using prototyped varargs functions..." >&4
21257	val="$undef"
21258	;;
21259esac
21260set vaproto
21261eval $setvar
21262
21263: determine compiler compiler
21264case "$yacc" in
21265'')
21266	dflt=yacc;;
21267*)
21268	dflt="$yacc";;
21269esac
21270echo " "
21271comp='yacc'
21272if $test -f "$byacc$_exe"; then
21273	dflt="$byacc"
21274	comp="byacc or $comp"
21275fi
21276if $test -f "$bison$_exe"; then
21277	comp="$comp or bison -y"
21278fi
21279rp="Which compiler compiler ($comp) shall I use?"
21280. ./myread
21281yacc="$ans"
21282case "$yacc" in
21283*bis*)
21284	case "$yacc" in
21285	*-y*) ;;
21286	*)
21287		yacc="$yacc -y"
21288		echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21289		;;
21290	esac
21291	;;
21292esac
21293
21294: see if this is a assert.h system
21295set assert.h i_assert
21296eval $inhdr
21297
21298: see if this is a fp.h system
21299set fp.h i_fp
21300eval $inhdr
21301
21302: see if this is a fp_class.h system
21303set fp_class.h i_fp_class
21304eval $inhdr
21305
21306: see if gdbm.h is available
21307set gdbm.h t_gdbm
21308eval $inhdr
21309case "$t_gdbm" in
21310$define)
21311	: see if gdbm_open exists
21312	set gdbm_open d_gdbm_open
21313	eval $inlibc
21314	case "$d_gdbm_open" in
21315	$undef)
21316		t_gdbm="$undef"
21317		echo "We won't be including <gdbm.h>"
21318		;;
21319	esac
21320	;;
21321esac
21322val="$t_gdbm"
21323set i_gdbm
21324eval $setvar
21325
21326: see if this is a ieeefp.h system
21327case "$i_ieeefp" in
21328'' ) set ieeefp.h i_ieeefp
21329     eval $inhdr
21330     ;;
21331esac
21332
21333: see if this is a libutil.h system
21334set libutil.h i_libutil
21335eval $inhdr
21336
21337: see if mach cthreads are available
21338if test "X$usethreads" = "X$define"; then
21339	set mach/cthreads.h i_machcthr
21340	eval $inhdr
21341else
21342	i_machcthr="$undef"
21343fi
21344
21345: see if this is a mntent.h system
21346set mntent.h i_mntent
21347eval $inhdr
21348
21349: see if net/errno.h is available
21350val=''
21351set net/errno.h val
21352eval $inhdr
21353
21354: Unfortunately, it causes problems on some systems.  Arrgh.
21355case "$val" in
21356$define)
21357	cat > try.c <<'EOM'
21358#include <stdio.h>
21359#include <errno.h>
21360#include <net/errno.h>
21361int func()
21362{
21363	return ENOTSOCK;
21364}
21365EOM
21366	if $cc $ccflags -c try.c >/dev/null 2>&1; then
21367		echo "We'll be including <net/errno.h>." >&4
21368	else
21369		echo "We won't be including <net/errno.h>." >&4
21370		val="$undef"
21371	fi
21372	$rm_try
21373	;;
21374esac
21375set i_neterrno
21376eval $setvar
21377
21378: see if netinet/tcp.h is available
21379set netinet/tcp.h i_netinettcp
21380eval $inhdr
21381
21382: see if this is a poll.h system
21383set poll.h i_poll
21384eval $inhdr
21385
21386: see if this is a prot.h system
21387set prot.h i_prot
21388eval $inhdr
21389
21390: Preprocessor symbols
21391echo " "
21392$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21393$cat <<'EOSH' > Cppsym.know
21394a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21395AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21396alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21397ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21398BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21399BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21400bull c cadmus clipper CMU COFF COMPILER_VERSION
21401concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21402CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21403Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21404FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21405GLIBC GLIBC_MINOR
21406GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21407H3050R H3050RX hbullx20 hcx host_mips
21408hp200 hp300 hp700 HP700 hp800 hp9000
21409hp9000s200 hp9000s300 hp9000s400 hp9000s500
21410hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21411i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21412IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21413INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21414LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21415LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21416LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21417LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21418M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21419M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21420M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21421MATH_HAS_NO_SIDE_EFFECTS
21422mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21423mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21424mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21425MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21426mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21427NetBSD news1500 news1700 news1800 news1900 news3700
21428news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21429ns32016 ns32332 ns32k nsc32000
21430OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21431pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21432pc532 pdp11 PGC PIC plexus PORTAR posix
21433POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21434POSIX_C_SOURCE POSIX_SOURCE POWER
21435PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21436riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21437SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21438sony sony_news sonyrisc sparc sparclite spectrum
21439stardent stdc STDC_EXT stratos sun sun3 sun386
21440Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21441SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21442SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21443sysV68 sysV88 Tek4132 Tek4300 titan
21444TM3200 TM5400 TM5600
21445tower tower32 tower32_200 tower32_600 tower32_700
21446tower32_800 tower32_850 tss
21447u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21448ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21449unix UNIX95 UNIX99 unixpc unos
21450USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21451USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21452USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21453USGr4 USGr4_2
21454Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21455XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21456XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21457z8000
21458EOSH
21459# Maybe put other stuff here too.
21460cat <<EOSH >>Cppsym.know
21461$osname
21462EOSH
21463./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21464./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21465$cat Cppsym.know > Cppsym.c
21466$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21467$rm -f Cppsym.a Cppsym.b Cppsym.c
21468cat <<EOSH > Cppsym
21469$startsh
21470if $test \$# -gt 0; then
21471    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21472    if $test -s Cppsym.got; then
21473        $rm -f Cppsym.got
21474        exit 0
21475    fi
21476    $rm -f Cppsym.got
21477    exit 1
21478else
21479    $tr " " "$trnl" | ./Cppsym.try
21480    exit 0
21481fi
21482EOSH
21483chmod +x Cppsym
21484$eunicefix Cppsym
21485cat <<EOSH > Cppsym.try
21486$startsh
21487cat <<'EOCP' > try.c
21488#include <stdio.h>
21489#if cpp_stuff == 1
21490#define STRINGIFY(a)    "a"
21491#endif
21492#if cpp_stuff == 42
21493#define StGiFy(a)  #a
21494#define STRINGIFY(a)    StGiFy(a)
21495#endif
21496#if $cpp_stuff != 1 && $cpp_stuff != 42
21497#   include "Bletch: How does this C preprocessor stringify macros?"
21498#endif
21499int main() {
21500EOCP
21501$awk \\
21502EOSH
21503cat <<'EOSH' >> Cppsym.try
21504'length($1) > 0 {
21505    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21506    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21507    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21508    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21509}'	 >> try.c
21510echo 'return 0;}' >> try.c
21511EOSH
21512cat <<EOSH >> Cppsym.try
21513ccflags="$ccflags"
21514case "$osname-$gccversion" in
21515irix-) ccflags="\$ccflags -woff 1178" ;;
21516os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21517esac
21518$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21519EOSH
21520chmod +x Cppsym.try
21521$eunicefix Cppsym.try
21522./Cppsym < Cppsym.know > Cppsym.true
21523: Add in any linux cpp "predefined macros":
21524case "$osname::$gccversion" in
21525  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21526    tHdrH=_tmpHdr
21527    rm -f $tHdrH'.h' $tHdrH
21528    touch $tHdrH'.h'
21529    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21530       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21531       if [ -s $tHdrH'_cppsym.real' ]; then
21532	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21533       fi
21534    fi
21535    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21536  ;;
21537esac
21538: now check the C compiler for additional symbols
21539postprocess_cc_v=''
21540case "$osname" in
21541aix) postprocess_cc_v="|$tr , ' '" ;;
21542esac
21543$cat >ccsym <<EOS
21544$startsh
21545$cat >tmp.c <<EOF
21546extern int foo;
21547EOF
21548for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21549do
21550	case "\$i" in
21551	-D*) echo "\$i" | $sed 's/^-D//';;
21552	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21553	esac
21554done
21555$rm_try
21556EOS
21557postprocess_cc_v=''
21558chmod +x ccsym
21559$eunicefix ccsym
21560./ccsym > ccsym1.raw
21561if $test -s ccsym1.raw; then
21562       $sort ccsym1.raw | $uniq >ccsym.raw
21563else
21564       mv ccsym1.raw ccsym.raw
21565fi
21566
21567$awk '/\=/ { print $0; next }
21568	{ print $0"=1" }' ccsym.raw >ccsym.list
21569$comm -13 Cppsym.true ccsym.list >ccsym.own
21570$comm -12 Cppsym.true ccsym.list >ccsym.com
21571$comm -23 Cppsym.true ccsym.list >ccsym.cpp
21572also=''
21573if $test -z ccsym.raw; then
21574	echo "Your C compiler doesn't seem to define any symbols!" >&4
21575	echo " "
21576	echo "However, your C preprocessor defines the following symbols:"
21577	$cat Cppsym.true
21578    	ccsymbols=''
21579	cppsymbols=`$cat Cppsym.true`
21580        cppsymbols=`echo $cppsymbols`
21581	cppccsymbols="$cppsymbols"
21582else
21583	if $test -s ccsym.com; then
21584		echo "Your C compiler and pre-processor define these symbols:"
21585		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
21586		also='also '
21587		symbols='ones'
21588		cppccsymbols=`$cat ccsym.com`
21589		cppccsymbols=`echo $cppccsymbols`
21590		$test "$silent" || sleep 1
21591	fi
21592	if $test -s ccsym.cpp; then
21593		$test "$also" && echo " "
21594		echo "Your C pre-processor ${also}defines the following symbols:"
21595		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21596		also='further '
21597		cppsymbols=`$cat ccsym.cpp`
21598		cppsymbols=`echo $cppsymbols`
21599		$test "$silent" || sleep 1
21600	fi
21601	if $test -s ccsym.own; then
21602		$test "$also" && echo " "
21603		echo "Your C compiler ${also}defines the following cpp symbols:"
21604		$sed -e 's/\(..*\)=1/\1/' ccsym.own
21605		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21606	        ccsymbols=`$cat ccsym.own`
21607	        ccsymbols=`echo $ccsymbols`
21608		$test "$silent" || sleep 1
21609	fi
21610fi
21611
21612: see if this is a termio system
21613val="$undef"
21614val2="$undef"
21615val3="$undef"
21616if $test `./findhdr termios.h`; then
21617	set tcsetattr i_termios
21618	eval $inlibc
21619	val3="$i_termios"
21620fi
21621echo " "
21622case "$val3" in
21623"$define") echo "You have POSIX termios.h... good!" >&4;;
21624*) if ./Cppsym pyr; then
21625		case "`/bin/universe`" in
21626		ucb) if $test `./findhdr sgtty.h`; then
21627				val2="$define"
21628				echo "<sgtty.h> found." >&4
21629			else
21630				echo "System is pyramid with BSD universe."
21631				./warn "<sgtty.h> not found--you could have problems."
21632			fi;;
21633		*) if $test `./findhdr termio.h`; then
21634				val="$define"
21635				echo "<termio.h> found." >&4
21636			else
21637				echo "System is pyramid with USG universe."
21638				./warn "<termio.h> not found--you could have problems."
21639			fi;;
21640		esac
21641	elif ./usg; then
21642		if $test `./findhdr termio.h`; then
21643			echo "<termio.h> found." >&4
21644			val="$define"
21645		elif $test `./findhdr sgtty.h`; then
21646			echo "<sgtty.h> found." >&4
21647			val2="$define"
21648		else
21649			./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21650		fi
21651	else
21652		if $test `./findhdr sgtty.h`; then
21653			echo "<sgtty.h> found." >&4
21654			val2="$define"
21655		elif $test `./findhdr termio.h`; then
21656			echo "<termio.h> found." >&4
21657			val="$define"
21658		else
21659			./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21660		fi
21661	fi;;
21662esac
21663set i_termio; eval $setvar
21664val=$val2; set i_sgtty; eval $setvar
21665val=$val3; set i_termios; eval $setvar
21666
21667: see if stddef is available
21668set stddef.h i_stddef
21669eval $inhdr
21670
21671: see if sys/access.h is available
21672set sys/access.h i_sysaccess
21673eval $inhdr
21674
21675: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21676set sys/filio.h i_sysfilio
21677eval $inhdr
21678echo " "
21679if $test `./findhdr sys/ioctl.h`; then
21680	val="$define"
21681	echo '<sys/ioctl.h> found.' >&4
21682else
21683	val="$undef"
21684	if $test $i_sysfilio = "$define"; then
21685	    echo '<sys/ioctl.h> NOT found.' >&4
21686	else
21687		$test $i_sgtty = "$define" && xxx="sgtty.h"
21688		$test $i_termio = "$define" && xxx="termio.h"
21689		$test $i_termios = "$define" && xxx="termios.h"
21690echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21691	fi
21692fi
21693set i_sysioctl
21694eval $setvar
21695
21696: see if socket ioctl defs are in sys/sockio.h
21697echo " "
21698xxx=`./findhdr sys/sockio.h`
21699if $test "$xxx"; then
21700	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21701		val="$define"
21702		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21703	else
21704		val="$undef"
21705		echo "No socket ioctls found in <sys/sockio.h>." >&4
21706	fi
21707else
21708	val="$undef"
21709	$cat <<EOM
21710<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21711EOM
21712fi
21713set i_syssockio
21714eval $setvar
21715
21716: see if this is a syslog.h system
21717set syslog.h i_syslog
21718eval $inhdr
21719
21720: see if this is a sys/mode.h system
21721set sys/mode.h i_sysmode
21722eval $inhdr
21723
21724: see if there is a sys/poll.h file
21725set sys/poll.h i_syspoll
21726eval $inhdr
21727
21728: see if sys/resource.h has to be included
21729set sys/resource.h i_sysresrc
21730eval $inhdr
21731
21732: see if sys/security.h is available
21733set sys/security.h i_syssecrt
21734eval $inhdr
21735
21736: see if this is a sys/statvfs.h system
21737set sys/statvfs.h i_sysstatvfs
21738eval $inhdr
21739
21740: see if this is a sys/un.h system
21741set sys/un.h i_sysun
21742eval $inhdr
21743
21744: see if this is a sys/utsname.h system
21745set sys/utsname.h i_sysutsname
21746eval $inhdr
21747
21748: see if this is a syswait system
21749set sys/wait.h i_syswait
21750eval $inhdr
21751
21752: see if this is a ustat.h system
21753set ustat.h i_ustat
21754eval $inhdr
21755
21756: see if this is an utime system
21757set utime.h i_utime
21758eval $inhdr
21759
21760: see if this is a vfork system
21761case "$d_vfork" in
21762"$define")
21763	set vfork.h i_vfork
21764	eval $inhdr
21765	;;
21766*)
21767	i_vfork="$undef"
21768	;;
21769esac
21770
21771: Check extensions
21772echo " "
21773echo "Looking for extensions..." >&4
21774: If we are using the old config.sh, known_extensions may contain
21775: old or inaccurate or duplicate values.
21776known_extensions=''
21777nonxs_extensions=''
21778: We do not use find because it might not be available.
21779: We do not just use MANIFEST because the user may have dropped
21780: some additional extensions into the source tree and expect them
21781: to be built.
21782
21783: Function to recursively find available extensions, ignoring DynaLoader
21784: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21785: In 5.10.1 and later, extensions are stored in directories
21786: like File-Glob instead of the older File/Glob/.
21787find_extensions='
21788    for xxx in *; do
21789	case "$xxx" in
21790	    DynaLoader|dynaload) ;;
21791	    *)
21792	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21793	    leaf=`echo $xxx | $sed -e s/.*-//`;
21794	    if $test -d File; then
21795		if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21796		    known_extensions="$known_extensions $1$this_ext";
21797		elif $test -f $xxx/Makefile.PL; then
21798		    nonxs_extensions="$nonxs_extensions $1$this_ext";
21799		else
21800		    if $test -d $xxx -a $# -lt 10; then
21801			set $1$xxx/ $*;
21802			cd "$xxx";
21803			eval $find_extensions;
21804			cd ..;
21805			shift;
21806		    fi;
21807		fi;
21808	    else
21809		$ls -1 $xxx > $$.tmp;
21810		if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21811		    known_extensions="$known_extensions $this_ext";
21812		elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21813		    known_extensions="$known_extensions $this_ext";
21814		elif $test -d $xxx; then
21815		    nonxs_extensions="$nonxs_extensions $this_ext";
21816		fi;
21817		$rm -f $$.tmp;
21818	    fi
21819	    ;;
21820	esac;
21821    done'
21822tdir=`pwd`
21823cd "$rsrc/cpan"
21824set X
21825shift
21826eval $find_extensions
21827cd "$rsrc/dist"
21828set X
21829shift
21830eval $find_extensions
21831cd "$rsrc/ext"
21832set X
21833shift
21834eval $find_extensions
21835if $test -d File-Glob; then
21836    : All ext/ flattened
21837else
21838    # Special case:  Add in modules that nest beyond the first level.
21839    # Currently threads/shared and Hash/Util/FieldHash, since they are
21840    # not picked up by the recursive find above (and adding in general
21841    # recursive finding breaks SDBM_File/sdbm).
21842    # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21843    known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21844fi
21845set X $known_extensions
21846shift
21847known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21848set X $nonxs_extensions
21849shift
21850nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21851cd "$tdir"
21852
21853: Now see which are supported on this system.
21854avail_ext=''
21855for xxx in $known_extensions ; do
21856	case "$xxx" in
21857	DB_File|db_file)
21858		case "$i_db" in
21859		$define) avail_ext="$avail_ext $xxx" ;;
21860		esac
21861		;;
21862	GDBM_File|gdbm_fil)
21863		case "$i_gdbm" in
21864		$define) avail_ext="$avail_ext $xxx" ;;
21865		esac
21866		;;
21867	I18N/Langinfo|i18n_lan)
21868		case "$i_langinfo$d_nl_langinfo" in
21869		$define$define) avail_ext="$avail_ext $xxx" ;;
21870		esac
21871		;;
21872	IPC/SysV|ipc/sysv)
21873		: XXX Do we need a useipcsysv variable here
21874		case "${d_msg}${d_sem}${d_shm}" in
21875		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
21876		esac
21877		;;
21878	NDBM_File|ndbm_fil)
21879		case "$d_ndbm" in
21880		$define)
21881		    case "$osname-$use64bitint" in
21882		    hpux-define)
21883			case "$libs" in
21884			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
21885			esac
21886			;;
21887		    *) avail_ext="$avail_ext $xxx" ;;
21888		    esac
21889		    ;;
21890		esac
21891		;;
21892	ODBM_File|odbm_fil)
21893		case "${i_dbm}${i_rpcsvcdbm}" in
21894		*"${define}"*)
21895		    case "$d_cplusplus" in
21896		    define) ;; # delete as a function name will not work
21897		    *)  case "$osname-$use64bitint" in
21898			hpux-define)
21899			    case "$libs" in
21900			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21901			    esac
21902			    ;;
21903			*) avail_ext="$avail_ext $xxx" ;;
21904			esac
21905			;;
21906		    esac
21907		    ;;
21908		esac
21909		;;
21910	Opcode|opcode)
21911		case "$useopcode" in
21912		true|define|y) avail_ext="$avail_ext $xxx" ;;
21913		esac
21914		;;
21915	POSIX|posix)
21916		case "$useposix" in
21917		true|define|y) avail_ext="$avail_ext $xxx" ;;
21918		esac
21919		;;
21920	Socket|socket)
21921		case "$d_socket" in
21922		true|$define|y)
21923		    case "$osname" in
21924		    beos) ;; # not unless BONE
21925		    *) avail_ext="$avail_ext $xxx" ;;
21926		    esac
21927		    ;;
21928		esac
21929		;;
21930	Sys/Syslog|sys/syslog)
21931		: XXX syslog requires socket
21932		case "$d_socket" in
21933		true|$define|y) avail_ext="$avail_ext $xxx" ;;
21934		esac
21935		;;
21936	Thread|thread)
21937                case "$usethreads" in
21938                true|$define|y)
21939                        case "$use5005threads" in
21940                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21941                        esac
21942		esac
21943		;;
21944	threads|threads/shared)
21945		# threads and threads::shared are special cases.
21946		# To stop people from asking "Perl 5.8.0 was supposed
21947		# to have this new fancy threads implementation but my
21948		# perl doesn't have it" and from people trying to
21949		# (re)install the threads module using CPAN.pm and
21950		# CPAN.pm then offering to reinstall Perl 5.8.0,
21951		# the threads.pm and threads/shared.pm will always be
21952		# there, croaking informatively ("you need to rebuild
21953		# all of Perl with threads, sorry") when threads haven't
21954		# been compiled in.
21955		# --jhi
21956		avail_ext="$avail_ext $xxx"
21957		;;
21958	VMS*)
21959		;;
21960	Win32*)
21961		case "$osname" in
21962		cygwin) avail_ext="$avail_ext $xxx" ;;
21963		esac
21964		;;
21965	XS/APItest|xs/apitest)
21966		# This is just for testing.  Skip it unless we have dynamic loading.
21967
21968		case "$usedl" in
21969		$define) avail_ext="$avail_ext $xxx" ;;
21970		esac
21971		;;
21972	XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21973		# This is just for testing.  Skip it unless we have dynamic loading.
21974
21975		case "$usedl" in
21976		$define) avail_ext="$avail_ext $xxx" ;;
21977		esac
21978		;;
21979	XS/Typemap|xs/typemap)
21980		# This is just for testing.  Skip it unless we have dynamic loading.
21981		case "$usedl" in
21982		$define) avail_ext="$avail_ext $xxx" ;;
21983		esac
21984		;;
21985	*)	avail_ext="$avail_ext $xxx"
21986		;;
21987	esac
21988done
21989
21990set X $avail_ext
21991shift
21992avail_ext="$*"
21993
21994case "$onlyextensions" in
21995'') ;;
21996*)  keepextensions=''
21997    echo "You have requested that only certains extensions be included..." >&4
21998    for i in $onlyextensions; do
21999        case " $avail_ext " in
22000        *" $i "*)
22001            echo "Keeping extension $i."
22002            keepextensions="$keepextensions $i"
22003            ;;
22004        *) echo "Ignoring extension $i." ;;
22005        esac
22006    done
22007    avail_ext="$keepextensions"
22008    ;;
22009esac
22010
22011case "$noextensions" in
22012'') ;;
22013*)  keepextensions=''
22014    echo "You have requested that certain extensions be ignored..." >&4
22015    for i in $avail_ext; do
22016        case " $noextensions " in
22017        *" $i "*) echo "Ignoring extension $i." ;;
22018        *) echo "Keeping extension $i.";
22019           keepextensions="$keepextensions $i"
22020           ;;
22021        esac
22022    done
22023    avail_ext="$keepextensions"
22024    ;;
22025esac
22026
22027: Now see which nonxs extensions are supported on this system.
22028: For now assume all are.
22029nonxs_ext=''
22030for xxx in $nonxs_extensions ; do
22031	case "$xxx" in
22032	CVS|RCS|SCCS|.svn)
22033		;;
22034	*)	nonxs_ext="$nonxs_ext $xxx"
22035		;;
22036	esac
22037done
22038
22039set X $nonxs_ext
22040shift
22041nonxs_ext="$*"
22042
22043case $usedl in
22044$define)
22045	$cat <<EOM
22046A number of extensions are supplied with $package.  You may choose to
22047compile these extensions for dynamic loading (the default), compile
22048them into the $package executable (static loading), or not include
22049them at all.  Answer "none" to include no extensions.
22050Note that DynaLoader is always built and need not be mentioned here.
22051
22052EOM
22053	case "$dynamic_ext" in
22054	'')
22055		: Exclude those listed in static_ext
22056		dflt=''
22057		for xxx in $avail_ext; do
22058			case " $static_ext " in
22059			*" $xxx "*) ;;
22060			*) dflt="$dflt $xxx" ;;
22061			esac
22062		done
22063		set X $dflt
22064		shift
22065		dflt="$*"
22066		;;
22067	*)	dflt="$dynamic_ext"
22068		# Perhaps we are reusing an old out-of-date config.sh.
22069		case "$hint" in
22070		previous)
22071			if test X"$dynamic_ext" != X"$avail_ext"; then
22072				$cat <<EOM
22073NOTICE:  Your previous config.sh list may be incorrect.
22074The extensions now available to you are
22075	${avail_ext}
22076but the default list from your previous config.sh is
22077	${dynamic_ext}
22078
22079EOM
22080			fi
22081			;;
22082		esac
22083		;;
22084	esac
22085	case "$dflt" in
22086	'')	dflt=none;;
22087	esac
22088	rp="What extensions do you wish to load dynamically?"
22089	. ./myread
22090	case "$ans" in
22091	none) dynamic_ext=' ' ;;
22092	*) dynamic_ext="$ans" ;;
22093	esac
22094
22095	case "$static_ext" in
22096	'')
22097		: Exclude those already listed in dynamic linking
22098		dflt=''
22099		for xxx in $avail_ext; do
22100			case " $dynamic_ext " in
22101			*" $xxx "*) ;;
22102			*) dflt="$dflt $xxx" ;;
22103			esac
22104		done
22105		set X $dflt
22106		shift
22107		dflt="$*"
22108		;;
22109	*)  dflt="$static_ext"
22110		;;
22111	esac
22112
22113	case "$dflt" in
22114	'')	dflt=none;;
22115	esac
22116	rp="What extensions do you wish to load statically?"
22117	. ./myread
22118	case "$ans" in
22119	none) static_ext=' ' ;;
22120	*) static_ext="$ans" ;;
22121	esac
22122	;;
22123*)
22124	$cat <<EOM
22125A number of extensions are supplied with $package.  Answer "none"
22126to include no extensions.
22127Note that DynaLoader is always built and need not be mentioned here.
22128
22129EOM
22130	case "$static_ext" in
22131	'') dflt="$avail_ext" ;;
22132	*)	dflt="$static_ext"
22133		# Perhaps we are reusing an old out-of-date config.sh.
22134		case "$hint" in
22135		previous)
22136			if test X"$static_ext" != X"$avail_ext"; then
22137				$cat <<EOM
22138NOTICE:  Your previous config.sh list may be incorrect.
22139The extensions now available to you are
22140	${avail_ext}
22141but the default list from your previous config.sh is
22142	${static_ext}
22143
22144EOM
22145			fi
22146			;;
22147		esac
22148		;;
22149	esac
22150	: Exclude those that are not xs extensions
22151	case "$dflt" in
22152	'')	dflt=none;;
22153	esac
22154	rp="What extensions do you wish to include?"
22155	. ./myread
22156	case "$ans" in
22157	none) static_ext=' ' ;;
22158	*) static_ext="$ans" ;;
22159	esac
22160	;;
22161esac
22162#
22163# Encode is a special case.  If we are building Encode as a static
22164# extension, we need to explicitly list its subextensions as well.
22165# For other nested extensions, this is handled automatically by
22166# the appropriate Makefile.PL.
22167case " $static_ext " in
22168	*" Encode "*) # Add the subextensions of Encode
22169	cd "$rsrc/ext"
22170	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22171		static_ext="$static_ext Encode/$xxx"
22172	done
22173	cd "$tdir"
22174	;;
22175esac
22176
22177set X $dynamic_ext $static_ext $nonxs_ext
22178shift
22179extensions="$*"
22180
22181# Sanity check:  We require an extension suitable for use with
22182# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22183# should show up as failures in the test suite, but it's helpful to
22184# catch them now.) The 'extensions' list is normally sorted
22185# alphabetically, so we need to accept either
22186#    DB_File ... Fcntl ... IO  ....
22187# or something like
22188#    Fcntl ... NDBM_File ... IO  ....
22189case " $extensions"  in
22190*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22191*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22192*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22193*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22194   echo "WARNING: The Perl you are building will be quite crippled." >& 4
22195   ;;
22196esac
22197
22198: Remove libraries needed only for extensions
22199: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22200: The exception is SunOS 4.x, which needs them.
22201case "${osname}X${osvers}" in
22202sunos*X4*)
22203    perllibs="$libs"
22204    ;;
22205*) case "$usedl" in
22206    $define|true|[yY]*)
22207	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22208	    shift
22209	    perllibs="$*"
22210	    ;;
22211    *)	perllibs="$libs"
22212	    ;;
22213    esac
22214    ;;
22215esac
22216
22217: Remove build directory name from cppstdin so it can be used from
22218: either the present location or the final installed location.
22219echo " "
22220: Get out of the UU directory to get correct path name.
22221cd ..
22222case "$cppstdin" in
22223`pwd`/cppstdin)
22224	echo "Stripping down cppstdin path name"
22225	cppstdin=cppstdin
22226	;;
22227esac
22228cd UU
22229
22230: end of configuration questions
22231echo " "
22232echo "End of configuration questions."
22233echo " "
22234
22235: back to where it started
22236if test -d ../UU; then
22237	cd ..
22238fi
22239
22240: configuration may be unconditionally patched via a 'config.arch' file
22241if $test -f config.arch; then
22242	echo "I see a config.arch file, loading it." >&4
22243	. ./config.arch
22244fi
22245
22246: configuration may be patched via a 'config.over' file
22247if $test -f config.over; then
22248	echo " "
22249	dflt=y
22250	rp='I see a config.over file.  Do you wish to load it?'
22251	. UU/myread
22252	case "$ans" in
22253	n*) echo "OK, I'll ignore it.";;
22254	*)	. ./config.over
22255		echo "Configuration override changes have been loaded."
22256		;;
22257	esac
22258fi
22259
22260: in case they want portability, strip down executable paths
22261case "$d_portable" in
22262"$define")
22263	echo " "
22264	echo "Stripping down executable paths..." >&4
22265	for file in $loclist $trylist; do
22266		eval temp=\$$file
22267		eval $file=`basename $temp`
22268	done
22269	;;
22270esac
22271
22272: create config.sh file
22273echo " "
22274echo "Creating config.sh..." >&4
22275$spitshell <<EOT >config.sh
22276$startsh
22277#
22278# This file was produced by running the Configure script. It holds all the
22279# definitions figured out by Configure. Should you modify one of these values,
22280# do not forget to propagate your changes by running "Configure -der". You may
22281# instead choose to run each of the .SH files by yourself, or "Configure -S".
22282#
22283
22284# Package name      : $package
22285# Source directory  : $src
22286# Configuration time: $cf_time
22287# Configured by     : $cf_by
22288# Target system     : $myuname
22289
22290EOT
22291: Add in command line options if available
22292$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22293
22294$spitshell <<EOT >>config.sh
22295
22296Author='$Author'
22297Date='$Date'
22298Header='$Header'
22299Id='$Id'
22300Locker='$Locker'
22301Log='$Log'
22302RCSfile='$RCSfile'
22303Revision='$Revision'
22304Source='$Source'
22305State='$State'
22306_a='$_a'
22307_exe='$_exe'
22308_o='$_o'
22309afs='$afs'
22310afsroot='$afsroot'
22311alignbytes='$alignbytes'
22312ansi2knr='$ansi2knr'
22313aphostname='$aphostname'
22314api_revision='$api_revision'
22315api_subversion='$api_subversion'
22316api_version='$api_version'
22317api_versionstring='$api_versionstring'
22318ar='$ar'
22319archlib='$archlib'
22320archlibexp='$archlibexp'
22321archname64='$archname64'
22322archname='$archname'
22323archobjs='$archobjs'
22324asctime_r_proto='$asctime_r_proto'
22325awk='$awk'
22326baserev='$baserev'
22327bash='$bash'
22328bin='$bin'
22329bin_ELF='$bin_ELF'
22330binexp='$binexp'
22331bison='$bison'
22332byacc='$byacc'
22333byteorder='$byteorder'
22334c='$c'
22335castflags='$castflags'
22336cat='$cat'
22337cc='$cc'
22338cccdlflags='$cccdlflags'
22339ccdlflags='$ccdlflags'
22340ccflags='$ccflags'
22341ccflags_uselargefiles='$ccflags_uselargefiles'
22342ccname='$ccname'
22343ccsymbols='$ccsymbols'
22344ccversion='$ccversion'
22345cf_by='$cf_by'
22346cf_email='$cf_email'
22347cf_time='$cf_time'
22348charbits='$charbits'
22349charsize='$charsize'
22350chgrp='$chgrp'
22351chmod='$chmod'
22352chown='$chown'
22353clocktype='$clocktype'
22354comm='$comm'
22355compress='$compress'
22356contains='$contains'
22357cp='$cp'
22358cpio='$cpio'
22359cpp='$cpp'
22360cpp_stuff='$cpp_stuff'
22361cppccsymbols='$cppccsymbols'
22362cppflags='$cppflags'
22363cpplast='$cpplast'
22364cppminus='$cppminus'
22365cpprun='$cpprun'
22366cppstdin='$cppstdin'
22367cppsymbols='$cppsymbols'
22368crypt_r_proto='$crypt_r_proto'
22369cryptlib='$cryptlib'
22370csh='$csh'
22371ctermid_r_proto='$ctermid_r_proto'
22372ctime_r_proto='$ctime_r_proto'
22373d_Gconvert='$d_Gconvert'
22374d_PRIEUldbl='$d_PRIEUldbl'
22375d_PRIFUldbl='$d_PRIFUldbl'
22376d_PRIGUldbl='$d_PRIGUldbl'
22377d_PRIXU64='$d_PRIXU64'
22378d_PRId64='$d_PRId64'
22379d_PRIeldbl='$d_PRIeldbl'
22380d_PRIfldbl='$d_PRIfldbl'
22381d_PRIgldbl='$d_PRIgldbl'
22382d_PRIi64='$d_PRIi64'
22383d_PRIo64='$d_PRIo64'
22384d_PRIu64='$d_PRIu64'
22385d_PRIx64='$d_PRIx64'
22386d_SCNfldbl='$d_SCNfldbl'
22387d__fwalk='$d__fwalk'
22388d_access='$d_access'
22389d_accessx='$d_accessx'
22390d_aintl='$d_aintl'
22391d_alarm='$d_alarm'
22392d_archlib='$d_archlib'
22393d_asctime64='$d_asctime64'
22394d_asctime_r='$d_asctime_r'
22395d_atolf='$d_atolf'
22396d_atoll='$d_atoll'
22397d_attribute_deprecated='$d_attribute_deprecated'
22398d_attribute_format='$d_attribute_format'
22399d_attribute_malloc='$d_attribute_malloc'
22400d_attribute_nonnull='$d_attribute_nonnull'
22401d_attribute_noreturn='$d_attribute_noreturn'
22402d_attribute_pure='$d_attribute_pure'
22403d_attribute_unused='$d_attribute_unused'
22404d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22405d_bcmp='$d_bcmp'
22406d_bcopy='$d_bcopy'
22407d_bsd='$d_bsd'
22408d_bsdgetpgrp='$d_bsdgetpgrp'
22409d_bsdsetpgrp='$d_bsdsetpgrp'
22410d_builtin_choose_expr='$d_builtin_choose_expr'
22411d_builtin_expect='$d_builtin_expect'
22412d_bzero='$d_bzero'
22413d_c99_variadic_macros='$d_c99_variadic_macros'
22414d_casti32='$d_casti32'
22415d_castneg='$d_castneg'
22416d_charvspr='$d_charvspr'
22417d_chown='$d_chown'
22418d_chroot='$d_chroot'
22419d_chsize='$d_chsize'
22420d_class='$d_class'
22421d_clearenv='$d_clearenv'
22422d_closedir='$d_closedir'
22423d_cmsghdr_s='$d_cmsghdr_s'
22424d_const='$d_const'
22425d_copysignl='$d_copysignl'
22426d_cplusplus='$d_cplusplus'
22427d_crypt='$d_crypt'
22428d_crypt_r='$d_crypt_r'
22429d_csh='$d_csh'
22430d_ctermid='$d_ctermid'
22431d_ctermid_r='$d_ctermid_r'
22432d_ctime64='$d_ctime64'
22433d_ctime_r='$d_ctime_r'
22434d_cuserid='$d_cuserid'
22435d_dbl_dig='$d_dbl_dig'
22436d_dbminitproto='$d_dbminitproto'
22437d_difftime64='$d_difftime64'
22438d_difftime='$d_difftime'
22439d_dir_dd_fd='$d_dir_dd_fd'
22440d_dirfd='$d_dirfd'
22441d_dirnamlen='$d_dirnamlen'
22442d_dlerror='$d_dlerror'
22443d_dlopen='$d_dlopen'
22444d_dlsymun='$d_dlsymun'
22445d_dosuid='$d_dosuid'
22446d_drand48_r='$d_drand48_r'
22447d_drand48proto='$d_drand48proto'
22448d_dup2='$d_dup2'
22449d_eaccess='$d_eaccess'
22450d_endgrent='$d_endgrent'
22451d_endgrent_r='$d_endgrent_r'
22452d_endhent='$d_endhent'
22453d_endhostent_r='$d_endhostent_r'
22454d_endnent='$d_endnent'
22455d_endnetent_r='$d_endnetent_r'
22456d_endpent='$d_endpent'
22457d_endprotoent_r='$d_endprotoent_r'
22458d_endpwent='$d_endpwent'
22459d_endpwent_r='$d_endpwent_r'
22460d_endsent='$d_endsent'
22461d_endservent_r='$d_endservent_r'
22462d_eofnblk='$d_eofnblk'
22463d_eunice='$d_eunice'
22464d_faststdio='$d_faststdio'
22465d_fchdir='$d_fchdir'
22466d_fchmod='$d_fchmod'
22467d_fchown='$d_fchown'
22468d_fcntl='$d_fcntl'
22469d_fcntl_can_lock='$d_fcntl_can_lock'
22470d_fd_macros='$d_fd_macros'
22471d_fd_set='$d_fd_set'
22472d_fds_bits='$d_fds_bits'
22473d_fgetpos='$d_fgetpos'
22474d_finite='$d_finite'
22475d_finitel='$d_finitel'
22476d_flexfnam='$d_flexfnam'
22477d_flock='$d_flock'
22478d_flockproto='$d_flockproto'
22479d_fork='$d_fork'
22480d_fp_class='$d_fp_class'
22481d_fpathconf='$d_fpathconf'
22482d_fpclass='$d_fpclass'
22483d_fpclassify='$d_fpclassify'
22484d_fpclassl='$d_fpclassl'
22485d_fpos64_t='$d_fpos64_t'
22486d_frexpl='$d_frexpl'
22487d_fs_data_s='$d_fs_data_s'
22488d_fseeko='$d_fseeko'
22489d_fsetpos='$d_fsetpos'
22490d_fstatfs='$d_fstatfs'
22491d_fstatvfs='$d_fstatvfs'
22492d_fsync='$d_fsync'
22493d_ftello='$d_ftello'
22494d_ftime='$d_ftime'
22495d_futimes='$d_futimes'
22496d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22497d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22498d_getaddrinfo='$d_getaddrinfo'
22499d_getcwd='$d_getcwd'
22500d_getespwnam='$d_getespwnam'
22501d_getfsstat='$d_getfsstat'
22502d_getgrent='$d_getgrent'
22503d_getgrent_r='$d_getgrent_r'
22504d_getgrgid_r='$d_getgrgid_r'
22505d_getgrnam_r='$d_getgrnam_r'
22506d_getgrps='$d_getgrps'
22507d_gethbyaddr='$d_gethbyaddr'
22508d_gethbyname='$d_gethbyname'
22509d_gethent='$d_gethent'
22510d_gethname='$d_gethname'
22511d_gethostbyaddr_r='$d_gethostbyaddr_r'
22512d_gethostbyname_r='$d_gethostbyname_r'
22513d_gethostent_r='$d_gethostent_r'
22514d_gethostprotos='$d_gethostprotos'
22515d_getitimer='$d_getitimer'
22516d_getlogin='$d_getlogin'
22517d_getlogin_r='$d_getlogin_r'
22518d_getmnt='$d_getmnt'
22519d_getmntent='$d_getmntent'
22520d_getnameinfo='$d_getnameinfo'
22521d_getnbyaddr='$d_getnbyaddr'
22522d_getnbyname='$d_getnbyname'
22523d_getnent='$d_getnent'
22524d_getnetbyaddr_r='$d_getnetbyaddr_r'
22525d_getnetbyname_r='$d_getnetbyname_r'
22526d_getnetent_r='$d_getnetent_r'
22527d_getnetprotos='$d_getnetprotos'
22528d_getpagsz='$d_getpagsz'
22529d_getpbyname='$d_getpbyname'
22530d_getpbynumber='$d_getpbynumber'
22531d_getpent='$d_getpent'
22532d_getpgid='$d_getpgid'
22533d_getpgrp2='$d_getpgrp2'
22534d_getpgrp='$d_getpgrp'
22535d_getppid='$d_getppid'
22536d_getprior='$d_getprior'
22537d_getprotobyname_r='$d_getprotobyname_r'
22538d_getprotobynumber_r='$d_getprotobynumber_r'
22539d_getprotoent_r='$d_getprotoent_r'
22540d_getprotoprotos='$d_getprotoprotos'
22541d_getprpwnam='$d_getprpwnam'
22542d_getpwent='$d_getpwent'
22543d_getpwent_r='$d_getpwent_r'
22544d_getpwnam_r='$d_getpwnam_r'
22545d_getpwuid_r='$d_getpwuid_r'
22546d_getsbyname='$d_getsbyname'
22547d_getsbyport='$d_getsbyport'
22548d_getsent='$d_getsent'
22549d_getservbyname_r='$d_getservbyname_r'
22550d_getservbyport_r='$d_getservbyport_r'
22551d_getservent_r='$d_getservent_r'
22552d_getservprotos='$d_getservprotos'
22553d_getspnam='$d_getspnam'
22554d_getspnam_r='$d_getspnam_r'
22555d_gettimeod='$d_gettimeod'
22556d_gmtime64='$d_gmtime64'
22557d_gmtime_r='$d_gmtime_r'
22558d_gnulibc='$d_gnulibc'
22559d_grpasswd='$d_grpasswd'
22560d_hasmntopt='$d_hasmntopt'
22561d_htonl='$d_htonl'
22562d_ilogbl='$d_ilogbl'
22563d_inc_version_list='$d_inc_version_list'
22564d_index='$d_index'
22565d_inetaton='$d_inetaton'
22566d_inetntop='$d_inetntop'
22567d_inetpton='$d_inetpton'
22568d_int64_t='$d_int64_t'
22569d_isascii='$d_isascii'
22570d_isfinite='$d_isfinite'
22571d_isinf='$d_isinf'
22572d_isnan='$d_isnan'
22573d_isnanl='$d_isnanl'
22574d_killpg='$d_killpg'
22575d_lchown='$d_lchown'
22576d_ldbl_dig='$d_ldbl_dig'
22577d_libm_lib_version='$d_libm_lib_version'
22578d_link='$d_link'
22579d_localtime64='$d_localtime64'
22580d_localtime_r='$d_localtime_r'
22581d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22582d_locconv='$d_locconv'
22583d_lockf='$d_lockf'
22584d_longdbl='$d_longdbl'
22585d_longlong='$d_longlong'
22586d_lseekproto='$d_lseekproto'
22587d_lstat='$d_lstat'
22588d_madvise='$d_madvise'
22589d_malloc_good_size='$d_malloc_good_size'
22590d_malloc_size='$d_malloc_size'
22591d_mblen='$d_mblen'
22592d_mbstowcs='$d_mbstowcs'
22593d_mbtowc='$d_mbtowc'
22594d_memchr='$d_memchr'
22595d_memcmp='$d_memcmp'
22596d_memcpy='$d_memcpy'
22597d_memmove='$d_memmove'
22598d_memset='$d_memset'
22599d_mkdir='$d_mkdir'
22600d_mkdtemp='$d_mkdtemp'
22601d_mkfifo='$d_mkfifo'
22602d_mkstemp='$d_mkstemp'
22603d_mkstemps='$d_mkstemps'
22604d_mktime64='$d_mktime64'
22605d_mktime='$d_mktime'
22606d_mmap='$d_mmap'
22607d_modfl='$d_modfl'
22608d_modfl_pow32_bug='$d_modfl_pow32_bug'
22609d_modflproto='$d_modflproto'
22610d_mprotect='$d_mprotect'
22611d_msg='$d_msg'
22612d_msg_ctrunc='$d_msg_ctrunc'
22613d_msg_dontroute='$d_msg_dontroute'
22614d_msg_oob='$d_msg_oob'
22615d_msg_peek='$d_msg_peek'
22616d_msg_proxy='$d_msg_proxy'
22617d_msgctl='$d_msgctl'
22618d_msgget='$d_msgget'
22619d_msghdr_s='$d_msghdr_s'
22620d_msgrcv='$d_msgrcv'
22621d_msgsnd='$d_msgsnd'
22622d_msync='$d_msync'
22623d_munmap='$d_munmap'
22624d_mymalloc='$d_mymalloc'
22625d_ndbm='$d_ndbm'
22626d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22627d_nice='$d_nice'
22628d_nl_langinfo='$d_nl_langinfo'
22629d_nv_preserves_uv='$d_nv_preserves_uv'
22630d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22631d_off64_t='$d_off64_t'
22632d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22633d_oldpthreads='$d_oldpthreads'
22634d_oldsock='$d_oldsock'
22635d_open3='$d_open3'
22636d_pathconf='$d_pathconf'
22637d_pause='$d_pause'
22638d_perl_otherlibdirs='$d_perl_otherlibdirs'
22639d_phostname='$d_phostname'
22640d_pipe='$d_pipe'
22641d_poll='$d_poll'
22642d_portable='$d_portable'
22643d_printf_format_null='$d_printf_format_null'
22644d_procselfexe='$d_procselfexe'
22645d_pseudofork='$d_pseudofork'
22646d_pthread_atfork='$d_pthread_atfork'
22647d_pthread_attr_setscope='$d_pthread_attr_setscope'
22648d_pthread_yield='$d_pthread_yield'
22649d_pwage='$d_pwage'
22650d_pwchange='$d_pwchange'
22651d_pwclass='$d_pwclass'
22652d_pwcomment='$d_pwcomment'
22653d_pwexpire='$d_pwexpire'
22654d_pwgecos='$d_pwgecos'
22655d_pwpasswd='$d_pwpasswd'
22656d_pwquota='$d_pwquota'
22657d_qgcvt='$d_qgcvt'
22658d_quad='$d_quad'
22659d_random_r='$d_random_r'
22660d_readdir64_r='$d_readdir64_r'
22661d_readdir='$d_readdir'
22662d_readdir_r='$d_readdir_r'
22663d_readlink='$d_readlink'
22664d_readv='$d_readv'
22665d_recvmsg='$d_recvmsg'
22666d_rename='$d_rename'
22667d_rewinddir='$d_rewinddir'
22668d_rmdir='$d_rmdir'
22669d_safebcpy='$d_safebcpy'
22670d_safemcpy='$d_safemcpy'
22671d_sanemcmp='$d_sanemcmp'
22672d_sbrkproto='$d_sbrkproto'
22673d_scalbnl='$d_scalbnl'
22674d_sched_yield='$d_sched_yield'
22675d_scm_rights='$d_scm_rights'
22676d_seekdir='$d_seekdir'
22677d_select='$d_select'
22678d_sem='$d_sem'
22679d_semctl='$d_semctl'
22680d_semctl_semid_ds='$d_semctl_semid_ds'
22681d_semctl_semun='$d_semctl_semun'
22682d_semget='$d_semget'
22683d_semop='$d_semop'
22684d_sendmsg='$d_sendmsg'
22685d_setegid='$d_setegid'
22686d_seteuid='$d_seteuid'
22687d_setgrent='$d_setgrent'
22688d_setgrent_r='$d_setgrent_r'
22689d_setgrps='$d_setgrps'
22690d_sethent='$d_sethent'
22691d_sethostent_r='$d_sethostent_r'
22692d_setitimer='$d_setitimer'
22693d_setlinebuf='$d_setlinebuf'
22694d_setlocale='$d_setlocale'
22695d_setlocale_r='$d_setlocale_r'
22696d_setnent='$d_setnent'
22697d_setnetent_r='$d_setnetent_r'
22698d_setpent='$d_setpent'
22699d_setpgid='$d_setpgid'
22700d_setpgrp2='$d_setpgrp2'
22701d_setpgrp='$d_setpgrp'
22702d_setprior='$d_setprior'
22703d_setproctitle='$d_setproctitle'
22704d_setprotoent_r='$d_setprotoent_r'
22705d_setpwent='$d_setpwent'
22706d_setpwent_r='$d_setpwent_r'
22707d_setregid='$d_setregid'
22708d_setresgid='$d_setresgid'
22709d_setresuid='$d_setresuid'
22710d_setreuid='$d_setreuid'
22711d_setrgid='$d_setrgid'
22712d_setruid='$d_setruid'
22713d_setsent='$d_setsent'
22714d_setservent_r='$d_setservent_r'
22715d_setsid='$d_setsid'
22716d_setvbuf='$d_setvbuf'
22717d_sfio='$d_sfio'
22718d_shm='$d_shm'
22719d_shmat='$d_shmat'
22720d_shmatprototype='$d_shmatprototype'
22721d_shmctl='$d_shmctl'
22722d_shmdt='$d_shmdt'
22723d_shmget='$d_shmget'
22724d_sigaction='$d_sigaction'
22725d_signbit='$d_signbit'
22726d_sigprocmask='$d_sigprocmask'
22727d_sigsetjmp='$d_sigsetjmp'
22728d_sitearch='$d_sitearch'
22729d_snprintf='$d_snprintf'
22730d_sockatmark='$d_sockatmark'
22731d_sockatmarkproto='$d_sockatmarkproto'
22732d_socket='$d_socket'
22733d_socklen_t='$d_socklen_t'
22734d_sockpair='$d_sockpair'
22735d_socks5_init='$d_socks5_init'
22736d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22737d_sqrtl='$d_sqrtl'
22738d_srand48_r='$d_srand48_r'
22739d_srandom_r='$d_srandom_r'
22740d_sresgproto='$d_sresgproto'
22741d_sresuproto='$d_sresuproto'
22742d_statblks='$d_statblks'
22743d_statfs_f_flags='$d_statfs_f_flags'
22744d_statfs_s='$d_statfs_s'
22745d_statvfs='$d_statvfs'
22746d_stdio_cnt_lval='$d_stdio_cnt_lval'
22747d_stdio_ptr_lval='$d_stdio_ptr_lval'
22748d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22749d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22750d_stdio_stream_array='$d_stdio_stream_array'
22751d_stdiobase='$d_stdiobase'
22752d_stdstdio='$d_stdstdio'
22753d_strchr='$d_strchr'
22754d_strcoll='$d_strcoll'
22755d_strctcpy='$d_strctcpy'
22756d_strerrm='$d_strerrm'
22757d_strerror='$d_strerror'
22758d_strerror_r='$d_strerror_r'
22759d_strftime='$d_strftime'
22760d_strlcat='$d_strlcat'
22761d_strlcpy='$d_strlcpy'
22762d_strtod='$d_strtod'
22763d_strtol='$d_strtol'
22764d_strtold='$d_strtold'
22765d_strtoll='$d_strtoll'
22766d_strtoq='$d_strtoq'
22767d_strtoul='$d_strtoul'
22768d_strtoull='$d_strtoull'
22769d_strtouq='$d_strtouq'
22770d_strxfrm='$d_strxfrm'
22771d_suidsafe='$d_suidsafe'
22772d_symlink='$d_symlink'
22773d_syscall='$d_syscall'
22774d_syscallproto='$d_syscallproto'
22775d_sysconf='$d_sysconf'
22776d_sysernlst='$d_sysernlst'
22777d_syserrlst='$d_syserrlst'
22778d_system='$d_system'
22779d_tcgetpgrp='$d_tcgetpgrp'
22780d_tcsetpgrp='$d_tcsetpgrp'
22781d_telldir='$d_telldir'
22782d_telldirproto='$d_telldirproto'
22783d_time='$d_time'
22784d_timegm='$d_timegm'
22785d_times='$d_times'
22786d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22787d_tm_tm_zone='$d_tm_tm_zone'
22788d_tmpnam_r='$d_tmpnam_r'
22789d_truncate='$d_truncate'
22790d_ttyname_r='$d_ttyname_r'
22791d_tzname='$d_tzname'
22792d_u32align='$d_u32align'
22793d_ualarm='$d_ualarm'
22794d_umask='$d_umask'
22795d_uname='$d_uname'
22796d_union_semun='$d_union_semun'
22797d_unordered='$d_unordered'
22798d_unsetenv='$d_unsetenv'
22799d_usleep='$d_usleep'
22800d_usleepproto='$d_usleepproto'
22801d_ustat='$d_ustat'
22802d_vendorarch='$d_vendorarch'
22803d_vendorbin='$d_vendorbin'
22804d_vendorlib='$d_vendorlib'
22805d_vendorscript='$d_vendorscript'
22806d_vfork='$d_vfork'
22807d_void_closedir='$d_void_closedir'
22808d_voidsig='$d_voidsig'
22809d_voidtty='$d_voidtty'
22810d_volatile='$d_volatile'
22811d_vprintf='$d_vprintf'
22812d_vsnprintf='$d_vsnprintf'
22813d_wait4='$d_wait4'
22814d_waitpid='$d_waitpid'
22815d_wcstombs='$d_wcstombs'
22816d_wctomb='$d_wctomb'
22817d_writev='$d_writev'
22818d_xenix='$d_xenix'
22819date='$date'
22820db_hashtype='$db_hashtype'
22821db_prefixtype='$db_prefixtype'
22822db_version_major='$db_version_major'
22823db_version_minor='$db_version_minor'
22824db_version_patch='$db_version_patch'
22825defvoidused='$defvoidused'
22826direntrytype='$direntrytype'
22827dlext='$dlext'
22828dlsrc='$dlsrc'
22829doublesize='$doublesize'
22830drand01='$drand01'
22831drand48_r_proto='$drand48_r_proto'
22832dtrace='$dtrace'
22833dynamic_ext='$dynamic_ext'
22834eagain='$eagain'
22835ebcdic='$ebcdic'
22836echo='$echo'
22837egrep='$egrep'
22838emacs='$emacs'
22839endgrent_r_proto='$endgrent_r_proto'
22840endhostent_r_proto='$endhostent_r_proto'
22841endnetent_r_proto='$endnetent_r_proto'
22842endprotoent_r_proto='$endprotoent_r_proto'
22843endpwent_r_proto='$endpwent_r_proto'
22844endservent_r_proto='$endservent_r_proto'
22845eunicefix='$eunicefix'
22846exe_ext='$exe_ext'
22847expr='$expr'
22848extensions='$extensions'
22849extern_C='$extern_C'
22850extras='$extras'
22851fflushNULL='$fflushNULL'
22852fflushall='$fflushall'
22853find='$find'
22854firstmakefile='$firstmakefile'
22855flex='$flex'
22856fpossize='$fpossize'
22857fpostype='$fpostype'
22858freetype='$freetype'
22859from='$from'
22860full_ar='$full_ar'
22861full_csh='$full_csh'
22862full_sed='$full_sed'
22863gccansipedantic='$gccansipedantic'
22864gccosandvers='$gccosandvers'
22865gccversion='$gccversion'
22866getgrent_r_proto='$getgrent_r_proto'
22867getgrgid_r_proto='$getgrgid_r_proto'
22868getgrnam_r_proto='$getgrnam_r_proto'
22869gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22870gethostbyname_r_proto='$gethostbyname_r_proto'
22871gethostent_r_proto='$gethostent_r_proto'
22872getlogin_r_proto='$getlogin_r_proto'
22873getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22874getnetbyname_r_proto='$getnetbyname_r_proto'
22875getnetent_r_proto='$getnetent_r_proto'
22876getprotobyname_r_proto='$getprotobyname_r_proto'
22877getprotobynumber_r_proto='$getprotobynumber_r_proto'
22878getprotoent_r_proto='$getprotoent_r_proto'
22879getpwent_r_proto='$getpwent_r_proto'
22880getpwnam_r_proto='$getpwnam_r_proto'
22881getpwuid_r_proto='$getpwuid_r_proto'
22882getservbyname_r_proto='$getservbyname_r_proto'
22883getservbyport_r_proto='$getservbyport_r_proto'
22884getservent_r_proto='$getservent_r_proto'
22885getspnam_r_proto='$getspnam_r_proto'
22886gidformat='$gidformat'
22887gidsign='$gidsign'
22888gidsize='$gidsize'
22889gidtype='$gidtype'
22890glibpth='$glibpth'
22891gmake='$gmake'
22892gmtime_r_proto='$gmtime_r_proto'
22893gnulibc_version='$gnulibc_version'
22894grep='$grep'
22895groupcat='$groupcat'
22896groupstype='$groupstype'
22897gzip='$gzip'
22898h_fcntl='$h_fcntl'
22899h_sysfile='$h_sysfile'
22900hint='$hint'
22901hostcat='$hostcat'
22902html1dir='$html1dir'
22903html1direxp='$html1direxp'
22904html3dir='$html3dir'
22905html3direxp='$html3direxp'
22906i16size='$i16size'
22907i16type='$i16type'
22908i32size='$i32size'
22909i32type='$i32type'
22910i64size='$i64size'
22911i64type='$i64type'
22912i8size='$i8size'
22913i8type='$i8type'
22914i_arpainet='$i_arpainet'
22915i_assert='$i_assert'
22916i_bsdioctl='$i_bsdioctl'
22917i_crypt='$i_crypt'
22918i_db='$i_db'
22919i_dbm='$i_dbm'
22920i_dirent='$i_dirent'
22921i_dld='$i_dld'
22922i_dlfcn='$i_dlfcn'
22923i_fcntl='$i_fcntl'
22924i_float='$i_float'
22925i_fp='$i_fp'
22926i_fp_class='$i_fp_class'
22927i_gdbm='$i_gdbm'
22928i_gdbm_ndbm='$i_gdbm_ndbm'
22929i_gdbmndbm='$i_gdbmndbm'
22930i_grp='$i_grp'
22931i_ieeefp='$i_ieeefp'
22932i_inttypes='$i_inttypes'
22933i_langinfo='$i_langinfo'
22934i_libutil='$i_libutil'
22935i_limits='$i_limits'
22936i_locale='$i_locale'
22937i_machcthr='$i_machcthr'
22938i_malloc='$i_malloc'
22939i_mallocmalloc='$i_mallocmalloc'
22940i_math='$i_math'
22941i_memory='$i_memory'
22942i_mntent='$i_mntent'
22943i_ndbm='$i_ndbm'
22944i_netdb='$i_netdb'
22945i_neterrno='$i_neterrno'
22946i_netinettcp='$i_netinettcp'
22947i_niin='$i_niin'
22948i_poll='$i_poll'
22949i_prot='$i_prot'
22950i_pthread='$i_pthread'
22951i_pwd='$i_pwd'
22952i_rpcsvcdbm='$i_rpcsvcdbm'
22953i_sfio='$i_sfio'
22954i_sgtty='$i_sgtty'
22955i_shadow='$i_shadow'
22956i_socks='$i_socks'
22957i_stdarg='$i_stdarg'
22958i_stddef='$i_stddef'
22959i_stdlib='$i_stdlib'
22960i_string='$i_string'
22961i_sunmath='$i_sunmath'
22962i_sysaccess='$i_sysaccess'
22963i_sysdir='$i_sysdir'
22964i_sysfile='$i_sysfile'
22965i_sysfilio='$i_sysfilio'
22966i_sysin='$i_sysin'
22967i_sysioctl='$i_sysioctl'
22968i_syslog='$i_syslog'
22969i_sysmman='$i_sysmman'
22970i_sysmode='$i_sysmode'
22971i_sysmount='$i_sysmount'
22972i_sysndir='$i_sysndir'
22973i_sysparam='$i_sysparam'
22974i_syspoll='$i_syspoll'
22975i_sysresrc='$i_sysresrc'
22976i_syssecrt='$i_syssecrt'
22977i_sysselct='$i_sysselct'
22978i_syssockio='$i_syssockio'
22979i_sysstat='$i_sysstat'
22980i_sysstatfs='$i_sysstatfs'
22981i_sysstatvfs='$i_sysstatvfs'
22982i_systime='$i_systime'
22983i_systimek='$i_systimek'
22984i_systimes='$i_systimes'
22985i_systypes='$i_systypes'
22986i_sysuio='$i_sysuio'
22987i_sysun='$i_sysun'
22988i_sysutsname='$i_sysutsname'
22989i_sysvfs='$i_sysvfs'
22990i_syswait='$i_syswait'
22991i_termio='$i_termio'
22992i_termios='$i_termios'
22993i_time='$i_time'
22994i_unistd='$i_unistd'
22995i_ustat='$i_ustat'
22996i_utime='$i_utime'
22997i_values='$i_values'
22998i_varargs='$i_varargs'
22999i_varhdr='$i_varhdr'
23000i_vfork='$i_vfork'
23001ignore_versioned_solibs='$ignore_versioned_solibs'
23002inc_version_list='$inc_version_list'
23003inc_version_list_init='$inc_version_list_init'
23004incpath='$incpath'
23005inews='$inews'
23006initialinstalllocation='$initialinstalllocation'
23007installarchlib='$installarchlib'
23008installbin='$installbin'
23009installhtml1dir='$installhtml1dir'
23010installhtml3dir='$installhtml3dir'
23011installman1dir='$installman1dir'
23012installman3dir='$installman3dir'
23013installprefix='$installprefix'
23014installprefixexp='$installprefixexp'
23015installprivlib='$installprivlib'
23016installscript='$installscript'
23017installsitearch='$installsitearch'
23018installsitebin='$installsitebin'
23019installsitehtml1dir='$installsitehtml1dir'
23020installsitehtml3dir='$installsitehtml3dir'
23021installsitelib='$installsitelib'
23022installsiteman1dir='$installsiteman1dir'
23023installsiteman3dir='$installsiteman3dir'
23024installsitescript='$installsitescript'
23025installstyle='$installstyle'
23026installusrbinperl='$installusrbinperl'
23027installvendorarch='$installvendorarch'
23028installvendorbin='$installvendorbin'
23029installvendorhtml1dir='$installvendorhtml1dir'
23030installvendorhtml3dir='$installvendorhtml3dir'
23031installvendorlib='$installvendorlib'
23032installvendorman1dir='$installvendorman1dir'
23033installvendorman3dir='$installvendorman3dir'
23034installvendorscript='$installvendorscript'
23035intsize='$intsize'
23036issymlink='$issymlink'
23037ivdformat='$ivdformat'
23038ivsize='$ivsize'
23039ivtype='$ivtype'
23040known_extensions='$known_extensions'
23041ksh='$ksh'
23042ld='$ld'
23043lddlflags='$lddlflags'
23044ldflags='$ldflags'
23045ldflags_uselargefiles='$ldflags_uselargefiles'
23046ldlibpthname='$ldlibpthname'
23047less='$less'
23048lib_ext='$lib_ext'
23049libc='$libc'
23050libperl='$libperl'
23051libpth='$libpth'
23052libs='$libs'
23053libsdirs='$libsdirs'
23054libsfiles='$libsfiles'
23055libsfound='$libsfound'
23056libspath='$libspath'
23057libswanted='$libswanted'
23058libswanted_uselargefiles='$libswanted_uselargefiles'
23059line='$line'
23060lint='$lint'
23061lkflags='$lkflags'
23062ln='$ln'
23063lns='$lns'
23064localtime_r_proto='$localtime_r_proto'
23065locincpth='$locincpth'
23066loclibpth='$loclibpth'
23067longdblsize='$longdblsize'
23068longlongsize='$longlongsize'
23069longsize='$longsize'
23070lp='$lp'
23071lpr='$lpr'
23072ls='$ls'
23073lseeksize='$lseeksize'
23074lseektype='$lseektype'
23075mad='$mad'
23076madlyh='$madlyh'
23077madlyobj='$madlyobj'
23078madlysrc='$madlysrc'
23079mail='$mail'
23080mailx='$mailx'
23081make='$make'
23082make_set_make='$make_set_make'
23083mallocobj='$mallocobj'
23084mallocsrc='$mallocsrc'
23085malloctype='$malloctype'
23086man1dir='$man1dir'
23087man1direxp='$man1direxp'
23088man1ext='$man1ext'
23089man3dir='$man3dir'
23090man3direxp='$man3direxp'
23091man3ext='$man3ext'
23092mips_type='$mips_type'
23093mistrustnm='$mistrustnm'
23094mkdir='$mkdir'
23095mmaptype='$mmaptype'
23096modetype='$modetype'
23097more='$more'
23098multiarch='$multiarch'
23099mv='$mv'
23100myarchname='$myarchname'
23101mydomain='$mydomain'
23102myhostname='$myhostname'
23103myuname='$myuname'
23104n='$n'
23105need_va_copy='$need_va_copy'
23106netdb_hlen_type='$netdb_hlen_type'
23107netdb_host_type='$netdb_host_type'
23108netdb_name_type='$netdb_name_type'
23109netdb_net_type='$netdb_net_type'
23110nm='$nm'
23111nm_opt='$nm_opt'
23112nm_so_opt='$nm_so_opt'
23113nonxs_ext='$nonxs_ext'
23114nroff='$nroff'
23115nvEUformat='$nvEUformat'
23116nvFUformat='$nvFUformat'
23117nvGUformat='$nvGUformat'
23118nv_overflows_integers_at='$nv_overflows_integers_at'
23119nv_preserves_uv_bits='$nv_preserves_uv_bits'
23120nveformat='$nveformat'
23121nvfformat='$nvfformat'
23122nvgformat='$nvgformat'
23123nvsize='$nvsize'
23124nvtype='$nvtype'
23125o_nonblock='$o_nonblock'
23126obj_ext='$obj_ext'
23127old_pthread_create_joinable='$old_pthread_create_joinable'
23128optimize='$optimize'
23129orderlib='$orderlib'
23130osname='$osname'
23131osvers='$osvers'
23132otherlibdirs='$otherlibdirs'
23133package='$package'
23134pager='$pager'
23135passcat='$passcat'
23136patchlevel='$patchlevel'
23137path_sep='$path_sep'
23138perl5='$perl5'
23139perl='$perl'
23140perl_patchlevel='$perl_patchlevel'
23141perladmin='$perladmin'
23142perllibs='$perllibs'
23143perlpath='$perlpath'
23144pg='$pg'
23145phostname='$phostname'
23146pidtype='$pidtype'
23147plibpth='$plibpth'
23148pmake='$pmake'
23149pr='$pr'
23150prefix='$prefix'
23151prefixexp='$prefixexp'
23152privlib='$privlib'
23153privlibexp='$privlibexp'
23154procselfexe='$procselfexe'
23155prototype='$prototype'
23156ptrsize='$ptrsize'
23157quadkind='$quadkind'
23158quadtype='$quadtype'
23159randbits='$randbits'
23160randfunc='$randfunc'
23161random_r_proto='$random_r_proto'
23162randseedtype='$randseedtype'
23163ranlib='$ranlib'
23164rd_nodata='$rd_nodata'
23165readdir64_r_proto='$readdir64_r_proto'
23166readdir_r_proto='$readdir_r_proto'
23167revision='$revision'
23168rm='$rm'
23169rm_try='$rm_try'
23170rmail='$rmail'
23171run='$run'
23172runnm='$runnm'
23173sGMTIME_max='$sGMTIME_max'
23174sGMTIME_min='$sGMTIME_min'
23175sLOCALTIME_max='$sLOCALTIME_max'
23176sLOCALTIME_min='$sLOCALTIME_min'
23177sPRIEUldbl='$sPRIEUldbl'
23178sPRIFUldbl='$sPRIFUldbl'
23179sPRIGUldbl='$sPRIGUldbl'
23180sPRIXU64='$sPRIXU64'
23181sPRId64='$sPRId64'
23182sPRIeldbl='$sPRIeldbl'
23183sPRIfldbl='$sPRIfldbl'
23184sPRIgldbl='$sPRIgldbl'
23185sPRIi64='$sPRIi64'
23186sPRIo64='$sPRIo64'
23187sPRIu64='$sPRIu64'
23188sPRIx64='$sPRIx64'
23189sSCNfldbl='$sSCNfldbl'
23190sched_yield='$sched_yield'
23191scriptdir='$scriptdir'
23192scriptdirexp='$scriptdirexp'
23193sed='$sed'
23194seedfunc='$seedfunc'
23195selectminbits='$selectminbits'
23196selecttype='$selecttype'
23197sendmail='$sendmail'
23198setgrent_r_proto='$setgrent_r_proto'
23199sethostent_r_proto='$sethostent_r_proto'
23200setlocale_r_proto='$setlocale_r_proto'
23201setnetent_r_proto='$setnetent_r_proto'
23202setprotoent_r_proto='$setprotoent_r_proto'
23203setpwent_r_proto='$setpwent_r_proto'
23204setservent_r_proto='$setservent_r_proto'
23205sh='$sh'
23206shar='$shar'
23207sharpbang='$sharpbang'
23208shmattype='$shmattype'
23209shortsize='$shortsize'
23210shrpenv='$shrpenv'
23211shsharp='$shsharp'
23212sig_count='$sig_count'
23213sig_name='$sig_name'
23214sig_name_init='$sig_name_init'
23215sig_num='$sig_num'
23216sig_num_init='$sig_num_init'
23217sig_size='$sig_size'
23218signal_t='$signal_t'
23219sitearch='$sitearch'
23220sitearchexp='$sitearchexp'
23221sitebin='$sitebin'
23222sitebinexp='$sitebinexp'
23223sitehtml1dir='$sitehtml1dir'
23224sitehtml1direxp='$sitehtml1direxp'
23225sitehtml3dir='$sitehtml3dir'
23226sitehtml3direxp='$sitehtml3direxp'
23227sitelib='$sitelib'
23228sitelib_stem='$sitelib_stem'
23229sitelibexp='$sitelibexp'
23230siteman1dir='$siteman1dir'
23231siteman1direxp='$siteman1direxp'
23232siteman3dir='$siteman3dir'
23233siteman3direxp='$siteman3direxp'
23234siteprefix='$siteprefix'
23235siteprefixexp='$siteprefixexp'
23236sitescript='$sitescript'
23237sitescriptexp='$sitescriptexp'
23238sizesize='$sizesize'
23239sizetype='$sizetype'
23240sleep='$sleep'
23241smail='$smail'
23242so='$so'
23243sockethdr='$sockethdr'
23244socketlib='$socketlib'
23245socksizetype='$socksizetype'
23246sort='$sort'
23247spackage='$spackage'
23248spitshell='$spitshell'
23249srand48_r_proto='$srand48_r_proto'
23250srandom_r_proto='$srandom_r_proto'
23251src='$src'
23252ssizetype='$ssizetype'
23253startperl='$startperl'
23254startsh='$startsh'
23255static_ext='$static_ext'
23256stdchar='$stdchar'
23257stdio_base='$stdio_base'
23258stdio_bufsiz='$stdio_bufsiz'
23259stdio_cnt='$stdio_cnt'
23260stdio_filbuf='$stdio_filbuf'
23261stdio_ptr='$stdio_ptr'
23262stdio_stream_array='$stdio_stream_array'
23263strerror_r_proto='$strerror_r_proto'
23264strings='$strings'
23265submit='$submit'
23266subversion='$subversion'
23267sysman='$sysman'
23268tail='$tail'
23269tar='$tar'
23270targetarch='$targetarch'
23271tbl='$tbl'
23272tee='$tee'
23273test='$test'
23274timeincl='$timeincl'
23275timetype='$timetype'
23276tmpnam_r_proto='$tmpnam_r_proto'
23277to='$to'
23278touch='$touch'
23279tr='$tr'
23280trnl='$trnl'
23281troff='$troff'
23282ttyname_r_proto='$ttyname_r_proto'
23283u16size='$u16size'
23284u16type='$u16type'
23285u32size='$u32size'
23286u32type='$u32type'
23287u64size='$u64size'
23288u64type='$u64type'
23289u8size='$u8size'
23290u8type='$u8type'
23291uidformat='$uidformat'
23292uidsign='$uidsign'
23293uidsize='$uidsize'
23294uidtype='$uidtype'
23295uname='$uname'
23296uniq='$uniq'
23297uquadtype='$uquadtype'
23298use5005threads='$use5005threads'
23299use64bitall='$use64bitall'
23300use64bitint='$use64bitint'
23301usecrosscompile='$usecrosscompile'
23302usedevel='$usedevel'
23303usedl='$usedl'
23304usedtrace='$usedtrace'
23305usefaststdio='$usefaststdio'
23306useithreads='$useithreads'
23307uselargefiles='$uselargefiles'
23308uselongdouble='$uselongdouble'
23309usemallocwrap='$usemallocwrap'
23310usemorebits='$usemorebits'
23311usemultiplicity='$usemultiplicity'
23312usemymalloc='$usemymalloc'
23313usenm='$usenm'
23314useopcode='$useopcode'
23315useperlio='$useperlio'
23316useposix='$useposix'
23317usereentrant='$usereentrant'
23318userelocatableinc='$userelocatableinc'
23319usesfio='$usesfio'
23320useshrplib='$useshrplib'
23321usesitecustomize='$usesitecustomize'
23322usesocks='$usesocks'
23323usethreads='$usethreads'
23324usevendorprefix='$usevendorprefix'
23325usevfork='$usevfork'
23326usrinc='$usrinc'
23327uuname='$uuname'
23328uvXUformat='$uvXUformat'
23329uvoformat='$uvoformat'
23330uvsize='$uvsize'
23331uvtype='$uvtype'
23332uvuformat='$uvuformat'
23333uvxformat='$uvxformat'
23334vaproto='$vaproto'
23335vendorarch='$vendorarch'
23336vendorarchexp='$vendorarchexp'
23337vendorbin='$vendorbin'
23338vendorbinexp='$vendorbinexp'
23339vendorhtml1dir='$vendorhtml1dir'
23340vendorhtml1direxp='$vendorhtml1direxp'
23341vendorhtml3dir='$vendorhtml3dir'
23342vendorhtml3direxp='$vendorhtml3direxp'
23343vendorlib='$vendorlib'
23344vendorlib_stem='$vendorlib_stem'
23345vendorlibexp='$vendorlibexp'
23346vendorman1dir='$vendorman1dir'
23347vendorman1direxp='$vendorman1direxp'
23348vendorman3dir='$vendorman3dir'
23349vendorman3direxp='$vendorman3direxp'
23350vendorprefix='$vendorprefix'
23351vendorprefixexp='$vendorprefixexp'
23352vendorscript='$vendorscript'
23353vendorscriptexp='$vendorscriptexp'
23354version='$version'
23355version_patchlevel_string='$version_patchlevel_string'
23356versiononly='$versiononly'
23357vi='$vi'
23358voidflags='$voidflags'
23359xlibpth='$xlibpth'
23360yacc='$yacc'
23361yaccflags='$yaccflags'
23362zcat='$zcat'
23363zip='$zip'
23364EOT
23365
23366: add special variables
23367$test -f $src/patchlevel.h && \
23368awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23369echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23370echo "PERL_CONFIG_SH=true" >>config.sh
23371
23372: propagate old symbols
23373if $test -f UU/config.sh; then
23374	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
23375	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23376		config.sh config.sh UU/oldconfig.sh |\
23377		$sort | $uniq -u >UU/oldsyms
23378	set X `cat UU/oldsyms`
23379	shift
23380	case $# in
23381	0) ;;
23382	*)
23383		cat <<EOM
23384Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23385EOM
23386		echo ": Variables propagated from previous config.sh file." >>config.sh
23387		for sym in `cat UU/oldsyms`; do
23388			echo "    Propagating $hint variable "'$'"$sym..."
23389			eval 'tmp="$'"${sym}"'"'
23390			echo "$tmp" | \
23391				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23392		done
23393		;;
23394	esac
23395fi
23396
23397: Finish up by extracting the .SH files
23398case "$alldone" in
23399exit)
23400	$rm -rf UU
23401	echo "Extraction done."
23402	exit 0
23403	;;
23404cont)
23405	;;
23406'')
23407	dflt=''
23408	nostick=true
23409	$cat <<EOM
23410
23411If you'd like to make any changes to the config.sh file before I begin
23412to configure things, do it as a shell escape now (e.g. !vi config.sh).
23413
23414EOM
23415	rp="Press return or use a shell escape to edit config.sh:"
23416	. UU/myread
23417	nostick=''
23418	case "$ans" in
23419	'') ;;
23420	*) : in case they cannot read
23421		sh 1>&4 -c "$ans";;
23422	esac
23423	;;
23424esac
23425
23426: if this fails, just run all the .SH files by hand
23427. ./config.sh
23428
23429echo " "
23430exec 1>&4
23431pwd=`pwd`
23432. ./UU/extract
23433cd "$pwd"
23434
23435if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23436	dflt=y
23437	case "$silent" in
23438	true) ;;
23439	*)
23440		$cat <<EOM
23441
23442Now you need to generate make dependencies by running "$make depend".
23443You might prefer to run it in background: "$make depend > makedepend.out &"
23444It can take a while, so you might not want to run it right now.
23445
23446EOM
23447		;;
23448	esac
23449	rp="Run $make depend now?"
23450	. UU/myread
23451	case "$ans" in
23452	y*)
23453		$make depend && echo "Now you must run '$make'."
23454		;;
23455	*)
23456		echo "You must run '$make depend' then '$make'."
23457		;;
23458	esac
23459elif test -f [Mm]akefile; then
23460	echo " "
23461	echo "Now you must run a $make."
23462else
23463	echo "Configure done."
23464fi
23465
23466if $test -f Policy.sh; then
23467    $cat <<EOM
23468
23469If you compile $package on a different machine or from a different object
23470directory, copy the Policy.sh file from this object directory to the
23471new one before you run Configure -- this will help you with most of
23472the policy defaults.
23473
23474EOM
23475fi
23476if $test -f config.msg; then
23477    echo "Hmm.  I also noted the following information while running:"
23478    echo " "
23479    $cat config.msg >&4
23480    $rm -f config.msg
23481fi
23482$rm -f kit*isdone ark*isdone
23483$rm -rf UU
23484
23485: End of Configure
23486
23487