xref: /openbsd/gnu/usr.bin/perl/Configure (revision a6445c1d)
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist package (which contains metaconfig) is available via SVN:
17#     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18#
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
22# For more information on patching Configure, see pod/perlhack.pod
23#
24# The metaunits are also available from the public git repository:
25#     http://perl5.git.perl.org/metaconfig.git/ or
26#     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27#
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
30
31# Generated on Wed Jun  4 08:58:13 CEST 2014 [metaconfig 3.5 PL0]
32# (with additional metaconfig patches by perlbug@perl.org)
33
34cat >c1$$ <<EOF
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false.  Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
45cat >c2$$ <<EOF
46
47OOPS!  You naughty creature!  You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
51true || cat c1$$ c2$$
52true || exec sh $0 $argv:q
53
54(exit $?0) || cat c2$$
55(exit $?0) || exec sh $0 $argv:q
56rm -f c1$$ c2$$
57
58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59	cat <<EOF
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67	exit 1
68fi
69
70if test ! -c /dev/null ; then
71	cat <<EOF
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79	exit 1
80fi
81
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87	test "$me" || me=$0
88	;;
89esac
90
91: Proper separator for the PATH environment variable
92p_=:
93: On OS/2 this directory should exist if this is not floppy only system ":-]"
94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
95	if test -n "$OS2_SHELL"; then
96		p_=\;
97		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99		is_os2=yes
100	elif test -n "$DJGPP"; then
101		case "X${MACHTYPE:-nonesuchmach}" in
102		*cygwin|*msys) ;;
103		*) p_=\; ;;
104		esac
105	fi
106fi
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
117paths="$paths /system/gnu_library/bin"
118
119for p in $paths
120do
121	case "$p_$PATH$p_" in
122	*$p_$p$p_*) ;;
123	*) test -d $p && PATH=$PATH$p_$p ;;
124	esac
125done
126
127PATH=.$p_$PATH
128export PATH
129
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
136if (PATH=.; alias -x) >/dev/null 2>&1; then
137		inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140	needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143	if test X`/usr/bin/uname -v` = X4; then
144		avoidksh="to avoid AIX 4's /bin/sh"
145		newsh=/usr/bin/bsh
146	fi
147fi
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149	if test X`/usr/bin/uname -s` = XOSF1; then
150		avoidksh="to avoid Digital UNIX' ksh"
151		newsh=/bin/sh
152		unset BIN_SH
153	fi
154fi
155case "$inksh/$needksh" in
156/[a-z]*)
157		ENV=''
158		changesh=true
159		reason="$needksh"
160	;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164	changesh=true
165	reason="$avoidksh"
166	;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
170		cat <<EOM
171(I see you are using the Korn shell.  Some ksh's blow up on $me,
172mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173EOM
174	;;
175esac
176case "$changesh" in
177true)
178	export newsh
179	echo "(Feeding myself to $newsh $reason.)"
180	case "$0" in
181	Configure|*/Configure) exec $newsh $0 "$@";;
182	*) exec $newsh Configure "$@";;
183	esac
184	;;
185esac
186test -x "${newsh}" || unset newsh
187
188: if needed, set CDPATH to a harmless value that is not chatty
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'')	;;
192*)	case "$SHELL" in
193	*bash*) CDPATH='.' ;;
194	*) CDPATH='' ;;
195	esac
196	;;
197esac
198
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
201cd UU && rm -f ./*
202
203ccname=''
204ccversion=''
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
208from=''
209hostgenerate=''
210hostosname=''
211hostperl=''
212run=''
213targetarch=''
214targetdir=''
215targetenv=''
216targethost=''
217targetmkdir=''
218targetport=''
219to=''
220usecrosscompile=''
221extern_C=''
222mistrustnm=''
223usedevel=''
224perllibs=''
225dynamic_ext=''
226extensions=''
227known_extensions=''
228nonxs_ext=''
229static_ext=''
230useopcode=''
231useposix=''
232extras=''
233d_bsd=''
234d_eunice=''
235d_xenix=''
236eunicefix=''
237ar=''
238awk=''
239bash=''
240bison=''
241byacc=''
242cat=''
243chgrp=''
244chmod=''
245chown=''
246comm=''
247compress=''
248cp=''
249cpio=''
250cpp=''
251csh=''
252date=''
253echo=''
254egrep=''
255emacs=''
256expr=''
257find=''
258flex=''
259gmake=''
260grep=''
261gzip=''
262inews=''
263ksh=''
264less=''
265line=''
266lint=''
267ln=''
268lp=''
269lpr=''
270ls=''
271mail=''
272mailx=''
273make=''
274mkdir=''
275more=''
276mv=''
277nm=''
278nroff=''
279perl=''
280pg=''
281pmake=''
282pr=''
283rm=''
284rmail=''
285sed=''
286sendmail=''
287shar=''
288sleep=''
289smail=''
290sort=''
291submit=''
292tail=''
293tar=''
294tbl=''
295tee=''
296test=''
297touch=''
298tr=''
299troff=''
300uname=''
301uniq=''
302uuname=''
303vi=''
304zcat=''
305zip=''
306full_ar=''
307full_sed=''
308libswanted=''
309hint=''
310myuname=''
311osname=''
312osvers=''
313Author=''
314Date=''
315Header=''
316Id=''
317Locker=''
318Log=''
319RCSfile=''
320Revision=''
321Source=''
322State=''
323sysroot=''
324_a=''
325_exe=''
326_o=''
327archobjs=''
328exe_ext=''
329firstmakefile=''
330lib_ext=''
331obj_ext=''
332path_sep=''
333rm_try=''
334afs=''
335afsroot=''
336alignbytes=''
337ansi2knr=''
338archlib=''
339archlibexp=''
340d_archlib=''
341installarchlib=''
342archname=''
343myarchname=''
344useversionedarchname=''
345d_atolf=''
346d_atoll=''
347baserev=''
348bin=''
349binexp=''
350initialinstalllocation=''
351installbin=''
352userelocatableinc=''
353byteorder=''
354cc=''
355ccflags=''
356cppflags=''
357ldflags=''
358lkflags=''
359locincpth=''
360optimize=''
361cf_email=''
362cf_by=''
363cf_time=''
364charbits=''
365charsize=''
366contains=''
367cpp_stuff=''
368cpplast=''
369cppminus=''
370cpprun=''
371cppstdin=''
372d__fwalk=''
373d_access=''
374d_accessx=''
375d_aintl=''
376d_alarm=''
377asctime_r_proto=''
378d_asctime_r=''
379d_attribute_deprecated=''
380d_attribute_format=''
381d_attribute_malloc=''
382d_attribute_nonnull=''
383d_attribute_noreturn=''
384d_attribute_pure=''
385d_attribute_unused=''
386d_attribute_warn_unused_result=''
387d_printf_format_null=''
388d_bcmp=''
389d_bcopy=''
390d_builtin_choose_expr=''
391d_builtin_expect=''
392d_bzero=''
393d_c99_variadic_macros=''
394d_casti32=''
395castflags=''
396d_castneg=''
397d_chown=''
398d_chroot=''
399d_chsize=''
400d_class=''
401d_clearenv=''
402d_closedir=''
403d_void_closedir=''
404d_cmsghdr_s=''
405d_const=''
406d_copysignl=''
407d_cplusplus=''
408cryptlib=''
409d_crypt=''
410crypt_r_proto=''
411d_crypt_r=''
412d_csh=''
413full_csh=''
414d_ctermid=''
415ctermid_r_proto=''
416d_ctermid_r=''
417ctime_r_proto=''
418d_ctime_r=''
419d_cuserid=''
420d_dbl_dig=''
421d_dbminitproto=''
422d_difftime=''
423d_dir_dd_fd=''
424d_dirfd=''
425d_dlerror=''
426d_dlopen=''
427d_dlsymun=''
428d_dosuid=''
429d_suidsafe=''
430d_drand48_r=''
431drand48_r_proto=''
432d_drand48proto=''
433d_dup2=''
434d_eaccess=''
435d_endgrent=''
436d_endgrent_r=''
437endgrent_r_proto=''
438d_endhent=''
439d_endhostent_r=''
440endhostent_r_proto=''
441d_endnent=''
442d_endnetent_r=''
443endnetent_r_proto=''
444d_endpent=''
445d_endprotoent_r=''
446endprotoent_r_proto=''
447d_endpwent=''
448d_endpwent_r=''
449endpwent_r_proto=''
450d_endsent=''
451d_endservent_r=''
452endservent_r_proto=''
453d_faststdio=''
454d_fchdir=''
455d_fchmod=''
456d_fchown=''
457d_fcntl=''
458d_fcntl_can_lock=''
459d_fd_macros=''
460d_fd_set=''
461d_fds_bits=''
462d_fgetpos=''
463d_finite=''
464d_finitel=''
465d_flexfnam=''
466d_flock=''
467d_flockproto=''
468d_fork=''
469d_fp_class=''
470d_fpclass=''
471d_fpclassify=''
472d_fpclassl=''
473d_fpos64_t=''
474d_frexpl=''
475d_fs_data_s=''
476d_fseeko=''
477d_fsetpos=''
478d_fstatfs=''
479d_fsync=''
480d_ftello=''
481d_ftime=''
482d_gettimeod=''
483d_futimes=''
484d_Gconvert=''
485d_getaddrinfo=''
486d_getcwd=''
487d_getespwnam=''
488d_getfsstat=''
489d_getgrent=''
490d_getgrent_r=''
491getgrent_r_proto=''
492d_getgrgid_r=''
493getgrgid_r_proto=''
494d_getgrnam_r=''
495getgrnam_r_proto=''
496d_getgrps=''
497d_gethbyaddr=''
498d_gethbyname=''
499d_gethent=''
500aphostname=''
501d_gethname=''
502d_phostname=''
503d_uname=''
504d_gethostbyaddr_r=''
505gethostbyaddr_r_proto=''
506d_gethostbyname_r=''
507gethostbyname_r_proto=''
508d_gethostent_r=''
509gethostent_r_proto=''
510d_gethostprotos=''
511d_getitimer=''
512d_getlogin=''
513d_getlogin_r=''
514getlogin_r_proto=''
515d_getmnt=''
516d_getmntent=''
517d_getnameinfo=''
518d_getnbyaddr=''
519d_getnbyname=''
520d_getnent=''
521d_getnetbyaddr_r=''
522getnetbyaddr_r_proto=''
523d_getnetbyname_r=''
524getnetbyname_r_proto=''
525d_getnetent_r=''
526getnetent_r_proto=''
527d_getnetprotos=''
528d_getpagsz=''
529d_getpent=''
530d_getpgid=''
531d_getpgrp2=''
532d_bsdgetpgrp=''
533d_getpgrp=''
534d_getppid=''
535d_getprior=''
536d_getpbyname=''
537d_getpbynumber=''
538d_getprotobyname_r=''
539getprotobyname_r_proto=''
540d_getprotobynumber_r=''
541getprotobynumber_r_proto=''
542d_getprotoent_r=''
543getprotoent_r_proto=''
544d_getprotoprotos=''
545d_getprpwnam=''
546d_getpwent=''
547d_getpwent_r=''
548getpwent_r_proto=''
549d_getpwnam_r=''
550getpwnam_r_proto=''
551d_getpwuid_r=''
552getpwuid_r_proto=''
553d_getsent=''
554d_getservbyname_r=''
555getservbyname_r_proto=''
556d_getservbyport_r=''
557getservbyport_r_proto=''
558d_getservent_r=''
559getservent_r_proto=''
560d_getservprotos=''
561d_getspnam=''
562d_getspnam_r=''
563getspnam_r_proto=''
564d_getsbyname=''
565d_getsbyport=''
566d_gmtime_r=''
567gmtime_r_proto=''
568d_gnulibc=''
569gnulibc_version=''
570d_hasmntopt=''
571d_htonl=''
572d_ilogbl=''
573d_inetaton=''
574d_inetntop=''
575d_inetpton=''
576d_int64_t=''
577d_isascii=''
578d_isblank=''
579d_isfinite=''
580d_isinf=''
581d_isnan=''
582d_isnanl=''
583d_killpg=''
584d_lchown=''
585d_ldbl_dig=''
586d_libm_lib_version=''
587d_link=''
588d_localtime_r=''
589d_localtime_r_needs_tzset=''
590localtime_r_proto=''
591d_locconv=''
592d_lc_monetary_2008=''
593d_lockf=''
594d_longdbl=''
595longdblsize=''
596d_longlong=''
597longlongsize=''
598d_lseekproto=''
599d_lstat=''
600d_madvise=''
601d_malloc_good_size=''
602d_malloc_size=''
603d_mblen=''
604d_mbstowcs=''
605d_mbtowc=''
606d_memchr=''
607d_memcmp=''
608d_memcpy=''
609d_memmove=''
610d_memset=''
611d_mkdir=''
612d_mkdtemp=''
613d_mkfifo=''
614d_mkstemp=''
615d_mkstemps=''
616d_mktime=''
617d_mmap=''
618mmaptype=''
619d_modfl=''
620d_modfl_pow32_bug=''
621d_modflproto=''
622d_mprotect=''
623d_msg=''
624d_msgctl=''
625d_msgget=''
626d_msghdr_s=''
627d_msgrcv=''
628d_msgsnd=''
629d_msync=''
630d_munmap=''
631d_nice=''
632d_nl_langinfo=''
633d_off64_t=''
634d_open3=''
635d_fpathconf=''
636d_pathconf=''
637d_pause=''
638d_pipe=''
639d_poll=''
640d_portable=''
641d_prctl=''
642d_prctl_set_name=''
643d_procselfexe=''
644procselfexe=''
645d_old_pthread_create_joinable=''
646old_pthread_create_joinable=''
647d_pthread_atfork=''
648d_pthread_attr_setscope=''
649d_pthread_yield=''
650d_sched_yield=''
651sched_yield=''
652d_qgcvt=''
653d_random_r=''
654random_r_proto=''
655d_readdir64_r=''
656readdir64_r_proto=''
657d_readdir=''
658d_rewinddir=''
659d_seekdir=''
660d_telldir=''
661d_readdir_r=''
662readdir_r_proto=''
663d_readlink=''
664d_readv=''
665d_recvmsg=''
666d_rename=''
667d_rmdir=''
668d_safebcpy=''
669d_safemcpy=''
670d_sanemcmp=''
671d_sbrkproto=''
672d_scalbnl=''
673d_select=''
674d_sem=''
675d_semctl=''
676d_semget=''
677d_semop=''
678d_sendmsg=''
679d_setegid=''
680d_seteuid=''
681d_setgrent=''
682d_setgrent_r=''
683setgrent_r_proto=''
684d_setgrps=''
685d_sethent=''
686d_sethostent_r=''
687sethostent_r_proto=''
688d_setitimer=''
689d_setlinebuf=''
690d_setlocale=''
691d_setlocale_r=''
692setlocale_r_proto=''
693d_setnent=''
694d_setnetent_r=''
695setnetent_r_proto=''
696d_setpent=''
697d_setpgid=''
698d_setpgrp2=''
699d_bsdsetpgrp=''
700d_setpgrp=''
701d_setprior=''
702d_setproctitle=''
703d_setprotoent_r=''
704setprotoent_r_proto=''
705d_setpwent=''
706d_setpwent_r=''
707setpwent_r_proto=''
708d_setregid=''
709d_setresgid=''
710d_setresuid=''
711d_setreuid=''
712d_setrgid=''
713d_setruid=''
714d_setsent=''
715d_setservent_r=''
716setservent_r_proto=''
717d_setsid=''
718d_setvbuf=''
719d_shm=''
720d_shmat=''
721d_shmatprototype=''
722shmattype=''
723d_shmctl=''
724d_shmdt=''
725d_shmget=''
726d_sigaction=''
727d_signbit=''
728d_sigprocmask=''
729d_sigsetjmp=''
730usesitecustomize=''
731d_snprintf=''
732d_vsnprintf=''
733d_sockatmark=''
734d_sockatmarkproto=''
735d_ip_mreq=''
736d_ip_mreq_source=''
737d_ipv6_mreq=''
738d_ipv6_mreq_source=''
739d_msg_ctrunc=''
740d_msg_dontroute=''
741d_msg_oob=''
742d_msg_peek=''
743d_msg_proxy=''
744d_oldsock=''
745d_scm_rights=''
746d_sin6_scope_id=''
747d_sockaddr_in6=''
748d_sockaddr_sa_len=''
749d_socket=''
750d_sockpair=''
751sockethdr=''
752socketlib=''
753d_socklen_t=''
754d_socks5_init=''
755d_sprintf_returns_strlen=''
756d_sqrtl=''
757d_srand48_r=''
758srand48_r_proto=''
759d_srandom_r=''
760srandom_r_proto=''
761d_sresgproto=''
762d_sresuproto=''
763d_statblks=''
764d_statfs_f_flags=''
765d_statfs_s=''
766d_static_inline=''
767perl_static_inline=''
768d_fstatvfs=''
769d_statvfs=''
770d_stdio_cnt_lval=''
771d_stdio_ptr_lval=''
772d_stdio_ptr_lval_nochange_cnt=''
773d_stdio_ptr_lval_sets_cnt=''
774d_stdiobase=''
775d_stdstdio=''
776stdio_base=''
777stdio_bufsiz=''
778stdio_cnt=''
779stdio_filbuf=''
780stdio_ptr=''
781d_index=''
782d_strchr=''
783d_strcoll=''
784d_strctcpy=''
785d_strerrm=''
786d_strerror=''
787d_sysernlst=''
788d_syserrlst=''
789d_strerror_r=''
790strerror_r_proto=''
791d_strftime=''
792d_strlcat=''
793d_strlcpy=''
794d_strtod=''
795d_strtol=''
796d_strtold=''
797d_strtoll=''
798d_strtoq=''
799d_strtoul=''
800d_strtoull=''
801d_strtouq=''
802d_strxfrm=''
803d_symlink=''
804d_syscall=''
805d_syscallproto=''
806d_sysconf=''
807d_system=''
808d_tcgetpgrp=''
809d_tcsetpgrp=''
810d_telldirproto=''
811d_time=''
812timetype=''
813d_asctime64=''
814d_ctime64=''
815d_difftime64=''
816d_gmtime64=''
817d_localtime64=''
818d_mktime64=''
819d_timegm=''
820clocktype=''
821d_times=''
822d_tmpnam_r=''
823tmpnam_r_proto=''
824d_truncate=''
825d_ttyname_r=''
826ttyname_r_proto=''
827d_tzname=''
828d_u32align=''
829d_ualarm=''
830d_umask=''
831d_semctl_semid_ds=''
832d_semctl_semun=''
833d_union_semun=''
834d_unordered=''
835d_unsetenv=''
836d_usleep=''
837d_usleepproto=''
838d_ustat=''
839d_pseudofork=''
840d_vfork=''
841usevfork=''
842d_voidsig=''
843signal_t=''
844d_volatile=''
845d_charvspr=''
846d_vprintf=''
847d_wait4=''
848d_waitpid=''
849d_wcstombs=''
850d_wctomb=''
851d_writev=''
852dlext=''
853bin_ELF=''
854cccdlflags=''
855ccdlflags=''
856dlsrc=''
857ld=''
858ld_can_script=''
859lddlflags=''
860usedl=''
861doublesize=''
862bootstrap_charset=''
863ebcdic=''
864fflushNULL=''
865fflushall=''
866fpossize=''
867fpostype=''
868gccansipedantic=''
869gccosandvers=''
870gccversion=''
871gidformat=''
872gidsign=''
873gidsize=''
874gidtype=''
875groupstype=''
876h_fcntl=''
877h_sysfile=''
878html1dir=''
879html1direxp=''
880installhtml1dir=''
881html3dir=''
882html3direxp=''
883installhtml3dir=''
884i_arpainet=''
885i_assert=''
886i_crypt=''
887db_hashtype=''
888db_prefixtype=''
889db_version_major=''
890db_version_minor=''
891db_version_patch=''
892i_db=''
893i_dbm=''
894i_rpcsvcdbm=''
895d_dirnamlen=''
896direntrytype=''
897i_dirent=''
898i_dlfcn=''
899i_fcntl=''
900i_float=''
901i_fp=''
902i_fp_class=''
903i_gdbm=''
904d_grpasswd=''
905i_grp=''
906i_ieeefp=''
907i_inttypes=''
908i_langinfo=''
909i_libutil=''
910i_limits=''
911i_locale=''
912i_machcthr=''
913i_malloc=''
914i_mallocmalloc=''
915i_math=''
916i_memory=''
917i_mntent=''
918d_gdbm_ndbm_h_uses_prototypes=''
919d_gdbmndbm_h_uses_prototypes=''
920d_ndbm=''
921d_ndbm_h_uses_prototypes=''
922i_gdbm_ndbm=''
923i_gdbmndbm=''
924i_ndbm=''
925i_netdb=''
926i_neterrno=''
927i_netinettcp=''
928i_niin=''
929i_sysin=''
930i_poll=''
931i_prot=''
932i_pthread=''
933d_pwage=''
934d_pwchange=''
935d_pwclass=''
936d_pwcomment=''
937d_pwexpire=''
938d_pwgecos=''
939d_pwpasswd=''
940d_pwquota=''
941i_pwd=''
942i_shadow=''
943i_socks=''
944i_stdbool=''
945i_stddef=''
946i_stdlib=''
947i_string=''
948strings=''
949i_sunmath=''
950i_sysaccess=''
951i_sysdir=''
952i_sysfile=''
953d_voidtty=''
954i_bsdioctl=''
955i_sysfilio=''
956i_sysioctl=''
957i_syssockio=''
958i_syslog=''
959i_sysmman=''
960i_sysmode=''
961i_sysmount=''
962i_sysndir=''
963i_sysparam=''
964i_syspoll=''
965i_sysresrc=''
966i_syssecrt=''
967i_sysselct=''
968i_sysstat=''
969i_sysstatfs=''
970i_sysstatvfs=''
971i_systimes=''
972i_systypes=''
973i_sysuio=''
974i_sysun=''
975i_sysutsname=''
976i_sysvfs=''
977i_syswait=''
978i_sgtty=''
979i_termio=''
980i_termios=''
981d_tm_tm_gmtoff=''
982d_tm_tm_zone=''
983i_systime=''
984i_systimek=''
985i_time=''
986timeincl=''
987i_unistd=''
988i_ustat=''
989i_utime=''
990i_values=''
991i_stdarg=''
992i_varargs=''
993i_varhdr=''
994i_vfork=''
995d_inc_version_list=''
996inc_version_list=''
997inc_version_list_init=''
998installprefix=''
999installprefixexp=''
1000installstyle=''
1001installusrbinperl=''
1002intsize=''
1003longsize=''
1004shortsize=''
1005issymlink=''
1006libc=''
1007ldlibpthname=''
1008libperl=''
1009shrpenv=''
1010useshrplib=''
1011glibpth=''
1012incpth=''
1013libpth=''
1014loclibpth=''
1015plibpth=''
1016xlibpth=''
1017ignore_versioned_solibs=''
1018libs=''
1019libsdirs=''
1020libsfiles=''
1021libsfound=''
1022libspath=''
1023lns=''
1024d_PRIEUldbl=''
1025d_PRIFUldbl=''
1026d_PRIGUldbl=''
1027d_PRIeldbl=''
1028d_PRIfldbl=''
1029d_PRIgldbl=''
1030d_SCNfldbl=''
1031sPRIEUldbl=''
1032sPRIFUldbl=''
1033sPRIGUldbl=''
1034sPRIeldbl=''
1035sPRIfldbl=''
1036sPRIgldbl=''
1037sSCNfldbl=''
1038lseeksize=''
1039lseektype=''
1040mad=''
1041madlyh=''
1042madlyobj=''
1043madlysrc=''
1044make_set_make=''
1045d_mymalloc=''
1046freetype=''
1047mallocobj=''
1048mallocsrc=''
1049malloctype=''
1050usemallocwrap=''
1051usemymalloc=''
1052installman1dir=''
1053man1dir=''
1054man1direxp=''
1055man1ext=''
1056installman3dir=''
1057man3dir=''
1058man3direxp=''
1059man3ext=''
1060modetype=''
1061multiarch=''
1062mydomain=''
1063myhostname=''
1064phostname=''
1065c=''
1066n=''
1067d_eofnblk=''
1068eagain=''
1069o_nonblock=''
1070rd_nodata=''
1071need_va_copy=''
1072netdb_hlen_type=''
1073netdb_host_type=''
1074netdb_name_type=''
1075netdb_net_type=''
1076groupcat=''
1077hostcat=''
1078passcat=''
1079orderlib=''
1080ranlib=''
1081d_perl_otherlibdirs=''
1082otherlibdirs=''
1083package=''
1084spackage=''
1085pager=''
1086api_revision=''
1087api_subversion=''
1088api_version=''
1089api_versionstring=''
1090patchlevel=''
1091perl_patchlevel=''
1092revision=''
1093subversion=''
1094version=''
1095version_patchlevel_string=''
1096perl5=''
1097perladmin=''
1098perlpath=''
1099d_nv_preserves_uv=''
1100d_nv_zero_is_allbits_zero=''
1101i16size=''
1102i16type=''
1103i32size=''
1104i32type=''
1105i64size=''
1106i64type=''
1107i8size=''
1108i8type=''
1109ivsize=''
1110ivtype=''
1111nv_overflows_integers_at=''
1112nv_preserves_uv_bits=''
1113nvsize=''
1114nvtype=''
1115u16size=''
1116u16type=''
1117u32size=''
1118u32type=''
1119u64size=''
1120u64type=''
1121u8size=''
1122u8type=''
1123uvsize=''
1124uvtype=''
1125ivdformat=''
1126nvEUformat=''
1127nvFUformat=''
1128nvGUformat=''
1129nveformat=''
1130nvfformat=''
1131nvgformat=''
1132uvXUformat=''
1133uvoformat=''
1134uvuformat=''
1135uvxformat=''
1136pidtype=''
1137prefix=''
1138prefixexp=''
1139installprivlib=''
1140privlib=''
1141privlibexp=''
1142prototype=''
1143ptrsize=''
1144d_PRIXU64=''
1145d_PRId64=''
1146d_PRIi64=''
1147d_PRIo64=''
1148d_PRIu64=''
1149d_PRIx64=''
1150sPRIXU64=''
1151sPRId64=''
1152sPRIi64=''
1153sPRIo64=''
1154sPRIu64=''
1155sPRIx64=''
1156d_quad=''
1157quadkind=''
1158quadtype=''
1159uquadtype=''
1160drand01=''
1161randbits=''
1162randfunc=''
1163randseedtype=''
1164seedfunc=''
1165installscript=''
1166scriptdir=''
1167scriptdirexp=''
1168selectminbits=''
1169selecttype=''
1170sh=''
1171targetsh=''
1172sig_count=''
1173sig_name=''
1174sig_name_init=''
1175sig_num=''
1176sig_num_init=''
1177sig_size=''
1178d_sitearch=''
1179installsitearch=''
1180sitearch=''
1181sitearchexp=''
1182installsitebin=''
1183sitebin=''
1184sitebinexp=''
1185installsitehtml1dir=''
1186sitehtml1dir=''
1187sitehtml1direxp=''
1188installsitehtml3dir=''
1189sitehtml3dir=''
1190sitehtml3direxp=''
1191installsitelib=''
1192sitelib=''
1193sitelib_stem=''
1194sitelibexp=''
1195installsiteman1dir=''
1196siteman1dir=''
1197siteman1direxp=''
1198installsiteman3dir=''
1199siteman3dir=''
1200siteman3direxp=''
1201siteprefix=''
1202siteprefixexp=''
1203installsitescript=''
1204sitescript=''
1205sitescriptexp=''
1206sizesize=''
1207sizetype=''
1208d_libname_unique=''
1209so=''
1210socksizetype=''
1211sharpbang=''
1212shsharp=''
1213spitshell=''
1214src=''
1215ssizetype=''
1216st_ino_sign=''
1217st_ino_size=''
1218startperl=''
1219startsh=''
1220stdchar=''
1221d_stdio_stream_array=''
1222stdio_stream_array=''
1223sysman=''
1224sGMTIME_max=''
1225sGMTIME_min=''
1226sLOCALTIME_max=''
1227sLOCALTIME_min=''
1228trnl=''
1229uidformat=''
1230uidsign=''
1231uidsize=''
1232uidtype=''
1233archname64=''
1234use64bitall=''
1235use64bitint=''
1236dtrace=''
1237usedtrace=''
1238usefaststdio=''
1239usekernprocpathname=''
1240ccflags_uselargefiles=''
1241ldflags_uselargefiles=''
1242libswanted_uselargefiles=''
1243uselargefiles=''
1244uselongdouble=''
1245usemorebits=''
1246usemultiplicity=''
1247nm_opt=''
1248nm_so_opt=''
1249runnm=''
1250usenm=''
1251usensgetexecutablepath=''
1252useperlio=''
1253usesocks=''
1254d_oldpthreads=''
1255use5005threads=''
1256useithreads=''
1257usereentrant=''
1258usethreads=''
1259incpath=''
1260mips_type=''
1261usrinc=''
1262vaproto=''
1263d_vendorarch=''
1264installvendorarch=''
1265vendorarch=''
1266vendorarchexp=''
1267d_vendorbin=''
1268installvendorbin=''
1269vendorbin=''
1270vendorbinexp=''
1271installvendorhtml1dir=''
1272vendorhtml1dir=''
1273vendorhtml1direxp=''
1274installvendorhtml3dir=''
1275vendorhtml3dir=''
1276vendorhtml3direxp=''
1277d_vendorlib=''
1278installvendorlib=''
1279vendorlib=''
1280vendorlib_stem=''
1281vendorlibexp=''
1282installvendorman1dir=''
1283vendorman1dir=''
1284vendorman1direxp=''
1285installvendorman3dir=''
1286vendorman3dir=''
1287vendorman3direxp=''
1288usevendorprefix=''
1289vendorprefix=''
1290vendorprefixexp=''
1291d_vendorscript=''
1292installvendorscript=''
1293vendorscript=''
1294vendorscriptexp=''
1295versiononly=''
1296yacc=''
1297yaccflags=''
1298CONFIG=''
1299
1300: Detect odd OSs
1301define='define'
1302undef='undef'
1303smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1304rmlist=''
1305
1306: We must find out about Eunice early
1307eunicefix=':'
1308if test -f /etc/unixtovms; then
1309	eunicefix=/etc/unixtovms
1310fi
1311if test -f /etc/unixtovms.exe; then
1312	eunicefix=/etc/unixtovms.exe
1313fi
1314
1315: Set executable suffix now -- needed before hints available
1316if test -f "/libs/version.library"; then
1317: Amiga OS
1318    _exe=""
1319elif test -f "/system/gnu_library/bin/ar.pm"; then
1320: Stratus VOS
1321    _exe=".pm"
1322elif test -n "$DJGPP"; then
1323: DOS DJGPP
1324    _exe=".exe"
1325elif test -f /kern/cookiejar; then
1326: MiNT
1327    _exe=""
1328elif test -d c:/. -o -n "$is_os2" ; then
1329: OS/2 or cygwin
1330    _exe=".exe"
1331fi
1332
1333groupstype=''
1334i_whoami=''
1335: Trailing extension.  Override this in a hint file, if needed.
1336: Extra object files, if any, needed on this platform.
1337archobjs=''
1338archname=''
1339: Possible local include directories to search.
1340: Set locincpth to "" in a hint file to defeat local include searches.
1341locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343:
1344: no include file wanted by default
1345inclwanted=''
1346
1347: Enable -DEBUGGING and -DDEBUGGING from the command line
1348EBUGGING=''
1349DEBUGGING=''
1350
1351libnames=''
1352: change the next line if compiling for Xenix/286 on Xenix/386
1353xlibpth='/usr/lib/386 /lib/386'
1354: Possible local library directories to search.
1355loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1356loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1357
1358: general looking path for locating libraries
1359glibpth="/lib /usr/lib $xlibpth"
1360glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1361test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1362test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1363test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1364
1365: Private path used by Configure to find libraries.  Its value
1366: is prepended to libpth. This variable takes care of special
1367: machines, like the mips.  Usually, it should be empty.
1368plibpth=''
1369
1370: default library list
1371libswanted=''
1372: some systems want to use only the non-versioned libso:s
1373ignore_versioned_solibs=''
1374: set usethreads on the Configure command line to enable threads.
1375usereentrant='undef'
1376ccname=''
1377ccversion=''
1378perllibs=''
1379: set useposix=false in your hint file to disable the POSIX extension.
1380useposix=true
1381: set useopcode=false in your hint file to disable the Opcode extension.
1382useopcode=true
1383archname64=''
1384ccflags_uselargefiles=''
1385ldflags_uselargefiles=''
1386libswanted_uselargefiles=''
1387: set usemultiplicity on the Configure command line to enable multiplicity.
1388: set usesocks on the Configure command line to enable socks.
1389: List of libraries we want.
1390: If anyone needs extra -lxxx, put those in a hint file.
1391libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1392libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1393: We probably want to search /usr/shlib before most other libraries.
1394: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1395glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1396glibpth="/usr/shlib $glibpth"
1397: Do not use vfork unless overridden by a hint file.
1398usevfork=false
1399
1400: Find the basic shell for Bourne shell scripts
1401case "$sh" in
1402'')
1403	case "$SYSTYPE" in
1404	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1405	*) xxx='/bin/sh';;
1406	esac
1407	if test -f "$xxx"; then
1408		sh="$xxx"
1409	else
1410		: Build up a list and do a single loop so we can 'break' out.
1411		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1412		for xxx in sh bash ksh pdksh ash; do
1413			for p in $pth; do
1414				try="$try ${p}/${xxx}"
1415			done
1416		done
1417		for xxx in $try; do
1418			if test -f "$xxx"; then
1419				sh="$xxx";
1420				break
1421			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1422				sh="$xxx";
1423				break
1424			elif test -f "$xxx.exe"; then
1425				sh="$xxx";
1426				break
1427			fi
1428		done
1429	fi
1430	;;
1431esac
1432
1433case "$sh" in
1434'')	cat >&2 <<EOM
1435$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1436
1437Usually it's in /bin/sh.  How did you even get this far?
1438Please contact me (Perl Maintainers) at perlbug@perl.org and
1439we'll try to straighten this all out.
1440EOM
1441	exit 1
1442	;;
1443esac
1444
1445: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1446: default both to the same thing, cross-compilers can then set targetsh differently if they like
1447targetsh=$sh
1448
1449: see if sh knows # comments
1450if `$sh -c '#' >/dev/null 2>&1`; then
1451	shsharp=true
1452	spitshell=cat
1453	xcat=/bin/cat
1454	test -f $xcat$_exe || xcat=/usr/bin/cat
1455	if test ! -f $xcat$_exe; then
1456		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1457			if test -f $p/cat$_exe; then
1458				xcat=$p/cat
1459				break
1460			fi
1461		done
1462		if test ! -f $xcat$_exe; then
1463			echo "Can't find cat anywhere!"
1464			exit 1
1465		fi
1466	fi
1467	echo "#!$xcat" >sharp
1468	$eunicefix sharp
1469	chmod +x sharp
1470	./sharp > today 2>/dev/null
1471	if test -s today; then
1472		sharpbang='#!'
1473	else
1474		echo "#! $xcat" > sharp
1475		$eunicefix sharp
1476		chmod +x sharp
1477		./sharp > today 2>/dev/null
1478		if test -s today; then
1479			sharpbang='#! '
1480		else
1481			sharpbang=': use '
1482		fi
1483	fi
1484else
1485	echo " "
1486	echo "Your $sh doesn't grok # comments--I will strip them later on."
1487	shsharp=false
1488	cd ..
1489	echo "exec grep -v '^[ 	]*#'" >spitshell
1490	chmod +x spitshell
1491	$eunicefix spitshell
1492	spitshell=`pwd`/spitshell
1493	cd UU
1494	echo "I presume that if # doesn't work, #! won't work either!"
1495	sharpbang=': use '
1496fi
1497rm -f sharp today
1498
1499: figure out how to guarantee sh startup
1500case "$startsh" in
1501'') startsh=${sharpbang}${sh} ;;
1502*)
1503esac
1504cat >sharp <<EOSS
1505$startsh
1506set abc
1507test "$?abc" != 1
1508EOSS
1509
1510chmod +x sharp
1511$eunicefix sharp
1512if ./sharp; then
1513	: echo "Yup, it does."
1514else
1515	echo "Hmm... '$startsh' does not guarantee sh startup..."
1516	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1517fi
1518rm -f sharp
1519
1520: Save command line options in file UU/cmdline.opt for later use in
1521: generating config.sh.
1522cat > cmdline.opt <<EOSH
1523: Configure command line arguments.
1524config_arg0='$0'
1525config_args='$*'
1526config_argc=$#
1527EOSH
1528argn=1
1529args_exp=''
1530args_sep=''
1531for arg in "$@"; do
1532	cat >>cmdline.opt <<EOSH
1533config_arg$argn='$arg'
1534EOSH
1535	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1536$arg
1537EOC
1538	arg_exp=`cat cmdl.opt`
1539	args_exp="$args_exp$args_sep'$arg_exp'"
1540	argn=`expr $argn + 1`
1541	args_sep=' '
1542done
1543rm -f cmdl.opt
1544
1545: produce awk script to parse command line options
1546cat >options.awk <<'EOF'
1547BEGIN {
1548	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1549
1550	len = length(optstr);
1551	for (i = 1; i <= len; i++) {
1552		c = substr(optstr, i, 1);
1553		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1554		if (a == ":") {
1555			arg[c] = 1;
1556			i++;
1557		}
1558		opt[c] = 1;
1559	}
1560}
1561{
1562	expect = 0;
1563	str = $0;
1564	if (substr(str, 1, 1) != "-") {
1565		printf("'%s'\n", str);
1566		next;
1567	}
1568	len = length($0);
1569	for (i = 2; i <= len; i++) {
1570		c = substr(str, i, 1);
1571		if (!opt[c]) {
1572			printf("-%s\n", substr(str, i));
1573			next;
1574		}
1575		printf("-%s\n", c);
1576		if (arg[c]) {
1577			if (i < len)
1578				printf("'%s'\n", substr(str, i + 1));
1579			else
1580				expect = 1;
1581			next;
1582		}
1583	}
1584}
1585END {
1586	if (expect)
1587		print "?";
1588}
1589EOF
1590
1591: process the command line options
1592set X `for arg in "$@"; do echo "X$arg"; done |
1593	sed -e s/X// | awk -f options.awk`
1594eval "set $*"
1595shift
1596rm -f options.awk
1597
1598: set up default values
1599fastread=''
1600reuseval=false
1601config_sh=''
1602alldone=''
1603error=''
1604silent=''
1605extractsh=''
1606override=''
1607knowitall=''
1608rm -f optdef.sh posthint.sh
1609cat >optdef.sh <<EOS
1610$startsh
1611EOS
1612
1613
1614: option parsing
1615while test $# -gt 0; do
1616	case "$1" in
1617	-d) shift; fastread=yes;;
1618	-e) shift; alldone=cont;;
1619	-f)
1620		shift
1621		cd ..
1622		if test -r "$1"; then
1623			config_sh="$1"
1624		else
1625			echo "$me: cannot read config file $1." >&2
1626			error=true
1627		fi
1628		cd UU
1629		shift;;
1630	--help|\
1631	-h) shift; error=true;;
1632	-r) shift; reuseval=true;;
1633	-s) shift; silent=true; realsilent=true;;
1634	-E) shift; alldone=exit;;
1635	-K) shift; knowitall=true;;
1636	-O) shift; override=true;;
1637	-S) shift; silent=true; extractsh=true;;
1638	-D)
1639		shift
1640		case "$1" in
1641		*=)
1642			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1643			echo "$me: ignoring -D $1" >&2
1644			;;
1645		*=*) echo "$1" | \
1646				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1647		*) echo "$1='define'" >> optdef.sh;;
1648		esac
1649		shift
1650		;;
1651	-U)
1652		shift
1653		case "$1" in
1654		*=) echo "$1" >> optdef.sh;;
1655		*=*)
1656			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1657			echo "$me: ignoring -U $1" >&2
1658			;;
1659		*) echo "$1='undef'" >> optdef.sh;;
1660		esac
1661		shift
1662		;;
1663	-A)
1664	    shift
1665	    xxx=''
1666	    yyy="$1"
1667	    zzz=''
1668	    uuu=undef
1669	    case "$yyy" in
1670            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1671                 case "$zzz" in
1672                 *:*) zzz='' ;;
1673                 *)   xxx=append
1674                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1675                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1676                 esac
1677                 ;;
1678            esac
1679            case "$xxx" in
1680            '')  case "$yyy" in
1681                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1682                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1683                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1684                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1685                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1686                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1687                 esac
1688                 ;;
1689            esac
1690	    case "$xxx" in
1691	    append)
1692		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1693	    clear)
1694		echo "$yyy=''"			>> posthint.sh ;;
1695	    define)
1696	        case "$zzz" in
1697		'') zzz=define ;;
1698		esac
1699		echo "$yyy='$zzz'"		>> posthint.sh ;;
1700	    eval)
1701		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1702	    prepend)
1703		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1704	    undef)
1705	        case "$zzz" in
1706		'') zzz="$uuu" ;;
1707		esac
1708		echo "$yyy=$zzz"		>> posthint.sh ;;
1709            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1710	    esac
1711	    shift
1712	    ;;
1713	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1714	    exit 0;;
1715	--) break;;
1716	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1717	*) break;;
1718	esac
1719done
1720
1721case "$error" in
1722true)
1723	cat >&2 <<EOM
1724Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1725                 [-U symbol] [-U symbol=] [-A command:symbol...]
1726  -d : use defaults for all answers.
1727  -e : go on without questioning past the production of config.sh.
1728  -f : specify an alternate default configuration file.
1729  -h : print this help message and exit (with an error status).
1730  -r : reuse C symbols value if possible (skips costly nm extraction).
1731  -s : silent mode, only echoes questions and essential information.
1732  -D : define symbol to have some value:
1733         -D symbol         symbol gets the value 'define'
1734         -D symbol=value   symbol gets the value 'value'
1735       common used examples (see INSTALL for more info):
1736         -Duse64bitint            use 64bit integers
1737         -Duse64bitall            use 64bit integers and pointers
1738         -Dusethreads             use thread support
1739         -Dinc_version_list=none  do not include older perl trees in @INC
1740         -DEBUGGING=none          DEBUGGING options
1741         -Dcc=gcc                 choose your compiler
1742         -Dprefix=/opt/perl5      choose your destination
1743  -E : stop at the end of questions, after having produced config.sh.
1744  -K : do not use unless you know what you are doing.
1745  -O : let -D and -U override definitions from loaded configuration file.
1746  -S : perform variable substitutions on all .SH files (can mix with -f)
1747  -U : undefine symbol:
1748         -U symbol    symbol gets the value 'undef'
1749         -U symbol=   symbol gets completely empty
1750       e.g.:  -Uversiononly
1751  -A : manipulate symbol after the platform specific hints have been applied:
1752         -A append:symbol=value   append value to symbol
1753         -A symbol=value          like append:, but with a separating space
1754         -A define:symbol=value   define symbol to have value
1755         -A clear:symbol          define symbol to be ''
1756         -A define:symbol         define symbol to be 'define'
1757         -A eval:symbol=value     define symbol to be eval of value
1758         -A prepend:symbol=value  prepend value to symbol
1759         -A undef:symbol          define symbol to be 'undef'
1760         -A undef:symbol=         define symbol to be ''
1761       e.g.:  -A prepend:libswanted='cl pthread '
1762              -A ccflags=-DSOME_MACRO
1763  -V : print version number and exit (with a zero status).
1764EOM
1765	exit 1
1766	;;
1767esac
1768
1769: Sanity checks
1770case "$fastread$alldone" in
1771yescont|yesexit) ;;
1772*)
1773	case "$extractsh" in
1774	true) ;;
1775	*)
1776		if test ! -t 0; then
1777			echo "Say 'sh Configure', not 'sh <Configure'"
1778			exit 1
1779		fi
1780		;;
1781	esac
1782	;;
1783esac
1784
1785exec 4>&1
1786case "$silent" in
1787true) exec 1>/dev/null;;
1788esac
1789
1790: run the defines and the undefines, if any, but leave the file out there...
1791touch optdef.sh
1792. ./optdef.sh
1793: create the posthint manipulation script and leave the file out there...
1794touch posthint.sh
1795
1796: set package name
1797package='perl5'
1798first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1799last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1800case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1801ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1802*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1803esac
1804
1805: Some greps do not return status, grrr.
1806echo "grimblepritz" >grimble
1807if grep blurfldyick grimble >/dev/null 2>&1 ; then
1808	contains=contains
1809elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1810	contains=grep
1811else
1812	contains=contains
1813fi
1814rm -f grimble
1815: the following should work in any shell
1816case "$contains" in
1817contains*)
1818	echo " "
1819	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1820	cat >contains <<'EOSS'
1821grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1822EOSS
1823chmod +x contains
1824esac
1825
1826: Find the path to the source tree
1827case "$src" in
1828'') case "$0" in
1829    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1830         case "$src" in
1831	 /*)	;;
1832	 .)	;;
1833         *)	src=`cd ../$src && pwd` ;;
1834	 esac
1835         ;;
1836    *)   src='.';;
1837    esac;;
1838esac
1839case "$src" in
1840'')	src=/
1841	rsrc=/
1842	;;
1843/*)	rsrc="$src";;
1844*)	rsrc="../$src";;
1845esac
1846if test -f $rsrc/Configure && \
1847	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1848then
1849   : found it, so we are ok.
1850else
1851	rsrc=''
1852	for src in . .. ../.. ../../.. ../../../..; do
1853		if test -f ../$src/Configure && \
1854			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1855		then
1856			rsrc=../$src
1857			break
1858		fi
1859	done
1860fi
1861case "$rsrc" in
1862'')
1863	cat <<EOM >&4
1864
1865Sorry, I can't seem to locate the source dir for $package.  Please start
1866Configure with an explicit path -- i.e. /some/path/Configure.
1867
1868EOM
1869	exit 1
1870	;;
1871../.)	rsrc='..';;
1872*)
1873	echo " "
1874	echo "Sources for $package found in \"$src\"." >&4
1875	;;
1876esac
1877
1878: script used to extract .SH files with variable substitutions
1879cat >extract <<'EOS'
1880PERL_CONFIG_SH=true
1881echo "Doing variable substitutions on .SH files..."
1882if test -f MANIFEST; then
1883	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1884else
1885	echo "(Looking for .SH files under the source directory.)"
1886	set x `(cd "$src"; find . -name "*.SH" -print)`
1887fi
1888shift
1889case $# in
18900) set x `(cd "$src"; echo *.SH)`; shift;;
1891esac
1892if test ! -f "$src/$1"; then
1893	shift
1894fi
1895mkdir_p='
1896name=$1;
1897create="";
1898while test $name; do
1899	if test ! -d "$name"; then
1900		create="$name $create";
1901		name=`echo $name | sed -e "s|^[^/]*$||"`;
1902		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1903	else
1904		name="";
1905	fi;
1906done;
1907for file in $create; do
1908	mkdir $file;
1909done
1910'
1911for file in $*; do
1912	case "$src" in
1913	".")
1914		case "$file" in
1915		*/*)
1916			dir=`expr X$file : 'X\(.*\)/'`
1917			file=`expr X$file : 'X.*/\(.*\)'`
1918			(cd "$dir" && . ./$file)
1919			;;
1920		*)
1921			. ./$file
1922			;;
1923		esac
1924		;;
1925	*)
1926		case "$file" in
1927		*/*)
1928			dir=`expr X$file : 'X\(.*\)/'`
1929			file=`expr X$file : 'X.*/\(.*\)'`
1930			(set x $dir; shift; eval $mkdir_p)
1931			sh <"$src/$dir/$file"
1932			;;
1933		*)
1934			sh <"$src/$file"
1935			;;
1936		esac
1937		;;
1938	esac
1939done
1940if test -f "$src/config_h.SH"; then
1941	if test ! -f config.h; then
1942	: oops, they left it out of MANIFEST, probably, so do it anyway.
1943	. "$src/config_h.SH"
1944	fi
1945fi
1946EOS
1947
1948: extract files and exit if asked to do so
1949case "$extractsh" in
1950true)
1951	case "$realsilent" in
1952	true) ;;
1953	*) exec 1>&4;;
1954	esac
1955	case "$config_sh" in
1956	'') config_sh='config.sh';;
1957	esac
1958	echo " "
1959	echo "Fetching answers from $config_sh..."
1960	cd ..
1961	. $config_sh
1962	test "$override" && . ./optdef.sh
1963	echo " "
1964	. UU/extract
1965	rm -rf UU
1966	echo "Extraction done."
1967	exit 0
1968	;;
1969esac
1970
1971: Eunice requires " " instead of "", can you believe it
1972echo " "
1973: Here we go...
1974echo "Beginning of configuration questions for $package."
1975
1976trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1977
1978: first determine how to suppress newline on echo command
1979echo " "
1980echo "Checking echo to see how to suppress newlines..."
1981(echo "hi there\c" ; echo " ") >.echotmp
1982if $contains c .echotmp >/dev/null 2>&1 ; then
1983	echo "...using -n."
1984	n='-n'
1985	c=''
1986else
1987	cat <<'EOM'
1988...using \c
1989EOM
1990	n=''
1991	c='\c'
1992fi
1993echo $n "The star should be here-->$c"
1994echo '*'
1995rm -f .echotmp
1996
1997: Now test for existence of everything in MANIFEST
1998echo " "
1999if test -f "$rsrc/MANIFEST"; then
2000	echo "First let's make sure your kit is complete.  Checking..." >&4
2001	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2002		(split -l 50 2>/dev/null || split -50)
2003	rm -f missing
2004	tmppwd=`pwd`
2005	for filelist in x??; do
2006		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2007			>/dev/null 2>>"$tmppwd/missing")
2008	done
2009	if test -s missing; then
2010		cat missing >&4
2011		cat >&4 <<'EOM'
2012
2013THIS PACKAGE SEEMS TO BE INCOMPLETE.
2014
2015You have the option of continuing the configuration process, despite the
2016distinct possibility that your kit is damaged, by typing 'y'es.  If you
2017do, don't blame me if something goes wrong.  I advise you to type 'n'o
2018and contact the author (perlbug@perl.org).
2019
2020EOM
2021		echo $n "Continue? [n] $c" >&4
2022		read ans
2023		case "$ans" in
2024		y*)
2025			echo "Continuing..." >&4
2026			rm -f missing
2027			;;
2028		*)
2029			echo "ABORTING..." >&4
2030			kill $$
2031			;;
2032		esac
2033	else
2034		echo "Looks good..."
2035	fi
2036else
2037	echo "There is no MANIFEST file.  I hope your kit is complete !"
2038fi
2039rm -f missing x??
2040
2041: Find the appropriate value for a newline for tr
2042echo " "
2043if test -n "$DJGPP"; then
2044       trnl='\012'
2045fi
2046if test X"$trnl" = X; then
2047	case "`echo foo|tr '\n' x 2>/dev/null`" in
2048	foox) trnl='\n' ;;
2049	esac
2050fi
2051if test X"$trnl" = X; then
2052	case "`echo foo|tr '\012' x 2>/dev/null`" in
2053	foox) trnl='\012' ;;
2054	esac
2055fi
2056if test X"$trnl" = X; then
2057       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2058       fooxy) trnl='\n\r' ;;
2059       esac
2060fi
2061if test X"$trnl" = X; then
2062	cat <<EOM >&2
2063
2064$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2065
2066EOM
2067	exit 1
2068fi
2069
2070: compute the number of columns on the terminal for proper question formatting
2071case "$COLUMNS" in
2072'') COLUMNS='80';;
2073esac
2074
2075: set up the echo used in my read
2076myecho="case \"\$xxxm\" in
2077'') echo $n \"\$rp $c\" >&4;;
2078*) case \"\$rp\" in
2079	'') echo $n \"[\$xxxm] $c\";;
2080	*)
2081		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2082			echo \"\$rp\" >&4
2083			echo $n \"[\$xxxm] $c\" >&4
2084		else
2085			echo $n \"\$rp [\$xxxm] $c\" >&4
2086		fi
2087		;;
2088	esac;;
2089esac"
2090
2091: now set up to do reads with possible shell escape and default assignment
2092cat <<EOSC >myread
2093$startsh
2094xxxm=\$dflt
2095$myecho
2096ans='!'
2097case "\$fastread" in
2098yes) case "\$dflt" in
2099	'') ;;
2100	*) ans='';
2101		case "\$silent-\$rp" in
2102		true-) ;;
2103		*) echo " " >&4;;
2104		esac;;
2105	esac;;
2106*) case "\$silent" in
2107	true) case "\$rp" in
2108		'') ans='';;
2109		esac;;
2110	esac;;
2111esac
2112while expr "X\$ans" : "X!" >/dev/null; do
2113	read answ
2114	set x \$xxxm
2115	shift
2116	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2117	case  "\$answ" in
2118	"!")
2119		sh 1>&4
2120		echo " "
2121		$myecho
2122		;;
2123	!*)
2124		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2125		shift
2126		sh 1>&4 -c "\$*"
2127		echo " "
2128		$myecho
2129		;;
2130	"\$ans")
2131		case "\$ans" in
2132		\\&*)
2133			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2134			shift
2135			case "\$1" in
2136			-d)
2137				fastread=yes
2138				echo "(OK, I'll run with -d after this question.)" >&4
2139				;;
2140			-*)
2141				echo "*** Sorry, \$1 not supported yet." >&4
2142				;;
2143			esac
2144			$myecho
2145			ans=!
2146			;;
2147		esac;;
2148	*)
2149		case "\$aok" in
2150		y)
2151			echo "*** Substitution done -- please confirm."
2152			xxxm="\$ans"
2153			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2154			xxxm="\$ans"
2155			ans=!
2156			;;
2157		*)
2158			echo "*** Error -- try again."
2159			ans=!
2160			;;
2161		esac
2162		$myecho
2163		;;
2164	esac
2165	case "\$ans\$xxxm\$nostick" in
2166	'')
2167		ans=!
2168		$myecho
2169		;;
2170	esac
2171done
2172case "\$ans" in
2173'') ans="\$xxxm";;
2174esac
2175EOSC
2176
2177: create .config dir to save info across Configure sessions
2178test -d ../.config || mkdir ../.config
2179cat >../.config/README <<EOF
2180This directory created by Configure to save information that should
2181persist across sessions for $package.
2182
2183You may safely delete it if you wish.
2184EOF
2185
2186: See if we are using a devel version and want that
2187xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2188case "$usedevel" in
2189$define|true|[yY]*)
2190    usedevel="$define" ;;
2191*) case "$xversion" in
2192   *[13579])
2193	cat >&4 <<EOH
2194*** WHOA THERE!!! ***
2195
2196    This is an UNSTABLE DEVELOPMENT release.
2197    The version of this $package distribution is $xversion, that is, odd,
2198    (as opposed to even) and that signifies a development release.
2199    If you want a maintenance release, you want an even-numbered version.
2200
2201    Do ***NOT*** install this into production use.
2202    Data corruption and crashes are possible.
2203
2204    It is most seriously suggested that you do not continue any further
2205    unless you want to help in developing and debugging Perl.
2206
2207    If you *still* want to build perl, you can answer 'y' now,
2208    or pass -Dusedevel to Configure.
2209
2210EOH
2211	rp='Do you really want to continue?'
2212	dflt='n'
2213	. ./myread
2214	case "$ans" in
2215	[yY]) echo >&4 "Okay, continuing."
2216	      usedevel="$define" ;;
2217	*) echo >&4 "Okay, bye."
2218	   exit 1
2219	   ;;
2220	esac
2221	;;
2222    esac
2223    usedevel="$undef"
2224    ;;
2225esac
2226case "$usedevel" in
2227$define|true|[yY]*)
2228	case "$versiononly" in
2229	'') versiononly="$define" ;;
2230	esac
2231	case "$installusrbinperl" in
2232	'') installusrbinperl="$undef" ;;
2233	esac
2234	;;
2235esac
2236
2237: general instructions
2238needman=true
2239firsttime=true
2240user=`(logname) 2>/dev/null`
2241case "$user" in
2242'') user=`whoami 2>&1`;;
2243esac
2244if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2245	firsttime=false
2246	echo " "
2247	rp='Would you like to see the instructions?'
2248	dflt=n
2249	. ./myread
2250	case "$ans" in
2251	[yY]*) ;;
2252	*) needman=false;;
2253	esac
2254fi
2255if $needman; then
2256	cat <<EOH
2257
2258This installation shell script will examine your system and ask you questions
2259to determine how the perl5 package should be installed. If you get
2260stuck on a question, you may use a ! shell escape to start a subshell or
2261execute a command.  Many of the questions will have default answers in square
2262brackets; typing carriage return will give you the default.
2263
2264On some of the questions which ask for file or directory names you are allowed
2265to use the ~name construct to specify the login directory belonging to "name",
2266even if you don't have a shell which knows about that.  Questions where this is
2267allowed will be marked "(~name ok)".
2268
2269EOH
2270	rp=''
2271	dflt='Type carriage return to continue'
2272	. ./myread
2273	cat <<'EOH'
2274
2275The prompter used in this script allows you to use shell variables and
2276backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2277in the default answer, as if the default line was a set of arguments given to a
2278script shell.  This means you may also use $* to repeat the whole default line,
2279so you do not have to re-type everything to add something to the default.
2280
2281Every time there is a substitution, you will have to confirm.  If there is an
2282error (e.g. an unmatched backtick), the default answer will remain unchanged
2283and you will be prompted again.
2284
2285If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2286the questions and use the computed defaults (or the previous answers if there
2287was already a config.sh file). Type 'Configure -h' for a list of options.
2288You may also start interactively and then answer '& -d' at any prompt to turn
2289on the non-interactive behaviour for the remainder of the execution.
2290
2291EOH
2292	. ./myread
2293	cat <<EOH
2294
2295Much effort has been expended to ensure that this shell script will run on any
2296Unix system.  If despite that it blows up on yours, your best bet is to edit
2297Configure and run it again.  If you can't run Configure for some reason,
2298you'll have to generate a config.sh file by hand.  Whatever problems you
2299have, let me (perlbug@perl.org) know how I blew it.
2300
2301This installation script affects things in two ways:
2302
23031) it may do direct variable substitutions on some of the files included
2304   in this kit.
23052) it builds a config.h file for inclusion in C programs.  You may edit
2306   any of these files as the need arises after running this script.
2307
2308If you make a mistake on a question, there is no easy way to back up to it
2309currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2310files.  Configure will offer to let you do this before it runs the SH files.
2311
2312EOH
2313	dflt='Type carriage return to continue'
2314	. ./myread
2315	case "$firsttime" in
2316	true) echo $user >>../.config/instruct;;
2317	esac
2318fi
2319
2320: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2321: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2322if test "X$sysroot" = X; then
2323    sysroot=""
2324else
2325    case "$cc" in
2326	*gcc*|*g++*)
2327	    echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2328	    # _sysroot is used in places where we need --sysroot=foo
2329	    # but using the rest of the flags could cause issues.
2330	    _sysroot="--sysroot=$sysroot";
2331	    case "$ccflags" in
2332		*sysroot*) ;;
2333		'undef'|*)
2334		ccflags="$ccflags $_sysroot"
2335	    esac
2336	    case "$ldflags" in
2337		*sysroot*) ;;
2338		'undef'|*)
2339		ldflags="$ldflags $_sysroot"
2340	    esac
2341	    case "$cppflags" in
2342		*sysroot*) ;;
2343		'undef'|*)
2344		cppflags="$cppflags $_sysroot"
2345	    esac
2346	    # lddlflags updated below in lddlflags section;
2347	    # same with cccdlflags
2348	    ;;
2349    esac
2350
2351    # Adjust some defaults to also use $sysroot
2352    for var in xlibpth loclibpth locincpth glibpth; do
2353	eval xxx=\$$var
2354	eval $var=''
2355	for path in $xxx; do
2356	    eval $var=\"\$$var $sysroot$path\"
2357	done
2358    done
2359
2360fi
2361
2362: find out where common programs are
2363echo " "
2364echo "Locating common programs..." >&4
2365cat <<EOSC >loc
2366$startsh
2367case \$# in
23680) exit 1;;
2369esac
2370thing=\$1
2371shift
2372dflt=\$1
2373shift
2374for dir in \$*; do
2375	case "\$thing" in
2376	.)
2377	if test -d \$dir/\$thing; then
2378		echo \$dir
2379		exit 0
2380	fi
2381	;;
2382	*)
2383	for thisthing in \$dir/\$thing; do
2384		: just loop through to pick last item
2385	done
2386	if test -f \$thisthing; then
2387		echo \$thisthing
2388		exit 0
2389	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2390		echo \$thisthing
2391		exit 0
2392	elif test -f \$dir/\$thing.exe; then
2393		if test -n "$DJGPP"; then
2394			echo \$dir/\$thing.exe
2395		elif test "$eunicefix" != ":"; then
2396			: on Eunice apparently
2397			echo \$dir/\$thing
2398		fi
2399		exit 0
2400	fi
2401	;;
2402	esac
2403done
2404echo \$dflt
2405exit 1
2406EOSC
2407chmod +x loc
2408$eunicefix loc
2409loclist="
2410awk
2411cat
2412chmod
2413comm
2414cp
2415echo
2416expr
2417grep
2418ls
2419mkdir
2420rm
2421sed
2422sort
2423touch
2424tr
2425uniq
2426"
2427trylist="
2428ar
2429bison
2430byacc
2431cpp
2432csh
2433date
2434egrep
2435gmake
2436gzip
2437less
2438ln
2439make
2440more
2441nm
2442nroff
2443perl
2444pg
2445test
2446uname
2447zip
2448"
2449pth=`echo $PATH | sed -e "s/$p_/ /g"`
2450pth="$pth $sysroot/lib $sysroot/usr/lib"
2451for file in $loclist; do
2452	eval xxx=\$$file
2453	case "$xxx" in
2454	/*|?:[\\/]*)
2455		if test -f "$xxx"; then
2456			: ok
2457		else
2458			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2459			xxx=`./loc $file $file $pth`
2460		fi
2461		;;
2462	'') xxx=`./loc $file $file $pth`;;
2463	*) xxx=`./loc $xxx $xxx $pth`;;
2464	esac
2465	eval $file=$xxx$_exe
2466	eval _$file=$xxx
2467	case "$xxx" in
2468	/*)
2469		echo $file is in $xxx.
2470		;;
2471	?:[\\/]*)
2472		echo $file is in $xxx.
2473		;;
2474	*)
2475		echo "I don't know where '$file' is, and my life depends on it." >&4
2476		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2477		exit 1
2478		;;
2479	esac
2480done
2481echo " "
2482echo "Don't worry if any of the following aren't found..."
2483say=offhand
2484for file in $trylist; do
2485	eval xxx=\$$file
2486	case "$xxx" in
2487	/*|?:[\\/]*)
2488		if test -f "$xxx"; then
2489			: ok
2490		else
2491			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2492			xxx=`./loc $file $file $pth`
2493		fi
2494		;;
2495	'') xxx=`./loc $file $file $pth`;;
2496	*) xxx=`./loc $xxx $xxx $pth`;;
2497	esac
2498	eval $file=$xxx$_exe
2499	eval _$file=$xxx
2500	case "$xxx" in
2501	/*)
2502		echo $file is in $xxx.
2503		;;
2504	?:[\\/]*)
2505		echo $file is in $xxx.
2506		;;
2507	*)
2508		echo "I don't see $file out there, $say."
2509		say=either
2510		;;
2511	esac
2512done
2513case "$egrep" in
2514egrep)
2515	echo "Substituting grep for egrep."
2516	egrep=$grep
2517	_egrep=$grep
2518	;;
2519esac
2520case "$less" in
2521'')	;;
2522*)	if $less -R </dev/null >/dev/null 2>&1; then
2523	       echo "Substituting less -R for less."
2524	       less="$less -R"
2525	       _less=$less
2526	fi
2527	;;
2528esac
2529case "$ln" in
2530ln)
2531	echo "Substituting cp for ln."
2532	ln=$cp
2533	_ln=$cp
2534	;;
2535esac
2536case "$make" in
2537make)
2538	case "$gmake" in
2539	gmake)
2540	echo "I can't find make or gmake, and my life depends on it." >&4
2541	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2542	exit 1
2543	;;
2544	esac
2545	;;
2546esac
2547case "$gmake" in
2548gmake)	;;
2549*)	# We can't have osname yet.
2550	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2551		# Assume that gmake, if found, is definitely GNU make
2552		# and prefer it over the system make.
2553		echo "Substituting gmake for make."
2554		make=$gmake
2555		_make=$gmake
2556	fi
2557	;;
2558esac
2559case "$test" in
2560test)
2561	echo "Hopefully test is built into your sh."
2562	;;
2563*)
2564	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2565		echo "Using the test built into your sh."
2566		test=test
2567		_test=test
2568	fi
2569	;;
2570esac
2571case "$echo" in
2572echo)
2573	echo "Hopefully echo is built into your sh."
2574	;;
2575'') ;;
2576*)
2577	echo " "
2578echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2579	$echo $n "hi there$c" >foo1
2580	echo $n "hi there$c" >foo2
2581	if cmp foo1 foo2 >/dev/null 2>&1; then
2582		echo "They are compatible.  In fact, they may be identical."
2583	else
2584		case "$n" in
2585		'-n') n='' c='\c';;
2586		*) n='-n' c='';;
2587		esac
2588		cat <<FOO
2589They are not compatible!  You are probably running ksh on a non-USG system.
2590I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2591have echo built in and we may have to run some Bourne shell scripts.  That
2592means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2593
2594FOO
2595		$echo $n "The star should be here-->$c"
2596		$echo "*"
2597	fi
2598	$rm -f foo1 foo2
2599	;;
2600esac
2601
2602# This question was auctioned at YAPC::Europe-2007 in Vienna
2603# I never promised you could answer it. I only auctioned the question.
2604cat <<FOO
2605The following message is sponsored by
2606
2607  Dresden.pm<--The stars should be here.
2608
2609Dear Perl user, system administrator or package
2610maintainer, the Perl community sends greetings to
2611you. Do you (emblematical) greet back [Y/n]? n
2612
2613FOO
2614
2615: Check what type of C compiler we use
2616cat <<EOS >trygcc
2617$startsh
2618EOS
2619cat <<'EOSC' >>trygcc
2620case "$cc" in
2621'') ;;
2622*)  $rm -f try try.*
2623    $cat >try.c <<EOM
2624int main(int argc, char *argv[]) {
2625  return 0;
2626}
2627EOM
2628    if $cc -o try $ccflags $ldflags try.c; then
2629       :
2630    else
2631        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2632        despair=yes
2633        trygcc=yes
2634        case "$cc" in
2635        *gcc*) trygcc=no ;;
2636        esac
2637	# Skip this test because it gives a false match on output like:
2638	#    ./trygcc: line 23: cc: command not found
2639        # case "`$cc -v -c try.c 2>&1`" in
2640        # *gcc*) trygcc=no ;;
2641        # esac
2642        if $test X"$trygcc" = Xyes; then
2643            if gcc -o try -c try.c; then
2644                echo " "
2645                echo "You seem to have a working gcc, though." >&4
2646		# Switching compilers may undo the work of hints files.
2647		# The most common problem is -D_REENTRANT for threads.
2648		# This heuristic catches that case, but gets false positives
2649		# if -Dusethreads was not actually specified.  Better to
2650		# bail out here with a useful message than fail
2651		# mysteriously later. Should we perhaps just try to
2652		# re-invoke Configure -Dcc=gcc config_args ?
2653		if $test -f usethreads.cbu; then
2654			$cat >&4 <<EOM 
2655
2656*** However, any setting of the C compiler flags (e.g. for thread support)
2657*** will be lost.  It may be necessary for you to restart Configure and
2658*** add -Dcc=gcc to your Configure command line.
2659
2660EOM
2661			rp="Would you like to go ahead and try gcc anyway?"
2662			dflt=n
2663		else
2664			rp="Would you like to use it?"
2665			dflt=y
2666		fi
2667                if $test -f myread; then
2668                    . ./myread
2669                else
2670                    if $test -f UU/myread; then
2671                        . ./UU/myread
2672                    else
2673                        echo "Cannot find myread, sorry.  Aborting." >&2
2674                        exit 1
2675                    fi
2676                fi
2677                case "$ans" in
2678                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2679                esac
2680            fi
2681        fi
2682    fi
2683    $rm -f try try.*
2684    ;;
2685esac
2686EOSC
2687
2688cat <<EOS >checkcc
2689$startsh
2690EOS
2691cat <<'EOSC' >>checkcc
2692case "$cc" in
2693'') ;;
2694*)  $rm -f try try.*
2695    $cat >try.c <<EOM
2696int main(int argc, char *argv[]) {
2697  return 0;
2698}
2699EOM
2700    if $cc -o try $ccflags $ldflags try.c; then
2701       :
2702    else
2703        if $test X"$despair" = Xyes; then
2704           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2705        fi
2706        $cat >&4 <<EOM         
2707You need to find a working C compiler.
2708Either (purchase and) install the C compiler supplied by your OS vendor,
2709or for a free C compiler try http://gcc.gnu.org/
2710I cannot continue any further, aborting.
2711EOM
2712        exit 1
2713    fi
2714    $rm -f try try.*
2715    ;;
2716esac
2717EOSC
2718
2719: determine whether symbolic links are supported
2720echo " "
2721$touch blurfl
2722if $ln -s blurfl sym > /dev/null 2>&1 ; then
2723	echo "Symbolic links are supported." >&4
2724	lns="$ln -s"
2725else
2726	echo "Symbolic links are NOT supported." >&4
2727	lns="$ln"
2728fi
2729$rm -f blurfl sym
2730
2731: determine whether symbolic links are supported
2732echo " "
2733case "$lns" in
2734*"ln"*" -s")
2735	echo "Checking how to test for symbolic links..." >&4
2736	$lns blurfl sym
2737	if $test "X$issymlink" = X; then
2738		case "$newsh" in
2739		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2740		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2741		esac
2742		if test $? = 0; then
2743			issymlink="test -h"
2744		else
2745			echo "Your builtin 'test -h' may be broken." >&4
2746			case "$test" in
2747			/*)	;;
2748			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2749				for p in $pth
2750				do
2751					if test -f "$p/$test"; then
2752						test="$p/$test"
2753						break
2754					fi
2755				done
2756				;;
2757			esac
2758			case "$test" in
2759			/*)
2760				echo "Trying external '$test -h'." >&4
2761				issymlink="$test -h"
2762				if $test ! -h sym >/dev/null 2>&1; then
2763					echo "External '$test -h' is broken, too." >&4
2764					issymlink=''
2765				fi
2766				;;
2767			*)	issymlink='' ;;
2768			esac
2769		fi
2770	fi
2771	if $test "X$issymlink" = X; then
2772		if $test -L sym 2>/dev/null; then
2773			issymlink="$test -L"
2774			echo "The builtin '$test -L' worked." >&4
2775		fi
2776	fi
2777	if $test "X$issymlink" != X; then
2778		echo "You can test for symbolic links with '$issymlink'." >&4
2779	else
2780		echo "I do not know how you can test for symbolic links." >&4
2781	fi
2782	$rm -f blurfl sym
2783	;;
2784*)	echo "No symbolic links, so not testing for their testing..." >&4
2785	;;
2786esac
2787echo " "
2788
2789: Make symlinks util
2790case "$mksymlinks" in
2791$define|true|[yY]*)
2792	case "$src" in
2793	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2794		exit 1
2795		;;
2796	*)	case "$lns:$issymlink" in
2797		*"ln"*" -s:"*"test -"?)
2798			echo "Creating the symbolic links..." >&4
2799			cd ..
2800			awk -v src="$src" '{
2801				dir=$1;
2802				if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." }
2803				mf[dir] = mf[dir]" "src"/"$1;
2804			} END {
2805				for (d in mf) {
2806					if (d != ".") { system("mkdir -p "d) }
2807					system("ln -sf "mf[d]" "d);
2808				}
2809			}' $src/MANIFEST
2810			# Sanity check 1.
2811			if test ! -d t/base; then
2812				echo "Failed to create the subdirectories.  Aborting." >&4
2813				exit 1
2814			fi
2815			# Sanity check 2.
2816			if test ! -f t/base/lex.t; then
2817				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2818				exit 1
2819			fi
2820			if test ! -f x2p/walk.c; then
2821				echo "Failed to create the symlinks (x2p/walk.c missing).  Aborting." >&4
2822				exit 1
2823			fi
2824			cd UU
2825			;;
2826		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2827			;;
2828		esac
2829		;;
2830	esac
2831	;;
2832esac
2833
2834: Check for Cross-Compilation
2835if $test "X$targethost" = "X"; then
2836    targethost=""
2837fi
2838if $test "X$targetenv" = "X"; then
2839    targetenv=""
2840fi
2841case "$usecrosscompile" in
2842$define|true|[yY]*)
2843	$echo "Cross-compiling..."
2844	croak=''
2845	case "$cc" in
2846	*-gcc*|*-g++*) # A cross-compiling gcc, probably.
2847	    # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2848	    # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2849	    targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2850	    ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2851	    # leave out ld, choosing it is more complex
2852	    nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2853	    ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2854	    # We are in a weird spot. Just before us, some values
2855	    # were 'saved', to be restored after the hints are
2856	    # run.  This means that the changes we made to ar,
2857	    # nm and ranlib will get reverted.
2858	    # To avoid that, we hijack the saving mechanism and
2859	    # have it save our new values.
2860	    for file in ar nm ranlib; do
2861		eval xxx=\$$file
2862		eval $file=$xxx$_exe
2863		eval _$file=$xxx
2864	    done
2865	;;
2866	esac
2867	case "$targetarch" in
2868	'') echo "Targetarch not defined." >&4; croak=y ;;
2869	*)  echo "Using targetarch $targetarch." >&4 ;;
2870	esac
2871	case "$targethost" in
2872	'') echo "Targethost not defined." >&4; croak=y ;;
2873	*)  echo "Using targethost $targethost." >&4
2874	esac
2875	locincpth=' '
2876	loclibpth=' '
2877	case "$croak" in
2878	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2879	esac
2880    : compile a host miniperl and generate_uudmap, unless we got passed them
2881    if $test "X$hostperl" = X; then
2882      echo "Building host miniperl and generate_uudmap binaries" >&4
2883      before_host=`pwd`
2884      cd ..
2885      cd $src
2886      src=`pwd`
2887      rm -rf $src/host
2888      mkdir $src/host
2889      cd $src/host
2890      $src/Configure -des -Dusedevel -Dmksymlinks
2891      $make miniperl
2892      case "$hostgenerate" in
2893      '') $make generate_uudmap
2894          hostgenerate=$src/host/generate_uudmap
2895          ;;
2896       "$undef") hostgenerate=''
2897          ;;
2898      esac
2899      hostperl=$src/host/miniperl
2900      cd $before_host
2901    fi
2902    hostosname=`$hostperl -le 'print $^O'`
2903    ;;
2904*)
2905    usecrosscompile="$undef"
2906    ;;
2907esac
2908
2909: Define -Dtargethost=somecomputer to run compiled tests on another machine
2910case "$targethost" in
2911    '') echo "Checking for cross-compile" >&4
2912    case "$usecrosscompile$multiarch" in
2913       *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2914         if [ -f Makefile ]; then
2915           echo " "
2916           echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2917         else
2918           echo "Configure done."
2919         fi
2920       exit 0
2921       ;;
2922     *) echo "No targethost for running compiler tests against defined, running locally" >&4
2923        run=''
2924        to=:
2925        from=:
2926        ;;
2927    esac
2928    ;;
2929    *) echo "Using targethost $targethost." >&4
2930	case "$src" in
2931	/*) run=$src/Cross/run
2932	    targetmkdir=$src/Cross/mkdir
2933	    to=$src/Cross/to
2934	    from=$src/Cross/from
2935	    ;;
2936	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2937	    run=$pwd/Cross/run
2938	    targetmkdir=$pwd/Cross/mkdir
2939	    to=$pwd/Cross/to
2940	    from=$pwd/Cross/from
2941	    ;;
2942	esac
2943	case "$targetrun" in
2944	'') targetrun=ssh ;;
2945	esac
2946	case "$targetto" in
2947	'') targetto=scp ;;
2948	esac
2949	case "$targetfrom" in
2950	'') targetfrom=scp ;;
2951	esac
2952	run=$run-$targetrun
2953	to=$to-$targetto
2954	from=$from-$targetfrom
2955	case "$targetdir" in
2956	'')  targetdir=/tmp
2957	     echo "Guessing targetdir $targetdir." >&4
2958	     ;;
2959	esac
2960	case "$targetuser" in
2961	'')  targetuser=root
2962	     echo "Guessing targetuser $targetuser." >&4
2963	     ;;
2964	esac
2965	case "$targetport" in
2966	'')  targetport=22
2967	     echo "Guessing targetport $targetport." >&4
2968	     ;;
2969	esac
2970	case "$targetfrom" in
2971	scp)	q=-q ;;
2972	*)	q='' ;;
2973	esac
2974	case "$targetrun" in
2975	ssh|rsh)
2976	    cat >$run <<EOF
2977#!/bin/sh
2978env=''
2979case "\$1" in
2980-cwd)
2981  shift
2982  cwd=\$1
2983  shift
2984  ;;
2985esac
2986case "\$1" in
2987-env)
2988  shift
2989  env=\$1
2990  shift
2991  ;;
2992esac
2993case "\$cwd" in
2994'') cwd=$targetdir ;;
2995esac
2996exe=\$1
2997shift
2998$to \$exe
2999$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3000EOF
3001	    ;;
3002	adb)
3003	    $touch $run
3004	    ;;
3005	*)  echo "Unknown targetrun '$targetrun'" >&4
3006	    exit 1
3007	    ;;
3008	esac
3009	case "$targetmkdir" in
3010	*/Cross/mkdir)
3011	    cat >$targetmkdir <<EOF
3012#!/bin/sh
3013$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3014EOF
3015	    $chmod a+rx $targetmkdir
3016	    ;;
3017	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3018	    exit 1
3019	    ;;
3020	esac
3021	case "$targetto" in
3022	scp|rcp)
3023	    cat >$to <<EOF
3024#!/bin/sh
3025for f in \$@
3026do
3027  case "\$f" in
3028  /*)
3029    $targetmkdir \`dirname \$f\`
3030    $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3031    ;;
3032  *)
3033    $targetmkdir $targetdir/\`dirname \$f\`
3034    $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3035    ;;
3036  esac
3037done
3038exit 0
3039EOF
3040	    ;;
3041	cp) cat >$to <<EOF
3042#!/bin/sh
3043for f in \$@
3044do
3045  case "\$f" in
3046  /*)
3047    $mkdir -p $targetdir/\`dirname \$f\`
3048    $cp \$f $targetdir/\$f || exit 1
3049    ;;
3050  *)
3051    $targetmkdir $targetdir/\`dirname \$f\`
3052    $cp \$f $targetdir/\$f || exit 1
3053    ;;
3054  esac
3055done
3056exit 0
3057EOF
3058	    ;;
3059	*)  echo "Unknown targetto '$targetto'" >&4
3060	    exit 1
3061	    ;;
3062	esac
3063	case "$targetfrom" in
3064	scp|rcp)
3065	  cat >$from <<EOF
3066#!/bin/sh
3067for f in \$@
3068do
3069  $rm -f \$f
3070  $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3071done
3072exit 0
3073EOF
3074	    ;;
3075	cp) cat >$from <<EOF
3076#!/bin/sh
3077for f in \$@
3078do
3079  $rm -f \$f
3080  cp $targetdir/\$f . || exit 1
3081done
3082exit 0
3083EOF
3084	    ;;
3085	*)  echo "Unknown targetfrom '$targetfrom'" >&4
3086	    exit 1
3087	    ;;
3088	esac
3089	if $test ! -f $run; then
3090	    echo "Target 'run' script '$run' not found." >&4
3091	else
3092	    $chmod a+rx $run
3093	fi
3094	if $test ! -f $to; then
3095	    echo "Target 'to' script '$to' not found." >&4
3096	else
3097	    $chmod a+rx $to
3098	fi
3099	if $test ! -f $from; then
3100	    echo "Target 'from' script '$from' not found." >&4
3101	else
3102	    $chmod a+rx $from
3103	fi
3104	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3105	    exit 1
3106	fi
3107	cat >&4 <<EOF
3108Using '$run' for remote execution,
3109and '$from' and '$to'
3110for remote file transfer.
3111EOF
3112	;;
3113*)	run=''
3114	to=:
3115	from=:
3116	usecrosscompile="$undef"
3117	targetarch=''
3118	;;
3119esac
3120
3121: see whether [:lower:] and [:upper:] are supported character classes
3122echo " "
3123case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3124ABYZ)
3125	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3126	up='[:upper:]'
3127	low='[:lower:]'
3128	;;
3129*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3130	# (0xd9 and 0xe2), therefore that is a nice testing point.
3131	if test "X$up" = X -o "X$low" = X; then
3132	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3133	    rs) up='[A-Z]'
3134		low='[a-z]'
3135		;;
3136	    esac
3137	fi
3138	if test "X$up" = X -o "X$low" = X; then
3139	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3140	    rs) up='A-Z'
3141		low='a-z'
3142		;;
3143	    esac
3144	fi
3145	if test "X$up" = X -o "X$low" = X; then
3146	    case "`echo RS | od -x 2>/dev/null`" in
3147	    *D9E2*|*d9e2*)
3148		echo "Hey, this might be EBCDIC." >&4
3149		if test "X$up" = X -o "X$low" = X; then
3150		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3151		    rs) up='[A-IJ-RS-Z]'
3152			low='[a-ij-rs-z]'
3153			;;
3154		    esac
3155		fi
3156		if test "X$up" = X -o "X$low" = X; then
3157		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3158		    rs) up='A-IJ-RS-Z'
3159			low='a-ij-rs-z'
3160			;;
3161		    esac
3162		fi
3163		;;
3164	    esac
3165	fi
3166esac
3167case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3168rs)
3169    echo "Using $up and $low to convert case." >&4
3170    ;;
3171*)
3172    echo "I don't know how to translate letters from upper to lower case." >&4
3173    echo "Your tr is not acting any way I know of." >&4
3174    exit 1
3175    ;;
3176esac
3177: set up the translation script tr, must be called with ./tr of course
3178cat >tr <<EOSC
3179$startsh
3180case "\$1\$2" in
3181'[A-Z][a-z]') exec $tr '$up' '$low';;
3182'[a-z][A-Z]') exec $tr '$low' '$up';;
3183esac
3184exec $tr "\$@"
3185EOSC
3186chmod +x tr
3187$eunicefix tr
3188
3189: Try to determine whether config.sh was made on this system
3190case "$config_sh" in
3191'')
3192myuname=`$uname -a 2>/dev/null`
3193$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3194# Downcase everything to avoid ambiguity.
3195# Remove slashes and single quotes so we can use parts of this in
3196# directory and file names.
3197# Remove newlines so myuname is sane to use elsewhere.
3198# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3199# because the A-Z/a-z are not consecutive.
3200myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3201	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3202newmyuname="$myuname"
3203dflt=n
3204case "$knowitall" in
3205'')
3206	if test -f ../config.sh; then
3207		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3208			eval "`grep myuname= ../config.sh`"
3209		fi
3210		if test "X$myuname" = "X$newmyuname"; then
3211			dflt=y
3212		fi
3213	fi
3214	;;
3215*) dflt=y;;
3216esac
3217
3218: Get old answers from old config file if Configure was run on the
3219: same system, otherwise use the hints.
3220hint=default
3221cd ..
3222if test -f config.sh; then
3223	echo " "
3224	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3225	. UU/myread
3226	case "$ans" in
3227	n*|N*) echo "OK, I'll ignore it."
3228		mv config.sh config.sh.old
3229		myuname="$newmyuname"
3230		;;
3231	*)  echo "Fetching default answers from your old config.sh file..." >&4
3232		tmp_n="$n"
3233		tmp_c="$c"
3234		tmp_sh="$sh"
3235		. ./config.sh
3236		cp config.sh UU
3237		n="$tmp_n"
3238		c="$tmp_c"
3239		: Older versions did not always set $sh.  Catch re-use of such
3240		: an old config.sh.
3241		case "$sh" in
3242		'') sh="$tmp_sh" ;;
3243		esac
3244		hint=previous
3245		;;
3246	esac
3247fi
3248. ./UU/checkcc
3249if test ! -f config.sh; then
3250	$cat <<EOM
3251
3252First time through, eh?  I have some defaults handy for some systems
3253that need some extra help getting the Configure answers right:
3254
3255EOM
3256	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3257	dflt=''
3258	: Half the following guesses are probably wrong... If you have better
3259	: tests or hints, please send them to perlbug@perl.org
3260	: The metaconfig authors would also appreciate a copy...
3261	$test -f /irix && osname=irix
3262	$test -f /xenix && osname=sco_xenix
3263	$test -f /dynix && osname=dynix
3264	$test -f /dnix && osname=dnix
3265	$test -f /lynx.os && osname=lynxos
3266	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3267	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3268	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3269	$test -f /bin/mips && /bin/mips && osname=mips
3270	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3271		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3272	$test -d /usr/apollo/bin && osname=apollo
3273	$test -f /etc/saf/_sactab && osname=svr4
3274	$test -d /usr/include/minix && osname=minix
3275	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3276	if $test -d /MachTen -o -d /MachTen_Folder; then
3277		osname=machten
3278		if $test -x /sbin/version; then
3279			osvers=`/sbin/version | $awk '{print $2}' |
3280			$sed -e 's/[A-Za-z]$//'`
3281		elif $test -x /usr/etc/version; then
3282			osvers=`/usr/etc/version | $awk '{print $2}' |
3283			$sed -e 's/[A-Za-z]$//'`
3284		else
3285			osvers="$2.$3"
3286		fi
3287	fi
3288
3289	$test -f /sys/posix.dll &&
3290		$test -f /usr/bin/what &&
3291		set X `/usr/bin/what /sys/posix.dll` &&
3292		$test "$3" = UWIN &&
3293		osname=uwin &&
3294		osvers="$5"
3295
3296	if $test -f $uname; then
3297		set X $myuname
3298		shift
3299
3300		case "$5" in
3301		fps*) osname=fps ;;
3302		mips*)
3303			case "$4" in
3304			umips) osname=umips ;;
3305			*) osname=mips ;;
3306			esac;;
3307		[23]100) osname=mips ;;
3308		next*) osname=next ;;
3309		i386*)
3310			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3311			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3312				osname='sco'
3313				osvers=$tmp
3314			elif $test -f /etc/kconfig; then
3315				osname=isc
3316				if test "$lns" = "$ln -s"; then
3317					osvers=4
3318				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3319					osvers=3
3320				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3321					osvers=2
3322				fi
3323			fi
3324			tmp=''
3325			;;
3326		pc*)
3327			if test -n "$DJGPP"; then
3328				osname=dos
3329				osvers=djgpp
3330			fi
3331			;;
3332		esac
3333
3334		case "$1" in
3335		aix) osname=aix
3336			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3337			case "$tmp" in
3338			# oslevel can fail with:
3339			# oslevel: Unable to acquire lock.
3340			*not\ found) osvers="$4"."$3" ;;
3341			'<3240'|'<>3240') osvers=3.2.0 ;;
3342			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3343			'=3250'|'>3250') osvers=3.2.5 ;;
3344			*) osvers=$tmp;;
3345			esac
3346			;;
3347		bitrig) osname=bitrig
3348			osvers="$3"
3349			;;
3350		bsd386) osname=bsd386
3351			osvers=`$uname -r`
3352			;;
3353		cygwin*) osname=cygwin
3354			osvers="$3"
3355			;;
3356		*dc.osx) osname=dcosx
3357			osvers="$3"
3358			;;
3359		dnix) osname=dnix
3360			osvers="$3"
3361			;;
3362		domainos) osname=apollo
3363			osvers="$3"
3364			;;
3365		dgux)	osname=dgux
3366			osvers="$3"
3367			;;
3368		dragonfly) osname=dragonfly
3369			osvers="$3"
3370			;;
3371		dynixptx*) osname=dynixptx
3372			osvers=`echo "$4"|sed 's/^v//'`
3373			;;
3374		freebsd) osname=freebsd
3375			osvers="$3" ;;
3376		genix)	osname=genix ;;
3377		gnu)	osname=gnu
3378			osvers="$3" ;;
3379		hp*)	osname=hpux
3380			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3381			;;
3382		irix*)	osname=irix
3383			case "$3" in
3384			4*) osvers=4 ;;
3385			5*) osvers=5 ;;
3386			*)	osvers="$3" ;;
3387			esac
3388			;;
3389		linux)	osname=linux
3390			case "$3" in
3391			*)	osvers="$3" ;;
3392			esac
3393			$test -f /system/lib/libandroid.so && osname=linux-android
3394			;;
3395		MiNT)	osname=mint
3396			;;
3397		netbsd*) osname=netbsd
3398			osvers="$3"
3399			;;
3400		news-os) osvers="$3"
3401			case "$3" in
3402			4*) osname=newsos4 ;;
3403			*) osname=newsos ;;
3404			esac
3405			;;
3406		next*) osname=next ;;
3407		nonstop-ux) osname=nonstopux ;;
3408		openbsd) osname=openbsd
3409                	osvers="$3"
3410                	;;
3411		os2)	osname=os2
3412			osvers="$4"
3413			;;
3414		POSIX-BC | posix-bc ) osname=posix-bc
3415			osvers="$3"
3416			;;
3417		powerux | power_ux | powermax_os | powermaxos | \
3418		powerunix | power_unix) osname=powerux
3419			osvers="$3"
3420			;;
3421		qnx) osname=qnx
3422			osvers="$4"
3423			;;
3424		solaris) osname=solaris
3425			case "$3" in
3426			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3427			*)	osvers="$3" ;;
3428			esac
3429			;;
3430		sunos) osname=sunos
3431			case "$3" in
3432			5*) osname=solaris
3433				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3434			*)	osvers="$3" ;;
3435			esac
3436			;;
3437		titanos) osname=titanos
3438			case "$3" in
3439			1*) osvers=1 ;;
3440			2*) osvers=2 ;;
3441			3*) osvers=3 ;;
3442			4*) osvers=4 ;;
3443			*)	osvers="$3" ;;
3444			esac
3445			;;
3446		ultrix) osname=ultrix
3447			osvers="$3"
3448			;;
3449		osf1|mls+)	case "$5" in
3450				alpha)
3451					osname=dec_osf
3452					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3453					case "$osvers" in
3454					[1-9].[0-9]*) ;;
3455					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3456					esac
3457					;;
3458			hp*)	osname=hp_osf1	;;
3459			mips)	osname=mips_osf1 ;;
3460			esac
3461			;;
3462		# UnixWare 7.1.2 is known as Open UNIX 8
3463		openunix|unixware) osname=svr5
3464			osvers="$4"
3465			;;
3466		uts)	osname=uts
3467			osvers="$3"
3468			;;
3469		vos) osvers="$3"
3470			;;
3471		$2) case "$osname" in
3472			*isc*) ;;
3473			*freebsd*) ;;
3474			svr*)
3475				: svr4.x or possibly later
3476				case "svr$3" in
3477				${osname}*)
3478					osname=svr$3
3479					osvers=$4
3480					;;
3481				esac
3482				case "$osname" in
3483				svr4.0)
3484					: Check for ESIX
3485					if test -f /stand/boot ; then
3486						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3487						if test -n "$INITPROG" -a -f "$INITPROG"; then
3488			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3489							if test -n "$isesix"; then
3490								osname=esix4
3491							fi
3492						fi
3493					fi
3494					;;
3495				esac
3496				;;
3497			*)	if test -f /etc/systemid; then
3498					osname=sco
3499					set `echo $3 | $sed 's/\./ /g'` $4
3500					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3501						osvers=$1.$2.$3
3502					elif $test -f $src/hints/sco_$1_$2.sh; then
3503						osvers=$1.$2
3504					elif $test -f $src/hints/sco_$1.sh; then
3505						osvers=$1
3506					fi
3507				else
3508					case "$osname" in
3509					'') : Still unknown.  Probably a generic Sys V.
3510						osname="sysv"
3511						osvers="$3"
3512						;;
3513					esac
3514				fi
3515				;;
3516			esac
3517			;;
3518		*)	case "$osname" in
3519			'') : Still unknown.  Probably a generic BSD.
3520				osname="$1"
3521				osvers="$3"
3522				;;
3523			esac
3524			;;
3525		esac
3526	else
3527		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3528			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3529			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3530				osname=news_os
3531			fi
3532			$rm -f UU/kernel.what
3533		elif test -d c:/. -o -n "$is_os2" ; then
3534			set X $myuname
3535			osname=os2
3536			osvers="$5"
3537		fi
3538	fi
3539
3540        case "$targetarch" in
3541        '') ;;
3542        *)  hostarch=$osname
3543            case "$targetarch" in
3544                nto*|*-nto-*)
3545                    # Will load qnx.sh, which should change osname to nto
3546                    osname=qnx
3547                    osvers=''
3548                    ;;
3549                *linux-android*)
3550                    # Catch arm-linux-androideabi, mipsel-linux-android,
3551                    # and i686-linux-android
3552                    osname=linux-android
3553                    osvers=''
3554                    ;;
3555                *linux*)
3556                    # Something like arm-linux-gnueabihf is really just
3557                    # plain linux.
3558                    osname=linux
3559                    osvers=''
3560                    ;;
3561                *solaris*|*sunos*)
3562                    osname=solaris
3563                    # XXX perhaps we should just assume
3564                    # osvers to be 2, or maybe take the value
3565                    # from targetarch. Using $run before the
3566                    # hints are run is somewhat icky.
3567                    set X `$run $uname -a 2>/dev/null`
3568                    shift
3569                    case "$3" in
3570                        5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3571                        *)  osvers="$3" ;;
3572                    esac
3573                    ;;
3574                *)
3575		    osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3576		    osvers=''
3577                ;;
3578            esac
3579            ;;
3580        esac
3581
3582	: Now look for a hint file osname_osvers, unless one has been
3583	: specified already.
3584	case "$hintfile" in
3585	''|' ')
3586		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3587		: Also try without trailing minor version numbers.
3588		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3589		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3590		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3591		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3592		case "$file" in
3593		'') dflt=none ;;
3594		*)  case "$osvers" in
3595			'') dflt=$file
3596				;;
3597			*)  if $test -f $src/hints/$file.sh ; then
3598					dflt=$file
3599				elif $test -f $src/hints/$xfile.sh ; then
3600					dflt=$xfile
3601				elif $test -f $src/hints/$xxfile.sh ; then
3602					dflt=$xxfile
3603				elif $test -f $src/hints/$xxxfile.sh ; then
3604					dflt=$xxxfile
3605				elif $test -f $src/hints/$xxxxfile.sh ; then
3606					dflt=$xxxxfile
3607				elif $test -f "$src/hints/${osname}.sh" ; then
3608					dflt="${osname}"
3609				else
3610					dflt=none
3611				fi
3612				;;
3613			esac
3614			;;
3615		esac
3616		if $test -f Policy.sh ; then
3617			case "$dflt" in
3618			*Policy*) ;;
3619			none) dflt="Policy" ;;
3620			*) dflt="Policy $dflt" ;;
3621			esac
3622		fi
3623		;;
3624	*)
3625		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3626		;;
3627	esac
3628
3629	if $test -f Policy.sh ; then
3630		$cat <<EOM
3631
3632There's also a Policy hint file available, which should make the
3633site-specific (policy) questions easier to answer.
3634EOM
3635
3636	fi
3637
3638	$cat <<EOM
3639
3640You may give one or more space-separated answers, or "none" if appropriate.
3641If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3642previous run of Configure, you may specify it as well as or instead of
3643OS-specific hints.  If hints are provided for your OS, you should use them:
3644although Perl can probably be built without hints on many platforms, using
3645hints often improve performance and may enable features that Configure can't
3646set up on its own. If there are no hints that match your OS, specify "none";
3647DO NOT give a wrong version or a wrong OS.
3648
3649EOM
3650
3651	rp="Which of these apply, if any?"
3652	. UU/myread
3653	tans=$ans
3654	for file in $tans; do
3655		if $test X$file = XPolicy -a -f Policy.sh; then
3656			. Policy.sh
3657			$cat Policy.sh >> UU/config.sh
3658		elif $test -f $src/hints/$file.sh; then
3659			. $src/hints/$file.sh
3660			$cat $src/hints/$file.sh >> UU/config.sh
3661		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3662			: nothing
3663		else
3664			: Give one chance to correct a possible typo.
3665			echo "$file.sh does not exist"
3666			dflt=$file
3667			rp="hint to use instead?"
3668			. UU/myread
3669			for file in $ans; do
3670				if $test -f "$src/hints/$file.sh"; then
3671					. $src/hints/$file.sh
3672					$cat $src/hints/$file.sh >> UU/config.sh
3673				elif $test X$ans = X -o X$ans = Xnone ; then
3674					: nothing
3675				else
3676					echo "$file.sh does not exist -- ignored."
3677				fi
3678			done
3679		fi
3680	done
3681
3682	hint=recommended
3683	: Remember our hint file for later.
3684	if $test -f "$src/hints/$file.sh" ; then
3685		hintfile="$file"
3686	else
3687		hintfile=''
3688	fi
3689fi
3690cd UU
3691;;
3692*)
3693	echo " "
3694	echo "Fetching default answers from $config_sh..." >&4
3695	tmp_n="$n"
3696	tmp_c="$c"
3697	cd ..
3698	cp $config_sh config.sh 2>/dev/null
3699	chmod +w config.sh
3700	. ./config.sh
3701	cd UU
3702	cp ../config.sh .
3703	n="$tmp_n"
3704	c="$tmp_c"
3705	hint=previous
3706	;;
3707esac
3708test "$override" && . ./optdef.sh
3709
3710: Restore computed paths
3711for file in $loclist $trylist; do
3712	eval $file="\$_$file"
3713done
3714
3715cat << EOM
3716
3717Configure uses the operating system name and version to set some defaults.
3718The default value is probably right if the name rings a bell. Otherwise,
3719since spelling matters for me, either accept the default or answer "none"
3720to leave it blank.
3721
3722EOM
3723case "$osname" in
3724	''|' ')
3725		case "$hintfile" in
3726		''|' '|none) dflt=none ;;
3727		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3728		esac
3729		;;
3730	*) dflt="$osname" ;;
3731esac
3732rp="Operating system name?"
3733. ./myread
3734case "$ans" in
3735none)  osname='' ;;
3736*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3737esac
3738echo " "
3739case "$osvers" in
3740	''|' ')
3741		case "$hintfile" in
3742		''|' '|none) dflt=none ;;
3743		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3744			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3745			case "$dflt" in
3746			''|' ') dflt=none ;;
3747			esac
3748			;;
3749		esac
3750		;;
3751	*) dflt="$osvers" ;;
3752esac
3753rp="Operating system version?"
3754. ./myread
3755case "$ans" in
3756none)  osvers='' ;;
3757*) osvers="$ans" ;;
3758esac
3759
3760
3761. ./posthint.sh
3762
3763: who configured the system
3764cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3765case "$cf_by" in
3766"")
3767	cf_by=`(logname) 2>/dev/null`
3768	case "$cf_by" in
3769	"")
3770		cf_by=`(whoami) 2>/dev/null`
3771		case "$cf_by" in
3772		"") cf_by=unknown ;;
3773		esac ;;
3774	esac ;;
3775esac
3776
3777: decide how portable to be.  Allow command line overrides.
3778case "$d_portable" in
3779"$undef") ;;
3780*)	d_portable="$define" ;;
3781esac
3782
3783: set up shell script to do ~ expansion
3784cat >filexp <<EOSS
3785$startsh
3786: expand filename
3787case "\$1" in
3788 \~/*|\~)
3789	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3790	;;
3791 \~*)
3792	if $test -f /bin/csh; then
3793		/bin/csh -f -c "glob \$1"
3794		failed=\$?
3795		echo ""
3796		exit \$failed
3797	else
3798		name=\`$expr x\$1 : '..\([^/]*\)'\`
3799		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3800		if $test ! -d "\$dir"; then
3801			me=\`basename \$0\`
3802			echo "\$me: can't locate home directory for: \$name" >&2
3803			exit 1
3804		fi
3805		case "\$1" in
3806		*/*)
3807			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3808			;;
3809		*)
3810			echo \$dir
3811			;;
3812		esac
3813	fi
3814	;;
3815*)
3816	echo \$1
3817	;;
3818esac
3819EOSS
3820chmod +x filexp
3821$eunicefix filexp
3822
3823: now set up to get a file name
3824cat <<EOS >getfile
3825$startsh
3826EOS
3827cat <<'EOSC' >>getfile
3828tilde=''
3829fullpath=''
3830already=''
3831skip=''
3832none_ok=''
3833exp_file=''
3834nopath_ok=''
3835orig_rp="$rp"
3836orig_dflt="$dflt"
3837case "$gfpth" in
3838'') gfpth='.' ;;
3839esac
3840
3841case "$fn" in
3842*\(*)
3843	: getfile will accept an answer from the comma-separated list
3844	: enclosed in parentheses even if it does not meet other criteria.
3845	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3846	fn=`echo $fn | sed 's/(.*)//'`
3847	;;
3848esac
3849
3850case "$fn" in
3851*:*)
3852	loc_file=`expr $fn : '.*:\(.*\)'`
3853	fn=`expr $fn : '\(.*\):.*'`
3854	;;
3855esac
3856
3857case "$fn" in
3858*~*) tilde=true;;
3859esac
3860case "$fn" in
3861*/*) fullpath=true;;
3862esac
3863case "$fn" in
3864*+*) skip=true;;
3865esac
3866case "$fn" in
3867*n*) none_ok=true;;
3868esac
3869case "$fn" in
3870*e*) exp_file=true;;
3871esac
3872case "$fn" in
3873*p*) nopath_ok=true;;
3874esac
3875
3876case "$fn" in
3877*f*) type='File';;
3878*d*) type='Directory';;
3879*l*) type='Locate';;
3880esac
3881
3882what="$type"
3883case "$what" in
3884Locate) what='File';;
3885esac
3886
3887case "$exp_file" in
3888'')
3889	case "$d_portable" in
3890	"$define") ;;
3891	*) exp_file=true;;
3892	esac
3893	;;
3894esac
3895
3896cd ..
3897while test "$type"; do
3898	redo=''
3899	rp="$orig_rp"
3900	dflt="$orig_dflt"
3901	case "$tilde" in
3902	true) rp="$rp (~name ok)";;
3903	esac
3904	. UU/myread
3905	if test -f UU/getfile.ok && \
3906		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3907	then
3908		value="$ans"
3909		ansexp="$ans"
3910		break
3911	fi
3912	case "$ans" in
3913	none)
3914		value=''
3915		ansexp=''
3916		case "$none_ok" in
3917		true) type='';;
3918		esac
3919		;;
3920	*)
3921		case "$tilde" in
3922		'') value="$ans"
3923			ansexp="$ans";;
3924		*)
3925			value=`UU/filexp $ans`
3926			case $? in
3927			0)
3928				if test "$ans" != "$value"; then
3929					echo "(That expands to $value on this system.)"
3930				fi
3931				;;
3932			*) value="$ans";;
3933			esac
3934			ansexp="$value"
3935			case "$exp_file" in
3936			'') value="$ans";;
3937			esac
3938			;;
3939		esac
3940		case "$fullpath" in
3941		true)
3942			case "$ansexp" in
3943			/*) value="$ansexp" ;;
3944			[a-zA-Z]:/*) value="$ansexp" ;;
3945			*)
3946				redo=true
3947				case "$already" in
3948				true)
3949				echo "I shall only accept a full path name, as in /bin/ls." >&4
3950				echo "Use a ! shell escape if you wish to check pathnames." >&4
3951					;;
3952				*)
3953				echo "Please give a full path name, starting with slash." >&4
3954					case "$tilde" in
3955					true)
3956				echo "Note that using ~name is ok provided it expands well." >&4
3957						already=true
3958						;;
3959					esac
3960				esac
3961				;;
3962			esac
3963			;;
3964		esac
3965		case "$redo" in
3966		'')
3967			case "$type" in
3968			File)
3969				for fp in $gfpth; do
3970					if test "X$fp" = X.; then
3971					    pf="$ansexp"
3972					else
3973					    pf="$fp/$ansexp"
3974					fi
3975					if test -f "$pf"; then
3976						type=''
3977					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3978					then
3979						echo "($value is not a plain file, but that's ok.)"
3980						type=''
3981					fi
3982					if test X"$type" = X; then
3983					    value="$pf"
3984					    break
3985					fi
3986				done
3987				;;
3988			Directory)
3989				for fp in $gfpth; do
3990					if test "X$fp" = X.; then
3991					    dir="$ans"
3992					    direxp="$ansexp"
3993					else
3994					    dir="$fp/$ansexp"
3995					    direxp="$fp/$ansexp"
3996					fi
3997					if test -d "$direxp"; then
3998						type=''
3999						value="$dir"
4000						break
4001					fi
4002				done
4003				;;
4004			Locate)
4005				if test -d "$ansexp"; then
4006					echo "(Looking for $loc_file in directory $value.)"
4007					value="$value/$loc_file"
4008					ansexp="$ansexp/$loc_file"
4009				fi
4010				if test -f "$ansexp"; then
4011					type=''
4012				fi
4013				case "$nopath_ok" in
4014				true)	case "$value" in
4015					*/*) ;;
4016					*)	echo "Assuming $value will be in people's path."
4017						type=''
4018						;;
4019					esac
4020					;;
4021				esac
4022				;;
4023			esac
4024
4025			case "$skip" in
4026			true) type='';
4027			esac
4028
4029			case "$type" in
4030			'') ;;
4031			*)
4032				if test "$fastread" = yes; then
4033					dflt=y
4034				else
4035					dflt=n
4036				fi
4037				rp="$what $value doesn't exist.  Use that name anyway?"
4038				. UU/myread
4039				dflt=''
4040				case "$ans" in
4041				y*) type='';;
4042				*) echo " ";;
4043				esac
4044				;;
4045			esac
4046			;;
4047		esac
4048		;;
4049	esac
4050done
4051cd UU
4052ans="$value"
4053rp="$orig_rp"
4054dflt="$orig_dflt"
4055rm -f getfile.ok
4056test "X$gfpthkeep" != Xy && gfpth=""
4057EOSC
4058
4059: determine root of directory hierarchy where package will be installed.
4060case "$prefix" in
4061'')
4062	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4063	;;
4064*?/)
4065	dflt=`echo "$prefix" | sed 's/.$//'`
4066	;;
4067*)
4068	dflt="$prefix"
4069	;;
4070esac
4071$cat <<EOM
4072
4073By default, $package will be installed in $dflt/bin, manual pages
4074under $dflt/man, etc..., i.e. with $dflt as prefix for all
4075installation directories. Typically this is something like /usr/local.
4076If you wish to have binaries under /usr/bin but other parts of the
4077installation under /usr/local, that's ok: you will be prompted
4078separately for each of the installation directories, the prefix being
4079only used to set the defaults.
4080
4081EOM
4082fn=d~
4083rp='Installation prefix to use?'
4084. ./getfile
4085oldprefix=''
4086case "$prefix" in
4087'') ;;
4088*)
4089	case "$ans" in
4090	"$prefix") ;;
4091	*) oldprefix="$prefix";;
4092	esac
4093	;;
4094esac
4095prefix="$ans"
4096prefixexp="$ansexp"
4097
4098: allow them to override the AFS root
4099case "$afsroot" in
4100'')	afsroot=/afs ;;
4101*)	afsroot=$afsroot ;;
4102esac
4103
4104: is AFS running?
4105echo " "
4106case "$afs" in
4107$define|true)	afs=true ;;
4108$undef|false)	afs=false ;;
4109*)	if $test -d $afsroot; then
4110		afs=true
4111	else
4112		afs=false
4113	fi
4114	;;
4115esac
4116if $afs; then
4117	echo "AFS may be running... I'll be extra cautious then..." >&4
4118else
4119	echo "AFS does not seem to be running..." >&4
4120fi
4121
4122: determine installation prefix for where package is to be installed.
4123if $afs; then
4124$cat <<EOM
4125
4126Since you are running AFS, I need to distinguish the directory in which
4127files will reside from the directory in which they are installed (and from
4128which they are presumably copied to the former directory by occult means).
4129
4130EOM
4131	case "$installprefix" in
4132	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4133	*) dflt="$installprefix";;
4134	esac
4135else
4136$cat <<EOM
4137
4138In some special cases, particularly when building $package for distribution,
4139it is convenient to distinguish the directory in which files should be
4140installed from the directory ($prefix) in which they will
4141eventually reside.  For most users, these two directories are the same.
4142
4143EOM
4144	case "$installprefix" in
4145	'') dflt=$prefix ;;
4146	*) dflt=$installprefix;;
4147	esac
4148fi
4149fn=d~
4150rp='What installation prefix should I use for installing files?'
4151. ./getfile
4152installprefix="$ans"
4153installprefixexp="$ansexp"
4154
4155: Perform the prefixexp/installprefixexp correction if necessary
4156cat <<EOS >installprefix
4157$startsh
4158EOS
4159cat <<'EOSC' >>installprefix
4160: Change installation prefix, if necessary.
4161if $test X"$prefix" != X"$installprefix"; then
4162    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4163else
4164    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4165fi
4166EOSC
4167chmod +x installprefix
4168$eunicefix installprefix
4169
4170: Set variables such as privlib and privlibexp from the output of ./getfile
4171: performing the prefixexp/installprefixexp correction if necessary.
4172cat <<EOS >setprefixvar
4173$startsh
4174EOS
4175cat <<'EOSC' >>setprefixvar
4176eval "${prefixvar}=\"\$ans\""
4177eval "${prefixvar}exp=\"\$ansexp\""
4178. ./installprefix
4179EOSC
4180chmod +x setprefixvar
4181$eunicefix setprefixvar
4182
4183: set up the script used to warn in case of inconsistency
4184cat <<EOS >whoa
4185$startsh
4186EOS
4187cat <<'EOSC' >>whoa
4188dflt=y
4189case "$hint" in
4190    recommended)
4191	case "$hintfile" in
4192	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4193		;;
4194	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4195		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4196		;;
4197	esac
4198	;;
4199    *)	echo " "
4200	echo "*** WHOA THERE!!! ***" >&4
4201	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4202	;;
4203esac
4204rp="    Keep the $hint value?"
4205. ./myread
4206case "$ans" in
4207y) td=$was; tu=$was;;
4208esac
4209EOSC
4210
4211: function used to set '$1' to '$val'
4212setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4213case "$val$was" in
4214$define$undef) . ./whoa; eval "$var=\$td";;
4215$undef$define) . ./whoa; eval "$var=\$tu";;
4216*) eval "$var=$val";;
4217esac'
4218
4219: get the patchlevel
4220echo " "
4221echo "Getting the current patchlevel..." >&4
4222if $test -r $rsrc/patchlevel.h;then
4223	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4224	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4225	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4226	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4227	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4228	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4229	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4230else
4231	revision=0
4232	patchlevel=0
4233	subversion=0
4234	api_revision=0
4235	api_version=0
4236	api_subversion=0
4237	perl_patchlevel=0
4238	$echo "(You do not have patchlevel.h.  Eek.)"
4239fi
4240: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4241version_patchlevel_string="version $patchlevel subversion $subversion"
4242case "$perl_patchlevel" in
42430|'') ;;
4244*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4245    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4246    ;;
4247esac
4248
4249$echo "(You have $package $version_patchlevel_string.)"
4250
4251case "$osname" in
4252dos|vms)
4253	: XXX Should be a Configure test for double-dots in filenames.
4254	version=`echo $revision $patchlevel $subversion | \
4255		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4256	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4257		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4258	;;
4259*)
4260	version=`echo $revision $patchlevel $subversion | \
4261		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4262	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4263		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4264	;;
4265esac
4266: Special case the 5.005_xx maintenance series, which used 5.005
4267: without any subversion label as a subdirectory in $sitelib
4268if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4269	api_versionstring='5.005'
4270fi
4271
4272: Do we want threads support and if so, what type
4273case "$usethreads" in
4274$define|true|[yY]*)     dflt='y';;
4275*)     # Catch case where user specified ithreads or 5005threads but
4276       # forgot -Dusethreads (A.D. 4/2002)
4277       case "$useithreads$use5005threads" in
4278       *$define*)	dflt='y';;
4279       *)		dflt='n';;
4280       esac
4281       ;;
4282esac
4283cat <<EOM
4284
4285Perl can be built to offer a form of threading support on some systems
4286To do so, Configure can be run with -Dusethreads.
4287
4288Note that Perl built with threading support runs slightly slower
4289and uses slightly more memory than plain Perl.
4290
4291If this doesn't make any sense to you, just accept the default '$dflt'.
4292EOM
4293rp='Build a threading Perl?'
4294. ./myread
4295case "$ans" in
4296y|Y)    val="$define" ;;
4297*)      val="$undef" ;;
4298esac
4299set usethreads
4300eval $setvar
4301
4302if $test $patchlevel -lt 9; then
4303    case "$usethreads" in
4304    $define)
4305	: Default to ithreads unless overridden on command line or with
4306	: old config.sh
4307	dflt='y'
4308	case "$use5005threads" in
4309		$define|true|[yY]*)
4310			echo "5.005 threads are no longer supported"
4311			exit 1
4312		;;
4313	esac
4314	case "$useithreads" in
4315		$undef|false|[nN]*) dflt='n';;
4316	esac
4317	rp='Use the newer interpreter-based ithreads?'
4318	. ./myread
4319	case "$ans" in
4320	y|Y)    val="$define" ;;
4321	*)      val="$undef" ;;
4322	esac
4323	set useithreads
4324	eval $setvar
4325	: Now set use5005threads to the opposite value.
4326	case "$useithreads" in
4327	$define) val="$undef" ;;
4328	*) val="$define" ;;
4329	esac
4330	set use5005threads
4331	eval $setvar
4332	;;
4333    *)
4334	useithreads="$undef"
4335	use5005threads="$undef"
4336	;;
4337    esac
4338
4339    case "$useithreads$use5005threads" in
4340    "$define$define")
4341	$cat >&4 <<EOM
4342
4343You cannot have both the ithreads and the 5.005 threads enabled
4344at the same time.  Disabling the 5.005 threads since they are
4345much less stable than the ithreads.
4346
4347EOM
4348	use5005threads="$undef"
4349	;;
4350    esac
4351
4352else
4353: perl-5.9.x and later
4354
4355    if test X"$usethreads" = "X$define"; then
4356	case "$use5005threads" in
4357	    $define|true|[yY]*)
4358		$cat >&4 <<EOM
4359
43605.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4361
4362EOM
4363	    ;;
4364	esac
4365    fi
4366
4367    use5005threads="$undef"
4368    useithreads="$usethreads"
4369fi
4370
4371case "$d_oldpthreads" in
4372'')	: Configure tests would be welcome here.  For now, assume undef.
4373	val="$undef" ;;
4374*)	val="$d_oldpthreads" ;;
4375esac
4376set d_oldpthreads
4377eval $setvar
4378
4379
4380: Look for a hint-file generated 'call-back-unit'.  If the
4381: user has specified that a threading perl is to be built,
4382: we may need to set or change some other defaults.
4383if $test -f usethreads.cbu; then
4384    echo "Your platform has some specific hints regarding threaded builds, using them..."
4385    . ./usethreads.cbu
4386else
4387    case "$usethreads" in
4388	"$define"|true|[yY]*)
4389		$cat <<EOM
4390(Your platform does not have any specific hints for threaded builds.
4391 Assuming POSIX threads, then.)
4392EOM
4393	;;
4394    esac
4395fi
4396
4397: Check if multiplicity is required
4398cat <<EOM
4399
4400Perl can be built so that multiple Perl interpreters can coexist
4401within the same Perl executable.
4402EOM
4403
4404case "$useithreads" in
4405$define)
4406	cat <<EOM
4407This multiple interpreter support is required for interpreter-based threads.
4408EOM
4409	val="$define"
4410	;;
4411*)	case "$usemultiplicity" in
4412	$define|true|[yY]*)	dflt='y';;
4413	*) dflt='n';;
4414	esac
4415	echo " "
4416	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4417	rp='Build Perl for multiplicity?'
4418	. ./myread
4419	case "$ans" in
4420	y|Y)	val="$define" ;;
4421	*)      val="$undef" ;;
4422	esac
4423	;;
4424esac
4425set usemultiplicity
4426eval $setvar
4427
4428: Check if morebits is requested
4429case "$usemorebits" in
4430"$define"|true|[yY]*)
4431	use64bitint="$define"
4432	uselongdouble="$define"
4433	usemorebits="$define"
4434	;;
4435*)	usemorebits="$undef"
4436	;;
4437esac
4438
4439: Determine the C compiler to be used
4440echo " "
4441case "$cc" in
4442'') dflt=cc;;
4443*) dflt="$cc";;
4444esac
4445rp="Use which C compiler?"
4446. ./myread
4447cc="$ans"
4448
4449: See whether they have no cc but they do have gcc
4450. ./trygcc
4451if $test -f cc.cbu; then
4452    . ./cc.cbu
4453fi
4454. ./checkcc
4455
4456: make some quick guesses about what we are up against
4457echo " "
4458$echo $n "Hmm...  $c"
4459echo exit 1 >bsd
4460echo exit 1 >usg
4461echo exit 1 >v7
4462echo exit 1 >osf1
4463echo exit 1 >eunice
4464echo exit 1 >xenix
4465echo exit 1 >venix
4466echo exit 1 >os2
4467d_bsd="$undef"
4468$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4469if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4470then
4471	echo "Looks kind of like an OSF/1 system, but we'll see..."
4472	echo exit 0 >osf1
4473elif test `echo abc | $tr a-z A-Z` = Abc ; then
4474	xxx=`./loc addbib blurfl $pth`
4475	if $test -f $xxx; then
4476	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4477		echo exit 0 >bsd
4478		echo exit 0 >usg
4479	else
4480		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4481			echo "Looks kind of like an extended USG system, but we'll see..."
4482		else
4483			echo "Looks kind of like a USG system, but we'll see..."
4484		fi
4485		echo exit 0 >usg
4486	fi
4487elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4488	echo "Looks kind of like a BSD system, but we'll see..."
4489	d_bsd="$define"
4490	echo exit 0 >bsd
4491else
4492	echo "Looks kind of like a Version 7 system, but we'll see..."
4493	echo exit 0 >v7
4494fi
4495case "$eunicefix" in
4496*unixtovms*)
4497	$cat <<'EOI'
4498There is, however, a strange, musty smell in the air that reminds me of
4499something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4500EOI
4501	echo exit 0 >eunice
4502	d_eunice="$define"
4503: it so happens the Eunice I know will not run shell scripts in Unix format
4504	;;
4505*)
4506	echo " "
4507	echo "Congratulations.  You aren't running Eunice."
4508	d_eunice="$undef"
4509	;;
4510esac
4511: Detect OS2.  The p_ variable is set above in the Head.U unit.
4512: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4513: semicolon as a patch separator
4514case "$p_" in
4515:) ;;
4516*)
4517	$cat <<'EOI'
4518I have the feeling something is not exactly right, however...don't tell me...
4519lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4520(Or you may be running DOS with DJGPP.)
4521EOI
4522	echo exit 0 >os2
4523	;;
4524esac
4525if test -f /xenix; then
4526	echo "Actually, this looks more like a XENIX system..."
4527	echo exit 0 >xenix
4528	d_xenix="$define"
4529else
4530	echo " "
4531	echo "It's not Xenix..."
4532	d_xenix="$undef"
4533fi
4534chmod +x xenix
4535$eunicefix xenix
4536if test -f /venix; then
4537	echo "Actually, this looks more like a VENIX system..."
4538	echo exit 0 >venix
4539else
4540	echo " "
4541	if ./xenix; then
4542		: null
4543	else
4544		echo "Nor is it Venix..."
4545	fi
4546fi
4547chmod +x bsd usg v7 osf1 eunice xenix venix os2
4548$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4549$rm -f foo
4550
4551: Check if we are using GNU gcc and what its version is
4552echo " "
4553echo "Checking for GNU cc in disguise and/or its version number..." >&4
4554$cat >try.c <<EOM
4555#include <stdio.h>
4556int main() {
4557#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4558#ifdef __VERSION__
4559	printf("%s\n", __VERSION__);
4560#else
4561	printf("%s\n", "1");
4562#endif
4563#endif
4564	return(0);
4565}
4566EOM
4567if $cc -o try $ccflags $ldflags try.c; then
4568	gccversion=`$run ./try`
4569	case "$gccversion" in
4570	'') echo "You are not using GNU cc." ;;
4571	*)  echo "You are using GNU cc $gccversion."
4572	    ccname=gcc
4573	    ;;
4574	esac
4575else
4576	echo " "
4577	echo "*** WHOA THERE!!! ***" >&4
4578	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4579	case "$knowitall" in
4580	'')
4581	echo "    You'd better start hunting for one and let me know about it." >&4
4582		exit 1
4583		;;
4584	esac
4585fi
4586$rm -f try try.*
4587case "$gccversion" in
45881*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4589esac
4590case "$gccversion" in
4591'') gccosandvers='' ;;
4592*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4593   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4594   gccshortvers=''
4595   case "$gccosandvers" in
4596   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4597   $osname$osvers) ;; # looking good
4598   $osname*) cat <<EOM >&4
4599
4600*** WHOA THERE!!! ***
4601
4602    Your gcc has not been compiled for the exact release of
4603    your operating system ($gccosandvers versus $osname$osvers).
4604
4605    In general it is a good idea to keep gcc synchronized with
4606    the operating system because otherwise serious problems
4607    may ensue when trying to compile software, like Perl.
4608
4609    I'm trying to be optimistic here, though, and will continue.
4610    If later during the configuration and build icky compilation
4611    problems appear (headerfile conflicts being the most common
4612    manifestation), I suggest reinstalling the gcc to match
4613    your operating system release.
4614
4615EOM
4616      ;;
4617   *) gccosandvers='' ;; # failed to parse, better be silent
4618   esac
4619   ;;
4620esac
4621case "$ccname" in
4622'') ccname="$cc" ;;
4623esac
4624
4625# gcc 3.* complain about adding -Idirectories that they already know about,
4626# so we will take those off from locincpth.
4627case "$gccversion" in
46283*)
4629    echo "main(){}">try.c
4630    for incdir in $locincpth; do
4631       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4632	     grep '^c[cp]p*[01]: warning: changing search order '`
4633       if test "X$warn" != X; then
4634	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4635       fi
4636    done
4637    $rm -f try try.*
4638esac
4639
4640# gcc 4.9 by default does some optimizations that break perl.
4641# see ticket 121505.
4642#
4643# The -fwrapv disables those optimizations (and probably others,) so
4644# for gcc 4.9 (and later, since the optimizations probably won't go
4645# away), add -fwrapv unless the user requests -fno-wrapv, which
4646# disables -fwrapv, or if the user requests -fsanitize=undefined,
4647# which turns the overflows -fwrapv ignores into runtime errors.
4648case "$gccversion" in
46494.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4650    case "$ccflags" in
4651    *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4652    *) ccflags="$ccflags -fwrapv" ;;
4653    esac
4654esac
4655
4656: What should the include directory be ?
4657: Use sysroot if set, so findhdr looks in the right place.
4658echo " "
4659$echo $n "Hmm...  $c"
4660dflt="$sysroot/usr/include"
4661incpath=''
4662mips_type=''
4663if $test -f /bin/mips && /bin/mips; then
4664	echo "Looks like a MIPS system..."
4665	$cat >usr.c <<'EOCP'
4666#ifdef SYSTYPE_BSD43
4667/bsd43
4668#endif
4669EOCP
4670	if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4671		dflt='/bsd43/usr/include'
4672		incpath='/bsd43'
4673		mips_type='BSD 4.3'
4674	else
4675		mips_type='System V'
4676	fi
4677	$rm -f usr.c usr.out
4678	echo "and you're compiling with the $mips_type compiler and libraries."
4679	xxx_prompt=y
4680	echo "exit 0" >mips
4681else
4682	echo "Doesn't look like a MIPS system."
4683	xxx_prompt=n
4684	echo "exit 1" >mips
4685fi
4686chmod +x mips
4687$eunicefix mips
4688case "$usrinc" in
4689'') ;;
4690*) dflt="$usrinc";;
4691esac
4692case "$xxx_prompt" in
4693y)	fn=d/
4694	echo " "
4695	rp='Where are the include files you want to use?'
4696	. ./getfile
4697	usrinc="$ans"
4698	;;
4699*)	usrinc="$dflt"
4700	;;
4701esac
4702
4703: see how we invoke the C preprocessor
4704echo " "
4705echo "Now, how can we feed standard input to your C preprocessor..." >&4
4706cat <<'EOT' >testcpp.c
4707#define ABC abc
4708#define XYZ xyz
4709ABC.XYZ
4710EOT
4711cd ..
4712if test ! -f cppstdin; then
4713	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4714		# AIX cc -E doesn't show the absolute headerfile
4715		# locations but we'll cheat by using the -M flag.
4716		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
4717	else
4718		echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4719	fi
4720else
4721	echo "Keeping your $hint cppstdin wrapper."
4722fi
4723chmod 755 cppstdin
4724wrapper=`pwd`/cppstdin
4725ok='false'
4726cd UU
4727
4728if $test "X$cppstdin" != "X" && \
4729	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4730	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4731then
4732	echo "You used to use $cppstdin $cppminus so we'll use that again."
4733	case "$cpprun" in
4734	'') echo "But let's see if we can live without a wrapper..." ;;
4735	*)
4736		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4737			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4738		then
4739			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4740			ok='true'
4741		else
4742			echo "(However, $cpprun $cpplast does not work, let's see...)"
4743		fi
4744		;;
4745	esac
4746else
4747	case "$cppstdin" in
4748	'') ;;
4749	*)
4750		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4751		;;
4752	esac
4753fi
4754
4755if $ok; then
4756	: nothing
4757elif echo 'Maybe "'"$cc"' -E" will work...'; \
4758	$cc -E <testcpp.c >testcpp.out 2>&1; \
4759	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4760	echo "Yup, it does."
4761	x_cpp="$cc $cppflags -E"
4762	x_minus='';
4763elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4764	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4765	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4766	echo "Yup, it does."
4767	x_cpp="$cc $cppflags -E"
4768	x_minus='-';
4769elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4770	$cc -P <testcpp.c >testcpp.out 2>&1; \
4771	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4772	echo "Yipee, that works!"
4773	x_cpp="$cc $cppflags -P"
4774	x_minus='';
4775elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4776	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4777	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4778	echo "At long last!"
4779	x_cpp="$cc $cppflags -P"
4780	x_minus='-';
4781elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4782	$cpp <testcpp.c >testcpp.out 2>&1; \
4783	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4784	echo "It works!"
4785	x_cpp="$cpp $cppflags"
4786	x_minus='';
4787elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4788	$cpp - <testcpp.c >testcpp.out 2>&1; \
4789	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4790	echo "Hooray, it works!  I was beginning to wonder."
4791	x_cpp="$cpp $cppflags"
4792	x_minus='-';
4793elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4794	$wrapper <testcpp.c >testcpp.out 2>&1; \
4795	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4796	x_cpp="$wrapper"
4797	x_minus=''
4798	echo "Eureka!"
4799else
4800	dflt=''
4801	rp="No dice.  I can't find a C preprocessor.  Name one:"
4802	. ./myread
4803	x_cpp="$ans"
4804	x_minus=''
4805	$x_cpp <testcpp.c >testcpp.out 2>&1
4806	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4807		echo "OK, that will do." >&4
4808	else
4809echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4810		exit 1
4811	fi
4812fi
4813
4814case "$ok" in
4815false)
4816	cppstdin="$x_cpp"
4817	cppminus="$x_minus"
4818	cpprun="$x_cpp"
4819	cpplast="$x_minus"
4820	set X $x_cpp
4821	shift
4822	case "$1" in
4823	"$cpp")
4824		echo "Perhaps can we force $cc -E using a wrapper..."
4825		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4826			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4827		then
4828			echo "Yup, we can."
4829			cppstdin="$wrapper"
4830			cppminus='';
4831		else
4832			echo "Nope, we'll have to live without it..."
4833		fi
4834		;;
4835	esac
4836	case "$cpprun" in
4837	"$wrapper")
4838		cpprun=''
4839		cpplast=''
4840		;;
4841	esac
4842	;;
4843esac
4844
4845case "$cppstdin" in
4846"$wrapper"|'cppstdin') ;;
4847*) $rm -f $wrapper;;
4848esac
4849$rm -f testcpp.c testcpp.out
4850
4851: Adjust cppfilter for path component separator
4852case "$osname" in
4853vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4854os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4855*)   cppfilter='' ;;
4856esac
4857
4858: Use gcc to determine libpth and incpth
4859# If using gcc or clang, we can get better values for libpth, incpth
4860# and usrinc directly from the compiler.
4861# Note that ccname for clang is also gcc.
4862case "$ccname" in
4863    gcc)
4864	$echo 'extern int foo;' > try.c
4865	set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4866	shift
4867	if $test $# -gt 0; then
4868	    incpth="$incpth $*"
4869	    incpth="`$echo $incpth|$sed 's/^ //'`"
4870	    for i in $*; do
4871		j="`$echo $i|$sed 's,/include$,/lib,'`"
4872		if $test -d $j; then
4873		    libpth="$libpth $j"
4874		fi
4875	    done
4876	    libpth="`$echo $libpth|$sed 's/^ //'`"
4877	    for xxx in $libpth $loclibpth $plibpth $glibpth; do
4878		if $test -d $xxx; then
4879		    case " $libpth " in
4880		    *" $xxx "*) ;;
4881		    *) libpth="$libpth $xxx";;
4882		    esac
4883		fi
4884	    done
4885	fi
4886	$rm -f try.c
4887	case "$usrinc" in
4888	'') for i in $incpth; do
4889		if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4890		    usrinc="$i"
4891		    break
4892		fi
4893	    done
4894	    ;;
4895	esac
4896
4897	case "$usecrosscompile" in
4898	$define|true|[yY]*)
4899	    case "$incpth" in
4900		'') echo "Incpth not defined." >&4; croak=y ;;
4901		*)  echo "Using incpth '$incpth'." >&4 ;;
4902	    esac
4903	    case "$libpth" in
4904		'') echo "Libpth not defined." >&4; croak=y ;;
4905		*)  echo "Using libpth '$libpth'." >&4 ;;
4906	    esac
4907	    case "$usrinc" in
4908		'') echo "Usrinc not defined." >&4; croak=y ;;
4909		*)  echo "Using usrinc $usrinc." >&4 ;;
4910	    esac
4911	    case "$croak" in
4912		y)
4913		if test "X$sysroot" = X; then
4914		    echo "Cannot continue, aborting." >&4; exit 1
4915		else
4916		    echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4917		fi
4918		;;
4919	    esac
4920	    ;;
4921	esac
4922    ;;
4923esac
4924
4925: Default value for incpth is just usrinc
4926case "$incpth" in
4927'') incpth="$usrinc";;
4928esac
4929
4930: Set private lib path
4931case "$plibpth" in
4932'') if ./mips; then
4933	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4934    fi;;
4935esac
4936case "$libpth" in
4937' ') dlist='';;
4938'') dlist="$loclibpth $plibpth $glibpth";;
4939*) dlist="$libpth";;
4940esac
4941
4942: Now check and see which directories actually exist, avoiding duplicates
4943for xxx in $dlist
4944do
4945    if $test -d $xxx; then
4946		case " $libpth " in
4947		*" $xxx "*) ;;
4948		*) libpth="$libpth $xxx";;
4949		esac
4950    fi
4951done
4952$cat <<'EOM'
4953
4954Some systems have incompatible or broken versions of libraries.  Among
4955the directories listed in the question below, please remove any you
4956know not to be holding relevant libraries, and add any that are needed.
4957Say "none" for none.
4958
4959EOM
4960
4961if test "X$sysroot" != X; then
4962    $cat <<EOM
4963You have set sysroot to $sysroot, please supply the directories excluding sysroot
4964
4965EOM
4966fi
4967
4968case "$libpth" in
4969'') dflt='none';;
4970*)
4971	set X $libpth
4972	shift
4973	dflt=${1+"$@"}
4974	;;
4975esac
4976rp="Directories to use for library searches?"
4977. ./myread
4978case "$ans" in
4979none) libpth=' ';;
4980*) libpth="$ans";;
4981esac
4982
4983: compute shared library extension
4984case "$so" in
4985'')
4986	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4987		dflt='sl'
4988	else
4989		dflt='so'
4990	fi
4991	;;
4992*) dflt="$so";;
4993esac
4994$cat <<EOM
4995
4996On some systems, shared libraries may be available.  Answer 'none' if
4997you want to suppress searching of shared libraries for the remainder
4998of this configuration.
4999
5000EOM
5001rp='What is the file extension used for shared libraries?'
5002. ./myread
5003so="$ans"
5004
5005: Does target system insist that shared library basenames are unique
5006$cat << EOM
5007
5008Some dynamic loaders assume that the *basename* of shared library filenames
5009are globally unique.  We'll default this to undef as we assume your system
5010is not this weird. Set to defined if you're on one of them.
5011
5012EOM
5013
5014dflt='n'
5015rp='Make shared library basenames unique?'
5016. ./myread
5017case "$ans" in
5018y|Y) val="$define" ;;
5019*)   val="$undef"  ;;
5020esac
5021set d_libname_unique
5022eval $setvar
5023
5024: Define several unixisms.
5025: Hints files or command line option can be used to override them.
5026: The convoluted testing is in case hints files set either the old
5027: or the new name.
5028case "$_exe" in
5029'')	case "$exe_ext" in
5030	'')	;;
5031	*)	_exe="$exe_ext" ;;
5032	esac
5033	;;
5034esac
5035case "$_a" in
5036'')	case "$lib_ext" in
5037    '')	_a='.a';;
5038	*)	_a="$lib_ext" ;;
5039	esac
5040	;;
5041esac
5042case "$_o" in
5043'') case "$obj_ext" in
5044	'')	_o='.o';;
5045	*)	_o="$obj_ext";;
5046	esac
5047	;;
5048esac
5049case "$p_" in
5050'') case "$path_sep" in
5051	'')	p_=':';;
5052	*)	p_="$path_sep";;
5053	esac
5054	;;
5055esac
5056exe_ext=$_exe
5057lib_ext=$_a
5058obj_ext=$_o
5059path_sep=$p_
5060
5061rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5062
5063: Which makefile gets called first.  This is used by make depend.
5064case "$firstmakefile" in
5065'') firstmakefile='makefile';;
5066esac
5067
5068: Check is we will use socks
5069case "$usesocks" in
5070$define|true|[yY]*)	dflt='y';;
5071*) dflt='n';;
5072esac
5073cat <<EOM
5074
5075Perl can be built to use the SOCKS proxy protocol library.  To do so,
5076Configure must be run with -Dusesocks.  If you use SOCKS you also need
5077to use the PerlIO abstraction layer, this will be implicitly selected.
5078
5079If this doesn't make any sense to you, just accept the default '$dflt'.
5080EOM
5081rp='Build Perl for SOCKS?'
5082. ./myread
5083case "$ans" in
5084y|Y)	val="$define" ;;
5085*)      val="$undef" ;;
5086esac
5087set usesocks
5088eval $setvar
5089
5090: Check for uselongdouble support
5091case "$ccflags" in
5092*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5093esac
5094
5095case "$uselongdouble" in
5096$define|true|[yY]*)	dflt='y';;
5097*) dflt='n';;
5098esac
5099cat <<EOM
5100
5101Perl can be built to take advantage of long doubles which
5102(if available) may give more accuracy and range for floating point numbers.
5103
5104If this doesn't make any sense to you, just accept the default '$dflt'.
5105EOM
5106rp='Try to use long doubles if available?'
5107. ./myread
5108case "$ans" in
5109y|Y) 	val="$define"	;;
5110*)      val="$undef"	;;
5111esac
5112set uselongdouble
5113eval $setvar
5114
5115case "$uselongdouble" in
5116true|[yY]*) uselongdouble="$define" ;;
5117esac
5118
5119: Look for a hint-file generated 'call-back-unit'.  If the
5120: user has specified that long doubles should be used,
5121: we may need to set or change some other defaults.
5122if $test -f uselongdouble.cbu; then
5123    echo "Your platform has some specific hints regarding long doubles, using them..."
5124    . ./uselongdouble.cbu
5125else
5126    case "$uselongdouble" in
5127	$define)
5128		$cat <<EOM
5129(Your platform does not have any specific hints for long doubles.)
5130EOM
5131	;;
5132    esac
5133fi
5134
5135: Looking for optional libraries
5136echo " "
5137echo "Checking for optional libraries..." >&4
5138case "$libs" in
5139' '|'') dflt='';;
5140*) dflt="$libs";;
5141esac
5142case "$libswanted" in
5143'') libswanted='c_s';;
5144esac
5145case "$usesocks" in
5146"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5147esac
5148libsfound=''
5149libsfiles=''
5150libsdirs=''
5151libspath=''
5152for thisdir in $libpth $xlibpth; do
5153  test -d $thisdir && libspath="$libspath $thisdir"
5154done
5155for thislib in $libswanted; do
5156	for thisdir in $libspath; do
5157	    xxx=''
5158	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5159		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5160	        $test -f "$xxx" && eval $libscheck
5161		$test -f "$xxx" && libstyle=shared
5162	    fi
5163	    if test ! -f "$xxx"; then
5164		xxx=$thisdir/lib$thislib.$so
5165	        $test -f "$xxx" && eval $libscheck
5166		$test -f "$xxx" && libstyle=shared
5167	    fi
5168	    if test ! -f "$xxx"; then
5169		xxx=$thisdir/lib$thislib$_a
5170	        $test -f "$xxx" && eval $libscheck
5171		$test -f "$xxx" && libstyle=static
5172	    fi
5173	    if test ! -f "$xxx"; then
5174		xxx=$thisdir/$thislib$_a
5175	        $test -f "$xxx" && eval $libscheck
5176		$test -f "$xxx" && libstyle=static
5177	    fi
5178	    if test ! -f "$xxx"; then
5179		xxx=$thisdir/lib${thislib}_s$_a
5180	        $test -f "$xxx" && eval $libscheck
5181		$test -f "$xxx" && libstyle=static
5182		$test -f "$xxx" && thislib=${thislib}_s
5183	    fi
5184	    if test ! -f "$xxx"; then
5185		xxx=$thisdir/Slib$thislib$_a
5186	        $test -f "$xxx" && eval $libscheck
5187		$test -f "$xxx" && libstyle=static
5188	    fi
5189	    if $test -f "$xxx"; then
5190		case "$libstyle" in
5191		shared) echo "Found -l$thislib (shared)." ;;
5192		static) echo "Found -l$thislib." ;;
5193		*)      echo "Found -l$thislib ($libstyle)." ;;
5194		esac
5195		case " $dflt " in
5196		*"-l$thislib "*);;
5197		*) dflt="$dflt -l$thislib"
5198                   libsfound="$libsfound $xxx"
5199                   yyy=`basename $xxx`
5200                   libsfiles="$libsfiles $yyy"
5201                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5202                   case " $libsdirs " in
5203                   *" $yyy "*) ;;
5204                   *) libsdirs="$libsdirs $yyy" ;;
5205                   esac
5206		   ;;
5207		esac
5208		break
5209	    fi
5210	done
5211	if $test ! -f "$xxx"; then
5212	    echo "No -l$thislib."
5213	fi
5214done
5215set X $dflt
5216shift
5217dflt="$*"
5218case "$libs" in
5219'') dflt="$dflt";;
5220*) dflt="$libs";;
5221esac
5222case "$dflt" in
5223' '|'') dflt='none';;
5224esac
5225
5226$cat <<EOM
5227
5228In order to compile $package on your machine, a number of libraries
5229are usually needed.  Include any other special libraries here as well.
5230Say "none" for none.  The default list is almost always right.
5231EOM
5232
5233echo " "
5234rp="What libraries to use?"
5235. ./myread
5236case "$ans" in
5237none) libs=' ';;
5238*) libs="$ans";;
5239esac
5240
5241: determine optimization, if desired, or use for debug flag also
5242case "$optimize" in
5243' '|$undef) dflt='none';;
5244'') dflt='-O';;
5245*) dflt="$optimize";;
5246esac
5247$cat <<EOH
5248
5249By default, $package compiles with the -O flag to use the optimizer.
5250Alternately, you might want to use the symbolic debugger, which uses
5251the -g flag (on traditional Unix systems).  Either flag can be
5252specified here.  To use neither flag, specify the word "none".
5253
5254EOH
5255rp="What optimizer/debugger flag should be used?"
5256. ./myread
5257optimize="$ans"
5258case "$optimize" in
5259'none') optimize=" ";;
5260esac
5261
5262: Check what DEBUGGING is required from the command line
5263: -DEBUGGING      or -DDEBUGGING or
5264: -DEBUGGING=both			= -g + -DDEBUGGING
5265: -DEBUGGING=-g   or -Doptimize=-g	= -g
5266: -DEBUGGING=none or -UDEBUGGING	=
5267: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5268case "$EBUGGING" in
5269'')	;;
5270*)	DEBUGGING=$EBUGGING ;;
5271esac
5272
5273case "$DEBUGGING" in
5274-g|both|$define)
5275    case "$optimize" in
5276	*-g*) ;;
5277	*)    optimize="$optimize -g" ;;
5278    esac ;;
5279none|$undef)
5280    case "$optimize" in
5281	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5282		shift
5283		optimize="$*"
5284		;;
5285    esac ;;
5286esac
5287
5288dflt=''
5289case "$DEBUGGING" in
5290both|$define) dflt='-DDEBUGGING'
5291esac
5292
5293: argument order is deliberate, as the flag will start with - which set could
5294: think is an option
5295checkccflag='check=$1; flag=$2; callback=$3;
5296echo " ";
5297echo "Checking if your compiler accepts $flag" 2>&1;
5298[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5299echo "int main(void) { return 0; }" > gcctest.c;
5300if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5301    echo "Yes, it does." 2>&1;
5302    if $test -s gcctest.out ; then
5303        echo "But your platform does not like it:";
5304        cat gcctest.out;
5305    else
5306	case "$ccflags" in
5307	*$check*)
5308	    echo "Leaving current flags $ccflags alone." 2>&1
5309	    ;;
5310	*) dflt="$dflt $flag";
5311	    eval $callback
5312	    ;;
5313	esac
5314    fi
5315else
5316    echo "Nope, it does not, but that is ok." 2>&1;
5317fi
5318'
5319
5320: We will not override a previous value, but we might want to
5321: augment a hint file
5322case "$hint" in
5323default|recommended)
5324	case "$gccversion" in
5325	1*) dflt="$dflt -fpcc-struct-return" ;;
5326	esac
5327	case "$optimize:$DEBUGGING" in
5328	*-g*:old) dflt="$dflt -DDEBUGGING";;
5329	esac
5330	case "$gccversion" in
5331	2*) if $test -d /etc/conf/kconfig.d &&
5332			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5333		then
5334			# Interactive Systems (ISC) POSIX mode.
5335			dflt="$dflt -posix"
5336		fi
5337		;;
5338	esac
5339	case "$gccversion" in
5340	1*) ;;
5341	2.[0-8]*) ;;
5342	?*)	set strict-aliasing -fno-strict-aliasing
5343		eval $checkccflag
5344		;;
5345	esac
5346	case "$gccversion" in
5347	1*) ;;
5348	2*) ;;
5349	?*) 	echo " "
5350		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5351		echo 'int main(void) { return 0; }' > gcctest.c
5352		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5353			echo "Yes, it does." 2>&1
5354			case "$ccflags" in
5355			*delete-null-pointer-checks*)
5356				echo "Leaving current flags $ccflags alone." 2>&1
5357				;;
5358			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5359			esac
5360		else
5361			echo "Nope, it doesn't, but that's ok." 2>&1
5362		fi
5363		;;
5364	esac
5365	# For gcc, adding -pipe speeds up compilations for some, but apparently
5366	# some assemblers can't read from stdin.  (It also slows down compilations
5367	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5368	case "$gccversion" in
5369	?*)	set pipe -pipe
5370		eval $checkccflag
5371		;;
5372	esac
5373
5374	# on x86_64 (at least) we require an extra library (libssp) in the
5375	# link command line. This library is not named, so I infer that it is
5376	# an implementation detail that may change. Hence the safest approach
5377	# is to add the flag to the flags passed to the compiler at link time,
5378	# as that way the compiler can do the right implementation dependant
5379	# thing. (NWC)
5380	case "$gccversion" in
5381	?*)	set stack-protector -fstack-protector
5382		eval $checkccflag
5383		;;
5384	esac
5385	;;
5386esac
5387
5388case "$mips_type" in
5389*BSD*|'') inclwanted="$locincpth $usrinc";;
5390*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5391esac
5392for thisincl in $inclwanted; do
5393	if $test -d $thisincl; then
5394		if $test x$thisincl != x$usrinc; then
5395			case "$dflt" in
5396			*" -I$thisincl "*);;
5397			*) dflt="$dflt -I$thisincl ";;
5398			esac
5399		fi
5400	fi
5401done
5402
5403inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5404	xxx=true;
5405elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5406	xxx=true;
5407else
5408	xxx=false;
5409fi;
5410if $xxx; then
5411	case "$dflt" in
5412	*$2*);;
5413	*) dflt="$dflt -D$2";;
5414	esac;
5415fi'
5416
5417set signal.h LANGUAGE_C; eval $inctest
5418
5419case "$usesocks" in
5420$define)
5421	ccflags="$ccflags -DSOCKS"
5422	;;
5423esac
5424
5425case "$hint" in
5426default|recommended) dflt="$ccflags $dflt" ;;
5427*) dflt="$ccflags";;
5428esac
5429
5430case "$dflt" in
5431''|' ') dflt=none;;
5432esac
5433
5434$cat <<EOH
5435
5436Your C compiler may want other flags.  For this question you should include
5437-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5438but you should NOT include libraries or ld flags like -lwhatever.  If you
5439want $package to honor its debug switch, you should include -DDEBUGGING here.
5440Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5441
5442To use no flags, specify the word "none".
5443
5444EOH
5445set X $dflt
5446shift
5447dflt=${1+"$@"}
5448rp="Any additional cc flags?"
5449. ./myread
5450case "$ans" in
5451none) ccflags='';;
5452*) ccflags="$ans";;
5453esac
5454
5455: the following weeds options from ccflags that are of no interest to cpp
5456case "$cppflags" in
5457'') cppflags="$ccflags" ;;
5458*)  cppflags="$cppflags $ccflags" ;;
5459esac
5460case "$gccversion" in
54611*) cppflags="$cppflags -D__GNUC__"
5462esac
5463case "$mips_type" in
5464'');;
5465*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5466esac
5467case "$cppflags" in
5468'');;
5469*)
5470	echo " "
5471	echo "Let me guess what the preprocessor flags are..." >&4
5472	set X $cppflags
5473	shift
5474	cppflags=''
5475	$cat >cpp.c <<'EOM'
5476#define BLURFL foo
5477
5478BLURFL xx LFRULB
5479EOM
5480	previous=''
5481	for flag in $*
5482	do
5483		case "$flag" in
5484		-*) ftry="$flag";;
5485		*) ftry="$previous $flag";;
5486		esac
5487		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5488			>cpp1.out 2>/dev/null && \
5489			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5490			>cpp2.out 2>/dev/null && \
5491			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5492			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5493		then
5494			cppflags="$cppflags $ftry"
5495			previous=''
5496		else
5497			previous="$flag"
5498		fi
5499	done
5500	set X $cppflags
5501	shift
5502	cppflags=${1+"$@"}
5503	case "$cppflags" in
5504	*-*)  echo "They appear to be: $cppflags";;
5505	esac
5506	$rm -f cpp.c cpp?.out
5507	;;
5508esac
5509
5510: flags used in final linking phase
5511case "$ldflags" in
5512'') if ./venix; then
5513		dflt='-i -z'
5514	else
5515		dflt=''
5516	fi
5517	case "$ccflags" in
5518	*-posix*) dflt="$dflt -posix" ;;
5519	esac
5520	;;
5521*) dflt="$ldflags";;
5522esac
5523# See note above about -fstack-protector
5524case "$ccflags" in
5525*-fstack-protector*)
5526	case "$dflt" in
5527	*-fstack-protector*) ;; # Don't add it again
5528	*) dflt="$dflt -fstack-protector" ;;
5529	esac
5530	;;
5531esac
5532
5533: Try to guess additional flags to pick up local libraries.
5534for thislibdir in $libpth; do
5535	case " $loclibpth " in
5536	*" $thislibdir "*)
5537		case "$dflt " in
5538		*"-L$thislibdir "*) ;;
5539		*)  dflt="$dflt -L$thislibdir" ;;
5540		esac
5541		;;
5542	esac
5543done
5544
5545case "$dflt" in
5546'') dflt='none' ;;
5547esac
5548
5549$cat <<EOH
5550
5551Your C linker may need flags.  For this question you should
5552include -L/whatever and any other flags used by the C linker, but you
5553should NOT include libraries like -lwhatever.
5554
5555Make sure you include the appropriate -L/path flags if your C linker
5556does not normally search all of the directories you specified above,
5557namely
5558	$libpth
5559To use no flags, specify the word "none".
5560
5561EOH
5562
5563rp="Any additional ld flags (NOT including libraries)?"
5564. ./myread
5565case "$ans" in
5566none) ldflags='';;
5567*) ldflags="$ans";;
5568esac
5569rmlist="$rmlist pdp11"
5570
5571: coherency check
5572echo " "
5573echo "Checking your choice of C compiler and flags for coherency..." >&4
5574$cat > try.c <<'EOF'
5575#include <stdio.h>
5576int main() { printf("Ok\n"); return(0); }
5577EOF
5578set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5579shift
5580$cat >try.msg <<'EOM'
5581I've tried to compile and run the following simple program:
5582
5583EOM
5584$cat try.c >> try.msg
5585
5586$cat >> try.msg <<EOM
5587
5588I used the command:
5589
5590	$*
5591	$run ./try
5592
5593and I got the following output:
5594
5595EOM
5596dflt=y
5597if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5598	if $sh -c "$run ./try " >>try.msg 2>&1; then
5599		xxx=`$run ./try`
5600		case "$xxx" in
5601		"Ok") dflt=n ;;
5602		*)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5603		esac
5604	else
5605		echo "The program compiled OK, but exited with status $?." >>try.msg
5606		rp="You have a problem.  Shall I abort Configure"
5607		dflt=y
5608	fi
5609else
5610	echo "I can't compile the test program." >>try.msg
5611	rp="You have a BIG problem.  Shall I abort Configure"
5612	dflt=y
5613fi
5614case "$dflt" in
5615y)
5616	$cat try.msg >&4
5617	case "$knowitall" in
5618	'')
5619		echo "(The supplied flags or libraries might be incorrect.)"
5620		;;
5621	*) dflt=n;;
5622	esac
5623	echo " "
5624	. ./myread
5625	case "$ans" in
5626	n*|N*) ;;
5627	*)	echo "Ok.  Stopping Configure." >&4
5628		exit 1
5629		;;
5630	esac
5631	;;
5632n) echo "OK, that should do.";;
5633esac
5634$rm_try gcctest gcctest.out
5635
5636: define a shorthand compile call
5637compile='
5638mc_file=$1;
5639shift;
5640case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5641echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5642exit 1;
5643fi;
5644esac;
5645$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5646: define a shorthand compile call for compilations that should be ok.
5647compile_ok='
5648mc_file=$1;
5649shift;
5650$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5651
5652: determine filename position in cpp output
5653echo " "
5654echo "Computing filename position in cpp output for #include directives..." >&4
5655case "$osname" in
5656vos) testaccess=-e ;;
5657*)   testaccess=-r ;;
5658esac
5659echo '#include <stdio.h>' > foo.c
5660$cat >fieldn <<EOF
5661$startsh
5662$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5663$grep '^[ 	]*#.*stdio\.h' | \
5664while read cline; do
5665	pos=1
5666	set \$cline
5667	while $test \$# -gt 0; do
5668		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5669			echo "\$pos"
5670			exit 0
5671		fi
5672		shift
5673		pos=\`expr \$pos + 1\`
5674	done
5675done
5676EOF
5677chmod +x fieldn
5678fieldn=`./fieldn`
5679$rm -f foo.c fieldn
5680case $fieldn in
5681'') pos='???';;
56821) pos=first;;
56832) pos=second;;
56843) pos=third;;
5685*) pos="${fieldn}th";;
5686esac
5687echo "Your cpp writes the filename in the $pos field of the line."
5688
5689: locate header file
5690$cat >findhdr <<EOF
5691$startsh
5692wanted=\$1
5693name=''
5694for usrincdir in $incpth
5695do
5696	if test -f \$usrincdir/\$wanted; then
5697		echo "\$usrincdir/\$wanted"
5698		exit 0
5699	fi
5700done
5701awkprg='{ print \$$fieldn }'
5702echo "#include <\$wanted>" > foo\$\$.c
5703$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5704$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5705while read cline; do
5706	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5707	case "\$name" in
5708	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5709	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5710	*) exit 2;;
5711	esac;
5712done;
5713#
5714# status = 0: grep returned 0 lines, case statement not executed
5715# status = 1: headerfile found
5716# status = 2: while loop executed, no headerfile found
5717#
5718status=\$?
5719$rm -f foo\$\$.c;
5720if test \$status -eq 1; then
5721	exit 0;
5722fi
5723exit 1
5724EOF
5725chmod +x findhdr
5726
5727: define an alternate in-header-list? function
5728inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5729cont=true; xxf="echo \"<\$1> found.\" >&4";
5730case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5731*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5732esac;
5733case $# in 4) instead=instead;; *) instead="at last";; esac;
5734while $test "$cont"; do
5735	xxx=`./findhdr $1`
5736	var=$2; eval "was=\$$2";
5737	if $test "$xxx" && $test -r "$xxx";
5738	then eval $xxf;
5739	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5740		cont="";
5741	else eval $xxnf;
5742	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5743	set $yyy; shift; shift; yyy=$@;
5744	case $# in 0) cont="";;
5745	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5746		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5747	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5748		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5749	esac;
5750done;
5751while $test "$yyy";
5752do set $yyy; var=$2; eval "was=\$$2";
5753	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5754	set $yyy; shift; shift; yyy=$@;
5755done'
5756
5757: see if stdlib is available
5758set stdlib.h i_stdlib
5759eval $inhdr
5760
5761: check for lengths of integral types
5762echo " "
5763case "$intsize" in
5764'')
5765	echo "Checking to see how big your integers are..." >&4
5766	$cat >try.c <<EOCP
5767#include <stdio.h>
5768#$i_stdlib I_STDLIB
5769#ifdef I_STDLIB
5770#include <stdlib.h>
5771#endif
5772int main()
5773{
5774	printf("intsize=%d;\n", (int)sizeof(int));
5775	printf("longsize=%d;\n", (int)sizeof(long));
5776	printf("shortsize=%d;\n", (int)sizeof(short));
5777	exit(0);
5778}
5779EOCP
5780	set try
5781	if eval $compile_ok && $run ./try > /dev/null; then
5782		eval `$run ./try`
5783		echo "Your integers are $intsize bytes long."
5784		echo "Your long integers are $longsize bytes long."
5785		echo "Your short integers are $shortsize bytes long."
5786	else
5787		$cat >&4 <<EOM
5788!
5789Help! I can't compile and run the intsize test program: please enlighten me!
5790(This is probably a misconfiguration in your system or libraries, and
5791you really ought to fix it.  Still, I'll try anyway.)
5792!
5793EOM
5794		dflt=4
5795		rp="What is the size of an integer (in bytes)?"
5796		. ./myread
5797		intsize="$ans"
5798		dflt=$intsize
5799		rp="What is the size of a long integer (in bytes)?"
5800		. ./myread
5801		longsize="$ans"
5802		dflt=2
5803		rp="What is the size of a short integer (in bytes)?"
5804		. ./myread
5805		shortsize="$ans"
5806	fi
5807	;;
5808esac
5809$rm_try
5810
5811: check for long long
5812echo " "
5813echo "Checking to see if you have long long..." >&4
5814echo 'int main() { long long x = 7; return 0; }' > try.c
5815set try
5816if eval $compile; then
5817	val="$define"
5818	echo "You have long long."
5819else
5820	val="$undef"
5821	echo "You do not have long long."
5822fi
5823$rm_try
5824set d_longlong
5825eval $setvar
5826
5827: check for length of long long
5828case "${d_longlong}${longlongsize}" in
5829$define)
5830	echo " "
5831	echo "Checking to see how big your long longs are..." >&4
5832	$cat >try.c <<'EOCP'
5833#include <stdio.h>
5834int main()
5835{
5836    printf("%d\n", (int)sizeof(long long));
5837    return(0);
5838}
5839EOCP
5840	set try
5841	if eval $compile_ok; then
5842		longlongsize=`$run ./try`
5843		echo "Your long longs are $longlongsize bytes long."
5844	else
5845		dflt='8'
5846		echo " "
5847		echo "(I can't seem to compile the test program.  Guessing...)"
5848		rp="What is the size of a long long (in bytes)?"
5849		. ./myread
5850		longlongsize="$ans"
5851	fi
5852	if $test "X$longsize" = "X$longlongsize"; then
5853		echo "(That isn't any different from an ordinary long.)"
5854	fi
5855	;;
5856esac
5857$rm_try
5858
5859: see if inttypes.h is available
5860: we want a real compile instead of Inhdr because some systems
5861: have an inttypes.h which includes non-existent headers
5862echo " "
5863$cat >try.c <<EOCP
5864#include <inttypes.h>
5865int main() {
5866	static int32_t foo32 = 0x12345678;
5867}
5868EOCP
5869set try
5870if eval $compile; then
5871	echo "<inttypes.h> found." >&4
5872	val="$define"
5873else
5874	echo "<inttypes.h> NOT found." >&4
5875	val="$undef"
5876fi
5877$rm_try
5878set i_inttypes
5879eval $setvar
5880
5881: check for int64_t
5882echo " "
5883echo "Checking to see if you have int64_t..." >&4
5884$cat >try.c <<EOCP
5885#include <sys/types.h>
5886#$i_inttypes I_INTTYPES
5887#ifdef I_INTTYPES
5888#include <inttypes.h>
5889#endif
5890int main() { int64_t x = 7; }
5891EOCP
5892set try
5893if eval $compile; then
5894	val="$define"
5895	echo "You have int64_t."
5896else
5897	val="$undef"
5898	echo "You do not have int64_t."
5899fi
5900$rm_try
5901set d_int64_t
5902eval $setvar
5903
5904: Check if 64bit ints have a quad type
5905echo " "
5906echo "Checking which 64-bit integer type we could use..." >&4
5907
5908case "$intsize" in
59098) val=int
5910   set quadtype
5911   eval $setvar
5912   val='"unsigned int"'
5913   set uquadtype
5914   eval $setvar
5915   quadkind=1
5916   ;;
5917*) case "$longsize" in
5918   8) val=long
5919      set quadtype
5920      eval $setvar
5921      val='"unsigned long"'
5922      set uquadtype
5923      eval $setvar
5924      quadkind=2
5925      ;;
5926   *) case "$d_longlong:$longlongsize" in
5927      define:8)
5928        val='"long long"'
5929        set quadtype
5930        eval $setvar
5931        val='"unsigned long long"'
5932        set uquadtype
5933        eval $setvar
5934        quadkind=3
5935        ;;
5936      *) case "$d_int64_t" in
5937         define)
5938           val=int64_t
5939           set quadtype
5940           eval $setvar
5941           val=uint64_t
5942           set uquadtype
5943           eval $setvar
5944           quadkind=4
5945           ;;
5946         esac
5947         ;;
5948      esac
5949      ;;
5950   esac
5951   ;;
5952esac
5953
5954case "$quadtype" in
5955'')	echo "Alas, no 64-bit integer types in sight." >&4
5956	d_quad="$undef"
5957	;;
5958*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5959	d_quad="$define"
5960	;;
5961esac
5962
5963: Do we want 64bit support
5964case "$uselonglong" in
5965"$define"|true|[yY]*)
5966	cat <<EOM >&4
5967
5968*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5969EOM
5970	use64bitint="$define"
5971	;;
5972esac
5973case "$use64bits" in
5974"$define"|true|[yY]*)
5975	cat <<EOM >&4
5976
5977*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5978EOM
5979	use64bitint="$define"
5980	;;
5981esac
5982case "$use64bitints" in
5983"$define"|true|[yY]*)
5984	cat <<EOM >&4
5985
5986*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5987EOM
5988	use64bitint="$define"
5989	;;
5990esac
5991case "$use64bitsint" in
5992"$define"|true|[yY]*)
5993	cat <<EOM >&4
5994
5995*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5996EOM
5997	use64bitint="$define"
5998	;;
5999esac
6000case "$uselonglongs" in
6001"$define"|true|[yY]*)
6002	cat <<EOM >&4
6003
6004*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6005EOM
6006	use64bitint="$define"
6007	;;
6008esac
6009case "$use64bitsall" in
6010"$define"|true|[yY]*)
6011	cat <<EOM >&4
6012
6013*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6014EOM
6015	use64bitall="$define"
6016	;;
6017esac
6018
6019case "$ccflags" in
6020*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6021esac
6022case "$use64bitall" in
6023"$define"|true|[yY]*) use64bitint="$define" ;;
6024esac
6025
6026case "$longsize" in
60278) cat <<EOM
6028
6029You have natively 64-bit long integers.
6030EOM
6031   val="$define"
6032   ;;
6033*) case "$use64bitint" in
6034   "$define"|true|[yY]*) dflt='y';;
6035   *) dflt='n';;
6036   esac
6037   case "$d_quad" in
6038   "$define") ;;
6039   *) dflt='n' ;;
6040   esac
6041   cat <<EOM
6042
6043Perl can be built to take advantage of 64-bit integer types
6044on some systems.  To do so, Configure can be run with -Duse64bitint.
6045Choosing this option will most probably introduce binary incompatibilities.
6046
6047If this doesn't make any sense to you, just accept the default '$dflt'.
6048(The default has been chosen based on your configuration.)
6049EOM
6050   rp='Try to use 64-bit integers, if available?'
6051   . ./myread
6052   case "$ans" in
6053   [yY]*) val="$define" ;;
6054   *)     val="$undef"  ;;
6055   esac
6056   ;;
6057esac
6058set use64bitint
6059eval $setvar
6060
6061case "$use64bitall" in
6062"$define"|true|[yY]*) dflt='y' ;;
6063*) case "$longsize" in
6064   8) dflt='y' ;;
6065   *) dflt='n' ;;
6066   esac
6067   ;;
6068esac
6069cat <<EOM
6070
6071You may also choose to try maximal 64-bitness.  It means using as much
607264-bitness as possible on the platform.  This in turn means even more
6073binary incompatibilities.  On the other hand, your platform may not
6074have any more 64-bitness available than what you already have chosen.
6075
6076If this doesn't make any sense to you, just accept the default '$dflt'.
6077(The default has been chosen based on your configuration.)
6078EOM
6079rp='Try to use maximal 64-bit support, if available?'
6080. ./myread
6081case "$ans" in
6082[yY]*) val="$define" ;;
6083*)     val="$undef"  ;;
6084esac
6085set use64bitall
6086eval $setvar
6087case "$use64bitall" in
6088"$define")
6089	case "$use64bitint" in
6090	"$undef")
6091		cat <<EOM
6092
6093Since you have chosen a maximally 64-bit build, I'm also turning on
6094the use of 64-bit integers.
6095EOM
6096		use64bitint="$define" ;;
6097	esac
6098	;;
6099esac
6100
6101: Look for a hint-file generated 'call-back-unit'.  If the
6102: user has specified that a 64-bit perl is to be built,
6103: we may need to set or change some other defaults.
6104if $test -f use64bitint.cbu; then
6105	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6106	. ./use64bitint.cbu
6107fi
6108case "$use64bitint" in
6109"$define"|true|[yY]*)
6110	: This test was common to all the OpenBSD forks, and seems harmless for
6111	: other platforms:
6112	echo " "
6113	echo "Checking if your C library has broken 64-bit functions..." >&4
6114	cat >try.c <<EOCP
6115#include <stdio.h>
6116typedef $uquadtype myULL;
6117int main (void)
6118{
6119    struct {
6120	double d;
6121	myULL  u;
6122    } *p, test[] = {
6123	{4294967303.15, 4294967303ULL},
6124	{4294967294.2,  4294967294ULL},
6125	{4294967295.7,  4294967295ULL},
6126	{0.0, 0ULL}
6127    };
6128    for (p = test; p->u; p++) {
6129	myULL x = (myULL)p->d;
6130	if (x != p->u) {
6131	    printf("buggy\n");
6132	    return 0;
6133	}
6134    }
6135    printf("ok\n");
6136    return 0;
6137}
6138EOCP
6139	set try
6140	if eval $compile_ok; then
6141	    libcquad=`$run ./try`
6142	    echo "Your C library's 64-bit functions are $libcquad."
6143	else
6144	    echo "(I can't seem to compile the test program.)"
6145	    echo "Assuming that your C library's 64-bit functions are ok."
6146	    libcquad="ok"
6147	fi
6148	$rm_try
6149
6150	case "$libcquad" in
6151	    buggy*)
6152		cat >&4 <<EOM
6153
6154*** You have a C library with broken 64-bit functions.
6155*** 64-bit support does not work reliably in this configuration.
6156*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6157*** Cannot continue, aborting.
6158
6159EOM
6160		exit 1
6161		;;
6162	esac
6163	case "$longsize" in
6164	4) case "$archname64" in
6165	   '') archname64=64int ;;
6166	   esac
6167	   ;;
6168	esac
6169	;;
6170esac
6171
6172: Look for a hint-file generated 'call-back-unit'.  If the
6173: user has specified that a maximally 64-bit perl is to be built,
6174: we may need to set or change some other defaults.
6175if $test -f use64bitall.cbu; then
6176	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6177	. ./use64bitall.cbu
6178fi
6179case "$use64bitall" in
6180"$define"|true|[yY]*)
6181	case "$longsize" in
6182	4) case "$archname64" in
6183	   ''|64int) archname64=64all ;;
6184	   esac
6185	   ;;
6186	esac
6187	;;
6188esac
6189
6190case "$d_quad:$use64bitint" in
6191$undef:$define)
6192	cat >&4 <<EOF
6193
6194*** You have chosen to use 64-bit integers,
6195*** but none can be found.
6196*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6197*** Cannot continue, aborting.
6198
6199EOF
6200	exit 1
6201	;;
6202esac
6203
6204: check for length of double
6205echo " "
6206case "$doublesize" in
6207'')
6208	echo "Checking to see how big your double precision numbers are..." >&4
6209	$cat >try.c <<EOCP
6210#include <stdio.h>
6211#$i_stdlib I_STDLIB
6212#ifdef I_STDLIB
6213#include <stdlib.h>
6214#endif
6215int main()
6216{
6217    printf("%d\n", (int)sizeof(double));
6218    exit(0);
6219}
6220EOCP
6221	set try
6222	if eval $compile_ok; then
6223		doublesize=`$run ./try`
6224		echo "Your double is $doublesize bytes long."
6225	else
6226		dflt='8'
6227		echo "(I can't seem to compile the test program.  Guessing...)"
6228		rp="What is the size of a double precision number (in bytes)?"
6229		. ./myread
6230		doublesize="$ans"
6231	fi
6232	;;
6233esac
6234$rm_try
6235
6236: check for long doubles
6237echo " "
6238echo "Checking to see if you have long double..." >&4
6239echo 'int main() { long double x = 7.0; }' > try.c
6240set try
6241if eval $compile; then
6242	val="$define"
6243	echo "You have long double."
6244else
6245	val="$undef"
6246	echo "You do not have long double."
6247fi
6248$rm_try
6249set d_longdbl
6250eval $setvar
6251
6252: check for length of long double
6253case "${d_longdbl}${longdblsize}" in
6254$define)
6255	echo " "
6256	echo "Checking to see how big your long doubles are..." >&4
6257	$cat >try.c <<'EOCP'
6258#include <stdio.h>
6259int main()
6260{
6261	printf("%d\n", sizeof(long double));
6262}
6263EOCP
6264	set try
6265	set try
6266	if eval $compile; then
6267		longdblsize=`$run ./try`
6268		echo "Your long doubles are $longdblsize bytes long."
6269	else
6270		dflt='8'
6271		echo " "
6272		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6273		rp="What is the size of a long double (in bytes)?"
6274		. ./myread
6275		longdblsize="$ans"
6276	fi
6277	if $test "X$doublesize" = "X$longdblsize"; then
6278		echo "That isn't any different from an ordinary double."
6279		echo "I'll keep your setting anyway, but you may see some"
6280		echo "harmless compilation warnings."
6281	fi
6282	;;
6283esac
6284$rm_try
6285
6286: determine the architecture name
6287echo " "
6288if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6289	tarch=`arch`"-$osname"
6290elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6291	if uname -m > tmparch 2>&1 ; then
6292		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6293			-e 's/$/'"-$osname/" tmparch`
6294	else
6295		tarch="$osname"
6296	fi
6297	$rm -f tmparch
6298else
6299	tarch="$osname"
6300fi
6301case "$myarchname" in
6302''|"$tarch") ;;
6303*)
6304	echo "(Your architecture name used to be $myarchname.)"
6305	archname=''
6306	;;
6307esac
6308case "$targetarch" in
6309'') ;;
6310*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6311esac
6312myarchname="$tarch"
6313case "$archname" in
6314'') dflt="$tarch";;
6315*) dflt="$archname";;
6316esac
6317rp='What is your architecture name'
6318. ./myread
6319archname="$ans"
6320
6321: optionally add API version to the architecture for versioned archlibs
6322case "$useversionedarchname" in
6323$define|true|[yY]*) dflt='y';;
6324*)                  dflt='n';;
6325esac
6326rp='Add the Perl API version to your archname?'
6327. ./myread
6328case "$ans" in
6329y|Y)	useversionedarchname="$define" ;;
6330*)      useversionedarchname="$undef" ;;
6331esac
6332case "$useversionedarchname" in
6333$define)
6334        case "$archname" in
6335        *-$api_versionstring)
6336                echo "...and architecture name already has -$api_versionstring" >&4
6337                ;;
6338        *)
6339                archname="$archname-$api_versionstring"
6340                echo "...setting architecture name to $archname." >&4
6341                ;;
6342        esac
6343        ;;
6344esac
6345
6346case "$usethreads" in
6347$define)
6348	echo "Threads selected." >&4
6349	case "$archname" in
6350        *-thread*) echo "...and architecture name already has -thread." >&4
6351                ;;
6352        *)      archname="$archname-thread"
6353                echo "...setting architecture name to $archname." >&4
6354                ;;
6355        esac
6356	;;
6357esac
6358case "$usemultiplicity" in
6359$define)
6360	echo "Multiplicity selected." >&4
6361	case "$archname" in
6362        *-multi*) echo "...and architecture name already has -multi." >&4
6363                ;;
6364        *)      archname="$archname-multi"
6365                echo "...setting architecture name to $archname." >&4
6366                ;;
6367        esac
6368	;;
6369esac
6370case "$use64bitint$use64bitall" in
6371*"$define"*)
6372	case "$archname64" in
6373	'')
6374		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6375		;;
6376	*)
6377		case "$use64bitint" in
6378		"$define") echo "64 bit integers selected." >&4 ;;
6379		esac
6380		case "$use64bitall" in
6381		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6382		esac
6383		case "$archname" in
6384	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6385	                ;;
6386	        *)      archname="$archname-$archname64"
6387	                echo "...setting architecture name to $archname." >&4
6388	                ;;
6389	        esac
6390		;;
6391	esac
6392esac
6393case "$uselongdouble" in
6394$define)
6395	echo "Long doubles selected." >&4
6396	case "$longdblsize" in
6397	$doublesize)
6398		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6399		;;
6400	*)
6401		case "$archname" in
6402	        *-ld*) echo "...and architecture name already has -ld." >&4
6403	                ;;
6404	        *)      archname="$archname-ld"
6405	                echo "...setting architecture name to $archname." >&4
6406        	        ;;
6407	        esac
6408		;;
6409	esac
6410	;;
6411esac
6412if $test -f archname.cbu; then
6413	echo "Your platform has some specific hints for architecture name, using them..."
6414	. ./archname.cbu
6415fi
6416
6417: set the prefixit variable, to compute a suitable default value
6418prefixit='case "$3" in
6419""|none)
6420	case "$oldprefix" in
6421	"") eval "$1=\"\$$2\"";;
6422	*)
6423		case "$3" in
6424		"") eval "$1=";;
6425		none)
6426			eval "tp=\"\$$2\"";
6427			case "$tp" in
6428			""|" ") eval "$1=\"\$$2\"";;
6429			*) eval "$1=";;
6430			esac;;
6431		esac;;
6432	esac;;
6433*)
6434	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6435	case "$tp" in
6436	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6437	/*-$oldprefix/*|\~*-$oldprefix/*)
6438		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6439	*) eval "$1=\"\$$2\"";;
6440	esac;;
6441esac'
6442
6443: determine installation style
6444: For now, try to deduce it from prefix unless it is already set.
6445: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6446case "$installstyle" in
6447'')	case "$prefix" in
6448		*perl*) dflt='lib';;
6449		*) dflt='lib/perl5' ;;
6450	esac
6451	;;
6452*)	dflt="$installstyle" ;;
6453esac
6454: Probably not worth prompting for this since we prompt for all
6455: the directories individually, and the prompt would be too long and
6456: confusing anyway.
6457installstyle=$dflt
6458
6459: determine where public executables go
6460echo " "
6461set dflt bin bin
6462eval $prefixit
6463fn=d~
6464rp='Pathname where the public executables will reside?'
6465. ./getfile
6466if $test "X$ansexp" != "X$binexp"; then
6467	installbin=''
6468fi
6469prefixvar=bin
6470: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6471: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6472:     this via initialinstalllocation
6473. ./setprefixvar
6474
6475case "$userelocatableinc" in
6476$define|true|[yY]*)	dflt='y' ;;
6477*)			dflt='n' ;;
6478esac
6479cat <<EOM
6480
6481Would you like to build Perl so that the installation is relocatable, so that
6482library paths in @INC are determined relative to the path of the perl binary?
6483This is not advised for system Perl installs, or if you need to run setid
6484scripts or scripts under taint mode.
6485
6486If this doesn't make any sense to you, just accept the default '$dflt'.
6487EOM
6488rp='Use relocatable @INC?'
6489. ./myread
6490case "$ans" in
6491y|Y)	val="$define" ;;
6492*)	val="$undef"  ;;
6493esac
6494set userelocatableinc
6495eval $setvar
6496
6497initialinstalllocation="$binexp"
6498: Default prefix is now "up one level from where the binaries are"
6499case "$userelocatableinc" in
6500$define|true|[yY]*)
6501    bin=".../"
6502    binexp=".../"
6503    prefix=".../.."
6504    prefixexp=".../.."
6505    installprefixexp=".../.."
6506    ;;
6507esac
6508
6509: determine where private library files go
6510: Usual default is /usr/local/lib/perl5/$version.
6511: Also allow things like /opt/perl/lib/$version, since
6512: /opt/perl/lib/perl5... would be redundant.
6513: The default "style" setting is made in installstyle.U
6514case "$installstyle" in
6515*lib/perl5*) set dflt privlib lib/$package/$version ;;
6516*)	 set dflt privlib lib/$version ;;
6517esac
6518eval $prefixit
6519$cat <<EOM
6520
6521There are some auxiliary files for $package that need to be put into a
6522private library directory that is accessible by everyone.
6523
6524EOM
6525fn=$binexp
6526fn=d~+
6527rp='Pathname where the private library files will reside?'
6528. ./getfile
6529prefixvar=privlib
6530. ./setprefixvar
6531
6532: set the prefixup variable, to restore leading tilda escape
6533prefixup='case "$prefixexp" in
6534"$prefix") ;;
6535*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6536esac'
6537
6538: determine where public architecture dependent libraries go
6539set archlib archlib
6540eval $prefixit
6541: privlib default is /usr/local/lib/$package/$version
6542: archlib default is /usr/local/lib/$package/$version/$archname
6543: privlib may have an optional trailing /share.
6544tdflt=`echo $privlib | $sed 's,/share$,,'`
6545tdflt=$tdflt/$archname
6546case "$archlib" in
6547'')	dflt=$tdflt
6548	;;
6549*)	dflt="$archlib"
6550    ;;
6551esac
6552$cat <<EOM
6553
6554$spackage contains architecture-dependent library files.  If you are
6555sharing libraries in a heterogeneous environment, you might store
6556these files in a separate location.  Otherwise, you can just include
6557them with the rest of the public library files.
6558
6559EOM
6560fn=$binexp
6561fn=d+~
6562rp='Where do you want to put the public architecture-dependent libraries?'
6563. ./getfile
6564prefixvar=archlib
6565. ./setprefixvar
6566if $test X"$archlib" = X"$privlib"; then
6567	d_archlib="$undef"
6568else
6569	d_archlib="$define"
6570fi
6571
6572: see if setuid scripts can be secure
6573$cat <<EOM
6574
6575Some kernels have a bug that prevents setuid #! scripts from being
6576secure.  Some sites have disabled setuid #! scripts because of this.
6577
6578First let's decide if your kernel supports secure setuid #! scripts.
6579(If setuid #! scripts would be secure but have been disabled anyway,
6580don't say that they are secure if asked.)
6581
6582EOM
6583
6584val="$undef"
6585if $test -d /dev/fd; then
6586	echo "#!$ls" >reflect
6587	chmod +x,u+s reflect
6588	./reflect >flect 2>&1
6589	if $contains "/dev/fd" flect >/dev/null; then
6590		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6591		val="$define"
6592	else
6593		$cat <<EOM
6594If you are not sure if they are secure, I can check but I'll need a
6595username and password different from the one you are using right now.
6596If you don't have such a username or don't want me to test, simply
6597enter 'none'.
6598
6599EOM
6600		rp='Other username to test security of setuid scripts with?'
6601		dflt='none'
6602		. ./myread
6603		case "$ans" in
6604		n|none)
6605			case "$d_suidsafe" in
6606			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6607				dflt=n;;
6608			"$undef")
6609				echo "Well, the $hint value is *not* secure." >&4
6610				dflt=n;;
6611			*)	echo "Well, the $hint value *is* secure." >&4
6612				dflt=y;;
6613			esac
6614			;;
6615		*)
6616			$rm -f reflect flect
6617			echo "#!$ls" >reflect
6618			chmod +x,u+s reflect
6619			echo >flect
6620			chmod a+w flect
6621			echo '"su" will (probably) prompt you for '"$ans's password."
6622			su $ans -c './reflect >flect'
6623			if $contains "/dev/fd" flect >/dev/null; then
6624				echo "Okay, it looks like setuid scripts are secure." >&4
6625				dflt=y
6626			else
6627				echo "I don't think setuid scripts are secure." >&4
6628				dflt=n
6629			fi
6630			;;
6631		esac
6632		rp='Does your kernel have *secure* setuid scripts?'
6633		. ./myread
6634		case "$ans" in
6635		[yY]*)	val="$define";;
6636		*)	val="$undef";;
6637		esac
6638	fi
6639else
6640	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6641	echo "(That's for file descriptors, not floppy disks.)"
6642	val="$undef"
6643fi
6644set d_suidsafe
6645eval $setvar
6646
6647$rm -f reflect flect
6648
6649: now see if they want to do setuid emulation
6650if $test $patchlevel -lt 11; then
6651echo " "
6652val="$undef"
6653case "$d_suidsafe" in
6654"$define")
6655	val="$undef"
6656	echo "No need to emulate SUID scripts since they are secure here." >&4
6657	;;
6658*)
6659	$cat <<EOM
6660Some systems have disabled setuid scripts, especially systems where
6661setuid scripts cannot be secure.  On systems where setuid scripts have
6662been disabled, the setuid/setgid bits on scripts are currently
6663useless.  It is possible for $package to detect those bits and emulate
6664setuid/setgid in a secure fashion.  This emulation will only work if
6665setuid scripts have been disabled in your kernel.
6666
6667EOM
6668	case "$d_dosuid" in
6669	"$define") dflt=y ;;
6670	*) dflt=n ;;
6671	esac
6672	rp="Do you want to do setuid/setgid emulation?"
6673	. ./myread
6674	case "$ans" in
6675	[yY]*)	val="$define";;
6676	*)	val="$undef";;
6677	esac
6678	;;
6679esac
6680set d_dosuid
6681eval $setvar
6682else
6683    case "$d_dosuid" in
6684	"$define")
6685	cat >&4 <<EOH
6686
6687SUID emulation has been removed for 5.12
6688Please re-run Configure without -Dd_dosuid
6689
6690EOH
6691	exit 1;
6692	;;
6693    esac
6694    d_dosuid=undef
6695fi
6696
6697: Find perl5.005 or later.
6698echo "Looking for a previously installed perl5.005 or later... "
6699case "$perl5" in
6700'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6701		: Check if this perl is recent and can load a simple module
6702		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6703			perl5=$tdir/perl
6704			break;
6705		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6706			perl5=$tdir/perl5
6707			break;
6708		fi
6709	done
6710	;;
6711*)	perl5="$perl5"
6712	;;
6713esac
6714case "$perl5" in
6715'')	echo "None found.  That's ok.";;
6716*)	echo "Using $perl5." ;;
6717esac
6718
6719: Set the siteprefix variables
6720$cat <<EOM
6721
6722After $package is installed, you may wish to install various
6723add-on modules and utilities.  Typically, these add-ons will
6724be installed under $prefix with the rest
6725of this package.  However, you may wish to install such add-ons
6726elsewhere under a different prefix.
6727
6728If you do not wish to put everything under a single prefix, that's
6729ok.  You will be prompted for the individual locations; this siteprefix
6730is only used to suggest the defaults.
6731
6732The default should be fine for most people.
6733
6734EOM
6735fn=d~+
6736rp='Installation prefix to use for add-on modules and utilities?'
6737: XXX Here might be another good place for an installstyle setting.
6738case "$siteprefix" in
6739'') dflt=$prefix ;;
6740*)  dflt=$siteprefix ;;
6741esac
6742. ./getfile
6743: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6744oldsiteprefix=''
6745case "$siteprefix" in
6746'') ;;
6747*)	case "$ans" in
6748	"$prefix") ;;
6749	*) oldsiteprefix="$prefix";;
6750	esac
6751	;;
6752esac
6753siteprefix="$ans"
6754siteprefixexp="$ansexp"
6755
6756: determine where site specific libraries go.
6757: Usual default is /usr/local/lib/perl5/site_perl/$version
6758: The default "style" setting is made in installstyle.U
6759: XXX No longer works with Prefixit stuff.
6760prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6761case "$sitelib" in
6762'') case "$installstyle" in
6763	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6764	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6765	esac
6766	;;
6767*)	dflt="$sitelib"
6768	;;
6769esac
6770$cat <<EOM
6771
6772The installation process will create a directory for
6773site-specific extensions and modules.  Most users find it convenient
6774to place all site-specific files in this directory rather than in the
6775main distribution directory.
6776
6777EOM
6778fn=d~+
6779rp='Pathname for the site-specific library files?'
6780. ./getfile
6781prefixvar=sitelib
6782. ./setprefixvar
6783sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6784
6785: Determine list of previous versions to include in @INC
6786$cat > getverlist <<EOPL
6787#!$perl5 -w
6788use File::Basename;
6789\$api_versionstring = "$api_versionstring";
6790\$version = "$version";
6791\$stem = "$sitelib_stem";
6792\$archname = "$archname";
6793EOPL
6794	$cat >> getverlist <<'EOPL'
6795# The list found is store twice for each entry: the original name, and
6796# the binary broken down version as pack "sss", so sorting is easy and
6797# unambiguous. This will work for all versions that have a maximum of
6798# three digit groups, separate by '.'s or '_'s. Names are extended with
6799# ".0.0" to ensure at least three elements for the pack.
6800#					-- H.Merijn Brand (m)'06 23-10-2006
6801
6802# Can't have leading @ because metaconfig interprets it as a command!
6803;@inc_version_list=();
6804# XXX Redo to do opendir/readdir?
6805if (-d $stem) {
6806    chdir($stem);
6807    ;@candidates = map {
6808	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6809    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6810}
6811else {
6812    ;@candidates = ();
6813}
6814
6815($pversion, $aversion, $vsn5005) = map {
6816    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6817foreach $d (@candidates) {
6818    if ($d->[1] lt $pversion) {
6819	if ($d->[1] ge $aversion) {
6820	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6821	}
6822	elsif ($d->[1] ge $vsn5005) {
6823	    unshift(@inc_version_list, grep { -d } $d->[0]);
6824	}
6825    }
6826    else {
6827	# Skip newer version.  I.e. don't look in
6828	# 5.7.0 if we're installing 5.6.1.
6829    }
6830}
6831
6832if (@inc_version_list) {
6833    print join(' ', @inc_version_list);
6834}
6835else {
6836    # Blank space to preserve value for next Configure run.
6837    print " ";
6838}
6839EOPL
6840chmod +x getverlist
6841case "$inc_version_list" in
6842'')	if test -x "$perl5$exe_ext"; then
6843		dflt=`$perl5 getverlist`
6844	else
6845		dflt='none'
6846	fi
6847	;;
6848$undef) dflt='none' ;;
6849*)  eval dflt=\"$inc_version_list\" ;;
6850esac
6851case "$dflt" in
6852''|' ') dflt=none ;;
6853esac
6854case "$dflt" in
68555.005) dflt=none ;;
6856esac
6857$cat <<EOM
6858
6859In order to ease the process of upgrading, this version of perl
6860can be configured to use modules built and installed with earlier
6861versions of perl that were installed under $prefix.  Specify here
6862the list of earlier versions that this version of perl should check.
6863If Configure detected no earlier versions of perl installed under
6864$prefix, then the list will be empty.  Answer 'none' to tell perl
6865to not search earlier versions.
6866
6867The default should almost always be sensible, so if you're not sure,
6868just accept the default.
6869EOM
6870
6871rp='List of earlier versions to include in @INC?'
6872. ./myread
6873case "$ans" in
6874[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6875*) inc_version_list="$ans" ;;
6876esac
6877case "$inc_version_list" in
6878''|' ')
6879	inc_version_list_init='0'
6880	d_inc_version_list="$undef"
6881	;;
6882*)	inc_version_list_init=`echo $inc_version_list |
6883		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6884	d_inc_version_list="$define"
6885	;;
6886esac
6887$rm -f getverlist
6888
6889: see if malloc/malloc.h has to be included
6890set malloc/malloc.h i_mallocmalloc
6891eval $inhdr
6892
6893: see if this is a malloc.h system
6894: we want a real compile instead of Inhdr because some systems have a
6895: malloc.h that just gives a compile error saying to use stdlib.h instead
6896echo " "
6897$cat >try.c <<EOCP
6898#include <stdlib.h>
6899#include <malloc.h>
6900#$i_mallocmalloc I_MALLOCMALLOC
6901#ifdef I_MALLOCMALLOC
6902# include <malloc/malloc.h>
6903#endif
6904
6905int main () { return 0; }
6906EOCP
6907set try
6908if eval $compile; then
6909    echo "<malloc.h> found." >&4
6910    val="$define"
6911else
6912    echo "<malloc.h> NOT found." >&4
6913    val="$undef"
6914fi
6915$rm_try
6916set i_malloc
6917eval $setvar
6918
6919: check for length of pointer
6920echo " "
6921case "$ptrsize" in
6922'')
6923	echo "Checking to see how big your pointers are..." >&4
6924	$cat >>try.c <<EOCP
6925#include <stdio.h>
6926#$i_stdlib I_STDLIB
6927#ifdef I_STDLIB
6928#include <stdlib.h>
6929#endif
6930int main()
6931{
6932    printf("%d\n", (int)sizeof(void *));
6933    exit(0);
6934}
6935EOCP
6936	set try
6937	if eval $compile_ok; then
6938		ptrsize=`$run ./try`
6939		echo "Your pointers are $ptrsize bytes long."
6940	else
6941		dflt='4'
6942		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6943		rp="What is the size of a pointer (in bytes)?"
6944		. ./myread
6945		ptrsize="$ans"
6946	fi
6947	;;
6948esac
6949$rm_try
6950case "$use64bitall" in
6951"$define"|true|[yY]*)
6952	case "$ptrsize" in
6953	4)	cat <<EOM >&4
6954
6955*** You have chosen a maximally 64-bit build,
6956*** but your pointers are only 4 bytes wide.
6957*** Please rerun Configure without -Duse64bitall.
6958EOM
6959		case "$d_quad" in
6960		define)
6961			cat <<EOM >&4
6962*** Since you have quads, you could possibly try with -Duse64bitint.
6963EOM
6964			;;
6965		esac
6966		cat <<EOM >&4
6967*** Cannot continue, aborting.
6968
6969EOM
6970
6971		exit 1
6972		;;
6973	esac
6974	;;
6975esac
6976
6977
6978: determine whether to use malloc wrapping
6979echo " "
6980case "$usemallocwrap" in
6981[yY]*|true|$define)	dflt='y' ;;
6982[nN]*|false|$undef)	dflt='n' ;;
6983*)	case "$usedevel" in
6984	[yY]*|true|$define)	dflt='y' ;;
6985	*) dflt='n' ;;
6986	esac
6987	;;
6988esac
6989rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6990. ./myread
6991usemallocwrap="$ans"
6992case "$ans" in
6993y*|true)
6994	usemallocwrap="$define" ;;
6995*)
6996	usemallocwrap="$undef" ;;
6997esac
6998
6999: determine which malloc to compile in
7000echo " "
7001case "$usemymalloc" in
7002[yY]*|true|$define)	dflt='y' ;;
7003[nN]*|false|$undef)	dflt='n' ;;
7004*)	case "$ptrsize" in
7005	4) dflt='y' ;;
7006	*) dflt='n' ;;
7007	esac
7008	if test "$useithreads" = "$define"; then dflt='n'; fi
7009	;;
7010esac
7011rp="Do you wish to attempt to use the malloc that comes with $package?"
7012. ./myread
7013usemymalloc="$ans"
7014case "$ans" in
7015y*|true)
7016	usemymalloc='y'
7017	mallocsrc='malloc.c'
7018	mallocobj="malloc$_o"
7019	d_mymalloc="$define"
7020	case "$libs" in
7021	*-lmalloc*)
7022		: Remove malloc from list of libraries to use
7023		echo "Removing unneeded -lmalloc from library list" >&4
7024		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7025		shift
7026		libs="$*"
7027		echo "libs = $libs" >&4
7028		;;
7029	esac
7030	;;
7031*)
7032	usemymalloc='n'
7033	mallocsrc=''
7034	mallocobj=''
7035	d_mymalloc="$undef"
7036	;;
7037esac
7038
7039: compute the return types of malloc and free
7040echo " "
7041$cat >malloc.c <<END
7042#$i_malloc I_MALLOC
7043#$i_stdlib I_STDLIB
7044#include <stdio.h>
7045#include <sys/types.h>
7046#ifdef I_MALLOC
7047#include <malloc.h>
7048#endif
7049#ifdef I_STDLIB
7050#include <stdlib.h>
7051#endif
7052#ifdef TRY_MALLOC
7053void *malloc();
7054#endif
7055#ifdef TRY_FREE
7056void free();
7057#endif
7058END
7059case "$malloctype" in
7060'')
7061	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7062		malloctype='void *'
7063	else
7064		malloctype='char *'
7065	fi
7066	;;
7067esac
7068echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7069
7070case "$freetype" in
7071'')
7072	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7073		freetype='void'
7074	else
7075		freetype='int'
7076	fi
7077	;;
7078esac
7079echo "Your system uses $freetype free(), it would seem." >&4
7080$rm -f malloc.[co]
7081: determine where site specific architecture-dependent libraries go.
7082: sitelib  default is /usr/local/lib/perl5/site_perl/$version
7083: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7084: sitelib may have an optional trailing /share.
7085case "$sitearch" in
7086'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
7087	dflt="$dflt/$archname"
7088	;;
7089*)	dflt="$sitearch"
7090	;;
7091esac
7092set sitearch sitearch none
7093eval $prefixit
7094$cat <<EOM
7095
7096The installation process will also create a directory for
7097architecture-dependent site-specific extensions and modules.
7098
7099EOM
7100fn=d~+
7101rp='Pathname for the site-specific architecture-dependent library files?'
7102. ./getfile
7103prefixvar=sitearch
7104. ./setprefixvar
7105if $test X"$sitearch" = X"$sitelib"; then
7106	d_sitearch="$undef"
7107else
7108	d_sitearch="$define"
7109fi
7110
7111: Set the vendorprefix variables
7112$cat <<EOM
7113
7114The installation process will also create a directory for
7115vendor-supplied add-ons.  Vendors who supply perl with their system
7116may find it convenient to place all vendor-supplied files in this
7117directory rather than in the main distribution directory.  This will
7118ease upgrades between binary-compatible maintenance versions of perl.
7119
7120Of course you may also use these directories in whatever way you see
7121fit.  For example, you might use them to access modules shared over a
7122company-wide network.
7123
7124The default answer should be fine for most people.
7125This causes further questions about vendor add-ons to be skipped
7126and no vendor-specific directories will be configured for perl.
7127
7128EOM
7129rp='Do you want to configure vendor-specific add-on directories?'
7130case "$usevendorprefix" in
7131define|true|[yY]*) dflt=y ;;
7132*)	: User may have set vendorprefix directly on Configure command line.
7133	case "$vendorprefix" in
7134	''|' ') dflt=n ;;
7135	*)	dflt=y ;;
7136	esac
7137	;;
7138esac
7139. ./myread
7140case "$ans" in
7141[yY]*)	fn=d~+
7142	rp='Installation prefix to use for vendor-supplied add-ons?'
7143	case "$vendorprefix" in
7144	'') dflt="$prefix" ;;
7145	*)  dflt=$vendorprefix ;;
7146	esac
7147	. ./getfile
7148	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7149	oldvendorprefix=''
7150	case "$vendorprefix" in
7151	'') ;;
7152	*)	case "$ans" in
7153		"$prefix") ;;
7154		*) oldvendorprefix="$prefix";;
7155		esac
7156		;;
7157	esac
7158	usevendorprefix="$define"
7159	vendorprefix="$ans"
7160	vendorprefixexp="$ansexp"
7161	;;
7162*)	usevendorprefix="$undef"
7163	vendorprefix=''
7164	vendorprefixexp=''
7165	;;
7166esac
7167
7168: Set the vendorlib variables
7169case "$vendorprefix" in
7170'')	d_vendorlib="$undef"
7171	vendorlib=''
7172	vendorlibexp=''
7173	;;
7174*)	d_vendorlib="$define"
7175	: determine where vendor-supplied modules go.
7176	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
7177	case "$vendorlib" in
7178	'')
7179		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7180		case "$installstyle" in
7181		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7182		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7183		esac
7184		;;
7185	*)	dflt="$vendorlib"
7186		;;
7187	esac
7188	fn=d~+
7189	rp='Pathname for the vendor-supplied library files?'
7190	. ./getfile
7191	vendorlib="$ans"
7192	vendorlibexp="$ansexp"
7193	;;
7194esac
7195vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7196prefixvar=vendorlib
7197. ./installprefix
7198
7199: Set the vendorarch variables
7200case "$vendorprefix" in
7201'')	d_vendorarch="$undef"
7202	vendorarch=''
7203	vendorarchexp=''
7204	;;
7205*)	d_vendorarch="$define"
7206	: determine where vendor-supplied architecture-dependent libraries go.
7207	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7208	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7209	: vendorlib may have an optional trailing /share.
7210	case "$vendorarch" in
7211	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
7212		dflt="$dflt/$archname"
7213		;;
7214	*)	dflt="$vendorarch" ;;
7215	esac
7216	fn=d~+
7217	rp='Pathname for vendor-supplied architecture-dependent files?'
7218	. ./getfile
7219	vendorarch="$ans"
7220	vendorarchexp="$ansexp"
7221	;;
7222esac
7223prefixvar=vendorarch
7224. ./installprefix
7225if $test X"$vendorarch" = X"$vendorlib"; then
7226	d_vendorarch="$undef"
7227else
7228	d_vendorarch="$define"
7229fi
7230
7231: Final catch-all directories to search
7232$cat <<EOM
7233
7234Lastly, you can have perl look in other directories for extensions and
7235modules in addition to those already specified.
7236These directories will be searched after
7237	$sitearch
7238	$sitelib
7239EOM
7240test X"$vendorlib" != "X" && echo '	' $vendorlib
7241test X"$vendorarch" != "X" && echo '	' $vendorarch
7242echo ' '
7243case "$otherlibdirs" in
7244''|' ') dflt='none' ;;
7245*)	dflt="$otherlibdirs" ;;
7246esac
7247$cat <<EOM
7248Enter a colon-separated set of extra paths to include in perl's @INC
7249search path, or enter 'none' for no extra paths.
7250
7251EOM
7252
7253rp='Colon-separated list of additional directories for perl to search?'
7254. ./myread
7255case "$ans" in
7256' '|''|none)	otherlibdirs=' ' ;;
7257*)	otherlibdirs="$ans" ;;
7258esac
7259case "$otherlibdirs" in
7260' ') val=$undef ;;
7261*)	val=$define ;;
7262esac
7263set d_perl_otherlibdirs
7264eval $setvar
7265
7266: Cruising for prototypes
7267echo " "
7268echo "Checking out function prototypes..." >&4
7269$cat >prototype.c <<EOCP
7270#$i_stdlib I_STDLIB
7271#ifdef I_STDLIB
7272#include <stdlib.h>
7273#endif
7274int main(int argc, char *argv[]) {
7275	exit(0);}
7276EOCP
7277if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7278	echo "Your C compiler appears to support function prototypes."
7279	val="$define"
7280else
7281	echo "Your C compiler doesn't seem to understand function prototypes."
7282	val="$undef"
7283fi
7284set prototype
7285eval $setvar
7286$rm -f prototype*
7287
7288: Check if ansi2knr is required
7289case "$prototype" in
7290"$define") ;;
7291*)	ansi2knr='ansi2knr'
7292	echo " "
7293	cat <<EOM >&4
7294
7295$me:  FATAL ERROR:
7296This version of $package can only be compiled by a compiler that 
7297understands function prototypes.  Unfortunately, your C compiler 
7298	$cc $ccflags
7299doesn't seem to understand them.  Sorry about that.
7300
7301If GNU cc is available for your system, perhaps you could try that instead.  
7302
7303Eventually, we hope to support building Perl with pre-ANSI compilers.
7304If you would like to help in that effort, please contact <perlbug@perl.org>.
7305
7306Aborting Configure now.
7307EOM
7308	exit 2
7309	;;
7310esac
7311
7312: DTrace support
7313dflt_dtrace='/usr/sbin/dtrace'
7314$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7315
7316cat <<EOM
7317
7318Perl can be built to support DTrace on platforms that support it.
7319DTrace is a diagnosis and performance analysis tool from Sun.
7320
7321If this doesn't make any sense to you, just accept the default '$dflt'.
7322EOM
7323
7324while $test 1 ; do
7325	case "$usedtrace" in
7326	$define|true|[yY]*)
7327		dflt='y'
7328		;;
7329	?*)
7330		dflt='y'
7331		dflt_dtrace=$usedtrace
7332		;;
7333	*)
7334		dflt='n'
7335		;;
7336	esac
7337
7338	rp='Support DTrace if available?'
7339	. ./myread
7340	case "$ans" in
7341	y|Y)	val="$define" ;;
7342	*)      val="$undef" ;;
7343	esac
7344	set usedtrace
7345	eval $setvar
7346
7347	test "X$usedtrace" != "X$define" && break
7348
7349	echo " "
7350	rp='Where is the dtrace executable?'
7351	dflt=$dflt_dtrace
7352	. ./getfile
7353	val="$ans"
7354	set dtrace
7355	eval $setvar
7356
7357	if $test -f $dtrace
7358	then
7359		if $dtrace -h -s ../perldtrace.d \
7360			-o perldtrace.tmp >/dev/null 2>&1 \
7361			&& rm -f perldtrace.tmp
7362		then
7363			echo " "
7364			echo "Good: your $dtrace knows about the -h flag."
7365		else
7366			cat >&2 <<EOM
7367
7368*** $me:  Fatal Error:  $dtrace doesn't support -h flag
7369***
7370*** Your installed dtrace doesn't support the -h switch to compile a D
7371*** program into a C header. Can't continue.
7372
7373EOM
7374			exit 1
7375		fi
7376		break;
7377	fi
7378
7379	case "$fastread" in
7380	yes)
7381		cat >&2 <<EOM
7382
7383*** $me:  Fatal Error:  $dtrace not found.
7384*** Can't continue.
7385
7386EOM
7387		exit 1
7388		;;
7389	*)
7390		echo "*** $dtrace was not found."
7391		echo " "
7392		;;
7393	esac
7394done
7395
7396: See if we want extra modules installed
7397echo " "
7398case "$extras" in
7399'') dflt='n';;
7400*) dflt='y';;
7401esac
7402cat <<EOM
7403Perl can be built with extra modules or bundles of modules which
7404will be fetched from the CPAN and installed alongside Perl.
7405
7406Notice that you will need access to the CPAN; either via the Internet,
7407or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7408be asked later to configure the CPAN.pm module which will in turn do
7409the installation of the rest of the extra modules or bundles.)
7410
7411Notice also that if the modules require any external software such as
7412libraries and headers (the libz library and the zlib.h header for the
7413Compress::Zlib module, for example) you MUST have any such software
7414already installed, this configuration process will NOT install such
7415things for you.
7416
7417If this doesn't make any sense to you, just accept the default '$dflt'.
7418EOM
7419rp='Install any extra modules (y or n)?'
7420. ./myread
7421case "$ans" in
7422y|Y)
7423	cat <<EOM
7424
7425Please list any extra modules or bundles to be installed from CPAN,
7426with spaces between the names.  The names can be in any format the
7427'install' command of CPAN.pm will understand.  (Answer 'none',
7428without the quotes, to install no extra modules or bundles.)
7429EOM
7430	rp='Extras?'
7431	dflt="$extras"
7432	. ./myread
7433	extras="$ans"
7434esac
7435case "$extras" in
7436''|'none')
7437	val=''
7438	$rm -f ../extras.lst
7439	;;
7440*)	echo "(Saving the list of extras for later...)"
7441	echo "$extras" > ../extras.lst
7442	val="'$extras'"
7443	;;
7444esac
7445set extras
7446eval $setvar
7447echo " "
7448
7449: determine where html pages for programs go
7450set html1dir html1dir none
7451eval $prefixit
7452$cat <<EOM
7453
7454If you wish to install html files for programs in $spackage, indicate
7455the appropriate directory here.  To skip installing html files,
7456answer "none".
7457EOM
7458case "$html1dir" in
7459''|none|$undef|' ') dflt=none ;;
7460*) dflt=$html1dir ;;
7461esac
7462fn=dn+~
7463rp="Directory for the main $spackage html pages?"
7464. ./getfile
7465prefixvar=html1dir
7466. ./setprefixvar
7467: Use ' ' for none so value is preserved next time through Configure
7468$test X"$html1dir" = "X" && html1dir=' '
7469
7470: determine where html pages for libraries and modules go
7471set html3dir html3dir none
7472eval $prefixit
7473$cat <<EOM
7474
7475If you wish to install html files for modules associated with $spackage,
7476indicate the appropriate directory here.  To skip installing html files,
7477answer "none".
7478EOM
7479: There is no obvious default.  If they have specified html1dir, then
7480: try to key off that, possibly changing .../html1 into .../html3.
7481case "$html3dir" in
7482'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7483*) dflt=$html3dir ;;
7484esac
7485fn=dn+~
7486rp="Directory for the $spackage module html pages?"
7487. ./getfile
7488prefixvar=html3dir
7489. ./setprefixvar
7490: Use ' ' for none so value is preserved next time through Configure
7491$test X"$html3dir" = "X" && html3dir=' '
7492
7493: determine whether to install perl also as /usr/bin/perl
7494
7495echo " "
7496if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7497	$cat <<EOM
7498Many scripts expect perl to be installed as /usr/bin/perl.
7499
7500If you want to, I can install the perl you are about to compile
7501as /usr/bin/perl (in addition to $bin/perl).
7502EOM
7503	if test -f /usr/bin/perl; then
7504	    $cat <<EOM
7505
7506However, please note that because you already have a /usr/bin/perl,
7507overwriting that with a new Perl would very probably cause problems.
7508Therefore I'm assuming you don't want to do that (unless you insist).
7509
7510EOM
7511	    case "$installusrbinperl" in
7512	    "$define"|[yY]*)	dflt='y';;
7513	    *)			dflt='n';;
7514	    esac
7515	else
7516	    $cat <<EOM
7517
7518Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7519
7520EOM
7521	    case "$installusrbinperl" in
7522	    "$undef"|[nN]*)	dflt='n';;
7523	    *)			dflt='y';;
7524	    esac
7525	fi
7526	rp="Do you want to install perl as /usr/bin/perl?"
7527	. ./myread
7528	case "$ans" in
7529	[yY]*)	val="$define";;
7530	*)	val="$undef" ;;
7531	esac
7532else
7533	val="$undef"
7534fi
7535set installusrbinperl
7536eval $setvar
7537
7538: Check if we are using the GNU C library
7539echo " "
7540echo "Checking for GNU C Library..." >&4
7541cat >try.c <<'EOCP'
7542/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7543   alone are insufficient to distinguish different versions, such as
7544   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7545   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7546*/
7547#include <stdio.h>
7548int main(void)
7549{
7550#ifdef __GLIBC__
7551#   ifdef __GLIBC_MINOR__
7552#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7553#           include <gnu/libc-version.h>
7554	    printf("%s\n",  gnu_get_libc_version());
7555#       else
7556	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7557#       endif
7558#   else
7559	printf("%d\n",  __GLIBC__);
7560#   endif
7561    return 0;
7562#else
7563    return 1;
7564#endif
7565}
7566EOCP
7567set try
7568if eval $compile_ok && $run ./try > glibc.ver; then
7569	val="$define"
7570	gnulibc_version=`$cat glibc.ver`
7571	echo "You are using the GNU C Library version $gnulibc_version"
7572else
7573	val="$undef"
7574	gnulibc_version=''
7575	echo "You are not using the GNU C Library"
7576fi
7577$rm_try glibc.ver
7578set d_gnulibc
7579eval $setvar
7580
7581: see if nm is to be used to determine whether a symbol is defined or not
7582case "$usenm" in
7583'')
7584	dflt=''
7585	case "$d_gnulibc" in
7586	"$define")
7587		echo " "
7588		echo "nm probably won't work on the GNU C Library." >&4
7589		dflt=n
7590		;;
7591	esac
7592	case "$dflt" in
7593	'')
7594		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7595			echo " "
7596			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7597			echo "'nm' won't be sufficient on this system." >&4
7598			dflt=n
7599		fi
7600		;;
7601	esac
7602	case "$dflt" in
7603	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7604		if $test $dflt -gt 20; then
7605			dflt=y
7606		else
7607			dflt=n
7608		fi
7609		;;
7610	esac
7611	;;
7612*)
7613	case "$usenm" in
7614	true|$define) dflt=y;;
7615	*) dflt=n;;
7616	esac
7617	;;
7618esac
7619$cat <<EOM
7620
7621I can use $nm to extract the symbols from your C libraries. This
7622is a time consuming task which may generate huge output on the disk (up
7623to 3 megabytes) but that should make the symbols extraction faster. The
7624alternative is to skip the 'nm' extraction part and to compile a small
7625test program instead to determine whether each symbol is present. If
7626you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7627this may be the best solution.
7628
7629You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7630
7631EOM
7632rp="Shall I use $nm to extract C symbols from the libraries?"
7633. ./myread
7634case "$ans" in
7635[Nn]*) usenm=false;;
7636*) usenm=true;;
7637esac
7638
7639runnm=$usenm
7640case "$reuseval" in
7641true) runnm=false;;
7642esac
7643
7644: nm options which may be necessary
7645case "$nm_opt" in
7646'') if $test -f /mach_boot; then
7647		nm_opt=''	# Mach
7648	elif $test -d /usr/ccs/lib; then
7649		nm_opt='-p'	# Solaris (and SunOS?)
7650	elif $test -f /dgux; then
7651		nm_opt='-p'	# DG-UX
7652	elif $test -f /lib64/rld; then
7653		nm_opt='-p'	# 64-bit Irix
7654	else
7655		nm_opt=''
7656	fi;;
7657esac
7658
7659: nm options which may be necessary for shared libraries but illegal
7660: for archive libraries.  Thank you, Linux.
7661case "$nm_so_opt" in
7662'')	case "$myuname" in
7663	*linux*|gnu*)
7664		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7665			nm_so_opt='--dynamic'
7666		fi
7667		;;
7668	esac
7669	;;
7670esac
7671
7672: Figure out where the libc is located
7673case "$runnm" in
7674true)
7675: get list of predefined functions in a handy place
7676echo " "
7677case "$libc" in
7678'') libc=unknown
7679	case "$libs" in
7680	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7681	esac
7682	;;
7683esac
7684case "$libs" in
7685'') ;;
7686*)  for thislib in $libs; do
7687	case "$thislib" in
7688	-lc|-lc_s)
7689		: Handle C library specially below.
7690		;;
7691	-l*)
7692		thislib=`echo $thislib | $sed -e 's/^-l//'`
7693		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7694			:
7695		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7696			:
7697		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7698			:
7699		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7700			:
7701		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7702			:
7703		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7704			:
7705		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7706			:
7707		else
7708			try=''
7709		fi
7710		libnames="$libnames $try"
7711		;;
7712	*) libnames="$libnames $thislib" ;;
7713	esac
7714	done
7715	;;
7716esac
7717xxx=normal
7718case "$libc" in
7719unknown)
7720	set /lib/libc.$so
7721	for xxx in $libpth; do
7722		$test -r $1 || set $xxx/libc.$so
7723		: The messy sed command sorts on library version numbers.
7724		$test -r $1 || \
7725			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7726			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7727				h
7728				s/[0-9][0-9]*/0000&/g
7729				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7730				G
7731				s/\n/ /' | \
7732			 $sort | $sed -e 's/^.* //'`
7733		eval set \$$#
7734	done
7735	$test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7736	$test -r $1 || set $sysroot/lib/libsys_s$_a
7737	;;
7738*)
7739	set blurfl
7740	;;
7741esac
7742if $test -r "$1"; then
7743	echo "Your (shared) C library seems to be in $1."
7744	libc="$1"
7745elif $test -r /lib/libc && $test -r /lib/clib; then
7746	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7747	xxx=apollo
7748	libc='/lib/clib /lib/libc'
7749	if $test -r /lib/syslib; then
7750		echo "(Your math library is in /lib/syslib.)"
7751		libc="$libc /lib/syslib"
7752	fi
7753elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7754	echo "Your C library seems to be in $libc, as you said before."
7755elif $test -r $incpath/usr/lib/libc$_a; then
7756	libc=$incpath/usr/lib/libc$_a;
7757	echo "Your C library seems to be in $libc.  That's fine."
7758elif $test -r /lib/libc$_a; then
7759	libc=/lib/libc$_a;
7760	echo "Your C library seems to be in $libc.  You're normal."
7761else
7762	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7763		:
7764	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7765		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7766	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7767		:
7768	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7769		:
7770	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7771		:
7772	else
7773		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7774	fi
7775	if $test -r "$tans"; then
7776		echo "Your C library seems to be in $tans, of all places."
7777		libc=$tans
7778	else
7779		libc='blurfl'
7780	fi
7781fi
7782if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7783	dflt="$libc"
7784	cat <<EOM
7785
7786If the guess above is wrong (which it might be if you're using a strange
7787compiler, or your machine supports multiple models), you can override it here.
7788
7789EOM
7790else
7791	dflt=''
7792	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7793	cat >&4 <<EOM
7794I can't seem to find your C library.  I've looked in the following places:
7795
7796EOM
7797	$sed 's/^/	/' libpath
7798	cat <<EOM
7799
7800None of these seems to contain your C library. I need to get its name...
7801
7802EOM
7803fi
7804fn=f
7805rp='Where is your C library?'
7806. ./getfile
7807libc="$ans"
7808
7809echo " "
7810echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7811set X `cat libnames`
7812shift
7813xxx=files
7814case $# in 1) xxx=file; esac
7815echo "Extracting names from the following $xxx for later perusal:" >&4
7816echo " "
7817$sed 's/^/	/' libnames >&4
7818echo " "
7819$echo $n "This may take a while...$c" >&4
7820
7821for file in $*; do
7822	case $file in
7823	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7824	*) $nm $nm_opt $file 2>/dev/null;;
7825	esac
7826done >libc.tmp
7827
7828$echo $n ".$c"
7829$grep fprintf libc.tmp > libc.ptf
7830xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7831xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7832xxx='[ADTSIWi]'
7833if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7834	eval $xscan;\
7835	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7836		eval $xrun
7837elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7838	eval $xscan;\
7839	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7840		eval $xrun
7841elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7842	eval $xscan;\
7843	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7844		eval $xrun
7845elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7846	eval $xscan;\
7847	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7848		eval $xrun
7849elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7850	eval $xscan;\
7851	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7852		eval $xrun
7853elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7854	eval $xscan;\
7855	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7856		eval $xrun
7857elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7858				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7859	eval $xscan;\
7860	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7861		eval $xrun
7862elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7863	eval $xscan;\
7864	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7865		eval $xrun
7866elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7867	eval $xscan;\
7868	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7869		eval $xrun
7870elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7871	eval $xscan;\
7872	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7873		eval $xrun
7874elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7875	eval $xscan;\
7876	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7877		eval $xrun
7878elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7879	eval $xscan;\
7880	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7881		eval $xrun
7882elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7883	eval $xscan;\
7884	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7885		eval $xrun
7886elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7887	eval $xscan;\
7888	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7889		eval $xrun
7890else
7891	$nm -p $* 2>/dev/null >libc.tmp
7892	$grep fprintf libc.tmp > libc.ptf
7893	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7894		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7895	then
7896		nm_opt='-p'
7897		eval $xrun
7898	else
7899		echo " "
7900		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7901		com=''
7902		if $ar t $libc > libc.tmp && \
7903			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
7904		then
7905			for thisname in $libnames $libc; do
7906				$ar t $thisname >>libc.tmp
7907			done
7908			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7909			echo "Ok." >&4
7910		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7911			for thisname in $libnames $libc; do
7912				$ar tv $thisname >>libc.tmp
7913				emximp -o tmp.imp $thisname \
7914				    2>/dev/null && \
7915				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7916				    < tmp.imp >>libc.tmp
7917				$rm -f tmp.imp
7918			done
7919			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7920			echo "Ok." >&4
7921		else
7922			echo "$ar didn't seem to work right." >&4
7923			echo "Maybe this is a Cray...trying bld instead..." >&4
7924			if  bld t $libc | \
7925				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7926				$test -s libc.list
7927			then
7928				for thisname in $libnames; do
7929					bld t $libnames | \
7930					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7931					$ar t $thisname >>libc.tmp
7932				done
7933				echo "Ok." >&4
7934			else
7935				echo "That didn't work either.  Giving up." >&4
7936				exit 1
7937			fi
7938		fi
7939	fi
7940fi
7941nm_extract="$com"
7942case "$PASE" in
7943define)
7944    echo " "
7945    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7946    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7947    ;;
7948*)  if $test -f /lib/syscalls.exp; then
7949	echo " "
7950	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7951	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
7952		/lib/syscalls.exp >>libc.list
7953    fi
7954    ;;
7955esac
7956;;
7957esac
7958$rm -f libnames libpath
7959
7960: Check if we are using C++
7961echo " "
7962echo "Checking for C++..." >&4
7963$cat >try.c <<'EOCP'
7964#include <stdio.h>
7965int main(void)
7966{
7967#ifdef __cplusplus
7968    return 0;
7969#else
7970    return 1;
7971#endif
7972}
7973EOCP
7974set try
7975if eval $compile_ok && $run ./try; then
7976	val="$define"
7977	echo "You are using a C++ compiler."
7978else
7979	val="$undef"
7980	echo "You are not using a C++ compiler."
7981fi
7982$rm_try cplusplus$$
7983set d_cplusplus
7984eval $setvar
7985
7986: is a C symbol defined?
7987csym='tlook=$1;
7988case "$3" in
7989-v) tf=libc.tmp; tdc="";;
7990-a) tf=libc.tmp; tdc="[]";;
7991*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7992esac;
7993case "$d_cplusplus" in
7994    $define)	extern_C="extern \"C\""	;;
7995    *)		extern_C="extern"	;;
7996esac;
7997tx=yes;
7998case "$reuseval-$4" in
7999true-) ;;
8000true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
8001esac;
8002case "$tx" in
8003yes)
8004	tval=false;
8005	if $test "$runnm" = true; then
8006		if $contains $tlook $tf >/dev/null 2>&1; then
8007			tval=true;
8008		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
8009			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
8010			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
8011			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
8012			$rm_try;
8013		fi;
8014	else
8015		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
8016		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
8017		$rm_try;
8018	fi;
8019	;;
8020*)
8021	case "$tval" in
8022	$define) tval=true;;
8023	*) tval=false;;
8024	esac;
8025	;;
8026esac;
8027eval "$2=$tval"'
8028
8029: define an is-in-libc? function
8030inlibc='echo " "; td=$define; tu=$undef;
8031sym=$1; var=$2; eval "was=\$$2";
8032tx=yes;
8033case "$reuseval$was" in
8034true) ;;
8035true*) tx=no;;
8036esac;
8037case "$tx" in
8038yes)
8039	set $sym tres -f;
8040	eval $csym;
8041	case "$tres" in
8042	true)
8043		echo "$sym() found." >&4;
8044		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8045	*)
8046		echo "$sym() NOT found." >&4;
8047		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8048	esac;;
8049*)
8050	case "$was" in
8051	$define) echo "$sym() found." >&4;;
8052	*) echo "$sym() NOT found." >&4;;
8053	esac;;
8054esac'
8055
8056: see if dlopen exists
8057xxx_runnm="$runnm"
8058xxx_ccflags="$ccflags"
8059runnm=false
8060: with g++ one needs -shared to get is-in-libc to work for dlopen
8061case "$gccversion" in
8062'')	;;
8063*)	case "$d_cplusplus" in
8064	"$define") ccflags="$ccflags -shared" ;;
8065	esac
8066	;;
8067esac
8068set dlopen d_dlopen
8069eval $inlibc
8070runnm="$xxx_runnm"
8071ccflags="$xxx_ccflags"
8072
8073: see if this is a unistd.h system
8074set unistd.h i_unistd
8075eval $inhdr
8076
8077: determine which dynamic loading, if any, to compile in
8078echo " "
8079dldir="ext/DynaLoader"
8080case "$usedl" in
8081    $define|y|true)
8082	dflt='y'
8083	usedl="$define"
8084	;;
8085    $undef|n|false)
8086	dflt='n'
8087	usedl="$undef"
8088	;;
8089    *)
8090	dflt='n'
8091	case "$d_dlopen" in
8092	    $define) dflt='y' ;;
8093	esac
8094	: Does a dl_xxx.xs file exist for this operating system
8095	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8096	;;
8097esac
8098rp="Do you wish to use dynamic loading?"
8099. ./myread
8100usedl="$ans"
8101bin_ELF="$undef"
8102case "$ans" in
8103    y*) usedl="$define"
8104	case "$dlsrc" in
8105	    '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8106		    dflt="$dldir/dl_${osname}.xs"
8107		elif $test "$d_dlopen" = "$define" ; then
8108		    dflt="$dldir/dl_dlopen.xs"
8109		else
8110		    dflt=''
8111		fi
8112		;;
8113	    *)  dflt="$dldir/$dlsrc"
8114		;;
8115	esac
8116	echo "The following dynamic loading files are available:"
8117	: Can not go over to $dldir because getfile has path hard-coded in.
8118	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8119	rp="Source file to use for dynamic loading"
8120	fn="fne"
8121	gfpth="$src"
8122	. ./getfile
8123	usedl="$define"
8124	: emulate basename
8125	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8126
8127	$cat << EOM
8128
8129Some systems may require passing special flags to $cc -c to
8130compile modules that will be used to create a shared library.
8131To use no flags, say "none".
8132
8133EOM
8134	case "$cccdlflags" in
8135	    '') case "$gccversion" in
8136		'') case "$osname" in
8137			hpux)	dflt='+z' ;;
8138			next)	dflt='none' ;;
8139			irix*)	dflt='-KPIC' ;;
8140			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8141			sunos)	dflt='-pic' ;;
8142			*)	dflt='none' ;;
8143		    esac
8144		    ;;
8145		*)  case "$osname" in
8146			darwin) dflt='none' ;;
8147			*linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8148			*)	dflt='-fpic' ;;
8149		    esac ;;
8150		esac ;;
8151	    ' ') dflt='none' ;;
8152	    *)   dflt="$cccdlflags" ;;
8153	esac
8154
8155	case "$dflt" in
8156	    none) dflt='' ;;
8157	esac
8158
8159	# If -Dsysroot was specified, now's the time to add it
8160	# to cccdlflags
8161	if test "X$sysroot" != X; then
8162	    case "$gccversion" in
8163		'') ;;
8164		*)  case "$dflt" in
8165			*sysroot*) ;;
8166			'undef'|*)
8167			    dflt="$dflt --sysroot=$sysroot" ;;
8168		    esac
8169		    ;;
8170	    esac
8171	fi
8172
8173	case "$dflt" in
8174	    '') dflt='none';;
8175	esac
8176
8177	rp="Any special flags to pass to $cc -c to compile shared library modules?"
8178	. ./myread
8179	case "$ans" in
8180	    none) cccdlflags=' ' ;;
8181	    *)    cccdlflags="$ans" ;;
8182	esac
8183
8184	cat << EOM
8185
8186Some systems use ld to create libraries that can be dynamically loaded,
8187while other systems (such as those using ELF) use $cc.
8188
8189EOM
8190
8191: Determine if this is ELF
8192	$cat >try.c <<EOM
8193/* Test for whether ELF binaries are produced */
8194#include <fcntl.h>
8195#$i_stdlib I_STDLIB
8196#ifdef I_STDLIB
8197#include <stdlib.h>
8198#endif
8199#$i_unistd I_UNISTD
8200#ifdef I_UNISTD
8201#include <unistd.h>
8202#endif
8203int main() {
8204    char b[4];
8205    int i = open("a.out",O_RDONLY);
8206    if(i == -1)
8207	exit(1); /* fail */
8208    if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8209	exit(0); /* succeed (yes, it is ELF) */
8210    exit(1); /* fail */
8211}
8212EOM
8213	if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8214	    bin_ELF="$define"
8215	fi
8216	$rm_try
8217
8218	case "$ld" in
8219	    '') if $test $bin_ELF = "$define"; then
8220		    cat <<EOM
8221You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8222EOM
8223		    dflt="$cc"
8224		else
8225		    echo "I'll use ld to build dynamic libraries."
8226		    dflt='ld'
8227		fi
8228		;;
8229	    *)  dflt="$ld"
8230		;;
8231	esac
8232
8233	rp="What command should be used to create dynamic libraries?"
8234	. ./myread
8235	ld="$ans"
8236
8237	cat << EOM
8238
8239Some systems may require passing special flags to $ld to create a
8240library that can be dynamically loaded.  If your ld flags include
8241-L/other/path options to locate libraries outside your loader's normal
8242search path, you may need to specify those -L options here as well.  To
8243use no flags, say "none".
8244
8245EOM
8246	case "$lddlflags" in
8247	    '') case "$osname" in
8248		    haiku) dflt='-shared' ;;
8249		    hpux) dflt='-b';
8250			  case "$gccversion" in
8251			      '') dflt="$dflt +vnocompatwarnings" ;;
8252			  esac
8253			  ;;
8254		    *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8255		    next)  dflt='none' ;;
8256		    solaris) # See [perl #66604].
8257			    # On Solaris 11, gcc -m64 on amd64
8258			    # appears not to understand -G.  gcc versions at
8259			    # least as old as 3.4.3 support -shared, so just
8260			    # use that with Solaris 11 and later, but keep
8261			    # the old behavior for older Solaris versions.
8262			    case "$gccversion" in
8263				'') dflt='-G' ;;
8264				*)  case "$osvers" in
8265					2.?|2.10) dflt='-G' ;;
8266					*) dflt='-shared' ;;
8267				    esac
8268				    ;;
8269			    esac
8270			    ;;
8271		    sunos) dflt='-assert nodefinitions' ;;
8272		    svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8273		    *)     dflt='none' ;;
8274		esac
8275		;;
8276	    *) dflt="$lddlflags" ;;
8277	esac
8278
8279	: Only do this for gcc, since, for example, qcc has no concept
8280	: of --sysroot.
8281	if $test "X$sysroot" != X; then
8282	    case "$gccversion" in
8283		'') ;;
8284		*)  dflt="$dflt --sysroot $sysroot" ;;
8285	    esac
8286	fi
8287
8288	: Try to guess additional flags to pick up local libraries.
8289	: Be careful not to append to a plain 'none'
8290	case "$dflt" in
8291	    none) dflt='' ;;
8292	esac
8293	for thisflag in $ldflags; do
8294	    case "$thisflag" in
8295		-L*|-R*|-Wl,-R*)
8296		    case " $dflt " in
8297			*" $thisflag "*) ;;
8298			*) dflt="$dflt $thisflag" ;;
8299		    esac
8300		    ;;
8301	    esac
8302	done
8303
8304	case "$dflt" in
8305	    ''|' ') dflt='none' ;;
8306	esac
8307
8308	case "$ldflags" in
8309	    *-fstack-protector*)
8310		case "$dflt" in
8311		    *-fstack-protector*) ;; # Don't add it again
8312		    *) dflt="$dflt -fstack-protector" ;;
8313		esac
8314		;;
8315	esac
8316
8317	rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8318	. ./myread
8319	case "$ans" in
8320	    none) lddlflags=' ' ;;
8321	    *) lddlflags="$ans" ;;
8322	esac
8323
8324	cat <<EOM
8325
8326Some systems may require passing special flags to $cc to indicate that
8327the resulting executable will use dynamic linking.  To use no flags,
8328say "none".
8329
8330EOM
8331	case "$ccdlflags" in
8332	    '') case "$osname" in
8333		    *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8334		    next|sunos)      dflt='none'   ;;
8335		    *)               dflt='none'   ;;
8336		esac ;;
8337	    ' ') dflt='none' ;;
8338	    *)   dflt="$ccdlflags" ;;
8339	esac
8340	rp="Any special flags to pass to $cc to use dynamic linking?"
8341	. ./myread
8342	case "$ans" in
8343	    none) ccdlflags=' ' ;;
8344	    *)    ccdlflags="$ans" ;;
8345	esac
8346	;;
8347
8348    *)  usedl="$undef"
8349	ld='ld'
8350	dlsrc='dl_none.xs'
8351	lddlflags=''
8352	ccdlflags=''
8353	;;
8354esac
8355
8356ld_can_script="$undef"
8357case "$bin_ELF$usedl" in
8358    $define$define)
8359	# Abuse try.h and a.out names for neat cleanup
8360	$cat >try.c <<EOM
8361void foo() {}
8362void bar() {}
8363EOM
8364	$cat >try.h <<EOM
8365LIBTEST_42 {
8366 global:
8367  foo;
8368 local: *;
8369 };
8370EOM
8371	if $cc $cccdlflags $ccdlflags $ccflags \
8372	       $ldflags $lddlflags -o a.out try.c \
8373	       -Wl,--version-script=try.h >/dev/null 2>&1 \
8374	   &&  $test -s a.out ; then
8375	    echo "ld supports scripting" >&4
8376	    ld_can_script="$define"
8377	else
8378	    echo "ld does not support scripting" >&4
8379	fi
8380	$rm_try
8381	;;
8382esac
8383
8384: Do we want a shared libperl?
8385also=''
8386case "$usedl" in
8387$undef)
8388	# No dynamic loading being used, so don't bother even to prompt.
8389	useshrplib='false'
8390	;;
8391*)	case "$useshrplib" in
8392	'')	case "$osname" in
8393		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8394			dflt=y
8395			also='Building a shared libperl is required for dynamic loading to work on your system.'
8396			;;
8397		next*)
8398			case "$osvers" in
8399			4*)	dflt=y
8400				also='Building a shared libperl is needed for MAB support.'
8401				;;
8402			*)	dflt=n
8403				;;
8404			esac
8405			;;
8406		*)	dflt=n
8407			;;
8408		esac
8409		;;
8410	$define|true|[Yy]*)
8411		dflt=y
8412		;;
8413	*)	dflt=n
8414		;;
8415	esac
8416	$cat << EOM
8417
8418The perl executable is normally obtained by linking perlmain.c with
8419libperl${_a}, any static extensions (usually just DynaLoader), and
8420any other libraries needed on this system (such as -lm, etc.).  Since
8421your system supports dynamic loading, it is probably possible to build
8422a shared libperl.$so.  If you will have more than one executable linked
8423to libperl.$so, this will significantly reduce the size of each
8424executable, but it may have a noticeable effect on performance.  The
8425default is probably sensible for your system.
8426$also
8427
8428EOM
8429	rp="Build a shared libperl.$so (y/n)"
8430	. ./myread
8431	case "$ans" in
8432	true|$define|[Yy]*)
8433		useshrplib='true'  ;;
8434	*)	useshrplib='false' ;;
8435	esac
8436	;;
8437esac
8438
8439case "$useshrplib" in
8440true)
8441	case "$userelocatableinc" in
8442	true|define)
8443		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8444		echo "See INSTALL for an explanation why that won't work." >&4
8445		exit 4
8446		;;
8447	esac
8448	case "$libperl" in
8449	'')
8450		# Figure out a good name for libperl.so.  Since it gets stored in
8451		# a version-specific architecture-dependent library, the version
8452		# number isn't really that important, except for making cc/ld happy.
8453		#
8454		# A name such as libperl.so.10.1
8455		majmin="libperl.$so.$patchlevel.$subversion"
8456		# A name such as libperl.so.100
8457		majonly=`echo $patchlevel $subversion |
8458			$awk '{printf "%d%02d", $1, $2}'`
8459		majonly=libperl.$so.$majonly
8460		# I'd prefer to keep the os-specific stuff here to a minimum, and
8461		# rely on figuring it out from the naming of libc.
8462		case "${osname}${osvers}" in
8463		next4*)
8464			dflt=libperl.5.$so
8465			# XXX How handle the --version stuff for MAB?
8466			;;
8467		*linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8468			dflt=libperl.$so
8469			;;
8470		cygwin*) # ld links now against the dll directly
8471			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8472			majonly=`echo $patchlevel $subversion |
8473				$awk '{printf "%03d%03d", $1, $2}'`
8474			majonly=cygperl5.$majonly.$so
8475			dflt=$majmin
8476			;;
8477		*)	# Try to guess based on whether libc has major.minor.
8478			case "$libc" in
8479			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8480			*libc.$so.[0-9]*) dflt=$majonly ;;
8481			*)	dflt=libperl.$so ;;
8482			esac
8483			;;
8484		esac
8485		;;
8486	*)	dflt=$libperl
8487		;;
8488	esac
8489	cat << EOM
8490
8491I need to select a good name for the shared libperl.  If your system uses
8492library names with major and minor numbers, then you might want something
8493like $majmin.  Alternatively, if your system uses a single version
8494number for shared libraries, then you might want to use $majonly.
8495Or, your system might be quite happy with a simple libperl.$so.
8496
8497Since the shared libperl will get installed into a version-specific
8498architecture-dependent directory, the version number of the shared perl
8499library probably isn't important, so the default should be o.k.
8500
8501EOM
8502	rp='What name do you want to give to the shared libperl?'
8503	. ./myread
8504	libperl=$ans
8505	echo "Ok, I'll use $libperl"
8506	;;
8507*)
8508	libperl="libperl${_a}"
8509	;;
8510esac
8511
8512# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8513case "$shrpdir" in
8514'') ;;
8515*)	$cat >&4 <<EOM
8516WARNING:  Use of the shrpdir variable for the installation location of
8517the shared $libperl is not supported.  It was never documented and
8518will not work in this version.  Let me (perlbug@perl.org)
8519know of any problems this may cause.
8520
8521EOM
8522	case "$shrpdir" in
8523	"$archlibexp/CORE")
8524		$cat >&4 <<EOM
8525But your current setting of $shrpdir is
8526the default anyway, so it's harmless.
8527EOM
8528		;;
8529	*)
8530		$cat >&4 <<EOM
8531Further, your current attempted setting of $shrpdir
8532conflicts with the value of $archlibexp/CORE
8533that installperl will use.
8534EOM
8535		;;
8536	esac
8537	;;
8538esac
8539
8540# How will the perl executable find the installed shared $libperl?
8541# Add $xxx to ccdlflags.
8542# If we can't figure out a command-line option, use $shrpenv to
8543# set env LD_RUN_PATH.  The main perl makefile uses this.
8544shrpdir=$archlibexp/CORE
8545xxx=''
8546tmp_shrpenv=''
8547if "$useshrplib"; then
8548    case "$osname" in
8549	aix)
8550		# We'll set it in Makefile.SH...
8551		;;
8552	solaris)
8553		xxx="-R $shrpdir"
8554		;;
8555	freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8556		xxx="-Wl,-R$shrpdir"
8557		;;
8558	bsdos|linux|irix*|dec_osf|gnu*)
8559		xxx="-Wl,-rpath,$shrpdir"
8560		;;
8561	next)
8562		# next doesn't like the default...
8563		;;
8564	haiku)
8565		# Haiku doesn't like the default, either.
8566		;;
8567	hpux*)
8568		# hpux doesn't like the default, either.
8569		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8570		;;
8571	cygwin)
8572		# cygwin needs only ldlibpth
8573		;;
8574	*)
8575		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8576		;;
8577	esac
8578	case "$xxx" in
8579	'') ;;
8580	*)
8581		# Only add $xxx if it isn't already in ccdlflags.
8582		case " $ccdlflags " in
8583		*" $xxx "*)	;;
8584		*)	ccdlflags="$ccdlflags $xxx"
8585			cat <<EOM >&4
8586
8587Adding $xxx to the flags
8588passed to $ld so that the perl executable will find the
8589installed shared $libperl.
8590
8591EOM
8592			;;
8593		esac
8594		;;
8595	esac
8596fi
8597# Fix ccdlflags in AIX for building external extensions.
8598# (For building Perl itself bare -bE:perl.exp is needed,
8599#  Makefile.SH takes care of this.)
8600case "$osname" in
8601aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8602esac
8603# Respect a hint or command-line value.
8604case "$shrpenv" in
8605'') shrpenv="$tmp_shrpenv" ;;
8606esac
8607case "$ldlibpthname" in
8608'')	ldlibpthname=LD_LIBRARY_PATH ;;
8609none)	ldlibpthname='' ;;
8610esac
8611
8612: determine where manual pages are on this system
8613echo " "
8614case "$sysman" in
8615'')
8616	syspath='/usr/share/man/man1 /usr/man/man1'
8617	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8618	syspath="$syspath /usr/man/u_man/man1"
8619	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8620	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8621	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8622	sysman=`./loc . /usr/man/man1 $syspath`
8623	;;
8624esac
8625if $test -d "$sysman"; then
8626	echo "System manual is in $sysman." >&4
8627else
8628	echo "Could not find manual pages in source form." >&4
8629fi
8630
8631: determine where manual pages go
8632set man1dir man1dir none
8633eval $prefixit
8634$cat <<EOM
8635
8636$spackage has manual pages available in source form.
8637EOM
8638case "$nroff" in
8639nroff)
8640	echo "However, you don't have nroff, so they're probably useless to you."
8641	case "$man1dir" in
8642	'') man1dir="none";;
8643	esac;;
8644esac
8645echo "If you don't want the manual sources installed, answer 'none'."
8646case "$man1dir" in
8647' ') dflt=none
8648	;;
8649'')
8650	lookpath="$prefixexp/share/man/man1"
8651	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8652	lookpath="$lookpath $prefixexp/man/p_man/man1"
8653	lookpath="$lookpath $prefixexp/man/u_man/man1"
8654	lookpath="$lookpath $prefixexp/man/man.1"
8655	case "$sysman" in
8656	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8657	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8658	esac
8659	set dflt
8660	eval $prefixup
8661	;;
8662*)  dflt="$man1dir"
8663	;;
8664esac
8665echo " "
8666fn=dn+~
8667rp="Where do the main $spackage manual pages (source) go?"
8668. ./getfile
8669if $test "X$man1direxp" != "X$ansexp"; then
8670	installman1dir=''
8671fi
8672prefixvar=man1dir
8673. ./setprefixvar
8674
8675case "$man1dir" in
8676'')	man1dir=' '
8677	installman1dir='';;
8678esac
8679
8680: What suffix to use on installed man pages
8681
8682case "$man1dir" in
8683' ')
8684	man1ext='0'
8685	;;
8686*)
8687	rp="What suffix should be used for the main $spackage man pages?"
8688	case "$man1ext" in
8689	'')	case "$man1dir" in
8690		*1)  dflt=1 ;;
8691		*1p) dflt=1p ;;
8692		*1pm) dflt=1pm ;;
8693		*l) dflt=l;;
8694		*n) dflt=n;;
8695		*o) dflt=o;;
8696		*p) dflt=p;;
8697		*C) dflt=C;;
8698		*L) dflt=L;;
8699		*L1) dflt=L1;;
8700		*) dflt=1;;
8701		esac
8702		;;
8703	*)	dflt="$man1ext";;
8704	esac
8705	. ./myread
8706	man1ext="$ans"
8707	;;
8708esac
8709
8710: see if we can have long filenames
8711echo " "
8712first=123456789abcdef
8713$rm -f $first
8714if (echo hi >$first) 2>/dev/null; then
8715	if $test -f 123456789abcde; then
8716		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8717		val="$undef"
8718	else
8719 		echo 'You can have filenames longer than 14 characters.'>&4
8720 		val="$define"
8721	fi
8722else
8723	$cat <<'EOM'
8724You can't have filenames longer than 14 chars.
8725You can't even think about them!
8726EOM
8727	val="$undef"
8728fi
8729set d_flexfnam
8730eval $setvar
8731$rm -rf 123456789abcde*
8732
8733: determine where library module manual pages go
8734set man3dir man3dir none
8735eval $prefixit
8736$cat <<EOM
8737
8738$spackage has manual pages for many of the library modules.
8739EOM
8740
8741case "$nroff" in
8742nroff)
8743	$cat <<'EOM'
8744However, you don't have nroff, so they're probably useless to you.
8745EOM
8746	case "$man3dir" in
8747	'') man3dir="none";;
8748	esac;;
8749esac
8750
8751case "$d_flexfnam" in
8752undef)
8753	$cat <<'EOM'
8754However, your system can't handle the long file names like File::Basename.3.
8755EOM
8756	case "$man3dir" in
8757	'') man3dir="none";;
8758	esac;;
8759esac
8760
8761echo "If you don't want the manual sources installed, answer 'none'."
8762prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8763case "$man3dir" in
8764'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8765	if $test -d "$privlib/man/man3"; then
8766		cat <<EOM >&4
8767
8768WARNING:  Previous versions of perl installed man3 pages into
8769$privlib/man/man3.  This version will suggest a
8770new default of $dflt.
8771EOM
8772		tdflt=$dflt
8773		dflt='n'
8774		rp='Do you wish to preserve the old behavior?(y/n)'
8775		. ./myread
8776		case "$ans" in
8777		y*) dflt="$privlib/man/man3" ;;
8778		*)  dflt=$tdflt ;;
8779		esac
8780    fi
8781	;;
8782*)	dflt="$man3dir" ;;
8783esac
8784case "$dflt" in
8785' ') dflt=none ;;
8786esac
8787echo " "
8788fn=dn+~
8789rp="Where do the $package library man pages (source) go?"
8790. ./getfile
8791prefixvar=man3dir
8792. ./setprefixvar
8793
8794case "$man3dir" in
8795'')	man3dir=' '
8796	installman3dir='';;
8797esac
8798
8799: What suffix to use on installed man pages
8800case "$man3dir" in
8801' ')
8802	man3ext='0'
8803	;;
8804*)
8805	rp="What suffix should be used for the $package library man pages?"
8806	case "$man3ext" in
8807	'')	case "$man3dir" in
8808		*3)  dflt=3 ;;
8809		*3p) dflt=3p ;;
8810		*3pm) dflt=3pm ;;
8811		*l) dflt=l;;
8812		*n) dflt=n;;
8813		*o) dflt=o;;
8814		*p) dflt=p;;
8815		*C) dflt=C;;
8816		*L) dflt=L;;
8817		*L3) dflt=L3;;
8818		*) dflt=3;;
8819		esac
8820		;;
8821	*)	dflt="$man3ext";;
8822	esac
8823	. ./myread
8824	man3ext="$ans"
8825	;;
8826esac
8827
8828: see if we have to deal with yellow pages, now NIS.
8829if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8830	if $test -f /usr/etc/nibindd; then
8831		echo " "
8832		echo "I'm fairly confident you're on a NeXT."
8833		echo " "
8834		rp='Do you get the hosts file via NetInfo?'
8835		dflt=y
8836		case "$hostcat" in
8837		nidump*) ;;
8838		'') ;;
8839		*) dflt=n;;
8840		esac
8841		. ./myread
8842		case "$ans" in
8843		y*) hostcat='nidump hosts .';;
8844		*)	case "$hostcat" in
8845			nidump*) hostcat='';;
8846			esac
8847			;;
8848		esac
8849	fi
8850	case "$hostcat" in
8851	nidump*) ;;
8852	*)
8853		case "$hostcat" in
8854		*ypcat*) dflt=y;;
8855		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8856				dflt=y
8857			else
8858				dflt=n
8859			fi;;
8860		*) dflt=n;;
8861		esac
8862		echo " "
8863		rp='Are you getting the hosts file via yellow pages?'
8864		. ./myread
8865		case "$ans" in
8866		y*) hostcat='ypcat hosts';;
8867		*) hostcat='cat /etc/hosts';;
8868		esac
8869		;;
8870	esac
8871fi
8872case "$hostcat" in
8873'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8874esac
8875case "$groupcat" in
8876'') test -f /etc/group && groupcat='cat /etc/group';;
8877esac
8878case "$passcat" in
8879'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8880esac
8881
8882: now get the host name
8883echo " "
8884echo "Figuring out host name..." >&4
8885case "$myhostname" in
8886'') cont=true
8887	echo 'Maybe "hostname" will work...'
8888	if tans=`sh -c hostname 2>&1` ; then
8889		myhostname=$tans
8890		phostname=hostname
8891		cont=''
8892	fi
8893	;;
8894*) cont='';;
8895esac
8896if $test "$cont"; then
8897	if ./xenix; then
8898		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8899		if tans=`cat /etc/systemid 2>&1` ; then
8900			myhostname=$tans
8901			phostname='cat /etc/systemid'
8902			echo "Whadyaknow.  Xenix always was a bit strange..."
8903			cont=''
8904		fi
8905	elif $test -r /etc/systemid; then
8906		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8907	fi
8908fi
8909if $test "$cont"; then
8910	echo 'No, maybe "uuname -l" will work...'
8911	if tans=`sh -c 'uuname -l' 2>&1` ; then
8912		myhostname=$tans
8913		phostname='uuname -l'
8914	else
8915		echo 'Strange.  Maybe "uname -n" will work...'
8916		if tans=`sh -c 'uname -n' 2>&1` ; then
8917			myhostname=$tans
8918			phostname='uname -n'
8919		else
8920			echo 'Oh well, maybe I can mine it out of whoami.h...'
8921			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8922				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8923				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8924			else
8925				case "$myhostname" in
8926				'') echo "Does this machine have an identity crisis or something?"
8927					phostname='';;
8928				*)
8929					echo "Well, you said $myhostname before..."
8930					phostname='echo $myhostname';;
8931				esac
8932			fi
8933		fi
8934	fi
8935fi
8936case "$myhostname" in
8937'') myhostname=noname ;;
8938esac
8939: you do not want to know about this
8940set $myhostname
8941myhostname=$1
8942
8943: verify guess
8944if $test "$myhostname" ; then
8945	dflt=y
8946	rp='Your host name appears to be "'$myhostname'".'" Right?"
8947	. ./myread
8948	case "$ans" in
8949	y*) ;;
8950	*) myhostname='';;
8951	esac
8952fi
8953
8954: bad guess or no guess
8955while $test "X$myhostname" = X ; do
8956	dflt=''
8957	rp="Please type the (one word) name of your host:"
8958	. ./myread
8959	myhostname="$ans"
8960done
8961
8962: translate upper to lower if necessary
8963case "$myhostname" in
8964*[A-Z]*)
8965	echo "(Normalizing case in your host name)"
8966	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8967	;;
8968esac
8969
8970case "$myhostname" in
8971*.*)
8972	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8973	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8974	echo "(Trimming domain name from host name--host name is now $myhostname)"
8975	;;
8976*) case "$mydomain" in
8977	'')
8978		{
8979			test "X$hostcat" = "Xypcat hosts" &&
8980			ypmatch "$myhostname" hosts 2>/dev/null |\
8981				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8982			$test -s hosts
8983		} || {
8984			test "X$hostcat" != "X" &&
8985		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8986					/[	 ]$myhostname[	. ]/p" > hosts
8987		}
8988		tmp_re="[	. ]"
8989		if $test -f hosts; then
8990			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8991			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8992			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8993				hosts | $sort | $uniq | \
8994				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8995			case `$echo X$dflt` in
8996			X*\ *)	echo "(Several hosts in the database matched hostname)"
8997				dflt=.
8998				;;
8999			X.) echo "(You do not have fully-qualified names in the hosts database)"
9000				;;
9001			esac
9002		else
9003			echo "(I cannot locate a hosts database anywhere)"
9004			dflt=.
9005		fi
9006		case "$dflt" in
9007		.)
9008			tans=`./loc resolv.conf X /etc /usr/etc`
9009			if $test -f "$tans"; then
9010				echo "(Attempting domain name extraction from $tans)"
9011				dflt=.`$sed -n -e 's/	/ /g' \
9012				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9013				  -e 1q 2>/dev/null`
9014				case "$dflt" in
9015				.) dflt=.`$sed -n -e 's/	/ /g' \
9016				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9017				     -e 1q 2>/dev/null`
9018  					;;
9019				esac
9020			fi
9021			;;
9022		esac
9023		case "$dflt" in
9024		.) echo "(No help from resolv.conf either -- attempting clever guess)"
9025			dflt=.`sh -c domainname 2>/dev/null`
9026			case "$dflt" in
9027			'') dflt='.';;
9028			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9029			esac
9030			;;
9031		esac
9032		case "$dflt$osname" in
9033		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9034			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9035			;;
9036		esac
9037		case "$dflt" in
9038		.) echo "(Lost all hope -- silly guess then)"
9039			dflt='.nonet'
9040			;;
9041		esac
9042		$rm -f hosts
9043		;;
9044	*) dflt="$mydomain";;
9045	esac;;
9046esac
9047echo " "
9048rp="What is your domain name?"
9049. ./myread
9050tans="$ans"
9051case "$ans" in
9052'') ;;
9053.*) ;;
9054*) tans=".$tans";;
9055esac
9056mydomain="$tans"
9057
9058: translate upper to lower if necessary
9059case "$mydomain" in
9060*[A-Z]*)
9061	echo "(Normalizing case in your domain name)"
9062	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9063	;;
9064esac
9065
9066: a little sanity check here
9067case "$phostname" in
9068'') ;;
9069*)
9070	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9071	$myhostname$mydomain|$myhostname) ;;
9072	*)
9073		case "$phostname" in
9074		sed*)
9075			echo "(That doesn't agree with your whoami.h file, by the way.)"
9076			;;
9077		*)
9078			echo "(That doesn't agree with your $phostname command, by the way.)"
9079			;;
9080		esac
9081	;;
9082	esac
9083	;;
9084esac
9085
9086: determine the e-mail address of the user who is running us
9087$cat <<EOM
9088
9089I need to get your e-mail address in Internet format if possible, i.e.
9090something like user@host.domain. Please answer accurately since I have
9091no easy means to double check it. The default value provided below
9092is most probably close to reality but may not be valid from outside
9093your organization...
9094
9095EOM
9096cont=x
9097while test "$cont"; do
9098	case "$MAILDOMAIN" in
9099	'')
9100		if $test -s /etc/mailname; then
9101			maildomain=`$cat /etc/mailname`
9102		else
9103			maildomain="$myhostname$mydomain"
9104		fi
9105		;;
9106	*)  maildomain="$MAILDOMAIN";;
9107	esac
9108	case "$cf_email" in
9109	'') dflt="$cf_by@$maildomain";;
9110	*)  dflt="$cf_email";;
9111	esac
9112	rp='What is your e-mail address?'
9113	. ./myread
9114	cf_email="$ans"
9115	case "$cf_email" in
9116	*@*.*) cont='' ;;
9117	*)
9118		rp='Address does not look like an Internet one.  Use it anyway?'
9119		case "$fastread" in
9120		yes) dflt=y ;;
9121		*) dflt=n ;;
9122		esac
9123		. ./myread
9124		case "$ans" in
9125		y*) cont='' ;;
9126		*) echo " " ;;
9127		esac
9128		;;
9129	esac
9130done
9131
9132: Ask e-mail of administrator
9133$cat <<EOM
9134
9135If you or somebody else will be maintaining perl at your site, please
9136fill in the correct e-mail address here so that they may be contacted
9137if necessary. Currently, the "perlbug" program included with perl
9138will send mail to this address in addition to perlbug@perl.org. You may
9139enter "none" for no administrator.
9140
9141EOM
9142case "$perladmin" in
9143'') dflt="$cf_email";;
9144*) dflt="$perladmin";;
9145esac
9146rp='Perl administrator e-mail address'
9147. ./myread
9148perladmin="$ans"
9149
9150: determine whether to only install version-specific parts.
9151echo " "
9152$cat <<EOM
9153Do you want to install only the version-specific parts of the perl
9154distribution?  Usually you do *not* want to do this.
9155EOM
9156case "$versiononly" in
9157"$define"|[Yy]*|true) dflt='y' ;;
9158*) dflt='n';
9159esac
9160rp="Do you want to install only the version-specific parts of perl?"
9161. ./myread
9162case "$ans" in
9163[yY]*)	val="$define";;
9164*)	val="$undef" ;;
9165esac
9166set versiononly
9167eval $setvar
9168
9169case "$versiononly" in
9170"$define") inc_version_list=''
9171           inc_version_list_init=0
9172           ;;
9173esac
9174
9175: figure out how to guarantee perl startup
9176: XXX Note that this currently takes advantage of the bug that binexp ignores
9177:     the Configure -Dinstallprefix setting, which in turn means that under
9178:     relocatable @INC, initialinstalllocation is what binexp started as.
9179case "$startperl" in
9180'')
9181	case "$sharpbang" in
9182	*!)
9183		$cat <<EOH
9184
9185I can use the #! construct to start perl on your system. This will
9186make startup of perl scripts faster, but may cause problems if you
9187want to share those scripts and perl is not in a standard place
9188($initialinstalllocation/perl) on all your platforms. The alternative
9189is to force a shell by starting the script with a single ':' character.
9190
9191EOH
9192		case "$versiononly" in
9193		"$define")      dflt="$initialinstalllocation/perl$version";;
9194		*)              dflt="$initialinstalllocation/perl";;
9195		esac
9196		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9197		. ./myread
9198		case "$ans" in
9199		none)	startperl=": # use perl";;
9200		*)	startperl="#!$ans"
9201			if $test 30 -lt `echo "$ans" | wc -c`; then
9202				$cat >&4 <<EOM
9203
9204WARNING:  Some systems limit the #! command to 32 characters.
9205If you experience difficulty running Perl scripts with #!, try
9206installing Perl in a directory with a shorter pathname.
9207
9208EOM
9209			fi ;;
9210		esac
9211		;;
9212	*) startperl=": # use perl"
9213		;;
9214	esac
9215	;;
9216esac
9217echo "I'll use $startperl to start perl scripts."
9218
9219: figure best path for perl in scripts
9220case "$perlpath" in
9221'')
9222	case "$versiononly" in
9223	"$define")	perlpath="$initialinstalllocation/perl$version";;
9224	*)		perlpath="$initialinstalllocation/perl";;
9225	esac
9226	case "$startperl" in
9227	*!*) ;;
9228	*)
9229		$cat <<EOH
9230
9231I will use the "eval 'exec'" idiom to start Perl on your system.
9232I can use the full path of your Perl binary for this purpose, but
9233doing so may cause problems if you want to share those scripts and
9234Perl is not always in a standard place ($initialinstalllocation/perl).
9235
9236EOH
9237		dflt="$initialinstalllocation/perl"
9238		rp="What path shall I use in \"eval 'exec'\"?"
9239		. ./myread
9240		perlpath="$ans"
9241		;;
9242	esac
9243	;;
9244esac
9245case "$startperl" in
9246*!*)	;;
9247*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9248esac
9249
9250: determine where public executable scripts go
9251set scriptdir scriptdir
9252eval $prefixit
9253case "$scriptdir" in
9254'')
9255	dflt="$bin"
9256	: guess some guesses
9257	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9258	$test -d /usr/share/bin     && dflt=/usr/share/bin
9259	$test -d /usr/local/script  && dflt=/usr/local/script
9260	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9261	$test -d $prefixexp/script  && dflt=$prefixexp/script
9262	set dflt
9263	eval $prefixup
9264	;;
9265*)  dflt="$scriptdir"
9266	;;
9267esac
9268$cat <<EOM
9269
9270Some installations have a separate directory just for executable scripts so
9271that they can mount it across multiple architectures but keep the scripts in
9272one spot.  You might, for example, have a subdirectory of /usr/share for this.
9273Or you might just lump your scripts in with all your other executables.
9274
9275EOM
9276fn=d~
9277rp='Where do you keep publicly executable scripts?'
9278. ./getfile
9279if $test "X$ansexp" != "X$scriptdirexp"; then
9280	installscript=''
9281fi
9282installscriptdir=''
9283prefixvar=scriptdir
9284. ./setprefixvar
9285: A little fix up for an irregularly named variable.
9286installscript="$installscriptdir"
9287
9288: determine where add-on public executables go
9289case "$sitebin" in
9290'')	dflt=$siteprefix/bin ;;
9291*)	dflt=$sitebin ;;
9292esac
9293fn=d~
9294rp='Pathname where the add-on public executables should be installed?'
9295. ./getfile
9296prefixvar=sitebin
9297. ./setprefixvar
9298
9299: determine where add-on html pages go
9300: There is no standard location, so try to copy the previously-selected
9301: directory structure for the core html pages.
9302case "$sitehtml1dir" in
9303'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9304*)     dflt=$sitehtml1dir ;;
9305esac
9306case "$dflt" in
9307''|' ') dflt=none ;;
9308esac
9309fn=dn+~
9310rp='Pathname where the site-specific html pages should be installed?'
9311. ./getfile
9312prefixvar=sitehtml1dir
9313. ./setprefixvar
9314
9315: determine where add-on library html pages go
9316: There is no standard location, so try to copy the previously-selected
9317: directory structure for the core html pages.
9318case "$sitehtml3dir" in
9319'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9320*)     dflt=$sitehtml3dir ;;
9321esac
9322case "$dflt" in
9323''|' ') dflt=none ;;
9324esac
9325fn=dn+~
9326rp='Pathname where the site-specific library html pages should be installed?'
9327. ./getfile
9328prefixvar=sitehtml3dir
9329. ./setprefixvar
9330
9331: determine where add-on manual pages go
9332case "$siteman1dir" in
9333'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9334*)	dflt=$siteman1dir ;;
9335esac
9336case "$dflt" in
9337''|' ') dflt=none ;;
9338esac
9339fn=dn+~
9340rp='Pathname where the site-specific manual pages should be installed?'
9341. ./getfile
9342prefixvar=siteman1dir
9343. ./setprefixvar
9344
9345: determine where add-on library man pages go
9346case "$siteman3dir" in
9347'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9348*)	dflt=$siteman3dir ;;
9349esac
9350case "$dflt" in
9351''|' ') dflt=none ;;
9352esac
9353fn=dn+~
9354rp='Pathname where the site-specific library manual pages should be installed?'
9355. ./getfile
9356prefixvar=siteman3dir
9357. ./setprefixvar
9358
9359: determine where add-on public executable scripts go
9360case "$sitescript" in
9361'')	dflt=$siteprefix/script
9362	$test -d $dflt || dflt=$sitebin ;;
9363*)  dflt="$sitescript" ;;
9364esac
9365fn=d~+
9366rp='Pathname where add-on public executable scripts should be installed?'
9367. ./getfile
9368prefixvar=sitescript
9369. ./setprefixvar
9370
9371: Check if faststdio is requested and available
9372case "$usefaststdio" in
9373$define|true|[yY]*|'')
9374	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9375	case "$xversion" in
9376	[68])	dflt='y' ;;
9377	*)	dflt='n' ;;
9378	esac
9379	;;
9380*) dflt='n';;
9381esac
9382cat <<EOM
9383
9384Perl can be built to use 'fast stdio', which means using the stdio
9385library but also directly manipulating the stdio buffers to enable
9386faster I/O.  Using stdio is better for backward compatibility (especially
9387for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9388interface has been preferred instead of stdio.
9389
9390If this doesn't make any sense to you, just accept the default '$dflt'.
9391EOM
9392rp='Use the "fast stdio" if available?'
9393. ./myread
9394case "$ans" in
9395y|Y)	val="$define" ;;
9396*)      val="$undef" ;;
9397esac
9398set usefaststdio
9399eval $setvar
9400
9401
9402: define an is-a-typedef? function
9403typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9404case "$inclist" in
9405"") inclist="sys/types.h";;
9406esac;
9407eval "varval=\$$var";
9408case "$varval" in
9409"")
9410	$rm -f temp.c;
9411	for inc in $inclist; do
9412		echo "#include <$inc>" >>temp.c;
9413	done;
9414	echo "#ifdef $type" >> temp.c;
9415	echo "printf(\"We have $type\");" >> temp.c;
9416	echo "#endif" >> temp.c;
9417	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9418	if $contains $type temp.E >/dev/null 2>&1; then
9419		eval "$var=\$type";
9420	else
9421		eval "$var=\$def";
9422	fi;
9423	$rm -f temp.?;;
9424*) eval "$var=\$varval";;
9425esac'
9426
9427: define an is-a-typedef? function that prompts if the type is not available.
9428typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9429case "$inclist" in
9430"") inclist="sys/types.h";;
9431esac;
9432eval "varval=\$$var";
9433case "$varval" in
9434"")
9435	$rm -f temp.c;
9436	for inc in $inclist; do
9437		echo "#include <$inc>" >>temp.c;
9438	done;
9439	echo "#ifdef $type" >> temp.c;
9440	echo "printf(\"We have $type\");" >> temp.c;
9441	echo "#endif" >> temp.c;
9442	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9443	echo " " ;
9444	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9445	if $contains $type temp.E >/dev/null 2>&1; then
9446		echo "$type found." >&4;
9447		eval "$var=\$type";
9448	else
9449		echo "$type NOT found." >&4;
9450		dflt="$def";
9451		. ./myread ;
9452		eval "$var=\$ans";
9453	fi;
9454	$rm -f temp.?;;
9455*) eval "$var=\$varval";;
9456esac'
9457
9458: see what type lseek is declared as in the kernel
9459rp="What is the type used for lseek's offset on this system?"
9460set off_t lseektype long stdio.h sys/types.h
9461eval $typedef_ask
9462
9463echo " "
9464echo "Checking to see how big your file offsets are..." >&4
9465$cat >try.c <<EOCP
9466#include <sys/types.h>
9467#include <stdio.h>
9468int main()
9469{
9470    printf("%d\n", (int)sizeof($lseektype));
9471    return(0);
9472}
9473EOCP
9474set try
9475if eval $compile_ok; then
9476	lseeksize=`$run ./try`
9477	echo "Your file offsets are $lseeksize bytes long."
9478else
9479	dflt=$longsize
9480	echo " "
9481	echo "(I can't seem to compile the test program.  Guessing...)"
9482	rp="What is the size of your file offsets (in bytes)?"
9483	. ./myread
9484	lseeksize="$ans"
9485fi
9486$rm_try
9487
9488: see what type file positions are declared as in the library
9489rp="What is the type for file position used by fsetpos()?"
9490set fpos_t fpostype long stdio.h sys/types.h
9491eval $typedef_ask
9492
9493: Check size for Fpos_t
9494echo " "
9495case "$fpostype" in
9496*_t) zzz="$fpostype"	;;
9497*)   zzz="fpos_t"	;;
9498esac
9499echo "Checking the size of $zzz..." >&4
9500cat > try.c <<EOCP
9501#include <sys/types.h>
9502#include <stdio.h>
9503#$i_stdlib I_STDLIB
9504#ifdef I_STDLIB
9505#include <stdlib.h>
9506#endif
9507int main() {
9508    printf("%d\n", (int)sizeof($fpostype));
9509    exit(0);
9510}
9511EOCP
9512set try
9513if eval $compile_ok; then
9514	yyy=`$run ./try`
9515	case "$yyy" in
9516	'')	fpossize=4
9517		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9518		;;
9519	*)	fpossize=$yyy
9520		echo "Your $zzz is $fpossize bytes long."
9521		;;
9522	esac
9523else
9524	dflt="$longsize"
9525	echo " " >&4
9526	echo "(I can't compile the test program.  Guessing...)" >&4
9527	rp="What is the size of your file positions (in bytes)?"
9528	. ./myread
9529	fpossize="$ans"
9530fi
9531
9532: Check for large file support
9533# Backward compatibility (uselfs is deprecated).
9534case "$uselfs" in
9535"$define"|true|[yY]*)
9536	cat <<EOM >&4
9537
9538*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9539EOM
9540	uselargefiles="$define"
9541	;;
9542esac
9543
9544case "$lseeksize:$fpossize" in
95458:8) cat <<EOM
9546
9547You can have files larger than 2 gigabytes.
9548EOM
9549   val="$define" ;;
9550*)    case "$uselargefiles" in
9551   "$undef"|false|[nN]*) dflt='n' ;;
9552   *)	dflt='y' ;;
9553   esac
9554   cat <<EOM
9555
9556Perl can be built to understand large files (files larger than 2 gigabytes)
9557on some systems.  To do so, Configure can be run with -Duselargefiles.
9558
9559If this doesn't make any sense to you, just accept the default '$dflt'.
9560EOM
9561   rp='Try to understand large files, if available?'
9562   . ./myread
9563   case "$ans" in
9564   y|Y) 	val="$define" ;;
9565   *)   	val="$undef"  ;;
9566   esac
9567   ;;
9568esac
9569set uselargefiles
9570eval $setvar
9571: Look for a hint-file generated 'call-back-unit'.  If the
9572: user has specified that a large files perl is to be built,
9573: we may need to set or change some other defaults.
9574if $test -f uselargefiles.cbu; then
9575	echo "Your platform has some specific hints regarding large file builds, using them..."
9576	. ./uselargefiles.cbu
9577fi
9578case "$uselargefiles" in
9579"$define")
9580	if $test -f uselargefiles.cbu; then
9581		echo " "
9582		echo "Rechecking to see how big your file offsets are..." >&4
9583		$cat >try.c <<EOCP
9584#include <sys/types.h>
9585#include <stdio.h>
9586int main()
9587{
9588    printf("%d\n", (int)sizeof($lseektype));
9589    return(0);
9590}
9591EOCP
9592		set try
9593		if eval $compile_ok; then
9594			lseeksize=`$run ./try`
9595			$echo "Your file offsets are now $lseeksize bytes long."
9596		else
9597			dflt="$lseeksize"
9598			echo " "
9599			echo "(I can't seem to compile the test program.  Guessing...)"
9600			rp="What is the size of your file offsets (in bytes)?"
9601			. ./myread
9602			lseeksize="$ans"
9603		fi
9604		case "$fpostype" in
9605		*_t) zzz="$fpostype"	;;
9606		*)   zzz="fpos_t"	;;
9607		esac
9608		$echo $n "Rechecking the size of $zzz...$c" >&4
9609		$cat > try.c <<EOCP
9610#include <sys/types.h>
9611#include <stdio.h>
9612#$i_stdlib I_STDLIB
9613#ifdef I_STDLIB
9614#include <stdlib.h>
9615#endif
9616int main() {
9617    printf("%d\n", (int)sizeof($fpostype));
9618    return(0);
9619}
9620EOCP
9621		set try
9622		if eval $compile_ok; then
9623			yyy=`$run ./try`
9624			dflt="$lseeksize"
9625			case "$yyy" in
9626			'')	echo " "
9627				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9628				;;
9629			*)	fpossize=$yyy
9630				echo " $fpossize bytes." >&4
9631				;;
9632			esac
9633		else
9634			dflt="$fpossize"
9635			echo " "
9636			echo "(I can't compile the test program.  Guessing...)" >&4
9637			rp="What is the size of your file positions (in bytes)?"
9638			. ./myread
9639			fpossize="$ans"
9640		fi
9641		$rm_try
9642	fi
9643	;;
9644esac
9645
9646: Check if we want perlio
9647useperlio="$define"
9648
9649: Set the vendorbin variables
9650case "$vendorprefix" in
9651'')	d_vendorbin="$undef"
9652	vendorbin=''
9653	vendorbinexp=''
9654	;;
9655*)	d_vendorbin="$define"
9656	: determine where vendor-supplied executables go.
9657	case "$vendorbin" in
9658	'') dflt=$vendorprefix/bin ;;
9659	*)	dflt="$vendorbin" ;;
9660	esac
9661	fn=d~+
9662	rp='Pathname for the vendor-supplied executables directory?'
9663	. ./getfile
9664	vendorbin="$ans"
9665	vendorbinexp="$ansexp"
9666	;;
9667esac
9668prefixvar=vendorbin
9669. ./installprefix
9670
9671: Set the vendorhtml1dir variables
9672case "$vendorprefix" in
9673'')	vendorhtml1dir=''
9674	vendorhtml1direxp=''
9675	;;
9676*)	: determine where vendor-supplied html pages go.
9677	: There is no standard location, so try to copy the previously-selected
9678	: directory structure for the core html pages.
9679	: XXX Better default suggestions would be welcome.
9680	case "$vendorhtml1dir" in
9681	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9682	*)	dflt=$vendorhtml1dir ;;
9683	esac
9684	case "$dflt" in
9685	''|' ') dflt=none ;;
9686	esac
9687	fn=dn+~
9688	rp='Pathname for the vendor-supplied html pages?'
9689	. ./getfile
9690	vendorhtml1dir="$ans"
9691	vendorhtml1direxp="$ansexp"
9692	;;
9693esac
9694: Use ' ' for none so value is preserved next time through Configure
9695$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9696prefixvar=vendorhtml1dir
9697. ./installprefix
9698
9699: Set the vendorhtml3dir variables
9700case "$vendorprefix" in
9701'')	vendorhtml3dir=''
9702	vendorhtml3direxp=''
9703	;;
9704*)	: determine where vendor-supplied module html pages go.
9705	: There is no standard location, so try to copy the previously-selected
9706	: directory structure for the core html pages.
9707	: XXX Better default suggestions would be welcome.
9708	case "$vendorhtml3dir" in
9709	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9710	*)	dflt=$vendorhtml3dir ;;
9711	esac
9712	case "$dflt" in
9713	''|' ') dflt=none ;;
9714	esac
9715	fn=dn+~
9716	rp='Pathname for the vendor-supplied html pages?'
9717	. ./getfile
9718	vendorhtml3dir="$ans"
9719	vendorhtml3direxp="$ansexp"
9720	;;
9721esac
9722: Use ' ' for none so value is preserved next time through Configure
9723$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9724prefixvar=vendorhtml3dir
9725. ./installprefix
9726
9727: Set the vendorman1dir variables
9728case "$vendorprefix" in
9729'')	vendorman1dir=''
9730	vendorman1direxp=''
9731	;;
9732*)	: determine where vendor-supplied manual pages go.
9733	case "$vendorman1dir" in
9734	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9735	*)	dflt=$vendorman1dir ;;
9736	esac
9737	case "$dflt" in
9738	''|' ') dflt=none ;;
9739	esac
9740	fn=nd~+
9741	rp='Pathname for the vendor-supplied manual section 1 pages?'
9742	. ./getfile
9743	vendorman1dir="$ans"
9744	vendorman1direxp="$ansexp"
9745	;;
9746esac
9747: Use ' ' for none so value is preserved next time through Configure
9748$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9749prefixvar=vendorman1dir
9750. ./installprefix
9751
9752: Set the vendorman3dir variables
9753case "$vendorprefix" in
9754'')	vendorman3dir=''
9755	vendorman3direxp=''
9756	;;
9757*)	: determine where vendor-supplied module manual pages go.
9758	case "$vendorman3dir" in
9759	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9760	*)	dflt=$vendorman3dir ;;
9761	esac
9762	case "$dflt" in
9763	''|' ') dflt=none ;;
9764	esac
9765	fn=nd~+
9766	rp='Pathname for the vendor-supplied manual section 3 pages?'
9767	. ./getfile
9768	vendorman3dir="$ans"
9769	vendorman3direxp="$ansexp"
9770	;;
9771esac
9772: Use ' ' for none so value is preserved next time through Configure
9773$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9774prefixvar=vendorman3dir
9775. ./installprefix
9776
9777: Set the vendorscript variables
9778case "$vendorprefix" in
9779'')	d_vendorscript="$undef"
9780	vendorscript=''
9781	vendorscriptexp=''
9782	;;
9783*)	d_vendorscript="$define"
9784	: determine where vendor-supplied scripts go.
9785	case "$vendorscript" in
9786	'')	dflt=$vendorprefix/script
9787		$test -d $dflt || dflt=$vendorbin ;;
9788	*)  dflt="$vendorscript" ;;
9789	esac
9790	$cat <<EOM
9791
9792The installation process will create a directory for
9793vendor-supplied scripts.
9794
9795EOM
9796	fn=d~+
9797	rp='Pathname for the vendor-supplied scripts directory?'
9798	. ./getfile
9799	vendorscript="$ans"
9800	vendorscriptexp="$ansexp"
9801	;;
9802esac
9803prefixvar=vendorscript
9804. ./installprefix
9805
9806: script used to emit important warnings
9807cat >warn <<EOS
9808$startsh
9809if test \$# -gt 0; then
9810	echo "\$@" >msg
9811else
9812	cat >msg
9813fi
9814echo "*** WARNING:" >&4
9815sed -e 's/^/*** /' <msg >&4
9816echo "*** " >&4
9817cat msg >>config.msg
9818echo " " >>config.msg
9819rm -f msg
9820EOS
9821chmod +x warn
9822$eunicefix warn
9823
9824: see which of string.h or strings.h is needed
9825echo " "
9826strings=`./findhdr string.h`
9827if $test "$strings" && $test -r "$strings"; then
9828	echo "Using <string.h> instead of <strings.h>." >&4
9829	val="$define"
9830else
9831	val="$undef"
9832	strings=`./findhdr strings.h`
9833	if $test "$strings" && $test -r "$strings"; then
9834		echo "Using <strings.h> instead of <string.h>." >&4
9835	else
9836		./warn "No string header found -- You'll surely have problems."
9837	fi
9838fi
9839set i_string
9840eval $setvar
9841case "$i_string" in
9842"$undef") strings=`./findhdr strings.h`;;
9843*)	  strings=`./findhdr string.h`;;
9844esac
9845
9846: see if qgcvt exists
9847set qgcvt d_qgcvt
9848eval $inlibc
9849
9850: Check print/scan long double stuff
9851echo " "
9852
9853if $test X"$d_longdbl" = X"$define"; then
9854
9855echo "Checking how to print long doubles..." >&4
9856
9857if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9858	$cat >try.c <<'EOCP'
9859#include <sys/types.h>
9860#include <stdio.h>
9861int main() {
9862  double d = 123.456;
9863  printf("%.3f\n", d);
9864}
9865EOCP
9866	set try
9867	if eval $compile; then
9868		yyy=`$run ./try`
9869		case "$yyy" in
9870		123.456)
9871			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9872                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9873			echo "We will use %f."
9874			;;
9875		esac
9876	fi
9877fi
9878
9879if $test X"$sPRIfldbl" = X; then
9880	$cat >try.c <<'EOCP'
9881#include <sys/types.h>
9882#include <stdio.h>
9883int main() {
9884  long double d = 123.456;
9885  printf("%.3Lf\n", d);
9886}
9887EOCP
9888	set try
9889	if eval $compile; then
9890		yyy=`$run ./try`
9891		case "$yyy" in
9892		123.456)
9893			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9894                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9895			echo "We will use %Lf."
9896			;;
9897		esac
9898	fi
9899fi
9900
9901if $test X"$sPRIfldbl" = X; then
9902	$cat >try.c <<'EOCP'
9903#include <sys/types.h>
9904#include <stdio.h>
9905int main() {
9906  long double d = 123.456;
9907  printf("%.3llf\n", d);
9908}
9909EOCP
9910	set try
9911	if eval $compile; then
9912		yyy=`$run ./try`
9913		case "$yyy" in
9914		123.456)
9915			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9916                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9917			echo "We will use %llf."
9918			;;
9919		esac
9920	fi
9921fi
9922
9923if $test X"$sPRIfldbl" = X; then
9924	$cat >try.c <<'EOCP'
9925#include <sys/types.h>
9926#include <stdio.h>
9927int main() {
9928  long double d = 123.456;
9929  printf("%.3lf\n", d);
9930}
9931EOCP
9932	set try
9933	if eval $compile; then
9934		yyy=`$run ./try`
9935		case "$yyy" in
9936		123.456)
9937			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9938                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9939			echo "We will use %lf."
9940			;;
9941		esac
9942	fi
9943fi
9944
9945if $test X"$sPRIfldbl" = X; then
9946	echo "Cannot figure out how to print long doubles." >&4
9947else
9948	sSCNfldbl=$sPRIfldbl	# expect consistency
9949fi
9950
9951$rm_try
9952
9953fi # d_longdbl
9954
9955case "$sPRIfldbl" in
9956'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9957	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9958	d_SCNfldbl="$undef";
9959	;;
9960*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9961	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9962	d_SCNfldbl="$define";
9963	;;
9964esac
9965
9966: Check how to convert floats to strings.
9967
9968if test "X$d_Gconvert" = X; then
9969
9970echo " "
9971echo "Checking for an efficient way to convert floats to strings."
9972echo " " > try.c
9973case "$uselongdouble" in
9974"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9975esac
9976case "$d_longdbl" in
9977"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9978esac
9979case "$d_PRIgldbl" in
9980"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9981esac
9982$cat >>try.c <<EOP
9983#ifdef TRY_gconvert
9984#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9985char *myname = "gconvert";
9986#endif
9987#ifdef TRY_gcvt
9988#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9989char *myname = "gcvt";
9990#endif
9991#ifdef TRY_qgcvt
9992#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9993char *myname = "qgcvt";
9994#define DOUBLETYPE long double
9995#endif
9996#ifdef TRY_sprintf
9997#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9998#ifdef HAS_PRIgldbl
9999#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10000#else
10001#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10002#endif
10003#else
10004#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10005#endif
10006char *myname = "sprintf";
10007#endif
10008
10009#ifndef DOUBLETYPE
10010#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10011#define DOUBLETYPE long double
10012#else
10013#define DOUBLETYPE double
10014#endif
10015#endif
10016
10017#include <stdio.h>
10018
10019#$i_stdlib I_STDLIB
10020#ifdef I_STDLIB
10021#include <stdlib.h>
10022#endif
10023#$i_string I_STRING
10024#ifdef I_STRING
10025#  include <string.h>
10026#else
10027#  include <strings.h>
10028#endif
10029
10030int checkit(char *expect, char *got)
10031{
10032    if (strcmp(expect, got)) {
10033		printf("%s oddity:  Expected %s, got %s\n",
10034			myname, expect, got);
10035		exit(1);
10036	}
10037}
10038
10039int main()
10040{
10041	char buf[64];
10042	buf[63] = '\0';
10043
10044	/* This must be 1st test on (which?) platform */
10045	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10046	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10047	checkit("0.1", buf);
10048
10049	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10050	checkit("0.01", buf);
10051
10052	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10053	checkit("0.001", buf);
10054
10055	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10056	checkit("0.0001", buf);
10057
10058	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10059	if (strlen(buf) > 5)
10060	    checkit("9e-005", buf); /* for Microsoft ?? */
10061	else
10062	    checkit("9e-05", buf);
10063
10064	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10065	checkit("1", buf);
10066
10067	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10068	checkit("1.1", buf);
10069
10070	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10071	checkit("1.01", buf);
10072
10073	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10074	checkit("1.001", buf);
10075
10076	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10077	checkit("1.0001", buf);
10078
10079	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10080	checkit("1.00001", buf);
10081
10082	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10083	checkit("1.000001", buf);
10084
10085	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10086	checkit("0", buf);
10087
10088	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10089	checkit("-1", buf);
10090
10091	/* Some Linux gcvt's give 1.e+5 here. */
10092	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10093	checkit("100000", buf);
10094
10095	/* Some Linux gcvt's give -1.e+5 here. */
10096	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10097	checkit("-100000", buf);
10098
10099	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10100	checkit("123.456", buf);
10101
10102	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10103	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10104	/* 34 should be enough to scare even long double
10105	 * places into using the e notation. */
10106	if (strlen(buf) > 5)
10107	    checkit("1e+034", buf); /* for Microsoft */
10108	else
10109	    checkit("1e+34", buf);
10110
10111	/* For Perl, if you add additional tests here, also add them to
10112	 * t/base/num.t for benefit of platforms not using Configure or
10113	 * overriding d_Gconvert */
10114
10115	exit(0);
10116}
10117EOP
10118: first add preferred functions to our list
10119xxx_list=""
10120for xxx_convert in $gconvert_preference; do
10121    case $xxx_convert in
10122    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10123    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10124    esac
10125done
10126: then add any others
10127for xxx_convert in gconvert gcvt sprintf; do
10128    case "$xxx_list" in
10129    *$xxx_convert*) ;;
10130    *) xxx_list="$xxx_list $xxx_convert" ;;
10131    esac
10132done
10133
10134case "$d_longdbl$uselongdouble" in
10135"$define$define")
10136    : again, add preferred functions to our list first
10137    xxx_ld_list=""
10138    for xxx_convert in $gconvert_ld_preference; do
10139        case $xxx_convert in
10140        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10141        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10142        esac
10143    done
10144    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10145    for xxx_convert in qgcvt sprintf $xxx_list; do
10146        case "$xxx_ld_list" in
10147        $xxx_convert*|*" $xxx_convert"*) ;;
10148        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10149        esac
10150    done
10151    : if sprintf cannot do long doubles, move it to the end
10152    if test "$d_PRIgldbl" != "$define"; then
10153        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10154    fi
10155    : if no qgcvt, remove it
10156    if test "$d_qgcvt" != "$define"; then
10157        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10158    fi
10159    : use the ld_list
10160    xxx_list="$xxx_ld_list"
10161    ;;
10162esac
10163
10164for xxx_convert in $xxx_list; do
10165	echo "Trying $xxx_convert..."
10166	$rm -f try try$_o core
10167	set try -DTRY_$xxx_convert
10168	if eval $compile; then
10169		echo "$xxx_convert() found." >&4
10170		if $run ./try; then
10171			echo "I'll use $xxx_convert to convert floats into a string." >&4
10172			break;
10173		else
10174			echo "...But $xxx_convert didn't work as I expected."
10175			xxx_convert=''
10176		fi
10177	else
10178		echo "$xxx_convert NOT found." >&4
10179	fi
10180done
10181
10182if test X$xxx_convert = X; then
10183    echo "*** WHOA THERE!!! ***" >&4
10184    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10185    xxx_convert=sprintf
10186fi
10187
10188case "$xxx_convert" in
10189gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10190gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10191qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10192*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10193   "$define$define$define")
10194      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10195   "$define$define$undef")
10196      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10197   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10198   esac
10199   ;;
10200esac
10201
10202fi
10203$rm_try
10204
10205: see if _fwalk exists
10206set fwalk d__fwalk
10207eval $inlibc
10208
10209: Initialize h_fcntl
10210h_fcntl=false
10211
10212: Initialize h_sysfile
10213h_sysfile=false
10214
10215: access call always available on UNIX
10216set access d_access
10217eval $inlibc
10218
10219: locate the flags for 'access()'
10220case "$d_access" in
10221"$define")
10222	echo " "
10223	$cat >access.c <<EOCP
10224#include <sys/types.h>
10225#ifdef I_FCNTL
10226#include <fcntl.h>
10227#endif
10228#ifdef I_SYS_FILE
10229#include <sys/file.h>
10230#endif
10231#ifdef I_UNISTD
10232#include <unistd.h>
10233#endif
10234#$i_stdlib I_STDLIB
10235#ifdef I_STDLIB
10236#include <stdlib.h>
10237#endif
10238int main() {
10239	exit(R_OK);
10240}
10241EOCP
10242	: check sys/file.h first, no particular reason here
10243	if $test `./findhdr sys/file.h` && \
10244		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10245		h_sysfile=true;
10246		echo "<sys/file.h> defines the *_OK access constants." >&4
10247	elif $test `./findhdr fcntl.h` && \
10248		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10249		h_fcntl=true;
10250		echo "<fcntl.h> defines the *_OK access constants." >&4
10251	elif $test `./findhdr unistd.h` && \
10252		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10253		echo "<unistd.h> defines the *_OK access constants." >&4
10254	else
10255		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10256	fi
10257	;;
10258esac
10259$rm -f access*
10260
10261: see if accessx exists
10262set accessx d_accessx
10263eval $inlibc
10264
10265: see if aintl exists
10266set aintl d_aintl
10267eval $inlibc
10268
10269: see if alarm exists
10270set alarm d_alarm
10271eval $inlibc
10272
10273: see if 64bit time functions exists
10274
10275set ctime64 d_ctime64
10276eval $inlibc
10277
10278set localtime64 d_localtime64
10279eval $inlibc
10280
10281set gmtime64 d_gmtime64
10282eval $inlibc
10283
10284set mktime64 d_mktime64
10285eval $inlibc
10286
10287set difftime64 d_difftime64
10288eval $inlibc
10289
10290set asctime64 d_asctime64
10291eval $inlibc
10292
10293: see if POSIX threads are available
10294set pthread.h i_pthread
10295eval $inhdr
10296
10297: define a function to check prototypes
10298$cat > protochk <<EOSH
10299$startsh
10300cc="$cc"
10301optimize="$optimize"
10302ccflags="$ccflags"
10303prototype="$prototype"
10304define="$define"
10305rm_try="$rm_try"
10306usethreads=$usethreads
10307i_pthread=$i_pthread
10308pthread_h_first=$pthread_h_first
10309EOSH
10310
10311$cat >> protochk <<'EOSH'
10312
10313$rm_try
10314foo="$1"
10315shift
10316while test $# -ge 2; do
10317	case "$1" in
10318		$define) echo "#include <$2>" >> try.c ;;
10319		literal) echo "$2" >> try.c ;;
10320	esac
10321    # Extra magic for the benefit of systems that need pthread.h
10322    # to be included early to correctly detect threadsafe functions.
10323    # Such functions must guarantee themselves, though, that the usethreads
10324    # and i_pthread have been defined, before calling protochk.
10325    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10326	echo "#include <pthread.h>" >> try.c
10327	pthread_h_done=yes
10328    fi
10329    shift 2
10330done
10331test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10332cat >> try.c <<'EOCP'
10333#ifdef CAN_PROTOTYPE
10334#define	_(args) args
10335#else
10336#define	_(args) ()
10337#endif
10338EOCP
10339echo "$foo" >> try.c
10340echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10341$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10342status=$?
10343$rm_try
10344exit $status
10345EOSH
10346chmod +x protochk
10347$eunicefix protochk
10348
10349: Define hasproto macro for Configure internal use
10350hasproto='varname=$1; func=$2; shift; shift;
10351while $test $# -ge 2; do
10352	case "$1" in
10353	$define) echo "#include <$2>";;
10354	esac ;
10355    shift 2;
10356done > try.c;
10357$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10358if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10359	echo "$func() prototype found.";
10360	val="$define";
10361else
10362	echo "$func() prototype NOT found.";
10363	val="$undef";
10364fi;
10365set $varname;
10366eval $setvar;
10367$rm_try tryout.c'
10368
10369: see if sys/types.h has to be included
10370set sys/types.h i_systypes
10371eval $inhdr
10372
10373: see if sys/select.h has to be included
10374set sys/select.h i_sysselct
10375eval $inhdr
10376
10377: Define hasfield macro for Configure internal use
10378hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10379while $test $# -ge 2; do
10380	case "$1" in
10381	$define) echo "#include <$2>";;
10382	esac ;
10383    shift 2;
10384done > try.c;
10385echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10386set try;
10387if eval $compile; then
10388	val="$define";
10389else
10390	val="$undef";
10391fi;
10392set $varname;
10393eval $setvar;
10394$rm_try'
10395
10396: see if we should include time.h, sys/time.h, or both
10397echo " "
10398if test "X$timeincl" = X; then
10399	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10400	$echo $n "I'm now running the test program...$c"
10401	$cat >try.c <<EOCP
10402#include <sys/types.h>
10403#ifdef I_TIME
10404#include <time.h>
10405#endif
10406#ifdef I_SYSTIME
10407#ifdef SYSTIMEKERNEL
10408#define KERNEL
10409#endif
10410#include <sys/time.h>
10411#endif
10412#ifdef I_SYSSELECT
10413#include <sys/select.h>
10414#endif
10415#$i_stdlib I_STDLIB
10416#ifdef I_STDLIB
10417#include <stdlib.h>
10418#endif
10419int main()
10420{
10421	struct tm foo;
10422#ifdef S_TIMEVAL
10423	struct timeval bar;
10424#endif
10425#ifdef S_TIMEZONE
10426	struct timezone tzp;
10427#endif
10428	if (foo.tm_sec == foo.tm_sec)
10429		exit(0);
10430#ifdef S_TIMEVAL
10431	if (bar.tv_sec == bar.tv_sec)
10432		exit(0);
10433#endif
10434	exit(1);
10435}
10436EOCP
10437	flags=''
10438	for s_timezone in '-DS_TIMEZONE' ''; do
10439	sysselect=''
10440	for s_timeval in '-DS_TIMEVAL' ''; do
10441	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10442	for i_time in '' '-DI_TIME'; do
10443	for i_systime in '-DI_SYSTIME' ''; do
10444		case "$flags" in
10445		'') $echo $n ".$c"
10446			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10447			if eval $compile; then
10448				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10449				shift
10450				flags="$*"
10451				echo " "
10452				$echo $n "Succeeded with $flags$c"
10453			fi
10454			;;
10455		esac
10456	done
10457	done
10458	done
10459	done
10460	done
10461	timeincl=''
10462	echo " "
10463	case "$flags" in
10464	*SYSTIMEKERNEL*) i_systimek="$define"
10465		timeincl=`./findhdr sys/time.h`
10466		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10467	*) i_systimek="$undef";;
10468	esac
10469	case "$flags" in
10470	*I_TIME*) i_time="$define"
10471		timeincl=`./findhdr time.h`" $timeincl"
10472		echo "We'll include <time.h>." >&4;;
10473	*) i_time="$undef";;
10474	esac
10475	case "$flags" in
10476	*I_SYSTIME*) i_systime="$define"
10477		timeincl=`./findhdr sys/time.h`" $timeincl"
10478		echo "We'll include <sys/time.h>." >&4;;
10479	*) i_systime="$undef";;
10480	esac
10481	$rm_try
10482fi
10483: see if struct tm knows about tm_zone
10484case "$i_systime$i_time" in
10485*$define*)
10486        echo " "
10487        echo "Checking to see if your struct tm has tm_zone field..." >&4
10488        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10489        eval $hasfield
10490        ;;
10491*)      val="$undef"
10492        set d_tm_tm_zone
10493        eval $setvar
10494        ;;
10495esac
10496case "$d_tm_tm_zone" in
10497"$define")      echo "Yes, it does."   ;;
10498*)              echo "No, it doesn't." ;;
10499esac
10500: see if struct tm knows about tm_gmtoff
10501case "$i_systime$i_time" in
10502*$define*)
10503        echo " "
10504        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10505        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10506        eval $hasfield
10507        ;;
10508*)      val="$undef"
10509        set d_tm_tm_gmtoff
10510        eval $setvar
10511        ;;
10512esac
10513case "$d_tm_tm_gmtoff" in
10514"$define")      echo "Yes, it does."   ;;
10515*)              echo "No, it doesn't." ;;
10516esac
10517
10518: see if asctime_r exists
10519set asctime_r d_asctime_r
10520eval $inlibc
10521case "$d_asctime_r" in
10522"$define")
10523	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10524	case "$d_asctime_r_proto:$usethreads" in
10525	":define")	d_asctime_r_proto=define
10526		set d_asctime_r_proto asctime_r $hdrs
10527		eval $hasproto ;;
10528	*)	;;
10529	esac
10530	case "$d_asctime_r_proto" in
10531	define)
10532	case "$asctime_r_proto" in
10533	''|0) try='char* asctime_r(const struct tm*, char*);'
10534	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10535	esac
10536	case "$asctime_r_proto" in
10537	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10538	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10539	esac
10540	case "$asctime_r_proto" in
10541	''|0) try='int asctime_r(const struct tm*, char*);'
10542	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10543	esac
10544	case "$asctime_r_proto" in
10545	''|0) try='int asctime_r(const struct tm*, char*, int);'
10546	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10547	esac
10548	case "$asctime_r_proto" in
10549	''|0)	d_asctime_r=undef
10550 	        asctime_r_proto=0
10551		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10552	* )	case "$asctime_r_proto" in
10553		REENTRANT_PROTO*) ;;
10554		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10555		esac
10556		echo "Prototype: $try" ;;
10557	esac
10558	;;
10559	*)	case "$usethreads" in
10560		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10561		esac
10562		d_asctime_r=undef
10563		asctime_r_proto=0
10564		;;
10565	esac
10566	;;
10567*)	asctime_r_proto=0
10568	;;
10569esac
10570
10571: see if atolf exists
10572set atolf d_atolf
10573eval $inlibc
10574
10575: see if atoll exists
10576set atoll d_atoll
10577eval $inlibc
10578
10579: Look for GCC-style attribute format
10580case "$d_attribute_format" in
10581'')
10582echo " "
10583echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10584$cat >attrib.c <<'EOCP'
10585#include <stdio.h>
10586void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10587EOCP
10588if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10589	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10590		echo "Your C compiler doesn't support __attribute__((format))."
10591		val="$undef"
10592	else
10593		echo "Your C compiler supports __attribute__((format))."
10594		val="$define"
10595	fi
10596else
10597	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10598	val="$undef"
10599fi
10600;;
10601*) val="$d_attribute_format" ;;
10602esac
10603set d_attribute_format
10604eval $setvar
10605$rm -f attrib*
10606
10607: Look for GCC-style attribute format with null format allowed
10608case "$d_printf_format_null" in
10609'') case "$d_attribute_format" in
10610    $define)
10611	echo " "
10612	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10613$cat >attrib.c <<EOCP
10614#include <stdio.h>
10615#$i_stdlib I_STDLIB
10616#ifdef I_STDLIB
10617#include <stdlib.h>
10618#endif
10619int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10620int null_printf (char* pat,...) { return (int)pat; }
10621int main () { exit(null_printf(NULL)); }
10622EOCP
10623	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10624	    : run the executable in case it produces a run-time warning
10625	    if $run ./attrib >>attrib.out 2>&1; then
10626		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10627		    echo "Your C compiler doesn't allow __printf__ format to be null."
10628		    val="$undef"
10629		else
10630		    echo "Your C compiler allows __printf__ format to be null."
10631		    val="$define"
10632		fi
10633	    else
10634	    echo "Your C compiler executable failed with __printf__ format null."
10635	    val="$undef"
10636	fi
10637    else
10638	echo "Your C compiler fails with __printf__ format null."
10639	val="$undef"
10640    fi
10641    ;;
10642    *)  val="$undef" ;;
10643    esac
10644;;
10645*)  val="$d_printf_format_null" ;;
10646esac
10647set d_printf_format_null
10648eval $setvar
10649$rm -f attrib*
10650
10651: Look for GCC-style attribute malloc
10652case "$d_attribute_malloc" in
10653'')
10654echo " "
10655echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10656$cat >attrib.c <<'EOCP'
10657#include <stdio.h>
10658char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10659EOCP
10660if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10661	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10662		echo "Your C compiler doesn't support __attribute__((malloc))."
10663		val="$undef"
10664	else
10665		echo "Your C compiler supports __attribute__((malloc))."
10666		val="$define"
10667	fi
10668else
10669	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10670	val="$undef"
10671fi
10672;;
10673*) val="$d_attribute_malloc" ;;
10674esac
10675set d_attribute_malloc
10676eval $setvar
10677$rm -f attrib*
10678
10679: Look for GCC-style attribute nonnull
10680case "$d_attribute_nonnull" in
10681'')
10682echo " "
10683echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10684$cat >attrib.c <<'EOCP'
10685#include <stdio.h>
10686void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10687EOCP
10688if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10689	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10690		echo "Your C compiler doesn't support __attribute__((nonnull))."
10691		val="$undef"
10692	else
10693		echo "Your C compiler supports __attribute__((nonnull))."
10694		val="$define"
10695	fi
10696else
10697	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10698	val="$undef"
10699fi
10700;;
10701*) val="$d_attribute_nonnull" ;;
10702esac
10703set d_attribute_nonnull
10704eval $setvar
10705$rm -f attrib*
10706
10707: Look for GCC-style attribute noreturn
10708case "$d_attribute_noreturn" in
10709'')
10710echo " "
10711echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10712$cat >attrib.c <<'EOCP'
10713#include <stdio.h>
10714void fall_over_dead( void ) __attribute__((noreturn));
10715EOCP
10716if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10717	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10718		echo "Your C compiler doesn't support __attribute__((noreturn))."
10719		val="$undef"
10720	else
10721		echo "Your C compiler supports __attribute__((noreturn))."
10722		val="$define"
10723	fi
10724else
10725	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10726	val="$undef"
10727fi
10728;;
10729*) val="$d_attribute_noreturn" ;;
10730esac
10731set d_attribute_noreturn
10732eval $setvar
10733$rm -f attrib*
10734
10735: Look for GCC-style attribute pure
10736case "$d_attribute_pure" in
10737'')
10738echo " "
10739echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10740$cat >attrib.c <<'EOCP'
10741#include <stdio.h>
10742int square( int n ) __attribute__((pure));
10743EOCP
10744if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10745	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10746		echo "Your C compiler doesn't support __attribute__((pure))."
10747		val="$undef"
10748	else
10749		echo "Your C compiler supports __attribute__((pure))."
10750		val="$define"
10751	fi
10752else
10753	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10754	val="$undef"
10755fi
10756;;
10757*) val="$d_attribute_pure" ;;
10758esac
10759set d_attribute_pure
10760eval $setvar
10761$rm -f attrib*
10762
10763: Look for GCC-style attribute unused
10764case "$d_attribute_unused" in
10765'')
10766echo " "
10767echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10768$cat >attrib.c <<'EOCP'
10769#include <stdio.h>
10770int do_something( int dummy __attribute__((unused)), int n );
10771EOCP
10772if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10773	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10774		echo "Your C compiler doesn't support __attribute__((unused))."
10775		val="$undef"
10776	else
10777		echo "Your C compiler supports __attribute__((unused))."
10778		val="$define"
10779	fi
10780else
10781	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10782	val="$undef"
10783fi
10784;;
10785*) val="$d_attribute_unused" ;;
10786esac
10787set d_attribute_unused
10788eval $setvar
10789$rm -f attrib*
10790
10791: Look for GCC-style attribute deprecated
10792case "$d_attribute_deprecated" in
10793'')
10794echo " "
10795echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10796$cat >attrib.c <<'EOCP'
10797#include <stdio.h>
10798int I_am_deprecated(void) __attribute__((deprecated));
10799EOCP
10800if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10801	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10802		echo "Your C compiler doesn't support __attribute__((deprecated))."
10803		val="$undef"
10804	else
10805		echo "Your C compiler supports __attribute__((deprecated))."
10806		val="$define"
10807	fi
10808else
10809	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10810	val="$undef"
10811fi
10812;;
10813*) val="$d_attribute_deprecated" ;;
10814esac
10815set d_attribute_deprecated
10816eval $setvar
10817$rm -f attrib*
10818
10819: Look for GCC-style attribute warn_unused_result
10820case "$d_attribute_warn_unused_result" in
10821'')
10822echo " "
10823echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10824$cat >attrib.c <<'EOCP'
10825#include <stdio.h>
10826int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10827EOCP
10828if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10829	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10830		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10831		val="$undef"
10832	else
10833		echo "Your C compiler supports __attribute__((warn_unused_result))."
10834		val="$define"
10835	fi
10836else
10837	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10838	val="$undef"
10839fi
10840;;
10841*) val="$d_attribute_warn_unused_result" ;;
10842esac
10843set d_attribute_warn_unused_result
10844eval $setvar
10845$rm -f attrib*
10846
10847: see if bcmp exists
10848set bcmp d_bcmp
10849eval $inlibc
10850
10851: see if bcopy exists
10852set bcopy d_bcopy
10853eval $inlibc
10854
10855: see if getpgrp exists
10856set getpgrp d_getpgrp
10857eval $inlibc
10858
10859case "$d_getpgrp" in
10860"$define")
10861	echo " "
10862	echo "Checking to see which flavor of getpgrp is in use..."
10863	$cat >try.c <<EOP
10864#$i_unistd I_UNISTD
10865#include <sys/types.h>
10866#ifdef I_UNISTD
10867#  include <unistd.h>
10868#endif
10869#$i_stdlib I_STDLIB
10870#ifdef I_STDLIB
10871#include <stdlib.h>
10872#endif
10873int main()
10874{
10875	if (getuid() == 0) {
10876		printf("(I see you are running Configure as super-user...)\n");
10877		setuid(1);
10878	}
10879#ifdef TRY_BSD_PGRP
10880	if (getpgrp(1) == 0)
10881		exit(0);
10882#else
10883	if (getpgrp() > 0)
10884		exit(0);
10885#endif
10886	exit(1);
10887}
10888EOP
10889	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10890		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10891		val="$define"
10892	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10893		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10894		val="$undef"
10895	else
10896		echo "I can't seem to compile and run the test program."
10897		if ./usg; then
10898			xxx="a USG one, i.e. you use getpgrp()."
10899		else
10900			# SVR4 systems can appear rather BSD-ish.
10901			case "$i_unistd" in
10902			$undef)
10903				xxx="a BSD one, i.e. you use getpgrp(pid)."
10904				val="$define"
10905				;;
10906			$define)
10907				xxx="probably a USG one, i.e. you use getpgrp()."
10908				val="$undef"
10909				;;
10910			esac
10911		fi
10912		echo "Assuming your getpgrp is $xxx" >&4
10913	fi
10914	;;
10915*) val="$undef";;
10916esac
10917set d_bsdgetpgrp
10918eval $setvar
10919$rm_try
10920
10921: see if setpgrp exists
10922set setpgrp d_setpgrp
10923eval $inlibc
10924
10925case "$d_setpgrp" in
10926"$define")
10927	echo " "
10928	echo "Checking to see which flavor of setpgrp is in use..."
10929	$cat >try.c <<EOP
10930#$i_unistd I_UNISTD
10931#include <sys/types.h>
10932#ifdef I_UNISTD
10933#  include <unistd.h>
10934#endif
10935#$i_stdlib I_STDLIB
10936#ifdef I_STDLIB
10937#include <stdlib.h>
10938#endif
10939int main()
10940{
10941	if (getuid() == 0) {
10942		printf("(I see you are running Configure as super-user...)\n");
10943		setuid(1);
10944	}
10945#ifdef TRY_BSD_PGRP
10946	if (-1 == setpgrp(1, 1))
10947		exit(0);
10948#else
10949	if (setpgrp() != -1)
10950		exit(0);
10951#endif
10952	exit(1);
10953}
10954EOP
10955	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10956		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10957		val="$define"
10958	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10959		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10960		val="$undef"
10961	else
10962		echo "(I can't seem to compile and run the test program.)"
10963		if ./usg; then
10964			xxx="a USG one, i.e. you use setpgrp()."
10965		else
10966			# SVR4 systems can appear rather BSD-ish.
10967			case "$i_unistd" in
10968			$undef)
10969				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10970				val="$define"
10971				;;
10972			$define)
10973				xxx="probably a USG one, i.e. you use setpgrp()."
10974				val="$undef"
10975				;;
10976			esac
10977		fi
10978		echo "Assuming your setpgrp is $xxx" >&4
10979	fi
10980	;;
10981*) val="$undef";;
10982esac
10983set d_bsdsetpgrp
10984eval $setvar
10985$rm_try
10986
10987: Look for GCC-style __builtin_choose_expr
10988case "$d_builtin_choose_expr" in
10989'')
10990    echo " "
10991    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10992    $cat >try.c <<'EOCP'
10993#include <assert.h>
10994#include <stdlib.h>
10995#include <stdio.h>
10996
10997#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10998
10999int main(void) {
11000    assert( SYRINX(1) == 2112 );
11001    assert( SYRINX(1) != 5150 );
11002    assert( SYRINX(0) == 5150 );
11003    assert( SYRINX(0) != 2112 );
11004    puts( "All good!" );
11005    exit(0);
11006}
11007
11008EOCP
11009    set try
11010    if eval $compile && $run ./try; then
11011	echo "Your C compiler supports __builtin_choose_expr."
11012	val="$define"
11013    else
11014	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11015	val="$undef"
11016    fi
11017;;
11018*) val="$d_builtin_choose_expr" ;;
11019esac
11020
11021set d_builtin_choose_expr
11022eval $setvar
11023$rm_try
11024
11025: Look for GCC-style __builtin_expect
11026case "$d_builtin_expect" in
11027'')
11028    echo " "
11029    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11030    $cat >try.c <<'EOCP'
11031int main(void) {
11032    int n = 50;
11033    if ( __builtin_expect(n, 0) ) n = 1;
11034    /* Remember shell exit code truth is 0, C truth is non-zero */
11035    return !(n == 1);
11036}
11037EOCP
11038    set try
11039    if eval $compile && $run ./try; then
11040	echo "Your C compiler supports __builtin_expect."
11041	val="$define"
11042    else
11043	echo "Your C compiler doesn't seem to understand __builtin_expect."
11044	val="$undef"
11045    fi
11046    ;;
11047*) val="$d_builtin_expect" ;;
11048esac
11049
11050set d_builtin_expect
11051eval $setvar
11052$rm_try
11053
11054: see if bzero exists
11055set bzero d_bzero
11056eval $inlibc
11057
11058: see if stdarg is available
11059echo " "
11060if $test `./findhdr stdarg.h`; then
11061	echo "<stdarg.h> found." >&4
11062	valstd="$define"
11063else
11064	echo "<stdarg.h> NOT found." >&4
11065	valstd="$undef"
11066fi
11067
11068: see if varargs is available
11069echo " "
11070if $test `./findhdr varargs.h`; then
11071	echo "<varargs.h> found." >&4
11072else
11073	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11074fi
11075
11076: set up the varargs testing programs
11077$cat > varargs.c <<EOP
11078#ifdef I_STDARG
11079#include <stdarg.h>
11080#endif
11081#ifdef I_VARARGS
11082#include <varargs.h>
11083#endif
11084
11085#ifdef I_STDARG
11086int f(char *p, ...)
11087#else
11088int f(va_alist)
11089va_dcl
11090#endif
11091{
11092	va_list ap;
11093#ifndef I_STDARG
11094	char *p;
11095#endif
11096#ifdef I_STDARG
11097	va_start(ap,p);
11098#else
11099	va_start(ap);
11100	p = va_arg(ap, char *);
11101#endif
11102	va_end(ap);
11103	return 0;
11104}
11105EOP
11106$cat > varargs <<EOP
11107$startsh
11108if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11109	echo "true"
11110else
11111	echo "false"
11112fi
11113$rm -f varargs$_o
11114EOP
11115chmod +x varargs
11116
11117: now check which varargs header should be included
11118echo " "
11119i_varhdr=''
11120val=''
11121case "$valstd" in
11122"$define")
11123	if `./varargs I_STDARG`; then
11124		val='stdarg.h'
11125	elif `./varargs I_VARARGS`; then
11126		val='varargs.h'
11127	fi
11128	;;
11129*)
11130	if `./varargs I_VARARGS`; then
11131		val='varargs.h'
11132	fi
11133	;;
11134esac
11135case "$val" in
11136'')
11137	echo " "
11138	echo "*** WHOA THERE!!! ***" >&4
11139	echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11140	case "$knowitall" in
11141	'')
11142	echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11143		exit 1
11144		;;
11145	esac
11146echo "I could not find the definition for va_dcl... You have problems..." >&4
11147	val="$undef"; set i_stdarg; eval $setvar
11148	val="$undef"; set i_varargs; eval $setvar
11149	;;
11150*)
11151	set i_varhdr
11152	eval $setvar
11153	case "$i_varhdr" in
11154	stdarg.h)
11155		val="$define"; set i_stdarg; eval $setvar
11156		val="$undef"; set i_varargs; eval $setvar
11157		;;
11158	varargs.h)
11159		val="$undef"; set i_stdarg; eval $setvar
11160		val="$define"; set i_varargs; eval $setvar
11161		;;
11162	esac
11163	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11164esac
11165$rm -f varargs*
11166
11167: see if the Compiler supports C99 variadic macros
11168case "$i_stdarg$i_stdlib" in
11169    "$define$define")
11170    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11171    $cat >try.c <<EOCP
11172#include <stdio.h>
11173#include <stdarg.h>
11174
11175#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11176
11177int main() {
11178  char buf[20];
11179  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11180  puts(buf);
11181  return 0;
11182}
11183EOCP
11184    set try
11185    if eval $compile && $run ./try 2>&1 >/dev/null; then
11186	case "`$run ./try`" in
11187	    "123 456 789")
11188	    echo "You have C99 variadic macros." >&4
11189	    d_c99_variadic_macros="$define"
11190	    ;;
11191	    *)
11192	    echo "You don't have functional C99 variadic macros." >&4
11193	    d_c99_variadic_macros="$undef"
11194	    ;;
11195	esac
11196    else
11197	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11198	d_c99_variadic_macros="$undef"
11199    fi
11200    $rm_try
11201    ;;
11202    *)
11203    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11204    d_c99_variadic_macros="$undef"
11205    ;;
11206esac
11207
11208: see if signal is declared as pointer to function returning int or void
11209echo " "
11210xxx=`./findhdr signal.h`
11211$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11212if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11213	echo "You have int (*signal())() instead of void." >&4
11214	val="$undef"
11215elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11216	echo "You have void (*signal())()." >&4
11217	val="$define"
11218elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11219	echo "You have int (*signal())() instead of void." >&4
11220	val="$undef"
11221elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11222	echo "You have void (*signal())()." >&4
11223	val="$define"
11224else
11225	case "$d_voidsig" in
11226	'')
11227	echo "I can't determine whether signal handler returns void or int..." >&4
11228		dflt=void
11229		rp="What type does your signal handler return?"
11230		. ./myread
11231		case "$ans" in
11232		v*) val="$define";;
11233		*) val="$undef";;
11234		esac;;
11235	"$define")
11236		echo "As you already told me, signal handler returns void." >&4
11237		val="$define"
11238		;;
11239	*)	echo "As you already told me, signal handler returns int." >&4
11240		val="$undef"
11241		;;
11242	esac
11243fi
11244set d_voidsig
11245eval $setvar
11246case "$d_voidsig" in
11247"$define") signal_t="void";;
11248*) signal_t="int";;
11249esac
11250$rm -f $$.tmp
11251
11252: check for ability to cast large floats to 32-bit ints.
11253echo " "
11254echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11255if $test "$intsize" -ge 4; then
11256	xxx=int
11257else
11258	xxx=long
11259fi
11260$cat >try.c <<EOCP
11261#include <stdio.h>
11262#$i_stdlib I_STDLIB
11263#ifdef I_STDLIB
11264#include <stdlib.h>
11265#endif
11266#include <sys/types.h>
11267#include <signal.h>
11268$signal_t blech(int s) { exit(3); }
11269int main()
11270{
11271	$xxx i32;
11272	double f, g;
11273	int result = 0;
11274	char str[16];
11275	signal(SIGFPE, blech);
11276
11277	/* Don't let compiler optimize the test away.  Store the number
11278	   in a writable string for gcc to pass to sscanf under HP-UX.
11279	*/
11280	sprintf(str, "2147483647");
11281	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11282	g = 10 * f;
11283	i32  = ($xxx) g;
11284
11285	/* x86 processors will probably give 0x8000 0000, which is a
11286	   sign change.  We don't want that.  We want to mimic SPARC
11287	   behavior here, which is to preserve the sign and give
11288	   back 0x7fff ffff.
11289	*/
11290	if (i32 != ($xxx) f)
11291		result |= 1;
11292	exit(result);
11293}
11294EOCP
11295set try
11296if eval $compile_ok; then
11297	$run ./try
11298	yyy=$?
11299else
11300	echo "(I can't seem to compile the test program--assuming it can't)"
11301	yyy=1
11302fi
11303case "$yyy" in
113040)	val="$define"
11305	echo "Yup, it can."
11306	;;
11307*)	val="$undef"
11308	echo "Nope, it can't."
11309	;;
11310esac
11311set d_casti32
11312eval $setvar
11313$rm_try
11314
11315: check for ability to cast negative floats to unsigned
11316echo " "
11317echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11318$cat >try.c <<EOCP
11319#include <stdio.h>
11320#$i_stdlib I_STDLIB
11321#ifdef I_STDLIB
11322#include <stdlib.h>
11323#endif
11324#include <sys/types.h>
11325#include <signal.h>
11326$signal_t blech(int s) { exit(7); }
11327$signal_t blech_in_list(int s) { exit(4); }
11328unsigned long dummy_long(unsigned long p) { return p; }
11329unsigned int dummy_int(unsigned int p) { return p; }
11330unsigned short dummy_short(unsigned short p) { return p; }
11331int main()
11332{
11333	double f;
11334	unsigned long along;
11335	unsigned int aint;
11336	unsigned short ashort;
11337	int result = 0;
11338	char str[16];
11339
11340	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11341	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11342	   optimized the whole file away
11343	*/
11344	/* Store the number in a writable string for gcc to pass to
11345	   sscanf under HP-UX.
11346	*/
11347	sprintf(str, "-123");
11348	sscanf(str, "%lf", &f);  /* f = -123.; */
11349
11350	signal(SIGFPE, blech);
11351	along = (unsigned long)f;
11352	aint = (unsigned int)f;
11353	ashort = (unsigned short)f;
11354	if (along != (unsigned long)-123)
11355		result |= 1;
11356	if (aint != (unsigned int)-123)
11357		result |= 1;
11358	if (ashort != (unsigned short)-123)
11359		result |= 1;
11360	sprintf(str, "1073741824.");
11361	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11362	f = f + f;
11363	along = 0;
11364	along = (unsigned long)f;
11365	if (along != 0x80000000)
11366		result |= 2;
11367	f -= 1.;
11368	along = 0;
11369	along = (unsigned long)f;
11370	if (along != 0x7fffffff)
11371		result |= 1;
11372	f += 2.;
11373	along = 0;
11374	along = (unsigned long)f;
11375	if (along != 0x80000001)
11376		result |= 2;
11377	if (result)
11378		exit(result);
11379	signal(SIGFPE, blech_in_list);
11380	sprintf(str, "123.");
11381	sscanf(str, "%lf", &f);  /* f = 123.; */
11382	along = dummy_long((unsigned long)f);
11383	aint = dummy_int((unsigned int)f);
11384	ashort = dummy_short((unsigned short)f);
11385	if (along != (unsigned long)123)
11386		result |= 4;
11387	if (aint != (unsigned int)123)
11388		result |= 4;
11389	if (ashort != (unsigned short)123)
11390		result |= 4;
11391	exit(result);
11392
11393}
11394EOCP
11395set try
11396if eval $compile_ok; then
11397	$run ./try
11398	castflags=$?
11399else
11400	echo "(I can't seem to compile the test program--assuming it can't)"
11401	castflags=7
11402fi
11403case "$castflags" in
114040)	val="$define"
11405	echo "Yup, it can."
11406	;;
11407*)	val="$undef"
11408	echo "Nope, it can't."
11409	;;
11410esac
11411set d_castneg
11412eval $setvar
11413$rm_try
11414
11415: see if vprintf exists
11416echo " "
11417if set vprintf val -f d_vprintf; eval $csym; $val; then
11418	echo 'vprintf() found.' >&4
11419	val="$define"
11420	$cat >try.c <<EOF
11421#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11422#$i_varargs I_VARARGS
11423
11424#$i_stdlib I_STDLIB
11425#$i_unistd I_UNISTD
11426
11427#ifdef I_STDARG
11428#  include <stdarg.h>
11429#else /* I_VARARGS */
11430#  include <varargs.h>
11431#endif
11432
11433#ifdef I_UNISTD
11434#  include <unistd.h>
11435#endif
11436
11437#ifdef I_STDLIB
11438#  include <stdlib.h>
11439#endif
11440
11441#include <stdio.h> /* vsprintf prototype */
11442
11443#ifdef I_STDARG
11444void xxx(int n, ...)
11445{
11446    va_list args;
11447    char buf[10];
11448    va_start(args, n);
11449    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11450}
11451int main() { xxx(1, "foo"); }
11452
11453#else /* I_VARARGS */
11454
11455xxx(va_alist)
11456va_dcl
11457{
11458    va_list args;
11459    char buf[10];
11460    va_start(args);
11461    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11462}
11463int main() { xxx("foo"); }
11464
11465#endif
11466
11467EOF
11468	set try
11469	if eval $compile_ok; then
11470		if $run ./try; then
11471			echo "Your vsprintf() returns (int)." >&4
11472			val2="$undef"
11473		else
11474			echo "Your vsprintf() returns (char*)." >&4
11475			val2="$define"
11476		fi
11477	else
11478		echo 'I am unable to compile the vsprintf() test program.' >&4
11479		# We shouldn't get here.  If we do, assume the standard signature,
11480		# not the old BSD one.
11481		echo 'Guessing that vsprintf() returns (int).' >&4
11482		val2="$undef"
11483	fi
11484else
11485	echo 'vprintf() NOT found.' >&4
11486	val="$undef"
11487	val2="$undef"
11488fi
11489$rm_try
11490set d_vprintf
11491eval $setvar
11492val=$val2
11493set d_charvspr
11494eval $setvar
11495
11496: see if chown exists
11497set chown d_chown
11498eval $inlibc
11499
11500: see if chroot exists
11501set chroot d_chroot
11502eval $inlibc
11503
11504: see if chsize exists
11505set chsize d_chsize
11506eval $inlibc
11507
11508: see if class exists
11509set class d_class
11510eval $inlibc
11511
11512: see if clearenv exists
11513set clearenv d_clearenv
11514eval $inlibc
11515
11516: Define hasstruct macro for Configure internal use
11517hasstruct='varname=$1; struct=$2; shift; shift;
11518while $test $# -ge 2; do
11519	case "$1" in
11520	$define) echo "#include <$2>";;
11521	esac ;
11522    shift 2;
11523done > try.c;
11524echo "int main () { struct $struct foo; }" >> try.c;
11525set try;
11526if eval $compile; then
11527	val="$define";
11528else
11529	val="$undef";
11530fi;
11531set $varname;
11532eval $setvar;
11533$rm_try'
11534
11535: see whether socket exists
11536socketlib=''
11537sockethdr=''
11538echo " "
11539$echo $n "Hmm... $c" >&4
11540if set socket val -f d_socket; eval $csym; $val; then
11541    echo "Looks like you have Berkeley networking support." >&4
11542    d_socket="$define"
11543    if set setsockopt val -f; eval $csym; $val; then
11544	d_oldsock="$undef"
11545    else
11546	echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11547	d_oldsock="$define"
11548    fi
11549else
11550    if $contains socklib libc.list >/dev/null 2>&1; then
11551	echo "Looks like you have Berkeley networking support." >&4
11552	d_socket="$define"
11553	: we will have to assume that it supports the 4.2 BSD interface
11554	d_oldsock="$undef"
11555    else
11556	echo "You don't have Berkeley networking in libc$_a..." >&4
11557	if test "X$d_socket" = "X$define"; then
11558	    echo "...but you seem to believe that you have sockets." >&4
11559	else
11560	    for net in net socket
11561	    do
11562		if test -f $sysroot/usr/lib/lib$net$_a; then
11563		    ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11564		    $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11565		    if $contains socket libc.list >/dev/null 2>&1; then
11566			d_socket="$define"
11567			socketlib="-l$net"
11568			case "$net" in
11569			net)
11570			    echo "...but the Wollongong group seems to have hacked it in." >&4
11571			    sockethdr="-I$sysroot/usr/netinclude"
11572			    ;;
11573			esac
11574			echo "Found Berkeley sockets interface in lib$net." >&4
11575			if $contains setsockopt libc.list >/dev/null 2>&1; then
11576			    d_oldsock="$undef"
11577			else
11578			    echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11579			    d_oldsock="$define"
11580			fi
11581			break
11582		    fi
11583		fi
11584	    done
11585	    if test "X$d_socket" != "X$define"; then
11586	       echo "or anywhere else I see." >&4
11587	       d_socket="$undef"
11588	       d_oldsock="$undef"
11589	    fi
11590	fi
11591    fi
11592fi
11593
11594: see if socketpair exists
11595set socketpair d_sockpair
11596eval $inlibc
11597
11598
11599echo " "
11600echo "Checking the availability sa_len in the sock struct ..." >&4
11601$cat >try.c <<EOF
11602#include <sys/types.h>
11603#include <sys/socket.h>
11604int main() {
11605struct sockaddr sa;
11606return (sa.sa_len);
11607}
11608EOF
11609val="$undef"
11610set try; if eval $compile; then
11611    val="$define"
11612fi
11613set d_sockaddr_sa_len; eval $setvar
11614$rm_try
11615
11616echo " "
11617echo "Checking the availability struct sockaddr_in6 ..." >&4
11618$cat >try.c <<EOF
11619#include <sys/types.h>
11620#include <sys/socket.h>
11621#include <netinet/in.h>
11622int main() {
11623struct sockaddr_in6 sin6;
11624return (sin6.sin6_family);
11625}
11626EOF
11627val="$undef"
11628set try; if eval $compile; then
11629    val="$define"
11630fi
11631set d_sockaddr_in6; eval $setvar
11632$rm_try
11633
11634echo " "
11635echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11636$cat >try.c <<EOF
11637#include <sys/types.h>
11638#include <sys/socket.h>
11639#include <netinet/in.h>
11640int main() {
11641struct sockaddr_in6 sin6;
11642return (sin6.sin6_scope_id);
11643}
11644EOF
11645val="$undef"
11646set try; if eval $compile; then
11647    val="$define"
11648fi
11649set d_sin6_scope_id; eval $setvar
11650$rm_try
11651
11652echo " "
11653echo "Checking the availability struct ip_mreq ..." >&4
11654$cat >try.c <<EOF
11655#include <sys/types.h>
11656#include <sys/socket.h>
11657#include <netinet/in.h>
11658int main() {
11659struct ip_mreq mreq;
11660return (mreq.imr_multiaddr.s_addr);
11661}
11662EOF
11663val="$undef"
11664set try; if eval $compile; then
11665       val="$define"
11666fi
11667set d_ip_mreq; eval $setvar
11668$rm_try
11669
11670echo " "
11671echo "Checking the availability struct ip_mreq_source ..." >&4
11672$cat >try.c <<EOF
11673#include <sys/types.h>
11674#include <sys/socket.h>
11675#include <netinet/in.h>
11676int main() {
11677struct ip_mreq_source mreq;
11678return (mreq.imr_multiaddr.s_addr);
11679}
11680EOF
11681val="$undef"
11682set try; if eval $compile; then
11683       val="$define"
11684fi
11685set d_ip_mreq_source; eval $setvar
11686$rm_try
11687
11688echo " "
11689echo "Checking the availability struct ipv6_mreq ..." >&4
11690$cat >try.c <<EOF
11691#include <sys/types.h>
11692#include <sys/socket.h>
11693#include <netinet/in.h>
11694int main() {
11695struct ipv6_mreq mreq;
11696return (mreq.ipv6mr_interface);
11697}
11698EOF
11699val="$undef"
11700set try; if eval $compile; then
11701    val="$define"
11702fi
11703set d_ipv6_mreq; eval $setvar
11704$rm_try
11705
11706echo " "
11707echo "Checking the availability struct ipv6_mreq_source ..." >&4
11708$cat >try.c <<EOF
11709#include <sys/types.h>
11710#include <sys/socket.h>
11711#include <netinet/in.h>
11712int main() {
11713struct ipv6_mreq_source mreq;
11714return (mreq.imr_multiaddr.s_addr);
11715}
11716EOF
11717val="$undef"
11718set try; if eval $compile; then
11719       val="$define"
11720fi
11721set d_ipv6_mreq_source; eval $setvar
11722$rm_try
11723
11724echo " "
11725echo "Checking the availability of certain socket constants..." >&4
11726for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11727    enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11728    $cat >try.c <<EOF
11729#include <sys/types.h>
11730#include <sys/socket.h>
11731int main() {
11732    int i = $ENUM;
11733}
11734EOF
11735    val="$undef"
11736    set try; if eval $compile; then
11737	val="$define"
11738    fi
11739    set d_${enum}; eval $setvar
11740    $rm_try
11741done
11742
11743: see if this is a sys/uio.h system
11744set sys/uio.h i_sysuio
11745eval $inhdr
11746
11747: Check for cmsghdr support
11748echo " "
11749echo "Checking to see if your system supports struct cmsghdr..." >&4
11750set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11751eval $hasstruct
11752case "$d_cmsghdr_s" in
11753"$define")      echo "Yes, it does."   ;;
11754*)              echo "No, it doesn't." ;;
11755esac
11756
11757
11758: check for const keyword
11759echo " "
11760echo 'Checking to see if your C compiler knows about "const"...' >&4
11761$cat >const.c <<'EOCP'
11762typedef struct spug { int drokk; } spug;
11763int main()
11764{
11765	const char *foo;
11766	const spug y = { 0 };
11767}
11768EOCP
11769if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11770	val="$define"
11771	echo "Yup, it does."
11772else
11773	val="$undef"
11774	echo "Nope, it doesn't."
11775fi
11776set d_const
11777eval $setvar
11778
11779: see if copysignl exists
11780set copysignl d_copysignl
11781eval $inlibc
11782
11783: see if crypt exists
11784echo " "
11785set crypt d_crypt
11786eval $inlibc
11787case "$d_crypt" in
11788$define) cryptlib='' ;;
11789*)	if set crypt val -f d_crypt; eval $csym; $val; then
11790		echo 'crypt() found.' >&4
11791		val="$define"
11792		cryptlib=''
11793	else
11794		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11795		if $test -z "$cryptlib"; then
11796			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11797		else
11798			cryptlib=-lcrypt
11799		fi
11800		if $test -z "$cryptlib"; then
11801			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11802		else
11803			cryptlib=-lcrypt
11804		fi
11805		if $test -z "$cryptlib"; then
11806			cryptlib=`./loc libcrypt$_a "" $libpth`
11807		else
11808			cryptlib=-lcrypt
11809		fi
11810		if $test -z "$cryptlib"; then
11811			echo 'crypt() NOT found.' >&4
11812			val="$undef"
11813		else
11814			val="$define"
11815		fi
11816	fi
11817	set d_crypt
11818	eval $setvar
11819	;;
11820esac
11821
11822: see if this is a crypt.h system
11823set crypt.h i_crypt
11824eval $inhdr
11825
11826: see if crypt_r exists
11827set crypt_r d_crypt_r
11828eval $inlibc
11829case "$d_crypt_r" in
11830"$define")
11831	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11832	case "$d_crypt_r_proto:$usethreads" in
11833	":define")	d_crypt_r_proto=define
11834		set d_crypt_r_proto crypt_r $hdrs
11835		eval $hasproto ;;
11836	*)	;;
11837	esac
11838	case "$d_crypt_r_proto" in
11839	define)
11840	case "$crypt_r_proto" in
11841	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11842	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11843	esac
11844	case "$crypt_r_proto" in
11845	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11846	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11847	esac
11848	case "$crypt_r_proto" in
11849	''|0)	d_crypt_r=undef
11850 	        crypt_r_proto=0
11851		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11852	* )	case "$crypt_r_proto" in
11853		REENTRANT_PROTO*) ;;
11854		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11855		esac
11856		echo "Prototype: $try" ;;
11857	esac
11858	;;
11859	*)	case "$usethreads" in
11860		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11861		esac
11862		d_crypt_r=undef
11863		crypt_r_proto=0
11864		;;
11865	esac
11866	;;
11867*)	crypt_r_proto=0
11868	;;
11869esac
11870
11871: get csh whereabouts
11872case "$csh" in
11873'csh') val="$undef" ;;
11874*) val="$define" ;;
11875esac
11876set d_csh
11877eval $setvar
11878: Respect a hint or command line value for full_csh.
11879case "$full_csh" in
11880'') full_csh=$csh ;;
11881esac
11882
11883: see if ctermid exists
11884set ctermid d_ctermid
11885eval $inlibc
11886
11887: see if ctermid_r exists
11888set ctermid_r d_ctermid_r
11889eval $inlibc
11890case "$d_ctermid_r" in
11891"$define")
11892	hdrs="$i_systypes sys/types.h define stdio.h "
11893	case "$d_ctermid_r_proto:$usethreads" in
11894	":define")	d_ctermid_r_proto=define
11895		set d_ctermid_r_proto ctermid_r $hdrs
11896		eval $hasproto ;;
11897	*)	;;
11898	esac
11899	case "$d_ctermid_r_proto" in
11900	define)
11901	case "$ctermid_r_proto" in
11902	''|0) try='char* ctermid_r(char*);'
11903	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11904	esac
11905	case "$ctermid_r_proto" in
11906	''|0)	d_ctermid_r=undef
11907 	        ctermid_r_proto=0
11908		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11909	* )	case "$ctermid_r_proto" in
11910		REENTRANT_PROTO*) ;;
11911		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11912		esac
11913		echo "Prototype: $try" ;;
11914	esac
11915	;;
11916	*)	case "$usethreads" in
11917		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11918		esac
11919		d_ctermid_r=undef
11920		ctermid_r_proto=0
11921		;;
11922	esac
11923	;;
11924*)	ctermid_r_proto=0
11925	;;
11926esac
11927
11928: see if ctime_r exists
11929set ctime_r d_ctime_r
11930eval $inlibc
11931case "$d_ctime_r" in
11932"$define")
11933	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11934	case "$d_ctime_r_proto:$usethreads" in
11935	":define")	d_ctime_r_proto=define
11936		set d_ctime_r_proto ctime_r $hdrs
11937		eval $hasproto ;;
11938	*)	;;
11939	esac
11940	case "$d_ctime_r_proto" in
11941	define)
11942	case "$ctime_r_proto" in
11943	''|0) try='char* ctime_r(const time_t*, char*);'
11944	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11945	esac
11946	case "$ctime_r_proto" in
11947	''|0) try='char* ctime_r(const time_t*, char*, int);'
11948	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11949	esac
11950	case "$ctime_r_proto" in
11951	''|0) try='int ctime_r(const time_t*, char*);'
11952	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11953	esac
11954	case "$ctime_r_proto" in
11955	''|0) try='int ctime_r(const time_t*, char*, int);'
11956	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11957	esac
11958	case "$ctime_r_proto" in
11959	''|0)	d_ctime_r=undef
11960 	        ctime_r_proto=0
11961		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11962	* )	case "$ctime_r_proto" in
11963		REENTRANT_PROTO*) ;;
11964		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11965		esac
11966		echo "Prototype: $try" ;;
11967	esac
11968	;;
11969	*)	case "$usethreads" in
11970		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11971		esac
11972		d_ctime_r=undef
11973		ctime_r_proto=0
11974		;;
11975	esac
11976	;;
11977*)	ctime_r_proto=0
11978	;;
11979esac
11980
11981: see if cuserid exists
11982set cuserid d_cuserid
11983eval $inlibc
11984
11985: see if this is a limits.h system
11986set limits.h i_limits
11987eval $inhdr
11988
11989: see if this is a float.h system
11990set float.h i_float
11991eval $inhdr
11992
11993: See if number of significant digits in a double precision number is known
11994echo " "
11995$cat >dbl_dig.c <<EOM
11996#$i_limits I_LIMITS
11997#$i_float I_FLOAT
11998#ifdef I_LIMITS
11999#include <limits.h>
12000#endif
12001#ifdef I_FLOAT
12002#include <float.h>
12003#endif
12004#ifdef DBL_DIG
12005printf("Contains DBL_DIG");
12006#endif
12007EOM
12008$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12009if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12010	echo "DBL_DIG found." >&4
12011	val="$define"
12012else
12013	echo "DBL_DIG NOT found." >&4
12014	val="$undef"
12015fi
12016$rm -f dbl_dig.?
12017set d_dbl_dig
12018eval $setvar
12019
12020: see if dbm.h is available
12021: see if dbmclose exists
12022set dbmclose d_dbmclose
12023eval $inlibc
12024
12025case "$d_dbmclose" in
12026$define)
12027	set dbm.h i_dbm
12028	eval $inhdr
12029	case "$i_dbm" in
12030	$define)
12031		val="$undef"
12032		set i_rpcsvcdbm
12033		eval $setvar
12034		;;
12035	*)	set rpcsvc/dbm.h i_rpcsvcdbm
12036		eval $inhdr
12037		;;
12038	esac
12039	;;
12040*)	echo "We won't be including <dbm.h>"
12041	val="$undef"
12042	set i_dbm
12043	eval $setvar
12044	val="$undef"
12045	set i_rpcsvcdbm
12046	eval $setvar
12047	;;
12048esac
12049
12050: see if prototype for dbminit is available
12051echo " "
12052set d_dbminitproto dbminit $i_dbm dbm.h
12053eval $hasproto
12054
12055: see if difftime exists
12056set difftime d_difftime
12057eval $inlibc
12058
12059: see if this is a dirent system
12060echo " "
12061if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12062	val="$define"
12063	echo "<dirent.h> found." >&4
12064else
12065	val="$undef"
12066	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12067		echo "<sys/dir.h> found." >&4
12068		echo " "
12069	else
12070		xinc=`./findhdr sys/ndir.h`
12071	fi
12072	echo "<dirent.h> NOT found." >&4
12073fi
12074set i_dirent
12075eval $setvar
12076
12077: Look for type of directory structure.
12078echo " "
12079$cppstdin $cppflags $cppminus < "$xinc" > try.c
12080
12081case "$direntrytype" in
12082''|' ')
12083	case "$i_dirent" in
12084	$define) guess1='struct dirent' ;;
12085	*) guess1='struct direct'  ;;
12086	esac
12087	;;
12088*)	guess1="$direntrytype"
12089	;;
12090esac
12091
12092case "$guess1" in
12093'struct dirent') guess2='struct direct' ;;
12094*) guess2='struct dirent' ;;
12095esac
12096
12097if $contains "$guess1" try.c >/dev/null 2>&1; then
12098	direntrytype="$guess1"
12099	echo "Your directory entries are $direntrytype." >&4
12100elif $contains "$guess2" try.c >/dev/null 2>&1; then
12101	direntrytype="$guess2"
12102	echo "Your directory entries seem to be $direntrytype." >&4
12103else
12104	echo "I don't recognize your system's directory entries." >&4
12105	rp="What type is used for directory entries on this system?"
12106	dflt="$guess1"
12107	. ./myread
12108	direntrytype="$ans"
12109fi
12110$rm_try
12111
12112: see if the directory entry stores field length
12113echo " "
12114$cppstdin $cppflags $cppminus < "$xinc" > try.c
12115if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12116	echo "Good, your directory entry keeps length information in d_namlen." >&4
12117	val="$define"
12118else
12119	echo "Your directory entry does not know about the d_namlen field." >&4
12120	val="$undef"
12121fi
12122set d_dirnamlen
12123eval $setvar
12124$rm_try
12125
12126: Look for DIR.dd_fd
12127case "$i_dirent" in
12128"$define")
12129    echo "Checking to see if DIR has a dd_fd member variable" >&4
12130    $cat >try.c <<EOCP
12131#$i_stdlib I_STDLIB
12132#ifdef I_STDLIB
12133#include <stdlib.h>
12134#endif
12135#include <dirent.h>
12136
12137int main() {
12138    DIR dir;
12139    dir.dd_fd = 1;
12140    return 0;
12141}
12142EOCP
12143    val=$undef
12144    set try
12145    if eval $compile; then
12146        echo "Yes, it does."
12147        val="$define"
12148    else
12149        echo "No, it does not."
12150        val="$undef"
12151    fi
12152    ;;
12153*)
12154    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12155    val="$undef"
12156    ;;
12157esac
12158set d_dir_dd_fd
12159eval $setvar
12160$rm_try
12161
12162: see if this is an sysdir system
12163set sys/dir.h i_sysdir
12164eval $inhdr
12165
12166: see if this is an sysndir system
12167set sys/ndir.h i_sysndir
12168eval $inhdr
12169
12170: Look for dirfd
12171echo " "
12172$cat >dirfd.c <<EOM
12173#include <stdio.h>
12174#$i_stdlib I_STDLIB
12175#ifdef I_STDLIB
12176#include <stdlib.h>
12177#endif
12178#$i_dirent I_DIRENT		/**/
12179#$i_sysdir I_SYS_DIR		/**/
12180#$i_sysndir I_SYS_NDIR		/**/
12181#$i_systypes I_SYS_TYPES	/**/
12182#if defined(I_SYS_TYPES)
12183#include <sys/types.h>
12184#endif
12185#if defined(I_DIRENT)
12186#include <dirent.h>
12187#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12188#include <sys/dir.h>
12189#endif
12190#else
12191#ifdef I_SYS_NDIR
12192#include <sys/ndir.h>
12193#else
12194#ifdef I_SYS_DIR
12195#ifdef hp9000s500
12196#include <ndir.h>	/* may be wrong in the future */
12197#else
12198#include <sys/dir.h>
12199#endif
12200#endif
12201#endif
12202#endif
12203int main() {
12204	DIR *dirp = opendir(".");
12205	if (dirfd(dirp) >= 0)
12206		exit(0);
12207	else
12208		exit(1);
12209}
12210EOM
12211val=$undef
12212set dirfd
12213if eval $compile; then
12214	val="$define"
12215fi
12216case "$val" in
12217$define)	echo "dirfd() found." >&4	;;
12218*)		echo "dirfd() NOT found." >&4	;;
12219esac
12220set d_dirfd
12221eval $setvar
12222$rm -f dirfd*
12223
12224: see if dlerror exists
12225xxx_runnm="$runnm"
12226runnm=false
12227set dlerror d_dlerror
12228eval $inlibc
12229runnm="$xxx_runnm"
12230
12231: see if dlfcn is available
12232set dlfcn.h i_dlfcn
12233eval $inhdr
12234
12235: Check what extension to use for shared libs
12236case "$usedl" in
12237$define|y|true)
12238	$cat << EOM
12239
12240On a few systems, the dynamically loaded modules that perl generates and uses
12241will need a different extension than shared libs. The default will probably
12242be appropriate.
12243
12244EOM
12245	case "$dlext" in
12246	'')	dflt="$so" ;;
12247	*)	dflt="$dlext" ;;
12248	esac
12249	rp='What is the extension of dynamically loaded modules'
12250	. ./myread
12251	dlext="$ans"
12252	;;
12253*)
12254	dlext="none"
12255	;;
12256esac
12257
12258: Check if dlsym need a leading underscore
12259echo " "
12260val="$undef"
12261
12262case "$dlsrc" in
12263dl_dlopen.xs)
12264	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12265	$cat >dyna.c <<'EOM'
12266fred () { }
12267EOM
12268
12269$cat >fred.c<<EOM
12270
12271#include <stdio.h>
12272#$i_stdlib I_STDLIB
12273#ifdef I_STDLIB
12274#include <stdlib.h>
12275#endif
12276#$i_dlfcn I_DLFCN
12277#ifdef I_DLFCN
12278#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12279#else
12280#include <sys/types.h>
12281#include <nlist.h>
12282#include <link.h>
12283#endif
12284
12285extern int fred() ;
12286
12287int main()
12288{
12289    void * handle ;
12290    void * symbol ;
12291#ifndef RTLD_LAZY
12292    int mode = 1 ;
12293#else
12294    int mode = RTLD_LAZY ;
12295#endif
12296    handle = dlopen("./dyna.$dlext", mode) ;
12297    if (handle == NULL) {
12298	printf ("1\n") ;
12299	fflush (stdout) ;
12300	exit(0);
12301    }
12302    symbol = dlsym(handle, "fred") ;
12303    if (symbol == NULL) {
12304	/* try putting a leading underscore */
12305	symbol = dlsym(handle, "_fred") ;
12306	if (symbol == NULL) {
12307	    printf ("2\n") ;
12308	    fflush (stdout) ;
12309	    exit(0);
12310	}
12311	printf ("3\n") ;
12312    }
12313    else
12314	printf ("4\n") ;
12315    fflush (stdout) ;
12316    exit(0);
12317}
12318EOM
12319	: Call the object file tmp-dyna.o in case dlext=o.
12320	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12321		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12322		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12323		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12324		xxx=`$run ./fred`
12325		case $xxx in
12326		1)	echo "Test program failed using dlopen." >&4
12327			echo "Perhaps you should not use dynamic loading." >&4;;
12328		2)	echo "Test program failed using dlsym." >&4
12329			echo "Perhaps you should not use dynamic loading." >&4;;
12330		3)	echo "dlsym needs a leading underscore" >&4
12331			val="$define" ;;
12332		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12333		esac
12334	else
12335		echo "I can't compile and run the test program." >&4
12336                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12337	fi
12338	;;
12339esac
12340
12341$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12342
12343set d_dlsymun
12344eval $setvar
12345
12346: see if drand48_r exists
12347set drand48_r d_drand48_r
12348eval $inlibc
12349case "$d_drand48_r" in
12350"$define")
12351	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12352	case "$d_drand48_r_proto:$usethreads" in
12353	":define")	d_drand48_r_proto=define
12354		set d_drand48_r_proto drand48_r $hdrs
12355		eval $hasproto ;;
12356	*)	;;
12357	esac
12358	case "$d_drand48_r_proto" in
12359	define)
12360	case "$drand48_r_proto" in
12361	''|0) try='int drand48_r(struct drand48_data*, double*);'
12362	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12363	esac
12364	case "$drand48_r_proto" in
12365	''|0)	d_drand48_r=undef
12366 	        drand48_r_proto=0
12367		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12368	* )	case "$drand48_r_proto" in
12369		REENTRANT_PROTO*) ;;
12370		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12371		esac
12372		echo "Prototype: $try" ;;
12373	esac
12374	;;
12375	*)	case "$usethreads" in
12376		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12377		esac
12378		d_drand48_r=undef
12379		drand48_r_proto=0
12380		;;
12381	esac
12382	;;
12383*)	drand48_r_proto=0
12384	;;
12385esac
12386
12387: see if prototype for drand48 is available
12388echo " "
12389set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12390eval $hasproto
12391
12392: see if dup2 exists
12393set dup2 d_dup2
12394eval $inlibc
12395
12396: see if eaccess exists
12397set eaccess d_eaccess
12398eval $inlibc
12399
12400: see if endgrent exists
12401set endgrent d_endgrent
12402eval $inlibc
12403
12404: see if this is an grp system
12405set grp.h i_grp
12406eval $inhdr
12407
12408case "$i_grp" in
12409$define)
12410	xxx=`./findhdr grp.h`
12411	$cppstdin $cppflags $cppminus < $xxx >$$.h
12412
12413	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12414		val="$define"
12415	else
12416		val="$undef"
12417	fi
12418	set d_grpasswd
12419	eval $setvar
12420
12421	$rm -f $$.h
12422	;;
12423*)
12424	val="$undef";
12425	set d_grpasswd; eval $setvar
12426	;;
12427esac
12428
12429: see if endgrent_r exists
12430set endgrent_r d_endgrent_r
12431eval $inlibc
12432case "$d_endgrent_r" in
12433"$define")
12434	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12435	case "$d_endgrent_r_proto:$usethreads" in
12436	":define")	d_endgrent_r_proto=define
12437		set d_endgrent_r_proto endgrent_r $hdrs
12438		eval $hasproto ;;
12439	*)	;;
12440	esac
12441	case "$d_endgrent_r_proto" in
12442	define)
12443	case "$endgrent_r_proto" in
12444	''|0) try='int endgrent_r(FILE**);'
12445	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12446	esac
12447	case "$endgrent_r_proto" in
12448	''|0) try='void endgrent_r(FILE**);'
12449	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12450	esac
12451	case "$endgrent_r_proto" in
12452	''|0)	d_endgrent_r=undef
12453 	        endgrent_r_proto=0
12454		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12455	* )	case "$endgrent_r_proto" in
12456		REENTRANT_PROTO*) ;;
12457		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12458		esac
12459		echo "Prototype: $try" ;;
12460	esac
12461	;;
12462	*)	case "$usethreads" in
12463		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12464		esac
12465		d_endgrent_r=undef
12466		endgrent_r_proto=0
12467		;;
12468	esac
12469	;;
12470*)	endgrent_r_proto=0
12471	;;
12472esac
12473
12474: see if endhostent exists
12475set endhostent d_endhent
12476eval $inlibc
12477
12478: see if this is a netdb.h system
12479set netdb.h i_netdb
12480eval $inhdr
12481
12482: see if endhostent_r exists
12483set endhostent_r d_endhostent_r
12484eval $inlibc
12485case "$d_endhostent_r" in
12486"$define")
12487	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12488	case "$d_endhostent_r_proto:$usethreads" in
12489	":define")	d_endhostent_r_proto=define
12490		set d_endhostent_r_proto endhostent_r $hdrs
12491		eval $hasproto ;;
12492	*)	;;
12493	esac
12494	case "$d_endhostent_r_proto" in
12495	define)
12496	case "$endhostent_r_proto" in
12497	''|0) try='int endhostent_r(struct hostent_data*);'
12498	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12499	esac
12500	case "$endhostent_r_proto" in
12501	''|0) try='void endhostent_r(struct hostent_data*);'
12502	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12503	esac
12504	case "$endhostent_r_proto" in
12505	''|0)	d_endhostent_r=undef
12506 	        endhostent_r_proto=0
12507		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12508	* )	case "$endhostent_r_proto" in
12509		REENTRANT_PROTO*) ;;
12510		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12511		esac
12512		echo "Prototype: $try" ;;
12513	esac
12514	;;
12515	*)	case "$usethreads" in
12516		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12517		esac
12518		d_endhostent_r=undef
12519		endhostent_r_proto=0
12520		;;
12521	esac
12522	;;
12523*)	endhostent_r_proto=0
12524	;;
12525esac
12526
12527: see if endnetent exists
12528set endnetent d_endnent
12529eval $inlibc
12530
12531: see if endnetent_r exists
12532set endnetent_r d_endnetent_r
12533eval $inlibc
12534case "$d_endnetent_r" in
12535"$define")
12536	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12537	case "$d_endnetent_r_proto:$usethreads" in
12538	":define")	d_endnetent_r_proto=define
12539		set d_endnetent_r_proto endnetent_r $hdrs
12540		eval $hasproto ;;
12541	*)	;;
12542	esac
12543	case "$d_endnetent_r_proto" in
12544	define)
12545	case "$endnetent_r_proto" in
12546	''|0) try='int endnetent_r(struct netent_data*);'
12547	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12548	esac
12549	case "$endnetent_r_proto" in
12550	''|0) try='void endnetent_r(struct netent_data*);'
12551	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12552	esac
12553	case "$endnetent_r_proto" in
12554	''|0)	d_endnetent_r=undef
12555 	        endnetent_r_proto=0
12556		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12557	* )	case "$endnetent_r_proto" in
12558		REENTRANT_PROTO*) ;;
12559		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12560		esac
12561		echo "Prototype: $try" ;;
12562	esac
12563	;;
12564	*)	case "$usethreads" in
12565		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12566		esac
12567		d_endnetent_r=undef
12568		endnetent_r_proto=0
12569		;;
12570	esac
12571	;;
12572*)	endnetent_r_proto=0
12573	;;
12574esac
12575
12576: see if endprotoent exists
12577set endprotoent d_endpent
12578eval $inlibc
12579
12580: see if endprotoent_r exists
12581set endprotoent_r d_endprotoent_r
12582eval $inlibc
12583case "$d_endprotoent_r" in
12584"$define")
12585	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12586	case "$d_endprotoent_r_proto:$usethreads" in
12587	":define")	d_endprotoent_r_proto=define
12588		set d_endprotoent_r_proto endprotoent_r $hdrs
12589		eval $hasproto ;;
12590	*)	;;
12591	esac
12592	case "$d_endprotoent_r_proto" in
12593	define)
12594	case "$endprotoent_r_proto" in
12595	''|0) try='int endprotoent_r(struct protoent_data*);'
12596	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12597	esac
12598	case "$endprotoent_r_proto" in
12599	''|0) try='void endprotoent_r(struct protoent_data*);'
12600	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12601	esac
12602	case "$endprotoent_r_proto" in
12603	''|0)	d_endprotoent_r=undef
12604 	        endprotoent_r_proto=0
12605		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12606	* )	case "$endprotoent_r_proto" in
12607		REENTRANT_PROTO*) ;;
12608		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12609		esac
12610		echo "Prototype: $try" ;;
12611	esac
12612	;;
12613	*)	case "$usethreads" in
12614		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12615		esac
12616		d_endprotoent_r=undef
12617		endprotoent_r_proto=0
12618		;;
12619	esac
12620	;;
12621*)	endprotoent_r_proto=0
12622	;;
12623esac
12624
12625: see if endpwent exists
12626set endpwent d_endpwent
12627eval $inlibc
12628
12629: see if this is a pwd.h system
12630set pwd.h i_pwd
12631eval $inhdr
12632
12633case "$i_pwd" in
12634$define)
12635	xxx=`./findhdr pwd.h`
12636	$cppstdin $cppflags $cppminus < $xxx >$$.h
12637
12638	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12639		val="$define"
12640	else
12641		val="$undef"
12642	fi
12643	set d_pwquota
12644	eval $setvar
12645
12646	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12647		val="$define"
12648	else
12649		val="$undef"
12650	fi
12651	set d_pwage
12652	eval $setvar
12653
12654	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12655		val="$define"
12656	else
12657		val="$undef"
12658	fi
12659	set d_pwchange
12660	eval $setvar
12661
12662	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12663		val="$define"
12664	else
12665		val="$undef"
12666	fi
12667	set d_pwclass
12668	eval $setvar
12669
12670	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12671		val="$define"
12672	else
12673		val="$undef"
12674	fi
12675	set d_pwexpire
12676	eval $setvar
12677
12678	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12679		val="$define"
12680	else
12681		val="$undef"
12682	fi
12683	set d_pwcomment
12684	eval $setvar
12685
12686	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12687		val="$define"
12688	else
12689		val="$undef"
12690	fi
12691	set d_pwgecos
12692	eval $setvar
12693
12694	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12695		val="$define"
12696	else
12697		val="$undef"
12698	fi
12699	set d_pwpasswd
12700	eval $setvar
12701
12702	$rm -f $$.h
12703	;;
12704*)
12705	val="$undef";
12706	set d_pwquota; eval $setvar
12707	set d_pwage; eval $setvar
12708	set d_pwchange; eval $setvar
12709	set d_pwclass; eval $setvar
12710	set d_pwexpire; eval $setvar
12711	set d_pwcomment; eval $setvar
12712	set d_pwgecos; eval $setvar
12713	set d_pwpasswd; eval $setvar
12714	;;
12715esac
12716
12717: see if endpwent_r exists
12718set endpwent_r d_endpwent_r
12719eval $inlibc
12720case "$d_endpwent_r" in
12721"$define")
12722	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12723	case "$d_endpwent_r_proto:$usethreads" in
12724	":define")	d_endpwent_r_proto=define
12725		set d_endpwent_r_proto endpwent_r $hdrs
12726		eval $hasproto ;;
12727	*)	;;
12728	esac
12729	case "$d_endpwent_r_proto" in
12730	define)
12731	case "$endpwent_r_proto" in
12732	''|0) try='int endpwent_r(FILE**);'
12733	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12734	esac
12735	case "$endpwent_r_proto" in
12736	''|0) try='void endpwent_r(FILE**);'
12737	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12738	esac
12739	case "$endpwent_r_proto" in
12740	''|0)	d_endpwent_r=undef
12741 	        endpwent_r_proto=0
12742		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12743	* )	case "$endpwent_r_proto" in
12744		REENTRANT_PROTO*) ;;
12745		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12746		esac
12747		echo "Prototype: $try" ;;
12748	esac
12749	;;
12750	*)	case "$usethreads" in
12751		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12752		esac
12753		d_endpwent_r=undef
12754		endpwent_r_proto=0
12755		;;
12756	esac
12757	;;
12758*)	endpwent_r_proto=0
12759	;;
12760esac
12761
12762: see if endservent exists
12763set endservent d_endsent
12764eval $inlibc
12765
12766: see if endservent_r exists
12767set endservent_r d_endservent_r
12768eval $inlibc
12769case "$d_endservent_r" in
12770"$define")
12771	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12772	case "$d_endservent_r_proto:$usethreads" in
12773	":define")	d_endservent_r_proto=define
12774		set d_endservent_r_proto endservent_r $hdrs
12775		eval $hasproto ;;
12776	*)	;;
12777	esac
12778	case "$d_endservent_r_proto" in
12779	define)
12780	case "$endservent_r_proto" in
12781	''|0) try='int endservent_r(struct servent_data*);'
12782	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12783	esac
12784	case "$endservent_r_proto" in
12785	''|0) try='void endservent_r(struct servent_data*);'
12786	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12787	esac
12788	case "$endservent_r_proto" in
12789	''|0)	d_endservent_r=undef
12790 	        endservent_r_proto=0
12791		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12792	* )	case "$endservent_r_proto" in
12793		REENTRANT_PROTO*) ;;
12794		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12795		esac
12796		echo "Prototype: $try" ;;
12797	esac
12798	;;
12799	*)	case "$usethreads" in
12800		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12801		esac
12802		d_endservent_r=undef
12803		endservent_r_proto=0
12804		;;
12805	esac
12806	;;
12807*)	endservent_r_proto=0
12808	;;
12809esac
12810
12811: Locate the flags for 'open()'
12812echo " "
12813$cat >try.c <<EOCP
12814#include <sys/types.h>
12815#ifdef I_FCNTL
12816#include <fcntl.h>
12817#endif
12818#ifdef I_SYS_FILE
12819#include <sys/file.h>
12820#endif
12821#$i_stdlib I_STDLIB
12822#ifdef I_STDLIB
12823#include <stdlib.h>
12824#endif
12825int main() {
12826	if(O_RDONLY);
12827#ifdef O_TRUNC
12828	exit(0);
12829#else
12830	exit(1);
12831#endif
12832}
12833EOCP
12834: check sys/file.h first to get FREAD on Sun
12835if $test `./findhdr sys/file.h` && \
12836		set try -DI_SYS_FILE && eval $compile; then
12837	h_sysfile=true;
12838	echo "<sys/file.h> defines the O_* constants..." >&4
12839	if $run ./try; then
12840		echo "and you have the 3 argument form of open()." >&4
12841		val="$define"
12842	else
12843		echo "but not the 3 argument form of open().  Oh, well." >&4
12844		val="$undef"
12845	fi
12846elif $test `./findhdr fcntl.h` && \
12847		set try -DI_FCNTL && eval $compile; then
12848	h_fcntl=true;
12849	echo "<fcntl.h> defines the O_* constants..." >&4
12850	if $run ./try; then
12851		echo "and you have the 3 argument form of open()." >&4
12852		val="$define"
12853	else
12854		echo "but not the 3 argument form of open().  Oh, well." >&4
12855		val="$undef"
12856	fi
12857else
12858	val="$undef"
12859	echo "I can't find the O_* constant definitions!  You got problems." >&4
12860fi
12861set d_open3
12862eval $setvar
12863$rm_try
12864
12865: see if this is a sys/file.h system
12866val=''
12867set sys/file.h val
12868eval $inhdr
12869
12870: do we need to include sys/file.h ?
12871case "$val" in
12872"$define")
12873	echo " "
12874	if $h_sysfile; then
12875		val="$define"
12876		echo "We'll be including <sys/file.h>." >&4
12877	else
12878		val="$undef"
12879		echo "We won't be including <sys/file.h>." >&4
12880	fi
12881	;;
12882*)
12883	h_sysfile=false
12884	;;
12885esac
12886set i_sysfile
12887eval $setvar
12888
12889: see if fcntl.h is there
12890val=''
12891set fcntl.h val
12892eval $inhdr
12893
12894: see if we can include fcntl.h
12895case "$val" in
12896"$define")
12897	echo " "
12898	if $h_fcntl; then
12899		val="$define"
12900		echo "We'll be including <fcntl.h>." >&4
12901	else
12902		val="$undef"
12903		if $h_sysfile; then
12904	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12905		else
12906			echo "We won't be including <fcntl.h>." >&4
12907		fi
12908	fi
12909	;;
12910*)
12911	h_fcntl=false
12912	val="$undef"
12913	;;
12914esac
12915set i_fcntl
12916eval $setvar
12917
12918: see if fork exists
12919set fork d_fork
12920eval $inlibc
12921
12922: see if pipe exists
12923set pipe d_pipe
12924eval $inlibc
12925
12926: check for non-blocking I/O stuff
12927case "$h_sysfile" in
12928true) echo "#include <sys/file.h>" > head.c;;
12929*)
12930       case "$h_fcntl" in
12931       true) echo "#include <fcntl.h>" > head.c;;
12932       *) echo "#include <sys/fcntl.h>" > head.c;;
12933       esac
12934       ;;
12935esac
12936echo " "
12937echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12938case "$o_nonblock" in
12939'')
12940	$cat head.c > try.c
12941	$cat >>try.c <<EOCP
12942#include <stdio.h>
12943#$i_stdlib I_STDLIB
12944#ifdef I_STDLIB
12945#include <stdlib.h>
12946#endif
12947#$i_fcntl I_FCNTL
12948#ifdef I_FCNTL
12949#include <fcntl.h>
12950#endif
12951int main() {
12952#ifdef O_NONBLOCK
12953	printf("O_NONBLOCK\n");
12954	exit(0);
12955#endif
12956#ifdef O_NDELAY
12957	printf("O_NDELAY\n");
12958	exit(0);
12959#endif
12960#ifdef FNDELAY
12961	printf("FNDELAY\n");
12962	exit(0);
12963#endif
12964	exit(0);
12965}
12966EOCP
12967	set try
12968	if eval $compile_ok; then
12969		o_nonblock=`$run ./try`
12970		case "$o_nonblock" in
12971		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12972		*) echo "Seems like we can use $o_nonblock.";;
12973		esac
12974	else
12975		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12976	fi
12977	;;
12978*) echo "Using $hint value $o_nonblock.";;
12979esac
12980$rm_try
12981
12982echo " "
12983echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12984case "$eagain" in
12985'')
12986	case "$d_fork:$d_pipe" in
12987	define:define)
12988	$cat head.c > try.c
12989	$cat >>try.c <<EOCP
12990#include <errno.h>
12991#include <sys/types.h>
12992#include <signal.h>
12993#include <stdio.h>
12994#$i_stdlib I_STDLIB
12995#ifdef I_STDLIB
12996#include <stdlib.h>
12997#endif
12998#$i_fcntl I_FCNTL
12999#ifdef I_FCNTL
13000#include <fcntl.h>
13001#endif
13002#define MY_O_NONBLOCK $o_nonblock
13003#ifndef errno  /* XXX need better Configure test */
13004extern int errno;
13005#endif
13006#$i_unistd I_UNISTD
13007#ifdef I_UNISTD
13008#include <unistd.h>
13009#endif
13010#$i_string I_STRING
13011#ifdef I_STRING
13012#include <string.h>
13013#else
13014#include <strings.h>
13015#endif
13016$signal_t blech(int x) { exit(3); }
13017EOCP
13018	$cat >> try.c <<'EOCP'
13019int main()
13020{
13021	int pd[2];
13022	int pu[2];
13023	char buf[1];
13024	char string[100];
13025
13026	pipe(pd);	/* Down: child -> parent */
13027	pipe(pu);	/* Up: parent -> child */
13028	if (0 != fork()) {
13029		int ret;
13030		close(pd[1]);	/* Parent reads from pd[0] */
13031		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
13032#ifdef F_SETFL
13033		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13034			exit(1);
13035#else
13036		exit(4);
13037#endif
13038		signal(SIGALRM, blech);
13039		alarm(5);
13040		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
13041			exit(2);
13042		sprintf(string, "%d\n", ret);
13043		write(2, string, strlen(string));
13044		alarm(0);
13045#ifdef EAGAIN
13046		if (errno == EAGAIN) {
13047			printf("EAGAIN\n");
13048			goto ok;
13049		}
13050#endif
13051#ifdef EWOULDBLOCK
13052		if (errno == EWOULDBLOCK)
13053			printf("EWOULDBLOCK\n");
13054#endif
13055	ok:
13056		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
13057		sleep(2);				/* Give it time to close our pipe */
13058		alarm(5);
13059		ret = read(pd[0], buf, 1);	/* Should read EOF */
13060		alarm(0);
13061		sprintf(string, "%d\n", ret);
13062		write(4, string, strlen(string));
13063		exit(0);
13064	}
13065
13066	close(pd[0]);			/* We write to pd[1] */
13067	close(pu[1]);			/* We read from pu[0] */
13068	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
13069	close(pd[1]);			/* Pipe pd is now fully closed! */
13070	exit(0);				/* Bye bye, thank you for playing! */
13071}
13072EOCP
13073	set try
13074	if eval $compile_ok; then
13075		echo "$startsh" >mtry
13076		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13077		chmod +x mtry
13078		$run ./mtry >/dev/null 2>&1
13079		case $? in
13080		0) eagain=`$cat try.out`;;
13081		1) echo "Could not perform non-blocking setting!";;
13082		2) echo "I did a successful read() for something that was not there!";;
13083		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13084		4) echo "Could not find F_SETFL!";;
13085		*) echo "Something terribly wrong happened during testing.";;
13086		esac
13087		rd_nodata=`$cat try.ret`
13088		echo "A read() system call with no data present returns $rd_nodata."
13089		case "$rd_nodata" in
13090		0|-1) ;;
13091		*)
13092			echo "(That's peculiar, fixing that to be -1.)"
13093			rd_nodata=-1
13094			;;
13095		esac
13096		case "$eagain" in
13097		'')
13098			echo "Forcing errno EAGAIN on read() with no data available."
13099			eagain=EAGAIN
13100			;;
13101		*)
13102			echo "Your read() sets errno to $eagain when no data is available."
13103			;;
13104		esac
13105		status=`$cat try.err`
13106		case "$status" in
13107		0) echo "And it correctly returns 0 to signal EOF.";;
13108		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
13109		*) echo "However, your read() returns '$status' on EOF??";;
13110		esac
13111		val="$define"
13112		if test "$status" = "$rd_nodata"; then
13113			echo "WARNING: you can't distinguish between EOF and no data!"
13114			val="$undef"
13115		fi
13116	else
13117		echo "I can't compile the test program--assuming errno EAGAIN will do."
13118		eagain=EAGAIN
13119	fi
13120	;;
13121	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13122		eagain=EAGAIN
13123		val="$define"
13124		;;
13125	esac
13126	set d_eofnblk
13127	eval $setvar
13128	;;
13129*)
13130	echo "Using $hint value $eagain."
13131	echo "Your read() returns $rd_nodata when no data is present."
13132	case "$d_eofnblk" in
13133	"$define") echo "And you can see EOF because read() returns 0.";;
13134	"$undef") echo "But you can't see EOF status from read() returned value.";;
13135	*)
13136		echo "(Assuming you can't see EOF status from read anyway.)"
13137		d_eofnblk=$undef
13138		;;
13139	esac
13140	;;
13141esac
13142$rm_try head.c mtry
13143
13144: see if _ptr and _cnt from stdio act std
13145echo " "
13146
13147if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13148	echo "(Looks like you have stdio.h from BSD.)"
13149	case "$stdio_ptr" in
13150	'') stdio_ptr='((fp)->_p)'
13151		ptr_lval=$define
13152		;;
13153	*)	ptr_lval=$d_stdio_ptr_lval;;
13154	esac
13155	case "$stdio_cnt" in
13156	'') stdio_cnt='((fp)->_r)'
13157		cnt_lval=$define
13158		;;
13159	*)	cnt_lval=$d_stdio_cnt_lval;;
13160	esac
13161	case "$stdio_base" in
13162	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13163	esac
13164	case "$stdio_bufsiz" in
13165	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13166	esac
13167elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13168	echo "(Looks like you have stdio.h from Linux.)"
13169	case "$stdio_ptr" in
13170	'') stdio_ptr='((fp)->_IO_read_ptr)'
13171		ptr_lval=$define
13172		;;
13173	*)	ptr_lval=$d_stdio_ptr_lval;;
13174	esac
13175	case "$stdio_cnt" in
13176	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13177		cnt_lval=$undef
13178		;;
13179	*)	cnt_lval=$d_stdio_cnt_lval;;
13180	esac
13181	case "$stdio_base" in
13182	'') stdio_base='((fp)->_IO_read_base)';;
13183	esac
13184	case "$stdio_bufsiz" in
13185	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13186	esac
13187else
13188	case "$stdio_ptr" in
13189	'') stdio_ptr='((fp)->_ptr)'
13190		ptr_lval=$define
13191		;;
13192	*)	ptr_lval=$d_stdio_ptr_lval;;
13193	esac
13194	case "$stdio_cnt" in
13195	'') stdio_cnt='((fp)->_cnt)'
13196		cnt_lval=$define
13197		;;
13198	*)	cnt_lval=$d_stdio_cnt_lval;;
13199	esac
13200	case "$stdio_base" in
13201	'') stdio_base='((fp)->_base)';;
13202	esac
13203	case "$stdio_bufsiz" in
13204	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13205	esac
13206fi
13207
13208: test whether _ptr and _cnt really work
13209echo "Checking how std your stdio is..." >&4
13210$cat >try.c <<EOP
13211#include <stdio.h>
13212#$i_stdlib I_STDLIB
13213#ifdef I_STDLIB
13214#include <stdlib.h>
13215#endif
13216#define FILE_ptr(fp)	$stdio_ptr
13217#define FILE_cnt(fp)	$stdio_cnt
13218int main() {
13219	FILE *fp = fopen("try.c", "r");
13220	char c = getc(fp);
13221	if (
13222		18 <= FILE_cnt(fp) &&
13223		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13224	)
13225		exit(0);
13226	exit(1);
13227}
13228EOP
13229val="$undef"
13230set try
13231if eval $compile && $to try.c; then
13232	if $run ./try; then
13233		echo "Your stdio acts pretty std."
13234		val="$define"
13235	else
13236		echo "Your stdio isn't very std."
13237	fi
13238else
13239	echo "Your stdio doesn't appear very std."
13240fi
13241$rm_try
13242
13243# glibc 2.2.90 and above apparently change stdio streams so Perl's
13244# direct buffer manipulation no longer works.  The Configure tests
13245# should be changed to correctly detect this, but until then,
13246# the following check should at least let perl compile and run.
13247# (This quick fix should be updated before 5.8.1.)
13248# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13249# A. Dougherty, June 3, 2002.
13250case "$d_gnulibc" in
13251$define)
13252	case "$gnulibc_version" in
13253	2.[01]*)  ;;
13254	2.2) ;;
13255	2.2.[0-9]) ;;
13256	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13257		val="$undef"
13258		;;
13259	esac
13260	;;
13261esac
13262set d_stdstdio
13263eval $setvar
13264
13265: Can _ptr be used as an lvalue?
13266case "$d_stdstdio$ptr_lval" in
13267$define$define) val=$define ;;
13268*) val=$undef ;;
13269esac
13270set d_stdio_ptr_lval
13271eval $setvar
13272
13273: Can _cnt be used as an lvalue?
13274case "$d_stdstdio$cnt_lval" in
13275$define$define) val=$define ;;
13276*) val=$undef ;;
13277esac
13278set d_stdio_cnt_lval
13279eval $setvar
13280
13281
13282: test whether setting _ptr sets _cnt as a side effect
13283d_stdio_ptr_lval_sets_cnt="$undef"
13284d_stdio_ptr_lval_nochange_cnt="$undef"
13285case "$d_stdio_ptr_lval$d_stdstdio" in
13286$define$define)
13287	echo "Checking to see what happens if we set the stdio ptr..." >&4
13288$cat >try.c <<EOP
13289#include <stdio.h>
13290/* Can we scream? */
13291/* Eat dust sed :-) */
13292/* In the buffer space, no one can hear you scream. */
13293#$i_stdlib I_STDLIB
13294#ifdef I_STDLIB
13295#include <stdlib.h>
13296#endif
13297#define FILE_ptr(fp)	$stdio_ptr
13298#define FILE_cnt(fp)	$stdio_cnt
13299#include <sys/types.h>
13300int main() {
13301	FILE *fp = fopen("try.c", "r");
13302	int c;
13303	char *ptr;
13304	size_t cnt;
13305	if (!fp) {
13306	    puts("Fail even to read");
13307	    exit(1);
13308	}
13309	c = getc(fp); /* Read away the first # */
13310	if (c == EOF) {
13311	    puts("Fail even to read");
13312	    exit(1);
13313	}
13314	if (!(
13315		18 <= FILE_cnt(fp) &&
13316		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13317	)) {
13318		puts("Fail even to read");
13319		exit (1);
13320	}
13321	ptr = (char*) FILE_ptr(fp);
13322	cnt = (size_t)FILE_cnt(fp);
13323
13324	FILE_ptr(fp) += 42;
13325
13326	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13327		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13328		exit (1);
13329	}
13330	if (FILE_cnt(fp) <= 20) {
13331		printf ("Fail (<20 chars to test)");
13332		exit (1);
13333	}
13334	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13335		puts("Fail compare");
13336		exit (1);
13337	}
13338	if (cnt == FILE_cnt(fp)) {
13339		puts("Pass_unchanged");
13340		exit (0);
13341	}
13342	if (FILE_cnt(fp) == (cnt - 42)) {
13343		puts("Pass_changed");
13344		exit (0);
13345	}
13346	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13347	return 1;
13348
13349}
13350EOP
13351	set try
13352	if eval $compile && $to try.c; then
13353 		case `$run ./try` in
13354		Pass_changed)
13355			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13356			d_stdio_ptr_lval_sets_cnt="$define" ;;
13357		Pass_unchanged)
13358			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13359			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13360		Fail*)
13361			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13362		*)
13363			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13364	esac
13365	else
13366		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13367	fi
13368	$rm_try
13369	;;
13370esac
13371
13372: see if _base is also standard
13373val="$undef"
13374case "$d_stdstdio" in
13375$define)
13376	$cat >try.c <<EOP
13377#include <stdio.h>
13378#$i_stdlib I_STDLIB
13379#ifdef I_STDLIB
13380#include <stdlib.h>
13381#endif
13382#define FILE_base(fp)	$stdio_base
13383#define FILE_bufsiz(fp)	$stdio_bufsiz
13384int main() {
13385	FILE *fp = fopen("try.c", "r");
13386	char c = getc(fp);
13387	if (
13388		19 <= FILE_bufsiz(fp) &&
13389		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13390	)
13391		exit(0);
13392	exit(1);
13393}
13394EOP
13395	set try
13396	if eval $compile && $to try.c; then
13397		if $run ./try; then
13398			echo "And its _base field acts std."
13399			val="$define"
13400		else
13401			echo "But its _base field isn't std."
13402		fi
13403	else
13404		echo "However, it seems to be lacking the _base field."
13405	fi
13406	$rm_try
13407	;;
13408esac
13409set d_stdiobase
13410eval $setvar
13411
13412: see if fast_stdio exists
13413val="$undef"
13414case "$d_stdstdio:$d_stdio_ptr_lval" in
13415"$define:$define")
13416	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13417	*$define*)
13418		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13419		val="$define"
13420		;;
13421	esac
13422	;;
13423esac
13424set d_faststdio
13425eval $setvar
13426
13427
13428
13429: see if fchdir exists
13430set fchdir d_fchdir
13431eval $inlibc
13432
13433: see if fchmod exists
13434set fchmod d_fchmod
13435eval $inlibc
13436
13437: see if fchown exists
13438set fchown d_fchown
13439eval $inlibc
13440
13441: see if this is an fcntl system
13442set fcntl d_fcntl
13443eval $inlibc
13444
13445: See if fcntl-based locking works.
13446echo " "
13447$cat >try.c <<EOCP
13448#$i_stdlib I_STDLIB
13449#ifdef I_STDLIB
13450#include <stdlib.h>
13451#endif
13452#include <unistd.h>
13453#include <fcntl.h>
13454#include <signal.h>
13455$signal_t blech(int x) { exit(3); }
13456int main() {
13457#if defined(F_SETLK) && defined(F_SETLKW)
13458     struct flock flock;
13459     int retval, fd;
13460     fd = open("try.c", O_RDONLY);
13461     flock.l_type = F_RDLCK;
13462     flock.l_whence = SEEK_SET;
13463     flock.l_start = flock.l_len = 0;
13464     signal(SIGALRM, blech);
13465     alarm(10);
13466     retval = fcntl(fd, F_SETLK, &flock);
13467     close(fd);
13468     (retval < 0 ? exit(2) : exit(0));
13469#else
13470     exit(2);
13471#endif
13472}
13473EOCP
13474echo "Checking if fcntl-based file locking works... "
13475case "$d_fcntl" in
13476"$define")
13477	set try
13478	if eval $compile_ok; then
13479		if $run ./try; then
13480			echo "Yes, it seems to work."
13481			val="$define"
13482		else
13483			echo "Nope, it didn't work."
13484			val="$undef"
13485			case "$?" in
13486			3) $cat >&4 <<EOM
13487***
13488*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13489*** This is (almost) impossible.
13490*** If your NFS lock daemons are not feeling well, something like
13491*** this may happen, please investigate.  Cannot continue, aborting.
13492***
13493EOM
13494				exit 1
13495				;;
13496			esac
13497		fi
13498	else
13499		echo "I'm unable to compile the test program, so I'll assume not."
13500		val="$undef"
13501	fi
13502	;;
13503*) val="$undef";
13504	echo "Nope, since you don't even have fcntl()."
13505	;;
13506esac
13507set d_fcntl_can_lock
13508eval $setvar
13509$rm_try
13510
13511: check for fd_set items
13512$cat <<EOM
13513
13514Checking to see how well your C compiler handles fd_set and friends ...
13515EOM
13516$cat >try.c <<EOCP
13517#$i_stdlib I_STDLIB
13518#ifdef I_STDLIB
13519#include <stdlib.h>
13520#endif
13521#$i_systime I_SYS_TIME
13522#$i_sysselct I_SYS_SELECT
13523#$d_socket HAS_SOCKET
13524#include <sys/types.h>
13525#ifdef HAS_SOCKET
13526#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13527#endif
13528#ifdef I_SYS_TIME
13529#include <sys/time.h>
13530#endif
13531#ifdef I_SYS_SELECT
13532#include <sys/select.h>
13533#endif
13534int main() {
13535	fd_set fds;
13536
13537#ifdef TRYBITS
13538	if(fds.fds_bits);
13539#endif
13540
13541#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13542	exit(0);
13543#else
13544	exit(1);
13545#endif
13546}
13547EOCP
13548set try -DTRYBITS
13549if eval $compile; then
13550	d_fds_bits="$define"
13551	d_fd_set="$define"
13552	echo "Well, your system knows about the normal fd_set typedef..." >&4
13553	if $run ./try; then
13554		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13555		d_fd_macros="$define"
13556	else
13557		$cat >&4 <<'EOM'
13558but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13559EOM
13560		d_fd_macros="$undef"
13561	fi
13562else
13563	$cat <<'EOM'
13564Hmm, your compiler has some difficulty with fd_set.  Checking further...
13565EOM
13566	set try
13567	if eval $compile; then
13568		d_fds_bits="$undef"
13569		d_fd_set="$define"
13570		echo "Well, your system has some sort of fd_set available..." >&4
13571		if $run ./try; then
13572			echo "and you have the normal fd_set macros." >&4
13573			d_fd_macros="$define"
13574		else
13575			$cat <<'EOM'
13576but not the normal fd_set macros!  Gross!  More work for me...
13577EOM
13578			d_fd_macros="$undef"
13579		fi
13580	else
13581	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13582		d_fd_set="$undef"
13583		d_fds_bits="$undef"
13584		d_fd_macros="$undef"
13585	fi
13586fi
13587$rm_try
13588
13589: see if fgetpos exists
13590set fgetpos d_fgetpos
13591eval $inlibc
13592
13593: see if finite exists
13594set finite d_finite
13595eval $inlibc
13596
13597: see if finitel exists
13598set finitel d_finitel
13599eval $inlibc
13600
13601: see if flock exists
13602set flock d_flock
13603eval $inlibc
13604
13605: see if prototype for flock is available
13606echo " "
13607set d_flockproto flock $i_sysfile sys/file.h
13608eval $hasproto
13609
13610: see if fp_class exists
13611set fp_class d_fp_class
13612eval $inlibc
13613
13614: see if pathconf exists
13615set pathconf d_pathconf
13616eval $inlibc
13617
13618: see if fpathconf exists
13619set fpathconf d_fpathconf
13620eval $inlibc
13621
13622: see if fpclass exists
13623set fpclass d_fpclass
13624eval $inlibc
13625
13626: see if fpclassify exists
13627set fpclassify d_fpclassify
13628eval $inlibc
13629
13630: see if fpclassl exists
13631set fpclassl d_fpclassl
13632eval $inlibc
13633
13634: check for fpos64_t
13635echo " "
13636echo "Checking to see if you have fpos64_t..." >&4
13637$cat >try.c <<EOCP
13638#include <stdio.h>
13639int main() { fpos64_t x = 7; }
13640EOCP
13641set try
13642if eval $compile; then
13643	val="$define"
13644	echo "You have fpos64_t."
13645else
13646	val="$undef"
13647	echo "You do not have fpos64_t."
13648	case "$fpossize" in
13649	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13650	esac
13651fi
13652$rm_try
13653set d_fpos64_t
13654eval $setvar
13655
13656: see if frexpl exists
13657set frexpl d_frexpl
13658eval $inlibc
13659
13660: see if this is a sys/param system
13661set sys/param.h i_sysparam
13662eval $inhdr
13663
13664: see if this is a sys/mount.h system
13665set sys/mount.h i_sysmount
13666eval $inhdr
13667
13668: Check for fs_data_s
13669echo " "
13670echo "Checking to see if your system supports struct fs_data..." >&4
13671set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13672eval $hasstruct
13673case "$d_fs_data_s" in
13674"$define")      echo "Yes, it does."   ;;
13675*)              echo "No, it doesn't." ;;
13676esac
13677
13678: see if fseeko exists
13679set fseeko d_fseeko
13680eval $inlibc
13681case "$longsize" in
136828) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13683esac
13684
13685: see if fsetpos exists
13686set fsetpos d_fsetpos
13687eval $inlibc
13688
13689: see if fstatfs exists
13690set fstatfs d_fstatfs
13691eval $inlibc
13692
13693: see if statvfs exists
13694set statvfs d_statvfs
13695eval $inlibc
13696
13697: see if fstatvfs exists
13698set fstatvfs d_fstatvfs
13699eval $inlibc
13700
13701
13702: see if fsync exists
13703set fsync d_fsync
13704eval $inlibc
13705
13706: see if ftello exists
13707set ftello d_ftello
13708eval $inlibc
13709case "$longsize" in
137108) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13711esac
13712
13713: check for a working futimes
13714d_futimes="$undef"
13715echo " "
13716echo "Checking if you have a working futimes()" >&4
13717$cat >try.c <<EOCP
13718#include <stdio.h>
13719#include <sys/time.h>
13720#include <errno.h>
13721#include <fcntl.h>
13722
13723int main ()
13724{
13725    int fd, rv;
13726    fd = open ("try.c", O_RDWR);
13727    if (-1 == fd) exit (1);
13728    rv = futimes (fd, NULL);
13729    exit (rv == -1 ? errno : 0);
13730}
13731EOCP
13732set try
13733if eval $compile; then
13734    `$run ./try`
13735    rc=$?
13736    case "$rc" in
13737	0)  echo "Yes, you have" >&4
13738	    d_futimes="$define"
13739	    ;;
13740	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13741	    ;;
13742    esac
13743else
13744    echo "No, it does not (probably harmless)" >&4
13745fi
13746$rm_try
13747
13748: see if ndbm.h is available
13749set ndbm.h i_ndbm
13750eval $inhdr
13751: Compatibility location for RedHat 7.1
13752set gdbm/ndbm.h i_gdbmndbm
13753eval $inhdr
13754: Compatibility location for Debian 4.0
13755set gdbm-ndbm.h i_gdbm_ndbm
13756eval $inhdr
13757
13758val="$undef"
13759if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13760	: see if dbm_open exists
13761	set dbm_open d_dbm_open
13762	eval $inlibc
13763	case "$d_dbm_open" in
13764	$undef)
13765		i_ndbm="$undef"
13766		i_gdbmndbm="$undef"
13767		i_gdbm_ndbm="$undef"
13768		echo "We won't be including <ndbm.h>"
13769		val="$undef"
13770		;;
13771	*) val="$define"
13772	   ;;
13773	esac
13774fi
13775set d_ndbm
13776eval $setvar
13777
13778ndbm_hdr_protochk='name=$1; hdr=$2;
13779eval "ihdr=\$""i_$name";
13780val="$undef";
13781if $test "$ihdr" = "$define"; then
13782	$echo "Checking if your <$hdr> uses prototypes..." >&4;
13783	case "$d_cplusplus" in
13784	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13785	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13786	esac;
13787	case "$val" in
13788	$define) $echo "Your <$hdr> seems to have prototypes";;
13789	*) $echo "Your <$hdr> does not seem to have prototypes";;
13790	esac;
13791fi;
13792set "d_${name}_h_uses_prototypes";
13793eval $setvar'
13794
13795set ndbm ndbm.h
13796eval $ndbm_hdr_protochk
13797set gdbmndbm gdbm/ndbm.h
13798eval $ndbm_hdr_protochk
13799set gdbm_ndbm gdbm-ndbm.h
13800eval $ndbm_hdr_protochk
13801
13802: see if getaddrinfo exists
13803set getaddrinfo d_getaddrinfo
13804eval $inlibc
13805
13806: see if getcwd exists
13807set getcwd d_getcwd
13808eval $inlibc
13809
13810: see if getespwnam exists
13811set getespwnam d_getespwnam
13812eval $inlibc
13813
13814: see if getfsstat exists
13815set getfsstat d_getfsstat
13816eval $inlibc
13817
13818: see if getgrent exists
13819set getgrent d_getgrent
13820eval $inlibc
13821
13822: see if getgrent_r exists
13823set getgrent_r d_getgrent_r
13824eval $inlibc
13825case "$d_getgrent_r" in
13826"$define")
13827	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13828	case "$d_getgrent_r_proto:$usethreads" in
13829	":define")	d_getgrent_r_proto=define
13830		set d_getgrent_r_proto getgrent_r $hdrs
13831		eval $hasproto ;;
13832	*)	;;
13833	esac
13834	case "$d_getgrent_r_proto" in
13835	define)
13836	case "$getgrent_r_proto" in
13837	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13838	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13839	esac
13840	case "$getgrent_r_proto" in
13841	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13842	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13843	esac
13844	case "$getgrent_r_proto" in
13845	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13846	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13847	esac
13848	case "$getgrent_r_proto" in
13849	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13850	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13851	esac
13852	case "$getgrent_r_proto" in
13853	''|0) try='int getgrent_r(struct group*, char*, int);'
13854	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13855	esac
13856	case "$getgrent_r_proto" in
13857	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13858	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13859	esac
13860	case "$getgrent_r_proto" in
13861	''|0)	d_getgrent_r=undef
13862 	        getgrent_r_proto=0
13863		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13864	* )	case "$getgrent_r_proto" in
13865		REENTRANT_PROTO*) ;;
13866		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13867		esac
13868		echo "Prototype: $try" ;;
13869	esac
13870	;;
13871	*)	case "$usethreads" in
13872		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13873		esac
13874		d_getgrent_r=undef
13875		getgrent_r_proto=0
13876		;;
13877	esac
13878	;;
13879*)	getgrent_r_proto=0
13880	;;
13881esac
13882
13883: see if getgrgid_r exists
13884set getgrgid_r d_getgrgid_r
13885eval $inlibc
13886case "$d_getgrgid_r" in
13887"$define")
13888	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13889	case "$d_getgrgid_r_proto:$usethreads" in
13890	":define")	d_getgrgid_r_proto=define
13891		set d_getgrgid_r_proto getgrgid_r $hdrs
13892		eval $hasproto ;;
13893	*)	;;
13894	esac
13895	case "$d_getgrgid_r_proto" in
13896	define)
13897	case "$getgrgid_r_proto" in
13898	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13899	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13900	esac
13901	case "$getgrgid_r_proto" in
13902	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13903	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13904	esac
13905	case "$getgrgid_r_proto" in
13906	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13907	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13908	esac
13909	case "$getgrgid_r_proto" in
13910	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13911	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13912	esac
13913	case "$getgrgid_r_proto" in
13914	''|0)	d_getgrgid_r=undef
13915 	        getgrgid_r_proto=0
13916		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13917	* )	case "$getgrgid_r_proto" in
13918		REENTRANT_PROTO*) ;;
13919		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13920		esac
13921		echo "Prototype: $try" ;;
13922	esac
13923	;;
13924	*)	case "$usethreads" in
13925		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13926		esac
13927		d_getgrgid_r=undef
13928		getgrgid_r_proto=0
13929		;;
13930	esac
13931	;;
13932*)	getgrgid_r_proto=0
13933	;;
13934esac
13935
13936: see if getgrnam_r exists
13937set getgrnam_r d_getgrnam_r
13938eval $inlibc
13939case "$d_getgrnam_r" in
13940"$define")
13941	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13942	case "$d_getgrnam_r_proto:$usethreads" in
13943	":define")	d_getgrnam_r_proto=define
13944		set d_getgrnam_r_proto getgrnam_r $hdrs
13945		eval $hasproto ;;
13946	*)	;;
13947	esac
13948	case "$d_getgrnam_r_proto" in
13949	define)
13950	case "$getgrnam_r_proto" in
13951	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13952	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13953	esac
13954	case "$getgrnam_r_proto" in
13955	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13956	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13957	esac
13958	case "$getgrnam_r_proto" in
13959	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13960	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13961	esac
13962	case "$getgrnam_r_proto" in
13963	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13964	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13965	esac
13966	case "$getgrnam_r_proto" in
13967	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13968	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13969	esac
13970	case "$getgrnam_r_proto" in
13971	''|0)	d_getgrnam_r=undef
13972 	        getgrnam_r_proto=0
13973		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13974	* )	case "$getgrnam_r_proto" in
13975		REENTRANT_PROTO*) ;;
13976		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13977		esac
13978		echo "Prototype: $try" ;;
13979	esac
13980	;;
13981	*)	case "$usethreads" in
13982		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13983		esac
13984		d_getgrnam_r=undef
13985		getgrnam_r_proto=0
13986		;;
13987	esac
13988	;;
13989*)	getgrnam_r_proto=0
13990	;;
13991esac
13992
13993: see if gethostbyaddr exists
13994set gethostbyaddr d_gethbyaddr
13995eval $inlibc
13996
13997: see if gethostbyname exists
13998set gethostbyname d_gethbyname
13999eval $inlibc
14000
14001: see if gethostent exists
14002set gethostent d_gethent
14003eval $inlibc
14004
14005: see how we will look up host name
14006echo " "
14007call=''
14008if set gethostname val -f d_gethname; eval $csym; $val; then
14009	echo 'gethostname() found.' >&4
14010	d_gethname="$define"
14011	call=gethostname
14012fi
14013if set uname val -f d_uname; eval $csym; $val; then
14014	if ./xenix; then
14015		$cat <<'EOM'
14016uname() was found, but you're running xenix, and older versions of xenix
14017have a broken uname(). If you don't really know whether your xenix is old
14018enough to have a broken system call, use the default answer.
14019
14020EOM
14021		dflt=y
14022		case "$d_uname" in
14023		"$define") dflt=n;;
14024		esac
14025		rp='Is your uname() broken?'
14026		. ./myread
14027		case "$ans" in
14028		n*) d_uname="$define"; call=uname;;
14029		esac
14030	else
14031		echo 'uname() found.' >&4
14032		d_uname="$define"
14033		case "$call" in
14034		'') call=uname ;;
14035		esac
14036	fi
14037fi
14038case "$d_gethname" in
14039'') d_gethname="$undef";;
14040esac
14041case "$d_uname" in
14042'') d_uname="$undef";;
14043esac
14044case "$d_uname$d_gethname" in
14045*define*)
14046	dflt=n
14047	cat <<EOM
14048
14049Every now and then someone has a $call() that lies about the hostname
14050but can't be fixed for political or economic reasons.  If you wish, I can
14051pretend $call() isn't there and maybe compute hostname at run-time
14052thanks to the '$phostname' command.
14053
14054EOM
14055	rp="Shall I ignore $call() from now on?"
14056	. ./myread
14057	case "$ans" in
14058	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14059	esac;;
14060esac
14061case "$phostname" in
14062'') aphostname='';;
14063*) case "$aphostname" in
14064	/*) ;;
14065	*) set X $phostname
14066		shift
14067		file=$1
14068		shift
14069		file=`./loc $file $file $pth`
14070		aphostname=`echo $file $*`
14071		;;
14072	esac
14073	;;
14074esac
14075case "$d_uname$d_gethname" in
14076*define*) ;;
14077*)
14078	case "$phostname" in
14079	'')
14080		echo "There will be no way for $package to get your hostname." >&4;;
14081	*)
14082	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14083		;;
14084	esac;;
14085esac
14086case "$d_phostname" in
14087'') d_phostname="$undef";;
14088esac
14089
14090: see if gethostbyaddr_r exists
14091set gethostbyaddr_r d_gethostbyaddr_r
14092eval $inlibc
14093case "$d_gethostbyaddr_r" in
14094"$define")
14095	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14096	case "$d_gethostbyaddr_r_proto:$usethreads" in
14097	":define")	d_gethostbyaddr_r_proto=define
14098		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14099		eval $hasproto ;;
14100	*)	;;
14101	esac
14102	case "$d_gethostbyaddr_r_proto" in
14103	define)
14104	case "$gethostbyaddr_r_proto" in
14105	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14106	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14107	esac
14108	case "$gethostbyaddr_r_proto" in
14109	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14110	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14111	esac
14112	case "$gethostbyaddr_r_proto" in
14113	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14114	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14115	esac
14116	case "$gethostbyaddr_r_proto" in
14117	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14118	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14119	esac
14120	case "$gethostbyaddr_r_proto" in
14121	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14122	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14123	esac
14124	case "$gethostbyaddr_r_proto" in
14125	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14126	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14127	esac
14128	case "$gethostbyaddr_r_proto" in
14129	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14130	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14131	esac
14132	case "$gethostbyaddr_r_proto" in
14133	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14134	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14135	esac
14136	case "$gethostbyaddr_r_proto" in
14137	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14138	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14139	esac
14140	case "$gethostbyaddr_r_proto" in
14141	''|0) try='int gethostbyaddr_r(const char*, int, int);'
14142	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14143	esac
14144	case "$gethostbyaddr_r_proto" in
14145	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14146	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14147	esac
14148	case "$gethostbyaddr_r_proto" in
14149	''|0)	d_gethostbyaddr_r=undef
14150 	        gethostbyaddr_r_proto=0
14151		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14152	* )	case "$gethostbyaddr_r_proto" in
14153		REENTRANT_PROTO*) ;;
14154		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14155		esac
14156		echo "Prototype: $try" ;;
14157	esac
14158	;;
14159	*)	case "$usethreads" in
14160		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14161		esac
14162		d_gethostbyaddr_r=undef
14163		gethostbyaddr_r_proto=0
14164		;;
14165	esac
14166	;;
14167*)	gethostbyaddr_r_proto=0
14168	;;
14169esac
14170
14171: see if gethostbyname_r exists
14172set gethostbyname_r d_gethostbyname_r
14173eval $inlibc
14174case "$d_gethostbyname_r" in
14175"$define")
14176	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14177	case "$d_gethostbyname_r_proto:$usethreads" in
14178	":define")	d_gethostbyname_r_proto=define
14179		set d_gethostbyname_r_proto gethostbyname_r $hdrs
14180		eval $hasproto ;;
14181	*)	;;
14182	esac
14183	case "$d_gethostbyname_r_proto" in
14184	define)
14185	case "$gethostbyname_r_proto" in
14186	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14187	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14188	esac
14189	case "$gethostbyname_r_proto" in
14190	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14191	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14192	esac
14193	case "$gethostbyname_r_proto" in
14194	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14195	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14196	esac
14197	case "$gethostbyname_r_proto" in
14198	''|0)	d_gethostbyname_r=undef
14199 	        gethostbyname_r_proto=0
14200		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14201	* )	case "$gethostbyname_r_proto" in
14202		REENTRANT_PROTO*) ;;
14203		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14204		esac
14205		echo "Prototype: $try" ;;
14206	esac
14207	;;
14208	*)	case "$usethreads" in
14209		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14210		esac
14211		d_gethostbyname_r=undef
14212		gethostbyname_r_proto=0
14213		;;
14214	esac
14215	;;
14216*)	gethostbyname_r_proto=0
14217	;;
14218esac
14219
14220: see if gethostent_r exists
14221set gethostent_r d_gethostent_r
14222eval $inlibc
14223case "$d_gethostent_r" in
14224"$define")
14225	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14226	case "$d_gethostent_r_proto:$usethreads" in
14227	":define")	d_gethostent_r_proto=define
14228		set d_gethostent_r_proto gethostent_r $hdrs
14229		eval $hasproto ;;
14230	*)	;;
14231	esac
14232	case "$d_gethostent_r_proto" in
14233	define)
14234	case "$gethostent_r_proto" in
14235	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14236	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14237	esac
14238	case "$gethostent_r_proto" in
14239	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14240	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14241	esac
14242	case "$gethostent_r_proto" in
14243	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14244	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14245	esac
14246	case "$gethostent_r_proto" in
14247	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14248	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14249	esac
14250	case "$gethostent_r_proto" in
14251	''|0) try='int gethostent_r(struct hostent*, char*, int);'
14252	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14253	esac
14254	case "$gethostent_r_proto" in
14255	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14256	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14257	esac
14258	case "$gethostent_r_proto" in
14259	''|0)	d_gethostent_r=undef
14260 	        gethostent_r_proto=0
14261		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14262	* )	case "$gethostent_r_proto" in
14263		REENTRANT_PROTO*) ;;
14264		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14265		esac
14266		echo "Prototype: $try" ;;
14267	esac
14268	;;
14269	*)	case "$usethreads" in
14270		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14271		esac
14272		d_gethostent_r=undef
14273		gethostent_r_proto=0
14274		;;
14275	esac
14276	;;
14277*)	gethostent_r_proto=0
14278	;;
14279esac
14280
14281: see if prototypes for various gethostxxx netdb.h functions are available
14282echo " "
14283set d_gethostprotos gethostent $i_netdb netdb.h
14284eval $hasproto
14285
14286: see if getitimer exists
14287set getitimer d_getitimer
14288eval $inlibc
14289
14290: see if getlogin exists
14291set getlogin d_getlogin
14292eval $inlibc
14293
14294: see if getlogin_r exists
14295set getlogin_r d_getlogin_r
14296eval $inlibc
14297case "$d_getlogin_r" in
14298"$define")
14299	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14300	case "$d_getlogin_r_proto:$usethreads" in
14301	":define")	d_getlogin_r_proto=define
14302		set d_getlogin_r_proto getlogin_r $hdrs
14303		eval $hasproto ;;
14304	*)	;;
14305	esac
14306	case "$d_getlogin_r_proto" in
14307	define)
14308	case "$getlogin_r_proto" in
14309	''|0) try='int getlogin_r(char*, size_t);'
14310	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14311	esac
14312	case "$getlogin_r_proto" in
14313	''|0) try='int getlogin_r(char*, int);'
14314	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14315	esac
14316	case "$getlogin_r_proto" in
14317	''|0) try='char* getlogin_r(char*, size_t);'
14318	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14319	esac
14320	case "$getlogin_r_proto" in
14321	''|0) try='char* getlogin_r(char*, int);'
14322	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14323	esac
14324	case "$getlogin_r_proto" in
14325	''|0)	d_getlogin_r=undef
14326 	        getlogin_r_proto=0
14327		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14328	* )	case "$getlogin_r_proto" in
14329		REENTRANT_PROTO*) ;;
14330		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14331		esac
14332		echo "Prototype: $try" ;;
14333	esac
14334	;;
14335	*)	case "$usethreads" in
14336		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14337		esac
14338		d_getlogin_r=undef
14339		getlogin_r_proto=0
14340		;;
14341	esac
14342	;;
14343*)	getlogin_r_proto=0
14344	;;
14345esac
14346
14347: see if getmnt exists
14348set getmnt d_getmnt
14349eval $inlibc
14350
14351: see if getmntent exists
14352set getmntent d_getmntent
14353eval $inlibc
14354
14355: see if getnameinfo exists
14356set getnameinfo d_getnameinfo
14357eval $inlibc
14358
14359: see if getnetbyaddr exists
14360set getnetbyaddr d_getnbyaddr
14361eval $inlibc
14362
14363: see if getnetbyname exists
14364set getnetbyname d_getnbyname
14365eval $inlibc
14366
14367: see if getnetent exists
14368set getnetent d_getnent
14369eval $inlibc
14370
14371: see if getnetbyaddr_r exists
14372set getnetbyaddr_r d_getnetbyaddr_r
14373eval $inlibc
14374case "$d_getnetbyaddr_r" in
14375"$define")
14376	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14377	case "$d_getnetbyaddr_r_proto:$usethreads" in
14378	":define")	d_getnetbyaddr_r_proto=define
14379		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14380		eval $hasproto ;;
14381	*)	;;
14382	esac
14383	case "$d_getnetbyaddr_r_proto" in
14384	define)
14385	case "$getnetbyaddr_r_proto" in
14386	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14387	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14388	esac
14389	case "$getnetbyaddr_r_proto" in
14390	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14391	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14392	esac
14393	case "$getnetbyaddr_r_proto" in
14394	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14395	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14396	esac
14397	case "$getnetbyaddr_r_proto" in
14398	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14399	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14400	esac
14401	case "$getnetbyaddr_r_proto" in
14402	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14403	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14404	esac
14405	case "$getnetbyaddr_r_proto" in
14406	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14407	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14408	esac
14409	case "$getnetbyaddr_r_proto" in
14410	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14411	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14412	esac
14413	case "$getnetbyaddr_r_proto" in
14414	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14415	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14416	esac
14417	case "$getnetbyaddr_r_proto" in
14418	''|0)	d_getnetbyaddr_r=undef
14419 	        getnetbyaddr_r_proto=0
14420		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14421	* )	case "$getnetbyaddr_r_proto" in
14422		REENTRANT_PROTO*) ;;
14423		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14424		esac
14425		echo "Prototype: $try" ;;
14426	esac
14427	;;
14428	*)	case "$usethreads" in
14429		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14430		esac
14431		d_getnetbyaddr_r=undef
14432		getnetbyaddr_r_proto=0
14433		;;
14434	esac
14435	;;
14436*)	getnetbyaddr_r_proto=0
14437	;;
14438esac
14439
14440: see if getnetbyname_r exists
14441set getnetbyname_r d_getnetbyname_r
14442eval $inlibc
14443case "$d_getnetbyname_r" in
14444"$define")
14445	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14446	case "$d_getnetbyname_r_proto:$usethreads" in
14447	":define")	d_getnetbyname_r_proto=define
14448		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14449		eval $hasproto ;;
14450	*)	;;
14451	esac
14452	case "$d_getnetbyname_r_proto" in
14453	define)
14454	case "$getnetbyname_r_proto" in
14455	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14456	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14457	esac
14458	case "$getnetbyname_r_proto" in
14459	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14460	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14461	esac
14462	case "$getnetbyname_r_proto" in
14463	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14464	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14465	esac
14466	case "$getnetbyname_r_proto" in
14467	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14468	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14469	esac
14470	case "$getnetbyname_r_proto" in
14471	''|0)	d_getnetbyname_r=undef
14472 	        getnetbyname_r_proto=0
14473		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14474	* )	case "$getnetbyname_r_proto" in
14475		REENTRANT_PROTO*) ;;
14476		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14477		esac
14478		echo "Prototype: $try" ;;
14479	esac
14480	;;
14481	*)	case "$usethreads" in
14482		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14483		esac
14484		d_getnetbyname_r=undef
14485		getnetbyname_r_proto=0
14486		;;
14487	esac
14488	;;
14489*)	getnetbyname_r_proto=0
14490	;;
14491esac
14492
14493: see if getnetent_r exists
14494set getnetent_r d_getnetent_r
14495eval $inlibc
14496case "$d_getnetent_r" in
14497"$define")
14498	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14499	case "$d_getnetent_r_proto:$usethreads" in
14500	":define")	d_getnetent_r_proto=define
14501		set d_getnetent_r_proto getnetent_r $hdrs
14502		eval $hasproto ;;
14503	*)	;;
14504	esac
14505	case "$d_getnetent_r_proto" in
14506	define)
14507	case "$getnetent_r_proto" in
14508	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14509	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14510	esac
14511	case "$getnetent_r_proto" in
14512	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14513	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14514	esac
14515	case "$getnetent_r_proto" in
14516	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14517	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14518	esac
14519	case "$getnetent_r_proto" in
14520	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14521	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14522	esac
14523	case "$getnetent_r_proto" in
14524	''|0) try='int getnetent_r(struct netent*, char*, int);'
14525	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14526	esac
14527	case "$getnetent_r_proto" in
14528	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14529	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14530	esac
14531	case "$getnetent_r_proto" in
14532	''|0)	d_getnetent_r=undef
14533 	        getnetent_r_proto=0
14534		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14535	* )	case "$getnetent_r_proto" in
14536		REENTRANT_PROTO*) ;;
14537		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14538		esac
14539		echo "Prototype: $try" ;;
14540	esac
14541	;;
14542	*)	case "$usethreads" in
14543		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14544		esac
14545		d_getnetent_r=undef
14546		getnetent_r_proto=0
14547		;;
14548	esac
14549	;;
14550*)	getnetent_r_proto=0
14551	;;
14552esac
14553
14554: see if prototypes for various getnetxxx netdb.h functions are available
14555echo " "
14556set d_getnetprotos getnetent $i_netdb netdb.h
14557eval $hasproto
14558
14559: see if getpagesize exists
14560set getpagesize d_getpagsz
14561eval $inlibc
14562
14563: Optional checks for getprotobyname and getprotobynumber
14564
14565: see if getprotobyname exists
14566set getprotobyname d_getpbyname
14567eval $inlibc
14568
14569: see if getprotobynumber exists
14570set getprotobynumber d_getpbynumber
14571eval $inlibc
14572
14573: see if getprotoent exists
14574set getprotoent d_getpent
14575eval $inlibc
14576
14577: see if getpgid exists
14578set getpgid d_getpgid
14579eval $inlibc
14580
14581: see if getpgrp2 exists
14582set getpgrp2 d_getpgrp2
14583eval $inlibc
14584
14585: see if getppid exists
14586set getppid d_getppid
14587eval $inlibc
14588
14589: see if getpriority exists
14590set getpriority d_getprior
14591eval $inlibc
14592
14593: see if getprotobyname_r exists
14594set getprotobyname_r d_getprotobyname_r
14595eval $inlibc
14596case "$d_getprotobyname_r" in
14597"$define")
14598	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14599	case "$d_getprotobyname_r_proto:$usethreads" in
14600	":define")	d_getprotobyname_r_proto=define
14601		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14602		eval $hasproto ;;
14603	*)	;;
14604	esac
14605	case "$d_getprotobyname_r_proto" in
14606	define)
14607	case "$getprotobyname_r_proto" in
14608	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14609	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14610	esac
14611	case "$getprotobyname_r_proto" in
14612	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14613	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14614	esac
14615	case "$getprotobyname_r_proto" in
14616	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14617	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14618	esac
14619	case "$getprotobyname_r_proto" in
14620	''|0)	d_getprotobyname_r=undef
14621 	        getprotobyname_r_proto=0
14622		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14623	* )	case "$getprotobyname_r_proto" in
14624		REENTRANT_PROTO*) ;;
14625		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14626		esac
14627		echo "Prototype: $try" ;;
14628	esac
14629	;;
14630	*)	case "$usethreads" in
14631		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14632		esac
14633		d_getprotobyname_r=undef
14634		getprotobyname_r_proto=0
14635		;;
14636	esac
14637	;;
14638*)	getprotobyname_r_proto=0
14639	;;
14640esac
14641
14642: see if getprotobynumber_r exists
14643set getprotobynumber_r d_getprotobynumber_r
14644eval $inlibc
14645case "$d_getprotobynumber_r" in
14646"$define")
14647	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14648	case "$d_getprotobynumber_r_proto:$usethreads" in
14649	":define")	d_getprotobynumber_r_proto=define
14650		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14651		eval $hasproto ;;
14652	*)	;;
14653	esac
14654	case "$d_getprotobynumber_r_proto" in
14655	define)
14656	case "$getprotobynumber_r_proto" in
14657	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14658	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14659	esac
14660	case "$getprotobynumber_r_proto" in
14661	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14662	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14663	esac
14664	case "$getprotobynumber_r_proto" in
14665	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14666	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14667	esac
14668	case "$getprotobynumber_r_proto" in
14669	''|0)	d_getprotobynumber_r=undef
14670 	        getprotobynumber_r_proto=0
14671		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14672	* )	case "$getprotobynumber_r_proto" in
14673		REENTRANT_PROTO*) ;;
14674		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14675		esac
14676		echo "Prototype: $try" ;;
14677	esac
14678	;;
14679	*)	case "$usethreads" in
14680		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14681		esac
14682		d_getprotobynumber_r=undef
14683		getprotobynumber_r_proto=0
14684		;;
14685	esac
14686	;;
14687*)	getprotobynumber_r_proto=0
14688	;;
14689esac
14690
14691: see if getprotoent_r exists
14692set getprotoent_r d_getprotoent_r
14693eval $inlibc
14694case "$d_getprotoent_r" in
14695"$define")
14696	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14697	case "$d_getprotoent_r_proto:$usethreads" in
14698	":define")	d_getprotoent_r_proto=define
14699		set d_getprotoent_r_proto getprotoent_r $hdrs
14700		eval $hasproto ;;
14701	*)	;;
14702	esac
14703	case "$d_getprotoent_r_proto" in
14704	define)
14705	case "$getprotoent_r_proto" in
14706	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14707	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14708	esac
14709	case "$getprotoent_r_proto" in
14710	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14711	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14712	esac
14713	case "$getprotoent_r_proto" in
14714	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14715	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14716	esac
14717	case "$getprotoent_r_proto" in
14718	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14719	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14720	esac
14721	case "$getprotoent_r_proto" in
14722	''|0)	d_getprotoent_r=undef
14723 	        getprotoent_r_proto=0
14724		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14725	* )	case "$getprotoent_r_proto" in
14726		REENTRANT_PROTO*) ;;
14727		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14728		esac
14729		echo "Prototype: $try" ;;
14730	esac
14731	;;
14732	*)	case "$usethreads" in
14733		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14734		esac
14735		d_getprotoent_r=undef
14736		getprotoent_r_proto=0
14737		;;
14738	esac
14739	;;
14740*)	getprotoent_r_proto=0
14741	;;
14742esac
14743
14744: see if prototypes for various getprotoxxx netdb.h functions are available
14745echo " "
14746set d_getprotoprotos getprotoent $i_netdb netdb.h
14747eval $hasproto
14748
14749: see if getprpwnam exists
14750set getprpwnam d_getprpwnam
14751eval $inlibc
14752
14753: see if getpwent exists
14754set getpwent d_getpwent
14755eval $inlibc
14756
14757: see if getpwent_r exists
14758set getpwent_r d_getpwent_r
14759eval $inlibc
14760case "$d_getpwent_r" in
14761"$define")
14762	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14763	case "$d_getpwent_r_proto:$usethreads" in
14764	":define")	d_getpwent_r_proto=define
14765		set d_getpwent_r_proto getpwent_r $hdrs
14766		eval $hasproto ;;
14767	*)	;;
14768	esac
14769	case "$d_getpwent_r_proto" in
14770	define)
14771	case "$getpwent_r_proto" in
14772	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14773	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14774	esac
14775	case "$getpwent_r_proto" in
14776	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14777	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14778	esac
14779	case "$getpwent_r_proto" in
14780	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14781	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14782	esac
14783	case "$getpwent_r_proto" in
14784	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14785	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14786	esac
14787	case "$getpwent_r_proto" in
14788	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14789	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14790	esac
14791	case "$getpwent_r_proto" in
14792	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14793	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14794	esac
14795	case "$getpwent_r_proto" in
14796	''|0)	d_getpwent_r=undef
14797 	        getpwent_r_proto=0
14798		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14799	* )	case "$getpwent_r_proto" in
14800		REENTRANT_PROTO*) ;;
14801		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14802		esac
14803		echo "Prototype: $try" ;;
14804	esac
14805	;;
14806	*)	case "$usethreads" in
14807		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14808		esac
14809		d_getpwent_r=undef
14810		getpwent_r_proto=0
14811		;;
14812	esac
14813	;;
14814*)	getpwent_r_proto=0
14815	;;
14816esac
14817
14818: see if getpwnam_r exists
14819set getpwnam_r d_getpwnam_r
14820eval $inlibc
14821case "$d_getpwnam_r" in
14822"$define")
14823	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14824	case "$d_getpwnam_r_proto:$usethreads" in
14825	":define")	d_getpwnam_r_proto=define
14826		set d_getpwnam_r_proto getpwnam_r $hdrs
14827		eval $hasproto ;;
14828	*)	;;
14829	esac
14830	case "$d_getpwnam_r_proto" in
14831	define)
14832	case "$getpwnam_r_proto" in
14833	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14834	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14835	esac
14836	case "$getpwnam_r_proto" in
14837	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14838	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14839	esac
14840	case "$getpwnam_r_proto" in
14841	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14842	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14843	esac
14844	case "$getpwnam_r_proto" in
14845	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14846	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14847	esac
14848	case "$getpwnam_r_proto" in
14849	''|0)	d_getpwnam_r=undef
14850 	        getpwnam_r_proto=0
14851		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14852	* )	case "$getpwnam_r_proto" in
14853		REENTRANT_PROTO*) ;;
14854		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14855		esac
14856		echo "Prototype: $try" ;;
14857	esac
14858	;;
14859	*)	case "$usethreads" in
14860		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14861		esac
14862		d_getpwnam_r=undef
14863		getpwnam_r_proto=0
14864		;;
14865	esac
14866	;;
14867*)	getpwnam_r_proto=0
14868	;;
14869esac
14870
14871: see if getpwuid_r exists
14872set getpwuid_r d_getpwuid_r
14873eval $inlibc
14874case "$d_getpwuid_r" in
14875"$define")
14876	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14877	case "$d_getpwuid_r_proto:$usethreads" in
14878	":define")	d_getpwuid_r_proto=define
14879		set d_getpwuid_r_proto getpwuid_r $hdrs
14880		eval $hasproto ;;
14881	*)	;;
14882	esac
14883	case "$d_getpwuid_r_proto" in
14884	define)
14885	case "$getpwuid_r_proto" in
14886	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14887	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14888	esac
14889	case "$getpwuid_r_proto" in
14890	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14891	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14892	esac
14893	case "$getpwuid_r_proto" in
14894	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14895	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14896	esac
14897	case "$getpwuid_r_proto" in
14898	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14899	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14900	esac
14901	case "$getpwuid_r_proto" in
14902	''|0)	d_getpwuid_r=undef
14903 	        getpwuid_r_proto=0
14904		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14905	* )	case "$getpwuid_r_proto" in
14906		REENTRANT_PROTO*) ;;
14907		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14908		esac
14909		echo "Prototype: $try" ;;
14910	esac
14911	;;
14912	*)	case "$usethreads" in
14913		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14914		esac
14915		d_getpwuid_r=undef
14916		getpwuid_r_proto=0
14917		;;
14918	esac
14919	;;
14920*)	getpwuid_r_proto=0
14921	;;
14922esac
14923
14924: Optional checks for getsbyname and getsbyport
14925
14926: see if getservbyname exists
14927set getservbyname d_getsbyname
14928eval $inlibc
14929
14930: see if getservbyport exists
14931set getservbyport d_getsbyport
14932eval $inlibc
14933
14934: see if getservent exists
14935set getservent d_getsent
14936eval $inlibc
14937
14938: see if getservbyname_r exists
14939set getservbyname_r d_getservbyname_r
14940eval $inlibc
14941case "$d_getservbyname_r" in
14942"$define")
14943	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14944	case "$d_getservbyname_r_proto:$usethreads" in
14945	":define")	d_getservbyname_r_proto=define
14946		set d_getservbyname_r_proto getservbyname_r $hdrs
14947		eval $hasproto ;;
14948	*)	;;
14949	esac
14950	case "$d_getservbyname_r_proto" in
14951	define)
14952	case "$getservbyname_r_proto" in
14953	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14954	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14955	esac
14956	case "$getservbyname_r_proto" in
14957	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14958	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14959	esac
14960	case "$getservbyname_r_proto" in
14961	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14962	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14963	esac
14964	case "$getservbyname_r_proto" in
14965	''|0)	d_getservbyname_r=undef
14966 	        getservbyname_r_proto=0
14967		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14968	* )	case "$getservbyname_r_proto" in
14969		REENTRANT_PROTO*) ;;
14970		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14971		esac
14972		echo "Prototype: $try" ;;
14973	esac
14974	;;
14975	*)	case "$usethreads" in
14976		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14977		esac
14978		d_getservbyname_r=undef
14979		getservbyname_r_proto=0
14980		;;
14981	esac
14982	;;
14983*)	getservbyname_r_proto=0
14984	;;
14985esac
14986
14987: see if getservbyport_r exists
14988set getservbyport_r d_getservbyport_r
14989eval $inlibc
14990case "$d_getservbyport_r" in
14991"$define")
14992	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14993	case "$d_getservbyport_r_proto:$usethreads" in
14994	":define")	d_getservbyport_r_proto=define
14995		set d_getservbyport_r_proto getservbyport_r $hdrs
14996		eval $hasproto ;;
14997	*)	;;
14998	esac
14999	case "$d_getservbyport_r_proto" in
15000	define)
15001	case "$getservbyport_r_proto" in
15002	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15003	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15004	esac
15005	case "$getservbyport_r_proto" in
15006	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15007	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15008	esac
15009	case "$getservbyport_r_proto" in
15010	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15011	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15012	esac
15013	case "$getservbyport_r_proto" in
15014	''|0)	d_getservbyport_r=undef
15015 	        getservbyport_r_proto=0
15016		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15017	* )	case "$getservbyport_r_proto" in
15018		REENTRANT_PROTO*) ;;
15019		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15020		esac
15021		echo "Prototype: $try" ;;
15022	esac
15023	;;
15024	*)	case "$usethreads" in
15025		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15026		esac
15027		d_getservbyport_r=undef
15028		getservbyport_r_proto=0
15029		;;
15030	esac
15031	;;
15032*)	getservbyport_r_proto=0
15033	;;
15034esac
15035
15036: see if getservent_r exists
15037set getservent_r d_getservent_r
15038eval $inlibc
15039case "$d_getservent_r" in
15040"$define")
15041	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15042	case "$d_getservent_r_proto:$usethreads" in
15043	":define")	d_getservent_r_proto=define
15044		set d_getservent_r_proto getservent_r $hdrs
15045		eval $hasproto ;;
15046	*)	;;
15047	esac
15048	case "$d_getservent_r_proto" in
15049	define)
15050	case "$getservent_r_proto" in
15051	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15052	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15053	esac
15054	case "$getservent_r_proto" in
15055	''|0) try='int getservent_r(struct servent*, char*, int);'
15056	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15057	esac
15058	case "$getservent_r_proto" in
15059	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15060	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15061	esac
15062	case "$getservent_r_proto" in
15063	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15064	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15065	esac
15066	case "$getservent_r_proto" in
15067	''|0)	d_getservent_r=undef
15068 	        getservent_r_proto=0
15069		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15070	* )	case "$getservent_r_proto" in
15071		REENTRANT_PROTO*) ;;
15072		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15073		esac
15074		echo "Prototype: $try" ;;
15075	esac
15076	;;
15077	*)	case "$usethreads" in
15078		define) echo "getservent_r has no prototype, not using it." >&4 ;;
15079		esac
15080		d_getservent_r=undef
15081		getservent_r_proto=0
15082		;;
15083	esac
15084	;;
15085*)	getservent_r_proto=0
15086	;;
15087esac
15088
15089: see if prototypes for various getservxxx netdb.h functions are available
15090echo " "
15091set d_getservprotos getservent $i_netdb netdb.h
15092eval $hasproto
15093
15094: see if getspnam exists
15095set getspnam d_getspnam
15096eval $inlibc
15097
15098: see if this is a shadow.h system
15099set shadow.h i_shadow
15100eval $inhdr
15101
15102: see if getspnam_r exists
15103set getspnam_r d_getspnam_r
15104eval $inlibc
15105case "$d_getspnam_r" in
15106"$define")
15107	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15108	case "$d_getspnam_r_proto:$usethreads" in
15109	":define")	d_getspnam_r_proto=define
15110		set d_getspnam_r_proto getspnam_r $hdrs
15111		eval $hasproto ;;
15112	*)	;;
15113	esac
15114	case "$d_getspnam_r_proto" in
15115	define)
15116	case "$getspnam_r_proto" in
15117	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15118	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15119	esac
15120	case "$getspnam_r_proto" in
15121	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15122	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15123	esac
15124	case "$getspnam_r_proto" in
15125	''|0)	d_getspnam_r=undef
15126 	        getspnam_r_proto=0
15127		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15128	* )	case "$getspnam_r_proto" in
15129		REENTRANT_PROTO*) ;;
15130		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15131		esac
15132		echo "Prototype: $try" ;;
15133	esac
15134	;;
15135	*)	case "$usethreads" in
15136		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15137		esac
15138		d_getspnam_r=undef
15139		getspnam_r_proto=0
15140		;;
15141	esac
15142	;;
15143*)	getspnam_r_proto=0
15144	;;
15145esac
15146
15147: see if gettimeofday or ftime exists
15148set gettimeofday d_gettimeod
15149eval $inlibc
15150case "$d_gettimeod" in
15151"$undef")
15152	set ftime d_ftime
15153	eval $inlibc
15154	;;
15155*)
15156	val="$undef"; set d_ftime; eval $setvar
15157	;;
15158esac
15159case "$d_gettimeod$d_ftime" in
15160"$undef$undef")
15161	echo " "
15162	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15163	;;
15164esac
15165
15166: see if gmtime_r exists
15167set gmtime_r d_gmtime_r
15168eval $inlibc
15169case "$d_gmtime_r" in
15170"$define")
15171	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15172	case "$d_gmtime_r_proto:$usethreads" in
15173	":define")	d_gmtime_r_proto=define
15174		set d_gmtime_r_proto gmtime_r $hdrs
15175		eval $hasproto ;;
15176	*)	;;
15177	esac
15178	case "$d_gmtime_r_proto" in
15179	define)
15180	case "$gmtime_r_proto" in
15181	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15182	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15183	esac
15184	case "$gmtime_r_proto" in
15185	''|0) try='int gmtime_r(const time_t*, struct tm*);'
15186	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15187	esac
15188	case "$gmtime_r_proto" in
15189	''|0)	d_gmtime_r=undef
15190 	        gmtime_r_proto=0
15191		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15192	* )	case "$gmtime_r_proto" in
15193		REENTRANT_PROTO*) ;;
15194		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15195		esac
15196		echo "Prototype: $try" ;;
15197	esac
15198	;;
15199	*)	case "$usethreads" in
15200		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15201		esac
15202		d_gmtime_r=undef
15203		gmtime_r_proto=0
15204		;;
15205	esac
15206	;;
15207*)	gmtime_r_proto=0
15208	;;
15209esac
15210
15211: see if hasmntopt exists
15212set hasmntopt d_hasmntopt
15213eval $inlibc
15214
15215: see if this is a netinet/in.h or sys/in.h system
15216set netinet/in.h i_niin sys/in.h i_sysin
15217eval $inhdr
15218
15219: see if arpa/inet.h has to be included
15220set arpa/inet.h i_arpainet
15221eval $inhdr
15222
15223: see if htonl --and friends-- exists
15224val=''
15225set htonl val
15226eval $inlibc
15227
15228: Maybe they are macros.
15229case "$val" in
15230$undef)
15231	$cat >htonl.c <<EOM
15232#include <stdio.h>
15233#include <sys/types.h>
15234#$i_niin I_NETINET_IN
15235#$i_sysin I_SYS_IN
15236#$i_arpainet I_ARPA_INET
15237#ifdef I_NETINET_IN
15238#include <netinet/in.h>
15239#endif
15240#ifdef I_SYS_IN
15241#include <sys/in.h>
15242#endif
15243#ifdef I_ARPA_INET
15244#include <arpa/inet.h>
15245#endif
15246#ifdef htonl
15247printf("Defined as a macro.");
15248#endif
15249EOM
15250	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15251	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15252		val="$define"
15253		echo "But it seems to be defined as a macro." >&4
15254	fi
15255	$rm -f htonl.?
15256	;;
15257esac
15258set d_htonl
15259eval $setvar
15260
15261: see if ilogbl exists
15262set ilogbl d_ilogbl
15263eval $inlibc
15264
15265: index or strchr
15266echo " "
15267if set index val -f; eval $csym; $val; then
15268	if set strchr val -f d_strchr; eval $csym; $val; then
15269		if $contains strchr "$strings" >/dev/null 2>&1 ; then
15270			val="$define"
15271			vali="$undef"
15272			echo "strchr() found." >&4
15273		else
15274			val="$undef"
15275			vali="$define"
15276			echo "index() found." >&4
15277		fi
15278	else
15279		val="$undef"
15280		vali="$define"
15281		echo "index() found." >&4
15282	fi
15283else
15284	if set strchr val -f d_strchr; eval $csym; $val; then
15285		val="$define"
15286		vali="$undef"
15287		echo "strchr() found." >&4
15288	else
15289		echo "No index() or strchr() found!" >&4
15290		val="$undef"
15291		vali="$undef"
15292	fi
15293fi
15294set d_strchr; eval $setvar
15295val="$vali"
15296set d_index; eval $setvar
15297
15298: check whether inet_aton exists
15299set inet_aton d_inetaton
15300eval $inlibc
15301
15302: see if inet_ntop exists
15303set inet_ntop d_inetntop
15304eval $inlibc
15305
15306: see if inet_pton exists
15307set inet_pton d_inetpton
15308eval $inlibc
15309
15310: Look for isascii
15311echo " "
15312$cat >isascii.c <<EOCP
15313#include <stdio.h>
15314#include <ctype.h>
15315#$i_stdlib I_STDLIB
15316#ifdef I_STDLIB
15317#include <stdlib.h>
15318#endif
15319int main() {
15320	int c = 'A';
15321	if (isascii(c))
15322		exit(0);
15323	else
15324		exit(1);
15325}
15326EOCP
15327set isascii
15328if eval $compile; then
15329	echo "isascii() found." >&4
15330	val="$define"
15331else
15332	echo "isascii() NOT found." >&4
15333	val="$undef"
15334fi
15335set d_isascii
15336eval $setvar
15337$rm -f isascii*
15338
15339: Look for isblank
15340echo " "
15341$cat >isblank.c <<'EOCP'
15342#include <stdio.h>
15343#include <ctype.h>
15344int main() {
15345	int c = ' ';
15346	if (isblank(c))
15347		return 0 ;
15348	else
15349		return 1 ;
15350}
15351EOCP
15352if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15353	echo "isblank() found." >&4
15354	val="$define"
15355else
15356	echo "isblank() NOT found." >&4
15357	val="$undef"
15358fi
15359set d_isblank
15360eval $setvar
15361$rm -f isblank*
15362
15363: see if isfinite exists
15364set isfinite d_isfinite
15365eval $inlibc
15366
15367: see if isinf exists
15368set isinf d_isinf
15369eval $inlibc
15370
15371: see if isnan exists
15372set isnan d_isnan
15373eval $inlibc
15374
15375: see if isnanl exists
15376set isnanl d_isnanl
15377eval $inlibc
15378
15379: see if killpg exists
15380set killpg d_killpg
15381eval $inlibc
15382
15383: see if lchown exists
15384echo " "
15385$cat > try.c <<'EOCP'
15386/* System header to define __stub macros and hopefully few prototypes,
15387    which can conflict with char lchown(); below.  */
15388#include <assert.h>
15389/* Override any gcc2 internal prototype to avoid an error.  */
15390/* We use char because int might match the return type of a gcc2
15391   builtin and then its argument prototype would still apply.  */
15392char lchown();
15393int main() {
15394    /*  The GNU C library defines this for functions which it implements
15395        to always fail with ENOSYS.  Some functions are actually named
15396	something starting with __ and the normal name is an alias.  */
15397#if defined (__stub_lchown) || defined (__stub___lchown)
15398choke me
15399#else
15400lchown();
15401#endif
15402; return 0; }
15403EOCP
15404set try
15405if eval $compile; then
15406    $echo "lchown() found." >&4
15407    val="$define"
15408else
15409    $echo "lchown() NOT found." >&4
15410    val="$undef"
15411fi
15412set d_lchown
15413eval $setvar
15414
15415: See if number of significant digits in a double precision number is known
15416echo " "
15417$cat >ldbl_dig.c <<EOM
15418#$i_limits I_LIMITS
15419#$i_float I_FLOAT
15420#ifdef I_LIMITS
15421#include <limits.h>
15422#endif
15423#ifdef I_FLOAT
15424#include <float.h>
15425#endif
15426#ifdef LDBL_DIG
15427printf("Contains LDBL_DIG");
15428#endif
15429EOM
15430$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15431if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15432	echo "LDBL_DIG found." >&4
15433	val="$define"
15434else
15435	echo "LDBL_DIG NOT found." >&4
15436	val="$undef"
15437fi
15438$rm -f ldbl_dig.?
15439set d_ldbl_dig
15440eval $setvar
15441
15442: see if this is a math.h system
15443set math.h i_math
15444eval $inhdr
15445
15446: check to see if math.h defines _LIB_VERSION
15447d_libm_lib_version="$undef"
15448case $i_math in
15449    $define)
15450	echo " "
15451	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15452	$cat >try.c <<EOCP
15453#include <unistd.h>
15454#include <math.h>
15455int main (int argc, char *argv[])
15456{
15457    printf ("%d\n", _LIB_VERSION);
15458    return (0);
15459    } /* main */
15460EOCP
15461	set try
15462	if eval $compile; then
15463	    foo=`$run ./try`
15464	    echo "Yes, it does ($foo)" >&4
15465	    d_libm_lib_version="$define"
15466	else
15467	    echo "No, it does not (probably harmless)" >&4
15468	    fi
15469	$rm_try
15470	;;
15471
15472    esac
15473
15474: see if link exists
15475set link d_link
15476eval $inlibc
15477
15478: see if localtime_r exists
15479set localtime_r d_localtime_r
15480eval $inlibc
15481case "$d_localtime_r" in
15482"$define")
15483	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15484	case "$d_localtime_r_proto:$usethreads" in
15485	":define")	d_localtime_r_proto=define
15486		set d_localtime_r_proto localtime_r $hdrs
15487		eval $hasproto ;;
15488	*)	;;
15489	esac
15490	case "$d_localtime_r_proto" in
15491	define)
15492	case "$localtime_r_proto" in
15493	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15494	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15495	esac
15496	case "$localtime_r_proto" in
15497	''|0) try='int localtime_r(const time_t*, struct tm*);'
15498	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15499	esac
15500	case "$localtime_r_proto" in
15501	''|0)	d_localtime_r=undef
15502 	        localtime_r_proto=0
15503		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15504	* )	case "$localtime_r_proto" in
15505		REENTRANT_PROTO*) ;;
15506		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15507		esac
15508		echo "Prototype: $try" ;;
15509	esac
15510	;;
15511	*)	case "$usethreads" in
15512		define) echo "localtime_r has no prototype, not using it." >&4 ;;
15513		esac
15514		d_localtime_r=undef
15515		localtime_r_proto=0
15516		;;
15517	esac
15518	;;
15519*)	localtime_r_proto=0
15520	;;
15521esac
15522
15523: see if localtime_r calls tzset
15524case "$localtime_r_proto" in
15525REENTRANT_PROTO*)
15526	$cat >try.c <<EOCP
15527/*  Does our libc's localtime_r call tzset ?
15528 *  return 0 if so, 1 otherwise.
15529 */
15530#$i_systypes	I_SYS_TYPES
15531#$i_unistd	I_UNISTD
15532#$i_time	I_TIME
15533#$i_stdlib	I_STDLIB
15534#$i_string	I_STRING
15535#$i_malloc	I_MALLOC
15536#ifdef I_SYS_TYPES
15537#  include <sys/types.h>
15538#endif
15539#ifdef I_UNISTD
15540#  include <unistd.h>
15541#endif
15542#ifdef I_TIME
15543#  include <time.h>
15544#endif
15545#ifdef I_STDLIB
15546#include <stdlib.h>
15547#endif
15548#ifdef I_STRING
15549#  include <string.h>
15550#else
15551#  include <strings.h>
15552#endif
15553#ifdef I_MALLOC
15554#  include <malloc.h>
15555#endif
15556int main()
15557{
15558    time_t t = time(0L);
15559    char w_tz[]="TZ" "=GMT+5",
15560	 e_tz[]="TZ" "=GMT-5",
15561	*tz_e = (char*)malloc(16),
15562	*tz_w = (char*)malloc(16);
15563    struct tm tm_e, tm_w;
15564    memset(&tm_e,'\0',sizeof(struct tm));
15565    memset(&tm_w,'\0',sizeof(struct tm));
15566    strcpy(tz_e,e_tz);
15567    strcpy(tz_w,w_tz);
15568
15569    putenv(tz_e);
15570    localtime_r(&t, &tm_e);
15571
15572    putenv(tz_w);
15573    localtime_r(&t, &tm_w);
15574
15575    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15576	return 1;
15577    return 0;
15578}
15579EOCP
15580	set try
15581	if eval $compile; then
15582	    if $run ./try; then
15583		d_localtime_r_needs_tzset=undef;
15584	    else
15585		d_localtime_r_needs_tzset=define;
15586	    fi;
15587	else
15588	    d_localtime_r_needs_tzset=undef;
15589	fi;
15590     ;;
15591  *)
15592     d_localtime_r_needs_tzset=undef;
15593     ;;
15594esac
15595$rm_try
15596
15597: see if localeconv exists
15598set localeconv d_locconv
15599eval $inlibc
15600
15601: see if localtime_r calls tzset
15602case "$d_locconv:$d_lc_monetary_2008" in
15603define:)
15604	$cat >try.c <<EOCP
15605#include <locale.h>
15606int main() {
15607	struct lconv *lc = localeconv();
15608	char int_p_cs_precedes = lc->int_p_cs_precedes;
15609	return 0;
15610}
15611EOCP
15612	set try
15613	if eval $compile; then
15614		d_lc_monetary_2008="$define"
15615	else
15616		d_lc_monetary_2008="$undef"
15617	fi;
15618	$rm_try
15619	;;
15620esac
15621
15622: see if lockf exists
15623set lockf d_lockf
15624eval $inlibc
15625
15626: see if prototype for lseek is available
15627echo " "
15628set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15629eval $hasproto
15630
15631: see if lstat exists
15632set lstat d_lstat
15633eval $inlibc
15634
15635: see if madvise exists
15636set madvise d_madvise
15637eval $inlibc
15638
15639: see if malloc_size exists
15640set malloc_size d_malloc_size
15641eval $inlibc
15642
15643: see if malloc_size_good exists
15644set malloc_good_size d_malloc_good_size
15645eval $inlibc
15646
15647: see if mblen exists
15648set mblen d_mblen
15649eval $inlibc
15650
15651: see if mbstowcs exists
15652set mbstowcs d_mbstowcs
15653eval $inlibc
15654
15655: see if mbtowc exists
15656set mbtowc d_mbtowc
15657eval $inlibc
15658
15659: see if memchr exists
15660set memchr d_memchr
15661eval $inlibc
15662
15663: see if memcmp exists
15664set memcmp d_memcmp
15665eval $inlibc
15666
15667: see if memcpy exists
15668set memcpy d_memcpy
15669eval $inlibc
15670
15671: see if memmove exists
15672set memmove d_memmove
15673eval $inlibc
15674
15675: see if memset exists
15676set memset d_memset
15677eval $inlibc
15678
15679: see if mkdir exists
15680set mkdir d_mkdir
15681eval $inlibc
15682
15683: see if mkdtemp exists
15684set mkdtemp d_mkdtemp
15685eval $inlibc
15686
15687: see if mkfifo exists
15688set mkfifo d_mkfifo
15689eval $inlibc
15690
15691: see if mkstemp exists
15692set mkstemp d_mkstemp
15693eval $inlibc
15694
15695: see if mkstemps exists
15696set mkstemps d_mkstemps
15697eval $inlibc
15698
15699: see if mktime exists
15700set mktime d_mktime
15701eval $inlibc
15702
15703: see if this is a sys/mman.h system
15704set sys/mman.h i_sysmman
15705eval $inhdr
15706
15707: see if mmap exists
15708set mmap d_mmap
15709eval $inlibc
15710: see what shmat returns
15711: default to something harmless
15712mmaptype='void *'
15713case "$i_sysmman$d_mmap" in
15714"$define$define")
15715	$cat >mmap.c <<'END'
15716#include <sys/mman.h>
15717void *mmap();
15718END
15719	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15720		mmaptype='void *'
15721	else
15722		mmaptype='caddr_t'
15723	fi
15724	echo "and it returns ($mmaptype)." >&4
15725	;;
15726esac
15727
15728
15729
15730: see if sqrtl exists
15731set sqrtl d_sqrtl
15732eval $inlibc
15733
15734: see if scalbnl exists
15735set scalbnl d_scalbnl
15736eval $inlibc
15737
15738: see if modfl exists
15739set modfl d_modfl
15740eval $inlibc
15741
15742: see if prototype for modfl is available
15743echo " "
15744set d_modflproto modfl $i_math math.h
15745eval $hasproto
15746
15747d_modfl_pow32_bug="$undef"
15748
15749case "$d_longdbl$d_modfl" in
15750$define$define)
15751	$cat <<EOM
15752Checking to see whether your modfl() is okay for large values...
15753EOM
15754$cat >try.c <<EOCP
15755#include <math.h>
15756#include <stdio.h>
15757EOCP
15758if $test "X$d_modflproto" != "X$define"; then
15759	$cat >>try.c <<EOCP
15760/* Sigh. many current glibcs provide the function, but do not prototype it. */
15761long double modfl (long double, long double *);
15762EOCP
15763fi
15764$cat >>try.c <<EOCP
15765int main() {
15766    long double nv = 4294967303.15;
15767    long double v, w;
15768    v = modfl(nv, &w);
15769#ifdef __GLIBC__
15770    printf("glibc");
15771#endif
15772    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15773    return 0;
15774}
15775EOCP
15776	case "$osname:$gccversion" in
15777	aix:)	saveccflags="$ccflags"
15778		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15779	esac
15780	set try
15781	if eval $compile; then
15782		foo=`$run ./try`
15783		case "$foo" in
15784		*" 4294967303.150000 1.150000 4294967302.000000")
15785			echo >&4 "Your modfl() is broken for large values."
15786			d_modfl_pow32_bug="$define"
15787			case "$foo" in
15788			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15789			;;
15790			esac
15791			;;
15792		*" 4294967303.150000 0.150000 4294967303.000000")
15793			echo >&4 "Your modfl() seems okay for large values."
15794			;;
15795		*)	echo >&4 "I don't understand your modfl() at all."
15796			d_modfl="$undef"
15797			;;
15798		esac
15799		$rm_try
15800	else
15801		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15802		d_modfl="$undef"
15803	fi
15804	case "$osname:$gccversion" in
15805	aix:)	ccflags="$saveccflags" ;; # restore
15806	esac
15807	;;
15808esac
15809
15810if $test "$uselongdouble" = "$define"; then
15811    message=""
15812    if $test "$d_sqrtl" != "$define"; then
15813	message="$message sqrtl"
15814    fi
15815    if $test "$d_modfl" != "$define"; then
15816	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15817	    echo "You have both aintl and copysignl, so I can emulate modfl."
15818	else
15819	    message="$message modfl"
15820	fi
15821    fi
15822    if $test "$d_frexpl" != "$define"; then
15823	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15824	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15825	else
15826	    message="$message frexpl"
15827	fi
15828    fi
15829
15830    if $test "$message" != ""; then
15831	$cat <<EOM >&4
15832
15833*** You requested the use of long doubles but you do not seem to have
15834*** the following mathematical functions needed for long double support:
15835***    $message
15836*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15837*** Cannot continue, aborting.
15838
15839EOM
15840
15841	exit 1
15842    fi
15843fi
15844
15845: see if mprotect exists
15846set mprotect d_mprotect
15847eval $inlibc
15848
15849: see if msgctl exists
15850set msgctl d_msgctl
15851eval $inlibc
15852
15853: see if msgget exists
15854set msgget d_msgget
15855eval $inlibc
15856
15857: see if msgsnd exists
15858set msgsnd d_msgsnd
15859eval $inlibc
15860
15861: see if msgrcv exists
15862set msgrcv d_msgrcv
15863eval $inlibc
15864
15865: see how much of the 'msg*(2)' library is present.
15866h_msg=true
15867echo " "
15868case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15869*"$undef"*) h_msg=false;;
15870esac
15871case "$osname" in
15872freebsd)
15873    case "`ipcs 2>&1`" in
15874    "SVID messages"*"not configured"*)
15875	echo "Your $osname does not have the msg*(2) configured." >&4
15876        h_msg=false
15877	val="$undef"
15878	set msgctl d_msgctl
15879	eval $setvar
15880	set msgget d_msgget
15881	eval $setvar
15882	set msgsnd d_msgsnd
15883	eval $setvar
15884	set msgrcv d_msgrcv
15885	eval $setvar
15886	;;
15887    esac
15888    ;;
15889esac
15890: we could also check for sys/ipc.h ...
15891if $h_msg && $test `./findhdr sys/msg.h`; then
15892	echo "You have the full msg*(2) library." >&4
15893	val="$define"
15894else
15895	echo "You don't have the full msg*(2) library." >&4
15896	val="$undef"
15897fi
15898set d_msg
15899eval $setvar
15900
15901: Check for msghdr_s
15902echo " "
15903echo "Checking to see if your system supports struct msghdr..." >&4
15904set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15905eval $hasstruct
15906case "$d_msghdr_s" in
15907"$define")      echo "Yes, it does."   ;;
15908*)              echo "No, it doesn't." ;;
15909esac
15910
15911
15912: see if msync exists
15913set msync d_msync
15914eval $inlibc
15915
15916: see if munmap exists
15917set munmap d_munmap
15918eval $inlibc
15919
15920: see if nice exists
15921set nice d_nice
15922eval $inlibc
15923
15924: see if this is a langinfo.h system
15925set langinfo.h i_langinfo
15926eval $inhdr
15927
15928: see if nl_langinfo exists
15929set nl_langinfo d_nl_langinfo
15930eval $inlibc
15931
15932: check for volatile keyword
15933echo " "
15934echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15935$cat >try.c <<'EOCP'
15936int main()
15937{
15938	typedef struct _goo_struct goo_struct;
15939	goo_struct * volatile goo = ((goo_struct *)0);
15940	struct _goo_struct {
15941		long long_int;
15942		int reg_int;
15943		char char_var;
15944	};
15945	typedef unsigned short foo_t;
15946	char *volatile foo;
15947	volatile int bar;
15948	volatile foo_t blech;
15949	foo = foo;
15950}
15951EOCP
15952if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15953	val="$define"
15954	echo "Yup, it does."
15955else
15956	val="$undef"
15957	echo "Nope, it doesn't."
15958fi
15959set d_volatile
15960eval $setvar
15961$rm_try
15962
15963: Check basic sizes
15964echo " "
15965$echo "Choosing the C types to be used for Perl's internal types..." >&4
15966
15967case "$use64bitint:$d_quad:$quadtype" in
15968define:define:?*)
15969	ivtype="$quadtype"
15970	uvtype="$uquadtype"
15971	ivsize=8
15972	uvsize=8
15973	;;
15974*)	ivtype="long"
15975	uvtype="unsigned long"
15976	ivsize=$longsize
15977	uvsize=$longsize
15978	;;
15979esac
15980
15981case "$uselongdouble:$d_longdbl" in
15982define:define)
15983	nvtype="long double"
15984	nvsize=$longdblsize
15985	;;
15986*)	nvtype=double
15987	nvsize=$doublesize
15988	;;
15989esac
15990
15991$echo "(IV will be "$ivtype", $ivsize bytes)"
15992$echo "(UV will be "$uvtype", $uvsize bytes)"
15993$echo "(NV will be "$nvtype", $nvsize bytes)"
15994
15995$cat >try.c <<EOCP
15996#$i_inttypes I_INTTYPES
15997#ifdef I_INTTYPES
15998#include <inttypes.h>
15999#endif
16000#include <stdio.h>
16001int main() {
16002#ifdef INT8
16003   int8_t i =  INT8_MAX;
16004  uint8_t u = UINT8_MAX;
16005  printf("int8_t\n");
16006#endif
16007#ifdef INT16
16008   int16_t i =  INT16_MAX;
16009  uint16_t u = UINT16_MAX;
16010  printf("int16_t\n");
16011#endif
16012#ifdef INT32
16013   int32_t i =  INT32_MAX;
16014  uint32_t u = UINT32_MAX;
16015  printf("int32_t\n");
16016#endif
16017}
16018EOCP
16019
16020i8type="signed char"
16021u8type="unsigned char"
16022i8size=1
16023u8size=1
16024
16025case "$i16type" in
16026'')	case "$shortsize" in
16027	2)	i16type=short
16028		u16type="unsigned short"
16029		i16size=$shortsize
16030		u16size=$shortsize
16031		;;
16032	esac
16033	;;
16034esac
16035case "$i16type" in
16036'')	set try -DINT16
16037	if eval $compile; then
16038		case "`$run ./try`" in
16039		int16_t)
16040			i16type=int16_t
16041			u16type=uint16_t
16042			i16size=2
16043			u16size=2
16044			;;
16045		esac
16046	fi
16047	;;
16048esac
16049case "$i16type" in
16050'')	if $test $shortsize -ge 2; then
16051		i16type=short
16052		u16type="unsigned short"
16053		i16size=$shortsize
16054		u16size=$shortsize
16055	fi
16056	;;
16057esac
16058
16059case "$i32type" in
16060'')	case "$longsize" in
16061	4)	i32type=long
16062		u32type="unsigned long"
16063		i32size=$longsize
16064		u32size=$longsize
16065		;;
16066	*)	case "$intsize" in
16067		4)	i32type=int
16068			u32type="unsigned int"
16069			i32size=$intsize
16070			u32size=$intsize
16071			;;
16072		esac
16073		;;
16074	esac
16075	;;
16076esac
16077case "$i32type" in
16078'')	set try -DINT32
16079	if eval $compile; then
16080		case "`$run ./try`" in
16081		int32_t)
16082			i32type=int32_t
16083			u32type=uint32_t
16084			i32size=4
16085			u32size=4
16086			;;
16087		esac
16088	fi
16089	;;
16090esac
16091case "$i32type" in
16092'')	if $test $intsize -ge 4; then
16093		i32type=int
16094		u32type="unsigned int"
16095		i32size=$intsize
16096		u32size=$intsize
16097	fi
16098	;;
16099esac
16100
16101case "$i64type" in
16102'')	case "$d_quad:$quadtype" in
16103	define:?*)
16104		i64type="$quadtype"
16105		u64type="$uquadtype"
16106		i64size=8
16107		u64size=8
16108		;;
16109	esac
16110	;;
16111esac
16112
16113$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16114: volatile so that the compiler has to store it out to memory.
16115if test X"$d_volatile" = X"$define"; then
16116	volatile=volatile
16117fi
16118$cat <<EOP >try.c
16119#include <stdio.h>
16120#$i_stdlib I_STDLIB
16121#ifdef I_STDLIB
16122#include <stdlib.h>
16123#endif
16124#include <sys/types.h>
16125#include <signal.h>
16126#ifdef SIGFPE
16127$volatile int bletched = 0;
16128$signal_t blech(int s) { bletched = 1; }
16129#endif
16130int main() {
16131    $uvtype u = 0;
16132    $nvtype d;
16133    int     n = 8 * $uvsize;
16134    int     i;
16135#ifdef SIGFPE
16136    signal(SIGFPE, blech);
16137#endif
16138
16139    for (i = 0; i < n; i++) {
16140      u = u << 1 | ($uvtype)1;
16141      d = ($nvtype)u;
16142      if (($uvtype)d != u)
16143        break;
16144      if (d <= 0)
16145	break;
16146      d = ($nvtype)(u - 1);
16147      if (($uvtype)d != (u - 1))
16148        break;
16149#ifdef SIGFPE
16150      if (bletched)
16151	break;
16152#endif
16153    }
16154    printf("%d\n", ((i == n) ? -n : i));
16155    exit(0);
16156}
16157EOP
16158set try
16159
16160d_nv_preserves_uv="$undef"
16161if eval $compile; then
16162	nv_preserves_uv_bits="`$run ./try`"
16163fi
16164case "$nv_preserves_uv_bits" in
16165\-[1-9]*)
16166	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16167	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16168	d_nv_preserves_uv="$define"
16169	;;
16170[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16171	d_nv_preserves_uv="$undef" ;;
16172*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
16173	nv_preserves_uv_bits="0" ;;
16174esac
16175$rm_try
16176
16177$echo "Checking to find the largest integer value your NVs can hold..." >&4
16178: volatile so that the compiler has to store it out to memory.
16179if test X"$d_volatile" = X"$define"; then
16180	volatile=volatile
16181fi
16182$cat <<EOP >try.c
16183#include <stdio.h>
16184
16185typedef $nvtype NV;
16186
16187int
16188main() {
16189  NV value = 2;
16190  int count = 1;
16191
16192  while(count < 256) {
16193    $volatile NV up = value + 1.0;
16194    $volatile NV negated = -value;
16195    $volatile NV down = negated - 1.0;
16196    $volatile NV got_up = up - value;
16197    int up_good = got_up == 1.0;
16198    int got_down = down - negated;
16199    int down_good = got_down == -1.0;
16200
16201    if (down_good != up_good) {
16202      fprintf(stderr,
16203	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16204	      up_good, (double) got_up, down_good, (double) got_down,
16205	      count, (double) value);
16206      return 1;
16207    }
16208    if (!up_good) {
16209      while (1) {
16210	if (count > 8) {
16211	  count -= 8;
16212	  fputs("256.0", stdout);
16213	} else {
16214	  count--;
16215	  fputs("2.0", stdout);
16216	}
16217	if (!count) {
16218	  puts("");
16219	  return 0;
16220	}
16221	fputs("*", stdout);
16222      }
16223    }
16224    value *= 2;
16225    ++count;
16226  }
16227  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16228	  count, (double) value);
16229  return 1;
16230}
16231EOP
16232set try
16233
16234nv_overflows_integers_at='0'
16235if eval $compile; then
16236    xxx="`$run ./try`"
16237    case "$?" in
16238	0)
16239	    case "$xxx" in
16240		2*)  cat >&4 <<EOM
16241The largest integer your NVs can preserve is equal to $xxx
16242EOM
16243		    nv_overflows_integers_at="$xxx"
16244		    ;;
16245		*)  cat >&4 <<EOM
16246Cannot determine the largest integer value your NVs can hold, unexpected output
16247'$xxx'
16248EOM
16249		    ;;
16250	    esac
16251	    ;;
16252	*)  cat >&4 <<EOM
16253Cannot determine the largest integer value your NVs can hold
16254EOM
16255	    ;;
16256    esac
16257fi
16258$rm_try
16259
16260$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16261: volatile so that the compiler has to store it out to memory.
16262if test X"$d_volatile" = X"$define"; then
16263	volatile=volatile
16264fi
16265$cat <<EOP >try.c
16266#include <stdio.h>
16267#$i_stdlib I_STDLIB
16268#ifdef I_STDLIB
16269#include <stdlib.h>
16270#endif
16271#$i_string I_STRING
16272#ifdef I_STRING
16273#  include <string.h>
16274#else
16275#  include <strings.h>
16276#endif
16277#include <sys/types.h>
16278#include <signal.h>
16279#ifdef SIGFPE
16280$volatile int bletched = 0;
16281$signal_t blech(int s) { bletched = 1; }
16282#endif
16283
16284int checkit($nvtype d, char *where) {
16285    unsigned char *p = (char *)&d;
16286    unsigned char *end = p + sizeof(d);
16287    int fail = 0;
16288
16289    while (p < end)
16290	fail += *p++;
16291
16292    if (!fail)
16293	return 0;
16294
16295    p = (char *)&d;
16296    printf("No - %s: 0x", where);
16297    while (p < end)
16298	printf ("%02X", *p++);
16299    printf("\n");
16300    return 1;
16301}
16302
16303int main(int argc, char **argv) {
16304    $nvtype d = 0.0;
16305    int fail = 0;
16306    fail += checkit(d, "0.0");
16307
16308    /* The compiler shouldn't be assuming that bletched is 0  */
16309    d = bletched;
16310
16311    fail += checkit(d, "bleched");
16312
16313#ifdef SIGFPE
16314    signal(SIGFPE, blech);
16315#endif
16316
16317    /* Paranoia - the compiler should have no way of knowing that ANSI says
16318       that argv[argc] will always be NULL.  Actually, if it did assume this it
16319       would be buggy, as this is C and main() can be called from elsewhere in
16320       the program.  */
16321    d = argv[argc] ? 1 : 0;
16322
16323    if (d) {
16324	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16325    }
16326
16327    fail += checkit(d, "ternary");
16328
16329    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16330
16331    if (d != 0.0) {
16332	printf("No - memset doesn't give 0.0\n");
16333	/* This might just blow up:  */
16334	printf("(gives %g)\n", d);
16335	return 1;
16336    }
16337
16338#ifdef SIGFPE
16339    if (bletched) {
16340	printf("No - something bleched\n");
16341	return 1;
16342    }
16343#endif
16344    if (fail) {
16345      printf("No - %d fail(s)\n", fail);
16346      return 1;
16347    }
16348    printf("Yes\n");
16349    return 0;
16350}
16351EOP
16352set try
16353
16354d_nv_zero_is_allbits_zero="$undef"
16355if eval $compile; then
16356    xxx="`$run ./try`"
16357    case "$?" in
16358	0)
16359	    case "$xxx" in
16360		Yes)  cat >&4 <<EOM
163610.0 is represented as all bits zero in memory
16362EOM
16363		    d_nv_zero_is_allbits_zero="$define"
16364		    ;;
16365		*)  cat >&4 <<EOM
163660.0 is not represented as all bits zero in memory
16367EOM
16368		    d_nv_zero_is_allbits_zero="$undef"
16369		    ;;
16370	    esac
16371	    ;;
16372	*)  cat >&4 <<EOM
163730.0 is not represented as all bits zero in memory
16374EOM
16375	    d_nv_zero_is_allbits_zero="$undef"
16376	    ;;
16377    esac
16378fi
16379$rm_try
16380
16381: check for off64_t
16382echo " "
16383echo "Checking to see if you have off64_t..." >&4
16384$cat >try.c <<EOCP
16385#include <sys/types.h>
16386#include <unistd.h>
16387int main() { off64_t x = 7; }
16388EOCP
16389set try
16390if eval $compile; then
16391	val="$define"
16392	echo "You have off64_t."
16393else
16394	val="$undef"
16395	echo "You do not have off64_t."
16396	case "$lseeksize" in
16397	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16398	esac
16399fi
16400$rm_try
16401set d_off64_t
16402eval $setvar
16403
16404: how to create joinable pthreads
16405if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16406	echo " "
16407	echo "Checking what constant to use for creating joinable pthreads..." >&4
16408	$cat >try.c <<'EOCP'
16409#include <pthread.h>
16410int main() {
16411    int detachstate = JOINABLE;
16412}
16413EOCP
16414	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16415	if eval $compile; then
16416		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16417		val="$undef" # Yes, undef.
16418		set d_old_pthread_create_joinable
16419		eval $setvar
16420		val=""
16421		set old_pthread_create_joinable
16422		eval $setvar
16423	else
16424		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16425		if eval $compile; then
16426			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16427			val="$define"
16428			set d_old_pthread_create_joinable
16429			eval $setvar
16430			val=PTHREAD_CREATE_UNDETACHED
16431			set old_pthread_create_joinable
16432			eval $setvar
16433		else
16434			set try -DJOINABLE=__UNDETACHED
16435			if eval $compile; then
16436				echo "You seem to use __UNDETACHED." >&4
16437				val="$define"
16438				set d_old_pthread_create_joinable
16439				eval $setvar
16440				val=__UNDETACHED
16441				set old_pthread_create_joinable
16442				eval $setvar
16443			else
16444				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16445				val="$define"
16446				set d_old_pthread_create_joinable
16447				eval $setvar
16448				val=0
16449				set old_pthread_create_joinable
16450				eval $setvar
16451			fi
16452		fi
16453	fi
16454	$rm_try
16455else
16456    d_old_pthread_create_joinable="$undef"
16457    old_pthread_create_joinable=""
16458fi
16459
16460: see if pause exists
16461set pause d_pause
16462eval $inlibc
16463
16464: see if poll exists
16465set poll d_poll
16466eval $inlibc
16467
16468: see if prctl exists
16469set prctl d_prctl
16470eval $inlibc
16471
16472: see if prctl supports PR_SET_NAME
16473d_prctl_set_name=$undef
16474case $d_prctl in
16475    $define)
16476	$cat >try.c <<EOM
16477#include <sys/prctl.h>
16478
16479int main (int argc, char *argv[])
16480{
16481    return (prctl (PR_SET_NAME, "Test"));
16482    } /* main */
16483EOM
16484	set try
16485	if eval $compile_ok && $run ./try; then
16486	    echo "Your prctl (PR_SET_NAME, ...) works"
16487	    d_prctl_set_name=$define
16488	    fi
16489	$rm_try
16490	;;
16491    esac
16492
16493: see if readlink exists
16494set readlink d_readlink
16495eval $inlibc
16496
16497: Check if exe is symlink to abs path of executing program
16498echo " "
16499procselfexe=''
16500val="$undef"
16501case "$d_readlink" in
16502    "$define")
16503	: NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16504	: more tidy to avoid an extra level of symlink
16505	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16506	while test $# -gt 0; do
16507	    type=$1; try=$2
16508	    shift; shift
16509	    if $issymlink $try; then
16510		$ls -l $try > reflect
16511		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16512		    echo "You have $type-like $try."
16513		    procselfexe='"'$try'"'
16514		    val="$define"
16515		    : This will break out of the loop
16516		    set X; shift
16517		fi
16518	    fi
16519	done
16520	;;
16521esac
16522$rm -f reflect
16523set d_procselfexe
16524eval $setvar
16525
16526: backward compatibility for d_hvfork
16527if test X$d_hvfork != X; then
16528	d_vfork="$d_hvfork"
16529	d_hvfork=''
16530fi
16531: see if there is a vfork
16532val=''
16533set vfork val
16534eval $inlibc
16535
16536d_pseudofork=$undef
16537
16538: Ok, but do we want to use it. vfork is reportedly unreliable in
16539: perl on Solaris 2.x, and probably elsewhere.
16540case "$val" in
16541$define)
16542	echo " "
16543	case "$usevfork" in
16544	false) dflt='n';;
16545	*) dflt='y';;
16546	esac
16547	cat <<'EOM'
16548
16549Perl can only use a vfork() that doesn't suffer from strict
16550restrictions on calling functions or modifying global data in
16551the child.  For example, glibc-2.1 contains such a vfork()
16552that is unsuitable.  If your system provides a proper fork()
16553call, chances are that you do NOT want perl to use vfork().
16554
16555EOM
16556	rp="Do you still want to use vfork()?"
16557	. ./myread
16558	case "$ans" in
16559	y|Y) ;;
16560	*)
16561		echo "Ok, we won't use vfork()."
16562		val="$undef"
16563		;;
16564	esac
16565	;;
16566esac
16567set d_vfork
16568eval $setvar
16569case "$d_vfork" in
16570$define) usevfork='true';;
16571*) usevfork='false';;
16572esac
16573
16574: see whether the pthread_atfork exists
16575$cat >try.c <<EOP
16576#include <pthread.h>
16577#include <stdio.h>
16578int main() {
16579#ifdef  PTHREAD_ATFORK
16580        pthread_atfork(NULL,NULL,NULL);
16581#endif
16582}
16583EOP
16584
16585: see if pthread_atfork exists
16586set try -DPTHREAD_ATFORK
16587if eval $compile; then
16588    val="$define"
16589else
16590    val="$undef"
16591fi
16592case "$usethreads" in
16593$define)
16594        case "$val" in
16595        $define) echo 'pthread_atfork found.' >&4        ;;
16596        *)       echo 'pthread_atfork NOT found.' >&4    ;;
16597        esac
16598esac
16599set d_pthread_atfork
16600eval $setvar
16601
16602: see if pthread_attr_setscope exists
16603set pthread_attr_setscope d_pthread_attr_setscope
16604eval $inlibc
16605
16606: see whether the various POSIXish _yields exist
16607$cat >try.c <<EOP
16608#include <pthread.h>
16609#include <stdio.h>
16610int main() {
16611#ifdef SCHED_YIELD
16612	sched_yield();
16613#else
16614#ifdef PTHREAD_YIELD
16615	pthread_yield();
16616#else
16617#ifdef PTHREAD_YIELD_NULL
16618	pthread_yield(NULL);
16619#endif
16620#endif
16621#endif
16622}
16623EOP
16624: see if sched_yield exists
16625set try -DSCHED_YIELD
16626if eval $compile; then
16627    val="$define"
16628    sched_yield='sched_yield()'
16629else
16630    val="$undef"
16631fi
16632case "$usethreads" in
16633$define)
16634	case "$val" in
16635	$define) echo 'sched_yield() found.' >&4	;;
16636	*)	 echo 'sched_yield() NOT found.' >&4	;;
16637	esac
16638esac
16639set d_sched_yield
16640eval $setvar
16641
16642: see if pthread_yield exists
16643set try -DPTHREAD_YIELD
16644if eval $compile; then
16645    val="$define"
16646    case "$sched_yield" in
16647    '') sched_yield='pthread_yield()' ;;
16648    esac
16649else
16650    set try -DPTHREAD_YIELD_NULL
16651    if eval $compile; then
16652	val="$define"
16653	case "$sched_yield" in
16654	'') sched_yield='pthread_yield(NULL)' ;;
16655	esac
16656    else
16657	val="$undef"
16658    fi
16659fi
16660case "$usethreads" in
16661$define)
16662	case "$val" in
16663	$define) echo 'pthread_yield() found.' >&4	;;
16664	*)	 echo 'pthread_yield() NOT found.' >&4	;;
16665	esac
16666	;;
16667esac
16668set d_pthread_yield
16669eval $setvar
16670case "$sched_yield" in
16671'') sched_yield=undef ;;
16672esac
16673$rm_try
16674
16675: see if random_r exists
16676set random_r d_random_r
16677eval $inlibc
16678case "$d_random_r" in
16679"$define")
16680	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16681	case "$d_random_r_proto:$usethreads" in
16682	":define")	d_random_r_proto=define
16683		set d_random_r_proto random_r $hdrs
16684		eval $hasproto ;;
16685	*)	;;
16686	esac
16687	case "$d_random_r_proto" in
16688	define)
16689	case "$random_r_proto" in
16690	''|0) try='int random_r(int*, struct random_data*);'
16691	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16692	esac
16693	case "$random_r_proto" in
16694	''|0) try='int random_r(long*, struct random_data*);'
16695	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16696	esac
16697	case "$random_r_proto" in
16698	''|0) try='int random_r(struct random_data*, int32_t*);'
16699	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16700	esac
16701	case "$random_r_proto" in
16702	''|0)	d_random_r=undef
16703 	        random_r_proto=0
16704		echo "Disabling random_r, cannot determine prototype." >&4 ;;
16705	* )	case "$random_r_proto" in
16706		REENTRANT_PROTO*) ;;
16707		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16708		esac
16709		echo "Prototype: $try" ;;
16710	esac
16711	;;
16712	*)	case "$usethreads" in
16713		define) echo "random_r has no prototype, not using it." >&4 ;;
16714		esac
16715		d_random_r=undef
16716		random_r_proto=0
16717		;;
16718	esac
16719	;;
16720*)	random_r_proto=0
16721	;;
16722esac
16723
16724: see if readdir and friends exist
16725set readdir d_readdir
16726eval $inlibc
16727set seekdir d_seekdir
16728eval $inlibc
16729set telldir d_telldir
16730eval $inlibc
16731set rewinddir d_rewinddir
16732eval $inlibc
16733
16734: see if readdir64_r exists
16735set readdir64_r d_readdir64_r
16736eval $inlibc
16737case "$d_readdir64_r" in
16738"$define")
16739	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16740	case "$d_readdir64_r_proto:$usethreads" in
16741	":define")	d_readdir64_r_proto=define
16742		set d_readdir64_r_proto readdir64_r $hdrs
16743		eval $hasproto ;;
16744	*)	;;
16745	esac
16746	case "$d_readdir64_r_proto" in
16747	define)
16748	case "$readdir64_r_proto" in
16749	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16750	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16751	esac
16752	case "$readdir64_r_proto" in
16753	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16754	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16755	esac
16756	case "$readdir64_r_proto" in
16757	''|0)	d_readdir64_r=undef
16758 	        readdir64_r_proto=0
16759		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16760	* )	case "$readdir64_r_proto" in
16761		REENTRANT_PROTO*) ;;
16762		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16763		esac
16764		echo "Prototype: $try" ;;
16765	esac
16766	;;
16767	*)	case "$usethreads" in
16768		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16769		esac
16770		d_readdir64_r=undef
16771		readdir64_r_proto=0
16772		;;
16773	esac
16774	;;
16775*)	readdir64_r_proto=0
16776	;;
16777esac
16778
16779: see if readdir_r exists
16780set readdir_r d_readdir_r
16781eval $inlibc
16782case "$d_readdir_r" in
16783"$define")
16784	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16785	case "$d_readdir_r_proto:$usethreads" in
16786	":define")	d_readdir_r_proto=define
16787		set d_readdir_r_proto readdir_r $hdrs
16788		eval $hasproto ;;
16789	*)	;;
16790	esac
16791	case "$d_readdir_r_proto" in
16792	define)
16793	case "$readdir_r_proto" in
16794	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16795	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16796	esac
16797	case "$readdir_r_proto" in
16798	''|0) try='int readdir_r(DIR*, struct dirent*);'
16799	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16800	esac
16801	case "$readdir_r_proto" in
16802	''|0)	d_readdir_r=undef
16803 	        readdir_r_proto=0
16804		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16805	* )	case "$readdir_r_proto" in
16806		REENTRANT_PROTO*) ;;
16807		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16808		esac
16809		echo "Prototype: $try" ;;
16810	esac
16811	;;
16812	*)	case "$usethreads" in
16813		define) echo "readdir_r has no prototype, not using it." >&4 ;;
16814		esac
16815		d_readdir_r=undef
16816		readdir_r_proto=0
16817		;;
16818	esac
16819	;;
16820*)	readdir_r_proto=0
16821	;;
16822esac
16823
16824: see if readv exists
16825set readv d_readv
16826eval $inlibc
16827
16828: see if recvmsg exists
16829set recvmsg d_recvmsg
16830eval $inlibc
16831
16832: see if rename exists
16833set rename d_rename
16834eval $inlibc
16835
16836: see if rmdir exists
16837set rmdir d_rmdir
16838eval $inlibc
16839
16840: see if memory.h is available.
16841val=''
16842set memory.h val
16843eval $inhdr
16844
16845: See if it conflicts with string.h
16846case "$val" in
16847$define)
16848	case "$strings" in
16849	'') ;;
16850	*)
16851		$cppstdin $cppflags $cppminus < $strings > mem.h
16852		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16853			echo " "
16854			echo "We won't be including <memory.h>."
16855			val="$undef"
16856		fi
16857		$rm -f mem.h
16858		;;
16859	esac
16860esac
16861set i_memory
16862eval $setvar
16863
16864: can bcopy handle overlapping blocks?
16865echo " "
16866val="$undef"
16867case "$d_memmove" in
16868"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16869*)	case "$d_bcopy" in
16870	"$define")
16871		echo "Checking to see if bcopy() can do overlapping copies..." >&4
16872		$cat >try.c <<EOCP
16873#$i_memory I_MEMORY
16874#$i_stdlib I_STDLIB
16875#$i_string I_STRING
16876#$i_unistd I_UNISTD
16877EOCP
16878	$cat >>try.c <<'EOCP'
16879#include <stdio.h>
16880#ifdef I_MEMORY
16881#  include <memory.h>
16882#endif
16883#ifdef I_STDLIB
16884#  include <stdlib.h>
16885#endif
16886#ifdef I_STRING
16887#  include <string.h>
16888#else
16889#  include <strings.h>
16890#endif
16891#ifdef I_UNISTD
16892#  include <unistd.h>  /* Needed for NetBSD */
16893#endif
16894int main()
16895{
16896char buf[128], abc[128];
16897char *b;
16898int len;
16899int off;
16900int align;
16901
16902/* Copy "abcde..." string to char abc[] so that gcc doesn't
16903   try to store the string in read-only memory. */
16904bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16905
16906for (align = 7; align >= 0; align--) {
16907	for (len = 36; len; len--) {
16908		b = buf+align;
16909		bcopy(abc, b, len);
16910		for (off = 1; off <= len; off++) {
16911			bcopy(b, b+off, len);
16912			bcopy(b+off, b, len);
16913			if (bcmp(b, abc, len))
16914				exit(1);
16915		}
16916	}
16917}
16918exit(0);
16919}
16920EOCP
16921		set try
16922		if eval $compile_ok; then
16923			if $run ./try 2>/dev/null; then
16924				echo "Yes, it can."
16925				val="$define"
16926			else
16927				echo "It can't, sorry."
16928			fi
16929		else
16930			echo "(I can't compile the test program, so we'll assume not...)"
16931		fi
16932		;;
16933	esac
16934	$rm_try
16935	;;
16936esac
16937set d_safebcpy
16938eval $setvar
16939
16940: can memcpy handle overlapping blocks?
16941echo " "
16942val="$undef"
16943case "$d_memmove" in
16944"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16945*)	case "$d_memcpy" in
16946	"$define")
16947		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16948		$cat >try.c <<EOCP
16949#$i_memory I_MEMORY
16950#$i_stdlib I_STDLIB
16951#$i_string I_STRING
16952#$i_unistd I_UNISTD
16953EOCP
16954	$cat >>try.c <<'EOCP'
16955#include <stdio.h>
16956#ifdef I_MEMORY
16957#  include <memory.h>
16958#endif
16959#ifdef I_STDLIB
16960#  include <stdlib.h>
16961#endif
16962#ifdef I_STRING
16963#  include <string.h>
16964#else
16965#  include <strings.h>
16966#endif
16967#ifdef I_UNISTD
16968#  include <unistd.h>  /* Needed for NetBSD */
16969#endif
16970int main()
16971{
16972char buf[128], abc[128];
16973char *b;
16974int len;
16975int off;
16976int align;
16977
16978/* Copy "abcde..." string to char abc[] so that gcc doesn't
16979   try to store the string in read-only memory. */
16980memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16981
16982for (align = 7; align >= 0; align--) {
16983	for (len = 36; len; len--) {
16984		b = buf+align;
16985		memcpy(b, abc, len);
16986		for (off = 1; off <= len; off++) {
16987			memcpy(b+off, b, len);
16988			memcpy(b, b+off, len);
16989			if (memcmp(b, abc, len))
16990				exit(1);
16991		}
16992	}
16993}
16994exit(0);
16995}
16996EOCP
16997		set try
16998		if eval $compile_ok; then
16999			if $run ./try 2>/dev/null; then
17000				echo "Yes, it can."
17001				val="$define"
17002			else
17003				echo "It can't, sorry."
17004			fi
17005		else
17006			echo "(I can't compile the test program, so we'll assume not...)"
17007		fi
17008		;;
17009	esac
17010	$rm_try
17011	;;
17012esac
17013set d_safemcpy
17014eval $setvar
17015
17016: can memcmp be trusted to compare relative magnitude?
17017val="$undef"
17018case "$d_memcmp" in
17019"$define")
17020	echo " "
17021	echo "Checking if your memcmp() can compare relative magnitude..." >&4
17022	$cat >try.c <<EOCP
17023#$i_memory I_MEMORY
17024#$i_stdlib I_STDLIB
17025#$i_string I_STRING
17026#$i_unistd I_UNISTD
17027EOCP
17028	$cat >>try.c <<'EOCP'
17029#include <stdio.h>
17030#ifdef I_MEMORY
17031#  include <memory.h>
17032#endif
17033#ifdef I_STDLIB
17034#  include <stdlib.h>
17035#endif
17036#ifdef I_STRING
17037#  include <string.h>
17038#else
17039#  include <strings.h>
17040#endif
17041#ifdef I_UNISTD
17042#  include <unistd.h>  /* Needed for NetBSD */
17043#endif
17044int main()
17045{
17046char a = -1;
17047char b = 0;
17048if ((a < b) && memcmp(&a, &b, 1) < 0)
17049	exit(1);
17050exit(0);
17051}
17052EOCP
17053	set try
17054	if eval $compile_ok; then
17055		if $run ./try 2>/dev/null; then
17056			echo "Yes, it can."
17057			val="$define"
17058		else
17059			echo "No, it can't (it uses signed chars)."
17060		fi
17061	else
17062		echo "(I can't compile the test program, so we'll assume not...)"
17063	fi
17064	;;
17065esac
17066$rm_try
17067set d_sanemcmp
17068eval $setvar
17069
17070: see if prototype for sbrk is available
17071echo " "
17072set d_sbrkproto sbrk $i_unistd unistd.h
17073eval $hasproto
17074
17075: see if select exists
17076set select d_select
17077eval $inlibc
17078
17079: see if semctl exists
17080set semctl d_semctl
17081eval $inlibc
17082
17083: see if semget exists
17084set semget d_semget
17085eval $inlibc
17086
17087: see if semop exists
17088set semop d_semop
17089eval $inlibc
17090
17091: see how much of the 'sem*(2)' library is present.
17092h_sem=true
17093echo " "
17094case "$d_semctl$d_semget$d_semop" in
17095*"$undef"*) h_sem=false;;
17096esac
17097case "$osname" in
17098freebsd)
17099    case "`ipcs 2>&1`" in
17100    "SVID messages"*"not configured"*)
17101	echo "Your $osname does not have the sem*(2) configured." >&4
17102        h_sem=false
17103	val="$undef"
17104	set semctl d_semctl
17105	eval $setvar
17106	set semget d_semget
17107	eval $setvar
17108	set semop d_semop
17109	eval $setvar
17110	;;
17111    esac
17112    ;;
17113esac
17114: we could also check for sys/ipc.h ...
17115if $h_sem && $test `./findhdr sys/sem.h`; then
17116	echo "You have the full sem*(2) library." >&4
17117	val="$define"
17118else
17119	echo "You don't have the full sem*(2) library." >&4
17120	val="$undef"
17121fi
17122set d_sem
17123eval $setvar
17124
17125: see whether sys/sem.h defines union semun
17126echo " "
17127$cat > try.c <<'END'
17128#include <sys/types.h>
17129#include <sys/ipc.h>
17130#include <sys/sem.h>
17131int main () { union semun semun; semun.buf = 0; }
17132END
17133set try
17134if eval $compile; then
17135    echo "You have union semun in <sys/sem.h>." >&4
17136    val="$define"
17137else
17138    echo "You do not have union semun in <sys/sem.h>." >&4
17139    val="$undef"
17140fi
17141$rm_try
17142set d_union_semun
17143eval $setvar
17144
17145: see how to do semctl IPC_STAT
17146case "$d_sem" in
17147$define)
17148    echo " "
17149    $cat > tryh.h <<END
17150#ifndef S_IRUSR
17151#   ifdef S_IREAD
17152#	define S_IRUSR S_IREAD
17153#	define S_IWUSR S_IWRITE
17154#	define S_IXUSR S_IEXEC
17155#   else
17156#	define S_IRUSR 0400
17157#	define S_IWUSR 0200
17158#	define S_IXUSR 0100
17159#   endif
17160#   define S_IRGRP (S_IRUSR>>3)
17161#   define S_IWGRP (S_IWUSR>>3)
17162#   define S_IXGRP (S_IXUSR>>3)
17163#   define S_IROTH (S_IRUSR>>6)
17164#   define S_IWOTH (S_IWUSR>>6)
17165#   define S_IXOTH (S_IXUSR>>6)
17166#endif
17167#ifndef S_IRWXU
17168#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17169#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17170#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17171#endif
17172END
17173    : see whether semctl IPC_STAT can use union semun
17174    case "$d_semctl_semun" in
17175    '')
17176      val="$undef"
17177      $cat > try.c <<END
17178#include <sys/types.h>
17179#include <sys/ipc.h>
17180#include <sys/sem.h>
17181#include <sys/stat.h>
17182#include <stdio.h>
17183#include <errno.h>
17184#include "tryh.h"
17185#ifndef errno
17186extern int errno;
17187#endif
17188#$d_union_semun HAS_UNION_SEMUN
17189int main() {
17190    union semun
17191#ifndef HAS_UNION_SEMUN
17192    {
17193	int val;
17194	struct semid_ds *buf;
17195	unsigned short *array;
17196    }
17197#endif
17198    arg;
17199    int sem, st;
17200
17201#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17202    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17203    if (sem > -1) {
17204	struct semid_ds argbuf;
17205	arg.buf = &argbuf;
17206#	ifdef IPC_STAT
17207	st = semctl(sem, 0, IPC_STAT, arg);
17208	if (st == 0)
17209	    printf("semun\n");
17210	else
17211#	endif /* IPC_STAT */
17212	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17213#	ifdef IPC_RMID
17214	if (semctl(sem, 0, IPC_RMID, arg) != 0)
17215#	endif /* IPC_RMID */
17216	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17217    } else
17218#endif /* IPC_PRIVATE && ... */
17219	printf("semget failed: errno = %d\n", errno);
17220  return 0;
17221}
17222END
17223      set try
17224      if eval $compile; then
17225	  xxx=`$run ./try`
17226          case "$xxx" in
17227          semun) val="$define" ;;
17228          esac
17229      fi
17230      $rm_try
17231      set d_semctl_semun
17232      eval $setvar
17233      ;;
17234    esac
17235    case "$d_semctl_semun" in
17236    $define)
17237        echo "You can use union semun for semctl IPC_STAT." >&4
17238	also='also'
17239        ;;
17240    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17241	also=''
17242        ;;
17243    esac
17244
17245    : see whether semctl IPC_STAT can use struct semid_ds pointer
17246    case "$d_semctl_semid_ds" in
17247    '')
17248      val="$undef"
17249      $cat > try.c <<'END'
17250#include <sys/types.h>
17251#include <sys/ipc.h>
17252#include <sys/sem.h>
17253#include <sys/stat.h>
17254#include "tryh.h"
17255#include <stdio.h>
17256#include <errno.h>
17257#ifndef errno
17258extern int errno;
17259#endif
17260int main() {
17261    struct semid_ds arg;
17262    int sem, st;
17263
17264#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17265    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17266    if (sem > -1) {
17267#	ifdef IPC_STAT
17268	st = semctl(sem, 0, IPC_STAT, &arg);
17269	if (st == 0)
17270	    printf("semid_ds\n");
17271	else
17272#	endif /* IPC_STAT */
17273	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17274#	ifdef IPC_RMID
17275	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17276#	endif /* IPC_RMID */
17277	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17278    } else
17279#endif /* IPC_PRIVATE && ... */
17280	printf("semget failed: errno = %d\n", errno);
17281
17282    return 0;
17283}
17284END
17285      set try
17286      if eval $compile; then
17287          xxx=`$run ./try`
17288          case "$xxx" in
17289          semid_ds) val="$define" ;;
17290          esac
17291      fi
17292      $rm_try
17293      set d_semctl_semid_ds
17294      eval $setvar
17295      ;;
17296    esac
17297    case "$d_semctl_semid_ds" in
17298    $define)
17299        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17300        ;;
17301    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17302        ;;
17303    esac
17304    ;;
17305*)  val="$undef"
17306
17307    # We do not have the full sem*(2) library, so assume we can not
17308    # use either.
17309
17310    set d_semctl_semun
17311    eval $setvar
17312
17313    set d_semctl_semid_ds
17314    eval $setvar
17315    ;;
17316esac
17317$rm_try tryh.h
17318
17319: see if sendmsg exists
17320set sendmsg d_sendmsg
17321eval $inlibc
17322
17323: see if setegid exists
17324set setegid d_setegid
17325eval $inlibc
17326
17327: see if seteuid exists
17328set seteuid d_seteuid
17329eval $inlibc
17330
17331: see if setgrent exists
17332set setgrent d_setgrent
17333eval $inlibc
17334
17335: see if setgrent_r exists
17336set setgrent_r d_setgrent_r
17337eval $inlibc
17338case "$d_setgrent_r" in
17339"$define")
17340	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17341	case "$d_setgrent_r_proto:$usethreads" in
17342	":define")	d_setgrent_r_proto=define
17343		set d_setgrent_r_proto setgrent_r $hdrs
17344		eval $hasproto ;;
17345	*)	;;
17346	esac
17347	case "$d_setgrent_r_proto" in
17348	define)
17349	case "$setgrent_r_proto" in
17350	''|0) try='int setgrent_r(FILE**);'
17351	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17352	esac
17353	case "$setgrent_r_proto" in
17354	''|0) try='void setgrent_r(FILE**);'
17355	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17356	esac
17357	case "$setgrent_r_proto" in
17358	''|0)	d_setgrent_r=undef
17359 	        setgrent_r_proto=0
17360		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17361	* )	case "$setgrent_r_proto" in
17362		REENTRANT_PROTO*) ;;
17363		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17364		esac
17365		echo "Prototype: $try" ;;
17366	esac
17367	;;
17368	*)	case "$usethreads" in
17369		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17370		esac
17371		d_setgrent_r=undef
17372		setgrent_r_proto=0
17373		;;
17374	esac
17375	;;
17376*)	setgrent_r_proto=0
17377	;;
17378esac
17379
17380: see if sethostent exists
17381set sethostent d_sethent
17382eval $inlibc
17383
17384: see if sethostent_r exists
17385set sethostent_r d_sethostent_r
17386eval $inlibc
17387case "$d_sethostent_r" in
17388"$define")
17389	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17390	case "$d_sethostent_r_proto:$usethreads" in
17391	":define")	d_sethostent_r_proto=define
17392		set d_sethostent_r_proto sethostent_r $hdrs
17393		eval $hasproto ;;
17394	*)	;;
17395	esac
17396	case "$d_sethostent_r_proto" in
17397	define)
17398	case "$sethostent_r_proto" in
17399	''|0) try='int sethostent_r(int, struct hostent_data*);'
17400	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17401	esac
17402	case "$sethostent_r_proto" in
17403	''|0) try='void sethostent_r(int, struct hostent_data*);'
17404	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17405	esac
17406	case "$sethostent_r_proto" in
17407	''|0)	d_sethostent_r=undef
17408 	        sethostent_r_proto=0
17409		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17410	* )	case "$sethostent_r_proto" in
17411		REENTRANT_PROTO*) ;;
17412		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17413		esac
17414		echo "Prototype: $try" ;;
17415	esac
17416	;;
17417	*)	case "$usethreads" in
17418		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17419		esac
17420		d_sethostent_r=undef
17421		sethostent_r_proto=0
17422		;;
17423	esac
17424	;;
17425*)	sethostent_r_proto=0
17426	;;
17427esac
17428
17429: see if setitimer exists
17430set setitimer d_setitimer
17431eval $inlibc
17432
17433: see if setlinebuf exists
17434set setlinebuf d_setlinebuf
17435eval $inlibc
17436
17437: see if setlocale exists
17438set setlocale d_setlocale
17439eval $inlibc
17440
17441: see if locale.h is available
17442set locale.h i_locale
17443eval $inhdr
17444
17445: see if setlocale_r exists
17446set setlocale_r d_setlocale_r
17447eval $inlibc
17448case "$d_setlocale_r" in
17449"$define")
17450	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17451	case "$d_setlocale_r_proto:$usethreads" in
17452	":define")	d_setlocale_r_proto=define
17453		set d_setlocale_r_proto setlocale_r $hdrs
17454		eval $hasproto ;;
17455	*)	;;
17456	esac
17457	case "$d_setlocale_r_proto" in
17458	define)
17459	case "$setlocale_r_proto" in
17460	''|0) try='int setlocale_r(int, const char*, char*, int);'
17461	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17462	esac
17463	case "$setlocale_r_proto" in
17464	''|0)	d_setlocale_r=undef
17465 	        setlocale_r_proto=0
17466		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17467	* )	case "$setlocale_r_proto" in
17468		REENTRANT_PROTO*) ;;
17469		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17470		esac
17471		echo "Prototype: $try" ;;
17472	esac
17473	;;
17474	*)	case "$usethreads" in
17475		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17476		esac
17477		d_setlocale_r=undef
17478		setlocale_r_proto=0
17479		;;
17480	esac
17481	;;
17482*)	setlocale_r_proto=0
17483	;;
17484esac
17485
17486: see if setnetent exists
17487set setnetent d_setnent
17488eval $inlibc
17489
17490: see if setnetent_r exists
17491set setnetent_r d_setnetent_r
17492eval $inlibc
17493case "$d_setnetent_r" in
17494"$define")
17495	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17496	case "$d_setnetent_r_proto:$usethreads" in
17497	":define")	d_setnetent_r_proto=define
17498		set d_setnetent_r_proto setnetent_r $hdrs
17499		eval $hasproto ;;
17500	*)	;;
17501	esac
17502	case "$d_setnetent_r_proto" in
17503	define)
17504	case "$setnetent_r_proto" in
17505	''|0) try='int setnetent_r(int, struct netent_data*);'
17506	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17507	esac
17508	case "$setnetent_r_proto" in
17509	''|0) try='void setnetent_r(int, struct netent_data*);'
17510	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17511	esac
17512	case "$setnetent_r_proto" in
17513	''|0)	d_setnetent_r=undef
17514 	        setnetent_r_proto=0
17515		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17516	* )	case "$setnetent_r_proto" in
17517		REENTRANT_PROTO*) ;;
17518		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17519		esac
17520		echo "Prototype: $try" ;;
17521	esac
17522	;;
17523	*)	case "$usethreads" in
17524		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17525		esac
17526		d_setnetent_r=undef
17527		setnetent_r_proto=0
17528		;;
17529	esac
17530	;;
17531*)	setnetent_r_proto=0
17532	;;
17533esac
17534
17535: see if setprotoent exists
17536set setprotoent d_setpent
17537eval $inlibc
17538
17539: see if setpgid exists
17540set setpgid d_setpgid
17541eval $inlibc
17542
17543: see if setpgrp2 exists
17544set setpgrp2 d_setpgrp2
17545eval $inlibc
17546
17547: see if setpriority exists
17548set setpriority d_setprior
17549eval $inlibc
17550
17551: see if setproctitle exists
17552set setproctitle d_setproctitle
17553eval $inlibc
17554
17555: see if setprotoent_r exists
17556set setprotoent_r d_setprotoent_r
17557eval $inlibc
17558case "$d_setprotoent_r" in
17559"$define")
17560	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17561	case "$d_setprotoent_r_proto:$usethreads" in
17562	":define")	d_setprotoent_r_proto=define
17563		set d_setprotoent_r_proto setprotoent_r $hdrs
17564		eval $hasproto ;;
17565	*)	;;
17566	esac
17567	case "$d_setprotoent_r_proto" in
17568	define)
17569	case "$setprotoent_r_proto" in
17570	''|0) try='int setprotoent_r(int, struct protoent_data*);'
17571	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17572	esac
17573	case "$setprotoent_r_proto" in
17574	''|0) try='void setprotoent_r(int, struct protoent_data*);'
17575	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17576	esac
17577	case "$setprotoent_r_proto" in
17578	''|0)	d_setprotoent_r=undef
17579 	        setprotoent_r_proto=0
17580		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17581	* )	case "$setprotoent_r_proto" in
17582		REENTRANT_PROTO*) ;;
17583		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17584		esac
17585		echo "Prototype: $try" ;;
17586	esac
17587	;;
17588	*)	case "$usethreads" in
17589		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17590		esac
17591		d_setprotoent_r=undef
17592		setprotoent_r_proto=0
17593		;;
17594	esac
17595	;;
17596*)	setprotoent_r_proto=0
17597	;;
17598esac
17599
17600: see if setpwent exists
17601set setpwent d_setpwent
17602eval $inlibc
17603
17604: see if setpwent_r exists
17605set setpwent_r d_setpwent_r
17606eval $inlibc
17607case "$d_setpwent_r" in
17608"$define")
17609	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17610	case "$d_setpwent_r_proto:$usethreads" in
17611	":define")	d_setpwent_r_proto=define
17612		set d_setpwent_r_proto setpwent_r $hdrs
17613		eval $hasproto ;;
17614	*)	;;
17615	esac
17616	case "$d_setpwent_r_proto" in
17617	define)
17618	case "$setpwent_r_proto" in
17619	''|0) try='int setpwent_r(FILE**);'
17620	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17621	esac
17622	case "$setpwent_r_proto" in
17623	''|0) try='void setpwent_r(FILE**);'
17624	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17625	esac
17626	case "$setpwent_r_proto" in
17627	''|0)	d_setpwent_r=undef
17628 	        setpwent_r_proto=0
17629		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17630	* )	case "$setpwent_r_proto" in
17631		REENTRANT_PROTO*) ;;
17632		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17633		esac
17634		echo "Prototype: $try" ;;
17635	esac
17636	;;
17637	*)	case "$usethreads" in
17638		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17639		esac
17640		d_setpwent_r=undef
17641		setpwent_r_proto=0
17642		;;
17643	esac
17644	;;
17645*)	setpwent_r_proto=0
17646	;;
17647esac
17648
17649: see if setregid exists
17650set setregid d_setregid
17651eval $inlibc
17652set setresgid d_setresgid
17653eval $inlibc
17654
17655: see if setreuid exists
17656set setreuid d_setreuid
17657eval $inlibc
17658set setresuid d_setresuid
17659eval $inlibc
17660
17661: see if setrgid exists
17662set setrgid d_setrgid
17663eval $inlibc
17664
17665: see if setruid exists
17666set setruid d_setruid
17667eval $inlibc
17668
17669: see if setservent exists
17670set setservent d_setsent
17671eval $inlibc
17672
17673: see if setservent_r exists
17674set setservent_r d_setservent_r
17675eval $inlibc
17676case "$d_setservent_r" in
17677"$define")
17678	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17679	case "$d_setservent_r_proto:$usethreads" in
17680	":define")	d_setservent_r_proto=define
17681		set d_setservent_r_proto setservent_r $hdrs
17682		eval $hasproto ;;
17683	*)	;;
17684	esac
17685	case "$d_setservent_r_proto" in
17686	define)
17687	case "$setservent_r_proto" in
17688	''|0) try='int setservent_r(int, struct servent_data*);'
17689	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17690	esac
17691	case "$setservent_r_proto" in
17692	''|0) try='void setservent_r(int, struct servent_data*);'
17693	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17694	esac
17695	case "$setservent_r_proto" in
17696	''|0)	d_setservent_r=undef
17697 	        setservent_r_proto=0
17698		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17699	* )	case "$setservent_r_proto" in
17700		REENTRANT_PROTO*) ;;
17701		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17702		esac
17703		echo "Prototype: $try" ;;
17704	esac
17705	;;
17706	*)	case "$usethreads" in
17707		define) echo "setservent_r has no prototype, not using it." >&4 ;;
17708		esac
17709		d_setservent_r=undef
17710		setservent_r_proto=0
17711		;;
17712	esac
17713	;;
17714*)	setservent_r_proto=0
17715	;;
17716esac
17717
17718: see if setsid exists
17719set setsid d_setsid
17720eval $inlibc
17721
17722: see if setvbuf exists
17723set setvbuf d_setvbuf
17724eval $inlibc
17725
17726: see if shmctl exists
17727set shmctl d_shmctl
17728eval $inlibc
17729
17730: see if shmget exists
17731set shmget d_shmget
17732eval $inlibc
17733
17734: see if shmat exists
17735set shmat d_shmat
17736eval $inlibc
17737: see what shmat returns
17738case "$d_shmat" in
17739"$define")
17740	$cat >shmat.c <<'END'
17741#include <sys/shm.h>
17742void *shmat();
17743END
17744	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17745		shmattype='void *'
17746	else
17747		shmattype='char *'
17748	fi
17749	echo "and it returns ($shmattype)." >&4
17750	: see if a prototype for shmat is available
17751	xxx=`./findhdr sys/shm.h`
17752	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17753	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17754		val="$define"
17755	else
17756		val="$undef"
17757	fi
17758	$rm -f shmat.[co]
17759	;;
17760*)
17761	val="$undef"
17762	;;
17763esac
17764set d_shmatprototype
17765eval $setvar
17766
17767: see if shmdt exists
17768set shmdt d_shmdt
17769eval $inlibc
17770
17771: see how much of the 'shm*(2)' library is present.
17772h_shm=true
17773echo " "
17774case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17775*"$undef"*) h_shm=false;;
17776esac
17777case "$osname" in
17778freebsd)
17779    case "`ipcs 2>&1`" in
17780    "SVID shared memory"*"not configured"*)
17781	echo "Your $osname does not have the shm*(2) configured." >&4
17782        h_shm=false
17783	val="$undef"
17784	set shmctl d_shmctl
17785	eval $setvar
17786	set shmget d_shmget
17787	eval $setvar
17788	set shmat d_shmat
17789	eval $setvar
17790	set shmdt d_shmdt
17791	eval $setvar
17792	;;
17793    esac
17794    ;;
17795esac
17796: we could also check for sys/ipc.h ...
17797if $h_shm && $test `./findhdr sys/shm.h`; then
17798	echo "You have the full shm*(2) library." >&4
17799	val="$define"
17800else
17801	echo "You don't have the full shm*(2) library." >&4
17802	val="$undef"
17803fi
17804set d_shm
17805eval $setvar
17806
17807: see if we have sigaction
17808echo " "
17809if set sigaction val -f d_sigaction; eval $csym; $val; then
17810	echo 'sigaction() found.' >&4
17811	$cat > try.c <<EOP
17812#include <stdio.h>
17813#include <sys/types.h>
17814#include <signal.h>
17815#$i_stdlib I_STDLIB
17816#ifdef I_STDLIB
17817#include <stdlib.h>
17818#endif
17819int main()
17820{
17821    struct sigaction act, oact;
17822    act.sa_flags = 0;
17823    oact.sa_handler = 0;
17824    /* so that act and oact are used */
17825    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17826}
17827EOP
17828	set try
17829	if eval $compile_ok; then
17830		val="$define"
17831	else
17832		echo "But you don't seem to have a usable struct sigaction." >&4
17833		val="$undef"
17834	fi
17835else
17836	echo 'sigaction NOT found.' >&4
17837	val="$undef"
17838fi
17839set d_sigaction; eval $setvar
17840$rm_try
17841
17842: see if this is a sunmath.h system
17843set sunmath.h i_sunmath
17844eval $inhdr
17845
17846: see if signbit exists
17847$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17848$cat >try.c <<EOCP
17849#$i_math I_MATH
17850#$i_sunmath I_SUNMATH
17851#ifdef I_MATH
17852#  include <math.h>
17853#endif
17854#ifdef I_SUNMATH  /* Solaris special math library */
17855#  include <sunmath.h>
17856#endif
17857#define NV $nvtype
17858int main(int argc, char **argv)
17859{
17860    NV x = 0.0;
17861    NV y = -0.0;
17862    if ((signbit(x) == 0) && (signbit(y) != 0))
17863	return 0;
17864    else
17865	return 1;
17866}
17867EOCP
17868val="$undef"
17869set try
17870if eval $compile; then
17871    if $run ./try; then
17872        $echo "Yes." >&4
17873	val="$define"
17874    else
17875        $echo "Signbit seems to be available, but doesn't work as I expected."
17876        $echo "I won't use it." >&4
17877	val="$undef"
17878    fi
17879else
17880    $echo "Nope." >&4
17881    dflt="$undef"
17882fi
17883set d_signbit
17884eval $setvar
17885$rm_try
17886
17887: see if sigprocmask exists
17888set sigprocmask d_sigprocmask
17889eval $inlibc
17890
17891: see if sigsetjmp exists
17892echo " "
17893case "$d_sigsetjmp" in
17894'')
17895	$cat >try.c <<EOP
17896#include <setjmp.h>
17897#$i_stdlib I_STDLIB
17898#ifdef I_STDLIB
17899#include <stdlib.h>
17900#endif
17901sigjmp_buf env;
17902int set = 1;
17903int main()
17904{
17905	if (sigsetjmp(env,1))
17906		exit(set);
17907	set = 0;
17908	siglongjmp(env, 1);
17909	exit(1);
17910}
17911EOP
17912	set try
17913	if eval $compile; then
17914		if $run ./try >/dev/null 2>&1; then
17915			echo "POSIX sigsetjmp found." >&4
17916			val="$define"
17917		else
17918			$cat >&4 <<EOM
17919Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17920I'll ignore them.
17921EOM
17922			val="$undef"
17923		fi
17924	else
17925		echo "sigsetjmp not found." >&4
17926		val="$undef"
17927	fi
17928	;;
17929*) val="$d_sigsetjmp"
17930	case "$d_sigsetjmp" in
17931	$define) echo "POSIX sigsetjmp found." >&4;;
17932	$undef) echo "sigsetjmp not found." >&4;;
17933	esac
17934	;;
17935esac
17936set d_sigsetjmp
17937eval $setvar
17938$rm_try
17939
17940: see if snprintf exists
17941set snprintf d_snprintf
17942eval $inlibc
17943
17944: see if vsnprintf exists
17945set vsnprintf d_vsnprintf
17946eval $inlibc
17947
17948case "$d_snprintf-$d_vsnprintf" in
17949"$define-$define")
17950    $cat <<EOM
17951Checking whether your snprintf() and vsnprintf() work okay...
17952EOM
17953    $cat >try.c <<'EOCP'
17954/* v?snprintf testing logic courtesy of Russ Allbery.
17955 * According to C99:
17956 * - if the buffer is too short it still must be \0-terminated
17957 * - if the buffer is too short the potentially required length
17958 *   must be returned and not -1
17959 * - if the buffer is NULL the potentially required length
17960 *   must be returned and not -1 or core dump
17961 */
17962#include <stdio.h>
17963#include <stdarg.h>
17964
17965char buf[2];
17966
17967int test (char *format, ...)
17968{
17969    va_list args;
17970    int count;
17971
17972    va_start (args, format);
17973    count = vsnprintf (buf, sizeof buf, format, args);
17974    va_end (args);
17975    return count;
17976}
17977
17978int main ()
17979{
17980    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17981             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17982}
17983EOCP
17984    set try
17985    if eval $compile; then
17986	`$run ./try`
17987	case "$?" in
17988	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17989	*) cat <<EOM >&4
17990Your snprintf() and snprintf() don't seem to be working okay.
17991EOM
17992	   d_snprintf="$undef"
17993	   d_vsnprintf="$undef"
17994	   ;;
17995	esac
17996    else
17997	echo "(I can't seem to compile the test program--assuming they don't)"
17998	d_snprintf="$undef"
17999	d_vsnprintf="$undef"
18000    fi
18001    $rm_try
18002    ;;
18003esac
18004
18005: see if sockatmark exists
18006set sockatmark d_sockatmark
18007eval $inlibc
18008
18009: see if prototype for sockatmark is available
18010echo " "
18011set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18012eval $hasproto
18013
18014: see if socks5_init exists
18015set socks5_init d_socks5_init
18016eval $inlibc
18017
18018: see if sprintf returns the length of the string in the buffer as per ANSI
18019$echo "Checking whether sprintf returns the length of the string..." >&4
18020$cat <<EOP >try.c
18021#include <stdio.h>
18022#$i_stdlib I_STDLIB
18023#ifdef I_STDLIB
18024#include <stdlib.h>
18025#endif
18026#$i_string I_STRING
18027#ifdef I_STRING
18028#  include <string.h>
18029#else
18030#  include <strings.h>
18031#endif
18032#$i_math I_MATH
18033#ifdef I_MATH
18034#include <math.h>
18035#endif
18036
18037char buffer[256];
18038
18039int check (size_t expect, int test) {
18040  size_t got = strlen(buffer);
18041  if (expect == got)
18042    return 0;
18043
18044  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18045       test, buffer);
18046  exit (test);
18047}
18048
18049int main(int argc, char **argv) {
18050  int test = 0;
18051
18052  check(sprintf(buffer, ""), ++test);
18053  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18054  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18055
18056  return 0;
18057}
18058EOP
18059set try
18060
18061if eval $compile; then
18062    xxx="`$run ./try`"
18063    case "$?" in
18064	0) cat >&4 <<EOM
18065sprintf returns the length of the string (as ANSI says it should)
18066EOM
18067	d_sprintf_returns_strlen="$define"
18068	;;
18069	*) cat >&4 <<EOM
18070sprintf does not return the length of the string (how old is this system?)
18071EOM
18072	d_sprintf_returns_strlen="$undef"
18073        ;;
18074    esac
18075else
18076    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18077    d_sprintf_returns_strlen="$undef"
18078fi
18079$rm_try
18080
18081: see if srand48_r exists
18082set srand48_r d_srand48_r
18083eval $inlibc
18084case "$d_srand48_r" in
18085"$define")
18086	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18087	case "$d_srand48_r_proto:$usethreads" in
18088	":define")	d_srand48_r_proto=define
18089		set d_srand48_r_proto srand48_r $hdrs
18090		eval $hasproto ;;
18091	*)	;;
18092	esac
18093	case "$d_srand48_r_proto" in
18094	define)
18095	case "$srand48_r_proto" in
18096	''|0) try='int srand48_r(long, struct drand48_data*);'
18097	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18098	esac
18099	case "$srand48_r_proto" in
18100	''|0)	d_srand48_r=undef
18101 	        srand48_r_proto=0
18102		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18103	* )	case "$srand48_r_proto" in
18104		REENTRANT_PROTO*) ;;
18105		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18106		esac
18107		echo "Prototype: $try" ;;
18108	esac
18109	;;
18110	*)	case "$usethreads" in
18111		define) echo "srand48_r has no prototype, not using it." >&4 ;;
18112		esac
18113		d_srand48_r=undef
18114		srand48_r_proto=0
18115		;;
18116	esac
18117	;;
18118*)	srand48_r_proto=0
18119	;;
18120esac
18121
18122: see if srandom_r exists
18123set srandom_r d_srandom_r
18124eval $inlibc
18125case "$d_srandom_r" in
18126"$define")
18127	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18128	case "$d_srandom_r_proto:$usethreads" in
18129	":define")	d_srandom_r_proto=define
18130		set d_srandom_r_proto srandom_r $hdrs
18131		eval $hasproto ;;
18132	*)	;;
18133	esac
18134	case "$d_srandom_r_proto" in
18135	define)
18136	case "$srandom_r_proto" in
18137	''|0) try='int srandom_r(unsigned int, struct random_data*);'
18138	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18139	esac
18140	case "$srandom_r_proto" in
18141	''|0)	d_srandom_r=undef
18142 	        srandom_r_proto=0
18143		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18144	* )	case "$srandom_r_proto" in
18145		REENTRANT_PROTO*) ;;
18146		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18147		esac
18148		echo "Prototype: $try" ;;
18149	esac
18150	;;
18151	*)	case "$usethreads" in
18152		define) echo "srandom_r has no prototype, not using it." >&4 ;;
18153		esac
18154		d_srandom_r=undef
18155		srandom_r_proto=0
18156		;;
18157	esac
18158	;;
18159*)	srandom_r_proto=0
18160	;;
18161esac
18162
18163: see if prototype for setresgid is available
18164echo " "
18165set d_sresgproto setresgid $i_unistd unistd.h
18166eval $hasproto
18167
18168: see if prototype for setresuid is available
18169echo " "
18170set d_sresuproto setresuid $i_unistd unistd.h
18171eval $hasproto
18172
18173: see if sys/stat.h is available
18174set sys/stat.h i_sysstat
18175eval $inhdr
18176
18177: see if stat knows about block sizes
18178echo " "
18179echo "Checking to see if your struct stat has st_blocks field..." >&4
18180set d_statblks stat st_blocks $i_sysstat sys/stat.h
18181eval $hasfield
18182
18183: see if this is a sys/vfs.h system
18184set sys/vfs.h i_sysvfs
18185eval $inhdr
18186
18187: see if this is a sys/statfs.h system
18188set sys/statfs.h i_sysstatfs
18189eval $inhdr
18190
18191: Check for statfs_s
18192echo " "
18193echo "Checking to see if your system supports struct statfs..." >&4
18194set 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
18195eval $hasstruct
18196case "$d_statfs_s" in
18197"$define")      echo "Yes, it does."   ;;
18198*)              echo "No, it doesn't." ;;
18199esac
18200
18201
18202: see if struct statfs knows about f_flags
18203case "$d_statfs_s" in
18204define)
18205	echo " "
18206	echo "Checking to see if your struct statfs has f_flags field..." >&4
18207	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
18208	eval $hasfield
18209	;;
18210*)	val="$undef"
18211	set d_statfs_f_flags
18212	eval $setvar
18213	;;
18214esac
18215case "$d_statfs_f_flags" in
18216"$define")      echo "Yes, it does."   ;;
18217*)              echo "No, it doesn't." ;;
18218esac
18219
18220: see what flavor, if any, of static inline is supported
18221echo " "
18222echo "Checking to see if your system supports static inline..."
18223$cat > try.c <<'EOCP'
18224#include <stdlib.h>
18225extern int f_via_a(int x);
18226extern int f_via_b(int x);
18227int main(int argc, char **argv)
18228{
18229    int y;
18230
18231    y = f_via_a(0);
18232#ifdef USE_B
18233    y = f_via_b(0);
18234#endif
18235    if (y == 42) {
18236        return EXIT_SUCCESS;
18237    }
18238    else {
18239        return EXIT_FAILURE;
18240    }
18241}
18242EOCP
18243$cat > a.c <<'EOCP'
18244static INLINE int f(int x) {
18245    int y;
18246    y = x + 42;
18247    return y;
18248}
18249
18250int f_via_a(int x)
18251{
18252    return f(x);
18253}
18254EOCP
18255$cat > b.c <<'EOCP'
18256extern int f(int x);
18257
18258int f_via_b(int x)
18259{
18260    return f(x);
18261}
18262EOCP
18263
18264# Respect a hint (or previous) value for perl_static_inline, if there is one.
18265case "$perl_static_inline" in
18266'')	# Check the various possibilities, and break out on success.
18267	# For gcc, prefer __inline__, which will still permit
18268	# cflags.SH to add in -ansi.
18269	case "$gccversion" in
18270		'') xxx="inline __inline__ __inline _inline";;
18271		*)  xxx="__inline__ inline __inline _inline";;
18272	esac
18273	for inline in $xxx; do
18274		set try -DINLINE=$inline a.c
18275		if eval $compile && $run ./try; then
18276			# Now make sure there is no external linkage of static
18277			# functions
18278			set try -DINLINE=$inline -DUSE_B a.c b.c
18279			if eval $compile && $run ./try; then
18280				$echo "Your compiler supports static $inline, " >&4
18281				$echo "but it also creates an external definition," >&4
18282				$echo "so I won't use it." >&4
18283				val=$undef
18284			else
18285				$echo "Your compiler supports static $inline." >&4
18286				val=$define
18287				perl_static_inline="static $inline";
18288				break;
18289			fi
18290		else
18291			$echo "Your compiler does NOT support static $inline." >&4
18292			val="$undef"
18293		fi
18294	done
18295	;;
18296*inline*) # Some variant of inline exists.
18297	echo "Keeping your $hint value of $perl_static_inline."
18298	val=$define
18299	;;
18300static)  # No inline capabilities
18301	echo "Keeping your $hint value of $perl_static_inline."
18302	val=$undef
18303	;;
18304*)  # Unrecognized previous value -- blindly trust the supplied
18305	# value and hope it makes sense.  Use old value for
18306	# d_static_inline, if there is one.
18307	echo "Keeping your $hint value of $perl_static_inline."
18308	case "$d_static_inline" in
18309		'') val=$define ;;
18310		*)  val=$d_static_inline ;;
18311	esac
18312	;;
18313esac
18314# Fallback to plain 'static' if nothing worked.
18315case "$perl_static_inline" in
18316'')
18317	perl_static_inline="static"
18318	val=$undef
18319	;;
18320esac
18321set d_static_inline
18322eval $setvar
18323$rm -f a.[co] b.[co]
18324$rm_try
18325
18326: Check stream access
18327$cat >&4 <<EOM
18328Checking how to access stdio streams by file descriptor number...
18329EOM
18330case "$stdio_stream_array" in
18331'') 	$cat >try.c <<EOCP
18332#include <stdio.h>
18333int main() {
18334  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18335    printf("yes\n");
18336}
18337EOCP
18338	for s in _iob __iob __sF
18339	do
18340	        set try -DSTDIO_STREAM_ARRAY=$s
18341		if eval $compile; then
18342		    	case "`$run ./try`" in
18343			yes)	stdio_stream_array=$s; break ;;
18344			esac
18345		fi
18346	done
18347	$rm_try
18348esac
18349case "$stdio_stream_array" in
18350'')	$cat >&4 <<EOM
18351I can't figure out how to access stdio streams by file descriptor number.
18352EOM
18353	d_stdio_stream_array="$undef"
18354	;;
18355*)	$cat >&4 <<EOM
18356You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18357EOM
18358	d_stdio_stream_array="$define"
18359	;;
18360esac
18361
18362: see if strcoll exists
18363set strcoll d_strcoll
18364eval $inlibc
18365
18366: check for structure copying
18367echo " "
18368echo "Checking to see if your C compiler can copy structs..." >&4
18369$cat >try.c <<'EOCP'
18370int main()
18371{
18372	struct blurfl {
18373		int dyick;
18374	} foo, bar;
18375
18376	foo = bar;
18377}
18378EOCP
18379if $cc -c try.c >/dev/null 2>&1 ; then
18380	val="$define"
18381	echo "Yup, it can."
18382else
18383	val="$undef"
18384	echo "Nope, it can't."
18385fi
18386set d_strctcpy
18387eval $setvar
18388$rm_try
18389
18390: see if strerror and/or sys_errlist[] exist
18391echo " "
18392if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18393    if set strerror val -f d_strerror; eval $csym; $val; then
18394		echo 'strerror() found.' >&4
18395		d_strerror="$define"
18396		d_strerrm='strerror(e)'
18397		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18398			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18399			d_syserrlst="$define"
18400		else
18401			echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18402			d_syserrlst="$undef"
18403		fi
18404    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18405			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18406		echo 'strerror() found in string header.' >&4
18407		d_strerror="$define"
18408		d_strerrm='strerror(e)'
18409		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18410			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18411				d_syserrlst="$define"
18412		else
18413			echo "(You don't appear to have any sys_errlist[], how can this be?)"
18414			d_syserrlst="$undef"
18415		fi
18416    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18417		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18418		d_strerror="$undef"
18419		d_syserrlst="$define"
18420		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18421    else
18422		echo 'strerror() and sys_errlist[] NOT found.' >&4
18423		d_strerror="$undef"
18424		d_syserrlst="$undef"
18425		d_strerrm='"unknown"'
18426    fi
18427fi
18428
18429: see if strerror_r exists
18430set strerror_r d_strerror_r
18431eval $inlibc
18432case "$d_strerror_r" in
18433"$define")
18434	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18435	case "$d_strerror_r_proto:$usethreads" in
18436	":define")	d_strerror_r_proto=define
18437		set d_strerror_r_proto strerror_r $hdrs
18438		eval $hasproto ;;
18439	*)	;;
18440	esac
18441	case "$d_strerror_r_proto" in
18442	define)
18443	case "$strerror_r_proto" in
18444	''|0) try='int strerror_r(int, char*, size_t);'
18445	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18446	esac
18447	case "$strerror_r_proto" in
18448	''|0) try='int strerror_r(int, char*, int);'
18449	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18450	esac
18451	case "$strerror_r_proto" in
18452	''|0) try='char* strerror_r(int, char*, size_t);'
18453	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18454	esac
18455	case "$strerror_r_proto" in
18456	''|0)	d_strerror_r=undef
18457 	        strerror_r_proto=0
18458		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18459	* )	case "$strerror_r_proto" in
18460		REENTRANT_PROTO*) ;;
18461		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18462		esac
18463		echo "Prototype: $try" ;;
18464	esac
18465	;;
18466	*)	case "$usethreads" in
18467		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18468		esac
18469		d_strerror_r=undef
18470		strerror_r_proto=0
18471		;;
18472	esac
18473	;;
18474*)	strerror_r_proto=0
18475	;;
18476esac
18477
18478: see if strftime exists
18479set strftime d_strftime
18480eval $inlibc
18481
18482: see if strlcat exists
18483set strlcat d_strlcat
18484eval $inlibc
18485
18486: see if strlcpy exists
18487set strlcpy d_strlcpy
18488eval $inlibc
18489
18490: see if strtod exists
18491set strtod d_strtod
18492eval $inlibc
18493
18494: see if strtol exists
18495set strtol d_strtol
18496eval $inlibc
18497
18498: see if strtold exists
18499set strtold d_strtold
18500eval $inlibc
18501
18502: see if strtoll exists
18503set strtoll d_strtoll
18504eval $inlibc
18505
18506case "$d_longlong-$d_strtoll" in
18507"$define-$define")
18508	$cat <<EOM
18509Checking whether your strtoll() works okay...
18510EOM
18511	$cat >try.c <<'EOCP'
18512#include <errno.h>
18513#ifdef __hpux
18514#define strtoll __strtoll
18515#endif
18516#ifdef __EMX__
18517#define strtoll _strtoll
18518#endif
18519#include <stdio.h>
18520extern long long int strtoll(char *s, char **, int);
18521static int bad = 0;
18522int check(char *s, long long ell, int een) {
18523	long long gll;
18524	errno = 0;
18525	gll = strtoll(s, 0, 10);
18526	if (!((gll == ell) && (errno == een)))
18527		bad++;
18528}
18529int main() {
18530	check(" 1",                                      1LL, 0);
18531	check(" 0",                                      0LL, 0);
18532	check("-1",                                     -1LL, 0);
18533	check("-9223372036854775808", -9223372036854775808LL, 0);
18534	check("-9223372036854775808", -9223372036854775808LL, 0);
18535	check(" 9223372036854775807",  9223372036854775807LL, 0);
18536	check("-9223372036854775808", -9223372036854775808LL, 0);
18537	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18538	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18539	if (!bad)
18540		printf("ok\n");
18541}
18542EOCP
18543	set try
18544	if eval $compile; then
18545		yyy=`$run ./try`
18546		case "$yyy" in
18547		ok) echo "Your strtoll() seems to be working okay." ;;
18548		*) cat <<EOM >&4
18549Your strtoll() doesn't seem to be working okay.
18550EOM
18551		   d_strtoll="$undef"
18552		   ;;
18553		esac
18554	else
18555		echo "(I can't seem to compile the test program--assuming it doesn't)"
18556		d_strtoll="$undef"
18557	fi
18558	;;
18559esac
18560
18561: see if strtoq exists
18562set strtoq d_strtoq
18563eval $inlibc
18564
18565: see if strtoul exists
18566set strtoul d_strtoul
18567eval $inlibc
18568
18569case "$d_strtoul" in
18570"$define")
18571	$cat <<EOM
18572Checking whether your strtoul() works okay...
18573EOM
18574	$cat >try.c <<'EOCP'
18575#include <errno.h>
18576#include <stdio.h>
18577extern unsigned long int strtoul(char *s, char **, int);
18578static int bad = 0;
18579void check(char *s, unsigned long eul, int een) {
18580	unsigned long gul;
18581	errno = 0;
18582	gul = strtoul(s, 0, 10);
18583	if (!((gul == eul) && (errno == een)))
18584		bad++;
18585}
18586int main() {
18587	check(" 1", 1L, 0);
18588	check(" 0", 0L, 0);
18589EOCP
18590	case "$longsize" in
18591	8)
18592	    $cat >>try.c <<'EOCP'
18593	check("18446744073709551615", 18446744073709551615UL, 0);
18594	check("18446744073709551616", 18446744073709551615UL, ERANGE);
18595#if 0 /* strtoul() for /^-/ strings is undefined. */
18596	check("-1", 18446744073709551615UL, 0);
18597	check("-18446744073709551614", 2, 0);
18598	check("-18446744073709551615", 1, 0);
18599       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18600	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18601#endif
18602EOCP
18603		;;
18604	4)
18605		    $cat >>try.c <<'EOCP'
18606	check("4294967295", 4294967295UL, 0);
18607	check("4294967296", 4294967295UL, ERANGE);
18608#if 0 /* strtoul() for /^-/ strings is undefined. */
18609	check("-1", 4294967295UL, 0);
18610	check("-4294967294", 2, 0);
18611	check("-4294967295", 1, 0);
18612       	check("-4294967296", 4294967295UL, ERANGE);
18613	check("-4294967297", 4294967295UL, ERANGE);
18614#endif
18615EOCP
18616		;;
18617	*)
18618: Should we write these tests to be more portable by sprintf-ing
18619: ~0 and then manipulating that char string as input for strtol?
18620		;;
18621	esac
18622	$cat >>try.c <<'EOCP'
18623	if (!bad)
18624		printf("ok\n");
18625	return 0;
18626}
18627EOCP
18628	set try
18629	if eval $compile; then
18630		case "`$run ./try`" in
18631		ok) echo "Your strtoul() seems to be working okay." ;;
18632		*) cat <<EOM >&4
18633Your strtoul() doesn't seem to be working okay.
18634EOM
18635		   d_strtoul="$undef"
18636		   ;;
18637		esac
18638	else
18639		echo "(I can't seem to compile the test program--assuming it doesn't)"
18640		d_strtoul="$undef"
18641	fi
18642	;;
18643esac
18644
18645: see if strtoull exists
18646set strtoull d_strtoull
18647eval $inlibc
18648
18649case "$d_longlong-$d_strtoull" in
18650"$define-$define")
18651	$cat <<EOM
18652Checking whether your strtoull() works okay...
18653EOM
18654	$cat >try.c <<'EOCP'
18655#include <errno.h>
18656#ifdef __hpux
18657#define strtoull __strtoull
18658#endif
18659#include <stdio.h>
18660extern unsigned long long int strtoull(char *s, char **, int);
18661static int bad = 0;
18662int check(char *s, long long eull, int een) {
18663	long long gull;
18664	errno = 0;
18665	gull = strtoull(s, 0, 10);
18666	if (!((gull == eull) && (errno == een)))
18667		bad++;
18668}
18669int main() {
18670	check(" 1",                                        1LL, 0);
18671	check(" 0",                                        0LL, 0);
18672	check("18446744073709551615",  18446744073709551615ULL, 0);
18673	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18674#if 0 /* strtoull() for /^-/ strings is undefined. */
18675	check("-1",                    18446744073709551615ULL, 0);
18676	check("-18446744073709551614",                     2LL, 0);
18677	check("-18446744073709551615",                     1LL, 0);
18678       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18679	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18680#endif
18681	if (!bad)
18682		printf("ok\n");
18683}
18684EOCP
18685	set try
18686	if eval $compile; then
18687		case "`$run ./try`" in
18688		ok) echo "Your strtoull() seems to be working okay." ;;
18689		*) cat <<EOM >&4
18690Your strtoull() doesn't seem to be working okay.
18691EOM
18692		   d_strtoull="$undef"
18693		   ;;
18694		esac
18695	else
18696		echo "(I can't seem to compile the test program--assuming it doesn't)"
18697		d_strtoull="$undef"
18698	fi
18699	;;
18700esac
18701
18702: see if strtouq exists
18703set strtouq d_strtouq
18704eval $inlibc
18705
18706case "$d_strtouq" in
18707"$define")
18708	$cat <<EOM
18709Checking whether your strtouq() works okay...
18710EOM
18711	$cat >try.c <<'EOCP'
18712#include <errno.h>
18713#include <stdio.h>
18714extern unsigned long long int strtouq(char *s, char **, int);
18715static int bad = 0;
18716void check(char *s, unsigned long long eull, int een) {
18717	unsigned long long gull;
18718	errno = 0;
18719	gull = strtouq(s, 0, 10);
18720	if (!((gull == eull) && (errno == een)))
18721		bad++;
18722}
18723int main() {
18724	check(" 1",                                        1LL, 0);
18725	check(" 0",                                        0LL, 0);
18726	check("18446744073709551615",  18446744073709551615ULL, 0);
18727	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18728#if 0 /* strtouq() for /^-/ strings is undefined. */
18729	check("-1",                    18446744073709551615ULL, 0);
18730	check("-18446744073709551614",                     2LL, 0);
18731	check("-18446744073709551615",                     1LL, 0);
18732       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18733	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18734#endif
18735	if (!bad)
18736		printf("ok\n");
18737	return 0;
18738}
18739EOCP
18740	set try
18741	if eval $compile; then
18742		case "`$run ./try`" in
18743		ok) echo "Your strtouq() seems to be working okay." ;;
18744		*) cat <<EOM >&4
18745Your strtouq() doesn't seem to be working okay.
18746EOM
18747		   d_strtouq="$undef"
18748		   ;;
18749		esac
18750	else
18751		echo "(I can't seem to compile the test program--assuming it doesn't)"
18752		d_strtouq="$undef"
18753	fi
18754	;;
18755esac
18756
18757: see if strxfrm exists
18758set strxfrm d_strxfrm
18759eval $inlibc
18760
18761: see if symlink exists
18762set symlink d_symlink
18763eval $inlibc
18764
18765: see if syscall exists
18766set syscall d_syscall
18767eval $inlibc
18768
18769: see if prototype for syscall is available
18770echo " "
18771set d_syscallproto syscall $i_unistd unistd.h
18772eval $hasproto
18773
18774: see if sysconf exists
18775set sysconf d_sysconf
18776eval $inlibc
18777
18778: see if system exists
18779set system d_system
18780eval $inlibc
18781
18782: see if tcgetpgrp exists
18783set tcgetpgrp d_tcgetpgrp
18784eval $inlibc
18785
18786: see if tcsetpgrp exists
18787set tcsetpgrp d_tcsetpgrp
18788eval $inlibc
18789
18790: see if prototype for telldir is available
18791echo " "
18792set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18793eval $hasproto
18794
18795: see if time exists
18796echo " "
18797if test "X$d_time" = X -o X"$timetype" = X; then
18798    if set time val -f d_time; eval $csym; $val; then
18799		echo 'time() found.' >&4
18800		val="$define"
18801		rp="What is the type returned by time() on this system?"
18802		set time_t timetype long stdio.h sys/types.h
18803		eval $typedef_ask
18804    else
18805		echo 'time() not found, hope that will do.' >&4
18806		val="$undef"
18807		timetype='int';
18808    fi
18809    set d_time
18810    eval $setvar
18811fi
18812
18813: see if timegm exists
18814set timegm d_timegm
18815eval $inlibc
18816
18817: see if this is a sys/times.h system
18818set sys/times.h i_systimes
18819eval $inhdr
18820
18821: see if times exists
18822echo " "
18823if set times val -f d_times; eval $csym; $val; then
18824	echo 'times() found.' >&4
18825	d_times="$define"
18826	inc=''
18827	case "$i_systimes" in
18828	"$define") inc='sys/times.h';;
18829	esac
18830	rp="What is the type returned by times() on this system?"
18831	set clock_t clocktype long stdio.h sys/types.h $inc
18832	eval $typedef_ask
18833else
18834	echo 'times() NOT found, hope that will do.' >&4
18835	d_times="$undef"
18836	clocktype='int'
18837fi
18838
18839: see if tmpnam_r exists
18840set tmpnam_r d_tmpnam_r
18841eval $inlibc
18842case "$d_tmpnam_r" in
18843"$define")
18844	hdrs="$i_systypes sys/types.h define stdio.h "
18845	case "$d_tmpnam_r_proto:$usethreads" in
18846	":define")	d_tmpnam_r_proto=define
18847		set d_tmpnam_r_proto tmpnam_r $hdrs
18848		eval $hasproto ;;
18849	*)	;;
18850	esac
18851	case "$d_tmpnam_r_proto" in
18852	define)
18853	case "$tmpnam_r_proto" in
18854	''|0) try='char* tmpnam_r(char*);'
18855	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18856	esac
18857	case "$tmpnam_r_proto" in
18858	''|0)	d_tmpnam_r=undef
18859 	        tmpnam_r_proto=0
18860		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18861	* )	case "$tmpnam_r_proto" in
18862		REENTRANT_PROTO*) ;;
18863		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18864		esac
18865		echo "Prototype: $try" ;;
18866	esac
18867	;;
18868	*)	case "$usethreads" in
18869		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18870		esac
18871		d_tmpnam_r=undef
18872		tmpnam_r_proto=0
18873		;;
18874	esac
18875	;;
18876*)	tmpnam_r_proto=0
18877	;;
18878esac
18879
18880: see if truncate exists
18881set truncate d_truncate
18882eval $inlibc
18883
18884: see if ttyname_r exists
18885set ttyname_r d_ttyname_r
18886eval $inlibc
18887case "$d_ttyname_r" in
18888"$define")
18889	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18890	case "$d_ttyname_r_proto:$usethreads" in
18891	":define")	d_ttyname_r_proto=define
18892		set d_ttyname_r_proto ttyname_r $hdrs
18893		eval $hasproto ;;
18894	*)	;;
18895	esac
18896	case "$d_ttyname_r_proto" in
18897	define)
18898	case "$ttyname_r_proto" in
18899	''|0) try='int ttyname_r(int, char*, size_t);'
18900	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18901	esac
18902	case "$ttyname_r_proto" in
18903	''|0) try='int ttyname_r(int, char*, int);'
18904	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18905	esac
18906	case "$ttyname_r_proto" in
18907	''|0) try='char* ttyname_r(int, char*, int);'
18908	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18909	esac
18910	case "$ttyname_r_proto" in
18911	''|0)	d_ttyname_r=undef
18912 	        ttyname_r_proto=0
18913		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18914	* )	case "$ttyname_r_proto" in
18915		REENTRANT_PROTO*) ;;
18916		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18917		esac
18918		echo "Prototype: $try" ;;
18919	esac
18920	;;
18921	*)	case "$usethreads" in
18922		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18923		esac
18924		d_ttyname_r=undef
18925		ttyname_r_proto=0
18926		;;
18927	esac
18928	;;
18929*)	ttyname_r_proto=0
18930	;;
18931esac
18932
18933: see if tzname[] exists
18934echo " "
18935if set tzname val -a d_tzname; eval $csym; $val; then
18936	val="$define"
18937	echo 'tzname[] found.' >&4
18938else
18939	val="$undef"
18940	echo 'tzname[] NOT found.' >&4
18941fi
18942set d_tzname
18943eval $setvar
18944
18945: Check if is a multiplatform env
18946case "$osname" in
18947next|darwin) multiarch="$define" ;;
18948esac
18949case "$multiarch" in
18950''|[nN]*) multiarch="$undef" ;;
18951esac
18952
18953: check for ordering of bytes in a UV
18954echo " "
18955case "$multiarch" in
18956*$define*)
18957	$cat <<EOM
18958You seem to be doing a multiarchitecture build,
18959skipping the byteorder check.
18960
18961EOM
18962	byteorder='ffff'
18963	;;
18964*)
18965	case "$byteorder" in
18966	'')
18967		$cat <<'EOM'
18968In the following, larger digits indicate more significance.  A big-endian
18969machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18970little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18971machines may have weird orders like 3412.  A Cray will report 87654321,
18972an Alpha will report 12345678. If the test program works the default is
18973probably right.
18974I'm now running the test program...
18975EOM
18976		$cat >try.c <<EOCP
18977#include <stdio.h>
18978#$i_stdlib I_STDLIB
18979#ifdef I_STDLIB
18980#include <stdlib.h>
18981#endif
18982#include <sys/types.h>
18983typedef $uvtype UV;
18984int main()
18985{
18986	int i;
18987	union {
18988		UV l;
18989		char c[$uvsize];
18990	} u;
18991
18992	if ($uvsize > 4)
18993		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18994	else
18995		u.l = (UV)0x04030201;
18996	for (i = 0; i < $uvsize; i++)
18997		printf("%c", u.c[i]+'0');
18998	printf("\n");
18999	exit(0);
19000}
19001EOCP
19002		xxx_prompt=y
19003		set try
19004		if eval $compile && $run ./try > /dev/null; then
19005			dflt=`$run ./try`
19006			case "$dflt" in
19007			[1-4][1-4][1-4][1-4]|12345678|87654321)
19008				echo "(The test program ran ok.)"
19009				echo "byteorder=$dflt"
19010				xxx_prompt=n
19011			;;
19012			????|????????) echo "(The test program ran ok.)" ;;
19013			*) echo "(The test program didn't run right for some reason.)" ;;
19014			esac
19015		else
19016			dflt='4321'
19017			cat <<'EOM'
19018(I can't seem to compile the test program.  Guessing big-endian...)
19019EOM
19020		fi
19021		case "$xxx_prompt" in
19022		y)
19023			rp="What is the order of bytes in $uvtype?"
19024			. ./myread
19025			byteorder="$ans"
19026			;;
19027		*)	byteorder=$dflt
19028			;;
19029		esac
19030		;;
19031	esac
19032	$rm_try
19033	;;
19034esac
19035
19036: Checking 32bit alignedness
19037$cat <<EOM
19038
19039Checking to see whether you can access character data unalignedly...
19040EOM
19041case "$d_u32align" in
19042'')   $cat >try.c <<EOCP
19043#include <stdio.h>
19044#$i_stdlib I_STDLIB
19045#ifdef I_STDLIB
19046#include <stdlib.h>
19047#endif
19048#define U32 $u32type
19049#define BYTEORDER 0x$byteorder
19050#define U8 $u8type
19051#include <signal.h>
19052#ifdef SIGBUS
19053$signal_t bletch(int s) { exit(4); }
19054#endif
19055int main() {
19056#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19057    volatile U8 buf[8];
19058    volatile U32 *up;
19059    int i;
19060
19061    if (sizeof(U32) != 4) {
19062	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19063	exit(1);
19064    }
19065
19066    fflush(stdout);
19067
19068#ifdef SIGBUS
19069    signal(SIGBUS, bletch);
19070#endif
19071
19072    buf[0] = 0;
19073    buf[1] = 0;
19074    buf[2] = 0;
19075    buf[3] = 1;
19076    buf[4] = 0;
19077    buf[5] = 0;
19078    buf[6] = 0;
19079    buf[7] = 1;
19080
19081    for (i = 0; i < 4; i++) {
19082	up = (U32*)(buf + i);
19083	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19084	       (*up == 1 << (8*(3-i)))  /* little-endian */
19085	      )
19086	   )
19087	{
19088	    printf("read failed (%x)\n", *up);
19089	    exit(2);
19090	}
19091    }
19092
19093    /* write test */
19094    for (i = 0; i < 4; i++) {
19095	up = (U32*)(buf + i);
19096	*up = 0xBeef;
19097	if (*up != 0xBeef) {
19098	    printf("write failed (%x)\n", *up);
19099	    exit(3);
19100	}
19101    }
19102
19103    exit(0);
19104#else
19105    printf("1\n");
19106    exit(1);
19107#endif
19108    return 0;
19109}
19110EOCP
19111set try
19112if eval $compile_ok; then
19113	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19114	$run ./try 2>&1 >/dev/null
19115	case "$?" in
19116	0)	cat >&4 <<EOM
19117You can access character data pretty unalignedly.
19118EOM
19119		d_u32align="$undef"
19120		;;
19121	*)	cat >&4 <<EOM
19122It seems that you must access character data in an aligned manner.
19123EOM
19124		d_u32align="$define"
19125		;;
19126	esac
19127else
19128	rp='Can you access character data at unaligned addresses?'
19129	dflt='n'
19130	. ./myread
19131	case "$ans" in
19132	[yY]*)	d_u32align="$undef"  ;;
19133	*)	d_u32align="$define" ;;
19134	esac
19135fi
19136$rm_try
19137;;
19138esac
19139
19140: see if ualarm exists
19141set ualarm d_ualarm
19142eval $inlibc
19143
19144: see if umask exists
19145set umask d_umask
19146eval $inlibc
19147
19148: see if unordered exists
19149set unordered d_unordered
19150eval $inlibc
19151
19152: see if unsetenv exists
19153set unsetenv d_unsetenv
19154eval $inlibc
19155
19156: see if usleep exists
19157set usleep d_usleep
19158eval $inlibc
19159
19160: see if prototype for usleep is available
19161echo " "
19162set d_usleepproto usleep $i_unistd unistd.h
19163eval $hasproto
19164
19165: see if ustat exists
19166set ustat d_ustat
19167eval $inlibc
19168
19169: see if closedir exists
19170set closedir d_closedir
19171eval $inlibc
19172
19173case "$d_closedir" in
19174"$define")
19175	echo " "
19176	echo "Checking whether closedir() returns a status..." >&4
19177	cat > try.c <<EOM
19178#$i_dirent I_DIRENT		/**/
19179#$i_sysdir I_SYS_DIR		/**/
19180#$i_sysndir I_SYS_NDIR		/**/
19181#$i_systypes I_SYS_TYPES	/**/
19182
19183#if defined(I_SYS_TYPES)
19184#include <sys/types.h>
19185#endif
19186#if defined(I_DIRENT)
19187#include <dirent.h>
19188#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19189#include <sys/dir.h>
19190#endif
19191#else
19192#ifdef I_SYS_NDIR
19193#include <sys/ndir.h>
19194#else
19195#ifdef I_SYS_DIR
19196#ifdef hp9000s500
19197#include <ndir.h>	/* may be wrong in the future */
19198#else
19199#include <sys/dir.h>
19200#endif
19201#endif
19202#endif
19203#endif
19204int main() { return closedir(opendir(".")); }
19205EOM
19206	set try
19207	if eval $compile_ok; then
19208		if $run ./try > /dev/null 2>&1 ; then
19209			echo "Yes, it does."
19210			val="$undef"
19211		else
19212			echo "No, it doesn't."
19213			val="$define"
19214		fi
19215	else
19216		echo "(I can't seem to compile the test program--assuming it doesn't)"
19217		val="$define"
19218	fi
19219	;;
19220*)
19221	val="$undef";
19222	;;
19223esac
19224set d_void_closedir
19225eval $setvar
19226$rm_try
19227
19228: see if there is a wait4
19229set wait4 d_wait4
19230eval $inlibc
19231
19232: see if waitpid exists
19233set waitpid d_waitpid
19234eval $inlibc
19235
19236: see if wcstombs exists
19237set wcstombs d_wcstombs
19238eval $inlibc
19239
19240: see if wctomb exists
19241set wctomb d_wctomb
19242eval $inlibc
19243
19244: see if writev exists
19245set writev d_writev
19246eval $inlibc
19247
19248: preserve RCS keywords in files with variable substitution, grrr
19249Date='$Date'
19250Id='$Id'
19251Log='$Log'
19252RCSfile='$RCSfile'
19253Revision='$Revision'
19254
19255: check for alignment requirements
19256echo " "
19257case "$alignbytes" in
19258    '') echo "Checking alignment constraints..." >&4
19259	if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19260	    $cat >try.c <<'EOCP'
19261typedef long double NV;
19262EOCP
19263	else
19264	    $cat >try.c <<'EOCP'
19265typedef double NV;
19266EOCP
19267	fi
19268	$cat >>try.c <<'EOCP'
19269#include <stdio.h>
19270struct foobar {
19271    char foo;
19272    NV bar;
19273} try_algn;
19274int main()
19275{
19276    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19277    return(0);
19278}
19279EOCP
19280	set try
19281	if eval $compile_ok; then
19282	    dflt=`$run ./try`
19283	else
19284	    dflt='8'
19285	    echo "(I can't seem to compile the test program...)"
19286	fi
19287	case "$multiarch" in
19288	    *$define*)
19289		: The usual safe value is 8, but Darwin with -Duselongdouble
19290		: needs 16.  Hence, we will take 8 as a minimum, but allow
19291		: Configure to pick a larger value if needed.
19292		if $test "$dflt" -lt 8; then
19293		    dflt='8'
19294		    echo "Setting alignment to 8 for multiarch support.">&4
19295		fi
19296		;;
19297	esac
19298	;;
19299    *) dflt="$alignbytes"
19300	;;
19301esac
19302rp="Doubles must be aligned on a how-many-byte boundary?"
19303. ./myread
19304alignbytes="$ans"
19305$rm_try
19306
19307: set the base revision
19308baserev=5.0
19309
19310: Determine if this is an EBCDIC system
19311echo " "
19312echo "Determining whether or not we are on an EBCDIC system..." >&4
19313$cat >try.c <<'EOM'
19314int main()
19315{
19316  if ('M'==0xd4) return 0;
19317  return 1;
19318}
19319EOM
19320
19321case "$BOOTSTRAP_CHARSET" in
19322    Y|y|define) bootstrap_charset=$define	;;
19323    *)		bootstrap_charset=$undef	;;
19324esac
19325
19326val=$undef
19327set try
19328if eval $compile_ok; then
19329	if $run ./try; then
19330		echo "You seem to speak EBCDIC." >&4
19331		val="$define"
19332	else
19333		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19334	fi
19335else
19336	echo "I'm unable to compile the test program." >&4
19337	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19338fi
19339$rm_try
19340set ebcdic
19341eval $setvar
19342
19343: length of character in bytes. Is always 1, otherwise it is not C
19344: This used to be a test using sizeof
19345charsize=1
19346
19347: Check for the number of bits in a character
19348case "$charbits" in
19349'')	echo "Checking how long a character is (in bits)..." >&4
19350	$cat >try.c <<EOCP
19351#include <stdio.h>
19352int main ()
19353{
19354    int n;
19355    unsigned char c;
19356    for (c = 1, n = 0; c; c <<= 1, n++) ;
19357    printf ("%d\n", n);
19358    return (0);
19359    }
19360EOCP
19361	set try
19362	if eval $compile_ok; then
19363		dflt=`$run ./try`
19364	else
19365		dflt='8'
19366		echo "(I can't seem to compile the test program.  Guessing...)"
19367	fi
19368	;;
19369*)
19370	dflt="$charbits"
19371	;;
19372esac
19373rp="What is the length of a character (in bits)?"
19374. ./myread
19375charbits="$ans"
19376$rm_try
19377case "$charbits" in
193788)	;;
19379*)	cat >&4 << EOM
19380Your system has an unsigned character size of $charbits bits, which
19381is rather unusual (normally it is 8 bits).  Perl likely will not work
19382correctly on your system, with subtle bugs in various places.
19383EOM
19384	rp='Do you really want to continue?'
19385	dflt='n'
19386	. ./myread
19387	case "$ans" in
19388		[yY])	echo >&4 "Okay, continuing."	;;
19389		*)	exit 1				;;
19390	esac
19391esac
19392
19393: how do we concatenate cpp tokens here?
19394echo " "
19395echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19396$cat >cpp_stuff.c <<'EOCP'
19397#define RCAT(a,b)a/**/b
19398#define ACAT(a,b)a ## b
19399RCAT(Rei,ser)
19400ACAT(Cir,cus)
19401EOCP
19402$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19403if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19404	echo "Oh!  Smells like ANSI's been here." >&4
19405	echo "We can catify or stringify, separately or together!"
19406	cpp_stuff=42
19407elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19408	echo "Ah, yes!  The good old days!" >&4
19409	echo "However, in the good old days we don't know how to stringify and"
19410	echo "catify at the same time."
19411	cpp_stuff=1
19412else
19413	$cat >&4 <<EOM
19414Hmm, I don't seem to be able to concatenate tokens with your cpp.
19415You're going to have to edit the values of CAT[2-5] in config.h...
19416EOM
19417	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19418fi
19419$rm -f cpp_stuff.*
19420
19421: see if this is a db.h system
19422set db.h i_db
19423eval $inhdr
19424
19425case "$i_db" in
19426$define)
19427	: Check db version.
19428	echo " "
19429	echo "Checking Berkeley DB version ..." >&4
19430	$cat >try.c <<EOCP
19431#$d_const HASCONST
19432#ifndef HASCONST
19433#define const
19434#endif
19435#include <sys/types.h>
19436#include <stdio.h>
19437#$i_stdlib I_STDLIB
19438#ifdef I_STDLIB
19439#include <stdlib.h>
19440#endif
19441#include <db.h>
19442int main(int argc, char *argv[])
19443{
19444#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
19445    int Major, Minor, Patch ;
19446    unsigned long Version ;
19447    (void)db_version(&Major, &Minor, &Patch) ;
19448    if (argc == 2) {
19449        printf("%d %d %d %d %d %d\n",
19450               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19451               Major, Minor, Patch);
19452        exit(0);
19453    }
19454    printf("You have Berkeley DB Version 2 or greater.\n");
19455
19456    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19457		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19458    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19459		Major, Minor, Patch) ;
19460
19461    /* check that db.h & libdb are compatible */
19462    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19463	printf("db.h and libdb are incompatible.\n") ;
19464        exit(3);
19465    }
19466
19467    printf("db.h and libdb are compatible.\n") ;
19468
19469    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19470		+ DB_VERSION_PATCH ;
19471
19472    /* needs to be >= 2.3.4 */
19473    if (Version < 2003004) {
19474    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19475	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19476        exit(2);
19477    }
19478
19479    exit(0);
19480#else
19481#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19482    if (argc == 2) {
19483        printf("1 0 0\n");
19484        exit(0);
19485    }
19486    printf("You have Berkeley DB Version 1.\n");
19487    exit(0);	/* DB version < 2: the coast is clear. */
19488#else
19489    exit(1);	/* <db.h> not Berkeley DB? */
19490#endif
19491#endif
19492}
19493EOCP
19494	set try
19495	if eval $compile_ok && $run ./try; then
19496		echo 'Looks OK.' >&4
19497		set `$run ./try 1`
19498		db_version_major=$1
19499		db_version_minor=$2
19500		db_version_patch=$3
19501	else
19502		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19503		i_db=$undef
19504		case " $libs " in
19505		*"-ldb "*)
19506			: Remove db from list of libraries to use
19507			echo "Removing unusable -ldb from library list" >&4
19508			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19509			shift
19510			libs="$*"
19511			echo "libs = $libs" >&4
19512			;;
19513		esac
19514	fi
19515	$rm_try
19516	;;
19517esac
19518
19519case "$i_db" in
19520define)
19521	: Check the return type needed for hash
19522	echo " "
19523	echo "Checking return type needed for hash for Berkeley DB ..." >&4
19524	$cat >try.c <<EOCP
19525#$d_const HASCONST
19526#ifndef HASCONST
19527#define const
19528#endif
19529#include <sys/types.h>
19530#include <db.h>
19531
19532#ifndef DB_VERSION_MAJOR
19533u_int32_t hash_cb (ptr, size)
19534const void *ptr;
19535size_t size;
19536{
19537}
19538HASHINFO info;
19539int main()
19540{
19541	info.hash = hash_cb;
19542}
19543#endif
19544EOCP
19545	if $cc $ccflags -c try.c >try.out 2>&1 ; then
19546		if $contains warning try.out >>/dev/null 2>&1 ; then
19547			db_hashtype='int'
19548		else
19549			db_hashtype='u_int32_t'
19550		fi
19551	else
19552		: XXX Maybe we should just give up here.
19553		db_hashtype=u_int32_t
19554		$cat try.out >&4
19555		echo "Help:  I can't seem to compile the db test program." >&4
19556		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19557	fi
19558	$rm_try
19559	echo "Your version of Berkeley DB uses $db_hashtype for hash."
19560	;;
19561*)	db_hashtype=u_int32_t
19562	;;
19563esac
19564case "$i_db" in
19565define)
19566	: Check the return type needed for prefix
19567	echo " "
19568	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19569	cat >try.c <<EOCP
19570#$d_const HASCONST
19571#ifndef HASCONST
19572#define const
19573#endif
19574#include <sys/types.h>
19575#include <db.h>
19576
19577#ifndef DB_VERSION_MAJOR
19578size_t prefix_cb (key1, key2)
19579const DBT *key1;
19580const DBT *key2;
19581{
19582}
19583BTREEINFO info;
19584int main()
19585{
19586	info.prefix = prefix_cb;
19587}
19588#endif
19589EOCP
19590	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19591		if $contains warning try.out >>/dev/null 2>&1 ; then
19592			db_prefixtype='int'
19593		else
19594			db_prefixtype='size_t'
19595		fi
19596	else
19597		db_prefixtype='size_t'
19598		: XXX Maybe we should just give up here.
19599		$cat try.out >&4
19600		echo "Help:  I can't seem to compile the db test program." >&4
19601		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19602	fi
19603	$rm_try
19604	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19605	;;
19606*)	db_prefixtype='size_t'
19607	;;
19608esac
19609
19610: How can we generate normalized random numbers ?
19611echo " "
19612echo "Using our internal random number implementation..." >&4
19613
19614case "$ccflags" in
19615*-Dmy_rand=*|*-Dmy_srand=*)
19616	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19617	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19618	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19619	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19620	;;
19621esac
19622
19623randfunc=Perl_drand48
19624drand01="Perl_drand48()"
19625seedfunc="Perl_drand48_init"
19626randbits=48
19627randseedtype=U32
19628
19629: Check how to flush
19630echo " "
19631$cat >&4 <<EOM
19632Checking how to flush all pending stdio output...
19633EOM
19634# I only know how to find the first 32 possibly open files on SunOS.
19635# See also hints/sunos_4_1.sh and util.c  --AD
19636case "$osname" in
19637sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19638esac
19639$cat >>try.c <<EOCP
19640#include <stdio.h>
19641#$i_stdlib I_STDLIB
19642#ifdef I_STDLIB
19643#include <stdlib.h>
19644#endif
19645#$i_unistd I_UNISTD
19646#ifdef I_UNISTD
19647# include <unistd.h>
19648#endif
19649#$d_sysconf HAS_SYSCONF
19650#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19651#ifdef HAS_STDIO_STREAM_ARRAY
19652# define STDIO_STREAM_ARRAY $stdio_stream_array
19653#endif
19654int main() {
19655  FILE* p;
19656  unlink("try.out");
19657  p = fopen("try.out", "w");
19658#ifdef TRY_FPUTC
19659  fputc('x', p);
19660#else
19661# ifdef TRY_FPRINTF
19662  fprintf(p, "x");
19663# endif
19664#endif
19665#ifdef TRY_FFLUSH_NULL
19666  fflush(NULL);
19667#endif
19668#ifdef TRY_FFLUSH_ALL
19669  {
19670    long open_max = -1;
19671# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19672    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19673# else
19674#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19675    open_max = sysconf(_SC_OPEN_MAX);
19676#  else
19677#   ifdef FOPEN_MAX
19678    open_max = FOPEN_MAX;
19679#   else
19680#    ifdef OPEN_MAX
19681    open_max = OPEN_MAX;
19682#    else
19683#     ifdef _NFILE
19684    open_max = _NFILE;
19685#     endif
19686#    endif
19687#   endif
19688#  endif
19689# endif
19690# ifdef HAS_STDIO_STREAM_ARRAY
19691    if (open_max > 0) {
19692      long i;
19693      for (i = 0; i < open_max; i++)
19694	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19695		STDIO_STREAM_ARRAY[i]._file < open_max &&
19696		STDIO_STREAM_ARRAY[i]._flag)
19697		fflush(&STDIO_STREAM_ARRAY[i]);
19698    }
19699  }
19700# endif
19701#endif
19702  _exit(42);
19703}
19704EOCP
19705: first we have to find out how _not_ to flush
19706$to try.c
19707if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19708    output=''
19709    set try -DTRY_FPUTC
19710    if eval $compile; then
19711	    $run ./try 2>/dev/null
19712	    code="$?"
19713	    $from try.out
19714	    if $test ! -s try.out -a "X$code" = X42; then
19715		output=-DTRY_FPUTC
19716	    fi
19717    fi
19718    case "$output" in
19719    '')
19720	    set try -DTRY_FPRINTF
19721	    if eval $compile; then
19722		    $run ./try 2>/dev/null
19723		    code="$?"
19724		    $from try.out
19725		    if $test ! -s try.out -a "X$code" = X42; then
19726			output=-DTRY_FPRINTF
19727		    fi
19728	    fi
19729	;;
19730    esac
19731fi
19732: check for fflush NULL behavior
19733case "$fflushNULL" in
19734'') 	set try -DTRY_FFLUSH_NULL $output
19735	if eval $compile; then
19736		$run ./try 2>/dev/null
19737		code="$?"
19738		$from try.out
19739		if $test -s try.out -a "X$code" = X42; then
19740			fflushNULL="`$cat try.out`"
19741		else
19742			if $test "X$code" != X42; then
19743				$cat >&4 <<EOM
19744(If this test failed, don't worry, we'll try another method shortly.)
19745EOM
19746			fi
19747		fi
19748	fi
19749	$rm -f core try.core core.try.*
19750	case "$fflushNULL" in
19751	x)	$cat >&4 <<EOM
19752Your fflush(NULL) works okay for output streams.
19753Let's see if it clobbers input pipes...
19754EOM
19755# As of mid-March 2000 all versions of Solaris appear to have a stdio
19756# bug that improperly flushes the input end of pipes.  So we avoid the
19757# autoflush on fork/system/exec support for now. :-(
19758$cat >tryp.c <<EOCP
19759#include <stdio.h>
19760int
19761main(int argc, char **argv)
19762{
19763    char buf[1024];
19764    int i;
19765    char *bp = buf;
19766    while (1) {
19767	while ((i = getc(stdin)) != -1
19768	       && (*bp++ = i) != '\n'
19769	       && bp < &buf[1024])
19770	/* DO NOTHING */ ;
19771	*bp = '\0';
19772	fprintf(stdout, "%s", buf);
19773	fflush(NULL);
19774	if (i == -1)
19775	    return 0;
19776	bp = buf;
19777    }
19778}
19779EOCP
19780		fflushNULL="$define"
19781		set tryp
19782		if eval $compile; then
19783		    $rm -f tryp.out
19784		    # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19785		    if $test "X$targethost" != X; then
19786			$to tryp.c
19787			$to tryp
19788			$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19789		    else
19790			$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19791		    fi
19792		    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19793		       $cat >&4 <<EOM
19794fflush(NULL) seems to behave okay with input streams.
19795EOM
19796			fflushNULL="$define"
19797		    else
19798			$cat >&4 <<EOM
19799Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19800EOM
19801			fflushNULL="$undef"
19802		    fi
19803		fi
19804		$rm -f core tryp.c tryp.core core.tryp.*
19805		;;
19806	'')	$cat >&4 <<EOM
19807Your fflush(NULL) isn't working (contrary to ANSI C).
19808EOM
19809		fflushNULL="$undef"
19810		;;
19811	*)	$cat >&4 <<EOM
19812Cannot figure out whether your fflush(NULL) works or not.
19813I'm assuming it doesn't (contrary to ANSI C).
19814EOM
19815		fflushNULL="$undef"
19816		;;
19817	esac
19818	;;
19819$define|true|[yY]*)
19820	fflushNULL="$define"
19821	;;
19822*)
19823	fflushNULL="$undef"
19824	;;
19825esac
19826: check explicit looping only if NULL did not work, and if the pipe
19827: bug does not show up on an explicit flush too
19828case "$fflushNULL" in
19829"$undef")
19830	$cat >tryp.c <<EOCP
19831#include <stdio.h>
19832int
19833main(int argc, char **argv)
19834{
19835    char buf[1024];
19836    int i;
19837    char *bp = buf;
19838    while (1) {
19839	while ((i = getc(stdin)) != -1
19840	       && (*bp++ = i) != '\n'
19841	       && bp < &buf[1024])
19842	/* DO NOTHING */ ;
19843	*bp = '\0';
19844	fprintf(stdout, "%s", buf);
19845	fflush(stdin);
19846	if (i == -1)
19847	    return 0;
19848	bp = buf;
19849    }
19850}
19851EOCP
19852	set tryp
19853	if eval $compile; then
19854	    $rm -f tryp.out
19855	    if $test "X$targethost" != X; then
19856		$to tryp.c
19857		$to tryp
19858		$run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19859	    else
19860		$cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19861	    fi
19862	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19863	       $cat >&4 <<EOM
19864Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19865EOM
19866		: now check for fflushall behaviour
19867		case "$fflushall" in
19868		'') 	set try -DTRY_FFLUSH_ALL $output
19869			if eval $compile; then
19870				$cat >&4 <<EOM
19871(Now testing the other method--but note that this also may fail.)
19872EOM
19873				$run ./try 2>/dev/null
19874				code=$?
19875				$from try.out
19876				if $test -s try.out -a "X$code" = X42; then
19877					fflushall="`$cat try.out`"
19878				fi
19879			fi
19880			$rm_try
19881			case "$fflushall" in
19882			x)	$cat >&4 <<EOM
19883Whew. Flushing explicitly all the stdio streams works.
19884EOM
19885				fflushall="$define"
19886				;;
19887			'')	$cat >&4 <<EOM
19888Sigh. Flushing explicitly all the stdio streams doesn't work.
19889EOM
19890				fflushall="$undef"
19891				;;
19892			*)	$cat >&4 <<EOM
19893Cannot figure out whether flushing stdio streams explicitly works or not.
19894I'm assuming it doesn't.
19895EOM
19896				fflushall="$undef"
19897				;;
19898			esac
19899			;;
19900		"$define"|true|[yY]*)
19901			fflushall="$define"
19902			;;
19903		*)
19904			fflushall="$undef"
19905			;;
19906		esac
19907	    else
19908		$cat >&4 <<EOM
19909All is futile.  Even fflush(stdin) clobbers input pipes!
19910EOM
19911		fflushall="$undef"
19912	    fi
19913	else
19914	    fflushall="$undef"
19915	fi
19916	$rm -f core tryp.c tryp.core core.tryp.*
19917	;;
19918*)	fflushall="$undef"
19919	;;
19920esac
19921
19922case "$fflushNULL$fflushall" in
19923undefundef)
19924	$cat <<EOM
19925OK, I give up.  I cannot figure out how to flush pending stdio output.
19926We won't be flushing handles at all before fork/exec/popen.
19927EOM
19928	;;
19929esac
19930$rm_try tryp
19931
19932: Store the full pathname to the ar program for use in the C program
19933: Respect a hint or command line value for full_ar.
19934case "$full_ar" in
19935'') full_ar=$ar ;;
19936esac
19937
19938: Store the full pathname to the sed program for use in the C program
19939full_sed=$sed
19940
19941: see what type gids are declared as in the kernel
19942echo " "
19943echo "Looking for the type for group ids returned by getgid()."
19944set gid_t gidtype xxx stdio.h sys/types.h
19945eval $typedef
19946case "$gidtype" in
19947xxx)
19948	xxx=`./findhdr sys/user.h`
19949	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19950	case $1 in
19951	unsigned) dflt="$1 $2" ;;
19952	*) dflt="$1" ;;
19953	esac
19954	;;
19955*) dflt="$gidtype";;
19956esac
19957case "$gidtype" in
19958gid_t) echo "gid_t found." ;;
19959*)	rp="What is the type for group ids returned by getgid()?"
19960	. ./myread
19961	gidtype="$ans"
19962	;;
19963esac
19964
19965: Check the size of GID
19966echo " "
19967case "$gidtype" in
19968*_t) zzz="$gidtype"	;;
19969*)   zzz="gid"		;;
19970esac
19971echo "Checking the size of $zzz..." >&4
19972cat > try.c <<EOCP
19973#include <sys/types.h>
19974#include <stdio.h>
19975#$i_stdlib I_STDLIB
19976#ifdef I_STDLIB
19977#include <stdlib.h>
19978#endif
19979int main() {
19980    printf("%d\n", (int)sizeof($gidtype));
19981    exit(0);
19982}
19983EOCP
19984set try
19985if eval $compile_ok; then
19986	yyy=`$run ./try`
19987	case "$yyy" in
19988	'')	gidsize=4
19989		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19990		;;
19991	*)	gidsize=$yyy
19992		echo "Your $zzz is $gidsize bytes long."
19993		;;
19994	esac
19995else
19996	gidsize=4
19997	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19998fi
19999
20000
20001: Check if GID is signed
20002echo " "
20003case "$gidtype" in
20004*_t) zzz="$gidtype"	;;
20005*)   zzz="gid"		;;
20006esac
20007echo "Checking the sign of $zzz..." >&4
20008cat > try.c <<EOCP
20009#include <sys/types.h>
20010#include <stdio.h>
20011int main() {
20012	$gidtype foo = -1;
20013	if (foo < 0)
20014		printf("-1\n");
20015	else
20016		printf("1\n");
20017}
20018EOCP
20019set try
20020if eval $compile; then
20021	yyy=`$run ./try`
20022	case "$yyy" in
20023	'')	gidsign=1
20024		echo "(I can't execute the test program--guessing unsigned.)" >&4
20025		;;
20026	*)	gidsign=$yyy
20027		case "$gidsign" in
20028		 1) echo "Your $zzz is unsigned." ;;
20029		-1) echo "Your $zzz is signed."   ;;
20030		esac
20031		;;
20032	esac
20033else
20034	gidsign=1
20035	echo "(I can't compile the test program--guessing unsigned.)" >&4
20036fi
20037
20038
20039: Check 64bit sizes
20040echo " "
20041
20042if $test X"$quadtype" != X; then
20043
20044echo "Checking how to print 64-bit integers..." >&4
20045
20046if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20047	$cat >try.c <<'EOCP'
20048#include <sys/types.h>
20049#include <stdio.h>
20050int main() {
20051  int q = 12345678901;
20052  printf("%ld\n", q);
20053}
20054EOCP
20055	set try
20056	if eval $compile; then
20057		yyy=`$run ./try`
20058		case "$yyy" in
20059		12345678901)
20060			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20061                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20062			echo "We will use %d."
20063			;;
20064		esac
20065	fi
20066fi
20067
20068if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20069	$cat >try.c <<'EOCP'
20070#include <sys/types.h>
20071#include <stdio.h>
20072int main() {
20073  long q = 12345678901;
20074  printf("%ld\n", q);
20075}
20076EOCP
20077	set try
20078	if eval $compile; then
20079		yyy=`$run ./try`
20080		case "$yyy" in
20081		12345678901)
20082			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20083                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20084			echo "We will use %ld."
20085			;;
20086		esac
20087	fi
20088fi
20089
20090if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20091	$cat >try.c <<'EOCP'
20092#include <sys/types.h>
20093#include <inttypes.h>
20094#include <stdio.h>
20095int main() {
20096  int64_t q = 12345678901;
20097  printf("%" PRId64 "\n", q);
20098}
20099EOCP
20100	set try
20101	if eval $compile; then
20102		yyy=`$run ./try`
20103		case "$yyy" in
20104		12345678901)
20105			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20106                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20107			echo "We will use the C9X style."
20108			;;
20109		esac
20110	fi
20111fi
20112
20113if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20114	$cat >try.c <<EOCP
20115#include <sys/types.h>
20116#include <stdio.h>
20117int main() {
20118  $quadtype q = 12345678901;
20119  printf("%Ld\n", q);
20120}
20121EOCP
20122	set try
20123	if eval $compile; then
20124		yyy=`$run ./try`
20125		case "$yyy" in
20126		12345678901)
20127			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20128                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20129			echo "We will use %Ld."
20130			;;
20131		esac
20132	fi
20133fi
20134
20135if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20136	$cat >try.c <<'EOCP'
20137#include <sys/types.h>
20138#include <stdio.h>
20139int main() {
20140  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20141  printf("%lld\n", q);
20142}
20143EOCP
20144	set try
20145	if eval $compile; then
20146		yyy=`$run ./try`
20147		case "$yyy" in
20148		12345678901)
20149			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20150                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20151			echo "We will use the %lld style."
20152			;;
20153		esac
20154	fi
20155fi
20156
20157if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20158	$cat >try.c <<EOCP
20159#include <sys/types.h>
20160#include <stdio.h>
20161int main() {
20162  $quadtype q = 12345678901;
20163  printf("%qd\n", q);
20164}
20165EOCP
20166	set try
20167	if eval $compile; then
20168		yyy=`$run ./try`
20169		case "$yyy" in
20170		12345678901)
20171			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20172                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20173			echo "We will use %qd."
20174			;;
20175		esac
20176	fi
20177fi
20178
20179if $test X"$sPRId64" = X; then
20180	echo "Cannot figure out how to print 64-bit integers." >&4
20181fi
20182$rm_try
20183
20184fi
20185
20186case "$sPRId64" in
20187'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20188	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20189	;;
20190*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20191	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20192	;;
20193esac
20194
20195: Check format strings for internal types
20196echo " "
20197$echo "Checking the format strings to be used for Perl's internal types..." >&4
20198
20199if $test X"$ivsize" = X8; then
20200	ivdformat="$sPRId64"
20201	uvuformat="$sPRIu64"
20202	uvoformat="$sPRIo64"
20203	uvxformat="$sPRIx64"
20204	uvXUformat="$sPRIXU64"
20205else
20206	if $test X"$ivsize" = X"$longsize"; then
20207		ivdformat='"ld"'
20208		uvuformat='"lu"'
20209		uvoformat='"lo"'
20210		uvxformat='"lx"'
20211		uvXUformat='"lX"'
20212	else
20213		if $test X"$ivsize" = X"$intsize"; then
20214			ivdformat='"d"'
20215			uvuformat='"u"'
20216			uvoformat='"o"'
20217			uvxformat='"x"'
20218			uvXUformat='"X"'
20219		else
20220			: far out
20221			if $test X"$ivsize" = X"$shortsize"; then
20222				ivdformat='"hd"'
20223				uvuformat='"hu"'
20224				uvoformat='"ho"'
20225				uvxformat='"hx"'
20226				uvXUformat='"hX"'
20227			fi
20228		fi
20229	fi
20230fi
20231
20232if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20233	nveformat="$sPRIeldbl"
20234	nvfformat="$sPRIfldbl"
20235	nvgformat="$sPRIgldbl"
20236	nvEUformat="$sPRIEUldbl"
20237	nvFUformat="$sPRIFUldbl"
20238	nvGUformat="$sPRIGUldbl"
20239else
20240	nveformat='"e"'
20241	nvfformat='"f"'
20242	nvgformat='"g"'
20243	nvEUformat='"E"'
20244	nvFUformat='"F"'
20245	nvGUformat='"G"'
20246fi
20247
20248case "$ivdformat" in
20249'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20250    exit 1
20251    ;;
20252esac
20253
20254: Check format string for GID
20255
20256echo " "
20257$echo "Checking the format string to be used for gids..." >&4
20258
20259case "$gidsign" in
20260-1)	if $test X"$gidsize" = X"$ivsize"; then
20261		gidformat="$ivdformat"
20262	else
20263		if $test X"$gidsize" = X"$longsize"; then
20264			gidformat='"ld"'
20265		else
20266			if $test X"$gidsize" = X"$intsize"; then
20267				gidformat='"d"'
20268			else
20269				if $test X"$gidsize" = X"$shortsize"; then
20270					gidformat='"hd"'
20271				fi
20272			fi
20273		fi
20274	fi
20275	;;
20276*)	if $test X"$gidsize" = X"$uvsize"; then
20277		gidformat="$uvuformat"
20278	else
20279		if $test X"$gidsize" = X"$longsize"; then
20280			gidformat='"lu"'
20281		else
20282			if $test X"$gidsize" = X"$intsize"; then
20283				gidformat='"u"'
20284			else
20285				if $test X"$gidsize" = X"$shortsize"; then
20286					gidformat='"hu"'
20287				fi
20288			fi
20289		fi
20290	fi
20291	;;
20292esac
20293
20294: see if getgroups exists
20295set getgroups d_getgrps
20296eval $inlibc
20297
20298: see if setgroups exists
20299set setgroups d_setgrps
20300eval $inlibc
20301
20302: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20303echo " "
20304case "$d_getgrps$d_setgrps" in
20305*define*)
20306	case "$groupstype" in
20307	'') dflt="$gidtype" ;;
20308	*)  dflt="$groupstype" ;;
20309	esac
20310	$cat <<EOM
20311What type of pointer is the second argument to getgroups() and setgroups()?
20312Usually this is the same as group ids, $gidtype, but not always.
20313
20314EOM
20315	rp='What type pointer is the second argument to getgroups() and setgroups()?'
20316	. ./myread
20317	groupstype="$ans"
20318	;;
20319*)  groupstype="$gidtype";;
20320esac
20321
20322: MAD = Misc Attribute Definition
20323
20324if $test $patchlevel -lt 9; then
20325: MAD is not available in 5.8.x or earlier.
20326    ans=n;
20327else
20328    case "$mad" in
20329    $define|true|[yY]*)	dflt='y' ;;
20330    *)			dflt='n' ;;
20331    esac
20332    cat <<EOM
20333
20334Would you like to build with Misc Attribute Decoration? This is development
20335work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20336overhead on the interpreter.
20337
20338If this doesn't make any sense to you, just accept the default '$dflt'.
20339EOM
20340    rp='Build Perl with MAD?'
20341    . ./myread
20342fi
20343case "$ans" in
20344y|Y)	val="$define"
20345	madlyh='madly.h madly.act madly.tab'
20346	madlysrc='madly.c'
20347	madlyobj="madly$_o" ;;
20348*)	val="$undef"
20349	madlyh=''
20350	madlysrc=''
20351	madlyobj='' ;;
20352esac
20353set mad
20354eval $setvar
20355
20356: check whether make sets MAKE
20357echo " "
20358echo "Checking if your $make program sets \$(MAKE)..." >&4
20359case "$make_set_make" in
20360'')
20361	$sed 's/^X //' > testmake.mak << 'EOF'
20362Xall:
20363X 	@echo 'maketemp="$(MAKE)"'
20364EOF
20365	case "`$make -f testmake.mak 2>/dev/null`" in
20366	*maketemp=*) make_set_make='#' ;;
20367	*)	make_set_make="MAKE=$make" ;;
20368	esac
20369	$rm -f testmake.mak
20370	;;
20371esac
20372case "$make_set_make" in
20373'#') echo "Yup, it does.";;
20374*) echo "Nope, it doesn't.";;
20375esac
20376
20377: see what type is used for mode_t
20378rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20379set mode_t modetype int stdio.h sys/types.h
20380eval $typedef_ask
20381
20382: see if we need va_copy
20383echo " "
20384case "$i_stdarg" in
20385"$define")
20386	$cat >try.c <<EOCP
20387#include <stdarg.h>
20388#include <stdio.h>
20389#$i_stdlib I_STDLIB
20390#ifdef I_STDLIB
20391#include <stdlib.h>
20392#endif
20393#include <signal.h>
20394
20395int
20396ivfprintf(FILE *f, const char *fmt, va_list *valp)
20397{
20398  return vfprintf(f, fmt, *valp);
20399}
20400
20401int
20402myvfprintf(FILE *f, const  char *fmt, va_list val)
20403{
20404  return ivfprintf(f, fmt, &val);
20405}
20406
20407int
20408myprintf(char *fmt, ...)
20409{
20410  va_list val;
20411  va_start(val, fmt);
20412  return myvfprintf(stdout, fmt, val);
20413}
20414
20415int
20416main(int ac, char **av)
20417{
20418  signal(SIGSEGV, exit);
20419
20420  myprintf("%s%cs all right, then\n", "that", '\'');
20421  exit(0);
20422}
20423EOCP
20424	set try
20425	if eval $compile && $run ./try 2>&1 >/dev/null; then
20426		case "`$run ./try`" in
20427		"that's all right, then")
20428			okay=yes
20429			;;
20430		esac
20431	fi
20432	case "$okay" in
20433	yes)	echo "It seems that you don't need va_copy()." >&4
20434		need_va_copy="$undef"
20435		;;
20436	*)	echo "It seems that va_copy() or similar will be needed." >&4
20437		need_va_copy="$define"
20438		;;
20439	esac
20440	$rm_try
20441	;;
20442*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20443	need_va_copy="$undef"
20444	;;
20445esac
20446
20447: see what type is used for size_t
20448rp="What is the type used for the length parameter for string functions?"
20449set size_t sizetype 'unsigned int' stdio.h sys/types.h
20450eval $typedef_ask
20451
20452: check for type of arguments to gethostbyaddr.
20453if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20454	case "$d_gethbyaddr" in
20455	$define)
20456		$cat <<EOM
20457
20458Checking to see what type of arguments are accepted by gethostbyaddr().
20459EOM
20460		hdrs="$define sys/types.h
20461			$d_socket sys/socket.h
20462			$i_niin netinet/in.h
20463			$i_netdb netdb.h
20464			$i_unistd unistd.h"
20465		: The first arg can 'char *' or 'void *'
20466		: The second arg is some of integral type
20467		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20468			for yyy in size_t long int; do
20469				case "$netdb_host_type" in
20470				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20471					if ./protochk "$try" $hdrs; then
20472						echo "Your system accepts $xxx for the first arg."
20473						echo "...and $yyy for the second arg."
20474						netdb_host_type="$xxx"
20475						netdb_hlen_type="$yyy"
20476					fi
20477					;;
20478				esac
20479			done
20480		done
20481		: In case none of those worked, prompt the user.
20482		case "$netdb_host_type" in
20483		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
20484			dflt='char *'
20485			. ./myread
20486			netdb_host_type=$ans
20487			rp='What is the type for the 2nd argument to gethostbyaddr?'
20488			dflt="$sizetype"
20489			. ./myread
20490			netdb_hlen_type=$ans
20491			;;
20492		esac
20493		;;
20494	*)	: no gethostbyaddr, so pick harmless defaults
20495		netdb_host_type='char *'
20496		netdb_hlen_type="$sizetype"
20497		;;
20498	esac
20499	# Remove the "const" if needed. -- but then we'll have a
20500	# prototype clash!
20501	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20502fi
20503
20504: check for type of argument to gethostbyname.
20505if test "X$netdb_name_type" = X ; then
20506	case "$d_gethbyname" in
20507	$define)
20508		$cat <<EOM
20509
20510Checking to see what type of argument is accepted by gethostbyname().
20511EOM
20512		hdrs="$define sys/types.h
20513			$d_socket sys/socket.h
20514			$i_niin netinet/in.h
20515			$i_netdb netdb.h
20516			$i_unistd unistd.h"
20517		for xxx in "const char *" "char *"; do
20518			case "$netdb_name_type" in
20519			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
20520				if ./protochk "$try" $hdrs; then
20521					echo "Your system accepts $xxx."
20522					netdb_name_type="$xxx"
20523				fi
20524				;;
20525			esac
20526		done
20527		: In case none of those worked, prompt the user.
20528		case "$netdb_name_type" in
20529		'')	rp='What is the type for the 1st argument to gethostbyname?'
20530			dflt='char *'
20531			. ./myread
20532			netdb_name_type=$ans
20533			;;
20534		esac
20535		;;
20536	*)	: no gethostbyname, so pick harmless default
20537		netdb_name_type='char *'
20538		;;
20539	esac
20540fi
20541
20542: check for type of 1st argument to getnetbyaddr.
20543if test "X$netdb_net_type" = X ; then
20544	case "$d_getnbyaddr" in
20545	$define)
20546		$cat <<EOM
20547
20548Checking to see what type of 1st argument is accepted by getnetbyaddr().
20549EOM
20550		hdrs="$define sys/types.h
20551			$d_socket sys/socket.h
20552			$i_niin netinet/in.h
20553			$i_netdb netdb.h
20554			$i_unistd unistd.h"
20555		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20556			case "$netdb_net_type" in
20557			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20558				if ./protochk "$try" $hdrs; then
20559					echo "Your system accepts $xxx."
20560					netdb_net_type="$xxx"
20561				fi
20562				;;
20563			esac
20564		done
20565		: In case none of those worked, prompt the user.
20566		case "$netdb_net_type" in
20567		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
20568			dflt='long'
20569			. ./myread
20570			netdb_net_type=$ans
20571			;;
20572		esac
20573		;;
20574	*)	: no getnetbyaddr, so pick harmless default
20575		netdb_net_type='long'
20576		;;
20577	esac
20578fi
20579: locate the preferred pager for this system
20580fn=f/
20581case "$pager" in
20582'')
20583	dflt=''
20584	case "$pg" in
20585	/*) dflt=$pg;;
20586	[a-zA-Z]:/*) dflt=$pg;;
20587	esac
20588	case "$more" in
20589	/*) dflt=$more;;
20590	[a-zA-Z]:/*) dflt=$more;;
20591	esac
20592	case "$less" in
20593	/*) dflt=$less;;
20594	[a-zA-Z]:/*) dflt=$less;;
20595	esac
20596	case "$dflt" in
20597	'') dflt=/usr/ucb/more;;
20598	esac
20599	;;
20600*)	dflt="$pager"
20601	;;
20602esac
20603fn="f/($dflt)"
20604echo " "
20605rp='What pager is used on your system?'
20606. ./getfile
20607pager="$ans"
20608
20609: see what type pids are declared as in the kernel
20610rp="What is the type of process ids on this system?"
20611set pid_t pidtype int stdio.h sys/types.h
20612eval $typedef_ask
20613
20614: see if ar generates random libraries by itself
20615echo " "
20616echo "Checking how to generate random libraries on your machine..." >&4
20617echo 'int bar1() { return bar2(); }' > bar1.c
20618echo 'int bar2() { return 2; }' > bar2.c
20619$cat > foo.c <<EOP
20620#$i_stdlib I_STDLIB
20621#ifdef I_STDLIB
20622#include <stdlib.h>
20623#endif
20624int main() { printf("%d\n", bar1()); exit(0); }
20625EOP
20626$cc $ccflags -c bar1.c >/dev/null 2>&1
20627$cc $ccflags -c bar2.c >/dev/null 2>&1
20628$cc $ccflags -c foo.c >/dev/null 2>&1
20629$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20630if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20631	$run ./foobar >/dev/null 2>&1; then
20632	echo "$ar appears to generate random libraries itself."
20633	orderlib=false
20634	if [ "X$ranlib" = "X" ]; then
20635	    ranlib=":"
20636	fi
20637elif $ar s bar$_a >/dev/null 2>&1 &&
20638	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20639	$run ./foobar >/dev/null 2>&1; then
20640		echo "a table of contents needs to be added with '$ar s'."
20641		orderlib=false
20642		ranlib="$ar s"
20643elif $ar ts bar$_a >/dev/null 2>&1 &&
20644	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20645	$run ./foobar >/dev/null 2>&1; then
20646		echo "a table of contents needs to be added with '$ar ts'."
20647		orderlib=false
20648		ranlib="$ar ts"
20649else
20650	case "$ranlib" in
20651	:) ranlib='';;
20652	'')
20653		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20654		$test -f $ranlib || ranlib=''
20655		;;
20656	esac
20657	if $test -n "$ranlib"; then
20658		echo "your system has '$ranlib'; we'll use that."
20659		orderlib=false
20660	else
20661		echo "your system doesn't seem to support random libraries"
20662		echo "so we'll use lorder and tsort to order the libraries."
20663		orderlib=true
20664		ranlib=":"
20665	fi
20666fi
20667$rm -f foo* bar*
20668
20669: see if this is a values.h system
20670set values.h i_values
20671eval $inhdr
20672
20673: Check the max offset that gmtime and localtime accept
20674echo "Checking max offsets that gmtime () accepts"
20675
20676case $i_values in
20677    define) yyy="#include <values.h>" ;;
20678    *)      yyy="" ;;
20679    esac
20680
20681case "$sGMTIME_min/$sGMTIME_max" in
20682    0/0|/)
20683	$cat >try.c <<EOCP
20684#include <sys/types.h>
20685#include <stdio.h>
20686#include <time.h>
20687$yyy
20688
20689int i;
20690struct tm *tmp;
20691time_t pt;
20692
20693void gm_check (time_t t, int min_year, int max_year)
20694{
20695    tmp = gmtime (&t);
20696    if ( tmp == NULL ||
20697	/* Check tm_year overflow */
20698	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20699	tmp = NULL;
20700    else
20701	pt = t;
20702    } /* gm_check */
20703
20704int check_max ()
20705{
20706    tmp = NULL;
20707    pt  = 0;
20708#ifdef MAXLONG
20709    gm_check (MAXLONG, 69, 0x7fffffff);
20710#endif
20711    if (tmp == NULL || tmp->tm_year < 0) {
20712	for (i = 63; i >= 0; i--) {
20713	    time_t x = pt | ((time_t)1 << i);
20714	    if (x < 0 || x < pt) continue;
20715	    gm_check (x, 69, 0x7fffffff);
20716	    }
20717	}
20718    printf ("sGMTIME_max=%ld\n", pt);
20719    return (0);
20720    } /* check_max */
20721
20722int check_min ()
20723{
20724    tmp = NULL;
20725    pt  = 0;
20726#ifdef MINLONG
20727    gm_check (MINLONG, -1900, 70);
20728#endif
20729    if (tmp == NULL) {
20730	for (i = 36; i >= 0; i--) {
20731	    time_t x = pt - ((time_t)1 << i);
20732	    if (x > 0) continue;
20733	    gm_check (x, -1900, 70);
20734	    }
20735	}
20736    printf ("sGMTIME_min=%ld\n", pt);
20737    return (0);
20738    } /* check_min */
20739
20740int main (int argc, char *argv[])
20741{
20742    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20743    check_max ();
20744    check_min ();
20745    return (0);
20746    } /* main */
20747EOCP
20748	set try
20749	if eval $compile; then
20750	    eval `$run ./try`
20751	else
20752	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20753	    fi
20754	$rm_try
20755	;;
20756    esac
20757
20758echo "Checking max offsets that localtime () accepts"
20759
20760case "$sLOCALTIME_min/$sLOCALTIME_max" in
20761    0/0|/)
20762	$cat >try.c <<EOCP
20763#include <sys/types.h>
20764#include <stdio.h>
20765#include <time.h>
20766$yyy
20767
20768int i;
20769struct tm *tmp;
20770time_t pt;
20771
20772void local_check (time_t t, int min_year, int max_year)
20773{
20774    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20775	tmp = NULL;
20776    else
20777	tmp = localtime (&t);
20778    if ( tmp == NULL ||
20779	/* Check tm_year overflow */
20780	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20781	tmp = NULL;
20782    else
20783	pt = t;
20784    } /* local_check */
20785
20786int check_max ()
20787{
20788    tmp = NULL;
20789    pt  = 0;
20790#ifdef MAXLONG
20791    local_check (MAXLONG, 69, 0x7fffffff);
20792#endif
20793    if (tmp == NULL || tmp->tm_year < 0) {
20794	for (i = 63; i >= 0; i--) {
20795	    time_t x = pt | ((time_t)1 << i);
20796	    if (x < 0 || x < pt) continue;
20797	    local_check (x, 69, 0x7fffffff);
20798	    }
20799	}
20800    printf ("sLOCALTIME_max=%ld\n", pt);
20801    return (0);
20802   } /* check_max */
20803
20804int check_min ()
20805{
20806    tmp = NULL;
20807    pt  = 0;
20808#ifdef MINLONG
20809    local_check (MINLONG, -1900, 70);
20810#endif
20811    if (tmp == NULL) {
20812	for (i = 36; i >= 0; i--) {
20813	    time_t x = pt - ((time_t)1 << i);
20814	    if (x > 0) continue;
20815	    local_check (x, -1900, 70);
20816	    }
20817	}
20818    printf ("sLOCALTIME_min=%ld\n", pt);
20819    return (0);
20820    } /* check_min */
20821
20822int main (int argc, char *argv[])
20823{
20824    check_max ();
20825    check_min ();
20826    return (0);
20827    } /* main */
20828EOCP
20829	set try
20830	if eval $compile; then
20831	    eval `$run ./try`
20832	else
20833	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20834	    fi
20835	$rm_try
20836	;;
20837    esac
20838
20839: check for type of arguments to select.
20840case "$selecttype" in
20841'') case "$d_select" in
20842	$define)
20843		echo " "
20844		$cat <<EOM
20845Checking to see what type of arguments are accepted by select().
20846EOM
20847		hdrs="$define sys/types.h
20848			$i_systime sys/time.h
20849			$i_sysselct sys/select.h
20850			$d_socket sys/socket.h"
20851		: The first arg can be int, unsigned, or size_t
20852		: The last arg may or may not be 'const'
20853		val=''
20854		: void pointer has been seen but using that
20855		: breaks the selectminbits test
20856		for xxx in 'fd_set *' 'int *'; do
20857			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20858				for tmo in 'struct timeval *' 'const struct timeval *'; do
20859					case "$val" in
20860					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20861						if ./protochk "$try" $hdrs; then
20862							echo "Your system accepts $xxx."
20863							val="$xxx"
20864						fi
20865						;;
20866					esac
20867				done
20868			done
20869		done
20870		case "$val" in
20871		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20872			case "$d_fd_set" in
20873				$define) dflt="fd_set *" ;;
20874				*)		dflt="int *" ;;
20875			esac
20876			. ./myread
20877			val=$ans
20878			;;
20879		esac
20880		selecttype="$val"
20881		;;
20882	*)	: no select, so pick a harmless default
20883		selecttype='int *'
20884		;;
20885	esac
20886	;;
20887esac
20888
20889: check for the select 'width'
20890case "$selectminbits" in
20891'') safebits=`expr $ptrsize \* 8`
20892    case "$d_select" in
20893	$define)
20894		$cat <<EOM
20895
20896Checking to see on how many bits at a time your select() operates...
20897EOM
20898		$cat >try.c <<EOCP
20899#include <sys/types.h>
20900#$i_time I_TIME
20901#$i_systime I_SYS_TIME
20902#$i_systimek I_SYS_TIME_KERNEL
20903#ifdef I_TIME
20904#   include <time.h>
20905#endif
20906#ifdef I_SYS_TIME
20907#   ifdef I_SYS_TIME_KERNEL
20908#	define KERNEL
20909#   endif
20910#   include <sys/time.h>
20911#   ifdef I_SYS_TIME_KERNEL
20912#	undef KERNEL
20913#   endif
20914#endif
20915#$i_sysselct I_SYS_SELECT
20916#ifdef I_SYS_SELECT
20917#include <sys/select.h>
20918#endif
20919#$d_socket HAS_SOCKET
20920#ifdef HAS_SOCKET
20921#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20922#endif
20923#include <stdio.h>
20924#$i_stdlib I_STDLIB
20925#ifdef I_STDLIB
20926#include <stdlib.h>
20927#endif
20928$selecttype b;
20929#define S sizeof(*(b))
20930#define MINBITS	64
20931#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20932#define NBITS  (NBYTES * 8)
20933int main() {
20934    char *s = (char *)malloc(NBYTES);
20935    struct timeval t;
20936    int i;
20937    FILE* fp;
20938    int fd;
20939
20940    if (!s)
20941	exit(1);
20942    fclose(stdin);
20943    fp = fopen("try.c", "r");
20944    if (fp == 0)
20945      exit(2);
20946    fd = fileno(fp);
20947    if (fd < 0)
20948      exit(3);
20949    b = ($selecttype)s;
20950    for (i = 0; i < NBITS; i++)
20951	FD_SET(i, b);
20952    t.tv_sec  = 0;
20953    t.tv_usec = 0;
20954    select(fd + 1, b, 0, 0, &t);
20955    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20956    free(s);
20957    printf("%d\n", i + 1);
20958    return 0;
20959}
20960EOCP
20961		set try
20962		if eval $compile_ok; then
20963			selectminbits=`$run ./try`
20964			case "$selectminbits" in
20965			'')	cat >&4 <<EOM
20966Cannot figure out on how many bits at a time your select() operates.
20967I'll play safe and guess it is $safebits bits.
20968EOM
20969				selectminbits=$safebits
20970				bits="$safebits bits"
20971				;;
20972			1)	bits="1 bit" ;;
20973			*)	bits="$selectminbits bits" ;;
20974			esac
20975			echo "Your select() operates on $bits at a time." >&4
20976		else
20977			rp='What is the minimum number of bits your select() operates on?'
20978			case "$byteorder" in
20979			12345678)	dflt=64 ;;
20980			1234)		dflt=32 ;;
20981			*)		dflt=1	;;
20982			esac
20983			. ./myread
20984			val=$ans
20985			selectminbits="$val"
20986		fi
20987		$rm_try
20988		;;
20989	*)	: no select, so pick a harmless default
20990		selectminbits=$safebits
20991		;;
20992	esac
20993	;;
20994esac
20995
20996: Trace out the files included by signal.h, then look for SIGxxx names.
20997if [ "X$fieldn" = X ]; then
20998	: Just make some guesses.  We check them later.
20999	xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21000else
21001	xxx=`echo '#include <signal.h>' |
21002	$cppstdin $cppminus $cppflags 2>/dev/null |
21003	$grep '^[ 	]*#.*include' |
21004	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21005		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21006fi
21007xxxfiles=''
21008for xx in $xxx /dev/null ; do
21009	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
21010done
21011case "$xxxfiles" in
21012'')	xxxfiles=`./findhdr signal.h` ;;
21013esac
21014xxx=`awk '
21015$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21016	print substr($2, 4, 20)
21017}
21018$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21019	print substr($3, 4, 20)
21020}' $xxxfiles`
21021: Append some common names just in case the awk scan failed.
21022xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21023xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21024xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21025xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21026xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21027
21028: generate a few handy files for later
21029$cat > signal.c <<EOCP
21030#include <sys/types.h>
21031#include <signal.h>
21032#$i_stdlib I_STDLIB
21033#ifdef I_STDLIB
21034#include <stdlib.h>
21035#endif
21036#include <stdio.h>
21037int main() {
21038
21039/* Strange style to avoid deeply-nested #if/#else/#endif */
21040#ifndef NSIG
21041#  ifdef _NSIG
21042#    define NSIG (_NSIG)
21043#  endif
21044#endif
21045
21046#ifndef NSIG
21047#  ifdef SIGMAX
21048#    define NSIG (SIGMAX+1)
21049#  endif
21050#endif
21051
21052#ifndef NSIG
21053#  ifdef SIG_MAX
21054#    define NSIG (SIG_MAX+1)
21055#  endif
21056#endif
21057
21058#ifndef NSIG
21059#  ifdef _SIG_MAX
21060#    define NSIG (_SIG_MAX+1)
21061#  endif
21062#endif
21063
21064#ifndef NSIG
21065#  ifdef MAXSIG
21066#    define NSIG (MAXSIG+1)
21067#  endif
21068#endif
21069
21070#ifndef NSIG
21071#  ifdef MAX_SIG
21072#    define NSIG (MAX_SIG+1)
21073#  endif
21074#endif
21075
21076#ifndef NSIG
21077#  ifdef SIGARRAYSIZE
21078#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21079#  endif
21080#endif
21081
21082#ifndef NSIG
21083#  ifdef _sys_nsig
21084#    define NSIG (_sys_nsig) /* Solaris 2.5 */
21085#  endif
21086#endif
21087
21088/* Default to some arbitrary number that's big enough to get most
21089   of the common signals.
21090*/
21091#ifndef NSIG
21092#    define NSIG 50
21093#endif
21094
21095printf("NSIG %d\n", NSIG);
21096
21097#ifndef JUST_NSIG
21098
21099EOCP
21100
21101echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21102{
21103	printf "#ifdef SIG"; printf $1; printf "\n"
21104	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21105	printf $1; printf ");\n"
21106	printf "#endif\n"
21107}
21108END {
21109	printf "#endif /* JUST_NSIG */\n";
21110	printf "exit(0);\n}\n";
21111}
21112' >>signal.c
21113$cat >signal.awk <<'EOP'
21114BEGIN { ndups = 0 }
21115$1 ~ /^NSIG$/ { nsig = $2 }
21116($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21117    if ($2 > maxsig) { maxsig = $2 }
21118    if (sig_name[$2]) {
21119	dup_name[ndups] = $1
21120	dup_num[ndups] = $2
21121	ndups++
21122    }
21123    else {
21124	sig_name[$2] = $1
21125	sig_num[$2] = $2
21126    }
21127}
21128END {
21129    if (nsig == 0) {
21130    	nsig = maxsig + 1
21131    }
21132    printf("NSIG %d\n", nsig);
21133    for (n = 1; n < nsig; n++) {
21134 	if (sig_name[n]) {
21135 	    printf("%s %d\n", sig_name[n], sig_num[n])
21136	}
21137 	else {
21138 	    printf("NUM%d %d\n", n, n)
21139 	}
21140    }
21141    for (n = 0; n < ndups; n++) {
21142 	printf("%s %d\n", dup_name[n], dup_num[n])
21143    }
21144}
21145EOP
21146$cat >signal_cmd <<EOS
21147$startsh
21148if $test -s signal.lst; then
21149    echo "Using your existing signal.lst file"
21150	exit 0
21151fi
21152xxx="$xxx"
21153EOS
21154$cat >>signal_cmd <<'EOS'
21155
21156set signal
21157if eval $compile_ok; then
21158	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21159		$uniq | $awk -f signal.awk >signal.lst
21160else
21161	echo "(I can't seem be able to compile the whole test program)" >&4
21162	echo "(I'll try it in little pieces.)" >&4
21163	set signal -DJUST_NSIG
21164	if eval $compile_ok; then
21165		$run ./signal$_exe > signal.nsg
21166		$cat signal.nsg
21167	else
21168		echo "I can't seem to figure out how many signals you have." >&4
21169		echo "Guessing 50." >&4
21170		echo 'NSIG 50' > signal.nsg
21171	fi
21172	: Now look at all the signal names, one at a time.
21173	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21174		$cat > signal.c <<EOCP
21175#include <sys/types.h>
21176#include <signal.h>
21177#include <stdio.h>
21178int main() {
21179printf("$xx %d\n", SIG${xx});
21180return 0;
21181}
21182EOCP
21183		set signal
21184		if eval $compile; then
21185			echo "SIG${xx} found."
21186			$run ./signal$_exe  >> signal.ls1
21187		else
21188			echo "SIG${xx} NOT found."
21189		fi
21190	done
21191	if $test -s signal.ls1; then
21192		$cat signal.nsg signal.ls1 |
21193			$sort -n | $uniq | $awk -f signal.awk >signal.lst
21194	fi
21195
21196fi
21197if $test -s signal.lst; then
21198	:
21199else
21200	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21201	echo 'kill -l' >signal
21202	set X `csh -f <signal`
21203	$rm -f signal
21204	shift
21205	case $# in
21206	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21207	esac
21208	echo $@ | $tr ' ' $trnl | \
21209 	    $awk '{ printf "%s %d\n", $1, ++s; }
21210 		  END { printf "NSIG %d\n", ++s }' >signal.lst
21211fi
21212$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21213EOS
21214chmod a+x signal_cmd
21215$eunicefix signal_cmd
21216
21217: generate list of signal names
21218echo " "
21219case "$sig_name_init" in
21220'') doinit=yes ;;
21221*)  case "$sig_num_init" in
21222    ''|*,*) doinit=yes ;;
21223    esac ;;
21224esac
21225case "$doinit" in
21226yes)
21227	echo "Generating a list of signal names and numbers..." >&4
21228	. ./signal_cmd
21229 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21230 	sig_name=`$awk 'BEGIN { printf "ZERO " }
21231 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
21232 	sig_num=`$awk  'BEGIN { printf "0 " }
21233 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
21234 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
21235 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
21236 			     END	{ printf "0\n" }' signal.lst`
21237 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
21238 			     !/^NSIG/	{ printf "%d, ", $2}
21239 			     END	{ printf "0\n"}' signal.lst`
21240	;;
21241esac
21242echo "The following $sig_count signals are available:"
21243echo " "
21244echo $sig_name | $awk \
21245'BEGIN { linelen = 0 }
21246{
21247	for (i = 1; i <= NF; i++) {
21248		name = "SIG" $i " "
21249		linelen = linelen + length(name)
21250		if (linelen > 70) {
21251			printf "\n"
21252			linelen = length(name)
21253		}
21254		printf "%s", name
21255	}
21256	printf "\n"
21257}'
21258sig_size=`echo $sig_name | awk '{print NF}'`
21259$rm -f signal signal.c signal.awk signal.lst signal_cmd
21260
21261: Check size of size
21262echo " "
21263case "$sizetype" in
21264*_t) zzz="$sizetype"	;;
21265*)   zzz="filesize"	;;
21266esac
21267echo "Checking the size of $zzz..." >&4
21268cat > try.c <<EOCP
21269#include <sys/types.h>
21270#include <stdio.h>
21271#$i_stdlib I_STDLIB
21272#ifdef I_STDLIB
21273#include <stdlib.h>
21274#endif
21275int main() {
21276    printf("%d\n", (int)sizeof($sizetype));
21277    exit(0);
21278}
21279EOCP
21280set try
21281if eval $compile_ok; then
21282	yyy=`$run ./try`
21283	case "$yyy" in
21284	'')	sizesize=4
21285		echo "(I can't execute the test program--guessing $sizesize.)" >&4
21286		;;
21287	*)	sizesize=$yyy
21288		echo "Your $zzz size is $sizesize bytes."
21289		;;
21290	esac
21291else
21292	sizesize=4
21293	echo "(I can't compile the test program--guessing $sizesize.)" >&4
21294fi
21295
21296
21297: check for socklen_t
21298echo " "
21299echo "Checking to see if you have socklen_t..." >&4
21300$cat >try.c <<EOCP
21301#include <sys/types.h>
21302#$d_socket HAS_SOCKET
21303#ifdef HAS_SOCKET
21304#include <sys/socket.h>
21305#endif
21306int main() { socklen_t x = 16; }
21307EOCP
21308set try
21309if eval $compile; then
21310	val="$define"
21311	echo "You have socklen_t."
21312else
21313	val="$undef"
21314	echo "You do not have socklen_t."
21315	case "$sizetype" in
21316	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21317	esac
21318fi
21319$rm_try
21320set d_socklen_t
21321eval $setvar
21322
21323: see if this is a socks.h system
21324set socks.h i_socks
21325eval $inhdr
21326
21327: check for type of the size argument to socket calls
21328case "$d_socket" in
21329"$define")
21330	$cat <<EOM
21331
21332Checking to see what type is the last argument of accept().
21333EOM
21334	yyy=''
21335	case "$d_socklen_t" in
21336	"$define") yyy="$yyy socklen_t"
21337	esac
21338	yyy="$yyy $sizetype int long unsigned"
21339	for xxx in $yyy; do
21340		case "$socksizetype" in
21341		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21342			case "$usesocks" in
21343			"$define")
21344				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21345					echo "Your system accepts '$xxx *' for the last argument of accept()."
21346					socksizetype="$xxx"
21347				fi
21348				;;
21349			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21350					echo "Your system accepts '$xxx *' for the last argument of accept()."
21351					socksizetype="$xxx"
21352				fi
21353				;;
21354			esac
21355			;;
21356		esac
21357	done
21358: In case none of those worked, prompt the user.
21359	case "$socksizetype" in
21360	'')	rp='What is the type for socket address structure sizes?'
21361		dflt='int'
21362		. ./myread
21363		socksizetype=$ans
21364		;;
21365	esac
21366	;;
21367*)	: no sockets, so pick relatively harmless default
21368	socksizetype='int'
21369	;;
21370esac
21371
21372: see what type is used for signed size_t
21373set ssize_t ssizetype int stdio.h sys/types.h
21374eval $typedef
21375dflt="$ssizetype"
21376$cat > try.c <<EOM
21377#include <stdio.h>
21378#$i_stdlib I_STDLIB
21379#ifdef I_STDLIB
21380#include <stdlib.h>
21381#endif
21382#include <sys/types.h>
21383#define Size_t $sizetype
21384#define SSize_t $dflt
21385int main()
21386{
21387	if (sizeof(Size_t) == sizeof(SSize_t))
21388		printf("$dflt\n");
21389	else if (sizeof(Size_t) == sizeof(int))
21390		printf("int\n");
21391	else
21392		printf("long\n");
21393	exit(0);
21394}
21395EOM
21396echo " "
21397set try
21398if eval $compile_ok && $run ./try > /dev/null; then
21399	ssizetype=`$run ./try`
21400	echo "I'll be using $ssizetype for functions returning a byte count." >&4
21401else
21402	$cat >&4 <<EOM
21403Help! I can't compile and run the ssize_t test program: please enlighten me!
21404(This is probably a misconfiguration in your system or libraries, and
21405you really ought to fix it.  Still, I'll try anyway.)
21406
21407I need a type that is the same size as $sizetype, but is guaranteed to
21408be signed.  Common values are ssize_t, int and long.
21409
21410EOM
21411	rp="What signed type is the same size as $sizetype?"
21412	. ./myread
21413	ssizetype="$ans"
21414fi
21415$rm_try
21416
21417: Check the size of st_ino
21418$echo " "
21419$echo "Checking the size of st_ino..." >&4
21420$cat > try.c <<EOCP
21421#include <sys/stat.h>
21422#include <stdio.h>
21423#$i_stdlib I_STDLIB
21424#ifdef I_STDLIB
21425#include <stdlib.h>
21426#endif
21427int main() {
21428    struct stat st;
21429    printf("%d\n", (int)sizeof(st.st_ino));
21430    exit(0);
21431}
21432EOCP
21433set try
21434if eval $compile_ok; then
21435	val=`$run ./try`
21436	case "$val" in
21437	'')	st_ino_size=4
21438		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21439		;;
21440	*)	st_ino_size=$val
21441		$echo "Your st_ino is $st_ino_size bytes long."
21442		;;
21443	esac
21444else
21445	st_ino_size=4
21446	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21447fi
21448$rm_try
21449
21450: Check if st_ino is signed
21451$echo " "
21452$echo "Checking the sign of st_ino..." >&4
21453$cat > try.c <<EOCP
21454#include <sys/stat.h>
21455#include <stdio.h>
21456int main() {
21457	struct stat foo;
21458        foo.st_ino = -1;
21459	if (foo.st_ino < 0)
21460		printf("-1\n");
21461	else
21462		printf("1\n");
21463}
21464EOCP
21465set try
21466if eval $compile; then
21467	val=`$run ./try`
21468	case "$val" in
21469	'')	st_ino_sign=1
21470		$echo "(I can't execute the test program--guessing unsigned.)" >&4
21471		;;
21472	*)	st_ino_sign=$val
21473		case "$st_ino_sign" in
21474		 1) $echo "Your st_ino is unsigned." ;;
21475		-1) $echo "Your st_ino is signed."   ;;
21476		esac
21477		;;
21478	esac
21479else
21480	st_ino_sign=1
21481	$echo "(I can't compile the test program--guessing unsigned.)" >&4
21482fi
21483$rm_try
21484
21485: see what type of char stdio uses.
21486echo " "
21487echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21488if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21489	echo "Your stdio uses unsigned chars." >&4
21490	stdchar="unsigned char"
21491else
21492	echo "Your stdio uses signed chars." >&4
21493	stdchar="char"
21494fi
21495$rm -f stdioh
21496
21497: see what type uids are declared as in the kernel
21498echo " "
21499echo "Looking for the type for user ids returned by getuid()."
21500set uid_t uidtype xxx stdio.h sys/types.h
21501eval $typedef
21502case "$uidtype" in
21503xxx)
21504	xxx=`./findhdr sys/user.h`
21505	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21506	case $1 in
21507	unsigned) dflt="$1 $2" ;;
21508	*) dflt="$1" ;;
21509	esac
21510	;;
21511*) dflt="$uidtype";;
21512esac
21513case "$uidtype" in
21514uid_t)	echo "uid_t found." ;;
21515*)	rp="What is the type for user ids returned by getuid()?"
21516	. ./myread
21517	uidtype="$ans"
21518	;;
21519esac
21520
21521: Check size of UID
21522echo " "
21523case "$uidtype" in
21524*_t) zzz="$uidtype"	;;
21525*)   zzz="uid"		;;
21526esac
21527echo "Checking the size of $zzz..." >&4
21528cat > try.c <<EOCP
21529#include <sys/types.h>
21530#include <stdio.h>
21531#$i_stdlib I_STDLIB
21532#ifdef I_STDLIB
21533#include <stdlib.h>
21534#endif
21535int main() {
21536    printf("%d\n", (int)sizeof($uidtype));
21537    exit(0);
21538}
21539EOCP
21540set try
21541if eval $compile_ok; then
21542	yyy=`$run ./try`
21543	case "$yyy" in
21544	'')	uidsize=4
21545		echo "(I can't execute the test program--guessing $uidsize.)" >&4
21546		;;
21547	*)	uidsize=$yyy
21548		echo "Your $zzz is $uidsize bytes long."
21549		;;
21550	esac
21551else
21552	uidsize=4
21553	echo "(I can't compile the test program--guessing $uidsize.)" >&4
21554fi
21555
21556: Check if UID is signed
21557echo " "
21558case "$uidtype" in
21559*_t) zzz="$uidtype"	;;
21560*)   zzz="uid"		;;
21561esac
21562echo "Checking the sign of $zzz..." >&4
21563cat > try.c <<EOCP
21564#include <sys/types.h>
21565#include <stdio.h>
21566int main() {
21567	$uidtype foo = -1;
21568	if (foo < 0)
21569		printf("-1\n");
21570	else
21571		printf("1\n");
21572}
21573EOCP
21574set try
21575if eval $compile; then
21576	yyy=`$run ./try`
21577	case "$yyy" in
21578	'')	uidsign=1
21579		echo "(I can't execute the test program--guessing unsigned.)" >&4
21580		;;
21581	*)	uidsign=$yyy
21582		case "$uidsign" in
21583		 1) echo "Your $zzz is unsigned." ;;
21584		-1) echo "Your $zzz is signed."   ;;
21585		esac
21586		;;
21587	esac
21588else
21589	uidsign=1
21590	echo "(I can't compile the test program--guessing unsigned.)" >&4
21591fi
21592
21593
21594: Check format string for UID
21595echo " "
21596$echo "Checking the format string to be used for uids..." >&4
21597
21598case "$uidsign" in
21599-1)	if $test X"$uidsize" = X"$ivsize"; then
21600		uidformat="$ivdformat"
21601	else
21602		if $test X"$uidsize" = X"$longsize"; then
21603			uidformat='"ld"'
21604		else
21605			if $test X"$uidsize" = X"$intsize"; then
21606				uidformat='"d"'
21607			else
21608				if $test X"$uidsize" = X"$shortsize"; then
21609					uidformat='"hd"'
21610				fi
21611			fi
21612		fi
21613	fi
21614	;;
21615*)	if $test X"$uidsize" = X"$uvsize"; then
21616		uidformat="$uvuformat"
21617	else
21618		if $test X"$uidsize" = X"$longsize"; then
21619			uidformat='"lu"'
21620		else
21621			if $test X"$uidsize" = X"$intsize"; then
21622				uidformat='"u"'
21623			else
21624				if $test X"$uidsize" = X"$shortsize"; then
21625					uidformat='"hu"'
21626				fi
21627			fi
21628		fi
21629	fi
21630	;;
21631esac
21632
21633: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21634echo " "
21635echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21636$cat >try.c <<'EOM'
21637/* Intentionally a long probe as I'd like to sanity check that the exact
21638   approach is going to work, as thinking it will work, but only having it
21639   part working at runtime is worse than not having it.  */
21640
21641#include <sys/types.h>
21642#include <sys/sysctl.h>
21643#include <sys/param.h>
21644#include <stdio.h>
21645#include <string.h>
21646#include <stdlib.h>
21647#include <unistd.h>
21648
21649int
21650main(int argc, char **argv) {
21651    char *buffer;
21652    char *argv_leaf = strrchr(argv[0], '/');
21653    char *buffer_leaf;
21654    size_t size = 0;
21655    int mib[4];
21656
21657    mib[0] = CTL_KERN;
21658    mib[1] = KERN_PROC;
21659    mib[2] = KERN_PROC_PATHNAME;
21660    mib[3] = -1;
21661
21662    if (!argv_leaf) {
21663	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21664	return 1;
21665    }
21666
21667    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21668	perror("sysctl");
21669	return 2;
21670    }
21671
21672    if (size < strlen(argv_leaf) + 1) {
21673	fprintf(stderr, "size %lu is too short for a path\n",
21674		(unsigned long) size);
21675	return 3;
21676    }
21677
21678    if (size > MAXPATHLEN * MAXPATHLEN) {
21679	fprintf(stderr, "size %lu is too long for a path\n",
21680		(unsigned long) size);
21681	return 4;
21682    }
21683
21684    buffer = malloc(size);
21685    if (!buffer) {
21686	perror("malloc");
21687	return 5;
21688    }
21689
21690    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21691	perror("sysctl");
21692	return 6;
21693    }
21694
21695    if (strlen(buffer) + 1 != size) {
21696	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21697		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
21698        return 7;
21699    }
21700
21701
21702    if (*buffer != '/') {
21703	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21704	return 8;
21705    }
21706
21707    if (strstr(buffer, "/./")) {
21708	fprintf(stderr, "Contains /./: '%s'\n", buffer);
21709	return 9;
21710    }
21711
21712    if (strstr(buffer, "/../")) {
21713	fprintf(stderr, "Contains /../: '%s'\n", buffer);
21714	return 10;
21715    }
21716
21717    buffer_leaf = strrchr(buffer, '/');
21718    if (strcmp(buffer_leaf, argv_leaf) != 0) {
21719	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21720	return 11;
21721    }
21722
21723    free(buffer);
21724
21725    return 0;
21726}
21727EOM
21728
21729val=$undef
21730set try
21731if eval $compile; then
21732	if $run ./try; then
21733		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21734		val="$define"
21735	else
21736		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21737		val="$undef"
21738	fi
21739else
21740	echo "I'm unable to compile the test program." >&4
21741	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21742	val="$undef"
21743fi
21744$rm_try
21745set usekernprocpathname
21746eval $setvar
21747
21748: Determine if we can use _NSGetExecutablePath to find executing program
21749echo " "
21750echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21751$cat >try.c <<'EOM'
21752/* Intentionally a long probe as I'd like to sanity check that the exact
21753   approach is going to work, as thinking it will work, but only having it
21754   part working at runtime is worse than not having it.  */
21755#include <mach-o/dyld.h>
21756#include <stdio.h>
21757#include <stdlib.h>
21758#include <sys/param.h>
21759#include <string.h>
21760
21761int
21762main(int argc, char **argv) {
21763    char buf[1];
21764    uint32_t size = sizeof(buf);
21765    int result;
21766    char *buffer;
21767    char *tidied;
21768    char *argv_leaf = strrchr(argv[0], '/');
21769    char *tidied_leaf;
21770
21771    if (!argv_leaf) {
21772	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21773	return 1;
21774    }
21775
21776    _NSGetExecutablePath(buf, &size);
21777    if (size > MAXPATHLEN * MAXPATHLEN) {
21778	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21779		(unsigned int) size);
21780	return 2;
21781    }
21782
21783    buffer = malloc(size);
21784    if (!buffer) {
21785	perror("malloc");
21786	return 3;
21787    }
21788
21789    result = _NSGetExecutablePath(buffer, &size);
21790    if (result != 0) {
21791	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21792		result, (unsigned int) size);
21793	return 4;
21794    }
21795
21796    tidied = realpath(buffer, NULL);
21797    if (!tidied) {
21798	perror("realpath");
21799	return 5;
21800    }
21801
21802    free(buffer);
21803
21804    if (*tidied != '/') {
21805	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21806	return 6;
21807    }
21808
21809    if (strstr(tidied, "/./")) {
21810	fprintf(stderr, "Contains /./: '%s'\n", tidied);
21811	return 7;
21812    }
21813
21814    if (strstr(tidied, "/../")) {
21815	fprintf(stderr, "Contains /../: '%s'\n", tidied);
21816	return 8;
21817    }
21818
21819    tidied_leaf = strrchr(tidied, '/');
21820    if (strcmp(tidied_leaf, argv_leaf) != 0) {
21821	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21822	return 9;
21823    }
21824
21825    free(tidied);
21826
21827    return 0;
21828}
21829EOM
21830
21831val=$undef
21832set try
21833if eval $compile; then
21834	if $run ./try; then
21835		echo "You can use _NSGetExecutablePath to find the executing program." >&4
21836		val="$define"
21837	else
21838		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21839	fi
21840else
21841	echo "I'm unable to compile the test program." >&4
21842	echo "I'll assume no _NSGetExecutablePath here." >&4
21843fi
21844$rm_try
21845set usensgetexecutablepath
21846eval $setvar
21847
21848: Check if site customization support was requested
21849case "$usesitecustomize" in
21850    $define|true|[Yy]*)
21851	usesitecustomize="$define"
21852	;;
21853    *)
21854	usesitecustomize="$undef"
21855	;;
21856    esac
21857
21858: see if prototypes support variable argument declarations
21859echo " "
21860case "$prototype$i_stdarg" in
21861$define$define)
21862	echo "It appears we'll be able to prototype varargs functions." >&4
21863	val="$define"
21864	;;
21865*)
21866	echo "Too bad... We won't be using prototyped varargs functions..." >&4
21867	val="$undef"
21868	;;
21869esac
21870set vaproto
21871eval $setvar
21872
21873: determine compiler compiler
21874case "$yacc" in
21875'')
21876	dflt=yacc;;
21877*)
21878	dflt="$yacc";;
21879esac
21880echo " "
21881comp='yacc'
21882if $test -f "$byacc$_exe"; then
21883	dflt="$byacc"
21884	comp="byacc or $comp"
21885fi
21886if $test -f "$bison$_exe"; then
21887	comp="$comp or bison -y"
21888fi
21889rp="Which compiler compiler ($comp) shall I use?"
21890. ./myread
21891yacc="$ans"
21892case "$yacc" in
21893*bis*)
21894	case "$yacc" in
21895	*-y*) ;;
21896	*)
21897		yacc="$yacc -y"
21898		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21899		;;
21900	esac
21901	;;
21902esac
21903
21904: see if this is a assert.h system
21905set assert.h i_assert
21906eval $inhdr
21907
21908: see if this is a fp.h system
21909set fp.h i_fp
21910eval $inhdr
21911
21912: see if this is a fp_class.h system
21913set fp_class.h i_fp_class
21914eval $inhdr
21915
21916: see if gdbm.h is available
21917set gdbm.h t_gdbm
21918eval $inhdr
21919case "$t_gdbm" in
21920$define)
21921	: see if gdbm_open exists
21922	set gdbm_open d_gdbm_open
21923	eval $inlibc
21924	case "$d_gdbm_open" in
21925	$undef)
21926		t_gdbm="$undef"
21927		echo "We won't be including <gdbm.h>"
21928		;;
21929	esac
21930	;;
21931esac
21932val="$t_gdbm"
21933set i_gdbm
21934eval $setvar
21935
21936: see if this is a ieeefp.h system
21937case "$i_ieeefp" in
21938'' ) set ieeefp.h i_ieeefp
21939     eval $inhdr
21940     ;;
21941esac
21942
21943: see if this is a libutil.h system
21944set libutil.h i_libutil
21945eval $inhdr
21946
21947: see if mach cthreads are available
21948if test "X$usethreads" = "X$define"; then
21949	set mach/cthreads.h i_machcthr
21950	eval $inhdr
21951else
21952	i_machcthr="$undef"
21953fi
21954
21955: see if this is a mntent.h system
21956set mntent.h i_mntent
21957eval $inhdr
21958
21959: see if net/errno.h is available
21960val=''
21961set net/errno.h val
21962eval $inhdr
21963
21964: Unfortunately, it causes problems on some systems.  Arrgh.
21965case "$val" in
21966$define)
21967	cat > try.c <<'EOM'
21968#include <stdio.h>
21969#include <errno.h>
21970#include <net/errno.h>
21971int func()
21972{
21973	return ENOTSOCK;
21974}
21975EOM
21976	if $cc $ccflags -c try.c >/dev/null 2>&1; then
21977		echo "We'll be including <net/errno.h>." >&4
21978	else
21979		echo "We won't be including <net/errno.h>." >&4
21980		val="$undef"
21981	fi
21982	$rm_try
21983	;;
21984esac
21985set i_neterrno
21986eval $setvar
21987
21988: see if netinet/tcp.h is available
21989set netinet/tcp.h i_netinettcp
21990eval $inhdr
21991
21992: see if this is a poll.h system
21993set poll.h i_poll
21994eval $inhdr
21995
21996: see if this is a prot.h system
21997set prot.h i_prot
21998eval $inhdr
21999
22000: Preprocessor symbols
22001echo " "
22002$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22003$cat <<'EOSH' > Cppsym.know
22004a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
22005AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
22006alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
22007ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
22008BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
22009BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
22010bull c cadmus clipper CMU COFF COMPILER_VERSION
22011concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
22012CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
22013Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
22014FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
22015GLIBC GLIBC_MINOR
22016GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
22017H3050R H3050RX hbullx20 hcx host_mips
22018hp200 hp300 hp700 HP700 hp800 hp9000
22019hp9000s200 hp9000s300 hp9000s400 hp9000s500
22020hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
22021i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
22022IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22023INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
22024LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
22025LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
22026LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
22027LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
22028M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
22029M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
22030M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
22031MATH_HAS_NO_SIDE_EFFECTS
22032mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
22033mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
22034mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
22035MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
22036mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
22037NetBSD news1500 news1700 news1800 news1900 news3700
22038news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
22039ns32016 ns32332 ns32k nsc32000
22040OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22041pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
22042pc532 pdp11 PGC PIC plexus PORTAR posix
22043POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22044POSIX_C_SOURCE POSIX_SOURCE POWER
22045PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
22046riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
22047SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22048sony sony_news sonyrisc sparc sparclite spectrum
22049stardent stdc STDC_EXT stratos sun sun3 sun386
22050Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22051SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22052SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22053sysV68 sysV88 Tek4132 Tek4300 titan
22054TM3200 TM5400 TM5600
22055tower tower32 tower32_200 tower32_600 tower32_700
22056tower32_800 tower32_850 tss
22057u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22058ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22059unix UNIX95 UNIX99 unixpc unos
22060USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22061USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22062USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22063USGr4 USGr4_2
22064Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22065XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22066XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22067z8000
22068EOSH
22069# Maybe put other stuff here too.
22070./tr '-' '_' <<EOSH >>Cppsym.know
22071$osname
22072EOSH
22073./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22074./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22075$cat Cppsym.know > Cppsym.c
22076$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22077$rm -f Cppsym.a Cppsym.b Cppsym.c
22078cat <<EOSH > Cppsym
22079$startsh
22080if $test \$# -gt 0; then
22081    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22082    if $test -s Cppsym.got; then
22083        $rm -f Cppsym.got
22084        exit 0
22085    fi
22086    $rm -f Cppsym.got
22087    exit 1
22088else
22089    $tr " " "$trnl" | ./Cppsym.try
22090    exit 0
22091fi
22092EOSH
22093chmod +x Cppsym
22094$eunicefix Cppsym
22095cat <<EOSH > Cppsym.try
22096$startsh
22097cat <<'EOCP' > try.c
22098#include <stdio.h>
22099#if cpp_stuff == 1
22100#define STRINGIFY(a)    "a"
22101#endif
22102#if cpp_stuff == 42
22103#define StGiFy(a)  #a
22104#define STRINGIFY(a)    StGiFy(a)
22105#endif
22106#if $cpp_stuff != 1 && $cpp_stuff != 42
22107#   include "Bletch: How does this C preprocessor stringify macros?"
22108#endif
22109int main() {
22110EOCP
22111$awk \\
22112EOSH
22113cat <<'EOSH' >> Cppsym.try
22114'length($1) > 0 {
22115    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22116    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22117    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22118    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22119}'	 >> try.c
22120echo 'return 0;}' >> try.c
22121EOSH
22122cat <<EOSH >> Cppsym.try
22123ccflags="$ccflags"
22124case "$osname-$gccversion" in
22125irix-) ccflags="\$ccflags -woff 1178" ;;
22126os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22127esac
22128$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22129EOSH
22130chmod +x Cppsym.try
22131$eunicefix Cppsym.try
22132./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22133: Add in any Linux cpp "predefined macros":
22134case "$osname::$gccversion" in
22135  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22136    tHdrH=_tmpHdr
22137    rm -f $tHdrH'.h' $tHdrH
22138    touch $tHdrH'.h'
22139    # Filter out macro arguments, such as Linux's __INT8_C(c)
22140    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22141       sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22142       if [ -s $tHdrH'_cppsym.real' ]; then
22143	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22144       fi
22145    fi
22146    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22147  ;;
22148esac
22149: now check the C compiler for additional symbols
22150postprocess_cc_v=''
22151case "$osname" in
22152aix) postprocess_cc_v="|$tr , ' '" ;;
22153esac
22154$cat >ccsym <<EOS
22155$startsh
22156$cat >tmp.c <<EOF
22157extern int foo;
22158EOF
22159for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22160do
22161	case "\$i" in
22162	-D*) echo "\$i" | $sed 's/^-D//';;
22163	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22164	esac
22165done
22166$rm_try
22167EOS
22168postprocess_cc_v=''
22169chmod +x ccsym
22170$eunicefix ccsym
22171./ccsym > ccsym1.raw
22172if $test -s ccsym1.raw; then
22173       $sort ccsym1.raw | $uniq >ccsym.raw
22174else
22175       mv ccsym1.raw ccsym.raw
22176fi
22177
22178$awk '/\=/ { print $0; next }
22179	{ print $0"=1" }' ccsym.raw >ccsym.list
22180$comm -13 Cppsym.true ccsym.list >ccsym.own
22181$comm -12 Cppsym.true ccsym.list >ccsym.com
22182$comm -23 Cppsym.true ccsym.list >ccsym.cpp
22183also=''
22184if $test -z ccsym.raw; then
22185	echo "Your C compiler doesn't seem to define any symbols!" >&4
22186	echo " "
22187	echo "However, your C preprocessor defines the following symbols:"
22188	$cat Cppsym.true
22189    	ccsymbols=''
22190	cppsymbols=`$cat Cppsym.true`
22191        cppsymbols=`echo $cppsymbols`
22192	cppccsymbols="$cppsymbols"
22193else
22194	if $test -s ccsym.com; then
22195		echo "Your C compiler and pre-processor define these symbols:"
22196		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
22197		also='also '
22198		symbols='ones'
22199		cppccsymbols=`$cat ccsym.com`
22200		cppccsymbols=`echo $cppccsymbols`
22201		$test "$silent" || sleep 1
22202	fi
22203	if $test -s ccsym.cpp; then
22204		$test "$also" && echo " "
22205		echo "Your C pre-processor ${also}defines the following symbols:"
22206		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22207		also='further '
22208		cppsymbols=`$cat ccsym.cpp`
22209		cppsymbols=`echo $cppsymbols`
22210		$test "$silent" || sleep 1
22211	fi
22212	if $test -s ccsym.own; then
22213		$test "$also" && echo " "
22214		echo "Your C compiler ${also}defines the following cpp symbols:"
22215		$sed -e 's/\(..*\)=1/\1/' ccsym.own
22216		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22217	        ccsymbols=`$cat ccsym.own`
22218	        ccsymbols=`echo $ccsymbols`
22219		$test "$silent" || sleep 1
22220	fi
22221fi
22222
22223: see if this is a termio system
22224val="$undef"
22225val2="$undef"
22226val3="$undef"
22227if $test `./findhdr termios.h`; then
22228    set tcsetattr i_termios
22229    eval $inlibc
22230    val3="$i_termios"
22231fi
22232echo " "
22233case "$val3" in
22234    "$define") echo "You have POSIX termios.h... good!" >&4;;
22235    *)  if ./Cppsym pyr; then
22236	    case "`$run /bin/universe`" in
22237		ucb) if $test `./findhdr sgtty.h`; then
22238			val2="$define"
22239			echo "<sgtty.h> found." >&4
22240		    else
22241			echo "System is pyramid with BSD universe."
22242			./warn "<sgtty.h> not found--you could have problems."
22243		    fi;;
22244		*)  if $test `./findhdr termio.h`; then
22245			val="$define"
22246			echo "<termio.h> found." >&4
22247		    else
22248			echo "System is pyramid with USG universe."
22249			./warn "<termio.h> not found--you could have problems."
22250		    fi;;
22251	    esac
22252	elif ./usg; then
22253	    if $test `./findhdr termio.h`; then
22254		echo "<termio.h> found." >&4
22255		val="$define"
22256	    elif $test `./findhdr sgtty.h`; then
22257		echo "<sgtty.h> found." >&4
22258		val2="$define"
22259	    else
22260		./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22261	    fi
22262	else
22263	    if $test `./findhdr sgtty.h`; then
22264		echo "<sgtty.h> found." >&4
22265		val2="$define"
22266	    elif $test `./findhdr termio.h`; then
22267		echo "<termio.h> found." >&4
22268		val="$define"
22269	    else
22270		./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22271	    fi
22272	fi;;
22273esac
22274set i_termio; eval $setvar
22275val=$val2; set i_sgtty; eval $setvar
22276val=$val3; set i_termios; eval $setvar
22277
22278: see if stdbool is available
22279: we want a real compile instead of Inhdr because some Solaris systems
22280: have stdbool.h, but it can only be used if the compiler indicates it
22281: is sufficiently c99-compliant.
22282echo " "
22283$cat >try.c <<EOCP
22284#include <stdio.h>
22285#include <stdbool.h>
22286int func(bool x)
22287{
22288    return x ? 1 : 0;
22289}
22290int main(int argc, char **argv)
22291{
22292    return func(0);
22293}
22294EOCP
22295set try
22296if eval $compile; then
22297	echo "<stdbool.h> found." >&4
22298	val="$define"
22299else
22300	echo "<stdbool.h> NOT found." >&4
22301	val="$undef"
22302fi
22303$rm_try
22304set i_stdbool
22305eval $setvar
22306
22307: see if stddef is available
22308set stddef.h i_stddef
22309eval $inhdr
22310
22311: see if sys/access.h is available
22312set sys/access.h i_sysaccess
22313eval $inhdr
22314
22315: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22316set sys/filio.h i_sysfilio
22317eval $inhdr
22318echo " "
22319if $test `./findhdr sys/ioctl.h`; then
22320	val="$define"
22321	echo '<sys/ioctl.h> found.' >&4
22322else
22323	val="$undef"
22324	if $test $i_sysfilio = "$define"; then
22325	    echo '<sys/ioctl.h> NOT found.' >&4
22326	else
22327		$test $i_sgtty = "$define" && xxx="sgtty.h"
22328		$test $i_termio = "$define" && xxx="termio.h"
22329		$test $i_termios = "$define" && xxx="termios.h"
22330echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22331	fi
22332fi
22333set i_sysioctl
22334eval $setvar
22335
22336: see if socket ioctl defs are in sys/sockio.h
22337echo " "
22338xxx=`./findhdr sys/sockio.h`
22339if $test "$xxx"; then
22340	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22341		val="$define"
22342		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22343	else
22344		val="$undef"
22345		echo "No socket ioctls found in <sys/sockio.h>." >&4
22346	fi
22347else
22348	val="$undef"
22349	$cat <<EOM
22350<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22351EOM
22352fi
22353set i_syssockio
22354eval $setvar
22355
22356: see if this is a syslog.h system
22357set syslog.h i_syslog
22358eval $inhdr
22359
22360: see if this is a sys/mode.h system
22361set sys/mode.h i_sysmode
22362eval $inhdr
22363
22364: see if there is a sys/poll.h file
22365set sys/poll.h i_syspoll
22366eval $inhdr
22367
22368: see if sys/resource.h has to be included
22369set sys/resource.h i_sysresrc
22370eval $inhdr
22371
22372: see if sys/security.h is available
22373set sys/security.h i_syssecrt
22374eval $inhdr
22375
22376: see if this is a sys/statvfs.h system
22377set sys/statvfs.h i_sysstatvfs
22378eval $inhdr
22379
22380: see if this is a sys/un.h system
22381set sys/un.h i_sysun
22382eval $inhdr
22383
22384: see if this is a sys/utsname.h system
22385set sys/utsname.h i_sysutsname
22386eval $inhdr
22387
22388: see if this is a syswait system
22389set sys/wait.h i_syswait
22390eval $inhdr
22391
22392: see if this is a ustat.h system
22393set ustat.h i_ustat
22394eval $inhdr
22395
22396: see if this is an utime system
22397set utime.h i_utime
22398eval $inhdr
22399
22400: see if this is a vfork system
22401case "$d_vfork" in
22402"$define")
22403	set vfork.h i_vfork
22404	eval $inhdr
22405	;;
22406*)
22407	i_vfork="$undef"
22408	;;
22409esac
22410
22411: Check extensions
22412echo " "
22413echo "Looking for extensions..." >&4
22414: If we are using the old config.sh, nonxs_extensions and xs_extensions may
22415: contain old or inaccurate or duplicate values.
22416nonxs_extensions=''
22417xs_extensions=''
22418: We do not use find because it might not be available.
22419: We do not just use MANIFEST because the user may have dropped
22420: some additional extensions into the source tree and expect them
22421: to be built.
22422
22423: Function to recursively find available extensions, ignoring DynaLoader
22424: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22425: In 5.10.1 and later, extensions are stored in directories
22426: like File-Glob instead of the older File/Glob/.
22427find_extensions='
22428    for xxx in *; do
22429	case "$xxx" in
22430	    CVS) ;;
22431	    DynaLoader|dynaload) ;;
22432	    *)
22433	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22434	    case "$this_ext" in
22435		Scalar/List/Utils) this_ext="List/Util"	;;
22436		PathTools)         this_ext="Cwd"	;;
22437	    esac;
22438	    echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22439	    if $contains " $this_ext " $tdir/$$.tmp; then
22440		echo >&4;
22441		echo "Duplicate directories detected for extension $xxx" >&4;
22442		echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22443		case "$knowitall" in
22444		"") dflt=y;;
22445		*) dflt=n;;
22446		esac;
22447		. ../UU/myread;
22448		case "$ans" in
22449		n*|N*) ;;
22450		*) echo >&4;
22451		    echo "Ok.  Stopping Configure." >&4;
22452		    echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22453		    exit 1;;
22454		esac;
22455		echo "Ok.  You will need to correct config.sh before running make." >&4;
22456	    fi;
22457	    $ls -1 $xxx > $tdir/$$.tmp;
22458	    if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22459		xs_extensions="$xs_extensions $this_ext";
22460	    elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22461		xs_extensions="$xs_extensions $this_ext";
22462	    elif $test -d $xxx; then
22463		nonxs_extensions="$nonxs_extensions $this_ext";
22464	    fi;
22465	    $rm -f $tdir/$$.tmp;
22466	    ;;
22467	esac;
22468    done'
22469tdir=`pwd`
22470cd "$rsrc/cpan"
22471set X
22472shift
22473eval $find_extensions
22474cd "$rsrc/dist"
22475set X
22476shift
22477eval $find_extensions
22478cd "$rsrc/ext"
22479set X
22480shift
22481eval $find_extensions
22482set X $xs_extensions
22483shift
22484xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22485set X $nonxs_extensions
22486shift
22487nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22488cd "$tdir"
22489known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22490
22491: Now see which are supported on this system.
22492avail_ext=''
22493for xxx in $xs_extensions ; do
22494	case "$xxx" in
22495	DB_File|db_file)
22496		case "$i_db" in
22497		$define) avail_ext="$avail_ext $xxx" ;;
22498		esac
22499		;;
22500	GDBM_File|gdbm_fil)
22501		case "$i_gdbm" in
22502		$define) avail_ext="$avail_ext $xxx" ;;
22503		esac
22504		;;
22505	I18N/Langinfo|i18n_lan)
22506		case "$i_langinfo$d_nl_langinfo" in
22507		$define$define) avail_ext="$avail_ext $xxx" ;;
22508		esac
22509		;;
22510	IPC/SysV|ipc/sysv)
22511		: XXX Do we need a useipcsysv variable here
22512		case "${d_msg}${d_sem}${d_shm}" in
22513		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
22514		esac
22515		;;
22516	NDBM_File|ndbm_fil)
22517		case "$d_ndbm" in
22518		$define)
22519		    case "$osname-$use64bitint" in
22520		    hpux-define)
22521			case "$libs" in
22522			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
22523			esac
22524			;;
22525		    *) avail_ext="$avail_ext $xxx" ;;
22526		    esac
22527		    ;;
22528		esac
22529		;;
22530	ODBM_File|odbm_fil)
22531		case "${i_dbm}${i_rpcsvcdbm}" in
22532		*"${define}"*)
22533		    case "$d_cplusplus" in
22534		    define) ;; # delete as a function name will not work
22535		    *)  case "$osname-$use64bitint" in
22536			hpux-define)
22537			    case "$libs" in
22538			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22539			    esac
22540			    ;;
22541			*) avail_ext="$avail_ext $xxx" ;;
22542			esac
22543			;;
22544		    esac
22545		    ;;
22546		esac
22547		;;
22548	Opcode|opcode)
22549		case "$useopcode" in
22550		true|define|y) avail_ext="$avail_ext $xxx" ;;
22551		esac
22552		;;
22553	POSIX|posix)
22554		case "$useposix" in
22555		true|define|y) avail_ext="$avail_ext $xxx" ;;
22556		esac
22557		;;
22558	Socket|socket)
22559		case "$d_socket" in
22560		true|$define|y) avail_ext="$avail_ext $xxx" ;;
22561		esac
22562		;;
22563	Sys/Syslog|sys/syslog)
22564		: XXX syslog requires socket
22565		case "$d_socket" in
22566		true|$define|y) avail_ext="$avail_ext $xxx" ;;
22567		esac
22568		;;
22569	Thread|thread)
22570                case "$usethreads" in
22571                true|$define|y)
22572                        case "$use5005threads" in
22573                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22574                        esac
22575		esac
22576		;;
22577	threads|threads/shared)
22578		# threads and threads::shared are special cases.
22579		# To stop people from asking "Perl 5.8.0 was supposed
22580		# to have this new fancy threads implementation but my
22581		# perl doesn't have it" and from people trying to
22582		# (re)install the threads module using CPAN.pm and
22583		# CPAN.pm then offering to reinstall Perl 5.8.0,
22584		# the threads.pm and threads/shared.pm will always be
22585		# there, croaking informatively ("you need to rebuild
22586		# all of Perl with threads, sorry") when threads haven't
22587		# been compiled in.
22588		# --jhi
22589		avail_ext="$avail_ext $xxx"
22590		;;
22591	VMS*)
22592		;;
22593	Win32*)
22594		case "$osname" in
22595		cygwin) avail_ext="$avail_ext $xxx" ;;
22596		esac
22597		;;
22598	XS/APItest|xs/apitest)
22599		# This is just for testing.  Skip it unless we have dynamic loading.
22600
22601		case "$usedl" in
22602		$define) avail_ext="$avail_ext $xxx" ;;
22603		esac
22604		;;
22605	XS/Typemap|xs/typemap)
22606		# This is just for testing.  Skip it unless we have dynamic loading.
22607		case "$usedl" in
22608		$define) avail_ext="$avail_ext $xxx" ;;
22609		esac
22610		;;
22611	*)	avail_ext="$avail_ext $xxx"
22612		;;
22613	esac
22614done
22615
22616set X $avail_ext
22617shift
22618avail_ext="$*"
22619
22620case "$onlyextensions" in
22621'') ;;
22622*)  keepextensions=''
22623    echo "You have requested that only certain extensions be included..." >&4
22624    for i in $onlyextensions; do
22625        case " $avail_ext " in
22626        *" $i "*)
22627            echo "Keeping extension $i."
22628            keepextensions="$keepextensions $i"
22629            ;;
22630        *) echo "Ignoring extension $i." ;;
22631        esac
22632    done
22633    avail_ext="$keepextensions"
22634    ;;
22635esac
22636
22637case "$noextensions" in
22638'') ;;
22639*)  keepextensions=''
22640    echo "You have requested that certain extensions be ignored..." >&4
22641    for i in $avail_ext; do
22642        case " $noextensions " in
22643        *" $i "*) echo "Ignoring extension $i." ;;
22644        *) echo "Keeping extension $i.";
22645           keepextensions="$keepextensions $i"
22646           ;;
22647        esac
22648    done
22649    avail_ext="$keepextensions"
22650    ;;
22651esac
22652
22653: Now see which nonxs extensions are supported on this system.
22654: For now assume all are.
22655nonxs_ext=''
22656for xxx in $nonxs_extensions ; do
22657	case "$xxx" in
22658	CVS|RCS|SCCS|.svn)
22659		;;
22660	VMS*)
22661		;;
22662	*)	nonxs_ext="$nonxs_ext $xxx"
22663		;;
22664	esac
22665done
22666
22667set X $nonxs_ext
22668shift
22669nonxs_ext="$*"
22670
22671case $usedl in
22672$define)
22673	$cat <<EOM
22674A number of extensions are supplied with $package.  You may choose to
22675compile these extensions for dynamic loading (the default), compile
22676them into the $package executable (static loading), or not include
22677them at all.  Answer "none" to include no extensions.
22678Note that DynaLoader is always built and need not be mentioned here.
22679
22680EOM
22681	case "$dynamic_ext" in
22682	'')
22683		: Exclude those listed in static_ext
22684		dflt=''
22685		for xxx in $avail_ext; do
22686			case " $static_ext " in
22687			*" $xxx "*) ;;
22688			*) dflt="$dflt $xxx" ;;
22689			esac
22690		done
22691		set X $dflt
22692		shift
22693		dflt="$*"
22694		;;
22695	*)	dflt="$dynamic_ext"
22696		# Perhaps we are reusing an old out-of-date config.sh.
22697		case "$hint" in
22698		previous)
22699			if test X"$dynamic_ext" != X"$avail_ext"; then
22700				$cat <<EOM
22701NOTICE:  Your previous config.sh list may be incorrect.
22702The extensions now available to you are
22703	${avail_ext}
22704but the default list from your previous config.sh is
22705	${dynamic_ext}
22706
22707EOM
22708			fi
22709			;;
22710		esac
22711		;;
22712	esac
22713	case "$dflt" in
22714	'')	dflt=none;;
22715	esac
22716	rp="What extensions do you wish to load dynamically?"
22717	. ./myread
22718	case "$ans" in
22719	none) dynamic_ext=' ' ;;
22720	*) dynamic_ext="$ans" ;;
22721	esac
22722
22723	case "$static_ext" in
22724	'')
22725		: Exclude those already listed in dynamic linking
22726		dflt=''
22727		for xxx in $avail_ext; do
22728			case " $dynamic_ext " in
22729			*" $xxx "*) ;;
22730			*) dflt="$dflt $xxx" ;;
22731			esac
22732		done
22733		set X $dflt
22734		shift
22735		dflt="$*"
22736		;;
22737	*)  dflt="$static_ext"
22738		;;
22739	esac
22740
22741	case "$dflt" in
22742	'')	dflt=none;;
22743	esac
22744	rp="What extensions do you wish to load statically?"
22745	. ./myread
22746	case "$ans" in
22747	none) static_ext=' ' ;;
22748	*) static_ext="$ans" ;;
22749	esac
22750	;;
22751*)
22752	$cat <<EOM
22753A number of extensions are supplied with $package.  Answer "none"
22754to include no extensions.
22755Note that DynaLoader is always built and need not be mentioned here.
22756
22757EOM
22758	case "$static_ext" in
22759	'') dflt="$avail_ext" ;;
22760	*)	dflt="$static_ext"
22761		# Perhaps we are reusing an old out-of-date config.sh.
22762		case "$hint" in
22763		previous)
22764			if test X"$static_ext" != X"$avail_ext"; then
22765				$cat <<EOM
22766NOTICE:  Your previous config.sh list may be incorrect.
22767The extensions now available to you are
22768	${avail_ext}
22769but the default list from your previous config.sh is
22770	${static_ext}
22771
22772EOM
22773			fi
22774			;;
22775		esac
22776		;;
22777	esac
22778	: Exclude those that are not xs extensions
22779	case "$dflt" in
22780	'')	dflt=none;;
22781	esac
22782	rp="What extensions do you wish to include?"
22783	. ./myread
22784	case "$ans" in
22785	none) static_ext=' ' ;;
22786	*) static_ext="$ans" ;;
22787	esac
22788	;;
22789esac
22790#
22791# Encode is a special case.  If we are building Encode as a static
22792# extension, we need to explicitly list its subextensions as well.
22793# For other nested extensions, this is handled automatically by
22794# the appropriate Makefile.PL.
22795case " $static_ext " in
22796	*" Encode "*) # Add the subextensions of Encode
22797	cd "$rsrc/cpan"
22798	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22799		static_ext="$static_ext Encode/$xxx"
22800		known_extensions="$known_extensions Encode/$xxx"
22801	done
22802	cd "$tdir"
22803	;;
22804esac
22805
22806set X $dynamic_ext $static_ext $nonxs_ext
22807shift
22808extensions="$*"
22809
22810# Sanity check:  We require an extension suitable for use with
22811# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22812# should show up as failures in the test suite, but it's helpful to
22813# catch them now.) The 'extensions' list is normally sorted
22814# alphabetically, so we need to accept either
22815#    DB_File ... Fcntl ... IO  ....
22816# or something like
22817#    Fcntl ... NDBM_File ... IO  ....
22818case " $extensions"  in
22819*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22820*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22821*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22822*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22823   echo "WARNING: The Perl you are building will be quite crippled." >& 4
22824   ;;
22825esac
22826
22827: Remove libraries needed only for extensions
22828: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22829: The exception is SunOS 4.x, which needs them.
22830case "${osname}X${osvers}" in
22831sunos*X4*)
22832    perllibs="$libs"
22833    ;;
22834*) case "$usedl" in
22835    $define|true|[yY]*)
22836	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22837	    shift
22838	    perllibs="$*"
22839	    ;;
22840    *)	perllibs="$libs"
22841	    ;;
22842    esac
22843    ;;
22844esac
22845
22846: Remove build directory name from cppstdin so it can be used from
22847: either the present location or the final installed location.
22848echo " "
22849: Get out of the UU directory to get correct path name.
22850cd ..
22851case "$cppstdin" in
22852`pwd`/cppstdin)
22853	echo "Stripping down cppstdin path name"
22854	cppstdin=cppstdin
22855	;;
22856esac
22857cd UU
22858
22859: end of configuration questions
22860echo " "
22861echo "End of configuration questions."
22862echo " "
22863
22864: back to where it started
22865if test -d ../UU; then
22866	cd ..
22867fi
22868
22869: configuration may be unconditionally patched via a 'config.arch' file
22870if $test -f config.arch; then
22871	echo "I see a config.arch file, loading it." >&4
22872	. ./config.arch
22873fi
22874
22875: configuration may be patched via a 'config.over' file
22876if $test -f config.over; then
22877	echo " "
22878	dflt=y
22879	rp='I see a config.over file.  Do you wish to load it?'
22880	. UU/myread
22881	case "$ans" in
22882	n*) echo "OK, I'll ignore it.";;
22883	*)	. ./config.over
22884		echo "Configuration override changes have been loaded."
22885		;;
22886	esac
22887fi
22888
22889: in case they want portability, strip down executable paths
22890case "$d_portable" in
22891"$define")
22892	echo " "
22893	echo "Stripping down executable paths..." >&4
22894	for file in $loclist $trylist; do
22895		eval temp=\$$file
22896		eval $file=`basename $temp`
22897	done
22898	;;
22899esac
22900
22901: create config.sh file
22902echo " "
22903echo "Creating config.sh..." >&4
22904$spitshell <<EOT >config.sh
22905$startsh
22906#
22907# This file was produced by running the Configure script. It holds all the
22908# definitions figured out by Configure. Should you modify one of these values,
22909# do not forget to propagate your changes by running "Configure -der". You may
22910# instead choose to run each of the .SH files by yourself, or "Configure -S".
22911#
22912
22913# Package name      : $package
22914# Source directory  : $src
22915# Configuration time: $cf_time
22916# Configured by     : $cf_by
22917# Target system     : $myuname
22918
22919EOT
22920: Add in command line options if available
22921$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22922
22923$spitshell <<EOT >>config.sh
22924
22925Author='$Author'
22926Date='$Date'
22927Header='$Header'
22928Id='$Id'
22929Locker='$Locker'
22930Log='$Log'
22931RCSfile='$RCSfile'
22932Revision='$Revision'
22933Source='$Source'
22934State='$State'
22935_a='$_a'
22936_exe='$_exe'
22937_o='$_o'
22938afs='$afs'
22939afsroot='$afsroot'
22940alignbytes='$alignbytes'
22941ansi2knr='$ansi2knr'
22942aphostname='$aphostname'
22943api_revision='$api_revision'
22944api_subversion='$api_subversion'
22945api_version='$api_version'
22946api_versionstring='$api_versionstring'
22947ar='$ar'
22948archlib='$archlib'
22949archlibexp='$archlibexp'
22950archname64='$archname64'
22951archname='$archname'
22952archobjs='$archobjs'
22953asctime_r_proto='$asctime_r_proto'
22954awk='$awk'
22955baserev='$baserev'
22956bash='$bash'
22957bin='$bin'
22958bin_ELF='$bin_ELF'
22959binexp='$binexp'
22960bison='$bison'
22961bootstrap_charset='$bootstrap_charset'
22962byacc='$byacc'
22963byteorder='$byteorder'
22964c='$c'
22965castflags='$castflags'
22966cat='$cat'
22967cc='$cc'
22968cccdlflags='$cccdlflags'
22969ccdlflags='$ccdlflags'
22970ccflags='$ccflags'
22971ccflags_uselargefiles='$ccflags_uselargefiles'
22972ccname='$ccname'
22973ccsymbols='$ccsymbols'
22974ccversion='$ccversion'
22975cf_by='$cf_by'
22976cf_email='$cf_email'
22977cf_time='$cf_time'
22978charbits='$charbits'
22979charsize='$charsize'
22980chgrp='$chgrp'
22981chmod='$chmod'
22982chown='$chown'
22983clocktype='$clocktype'
22984comm='$comm'
22985compress='$compress'
22986contains='$contains'
22987cp='$cp'
22988cpio='$cpio'
22989cpp='$cpp'
22990cpp_stuff='$cpp_stuff'
22991cppccsymbols='$cppccsymbols'
22992cppflags='$cppflags'
22993cpplast='$cpplast'
22994cppminus='$cppminus'
22995cpprun='$cpprun'
22996cppstdin='$cppstdin'
22997cppsymbols='$cppsymbols'
22998crypt_r_proto='$crypt_r_proto'
22999cryptlib='$cryptlib'
23000csh='$csh'
23001ctermid_r_proto='$ctermid_r_proto'
23002ctime_r_proto='$ctime_r_proto'
23003d_Gconvert='$d_Gconvert'
23004d_PRIEUldbl='$d_PRIEUldbl'
23005d_PRIFUldbl='$d_PRIFUldbl'
23006d_PRIGUldbl='$d_PRIGUldbl'
23007d_PRIXU64='$d_PRIXU64'
23008d_PRId64='$d_PRId64'
23009d_PRIeldbl='$d_PRIeldbl'
23010d_PRIfldbl='$d_PRIfldbl'
23011d_PRIgldbl='$d_PRIgldbl'
23012d_PRIi64='$d_PRIi64'
23013d_PRIo64='$d_PRIo64'
23014d_PRIu64='$d_PRIu64'
23015d_PRIx64='$d_PRIx64'
23016d_SCNfldbl='$d_SCNfldbl'
23017d__fwalk='$d__fwalk'
23018d_access='$d_access'
23019d_accessx='$d_accessx'
23020d_aintl='$d_aintl'
23021d_alarm='$d_alarm'
23022d_archlib='$d_archlib'
23023d_asctime64='$d_asctime64'
23024d_asctime_r='$d_asctime_r'
23025d_atolf='$d_atolf'
23026d_atoll='$d_atoll'
23027d_attribute_deprecated='$d_attribute_deprecated'
23028d_attribute_format='$d_attribute_format'
23029d_attribute_malloc='$d_attribute_malloc'
23030d_attribute_nonnull='$d_attribute_nonnull'
23031d_attribute_noreturn='$d_attribute_noreturn'
23032d_attribute_pure='$d_attribute_pure'
23033d_attribute_unused='$d_attribute_unused'
23034d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23035d_bcmp='$d_bcmp'
23036d_bcopy='$d_bcopy'
23037d_bsd='$d_bsd'
23038d_bsdgetpgrp='$d_bsdgetpgrp'
23039d_bsdsetpgrp='$d_bsdsetpgrp'
23040d_builtin_choose_expr='$d_builtin_choose_expr'
23041d_builtin_expect='$d_builtin_expect'
23042d_bzero='$d_bzero'
23043d_c99_variadic_macros='$d_c99_variadic_macros'
23044d_casti32='$d_casti32'
23045d_castneg='$d_castneg'
23046d_charvspr='$d_charvspr'
23047d_chown='$d_chown'
23048d_chroot='$d_chroot'
23049d_chsize='$d_chsize'
23050d_class='$d_class'
23051d_clearenv='$d_clearenv'
23052d_closedir='$d_closedir'
23053d_cmsghdr_s='$d_cmsghdr_s'
23054d_const='$d_const'
23055d_copysignl='$d_copysignl'
23056d_cplusplus='$d_cplusplus'
23057d_crypt='$d_crypt'
23058d_crypt_r='$d_crypt_r'
23059d_csh='$d_csh'
23060d_ctermid='$d_ctermid'
23061d_ctermid_r='$d_ctermid_r'
23062d_ctime64='$d_ctime64'
23063d_ctime_r='$d_ctime_r'
23064d_cuserid='$d_cuserid'
23065d_dbl_dig='$d_dbl_dig'
23066d_dbminitproto='$d_dbminitproto'
23067d_difftime64='$d_difftime64'
23068d_difftime='$d_difftime'
23069d_dir_dd_fd='$d_dir_dd_fd'
23070d_dirfd='$d_dirfd'
23071d_dirnamlen='$d_dirnamlen'
23072d_dlerror='$d_dlerror'
23073d_dlopen='$d_dlopen'
23074d_dlsymun='$d_dlsymun'
23075d_dosuid='$d_dosuid'
23076d_drand48_r='$d_drand48_r'
23077d_drand48proto='$d_drand48proto'
23078d_dup2='$d_dup2'
23079d_eaccess='$d_eaccess'
23080d_endgrent='$d_endgrent'
23081d_endgrent_r='$d_endgrent_r'
23082d_endhent='$d_endhent'
23083d_endhostent_r='$d_endhostent_r'
23084d_endnent='$d_endnent'
23085d_endnetent_r='$d_endnetent_r'
23086d_endpent='$d_endpent'
23087d_endprotoent_r='$d_endprotoent_r'
23088d_endpwent='$d_endpwent'
23089d_endpwent_r='$d_endpwent_r'
23090d_endsent='$d_endsent'
23091d_endservent_r='$d_endservent_r'
23092d_eofnblk='$d_eofnblk'
23093d_eunice='$d_eunice'
23094d_faststdio='$d_faststdio'
23095d_fchdir='$d_fchdir'
23096d_fchmod='$d_fchmod'
23097d_fchown='$d_fchown'
23098d_fcntl='$d_fcntl'
23099d_fcntl_can_lock='$d_fcntl_can_lock'
23100d_fd_macros='$d_fd_macros'
23101d_fd_set='$d_fd_set'
23102d_fds_bits='$d_fds_bits'
23103d_fgetpos='$d_fgetpos'
23104d_finite='$d_finite'
23105d_finitel='$d_finitel'
23106d_flexfnam='$d_flexfnam'
23107d_flock='$d_flock'
23108d_flockproto='$d_flockproto'
23109d_fork='$d_fork'
23110d_fp_class='$d_fp_class'
23111d_fpathconf='$d_fpathconf'
23112d_fpclass='$d_fpclass'
23113d_fpclassify='$d_fpclassify'
23114d_fpclassl='$d_fpclassl'
23115d_fpos64_t='$d_fpos64_t'
23116d_frexpl='$d_frexpl'
23117d_fs_data_s='$d_fs_data_s'
23118d_fseeko='$d_fseeko'
23119d_fsetpos='$d_fsetpos'
23120d_fstatfs='$d_fstatfs'
23121d_fstatvfs='$d_fstatvfs'
23122d_fsync='$d_fsync'
23123d_ftello='$d_ftello'
23124d_ftime='$d_ftime'
23125d_futimes='$d_futimes'
23126d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23127d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23128d_getaddrinfo='$d_getaddrinfo'
23129d_getcwd='$d_getcwd'
23130d_getespwnam='$d_getespwnam'
23131d_getfsstat='$d_getfsstat'
23132d_getgrent='$d_getgrent'
23133d_getgrent_r='$d_getgrent_r'
23134d_getgrgid_r='$d_getgrgid_r'
23135d_getgrnam_r='$d_getgrnam_r'
23136d_getgrps='$d_getgrps'
23137d_gethbyaddr='$d_gethbyaddr'
23138d_gethbyname='$d_gethbyname'
23139d_gethent='$d_gethent'
23140d_gethname='$d_gethname'
23141d_gethostbyaddr_r='$d_gethostbyaddr_r'
23142d_gethostbyname_r='$d_gethostbyname_r'
23143d_gethostent_r='$d_gethostent_r'
23144d_gethostprotos='$d_gethostprotos'
23145d_getitimer='$d_getitimer'
23146d_getlogin='$d_getlogin'
23147d_getlogin_r='$d_getlogin_r'
23148d_getmnt='$d_getmnt'
23149d_getmntent='$d_getmntent'
23150d_getnameinfo='$d_getnameinfo'
23151d_getnbyaddr='$d_getnbyaddr'
23152d_getnbyname='$d_getnbyname'
23153d_getnent='$d_getnent'
23154d_getnetbyaddr_r='$d_getnetbyaddr_r'
23155d_getnetbyname_r='$d_getnetbyname_r'
23156d_getnetent_r='$d_getnetent_r'
23157d_getnetprotos='$d_getnetprotos'
23158d_getpagsz='$d_getpagsz'
23159d_getpbyname='$d_getpbyname'
23160d_getpbynumber='$d_getpbynumber'
23161d_getpent='$d_getpent'
23162d_getpgid='$d_getpgid'
23163d_getpgrp2='$d_getpgrp2'
23164d_getpgrp='$d_getpgrp'
23165d_getppid='$d_getppid'
23166d_getprior='$d_getprior'
23167d_getprotobyname_r='$d_getprotobyname_r'
23168d_getprotobynumber_r='$d_getprotobynumber_r'
23169d_getprotoent_r='$d_getprotoent_r'
23170d_getprotoprotos='$d_getprotoprotos'
23171d_getprpwnam='$d_getprpwnam'
23172d_getpwent='$d_getpwent'
23173d_getpwent_r='$d_getpwent_r'
23174d_getpwnam_r='$d_getpwnam_r'
23175d_getpwuid_r='$d_getpwuid_r'
23176d_getsbyname='$d_getsbyname'
23177d_getsbyport='$d_getsbyport'
23178d_getsent='$d_getsent'
23179d_getservbyname_r='$d_getservbyname_r'
23180d_getservbyport_r='$d_getservbyport_r'
23181d_getservent_r='$d_getservent_r'
23182d_getservprotos='$d_getservprotos'
23183d_getspnam='$d_getspnam'
23184d_getspnam_r='$d_getspnam_r'
23185d_gettimeod='$d_gettimeod'
23186d_gmtime64='$d_gmtime64'
23187d_gmtime_r='$d_gmtime_r'
23188d_gnulibc='$d_gnulibc'
23189d_grpasswd='$d_grpasswd'
23190d_hasmntopt='$d_hasmntopt'
23191d_htonl='$d_htonl'
23192d_ilogbl='$d_ilogbl'
23193d_inc_version_list='$d_inc_version_list'
23194d_index='$d_index'
23195d_inetaton='$d_inetaton'
23196d_inetntop='$d_inetntop'
23197d_inetpton='$d_inetpton'
23198d_int64_t='$d_int64_t'
23199d_ip_mreq='$d_ip_mreq'
23200d_ip_mreq_source='$d_ip_mreq_source'
23201d_ipv6_mreq='$d_ipv6_mreq'
23202d_ipv6_mreq_source='$d_ipv6_mreq_source'
23203d_isascii='$d_isascii'
23204d_isblank='$d_isblank'
23205d_isfinite='$d_isfinite'
23206d_isinf='$d_isinf'
23207d_isnan='$d_isnan'
23208d_isnanl='$d_isnanl'
23209d_killpg='$d_killpg'
23210d_lchown='$d_lchown'
23211d_ldbl_dig='$d_ldbl_dig'
23212d_libm_lib_version='$d_libm_lib_version'
23213d_libname_unique='$d_libname_unique'
23214d_link='$d_link'
23215d_localtime64='$d_localtime64'
23216d_localtime_r='$d_localtime_r'
23217d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23218d_locconv='$d_locconv'
23219d_lc_monetary_2008='$d_lc_monetary_2008'
23220d_lockf='$d_lockf'
23221d_longdbl='$d_longdbl'
23222d_longlong='$d_longlong'
23223d_lseekproto='$d_lseekproto'
23224d_lstat='$d_lstat'
23225d_madvise='$d_madvise'
23226d_malloc_good_size='$d_malloc_good_size'
23227d_malloc_size='$d_malloc_size'
23228d_mblen='$d_mblen'
23229d_mbstowcs='$d_mbstowcs'
23230d_mbtowc='$d_mbtowc'
23231d_memchr='$d_memchr'
23232d_memcmp='$d_memcmp'
23233d_memcpy='$d_memcpy'
23234d_memmove='$d_memmove'
23235d_memset='$d_memset'
23236d_mkdir='$d_mkdir'
23237d_mkdtemp='$d_mkdtemp'
23238d_mkfifo='$d_mkfifo'
23239d_mkstemp='$d_mkstemp'
23240d_mkstemps='$d_mkstemps'
23241d_mktime64='$d_mktime64'
23242d_mktime='$d_mktime'
23243d_mmap='$d_mmap'
23244d_modfl='$d_modfl'
23245d_modfl_pow32_bug='$d_modfl_pow32_bug'
23246d_modflproto='$d_modflproto'
23247d_mprotect='$d_mprotect'
23248d_msg='$d_msg'
23249d_msg_ctrunc='$d_msg_ctrunc'
23250d_msg_dontroute='$d_msg_dontroute'
23251d_msg_oob='$d_msg_oob'
23252d_msg_peek='$d_msg_peek'
23253d_msg_proxy='$d_msg_proxy'
23254d_msgctl='$d_msgctl'
23255d_msgget='$d_msgget'
23256d_msghdr_s='$d_msghdr_s'
23257d_msgrcv='$d_msgrcv'
23258d_msgsnd='$d_msgsnd'
23259d_msync='$d_msync'
23260d_munmap='$d_munmap'
23261d_mymalloc='$d_mymalloc'
23262d_ndbm='$d_ndbm'
23263d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23264d_nice='$d_nice'
23265d_nl_langinfo='$d_nl_langinfo'
23266d_nv_preserves_uv='$d_nv_preserves_uv'
23267d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23268d_off64_t='$d_off64_t'
23269d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23270d_oldpthreads='$d_oldpthreads'
23271d_oldsock='$d_oldsock'
23272d_open3='$d_open3'
23273d_pathconf='$d_pathconf'
23274d_pause='$d_pause'
23275d_perl_otherlibdirs='$d_perl_otherlibdirs'
23276d_phostname='$d_phostname'
23277d_pipe='$d_pipe'
23278d_poll='$d_poll'
23279d_portable='$d_portable'
23280d_prctl='$d_prctl'
23281d_prctl_set_name='$d_prctl_set_name'
23282d_printf_format_null='$d_printf_format_null'
23283d_procselfexe='$d_procselfexe'
23284d_pseudofork='$d_pseudofork'
23285d_pthread_atfork='$d_pthread_atfork'
23286d_pthread_attr_setscope='$d_pthread_attr_setscope'
23287d_pthread_yield='$d_pthread_yield'
23288d_pwage='$d_pwage'
23289d_pwchange='$d_pwchange'
23290d_pwclass='$d_pwclass'
23291d_pwcomment='$d_pwcomment'
23292d_pwexpire='$d_pwexpire'
23293d_pwgecos='$d_pwgecos'
23294d_pwpasswd='$d_pwpasswd'
23295d_pwquota='$d_pwquota'
23296d_qgcvt='$d_qgcvt'
23297d_quad='$d_quad'
23298d_random_r='$d_random_r'
23299d_readdir64_r='$d_readdir64_r'
23300d_readdir='$d_readdir'
23301d_readdir_r='$d_readdir_r'
23302d_readlink='$d_readlink'
23303d_readv='$d_readv'
23304d_recvmsg='$d_recvmsg'
23305d_rename='$d_rename'
23306d_rewinddir='$d_rewinddir'
23307d_rmdir='$d_rmdir'
23308d_safebcpy='$d_safebcpy'
23309d_safemcpy='$d_safemcpy'
23310d_sanemcmp='$d_sanemcmp'
23311d_sbrkproto='$d_sbrkproto'
23312d_scalbnl='$d_scalbnl'
23313d_sched_yield='$d_sched_yield'
23314d_scm_rights='$d_scm_rights'
23315d_seekdir='$d_seekdir'
23316d_select='$d_select'
23317d_sem='$d_sem'
23318d_semctl='$d_semctl'
23319d_semctl_semid_ds='$d_semctl_semid_ds'
23320d_semctl_semun='$d_semctl_semun'
23321d_semget='$d_semget'
23322d_semop='$d_semop'
23323d_sendmsg='$d_sendmsg'
23324d_setegid='$d_setegid'
23325d_seteuid='$d_seteuid'
23326d_setgrent='$d_setgrent'
23327d_setgrent_r='$d_setgrent_r'
23328d_setgrps='$d_setgrps'
23329d_sethent='$d_sethent'
23330d_sethostent_r='$d_sethostent_r'
23331d_setitimer='$d_setitimer'
23332d_setlinebuf='$d_setlinebuf'
23333d_setlocale='$d_setlocale'
23334d_setlocale_r='$d_setlocale_r'
23335d_setnent='$d_setnent'
23336d_setnetent_r='$d_setnetent_r'
23337d_setpent='$d_setpent'
23338d_setpgid='$d_setpgid'
23339d_setpgrp2='$d_setpgrp2'
23340d_setpgrp='$d_setpgrp'
23341d_setprior='$d_setprior'
23342d_setproctitle='$d_setproctitle'
23343d_setprotoent_r='$d_setprotoent_r'
23344d_setpwent='$d_setpwent'
23345d_setpwent_r='$d_setpwent_r'
23346d_setregid='$d_setregid'
23347d_setresgid='$d_setresgid'
23348d_setresuid='$d_setresuid'
23349d_setreuid='$d_setreuid'
23350d_setrgid='$d_setrgid'
23351d_setruid='$d_setruid'
23352d_setsent='$d_setsent'
23353d_setservent_r='$d_setservent_r'
23354d_setsid='$d_setsid'
23355d_setvbuf='$d_setvbuf'
23356d_shm='$d_shm'
23357d_shmat='$d_shmat'
23358d_shmatprototype='$d_shmatprototype'
23359d_shmctl='$d_shmctl'
23360d_shmdt='$d_shmdt'
23361d_shmget='$d_shmget'
23362d_sigaction='$d_sigaction'
23363d_signbit='$d_signbit'
23364d_sigprocmask='$d_sigprocmask'
23365d_sigsetjmp='$d_sigsetjmp'
23366d_sin6_scope_id='$d_sin6_scope_id'
23367d_sitearch='$d_sitearch'
23368d_snprintf='$d_snprintf'
23369d_sockaddr_in6='$d_sockaddr_in6'
23370d_sockaddr_sa_len='$d_sockaddr_sa_len'
23371d_sockatmark='$d_sockatmark'
23372d_sockatmarkproto='$d_sockatmarkproto'
23373d_socket='$d_socket'
23374d_socklen_t='$d_socklen_t'
23375d_sockpair='$d_sockpair'
23376d_socks5_init='$d_socks5_init'
23377d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23378d_sqrtl='$d_sqrtl'
23379d_srand48_r='$d_srand48_r'
23380d_srandom_r='$d_srandom_r'
23381d_sresgproto='$d_sresgproto'
23382d_sresuproto='$d_sresuproto'
23383d_statblks='$d_statblks'
23384d_statfs_f_flags='$d_statfs_f_flags'
23385d_statfs_s='$d_statfs_s'
23386d_static_inline='$d_static_inline'
23387d_statvfs='$d_statvfs'
23388d_stdio_cnt_lval='$d_stdio_cnt_lval'
23389d_stdio_ptr_lval='$d_stdio_ptr_lval'
23390d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23391d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23392d_stdio_stream_array='$d_stdio_stream_array'
23393d_stdiobase='$d_stdiobase'
23394d_stdstdio='$d_stdstdio'
23395d_strchr='$d_strchr'
23396d_strcoll='$d_strcoll'
23397d_strctcpy='$d_strctcpy'
23398d_strerrm='$d_strerrm'
23399d_strerror='$d_strerror'
23400d_strerror_r='$d_strerror_r'
23401d_strftime='$d_strftime'
23402d_strlcat='$d_strlcat'
23403d_strlcpy='$d_strlcpy'
23404d_strtod='$d_strtod'
23405d_strtol='$d_strtol'
23406d_strtold='$d_strtold'
23407d_strtoll='$d_strtoll'
23408d_strtoq='$d_strtoq'
23409d_strtoul='$d_strtoul'
23410d_strtoull='$d_strtoull'
23411d_strtouq='$d_strtouq'
23412d_strxfrm='$d_strxfrm'
23413d_suidsafe='$d_suidsafe'
23414d_symlink='$d_symlink'
23415d_syscall='$d_syscall'
23416d_syscallproto='$d_syscallproto'
23417d_sysconf='$d_sysconf'
23418d_sysernlst='$d_sysernlst'
23419d_syserrlst='$d_syserrlst'
23420d_system='$d_system'
23421d_tcgetpgrp='$d_tcgetpgrp'
23422d_tcsetpgrp='$d_tcsetpgrp'
23423d_telldir='$d_telldir'
23424d_telldirproto='$d_telldirproto'
23425d_time='$d_time'
23426d_timegm='$d_timegm'
23427d_times='$d_times'
23428d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23429d_tm_tm_zone='$d_tm_tm_zone'
23430d_tmpnam_r='$d_tmpnam_r'
23431d_truncate='$d_truncate'
23432d_ttyname_r='$d_ttyname_r'
23433d_tzname='$d_tzname'
23434d_u32align='$d_u32align'
23435d_ualarm='$d_ualarm'
23436d_umask='$d_umask'
23437d_uname='$d_uname'
23438d_union_semun='$d_union_semun'
23439d_unordered='$d_unordered'
23440d_unsetenv='$d_unsetenv'
23441d_usleep='$d_usleep'
23442d_usleepproto='$d_usleepproto'
23443d_ustat='$d_ustat'
23444d_vendorarch='$d_vendorarch'
23445d_vendorbin='$d_vendorbin'
23446d_vendorlib='$d_vendorlib'
23447d_vendorscript='$d_vendorscript'
23448d_vfork='$d_vfork'
23449d_void_closedir='$d_void_closedir'
23450d_voidsig='$d_voidsig'
23451d_voidtty='$d_voidtty'
23452d_volatile='$d_volatile'
23453d_vprintf='$d_vprintf'
23454d_vsnprintf='$d_vsnprintf'
23455d_wait4='$d_wait4'
23456d_waitpid='$d_waitpid'
23457d_wcstombs='$d_wcstombs'
23458d_wctomb='$d_wctomb'
23459d_writev='$d_writev'
23460d_xenix='$d_xenix'
23461date='$date'
23462db_hashtype='$db_hashtype'
23463db_prefixtype='$db_prefixtype'
23464db_version_major='$db_version_major'
23465db_version_minor='$db_version_minor'
23466db_version_patch='$db_version_patch'
23467direntrytype='$direntrytype'
23468dlext='$dlext'
23469dlsrc='$dlsrc'
23470doublesize='$doublesize'
23471drand01='$drand01'
23472drand48_r_proto='$drand48_r_proto'
23473dtrace='$dtrace'
23474dynamic_ext='$dynamic_ext'
23475eagain='$eagain'
23476ebcdic='$ebcdic'
23477echo='$echo'
23478egrep='$egrep'
23479emacs='$emacs'
23480endgrent_r_proto='$endgrent_r_proto'
23481endhostent_r_proto='$endhostent_r_proto'
23482endnetent_r_proto='$endnetent_r_proto'
23483endprotoent_r_proto='$endprotoent_r_proto'
23484endpwent_r_proto='$endpwent_r_proto'
23485endservent_r_proto='$endservent_r_proto'
23486eunicefix='$eunicefix'
23487exe_ext='$exe_ext'
23488expr='$expr'
23489extensions='$extensions'
23490extern_C='$extern_C'
23491extras='$extras'
23492fflushNULL='$fflushNULL'
23493fflushall='$fflushall'
23494find='$find'
23495firstmakefile='$firstmakefile'
23496flex='$flex'
23497fpossize='$fpossize'
23498fpostype='$fpostype'
23499freetype='$freetype'
23500from='$from'
23501full_ar='$full_ar'
23502full_csh='$full_csh'
23503full_sed='$full_sed'
23504gccansipedantic='$gccansipedantic'
23505gccosandvers='$gccosandvers'
23506gccversion='$gccversion'
23507getgrent_r_proto='$getgrent_r_proto'
23508getgrgid_r_proto='$getgrgid_r_proto'
23509getgrnam_r_proto='$getgrnam_r_proto'
23510gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23511gethostbyname_r_proto='$gethostbyname_r_proto'
23512gethostent_r_proto='$gethostent_r_proto'
23513getlogin_r_proto='$getlogin_r_proto'
23514getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23515getnetbyname_r_proto='$getnetbyname_r_proto'
23516getnetent_r_proto='$getnetent_r_proto'
23517getprotobyname_r_proto='$getprotobyname_r_proto'
23518getprotobynumber_r_proto='$getprotobynumber_r_proto'
23519getprotoent_r_proto='$getprotoent_r_proto'
23520getpwent_r_proto='$getpwent_r_proto'
23521getpwnam_r_proto='$getpwnam_r_proto'
23522getpwuid_r_proto='$getpwuid_r_proto'
23523getservbyname_r_proto='$getservbyname_r_proto'
23524getservbyport_r_proto='$getservbyport_r_proto'
23525getservent_r_proto='$getservent_r_proto'
23526getspnam_r_proto='$getspnam_r_proto'
23527gidformat='$gidformat'
23528gidsign='$gidsign'
23529gidsize='$gidsize'
23530gidtype='$gidtype'
23531glibpth='$glibpth'
23532gmake='$gmake'
23533gmtime_r_proto='$gmtime_r_proto'
23534gnulibc_version='$gnulibc_version'
23535grep='$grep'
23536groupcat='$groupcat'
23537groupstype='$groupstype'
23538gzip='$gzip'
23539h_fcntl='$h_fcntl'
23540h_sysfile='$h_sysfile'
23541hint='$hint'
23542hostcat='$hostcat'
23543hostgenerate='$hostgenerate'
23544hostosname='$hostosname'
23545hostperl='$hostperl'
23546html1dir='$html1dir'
23547html1direxp='$html1direxp'
23548html3dir='$html3dir'
23549html3direxp='$html3direxp'
23550i16size='$i16size'
23551i16type='$i16type'
23552i32size='$i32size'
23553i32type='$i32type'
23554i64size='$i64size'
23555i64type='$i64type'
23556i8size='$i8size'
23557i8type='$i8type'
23558i_arpainet='$i_arpainet'
23559i_assert='$i_assert'
23560i_bsdioctl='$i_bsdioctl'
23561i_crypt='$i_crypt'
23562i_db='$i_db'
23563i_dbm='$i_dbm'
23564i_dirent='$i_dirent'
23565i_dlfcn='$i_dlfcn'
23566i_fcntl='$i_fcntl'
23567i_float='$i_float'
23568i_fp='$i_fp'
23569i_fp_class='$i_fp_class'
23570i_gdbm='$i_gdbm'
23571i_gdbm_ndbm='$i_gdbm_ndbm'
23572i_gdbmndbm='$i_gdbmndbm'
23573i_grp='$i_grp'
23574i_ieeefp='$i_ieeefp'
23575i_inttypes='$i_inttypes'
23576i_langinfo='$i_langinfo'
23577i_libutil='$i_libutil'
23578i_limits='$i_limits'
23579i_locale='$i_locale'
23580i_machcthr='$i_machcthr'
23581i_malloc='$i_malloc'
23582i_mallocmalloc='$i_mallocmalloc'
23583i_math='$i_math'
23584i_memory='$i_memory'
23585i_mntent='$i_mntent'
23586i_ndbm='$i_ndbm'
23587i_netdb='$i_netdb'
23588i_neterrno='$i_neterrno'
23589i_netinettcp='$i_netinettcp'
23590i_niin='$i_niin'
23591i_poll='$i_poll'
23592i_prot='$i_prot'
23593i_pthread='$i_pthread'
23594i_pwd='$i_pwd'
23595i_rpcsvcdbm='$i_rpcsvcdbm'
23596i_sgtty='$i_sgtty'
23597i_shadow='$i_shadow'
23598i_socks='$i_socks'
23599i_stdarg='$i_stdarg'
23600i_stdbool='$i_stdbool'
23601i_stddef='$i_stddef'
23602i_stdlib='$i_stdlib'
23603i_string='$i_string'
23604i_sunmath='$i_sunmath'
23605i_sysaccess='$i_sysaccess'
23606i_sysdir='$i_sysdir'
23607i_sysfile='$i_sysfile'
23608i_sysfilio='$i_sysfilio'
23609i_sysin='$i_sysin'
23610i_sysioctl='$i_sysioctl'
23611i_syslog='$i_syslog'
23612i_sysmman='$i_sysmman'
23613i_sysmode='$i_sysmode'
23614i_sysmount='$i_sysmount'
23615i_sysndir='$i_sysndir'
23616i_sysparam='$i_sysparam'
23617i_syspoll='$i_syspoll'
23618i_sysresrc='$i_sysresrc'
23619i_syssecrt='$i_syssecrt'
23620i_sysselct='$i_sysselct'
23621i_syssockio='$i_syssockio'
23622i_sysstat='$i_sysstat'
23623i_sysstatfs='$i_sysstatfs'
23624i_sysstatvfs='$i_sysstatvfs'
23625i_systime='$i_systime'
23626i_systimek='$i_systimek'
23627i_systimes='$i_systimes'
23628i_systypes='$i_systypes'
23629i_sysuio='$i_sysuio'
23630i_sysun='$i_sysun'
23631i_sysutsname='$i_sysutsname'
23632i_sysvfs='$i_sysvfs'
23633i_syswait='$i_syswait'
23634i_termio='$i_termio'
23635i_termios='$i_termios'
23636i_time='$i_time'
23637i_unistd='$i_unistd'
23638i_ustat='$i_ustat'
23639i_utime='$i_utime'
23640i_values='$i_values'
23641i_varargs='$i_varargs'
23642i_varhdr='$i_varhdr'
23643i_vfork='$i_vfork'
23644ignore_versioned_solibs='$ignore_versioned_solibs'
23645inc_version_list='$inc_version_list'
23646inc_version_list_init='$inc_version_list_init'
23647incpath='$incpath'
23648incpth='$incpth'
23649inews='$inews'
23650initialinstalllocation='$initialinstalllocation'
23651installarchlib='$installarchlib'
23652installbin='$installbin'
23653installhtml1dir='$installhtml1dir'
23654installhtml3dir='$installhtml3dir'
23655installman1dir='$installman1dir'
23656installman3dir='$installman3dir'
23657installprefix='$installprefix'
23658installprefixexp='$installprefixexp'
23659installprivlib='$installprivlib'
23660installscript='$installscript'
23661installsitearch='$installsitearch'
23662installsitebin='$installsitebin'
23663installsitehtml1dir='$installsitehtml1dir'
23664installsitehtml3dir='$installsitehtml3dir'
23665installsitelib='$installsitelib'
23666installsiteman1dir='$installsiteman1dir'
23667installsiteman3dir='$installsiteman3dir'
23668installsitescript='$installsitescript'
23669installstyle='$installstyle'
23670installusrbinperl='$installusrbinperl'
23671installvendorarch='$installvendorarch'
23672installvendorbin='$installvendorbin'
23673installvendorhtml1dir='$installvendorhtml1dir'
23674installvendorhtml3dir='$installvendorhtml3dir'
23675installvendorlib='$installvendorlib'
23676installvendorman1dir='$installvendorman1dir'
23677installvendorman3dir='$installvendorman3dir'
23678installvendorscript='$installvendorscript'
23679intsize='$intsize'
23680issymlink='$issymlink'
23681ivdformat='$ivdformat'
23682ivsize='$ivsize'
23683ivtype='$ivtype'
23684known_extensions='$known_extensions'
23685ksh='$ksh'
23686ld='$ld'
23687ld_can_script='$ld_can_script'
23688lddlflags='$lddlflags'
23689ldflags='$ldflags'
23690ldflags_uselargefiles='$ldflags_uselargefiles'
23691ldlibpthname='$ldlibpthname'
23692less='$less'
23693lib_ext='$lib_ext'
23694libc='$libc'
23695libperl='$libperl'
23696libpth='$libpth'
23697libs='$libs'
23698libsdirs='$libsdirs'
23699libsfiles='$libsfiles'
23700libsfound='$libsfound'
23701libspath='$libspath'
23702libswanted='$libswanted'
23703libswanted_uselargefiles='$libswanted_uselargefiles'
23704line='$line'
23705lint='$lint'
23706lkflags='$lkflags'
23707ln='$ln'
23708lns='$lns'
23709localtime_r_proto='$localtime_r_proto'
23710locincpth='$locincpth'
23711loclibpth='$loclibpth'
23712longdblsize='$longdblsize'
23713longlongsize='$longlongsize'
23714longsize='$longsize'
23715lp='$lp'
23716lpr='$lpr'
23717ls='$ls'
23718lseeksize='$lseeksize'
23719lseektype='$lseektype'
23720mad='$mad'
23721madlyh='$madlyh'
23722madlyobj='$madlyobj'
23723madlysrc='$madlysrc'
23724mail='$mail'
23725mailx='$mailx'
23726make='$make'
23727make_set_make='$make_set_make'
23728mallocobj='$mallocobj'
23729mallocsrc='$mallocsrc'
23730malloctype='$malloctype'
23731man1dir='$man1dir'
23732man1direxp='$man1direxp'
23733man1ext='$man1ext'
23734man3dir='$man3dir'
23735man3direxp='$man3direxp'
23736man3ext='$man3ext'
23737mips_type='$mips_type'
23738mistrustnm='$mistrustnm'
23739mkdir='$mkdir'
23740mmaptype='$mmaptype'
23741modetype='$modetype'
23742more='$more'
23743multiarch='$multiarch'
23744mv='$mv'
23745myarchname='$myarchname'
23746mydomain='$mydomain'
23747myhostname='$myhostname'
23748myuname='$myuname'
23749n='$n'
23750need_va_copy='$need_va_copy'
23751netdb_hlen_type='$netdb_hlen_type'
23752netdb_host_type='$netdb_host_type'
23753netdb_name_type='$netdb_name_type'
23754netdb_net_type='$netdb_net_type'
23755nm='$nm'
23756nm_opt='$nm_opt'
23757nm_so_opt='$nm_so_opt'
23758nonxs_ext='$nonxs_ext'
23759nroff='$nroff'
23760nvEUformat='$nvEUformat'
23761nvFUformat='$nvFUformat'
23762nvGUformat='$nvGUformat'
23763nv_overflows_integers_at='$nv_overflows_integers_at'
23764nv_preserves_uv_bits='$nv_preserves_uv_bits'
23765nveformat='$nveformat'
23766nvfformat='$nvfformat'
23767nvgformat='$nvgformat'
23768nvsize='$nvsize'
23769nvtype='$nvtype'
23770o_nonblock='$o_nonblock'
23771obj_ext='$obj_ext'
23772old_pthread_create_joinable='$old_pthread_create_joinable'
23773optimize='$optimize'
23774orderlib='$orderlib'
23775osname='$osname'
23776osvers='$osvers'
23777otherlibdirs='$otherlibdirs'
23778package='$package'
23779pager='$pager'
23780passcat='$passcat'
23781patchlevel='$patchlevel'
23782path_sep='$path_sep'
23783perl5='$perl5'
23784perl='$perl'
23785perl_patchlevel='$perl_patchlevel'
23786perl_static_inline='$perl_static_inline'
23787perladmin='$perladmin'
23788perllibs='$perllibs'
23789perlpath='$perlpath'
23790pg='$pg'
23791phostname='$phostname'
23792pidtype='$pidtype'
23793plibpth='$plibpth'
23794pmake='$pmake'
23795pr='$pr'
23796prefix='$prefix'
23797prefixexp='$prefixexp'
23798privlib='$privlib'
23799privlibexp='$privlibexp'
23800procselfexe='$procselfexe'
23801prototype='$prototype'
23802ptrsize='$ptrsize'
23803quadkind='$quadkind'
23804quadtype='$quadtype'
23805randbits='$randbits'
23806randfunc='$randfunc'
23807random_r_proto='$random_r_proto'
23808randseedtype='$randseedtype'
23809ranlib='$ranlib'
23810rd_nodata='$rd_nodata'
23811readdir64_r_proto='$readdir64_r_proto'
23812readdir_r_proto='$readdir_r_proto'
23813revision='$revision'
23814rm='$rm'
23815rm_try='$rm_try'
23816rmail='$rmail'
23817run='$run'
23818runnm='$runnm'
23819sGMTIME_max='$sGMTIME_max'
23820sGMTIME_min='$sGMTIME_min'
23821sLOCALTIME_max='$sLOCALTIME_max'
23822sLOCALTIME_min='$sLOCALTIME_min'
23823sPRIEUldbl='$sPRIEUldbl'
23824sPRIFUldbl='$sPRIFUldbl'
23825sPRIGUldbl='$sPRIGUldbl'
23826sPRIXU64='$sPRIXU64'
23827sPRId64='$sPRId64'
23828sPRIeldbl='$sPRIeldbl'
23829sPRIfldbl='$sPRIfldbl'
23830sPRIgldbl='$sPRIgldbl'
23831sPRIi64='$sPRIi64'
23832sPRIo64='$sPRIo64'
23833sPRIu64='$sPRIu64'
23834sPRIx64='$sPRIx64'
23835sSCNfldbl='$sSCNfldbl'
23836sched_yield='$sched_yield'
23837scriptdir='$scriptdir'
23838scriptdirexp='$scriptdirexp'
23839sed='$sed'
23840seedfunc='$seedfunc'
23841selectminbits='$selectminbits'
23842selecttype='$selecttype'
23843sendmail='$sendmail'
23844setgrent_r_proto='$setgrent_r_proto'
23845sethostent_r_proto='$sethostent_r_proto'
23846setlocale_r_proto='$setlocale_r_proto'
23847setnetent_r_proto='$setnetent_r_proto'
23848setprotoent_r_proto='$setprotoent_r_proto'
23849setpwent_r_proto='$setpwent_r_proto'
23850setservent_r_proto='$setservent_r_proto'
23851sh='$sh'
23852shar='$shar'
23853sharpbang='$sharpbang'
23854shmattype='$shmattype'
23855shortsize='$shortsize'
23856shrpenv='$shrpenv'
23857shsharp='$shsharp'
23858sig_count='$sig_count'
23859sig_name='$sig_name'
23860sig_name_init='$sig_name_init'
23861sig_num='$sig_num'
23862sig_num_init='$sig_num_init'
23863sig_size='$sig_size'
23864signal_t='$signal_t'
23865sitearch='$sitearch'
23866sitearchexp='$sitearchexp'
23867sitebin='$sitebin'
23868sitebinexp='$sitebinexp'
23869sitehtml1dir='$sitehtml1dir'
23870sitehtml1direxp='$sitehtml1direxp'
23871sitehtml3dir='$sitehtml3dir'
23872sitehtml3direxp='$sitehtml3direxp'
23873sitelib='$sitelib'
23874sitelib_stem='$sitelib_stem'
23875sitelibexp='$sitelibexp'
23876siteman1dir='$siteman1dir'
23877siteman1direxp='$siteman1direxp'
23878siteman3dir='$siteman3dir'
23879siteman3direxp='$siteman3direxp'
23880siteprefix='$siteprefix'
23881siteprefixexp='$siteprefixexp'
23882sitescript='$sitescript'
23883sitescriptexp='$sitescriptexp'
23884sizesize='$sizesize'
23885sizetype='$sizetype'
23886sleep='$sleep'
23887smail='$smail'
23888so='$so'
23889sockethdr='$sockethdr'
23890socketlib='$socketlib'
23891socksizetype='$socksizetype'
23892sort='$sort'
23893spackage='$spackage'
23894spitshell='$spitshell'
23895srand48_r_proto='$srand48_r_proto'
23896srandom_r_proto='$srandom_r_proto'
23897src='$src'
23898ssizetype='$ssizetype'
23899st_ino_sign='$st_ino_sign'
23900st_ino_size='$st_ino_size'
23901startperl='$startperl'
23902startsh='$startsh'
23903static_ext='$static_ext'
23904stdchar='$stdchar'
23905stdio_base='$stdio_base'
23906stdio_bufsiz='$stdio_bufsiz'
23907stdio_cnt='$stdio_cnt'
23908stdio_filbuf='$stdio_filbuf'
23909stdio_ptr='$stdio_ptr'
23910stdio_stream_array='$stdio_stream_array'
23911strerror_r_proto='$strerror_r_proto'
23912strings='$strings'
23913submit='$submit'
23914subversion='$subversion'
23915sysman='$sysman'
23916sysroot='$sysroot'
23917tail='$tail'
23918tar='$tar'
23919targetarch='$targetarch'
23920targetdir='$targetdir'
23921targetenv='$targetenv'
23922targethost='$targethost'
23923targetmkdir='$targetmkdir'
23924targetport='$targetport'
23925targetsh='$targetsh'
23926tbl='$tbl'
23927tee='$tee'
23928test='$test'
23929timeincl='$timeincl'
23930timetype='$timetype'
23931tmpnam_r_proto='$tmpnam_r_proto'
23932to='$to'
23933touch='$touch'
23934tr='$tr'
23935trnl='$trnl'
23936troff='$troff'
23937ttyname_r_proto='$ttyname_r_proto'
23938u16size='$u16size'
23939u16type='$u16type'
23940u32size='$u32size'
23941u32type='$u32type'
23942u64size='$u64size'
23943u64type='$u64type'
23944u8size='$u8size'
23945u8type='$u8type'
23946uidformat='$uidformat'
23947uidsign='$uidsign'
23948uidsize='$uidsize'
23949uidtype='$uidtype'
23950uname='$uname'
23951uniq='$uniq'
23952uquadtype='$uquadtype'
23953use5005threads='$use5005threads'
23954use64bitall='$use64bitall'
23955use64bitint='$use64bitint'
23956usecrosscompile='$usecrosscompile'
23957usedevel='$usedevel'
23958usedl='$usedl'
23959usedtrace='$usedtrace'
23960usefaststdio='$usefaststdio'
23961useithreads='$useithreads'
23962usekernprocpathname='$usekernprocpathname'
23963uselargefiles='$uselargefiles'
23964uselongdouble='$uselongdouble'
23965usemallocwrap='$usemallocwrap'
23966usemorebits='$usemorebits'
23967usemultiplicity='$usemultiplicity'
23968usemymalloc='$usemymalloc'
23969usenm='$usenm'
23970usensgetexecutablepath='$usensgetexecutablepath'
23971useopcode='$useopcode'
23972useperlio='$useperlio'
23973useposix='$useposix'
23974usereentrant='$usereentrant'
23975userelocatableinc='$userelocatableinc'
23976useshrplib='$useshrplib'
23977usesitecustomize='$usesitecustomize'
23978usesocks='$usesocks'
23979usethreads='$usethreads'
23980usevendorprefix='$usevendorprefix'
23981useversionedarchname='$useversionedarchname'
23982usevfork='$usevfork'
23983usrinc='$usrinc'
23984uuname='$uuname'
23985uvXUformat='$uvXUformat'
23986uvoformat='$uvoformat'
23987uvsize='$uvsize'
23988uvtype='$uvtype'
23989uvuformat='$uvuformat'
23990uvxformat='$uvxformat'
23991vaproto='$vaproto'
23992vendorarch='$vendorarch'
23993vendorarchexp='$vendorarchexp'
23994vendorbin='$vendorbin'
23995vendorbinexp='$vendorbinexp'
23996vendorhtml1dir='$vendorhtml1dir'
23997vendorhtml1direxp='$vendorhtml1direxp'
23998vendorhtml3dir='$vendorhtml3dir'
23999vendorhtml3direxp='$vendorhtml3direxp'
24000vendorlib='$vendorlib'
24001vendorlib_stem='$vendorlib_stem'
24002vendorlibexp='$vendorlibexp'
24003vendorman1dir='$vendorman1dir'
24004vendorman1direxp='$vendorman1direxp'
24005vendorman3dir='$vendorman3dir'
24006vendorman3direxp='$vendorman3direxp'
24007vendorprefix='$vendorprefix'
24008vendorprefixexp='$vendorprefixexp'
24009vendorscript='$vendorscript'
24010vendorscriptexp='$vendorscriptexp'
24011version='$version'
24012version_patchlevel_string='$version_patchlevel_string'
24013versiononly='$versiononly'
24014vi='$vi'
24015xlibpth='$xlibpth'
24016yacc='$yacc'
24017yaccflags='$yaccflags'
24018zcat='$zcat'
24019zip='$zip'
24020EOT
24021
24022: add special variables
24023$test -f $src/patchlevel.h && \
24024awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24025echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24026echo "PERL_CONFIG_SH=true" >>config.sh
24027
24028: propagate old symbols
24029if $test -f UU/config.sh; then
24030	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
24031	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24032		config.sh config.sh UU/oldconfig.sh |\
24033		$sort | $uniq -u >UU/oldsyms
24034	set X `$cat UU/oldsyms`
24035	shift
24036	case $# in
24037	0) ;;
24038	*)
24039		$cat <<EOM
24040Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24041EOM
24042		echo ": Variables propagated from previous config.sh file." >>config.sh
24043		for sym in `$cat UU/oldsyms`; do
24044			echo "    Propagating $hint variable "'$'"$sym..."
24045			eval 'tmp="$'"${sym}"'"'
24046			echo "$tmp" | \
24047				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24048		done
24049		;;
24050	esac
24051fi
24052
24053: Finish up by extracting the .SH files
24054case "$alldone" in
24055exit)
24056	$rm -rf UU
24057	echo "Extraction done."
24058	exit 0
24059	;;
24060cont)
24061	;;
24062'')
24063	dflt=''
24064	nostick=true
24065	$cat <<EOM
24066
24067If you'd like to make any changes to the config.sh file before I begin
24068to configure things, do it as a shell escape now (e.g. !vi config.sh).
24069
24070EOM
24071	rp="Press return or use a shell escape to edit config.sh:"
24072	. UU/myread
24073	nostick=''
24074	case "$ans" in
24075	'') ;;
24076	*) : in case they cannot read
24077		sh 1>&4 -c "$ans";;
24078	esac
24079	;;
24080esac
24081
24082: if this fails, just run all the .SH files by hand
24083. ./config.sh
24084
24085echo " "
24086exec 1>&4
24087pwd=`pwd`
24088. ./UU/extract
24089cd "$pwd"
24090
24091if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24092	dflt=y
24093	case "$silent" in
24094	true) ;;
24095	*)
24096		$cat <<EOM
24097
24098Now you need to generate make dependencies by running "$make depend".
24099You might prefer to run it in background: "$make depend > makedepend.out &"
24100It can take a while, so you might not want to run it right now.
24101
24102EOM
24103		;;
24104	esac
24105	rp="Run $make depend now?"
24106	. UU/myread
24107	case "$ans" in
24108	y*)
24109		$make depend && echo "Now you must run '$make'."
24110		;;
24111	*)
24112		echo "You must run '$make depend' then '$make'."
24113		;;
24114	esac
24115elif test -f [Mm]akefile; then
24116	echo " "
24117	echo "Now you must run a $make."
24118else
24119	echo "Configure done."
24120fi
24121
24122if $test -f Policy.sh; then
24123    $cat <<EOM
24124
24125If you compile $package on a different machine or from a different object
24126directory, copy the Policy.sh file from this object directory to the
24127new one before you run Configure -- this will help you with most of
24128the policy defaults.
24129
24130EOM
24131fi
24132if $test -f config.msg; then
24133    echo "Hmm.  I also noted the following information while running:"
24134    echo " "
24135    $cat config.msg >&4
24136    $rm -f config.msg
24137fi
24138$rm -f kit*isdone ark*isdone
24139$rm -rf UU
24140
24141: End of Configure
24142
24143