xref: /openbsd-src/gnu/usr.bin/perl/Configure (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
19#
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
26
27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28#
29# Generated on Mon Oct  8 10:22:27 CEST 2007 [metaconfig 3.0 PL70]
30# (with additional metaconfig patches by perlbug@perl.org)
31
32cat >c1$$ <<EOF
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false.  Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
43cat >c2$$ <<EOF
44
45OOPS!  You naughty creature!  You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
49true || cat c1$$ c2$$
50true || exec sh $0 $argv:q
51
52(exit $?0) || cat c2$$
53(exit $?0) || exec sh $0 $argv:q
54rm -f c1$$ c2$$
55
56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57	cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65	exit 1
66fi
67
68if test ! -c /dev/null ; then
69	cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77	exit 1
78fi
79
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85	test "$me" || me=$0
86	;;
87esac
88
89: Proper separator for the PATH environment variable
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93    if test -n "$OS2_SHELL"; then
94		p_=\;
95		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97		is_os2=yes
98	elif test -n "$DJGPP"; then
99		case "X${MACHTYPE:-nonesuchmach}" in
100		*cygwin) ;;
101		*) p_=\; ;;
102		esac
103	fi
104fi
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
115paths="$paths /system/gnu_library/bin"
116
117for p in $paths
118do
119	case "$p_$PATH$p_" in
120	*$p_$p$p_*) ;;
121	*) test -d $p && PATH=$PATH$p_$p ;;
122	esac
123done
124
125PATH=.$p_$PATH
126export PATH
127
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
134if (PATH=.; alias -x) >/dev/null 2>&1; then
135		inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138	needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141	if test X`/usr/bin/uname -v` = X4; then
142		avoidksh="to avoid AIX 4's /bin/sh"
143		newsh=/usr/bin/bsh
144	fi
145fi
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147	if test X`/usr/bin/uname -s` = XOSF1; then
148	        avoidksh="to avoid Digital UNIX' ksh"
149	        newsh=/bin/sh
150	        unset BIN_SH # if this is 'xpg4' sh will start up ksh
151	fi
152fi
153case "$inksh/$needksh" in
154/[a-z]*)
155		ENV=''
156		changesh=true
157		reason="$needksh"
158	;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162	changesh=true
163	reason="$avoidksh"
164	;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
168		cat <<EOM
169(I see you are using the Korn shell.  Some ksh's blow up on $me,
170mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171EOM
172	;;
173esac
174case "$changesh" in
175true)
176	export newsh
177	echo "(Feeding myself to $newsh $reason.)"
178	case "$0" in
179	Configure|*/Configure) exec $newsh $0 "$@";;
180	*) exec $newsh Configure "$@";;
181	esac
182	;;
183esac
184test -x "${newsh}" || unset newsh
185
186: if needed set CDPATH to a harmless value that is not chatty
187: avoid bash 2.02 problems with empty CDPATH.
188case "$CDPATH" in
189'')	;;
190*)	case "$SHELL" in
191	*bash*)	CDPATH='.' ;;
192	*)		CDPATH='' ;;
193	esac
194	;;
195esac
196: Configure runs within the UU subdirectory
197test -d UU || mkdir UU
198cd UU && rm -f ./*
199
200ccname=''
201ccversion=''
202ccsymbols=''
203cppccsymbols=''
204cppsymbols=''
205from=''
206run=''
207targetarch=''
208to=''
209usecrosscompile=''
210mistrustnm=''
211perllibs=''
212dynamic_ext=''
213extensions=''
214known_extensions=''
215nonxs_ext=''
216static_ext=''
217useopcode=''
218useposix=''
219extras=''
220d_bsd=''
221d_eunice=''
222d_xenix=''
223eunicefix=''
224Mcc=''
225ar=''
226awk=''
227bash=''
228bison=''
229byacc=''
230cat=''
231chgrp=''
232chmod=''
233chown=''
234comm=''
235compress=''
236cp=''
237cpio=''
238cpp=''
239csh=''
240date=''
241echo=''
242egrep=''
243emacs=''
244expr=''
245find=''
246flex=''
247gmake=''
248grep=''
249gzip=''
250inews=''
251ksh=''
252less=''
253line=''
254lint=''
255ln=''
256lp=''
257lpr=''
258ls=''
259mail=''
260mailx=''
261make=''
262mkdir=''
263more=''
264mv=''
265nm=''
266nroff=''
267perl=''
268pg=''
269pmake=''
270pr=''
271rm=''
272rmail=''
273sed=''
274sendmail=''
275shar=''
276sleep=''
277smail=''
278sort=''
279submit=''
280tail=''
281tar=''
282tbl=''
283tee=''
284test=''
285touch=''
286tr=''
287troff=''
288uname=''
289uniq=''
290uuname=''
291vi=''
292zcat=''
293zip=''
294full_ar=''
295full_sed=''
296libswanted=''
297hint=''
298myuname=''
299osname=''
300osvers=''
301Author=''
302Date=''
303Header=''
304Id=''
305Locker=''
306Log=''
307RCSfile=''
308Revision=''
309Source=''
310State=''
311_a=''
312_exe=''
313_o=''
314archobjs=''
315exe_ext=''
316firstmakefile=''
317lib_ext=''
318obj_ext=''
319path_sep=''
320rm_try=''
321afs=''
322afsroot=''
323alignbytes=''
324ansi2knr=''
325archlib=''
326archlibexp=''
327d_archlib=''
328installarchlib=''
329archname=''
330myarchname=''
331d_atolf=''
332d_atoll=''
333baserev=''
334bin=''
335binexp=''
336initialinstalllocation=''
337installbin=''
338userelocatableinc=''
339byteorder=''
340cc=''
341ccflags=''
342cppflags=''
343ldflags=''
344lkflags=''
345locincpth=''
346optimize=''
347cf_email=''
348cf_by=''
349cf_time=''
350contains=''
351cpp_stuff=''
352cpplast=''
353cppminus=''
354cpprun=''
355cppstdin=''
356d__fwalk=''
357d_access=''
358d_accessx=''
359d_aintl=''
360d_alarm=''
361asctime_r_proto=''
362d_asctime_r=''
363d_attribute_format=''
364d_attribute_malloc=''
365d_attribute_nonnull=''
366d_attribute_noreturn=''
367d_attribute_pure=''
368d_attribute_unused=''
369d_attribute_warn_unused_result=''
370d_printf_format_null=''
371d_bcmp=''
372d_bcopy=''
373d_builtin_choose_expr=''
374d_builtin_expect=''
375d_bzero=''
376d_c99_variadic_macros=''
377d_casti32=''
378castflags=''
379d_castneg=''
380d_chown=''
381d_chroot=''
382d_chsize=''
383d_class=''
384d_clearenv=''
385d_closedir=''
386d_void_closedir=''
387d_cmsghdr_s=''
388d_const=''
389d_copysignl=''
390d_cplusplus=''
391cryptlib=''
392d_crypt=''
393crypt_r_proto=''
394d_crypt_r=''
395d_csh=''
396full_csh=''
397d_ctermid=''
398ctermid_r_proto=''
399d_ctermid_r=''
400ctime_r_proto=''
401d_ctime_r=''
402d_cuserid=''
403d_dbl_dig=''
404d_dbminitproto=''
405d_difftime=''
406d_dir_dd_fd=''
407d_dirfd=''
408d_dlerror=''
409d_dlopen=''
410d_dlsymun=''
411d_dosuid=''
412d_suidsafe=''
413d_drand48_r=''
414drand48_r_proto=''
415d_drand48proto=''
416d_dup2=''
417d_eaccess=''
418d_endgrent=''
419d_endgrent_r=''
420endgrent_r_proto=''
421d_endhent=''
422d_endhostent_r=''
423endhostent_r_proto=''
424d_endnent=''
425d_endnetent_r=''
426endnetent_r_proto=''
427d_endpent=''
428d_endprotoent_r=''
429endprotoent_r_proto=''
430d_endpwent=''
431d_endpwent_r=''
432endpwent_r_proto=''
433d_endsent=''
434d_endservent_r=''
435endservent_r_proto=''
436d_faststdio=''
437d_fchdir=''
438d_fchmod=''
439d_fchown=''
440d_fcntl=''
441d_fcntl_can_lock=''
442d_fd_macros=''
443d_fd_set=''
444d_fds_bits=''
445d_fgetpos=''
446d_finite=''
447d_finitel=''
448d_flexfnam=''
449d_flock=''
450d_flockproto=''
451d_fork=''
452d_fp_class=''
453d_fpclass=''
454d_fpclassify=''
455d_fpclassl=''
456d_fpos64_t=''
457d_frexpl=''
458d_fs_data_s=''
459d_fseeko=''
460d_fsetpos=''
461d_fstatfs=''
462d_fsync=''
463d_ftello=''
464d_ftime=''
465d_gettimeod=''
466d_futimes=''
467d_Gconvert=''
468d_getcwd=''
469d_getespwnam=''
470d_getfsstat=''
471d_getgrent=''
472d_getgrent_r=''
473getgrent_r_proto=''
474d_getgrgid_r=''
475getgrgid_r_proto=''
476d_getgrnam_r=''
477getgrnam_r_proto=''
478d_getgrps=''
479d_gethbyaddr=''
480d_gethbyname=''
481d_gethent=''
482aphostname=''
483d_gethname=''
484d_phostname=''
485d_uname=''
486d_gethostbyaddr_r=''
487gethostbyaddr_r_proto=''
488d_gethostbyname_r=''
489gethostbyname_r_proto=''
490d_gethostent_r=''
491gethostent_r_proto=''
492d_gethostprotos=''
493d_getitimer=''
494d_getlogin=''
495d_getlogin_r=''
496getlogin_r_proto=''
497d_getmnt=''
498d_getmntent=''
499d_getnbyaddr=''
500d_getnbyname=''
501d_getnent=''
502d_getnetbyaddr_r=''
503getnetbyaddr_r_proto=''
504d_getnetbyname_r=''
505getnetbyname_r_proto=''
506d_getnetent_r=''
507getnetent_r_proto=''
508d_getnetprotos=''
509d_getpagsz=''
510d_getpent=''
511d_getpgid=''
512d_getpgrp2=''
513d_bsdgetpgrp=''
514d_getpgrp=''
515d_getppid=''
516d_getprior=''
517d_getpbyname=''
518d_getpbynumber=''
519d_getprotobyname_r=''
520getprotobyname_r_proto=''
521d_getprotobynumber_r=''
522getprotobynumber_r_proto=''
523d_getprotoent_r=''
524getprotoent_r_proto=''
525d_getprotoprotos=''
526d_getprpwnam=''
527d_getpwent=''
528d_getpwent_r=''
529getpwent_r_proto=''
530d_getpwnam_r=''
531getpwnam_r_proto=''
532d_getpwuid_r=''
533getpwuid_r_proto=''
534d_getsent=''
535d_getservbyname_r=''
536getservbyname_r_proto=''
537d_getservbyport_r=''
538getservbyport_r_proto=''
539d_getservent_r=''
540getservent_r_proto=''
541d_getservprotos=''
542d_getspnam=''
543d_getspnam_r=''
544getspnam_r_proto=''
545d_getsbyname=''
546d_getsbyport=''
547d_gmtime_r=''
548gmtime_r_proto=''
549d_gnulibc=''
550gnulibc_version=''
551d_hasmntopt=''
552d_htonl=''
553d_ilogbl=''
554d_inetaton=''
555d_int64_t=''
556d_isascii=''
557d_isfinite=''
558d_isinf=''
559d_isnan=''
560d_isnanl=''
561d_killpg=''
562d_lchown=''
563d_ldbl_dig=''
564d_libm_lib_version=''
565d_link=''
566d_localtime_r=''
567d_localtime_r_needs_tzset=''
568localtime_r_proto=''
569d_locconv=''
570d_lockf=''
571d_longdbl=''
572longdblsize=''
573d_longlong=''
574longlongsize=''
575d_lseekproto=''
576d_lstat=''
577d_madvise=''
578d_malloc_good_size=''
579d_malloc_size=''
580d_mblen=''
581d_mbstowcs=''
582d_mbtowc=''
583d_memchr=''
584d_memcmp=''
585d_memcpy=''
586d_memmove=''
587d_memset=''
588d_mkdir=''
589d_mkdtemp=''
590d_mkfifo=''
591d_mkstemp=''
592d_mkstemps=''
593d_mktime=''
594d_mmap=''
595mmaptype=''
596d_modfl=''
597d_modfl_pow32_bug=''
598d_modflproto=''
599d_mprotect=''
600d_msg=''
601d_msgctl=''
602d_msgget=''
603d_msghdr_s=''
604d_msgrcv=''
605d_msgsnd=''
606d_msync=''
607d_munmap=''
608d_nice=''
609d_nl_langinfo=''
610d_off64_t=''
611d_open3=''
612d_fpathconf=''
613d_pathconf=''
614d_pause=''
615d_pipe=''
616d_poll=''
617d_portable=''
618d_procselfexe=''
619procselfexe=''
620d_old_pthread_create_joinable=''
621old_pthread_create_joinable=''
622d_pthread_atfork=''
623d_pthread_attr_setscope=''
624d_pthread_yield=''
625d_sched_yield=''
626sched_yield=''
627d_qgcvt=''
628d_random_r=''
629random_r_proto=''
630d_readdir64_r=''
631readdir64_r_proto=''
632d_readdir=''
633d_rewinddir=''
634d_seekdir=''
635d_telldir=''
636d_readdir_r=''
637readdir_r_proto=''
638d_readlink=''
639d_readv=''
640d_recvmsg=''
641d_rename=''
642d_rmdir=''
643d_safebcpy=''
644d_safemcpy=''
645d_sanemcmp=''
646d_sbrkproto=''
647d_scalbnl=''
648d_select=''
649d_sem=''
650d_semctl=''
651d_semget=''
652d_semop=''
653d_sendmsg=''
654d_setegid=''
655d_seteuid=''
656d_setgrent=''
657d_setgrent_r=''
658setgrent_r_proto=''
659d_setgrps=''
660d_sethent=''
661d_sethostent_r=''
662sethostent_r_proto=''
663d_setitimer=''
664d_setlinebuf=''
665d_setlocale=''
666d_setlocale_r=''
667setlocale_r_proto=''
668d_setnent=''
669d_setnetent_r=''
670setnetent_r_proto=''
671d_setpent=''
672d_setpgid=''
673d_setpgrp2=''
674d_bsdsetpgrp=''
675d_setpgrp=''
676d_setprior=''
677d_setproctitle=''
678d_setprotoent_r=''
679setprotoent_r_proto=''
680d_setpwent=''
681d_setpwent_r=''
682setpwent_r_proto=''
683d_setregid=''
684d_setresgid=''
685d_setresuid=''
686d_setreuid=''
687d_setrgid=''
688d_setruid=''
689d_setsent=''
690d_setservent_r=''
691setservent_r_proto=''
692d_setsid=''
693d_setvbuf=''
694d_sfio=''
695usesfio=''
696d_shm=''
697d_shmat=''
698d_shmatprototype=''
699shmattype=''
700d_shmctl=''
701d_shmdt=''
702d_shmget=''
703d_sigaction=''
704d_signbit=''
705d_sigprocmask=''
706d_sigsetjmp=''
707usesitecustomize=''
708d_snprintf=''
709d_vsnprintf=''
710d_sockatmark=''
711d_sockatmarkproto=''
712d_msg_ctrunc=''
713d_msg_dontroute=''
714d_msg_oob=''
715d_msg_peek=''
716d_msg_proxy=''
717d_oldsock=''
718d_scm_rights=''
719d_socket=''
720d_sockpair=''
721sockethdr=''
722socketlib=''
723d_socklen_t=''
724d_socks5_init=''
725d_sprintf_returns_strlen=''
726d_sqrtl=''
727d_srand48_r=''
728srand48_r_proto=''
729d_srandom_r=''
730srandom_r_proto=''
731d_sresgproto=''
732d_sresuproto=''
733d_statblks=''
734d_statfs_f_flags=''
735d_statfs_s=''
736d_fstatvfs=''
737d_statvfs=''
738d_stdio_cnt_lval=''
739d_stdio_ptr_lval=''
740d_stdio_ptr_lval_nochange_cnt=''
741d_stdio_ptr_lval_sets_cnt=''
742d_stdiobase=''
743d_stdstdio=''
744stdio_base=''
745stdio_bufsiz=''
746stdio_cnt=''
747stdio_filbuf=''
748stdio_ptr=''
749d_index=''
750d_strchr=''
751d_strcoll=''
752d_strctcpy=''
753d_strerrm=''
754d_strerror=''
755d_sysernlst=''
756d_syserrlst=''
757d_strerror_r=''
758strerror_r_proto=''
759d_strftime=''
760d_strlcat=''
761d_strlcpy=''
762d_strtod=''
763d_strtol=''
764d_strtold=''
765d_strtoll=''
766d_strtoq=''
767d_strtoul=''
768d_strtoull=''
769d_strtouq=''
770d_strxfrm=''
771d_symlink=''
772d_syscall=''
773d_syscallproto=''
774d_sysconf=''
775d_system=''
776d_tcgetpgrp=''
777d_tcsetpgrp=''
778d_telldirproto=''
779d_time=''
780timetype=''
781clocktype=''
782d_times=''
783d_tmpnam_r=''
784tmpnam_r_proto=''
785d_truncate=''
786d_ttyname_r=''
787ttyname_r_proto=''
788d_tzname=''
789d_u32align=''
790d_ualarm=''
791d_umask=''
792d_semctl_semid_ds=''
793d_semctl_semun=''
794d_union_semun=''
795d_unordered=''
796d_unsetenv=''
797d_usleep=''
798d_usleepproto=''
799d_ustat=''
800d_pseudofork=''
801d_vfork=''
802usevfork=''
803d_voidsig=''
804signal_t=''
805d_volatile=''
806d_charvspr=''
807d_vprintf=''
808d_wait4=''
809d_waitpid=''
810d_wcstombs=''
811d_wctomb=''
812d_writev=''
813dlext=''
814cccdlflags=''
815ccdlflags=''
816dlsrc=''
817ld=''
818lddlflags=''
819usedl=''
820doublesize=''
821ebcdic=''
822fflushNULL=''
823fflushall=''
824fpossize=''
825fpostype=''
826gccansipedantic=''
827gccosandvers=''
828gccversion=''
829gidformat=''
830gidsign=''
831gidsize=''
832gidtype=''
833groupstype=''
834h_fcntl=''
835h_sysfile=''
836html1dir=''
837html1direxp=''
838installhtml1dir=''
839html3dir=''
840html3direxp=''
841installhtml3dir=''
842i_arpainet=''
843i_crypt=''
844db_hashtype=''
845db_prefixtype=''
846db_version_major=''
847db_version_minor=''
848db_version_patch=''
849i_db=''
850i_dbm=''
851i_rpcsvcdbm=''
852d_dirnamlen=''
853direntrytype=''
854i_dirent=''
855i_dld=''
856i_dlfcn=''
857i_fcntl=''
858i_float=''
859i_fp=''
860i_fp_class=''
861i_gdbm=''
862d_grpasswd=''
863i_grp=''
864i_ieeefp=''
865i_inttypes=''
866i_langinfo=''
867i_libutil=''
868i_limits=''
869i_locale=''
870i_machcthr=''
871i_malloc=''
872i_math=''
873i_memory=''
874i_mntent=''
875i_ndbm=''
876i_netdb=''
877i_neterrno=''
878i_netinettcp=''
879i_niin=''
880i_sysin=''
881i_poll=''
882i_prot=''
883i_pthread=''
884d_pwage=''
885d_pwchange=''
886d_pwclass=''
887d_pwcomment=''
888d_pwexpire=''
889d_pwgecos=''
890d_pwpasswd=''
891d_pwquota=''
892i_pwd=''
893i_sfio=''
894i_shadow=''
895i_socks=''
896i_stddef=''
897i_stdlib=''
898i_string=''
899strings=''
900i_sunmath=''
901i_sysaccess=''
902i_sysdir=''
903i_sysfile=''
904d_voidtty=''
905i_bsdioctl=''
906i_sysfilio=''
907i_sysioctl=''
908i_syssockio=''
909i_syslog=''
910i_sysmman=''
911i_sysmode=''
912i_sysmount=''
913i_sysndir=''
914i_sysparam=''
915i_sysresrc=''
916i_syssecrt=''
917i_sysselct=''
918i_sysstat=''
919i_sysstatfs=''
920i_sysstatvfs=''
921i_systimes=''
922i_systypes=''
923i_sysuio=''
924i_sysun=''
925i_sysutsname=''
926i_sysvfs=''
927i_syswait=''
928i_sgtty=''
929i_termio=''
930i_termios=''
931d_tm_tm_gmtoff=''
932d_tm_tm_zone=''
933i_systime=''
934i_systimek=''
935i_time=''
936timeincl=''
937i_unistd=''
938i_ustat=''
939i_utime=''
940i_values=''
941i_stdarg=''
942i_varargs=''
943i_varhdr=''
944i_vfork=''
945d_inc_version_list=''
946inc_version_list=''
947inc_version_list_init=''
948installprefix=''
949installprefixexp=''
950installstyle=''
951installusrbinperl=''
952intsize=''
953longsize=''
954shortsize=''
955issymlink=''
956libc=''
957ldlibpthname=''
958libperl=''
959shrpenv=''
960useshrplib=''
961glibpth=''
962libpth=''
963loclibpth=''
964plibpth=''
965xlibpth=''
966ignore_versioned_solibs=''
967libs=''
968libsdirs=''
969libsfiles=''
970libsfound=''
971libspath=''
972lns=''
973d_PRIEUldbl=''
974d_PRIFUldbl=''
975d_PRIGUldbl=''
976d_PRIeldbl=''
977d_PRIfldbl=''
978d_PRIgldbl=''
979d_SCNfldbl=''
980sPRIEUldbl=''
981sPRIFUldbl=''
982sPRIGUldbl=''
983sPRIeldbl=''
984sPRIfldbl=''
985sPRIgldbl=''
986sSCNfldbl=''
987lseeksize=''
988lseektype=''
989mad=''
990madlyh=''
991madlyobj=''
992madlysrc=''
993make_set_make=''
994d_mymalloc=''
995freetype=''
996mallocobj=''
997mallocsrc=''
998malloctype=''
999usemallocwrap=''
1000usemymalloc=''
1001installman1dir=''
1002man1dir=''
1003man1direxp=''
1004man1ext=''
1005installman3dir=''
1006man3dir=''
1007man3direxp=''
1008man3ext=''
1009modetype=''
1010multiarch=''
1011mydomain=''
1012myhostname=''
1013phostname=''
1014c=''
1015n=''
1016d_eofnblk=''
1017eagain=''
1018o_nonblock=''
1019rd_nodata=''
1020need_va_copy=''
1021netdb_hlen_type=''
1022netdb_host_type=''
1023netdb_name_type=''
1024netdb_net_type=''
1025groupcat=''
1026hostcat=''
1027passcat=''
1028orderlib=''
1029ranlib=''
1030d_perl_otherlibdirs=''
1031otherlibdirs=''
1032package=''
1033spackage=''
1034pager=''
1035api_revision=''
1036api_subversion=''
1037api_version=''
1038api_versionstring=''
1039patchlevel=''
1040perl_patchlevel=''
1041revision=''
1042subversion=''
1043version=''
1044version_patchlevel_string=''
1045perl5=''
1046perladmin=''
1047perlpath=''
1048d_nv_preserves_uv=''
1049d_nv_zero_is_allbits_zero=''
1050i16size=''
1051i16type=''
1052i32size=''
1053i32type=''
1054i64size=''
1055i64type=''
1056i8size=''
1057i8type=''
1058ivsize=''
1059ivtype=''
1060nv_preserves_uv_bits=''
1061nvsize=''
1062nvtype=''
1063u16size=''
1064u16type=''
1065u32size=''
1066u32type=''
1067u64size=''
1068u64type=''
1069u8size=''
1070u8type=''
1071uvsize=''
1072uvtype=''
1073ivdformat=''
1074nvEUformat=''
1075nvFUformat=''
1076nvGUformat=''
1077nveformat=''
1078nvfformat=''
1079nvgformat=''
1080uvXUformat=''
1081uvoformat=''
1082uvuformat=''
1083uvxformat=''
1084pidtype=''
1085prefix=''
1086prefixexp=''
1087installprivlib=''
1088privlib=''
1089privlibexp=''
1090prototype=''
1091ptrsize=''
1092d_PRIXU64=''
1093d_PRId64=''
1094d_PRIi64=''
1095d_PRIo64=''
1096d_PRIu64=''
1097d_PRIx64=''
1098sPRIXU64=''
1099sPRId64=''
1100sPRIi64=''
1101sPRIo64=''
1102sPRIu64=''
1103sPRIx64=''
1104d_quad=''
1105quadkind=''
1106quadtype=''
1107uquadtype=''
1108drand01=''
1109randbits=''
1110randfunc=''
1111randseedtype=''
1112seedfunc=''
1113installscript=''
1114scriptdir=''
1115scriptdirexp=''
1116selectminbits=''
1117selecttype=''
1118sh=''
1119sig_count=''
1120sig_name=''
1121sig_name_init=''
1122sig_num=''
1123sig_num_init=''
1124sig_size=''
1125d_sitearch=''
1126installsitearch=''
1127sitearch=''
1128sitearchexp=''
1129installsitebin=''
1130sitebin=''
1131sitebinexp=''
1132installsitehtml1dir=''
1133sitehtml1dir=''
1134sitehtml1direxp=''
1135installsitehtml3dir=''
1136sitehtml3dir=''
1137sitehtml3direxp=''
1138installsitelib=''
1139sitelib=''
1140sitelib_stem=''
1141sitelibexp=''
1142installsiteman1dir=''
1143siteman1dir=''
1144siteman1direxp=''
1145installsiteman3dir=''
1146siteman3dir=''
1147siteman3direxp=''
1148siteprefix=''
1149siteprefixexp=''
1150installsitescript=''
1151sitescript=''
1152sitescriptexp=''
1153sizesize=''
1154sizetype=''
1155so=''
1156socksizetype=''
1157sharpbang=''
1158shsharp=''
1159spitshell=''
1160src=''
1161ssizetype=''
1162startperl=''
1163startsh=''
1164stdchar=''
1165d_stdio_stream_array=''
1166stdio_stream_array=''
1167sysman=''
1168trnl=''
1169uidformat=''
1170uidsign=''
1171uidsize=''
1172uidtype=''
1173archname64=''
1174use64bitall=''
1175use64bitint=''
1176usefaststdio=''
1177ccflags_uselargefiles=''
1178ldflags_uselargefiles=''
1179libswanted_uselargefiles=''
1180uselargefiles=''
1181uselongdouble=''
1182usemorebits=''
1183usemultiplicity=''
1184nm_opt=''
1185nm_so_opt=''
1186runnm=''
1187usenm=''
1188useperlio=''
1189usesocks=''
1190d_oldpthreads=''
1191use5005threads=''
1192useithreads=''
1193usereentrant=''
1194usethreads=''
1195incpath=''
1196mips_type=''
1197usrinc=''
1198d_vendorarch=''
1199installvendorarch=''
1200vendorarch=''
1201vendorarchexp=''
1202d_vendorbin=''
1203installvendorbin=''
1204vendorbin=''
1205vendorbinexp=''
1206installvendorhtml1dir=''
1207vendorhtml1dir=''
1208vendorhtml1direxp=''
1209installvendorhtml3dir=''
1210vendorhtml3dir=''
1211vendorhtml3direxp=''
1212d_vendorlib=''
1213installvendorlib=''
1214vendorlib=''
1215vendorlib_stem=''
1216vendorlibexp=''
1217installvendorman1dir=''
1218vendorman1dir=''
1219vendorman1direxp=''
1220installvendorman3dir=''
1221vendorman3dir=''
1222vendorman3direxp=''
1223usevendorprefix=''
1224vendorprefix=''
1225vendorprefixexp=''
1226d_vendorscript=''
1227installvendorscript=''
1228vendorscript=''
1229vendorscriptexp=''
1230versiononly=''
1231defvoidused=''
1232voidflags=''
1233yacc=''
1234yaccflags=''
1235CONFIG=''
1236
1237define='define'
1238undef='undef'
1239smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240rmlist=''
1241
1242: We must find out about Eunice early
1243eunicefix=':'
1244if test -f /etc/unixtovms; then
1245	eunicefix=/etc/unixtovms
1246fi
1247if test -f /etc/unixtovms.exe; then
1248	eunicefix=/etc/unixtovms.exe
1249fi
1250
1251: Set executable suffix now -- needed before hints available
1252if test -f "/libs/version.library"; then
1253: Amiga OS
1254    _exe=""
1255elif test -f "/system/gnu_library/bin/ar.pm"; then
1256: Stratus VOS
1257    _exe=".pm"
1258elif test -n "$DJGPP"; then
1259: DOS DJGPP
1260    _exe=".exe"
1261elif test -d c:/. -o -n "$is_os2" ; then
1262: OS/2 or cygwin
1263    _exe=".exe"
1264fi
1265
1266i_whoami=''
1267: Trailing extension.  Override this in a hint file, if needed.
1268: Extra object files, if any, needed on this platform.
1269archobjs=''
1270archname=''
1271groupstype=''
1272libnames=''
1273: change the next line if compiling for Xenix/286 on Xenix/386
1274xlibpth='/usr/lib/386 /lib/386'
1275: Possible local library directories to search.
1276loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279: general looking path for locating libraries
1280glibpth="/lib /usr/lib $xlibpth"
1281glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286: Private path used by Configure to find libraries.  Its value
1287: is prepended to libpth. This variable takes care of special
1288: machines, like the mips.  Usually, it should be empty.
1289plibpth=''
1290
1291: default library list
1292libswanted=''
1293: some systems want to use only the non-versioned libso:s
1294ignore_versioned_solibs=''
1295siteman1dir=''
1296siteman3dir=''
1297sitescript=''
1298: set usethreads on the Configure command line to enable threads.
1299usereentrant='undef'
1300: full support for void wanted by default
1301defvoidused=15
1302
1303: Possible local include directories to search.
1304: Set locincpth to "" in a hint file to defeat local include searches.
1305locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307:
1308: no include file wanted by default
1309inclwanted=''
1310
1311: Enable -DEBUGGING and -DDEBUGGING from the command line
1312EBUGGING=''
1313DEBUGGING=old
1314
1315ccname=''
1316ccversion=''
1317perllibs=''
1318: set useposix=false in your hint file to disable the POSIX extension.
1319useposix=true
1320: set useopcode=false in your hint file to disable the Opcode extension.
1321useopcode=true
1322archname64=''
1323ccflags_uselargefiles=''
1324ldflags_uselargefiles=''
1325libswanted_uselargefiles=''
1326: set usemultiplicity on the Configure command line to enable multiplicity.
1327: set usesocks on the Configure command line to enable socks.
1328: List of libraries we want.
1329: If anyone needs extra -lxxx, put those in a hint file.
1330libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332: We probably want to search /usr/shlib before most other libraries.
1333: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335glibpth="/usr/shlib $glibpth"
1336: Do not use vfork unless overridden by a hint file.
1337usevfork=false
1338
1339: Find the basic shell for Bourne shell scripts
1340case "$sh" in
1341'')
1342	case "$SYSTYPE" in
1343	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344	*) xxx='/bin/sh';;
1345	esac
1346	if test -f "$xxx"; then
1347		sh="$xxx"
1348	else
1349		: Build up a list and do a single loop so we can 'break' out.
1350		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351		for xxx in sh bash ksh pdksh ash; do
1352			for p in $pth; do
1353				try="$try ${p}/${xxx}"
1354			done
1355		done
1356		for xxx in $try; do
1357			if test -f "$xxx"; then
1358				sh="$xxx";
1359				break
1360			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361				sh="$xxx";
1362				break
1363			elif test -f "$xxx.exe"; then
1364				sh="$xxx";
1365				break
1366			fi
1367		done
1368	fi
1369	;;
1370esac
1371
1372case "$sh" in
1373'')	cat >&2 <<EOM
1374$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376Usually it's in /bin/sh.  How did you even get this far?
1377Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378we'll try to straighten this all out.
1379EOM
1380	exit 1
1381	;;
1382esac
1383
1384: see if sh knows # comments
1385if `$sh -c '#' >/dev/null 2>&1`; then
1386	shsharp=true
1387	spitshell=cat
1388	xcat=/bin/cat
1389	test -f $xcat$_exe || xcat=/usr/bin/cat
1390	if test ! -f $xcat$_exe; then
1391		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392			if test -f $p/cat$_exe; then
1393				xcat=$p/cat
1394				break
1395			fi
1396		done
1397		if test ! -f $xcat$_exe; then
1398			echo "Can't find cat anywhere!"
1399			exit 1
1400		fi
1401	fi
1402	echo "#!$xcat" >sharp
1403	$eunicefix sharp
1404	chmod +x sharp
1405	./sharp > today
1406	if test -s today; then
1407		sharpbang='#!'
1408	else
1409		echo "#! $xcat" > sharp
1410		$eunicefix sharp
1411		chmod +x sharp
1412		./sharp > today
1413		if test -s today; then
1414			sharpbang='#! '
1415		else
1416			sharpbang=': use '
1417		fi
1418	fi
1419else
1420	echo " "
1421	echo "Your $sh doesn't grok # comments--I will strip them later on."
1422	shsharp=false
1423	cd ..
1424	echo "exec grep -v '^[ 	]*#'" >spitshell
1425	chmod +x spitshell
1426	$eunicefix spitshell
1427	spitshell=`pwd`/spitshell
1428	cd UU
1429	echo "I presume that if # doesn't work, #! won't work either!"
1430	sharpbang=': use '
1431fi
1432rm -f sharp today
1433
1434: figure out how to guarantee sh startup
1435case "$startsh" in
1436'') startsh=${sharpbang}${sh} ;;
1437*)
1438esac
1439cat >sharp <<EOSS
1440$startsh
1441set abc
1442test "$?abc" != 1
1443EOSS
1444
1445chmod +x sharp
1446$eunicefix sharp
1447if ./sharp; then
1448	: echo "Yup, it does."
1449else
1450	echo "Hmm... '$startsh' does not guarantee sh startup..."
1451	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452fi
1453rm -f sharp
1454
1455
1456: Save command line options in file UU/cmdline.opt for later use in
1457: generating config.sh.
1458cat > cmdline.opt <<EOSH
1459# Configure command line arguments.
1460config_arg0='$0'
1461config_args='$*'
1462config_argc=$#
1463EOSH
1464argn=1
1465args_exp=''
1466args_sep=''
1467for arg in "$@"; do
1468	cat >>cmdline.opt <<EOSH
1469config_arg$argn='$arg'
1470EOSH
1471	# Extreme backslashitis: replace each ' by '"'"'
1472	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473$arg
1474EOC
1475	arg_exp=`cat cmdl.opt`
1476	args_exp="$args_exp$args_sep'$arg_exp'"
1477	argn=`expr $argn + 1`
1478	args_sep=' '
1479done
1480# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481# used by ./hints/os2.sh
1482rm -f cmdl.opt
1483
1484: produce awk script to parse command line options
1485cat >options.awk <<'EOF'
1486BEGIN {
1487	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1488
1489	len = length(optstr);
1490	for (i = 1; i <= len; i++) {
1491		c = substr(optstr, i, 1);
1492		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493		if (a == ":") {
1494			arg[c] = 1;
1495			i++;
1496		}
1497		opt[c] = 1;
1498	}
1499}
1500{
1501	expect = 0;
1502	str = $0;
1503	if (substr(str, 1, 1) != "-") {
1504		printf("'%s'\n", str);
1505		next;
1506	}
1507	len = length($0);
1508	for (i = 2; i <= len; i++) {
1509		c = substr(str, i, 1);
1510		if (!opt[c]) {
1511			printf("-%s\n", substr(str, i));
1512			next;
1513		}
1514		printf("-%s\n", c);
1515		if (arg[c]) {
1516			if (i < len)
1517				printf("'%s'\n", substr(str, i + 1));
1518			else
1519				expect = 1;
1520			next;
1521		}
1522	}
1523}
1524END {
1525	if (expect)
1526		print "?";
1527}
1528EOF
1529
1530: process the command line options
1531set X `for arg in "$@"; do echo "X$arg"; done |
1532	sed -e s/X// | awk -f options.awk`
1533eval "set $*"
1534shift
1535rm -f options.awk
1536
1537: set up default values
1538fastread=''
1539reuseval=false
1540config_sh=''
1541alldone=''
1542error=''
1543silent=''
1544extractsh=''
1545override=''
1546knowitall=''
1547rm -f optdef.sh posthint.sh
1548cat >optdef.sh <<EOS
1549$startsh
1550EOS
1551
1552
1553: option parsing
1554while test $# -gt 0; do
1555	case "$1" in
1556	-d) shift; fastread=yes;;
1557	-e) shift; alldone=cont;;
1558	-f)
1559		shift
1560		cd ..
1561		if test -r "$1"; then
1562			config_sh="$1"
1563		else
1564			echo "$me: cannot read config file $1." >&2
1565			error=true
1566		fi
1567		cd UU
1568		shift;;
1569	--help|\
1570	-h) shift; error=true;;
1571	-r) shift; reuseval=true;;
1572	-s) shift; silent=true; realsilent=true;;
1573	-E) shift; alldone=exit;;
1574	-K) shift; knowitall=true;;
1575	-O) shift; override=true;;
1576	-S) shift; silent=true; extractsh=true;;
1577	-D)
1578		shift
1579		case "$1" in
1580		*=)
1581			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582			echo "$me: ignoring -D $1" >&2
1583			;;
1584		*=*) echo "$1" | \
1585				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586		*) echo "$1='define'" >> optdef.sh;;
1587		esac
1588		shift
1589		;;
1590	-U)
1591		shift
1592		case "$1" in
1593		*=) echo "$1" >> optdef.sh;;
1594		*=*)
1595			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596			echo "$me: ignoring -U $1" >&2
1597			;;
1598		*) echo "$1='undef'" >> optdef.sh;;
1599		esac
1600		shift
1601		;;
1602	-A)
1603	    shift
1604	    xxx=''
1605	    yyy="$1"
1606	    zzz=''
1607	    uuu=undef
1608	    case "$yyy" in
1609            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                 case "$zzz" in
1611                 *:*) zzz='' ;;
1612                 *)   xxx=append
1613                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1614                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                 esac
1616                 ;;
1617            esac
1618            case "$xxx" in
1619            '')  case "$yyy" in
1620                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                 esac
1627                 ;;
1628            esac
1629	    case "$xxx" in
1630	    append)
1631		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1632	    clear)
1633		echo "$yyy=''"			>> posthint.sh ;;
1634	    define)
1635	        case "$zzz" in
1636		'') zzz=define ;;
1637		esac
1638		echo "$yyy='$zzz'"		>> posthint.sh ;;
1639	    eval)
1640		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1641	    prepend)
1642		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1643	    undef)
1644	        case "$zzz" in
1645		'') zzz="$uuu" ;;
1646		esac
1647		echo "$yyy=$zzz"		>> posthint.sh ;;
1648            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649	    esac
1650	    shift
1651	    ;;
1652	-V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653	    exit 0;;
1654	--) break;;
1655	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656	*) break;;
1657	esac
1658done
1659
1660case "$error" in
1661true)
1662	cat >&2 <<EOM
1663Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                 [-U symbol] [-U symbol=] [-A command:symbol...]
1665  -d : use defaults for all answers.
1666  -e : go on without questioning past the production of config.sh.
1667  -f : specify an alternate default configuration file.
1668  -h : print this help message and exit (with an error status).
1669  -r : reuse C symbols value if possible (skips costly nm extraction).
1670  -s : silent mode, only echoes questions and essential information.
1671  -D : define symbol to have some value:
1672         -D symbol         symbol gets the value 'define'
1673         -D symbol=value   symbol gets the value 'value'
1674       common used examples (see INSTALL for more info):
1675         -Duse64bitint            use 64bit integers
1676         -Duse64bitall            use 64bit integers and pointers
1677         -Dusethreads             use thread support
1678         -Dinc_version_list=none  do not include older perl trees in @INC
1679         -DEBUGGING=none          DEBUGGING options
1680         -Dcc=gcc                 choose your compiler
1681         -Dprefix=/opt/perl5      choose your destination
1682  -E : stop at the end of questions, after having produced config.sh.
1683  -K : do not use unless you know what you are doing.
1684  -O : let -D and -U override definitions from loaded configuration file.
1685  -S : perform variable substitutions on all .SH files (can mix with -f)
1686  -U : undefine symbol:
1687         -U symbol    symbol gets the value 'undef'
1688         -U symbol=   symbol gets completely empty
1689       e.g.:  -Uversiononly
1690  -A : manipulate symbol after the platform specific hints have been applied:
1691         -A append:symbol=value   append value to symbol
1692         -A symbol=value          like append:, but with a separating space
1693         -A define:symbol=value   define symbol to have value
1694         -A clear:symbol          define symbol to be ''
1695         -A define:symbol         define symbol to be 'define'
1696         -A eval:symbol=value     define symbol to be eval of value
1697         -A prepend:symbol=value  prepend value to symbol
1698         -A undef:symbol          define symbol to be 'undef'
1699         -A undef:symbol=         define symbol to be ''
1700       e.g.:  -A prepend:libswanted='cl pthread '
1701              -A ccflags=-DSOME_MACRO
1702  -V : print version number and exit (with a zero status).
1703EOM
1704	exit 1
1705	;;
1706esac
1707
1708: Sanity checks
1709case "$fastread$alldone" in
1710yescont|yesexit) ;;
1711*)
1712	case "$extractsh" in
1713	true) ;;
1714	*)
1715		if test ! -t 0; then
1716			echo "Say 'sh Configure', not 'sh <Configure'"
1717			exit 1
1718		fi
1719		;;
1720	esac
1721	;;
1722esac
1723
1724exec 4>&1
1725case "$silent" in
1726true) exec 1>/dev/null;;
1727esac
1728
1729: run the defines and the undefines, if any, but leave the file out there...
1730touch optdef.sh
1731. ./optdef.sh
1732: create the posthint manipulation script and leave the file out there...
1733touch posthint.sh
1734
1735: set package name
1736package=perl5
1737first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742esac
1743
1744: Some greps do not return status, grrr.
1745echo "grimblepritz" >grimble
1746if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747	contains=contains
1748elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749	contains=grep
1750else
1751	contains=contains
1752fi
1753rm -f grimble
1754: the following should work in any shell
1755case "$contains" in
1756contains*)
1757	echo " "
1758	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759	cat >contains <<'EOSS'
1760grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761EOSS
1762chmod +x contains
1763esac
1764
1765: Find the path to the source tree
1766case "$src" in
1767'') case "$0" in
1768    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769         case "$src" in
1770	 /*)	;;
1771	 .)	;;
1772         *)	src=`cd ../$src && pwd` ;;
1773	 esac
1774         ;;
1775    *)   src='.';;
1776    esac;;
1777esac
1778case "$src" in
1779'')	src=/
1780	rsrc=/
1781	;;
1782/*) rsrc="$src";;
1783*) rsrc="../$src";;
1784esac
1785if test -f $rsrc/Configure && \
1786	$contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787then
1788   : found it, so we are ok.
1789else
1790	rsrc=''
1791	for src in . .. ../.. ../../.. ../../../..; do
1792		if test -f ../$src/Configure && \
1793			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794		then
1795			rsrc=../$src
1796			break
1797		fi
1798	done
1799fi
1800case "$rsrc" in
1801'')
1802	cat <<EOM >&4
1803
1804Sorry, I can't seem to locate the source dir for $package.  Please start
1805Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807EOM
1808	exit 1
1809	;;
1810../.)	rsrc='..';;
1811*)
1812	echo " "
1813	echo "Sources for $package found in \"$src\"." >&4
1814	;;
1815esac
1816
1817: script used to extract .SH files with variable substitutions
1818cat >extract <<'EOS'
1819PERL_CONFIG_SH=true
1820echo "Doing variable substitutions on .SH files..."
1821if test -f MANIFEST; then
1822	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823else
1824	echo "(Looking for .SH files under the source directory.)"
1825	set x `(cd "$src"; find . -name "*.SH" -print)`
1826fi
1827shift
1828case $# in
18290) set x `(cd "$src"; echo *.SH)`; shift;;
1830esac
1831if test ! -f "$src/$1"; then
1832	shift
1833fi
1834mkdir_p='
1835name=$1;
1836create="";
1837while test $name; do
1838	if test ! -d "$name"; then
1839		create="$name $create";
1840		name=`echo $name | sed -e "s|^[^/]*$||"`;
1841		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842	else
1843		name="";
1844	fi;
1845done;
1846for file in $create; do
1847	mkdir $file;
1848done
1849'
1850for file in $*; do
1851	case "$src" in
1852	".")
1853		case "$file" in
1854		*/*)
1855			dir=`expr X$file : 'X\(.*\)/'`
1856			file=`expr X$file : 'X.*/\(.*\)'`
1857			(cd "$dir" && . ./$file)
1858			;;
1859		*)
1860			. ./$file
1861			;;
1862		esac
1863		;;
1864	*)
1865		case "$file" in
1866		*/*)
1867			dir=`expr X$file : 'X\(.*\)/'`
1868			file=`expr X$file : 'X.*/\(.*\)'`
1869			(set x $dir; shift; eval $mkdir_p)
1870			sh <"$src/$dir/$file"
1871			;;
1872		*)
1873			sh <"$src/$file"
1874			;;
1875		esac
1876		;;
1877	esac
1878done
1879if test -f "$src/config_h.SH"; then
1880	if test ! -f config.h; then
1881	: oops, they left it out of MANIFEST, probably, so do it anyway.
1882	. "$src/config_h.SH"
1883	fi
1884fi
1885EOS
1886
1887: extract files and exit if asked to do so
1888case "$extractsh" in
1889true)
1890	case "$realsilent" in
1891	true) ;;
1892	*) exec 1>&4;;
1893	esac
1894	case "$config_sh" in
1895	'') config_sh='config.sh';;
1896	esac
1897	echo " "
1898	echo "Fetching answers from $config_sh..."
1899	cd ..
1900	. $config_sh
1901	test "$override" && . ./optdef.sh
1902	echo " "
1903	. UU/extract
1904	rm -rf UU
1905	echo "Extraction done."
1906	exit 0
1907	;;
1908esac
1909
1910: Eunice requires " " instead of "", can you believe it
1911echo " "
1912: Here we go...
1913echo "Beginning of configuration questions for $package."
1914
1915trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917: first determine how to suppress newline on echo command
1918echo " "
1919echo "Checking echo to see how to suppress newlines..."
1920(echo "hi there\c" ; echo " ") >.echotmp
1921if $contains c .echotmp >/dev/null 2>&1 ; then
1922	echo "...using -n."
1923	n='-n'
1924	c=''
1925else
1926	cat <<'EOM'
1927...using \c
1928EOM
1929	n=''
1930	c='\c'
1931fi
1932echo $n "The star should be here-->$c"
1933echo '*'
1934rm -f .echotmp
1935
1936: Now test for existence of everything in MANIFEST
1937echo " "
1938if test -f "$rsrc/MANIFEST"; then
1939	echo "First let's make sure your kit is complete.  Checking..." >&4
1940	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941	rm -f missing
1942	tmppwd=`pwd`
1943	for filelist in x??; do
1944		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945	done
1946	if test -s missing; then
1947		cat missing >&4
1948		cat >&4 <<'EOM'
1949
1950THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952You have the option of continuing the configuration process, despite the
1953distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955and contact the author (perlbug@perl.org).
1956
1957EOM
1958		echo $n "Continue? [n] $c" >&4
1959		read ans
1960		case "$ans" in
1961		y*)
1962			echo "Continuing..." >&4
1963			rm -f missing
1964			;;
1965		*)
1966			echo "ABORTING..." >&4
1967			kill $$
1968			;;
1969		esac
1970	else
1971		echo "Looks good..."
1972	fi
1973else
1974	echo "There is no MANIFEST file.  I hope your kit is complete !"
1975fi
1976rm -f missing x??
1977
1978echo " "
1979: Find the appropriate value for a newline for tr
1980if test -n "$DJGPP"; then
1981       trnl='\012'
1982fi
1983if test X"$trnl" = X; then
1984	case "`echo foo|tr '\n' x 2>/dev/null`" in
1985	foox) trnl='\n' ;;
1986	esac
1987fi
1988if test X"$trnl" = X; then
1989	case "`echo foo|tr '\012' x 2>/dev/null`" in
1990	foox) trnl='\012' ;;
1991	esac
1992fi
1993if test X"$trnl" = X; then
1994       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995       fooxy) trnl='\n\r' ;;
1996       esac
1997fi
1998if test X"$trnl" = X; then
1999	cat <<EOM >&2
2000
2001$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003EOM
2004	exit 1
2005fi
2006
2007: compute the number of columns on the terminal for proper question formatting
2008case "$COLUMNS" in
2009'') COLUMNS='80';;
2010esac
2011
2012: set up the echo used in my read
2013myecho="case \"\$xxxm\" in
2014'') echo $n \"\$rp $c\" >&4;;
2015*) case \"\$rp\" in
2016	'') echo $n \"[\$xxxm] $c\";;
2017	*)
2018		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019			echo \"\$rp\" >&4
2020			echo $n \"[\$xxxm] $c\" >&4
2021		else
2022			echo $n \"\$rp [\$xxxm] $c\" >&4
2023		fi
2024		;;
2025	esac;;
2026esac"
2027
2028: now set up to do reads with possible shell escape and default assignment
2029cat <<EOSC >myread
2030$startsh
2031xxxm=\$dflt
2032$myecho
2033ans='!'
2034case "\$fastread" in
2035yes) case "\$dflt" in
2036	'') ;;
2037	*) ans='';
2038		case "\$silent-\$rp" in
2039		true-) ;;
2040		*) echo " " >&4;;
2041		esac;;
2042	esac;;
2043*) case "\$silent" in
2044	true) case "\$rp" in
2045		'') ans='';;
2046		esac;;
2047	esac;;
2048esac
2049while expr "X\$ans" : "X!" >/dev/null; do
2050	read answ
2051	set x \$xxxm
2052	shift
2053	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054	case  "\$answ" in
2055	"!")
2056		sh 1>&4
2057		echo " "
2058		$myecho
2059		;;
2060	!*)
2061		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062		shift
2063		sh 1>&4 -c "\$*"
2064		echo " "
2065		$myecho
2066		;;
2067	"\$ans")
2068		case "\$ans" in
2069		\\&*)
2070			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071			shift
2072			case "\$1" in
2073			-d)
2074				fastread=yes
2075				echo "(OK, I'll run with -d after this question.)" >&4
2076				;;
2077			-*)
2078				echo "*** Sorry, \$1 not supported yet." >&4
2079				;;
2080			esac
2081			$myecho
2082			ans=!
2083			;;
2084		esac;;
2085	*)
2086		case "\$aok" in
2087		y)
2088			echo "*** Substitution done -- please confirm."
2089			xxxm="\$ans"
2090			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091			xxxm="\$ans"
2092			ans=!
2093			;;
2094		*)
2095			echo "*** Error -- try again."
2096			ans=!
2097			;;
2098		esac
2099		$myecho
2100		;;
2101	esac
2102	case "\$ans\$xxxm\$nostick" in
2103	'')
2104		ans=!
2105		$myecho
2106		;;
2107	esac
2108done
2109case "\$ans" in
2110'') ans="\$xxxm";;
2111esac
2112EOSC
2113
2114: create .config dir to save info across Configure sessions
2115test -d ../.config || mkdir ../.config
2116cat >../.config/README <<EOF
2117This directory created by Configure to save information that should
2118persist across sessions for $package.
2119
2120You may safely delete it if you wish.
2121EOF
2122
2123xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124case "$usedevel" in
2125$define|true|[yY]*) ;;
2126*) case "$xversion" in
2127   *[13579])
2128	cat >&4 <<EOH
2129*** WHOA THERE!!! ***
2130
2131    This is an UNSTABLE DEVELOPMENT release.
2132    The version of this $package distribution is $xversion, that is, odd,
2133    (as opposed to even) and that signifies a development release.
2134    If you want a maintenance release, you want an even-numbered version.
2135
2136    Do ***NOT*** install this into production use.
2137    Data corruption and crashes are possible.
2138
2139    It is most seriously suggested that you do not continue any further
2140    unless you want to help in developing and debugging Perl.
2141
2142    If you *still* want to build perl, you can answer 'y' now,
2143    or pass -Dusedevel to Configure.
2144
2145EOH
2146	rp='Do you really want to continue?'
2147	dflt='n'
2148	. ./myread
2149	case "$ans" in
2150	[yY]) echo >&4 "Okay, continuing."
2151	      usedevel="$define" ;;
2152	*) echo >&4 "Okay, bye."
2153	   exit 1
2154	   ;;
2155	esac
2156	;;
2157    esac
2158    ;;
2159esac
2160case "$usedevel" in
2161$define|true|[yY]*)
2162	case "$versiononly" in
2163	'') versiononly="$define" ;;
2164	esac
2165	case "$installusrbinperl" in
2166	'') installusrbinperl="$undef" ;;
2167	esac
2168	;;
2169esac
2170
2171: general instructions
2172needman=true
2173firsttime=true
2174user=`(logname) 2>/dev/null`
2175case "$user" in
2176'') user=`whoami 2>&1`;;
2177esac
2178if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179	firsttime=false
2180	echo " "
2181	rp='Would you like to see the instructions?'
2182	dflt=n
2183	. ./myread
2184	case "$ans" in
2185	[yY]*) ;;
2186	*) needman=false;;
2187	esac
2188fi
2189if $needman; then
2190	cat <<EOH
2191
2192This installation shell script will examine your system and ask you questions
2193to determine how the perl5 package should be installed. If you get
2194stuck on a question, you may use a ! shell escape to start a subshell or
2195execute a command.  Many of the questions will have default answers in square
2196brackets; typing carriage return will give you the default.
2197
2198On some of the questions which ask for file or directory names you are allowed
2199to use the ~name construct to specify the login directory belonging to "name",
2200even if you don't have a shell which knows about that.  Questions where this is
2201allowed will be marked "(~name ok)".
2202
2203EOH
2204	rp=''
2205	dflt='Type carriage return to continue'
2206	. ./myread
2207	cat <<'EOH'
2208
2209The prompter used in this script allows you to use shell variables and
2210backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211in the default answer, as if the default line was a set of arguments given to a
2212script shell.  This means you may also use $* to repeat the whole default line,
2213so you do not have to re-type everything to add something to the default.
2214
2215Everytime there is a substitution, you will have to confirm.  If there is an
2216error (e.g. an unmatched backtick), the default answer will remain unchanged
2217and you will be prompted again.
2218
2219If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220the questions and use the computed defaults (or the previous answers if there
2221was already a config.sh file). Type 'Configure -h' for a list of options.
2222You may also start interactively and then answer '& -d' at any prompt to turn
2223on the non-interactive behaviour for the remainder of the execution.
2224
2225EOH
2226	. ./myread
2227	cat <<EOH
2228
2229Much effort has been expended to ensure that this shell script will run on any
2230Unix system.  If despite that it blows up on yours, your best bet is to edit
2231Configure and run it again.  If you can't run Configure for some reason,
2232you'll have to generate a config.sh file by hand.  Whatever problems you
2233have, let me (perlbug@perl.org) know how I blew it.
2234
2235This installation script affects things in two ways:
2236
22371) it may do direct variable substitutions on some of the files included
2238   in this kit.
22392) it builds a config.h file for inclusion in C programs.  You may edit
2240   any of these files as the need arises after running this script.
2241
2242If you make a mistake on a question, there is no easy way to back up to it
2243currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244files.  Configure will offer to let you do this before it runs the SH files.
2245
2246EOH
2247	dflt='Type carriage return to continue'
2248	. ./myread
2249	case "$firsttime" in
2250	true) echo $user >>../.config/instruct;;
2251	esac
2252fi
2253
2254: find out where common programs are
2255echo " "
2256echo "Locating common programs..." >&4
2257cat <<EOSC >loc
2258$startsh
2259case \$# in
22600) exit 1;;
2261esac
2262thing=\$1
2263shift
2264dflt=\$1
2265shift
2266for dir in \$*; do
2267	case "\$thing" in
2268	.)
2269	if test -d \$dir/\$thing; then
2270		echo \$dir
2271		exit 0
2272	fi
2273	;;
2274	*)
2275	for thisthing in \$dir/\$thing; do
2276		: just loop through to pick last item
2277	done
2278	if test -f \$thisthing; then
2279		echo \$thisthing
2280		exit 0
2281	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282		echo \$thisthing
2283        	exit 0
2284	elif test -f \$dir/\$thing.exe; then
2285		if test -n "$DJGPP"; then
2286			echo \$dir/\$thing.exe
2287		elif test "$eunicefix" != ":"; then
2288			: on Eunice apparently
2289			echo \$dir/\$thing
2290			exit 0
2291		fi
2292		exit 0
2293	fi
2294	;;
2295	esac
2296done
2297echo \$dflt
2298exit 1
2299EOSC
2300chmod +x loc
2301$eunicefix loc
2302loclist="
2303awk
2304cat
2305chmod
2306comm
2307cp
2308echo
2309expr
2310grep
2311ls
2312mkdir
2313rm
2314sed
2315sort
2316touch
2317tr
2318uniq
2319"
2320trylist="
2321Mcc
2322ar
2323bison
2324byacc
2325cpp
2326csh
2327date
2328egrep
2329gmake
2330gzip
2331less
2332ln
2333make
2334more
2335nm
2336nroff
2337pg
2338test
2339uname
2340zip
2341"
2342pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343pth="$pth /lib /usr/lib"
2344for file in $loclist; do
2345	eval xxx=\$$file
2346	case "$xxx" in
2347	/*|?:[\\/]*)
2348		if test -f "$xxx"; then
2349			: ok
2350		else
2351			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352			xxx=`./loc $file $file $pth`
2353		fi
2354		;;
2355	'') xxx=`./loc $file $file $pth`;;
2356	*) xxx=`./loc $xxx $xxx $pth`;;
2357	esac
2358	eval $file=$xxx$_exe
2359	eval _$file=$xxx
2360	case "$xxx" in
2361	/*)
2362		echo $file is in $xxx.
2363		;;
2364	?:[\\/]*)
2365		echo $file is in $xxx.
2366		;;
2367	*)
2368		echo "I don't know where '$file' is, and my life depends on it." >&4
2369		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370		exit 1
2371		;;
2372	esac
2373done
2374echo " "
2375echo "Don't worry if any of the following aren't found..."
2376say=offhand
2377for file in $trylist; do
2378	eval xxx=\$$file
2379	case "$xxx" in
2380	/*|?:[\\/]*)
2381		if test -f "$xxx"; then
2382			: ok
2383		else
2384			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385			xxx=`./loc $file $file $pth`
2386		fi
2387		;;
2388	'') xxx=`./loc $file $file $pth`;;
2389	*) xxx=`./loc $xxx $xxx $pth`;;
2390	esac
2391	eval $file=$xxx$_exe
2392	eval _$file=$xxx
2393	case "$xxx" in
2394	/*)
2395		echo $file is in $xxx.
2396		;;
2397	?:[\\/]*)
2398		echo $file is in $xxx.
2399		;;
2400	*)
2401		echo "I don't see $file out there, $say."
2402		say=either
2403		;;
2404	esac
2405done
2406case "$egrep" in
2407egrep)
2408	echo "Substituting grep for egrep."
2409	egrep=$grep
2410	_egrep=$grep
2411	;;
2412esac
2413case "$ln" in
2414ln)
2415	echo "Substituting cp for ln."
2416	ln=$cp
2417	_ln=$cp
2418	;;
2419esac
2420case "$make" in
2421make)
2422	case "$gmake" in
2423	gmake)
2424	echo "I can't find make or gmake, and my life depends on it." >&4
2425	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426	exit 1
2427	;;
2428	esac
2429	;;
2430esac
2431case "$gmake" in
2432gmake)	;;
2433*)	# We can't have osname yet.
2434	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435		# Assume that gmake, if found, is definitely GNU make
2436		# and prefer it over the system make.
2437		echo "Substituting gmake for make."
2438		make=$gmake
2439		_make=$gmake
2440	fi
2441	;;
2442esac
2443case "$test" in
2444test)
2445	echo "Hopefully test is built into your sh."
2446	;;
2447*)
2448	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449		echo "Using the test built into your sh."
2450		test=test
2451		_test=test
2452	fi
2453	;;
2454esac
2455case "$echo" in
2456echo)
2457	echo "Hopefully echo is built into your sh."
2458	;;
2459'') ;;
2460*)
2461	echo " "
2462echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463	$echo $n "hi there$c" >foo1
2464	echo $n "hi there$c" >foo2
2465	if cmp foo1 foo2 >/dev/null 2>&1; then
2466		echo "They are compatible.  In fact, they may be identical."
2467	else
2468		case "$n" in
2469		'-n') n='' c='\c';;
2470		*) n='-n' c='';;
2471		esac
2472		cat <<FOO
2473They are not compatible!  You are probably running ksh on a non-USG system.
2474I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475have echo built in and we may have to run some Bourne shell scripts.  That
2476means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478FOO
2479		$echo $n "The star should be here-->$c"
2480		$echo "*"
2481	fi
2482	$rm -f foo1 foo2
2483	;;
2484esac
2485
2486# This question was auctioned at YAPC::Europe-2007 in Vienna
2487# I never promised you could answer it. I only auctioned the question.
2488cat <<FOO
2489The following message is sponsored by
2490
2491  Dresden.pm<--The stars should be here.
2492
2493Dear Perl user, system administrator or package
2494maintainer, the Perl community sends greetings to
2495you. Do you (emblematical) greet back [Y/n]? n
2496
2497FOO
2498
2499cat <<EOS >trygcc
2500$startsh
2501EOS
2502cat <<'EOSC' >>trygcc
2503case "$cc" in
2504'') ;;
2505*)  $rm -f try try.*
2506    $cat >try.c <<EOM
2507int main(int argc, char *argv[]) {
2508  return 0;
2509}
2510EOM
2511    if $cc -o try $ccflags $ldflags try.c; then
2512       :
2513    else
2514        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2515        despair=yes
2516        trygcc=yes
2517        case "$cc" in
2518        *gcc*) trygcc=no ;;
2519        esac
2520	# Skip this test because it gives a false match on output like:
2521	#    ./trygcc: line 23: cc: command not found
2522        # case "`$cc -v -c try.c 2>&1`" in
2523        # *gcc*) trygcc=no ;;
2524        # esac
2525        if $test X"$trygcc" = Xyes; then
2526            if gcc -o try -c try.c; then
2527                echo " "
2528                echo "You seem to have a working gcc, though." >&4
2529		# Switching compilers may undo the work of hints files.
2530		# The most common problem is -D_REENTRANT for threads.
2531		# This heuristic catches that case, but gets false positives
2532		# if -Dusethreads was not actually specified.  Better to
2533		# bail out here with a useful message than fail
2534		# mysteriously later. Should we perhaps just try to
2535		# re-invoke Configure -Dcc=gcc config_args ?
2536		if $test -f usethreads.cbu; then
2537			$cat >&4 <<EOM 
2538
2539*** However, any setting of the C compiler flags (e.g. for thread support)
2540*** will be lost.  It may be necessary for you to restart Configure and
2541*** add -Dcc=gcc to your Configure command line.
2542
2543EOM
2544			rp="Would you like to go ahead and try gcc anyway?"
2545			dflt=n
2546		else
2547			rp="Would you like to use it?"
2548			dflt=y
2549		fi
2550                if $test -f myread; then
2551                    . ./myread
2552                else
2553                    if $test -f UU/myread; then
2554                        . ./UU/myread
2555                    else
2556                        echo "Cannot find myread, sorry.  Aborting." >&2
2557                        exit 1
2558                    fi
2559                fi
2560                case "$ans" in
2561                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2562                esac
2563            fi
2564        fi
2565    fi
2566    $rm -f try try.*
2567    ;;
2568esac
2569EOSC
2570
2571cat <<EOS >checkcc
2572$startsh
2573EOS
2574cat <<'EOSC' >>checkcc
2575case "$cc" in
2576'') ;;
2577*)  $rm -f try try.*
2578    $cat >try.c <<EOM
2579int main(int argc, char *argv[]) {
2580  return 0;
2581}
2582EOM
2583    if $cc -o try $ccflags $ldflags try.c; then
2584       :
2585    else
2586        if $test X"$despair" = Xyes; then
2587           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2588        fi
2589        $cat >&4 <<EOM         
2590You need to find a working C compiler.
2591Either (purchase and) install the C compiler supplied by your OS vendor,
2592or for a free C compiler try http://gcc.gnu.org/
2593I cannot continue any further, aborting.
2594EOM
2595        exit 1
2596    fi
2597    $rm -f try try.*
2598    ;;
2599esac
2600EOSC
2601
2602: determine whether symbolic links are supported
2603echo " "
2604$touch blurfl
2605if $ln -s blurfl sym > /dev/null 2>&1 ; then
2606	echo "Symbolic links are supported." >&4
2607	lns="$ln -s"
2608else
2609	echo "Symbolic links are NOT supported." >&4
2610	lns="$ln"
2611fi
2612$rm -f blurfl sym
2613
2614: determine whether symbolic links are supported
2615echo " "
2616case "$lns" in
2617*"ln"*" -s")
2618	echo "Checking how to test for symbolic links..." >&4
2619	$lns blurfl sym
2620	if $test "X$issymlink" = X; then
2621		case "$newsh" in
2622		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624		esac
2625		if test $? = 0; then
2626			issymlink="test -h"
2627		else
2628			echo "Your builtin 'test -h' may be broken." >&4
2629			case "$test" in
2630			/*)	;;
2631			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2632				for p in $pth
2633				do
2634					if test -f "$p/$test"; then
2635						test="$p/$test"
2636						break
2637					fi
2638				done
2639				;;
2640			esac
2641			case "$test" in
2642			/*)
2643				echo "Trying external '$test -h'." >&4
2644				issymlink="$test -h"
2645				if $test ! -h sym >/dev/null 2>&1; then
2646					echo "External '$test -h' is broken, too." >&4
2647					issymlink=''
2648				fi
2649				;;
2650			*)	issymlink='' ;;
2651			esac
2652		fi
2653	fi
2654	if $test "X$issymlink" = X; then
2655		if $test -L sym 2>/dev/null; then
2656			issymlink="$test -L"
2657			echo "The builtin '$test -L' worked." >&4
2658		fi
2659	fi
2660	if $test "X$issymlink" != X; then
2661		echo "You can test for symbolic links with '$issymlink'." >&4
2662	else
2663		echo "I do not know how you can test for symbolic links." >&4
2664	fi
2665	$rm -f blurfl sym
2666	;;
2667*)	echo "No symbolic links, so not testing for their testing..." >&4
2668	;;
2669esac
2670echo " "
2671
2672
2673case "$mksymlinks" in
2674$define|true|[yY]*)
2675	case "$src" in
2676	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2677		exit 1
2678		;;
2679	*)	case "$lns:$issymlink" in
2680		*"ln"*" -s:"*"test -"?)
2681			echo "Creating the symbolic links..." >&4
2682			echo "(First creating the subdirectories...)" >&4
2683			cd ..
2684			awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2685				read directory
2686				test -z "$directory" && break
2687				mkdir -p $directory
2688			done
2689			# Sanity check 1.
2690			if test ! -d t/base; then
2691				echo "Failed to create the subdirectories.  Aborting." >&4
2692				exit 1
2693			fi
2694			echo "(Then creating the symlinks...)" >&4
2695			awk '{print $1}' $src/MANIFEST | while true; do
2696				read filename
2697				test -z "$filename" && break
2698				if test -f $filename; then
2699					if $issymlink $filename; then
2700						rm -f $filename
2701					fi
2702				fi
2703				if test -f $filename; then
2704					echo "$filename already exists, not symlinking."
2705				else
2706					ln -s $src/$filename $filename
2707				fi
2708			done
2709			# Sanity check 2.
2710			if test ! -f t/base/lex.t; then
2711				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2712				exit 1
2713			fi
2714			cd UU
2715			;;
2716		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2717			;;
2718		esac
2719		;;
2720	esac
2721	;;
2722esac
2723
2724
2725case "$usecrosscompile" in
2726$define|true|[yY]*)
2727	$echo "Cross-compiling..."
2728        croak=''
2729    	case "$cc" in
2730	*-*-gcc) # A cross-compiling gcc, probably.
2731	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2732	    ar=$targetarch-ar
2733	    # leave out ld, choosing it is more complex
2734	    nm=$targetarch-nm
2735	    ranlib=$targetarch-ranlib
2736	    $echo 'extern int foo;' > try.c
2737	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2738	    shift
2739            if $test $# -gt 0; then
2740	        incpth="$incpth $*"
2741		incpth="`$echo $incpth|$sed 's/^ //'`"
2742                echo "Guessing incpth '$incpth'." >&4
2743                for i in $*; do
2744		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2745		    if $test -d $j; then
2746			libpth="$libpth $j"
2747		    fi
2748                done
2749		libpth="`$echo $libpth|$sed 's/^ //'`"
2750                echo "Guessing libpth '$libpth'." >&4
2751	    fi
2752	    $rm -f try.c
2753	    ;;
2754	esac
2755	case "$targetarch" in
2756	'') echo "Targetarch not defined." >&4; croak=y ;;
2757        *)  echo "Using targetarch $targetarch." >&4 ;;
2758	esac
2759	case "$incpth" in
2760	'') echo "Incpth not defined." >&4; croak=y ;;
2761        *)  echo "Using incpth '$incpth'." >&4 ;;
2762	esac
2763	case "$libpth" in
2764	'') echo "Libpth not defined." >&4; croak=y ;;
2765        *)  echo "Using libpth '$libpth'." >&4 ;;
2766	esac
2767	case "$usrinc" in
2768	'') for i in $incpth; do
2769	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2770		    usrinc=$i
2771	            echo "Guessing usrinc $usrinc." >&4
2772		    break
2773		fi
2774	    done
2775	    case "$usrinc" in
2776	    '') echo "Usrinc not defined." >&4; croak=y ;;
2777	    esac
2778            ;;
2779        *)  echo "Using usrinc $usrinc." >&4 ;;
2780	esac
2781	case "$targethost" in
2782	'') echo "Targethost not defined." >&4; croak=y ;;
2783        *)  echo "Using targethost $targethost." >&4
2784	esac
2785	locincpth=' '
2786	loclibpth=' '
2787	case "$croak" in
2788	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2789	esac
2790	case "$src" in
2791	/*) run=$src/Cross/run
2792	    targetmkdir=$src/Cross/mkdir
2793	    to=$src/Cross/to
2794	    from=$src/Cross/from
2795	    ;;
2796	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2797	    run=$pwd/Cross/run
2798	    targetmkdir=$pwd/Cross/mkdir
2799	    to=$pwd/Cross/to
2800	    from=$pwd/Cross/from
2801	    ;;
2802	esac
2803	case "$targetrun" in
2804	'') targetrun=ssh ;;
2805	esac
2806	case "$targetto" in
2807	'') targetto=scp ;;
2808	esac
2809	case "$targetfrom" in
2810	'') targetfrom=scp ;;
2811	esac
2812    	run=$run-$targetrun
2813    	to=$to-$targetto
2814    	from=$from-$targetfrom
2815	case "$targetdir" in
2816	'')  targetdir=/tmp
2817             echo "Guessing targetdir $targetdir." >&4
2818             ;;
2819	esac
2820	case "$targetuser" in
2821	'')  targetuser=root
2822             echo "Guessing targetuser $targetuser." >&4
2823             ;;
2824	esac
2825	case "$targetfrom" in
2826	scp)	q=-q ;;
2827	*)	q='' ;;
2828	esac
2829	case "$targetrun" in
2830	ssh|rsh)
2831	    cat >$run <<EOF
2832#!/bin/sh
2833case "\$1" in
2834-cwd)
2835  shift
2836  cwd=\$1
2837  shift
2838  ;;
2839esac
2840case "\$cwd" in
2841'') cwd=$targetdir ;;
2842esac
2843exe=\$1
2844shift
2845if $test ! -f \$exe.xok; then
2846  $to \$exe
2847  $touch \$exe.xok
2848fi
2849$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2850EOF
2851	    ;;
2852	*)  echo "Unknown targetrun '$targetrun'" >&4
2853	    exit 1
2854	    ;;
2855	esac
2856	case "$targetmkdir" in
2857	*/Cross/mkdir)
2858	    cat >$targetmkdir <<EOF
2859#!/bin/sh
2860$targetrun -l $targetuser $targethost "mkdir -p \$@"
2861EOF
2862	    $chmod a+rx $targetmkdir
2863	    ;;
2864	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2865	    exit 1
2866	    ;;
2867	esac
2868	case "$targetto" in
2869	scp|rcp)
2870	    cat >$to <<EOF
2871#!/bin/sh
2872for f in \$@
2873do
2874  case "\$f" in
2875  /*)
2876    $targetmkdir \`dirname \$f\`
2877    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2878    ;;
2879  *)
2880    $targetmkdir $targetdir/\`dirname \$f\`
2881    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2882    ;;
2883  esac
2884done
2885exit 0
2886EOF
2887	    ;;
2888	cp) cat >$to <<EOF
2889#!/bin/sh
2890for f in \$@
2891do
2892  case "\$f" in
2893  /*)
2894    $mkdir -p $targetdir/\`dirname \$f\`
2895    $cp \$f $targetdir/\$f || exit 1
2896    ;;
2897  *)
2898    $targetmkdir $targetdir/\`dirname \$f\`
2899    $cp \$f $targetdir/\$f || exit 1
2900    ;;
2901  esac
2902done
2903exit 0
2904EOF
2905	    ;;
2906	*)  echo "Unknown targetto '$targetto'" >&4
2907	    exit 1
2908	    ;;
2909	esac
2910	case "$targetfrom" in
2911	scp|rcp)
2912	  cat >$from <<EOF
2913#!/bin/sh
2914for f in \$@
2915do
2916  $rm -f \$f
2917  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2918done
2919exit 0
2920EOF
2921	    ;;
2922	cp) cat >$from <<EOF
2923#!/bin/sh
2924for f in \$@
2925do
2926  $rm -f \$f
2927  cp $targetdir/\$f . || exit 1
2928done
2929exit 0
2930EOF
2931	    ;;
2932	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2933	    exit 1
2934	    ;;
2935	esac
2936	if $test ! -f $run; then
2937	    echo "Target 'run' script '$run' not found." >&4
2938	else
2939	    $chmod a+rx $run
2940	fi
2941	if $test ! -f $to; then
2942	    echo "Target 'to' script '$to' not found." >&4
2943	else
2944	    $chmod a+rx $to
2945	fi
2946	if $test ! -f $from; then
2947	    echo "Target 'from' script '$from' not found." >&4
2948	else
2949	    $chmod a+rx $from
2950	fi
2951	if $test ! -f $run -o ! -f $to -o ! -f $from; then
2952	    exit 1
2953	fi
2954	cat >&4 <<EOF
2955Using '$run' for remote execution,
2956and '$from' and '$to'
2957for remote file transfer.
2958EOF
2959	;;
2960*)	run=''
2961	to=:
2962	from=:
2963	usecrosscompile='undef'
2964	targetarch=''
2965	;;
2966esac
2967
2968: see whether [:lower:] and [:upper:] are supported character classes
2969echo " "
2970case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2971ABYZ)
2972	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2973	up='[:upper:]'
2974	low='[:lower:]'
2975	;;
2976*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
2977	# (0xd9 and 0xe2), therefore that is a nice testing point.
2978	if test "X$up" = X -o "X$low" = X; then
2979	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2980	    rs) up='[A-Z]'
2981		low='[a-z]'
2982		;;
2983	    esac
2984	fi
2985	if test "X$up" = X -o "X$low" = X; then
2986	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2987	    rs) up='A-Z'
2988		low='a-z'
2989		;;
2990	    esac
2991	fi
2992	if test "X$up" = X -o "X$low" = X; then
2993	    case "`echo RS | od -x 2>/dev/null`" in
2994	    *D9E2*|*d9e2*)
2995		echo "Hey, this might be EBCDIC." >&4
2996		if test "X$up" = X -o "X$low" = X; then
2997		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2998		    rs) up='[A-IJ-RS-Z]'
2999			low='[a-ij-rs-z]'
3000			;;
3001		    esac
3002		fi
3003		if test "X$up" = X -o "X$low" = X; then
3004		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3005		    rs) up='A-IJ-RS-Z'
3006			low='a-ij-rs-z'
3007			;;
3008		    esac
3009		fi
3010		;;
3011	    esac
3012	fi
3013esac
3014case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3015rs)
3016    echo "Using $up and $low to convert case." >&4
3017    ;;
3018*)
3019    echo "I don't know how to translate letters from upper to lower case." >&4
3020    echo "Your tr is not acting any way I know of." >&4
3021    exit 1
3022    ;;
3023esac
3024: set up the translation script tr, must be called with ./tr of course
3025cat >tr <<EOSC
3026$startsh
3027case "\$1\$2" in
3028'[A-Z][a-z]') exec $tr '$up' '$low';;
3029'[a-z][A-Z]') exec $tr '$low' '$up';;
3030esac
3031exec $tr "\$@"
3032EOSC
3033chmod +x tr
3034$eunicefix tr
3035
3036: Try to determine whether config.sh was made on this system
3037case "$config_sh" in
3038'')
3039myuname=`$uname -a 2>/dev/null`
3040$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3041# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3042# because the A-Z/a-z are not consecutive.
3043myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3044	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3045newmyuname="$myuname"
3046dflt=n
3047case "$knowitall" in
3048'')
3049	if test -f ../config.sh; then
3050		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3051			eval "`grep myuname= ../config.sh`"
3052		fi
3053		if test "X$myuname" = "X$newmyuname"; then
3054			dflt=y
3055		fi
3056	fi
3057	;;
3058*) dflt=y;;
3059esac
3060
3061: Get old answers from old config file if Configure was run on the
3062: same system, otherwise use the hints.
3063hint=default
3064cd ..
3065if test -f config.sh; then
3066	echo " "
3067	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3068	. UU/myread
3069	case "$ans" in
3070	n*|N*) echo "OK, I'll ignore it."
3071		mv config.sh config.sh.old
3072		myuname="$newmyuname"
3073		;;
3074	*)  echo "Fetching default answers from your old config.sh file..." >&4
3075		tmp_n="$n"
3076		tmp_c="$c"
3077		tmp_sh="$sh"
3078		. ./config.sh
3079		cp config.sh UU
3080		n="$tmp_n"
3081		c="$tmp_c"
3082		: Older versions did not always set $sh.  Catch re-use of such
3083		: an old config.sh.
3084		case "$sh" in
3085		'') sh="$tmp_sh" ;;
3086		esac
3087		hint=previous
3088		;;
3089	esac
3090fi
3091. ./UU/checkcc
3092if test ! -f config.sh; then
3093	$cat <<EOM
3094
3095First time through, eh?  I have some defaults handy for some systems
3096that need some extra help getting the Configure answers right:
3097
3098EOM
3099	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3100	dflt=''
3101	: Half the following guesses are probably wrong... If you have better
3102	: tests or hints, please send them to perlbug@perl.org
3103	: The metaconfig authors would also appreciate a copy...
3104	$test -f /irix && osname=irix
3105	$test -f /xenix && osname=sco_xenix
3106	$test -f /dynix && osname=dynix
3107	$test -f /dnix && osname=dnix
3108	$test -f /lynx.os && osname=lynxos
3109	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3110	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3111	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3112	$test -f /bin/mips && /bin/mips && osname=mips
3113	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3114		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3115	$test -d /usr/apollo/bin && osname=apollo
3116	$test -f /etc/saf/_sactab && osname=svr4
3117	$test -d /usr/include/minix && osname=minix
3118	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3119	if $test -d /MachTen -o -d /MachTen_Folder; then
3120		osname=machten
3121		if $test -x /sbin/version; then
3122			osvers=`/sbin/version | $awk '{print $2}' |
3123			$sed -e 's/[A-Za-z]$//'`
3124		elif $test -x /usr/etc/version; then
3125			osvers=`/usr/etc/version | $awk '{print $2}' |
3126			$sed -e 's/[A-Za-z]$//'`
3127		else
3128			osvers="$2.$3"
3129		fi
3130	fi
3131
3132	$test -f /sys/posix.dll &&
3133		$test -f /usr/bin/what &&
3134		set X `/usr/bin/what /sys/posix.dll` &&
3135		$test "$3" = UWIN &&
3136		osname=uwin &&
3137		osvers="$5"
3138
3139	if $test -f $uname; then
3140		set X $myuname
3141		shift
3142
3143		case "$5" in
3144		fps*) osname=fps ;;
3145		mips*)
3146			case "$4" in
3147			umips) osname=umips ;;
3148			*) osname=mips ;;
3149			esac;;
3150		[23]100) osname=mips ;;
3151		next*) osname=next ;;
3152		i386*)
3153			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3154			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3155				osname='sco'
3156				osvers=$tmp
3157			elif $test -f /etc/kconfig; then
3158				osname=isc
3159				if test "$lns" = "$ln -s"; then
3160					osvers=4
3161				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3162					osvers=3
3163				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3164					osvers=2
3165				fi
3166			fi
3167			tmp=''
3168			;;
3169		pc*)
3170			if test -n "$DJGPP"; then
3171				osname=dos
3172				osvers=djgpp
3173			fi
3174			;;
3175		esac
3176
3177		case "$1" in
3178		aix) osname=aix
3179			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3180			case "$tmp" in
3181			# oslevel can fail with:
3182			# oslevel: Unable to acquire lock.
3183			*not\ found) osvers="$4"."$3" ;;
3184			'<3240'|'<>3240') osvers=3.2.0 ;;
3185			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3186			'=3250'|'>3250') osvers=3.2.5 ;;
3187			*) osvers=$tmp;;
3188			esac
3189			;;
3190		bsd386) osname=bsd386
3191			osvers=`$uname -r`
3192			;;
3193		cygwin*) osname=cygwin
3194			osvers="$3"
3195			;;
3196		*dc.osx) osname=dcosx
3197			osvers="$3"
3198			;;
3199		dnix) osname=dnix
3200			osvers="$3"
3201			;;
3202		domainos) osname=apollo
3203			osvers="$3"
3204			;;
3205		dgux)	osname=dgux
3206			osvers="$3"
3207			;;
3208		dragonfly) osname=dragonfly
3209			osvers="$3"
3210			;;
3211		dynixptx*) osname=dynixptx
3212			osvers=`echo "$4"|sed 's/^v//'`
3213			;;
3214		freebsd) osname=freebsd
3215			osvers="$3" ;;
3216		genix)	osname=genix ;;
3217		gnu)	osname=gnu
3218			osvers="$3" ;;
3219		hp*)	osname=hpux
3220			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3221			;;
3222		irix*)	osname=irix
3223			case "$3" in
3224			4*) osvers=4 ;;
3225			5*) osvers=5 ;;
3226			*)	osvers="$3" ;;
3227			esac
3228			;;
3229		linux)	osname=linux
3230			case "$3" in
3231			*)	osvers="$3" ;;
3232			esac
3233			;;
3234		MiNT)	osname=mint
3235			;;
3236		netbsd*) osname=netbsd
3237			osvers="$3"
3238			;;
3239		news-os) osvers="$3"
3240			case "$3" in
3241			4*) osname=newsos4 ;;
3242			*) osname=newsos ;;
3243			esac
3244			;;
3245		next*) osname=next ;;
3246		nonstop-ux) osname=nonstopux ;;
3247		openbsd) osname=openbsd
3248                	osvers="$3"
3249                	;;
3250		os2)	osname=os2
3251			osvers="$4"
3252			;;
3253		POSIX-BC | posix-bc ) osname=posix-bc
3254			osvers="$3"
3255			;;
3256		powerux | power_ux | powermax_os | powermaxos | \
3257		powerunix | power_unix) osname=powerux
3258			osvers="$3"
3259			;;
3260		qnx) osname=qnx
3261			osvers="$4"
3262			;;
3263		solaris) osname=solaris
3264			case "$3" in
3265			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3266			*)	osvers="$3" ;;
3267			esac
3268			;;
3269		sunos) osname=sunos
3270			case "$3" in
3271			5*) osname=solaris
3272				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273			*)	osvers="$3" ;;
3274			esac
3275			;;
3276		titanos) osname=titanos
3277			case "$3" in
3278			1*) osvers=1 ;;
3279			2*) osvers=2 ;;
3280			3*) osvers=3 ;;
3281			4*) osvers=4 ;;
3282			*)	osvers="$3" ;;
3283			esac
3284			;;
3285		ultrix) osname=ultrix
3286			osvers="$3"
3287			;;
3288		osf1|mls+)	case "$5" in
3289				alpha)
3290					osname=dec_osf
3291					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3292					case "$osvers" in
3293					[1-9].[0-9]*) ;;
3294					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3295					esac
3296					;;
3297			hp*)	osname=hp_osf1	;;
3298			mips)	osname=mips_osf1 ;;
3299			esac
3300			;;
3301		# UnixWare 7.1.2 is known as Open UNIX 8
3302		openunix|unixware) osname=svr5
3303			osvers="$4"
3304			;;
3305		uts)	osname=uts
3306			osvers="$3"
3307			;;
3308		vos) osvers="$3"
3309			;;
3310		$2) case "$osname" in
3311			*isc*) ;;
3312			*freebsd*) ;;
3313			svr*)
3314				: svr4.x or possibly later
3315				case "svr$3" in
3316				${osname}*)
3317					osname=svr$3
3318					osvers=$4
3319					;;
3320				esac
3321				case "$osname" in
3322				svr4.0)
3323					: Check for ESIX
3324					if test -f /stand/boot ; then
3325						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3326						if test -n "$INITPROG" -a -f "$INITPROG"; then
3327			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3328							if test -n "$isesix"; then
3329								osname=esix4
3330							fi
3331						fi
3332					fi
3333					;;
3334				esac
3335				;;
3336			*)	if test -f /etc/systemid; then
3337					osname=sco
3338					set `echo $3 | $sed 's/\./ /g'` $4
3339					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3340						osvers=$1.$2.$3
3341					elif $test -f $src/hints/sco_$1_$2.sh; then
3342						osvers=$1.$2
3343					elif $test -f $src/hints/sco_$1.sh; then
3344						osvers=$1
3345					fi
3346				else
3347					case "$osname" in
3348					'') : Still unknown.  Probably a generic Sys V.
3349						osname="sysv"
3350						osvers="$3"
3351						;;
3352					esac
3353				fi
3354				;;
3355			esac
3356			;;
3357		*)	case "$osname" in
3358			'') : Still unknown.  Probably a generic BSD.
3359				osname="$1"
3360				osvers="$3"
3361				;;
3362			esac
3363			;;
3364		esac
3365	else
3366		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3367			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3368			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3369				osname=news_os
3370			fi
3371			$rm -f UU/kernel.what
3372		elif test -d c:/. -o -n "$is_os2" ; then
3373			set X $myuname
3374			osname=os2
3375			osvers="$5"
3376		fi
3377	fi
3378
3379        case "$targetarch" in
3380        '') ;;
3381        *)  hostarch=$osname
3382            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3383            osvers=''
3384            ;;
3385        esac
3386
3387	: Now look for a hint file osname_osvers, unless one has been
3388	: specified already.
3389	case "$hintfile" in
3390	''|' ')
3391		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3392		: Also try without trailing minor version numbers.
3393		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3394		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3395		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3396		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3397		case "$file" in
3398		'') dflt=none ;;
3399		*)  case "$osvers" in
3400			'') dflt=$file
3401				;;
3402			*)  if $test -f $src/hints/$file.sh ; then
3403					dflt=$file
3404				elif $test -f $src/hints/$xfile.sh ; then
3405					dflt=$xfile
3406				elif $test -f $src/hints/$xxfile.sh ; then
3407					dflt=$xxfile
3408				elif $test -f $src/hints/$xxxfile.sh ; then
3409					dflt=$xxxfile
3410				elif $test -f $src/hints/$xxxxfile.sh ; then
3411					dflt=$xxxxfile
3412				elif $test -f "$src/hints/${osname}.sh" ; then
3413					dflt="${osname}"
3414				else
3415					dflt=none
3416				fi
3417				;;
3418			esac
3419			;;
3420		esac
3421		if $test -f Policy.sh ; then
3422			case "$dflt" in
3423			*Policy*) ;;
3424			none) dflt="Policy" ;;
3425			*) dflt="Policy $dflt" ;;
3426			esac
3427		fi
3428		;;
3429	*)
3430		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3431		;;
3432	esac
3433
3434	if $test -f Policy.sh ; then
3435		$cat <<EOM
3436
3437There's also a Policy hint file available, which should make the
3438site-specific (policy) questions easier to answer.
3439EOM
3440
3441	fi
3442
3443	$cat <<EOM
3444
3445You may give one or more space-separated answers, or "none" if appropriate.
3446If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3447previous run of Configure, you may specify it as well as or instead of
3448OS-specific hints.  If hints are provided for your OS, you should use them:
3449although Perl can probably be built without hints on many platforms, using
3450hints often improve performance and may enable features that Configure can't
3451set up on its own. If there are no hints that match your OS, specify "none";
3452DO NOT give a wrong version or a wrong OS.
3453
3454EOM
3455
3456	rp="Which of these apply, if any?"
3457	. UU/myread
3458	tans=$ans
3459	for file in $tans; do
3460		if $test X$file = XPolicy -a -f Policy.sh; then
3461			. Policy.sh
3462			$cat Policy.sh >> UU/config.sh
3463		elif $test -f $src/hints/$file.sh; then
3464			. $src/hints/$file.sh
3465			$cat $src/hints/$file.sh >> UU/config.sh
3466		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3467			: nothing
3468		else
3469			: Give one chance to correct a possible typo.
3470			echo "$file.sh does not exist"
3471			dflt=$file
3472			rp="hint to use instead?"
3473			. UU/myread
3474			for file in $ans; do
3475				if $test -f "$src/hints/$file.sh"; then
3476					. $src/hints/$file.sh
3477					$cat $src/hints/$file.sh >> UU/config.sh
3478				elif $test X$ans = X -o X$ans = Xnone ; then
3479					: nothing
3480				else
3481					echo "$file.sh does not exist -- ignored."
3482				fi
3483			done
3484		fi
3485	done
3486
3487	hint=recommended
3488	: Remember our hint file for later.
3489	if $test -f "$src/hints/$file.sh" ; then
3490		hintfile="$file"
3491	else
3492		hintfile=''
3493	fi
3494fi
3495cd UU
3496;;
3497*)
3498	echo " "
3499	echo "Fetching default answers from $config_sh..." >&4
3500	tmp_n="$n"
3501	tmp_c="$c"
3502	cd ..
3503	cp $config_sh config.sh 2>/dev/null
3504	chmod +w config.sh
3505	. ./config.sh
3506	cd UU
3507	cp ../config.sh .
3508	n="$tmp_n"
3509	c="$tmp_c"
3510	hint=previous
3511	;;
3512esac
3513test "$override" && . ./optdef.sh
3514
3515: Restore computed paths
3516for file in $loclist $trylist; do
3517	eval $file="\$_$file"
3518done
3519
3520cat << EOM
3521
3522Configure uses the operating system name and version to set some defaults.
3523The default value is probably right if the name rings a bell. Otherwise,
3524since spelling matters for me, either accept the default or answer "none"
3525to leave it blank.
3526
3527EOM
3528case "$osname" in
3529	''|' ')
3530		case "$hintfile" in
3531		''|' '|none) dflt=none ;;
3532		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3533		esac
3534		;;
3535	*) dflt="$osname" ;;
3536esac
3537rp="Operating system name?"
3538. ./myread
3539case "$ans" in
3540none)  osname='' ;;
3541*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3542esac
3543echo " "
3544case "$osvers" in
3545	''|' ')
3546		case "$hintfile" in
3547		''|' '|none) dflt=none ;;
3548		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3549			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3550			case "$dflt" in
3551			''|' ') dflt=none ;;
3552			esac
3553			;;
3554		esac
3555		;;
3556	*) dflt="$osvers" ;;
3557esac
3558rp="Operating system version?"
3559. ./myread
3560case "$ans" in
3561none)  osvers='' ;;
3562*) osvers="$ans" ;;
3563esac
3564
3565
3566. ./posthint.sh
3567
3568: who configured the system
3569cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3570case "$cf_by" in
3571"")
3572	cf_by=`(logname) 2>/dev/null`
3573	case "$cf_by" in
3574	"")
3575		cf_by=`(whoami) 2>/dev/null`
3576		case "$cf_by" in
3577		"") cf_by=unknown ;;
3578		esac ;;
3579	esac ;;
3580esac
3581
3582: decide how portable to be.  Allow command line overrides.
3583case "$d_portable" in
3584"$undef") ;;
3585*)	d_portable="$define" ;;
3586esac
3587
3588: set up shell script to do ~ expansion
3589cat >filexp <<EOSS
3590$startsh
3591: expand filename
3592case "\$1" in
3593 ~/*|~)
3594	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3595	;;
3596 ~*)
3597	if $test -f /bin/csh; then
3598		/bin/csh -f -c "glob \$1"
3599		failed=\$?
3600		echo ""
3601		exit \$failed
3602	else
3603		name=\`$expr x\$1 : '..\([^/]*\)'\`
3604		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3605		if $test ! -d "\$dir"; then
3606			me=\`basename \$0\`
3607			echo "\$me: can't locate home directory for: \$name" >&2
3608			exit 1
3609		fi
3610		case "\$1" in
3611		*/*)
3612			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3613			;;
3614		*)
3615			echo \$dir
3616			;;
3617		esac
3618	fi
3619	;;
3620*)
3621	echo \$1
3622	;;
3623esac
3624EOSS
3625chmod +x filexp
3626$eunicefix filexp
3627
3628: now set up to get a file name
3629cat <<EOS >getfile
3630$startsh
3631EOS
3632cat <<'EOSC' >>getfile
3633tilde=''
3634fullpath=''
3635already=''
3636skip=''
3637none_ok=''
3638exp_file=''
3639nopath_ok=''
3640orig_rp="$rp"
3641orig_dflt="$dflt"
3642case "$gfpth" in
3643'') gfpth='.' ;;
3644esac
3645
3646case "$fn" in
3647*\(*)
3648	: getfile will accept an answer from the comma-separated list
3649	: enclosed in parentheses even if it does not meet other criteria.
3650	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3651	fn=`echo $fn | sed 's/(.*)//'`
3652	;;
3653esac
3654
3655case "$fn" in
3656*:*)
3657	loc_file=`expr $fn : '.*:\(.*\)'`
3658	fn=`expr $fn : '\(.*\):.*'`
3659	;;
3660esac
3661
3662case "$fn" in
3663*~*) tilde=true;;
3664esac
3665case "$fn" in
3666*/*) fullpath=true;;
3667esac
3668case "$fn" in
3669*+*) skip=true;;
3670esac
3671case "$fn" in
3672*n*) none_ok=true;;
3673esac
3674case "$fn" in
3675*e*) exp_file=true;;
3676esac
3677case "$fn" in
3678*p*) nopath_ok=true;;
3679esac
3680
3681case "$fn" in
3682*f*) type='File';;
3683*d*) type='Directory';;
3684*l*) type='Locate';;
3685esac
3686
3687what="$type"
3688case "$what" in
3689Locate) what='File';;
3690esac
3691
3692case "$exp_file" in
3693'')
3694	case "$d_portable" in
3695	"$define") ;;
3696	*) exp_file=true;;
3697	esac
3698	;;
3699esac
3700
3701cd ..
3702while test "$type"; do
3703	redo=''
3704	rp="$orig_rp"
3705	dflt="$orig_dflt"
3706	case "$tilde" in
3707	true) rp="$rp (~name ok)";;
3708	esac
3709	. UU/myread
3710	if test -f UU/getfile.ok && \
3711		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3712	then
3713		value="$ans"
3714		ansexp="$ans"
3715		break
3716	fi
3717	case "$ans" in
3718	none)
3719		value=''
3720		ansexp=''
3721		case "$none_ok" in
3722		true) type='';;
3723		esac
3724		;;
3725	*)
3726		case "$tilde" in
3727		'') value="$ans"
3728			ansexp="$ans";;
3729		*)
3730			value=`UU/filexp $ans`
3731			case $? in
3732			0)
3733				if test "$ans" != "$value"; then
3734					echo "(That expands to $value on this system.)"
3735				fi
3736				;;
3737			*) value="$ans";;
3738			esac
3739			ansexp="$value"
3740			case "$exp_file" in
3741			'') value="$ans";;
3742			esac
3743			;;
3744		esac
3745		case "$fullpath" in
3746		true)
3747			case "$ansexp" in
3748			/*) value="$ansexp" ;;
3749			[a-zA-Z]:/*) value="$ansexp" ;;
3750			*)
3751				redo=true
3752				case "$already" in
3753				true)
3754				echo "I shall only accept a full path name, as in /bin/ls." >&4
3755				echo "Use a ! shell escape if you wish to check pathnames." >&4
3756					;;
3757				*)
3758				echo "Please give a full path name, starting with slash." >&4
3759					case "$tilde" in
3760					true)
3761				echo "Note that using ~name is ok provided it expands well." >&4
3762						already=true
3763						;;
3764					esac
3765				esac
3766				;;
3767			esac
3768			;;
3769		esac
3770		case "$redo" in
3771		'')
3772			case "$type" in
3773			File)
3774				for fp in $gfpth; do
3775					if test "X$fp" = X.; then
3776					    pf="$ansexp"
3777					else
3778					    pf="$fp/$ansexp"
3779					fi
3780					if test -f "$pf"; then
3781						type=''
3782					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3783					then
3784						echo "($value is not a plain file, but that's ok.)"
3785						type=''
3786					fi
3787					if test X"$type" = X; then
3788					    value="$pf"
3789					    break
3790					fi
3791				done
3792				;;
3793			Directory)
3794				for fp in $gfpth; do
3795					if test "X$fp" = X.; then
3796					    dir="$ans"
3797					    direxp="$ansexp"
3798					else
3799					    dir="$fp/$ansexp"
3800					    direxp="$fp/$ansexp"
3801					fi
3802					if test -d "$direxp"; then
3803						type=''
3804						value="$dir"
3805						break
3806					fi
3807				done
3808				;;
3809			Locate)
3810				if test -d "$ansexp"; then
3811					echo "(Looking for $loc_file in directory $value.)"
3812					value="$value/$loc_file"
3813					ansexp="$ansexp/$loc_file"
3814				fi
3815				if test -f "$ansexp"; then
3816					type=''
3817				fi
3818				case "$nopath_ok" in
3819				true)	case "$value" in
3820					*/*) ;;
3821					*)	echo "Assuming $value will be in people's path."
3822						type=''
3823						;;
3824					esac
3825					;;
3826				esac
3827				;;
3828			esac
3829
3830			case "$skip" in
3831			true) type='';
3832			esac
3833
3834			case "$type" in
3835			'') ;;
3836			*)
3837				if test "$fastread" = yes; then
3838					dflt=y
3839				else
3840					dflt=n
3841				fi
3842				rp="$what $value doesn't exist.  Use that name anyway?"
3843				. UU/myread
3844				dflt=''
3845				case "$ans" in
3846				y*) type='';;
3847				*) echo " ";;
3848				esac
3849				;;
3850			esac
3851			;;
3852		esac
3853		;;
3854	esac
3855done
3856cd UU
3857ans="$value"
3858rp="$orig_rp"
3859dflt="$orig_dflt"
3860rm -f getfile.ok
3861test "X$gfpthkeep" != Xy && gfpth=""
3862EOSC
3863
3864: determine root of directory hierarchy where package will be installed.
3865case "$prefix" in
3866'')
3867	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3868	;;
3869*?/)
3870	dflt=`echo "$prefix" | sed 's/.$//'`
3871	;;
3872*)
3873	dflt="$prefix"
3874	;;
3875esac
3876$cat <<EOM
3877
3878By default, $package will be installed in $dflt/bin, manual pages
3879under $dflt/man, etc..., i.e. with $dflt as prefix for all
3880installation directories. Typically this is something like /usr/local.
3881If you wish to have binaries under /usr/bin but other parts of the
3882installation under /usr/local, that's ok: you will be prompted
3883separately for each of the installation directories, the prefix being
3884only used to set the defaults.
3885
3886EOM
3887fn=d~
3888rp='Installation prefix to use?'
3889. ./getfile
3890oldprefix=''
3891case "$prefix" in
3892'') ;;
3893*)
3894	case "$ans" in
3895	"$prefix") ;;
3896	*) oldprefix="$prefix";;
3897	esac
3898	;;
3899esac
3900prefix="$ans"
3901prefixexp="$ansexp"
3902
3903case "$afsroot" in
3904'')	afsroot=/afs ;;
3905*)	afsroot=$afsroot ;;
3906esac
3907
3908: is AFS running?
3909echo " "
3910case "$afs" in
3911$define|true)	afs=true ;;
3912$undef|false)	afs=false ;;
3913*)	if test -d $afsroot; then
3914		afs=true
3915	else
3916		afs=false
3917	fi
3918	;;
3919esac
3920if $afs; then
3921	echo "AFS may be running... I'll be extra cautious then..." >&4
3922else
3923	echo "AFS does not seem to be running..." >&4
3924fi
3925
3926: determine installation prefix for where package is to be installed.
3927if $afs; then
3928$cat <<EOM
3929
3930Since you are running AFS, I need to distinguish the directory in which
3931files will reside from the directory in which they are installed (and from
3932which they are presumably copied to the former directory by occult means).
3933
3934EOM
3935	case "$installprefix" in
3936	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3937	*) dflt="$installprefix";;
3938	esac
3939else
3940$cat <<EOM
3941
3942In some special cases, particularly when building $package for distribution,
3943it is convenient to distinguish the directory in which files should be
3944installed from the directory ($prefix) in which they will
3945eventually reside.  For most users, these two directories are the same.
3946
3947EOM
3948	case "$installprefix" in
3949	'') dflt=$prefix ;;
3950	*) dflt=$installprefix;;
3951	esac
3952fi
3953fn=d~
3954rp='What installation prefix should I use for installing files?'
3955. ./getfile
3956installprefix="$ans"
3957installprefixexp="$ansexp"
3958
3959: Perform the prefixexp/installprefixexp correction if necessary
3960cat <<EOS >installprefix
3961$startsh
3962EOS
3963cat <<'EOSC' >>installprefix
3964: Change installation prefix, if necessary.
3965if $test X"$prefix" != X"$installprefix"; then
3966    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3967else
3968    eval "install${prefixvar}=\"\$${prefixvar}exp\""
3969fi
3970EOSC
3971chmod +x installprefix
3972$eunicefix installprefix
3973
3974: Set variables such as privlib and privlibexp from the output of ./getfile
3975: performing the prefixexp/installprefixexp correction if necessary.
3976cat <<EOS >setprefixvar
3977$startsh
3978EOS
3979cat <<'EOSC' >>setprefixvar
3980eval "${prefixvar}=\"\$ans\""
3981eval "${prefixvar}exp=\"\$ansexp\""
3982. ./installprefix
3983EOSC
3984chmod +x setprefixvar
3985$eunicefix setprefixvar
3986
3987: set up the script used to warn in case of inconsistency
3988cat <<EOS >whoa
3989$startsh
3990EOS
3991cat <<'EOSC' >>whoa
3992dflt=y
3993case "$hint" in
3994    recommended)
3995	case "$hintfile" in
3996	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3997		;;
3998	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3999		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4000		;;
4001	esac
4002	;;
4003    *)	echo " "
4004	echo "*** WHOA THERE!!! ***" >&4
4005	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4006	;;
4007esac
4008rp="    Keep the $hint value?"
4009. ./myread
4010case "$ans" in
4011y) td=$was; tu=$was;;
4012esac
4013EOSC
4014
4015: function used to set $1 to $val
4016setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4017case "$val$was" in
4018$define$undef) . ./whoa; eval "$var=\$td";;
4019$undef$define) . ./whoa; eval "$var=\$tu";;
4020*) eval "$var=$val";;
4021esac'
4022
4023case "$usesocks" in
4024$define|true|[yY]*)	dflt='y';;
4025*) dflt='n';;
4026esac
4027cat <<EOM
4028
4029Perl can be built to use the SOCKS proxy protocol library.  To do so,
4030Configure must be run with -Dusesocks.  If you use SOCKS you also need
4031to use the PerlIO abstraction layer, this will be implicitly selected.
4032
4033If this doesn't make any sense to you, just accept the default '$dflt'.
4034EOM
4035rp='Build Perl for SOCKS?'
4036. ./myread
4037case "$ans" in
4038y|Y)	val="$define" ;;
4039*)      val="$undef" ;;
4040esac
4041set usesocks
4042eval $setvar
4043
4044case "$usesocks" in
4045$define|true|[yY]*) useperlio="$define";;
4046esac
4047
4048case "$useperlio" in
4049$define|true|[yY]*|'')	dflt='y';;
4050*) dflt='n';;
4051esac
4052cat <<EOM
4053
4054Previous version of $package used the standard IO mechanisms as
4055defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4056alternate IO mechanisms via the PerlIO abstraction layer, but the
4057stdio mechanism is still available if needed.  The abstraction layer
4058can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4059Using PerlIO with sfio may cause problems with some extension modules.
4060
4061If this doesn't make any sense to you, just accept the default '$dflt'.
4062EOM
4063rp='Use the PerlIO abstraction layer?'
4064. ./myread
4065case "$ans" in
4066y|Y)
4067	val="$define"
4068	;;
4069*)
4070	echo "Ok, doing things the stdio way."
4071	val="$undef"
4072	;;
4073esac
4074set useperlio
4075eval $setvar
4076
4077case "$usesocks" in
4078$define|true|[yY]*)
4079	case "$useperlio" in
4080	$define|true|[yY]*) ;;
4081	*)	cat >&4 <<EOM
4082
4083You are using the SOCKS proxy protocol library which means that you
4084should also use the PerlIO layer.  You may be headed for trouble.
4085
4086EOM
4087		;;
4088	esac
4089	;;
4090esac
4091
4092
4093: get the patchlevel
4094echo " "
4095echo "Getting the current patchlevel..." >&4
4096if $test -r $rsrc/patchlevel.h;then
4097	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4104else
4105	revision=0
4106	patchlevel=0
4107	subversion=0
4108	api_revision=0
4109	api_version=0
4110	api_subversion=0
4111	perl_patchlevel=0
4112	$echo "(You do not have patchlevel.h.  Eek.)"
4113fi
4114if $test -r $rsrc/.patch ; then
4115	if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4116		perl_patchlevel=`cat $rsrc/.patch`
4117	fi
4118fi
4119: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4120version_patchlevel_string="version $patchlevel subversion $subversion"
4121case "$perl_patchlevel" in
41220|'') ;;
4123*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4124esac
4125
4126$echo "(You have $package $version_patchlevel_string.)"
4127
4128case "$osname" in
4129dos|vms)
4130	: XXX Should be a Configure test for double-dots in filenames.
4131	version=`echo $revision $patchlevel $subversion | \
4132		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4133	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135	;;
4136*)
4137	version=`echo $revision $patchlevel $subversion | \
4138		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4139	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141	;;
4142esac
4143: Special case the 5.005_xx maintenance series, which used 5.005
4144: without any subversion label as a subdirectory in $sitelib
4145if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4146	api_versionstring='5.005'
4147fi
4148
4149case "$usethreads" in
4150$define|true|[yY]*)     dflt='y';;
4151*)     # Catch case where user specified ithreads or 5005threads but
4152       # forgot -Dusethreads (A.D. 4/2002)
4153       case "$useithreads$use5005threads" in
4154       *$define*)
4155		case "$useperlio" in
4156		"$define")	dflt='y' ;;
4157		*)		dflt='n' ;;
4158		esac
4159		;;
4160       *)	dflt='n';;
4161       esac
4162       ;;
4163esac
4164cat <<EOM
4165
4166Perl can be built to take advantage of threads on some systems.
4167To do so, Configure can be run with -Dusethreads.
4168
4169Note that Perl built with threading support runs slightly slower
4170and uses more memory than plain Perl. The current implementation
4171is believed to be stable, but it is fairly new, and so should be
4172treated with caution.
4173
4174If this doesn't make any sense to you, just accept the default '$dflt'.
4175EOM
4176rp='Build a threading Perl?'
4177. ./myread
4178case "$ans" in
4179y|Y)    val="$define" ;;
4180*)      val="$undef" ;;
4181esac
4182set usethreads
4183eval $setvar
4184
4185if $test $patchlevel -lt 9; then
4186    case "$usethreads" in
4187    $define)
4188	$cat <<EOM
4189
4190Since release 5.6, Perl has had two different threading implementations,
4191the newer interpreter-based version (ithreads) with one interpreter per
4192thread, and the older 5.005 version (5005threads).
4193The 5005threads version is effectively unmaintained and will probably be
4194removed in Perl 5.10, so there should be no need to build a Perl using it
4195unless needed for backwards compatibility with some existing 5.005threads
4196code.
4197
4198EOM
4199	: Default to ithreads unless overridden on command line or with
4200	: old config.sh
4201	dflt='y'
4202	case "$use5005threads" in
4203		$define|true|[yY]*) dflt='n';;
4204	esac
4205	case "$useithreads" in
4206		$undef|false|[nN]*) dflt='n';;
4207	esac
4208	rp='Use the newer interpreter-based ithreads?'
4209	. ./myread
4210	case "$ans" in
4211	y|Y)    val="$define" ;;
4212	*)      val="$undef" ;;
4213	esac
4214	set useithreads
4215	eval $setvar
4216	: Now set use5005threads to the opposite value.
4217	case "$useithreads" in
4218	$define) val="$undef" ;;
4219	*) val="$define" ;;
4220	esac
4221	set use5005threads
4222	eval $setvar
4223	;;
4224    *)
4225	useithreads="$undef"
4226	use5005threads="$undef"
4227	;;
4228    esac
4229
4230    case "$useithreads$use5005threads" in
4231    "$define$define")
4232	$cat >&4 <<EOM
4233
4234You cannot have both the ithreads and the 5.005 threads enabled
4235at the same time.  Disabling the 5.005 threads since they are
4236much less stable than the ithreads.
4237
4238EOM
4239	use5005threads="$undef"
4240	;;
4241    esac
4242
4243else
4244: perl-5.9.x and later
4245
4246    if test X"$usethreads" = "X$define"; then
4247	case "$use5005threads" in
4248	    $define|true|[yY]*)
4249		$cat >&4 <<EOM
4250
42515.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4252
4253EOM
4254	    ;;
4255	esac
4256    fi
4257
4258    use5005threads="$undef"
4259    useithreads="$usethreads"
4260fi
4261
4262if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4263	cat >&4 <<EOF
4264***
4265*** To build with ithreads you must also use the PerlIO layer.
4266*** Cannot continue, aborting.
4267***
4268EOF
4269	exit 1
4270fi
4271
4272case "$d_oldpthreads" in
4273'')	: Configure tests would be welcome here.  For now, assume undef.
4274	val="$undef" ;;
4275*)	val="$d_oldpthreads" ;;
4276esac
4277set d_oldpthreads
4278eval $setvar
4279
4280
4281: Look for a hint-file generated 'call-back-unit'.  If the
4282: user has specified that a threading perl is to be built,
4283: we may need to set or change some other defaults.
4284if $test -f usethreads.cbu; then
4285    echo "Your platform has some specific hints regarding threaded builds, using them..."
4286    . ./usethreads.cbu
4287else
4288    case "$usethreads" in
4289	"$define"|true|[yY]*)
4290		$cat <<EOM
4291(Your platform does not have any specific hints for threaded builds.
4292 Assuming POSIX threads, then.)
4293EOM
4294	;;
4295    esac
4296fi
4297
4298cat <<EOM
4299
4300Perl can be built so that multiple Perl interpreters can coexist
4301within the same Perl executable.
4302EOM
4303
4304case "$useithreads" in
4305$define)
4306	cat <<EOM
4307This multiple interpreter support is required for interpreter-based threads.
4308EOM
4309	val="$define"
4310	;;
4311*)	case "$usemultiplicity" in
4312	$define|true|[yY]*)	dflt='y';;
4313	*) dflt='n';;
4314	esac
4315	echo " "
4316	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4317	rp='Build Perl for multiplicity?'
4318	. ./myread
4319	case "$ans" in
4320	y|Y)	val="$define" ;;
4321	*)      val="$undef" ;;
4322	esac
4323	;;
4324esac
4325set usemultiplicity
4326eval $setvar
4327
4328
4329case "$usemorebits" in
4330"$define"|true|[yY]*)
4331	use64bitint="$define"
4332	uselongdouble="$define"
4333	usemorebits="$define"
4334	;;
4335*)	usemorebits="$undef"
4336	;;
4337esac
4338
4339: make some quick guesses about what we are up against
4340echo " "
4341$echo $n "Hmm...  $c"
4342echo exit 1 >bsd
4343echo exit 1 >usg
4344echo exit 1 >v7
4345echo exit 1 >osf1
4346echo exit 1 >eunice
4347echo exit 1 >xenix
4348echo exit 1 >venix
4349echo exit 1 >os2
4350d_bsd="$undef"
4351$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353then
4354	echo "Looks kind of like an OSF/1 system, but we'll see..."
4355	echo exit 0 >osf1
4356elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357	xxx=`./loc addbib blurfl $pth`
4358	if $test -f $xxx; then
4359	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360		echo exit 0 >bsd
4361		echo exit 0 >usg
4362	else
4363		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364			echo "Looks kind of like an extended USG system, but we'll see..."
4365		else
4366			echo "Looks kind of like a USG system, but we'll see..."
4367		fi
4368		echo exit 0 >usg
4369	fi
4370elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371	echo "Looks kind of like a BSD system, but we'll see..."
4372	d_bsd="$define"
4373	echo exit 0 >bsd
4374else
4375	echo "Looks kind of like a Version 7 system, but we'll see..."
4376	echo exit 0 >v7
4377fi
4378case "$eunicefix" in
4379*unixtovms*)
4380	$cat <<'EOI'
4381There is, however, a strange, musty smell in the air that reminds me of
4382something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383EOI
4384	echo exit 0 >eunice
4385	d_eunice="$define"
4386: it so happens the Eunice I know will not run shell scripts in Unix format
4387	;;
4388*)
4389	echo " "
4390	echo "Congratulations.  You aren't running Eunice."
4391	d_eunice="$undef"
4392	;;
4393esac
4394: Detect OS2.  The p_ variable is set above in the Head.U unit.
4395: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396: semicolon as a patch separator
4397case "$p_" in
4398:) ;;
4399*)
4400	$cat <<'EOI'
4401I have the feeling something is not exactly right, however...don't tell me...
4402lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403(Or you may be running DOS with DJGPP.)
4404EOI
4405	echo exit 0 >os2
4406	;;
4407esac
4408if test -f /xenix; then
4409	echo "Actually, this looks more like a XENIX system..."
4410	echo exit 0 >xenix
4411	d_xenix="$define"
4412else
4413	echo " "
4414	echo "It's not Xenix..."
4415	d_xenix="$undef"
4416fi
4417chmod +x xenix
4418$eunicefix xenix
4419if test -f /venix; then
4420	echo "Actually, this looks more like a VENIX system..."
4421	echo exit 0 >venix
4422else
4423	echo " "
4424	if ./xenix; then
4425		: null
4426	else
4427		echo "Nor is it Venix..."
4428	fi
4429fi
4430chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432$rm -f foo
4433
4434case "$cc" in
4435'') dflt=cc;;
4436*) dflt="$cc";;
4437esac
4438rp="Use which C compiler?"
4439. ./myread
4440cc="$ans"
4441
4442: See if they have not cc but they do have gcc
4443. ./trygcc
4444: Look for a hint-file generated 'call-back-unit'.  Now that the
4445: user has specified the compiler, we may need to set or change some
4446: other defaults.
4447if $test -f cc.cbu; then
4448    . ./cc.cbu
4449fi
4450. ./checkcc
4451
4452echo " "
4453echo "Checking for GNU cc in disguise and/or its version number..." >&4
4454$cat >try.c <<EOM
4455#include <stdio.h>
4456int main() {
4457#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4458#ifdef __VERSION__
4459	printf("%s\n", __VERSION__);
4460#else
4461	printf("%s\n", "1");
4462#endif
4463#endif
4464	return(0);
4465}
4466EOM
4467if $cc -o try $ccflags $ldflags try.c; then
4468	gccversion=`$run ./try`
4469	case "$gccversion" in
4470	'') echo "You are not using GNU cc." ;;
4471	*)  echo "You are using GNU cc $gccversion."
4472	    ccname=gcc
4473	    ;;
4474	esac
4475else
4476	echo " "
4477	echo "*** WHOA THERE!!! ***" >&4
4478	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4479	case "$knowitall" in
4480	'')
4481	echo "    You'd better start hunting for one and let me know about it." >&4
4482		exit 1
4483		;;
4484	esac
4485fi
4486$rm -f try try.*
4487case "$gccversion" in
44881*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4489esac
4490case "$gccversion" in
4491'') gccosandvers='' ;;
4492*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4493   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4494   gccshortvers=''
4495   case "$gccosandvers" in
4496   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4497   $osname$osvers) ;; # looking good
4498   $osname*) cat <<EOM >&4
4499
4500*** WHOA THERE!!! ***
4501
4502    Your gcc has not been compiled for the exact release of
4503    your operating system ($gccosandvers versus $osname$osvers).
4504
4505    In general it is a good idea to keep gcc synchronized with
4506    the operating system because otherwise serious problems
4507    may ensue when trying to compile software, like Perl.
4508
4509    I'm trying to be optimistic here, though, and will continue.
4510    If later during the configuration and build icky compilation
4511    problems appear (headerfile conflicts being the most common
4512    manifestation), I suggest reinstalling the gcc to match
4513    your operating system release.
4514
4515EOM
4516      ;;
4517   *) gccosandvers='' ;; # failed to parse, better be silent
4518   esac
4519   ;;
4520esac
4521case "$ccname" in
4522'') ccname="$cc" ;;
4523esac
4524
4525# gcc 3.* complain about adding -Idirectories that they already know about,
4526# so we will take those off from locincpth.
4527case "$gccversion" in
45283*)
4529    echo "main(){}">try.c
4530    for incdir in $locincpth; do
4531       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4532	     grep '^c[cp]p*[01]: warning: changing search order '`
4533       if test "X$warn" != X; then
4534	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4535       fi
4536    done
4537    $rm -f try try.*
4538esac
4539
4540: What should the include directory be ?
4541echo " "
4542$echo $n "Hmm...  $c"
4543dflt='/usr/include'
4544incpath=''
4545mips_type=''
4546if $test -f /bin/mips && /bin/mips; then
4547	echo "Looks like a MIPS system..."
4548	$cat >usr.c <<'EOCP'
4549#ifdef SYSTYPE_BSD43
4550/bsd43
4551#endif
4552EOCP
4553	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4554		dflt='/bsd43/usr/include'
4555		incpath='/bsd43'
4556		mips_type='BSD 4.3'
4557	else
4558		mips_type='System V'
4559	fi
4560	$rm -f usr.c usr.out
4561	echo "and you're compiling with the $mips_type compiler and libraries."
4562	xxx_prompt=y
4563	echo "exit 0" >mips
4564else
4565	echo "Doesn't look like a MIPS system."
4566	xxx_prompt=n
4567	echo "exit 1" >mips
4568fi
4569chmod +x mips
4570$eunicefix mips
4571case "$usrinc" in
4572'') ;;
4573*) dflt="$usrinc";;
4574esac
4575case "$xxx_prompt" in
4576y)	fn=d/
4577	echo " "
4578	rp='Where are the include files you want to use?'
4579	. ./getfile
4580	usrinc="$ans"
4581	;;
4582*)	usrinc="$dflt"
4583	;;
4584esac
4585
4586: see how we invoke the C preprocessor
4587echo " "
4588echo "Now, how can we feed standard input to your C preprocessor..." >&4
4589cat <<'EOT' >testcpp.c
4590#define ABC abc
4591#define XYZ xyz
4592ABC.XYZ
4593EOT
4594cd ..
4595if test ! -f cppstdin; then
4596	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4597		# AIX cc -E doesn't show the absolute headerfile
4598		# locations but we'll cheat by using the -M flag.
4599		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
4600	else
4601		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4602	fi
4603else
4604	echo "Keeping your $hint cppstdin wrapper."
4605fi
4606chmod 755 cppstdin
4607wrapper=`pwd`/cppstdin
4608ok='false'
4609cd UU
4610
4611if $test "X$cppstdin" != "X" && \
4612	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4613	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4614then
4615	echo "You used to use $cppstdin $cppminus so we'll use that again."
4616	case "$cpprun" in
4617	'') echo "But let's see if we can live without a wrapper..." ;;
4618	*)
4619		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4620			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4621		then
4622			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4623			ok='true'
4624		else
4625			echo "(However, $cpprun $cpplast does not work, let's see...)"
4626		fi
4627		;;
4628	esac
4629else
4630	case "$cppstdin" in
4631	'') ;;
4632	*)
4633		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4634		;;
4635	esac
4636fi
4637
4638if $ok; then
4639	: nothing
4640elif echo 'Maybe "'"$cc"' -E" will work...'; \
4641	$cc -E <testcpp.c >testcpp.out 2>&1; \
4642	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643	echo "Yup, it does."
4644	x_cpp="$cc -E"
4645	x_minus='';
4646elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4647	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4648	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649	echo "Yup, it does."
4650	x_cpp="$cc -E"
4651	x_minus='-';
4652elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4653	$cc -P <testcpp.c >testcpp.out 2>&1; \
4654	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655	echo "Yipee, that works!"
4656	x_cpp="$cc -P"
4657	x_minus='';
4658elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4659	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4660	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661	echo "At long last!"
4662	x_cpp="$cc -P"
4663	x_minus='-';
4664elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4665	$cpp <testcpp.c >testcpp.out 2>&1; \
4666	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667	echo "It works!"
4668	x_cpp="$cpp"
4669	x_minus='';
4670elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4671	$cpp - <testcpp.c >testcpp.out 2>&1; \
4672	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673	echo "Hooray, it works!  I was beginning to wonder."
4674	x_cpp="$cpp"
4675	x_minus='-';
4676elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4677	$wrapper <testcpp.c >testcpp.out 2>&1; \
4678	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4679	x_cpp="$wrapper"
4680	x_minus=''
4681	echo "Eureka!"
4682else
4683	dflt=''
4684	rp="No dice.  I can't find a C preprocessor.  Name one:"
4685	. ./myread
4686	x_cpp="$ans"
4687	x_minus=''
4688	$x_cpp <testcpp.c >testcpp.out 2>&1
4689	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690		echo "OK, that will do." >&4
4691	else
4692echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4693		exit 1
4694	fi
4695fi
4696
4697case "$ok" in
4698false)
4699	cppstdin="$x_cpp"
4700	cppminus="$x_minus"
4701	cpprun="$x_cpp"
4702	cpplast="$x_minus"
4703	set X $x_cpp
4704	shift
4705	case "$1" in
4706	"$cpp")
4707		echo "Perhaps can we force $cc -E using a wrapper..."
4708		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4709			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4710		then
4711			echo "Yup, we can."
4712			cppstdin="$wrapper"
4713			cppminus='';
4714		else
4715			echo "Nope, we'll have to live without it..."
4716		fi
4717		;;
4718	esac
4719	case "$cpprun" in
4720	"$wrapper")
4721		cpprun=''
4722		cpplast=''
4723		;;
4724	esac
4725	;;
4726esac
4727
4728case "$cppstdin" in
4729"$wrapper"|'cppstdin') ;;
4730*) $rm -f $wrapper;;
4731esac
4732$rm -f testcpp.c testcpp.out
4733
4734: Set private lib path
4735case "$plibpth" in
4736'') if ./mips; then
4737		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4738	fi;;
4739esac
4740case "$libpth" in
4741' ') dlist='';;
4742'') dlist="$loclibpth $plibpth $glibpth";;
4743*) dlist="$libpth";;
4744esac
4745
4746: Now check and see which directories actually exist, avoiding duplicates
4747libpth=''
4748for xxx in $dlist
4749do
4750    if $test -d $xxx; then
4751		case " $libpth " in
4752		*" $xxx "*) ;;
4753		*) libpth="$libpth $xxx";;
4754		esac
4755    fi
4756done
4757$cat <<'EOM'
4758
4759Some systems have incompatible or broken versions of libraries.  Among
4760the directories listed in the question below, please remove any you
4761know not to be holding relevant libraries, and add any that are needed.
4762Say "none" for none.
4763
4764EOM
4765case "$libpth" in
4766'') dflt='none';;
4767*)
4768	set X $libpth
4769	shift
4770	dflt=${1+"$@"}
4771	;;
4772esac
4773rp="Directories to use for library searches?"
4774. ./myread
4775case "$ans" in
4776none) libpth=' ';;
4777*) libpth="$ans";;
4778esac
4779
4780: compute shared library extension
4781case "$so" in
4782'')
4783	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4784		dflt='sl'
4785	else
4786		dflt='so'
4787	fi
4788	;;
4789*) dflt="$so";;
4790esac
4791$cat <<EOM
4792
4793On some systems, shared libraries may be available.  Answer 'none' if
4794you want to suppress searching of shared libraries for the remainder
4795of this configuration.
4796
4797EOM
4798rp='What is the file extension used for shared libraries?'
4799. ./myread
4800so="$ans"
4801
4802: Define several unixisms.
4803: Hints files or command line option can be used to override them.
4804: The convoluted testing is in case hints files set either the old
4805: or the new name.
4806case "$_exe" in
4807'')	case "$exe_ext" in
4808	'')	;;
4809	*)	_exe="$exe_ext" ;;
4810	esac
4811	;;
4812esac
4813case "$_a" in
4814'')	case "$lib_ext" in
4815    '')	_a='.a';;
4816	*)	_a="$lib_ext" ;;
4817	esac
4818	;;
4819esac
4820case "$_o" in
4821'') case "$obj_ext" in
4822	'')	_o='.o';;
4823	*)	_o="$obj_ext";;
4824	esac
4825	;;
4826esac
4827case "$p_" in
4828'') case "$path_sep" in
4829	'')	p_=':';;
4830	*)	p_="$path_sep";;
4831	esac
4832	;;
4833esac
4834exe_ext=$_exe
4835lib_ext=$_a
4836obj_ext=$_o
4837path_sep=$p_
4838
4839rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4840
4841: Which makefile gets called first.  This is used by make depend.
4842case "$firstmakefile" in
4843'') firstmakefile='makefile';;
4844esac
4845
4846case "$ccflags" in
4847*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848esac
4849
4850case "$uselongdouble" in
4851$define|true|[yY]*)	dflt='y';;
4852*) dflt='n';;
4853esac
4854cat <<EOM
4855
4856Perl can be built to take advantage of long doubles which
4857(if available) may give more accuracy and range for floating point numbers.
4858
4859If this doesn't make any sense to you, just accept the default '$dflt'.
4860EOM
4861rp='Try to use long doubles if available?'
4862. ./myread
4863case "$ans" in
4864y|Y) 	val="$define"	;;
4865*)      val="$undef"	;;
4866esac
4867set uselongdouble
4868eval $setvar
4869
4870case "$uselongdouble" in
4871true|[yY]*) uselongdouble="$define" ;;
4872esac
4873
4874: Look for a hint-file generated 'call-back-unit'.  If the
4875: user has specified that long doubles should be used,
4876: we may need to set or change some other defaults.
4877if $test -f uselongdouble.cbu; then
4878    echo "Your platform has some specific hints regarding long doubles, using them..."
4879    . ./uselongdouble.cbu
4880else
4881    case "$uselongdouble" in
4882	$define)
4883		$cat <<EOM
4884(Your platform does not have any specific hints for long doubles.)
4885EOM
4886	;;
4887    esac
4888fi
4889
4890: Looking for optional libraries
4891echo " "
4892echo "Checking for optional libraries..." >&4
4893case "$libs" in
4894' '|'') dflt='';;
4895*) dflt="$libs";;
4896esac
4897case "$libswanted" in
4898'') libswanted='c_s';;
4899esac
4900case "$usesocks" in
4901"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4902esac
4903libsfound=''
4904libsfiles=''
4905libsdirs=''
4906libspath=''
4907for thisdir in $libpth $xlibpth; do
4908  test -d $thisdir && libspath="$libspath $thisdir"
4909done
4910for thislib in $libswanted; do
4911	for thisdir in $libspath; do
4912	    xxx=''
4913	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4914		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4915	        $test -f "$xxx" && eval $libscheck
4916		$test -f "$xxx" && libstyle=shared
4917	    fi
4918	    if test ! -f "$xxx"; then
4919		xxx=$thisdir/lib$thislib.$so
4920	        $test -f "$xxx" && eval $libscheck
4921		$test -f "$xxx" && libstyle=shared
4922	    fi
4923	    if test ! -f "$xxx"; then
4924		xxx=$thisdir/lib$thislib$_a
4925	        $test -f "$xxx" && eval $libscheck
4926		$test -f "$xxx" && libstyle=static
4927	    fi
4928	    if test ! -f "$xxx"; then
4929		xxx=$thisdir/$thislib$_a
4930	        $test -f "$xxx" && eval $libscheck
4931		$test -f "$xxx" && libstyle=static
4932	    fi
4933	    if test ! -f "$xxx"; then
4934		xxx=$thisdir/lib${thislib}_s$_a
4935	        $test -f "$xxx" && eval $libscheck
4936		$test -f "$xxx" && libstyle=static
4937		$test -f "$xxx" && thislib=${thislib}_s
4938	    fi
4939	    if test ! -f "$xxx"; then
4940		xxx=$thisdir/Slib$thislib$_a
4941	        $test -f "$xxx" && eval $libscheck
4942		$test -f "$xxx" && libstyle=static
4943	    fi
4944	    if $test -f "$xxx"; then
4945		case "$libstyle" in
4946		shared) echo "Found -l$thislib (shared)." ;;
4947		static) echo "Found -l$thislib." ;;
4948		*)      echo "Found -l$thislib ($libstyle)." ;;
4949		esac
4950		case " $dflt " in
4951		*"-l$thislib "*);;
4952		*) dflt="$dflt -l$thislib"
4953                   libsfound="$libsfound $xxx"
4954                   yyy=`basename $xxx`
4955                   libsfiles="$libsfiles $yyy"
4956                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4957                   case " $libsdirs " in
4958                   *" $yyy "*) ;;
4959                   *) libsdirs="$libsdirs $yyy" ;;
4960                   esac
4961		   ;;
4962		esac
4963		break
4964	    fi
4965	done
4966	if $test ! -f "$xxx"; then
4967	    echo "No -l$thislib."
4968	fi
4969done
4970set X $dflt
4971shift
4972dflt="$*"
4973case "$libs" in
4974'') dflt="$dflt";;
4975*) dflt="$libs";;
4976esac
4977case "$dflt" in
4978' '|'') dflt='none';;
4979esac
4980
4981$cat <<EOM
4982
4983In order to compile $package on your machine, a number of libraries
4984are usually needed.  Include any other special libraries here as well.
4985Say "none" for none.  The default list is almost always right.
4986EOM
4987
4988echo " "
4989rp="What libraries to use?"
4990. ./myread
4991case "$ans" in
4992none) libs=' ';;
4993*) libs="$ans";;
4994esac
4995
4996: determine optimization, if desired, or use for debug flag also
4997case "$optimize" in
4998' '|$undef) dflt='none';;
4999'') dflt='-O';;
5000*) dflt="$optimize";;
5001esac
5002$cat <<EOH
5003
5004By default, $package compiles with the -O flag to use the optimizer.
5005Alternately, you might want to use the symbolic debugger, which uses
5006the -g flag (on traditional Unix systems).  Either flag can be
5007specified here.  To use neither flag, specify the word "none".
5008
5009EOH
5010rp="What optimizer/debugger flag should be used?"
5011. ./myread
5012optimize="$ans"
5013case "$optimize" in
5014'none') optimize=" ";;
5015esac
5016
5017: Check what DEBUGGING is required from the command line
5018: -DEBUGGING      or -DDEBUGGING or
5019: -DEBUGGING=both			= -g + -DDEBUGGING
5020: -DEBUGGING=-g   or -Doptimize=-g	= -g
5021: -DEBUGGING=none or -UDEBUGGING	=
5022: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5023case "$EBUGGING" in
5024'')	;;
5025*)	DEBUGGING=$EBUGGING ;;
5026esac
5027
5028case "$DEBUGGING" in
5029-g|both|$define)
5030    case "$optimize" in
5031	*-g*) ;;
5032	*)    optimize="$optimize -g" ;;
5033    esac ;;
5034none|$undef)
5035    case "$optimize" in
5036	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5037		shift
5038		optimize="$*"
5039		;;
5040    esac ;;
5041esac
5042
5043dflt=''
5044case "$DEBUGGING" in
5045both|$define) dflt='-DDEBUGGING'
5046esac
5047
5048: We will not override a previous value, but we might want to
5049: augment a hint file
5050case "$hint" in
5051default|recommended)
5052	case "$gccversion" in
5053	1*) dflt="$dflt -fpcc-struct-return" ;;
5054	esac
5055	case "$optimize:$DEBUGGING" in
5056	*-g*:old) dflt="$dflt -DDEBUGGING";;
5057	esac
5058	case "$gccversion" in
5059	2*) if test -d /etc/conf/kconfig.d &&
5060			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5061		then
5062			# Interactive Systems (ISC) POSIX mode.
5063			dflt="$dflt -posix"
5064		fi
5065		;;
5066	esac
5067	case "$gccversion" in
5068	1*) ;;
5069	2.[0-8]*) ;;
5070	?*) 	echo " "
5071		echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5072		echo 'int main(void) { return 0; }' > gcctest.c
5073		if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5074			echo "Yes, it does." 2>&1
5075			case "$ccflags" in
5076			*strict-aliasing*)
5077				echo "Leaving current flags $ccflags alone." 2>&1
5078				;;
5079			*) dflt="$dflt -fno-strict-aliasing" ;;
5080			esac
5081		else
5082			echo "Nope, it doesn't, but that's ok." 2>&1
5083		fi
5084		;;
5085	esac
5086	case "$gccversion" in
5087	1*) ;;
5088	2*) ;;
5089	?*) 	echo " "
5090		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5091		echo 'int main(void) { return 0; }' > gcctest.c
5092		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5093			echo "Yes, it does." 2>&1
5094			case "$ccflags" in
5095			*delete-null-pointer-checks*)
5096				echo "Leaving current flags $ccflags alone." 2>&1
5097				;;
5098			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5099			esac
5100		else
5101			echo "Nope, it doesn't, but that's ok." 2>&1
5102		fi
5103		;;
5104	esac
5105	# For gcc, adding -pipe speeds up compilations for some, but apparently
5106	# some assemblers can't read from stdin.  (It also slows down compilations
5107	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5108	case "$gccversion" in
5109	?*)	echo " "
5110		echo "Checking if your compiler accepts -pipe" 2>&1
5111		echo 'int main(void) { return 0; }' > gcctest.c
5112		if $cc -pipe -o gcctest gcctest.c; then
5113			echo "Yes, it does." 2>&1
5114			case "$ccflags" in
5115			*-pipe*)
5116				echo "Leaving current flags $ccflags alone." 2>&1
5117				;;
5118			*) dflt="$dflt -pipe" ;;
5119			esac
5120		else
5121			echo "Nope, it doesn't, but that's ok." 2>&1
5122		fi
5123		;;
5124	esac
5125	;;
5126esac
5127
5128case "$mips_type" in
5129*BSD*|'') inclwanted="$locincpth $usrinc";;
5130*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5131esac
5132for thisincl in $inclwanted; do
5133	if $test -d $thisincl; then
5134		if $test x$thisincl != x$usrinc; then
5135			case "$dflt" in
5136			*" -I$thisincl "*);;
5137			*) dflt="$dflt -I$thisincl ";;
5138			esac
5139		fi
5140	fi
5141done
5142
5143inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5144	xxx=true;
5145elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5146	xxx=true;
5147else
5148	xxx=false;
5149fi;
5150if $xxx; then
5151	case "$dflt" in
5152	*$2*);;
5153	*) dflt="$dflt -D$2";;
5154	esac;
5155fi'
5156
5157set signal.h LANGUAGE_C; eval $inctest
5158
5159case "$usesocks" in
5160$define)
5161	ccflags="$ccflags -DSOCKS"
5162	;;
5163esac
5164
5165case "$hint" in
5166default|recommended) dflt="$ccflags $dflt" ;;
5167*) dflt="$ccflags";;
5168esac
5169
5170case "$dflt" in
5171''|' ') dflt=none;;
5172esac
5173
5174$cat <<EOH
5175
5176Your C compiler may want other flags.  For this question you should include
5177-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5178but you should NOT include libraries or ld flags like -lwhatever.  If you
5179want $package to honor its debug switch, you should include -DDEBUGGING here.
5180Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5181
5182To use no flags, specify the word "none".
5183
5184EOH
5185set X $dflt
5186shift
5187dflt=${1+"$@"}
5188rp="Any additional cc flags?"
5189. ./myread
5190case "$ans" in
5191none) ccflags='';;
5192*) ccflags="$ans";;
5193esac
5194
5195: the following weeds options from ccflags that are of no interest to cpp
5196case "$cppflags" in
5197'') cppflags="$ccflags" ;;
5198*)  cppflags="$cppflags $ccflags" ;;
5199esac
5200case "$gccversion" in
52011*) cppflags="$cppflags -D__GNUC__"
5202esac
5203case "$mips_type" in
5204'');;
5205*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5206esac
5207case "$cppflags" in
5208'');;
5209*)
5210	echo " "
5211	echo "Let me guess what the preprocessor flags are..." >&4
5212	set X $cppflags
5213	shift
5214	cppflags=''
5215	$cat >cpp.c <<'EOM'
5216#define BLURFL foo
5217
5218BLURFL xx LFRULB
5219EOM
5220	previous=''
5221	for flag in $*
5222	do
5223		case "$flag" in
5224		-*) ftry="$flag";;
5225		*) ftry="$previous $flag";;
5226		esac
5227		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5228			>cpp1.out 2>/dev/null && \
5229			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5230			>cpp2.out 2>/dev/null && \
5231			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5232			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5233		then
5234			cppflags="$cppflags $ftry"
5235			previous=''
5236		else
5237			previous="$flag"
5238		fi
5239	done
5240	set X $cppflags
5241	shift
5242	cppflags=${1+"$@"}
5243	case "$cppflags" in
5244	*-*)  echo "They appear to be: $cppflags";;
5245	esac
5246	$rm -f cpp.c cpp?.out
5247	;;
5248esac
5249
5250: flags used in final linking phase
5251case "$ldflags" in
5252'') if ./venix; then
5253		dflt='-i -z'
5254	else
5255		dflt=''
5256	fi
5257	case "$ccflags" in
5258	*-posix*) dflt="$dflt -posix" ;;
5259	esac
5260	;;
5261*) dflt="$ldflags";;
5262esac
5263
5264: Try to guess additional flags to pick up local libraries.
5265for thislibdir in $libpth; do
5266	case " $loclibpth " in
5267	*" $thislibdir "*)
5268		case "$dflt " in
5269		*"-L$thislibdir "*) ;;
5270		*)  dflt="$dflt -L$thislibdir" ;;
5271		esac
5272		;;
5273	esac
5274done
5275
5276case "$dflt" in
5277'') dflt='none' ;;
5278esac
5279
5280$cat <<EOH
5281
5282Your C linker may need flags.  For this question you should
5283include -L/whatever and any other flags used by the C linker, but you
5284should NOT include libraries like -lwhatever.
5285
5286Make sure you include the appropriate -L/path flags if your C linker
5287does not normally search all of the directories you specified above,
5288namely
5289	$libpth
5290To use no flags, specify the word "none".
5291
5292EOH
5293
5294rp="Any additional ld flags (NOT including libraries)?"
5295. ./myread
5296case "$ans" in
5297none) ldflags='';;
5298*) ldflags="$ans";;
5299esac
5300rmlist="$rmlist pdp11"
5301
5302: coherency check
5303echo " "
5304echo "Checking your choice of C compiler and flags for coherency..." >&4
5305$cat > try.c <<'EOF'
5306#include <stdio.h>
5307int main() { printf("Ok\n"); return(0); }
5308EOF
5309set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5310shift
5311$cat >try.msg <<'EOM'
5312I've tried to compile and run the following simple program:
5313
5314EOM
5315$cat try.c >> try.msg
5316
5317$cat >> try.msg <<EOM
5318
5319I used the command:
5320
5321	$*
5322	$run ./try
5323
5324and I got the following output:
5325
5326EOM
5327dflt=y
5328if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5329	if $sh -c "$run ./try" >>try.msg 2>&1; then
5330		xxx=`$run ./try`
5331		case "$xxx" in
5332		"Ok") dflt=n ;;
5333		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
5334			case " $libs " in
5335			*" -lsfio "*)
5336				cat >> try.msg <<'EOQS'
5337If $libs contains -lsfio, and sfio is mis-configured, then it
5338sometimes (apparently) runs and exits with a 0 status, but with no
5339output!  It may have to do with sfio's use of _exit vs. exit.
5340
5341EOQS
5342				rp="You have a big problem.  Shall I abort Configure"
5343				dflt=y
5344				;;
5345			esac
5346			;;
5347		esac
5348	else
5349		echo "The program compiled OK, but exited with status $?." >>try.msg
5350		rp="You have a problem.  Shall I abort Configure"
5351		dflt=y
5352	fi
5353else
5354	echo "I can't compile the test program." >>try.msg
5355	rp="You have a BIG problem.  Shall I abort Configure"
5356	dflt=y
5357fi
5358case "$dflt" in
5359y)
5360	$cat try.msg >&4
5361	case "$knowitall" in
5362	'')
5363		echo "(The supplied flags or libraries might be incorrect.)"
5364		;;
5365	*) dflt=n;;
5366	esac
5367	echo " "
5368	. ./myread
5369	case "$ans" in
5370	n*|N*) ;;
5371	*)	echo "Ok.  Stopping Configure." >&4
5372		exit 1
5373		;;
5374	esac
5375	;;
5376n) echo "OK, that should do.";;
5377esac
5378$rm_try
5379
5380: define a shorthand compile call
5381compile='
5382mc_file=$1;
5383shift;
5384$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5385: define a shorthand compile call for compilations that should be ok.
5386compile_ok='
5387mc_file=$1;
5388shift;
5389$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5390
5391: determine filename position in cpp output
5392echo " "
5393echo "Computing filename position in cpp output for #include directives..." >&4
5394case "$osname" in
5395vos) testaccess=-e ;;
5396*)   testaccess=-r ;;
5397esac
5398echo '#include <stdio.h>' > foo.c
5399$cat >fieldn <<EOF
5400$startsh
5401$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5402$grep '^[ 	]*#.*stdio\.h' | \
5403while read cline; do
5404	pos=1
5405	set \$cline
5406	while $test \$# -gt 0; do
5407		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5408			echo "\$pos"
5409			exit 0
5410		fi
5411		shift
5412		pos=\`expr \$pos + 1\`
5413	done
5414done
5415EOF
5416chmod +x fieldn
5417fieldn=`./fieldn`
5418$rm -f foo.c fieldn
5419case $fieldn in
5420'') pos='???';;
54211) pos=first;;
54222) pos=second;;
54233) pos=third;;
5424*) pos="${fieldn}th";;
5425esac
5426echo "Your cpp writes the filename in the $pos field of the line."
5427
5428case "$osname" in
5429vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5430os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5431*)   cppfilter='' ;;
5432esac
5433: locate header file
5434$cat >findhdr <<EOF
5435$startsh
5436wanted=\$1
5437name=''
5438for usrincdir in $usrinc
5439do
5440	if test -f \$usrincdir/\$wanted; then
5441		echo "\$usrincdir/\$wanted"
5442		exit 0
5443	fi
5444done
5445awkprg='{ print \$$fieldn }'
5446echo "#include <\$wanted>" > foo\$\$.c
5447$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5448$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5449while read cline; do
5450	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5451	case "\$name" in
5452	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5453	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5454	*) exit 2;;
5455	esac;
5456done;
5457#
5458# status = 0: grep returned 0 lines, case statement not executed
5459# status = 1: headerfile found
5460# status = 2: while loop executed, no headerfile found
5461#
5462status=\$?
5463$rm -f foo\$\$.c;
5464if test \$status -eq 1; then
5465	exit 0;
5466fi
5467exit 1
5468EOF
5469chmod +x findhdr
5470
5471: define an alternate in-header-list? function
5472inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5473cont=true; xxf="echo \"<\$1> found.\" >&4";
5474case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5475*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5476esac;
5477case $# in 4) instead=instead;; *) instead="at last";; esac;
5478while $test "$cont"; do
5479	xxx=`./findhdr $1`
5480	var=$2; eval "was=\$$2";
5481	if $test "$xxx" && $test -r "$xxx";
5482	then eval $xxf;
5483	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5484		cont="";
5485	else eval $xxnf;
5486	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5487	set $yyy; shift; shift; yyy=$@;
5488	case $# in 0) cont="";;
5489	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5490		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5491	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5492		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5493	esac;
5494done;
5495while $test "$yyy";
5496do set $yyy; var=$2; eval "was=\$$2";
5497	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5498	set $yyy; shift; shift; yyy=$@;
5499done'
5500
5501: see if stdlib is available
5502set stdlib.h i_stdlib
5503eval $inhdr
5504
5505: check for lengths of integral types
5506echo " "
5507case "$intsize" in
5508'')
5509	echo "Checking to see how big your integers are..." >&4
5510	$cat >try.c <<EOCP
5511#include <stdio.h>
5512#$i_stdlib I_STDLIB
5513#ifdef I_STDLIB
5514#include <stdlib.h>
5515#endif
5516int main()
5517{
5518	printf("intsize=%d;\n", (int)sizeof(int));
5519	printf("longsize=%d;\n", (int)sizeof(long));
5520	printf("shortsize=%d;\n", (int)sizeof(short));
5521	exit(0);
5522}
5523EOCP
5524	set try
5525	if eval $compile_ok && $run ./try > /dev/null; then
5526		eval `$run ./try`
5527		echo "Your integers are $intsize bytes long."
5528		echo "Your long integers are $longsize bytes long."
5529		echo "Your short integers are $shortsize bytes long."
5530	else
5531		$cat >&4 <<EOM
5532!
5533Help! I can't compile and run the intsize test program: please enlighten me!
5534(This is probably a misconfiguration in your system or libraries, and
5535you really ought to fix it.  Still, I'll try anyway.)
5536!
5537EOM
5538		dflt=4
5539		rp="What is the size of an integer (in bytes)?"
5540		. ./myread
5541		intsize="$ans"
5542		dflt=$intsize
5543		rp="What is the size of a long integer (in bytes)?"
5544		. ./myread
5545		longsize="$ans"
5546		dflt=2
5547		rp="What is the size of a short integer (in bytes)?"
5548		. ./myread
5549		shortsize="$ans"
5550	fi
5551	;;
5552esac
5553$rm_try
5554
5555: check for long long
5556echo " "
5557echo "Checking to see if you have long long..." >&4
5558echo 'int main() { long long x = 7; return 0; }' > try.c
5559set try
5560if eval $compile; then
5561	val="$define"
5562	echo "You have long long."
5563else
5564	val="$undef"
5565	echo "You do not have long long."
5566fi
5567$rm_try
5568set d_longlong
5569eval $setvar
5570
5571: check for length of long long
5572case "${d_longlong}${longlongsize}" in
5573$define)
5574	echo " "
5575	echo "Checking to see how big your long longs are..." >&4
5576	$cat >try.c <<'EOCP'
5577#include <stdio.h>
5578int main()
5579{
5580    printf("%d\n", (int)sizeof(long long));
5581    return(0);
5582}
5583EOCP
5584	set try
5585	if eval $compile_ok; then
5586		longlongsize=`$run ./try`
5587		echo "Your long longs are $longlongsize bytes long."
5588	else
5589		dflt='8'
5590		echo " "
5591		echo "(I can't seem to compile the test program.  Guessing...)"
5592		rp="What is the size of a long long (in bytes)?"
5593		. ./myread
5594		longlongsize="$ans"
5595	fi
5596	if $test "X$longsize" = "X$longlongsize"; then
5597		echo "(That isn't any different from an ordinary long.)"
5598	fi
5599	;;
5600esac
5601$rm_try
5602
5603: see if inttypes.h is available
5604: we want a real compile instead of Inhdr because some systems
5605: have an inttypes.h which includes non-existent headers
5606echo " "
5607$cat >try.c <<EOCP
5608#include <inttypes.h>
5609int main() {
5610	static int32_t foo32 = 0x12345678;
5611}
5612EOCP
5613set try
5614if eval $compile; then
5615	echo "<inttypes.h> found." >&4
5616	val="$define"
5617else
5618	echo "<inttypes.h> NOT found." >&4
5619	val="$undef"
5620fi
5621$rm_try
5622set i_inttypes
5623eval $setvar
5624
5625: check for int64_t
5626echo " "
5627echo "Checking to see if you have int64_t..." >&4
5628$cat >try.c <<EOCP
5629#include <sys/types.h>
5630#$i_inttypes I_INTTYPES
5631#ifdef I_INTTYPES
5632#include <inttypes.h>
5633#endif
5634int main() { int64_t x = 7; }
5635EOCP
5636set try
5637if eval $compile; then
5638	val="$define"
5639	echo "You have int64_t."
5640else
5641	val="$undef"
5642	echo "You do not have int64_t."
5643fi
5644$rm_try
5645set d_int64_t
5646eval $setvar
5647
5648
5649echo " "
5650echo "Checking which 64-bit integer type we could use..." >&4
5651
5652case "$intsize" in
56538) val=int
5654   set quadtype
5655   eval $setvar
5656   val='"unsigned int"'
5657   set uquadtype
5658   eval $setvar
5659   quadkind=1
5660   ;;
5661*) case "$longsize" in
5662   8) val=long
5663      set quadtype
5664      eval $setvar
5665      val='"unsigned long"'
5666      set uquadtype
5667      eval $setvar
5668      quadkind=2
5669      ;;
5670   *) case "$d_longlong:$longlongsize" in
5671      define:8)
5672        val='"long long"'
5673        set quadtype
5674        eval $setvar
5675        val='"unsigned long long"'
5676        set uquadtype
5677        eval $setvar
5678        quadkind=3
5679        ;;
5680      *) case "$d_int64_t" in
5681         define)
5682           val=int64_t
5683           set quadtype
5684           eval $setvar
5685           val=uint64_t
5686           set uquadtype
5687           eval $setvar
5688           quadkind=4
5689           ;;
5690         esac
5691         ;;
5692      esac
5693      ;;
5694   esac
5695   ;;
5696esac
5697
5698case "$quadtype" in
5699'')	echo "Alas, no 64-bit integer types in sight." >&4
5700	d_quad="$undef"
5701	;;
5702*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5703	d_quad="$define"
5704	;;
5705esac
5706
5707
5708case "$uselonglong" in
5709"$define"|true|[yY]*)
5710	cat <<EOM >&4
5711
5712*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5713EOM
5714	use64bitint="$define"
5715	;;
5716esac
5717case "$use64bits" in
5718"$define"|true|[yY]*)
5719	cat <<EOM >&4
5720
5721*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5722EOM
5723	use64bitint="$define"
5724	;;
5725esac
5726case "$use64bitints" in
5727"$define"|true|[yY]*)
5728	cat <<EOM >&4
5729
5730*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5731EOM
5732	use64bitint="$define"
5733	;;
5734esac
5735case "$use64bitsint" in
5736"$define"|true|[yY]*)
5737	cat <<EOM >&4
5738
5739*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5740EOM
5741	use64bitint="$define"
5742	;;
5743esac
5744case "$uselonglongs" in
5745"$define"|true|[yY]*)
5746	cat <<EOM >&4
5747
5748*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5749EOM
5750	use64bitint="$define"
5751	;;
5752esac
5753case "$use64bitsall" in
5754"$define"|true|[yY]*)
5755	cat <<EOM >&4
5756
5757*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5758EOM
5759	use64bitall="$define"
5760	;;
5761esac
5762
5763case "$ccflags" in
5764*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5765esac
5766case "$use64bitall" in
5767"$define"|true|[yY]*) use64bitint="$define" ;;
5768esac
5769
5770case "$longsize" in
57718) cat <<EOM
5772
5773You have natively 64-bit long integers.
5774EOM
5775   val="$define"
5776   ;;
5777*) case "$use64bitint" in
5778   "$define"|true|[yY]*) dflt='y';;
5779   *) dflt='n';;
5780   esac
5781   case "$d_quad" in
5782   "$define") ;;
5783   *) dflt='n' ;;
5784   esac
5785   cat <<EOM
5786
5787Perl can be built to take advantage of 64-bit integer types
5788on some systems.  To do so, Configure can be run with -Duse64bitint.
5789Choosing this option will most probably introduce binary incompatibilities.
5790
5791If this doesn't make any sense to you, just accept the default '$dflt'.
5792(The default has been chosen based on your configuration.)
5793EOM
5794   rp='Try to use 64-bit integers, if available?'
5795   . ./myread
5796   case "$ans" in
5797   [yY]*) val="$define" ;;
5798   *)     val="$undef"  ;;
5799   esac
5800   ;;
5801esac
5802set use64bitint
5803eval $setvar
5804
5805case "$use64bitall" in
5806"$define"|true|[yY]*) dflt='y' ;;
5807*) case "$longsize" in
5808   8) dflt='y' ;;
5809   *) dflt='n' ;;
5810   esac
5811   ;;
5812esac
5813cat <<EOM
5814
5815You may also choose to try maximal 64-bitness.  It means using as much
581664-bitness as possible on the platform.  This in turn means even more
5817binary incompatibilities.  On the other hand, your platform may not
5818have any more 64-bitness available than what you already have chosen.
5819
5820If this doesn't make any sense to you, just accept the default '$dflt'.
5821(The default has been chosen based on your configuration.)
5822EOM
5823rp='Try to use maximal 64-bit support, if available?'
5824. ./myread
5825case "$ans" in
5826[yY]*) val="$define" ;;
5827*)     val="$undef"  ;;
5828esac
5829set use64bitall
5830eval $setvar
5831case "$use64bitall" in
5832"$define")
5833	case "$use64bitint" in
5834	"$undef")
5835		cat <<EOM
5836
5837Since you have chosen a maximally 64-bit build, I'm also turning on
5838the use of 64-bit integers.
5839EOM
5840		use64bitint="$define" ;;
5841	esac
5842	;;
5843esac
5844
5845: Look for a hint-file generated 'call-back-unit'.  If the
5846: user has specified that a 64-bit perl is to be built,
5847: we may need to set or change some other defaults.
5848if $test -f use64bitint.cbu; then
5849	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5850	. ./use64bitint.cbu
5851fi
5852case "$use64bitint" in
5853"$define"|true|[yY]*)
5854	case "$longsize" in
5855	4) case "$archname64" in
5856	   '') archname64=64int ;;
5857	   esac
5858	   ;;
5859	esac
5860	;;
5861esac
5862
5863: Look for a hint-file generated 'call-back-unit'.  If the
5864: user has specified that a maximally 64-bit perl is to be built,
5865: we may need to set or change some other defaults.
5866if $test -f use64bitall.cbu; then
5867	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5868	. ./use64bitall.cbu
5869fi
5870case "$use64bitall" in
5871"$define"|true|[yY]*)
5872	case "$longsize" in
5873	4) case "$archname64" in
5874	   ''|64int) archname64=64all ;;
5875	   esac
5876	   ;;
5877	esac
5878	;;
5879esac
5880
5881case "$d_quad:$use64bitint" in
5882$undef:$define)
5883	cat >&4 <<EOF
5884
5885*** You have chosen to use 64-bit integers,
5886*** but none can be found.
5887*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5888*** Cannot continue, aborting.
5889
5890EOF
5891	exit 1
5892	;;
5893esac
5894
5895: check for length of double
5896echo " "
5897case "$doublesize" in
5898'')
5899	echo "Checking to see how big your double precision numbers are..." >&4
5900	$cat >try.c <<EOCP
5901#include <stdio.h>
5902#$i_stdlib I_STDLIB
5903#ifdef I_STDLIB
5904#include <stdlib.h>
5905#endif
5906int main()
5907{
5908    printf("%d\n", (int)sizeof(double));
5909    exit(0);
5910}
5911EOCP
5912	set try
5913	if eval $compile_ok; then
5914		doublesize=`$run ./try`
5915		echo "Your double is $doublesize bytes long."
5916	else
5917		dflt='8'
5918		echo "(I can't seem to compile the test program.  Guessing...)"
5919		rp="What is the size of a double precision number (in bytes)?"
5920		. ./myread
5921		doublesize="$ans"
5922	fi
5923	;;
5924esac
5925$rm_try
5926
5927: check for long doubles
5928echo " "
5929echo "Checking to see if you have long double..." >&4
5930echo 'int main() { long double x = 7.0; }' > try.c
5931set try
5932if eval $compile; then
5933	val="$define"
5934	echo "You have long double."
5935else
5936	val="$undef"
5937	echo "You do not have long double."
5938fi
5939$rm_try
5940set d_longdbl
5941eval $setvar
5942
5943: check for length of long double
5944case "${d_longdbl}${longdblsize}" in
5945$define)
5946	echo " "
5947	echo "Checking to see how big your long doubles are..." >&4
5948	$cat >try.c <<'EOCP'
5949#include <stdio.h>
5950int main()
5951{
5952	printf("%d\n", sizeof(long double));
5953}
5954EOCP
5955	set try
5956	set try
5957	if eval $compile; then
5958		longdblsize=`$run ./try`
5959		echo "Your long doubles are $longdblsize bytes long."
5960	else
5961		dflt='8'
5962		echo " "
5963		echo "(I can't seem to compile the test program.  Guessing...)" >&4
5964		rp="What is the size of a long double (in bytes)?"
5965		. ./myread
5966		longdblsize="$ans"
5967	fi
5968	if $test "X$doublesize" = "X$longdblsize"; then
5969		echo "That isn't any different from an ordinary double."
5970		echo "I'll keep your setting anyway, but you may see some"
5971		echo "harmless compilation warnings."
5972	fi
5973	;;
5974esac
5975$rm_try
5976
5977: determine the architecture name
5978echo " "
5979if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5980	tarch=`arch`"-$osname"
5981elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5982	if uname -m > tmparch 2>&1 ; then
5983		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5984			-e 's/$/'"-$osname/" tmparch`
5985	else
5986		tarch="$osname"
5987	fi
5988	$rm -f tmparch
5989else
5990	tarch="$osname"
5991fi
5992case "$myarchname" in
5993''|"$tarch") ;;
5994*)
5995	echo "(Your architecture name used to be $myarchname.)"
5996	archname=''
5997	;;
5998esac
5999case "$targetarch" in
6000'') ;;
6001*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6002esac
6003myarchname="$tarch"
6004case "$archname" in
6005'') dflt="$tarch";;
6006*) dflt="$archname";;
6007esac
6008rp='What is your architecture name'
6009. ./myread
6010archname="$ans"
6011case "$usethreads" in
6012$define)
6013	echo "Threads selected." >&4
6014	case "$archname" in
6015        *-thread*) echo "...and architecture name already has -thread." >&4
6016                ;;
6017        *)      archname="$archname-thread"
6018                echo "...setting architecture name to $archname." >&4
6019                ;;
6020        esac
6021	;;
6022esac
6023case "$usemultiplicity" in
6024$define)
6025	echo "Multiplicity selected." >&4
6026	case "$archname" in
6027        *-multi*) echo "...and architecture name already has -multi." >&4
6028                ;;
6029        *)      archname="$archname-multi"
6030                echo "...setting architecture name to $archname." >&4
6031                ;;
6032        esac
6033	;;
6034esac
6035case "$use64bitint$use64bitall" in
6036*"$define"*)
6037	case "$archname64" in
6038	'')
6039		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6040		;;
6041	*)
6042		case "$use64bitint" in
6043		"$define") echo "64 bit integers selected." >&4 ;;
6044		esac
6045		case "$use64bitall" in
6046		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6047		esac
6048		case "$archname" in
6049	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6050	                ;;
6051	        *)      archname="$archname-$archname64"
6052	                echo "...setting architecture name to $archname." >&4
6053	                ;;
6054	        esac
6055		;;
6056	esac
6057esac
6058case "$uselongdouble" in
6059$define)
6060	echo "Long doubles selected." >&4
6061	case "$longdblsize" in
6062	$doublesize)
6063		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6064		;;
6065	*)
6066		case "$archname" in
6067	        *-ld*) echo "...and architecture name already has -ld." >&4
6068	                ;;
6069	        *)      archname="$archname-ld"
6070	                echo "...setting architecture name to $archname." >&4
6071        	        ;;
6072	        esac
6073		;;
6074	esac
6075	;;
6076esac
6077case "$useperlio" in
6078$define)
6079	echo "Perlio selected." >&4
6080	;;
6081*)
6082	echo "Perlio not selected, using stdio." >&4
6083	case "$archname" in
6084        *-stdio*) echo "...and architecture name already has -stdio." >&4
6085                ;;
6086        *)      archname="$archname-stdio"
6087                echo "...setting architecture name to $archname." >&4
6088                ;;
6089        esac
6090	;;
6091esac
6092if $test -f archname.cbu; then
6093	echo "Your platform has some specific hints for architecture name, using them..."
6094	. ./archname.cbu
6095fi
6096
6097: set the prefixit variable, to compute a suitable default value
6098prefixit='case "$3" in
6099""|none)
6100	case "$oldprefix" in
6101	"") eval "$1=\"\$$2\"";;
6102	*)
6103		case "$3" in
6104		"") eval "$1=";;
6105		none)
6106			eval "tp=\"\$$2\"";
6107			case "$tp" in
6108			""|" ") eval "$1=\"\$$2\"";;
6109			*) eval "$1=";;
6110			esac;;
6111		esac;;
6112	esac;;
6113*)
6114	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6115	case "$tp" in
6116	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6117	/*-$oldprefix/*|\~*-$oldprefix/*)
6118		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6119	*) eval "$1=\"\$$2\"";;
6120	esac;;
6121esac'
6122
6123: determine installation style
6124: For now, try to deduce it from prefix unless it is already set.
6125: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6126case "$installstyle" in
6127'')	case "$prefix" in
6128		*perl*) dflt='lib';;
6129		*) dflt='lib/perl5' ;;
6130	esac
6131	;;
6132*)	dflt="$installstyle" ;;
6133esac
6134: Probably not worth prompting for this since we prompt for all
6135: the directories individually, and the prompt would be too long and
6136: confusing anyway.
6137installstyle=$dflt
6138
6139: determine where public executables go
6140echo " "
6141set dflt bin bin
6142eval $prefixit
6143fn=d~
6144rp='Pathname where the public executables will reside?'
6145. ./getfile
6146if $test "X$ansexp" != "X$binexp"; then
6147	installbin=''
6148fi
6149prefixvar=bin
6150: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6151: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6152:     this via initialinstalllocation
6153. ./setprefixvar
6154
6155case "$userelocatableinc" in
6156$define|true|[yY]*)	dflt='y' ;;
6157*)			dflt='n' ;;
6158esac
6159cat <<EOM
6160
6161Would you like to build Perl so that the installation is relocatable, so that
6162library paths in @INC are determined relative to the path of the perl binary?
6163This is not advised for system Perl installs, or if you need to run setid
6164scripts or scripts under taint mode.
6165
6166If this doesn't make any sense to you, just accept the default '$dflt'.
6167EOM
6168rp='Use relocatable @INC?'
6169. ./myread
6170case "$ans" in
6171y|Y)	val="$define" ;;
6172*)	val="$undef"  ;;
6173esac
6174set userelocatableinc
6175eval $setvar
6176
6177initialinstalllocation="$binexp"
6178: Default prefix is now "up one level from where the binaries are"
6179case "$userelocatableinc" in
6180$define|true|[yY]*)
6181    bin=".../"
6182    binexp=".../"
6183    prefix=".../.."
6184    prefixexp=".../.."
6185    installprefixexp=".../.."
6186    ;;
6187esac
6188
6189: determine where private library files go
6190: Usual default is /usr/local/lib/perl5/$version.
6191: Also allow things like /opt/perl/lib/$version, since
6192: /opt/perl/lib/perl5... would be redundant.
6193: The default "style" setting is made in installstyle.U
6194case "$installstyle" in
6195*lib/perl5*) set dflt privlib lib/$package/$version ;;
6196*)	 set dflt privlib lib/$version ;;
6197esac
6198eval $prefixit
6199$cat <<EOM
6200
6201There are some auxiliary files for $package that need to be put into a
6202private library directory that is accessible by everyone.
6203
6204EOM
6205fn=$binexp
6206fn=d~+
6207rp='Pathname where the private library files will reside?'
6208. ./getfile
6209prefixvar=privlib
6210. ./setprefixvar
6211
6212: set the prefixup variable, to restore leading tilda escape
6213prefixup='case "$prefixexp" in
6214"$prefix") ;;
6215*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6216esac'
6217
6218: determine where public architecture dependent libraries go
6219set archlib archlib
6220eval $prefixit
6221: privlib default is /usr/local/lib/$package/$version
6222: archlib default is /usr/local/lib/$package/$version/$archname
6223: privlib may have an optional trailing /share.
6224tdflt=`echo $privlib | $sed 's,/share$,,'`
6225tdflt=$tdflt/$archname
6226case "$archlib" in
6227'')	dflt=$tdflt
6228	;;
6229*)	dflt="$archlib"
6230    ;;
6231esac
6232$cat <<EOM
6233
6234$spackage contains architecture-dependent library files.  If you are
6235sharing libraries in a heterogeneous environment, you might store
6236these files in a separate location.  Otherwise, you can just include
6237them with the rest of the public library files.
6238
6239EOM
6240fn=$binexp
6241fn=d+~
6242rp='Where do you want to put the public architecture-dependent libraries?'
6243. ./getfile
6244prefixvar=archlib
6245. ./setprefixvar
6246if $test X"$archlib" = X"$privlib"; then
6247	d_archlib="$undef"
6248else
6249	d_archlib="$define"
6250fi
6251
6252: see if setuid scripts can be secure
6253$cat <<EOM
6254
6255Some kernels have a bug that prevents setuid #! scripts from being
6256secure.  Some sites have disabled setuid #! scripts because of this.
6257
6258First let's decide if your kernel supports secure setuid #! scripts.
6259(If setuid #! scripts would be secure but have been disabled anyway,
6260don't say that they are secure if asked.)
6261
6262EOM
6263
6264val="$undef"
6265if $test -d /dev/fd; then
6266	echo "#!$ls" >reflect
6267	chmod +x,u+s reflect
6268	./reflect >flect 2>&1
6269	if $contains "/dev/fd" flect >/dev/null; then
6270		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6271		val="$define"
6272	else
6273		$cat <<EOM
6274If you are not sure if they are secure, I can check but I'll need a
6275username and password different from the one you are using right now.
6276If you don't have such a username or don't want me to test, simply
6277enter 'none'.
6278
6279EOM
6280		rp='Other username to test security of setuid scripts with?'
6281		dflt='none'
6282		. ./myread
6283		case "$ans" in
6284		n|none)
6285			case "$d_suidsafe" in
6286			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6287				dflt=n;;
6288			"$undef")
6289				echo "Well, the $hint value is *not* secure." >&4
6290				dflt=n;;
6291			*)	echo "Well, the $hint value *is* secure." >&4
6292				dflt=y;;
6293			esac
6294			;;
6295		*)
6296			$rm -f reflect flect
6297			echo "#!$ls" >reflect
6298			chmod +x,u+s reflect
6299			echo >flect
6300			chmod a+w flect
6301			echo '"su" will (probably) prompt you for '"$ans's password."
6302			su $ans -c './reflect >flect'
6303			if $contains "/dev/fd" flect >/dev/null; then
6304				echo "Okay, it looks like setuid scripts are secure." >&4
6305				dflt=y
6306			else
6307				echo "I don't think setuid scripts are secure." >&4
6308				dflt=n
6309			fi
6310			;;
6311		esac
6312		rp='Does your kernel have *secure* setuid scripts?'
6313		. ./myread
6314		case "$ans" in
6315		[yY]*)	val="$define";;
6316		*)	val="$undef";;
6317		esac
6318	fi
6319else
6320	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6321	echo "(That's for file descriptors, not floppy disks.)"
6322	val="$undef"
6323fi
6324set d_suidsafe
6325eval $setvar
6326
6327$rm -f reflect flect
6328
6329: now see if they want to do setuid emulation
6330echo " "
6331val="$undef"
6332case "$d_suidsafe" in
6333"$define")
6334	val="$undef"
6335	echo "No need to emulate SUID scripts since they are secure here." >&4
6336	;;
6337*)
6338	$cat <<EOM
6339Some systems have disabled setuid scripts, especially systems where
6340setuid scripts cannot be secure.  On systems where setuid scripts have
6341been disabled, the setuid/setgid bits on scripts are currently
6342useless.  It is possible for $package to detect those bits and emulate
6343setuid/setgid in a secure fashion.  This emulation will only work if
6344setuid scripts have been disabled in your kernel.
6345
6346EOM
6347	case "$d_dosuid" in
6348	"$define") dflt=y ;;
6349	*) dflt=n ;;
6350	esac
6351	rp="Do you want to do setuid/setgid emulation?"
6352	. ./myread
6353	case "$ans" in
6354	[yY]*)	val="$define";;
6355	*)	val="$undef";;
6356	esac
6357	;;
6358esac
6359set d_dosuid
6360eval $setvar
6361
6362: Find perl5.005 or later.
6363echo "Looking for a previously installed perl5.005 or later... "
6364case "$perl5" in
6365'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6366		: Check if this perl is recent and can load a simple module
6367		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6368			perl5=$tdir/perl
6369			break;
6370		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371			perl5=$tdir/perl5
6372			break;
6373		fi
6374	done
6375	;;
6376*)	perl5="$perl5"
6377	;;
6378esac
6379case "$perl5" in
6380'')	echo "None found.  That's ok.";;
6381*)	echo "Using $perl5." ;;
6382esac
6383
6384$cat <<EOM
6385
6386After $package is installed, you may wish to install various
6387add-on modules and utilities.  Typically, these add-ons will
6388be installed under $prefix with the rest
6389of this package.  However, you may wish to install such add-ons
6390elsewhere under a different prefix.
6391
6392If you do not wish to put everything under a single prefix, that's
6393ok.  You will be prompted for the individual locations; this siteprefix
6394is only used to suggest the defaults.
6395
6396The default should be fine for most people.
6397
6398EOM
6399fn=d~+
6400rp='Installation prefix to use for add-on modules and utilities?'
6401: XXX Here might be another good place for an installstyle setting.
6402case "$siteprefix" in
6403'') dflt=$prefix ;;
6404*)  dflt=$siteprefix ;;
6405esac
6406. ./getfile
6407: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6408oldsiteprefix=''
6409case "$siteprefix" in
6410'') ;;
6411*)	case "$ans" in
6412	"$prefix") ;;
6413	*) oldsiteprefix="$prefix";;
6414	esac
6415	;;
6416esac
6417siteprefix="$ans"
6418siteprefixexp="$ansexp"
6419
6420: determine where site specific libraries go.
6421: Usual default is /usr/local/lib/perl5/site_perl/$version
6422: The default "style" setting is made in installstyle.U
6423: XXX No longer works with Prefixit stuff.
6424prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6425case "$sitelib" in
6426'') case "$installstyle" in
6427	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6428	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6429	esac
6430	;;
6431*)	dflt="$sitelib"
6432	;;
6433esac
6434$cat <<EOM
6435
6436The installation process will create a directory for
6437site-specific extensions and modules.  Most users find it convenient
6438to place all site-specific files in this directory rather than in the
6439main distribution directory.
6440
6441EOM
6442fn=d~+
6443rp='Pathname for the site-specific library files?'
6444. ./getfile
6445prefixvar=sitelib
6446. ./setprefixvar
6447sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6448
6449: Determine list of previous versions to include in @INC
6450$cat > getverlist <<EOPL
6451#!$perl5 -w
6452use File::Basename;
6453\$api_versionstring = "$api_versionstring";
6454\$version = "$version";
6455\$stem = "$sitelib_stem";
6456\$archname = "$archname";
6457EOPL
6458	$cat >> getverlist <<'EOPL'
6459# The list found is store twice for each entry: the original name, and
6460# the binary broken down version as pack "sss", so sorting is easy and
6461# unambiguous. This will work for all versions that have a maximum of
6462# three digit groups, separate by '.'s or '_'s. Names are extended with
6463# ".0.0" to ensure at least three elements for the pack.
6464#					-- H.Merijn Brand (m)'06 23-10-2006
6465
6466# Can't have leading @ because metaconfig interprets it as a command!
6467;@inc_version_list=();
6468# XXX Redo to do opendir/readdir?
6469if (-d $stem) {
6470    chdir($stem);
6471    ;@candidates = map {
6472	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6473}
6474else {
6475    ;@candidates = ();
6476}
6477
6478($pversion, $aversion, $vsn5005) = map {
6479    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6480foreach $d (@candidates) {
6481    if ($d->[1] lt $pversion) {
6482	if ($d->[1] ge $aversion) {
6483	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6484	}
6485	elsif ($d->[1] ge $vsn5005) {
6486	    unshift(@inc_version_list, grep { -d } $d->[0]);
6487	}
6488    }
6489    else {
6490	# Skip newer version.  I.e. don't look in
6491	# 5.7.0 if we're installing 5.6.1.
6492    }
6493}
6494
6495if (@inc_version_list) {
6496    print join(' ', @inc_version_list);
6497}
6498else {
6499    # Blank space to preserve value for next Configure run.
6500    print " ";
6501}
6502EOPL
6503chmod +x getverlist
6504case "$inc_version_list" in
6505'')	if test -x "$perl5$exe_ext"; then
6506		dflt=`$perl5 getverlist`
6507	else
6508		dflt='none'
6509	fi
6510	;;
6511$undef) dflt='none' ;;
6512*)  eval dflt=\"$inc_version_list\" ;;
6513esac
6514case "$dflt" in
6515''|' ') dflt=none ;;
6516esac
6517case "$dflt" in
65185.005) dflt=none ;;
6519esac
6520$cat <<EOM
6521
6522In order to ease the process of upgrading, this version of perl
6523can be configured to use modules built and installed with earlier
6524versions of perl that were installed under $prefix.  Specify here
6525the list of earlier versions that this version of perl should check.
6526If Configure detected no earlier versions of perl installed under
6527$prefix, then the list will be empty.  Answer 'none' to tell perl
6528to not search earlier versions.
6529
6530The default should almost always be sensible, so if you're not sure,
6531just accept the default.
6532EOM
6533
6534rp='List of earlier versions to include in @INC?'
6535. ./myread
6536case "$ans" in
6537[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6538*) inc_version_list="$ans" ;;
6539esac
6540case "$inc_version_list" in
6541''|' ')
6542	inc_version_list_init='0'
6543	d_inc_version_list="$undef"
6544	;;
6545*)	inc_version_list_init=`echo $inc_version_list |
6546		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6547	d_inc_version_list="$define"
6548	;;
6549esac
6550$rm -f getverlist
6551
6552: see if this is a malloc.h system
6553: we want a real compile instead of Inhdr because some systems have a
6554: malloc.h that just gives a compile error saying to use stdlib.h instead
6555echo " "
6556$cat >try.c <<EOCP
6557#include <stdlib.h>
6558#include <malloc.h>
6559int main () { return 0; }
6560EOCP
6561set try
6562if eval $compile; then
6563    echo "<malloc.h> found." >&4
6564    val="$define"
6565else
6566    echo "<malloc.h> NOT found." >&4
6567    val="$undef"
6568fi
6569$rm_try
6570set i_malloc
6571eval $setvar
6572
6573: check for void type
6574echo " "
6575echo "Checking to see how well your C compiler groks the void type..." >&4
6576case "$voidflags" in
6577'')
6578	$cat >try.c <<EOCP
6579#$i_stdlib I_STDLIB
6580#ifdef I_STDLIB
6581#include <stdlib.h>
6582#endif
6583#if TRY & 1
6584void sub() {
6585#else
6586sub() {
6587#endif
6588	extern void moo();	/* function returning void */
6589	void (*goo)();		/* ptr to func returning void */
6590#if TRY & 8
6591	void *hue;		/* generic ptr */
6592#endif
6593#if TRY & 2
6594	void (*foo[10])();
6595#endif
6596
6597#if TRY & 4
6598	if(goo == moo) {
6599		exit(0);
6600	}
6601#endif
6602	exit(0);
6603}
6604int main() { sub(); }
6605EOCP
6606	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6607		voidflags=$defvoidused
6608	echo "Good.  It appears to support void to the level $package wants.">&4
6609		if $contains warning .out >/dev/null 2>&1; then
6610			echo "However, you might get some warnings that look like this:"
6611			$cat .out
6612		fi
6613	else
6614echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6615		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6616			echo "It supports 1..."
6617			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6618				echo "It also supports 2..."
6619				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6620					voidflags=7
6621					echo "And it supports 4 but not 8 definitely."
6622				else
6623					echo "It doesn't support 4..."
6624					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6625						voidflags=11
6626						echo "But it supports 8."
6627					else
6628						voidflags=3
6629						echo "Neither does it support 8."
6630					fi
6631				fi
6632			else
6633				echo "It does not support 2..."
6634				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6635					voidflags=13
6636					echo "But it supports 4 and 8."
6637				else
6638					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6639						voidflags=5
6640						echo "And it supports 4 but has not heard about 8."
6641					else
6642						echo "However it supports 8 but not 4."
6643					fi
6644				fi
6645			fi
6646		else
6647			echo "There is no support at all for void."
6648			voidflags=0
6649		fi
6650	fi
6651esac
6652case "$voidflags" in
6653"$defvoidused") ;;
6654*)	$cat >&4 <<'EOM'
6655  Support flag bits are:
6656    1: basic void declarations.
6657    2: arrays of pointers to functions returning void.
6658    4: operations between pointers to and addresses of void functions.
6659    8: generic void pointers.
6660EOM
6661	dflt="$voidflags";
6662	rp="Your void support flags add up to what?"
6663	. ./myread
6664	voidflags="$ans"
6665	;;
6666esac
6667$rm_try
6668
6669: check for length of pointer
6670echo " "
6671case "$ptrsize" in
6672'')
6673	echo "Checking to see how big your pointers are..." >&4
6674	if test "$voidflags" -gt 7; then
6675		echo '#define VOID_PTR char *' > try.c
6676	else
6677		echo '#define VOID_PTR void *' > try.c
6678	fi
6679	$cat >>try.c <<EOCP
6680#include <stdio.h>
6681#$i_stdlib I_STDLIB
6682#ifdef I_STDLIB
6683#include <stdlib.h>
6684#endif
6685int main()
6686{
6687    printf("%d\n", (int)sizeof(VOID_PTR));
6688    exit(0);
6689}
6690EOCP
6691	set try
6692	if eval $compile_ok; then
6693		ptrsize=`$run ./try`
6694		echo "Your pointers are $ptrsize bytes long."
6695	else
6696		dflt='4'
6697		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6698		rp="What is the size of a pointer (in bytes)?"
6699		. ./myread
6700		ptrsize="$ans"
6701	fi
6702	;;
6703esac
6704$rm_try
6705case "$use64bitall" in
6706"$define"|true|[yY]*)
6707	case "$ptrsize" in
6708	4)	cat <<EOM >&4
6709
6710*** You have chosen a maximally 64-bit build,
6711*** but your pointers are only 4 bytes wide.
6712*** Please rerun Configure without -Duse64bitall.
6713EOM
6714		case "$d_quad" in
6715		define)
6716			cat <<EOM >&4
6717*** Since you have quads, you could possibly try with -Duse64bitint.
6718EOM
6719			;;
6720		esac
6721		cat <<EOM >&4
6722*** Cannot continue, aborting.
6723
6724EOM
6725
6726		exit 1
6727		;;
6728	esac
6729	;;
6730esac
6731
6732
6733: determine whether to use malloc wrapping
6734echo " "
6735case "$usemallocwrap" in
6736[yY]*|true|$define)	dflt='y' ;;
6737[nN]*|false|$undef)	dflt='n' ;;
6738*)	case "$usedevel" in
6739	[yY]*|true|$define)	dflt='y' ;;
6740	*) dflt='n' ;;
6741	esac
6742	;;
6743esac
6744rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6745. ./myread
6746usemallocwrap="$ans"
6747case "$ans" in
6748y*|true)
6749	usemallocwrap="$define" ;;
6750*)
6751	usemallocwrap="$undef" ;;
6752esac
6753
6754: determine which malloc to compile in
6755echo " "
6756case "$usemymalloc" in
6757[yY]*|true|$define)	dflt='y' ;;
6758[nN]*|false|$undef)	dflt='n' ;;
6759*)	case "$ptrsize" in
6760	4) dflt='y' ;;
6761	*) dflt='n' ;;
6762	esac
6763	;;
6764esac
6765rp="Do you wish to attempt to use the malloc that comes with $package?"
6766. ./myread
6767usemymalloc="$ans"
6768case "$ans" in
6769y*|true)
6770	usemymalloc='y'
6771	mallocsrc='malloc.c'
6772	mallocobj="malloc$_o"
6773	d_mymalloc="$define"
6774	case "$libs" in
6775	*-lmalloc*)
6776		: Remove malloc from list of libraries to use
6777		echo "Removing unneeded -lmalloc from library list" >&4
6778		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6779		shift
6780		libs="$*"
6781		echo "libs = $libs" >&4
6782		;;
6783	esac
6784	;;
6785*)
6786	usemymalloc='n'
6787	mallocsrc=''
6788	mallocobj=''
6789	d_mymalloc="$undef"
6790	;;
6791esac
6792
6793: compute the return types of malloc and free
6794echo " "
6795$cat >malloc.c <<END
6796#$i_malloc I_MALLOC
6797#$i_stdlib I_STDLIB
6798#include <stdio.h>
6799#include <sys/types.h>
6800#ifdef I_MALLOC
6801#include <malloc.h>
6802#endif
6803#ifdef I_STDLIB
6804#include <stdlib.h>
6805#endif
6806#ifdef TRY_MALLOC
6807void *malloc();
6808#endif
6809#ifdef TRY_FREE
6810void free();
6811#endif
6812END
6813case "$malloctype" in
6814'')
6815	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6816		malloctype='void *'
6817	else
6818		malloctype='char *'
6819	fi
6820	;;
6821esac
6822echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6823
6824case "$freetype" in
6825'')
6826	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6827		freetype='void'
6828	else
6829		freetype='int'
6830	fi
6831	;;
6832esac
6833echo "Your system uses $freetype free(), it would seem." >&4
6834$rm -f malloc.[co]
6835: determine where site specific architecture-dependent libraries go.
6836: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6837: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6838: sitelib may have an optional trailing /share.
6839case "$sitearch" in
6840'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6841	dflt="$dflt/$archname"
6842	;;
6843*)	dflt="$sitearch"
6844	;;
6845esac
6846set sitearch sitearch none
6847eval $prefixit
6848$cat <<EOM
6849
6850The installation process will also create a directory for
6851architecture-dependent site-specific extensions and modules.
6852
6853EOM
6854fn=d~+
6855rp='Pathname for the site-specific architecture-dependent library files?'
6856. ./getfile
6857prefixvar=sitearch
6858. ./setprefixvar
6859if $test X"$sitearch" = X"$sitelib"; then
6860	d_sitearch="$undef"
6861else
6862	d_sitearch="$define"
6863fi
6864
6865$cat <<EOM
6866
6867The installation process will also create a directory for
6868vendor-supplied add-ons.  Vendors who supply perl with their system
6869may find it convenient to place all vendor-supplied files in this
6870directory rather than in the main distribution directory.  This will
6871ease upgrades between binary-compatible maintenance versions of perl.
6872
6873Of course you may also use these directories in whatever way you see
6874fit.  For example, you might use them to access modules shared over a
6875company-wide network.
6876
6877The default answer should be fine for most people.
6878This causes further questions about vendor add-ons to be skipped
6879and no vendor-specific directories will be configured for perl.
6880
6881EOM
6882rp='Do you want to configure vendor-specific add-on directories?'
6883case "$usevendorprefix" in
6884define|true|[yY]*) dflt=y ;;
6885*)	: User may have set vendorprefix directly on Configure command line.
6886	case "$vendorprefix" in
6887	''|' ') dflt=n ;;
6888	*)	dflt=y ;;
6889	esac
6890	;;
6891esac
6892. ./myread
6893case "$ans" in
6894[yY]*)	fn=d~+
6895	rp='Installation prefix to use for vendor-supplied add-ons?'
6896	case "$vendorprefix" in
6897	'') dflt='' ;;
6898	*)  dflt=$vendorprefix ;;
6899	esac
6900	. ./getfile
6901	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6902	oldvendorprefix=''
6903	case "$vendorprefix" in
6904	'') ;;
6905	*)	case "$ans" in
6906		"$prefix") ;;
6907		*) oldvendorprefix="$prefix";;
6908		esac
6909		;;
6910	esac
6911	usevendorprefix="$define"
6912	vendorprefix="$ans"
6913	vendorprefixexp="$ansexp"
6914	;;
6915*)	usevendorprefix="$undef"
6916	vendorprefix=''
6917	vendorprefixexp=''
6918	;;
6919esac
6920
6921case "$vendorprefix" in
6922'')	d_vendorlib="$undef"
6923	vendorlib=''
6924	vendorlibexp=''
6925	;;
6926*)	d_vendorlib="$define"
6927	: determine where vendor-supplied modules go.
6928	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
6929	case "$vendorlib" in
6930	'')
6931		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6932		case "$installstyle" in
6933		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6934		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6935		esac
6936		;;
6937	*)	dflt="$vendorlib"
6938		;;
6939	esac
6940	fn=d~+
6941	rp='Pathname for the vendor-supplied library files?'
6942	. ./getfile
6943	vendorlib="$ans"
6944	vendorlibexp="$ansexp"
6945	;;
6946esac
6947vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6948prefixvar=vendorlib
6949. ./installprefix
6950
6951case "$vendorprefix" in
6952'')	d_vendorarch="$undef"
6953	vendorarch=''
6954	vendorarchexp=''
6955	;;
6956*)	d_vendorarch="$define"
6957	: determine where vendor-supplied architecture-dependent libraries go.
6958	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6959	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6960	: vendorlib may have an optional trailing /share.
6961	case "$vendorarch" in
6962	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
6963		dflt="$dflt/$archname"
6964		;;
6965	*)	dflt="$vendorarch" ;;
6966	esac
6967	fn=d~+
6968	rp='Pathname for vendor-supplied architecture-dependent files?'
6969	. ./getfile
6970	vendorarch="$ans"
6971	vendorarchexp="$ansexp"
6972	;;
6973esac
6974prefixvar=vendorarch
6975. ./installprefix
6976
6977: Final catch-all directories to search
6978$cat <<EOM
6979
6980Lastly, you can have perl look in other directories for extensions and
6981modules in addition to those already specified.
6982These directories will be searched after 
6983	$sitearch 
6984	$sitelib 
6985EOM
6986test X"$vendorlib" != "X" && echo '	' $vendorlib
6987test X"$vendorarch" != "X" && echo '	' $vendorarch
6988echo ' '
6989case "$otherlibdirs" in
6990''|' ') dflt='none' ;;
6991*)	dflt="$otherlibdirs" ;;
6992esac
6993$cat <<EOM
6994Enter a colon-separated set of extra paths to include in perl's @INC
6995search path, or enter 'none' for no extra paths.
6996
6997EOM
6998
6999rp='Colon-separated list of additional directories for perl to search?'
7000. ./myread
7001case "$ans" in
7002' '|''|none)	otherlibdirs=' ' ;;
7003*)	otherlibdirs="$ans" ;;
7004esac
7005case "$otherlibdirs" in
7006' ') val=$undef ;;
7007*)	val=$define ;;
7008esac
7009set d_perl_otherlibdirs
7010eval $setvar
7011
7012: Cruising for prototypes
7013echo " "
7014echo "Checking out function prototypes..." >&4
7015$cat >prototype.c <<EOCP
7016#$i_stdlib I_STDLIB
7017#ifdef I_STDLIB
7018#include <stdlib.h>
7019#endif
7020int main(int argc, char *argv[]) {
7021	exit(0);}
7022EOCP
7023if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7024	echo "Your C compiler appears to support function prototypes."
7025	val="$define"
7026else
7027	echo "Your C compiler doesn't seem to understand function prototypes."
7028	val="$undef"
7029fi
7030set prototype
7031eval $setvar
7032$rm -f prototype*
7033
7034case "$prototype" in
7035"$define") ;;
7036*)	ansi2knr='ansi2knr'
7037	echo " "
7038	cat <<EOM >&4
7039
7040$me:  FATAL ERROR:
7041This version of $package can only be compiled by a compiler that 
7042understands function prototypes.  Unfortunately, your C compiler 
7043	$cc $ccflags
7044doesn't seem to understand them.  Sorry about that.
7045
7046If GNU cc is available for your system, perhaps you could try that instead.  
7047
7048Eventually, we hope to support building Perl with pre-ANSI compilers.
7049If you would like to help in that effort, please contact <perlbug@perl.org>.
7050
7051Aborting Configure now.
7052EOM
7053	exit 2
7054	;;
7055esac
7056
7057echo " "
7058case "$extras" in
7059'') dflt='n';;
7060*) dflt='y';;
7061esac
7062cat <<EOM
7063Perl can be built with extra modules or bundles of modules which
7064will be fetched from the CPAN and installed alongside Perl.
7065
7066Notice that you will need access to the CPAN; either via the Internet,
7067or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7068be asked later to configure the CPAN.pm module which will in turn do
7069the installation of the rest of the extra modules or bundles.)
7070
7071Notice also that if the modules require any external software such as
7072libraries and headers (the libz library and the zlib.h header for the
7073Compress::Zlib module, for example) you MUST have any such software
7074already installed, this configuration process will NOT install such
7075things for you.
7076
7077If this doesn't make any sense to you, just accept the default '$dflt'.
7078EOM
7079rp='Install any extra modules (y or n)?'
7080. ./myread
7081case "$ans" in
7082y|Y)
7083	cat <<EOM
7084
7085Please list any extra modules or bundles to be installed from CPAN,
7086with spaces between the names.  The names can be in any format the
7087'install' command of CPAN.pm will understand.  (Answer 'none',
7088without the quotes, to install no extra modules or bundles.)
7089EOM
7090	rp='Extras?'
7091	dflt="$extras"
7092	. ./myread
7093	extras="$ans"
7094esac
7095case "$extras" in
7096''|'none')
7097	val=''
7098	$rm -f ../extras.lst
7099	;;
7100*)	echo "(Saving the list of extras for later...)"
7101	echo "$extras" > ../extras.lst
7102	val="'$extras'"
7103	;;
7104esac
7105set extras
7106eval $setvar
7107echo " "
7108
7109: determine where html pages for programs go
7110set html1dir html1dir none
7111eval $prefixit
7112$cat <<EOM
7113
7114If you wish to install html files for programs in $spackage, indicate
7115the appropriate directory here.  To skip installing html files,
7116answer "none".
7117EOM
7118case "$html1dir" in
7119''|none|$undef|' ') dflt=none ;;
7120*) dflt=$html1dir ;;
7121esac
7122fn=dn+~
7123rp="Directory for the main $spackage html pages?"
7124. ./getfile
7125prefixvar=html1dir
7126. ./setprefixvar
7127: Use ' ' for none so value is preserved next time through Configure
7128$test X"$html1dir" = "X" && html1dir=' '
7129
7130: determine where html pages for libraries and modules go
7131set html3dir html3dir none
7132eval $prefixit
7133$cat <<EOM
7134
7135If you wish to install html files for modules associated with $spackage,
7136indicate the appropriate directory here.  To skip installing html files,
7137answer "none".
7138EOM
7139: There is no obvious default.  If they have specified html1dir, then
7140: try to key off that, possibly changing .../html1 into .../html3.
7141case "$html3dir" in
7142'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7143*) dflt=$html3dir ;;
7144esac
7145fn=dn+~
7146rp="Directory for the $spackage module html pages?"
7147. ./getfile
7148prefixvar=html3dir
7149. ./setprefixvar
7150: Use ' ' for none so value is preserved next time through Configure
7151$test X"$html3dir" = "X" && html3dir=' '
7152
7153: determine whether to install perl also as /usr/bin/perl
7154
7155echo " "
7156if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7157	$cat <<EOM
7158Many scripts expect perl to be installed as /usr/bin/perl.
7159
7160If you want to, I can install the perl you are about to compile
7161as /usr/bin/perl (in addition to $bin/perl).
7162EOM
7163	if test -f /usr/bin/perl; then
7164	    $cat <<EOM
7165
7166However, please note that because you already have a /usr/bin/perl,
7167overwriting that with a new Perl would very probably cause problems.
7168Therefore I'm assuming you don't want to do that (unless you insist).
7169
7170EOM
7171	    case "$installusrbinperl" in
7172	    "$define"|[yY]*)	dflt='y';;
7173	    *)			dflt='n';;
7174	    esac
7175	else
7176	    $cat <<EOM
7177
7178Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7179
7180EOM
7181	    case "$installusrbinperl" in
7182	    "$undef"|[nN]*)	dflt='n';;
7183	    *)			dflt='y';;
7184	    esac
7185	fi
7186	rp="Do you want to install perl as /usr/bin/perl?"
7187	. ./myread
7188	case "$ans" in
7189	[yY]*)	val="$define";;
7190	*)	val="$undef" ;;
7191	esac
7192else
7193	val="$undef"
7194fi
7195set installusrbinperl
7196eval $setvar
7197
7198echo " "
7199echo "Checking for GNU C Library..." >&4
7200cat >try.c <<'EOCP'
7201/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7202   alone are insufficient to distinguish different versions, such as
7203   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7204   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7205*/
7206#include <stdio.h>
7207int main(void)
7208{
7209#ifdef __GLIBC__
7210#   ifdef __GLIBC_MINOR__
7211#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7212#           include <gnu/libc-version.h>
7213	    printf("%s\n",  gnu_get_libc_version());
7214#       else
7215	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7216#       endif
7217#   else
7218	printf("%d\n",  __GLIBC__);
7219#   endif
7220    return 0;
7221#else
7222    return 1;
7223#endif
7224}
7225EOCP
7226set try
7227if eval $compile_ok && $run ./try > glibc.ver; then
7228	val="$define"
7229	gnulibc_version=`$cat glibc.ver`
7230	echo "You are using the GNU C Library version $gnulibc_version"
7231else
7232	val="$undef"
7233	gnulibc_version=''
7234	echo "You are not using the GNU C Library"
7235fi
7236$rm_try glibc.ver
7237set d_gnulibc
7238eval $setvar
7239
7240: see if nm is to be used to determine whether a symbol is defined or not
7241case "$usenm" in
7242'')
7243	dflt=''
7244	case "$d_gnulibc" in
7245	"$define")
7246		echo " "
7247		echo "nm probably won't work on the GNU C Library." >&4
7248		dflt=n
7249		;;
7250	esac
7251	case "$dflt" in
7252	'')
7253		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7254			echo " "
7255			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7256			echo "'nm' won't be sufficient on this sytem." >&4
7257			dflt=n
7258		fi
7259		;;
7260	esac
7261	case "$dflt" in
7262	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7263		if $test $dflt -gt 20; then
7264			dflt=y
7265		else
7266			dflt=n
7267		fi
7268		;;
7269	esac
7270	;;
7271*)
7272	case "$usenm" in
7273	true|$define) dflt=y;;
7274	*) dflt=n;;
7275	esac
7276	;;
7277esac
7278$cat <<EOM
7279
7280I can use $nm to extract the symbols from your C libraries. This
7281is a time consuming task which may generate huge output on the disk (up
7282to 3 megabytes) but that should make the symbols extraction faster. The
7283alternative is to skip the 'nm' extraction part and to compile a small
7284test program instead to determine whether each symbol is present. If
7285you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7286this may be the best solution.
7287
7288You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7289
7290EOM
7291rp="Shall I use $nm to extract C symbols from the libraries?"
7292. ./myread
7293case "$ans" in
7294[Nn]*) usenm=false;;
7295*) usenm=true;;
7296esac
7297
7298runnm=$usenm
7299case "$reuseval" in
7300true) runnm=false;;
7301esac
7302
7303: nm options which may be necessary
7304case "$nm_opt" in
7305'') if $test -f /mach_boot; then
7306		nm_opt=''	# Mach
7307	elif $test -d /usr/ccs/lib; then
7308		nm_opt='-p'	# Solaris (and SunOS?)
7309	elif $test -f /dgux; then
7310		nm_opt='-p'	# DG-UX
7311	elif $test -f /lib64/rld; then
7312		nm_opt='-p'	# 64-bit Irix
7313	else
7314		nm_opt=''
7315	fi;;
7316esac
7317
7318: nm options which may be necessary for shared libraries but illegal
7319: for archive libraries.  Thank you, Linux.
7320case "$nm_so_opt" in
7321'')	case "$myuname" in
7322	*linux*|gnu*)
7323		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7324			nm_so_opt='--dynamic'
7325		fi
7326		;;
7327	esac
7328	;;
7329esac
7330
7331case "$runnm" in
7332true)
7333: get list of predefined functions in a handy place
7334echo " "
7335case "$libc" in
7336'') libc=unknown
7337	case "$libs" in
7338	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7339	esac
7340	;;
7341esac
7342case "$libs" in
7343'') ;;
7344*)  for thislib in $libs; do
7345	case "$thislib" in
7346	-lc|-lc_s)
7347		: Handle C library specially below.
7348		;;
7349	-l*)
7350		thislib=`echo $thislib | $sed -e 's/^-l//'`
7351		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7352			:
7353		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7354			:
7355		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7356			:
7357		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7358			:
7359		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7360			:
7361		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7362			:
7363		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7364			:
7365		else
7366			try=''
7367		fi
7368		libnames="$libnames $try"
7369		;;
7370	*) libnames="$libnames $thislib" ;;
7371	esac
7372	done
7373	;;
7374esac
7375xxx=normal
7376case "$libc" in
7377unknown)
7378	set /lib/libc.$so
7379	for xxx in $libpth; do
7380		$test -r $1 || set $xxx/libc.$so
7381		: The messy sed command sorts on library version numbers.
7382		$test -r $1 || \
7383			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7384			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7385				h
7386				s/[0-9][0-9]*/0000&/g
7387				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7388				G
7389				s/\n/ /' | \
7390			 $sort | $sed -e 's/^.* //'`
7391		eval set \$$#
7392	done
7393	$test -r $1 || set /usr/ccs/lib/libc.$so
7394	$test -r $1 || set /lib/libsys_s$_a
7395	;;
7396*)
7397	set blurfl
7398	;;
7399esac
7400if $test -r "$1"; then
7401	echo "Your (shared) C library seems to be in $1."
7402	libc="$1"
7403elif $test -r /lib/libc && $test -r /lib/clib; then
7404	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7405	xxx=apollo
7406	libc='/lib/clib /lib/libc'
7407	if $test -r /lib/syslib; then
7408		echo "(Your math library is in /lib/syslib.)"
7409		libc="$libc /lib/syslib"
7410	fi
7411elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7412	echo "Your C library seems to be in $libc, as you said before."
7413elif $test -r $incpath/usr/lib/libc$_a; then
7414	libc=$incpath/usr/lib/libc$_a;
7415	echo "Your C library seems to be in $libc.  That's fine."
7416elif $test -r /lib/libc$_a; then
7417	libc=/lib/libc$_a;
7418	echo "Your C library seems to be in $libc.  You're normal."
7419else
7420	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7421		:
7422	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7423		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7424	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7425		:
7426	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7427		:
7428	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7429		:
7430	else
7431		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7432	fi
7433	if $test -r "$tans"; then
7434		echo "Your C library seems to be in $tans, of all places."
7435		libc=$tans
7436	else
7437		libc='blurfl'
7438	fi
7439fi
7440if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7441	dflt="$libc"
7442	cat <<EOM
7443
7444If the guess above is wrong (which it might be if you're using a strange
7445compiler, or your machine supports multiple models), you can override it here.
7446
7447EOM
7448else
7449	dflt=''
7450	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7451	cat >&4 <<EOM
7452I can't seem to find your C library.  I've looked in the following places:
7453
7454EOM
7455	$sed 's/^/	/' libpath
7456	cat <<EOM
7457
7458None of these seems to contain your C library. I need to get its name...
7459
7460EOM
7461fi
7462fn=f
7463rp='Where is your C library?'
7464. ./getfile
7465libc="$ans"
7466
7467echo " "
7468echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7469set X `cat libnames`
7470shift
7471xxx=files
7472case $# in 1) xxx=file; esac
7473echo "Extracting names from the following $xxx for later perusal:" >&4
7474echo " "
7475$sed 's/^/	/' libnames >&4
7476echo " "
7477$echo $n "This may take a while...$c" >&4
7478
7479for file in $*; do
7480	case $file in
7481	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7482	*) $nm $nm_opt $file 2>/dev/null;;
7483	esac
7484done >libc.tmp
7485
7486$echo $n ".$c"
7487$grep fprintf libc.tmp > libc.ptf
7488xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7489xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7490xxx='[ADTSIW]'
7491if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7492	eval $xscan;\
7493	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7494		eval $xrun
7495elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7496	eval $xscan;\
7497	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7498		eval $xrun
7499elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7500	eval $xscan;\
7501	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7502		eval $xrun
7503elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7504	eval $xscan;\
7505	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7506		eval $xrun
7507elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7508	eval $xscan;\
7509	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7510		eval $xrun
7511elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7512	eval $xscan;\
7513	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7514		eval $xrun
7515elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7516				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7517	eval $xscan;\
7518	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7519		eval $xrun
7520elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7521	eval $xscan;\
7522	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7523		eval $xrun
7524elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7525	eval $xscan;\
7526	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7527		eval $xrun
7528elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7529	eval $xscan;\
7530	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7531		eval $xrun
7532elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7533	eval $xscan;\
7534	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7535		eval $xrun
7536elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7537	eval $xscan;\
7538	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7539		eval $xrun
7540elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7541	eval $xscan;\
7542	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7543		eval $xrun
7544elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7545	eval $xscan;\
7546	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7547		eval $xrun
7548else
7549	$nm -p $* 2>/dev/null >libc.tmp
7550	$grep fprintf libc.tmp > libc.ptf
7551	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7552		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7553	then
7554		nm_opt='-p'
7555		eval $xrun
7556	else
7557		echo " "
7558		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7559		com=''
7560		if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7561			for thisname in $libnames $libc; do
7562				$ar t $thisname >>libc.tmp
7563			done
7564			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7565			echo "Ok." >&4
7566		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7567			# Repeat libc to extract forwarders to DLL entries too
7568			for thisname in $libnames $libc; do
7569				$ar tv $thisname >>libc.tmp
7570				# Revision 50 of EMX has bug in $ar.
7571				# it will not extract forwarders to DLL entries
7572				# Use emximp which will extract exactly them.
7573				emximp -o tmp.imp $thisname \
7574				    2>/dev/null && \
7575				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7576				    < tmp.imp >>libc.tmp
7577				$rm tmp.imp
7578			done
7579			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7580			echo "Ok." >&4
7581		else
7582			echo "$ar didn't seem to work right." >&4
7583			echo "Maybe this is a Cray...trying bld instead..." >&4
7584			if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7585			then
7586				for thisname in $libnames; do
7587					bld t $libnames | \
7588					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7589					$ar t $thisname >>libc.tmp
7590				done
7591				echo "Ok." >&4
7592			else
7593				echo "That didn't work either.  Giving up." >&4
7594				exit 1
7595			fi
7596		fi
7597	fi
7598fi
7599nm_extract="$com"
7600case "$PASE" in
7601define)
7602    echo " "
7603    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7604    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7605    ;;
7606*)  if $test -f /lib/syscalls.exp; then
7607	echo " "
7608	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7609	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' /lib/syscalls.exp >>libc.list
7610    fi
7611    ;;
7612esac
7613;;
7614esac
7615$rm -f libnames libpath
7616
7617: see if dld is available
7618set dld.h i_dld
7619eval $inhdr
7620
7621
7622echo " "
7623echo "Checking for C++..." >&4
7624$cat >try.c <<'EOCP'
7625#include <stdio.h>
7626int main(void)
7627{
7628#ifdef __cplusplus
7629    return 0;
7630#else
7631    return 1;
7632#endif
7633}
7634EOCP
7635set try
7636if eval $compile_ok && $run ./try; then
7637	val="$define"
7638	echo "You are using a C++ compiler."
7639else
7640	val="$undef"
7641	echo "You are not using a C++ compiler."
7642fi
7643$rm_try cplusplus$$
7644set d_cplusplus
7645eval $setvar
7646
7647: is a C symbol defined?
7648csym='tlook=$1;
7649case "$3" in
7650-v) tf=libc.tmp; tdc="";;
7651-a) tf=libc.tmp; tdc="[]";;
7652*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7653esac;
7654tx=yes;
7655case "$reuseval-$4" in
7656true-) ;;
7657true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7658esac;
7659case "$tx" in
7660yes)
7661	tval=false;
7662	case "$d_cplusplus" in
7663		$define) extern_C=\"C\";;
7664	esac;
7665	if $test "$runnm" = true; then
7666		if $contains $tlook $tf >/dev/null 2>&1; then
7667			tval=true;
7668		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7669			echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7670			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7671			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7672			$rm_try;
7673		fi;
7674	else
7675		echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7676		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7677		$rm_try;
7678	fi;
7679	;;
7680*)
7681	case "$tval" in
7682	$define) tval=true;;
7683	*) tval=false;;
7684	esac;
7685	;;
7686esac;
7687eval "$2=$tval"'
7688
7689: define an is-in-libc? function
7690inlibc='echo " "; td=$define; tu=$undef;
7691sym=$1; var=$2; eval "was=\$$2";
7692tx=yes;
7693case "$reuseval$was" in
7694true) ;;
7695true*) tx=no;;
7696esac;
7697case "$tx" in
7698yes)
7699	set $sym tres -f;
7700	eval $csym;
7701	case "$tres" in
7702	true)
7703		echo "$sym() found." >&4;
7704		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7705	*)
7706		echo "$sym() NOT found." >&4;
7707		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7708	esac;;
7709*)
7710	case "$was" in
7711	$define) echo "$sym() found." >&4;;
7712	*) echo "$sym() NOT found." >&4;;
7713	esac;;
7714esac'
7715
7716: see if dlopen exists
7717xxx_runnm="$runnm"
7718xxx_ccflags="$ccflags"
7719runnm=false
7720: with g++ one needs -shared to get is-in-libc to work for dlopen
7721case "$gccversion" in
7722'')	;;
7723*)	case "$d_cplusplus" in
7724	"$define") ccflags="$ccflags -shared" ;;
7725	esac
7726	;;
7727esac
7728set dlopen d_dlopen
7729eval $inlibc
7730runnm="$xxx_runnm"
7731ccflags="$xxx_ccflags"
7732
7733: see if this is a unistd.h system
7734set unistd.h i_unistd
7735eval $inhdr
7736
7737: determine which dynamic loading, if any, to compile in
7738echo " "
7739dldir="ext/DynaLoader"
7740case "$usedl" in
7741$define|y|true)
7742	dflt='y'
7743	usedl="$define"
7744	;;
7745$undef|n|false)
7746	dflt='n'
7747	usedl="$undef"
7748	;;
7749*)
7750	dflt='n'
7751	case "$d_dlopen" in
7752	    $define) dflt='y' ;;
7753	esac
7754	case "$i_dld" in
7755	    $define) dflt='y' ;;
7756	esac
7757	: Does a dl_xxx.xs file exist for this operating system
7758	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7759	;;
7760esac
7761rp="Do you wish to use dynamic loading?"
7762. ./myread
7763usedl="$ans"
7764case "$ans" in
7765y*) usedl="$define"
7766	case "$dlsrc" in
7767	'')
7768		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7769			dflt="$dldir/dl_${osname}.xs"
7770		elif $test "$d_dlopen" = "$define" ; then
7771			dflt="$dldir/dl_dlopen.xs"
7772		elif $test "$i_dld" = "$define" ; then
7773			dflt="$dldir/dl_dld.xs"
7774		else
7775			dflt=''
7776		fi
7777		;;
7778	*)	dflt="$dldir/$dlsrc"
7779		;;
7780	esac
7781    echo "The following dynamic loading files are available:"
7782	: Can not go over to $dldir because getfile has path hard-coded in.
7783	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7784	rp="Source file to use for dynamic loading"
7785	fn="fne"
7786	gfpth="$src"
7787	. ./getfile
7788	usedl="$define"
7789	: emulate basename
7790	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7791
7792	$cat << EOM
7793
7794Some systems may require passing special flags to $cc -c to
7795compile modules that will be used to create a shared library.
7796To use no flags, say "none".
7797
7798EOM
7799    case "$cccdlflags" in
7800    '')	case "$gccversion" in
7801		'') case "$osname" in
7802			hpux)	dflt='+z' ;;
7803			next)	dflt='none' ;;
7804			irix*)	dflt='-KPIC' ;;
7805			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7806			sunos)	dflt='-pic' ;;
7807			*)	dflt='none' ;;
7808		    esac
7809			;;
7810		*)  case "$osname" in
7811	                darwin) dflt='none' ;;
7812			linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7813			*)	dflt='-fpic' ;;
7814		    esac ;;
7815	    esac ;;
7816	' ') dflt='none' ;;
7817    *)	dflt="$cccdlflags" ;;
7818    esac
7819    rp="Any special flags to pass to $cc -c to compile shared library modules?"
7820    . ./myread
7821    case "$ans" in
7822    none) cccdlflags=' ' ;;
7823    *) cccdlflags="$ans" ;;
7824    esac
7825
7826    cat << EOM
7827
7828Some systems use ld to create libraries that can be dynamically loaded,
7829while other systems (such as those using ELF) use $cc.
7830
7831EOM
7832	case "$ld" in
7833	'')	$cat >try.c <<EOM
7834/* Test for whether ELF binaries are produced */
7835#include <fcntl.h>
7836#$i_stdlib I_STDLIB
7837#ifdef I_STDLIB
7838#include <stdlib.h>
7839#endif
7840#$i_unistd I_UNISTD
7841#ifdef I_UNISTD
7842#include <unistd.h>
7843#endif
7844int main() {
7845	char b[4];
7846	int i = open("a.out",O_RDONLY);
7847	if(i == -1)
7848		exit(1); /* fail */
7849	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7850		exit(0); /* succeed (yes, it's ELF) */
7851	else
7852		exit(1); /* fail */
7853}
7854EOM
7855		if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7856			cat <<EOM
7857You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7858EOM
7859			dflt="$cc"
7860		else
7861			echo "I'll use ld to build dynamic libraries."
7862			dflt='ld'
7863		fi
7864		$rm_try
7865		;;
7866	*)	dflt="$ld"
7867		;;
7868	esac
7869
7870    rp="What command should be used to create dynamic libraries?"
7871    . ./myread
7872	ld="$ans"
7873
7874    cat << EOM
7875
7876Some systems may require passing special flags to $ld to create a
7877library that can be dynamically loaded.  If your ld flags include
7878-L/other/path options to locate libraries outside your loader's normal
7879search path, you may need to specify those -L options here as well.  To
7880use no flags, say "none".
7881
7882EOM
7883    case "$lddlflags" in
7884    '') case "$osname" in
7885  			beos) dflt='-nostart' ;;
7886			hpux) dflt='-b';
7887			      case "$gccversion" in
7888			      '') dflt="$dflt +vnocompatwarnings" ;;
7889			      esac
7890			      ;;
7891			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7892			next)  dflt='none' ;;
7893			solaris) dflt='-G' ;;
7894			sunos) dflt='-assert nodefinitions' ;;
7895			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7896	        *)     dflt='none' ;;
7897			esac
7898			;;
7899    *) dflt="$lddlflags" ;;
7900    esac
7901
7902	: Try to guess additional flags to pick up local libraries.
7903	: Be careful not to append to a plain 'none'
7904	case "$dflt" in
7905	none) dflt='' ;;
7906	esac
7907	for thisflag in $ldflags; do
7908		case "$thisflag" in
7909		-L*|-R*|-Wl,-R*)
7910			case " $dflt " in
7911			*" $thisflag "*) ;;
7912			*) dflt="$dflt $thisflag" ;;
7913			esac
7914			;;
7915		esac
7916	done
7917
7918	case "$dflt" in
7919	''|' ') dflt='none' ;;
7920	esac
7921
7922    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7923    . ./myread
7924    case "$ans" in
7925    none) lddlflags=' ' ;;
7926    *) lddlflags="$ans" ;;
7927    esac
7928
7929	cat <<EOM
7930
7931Some systems may require passing special flags to $cc to indicate that
7932the resulting executable will use dynamic linking.  To use no flags,
7933say "none".
7934
7935EOM
7936    case "$ccdlflags" in
7937    '') case "$osname" in
7938	    linux|hpux|gnu*)	dflt='-Wl,-E' ;;
7939	    next|sunos)	dflt='none' ;;
7940	    *)		dflt='none' ;;
7941	    esac ;;
7942    ' ')  dflt='none' ;;
7943    *)  dflt="$ccdlflags" ;;
7944    esac
7945    rp="Any special flags to pass to $cc to use dynamic linking?"
7946    . ./myread
7947    case "$ans" in
7948    none) ccdlflags=' ' ;;
7949    *) ccdlflags="$ans" ;;
7950    esac
7951    ;;
7952*)  usedl="$undef"
7953	ld='ld'
7954    dlsrc='dl_none.xs'
7955    lddlflags=''
7956    ccdlflags=''
7957    ;;
7958esac
7959
7960also=''
7961case "$usedl" in
7962$undef)
7963	# No dynamic loading being used, so don't bother even to prompt.
7964	useshrplib='false'
7965	;;
7966*)	case "$useshrplib" in
7967	'')	case "$osname" in
7968		svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7969			dflt=y
7970			also='Building a shared libperl is required for dynamic loading to work on your system.'
7971			;;
7972		next*)
7973			case "$osvers" in
7974			4*)	dflt=y
7975				also='Building a shared libperl is needed for MAB support.'
7976				;;
7977			*)	dflt=n
7978				;;
7979			esac
7980			;;
7981		*)	dflt=n
7982			;;
7983		esac
7984		;;
7985	$define|true|[Yy]*)
7986		dflt=y
7987		;;
7988	*)	dflt=n
7989		;;
7990	esac
7991	$cat << EOM
7992
7993The perl executable is normally obtained by linking perlmain.c with
7994libperl${_a}, any static extensions (usually just DynaLoader), and
7995any other libraries needed on this system (such as -lm, etc.).  Since
7996your system supports dynamic loading, it is probably possible to build
7997a shared libperl.$so.  If you will have more than one executable linked
7998to libperl.$so, this will significantly reduce the size of each
7999executable, but it may have a noticeable effect on performance.  The
8000default is probably sensible for your system.
8001$also
8002
8003EOM
8004	rp="Build a shared libperl.$so (y/n)"
8005	. ./myread
8006	case "$ans" in
8007	true|$define|[Yy]*)
8008		useshrplib='true'  ;;
8009	*)	useshrplib='false' ;;
8010	esac
8011	;;
8012esac
8013
8014case "$useshrplib" in
8015true)
8016	case "$libperl" in
8017	'')
8018		# Figure out a good name for libperl.so.  Since it gets stored in
8019		# a version-specific architecture-dependent library, the version
8020		# number isn't really that important, except for making cc/ld happy.
8021		#
8022		# A name such as libperl.so.3.1
8023		majmin="libperl.$so.$patchlevel.$subversion"
8024		# A name such as libperl.so.301
8025		majonly=`echo $patchlevel $subversion |
8026			$awk '{printf "%d%02d", $1, $2}'`
8027		majonly=libperl.$so.$majonly
8028		# I'd prefer to keep the os-specific stuff here to a minimum, and
8029		# rely on figuring it out from the naming of libc.
8030		case "${osname}${osvers}" in
8031		next4*)
8032			dflt=libperl.5.$so
8033			# XXX How handle the --version stuff for MAB?
8034			;;
8035		linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8036			dflt=libperl.$so
8037			;;
8038		cygwin*) # ld links against an importlib
8039			dflt=libperl$lib_ext
8040			;;
8041		*)	# Try to guess based on whether libc has major.minor.
8042			case "$libc" in
8043			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8044			*libc.$so.[0-9]*) dflt=$majonly ;;
8045			*)	dflt=libperl.$so ;;
8046			esac
8047			;;
8048		esac
8049		;;
8050	*)	dflt=$libperl
8051		;;
8052	esac
8053	cat << EOM
8054
8055I need to select a good name for the shared libperl.  If your system uses
8056library names with major and minor numbers, then you might want something
8057like $majmin.  Alternatively, if your system uses a single version
8058number for shared libraries, then you might want to use $majonly.
8059Or, your system might be quite happy with a simple libperl.$so.
8060
8061Since the shared libperl will get installed into a version-specific
8062architecture-dependent directory, the version number of the shared perl
8063library probably isn't important, so the default should be o.k.
8064
8065EOM
8066	rp='What name do you want to give to the shared libperl?'
8067	. ./myread
8068	libperl=$ans
8069	echo "Ok, I'll use $libperl"
8070	;;
8071*)
8072	libperl="libperl${_a}"
8073	;;
8074esac
8075
8076# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8077case "$shrpdir" in
8078'') ;;
8079*)	$cat >&4 <<EOM
8080WARNING:  Use of the shrpdir variable for the installation location of
8081the shared $libperl is not supported.  It was never documented and
8082will not work in this version.  Let me (perlbug@perl.org)
8083know of any problems this may cause.
8084
8085EOM
8086	case "$shrpdir" in
8087	"$archlibexp/CORE")
8088		$cat >&4 <<EOM
8089But your current setting of $shrpdir is
8090the default anyway, so it's harmless.
8091EOM
8092		;;
8093	*)
8094		$cat >&4 <<EOM
8095Further, your current attempted setting of $shrpdir
8096conflicts with the value of $archlibexp/CORE
8097that installperl will use.
8098EOM
8099		;;
8100	esac
8101	;;
8102esac
8103
8104# How will the perl executable find the installed shared $libperl?
8105# Add $xxx to ccdlflags.
8106# If we can't figure out a command-line option, use $shrpenv to
8107# set env LD_RUN_PATH.  The main perl makefile uses this.
8108shrpdir=$archlibexp/CORE
8109xxx=''
8110tmp_shrpenv=''
8111if "$useshrplib"; then
8112    case "$osname" in
8113	aix)
8114		# We'll set it in Makefile.SH...
8115		;;
8116	solaris)
8117		xxx="-R $shrpdir"
8118		;;
8119	freebsd|netbsd|openbsd|interix|dragonfly)
8120		xxx="-Wl,-R$shrpdir"
8121		;;
8122	bsdos|linux|irix*|dec_osf|gnu*)
8123		xxx="-Wl,-rpath,$shrpdir"
8124		;;
8125	next)
8126		# next doesn't like the default...
8127		;;
8128	beos)
8129		# beos doesn't like the default, either.
8130		;;
8131	hpux*)
8132		# hpux doesn't like the default, either.
8133		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8134		;;
8135	*)
8136		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8137		;;
8138	esac
8139	case "$xxx" in
8140	'') ;;
8141	*)
8142		# Only add $xxx if it isn't already in ccdlflags.
8143		case " $ccdlflags " in
8144		*" $xxx "*)	;;
8145		*)	ccdlflags="$ccdlflags $xxx"
8146			cat <<EOM >&4
8147
8148Adding $xxx to the flags
8149passed to $ld so that the perl executable will find the 
8150installed shared $libperl.
8151
8152EOM
8153			;;
8154		esac
8155		;;
8156	esac
8157fi
8158# Fix ccdlflags in AIX for building external extensions.
8159# (For building Perl itself bare -bE:perl.exp is needed,
8160#  Makefile.SH takes care of this.)
8161case "$osname" in
8162aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8163esac
8164# Respect a hint or command-line value.
8165case "$shrpenv" in
8166'') shrpenv="$tmp_shrpenv" ;;
8167esac
8168case "$ldlibpthname" in
8169'')	ldlibpthname=LD_LIBRARY_PATH ;;
8170none)	ldlibpthname='' ;;
8171esac
8172
8173: determine where manual pages are on this system
8174echo " "
8175case "$sysman" in
8176'')
8177	syspath='/usr/share/man/man1 /usr/man/man1'
8178	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8179	syspath="$syspath /usr/man/u_man/man1"
8180	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8181	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8182	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8183	sysman=`./loc . /usr/man/man1 $syspath`
8184	;;
8185esac
8186if $test -d "$sysman"; then
8187	echo "System manual is in $sysman." >&4
8188else
8189	echo "Could not find manual pages in source form." >&4
8190fi
8191
8192: determine where manual pages go
8193set man1dir man1dir none
8194eval $prefixit
8195$cat <<EOM
8196
8197$spackage has manual pages available in source form.
8198EOM
8199case "$nroff" in
8200nroff)
8201	echo "However, you don't have nroff, so they're probably useless to you."
8202	case "$man1dir" in
8203	'') man1dir="none";;
8204	esac;;
8205esac
8206echo "If you don't want the manual sources installed, answer 'none'."
8207case "$man1dir" in
8208' ') dflt=none
8209	;;
8210'')
8211	lookpath="$prefixexp/share/man/man1"
8212	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8213	lookpath="$lookpath $prefixexp/man/p_man/man1"
8214	lookpath="$lookpath $prefixexp/man/u_man/man1"
8215	lookpath="$lookpath $prefixexp/man/man.1"
8216	case "$sysman" in
8217	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8218	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8219	esac
8220	set dflt
8221	eval $prefixup
8222	;;
8223*)  dflt="$man1dir"
8224	;;
8225esac
8226echo " "
8227fn=dn+~
8228rp="Where do the main $spackage manual pages (source) go?"
8229. ./getfile
8230if $test "X$man1direxp" != "X$ansexp"; then
8231	installman1dir=''
8232fi
8233prefixvar=man1dir
8234. ./setprefixvar
8235
8236case "$man1dir" in
8237'')	man1dir=' '
8238	installman1dir='';;
8239esac
8240
8241: What suffix to use on installed man pages
8242
8243case "$man1dir" in
8244' ')
8245	man1ext='0'
8246	;;
8247*)
8248	rp="What suffix should be used for the main $spackage man pages?"
8249	case "$man1ext" in
8250	'')	case "$man1dir" in
8251		*1)  dflt=1 ;;
8252		*1p) dflt=1p ;;
8253		*1pm) dflt=1pm ;;
8254		*l) dflt=l;;
8255		*n) dflt=n;;
8256		*o) dflt=o;;
8257		*p) dflt=p;;
8258		*C) dflt=C;;
8259		*L) dflt=L;;
8260		*L1) dflt=L1;;
8261		*) dflt=1;;
8262		esac
8263		;;
8264	*)	dflt="$man1ext";;
8265	esac
8266	. ./myread
8267	man1ext="$ans"
8268	;;
8269esac
8270
8271: see if we can have long filenames
8272echo " "
8273first=123456789abcdef
8274$rm -f $first
8275if (echo hi >$first) 2>/dev/null; then
8276	if $test -f 123456789abcde; then
8277		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8278		val="$undef"
8279	else
8280 		echo 'You can have filenames longer than 14 characters.'>&4
8281 		val="$define"
8282	fi
8283else
8284	$cat <<'EOM'
8285You can't have filenames longer than 14 chars.
8286You can't even think about them!
8287EOM
8288	val="$undef"
8289fi
8290set d_flexfnam
8291eval $setvar
8292$rm -rf 123456789abcde*
8293
8294: determine where library module manual pages go
8295set man3dir man3dir none
8296eval $prefixit
8297$cat <<EOM
8298
8299$spackage has manual pages for many of the library modules.
8300EOM
8301
8302case "$nroff" in
8303nroff)
8304	$cat <<'EOM'
8305However, you don't have nroff, so they're probably useless to you.
8306EOM
8307	case "$man3dir" in
8308	'') man3dir="none";;
8309	esac;;
8310esac
8311
8312case "$d_flexfnam" in
8313undef)
8314	$cat <<'EOM'
8315However, your system can't handle the long file names like File::Basename.3.
8316EOM
8317	case "$man3dir" in
8318	'') man3dir="none";;
8319	esac;;
8320esac
8321
8322echo "If you don't want the manual sources installed, answer 'none'."
8323prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8324case "$man3dir" in
8325'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8326	if $test -d "$privlib/man/man3"; then
8327		cat <<EOM >&4
8328
8329WARNING:  Previous versions of perl installed man3 pages into
8330$privlib/man/man3.  This version will suggest a
8331new default of $dflt.
8332EOM
8333		tdflt=$dflt
8334		dflt='n'
8335		rp='Do you wish to preserve the old behavior?(y/n)'
8336		. ./myread
8337		case "$ans" in
8338		y*) dflt="$privlib/man/man3" ;;
8339		*)  dflt=$tdflt ;;
8340		esac
8341    fi
8342	;;
8343*)	dflt="$man3dir" ;;
8344esac
8345case "$dflt" in
8346' ') dflt=none ;;
8347esac
8348echo " "
8349fn=dn+~
8350rp="Where do the $package library man pages (source) go?"
8351. ./getfile
8352prefixvar=man3dir
8353. ./setprefixvar
8354
8355case "$man3dir" in
8356'')	man3dir=' '
8357	installman3dir='';;
8358esac
8359
8360: What suffix to use on installed man pages
8361case "$man3dir" in
8362' ')
8363	man3ext='0'
8364	;;
8365*)
8366	rp="What suffix should be used for the $package library man pages?"
8367	case "$man3ext" in
8368	'')	case "$man3dir" in
8369		*3)  dflt=3 ;;
8370		*3p) dflt=3p ;;
8371		*3pm) dflt=3pm ;;
8372		*l) dflt=l;;
8373		*n) dflt=n;;
8374		*o) dflt=o;;
8375		*p) dflt=p;;
8376		*C) dflt=C;;
8377		*L) dflt=L;;
8378		*L3) dflt=L3;;
8379		*) dflt=3;;
8380		esac
8381		;;
8382	*)	dflt="$man3ext";;
8383	esac
8384	. ./myread
8385	man3ext="$ans"
8386	;;
8387esac
8388
8389: see if we have to deal with yellow pages, now NIS.
8390if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8391	if $test -f /usr/etc/nibindd; then
8392		echo " "
8393		echo "I'm fairly confident you're on a NeXT."
8394		echo " "
8395		rp='Do you get the hosts file via NetInfo?'
8396		dflt=y
8397		case "$hostcat" in
8398		nidump*) ;;
8399		'') ;;
8400		*) dflt=n;;
8401		esac
8402		. ./myread
8403		case "$ans" in
8404		y*) hostcat='nidump hosts .';;
8405		*)	case "$hostcat" in
8406			nidump*) hostcat='';;
8407			esac
8408			;;
8409		esac
8410	fi
8411	case "$hostcat" in
8412	nidump*) ;;
8413	*)
8414		case "$hostcat" in
8415		*ypcat*) dflt=y;;
8416		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8417				dflt=y
8418			else
8419				dflt=n
8420			fi;;
8421		*) dflt=n;;
8422		esac
8423		echo " "
8424		rp='Are you getting the hosts file via yellow pages?'
8425		. ./myread
8426		case "$ans" in
8427		y*) hostcat='ypcat hosts';;
8428		*) hostcat='cat /etc/hosts';;
8429		esac
8430		;;
8431	esac
8432fi
8433case "$hostcat" in
8434'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8435esac
8436case "$groupcat" in
8437'') test -f /etc/group && groupcat='cat /etc/group';;
8438esac
8439case "$passcat" in
8440'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8441esac
8442
8443: now get the host name
8444echo " "
8445echo "Figuring out host name..." >&4
8446case "$myhostname" in
8447'') cont=true
8448	echo 'Maybe "hostname" will work...'
8449	if tans=`sh -c hostname 2>&1` ; then
8450		myhostname=$tans
8451		phostname=hostname
8452		cont=''
8453	fi
8454	;;
8455*) cont='';;
8456esac
8457if $test "$cont"; then
8458	if ./xenix; then
8459		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8460		if tans=`cat /etc/systemid 2>&1` ; then
8461			myhostname=$tans
8462			phostname='cat /etc/systemid'
8463			echo "Whadyaknow.  Xenix always was a bit strange..."
8464			cont=''
8465		fi
8466	elif $test -r /etc/systemid; then
8467		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8468	fi
8469fi
8470if $test "$cont"; then
8471	echo 'No, maybe "uuname -l" will work...'
8472	if tans=`sh -c 'uuname -l' 2>&1` ; then
8473		myhostname=$tans
8474		phostname='uuname -l'
8475	else
8476		echo 'Strange.  Maybe "uname -n" will work...'
8477		if tans=`sh -c 'uname -n' 2>&1` ; then
8478			myhostname=$tans
8479			phostname='uname -n'
8480		else
8481			echo 'Oh well, maybe I can mine it out of whoami.h...'
8482			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8483				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8484				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8485			else
8486				case "$myhostname" in
8487				'') echo "Does this machine have an identity crisis or something?"
8488					phostname='';;
8489				*)
8490					echo "Well, you said $myhostname before..."
8491					phostname='echo $myhostname';;
8492				esac
8493			fi
8494		fi
8495	fi
8496fi
8497case "$myhostname" in
8498'') myhostname=noname ;;
8499esac
8500: you do not want to know about this
8501set $myhostname
8502myhostname=$1
8503
8504: verify guess
8505if $test "$myhostname" ; then
8506	dflt=y
8507	rp='Your host name appears to be "'$myhostname'".'" Right?"
8508	. ./myread
8509	case "$ans" in
8510	y*) ;;
8511	*) myhostname='';;
8512	esac
8513fi
8514
8515: bad guess or no guess
8516while $test "X$myhostname" = X ; do
8517	dflt=''
8518	rp="Please type the (one word) name of your host:"
8519	. ./myread
8520	myhostname="$ans"
8521done
8522
8523: translate upper to lower if necessary
8524case "$myhostname" in
8525*[A-Z]*)
8526	echo "(Normalizing case in your host name)"
8527	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8528	;;
8529esac
8530
8531case "$myhostname" in
8532*.*)
8533	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8534	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8535	echo "(Trimming domain name from host name--host name is now $myhostname)"
8536	;;
8537*) case "$mydomain" in
8538	'')
8539		{
8540			test "X$hostcat" = "Xypcat hosts" &&
8541			ypmatch "$myhostname" hosts 2>/dev/null |\
8542				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8543			$test -s hosts
8544		} || {
8545			test "X$hostcat" != "X" &&
8546		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8547					/[	 ]$myhostname[	. ]/p" > hosts
8548		}
8549		tmp_re="[	. ]"
8550		if $test -f hosts; then
8551			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8552			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8553			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8554				hosts | $sort | $uniq | \
8555				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8556			case `$echo X$dflt` in
8557			X*\ *)	echo "(Several hosts in the database matched hostname)"
8558				dflt=.
8559				;;
8560			X.) echo "(You do not have fully-qualified names in the hosts database)"
8561				;;
8562			esac
8563		else
8564			echo "(I cannot locate a hosts database anywhere)"
8565			dflt=.
8566		fi
8567		case "$dflt" in
8568		.)
8569			tans=`./loc resolv.conf X /etc /usr/etc`
8570			if $test -f "$tans"; then
8571				echo "(Attempting domain name extraction from $tans)"
8572				dflt=.`$sed -n -e 's/	/ /g' \
8573				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8574				  | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8575				case "$dflt" in
8576				.) dflt=.`$sed -n -e 's/	/ /g' \
8577				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8578				     | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8579  					;;
8580				esac
8581			fi
8582			;;
8583		esac
8584		case "$dflt" in
8585		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8586			dflt=.`sh -c domainname 2>/dev/null`
8587			case "$dflt" in
8588			'') dflt='.';;
8589			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8590			esac
8591			;;
8592		esac
8593		case "$dflt$osname" in
8594		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8595			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8596			;;
8597		esac
8598		case "$dflt" in
8599		.) echo "(Lost all hope -- silly guess then)"
8600			dflt='.nonet'
8601			;;
8602		esac
8603		$rm -f hosts
8604		;;
8605	*) dflt="$mydomain";;
8606	esac;;
8607esac
8608echo " "
8609rp="What is your domain name?"
8610. ./myread
8611tans="$ans"
8612case "$ans" in
8613'') ;;
8614.*) ;;
8615*) tans=".$tans";;
8616esac
8617mydomain="$tans"
8618
8619: translate upper to lower if necessary
8620case "$mydomain" in
8621*[A-Z]*)
8622	echo "(Normalizing case in your domain name)"
8623	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8624	;;
8625esac
8626
8627: a little sanity check here
8628case "$phostname" in
8629'') ;;
8630*)
8631	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8632	$myhostname$mydomain|$myhostname) ;;
8633	*)
8634		case "$phostname" in
8635		sed*)
8636			echo "(That doesn't agree with your whoami.h file, by the way.)"
8637			;;
8638		*)
8639			echo "(That doesn't agree with your $phostname command, by the way.)"
8640			;;
8641		esac
8642	;;
8643	esac
8644	;;
8645esac
8646
8647$cat <<EOM
8648
8649I need to get your e-mail address in Internet format if possible, i.e.
8650something like user@host.domain. Please answer accurately since I have
8651no easy means to double check it. The default value provided below
8652is most probably close to reality but may not be valid from outside
8653your organization...
8654
8655EOM
8656cont=x
8657while test "$cont"; do
8658	case "$cf_email" in
8659	'') dflt="$cf_by@$myhostname$mydomain";;
8660	*) dflt="$cf_email";;
8661	esac
8662	rp='What is your e-mail address?'
8663	. ./myread
8664	cf_email="$ans"
8665	case "$cf_email" in
8666	*@*.*) cont='' ;;
8667	*)
8668		rp='Address does not look like an Internet one.  Use it anyway?'
8669		case "$fastread" in
8670		yes) dflt=y ;;
8671		*) dflt=n ;;
8672		esac
8673		. ./myread
8674		case "$ans" in
8675		y*) cont='' ;;
8676		*) echo " " ;;
8677		esac
8678		;;
8679	esac
8680done
8681
8682$cat <<EOM
8683
8684If you or somebody else will be maintaining perl at your site, please
8685fill in the correct e-mail address here so that they may be contacted
8686if necessary. Currently, the "perlbug" program included with perl
8687will send mail to this address in addition to perlbug@perl.org. You may
8688enter "none" for no administrator.
8689
8690EOM
8691case "$perladmin" in
8692'') dflt="$cf_email";;
8693*) dflt="$perladmin";;
8694esac
8695rp='Perl administrator e-mail address'
8696. ./myread
8697perladmin="$ans"
8698
8699: determine whether to only install version-specific parts.
8700echo " "
8701$cat <<EOM
8702Do you want to install only the version-specific parts of the perl
8703distribution?  Usually you do *not* want to do this.
8704EOM
8705case "$versiononly" in
8706"$define"|[Yy]*|true) dflt='y' ;;
8707*) dflt='n';
8708esac
8709rp="Do you want to install only the version-specific parts of perl?"
8710. ./myread
8711case "$ans" in
8712[yY]*)	val="$define";;
8713*)	val="$undef" ;;
8714esac
8715set versiononly
8716eval $setvar
8717
8718case "$versiononly" in
8719"$define") inc_version_list=''
8720           inc_version_list_init=0
8721           ;;
8722esac
8723
8724: figure out how to guarantee perl startup
8725: XXX Note that this currently takes advantage of the bug that binexp ignores
8726:     the Configure -Dinstallprefix setting, which in turn means that under
8727:     relocatable @INC, initialinstalllocation is what binexp started as.
8728case "$startperl" in
8729'')
8730	case "$sharpbang" in
8731	*!)
8732		$cat <<EOH
8733
8734I can use the #! construct to start perl on your system. This will
8735make startup of perl scripts faster, but may cause problems if you
8736want to share those scripts and perl is not in a standard place
8737($initialinstalllocation/perl) on all your platforms. The alternative
8738is to force a shell by starting the script with a single ':' character.
8739
8740EOH
8741		case "$versiononly" in
8742		"$define")      dflt="$initialinstalllocation/perl$version";;
8743		*)              dflt="$initialinstalllocation/perl";;
8744		esac
8745		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8746		. ./myread
8747		case "$ans" in
8748		none)	startperl=": # use perl";;
8749		*)	startperl="#!$ans"
8750			if $test 30 -lt `echo "$ans" | wc -c`; then
8751				$cat >&4 <<EOM
8752
8753WARNING:  Some systems limit the #! command to 32 characters.
8754If you experience difficulty running Perl scripts with #!, try
8755installing Perl in a directory with a shorter pathname.
8756
8757EOM
8758			fi ;;
8759		esac
8760		;;
8761	*) startperl=": # use perl"
8762		;;
8763	esac
8764	;;
8765esac
8766echo "I'll use $startperl to start perl scripts."
8767
8768: figure best path for perl in scripts
8769case "$perlpath" in
8770'')
8771	case "$versiononly" in
8772	"$define")	perlpath="$initialinstalllocation/perl$version";;
8773	*)		perlpath="$initialinstalllocation/perl";;
8774	esac
8775	case "$startperl" in
8776	*!*) ;;
8777	*)
8778		$cat <<EOH
8779
8780I will use the "eval 'exec'" idiom to start Perl on your system.
8781I can use the full path of your Perl binary for this purpose, but
8782doing so may cause problems if you want to share those scripts and
8783Perl is not always in a standard place ($initialinstalllocation/perl).
8784
8785EOH
8786		dflt="$initialinstalllocation/perl"
8787		rp="What path shall I use in \"eval 'exec'\"?"
8788		. ./myread
8789		perlpath="$ans"
8790		;;
8791	esac
8792	;;
8793esac
8794case "$startperl" in
8795*!*)	;;
8796*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8797esac
8798
8799: determine where public executable scripts go
8800set scriptdir scriptdir
8801eval $prefixit
8802case "$scriptdir" in
8803'')
8804	dflt="$bin"
8805	: guess some guesses
8806	$test -d /usr/share/scripts && dflt=/usr/share/scripts
8807	$test -d /usr/share/bin     && dflt=/usr/share/bin
8808	$test -d /usr/local/script  && dflt=/usr/local/script
8809	$test -d /usr/local/scripts && dflt=/usr/local/scripts
8810	$test -d $prefixexp/script  && dflt=$prefixexp/script
8811	set dflt
8812	eval $prefixup
8813	;;
8814*)  dflt="$scriptdir"
8815	;;
8816esac
8817$cat <<EOM
8818
8819Some installations have a separate directory just for executable scripts so
8820that they can mount it across multiple architectures but keep the scripts in
8821one spot.  You might, for example, have a subdirectory of /usr/share for this.
8822Or you might just lump your scripts in with all your other executables.
8823
8824EOM
8825fn=d~
8826rp='Where do you keep publicly executable scripts?'
8827. ./getfile
8828if $test "X$ansexp" != "X$scriptdirexp"; then
8829	installscript=''
8830fi
8831installscriptdir=''
8832prefixvar=scriptdir
8833. ./setprefixvar
8834: A little fix up for an irregularly named variable.
8835installscript="$installscriptdir"
8836
8837: determine where add-on public executables go
8838case "$sitebin" in
8839'')	dflt=$siteprefix/bin ;;
8840*)	dflt=$sitebin ;;
8841esac
8842fn=d~
8843rp='Pathname where the add-on public executables should be installed?'
8844. ./getfile
8845prefixvar=sitebin
8846. ./setprefixvar
8847
8848: determine where add-on html pages go
8849: There is no standard location, so try to copy the previously-selected
8850: directory structure for the core html pages.
8851case "$sitehtml1dir" in
8852'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8853*)     dflt=$sitehtml1dir ;;
8854esac
8855case "$dflt" in
8856''|' ') dflt=none ;;
8857esac
8858fn=dn+~
8859rp='Pathname where the site-specific html pages should be installed?'
8860. ./getfile
8861prefixvar=sitehtml1dir
8862. ./setprefixvar
8863
8864: determine where add-on library html pages go
8865: There is no standard location, so try to copy the previously-selected
8866: directory structure for the core html pages.
8867case "$sitehtml3dir" in
8868'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8869*)     dflt=$sitehtml3dir ;;
8870esac
8871case "$dflt" in
8872''|' ') dflt=none ;;
8873esac
8874fn=dn+~
8875rp='Pathname where the site-specific library html pages should be installed?'
8876. ./getfile
8877prefixvar=sitehtml3dir
8878. ./setprefixvar
8879
8880: determine where add-on manual pages go
8881case "$siteman1dir" in
8882'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8883*)	dflt=$siteman1dir ;;
8884esac
8885case "$dflt" in
8886''|' ') dflt=none ;;
8887esac
8888fn=dn+~
8889rp='Pathname where the site-specific manual pages should be installed?'
8890. ./getfile
8891prefixvar=siteman1dir
8892. ./setprefixvar
8893
8894: determine where add-on library man pages go
8895case "$siteman3dir" in
8896'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8897*)	dflt=$siteman3dir ;;
8898esac
8899case "$dflt" in
8900''|' ') dflt=none ;;
8901esac
8902fn=dn+~
8903rp='Pathname where the site-specific library manual pages should be installed?'
8904. ./getfile
8905prefixvar=siteman3dir
8906. ./setprefixvar
8907
8908: determine where add-on public executable scripts go
8909case "$sitescript" in
8910'')	dflt=$siteprefix/script
8911	$test -d $dflt || dflt=$sitebin ;;
8912*)  dflt="$sitescript" ;;
8913esac
8914fn=d~+
8915rp='Pathname where add-on public executable scripts should be installed?'
8916. ./getfile
8917prefixvar=sitescript
8918. ./setprefixvar
8919
8920case "$usefaststdio" in
8921$define|true|[yY]*|'')
8922	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8923	case "$xversion" in
8924	[68])	dflt='y' ;;
8925	*)	dflt='n' ;;
8926	esac
8927	;;
8928*) dflt='n';;
8929esac
8930cat <<EOM
8931
8932Perl can be built to use 'fast stdio', which means using the stdio
8933library but also directly manipulating the stdio buffers to enable
8934faster I/O.  Using stdio is better for backward compatibility (especially
8935for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8936interface has been preferred instead of stdio.
8937
8938If this doesn't make any sense to you, just accept the default '$dflt'.
8939EOM
8940rp='Use the "fast stdio" if available?'
8941. ./myread
8942case "$ans" in
8943y|Y)	val="$define" ;;
8944*)      val="$undef" ;;
8945esac
8946set usefaststdio
8947eval $setvar
8948
8949
8950: define an is-a-typedef? function
8951typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8952case "$inclist" in
8953"") inclist="sys/types.h";;
8954esac;
8955eval "varval=\$$var";
8956case "$varval" in
8957"")
8958	$rm -f temp.c;
8959	for inc in $inclist; do
8960		echo "#include <$inc>" >>temp.c;
8961	done;
8962	echo "#ifdef $type" >> temp.c;
8963	echo "printf(\"We have $type\");" >> temp.c;
8964	echo "#endif" >> temp.c;
8965	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8966	if $contains $type temp.E >/dev/null 2>&1; then
8967		eval "$var=\$type";
8968	else
8969		eval "$var=\$def";
8970	fi;
8971	$rm -f temp.?;;
8972*) eval "$var=\$varval";;
8973esac'
8974
8975: define an is-a-typedef? function that prompts if the type is not available.
8976typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8977case "$inclist" in
8978"") inclist="sys/types.h";;
8979esac;
8980eval "varval=\$$var";
8981case "$varval" in
8982"")
8983	$rm -f temp.c;
8984	for inc in $inclist; do
8985		echo "#include <$inc>" >>temp.c;
8986	done;
8987	echo "#ifdef $type" >> temp.c;
8988	echo "printf(\"We have $type\");" >> temp.c;
8989	echo "#endif" >> temp.c;
8990	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8991	echo " " ;
8992	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8993	if $contains $type temp.E >/dev/null 2>&1; then
8994		echo "$type found." >&4;
8995		eval "$var=\$type";
8996	else
8997		echo "$type NOT found." >&4;
8998		dflt="$def";
8999		. ./myread ;
9000		eval "$var=\$ans";
9001	fi;
9002	$rm -f temp.?;;
9003*) eval "$var=\$varval";;
9004esac'
9005
9006: see what type lseek is declared as in the kernel
9007rp="What is the type used for lseek's offset on this system?"
9008set off_t lseektype long stdio.h sys/types.h
9009eval $typedef_ask
9010
9011echo " "
9012echo "Checking to see how big your file offsets are..." >&4
9013$cat >try.c <<EOCP
9014#include <sys/types.h>
9015#include <stdio.h>
9016int main()
9017{
9018    printf("%d\n", (int)sizeof($lseektype));
9019    return(0);
9020}
9021EOCP
9022set try
9023if eval $compile_ok; then
9024	lseeksize=`$run ./try`
9025	echo "Your file offsets are $lseeksize bytes long."
9026else
9027	dflt=$longsize
9028	echo " "
9029	echo "(I can't seem to compile the test program.  Guessing...)"
9030	rp="What is the size of your file offsets (in bytes)?"
9031	. ./myread
9032	lseeksize="$ans"
9033fi
9034$rm_try
9035
9036: see what type file positions are declared as in the library
9037rp="What is the type for file position used by fsetpos()?"
9038set fpos_t fpostype long stdio.h sys/types.h
9039eval $typedef_ask
9040
9041echo " "
9042case "$fpostype" in
9043*_t) zzz="$fpostype"	;;
9044*)   zzz="fpos_t"	;;
9045esac
9046echo "Checking the size of $zzz..." >&4
9047cat > try.c <<EOCP
9048#include <sys/types.h>
9049#include <stdio.h>
9050#$i_stdlib I_STDLIB
9051#ifdef I_STDLIB
9052#include <stdlib.h>
9053#endif
9054int main() {
9055    printf("%d\n", (int)sizeof($fpostype));
9056    exit(0);
9057}
9058EOCP
9059set try
9060if eval $compile_ok; then
9061	yyy=`$run ./try`
9062	case "$yyy" in
9063	'')	fpossize=4
9064		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9065		;;
9066	*)	fpossize=$yyy
9067		echo "Your $zzz is $fpossize bytes long."
9068		;;
9069	esac
9070else
9071	dflt="$longsize"
9072	echo " " >&4
9073	echo "(I can't compile the test program.  Guessing...)" >&4
9074	rp="What is the size of your file positions (in bytes)?"
9075	. ./myread
9076	fpossize="$ans"
9077fi
9078
9079# Backward compatibility (uselfs is deprecated).
9080case "$uselfs" in
9081"$define"|true|[yY]*)
9082	cat <<EOM >&4
9083
9084*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9085EOM
9086	uselargefiles="$define"
9087	;;
9088esac
9089
9090case "$lseeksize:$fpossize" in
90918:8) cat <<EOM
9092
9093You can have files larger than 2 gigabytes.
9094EOM
9095   val="$define" ;;
9096*)    case "$uselargefiles" in
9097   "$undef"|false|[nN]*) dflt='n' ;;
9098   *)	dflt='y' ;;
9099   esac
9100   cat <<EOM
9101
9102Perl can be built to understand large files (files larger than 2 gigabytes)
9103on some systems.  To do so, Configure can be run with -Duselargefiles.
9104
9105If this doesn't make any sense to you, just accept the default '$dflt'.
9106EOM
9107   rp='Try to understand large files, if available?'
9108   . ./myread
9109   case "$ans" in
9110   y|Y) 	val="$define" ;;
9111   *)   	val="$undef"  ;;
9112   esac
9113   ;;
9114esac
9115set uselargefiles
9116eval $setvar
9117: Look for a hint-file generated 'call-back-unit'.  If the
9118: user has specified that a large files perl is to be built,
9119: we may need to set or change some other defaults.
9120if $test -f uselargefiles.cbu; then
9121	echo "Your platform has some specific hints regarding large file builds, using them..."
9122	. ./uselargefiles.cbu
9123fi
9124case "$uselargefiles" in
9125"$define")
9126	if $test -f uselargefiles.cbu; then
9127		echo " "
9128		echo "Rechecking to see how big your file offsets are..." >&4
9129		$cat >try.c <<EOCP
9130#include <sys/types.h>
9131#include <stdio.h>
9132int main()
9133{
9134    printf("%d\n", (int)sizeof($lseektype));
9135    return(0);
9136}
9137EOCP
9138		set try
9139		if eval $compile_ok; then
9140			lseeksize=`$run ./try`
9141			$echo "Your file offsets are now $lseeksize bytes long."
9142		else
9143			dflt="$lseeksize"
9144			echo " "
9145			echo "(I can't seem to compile the test program.  Guessing...)"
9146			rp="What is the size of your file offsets (in bytes)?"
9147			. ./myread
9148			lseeksize="$ans"
9149		fi
9150		case "$fpostype" in
9151		*_t) zzz="$fpostype"	;;
9152		*)   zzz="fpos_t"	;;
9153		esac
9154		$echo $n "Rechecking the size of $zzz...$c" >&4
9155		$cat > try.c <<EOCP
9156#include <sys/types.h>
9157#include <stdio.h>
9158#$i_stdlib I_STDLIB
9159#ifdef I_STDLIB
9160#include <stdlib.h>
9161#endif
9162int main() {
9163    printf("%d\n", (int)sizeof($fpostype));
9164    return(0);
9165}
9166EOCP
9167		set try
9168		if eval $compile_ok; then
9169			yyy=`$run ./try`
9170			dflt="$lseeksize"
9171			case "$yyy" in
9172			'')	echo " "
9173				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9174				;;
9175			*)	fpossize=$yyy
9176				echo " $fpossize bytes." >&4
9177				;;
9178			esac
9179		else
9180			dflt="$fpossize"
9181			echo " "
9182			echo "(I can't compile the test program.  Guessing...)" >&4
9183			rp="What is the size of your file positions (in bytes)?"
9184			. ./myread
9185			fpossize="$ans"
9186		fi
9187		$rm_try
9188	fi
9189	;;
9190esac
9191
9192case "$vendorprefix" in
9193'')	d_vendorbin="$undef"
9194	vendorbin=''
9195	vendorbinexp=''
9196	;;
9197*)	d_vendorbin="$define"
9198	: determine where vendor-supplied executables go.
9199	case "$vendorbin" in
9200	'') dflt=$vendorprefix/bin ;;
9201	*)	dflt="$vendorbin" ;;
9202	esac
9203	fn=d~+
9204	rp='Pathname for the vendor-supplied executables directory?'
9205	. ./getfile
9206	vendorbin="$ans"
9207	vendorbinexp="$ansexp"
9208	;;
9209esac
9210prefixvar=vendorbin
9211. ./installprefix
9212
9213case "$vendorprefix" in
9214'')	vendorhtml1dir=''
9215	vendorhtml1direxp=''
9216	;;
9217*)	: determine where vendor-supplied html pages go.
9218	: There is no standard location, so try to copy the previously-selected
9219	: directory structure for the core html pages.
9220	: XXX Better default suggestions would be welcome.
9221	case "$vendorhtml1dir" in
9222	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9223	*)	dflt=$vendorhtml1dir ;;
9224	esac
9225	case "$dflt" in
9226	''|' ') dflt=none ;;
9227	esac
9228	fn=dn+~
9229	rp='Pathname for the vendor-supplied html pages?'
9230	. ./getfile
9231	vendorhtml1dir="$ans"
9232	vendorhtml1direxp="$ansexp"
9233	;;
9234esac
9235: Use ' ' for none so value is preserved next time through Configure
9236$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9237prefixvar=vendorhtml1dir
9238. ./installprefix
9239
9240case "$vendorprefix" in
9241'')	vendorhtml3dir=''
9242	vendorhtml3direxp=''
9243	;;
9244*)	: determine where vendor-supplied module html pages go.
9245	: There is no standard location, so try to copy the previously-selected
9246	: directory structure for the core html pages.
9247	: XXX Better default suggestions would be welcome.
9248	case "$vendorhtml3dir" in
9249	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9250	*)	dflt=$vendorhtml3dir ;;
9251	esac
9252	case "$dflt" in
9253	''|' ') dflt=none ;;
9254	esac
9255	fn=dn+~
9256	rp='Pathname for the vendor-supplied html pages?'
9257	. ./getfile
9258	vendorhtml3dir="$ans"
9259	vendorhtml3direxp="$ansexp"
9260	;;
9261esac
9262: Use ' ' for none so value is preserved next time through Configure
9263$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9264prefixvar=vendorhtml3dir
9265. ./installprefix
9266
9267case "$vendorprefix" in
9268'')	vendorman1dir=''
9269	vendorman1direxp=''
9270	;;
9271*)	: determine where vendor-supplied manual pages go.
9272	case "$vendorman1dir" in
9273	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9274	*)	dflt=$vendorman1dir ;;
9275	esac
9276	case "$dflt" in
9277	''|' ') dflt=none ;;
9278	esac
9279	fn=nd~+
9280	rp='Pathname for the vendor-supplied manual section 1 pages?'
9281	. ./getfile
9282	vendorman1dir="$ans"
9283	vendorman1direxp="$ansexp"
9284	;;
9285esac
9286: Use ' ' for none so value is preserved next time through Configure
9287$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9288prefixvar=vendorman1dir
9289. ./installprefix
9290
9291case "$vendorprefix" in
9292'')	vendorman3dir=''
9293	vendorman3direxp=''
9294	;;
9295*)	: determine where vendor-supplied module manual pages go.
9296	case "$vendorman3dir" in
9297	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9298	*)	dflt=$vendorman3dir ;;
9299	esac
9300	case "$dflt" in
9301	''|' ') dflt=none ;;
9302	esac
9303	fn=nd~+
9304	rp='Pathname for the vendor-supplied manual section 3 pages?'
9305	. ./getfile
9306	vendorman3dir="$ans"
9307	vendorman3direxp="$ansexp"
9308	;;
9309esac
9310: Use ' ' for none so value is preserved next time through Configure
9311$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9312prefixvar=vendorman3dir
9313. ./installprefix
9314
9315case "$vendorprefix" in
9316'')	d_vendorscript="$undef"
9317	vendorscript=''
9318	vendorscriptexp=''
9319	;;
9320*)	d_vendorscript="$define"
9321	: determine where vendor-supplied scripts go.
9322	case "$vendorscript" in
9323	'')	dflt=$vendorprefix/script
9324		$test -d $dflt || dflt=$vendorbin ;;
9325	*)  dflt="$vendorscript" ;;
9326	esac
9327	$cat <<EOM
9328
9329The installation process will create a directory for
9330vendor-supplied scripts.
9331
9332EOM
9333	fn=d~+
9334	rp='Pathname for the vendor-supplied scripts directory?'
9335	. ./getfile
9336	vendorscript="$ans"
9337	vendorscriptexp="$ansexp"
9338	;;
9339esac
9340prefixvar=vendorscript
9341. ./installprefix
9342
9343: see if qgcvt exists
9344set qgcvt d_qgcvt
9345eval $inlibc
9346
9347echo " "
9348
9349if $test X"$d_longdbl" = X"$define"; then
9350
9351echo "Checking how to print long doubles..." >&4
9352
9353if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9354	$cat >try.c <<'EOCP'
9355#include <sys/types.h>
9356#include <stdio.h>
9357int main() {
9358  double d = 123.456;
9359  printf("%.3f\n", d);
9360}
9361EOCP
9362	set try
9363	if eval $compile; then
9364		yyy=`$run ./try`
9365		case "$yyy" in
9366		123.456)
9367			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9368                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9369			echo "We will use %f."
9370			;;
9371		esac
9372	fi
9373fi
9374
9375if $test X"$sPRIfldbl" = X; then
9376	$cat >try.c <<'EOCP'
9377#include <sys/types.h>
9378#include <stdio.h>
9379int main() {
9380  long double d = 123.456;
9381  printf("%.3Lf\n", d);
9382}
9383EOCP
9384	set try
9385	if eval $compile; then
9386		yyy=`$run ./try`
9387		case "$yyy" in
9388		123.456)
9389			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9390                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9391			echo "We will use %Lf."
9392			;;
9393		esac
9394	fi
9395fi
9396
9397if $test X"$sPRIfldbl" = X; then
9398	$cat >try.c <<'EOCP'
9399#include <sys/types.h>
9400#include <stdio.h>
9401int main() {
9402  long double d = 123.456;
9403  printf("%.3llf\n", d);
9404}
9405EOCP
9406	set try
9407	if eval $compile; then
9408		yyy=`$run ./try`
9409		case "$yyy" in
9410		123.456)
9411			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9412                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9413			echo "We will use %llf."
9414			;;
9415		esac
9416	fi
9417fi
9418
9419if $test X"$sPRIfldbl" = X; then
9420	$cat >try.c <<'EOCP'
9421#include <sys/types.h>
9422#include <stdio.h>
9423int main() {
9424  long double d = 123.456;
9425  printf("%.3lf\n", d);
9426}
9427EOCP
9428	set try
9429	if eval $compile; then
9430		yyy=`$run ./try`
9431		case "$yyy" in
9432		123.456)
9433			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9434                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9435			echo "We will use %lf."
9436			;;
9437		esac
9438	fi
9439fi
9440
9441if $test X"$sPRIfldbl" = X; then
9442	echo "Cannot figure out how to print long doubles." >&4
9443else
9444	sSCNfldbl=$sPRIfldbl	# expect consistency
9445fi
9446
9447$rm_try
9448
9449fi # d_longdbl
9450
9451case "$sPRIfldbl" in
9452'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9453	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9454	d_SCNfldbl="$undef";
9455	;;
9456*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9457	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9458	d_SCNfldbl="$define";
9459	;;
9460esac
9461
9462: Check how to convert floats to strings.
9463
9464if test "X$d_Gconvert" = X; then
9465
9466echo " "
9467echo "Checking for an efficient way to convert floats to strings."
9468echo " " > try.c
9469case "$uselongdouble" in
9470"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9471esac
9472case "$d_longdbl" in
9473"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9474esac
9475case "$d_PRIgldbl" in
9476"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9477esac
9478$cat >>try.c <<EOP
9479#ifdef TRY_gconvert
9480#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9481char *myname = "gconvert";
9482#endif
9483#ifdef TRY_gcvt
9484#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9485char *myname = "gcvt";
9486#endif
9487#ifdef TRY_qgcvt
9488#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9489char *myname = "qgcvt";
9490#define DOUBLETYPE long double
9491#endif
9492#ifdef TRY_sprintf
9493#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9494#ifdef HAS_PRIgldbl
9495#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9496#else
9497#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9498#endif
9499#else
9500#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9501#endif
9502char *myname = "sprintf";
9503#endif
9504
9505#ifndef DOUBLETYPE
9506#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9507#define DOUBLETYPE long double
9508#else
9509#define DOUBLETYPE double
9510#endif
9511#endif
9512
9513#include <stdio.h>
9514
9515#define I_STDLIB $i_stdlib
9516#ifdef I_STDLIB
9517#include <stdlib.h>
9518#endif
9519
9520int
9521checkit(expect, got)
9522char *expect;
9523char *got;
9524{
9525    if (strcmp(expect, got)) {
9526		printf("%s oddity:  Expected %s, got %s\n",
9527			myname, expect, got);
9528		exit(1);
9529	}
9530}
9531
9532int main()
9533{
9534	char buf[64];
9535	buf[63] = '\0';
9536
9537	/* This must be 1st test on (which?) platform */
9538	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9539	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9540	checkit("0.1", buf);
9541
9542	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9543	checkit("0.01", buf);
9544
9545	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9546	checkit("0.001", buf);
9547
9548	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9549	checkit("0.0001", buf);
9550
9551	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9552	if (strlen(buf) > 5)
9553	    checkit("9e-005", buf); /* for Microsoft ?? */
9554	else
9555	    checkit("9e-05", buf);
9556
9557	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9558	checkit("1", buf);
9559
9560	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9561	checkit("1.1", buf);
9562
9563	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9564	checkit("1.01", buf);
9565
9566	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9567	checkit("1.001", buf);
9568
9569	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9570	checkit("1.0001", buf);
9571
9572	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9573	checkit("1.00001", buf);
9574
9575	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9576	checkit("1.000001", buf);
9577
9578	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9579	checkit("0", buf);
9580
9581	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9582	checkit("-1", buf);
9583
9584	/* Some Linux gcvt's give 1.e+5 here. */
9585	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9586	checkit("100000", buf);
9587
9588	/* Some Linux gcvt's give -1.e+5 here. */
9589	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9590	checkit("-100000", buf);
9591
9592	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9593	checkit("123.456", buf);
9594
9595	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9596	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9597	/* 34 should be enough to scare even long double
9598	 * places into using the e notation. */
9599	if (strlen(buf) > 5)
9600	    checkit("1e+034", buf); /* for Microsoft */
9601	else
9602	    checkit("1e+34", buf);
9603
9604	/* For Perl, if you add additional tests here, also add them to
9605	 * t/base/num.t for benefit of platforms not using Configure or
9606	 * overriding d_Gconvert */
9607
9608	exit(0);
9609}
9610EOP
9611: first add preferred functions to our list
9612xxx_list=""
9613for xxx_convert in $gconvert_preference; do
9614    case $xxx_convert in
9615    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9616    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9617    esac
9618done
9619: then add any others
9620for xxx_convert in gconvert gcvt sprintf; do
9621    case "$xxx_list" in
9622    *$xxx_convert*) ;;
9623    *) xxx_list="$xxx_list $xxx_convert" ;;
9624    esac
9625done
9626
9627case "$d_longdbl$uselongdouble" in
9628"$define$define")
9629    : again, add prefered functions to our list first
9630    xxx_ld_list=""
9631    for xxx_convert in $gconvert_ld_preference; do
9632        case $xxx_convert in
9633        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9634        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9635        esac
9636    done
9637    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9638    for xxx_convert in qgcvt sprintf $xxx_list; do
9639        case "$xxx_ld_list" in
9640        $xxx_convert*|*" $xxx_convert"*) ;;
9641        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9642        esac
9643    done
9644    : if sprintf cannot do long doubles, move it to the end
9645    if test "$d_PRIgldbl" != "$define"; then
9646        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9647    fi
9648    : if no qgcvt, remove it
9649    if test "$d_qgcvt" != "$define"; then
9650        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9651    fi
9652    : use the ld_list
9653    xxx_list="$xxx_ld_list"
9654    ;;
9655esac
9656
9657for xxx_convert in $xxx_list; do
9658	echo "Trying $xxx_convert..."
9659	$rm -f try try$_o core
9660	set try -DTRY_$xxx_convert
9661	if eval $compile; then
9662		echo "$xxx_convert() found." >&4
9663		if $run ./try; then
9664			echo "I'll use $xxx_convert to convert floats into a string." >&4
9665			break;
9666		else
9667			echo "...But $xxx_convert didn't work as I expected."
9668			xxx_convert=''
9669		fi
9670	else
9671		echo "$xxx_convert NOT found." >&4
9672	fi
9673done
9674
9675if test X$xxx_convert = X; then
9676    echo "*** WHOA THERE!!! ***" >&4
9677    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9678    xxx_convert=sprintf
9679fi
9680
9681case "$xxx_convert" in
9682gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9683gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9684qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9685*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9686   "$define$define$define")
9687      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9688   "$define$define$undef")
9689      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9690   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9691   esac
9692   ;;
9693esac
9694
9695fi
9696$rm_try
9697
9698: see if _fwalk exists
9699set fwalk d__fwalk
9700eval $inlibc
9701
9702: Initialize h_fcntl
9703h_fcntl=false
9704
9705: Initialize h_sysfile
9706h_sysfile=false
9707
9708: access call always available on UNIX
9709set access d_access
9710eval $inlibc
9711
9712: locate the flags for 'access()'
9713case "$d_access" in
9714"$define")
9715	echo " "
9716	$cat >access.c <<EOCP
9717#include <sys/types.h>
9718#ifdef I_FCNTL
9719#include <fcntl.h>
9720#endif
9721#ifdef I_SYS_FILE
9722#include <sys/file.h>
9723#endif
9724#ifdef I_UNISTD
9725#include <unistd.h>
9726#endif
9727#$i_stdlib I_STDLIB
9728#ifdef I_STDLIB
9729#include <stdlib.h>
9730#endif
9731int main() {
9732	exit(R_OK);
9733}
9734EOCP
9735	: check sys/file.h first, no particular reason here
9736	if $test `./findhdr sys/file.h` && \
9737		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9738		h_sysfile=true;
9739		echo "<sys/file.h> defines the *_OK access constants." >&4
9740	elif $test `./findhdr fcntl.h` && \
9741		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9742		h_fcntl=true;
9743		echo "<fcntl.h> defines the *_OK access constants." >&4
9744	elif $test `./findhdr unistd.h` && \
9745		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9746		echo "<unistd.h> defines the *_OK access constants." >&4
9747	else
9748		echo "I can't find the four *_OK access constants--I'll use mine." >&4
9749	fi
9750	;;
9751esac
9752$rm -f access*
9753
9754: see if accessx exists
9755set accessx d_accessx
9756eval $inlibc
9757
9758: see if aintl exists
9759set aintl d_aintl
9760eval $inlibc
9761
9762: see if alarm exists
9763set alarm d_alarm
9764eval $inlibc
9765
9766: see if POSIX threads are available
9767set pthread.h i_pthread
9768eval $inhdr
9769
9770: define a fucntion to check prototypes
9771$cat > protochk <<EOSH
9772$startsh
9773cc="$cc"
9774optimize="$optimize"
9775ccflags="$ccflags"
9776prototype="$prototype"
9777define="$define"
9778rm_try="$rm_try"
9779usethreads=$usethreads
9780i_pthread=$i_pthread
9781pthread_h_first=$pthread_h_first
9782EOSH
9783
9784$cat >> protochk <<'EOSH'
9785
9786$rm_try
9787foo="$1"
9788shift
9789while test $# -ge 2; do
9790	case "$1" in
9791		$define) echo "#include <$2>" >> try.c ;;
9792		literal) echo "$2" >> try.c ;;
9793	esac
9794    # Extra magic for the benefit of systems that need pthread.h
9795    # to be included early to correctly detect threadsafe functions.
9796    # Such functions must guarantee themselves, though, that the usethreads
9797    # and i_pthread have been defined, before calling protochk.
9798    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9799	echo "#include <pthread.h>" >> try.c
9800	pthread_h_done=yes
9801    fi
9802    shift 2
9803done
9804test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9805cat >> try.c <<'EOCP'
9806#ifdef CAN_PROTOTYPE
9807#define	_(args) args
9808#else
9809#define	_(args) ()
9810#endif
9811EOCP
9812echo "$foo" >> try.c
9813echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9814$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9815status=$?
9816$rm_try
9817exit $status
9818EOSH
9819chmod +x protochk
9820$eunicefix protochk
9821
9822hasproto='varname=$1; func=$2; shift; shift;
9823while $test $# -ge 2; do
9824	case "$1" in
9825	$define) echo "#include <$2>";;
9826	esac ;
9827    shift 2;
9828done > try.c;
9829$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9830if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9831	echo "$func() prototype found.";
9832	val="$define";
9833else
9834	echo "$func() prototype NOT found.";
9835	val="$undef";
9836fi;
9837set $varname;
9838eval $setvar;
9839$rm_try tryout.c'
9840
9841: see if sys/types.h has to be included
9842set sys/types.h i_systypes
9843eval $inhdr
9844
9845: see if sys/select.h has to be included
9846set sys/select.h i_sysselct
9847eval $inhdr
9848
9849hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9850while $test $# -ge 2; do
9851	case "$1" in
9852	$define) echo "#include <$2>";;
9853	esac ;
9854    shift 2;
9855done > try.c;
9856echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9857set try;
9858if eval $compile; then
9859	val="$define";
9860else
9861	val="$undef";
9862fi;
9863set $varname;
9864eval $setvar;
9865$rm_try'
9866
9867: see if we should include time.h, sys/time.h, or both
9868echo " "
9869if test "X$timeincl" = X; then
9870	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9871	$echo $n "I'm now running the test program...$c"
9872	$cat >try.c <<EOCP
9873#include <sys/types.h>
9874#ifdef I_TIME
9875#include <time.h>
9876#endif
9877#ifdef I_SYSTIME
9878#ifdef SYSTIMEKERNEL
9879#define KERNEL
9880#endif
9881#include <sys/time.h>
9882#endif
9883#ifdef I_SYSSELECT
9884#include <sys/select.h>
9885#endif
9886#$i_stdlib I_STDLIB
9887#ifdef I_STDLIB
9888#include <stdlib.h>
9889#endif
9890int main()
9891{
9892	struct tm foo;
9893#ifdef S_TIMEVAL
9894	struct timeval bar;
9895#endif
9896#ifdef S_TIMEZONE
9897	struct timezone tzp;
9898#endif
9899	if (foo.tm_sec == foo.tm_sec)
9900		exit(0);
9901#ifdef S_TIMEVAL
9902	if (bar.tv_sec == bar.tv_sec)
9903		exit(0);
9904#endif
9905	exit(1);
9906}
9907EOCP
9908	flags=''
9909	for s_timezone in '-DS_TIMEZONE' ''; do
9910	sysselect=''
9911	for s_timeval in '-DS_TIMEVAL' ''; do
9912	for i_systimek in '' '-DSYSTIMEKERNEL'; do
9913	for i_time in '' '-DI_TIME'; do
9914	for i_systime in '-DI_SYSTIME' ''; do
9915		case "$flags" in
9916		'') $echo $n ".$c"
9917			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9918			if eval $compile; then
9919				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9920				shift
9921				flags="$*"
9922				echo " "
9923				$echo $n "Succeeded with $flags$c"
9924			fi
9925			;;
9926		esac
9927	done
9928	done
9929	done
9930	done
9931	done
9932	timeincl=''
9933	echo " "
9934	case "$flags" in
9935	*SYSTIMEKERNEL*) i_systimek="$define"
9936		timeincl=`./findhdr sys/time.h`
9937		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9938	*) i_systimek="$undef";;
9939	esac
9940	case "$flags" in
9941	*I_TIME*) i_time="$define"
9942		timeincl=`./findhdr time.h`" $timeincl"
9943		echo "We'll include <time.h>." >&4;;
9944	*) i_time="$undef";;
9945	esac
9946	case "$flags" in
9947	*I_SYSTIME*) i_systime="$define"
9948		timeincl=`./findhdr sys/time.h`" $timeincl"
9949		echo "We'll include <sys/time.h>." >&4;;
9950	*) i_systime="$undef";;
9951	esac
9952	$rm_try
9953fi
9954: see if struct tm knows about tm_zone
9955case "$i_systime$i_time" in
9956*$define*)
9957        echo " "
9958        echo "Checking to see if your struct tm has tm_zone field..." >&4
9959        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9960        eval $hasfield
9961        ;;
9962*)      val="$undef"
9963        set d_tm_tm_zone
9964        eval $setvar
9965        ;;
9966esac
9967case "$d_tm_tm_zone" in
9968"$define")      echo "Yes, it does."   ;;
9969*)              echo "No, it doesn't." ;;
9970esac
9971: see if struct tm knows about tm_gmtoff
9972case "$i_systime$i_time" in
9973*$define*)
9974        echo " "
9975        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9976        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9977        eval $hasfield
9978        ;;
9979*)      val="$undef"
9980        set d_tm_tm_gmtoff
9981        eval $setvar
9982        ;;
9983esac
9984case "$d_tm_tm_gmtoff" in
9985"$define")      echo "Yes, it does."   ;;
9986*)              echo "No, it doesn't." ;;
9987esac
9988
9989: see if asctime_r exists
9990set asctime_r d_asctime_r
9991eval $inlibc
9992case "$d_asctime_r" in
9993"$define")
9994	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9995	case "$d_asctime_r_proto:$usethreads" in
9996	":define")	d_asctime_r_proto=define
9997		set d_asctime_r_proto asctime_r $hdrs
9998		eval $hasproto ;;
9999	*)	;;
10000	esac
10001	case "$d_asctime_r_proto" in
10002	define)
10003	case "$asctime_r_proto" in
10004	''|0) try='char* asctime_r(const struct tm*, char*);'
10005	./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10006	esac
10007	case "$asctime_r_proto" in
10008	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10009	./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10010	esac
10011	case "$asctime_r_proto" in
10012	''|0) try='int asctime_r(const struct tm*, char*);'
10013	./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10014	esac
10015	case "$asctime_r_proto" in
10016	''|0) try='int asctime_r(const struct tm*, char*, int);'
10017	./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10018	esac
10019	case "$asctime_r_proto" in
10020	''|0)	d_asctime_r=undef
10021 	        asctime_r_proto=0
10022		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10023	* )	case "$asctime_r_proto" in
10024		REENTRANT_PROTO*) ;;
10025		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10026		esac
10027		echo "Prototype: $try" ;;
10028	esac
10029	;;
10030	*)	case "$usethreads" in
10031		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10032		esac
10033		d_asctime_r=undef
10034		asctime_r_proto=0
10035		;;
10036	esac
10037	;;
10038*)	asctime_r_proto=0
10039	;;
10040esac
10041
10042: see if atolf exists
10043set atolf d_atolf
10044eval $inlibc
10045
10046: see if atoll exists
10047set atoll d_atoll
10048eval $inlibc
10049
10050: Look for GCC-style attribute format
10051case "$d_attribute_format" in
10052'')
10053echo " "
10054echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10055$cat >attrib.c <<'EOCP'
10056#include <stdio.h>
10057void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10058EOCP
10059if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10060	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10061		echo "Your C compiler doesn't support __attribute__((format))."
10062		val="$undef"
10063	else
10064		echo "Your C compiler supports __attribute__((format))."
10065		val="$define"
10066	fi
10067else
10068	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10069	val="$undef"
10070fi
10071;;
10072*) val="$d_attribute_format" ;;
10073esac
10074set d_attribute_format
10075eval $setvar
10076$rm -f attrib*
10077
10078: Look for GCC-style attribute format with null format allowed
10079case "$d_printf_format_null" in
10080'') case "$d_attribute_format" in
10081    $define)
10082	echo " "
10083	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10084$cat >attrib.c <<EOCP
10085#include <stdio.h>
10086#$i_stdlib I_STDLIB
10087#ifdef I_STDLIB
10088#include <stdlib.h>
10089#endif
10090int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10091int null_printf (char* pat,...) { return (int)pat; }
10092int main () { exit(null_printf(NULL)); }
10093EOCP
10094	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10095	    : run the executable in case it produces a run-time warning
10096	    if $run ./attrib >>attrib.out 2>&1; then
10097		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10098		    echo "Your C compiler doesn't allow __printf__ format to be null."
10099		    val="$undef"
10100		else
10101		    echo "Your C compiler allows __printf__ format to be null."
10102		    val="$define"
10103		fi
10104	    else
10105	    echo "Your C compiler executable failed with __printf__ format null."
10106	    val="$undef"
10107	fi
10108    else
10109	echo "Your C compiler fails with __printf__ format null."
10110	val="$undef"
10111    fi
10112    ;;
10113    *)  val="$undef" ;;
10114    esac
10115;;
10116*)  val="$d_printf_format_null" ;;
10117esac
10118set d_printf_format_null
10119eval $setvar
10120$rm -f attrib*
10121
10122: Look for GCC-style attribute malloc
10123case "$d_attribute_malloc" in
10124'')
10125echo " "
10126echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10127$cat >attrib.c <<'EOCP'
10128#include <stdio.h>
10129char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10130EOCP
10131if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10132	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10133		echo "Your C compiler doesn't support __attribute__((malloc))."
10134		val="$undef"
10135	else
10136		echo "Your C compiler supports __attribute__((malloc))."
10137		val="$define"
10138	fi
10139else
10140	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10141	val="$undef"
10142fi
10143;;
10144*) val="$d_attribute_malloc" ;;
10145esac
10146set d_attribute_malloc
10147eval $setvar
10148$rm -f attrib*
10149
10150: Look for GCC-style attribute nonnull
10151case "$d_attribute_nonnull" in
10152'')
10153echo " "
10154echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10155$cat >attrib.c <<'EOCP'
10156#include <stdio.h>
10157void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10158EOCP
10159if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10160	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10161		echo "Your C compiler doesn't support __attribute__((nonnull))."
10162		val="$undef"
10163	else
10164		echo "Your C compiler supports __attribute__((nonnull))."
10165		val="$define"
10166	fi
10167else
10168	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10169	val="$undef"
10170fi
10171;;
10172*) val="$d_attribute_nonnull" ;;
10173esac
10174set d_attribute_nonnull
10175eval $setvar
10176$rm -f attrib*
10177
10178: Look for GCC-style attribute noreturn
10179case "$d_attribute_noreturn" in
10180'')
10181echo " "
10182echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10183$cat >attrib.c <<'EOCP'
10184#include <stdio.h>
10185void fall_over_dead( void ) __attribute__((noreturn));
10186EOCP
10187if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10188	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10189		echo "Your C compiler doesn't support __attribute__((noreturn))."
10190		val="$undef"
10191	else
10192		echo "Your C compiler supports __attribute__((noreturn))."
10193		val="$define"
10194	fi
10195else
10196	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10197	val="$undef"
10198fi
10199;;
10200*) val="$d_attribute_noreturn" ;;
10201esac
10202set d_attribute_noreturn
10203eval $setvar
10204$rm -f attrib*
10205
10206: Look for GCC-style attribute pure
10207case "$d_attribute_pure" in
10208'')
10209echo " "
10210echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10211$cat >attrib.c <<'EOCP'
10212#include <stdio.h>
10213int square( int n ) __attribute__((pure));
10214EOCP
10215if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10216	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10217		echo "Your C compiler doesn't support __attribute__((pure))."
10218		val="$undef"
10219	else
10220		echo "Your C compiler supports __attribute__((pure))."
10221		val="$define"
10222	fi
10223else
10224	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10225	val="$undef"
10226fi
10227;;
10228*) val="$d_attribute_pure" ;;
10229esac
10230set d_attribute_pure
10231eval $setvar
10232$rm -f attrib*
10233
10234: Look for GCC-style attribute unused
10235case "$d_attribute_unused" in
10236'')
10237echo " "
10238echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10239$cat >attrib.c <<'EOCP'
10240#include <stdio.h>
10241int do_something( int dummy __attribute__((unused)), int n );
10242EOCP
10243if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10244	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10245		echo "Your C compiler doesn't support __attribute__((unused))."
10246		val="$undef"
10247	else
10248		echo "Your C compiler supports __attribute__((unused))."
10249		val="$define"
10250	fi
10251else
10252	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10253	val="$undef"
10254fi
10255;;
10256*) val="$d_attribute_unused" ;;
10257esac
10258set d_attribute_unused
10259eval $setvar
10260$rm -f attrib*
10261
10262: Look for GCC-style attribute warn_unused_result
10263case "$d_attribute_warn_unused_result" in
10264'')
10265echo " "
10266echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10267$cat >attrib.c <<'EOCP'
10268#include <stdio.h>
10269int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10270EOCP
10271if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10272	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10273		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10274		val="$undef"
10275	else
10276		echo "Your C compiler supports __attribute__((warn_unused_result))."
10277		val="$define"
10278	fi
10279else
10280	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10281	val="$undef"
10282fi
10283;;
10284*) val="$d_attribute_warn_unused_result" ;;
10285esac
10286set d_attribute_warn_unused_result
10287eval $setvar
10288$rm -f attrib*
10289
10290: see if bcmp exists
10291set bcmp d_bcmp
10292eval $inlibc
10293
10294: see if bcopy exists
10295set bcopy d_bcopy
10296eval $inlibc
10297
10298: see if getpgrp exists
10299set getpgrp d_getpgrp
10300eval $inlibc
10301
10302case "$d_getpgrp" in
10303"$define")
10304	echo " "
10305	echo "Checking to see which flavor of getpgrp is in use..."
10306	$cat >try.c <<EOP
10307#$i_unistd I_UNISTD
10308#include <sys/types.h>
10309#ifdef I_UNISTD
10310#  include <unistd.h>
10311#endif
10312#$i_stdlib I_STDLIB
10313#ifdef I_STDLIB
10314#include <stdlib.h>
10315#endif
10316int main()
10317{
10318	if (getuid() == 0) {
10319		printf("(I see you are running Configure as super-user...)\n");
10320		setuid(1);
10321	}
10322#ifdef TRY_BSD_PGRP
10323	if (getpgrp(1) == 0)
10324		exit(0);
10325#else
10326	if (getpgrp() > 0)
10327		exit(0);
10328#endif
10329	exit(1);
10330}
10331EOP
10332	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10333		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10334		val="$define"
10335	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10336		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10337		val="$undef"
10338	else
10339		echo "I can't seem to compile and run the test program."
10340		if ./usg; then
10341			xxx="a USG one, i.e. you use getpgrp()."
10342		else
10343			# SVR4 systems can appear rather BSD-ish.
10344			case "$i_unistd" in
10345			$undef)
10346				xxx="a BSD one, i.e. you use getpgrp(pid)."
10347				val="$define"
10348				;;
10349			$define)
10350				xxx="probably a USG one, i.e. you use getpgrp()."
10351				val="$undef"
10352				;;
10353			esac
10354		fi
10355		echo "Assuming your getpgrp is $xxx" >&4
10356	fi
10357	;;
10358*) val="$undef";;
10359esac
10360set d_bsdgetpgrp
10361eval $setvar
10362$rm_try
10363
10364: see if setpgrp exists
10365set setpgrp d_setpgrp
10366eval $inlibc
10367
10368case "$d_setpgrp" in
10369"$define")
10370	echo " "
10371	echo "Checking to see which flavor of setpgrp is in use..."
10372	$cat >try.c <<EOP
10373#$i_unistd I_UNISTD
10374#include <sys/types.h>
10375#ifdef I_UNISTD
10376#  include <unistd.h>
10377#endif
10378#$i_stdlib I_STDLIB
10379#ifdef I_STDLIB
10380#include <stdlib.h>
10381#endif
10382int main()
10383{
10384	if (getuid() == 0) {
10385		printf("(I see you are running Configure as super-user...)\n");
10386		setuid(1);
10387	}
10388#ifdef TRY_BSD_PGRP
10389	if (-1 == setpgrp(1, 1))
10390		exit(0);
10391#else
10392	if (setpgrp() != -1)
10393		exit(0);
10394#endif
10395	exit(1);
10396}
10397EOP
10398	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10399		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10400		val="$define"
10401	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10402		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10403		val="$undef"
10404	else
10405		echo "(I can't seem to compile and run the test program.)"
10406		if ./usg; then
10407			xxx="a USG one, i.e. you use setpgrp()."
10408		else
10409			# SVR4 systems can appear rather BSD-ish.
10410			case "$i_unistd" in
10411			$undef)
10412				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10413				val="$define"
10414				;;
10415			$define)
10416				xxx="probably a USG one, i.e. you use setpgrp()."
10417				val="$undef"
10418				;;
10419			esac
10420		fi
10421		echo "Assuming your setpgrp is $xxx" >&4
10422	fi
10423	;;
10424*) val="$undef";;
10425esac
10426set d_bsdsetpgrp
10427eval $setvar
10428$rm_try
10429
10430: Look for GCC-style __builtin_choose_expr
10431case "$d_builtin_choose_expr" in
10432'')
10433    echo " "
10434    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10435    $cat >try.c <<'EOCP'
10436#include <assert.h>
10437#include <stdlib.h>
10438#include <stdio.h>
10439
10440#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10441
10442int main(void) {
10443    assert( SYRINX(1) == 2112 );
10444    assert( SYRINX(1) != 5150 );
10445    assert( SYRINX(0) == 5150 );
10446    assert( SYRINX(0) != 2112 );
10447    puts( "All good!" );
10448    exit(0);
10449}
10450
10451EOCP
10452    set try
10453    if eval $compile; then
10454	echo "Your C compiler supports __builtin_choose_expr."
10455	val="$define"
10456    else
10457	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10458	val="$undef"
10459    fi
10460;;
10461*) val="$d_builtin_choose_expr" ;;
10462esac
10463
10464set d_builtin_choose_expr
10465eval $setvar
10466$rm_try
10467
10468: Look for GCC-style __builtin_expect
10469case "$d_builtin_expect" in
10470'')
10471    echo " "
10472    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10473    $cat >builtin.c <<'EOCP'
10474int main(void) {
10475    int n = 50;
10476    if ( __builtin_expect(n, 0) ) n = 1;
10477}
10478EOCP
10479    set try
10480    if eval $compile; then
10481	echo "Your C compiler supports __builtin_choose_expr."
10482	val="$define"
10483    else
10484	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10485	val="$undef"
10486    fi
10487    ;;
10488*) val="$d_builtin_expect" ;;
10489esac
10490
10491set d_builtin_expect
10492eval $setvar
10493$rm_try
10494
10495: see if bzero exists
10496set bzero d_bzero
10497eval $inlibc
10498
10499: see if stdarg is available
10500echo " "
10501if $test `./findhdr stdarg.h`; then
10502	echo "<stdarg.h> found." >&4
10503	valstd="$define"
10504else
10505	echo "<stdarg.h> NOT found." >&4
10506	valstd="$undef"
10507fi
10508
10509: see if varags is available
10510echo " "
10511if $test `./findhdr varargs.h`; then
10512	echo "<varargs.h> found." >&4
10513else
10514	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10515fi
10516
10517: set up the varargs testing programs
10518$cat > varargs.c <<EOP
10519#ifdef I_STDARG
10520#include <stdarg.h>
10521#endif
10522#ifdef I_VARARGS
10523#include <varargs.h>
10524#endif
10525
10526#ifdef I_STDARG
10527int f(char *p, ...)
10528#else
10529int f(va_alist)
10530va_dcl
10531#endif
10532{
10533	va_list ap;
10534#ifndef I_STDARG
10535	char *p;
10536#endif
10537#ifdef I_STDARG
10538	va_start(ap,p);
10539#else
10540	va_start(ap);
10541	p = va_arg(ap, char *);
10542#endif
10543	va_end(ap);
10544	return 0;
10545}
10546EOP
10547$cat > varargs <<EOP
10548$startsh
10549if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10550	echo "true"
10551else
10552	echo "false"
10553fi
10554$rm -f varargs$_o
10555EOP
10556chmod +x varargs
10557
10558: now check which varargs header should be included
10559echo " "
10560i_varhdr=''
10561case "$valstd" in
10562"$define")
10563	if `./varargs I_STDARG`; then
10564		val='stdarg.h'
10565	elif `./varargs I_VARARGS`; then
10566		val='varargs.h'
10567	fi
10568	;;
10569*)
10570	if `./varargs I_VARARGS`; then
10571		val='varargs.h'
10572	fi
10573	;;
10574esac
10575case "$val" in
10576'')
10577echo "I could not find the definition for va_dcl... You have problems..." >&4
10578	val="$undef"; set i_stdarg; eval $setvar
10579	val="$undef"; set i_varargs; eval $setvar
10580	;;
10581*)
10582	set i_varhdr
10583	eval $setvar
10584	case "$i_varhdr" in
10585	stdarg.h)
10586		val="$define"; set i_stdarg; eval $setvar
10587		val="$undef"; set i_varargs; eval $setvar
10588		;;
10589	varargs.h)
10590		val="$undef"; set i_stdarg; eval $setvar
10591		val="$define"; set i_varargs; eval $setvar
10592		;;
10593	esac
10594	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10595esac
10596$rm -f varargs*
10597
10598: see if the Compiler supports C99 variadic macros
10599case "$i_stdarg$i_stdlib" in
10600    "$define$define")
10601    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10602    $cat >try.c <<EOCP
10603#include <stdio.h>
10604#include <stdarg.h>
10605
10606#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10607
10608int main() {
10609  char buf[20];
10610  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10611  puts(buf);
10612  return 0;
10613}
10614EOCP
10615    set try
10616    if eval $compile && $run ./try 2>&1 >/dev/null; then
10617	case "`$run ./try`" in
10618	    "123 456 789")
10619	    echo "You have C99 variadic macros." >&4
10620	    d_c99_variadic_macros="$define"
10621	    ;;
10622	    *)
10623	    echo "You don't have functional C99 variadic macros." >&4
10624	    d_c99_variadic_macros="$undef"
10625	    ;;
10626	esac
10627    else
10628	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10629	d_c99_variadic_macros="$undef"
10630    fi
10631    $rm_try
10632    ;;
10633    *)
10634    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10635    d_c99_variadic_macros="$undef"
10636    ;;
10637esac
10638
10639: see if signal is declared as pointer to function returning int or void
10640echo " "
10641xxx=`./findhdr signal.h`
10642$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10643if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10644	echo "You have int (*signal())() instead of void." >&4
10645	val="$undef"
10646elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
10647	echo "You have void (*signal())()." >&4
10648	val="$define"
10649elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10650	echo "You have int (*signal())() instead of void." >&4
10651	val="$undef"
10652elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10653	echo "You have void (*signal())()." >&4
10654	val="$define"
10655else
10656	case "$d_voidsig" in
10657	'')
10658	echo "I can't determine whether signal handler returns void or int..." >&4
10659		dflt=void
10660		rp="What type does your signal handler return?"
10661		. ./myread
10662		case "$ans" in
10663		v*) val="$define";;
10664		*) val="$undef";;
10665		esac;;
10666	"$define")
10667		echo "As you already told me, signal handler returns void." >&4
10668		val="$define"
10669		;;
10670	*)	echo "As you already told me, signal handler returns int." >&4
10671		val="$undef"
10672		;;
10673	esac
10674fi
10675set d_voidsig
10676eval $setvar
10677case "$d_voidsig" in
10678"$define") signal_t="void";;
10679*) signal_t="int";;
10680esac
10681$rm -f $$.tmp
10682
10683: check for ability to cast large floats to 32-bit ints.
10684echo " "
10685echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10686if $test "$intsize" -ge 4; then
10687	xxx=int
10688else
10689	xxx=long
10690fi
10691$cat >try.c <<EOCP
10692#include <stdio.h>
10693#$i_stdlib I_STDLIB
10694#ifdef I_STDLIB
10695#include <stdlib.h>
10696#endif
10697#include <sys/types.h>
10698#include <signal.h>
10699$signal_t blech(int s) { exit(3); }
10700int main()
10701{
10702	$xxx i32;
10703	double f, g;
10704	int result = 0;
10705	char str[16];
10706	signal(SIGFPE, blech);
10707
10708	/* Don't let compiler optimize the test away.  Store the number
10709	   in a writable string for gcc to pass to sscanf under HP/UX.
10710	*/
10711	sprintf(str, "2147483647");
10712	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10713	g = 10 * f;
10714	i32  = ($xxx) g;
10715
10716	/* x86 processors will probably give 0x8000 0000, which is a
10717	   sign change.  We don't want that.  We want to mimic SPARC
10718	   behavior here, which is to preserve the sign and give
10719	   back 0x7fff ffff.
10720	*/
10721	if (i32 != ($xxx) f)
10722		result |= 1;
10723	exit(result);
10724}
10725EOCP
10726set try
10727if eval $compile_ok; then
10728	$run ./try
10729	yyy=$?
10730else
10731	echo "(I can't seem to compile the test program--assuming it can't)"
10732	yyy=1
10733fi
10734case "$yyy" in
107350)	val="$define"
10736	echo "Yup, it can."
10737	;;
10738*)	val="$undef"
10739	echo "Nope, it can't."
10740	;;
10741esac
10742set d_casti32
10743eval $setvar
10744$rm_try
10745
10746: check for ability to cast negative floats to unsigned
10747echo " "
10748echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10749$cat >try.c <<EOCP
10750#include <stdio.h>
10751#$i_stdlib I_STDLIB
10752#ifdef I_STDLIB
10753#include <stdlib.h>
10754#endif
10755#include <sys/types.h>
10756#include <signal.h>
10757$signal_t blech(int s) { exit(7); }
10758$signal_t blech_in_list(int s) { exit(4); }
10759unsigned long dummy_long(unsigned long p) { return p; }
10760unsigned int dummy_int(unsigned int p) { return p; }
10761unsigned short dummy_short(unsigned short p) { return p; }
10762int main()
10763{
10764	double f;
10765	unsigned long along;
10766	unsigned int aint;
10767	unsigned short ashort;
10768	int result = 0;
10769	char str[16];
10770
10771	/* Frustrate gcc-2.7.2's optimizer which failed this test with
10772	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
10773	   optimized the whole file away
10774	*/
10775	/* Store the number in a writable string for gcc to pass to
10776	   sscanf under HP/UX.
10777	*/
10778	sprintf(str, "-123");
10779	sscanf(str, "%lf", &f);  /* f = -123.; */
10780
10781	signal(SIGFPE, blech);
10782	along = (unsigned long)f;
10783	aint = (unsigned int)f;
10784	ashort = (unsigned short)f;
10785	if (along != (unsigned long)-123)
10786		result |= 1;
10787	if (aint != (unsigned int)-123)
10788		result |= 1;
10789	if (ashort != (unsigned short)-123)
10790		result |= 1;
10791	sprintf(str, "1073741824.");
10792	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10793	f = f + f;
10794	along = 0;
10795	along = (unsigned long)f;
10796	if (along != 0x80000000)
10797		result |= 2;
10798	f -= 1.;
10799	along = 0;
10800	along = (unsigned long)f;
10801	if (along != 0x7fffffff)
10802		result |= 1;
10803	f += 2.;
10804	along = 0;
10805	along = (unsigned long)f;
10806	if (along != 0x80000001)
10807		result |= 2;
10808	if (result)
10809		exit(result);
10810	signal(SIGFPE, blech_in_list);
10811	sprintf(str, "123.");
10812	sscanf(str, "%lf", &f);  /* f = 123.; */
10813	along = dummy_long((unsigned long)f);
10814	aint = dummy_int((unsigned int)f);
10815	ashort = dummy_short((unsigned short)f);
10816	if (along != (unsigned long)123)
10817		result |= 4;
10818	if (aint != (unsigned int)123)
10819		result |= 4;
10820	if (ashort != (unsigned short)123)
10821		result |= 4;
10822	exit(result);
10823
10824}
10825EOCP
10826set try
10827if eval $compile_ok; then
10828	$run ./try
10829	castflags=$?
10830else
10831	echo "(I can't seem to compile the test program--assuming it can't)"
10832	castflags=7
10833fi
10834case "$castflags" in
108350)	val="$define"
10836	echo "Yup, it can."
10837	;;
10838*)	val="$undef"
10839	echo "Nope, it can't."
10840	;;
10841esac
10842set d_castneg
10843eval $setvar
10844$rm_try
10845
10846: see if vprintf exists
10847echo " "
10848if set vprintf val -f d_vprintf; eval $csym; $val; then
10849	echo 'vprintf() found.' >&4
10850	val="$define"
10851	$cat >try.c <<EOF
10852#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10853#$i_varargs I_VARARGS
10854
10855#$i_stdlib I_STDLIB
10856#$i_unistd I_UNISTD
10857
10858#ifdef I_STDARG
10859#  include <stdarg.h>
10860#else /* I_VARARGS */
10861#  include <varargs.h>
10862#endif
10863
10864#ifdef I_UNISTD
10865#  include <unistd.h>
10866#endif
10867
10868#ifdef I_STDLIB
10869#  include <stdlib.h>
10870#endif
10871
10872#include <stdio.h> /* vsprintf prototype */
10873
10874#ifdef I_STDARG
10875void xxx(int n, ...)
10876{
10877    va_list args;
10878    char buf[10];
10879    va_start(args, n);
10880    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10881}
10882int main() { xxx(1, "foo"); }
10883
10884#else /* I_VARARGS */
10885
10886xxx(va_alist)
10887va_dcl
10888{
10889    va_list args;
10890    char buf[10];
10891    va_start(args);
10892    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10893}
10894int main() { xxx("foo"); }
10895
10896#endif
10897
10898EOF
10899	set try
10900	if eval $compile_ok; then
10901		if $run ./try; then
10902			echo "Your vsprintf() returns (int)." >&4
10903			val2="$undef"
10904		else
10905			echo "Your vsprintf() returns (char*)." >&4
10906			val2="$define"
10907		fi
10908	else
10909		echo 'I am unable to compile the vsprintf() test program.' >&4
10910		# We shouldn't get here.  If we do, assume the standard signature,
10911		# not the old BSD one.
10912		echo 'Guessing that vsprintf() returns (int).' >&4
10913		val2="$undef"
10914	fi
10915else
10916	echo 'vprintf() NOT found.' >&4
10917	val="$undef"
10918	val2="$undef"
10919fi
10920$rm_try
10921set d_vprintf
10922eval $setvar
10923val=$val2
10924set d_charvspr
10925eval $setvar
10926
10927: see if chown exists
10928set chown d_chown
10929eval $inlibc
10930
10931: see if chroot exists
10932set chroot d_chroot
10933eval $inlibc
10934
10935: see if chsize exists
10936set chsize d_chsize
10937eval $inlibc
10938
10939: see if class exists
10940set class d_class
10941eval $inlibc
10942
10943: see if clearenv exists
10944set clearenv d_clearenv
10945eval $inlibc
10946
10947hasstruct='varname=$1; struct=$2; shift; shift;
10948while $test $# -ge 2; do
10949	case "$1" in
10950	$define) echo "#include <$2>";;
10951	esac ;
10952    shift 2;
10953done > try.c;
10954echo "int main () { struct $struct foo; }" >> try.c;
10955set try;
10956if eval $compile; then
10957	val="$define";
10958else
10959	val="$undef";
10960fi;
10961set $varname;
10962eval $setvar;
10963$rm_try'
10964
10965socketlib=''
10966sockethdr=''
10967: see whether socket exists
10968echo " "
10969$echo $n "Hmm... $c" >&4
10970if set socket val -f d_socket; eval $csym; $val; then
10971	echo "Looks like you have Berkeley networking support." >&4
10972	d_socket="$define"
10973	if set setsockopt val -f; eval $csym; $val; then
10974		d_oldsock="$undef"
10975	else
10976		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10977		d_oldsock="$define"
10978	fi
10979else
10980	if $contains socklib libc.list >/dev/null 2>&1; then
10981		echo "Looks like you have Berkeley networking support." >&4
10982		d_socket="$define"
10983		: we will have to assume that it supports the 4.2 BSD interface
10984		d_oldsock="$undef"
10985	else
10986		echo "You don't have Berkeley networking in libc$_a..." >&4
10987		if test "X$d_socket" = "X$define"; then
10988		   echo "...but you seem to believe that you have sockets." >&4
10989		else
10990			for net in net socket
10991			do
10992				if test -f /usr/lib/lib$net$_a; then
10993					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10994					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10995					if $contains socket libc.list >/dev/null 2>&1; then
10996						d_socket="$define"
10997						socketlib="-l$net"
10998						case "$net" in
10999						net)
11000							echo "...but the Wollongong group seems to have hacked it in." >&4
11001							sockethdr="-I/usr/netinclude"
11002							;;
11003						esac
11004						echo "Found Berkeley sockets interface in lib$net." >&4
11005						if $contains setsockopt libc.list >/dev/null 2>&1; then
11006							d_oldsock="$undef"
11007						else
11008							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11009							d_oldsock="$define"
11010						fi
11011						break
11012					fi
11013				fi
11014			done
11015			if test "X$d_socket" != "X$define"; then
11016			   echo "or anywhere else I see." >&4
11017			   d_socket="$undef"
11018			   d_oldsock="$undef"
11019			fi
11020		fi
11021	fi
11022fi
11023
11024: see if socketpair exists
11025set socketpair d_sockpair
11026eval $inlibc
11027
11028
11029echo " "
11030echo "Checking the availability of certain socket constants..." >&4
11031for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11032	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11033	$cat >try.c <<EOF
11034#include <sys/types.h>
11035#include <sys/socket.h>
11036int main() {
11037    int i = $ENUM;
11038}
11039EOF
11040	val="$undef"
11041	set try; if eval $compile; then
11042		val="$define"
11043	fi
11044	set d_${enum}; eval $setvar
11045	$rm_try
11046done
11047
11048: see if this is a sys/uio.h system
11049set sys/uio.h i_sysuio
11050eval $inhdr
11051
11052
11053echo " "
11054echo "Checking to see if your system supports struct cmsghdr..." >&4
11055set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11056eval $hasstruct
11057case "$d_cmsghdr_s" in
11058"$define")      echo "Yes, it does."   ;;
11059*)              echo "No, it doesn't." ;;
11060esac
11061
11062
11063: check for const keyword
11064echo " "
11065echo 'Checking to see if your C compiler knows about "const"...' >&4
11066$cat >const.c <<'EOCP'
11067typedef struct spug { int drokk; } spug;
11068int main()
11069{
11070	const char *foo;
11071	const spug y = { 0 };
11072}
11073EOCP
11074if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11075	val="$define"
11076	echo "Yup, it does."
11077else
11078	val="$undef"
11079	echo "Nope, it doesn't."
11080fi
11081set d_const
11082eval $setvar
11083
11084: see if copysignl exists
11085set copysignl d_copysignl
11086eval $inlibc
11087
11088: see if crypt exists
11089echo " "
11090set crypt d_crypt
11091eval $inlibc
11092case "$d_crypt" in
11093$define) cryptlib='' ;;
11094*)	if set crypt val -f d_crypt; eval $csym; $val; then
11095		echo 'crypt() found.' >&4
11096		val="$define"
11097		cryptlib=''
11098	else
11099		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11100		if $test -z "$cryptlib"; then
11101			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11102		else
11103			cryptlib=-lcrypt
11104		fi
11105		if $test -z "$cryptlib"; then
11106			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11107		else
11108			cryptlib=-lcrypt
11109		fi
11110		if $test -z "$cryptlib"; then
11111			cryptlib=`./loc libcrypt$_a "" $libpth`
11112		else
11113			cryptlib=-lcrypt
11114		fi
11115		if $test -z "$cryptlib"; then
11116			echo 'crypt() NOT found.' >&4
11117			val="$undef"
11118		else
11119			val="$define"
11120		fi
11121	fi
11122	set d_crypt
11123	eval $setvar
11124	;;
11125esac
11126
11127: see if this is a crypt.h system
11128set crypt.h i_crypt
11129eval $inhdr
11130
11131: see if crypt_r exists
11132set crypt_r d_crypt_r
11133eval $inlibc
11134case "$d_crypt_r" in
11135"$define")
11136	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11137	case "$d_crypt_r_proto:$usethreads" in
11138	":define")	d_crypt_r_proto=define
11139		set d_crypt_r_proto crypt_r $hdrs
11140		eval $hasproto ;;
11141	*)	;;
11142	esac
11143	case "$d_crypt_r_proto" in
11144	define)
11145	case "$crypt_r_proto" in
11146	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11147	./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11148	esac
11149	case "$crypt_r_proto" in
11150	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11151	./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11152	esac
11153	case "$crypt_r_proto" in
11154	''|0)	d_crypt_r=undef
11155 	        crypt_r_proto=0
11156		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11157	* )	case "$crypt_r_proto" in
11158		REENTRANT_PROTO*) ;;
11159		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11160		esac
11161		echo "Prototype: $try" ;;
11162	esac
11163	;;
11164	*)	case "$usethreads" in
11165		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11166		esac
11167		d_crypt_r=undef
11168		crypt_r_proto=0
11169		;;
11170	esac
11171	;;
11172*)	crypt_r_proto=0
11173	;;
11174esac
11175
11176: get csh whereabouts
11177case "$csh" in
11178'csh') val="$undef" ;;
11179*) val="$define" ;;
11180esac
11181set d_csh
11182eval $setvar
11183: Respect a hint or command line value for full_csh.
11184case "$full_csh" in
11185'') full_csh=$csh ;;
11186esac
11187
11188: see if ctermid exists
11189set ctermid d_ctermid
11190eval $inlibc
11191
11192: see if ctermid_r exists
11193set ctermid_r d_ctermid_r
11194eval $inlibc
11195case "$d_ctermid_r" in
11196"$define")
11197	hdrs="$i_systypes sys/types.h define stdio.h "
11198	case "$d_ctermid_r_proto:$usethreads" in
11199	":define")	d_ctermid_r_proto=define
11200		set d_ctermid_r_proto ctermid_r $hdrs
11201		eval $hasproto ;;
11202	*)	;;
11203	esac
11204	case "$d_ctermid_r_proto" in
11205	define)
11206	case "$ctermid_r_proto" in
11207	''|0) try='char* ctermid_r(char*);'
11208	./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11209	esac
11210	case "$ctermid_r_proto" in
11211	''|0)	d_ctermid_r=undef
11212 	        ctermid_r_proto=0
11213		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11214	* )	case "$ctermid_r_proto" in
11215		REENTRANT_PROTO*) ;;
11216		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11217		esac
11218		echo "Prototype: $try" ;;
11219	esac
11220	;;
11221	*)	case "$usethreads" in
11222		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11223		esac
11224		d_ctermid_r=undef
11225		ctermid_r_proto=0
11226		;;
11227	esac
11228	;;
11229*)	ctermid_r_proto=0
11230	;;
11231esac
11232
11233: see if ctime_r exists
11234set ctime_r d_ctime_r
11235eval $inlibc
11236case "$d_ctime_r" in
11237"$define")
11238	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11239	case "$d_ctime_r_proto:$usethreads" in
11240	":define")	d_ctime_r_proto=define
11241		set d_ctime_r_proto ctime_r $hdrs
11242		eval $hasproto ;;
11243	*)	;;
11244	esac
11245	case "$d_ctime_r_proto" in
11246	define)
11247	case "$ctime_r_proto" in
11248	''|0) try='char* ctime_r(const time_t*, char*);'
11249	./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11250	esac
11251	case "$ctime_r_proto" in
11252	''|0) try='char* ctime_r(const time_t*, char*, int);'
11253	./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11254	esac
11255	case "$ctime_r_proto" in
11256	''|0) try='int ctime_r(const time_t*, char*);'
11257	./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11258	esac
11259	case "$ctime_r_proto" in
11260	''|0) try='int ctime_r(const time_t*, char*, int);'
11261	./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11262	esac
11263	case "$ctime_r_proto" in
11264	''|0)	d_ctime_r=undef
11265 	        ctime_r_proto=0
11266		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11267	* )	case "$ctime_r_proto" in
11268		REENTRANT_PROTO*) ;;
11269		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11270		esac
11271		echo "Prototype: $try" ;;
11272	esac
11273	;;
11274	*)	case "$usethreads" in
11275		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11276		esac
11277		d_ctime_r=undef
11278		ctime_r_proto=0
11279		;;
11280	esac
11281	;;
11282*)	ctime_r_proto=0
11283	;;
11284esac
11285
11286: see if cuserid exists
11287set cuserid d_cuserid
11288eval $inlibc
11289
11290: see if this is a limits.h system
11291set limits.h i_limits
11292eval $inhdr
11293
11294: see if this is a float.h system
11295set float.h i_float
11296eval $inhdr
11297
11298: See if number of significant digits in a double precision number is known
11299echo " "
11300$cat >dbl_dig.c <<EOM
11301#$i_limits I_LIMITS
11302#$i_float I_FLOAT
11303#ifdef I_LIMITS
11304#include <limits.h>
11305#endif
11306#ifdef I_FLOAT
11307#include <float.h>
11308#endif
11309#ifdef DBL_DIG
11310printf("Contains DBL_DIG");
11311#endif
11312EOM
11313$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11314if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11315	echo "DBL_DIG found." >&4
11316	val="$define"
11317else
11318	echo "DBL_DIG NOT found." >&4
11319	val="$undef"
11320fi
11321$rm -f dbl_dig.?
11322set d_dbl_dig
11323eval $setvar
11324
11325: see if dbm.h is available
11326: see if dbmclose exists
11327set dbmclose d_dbmclose
11328eval $inlibc
11329
11330case "$d_dbmclose" in
11331$define)
11332	set dbm.h i_dbm
11333	eval $inhdr
11334	case "$i_dbm" in
11335	$define)
11336		val="$undef"
11337		set i_rpcsvcdbm
11338		eval $setvar
11339		;;
11340	*)	set rpcsvc/dbm.h i_rpcsvcdbm
11341		eval $inhdr
11342		;;
11343	esac
11344	;;
11345*)	echo "We won't be including <dbm.h>"
11346	val="$undef"
11347	set i_dbm
11348	eval $setvar
11349	val="$undef"
11350	set i_rpcsvcdbm
11351	eval $setvar
11352	;;
11353esac
11354
11355: see if prototype for dbminit is available
11356echo " "
11357set d_dbminitproto dbminit $i_dbm dbm.h
11358eval $hasproto
11359
11360: see if difftime exists
11361set difftime d_difftime
11362eval $inlibc
11363
11364: see if this is a dirent system
11365echo " "
11366if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11367	val="$define"
11368	echo "<dirent.h> found." >&4
11369else
11370	val="$undef"
11371	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11372		echo "<sys/dir.h> found." >&4
11373		echo " "
11374	else
11375		xinc=`./findhdr sys/ndir.h`
11376	fi
11377	echo "<dirent.h> NOT found." >&4
11378fi
11379set i_dirent
11380eval $setvar
11381
11382: Look for type of directory structure.
11383echo " "
11384$cppstdin $cppflags $cppminus < "$xinc" > try.c
11385
11386case "$direntrytype" in
11387''|' ')
11388	case "$i_dirent" in
11389	$define) guess1='struct dirent' ;;
11390	*) guess1='struct direct'  ;;
11391	esac
11392	;;
11393*)	guess1="$direntrytype"
11394	;;
11395esac
11396
11397case "$guess1" in
11398'struct dirent') guess2='struct direct' ;;
11399*) guess2='struct dirent' ;;
11400esac
11401
11402if $contains "$guess1" try.c >/dev/null 2>&1; then
11403	direntrytype="$guess1"
11404	echo "Your directory entries are $direntrytype." >&4
11405elif $contains "$guess2" try.c >/dev/null 2>&1; then
11406	direntrytype="$guess2"
11407	echo "Your directory entries seem to be $direntrytype." >&4
11408else
11409	echo "I don't recognize your system's directory entries." >&4
11410	rp="What type is used for directory entries on this system?"
11411	dflt="$guess1"
11412	. ./myread
11413	direntrytype="$ans"
11414fi
11415$rm_try
11416
11417: see if the directory entry stores field length
11418echo " "
11419$cppstdin $cppflags $cppminus < "$xinc" > try.c
11420if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11421	echo "Good, your directory entry keeps length information in d_namlen." >&4
11422	val="$define"
11423else
11424	echo "Your directory entry does not know about the d_namlen field." >&4
11425	val="$undef"
11426fi
11427set d_dirnamlen
11428eval $setvar
11429$rm_try
11430
11431: Look for DIR.dd_fd
11432case "$i_dirent" in
11433"$define")
11434    echo "Checking to see if DIR has a dd_fd member variable" >&4
11435    $cat >try.c <<EOCP
11436#$i_stdlib I_STDLIB
11437#ifdef I_STDLIB
11438#include <stdlib.h>
11439#endif
11440#include <dirent.h>
11441
11442int main() {
11443    DIR dir;
11444    dir.dd_fd = 1;
11445    return 0;
11446}
11447EOCP
11448    val=$undef
11449    set try
11450    if eval $compile; then
11451        echo "Yes, it does."
11452        val="$define"
11453    else
11454        echo "No, it does not."
11455        val="$undef"
11456    fi
11457    ;;
11458*)
11459    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11460    val="$undef"
11461    ;;
11462esac
11463set d_dir_dd_fd
11464eval $setvar
11465$rm_try
11466
11467: see if this is an sysdir system
11468set sys/dir.h i_sysdir
11469eval $inhdr
11470
11471: see if this is an sysndir system
11472set sys/ndir.h i_sysndir
11473eval $inhdr
11474
11475: Look for dirfd
11476echo " "
11477$cat >dirfd.c <<EOM
11478#include <stdio.h>
11479#$i_stdlib I_STDLIB
11480#ifdef I_STDLIB
11481#include <stdlib.h>
11482#endif
11483#$i_dirent I_DIRENT		/**/
11484#$i_sysdir I_SYS_DIR		/**/
11485#$i_sysndir I_SYS_NDIR		/**/
11486#$i_systypes I_SYS_TYPES	/**/
11487#if defined(I_SYS_TYPES)
11488#include <sys/types.h>
11489#endif
11490#if defined(I_DIRENT)
11491#include <dirent.h>
11492#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11493#include <sys/dir.h>
11494#endif
11495#else
11496#ifdef I_SYS_NDIR
11497#include <sys/ndir.h>
11498#else
11499#ifdef I_SYS_DIR
11500#ifdef hp9000s500
11501#include <ndir.h>	/* may be wrong in the future */
11502#else
11503#include <sys/dir.h>
11504#endif
11505#endif
11506#endif
11507#endif 
11508int main() {
11509	DIR *dirp = opendir(".");
11510	if (dirfd(dirp) >= 0)
11511		exit(0);
11512	else
11513		exit(1);
11514}
11515EOM
11516val=$undef
11517set dirfd
11518if eval $compile; then
11519	val="$define"
11520fi
11521case "$val" in
11522$define)	echo "dirfd() found." >&4	;;
11523*)		echo "dirfd() NOT found." >&4	;;
11524esac
11525set d_dirfd
11526eval $setvar
11527$rm -f dirfd*
11528
11529: see if dlerror exists
11530xxx_runnm="$runnm"
11531runnm=false
11532set dlerror d_dlerror
11533eval $inlibc
11534runnm="$xxx_runnm"
11535
11536: see if dlfcn is available
11537set dlfcn.h i_dlfcn
11538eval $inhdr
11539
11540case "$usedl" in
11541$define|y|true)
11542	$cat << EOM
11543
11544On a few systems, the dynamically loaded modules that perl generates and uses
11545will need a different extension than shared libs. The default will probably
11546be appropriate.
11547
11548EOM
11549	case "$dlext" in
11550	'')	dflt="$so" ;;
11551	*)	dflt="$dlext" ;;
11552	esac
11553	rp='What is the extension of dynamically loaded modules'
11554	. ./myread
11555	dlext="$ans"
11556	;;
11557*)
11558	dlext="none"
11559	;;
11560esac
11561
11562: Check if dlsym need a leading underscore
11563echo " "
11564val="$undef"
11565
11566case "$dlsrc" in
11567dl_dlopen.xs)
11568	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11569	$cat >dyna.c <<'EOM'
11570fred () { }
11571EOM
11572
11573$cat >fred.c<<EOM
11574
11575#include <stdio.h>
11576#$i_stdlib I_STDLIB
11577#ifdef I_STDLIB
11578#include <stdlib.h>
11579#endif
11580#$i_dlfcn I_DLFCN
11581#ifdef I_DLFCN
11582#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11583#else
11584#include <sys/types.h>
11585#include <nlist.h>
11586#include <link.h>
11587#endif
11588
11589extern int fred() ;
11590
11591int main()
11592{
11593    void * handle ;
11594    void * symbol ;
11595#ifndef RTLD_LAZY
11596    int mode = 1 ;
11597#else
11598    int mode = RTLD_LAZY ;
11599#endif
11600    handle = dlopen("./dyna.$dlext", mode) ;
11601    if (handle == NULL) {
11602	printf ("1\n") ;
11603	fflush (stdout) ;
11604	exit(0);
11605    }
11606    symbol = dlsym(handle, "fred") ;
11607    if (symbol == NULL) {
11608	/* try putting a leading underscore */
11609	symbol = dlsym(handle, "_fred") ;
11610	if (symbol == NULL) {
11611	    printf ("2\n") ;
11612	    fflush (stdout) ;
11613	    exit(0);
11614	}
11615	printf ("3\n") ;
11616    }
11617    else
11618	printf ("4\n") ;
11619    fflush (stdout) ;
11620    exit(0);
11621}
11622EOM
11623	: Call the object file tmp-dyna.o in case dlext=o.
11624	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11625		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11626		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11627		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11628		xxx=`$run ./fred`
11629		case $xxx in
11630		1)	echo "Test program failed using dlopen." >&4
11631			echo "Perhaps you should not use dynamic loading." >&4;;
11632		2)	echo "Test program failed using dlsym." >&4
11633			echo "Perhaps you should not use dynamic loading." >&4;;
11634		3)	echo "dlsym needs a leading underscore" >&4
11635			val="$define" ;;
11636		4)	echo "dlsym doesn't need a leading underscore." >&4;;
11637		esac
11638	else
11639		echo "I can't compile and run the test program." >&4
11640                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11641	fi
11642	;;
11643esac
11644
11645$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11646
11647set d_dlsymun
11648eval $setvar
11649
11650: see if drand48_r exists
11651set drand48_r d_drand48_r
11652eval $inlibc
11653case "$d_drand48_r" in
11654"$define")
11655	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11656	case "$d_drand48_r_proto:$usethreads" in
11657	":define")	d_drand48_r_proto=define
11658		set d_drand48_r_proto drand48_r $hdrs
11659		eval $hasproto ;;
11660	*)	;;
11661	esac
11662	case "$d_drand48_r_proto" in
11663	define)
11664	case "$drand48_r_proto" in
11665	''|0) try='int drand48_r(struct drand48_data*, double*);'
11666	./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11667	esac
11668	case "$drand48_r_proto" in
11669	''|0)	d_drand48_r=undef
11670 	        drand48_r_proto=0
11671		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11672	* )	case "$drand48_r_proto" in
11673		REENTRANT_PROTO*) ;;
11674		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11675		esac
11676		echo "Prototype: $try" ;;
11677	esac
11678	;;
11679	*)	case "$usethreads" in
11680		define) echo "drand48_r has no prototype, not using it." >&4 ;;
11681		esac
11682		d_drand48_r=undef
11683		drand48_r_proto=0
11684		;;
11685	esac
11686	;;
11687*)	drand48_r_proto=0
11688	;;
11689esac
11690
11691: see if prototype for drand48 is available
11692echo " "
11693set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11694eval $hasproto
11695
11696: see if dup2 exists
11697set dup2 d_dup2
11698eval $inlibc
11699
11700: see if eaccess exists
11701set eaccess d_eaccess
11702eval $inlibc
11703
11704: see if endgrent exists
11705set endgrent d_endgrent
11706eval $inlibc
11707
11708: see if this is an grp system
11709set grp.h i_grp
11710eval $inhdr
11711
11712case "$i_grp" in
11713$define)
11714	xxx=`./findhdr grp.h`
11715	$cppstdin $cppflags $cppminus < $xxx >$$.h
11716
11717	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11718		val="$define"
11719	else
11720		val="$undef"
11721	fi
11722	set d_grpasswd
11723	eval $setvar
11724
11725	$rm -f $$.h
11726	;;
11727*)
11728	val="$undef";
11729	set d_grpasswd; eval $setvar
11730	;;
11731esac
11732
11733: see if endgrent_r exists
11734set endgrent_r d_endgrent_r
11735eval $inlibc
11736case "$d_endgrent_r" in
11737"$define")
11738	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11739	case "$d_endgrent_r_proto:$usethreads" in
11740	":define")	d_endgrent_r_proto=define
11741		set d_endgrent_r_proto endgrent_r $hdrs
11742		eval $hasproto ;;
11743	*)	;;
11744	esac
11745	case "$d_endgrent_r_proto" in
11746	define)
11747	case "$endgrent_r_proto" in
11748	''|0) try='int endgrent_r(FILE**);'
11749	./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11750	esac
11751	case "$endgrent_r_proto" in
11752	''|0) try='void endgrent_r(FILE**);'
11753	./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11754	esac
11755	case "$endgrent_r_proto" in
11756	''|0)	d_endgrent_r=undef
11757 	        endgrent_r_proto=0
11758		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11759	* )	case "$endgrent_r_proto" in
11760		REENTRANT_PROTO*) ;;
11761		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11762		esac
11763		echo "Prototype: $try" ;;
11764	esac
11765	;;
11766	*)	case "$usethreads" in
11767		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11768		esac
11769		d_endgrent_r=undef
11770		endgrent_r_proto=0
11771		;;
11772	esac
11773	;;
11774*)	endgrent_r_proto=0
11775	;;
11776esac
11777
11778: see if endhostent exists
11779set endhostent d_endhent
11780eval $inlibc
11781
11782: see if this is a netdb.h system
11783set netdb.h i_netdb
11784eval $inhdr
11785
11786: see if endhostent_r exists
11787set endhostent_r d_endhostent_r
11788eval $inlibc
11789case "$d_endhostent_r" in
11790"$define")
11791	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11792	case "$d_endhostent_r_proto:$usethreads" in
11793	":define")	d_endhostent_r_proto=define
11794		set d_endhostent_r_proto endhostent_r $hdrs
11795		eval $hasproto ;;
11796	*)	;;
11797	esac
11798	case "$d_endhostent_r_proto" in
11799	define)
11800	case "$endhostent_r_proto" in
11801	''|0) try='int endhostent_r(struct hostent_data*);'
11802	./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11803	esac
11804	case "$endhostent_r_proto" in
11805	''|0) try='void endhostent_r(struct hostent_data*);'
11806	./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11807	esac
11808	case "$endhostent_r_proto" in
11809	''|0)	d_endhostent_r=undef
11810 	        endhostent_r_proto=0
11811		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11812	* )	case "$endhostent_r_proto" in
11813		REENTRANT_PROTO*) ;;
11814		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11815		esac
11816		echo "Prototype: $try" ;;
11817	esac
11818	;;
11819	*)	case "$usethreads" in
11820		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11821		esac
11822		d_endhostent_r=undef
11823		endhostent_r_proto=0
11824		;;
11825	esac
11826	;;
11827*)	endhostent_r_proto=0
11828	;;
11829esac
11830
11831: see if endnetent exists
11832set endnetent d_endnent
11833eval $inlibc
11834
11835: see if endnetent_r exists
11836set endnetent_r d_endnetent_r
11837eval $inlibc
11838case "$d_endnetent_r" in
11839"$define")
11840	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11841	case "$d_endnetent_r_proto:$usethreads" in
11842	":define")	d_endnetent_r_proto=define
11843		set d_endnetent_r_proto endnetent_r $hdrs
11844		eval $hasproto ;;
11845	*)	;;
11846	esac
11847	case "$d_endnetent_r_proto" in
11848	define)
11849	case "$endnetent_r_proto" in
11850	''|0) try='int endnetent_r(struct netent_data*);'
11851	./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11852	esac
11853	case "$endnetent_r_proto" in
11854	''|0) try='void endnetent_r(struct netent_data*);'
11855	./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11856	esac
11857	case "$endnetent_r_proto" in
11858	''|0)	d_endnetent_r=undef
11859 	        endnetent_r_proto=0
11860		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11861	* )	case "$endnetent_r_proto" in
11862		REENTRANT_PROTO*) ;;
11863		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11864		esac
11865		echo "Prototype: $try" ;;
11866	esac
11867	;;
11868	*)	case "$usethreads" in
11869		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11870		esac
11871		d_endnetent_r=undef
11872		endnetent_r_proto=0
11873		;;
11874	esac
11875	;;
11876*)	endnetent_r_proto=0
11877	;;
11878esac
11879
11880: see if endprotoent exists
11881set endprotoent d_endpent
11882eval $inlibc
11883
11884: see if endprotoent_r exists
11885set endprotoent_r d_endprotoent_r
11886eval $inlibc
11887case "$d_endprotoent_r" in
11888"$define")
11889	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11890	case "$d_endprotoent_r_proto:$usethreads" in
11891	":define")	d_endprotoent_r_proto=define
11892		set d_endprotoent_r_proto endprotoent_r $hdrs
11893		eval $hasproto ;;
11894	*)	;;
11895	esac
11896	case "$d_endprotoent_r_proto" in
11897	define)
11898	case "$endprotoent_r_proto" in
11899	''|0) try='int endprotoent_r(struct protoent_data*);'
11900	./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11901	esac
11902	case "$endprotoent_r_proto" in
11903	''|0) try='void endprotoent_r(struct protoent_data*);'
11904	./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11905	esac
11906	case "$endprotoent_r_proto" in
11907	''|0)	d_endprotoent_r=undef
11908 	        endprotoent_r_proto=0
11909		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11910	* )	case "$endprotoent_r_proto" in
11911		REENTRANT_PROTO*) ;;
11912		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11913		esac
11914		echo "Prototype: $try" ;;
11915	esac
11916	;;
11917	*)	case "$usethreads" in
11918		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11919		esac
11920		d_endprotoent_r=undef
11921		endprotoent_r_proto=0
11922		;;
11923	esac
11924	;;
11925*)	endprotoent_r_proto=0
11926	;;
11927esac
11928
11929: see if endpwent exists
11930set endpwent d_endpwent
11931eval $inlibc
11932
11933: see if this is a pwd.h system
11934set pwd.h i_pwd
11935eval $inhdr
11936
11937case "$i_pwd" in
11938$define)
11939	xxx=`./findhdr pwd.h`
11940	$cppstdin $cppflags $cppminus < $xxx >$$.h
11941
11942	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11943		val="$define"
11944	else
11945		val="$undef"
11946	fi
11947	set d_pwquota
11948	eval $setvar
11949
11950	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11951		val="$define"
11952	else
11953		val="$undef"
11954	fi
11955	set d_pwage
11956	eval $setvar
11957
11958	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11959		val="$define"
11960	else
11961		val="$undef"
11962	fi
11963	set d_pwchange
11964	eval $setvar
11965
11966	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11967		val="$define"
11968	else
11969		val="$undef"
11970	fi
11971	set d_pwclass
11972	eval $setvar
11973
11974	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11975		val="$define"
11976	else
11977		val="$undef"
11978	fi
11979	set d_pwexpire
11980	eval $setvar
11981
11982	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11983		val="$define"
11984	else
11985		val="$undef"
11986	fi
11987	set d_pwcomment
11988	eval $setvar
11989
11990	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11991		val="$define"
11992	else
11993		val="$undef"
11994	fi
11995	set d_pwgecos
11996	eval $setvar
11997
11998	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11999		val="$define"
12000	else
12001		val="$undef"
12002	fi
12003	set d_pwpasswd
12004	eval $setvar
12005
12006	$rm -f $$.h
12007	;;
12008*)
12009	val="$undef";
12010	set d_pwquota; eval $setvar
12011	set d_pwage; eval $setvar
12012	set d_pwchange; eval $setvar
12013	set d_pwclass; eval $setvar
12014	set d_pwexpire; eval $setvar
12015	set d_pwcomment; eval $setvar
12016	set d_pwgecos; eval $setvar
12017	set d_pwpasswd; eval $setvar
12018	;;
12019esac
12020
12021: see if endpwent_r exists
12022set endpwent_r d_endpwent_r
12023eval $inlibc
12024case "$d_endpwent_r" in
12025"$define")
12026	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12027	case "$d_endpwent_r_proto:$usethreads" in
12028	":define")	d_endpwent_r_proto=define
12029		set d_endpwent_r_proto endpwent_r $hdrs
12030		eval $hasproto ;;
12031	*)	;;
12032	esac
12033	case "$d_endpwent_r_proto" in
12034	define)
12035	case "$endpwent_r_proto" in
12036	''|0) try='int endpwent_r(FILE**);'
12037	./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12038	esac
12039	case "$endpwent_r_proto" in
12040	''|0) try='void endpwent_r(FILE**);'
12041	./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12042	esac
12043	case "$endpwent_r_proto" in
12044	''|0)	d_endpwent_r=undef
12045 	        endpwent_r_proto=0
12046		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12047	* )	case "$endpwent_r_proto" in
12048		REENTRANT_PROTO*) ;;
12049		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12050		esac
12051		echo "Prototype: $try" ;;
12052	esac
12053	;;
12054	*)	case "$usethreads" in
12055		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12056		esac
12057		d_endpwent_r=undef
12058		endpwent_r_proto=0
12059		;;
12060	esac
12061	;;
12062*)	endpwent_r_proto=0
12063	;;
12064esac
12065
12066: see if endservent exists
12067set endservent d_endsent
12068eval $inlibc
12069
12070: see if endservent_r exists
12071set endservent_r d_endservent_r
12072eval $inlibc
12073case "$d_endservent_r" in
12074"$define")
12075	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12076	case "$d_endservent_r_proto:$usethreads" in
12077	":define")	d_endservent_r_proto=define
12078		set d_endservent_r_proto endservent_r $hdrs
12079		eval $hasproto ;;
12080	*)	;;
12081	esac
12082	case "$d_endservent_r_proto" in
12083	define)
12084	case "$endservent_r_proto" in
12085	''|0) try='int endservent_r(struct servent_data*);'
12086	./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12087	esac
12088	case "$endservent_r_proto" in
12089	''|0) try='void endservent_r(struct servent_data*);'
12090	./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12091	esac
12092	case "$endservent_r_proto" in
12093	''|0)	d_endservent_r=undef
12094 	        endservent_r_proto=0
12095		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12096	* )	case "$endservent_r_proto" in
12097		REENTRANT_PROTO*) ;;
12098		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12099		esac
12100		echo "Prototype: $try" ;;
12101	esac
12102	;;
12103	*)	case "$usethreads" in
12104		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12105		esac
12106		d_endservent_r=undef
12107		endservent_r_proto=0
12108		;;
12109	esac
12110	;;
12111*)	endservent_r_proto=0
12112	;;
12113esac
12114
12115: Locate the flags for 'open()'
12116echo " "
12117$cat >try.c <<EOCP
12118#include <sys/types.h>
12119#ifdef I_FCNTL
12120#include <fcntl.h>
12121#endif
12122#ifdef I_SYS_FILE
12123#include <sys/file.h>
12124#endif
12125#$i_stdlib I_STDLIB
12126#ifdef I_STDLIB
12127#include <stdlib.h>
12128#endif
12129int main() {
12130	if(O_RDONLY);
12131#ifdef O_TRUNC
12132	exit(0);
12133#else
12134	exit(1);
12135#endif
12136}
12137EOCP
12138: check sys/file.h first to get FREAD on Sun
12139if $test `./findhdr sys/file.h` && \
12140		set try -DI_SYS_FILE && eval $compile; then
12141	h_sysfile=true;
12142	echo "<sys/file.h> defines the O_* constants..." >&4
12143	if $run ./try; then
12144		echo "and you have the 3 argument form of open()." >&4
12145		val="$define"
12146	else
12147		echo "but not the 3 argument form of open().  Oh, well." >&4
12148		val="$undef"
12149	fi
12150elif $test `./findhdr fcntl.h` && \
12151		set try -DI_FCNTL && eval $compile; then
12152	h_fcntl=true;
12153	echo "<fcntl.h> defines the O_* constants..." >&4
12154	if $run ./try; then
12155		echo "and you have the 3 argument form of open()." >&4
12156		val="$define"
12157	else
12158		echo "but not the 3 argument form of open().  Oh, well." >&4
12159		val="$undef"
12160	fi
12161else
12162	val="$undef"
12163	echo "I can't find the O_* constant definitions!  You got problems." >&4
12164fi
12165set d_open3
12166eval $setvar
12167$rm_try
12168
12169: see which of string.h or strings.h is needed
12170echo " "
12171strings=`./findhdr string.h`
12172if $test "$strings" && $test -r "$strings"; then
12173	echo "Using <string.h> instead of <strings.h>." >&4
12174	val="$define"
12175else
12176	val="$undef"
12177	strings=`./findhdr strings.h`
12178	if $test "$strings" && $test -r "$strings"; then
12179		echo "Using <strings.h> instead of <string.h>." >&4
12180	else
12181		echo "No string header found -- You'll surely have problems." >&4
12182	fi
12183fi
12184set i_string
12185eval $setvar
12186case "$i_string" in
12187"$undef") strings=`./findhdr strings.h`;;
12188*)	  strings=`./findhdr string.h`;;
12189esac
12190
12191: see if this is a sys/file.h system
12192val=''
12193set sys/file.h val
12194eval $inhdr
12195
12196: do we need to include sys/file.h ?
12197case "$val" in
12198"$define")
12199	echo " "
12200	if $h_sysfile; then
12201		val="$define"
12202		echo "We'll be including <sys/file.h>." >&4
12203	else
12204		val="$undef"
12205		echo "We won't be including <sys/file.h>." >&4
12206	fi
12207	;;
12208*)
12209	h_sysfile=false
12210	;;
12211esac
12212set i_sysfile
12213eval $setvar
12214
12215: see if fcntl.h is there
12216val=''
12217set fcntl.h val
12218eval $inhdr
12219
12220: see if we can include fcntl.h
12221case "$val" in
12222"$define")
12223	echo " "
12224	if $h_fcntl; then
12225		val="$define"
12226		echo "We'll be including <fcntl.h>." >&4
12227	else
12228		val="$undef"
12229		if $h_sysfile; then
12230	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12231		else
12232			echo "We won't be including <fcntl.h>." >&4
12233		fi
12234	fi
12235	;;
12236*)
12237	h_fcntl=false
12238	val="$undef"
12239	;;
12240esac
12241set i_fcntl
12242eval $setvar
12243
12244: see if fork exists
12245set fork d_fork
12246eval $inlibc
12247
12248: see if pipe exists
12249set pipe d_pipe
12250eval $inlibc
12251
12252: check for non-blocking I/O stuff
12253case "$h_sysfile" in
12254true) echo "#include <sys/file.h>" > head.c;;
12255*)
12256       case "$h_fcntl" in
12257       true) echo "#include <fcntl.h>" > head.c;;
12258       *) echo "#include <sys/fcntl.h>" > head.c;;
12259       esac
12260       ;;
12261esac
12262echo " "
12263echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12264case "$o_nonblock" in
12265'')
12266	$cat head.c > try.c
12267	$cat >>try.c <<EOCP
12268#include <stdio.h>
12269#$i_stdlib I_STDLIB
12270#ifdef I_STDLIB
12271#include <stdlib.h>
12272#endif
12273#$i_fcntl I_FCNTL
12274#ifdef I_FCNTL
12275#include <fcntl.h>
12276#endif
12277int main() {
12278#ifdef O_NONBLOCK
12279	printf("O_NONBLOCK\n");
12280	exit(0);
12281#endif
12282#ifdef O_NDELAY
12283	printf("O_NDELAY\n");
12284	exit(0);
12285#endif
12286#ifdef FNDELAY
12287	printf("FNDELAY\n");
12288	exit(0);
12289#endif
12290	exit(0);
12291}
12292EOCP
12293	set try
12294	if eval $compile_ok; then
12295		o_nonblock=`$run ./try`
12296		case "$o_nonblock" in
12297		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12298		*) echo "Seems like we can use $o_nonblock.";;
12299		esac
12300	else
12301		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12302	fi
12303	;;
12304*) echo "Using $hint value $o_nonblock.";;
12305esac
12306$rm_try
12307
12308echo " "
12309echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12310case "$eagain" in
12311'')
12312	case "$d_fork:$d_pipe" in
12313	define:define)
12314	$cat head.c > try.c
12315	$cat >>try.c <<EOCP
12316#include <errno.h>
12317#include <sys/types.h>
12318#include <signal.h>
12319#include <stdio.h>
12320#$i_stdlib I_STDLIB
12321#ifdef I_STDLIB
12322#include <stdlib.h>
12323#endif
12324#$i_fcntl I_FCNTL
12325#ifdef I_FCNTL
12326#include <fcntl.h>
12327#endif
12328#define MY_O_NONBLOCK $o_nonblock
12329#ifndef errno  /* XXX need better Configure test */
12330extern int errno;
12331#endif
12332#$i_unistd I_UNISTD
12333#ifdef I_UNISTD
12334#include <unistd.h>
12335#endif
12336#$i_string I_STRING
12337#ifdef I_STRING
12338#include <string.h>
12339#else
12340#include <strings.h>
12341#endif
12342$signal_t blech(int x) { exit(3); }
12343EOCP
12344	$cat >> try.c <<'EOCP'
12345int main()
12346{
12347	int pd[2];
12348	int pu[2];
12349	char buf[1];
12350	char string[100];
12351
12352	pipe(pd);	/* Down: child -> parent */
12353	pipe(pu);	/* Up: parent -> child */
12354	if (0 != fork()) {
12355		int ret;
12356		close(pd[1]);	/* Parent reads from pd[0] */
12357		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
12358#ifdef F_SETFL
12359		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12360			exit(1);
12361#else
12362		exit(4);
12363#endif
12364		signal(SIGALRM, blech);
12365		alarm(5);
12366		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
12367			exit(2);
12368		sprintf(string, "%d\n", ret);
12369		write(2, string, strlen(string));
12370		alarm(0);
12371#ifdef EAGAIN
12372		if (errno == EAGAIN) {
12373			printf("EAGAIN\n");
12374			goto ok;
12375		}
12376#endif
12377#ifdef EWOULDBLOCK
12378		if (errno == EWOULDBLOCK)
12379			printf("EWOULDBLOCK\n");
12380#endif
12381	ok:
12382		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
12383		sleep(2);				/* Give it time to close our pipe */
12384		alarm(5);
12385		ret = read(pd[0], buf, 1);	/* Should read EOF */
12386		alarm(0);
12387		sprintf(string, "%d\n", ret);
12388		write(4, string, strlen(string));
12389		exit(0);
12390	}
12391
12392	close(pd[0]);			/* We write to pd[1] */
12393	close(pu[1]);			/* We read from pu[0] */
12394	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
12395	close(pd[1]);			/* Pipe pd is now fully closed! */
12396	exit(0);				/* Bye bye, thank you for playing! */
12397}
12398EOCP
12399	set try
12400	if eval $compile_ok; then
12401		echo "$startsh" >mtry
12402		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12403		chmod +x mtry
12404		./mtry >/dev/null 2>&1
12405		case $? in
12406		0) eagain=`$cat try.out`;;
12407		1) echo "Could not perform non-blocking setting!";;
12408		2) echo "I did a successful read() for something that was not there!";;
12409		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12410		4) echo "Could not find F_SETFL!";;
12411		*) echo "Something terribly wrong happened during testing.";;
12412		esac
12413		rd_nodata=`$cat try.ret`
12414		echo "A read() system call with no data present returns $rd_nodata."
12415		case "$rd_nodata" in
12416		0|-1) ;;
12417		*)
12418			echo "(That's peculiar, fixing that to be -1.)"
12419			rd_nodata=-1
12420			;;
12421		esac
12422		case "$eagain" in
12423		'')
12424			echo "Forcing errno EAGAIN on read() with no data available."
12425			eagain=EAGAIN
12426			;;
12427		*)
12428			echo "Your read() sets errno to $eagain when no data is available."
12429			;;
12430		esac
12431		status=`$cat try.err`
12432		case "$status" in
12433		0) echo "And it correctly returns 0 to signal EOF.";;
12434		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
12435		*) echo "However, your read() returns '$status' on EOF??";;
12436		esac
12437		val="$define"
12438		if test "$status" = "$rd_nodata"; then
12439			echo "WARNING: you can't distinguish between EOF and no data!"
12440			val="$undef"
12441		fi
12442	else
12443		echo "I can't compile the test program--assuming errno EAGAIN will do."
12444		eagain=EAGAIN
12445	fi
12446	;;
12447	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12448		eagain=EAGAIN
12449		val="$define"
12450		;;
12451	esac
12452	set d_eofnblk
12453	eval $setvar
12454	;;
12455*)
12456	echo "Using $hint value $eagain."
12457	echo "Your read() returns $rd_nodata when no data is present."
12458	case "$d_eofnblk" in
12459	"$define") echo "And you can see EOF because read() returns 0.";;
12460	"$undef") echo "But you can't see EOF status from read() returned value.";;
12461	*)
12462		echo "(Assuming you can't see EOF status from read anyway.)"
12463		d_eofnblk=$undef
12464		;;
12465	esac
12466	;;
12467esac
12468$rm_try head.c mtry
12469
12470: see if _ptr and _cnt from stdio act std
12471echo " "
12472
12473if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12474	echo "(Looks like you have stdio.h from BSD.)"
12475	case "$stdio_ptr" in
12476	'') stdio_ptr='((fp)->_p)'
12477		ptr_lval=$define
12478		;;
12479	*)	ptr_lval=$d_stdio_ptr_lval;;
12480	esac
12481	case "$stdio_cnt" in
12482	'') stdio_cnt='((fp)->_r)'
12483		cnt_lval=$define
12484		;;
12485	*)	cnt_lval=$d_stdio_cnt_lval;;
12486	esac
12487	case "$stdio_base" in
12488	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12489	esac
12490	case "$stdio_bufsiz" in
12491	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12492	esac
12493elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12494	echo "(Looks like you have stdio.h from Linux.)"
12495	case "$stdio_ptr" in
12496	'') stdio_ptr='((fp)->_IO_read_ptr)'
12497		ptr_lval=$define
12498		;;
12499	*)	ptr_lval=$d_stdio_ptr_lval;;
12500	esac
12501	case "$stdio_cnt" in
12502	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12503		cnt_lval=$undef
12504		;;
12505	*)	cnt_lval=$d_stdio_cnt_lval;;
12506	esac
12507	case "$stdio_base" in
12508	'') stdio_base='((fp)->_IO_read_base)';;
12509	esac
12510	case "$stdio_bufsiz" in
12511	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12512	esac
12513else
12514	case "$stdio_ptr" in
12515	'') stdio_ptr='((fp)->_ptr)'
12516		ptr_lval=$define
12517		;;
12518	*)	ptr_lval=$d_stdio_ptr_lval;;
12519	esac
12520	case "$stdio_cnt" in
12521	'') stdio_cnt='((fp)->_cnt)'
12522		cnt_lval=$define
12523		;;
12524	*)	cnt_lval=$d_stdio_cnt_lval;;
12525	esac
12526	case "$stdio_base" in
12527	'') stdio_base='((fp)->_base)';;
12528	esac
12529	case "$stdio_bufsiz" in
12530	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12531	esac
12532fi
12533
12534: test whether _ptr and _cnt really work
12535echo "Checking how std your stdio is..." >&4
12536$cat >try.c <<EOP
12537#include <stdio.h>
12538#$i_stdlib I_STDLIB
12539#ifdef I_STDLIB
12540#include <stdlib.h>
12541#endif
12542#define FILE_ptr(fp)	$stdio_ptr
12543#define FILE_cnt(fp)	$stdio_cnt
12544int main() {
12545	FILE *fp = fopen("try.c", "r");
12546	char c = getc(fp);
12547	if (
12548		18 <= FILE_cnt(fp) &&
12549		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12550	)
12551		exit(0);
12552	exit(1);
12553}
12554EOP
12555val="$undef"
12556set try
12557if eval $compile && $to try.c; then
12558	if $run ./try; then
12559		echo "Your stdio acts pretty std."
12560		val="$define"
12561	else
12562		echo "Your stdio isn't very std."
12563	fi
12564else
12565	echo "Your stdio doesn't appear very std."
12566fi
12567$rm_try
12568
12569# glibc 2.2.90 and above apparently change stdio streams so Perl's
12570# direct buffer manipulation no longer works.  The Configure tests
12571# should be changed to correctly detect this, but until then,
12572# the following check should at least let perl compile and run.
12573# (This quick fix should be updated before 5.8.1.)
12574# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12575# A. Dougherty, June 3, 2002.
12576case "$d_gnulibc" in
12577$define)
12578	case "$gnulibc_version" in
12579	2.[01]*)  ;;
12580	2.2) ;;
12581	2.2.[0-9]) ;;
12582	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12583		val="$undef"
12584		;;
12585	esac
12586	;;
12587esac
12588set d_stdstdio
12589eval $setvar
12590
12591: Can _ptr be used as an lvalue?
12592case "$d_stdstdio$ptr_lval" in
12593$define$define) val=$define ;;
12594*) val=$undef ;;
12595esac
12596set d_stdio_ptr_lval
12597eval $setvar
12598
12599: Can _cnt be used as an lvalue?
12600case "$d_stdstdio$cnt_lval" in
12601$define$define) val=$define ;;
12602*) val=$undef ;;
12603esac
12604set d_stdio_cnt_lval
12605eval $setvar
12606
12607
12608: test whether setting _ptr sets _cnt as a side effect
12609d_stdio_ptr_lval_sets_cnt="$undef"
12610d_stdio_ptr_lval_nochange_cnt="$undef"
12611case "$d_stdio_ptr_lval$d_stdstdio" in
12612$define$define)
12613	echo "Checking to see what happens if we set the stdio ptr..." >&4
12614$cat >try.c <<EOP
12615#include <stdio.h>
12616/* Can we scream? */
12617/* Eat dust sed :-) */
12618/* In the buffer space, no one can hear you scream. */
12619#$i_stdlib I_STDLIB
12620#ifdef I_STDLIB
12621#include <stdlib.h>
12622#endif
12623#define FILE_ptr(fp)	$stdio_ptr
12624#define FILE_cnt(fp)	$stdio_cnt
12625#include <sys/types.h>
12626int main() {
12627	FILE *fp = fopen("try.c", "r");
12628	int c;
12629	char *ptr;
12630	size_t cnt;
12631	if (!fp) {
12632	    puts("Fail even to read");
12633	    exit(1);
12634	}
12635	c = getc(fp); /* Read away the first # */
12636	if (c == EOF) {
12637	    puts("Fail even to read");
12638	    exit(1);
12639	}
12640	if (!(
12641		18 <= FILE_cnt(fp) &&
12642		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12643	)) {
12644		puts("Fail even to read");
12645		exit (1);
12646	}
12647	ptr = (char*) FILE_ptr(fp);
12648	cnt = (size_t)FILE_cnt(fp);
12649
12650	FILE_ptr(fp) += 42;
12651
12652	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12653		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12654		exit (1);
12655	}
12656	if (FILE_cnt(fp) <= 20) {
12657		printf ("Fail (<20 chars to test)");
12658		exit (1);
12659	}
12660	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12661		puts("Fail compare");
12662		exit (1);
12663	}
12664	if (cnt == FILE_cnt(fp)) {
12665		puts("Pass_unchanged");
12666		exit (0);
12667	}
12668	if (FILE_cnt(fp) == (cnt - 42)) {
12669		puts("Pass_changed");
12670		exit (0);
12671	}
12672	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12673	return 1;
12674
12675}
12676EOP
12677	set try
12678	if eval $compile && $to try.c; then
12679 		case `$run ./try` in
12680		Pass_changed)
12681			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12682			d_stdio_ptr_lval_sets_cnt="$define" ;;
12683		Pass_unchanged)
12684			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12685			d_stdio_ptr_lval_nochange_cnt="$define" ;;
12686		Fail*)
12687			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12688		*)
12689			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12690	esac
12691	else
12692		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12693	fi
12694	$rm_try
12695	;;
12696esac
12697
12698: see if _base is also standard
12699val="$undef"
12700case "$d_stdstdio" in
12701$define)
12702	$cat >try.c <<EOP
12703#include <stdio.h>
12704#$i_stdlib I_STDLIB
12705#ifdef I_STDLIB
12706#include <stdlib.h>
12707#endif
12708#define FILE_base(fp)	$stdio_base
12709#define FILE_bufsiz(fp)	$stdio_bufsiz
12710int main() {
12711	FILE *fp = fopen("try.c", "r");
12712	char c = getc(fp);
12713	if (
12714		19 <= FILE_bufsiz(fp) &&
12715		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12716	)
12717		exit(0);
12718	exit(1);
12719}
12720EOP
12721	set try
12722	if eval $compile && $to try.c; then
12723		if $run ./try; then
12724			echo "And its _base field acts std."
12725			val="$define"
12726		else
12727			echo "But its _base field isn't std."
12728		fi
12729	else
12730		echo "However, it seems to be lacking the _base field."
12731	fi
12732	$rm_try
12733	;;
12734esac
12735set d_stdiobase
12736eval $setvar
12737
12738: see if fast_stdio exists
12739val="$undef"
12740case "$d_stdstdio:$d_stdio_ptr_lval" in
12741"$define:$define")
12742	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12743	*$define*)
12744		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12745		val="$define"
12746		;;
12747	esac
12748	;;
12749esac
12750set d_faststdio
12751eval $setvar
12752
12753
12754
12755: see if fchdir exists
12756set fchdir d_fchdir
12757eval $inlibc
12758
12759: see if fchmod exists
12760set fchmod d_fchmod
12761eval $inlibc
12762
12763: see if fchown exists
12764set fchown d_fchown
12765eval $inlibc
12766
12767: see if this is an fcntl system
12768set fcntl d_fcntl
12769eval $inlibc
12770
12771echo " "
12772: See if fcntl-based locking works.
12773$cat >try.c <<EOCP
12774#$i_stdlib I_STDLIB
12775#ifdef I_STDLIB
12776#include <stdlib.h>
12777#endif
12778#include <unistd.h>
12779#include <fcntl.h>
12780#include <signal.h>
12781$signal_t blech(int x) { exit(3); }
12782int main() {
12783#if defined(F_SETLK) && defined(F_SETLKW)
12784     struct flock flock;
12785     int retval, fd;
12786     fd = open("try.c", O_RDONLY);
12787     flock.l_type = F_RDLCK;
12788     flock.l_whence = SEEK_SET;
12789     flock.l_start = flock.l_len = 0;
12790     signal(SIGALRM, blech);
12791     alarm(10);
12792     retval = fcntl(fd, F_SETLK, &flock);
12793     close(fd);
12794     (retval < 0 ? exit(2) : exit(0));
12795#else
12796     exit(2);
12797#endif
12798}
12799EOCP
12800echo "Checking if fcntl-based file locking works... "
12801case "$d_fcntl" in
12802"$define")
12803	set try
12804	if eval $compile_ok; then
12805		if $run ./try; then
12806			echo "Yes, it seems to work."
12807			val="$define"
12808		else
12809			echo "Nope, it didn't work."
12810			val="$undef"
12811			case "$?" in
12812			3) $cat >&4 <<EOM
12813***
12814*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12815*** This is (almost) impossible.
12816*** If your NFS lock daemons are not feeling well, something like
12817*** this may happen, please investigate.  Cannot continue, aborting.
12818***
12819EOM
12820				exit 1
12821				;;
12822			esac
12823		fi
12824	else
12825		echo "I'm unable to compile the test program, so I'll assume not."
12826		val="$undef"
12827	fi
12828	;;
12829*) val="$undef";
12830	echo "Nope, since you don't even have fcntl()."
12831	;;
12832esac
12833set d_fcntl_can_lock
12834eval $setvar
12835$rm_try
12836
12837: check for fd_set items
12838$cat <<EOM
12839
12840Checking to see how well your C compiler handles fd_set and friends ...
12841EOM
12842$cat >try.c <<EOCP
12843#$i_stdlib I_STDLIB
12844#ifdef I_STDLIB
12845#include <stdlib.h>
12846#endif
12847#$i_systime I_SYS_TIME
12848#$i_sysselct I_SYS_SELECT
12849#$d_socket HAS_SOCKET
12850#include <sys/types.h>
12851#ifdef HAS_SOCKET
12852#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12853#endif
12854#ifdef I_SYS_TIME
12855#include <sys/time.h>
12856#endif
12857#ifdef I_SYS_SELECT
12858#include <sys/select.h>
12859#endif
12860int main() {
12861	fd_set fds;
12862
12863#ifdef TRYBITS
12864	if(fds.fds_bits);
12865#endif
12866
12867#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12868	exit(0);
12869#else
12870	exit(1);
12871#endif
12872}
12873EOCP
12874set try -DTRYBITS
12875if eval $compile; then
12876	d_fds_bits="$define"
12877	d_fd_set="$define"
12878	echo "Well, your system knows about the normal fd_set typedef..." >&4
12879	if $run ./try; then
12880		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12881		d_fd_macros="$define"
12882	else
12883		$cat >&4 <<'EOM'
12884but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12885EOM
12886		d_fd_macros="$undef"
12887	fi
12888else
12889	$cat <<'EOM'
12890Hmm, your compiler has some difficulty with fd_set.  Checking further...
12891EOM
12892	set try
12893	if eval $compile; then
12894		d_fds_bits="$undef"
12895		d_fd_set="$define"
12896		echo "Well, your system has some sort of fd_set available..." >&4
12897		if $run ./try; then
12898			echo "and you have the normal fd_set macros." >&4
12899			d_fd_macros="$define"
12900		else
12901			$cat <<'EOM'
12902but not the normal fd_set macros!  Gross!  More work for me...
12903EOM
12904			d_fd_macros="$undef"
12905		fi
12906	else
12907	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12908		d_fd_set="$undef"
12909		d_fds_bits="$undef"
12910		d_fd_macros="$undef"
12911	fi
12912fi
12913$rm_try
12914
12915: see if fgetpos exists
12916set fgetpos d_fgetpos
12917eval $inlibc
12918
12919: see if finite exists
12920set finite d_finite
12921eval $inlibc
12922
12923: see if finitel exists
12924set finitel d_finitel
12925eval $inlibc
12926
12927: see if flock exists
12928set flock d_flock
12929eval $inlibc
12930
12931: see if prototype for flock is available
12932echo " "
12933set d_flockproto flock $i_sysfile sys/file.h
12934eval $hasproto
12935
12936: see if fp_class exists
12937set fp_class d_fp_class
12938eval $inlibc
12939
12940: see if pathconf exists
12941set pathconf d_pathconf
12942eval $inlibc
12943
12944: see if fpathconf exists
12945set fpathconf d_fpathconf
12946eval $inlibc
12947
12948: see if fpclass exists
12949set fpclass d_fpclass
12950eval $inlibc
12951
12952: see if fpclassify exists
12953set fpclassify d_fpclassify
12954eval $inlibc
12955
12956: see if fpclassl exists
12957set fpclassl d_fpclassl
12958eval $inlibc
12959
12960
12961: check for fpos64_t
12962echo " "
12963echo "Checking to see if you have fpos64_t..." >&4
12964$cat >try.c <<EOCP
12965#include <stdio.h>
12966int main() { fpos64_t x = 7; }
12967EOCP
12968set try
12969if eval $compile; then
12970	val="$define"
12971	echo "You have fpos64_t."
12972else
12973	val="$undef"
12974	echo "You do not have fpos64_t."
12975	case "$fpossize" in
12976	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12977	esac
12978fi
12979$rm_try
12980set d_fpos64_t
12981eval $setvar
12982
12983: see if frexpl exists
12984set frexpl d_frexpl
12985eval $inlibc
12986
12987: see if this is a sys/param system
12988set sys/param.h i_sysparam
12989eval $inhdr
12990
12991: see if this is a sys/mount.h system
12992set sys/mount.h i_sysmount
12993eval $inhdr
12994
12995
12996echo " "
12997echo "Checking to see if your system supports struct fs_data..." >&4
12998set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12999eval $hasstruct
13000case "$d_fs_data_s" in
13001"$define")      echo "Yes, it does."   ;;
13002*)              echo "No, it doesn't." ;;
13003esac
13004
13005: see if fseeko exists
13006set fseeko d_fseeko
13007eval $inlibc
13008case "$longsize" in
130098) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13010esac
13011
13012: see if fsetpos exists
13013set fsetpos d_fsetpos
13014eval $inlibc
13015
13016
13017: see if fstatfs exists
13018set fstatfs d_fstatfs
13019eval $inlibc
13020
13021
13022: see if statvfs exists
13023set statvfs d_statvfs
13024eval $inlibc
13025
13026: see if fstatvfs exists
13027set fstatvfs d_fstatvfs
13028eval $inlibc
13029
13030
13031: see if fsync exists
13032set fsync d_fsync
13033eval $inlibc
13034
13035: see if ftello exists
13036set ftello d_ftello
13037eval $inlibc
13038case "$longsize" in
130398) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13040esac
13041
13042d_futimes="$undef"
13043: check for a working futimes
13044echo " "
13045echo "Checking if you have a working futimes()" >&4
13046$cat >try.c <<EOCP
13047#include <stdio.h>
13048#include <sys/time.h>
13049#include <errno.h>
13050#include <fcntl.h>
13051
13052int main ()
13053{
13054    int fd, rv;
13055    fd = open ("try.c", O_RDWR);
13056    if (-1 == fd) exit (1);
13057    rv = futimes (fd, NULL);
13058    exit (rv == -1 ? errno : 0);
13059}
13060EOCP
13061set try
13062if eval $compile; then
13063    `$run ./try`
13064    rc=$?
13065    case "$rc" in
13066	0)  echo "Yes, you have" >&4
13067	    d_futimes="$define"
13068	    ;;
13069	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13070	    ;;
13071    esac
13072else
13073    echo "No, it does not (probably harmless)" >&4
13074fi
13075$rm_try
13076
13077: see if getcwd exists
13078set getcwd d_getcwd
13079eval $inlibc
13080
13081: see if getespwnam exists
13082set getespwnam d_getespwnam
13083eval $inlibc
13084
13085
13086: see if getfsstat exists
13087set getfsstat d_getfsstat
13088eval $inlibc
13089
13090: see if getgrent exists
13091set getgrent d_getgrent
13092eval $inlibc
13093
13094: see if getgrent_r exists
13095set getgrent_r d_getgrent_r
13096eval $inlibc
13097case "$d_getgrent_r" in
13098"$define")
13099	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13100	case "$d_getgrent_r_proto:$usethreads" in
13101	":define")	d_getgrent_r_proto=define
13102		set d_getgrent_r_proto getgrent_r $hdrs
13103		eval $hasproto ;;
13104	*)	;;
13105	esac
13106	case "$d_getgrent_r_proto" in
13107	define)
13108	case "$getgrent_r_proto" in
13109	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13110	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13111	esac
13112	case "$getgrent_r_proto" in
13113	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13114	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13115	esac
13116	case "$getgrent_r_proto" in
13117	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13118	./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13119	esac
13120	case "$getgrent_r_proto" in
13121	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13122	./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13123	esac
13124	case "$getgrent_r_proto" in
13125	''|0) try='int getgrent_r(struct group*, char*, int);'
13126	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13127	esac
13128	case "$getgrent_r_proto" in
13129	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13130	./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13131	esac
13132	case "$getgrent_r_proto" in
13133	''|0)	d_getgrent_r=undef
13134 	        getgrent_r_proto=0
13135		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13136	* )	case "$getgrent_r_proto" in
13137		REENTRANT_PROTO*) ;;
13138		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13139		esac
13140		echo "Prototype: $try" ;;
13141	esac
13142	;;
13143	*)	case "$usethreads" in
13144		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13145		esac
13146		d_getgrent_r=undef
13147		getgrent_r_proto=0
13148		;;
13149	esac
13150	;;
13151*)	getgrent_r_proto=0
13152	;;
13153esac
13154
13155: see if getgrgid_r exists
13156set getgrgid_r d_getgrgid_r
13157eval $inlibc
13158case "$d_getgrgid_r" in
13159"$define")
13160	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13161	case "$d_getgrgid_r_proto:$usethreads" in
13162	":define")	d_getgrgid_r_proto=define
13163		set d_getgrgid_r_proto getgrgid_r $hdrs
13164		eval $hasproto ;;
13165	*)	;;
13166	esac
13167	case "$d_getgrgid_r_proto" in
13168	define)
13169	case "$getgrgid_r_proto" in
13170	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13171	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13172	esac
13173	case "$getgrgid_r_proto" in
13174	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13175	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13176	esac
13177	case "$getgrgid_r_proto" in
13178	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13179	./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13180	esac
13181	case "$getgrgid_r_proto" in
13182	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13183	./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13184	esac
13185	case "$getgrgid_r_proto" in
13186	''|0)	d_getgrgid_r=undef
13187 	        getgrgid_r_proto=0
13188		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13189	* )	case "$getgrgid_r_proto" in
13190		REENTRANT_PROTO*) ;;
13191		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13192		esac
13193		echo "Prototype: $try" ;;
13194	esac
13195	;;
13196	*)	case "$usethreads" in
13197		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13198		esac
13199		d_getgrgid_r=undef
13200		getgrgid_r_proto=0
13201		;;
13202	esac
13203	;;
13204*)	getgrgid_r_proto=0
13205	;;
13206esac
13207
13208: see if getgrnam_r exists
13209set getgrnam_r d_getgrnam_r
13210eval $inlibc
13211case "$d_getgrnam_r" in
13212"$define")
13213	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13214	case "$d_getgrnam_r_proto:$usethreads" in
13215	":define")	d_getgrnam_r_proto=define
13216		set d_getgrnam_r_proto getgrnam_r $hdrs
13217		eval $hasproto ;;
13218	*)	;;
13219	esac
13220	case "$d_getgrnam_r_proto" in
13221	define)
13222	case "$getgrnam_r_proto" in
13223	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13224	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13225	esac
13226	case "$getgrnam_r_proto" in
13227	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13228	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13229	esac
13230	case "$getgrnam_r_proto" in
13231	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13232	./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13233	esac
13234	case "$getgrnam_r_proto" in
13235	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13236	./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13237	esac
13238	case "$getgrnam_r_proto" in
13239	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13240	./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13241	esac
13242	case "$getgrnam_r_proto" in
13243	''|0)	d_getgrnam_r=undef
13244 	        getgrnam_r_proto=0
13245		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13246	* )	case "$getgrnam_r_proto" in
13247		REENTRANT_PROTO*) ;;
13248		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13249		esac
13250		echo "Prototype: $try" ;;
13251	esac
13252	;;
13253	*)	case "$usethreads" in
13254		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13255		esac
13256		d_getgrnam_r=undef
13257		getgrnam_r_proto=0
13258		;;
13259	esac
13260	;;
13261*)	getgrnam_r_proto=0
13262	;;
13263esac
13264
13265: see if gethostbyaddr exists
13266set gethostbyaddr d_gethbyaddr
13267eval $inlibc
13268
13269: see if gethostbyname exists
13270set gethostbyname d_gethbyname
13271eval $inlibc
13272
13273: see if gethostent exists
13274set gethostent d_gethent
13275eval $inlibc
13276
13277: see how we will look up host name
13278echo " "
13279call=''
13280if set gethostname val -f d_gethname; eval $csym; $val; then
13281	echo 'gethostname() found.' >&4
13282	d_gethname="$define"
13283	call=gethostname
13284fi
13285if set uname val -f d_uname; eval $csym; $val; then
13286	if ./xenix; then
13287		$cat <<'EOM'
13288uname() was found, but you're running xenix, and older versions of xenix
13289have a broken uname(). If you don't really know whether your xenix is old
13290enough to have a broken system call, use the default answer.
13291
13292EOM
13293		dflt=y
13294		case "$d_uname" in
13295		"$define") dflt=n;;
13296		esac
13297		rp='Is your uname() broken?'
13298		. ./myread
13299		case "$ans" in
13300		n*) d_uname="$define"; call=uname;;
13301		esac
13302	else
13303		echo 'uname() found.' >&4
13304		d_uname="$define"
13305		case "$call" in
13306		'') call=uname ;;
13307		esac
13308	fi
13309fi
13310case "$d_gethname" in
13311'') d_gethname="$undef";;
13312esac
13313case "$d_uname" in
13314'') d_uname="$undef";;
13315esac
13316case "$d_uname$d_gethname" in
13317*define*)
13318	dflt=n
13319	cat <<EOM
13320
13321Every now and then someone has a $call() that lies about the hostname
13322but can't be fixed for political or economic reasons.  If you wish, I can
13323pretend $call() isn't there and maybe compute hostname at run-time
13324thanks to the '$phostname' command.
13325
13326EOM
13327	rp="Shall I ignore $call() from now on?"
13328	. ./myread
13329	case "$ans" in
13330	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13331	esac;;
13332esac
13333case "$phostname" in
13334'') aphostname='';;
13335*) case "$aphostname" in
13336	/*) ;;
13337	*) set X $phostname
13338		shift
13339		file=$1
13340		shift
13341		file=`./loc $file $file $pth`
13342		aphostname=`echo $file $*`
13343		;;
13344	esac
13345	;;
13346esac
13347case "$d_uname$d_gethname" in
13348*define*) ;;
13349*)
13350	case "$phostname" in
13351	'')
13352		echo "There will be no way for $package to get your hostname." >&4;;
13353	*)
13354	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13355		;;
13356	esac;;
13357esac
13358case "$d_phostname" in
13359'') d_phostname="$undef";;
13360esac
13361
13362: see if gethostbyaddr_r exists
13363set gethostbyaddr_r d_gethostbyaddr_r
13364eval $inlibc
13365case "$d_gethostbyaddr_r" in
13366"$define")
13367	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13368	case "$d_gethostbyaddr_r_proto:$usethreads" in
13369	":define")	d_gethostbyaddr_r_proto=define
13370		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13371		eval $hasproto ;;
13372	*)	;;
13373	esac
13374	case "$d_gethostbyaddr_r_proto" in
13375	define)
13376	case "$gethostbyaddr_r_proto" in
13377	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13378	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13379	esac
13380	case "$gethostbyaddr_r_proto" in
13381	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13382	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13383	esac
13384	case "$gethostbyaddr_r_proto" in
13385	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13386	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13387	esac
13388	case "$gethostbyaddr_r_proto" in
13389	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13390	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13391	esac
13392	case "$gethostbyaddr_r_proto" in
13393	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13394	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13395	esac
13396	case "$gethostbyaddr_r_proto" in
13397	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13398	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13399	esac
13400	case "$gethostbyaddr_r_proto" in
13401	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13402	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13403	esac
13404	case "$gethostbyaddr_r_proto" in
13405	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13406	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13407	esac
13408	case "$gethostbyaddr_r_proto" in
13409	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13410	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13411	esac
13412	case "$gethostbyaddr_r_proto" in
13413	''|0) try='int gethostbyaddr_r(const char*, int, int);'
13414	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13415	esac
13416	case "$gethostbyaddr_r_proto" in
13417	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13418	./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13419	esac
13420	case "$gethostbyaddr_r_proto" in
13421	''|0)	d_gethostbyaddr_r=undef
13422 	        gethostbyaddr_r_proto=0
13423		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13424	* )	case "$gethostbyaddr_r_proto" in
13425		REENTRANT_PROTO*) ;;
13426		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13427		esac
13428		echo "Prototype: $try" ;;
13429	esac
13430	;;
13431	*)	case "$usethreads" in
13432		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13433		esac
13434		d_gethostbyaddr_r=undef
13435		gethostbyaddr_r_proto=0
13436		;;
13437	esac
13438	;;
13439*)	gethostbyaddr_r_proto=0
13440	;;
13441esac
13442
13443: see if gethostbyname_r exists
13444set gethostbyname_r d_gethostbyname_r
13445eval $inlibc
13446case "$d_gethostbyname_r" in
13447"$define")
13448	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13449	case "$d_gethostbyname_r_proto:$usethreads" in
13450	":define")	d_gethostbyname_r_proto=define
13451		set d_gethostbyname_r_proto gethostbyname_r $hdrs
13452		eval $hasproto ;;
13453	*)	;;
13454	esac
13455	case "$d_gethostbyname_r_proto" in
13456	define)
13457	case "$gethostbyname_r_proto" in
13458	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13459	./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13460	esac
13461	case "$gethostbyname_r_proto" in
13462	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13463	./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13464	esac
13465	case "$gethostbyname_r_proto" in
13466	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13467	./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13468	esac
13469	case "$gethostbyname_r_proto" in
13470	''|0)	d_gethostbyname_r=undef
13471 	        gethostbyname_r_proto=0
13472		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13473	* )	case "$gethostbyname_r_proto" in
13474		REENTRANT_PROTO*) ;;
13475		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13476		esac
13477		echo "Prototype: $try" ;;
13478	esac
13479	;;
13480	*)	case "$usethreads" in
13481		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13482		esac
13483		d_gethostbyname_r=undef
13484		gethostbyname_r_proto=0
13485		;;
13486	esac
13487	;;
13488*)	gethostbyname_r_proto=0
13489	;;
13490esac
13491
13492: see if gethostent_r exists
13493set gethostent_r d_gethostent_r
13494eval $inlibc
13495case "$d_gethostent_r" in
13496"$define")
13497	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13498	case "$d_gethostent_r_proto:$usethreads" in
13499	":define")	d_gethostent_r_proto=define
13500		set d_gethostent_r_proto gethostent_r $hdrs
13501		eval $hasproto ;;
13502	*)	;;
13503	esac
13504	case "$d_gethostent_r_proto" in
13505	define)
13506	case "$gethostent_r_proto" in
13507	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13508	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13509	esac
13510	case "$gethostent_r_proto" in
13511	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13512	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13513	esac
13514	case "$gethostent_r_proto" in
13515	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13516	./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13517	esac
13518	case "$gethostent_r_proto" in
13519	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13520	./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13521	esac
13522	case "$gethostent_r_proto" in
13523	''|0) try='int gethostent_r(struct hostent*, char*, int);'
13524	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13525	esac
13526	case "$gethostent_r_proto" in
13527	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13528	./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13529	esac
13530	case "$gethostent_r_proto" in
13531	''|0)	d_gethostent_r=undef
13532 	        gethostent_r_proto=0
13533		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13534	* )	case "$gethostent_r_proto" in
13535		REENTRANT_PROTO*) ;;
13536		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13537		esac
13538		echo "Prototype: $try" ;;
13539	esac
13540	;;
13541	*)	case "$usethreads" in
13542		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13543		esac
13544		d_gethostent_r=undef
13545		gethostent_r_proto=0
13546		;;
13547	esac
13548	;;
13549*)	gethostent_r_proto=0
13550	;;
13551esac
13552
13553: see if prototypes for various gethostxxx netdb.h functions are available
13554echo " "
13555set d_gethostprotos gethostent $i_netdb netdb.h
13556eval $hasproto
13557
13558: see if getitimer exists
13559set getitimer d_getitimer
13560eval $inlibc
13561
13562: see if getlogin exists
13563set getlogin d_getlogin
13564eval $inlibc
13565
13566: see if getlogin_r exists
13567set getlogin_r d_getlogin_r
13568eval $inlibc
13569case "$d_getlogin_r" in
13570"$define")
13571	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13572	case "$d_getlogin_r_proto:$usethreads" in
13573	":define")	d_getlogin_r_proto=define
13574		set d_getlogin_r_proto getlogin_r $hdrs
13575		eval $hasproto ;;
13576	*)	;;
13577	esac
13578	case "$d_getlogin_r_proto" in
13579	define)
13580	case "$getlogin_r_proto" in
13581	''|0) try='int getlogin_r(char*, size_t);'
13582	./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13583	esac
13584	case "$getlogin_r_proto" in
13585	''|0) try='int getlogin_r(char*, int);'
13586	./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13587	esac
13588	case "$getlogin_r_proto" in
13589	''|0) try='char* getlogin_r(char*, size_t);'
13590	./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13591	esac
13592	case "$getlogin_r_proto" in
13593	''|0) try='char* getlogin_r(char*, int);'
13594	./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13595	esac
13596	case "$getlogin_r_proto" in
13597	''|0)	d_getlogin_r=undef
13598 	        getlogin_r_proto=0
13599		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13600	* )	case "$getlogin_r_proto" in
13601		REENTRANT_PROTO*) ;;
13602		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13603		esac
13604		echo "Prototype: $try" ;;
13605	esac
13606	;;
13607	*)	case "$usethreads" in
13608		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13609		esac
13610		d_getlogin_r=undef
13611		getlogin_r_proto=0
13612		;;
13613	esac
13614	;;
13615*)	getlogin_r_proto=0
13616	;;
13617esac
13618
13619: see if getmnt exists
13620set getmnt d_getmnt
13621eval $inlibc
13622
13623: see if getmntent exists
13624set getmntent d_getmntent
13625eval $inlibc
13626
13627: see if getnetbyaddr exists
13628set getnetbyaddr d_getnbyaddr
13629eval $inlibc
13630
13631: see if getnetbyname exists
13632set getnetbyname d_getnbyname
13633eval $inlibc
13634
13635: see if getnetent exists
13636set getnetent d_getnent
13637eval $inlibc
13638
13639: see if getnetbyaddr_r exists
13640set getnetbyaddr_r d_getnetbyaddr_r
13641eval $inlibc
13642case "$d_getnetbyaddr_r" in
13643"$define")
13644	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13645	case "$d_getnetbyaddr_r_proto:$usethreads" in
13646	":define")	d_getnetbyaddr_r_proto=define
13647		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13648		eval $hasproto ;;
13649	*)	;;
13650	esac
13651	case "$d_getnetbyaddr_r_proto" in
13652	define)
13653	case "$getnetbyaddr_r_proto" in
13654	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13655	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13656	esac
13657	case "$getnetbyaddr_r_proto" in
13658	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13659	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13660	esac
13661	case "$getnetbyaddr_r_proto" in
13662	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13663	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13664	esac
13665	case "$getnetbyaddr_r_proto" in
13666	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13667	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13668	esac
13669	case "$getnetbyaddr_r_proto" in
13670	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13671	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13672	esac
13673	case "$getnetbyaddr_r_proto" in
13674	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13675	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13676	esac
13677	case "$getnetbyaddr_r_proto" in
13678	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13679	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13680	esac
13681	case "$getnetbyaddr_r_proto" in
13682	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13683	./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13684	esac
13685	case "$getnetbyaddr_r_proto" in
13686	''|0)	d_getnetbyaddr_r=undef
13687 	        getnetbyaddr_r_proto=0
13688		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13689	* )	case "$getnetbyaddr_r_proto" in
13690		REENTRANT_PROTO*) ;;
13691		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13692		esac
13693		echo "Prototype: $try" ;;
13694	esac
13695	;;
13696	*)	case "$usethreads" in
13697		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13698		esac
13699		d_getnetbyaddr_r=undef
13700		getnetbyaddr_r_proto=0
13701		;;
13702	esac
13703	;;
13704*)	getnetbyaddr_r_proto=0
13705	;;
13706esac
13707
13708: see if getnetbyname_r exists
13709set getnetbyname_r d_getnetbyname_r
13710eval $inlibc
13711case "$d_getnetbyname_r" in
13712"$define")
13713	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13714	case "$d_getnetbyname_r_proto:$usethreads" in
13715	":define")	d_getnetbyname_r_proto=define
13716		set d_getnetbyname_r_proto getnetbyname_r $hdrs
13717		eval $hasproto ;;
13718	*)	;;
13719	esac
13720	case "$d_getnetbyname_r_proto" in
13721	define)
13722	case "$getnetbyname_r_proto" in
13723	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13724	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13725	esac
13726	case "$getnetbyname_r_proto" in
13727	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13728	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13729	esac
13730	case "$getnetbyname_r_proto" in
13731	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13732	./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13733	esac
13734	case "$getnetbyname_r_proto" in
13735	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13736	./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13737	esac
13738	case "$getnetbyname_r_proto" in
13739	''|0)	d_getnetbyname_r=undef
13740 	        getnetbyname_r_proto=0
13741		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13742	* )	case "$getnetbyname_r_proto" in
13743		REENTRANT_PROTO*) ;;
13744		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13745		esac
13746		echo "Prototype: $try" ;;
13747	esac
13748	;;
13749	*)	case "$usethreads" in
13750		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13751		esac
13752		d_getnetbyname_r=undef
13753		getnetbyname_r_proto=0
13754		;;
13755	esac
13756	;;
13757*)	getnetbyname_r_proto=0
13758	;;
13759esac
13760
13761: see if getnetent_r exists
13762set getnetent_r d_getnetent_r
13763eval $inlibc
13764case "$d_getnetent_r" in
13765"$define")
13766	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13767	case "$d_getnetent_r_proto:$usethreads" in
13768	":define")	d_getnetent_r_proto=define
13769		set d_getnetent_r_proto getnetent_r $hdrs
13770		eval $hasproto ;;
13771	*)	;;
13772	esac
13773	case "$d_getnetent_r_proto" in
13774	define)
13775	case "$getnetent_r_proto" in
13776	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13777	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13778	esac
13779	case "$getnetent_r_proto" in
13780	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13781	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13782	esac
13783	case "$getnetent_r_proto" in
13784	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13785	./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13786	esac
13787	case "$getnetent_r_proto" in
13788	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13789	./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13790	esac
13791	case "$getnetent_r_proto" in
13792	''|0) try='int getnetent_r(struct netent*, char*, int);'
13793	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13794	esac
13795	case "$getnetent_r_proto" in
13796	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13797	./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13798	esac
13799	case "$getnetent_r_proto" in
13800	''|0)	d_getnetent_r=undef
13801 	        getnetent_r_proto=0
13802		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13803	* )	case "$getnetent_r_proto" in
13804		REENTRANT_PROTO*) ;;
13805		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13806		esac
13807		echo "Prototype: $try" ;;
13808	esac
13809	;;
13810	*)	case "$usethreads" in
13811		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13812		esac
13813		d_getnetent_r=undef
13814		getnetent_r_proto=0
13815		;;
13816	esac
13817	;;
13818*)	getnetent_r_proto=0
13819	;;
13820esac
13821
13822: see if prototypes for various getnetxxx netdb.h functions are available
13823echo " "
13824set d_getnetprotos getnetent $i_netdb netdb.h
13825eval $hasproto
13826
13827: see if getpagesize exists
13828set getpagesize d_getpagsz
13829eval $inlibc
13830
13831
13832: see if getprotobyname exists
13833set getprotobyname d_getpbyname
13834eval $inlibc
13835
13836: see if getprotobynumber exists
13837set getprotobynumber d_getpbynumber
13838eval $inlibc
13839
13840: see if getprotoent exists
13841set getprotoent d_getpent
13842eval $inlibc
13843
13844: see if getpgid exists
13845set getpgid d_getpgid
13846eval $inlibc
13847
13848: see if getpgrp2 exists
13849set getpgrp2 d_getpgrp2
13850eval $inlibc
13851
13852: see if getppid exists
13853set getppid d_getppid
13854eval $inlibc
13855
13856: see if getpriority exists
13857set getpriority d_getprior
13858eval $inlibc
13859
13860: see if getprotobyname_r exists
13861set getprotobyname_r d_getprotobyname_r
13862eval $inlibc
13863case "$d_getprotobyname_r" in
13864"$define")
13865	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13866	case "$d_getprotobyname_r_proto:$usethreads" in
13867	":define")	d_getprotobyname_r_proto=define
13868		set d_getprotobyname_r_proto getprotobyname_r $hdrs
13869		eval $hasproto ;;
13870	*)	;;
13871	esac
13872	case "$d_getprotobyname_r_proto" in
13873	define)
13874	case "$getprotobyname_r_proto" in
13875	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13876	./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13877	esac
13878	case "$getprotobyname_r_proto" in
13879	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13880	./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13881	esac
13882	case "$getprotobyname_r_proto" in
13883	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13884	./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13885	esac
13886	case "$getprotobyname_r_proto" in
13887	''|0)	d_getprotobyname_r=undef
13888 	        getprotobyname_r_proto=0
13889		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13890	* )	case "$getprotobyname_r_proto" in
13891		REENTRANT_PROTO*) ;;
13892		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13893		esac
13894		echo "Prototype: $try" ;;
13895	esac
13896	;;
13897	*)	case "$usethreads" in
13898		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13899		esac
13900		d_getprotobyname_r=undef
13901		getprotobyname_r_proto=0
13902		;;
13903	esac
13904	;;
13905*)	getprotobyname_r_proto=0
13906	;;
13907esac
13908
13909: see if getprotobynumber_r exists
13910set getprotobynumber_r d_getprotobynumber_r
13911eval $inlibc
13912case "$d_getprotobynumber_r" in
13913"$define")
13914	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13915	case "$d_getprotobynumber_r_proto:$usethreads" in
13916	":define")	d_getprotobynumber_r_proto=define
13917		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13918		eval $hasproto ;;
13919	*)	;;
13920	esac
13921	case "$d_getprotobynumber_r_proto" in
13922	define)
13923	case "$getprotobynumber_r_proto" in
13924	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13925	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13926	esac
13927	case "$getprotobynumber_r_proto" in
13928	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13929	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13930	esac
13931	case "$getprotobynumber_r_proto" in
13932	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13933	./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13934	esac
13935	case "$getprotobynumber_r_proto" in
13936	''|0)	d_getprotobynumber_r=undef
13937 	        getprotobynumber_r_proto=0
13938		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13939	* )	case "$getprotobynumber_r_proto" in
13940		REENTRANT_PROTO*) ;;
13941		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13942		esac
13943		echo "Prototype: $try" ;;
13944	esac
13945	;;
13946	*)	case "$usethreads" in
13947		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13948		esac
13949		d_getprotobynumber_r=undef
13950		getprotobynumber_r_proto=0
13951		;;
13952	esac
13953	;;
13954*)	getprotobynumber_r_proto=0
13955	;;
13956esac
13957
13958: see if getprotoent_r exists
13959set getprotoent_r d_getprotoent_r
13960eval $inlibc
13961case "$d_getprotoent_r" in
13962"$define")
13963	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13964	case "$d_getprotoent_r_proto:$usethreads" in
13965	":define")	d_getprotoent_r_proto=define
13966		set d_getprotoent_r_proto getprotoent_r $hdrs
13967		eval $hasproto ;;
13968	*)	;;
13969	esac
13970	case "$d_getprotoent_r_proto" in
13971	define)
13972	case "$getprotoent_r_proto" in
13973	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13974	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13975	esac
13976	case "$getprotoent_r_proto" in
13977	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13978	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13979	esac
13980	case "$getprotoent_r_proto" in
13981	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13982	./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13983	esac
13984	case "$getprotoent_r_proto" in
13985	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13986	./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13987	esac
13988	case "$getprotoent_r_proto" in
13989	''|0)	d_getprotoent_r=undef
13990 	        getprotoent_r_proto=0
13991		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13992	* )	case "$getprotoent_r_proto" in
13993		REENTRANT_PROTO*) ;;
13994		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13995		esac
13996		echo "Prototype: $try" ;;
13997	esac
13998	;;
13999	*)	case "$usethreads" in
14000		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14001		esac
14002		d_getprotoent_r=undef
14003		getprotoent_r_proto=0
14004		;;
14005	esac
14006	;;
14007*)	getprotoent_r_proto=0
14008	;;
14009esac
14010
14011: see if prototypes for various getprotoxxx netdb.h functions are available
14012echo " "
14013set d_getprotoprotos getprotoent $i_netdb netdb.h
14014eval $hasproto
14015
14016: see if getprpwnam exists
14017set getprpwnam d_getprpwnam
14018eval $inlibc
14019
14020: see if getpwent exists
14021set getpwent d_getpwent
14022eval $inlibc
14023
14024: see if getpwent_r exists
14025set getpwent_r d_getpwent_r
14026eval $inlibc
14027case "$d_getpwent_r" in
14028"$define")
14029	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14030	case "$d_getpwent_r_proto:$usethreads" in
14031	":define")	d_getpwent_r_proto=define
14032		set d_getpwent_r_proto getpwent_r $hdrs
14033		eval $hasproto ;;
14034	*)	;;
14035	esac
14036	case "$d_getpwent_r_proto" in
14037	define)
14038	case "$getpwent_r_proto" in
14039	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14040	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14041	esac
14042	case "$getpwent_r_proto" in
14043	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14044	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14045	esac
14046	case "$getpwent_r_proto" in
14047	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14048	./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14049	esac
14050	case "$getpwent_r_proto" in
14051	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14052	./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14053	esac
14054	case "$getpwent_r_proto" in
14055	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14056	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14057	esac
14058	case "$getpwent_r_proto" in
14059	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14060	./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14061	esac
14062	case "$getpwent_r_proto" in
14063	''|0)	d_getpwent_r=undef
14064 	        getpwent_r_proto=0
14065		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14066	* )	case "$getpwent_r_proto" in
14067		REENTRANT_PROTO*) ;;
14068		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14069		esac
14070		echo "Prototype: $try" ;;
14071	esac
14072	;;
14073	*)	case "$usethreads" in
14074		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14075		esac
14076		d_getpwent_r=undef
14077		getpwent_r_proto=0
14078		;;
14079	esac
14080	;;
14081*)	getpwent_r_proto=0
14082	;;
14083esac
14084
14085: see if getpwnam_r exists
14086set getpwnam_r d_getpwnam_r
14087eval $inlibc
14088case "$d_getpwnam_r" in
14089"$define")
14090	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14091	case "$d_getpwnam_r_proto:$usethreads" in
14092	":define")	d_getpwnam_r_proto=define
14093		set d_getpwnam_r_proto getpwnam_r $hdrs
14094		eval $hasproto ;;
14095	*)	;;
14096	esac
14097	case "$d_getpwnam_r_proto" in
14098	define)
14099	case "$getpwnam_r_proto" in
14100	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14101	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14102	esac
14103	case "$getpwnam_r_proto" in
14104	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14105	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14106	esac
14107	case "$getpwnam_r_proto" in
14108	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14109	./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14110	esac
14111	case "$getpwnam_r_proto" in
14112	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14113	./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14114	esac
14115	case "$getpwnam_r_proto" in
14116	''|0)	d_getpwnam_r=undef
14117 	        getpwnam_r_proto=0
14118		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14119	* )	case "$getpwnam_r_proto" in
14120		REENTRANT_PROTO*) ;;
14121		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14122		esac
14123		echo "Prototype: $try" ;;
14124	esac
14125	;;
14126	*)	case "$usethreads" in
14127		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14128		esac
14129		d_getpwnam_r=undef
14130		getpwnam_r_proto=0
14131		;;
14132	esac
14133	;;
14134*)	getpwnam_r_proto=0
14135	;;
14136esac
14137
14138: see if getpwuid_r exists
14139set getpwuid_r d_getpwuid_r
14140eval $inlibc
14141case "$d_getpwuid_r" in
14142"$define")
14143	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14144	case "$d_getpwuid_r_proto:$usethreads" in
14145	":define")	d_getpwuid_r_proto=define
14146		set d_getpwuid_r_proto getpwuid_r $hdrs
14147		eval $hasproto ;;
14148	*)	;;
14149	esac
14150	case "$d_getpwuid_r_proto" in
14151	define)
14152	case "$getpwuid_r_proto" in
14153	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14154	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14155	esac
14156	case "$getpwuid_r_proto" in
14157	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14158	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14159	esac
14160	case "$getpwuid_r_proto" in
14161	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14162	./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14163	esac
14164	case "$getpwuid_r_proto" in
14165	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14166	./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14167	esac
14168	case "$getpwuid_r_proto" in
14169	''|0)	d_getpwuid_r=undef
14170 	        getpwuid_r_proto=0
14171		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14172	* )	case "$getpwuid_r_proto" in
14173		REENTRANT_PROTO*) ;;
14174		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14175		esac
14176		echo "Prototype: $try" ;;
14177	esac
14178	;;
14179	*)	case "$usethreads" in
14180		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14181		esac
14182		d_getpwuid_r=undef
14183		getpwuid_r_proto=0
14184		;;
14185	esac
14186	;;
14187*)	getpwuid_r_proto=0
14188	;;
14189esac
14190
14191
14192: see if getservbyname exists
14193set getservbyname d_getsbyname
14194eval $inlibc
14195
14196: see if getservbyport exists
14197set getservbyport d_getsbyport
14198eval $inlibc
14199
14200: see if getservent exists
14201set getservent d_getsent
14202eval $inlibc
14203
14204: see if getservbyname_r exists
14205set getservbyname_r d_getservbyname_r
14206eval $inlibc
14207case "$d_getservbyname_r" in
14208"$define")
14209	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14210	case "$d_getservbyname_r_proto:$usethreads" in
14211	":define")	d_getservbyname_r_proto=define
14212		set d_getservbyname_r_proto getservbyname_r $hdrs
14213		eval $hasproto ;;
14214	*)	;;
14215	esac
14216	case "$d_getservbyname_r_proto" in
14217	define)
14218	case "$getservbyname_r_proto" in
14219	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14220	./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14221	esac
14222	case "$getservbyname_r_proto" in
14223	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14224	./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14225	esac
14226	case "$getservbyname_r_proto" in
14227	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14228	./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14229	esac
14230	case "$getservbyname_r_proto" in
14231	''|0)	d_getservbyname_r=undef
14232 	        getservbyname_r_proto=0
14233		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14234	* )	case "$getservbyname_r_proto" in
14235		REENTRANT_PROTO*) ;;
14236		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14237		esac
14238		echo "Prototype: $try" ;;
14239	esac
14240	;;
14241	*)	case "$usethreads" in
14242		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14243		esac
14244		d_getservbyname_r=undef
14245		getservbyname_r_proto=0
14246		;;
14247	esac
14248	;;
14249*)	getservbyname_r_proto=0
14250	;;
14251esac
14252
14253: see if getservbyport_r exists
14254set getservbyport_r d_getservbyport_r
14255eval $inlibc
14256case "$d_getservbyport_r" in
14257"$define")
14258	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14259	case "$d_getservbyport_r_proto:$usethreads" in
14260	":define")	d_getservbyport_r_proto=define
14261		set d_getservbyport_r_proto getservbyport_r $hdrs
14262		eval $hasproto ;;
14263	*)	;;
14264	esac
14265	case "$d_getservbyport_r_proto" in
14266	define)
14267	case "$getservbyport_r_proto" in
14268	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14269	./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14270	esac
14271	case "$getservbyport_r_proto" in
14272	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14273	./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14274	esac
14275	case "$getservbyport_r_proto" in
14276	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14277	./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14278	esac
14279	case "$getservbyport_r_proto" in
14280	''|0)	d_getservbyport_r=undef
14281 	        getservbyport_r_proto=0
14282		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14283	* )	case "$getservbyport_r_proto" in
14284		REENTRANT_PROTO*) ;;
14285		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14286		esac
14287		echo "Prototype: $try" ;;
14288	esac
14289	;;
14290	*)	case "$usethreads" in
14291		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14292		esac
14293		d_getservbyport_r=undef
14294		getservbyport_r_proto=0
14295		;;
14296	esac
14297	;;
14298*)	getservbyport_r_proto=0
14299	;;
14300esac
14301
14302: see if getservent_r exists
14303set getservent_r d_getservent_r
14304eval $inlibc
14305case "$d_getservent_r" in
14306"$define")
14307	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14308	case "$d_getservent_r_proto:$usethreads" in
14309	":define")	d_getservent_r_proto=define
14310		set d_getservent_r_proto getservent_r $hdrs
14311		eval $hasproto ;;
14312	*)	;;
14313	esac
14314	case "$d_getservent_r_proto" in
14315	define)
14316	case "$getservent_r_proto" in
14317	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14318	./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14319	esac
14320	case "$getservent_r_proto" in
14321	''|0) try='int getservent_r(struct servent*, char*, int);'
14322	./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14323	esac
14324	case "$getservent_r_proto" in
14325	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14326	./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14327	esac
14328	case "$getservent_r_proto" in
14329	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14330	./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14331	esac
14332	case "$getservent_r_proto" in
14333	''|0)	d_getservent_r=undef
14334 	        getservent_r_proto=0
14335		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14336	* )	case "$getservent_r_proto" in
14337		REENTRANT_PROTO*) ;;
14338		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14339		esac
14340		echo "Prototype: $try" ;;
14341	esac
14342	;;
14343	*)	case "$usethreads" in
14344		define) echo "getservent_r has no prototype, not using it." >&4 ;;
14345		esac
14346		d_getservent_r=undef
14347		getservent_r_proto=0
14348		;;
14349	esac
14350	;;
14351*)	getservent_r_proto=0
14352	;;
14353esac
14354
14355: see if prototypes for various getservxxx netdb.h functions are available
14356echo " "
14357set d_getservprotos getservent $i_netdb netdb.h
14358eval $hasproto
14359
14360: see if getspnam exists
14361set getspnam d_getspnam
14362eval $inlibc
14363
14364: see if this is a shadow.h system
14365set shadow.h i_shadow
14366eval $inhdr
14367
14368: see if getspnam_r exists
14369set getspnam_r d_getspnam_r
14370eval $inlibc
14371case "$d_getspnam_r" in
14372"$define")
14373	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14374	case "$d_getspnam_r_proto:$usethreads" in
14375	":define")	d_getspnam_r_proto=define
14376		set d_getspnam_r_proto getspnam_r $hdrs
14377		eval $hasproto ;;
14378	*)	;;
14379	esac
14380	case "$d_getspnam_r_proto" in
14381	define)
14382	case "$getspnam_r_proto" in
14383	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14384	./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14385	esac
14386	case "$getspnam_r_proto" in
14387	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14388	./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14389	esac
14390	case "$getspnam_r_proto" in
14391	''|0)	d_getspnam_r=undef
14392 	        getspnam_r_proto=0
14393		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14394	* )	case "$getspnam_r_proto" in
14395		REENTRANT_PROTO*) ;;
14396		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14397		esac
14398		echo "Prototype: $try" ;;
14399	esac
14400	;;
14401	*)	case "$usethreads" in
14402		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14403		esac
14404		d_getspnam_r=undef
14405		getspnam_r_proto=0
14406		;;
14407	esac
14408	;;
14409*)	getspnam_r_proto=0
14410	;;
14411esac
14412
14413: see if gettimeofday or ftime exists
14414set gettimeofday d_gettimeod
14415eval $inlibc
14416case "$d_gettimeod" in
14417"$undef")
14418	set ftime d_ftime
14419	eval $inlibc
14420	;;
14421*)
14422	val="$undef"; set d_ftime; eval $setvar
14423	;;
14424esac
14425case "$d_gettimeod$d_ftime" in
14426"$undef$undef")
14427	echo " "
14428	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14429	;;
14430esac
14431
14432: see if gmtime_r exists
14433set gmtime_r d_gmtime_r
14434eval $inlibc
14435case "$d_gmtime_r" in
14436"$define")
14437	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14438	case "$d_gmtime_r_proto:$usethreads" in
14439	":define")	d_gmtime_r_proto=define
14440		set d_gmtime_r_proto gmtime_r $hdrs
14441		eval $hasproto ;;
14442	*)	;;
14443	esac
14444	case "$d_gmtime_r_proto" in
14445	define)
14446	case "$gmtime_r_proto" in
14447	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14448	./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14449	esac
14450	case "$gmtime_r_proto" in
14451	''|0) try='int gmtime_r(const time_t*, struct tm*);'
14452	./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14453	esac
14454	case "$gmtime_r_proto" in
14455	''|0)	d_gmtime_r=undef
14456 	        gmtime_r_proto=0
14457		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14458	* )	case "$gmtime_r_proto" in
14459		REENTRANT_PROTO*) ;;
14460		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14461		esac
14462		echo "Prototype: $try" ;;
14463	esac
14464	;;
14465	*)	case "$usethreads" in
14466		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14467		esac
14468		d_gmtime_r=undef
14469		gmtime_r_proto=0
14470		;;
14471	esac
14472	;;
14473*)	gmtime_r_proto=0
14474	;;
14475esac
14476
14477: see if hasmntopt exists
14478set hasmntopt d_hasmntopt
14479eval $inlibc
14480
14481: see if this is a netinet/in.h or sys/in.h system
14482set netinet/in.h i_niin sys/in.h i_sysin
14483eval $inhdr
14484
14485: see if arpa/inet.h has to be included
14486set arpa/inet.h i_arpainet
14487eval $inhdr
14488
14489: see if htonl --and friends-- exists
14490val=''
14491set htonl val
14492eval $inlibc
14493
14494: Maybe they are macros.
14495case "$val" in
14496$undef)
14497	$cat >htonl.c <<EOM
14498#include <stdio.h>
14499#include <sys/types.h>
14500#$i_niin I_NETINET_IN
14501#$i_sysin I_SYS_IN
14502#$i_arpainet I_ARPA_INET
14503#ifdef I_NETINET_IN
14504#include <netinet/in.h>
14505#endif
14506#ifdef I_SYS_IN
14507#include <sys/in.h>
14508#endif
14509#ifdef I_ARPA_INET
14510#include <arpa/inet.h>
14511#endif
14512#ifdef htonl
14513printf("Defined as a macro.");
14514#endif
14515EOM
14516	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14517	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14518		val="$define"
14519		echo "But it seems to be defined as a macro." >&4
14520	fi
14521	$rm -f htonl.?
14522	;;
14523esac
14524set d_htonl
14525eval $setvar
14526
14527: see if ilogbl exists
14528set ilogbl d_ilogbl
14529eval $inlibc
14530
14531: index or strchr
14532echo " "
14533if set index val -f; eval $csym; $val; then
14534	if set strchr val -f d_strchr; eval $csym; $val; then
14535		if $contains strchr "$strings" >/dev/null 2>&1 ; then
14536			val="$define"
14537			vali="$undef"
14538			echo "strchr() found." >&4
14539		else
14540			val="$undef"
14541			vali="$define"
14542			echo "index() found." >&4
14543		fi
14544	else
14545		val="$undef"
14546		vali="$define"
14547		echo "index() found." >&4
14548	fi
14549else
14550	if set strchr val -f d_strchr; eval $csym; $val; then
14551		val="$define"
14552		vali="$undef"
14553		echo "strchr() found." >&4
14554	else
14555		echo "No index() or strchr() found!" >&4
14556		val="$undef"
14557		vali="$undef"
14558	fi
14559fi
14560set d_strchr; eval $setvar
14561val="$vali"
14562set d_index; eval $setvar
14563
14564: check whether inet_aton exists
14565set inet_aton d_inetaton
14566eval $inlibc
14567
14568: Look for isascii
14569echo " "
14570$cat >isascii.c <<EOCP
14571#include <stdio.h>
14572#include <ctype.h>
14573#$i_stdlib I_STDLIB
14574#ifdef I_STDLIB
14575#include <stdlib.h>
14576#endif
14577int main() {
14578	int c = 'A';
14579	if (isascii(c))
14580		exit(0);
14581	else
14582		exit(1);
14583}
14584EOCP
14585set isascii
14586if eval $compile; then
14587	echo "isascii() found." >&4
14588	val="$define"
14589else
14590	echo "isascii() NOT found." >&4
14591	val="$undef"
14592fi
14593set d_isascii
14594eval $setvar
14595$rm -f isascii*
14596
14597: see if isfinite exists
14598set isfinite d_isfinite
14599eval $inlibc
14600
14601: see if isinf exists
14602set isinf d_isinf
14603eval $inlibc
14604
14605: see if isnan exists
14606set isnan d_isnan
14607eval $inlibc
14608
14609: see if isnanl exists
14610set isnanl d_isnanl
14611eval $inlibc
14612
14613: see if killpg exists
14614set killpg d_killpg
14615eval $inlibc
14616
14617: see if lchown exists
14618echo " "
14619$cat > try.c <<'EOCP'
14620/* System header to define __stub macros and hopefully few prototypes,
14621    which can conflict with char lchown(); below.  */
14622#include <assert.h>
14623/* Override any gcc2 internal prototype to avoid an error.  */
14624/* We use char because int might match the return type of a gcc2
14625   builtin and then its argument prototype would still apply.  */
14626char lchown();
14627int main() {
14628    /*  The GNU C library defines this for functions which it implements
14629        to always fail with ENOSYS.  Some functions are actually named
14630	something starting with __ and the normal name is an alias.  */
14631#if defined (__stub_lchown) || defined (__stub___lchown)
14632choke me
14633#else
14634lchown();
14635#endif
14636; return 0; }
14637EOCP
14638set try
14639if eval $compile; then
14640    $echo "lchown() found." >&4
14641    val="$define"
14642else
14643    $echo "lchown() NOT found." >&4
14644    val="$undef"
14645fi
14646set d_lchown
14647eval $setvar
14648
14649: See if number of significant digits in a double precision number is known
14650echo " "
14651$cat >ldbl_dig.c <<EOM
14652#$i_limits I_LIMITS
14653#$i_float I_FLOAT
14654#ifdef I_LIMITS
14655#include <limits.h>
14656#endif
14657#ifdef I_FLOAT
14658#include <float.h>
14659#endif
14660#ifdef LDBL_DIG
14661printf("Contains LDBL_DIG");
14662#endif
14663EOM
14664$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14665if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14666	echo "LDBL_DIG found." >&4
14667	val="$define"
14668else
14669	echo "LDBL_DIG NOT found." >&4
14670	val="$undef"
14671fi
14672$rm -f ldbl_dig.?
14673set d_ldbl_dig
14674eval $setvar
14675
14676: see if this is a math.h system
14677set math.h i_math
14678eval $inhdr
14679
14680d_libm_lib_version="$undef"
14681case $i_math in
14682    $define)
14683	: check to see if math.h defines _LIB_VERSION
14684	echo " "
14685	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14686	$cat >try.c <<EOCP
14687#include <unistd.h>
14688#include <math.h>
14689int main (int argc, char *argv[])
14690{
14691    printf ("%d\n", _LIB_VERSION);
14692    return (0);
14693    } /* main */
14694EOCP
14695	set try
14696	if eval $compile; then
14697	    foo=`$run ./try`
14698	    echo "Yes, it does ($foo)" >&4
14699	    d_libm_lib_version="$define"
14700	else
14701	    echo "No, it does not (probably harmless)" >&4
14702	    fi
14703	$rm_try
14704	;;
14705
14706    esac
14707
14708: see if link exists
14709set link d_link
14710eval $inlibc
14711
14712: see if localtime_r exists
14713set localtime_r d_localtime_r
14714eval $inlibc
14715case "$d_localtime_r" in
14716"$define")
14717	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14718	case "$d_localtime_r_proto:$usethreads" in
14719	":define")	d_localtime_r_proto=define
14720		set d_localtime_r_proto localtime_r $hdrs
14721		eval $hasproto ;;
14722	*)	;;
14723	esac
14724	case "$d_localtime_r_proto" in
14725	define)
14726	case "$localtime_r_proto" in
14727	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14728	./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14729	esac
14730	case "$localtime_r_proto" in
14731	''|0) try='int localtime_r(const time_t*, struct tm*);'
14732	./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14733	esac
14734	case "$localtime_r_proto" in
14735	''|0)	d_localtime_r=undef
14736 	        localtime_r_proto=0
14737		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14738	* )	case "$localtime_r_proto" in
14739		REENTRANT_PROTO*) ;;
14740		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14741		esac
14742		echo "Prototype: $try" ;;
14743	esac
14744	;;
14745	*)	case "$usethreads" in
14746		define) echo "localtime_r has no prototype, not using it." >&4 ;;
14747		esac
14748		d_localtime_r=undef
14749		localtime_r_proto=0
14750		;;
14751	esac
14752	;;
14753*)	localtime_r_proto=0
14754	;;
14755esac
14756
14757: see if localtime_r calls tzset
14758case "$localtime_r_proto" in
14759REENTRANT_PROTO*)
14760	$cat >try.c <<EOCP
14761/*  Does our libc's localtime_r call tzset ?
14762 *  return 0 if so, 1 otherwise.
14763 */
14764#include <sys/types.h>
14765#include <unistd.h>
14766#include <time.h>
14767#include <string.h>
14768#include <malloc.h>
14769int main()
14770{
14771    time_t t = time(0L);
14772    char w_tz[]="TZ" "=GMT+5",
14773	 e_tz[]="TZ" "=GMT-5",
14774	*tz_e = (char*)malloc(16),
14775	*tz_w = (char*)malloc(16);
14776    struct tm tm_e, tm_w;
14777    memset(&tm_e,'\0',sizeof(struct tm));
14778    memset(&tm_w,'\0',sizeof(struct tm));
14779    strcpy(tz_e,e_tz);
14780    strcpy(tz_w,w_tz);
14781
14782    putenv(tz_e);
14783    localtime_r(&t, &tm_e);
14784
14785    putenv(tz_w);
14786    localtime_r(&t, &tm_w);
14787
14788    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14789	return 1;
14790    return 0;
14791}
14792EOCP
14793	set try
14794	if eval $compile; then
14795	    if $run ./try; then
14796		d_localtime_r_needs_tzset=undef;
14797	    else
14798		d_localtime_r_needs_tzset=define;
14799	    fi;
14800	else
14801	    d_localtime_r_needs_tzset=undef;
14802	fi;
14803     ;;
14804  *)
14805     d_localtime_r_needs_tzset=undef;
14806     ;;
14807esac
14808$rm_try
14809
14810: see if localeconv exists
14811set localeconv d_locconv
14812eval $inlibc
14813
14814: see if lockf exists
14815set lockf d_lockf
14816eval $inlibc
14817
14818: see if prototype for lseek is available
14819echo " "
14820set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14821eval $hasproto
14822
14823: see if lstat exists
14824set lstat d_lstat
14825eval $inlibc
14826
14827: see if madvise exists
14828set madvise d_madvise
14829eval $inlibc
14830
14831: see if malloc_size exists
14832set malloc_size d_malloc_size
14833eval $inlibc
14834
14835: see if malloc_size_good exists
14836set malloc_good_size d_malloc_good_size
14837eval $inlibc
14838
14839: see if mblen exists
14840set mblen d_mblen
14841eval $inlibc
14842
14843: see if mbstowcs exists
14844set mbstowcs d_mbstowcs
14845eval $inlibc
14846
14847: see if mbtowc exists
14848set mbtowc d_mbtowc
14849eval $inlibc
14850
14851: see if memchr exists
14852set memchr d_memchr
14853eval $inlibc
14854
14855: see if memcmp exists
14856set memcmp d_memcmp
14857eval $inlibc
14858
14859: see if memcpy exists
14860set memcpy d_memcpy
14861eval $inlibc
14862
14863: see if memmove exists
14864set memmove d_memmove
14865eval $inlibc
14866
14867: see if memset exists
14868set memset d_memset
14869eval $inlibc
14870
14871: see if mkdir exists
14872set mkdir d_mkdir
14873eval $inlibc
14874
14875: see if mkdtemp exists
14876set mkdtemp d_mkdtemp
14877eval $inlibc
14878
14879: see if mkfifo exists
14880set mkfifo d_mkfifo
14881eval $inlibc
14882
14883: see if mkstemp exists
14884set mkstemp d_mkstemp
14885eval $inlibc
14886
14887: see if mkstemps exists
14888set mkstemps d_mkstemps
14889eval $inlibc
14890
14891: see if mktime exists
14892set mktime d_mktime
14893eval $inlibc
14894
14895: see if this is a sys/mman.h system
14896set sys/mman.h i_sysmman
14897eval $inhdr
14898
14899: see if mmap exists
14900set mmap d_mmap
14901eval $inlibc
14902: see what shmat returns
14903: default to something harmless
14904mmaptype='void *'
14905case "$i_sysmman$d_mmap" in
14906"$define$define")
14907	$cat >mmap.c <<'END'
14908#include <sys/mman.h>
14909void *mmap();
14910END
14911	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14912		mmaptype='void *'
14913	else
14914		mmaptype='caddr_t'
14915	fi
14916	echo "and it returns ($mmaptype)." >&4
14917	;;
14918esac
14919
14920
14921
14922: see if sqrtl exists
14923set sqrtl d_sqrtl
14924eval $inlibc
14925
14926: see if scalbnl exists
14927set scalbnl d_scalbnl
14928eval $inlibc
14929
14930: see if modfl exists
14931set modfl d_modfl
14932eval $inlibc
14933
14934: see if prototype for modfl is available
14935echo " "
14936set d_modflproto modfl $i_math math.h
14937eval $hasproto
14938
14939d_modfl_pow32_bug="$undef"
14940
14941case "$d_longdbl$d_modfl" in
14942$define$define)
14943	$cat <<EOM
14944Checking to see whether your modfl() is okay for large values...
14945EOM
14946$cat >try.c <<EOCP
14947#include <math.h>
14948#include <stdio.h>
14949EOCP
14950if $test "X$d_modflproto" != "X$define"; then
14951	$cat >>try.c <<EOCP
14952/* Sigh. many current glibcs provide the function, but do not prototype it. */
14953long double modfl (long double, long double *);
14954EOCP
14955fi
14956$cat >>try.c <<EOCP
14957int main() {
14958    long double nv = 4294967303.15;
14959    long double v, w;
14960    v = modfl(nv, &w);
14961#ifdef __GLIBC__
14962    printf("glibc");
14963#endif
14964    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14965    return 0;
14966}
14967EOCP
14968	case "$osname:$gccversion" in
14969	aix:)	saveccflags="$ccflags"
14970		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14971	esac
14972	set try
14973	if eval $compile; then
14974		foo=`$run ./try`
14975		case "$foo" in
14976		*" 4294967303.150000 1.150000 4294967302.000000")
14977			echo >&4 "Your modfl() is broken for large values."
14978			d_modfl_pow32_bug="$define"
14979			case "$foo" in
14980			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14981			;;
14982			esac
14983			;;
14984		*" 4294967303.150000 0.150000 4294967303.000000")
14985			echo >&4 "Your modfl() seems okay for large values."
14986			;;
14987		*)	echo >&4 "I don't understand your modfl() at all."
14988			d_modfl="$undef"
14989			;;
14990		esac
14991		$rm_try
14992	else
14993		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14994		d_modfl="$undef"
14995	fi
14996	case "$osname:$gccversion" in
14997	aix:)	ccflags="$saveccflags" ;; # restore
14998	esac
14999	;;
15000esac
15001
15002if $test "$uselongdouble" = "$define"; then
15003    message=""
15004    if $test "$d_sqrtl" != "$define"; then
15005	message="$message sqrtl"
15006    fi
15007    if $test "$d_modfl" != "$define"; then
15008	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15009	    echo "You have both aintl and copysignl, so I can emulate modfl."
15010	else
15011	    message="$message modfl"
15012	fi
15013    fi
15014    if $test "$d_frexpl" != "$define"; then
15015	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15016	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15017	else
15018	    message="$message frexpl"
15019	fi
15020    fi
15021
15022    if $test "$message" != ""; then
15023	$cat <<EOM >&4
15024
15025*** You requested the use of long doubles but you do not seem to have
15026*** the following mathematical functions needed for long double support:
15027***    $message
15028*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15029*** Cannot continue, aborting.
15030
15031EOM
15032
15033	exit 1
15034    fi
15035fi
15036
15037: see if mprotect exists
15038set mprotect d_mprotect
15039eval $inlibc
15040
15041: see if msgctl exists
15042set msgctl d_msgctl
15043eval $inlibc
15044
15045: see if msgget exists
15046set msgget d_msgget
15047eval $inlibc
15048
15049: see if msgsnd exists
15050set msgsnd d_msgsnd
15051eval $inlibc
15052
15053: see if msgrcv exists
15054set msgrcv d_msgrcv
15055eval $inlibc
15056
15057: see how much of the 'msg*(2)' library is present.
15058h_msg=true
15059echo " "
15060case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15061*"$undef"*) h_msg=false;;
15062esac
15063case "$osname" in
15064freebsd)
15065    case "`ipcs 2>&1`" in
15066    "SVID messages"*"not configured"*)
15067	echo "Your $osname does not have the msg*(2) configured." >&4
15068        h_msg=false
15069	val="$undef"
15070	set msgctl d_msgctl
15071	eval $setvar
15072	set msgget d_msgget
15073	eval $setvar
15074	set msgsnd d_msgsnd
15075	eval $setvar
15076	set msgrcv d_msgrcv
15077	eval $setvar
15078	;;
15079    esac
15080    ;;
15081esac
15082: we could also check for sys/ipc.h ...
15083if $h_msg && $test `./findhdr sys/msg.h`; then
15084	echo "You have the full msg*(2) library." >&4
15085	val="$define"
15086else
15087	echo "You don't have the full msg*(2) library." >&4
15088	val="$undef"
15089fi
15090set d_msg
15091eval $setvar
15092
15093
15094echo " "
15095echo "Checking to see if your system supports struct msghdr..." >&4
15096set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15097eval $hasstruct
15098case "$d_msghdr_s" in
15099"$define")      echo "Yes, it does."   ;;
15100*)              echo "No, it doesn't." ;;
15101esac
15102
15103
15104: see if msync exists
15105set msync d_msync
15106eval $inlibc
15107
15108: see if munmap exists
15109set munmap d_munmap
15110eval $inlibc
15111
15112: see if nice exists
15113set nice d_nice
15114eval $inlibc
15115
15116: see if this is a langinfo.h system
15117set langinfo.h i_langinfo
15118eval $inhdr
15119
15120: see if nl_langinfo exists
15121set nl_langinfo d_nl_langinfo
15122eval $inlibc
15123
15124: check for volatile keyword
15125echo " "
15126echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15127$cat >try.c <<'EOCP'
15128int main()
15129{
15130	typedef struct _goo_struct goo_struct;
15131	goo_struct * volatile goo = ((goo_struct *)0);
15132	struct _goo_struct {
15133		long long_int;
15134		int reg_int;
15135		char char_var;
15136	};
15137	typedef unsigned short foo_t;
15138	char *volatile foo;
15139	volatile int bar;
15140	volatile foo_t blech;
15141	foo = foo;
15142}
15143EOCP
15144if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15145	val="$define"
15146	echo "Yup, it does."
15147else
15148	val="$undef"
15149	echo "Nope, it doesn't."
15150fi
15151set d_volatile
15152eval $setvar
15153$rm_try
15154
15155
15156echo " "
15157$echo "Choosing the C types to be used for Perl's internal types..." >&4
15158
15159case "$use64bitint:$d_quad:$quadtype" in
15160define:define:?*)
15161	ivtype="$quadtype"
15162	uvtype="$uquadtype"
15163	ivsize=8
15164	uvsize=8
15165	;;
15166*)	ivtype="long"
15167	uvtype="unsigned long"
15168	ivsize=$longsize
15169	uvsize=$longsize
15170	;;
15171esac
15172
15173case "$uselongdouble:$d_longdbl" in
15174define:define)
15175	nvtype="long double"
15176	nvsize=$longdblsize
15177	;;
15178*)	nvtype=double
15179	nvsize=$doublesize
15180	;;
15181esac
15182
15183$echo "(IV will be "$ivtype", $ivsize bytes)"
15184$echo "(UV will be "$uvtype", $uvsize bytes)"
15185$echo "(NV will be "$nvtype", $nvsize bytes)"
15186
15187$cat >try.c <<EOCP
15188#$i_inttypes I_INTTYPES
15189#ifdef I_INTTYPES
15190#include <inttypes.h>
15191#endif
15192#include <stdio.h>
15193int main() {
15194#ifdef INT8
15195   int8_t i =  INT8_MAX;
15196  uint8_t u = UINT8_MAX;
15197  printf("int8_t\n");
15198#endif
15199#ifdef INT16
15200   int16_t i =  INT16_MAX;
15201  uint16_t i = UINT16_MAX;
15202  printf("int16_t\n");
15203#endif
15204#ifdef INT32
15205   int32_t i =  INT32_MAX;
15206  uint32_t u = UINT32_MAX;
15207  printf("int32_t\n");
15208#endif
15209}
15210EOCP
15211
15212i8type=char
15213u8type="unsigned char"
15214i8size=1
15215u8size=1
15216
15217case "$i16type" in
15218'')	case "$shortsize" in
15219	2)	i16type=short
15220		u16type="unsigned short"
15221		i16size=$shortsize
15222		u16size=$shortsize
15223		;;
15224	esac
15225	;;
15226esac
15227case "$i16type" in
15228'')	set try -DINT16
15229	if eval $compile; then
15230		case "`$run ./try`" in
15231		int16_t)
15232			i16type=int16_t
15233			u16type=uint16_t
15234			i16size=2
15235			u16size=2
15236			;;
15237		esac
15238	fi
15239	;;
15240esac
15241case "$i16type" in
15242'')	if $test $shortsize -ge 2; then
15243		i16type=short
15244		u16type="unsigned short"
15245		i16size=$shortsize
15246		u16size=$shortsize
15247	fi
15248	;;
15249esac
15250
15251case "$i32type" in
15252'')	case "$longsize" in
15253	4)	i32type=long
15254		u32type="unsigned long"
15255		i32size=$longsize
15256		u32size=$longsize
15257		;;
15258	*)	case "$intsize" in
15259		4)	i32type=int
15260			u32type="unsigned int"
15261			i32size=$intsize
15262			u32size=$intsize
15263			;;
15264		esac
15265		;;
15266	esac
15267	;;
15268esac
15269case "$i32type" in
15270'')	set try -DINT32
15271	if eval $compile; then
15272		case "`$run ./try`" in
15273		int32_t)
15274			i32type=int32_t
15275			u32type=uint32_t
15276			i32size=4
15277			u32size=4
15278			;;
15279		esac
15280	fi
15281	;;
15282esac
15283case "$i32type" in
15284'')	if $test $intsize -ge 4; then
15285		i32type=int
15286		u32type="unsigned int"
15287		i32size=$intsize
15288		u32size=$intsize
15289	fi
15290	;;
15291esac
15292
15293case "$i64type" in
15294'')	case "$d_quad:$quadtype" in
15295	define:?*)
15296		i64type="$quadtype"
15297		u64type="$uquadtype"
15298		i64size=8
15299		u64size=8
15300		;;
15301	esac
15302	;;
15303esac
15304
15305$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15306: volatile so that the compiler has to store it out to memory.
15307if test X"$d_volatile" = X"$define"; then
15308	volatile=volatile
15309fi
15310$cat <<EOP >try.c
15311#include <stdio.h>
15312#$i_stdlib I_STDLIB
15313#ifdef I_STDLIB
15314#include <stdlib.h>
15315#endif
15316#include <sys/types.h>
15317#include <signal.h>
15318#ifdef SIGFPE
15319$volatile int bletched = 0;
15320$signal_t blech(int s) { bletched = 1; }
15321#endif
15322int main() {
15323    $uvtype u = 0;
15324    $nvtype d;
15325    int     n = 8 * $uvsize;
15326    int     i;
15327#ifdef SIGFPE
15328    signal(SIGFPE, blech);
15329#endif
15330
15331    for (i = 0; i < n; i++) {
15332      u = u << 1 | ($uvtype)1;
15333      d = ($nvtype)u;
15334      if (($uvtype)d != u)
15335        break;
15336      if (d <= 0)
15337	break;
15338      d = ($nvtype)(u - 1);
15339      if (($uvtype)d != (u - 1))
15340        break;
15341#ifdef SIGFPE
15342      if (bletched)
15343	break;
15344#endif
15345    }
15346    printf("%d\n", ((i == n) ? -n : i));
15347    exit(0);
15348}
15349EOP
15350set try
15351
15352d_nv_preserves_uv="$undef"
15353if eval $compile; then
15354	nv_preserves_uv_bits="`$run ./try`"
15355fi
15356case "$nv_preserves_uv_bits" in
15357\-[1-9]*)
15358	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15359	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15360	d_nv_preserves_uv="$define"
15361	;;
15362[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15363	d_nv_preserves_uv="$undef" ;;
15364*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
15365	nv_preserves_uv_bits="0" ;;
15366esac
15367$rm_try
15368
15369$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15370: volatile so that the compiler has to store it out to memory.
15371if test X"$d_volatile" = X"$define"; then
15372	volatile=volatile
15373fi
15374$cat <<EOP >try.c
15375#include <stdio.h>
15376#$i_stdlib I_STDLIB
15377#ifdef I_STDLIB
15378#include <stdlib.h>
15379#endif
15380#$i_string I_STRING
15381#ifdef I_STRING
15382#  include <string.h>
15383#else
15384#  include <strings.h>
15385#endif
15386#include <sys/types.h>
15387#include <signal.h>
15388#ifdef SIGFPE
15389$volatile int bletched = 0;
15390$signal_t blech(int s) { bletched = 1; }
15391#endif
15392
15393int checkit($nvtype d, char *where) {
15394    unsigned char *p = (char *)&d;
15395    unsigned char *end = p + sizeof(d);
15396    int fail = 0;
15397
15398    while (p < end)
15399	fail += *p++;
15400
15401    if (!fail)
15402	return 0;
15403
15404    p = (char *)&d;
15405    printf("No - %s: 0x", where);
15406    while (p < end)
15407	printf ("%02X", *p++);
15408    printf("\n");
15409    return 1;
15410}
15411
15412int main(int argc, char **argv) {
15413    $nvtype d = 0.0;
15414    int fail = 0;
15415    fail += checkit(d, "0.0");
15416
15417    /* The compiler shouldn't be assuming that bletched is 0  */
15418    d = bletched;
15419
15420    fail += checkit(d, "bleched");
15421
15422#ifdef SIGFPE
15423    signal(SIGFPE, blech);
15424#endif
15425
15426    /* Paranoia - the compiler should have no way of knowing that ANSI says
15427       that argv[argc] will always be NULL.  Actually, if it did assume this it
15428       would be buggy, as this is C and main() can be called from elsewhere in
15429       the program.  */
15430    d = argv[argc] ? 1 : 0;
15431
15432    if (d) {
15433	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15434    }
15435
15436    fail += checkit(d, "ternary");
15437
15438    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15439
15440    if (d != 0.0) {
15441	printf("No - memset doesn't give 0.0\n");
15442	/* This might just blow up:  */
15443	printf("(gives %g)\n", d);
15444	return 1;
15445    }
15446
15447#ifdef SIGFPE
15448    if (bletched) {
15449	printf("No - something bleched\n");
15450	return 1;
15451    }
15452#endif
15453    if (fail) {
15454      printf("No - %d fail(s)\n", fail);
15455      return 1;
15456    }
15457    printf("Yes\n");
15458    return 0;
15459}
15460EOP
15461set try
15462
15463d_nv_zero_is_allbits_zero="$undef"
15464if eval $compile; then
15465    xxx="`$run ./try`"
15466    case "$?" in
15467	0)
15468	    case "$xxx" in
15469		Yes)  cat >&4 <<EOM
154700.0 is represented as all bits zero in memory
15471EOM
15472		    d_nv_zero_is_allbits_zero="$define"
15473		    ;;
15474		*)  cat >&4 <<EOM
154750.0 is not represented as all bits zero in memory
15476EOM
15477		    d_nv_zero_is_allbits_zero="$undef"
15478		    ;;
15479	    esac
15480	    ;;
15481	*)  cat >&4 <<EOM
154820.0 is not represented as all bits zero in memory
15483EOM
15484	    d_nv_zero_is_allbits_zero="$undef"
15485	    ;;
15486    esac
15487fi
15488$rm_try
15489
15490: check for off64_t
15491echo " "
15492echo "Checking to see if you have off64_t..." >&4
15493$cat >try.c <<EOCP
15494#include <sys/types.h>
15495#include <unistd.h>
15496int main() { off64_t x = 7; }
15497EOCP
15498set try
15499if eval $compile; then
15500	val="$define"
15501	echo "You have off64_t."
15502else
15503	val="$undef"
15504	echo "You do not have off64_t."
15505	case "$lseeksize" in
15506	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15507	esac
15508fi
15509$rm_try
15510set d_off64_t
15511eval $setvar
15512
15513: how to create joinable pthreads
15514if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15515	echo " "
15516	echo "Checking what constant to use for creating joinable pthreads..." >&4
15517	$cat >try.c <<'EOCP'
15518#include <pthread.h>
15519int main() {
15520    int detachstate = JOINABLE;
15521}
15522EOCP
15523	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15524	if eval $compile; then
15525		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15526		val="$undef" # Yes, undef.
15527		set d_old_pthread_create_joinable
15528		eval $setvar
15529		val=""
15530		set old_pthread_create_joinable
15531		eval $setvar
15532	else
15533		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15534		if eval $compile; then
15535			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15536			val="$define"
15537			set d_old_pthread_create_joinable
15538			eval $setvar
15539			val=PTHREAD_CREATE_UNDETACHED
15540			set old_pthread_create_joinable
15541			eval $setvar
15542		else
15543			set try -DJOINABLE=__UNDETACHED
15544			if eval $compile; then
15545				echo "You seem to use __UNDETACHED." >&4
15546				val="$define"
15547				set d_old_pthread_create_joinable
15548				eval $setvar
15549				val=__UNDETACHED
15550				set old_pthread_create_joinable
15551				eval $setvar
15552			else
15553				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15554				val="$define"
15555				set d_old_pthread_create_joinable
15556				eval $setvar
15557				val=0
15558				set old_pthread_create_joinable
15559				eval $setvar
15560			fi
15561		fi
15562	fi
15563	$rm_try
15564else
15565    d_old_pthread_create_joinable="$undef"
15566    old_pthread_create_joinable=""
15567fi
15568
15569: see if pause exists
15570set pause d_pause
15571eval $inlibc
15572
15573: see if poll exists
15574set poll d_poll
15575eval $inlibc
15576
15577: see if readlink exists
15578set readlink d_readlink
15579eval $inlibc
15580
15581echo " "
15582procselfexe=''
15583val="$undef"
15584case "$d_readlink" in
15585"$define")
15586	if $issymlink /proc/self/exe ; then
15587		$ls -l /proc/self/exe > reflect
15588		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15589			echo "You have Linux-like /proc/self/exe."
15590			procselfexe='"/proc/self/exe"'
15591			val="$define"
15592		fi
15593	fi
15594	if $issymlink /proc/curproc/file ; then
15595		$ls -l /proc/curproc/file > reflect
15596		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15597			echo "You have BSD-like /proc/curproc/file."
15598			procselfexe='"/proc/curproc/file"'
15599			val="$define"
15600		fi
15601	fi
15602	;;
15603esac
15604$rm -f reflect
15605set d_procselfexe
15606eval $setvar
15607
15608: backward compatibility for d_hvfork
15609if test X$d_hvfork != X; then
15610	d_vfork="$d_hvfork"
15611	d_hvfork=''
15612fi
15613: see if there is a vfork
15614val=''
15615set vfork val
15616eval $inlibc
15617
15618d_pseudofork=$undef
15619
15620: Ok, but do we want to use it. vfork is reportedly unreliable in
15621: perl on Solaris 2.x, and probably elsewhere.
15622case "$val" in
15623$define)
15624	echo " "
15625	case "$usevfork" in
15626	false) dflt='n';;
15627	*) dflt='y';;
15628	esac
15629	cat <<'EOM'
15630
15631Perl can only use a vfork() that doesn't suffer from strict
15632restrictions on calling functions or modifying global data in
15633the child.  For example, glibc-2.1 contains such a vfork()
15634that is unsuitable.  If your system provides a proper fork()
15635call, chances are that you do NOT want perl to use vfork().
15636
15637EOM
15638	rp="Do you still want to use vfork()?"
15639	. ./myread
15640	case "$ans" in
15641	y|Y) ;;
15642	*)
15643		echo "Ok, we won't use vfork()."
15644		val="$undef"
15645		;;
15646	esac
15647	;;
15648esac
15649set d_vfork
15650eval $setvar
15651case "$d_vfork" in
15652$define) usevfork='true';;
15653*) usevfork='false';;
15654esac
15655
15656: see whether the pthread_atfork exists
15657$cat >try.c <<EOP
15658#include <pthread.h>
15659#include <stdio.h>
15660int main() {
15661#ifdef  PTHREAD_ATFORK
15662        pthread_atfork(NULL,NULL,NULL);
15663#endif
15664}
15665EOP
15666
15667: see if pthread_atfork exists
15668set try -DPTHREAD_ATFORK
15669if eval $compile; then
15670    val="$define"
15671else
15672    val="$undef"
15673fi
15674case "$usethreads" in
15675$define)
15676        case "$val" in
15677        $define) echo 'pthread_atfork found.' >&4        ;;
15678        *)       echo 'pthread_atfork NOT found.' >&4    ;;
15679        esac
15680esac
15681set d_pthread_atfork
15682eval $setvar
15683
15684: see if pthread_attr_setscope exists
15685set pthread_attr_setscope d_pthread_attr_setscope
15686eval $inlibc
15687
15688
15689: see whether the various POSIXish _yields exist
15690$cat >try.c <<EOP
15691#include <pthread.h>
15692#include <stdio.h>
15693int main() {
15694#ifdef SCHED_YIELD
15695	sched_yield();
15696#else
15697#ifdef PTHREAD_YIELD
15698	pthread_yield();
15699#else
15700#ifdef PTHREAD_YIELD_NULL
15701	pthread_yield(NULL);
15702#endif
15703#endif
15704#endif
15705}
15706EOP
15707: see if sched_yield exists
15708set try -DSCHED_YIELD
15709if eval $compile; then
15710    val="$define"
15711    sched_yield='sched_yield()'
15712else
15713    val="$undef"
15714fi
15715case "$usethreads" in
15716$define)
15717	case "$val" in
15718	$define) echo 'sched_yield() found.' >&4	;;
15719	*)	 echo 'sched_yield() NOT found.' >&4	;;
15720	esac
15721esac
15722set d_sched_yield
15723eval $setvar
15724
15725: see if pthread_yield exists
15726set try -DPTHREAD_YIELD
15727if eval $compile; then
15728    val="$define"
15729    case "$sched_yield" in
15730    '') sched_yield='pthread_yield()' ;;
15731    esac
15732else
15733    set try -DPTHREAD_YIELD_NULL
15734    if eval $compile; then
15735	val="$define"
15736	case "$sched_yield" in
15737	'') sched_yield='pthread_yield(NULL)' ;;
15738	esac
15739    else
15740	val="$undef"
15741    fi
15742fi
15743case "$usethreads" in
15744$define)
15745	case "$val" in
15746	$define) echo 'pthread_yield() found.' >&4	;;
15747	*)	 echo 'pthread_yield() NOT found.' >&4	;;
15748	esac
15749	;;
15750esac
15751set d_pthread_yield
15752eval $setvar
15753case "$sched_yield" in
15754'') sched_yield=undef ;;
15755esac
15756$rm_try
15757
15758: see if random_r exists
15759set random_r d_random_r
15760eval $inlibc
15761case "$d_random_r" in
15762"$define")
15763	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15764	case "$d_random_r_proto:$usethreads" in
15765	":define")	d_random_r_proto=define
15766		set d_random_r_proto random_r $hdrs
15767		eval $hasproto ;;
15768	*)	;;
15769	esac
15770	case "$d_random_r_proto" in
15771	define)
15772	case "$random_r_proto" in
15773	''|0) try='int random_r(int*, struct random_data*);'
15774	./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15775	esac
15776	case "$random_r_proto" in
15777	''|0) try='int random_r(long*, struct random_data*);'
15778	./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15779	esac
15780	case "$random_r_proto" in
15781	''|0) try='int random_r(struct random_data*, int32_t*);'
15782	./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15783	esac
15784	case "$random_r_proto" in
15785	''|0)	d_random_r=undef
15786 	        random_r_proto=0
15787		echo "Disabling random_r, cannot determine prototype." >&4 ;;
15788	* )	case "$random_r_proto" in
15789		REENTRANT_PROTO*) ;;
15790		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15791		esac
15792		echo "Prototype: $try" ;;
15793	esac
15794	;;
15795	*)	case "$usethreads" in
15796		define) echo "random_r has no prototype, not using it." >&4 ;;
15797		esac
15798		d_random_r=undef
15799		random_r_proto=0
15800		;;
15801	esac
15802	;;
15803*)	random_r_proto=0
15804	;;
15805esac
15806
15807: see if readdir and friends exist
15808set readdir d_readdir
15809eval $inlibc
15810set seekdir d_seekdir
15811eval $inlibc
15812set telldir d_telldir
15813eval $inlibc
15814set rewinddir d_rewinddir
15815eval $inlibc
15816
15817: see if readdir64_r exists
15818set readdir64_r d_readdir64_r
15819eval $inlibc
15820case "$d_readdir64_r" in
15821"$define")
15822	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15823	case "$d_readdir64_r_proto:$usethreads" in
15824	":define")	d_readdir64_r_proto=define
15825		set d_readdir64_r_proto readdir64_r $hdrs
15826		eval $hasproto ;;
15827	*)	;;
15828	esac
15829	case "$d_readdir64_r_proto" in
15830	define)
15831	case "$readdir64_r_proto" in
15832	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15833	./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15834	esac
15835	case "$readdir64_r_proto" in
15836	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15837	./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15838	esac
15839	case "$readdir64_r_proto" in
15840	''|0)	d_readdir64_r=undef
15841 	        readdir64_r_proto=0
15842		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15843	* )	case "$readdir64_r_proto" in
15844		REENTRANT_PROTO*) ;;
15845		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15846		esac
15847		echo "Prototype: $try" ;;
15848	esac
15849	;;
15850	*)	case "$usethreads" in
15851		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15852		esac
15853		d_readdir64_r=undef
15854		readdir64_r_proto=0
15855		;;
15856	esac
15857	;;
15858*)	readdir64_r_proto=0
15859	;;
15860esac
15861
15862: see if readdir_r exists
15863set readdir_r d_readdir_r
15864eval $inlibc
15865case "$d_readdir_r" in
15866"$define")
15867	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15868	case "$d_readdir_r_proto:$usethreads" in
15869	":define")	d_readdir_r_proto=define
15870		set d_readdir_r_proto readdir_r $hdrs
15871		eval $hasproto ;;
15872	*)	;;
15873	esac
15874	case "$d_readdir_r_proto" in
15875	define)
15876	case "$readdir_r_proto" in
15877	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15878	./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15879	esac
15880	case "$readdir_r_proto" in
15881	''|0) try='int readdir_r(DIR*, struct dirent*);'
15882	./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15883	esac
15884	case "$readdir_r_proto" in
15885	''|0)	d_readdir_r=undef
15886 	        readdir_r_proto=0
15887		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15888	* )	case "$readdir_r_proto" in
15889		REENTRANT_PROTO*) ;;
15890		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15891		esac
15892		echo "Prototype: $try" ;;
15893	esac
15894	;;
15895	*)	case "$usethreads" in
15896		define) echo "readdir_r has no prototype, not using it." >&4 ;;
15897		esac
15898		d_readdir_r=undef
15899		readdir_r_proto=0
15900		;;
15901	esac
15902	;;
15903*)	readdir_r_proto=0
15904	;;
15905esac
15906
15907: see if readv exists
15908set readv d_readv
15909eval $inlibc
15910
15911: see if recvmsg exists
15912set recvmsg d_recvmsg
15913eval $inlibc
15914
15915: see if rename exists
15916set rename d_rename
15917eval $inlibc
15918
15919: see if rmdir exists
15920set rmdir d_rmdir
15921eval $inlibc
15922
15923: see if memory.h is available.
15924val=''
15925set memory.h val
15926eval $inhdr
15927
15928: See if it conflicts with string.h
15929case "$val" in
15930$define)
15931	case "$strings" in
15932	'') ;;
15933	*)
15934		$cppstdin $cppflags $cppminus < $strings > mem.h
15935		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15936			echo " "
15937			echo "We won't be including <memory.h>."
15938			val="$undef"
15939		fi
15940		$rm -f mem.h
15941		;;
15942	esac
15943esac
15944set i_memory
15945eval $setvar
15946
15947: can bcopy handle overlapping blocks?
15948echo " "
15949val="$undef"
15950case "$d_memmove" in
15951"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15952*)	case "$d_bcopy" in
15953	"$define")
15954		echo "Checking to see if bcopy() can do overlapping copies..." >&4
15955		$cat >try.c <<EOCP
15956#$i_memory I_MEMORY
15957#$i_stdlib I_STDLIB
15958#$i_string I_STRING
15959#$i_unistd I_UNISTD
15960EOCP
15961	$cat >>try.c <<'EOCP'
15962#include <stdio.h>
15963#ifdef I_MEMORY
15964#  include <memory.h>
15965#endif
15966#ifdef I_STDLIB
15967#  include <stdlib.h>
15968#endif
15969#ifdef I_STRING
15970#  include <string.h>
15971#else
15972#  include <strings.h>
15973#endif
15974#ifdef I_UNISTD
15975#  include <unistd.h>  /* Needed for NetBSD */
15976#endif
15977int main()
15978{
15979char buf[128], abc[128];
15980char *b;
15981int len;
15982int off;
15983int align;
15984
15985/* Copy "abcde..." string to char abc[] so that gcc doesn't
15986   try to store the string in read-only memory. */
15987bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15988
15989for (align = 7; align >= 0; align--) {
15990	for (len = 36; len; len--) {
15991		b = buf+align;
15992		bcopy(abc, b, len);
15993		for (off = 1; off <= len; off++) {
15994			bcopy(b, b+off, len);
15995			bcopy(b+off, b, len);
15996			if (bcmp(b, abc, len))
15997				exit(1);
15998		}
15999	}
16000}
16001exit(0);
16002}
16003EOCP
16004		set try
16005		if eval $compile_ok; then
16006			if $run ./try 2>/dev/null; then
16007				echo "Yes, it can."
16008				val="$define"
16009			else
16010				echo "It can't, sorry."
16011			fi
16012		else
16013			echo "(I can't compile the test program, so we'll assume not...)"
16014		fi
16015		;;
16016	esac
16017	$rm_try
16018	;;
16019esac
16020set d_safebcpy
16021eval $setvar
16022
16023: can memcpy handle overlapping blocks?
16024echo " "
16025val="$undef"
16026case "$d_memmove" in
16027"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16028*)	case "$d_memcpy" in
16029	"$define")
16030		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16031		$cat >try.c <<EOCP
16032#$i_memory I_MEMORY
16033#$i_stdlib I_STDLIB
16034#$i_string I_STRING
16035#$i_unistd I_UNISTD
16036EOCP
16037	$cat >>try.c <<'EOCP'
16038#include <stdio.h>
16039#ifdef I_MEMORY
16040#  include <memory.h>
16041#endif
16042#ifdef I_STDLIB
16043#  include <stdlib.h>
16044#endif
16045#ifdef I_STRING
16046#  include <string.h>
16047#else
16048#  include <strings.h>
16049#endif
16050#ifdef I_UNISTD
16051#  include <unistd.h>  /* Needed for NetBSD */
16052#endif
16053int main()
16054{
16055char buf[128], abc[128];
16056char *b;
16057int len;
16058int off;
16059int align;
16060
16061/* Copy "abcde..." string to char abc[] so that gcc doesn't
16062   try to store the string in read-only memory. */
16063memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16064
16065for (align = 7; align >= 0; align--) {
16066	for (len = 36; len; len--) {
16067		b = buf+align;
16068		memcpy(b, abc, len);
16069		for (off = 1; off <= len; off++) {
16070			memcpy(b+off, b, len);
16071			memcpy(b, b+off, len);
16072			if (memcmp(b, abc, len))
16073				exit(1);
16074		}
16075	}
16076}
16077exit(0);
16078}
16079EOCP
16080		set try
16081		if eval $compile_ok; then
16082			if $run ./try 2>/dev/null; then
16083				echo "Yes, it can."
16084				val="$define"
16085			else
16086				echo "It can't, sorry."
16087			fi
16088		else
16089			echo "(I can't compile the test program, so we'll assume not...)"
16090		fi
16091		;;
16092	esac
16093	$rm_try
16094	;;
16095esac
16096set d_safemcpy
16097eval $setvar
16098
16099: can memcmp be trusted to compare relative magnitude?
16100val="$undef"
16101case "$d_memcmp" in
16102"$define")
16103	echo " "
16104	echo "Checking if your memcmp() can compare relative magnitude..." >&4
16105	$cat >try.c <<EOCP
16106#$i_memory I_MEMORY
16107#$i_stdlib I_STDLIB
16108#$i_string I_STRING
16109#$i_unistd I_UNISTD
16110EOCP
16111	$cat >>try.c <<'EOCP'
16112#include <stdio.h>
16113#ifdef I_MEMORY
16114#  include <memory.h>
16115#endif
16116#ifdef I_STDLIB
16117#  include <stdlib.h>
16118#endif
16119#ifdef I_STRING
16120#  include <string.h>
16121#else
16122#  include <strings.h>
16123#endif
16124#ifdef I_UNISTD
16125#  include <unistd.h>  /* Needed for NetBSD */
16126#endif
16127int main()
16128{
16129char a = -1;
16130char b = 0;
16131if ((a < b) && memcmp(&a, &b, 1) < 0)
16132	exit(1);
16133exit(0);
16134}
16135EOCP
16136	set try
16137	if eval $compile_ok; then
16138		if $run ./try 2>/dev/null; then
16139			echo "Yes, it can."
16140			val="$define"
16141		else
16142			echo "No, it can't (it uses signed chars)."
16143		fi
16144	else
16145		echo "(I can't compile the test program, so we'll assume not...)"
16146	fi
16147	;;
16148esac
16149$rm_try
16150set d_sanemcmp
16151eval $setvar
16152
16153: see if prototype for sbrk is available
16154echo " "
16155set d_sbrkproto sbrk $i_unistd unistd.h
16156eval $hasproto
16157
16158: see if select exists
16159set select d_select
16160eval $inlibc
16161
16162: see if semctl exists
16163set semctl d_semctl
16164eval $inlibc
16165
16166: see if semget exists
16167set semget d_semget
16168eval $inlibc
16169
16170: see if semop exists
16171set semop d_semop
16172eval $inlibc
16173
16174: see how much of the 'sem*(2)' library is present.
16175h_sem=true
16176echo " "
16177case "$d_semctl$d_semget$d_semop" in
16178*"$undef"*) h_sem=false;;
16179esac
16180case "$osname" in
16181freebsd)
16182    case "`ipcs 2>&1`" in
16183    "SVID messages"*"not configured"*)
16184	echo "Your $osname does not have the sem*(2) configured." >&4
16185        h_sem=false
16186	val="$undef"
16187	set semctl d_semctl
16188	eval $setvar
16189	set semget d_semget
16190	eval $setvar
16191	set semop d_semop
16192	eval $setvar
16193	;;
16194    esac
16195    ;;
16196esac
16197: we could also check for sys/ipc.h ...
16198if $h_sem && $test `./findhdr sys/sem.h`; then
16199	echo "You have the full sem*(2) library." >&4
16200	val="$define"
16201else
16202	echo "You don't have the full sem*(2) library." >&4
16203	val="$undef"
16204fi
16205set d_sem
16206eval $setvar
16207
16208: see whether sys/sem.h defines union semun
16209echo " "
16210$cat > try.c <<'END'
16211#include <sys/types.h>
16212#include <sys/ipc.h>
16213#include <sys/sem.h>
16214int main () { union semun semun; semun.buf = 0; }
16215END
16216set try
16217if eval $compile; then
16218    echo "You have union semun in <sys/sem.h>." >&4
16219    val="$define"
16220else
16221    echo "You do not have union semun in <sys/sem.h>." >&4
16222    val="$undef"
16223fi
16224$rm_try
16225set d_union_semun
16226eval $setvar
16227
16228: see how to do semctl IPC_STAT
16229case "$d_sem" in
16230$define)
16231    echo " "
16232    $cat > tryh.h <<END
16233#ifndef S_IRUSR
16234#   ifdef S_IREAD
16235#	define S_IRUSR S_IREAD
16236#	define S_IWUSR S_IWRITE
16237#	define S_IXUSR S_IEXEC
16238#   else
16239#	define S_IRUSR 0400
16240#	define S_IWUSR 0200
16241#	define S_IXUSR 0100
16242#   endif
16243#   define S_IRGRP (S_IRUSR>>3)
16244#   define S_IWGRP (S_IWUSR>>3)
16245#   define S_IXGRP (S_IXUSR>>3)
16246#   define S_IROTH (S_IRUSR>>6)
16247#   define S_IWOTH (S_IWUSR>>6)
16248#   define S_IXOTH (S_IXUSR>>6)
16249#endif
16250#ifndef S_IRWXU
16251#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16252#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16253#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16254#endif
16255END
16256    : see whether semctl IPC_STAT can use union semun
16257    case "$d_semctl_semun" in
16258    '')
16259      val="$undef"
16260      $cat > try.c <<END
16261#include <sys/types.h>
16262#include <sys/ipc.h>
16263#include <sys/sem.h>
16264#include <sys/stat.h>
16265#include <stdio.h>
16266#include <errno.h>
16267#include "tryh.h"
16268#ifndef errno
16269extern int errno;
16270#endif
16271#$d_union_semun HAS_UNION_SEMUN
16272int main() {
16273    union semun
16274#ifndef HAS_UNION_SEMUN
16275    {
16276	int val;
16277	struct semid_ds *buf;
16278	unsigned short *array;
16279    }
16280#endif
16281    arg;
16282    int sem, st;
16283
16284#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16285    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16286    if (sem > -1) {
16287	struct semid_ds argbuf;
16288	arg.buf = &argbuf;
16289#	ifdef IPC_STAT
16290	st = semctl(sem, 0, IPC_STAT, arg);
16291	if (st == 0)
16292	    printf("semun\n");
16293	else
16294#	endif /* IPC_STAT */
16295	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16296#	ifdef IPC_RMID
16297	if (semctl(sem, 0, IPC_RMID, arg) != 0)
16298#	endif /* IPC_RMID */
16299	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16300    } else
16301#endif /* IPC_PRIVATE && ... */
16302	printf("semget failed: errno = %d\n", errno);
16303  return 0;
16304}
16305END
16306      set try
16307      if eval $compile; then
16308	  xxx=`$run ./try`
16309          case "$xxx" in
16310          semun) val="$define" ;;
16311          esac
16312      fi
16313      $rm_try
16314      set d_semctl_semun
16315      eval $setvar
16316      ;;
16317    esac
16318    case "$d_semctl_semun" in
16319    $define)
16320        echo "You can use union semun for semctl IPC_STAT." >&4
16321	also='also'
16322        ;;
16323    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16324	also=''
16325        ;;
16326    esac
16327
16328    : see whether semctl IPC_STAT can use struct semid_ds pointer
16329    case "$d_semctl_semid_ds" in
16330    '')
16331      val="$undef"
16332      $cat > try.c <<'END'
16333#include <sys/types.h>
16334#include <sys/ipc.h>
16335#include <sys/sem.h>
16336#include <sys/stat.h>
16337#include "tryh.h"
16338#include <stdio.h>
16339#include <errno.h>
16340#ifndef errno
16341extern int errno;
16342#endif
16343int main() {
16344    struct semid_ds arg;
16345    int sem, st;
16346
16347#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16348    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16349    if (sem > -1) {
16350#	ifdef IPC_STAT
16351	st = semctl(sem, 0, IPC_STAT, &arg);
16352	if (st == 0)
16353	    printf("semid_ds\n");
16354	else
16355#	endif /* IPC_STAT */
16356	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16357#	ifdef IPC_RMID
16358	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16359#	endif /* IPC_RMID */
16360	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16361    } else
16362#endif /* IPC_PRIVATE && ... */
16363	printf("semget failed: errno = %d\n", errno);
16364
16365    return 0;
16366}
16367END
16368      set try
16369      if eval $compile; then
16370          xxx=`$run ./try`
16371          case "$xxx" in
16372          semid_ds) val="$define" ;;
16373          esac
16374      fi
16375      $rm_try
16376      set d_semctl_semid_ds
16377      eval $setvar
16378      ;;
16379    esac
16380    case "$d_semctl_semid_ds" in
16381    $define)
16382        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16383        ;;
16384    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16385        ;;
16386    esac
16387    ;;
16388*)  val="$undef"
16389
16390    # We do not have the full sem*(2) library, so assume we can not
16391    # use either.
16392
16393    set d_semctl_semun
16394    eval $setvar
16395
16396    set d_semctl_semid_ds
16397    eval $setvar
16398    ;;
16399esac
16400$rm_try tryh.h
16401
16402: see if sendmsg exists
16403set sendmsg d_sendmsg
16404eval $inlibc
16405
16406: see if setegid exists
16407set setegid d_setegid
16408eval $inlibc
16409
16410: see if seteuid exists
16411set seteuid d_seteuid
16412eval $inlibc
16413
16414: see if setgrent exists
16415set setgrent d_setgrent
16416eval $inlibc
16417
16418: see if setgrent_r exists
16419set setgrent_r d_setgrent_r
16420eval $inlibc
16421case "$d_setgrent_r" in
16422"$define")
16423	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16424	case "$d_setgrent_r_proto:$usethreads" in
16425	":define")	d_setgrent_r_proto=define
16426		set d_setgrent_r_proto setgrent_r $hdrs
16427		eval $hasproto ;;
16428	*)	;;
16429	esac
16430	case "$d_setgrent_r_proto" in
16431	define)
16432	case "$setgrent_r_proto" in
16433	''|0) try='int setgrent_r(FILE**);'
16434	./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16435	esac
16436	case "$setgrent_r_proto" in
16437	''|0) try='void setgrent_r(FILE**);'
16438	./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16439	esac
16440	case "$setgrent_r_proto" in
16441	''|0)	d_setgrent_r=undef
16442 	        setgrent_r_proto=0
16443		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16444	* )	case "$setgrent_r_proto" in
16445		REENTRANT_PROTO*) ;;
16446		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16447		esac
16448		echo "Prototype: $try" ;;
16449	esac
16450	;;
16451	*)	case "$usethreads" in
16452		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16453		esac
16454		d_setgrent_r=undef
16455		setgrent_r_proto=0
16456		;;
16457	esac
16458	;;
16459*)	setgrent_r_proto=0
16460	;;
16461esac
16462
16463: see if sethostent exists
16464set sethostent d_sethent
16465eval $inlibc
16466
16467: see if sethostent_r exists
16468set sethostent_r d_sethostent_r
16469eval $inlibc
16470case "$d_sethostent_r" in
16471"$define")
16472	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16473	case "$d_sethostent_r_proto:$usethreads" in
16474	":define")	d_sethostent_r_proto=define
16475		set d_sethostent_r_proto sethostent_r $hdrs
16476		eval $hasproto ;;
16477	*)	;;
16478	esac
16479	case "$d_sethostent_r_proto" in
16480	define)
16481	case "$sethostent_r_proto" in
16482	''|0) try='int sethostent_r(int, struct hostent_data*);'
16483	./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16484	esac
16485	case "$sethostent_r_proto" in
16486	''|0) try='void sethostent_r(int, struct hostent_data*);'
16487	./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16488	esac
16489	case "$sethostent_r_proto" in
16490	''|0)	d_sethostent_r=undef
16491 	        sethostent_r_proto=0
16492		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16493	* )	case "$sethostent_r_proto" in
16494		REENTRANT_PROTO*) ;;
16495		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16496		esac
16497		echo "Prototype: $try" ;;
16498	esac
16499	;;
16500	*)	case "$usethreads" in
16501		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16502		esac
16503		d_sethostent_r=undef
16504		sethostent_r_proto=0
16505		;;
16506	esac
16507	;;
16508*)	sethostent_r_proto=0
16509	;;
16510esac
16511
16512: see if setitimer exists
16513set setitimer d_setitimer
16514eval $inlibc
16515
16516: see if setlinebuf exists
16517set setlinebuf d_setlinebuf
16518eval $inlibc
16519
16520: see if setlocale exists
16521set setlocale d_setlocale
16522eval $inlibc
16523
16524: see if locale.h is available
16525set locale.h i_locale
16526eval $inhdr
16527
16528: see if setlocale_r exists
16529set setlocale_r d_setlocale_r
16530eval $inlibc
16531case "$d_setlocale_r" in
16532"$define")
16533	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16534	case "$d_setlocale_r_proto:$usethreads" in
16535	":define")	d_setlocale_r_proto=define
16536		set d_setlocale_r_proto setlocale_r $hdrs
16537		eval $hasproto ;;
16538	*)	;;
16539	esac
16540	case "$d_setlocale_r_proto" in
16541	define)
16542	case "$setlocale_r_proto" in
16543	''|0) try='int setlocale_r(int, const char*, char*, int);'
16544	./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16545	esac
16546	case "$setlocale_r_proto" in
16547	''|0)	d_setlocale_r=undef
16548 	        setlocale_r_proto=0
16549		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16550	* )	case "$setlocale_r_proto" in
16551		REENTRANT_PROTO*) ;;
16552		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16553		esac
16554		echo "Prototype: $try" ;;
16555	esac
16556	;;
16557	*)	case "$usethreads" in
16558		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16559		esac
16560		d_setlocale_r=undef
16561		setlocale_r_proto=0
16562		;;
16563	esac
16564	;;
16565*)	setlocale_r_proto=0
16566	;;
16567esac
16568
16569: see if setnetent exists
16570set setnetent d_setnent
16571eval $inlibc
16572
16573: see if setnetent_r exists
16574set setnetent_r d_setnetent_r
16575eval $inlibc
16576case "$d_setnetent_r" in
16577"$define")
16578	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16579	case "$d_setnetent_r_proto:$usethreads" in
16580	":define")	d_setnetent_r_proto=define
16581		set d_setnetent_r_proto setnetent_r $hdrs
16582		eval $hasproto ;;
16583	*)	;;
16584	esac
16585	case "$d_setnetent_r_proto" in
16586	define)
16587	case "$setnetent_r_proto" in
16588	''|0) try='int setnetent_r(int, struct netent_data*);'
16589	./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16590	esac
16591	case "$setnetent_r_proto" in
16592	''|0) try='void setnetent_r(int, struct netent_data*);'
16593	./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16594	esac
16595	case "$setnetent_r_proto" in
16596	''|0)	d_setnetent_r=undef
16597 	        setnetent_r_proto=0
16598		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16599	* )	case "$setnetent_r_proto" in
16600		REENTRANT_PROTO*) ;;
16601		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16602		esac
16603		echo "Prototype: $try" ;;
16604	esac
16605	;;
16606	*)	case "$usethreads" in
16607		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16608		esac
16609		d_setnetent_r=undef
16610		setnetent_r_proto=0
16611		;;
16612	esac
16613	;;
16614*)	setnetent_r_proto=0
16615	;;
16616esac
16617
16618: see if setprotoent exists
16619set setprotoent d_setpent
16620eval $inlibc
16621
16622: see if setpgid exists
16623set setpgid d_setpgid
16624eval $inlibc
16625
16626: see if setpgrp2 exists
16627set setpgrp2 d_setpgrp2
16628eval $inlibc
16629
16630: see if setpriority exists
16631set setpriority d_setprior
16632eval $inlibc
16633
16634: see if setproctitle exists
16635set setproctitle d_setproctitle
16636eval $inlibc
16637
16638: see if setprotoent_r exists
16639set setprotoent_r d_setprotoent_r
16640eval $inlibc
16641case "$d_setprotoent_r" in
16642"$define")
16643	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16644	case "$d_setprotoent_r_proto:$usethreads" in
16645	":define")	d_setprotoent_r_proto=define
16646		set d_setprotoent_r_proto setprotoent_r $hdrs
16647		eval $hasproto ;;
16648	*)	;;
16649	esac
16650	case "$d_setprotoent_r_proto" in
16651	define)
16652	case "$setprotoent_r_proto" in
16653	''|0) try='int setprotoent_r(int, struct protoent_data*);'
16654	./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16655	esac
16656	case "$setprotoent_r_proto" in
16657	''|0) try='void setprotoent_r(int, struct protoent_data*);'
16658	./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16659	esac
16660	case "$setprotoent_r_proto" in
16661	''|0)	d_setprotoent_r=undef
16662 	        setprotoent_r_proto=0
16663		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16664	* )	case "$setprotoent_r_proto" in
16665		REENTRANT_PROTO*) ;;
16666		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16667		esac
16668		echo "Prototype: $try" ;;
16669	esac
16670	;;
16671	*)	case "$usethreads" in
16672		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16673		esac
16674		d_setprotoent_r=undef
16675		setprotoent_r_proto=0
16676		;;
16677	esac
16678	;;
16679*)	setprotoent_r_proto=0
16680	;;
16681esac
16682
16683: see if setpwent exists
16684set setpwent d_setpwent
16685eval $inlibc
16686
16687: see if setpwent_r exists
16688set setpwent_r d_setpwent_r
16689eval $inlibc
16690case "$d_setpwent_r" in
16691"$define")
16692	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16693	case "$d_setpwent_r_proto:$usethreads" in
16694	":define")	d_setpwent_r_proto=define
16695		set d_setpwent_r_proto setpwent_r $hdrs
16696		eval $hasproto ;;
16697	*)	;;
16698	esac
16699	case "$d_setpwent_r_proto" in
16700	define)
16701	case "$setpwent_r_proto" in
16702	''|0) try='int setpwent_r(FILE**);'
16703	./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16704	esac
16705	case "$setpwent_r_proto" in
16706	''|0) try='void setpwent_r(FILE**);'
16707	./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16708	esac
16709	case "$setpwent_r_proto" in
16710	''|0)	d_setpwent_r=undef
16711 	        setpwent_r_proto=0
16712		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16713	* )	case "$setpwent_r_proto" in
16714		REENTRANT_PROTO*) ;;
16715		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16716		esac
16717		echo "Prototype: $try" ;;
16718	esac
16719	;;
16720	*)	case "$usethreads" in
16721		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16722		esac
16723		d_setpwent_r=undef
16724		setpwent_r_proto=0
16725		;;
16726	esac
16727	;;
16728*)	setpwent_r_proto=0
16729	;;
16730esac
16731
16732: see if setregid exists
16733set setregid d_setregid
16734eval $inlibc
16735set setresgid d_setresgid
16736eval $inlibc
16737
16738: see if setreuid exists
16739set setreuid d_setreuid
16740eval $inlibc
16741set setresuid d_setresuid
16742eval $inlibc
16743
16744: see if setrgid exists
16745set setrgid d_setrgid
16746eval $inlibc
16747
16748: see if setruid exists
16749set setruid d_setruid
16750eval $inlibc
16751
16752: see if setservent exists
16753set setservent d_setsent
16754eval $inlibc
16755
16756: see if setservent_r exists
16757set setservent_r d_setservent_r
16758eval $inlibc
16759case "$d_setservent_r" in
16760"$define")
16761	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16762	case "$d_setservent_r_proto:$usethreads" in
16763	":define")	d_setservent_r_proto=define
16764		set d_setservent_r_proto setservent_r $hdrs
16765		eval $hasproto ;;
16766	*)	;;
16767	esac
16768	case "$d_setservent_r_proto" in
16769	define)
16770	case "$setservent_r_proto" in
16771	''|0) try='int setservent_r(int, struct servent_data*);'
16772	./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16773	esac
16774	case "$setservent_r_proto" in
16775	''|0) try='void setservent_r(int, struct servent_data*);'
16776	./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16777	esac
16778	case "$setservent_r_proto" in
16779	''|0)	d_setservent_r=undef
16780 	        setservent_r_proto=0
16781		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16782	* )	case "$setservent_r_proto" in
16783		REENTRANT_PROTO*) ;;
16784		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16785		esac
16786		echo "Prototype: $try" ;;
16787	esac
16788	;;
16789	*)	case "$usethreads" in
16790		define) echo "setservent_r has no prototype, not using it." >&4 ;;
16791		esac
16792		d_setservent_r=undef
16793		setservent_r_proto=0
16794		;;
16795	esac
16796	;;
16797*)	setservent_r_proto=0
16798	;;
16799esac
16800
16801: see if setsid exists
16802set setsid d_setsid
16803eval $inlibc
16804
16805: see if setvbuf exists
16806set setvbuf d_setvbuf
16807eval $inlibc
16808
16809: see if sfio.h is available
16810set sfio.h i_sfio
16811eval $inhdr
16812
16813
16814: see if sfio library is available
16815case "$i_sfio" in
16816$define)
16817	val=''
16818	set sfreserve val
16819	eval $inlibc
16820	;;
16821*)
16822	val="$undef"
16823	;;
16824esac
16825: Ok, but do we want to use it.
16826case "$val" in
16827$define)
16828	case "$usesfio" in
16829	true|$define|[yY]*) dflt='y';;
16830	*) dflt='n';;
16831	esac
16832	echo "$package can use the sfio library, but it is experimental."
16833	case "$useperlio" in
16834	"$undef")
16835	    echo "For sfio also the PerlIO abstraction layer is needed."
16836	    echo "Earlier you said you wouldn't want that."
16837	    ;;
16838	esac
16839	rp="You seem to have sfio available, do you want to try using it?"
16840	. ./myread
16841	case "$ans" in
16842	y|Y)	echo "Ok, turning on both sfio and PerlIO, then."
16843		useperlio="$define"
16844		val="$define"
16845		;;
16846	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16847		val="$undef"
16848		;;
16849	esac
16850	;;
16851*)	case "$usesfio" in
16852	true|$define|[yY]*)
16853		echo "Sorry, cannot find sfio on this machine." >&4
16854		echo "Ignoring your setting of usesfio=$usesfio." >&4
16855		val="$undef"
16856		;;
16857	esac
16858	;;
16859esac
16860set d_sfio
16861eval $setvar
16862case "$d_sfio" in
16863$define) usesfio='true';;
16864*) usesfio='false';;
16865esac
16866case "$d_sfio" in
16867$define) ;;
16868*)	: Remove sfio from list of libraries to use
16869	case "$libs" in
16870	*-lsfio*)
16871		echo "Removing unneeded -lsfio from library list" >&4
16872		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16873		shift
16874		libs="$*"
16875		echo "libs = $libs" >&4
16876		;;
16877	esac
16878;;
16879esac
16880
16881
16882: see if shmctl exists
16883set shmctl d_shmctl
16884eval $inlibc
16885
16886: see if shmget exists
16887set shmget d_shmget
16888eval $inlibc
16889
16890: see if shmat exists
16891set shmat d_shmat
16892eval $inlibc
16893: see what shmat returns
16894case "$d_shmat" in
16895"$define")
16896	$cat >shmat.c <<'END'
16897#include <sys/shm.h>
16898void *shmat();
16899END
16900	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16901		shmattype='void *'
16902	else
16903		shmattype='char *'
16904	fi
16905	echo "and it returns ($shmattype)." >&4
16906	: see if a prototype for shmat is available
16907	xxx=`./findhdr sys/shm.h`
16908	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16909	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16910		val="$define"
16911	else
16912		val="$undef"
16913	fi
16914	$rm -f shmat.[co]
16915	;;
16916*)
16917	val="$undef"
16918	;;
16919esac
16920set d_shmatprototype
16921eval $setvar
16922
16923: see if shmdt exists
16924set shmdt d_shmdt
16925eval $inlibc
16926
16927: see how much of the 'shm*(2)' library is present.
16928h_shm=true
16929echo " "
16930case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16931*"$undef"*) h_shm=false;;
16932esac
16933case "$osname" in
16934freebsd)
16935    case "`ipcs 2>&1`" in
16936    "SVID shared memory"*"not configured"*)
16937	echo "Your $osname does not have the shm*(2) configured." >&4
16938        h_shm=false
16939	val="$undef"
16940	set shmctl d_shmctl
16941	evat $setvar
16942	set shmget d_shmget
16943	evat $setvar
16944	set shmat d_shmat
16945	evat $setvar
16946	set shmdt d_shmdt
16947	evat $setvar
16948	;;
16949    esac
16950    ;;
16951esac
16952: we could also check for sys/ipc.h ...
16953if $h_shm && $test `./findhdr sys/shm.h`; then
16954	echo "You have the full shm*(2) library." >&4
16955	val="$define"
16956else
16957	echo "You don't have the full shm*(2) library." >&4
16958	val="$undef"
16959fi
16960set d_shm
16961eval $setvar
16962
16963echo " "
16964: see if we have sigaction
16965if set sigaction val -f d_sigaction; eval $csym; $val; then
16966	echo 'sigaction() found.' >&4
16967	$cat > try.c <<EOP
16968#include <stdio.h>
16969#include <sys/types.h>
16970#include <signal.h>
16971#$i_stdlib I_STDLIB
16972#ifdef I_STDLIB
16973#include <stdlib.h>
16974#endif
16975int main()
16976{
16977    struct sigaction act, oact;
16978    act.sa_flags = 0;
16979    oact.sa_handler = 0;
16980    /* so that act and oact are used */
16981    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16982}
16983EOP
16984	set try
16985	if eval $compile_ok; then
16986		val="$define"
16987	else
16988		echo "But you don't seem to have a useable struct sigaction." >&4
16989		val="$undef"
16990	fi
16991else
16992	echo 'sigaction NOT found.' >&4
16993	val="$undef"
16994fi
16995set d_sigaction; eval $setvar
16996$rm_try
16997
16998: see if this is a sunmath.h system
16999set sunmath.h i_sunmath
17000eval $inhdr
17001
17002: see if signbit exists
17003$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17004$cat >try.c <<EOCP
17005#$i_math I_MATH
17006#$i_sunmath I_SUNMATH
17007#ifdef I_MATH
17008#  include <math.h>
17009#endif
17010#ifdef I_SUNMATH  /* Solaris special math library */
17011#  include <sunmath.h>
17012#endif
17013#define NV $nvtype
17014int main(int argc, char **argv)
17015{
17016    NV x = 0.0;
17017    NV y = -0.0;
17018    if ((signbit(x) == 0) && (signbit(y) != 0))
17019	return 0;
17020    else
17021	return 1;
17022}
17023EOCP
17024val="$undef"
17025set try
17026if eval $compile; then
17027    if $run ./try; then
17028        $echo "Yes." >&4
17029	val="$define"
17030    else
17031        $echo "Signbit seems to be available, but doesn't work as I expected."
17032        $echo "I won't use it." >&4
17033	val="$undef"
17034    fi
17035else
17036    $echo "Nope." >&4
17037    dflt="$undef"
17038fi
17039set d_signbit
17040eval $setvar
17041$rm_try
17042
17043: see if sigprocmask exists
17044set sigprocmask d_sigprocmask
17045eval $inlibc
17046
17047: see if sigsetjmp exists
17048echo " "
17049case "$d_sigsetjmp" in
17050'')
17051	$cat >try.c <<EOP
17052#include <setjmp.h>
17053#$i_stdlib I_STDLIB
17054#ifdef I_STDLIB
17055#include <stdlib.h>
17056#endif
17057sigjmp_buf env;
17058int set = 1;
17059int main()
17060{
17061	if (sigsetjmp(env,1))
17062		exit(set);
17063	set = 0;
17064	siglongjmp(env, 1);
17065	exit(1);
17066}
17067EOP
17068	set try
17069	if eval $compile; then
17070		if $run ./try >/dev/null 2>&1; then
17071			echo "POSIX sigsetjmp found." >&4
17072			val="$define"
17073		else
17074			$cat >&4 <<EOM
17075Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17076I'll ignore them.
17077EOM
17078			val="$undef"
17079		fi
17080	else
17081		echo "sigsetjmp not found." >&4
17082		val="$undef"
17083	fi
17084	;;
17085*) val="$d_sigsetjmp"
17086	case "$d_sigsetjmp" in
17087	$define) echo "POSIX sigsetjmp found." >&4;;
17088	$undef) echo "sigsetjmp not found." >&4;;
17089	esac
17090	;;
17091esac
17092set d_sigsetjmp
17093eval $setvar
17094$rm_try
17095
17096: see if snprintf exists
17097set snprintf d_snprintf
17098eval $inlibc
17099
17100: see if vsnprintf exists
17101set vsnprintf d_vsnprintf
17102eval $inlibc
17103
17104case "$d_snprintf-$d_vsnprintf" in
17105"$define-$define")
17106    $cat <<EOM
17107Checking whether your snprintf() and vsnprintf() work okay...
17108EOM
17109    $cat >try.c <<'EOCP'
17110/* v?snprintf testing logic courtesy of Russ Allbery.
17111 * According to C99:
17112 * - if the buffer is too short it still must be \0-terminated
17113 * - if the buffer is too short the potentially required length
17114 *   must be returned and not -1
17115 * - if the buffer is NULL the potentially required length
17116 *   must be returned and not -1 or core dump
17117 */
17118#include <stdio.h>
17119#include <stdarg.h>
17120
17121char buf[2];
17122
17123int test (char *format, ...)
17124{
17125    va_list args;
17126    int count;
17127
17128    va_start (args, format);
17129    count = vsnprintf (buf, sizeof buf, format, args);
17130    va_end (args);
17131    return count;
17132}
17133
17134int main ()
17135{
17136    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17137             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17138}
17139EOCP
17140    set try
17141    if eval $compile; then
17142	`$run ./try`
17143	case "$?" in
17144	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17145	*) cat <<EOM >&4
17146Your snprintf() and snprintf() don't seem to be working okay.
17147EOM
17148	   d_snprintf="$undef"
17149	   d_vsnprintf="$undef"
17150	   ;;
17151	esac
17152    else
17153	echo "(I can't seem to compile the test program--assuming they don't)"
17154	d_snprintf="$undef"
17155	d_vsnprintf="$undef"
17156    fi
17157    $rm_try
17158    ;;
17159esac
17160
17161: see if sockatmark exists
17162set sockatmark d_sockatmark
17163eval $inlibc
17164
17165: see if prototype for sockatmark is available
17166echo " "
17167set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17168eval $hasproto
17169
17170: see if socks5_init exists
17171set socks5_init d_socks5_init
17172eval $inlibc
17173
17174: see if sprintf returns the length of the string in the buffer as per ANSI
17175$echo "Checking whether sprintf returns the length of the string..." >&4
17176$cat <<EOP >try.c
17177#include <stdio.h>
17178#$i_stdlib I_STDLIB
17179#ifdef I_STDLIB
17180#include <stdlib.h>
17181#endif
17182#$i_string I_STRING
17183#ifdef I_STRING
17184#  include <string.h>
17185#else
17186#  include <strings.h>
17187#endif
17188#$i_math I_MATH
17189#ifdef I_MATH
17190#include <math.h>
17191#endif
17192
17193char buffer[256];
17194
17195int check (size_t expect, int test) {
17196  size_t got = strlen(buffer);
17197  if (expect == got)
17198    return 0;
17199
17200  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17201       test, buffer);
17202  exit (test);
17203}
17204
17205int main(int argc, char **argv) {
17206  int test = 0;
17207
17208  check(sprintf(buffer, ""), ++test);
17209  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17210  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17211
17212  return 0;
17213}
17214EOP
17215set try
17216
17217d_sprintf_returns_strlen="$undef"
17218if eval $compile; then
17219    xxx="`$run ./try`"
17220    case "$?" in
17221	0) cat >&4 <<EOM
17222sprintf returns the length of the string (as ANSI says it should)
17223EOM
17224	d_sprintf_returns_strlen="$define"
17225	;;
17226	*) cat >&4 <<EOM
17227sprintf does not return the length of the string (how old is this system?)
17228EOM
17229	d_sprintf_returns_strlen="$undef"
17230        ;;
17231    esac
17232fi
17233$rm_try
17234
17235: see if srand48_r exists
17236set srand48_r d_srand48_r
17237eval $inlibc
17238case "$d_srand48_r" in
17239"$define")
17240	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17241	case "$d_srand48_r_proto:$usethreads" in
17242	":define")	d_srand48_r_proto=define
17243		set d_srand48_r_proto srand48_r $hdrs
17244		eval $hasproto ;;
17245	*)	;;
17246	esac
17247	case "$d_srand48_r_proto" in
17248	define)
17249	case "$srand48_r_proto" in
17250	''|0) try='int srand48_r(long, struct drand48_data*);'
17251	./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17252	esac
17253	case "$srand48_r_proto" in
17254	''|0)	d_srand48_r=undef
17255 	        srand48_r_proto=0
17256		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17257	* )	case "$srand48_r_proto" in
17258		REENTRANT_PROTO*) ;;
17259		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17260		esac
17261		echo "Prototype: $try" ;;
17262	esac
17263	;;
17264	*)	case "$usethreads" in
17265		define) echo "srand48_r has no prototype, not using it." >&4 ;;
17266		esac
17267		d_srand48_r=undef
17268		srand48_r_proto=0
17269		;;
17270	esac
17271	;;
17272*)	srand48_r_proto=0
17273	;;
17274esac
17275
17276: see if srandom_r exists
17277set srandom_r d_srandom_r
17278eval $inlibc
17279case "$d_srandom_r" in
17280"$define")
17281	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17282	case "$d_srandom_r_proto:$usethreads" in
17283	":define")	d_srandom_r_proto=define
17284		set d_srandom_r_proto srandom_r $hdrs
17285		eval $hasproto ;;
17286	*)	;;
17287	esac
17288	case "$d_srandom_r_proto" in
17289	define)
17290	case "$srandom_r_proto" in
17291	''|0) try='int srandom_r(unsigned int, struct random_data*);'
17292	./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17293	esac
17294	case "$srandom_r_proto" in
17295	''|0)	d_srandom_r=undef
17296 	        srandom_r_proto=0
17297		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17298	* )	case "$srandom_r_proto" in
17299		REENTRANT_PROTO*) ;;
17300		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17301		esac
17302		echo "Prototype: $try" ;;
17303	esac
17304	;;
17305	*)	case "$usethreads" in
17306		define) echo "srandom_r has no prototype, not using it." >&4 ;;
17307		esac
17308		d_srandom_r=undef
17309		srandom_r_proto=0
17310		;;
17311	esac
17312	;;
17313*)	srandom_r_proto=0
17314	;;
17315esac
17316
17317: see if prototype for setresgid is available
17318echo " "
17319set d_sresgproto setresgid $i_unistd unistd.h
17320eval $hasproto
17321
17322: see if prototype for setresuid is available
17323echo " "
17324set d_sresuproto setresuid $i_unistd unistd.h
17325eval $hasproto
17326
17327: see if sys/stat.h is available
17328set sys/stat.h i_sysstat
17329eval $inhdr
17330
17331
17332: see if stat knows about block sizes
17333echo " "
17334echo "Checking to see if your struct stat has st_blocks field..." >&4
17335set d_statblks stat st_blocks $i_sysstat sys/stat.h
17336eval $hasfield
17337
17338
17339: see if this is a sys/vfs.h system
17340set sys/vfs.h i_sysvfs
17341eval $inhdr
17342
17343
17344: see if this is a sys/statfs.h system
17345set sys/statfs.h i_sysstatfs
17346eval $inhdr
17347
17348
17349echo " "
17350echo "Checking to see if your system supports struct statfs..." >&4
17351set 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
17352eval $hasstruct
17353case "$d_statfs_s" in
17354"$define")      echo "Yes, it does."   ;;
17355*)              echo "No, it doesn't." ;;
17356esac
17357
17358
17359
17360: see if struct statfs knows about f_flags
17361case "$d_statfs_s" in
17362define)
17363	echo " "
17364	echo "Checking to see if your struct statfs has f_flags field..." >&4
17365	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
17366	eval $hasfield
17367	;;
17368*)	val="$undef"
17369	set d_statfs_f_flags
17370	eval $setvar
17371	;;
17372esac
17373case "$d_statfs_f_flags" in
17374"$define")      echo "Yes, it does."   ;;
17375*)              echo "No, it doesn't." ;;
17376esac
17377
17378$cat >&4 <<EOM
17379Checking how to access stdio streams by file descriptor number...
17380EOM
17381case "$stdio_stream_array" in
17382'') 	$cat >try.c <<EOCP
17383#include <stdio.h>
17384int main() {
17385  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17386    printf("yes\n");
17387}
17388EOCP
17389	for s in _iob __iob __sF
17390	do
17391	        set try -DSTDIO_STREAM_ARRAY=$s
17392		if eval $compile; then
17393		    	case "`$run ./try`" in
17394			yes)	stdio_stream_array=$s; break ;;
17395			esac
17396		fi
17397	done
17398	$rm_try
17399esac
17400case "$stdio_stream_array" in
17401'')	$cat >&4 <<EOM
17402I can't figure out how to access stdio streams by file descriptor number.
17403EOM
17404	d_stdio_stream_array="$undef"
17405	;;
17406*)	$cat >&4 <<EOM
17407You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17408EOM
17409	d_stdio_stream_array="$define"
17410	;;
17411esac
17412
17413: see if strcoll exists
17414set strcoll d_strcoll
17415eval $inlibc
17416
17417: check for structure copying
17418echo " "
17419echo "Checking to see if your C compiler can copy structs..." >&4
17420$cat >try.c <<'EOCP'
17421int main()
17422{
17423	struct blurfl {
17424		int dyick;
17425	} foo, bar;
17426
17427	foo = bar;
17428}
17429EOCP
17430if $cc -c try.c >/dev/null 2>&1 ; then
17431	val="$define"
17432	echo "Yup, it can."
17433else
17434	val="$undef"
17435	echo "Nope, it can't."
17436fi
17437set d_strctcpy
17438eval $setvar
17439$rm_try
17440
17441: see if strerror and/or sys_errlist[] exist
17442echo " "
17443if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17444    if set strerror val -f d_strerror; eval $csym; $val; then
17445		echo 'strerror() found.' >&4
17446		d_strerror="$define"
17447		d_strerrm='strerror(e)'
17448		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17449			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17450			d_syserrlst="$define"
17451		else
17452			echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17453			d_syserrlst="$undef"
17454		fi
17455    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17456			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17457		echo 'strerror() found in string header.' >&4
17458		d_strerror="$define"
17459		d_strerrm='strerror(e)'
17460		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17461			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17462				d_syserrlst="$define"
17463		else
17464			echo "(You don't appear to have any sys_errlist[], how can this be?)"
17465			d_syserrlst="$undef"
17466		fi
17467    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17468		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17469		d_strerror="$undef"
17470		d_syserrlst="$define"
17471		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17472    else
17473		echo 'strerror() and sys_errlist[] NOT found.' >&4
17474		d_strerror="$undef"
17475		d_syserrlst="$undef"
17476		d_strerrm='"unknown"'
17477    fi
17478fi
17479
17480: see if strerror_r exists
17481set strerror_r d_strerror_r
17482eval $inlibc
17483case "$d_strerror_r" in
17484"$define")
17485	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17486	case "$d_strerror_r_proto:$usethreads" in
17487	":define")	d_strerror_r_proto=define
17488		set d_strerror_r_proto strerror_r $hdrs
17489		eval $hasproto ;;
17490	*)	;;
17491	esac
17492	case "$d_strerror_r_proto" in
17493	define)
17494	case "$strerror_r_proto" in
17495	''|0) try='int strerror_r(int, char*, size_t);'
17496	./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17497	esac
17498	case "$strerror_r_proto" in
17499	''|0) try='int strerror_r(int, char*, int);'
17500	./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17501	esac
17502	case "$strerror_r_proto" in
17503	''|0) try='char* strerror_r(int, char*, size_t);'
17504	./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17505	esac
17506	case "$strerror_r_proto" in
17507	''|0)	d_strerror_r=undef
17508 	        strerror_r_proto=0
17509		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17510	* )	case "$strerror_r_proto" in
17511		REENTRANT_PROTO*) ;;
17512		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17513		esac
17514		echo "Prototype: $try" ;;
17515	esac
17516	;;
17517	*)	case "$usethreads" in
17518		define) echo "strerror_r has no prototype, not using it." >&4 ;;
17519		esac
17520		d_strerror_r=undef
17521		strerror_r_proto=0
17522		;;
17523	esac
17524	;;
17525*)	strerror_r_proto=0
17526	;;
17527esac
17528
17529: see if strftime exists
17530set strftime d_strftime
17531eval $inlibc
17532
17533: see if strlcat exists
17534set strlcat d_strlcat
17535eval $inlibc
17536
17537: see if strlcpy exists
17538set strlcpy d_strlcpy
17539eval $inlibc
17540
17541: see if strtod exists
17542set strtod d_strtod
17543eval $inlibc
17544
17545: see if strtol exists
17546set strtol d_strtol
17547eval $inlibc
17548
17549: see if strtold exists
17550set strtold d_strtold
17551eval $inlibc
17552
17553: see if strtoll exists
17554set strtoll d_strtoll
17555eval $inlibc
17556
17557case "$d_longlong-$d_strtoll" in
17558"$define-$define")
17559	$cat <<EOM
17560Checking whether your strtoll() works okay...
17561EOM
17562	$cat >try.c <<'EOCP'
17563#include <errno.h>
17564#ifdef __hpux
17565#define strtoll __strtoll
17566#endif
17567#ifdef __EMX__
17568#define strtoll _strtoll
17569#endif
17570#include <stdio.h>
17571extern long long int strtoll(char *s, char **, int);
17572static int bad = 0;
17573int check(char *s, long long ell, int een) {
17574	long long gll;
17575	errno = 0;
17576	gll = strtoll(s, 0, 10);
17577	if (!((gll == ell) && (errno == een)))
17578		bad++;
17579}
17580int main() {
17581	check(" 1",                                      1LL, 0);
17582	check(" 0",                                      0LL, 0);
17583	check("-1",                                     -1LL, 0);
17584	check("-9223372036854775808", -9223372036854775808LL, 0);
17585	check("-9223372036854775808", -9223372036854775808LL, 0);
17586	check(" 9223372036854775807",  9223372036854775807LL, 0);
17587	check("-9223372036854775808", -9223372036854775808LL, 0);
17588	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17589	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17590	if (!bad)
17591		printf("ok\n");
17592}
17593EOCP
17594	set try
17595	if eval $compile; then
17596		yyy=`$run ./try`
17597		case "$yyy" in
17598		ok) echo "Your strtoll() seems to be working okay." ;;
17599		*) cat <<EOM >&4
17600Your strtoll() doesn't seem to be working okay.
17601EOM
17602		   d_strtoll="$undef"
17603		   ;;
17604		esac
17605	else
17606		echo "(I can't seem to compile the test program--assuming it doesn't)"
17607		d_strtoll="$undef"
17608	fi
17609	;;
17610esac
17611
17612: see if strtoq exists
17613set strtoq d_strtoq
17614eval $inlibc
17615
17616: see if strtoul exists
17617set strtoul d_strtoul
17618eval $inlibc
17619
17620case "$d_strtoul" in
17621"$define")
17622	$cat <<EOM
17623Checking whether your strtoul() works okay...
17624EOM
17625	$cat >try.c <<'EOCP'
17626#include <errno.h>
17627#include <stdio.h>
17628extern unsigned long int strtoul(char *s, char **, int);
17629static int bad = 0;
17630void check(char *s, unsigned long eul, int een) {
17631	unsigned long gul;
17632	errno = 0;
17633	gul = strtoul(s, 0, 10);
17634	if (!((gul == eul) && (errno == een)))
17635		bad++;
17636}
17637int main() {
17638	check(" 1", 1L, 0);
17639	check(" 0", 0L, 0);
17640EOCP
17641	case "$longsize" in
17642	8)
17643	    $cat >>try.c <<'EOCP'
17644	check("18446744073709551615", 18446744073709551615UL, 0);
17645	check("18446744073709551616", 18446744073709551615UL, ERANGE);
17646#if 0 /* strtoul() for /^-/ strings is undefined. */
17647	check("-1", 18446744073709551615UL, 0);
17648	check("-18446744073709551614", 2, 0);
17649	check("-18446744073709551615", 1, 0);
17650       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17651	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17652#endif
17653EOCP
17654		;;
17655	4)
17656		    $cat >>try.c <<'EOCP'
17657	check("4294967295", 4294967295UL, 0);
17658	check("4294967296", 4294967295UL, ERANGE);
17659#if 0 /* strtoul() for /^-/ strings is undefined. */
17660	check("-1", 4294967295UL, 0);
17661	check("-4294967294", 2, 0);
17662	check("-4294967295", 1, 0);
17663       	check("-4294967296", 4294967295UL, ERANGE);
17664	check("-4294967297", 4294967295UL, ERANGE);
17665#endif
17666EOCP
17667		;;
17668	*)
17669: Should we write these tests to be more portable by sprintf-ing
17670: ~0 and then manipulating that char string as input for strtol?
17671		;;
17672	esac
17673	$cat >>try.c <<'EOCP'
17674	if (!bad)
17675		printf("ok\n");
17676	return 0;
17677}
17678EOCP
17679	set try
17680	if eval $compile; then
17681		case "`$run ./try`" in
17682		ok) echo "Your strtoul() seems to be working okay." ;;
17683		*) cat <<EOM >&4
17684Your strtoul() doesn't seem to be working okay.
17685EOM
17686		   d_strtoul="$undef"
17687		   ;;
17688		esac
17689	else
17690		echo "(I can't seem to compile the test program--assuming it doesn't)"
17691		d_strtoul="$undef"
17692	fi
17693	;;
17694esac
17695
17696: see if strtoull exists
17697set strtoull d_strtoull
17698eval $inlibc
17699
17700case "$d_longlong-$d_strtoull" in
17701"$define-$define")
17702	$cat <<EOM
17703Checking whether your strtoull() works okay...
17704EOM
17705	$cat >try.c <<'EOCP'
17706#include <errno.h>
17707#ifdef __hpux
17708#define strtoull __strtoull
17709#endif
17710#include <stdio.h>
17711extern unsigned long long int strtoull(char *s, char **, int);
17712static int bad = 0;
17713int check(char *s, long long eull, int een) {
17714	long long gull;
17715	errno = 0;
17716	gull = strtoull(s, 0, 10);
17717	if (!((gull == eull) && (errno == een)))
17718		bad++;
17719}
17720int main() {
17721	check(" 1",                                        1LL, 0);
17722	check(" 0",                                        0LL, 0);
17723	check("18446744073709551615",  18446744073709551615ULL, 0);
17724	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17725#if 0 /* strtoull() for /^-/ strings is undefined. */
17726	check("-1",                    18446744073709551615ULL, 0);
17727	check("-18446744073709551614",                     2LL, 0);
17728	check("-18446744073709551615",                     1LL, 0);
17729       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17730	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17731#endif
17732	if (!bad)
17733		printf("ok\n");
17734}
17735EOCP
17736	set try
17737	if eval $compile; then
17738		case "`$run ./try`" in
17739		ok) echo "Your strtoull() seems to be working okay." ;;
17740		*) cat <<EOM >&4
17741Your strtoull() doesn't seem to be working okay.
17742EOM
17743		   d_strtoull="$undef"
17744		   ;;
17745		esac
17746	else
17747		echo "(I can't seem to compile the test program--assuming it doesn't)"
17748		d_strtoull="$undef"
17749	fi
17750	;;
17751esac
17752
17753: see if strtouq exists
17754set strtouq d_strtouq
17755eval $inlibc
17756
17757case "$d_strtouq" in
17758"$define")
17759	$cat <<EOM
17760Checking whether your strtouq() works okay...
17761EOM
17762	$cat >try.c <<'EOCP'
17763#include <errno.h>
17764#include <stdio.h>
17765extern unsigned long long int strtouq(char *s, char **, int);
17766static int bad = 0;
17767void check(char *s, unsigned long long eull, int een) {
17768	unsigned long long gull;
17769	errno = 0;
17770	gull = strtouq(s, 0, 10);
17771	if (!((gull == eull) && (errno == een)))
17772		bad++;
17773}
17774int main() {
17775	check(" 1",                                        1LL, 0);
17776	check(" 0",                                        0LL, 0);
17777	check("18446744073709551615",  18446744073709551615ULL, 0);
17778	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17779#if 0 /* strtouq() for /^-/ strings is undefined. */
17780	check("-1",                    18446744073709551615ULL, 0);
17781	check("-18446744073709551614",                     2LL, 0);
17782	check("-18446744073709551615",                     1LL, 0);
17783       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17784	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17785#endif
17786	if (!bad)
17787		printf("ok\n");
17788	return 0;
17789}
17790EOCP
17791	set try
17792	if eval $compile; then
17793		case "`$run ./try`" in
17794		ok) echo "Your strtouq() seems to be working okay." ;;
17795		*) cat <<EOM >&4
17796Your strtouq() doesn't seem to be working okay.
17797EOM
17798		   d_strtouq="$undef"
17799		   ;;
17800		esac
17801	else
17802		echo "(I can't seem to compile the test program--assuming it doesn't)"
17803		d_strtouq="$undef"
17804	fi
17805	;;
17806esac
17807
17808: see if strxfrm exists
17809set strxfrm d_strxfrm
17810eval $inlibc
17811
17812: see if symlink exists
17813set symlink d_symlink
17814eval $inlibc
17815
17816: see if syscall exists
17817set syscall d_syscall
17818eval $inlibc
17819
17820: see if prototype for syscall is available
17821echo " "
17822set d_syscallproto syscall $i_unistd unistd.h
17823eval $hasproto
17824
17825: see if sysconf exists
17826set sysconf d_sysconf
17827eval $inlibc
17828
17829: see if system exists
17830set system d_system
17831eval $inlibc
17832
17833: see if tcgetpgrp exists
17834set tcgetpgrp d_tcgetpgrp
17835eval $inlibc
17836
17837: see if tcsetpgrp exists
17838set tcsetpgrp d_tcsetpgrp
17839eval $inlibc
17840
17841: see if prototype for telldir is available
17842echo " "
17843set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17844eval $hasproto
17845
17846: see if time exists
17847echo " "
17848if test "X$d_time" = X -o X"$timetype" = X; then
17849    if set time val -f d_time; eval $csym; $val; then
17850		echo 'time() found.' >&4
17851		val="$define"
17852		rp="What is the type returned by time() on this system?"
17853		set time_t timetype long stdio.h sys/types.h
17854		eval $typedef_ask
17855    else
17856		echo 'time() not found, hope that will do.' >&4
17857		val="$undef"
17858		timetype='int';
17859    fi
17860    set d_time
17861    eval $setvar
17862fi
17863
17864: see if this is a sys/times.h system
17865set sys/times.h i_systimes
17866eval $inhdr
17867
17868: see if times exists
17869echo " "
17870if set times val -f d_times; eval $csym; $val; then
17871	echo 'times() found.' >&4
17872	d_times="$define"
17873	inc=''
17874	case "$i_systimes" in
17875	"$define") inc='sys/times.h';;
17876	esac
17877	rp="What is the type returned by times() on this system?"
17878	set clock_t clocktype long stdio.h sys/types.h $inc
17879	eval $typedef_ask
17880else
17881	echo 'times() NOT found, hope that will do.' >&4
17882	d_times="$undef"
17883	clocktype='int'
17884fi
17885
17886: see if tmpnam_r exists
17887set tmpnam_r d_tmpnam_r
17888eval $inlibc
17889case "$d_tmpnam_r" in
17890"$define")
17891	hdrs="$i_systypes sys/types.h define stdio.h "
17892	case "$d_tmpnam_r_proto:$usethreads" in
17893	":define")	d_tmpnam_r_proto=define
17894		set d_tmpnam_r_proto tmpnam_r $hdrs
17895		eval $hasproto ;;
17896	*)	;;
17897	esac
17898	case "$d_tmpnam_r_proto" in
17899	define)
17900	case "$tmpnam_r_proto" in
17901	''|0) try='char* tmpnam_r(char*);'
17902	./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17903	esac
17904	case "$tmpnam_r_proto" in
17905	''|0)	d_tmpnam_r=undef
17906 	        tmpnam_r_proto=0
17907		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17908	* )	case "$tmpnam_r_proto" in
17909		REENTRANT_PROTO*) ;;
17910		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17911		esac
17912		echo "Prototype: $try" ;;
17913	esac
17914	;;
17915	*)	case "$usethreads" in
17916		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17917		esac
17918		d_tmpnam_r=undef
17919		tmpnam_r_proto=0
17920		;;
17921	esac
17922	;;
17923*)	tmpnam_r_proto=0
17924	;;
17925esac
17926
17927: see if truncate exists
17928set truncate d_truncate
17929eval $inlibc
17930
17931: see if ttyname_r exists
17932set ttyname_r d_ttyname_r
17933eval $inlibc
17934case "$d_ttyname_r" in
17935"$define")
17936	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17937	case "$d_ttyname_r_proto:$usethreads" in
17938	":define")	d_ttyname_r_proto=define
17939		set d_ttyname_r_proto ttyname_r $hdrs
17940		eval $hasproto ;;
17941	*)	;;
17942	esac
17943	case "$d_ttyname_r_proto" in
17944	define)
17945	case "$ttyname_r_proto" in
17946	''|0) try='int ttyname_r(int, char*, size_t);'
17947	./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17948	esac
17949	case "$ttyname_r_proto" in
17950	''|0) try='int ttyname_r(int, char*, int);'
17951	./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17952	esac
17953	case "$ttyname_r_proto" in
17954	''|0) try='char* ttyname_r(int, char*, int);'
17955	./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17956	esac
17957	case "$ttyname_r_proto" in
17958	''|0)	d_ttyname_r=undef
17959 	        ttyname_r_proto=0
17960		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17961	* )	case "$ttyname_r_proto" in
17962		REENTRANT_PROTO*) ;;
17963		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17964		esac
17965		echo "Prototype: $try" ;;
17966	esac
17967	;;
17968	*)	case "$usethreads" in
17969		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17970		esac
17971		d_ttyname_r=undef
17972		ttyname_r_proto=0
17973		;;
17974	esac
17975	;;
17976*)	ttyname_r_proto=0
17977	;;
17978esac
17979
17980: see if tzname[] exists
17981echo " "
17982if set tzname val -a d_tzname; eval $csym; $val; then
17983	val="$define"
17984	echo 'tzname[] found.' >&4
17985else
17986	val="$undef"
17987	echo 'tzname[] NOT found.' >&4
17988fi
17989set d_tzname
17990eval $setvar
17991
17992case "$osname" in
17993next|rhapsody|darwin) multiarch="$define" ;;
17994esac
17995case "$multiarch" in
17996''|[nN]*) multiarch="$undef" ;;
17997esac
17998
17999: check for ordering of bytes in a UV
18000echo " "
18001case "$usecrosscompile$multiarch" in
18002*$define*)
18003	$cat <<EOM
18004You seem to be either cross-compiling or doing a multiarchitecture build,
18005skipping the byteorder check.
18006
18007EOM
18008	byteorder='ffff'
18009	;;
18010*)
18011	case "$byteorder" in
18012	'')
18013		$cat <<'EOM'
18014In the following, larger digits indicate more significance.  A big-endian
18015machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18016little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18017machines may have weird orders like 3412.  A Cray will report 87654321,
18018an Alpha will report 12345678. If the test program works the default is
18019probably right.
18020I'm now running the test program...
18021EOM
18022		$cat >try.c <<EOCP
18023#include <stdio.h>
18024#$i_stdlib I_STDLIB
18025#ifdef I_STDLIB
18026#include <stdlib.h>
18027#endif
18028#include <sys/types.h>
18029typedef $uvtype UV;
18030int main()
18031{
18032	int i;
18033	union {
18034		UV l;
18035		char c[$uvsize];
18036	} u;
18037
18038	if ($uvsize > 4)
18039		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18040	else
18041		u.l = (UV)0x04030201;
18042	for (i = 0; i < $uvsize; i++)
18043		printf("%c", u.c[i]+'0');
18044	printf("\n");
18045	exit(0);
18046}
18047EOCP
18048		xxx_prompt=y
18049		set try
18050		if eval $compile && $run ./try > /dev/null; then
18051			dflt=`$run ./try`
18052			case "$dflt" in
18053			[1-4][1-4][1-4][1-4]|12345678|87654321)
18054				echo "(The test program ran ok.)"
18055				echo "byteorder=$dflt"
18056				xxx_prompt=n
18057			;;
18058			????|????????) echo "(The test program ran ok.)" ;;
18059			*) echo "(The test program didn't run right for some reason.)" ;;
18060			esac
18061		else
18062			dflt='4321'
18063			cat <<'EOM'
18064(I can't seem to compile the test program.  Guessing big-endian...)
18065EOM
18066		fi
18067		case "$xxx_prompt" in
18068		y)
18069			rp="What is the order of bytes in $uvtype?"
18070			. ./myread
18071			byteorder="$ans"
18072			;;
18073		*)	byteorder=$dflt
18074			;;
18075		esac
18076		;;
18077	esac
18078	$rm_try
18079	;;
18080esac
18081
18082$cat <<EOM
18083
18084Checking to see whether you can access character data unalignedly...
18085EOM
18086case "$d_u32align" in
18087'')   $cat >try.c <<EOCP
18088#include <stdio.h>
18089#$i_stdlib I_STDLIB
18090#ifdef I_STDLIB
18091#include <stdlib.h>
18092#endif
18093#define U32 $u32type
18094#define BYTEORDER 0x$byteorder
18095#define U8 $u8type
18096#include <signal.h>
18097#ifdef SIGBUS
18098$signal_t bletch(int s) { exit(4); }
18099#endif
18100int main() {
18101#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18102    U8 buf[8];
18103    U32 *up;
18104    int i;
18105
18106    if (sizeof(U32) != 4) {
18107	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18108	exit(1);
18109    }
18110
18111    fflush(stdout);
18112
18113#ifdef SIGBUS
18114    signal(SIGBUS, bletch);
18115#endif
18116
18117    buf[0] = 0;
18118    buf[1] = 0;
18119    buf[2] = 0;
18120    buf[3] = 1;
18121    buf[4] = 0;
18122    buf[5] = 0;
18123    buf[6] = 0;
18124    buf[7] = 1;
18125
18126    for (i = 0; i < 4; i++) {
18127	up = (U32*)(buf + i);
18128	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18129	       (*up == 1 << (8*(3-i)))  /* little-endian */
18130	      )
18131	   )
18132	{
18133	    printf("read failed (%x)\n", *up);
18134	    exit(2);
18135	}
18136    }
18137
18138    /* write test */
18139    for (i = 0; i < 4; i++) {
18140	up = (U32*)(buf + i);
18141	*up = 0xBeef;
18142	if (*up != 0xBeef) {
18143	    printf("write failed (%x)\n", *up);
18144	    exit(3);
18145	}
18146    }
18147
18148    exit(0);
18149#else
18150    printf("1\n");
18151    exit(1);
18152#endif
18153    return 0;
18154}
18155EOCP
18156set try
18157if eval $compile_ok; then
18158	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18159	$run ./try 2>&1 >/dev/null
18160	case "$?" in
18161	0)	cat >&4 <<EOM
18162You can access character data pretty unalignedly.
18163EOM
18164		d_u32align="$undef"
18165		;;
18166	*)	cat >&4 <<EOM
18167It seems that you must access character data in an aligned manner.
18168EOM
18169		d_u32align="$define"
18170		;;
18171	esac
18172else
18173	rp='Can you access character data at unaligned addresses?'
18174	dflt='n'
18175	. ./myread
18176	case "$ans" in
18177	[yY]*)	d_u32align="$undef"  ;;
18178	*)	d_u32align="$define" ;;
18179	esac
18180fi
18181$rm_try
18182;;
18183esac
18184
18185: see if ualarm exists
18186set ualarm d_ualarm
18187eval $inlibc
18188
18189: see if umask exists
18190set umask d_umask
18191eval $inlibc
18192
18193: see if unordered exists
18194set unordered d_unordered
18195eval $inlibc
18196
18197: see if unsetenv exists
18198set unsetenv d_unsetenv
18199eval $inlibc
18200
18201: see if usleep exists
18202set usleep d_usleep
18203eval $inlibc
18204
18205: see if prototype for usleep is available
18206echo " "
18207set d_usleepproto usleep $i_unistd unistd.h
18208eval $hasproto
18209
18210: see if ustat exists
18211set ustat d_ustat
18212eval $inlibc
18213
18214: see if closedir exists
18215set closedir d_closedir
18216eval $inlibc
18217
18218case "$d_closedir" in
18219"$define")
18220	echo " "
18221	echo "Checking whether closedir() returns a status..." >&4
18222	cat > try.c <<EOM
18223#$i_dirent I_DIRENT		/**/
18224#$i_sysdir I_SYS_DIR		/**/
18225#$i_sysndir I_SYS_NDIR		/**/
18226#$i_systypes I_SYS_TYPES	/**/
18227
18228#if defined(I_SYS_TYPES)
18229#include <sys/types.h>
18230#endif
18231#if defined(I_DIRENT)
18232#include <dirent.h>
18233#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18234#include <sys/dir.h>
18235#endif
18236#else
18237#ifdef I_SYS_NDIR
18238#include <sys/ndir.h>
18239#else
18240#ifdef I_SYS_DIR
18241#ifdef hp9000s500
18242#include <ndir.h>	/* may be wrong in the future */
18243#else
18244#include <sys/dir.h>
18245#endif
18246#endif
18247#endif
18248#endif
18249int main() { return closedir(opendir(".")); }
18250EOM
18251	set try
18252	if eval $compile_ok; then
18253		if $run ./try > /dev/null 2>&1 ; then
18254			echo "Yes, it does."
18255			val="$undef"
18256		else
18257			echo "No, it doesn't."
18258			val="$define"
18259		fi
18260	else
18261		echo "(I can't seem to compile the test program--assuming it doesn't)"
18262		val="$define"
18263	fi
18264	;;
18265*)
18266	val="$undef";
18267	;;
18268esac
18269set d_void_closedir
18270eval $setvar
18271$rm_try
18272
18273: see if there is a wait4
18274set wait4 d_wait4
18275eval $inlibc
18276
18277: see if waitpid exists
18278set waitpid d_waitpid
18279eval $inlibc
18280
18281: see if wcstombs exists
18282set wcstombs d_wcstombs
18283eval $inlibc
18284
18285: see if wctomb exists
18286set wctomb d_wctomb
18287eval $inlibc
18288
18289: see if writev exists
18290set writev d_writev
18291eval $inlibc
18292
18293: preserve RCS keywords in files with variable substitution, grrr
18294Date='$Date'
18295Id='$Id'
18296Log='$Log'
18297RCSfile='$RCSfile'
18298Revision='$Revision'
18299
18300: check for alignment requirements
18301echo " "
18302case "$usecrosscompile$multiarch" in
18303*$define*)
18304	$cat <<EOM
18305You seem to be either cross-compiling or doing a multiarchitecture build,
18306skipping the memory alignment check.
18307
18308EOM
18309	case "$alignbytes" in
18310	'') alignbytes=8 ;;
18311	esac
18312	;;
18313*)
18314	case "$alignbytes" in
18315	'') echo "Checking alignment constraints..." >&4
18316		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18317			$cat >try.c <<'EOCP'
18318typedef long double NV;
18319EOCP
18320		else
18321			$cat >try.c <<'EOCP'
18322typedef double NV;
18323EOCP
18324		fi
18325		$cat >>try.c <<'EOCP'
18326#include <stdio.h>
18327struct foobar {
18328	char foo;
18329	NV bar;
18330} try_algn;
18331int main()
18332{
18333    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18334    return(0);
18335}
18336EOCP
18337		set try
18338		if eval $compile_ok; then
18339			dflt=`$run ./try`
18340		else
18341			dflt='8'
18342			echo "(I can't seem to compile the test program...)"
18343		fi
18344		;;
18345	*) dflt="$alignbytes"
18346		;;
18347	esac
18348	rp="Doubles must be aligned on a how-many-byte boundary?"
18349	. ./myread
18350	alignbytes="$ans"
18351	$rm_try
18352	;;
18353esac
18354
18355
18356: set the base revision
18357baserev=5.0
18358
18359: how do we concatenate cpp tokens here?
18360echo " "
18361echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18362$cat >cpp_stuff.c <<'EOCP'
18363#define RCAT(a,b)a/**/b
18364#define ACAT(a,b)a ## b
18365RCAT(Rei,ser)
18366ACAT(Cir,cus)
18367EOCP
18368$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18369if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18370	echo "Oh!  Smells like ANSI's been here." >&4
18371	echo "We can catify or stringify, separately or together!"
18372	cpp_stuff=42
18373elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18374	echo "Ah, yes!  The good old days!" >&4
18375	echo "However, in the good old days we don't know how to stringify and"
18376	echo "catify at the same time."
18377	cpp_stuff=1
18378else
18379	$cat >&4 <<EOM
18380Hmm, I don't seem to be able to concatenate tokens with your cpp.
18381You're going to have to edit the values of CAT[2-5] in config.h...
18382EOM
18383	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18384fi
18385$rm -f cpp_stuff.*
18386
18387: see if this is a db.h system
18388set db.h i_db
18389eval $inhdr
18390
18391case "$i_db" in
18392$define)
18393	: Check db version.
18394	echo " "
18395	echo "Checking Berkeley DB version ..." >&4
18396	$cat >try.c <<EOCP
18397#$d_const HASCONST
18398#ifndef HASCONST
18399#define const
18400#endif
18401#include <sys/types.h>
18402#include <stdio.h>
18403#$i_stdlib I_STDLIB
18404#ifdef I_STDLIB
18405#include <stdlib.h>
18406#endif
18407#include <db.h>
18408int main(int argc, char *argv[])
18409{
18410#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
18411    int Major, Minor, Patch ;
18412    unsigned long Version ;
18413    (void)db_version(&Major, &Minor, &Patch) ;
18414    if (argc == 2) {
18415        printf("%d %d %d %d %d %d\n",
18416               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18417               Major, Minor, Patch);
18418        exit(0);
18419    }
18420    printf("You have Berkeley DB Version 2 or greater.\n");
18421
18422    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18423		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18424    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18425		Major, Minor, Patch) ;
18426
18427    /* check that db.h & libdb are compatible */
18428    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18429	printf("db.h and libdb are incompatible.\n") ;
18430        exit(3);
18431    }
18432
18433    printf("db.h and libdb are compatible.\n") ;
18434
18435    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18436		+ DB_VERSION_PATCH ;
18437
18438    /* needs to be >= 2.3.4 */
18439    if (Version < 2003004) {
18440    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18441	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18442        exit(2);
18443    }
18444
18445    exit(0);
18446#else
18447#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18448    if (argc == 2) {
18449        printf("1 0 0\n");
18450        exit(0);
18451    }
18452    printf("You have Berkeley DB Version 1.\n");
18453    exit(0);	/* DB version < 2: the coast is clear. */
18454#else
18455    exit(1);	/* <db.h> not Berkeley DB? */
18456#endif
18457#endif
18458}
18459EOCP
18460	set try
18461	if eval $compile_ok && $run ./try; then
18462		echo 'Looks OK.' >&4
18463		set `$run ./try 1`
18464		db_version_major=$1
18465		db_version_minor=$2
18466		db_version_patch=$3
18467	else
18468		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18469		i_db=$undef
18470		case " $libs " in
18471		*"-ldb "*)
18472			: Remove db from list of libraries to use
18473			echo "Removing unusable -ldb from library list" >&4
18474			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18475			shift
18476			libs="$*"
18477			echo "libs = $libs" >&4
18478			;;
18479		esac
18480	fi
18481	$rm_try
18482	;;
18483esac
18484
18485case "$i_db" in
18486define)
18487	: Check the return type needed for hash
18488	echo " "
18489	echo "Checking return type needed for hash for Berkeley DB ..." >&4
18490	$cat >try.c <<EOCP
18491#$d_const HASCONST
18492#ifndef HASCONST
18493#define const
18494#endif
18495#include <sys/types.h>
18496#include <db.h>
18497
18498#ifndef DB_VERSION_MAJOR
18499u_int32_t hash_cb (ptr, size)
18500const void *ptr;
18501size_t size;
18502{
18503}
18504HASHINFO info;
18505int main()
18506{
18507	info.hash = hash_cb;
18508}
18509#endif
18510EOCP
18511	if $cc $ccflags -c try.c >try.out 2>&1 ; then
18512		if $contains warning try.out >>/dev/null 2>&1 ; then
18513			db_hashtype='int'
18514		else
18515			db_hashtype='u_int32_t'
18516		fi
18517	else
18518		: XXX Maybe we should just give up here.
18519		db_hashtype=u_int32_t
18520		$cat try.out >&4
18521		echo "Help:  I can't seem to compile the db test program." >&4
18522		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18523	fi
18524	$rm_try
18525	echo "Your version of Berkeley DB uses $db_hashtype for hash."
18526	;;
18527*)	db_hashtype=u_int32_t
18528	;;
18529esac
18530case "$i_db" in
18531define)
18532	: Check the return type needed for prefix
18533	echo " "
18534	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18535	cat >try.c <<EOCP
18536#$d_const HASCONST
18537#ifndef HASCONST
18538#define const
18539#endif
18540#include <sys/types.h>
18541#include <db.h>
18542
18543#ifndef DB_VERSION_MAJOR
18544size_t prefix_cb (key1, key2)
18545const DBT *key1;
18546const DBT *key2;
18547{
18548}
18549BTREEINFO info;
18550int main()
18551{
18552	info.prefix = prefix_cb;
18553}
18554#endif
18555EOCP
18556	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18557		if $contains warning try.out >>/dev/null 2>&1 ; then
18558			db_prefixtype='int'
18559		else
18560			db_prefixtype='size_t'
18561		fi
18562	else
18563		db_prefixtype='size_t'
18564		: XXX Maybe we should just give up here.
18565		$cat try.out >&4
18566		echo "Help:  I can't seem to compile the db test program." >&4
18567		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18568	fi
18569	$rm_try
18570	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18571	;;
18572*)	db_prefixtype='size_t'
18573	;;
18574esac
18575
18576: How can we generate normalized random numbers ?
18577echo " "
18578echo "Looking for a random number function..." >&4
18579case "$randfunc" in
18580'')
18581	if set drand48 val -f; eval $csym; $val; then
18582		dflt="drand48"
18583		echo "Good, found drand48()." >&4
18584	elif set random val -f; eval $csym; $val; then
18585		dflt="random"
18586		echo "OK, found random()." >&4
18587	else
18588		dflt="rand"
18589		echo "Yick, looks like I have to use rand()." >&4
18590	fi
18591	echo " "
18592	;;
18593*)
18594	dflt="$randfunc"
18595	;;
18596esac
18597cont=true
18598
18599case "$ccflags" in
18600*-Dmy_rand=*|*-Dmy_srand=*)
18601	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18602	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18603	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18604	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18605	;;
18606esac
18607
18608while $test "$cont"; do
18609	rp="Use which function to generate random numbers?"
18610	. ./myread
18611	if $test "$ans" = "$dflt"; then
18612		: null
18613	else
18614		randbits=''
18615	fi
18616	randfunc="$ans"
18617	if set $ans val -f; eval $csym; $val; then
18618		cont=''
18619	else
18620		dflt=y
18621		rp="I cannot find function $ans. Use that name anyway?"
18622		. ./myread
18623		dflt=rand
18624		case "$ans" in
18625			[yY]*) cont='';;
18626		esac
18627	fi
18628	case "$cont" in
18629	'')
18630		case "$randfunc" in
18631		drand48)
18632			drand01="drand48()"
18633			seedfunc="srand48"
18634			randbits=48
18635			randseedtype=long
18636			;;
18637		rand|random)
18638			case "$randbits" in
18639			'')
18640echo "Checking to see how many bits your $randfunc() function produces..." >&4
18641				$cat >try.c <<EOCP
18642#$i_unistd I_UNISTD
18643#$i_stdlib I_STDLIB
18644#include <stdio.h>
18645#ifdef I_UNISTD
18646#  include <unistd.h>
18647#endif
18648#ifdef I_STDLIB
18649#  include <stdlib.h>
18650#endif
18651int main()
18652{
18653	register int i;
18654	register unsigned long tmp;
18655	register unsigned long max = 0L;
18656
18657	for (i = 1000; i; i--) {
18658		tmp = (unsigned long) $randfunc();
18659		if (tmp > max) max = tmp;
18660	}
18661	for (i = 0; max; i++)
18662		max /= 2;
18663	printf("%d\n",i);
18664}
18665EOCP
18666				set try
18667				if eval $compile_ok; then
18668					dflt=`try`
18669				else
18670					dflt='?'
18671					echo "(I can't seem to compile the test program...)"
18672				fi
18673				;;
18674			*)
18675				dflt="$randbits"
18676				;;
18677			esac
18678			rp="How many bits does your $randfunc() function produce?"
18679			. ./myread
18680			randbits="$ans"
18681			$rm_try
18682			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18683			seedfunc="s$randfunc"
18684			randseedtype=unsigned
18685			;;
18686		*)
18687			dflt="31"
18688			rp="How many bits does your $randfunc() function produce?"
18689			. ./myread
18690			randbits="$ans"
18691			seedfunc="s$randfunc"
18692			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18693			if set $seedfunc val -f; eval $csym; $val; then
18694				echo "(Using $seedfunc() to seed random generator)"
18695			else
18696				echo "(Warning: no $seedfunc() to seed random generator)"
18697				seedfunc=rand
18698			fi
18699			randseedtype=unsigned
18700			;;
18701		esac
18702		;;
18703	esac
18704done
18705
18706echo " "
18707echo "Determining whether or not we are on an EBCDIC system..." >&4
18708$cat >try.c <<'EOM'
18709int main()
18710{
18711  if ('M'==0xd4) return 0;
18712  return 1;
18713}
18714EOM
18715
18716val=$undef
18717set try
18718if eval $compile_ok; then
18719	if $run ./try; then
18720		echo "You seem to speak EBCDIC." >&4
18721		val="$define"
18722	else
18723		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18724	fi
18725else
18726	echo "I'm unable to compile the test program." >&4
18727	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18728fi
18729$rm_try
18730set ebcdic
18731eval $setvar
18732
18733echo " "
18734$cat >&4 <<EOM
18735Checking how to flush all pending stdio output...
18736EOM
18737# I only know how to find the first 32 possibly open files on SunOS.
18738# See also hints/sunos_4_1.sh and util.c  --AD
18739case "$osname" in
18740sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18741esac
18742$cat >>try.c <<EOCP
18743#include <stdio.h>
18744#$i_stdlib I_STDLIB
18745#ifdef I_STDLIB
18746#include <stdlib.h>
18747#endif
18748#$i_unistd I_UNISTD
18749#ifdef I_UNISTD
18750# include <unistd.h>
18751#endif
18752#$d_sysconf HAS_SYSCONF
18753#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18754#ifdef HAS_STDIO_STREAM_ARRAY
18755# define STDIO_STREAM_ARRAY $stdio_stream_array
18756#endif
18757int main() {
18758  FILE* p;
18759  unlink("try.out");
18760  p = fopen("try.out", "w");
18761#ifdef TRY_FPUTC
18762  fputc('x', p);
18763#else
18764# ifdef TRY_FPRINTF
18765  fprintf(p, "x");
18766# endif
18767#endif
18768#ifdef TRY_FFLUSH_NULL
18769  fflush(NULL);
18770#endif
18771#ifdef TRY_FFLUSH_ALL
18772  {
18773    long open_max = -1;
18774# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18775    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18776# else
18777#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18778    open_max = sysconf(_SC_OPEN_MAX);
18779#  else
18780#   ifdef FOPEN_MAX
18781    open_max = FOPEN_MAX;
18782#   else
18783#    ifdef OPEN_MAX
18784    open_max = OPEN_MAX;
18785#    else
18786#     ifdef _NFILE
18787    open_max = _NFILE;
18788#     endif
18789#    endif
18790#   endif
18791#  endif
18792# endif
18793# ifdef HAS_STDIO_STREAM_ARRAY
18794    if (open_max > 0) {
18795      long i;
18796      for (i = 0; i < open_max; i++)
18797	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18798		STDIO_STREAM_ARRAY[i]._file < open_max &&
18799		STDIO_STREAM_ARRAY[i]._flag)
18800		fflush(&STDIO_STREAM_ARRAY[i]);
18801    }
18802  }
18803# endif
18804#endif
18805  _exit(42);
18806}
18807EOCP
18808: first we have to find out how _not_ to flush
18809$to try.c
18810if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18811    output=''
18812    set try -DTRY_FPUTC
18813    if eval $compile; then
18814 	    $run ./try 2>/dev/null
18815	    code="$?"
18816	    $from try.out
18817	    if $test ! -s try.out -a "X$code" = X42; then
18818		output=-DTRY_FPUTC
18819	    fi
18820    fi
18821    case "$output" in
18822    '')
18823	    set try -DTRY_FPRINTF
18824	    if eval $compile; then
18825 		    $run ./try 2>/dev/null
18826		    code="$?"
18827		    $from try.out
18828		    if $test ! -s try.out -a "X$code" = X42; then
18829			output=-DTRY_FPRINTF
18830		    fi
18831	    fi
18832	;;
18833    esac
18834fi
18835: check for fflush NULL behaviour
18836case "$fflushNULL" in
18837'') 	set try -DTRY_FFLUSH_NULL $output
18838	if eval $compile; then
18839	    	$run ./try 2>/dev/null
18840		code="$?"
18841		$from try.out
18842		if $test -s try.out -a "X$code" = X42; then
18843			fflushNULL="`$cat try.out`"
18844		else
18845			if $test "X$code" != X42; then
18846				$cat >&4 <<EOM
18847(If this test failed, don't worry, we'll try another method shortly.)
18848EOM
18849			fi
18850		fi
18851	fi
18852	$rm_try
18853	case "$fflushNULL" in
18854	x)	$cat >&4 <<EOM
18855Your fflush(NULL) works okay for output streams.
18856Let's see if it clobbers input pipes...
18857EOM
18858# As of mid-March 2000 all versions of Solaris appear to have a stdio
18859# bug that improperly flushes the input end of pipes.  So we avoid the
18860# autoflush on fork/system/exec support for now. :-(
18861$cat >tryp.c <<EOCP
18862#include <stdio.h>
18863int
18864main(int argc, char **argv)
18865{
18866    char buf[1024];
18867    int i;
18868    char *bp = buf;
18869    while (1) {
18870        while ((i = getc(stdin)) != -1
18871               && (*bp++ = i) != '\n'
18872               && bp < &buf[1024])
18873    	/* DO NOTHING */ ;
18874        *bp = '\0';
18875        fprintf(stdout, "%s", buf);
18876        fflush(NULL);
18877        if (i == -1)
18878	    return 0;
18879        bp = buf;
18880    }
18881}
18882EOCP
18883                fflushNULL="$define"
18884                set tryp
18885                if eval $compile; then
18886                    $rm -f tryp.out
18887                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18888                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
18889                       $cat >&4 <<EOM
18890fflush(NULL) seems to behave okay with input streams.
18891EOM
18892			fflushNULL="$define"
18893                    else
18894			$cat >&4 <<EOM
18895Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18896EOM
18897                        fflushNULL="$undef"
18898                    fi
18899                fi
18900	        $rm -f core tryp.c tryp.core core.tryp.*
18901		;;
18902	'')	$cat >&4 <<EOM
18903Your fflush(NULL) isn't working (contrary to ANSI C).
18904EOM
18905		fflushNULL="$undef"
18906		;;
18907	*)	$cat >&4 <<EOM
18908Cannot figure out whether your fflush(NULL) works or not.
18909I'm assuming it doesn't (contrary to ANSI C).
18910EOM
18911		fflushNULL="$undef"
18912		;;
18913	esac
18914	;;
18915$define|true|[yY]*)
18916	fflushNULL="$define"
18917	;;
18918*)
18919	fflushNULL="$undef"
18920	;;
18921esac
18922: check explicit looping only if NULL did not work, and if the pipe
18923: bug does not show up on an explicit flush too
18924case "$fflushNULL" in
18925"$undef")
18926	$cat >tryp.c <<EOCP
18927#include <stdio.h>
18928int
18929main(int argc, char **argv)
18930{
18931    char buf[1024];
18932    int i;
18933    char *bp = buf;
18934    while (1) {
18935	while ((i = getc(stdin)) != -1
18936	       && (*bp++ = i) != '\n'
18937	       && bp < &buf[1024])
18938	/* DO NOTHING */ ;
18939	*bp = '\0';
18940	fprintf(stdout, "%s", buf);
18941	fflush(stdin);
18942	if (i == -1)
18943	    return 0;
18944	bp = buf;
18945    }
18946}
18947EOCP
18948	set tryp
18949	if eval $compile; then
18950	    $rm -f tryp.out
18951	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18952	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
18953	       $cat >&4 <<EOM
18954Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18955EOM
18956		: now check for fflushall behaviour
18957		case "$fflushall" in
18958		'') 	set try -DTRY_FFLUSH_ALL $output
18959			if eval $compile; then
18960				$cat >&4 <<EOM
18961(Now testing the other method--but note that this also may fail.)
18962EOM
18963				$run ./try 2>/dev/null
18964				code=$?
18965				$from try.out
18966				if $test -s try.out -a "X$code" = X42; then
18967					fflushall="`$cat try.out`"
18968				fi
18969			fi
18970			$rm_try
18971			case "$fflushall" in
18972			x)	$cat >&4 <<EOM
18973Whew. Flushing explicitly all the stdio streams works.
18974EOM
18975				fflushall="$define"
18976				;;
18977			'')	$cat >&4 <<EOM
18978Sigh. Flushing explicitly all the stdio streams doesn't work.
18979EOM
18980				fflushall="$undef"
18981				;;
18982			*)	$cat >&4 <<EOM
18983Cannot figure out whether flushing stdio streams explicitly works or not.
18984I'm assuming it doesn't.
18985EOM
18986				fflushall="$undef"
18987				;;
18988			esac
18989			;;
18990		"$define"|true|[yY]*)
18991			fflushall="$define"
18992			;;
18993		*)
18994			fflushall="$undef"
18995			;;
18996		esac
18997	    else
18998		$cat >&4 <<EOM
18999All is futile.  Even fflush(stdin) clobbers input pipes!
19000EOM
19001		fflushall="$undef"
19002	    fi
19003	else
19004	    fflushall="$undef"
19005	fi
19006	$rm -f core tryp.c tryp.core core.tryp.*
19007	;;
19008*)	fflushall="$undef"
19009	;;
19010esac
19011
19012case "$fflushNULL$fflushall" in
19013undefundef)
19014	$cat <<EOM
19015OK, I give up.  I cannot figure out how to flush pending stdio output.
19016We won't be flushing handles at all before fork/exec/popen.
19017EOM
19018	;;
19019esac
19020$rm_try
19021
19022: Store the full pathname to the ar program for use in the C program
19023: Respect a hint or command line value for full_ar.
19024case "$full_ar" in
19025'') full_ar=$ar ;;
19026esac
19027
19028: Store the full pathname to the sed program for use in the C program
19029full_sed=$sed
19030
19031: see what type gids are declared as in the kernel
19032echo " "
19033echo "Looking for the type for group ids returned by getgid()."
19034set gid_t gidtype xxx stdio.h sys/types.h
19035eval $typedef
19036case "$gidtype" in
19037xxx)
19038	xxx=`./findhdr sys/user.h`
19039	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19040	case $1 in
19041	unsigned) dflt="$1 $2" ;;
19042	*) dflt="$1" ;;
19043	esac
19044	;;
19045*) dflt="$gidtype";;
19046esac
19047case "$gidtype" in
19048gid_t) echo "gid_t found." ;;
19049*)	rp="What is the type for group ids returned by getgid()?"
19050	. ./myread
19051	gidtype="$ans"
19052	;;
19053esac
19054
19055echo " "
19056case "$gidtype" in
19057*_t) zzz="$gidtype"	;;
19058*)   zzz="gid"		;;
19059esac
19060echo "Checking the size of $zzz..." >&4
19061cat > try.c <<EOCP
19062#include <sys/types.h>
19063#include <stdio.h>
19064#$i_stdlib I_STDLIB
19065#ifdef I_STDLIB
19066#include <stdlib.h>
19067#endif
19068int main() {
19069    printf("%d\n", (int)sizeof($gidtype));
19070    exit(0);
19071}
19072EOCP
19073set try
19074if eval $compile_ok; then
19075	yyy=`$run ./try`
19076	case "$yyy" in
19077	'')	gidsize=4
19078		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19079		;;
19080	*)	gidsize=$yyy
19081		echo "Your $zzz is $gidsize bytes long."
19082		;;
19083	esac
19084else
19085	gidsize=4
19086	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19087fi
19088
19089
19090echo " "
19091case "$gidtype" in
19092*_t) zzz="$gidtype"	;;
19093*)   zzz="gid"		;;
19094esac
19095echo "Checking the sign of $zzz..." >&4
19096cat > try.c <<EOCP
19097#include <sys/types.h>
19098#include <stdio.h>
19099int main() {
19100	$gidtype foo = -1;
19101	if (foo < 0)
19102		printf("-1\n");
19103	else
19104		printf("1\n");
19105}
19106EOCP
19107set try
19108if eval $compile; then
19109	yyy=`$run ./try`
19110	case "$yyy" in
19111	'')	gidsign=1
19112		echo "(I can't execute the test program--guessing unsigned.)" >&4
19113		;;
19114	*)	gidsign=$yyy
19115		case "$gidsign" in
19116		 1) echo "Your $zzz is unsigned." ;;
19117		-1) echo "Your $zzz is signed."   ;;
19118		esac
19119		;;
19120	esac
19121else
19122	gidsign=1
19123	echo "(I can't compile the test program--guessing unsigned.)" >&4
19124fi
19125
19126
19127echo " "
19128
19129if $test X"$quadtype" != X; then
19130
19131echo "Checking how to print 64-bit integers..." >&4
19132
19133if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19134	$cat >try.c <<'EOCP'
19135#include <sys/types.h>
19136#include <stdio.h>
19137int main() {
19138  int q = 12345678901;
19139  printf("%ld\n", q);
19140}
19141EOCP
19142	set try
19143	if eval $compile; then
19144		yyy=`$run ./try`
19145		case "$yyy" in
19146		12345678901)
19147			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19148                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19149			echo "We will use %d."
19150			;;
19151		esac
19152	fi
19153fi
19154
19155if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19156	$cat >try.c <<'EOCP'
19157#include <sys/types.h>
19158#include <stdio.h>
19159int main() {
19160  long q = 12345678901;
19161  printf("%ld\n", q);
19162}
19163EOCP
19164	set try
19165	if eval $compile; then
19166		yyy=`$run ./try`
19167		case "$yyy" in
19168		12345678901)
19169			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19170                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19171			echo "We will use %ld."
19172			;;
19173		esac
19174	fi
19175fi
19176
19177if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19178	$cat >try.c <<'EOCP'
19179#include <sys/types.h>
19180#include <inttypes.h>
19181#include <stdio.h>
19182int main() {
19183  int64_t q = 12345678901;
19184  printf("%" PRId64 "\n", q);
19185}
19186EOCP
19187	set try
19188	if eval $compile; then
19189		yyy=`$run ./try`
19190		case "$yyy" in
19191		12345678901)
19192			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19193                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19194			echo "We will use the C9X style."
19195			;;
19196		esac
19197	fi
19198fi
19199
19200if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19201	$cat >try.c <<EOCP
19202#include <sys/types.h>
19203#include <stdio.h>
19204int main() {
19205  $quadtype q = 12345678901;
19206  printf("%Ld\n", q);
19207}
19208EOCP
19209	set try
19210	if eval $compile; then
19211		yyy=`$run ./try`
19212		case "$yyy" in
19213		12345678901)
19214			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19215                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19216			echo "We will use %Ld."
19217			;;
19218		esac
19219	fi
19220fi
19221
19222if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19223	$cat >try.c <<'EOCP'
19224#include <sys/types.h>
19225#include <stdio.h>
19226int main() {
19227  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19228  printf("%lld\n", q);
19229}
19230EOCP
19231	set try
19232	if eval $compile; then
19233		yyy=`$run ./try`
19234		case "$yyy" in
19235		12345678901)
19236			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19237                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19238			echo "We will use the %lld style."
19239			;;
19240		esac
19241	fi
19242fi
19243
19244if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19245	$cat >try.c <<EOCP
19246#include <sys/types.h>
19247#include <stdio.h>
19248int main() {
19249  $quadtype q = 12345678901;
19250  printf("%qd\n", q);
19251}
19252EOCP
19253	set try
19254	if eval $compile; then
19255		yyy=`$run ./try`
19256		case "$yyy" in
19257		12345678901)
19258			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19259                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19260			echo "We will use %qd."
19261			;;
19262		esac
19263	fi
19264fi
19265
19266if $test X"$sPRId64" = X; then
19267	echo "Cannot figure out how to print 64-bit integers." >&4
19268fi
19269$rm_try
19270
19271fi
19272
19273case "$sPRId64" in
19274'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19275	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19276	;;
19277*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19278	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19279	;;
19280esac
19281
19282
19283echo " "
19284$echo "Checking the format strings to be used for Perl's internal types..." >&4
19285
19286if $test X"$ivsize" = X8; then
19287	ivdformat="$sPRId64"
19288	uvuformat="$sPRIu64"
19289	uvoformat="$sPRIo64"
19290	uvxformat="$sPRIx64"
19291	uvXUformat="$sPRIXU64"
19292else
19293	if $test X"$ivsize" = X"$longsize"; then
19294		ivdformat='"ld"'
19295		uvuformat='"lu"'
19296		uvoformat='"lo"'
19297		uvxformat='"lx"'
19298		uvXUformat='"lX"'
19299	else
19300		if $test X"$ivsize" = X"$intsize"; then
19301			ivdformat='"d"'
19302			uvuformat='"u"'
19303			uvoformat='"o"'
19304			uvxformat='"x"'
19305			uvXUformat='"X"'
19306		else
19307			: far out
19308			if $test X"$ivsize" = X"$shortsize"; then
19309				ivdformat='"hd"'
19310				uvuformat='"hu"'
19311				uvoformat='"ho"'
19312				uvxformat='"hx"'
19313				uvXUformat='"hX"'
19314			fi
19315		fi
19316	fi
19317fi
19318
19319if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19320	nveformat="$sPRIeldbl"
19321	nvfformat="$sPRIfldbl"
19322	nvgformat="$sPRIgldbl"
19323	nvEUformat="$sPRIEUldbl"
19324	nvFUformat="$sPRIFUldbl"
19325	nvGUformat="$sPRIGUldbl"
19326else
19327	nveformat='"e"'
19328	nvfformat='"f"'
19329	nvgformat='"g"'
19330	nvEUformat='"E"'
19331	nvFUformat='"F"'
19332	nvGUformat='"G"'
19333fi
19334
19335case "$ivdformat" in
19336'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19337    exit 1
19338    ;;
19339esac
19340
19341
19342echo " "
19343$echo "Checking the format string to be used for gids..." >&4
19344
19345case "$gidsign" in
19346-1)	if $test X"$gidsize" = X"$ivsize"; then
19347		gidformat="$ivdformat"
19348	else
19349		if $test X"$gidsize" = X"$longsize"; then
19350			gidformat='"ld"'
19351		else
19352			if $test X"$gidsize" = X"$intsize"; then
19353				gidformat='"d"'
19354			else
19355				if $test X"$gidsize" = X"$shortsize"; then
19356					gidformat='"hd"'
19357				fi
19358			fi
19359		fi
19360	fi
19361	;;
19362*)	if $test X"$gidsize" = X"$uvsize"; then
19363		gidformat="$uvuformat"
19364	else
19365		if $test X"$gidsize" = X"$longsize"; then
19366			gidformat='"lu"'
19367		else
19368			if $test X"$gidsize" = X"$intsize"; then
19369				gidformat='"u"'
19370			else
19371				if $test X"$gidsize" = X"$shortsize"; then
19372					gidformat='"hu"'
19373				fi
19374			fi
19375		fi
19376	fi
19377	;;
19378esac
19379
19380: see if getgroups exists
19381set getgroups d_getgrps
19382eval $inlibc
19383
19384: see if setgroups exists
19385set setgroups d_setgrps
19386eval $inlibc
19387
19388
19389: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19390echo " "
19391case "$d_getgrps$d_setgrps" in
19392*define*)
19393	case "$groupstype" in
19394	'') dflt="$gidtype" ;;
19395	*)  dflt="$groupstype" ;;
19396	esac
19397	$cat <<EOM
19398What type of pointer is the second argument to getgroups() and setgroups()?
19399Usually this is the same as group ids, $gidtype, but not always.
19400
19401EOM
19402	rp='What type pointer is the second argument to getgroups() and setgroups()?'
19403	. ./myread
19404	groupstype="$ans"
19405	;;
19406*)  groupstype="$gidtype";;
19407esac
19408
19409
19410if $test $patchlevel -lt 9; then
19411: MAD is not available in 5.8.x or earlier.
19412    ans=n;
19413else
19414    case "$mad" in
19415    $define|true|[yY]*)	dflt='y' ;;
19416    *)			dflt='n' ;;
19417    esac
19418    cat <<EOM
19419
19420Would you like to build with Misc Attribute Decoration? This is development
19421work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19422overhead on the interpreter.
19423
19424If this doesn't make any sense to you, just accept the default '$dflt'.
19425EOM
19426    rp='Build Perl with MAD?'
19427    . ./myread
19428fi
19429case "$ans" in
19430y|Y)	val="$define"
19431	madlyh='madly.h madly.act madly.tab'
19432	madlysrc='madly.c'
19433	madlyobj="madly$_o" ;;
19434*)	val="$undef"
19435	madlyh=''
19436	madlysrc=''
19437	madlyobj='' ;;
19438esac
19439set mad
19440eval $setvar
19441
19442echo " "
19443echo "Checking if your $make program sets \$(MAKE)..." >&4
19444case "$make_set_make" in
19445'')
19446	$sed 's/^X //' > testmake.mak << 'EOF'
19447Xall:
19448X 	@echo 'maketemp="$(MAKE)"'
19449EOF
19450	case "`$make -f testmake.mak 2>/dev/null`" in
19451	*maketemp=*) make_set_make='#' ;;
19452	*)	make_set_make="MAKE=$make" ;;
19453	esac
19454	$rm -f testmake.mak
19455	;;
19456esac
19457case "$make_set_make" in
19458'#') echo "Yup, it does.";;
19459*) echo "Nope, it doesn't.";;
19460esac
19461
19462: see what type is used for mode_t
19463rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19464set mode_t modetype int stdio.h sys/types.h
19465eval $typedef_ask
19466
19467: see if we need va_copy
19468echo " "
19469case "$i_stdarg" in
19470"$define")
19471	$cat >try.c <<EOCP
19472#include <stdarg.h>
19473#include <stdio.h>
19474#$i_stdlib I_STDLIB
19475#ifdef I_STDLIB
19476#include <stdlib.h>
19477#endif
19478#include <signal.h>
19479
19480int
19481ivfprintf(FILE *f, const char *fmt, va_list *valp)
19482{
19483  return vfprintf(f, fmt, *valp);
19484}
19485
19486int
19487myvfprintf(FILE *f, const  char *fmt, va_list val)
19488{
19489  return ivfprintf(f, fmt, &val);
19490}
19491
19492int
19493myprintf(char *fmt, ...)
19494{
19495  va_list val;
19496  va_start(val, fmt);
19497  return myvfprintf(stdout, fmt, val);
19498}
19499
19500int
19501main(int ac, char **av)
19502{
19503  signal(SIGSEGV, exit);
19504
19505  myprintf("%s%cs all right, then\n", "that", '\'');
19506  exit(0);
19507}
19508EOCP
19509	set try
19510	if eval $compile && $run ./try 2>&1 >/dev/null; then
19511		case "`$run ./try`" in
19512		"that's all right, then")
19513			okay=yes
19514			;;
19515		esac
19516	fi
19517	case "$okay" in
19518	yes)	echo "It seems that you don't need va_copy()." >&4
19519		need_va_copy="$undef"
19520		;;
19521	*)	echo "It seems that va_copy() or similar will be needed." >&4
19522		need_va_copy="$define"
19523		;;
19524	esac
19525	$rm_try
19526	;;
19527*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19528	;;
19529esac
19530
19531: see what type is used for size_t
19532rp="What is the type used for the length parameter for string functions?"
19533set size_t sizetype 'unsigned int' stdio.h sys/types.h
19534eval $typedef_ask
19535
19536: check for type of arguments to gethostbyaddr.
19537if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19538	case "$d_gethbyaddr" in
19539	$define)
19540		$cat <<EOM
19541
19542Checking to see what type of arguments are accepted by gethostbyaddr().
19543EOM
19544		hdrs="$define sys/types.h
19545			$d_socket sys/socket.h
19546			$i_niin netinet/in.h
19547			$i_netdb netdb.h
19548			$i_unistd unistd.h"
19549		: The first arg can 'char *' or 'void *'
19550		: The second arg is some of integral type
19551		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19552			for yyy in size_t long int; do
19553				case "$netdb_host_type" in
19554				'')	try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19555					if ./protochk "$try" $hdrs; then
19556						echo "Your system accepts $xxx for the first arg."
19557						echo "...and $yyy for the second arg."
19558						netdb_host_type="$xxx"
19559						netdb_hlen_type="$yyy"
19560					fi
19561					;;
19562				esac
19563			done
19564		done
19565		: In case none of those worked, prompt the user.
19566		case "$netdb_host_type" in
19567		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
19568			dflt='char *'
19569			. ./myread
19570			netdb_host_type=$ans
19571			rp='What is the type for the 2nd argument to gethostbyaddr?'
19572			dflt="$sizetype"
19573			. ./myread
19574			netdb_hlen_type=$ans
19575			;;
19576		esac
19577		;;
19578	*)	: no gethostbyaddr, so pick harmless defaults
19579		netdb_host_type='char *'
19580		netdb_hlen_type="$sizetype"
19581		;;
19582	esac
19583	# Remove the "const" if needed. -- but then we'll have a
19584	# prototype clash!
19585	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19586fi
19587
19588: check for type of argument to gethostbyname.
19589if test "X$netdb_name_type" = X ; then
19590	case "$d_gethbyname" in
19591	$define)
19592		$cat <<EOM
19593
19594Checking to see what type of argument is accepted by gethostbyname().
19595EOM
19596		hdrs="$define sys/types.h
19597			$d_socket sys/socket.h
19598			$i_niin netinet/in.h
19599			$i_netdb netdb.h
19600			$i_unistd unistd.h"
19601		for xxx in "const char *" "char *"; do
19602			case "$netdb_name_type" in
19603			'')	try="extern struct hostent *gethostbyname($xxx);"
19604				if ./protochk "$try" $hdrs; then
19605					echo "Your system accepts $xxx."
19606					netdb_name_type="$xxx"
19607				fi
19608				;;
19609			esac
19610		done
19611		: In case none of those worked, prompt the user.
19612		case "$netdb_name_type" in
19613		'')	rp='What is the type for the 1st argument to gethostbyname?'
19614			dflt='char *'
19615			. ./myread
19616			netdb_name_type=$ans
19617			;;
19618		esac
19619		;;
19620	*)	: no gethostbyname, so pick harmless default
19621		netdb_name_type='char *'
19622		;;
19623	esac
19624fi
19625
19626: check for type of 1st argument to getnetbyaddr.
19627if test "X$netdb_net_type" = X ; then
19628	case "$d_getnbyaddr" in
19629	$define)
19630		$cat <<EOM
19631
19632Checking to see what type of 1st argument is accepted by getnetbyaddr().
19633EOM
19634		hdrs="$define sys/types.h
19635			$d_socket sys/socket.h
19636			$i_niin netinet/in.h
19637			$i_netdb netdb.h
19638			$i_unistd unistd.h"
19639		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19640			case "$netdb_net_type" in
19641			'')	try="extern struct netent *getnetbyaddr($xxx, int);"
19642				if ./protochk "$try" $hdrs; then
19643					echo "Your system accepts $xxx."
19644					netdb_net_type="$xxx"
19645				fi
19646				;;
19647			esac
19648		done
19649		: In case none of those worked, prompt the user.
19650		case "$netdb_net_type" in
19651		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
19652			dflt='long'
19653			. ./myread
19654			netdb_net_type=$ans
19655			;;
19656		esac
19657		;;
19658	*)	: no getnetbyaddr, so pick harmless default
19659		netdb_net_type='long'
19660		;;
19661	esac
19662fi
19663: locate the preferred pager for this system
19664fn=f/
19665case "$pager" in
19666'')
19667	dflt=''
19668	case "$pg" in
19669	/*) dflt=$pg;;
19670	[a-zA-Z]:/*) dflt=$pg;;
19671	esac
19672	case "$more" in
19673	/*) dflt=$more;;
19674	[a-zA-Z]:/*) dflt=$more;;
19675	esac
19676	case "$less" in
19677	/*) dflt=$less;;
19678	[a-zA-Z]:/*) dflt=$less;;
19679	esac
19680	case "$dflt" in
19681	'') dflt=/usr/ucb/more;;
19682	esac
19683	;;
19684*)	dflt="$pager"
19685	: Instruct ./getfile to trust the hinted or previous pager value,
19686	: even if it does not begin with a slash.  For example, on os2,
19687	: pager might be cmd /c more.  See comments in UU/getfile.
19688	fn="f/($pager)"
19689	;;
19690esac
19691echo " "
19692rp='What pager is used on your system?'
19693. ./getfile
19694pager="$ans"
19695
19696: see what type pids are declared as in the kernel
19697rp="What is the type of process ids on this system?"
19698set pid_t pidtype int stdio.h sys/types.h
19699eval $typedef_ask
19700
19701: see if ar generates random libraries by itself
19702echo " "
19703echo "Checking how to generate random libraries on your machine..." >&4
19704echo 'int bar1() { return bar2(); }' > bar1.c
19705echo 'int bar2() { return 2; }' > bar2.c
19706$cat > foo.c <<EOP
19707#$i_stdlib I_STDLIB
19708#ifdef I_STDLIB
19709#include <stdlib.h>
19710#endif
19711int main() { printf("%d\n", bar1()); exit(0); }
19712EOP
19713$cc $ccflags -c bar1.c >/dev/null 2>&1
19714$cc $ccflags -c bar2.c >/dev/null 2>&1
19715$cc $ccflags -c foo.c >/dev/null 2>&1
19716$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19717if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19718	$run ./foobar >/dev/null 2>&1; then
19719	echo "$ar appears to generate random libraries itself."
19720	orderlib=false
19721	if [ "X$ranlib" = "X" ]; then
19722	    ranlib=":"
19723	fi
19724elif $ar s bar$_a >/dev/null 2>&1 &&
19725	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19726	$run ./foobar >/dev/null 2>&1; then
19727		echo "a table of contents needs to be added with '$ar s'."
19728		orderlib=false
19729		ranlib="$ar s"
19730elif $ar ts bar$_a >/dev/null 2>&1 &&
19731	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19732	$run ./foobar >/dev/null 2>&1; then
19733		echo "a table of contents needs to be added with '$ar ts'."
19734		orderlib=false
19735		ranlib="$ar ts"
19736else
19737	case "$ranlib" in
19738	:) ranlib='';;
19739	'')
19740		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19741		$test -f $ranlib || ranlib=''
19742		;;
19743	esac
19744	if $test -n "$ranlib"; then
19745		echo "your system has '$ranlib'; we'll use that."
19746		orderlib=false
19747	else
19748		echo "your system doesn't seem to support random libraries"
19749		echo "so we'll use lorder and tsort to order the libraries."
19750		orderlib=true
19751		ranlib=":"
19752	fi
19753fi
19754$rm -f foo* bar*
19755
19756: check for type of arguments to select.
19757case "$selecttype" in
19758'') case "$d_select" in
19759	$define)
19760		echo " "
19761		$cat <<EOM
19762Checking to see what type of arguments are accepted by select().
19763EOM
19764		hdrs="$define sys/types.h
19765			$i_systime sys/time.h
19766			$i_sysselct sys/select.h
19767			$d_socket sys/socket.h"
19768		: The first arg can be int, unsigned, or size_t
19769		: The last arg may or may not be 'const'
19770		val=''
19771		: void pointer has been seen but using that
19772		: breaks the selectminbits test
19773		for xxx in 'fd_set *' 'int *'; do
19774			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19775				for tmo in 'struct timeval *' 'const struct timeval *'; do
19776					case "$val" in
19777					'')	try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19778						if ./protochk "$try" $hdrs; then
19779							echo "Your system accepts $xxx."
19780							val="$xxx"
19781						fi
19782						;;
19783					esac
19784				done
19785			done
19786		done
19787		case "$val" in
19788		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19789			case "$d_fd_set" in
19790				$define) dflt="fd_set *" ;;
19791				*)		dflt="int *" ;;
19792			esac
19793			. ./myread
19794			val=$ans
19795			;;
19796		esac
19797		selecttype="$val"
19798		;;
19799	*)	: no select, so pick a harmless default
19800		selecttype='int *'
19801		;;
19802	esac
19803	;;
19804esac
19805
19806: check for the select 'width'
19807case "$selectminbits" in
19808'') safebits=`expr $ptrsize \* 8`
19809    case "$d_select" in
19810	$define)
19811		$cat <<EOM
19812
19813Checking to see on how many bits at a time your select() operates...
19814EOM
19815		$cat >try.c <<EOCP
19816#include <sys/types.h>
19817#$i_time I_TIME
19818#$i_systime I_SYS_TIME
19819#$i_systimek I_SYS_TIME_KERNEL
19820#ifdef I_TIME
19821#   include <time.h>
19822#endif
19823#ifdef I_SYS_TIME
19824#   ifdef I_SYS_TIME_KERNEL
19825#	define KERNEL
19826#   endif
19827#   include <sys/time.h>
19828#   ifdef I_SYS_TIME_KERNEL
19829#	undef KERNEL
19830#   endif
19831#endif
19832#$i_sysselct I_SYS_SELECT
19833#ifdef I_SYS_SELECT
19834#include <sys/select.h>
19835#endif
19836#$d_socket HAS_SOCKET
19837#ifdef HAS_SOCKET
19838#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19839#endif
19840#include <stdio.h>
19841#$i_stdlib I_STDLIB
19842#ifdef I_STDLIB
19843#include <stdlib.h>
19844#endif
19845$selecttype b;
19846#define S sizeof(*(b))
19847#define MINBITS	64
19848#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19849#define NBITS  (NBYTES * 8)
19850int main() {
19851    char *s = (char *)malloc(NBYTES);
19852    struct timeval t;
19853    int i;
19854    FILE* fp;
19855    int fd;
19856
19857    if (!s)
19858	exit(1);
19859    fclose(stdin);
19860    fp = fopen("try.c", "r");
19861    if (fp == 0)
19862      exit(2);
19863    fd = fileno(fp);
19864    if (fd < 0)
19865      exit(3);
19866    b = ($selecttype)s;
19867    for (i = 0; i < NBITS; i++)
19868	FD_SET(i, b);
19869    t.tv_sec  = 0;
19870    t.tv_usec = 0;
19871    select(fd + 1, b, 0, 0, &t);
19872    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19873    free(s);
19874    printf("%d\n", i + 1);
19875    return 0;
19876}
19877EOCP
19878		set try
19879		if eval $compile_ok; then
19880			selectminbits=`$run ./try`
19881			case "$selectminbits" in
19882			'')	cat >&4 <<EOM
19883Cannot figure out on how many bits at a time your select() operates.
19884I'll play safe and guess it is $safebits bits.
19885EOM
19886				selectminbits=$safebits
19887				bits="$safebits bits"
19888				;;
19889			1)	bits="1 bit" ;;
19890			*)	bits="$selectminbits bits" ;;
19891			esac
19892			echo "Your select() operates on $bits at a time." >&4
19893		else
19894			rp='What is the minimum number of bits your select() operates on?'
19895			case "$byteorder" in
19896			12345678)	dflt=64 ;;
19897			1234)		dflt=32 ;;
19898			*)		dflt=1	;;
19899			esac
19900			. ./myread
19901			val=$ans
19902			selectminbits="$val"
19903		fi
19904		$rm_try
19905		;;
19906	*)	: no select, so pick a harmless default
19907		selectminbits=$safebits
19908		;;
19909	esac
19910	;;
19911esac
19912
19913: Trace out the files included by signal.h, then look for SIGxxx names.
19914: Remove SIGARRAYSIZE used by HPUX.
19915: Remove SIGSTKSIZE used by Linux.
19916: Remove SIGSTKSZ used by Posix.
19917: Remove SIGTYP void lines used by OS2.
19918: Some cpps, like os390, dont give the file name anywhere
19919if [ "X$fieldn" = X ]; then
19920	: Just make some guesses.  We check them later.
19921	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19922else
19923	xxx=`echo '#include <signal.h>' |
19924	$cppstdin $cppminus $cppflags 2>/dev/null |
19925	$grep '^[ 	]*#.*include' |
19926	$awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19927fi
19928: Check this list of files to be sure we have parsed the cpp output ok.
19929: This will also avoid potentially non-existent files, such
19930: as ../foo/bar.h
19931xxxfiles=''
19932for xx in $xxx /dev/null ; do
19933	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
19934done
19935: If we have found no files, at least try signal.h
19936case "$xxxfiles" in
19937'')	xxxfiles=`./findhdr signal.h` ;;
19938esac
19939xxx=`awk '
19940$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19941	print substr($2, 4, 20)
19942}
19943$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19944	print substr($3, 4, 20)
19945}' $xxxfiles`
19946: Append some common names just in case the awk scan failed.
19947xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19948xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19949xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19950xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19951xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19952
19953: generate a few handy files for later
19954$cat > signal.c <<EOCP
19955#include <sys/types.h>
19956#include <signal.h>
19957#$i_stdlib I_STDLIB
19958#ifdef I_STDLIB
19959#include <stdlib.h>
19960#endif
19961#include <stdio.h>
19962int main() {
19963
19964/* Strange style to avoid deeply-nested #if/#else/#endif */
19965#ifndef NSIG
19966#  ifdef _NSIG
19967#    define NSIG (_NSIG)
19968#  endif
19969#endif
19970
19971#ifndef NSIG
19972#  ifdef SIGMAX
19973#    define NSIG (SIGMAX+1)
19974#  endif
19975#endif
19976
19977#ifndef NSIG
19978#  ifdef SIG_MAX
19979#    define NSIG (SIG_MAX+1)
19980#  endif
19981#endif
19982
19983#ifndef NSIG
19984#  ifdef _SIG_MAX
19985#    define NSIG (_SIG_MAX+1)
19986#  endif
19987#endif
19988
19989#ifndef NSIG
19990#  ifdef MAXSIG
19991#    define NSIG (MAXSIG+1)
19992#  endif
19993#endif
19994
19995#ifndef NSIG
19996#  ifdef MAX_SIG
19997#    define NSIG (MAX_SIG+1)
19998#  endif
19999#endif
20000
20001#ifndef NSIG
20002#  ifdef SIGARRAYSIZE
20003#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20004#  endif
20005#endif
20006
20007#ifndef NSIG
20008#  ifdef _sys_nsig
20009#    define NSIG (_sys_nsig) /* Solaris 2.5 */
20010#  endif
20011#endif
20012
20013/* Default to some arbitrary number that's big enough to get most
20014   of the common signals.
20015*/
20016#ifndef NSIG
20017#    define NSIG 50
20018#endif
20019
20020printf("NSIG %d\n", NSIG);
20021
20022#ifndef JUST_NSIG
20023
20024EOCP
20025
20026echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20027{
20028	printf "#ifdef SIG"; printf $1; printf "\n"
20029	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20030	printf $1; printf ");\n"
20031	printf "#endif\n"
20032}
20033END {
20034	printf "#endif /* JUST_NSIG */\n";
20035	printf "exit(0);\n}\n";
20036}
20037' >>signal.c
20038$cat >signal.awk <<'EOP'
20039BEGIN { ndups = 0 }
20040$1 ~ /^NSIG$/ { nsig = $2 }
20041($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20042    if ($2 > maxsig) { maxsig = $2 }
20043    if (sig_name[$2]) {
20044	dup_name[ndups] = $1
20045	dup_num[ndups] = $2
20046	ndups++
20047    }
20048    else {
20049	sig_name[$2] = $1
20050	sig_num[$2] = $2
20051    }
20052}
20053END {
20054    if (nsig == 0) {
20055    	nsig = maxsig + 1
20056    }
20057    printf("NSIG %d\n", nsig);
20058    for (n = 1; n < nsig; n++) {
20059 	if (sig_name[n]) {
20060 	    printf("%s %d\n", sig_name[n], sig_num[n])
20061	}
20062 	else {
20063 	    printf("NUM%d %d\n", n, n)
20064 	}
20065    }
20066    for (n = 0; n < ndups; n++) {
20067 	printf("%s %d\n", dup_name[n], dup_num[n])
20068    }
20069}
20070EOP
20071$cat >signal_cmd <<EOS
20072$startsh
20073if $test -s signal.lst; then
20074    echo "Using your existing signal.lst file"
20075	exit 0
20076fi
20077xxx="$xxx"
20078EOS
20079$cat >>signal_cmd <<'EOS'
20080
20081set signal
20082if eval $compile_ok; then
20083	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20084else
20085	echo "(I can't seem be able to compile the whole test program)" >&4
20086	echo "(I'll try it in little pieces.)" >&4
20087	set signal -DJUST_NSIG
20088	if eval $compile_ok; then
20089		$run ./signal$_exe > signal.nsg
20090		$cat signal.nsg
20091	else
20092		echo "I can't seem to figure out how many signals you have." >&4
20093		echo "Guessing 50." >&4
20094		echo 'NSIG 50' > signal.nsg
20095	fi
20096	: Now look at all the signal names, one at a time.
20097	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20098		$cat > signal.c <<EOCP
20099#include <sys/types.h>
20100#include <signal.h>
20101#include <stdio.h>
20102int main() {
20103printf("$xx %d\n", SIG${xx});
20104return 0;
20105}
20106EOCP
20107		set signal
20108		if eval $compile; then
20109			echo "SIG${xx} found."
20110			$run ./signal$_exe  >> signal.ls1
20111		else
20112			echo "SIG${xx} NOT found."
20113		fi
20114	done
20115	if $test -s signal.ls1; then
20116		$cat signal.nsg signal.ls1 |
20117			$sort -n | $uniq | $awk -f signal.awk >signal.lst
20118	fi
20119
20120fi
20121if $test -s signal.lst; then
20122	:
20123else
20124	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20125	echo 'kill -l' >signal
20126	set X `csh -f <signal`
20127	$rm -f signal
20128	shift
20129	case $# in
20130	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20131	esac
20132	echo $@ | $tr ' ' $trnl | \
20133 	    $awk '{ printf "%s %d\n", $1, ++s; }
20134 		  END { printf "NSIG %d\n", ++s }' >signal.lst
20135fi
20136$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20137EOS
20138chmod a+x signal_cmd
20139$eunicefix signal_cmd
20140
20141: generate list of signal names
20142echo " "
20143case "$sig_name_init" in
20144'') doinit=yes ;;
20145*)  case "$sig_num_init" in
20146    ''|*,*) doinit=yes ;;
20147    esac ;;
20148esac
20149case "$doinit" in
20150yes)
20151	echo "Generating a list of signal names and numbers..." >&4
20152	. ./signal_cmd
20153 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20154 	sig_name=`$awk 'BEGIN { printf "ZERO " }
20155 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
20156 	sig_num=`$awk  'BEGIN { printf "0 " }
20157 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
20158 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
20159 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
20160 			     END	{ printf "0\n" }' signal.lst`
20161 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
20162 			     !/^NSIG/	{ printf "%d, ", $2}
20163 			     END	{ printf "0\n"}' signal.lst`
20164	;;
20165esac
20166echo "The following $sig_count signals are available:"
20167echo " "
20168echo $sig_name | $awk \
20169'BEGIN { linelen = 0 }
20170{
20171	for (i = 1; i <= NF; i++) {
20172		name = "SIG" $i " "
20173		linelen = linelen + length(name)
20174		if (linelen > 70) {
20175			printf "\n"
20176			linelen = length(name)
20177		}
20178		printf "%s", name
20179	}
20180	printf "\n"
20181}'
20182sig_size=`echo $sig_name | awk '{print NF}'`
20183$rm -f signal signal.c signal.awk signal.lst signal_cmd
20184
20185echo " "
20186case "$sizetype" in
20187*_t) zzz="$sizetype"	;;
20188*)   zzz="filesize"	;;
20189esac
20190echo "Checking the size of $zzz..." >&4
20191cat > try.c <<EOCP
20192#include <sys/types.h>
20193#include <stdio.h>
20194#$i_stdlib I_STDLIB
20195#ifdef I_STDLIB
20196#include <stdlib.h>
20197#endif
20198int main() {
20199    printf("%d\n", (int)sizeof($sizetype));
20200    exit(0);
20201}
20202EOCP
20203set try
20204if eval $compile_ok; then
20205	yyy=`$run ./try`
20206	case "$yyy" in
20207	'')	sizesize=4
20208		echo "(I can't execute the test program--guessing $sizesize.)" >&4
20209		;;
20210	*)	sizesize=$yyy
20211		echo "Your $zzz size is $sizesize bytes."
20212		;;
20213	esac
20214else
20215	sizesize=4
20216	echo "(I can't compile the test program--guessing $sizesize.)" >&4
20217fi
20218
20219
20220: check for socklen_t
20221echo " "
20222echo "Checking to see if you have socklen_t..." >&4
20223$cat >try.c <<EOCP
20224#include <sys/types.h>
20225#$d_socket HAS_SOCKET
20226#ifdef HAS_SOCKET
20227#include <sys/socket.h>
20228#endif
20229int main() { socklen_t x = 16; }
20230EOCP
20231set try
20232if eval $compile; then
20233	val="$define"
20234	echo "You have socklen_t."
20235else
20236	val="$undef"
20237	echo "You do not have socklen_t."
20238	case "$sizetype" in
20239	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20240	esac
20241fi
20242$rm_try
20243set d_socklen_t
20244eval $setvar
20245
20246: see if this is a socks.h system
20247set socks.h i_socks
20248eval $inhdr
20249
20250: check for type of the size argument to socket calls
20251case "$d_socket" in
20252"$define")
20253	$cat <<EOM
20254
20255Checking to see what type is the last argument of accept().
20256EOM
20257	yyy=''
20258	case "$d_socklen_t" in
20259	"$define") yyy="$yyy socklen_t"
20260	esac
20261	yyy="$yyy $sizetype int long unsigned"
20262	for xxx in $yyy; do
20263		case "$socksizetype" in
20264		'')	try="extern int accept(int, struct sockaddr *, $xxx *);"
20265			case "$usesocks" in
20266			"$define")
20267				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20268					echo "Your system accepts '$xxx *' for the last argument of accept()."
20269					socksizetype="$xxx"
20270				fi
20271				;;
20272			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20273					echo "Your system accepts '$xxx *' for the last argument of accept()."
20274					socksizetype="$xxx"
20275				fi
20276				;;
20277			esac
20278			;;
20279		esac
20280	done
20281: In case none of those worked, prompt the user.
20282	case "$socksizetype" in
20283	'')	rp='What is the type for socket address structure sizes?'
20284		dflt='int'
20285		. ./myread
20286		socksizetype=$ans
20287		;;
20288	esac
20289	;;
20290*)	: no sockets, so pick relatively harmless default
20291	socksizetype='int'
20292	;;
20293esac
20294
20295: see what type is used for signed size_t
20296set ssize_t ssizetype int stdio.h sys/types.h
20297eval $typedef
20298dflt="$ssizetype"
20299$cat > try.c <<EOM
20300#include <stdio.h>
20301#$i_stdlib I_STDLIB
20302#ifdef I_STDLIB
20303#include <stdlib.h>
20304#endif
20305#include <sys/types.h>
20306#define Size_t $sizetype
20307#define SSize_t $dflt
20308int main()
20309{
20310	if (sizeof(Size_t) == sizeof(SSize_t))
20311		printf("$dflt\n");
20312	else if (sizeof(Size_t) == sizeof(int))
20313		printf("int\n");
20314	else
20315		printf("long\n");
20316	exit(0);
20317}
20318EOM
20319echo " "
20320set try
20321if eval $compile_ok && $run ./try > /dev/null; then
20322	ssizetype=`$run ./try`
20323	echo "I'll be using $ssizetype for functions returning a byte count." >&4
20324else
20325	$cat >&4 <<EOM
20326Help! I can't compile and run the ssize_t test program: please enlighten me!
20327(This is probably a misconfiguration in your system or libraries, and
20328you really ought to fix it.  Still, I'll try anyway.)
20329
20330I need a type that is the same size as $sizetype, but is guaranteed to
20331be signed.  Common values are ssize_t, int and long.
20332
20333EOM
20334	rp="What signed type is the same size as $sizetype?"
20335	. ./myread
20336	ssizetype="$ans"
20337fi
20338$rm_try
20339
20340: see what type of char stdio uses.
20341echo " "
20342echo '#include <stdio.h>' > stdio.c
20343$cppstdin $cppminus < stdio.c > stdioh
20344if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20345	echo "Your stdio uses unsigned chars." >&4
20346	stdchar="unsigned char"
20347else
20348	echo "Your stdio uses signed chars." >&4
20349	stdchar="char"
20350fi
20351$rm -f stdio.* stdioh
20352
20353: see what type uids are declared as in the kernel
20354echo " "
20355echo "Looking for the type for user ids returned by getuid()."
20356set uid_t uidtype xxx stdio.h sys/types.h
20357eval $typedef
20358case "$uidtype" in
20359xxx)
20360	xxx=`./findhdr sys/user.h`
20361	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20362	case $1 in
20363	unsigned) dflt="$1 $2" ;;
20364	*) dflt="$1" ;;
20365	esac
20366	;;
20367*) dflt="$uidtype";;
20368esac
20369case "$uidtype" in
20370uid_t)	echo "uid_t found." ;;
20371*)	rp="What is the type for user ids returned by getuid()?"
20372	. ./myread
20373	uidtype="$ans"
20374	;;
20375esac
20376
20377echo " "
20378case "$uidtype" in
20379*_t) zzz="$uidtype"	;;
20380*)   zzz="uid"		;;
20381esac
20382echo "Checking the size of $zzz..." >&4
20383cat > try.c <<EOCP
20384#include <sys/types.h>
20385#include <stdio.h>
20386#$i_stdlib I_STDLIB
20387#ifdef I_STDLIB
20388#include <stdlib.h>
20389#endif
20390int main() {
20391    printf("%d\n", (int)sizeof($uidtype));
20392    exit(0);
20393}
20394EOCP
20395set try
20396if eval $compile_ok; then
20397	yyy=`$run ./try`
20398	case "$yyy" in
20399	'')	uidsize=4
20400		echo "(I can't execute the test program--guessing $uidsize.)" >&4
20401		;;
20402	*)	uidsize=$yyy
20403		echo "Your $zzz is $uidsize bytes long."
20404		;;
20405	esac
20406else
20407	uidsize=4
20408	echo "(I can't compile the test program--guessing $uidsize.)" >&4
20409fi
20410
20411echo " "
20412case "$uidtype" in
20413*_t) zzz="$uidtype"	;;
20414*)   zzz="uid"		;;
20415esac
20416echo "Checking the sign of $zzz..." >&4
20417cat > try.c <<EOCP
20418#include <sys/types.h>
20419#include <stdio.h>
20420int main() {
20421	$uidtype foo = -1;
20422	if (foo < 0)
20423		printf("-1\n");
20424	else
20425		printf("1\n");
20426}
20427EOCP
20428set try
20429if eval $compile; then
20430	yyy=`$run ./try`
20431	case "$yyy" in
20432	'')	uidsign=1
20433		echo "(I can't execute the test program--guessing unsigned.)" >&4
20434		;;
20435	*)	uidsign=$yyy
20436		case "$uidsign" in
20437		 1) echo "Your $zzz is unsigned." ;;
20438		-1) echo "Your $zzz is signed."   ;;
20439		esac
20440		;;
20441	esac
20442else
20443	uidsign=1
20444	echo "(I can't compile the test program--guessing unsigned.)" >&4
20445fi
20446
20447
20448
20449echo " "
20450$echo "Checking the format string to be used for uids..." >&4
20451
20452case "$uidsign" in
20453-1)	if $test X"$uidsize" = X"$ivsize"; then
20454		uidformat="$ivdformat"
20455	else
20456		if $test X"$uidsize" = X"$longsize"; then
20457			uidformat='"ld"'
20458		else
20459			if $test X"$uidsize" = X"$intsize"; then
20460				uidformat='"d"'
20461			else
20462				if $test X"$uidsize" = X"$shortsize"; then
20463					uidformat='"hd"'
20464				fi
20465			fi
20466		fi
20467	fi
20468	;;
20469*)	if $test X"$uidsize" = X"$uvsize"; then
20470		uidformat="$uvuformat"
20471	else
20472		if $test X"$uidsize" = X"$longsize"; then
20473			uidformat='"lu"'
20474		else
20475			if $test X"$uidsize" = X"$intsize"; then
20476				uidformat='"u"'
20477			else
20478				if $test X"$uidsize" = X"$shortsize"; then
20479					uidformat='"hu"'
20480				fi
20481			fi
20482		fi
20483	fi
20484	;;
20485esac
20486
20487
20488case "$usesitecustomize" in
20489    $define|true|[Yy]*)
20490	usesitecustomize="$define"
20491	;;
20492    *)
20493	usesitecustomize="$undef"
20494	;;
20495    esac
20496
20497: determine compiler compiler
20498case "$yacc" in
20499'')
20500	dflt=yacc;;
20501*)
20502	dflt="$yacc";;
20503esac
20504echo " "
20505comp='yacc'
20506if $test -f "$byacc$_exe"; then
20507	dflt="$byacc"
20508	comp="byacc or $comp"
20509fi
20510if $test -f "$bison$_exe"; then
20511	comp="$comp or bison -y"
20512fi
20513rp="Which compiler compiler ($comp) shall I use?"
20514. ./myread
20515yacc="$ans"
20516case "$yacc" in
20517*bis*)
20518	case "$yacc" in
20519	*-y*) ;;
20520	*)
20521		yacc="$yacc -y"
20522		echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20523		;;
20524	esac
20525	;;
20526esac
20527
20528: see if this is a fp.h system
20529set fp.h i_fp
20530eval $inhdr
20531
20532: see if this is a fp_class.h system
20533set fp_class.h i_fp_class
20534eval $inhdr
20535
20536: see if gdbm.h is available
20537set gdbm.h t_gdbm
20538eval $inhdr
20539case "$t_gdbm" in
20540$define)
20541	: see if gdbm_open exists
20542	set gdbm_open d_gdbm_open
20543	eval $inlibc
20544	case "$d_gdbm_open" in
20545	$undef)
20546		t_gdbm="$undef"
20547		echo "We won't be including <gdbm.h>"
20548		;;
20549	esac
20550	;;
20551esac
20552val="$t_gdbm"
20553set i_gdbm
20554eval $setvar
20555
20556: see if this is a ieeefp.h system
20557case "$i_ieeefp" in
20558'' ) set ieeefp.h i_ieeefp
20559     eval $inhdr
20560     ;;
20561esac
20562
20563: see if this is a libutil.h system
20564set libutil.h i_libutil
20565eval $inhdr
20566
20567: see if mach cthreads are available
20568if test "X$usethreads" = "X$define"; then
20569	set mach/cthreads.h i_machcthr
20570	eval $inhdr
20571else
20572	i_machcthr="$undef"
20573fi
20574
20575
20576
20577: see if this is a mntent.h system
20578set mntent.h i_mntent
20579eval $inhdr
20580
20581: see if ndbm.h is available
20582set ndbm.h t_ndbm
20583eval $inhdr
20584
20585case "$t_ndbm" in
20586$undef)
20587    # Some Linux distributions such as RedHat 7.1 put the
20588    # ndbm.h header in /usr/include/gdbm/ndbm.h.
20589    if $test -f /usr/include/gdbm/ndbm.h; then
20590	echo '<gdbm/ndbm.h> found.'
20591        ccflags="$ccflags -I/usr/include/gdbm"
20592        cppflags="$cppflags -I/usr/include/gdbm"
20593        t_ndbm=$define
20594    fi
20595    ;;
20596esac
20597
20598case "$t_ndbm" in
20599$define)
20600	: see if dbm_open exists
20601	set dbm_open d_dbm_open
20602	eval $inlibc
20603	case "$d_dbm_open" in
20604	$undef)
20605		t_ndbm="$undef"
20606		echo "We won't be including <ndbm.h>"
20607		;;
20608	esac
20609	;;
20610esac
20611val="$t_ndbm"
20612set i_ndbm
20613eval $setvar
20614
20615: see if net/errno.h is available
20616val=''
20617set net/errno.h val
20618eval $inhdr
20619
20620: Unfortunately, it causes problems on some systems.  Arrgh.
20621case "$val" in
20622$define)
20623	cat > try.c <<'EOM'
20624#include <stdio.h>
20625#include <errno.h>
20626#include <net/errno.h>
20627int func()
20628{
20629	return ENOTSOCK;
20630}
20631EOM
20632	if $cc $ccflags -c try.c >/dev/null 2>&1; then
20633		echo "We'll be including <net/errno.h>." >&4
20634	else
20635		echo "We won't be including <net/errno.h>." >&4
20636		val="$undef"
20637	fi
20638	$rm_try
20639	;;
20640esac
20641set i_neterrno
20642eval $setvar
20643
20644: see if netinet/tcp.h is available
20645set netinet/tcp.h i_netinettcp
20646eval $inhdr
20647
20648: see if this is a poll.h system
20649set poll.h i_poll
20650eval $inhdr
20651
20652: see if this is a prot.h system
20653set prot.h i_prot
20654eval $inhdr
20655
20656echo " "
20657$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20658$cat <<'EOSH' > Cppsym.know
20659a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20660AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20661alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20662ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20663BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20664BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20665bull c cadmus clipper CMU COFF COMPILER_VERSION
20666concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20667CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20668Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20669FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20670GLIBC GLIBC_MINOR
20671GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20672H3050R H3050RX hbullx20 hcx host_mips
20673hp200 hp300 hp700 HP700 hp800 hp9000
20674hp9000s200 hp9000s300 hp9000s400 hp9000s500
20675hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20676i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20677IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20678INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20679LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20680LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20681LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20682LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20683M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20684M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20685M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20686MATH_HAS_NO_SIDE_EFFECTS
20687mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20688mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20689mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20690MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20691mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20692NetBSD news1500 news1700 news1800 news1900 news3700
20693news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20694ns32016 ns32332 ns32k nsc32000
20695OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20696pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20697pc532 pdp11 PGC PIC plexus PORTAR posix
20698POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20699POSIX_C_SOURCE POSIX_SOURCE POWER
20700PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20701riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20702SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20703sony sony_news sonyrisc sparc sparclite spectrum
20704stardent stdc STDC_EXT stratos sun sun3 sun386
20705Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20706SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20707SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20708sysV68 sysV88 Tek4132 Tek4300 titan
20709TM3200 TM5400 TM5600
20710tower tower32 tower32_200 tower32_600 tower32_700
20711tower32_800 tower32_850 tss
20712u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20713ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20714unix UNIX95 UNIX99 unixpc unos
20715USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20716USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20717USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20718USGr4 USGr4_2
20719Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20720XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20721XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20722z8000
20723EOSH
20724# Maybe put other stuff here too.
20725cat <<EOSH >>Cppsym.know
20726$osname
20727EOSH
20728./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20729./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20730$cat Cppsym.know > Cppsym.c
20731$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20732$rm -f Cppsym.a Cppsym.b Cppsym.c
20733cat <<EOSH > Cppsym
20734$startsh
20735if $test \$# -gt 0; then
20736    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20737    if $test -s Cppsym.got; then
20738        $rm -f Cppsym.got
20739        exit 0
20740    fi
20741    $rm -f Cppsym.got
20742    exit 1
20743else
20744    $tr " " "$trnl" | ./Cppsym.try
20745    exit 0
20746fi
20747EOSH
20748chmod +x Cppsym
20749$eunicefix Cppsym
20750cat <<EOSH > Cppsym.try
20751$startsh
20752cat <<'EOCP' > try.c
20753#include <stdio.h>
20754#if cpp_stuff == 1
20755#define STRINGIFY(a)    "a"
20756#endif
20757#if cpp_stuff == 42
20758#define StGiFy(a)  #a
20759#define STRINGIFY(a)    StGiFy(a)
20760#endif
20761#if $cpp_stuff != 1 && $cpp_stuff != 42
20762#   include "Bletch: How does this C preprocessor stringify macros?"
20763#endif
20764int main() {
20765EOCP
20766$awk \\
20767EOSH
20768cat <<'EOSH' >> Cppsym.try
20769'length($1) > 0 {
20770    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20771    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20772    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20773    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20774}'	 >> try.c
20775echo 'return 0;}' >> try.c
20776EOSH
20777cat <<EOSH >> Cppsym.try
20778ccflags="$ccflags"
20779case "$osname-$gccversion" in
20780irix-) ccflags="\$ccflags -woff 1178" ;;
20781os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20782esac
20783$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20784EOSH
20785chmod +x Cppsym.try
20786$eunicefix Cppsym.try
20787./Cppsym < Cppsym.know > Cppsym.true
20788: Add in any linux cpp "predefined macros":
20789case "$osname::$gccversion" in
20790  *linux*::*.*)
20791    tHdrH=_tmpHdr
20792    rm -f $tHdrH'.h' $tHdrH
20793    touch $tHdrH'.h'
20794    if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20795       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20796       if [ -s $tHdrH'_cppsym.real' ]; then
20797	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20798       fi
20799    fi
20800    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20801  ;;
20802esac
20803: now check the C compiler for additional symbols
20804postprocess_cc_v=''
20805case "$osname" in
20806aix) postprocess_cc_v="|$tr , ' '" ;;
20807esac
20808$cat >ccsym <<EOS
20809$startsh
20810$cat >tmp.c <<EOF
20811extern int foo;
20812EOF
20813for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20814do
20815	case "\$i" in
20816	-D*) echo "\$i" | $sed 's/^-D//';;
20817	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20818	esac
20819done
20820$rm_try
20821EOS
20822postprocess_cc_v=''
20823chmod +x ccsym
20824$eunicefix ccsym
20825./ccsym > ccsym1.raw
20826if $test -s ccsym1.raw; then
20827       $sort ccsym1.raw | $uniq >ccsym.raw
20828else
20829       mv ccsym1.raw ccsym.raw
20830fi
20831
20832$awk '/\=/ { print $0; next }
20833	{ print $0"=1" }' ccsym.raw >ccsym.list
20834$comm -13 Cppsym.true ccsym.list >ccsym.own
20835$comm -12 Cppsym.true ccsym.list >ccsym.com
20836$comm -23 Cppsym.true ccsym.list >ccsym.cpp
20837also=''
20838if $test -z ccsym.raw; then
20839	echo "Your C compiler doesn't seem to define any symbols!" >&4
20840	echo " "
20841	echo "However, your C preprocessor defines the following symbols:"
20842	$cat Cppsym.true
20843    	ccsymbols=''
20844	cppsymbols=`$cat Cppsym.true`
20845        cppsymbols=`echo $cppsymbols`
20846	cppccsymbols="$cppsymbols"
20847else
20848	if $test -s ccsym.com; then
20849		echo "Your C compiler and pre-processor define these symbols:"
20850		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
20851		also='also '
20852		symbols='ones'
20853		cppccsymbols=`$cat ccsym.com`
20854		cppccsymbols=`echo $cppccsymbols`
20855		$test "$silent" || sleep 1
20856	fi
20857	if $test -s ccsym.cpp; then
20858		$test "$also" && echo " "
20859		echo "Your C pre-processor ${also}defines the following symbols:"
20860		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20861		also='further '
20862		cppsymbols=`$cat ccsym.cpp`
20863		cppsymbols=`echo $cppsymbols`
20864		$test "$silent" || sleep 1
20865	fi
20866	if $test -s ccsym.own; then
20867		$test "$also" && echo " "
20868		echo "Your C compiler ${also}defines the following cpp symbols:"
20869		$sed -e 's/\(..*\)=1/\1/' ccsym.own
20870		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20871	        ccsymbols=`$cat ccsym.own`
20872	        ccsymbols=`echo $ccsymbols`
20873		$test "$silent" || sleep 1
20874	fi
20875fi
20876
20877: see if this is a termio system
20878val="$undef"
20879val2="$undef"
20880val3="$undef"
20881if $test `./findhdr termios.h`; then
20882	set tcsetattr i_termios
20883	eval $inlibc
20884	val3="$i_termios"
20885fi
20886echo " "
20887case "$val3" in
20888"$define") echo "You have POSIX termios.h... good!" >&4;;
20889*) if ./Cppsym pyr; then
20890		case "`/bin/universe`" in
20891		ucb) if $test `./findhdr sgtty.h`; then
20892				val2="$define"
20893				echo "<sgtty.h> found." >&4
20894			else
20895				echo "System is pyramid with BSD universe."
20896				echo "<sgtty.h> not found--you could have problems." >&4
20897			fi;;
20898		*) if $test `./findhdr termio.h`; then
20899				val="$define"
20900				echo "<termio.h> found." >&4
20901			else
20902				echo "System is pyramid with USG universe."
20903				echo "<termio.h> not found--you could have problems." >&4
20904			fi;;
20905		esac
20906	elif ./usg; then
20907		if $test `./findhdr termio.h`; then
20908			echo "<termio.h> found." >&4
20909			val="$define"
20910		elif $test `./findhdr sgtty.h`; then
20911			echo "<sgtty.h> found." >&4
20912			val2="$define"
20913		else
20914echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20915		fi
20916	else
20917		if $test `./findhdr sgtty.h`; then
20918			echo "<sgtty.h> found." >&4
20919			val2="$define"
20920		elif $test `./findhdr termio.h`; then
20921			echo "<termio.h> found." >&4
20922			val="$define"
20923		else
20924echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20925		fi
20926	fi;;
20927esac
20928set i_termio; eval $setvar
20929val=$val2; set i_sgtty; eval $setvar
20930val=$val3; set i_termios; eval $setvar
20931
20932: see if stddef is available
20933set stddef.h i_stddef
20934eval $inhdr
20935
20936: see if sys/access.h is available
20937set sys/access.h i_sysaccess
20938eval $inhdr
20939
20940: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20941set sys/filio.h i_sysfilio
20942eval $inhdr
20943echo " "
20944if $test `./findhdr sys/ioctl.h`; then
20945	val="$define"
20946	echo '<sys/ioctl.h> found.' >&4
20947else
20948	val="$undef"
20949	if $test $i_sysfilio = "$define"; then
20950	    echo '<sys/ioctl.h> NOT found.' >&4
20951	else
20952		$test $i_sgtty = "$define" && xxx="sgtty.h"
20953		$test $i_termio = "$define" && xxx="termio.h"
20954		$test $i_termios = "$define" && xxx="termios.h"
20955echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20956	fi
20957fi
20958set i_sysioctl
20959eval $setvar
20960
20961: see if socket ioctl defs are in sys/sockio.h
20962echo " "
20963xxx=`./findhdr sys/sockio.h`
20964if $test "$xxx"; then
20965	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20966		val="$define"
20967		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20968	else
20969		val="$undef"
20970		echo "No socket ioctls found in <sys/sockio.h>." >&4
20971	fi
20972else
20973	val="$undef"
20974	$cat <<EOM
20975<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20976EOM
20977fi
20978set i_syssockio
20979eval $setvar
20980
20981
20982: see if this is a syslog.h system
20983set syslog.h i_syslog
20984eval $inhdr
20985
20986
20987: see if this is a sys/mode.h system
20988set sys/mode.h i_sysmode
20989eval $inhdr
20990
20991: see if sys/resource.h has to be included
20992set sys/resource.h i_sysresrc
20993eval $inhdr
20994
20995: see if sys/security.h is available
20996set sys/security.h i_syssecrt
20997eval $inhdr
20998
20999: see if this is a sys/statvfs.h system
21000set sys/statvfs.h i_sysstatvfs
21001eval $inhdr
21002
21003: see if this is a sys/un.h system
21004set sys/un.h i_sysun
21005eval $inhdr
21006
21007
21008: see if this is a sys/utsname.h system
21009set sys/utsname.h i_sysutsname
21010eval $inhdr
21011
21012: see if this is a syswait system
21013set sys/wait.h i_syswait
21014eval $inhdr
21015
21016: see if this is a ustat.h system
21017set ustat.h i_ustat
21018eval $inhdr
21019
21020: see if this is an utime system
21021set utime.h i_utime
21022eval $inhdr
21023
21024: see if this is a values.h system
21025set values.h i_values
21026eval $inhdr
21027
21028: see if this is a vfork system
21029case "$d_vfork" in
21030"$define")
21031	set vfork.h i_vfork
21032	eval $inhdr
21033	;;
21034*)
21035	i_vfork="$undef"
21036	;;
21037esac
21038
21039echo " "
21040echo "Looking for extensions..." >&4
21041: If we are using the old config.sh, known_extensions may contain
21042: old or inaccurate or duplicate values.
21043known_extensions=''
21044nonxs_extensions=''
21045: We do not use find because it might not be available.
21046: We do not just use MANIFEST because the user may have dropped
21047: some additional extensions into the source tree and expect them
21048: to be built.
21049
21050: Function to recursively find available extensions, ignoring DynaLoader
21051: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21052find_extensions='
21053    for xxx in *; do
21054	case "$xxx" in
21055	    DynaLoader|dynaload) ;;
21056	    *)
21057	    if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21058		known_extensions="$known_extensions $1$xxx";
21059	    elif $test -f $xxx/Makefile.PL; then
21060		nonxs_extensions="$nonxs_extensions $1$xxx";
21061	    else
21062		if $test -d $xxx -a $# -lt 10; then
21063		    set $1$xxx/ $*;
21064		    cd "$xxx";
21065		    eval $find_extensions;
21066		    cd ..;
21067		    shift;
21068		fi;
21069	    fi
21070	    ;;
21071	esac;
21072    done'
21073tdir=`pwd`
21074cd "$rsrc/ext"
21075set X
21076shift
21077eval $find_extensions
21078# Special case:  Add in modules that nest beyond the first level.
21079# Currently threads/shared and Hash/Util/FieldHash, since they are
21080# not picked up by the recursive find above (and adding in general
21081# recursive finding breaks SDBM_File/sdbm).
21082# A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21083known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21084set X $known_extensions
21085shift
21086known_extensions="$*"
21087set X $nonxs_extensions
21088shift
21089nonxs_extensions="$*"
21090cd "$tdir"
21091
21092: Now see which are supported on this system.
21093avail_ext=''
21094for xxx in $known_extensions ; do
21095	case "$xxx" in
21096	DB_File|db_file)
21097		case "$i_db" in
21098		$define) avail_ext="$avail_ext $xxx" ;;
21099		esac
21100		;;
21101	GDBM_File|gdbm_fil)
21102		case "$i_gdbm" in
21103		$define) avail_ext="$avail_ext $xxx" ;;
21104		esac
21105		;;
21106	I18N/Langinfo|i18n_lan)
21107		case "$i_langinfo$d_nl_langinfo" in
21108		$define$define) avail_ext="$avail_ext $xxx" ;;
21109		esac
21110		;;
21111	IPC/SysV|ipc/sysv)
21112		: XXX Do we need a useipcsysv variable here
21113		case "${d_msg}${d_sem}${d_shm}" in
21114		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
21115		esac
21116		;;
21117	NDBM_File|ndbm_fil)
21118		case "$i_ndbm" in
21119		$define)
21120		    case "$osname-$use64bitint" in
21121		    hpux-define)
21122			case "$libs" in
21123			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
21124			esac
21125			;;
21126		    *) avail_ext="$avail_ext $xxx" ;;
21127		    esac
21128		    ;;
21129		esac
21130		;;
21131	ODBM_File|odbm_fil)
21132		case "${i_dbm}${i_rpcsvcdbm}" in
21133		*"${define}"*)
21134		    case "$d_cplusplus" in
21135		    define) ;; # delete as a function name will not work
21136		    *)  case "$osname-$use64bitint" in
21137			hpux-define)
21138			    case "$libs" in
21139			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21140			    esac
21141			    ;;
21142			*) avail_ext="$avail_ext $xxx" ;;
21143			esac
21144			;;
21145		    esac
21146		    ;;
21147		esac
21148		;;
21149	Opcode|opcode)
21150		case "$useopcode" in
21151		true|define|y) avail_ext="$avail_ext $xxx" ;;
21152		esac
21153		;;
21154	POSIX|posix)
21155		case "$useposix" in
21156		true|define|y) avail_ext="$avail_ext $xxx" ;;
21157		esac
21158		;;
21159	Socket|socket)
21160		case "$d_socket" in
21161		true|$define|y)
21162		    case "$osname" in
21163		    beos) ;; # not unless BONE
21164		    *) avail_ext="$avail_ext $xxx" ;;
21165		    esac
21166		    ;;
21167		esac
21168		;;
21169	Sys/Syslog|sys/syslog)
21170		: XXX syslog requires socket
21171		case "$d_socket" in
21172		true|$define|y) avail_ext="$avail_ext $xxx" ;;
21173		esac
21174		;;
21175	Thread|thread)
21176                case "$usethreads" in
21177                true|$define|y)
21178                        case "$use5005threads" in
21179                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21180                        esac
21181		esac
21182		;;
21183	threads|threads/shared)
21184		# threads and threads::shared are special cases.
21185		# To stop people from asking "Perl 5.8.0 was supposed
21186		# to have this new fancy threads implementation but my
21187		# perl doesn't have it" and from people trying to
21188		# (re)install the threads module using CPAN.pm and
21189		# CPAN.pm then offering to reinstall Perl 5.8.0,
21190		# the threads.pm and threads/shared.pm will always be
21191		# there, croaking informatively ("you need to rebuild
21192		# all of Perl with threads, sorry") when threads haven't
21193		# been compiled in.
21194		# --jhi
21195		avail_ext="$avail_ext $xxx"
21196		;;
21197	Win32*)
21198		case "$osname" in
21199		cygwin) avail_ext="$avail_ext $xxx" ;;
21200		esac
21201		;;
21202	XS/APItest|xs/apitest)
21203		# This is just for testing.  Skip it unless we have dynamic loading.
21204
21205		case "$usedl" in
21206		$define) avail_ext="$avail_ext $xxx" ;;
21207		esac
21208		;;
21209	XS/Typemap|xs/typemap)
21210		# This is just for testing.  Skip it unless we have dynamic loading.
21211		case "$usedl" in
21212		$define) avail_ext="$avail_ext $xxx" ;;
21213		esac
21214		;;
21215	*)	avail_ext="$avail_ext $xxx"
21216		;;
21217	esac
21218done
21219
21220set X $avail_ext
21221shift
21222avail_ext="$*"
21223
21224case "$onlyextensions" in
21225'') ;;
21226*)  keepextensions=''
21227    echo "You have requested that only certains extensions be included..." >&4
21228    for i in $onlyextensions; do
21229        case " $avail_ext " in
21230        *" $i "*)
21231            echo "Keeping extension $i."
21232            keepextensions="$keepextensions $i"
21233            ;;
21234        *) echo "Ignoring extension $i." ;;
21235        esac
21236    done
21237    avail_ext="$keepextensions"
21238    ;;
21239esac
21240
21241case "$noextensions" in
21242'') ;;
21243*)  keepextensions=''
21244    echo "You have requested that certain extensions be ignored..." >&4
21245    for i in $avail_ext; do
21246        case " $noextensions " in
21247        *" $i "*) echo "Ignoring extension $i." ;;
21248        *) echo "Keeping extension $i.";
21249           keepextensions="$keepextensions $i"
21250           ;;
21251        esac
21252    done
21253    avail_ext="$keepextensions"
21254    ;;
21255esac
21256
21257: Now see which nonxs extensions are supported on this system.
21258: For now assume all are.
21259nonxs_ext=''
21260for xxx in $nonxs_extensions ; do
21261	case "$xxx" in
21262	*)	nonxs_ext="$nonxs_ext $xxx"
21263		;;
21264	esac
21265done
21266
21267set X $nonxs_ext
21268shift
21269nonxs_ext="$*"
21270
21271case $usedl in
21272$define)
21273	$cat <<EOM
21274A number of extensions are supplied with $package.  You may choose to
21275compile these extensions for dynamic loading (the default), compile
21276them into the $package executable (static loading), or not include
21277them at all.  Answer "none" to include no extensions.
21278Note that DynaLoader is always built and need not be mentioned here.
21279
21280EOM
21281	case "$dynamic_ext" in
21282	'')
21283		: Exclude those listed in static_ext
21284		dflt=''
21285		for xxx in $avail_ext; do
21286			case " $static_ext " in
21287			*" $xxx "*) ;;
21288			*) dflt="$dflt $xxx" ;;
21289			esac
21290		done
21291		set X $dflt
21292		shift
21293		dflt="$*"
21294		;;
21295	*)	dflt="$dynamic_ext"
21296		# Perhaps we are reusing an old out-of-date config.sh.
21297		case "$hint" in
21298		previous)
21299			if test X"$dynamic_ext" != X"$avail_ext"; then
21300				$cat <<EOM
21301NOTICE:  Your previous config.sh list may be incorrect.
21302The extensions now available to you are
21303	${avail_ext}
21304but the default list from your previous config.sh is
21305	${dynamic_ext}
21306
21307EOM
21308			fi
21309			;;
21310		esac
21311		;;
21312	esac
21313	case "$dflt" in
21314	'')	dflt=none;;
21315	esac
21316	rp="What extensions do you wish to load dynamically?"
21317	. ./myread
21318	case "$ans" in
21319	none) dynamic_ext=' ' ;;
21320	*) dynamic_ext="$ans" ;;
21321	esac
21322
21323	case "$static_ext" in
21324	'')
21325		: Exclude those already listed in dynamic linking
21326		dflt=''
21327		for xxx in $avail_ext; do
21328			case " $dynamic_ext " in
21329			*" $xxx "*) ;;
21330			*) dflt="$dflt $xxx" ;;
21331			esac
21332		done
21333		set X $dflt
21334		shift
21335		dflt="$*"
21336		;;
21337	*)  dflt="$static_ext"
21338		;;
21339	esac
21340
21341	case "$dflt" in
21342	'')	dflt=none;;
21343	esac
21344	rp="What extensions do you wish to load statically?"
21345	. ./myread
21346	case "$ans" in
21347	none) static_ext=' ' ;;
21348	*) static_ext="$ans" ;;
21349	esac
21350	;;
21351*)
21352	$cat <<EOM
21353A number of extensions are supplied with $package.  Answer "none"
21354to include no extensions.
21355Note that DynaLoader is always built and need not be mentioned here.
21356
21357EOM
21358	case "$static_ext" in
21359	'') dflt="$avail_ext" ;;
21360	*)	dflt="$static_ext"
21361		# Perhaps we are reusing an old out-of-date config.sh.
21362		case "$hint" in
21363		previous)
21364			if test X"$static_ext" != X"$avail_ext"; then
21365				$cat <<EOM
21366NOTICE:  Your previous config.sh list may be incorrect.
21367The extensions now available to you are
21368	${avail_ext}
21369but the default list from your previous config.sh is
21370	${static_ext}
21371
21372EOM
21373			fi
21374			;;
21375		esac
21376		;;
21377	esac
21378	: Exclude those that are not xs extensions
21379	case "$dflt" in
21380	'')	dflt=none;;
21381	esac
21382	rp="What extensions do you wish to include?"
21383	. ./myread
21384	case "$ans" in
21385	none) static_ext=' ' ;;
21386	*) static_ext="$ans" ;;
21387	esac
21388	;;
21389esac
21390#
21391# Encode is a special case.  If we are building Encode as a static
21392# extension, we need to explicitly list its subextensions as well.
21393# For other nested extensions, this is handled automatically by
21394# the appropriate Makefile.PL.
21395case " $static_ext " in
21396	*" Encode "*) # Add the subextensions of Encode
21397	cd "$rsrc/ext"
21398	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21399		static_ext="$static_ext Encode/$xxx"
21400	done
21401	cd "$tdir"
21402	;;
21403esac
21404
21405set X $dynamic_ext $static_ext $nonxs_ext
21406shift
21407extensions="$*"
21408
21409# Sanity check:  We require an extension suitable for use with
21410# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21411# should show up as failures in the test suite, but it's helpful to
21412# catch them now.) The 'extensions' list is normally sorted
21413# alphabetically, so we need to accept either
21414#    DB_File ... Fcntl ... IO  ....
21415# or something like
21416#    Fcntl ... NDBM_File ... IO  ....
21417case " $extensions"  in
21418*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21419*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21420*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21421*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21422   echo "WARNING: The Perl you are building will be quite crippled." >& 4
21423   ;;
21424esac
21425
21426: Remove libraries needed only for extensions
21427: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21428: The exception is SunOS 4.x, which needs them.
21429case "${osname}X${osvers}" in
21430sunos*X4*)
21431    perllibs="$libs"
21432    ;;
21433*) case "$usedl" in
21434    $define|true|[yY]*)
21435	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21436	    shift
21437	    perllibs="$*"
21438	    ;;
21439    *)	perllibs="$libs"
21440	    ;;
21441    esac
21442    ;;
21443esac
21444
21445: Remove build directory name from cppstdin so it can be used from
21446: either the present location or the final installed location.
21447echo " "
21448: Get out of the UU directory to get correct path name.
21449cd ..
21450case "$cppstdin" in
21451`pwd`/cppstdin)
21452	echo "Stripping down cppstdin path name"
21453	cppstdin=cppstdin
21454	;;
21455esac
21456cd UU
21457
21458: end of configuration questions
21459echo " "
21460echo "End of configuration questions."
21461echo " "
21462
21463: back to where it started
21464if test -d ../UU; then
21465	cd ..
21466fi
21467
21468: configuration may be patched via a 'config.arch' file
21469if $test -f config.arch; then
21470	echo "I see a config.arch file, loading it."
21471	. ./config.arch
21472fi
21473
21474: configuration may be patched via a 'config.over' file
21475if $test -f config.over; then
21476	echo " "
21477	dflt=y
21478	rp='I see a config.over file.  Do you wish to load it?'
21479	. UU/myread
21480	case "$ans" in
21481	n*) echo "OK, I'll ignore it.";;
21482	*)	. ./config.over
21483		echo "Configuration override changes have been loaded."
21484		;;
21485	esac
21486fi
21487
21488: in case they want portability, strip down executable paths
21489case "$d_portable" in
21490"$define")
21491	echo " "
21492	echo "Stripping down executable paths..." >&4
21493	for file in $loclist $trylist; do
21494		eval temp=\$$file
21495		eval $file=`basename $temp`
21496	done
21497	;;
21498esac
21499
21500: create config.sh file
21501echo " "
21502echo "Creating config.sh..." >&4
21503$spitshell <<EOT >config.sh
21504$startsh
21505#
21506# This file was produced by running the Configure script. It holds all the
21507# definitions figured out by Configure. Should you modify one of these values,
21508# do not forget to propagate your changes by running "Configure -der". You may
21509# instead choose to run each of the .SH files by yourself, or "Configure -S".
21510#
21511
21512# Package name      : $package
21513# Source directory  : $src
21514# Configuration time: $cf_time
21515# Configured by     : $cf_by
21516# Target system     : $myuname
21517
21518Author='$Author'
21519Date='$Date'
21520Header='$Header'
21521Id='$Id'
21522Locker='$Locker'
21523Log='$Log'
21524Mcc='$Mcc'
21525RCSfile='$RCSfile'
21526Revision='$Revision'
21527Source='$Source'
21528State='$State'
21529_a='$_a'
21530_exe='$_exe'
21531_o='$_o'
21532afs='$afs'
21533afsroot='$afsroot'
21534alignbytes='$alignbytes'
21535ansi2knr='$ansi2knr'
21536aphostname='$aphostname'
21537api_revision='$api_revision'
21538api_subversion='$api_subversion'
21539api_version='$api_version'
21540api_versionstring='$api_versionstring'
21541ar='$ar'
21542archlib='$archlib'
21543archlibexp='$archlibexp'
21544archname64='$archname64'
21545archname='$archname'
21546archobjs='$archobjs'
21547asctime_r_proto='$asctime_r_proto'
21548awk='$awk'
21549baserev='$baserev'
21550bash='$bash'
21551bin='$bin'
21552binexp='$binexp'
21553bison='$bison'
21554byacc='$byacc'
21555byteorder='$byteorder'
21556c='$c'
21557castflags='$castflags'
21558cat='$cat'
21559cc='$cc'
21560cccdlflags='$cccdlflags'
21561ccdlflags='$ccdlflags'
21562ccflags='$ccflags'
21563ccflags_uselargefiles='$ccflags_uselargefiles'
21564ccname='$ccname'
21565ccsymbols='$ccsymbols'
21566ccversion='$ccversion'
21567cf_by='$cf_by'
21568cf_email='$cf_email'
21569cf_time='$cf_time'
21570chgrp='$chgrp'
21571chmod='$chmod'
21572chown='$chown'
21573clocktype='$clocktype'
21574comm='$comm'
21575compress='$compress'
21576contains='$contains'
21577cp='$cp'
21578cpio='$cpio'
21579cpp='$cpp'
21580cpp_stuff='$cpp_stuff'
21581cppccsymbols='$cppccsymbols'
21582cppflags='$cppflags'
21583cpplast='$cpplast'
21584cppminus='$cppminus'
21585cpprun='$cpprun'
21586cppstdin='$cppstdin'
21587cppsymbols='$cppsymbols'
21588crypt_r_proto='$crypt_r_proto'
21589cryptlib='$cryptlib'
21590csh='$csh'
21591ctermid_r_proto='$ctermid_r_proto'
21592ctime_r_proto='$ctime_r_proto'
21593d_Gconvert='$d_Gconvert'
21594d_PRIEUldbl='$d_PRIEUldbl'
21595d_PRIFUldbl='$d_PRIFUldbl'
21596d_PRIGUldbl='$d_PRIGUldbl'
21597d_PRIXU64='$d_PRIXU64'
21598d_PRId64='$d_PRId64'
21599d_PRIeldbl='$d_PRIeldbl'
21600d_PRIfldbl='$d_PRIfldbl'
21601d_PRIgldbl='$d_PRIgldbl'
21602d_PRIi64='$d_PRIi64'
21603d_PRIo64='$d_PRIo64'
21604d_PRIu64='$d_PRIu64'
21605d_PRIx64='$d_PRIx64'
21606d_SCNfldbl='$d_SCNfldbl'
21607d__fwalk='$d__fwalk'
21608d_access='$d_access'
21609d_accessx='$d_accessx'
21610d_aintl='$d_aintl'
21611d_alarm='$d_alarm'
21612d_archlib='$d_archlib'
21613d_asctime_r='$d_asctime_r'
21614d_atolf='$d_atolf'
21615d_atoll='$d_atoll'
21616d_attribute_format='$d_attribute_format'
21617d_attribute_malloc='$d_attribute_malloc'
21618d_attribute_nonnull='$d_attribute_nonnull'
21619d_attribute_noreturn='$d_attribute_noreturn'
21620d_attribute_pure='$d_attribute_pure'
21621d_attribute_unused='$d_attribute_unused'
21622d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21623d_bcmp='$d_bcmp'
21624d_bcopy='$d_bcopy'
21625d_bsd='$d_bsd'
21626d_bsdgetpgrp='$d_bsdgetpgrp'
21627d_bsdsetpgrp='$d_bsdsetpgrp'
21628d_builtin_choose_expr='$d_builtin_choose_expr'
21629d_builtin_expect='$d_builtin_expect'
21630d_bzero='$d_bzero'
21631d_c99_variadic_macros='$d_c99_variadic_macros'
21632d_casti32='$d_casti32'
21633d_castneg='$d_castneg'
21634d_charvspr='$d_charvspr'
21635d_chown='$d_chown'
21636d_chroot='$d_chroot'
21637d_chsize='$d_chsize'
21638d_class='$d_class'
21639d_clearenv='$d_clearenv'
21640d_closedir='$d_closedir'
21641d_cmsghdr_s='$d_cmsghdr_s'
21642d_const='$d_const'
21643d_copysignl='$d_copysignl'
21644d_cplusplus='$d_cplusplus'
21645d_crypt='$d_crypt'
21646d_crypt_r='$d_crypt_r'
21647d_csh='$d_csh'
21648d_ctermid='$d_ctermid'
21649d_ctermid_r='$d_ctermid_r'
21650d_ctime_r='$d_ctime_r'
21651d_cuserid='$d_cuserid'
21652d_dbl_dig='$d_dbl_dig'
21653d_dbminitproto='$d_dbminitproto'
21654d_difftime='$d_difftime'
21655d_dir_dd_fd='$d_dir_dd_fd'
21656d_dirfd='$d_dirfd'
21657d_dirnamlen='$d_dirnamlen'
21658d_dlerror='$d_dlerror'
21659d_dlopen='$d_dlopen'
21660d_dlsymun='$d_dlsymun'
21661d_dosuid='$d_dosuid'
21662d_drand48_r='$d_drand48_r'
21663d_drand48proto='$d_drand48proto'
21664d_dup2='$d_dup2'
21665d_eaccess='$d_eaccess'
21666d_endgrent='$d_endgrent'
21667d_endgrent_r='$d_endgrent_r'
21668d_endhent='$d_endhent'
21669d_endhostent_r='$d_endhostent_r'
21670d_endnent='$d_endnent'
21671d_endnetent_r='$d_endnetent_r'
21672d_endpent='$d_endpent'
21673d_endprotoent_r='$d_endprotoent_r'
21674d_endpwent='$d_endpwent'
21675d_endpwent_r='$d_endpwent_r'
21676d_endsent='$d_endsent'
21677d_endservent_r='$d_endservent_r'
21678d_eofnblk='$d_eofnblk'
21679d_eunice='$d_eunice'
21680d_faststdio='$d_faststdio'
21681d_fchdir='$d_fchdir'
21682d_fchmod='$d_fchmod'
21683d_fchown='$d_fchown'
21684d_fcntl='$d_fcntl'
21685d_fcntl_can_lock='$d_fcntl_can_lock'
21686d_fd_macros='$d_fd_macros'
21687d_fd_set='$d_fd_set'
21688d_fds_bits='$d_fds_bits'
21689d_fgetpos='$d_fgetpos'
21690d_finite='$d_finite'
21691d_finitel='$d_finitel'
21692d_flexfnam='$d_flexfnam'
21693d_flock='$d_flock'
21694d_flockproto='$d_flockproto'
21695d_fork='$d_fork'
21696d_fp_class='$d_fp_class'
21697d_fpathconf='$d_fpathconf'
21698d_fpclass='$d_fpclass'
21699d_fpclassify='$d_fpclassify'
21700d_fpclassl='$d_fpclassl'
21701d_fpos64_t='$d_fpos64_t'
21702d_frexpl='$d_frexpl'
21703d_fs_data_s='$d_fs_data_s'
21704d_fseeko='$d_fseeko'
21705d_fsetpos='$d_fsetpos'
21706d_fstatfs='$d_fstatfs'
21707d_fstatvfs='$d_fstatvfs'
21708d_fsync='$d_fsync'
21709d_ftello='$d_ftello'
21710d_ftime='$d_ftime'
21711d_futimes='$d_futimes'
21712d_getcwd='$d_getcwd'
21713d_getespwnam='$d_getespwnam'
21714d_getfsstat='$d_getfsstat'
21715d_getgrent='$d_getgrent'
21716d_getgrent_r='$d_getgrent_r'
21717d_getgrgid_r='$d_getgrgid_r'
21718d_getgrnam_r='$d_getgrnam_r'
21719d_getgrps='$d_getgrps'
21720d_gethbyaddr='$d_gethbyaddr'
21721d_gethbyname='$d_gethbyname'
21722d_gethent='$d_gethent'
21723d_gethname='$d_gethname'
21724d_gethostbyaddr_r='$d_gethostbyaddr_r'
21725d_gethostbyname_r='$d_gethostbyname_r'
21726d_gethostent_r='$d_gethostent_r'
21727d_gethostprotos='$d_gethostprotos'
21728d_getitimer='$d_getitimer'
21729d_getlogin='$d_getlogin'
21730d_getlogin_r='$d_getlogin_r'
21731d_getmnt='$d_getmnt'
21732d_getmntent='$d_getmntent'
21733d_getnbyaddr='$d_getnbyaddr'
21734d_getnbyname='$d_getnbyname'
21735d_getnent='$d_getnent'
21736d_getnetbyaddr_r='$d_getnetbyaddr_r'
21737d_getnetbyname_r='$d_getnetbyname_r'
21738d_getnetent_r='$d_getnetent_r'
21739d_getnetprotos='$d_getnetprotos'
21740d_getpagsz='$d_getpagsz'
21741d_getpbyname='$d_getpbyname'
21742d_getpbynumber='$d_getpbynumber'
21743d_getpent='$d_getpent'
21744d_getpgid='$d_getpgid'
21745d_getpgrp2='$d_getpgrp2'
21746d_getpgrp='$d_getpgrp'
21747d_getppid='$d_getppid'
21748d_getprior='$d_getprior'
21749d_getprotobyname_r='$d_getprotobyname_r'
21750d_getprotobynumber_r='$d_getprotobynumber_r'
21751d_getprotoent_r='$d_getprotoent_r'
21752d_getprotoprotos='$d_getprotoprotos'
21753d_getprpwnam='$d_getprpwnam'
21754d_getpwent='$d_getpwent'
21755d_getpwent_r='$d_getpwent_r'
21756d_getpwnam_r='$d_getpwnam_r'
21757d_getpwuid_r='$d_getpwuid_r'
21758d_getsbyname='$d_getsbyname'
21759d_getsbyport='$d_getsbyport'
21760d_getsent='$d_getsent'
21761d_getservbyname_r='$d_getservbyname_r'
21762d_getservbyport_r='$d_getservbyport_r'
21763d_getservent_r='$d_getservent_r'
21764d_getservprotos='$d_getservprotos'
21765d_getspnam='$d_getspnam'
21766d_getspnam_r='$d_getspnam_r'
21767d_gettimeod='$d_gettimeod'
21768d_gmtime_r='$d_gmtime_r'
21769d_gnulibc='$d_gnulibc'
21770d_grpasswd='$d_grpasswd'
21771d_hasmntopt='$d_hasmntopt'
21772d_htonl='$d_htonl'
21773d_ilogbl='$d_ilogbl'
21774d_inc_version_list='$d_inc_version_list'
21775d_index='$d_index'
21776d_inetaton='$d_inetaton'
21777d_int64_t='$d_int64_t'
21778d_isascii='$d_isascii'
21779d_isfinite='$d_isfinite'
21780d_isinf='$d_isinf'
21781d_isnan='$d_isnan'
21782d_isnanl='$d_isnanl'
21783d_killpg='$d_killpg'
21784d_lchown='$d_lchown'
21785d_ldbl_dig='$d_ldbl_dig'
21786d_libm_lib_version='$d_libm_lib_version'
21787d_link='$d_link'
21788d_localtime_r='$d_localtime_r'
21789d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21790d_locconv='$d_locconv'
21791d_lockf='$d_lockf'
21792d_longdbl='$d_longdbl'
21793d_longlong='$d_longlong'
21794d_lseekproto='$d_lseekproto'
21795d_lstat='$d_lstat'
21796d_madvise='$d_madvise'
21797d_malloc_good_size='$d_malloc_good_size'
21798d_malloc_size='$d_malloc_size'
21799d_mblen='$d_mblen'
21800d_mbstowcs='$d_mbstowcs'
21801d_mbtowc='$d_mbtowc'
21802d_memchr='$d_memchr'
21803d_memcmp='$d_memcmp'
21804d_memcpy='$d_memcpy'
21805d_memmove='$d_memmove'
21806d_memset='$d_memset'
21807d_mkdir='$d_mkdir'
21808d_mkdtemp='$d_mkdtemp'
21809d_mkfifo='$d_mkfifo'
21810d_mkstemp='$d_mkstemp'
21811d_mkstemps='$d_mkstemps'
21812d_mktime='$d_mktime'
21813d_mmap='$d_mmap'
21814d_modfl='$d_modfl'
21815d_modfl_pow32_bug='$d_modfl_pow32_bug'
21816d_modflproto='$d_modflproto'
21817d_mprotect='$d_mprotect'
21818d_msg='$d_msg'
21819d_msg_ctrunc='$d_msg_ctrunc'
21820d_msg_dontroute='$d_msg_dontroute'
21821d_msg_oob='$d_msg_oob'
21822d_msg_peek='$d_msg_peek'
21823d_msg_proxy='$d_msg_proxy'
21824d_msgctl='$d_msgctl'
21825d_msgget='$d_msgget'
21826d_msghdr_s='$d_msghdr_s'
21827d_msgrcv='$d_msgrcv'
21828d_msgsnd='$d_msgsnd'
21829d_msync='$d_msync'
21830d_munmap='$d_munmap'
21831d_mymalloc='$d_mymalloc'
21832d_nice='$d_nice'
21833d_nl_langinfo='$d_nl_langinfo'
21834d_nv_preserves_uv='$d_nv_preserves_uv'
21835d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21836d_off64_t='$d_off64_t'
21837d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21838d_oldpthreads='$d_oldpthreads'
21839d_oldsock='$d_oldsock'
21840d_open3='$d_open3'
21841d_pathconf='$d_pathconf'
21842d_pause='$d_pause'
21843d_perl_otherlibdirs='$d_perl_otherlibdirs'
21844d_phostname='$d_phostname'
21845d_pipe='$d_pipe'
21846d_poll='$d_poll'
21847d_portable='$d_portable'
21848d_printf_format_null='$d_printf_format_null'
21849d_procselfexe='$d_procselfexe'
21850d_pseudofork='$d_pseudofork'
21851d_pthread_atfork='$d_pthread_atfork'
21852d_pthread_attr_setscope='$d_pthread_attr_setscope'
21853d_pthread_yield='$d_pthread_yield'
21854d_pwage='$d_pwage'
21855d_pwchange='$d_pwchange'
21856d_pwclass='$d_pwclass'
21857d_pwcomment='$d_pwcomment'
21858d_pwexpire='$d_pwexpire'
21859d_pwgecos='$d_pwgecos'
21860d_pwpasswd='$d_pwpasswd'
21861d_pwquota='$d_pwquota'
21862d_qgcvt='$d_qgcvt'
21863d_quad='$d_quad'
21864d_random_r='$d_random_r'
21865d_readdir64_r='$d_readdir64_r'
21866d_readdir='$d_readdir'
21867d_readdir_r='$d_readdir_r'
21868d_readlink='$d_readlink'
21869d_readv='$d_readv'
21870d_recvmsg='$d_recvmsg'
21871d_rename='$d_rename'
21872d_rewinddir='$d_rewinddir'
21873d_rmdir='$d_rmdir'
21874d_safebcpy='$d_safebcpy'
21875d_safemcpy='$d_safemcpy'
21876d_sanemcmp='$d_sanemcmp'
21877d_sbrkproto='$d_sbrkproto'
21878d_scalbnl='$d_scalbnl'
21879d_sched_yield='$d_sched_yield'
21880d_scm_rights='$d_scm_rights'
21881d_seekdir='$d_seekdir'
21882d_select='$d_select'
21883d_sem='$d_sem'
21884d_semctl='$d_semctl'
21885d_semctl_semid_ds='$d_semctl_semid_ds'
21886d_semctl_semun='$d_semctl_semun'
21887d_semget='$d_semget'
21888d_semop='$d_semop'
21889d_sendmsg='$d_sendmsg'
21890d_setegid='$d_setegid'
21891d_seteuid='$d_seteuid'
21892d_setgrent='$d_setgrent'
21893d_setgrent_r='$d_setgrent_r'
21894d_setgrps='$d_setgrps'
21895d_sethent='$d_sethent'
21896d_sethostent_r='$d_sethostent_r'
21897d_setitimer='$d_setitimer'
21898d_setlinebuf='$d_setlinebuf'
21899d_setlocale='$d_setlocale'
21900d_setlocale_r='$d_setlocale_r'
21901d_setnent='$d_setnent'
21902d_setnetent_r='$d_setnetent_r'
21903d_setpent='$d_setpent'
21904d_setpgid='$d_setpgid'
21905d_setpgrp2='$d_setpgrp2'
21906d_setpgrp='$d_setpgrp'
21907d_setprior='$d_setprior'
21908d_setproctitle='$d_setproctitle'
21909d_setprotoent_r='$d_setprotoent_r'
21910d_setpwent='$d_setpwent'
21911d_setpwent_r='$d_setpwent_r'
21912d_setregid='$d_setregid'
21913d_setresgid='$d_setresgid'
21914d_setresuid='$d_setresuid'
21915d_setreuid='$d_setreuid'
21916d_setrgid='$d_setrgid'
21917d_setruid='$d_setruid'
21918d_setsent='$d_setsent'
21919d_setservent_r='$d_setservent_r'
21920d_setsid='$d_setsid'
21921d_setvbuf='$d_setvbuf'
21922d_sfio='$d_sfio'
21923d_shm='$d_shm'
21924d_shmat='$d_shmat'
21925d_shmatprototype='$d_shmatprototype'
21926d_shmctl='$d_shmctl'
21927d_shmdt='$d_shmdt'
21928d_shmget='$d_shmget'
21929d_sigaction='$d_sigaction'
21930d_signbit='$d_signbit'
21931d_sigprocmask='$d_sigprocmask'
21932d_sigsetjmp='$d_sigsetjmp'
21933d_sitearch='$d_sitearch'
21934d_snprintf='$d_snprintf'
21935d_sockatmark='$d_sockatmark'
21936d_sockatmarkproto='$d_sockatmarkproto'
21937d_socket='$d_socket'
21938d_socklen_t='$d_socklen_t'
21939d_sockpair='$d_sockpair'
21940d_socks5_init='$d_socks5_init'
21941d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21942d_sqrtl='$d_sqrtl'
21943d_srand48_r='$d_srand48_r'
21944d_srandom_r='$d_srandom_r'
21945d_sresgproto='$d_sresgproto'
21946d_sresuproto='$d_sresuproto'
21947d_statblks='$d_statblks'
21948d_statfs_f_flags='$d_statfs_f_flags'
21949d_statfs_s='$d_statfs_s'
21950d_statvfs='$d_statvfs'
21951d_stdio_cnt_lval='$d_stdio_cnt_lval'
21952d_stdio_ptr_lval='$d_stdio_ptr_lval'
21953d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21954d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21955d_stdio_stream_array='$d_stdio_stream_array'
21956d_stdiobase='$d_stdiobase'
21957d_stdstdio='$d_stdstdio'
21958d_strchr='$d_strchr'
21959d_strcoll='$d_strcoll'
21960d_strctcpy='$d_strctcpy'
21961d_strerrm='$d_strerrm'
21962d_strerror='$d_strerror'
21963d_strerror_r='$d_strerror_r'
21964d_strftime='$d_strftime'
21965d_strlcat='$d_strlcat'
21966d_strlcpy='$d_strlcpy'
21967d_strtod='$d_strtod'
21968d_strtol='$d_strtol'
21969d_strtold='$d_strtold'
21970d_strtoll='$d_strtoll'
21971d_strtoq='$d_strtoq'
21972d_strtoul='$d_strtoul'
21973d_strtoull='$d_strtoull'
21974d_strtouq='$d_strtouq'
21975d_strxfrm='$d_strxfrm'
21976d_suidsafe='$d_suidsafe'
21977d_symlink='$d_symlink'
21978d_syscall='$d_syscall'
21979d_syscallproto='$d_syscallproto'
21980d_sysconf='$d_sysconf'
21981d_sysernlst='$d_sysernlst'
21982d_syserrlst='$d_syserrlst'
21983d_system='$d_system'
21984d_tcgetpgrp='$d_tcgetpgrp'
21985d_tcsetpgrp='$d_tcsetpgrp'
21986d_telldir='$d_telldir'
21987d_telldirproto='$d_telldirproto'
21988d_time='$d_time'
21989d_times='$d_times'
21990d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21991d_tm_tm_zone='$d_tm_tm_zone'
21992d_tmpnam_r='$d_tmpnam_r'
21993d_truncate='$d_truncate'
21994d_ttyname_r='$d_ttyname_r'
21995d_tzname='$d_tzname'
21996d_u32align='$d_u32align'
21997d_ualarm='$d_ualarm'
21998d_umask='$d_umask'
21999d_uname='$d_uname'
22000d_union_semun='$d_union_semun'
22001d_unordered='$d_unordered'
22002d_unsetenv='$d_unsetenv'
22003d_usleep='$d_usleep'
22004d_usleepproto='$d_usleepproto'
22005d_ustat='$d_ustat'
22006d_vendorarch='$d_vendorarch'
22007d_vendorbin='$d_vendorbin'
22008d_vendorlib='$d_vendorlib'
22009d_vendorscript='$d_vendorscript'
22010d_vfork='$d_vfork'
22011d_void_closedir='$d_void_closedir'
22012d_voidsig='$d_voidsig'
22013d_voidtty='$d_voidtty'
22014d_volatile='$d_volatile'
22015d_vprintf='$d_vprintf'
22016d_vsnprintf='$d_vsnprintf'
22017d_wait4='$d_wait4'
22018d_waitpid='$d_waitpid'
22019d_wcstombs='$d_wcstombs'
22020d_wctomb='$d_wctomb'
22021d_writev='$d_writev'
22022d_xenix='$d_xenix'
22023date='$date'
22024db_hashtype='$db_hashtype'
22025db_prefixtype='$db_prefixtype'
22026db_version_major='$db_version_major'
22027db_version_minor='$db_version_minor'
22028db_version_patch='$db_version_patch'
22029defvoidused='$defvoidused'
22030direntrytype='$direntrytype'
22031dlext='$dlext'
22032dlsrc='$dlsrc'
22033doublesize='$doublesize'
22034drand01='$drand01'
22035drand48_r_proto='$drand48_r_proto'
22036dynamic_ext='$dynamic_ext'
22037eagain='$eagain'
22038ebcdic='$ebcdic'
22039echo='$echo'
22040egrep='$egrep'
22041emacs='$emacs'
22042endgrent_r_proto='$endgrent_r_proto'
22043endhostent_r_proto='$endhostent_r_proto'
22044endnetent_r_proto='$endnetent_r_proto'
22045endprotoent_r_proto='$endprotoent_r_proto'
22046endpwent_r_proto='$endpwent_r_proto'
22047endservent_r_proto='$endservent_r_proto'
22048eunicefix='$eunicefix'
22049exe_ext='$exe_ext'
22050expr='$expr'
22051extensions='$extensions'
22052extras='$extras'
22053fflushNULL='$fflushNULL'
22054fflushall='$fflushall'
22055find='$find'
22056firstmakefile='$firstmakefile'
22057flex='$flex'
22058fpossize='$fpossize'
22059fpostype='$fpostype'
22060freetype='$freetype'
22061from='$from'
22062full_ar='$full_ar'
22063full_csh='$full_csh'
22064full_sed='$full_sed'
22065gccansipedantic='$gccansipedantic'
22066gccosandvers='$gccosandvers'
22067gccversion='$gccversion'
22068getgrent_r_proto='$getgrent_r_proto'
22069getgrgid_r_proto='$getgrgid_r_proto'
22070getgrnam_r_proto='$getgrnam_r_proto'
22071gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22072gethostbyname_r_proto='$gethostbyname_r_proto'
22073gethostent_r_proto='$gethostent_r_proto'
22074getlogin_r_proto='$getlogin_r_proto'
22075getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22076getnetbyname_r_proto='$getnetbyname_r_proto'
22077getnetent_r_proto='$getnetent_r_proto'
22078getprotobyname_r_proto='$getprotobyname_r_proto'
22079getprotobynumber_r_proto='$getprotobynumber_r_proto'
22080getprotoent_r_proto='$getprotoent_r_proto'
22081getpwent_r_proto='$getpwent_r_proto'
22082getpwnam_r_proto='$getpwnam_r_proto'
22083getpwuid_r_proto='$getpwuid_r_proto'
22084getservbyname_r_proto='$getservbyname_r_proto'
22085getservbyport_r_proto='$getservbyport_r_proto'
22086getservent_r_proto='$getservent_r_proto'
22087getspnam_r_proto='$getspnam_r_proto'
22088gidformat='$gidformat'
22089gidsign='$gidsign'
22090gidsize='$gidsize'
22091gidtype='$gidtype'
22092glibpth='$glibpth'
22093gmake='$gmake'
22094gmtime_r_proto='$gmtime_r_proto'
22095gnulibc_version='$gnulibc_version'
22096grep='$grep'
22097groupcat='$groupcat'
22098groupstype='$groupstype'
22099gzip='$gzip'
22100h_fcntl='$h_fcntl'
22101h_sysfile='$h_sysfile'
22102hint='$hint'
22103hostcat='$hostcat'
22104html1dir='$html1dir'
22105html1direxp='$html1direxp'
22106html3dir='$html3dir'
22107html3direxp='$html3direxp'
22108i16size='$i16size'
22109i16type='$i16type'
22110i32size='$i32size'
22111i32type='$i32type'
22112i64size='$i64size'
22113i64type='$i64type'
22114i8size='$i8size'
22115i8type='$i8type'
22116i_arpainet='$i_arpainet'
22117i_bsdioctl='$i_bsdioctl'
22118i_crypt='$i_crypt'
22119i_db='$i_db'
22120i_dbm='$i_dbm'
22121i_dirent='$i_dirent'
22122i_dld='$i_dld'
22123i_dlfcn='$i_dlfcn'
22124i_fcntl='$i_fcntl'
22125i_float='$i_float'
22126i_fp='$i_fp'
22127i_fp_class='$i_fp_class'
22128i_gdbm='$i_gdbm'
22129i_grp='$i_grp'
22130i_ieeefp='$i_ieeefp'
22131i_inttypes='$i_inttypes'
22132i_langinfo='$i_langinfo'
22133i_libutil='$i_libutil'
22134i_limits='$i_limits'
22135i_locale='$i_locale'
22136i_machcthr='$i_machcthr'
22137i_malloc='$i_malloc'
22138i_math='$i_math'
22139i_memory='$i_memory'
22140i_mntent='$i_mntent'
22141i_ndbm='$i_ndbm'
22142i_netdb='$i_netdb'
22143i_neterrno='$i_neterrno'
22144i_netinettcp='$i_netinettcp'
22145i_niin='$i_niin'
22146i_poll='$i_poll'
22147i_prot='$i_prot'
22148i_pthread='$i_pthread'
22149i_pwd='$i_pwd'
22150i_rpcsvcdbm='$i_rpcsvcdbm'
22151i_sfio='$i_sfio'
22152i_sgtty='$i_sgtty'
22153i_shadow='$i_shadow'
22154i_socks='$i_socks'
22155i_stdarg='$i_stdarg'
22156i_stddef='$i_stddef'
22157i_stdlib='$i_stdlib'
22158i_string='$i_string'
22159i_sunmath='$i_sunmath'
22160i_sysaccess='$i_sysaccess'
22161i_sysdir='$i_sysdir'
22162i_sysfile='$i_sysfile'
22163i_sysfilio='$i_sysfilio'
22164i_sysin='$i_sysin'
22165i_sysioctl='$i_sysioctl'
22166i_syslog='$i_syslog'
22167i_sysmman='$i_sysmman'
22168i_sysmode='$i_sysmode'
22169i_sysmount='$i_sysmount'
22170i_sysndir='$i_sysndir'
22171i_sysparam='$i_sysparam'
22172i_sysresrc='$i_sysresrc'
22173i_syssecrt='$i_syssecrt'
22174i_sysselct='$i_sysselct'
22175i_syssockio='$i_syssockio'
22176i_sysstat='$i_sysstat'
22177i_sysstatfs='$i_sysstatfs'
22178i_sysstatvfs='$i_sysstatvfs'
22179i_systime='$i_systime'
22180i_systimek='$i_systimek'
22181i_systimes='$i_systimes'
22182i_systypes='$i_systypes'
22183i_sysuio='$i_sysuio'
22184i_sysun='$i_sysun'
22185i_sysutsname='$i_sysutsname'
22186i_sysvfs='$i_sysvfs'
22187i_syswait='$i_syswait'
22188i_termio='$i_termio'
22189i_termios='$i_termios'
22190i_time='$i_time'
22191i_unistd='$i_unistd'
22192i_ustat='$i_ustat'
22193i_utime='$i_utime'
22194i_values='$i_values'
22195i_varargs='$i_varargs'
22196i_varhdr='$i_varhdr'
22197i_vfork='$i_vfork'
22198ignore_versioned_solibs='$ignore_versioned_solibs'
22199inc_version_list='$inc_version_list'
22200inc_version_list_init='$inc_version_list_init'
22201incpath='$incpath'
22202inews='$inews'
22203initialinstalllocation='$initialinstalllocation'
22204installarchlib='$installarchlib'
22205installbin='$installbin'
22206installhtml1dir='$installhtml1dir'
22207installhtml3dir='$installhtml3dir'
22208installman1dir='$installman1dir'
22209installman3dir='$installman3dir'
22210installprefix='$installprefix'
22211installprefixexp='$installprefixexp'
22212installprivlib='$installprivlib'
22213installscript='$installscript'
22214installsitearch='$installsitearch'
22215installsitebin='$installsitebin'
22216installsitehtml1dir='$installsitehtml1dir'
22217installsitehtml3dir='$installsitehtml3dir'
22218installsitelib='$installsitelib'
22219installsiteman1dir='$installsiteman1dir'
22220installsiteman3dir='$installsiteman3dir'
22221installsitescript='$installsitescript'
22222installstyle='$installstyle'
22223installusrbinperl='$installusrbinperl'
22224installvendorarch='$installvendorarch'
22225installvendorbin='$installvendorbin'
22226installvendorhtml1dir='$installvendorhtml1dir'
22227installvendorhtml3dir='$installvendorhtml3dir'
22228installvendorlib='$installvendorlib'
22229installvendorman1dir='$installvendorman1dir'
22230installvendorman3dir='$installvendorman3dir'
22231installvendorscript='$installvendorscript'
22232intsize='$intsize'
22233issymlink='$issymlink'
22234ivdformat='$ivdformat'
22235ivsize='$ivsize'
22236ivtype='$ivtype'
22237known_extensions='$known_extensions'
22238ksh='$ksh'
22239ld='$ld'
22240lddlflags='$lddlflags'
22241ldflags='$ldflags'
22242ldflags_uselargefiles='$ldflags_uselargefiles'
22243ldlibpthname='$ldlibpthname'
22244less='$less'
22245lib_ext='$lib_ext'
22246libc='$libc'
22247libperl='$libperl'
22248libpth='$libpth'
22249libs='$libs'
22250libsdirs='$libsdirs'
22251libsfiles='$libsfiles'
22252libsfound='$libsfound'
22253libspath='$libspath'
22254libswanted='$libswanted'
22255libswanted_uselargefiles='$libswanted_uselargefiles'
22256line='$line'
22257lint='$lint'
22258lkflags='$lkflags'
22259ln='$ln'
22260lns='$lns'
22261localtime_r_proto='$localtime_r_proto'
22262locincpth='$locincpth'
22263loclibpth='$loclibpth'
22264longdblsize='$longdblsize'
22265longlongsize='$longlongsize'
22266longsize='$longsize'
22267lp='$lp'
22268lpr='$lpr'
22269ls='$ls'
22270lseeksize='$lseeksize'
22271lseektype='$lseektype'
22272mad='$mad'
22273madlyh='$madlyh'
22274madlyobj='$madlyobj'
22275madlysrc='$madlysrc'
22276mail='$mail'
22277mailx='$mailx'
22278make='$make'
22279make_set_make='$make_set_make'
22280mallocobj='$mallocobj'
22281mallocsrc='$mallocsrc'
22282malloctype='$malloctype'
22283man1dir='$man1dir'
22284man1direxp='$man1direxp'
22285man1ext='$man1ext'
22286man3dir='$man3dir'
22287man3direxp='$man3direxp'
22288man3ext='$man3ext'
22289mips_type='$mips_type'
22290mistrustnm='$mistrustnm'
22291mkdir='$mkdir'
22292mmaptype='$mmaptype'
22293modetype='$modetype'
22294more='$more'
22295multiarch='$multiarch'
22296mv='$mv'
22297myarchname='$myarchname'
22298mydomain='$mydomain'
22299myhostname='$myhostname'
22300myuname='$myuname'
22301n='$n'
22302need_va_copy='$need_va_copy'
22303netdb_hlen_type='$netdb_hlen_type'
22304netdb_host_type='$netdb_host_type'
22305netdb_name_type='$netdb_name_type'
22306netdb_net_type='$netdb_net_type'
22307nm='$nm'
22308nm_opt='$nm_opt'
22309nm_so_opt='$nm_so_opt'
22310nonxs_ext='$nonxs_ext'
22311nroff='$nroff'
22312nvEUformat='$nvEUformat'
22313nvFUformat='$nvFUformat'
22314nvGUformat='$nvGUformat'
22315nv_preserves_uv_bits='$nv_preserves_uv_bits'
22316nveformat='$nveformat'
22317nvfformat='$nvfformat'
22318nvgformat='$nvgformat'
22319nvsize='$nvsize'
22320nvtype='$nvtype'
22321o_nonblock='$o_nonblock'
22322obj_ext='$obj_ext'
22323old_pthread_create_joinable='$old_pthread_create_joinable'
22324optimize='$optimize'
22325orderlib='$orderlib'
22326osname='$osname'
22327osvers='$osvers'
22328otherlibdirs='$otherlibdirs'
22329package='$package'
22330pager='$pager'
22331passcat='$passcat'
22332patchlevel='$patchlevel'
22333path_sep='$path_sep'
22334perl5='$perl5'
22335perl='$perl'
22336perl_patchlevel='$perl_patchlevel'
22337perladmin='$perladmin'
22338perllibs='$perllibs'
22339perlpath='$perlpath'
22340pg='$pg'
22341phostname='$phostname'
22342pidtype='$pidtype'
22343plibpth='$plibpth'
22344pmake='$pmake'
22345pr='$pr'
22346prefix='$prefix'
22347prefixexp='$prefixexp'
22348privlib='$privlib'
22349privlibexp='$privlibexp'
22350procselfexe='$procselfexe'
22351prototype='$prototype'
22352ptrsize='$ptrsize'
22353quadkind='$quadkind'
22354quadtype='$quadtype'
22355randbits='$randbits'
22356randfunc='$randfunc'
22357random_r_proto='$random_r_proto'
22358randseedtype='$randseedtype'
22359ranlib='$ranlib'
22360rd_nodata='$rd_nodata'
22361readdir64_r_proto='$readdir64_r_proto'
22362readdir_r_proto='$readdir_r_proto'
22363revision='$revision'
22364rm='$rm'
22365rm_try='$rm_try'
22366rmail='$rmail'
22367run='$run'
22368runnm='$runnm'
22369sPRIEUldbl='$sPRIEUldbl'
22370sPRIFUldbl='$sPRIFUldbl'
22371sPRIGUldbl='$sPRIGUldbl'
22372sPRIXU64='$sPRIXU64'
22373sPRId64='$sPRId64'
22374sPRIeldbl='$sPRIeldbl'
22375sPRIfldbl='$sPRIfldbl'
22376sPRIgldbl='$sPRIgldbl'
22377sPRIi64='$sPRIi64'
22378sPRIo64='$sPRIo64'
22379sPRIu64='$sPRIu64'
22380sPRIx64='$sPRIx64'
22381sSCNfldbl='$sSCNfldbl'
22382sched_yield='$sched_yield'
22383scriptdir='$scriptdir'
22384scriptdirexp='$scriptdirexp'
22385sed='$sed'
22386seedfunc='$seedfunc'
22387selectminbits='$selectminbits'
22388selecttype='$selecttype'
22389sendmail='$sendmail'
22390setgrent_r_proto='$setgrent_r_proto'
22391sethostent_r_proto='$sethostent_r_proto'
22392setlocale_r_proto='$setlocale_r_proto'
22393setnetent_r_proto='$setnetent_r_proto'
22394setprotoent_r_proto='$setprotoent_r_proto'
22395setpwent_r_proto='$setpwent_r_proto'
22396setservent_r_proto='$setservent_r_proto'
22397sh='$sh'
22398shar='$shar'
22399sharpbang='$sharpbang'
22400shmattype='$shmattype'
22401shortsize='$shortsize'
22402shrpenv='$shrpenv'
22403shsharp='$shsharp'
22404sig_count='$sig_count'
22405sig_name='$sig_name'
22406sig_name_init='$sig_name_init'
22407sig_num='$sig_num'
22408sig_num_init='$sig_num_init'
22409sig_size='$sig_size'
22410signal_t='$signal_t'
22411sitearch='$sitearch'
22412sitearchexp='$sitearchexp'
22413sitebin='$sitebin'
22414sitebinexp='$sitebinexp'
22415sitehtml1dir='$sitehtml1dir'
22416sitehtml1direxp='$sitehtml1direxp'
22417sitehtml3dir='$sitehtml3dir'
22418sitehtml3direxp='$sitehtml3direxp'
22419sitelib='$sitelib'
22420sitelib_stem='$sitelib_stem'
22421sitelibexp='$sitelibexp'
22422siteman1dir='$siteman1dir'
22423siteman1direxp='$siteman1direxp'
22424siteman3dir='$siteman3dir'
22425siteman3direxp='$siteman3direxp'
22426siteprefix='$siteprefix'
22427siteprefixexp='$siteprefixexp'
22428sitescript='$sitescript'
22429sitescriptexp='$sitescriptexp'
22430sizesize='$sizesize'
22431sizetype='$sizetype'
22432sleep='$sleep'
22433smail='$smail'
22434so='$so'
22435sockethdr='$sockethdr'
22436socketlib='$socketlib'
22437socksizetype='$socksizetype'
22438sort='$sort'
22439spackage='$spackage'
22440spitshell='$spitshell'
22441srand48_r_proto='$srand48_r_proto'
22442srandom_r_proto='$srandom_r_proto'
22443src='$src'
22444ssizetype='$ssizetype'
22445startperl='$startperl'
22446startsh='$startsh'
22447static_ext='$static_ext'
22448stdchar='$stdchar'
22449stdio_base='$stdio_base'
22450stdio_bufsiz='$stdio_bufsiz'
22451stdio_cnt='$stdio_cnt'
22452stdio_filbuf='$stdio_filbuf'
22453stdio_ptr='$stdio_ptr'
22454stdio_stream_array='$stdio_stream_array'
22455strerror_r_proto='$strerror_r_proto'
22456strings='$strings'
22457submit='$submit'
22458subversion='$subversion'
22459sysman='$sysman'
22460tail='$tail'
22461tar='$tar'
22462targetarch='$targetarch'
22463tbl='$tbl'
22464tee='$tee'
22465test='$test'
22466timeincl='$timeincl'
22467timetype='$timetype'
22468tmpnam_r_proto='$tmpnam_r_proto'
22469to='$to'
22470touch='$touch'
22471tr='$tr'
22472trnl='$trnl'
22473troff='$troff'
22474ttyname_r_proto='$ttyname_r_proto'
22475u16size='$u16size'
22476u16type='$u16type'
22477u32size='$u32size'
22478u32type='$u32type'
22479u64size='$u64size'
22480u64type='$u64type'
22481u8size='$u8size'
22482u8type='$u8type'
22483uidformat='$uidformat'
22484uidsign='$uidsign'
22485uidsize='$uidsize'
22486uidtype='$uidtype'
22487uname='$uname'
22488uniq='$uniq'
22489uquadtype='$uquadtype'
22490use5005threads='$use5005threads'
22491use64bitall='$use64bitall'
22492use64bitint='$use64bitint'
22493usecrosscompile='$usecrosscompile'
22494usedl='$usedl'
22495usefaststdio='$usefaststdio'
22496useithreads='$useithreads'
22497uselargefiles='$uselargefiles'
22498uselongdouble='$uselongdouble'
22499usemallocwrap='$usemallocwrap'
22500usemorebits='$usemorebits'
22501usemultiplicity='$usemultiplicity'
22502usemymalloc='$usemymalloc'
22503usenm='$usenm'
22504useopcode='$useopcode'
22505useperlio='$useperlio'
22506useposix='$useposix'
22507usereentrant='$usereentrant'
22508userelocatableinc='$userelocatableinc'
22509usesfio='$usesfio'
22510useshrplib='$useshrplib'
22511usesitecustomize='$usesitecustomize'
22512usesocks='$usesocks'
22513usethreads='$usethreads'
22514usevendorprefix='$usevendorprefix'
22515usevfork='$usevfork'
22516usrinc='$usrinc'
22517uuname='$uuname'
22518uvXUformat='$uvXUformat'
22519uvoformat='$uvoformat'
22520uvsize='$uvsize'
22521uvtype='$uvtype'
22522uvuformat='$uvuformat'
22523uvxformat='$uvxformat'
22524vendorarch='$vendorarch'
22525vendorarchexp='$vendorarchexp'
22526vendorbin='$vendorbin'
22527vendorbinexp='$vendorbinexp'
22528vendorhtml1dir='$vendorhtml1dir'
22529vendorhtml1direxp='$vendorhtml1direxp'
22530vendorhtml3dir='$vendorhtml3dir'
22531vendorhtml3direxp='$vendorhtml3direxp'
22532vendorlib='$vendorlib'
22533vendorlib_stem='$vendorlib_stem'
22534vendorlibexp='$vendorlibexp'
22535vendorman1dir='$vendorman1dir'
22536vendorman1direxp='$vendorman1direxp'
22537vendorman3dir='$vendorman3dir'
22538vendorman3direxp='$vendorman3direxp'
22539vendorprefix='$vendorprefix'
22540vendorprefixexp='$vendorprefixexp'
22541vendorscript='$vendorscript'
22542vendorscriptexp='$vendorscriptexp'
22543version='$version'
22544version_patchlevel_string='$version_patchlevel_string'
22545versiononly='$versiononly'
22546vi='$vi'
22547voidflags='$voidflags'
22548xlibpth='$xlibpth'
22549yacc='$yacc'
22550yaccflags='$yaccflags'
22551zcat='$zcat'
22552zip='$zip'
22553EOT
22554
22555: Add in command line options if available
22556$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22557
22558: add special variables
22559$test -f $src/patchlevel.h && \
22560awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22561echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22562echo "PERL_CONFIG_SH=true" >>config.sh
22563
22564: propagate old symbols
22565if $test -f UU/config.sh; then
22566	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
22567	sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22568	$sort | $uniq -u >UU/oldsyms
22569	set X `cat UU/oldsyms`
22570	shift
22571	case $# in
22572	0) ;;
22573	*)
22574		cat <<EOM
22575Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22576EOM
22577		echo "# Variables propagated from previous config.sh file." >>config.sh
22578		for sym in `cat UU/oldsyms`; do
22579			echo "    Propagating $hint variable "'$'"$sym..."
22580			eval 'tmp="$'"${sym}"'"'
22581			echo "$tmp" | \
22582				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22583		done
22584		;;
22585	esac
22586fi
22587
22588: Finish up by extracting the .SH files
22589case "$alldone" in
22590exit)
22591	$rm -rf UU
22592	echo "Extraction done."
22593	exit 0
22594	;;
22595cont)
22596	;;
22597'')
22598	dflt=''
22599	nostick=true
22600	$cat <<EOM
22601
22602If you'd like to make any changes to the config.sh file before I begin
22603to configure things, do it as a shell escape now (e.g. !vi config.sh).
22604
22605EOM
22606	rp="Press return or use a shell escape to edit config.sh:"
22607	. UU/myread
22608	nostick=''
22609	case "$ans" in
22610	'') ;;
22611	*) : in case they cannot read
22612		sh 1>&4 -c "$ans";;
22613	esac
22614	;;
22615esac
22616
22617: if this fails, just run all the .SH files by hand
22618. ./config.sh
22619
22620echo " "
22621exec 1>&4
22622pwd=`pwd`
22623. ./UU/extract
22624cd "$pwd"
22625
22626if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22627	dflt=y
22628	case "$silent" in
22629	true) ;;
22630	*)
22631		$cat <<EOM
22632
22633Now you need to generate make dependencies by running "$make depend".
22634You might prefer to run it in background: "$make depend > makedepend.out &"
22635It can take a while, so you might not want to run it right now.
22636
22637EOM
22638		;;
22639	esac
22640	rp="Run $make depend now?"
22641	. UU/myread
22642	case "$ans" in
22643	y*)
22644		$make depend && echo "Now you must run '$make'."
22645		;;
22646	*)
22647		echo "You must run '$make depend' then '$make'."
22648		;;
22649	esac
22650elif test -f [Mm]akefile; then
22651	echo " "
22652	echo "Now you must run a $make."
22653else
22654	echo "Configure done."
22655fi
22656
22657if $test -f Policy.sh; then
22658    $cat <<EOM
22659
22660If you compile $package on a different machine or from a different object
22661directory, copy the Policy.sh file from this object directory to the
22662new one before you run Configure -- this will help you with most of
22663the policy defaults.
22664
22665EOM
22666fi
22667if $test -f config.msg; then
22668    echo "Hmm.  I also noted the following information while running:"
22669    echo " "
22670    $cat config.msg >&4
22671    $rm -f config.msg
22672fi
22673$rm -f kit*isdone ark*isdone
22674$rm -rf UU
22675
22676: End of Configure
22677
22678