xref: /openbsd-src/gnu/usr.bin/perl/Configure (revision 50b7afb2c2c0993b0894d4e34bf857cb13ed9c80)
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 May  8 15:28:09 CEST 2013 [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 >/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) ;;
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=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
213extern_C=''
214mistrustnm=''
215usedevel=''
216perllibs=''
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
224extras=''
225d_bsd=''
226d_eunice=''
227d_xenix=''
228eunicefix=''
229ar=''
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
238comm=''
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
251gmake=''
252grep=''
253gzip=''
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
265make=''
266mkdir=''
267more=''
268mv=''
269nm=''
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
287tee=''
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
297zip=''
298full_ar=''
299full_sed=''
300libswanted=''
301hint=''
302myuname=''
303osname=''
304osvers=''
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
315_a=''
316_exe=''
317_o=''
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
324rm_try=''
325afs=''
326afsroot=''
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
335useversionedarchname=''
336d_atolf=''
337d_atoll=''
338baserev=''
339bin=''
340binexp=''
341initialinstalllocation=''
342installbin=''
343userelocatableinc=''
344byteorder=''
345cc=''
346ccflags=''
347cppflags=''
348ldflags=''
349lkflags=''
350locincpth=''
351optimize=''
352cf_email=''
353cf_by=''
354cf_time=''
355charbits=''
356charsize=''
357contains=''
358cpp_stuff=''
359cpplast=''
360cppminus=''
361cpprun=''
362cppstdin=''
363d__fwalk=''
364d_access=''
365d_accessx=''
366d_aintl=''
367d_alarm=''
368asctime_r_proto=''
369d_asctime_r=''
370d_attribute_deprecated=''
371d_attribute_format=''
372d_attribute_malloc=''
373d_attribute_nonnull=''
374d_attribute_noreturn=''
375d_attribute_pure=''
376d_attribute_unused=''
377d_attribute_warn_unused_result=''
378d_printf_format_null=''
379d_bcmp=''
380d_bcopy=''
381d_builtin_choose_expr=''
382d_builtin_expect=''
383d_bzero=''
384d_c99_variadic_macros=''
385d_casti32=''
386castflags=''
387d_castneg=''
388d_chown=''
389d_chroot=''
390d_chsize=''
391d_class=''
392d_clearenv=''
393d_closedir=''
394d_void_closedir=''
395d_cmsghdr_s=''
396d_const=''
397d_copysignl=''
398d_cplusplus=''
399cryptlib=''
400d_crypt=''
401crypt_r_proto=''
402d_crypt_r=''
403d_csh=''
404full_csh=''
405d_ctermid=''
406ctermid_r_proto=''
407d_ctermid_r=''
408ctime_r_proto=''
409d_ctime_r=''
410d_cuserid=''
411d_dbl_dig=''
412d_dbminitproto=''
413d_difftime=''
414d_dir_dd_fd=''
415d_dirfd=''
416d_dlerror=''
417d_dlopen=''
418d_dlsymun=''
419d_dosuid=''
420d_suidsafe=''
421d_drand48_r=''
422drand48_r_proto=''
423d_drand48proto=''
424d_dup2=''
425d_eaccess=''
426d_endgrent=''
427d_endgrent_r=''
428endgrent_r_proto=''
429d_endhent=''
430d_endhostent_r=''
431endhostent_r_proto=''
432d_endnent=''
433d_endnetent_r=''
434endnetent_r_proto=''
435d_endpent=''
436d_endprotoent_r=''
437endprotoent_r_proto=''
438d_endpwent=''
439d_endpwent_r=''
440endpwent_r_proto=''
441d_endsent=''
442d_endservent_r=''
443endservent_r_proto=''
444d_faststdio=''
445d_fchdir=''
446d_fchmod=''
447d_fchown=''
448d_fcntl=''
449d_fcntl_can_lock=''
450d_fd_macros=''
451d_fd_set=''
452d_fds_bits=''
453d_fgetpos=''
454d_finite=''
455d_finitel=''
456d_flexfnam=''
457d_flock=''
458d_flockproto=''
459d_fork=''
460d_fp_class=''
461d_fpclass=''
462d_fpclassify=''
463d_fpclassl=''
464d_fpos64_t=''
465d_frexpl=''
466d_fs_data_s=''
467d_fseeko=''
468d_fsetpos=''
469d_fstatfs=''
470d_fsync=''
471d_ftello=''
472d_ftime=''
473d_gettimeod=''
474d_futimes=''
475d_Gconvert=''
476d_getaddrinfo=''
477d_getcwd=''
478d_getespwnam=''
479d_getfsstat=''
480d_getgrent=''
481d_getgrent_r=''
482getgrent_r_proto=''
483d_getgrgid_r=''
484getgrgid_r_proto=''
485d_getgrnam_r=''
486getgrnam_r_proto=''
487d_getgrps=''
488d_gethbyaddr=''
489d_gethbyname=''
490d_gethent=''
491aphostname=''
492d_gethname=''
493d_phostname=''
494d_uname=''
495d_gethostbyaddr_r=''
496gethostbyaddr_r_proto=''
497d_gethostbyname_r=''
498gethostbyname_r_proto=''
499d_gethostent_r=''
500gethostent_r_proto=''
501d_gethostprotos=''
502d_getitimer=''
503d_getlogin=''
504d_getlogin_r=''
505getlogin_r_proto=''
506d_getmnt=''
507d_getmntent=''
508d_getnameinfo=''
509d_getnbyaddr=''
510d_getnbyname=''
511d_getnent=''
512d_getnetbyaddr_r=''
513getnetbyaddr_r_proto=''
514d_getnetbyname_r=''
515getnetbyname_r_proto=''
516d_getnetent_r=''
517getnetent_r_proto=''
518d_getnetprotos=''
519d_getpagsz=''
520d_getpent=''
521d_getpgid=''
522d_getpgrp2=''
523d_bsdgetpgrp=''
524d_getpgrp=''
525d_getppid=''
526d_getprior=''
527d_getpbyname=''
528d_getpbynumber=''
529d_getprotobyname_r=''
530getprotobyname_r_proto=''
531d_getprotobynumber_r=''
532getprotobynumber_r_proto=''
533d_getprotoent_r=''
534getprotoent_r_proto=''
535d_getprotoprotos=''
536d_getprpwnam=''
537d_getpwent=''
538d_getpwent_r=''
539getpwent_r_proto=''
540d_getpwnam_r=''
541getpwnam_r_proto=''
542d_getpwuid_r=''
543getpwuid_r_proto=''
544d_getsent=''
545d_getservbyname_r=''
546getservbyname_r_proto=''
547d_getservbyport_r=''
548getservbyport_r_proto=''
549d_getservent_r=''
550getservent_r_proto=''
551d_getservprotos=''
552d_getspnam=''
553d_getspnam_r=''
554getspnam_r_proto=''
555d_getsbyname=''
556d_getsbyport=''
557d_gmtime_r=''
558gmtime_r_proto=''
559d_gnulibc=''
560gnulibc_version=''
561d_hasmntopt=''
562d_htonl=''
563d_ilogbl=''
564d_inetaton=''
565d_inetntop=''
566d_inetpton=''
567d_int64_t=''
568d_isascii=''
569d_isblank=''
570d_isfinite=''
571d_isinf=''
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
577d_libm_lib_version=''
578d_link=''
579d_localtime_r=''
580d_localtime_r_needs_tzset=''
581localtime_r_proto=''
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
591d_malloc_good_size=''
592d_malloc_size=''
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
610d_modfl_pow32_bug=''
611d_modflproto=''
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
616d_msghdr_s=''
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
622d_nl_langinfo=''
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
630d_portable=''
631d_prctl=''
632d_prctl_set_name=''
633d_procselfexe=''
634procselfexe=''
635d_old_pthread_create_joinable=''
636old_pthread_create_joinable=''
637d_pthread_atfork=''
638d_pthread_attr_setscope=''
639d_pthread_yield=''
640d_sched_yield=''
641sched_yield=''
642d_qgcvt=''
643d_random_r=''
644random_r_proto=''
645d_readdir64_r=''
646readdir64_r_proto=''
647d_readdir=''
648d_rewinddir=''
649d_seekdir=''
650d_telldir=''
651d_readdir_r=''
652readdir_r_proto=''
653d_readlink=''
654d_readv=''
655d_recvmsg=''
656d_rename=''
657d_rmdir=''
658d_safebcpy=''
659d_safemcpy=''
660d_sanemcmp=''
661d_sbrkproto=''
662d_scalbnl=''
663d_select=''
664d_sem=''
665d_semctl=''
666d_semget=''
667d_semop=''
668d_sendmsg=''
669d_setegid=''
670d_seteuid=''
671d_setgrent=''
672d_setgrent_r=''
673setgrent_r_proto=''
674d_setgrps=''
675d_sethent=''
676d_sethostent_r=''
677sethostent_r_proto=''
678d_setitimer=''
679d_setlinebuf=''
680d_setlocale=''
681d_setlocale_r=''
682setlocale_r_proto=''
683d_setnent=''
684d_setnetent_r=''
685setnetent_r_proto=''
686d_setpent=''
687d_setpgid=''
688d_setpgrp2=''
689d_bsdsetpgrp=''
690d_setpgrp=''
691d_setprior=''
692d_setproctitle=''
693d_setprotoent_r=''
694setprotoent_r_proto=''
695d_setpwent=''
696d_setpwent_r=''
697setpwent_r_proto=''
698d_setregid=''
699d_setresgid=''
700d_setresuid=''
701d_setreuid=''
702d_setrgid=''
703d_setruid=''
704d_setsent=''
705d_setservent_r=''
706setservent_r_proto=''
707d_setsid=''
708d_setvbuf=''
709d_sfio=''
710usesfio=''
711d_shm=''
712d_shmat=''
713d_shmatprototype=''
714shmattype=''
715d_shmctl=''
716d_shmdt=''
717d_shmget=''
718d_sigaction=''
719d_signbit=''
720d_sigprocmask=''
721d_sigsetjmp=''
722usesitecustomize=''
723d_snprintf=''
724d_vsnprintf=''
725d_sockatmark=''
726d_sockatmarkproto=''
727d_ip_mreq=''
728d_ip_mreq_source=''
729d_ipv6_mreq=''
730d_ipv6_mreq_source=''
731d_msg_ctrunc=''
732d_msg_dontroute=''
733d_msg_oob=''
734d_msg_peek=''
735d_msg_proxy=''
736d_oldsock=''
737d_scm_rights=''
738d_sin6_scope_id=''
739d_sockaddr_in6=''
740d_sockaddr_sa_len=''
741d_socket=''
742d_sockpair=''
743sockethdr=''
744socketlib=''
745d_socklen_t=''
746d_socks5_init=''
747d_sprintf_returns_strlen=''
748d_sqrtl=''
749d_srand48_r=''
750srand48_r_proto=''
751d_srandom_r=''
752srandom_r_proto=''
753d_sresgproto=''
754d_sresuproto=''
755d_statblks=''
756d_statfs_f_flags=''
757d_statfs_s=''
758d_static_inline=''
759perl_static_inline=''
760d_fstatvfs=''
761d_statvfs=''
762d_stdio_cnt_lval=''
763d_stdio_ptr_lval=''
764d_stdio_ptr_lval_nochange_cnt=''
765d_stdio_ptr_lval_sets_cnt=''
766d_stdiobase=''
767d_stdstdio=''
768stdio_base=''
769stdio_bufsiz=''
770stdio_cnt=''
771stdio_filbuf=''
772stdio_ptr=''
773d_index=''
774d_strchr=''
775d_strcoll=''
776d_strctcpy=''
777d_strerrm=''
778d_strerror=''
779d_sysernlst=''
780d_syserrlst=''
781d_strerror_r=''
782strerror_r_proto=''
783d_strftime=''
784d_strlcat=''
785d_strlcpy=''
786d_strtod=''
787d_strtol=''
788d_strtold=''
789d_strtoll=''
790d_strtoq=''
791d_strtoul=''
792d_strtoull=''
793d_strtouq=''
794d_strxfrm=''
795d_symlink=''
796d_syscall=''
797d_syscallproto=''
798d_sysconf=''
799d_system=''
800d_tcgetpgrp=''
801d_tcsetpgrp=''
802d_telldirproto=''
803d_time=''
804timetype=''
805d_asctime64=''
806d_ctime64=''
807d_difftime64=''
808d_gmtime64=''
809d_localtime64=''
810d_mktime64=''
811d_timegm=''
812clocktype=''
813d_times=''
814d_tmpnam_r=''
815tmpnam_r_proto=''
816d_truncate=''
817d_ttyname_r=''
818ttyname_r_proto=''
819d_tzname=''
820d_u32align=''
821d_ualarm=''
822d_umask=''
823d_semctl_semid_ds=''
824d_semctl_semun=''
825d_union_semun=''
826d_unordered=''
827d_unsetenv=''
828d_usleep=''
829d_usleepproto=''
830d_ustat=''
831d_pseudofork=''
832d_vfork=''
833usevfork=''
834d_voidsig=''
835signal_t=''
836d_volatile=''
837d_charvspr=''
838d_vprintf=''
839d_wait4=''
840d_waitpid=''
841d_wcstombs=''
842d_wctomb=''
843d_writev=''
844dlext=''
845bin_ELF=''
846cccdlflags=''
847ccdlflags=''
848dlsrc=''
849ld=''
850ld_can_script=''
851lddlflags=''
852usedl=''
853doublesize=''
854bootstrap_charset=''
855ebcdic=''
856fflushNULL=''
857fflushall=''
858fpossize=''
859fpostype=''
860gccansipedantic=''
861gccosandvers=''
862gccversion=''
863gidformat=''
864gidsign=''
865gidsize=''
866gidtype=''
867groupstype=''
868h_fcntl=''
869h_sysfile=''
870html1dir=''
871html1direxp=''
872installhtml1dir=''
873html3dir=''
874html3direxp=''
875installhtml3dir=''
876i_arpainet=''
877i_assert=''
878i_crypt=''
879db_hashtype=''
880db_prefixtype=''
881db_version_major=''
882db_version_minor=''
883db_version_patch=''
884i_db=''
885i_dbm=''
886i_rpcsvcdbm=''
887d_dirnamlen=''
888direntrytype=''
889i_dirent=''
890i_dld=''
891i_dlfcn=''
892i_fcntl=''
893i_float=''
894i_fp=''
895i_fp_class=''
896i_gdbm=''
897d_grpasswd=''
898i_grp=''
899i_ieeefp=''
900i_inttypes=''
901i_langinfo=''
902i_libutil=''
903i_limits=''
904i_locale=''
905i_machcthr=''
906i_malloc=''
907i_mallocmalloc=''
908i_math=''
909i_memory=''
910i_mntent=''
911d_gdbm_ndbm_h_uses_prototypes=''
912d_gdbmndbm_h_uses_prototypes=''
913d_ndbm=''
914d_ndbm_h_uses_prototypes=''
915i_gdbm_ndbm=''
916i_gdbmndbm=''
917i_ndbm=''
918i_netdb=''
919i_neterrno=''
920i_netinettcp=''
921i_niin=''
922i_sysin=''
923i_poll=''
924i_prot=''
925i_pthread=''
926d_pwage=''
927d_pwchange=''
928d_pwclass=''
929d_pwcomment=''
930d_pwexpire=''
931d_pwgecos=''
932d_pwpasswd=''
933d_pwquota=''
934i_pwd=''
935i_sfio=''
936i_shadow=''
937i_socks=''
938i_stdbool=''
939i_stddef=''
940i_stdlib=''
941i_string=''
942strings=''
943i_sunmath=''
944i_sysaccess=''
945i_sysdir=''
946i_sysfile=''
947d_voidtty=''
948i_bsdioctl=''
949i_sysfilio=''
950i_sysioctl=''
951i_syssockio=''
952i_syslog=''
953i_sysmman=''
954i_sysmode=''
955i_sysmount=''
956i_sysndir=''
957i_sysparam=''
958i_syspoll=''
959i_sysresrc=''
960i_syssecrt=''
961i_sysselct=''
962i_sysstat=''
963i_sysstatfs=''
964i_sysstatvfs=''
965i_systimes=''
966i_systypes=''
967i_sysuio=''
968i_sysun=''
969i_sysutsname=''
970i_sysvfs=''
971i_syswait=''
972i_sgtty=''
973i_termio=''
974i_termios=''
975d_tm_tm_gmtoff=''
976d_tm_tm_zone=''
977i_systime=''
978i_systimek=''
979i_time=''
980timeincl=''
981i_unistd=''
982i_ustat=''
983i_utime=''
984i_values=''
985i_stdarg=''
986i_varargs=''
987i_varhdr=''
988i_vfork=''
989d_inc_version_list=''
990inc_version_list=''
991inc_version_list_init=''
992installprefix=''
993installprefixexp=''
994installstyle=''
995installusrbinperl=''
996intsize=''
997longsize=''
998shortsize=''
999issymlink=''
1000libc=''
1001ldlibpthname=''
1002libperl=''
1003shrpenv=''
1004useshrplib=''
1005glibpth=''
1006libpth=''
1007loclibpth=''
1008plibpth=''
1009xlibpth=''
1010ignore_versioned_solibs=''
1011libs=''
1012libsdirs=''
1013libsfiles=''
1014libsfound=''
1015libspath=''
1016lns=''
1017d_PRIEUldbl=''
1018d_PRIFUldbl=''
1019d_PRIGUldbl=''
1020d_PRIeldbl=''
1021d_PRIfldbl=''
1022d_PRIgldbl=''
1023d_SCNfldbl=''
1024sPRIEUldbl=''
1025sPRIFUldbl=''
1026sPRIGUldbl=''
1027sPRIeldbl=''
1028sPRIfldbl=''
1029sPRIgldbl=''
1030sSCNfldbl=''
1031lseeksize=''
1032lseektype=''
1033mad=''
1034madlyh=''
1035madlyobj=''
1036madlysrc=''
1037make_set_make=''
1038d_mymalloc=''
1039freetype=''
1040mallocobj=''
1041mallocsrc=''
1042malloctype=''
1043usemallocwrap=''
1044usemymalloc=''
1045installman1dir=''
1046man1dir=''
1047man1direxp=''
1048man1ext=''
1049installman3dir=''
1050man3dir=''
1051man3direxp=''
1052man3ext=''
1053modetype=''
1054multiarch=''
1055mydomain=''
1056myhostname=''
1057phostname=''
1058c=''
1059n=''
1060d_eofnblk=''
1061eagain=''
1062o_nonblock=''
1063rd_nodata=''
1064need_va_copy=''
1065netdb_hlen_type=''
1066netdb_host_type=''
1067netdb_name_type=''
1068netdb_net_type=''
1069groupcat=''
1070hostcat=''
1071passcat=''
1072orderlib=''
1073ranlib=''
1074d_perl_otherlibdirs=''
1075otherlibdirs=''
1076package=''
1077spackage=''
1078pager=''
1079api_revision=''
1080api_subversion=''
1081api_version=''
1082api_versionstring=''
1083patchlevel=''
1084perl_patchlevel=''
1085revision=''
1086subversion=''
1087version=''
1088version_patchlevel_string=''
1089perl5=''
1090perladmin=''
1091perlpath=''
1092d_nv_preserves_uv=''
1093d_nv_zero_is_allbits_zero=''
1094i16size=''
1095i16type=''
1096i32size=''
1097i32type=''
1098i64size=''
1099i64type=''
1100i8size=''
1101i8type=''
1102ivsize=''
1103ivtype=''
1104nv_overflows_integers_at=''
1105nv_preserves_uv_bits=''
1106nvsize=''
1107nvtype=''
1108u16size=''
1109u16type=''
1110u32size=''
1111u32type=''
1112u64size=''
1113u64type=''
1114u8size=''
1115u8type=''
1116uvsize=''
1117uvtype=''
1118ivdformat=''
1119nvEUformat=''
1120nvFUformat=''
1121nvGUformat=''
1122nveformat=''
1123nvfformat=''
1124nvgformat=''
1125uvXUformat=''
1126uvoformat=''
1127uvuformat=''
1128uvxformat=''
1129pidtype=''
1130prefix=''
1131prefixexp=''
1132installprivlib=''
1133privlib=''
1134privlibexp=''
1135prototype=''
1136ptrsize=''
1137d_PRIXU64=''
1138d_PRId64=''
1139d_PRIi64=''
1140d_PRIo64=''
1141d_PRIu64=''
1142d_PRIx64=''
1143sPRIXU64=''
1144sPRId64=''
1145sPRIi64=''
1146sPRIo64=''
1147sPRIu64=''
1148sPRIx64=''
1149d_quad=''
1150quadkind=''
1151quadtype=''
1152uquadtype=''
1153drand01=''
1154randbits=''
1155randfunc=''
1156randseedtype=''
1157seedfunc=''
1158installscript=''
1159scriptdir=''
1160scriptdirexp=''
1161selectminbits=''
1162selecttype=''
1163sh=''
1164sig_count=''
1165sig_name=''
1166sig_name_init=''
1167sig_num=''
1168sig_num_init=''
1169sig_size=''
1170d_sitearch=''
1171installsitearch=''
1172sitearch=''
1173sitearchexp=''
1174installsitebin=''
1175sitebin=''
1176sitebinexp=''
1177installsitehtml1dir=''
1178sitehtml1dir=''
1179sitehtml1direxp=''
1180installsitehtml3dir=''
1181sitehtml3dir=''
1182sitehtml3direxp=''
1183installsitelib=''
1184sitelib=''
1185sitelib_stem=''
1186sitelibexp=''
1187installsiteman1dir=''
1188siteman1dir=''
1189siteman1direxp=''
1190installsiteman3dir=''
1191siteman3dir=''
1192siteman3direxp=''
1193siteprefix=''
1194siteprefixexp=''
1195installsitescript=''
1196sitescript=''
1197sitescriptexp=''
1198sizesize=''
1199sizetype=''
1200so=''
1201socksizetype=''
1202sharpbang=''
1203shsharp=''
1204spitshell=''
1205src=''
1206ssizetype=''
1207st_ino_sign=''
1208st_ino_size=''
1209startperl=''
1210startsh=''
1211stdchar=''
1212d_stdio_stream_array=''
1213stdio_stream_array=''
1214sysman=''
1215sGMTIME_max=''
1216sGMTIME_min=''
1217sLOCALTIME_max=''
1218sLOCALTIME_min=''
1219trnl=''
1220uidformat=''
1221uidsign=''
1222uidsize=''
1223uidtype=''
1224archname64=''
1225use64bitall=''
1226use64bitint=''
1227dtrace=''
1228usedtrace=''
1229usefaststdio=''
1230usekernprocpathname=''
1231ccflags_uselargefiles=''
1232ldflags_uselargefiles=''
1233libswanted_uselargefiles=''
1234uselargefiles=''
1235uselongdouble=''
1236usemorebits=''
1237usemultiplicity=''
1238nm_opt=''
1239nm_so_opt=''
1240runnm=''
1241usenm=''
1242usensgetexecutablepath=''
1243useperlio=''
1244usesocks=''
1245d_oldpthreads=''
1246use5005threads=''
1247useithreads=''
1248usereentrant=''
1249usethreads=''
1250incpath=''
1251mips_type=''
1252usrinc=''
1253vaproto=''
1254d_vendorarch=''
1255installvendorarch=''
1256vendorarch=''
1257vendorarchexp=''
1258d_vendorbin=''
1259installvendorbin=''
1260vendorbin=''
1261vendorbinexp=''
1262installvendorhtml1dir=''
1263vendorhtml1dir=''
1264vendorhtml1direxp=''
1265installvendorhtml3dir=''
1266vendorhtml3dir=''
1267vendorhtml3direxp=''
1268d_vendorlib=''
1269installvendorlib=''
1270vendorlib=''
1271vendorlib_stem=''
1272vendorlibexp=''
1273installvendorman1dir=''
1274vendorman1dir=''
1275vendorman1direxp=''
1276installvendorman3dir=''
1277vendorman3dir=''
1278vendorman3direxp=''
1279usevendorprefix=''
1280vendorprefix=''
1281vendorprefixexp=''
1282d_vendorscript=''
1283installvendorscript=''
1284vendorscript=''
1285vendorscriptexp=''
1286versiononly=''
1287defvoidused=''
1288voidflags=''
1289yacc=''
1290yaccflags=''
1291CONFIG=''
1292
1293: Detect odd OSs
1294define='define'
1295undef='undef'
1296smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1297rmlist=''
1298
1299: We must find out about Eunice early
1300eunicefix=':'
1301if test -f /etc/unixtovms; then
1302	eunicefix=/etc/unixtovms
1303fi
1304if test -f /etc/unixtovms.exe; then
1305	eunicefix=/etc/unixtovms.exe
1306fi
1307
1308: Set executable suffix now -- needed before hints available
1309if test -f "/libs/version.library"; then
1310: Amiga OS
1311    _exe=""
1312elif test -f "/system/gnu_library/bin/ar.pm"; then
1313: Stratus VOS
1314    _exe=".pm"
1315elif test -n "$DJGPP"; then
1316: DOS DJGPP
1317    _exe=".exe"
1318elif test -d c:/. -o -n "$is_os2" ; then
1319: OS/2 or cygwin
1320    _exe=".exe"
1321fi
1322
1323groupstype=''
1324i_whoami=''
1325: Trailing extension.  Override this in a hint file, if needed.
1326: Extra object files, if any, needed on this platform.
1327archobjs=''
1328archname=''
1329: Possible local include directories to search.
1330: Set locincpth to "" in a hint file to defeat local include searches.
1331locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333:
1334: no include file wanted by default
1335inclwanted=''
1336
1337: Enable -DEBUGGING and -DDEBUGGING from the command line
1338EBUGGING=''
1339DEBUGGING=''
1340
1341libnames=''
1342: change the next line if compiling for Xenix/286 on Xenix/386
1343xlibpth='/usr/lib/386 /lib/386'
1344: Possible local library directories to search.
1345loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348: general looking path for locating libraries
1349glibpth="/lib /usr/lib $xlibpth"
1350glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1351test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1353test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1354
1355: Private path used by Configure to find libraries.  Its value
1356: is prepended to libpth. This variable takes care of special
1357: machines, like the mips.  Usually, it should be empty.
1358plibpth=''
1359
1360: default library list
1361libswanted=''
1362: some systems want to use only the non-versioned libso:s
1363ignore_versioned_solibs=''
1364: set usethreads on the Configure command line to enable threads.
1365usereentrant='undef'
1366: full support for void wanted by default
1367defvoidused=15
1368
1369ccname=''
1370ccversion=''
1371perllibs=''
1372: set useposix=false in your hint file to disable the POSIX extension.
1373useposix=true
1374: set useopcode=false in your hint file to disable the Opcode extension.
1375useopcode=true
1376archname64=''
1377ccflags_uselargefiles=''
1378ldflags_uselargefiles=''
1379libswanted_uselargefiles=''
1380: set usemultiplicity on the Configure command line to enable multiplicity.
1381: set usesocks on the Configure command line to enable socks.
1382: List of libraries we want.
1383: If anyone needs extra -lxxx, put those in a hint file.
1384libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1385libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1386: We probably want to search /usr/shlib before most other libraries.
1387: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1388glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1389glibpth="/usr/shlib $glibpth"
1390: Do not use vfork unless overridden by a hint file.
1391usevfork=false
1392
1393: Find the basic shell for Bourne shell scripts
1394case "$sh" in
1395'')
1396	case "$SYSTYPE" in
1397	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1398	*) xxx='/bin/sh';;
1399	esac
1400	if test -f "$xxx"; then
1401		sh="$xxx"
1402	else
1403		: Build up a list and do a single loop so we can 'break' out.
1404		pth=`echo $PATH | sed -e "s/$p_/ /g"`
1405		for xxx in sh bash ksh pdksh ash; do
1406			for p in $pth; do
1407				try="$try ${p}/${xxx}"
1408			done
1409		done
1410		for xxx in $try; do
1411			if test -f "$xxx"; then
1412				sh="$xxx";
1413				break
1414			elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1415				sh="$xxx";
1416				break
1417			elif test -f "$xxx.exe"; then
1418				sh="$xxx";
1419				break
1420			fi
1421		done
1422	fi
1423	;;
1424esac
1425
1426case "$sh" in
1427'')	cat >&2 <<EOM
1428$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1429
1430Usually it's in /bin/sh.  How did you even get this far?
1431Please contact me (Perl Maintainers) at perlbug@perl.org and
1432we'll try to straighten this all out.
1433EOM
1434	exit 1
1435	;;
1436esac
1437
1438: see if sh knows # comments
1439if `$sh -c '#' >/dev/null 2>&1`; then
1440	shsharp=true
1441	spitshell=cat
1442	xcat=/bin/cat
1443	test -f $xcat$_exe || xcat=/usr/bin/cat
1444	if test ! -f $xcat$_exe; then
1445		for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1446			if test -f $p/cat$_exe; then
1447				xcat=$p/cat
1448				break
1449			fi
1450		done
1451		if test ! -f $xcat$_exe; then
1452			echo "Can't find cat anywhere!"
1453			exit 1
1454		fi
1455	fi
1456	echo "#!$xcat" >sharp
1457	$eunicefix sharp
1458	chmod +x sharp
1459	./sharp > today 2>/dev/null
1460	if test -s today; then
1461		sharpbang='#!'
1462	else
1463		echo "#! $xcat" > sharp
1464		$eunicefix sharp
1465		chmod +x sharp
1466		./sharp > today 2>/dev/null
1467		if test -s today; then
1468			sharpbang='#! '
1469		else
1470			sharpbang=': use '
1471		fi
1472	fi
1473else
1474	echo " "
1475	echo "Your $sh doesn't grok # comments--I will strip them later on."
1476	shsharp=false
1477	cd ..
1478	echo "exec grep -v '^[ 	]*#'" >spitshell
1479	chmod +x spitshell
1480	$eunicefix spitshell
1481	spitshell=`pwd`/spitshell
1482	cd UU
1483	echo "I presume that if # doesn't work, #! won't work either!"
1484	sharpbang=': use '
1485fi
1486rm -f sharp today
1487
1488: figure out how to guarantee sh startup
1489case "$startsh" in
1490'') startsh=${sharpbang}${sh} ;;
1491*)
1492esac
1493cat >sharp <<EOSS
1494$startsh
1495set abc
1496test "$?abc" != 1
1497EOSS
1498
1499chmod +x sharp
1500$eunicefix sharp
1501if ./sharp; then
1502	: echo "Yup, it does."
1503else
1504	echo "Hmm... '$startsh' does not guarantee sh startup..."
1505	echo "You may have to fix up the shell scripts to make sure $sh runs them."
1506fi
1507rm -f sharp
1508
1509: Save command line options in file UU/cmdline.opt for later use in
1510: generating config.sh.
1511cat > cmdline.opt <<EOSH
1512: Configure command line arguments.
1513config_arg0='$0'
1514config_args='$*'
1515config_argc=$#
1516EOSH
1517argn=1
1518args_exp=''
1519args_sep=''
1520for arg in "$@"; do
1521	cat >>cmdline.opt <<EOSH
1522config_arg$argn='$arg'
1523EOSH
1524	cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1525$arg
1526EOC
1527	arg_exp=`cat cmdl.opt`
1528	args_exp="$args_exp$args_sep'$arg_exp'"
1529	argn=`expr $argn + 1`
1530	args_sep=' '
1531done
1532rm -f cmdl.opt
1533
1534: produce awk script to parse command line options
1535cat >options.awk <<'EOF'
1536BEGIN {
1537	optstr = "A:dD:eEf:hKOrsSU:V";	# getopt-style specification
1538
1539	len = length(optstr);
1540	for (i = 1; i <= len; i++) {
1541		c = substr(optstr, i, 1);
1542		if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1543		if (a == ":") {
1544			arg[c] = 1;
1545			i++;
1546		}
1547		opt[c] = 1;
1548	}
1549}
1550{
1551	expect = 0;
1552	str = $0;
1553	if (substr(str, 1, 1) != "-") {
1554		printf("'%s'\n", str);
1555		next;
1556	}
1557	len = length($0);
1558	for (i = 2; i <= len; i++) {
1559		c = substr(str, i, 1);
1560		if (!opt[c]) {
1561			printf("-%s\n", substr(str, i));
1562			next;
1563		}
1564		printf("-%s\n", c);
1565		if (arg[c]) {
1566			if (i < len)
1567				printf("'%s'\n", substr(str, i + 1));
1568			else
1569				expect = 1;
1570			next;
1571		}
1572	}
1573}
1574END {
1575	if (expect)
1576		print "?";
1577}
1578EOF
1579
1580: process the command line options
1581set X `for arg in "$@"; do echo "X$arg"; done |
1582	sed -e s/X// | awk -f options.awk`
1583eval "set $*"
1584shift
1585rm -f options.awk
1586
1587: set up default values
1588fastread=''
1589reuseval=false
1590config_sh=''
1591alldone=''
1592error=''
1593silent=''
1594extractsh=''
1595override=''
1596knowitall=''
1597rm -f optdef.sh posthint.sh
1598cat >optdef.sh <<EOS
1599$startsh
1600EOS
1601
1602
1603: option parsing
1604while test $# -gt 0; do
1605	case "$1" in
1606	-d) shift; fastread=yes;;
1607	-e) shift; alldone=cont;;
1608	-f)
1609		shift
1610		cd ..
1611		if test -r "$1"; then
1612			config_sh="$1"
1613		else
1614			echo "$me: cannot read config file $1." >&2
1615			error=true
1616		fi
1617		cd UU
1618		shift;;
1619	--help|\
1620	-h) shift; error=true;;
1621	-r) shift; reuseval=true;;
1622	-s) shift; silent=true; realsilent=true;;
1623	-E) shift; alldone=exit;;
1624	-K) shift; knowitall=true;;
1625	-O) shift; override=true;;
1626	-S) shift; silent=true; extractsh=true;;
1627	-D)
1628		shift
1629		case "$1" in
1630		*=)
1631			echo "$me: use '-U symbol=', not '-D symbol='." >&2
1632			echo "$me: ignoring -D $1" >&2
1633			;;
1634		*=*) echo "$1" | \
1635				sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1636		*) echo "$1='define'" >> optdef.sh;;
1637		esac
1638		shift
1639		;;
1640	-U)
1641		shift
1642		case "$1" in
1643		*=) echo "$1" >> optdef.sh;;
1644		*=*)
1645			echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1646			echo "$me: ignoring -U $1" >&2
1647			;;
1648		*) echo "$1='undef'" >> optdef.sh;;
1649		esac
1650		shift
1651		;;
1652	-A)
1653	    shift
1654	    xxx=''
1655	    yyy="$1"
1656	    zzz=''
1657	    uuu=undef
1658	    case "$yyy" in
1659            *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1660                 case "$zzz" in
1661                 *:*) zzz='' ;;
1662                 *)   xxx=append
1663                      zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1664                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665                 esac
1666                 ;;
1667            esac
1668            case "$xxx" in
1669            '')  case "$yyy" in
1670                 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1672                      zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1673                      yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674                 *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1675                      yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1676                 esac
1677                 ;;
1678            esac
1679	    case "$xxx" in
1680	    append)
1681		echo "$yyy=\"\${$yyy}$zzz\""	>> posthint.sh ;;
1682	    clear)
1683		echo "$yyy=''"			>> posthint.sh ;;
1684	    define)
1685	        case "$zzz" in
1686		'') zzz=define ;;
1687		esac
1688		echo "$yyy='$zzz'"		>> posthint.sh ;;
1689	    eval)
1690		echo "eval \"$yyy=$zzz\""	>> posthint.sh ;;
1691	    prepend)
1692		echo "$yyy=\"$zzz\${$yyy}\""	>> posthint.sh ;;
1693	    undef)
1694	        case "$zzz" in
1695		'') zzz="$uuu" ;;
1696		esac
1697		echo "$yyy=$zzz"		>> posthint.sh ;;
1698            *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1699	    esac
1700	    shift
1701	    ;;
1702	-V) echo "$me generated by metaconfig 3.5 PL0." >&2
1703	    exit 0;;
1704	--) break;;
1705	-*) echo "$me: unknown option $1" >&2; shift; error=true;;
1706	*) break;;
1707	esac
1708done
1709
1710case "$error" in
1711true)
1712	cat >&2 <<EOM
1713Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1714                 [-U symbol] [-U symbol=] [-A command:symbol...]
1715  -d : use defaults for all answers.
1716  -e : go on without questioning past the production of config.sh.
1717  -f : specify an alternate default configuration file.
1718  -h : print this help message and exit (with an error status).
1719  -r : reuse C symbols value if possible (skips costly nm extraction).
1720  -s : silent mode, only echoes questions and essential information.
1721  -D : define symbol to have some value:
1722         -D symbol         symbol gets the value 'define'
1723         -D symbol=value   symbol gets the value 'value'
1724       common used examples (see INSTALL for more info):
1725         -Duse64bitint            use 64bit integers
1726         -Duse64bitall            use 64bit integers and pointers
1727         -Dusethreads             use thread support
1728         -Dinc_version_list=none  do not include older perl trees in @INC
1729         -DEBUGGING=none          DEBUGGING options
1730         -Dcc=gcc                 choose your compiler
1731         -Dprefix=/opt/perl5      choose your destination
1732  -E : stop at the end of questions, after having produced config.sh.
1733  -K : do not use unless you know what you are doing.
1734  -O : let -D and -U override definitions from loaded configuration file.
1735  -S : perform variable substitutions on all .SH files (can mix with -f)
1736  -U : undefine symbol:
1737         -U symbol    symbol gets the value 'undef'
1738         -U symbol=   symbol gets completely empty
1739       e.g.:  -Uversiononly
1740  -A : manipulate symbol after the platform specific hints have been applied:
1741         -A append:symbol=value   append value to symbol
1742         -A symbol=value          like append:, but with a separating space
1743         -A define:symbol=value   define symbol to have value
1744         -A clear:symbol          define symbol to be ''
1745         -A define:symbol         define symbol to be 'define'
1746         -A eval:symbol=value     define symbol to be eval of value
1747         -A prepend:symbol=value  prepend value to symbol
1748         -A undef:symbol          define symbol to be 'undef'
1749         -A undef:symbol=         define symbol to be ''
1750       e.g.:  -A prepend:libswanted='cl pthread '
1751              -A ccflags=-DSOME_MACRO
1752  -V : print version number and exit (with a zero status).
1753EOM
1754	exit 1
1755	;;
1756esac
1757
1758: Sanity checks
1759case "$fastread$alldone" in
1760yescont|yesexit) ;;
1761*)
1762	case "$extractsh" in
1763	true) ;;
1764	*)
1765		if test ! -t 0; then
1766			echo "Say 'sh Configure', not 'sh <Configure'"
1767			exit 1
1768		fi
1769		;;
1770	esac
1771	;;
1772esac
1773
1774exec 4>&1
1775case "$silent" in
1776true) exec 1>/dev/null;;
1777esac
1778
1779: run the defines and the undefines, if any, but leave the file out there...
1780touch optdef.sh
1781. ./optdef.sh
1782: create the posthint manipulation script and leave the file out there...
1783touch posthint.sh
1784
1785: set package name
1786package='perl5'
1787first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1788last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1789case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1790ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1791*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1792esac
1793
1794: Some greps do not return status, grrr.
1795echo "grimblepritz" >grimble
1796if grep blurfldyick grimble >/dev/null 2>&1 ; then
1797	contains=contains
1798elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1799	contains=grep
1800else
1801	contains=contains
1802fi
1803rm -f grimble
1804: the following should work in any shell
1805case "$contains" in
1806contains*)
1807	echo " "
1808	echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1809	cat >contains <<'EOSS'
1810grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1811EOSS
1812chmod +x contains
1813esac
1814
1815: Find the path to the source tree
1816case "$src" in
1817'') case "$0" in
1818    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1819         case "$src" in
1820	 /*)	;;
1821	 .)	;;
1822         *)	src=`cd ../$src && pwd` ;;
1823	 esac
1824         ;;
1825    *)   src='.';;
1826    esac;;
1827esac
1828case "$src" in
1829'')	src=/
1830	rsrc=/
1831	;;
1832/*)	rsrc="$src";;
1833*)	rsrc="../$src";;
1834esac
1835if test -f $rsrc/Configure && \
1836	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1837then
1838   : found it, so we are ok.
1839else
1840	rsrc=''
1841	for src in . .. ../.. ../../.. ../../../..; do
1842		if test -f ../$src/Configure && \
1843			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1844		then
1845			rsrc=../$src
1846			break
1847		fi
1848	done
1849fi
1850case "$rsrc" in
1851'')
1852	cat <<EOM >&4
1853
1854Sorry, I can't seem to locate the source dir for $package.  Please start
1855Configure with an explicit path -- i.e. /some/path/Configure.
1856
1857EOM
1858	exit 1
1859	;;
1860../.)	rsrc='..';;
1861*)
1862	echo " "
1863	echo "Sources for $package found in \"$src\"." >&4
1864	;;
1865esac
1866
1867: script used to extract .SH files with variable substitutions
1868cat >extract <<'EOS'
1869PERL_CONFIG_SH=true
1870echo "Doing variable substitutions on .SH files..."
1871if test -f MANIFEST; then
1872	set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1873else
1874	echo "(Looking for .SH files under the source directory.)"
1875	set x `(cd "$src"; find . -name "*.SH" -print)`
1876fi
1877shift
1878case $# in
18790) set x `(cd "$src"; echo *.SH)`; shift;;
1880esac
1881if test ! -f "$src/$1"; then
1882	shift
1883fi
1884mkdir_p='
1885name=$1;
1886create="";
1887while test $name; do
1888	if test ! -d "$name"; then
1889		create="$name $create";
1890		name=`echo $name | sed -e "s|^[^/]*$||"`;
1891		name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1892	else
1893		name="";
1894	fi;
1895done;
1896for file in $create; do
1897	mkdir $file;
1898done
1899'
1900for file in $*; do
1901	case "$src" in
1902	".")
1903		case "$file" in
1904		*/*)
1905			dir=`expr X$file : 'X\(.*\)/'`
1906			file=`expr X$file : 'X.*/\(.*\)'`
1907			(cd "$dir" && . ./$file)
1908			;;
1909		*)
1910			. ./$file
1911			;;
1912		esac
1913		;;
1914	*)
1915		case "$file" in
1916		*/*)
1917			dir=`expr X$file : 'X\(.*\)/'`
1918			file=`expr X$file : 'X.*/\(.*\)'`
1919			(set x $dir; shift; eval $mkdir_p)
1920			sh <"$src/$dir/$file"
1921			;;
1922		*)
1923			sh <"$src/$file"
1924			;;
1925		esac
1926		;;
1927	esac
1928done
1929if test -f "$src/config_h.SH"; then
1930	if test ! -f config.h; then
1931	: oops, they left it out of MANIFEST, probably, so do it anyway.
1932	. "$src/config_h.SH"
1933	fi
1934fi
1935EOS
1936
1937: extract files and exit if asked to do so
1938case "$extractsh" in
1939true)
1940	case "$realsilent" in
1941	true) ;;
1942	*) exec 1>&4;;
1943	esac
1944	case "$config_sh" in
1945	'') config_sh='config.sh';;
1946	esac
1947	echo " "
1948	echo "Fetching answers from $config_sh..."
1949	cd ..
1950	. $config_sh
1951	test "$override" && . ./optdef.sh
1952	echo " "
1953	. UU/extract
1954	rm -rf UU
1955	echo "Extraction done."
1956	exit 0
1957	;;
1958esac
1959
1960: Eunice requires " " instead of "", can you believe it
1961echo " "
1962: Here we go...
1963echo "Beginning of configuration questions for $package."
1964
1965trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1966
1967: first determine how to suppress newline on echo command
1968echo " "
1969echo "Checking echo to see how to suppress newlines..."
1970(echo "hi there\c" ; echo " ") >.echotmp
1971if $contains c .echotmp >/dev/null 2>&1 ; then
1972	echo "...using -n."
1973	n='-n'
1974	c=''
1975else
1976	cat <<'EOM'
1977...using \c
1978EOM
1979	n=''
1980	c='\c'
1981fi
1982echo $n "The star should be here-->$c"
1983echo '*'
1984rm -f .echotmp
1985
1986: Now test for existence of everything in MANIFEST
1987echo " "
1988if test -f "$rsrc/MANIFEST"; then
1989	echo "First let's make sure your kit is complete.  Checking..." >&4
1990	awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1991		(split -l 50 2>/dev/null || split -50)
1992	rm -f missing
1993	tmppwd=`pwd`
1994	for filelist in x??; do
1995		(cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1996			>/dev/null 2>>"$tmppwd/missing")
1997	done
1998	if test -s missing; then
1999		cat missing >&4
2000		cat >&4 <<'EOM'
2001
2002THIS PACKAGE SEEMS TO BE INCOMPLETE.
2003
2004You have the option of continuing the configuration process, despite the
2005distinct possibility that your kit is damaged, by typing 'y'es.  If you
2006do, don't blame me if something goes wrong.  I advise you to type 'n'o
2007and contact the author (perlbug@perl.org).
2008
2009EOM
2010		echo $n "Continue? [n] $c" >&4
2011		read ans
2012		case "$ans" in
2013		y*)
2014			echo "Continuing..." >&4
2015			rm -f missing
2016			;;
2017		*)
2018			echo "ABORTING..." >&4
2019			kill $$
2020			;;
2021		esac
2022	else
2023		echo "Looks good..."
2024	fi
2025else
2026	echo "There is no MANIFEST file.  I hope your kit is complete !"
2027fi
2028rm -f missing x??
2029
2030: Find the appropriate value for a newline for tr
2031echo " "
2032if test -n "$DJGPP"; then
2033       trnl='\012'
2034fi
2035if test X"$trnl" = X; then
2036	case "`echo foo|tr '\n' x 2>/dev/null`" in
2037	foox) trnl='\n' ;;
2038	esac
2039fi
2040if test X"$trnl" = X; then
2041	case "`echo foo|tr '\012' x 2>/dev/null`" in
2042	foox) trnl='\012' ;;
2043	esac
2044fi
2045if test X"$trnl" = X; then
2046       case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2047       fooxy) trnl='\n\r' ;;
2048       esac
2049fi
2050if test X"$trnl" = X; then
2051	cat <<EOM >&2
2052
2053$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2054
2055EOM
2056	exit 1
2057fi
2058
2059: compute the number of columns on the terminal for proper question formatting
2060case "$COLUMNS" in
2061'') COLUMNS='80';;
2062esac
2063
2064: set up the echo used in my read
2065myecho="case \"\$xxxm\" in
2066'') echo $n \"\$rp $c\" >&4;;
2067*) case \"\$rp\" in
2068	'') echo $n \"[\$xxxm] $c\";;
2069	*)
2070		if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2071			echo \"\$rp\" >&4
2072			echo $n \"[\$xxxm] $c\" >&4
2073		else
2074			echo $n \"\$rp [\$xxxm] $c\" >&4
2075		fi
2076		;;
2077	esac;;
2078esac"
2079
2080: now set up to do reads with possible shell escape and default assignment
2081cat <<EOSC >myread
2082$startsh
2083xxxm=\$dflt
2084$myecho
2085ans='!'
2086case "\$fastread" in
2087yes) case "\$dflt" in
2088	'') ;;
2089	*) ans='';
2090		case "\$silent-\$rp" in
2091		true-) ;;
2092		*) echo " " >&4;;
2093		esac;;
2094	esac;;
2095*) case "\$silent" in
2096	true) case "\$rp" in
2097		'') ans='';;
2098		esac;;
2099	esac;;
2100esac
2101while expr "X\$ans" : "X!" >/dev/null; do
2102	read answ
2103	set x \$xxxm
2104	shift
2105	aok=''; eval "ans=\\"\$answ\\"" && aok=y
2106	case  "\$answ" in
2107	"!")
2108		sh 1>&4
2109		echo " "
2110		$myecho
2111		;;
2112	!*)
2113		set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2114		shift
2115		sh 1>&4 -c "\$*"
2116		echo " "
2117		$myecho
2118		;;
2119	"\$ans")
2120		case "\$ans" in
2121		\\&*)
2122			set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2123			shift
2124			case "\$1" in
2125			-d)
2126				fastread=yes
2127				echo "(OK, I'll run with -d after this question.)" >&4
2128				;;
2129			-*)
2130				echo "*** Sorry, \$1 not supported yet." >&4
2131				;;
2132			esac
2133			$myecho
2134			ans=!
2135			;;
2136		esac;;
2137	*)
2138		case "\$aok" in
2139		y)
2140			echo "*** Substitution done -- please confirm."
2141			xxxm="\$ans"
2142			ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2143			xxxm="\$ans"
2144			ans=!
2145			;;
2146		*)
2147			echo "*** Error -- try again."
2148			ans=!
2149			;;
2150		esac
2151		$myecho
2152		;;
2153	esac
2154	case "\$ans\$xxxm\$nostick" in
2155	'')
2156		ans=!
2157		$myecho
2158		;;
2159	esac
2160done
2161case "\$ans" in
2162'') ans="\$xxxm";;
2163esac
2164EOSC
2165
2166: create .config dir to save info across Configure sessions
2167test -d ../.config || mkdir ../.config
2168cat >../.config/README <<EOF
2169This directory created by Configure to save information that should
2170persist across sessions for $package.
2171
2172You may safely delete it if you wish.
2173EOF
2174
2175: See if we are using a devel version and want that
2176xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2177case "$usedevel" in
2178$define|true|[yY]*)
2179    usedevel="$define" ;;
2180*) case "$xversion" in
2181   *[13579])
2182	cat >&4 <<EOH
2183*** WHOA THERE!!! ***
2184
2185    This is an UNSTABLE DEVELOPMENT release.
2186    The version of this $package distribution is $xversion, that is, odd,
2187    (as opposed to even) and that signifies a development release.
2188    If you want a maintenance release, you want an even-numbered version.
2189
2190    Do ***NOT*** install this into production use.
2191    Data corruption and crashes are possible.
2192
2193    It is most seriously suggested that you do not continue any further
2194    unless you want to help in developing and debugging Perl.
2195
2196    If you *still* want to build perl, you can answer 'y' now,
2197    or pass -Dusedevel to Configure.
2198
2199EOH
2200	rp='Do you really want to continue?'
2201	dflt='n'
2202	. ./myread
2203	case "$ans" in
2204	[yY]) echo >&4 "Okay, continuing."
2205	      usedevel="$define" ;;
2206	*) echo >&4 "Okay, bye."
2207	   exit 1
2208	   ;;
2209	esac
2210	;;
2211    esac
2212    usedevel="$undef"
2213    ;;
2214esac
2215case "$usedevel" in
2216$define|true|[yY]*)
2217	case "$versiononly" in
2218	'') versiononly="$define" ;;
2219	esac
2220	case "$installusrbinperl" in
2221	'') installusrbinperl="$undef" ;;
2222	esac
2223	;;
2224esac
2225
2226: general instructions
2227needman=true
2228firsttime=true
2229user=`(logname) 2>/dev/null`
2230case "$user" in
2231'') user=`whoami 2>&1`;;
2232esac
2233if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2234	firsttime=false
2235	echo " "
2236	rp='Would you like to see the instructions?'
2237	dflt=n
2238	. ./myread
2239	case "$ans" in
2240	[yY]*) ;;
2241	*) needman=false;;
2242	esac
2243fi
2244if $needman; then
2245	cat <<EOH
2246
2247This installation shell script will examine your system and ask you questions
2248to determine how the perl5 package should be installed. If you get
2249stuck on a question, you may use a ! shell escape to start a subshell or
2250execute a command.  Many of the questions will have default answers in square
2251brackets; typing carriage return will give you the default.
2252
2253On some of the questions which ask for file or directory names you are allowed
2254to use the ~name construct to specify the login directory belonging to "name",
2255even if you don't have a shell which knows about that.  Questions where this is
2256allowed will be marked "(~name ok)".
2257
2258EOH
2259	rp=''
2260	dflt='Type carriage return to continue'
2261	. ./myread
2262	cat <<'EOH'
2263
2264The prompter used in this script allows you to use shell variables and
2265backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2266in the default answer, as if the default line was a set of arguments given to a
2267script shell.  This means you may also use $* to repeat the whole default line,
2268so you do not have to re-type everything to add something to the default.
2269
2270Every time there is a substitution, you will have to confirm.  If there is an
2271error (e.g. an unmatched backtick), the default answer will remain unchanged
2272and you will be prompted again.
2273
2274If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2275the questions and use the computed defaults (or the previous answers if there
2276was already a config.sh file). Type 'Configure -h' for a list of options.
2277You may also start interactively and then answer '& -d' at any prompt to turn
2278on the non-interactive behaviour for the remainder of the execution.
2279
2280EOH
2281	. ./myread
2282	cat <<EOH
2283
2284Much effort has been expended to ensure that this shell script will run on any
2285Unix system.  If despite that it blows up on yours, your best bet is to edit
2286Configure and run it again.  If you can't run Configure for some reason,
2287you'll have to generate a config.sh file by hand.  Whatever problems you
2288have, let me (perlbug@perl.org) know how I blew it.
2289
2290This installation script affects things in two ways:
2291
22921) it may do direct variable substitutions on some of the files included
2293   in this kit.
22942) it builds a config.h file for inclusion in C programs.  You may edit
2295   any of these files as the need arises after running this script.
2296
2297If you make a mistake on a question, there is no easy way to back up to it
2298currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2299files.  Configure will offer to let you do this before it runs the SH files.
2300
2301EOH
2302	dflt='Type carriage return to continue'
2303	. ./myread
2304	case "$firsttime" in
2305	true) echo $user >>../.config/instruct;;
2306	esac
2307fi
2308
2309: find out where common programs are
2310echo " "
2311echo "Locating common programs..." >&4
2312cat <<EOSC >loc
2313$startsh
2314case \$# in
23150) exit 1;;
2316esac
2317thing=\$1
2318shift
2319dflt=\$1
2320shift
2321for dir in \$*; do
2322	case "\$thing" in
2323	.)
2324	if test -d \$dir/\$thing; then
2325		echo \$dir
2326		exit 0
2327	fi
2328	;;
2329	*)
2330	for thisthing in \$dir/\$thing; do
2331		: just loop through to pick last item
2332	done
2333	if test -f \$thisthing; then
2334		echo \$thisthing
2335		exit 0
2336	elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2337		echo \$thisthing
2338		exit 0
2339	elif test -f \$dir/\$thing.exe; then
2340		if test -n "$DJGPP"; then
2341			echo \$dir/\$thing.exe
2342		elif test "$eunicefix" != ":"; then
2343			: on Eunice apparently
2344			echo \$dir/\$thing
2345		fi
2346		exit 0
2347	fi
2348	;;
2349	esac
2350done
2351echo \$dflt
2352exit 1
2353EOSC
2354chmod +x loc
2355$eunicefix loc
2356loclist="
2357awk
2358cat
2359chmod
2360comm
2361cp
2362echo
2363expr
2364grep
2365ls
2366mkdir
2367rm
2368sed
2369sort
2370touch
2371tr
2372uniq
2373"
2374trylist="
2375ar
2376bison
2377byacc
2378cpp
2379csh
2380date
2381egrep
2382gmake
2383gzip
2384less
2385ln
2386make
2387more
2388nm
2389nroff
2390perl
2391pg
2392test
2393uname
2394zip
2395"
2396pth=`echo $PATH | sed -e "s/$p_/ /g"`
2397pth="$pth /lib /usr/lib"
2398for file in $loclist; do
2399	eval xxx=\$$file
2400	case "$xxx" in
2401	/*|?:[\\/]*)
2402		if test -f "$xxx"; then
2403			: ok
2404		else
2405			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406			xxx=`./loc $file $file $pth`
2407		fi
2408		;;
2409	'') xxx=`./loc $file $file $pth`;;
2410	*) xxx=`./loc $xxx $xxx $pth`;;
2411	esac
2412	eval $file=$xxx$_exe
2413	eval _$file=$xxx
2414	case "$xxx" in
2415	/*)
2416		echo $file is in $xxx.
2417		;;
2418	?:[\\/]*)
2419		echo $file is in $xxx.
2420		;;
2421	*)
2422		echo "I don't know where '$file' is, and my life depends on it." >&4
2423		echo "Go find a public domain implementation or fix your PATH setting!" >&4
2424		exit 1
2425		;;
2426	esac
2427done
2428echo " "
2429echo "Don't worry if any of the following aren't found..."
2430say=offhand
2431for file in $trylist; do
2432	eval xxx=\$$file
2433	case "$xxx" in
2434	/*|?:[\\/]*)
2435		if test -f "$xxx"; then
2436			: ok
2437		else
2438			echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2439			xxx=`./loc $file $file $pth`
2440		fi
2441		;;
2442	'') xxx=`./loc $file $file $pth`;;
2443	*) xxx=`./loc $xxx $xxx $pth`;;
2444	esac
2445	eval $file=$xxx$_exe
2446	eval _$file=$xxx
2447	case "$xxx" in
2448	/*)
2449		echo $file is in $xxx.
2450		;;
2451	?:[\\/]*)
2452		echo $file is in $xxx.
2453		;;
2454	*)
2455		echo "I don't see $file out there, $say."
2456		say=either
2457		;;
2458	esac
2459done
2460case "$egrep" in
2461egrep)
2462	echo "Substituting grep for egrep."
2463	egrep=$grep
2464	_egrep=$grep
2465	;;
2466esac
2467case "$less" in
2468'')	;;
2469*)	if $less -R </dev/null >/dev/null; then
2470	       echo "Substituting less -R for less."
2471	       less="$less -R"
2472	       _less=$less
2473	fi
2474	;;
2475esac
2476case "$ln" in
2477ln)
2478	echo "Substituting cp for ln."
2479	ln=$cp
2480	_ln=$cp
2481	;;
2482esac
2483case "$make" in
2484make)
2485	case "$gmake" in
2486	gmake)
2487	echo "I can't find make or gmake, and my life depends on it." >&4
2488	echo "Go find a public domain implementation or fix your PATH setting!" >&4
2489	exit 1
2490	;;
2491	esac
2492	;;
2493esac
2494case "$gmake" in
2495gmake)	;;
2496*)	# We can't have osname yet.
2497	if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2498		# Assume that gmake, if found, is definitely GNU make
2499		# and prefer it over the system make.
2500		echo "Substituting gmake for make."
2501		make=$gmake
2502		_make=$gmake
2503	fi
2504	;;
2505esac
2506case "$test" in
2507test)
2508	echo "Hopefully test is built into your sh."
2509	;;
2510*)
2511	if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2512		echo "Using the test built into your sh."
2513		test=test
2514		_test=test
2515	fi
2516	;;
2517esac
2518case "$echo" in
2519echo)
2520	echo "Hopefully echo is built into your sh."
2521	;;
2522'') ;;
2523*)
2524	echo " "
2525echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2526	$echo $n "hi there$c" >foo1
2527	echo $n "hi there$c" >foo2
2528	if cmp foo1 foo2 >/dev/null 2>&1; then
2529		echo "They are compatible.  In fact, they may be identical."
2530	else
2531		case "$n" in
2532		'-n') n='' c='\c';;
2533		*) n='-n' c='';;
2534		esac
2535		cat <<FOO
2536They are not compatible!  You are probably running ksh on a non-USG system.
2537I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2538have echo built in and we may have to run some Bourne shell scripts.  That
2539means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2540
2541FOO
2542		$echo $n "The star should be here-->$c"
2543		$echo "*"
2544	fi
2545	$rm -f foo1 foo2
2546	;;
2547esac
2548
2549# This question was auctioned at YAPC::Europe-2007 in Vienna
2550# I never promised you could answer it. I only auctioned the question.
2551cat <<FOO
2552The following message is sponsored by
2553
2554  Dresden.pm<--The stars should be here.
2555
2556Dear Perl user, system administrator or package
2557maintainer, the Perl community sends greetings to
2558you. Do you (emblematical) greet back [Y/n]? n
2559
2560FOO
2561
2562: Check what type of C compiler we use
2563cat <<EOS >trygcc
2564$startsh
2565EOS
2566cat <<'EOSC' >>trygcc
2567case "$cc" in
2568'') ;;
2569*)  $rm -f try try.*
2570    $cat >try.c <<EOM
2571int main(int argc, char *argv[]) {
2572  return 0;
2573}
2574EOM
2575    if $cc -o try $ccflags $ldflags try.c; then
2576       :
2577    else
2578        echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2579        despair=yes
2580        trygcc=yes
2581        case "$cc" in
2582        *gcc*) trygcc=no ;;
2583        esac
2584	# Skip this test because it gives a false match on output like:
2585	#    ./trygcc: line 23: cc: command not found
2586        # case "`$cc -v -c try.c 2>&1`" in
2587        # *gcc*) trygcc=no ;;
2588        # esac
2589        if $test X"$trygcc" = Xyes; then
2590            if gcc -o try -c try.c; then
2591                echo " "
2592                echo "You seem to have a working gcc, though." >&4
2593		# Switching compilers may undo the work of hints files.
2594		# The most common problem is -D_REENTRANT for threads.
2595		# This heuristic catches that case, but gets false positives
2596		# if -Dusethreads was not actually specified.  Better to
2597		# bail out here with a useful message than fail
2598		# mysteriously later. Should we perhaps just try to
2599		# re-invoke Configure -Dcc=gcc config_args ?
2600		if $test -f usethreads.cbu; then
2601			$cat >&4 <<EOM 
2602
2603*** However, any setting of the C compiler flags (e.g. for thread support)
2604*** will be lost.  It may be necessary for you to restart Configure and
2605*** add -Dcc=gcc to your Configure command line.
2606
2607EOM
2608			rp="Would you like to go ahead and try gcc anyway?"
2609			dflt=n
2610		else
2611			rp="Would you like to use it?"
2612			dflt=y
2613		fi
2614                if $test -f myread; then
2615                    . ./myread
2616                else
2617                    if $test -f UU/myread; then
2618                        . ./UU/myread
2619                    else
2620                        echo "Cannot find myread, sorry.  Aborting." >&2
2621                        exit 1
2622                    fi
2623                fi
2624                case "$ans" in
2625                [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2626                esac
2627            fi
2628        fi
2629    fi
2630    $rm -f try try.*
2631    ;;
2632esac
2633EOSC
2634
2635cat <<EOS >checkcc
2636$startsh
2637EOS
2638cat <<'EOSC' >>checkcc
2639case "$cc" in
2640'') ;;
2641*)  $rm -f try try.*
2642    $cat >try.c <<EOM
2643int main(int argc, char *argv[]) {
2644  return 0;
2645}
2646EOM
2647    if $cc -o try $ccflags $ldflags try.c; then
2648       :
2649    else
2650        if $test X"$despair" = Xyes; then
2651           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652        fi
2653        $cat >&4 <<EOM         
2654You need to find a working C compiler.
2655Either (purchase and) install the C compiler supplied by your OS vendor,
2656or for a free C compiler try http://gcc.gnu.org/
2657I cannot continue any further, aborting.
2658EOM
2659        exit 1
2660    fi
2661    $rm -f try try.*
2662    ;;
2663esac
2664EOSC
2665
2666: determine whether symbolic links are supported
2667echo " "
2668$touch blurfl
2669if $ln -s blurfl sym > /dev/null 2>&1 ; then
2670	echo "Symbolic links are supported." >&4
2671	lns="$ln -s"
2672else
2673	echo "Symbolic links are NOT supported." >&4
2674	lns="$ln"
2675fi
2676$rm -f blurfl sym
2677
2678: determine whether symbolic links are supported
2679echo " "
2680case "$lns" in
2681*"ln"*" -s")
2682	echo "Checking how to test for symbolic links..." >&4
2683	$lns blurfl sym
2684	if $test "X$issymlink" = X; then
2685		case "$newsh" in
2686		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2688		esac
2689		if test $? = 0; then
2690			issymlink="test -h"
2691		else
2692			echo "Your builtin 'test -h' may be broken." >&4
2693			case "$test" in
2694			/*)	;;
2695			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
2696				for p in $pth
2697				do
2698					if test -f "$p/$test"; then
2699						test="$p/$test"
2700						break
2701					fi
2702				done
2703				;;
2704			esac
2705			case "$test" in
2706			/*)
2707				echo "Trying external '$test -h'." >&4
2708				issymlink="$test -h"
2709				if $test ! -h sym >/dev/null 2>&1; then
2710					echo "External '$test -h' is broken, too." >&4
2711					issymlink=''
2712				fi
2713				;;
2714			*)	issymlink='' ;;
2715			esac
2716		fi
2717	fi
2718	if $test "X$issymlink" = X; then
2719		if $test -L sym 2>/dev/null; then
2720			issymlink="$test -L"
2721			echo "The builtin '$test -L' worked." >&4
2722		fi
2723	fi
2724	if $test "X$issymlink" != X; then
2725		echo "You can test for symbolic links with '$issymlink'." >&4
2726	else
2727		echo "I do not know how you can test for symbolic links." >&4
2728	fi
2729	$rm -f blurfl sym
2730	;;
2731*)	echo "No symbolic links, so not testing for their testing..." >&4
2732	;;
2733esac
2734echo " "
2735
2736: Make symlinks util
2737case "$mksymlinks" in
2738$define|true|[yY]*)
2739	case "$src" in
2740	''|'.')	echo "Cannot create symlinks in the original directory." >&4
2741		exit 1
2742		;;
2743	*)	case "$lns:$issymlink" in
2744		*"ln"*" -s:"*"test -"?)
2745			echo "Creating the symbolic links..." >&4
2746			cd ..
2747			awk -v src="$src" '{
2748				dir=$1;
2749				if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." }
2750				mf[dir] = mf[dir]" "src"/"$1;
2751			} END {
2752				for (d in mf) {
2753					if (d != ".") { system("mkdir -p "d) }
2754					system("ln -sf "mf[d]" "d);
2755				}
2756			}' $src/MANIFEST
2757			# Sanity check 1.
2758			if test ! -d t/base; then
2759				echo "Failed to create the subdirectories.  Aborting." >&4
2760				exit 1
2761			fi
2762			# Sanity check 2.
2763			if test ! -f t/base/lex.t; then
2764				echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2765				exit 1
2766			fi
2767			if test ! -f x2p/walk.c; then
2768				echo "Failed to create the symlinks (x2p/walk.c missing).  Aborting." >&4
2769				exit 1
2770			fi
2771			cd UU
2772			;;
2773		*)	echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2774			;;
2775		esac
2776		;;
2777	esac
2778	;;
2779esac
2780
2781: Check for Cross-Compilation
2782case "$usecrosscompile" in
2783$define|true|[yY]*)
2784	$echo "Cross-compiling..."
2785        croak=''
2786    	case "$cc" in
2787	*-*-gcc) # A cross-compiling gcc, probably.
2788	    targetarch=`$echo $cc|$sed 's/-gcc$//'`
2789	    ar=$targetarch-ar
2790	    # leave out ld, choosing it is more complex
2791	    nm=$targetarch-nm
2792	    ranlib=$targetarch-ranlib
2793	    $echo 'extern int foo;' > try.c
2794	    set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2795	    shift
2796            if $test $# -gt 0; then
2797	        incpth="$incpth $*"
2798		incpth="`$echo $incpth|$sed 's/^ //'`"
2799                echo "Guessing incpth '$incpth'." >&4
2800                for i in $*; do
2801		    j="`$echo $i|$sed 's,/include$,/lib,'`"
2802		    if $test -d $j; then
2803			libpth="$libpth $j"
2804		    fi
2805                done
2806		libpth="`$echo $libpth|$sed 's/^ //'`"
2807                echo "Guessing libpth '$libpth'." >&4
2808	    fi
2809	    $rm -f try.c
2810	    ;;
2811	esac
2812	case "$targetarch" in
2813	'') echo "Targetarch not defined." >&4; croak=y ;;
2814        *)  echo "Using targetarch $targetarch." >&4 ;;
2815	esac
2816	case "$incpth" in
2817	'') echo "Incpth not defined." >&4; croak=y ;;
2818        *)  echo "Using incpth '$incpth'." >&4 ;;
2819	esac
2820	case "$libpth" in
2821	'') echo "Libpth not defined." >&4; croak=y ;;
2822        *)  echo "Using libpth '$libpth'." >&4 ;;
2823	esac
2824	case "$usrinc" in
2825	'') for i in $incpth; do
2826	        if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2827		    usrinc=$i
2828	            echo "Guessing usrinc $usrinc." >&4
2829		    break
2830		fi
2831	    done
2832	    case "$usrinc" in
2833	    '') echo "Usrinc not defined." >&4; croak=y ;;
2834	    esac
2835            ;;
2836        *)  echo "Using usrinc $usrinc." >&4 ;;
2837	esac
2838	case "$targethost" in
2839	'') echo "Targethost not defined." >&4; croak=y ;;
2840        *)  echo "Using targethost $targethost." >&4
2841	esac
2842	locincpth=' '
2843	loclibpth=' '
2844	case "$croak" in
2845	y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2846	esac
2847	case "$src" in
2848	/*) run=$src/Cross/run
2849	    targetmkdir=$src/Cross/mkdir
2850	    to=$src/Cross/to
2851	    from=$src/Cross/from
2852	    ;;
2853	*)  pwd=`$test -f ../Configure & cd ..; pwd`
2854	    run=$pwd/Cross/run
2855	    targetmkdir=$pwd/Cross/mkdir
2856	    to=$pwd/Cross/to
2857	    from=$pwd/Cross/from
2858	    ;;
2859	esac
2860	case "$targetrun" in
2861	'') targetrun=ssh ;;
2862	esac
2863	case "$targetto" in
2864	'') targetto=scp ;;
2865	esac
2866	case "$targetfrom" in
2867	'') targetfrom=scp ;;
2868	esac
2869    	run=$run-$targetrun
2870    	to=$to-$targetto
2871    	from=$from-$targetfrom
2872	case "$targetdir" in
2873	'')  targetdir=/tmp
2874             echo "Guessing targetdir $targetdir." >&4
2875             ;;
2876	esac
2877	case "$targetuser" in
2878	'')  targetuser=root
2879             echo "Guessing targetuser $targetuser." >&4
2880             ;;
2881	esac
2882	case "$targetfrom" in
2883	scp)	q=-q ;;
2884	*)	q='' ;;
2885	esac
2886	case "$targetrun" in
2887	ssh|rsh)
2888	    cat >$run <<EOF
2889#!/bin/sh
2890case "\$1" in
2891-cwd)
2892  shift
2893  cwd=\$1
2894  shift
2895  ;;
2896esac
2897case "\$cwd" in
2898'') cwd=$targetdir ;;
2899esac
2900exe=\$1
2901shift
2902if $test ! -f \$exe.xok; then
2903  $to \$exe
2904  $touch \$exe.xok
2905fi
2906$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2907EOF
2908	    ;;
2909	*)  echo "Unknown targetrun '$targetrun'" >&4
2910	    exit 1
2911	    ;;
2912	esac
2913	case "$targetmkdir" in
2914	*/Cross/mkdir)
2915	    cat >$targetmkdir <<EOF
2916#!/bin/sh
2917$targetrun -l $targetuser $targethost "mkdir -p \$@"
2918EOF
2919	    $chmod a+rx $targetmkdir
2920	    ;;
2921	*)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2922	    exit 1
2923	    ;;
2924	esac
2925	case "$targetto" in
2926	scp|rcp)
2927	    cat >$to <<EOF
2928#!/bin/sh
2929for f in \$@
2930do
2931  case "\$f" in
2932  /*)
2933    $targetmkdir \`dirname \$f\`
2934    $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2935    ;;
2936  *)
2937    $targetmkdir $targetdir/\`dirname \$f\`
2938    $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2939    ;;
2940  esac
2941done
2942exit 0
2943EOF
2944	    ;;
2945	cp) cat >$to <<EOF
2946#!/bin/sh
2947for f in \$@
2948do
2949  case "\$f" in
2950  /*)
2951    $mkdir -p $targetdir/\`dirname \$f\`
2952    $cp \$f $targetdir/\$f || exit 1
2953    ;;
2954  *)
2955    $targetmkdir $targetdir/\`dirname \$f\`
2956    $cp \$f $targetdir/\$f || exit 1
2957    ;;
2958  esac
2959done
2960exit 0
2961EOF
2962	    ;;
2963	*)  echo "Unknown targetto '$targetto'" >&4
2964	    exit 1
2965	    ;;
2966	esac
2967	case "$targetfrom" in
2968	scp|rcp)
2969	  cat >$from <<EOF
2970#!/bin/sh
2971for f in \$@
2972do
2973  $rm -f \$f
2974  $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2975done
2976exit 0
2977EOF
2978	    ;;
2979	cp) cat >$from <<EOF
2980#!/bin/sh
2981for f in \$@
2982do
2983  $rm -f \$f
2984  cp $targetdir/\$f . || exit 1
2985done
2986exit 0
2987EOF
2988	    ;;
2989	*)  echo "Unknown targetfrom '$targetfrom'" >&4
2990	    exit 1
2991	    ;;
2992	esac
2993	if $test ! -f $run; then
2994	    echo "Target 'run' script '$run' not found." >&4
2995	else
2996	    $chmod a+rx $run
2997	fi
2998	if $test ! -f $to; then
2999	    echo "Target 'to' script '$to' not found." >&4
3000	else
3001	    $chmod a+rx $to
3002	fi
3003	if $test ! -f $from; then
3004	    echo "Target 'from' script '$from' not found." >&4
3005	else
3006	    $chmod a+rx $from
3007	fi
3008	if $test ! -f $run -o ! -f $to -o ! -f $from; then
3009	    exit 1
3010	fi
3011	cat >&4 <<EOF
3012Using '$run' for remote execution,
3013and '$from' and '$to'
3014for remote file transfer.
3015EOF
3016	;;
3017*)	run=''
3018	to=:
3019	from=:
3020	usecrosscompile='undef'
3021	targetarch=''
3022	;;
3023esac
3024
3025: see whether [:lower:] and [:upper:] are supported character classes
3026echo " "
3027case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3028ABYZ)
3029	echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3030	up='[:upper:]'
3031	low='[:lower:]'
3032	;;
3033*)	# There is a discontinuity in EBCDIC between 'R' and 'S'
3034	# (0xd9 and 0xe2), therefore that is a nice testing point.
3035	if test "X$up" = X -o "X$low" = X; then
3036	    case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3037	    rs) up='[A-Z]'
3038		low='[a-z]'
3039		;;
3040	    esac
3041	fi
3042	if test "X$up" = X -o "X$low" = X; then
3043	    case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3044	    rs) up='A-Z'
3045		low='a-z'
3046		;;
3047	    esac
3048	fi
3049	if test "X$up" = X -o "X$low" = X; then
3050	    case "`echo RS | od -x 2>/dev/null`" in
3051	    *D9E2*|*d9e2*)
3052		echo "Hey, this might be EBCDIC." >&4
3053		if test "X$up" = X -o "X$low" = X; then
3054		    case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3055		    rs) up='[A-IJ-RS-Z]'
3056			low='[a-ij-rs-z]'
3057			;;
3058		    esac
3059		fi
3060		if test "X$up" = X -o "X$low" = X; then
3061		    case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3062		    rs) up='A-IJ-RS-Z'
3063			low='a-ij-rs-z'
3064			;;
3065		    esac
3066		fi
3067		;;
3068	    esac
3069	fi
3070esac
3071case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3072rs)
3073    echo "Using $up and $low to convert case." >&4
3074    ;;
3075*)
3076    echo "I don't know how to translate letters from upper to lower case." >&4
3077    echo "Your tr is not acting any way I know of." >&4
3078    exit 1
3079    ;;
3080esac
3081: set up the translation script tr, must be called with ./tr of course
3082cat >tr <<EOSC
3083$startsh
3084case "\$1\$2" in
3085'[A-Z][a-z]') exec $tr '$up' '$low';;
3086'[a-z][A-Z]') exec $tr '$low' '$up';;
3087esac
3088exec $tr "\$@"
3089EOSC
3090chmod +x tr
3091$eunicefix tr
3092
3093: Try to determine whether config.sh was made on this system
3094case "$config_sh" in
3095'')
3096myuname=`$uname -a 2>/dev/null`
3097$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3098# Downcase everything to avoid ambiguity.
3099# Remove slashes and single quotes so we can use parts of this in
3100# directory and file names.
3101# Remove newlines so myuname is sane to use elsewhere.
3102# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3103# because the A-Z/a-z are not consecutive.
3104myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3105	./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3106newmyuname="$myuname"
3107dflt=n
3108case "$knowitall" in
3109'')
3110	if test -f ../config.sh; then
3111		if $contains myuname= ../config.sh >/dev/null 2>&1; then
3112			eval "`grep myuname= ../config.sh`"
3113		fi
3114		if test "X$myuname" = "X$newmyuname"; then
3115			dflt=y
3116		fi
3117	fi
3118	;;
3119*) dflt=y;;
3120esac
3121
3122: Get old answers from old config file if Configure was run on the
3123: same system, otherwise use the hints.
3124hint=default
3125cd ..
3126if test -f config.sh; then
3127	echo " "
3128	rp="I see a config.sh file.  Shall I use it to set the defaults?"
3129	. UU/myread
3130	case "$ans" in
3131	n*|N*) echo "OK, I'll ignore it."
3132		mv config.sh config.sh.old
3133		myuname="$newmyuname"
3134		;;
3135	*)  echo "Fetching default answers from your old config.sh file..." >&4
3136		tmp_n="$n"
3137		tmp_c="$c"
3138		tmp_sh="$sh"
3139		. ./config.sh
3140		cp config.sh UU
3141		n="$tmp_n"
3142		c="$tmp_c"
3143		: Older versions did not always set $sh.  Catch re-use of such
3144		: an old config.sh.
3145		case "$sh" in
3146		'') sh="$tmp_sh" ;;
3147		esac
3148		hint=previous
3149		;;
3150	esac
3151fi
3152. ./UU/checkcc
3153if test ! -f config.sh; then
3154	$cat <<EOM
3155
3156First time through, eh?  I have some defaults handy for some systems
3157that need some extra help getting the Configure answers right:
3158
3159EOM
3160	(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3161	dflt=''
3162	: Half the following guesses are probably wrong... If you have better
3163	: tests or hints, please send them to perlbug@perl.org
3164	: The metaconfig authors would also appreciate a copy...
3165	$test -f /irix && osname=irix
3166	$test -f /xenix && osname=sco_xenix
3167	$test -f /dynix && osname=dynix
3168	$test -f /dnix && osname=dnix
3169	$test -f /lynx.os && osname=lynxos
3170	$test -f /unicos && osname=unicos && osvers=`$uname -r`
3171	$test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3172	$test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3173	$test -f /bin/mips && /bin/mips && osname=mips
3174	$test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3175		$sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3176	$test -d /usr/apollo/bin && osname=apollo
3177	$test -f /etc/saf/_sactab && osname=svr4
3178	$test -d /usr/include/minix && osname=minix
3179	$test -f /system/gnu_library/bin/ar.pm && osname=vos
3180	if $test -d /MachTen -o -d /MachTen_Folder; then
3181		osname=machten
3182		if $test -x /sbin/version; then
3183			osvers=`/sbin/version | $awk '{print $2}' |
3184			$sed -e 's/[A-Za-z]$//'`
3185		elif $test -x /usr/etc/version; then
3186			osvers=`/usr/etc/version | $awk '{print $2}' |
3187			$sed -e 's/[A-Za-z]$//'`
3188		else
3189			osvers="$2.$3"
3190		fi
3191	fi
3192
3193	$test -f /sys/posix.dll &&
3194		$test -f /usr/bin/what &&
3195		set X `/usr/bin/what /sys/posix.dll` &&
3196		$test "$3" = UWIN &&
3197		osname=uwin &&
3198		osvers="$5"
3199
3200	if $test -f $uname; then
3201		set X $myuname
3202		shift
3203
3204		case "$5" in
3205		fps*) osname=fps ;;
3206		mips*)
3207			case "$4" in
3208			umips) osname=umips ;;
3209			*) osname=mips ;;
3210			esac;;
3211		[23]100) osname=mips ;;
3212		next*) osname=next ;;
3213		i386*)
3214			tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3215			if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3216				osname='sco'
3217				osvers=$tmp
3218			elif $test -f /etc/kconfig; then
3219				osname=isc
3220				if test "$lns" = "$ln -s"; then
3221					osvers=4
3222				elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3223					osvers=3
3224				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3225					osvers=2
3226				fi
3227			fi
3228			tmp=''
3229			;;
3230		pc*)
3231			if test -n "$DJGPP"; then
3232				osname=dos
3233				osvers=djgpp
3234			fi
3235			;;
3236		esac
3237
3238		case "$1" in
3239		aix) osname=aix
3240			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3241			case "$tmp" in
3242			# oslevel can fail with:
3243			# oslevel: Unable to acquire lock.
3244			*not\ found) osvers="$4"."$3" ;;
3245			'<3240'|'<>3240') osvers=3.2.0 ;;
3246			'=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3247			'=3250'|'>3250') osvers=3.2.5 ;;
3248			*) osvers=$tmp;;
3249			esac
3250			;;
3251		bsd386) osname=bsd386
3252			osvers=`$uname -r`
3253			;;
3254		cygwin*) osname=cygwin
3255			osvers="$3"
3256			;;
3257		*dc.osx) osname=dcosx
3258			osvers="$3"
3259			;;
3260		dnix) osname=dnix
3261			osvers="$3"
3262			;;
3263		domainos) osname=apollo
3264			osvers="$3"
3265			;;
3266		dgux)	osname=dgux
3267			osvers="$3"
3268			;;
3269		dragonfly) osname=dragonfly
3270			osvers="$3"
3271			;;
3272		dynixptx*) osname=dynixptx
3273			osvers=`echo "$4"|sed 's/^v//'`
3274			;;
3275		freebsd) osname=freebsd
3276			osvers="$3" ;;
3277		genix)	osname=genix ;;
3278		gnu)	osname=gnu
3279			osvers="$3" ;;
3280		hp*)	osname=hpux
3281			osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3282			;;
3283		irix*)	osname=irix
3284			case "$3" in
3285			4*) osvers=4 ;;
3286			5*) osvers=5 ;;
3287			*)	osvers="$3" ;;
3288			esac
3289			;;
3290		linux)	osname=linux
3291			case "$3" in
3292			*)	osvers="$3" ;;
3293			esac
3294			;;
3295		MiNT)	osname=mint
3296			;;
3297		netbsd*) osname=netbsd
3298			osvers="$3"
3299			;;
3300		news-os) osvers="$3"
3301			case "$3" in
3302			4*) osname=newsos4 ;;
3303			*) osname=newsos ;;
3304			esac
3305			;;
3306		next*) osname=next ;;
3307		nonstop-ux) osname=nonstopux ;;
3308		openbsd) osname=openbsd
3309                	osvers="$3"
3310                	;;
3311		os2)	osname=os2
3312			osvers="$4"
3313			;;
3314		POSIX-BC | posix-bc ) osname=posix-bc
3315			osvers="$3"
3316			;;
3317		powerux | power_ux | powermax_os | powermaxos | \
3318		powerunix | power_unix) osname=powerux
3319			osvers="$3"
3320			;;
3321		qnx) osname=qnx
3322			osvers="$4"
3323			;;
3324		solaris) osname=solaris
3325			case "$3" in
3326			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3327			*)	osvers="$3" ;;
3328			esac
3329			;;
3330		sunos) osname=sunos
3331			case "$3" in
3332			5*) osname=solaris
3333				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3334			*)	osvers="$3" ;;
3335			esac
3336			;;
3337		titanos) osname=titanos
3338			case "$3" in
3339			1*) osvers=1 ;;
3340			2*) osvers=2 ;;
3341			3*) osvers=3 ;;
3342			4*) osvers=4 ;;
3343			*)	osvers="$3" ;;
3344			esac
3345			;;
3346		ultrix) osname=ultrix
3347			osvers="$3"
3348			;;
3349		osf1|mls+)	case "$5" in
3350				alpha)
3351					osname=dec_osf
3352					osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3353					case "$osvers" in
3354					[1-9].[0-9]*) ;;
3355					*) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3356					esac
3357					;;
3358			hp*)	osname=hp_osf1	;;
3359			mips)	osname=mips_osf1 ;;
3360			esac
3361			;;
3362		# UnixWare 7.1.2 is known as Open UNIX 8
3363		openunix|unixware) osname=svr5
3364			osvers="$4"
3365			;;
3366		uts)	osname=uts
3367			osvers="$3"
3368			;;
3369		vos) osvers="$3"
3370			;;
3371		$2) case "$osname" in
3372			*isc*) ;;
3373			*freebsd*) ;;
3374			svr*)
3375				: svr4.x or possibly later
3376				case "svr$3" in
3377				${osname}*)
3378					osname=svr$3
3379					osvers=$4
3380					;;
3381				esac
3382				case "$osname" in
3383				svr4.0)
3384					: Check for ESIX
3385					if test -f /stand/boot ; then
3386						eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3387						if test -n "$INITPROG" -a -f "$INITPROG"; then
3388			isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3389							if test -n "$isesix"; then
3390								osname=esix4
3391							fi
3392						fi
3393					fi
3394					;;
3395				esac
3396				;;
3397			*)	if test -f /etc/systemid; then
3398					osname=sco
3399					set `echo $3 | $sed 's/\./ /g'` $4
3400					if $test -f $src/hints/sco_$1_$2_$3.sh; then
3401						osvers=$1.$2.$3
3402					elif $test -f $src/hints/sco_$1_$2.sh; then
3403						osvers=$1.$2
3404					elif $test -f $src/hints/sco_$1.sh; then
3405						osvers=$1
3406					fi
3407				else
3408					case "$osname" in
3409					'') : Still unknown.  Probably a generic Sys V.
3410						osname="sysv"
3411						osvers="$3"
3412						;;
3413					esac
3414				fi
3415				;;
3416			esac
3417			;;
3418		*)	case "$osname" in
3419			'') : Still unknown.  Probably a generic BSD.
3420				osname="$1"
3421				osvers="$3"
3422				;;
3423			esac
3424			;;
3425		esac
3426	else
3427		if test -f /vmunix -a -f $src/hints/news_os.sh; then
3428			(what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3429			if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3430				osname=news_os
3431			fi
3432			$rm -f UU/kernel.what
3433		elif test -d c:/. -o -n "$is_os2" ; then
3434			set X $myuname
3435			osname=os2
3436			osvers="$5"
3437		fi
3438	fi
3439
3440        case "$targetarch" in
3441        '') ;;
3442        *)  hostarch=$osname
3443            osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3444            osvers=''
3445            ;;
3446        esac
3447
3448	: Now look for a hint file osname_osvers, unless one has been
3449	: specified already.
3450	case "$hintfile" in
3451	''|' ')
3452		file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3453		: Also try without trailing minor version numbers.
3454		xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3455		xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3456		xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3457		xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3458		case "$file" in
3459		'') dflt=none ;;
3460		*)  case "$osvers" in
3461			'') dflt=$file
3462				;;
3463			*)  if $test -f $src/hints/$file.sh ; then
3464					dflt=$file
3465				elif $test -f $src/hints/$xfile.sh ; then
3466					dflt=$xfile
3467				elif $test -f $src/hints/$xxfile.sh ; then
3468					dflt=$xxfile
3469				elif $test -f $src/hints/$xxxfile.sh ; then
3470					dflt=$xxxfile
3471				elif $test -f $src/hints/$xxxxfile.sh ; then
3472					dflt=$xxxxfile
3473				elif $test -f "$src/hints/${osname}.sh" ; then
3474					dflt="${osname}"
3475				else
3476					dflt=none
3477				fi
3478				;;
3479			esac
3480			;;
3481		esac
3482		if $test -f Policy.sh ; then
3483			case "$dflt" in
3484			*Policy*) ;;
3485			none) dflt="Policy" ;;
3486			*) dflt="Policy $dflt" ;;
3487			esac
3488		fi
3489		;;
3490	*)
3491		dflt=`echo $hintfile | $sed 's/\.sh$//'`
3492		;;
3493	esac
3494
3495	if $test -f Policy.sh ; then
3496		$cat <<EOM
3497
3498There's also a Policy hint file available, which should make the
3499site-specific (policy) questions easier to answer.
3500EOM
3501
3502	fi
3503
3504	$cat <<EOM
3505
3506You may give one or more space-separated answers, or "none" if appropriate.
3507If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3508previous run of Configure, you may specify it as well as or instead of
3509OS-specific hints.  If hints are provided for your OS, you should use them:
3510although Perl can probably be built without hints on many platforms, using
3511hints often improve performance and may enable features that Configure can't
3512set up on its own. If there are no hints that match your OS, specify "none";
3513DO NOT give a wrong version or a wrong OS.
3514
3515EOM
3516
3517	rp="Which of these apply, if any?"
3518	. UU/myread
3519	tans=$ans
3520	for file in $tans; do
3521		if $test X$file = XPolicy -a -f Policy.sh; then
3522			. Policy.sh
3523			$cat Policy.sh >> UU/config.sh
3524		elif $test -f $src/hints/$file.sh; then
3525			. $src/hints/$file.sh
3526			$cat $src/hints/$file.sh >> UU/config.sh
3527		elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3528			: nothing
3529		else
3530			: Give one chance to correct a possible typo.
3531			echo "$file.sh does not exist"
3532			dflt=$file
3533			rp="hint to use instead?"
3534			. UU/myread
3535			for file in $ans; do
3536				if $test -f "$src/hints/$file.sh"; then
3537					. $src/hints/$file.sh
3538					$cat $src/hints/$file.sh >> UU/config.sh
3539				elif $test X$ans = X -o X$ans = Xnone ; then
3540					: nothing
3541				else
3542					echo "$file.sh does not exist -- ignored."
3543				fi
3544			done
3545		fi
3546	done
3547
3548	hint=recommended
3549	: Remember our hint file for later.
3550	if $test -f "$src/hints/$file.sh" ; then
3551		hintfile="$file"
3552	else
3553		hintfile=''
3554	fi
3555fi
3556cd UU
3557;;
3558*)
3559	echo " "
3560	echo "Fetching default answers from $config_sh..." >&4
3561	tmp_n="$n"
3562	tmp_c="$c"
3563	cd ..
3564	cp $config_sh config.sh 2>/dev/null
3565	chmod +w config.sh
3566	. ./config.sh
3567	cd UU
3568	cp ../config.sh .
3569	n="$tmp_n"
3570	c="$tmp_c"
3571	hint=previous
3572	;;
3573esac
3574test "$override" && . ./optdef.sh
3575
3576: Restore computed paths
3577for file in $loclist $trylist; do
3578	eval $file="\$_$file"
3579done
3580
3581cat << EOM
3582
3583Configure uses the operating system name and version to set some defaults.
3584The default value is probably right if the name rings a bell. Otherwise,
3585since spelling matters for me, either accept the default or answer "none"
3586to leave it blank.
3587
3588EOM
3589case "$osname" in
3590	''|' ')
3591		case "$hintfile" in
3592		''|' '|none) dflt=none ;;
3593		*)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3594		esac
3595		;;
3596	*) dflt="$osname" ;;
3597esac
3598rp="Operating system name?"
3599. ./myread
3600case "$ans" in
3601none)  osname='' ;;
3602*) osname=`echo "$ans" | $sed -e 's/[ 	][	]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3603esac
3604echo " "
3605case "$osvers" in
3606	''|' ')
3607		case "$hintfile" in
3608		''|' '|none) dflt=none ;;
3609		*)	dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3610			dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3611			case "$dflt" in
3612			''|' ') dflt=none ;;
3613			esac
3614			;;
3615		esac
3616		;;
3617	*) dflt="$osvers" ;;
3618esac
3619rp="Operating system version?"
3620. ./myread
3621case "$ans" in
3622none)  osvers='' ;;
3623*) osvers="$ans" ;;
3624esac
3625
3626
3627. ./posthint.sh
3628
3629: who configured the system
3630cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3631case "$cf_by" in
3632"")
3633	cf_by=`(logname) 2>/dev/null`
3634	case "$cf_by" in
3635	"")
3636		cf_by=`(whoami) 2>/dev/null`
3637		case "$cf_by" in
3638		"") cf_by=unknown ;;
3639		esac ;;
3640	esac ;;
3641esac
3642
3643: decide how portable to be.  Allow command line overrides.
3644case "$d_portable" in
3645"$undef") ;;
3646*)	d_portable="$define" ;;
3647esac
3648
3649: set up shell script to do ~ expansion
3650cat >filexp <<EOSS
3651$startsh
3652: expand filename
3653case "\$1" in
3654 \~/*|\~)
3655	echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3656	;;
3657 \~*)
3658	if $test -f /bin/csh; then
3659		/bin/csh -f -c "glob \$1"
3660		failed=\$?
3661		echo ""
3662		exit \$failed
3663	else
3664		name=\`$expr x\$1 : '..\([^/]*\)'\`
3665		dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3666		if $test ! -d "\$dir"; then
3667			me=\`basename \$0\`
3668			echo "\$me: can't locate home directory for: \$name" >&2
3669			exit 1
3670		fi
3671		case "\$1" in
3672		*/*)
3673			echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3674			;;
3675		*)
3676			echo \$dir
3677			;;
3678		esac
3679	fi
3680	;;
3681*)
3682	echo \$1
3683	;;
3684esac
3685EOSS
3686chmod +x filexp
3687$eunicefix filexp
3688
3689: now set up to get a file name
3690cat <<EOS >getfile
3691$startsh
3692EOS
3693cat <<'EOSC' >>getfile
3694tilde=''
3695fullpath=''
3696already=''
3697skip=''
3698none_ok=''
3699exp_file=''
3700nopath_ok=''
3701orig_rp="$rp"
3702orig_dflt="$dflt"
3703case "$gfpth" in
3704'') gfpth='.' ;;
3705esac
3706
3707case "$fn" in
3708*\(*)
3709	: getfile will accept an answer from the comma-separated list
3710	: enclosed in parentheses even if it does not meet other criteria.
3711	expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3712	fn=`echo $fn | sed 's/(.*)//'`
3713	;;
3714esac
3715
3716case "$fn" in
3717*:*)
3718	loc_file=`expr $fn : '.*:\(.*\)'`
3719	fn=`expr $fn : '\(.*\):.*'`
3720	;;
3721esac
3722
3723case "$fn" in
3724*~*) tilde=true;;
3725esac
3726case "$fn" in
3727*/*) fullpath=true;;
3728esac
3729case "$fn" in
3730*+*) skip=true;;
3731esac
3732case "$fn" in
3733*n*) none_ok=true;;
3734esac
3735case "$fn" in
3736*e*) exp_file=true;;
3737esac
3738case "$fn" in
3739*p*) nopath_ok=true;;
3740esac
3741
3742case "$fn" in
3743*f*) type='File';;
3744*d*) type='Directory';;
3745*l*) type='Locate';;
3746esac
3747
3748what="$type"
3749case "$what" in
3750Locate) what='File';;
3751esac
3752
3753case "$exp_file" in
3754'')
3755	case "$d_portable" in
3756	"$define") ;;
3757	*) exp_file=true;;
3758	esac
3759	;;
3760esac
3761
3762cd ..
3763while test "$type"; do
3764	redo=''
3765	rp="$orig_rp"
3766	dflt="$orig_dflt"
3767	case "$tilde" in
3768	true) rp="$rp (~name ok)";;
3769	esac
3770	. UU/myread
3771	if test -f UU/getfile.ok && \
3772		$contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3773	then
3774		value="$ans"
3775		ansexp="$ans"
3776		break
3777	fi
3778	case "$ans" in
3779	none)
3780		value=''
3781		ansexp=''
3782		case "$none_ok" in
3783		true) type='';;
3784		esac
3785		;;
3786	*)
3787		case "$tilde" in
3788		'') value="$ans"
3789			ansexp="$ans";;
3790		*)
3791			value=`UU/filexp $ans`
3792			case $? in
3793			0)
3794				if test "$ans" != "$value"; then
3795					echo "(That expands to $value on this system.)"
3796				fi
3797				;;
3798			*) value="$ans";;
3799			esac
3800			ansexp="$value"
3801			case "$exp_file" in
3802			'') value="$ans";;
3803			esac
3804			;;
3805		esac
3806		case "$fullpath" in
3807		true)
3808			case "$ansexp" in
3809			/*) value="$ansexp" ;;
3810			[a-zA-Z]:/*) value="$ansexp" ;;
3811			*)
3812				redo=true
3813				case "$already" in
3814				true)
3815				echo "I shall only accept a full path name, as in /bin/ls." >&4
3816				echo "Use a ! shell escape if you wish to check pathnames." >&4
3817					;;
3818				*)
3819				echo "Please give a full path name, starting with slash." >&4
3820					case "$tilde" in
3821					true)
3822				echo "Note that using ~name is ok provided it expands well." >&4
3823						already=true
3824						;;
3825					esac
3826				esac
3827				;;
3828			esac
3829			;;
3830		esac
3831		case "$redo" in
3832		'')
3833			case "$type" in
3834			File)
3835				for fp in $gfpth; do
3836					if test "X$fp" = X.; then
3837					    pf="$ansexp"
3838					else
3839					    pf="$fp/$ansexp"
3840					fi
3841					if test -f "$pf"; then
3842						type=''
3843					elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3844					then
3845						echo "($value is not a plain file, but that's ok.)"
3846						type=''
3847					fi
3848					if test X"$type" = X; then
3849					    value="$pf"
3850					    break
3851					fi
3852				done
3853				;;
3854			Directory)
3855				for fp in $gfpth; do
3856					if test "X$fp" = X.; then
3857					    dir="$ans"
3858					    direxp="$ansexp"
3859					else
3860					    dir="$fp/$ansexp"
3861					    direxp="$fp/$ansexp"
3862					fi
3863					if test -d "$direxp"; then
3864						type=''
3865						value="$dir"
3866						break
3867					fi
3868				done
3869				;;
3870			Locate)
3871				if test -d "$ansexp"; then
3872					echo "(Looking for $loc_file in directory $value.)"
3873					value="$value/$loc_file"
3874					ansexp="$ansexp/$loc_file"
3875				fi
3876				if test -f "$ansexp"; then
3877					type=''
3878				fi
3879				case "$nopath_ok" in
3880				true)	case "$value" in
3881					*/*) ;;
3882					*)	echo "Assuming $value will be in people's path."
3883						type=''
3884						;;
3885					esac
3886					;;
3887				esac
3888				;;
3889			esac
3890
3891			case "$skip" in
3892			true) type='';
3893			esac
3894
3895			case "$type" in
3896			'') ;;
3897			*)
3898				if test "$fastread" = yes; then
3899					dflt=y
3900				else
3901					dflt=n
3902				fi
3903				rp="$what $value doesn't exist.  Use that name anyway?"
3904				. UU/myread
3905				dflt=''
3906				case "$ans" in
3907				y*) type='';;
3908				*) echo " ";;
3909				esac
3910				;;
3911			esac
3912			;;
3913		esac
3914		;;
3915	esac
3916done
3917cd UU
3918ans="$value"
3919rp="$orig_rp"
3920dflt="$orig_dflt"
3921rm -f getfile.ok
3922test "X$gfpthkeep" != Xy && gfpth=""
3923EOSC
3924
3925: determine root of directory hierarchy where package will be installed.
3926case "$prefix" in
3927'')
3928	dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3929	;;
3930*?/)
3931	dflt=`echo "$prefix" | sed 's/.$//'`
3932	;;
3933*)
3934	dflt="$prefix"
3935	;;
3936esac
3937$cat <<EOM
3938
3939By default, $package will be installed in $dflt/bin, manual pages
3940under $dflt/man, etc..., i.e. with $dflt as prefix for all
3941installation directories. Typically this is something like /usr/local.
3942If you wish to have binaries under /usr/bin but other parts of the
3943installation under /usr/local, that's ok: you will be prompted
3944separately for each of the installation directories, the prefix being
3945only used to set the defaults.
3946
3947EOM
3948fn=d~
3949rp='Installation prefix to use?'
3950. ./getfile
3951oldprefix=''
3952case "$prefix" in
3953'') ;;
3954*)
3955	case "$ans" in
3956	"$prefix") ;;
3957	*) oldprefix="$prefix";;
3958	esac
3959	;;
3960esac
3961prefix="$ans"
3962prefixexp="$ansexp"
3963
3964: allow them to override the AFS root
3965case "$afsroot" in
3966'')	afsroot=/afs ;;
3967*)	afsroot=$afsroot ;;
3968esac
3969
3970: is AFS running?
3971echo " "
3972case "$afs" in
3973$define|true)	afs=true ;;
3974$undef|false)	afs=false ;;
3975*)	if $test -d $afsroot; then
3976		afs=true
3977	else
3978		afs=false
3979	fi
3980	;;
3981esac
3982if $afs; then
3983	echo "AFS may be running... I'll be extra cautious then..." >&4
3984else
3985	echo "AFS does not seem to be running..." >&4
3986fi
3987
3988: determine installation prefix for where package is to be installed.
3989if $afs; then
3990$cat <<EOM
3991
3992Since you are running AFS, I need to distinguish the directory in which
3993files will reside from the directory in which they are installed (and from
3994which they are presumably copied to the former directory by occult means).
3995
3996EOM
3997	case "$installprefix" in
3998	'') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3999	*) dflt="$installprefix";;
4000	esac
4001else
4002$cat <<EOM
4003
4004In some special cases, particularly when building $package for distribution,
4005it is convenient to distinguish the directory in which files should be
4006installed from the directory ($prefix) in which they will
4007eventually reside.  For most users, these two directories are the same.
4008
4009EOM
4010	case "$installprefix" in
4011	'') dflt=$prefix ;;
4012	*) dflt=$installprefix;;
4013	esac
4014fi
4015fn=d~
4016rp='What installation prefix should I use for installing files?'
4017. ./getfile
4018installprefix="$ans"
4019installprefixexp="$ansexp"
4020
4021: Perform the prefixexp/installprefixexp correction if necessary
4022cat <<EOS >installprefix
4023$startsh
4024EOS
4025cat <<'EOSC' >>installprefix
4026: Change installation prefix, if necessary.
4027if $test X"$prefix" != X"$installprefix"; then
4028    eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4029else
4030    eval "install${prefixvar}=\"\$${prefixvar}exp\""
4031fi
4032EOSC
4033chmod +x installprefix
4034$eunicefix installprefix
4035
4036: Set variables such as privlib and privlibexp from the output of ./getfile
4037: performing the prefixexp/installprefixexp correction if necessary.
4038cat <<EOS >setprefixvar
4039$startsh
4040EOS
4041cat <<'EOSC' >>setprefixvar
4042eval "${prefixvar}=\"\$ans\""
4043eval "${prefixvar}exp=\"\$ansexp\""
4044. ./installprefix
4045EOSC
4046chmod +x setprefixvar
4047$eunicefix setprefixvar
4048
4049: set up the script used to warn in case of inconsistency
4050cat <<EOS >whoa
4051$startsh
4052EOS
4053cat <<'EOSC' >>whoa
4054dflt=y
4055case "$hint" in
4056    recommended)
4057	case "$hintfile" in
4058	'')	echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4059		;;
4060	*)	echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4061		echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4062		;;
4063	esac
4064	;;
4065    *)	echo " "
4066	echo "*** WHOA THERE!!! ***" >&4
4067	echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4068	;;
4069esac
4070rp="    Keep the $hint value?"
4071. ./myread
4072case "$ans" in
4073y) td=$was; tu=$was;;
4074esac
4075EOSC
4076
4077: function used to set '$1' to '$val'
4078setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4079case "$val$was" in
4080$define$undef) . ./whoa; eval "$var=\$td";;
4081$undef$define) . ./whoa; eval "$var=\$tu";;
4082*) eval "$var=$val";;
4083esac'
4084
4085: get the patchlevel
4086echo " "
4087echo "Getting the current patchlevel..." >&4
4088if $test -r $rsrc/patchlevel.h;then
4089	revision=`awk '/define[ 	]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4090	patchlevel=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4091	subversion=`awk '/define[ 	]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4092	api_revision=`awk '/define[ 	]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4093	api_version=`awk '/define[ 	]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4094	api_subversion=`awk '/define[ 	]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4095	perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4096else
4097	revision=0
4098	patchlevel=0
4099	subversion=0
4100	api_revision=0
4101	api_version=0
4102	api_subversion=0
4103	perl_patchlevel=0
4104	$echo "(You do not have patchlevel.h.  Eek.)"
4105fi
4106: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4107version_patchlevel_string="version $patchlevel subversion $subversion"
4108case "$perl_patchlevel" in
41090|'') ;;
4110*)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4111    version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4112    ;;
4113esac
4114
4115$echo "(You have $package $version_patchlevel_string.)"
4116
4117case "$osname" in
4118dos|vms)
4119	: XXX Should be a Configure test for double-dots in filenames.
4120	version=`echo $revision $patchlevel $subversion | \
4121		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4122	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4123		 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4124	;;
4125*)
4126	version=`echo $revision $patchlevel $subversion | \
4127		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4128	api_versionstring=`echo $api_revision $api_version $api_subversion | \
4129		 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4130	;;
4131esac
4132: Special case the 5.005_xx maintenance series, which used 5.005
4133: without any subversion label as a subdirectory in $sitelib
4134if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4135	api_versionstring='5.005'
4136fi
4137
4138: Do we want threads support and if so, what type
4139case "$usethreads" in
4140$define|true|[yY]*)     dflt='y';;
4141*)     # Catch case where user specified ithreads or 5005threads but
4142       # forgot -Dusethreads (A.D. 4/2002)
4143       case "$useithreads$use5005threads" in
4144       *$define*)	dflt='y';;
4145       *)		dflt='n';;
4146       esac
4147       ;;
4148esac
4149cat <<EOM
4150
4151Perl can be built to take advantage of threads on some systems.
4152To do so, Configure can be run with -Dusethreads.
4153
4154Note that Perl built with threading support runs slightly slower
4155and uses more memory than plain Perl. The current implementation
4156is believed to be stable, but it is fairly new, and so should be
4157treated with caution.
4158
4159If this doesn't make any sense to you, just accept the default '$dflt'.
4160EOM
4161rp='Build a threading Perl?'
4162. ./myread
4163case "$ans" in
4164y|Y)    val="$define" ;;
4165*)      val="$undef" ;;
4166esac
4167set usethreads
4168eval $setvar
4169
4170if $test $patchlevel -lt 9; then
4171    case "$usethreads" in
4172    $define)
4173	$cat <<EOM
4174
4175Since release 5.6, Perl has had two different threading implementations,
4176the newer interpreter-based version (ithreads) with one interpreter per
4177thread, and the older 5.005 version (5005threads).
4178The 5005threads version is effectively unmaintained and will probably be
4179removed in Perl 5.10, so there should be no need to build a Perl using it
4180unless needed for backwards compatibility with some existing 5.005threads
4181code.
4182
4183EOM
4184	: Default to ithreads unless overridden on command line or with
4185	: old config.sh
4186	dflt='y'
4187	case "$use5005threads" in
4188		$define|true|[yY]*) dflt='n';;
4189	esac
4190	case "$useithreads" in
4191		$undef|false|[nN]*) dflt='n';;
4192	esac
4193	rp='Use the newer interpreter-based ithreads?'
4194	. ./myread
4195	case "$ans" in
4196	y|Y)    val="$define" ;;
4197	*)      val="$undef" ;;
4198	esac
4199	set useithreads
4200	eval $setvar
4201	: Now set use5005threads to the opposite value.
4202	case "$useithreads" in
4203	$define) val="$undef" ;;
4204	*) val="$define" ;;
4205	esac
4206	set use5005threads
4207	eval $setvar
4208	;;
4209    *)
4210	useithreads="$undef"
4211	use5005threads="$undef"
4212	;;
4213    esac
4214
4215    case "$useithreads$use5005threads" in
4216    "$define$define")
4217	$cat >&4 <<EOM
4218
4219You cannot have both the ithreads and the 5.005 threads enabled
4220at the same time.  Disabling the 5.005 threads since they are
4221much less stable than the ithreads.
4222
4223EOM
4224	use5005threads="$undef"
4225	;;
4226    esac
4227
4228else
4229: perl-5.9.x and later
4230
4231    if test X"$usethreads" = "X$define"; then
4232	case "$use5005threads" in
4233	    $define|true|[yY]*)
4234		$cat >&4 <<EOM
4235
42365.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4237
4238EOM
4239	    ;;
4240	esac
4241    fi
4242
4243    use5005threads="$undef"
4244    useithreads="$usethreads"
4245fi
4246
4247case "$d_oldpthreads" in
4248'')	: Configure tests would be welcome here.  For now, assume undef.
4249	val="$undef" ;;
4250*)	val="$d_oldpthreads" ;;
4251esac
4252set d_oldpthreads
4253eval $setvar
4254
4255
4256: Look for a hint-file generated 'call-back-unit'.  If the
4257: user has specified that a threading perl is to be built,
4258: we may need to set or change some other defaults.
4259if $test -f usethreads.cbu; then
4260    echo "Your platform has some specific hints regarding threaded builds, using them..."
4261    . ./usethreads.cbu
4262else
4263    case "$usethreads" in
4264	"$define"|true|[yY]*)
4265		$cat <<EOM
4266(Your platform does not have any specific hints for threaded builds.
4267 Assuming POSIX threads, then.)
4268EOM
4269	;;
4270    esac
4271fi
4272
4273: Check if multiplicity is required
4274cat <<EOM
4275
4276Perl can be built so that multiple Perl interpreters can coexist
4277within the same Perl executable.
4278EOM
4279
4280case "$useithreads" in
4281$define)
4282	cat <<EOM
4283This multiple interpreter support is required for interpreter-based threads.
4284EOM
4285	val="$define"
4286	;;
4287*)	case "$usemultiplicity" in
4288	$define|true|[yY]*)	dflt='y';;
4289	*) dflt='n';;
4290	esac
4291	echo " "
4292	echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4293	rp='Build Perl for multiplicity?'
4294	. ./myread
4295	case "$ans" in
4296	y|Y)	val="$define" ;;
4297	*)      val="$undef" ;;
4298	esac
4299	;;
4300esac
4301set usemultiplicity
4302eval $setvar
4303
4304: Check if morebits is requested
4305case "$usemorebits" in
4306"$define"|true|[yY]*)
4307	use64bitint="$define"
4308	uselongdouble="$define"
4309	usemorebits="$define"
4310	;;
4311*)	usemorebits="$undef"
4312	;;
4313esac
4314
4315: Determine the C compiler to be used
4316echo " "
4317case "$cc" in
4318'') dflt=cc;;
4319*) dflt="$cc";;
4320esac
4321rp="Use which C compiler?"
4322. ./myread
4323cc="$ans"
4324
4325: See whether they have no cc but they do have gcc
4326. ./trygcc
4327if $test -f cc.cbu; then
4328    . ./cc.cbu
4329fi
4330. ./checkcc
4331
4332: make some quick guesses about what we are up against
4333echo " "
4334$echo $n "Hmm...  $c"
4335echo exit 1 >bsd
4336echo exit 1 >usg
4337echo exit 1 >v7
4338echo exit 1 >osf1
4339echo exit 1 >eunice
4340echo exit 1 >xenix
4341echo exit 1 >venix
4342echo exit 1 >os2
4343d_bsd="$undef"
4344$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4345if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4346then
4347	echo "Looks kind of like an OSF/1 system, but we'll see..."
4348	echo exit 0 >osf1
4349elif test `echo abc | $tr a-z A-Z` = Abc ; then
4350	xxx=`./loc addbib blurfl $pth`
4351	if $test -f $xxx; then
4352	echo "Looks kind of like a USG system with BSD features, but we'll see..."
4353		echo exit 0 >bsd
4354		echo exit 0 >usg
4355	else
4356		if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4357			echo "Looks kind of like an extended USG system, but we'll see..."
4358		else
4359			echo "Looks kind of like a USG system, but we'll see..."
4360		fi
4361		echo exit 0 >usg
4362	fi
4363elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364	echo "Looks kind of like a BSD system, but we'll see..."
4365	d_bsd="$define"
4366	echo exit 0 >bsd
4367else
4368	echo "Looks kind of like a Version 7 system, but we'll see..."
4369	echo exit 0 >v7
4370fi
4371case "$eunicefix" in
4372*unixtovms*)
4373	$cat <<'EOI'
4374There is, however, a strange, musty smell in the air that reminds me of
4375something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4376EOI
4377	echo exit 0 >eunice
4378	d_eunice="$define"
4379: it so happens the Eunice I know will not run shell scripts in Unix format
4380	;;
4381*)
4382	echo " "
4383	echo "Congratulations.  You aren't running Eunice."
4384	d_eunice="$undef"
4385	;;
4386esac
4387: Detect OS2.  The p_ variable is set above in the Head.U unit.
4388: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4389: semicolon as a patch separator
4390case "$p_" in
4391:) ;;
4392*)
4393	$cat <<'EOI'
4394I have the feeling something is not exactly right, however...don't tell me...
4395lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4396(Or you may be running DOS with DJGPP.)
4397EOI
4398	echo exit 0 >os2
4399	;;
4400esac
4401if test -f /xenix; then
4402	echo "Actually, this looks more like a XENIX system..."
4403	echo exit 0 >xenix
4404	d_xenix="$define"
4405else
4406	echo " "
4407	echo "It's not Xenix..."
4408	d_xenix="$undef"
4409fi
4410chmod +x xenix
4411$eunicefix xenix
4412if test -f /venix; then
4413	echo "Actually, this looks more like a VENIX system..."
4414	echo exit 0 >venix
4415else
4416	echo " "
4417	if ./xenix; then
4418		: null
4419	else
4420		echo "Nor is it Venix..."
4421	fi
4422fi
4423chmod +x bsd usg v7 osf1 eunice xenix venix os2
4424$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4425$rm -f foo
4426
4427: Check if we are using GNU gcc and what its version is
4428echo " "
4429echo "Checking for GNU cc in disguise and/or its version number..." >&4
4430$cat >try.c <<EOM
4431#include <stdio.h>
4432int main() {
4433#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4434#ifdef __VERSION__
4435	printf("%s\n", __VERSION__);
4436#else
4437	printf("%s\n", "1");
4438#endif
4439#endif
4440	return(0);
4441}
4442EOM
4443if $cc -o try $ccflags $ldflags try.c; then
4444	gccversion=`$run ./try`
4445	case "$gccversion" in
4446	'') echo "You are not using GNU cc." ;;
4447	*)  echo "You are using GNU cc $gccversion."
4448	    ccname=gcc
4449	    ;;
4450	esac
4451else
4452	echo " "
4453	echo "*** WHOA THERE!!! ***" >&4
4454	echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4455	case "$knowitall" in
4456	'')
4457	echo "    You'd better start hunting for one and let me know about it." >&4
4458		exit 1
4459		;;
4460	esac
4461fi
4462$rm -f try try.*
4463case "$gccversion" in
44641*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4465esac
4466case "$gccversion" in
4467'') gccosandvers='' ;;
4468*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4469   gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4470   gccshortvers=''
4471   case "$gccosandvers" in
4472   $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4473   $osname$osvers) ;; # looking good
4474   $osname*) cat <<EOM >&4
4475
4476*** WHOA THERE!!! ***
4477
4478    Your gcc has not been compiled for the exact release of
4479    your operating system ($gccosandvers versus $osname$osvers).
4480
4481    In general it is a good idea to keep gcc synchronized with
4482    the operating system because otherwise serious problems
4483    may ensue when trying to compile software, like Perl.
4484
4485    I'm trying to be optimistic here, though, and will continue.
4486    If later during the configuration and build icky compilation
4487    problems appear (headerfile conflicts being the most common
4488    manifestation), I suggest reinstalling the gcc to match
4489    your operating system release.
4490
4491EOM
4492      ;;
4493   *) gccosandvers='' ;; # failed to parse, better be silent
4494   esac
4495   ;;
4496esac
4497case "$ccname" in
4498'') ccname="$cc" ;;
4499esac
4500
4501# gcc 3.* complain about adding -Idirectories that they already know about,
4502# so we will take those off from locincpth.
4503case "$gccversion" in
45043*)
4505    echo "main(){}">try.c
4506    for incdir in $locincpth; do
4507       warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4508	     grep '^c[cp]p*[01]: warning: changing search order '`
4509       if test "X$warn" != X; then
4510	   locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4511       fi
4512    done
4513    $rm -f try try.*
4514esac
4515
4516: What should the include directory be ?
4517echo " "
4518$echo $n "Hmm...  $c"
4519dflt='/usr/include'
4520incpath=''
4521mips_type=''
4522if $test -f /bin/mips && /bin/mips; then
4523	echo "Looks like a MIPS system..."
4524	$cat >usr.c <<'EOCP'
4525#ifdef SYSTYPE_BSD43
4526/bsd43
4527#endif
4528EOCP
4529	if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4530		dflt='/bsd43/usr/include'
4531		incpath='/bsd43'
4532		mips_type='BSD 4.3'
4533	else
4534		mips_type='System V'
4535	fi
4536	$rm -f usr.c usr.out
4537	echo "and you're compiling with the $mips_type compiler and libraries."
4538	xxx_prompt=y
4539	echo "exit 0" >mips
4540else
4541	echo "Doesn't look like a MIPS system."
4542	xxx_prompt=n
4543	echo "exit 1" >mips
4544fi
4545chmod +x mips
4546$eunicefix mips
4547case "$usrinc" in
4548'') ;;
4549*) dflt="$usrinc";;
4550esac
4551case "$xxx_prompt" in
4552y)	fn=d/
4553	echo " "
4554	rp='Where are the include files you want to use?'
4555	. ./getfile
4556	usrinc="$ans"
4557	;;
4558*)	usrinc="$dflt"
4559	;;
4560esac
4561
4562: see how we invoke the C preprocessor
4563echo " "
4564echo "Now, how can we feed standard input to your C preprocessor..." >&4
4565cat <<'EOT' >testcpp.c
4566#define ABC abc
4567#define XYZ xyz
4568ABC.XYZ
4569EOT
4570cd ..
4571if test ! -f cppstdin; then
4572	if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4573		# AIX cc -E doesn't show the absolute headerfile
4574		# locations but we'll cheat by using the -M flag.
4575		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
4576	else
4577		echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4578	fi
4579else
4580	echo "Keeping your $hint cppstdin wrapper."
4581fi
4582chmod 755 cppstdin
4583wrapper=`pwd`/cppstdin
4584ok='false'
4585cd UU
4586
4587if $test "X$cppstdin" != "X" && \
4588	$cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4589	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4590then
4591	echo "You used to use $cppstdin $cppminus so we'll use that again."
4592	case "$cpprun" in
4593	'') echo "But let's see if we can live without a wrapper..." ;;
4594	*)
4595		if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4596			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597		then
4598			echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4599			ok='true'
4600		else
4601			echo "(However, $cpprun $cpplast does not work, let's see...)"
4602		fi
4603		;;
4604	esac
4605else
4606	case "$cppstdin" in
4607	'') ;;
4608	*)
4609		echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4610		;;
4611	esac
4612fi
4613
4614if $ok; then
4615	: nothing
4616elif echo 'Maybe "'"$cc"' -E" will work...'; \
4617	$cc -E <testcpp.c >testcpp.out 2>&1; \
4618	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619	echo "Yup, it does."
4620	x_cpp="$cc -E"
4621	x_minus='';
4622elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4623	$cc -E - <testcpp.c >testcpp.out 2>&1; \
4624	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625	echo "Yup, it does."
4626	x_cpp="$cc -E"
4627	x_minus='-';
4628elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4629	$cc -P <testcpp.c >testcpp.out 2>&1; \
4630	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631	echo "Yipee, that works!"
4632	x_cpp="$cc -P"
4633	x_minus='';
4634elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4635	$cc -P - <testcpp.c >testcpp.out 2>&1; \
4636	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637	echo "At long last!"
4638	x_cpp="$cc -P"
4639	x_minus='-';
4640elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4641	$cpp <testcpp.c >testcpp.out 2>&1; \
4642	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643	echo "It works!"
4644	x_cpp="$cpp"
4645	x_minus='';
4646elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4647	$cpp - <testcpp.c >testcpp.out 2>&1; \
4648	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649	echo "Hooray, it works!  I was beginning to wonder."
4650	x_cpp="$cpp"
4651	x_minus='-';
4652elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4653	$wrapper <testcpp.c >testcpp.out 2>&1; \
4654	$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655	x_cpp="$wrapper"
4656	x_minus=''
4657	echo "Eureka!"
4658else
4659	dflt=''
4660	rp="No dice.  I can't find a C preprocessor.  Name one:"
4661	. ./myread
4662	x_cpp="$ans"
4663	x_minus=''
4664	$x_cpp <testcpp.c >testcpp.out 2>&1
4665	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666		echo "OK, that will do." >&4
4667	else
4668echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4669		exit 1
4670	fi
4671fi
4672
4673case "$ok" in
4674false)
4675	cppstdin="$x_cpp"
4676	cppminus="$x_minus"
4677	cpprun="$x_cpp"
4678	cpplast="$x_minus"
4679	set X $x_cpp
4680	shift
4681	case "$1" in
4682	"$cpp")
4683		echo "Perhaps can we force $cc -E using a wrapper..."
4684		if $wrapper <testcpp.c >testcpp.out 2>&1; \
4685			$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4686		then
4687			echo "Yup, we can."
4688			cppstdin="$wrapper"
4689			cppminus='';
4690		else
4691			echo "Nope, we'll have to live without it..."
4692		fi
4693		;;
4694	esac
4695	case "$cpprun" in
4696	"$wrapper")
4697		cpprun=''
4698		cpplast=''
4699		;;
4700	esac
4701	;;
4702esac
4703
4704case "$cppstdin" in
4705"$wrapper"|'cppstdin') ;;
4706*) $rm -f $wrapper;;
4707esac
4708$rm -f testcpp.c testcpp.out
4709
4710: Set private lib path
4711case "$plibpth" in
4712'') if ./mips; then
4713		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4714	fi;;
4715esac
4716case "$libpth" in
4717' ') dlist='';;
4718'') dlist="$loclibpth $plibpth $glibpth";;
4719*) dlist="$libpth";;
4720esac
4721
4722: Now check and see which directories actually exist, avoiding duplicates
4723libpth=''
4724for xxx in $dlist
4725do
4726    if $test -d $xxx; then
4727		case " $libpth " in
4728		*" $xxx "*) ;;
4729		*) libpth="$libpth $xxx";;
4730		esac
4731    fi
4732done
4733$cat <<'EOM'
4734
4735Some systems have incompatible or broken versions of libraries.  Among
4736the directories listed in the question below, please remove any you
4737know not to be holding relevant libraries, and add any that are needed.
4738Say "none" for none.
4739
4740EOM
4741case "$libpth" in
4742'') dflt='none';;
4743*)
4744	set X $libpth
4745	shift
4746	dflt=${1+"$@"}
4747	;;
4748esac
4749rp="Directories to use for library searches?"
4750. ./myread
4751case "$ans" in
4752none) libpth=' ';;
4753*) libpth="$ans";;
4754esac
4755
4756: compute shared library extension
4757case "$so" in
4758'')
4759	if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4760		dflt='sl'
4761	else
4762		dflt='so'
4763	fi
4764	;;
4765*) dflt="$so";;
4766esac
4767$cat <<EOM
4768
4769On some systems, shared libraries may be available.  Answer 'none' if
4770you want to suppress searching of shared libraries for the remainder
4771of this configuration.
4772
4773EOM
4774rp='What is the file extension used for shared libraries?'
4775. ./myread
4776so="$ans"
4777
4778: Define several unixisms.
4779: Hints files or command line option can be used to override them.
4780: The convoluted testing is in case hints files set either the old
4781: or the new name.
4782case "$_exe" in
4783'')	case "$exe_ext" in
4784	'')	;;
4785	*)	_exe="$exe_ext" ;;
4786	esac
4787	;;
4788esac
4789case "$_a" in
4790'')	case "$lib_ext" in
4791    '')	_a='.a';;
4792	*)	_a="$lib_ext" ;;
4793	esac
4794	;;
4795esac
4796case "$_o" in
4797'') case "$obj_ext" in
4798	'')	_o='.o';;
4799	*)	_o="$obj_ext";;
4800	esac
4801	;;
4802esac
4803case "$p_" in
4804'') case "$path_sep" in
4805	'')	p_=':';;
4806	*)	p_="$path_sep";;
4807	esac
4808	;;
4809esac
4810exe_ext=$_exe
4811lib_ext=$_a
4812obj_ext=$_o
4813path_sep=$p_
4814
4815rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4816
4817: Which makefile gets called first.  This is used by make depend.
4818case "$firstmakefile" in
4819'') firstmakefile='makefile';;
4820esac
4821
4822: Check is we will use socks
4823case "$usesocks" in
4824$define|true|[yY]*)	dflt='y';;
4825*) dflt='n';;
4826esac
4827cat <<EOM
4828
4829Perl can be built to use the SOCKS proxy protocol library.  To do so,
4830Configure must be run with -Dusesocks.  If you use SOCKS you also need
4831to use the PerlIO abstraction layer, this will be implicitly selected.
4832
4833If this doesn't make any sense to you, just accept the default '$dflt'.
4834EOM
4835rp='Build Perl for SOCKS?'
4836. ./myread
4837case "$ans" in
4838y|Y)	val="$define" ;;
4839*)      val="$undef" ;;
4840esac
4841set usesocks
4842eval $setvar
4843
4844: Check for uselongdouble support
4845case "$ccflags" in
4846*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4847esac
4848
4849case "$uselongdouble" in
4850$define|true|[yY]*)	dflt='y';;
4851*) dflt='n';;
4852esac
4853cat <<EOM
4854
4855Perl can be built to take advantage of long doubles which
4856(if available) may give more accuracy and range for floating point numbers.
4857
4858If this doesn't make any sense to you, just accept the default '$dflt'.
4859EOM
4860rp='Try to use long doubles if available?'
4861. ./myread
4862case "$ans" in
4863y|Y) 	val="$define"	;;
4864*)      val="$undef"	;;
4865esac
4866set uselongdouble
4867eval $setvar
4868
4869case "$uselongdouble" in
4870true|[yY]*) uselongdouble="$define" ;;
4871esac
4872
4873: Look for a hint-file generated 'call-back-unit'.  If the
4874: user has specified that long doubles should be used,
4875: we may need to set or change some other defaults.
4876if $test -f uselongdouble.cbu; then
4877    echo "Your platform has some specific hints regarding long doubles, using them..."
4878    . ./uselongdouble.cbu
4879else
4880    case "$uselongdouble" in
4881	$define)
4882		$cat <<EOM
4883(Your platform does not have any specific hints for long doubles.)
4884EOM
4885	;;
4886    esac
4887fi
4888
4889: Looking for optional libraries
4890echo " "
4891echo "Checking for optional libraries..." >&4
4892case "$libs" in
4893' '|'') dflt='';;
4894*) dflt="$libs";;
4895esac
4896case "$libswanted" in
4897'') libswanted='c_s';;
4898esac
4899case "$usesocks" in
4900"$define") libswanted="$libswanted socks5 socks5_sh" ;;
4901esac
4902libsfound=''
4903libsfiles=''
4904libsdirs=''
4905libspath=''
4906for thisdir in $libpth $xlibpth; do
4907  test -d $thisdir && libspath="$libspath $thisdir"
4908done
4909for thislib in $libswanted; do
4910	for thisdir in $libspath; do
4911	    xxx=''
4912	    if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4913		xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4914	        $test -f "$xxx" && eval $libscheck
4915		$test -f "$xxx" && libstyle=shared
4916	    fi
4917	    if test ! -f "$xxx"; then
4918		xxx=$thisdir/lib$thislib.$so
4919	        $test -f "$xxx" && eval $libscheck
4920		$test -f "$xxx" && libstyle=shared
4921	    fi
4922	    if test ! -f "$xxx"; then
4923		xxx=$thisdir/lib$thislib$_a
4924	        $test -f "$xxx" && eval $libscheck
4925		$test -f "$xxx" && libstyle=static
4926	    fi
4927	    if test ! -f "$xxx"; then
4928		xxx=$thisdir/$thislib$_a
4929	        $test -f "$xxx" && eval $libscheck
4930		$test -f "$xxx" && libstyle=static
4931	    fi
4932	    if test ! -f "$xxx"; then
4933		xxx=$thisdir/lib${thislib}_s$_a
4934	        $test -f "$xxx" && eval $libscheck
4935		$test -f "$xxx" && libstyle=static
4936		$test -f "$xxx" && thislib=${thislib}_s
4937	    fi
4938	    if test ! -f "$xxx"; then
4939		xxx=$thisdir/Slib$thislib$_a
4940	        $test -f "$xxx" && eval $libscheck
4941		$test -f "$xxx" && libstyle=static
4942	    fi
4943	    if $test -f "$xxx"; then
4944		case "$libstyle" in
4945		shared) echo "Found -l$thislib (shared)." ;;
4946		static) echo "Found -l$thislib." ;;
4947		*)      echo "Found -l$thislib ($libstyle)." ;;
4948		esac
4949		case " $dflt " in
4950		*"-l$thislib "*);;
4951		*) dflt="$dflt -l$thislib"
4952                   libsfound="$libsfound $xxx"
4953                   yyy=`basename $xxx`
4954                   libsfiles="$libsfiles $yyy"
4955                   yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4956                   case " $libsdirs " in
4957                   *" $yyy "*) ;;
4958                   *) libsdirs="$libsdirs $yyy" ;;
4959                   esac
4960		   ;;
4961		esac
4962		break
4963	    fi
4964	done
4965	if $test ! -f "$xxx"; then
4966	    echo "No -l$thislib."
4967	fi
4968done
4969set X $dflt
4970shift
4971dflt="$*"
4972case "$libs" in
4973'') dflt="$dflt";;
4974*) dflt="$libs";;
4975esac
4976case "$dflt" in
4977' '|'') dflt='none';;
4978esac
4979
4980$cat <<EOM
4981
4982In order to compile $package on your machine, a number of libraries
4983are usually needed.  Include any other special libraries here as well.
4984Say "none" for none.  The default list is almost always right.
4985EOM
4986
4987echo " "
4988rp="What libraries to use?"
4989. ./myread
4990case "$ans" in
4991none) libs=' ';;
4992*) libs="$ans";;
4993esac
4994
4995: determine optimization, if desired, or use for debug flag also
4996case "$optimize" in
4997' '|$undef) dflt='none';;
4998'') dflt='-O';;
4999*) dflt="$optimize";;
5000esac
5001$cat <<EOH
5002
5003By default, $package compiles with the -O flag to use the optimizer.
5004Alternately, you might want to use the symbolic debugger, which uses
5005the -g flag (on traditional Unix systems).  Either flag can be
5006specified here.  To use neither flag, specify the word "none".
5007
5008EOH
5009rp="What optimizer/debugger flag should be used?"
5010. ./myread
5011optimize="$ans"
5012case "$optimize" in
5013'none') optimize=" ";;
5014esac
5015
5016: Check what DEBUGGING is required from the command line
5017: -DEBUGGING      or -DDEBUGGING or
5018: -DEBUGGING=both			= -g + -DDEBUGGING
5019: -DEBUGGING=-g   or -Doptimize=-g	= -g
5020: -DEBUGGING=none or -UDEBUGGING	=
5021: -DEBUGGING=old  or -DEBUGGING=default	= ? $optimize
5022case "$EBUGGING" in
5023'')	;;
5024*)	DEBUGGING=$EBUGGING ;;
5025esac
5026
5027case "$DEBUGGING" in
5028-g|both|$define)
5029    case "$optimize" in
5030	*-g*) ;;
5031	*)    optimize="$optimize -g" ;;
5032    esac ;;
5033none|$undef)
5034    case "$optimize" in
5035	*-g*)	set `echo "X $optimize " | sed 's/ -g / /'`
5036		shift
5037		optimize="$*"
5038		;;
5039    esac ;;
5040esac
5041
5042dflt=''
5043case "$DEBUGGING" in
5044both|$define) dflt='-DDEBUGGING'
5045esac
5046
5047: argument order is deliberate, as the flag will start with - which set could
5048: think is an option
5049checkccflag='check=$1; flag=$2; callback=$3;
5050echo " ";
5051echo "Checking if your compiler accepts $flag" 2>&1;
5052echo "int main(void) { return 0; }" > gcctest.c;
5053if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5054    echo "Yes, it does." 2>&1;
5055    if $test -s gcctest.out ; then
5056        echo "But your platform does not like it:";
5057        cat gcctest.out;
5058    else
5059	case "$ccflags" in
5060	*$check*)
5061	    echo "Leaving current flags $ccflags alone." 2>&1
5062	    ;;
5063	*) dflt="$dflt $flag";
5064	    eval $callback
5065	    ;;
5066	esac
5067    fi
5068else
5069    echo "Nope, it does not, but that is ok." 2>&1;
5070fi
5071'
5072
5073: We will not override a previous value, but we might want to
5074: augment a hint file
5075case "$hint" in
5076default|recommended)
5077	case "$gccversion" in
5078	1*) dflt="$dflt -fpcc-struct-return" ;;
5079	esac
5080	case "$optimize:$DEBUGGING" in
5081	*-g*:old) dflt="$dflt -DDEBUGGING";;
5082	esac
5083	case "$gccversion" in
5084	2*) if $test -d /etc/conf/kconfig.d &&
5085			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5086		then
5087			# Interactive Systems (ISC) POSIX mode.
5088			dflt="$dflt -posix"
5089		fi
5090		;;
5091	esac
5092	case "$gccversion" in
5093	1*) ;;
5094	2.[0-8]*) ;;
5095	?*)	set strict-aliasing -fno-strict-aliasing
5096		eval $checkccflag
5097		;;
5098	esac
5099	case "$gccversion" in
5100	1*) ;;
5101	2*) ;;
5102	?*) 	echo " "
5103		echo "Checking if your compiler accepts -fno-delete-null-pointer-checks" 2>&1
5104		echo 'int main(void) { return 0; }' > gcctest.c
5105		if $cc -O2 -fno-delete-null-pointer-checks -o gcctest gcctest.c; then
5106			echo "Yes, it does." 2>&1
5107			case "$ccflags" in
5108			*delete-null-pointer-checks*)
5109				echo "Leaving current flags $ccflags alone." 2>&1
5110				;;
5111			*) dflt="$dflt -fno-delete-null-pointer-checks" ;;
5112			esac
5113		else
5114			echo "Nope, it doesn't, but that's ok." 2>&1
5115		fi
5116		;;
5117	esac
5118	# For gcc, adding -pipe speeds up compilations for some, but apparently
5119	# some assemblers can't read from stdin.  (It also slows down compilations
5120	# in other cases, but those are apparently rarer these days.)  AD 5/2004.
5121	case "$gccversion" in
5122	?*)	set pipe -pipe
5123		eval $checkccflag
5124		;;
5125	esac
5126
5127	# on x86_64 (at least) we require an extra library (libssp) in the
5128	# link command line. This library is not named, so I infer that it is
5129	# an implementation detail that may change. Hence the safest approach
5130	# is to add the flag to the flags passed to the compiler at link time,
5131	# as that way the compiler can do the right implementation dependant
5132	# thing. (NWC)
5133	case "$gccversion" in
5134	?*)	set stack-protector -fstack-protector
5135		eval $checkccflag
5136		;;
5137	esac
5138	;;
5139esac
5140
5141case "$mips_type" in
5142*BSD*|'') inclwanted="$locincpth $usrinc";;
5143*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5144esac
5145for thisincl in $inclwanted; do
5146	if $test -d $thisincl; then
5147		if $test x$thisincl != x$usrinc; then
5148			case "$dflt" in
5149			*" -I$thisincl "*);;
5150			*) dflt="$dflt -I$thisincl ";;
5151			esac
5152		fi
5153	fi
5154done
5155
5156inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5157	xxx=true;
5158elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5159	xxx=true;
5160else
5161	xxx=false;
5162fi;
5163if $xxx; then
5164	case "$dflt" in
5165	*$2*);;
5166	*) dflt="$dflt -D$2";;
5167	esac;
5168fi'
5169
5170set signal.h LANGUAGE_C; eval $inctest
5171
5172case "$usesocks" in
5173$define)
5174	ccflags="$ccflags -DSOCKS"
5175	;;
5176esac
5177
5178case "$hint" in
5179default|recommended) dflt="$ccflags $dflt" ;;
5180*) dflt="$ccflags";;
5181esac
5182
5183case "$dflt" in
5184''|' ') dflt=none;;
5185esac
5186
5187$cat <<EOH
5188
5189Your C compiler may want other flags.  For this question you should include
5190-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5191but you should NOT include libraries or ld flags like -lwhatever.  If you
5192want $package to honor its debug switch, you should include -DDEBUGGING here.
5193Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5194
5195To use no flags, specify the word "none".
5196
5197EOH
5198set X $dflt
5199shift
5200dflt=${1+"$@"}
5201rp="Any additional cc flags?"
5202. ./myread
5203case "$ans" in
5204none) ccflags='';;
5205*) ccflags="$ans";;
5206esac
5207
5208: the following weeds options from ccflags that are of no interest to cpp
5209case "$cppflags" in
5210'') cppflags="$ccflags" ;;
5211*)  cppflags="$cppflags $ccflags" ;;
5212esac
5213case "$gccversion" in
52141*) cppflags="$cppflags -D__GNUC__"
5215esac
5216case "$mips_type" in
5217'');;
5218*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5219esac
5220case "$cppflags" in
5221'');;
5222*)
5223	echo " "
5224	echo "Let me guess what the preprocessor flags are..." >&4
5225	set X $cppflags
5226	shift
5227	cppflags=''
5228	$cat >cpp.c <<'EOM'
5229#define BLURFL foo
5230
5231BLURFL xx LFRULB
5232EOM
5233	previous=''
5234	for flag in $*
5235	do
5236		case "$flag" in
5237		-*) ftry="$flag";;
5238		*) ftry="$previous $flag";;
5239		esac
5240		if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5241			>cpp1.out 2>/dev/null && \
5242			$cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5243			>cpp2.out 2>/dev/null && \
5244			$contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5245			$contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5246		then
5247			cppflags="$cppflags $ftry"
5248			previous=''
5249		else
5250			previous="$flag"
5251		fi
5252	done
5253	set X $cppflags
5254	shift
5255	cppflags=${1+"$@"}
5256	case "$cppflags" in
5257	*-*)  echo "They appear to be: $cppflags";;
5258	esac
5259	$rm -f cpp.c cpp?.out
5260	;;
5261esac
5262
5263: flags used in final linking phase
5264case "$ldflags" in
5265'') if ./venix; then
5266		dflt='-i -z'
5267	else
5268		dflt=''
5269	fi
5270	case "$ccflags" in
5271	*-posix*) dflt="$dflt -posix" ;;
5272	esac
5273	;;
5274*) dflt="$ldflags";;
5275esac
5276# See note above about -fstack-protector
5277case "$ccflags" in
5278*-fstack-protector*)
5279	case "$dflt" in
5280	*-fstack-protector*) ;; # Don't add it again
5281	*) dflt="$dflt -fstack-protector" ;;
5282	esac
5283	;;
5284esac
5285
5286: Try to guess additional flags to pick up local libraries.
5287for thislibdir in $libpth; do
5288	case " $loclibpth " in
5289	*" $thislibdir "*)
5290		case "$dflt " in
5291		*"-L$thislibdir "*) ;;
5292		*)  dflt="$dflt -L$thislibdir" ;;
5293		esac
5294		;;
5295	esac
5296done
5297
5298case "$dflt" in
5299'') dflt='none' ;;
5300esac
5301
5302$cat <<EOH
5303
5304Your C linker may need flags.  For this question you should
5305include -L/whatever and any other flags used by the C linker, but you
5306should NOT include libraries like -lwhatever.
5307
5308Make sure you include the appropriate -L/path flags if your C linker
5309does not normally search all of the directories you specified above,
5310namely
5311	$libpth
5312To use no flags, specify the word "none".
5313
5314EOH
5315
5316rp="Any additional ld flags (NOT including libraries)?"
5317. ./myread
5318case "$ans" in
5319none) ldflags='';;
5320*) ldflags="$ans";;
5321esac
5322rmlist="$rmlist pdp11"
5323
5324: coherency check
5325echo " "
5326echo "Checking your choice of C compiler and flags for coherency..." >&4
5327$cat > try.c <<'EOF'
5328#include <stdio.h>
5329int main() { printf("Ok\n"); return(0); }
5330EOF
5331set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5332shift
5333$cat >try.msg <<'EOM'
5334I've tried to compile and run the following simple program:
5335
5336EOM
5337$cat try.c >> try.msg
5338
5339$cat >> try.msg <<EOM
5340
5341I used the command:
5342
5343	$*
5344	$run ./try
5345
5346and I got the following output:
5347
5348EOM
5349dflt=y
5350if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5351	if $sh -c "$run ./try " >>try.msg 2>&1; then
5352		xxx=`$run ./try`
5353		case "$xxx" in
5354		"Ok") dflt=n ;;
5355		*)	echo 'The program compiled OK, but produced no output.' >> try.msg
5356			case " $libs " in
5357			*" -lsfio "*)
5358				cat >> try.msg <<'EOQS'
5359If $libs contains -lsfio, and sfio is mis-configured, then it
5360sometimes (apparently) runs and exits with a 0 status, but with no
5361output!  It may have to do with sfio's use of _exit vs. exit.
5362
5363EOQS
5364				rp="You have a big problem.  Shall I abort Configure"
5365				dflt=y
5366				;;
5367			esac
5368			;;
5369		esac
5370	else
5371		echo "The program compiled OK, but exited with status $?." >>try.msg
5372		rp="You have a problem.  Shall I abort Configure"
5373		dflt=y
5374	fi
5375else
5376	echo "I can't compile the test program." >>try.msg
5377	rp="You have a BIG problem.  Shall I abort Configure"
5378	dflt=y
5379fi
5380case "$dflt" in
5381y)
5382	$cat try.msg >&4
5383	case "$knowitall" in
5384	'')
5385		echo "(The supplied flags or libraries might be incorrect.)"
5386		;;
5387	*) dflt=n;;
5388	esac
5389	echo " "
5390	. ./myread
5391	case "$ans" in
5392	n*|N*) ;;
5393	*)	echo "Ok.  Stopping Configure." >&4
5394		exit 1
5395		;;
5396	esac
5397	;;
5398n) echo "OK, that should do.";;
5399esac
5400$rm_try gcctest gcctest.out
5401
5402: define a shorthand compile call
5403compile='
5404mc_file=$1;
5405shift;
5406case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5407echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5408exit 1;
5409fi;
5410esac;
5411$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5412: define a shorthand compile call for compilations that should be ok.
5413compile_ok='
5414mc_file=$1;
5415shift;
5416$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5417
5418: determine filename position in cpp output
5419echo " "
5420echo "Computing filename position in cpp output for #include directives..." >&4
5421case "$osname" in
5422vos) testaccess=-e ;;
5423*)   testaccess=-r ;;
5424esac
5425echo '#include <stdio.h>' > foo.c
5426$cat >fieldn <<EOF
5427$startsh
5428$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5429$grep '^[ 	]*#.*stdio\.h' | \
5430while read cline; do
5431	pos=1
5432	set \$cline
5433	while $test \$# -gt 0; do
5434		if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5435			echo "\$pos"
5436			exit 0
5437		fi
5438		shift
5439		pos=\`expr \$pos + 1\`
5440	done
5441done
5442EOF
5443chmod +x fieldn
5444fieldn=`./fieldn`
5445$rm -f foo.c fieldn
5446case $fieldn in
5447'') pos='???';;
54481) pos=first;;
54492) pos=second;;
54503) pos=third;;
5451*) pos="${fieldn}th";;
5452esac
5453echo "Your cpp writes the filename in the $pos field of the line."
5454
5455case "$osname" in
5456vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5457os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5458*)   cppfilter='' ;;
5459esac
5460: locate header file
5461$cat >findhdr <<EOF
5462$startsh
5463wanted=\$1
5464name=''
5465for usrincdir in $usrinc
5466do
5467	if test -f \$usrincdir/\$wanted; then
5468		echo "\$usrincdir/\$wanted"
5469		exit 0
5470	fi
5471done
5472awkprg='{ print \$$fieldn }'
5473echo "#include <\$wanted>" > foo\$\$.c
5474$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5475$cppfilter $grep "^[ 	]*#.*\$wanted" | \
5476while read cline; do
5477	name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5478	case "\$name" in
5479	*[/\\\\]\$wanted) echo "\$name"; exit 1;;
5480	*[\\\\/]\$wanted) echo "\$name"; exit 1;;
5481	*) exit 2;;
5482	esac;
5483done;
5484#
5485# status = 0: grep returned 0 lines, case statement not executed
5486# status = 1: headerfile found
5487# status = 2: while loop executed, no headerfile found
5488#
5489status=\$?
5490$rm -f foo\$\$.c;
5491if test \$status -eq 1; then
5492	exit 0;
5493fi
5494exit 1
5495EOF
5496chmod +x findhdr
5497
5498: define an alternate in-header-list? function
5499inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5500cont=true; xxf="echo \"<\$1> found.\" >&4";
5501case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5502*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5503esac;
5504case $# in 4) instead=instead;; *) instead="at last";; esac;
5505while $test "$cont"; do
5506	xxx=`./findhdr $1`
5507	var=$2; eval "was=\$$2";
5508	if $test "$xxx" && $test -r "$xxx";
5509	then eval $xxf;
5510	eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5511		cont="";
5512	else eval $xxnf;
5513	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5514	set $yyy; shift; shift; yyy=$@;
5515	case $# in 0) cont="";;
5516	2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5517		xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5518	*) xxf="echo \"but I found <\$1\> instead.\" >&4";
5519		xxnf="echo \"there is no <\$1>, ...\" >&4";;
5520	esac;
5521done;
5522while $test "$yyy";
5523do set $yyy; var=$2; eval "was=\$$2";
5524	eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5525	set $yyy; shift; shift; yyy=$@;
5526done'
5527
5528: see if stdlib is available
5529set stdlib.h i_stdlib
5530eval $inhdr
5531
5532: check for lengths of integral types
5533echo " "
5534case "$intsize" in
5535'')
5536	echo "Checking to see how big your integers are..." >&4
5537	$cat >try.c <<EOCP
5538#include <stdio.h>
5539#$i_stdlib I_STDLIB
5540#ifdef I_STDLIB
5541#include <stdlib.h>
5542#endif
5543int main()
5544{
5545	printf("intsize=%d;\n", (int)sizeof(int));
5546	printf("longsize=%d;\n", (int)sizeof(long));
5547	printf("shortsize=%d;\n", (int)sizeof(short));
5548	exit(0);
5549}
5550EOCP
5551	set try
5552	if eval $compile_ok && $run ./try > /dev/null; then
5553		eval `$run ./try`
5554		echo "Your integers are $intsize bytes long."
5555		echo "Your long integers are $longsize bytes long."
5556		echo "Your short integers are $shortsize bytes long."
5557	else
5558		$cat >&4 <<EOM
5559!
5560Help! I can't compile and run the intsize test program: please enlighten me!
5561(This is probably a misconfiguration in your system or libraries, and
5562you really ought to fix it.  Still, I'll try anyway.)
5563!
5564EOM
5565		dflt=4
5566		rp="What is the size of an integer (in bytes)?"
5567		. ./myread
5568		intsize="$ans"
5569		dflt=$intsize
5570		rp="What is the size of a long integer (in bytes)?"
5571		. ./myread
5572		longsize="$ans"
5573		dflt=2
5574		rp="What is the size of a short integer (in bytes)?"
5575		. ./myread
5576		shortsize="$ans"
5577	fi
5578	;;
5579esac
5580$rm_try
5581
5582: check for long long
5583echo " "
5584echo "Checking to see if you have long long..." >&4
5585echo 'int main() { long long x = 7; return 0; }' > try.c
5586set try
5587if eval $compile; then
5588	val="$define"
5589	echo "You have long long."
5590else
5591	val="$undef"
5592	echo "You do not have long long."
5593fi
5594$rm_try
5595set d_longlong
5596eval $setvar
5597
5598: check for length of long long
5599case "${d_longlong}${longlongsize}" in
5600$define)
5601	echo " "
5602	echo "Checking to see how big your long longs are..." >&4
5603	$cat >try.c <<'EOCP'
5604#include <stdio.h>
5605int main()
5606{
5607    printf("%d\n", (int)sizeof(long long));
5608    return(0);
5609}
5610EOCP
5611	set try
5612	if eval $compile_ok; then
5613		longlongsize=`$run ./try`
5614		echo "Your long longs are $longlongsize bytes long."
5615	else
5616		dflt='8'
5617		echo " "
5618		echo "(I can't seem to compile the test program.  Guessing...)"
5619		rp="What is the size of a long long (in bytes)?"
5620		. ./myread
5621		longlongsize="$ans"
5622	fi
5623	if $test "X$longsize" = "X$longlongsize"; then
5624		echo "(That isn't any different from an ordinary long.)"
5625	fi
5626	;;
5627esac
5628$rm_try
5629
5630: see if inttypes.h is available
5631: we want a real compile instead of Inhdr because some systems
5632: have an inttypes.h which includes non-existent headers
5633echo " "
5634$cat >try.c <<EOCP
5635#include <inttypes.h>
5636int main() {
5637	static int32_t foo32 = 0x12345678;
5638}
5639EOCP
5640set try
5641if eval $compile; then
5642	echo "<inttypes.h> found." >&4
5643	val="$define"
5644else
5645	echo "<inttypes.h> NOT found." >&4
5646	val="$undef"
5647fi
5648$rm_try
5649set i_inttypes
5650eval $setvar
5651
5652: check for int64_t
5653echo " "
5654echo "Checking to see if you have int64_t..." >&4
5655$cat >try.c <<EOCP
5656#include <sys/types.h>
5657#$i_inttypes I_INTTYPES
5658#ifdef I_INTTYPES
5659#include <inttypes.h>
5660#endif
5661int main() { int64_t x = 7; }
5662EOCP
5663set try
5664if eval $compile; then
5665	val="$define"
5666	echo "You have int64_t."
5667else
5668	val="$undef"
5669	echo "You do not have int64_t."
5670fi
5671$rm_try
5672set d_int64_t
5673eval $setvar
5674
5675: Check if 64bit ints have a quad type
5676echo " "
5677echo "Checking which 64-bit integer type we could use..." >&4
5678
5679case "$intsize" in
56808) val=int
5681   set quadtype
5682   eval $setvar
5683   val='"unsigned int"'
5684   set uquadtype
5685   eval $setvar
5686   quadkind=1
5687   ;;
5688*) case "$longsize" in
5689   8) val=long
5690      set quadtype
5691      eval $setvar
5692      val='"unsigned long"'
5693      set uquadtype
5694      eval $setvar
5695      quadkind=2
5696      ;;
5697   *) case "$d_longlong:$longlongsize" in
5698      define:8)
5699        val='"long long"'
5700        set quadtype
5701        eval $setvar
5702        val='"unsigned long long"'
5703        set uquadtype
5704        eval $setvar
5705        quadkind=3
5706        ;;
5707      *) case "$d_int64_t" in
5708         define)
5709           val=int64_t
5710           set quadtype
5711           eval $setvar
5712           val=uint64_t
5713           set uquadtype
5714           eval $setvar
5715           quadkind=4
5716           ;;
5717         esac
5718         ;;
5719      esac
5720      ;;
5721   esac
5722   ;;
5723esac
5724
5725case "$quadtype" in
5726'')	echo "Alas, no 64-bit integer types in sight." >&4
5727	d_quad="$undef"
5728	;;
5729*)	echo "We could use '$quadtype' for 64-bit integers." >&4
5730	d_quad="$define"
5731	;;
5732esac
5733
5734: Do we want 64bit support
5735case "$uselonglong" in
5736"$define"|true|[yY]*)
5737	cat <<EOM >&4
5738
5739*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5740EOM
5741	use64bitint="$define"
5742	;;
5743esac
5744case "$use64bits" in
5745"$define"|true|[yY]*)
5746	cat <<EOM >&4
5747
5748*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5749EOM
5750	use64bitint="$define"
5751	;;
5752esac
5753case "$use64bitints" in
5754"$define"|true|[yY]*)
5755	cat <<EOM >&4
5756
5757*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5758EOM
5759	use64bitint="$define"
5760	;;
5761esac
5762case "$use64bitsint" in
5763"$define"|true|[yY]*)
5764	cat <<EOM >&4
5765
5766*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5767EOM
5768	use64bitint="$define"
5769	;;
5770esac
5771case "$uselonglongs" in
5772"$define"|true|[yY]*)
5773	cat <<EOM >&4
5774
5775*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5776EOM
5777	use64bitint="$define"
5778	;;
5779esac
5780case "$use64bitsall" in
5781"$define"|true|[yY]*)
5782	cat <<EOM >&4
5783
5784*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5785EOM
5786	use64bitall="$define"
5787	;;
5788esac
5789
5790case "$ccflags" in
5791*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5792esac
5793case "$use64bitall" in
5794"$define"|true|[yY]*) use64bitint="$define" ;;
5795esac
5796
5797case "$longsize" in
57988) cat <<EOM
5799
5800You have natively 64-bit long integers.
5801EOM
5802   val="$define"
5803   ;;
5804*) case "$use64bitint" in
5805   "$define"|true|[yY]*) dflt='y';;
5806   *) dflt='n';;
5807   esac
5808   case "$d_quad" in
5809   "$define") ;;
5810   *) dflt='n' ;;
5811   esac
5812   cat <<EOM
5813
5814Perl can be built to take advantage of 64-bit integer types
5815on some systems.  To do so, Configure can be run with -Duse64bitint.
5816Choosing this option will most probably introduce binary incompatibilities.
5817
5818If this doesn't make any sense to you, just accept the default '$dflt'.
5819(The default has been chosen based on your configuration.)
5820EOM
5821   rp='Try to use 64-bit integers, if available?'
5822   . ./myread
5823   case "$ans" in
5824   [yY]*) val="$define" ;;
5825   *)     val="$undef"  ;;
5826   esac
5827   ;;
5828esac
5829set use64bitint
5830eval $setvar
5831
5832case "$use64bitall" in
5833"$define"|true|[yY]*) dflt='y' ;;
5834*) case "$longsize" in
5835   8) dflt='y' ;;
5836   *) dflt='n' ;;
5837   esac
5838   ;;
5839esac
5840cat <<EOM
5841
5842You may also choose to try maximal 64-bitness.  It means using as much
584364-bitness as possible on the platform.  This in turn means even more
5844binary incompatibilities.  On the other hand, your platform may not
5845have any more 64-bitness available than what you already have chosen.
5846
5847If this doesn't make any sense to you, just accept the default '$dflt'.
5848(The default has been chosen based on your configuration.)
5849EOM
5850rp='Try to use maximal 64-bit support, if available?'
5851. ./myread
5852case "$ans" in
5853[yY]*) val="$define" ;;
5854*)     val="$undef"  ;;
5855esac
5856set use64bitall
5857eval $setvar
5858case "$use64bitall" in
5859"$define")
5860	case "$use64bitint" in
5861	"$undef")
5862		cat <<EOM
5863
5864Since you have chosen a maximally 64-bit build, I'm also turning on
5865the use of 64-bit integers.
5866EOM
5867		use64bitint="$define" ;;
5868	esac
5869	;;
5870esac
5871
5872: Look for a hint-file generated 'call-back-unit'.  If the
5873: user has specified that a 64-bit perl is to be built,
5874: we may need to set or change some other defaults.
5875if $test -f use64bitint.cbu; then
5876	echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5877	. ./use64bitint.cbu
5878fi
5879case "$use64bitint" in
5880"$define"|true|[yY]*)
5881	case "$longsize" in
5882	4) case "$archname64" in
5883	   '') archname64=64int ;;
5884	   esac
5885	   ;;
5886	esac
5887	;;
5888esac
5889
5890: Look for a hint-file generated 'call-back-unit'.  If the
5891: user has specified that a maximally 64-bit perl is to be built,
5892: we may need to set or change some other defaults.
5893if $test -f use64bitall.cbu; then
5894	echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5895	. ./use64bitall.cbu
5896fi
5897case "$use64bitall" in
5898"$define"|true|[yY]*)
5899	case "$longsize" in
5900	4) case "$archname64" in
5901	   ''|64int) archname64=64all ;;
5902	   esac
5903	   ;;
5904	esac
5905	;;
5906esac
5907
5908case "$d_quad:$use64bitint" in
5909$undef:$define)
5910	cat >&4 <<EOF
5911
5912*** You have chosen to use 64-bit integers,
5913*** but none can be found.
5914*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5915*** Cannot continue, aborting.
5916
5917EOF
5918	exit 1
5919	;;
5920esac
5921
5922: check for length of double
5923echo " "
5924case "$doublesize" in
5925'')
5926	echo "Checking to see how big your double precision numbers are..." >&4
5927	$cat >try.c <<EOCP
5928#include <stdio.h>
5929#$i_stdlib I_STDLIB
5930#ifdef I_STDLIB
5931#include <stdlib.h>
5932#endif
5933int main()
5934{
5935    printf("%d\n", (int)sizeof(double));
5936    exit(0);
5937}
5938EOCP
5939	set try
5940	if eval $compile_ok; then
5941		doublesize=`$run ./try`
5942		echo "Your double is $doublesize bytes long."
5943	else
5944		dflt='8'
5945		echo "(I can't seem to compile the test program.  Guessing...)"
5946		rp="What is the size of a double precision number (in bytes)?"
5947		. ./myread
5948		doublesize="$ans"
5949	fi
5950	;;
5951esac
5952$rm_try
5953
5954: check for long doubles
5955echo " "
5956echo "Checking to see if you have long double..." >&4
5957echo 'int main() { long double x = 7.0; }' > try.c
5958set try
5959if eval $compile; then
5960	val="$define"
5961	echo "You have long double."
5962else
5963	val="$undef"
5964	echo "You do not have long double."
5965fi
5966$rm_try
5967set d_longdbl
5968eval $setvar
5969
5970: check for length of long double
5971case "${d_longdbl}${longdblsize}" in
5972$define)
5973	echo " "
5974	echo "Checking to see how big your long doubles are..." >&4
5975	$cat >try.c <<'EOCP'
5976#include <stdio.h>
5977int main()
5978{
5979	printf("%d\n", sizeof(long double));
5980}
5981EOCP
5982	set try
5983	set try
5984	if eval $compile; then
5985		longdblsize=`$run ./try`
5986		echo "Your long doubles are $longdblsize bytes long."
5987	else
5988		dflt='8'
5989		echo " "
5990		echo "(I can't seem to compile the test program.  Guessing...)" >&4
5991		rp="What is the size of a long double (in bytes)?"
5992		. ./myread
5993		longdblsize="$ans"
5994	fi
5995	if $test "X$doublesize" = "X$longdblsize"; then
5996		echo "That isn't any different from an ordinary double."
5997		echo "I'll keep your setting anyway, but you may see some"
5998		echo "harmless compilation warnings."
5999	fi
6000	;;
6001esac
6002$rm_try
6003
6004: determine the architecture name
6005echo " "
6006if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6007	tarch=`arch`"-$osname"
6008elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6009	if uname -m > tmparch 2>&1 ; then
6010		tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6011			-e 's/$/'"-$osname/" tmparch`
6012	else
6013		tarch="$osname"
6014	fi
6015	$rm -f tmparch
6016else
6017	tarch="$osname"
6018fi
6019case "$myarchname" in
6020''|"$tarch") ;;
6021*)
6022	echo "(Your architecture name used to be $myarchname.)"
6023	archname=''
6024	;;
6025esac
6026case "$targetarch" in
6027'') ;;
6028*)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6029esac
6030myarchname="$tarch"
6031case "$archname" in
6032'') dflt="$tarch";;
6033*) dflt="$archname";;
6034esac
6035rp='What is your architecture name'
6036. ./myread
6037archname="$ans"
6038
6039: optionally add API version to the architecture for versioned archlibs
6040case "$useversionedarchname" in
6041$define|true|[yY]*) dflt='y';;
6042*)                  dflt='n';;
6043esac
6044rp='Add the Perl API version to your archname?'
6045. ./myread
6046case "$ans" in
6047y|Y)	useversionedarchname="$define" ;;
6048*)      useversionedarchname="$undef" ;;
6049esac
6050case "$useversionedarchname" in
6051$define)
6052        case "$archname" in
6053        *-$api_versionstring)
6054                echo "...and architecture name already has -$api_versionstring" >&4
6055                ;;
6056        *)
6057                archname="$archname-$api_versionstring"
6058                echo "...setting architecture name to $archname." >&4
6059                ;;
6060        esac
6061        ;;
6062esac
6063
6064case "$usethreads" in
6065$define)
6066	echo "Threads selected." >&4
6067	case "$archname" in
6068        *-thread*) echo "...and architecture name already has -thread." >&4
6069                ;;
6070        *)      archname="$archname-thread"
6071                echo "...setting architecture name to $archname." >&4
6072                ;;
6073        esac
6074	;;
6075esac
6076case "$usemultiplicity" in
6077$define)
6078	echo "Multiplicity selected." >&4
6079	case "$archname" in
6080        *-multi*) echo "...and architecture name already has -multi." >&4
6081                ;;
6082        *)      archname="$archname-multi"
6083                echo "...setting architecture name to $archname." >&4
6084                ;;
6085        esac
6086	;;
6087esac
6088case "$use64bitint$use64bitall" in
6089*"$define"*)
6090	case "$archname64" in
6091	'')
6092		echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6093		;;
6094	*)
6095		case "$use64bitint" in
6096		"$define") echo "64 bit integers selected." >&4 ;;
6097		esac
6098		case "$use64bitall" in
6099		"$define") echo "Maximal 64 bitness selected." >&4 ;;
6100		esac
6101		case "$archname" in
6102	        *-$archname64*) echo "...and architecture name already has $archname64." >&4
6103	                ;;
6104	        *)      archname="$archname-$archname64"
6105	                echo "...setting architecture name to $archname." >&4
6106	                ;;
6107	        esac
6108		;;
6109	esac
6110esac
6111case "$uselongdouble" in
6112$define)
6113	echo "Long doubles selected." >&4
6114	case "$longdblsize" in
6115	$doublesize)
6116		echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6117		;;
6118	*)
6119		case "$archname" in
6120	        *-ld*) echo "...and architecture name already has -ld." >&4
6121	                ;;
6122	        *)      archname="$archname-ld"
6123	                echo "...setting architecture name to $archname." >&4
6124        	        ;;
6125	        esac
6126		;;
6127	esac
6128	;;
6129esac
6130if $test -f archname.cbu; then
6131	echo "Your platform has some specific hints for architecture name, using them..."
6132	. ./archname.cbu
6133fi
6134
6135: set the prefixit variable, to compute a suitable default value
6136prefixit='case "$3" in
6137""|none)
6138	case "$oldprefix" in
6139	"") eval "$1=\"\$$2\"";;
6140	*)
6141		case "$3" in
6142		"") eval "$1=";;
6143		none)
6144			eval "tp=\"\$$2\"";
6145			case "$tp" in
6146			""|" ") eval "$1=\"\$$2\"";;
6147			*) eval "$1=";;
6148			esac;;
6149		esac;;
6150	esac;;
6151*)
6152	eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6153	case "$tp" in
6154	--|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6155	/*-$oldprefix/*|\~*-$oldprefix/*)
6156		eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6157	*) eval "$1=\"\$$2\"";;
6158	esac;;
6159esac'
6160
6161: determine installation style
6162: For now, try to deduce it from prefix unless it is already set.
6163: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6164case "$installstyle" in
6165'')	case "$prefix" in
6166		*perl*) dflt='lib';;
6167		*) dflt='lib/perl5' ;;
6168	esac
6169	;;
6170*)	dflt="$installstyle" ;;
6171esac
6172: Probably not worth prompting for this since we prompt for all
6173: the directories individually, and the prompt would be too long and
6174: confusing anyway.
6175installstyle=$dflt
6176
6177: determine where public executables go
6178echo " "
6179set dflt bin bin
6180eval $prefixit
6181fn=d~
6182rp='Pathname where the public executables will reside?'
6183. ./getfile
6184if $test "X$ansexp" != "X$binexp"; then
6185	installbin=''
6186fi
6187prefixvar=bin
6188: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6189: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6190:     this via initialinstalllocation
6191. ./setprefixvar
6192
6193case "$userelocatableinc" in
6194$define|true|[yY]*)	dflt='y' ;;
6195*)			dflt='n' ;;
6196esac
6197cat <<EOM
6198
6199Would you like to build Perl so that the installation is relocatable, so that
6200library paths in @INC are determined relative to the path of the perl binary?
6201This is not advised for system Perl installs, or if you need to run setid
6202scripts or scripts under taint mode.
6203
6204If this doesn't make any sense to you, just accept the default '$dflt'.
6205EOM
6206rp='Use relocatable @INC?'
6207. ./myread
6208case "$ans" in
6209y|Y)	val="$define" ;;
6210*)	val="$undef"  ;;
6211esac
6212set userelocatableinc
6213eval $setvar
6214
6215initialinstalllocation="$binexp"
6216: Default prefix is now "up one level from where the binaries are"
6217case "$userelocatableinc" in
6218$define|true|[yY]*)
6219    bin=".../"
6220    binexp=".../"
6221    prefix=".../.."
6222    prefixexp=".../.."
6223    installprefixexp=".../.."
6224    ;;
6225esac
6226
6227: determine where private library files go
6228: Usual default is /usr/local/lib/perl5/$version.
6229: Also allow things like /opt/perl/lib/$version, since
6230: /opt/perl/lib/perl5... would be redundant.
6231: The default "style" setting is made in installstyle.U
6232case "$installstyle" in
6233*lib/perl5*) set dflt privlib lib/$package/$version ;;
6234*)	 set dflt privlib lib/$version ;;
6235esac
6236eval $prefixit
6237$cat <<EOM
6238
6239There are some auxiliary files for $package that need to be put into a
6240private library directory that is accessible by everyone.
6241
6242EOM
6243fn=$binexp
6244fn=d~+
6245rp='Pathname where the private library files will reside?'
6246. ./getfile
6247prefixvar=privlib
6248. ./setprefixvar
6249
6250: set the prefixup variable, to restore leading tilda escape
6251prefixup='case "$prefixexp" in
6252"$prefix") ;;
6253*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6254esac'
6255
6256: determine where public architecture dependent libraries go
6257set archlib archlib
6258eval $prefixit
6259: privlib default is /usr/local/lib/$package/$version
6260: archlib default is /usr/local/lib/$package/$version/$archname
6261: privlib may have an optional trailing /share.
6262tdflt=`echo $privlib | $sed 's,/share$,,'`
6263tdflt=$tdflt/$archname
6264case "$archlib" in
6265'')	dflt=$tdflt
6266	;;
6267*)	dflt="$archlib"
6268    ;;
6269esac
6270$cat <<EOM
6271
6272$spackage contains architecture-dependent library files.  If you are
6273sharing libraries in a heterogeneous environment, you might store
6274these files in a separate location.  Otherwise, you can just include
6275them with the rest of the public library files.
6276
6277EOM
6278fn=$binexp
6279fn=d+~
6280rp='Where do you want to put the public architecture-dependent libraries?'
6281. ./getfile
6282prefixvar=archlib
6283. ./setprefixvar
6284if $test X"$archlib" = X"$privlib"; then
6285	d_archlib="$undef"
6286else
6287	d_archlib="$define"
6288fi
6289
6290: see if setuid scripts can be secure
6291$cat <<EOM
6292
6293Some kernels have a bug that prevents setuid #! scripts from being
6294secure.  Some sites have disabled setuid #! scripts because of this.
6295
6296First let's decide if your kernel supports secure setuid #! scripts.
6297(If setuid #! scripts would be secure but have been disabled anyway,
6298don't say that they are secure if asked.)
6299
6300EOM
6301
6302val="$undef"
6303if $test -d /dev/fd; then
6304	echo "#!$ls" >reflect
6305	chmod +x,u+s reflect
6306	./reflect >flect 2>&1
6307	if $contains "/dev/fd" flect >/dev/null; then
6308		echo "Congratulations, your kernel has secure setuid scripts!" >&4
6309		val="$define"
6310	else
6311		$cat <<EOM
6312If you are not sure if they are secure, I can check but I'll need a
6313username and password different from the one you are using right now.
6314If you don't have such a username or don't want me to test, simply
6315enter 'none'.
6316
6317EOM
6318		rp='Other username to test security of setuid scripts with?'
6319		dflt='none'
6320		. ./myread
6321		case "$ans" in
6322		n|none)
6323			case "$d_suidsafe" in
6324			'')	echo "I'll assume setuid scripts are *not* secure." >&4
6325				dflt=n;;
6326			"$undef")
6327				echo "Well, the $hint value is *not* secure." >&4
6328				dflt=n;;
6329			*)	echo "Well, the $hint value *is* secure." >&4
6330				dflt=y;;
6331			esac
6332			;;
6333		*)
6334			$rm -f reflect flect
6335			echo "#!$ls" >reflect
6336			chmod +x,u+s reflect
6337			echo >flect
6338			chmod a+w flect
6339			echo '"su" will (probably) prompt you for '"$ans's password."
6340			su $ans -c './reflect >flect'
6341			if $contains "/dev/fd" flect >/dev/null; then
6342				echo "Okay, it looks like setuid scripts are secure." >&4
6343				dflt=y
6344			else
6345				echo "I don't think setuid scripts are secure." >&4
6346				dflt=n
6347			fi
6348			;;
6349		esac
6350		rp='Does your kernel have *secure* setuid scripts?'
6351		. ./myread
6352		case "$ans" in
6353		[yY]*)	val="$define";;
6354		*)	val="$undef";;
6355		esac
6356	fi
6357else
6358	echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6359	echo "(That's for file descriptors, not floppy disks.)"
6360	val="$undef"
6361fi
6362set d_suidsafe
6363eval $setvar
6364
6365$rm -f reflect flect
6366
6367: now see if they want to do setuid emulation
6368if $test $patchlevel -lt 11; then
6369echo " "
6370val="$undef"
6371case "$d_suidsafe" in
6372"$define")
6373	val="$undef"
6374	echo "No need to emulate SUID scripts since they are secure here." >&4
6375	;;
6376*)
6377	$cat <<EOM
6378Some systems have disabled setuid scripts, especially systems where
6379setuid scripts cannot be secure.  On systems where setuid scripts have
6380been disabled, the setuid/setgid bits on scripts are currently
6381useless.  It is possible for $package to detect those bits and emulate
6382setuid/setgid in a secure fashion.  This emulation will only work if
6383setuid scripts have been disabled in your kernel.
6384
6385EOM
6386	case "$d_dosuid" in
6387	"$define") dflt=y ;;
6388	*) dflt=n ;;
6389	esac
6390	rp="Do you want to do setuid/setgid emulation?"
6391	. ./myread
6392	case "$ans" in
6393	[yY]*)	val="$define";;
6394	*)	val="$undef";;
6395	esac
6396	;;
6397esac
6398set d_dosuid
6399eval $setvar
6400else
6401    case "$d_dosuid" in
6402	"$define")
6403	cat >&4 <<EOH
6404
6405SUID emulation has been removed for 5.12
6406Please re-run Configure without -Dd_dosuid
6407
6408EOH
6409	exit 1;
6410	;;
6411    esac
6412    d_dosuid=undef
6413fi
6414
6415: Find perl5.005 or later.
6416echo "Looking for a previously installed perl5.005 or later... "
6417case "$perl5" in
6418'')	for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6419		: Check if this perl is recent and can load a simple module
6420		if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6421			perl5=$tdir/perl
6422			break;
6423		elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6424			perl5=$tdir/perl5
6425			break;
6426		fi
6427	done
6428	;;
6429*)	perl5="$perl5"
6430	;;
6431esac
6432case "$perl5" in
6433'')	echo "None found.  That's ok.";;
6434*)	echo "Using $perl5." ;;
6435esac
6436
6437: Set the siteprefix variables
6438$cat <<EOM
6439
6440After $package is installed, you may wish to install various
6441add-on modules and utilities.  Typically, these add-ons will
6442be installed under $prefix with the rest
6443of this package.  However, you may wish to install such add-ons
6444elsewhere under a different prefix.
6445
6446If you do not wish to put everything under a single prefix, that's
6447ok.  You will be prompted for the individual locations; this siteprefix
6448is only used to suggest the defaults.
6449
6450The default should be fine for most people.
6451
6452EOM
6453fn=d~+
6454rp='Installation prefix to use for add-on modules and utilities?'
6455: XXX Here might be another good place for an installstyle setting.
6456case "$siteprefix" in
6457'') dflt=$prefix ;;
6458*)  dflt=$siteprefix ;;
6459esac
6460. ./getfile
6461: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6462oldsiteprefix=''
6463case "$siteprefix" in
6464'') ;;
6465*)	case "$ans" in
6466	"$prefix") ;;
6467	*) oldsiteprefix="$prefix";;
6468	esac
6469	;;
6470esac
6471siteprefix="$ans"
6472siteprefixexp="$ansexp"
6473
6474: determine where site specific libraries go.
6475: Usual default is /usr/local/lib/perl5/site_perl/$version
6476: The default "style" setting is made in installstyle.U
6477: XXX No longer works with Prefixit stuff.
6478prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6479case "$sitelib" in
6480'') case "$installstyle" in
6481	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6482	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
6483	esac
6484	;;
6485*)	dflt="$sitelib"
6486	;;
6487esac
6488$cat <<EOM
6489
6490The installation process will create a directory for
6491site-specific extensions and modules.  Most users find it convenient
6492to place all site-specific files in this directory rather than in the
6493main distribution directory.
6494
6495EOM
6496fn=d~+
6497rp='Pathname for the site-specific library files?'
6498. ./getfile
6499prefixvar=sitelib
6500. ./setprefixvar
6501sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6502
6503: Determine list of previous versions to include in @INC
6504$cat > getverlist <<EOPL
6505#!$perl5 -w
6506use File::Basename;
6507\$api_versionstring = "$api_versionstring";
6508\$version = "$version";
6509\$stem = "$sitelib_stem";
6510\$archname = "$archname";
6511EOPL
6512	$cat >> getverlist <<'EOPL'
6513# The list found is store twice for each entry: the original name, and
6514# the binary broken down version as pack "sss", so sorting is easy and
6515# unambiguous. This will work for all versions that have a maximum of
6516# three digit groups, separate by '.'s or '_'s. Names are extended with
6517# ".0.0" to ensure at least three elements for the pack.
6518#					-- H.Merijn Brand (m)'06 23-10-2006
6519
6520# Can't have leading @ because metaconfig interprets it as a command!
6521;@inc_version_list=();
6522# XXX Redo to do opendir/readdir?
6523if (-d $stem) {
6524    chdir($stem);
6525    ;@candidates = map {
6526	[ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6527    ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6528}
6529else {
6530    ;@candidates = ();
6531}
6532
6533($pversion, $aversion, $vsn5005) = map {
6534    pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6535foreach $d (@candidates) {
6536    if ($d->[1] lt $pversion) {
6537	if ($d->[1] ge $aversion) {
6538	    unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6539	}
6540	elsif ($d->[1] ge $vsn5005) {
6541	    unshift(@inc_version_list, grep { -d } $d->[0]);
6542	}
6543    }
6544    else {
6545	# Skip newer version.  I.e. don't look in
6546	# 5.7.0 if we're installing 5.6.1.
6547    }
6548}
6549
6550if (@inc_version_list) {
6551    print join(' ', @inc_version_list);
6552}
6553else {
6554    # Blank space to preserve value for next Configure run.
6555    print " ";
6556}
6557EOPL
6558chmod +x getverlist
6559case "$inc_version_list" in
6560'')	if test -x "$perl5$exe_ext"; then
6561		dflt=`$perl5 getverlist`
6562	else
6563		dflt='none'
6564	fi
6565	;;
6566$undef) dflt='none' ;;
6567*)  eval dflt=\"$inc_version_list\" ;;
6568esac
6569case "$dflt" in
6570''|' ') dflt=none ;;
6571esac
6572case "$dflt" in
65735.005) dflt=none ;;
6574esac
6575$cat <<EOM
6576
6577In order to ease the process of upgrading, this version of perl
6578can be configured to use modules built and installed with earlier
6579versions of perl that were installed under $prefix.  Specify here
6580the list of earlier versions that this version of perl should check.
6581If Configure detected no earlier versions of perl installed under
6582$prefix, then the list will be empty.  Answer 'none' to tell perl
6583to not search earlier versions.
6584
6585The default should almost always be sensible, so if you're not sure,
6586just accept the default.
6587EOM
6588
6589rp='List of earlier versions to include in @INC?'
6590. ./myread
6591case "$ans" in
6592[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6593*) inc_version_list="$ans" ;;
6594esac
6595case "$inc_version_list" in
6596''|' ')
6597	inc_version_list_init='0'
6598	d_inc_version_list="$undef"
6599	;;
6600*)	inc_version_list_init=`echo $inc_version_list |
6601		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6602	d_inc_version_list="$define"
6603	;;
6604esac
6605$rm -f getverlist
6606
6607: see if malloc/malloc.h has to be included
6608set malloc/malloc.h i_mallocmalloc
6609eval $inhdr
6610
6611: see if this is a malloc.h system
6612: we want a real compile instead of Inhdr because some systems have a
6613: malloc.h that just gives a compile error saying to use stdlib.h instead
6614echo " "
6615$cat >try.c <<EOCP
6616#include <stdlib.h>
6617#include <malloc.h>
6618#$i_mallocmalloc I_MALLOCMALLOC
6619#ifdef I_MALLOCMALLOC
6620# include <malloc/malloc.h>
6621#endif
6622
6623int main () { return 0; }
6624EOCP
6625set try
6626if eval $compile; then
6627    echo "<malloc.h> found." >&4
6628    val="$define"
6629else
6630    echo "<malloc.h> NOT found." >&4
6631    val="$undef"
6632fi
6633$rm_try
6634set i_malloc
6635eval $setvar
6636
6637: check for void type
6638echo " "
6639echo "Checking to see how well your C compiler groks the void type..." >&4
6640case "$voidflags" in
6641'')
6642	$cat >try.c <<EOCP
6643#$i_stdlib I_STDLIB
6644#ifdef I_STDLIB
6645#include <stdlib.h>
6646#endif
6647#if TRY & 1
6648void sub() {
6649#else
6650sub() {
6651#endif
6652	extern void moo();	/* function returning void */
6653	void (*goo)();		/* ptr to func returning void */
6654#if TRY & 8
6655	void *hue;		/* generic ptr */
6656#endif
6657#if TRY & 2
6658	void (*foo[10])();
6659#endif
6660
6661#if TRY & 4
6662	if(goo == moo) {
6663		exit(0);
6664	}
6665#endif
6666	exit(0);
6667}
6668int main() { sub(); }
6669EOCP
6670	if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6671		voidflags=$defvoidused
6672	echo "Good.  It appears to support void to the level $package wants.">&4
6673		if $contains warning .out >/dev/null 2>&1; then
6674			echo "However, you might get some warnings that look like this:"
6675			$cat .out
6676		fi
6677	else
6678echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6679		if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6680			echo "It supports 1..."
6681			if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6682				echo "It also supports 2..."
6683				if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6684					voidflags=7
6685					echo "And it supports 4 but not 8 definitely."
6686				else
6687					echo "It doesn't support 4..."
6688					if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6689						voidflags=11
6690						echo "But it supports 8."
6691					else
6692						voidflags=3
6693						echo "Neither does it support 8."
6694					fi
6695				fi
6696			else
6697				echo "It does not support 2..."
6698				if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6699					voidflags=13
6700					echo "But it supports 4 and 8."
6701				else
6702					if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6703						voidflags=5
6704						echo "And it supports 4 but has not heard about 8."
6705					else
6706						echo "However it supports 8 but not 4."
6707					fi
6708				fi
6709			fi
6710		else
6711			echo "There is no support at all for void."
6712			voidflags=0
6713		fi
6714	fi
6715esac
6716case "$voidflags" in
6717"$defvoidused") ;;
6718*)	$cat >&4 <<'EOM'
6719  Support flag bits are:
6720    1: basic void declarations.
6721    2: arrays of pointers to functions returning void.
6722    4: operations between pointers to and addresses of void functions.
6723    8: generic void pointers.
6724EOM
6725	dflt="$voidflags";
6726	rp="Your void support flags add up to what?"
6727	. ./myread
6728	voidflags="$ans"
6729	;;
6730esac
6731$rm_try
6732
6733: check for length of pointer
6734echo " "
6735case "$ptrsize" in
6736'')
6737	echo "Checking to see how big your pointers are..." >&4
6738	if test "$voidflags" -gt 7; then
6739		echo '#define VOID_PTR char *' > try.c
6740	else
6741		echo '#define VOID_PTR void *' > try.c
6742	fi
6743	$cat >>try.c <<EOCP
6744#include <stdio.h>
6745#$i_stdlib I_STDLIB
6746#ifdef I_STDLIB
6747#include <stdlib.h>
6748#endif
6749int main()
6750{
6751    printf("%d\n", (int)sizeof(VOID_PTR));
6752    exit(0);
6753}
6754EOCP
6755	set try
6756	if eval $compile_ok; then
6757		ptrsize=`$run ./try`
6758		echo "Your pointers are $ptrsize bytes long."
6759	else
6760		dflt='4'
6761		echo "(I can't seem to compile the test program.  Guessing...)" >&4
6762		rp="What is the size of a pointer (in bytes)?"
6763		. ./myread
6764		ptrsize="$ans"
6765	fi
6766	;;
6767esac
6768$rm_try
6769case "$use64bitall" in
6770"$define"|true|[yY]*)
6771	case "$ptrsize" in
6772	4)	cat <<EOM >&4
6773
6774*** You have chosen a maximally 64-bit build,
6775*** but your pointers are only 4 bytes wide.
6776*** Please rerun Configure without -Duse64bitall.
6777EOM
6778		case "$d_quad" in
6779		define)
6780			cat <<EOM >&4
6781*** Since you have quads, you could possibly try with -Duse64bitint.
6782EOM
6783			;;
6784		esac
6785		cat <<EOM >&4
6786*** Cannot continue, aborting.
6787
6788EOM
6789
6790		exit 1
6791		;;
6792	esac
6793	;;
6794esac
6795
6796
6797: determine whether to use malloc wrapping
6798echo " "
6799case "$usemallocwrap" in
6800[yY]*|true|$define)	dflt='y' ;;
6801[nN]*|false|$undef)	dflt='n' ;;
6802*)	case "$usedevel" in
6803	[yY]*|true|$define)	dflt='y' ;;
6804	*) dflt='n' ;;
6805	esac
6806	;;
6807esac
6808rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6809. ./myread
6810usemallocwrap="$ans"
6811case "$ans" in
6812y*|true)
6813	usemallocwrap="$define" ;;
6814*)
6815	usemallocwrap="$undef" ;;
6816esac
6817
6818: determine which malloc to compile in
6819echo " "
6820case "$usemymalloc" in
6821[yY]*|true|$define)	dflt='y' ;;
6822[nN]*|false|$undef)	dflt='n' ;;
6823*)	case "$ptrsize" in
6824	4) dflt='y' ;;
6825	*) dflt='n' ;;
6826	esac
6827	if test "$useithreads" = "$define"; then dflt='n'; fi
6828	;;
6829esac
6830rp="Do you wish to attempt to use the malloc that comes with $package?"
6831. ./myread
6832usemymalloc="$ans"
6833case "$ans" in
6834y*|true)
6835	usemymalloc='y'
6836	mallocsrc='malloc.c'
6837	mallocobj="malloc$_o"
6838	d_mymalloc="$define"
6839	case "$libs" in
6840	*-lmalloc*)
6841		: Remove malloc from list of libraries to use
6842		echo "Removing unneeded -lmalloc from library list" >&4
6843		set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6844		shift
6845		libs="$*"
6846		echo "libs = $libs" >&4
6847		;;
6848	esac
6849	;;
6850*)
6851	usemymalloc='n'
6852	mallocsrc=''
6853	mallocobj=''
6854	d_mymalloc="$undef"
6855	;;
6856esac
6857
6858: compute the return types of malloc and free
6859echo " "
6860$cat >malloc.c <<END
6861#$i_malloc I_MALLOC
6862#$i_stdlib I_STDLIB
6863#include <stdio.h>
6864#include <sys/types.h>
6865#ifdef I_MALLOC
6866#include <malloc.h>
6867#endif
6868#ifdef I_STDLIB
6869#include <stdlib.h>
6870#endif
6871#ifdef TRY_MALLOC
6872void *malloc();
6873#endif
6874#ifdef TRY_FREE
6875void free();
6876#endif
6877END
6878case "$malloctype" in
6879'')
6880	if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6881		malloctype='void *'
6882	else
6883		malloctype='char *'
6884	fi
6885	;;
6886esac
6887echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6888
6889case "$freetype" in
6890'')
6891	if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6892		freetype='void'
6893	else
6894		freetype='int'
6895	fi
6896	;;
6897esac
6898echo "Your system uses $freetype free(), it would seem." >&4
6899$rm -f malloc.[co]
6900: determine where site specific architecture-dependent libraries go.
6901: sitelib  default is /usr/local/lib/perl5/site_perl/$version
6902: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6903: sitelib may have an optional trailing /share.
6904case "$sitearch" in
6905'')	dflt=`echo $sitelib | $sed 's,/share$,,'`
6906	dflt="$dflt/$archname"
6907	;;
6908*)	dflt="$sitearch"
6909	;;
6910esac
6911set sitearch sitearch none
6912eval $prefixit
6913$cat <<EOM
6914
6915The installation process will also create a directory for
6916architecture-dependent site-specific extensions and modules.
6917
6918EOM
6919fn=d~+
6920rp='Pathname for the site-specific architecture-dependent library files?'
6921. ./getfile
6922prefixvar=sitearch
6923. ./setprefixvar
6924if $test X"$sitearch" = X"$sitelib"; then
6925	d_sitearch="$undef"
6926else
6927	d_sitearch="$define"
6928fi
6929
6930: Set the vendorprefix variables
6931$cat <<EOM
6932
6933The installation process will also create a directory for
6934vendor-supplied add-ons.  Vendors who supply perl with their system
6935may find it convenient to place all vendor-supplied files in this
6936directory rather than in the main distribution directory.  This will
6937ease upgrades between binary-compatible maintenance versions of perl.
6938
6939Of course you may also use these directories in whatever way you see
6940fit.  For example, you might use them to access modules shared over a
6941company-wide network.
6942
6943The default answer should be fine for most people.
6944This causes further questions about vendor add-ons to be skipped
6945and no vendor-specific directories will be configured for perl.
6946
6947EOM
6948rp='Do you want to configure vendor-specific add-on directories?'
6949case "$usevendorprefix" in
6950define|true|[yY]*) dflt=y ;;
6951*)	: User may have set vendorprefix directly on Configure command line.
6952	case "$vendorprefix" in
6953	''|' ') dflt=n ;;
6954	*)	dflt=y ;;
6955	esac
6956	;;
6957esac
6958. ./myread
6959case "$ans" in
6960[yY]*)	fn=d~+
6961	rp='Installation prefix to use for vendor-supplied add-ons?'
6962	case "$vendorprefix" in
6963	'') dflt='' ;;
6964	*)  dflt=$vendorprefix ;;
6965	esac
6966	. ./getfile
6967	: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6968	oldvendorprefix=''
6969	case "$vendorprefix" in
6970	'') ;;
6971	*)	case "$ans" in
6972		"$prefix") ;;
6973		*) oldvendorprefix="$prefix";;
6974		esac
6975		;;
6976	esac
6977	usevendorprefix="$define"
6978	vendorprefix="$ans"
6979	vendorprefixexp="$ansexp"
6980	;;
6981*)	usevendorprefix="$undef"
6982	vendorprefix=''
6983	vendorprefixexp=''
6984	;;
6985esac
6986
6987: Set the vendorlib variables
6988case "$vendorprefix" in
6989'')	d_vendorlib="$undef"
6990	vendorlib=''
6991	vendorlibexp=''
6992	;;
6993*)	d_vendorlib="$define"
6994	: determine where vendor-supplied modules go.
6995	: Usual default is /usr/local/lib/perl5/vendor_perl/$version
6996	case "$vendorlib" in
6997	'')
6998		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6999		case "$installstyle" in
7000		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7001		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7002		esac
7003		;;
7004	*)	dflt="$vendorlib"
7005		;;
7006	esac
7007	fn=d~+
7008	rp='Pathname for the vendor-supplied library files?'
7009	. ./getfile
7010	vendorlib="$ans"
7011	vendorlibexp="$ansexp"
7012	;;
7013esac
7014vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7015prefixvar=vendorlib
7016. ./installprefix
7017
7018: Set the vendorarch variables
7019case "$vendorprefix" in
7020'')	d_vendorarch="$undef"
7021	vendorarch=''
7022	vendorarchexp=''
7023	;;
7024*)	d_vendorarch="$define"
7025	: determine where vendor-supplied architecture-dependent libraries go.
7026	: vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7027	: vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7028	: vendorlib may have an optional trailing /share.
7029	case "$vendorarch" in
7030	'')	dflt=`echo $vendorlib | $sed 's,/share$,,'`
7031		dflt="$dflt/$archname"
7032		;;
7033	*)	dflt="$vendorarch" ;;
7034	esac
7035	fn=d~+
7036	rp='Pathname for vendor-supplied architecture-dependent files?'
7037	. ./getfile
7038	vendorarch="$ans"
7039	vendorarchexp="$ansexp"
7040	;;
7041esac
7042prefixvar=vendorarch
7043. ./installprefix
7044if $test X"$vendorarch" = X"$vendorlib"; then
7045	d_vendorarch="$undef"
7046else
7047	d_vendorarch="$define"
7048fi
7049
7050: Final catch-all directories to search
7051$cat <<EOM
7052
7053Lastly, you can have perl look in other directories for extensions and
7054modules in addition to those already specified.
7055These directories will be searched after
7056	$sitearch
7057	$sitelib
7058EOM
7059test X"$vendorlib" != "X" && echo '	' $vendorlib
7060test X"$vendorarch" != "X" && echo '	' $vendorarch
7061echo ' '
7062case "$otherlibdirs" in
7063''|' ') dflt='none' ;;
7064*)	dflt="$otherlibdirs" ;;
7065esac
7066$cat <<EOM
7067Enter a colon-separated set of extra paths to include in perl's @INC
7068search path, or enter 'none' for no extra paths.
7069
7070EOM
7071
7072rp='Colon-separated list of additional directories for perl to search?'
7073. ./myread
7074case "$ans" in
7075' '|''|none)	otherlibdirs=' ' ;;
7076*)	otherlibdirs="$ans" ;;
7077esac
7078case "$otherlibdirs" in
7079' ') val=$undef ;;
7080*)	val=$define ;;
7081esac
7082set d_perl_otherlibdirs
7083eval $setvar
7084
7085: Cruising for prototypes
7086echo " "
7087echo "Checking out function prototypes..." >&4
7088$cat >prototype.c <<EOCP
7089#$i_stdlib I_STDLIB
7090#ifdef I_STDLIB
7091#include <stdlib.h>
7092#endif
7093int main(int argc, char *argv[]) {
7094	exit(0);}
7095EOCP
7096if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7097	echo "Your C compiler appears to support function prototypes."
7098	val="$define"
7099else
7100	echo "Your C compiler doesn't seem to understand function prototypes."
7101	val="$undef"
7102fi
7103set prototype
7104eval $setvar
7105$rm -f prototype*
7106
7107: Check if ansi2knr is required
7108case "$prototype" in
7109"$define") ;;
7110*)	ansi2knr='ansi2knr'
7111	echo " "
7112	cat <<EOM >&4
7113
7114$me:  FATAL ERROR:
7115This version of $package can only be compiled by a compiler that 
7116understands function prototypes.  Unfortunately, your C compiler 
7117	$cc $ccflags
7118doesn't seem to understand them.  Sorry about that.
7119
7120If GNU cc is available for your system, perhaps you could try that instead.  
7121
7122Eventually, we hope to support building Perl with pre-ANSI compilers.
7123If you would like to help in that effort, please contact <perlbug@perl.org>.
7124
7125Aborting Configure now.
7126EOM
7127	exit 2
7128	;;
7129esac
7130
7131: DTrace support
7132dflt_dtrace='/usr/sbin/dtrace'
7133$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7134
7135cat <<EOM
7136
7137Perl can be built to support DTrace on platforms that support it.
7138DTrace is a diagnosis and performance analysis tool from Sun.
7139
7140If this doesn't make any sense to you, just accept the default '$dflt'.
7141EOM
7142
7143while $test 1 ; do
7144	case "$usedtrace" in
7145	$define|true|[yY]*)
7146		dflt='y'
7147		;;
7148	?*)
7149		dflt='y'
7150		dflt_dtrace=$usedtrace
7151		;;
7152	*)
7153		dflt='n'
7154		;;
7155	esac
7156
7157	rp='Support DTrace if available?'
7158	. ./myread
7159	case "$ans" in
7160	y|Y)	val="$define" ;;
7161	*)      val="$undef" ;;
7162	esac
7163	set usedtrace
7164	eval $setvar
7165
7166	test "X$usedtrace" != "X$define" && break
7167
7168	echo " "
7169	rp='Where is the dtrace executable?'
7170	dflt=$dflt_dtrace
7171	. ./getfile
7172	val="$ans"
7173	set dtrace
7174	eval $setvar
7175
7176	if $test -f $dtrace
7177	then
7178		if $dtrace -h -s ../perldtrace.d \
7179			-o perldtrace.tmp >/dev/null 2>&1 \
7180			&& rm -f perldtrace.tmp
7181		then
7182			echo " "
7183			echo "Good: your $dtrace knows about the -h flag."
7184		else
7185			cat >&2 <<EOM
7186
7187*** $me:  Fatal Error:  $dtrace doesn't support -h flag
7188***
7189*** Your installed dtrace doesn't support the -h switch to compile a D
7190*** program into a C header. Can't continue.
7191
7192EOM
7193			exit 1
7194		fi
7195		break;
7196	fi
7197
7198	case "$fastread" in
7199	yes)
7200		cat >&2 <<EOM
7201
7202*** $me:  Fatal Error:  $dtrace not found.
7203*** Can't continue.
7204
7205EOM
7206		exit 1
7207		;;
7208	*)
7209		echo "*** $dtrace was not found."
7210		echo " "
7211		;;
7212	esac
7213done
7214
7215: See if we want extra modules installed
7216echo " "
7217case "$extras" in
7218'') dflt='n';;
7219*) dflt='y';;
7220esac
7221cat <<EOM
7222Perl can be built with extra modules or bundles of modules which
7223will be fetched from the CPAN and installed alongside Perl.
7224
7225Notice that you will need access to the CPAN; either via the Internet,
7226or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7227be asked later to configure the CPAN.pm module which will in turn do
7228the installation of the rest of the extra modules or bundles.)
7229
7230Notice also that if the modules require any external software such as
7231libraries and headers (the libz library and the zlib.h header for the
7232Compress::Zlib module, for example) you MUST have any such software
7233already installed, this configuration process will NOT install such
7234things for you.
7235
7236If this doesn't make any sense to you, just accept the default '$dflt'.
7237EOM
7238rp='Install any extra modules (y or n)?'
7239. ./myread
7240case "$ans" in
7241y|Y)
7242	cat <<EOM
7243
7244Please list any extra modules or bundles to be installed from CPAN,
7245with spaces between the names.  The names can be in any format the
7246'install' command of CPAN.pm will understand.  (Answer 'none',
7247without the quotes, to install no extra modules or bundles.)
7248EOM
7249	rp='Extras?'
7250	dflt="$extras"
7251	. ./myread
7252	extras="$ans"
7253esac
7254case "$extras" in
7255''|'none')
7256	val=''
7257	$rm -f ../extras.lst
7258	;;
7259*)	echo "(Saving the list of extras for later...)"
7260	echo "$extras" > ../extras.lst
7261	val="'$extras'"
7262	;;
7263esac
7264set extras
7265eval $setvar
7266echo " "
7267
7268: determine where html pages for programs go
7269set html1dir html1dir none
7270eval $prefixit
7271$cat <<EOM
7272
7273If you wish to install html files for programs in $spackage, indicate
7274the appropriate directory here.  To skip installing html files,
7275answer "none".
7276EOM
7277case "$html1dir" in
7278''|none|$undef|' ') dflt=none ;;
7279*) dflt=$html1dir ;;
7280esac
7281fn=dn+~
7282rp="Directory for the main $spackage html pages?"
7283. ./getfile
7284prefixvar=html1dir
7285. ./setprefixvar
7286: Use ' ' for none so value is preserved next time through Configure
7287$test X"$html1dir" = "X" && html1dir=' '
7288
7289: determine where html pages for libraries and modules go
7290set html3dir html3dir none
7291eval $prefixit
7292$cat <<EOM
7293
7294If you wish to install html files for modules associated with $spackage,
7295indicate the appropriate directory here.  To skip installing html files,
7296answer "none".
7297EOM
7298: There is no obvious default.  If they have specified html1dir, then
7299: try to key off that, possibly changing .../html1 into .../html3.
7300case "$html3dir" in
7301'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7302*) dflt=$html3dir ;;
7303esac
7304fn=dn+~
7305rp="Directory for the $spackage module html pages?"
7306. ./getfile
7307prefixvar=html3dir
7308. ./setprefixvar
7309: Use ' ' for none so value is preserved next time through Configure
7310$test X"$html3dir" = "X" && html3dir=' '
7311
7312: determine whether to install perl also as /usr/bin/perl
7313
7314echo " "
7315if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7316	$cat <<EOM
7317Many scripts expect perl to be installed as /usr/bin/perl.
7318
7319If you want to, I can install the perl you are about to compile
7320as /usr/bin/perl (in addition to $bin/perl).
7321EOM
7322	if test -f /usr/bin/perl; then
7323	    $cat <<EOM
7324
7325However, please note that because you already have a /usr/bin/perl,
7326overwriting that with a new Perl would very probably cause problems.
7327Therefore I'm assuming you don't want to do that (unless you insist).
7328
7329EOM
7330	    case "$installusrbinperl" in
7331	    "$define"|[yY]*)	dflt='y';;
7332	    *)			dflt='n';;
7333	    esac
7334	else
7335	    $cat <<EOM
7336
7337Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7338
7339EOM
7340	    case "$installusrbinperl" in
7341	    "$undef"|[nN]*)	dflt='n';;
7342	    *)			dflt='y';;
7343	    esac
7344	fi
7345	rp="Do you want to install perl as /usr/bin/perl?"
7346	. ./myread
7347	case "$ans" in
7348	[yY]*)	val="$define";;
7349	*)	val="$undef" ;;
7350	esac
7351else
7352	val="$undef"
7353fi
7354set installusrbinperl
7355eval $setvar
7356
7357: Check if we are using the GNU C library
7358echo " "
7359echo "Checking for GNU C Library..." >&4
7360cat >try.c <<'EOCP'
7361/* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7362   alone are insufficient to distinguish different versions, such as
7363   2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7364   libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7365*/
7366#include <stdio.h>
7367int main(void)
7368{
7369#ifdef __GLIBC__
7370#   ifdef __GLIBC_MINOR__
7371#       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7372#           include <gnu/libc-version.h>
7373	    printf("%s\n",  gnu_get_libc_version());
7374#       else
7375	    printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7376#       endif
7377#   else
7378	printf("%d\n",  __GLIBC__);
7379#   endif
7380    return 0;
7381#else
7382    return 1;
7383#endif
7384}
7385EOCP
7386set try
7387if eval $compile_ok && $run ./try > glibc.ver; then
7388	val="$define"
7389	gnulibc_version=`$cat glibc.ver`
7390	echo "You are using the GNU C Library version $gnulibc_version"
7391else
7392	val="$undef"
7393	gnulibc_version=''
7394	echo "You are not using the GNU C Library"
7395fi
7396$rm_try glibc.ver
7397set d_gnulibc
7398eval $setvar
7399
7400: see if nm is to be used to determine whether a symbol is defined or not
7401case "$usenm" in
7402'')
7403	dflt=''
7404	case "$d_gnulibc" in
7405	"$define")
7406		echo " "
7407		echo "nm probably won't work on the GNU C Library." >&4
7408		dflt=n
7409		;;
7410	esac
7411	case "$dflt" in
7412	'')
7413		if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7414			echo " "
7415			echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7416			echo "'nm' won't be sufficient on this system." >&4
7417			dflt=n
7418		fi
7419		;;
7420	esac
7421	case "$dflt" in
7422	'') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7423		if $test $dflt -gt 20; then
7424			dflt=y
7425		else
7426			dflt=n
7427		fi
7428		;;
7429	esac
7430	;;
7431*)
7432	case "$usenm" in
7433	true|$define) dflt=y;;
7434	*) dflt=n;;
7435	esac
7436	;;
7437esac
7438$cat <<EOM
7439
7440I can use $nm to extract the symbols from your C libraries. This
7441is a time consuming task which may generate huge output on the disk (up
7442to 3 megabytes) but that should make the symbols extraction faster. The
7443alternative is to skip the 'nm' extraction part and to compile a small
7444test program instead to determine whether each symbol is present. If
7445you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7446this may be the best solution.
7447
7448You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7449
7450EOM
7451rp="Shall I use $nm to extract C symbols from the libraries?"
7452. ./myread
7453case "$ans" in
7454[Nn]*) usenm=false;;
7455*) usenm=true;;
7456esac
7457
7458runnm=$usenm
7459case "$reuseval" in
7460true) runnm=false;;
7461esac
7462
7463: nm options which may be necessary
7464case "$nm_opt" in
7465'') if $test -f /mach_boot; then
7466		nm_opt=''	# Mach
7467	elif $test -d /usr/ccs/lib; then
7468		nm_opt='-p'	# Solaris (and SunOS?)
7469	elif $test -f /dgux; then
7470		nm_opt='-p'	# DG-UX
7471	elif $test -f /lib64/rld; then
7472		nm_opt='-p'	# 64-bit Irix
7473	else
7474		nm_opt=''
7475	fi;;
7476esac
7477
7478: nm options which may be necessary for shared libraries but illegal
7479: for archive libraries.  Thank you, Linux.
7480case "$nm_so_opt" in
7481'')	case "$myuname" in
7482	*linux*|gnu*)
7483		if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7484			nm_so_opt='--dynamic'
7485		fi
7486		;;
7487	esac
7488	;;
7489esac
7490
7491: Figure out where the libc is located
7492case "$runnm" in
7493true)
7494: get list of predefined functions in a handy place
7495echo " "
7496case "$libc" in
7497'') libc=unknown
7498	case "$libs" in
7499	*-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7500	esac
7501	;;
7502esac
7503case "$libs" in
7504'') ;;
7505*)  for thislib in $libs; do
7506	case "$thislib" in
7507	-lc|-lc_s)
7508		: Handle C library specially below.
7509		;;
7510	-l*)
7511		thislib=`echo $thislib | $sed -e 's/^-l//'`
7512		if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7513			:
7514		elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7515			:
7516		elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7517			:
7518		elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7519			:
7520		elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7521			:
7522		elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7523			:
7524		elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7525			:
7526		else
7527			try=''
7528		fi
7529		libnames="$libnames $try"
7530		;;
7531	*) libnames="$libnames $thislib" ;;
7532	esac
7533	done
7534	;;
7535esac
7536xxx=normal
7537case "$libc" in
7538unknown)
7539	set /lib/libc.$so
7540	for xxx in $libpth; do
7541		$test -r $1 || set $xxx/libc.$so
7542		: The messy sed command sorts on library version numbers.
7543		$test -r $1 || \
7544			set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7545			tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7546				h
7547				s/[0-9][0-9]*/0000&/g
7548				s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7549				G
7550				s/\n/ /' | \
7551			 $sort | $sed -e 's/^.* //'`
7552		eval set \$$#
7553	done
7554	$test -r $1 || set /usr/ccs/lib/libc.$so
7555	$test -r $1 || set /lib/libsys_s$_a
7556	;;
7557*)
7558	set blurfl
7559	;;
7560esac
7561if $test -r "$1"; then
7562	echo "Your (shared) C library seems to be in $1."
7563	libc="$1"
7564elif $test -r /lib/libc && $test -r /lib/clib; then
7565	echo "Your C library seems to be in both /lib/clib and /lib/libc."
7566	xxx=apollo
7567	libc='/lib/clib /lib/libc'
7568	if $test -r /lib/syslib; then
7569		echo "(Your math library is in /lib/syslib.)"
7570		libc="$libc /lib/syslib"
7571	fi
7572elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7573	echo "Your C library seems to be in $libc, as you said before."
7574elif $test -r $incpath/usr/lib/libc$_a; then
7575	libc=$incpath/usr/lib/libc$_a;
7576	echo "Your C library seems to be in $libc.  That's fine."
7577elif $test -r /lib/libc$_a; then
7578	libc=/lib/libc$_a;
7579	echo "Your C library seems to be in $libc.  You're normal."
7580else
7581	if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7582		:
7583	elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7584		libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7585	elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7586		:
7587	elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7588		:
7589	elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7590		:
7591	else
7592		tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7593	fi
7594	if $test -r "$tans"; then
7595		echo "Your C library seems to be in $tans, of all places."
7596		libc=$tans
7597	else
7598		libc='blurfl'
7599	fi
7600fi
7601if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7602	dflt="$libc"
7603	cat <<EOM
7604
7605If the guess above is wrong (which it might be if you're using a strange
7606compiler, or your machine supports multiple models), you can override it here.
7607
7608EOM
7609else
7610	dflt=''
7611	echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7612	cat >&4 <<EOM
7613I can't seem to find your C library.  I've looked in the following places:
7614
7615EOM
7616	$sed 's/^/	/' libpath
7617	cat <<EOM
7618
7619None of these seems to contain your C library. I need to get its name...
7620
7621EOM
7622fi
7623fn=f
7624rp='Where is your C library?'
7625. ./getfile
7626libc="$ans"
7627
7628echo " "
7629echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7630set X `cat libnames`
7631shift
7632xxx=files
7633case $# in 1) xxx=file; esac
7634echo "Extracting names from the following $xxx for later perusal:" >&4
7635echo " "
7636$sed 's/^/	/' libnames >&4
7637echo " "
7638$echo $n "This may take a while...$c" >&4
7639
7640for file in $*; do
7641	case $file in
7642	*$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7643	*) $nm $nm_opt $file 2>/dev/null;;
7644	esac
7645done >libc.tmp
7646
7647$echo $n ".$c"
7648$grep fprintf libc.tmp > libc.ptf
7649xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7650xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7651xxx='[ADTSIWi]'
7652if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7653	eval $xscan;\
7654	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655		eval $xrun
7656elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7657	eval $xscan;\
7658	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659		eval $xrun
7660elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7661	eval $xscan;\
7662	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663		eval $xrun
7664elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7665	eval $xscan;\
7666	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667		eval $xrun
7668elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7669	eval $xscan;\
7670	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671		eval $xrun
7672elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7673	eval $xscan;\
7674	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675		eval $xrun
7676elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7677				-e '/ file/d' -e 's/^\([^ 	]*\).*/\1/p'";\
7678	eval $xscan;\
7679	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680		eval $xrun
7681elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7682	eval $xscan;\
7683	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684		eval $xrun
7685elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7686	eval $xscan;\
7687	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688		eval $xrun
7689elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7690	eval $xscan;\
7691	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692		eval $xrun
7693elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7694	eval $xscan;\
7695	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696		eval $xrun
7697elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7698	eval $xscan;\
7699	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7700		eval $xrun
7701elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7702	eval $xscan;\
7703	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7704		eval $xrun
7705elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7706	eval $xscan;\
7707	$contains '^fprintf$' libc.list >/dev/null 2>&1; then
7708		eval $xrun
7709else
7710	$nm -p $* 2>/dev/null >libc.tmp
7711	$grep fprintf libc.tmp > libc.ptf
7712	if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7713		eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7714	then
7715		nm_opt='-p'
7716		eval $xrun
7717	else
7718		echo " "
7719		echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7720		com=''
7721		if $ar t $libc > libc.tmp && \
7722			$contains '^fprintf$' libc.tmp >/dev/null 2>&1
7723		then
7724			for thisname in $libnames $libc; do
7725				$ar t $thisname >>libc.tmp
7726			done
7727			$sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7728			echo "Ok." >&4
7729		elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7730			for thisname in $libnames $libc; do
7731				$ar tv $thisname >>libc.tmp
7732				emximp -o tmp.imp $thisname \
7733				    2>/dev/null && \
7734				    $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7735				    < tmp.imp >>libc.tmp
7736				$rm -f tmp.imp
7737			done
7738			$sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7739			echo "Ok." >&4
7740		else
7741			echo "$ar didn't seem to work right." >&4
7742			echo "Maybe this is a Cray...trying bld instead..." >&4
7743			if  bld t $libc | \
7744				$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7745				$test -s libc.list
7746			then
7747				for thisname in $libnames; do
7748					bld t $libnames | \
7749					$sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7750					$ar t $thisname >>libc.tmp
7751				done
7752				echo "Ok." >&4
7753			else
7754				echo "That didn't work either.  Giving up." >&4
7755				exit 1
7756			fi
7757		fi
7758	fi
7759fi
7760nm_extract="$com"
7761case "$PASE" in
7762define)
7763    echo " "
7764    echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7765    dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7766    ;;
7767*)  if $test -f /lib/syscalls.exp; then
7768	echo " "
7769	echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7770	$sed -n 's/^\([^ 	]*\)[ 	]*syscall[0-9]*[ 	]*$/\1/p' \
7771		/lib/syscalls.exp >>libc.list
7772    fi
7773    ;;
7774esac
7775;;
7776esac
7777$rm -f libnames libpath
7778
7779: see if dld is available
7780set dld.h i_dld
7781eval $inhdr
7782
7783: Check if we are using C++
7784echo " "
7785echo "Checking for C++..." >&4
7786$cat >try.c <<'EOCP'
7787#include <stdio.h>
7788int main(void)
7789{
7790#ifdef __cplusplus
7791    return 0;
7792#else
7793    return 1;
7794#endif
7795}
7796EOCP
7797set try
7798if eval $compile_ok && $run ./try; then
7799	val="$define"
7800	echo "You are using a C++ compiler."
7801else
7802	val="$undef"
7803	echo "You are not using a C++ compiler."
7804fi
7805$rm_try cplusplus$$
7806set d_cplusplus
7807eval $setvar
7808
7809: is a C symbol defined?
7810csym='tlook=$1;
7811case "$3" in
7812-v) tf=libc.tmp; tdc="";;
7813-a) tf=libc.tmp; tdc="[]";;
7814*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7815esac;
7816case "$d_cplusplus" in
7817    $define)	extern_C="extern \"C\""	;;
7818    *)		extern_C="extern"	;;
7819esac;
7820tx=yes;
7821case "$reuseval-$4" in
7822true-) ;;
7823true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7824esac;
7825case "$tx" in
7826yes)
7827	tval=false;
7828	if $test "$runnm" = true; then
7829		if $contains $tlook $tf >/dev/null 2>&1; then
7830			tval=true;
7831		elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7832			echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7833			$cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7834			$test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7835			$rm_try;
7836		fi;
7837	else
7838		echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7839		$cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7840		$rm_try;
7841	fi;
7842	;;
7843*)
7844	case "$tval" in
7845	$define) tval=true;;
7846	*) tval=false;;
7847	esac;
7848	;;
7849esac;
7850eval "$2=$tval"'
7851
7852: define an is-in-libc? function
7853inlibc='echo " "; td=$define; tu=$undef;
7854sym=$1; var=$2; eval "was=\$$2";
7855tx=yes;
7856case "$reuseval$was" in
7857true) ;;
7858true*) tx=no;;
7859esac;
7860case "$tx" in
7861yes)
7862	set $sym tres -f;
7863	eval $csym;
7864	case "$tres" in
7865	true)
7866		echo "$sym() found." >&4;
7867		case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7868	*)
7869		echo "$sym() NOT found." >&4;
7870		case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7871	esac;;
7872*)
7873	case "$was" in
7874	$define) echo "$sym() found." >&4;;
7875	*) echo "$sym() NOT found." >&4;;
7876	esac;;
7877esac'
7878
7879: see if dlopen exists
7880xxx_runnm="$runnm"
7881xxx_ccflags="$ccflags"
7882runnm=false
7883: with g++ one needs -shared to get is-in-libc to work for dlopen
7884case "$gccversion" in
7885'')	;;
7886*)	case "$d_cplusplus" in
7887	"$define") ccflags="$ccflags -shared" ;;
7888	esac
7889	;;
7890esac
7891set dlopen d_dlopen
7892eval $inlibc
7893runnm="$xxx_runnm"
7894ccflags="$xxx_ccflags"
7895
7896: see if this is a unistd.h system
7897set unistd.h i_unistd
7898eval $inhdr
7899
7900: determine which dynamic loading, if any, to compile in
7901echo " "
7902dldir="ext/DynaLoader"
7903case "$usedl" in
7904$define|y|true)
7905	dflt='y'
7906	usedl="$define"
7907	;;
7908$undef|n|false)
7909	dflt='n'
7910	usedl="$undef"
7911	;;
7912*)
7913	dflt='n'
7914	case "$d_dlopen" in
7915	    $define) dflt='y' ;;
7916	esac
7917	case "$i_dld" in
7918	    $define) dflt='y' ;;
7919	esac
7920	: Does a dl_xxx.xs file exist for this operating system
7921	$test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7922	;;
7923esac
7924rp="Do you wish to use dynamic loading?"
7925. ./myread
7926usedl="$ans"
7927bin_ELF="$undef"
7928case "$ans" in
7929y*) usedl="$define"
7930	case "$dlsrc" in
7931	'')
7932		if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7933			dflt="$dldir/dl_${osname}.xs"
7934		elif $test "$d_dlopen" = "$define" ; then
7935			dflt="$dldir/dl_dlopen.xs"
7936		elif $test "$i_dld" = "$define" ; then
7937			dflt="$dldir/dl_dld.xs"
7938		else
7939			dflt=''
7940		fi
7941		;;
7942	*)	dflt="$dldir/$dlsrc"
7943		;;
7944	esac
7945    echo "The following dynamic loading files are available:"
7946	: Can not go over to $dldir because getfile has path hard-coded in.
7947	tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7948	rp="Source file to use for dynamic loading"
7949	fn="fne"
7950	gfpth="$src"
7951	. ./getfile
7952	usedl="$define"
7953	: emulate basename
7954	dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7955
7956	$cat << EOM
7957
7958Some systems may require passing special flags to $cc -c to
7959compile modules that will be used to create a shared library.
7960To use no flags, say "none".
7961
7962EOM
7963    case "$cccdlflags" in
7964    '')	case "$gccversion" in
7965		'') case "$osname" in
7966			hpux)	dflt='+z' ;;
7967			next)	dflt='none' ;;
7968			irix*)	dflt='-KPIC' ;;
7969			svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7970			sunos)	dflt='-pic' ;;
7971			*)	dflt='none' ;;
7972		    esac
7973			;;
7974		*)  case "$osname" in
7975	                darwin) dflt='none' ;;
7976			linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7977			*)	dflt='-fpic' ;;
7978		    esac ;;
7979	    esac ;;
7980	' ') dflt='none' ;;
7981    *)	dflt="$cccdlflags" ;;
7982    esac
7983    rp="Any special flags to pass to $cc -c to compile shared library modules?"
7984    . ./myread
7985    case "$ans" in
7986    none) cccdlflags=' ' ;;
7987    *) cccdlflags="$ans" ;;
7988    esac
7989
7990    cat << EOM
7991
7992Some systems use ld to create libraries that can be dynamically loaded,
7993while other systems (such as those using ELF) use $cc.
7994
7995EOM
7996
7997: Determine if this is ELF
7998	$cat >try.c <<EOM
7999/* Test for whether ELF binaries are produced */
8000#include <fcntl.h>
8001#$i_stdlib I_STDLIB
8002#ifdef I_STDLIB
8003#include <stdlib.h>
8004#endif
8005#$i_unistd I_UNISTD
8006#ifdef I_UNISTD
8007#include <unistd.h>
8008#endif
8009int main() {
8010	char b[4];
8011	int i = open("a.out",O_RDONLY);
8012	if(i == -1)
8013		exit(1); /* fail */
8014	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8015		exit(0); /* succeed (yes, it is ELF) */
8016	else
8017		exit(1); /* fail */
8018}
8019EOM
8020	if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8021		bin_ELF="$define"
8022	fi
8023	$rm_try
8024
8025	case "$ld" in
8026	'')	if $test $bin_ELF = "$define"; then
8027			cat <<EOM
8028You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8029EOM
8030			dflt="$cc"
8031		else
8032			echo "I'll use ld to build dynamic libraries."
8033			dflt='ld'
8034		fi
8035		;;
8036	*)	dflt="$ld"
8037		;;
8038	esac
8039
8040    rp="What command should be used to create dynamic libraries?"
8041    . ./myread
8042	ld="$ans"
8043
8044    cat << EOM
8045
8046Some systems may require passing special flags to $ld to create a
8047library that can be dynamically loaded.  If your ld flags include
8048-L/other/path options to locate libraries outside your loader's normal
8049search path, you may need to specify those -L options here as well.  To
8050use no flags, say "none".
8051
8052EOM
8053    case "$lddlflags" in
8054    '') case "$osname" in
8055  			haiku) dflt='-shared' ;;
8056			hpux) dflt='-b';
8057			      case "$gccversion" in
8058			      '') dflt="$dflt +vnocompatwarnings" ;;
8059			      esac
8060			      ;;
8061			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8062			next)  dflt='none' ;;
8063			solaris) # See [perl #66604].  On Solaris 11, gcc -m64 on amd64
8064				# appears not to understand -G.  gcc versions at
8065				# least as old as 3.4.3 support -shared, so just
8066				# use that with Solaris 11 and later, but keep
8067				# the old behavior for older Solaris versions.
8068				case "$gccversion" in
8069					'') dflt='-G' ;;
8070					*)	case "$osvers" in
8071							2.?|2.10) dflt='-G' ;;
8072							*) dflt='-shared' ;;
8073						esac
8074						;;
8075				esac
8076				;;
8077			sunos) dflt='-assert nodefinitions' ;;
8078			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8079	        *)     dflt='none' ;;
8080			esac
8081			;;
8082    *) dflt="$lddlflags" ;;
8083    esac
8084
8085	: Try to guess additional flags to pick up local libraries.
8086	: Be careful not to append to a plain 'none'
8087	case "$dflt" in
8088	none) dflt='' ;;
8089	esac
8090	for thisflag in $ldflags; do
8091		case "$thisflag" in
8092		-L*|-R*|-Wl,-R*)
8093			case " $dflt " in
8094			*" $thisflag "*) ;;
8095			*) dflt="$dflt $thisflag" ;;
8096			esac
8097			;;
8098		esac
8099	done
8100
8101	case "$dflt" in
8102	''|' ') dflt='none' ;;
8103	esac
8104
8105	case "$ldflags" in
8106	*-fstack-protector*)
8107	    case "$dflt" in
8108			*-fstack-protector*) ;; # Don't add it again
8109			*) dflt="$dflt -fstack-protector" ;;
8110		esac
8111		;;
8112	esac
8113
8114
8115    rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8116    . ./myread
8117    case "$ans" in
8118    none) lddlflags=' ' ;;
8119    *) lddlflags="$ans" ;;
8120    esac
8121
8122	cat <<EOM
8123
8124Some systems may require passing special flags to $cc to indicate that
8125the resulting executable will use dynamic linking.  To use no flags,
8126say "none".
8127
8128EOM
8129    case "$ccdlflags" in
8130    '') case "$osname" in
8131	    linux|hpux|gnu*)	dflt='-Wl,-E' ;;
8132	    next|sunos)	dflt='none' ;;
8133	    *)		dflt='none' ;;
8134	    esac ;;
8135    ' ')  dflt='none' ;;
8136    *)  dflt="$ccdlflags" ;;
8137    esac
8138    rp="Any special flags to pass to $cc to use dynamic linking?"
8139    . ./myread
8140    case "$ans" in
8141    none) ccdlflags=' ' ;;
8142    *) ccdlflags="$ans" ;;
8143    esac
8144    ;;
8145*)  usedl="$undef"
8146	ld='ld'
8147    dlsrc='dl_none.xs'
8148    lddlflags=''
8149    ccdlflags=''
8150    ;;
8151esac
8152
8153ld_can_script="$undef"
8154case "$bin_ELF$usedl" in
8155$define$define)
8156    # Abuse try.h and a.out names for neat cleanup
8157    $cat >try.c <<EOM
8158void foo() {}
8159void bar() {}
8160EOM
8161    $cat >try.h <<EOM
8162LIBTEST_42 {
8163 global:
8164  foo;
8165 local: *;
8166 };
8167EOM
8168    if $cc $cccdlflags $ccdlflags $ccflags \
8169           $ldflags $lddlflags -o a.out try.c \
8170           -Wl,--version-script=try.h >/dev/null 2>&1 \
8171       &&  $test -s a.out ; then
8172	echo "ld supports scripting" >&4
8173	ld_can_script="$define"
8174    else
8175	echo "ld does not support scripting" >&4
8176    fi
8177    $rm_try
8178    ;;
8179esac
8180
8181: Do we want a shared libperl?
8182also=''
8183case "$usedl" in
8184$undef)
8185	# No dynamic loading being used, so don't bother even to prompt.
8186	useshrplib='false'
8187	;;
8188*)	case "$useshrplib" in
8189	'')	case "$osname" in
8190		svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8191			dflt=y
8192			also='Building a shared libperl is required for dynamic loading to work on your system.'
8193			;;
8194		next*)
8195			case "$osvers" in
8196			4*)	dflt=y
8197				also='Building a shared libperl is needed for MAB support.'
8198				;;
8199			*)	dflt=n
8200				;;
8201			esac
8202			;;
8203		*)	dflt=n
8204			;;
8205		esac
8206		;;
8207	$define|true|[Yy]*)
8208		dflt=y
8209		;;
8210	*)	dflt=n
8211		;;
8212	esac
8213	$cat << EOM
8214
8215The perl executable is normally obtained by linking perlmain.c with
8216libperl${_a}, any static extensions (usually just DynaLoader), and
8217any other libraries needed on this system (such as -lm, etc.).  Since
8218your system supports dynamic loading, it is probably possible to build
8219a shared libperl.$so.  If you will have more than one executable linked
8220to libperl.$so, this will significantly reduce the size of each
8221executable, but it may have a noticeable effect on performance.  The
8222default is probably sensible for your system.
8223$also
8224
8225EOM
8226	rp="Build a shared libperl.$so (y/n)"
8227	. ./myread
8228	case "$ans" in
8229	true|$define|[Yy]*)
8230		useshrplib='true'  ;;
8231	*)	useshrplib='false' ;;
8232	esac
8233	;;
8234esac
8235
8236case "$useshrplib" in
8237true)
8238	case "$userelocatableinc" in
8239	true|define)
8240		echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8241		echo "See INSTALL for an explanation why that won't work." >&4
8242		exit 4
8243		;;
8244	esac
8245	case "$libperl" in
8246	'')
8247		# Figure out a good name for libperl.so.  Since it gets stored in
8248		# a version-specific architecture-dependent library, the version
8249		# number isn't really that important, except for making cc/ld happy.
8250		#
8251		# A name such as libperl.so.10.1
8252		majmin="libperl.$so.$patchlevel.$subversion"
8253		# A name such as libperl.so.100
8254		majonly=`echo $patchlevel $subversion |
8255			$awk '{printf "%d%02d", $1, $2}'`
8256		majonly=libperl.$so.$majonly
8257		# I'd prefer to keep the os-specific stuff here to a minimum, and
8258		# rely on figuring it out from the naming of libc.
8259		case "${osname}${osvers}" in
8260		next4*)
8261			dflt=libperl.5.$so
8262			# XXX How handle the --version stuff for MAB?
8263			;;
8264		linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8265			dflt=libperl.$so
8266			;;
8267		cygwin*) # ld links now against the dll directly
8268			majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8269			majonly=`echo $patchlevel $subversion |
8270				$awk '{printf "%03d%03d", $1, $2}'`
8271			majonly=cygperl5.$majonly.$so
8272			dflt=$majmin
8273			;;
8274		*)	# Try to guess based on whether libc has major.minor.
8275			case "$libc" in
8276			*libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8277			*libc.$so.[0-9]*) dflt=$majonly ;;
8278			*)	dflt=libperl.$so ;;
8279			esac
8280			;;
8281		esac
8282		;;
8283	*)	dflt=$libperl
8284		;;
8285	esac
8286	cat << EOM
8287
8288I need to select a good name for the shared libperl.  If your system uses
8289library names with major and minor numbers, then you might want something
8290like $majmin.  Alternatively, if your system uses a single version
8291number for shared libraries, then you might want to use $majonly.
8292Or, your system might be quite happy with a simple libperl.$so.
8293
8294Since the shared libperl will get installed into a version-specific
8295architecture-dependent directory, the version number of the shared perl
8296library probably isn't important, so the default should be o.k.
8297
8298EOM
8299	rp='What name do you want to give to the shared libperl?'
8300	. ./myread
8301	libperl=$ans
8302	echo "Ok, I'll use $libperl"
8303	;;
8304*)
8305	libperl="libperl${_a}"
8306	;;
8307esac
8308
8309# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8310case "$shrpdir" in
8311'') ;;
8312*)	$cat >&4 <<EOM
8313WARNING:  Use of the shrpdir variable for the installation location of
8314the shared $libperl is not supported.  It was never documented and
8315will not work in this version.  Let me (perlbug@perl.org)
8316know of any problems this may cause.
8317
8318EOM
8319	case "$shrpdir" in
8320	"$archlibexp/CORE")
8321		$cat >&4 <<EOM
8322But your current setting of $shrpdir is
8323the default anyway, so it's harmless.
8324EOM
8325		;;
8326	*)
8327		$cat >&4 <<EOM
8328Further, your current attempted setting of $shrpdir
8329conflicts with the value of $archlibexp/CORE
8330that installperl will use.
8331EOM
8332		;;
8333	esac
8334	;;
8335esac
8336
8337# How will the perl executable find the installed shared $libperl?
8338# Add $xxx to ccdlflags.
8339# If we can't figure out a command-line option, use $shrpenv to
8340# set env LD_RUN_PATH.  The main perl makefile uses this.
8341shrpdir=$archlibexp/CORE
8342xxx=''
8343tmp_shrpenv=''
8344if "$useshrplib"; then
8345    case "$osname" in
8346	aix)
8347		# We'll set it in Makefile.SH...
8348		;;
8349	solaris)
8350		xxx="-R $shrpdir"
8351		;;
8352	freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8353		xxx="-Wl,-R$shrpdir"
8354		;;
8355	bsdos|linux|irix*|dec_osf|gnu*)
8356		xxx="-Wl,-rpath,$shrpdir"
8357		;;
8358	next)
8359		# next doesn't like the default...
8360		;;
8361	haiku)
8362		# Haiku doesn't like the default, either.
8363		;;
8364	hpux*)
8365		# hpux doesn't like the default, either.
8366		tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8367		;;
8368	cygwin)
8369		# cygwin needs only ldlibpth
8370		;;
8371	*)
8372		tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8373		;;
8374	esac
8375	case "$xxx" in
8376	'') ;;
8377	*)
8378		# Only add $xxx if it isn't already in ccdlflags.
8379		case " $ccdlflags " in
8380		*" $xxx "*)	;;
8381		*)	ccdlflags="$ccdlflags $xxx"
8382			cat <<EOM >&4
8383
8384Adding $xxx to the flags
8385passed to $ld so that the perl executable will find the
8386installed shared $libperl.
8387
8388EOM
8389			;;
8390		esac
8391		;;
8392	esac
8393fi
8394# Fix ccdlflags in AIX for building external extensions.
8395# (For building Perl itself bare -bE:perl.exp is needed,
8396#  Makefile.SH takes care of this.)
8397case "$osname" in
8398aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8399esac
8400# Respect a hint or command-line value.
8401case "$shrpenv" in
8402'') shrpenv="$tmp_shrpenv" ;;
8403esac
8404case "$ldlibpthname" in
8405'')	ldlibpthname=LD_LIBRARY_PATH ;;
8406none)	ldlibpthname='' ;;
8407esac
8408
8409: determine where manual pages are on this system
8410echo " "
8411case "$sysman" in
8412'')
8413	syspath='/usr/share/man/man1 /usr/man/man1'
8414	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8415	syspath="$syspath /usr/man/u_man/man1"
8416	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8417	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8418	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8419	sysman=`./loc . /usr/man/man1 $syspath`
8420	;;
8421esac
8422if $test -d "$sysman"; then
8423	echo "System manual is in $sysman." >&4
8424else
8425	echo "Could not find manual pages in source form." >&4
8426fi
8427
8428: determine where manual pages go
8429set man1dir man1dir none
8430eval $prefixit
8431$cat <<EOM
8432
8433$spackage has manual pages available in source form.
8434EOM
8435case "$nroff" in
8436nroff)
8437	echo "However, you don't have nroff, so they're probably useless to you."
8438	case "$man1dir" in
8439	'') man1dir="none";;
8440	esac;;
8441esac
8442echo "If you don't want the manual sources installed, answer 'none'."
8443case "$man1dir" in
8444' ') dflt=none
8445	;;
8446'')
8447	lookpath="$prefixexp/share/man/man1"
8448	lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8449	lookpath="$lookpath $prefixexp/man/p_man/man1"
8450	lookpath="$lookpath $prefixexp/man/u_man/man1"
8451	lookpath="$lookpath $prefixexp/man/man.1"
8452	case "$sysman" in
8453	*/?_man*)	dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8454	*)	dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8455	esac
8456	set dflt
8457	eval $prefixup
8458	;;
8459*)  dflt="$man1dir"
8460	;;
8461esac
8462echo " "
8463fn=dn+~
8464rp="Where do the main $spackage manual pages (source) go?"
8465. ./getfile
8466if $test "X$man1direxp" != "X$ansexp"; then
8467	installman1dir=''
8468fi
8469prefixvar=man1dir
8470. ./setprefixvar
8471
8472case "$man1dir" in
8473'')	man1dir=' '
8474	installman1dir='';;
8475esac
8476
8477: What suffix to use on installed man pages
8478
8479case "$man1dir" in
8480' ')
8481	man1ext='0'
8482	;;
8483*)
8484	rp="What suffix should be used for the main $spackage man pages?"
8485	case "$man1ext" in
8486	'')	case "$man1dir" in
8487		*1)  dflt=1 ;;
8488		*1p) dflt=1p ;;
8489		*1pm) dflt=1pm ;;
8490		*l) dflt=l;;
8491		*n) dflt=n;;
8492		*o) dflt=o;;
8493		*p) dflt=p;;
8494		*C) dflt=C;;
8495		*L) dflt=L;;
8496		*L1) dflt=L1;;
8497		*) dflt=1;;
8498		esac
8499		;;
8500	*)	dflt="$man1ext";;
8501	esac
8502	. ./myread
8503	man1ext="$ans"
8504	;;
8505esac
8506
8507: see if we can have long filenames
8508echo " "
8509first=123456789abcdef
8510$rm -f $first
8511if (echo hi >$first) 2>/dev/null; then
8512	if $test -f 123456789abcde; then
8513		echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8514		val="$undef"
8515	else
8516 		echo 'You can have filenames longer than 14 characters.'>&4
8517 		val="$define"
8518	fi
8519else
8520	$cat <<'EOM'
8521You can't have filenames longer than 14 chars.
8522You can't even think about them!
8523EOM
8524	val="$undef"
8525fi
8526set d_flexfnam
8527eval $setvar
8528$rm -rf 123456789abcde*
8529
8530: determine where library module manual pages go
8531set man3dir man3dir none
8532eval $prefixit
8533$cat <<EOM
8534
8535$spackage has manual pages for many of the library modules.
8536EOM
8537
8538case "$nroff" in
8539nroff)
8540	$cat <<'EOM'
8541However, you don't have nroff, so they're probably useless to you.
8542EOM
8543	case "$man3dir" in
8544	'') man3dir="none";;
8545	esac;;
8546esac
8547
8548case "$d_flexfnam" in
8549undef)
8550	$cat <<'EOM'
8551However, your system can't handle the long file names like File::Basename.3.
8552EOM
8553	case "$man3dir" in
8554	'') man3dir="none";;
8555	esac;;
8556esac
8557
8558echo "If you don't want the manual sources installed, answer 'none'."
8559prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8560case "$man3dir" in
8561'')	dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8562	if $test -d "$privlib/man/man3"; then
8563		cat <<EOM >&4
8564
8565WARNING:  Previous versions of perl installed man3 pages into
8566$privlib/man/man3.  This version will suggest a
8567new default of $dflt.
8568EOM
8569		tdflt=$dflt
8570		dflt='n'
8571		rp='Do you wish to preserve the old behavior?(y/n)'
8572		. ./myread
8573		case "$ans" in
8574		y*) dflt="$privlib/man/man3" ;;
8575		*)  dflt=$tdflt ;;
8576		esac
8577    fi
8578	;;
8579*)	dflt="$man3dir" ;;
8580esac
8581case "$dflt" in
8582' ') dflt=none ;;
8583esac
8584echo " "
8585fn=dn+~
8586rp="Where do the $package library man pages (source) go?"
8587. ./getfile
8588prefixvar=man3dir
8589. ./setprefixvar
8590
8591case "$man3dir" in
8592'')	man3dir=' '
8593	installman3dir='';;
8594esac
8595
8596: What suffix to use on installed man pages
8597case "$man3dir" in
8598' ')
8599	man3ext='0'
8600	;;
8601*)
8602	rp="What suffix should be used for the $package library man pages?"
8603	case "$man3ext" in
8604	'')	case "$man3dir" in
8605		*3)  dflt=3 ;;
8606		*3p) dflt=3p ;;
8607		*3pm) dflt=3pm ;;
8608		*l) dflt=l;;
8609		*n) dflt=n;;
8610		*o) dflt=o;;
8611		*p) dflt=p;;
8612		*C) dflt=C;;
8613		*L) dflt=L;;
8614		*L3) dflt=L3;;
8615		*) dflt=3;;
8616		esac
8617		;;
8618	*)	dflt="$man3ext";;
8619	esac
8620	. ./myread
8621	man3ext="$ans"
8622	;;
8623esac
8624
8625: see if we have to deal with yellow pages, now NIS.
8626if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8627	if $test -f /usr/etc/nibindd; then
8628		echo " "
8629		echo "I'm fairly confident you're on a NeXT."
8630		echo " "
8631		rp='Do you get the hosts file via NetInfo?'
8632		dflt=y
8633		case "$hostcat" in
8634		nidump*) ;;
8635		'') ;;
8636		*) dflt=n;;
8637		esac
8638		. ./myread
8639		case "$ans" in
8640		y*) hostcat='nidump hosts .';;
8641		*)	case "$hostcat" in
8642			nidump*) hostcat='';;
8643			esac
8644			;;
8645		esac
8646	fi
8647	case "$hostcat" in
8648	nidump*) ;;
8649	*)
8650		case "$hostcat" in
8651		*ypcat*) dflt=y;;
8652		'') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8653				dflt=y
8654			else
8655				dflt=n
8656			fi;;
8657		*) dflt=n;;
8658		esac
8659		echo " "
8660		rp='Are you getting the hosts file via yellow pages?'
8661		. ./myread
8662		case "$ans" in
8663		y*) hostcat='ypcat hosts';;
8664		*) hostcat='cat /etc/hosts';;
8665		esac
8666		;;
8667	esac
8668fi
8669case "$hostcat" in
8670'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8671esac
8672case "$groupcat" in
8673'') test -f /etc/group && groupcat='cat /etc/group';;
8674esac
8675case "$passcat" in
8676'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8677esac
8678
8679: now get the host name
8680echo " "
8681echo "Figuring out host name..." >&4
8682case "$myhostname" in
8683'') cont=true
8684	echo 'Maybe "hostname" will work...'
8685	if tans=`sh -c hostname 2>&1` ; then
8686		myhostname=$tans
8687		phostname=hostname
8688		cont=''
8689	fi
8690	;;
8691*) cont='';;
8692esac
8693if $test "$cont"; then
8694	if ./xenix; then
8695		echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8696		if tans=`cat /etc/systemid 2>&1` ; then
8697			myhostname=$tans
8698			phostname='cat /etc/systemid'
8699			echo "Whadyaknow.  Xenix always was a bit strange..."
8700			cont=''
8701		fi
8702	elif $test -r /etc/systemid; then
8703		echo "(What is a non-Xenix system doing with /etc/systemid?)"
8704	fi
8705fi
8706if $test "$cont"; then
8707	echo 'No, maybe "uuname -l" will work...'
8708	if tans=`sh -c 'uuname -l' 2>&1` ; then
8709		myhostname=$tans
8710		phostname='uuname -l'
8711	else
8712		echo 'Strange.  Maybe "uname -n" will work...'
8713		if tans=`sh -c 'uname -n' 2>&1` ; then
8714			myhostname=$tans
8715			phostname='uname -n'
8716		else
8717			echo 'Oh well, maybe I can mine it out of whoami.h...'
8718			if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8719				myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8720				phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8721			else
8722				case "$myhostname" in
8723				'') echo "Does this machine have an identity crisis or something?"
8724					phostname='';;
8725				*)
8726					echo "Well, you said $myhostname before..."
8727					phostname='echo $myhostname';;
8728				esac
8729			fi
8730		fi
8731	fi
8732fi
8733case "$myhostname" in
8734'') myhostname=noname ;;
8735esac
8736: you do not want to know about this
8737set $myhostname
8738myhostname=$1
8739
8740: verify guess
8741if $test "$myhostname" ; then
8742	dflt=y
8743	rp='Your host name appears to be "'$myhostname'".'" Right?"
8744	. ./myread
8745	case "$ans" in
8746	y*) ;;
8747	*) myhostname='';;
8748	esac
8749fi
8750
8751: bad guess or no guess
8752while $test "X$myhostname" = X ; do
8753	dflt=''
8754	rp="Please type the (one word) name of your host:"
8755	. ./myread
8756	myhostname="$ans"
8757done
8758
8759: translate upper to lower if necessary
8760case "$myhostname" in
8761*[A-Z]*)
8762	echo "(Normalizing case in your host name)"
8763	myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8764	;;
8765esac
8766
8767case "$myhostname" in
8768*.*)
8769	dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8770	myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8771	echo "(Trimming domain name from host name--host name is now $myhostname)"
8772	;;
8773*) case "$mydomain" in
8774	'')
8775		{
8776			test "X$hostcat" = "Xypcat hosts" &&
8777			ypmatch "$myhostname" hosts 2>/dev/null |\
8778				$sed -e 's/[	 ]*#.*//; s/$/ /' > hosts && \
8779			$test -s hosts
8780		} || {
8781			test "X$hostcat" != "X" &&
8782		     	$hostcat | $sed -n -e "s/[	 ]*#.*//; s/\$/ /
8783					/[	 ]$myhostname[	. ]/p" > hosts
8784		}
8785		tmp_re="[	. ]"
8786		if $test -f hosts; then
8787			$test x`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ { sum++ }
8788			     END { print sum }" hosts` = x1 || tmp_re="[	 ]"
8789			dflt=.`$awk "/[0-9].*[	 ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8790				hosts | $sort | $uniq | \
8791				$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8792			case `$echo X$dflt` in
8793			X*\ *)	echo "(Several hosts in the database matched hostname)"
8794				dflt=.
8795				;;
8796			X.) echo "(You do not have fully-qualified names in the hosts database)"
8797				;;
8798			esac
8799		else
8800			echo "(I cannot locate a hosts database anywhere)"
8801			dflt=.
8802		fi
8803		case "$dflt" in
8804		.)
8805			tans=`./loc resolv.conf X /etc /usr/etc`
8806			if $test -f "$tans"; then
8807				echo "(Attempting domain name extraction from $tans)"
8808				dflt=.`$sed -n -e 's/	/ /g' \
8809				  -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8810				  -e 1q 2>/dev/null`
8811				case "$dflt" in
8812				.) dflt=.`$sed -n -e 's/	/ /g' \
8813				     -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8814				     -e 1q 2>/dev/null`
8815  					;;
8816				esac
8817			fi
8818			;;
8819		esac
8820		case "$dflt" in
8821		.) echo "(No help from resolv.conf either -- attempting clever guess)"
8822			dflt=.`sh -c domainname 2>/dev/null`
8823			case "$dflt" in
8824			'') dflt='.';;
8825			.nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8826			esac
8827			;;
8828		esac
8829		case "$dflt$osname" in
8830		.os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8831			dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8832			;;
8833		esac
8834		case "$dflt" in
8835		.) echo "(Lost all hope -- silly guess then)"
8836			dflt='.nonet'
8837			;;
8838		esac
8839		$rm -f hosts
8840		;;
8841	*) dflt="$mydomain";;
8842	esac;;
8843esac
8844echo " "
8845rp="What is your domain name?"
8846. ./myread
8847tans="$ans"
8848case "$ans" in
8849'') ;;
8850.*) ;;
8851*) tans=".$tans";;
8852esac
8853mydomain="$tans"
8854
8855: translate upper to lower if necessary
8856case "$mydomain" in
8857*[A-Z]*)
8858	echo "(Normalizing case in your domain name)"
8859	mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8860	;;
8861esac
8862
8863: a little sanity check here
8864case "$phostname" in
8865'') ;;
8866*)
8867	case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8868	$myhostname$mydomain|$myhostname) ;;
8869	*)
8870		case "$phostname" in
8871		sed*)
8872			echo "(That doesn't agree with your whoami.h file, by the way.)"
8873			;;
8874		*)
8875			echo "(That doesn't agree with your $phostname command, by the way.)"
8876			;;
8877		esac
8878	;;
8879	esac
8880	;;
8881esac
8882
8883: determine the e-mail address of the user who is running us
8884$cat <<EOM
8885
8886I need to get your e-mail address in Internet format if possible, i.e.
8887something like user@host.domain. Please answer accurately since I have
8888no easy means to double check it. The default value provided below
8889is most probably close to reality but may not be valid from outside
8890your organization...
8891
8892EOM
8893cont=x
8894while test "$cont"; do
8895	case "$MAILDOMAIN" in
8896	'')
8897		if $test -s /etc/mailname; then
8898			maildomain=`$cat /etc/mailname`
8899		else
8900			maildomain="$myhostname$mydomain"
8901		fi
8902		;;
8903	*)  maildomain="$MAILDOMAIN";;
8904	esac
8905	case "$cf_email" in
8906	'') dflt="$cf_by@$maildomain";;
8907	*)  dflt="$cf_email";;
8908	esac
8909	rp='What is your e-mail address?'
8910	. ./myread
8911	cf_email="$ans"
8912	case "$cf_email" in
8913	*@*.*) cont='' ;;
8914	*)
8915		rp='Address does not look like an Internet one.  Use it anyway?'
8916		case "$fastread" in
8917		yes) dflt=y ;;
8918		*) dflt=n ;;
8919		esac
8920		. ./myread
8921		case "$ans" in
8922		y*) cont='' ;;
8923		*) echo " " ;;
8924		esac
8925		;;
8926	esac
8927done
8928
8929: Ask e-mail of administrator
8930$cat <<EOM
8931
8932If you or somebody else will be maintaining perl at your site, please
8933fill in the correct e-mail address here so that they may be contacted
8934if necessary. Currently, the "perlbug" program included with perl
8935will send mail to this address in addition to perlbug@perl.org. You may
8936enter "none" for no administrator.
8937
8938EOM
8939case "$perladmin" in
8940'') dflt="$cf_email";;
8941*) dflt="$perladmin";;
8942esac
8943rp='Perl administrator e-mail address'
8944. ./myread
8945perladmin="$ans"
8946
8947: determine whether to only install version-specific parts.
8948echo " "
8949$cat <<EOM
8950Do you want to install only the version-specific parts of the perl
8951distribution?  Usually you do *not* want to do this.
8952EOM
8953case "$versiononly" in
8954"$define"|[Yy]*|true) dflt='y' ;;
8955*) dflt='n';
8956esac
8957rp="Do you want to install only the version-specific parts of perl?"
8958. ./myread
8959case "$ans" in
8960[yY]*)	val="$define";;
8961*)	val="$undef" ;;
8962esac
8963set versiononly
8964eval $setvar
8965
8966case "$versiononly" in
8967"$define") inc_version_list=''
8968           inc_version_list_init=0
8969           ;;
8970esac
8971
8972: figure out how to guarantee perl startup
8973: XXX Note that this currently takes advantage of the bug that binexp ignores
8974:     the Configure -Dinstallprefix setting, which in turn means that under
8975:     relocatable @INC, initialinstalllocation is what binexp started as.
8976case "$startperl" in
8977'')
8978	case "$sharpbang" in
8979	*!)
8980		$cat <<EOH
8981
8982I can use the #! construct to start perl on your system. This will
8983make startup of perl scripts faster, but may cause problems if you
8984want to share those scripts and perl is not in a standard place
8985($initialinstalllocation/perl) on all your platforms. The alternative
8986is to force a shell by starting the script with a single ':' character.
8987
8988EOH
8989		case "$versiononly" in
8990		"$define")      dflt="$initialinstalllocation/perl$version";;
8991		*)              dflt="$initialinstalllocation/perl";;
8992		esac
8993		rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8994		. ./myread
8995		case "$ans" in
8996		none)	startperl=": # use perl";;
8997		*)	startperl="#!$ans"
8998			if $test 30 -lt `echo "$ans" | wc -c`; then
8999				$cat >&4 <<EOM
9000
9001WARNING:  Some systems limit the #! command to 32 characters.
9002If you experience difficulty running Perl scripts with #!, try
9003installing Perl in a directory with a shorter pathname.
9004
9005EOM
9006			fi ;;
9007		esac
9008		;;
9009	*) startperl=": # use perl"
9010		;;
9011	esac
9012	;;
9013esac
9014echo "I'll use $startperl to start perl scripts."
9015
9016: figure best path for perl in scripts
9017case "$perlpath" in
9018'')
9019	case "$versiononly" in
9020	"$define")	perlpath="$initialinstalllocation/perl$version";;
9021	*)		perlpath="$initialinstalllocation/perl";;
9022	esac
9023	case "$startperl" in
9024	*!*) ;;
9025	*)
9026		$cat <<EOH
9027
9028I will use the "eval 'exec'" idiom to start Perl on your system.
9029I can use the full path of your Perl binary for this purpose, but
9030doing so may cause problems if you want to share those scripts and
9031Perl is not always in a standard place ($initialinstalllocation/perl).
9032
9033EOH
9034		dflt="$initialinstalllocation/perl"
9035		rp="What path shall I use in \"eval 'exec'\"?"
9036		. ./myread
9037		perlpath="$ans"
9038		;;
9039	esac
9040	;;
9041esac
9042case "$startperl" in
9043*!*)	;;
9044*)	echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9045esac
9046
9047: determine where public executable scripts go
9048set scriptdir scriptdir
9049eval $prefixit
9050case "$scriptdir" in
9051'')
9052	dflt="$bin"
9053	: guess some guesses
9054	$test -d /usr/share/scripts && dflt=/usr/share/scripts
9055	$test -d /usr/share/bin     && dflt=/usr/share/bin
9056	$test -d /usr/local/script  && dflt=/usr/local/script
9057	$test -d /usr/local/scripts && dflt=/usr/local/scripts
9058	$test -d $prefixexp/script  && dflt=$prefixexp/script
9059	set dflt
9060	eval $prefixup
9061	;;
9062*)  dflt="$scriptdir"
9063	;;
9064esac
9065$cat <<EOM
9066
9067Some installations have a separate directory just for executable scripts so
9068that they can mount it across multiple architectures but keep the scripts in
9069one spot.  You might, for example, have a subdirectory of /usr/share for this.
9070Or you might just lump your scripts in with all your other executables.
9071
9072EOM
9073fn=d~
9074rp='Where do you keep publicly executable scripts?'
9075. ./getfile
9076if $test "X$ansexp" != "X$scriptdirexp"; then
9077	installscript=''
9078fi
9079installscriptdir=''
9080prefixvar=scriptdir
9081. ./setprefixvar
9082: A little fix up for an irregularly named variable.
9083installscript="$installscriptdir"
9084
9085: determine where add-on public executables go
9086case "$sitebin" in
9087'')	dflt=$siteprefix/bin ;;
9088*)	dflt=$sitebin ;;
9089esac
9090fn=d~
9091rp='Pathname where the add-on public executables should be installed?'
9092. ./getfile
9093prefixvar=sitebin
9094. ./setprefixvar
9095
9096: determine where add-on html pages go
9097: There is no standard location, so try to copy the previously-selected
9098: directory structure for the core html pages.
9099case "$sitehtml1dir" in
9100'')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9101*)     dflt=$sitehtml1dir ;;
9102esac
9103case "$dflt" in
9104''|' ') dflt=none ;;
9105esac
9106fn=dn+~
9107rp='Pathname where the site-specific html pages should be installed?'
9108. ./getfile
9109prefixvar=sitehtml1dir
9110. ./setprefixvar
9111
9112: determine where add-on library html pages go
9113: There is no standard location, so try to copy the previously-selected
9114: directory structure for the core html pages.
9115case "$sitehtml3dir" in
9116'')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9117*)     dflt=$sitehtml3dir ;;
9118esac
9119case "$dflt" in
9120''|' ') dflt=none ;;
9121esac
9122fn=dn+~
9123rp='Pathname where the site-specific library html pages should be installed?'
9124. ./getfile
9125prefixvar=sitehtml3dir
9126. ./setprefixvar
9127
9128: determine where add-on manual pages go
9129case "$siteman1dir" in
9130'')	dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9131*)	dflt=$siteman1dir ;;
9132esac
9133case "$dflt" in
9134''|' ') dflt=none ;;
9135esac
9136fn=dn+~
9137rp='Pathname where the site-specific manual pages should be installed?'
9138. ./getfile
9139prefixvar=siteman1dir
9140. ./setprefixvar
9141
9142: determine where add-on library man pages go
9143case "$siteman3dir" in
9144'')	dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9145*)	dflt=$siteman3dir ;;
9146esac
9147case "$dflt" in
9148''|' ') dflt=none ;;
9149esac
9150fn=dn+~
9151rp='Pathname where the site-specific library manual pages should be installed?'
9152. ./getfile
9153prefixvar=siteman3dir
9154. ./setprefixvar
9155
9156: determine where add-on public executable scripts go
9157case "$sitescript" in
9158'')	dflt=$siteprefix/script
9159	$test -d $dflt || dflt=$sitebin ;;
9160*)  dflt="$sitescript" ;;
9161esac
9162fn=d~+
9163rp='Pathname where add-on public executable scripts should be installed?'
9164. ./getfile
9165prefixvar=sitescript
9166. ./setprefixvar
9167
9168: Check if faststdio is requested and available
9169case "$usefaststdio" in
9170$define|true|[yY]*|'')
9171	xversion=`awk '/define[ 	]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9172	case "$xversion" in
9173	[68])	dflt='y' ;;
9174	*)	dflt='n' ;;
9175	esac
9176	;;
9177*) dflt='n';;
9178esac
9179cat <<EOM
9180
9181Perl can be built to use 'fast stdio', which means using the stdio
9182library but also directly manipulating the stdio buffers to enable
9183faster I/O.  Using stdio is better for backward compatibility (especially
9184for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9185interface has been preferred instead of stdio.
9186
9187If this doesn't make any sense to you, just accept the default '$dflt'.
9188EOM
9189rp='Use the "fast stdio" if available?'
9190. ./myread
9191case "$ans" in
9192y|Y)	val="$define" ;;
9193*)      val="$undef" ;;
9194esac
9195set usefaststdio
9196eval $setvar
9197
9198
9199: define an is-a-typedef? function
9200typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9201case "$inclist" in
9202"") inclist="sys/types.h";;
9203esac;
9204eval "varval=\$$var";
9205case "$varval" in
9206"")
9207	$rm -f temp.c;
9208	for inc in $inclist; do
9209		echo "#include <$inc>" >>temp.c;
9210	done;
9211	echo "#ifdef $type" >> temp.c;
9212	echo "printf(\"We have $type\");" >> temp.c;
9213	echo "#endif" >> temp.c;
9214	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9215	if $contains $type temp.E >/dev/null 2>&1; then
9216		eval "$var=\$type";
9217	else
9218		eval "$var=\$def";
9219	fi;
9220	$rm -f temp.?;;
9221*) eval "$var=\$varval";;
9222esac'
9223
9224: define an is-a-typedef? function that prompts if the type is not available.
9225typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9226case "$inclist" in
9227"") inclist="sys/types.h";;
9228esac;
9229eval "varval=\$$var";
9230case "$varval" in
9231"")
9232	$rm -f temp.c;
9233	for inc in $inclist; do
9234		echo "#include <$inc>" >>temp.c;
9235	done;
9236	echo "#ifdef $type" >> temp.c;
9237	echo "printf(\"We have $type\");" >> temp.c;
9238	echo "#endif" >> temp.c;
9239	$cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9240	echo " " ;
9241	echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9242	if $contains $type temp.E >/dev/null 2>&1; then
9243		echo "$type found." >&4;
9244		eval "$var=\$type";
9245	else
9246		echo "$type NOT found." >&4;
9247		dflt="$def";
9248		. ./myread ;
9249		eval "$var=\$ans";
9250	fi;
9251	$rm -f temp.?;;
9252*) eval "$var=\$varval";;
9253esac'
9254
9255: see what type lseek is declared as in the kernel
9256rp="What is the type used for lseek's offset on this system?"
9257set off_t lseektype long stdio.h sys/types.h
9258eval $typedef_ask
9259
9260echo " "
9261echo "Checking to see how big your file offsets are..." >&4
9262$cat >try.c <<EOCP
9263#include <sys/types.h>
9264#include <stdio.h>
9265int main()
9266{
9267    printf("%d\n", (int)sizeof($lseektype));
9268    return(0);
9269}
9270EOCP
9271set try
9272if eval $compile_ok; then
9273	lseeksize=`$run ./try`
9274	echo "Your file offsets are $lseeksize bytes long."
9275else
9276	dflt=$longsize
9277	echo " "
9278	echo "(I can't seem to compile the test program.  Guessing...)"
9279	rp="What is the size of your file offsets (in bytes)?"
9280	. ./myread
9281	lseeksize="$ans"
9282fi
9283$rm_try
9284
9285: see what type file positions are declared as in the library
9286rp="What is the type for file position used by fsetpos()?"
9287set fpos_t fpostype long stdio.h sys/types.h
9288eval $typedef_ask
9289
9290: Check size for Fpos_t
9291echo " "
9292case "$fpostype" in
9293*_t) zzz="$fpostype"	;;
9294*)   zzz="fpos_t"	;;
9295esac
9296echo "Checking the size of $zzz..." >&4
9297cat > try.c <<EOCP
9298#include <sys/types.h>
9299#include <stdio.h>
9300#$i_stdlib I_STDLIB
9301#ifdef I_STDLIB
9302#include <stdlib.h>
9303#endif
9304int main() {
9305    printf("%d\n", (int)sizeof($fpostype));
9306    exit(0);
9307}
9308EOCP
9309set try
9310if eval $compile_ok; then
9311	yyy=`$run ./try`
9312	case "$yyy" in
9313	'')	fpossize=4
9314		echo "(I can't execute the test program--guessing $fpossize.)" >&4
9315		;;
9316	*)	fpossize=$yyy
9317		echo "Your $zzz is $fpossize bytes long."
9318		;;
9319	esac
9320else
9321	dflt="$longsize"
9322	echo " " >&4
9323	echo "(I can't compile the test program.  Guessing...)" >&4
9324	rp="What is the size of your file positions (in bytes)?"
9325	. ./myread
9326	fpossize="$ans"
9327fi
9328
9329: Check for large file support
9330# Backward compatibility (uselfs is deprecated).
9331case "$uselfs" in
9332"$define"|true|[yY]*)
9333	cat <<EOM >&4
9334
9335*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9336EOM
9337	uselargefiles="$define"
9338	;;
9339esac
9340
9341case "$lseeksize:$fpossize" in
93428:8) cat <<EOM
9343
9344You can have files larger than 2 gigabytes.
9345EOM
9346   val="$define" ;;
9347*)    case "$uselargefiles" in
9348   "$undef"|false|[nN]*) dflt='n' ;;
9349   *)	dflt='y' ;;
9350   esac
9351   cat <<EOM
9352
9353Perl can be built to understand large files (files larger than 2 gigabytes)
9354on some systems.  To do so, Configure can be run with -Duselargefiles.
9355
9356If this doesn't make any sense to you, just accept the default '$dflt'.
9357EOM
9358   rp='Try to understand large files, if available?'
9359   . ./myread
9360   case "$ans" in
9361   y|Y) 	val="$define" ;;
9362   *)   	val="$undef"  ;;
9363   esac
9364   ;;
9365esac
9366set uselargefiles
9367eval $setvar
9368: Look for a hint-file generated 'call-back-unit'.  If the
9369: user has specified that a large files perl is to be built,
9370: we may need to set or change some other defaults.
9371if $test -f uselargefiles.cbu; then
9372	echo "Your platform has some specific hints regarding large file builds, using them..."
9373	. ./uselargefiles.cbu
9374fi
9375case "$uselargefiles" in
9376"$define")
9377	if $test -f uselargefiles.cbu; then
9378		echo " "
9379		echo "Rechecking to see how big your file offsets are..." >&4
9380		$cat >try.c <<EOCP
9381#include <sys/types.h>
9382#include <stdio.h>
9383int main()
9384{
9385    printf("%d\n", (int)sizeof($lseektype));
9386    return(0);
9387}
9388EOCP
9389		set try
9390		if eval $compile_ok; then
9391			lseeksize=`$run ./try`
9392			$echo "Your file offsets are now $lseeksize bytes long."
9393		else
9394			dflt="$lseeksize"
9395			echo " "
9396			echo "(I can't seem to compile the test program.  Guessing...)"
9397			rp="What is the size of your file offsets (in bytes)?"
9398			. ./myread
9399			lseeksize="$ans"
9400		fi
9401		case "$fpostype" in
9402		*_t) zzz="$fpostype"	;;
9403		*)   zzz="fpos_t"	;;
9404		esac
9405		$echo $n "Rechecking the size of $zzz...$c" >&4
9406		$cat > try.c <<EOCP
9407#include <sys/types.h>
9408#include <stdio.h>
9409#$i_stdlib I_STDLIB
9410#ifdef I_STDLIB
9411#include <stdlib.h>
9412#endif
9413int main() {
9414    printf("%d\n", (int)sizeof($fpostype));
9415    return(0);
9416}
9417EOCP
9418		set try
9419		if eval $compile_ok; then
9420			yyy=`$run ./try`
9421			dflt="$lseeksize"
9422			case "$yyy" in
9423			'')	echo " "
9424				echo "(I can't execute the test program--guessing $fpossize.)" >&4
9425				;;
9426			*)	fpossize=$yyy
9427				echo " $fpossize bytes." >&4
9428				;;
9429			esac
9430		else
9431			dflt="$fpossize"
9432			echo " "
9433			echo "(I can't compile the test program.  Guessing...)" >&4
9434			rp="What is the size of your file positions (in bytes)?"
9435			. ./myread
9436			fpossize="$ans"
9437		fi
9438		$rm_try
9439	fi
9440	;;
9441esac
9442
9443: Check if we want perlio
9444useperlio="$define"
9445
9446: Set the vendorbin variables
9447case "$vendorprefix" in
9448'')	d_vendorbin="$undef"
9449	vendorbin=''
9450	vendorbinexp=''
9451	;;
9452*)	d_vendorbin="$define"
9453	: determine where vendor-supplied executables go.
9454	case "$vendorbin" in
9455	'') dflt=$vendorprefix/bin ;;
9456	*)	dflt="$vendorbin" ;;
9457	esac
9458	fn=d~+
9459	rp='Pathname for the vendor-supplied executables directory?'
9460	. ./getfile
9461	vendorbin="$ans"
9462	vendorbinexp="$ansexp"
9463	;;
9464esac
9465prefixvar=vendorbin
9466. ./installprefix
9467
9468: Set the vendorhtml1dir variables
9469case "$vendorprefix" in
9470'')	vendorhtml1dir=''
9471	vendorhtml1direxp=''
9472	;;
9473*)	: determine where vendor-supplied html pages go.
9474	: There is no standard location, so try to copy the previously-selected
9475	: directory structure for the core html pages.
9476	: XXX Better default suggestions would be welcome.
9477	case "$vendorhtml1dir" in
9478	'')	dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9479	*)	dflt=$vendorhtml1dir ;;
9480	esac
9481	case "$dflt" in
9482	''|' ') dflt=none ;;
9483	esac
9484	fn=dn+~
9485	rp='Pathname for the vendor-supplied html pages?'
9486	. ./getfile
9487	vendorhtml1dir="$ans"
9488	vendorhtml1direxp="$ansexp"
9489	;;
9490esac
9491: Use ' ' for none so value is preserved next time through Configure
9492$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9493prefixvar=vendorhtml1dir
9494. ./installprefix
9495
9496: Set the vendorhtml3dir variables
9497case "$vendorprefix" in
9498'')	vendorhtml3dir=''
9499	vendorhtml3direxp=''
9500	;;
9501*)	: determine where vendor-supplied module html pages go.
9502	: There is no standard location, so try to copy the previously-selected
9503	: directory structure for the core html pages.
9504	: XXX Better default suggestions would be welcome.
9505	case "$vendorhtml3dir" in
9506	'')	dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9507	*)	dflt=$vendorhtml3dir ;;
9508	esac
9509	case "$dflt" in
9510	''|' ') dflt=none ;;
9511	esac
9512	fn=dn+~
9513	rp='Pathname for the vendor-supplied html pages?'
9514	. ./getfile
9515	vendorhtml3dir="$ans"
9516	vendorhtml3direxp="$ansexp"
9517	;;
9518esac
9519: Use ' ' for none so value is preserved next time through Configure
9520$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9521prefixvar=vendorhtml3dir
9522. ./installprefix
9523
9524: Set the vendorman1dir variables
9525case "$vendorprefix" in
9526'')	vendorman1dir=''
9527	vendorman1direxp=''
9528	;;
9529*)	: determine where vendor-supplied manual pages go.
9530	case "$vendorman1dir" in
9531	'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9532	*)	dflt=$vendorman1dir ;;
9533	esac
9534	case "$dflt" in
9535	''|' ') dflt=none ;;
9536	esac
9537	fn=nd~+
9538	rp='Pathname for the vendor-supplied manual section 1 pages?'
9539	. ./getfile
9540	vendorman1dir="$ans"
9541	vendorman1direxp="$ansexp"
9542	;;
9543esac
9544: Use ' ' for none so value is preserved next time through Configure
9545$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9546prefixvar=vendorman1dir
9547. ./installprefix
9548
9549: Set the vendorman3dir variables
9550case "$vendorprefix" in
9551'')	vendorman3dir=''
9552	vendorman3direxp=''
9553	;;
9554*)	: determine where vendor-supplied module manual pages go.
9555	case "$vendorman3dir" in
9556	'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9557	*)	dflt=$vendorman3dir ;;
9558	esac
9559	case "$dflt" in
9560	''|' ') dflt=none ;;
9561	esac
9562	fn=nd~+
9563	rp='Pathname for the vendor-supplied manual section 3 pages?'
9564	. ./getfile
9565	vendorman3dir="$ans"
9566	vendorman3direxp="$ansexp"
9567	;;
9568esac
9569: Use ' ' for none so value is preserved next time through Configure
9570$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9571prefixvar=vendorman3dir
9572. ./installprefix
9573
9574: Set the vendorscript variables
9575case "$vendorprefix" in
9576'')	d_vendorscript="$undef"
9577	vendorscript=''
9578	vendorscriptexp=''
9579	;;
9580*)	d_vendorscript="$define"
9581	: determine where vendor-supplied scripts go.
9582	case "$vendorscript" in
9583	'')	dflt=$vendorprefix/script
9584		$test -d $dflt || dflt=$vendorbin ;;
9585	*)  dflt="$vendorscript" ;;
9586	esac
9587	$cat <<EOM
9588
9589The installation process will create a directory for
9590vendor-supplied scripts.
9591
9592EOM
9593	fn=d~+
9594	rp='Pathname for the vendor-supplied scripts directory?'
9595	. ./getfile
9596	vendorscript="$ans"
9597	vendorscriptexp="$ansexp"
9598	;;
9599esac
9600prefixvar=vendorscript
9601. ./installprefix
9602
9603: script used to emit important warnings
9604cat >warn <<EOS
9605$startsh
9606if test \$# -gt 0; then
9607	echo "\$@" >msg
9608else
9609	cat >msg
9610fi
9611echo "*** WARNING:" >&4
9612sed -e 's/^/*** /' <msg >&4
9613echo "*** " >&4
9614cat msg >>config.msg
9615echo " " >>config.msg
9616rm -f msg
9617EOS
9618chmod +x warn
9619$eunicefix warn
9620
9621: see which of string.h or strings.h is needed
9622echo " "
9623strings=`./findhdr string.h`
9624if $test "$strings" && $test -r "$strings"; then
9625	echo "Using <string.h> instead of <strings.h>." >&4
9626	val="$define"
9627else
9628	val="$undef"
9629	strings=`./findhdr strings.h`
9630	if $test "$strings" && $test -r "$strings"; then
9631		echo "Using <strings.h> instead of <string.h>." >&4
9632	else
9633		./warn "No string header found -- You'll surely have problems."
9634	fi
9635fi
9636set i_string
9637eval $setvar
9638case "$i_string" in
9639"$undef") strings=`./findhdr strings.h`;;
9640*)	  strings=`./findhdr string.h`;;
9641esac
9642
9643: see if qgcvt exists
9644set qgcvt d_qgcvt
9645eval $inlibc
9646
9647: Check print/scan long double stuff
9648echo " "
9649
9650if $test X"$d_longdbl" = X"$define"; then
9651
9652echo "Checking how to print long doubles..." >&4
9653
9654if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9655	$cat >try.c <<'EOCP'
9656#include <sys/types.h>
9657#include <stdio.h>
9658int main() {
9659  double d = 123.456;
9660  printf("%.3f\n", d);
9661}
9662EOCP
9663	set try
9664	if eval $compile; then
9665		yyy=`$run ./try`
9666		case "$yyy" in
9667		123.456)
9668			sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9669                	sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9670			echo "We will use %f."
9671			;;
9672		esac
9673	fi
9674fi
9675
9676if $test X"$sPRIfldbl" = X; then
9677	$cat >try.c <<'EOCP'
9678#include <sys/types.h>
9679#include <stdio.h>
9680int main() {
9681  long double d = 123.456;
9682  printf("%.3Lf\n", d);
9683}
9684EOCP
9685	set try
9686	if eval $compile; then
9687		yyy=`$run ./try`
9688		case "$yyy" in
9689		123.456)
9690			sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9691                	sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9692			echo "We will use %Lf."
9693			;;
9694		esac
9695	fi
9696fi
9697
9698if $test X"$sPRIfldbl" = X; then
9699	$cat >try.c <<'EOCP'
9700#include <sys/types.h>
9701#include <stdio.h>
9702int main() {
9703  long double d = 123.456;
9704  printf("%.3llf\n", d);
9705}
9706EOCP
9707	set try
9708	if eval $compile; then
9709		yyy=`$run ./try`
9710		case "$yyy" in
9711		123.456)
9712			sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9713                	sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9714			echo "We will use %llf."
9715			;;
9716		esac
9717	fi
9718fi
9719
9720if $test X"$sPRIfldbl" = X; then
9721	$cat >try.c <<'EOCP'
9722#include <sys/types.h>
9723#include <stdio.h>
9724int main() {
9725  long double d = 123.456;
9726  printf("%.3lf\n", d);
9727}
9728EOCP
9729	set try
9730	if eval $compile; then
9731		yyy=`$run ./try`
9732		case "$yyy" in
9733		123.456)
9734			sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9735                	sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9736			echo "We will use %lf."
9737			;;
9738		esac
9739	fi
9740fi
9741
9742if $test X"$sPRIfldbl" = X; then
9743	echo "Cannot figure out how to print long doubles." >&4
9744else
9745	sSCNfldbl=$sPRIfldbl	# expect consistency
9746fi
9747
9748$rm_try
9749
9750fi # d_longdbl
9751
9752case "$sPRIfldbl" in
9753'')	d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9754	d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9755	d_SCNfldbl="$undef";
9756	;;
9757*)	d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9758	d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9759	d_SCNfldbl="$define";
9760	;;
9761esac
9762
9763: Check how to convert floats to strings.
9764
9765if test "X$d_Gconvert" = X; then
9766
9767echo " "
9768echo "Checking for an efficient way to convert floats to strings."
9769echo " " > try.c
9770case "$uselongdouble" in
9771"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9772esac
9773case "$d_longdbl" in
9774"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9775esac
9776case "$d_PRIgldbl" in
9777"$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9778esac
9779$cat >>try.c <<EOP
9780#ifdef TRY_gconvert
9781#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9782char *myname = "gconvert";
9783#endif
9784#ifdef TRY_gcvt
9785#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9786char *myname = "gcvt";
9787#endif
9788#ifdef TRY_qgcvt
9789#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9790char *myname = "qgcvt";
9791#define DOUBLETYPE long double
9792#endif
9793#ifdef TRY_sprintf
9794#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9795#ifdef HAS_PRIgldbl
9796#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9797#else
9798#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9799#endif
9800#else
9801#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9802#endif
9803char *myname = "sprintf";
9804#endif
9805
9806#ifndef DOUBLETYPE
9807#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9808#define DOUBLETYPE long double
9809#else
9810#define DOUBLETYPE double
9811#endif
9812#endif
9813
9814#include <stdio.h>
9815
9816#$i_stdlib I_STDLIB
9817#ifdef I_STDLIB
9818#include <stdlib.h>
9819#endif
9820#$i_string I_STRING
9821#ifdef I_STRING
9822#  include <string.h>
9823#else
9824#  include <strings.h>
9825#endif
9826
9827int checkit(char *expect, char *got)
9828{
9829    if (strcmp(expect, got)) {
9830		printf("%s oddity:  Expected %s, got %s\n",
9831			myname, expect, got);
9832		exit(1);
9833	}
9834}
9835
9836int main()
9837{
9838	char buf[64];
9839	buf[63] = '\0';
9840
9841	/* This must be 1st test on (which?) platform */
9842	/* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9843	Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9844	checkit("0.1", buf);
9845
9846	Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9847	checkit("0.01", buf);
9848
9849	Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9850	checkit("0.001", buf);
9851
9852	Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9853	checkit("0.0001", buf);
9854
9855	Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9856	if (strlen(buf) > 5)
9857	    checkit("9e-005", buf); /* for Microsoft ?? */
9858	else
9859	    checkit("9e-05", buf);
9860
9861	Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9862	checkit("1", buf);
9863
9864	Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9865	checkit("1.1", buf);
9866
9867	Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9868	checkit("1.01", buf);
9869
9870	Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9871	checkit("1.001", buf);
9872
9873	Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9874	checkit("1.0001", buf);
9875
9876	Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9877	checkit("1.00001", buf);
9878
9879	Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9880	checkit("1.000001", buf);
9881
9882	Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9883	checkit("0", buf);
9884
9885	Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9886	checkit("-1", buf);
9887
9888	/* Some Linux gcvt's give 1.e+5 here. */
9889	Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9890	checkit("100000", buf);
9891
9892	/* Some Linux gcvt's give -1.e+5 here. */
9893	Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9894	checkit("-100000", buf);
9895
9896	Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9897	checkit("123.456", buf);
9898
9899	/* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9900	Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9901	/* 34 should be enough to scare even long double
9902	 * places into using the e notation. */
9903	if (strlen(buf) > 5)
9904	    checkit("1e+034", buf); /* for Microsoft */
9905	else
9906	    checkit("1e+34", buf);
9907
9908	/* For Perl, if you add additional tests here, also add them to
9909	 * t/base/num.t for benefit of platforms not using Configure or
9910	 * overriding d_Gconvert */
9911
9912	exit(0);
9913}
9914EOP
9915: first add preferred functions to our list
9916xxx_list=""
9917for xxx_convert in $gconvert_preference; do
9918    case $xxx_convert in
9919    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9920    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9921    esac
9922done
9923: then add any others
9924for xxx_convert in gconvert gcvt sprintf; do
9925    case "$xxx_list" in
9926    *$xxx_convert*) ;;
9927    *) xxx_list="$xxx_list $xxx_convert" ;;
9928    esac
9929done
9930
9931case "$d_longdbl$uselongdouble" in
9932"$define$define")
9933    : again, add preferred functions to our list first
9934    xxx_ld_list=""
9935    for xxx_convert in $gconvert_ld_preference; do
9936        case $xxx_convert in
9937        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9938        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9939        esac
9940    done
9941    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9942    for xxx_convert in qgcvt sprintf $xxx_list; do
9943        case "$xxx_ld_list" in
9944        $xxx_convert*|*" $xxx_convert"*) ;;
9945        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9946        esac
9947    done
9948    : if sprintf cannot do long doubles, move it to the end
9949    if test "$d_PRIgldbl" != "$define"; then
9950        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9951    fi
9952    : if no qgcvt, remove it
9953    if test "$d_qgcvt" != "$define"; then
9954        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9955    fi
9956    : use the ld_list
9957    xxx_list="$xxx_ld_list"
9958    ;;
9959esac
9960
9961for xxx_convert in $xxx_list; do
9962	echo "Trying $xxx_convert..."
9963	$rm -f try try$_o core
9964	set try -DTRY_$xxx_convert
9965	if eval $compile; then
9966		echo "$xxx_convert() found." >&4
9967		if $run ./try; then
9968			echo "I'll use $xxx_convert to convert floats into a string." >&4
9969			break;
9970		else
9971			echo "...But $xxx_convert didn't work as I expected."
9972			xxx_convert=''
9973		fi
9974	else
9975		echo "$xxx_convert NOT found." >&4
9976	fi
9977done
9978
9979if test X$xxx_convert = X; then
9980    echo "*** WHOA THERE!!! ***" >&4
9981    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9982    xxx_convert=sprintf
9983fi
9984
9985case "$xxx_convert" in
9986gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9987gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9988qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9989*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9990   "$define$define$define")
9991      d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9992   "$define$define$undef")
9993      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9994   *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9995   esac
9996   ;;
9997esac
9998
9999fi
10000$rm_try
10001
10002: see if _fwalk exists
10003set fwalk d__fwalk
10004eval $inlibc
10005
10006: Initialize h_fcntl
10007h_fcntl=false
10008
10009: Initialize h_sysfile
10010h_sysfile=false
10011
10012: access call always available on UNIX
10013set access d_access
10014eval $inlibc
10015
10016: locate the flags for 'access()'
10017case "$d_access" in
10018"$define")
10019	echo " "
10020	$cat >access.c <<EOCP
10021#include <sys/types.h>
10022#ifdef I_FCNTL
10023#include <fcntl.h>
10024#endif
10025#ifdef I_SYS_FILE
10026#include <sys/file.h>
10027#endif
10028#ifdef I_UNISTD
10029#include <unistd.h>
10030#endif
10031#$i_stdlib I_STDLIB
10032#ifdef I_STDLIB
10033#include <stdlib.h>
10034#endif
10035int main() {
10036	exit(R_OK);
10037}
10038EOCP
10039	: check sys/file.h first, no particular reason here
10040	if $test `./findhdr sys/file.h` && \
10041		$cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10042		h_sysfile=true;
10043		echo "<sys/file.h> defines the *_OK access constants." >&4
10044	elif $test `./findhdr fcntl.h` && \
10045		$cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10046		h_fcntl=true;
10047		echo "<fcntl.h> defines the *_OK access constants." >&4
10048	elif $test `./findhdr unistd.h` && \
10049		$cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10050		echo "<unistd.h> defines the *_OK access constants." >&4
10051	else
10052		echo "I can't find the four *_OK access constants--I'll use mine." >&4
10053	fi
10054	;;
10055esac
10056$rm -f access*
10057
10058: see if accessx exists
10059set accessx d_accessx
10060eval $inlibc
10061
10062: see if aintl exists
10063set aintl d_aintl
10064eval $inlibc
10065
10066: see if alarm exists
10067set alarm d_alarm
10068eval $inlibc
10069
10070: see if 64bit time functions exists
10071
10072set ctime64 d_ctime64
10073eval $inlibc
10074
10075set localtime64 d_localtime64
10076eval $inlibc
10077
10078set gmtime64 d_gmtime64
10079eval $inlibc
10080
10081set mktime64 d_mktime64
10082eval $inlibc
10083
10084set difftime64 d_difftime64
10085eval $inlibc
10086
10087set asctime64 d_asctime64
10088eval $inlibc
10089
10090: see if POSIX threads are available
10091set pthread.h i_pthread
10092eval $inhdr
10093
10094: define a function to check prototypes
10095$cat > protochk <<EOSH
10096$startsh
10097cc="$cc"
10098optimize="$optimize"
10099ccflags="$ccflags"
10100prototype="$prototype"
10101define="$define"
10102rm_try="$rm_try"
10103usethreads=$usethreads
10104i_pthread=$i_pthread
10105pthread_h_first=$pthread_h_first
10106EOSH
10107
10108$cat >> protochk <<'EOSH'
10109
10110$rm_try
10111foo="$1"
10112shift
10113while test $# -ge 2; do
10114	case "$1" in
10115		$define) echo "#include <$2>" >> try.c ;;
10116		literal) echo "$2" >> try.c ;;
10117	esac
10118    # Extra magic for the benefit of systems that need pthread.h
10119    # to be included early to correctly detect threadsafe functions.
10120    # Such functions must guarantee themselves, though, that the usethreads
10121    # and i_pthread have been defined, before calling protochk.
10122    if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10123	echo "#include <pthread.h>" >> try.c
10124	pthread_h_done=yes
10125    fi
10126    shift 2
10127done
10128test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10129cat >> try.c <<'EOCP'
10130#ifdef CAN_PROTOTYPE
10131#define	_(args) args
10132#else
10133#define	_(args) ()
10134#endif
10135EOCP
10136echo "$foo" >> try.c
10137echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10138$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10139status=$?
10140$rm_try
10141exit $status
10142EOSH
10143chmod +x protochk
10144$eunicefix protochk
10145
10146: Define hasproto macro for Configure internal use
10147hasproto='varname=$1; func=$2; shift; shift;
10148while $test $# -ge 2; do
10149	case "$1" in
10150	$define) echo "#include <$2>";;
10151	esac ;
10152    shift 2;
10153done > try.c;
10154$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10155if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10156	echo "$func() prototype found.";
10157	val="$define";
10158else
10159	echo "$func() prototype NOT found.";
10160	val="$undef";
10161fi;
10162set $varname;
10163eval $setvar;
10164$rm_try tryout.c'
10165
10166: see if sys/types.h has to be included
10167set sys/types.h i_systypes
10168eval $inhdr
10169
10170: see if sys/select.h has to be included
10171set sys/select.h i_sysselct
10172eval $inhdr
10173
10174: Define hasfield macro for Configure internal use
10175hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10176while $test $# -ge 2; do
10177	case "$1" in
10178	$define) echo "#include <$2>";;
10179	esac ;
10180    shift 2;
10181done > try.c;
10182echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10183set try;
10184if eval $compile; then
10185	val="$define";
10186else
10187	val="$undef";
10188fi;
10189set $varname;
10190eval $setvar;
10191$rm_try'
10192
10193: see if we should include time.h, sys/time.h, or both
10194echo " "
10195if test "X$timeincl" = X; then
10196	echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10197	$echo $n "I'm now running the test program...$c"
10198	$cat >try.c <<EOCP
10199#include <sys/types.h>
10200#ifdef I_TIME
10201#include <time.h>
10202#endif
10203#ifdef I_SYSTIME
10204#ifdef SYSTIMEKERNEL
10205#define KERNEL
10206#endif
10207#include <sys/time.h>
10208#endif
10209#ifdef I_SYSSELECT
10210#include <sys/select.h>
10211#endif
10212#$i_stdlib I_STDLIB
10213#ifdef I_STDLIB
10214#include <stdlib.h>
10215#endif
10216int main()
10217{
10218	struct tm foo;
10219#ifdef S_TIMEVAL
10220	struct timeval bar;
10221#endif
10222#ifdef S_TIMEZONE
10223	struct timezone tzp;
10224#endif
10225	if (foo.tm_sec == foo.tm_sec)
10226		exit(0);
10227#ifdef S_TIMEVAL
10228	if (bar.tv_sec == bar.tv_sec)
10229		exit(0);
10230#endif
10231	exit(1);
10232}
10233EOCP
10234	flags=''
10235	for s_timezone in '-DS_TIMEZONE' ''; do
10236	sysselect=''
10237	for s_timeval in '-DS_TIMEVAL' ''; do
10238	for i_systimek in '' '-DSYSTIMEKERNEL'; do
10239	for i_time in '' '-DI_TIME'; do
10240	for i_systime in '-DI_SYSTIME' ''; do
10241		case "$flags" in
10242		'') $echo $n ".$c"
10243			set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10244			if eval $compile; then
10245				set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10246				shift
10247				flags="$*"
10248				echo " "
10249				$echo $n "Succeeded with $flags$c"
10250			fi
10251			;;
10252		esac
10253	done
10254	done
10255	done
10256	done
10257	done
10258	timeincl=''
10259	echo " "
10260	case "$flags" in
10261	*SYSTIMEKERNEL*) i_systimek="$define"
10262		timeincl=`./findhdr sys/time.h`
10263		echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10264	*) i_systimek="$undef";;
10265	esac
10266	case "$flags" in
10267	*I_TIME*) i_time="$define"
10268		timeincl=`./findhdr time.h`" $timeincl"
10269		echo "We'll include <time.h>." >&4;;
10270	*) i_time="$undef";;
10271	esac
10272	case "$flags" in
10273	*I_SYSTIME*) i_systime="$define"
10274		timeincl=`./findhdr sys/time.h`" $timeincl"
10275		echo "We'll include <sys/time.h>." >&4;;
10276	*) i_systime="$undef";;
10277	esac
10278	$rm_try
10279fi
10280: see if struct tm knows about tm_zone
10281case "$i_systime$i_time" in
10282*$define*)
10283        echo " "
10284        echo "Checking to see if your struct tm has tm_zone field..." >&4
10285        set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10286        eval $hasfield
10287        ;;
10288*)      val="$undef"
10289        set d_tm_tm_zone
10290        eval $setvar
10291        ;;
10292esac
10293case "$d_tm_tm_zone" in
10294"$define")      echo "Yes, it does."   ;;
10295*)              echo "No, it doesn't." ;;
10296esac
10297: see if struct tm knows about tm_gmtoff
10298case "$i_systime$i_time" in
10299*$define*)
10300        echo " "
10301        echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10302        set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10303        eval $hasfield
10304        ;;
10305*)      val="$undef"
10306        set d_tm_tm_gmtoff
10307        eval $setvar
10308        ;;
10309esac
10310case "$d_tm_tm_gmtoff" in
10311"$define")      echo "Yes, it does."   ;;
10312*)              echo "No, it doesn't." ;;
10313esac
10314
10315: see if asctime_r exists
10316set asctime_r d_asctime_r
10317eval $inlibc
10318case "$d_asctime_r" in
10319"$define")
10320	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10321	case "$d_asctime_r_proto:$usethreads" in
10322	":define")	d_asctime_r_proto=define
10323		set d_asctime_r_proto asctime_r $hdrs
10324		eval $hasproto ;;
10325	*)	;;
10326	esac
10327	case "$d_asctime_r_proto" in
10328	define)
10329	case "$asctime_r_proto" in
10330	''|0) try='char* asctime_r(const struct tm*, char*);'
10331	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10332	esac
10333	case "$asctime_r_proto" in
10334	''|0) try='char* asctime_r(const struct tm*, char*, int);'
10335	./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10336	esac
10337	case "$asctime_r_proto" in
10338	''|0) try='int asctime_r(const struct tm*, char*);'
10339	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10340	esac
10341	case "$asctime_r_proto" in
10342	''|0) try='int asctime_r(const struct tm*, char*, int);'
10343	./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10344	esac
10345	case "$asctime_r_proto" in
10346	''|0)	d_asctime_r=undef
10347 	        asctime_r_proto=0
10348		echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10349	* )	case "$asctime_r_proto" in
10350		REENTRANT_PROTO*) ;;
10351		*) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10352		esac
10353		echo "Prototype: $try" ;;
10354	esac
10355	;;
10356	*)	case "$usethreads" in
10357		define) echo "asctime_r has no prototype, not using it." >&4 ;;
10358		esac
10359		d_asctime_r=undef
10360		asctime_r_proto=0
10361		;;
10362	esac
10363	;;
10364*)	asctime_r_proto=0
10365	;;
10366esac
10367
10368: see if atolf exists
10369set atolf d_atolf
10370eval $inlibc
10371
10372: see if atoll exists
10373set atoll d_atoll
10374eval $inlibc
10375
10376: Look for GCC-style attribute format
10377case "$d_attribute_format" in
10378'')
10379echo " "
10380echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10381$cat >attrib.c <<'EOCP'
10382#include <stdio.h>
10383void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10384EOCP
10385if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10386	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10387		echo "Your C compiler doesn't support __attribute__((format))."
10388		val="$undef"
10389	else
10390		echo "Your C compiler supports __attribute__((format))."
10391		val="$define"
10392	fi
10393else
10394	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10395	val="$undef"
10396fi
10397;;
10398*) val="$d_attribute_format" ;;
10399esac
10400set d_attribute_format
10401eval $setvar
10402$rm -f attrib*
10403
10404: Look for GCC-style attribute format with null format allowed
10405case "$d_printf_format_null" in
10406'') case "$d_attribute_format" in
10407    $define)
10408	echo " "
10409	echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10410$cat >attrib.c <<EOCP
10411#include <stdio.h>
10412#$i_stdlib I_STDLIB
10413#ifdef I_STDLIB
10414#include <stdlib.h>
10415#endif
10416int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10417int null_printf (char* pat,...) { return (int)pat; }
10418int main () { exit(null_printf(NULL)); }
10419EOCP
10420	if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10421	    : run the executable in case it produces a run-time warning
10422	    if $run ./attrib >>attrib.out 2>&1; then
10423		if $contains 'warning' attrib.out >/dev/null 2>&1; then
10424		    echo "Your C compiler doesn't allow __printf__ format to be null."
10425		    val="$undef"
10426		else
10427		    echo "Your C compiler allows __printf__ format to be null."
10428		    val="$define"
10429		fi
10430	    else
10431	    echo "Your C compiler executable failed with __printf__ format null."
10432	    val="$undef"
10433	fi
10434    else
10435	echo "Your C compiler fails with __printf__ format null."
10436	val="$undef"
10437    fi
10438    ;;
10439    *)  val="$undef" ;;
10440    esac
10441;;
10442*)  val="$d_printf_format_null" ;;
10443esac
10444set d_printf_format_null
10445eval $setvar
10446$rm -f attrib*
10447
10448: Look for GCC-style attribute malloc
10449case "$d_attribute_malloc" in
10450'')
10451echo " "
10452echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10453$cat >attrib.c <<'EOCP'
10454#include <stdio.h>
10455char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10456EOCP
10457if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10458	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10459		echo "Your C compiler doesn't support __attribute__((malloc))."
10460		val="$undef"
10461	else
10462		echo "Your C compiler supports __attribute__((malloc))."
10463		val="$define"
10464	fi
10465else
10466	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10467	val="$undef"
10468fi
10469;;
10470*) val="$d_attribute_malloc" ;;
10471esac
10472set d_attribute_malloc
10473eval $setvar
10474$rm -f attrib*
10475
10476: Look for GCC-style attribute nonnull
10477case "$d_attribute_nonnull" in
10478'')
10479echo " "
10480echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10481$cat >attrib.c <<'EOCP'
10482#include <stdio.h>
10483void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10484EOCP
10485if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10486	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10487		echo "Your C compiler doesn't support __attribute__((nonnull))."
10488		val="$undef"
10489	else
10490		echo "Your C compiler supports __attribute__((nonnull))."
10491		val="$define"
10492	fi
10493else
10494	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10495	val="$undef"
10496fi
10497;;
10498*) val="$d_attribute_nonnull" ;;
10499esac
10500set d_attribute_nonnull
10501eval $setvar
10502$rm -f attrib*
10503
10504: Look for GCC-style attribute noreturn
10505case "$d_attribute_noreturn" in
10506'')
10507echo " "
10508echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10509$cat >attrib.c <<'EOCP'
10510#include <stdio.h>
10511void fall_over_dead( void ) __attribute__((noreturn));
10512EOCP
10513if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10514	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10515		echo "Your C compiler doesn't support __attribute__((noreturn))."
10516		val="$undef"
10517	else
10518		echo "Your C compiler supports __attribute__((noreturn))."
10519		val="$define"
10520	fi
10521else
10522	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10523	val="$undef"
10524fi
10525;;
10526*) val="$d_attribute_noreturn" ;;
10527esac
10528set d_attribute_noreturn
10529eval $setvar
10530$rm -f attrib*
10531
10532: Look for GCC-style attribute pure
10533case "$d_attribute_pure" in
10534'')
10535echo " "
10536echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10537$cat >attrib.c <<'EOCP'
10538#include <stdio.h>
10539int square( int n ) __attribute__((pure));
10540EOCP
10541if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10542	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10543		echo "Your C compiler doesn't support __attribute__((pure))."
10544		val="$undef"
10545	else
10546		echo "Your C compiler supports __attribute__((pure))."
10547		val="$define"
10548	fi
10549else
10550	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10551	val="$undef"
10552fi
10553;;
10554*) val="$d_attribute_pure" ;;
10555esac
10556set d_attribute_pure
10557eval $setvar
10558$rm -f attrib*
10559
10560: Look for GCC-style attribute unused
10561case "$d_attribute_unused" in
10562'')
10563echo " "
10564echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10565$cat >attrib.c <<'EOCP'
10566#include <stdio.h>
10567int do_something( int dummy __attribute__((unused)), int n );
10568EOCP
10569if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10570	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10571		echo "Your C compiler doesn't support __attribute__((unused))."
10572		val="$undef"
10573	else
10574		echo "Your C compiler supports __attribute__((unused))."
10575		val="$define"
10576	fi
10577else
10578	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10579	val="$undef"
10580fi
10581;;
10582*) val="$d_attribute_unused" ;;
10583esac
10584set d_attribute_unused
10585eval $setvar
10586$rm -f attrib*
10587
10588: Look for GCC-style attribute deprecated
10589case "$d_attribute_deprecated" in
10590'')
10591echo " "
10592echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10593$cat >attrib.c <<'EOCP'
10594#include <stdio.h>
10595int I_am_deprecated(void) __attribute__((deprecated));
10596EOCP
10597if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10598	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10599		echo "Your C compiler doesn't support __attribute__((deprecated))."
10600		val="$undef"
10601	else
10602		echo "Your C compiler supports __attribute__((deprecated))."
10603		val="$define"
10604	fi
10605else
10606	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10607	val="$undef"
10608fi
10609;;
10610*) val="$d_attribute_deprecated" ;;
10611esac
10612set d_attribute_deprecated
10613eval $setvar
10614$rm -f attrib*
10615
10616: Look for GCC-style attribute warn_unused_result
10617case "$d_attribute_warn_unused_result" in
10618'')
10619echo " "
10620echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10621$cat >attrib.c <<'EOCP'
10622#include <stdio.h>
10623int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10624EOCP
10625if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10626	if $contains 'warning' attrib.out >/dev/null 2>&1; then
10627		echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10628		val="$undef"
10629	else
10630		echo "Your C compiler supports __attribute__((warn_unused_result))."
10631		val="$define"
10632	fi
10633else
10634	echo "Your C compiler doesn't seem to understand __attribute__ at all."
10635	val="$undef"
10636fi
10637;;
10638*) val="$d_attribute_warn_unused_result" ;;
10639esac
10640set d_attribute_warn_unused_result
10641eval $setvar
10642$rm -f attrib*
10643
10644: see if bcmp exists
10645set bcmp d_bcmp
10646eval $inlibc
10647
10648: see if bcopy exists
10649set bcopy d_bcopy
10650eval $inlibc
10651
10652: see if getpgrp exists
10653set getpgrp d_getpgrp
10654eval $inlibc
10655
10656case "$d_getpgrp" in
10657"$define")
10658	echo " "
10659	echo "Checking to see which flavor of getpgrp is in use..."
10660	$cat >try.c <<EOP
10661#$i_unistd I_UNISTD
10662#include <sys/types.h>
10663#ifdef I_UNISTD
10664#  include <unistd.h>
10665#endif
10666#$i_stdlib I_STDLIB
10667#ifdef I_STDLIB
10668#include <stdlib.h>
10669#endif
10670int main()
10671{
10672	if (getuid() == 0) {
10673		printf("(I see you are running Configure as super-user...)\n");
10674		setuid(1);
10675	}
10676#ifdef TRY_BSD_PGRP
10677	if (getpgrp(1) == 0)
10678		exit(0);
10679#else
10680	if (getpgrp() > 0)
10681		exit(0);
10682#endif
10683	exit(1);
10684}
10685EOP
10686	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10687		echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10688		val="$define"
10689	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10690		echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10691		val="$undef"
10692	else
10693		echo "I can't seem to compile and run the test program."
10694		if ./usg; then
10695			xxx="a USG one, i.e. you use getpgrp()."
10696		else
10697			# SVR4 systems can appear rather BSD-ish.
10698			case "$i_unistd" in
10699			$undef)
10700				xxx="a BSD one, i.e. you use getpgrp(pid)."
10701				val="$define"
10702				;;
10703			$define)
10704				xxx="probably a USG one, i.e. you use getpgrp()."
10705				val="$undef"
10706				;;
10707			esac
10708		fi
10709		echo "Assuming your getpgrp is $xxx" >&4
10710	fi
10711	;;
10712*) val="$undef";;
10713esac
10714set d_bsdgetpgrp
10715eval $setvar
10716$rm_try
10717
10718: see if setpgrp exists
10719set setpgrp d_setpgrp
10720eval $inlibc
10721
10722case "$d_setpgrp" in
10723"$define")
10724	echo " "
10725	echo "Checking to see which flavor of setpgrp is in use..."
10726	$cat >try.c <<EOP
10727#$i_unistd I_UNISTD
10728#include <sys/types.h>
10729#ifdef I_UNISTD
10730#  include <unistd.h>
10731#endif
10732#$i_stdlib I_STDLIB
10733#ifdef I_STDLIB
10734#include <stdlib.h>
10735#endif
10736int main()
10737{
10738	if (getuid() == 0) {
10739		printf("(I see you are running Configure as super-user...)\n");
10740		setuid(1);
10741	}
10742#ifdef TRY_BSD_PGRP
10743	if (-1 == setpgrp(1, 1))
10744		exit(0);
10745#else
10746	if (setpgrp() != -1)
10747		exit(0);
10748#endif
10749	exit(1);
10750}
10751EOP
10752	if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10753		echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10754		val="$define"
10755	elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10756		echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10757		val="$undef"
10758	else
10759		echo "(I can't seem to compile and run the test program.)"
10760		if ./usg; then
10761			xxx="a USG one, i.e. you use setpgrp()."
10762		else
10763			# SVR4 systems can appear rather BSD-ish.
10764			case "$i_unistd" in
10765			$undef)
10766				xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10767				val="$define"
10768				;;
10769			$define)
10770				xxx="probably a USG one, i.e. you use setpgrp()."
10771				val="$undef"
10772				;;
10773			esac
10774		fi
10775		echo "Assuming your setpgrp is $xxx" >&4
10776	fi
10777	;;
10778*) val="$undef";;
10779esac
10780set d_bsdsetpgrp
10781eval $setvar
10782$rm_try
10783
10784: Look for GCC-style __builtin_choose_expr
10785case "$d_builtin_choose_expr" in
10786'')
10787    echo " "
10788    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10789    $cat >try.c <<'EOCP'
10790#include <assert.h>
10791#include <stdlib.h>
10792#include <stdio.h>
10793
10794#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10795
10796int main(void) {
10797    assert( SYRINX(1) == 2112 );
10798    assert( SYRINX(1) != 5150 );
10799    assert( SYRINX(0) == 5150 );
10800    assert( SYRINX(0) != 2112 );
10801    puts( "All good!" );
10802    exit(0);
10803}
10804
10805EOCP
10806    set try
10807    if eval $compile && $run ./try; then
10808	echo "Your C compiler supports __builtin_choose_expr."
10809	val="$define"
10810    else
10811	echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10812	val="$undef"
10813    fi
10814;;
10815*) val="$d_builtin_choose_expr" ;;
10816esac
10817
10818set d_builtin_choose_expr
10819eval $setvar
10820$rm_try
10821
10822: Look for GCC-style __builtin_expect
10823case "$d_builtin_expect" in
10824'')
10825    echo " "
10826    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10827    $cat >try.c <<'EOCP'
10828int main(void) {
10829    int n = 50;
10830    if ( __builtin_expect(n, 0) ) n = 1;
10831    /* Remember shell exit code truth is 0, C truth is non-zero */
10832    return !(n == 1);
10833}
10834EOCP
10835    set try
10836    if eval $compile && $run ./try; then
10837	echo "Your C compiler supports __builtin_expect."
10838	val="$define"
10839    else
10840	echo "Your C compiler doesn't seem to understand __builtin_expect."
10841	val="$undef"
10842    fi
10843    ;;
10844*) val="$d_builtin_expect" ;;
10845esac
10846
10847set d_builtin_expect
10848eval $setvar
10849$rm_try
10850
10851: see if bzero exists
10852set bzero d_bzero
10853eval $inlibc
10854
10855: see if stdarg is available
10856echo " "
10857if $test `./findhdr stdarg.h`; then
10858	echo "<stdarg.h> found." >&4
10859	valstd="$define"
10860else
10861	echo "<stdarg.h> NOT found." >&4
10862	valstd="$undef"
10863fi
10864
10865: see if varargs is available
10866echo " "
10867if $test `./findhdr varargs.h`; then
10868	echo "<varargs.h> found." >&4
10869else
10870	echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10871fi
10872
10873: set up the varargs testing programs
10874$cat > varargs.c <<EOP
10875#ifdef I_STDARG
10876#include <stdarg.h>
10877#endif
10878#ifdef I_VARARGS
10879#include <varargs.h>
10880#endif
10881
10882#ifdef I_STDARG
10883int f(char *p, ...)
10884#else
10885int f(va_alist)
10886va_dcl
10887#endif
10888{
10889	va_list ap;
10890#ifndef I_STDARG
10891	char *p;
10892#endif
10893#ifdef I_STDARG
10894	va_start(ap,p);
10895#else
10896	va_start(ap);
10897	p = va_arg(ap, char *);
10898#endif
10899	va_end(ap);
10900	return 0;
10901}
10902EOP
10903$cat > varargs <<EOP
10904$startsh
10905if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10906	echo "true"
10907else
10908	echo "false"
10909fi
10910$rm -f varargs$_o
10911EOP
10912chmod +x varargs
10913
10914: now check which varargs header should be included
10915echo " "
10916i_varhdr=''
10917val=''
10918case "$valstd" in
10919"$define")
10920	if `./varargs I_STDARG`; then
10921		val='stdarg.h'
10922	elif `./varargs I_VARARGS`; then
10923		val='varargs.h'
10924	fi
10925	;;
10926*)
10927	if `./varargs I_VARARGS`; then
10928		val='varargs.h'
10929	fi
10930	;;
10931esac
10932case "$val" in
10933'')
10934	echo " "
10935	echo "*** WHOA THERE!!! ***" >&4
10936	echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10937	case "$knowitall" in
10938	'')
10939	echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10940		exit 1
10941		;;
10942	esac
10943echo "I could not find the definition for va_dcl... You have problems..." >&4
10944	val="$undef"; set i_stdarg; eval $setvar
10945	val="$undef"; set i_varargs; eval $setvar
10946	;;
10947*)
10948	set i_varhdr
10949	eval $setvar
10950	case "$i_varhdr" in
10951	stdarg.h)
10952		val="$define"; set i_stdarg; eval $setvar
10953		val="$undef"; set i_varargs; eval $setvar
10954		;;
10955	varargs.h)
10956		val="$undef"; set i_stdarg; eval $setvar
10957		val="$define"; set i_varargs; eval $setvar
10958		;;
10959	esac
10960	echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10961esac
10962$rm -f varargs*
10963
10964: see if the Compiler supports C99 variadic macros
10965case "$i_stdarg$i_stdlib" in
10966    "$define$define")
10967    echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10968    $cat >try.c <<EOCP
10969#include <stdio.h>
10970#include <stdarg.h>
10971
10972#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10973
10974int main() {
10975  char buf[20];
10976  foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10977  puts(buf);
10978  return 0;
10979}
10980EOCP
10981    set try
10982    if eval $compile && $run ./try 2>&1 >/dev/null; then
10983	case "`$run ./try`" in
10984	    "123 456 789")
10985	    echo "You have C99 variadic macros." >&4
10986	    d_c99_variadic_macros="$define"
10987	    ;;
10988	    *)
10989	    echo "You don't have functional C99 variadic macros." >&4
10990	    d_c99_variadic_macros="$undef"
10991	    ;;
10992	esac
10993    else
10994	echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10995	d_c99_variadic_macros="$undef"
10996    fi
10997    $rm_try
10998    ;;
10999    *)
11000    echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11001    d_c99_variadic_macros="$undef"
11002    ;;
11003esac
11004
11005: see if signal is declared as pointer to function returning int or void
11006echo " "
11007xxx=`./findhdr signal.h`
11008$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11009if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11010	echo "You have int (*signal())() instead of void." >&4
11011	val="$undef"
11012elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
11013	echo "You have void (*signal())()." >&4
11014	val="$define"
11015elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11016	echo "You have int (*signal())() instead of void." >&4
11017	val="$undef"
11018elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11019	echo "You have void (*signal())()." >&4
11020	val="$define"
11021else
11022	case "$d_voidsig" in
11023	'')
11024	echo "I can't determine whether signal handler returns void or int..." >&4
11025		dflt=void
11026		rp="What type does your signal handler return?"
11027		. ./myread
11028		case "$ans" in
11029		v*) val="$define";;
11030		*) val="$undef";;
11031		esac;;
11032	"$define")
11033		echo "As you already told me, signal handler returns void." >&4
11034		val="$define"
11035		;;
11036	*)	echo "As you already told me, signal handler returns int." >&4
11037		val="$undef"
11038		;;
11039	esac
11040fi
11041set d_voidsig
11042eval $setvar
11043case "$d_voidsig" in
11044"$define") signal_t="void";;
11045*) signal_t="int";;
11046esac
11047$rm -f $$.tmp
11048
11049: check for ability to cast large floats to 32-bit ints.
11050echo " "
11051echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11052if $test "$intsize" -ge 4; then
11053	xxx=int
11054else
11055	xxx=long
11056fi
11057$cat >try.c <<EOCP
11058#include <stdio.h>
11059#$i_stdlib I_STDLIB
11060#ifdef I_STDLIB
11061#include <stdlib.h>
11062#endif
11063#include <sys/types.h>
11064#include <signal.h>
11065$signal_t blech(int s) { exit(3); }
11066int main()
11067{
11068	$xxx i32;
11069	double f, g;
11070	int result = 0;
11071	char str[16];
11072	signal(SIGFPE, blech);
11073
11074	/* Don't let compiler optimize the test away.  Store the number
11075	   in a writable string for gcc to pass to sscanf under HP-UX.
11076	*/
11077	sprintf(str, "2147483647");
11078	sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11079	g = 10 * f;
11080	i32  = ($xxx) g;
11081
11082	/* x86 processors will probably give 0x8000 0000, which is a
11083	   sign change.  We don't want that.  We want to mimic SPARC
11084	   behavior here, which is to preserve the sign and give
11085	   back 0x7fff ffff.
11086	*/
11087	if (i32 != ($xxx) f)
11088		result |= 1;
11089	exit(result);
11090}
11091EOCP
11092set try
11093if eval $compile_ok; then
11094	$run ./try
11095	yyy=$?
11096else
11097	echo "(I can't seem to compile the test program--assuming it can't)"
11098	yyy=1
11099fi
11100case "$yyy" in
111010)	val="$define"
11102	echo "Yup, it can."
11103	;;
11104*)	val="$undef"
11105	echo "Nope, it can't."
11106	;;
11107esac
11108set d_casti32
11109eval $setvar
11110$rm_try
11111
11112: check for ability to cast negative floats to unsigned
11113echo " "
11114echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11115$cat >try.c <<EOCP
11116#include <stdio.h>
11117#$i_stdlib I_STDLIB
11118#ifdef I_STDLIB
11119#include <stdlib.h>
11120#endif
11121#include <sys/types.h>
11122#include <signal.h>
11123$signal_t blech(int s) { exit(7); }
11124$signal_t blech_in_list(int s) { exit(4); }
11125unsigned long dummy_long(unsigned long p) { return p; }
11126unsigned int dummy_int(unsigned int p) { return p; }
11127unsigned short dummy_short(unsigned short p) { return p; }
11128int main()
11129{
11130	double f;
11131	unsigned long along;
11132	unsigned int aint;
11133	unsigned short ashort;
11134	int result = 0;
11135	char str[16];
11136
11137	/* Frustrate gcc-2.7.2's optimizer which failed this test with
11138	   a direct f = -123. assignment.  gcc-2.8.0 reportedly
11139	   optimized the whole file away
11140	*/
11141	/* Store the number in a writable string for gcc to pass to
11142	   sscanf under HP-UX.
11143	*/
11144	sprintf(str, "-123");
11145	sscanf(str, "%lf", &f);  /* f = -123.; */
11146
11147	signal(SIGFPE, blech);
11148	along = (unsigned long)f;
11149	aint = (unsigned int)f;
11150	ashort = (unsigned short)f;
11151	if (along != (unsigned long)-123)
11152		result |= 1;
11153	if (aint != (unsigned int)-123)
11154		result |= 1;
11155	if (ashort != (unsigned short)-123)
11156		result |= 1;
11157	sprintf(str, "1073741824.");
11158	sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11159	f = f + f;
11160	along = 0;
11161	along = (unsigned long)f;
11162	if (along != 0x80000000)
11163		result |= 2;
11164	f -= 1.;
11165	along = 0;
11166	along = (unsigned long)f;
11167	if (along != 0x7fffffff)
11168		result |= 1;
11169	f += 2.;
11170	along = 0;
11171	along = (unsigned long)f;
11172	if (along != 0x80000001)
11173		result |= 2;
11174	if (result)
11175		exit(result);
11176	signal(SIGFPE, blech_in_list);
11177	sprintf(str, "123.");
11178	sscanf(str, "%lf", &f);  /* f = 123.; */
11179	along = dummy_long((unsigned long)f);
11180	aint = dummy_int((unsigned int)f);
11181	ashort = dummy_short((unsigned short)f);
11182	if (along != (unsigned long)123)
11183		result |= 4;
11184	if (aint != (unsigned int)123)
11185		result |= 4;
11186	if (ashort != (unsigned short)123)
11187		result |= 4;
11188	exit(result);
11189
11190}
11191EOCP
11192set try
11193if eval $compile_ok; then
11194	$run ./try
11195	castflags=$?
11196else
11197	echo "(I can't seem to compile the test program--assuming it can't)"
11198	castflags=7
11199fi
11200case "$castflags" in
112010)	val="$define"
11202	echo "Yup, it can."
11203	;;
11204*)	val="$undef"
11205	echo "Nope, it can't."
11206	;;
11207esac
11208set d_castneg
11209eval $setvar
11210$rm_try
11211
11212: see if vprintf exists
11213echo " "
11214if set vprintf val -f d_vprintf; eval $csym; $val; then
11215	echo 'vprintf() found.' >&4
11216	val="$define"
11217	$cat >try.c <<EOF
11218#$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11219#$i_varargs I_VARARGS
11220
11221#$i_stdlib I_STDLIB
11222#$i_unistd I_UNISTD
11223
11224#ifdef I_STDARG
11225#  include <stdarg.h>
11226#else /* I_VARARGS */
11227#  include <varargs.h>
11228#endif
11229
11230#ifdef I_UNISTD
11231#  include <unistd.h>
11232#endif
11233
11234#ifdef I_STDLIB
11235#  include <stdlib.h>
11236#endif
11237
11238#include <stdio.h> /* vsprintf prototype */
11239
11240#ifdef I_STDARG
11241void xxx(int n, ...)
11242{
11243    va_list args;
11244    char buf[10];
11245    va_start(args, n);
11246    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11247}
11248int main() { xxx(1, "foo"); }
11249
11250#else /* I_VARARGS */
11251
11252xxx(va_alist)
11253va_dcl
11254{
11255    va_list args;
11256    char buf[10];
11257    va_start(args);
11258    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11259}
11260int main() { xxx("foo"); }
11261
11262#endif
11263
11264EOF
11265	set try
11266	if eval $compile_ok; then
11267		if $run ./try; then
11268			echo "Your vsprintf() returns (int)." >&4
11269			val2="$undef"
11270		else
11271			echo "Your vsprintf() returns (char*)." >&4
11272			val2="$define"
11273		fi
11274	else
11275		echo 'I am unable to compile the vsprintf() test program.' >&4
11276		# We shouldn't get here.  If we do, assume the standard signature,
11277		# not the old BSD one.
11278		echo 'Guessing that vsprintf() returns (int).' >&4
11279		val2="$undef"
11280	fi
11281else
11282	echo 'vprintf() NOT found.' >&4
11283	val="$undef"
11284	val2="$undef"
11285fi
11286$rm_try
11287set d_vprintf
11288eval $setvar
11289val=$val2
11290set d_charvspr
11291eval $setvar
11292
11293: see if chown exists
11294set chown d_chown
11295eval $inlibc
11296
11297: see if chroot exists
11298set chroot d_chroot
11299eval $inlibc
11300
11301: see if chsize exists
11302set chsize d_chsize
11303eval $inlibc
11304
11305: see if class exists
11306set class d_class
11307eval $inlibc
11308
11309: see if clearenv exists
11310set clearenv d_clearenv
11311eval $inlibc
11312
11313: Define hasstruct macro for Configure internal use
11314hasstruct='varname=$1; struct=$2; shift; shift;
11315while $test $# -ge 2; do
11316	case "$1" in
11317	$define) echo "#include <$2>";;
11318	esac ;
11319    shift 2;
11320done > try.c;
11321echo "int main () { struct $struct foo; }" >> try.c;
11322set try;
11323if eval $compile; then
11324	val="$define";
11325else
11326	val="$undef";
11327fi;
11328set $varname;
11329eval $setvar;
11330$rm_try'
11331
11332: see whether socket exists
11333socketlib=''
11334sockethdr=''
11335echo " "
11336$echo $n "Hmm... $c" >&4
11337if set socket val -f d_socket; eval $csym; $val; then
11338	echo "Looks like you have Berkeley networking support." >&4
11339	d_socket="$define"
11340	if set setsockopt val -f; eval $csym; $val; then
11341		d_oldsock="$undef"
11342	else
11343		echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11344		d_oldsock="$define"
11345	fi
11346else
11347	if $contains socklib libc.list >/dev/null 2>&1; then
11348		echo "Looks like you have Berkeley networking support." >&4
11349		d_socket="$define"
11350		: we will have to assume that it supports the 4.2 BSD interface
11351		d_oldsock="$undef"
11352	else
11353		echo "You don't have Berkeley networking in libc$_a..." >&4
11354		if test "X$d_socket" = "X$define"; then
11355		   echo "...but you seem to believe that you have sockets." >&4
11356		else
11357			for net in net socket
11358			do
11359				if test -f /usr/lib/lib$net$_a; then
11360					( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11361					$ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11362					if $contains socket libc.list >/dev/null 2>&1; then
11363						d_socket="$define"
11364						socketlib="-l$net"
11365						case "$net" in
11366						net)
11367							echo "...but the Wollongong group seems to have hacked it in." >&4
11368							sockethdr="-I/usr/netinclude"
11369							;;
11370						esac
11371						echo "Found Berkeley sockets interface in lib$net." >&4
11372						if $contains setsockopt libc.list >/dev/null 2>&1; then
11373							d_oldsock="$undef"
11374						else
11375							echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11376							d_oldsock="$define"
11377						fi
11378						break
11379					fi
11380				fi
11381			done
11382			if test "X$d_socket" != "X$define"; then
11383			   echo "or anywhere else I see." >&4
11384			   d_socket="$undef"
11385			   d_oldsock="$undef"
11386			fi
11387		fi
11388	fi
11389fi
11390
11391: see if socketpair exists
11392set socketpair d_sockpair
11393eval $inlibc
11394
11395
11396echo " "
11397echo "Checking the availability sa_len in the sock struct ..." >&4
11398$cat >try.c <<EOF
11399#include <sys/types.h>
11400#include <sys/socket.h>
11401int main() {
11402struct sockaddr sa;
11403return (sa.sa_len);
11404}
11405EOF
11406val="$undef"
11407set try; if eval $compile; then
11408	val="$define"
11409fi
11410set d_sockaddr_sa_len; eval $setvar
11411$rm_try
11412
11413echo " "
11414echo "Checking the availability struct sockaddr_in6 ..." >&4
11415$cat >try.c <<EOF
11416#include <sys/types.h>
11417#include <sys/socket.h>
11418#include <netinet/in.h>
11419int main() {
11420struct sockaddr_in6 sin6;
11421return (sin6.sin6_family);
11422}
11423EOF
11424val="$undef"
11425set try; if eval $compile; then
11426	val="$define"
11427fi
11428set d_sockaddr_in6; eval $setvar
11429$rm_try
11430
11431echo " "
11432echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11433$cat >try.c <<EOF
11434#include <sys/types.h>
11435#include <sys/socket.h>
11436#include <netinet/in.h>
11437int main() {
11438struct sockaddr_in6 sin6;
11439return (sin6.sin6_scope_id);
11440}
11441EOF
11442val="$undef"
11443set try; if eval $compile; then
11444	val="$define"
11445fi
11446set d_sin6_scope_id; eval $setvar
11447$rm_try
11448
11449echo " "
11450echo "Checking the availability struct ip_mreq ..." >&4
11451$cat >try.c <<EOF
11452#include <sys/types.h>
11453#include <sys/socket.h>
11454#include <netinet/in.h>
11455int main() {
11456struct ip_mreq mreq;
11457return (mreq.imr_multiaddr.s_addr);
11458}
11459EOF
11460val="$undef"
11461set try; if eval $compile; then
11462       val="$define"
11463fi
11464set d_ip_mreq; eval $setvar
11465$rm_try
11466
11467echo " "
11468echo "Checking the availability struct ip_mreq_source ..." >&4
11469$cat >try.c <<EOF
11470#include <sys/types.h>
11471#include <sys/socket.h>
11472#include <netinet/in.h>
11473int main() {
11474struct ip_mreq_source mreq;
11475return (mreq.imr_multiaddr.s_addr);
11476}
11477EOF
11478val="$undef"
11479set try; if eval $compile; then
11480       val="$define"
11481fi
11482set d_ip_mreq_source; eval $setvar
11483$rm_try
11484
11485echo " "
11486echo "Checking the availability struct ipv6_mreq ..." >&4
11487$cat >try.c <<EOF
11488#include <sys/types.h>
11489#include <sys/socket.h>
11490#include <netinet/in.h>
11491int main() {
11492struct ipv6_mreq mreq;
11493return (mreq.ipv6mr_interface);
11494}
11495EOF
11496val="$undef"
11497set try; if eval $compile; then
11498	val="$define"
11499fi
11500set d_ipv6_mreq; eval $setvar
11501$rm_try
11502
11503echo " "
11504echo "Checking the availability struct ipv6_mreq_source ..." >&4
11505$cat >try.c <<EOF
11506#include <sys/types.h>
11507#include <sys/socket.h>
11508#include <netinet/in.h>
11509int main() {
11510struct ipv6_mreq_source mreq;
11511return (mreq.imr_multiaddr.s_addr);
11512}
11513EOF
11514val="$undef"
11515set try; if eval $compile; then
11516       val="$define"
11517fi
11518set d_ipv6_mreq_source; eval $setvar
11519$rm_try
11520
11521echo " "
11522echo "Checking the availability of certain socket constants..." >&4
11523for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11524	enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11525	$cat >try.c <<EOF
11526#include <sys/types.h>
11527#include <sys/socket.h>
11528int main() {
11529    int i = $ENUM;
11530}
11531EOF
11532	val="$undef"
11533	set try; if eval $compile; then
11534		val="$define"
11535	fi
11536	set d_${enum}; eval $setvar
11537	$rm_try
11538done
11539
11540: see if this is a sys/uio.h system
11541set sys/uio.h i_sysuio
11542eval $inhdr
11543
11544: Check for cmsghdr support
11545echo " "
11546echo "Checking to see if your system supports struct cmsghdr..." >&4
11547set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11548eval $hasstruct
11549case "$d_cmsghdr_s" in
11550"$define")      echo "Yes, it does."   ;;
11551*)              echo "No, it doesn't." ;;
11552esac
11553
11554
11555: check for const keyword
11556echo " "
11557echo 'Checking to see if your C compiler knows about "const"...' >&4
11558$cat >const.c <<'EOCP'
11559typedef struct spug { int drokk; } spug;
11560int main()
11561{
11562	const char *foo;
11563	const spug y = { 0 };
11564}
11565EOCP
11566if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11567	val="$define"
11568	echo "Yup, it does."
11569else
11570	val="$undef"
11571	echo "Nope, it doesn't."
11572fi
11573set d_const
11574eval $setvar
11575
11576: see if copysignl exists
11577set copysignl d_copysignl
11578eval $inlibc
11579
11580: see if crypt exists
11581echo " "
11582set crypt d_crypt
11583eval $inlibc
11584case "$d_crypt" in
11585$define) cryptlib='' ;;
11586*)	if set crypt val -f d_crypt; eval $csym; $val; then
11587		echo 'crypt() found.' >&4
11588		val="$define"
11589		cryptlib=''
11590	else
11591		cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11592		if $test -z "$cryptlib"; then
11593			cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11594		else
11595			cryptlib=-lcrypt
11596		fi
11597		if $test -z "$cryptlib"; then
11598			cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11599		else
11600			cryptlib=-lcrypt
11601		fi
11602		if $test -z "$cryptlib"; then
11603			cryptlib=`./loc libcrypt$_a "" $libpth`
11604		else
11605			cryptlib=-lcrypt
11606		fi
11607		if $test -z "$cryptlib"; then
11608			echo 'crypt() NOT found.' >&4
11609			val="$undef"
11610		else
11611			val="$define"
11612		fi
11613	fi
11614	set d_crypt
11615	eval $setvar
11616	;;
11617esac
11618
11619: see if this is a crypt.h system
11620set crypt.h i_crypt
11621eval $inhdr
11622
11623: see if crypt_r exists
11624set crypt_r d_crypt_r
11625eval $inlibc
11626case "$d_crypt_r" in
11627"$define")
11628	hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11629	case "$d_crypt_r_proto:$usethreads" in
11630	":define")	d_crypt_r_proto=define
11631		set d_crypt_r_proto crypt_r $hdrs
11632		eval $hasproto ;;
11633	*)	;;
11634	esac
11635	case "$d_crypt_r_proto" in
11636	define)
11637	case "$crypt_r_proto" in
11638	''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11639	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11640	esac
11641	case "$crypt_r_proto" in
11642	''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11643	./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11644	esac
11645	case "$crypt_r_proto" in
11646	''|0)	d_crypt_r=undef
11647 	        crypt_r_proto=0
11648		echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11649	* )	case "$crypt_r_proto" in
11650		REENTRANT_PROTO*) ;;
11651		*) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11652		esac
11653		echo "Prototype: $try" ;;
11654	esac
11655	;;
11656	*)	case "$usethreads" in
11657		define) echo "crypt_r has no prototype, not using it." >&4 ;;
11658		esac
11659		d_crypt_r=undef
11660		crypt_r_proto=0
11661		;;
11662	esac
11663	;;
11664*)	crypt_r_proto=0
11665	;;
11666esac
11667
11668: get csh whereabouts
11669case "$csh" in
11670'csh') val="$undef" ;;
11671*) val="$define" ;;
11672esac
11673set d_csh
11674eval $setvar
11675: Respect a hint or command line value for full_csh.
11676case "$full_csh" in
11677'') full_csh=$csh ;;
11678esac
11679
11680: see if ctermid exists
11681set ctermid d_ctermid
11682eval $inlibc
11683
11684: see if ctermid_r exists
11685set ctermid_r d_ctermid_r
11686eval $inlibc
11687case "$d_ctermid_r" in
11688"$define")
11689	hdrs="$i_systypes sys/types.h define stdio.h "
11690	case "$d_ctermid_r_proto:$usethreads" in
11691	":define")	d_ctermid_r_proto=define
11692		set d_ctermid_r_proto ctermid_r $hdrs
11693		eval $hasproto ;;
11694	*)	;;
11695	esac
11696	case "$d_ctermid_r_proto" in
11697	define)
11698	case "$ctermid_r_proto" in
11699	''|0) try='char* ctermid_r(char*);'
11700	./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11701	esac
11702	case "$ctermid_r_proto" in
11703	''|0)	d_ctermid_r=undef
11704 	        ctermid_r_proto=0
11705		echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11706	* )	case "$ctermid_r_proto" in
11707		REENTRANT_PROTO*) ;;
11708		*) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11709		esac
11710		echo "Prototype: $try" ;;
11711	esac
11712	;;
11713	*)	case "$usethreads" in
11714		define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11715		esac
11716		d_ctermid_r=undef
11717		ctermid_r_proto=0
11718		;;
11719	esac
11720	;;
11721*)	ctermid_r_proto=0
11722	;;
11723esac
11724
11725: see if ctime_r exists
11726set ctime_r d_ctime_r
11727eval $inlibc
11728case "$d_ctime_r" in
11729"$define")
11730	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11731	case "$d_ctime_r_proto:$usethreads" in
11732	":define")	d_ctime_r_proto=define
11733		set d_ctime_r_proto ctime_r $hdrs
11734		eval $hasproto ;;
11735	*)	;;
11736	esac
11737	case "$d_ctime_r_proto" in
11738	define)
11739	case "$ctime_r_proto" in
11740	''|0) try='char* ctime_r(const time_t*, char*);'
11741	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11742	esac
11743	case "$ctime_r_proto" in
11744	''|0) try='char* ctime_r(const time_t*, char*, int);'
11745	./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11746	esac
11747	case "$ctime_r_proto" in
11748	''|0) try='int ctime_r(const time_t*, char*);'
11749	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11750	esac
11751	case "$ctime_r_proto" in
11752	''|0) try='int ctime_r(const time_t*, char*, int);'
11753	./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11754	esac
11755	case "$ctime_r_proto" in
11756	''|0)	d_ctime_r=undef
11757 	        ctime_r_proto=0
11758		echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11759	* )	case "$ctime_r_proto" in
11760		REENTRANT_PROTO*) ;;
11761		*) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11762		esac
11763		echo "Prototype: $try" ;;
11764	esac
11765	;;
11766	*)	case "$usethreads" in
11767		define) echo "ctime_r has no prototype, not using it." >&4 ;;
11768		esac
11769		d_ctime_r=undef
11770		ctime_r_proto=0
11771		;;
11772	esac
11773	;;
11774*)	ctime_r_proto=0
11775	;;
11776esac
11777
11778: see if cuserid exists
11779set cuserid d_cuserid
11780eval $inlibc
11781
11782: see if this is a limits.h system
11783set limits.h i_limits
11784eval $inhdr
11785
11786: see if this is a float.h system
11787set float.h i_float
11788eval $inhdr
11789
11790: See if number of significant digits in a double precision number is known
11791echo " "
11792$cat >dbl_dig.c <<EOM
11793#$i_limits I_LIMITS
11794#$i_float I_FLOAT
11795#ifdef I_LIMITS
11796#include <limits.h>
11797#endif
11798#ifdef I_FLOAT
11799#include <float.h>
11800#endif
11801#ifdef DBL_DIG
11802printf("Contains DBL_DIG");
11803#endif
11804EOM
11805$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11806if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11807	echo "DBL_DIG found." >&4
11808	val="$define"
11809else
11810	echo "DBL_DIG NOT found." >&4
11811	val="$undef"
11812fi
11813$rm -f dbl_dig.?
11814set d_dbl_dig
11815eval $setvar
11816
11817: see if dbm.h is available
11818: see if dbmclose exists
11819set dbmclose d_dbmclose
11820eval $inlibc
11821
11822case "$d_dbmclose" in
11823$define)
11824	set dbm.h i_dbm
11825	eval $inhdr
11826	case "$i_dbm" in
11827	$define)
11828		val="$undef"
11829		set i_rpcsvcdbm
11830		eval $setvar
11831		;;
11832	*)	set rpcsvc/dbm.h i_rpcsvcdbm
11833		eval $inhdr
11834		;;
11835	esac
11836	;;
11837*)	echo "We won't be including <dbm.h>"
11838	val="$undef"
11839	set i_dbm
11840	eval $setvar
11841	val="$undef"
11842	set i_rpcsvcdbm
11843	eval $setvar
11844	;;
11845esac
11846
11847: see if prototype for dbminit is available
11848echo " "
11849set d_dbminitproto dbminit $i_dbm dbm.h
11850eval $hasproto
11851
11852: see if difftime exists
11853set difftime d_difftime
11854eval $inlibc
11855
11856: see if this is a dirent system
11857echo " "
11858if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11859	val="$define"
11860	echo "<dirent.h> found." >&4
11861else
11862	val="$undef"
11863	if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11864		echo "<sys/dir.h> found." >&4
11865		echo " "
11866	else
11867		xinc=`./findhdr sys/ndir.h`
11868	fi
11869	echo "<dirent.h> NOT found." >&4
11870fi
11871set i_dirent
11872eval $setvar
11873
11874: Look for type of directory structure.
11875echo " "
11876$cppstdin $cppflags $cppminus < "$xinc" > try.c
11877
11878case "$direntrytype" in
11879''|' ')
11880	case "$i_dirent" in
11881	$define) guess1='struct dirent' ;;
11882	*) guess1='struct direct'  ;;
11883	esac
11884	;;
11885*)	guess1="$direntrytype"
11886	;;
11887esac
11888
11889case "$guess1" in
11890'struct dirent') guess2='struct direct' ;;
11891*) guess2='struct dirent' ;;
11892esac
11893
11894if $contains "$guess1" try.c >/dev/null 2>&1; then
11895	direntrytype="$guess1"
11896	echo "Your directory entries are $direntrytype." >&4
11897elif $contains "$guess2" try.c >/dev/null 2>&1; then
11898	direntrytype="$guess2"
11899	echo "Your directory entries seem to be $direntrytype." >&4
11900else
11901	echo "I don't recognize your system's directory entries." >&4
11902	rp="What type is used for directory entries on this system?"
11903	dflt="$guess1"
11904	. ./myread
11905	direntrytype="$ans"
11906fi
11907$rm_try
11908
11909: see if the directory entry stores field length
11910echo " "
11911$cppstdin $cppflags $cppminus < "$xinc" > try.c
11912if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11913	echo "Good, your directory entry keeps length information in d_namlen." >&4
11914	val="$define"
11915else
11916	echo "Your directory entry does not know about the d_namlen field." >&4
11917	val="$undef"
11918fi
11919set d_dirnamlen
11920eval $setvar
11921$rm_try
11922
11923: Look for DIR.dd_fd
11924case "$i_dirent" in
11925"$define")
11926    echo "Checking to see if DIR has a dd_fd member variable" >&4
11927    $cat >try.c <<EOCP
11928#$i_stdlib I_STDLIB
11929#ifdef I_STDLIB
11930#include <stdlib.h>
11931#endif
11932#include <dirent.h>
11933
11934int main() {
11935    DIR dir;
11936    dir.dd_fd = 1;
11937    return 0;
11938}
11939EOCP
11940    val=$undef
11941    set try
11942    if eval $compile; then
11943        echo "Yes, it does."
11944        val="$define"
11945    else
11946        echo "No, it does not."
11947        val="$undef"
11948    fi
11949    ;;
11950*)
11951    echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11952    val="$undef"
11953    ;;
11954esac
11955set d_dir_dd_fd
11956eval $setvar
11957$rm_try
11958
11959: see if this is an sysdir system
11960set sys/dir.h i_sysdir
11961eval $inhdr
11962
11963: see if this is an sysndir system
11964set sys/ndir.h i_sysndir
11965eval $inhdr
11966
11967: Look for dirfd
11968echo " "
11969$cat >dirfd.c <<EOM
11970#include <stdio.h>
11971#$i_stdlib I_STDLIB
11972#ifdef I_STDLIB
11973#include <stdlib.h>
11974#endif
11975#$i_dirent I_DIRENT		/**/
11976#$i_sysdir I_SYS_DIR		/**/
11977#$i_sysndir I_SYS_NDIR		/**/
11978#$i_systypes I_SYS_TYPES	/**/
11979#if defined(I_SYS_TYPES)
11980#include <sys/types.h>
11981#endif
11982#if defined(I_DIRENT)
11983#include <dirent.h>
11984#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11985#include <sys/dir.h>
11986#endif
11987#else
11988#ifdef I_SYS_NDIR
11989#include <sys/ndir.h>
11990#else
11991#ifdef I_SYS_DIR
11992#ifdef hp9000s500
11993#include <ndir.h>	/* may be wrong in the future */
11994#else
11995#include <sys/dir.h>
11996#endif
11997#endif
11998#endif
11999#endif
12000int main() {
12001	DIR *dirp = opendir(".");
12002	if (dirfd(dirp) >= 0)
12003		exit(0);
12004	else
12005		exit(1);
12006}
12007EOM
12008val=$undef
12009set dirfd
12010if eval $compile; then
12011	val="$define"
12012fi
12013case "$val" in
12014$define)	echo "dirfd() found." >&4	;;
12015*)		echo "dirfd() NOT found." >&4	;;
12016esac
12017set d_dirfd
12018eval $setvar
12019$rm -f dirfd*
12020
12021: see if dlerror exists
12022xxx_runnm="$runnm"
12023runnm=false
12024set dlerror d_dlerror
12025eval $inlibc
12026runnm="$xxx_runnm"
12027
12028: see if dlfcn is available
12029set dlfcn.h i_dlfcn
12030eval $inhdr
12031
12032: Check what extension to use for shared libs
12033case "$usedl" in
12034$define|y|true)
12035	$cat << EOM
12036
12037On a few systems, the dynamically loaded modules that perl generates and uses
12038will need a different extension than shared libs. The default will probably
12039be appropriate.
12040
12041EOM
12042	case "$dlext" in
12043	'')	dflt="$so" ;;
12044	*)	dflt="$dlext" ;;
12045	esac
12046	rp='What is the extension of dynamically loaded modules'
12047	. ./myread
12048	dlext="$ans"
12049	;;
12050*)
12051	dlext="none"
12052	;;
12053esac
12054
12055: Check if dlsym need a leading underscore
12056echo " "
12057val="$undef"
12058
12059case "$dlsrc" in
12060dl_dlopen.xs)
12061	echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12062	$cat >dyna.c <<'EOM'
12063fred () { }
12064EOM
12065
12066$cat >fred.c<<EOM
12067
12068#include <stdio.h>
12069#$i_stdlib I_STDLIB
12070#ifdef I_STDLIB
12071#include <stdlib.h>
12072#endif
12073#$i_dlfcn I_DLFCN
12074#ifdef I_DLFCN
12075#include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12076#else
12077#include <sys/types.h>
12078#include <nlist.h>
12079#include <link.h>
12080#endif
12081
12082extern int fred() ;
12083
12084int main()
12085{
12086    void * handle ;
12087    void * symbol ;
12088#ifndef RTLD_LAZY
12089    int mode = 1 ;
12090#else
12091    int mode = RTLD_LAZY ;
12092#endif
12093    handle = dlopen("./dyna.$dlext", mode) ;
12094    if (handle == NULL) {
12095	printf ("1\n") ;
12096	fflush (stdout) ;
12097	exit(0);
12098    }
12099    symbol = dlsym(handle, "fred") ;
12100    if (symbol == NULL) {
12101	/* try putting a leading underscore */
12102	symbol = dlsym(handle, "_fred") ;
12103	if (symbol == NULL) {
12104	    printf ("2\n") ;
12105	    fflush (stdout) ;
12106	    exit(0);
12107	}
12108	printf ("3\n") ;
12109    }
12110    else
12111	printf ("4\n") ;
12112    fflush (stdout) ;
12113    exit(0);
12114}
12115EOM
12116	: Call the object file tmp-dyna.o in case dlext=o.
12117	if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12118		mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12119		$ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12120		$cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12121		xxx=`$run ./fred`
12122		case $xxx in
12123		1)	echo "Test program failed using dlopen." >&4
12124			echo "Perhaps you should not use dynamic loading." >&4;;
12125		2)	echo "Test program failed using dlsym." >&4
12126			echo "Perhaps you should not use dynamic loading." >&4;;
12127		3)	echo "dlsym needs a leading underscore" >&4
12128			val="$define" ;;
12129		4)	echo "dlsym doesn't need a leading underscore." >&4;;
12130		esac
12131	else
12132		echo "I can't compile and run the test program." >&4
12133                echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12134	fi
12135	;;
12136esac
12137
12138$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12139
12140set d_dlsymun
12141eval $setvar
12142
12143: see if drand48_r exists
12144set drand48_r d_drand48_r
12145eval $inlibc
12146case "$d_drand48_r" in
12147"$define")
12148	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12149	case "$d_drand48_r_proto:$usethreads" in
12150	":define")	d_drand48_r_proto=define
12151		set d_drand48_r_proto drand48_r $hdrs
12152		eval $hasproto ;;
12153	*)	;;
12154	esac
12155	case "$d_drand48_r_proto" in
12156	define)
12157	case "$drand48_r_proto" in
12158	''|0) try='int drand48_r(struct drand48_data*, double*);'
12159	./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12160	esac
12161	case "$drand48_r_proto" in
12162	''|0)	d_drand48_r=undef
12163 	        drand48_r_proto=0
12164		echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12165	* )	case "$drand48_r_proto" in
12166		REENTRANT_PROTO*) ;;
12167		*) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12168		esac
12169		echo "Prototype: $try" ;;
12170	esac
12171	;;
12172	*)	case "$usethreads" in
12173		define) echo "drand48_r has no prototype, not using it." >&4 ;;
12174		esac
12175		d_drand48_r=undef
12176		drand48_r_proto=0
12177		;;
12178	esac
12179	;;
12180*)	drand48_r_proto=0
12181	;;
12182esac
12183
12184: see if prototype for drand48 is available
12185echo " "
12186set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12187eval $hasproto
12188
12189: see if dup2 exists
12190set dup2 d_dup2
12191eval $inlibc
12192
12193: see if eaccess exists
12194set eaccess d_eaccess
12195eval $inlibc
12196
12197: see if endgrent exists
12198set endgrent d_endgrent
12199eval $inlibc
12200
12201: see if this is an grp system
12202set grp.h i_grp
12203eval $inhdr
12204
12205case "$i_grp" in
12206$define)
12207	xxx=`./findhdr grp.h`
12208	$cppstdin $cppflags $cppminus < $xxx >$$.h
12209
12210	if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12211		val="$define"
12212	else
12213		val="$undef"
12214	fi
12215	set d_grpasswd
12216	eval $setvar
12217
12218	$rm -f $$.h
12219	;;
12220*)
12221	val="$undef";
12222	set d_grpasswd; eval $setvar
12223	;;
12224esac
12225
12226: see if endgrent_r exists
12227set endgrent_r d_endgrent_r
12228eval $inlibc
12229case "$d_endgrent_r" in
12230"$define")
12231	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12232	case "$d_endgrent_r_proto:$usethreads" in
12233	":define")	d_endgrent_r_proto=define
12234		set d_endgrent_r_proto endgrent_r $hdrs
12235		eval $hasproto ;;
12236	*)	;;
12237	esac
12238	case "$d_endgrent_r_proto" in
12239	define)
12240	case "$endgrent_r_proto" in
12241	''|0) try='int endgrent_r(FILE**);'
12242	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12243	esac
12244	case "$endgrent_r_proto" in
12245	''|0) try='void endgrent_r(FILE**);'
12246	./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12247	esac
12248	case "$endgrent_r_proto" in
12249	''|0)	d_endgrent_r=undef
12250 	        endgrent_r_proto=0
12251		echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12252	* )	case "$endgrent_r_proto" in
12253		REENTRANT_PROTO*) ;;
12254		*) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12255		esac
12256		echo "Prototype: $try" ;;
12257	esac
12258	;;
12259	*)	case "$usethreads" in
12260		define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12261		esac
12262		d_endgrent_r=undef
12263		endgrent_r_proto=0
12264		;;
12265	esac
12266	;;
12267*)	endgrent_r_proto=0
12268	;;
12269esac
12270
12271: see if endhostent exists
12272set endhostent d_endhent
12273eval $inlibc
12274
12275: see if this is a netdb.h system
12276set netdb.h i_netdb
12277eval $inhdr
12278
12279: see if endhostent_r exists
12280set endhostent_r d_endhostent_r
12281eval $inlibc
12282case "$d_endhostent_r" in
12283"$define")
12284	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12285	case "$d_endhostent_r_proto:$usethreads" in
12286	":define")	d_endhostent_r_proto=define
12287		set d_endhostent_r_proto endhostent_r $hdrs
12288		eval $hasproto ;;
12289	*)	;;
12290	esac
12291	case "$d_endhostent_r_proto" in
12292	define)
12293	case "$endhostent_r_proto" in
12294	''|0) try='int endhostent_r(struct hostent_data*);'
12295	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12296	esac
12297	case "$endhostent_r_proto" in
12298	''|0) try='void endhostent_r(struct hostent_data*);'
12299	./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12300	esac
12301	case "$endhostent_r_proto" in
12302	''|0)	d_endhostent_r=undef
12303 	        endhostent_r_proto=0
12304		echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12305	* )	case "$endhostent_r_proto" in
12306		REENTRANT_PROTO*) ;;
12307		*) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12308		esac
12309		echo "Prototype: $try" ;;
12310	esac
12311	;;
12312	*)	case "$usethreads" in
12313		define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12314		esac
12315		d_endhostent_r=undef
12316		endhostent_r_proto=0
12317		;;
12318	esac
12319	;;
12320*)	endhostent_r_proto=0
12321	;;
12322esac
12323
12324: see if endnetent exists
12325set endnetent d_endnent
12326eval $inlibc
12327
12328: see if endnetent_r exists
12329set endnetent_r d_endnetent_r
12330eval $inlibc
12331case "$d_endnetent_r" in
12332"$define")
12333	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12334	case "$d_endnetent_r_proto:$usethreads" in
12335	":define")	d_endnetent_r_proto=define
12336		set d_endnetent_r_proto endnetent_r $hdrs
12337		eval $hasproto ;;
12338	*)	;;
12339	esac
12340	case "$d_endnetent_r_proto" in
12341	define)
12342	case "$endnetent_r_proto" in
12343	''|0) try='int endnetent_r(struct netent_data*);'
12344	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12345	esac
12346	case "$endnetent_r_proto" in
12347	''|0) try='void endnetent_r(struct netent_data*);'
12348	./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12349	esac
12350	case "$endnetent_r_proto" in
12351	''|0)	d_endnetent_r=undef
12352 	        endnetent_r_proto=0
12353		echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12354	* )	case "$endnetent_r_proto" in
12355		REENTRANT_PROTO*) ;;
12356		*) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12357		esac
12358		echo "Prototype: $try" ;;
12359	esac
12360	;;
12361	*)	case "$usethreads" in
12362		define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12363		esac
12364		d_endnetent_r=undef
12365		endnetent_r_proto=0
12366		;;
12367	esac
12368	;;
12369*)	endnetent_r_proto=0
12370	;;
12371esac
12372
12373: see if endprotoent exists
12374set endprotoent d_endpent
12375eval $inlibc
12376
12377: see if endprotoent_r exists
12378set endprotoent_r d_endprotoent_r
12379eval $inlibc
12380case "$d_endprotoent_r" in
12381"$define")
12382	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12383	case "$d_endprotoent_r_proto:$usethreads" in
12384	":define")	d_endprotoent_r_proto=define
12385		set d_endprotoent_r_proto endprotoent_r $hdrs
12386		eval $hasproto ;;
12387	*)	;;
12388	esac
12389	case "$d_endprotoent_r_proto" in
12390	define)
12391	case "$endprotoent_r_proto" in
12392	''|0) try='int endprotoent_r(struct protoent_data*);'
12393	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12394	esac
12395	case "$endprotoent_r_proto" in
12396	''|0) try='void endprotoent_r(struct protoent_data*);'
12397	./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12398	esac
12399	case "$endprotoent_r_proto" in
12400	''|0)	d_endprotoent_r=undef
12401 	        endprotoent_r_proto=0
12402		echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12403	* )	case "$endprotoent_r_proto" in
12404		REENTRANT_PROTO*) ;;
12405		*) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12406		esac
12407		echo "Prototype: $try" ;;
12408	esac
12409	;;
12410	*)	case "$usethreads" in
12411		define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12412		esac
12413		d_endprotoent_r=undef
12414		endprotoent_r_proto=0
12415		;;
12416	esac
12417	;;
12418*)	endprotoent_r_proto=0
12419	;;
12420esac
12421
12422: see if endpwent exists
12423set endpwent d_endpwent
12424eval $inlibc
12425
12426: see if this is a pwd.h system
12427set pwd.h i_pwd
12428eval $inhdr
12429
12430case "$i_pwd" in
12431$define)
12432	xxx=`./findhdr pwd.h`
12433	$cppstdin $cppflags $cppminus < $xxx >$$.h
12434
12435	if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12436		val="$define"
12437	else
12438		val="$undef"
12439	fi
12440	set d_pwquota
12441	eval $setvar
12442
12443	if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12444		val="$define"
12445	else
12446		val="$undef"
12447	fi
12448	set d_pwage
12449	eval $setvar
12450
12451	if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12452		val="$define"
12453	else
12454		val="$undef"
12455	fi
12456	set d_pwchange
12457	eval $setvar
12458
12459	if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12460		val="$define"
12461	else
12462		val="$undef"
12463	fi
12464	set d_pwclass
12465	eval $setvar
12466
12467	if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12468		val="$define"
12469	else
12470		val="$undef"
12471	fi
12472	set d_pwexpire
12473	eval $setvar
12474
12475	if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12476		val="$define"
12477	else
12478		val="$undef"
12479	fi
12480	set d_pwcomment
12481	eval $setvar
12482
12483	if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12484		val="$define"
12485	else
12486		val="$undef"
12487	fi
12488	set d_pwgecos
12489	eval $setvar
12490
12491	if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12492		val="$define"
12493	else
12494		val="$undef"
12495	fi
12496	set d_pwpasswd
12497	eval $setvar
12498
12499	$rm -f $$.h
12500	;;
12501*)
12502	val="$undef";
12503	set d_pwquota; eval $setvar
12504	set d_pwage; eval $setvar
12505	set d_pwchange; eval $setvar
12506	set d_pwclass; eval $setvar
12507	set d_pwexpire; eval $setvar
12508	set d_pwcomment; eval $setvar
12509	set d_pwgecos; eval $setvar
12510	set d_pwpasswd; eval $setvar
12511	;;
12512esac
12513
12514: see if endpwent_r exists
12515set endpwent_r d_endpwent_r
12516eval $inlibc
12517case "$d_endpwent_r" in
12518"$define")
12519	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12520	case "$d_endpwent_r_proto:$usethreads" in
12521	":define")	d_endpwent_r_proto=define
12522		set d_endpwent_r_proto endpwent_r $hdrs
12523		eval $hasproto ;;
12524	*)	;;
12525	esac
12526	case "$d_endpwent_r_proto" in
12527	define)
12528	case "$endpwent_r_proto" in
12529	''|0) try='int endpwent_r(FILE**);'
12530	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12531	esac
12532	case "$endpwent_r_proto" in
12533	''|0) try='void endpwent_r(FILE**);'
12534	./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12535	esac
12536	case "$endpwent_r_proto" in
12537	''|0)	d_endpwent_r=undef
12538 	        endpwent_r_proto=0
12539		echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12540	* )	case "$endpwent_r_proto" in
12541		REENTRANT_PROTO*) ;;
12542		*) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12543		esac
12544		echo "Prototype: $try" ;;
12545	esac
12546	;;
12547	*)	case "$usethreads" in
12548		define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12549		esac
12550		d_endpwent_r=undef
12551		endpwent_r_proto=0
12552		;;
12553	esac
12554	;;
12555*)	endpwent_r_proto=0
12556	;;
12557esac
12558
12559: see if endservent exists
12560set endservent d_endsent
12561eval $inlibc
12562
12563: see if endservent_r exists
12564set endservent_r d_endservent_r
12565eval $inlibc
12566case "$d_endservent_r" in
12567"$define")
12568	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12569	case "$d_endservent_r_proto:$usethreads" in
12570	":define")	d_endservent_r_proto=define
12571		set d_endservent_r_proto endservent_r $hdrs
12572		eval $hasproto ;;
12573	*)	;;
12574	esac
12575	case "$d_endservent_r_proto" in
12576	define)
12577	case "$endservent_r_proto" in
12578	''|0) try='int endservent_r(struct servent_data*);'
12579	./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12580	esac
12581	case "$endservent_r_proto" in
12582	''|0) try='void endservent_r(struct servent_data*);'
12583	./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12584	esac
12585	case "$endservent_r_proto" in
12586	''|0)	d_endservent_r=undef
12587 	        endservent_r_proto=0
12588		echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12589	* )	case "$endservent_r_proto" in
12590		REENTRANT_PROTO*) ;;
12591		*) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12592		esac
12593		echo "Prototype: $try" ;;
12594	esac
12595	;;
12596	*)	case "$usethreads" in
12597		define) echo "endservent_r has no prototype, not using it." >&4 ;;
12598		esac
12599		d_endservent_r=undef
12600		endservent_r_proto=0
12601		;;
12602	esac
12603	;;
12604*)	endservent_r_proto=0
12605	;;
12606esac
12607
12608: Locate the flags for 'open()'
12609echo " "
12610$cat >try.c <<EOCP
12611#include <sys/types.h>
12612#ifdef I_FCNTL
12613#include <fcntl.h>
12614#endif
12615#ifdef I_SYS_FILE
12616#include <sys/file.h>
12617#endif
12618#$i_stdlib I_STDLIB
12619#ifdef I_STDLIB
12620#include <stdlib.h>
12621#endif
12622int main() {
12623	if(O_RDONLY);
12624#ifdef O_TRUNC
12625	exit(0);
12626#else
12627	exit(1);
12628#endif
12629}
12630EOCP
12631: check sys/file.h first to get FREAD on Sun
12632if $test `./findhdr sys/file.h` && \
12633		set try -DI_SYS_FILE && eval $compile; then
12634	h_sysfile=true;
12635	echo "<sys/file.h> defines the O_* constants..." >&4
12636	if $run ./try; then
12637		echo "and you have the 3 argument form of open()." >&4
12638		val="$define"
12639	else
12640		echo "but not the 3 argument form of open().  Oh, well." >&4
12641		val="$undef"
12642	fi
12643elif $test `./findhdr fcntl.h` && \
12644		set try -DI_FCNTL && eval $compile; then
12645	h_fcntl=true;
12646	echo "<fcntl.h> defines the O_* constants..." >&4
12647	if $run ./try; then
12648		echo "and you have the 3 argument form of open()." >&4
12649		val="$define"
12650	else
12651		echo "but not the 3 argument form of open().  Oh, well." >&4
12652		val="$undef"
12653	fi
12654else
12655	val="$undef"
12656	echo "I can't find the O_* constant definitions!  You got problems." >&4
12657fi
12658set d_open3
12659eval $setvar
12660$rm_try
12661
12662: see if this is a sys/file.h system
12663val=''
12664set sys/file.h val
12665eval $inhdr
12666
12667: do we need to include sys/file.h ?
12668case "$val" in
12669"$define")
12670	echo " "
12671	if $h_sysfile; then
12672		val="$define"
12673		echo "We'll be including <sys/file.h>." >&4
12674	else
12675		val="$undef"
12676		echo "We won't be including <sys/file.h>." >&4
12677	fi
12678	;;
12679*)
12680	h_sysfile=false
12681	;;
12682esac
12683set i_sysfile
12684eval $setvar
12685
12686: see if fcntl.h is there
12687val=''
12688set fcntl.h val
12689eval $inhdr
12690
12691: see if we can include fcntl.h
12692case "$val" in
12693"$define")
12694	echo " "
12695	if $h_fcntl; then
12696		val="$define"
12697		echo "We'll be including <fcntl.h>." >&4
12698	else
12699		val="$undef"
12700		if $h_sysfile; then
12701	echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12702		else
12703			echo "We won't be including <fcntl.h>." >&4
12704		fi
12705	fi
12706	;;
12707*)
12708	h_fcntl=false
12709	val="$undef"
12710	;;
12711esac
12712set i_fcntl
12713eval $setvar
12714
12715: see if fork exists
12716set fork d_fork
12717eval $inlibc
12718
12719: see if pipe exists
12720set pipe d_pipe
12721eval $inlibc
12722
12723: check for non-blocking I/O stuff
12724case "$h_sysfile" in
12725true) echo "#include <sys/file.h>" > head.c;;
12726*)
12727       case "$h_fcntl" in
12728       true) echo "#include <fcntl.h>" > head.c;;
12729       *) echo "#include <sys/fcntl.h>" > head.c;;
12730       esac
12731       ;;
12732esac
12733echo " "
12734echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12735case "$o_nonblock" in
12736'')
12737	$cat head.c > try.c
12738	$cat >>try.c <<EOCP
12739#include <stdio.h>
12740#$i_stdlib I_STDLIB
12741#ifdef I_STDLIB
12742#include <stdlib.h>
12743#endif
12744#$i_fcntl I_FCNTL
12745#ifdef I_FCNTL
12746#include <fcntl.h>
12747#endif
12748int main() {
12749#ifdef O_NONBLOCK
12750	printf("O_NONBLOCK\n");
12751	exit(0);
12752#endif
12753#ifdef O_NDELAY
12754	printf("O_NDELAY\n");
12755	exit(0);
12756#endif
12757#ifdef FNDELAY
12758	printf("FNDELAY\n");
12759	exit(0);
12760#endif
12761	exit(0);
12762}
12763EOCP
12764	set try
12765	if eval $compile_ok; then
12766		o_nonblock=`$run ./try`
12767		case "$o_nonblock" in
12768		'') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12769		*) echo "Seems like we can use $o_nonblock.";;
12770		esac
12771	else
12772		echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12773	fi
12774	;;
12775*) echo "Using $hint value $o_nonblock.";;
12776esac
12777$rm_try
12778
12779echo " "
12780echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12781case "$eagain" in
12782'')
12783	case "$d_fork:$d_pipe" in
12784	define:define)
12785	$cat head.c > try.c
12786	$cat >>try.c <<EOCP
12787#include <errno.h>
12788#include <sys/types.h>
12789#include <signal.h>
12790#include <stdio.h>
12791#$i_stdlib I_STDLIB
12792#ifdef I_STDLIB
12793#include <stdlib.h>
12794#endif
12795#$i_fcntl I_FCNTL
12796#ifdef I_FCNTL
12797#include <fcntl.h>
12798#endif
12799#define MY_O_NONBLOCK $o_nonblock
12800#ifndef errno  /* XXX need better Configure test */
12801extern int errno;
12802#endif
12803#$i_unistd I_UNISTD
12804#ifdef I_UNISTD
12805#include <unistd.h>
12806#endif
12807#$i_string I_STRING
12808#ifdef I_STRING
12809#include <string.h>
12810#else
12811#include <strings.h>
12812#endif
12813$signal_t blech(int x) { exit(3); }
12814EOCP
12815	$cat >> try.c <<'EOCP'
12816int main()
12817{
12818	int pd[2];
12819	int pu[2];
12820	char buf[1];
12821	char string[100];
12822
12823	pipe(pd);	/* Down: child -> parent */
12824	pipe(pu);	/* Up: parent -> child */
12825	if (0 != fork()) {
12826		int ret;
12827		close(pd[1]);	/* Parent reads from pd[0] */
12828		close(pu[0]);	/* Parent writes (blocking) to pu[1] */
12829#ifdef F_SETFL
12830		if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12831			exit(1);
12832#else
12833		exit(4);
12834#endif
12835		signal(SIGALRM, blech);
12836		alarm(5);
12837		if ((ret = read(pd[0], buf, 1)) > 0)	/* Nothing to read! */
12838			exit(2);
12839		sprintf(string, "%d\n", ret);
12840		write(2, string, strlen(string));
12841		alarm(0);
12842#ifdef EAGAIN
12843		if (errno == EAGAIN) {
12844			printf("EAGAIN\n");
12845			goto ok;
12846		}
12847#endif
12848#ifdef EWOULDBLOCK
12849		if (errno == EWOULDBLOCK)
12850			printf("EWOULDBLOCK\n");
12851#endif
12852	ok:
12853		write(pu[1], buf, 1);	/* Unblocks child, tell it to close our pipe */
12854		sleep(2);				/* Give it time to close our pipe */
12855		alarm(5);
12856		ret = read(pd[0], buf, 1);	/* Should read EOF */
12857		alarm(0);
12858		sprintf(string, "%d\n", ret);
12859		write(4, string, strlen(string));
12860		exit(0);
12861	}
12862
12863	close(pd[0]);			/* We write to pd[1] */
12864	close(pu[1]);			/* We read from pu[0] */
12865	read(pu[0], buf, 1);	/* Wait for parent to signal us we may continue */
12866	close(pd[1]);			/* Pipe pd is now fully closed! */
12867	exit(0);				/* Bye bye, thank you for playing! */
12868}
12869EOCP
12870	set try
12871	if eval $compile_ok; then
12872		echo "$startsh" >mtry
12873		echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12874		chmod +x mtry
12875		./mtry >/dev/null 2>&1
12876		case $? in
12877		0) eagain=`$cat try.out`;;
12878		1) echo "Could not perform non-blocking setting!";;
12879		2) echo "I did a successful read() for something that was not there!";;
12880		3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12881		4) echo "Could not find F_SETFL!";;
12882		*) echo "Something terribly wrong happened during testing.";;
12883		esac
12884		rd_nodata=`$cat try.ret`
12885		echo "A read() system call with no data present returns $rd_nodata."
12886		case "$rd_nodata" in
12887		0|-1) ;;
12888		*)
12889			echo "(That's peculiar, fixing that to be -1.)"
12890			rd_nodata=-1
12891			;;
12892		esac
12893		case "$eagain" in
12894		'')
12895			echo "Forcing errno EAGAIN on read() with no data available."
12896			eagain=EAGAIN
12897			;;
12898		*)
12899			echo "Your read() sets errno to $eagain when no data is available."
12900			;;
12901		esac
12902		status=`$cat try.err`
12903		case "$status" in
12904		0) echo "And it correctly returns 0 to signal EOF.";;
12905		-1) echo "But it also returns -1 to signal EOF, so be careful!";;
12906		*) echo "However, your read() returns '$status' on EOF??";;
12907		esac
12908		val="$define"
12909		if test "$status" = "$rd_nodata"; then
12910			echo "WARNING: you can't distinguish between EOF and no data!"
12911			val="$undef"
12912		fi
12913	else
12914		echo "I can't compile the test program--assuming errno EAGAIN will do."
12915		eagain=EAGAIN
12916	fi
12917	;;
12918	*)	echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12919		eagain=EAGAIN
12920		val="$define"
12921		;;
12922	esac
12923	set d_eofnblk
12924	eval $setvar
12925	;;
12926*)
12927	echo "Using $hint value $eagain."
12928	echo "Your read() returns $rd_nodata when no data is present."
12929	case "$d_eofnblk" in
12930	"$define") echo "And you can see EOF because read() returns 0.";;
12931	"$undef") echo "But you can't see EOF status from read() returned value.";;
12932	*)
12933		echo "(Assuming you can't see EOF status from read anyway.)"
12934		d_eofnblk=$undef
12935		;;
12936	esac
12937	;;
12938esac
12939$rm_try head.c mtry
12940
12941: see if _ptr and _cnt from stdio act std
12942echo " "
12943
12944if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12945	echo "(Looks like you have stdio.h from BSD.)"
12946	case "$stdio_ptr" in
12947	'') stdio_ptr='((fp)->_p)'
12948		ptr_lval=$define
12949		;;
12950	*)	ptr_lval=$d_stdio_ptr_lval;;
12951	esac
12952	case "$stdio_cnt" in
12953	'') stdio_cnt='((fp)->_r)'
12954		cnt_lval=$define
12955		;;
12956	*)	cnt_lval=$d_stdio_cnt_lval;;
12957	esac
12958	case "$stdio_base" in
12959	'') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12960	esac
12961	case "$stdio_bufsiz" in
12962	'') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12963	esac
12964elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12965	echo "(Looks like you have stdio.h from Linux.)"
12966	case "$stdio_ptr" in
12967	'') stdio_ptr='((fp)->_IO_read_ptr)'
12968		ptr_lval=$define
12969		;;
12970	*)	ptr_lval=$d_stdio_ptr_lval;;
12971	esac
12972	case "$stdio_cnt" in
12973	'') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12974		cnt_lval=$undef
12975		;;
12976	*)	cnt_lval=$d_stdio_cnt_lval;;
12977	esac
12978	case "$stdio_base" in
12979	'') stdio_base='((fp)->_IO_read_base)';;
12980	esac
12981	case "$stdio_bufsiz" in
12982	'') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12983	esac
12984else
12985	case "$stdio_ptr" in
12986	'') stdio_ptr='((fp)->_ptr)'
12987		ptr_lval=$define
12988		;;
12989	*)	ptr_lval=$d_stdio_ptr_lval;;
12990	esac
12991	case "$stdio_cnt" in
12992	'') stdio_cnt='((fp)->_cnt)'
12993		cnt_lval=$define
12994		;;
12995	*)	cnt_lval=$d_stdio_cnt_lval;;
12996	esac
12997	case "$stdio_base" in
12998	'') stdio_base='((fp)->_base)';;
12999	esac
13000	case "$stdio_bufsiz" in
13001	'') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13002	esac
13003fi
13004
13005: test whether _ptr and _cnt really work
13006echo "Checking how std your stdio is..." >&4
13007$cat >try.c <<EOP
13008#include <stdio.h>
13009#$i_stdlib I_STDLIB
13010#ifdef I_STDLIB
13011#include <stdlib.h>
13012#endif
13013#define FILE_ptr(fp)	$stdio_ptr
13014#define FILE_cnt(fp)	$stdio_cnt
13015int main() {
13016	FILE *fp = fopen("try.c", "r");
13017	char c = getc(fp);
13018	if (
13019		18 <= FILE_cnt(fp) &&
13020		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13021	)
13022		exit(0);
13023	exit(1);
13024}
13025EOP
13026val="$undef"
13027set try
13028if eval $compile && $to try.c; then
13029	if $run ./try; then
13030		echo "Your stdio acts pretty std."
13031		val="$define"
13032	else
13033		echo "Your stdio isn't very std."
13034	fi
13035else
13036	echo "Your stdio doesn't appear very std."
13037fi
13038$rm_try
13039
13040# glibc 2.2.90 and above apparently change stdio streams so Perl's
13041# direct buffer manipulation no longer works.  The Configure tests
13042# should be changed to correctly detect this, but until then,
13043# the following check should at least let perl compile and run.
13044# (This quick fix should be updated before 5.8.1.)
13045# To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13046# A. Dougherty, June 3, 2002.
13047case "$d_gnulibc" in
13048$define)
13049	case "$gnulibc_version" in
13050	2.[01]*)  ;;
13051	2.2) ;;
13052	2.2.[0-9]) ;;
13053	*)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13054		val="$undef"
13055		;;
13056	esac
13057	;;
13058esac
13059set d_stdstdio
13060eval $setvar
13061
13062: Can _ptr be used as an lvalue?
13063case "$d_stdstdio$ptr_lval" in
13064$define$define) val=$define ;;
13065*) val=$undef ;;
13066esac
13067set d_stdio_ptr_lval
13068eval $setvar
13069
13070: Can _cnt be used as an lvalue?
13071case "$d_stdstdio$cnt_lval" in
13072$define$define) val=$define ;;
13073*) val=$undef ;;
13074esac
13075set d_stdio_cnt_lval
13076eval $setvar
13077
13078
13079: test whether setting _ptr sets _cnt as a side effect
13080d_stdio_ptr_lval_sets_cnt="$undef"
13081d_stdio_ptr_lval_nochange_cnt="$undef"
13082case "$d_stdio_ptr_lval$d_stdstdio" in
13083$define$define)
13084	echo "Checking to see what happens if we set the stdio ptr..." >&4
13085$cat >try.c <<EOP
13086#include <stdio.h>
13087/* Can we scream? */
13088/* Eat dust sed :-) */
13089/* In the buffer space, no one can hear you scream. */
13090#$i_stdlib I_STDLIB
13091#ifdef I_STDLIB
13092#include <stdlib.h>
13093#endif
13094#define FILE_ptr(fp)	$stdio_ptr
13095#define FILE_cnt(fp)	$stdio_cnt
13096#include <sys/types.h>
13097int main() {
13098	FILE *fp = fopen("try.c", "r");
13099	int c;
13100	char *ptr;
13101	size_t cnt;
13102	if (!fp) {
13103	    puts("Fail even to read");
13104	    exit(1);
13105	}
13106	c = getc(fp); /* Read away the first # */
13107	if (c == EOF) {
13108	    puts("Fail even to read");
13109	    exit(1);
13110	}
13111	if (!(
13112		18 <= FILE_cnt(fp) &&
13113		strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13114	)) {
13115		puts("Fail even to read");
13116		exit (1);
13117	}
13118	ptr = (char*) FILE_ptr(fp);
13119	cnt = (size_t)FILE_cnt(fp);
13120
13121	FILE_ptr(fp) += 42;
13122
13123	if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13124		printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13125		exit (1);
13126	}
13127	if (FILE_cnt(fp) <= 20) {
13128		printf ("Fail (<20 chars to test)");
13129		exit (1);
13130	}
13131	if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13132		puts("Fail compare");
13133		exit (1);
13134	}
13135	if (cnt == FILE_cnt(fp)) {
13136		puts("Pass_unchanged");
13137		exit (0);
13138	}
13139	if (FILE_cnt(fp) == (cnt - 42)) {
13140		puts("Pass_changed");
13141		exit (0);
13142	}
13143	printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13144	return 1;
13145
13146}
13147EOP
13148	set try
13149	if eval $compile && $to try.c; then
13150 		case `$run ./try` in
13151		Pass_changed)
13152			echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13153			d_stdio_ptr_lval_sets_cnt="$define" ;;
13154		Pass_unchanged)
13155			echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13156			d_stdio_ptr_lval_nochange_cnt="$define" ;;
13157		Fail*)
13158			echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13159		*)
13160			echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13161	esac
13162	else
13163		echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13164	fi
13165	$rm_try
13166	;;
13167esac
13168
13169: see if _base is also standard
13170val="$undef"
13171case "$d_stdstdio" in
13172$define)
13173	$cat >try.c <<EOP
13174#include <stdio.h>
13175#$i_stdlib I_STDLIB
13176#ifdef I_STDLIB
13177#include <stdlib.h>
13178#endif
13179#define FILE_base(fp)	$stdio_base
13180#define FILE_bufsiz(fp)	$stdio_bufsiz
13181int main() {
13182	FILE *fp = fopen("try.c", "r");
13183	char c = getc(fp);
13184	if (
13185		19 <= FILE_bufsiz(fp) &&
13186		strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13187	)
13188		exit(0);
13189	exit(1);
13190}
13191EOP
13192	set try
13193	if eval $compile && $to try.c; then
13194		if $run ./try; then
13195			echo "And its _base field acts std."
13196			val="$define"
13197		else
13198			echo "But its _base field isn't std."
13199		fi
13200	else
13201		echo "However, it seems to be lacking the _base field."
13202	fi
13203	$rm_try
13204	;;
13205esac
13206set d_stdiobase
13207eval $setvar
13208
13209: see if fast_stdio exists
13210val="$undef"
13211case "$d_stdstdio:$d_stdio_ptr_lval" in
13212"$define:$define")
13213	case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13214	*$define*)
13215		echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13216		val="$define"
13217		;;
13218	esac
13219	;;
13220esac
13221set d_faststdio
13222eval $setvar
13223
13224
13225
13226: see if fchdir exists
13227set fchdir d_fchdir
13228eval $inlibc
13229
13230: see if fchmod exists
13231set fchmod d_fchmod
13232eval $inlibc
13233
13234: see if fchown exists
13235set fchown d_fchown
13236eval $inlibc
13237
13238: see if this is an fcntl system
13239set fcntl d_fcntl
13240eval $inlibc
13241
13242: See if fcntl-based locking works.
13243echo " "
13244$cat >try.c <<EOCP
13245#$i_stdlib I_STDLIB
13246#ifdef I_STDLIB
13247#include <stdlib.h>
13248#endif
13249#include <unistd.h>
13250#include <fcntl.h>
13251#include <signal.h>
13252$signal_t blech(int x) { exit(3); }
13253int main() {
13254#if defined(F_SETLK) && defined(F_SETLKW)
13255     struct flock flock;
13256     int retval, fd;
13257     fd = open("try.c", O_RDONLY);
13258     flock.l_type = F_RDLCK;
13259     flock.l_whence = SEEK_SET;
13260     flock.l_start = flock.l_len = 0;
13261     signal(SIGALRM, blech);
13262     alarm(10);
13263     retval = fcntl(fd, F_SETLK, &flock);
13264     close(fd);
13265     (retval < 0 ? exit(2) : exit(0));
13266#else
13267     exit(2);
13268#endif
13269}
13270EOCP
13271echo "Checking if fcntl-based file locking works... "
13272case "$d_fcntl" in
13273"$define")
13274	set try
13275	if eval $compile_ok; then
13276		if $run ./try; then
13277			echo "Yes, it seems to work."
13278			val="$define"
13279		else
13280			echo "Nope, it didn't work."
13281			val="$undef"
13282			case "$?" in
13283			3) $cat >&4 <<EOM
13284***
13285*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13286*** This is (almost) impossible.
13287*** If your NFS lock daemons are not feeling well, something like
13288*** this may happen, please investigate.  Cannot continue, aborting.
13289***
13290EOM
13291				exit 1
13292				;;
13293			esac
13294		fi
13295	else
13296		echo "I'm unable to compile the test program, so I'll assume not."
13297		val="$undef"
13298	fi
13299	;;
13300*) val="$undef";
13301	echo "Nope, since you don't even have fcntl()."
13302	;;
13303esac
13304set d_fcntl_can_lock
13305eval $setvar
13306$rm_try
13307
13308: check for fd_set items
13309$cat <<EOM
13310
13311Checking to see how well your C compiler handles fd_set and friends ...
13312EOM
13313$cat >try.c <<EOCP
13314#$i_stdlib I_STDLIB
13315#ifdef I_STDLIB
13316#include <stdlib.h>
13317#endif
13318#$i_systime I_SYS_TIME
13319#$i_sysselct I_SYS_SELECT
13320#$d_socket HAS_SOCKET
13321#include <sys/types.h>
13322#ifdef HAS_SOCKET
13323#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13324#endif
13325#ifdef I_SYS_TIME
13326#include <sys/time.h>
13327#endif
13328#ifdef I_SYS_SELECT
13329#include <sys/select.h>
13330#endif
13331int main() {
13332	fd_set fds;
13333
13334#ifdef TRYBITS
13335	if(fds.fds_bits);
13336#endif
13337
13338#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13339	exit(0);
13340#else
13341	exit(1);
13342#endif
13343}
13344EOCP
13345set try -DTRYBITS
13346if eval $compile; then
13347	d_fds_bits="$define"
13348	d_fd_set="$define"
13349	echo "Well, your system knows about the normal fd_set typedef..." >&4
13350	if $run ./try; then
13351		echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13352		d_fd_macros="$define"
13353	else
13354		$cat >&4 <<'EOM'
13355but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13356EOM
13357		d_fd_macros="$undef"
13358	fi
13359else
13360	$cat <<'EOM'
13361Hmm, your compiler has some difficulty with fd_set.  Checking further...
13362EOM
13363	set try
13364	if eval $compile; then
13365		d_fds_bits="$undef"
13366		d_fd_set="$define"
13367		echo "Well, your system has some sort of fd_set available..." >&4
13368		if $run ./try; then
13369			echo "and you have the normal fd_set macros." >&4
13370			d_fd_macros="$define"
13371		else
13372			$cat <<'EOM'
13373but not the normal fd_set macros!  Gross!  More work for me...
13374EOM
13375			d_fd_macros="$undef"
13376		fi
13377	else
13378	echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13379		d_fd_set="$undef"
13380		d_fds_bits="$undef"
13381		d_fd_macros="$undef"
13382	fi
13383fi
13384$rm_try
13385
13386: see if fgetpos exists
13387set fgetpos d_fgetpos
13388eval $inlibc
13389
13390: see if finite exists
13391set finite d_finite
13392eval $inlibc
13393
13394: see if finitel exists
13395set finitel d_finitel
13396eval $inlibc
13397
13398: see if flock exists
13399set flock d_flock
13400eval $inlibc
13401
13402: see if prototype for flock is available
13403echo " "
13404set d_flockproto flock $i_sysfile sys/file.h
13405eval $hasproto
13406
13407: see if fp_class exists
13408set fp_class d_fp_class
13409eval $inlibc
13410
13411: see if pathconf exists
13412set pathconf d_pathconf
13413eval $inlibc
13414
13415: see if fpathconf exists
13416set fpathconf d_fpathconf
13417eval $inlibc
13418
13419: see if fpclass exists
13420set fpclass d_fpclass
13421eval $inlibc
13422
13423: see if fpclassify exists
13424set fpclassify d_fpclassify
13425eval $inlibc
13426
13427: see if fpclassl exists
13428set fpclassl d_fpclassl
13429eval $inlibc
13430
13431: check for fpos64_t
13432echo " "
13433echo "Checking to see if you have fpos64_t..." >&4
13434$cat >try.c <<EOCP
13435#include <stdio.h>
13436int main() { fpos64_t x = 7; }
13437EOCP
13438set try
13439if eval $compile; then
13440	val="$define"
13441	echo "You have fpos64_t."
13442else
13443	val="$undef"
13444	echo "You do not have fpos64_t."
13445	case "$fpossize" in
13446	8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13447	esac
13448fi
13449$rm_try
13450set d_fpos64_t
13451eval $setvar
13452
13453: see if frexpl exists
13454set frexpl d_frexpl
13455eval $inlibc
13456
13457: see if this is a sys/param system
13458set sys/param.h i_sysparam
13459eval $inhdr
13460
13461: see if this is a sys/mount.h system
13462set sys/mount.h i_sysmount
13463eval $inhdr
13464
13465: Check for fs_data_s
13466echo " "
13467echo "Checking to see if your system supports struct fs_data..." >&4
13468set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13469eval $hasstruct
13470case "$d_fs_data_s" in
13471"$define")      echo "Yes, it does."   ;;
13472*)              echo "No, it doesn't." ;;
13473esac
13474
13475: see if fseeko exists
13476set fseeko d_fseeko
13477eval $inlibc
13478case "$longsize" in
134798) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13480esac
13481
13482: see if fsetpos exists
13483set fsetpos d_fsetpos
13484eval $inlibc
13485
13486: see if fstatfs exists
13487set fstatfs d_fstatfs
13488eval $inlibc
13489
13490: see if statvfs exists
13491set statvfs d_statvfs
13492eval $inlibc
13493
13494: see if fstatvfs exists
13495set fstatvfs d_fstatvfs
13496eval $inlibc
13497
13498
13499: see if fsync exists
13500set fsync d_fsync
13501eval $inlibc
13502
13503: see if ftello exists
13504set ftello d_ftello
13505eval $inlibc
13506case "$longsize" in
135078) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13508esac
13509
13510: check for a working futimes
13511d_futimes="$undef"
13512echo " "
13513echo "Checking if you have a working futimes()" >&4
13514$cat >try.c <<EOCP
13515#include <stdio.h>
13516#include <sys/time.h>
13517#include <errno.h>
13518#include <fcntl.h>
13519
13520int main ()
13521{
13522    int fd, rv;
13523    fd = open ("try.c", O_RDWR);
13524    if (-1 == fd) exit (1);
13525    rv = futimes (fd, NULL);
13526    exit (rv == -1 ? errno : 0);
13527}
13528EOCP
13529set try
13530if eval $compile; then
13531    `$run ./try`
13532    rc=$?
13533    case "$rc" in
13534	0)  echo "Yes, you have" >&4
13535	    d_futimes="$define"
13536	    ;;
13537	*)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13538	    ;;
13539    esac
13540else
13541    echo "No, it does not (probably harmless)" >&4
13542fi
13543$rm_try
13544
13545: see if ndbm.h is available
13546set ndbm.h i_ndbm
13547eval $inhdr
13548: Compatibility location for RedHat 7.1
13549set gdbm/ndbm.h i_gdbmndbm
13550eval $inhdr
13551: Compatibility location for Debian 4.0
13552set gdbm-ndbm.h i_gdbm_ndbm
13553eval $inhdr
13554
13555val="$undef"
13556if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13557	: see if dbm_open exists
13558	set dbm_open d_dbm_open
13559	eval $inlibc
13560	case "$d_dbm_open" in
13561	$undef)
13562		i_ndbm="$undef"
13563		i_gdbmndbm="$undef"
13564		i_gdbm_ndbm="$undef"
13565		echo "We won't be including <ndbm.h>"
13566		val="$undef"
13567		;;
13568	*) val="$define"
13569	   ;;
13570	esac
13571fi
13572set d_ndbm
13573eval $setvar
13574
13575ndbm_hdr_protochk='name=$1; hdr=$2;
13576eval "ihdr=\$""i_$name";
13577val="$undef";
13578if $test "$ihdr" = "$define"; then
13579	$echo "Checking if your <$hdr> uses prototypes..." >&4;
13580	case "$d_cplusplus" in
13581	$define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13582	*) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13583	esac;
13584	case "$val" in
13585	$define) $echo "Your <$hdr> seems to have prototypes";;
13586	*) $echo "Your <$hdr> does not seem to have prototypes";;
13587	esac;
13588fi;
13589set "d_${name}_h_uses_prototypes";
13590eval $setvar'
13591
13592set ndbm ndbm.h
13593eval $ndbm_hdr_protochk
13594set gdbmndbm gdbm/ndbm.h
13595eval $ndbm_hdr_protochk
13596set gdbm_ndbm gdbm-ndbm.h
13597eval $ndbm_hdr_protochk
13598
13599: see if getaddrinfo exists
13600set getaddrinfo d_getaddrinfo
13601eval $inlibc
13602
13603: see if getcwd exists
13604set getcwd d_getcwd
13605eval $inlibc
13606
13607: see if getespwnam exists
13608set getespwnam d_getespwnam
13609eval $inlibc
13610
13611: see if getfsstat exists
13612set getfsstat d_getfsstat
13613eval $inlibc
13614
13615: see if getgrent exists
13616set getgrent d_getgrent
13617eval $inlibc
13618
13619: see if getgrent_r exists
13620set getgrent_r d_getgrent_r
13621eval $inlibc
13622case "$d_getgrent_r" in
13623"$define")
13624	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13625	case "$d_getgrent_r_proto:$usethreads" in
13626	":define")	d_getgrent_r_proto=define
13627		set d_getgrent_r_proto getgrent_r $hdrs
13628		eval $hasproto ;;
13629	*)	;;
13630	esac
13631	case "$d_getgrent_r_proto" in
13632	define)
13633	case "$getgrent_r_proto" in
13634	''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13635	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13636	esac
13637	case "$getgrent_r_proto" in
13638	''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13639	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13640	esac
13641	case "$getgrent_r_proto" in
13642	''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13643	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13644	esac
13645	case "$getgrent_r_proto" in
13646	''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13647	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13648	esac
13649	case "$getgrent_r_proto" in
13650	''|0) try='int getgrent_r(struct group*, char*, int);'
13651	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13652	esac
13653	case "$getgrent_r_proto" in
13654	''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13655	./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13656	esac
13657	case "$getgrent_r_proto" in
13658	''|0)	d_getgrent_r=undef
13659 	        getgrent_r_proto=0
13660		echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13661	* )	case "$getgrent_r_proto" in
13662		REENTRANT_PROTO*) ;;
13663		*) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13664		esac
13665		echo "Prototype: $try" ;;
13666	esac
13667	;;
13668	*)	case "$usethreads" in
13669		define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13670		esac
13671		d_getgrent_r=undef
13672		getgrent_r_proto=0
13673		;;
13674	esac
13675	;;
13676*)	getgrent_r_proto=0
13677	;;
13678esac
13679
13680: see if getgrgid_r exists
13681set getgrgid_r d_getgrgid_r
13682eval $inlibc
13683case "$d_getgrgid_r" in
13684"$define")
13685	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13686	case "$d_getgrgid_r_proto:$usethreads" in
13687	":define")	d_getgrgid_r_proto=define
13688		set d_getgrgid_r_proto getgrgid_r $hdrs
13689		eval $hasproto ;;
13690	*)	;;
13691	esac
13692	case "$d_getgrgid_r_proto" in
13693	define)
13694	case "$getgrgid_r_proto" in
13695	''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13696	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13697	esac
13698	case "$getgrgid_r_proto" in
13699	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13700	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13701	esac
13702	case "$getgrgid_r_proto" in
13703	''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13704	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13705	esac
13706	case "$getgrgid_r_proto" in
13707	''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13708	./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13709	esac
13710	case "$getgrgid_r_proto" in
13711	''|0)	d_getgrgid_r=undef
13712 	        getgrgid_r_proto=0
13713		echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13714	* )	case "$getgrgid_r_proto" in
13715		REENTRANT_PROTO*) ;;
13716		*) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13717		esac
13718		echo "Prototype: $try" ;;
13719	esac
13720	;;
13721	*)	case "$usethreads" in
13722		define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13723		esac
13724		d_getgrgid_r=undef
13725		getgrgid_r_proto=0
13726		;;
13727	esac
13728	;;
13729*)	getgrgid_r_proto=0
13730	;;
13731esac
13732
13733: see if getgrnam_r exists
13734set getgrnam_r d_getgrnam_r
13735eval $inlibc
13736case "$d_getgrnam_r" in
13737"$define")
13738	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13739	case "$d_getgrnam_r_proto:$usethreads" in
13740	":define")	d_getgrnam_r_proto=define
13741		set d_getgrnam_r_proto getgrnam_r $hdrs
13742		eval $hasproto ;;
13743	*)	;;
13744	esac
13745	case "$d_getgrnam_r_proto" in
13746	define)
13747	case "$getgrnam_r_proto" in
13748	''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13749	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13750	esac
13751	case "$getgrnam_r_proto" in
13752	''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13753	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13754	esac
13755	case "$getgrnam_r_proto" in
13756	''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13757	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13758	esac
13759	case "$getgrnam_r_proto" in
13760	''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13761	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13762	esac
13763	case "$getgrnam_r_proto" in
13764	''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13765	./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13766	esac
13767	case "$getgrnam_r_proto" in
13768	''|0)	d_getgrnam_r=undef
13769 	        getgrnam_r_proto=0
13770		echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13771	* )	case "$getgrnam_r_proto" in
13772		REENTRANT_PROTO*) ;;
13773		*) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13774		esac
13775		echo "Prototype: $try" ;;
13776	esac
13777	;;
13778	*)	case "$usethreads" in
13779		define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13780		esac
13781		d_getgrnam_r=undef
13782		getgrnam_r_proto=0
13783		;;
13784	esac
13785	;;
13786*)	getgrnam_r_proto=0
13787	;;
13788esac
13789
13790: see if gethostbyaddr exists
13791set gethostbyaddr d_gethbyaddr
13792eval $inlibc
13793
13794: see if gethostbyname exists
13795set gethostbyname d_gethbyname
13796eval $inlibc
13797
13798: see if gethostent exists
13799set gethostent d_gethent
13800eval $inlibc
13801
13802: see how we will look up host name
13803echo " "
13804call=''
13805if set gethostname val -f d_gethname; eval $csym; $val; then
13806	echo 'gethostname() found.' >&4
13807	d_gethname="$define"
13808	call=gethostname
13809fi
13810if set uname val -f d_uname; eval $csym; $val; then
13811	if ./xenix; then
13812		$cat <<'EOM'
13813uname() was found, but you're running xenix, and older versions of xenix
13814have a broken uname(). If you don't really know whether your xenix is old
13815enough to have a broken system call, use the default answer.
13816
13817EOM
13818		dflt=y
13819		case "$d_uname" in
13820		"$define") dflt=n;;
13821		esac
13822		rp='Is your uname() broken?'
13823		. ./myread
13824		case "$ans" in
13825		n*) d_uname="$define"; call=uname;;
13826		esac
13827	else
13828		echo 'uname() found.' >&4
13829		d_uname="$define"
13830		case "$call" in
13831		'') call=uname ;;
13832		esac
13833	fi
13834fi
13835case "$d_gethname" in
13836'') d_gethname="$undef";;
13837esac
13838case "$d_uname" in
13839'') d_uname="$undef";;
13840esac
13841case "$d_uname$d_gethname" in
13842*define*)
13843	dflt=n
13844	cat <<EOM
13845
13846Every now and then someone has a $call() that lies about the hostname
13847but can't be fixed for political or economic reasons.  If you wish, I can
13848pretend $call() isn't there and maybe compute hostname at run-time
13849thanks to the '$phostname' command.
13850
13851EOM
13852	rp="Shall I ignore $call() from now on?"
13853	. ./myread
13854	case "$ans" in
13855	y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13856	esac;;
13857esac
13858case "$phostname" in
13859'') aphostname='';;
13860*) case "$aphostname" in
13861	/*) ;;
13862	*) set X $phostname
13863		shift
13864		file=$1
13865		shift
13866		file=`./loc $file $file $pth`
13867		aphostname=`echo $file $*`
13868		;;
13869	esac
13870	;;
13871esac
13872case "$d_uname$d_gethname" in
13873*define*) ;;
13874*)
13875	case "$phostname" in
13876	'')
13877		echo "There will be no way for $package to get your hostname." >&4;;
13878	*)
13879	echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13880		;;
13881	esac;;
13882esac
13883case "$d_phostname" in
13884'') d_phostname="$undef";;
13885esac
13886
13887: see if gethostbyaddr_r exists
13888set gethostbyaddr_r d_gethostbyaddr_r
13889eval $inlibc
13890case "$d_gethostbyaddr_r" in
13891"$define")
13892	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13893	case "$d_gethostbyaddr_r_proto:$usethreads" in
13894	":define")	d_gethostbyaddr_r_proto=define
13895		set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13896		eval $hasproto ;;
13897	*)	;;
13898	esac
13899	case "$d_gethostbyaddr_r_proto" in
13900	define)
13901	case "$gethostbyaddr_r_proto" in
13902	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13903	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13904	esac
13905	case "$gethostbyaddr_r_proto" in
13906	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13907	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13908	esac
13909	case "$gethostbyaddr_r_proto" in
13910	''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13911	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13912	esac
13913	case "$gethostbyaddr_r_proto" in
13914	''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13915	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13916	esac
13917	case "$gethostbyaddr_r_proto" in
13918	''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13919	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13920	esac
13921	case "$gethostbyaddr_r_proto" in
13922	''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13923	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13924	esac
13925	case "$gethostbyaddr_r_proto" in
13926	''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13927	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13928	esac
13929	case "$gethostbyaddr_r_proto" in
13930	''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13931	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13932	esac
13933	case "$gethostbyaddr_r_proto" in
13934	''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13935	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13936	esac
13937	case "$gethostbyaddr_r_proto" in
13938	''|0) try='int gethostbyaddr_r(const char*, int, int);'
13939	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13940	esac
13941	case "$gethostbyaddr_r_proto" in
13942	''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13943	./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13944	esac
13945	case "$gethostbyaddr_r_proto" in
13946	''|0)	d_gethostbyaddr_r=undef
13947 	        gethostbyaddr_r_proto=0
13948		echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13949	* )	case "$gethostbyaddr_r_proto" in
13950		REENTRANT_PROTO*) ;;
13951		*) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13952		esac
13953		echo "Prototype: $try" ;;
13954	esac
13955	;;
13956	*)	case "$usethreads" in
13957		define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13958		esac
13959		d_gethostbyaddr_r=undef
13960		gethostbyaddr_r_proto=0
13961		;;
13962	esac
13963	;;
13964*)	gethostbyaddr_r_proto=0
13965	;;
13966esac
13967
13968: see if gethostbyname_r exists
13969set gethostbyname_r d_gethostbyname_r
13970eval $inlibc
13971case "$d_gethostbyname_r" in
13972"$define")
13973	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13974	case "$d_gethostbyname_r_proto:$usethreads" in
13975	":define")	d_gethostbyname_r_proto=define
13976		set d_gethostbyname_r_proto gethostbyname_r $hdrs
13977		eval $hasproto ;;
13978	*)	;;
13979	esac
13980	case "$d_gethostbyname_r_proto" in
13981	define)
13982	case "$gethostbyname_r_proto" in
13983	''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13984	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13985	esac
13986	case "$gethostbyname_r_proto" in
13987	''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13988	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13989	esac
13990	case "$gethostbyname_r_proto" in
13991	''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13992	./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13993	esac
13994	case "$gethostbyname_r_proto" in
13995	''|0)	d_gethostbyname_r=undef
13996 	        gethostbyname_r_proto=0
13997		echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13998	* )	case "$gethostbyname_r_proto" in
13999		REENTRANT_PROTO*) ;;
14000		*) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14001		esac
14002		echo "Prototype: $try" ;;
14003	esac
14004	;;
14005	*)	case "$usethreads" in
14006		define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14007		esac
14008		d_gethostbyname_r=undef
14009		gethostbyname_r_proto=0
14010		;;
14011	esac
14012	;;
14013*)	gethostbyname_r_proto=0
14014	;;
14015esac
14016
14017: see if gethostent_r exists
14018set gethostent_r d_gethostent_r
14019eval $inlibc
14020case "$d_gethostent_r" in
14021"$define")
14022	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14023	case "$d_gethostent_r_proto:$usethreads" in
14024	":define")	d_gethostent_r_proto=define
14025		set d_gethostent_r_proto gethostent_r $hdrs
14026		eval $hasproto ;;
14027	*)	;;
14028	esac
14029	case "$d_gethostent_r_proto" in
14030	define)
14031	case "$gethostent_r_proto" in
14032	''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14033	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14034	esac
14035	case "$gethostent_r_proto" in
14036	''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14037	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14038	esac
14039	case "$gethostent_r_proto" in
14040	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14041	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14042	esac
14043	case "$gethostent_r_proto" in
14044	''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14045	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14046	esac
14047	case "$gethostent_r_proto" in
14048	''|0) try='int gethostent_r(struct hostent*, char*, int);'
14049	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14050	esac
14051	case "$gethostent_r_proto" in
14052	''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14053	./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14054	esac
14055	case "$gethostent_r_proto" in
14056	''|0)	d_gethostent_r=undef
14057 	        gethostent_r_proto=0
14058		echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14059	* )	case "$gethostent_r_proto" in
14060		REENTRANT_PROTO*) ;;
14061		*) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14062		esac
14063		echo "Prototype: $try" ;;
14064	esac
14065	;;
14066	*)	case "$usethreads" in
14067		define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14068		esac
14069		d_gethostent_r=undef
14070		gethostent_r_proto=0
14071		;;
14072	esac
14073	;;
14074*)	gethostent_r_proto=0
14075	;;
14076esac
14077
14078: see if prototypes for various gethostxxx netdb.h functions are available
14079echo " "
14080set d_gethostprotos gethostent $i_netdb netdb.h
14081eval $hasproto
14082
14083: see if getitimer exists
14084set getitimer d_getitimer
14085eval $inlibc
14086
14087: see if getlogin exists
14088set getlogin d_getlogin
14089eval $inlibc
14090
14091: see if getlogin_r exists
14092set getlogin_r d_getlogin_r
14093eval $inlibc
14094case "$d_getlogin_r" in
14095"$define")
14096	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14097	case "$d_getlogin_r_proto:$usethreads" in
14098	":define")	d_getlogin_r_proto=define
14099		set d_getlogin_r_proto getlogin_r $hdrs
14100		eval $hasproto ;;
14101	*)	;;
14102	esac
14103	case "$d_getlogin_r_proto" in
14104	define)
14105	case "$getlogin_r_proto" in
14106	''|0) try='int getlogin_r(char*, size_t);'
14107	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14108	esac
14109	case "$getlogin_r_proto" in
14110	''|0) try='int getlogin_r(char*, int);'
14111	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14112	esac
14113	case "$getlogin_r_proto" in
14114	''|0) try='char* getlogin_r(char*, size_t);'
14115	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14116	esac
14117	case "$getlogin_r_proto" in
14118	''|0) try='char* getlogin_r(char*, int);'
14119	./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14120	esac
14121	case "$getlogin_r_proto" in
14122	''|0)	d_getlogin_r=undef
14123 	        getlogin_r_proto=0
14124		echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14125	* )	case "$getlogin_r_proto" in
14126		REENTRANT_PROTO*) ;;
14127		*) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14128		esac
14129		echo "Prototype: $try" ;;
14130	esac
14131	;;
14132	*)	case "$usethreads" in
14133		define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14134		esac
14135		d_getlogin_r=undef
14136		getlogin_r_proto=0
14137		;;
14138	esac
14139	;;
14140*)	getlogin_r_proto=0
14141	;;
14142esac
14143
14144: see if getmnt exists
14145set getmnt d_getmnt
14146eval $inlibc
14147
14148: see if getmntent exists
14149set getmntent d_getmntent
14150eval $inlibc
14151
14152: see if getnameinfo exists
14153set getnameinfo d_getnameinfo
14154eval $inlibc
14155
14156: see if getnetbyaddr exists
14157set getnetbyaddr d_getnbyaddr
14158eval $inlibc
14159
14160: see if getnetbyname exists
14161set getnetbyname d_getnbyname
14162eval $inlibc
14163
14164: see if getnetent exists
14165set getnetent d_getnent
14166eval $inlibc
14167
14168: see if getnetbyaddr_r exists
14169set getnetbyaddr_r d_getnetbyaddr_r
14170eval $inlibc
14171case "$d_getnetbyaddr_r" in
14172"$define")
14173	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14174	case "$d_getnetbyaddr_r_proto:$usethreads" in
14175	":define")	d_getnetbyaddr_r_proto=define
14176		set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14177		eval $hasproto ;;
14178	*)	;;
14179	esac
14180	case "$d_getnetbyaddr_r_proto" in
14181	define)
14182	case "$getnetbyaddr_r_proto" in
14183	''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14184	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14185	esac
14186	case "$getnetbyaddr_r_proto" in
14187	''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14188	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14189	esac
14190	case "$getnetbyaddr_r_proto" in
14191	''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14192	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14193	esac
14194	case "$getnetbyaddr_r_proto" in
14195	''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14196	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14197	esac
14198	case "$getnetbyaddr_r_proto" in
14199	''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14200	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14201	esac
14202	case "$getnetbyaddr_r_proto" in
14203	''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14204	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14205	esac
14206	case "$getnetbyaddr_r_proto" in
14207	''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14208	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14209	esac
14210	case "$getnetbyaddr_r_proto" in
14211	''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14212	./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14213	esac
14214	case "$getnetbyaddr_r_proto" in
14215	''|0)	d_getnetbyaddr_r=undef
14216 	        getnetbyaddr_r_proto=0
14217		echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14218	* )	case "$getnetbyaddr_r_proto" in
14219		REENTRANT_PROTO*) ;;
14220		*) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14221		esac
14222		echo "Prototype: $try" ;;
14223	esac
14224	;;
14225	*)	case "$usethreads" in
14226		define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14227		esac
14228		d_getnetbyaddr_r=undef
14229		getnetbyaddr_r_proto=0
14230		;;
14231	esac
14232	;;
14233*)	getnetbyaddr_r_proto=0
14234	;;
14235esac
14236
14237: see if getnetbyname_r exists
14238set getnetbyname_r d_getnetbyname_r
14239eval $inlibc
14240case "$d_getnetbyname_r" in
14241"$define")
14242	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14243	case "$d_getnetbyname_r_proto:$usethreads" in
14244	":define")	d_getnetbyname_r_proto=define
14245		set d_getnetbyname_r_proto getnetbyname_r $hdrs
14246		eval $hasproto ;;
14247	*)	;;
14248	esac
14249	case "$d_getnetbyname_r_proto" in
14250	define)
14251	case "$getnetbyname_r_proto" in
14252	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14253	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14254	esac
14255	case "$getnetbyname_r_proto" in
14256	''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14257	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14258	esac
14259	case "$getnetbyname_r_proto" in
14260	''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14261	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14262	esac
14263	case "$getnetbyname_r_proto" in
14264	''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14265	./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14266	esac
14267	case "$getnetbyname_r_proto" in
14268	''|0)	d_getnetbyname_r=undef
14269 	        getnetbyname_r_proto=0
14270		echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14271	* )	case "$getnetbyname_r_proto" in
14272		REENTRANT_PROTO*) ;;
14273		*) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14274		esac
14275		echo "Prototype: $try" ;;
14276	esac
14277	;;
14278	*)	case "$usethreads" in
14279		define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14280		esac
14281		d_getnetbyname_r=undef
14282		getnetbyname_r_proto=0
14283		;;
14284	esac
14285	;;
14286*)	getnetbyname_r_proto=0
14287	;;
14288esac
14289
14290: see if getnetent_r exists
14291set getnetent_r d_getnetent_r
14292eval $inlibc
14293case "$d_getnetent_r" in
14294"$define")
14295	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14296	case "$d_getnetent_r_proto:$usethreads" in
14297	":define")	d_getnetent_r_proto=define
14298		set d_getnetent_r_proto getnetent_r $hdrs
14299		eval $hasproto ;;
14300	*)	;;
14301	esac
14302	case "$d_getnetent_r_proto" in
14303	define)
14304	case "$getnetent_r_proto" in
14305	''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14306	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14307	esac
14308	case "$getnetent_r_proto" in
14309	''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14310	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14311	esac
14312	case "$getnetent_r_proto" in
14313	''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14314	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14315	esac
14316	case "$getnetent_r_proto" in
14317	''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14318	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14319	esac
14320	case "$getnetent_r_proto" in
14321	''|0) try='int getnetent_r(struct netent*, char*, int);'
14322	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14323	esac
14324	case "$getnetent_r_proto" in
14325	''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14326	./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14327	esac
14328	case "$getnetent_r_proto" in
14329	''|0)	d_getnetent_r=undef
14330 	        getnetent_r_proto=0
14331		echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14332	* )	case "$getnetent_r_proto" in
14333		REENTRANT_PROTO*) ;;
14334		*) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14335		esac
14336		echo "Prototype: $try" ;;
14337	esac
14338	;;
14339	*)	case "$usethreads" in
14340		define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14341		esac
14342		d_getnetent_r=undef
14343		getnetent_r_proto=0
14344		;;
14345	esac
14346	;;
14347*)	getnetent_r_proto=0
14348	;;
14349esac
14350
14351: see if prototypes for various getnetxxx netdb.h functions are available
14352echo " "
14353set d_getnetprotos getnetent $i_netdb netdb.h
14354eval $hasproto
14355
14356: see if getpagesize exists
14357set getpagesize d_getpagsz
14358eval $inlibc
14359
14360: Optional checks for getprotobyname and getprotobynumber
14361
14362: see if getprotobyname exists
14363set getprotobyname d_getpbyname
14364eval $inlibc
14365
14366: see if getprotobynumber exists
14367set getprotobynumber d_getpbynumber
14368eval $inlibc
14369
14370: see if getprotoent exists
14371set getprotoent d_getpent
14372eval $inlibc
14373
14374: see if getpgid exists
14375set getpgid d_getpgid
14376eval $inlibc
14377
14378: see if getpgrp2 exists
14379set getpgrp2 d_getpgrp2
14380eval $inlibc
14381
14382: see if getppid exists
14383set getppid d_getppid
14384eval $inlibc
14385
14386: see if getpriority exists
14387set getpriority d_getprior
14388eval $inlibc
14389
14390: see if getprotobyname_r exists
14391set getprotobyname_r d_getprotobyname_r
14392eval $inlibc
14393case "$d_getprotobyname_r" in
14394"$define")
14395	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14396	case "$d_getprotobyname_r_proto:$usethreads" in
14397	":define")	d_getprotobyname_r_proto=define
14398		set d_getprotobyname_r_proto getprotobyname_r $hdrs
14399		eval $hasproto ;;
14400	*)	;;
14401	esac
14402	case "$d_getprotobyname_r_proto" in
14403	define)
14404	case "$getprotobyname_r_proto" in
14405	''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14406	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14407	esac
14408	case "$getprotobyname_r_proto" in
14409	''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14410	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14411	esac
14412	case "$getprotobyname_r_proto" in
14413	''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14414	./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14415	esac
14416	case "$getprotobyname_r_proto" in
14417	''|0)	d_getprotobyname_r=undef
14418 	        getprotobyname_r_proto=0
14419		echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14420	* )	case "$getprotobyname_r_proto" in
14421		REENTRANT_PROTO*) ;;
14422		*) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14423		esac
14424		echo "Prototype: $try" ;;
14425	esac
14426	;;
14427	*)	case "$usethreads" in
14428		define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14429		esac
14430		d_getprotobyname_r=undef
14431		getprotobyname_r_proto=0
14432		;;
14433	esac
14434	;;
14435*)	getprotobyname_r_proto=0
14436	;;
14437esac
14438
14439: see if getprotobynumber_r exists
14440set getprotobynumber_r d_getprotobynumber_r
14441eval $inlibc
14442case "$d_getprotobynumber_r" in
14443"$define")
14444	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14445	case "$d_getprotobynumber_r_proto:$usethreads" in
14446	":define")	d_getprotobynumber_r_proto=define
14447		set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14448		eval $hasproto ;;
14449	*)	;;
14450	esac
14451	case "$d_getprotobynumber_r_proto" in
14452	define)
14453	case "$getprotobynumber_r_proto" in
14454	''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14455	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14456	esac
14457	case "$getprotobynumber_r_proto" in
14458	''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14459	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14460	esac
14461	case "$getprotobynumber_r_proto" in
14462	''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14463	./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14464	esac
14465	case "$getprotobynumber_r_proto" in
14466	''|0)	d_getprotobynumber_r=undef
14467 	        getprotobynumber_r_proto=0
14468		echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14469	* )	case "$getprotobynumber_r_proto" in
14470		REENTRANT_PROTO*) ;;
14471		*) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14472		esac
14473		echo "Prototype: $try" ;;
14474	esac
14475	;;
14476	*)	case "$usethreads" in
14477		define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14478		esac
14479		d_getprotobynumber_r=undef
14480		getprotobynumber_r_proto=0
14481		;;
14482	esac
14483	;;
14484*)	getprotobynumber_r_proto=0
14485	;;
14486esac
14487
14488: see if getprotoent_r exists
14489set getprotoent_r d_getprotoent_r
14490eval $inlibc
14491case "$d_getprotoent_r" in
14492"$define")
14493	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14494	case "$d_getprotoent_r_proto:$usethreads" in
14495	":define")	d_getprotoent_r_proto=define
14496		set d_getprotoent_r_proto getprotoent_r $hdrs
14497		eval $hasproto ;;
14498	*)	;;
14499	esac
14500	case "$d_getprotoent_r_proto" in
14501	define)
14502	case "$getprotoent_r_proto" in
14503	''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14504	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14505	esac
14506	case "$getprotoent_r_proto" in
14507	''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14508	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14509	esac
14510	case "$getprotoent_r_proto" in
14511	''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14512	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14513	esac
14514	case "$getprotoent_r_proto" in
14515	''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14516	./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14517	esac
14518	case "$getprotoent_r_proto" in
14519	''|0)	d_getprotoent_r=undef
14520 	        getprotoent_r_proto=0
14521		echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14522	* )	case "$getprotoent_r_proto" in
14523		REENTRANT_PROTO*) ;;
14524		*) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14525		esac
14526		echo "Prototype: $try" ;;
14527	esac
14528	;;
14529	*)	case "$usethreads" in
14530		define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14531		esac
14532		d_getprotoent_r=undef
14533		getprotoent_r_proto=0
14534		;;
14535	esac
14536	;;
14537*)	getprotoent_r_proto=0
14538	;;
14539esac
14540
14541: see if prototypes for various getprotoxxx netdb.h functions are available
14542echo " "
14543set d_getprotoprotos getprotoent $i_netdb netdb.h
14544eval $hasproto
14545
14546: see if getprpwnam exists
14547set getprpwnam d_getprpwnam
14548eval $inlibc
14549
14550: see if getpwent exists
14551set getpwent d_getpwent
14552eval $inlibc
14553
14554: see if getpwent_r exists
14555set getpwent_r d_getpwent_r
14556eval $inlibc
14557case "$d_getpwent_r" in
14558"$define")
14559	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14560	case "$d_getpwent_r_proto:$usethreads" in
14561	":define")	d_getpwent_r_proto=define
14562		set d_getpwent_r_proto getpwent_r $hdrs
14563		eval $hasproto ;;
14564	*)	;;
14565	esac
14566	case "$d_getpwent_r_proto" in
14567	define)
14568	case "$getpwent_r_proto" in
14569	''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14570	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14571	esac
14572	case "$getpwent_r_proto" in
14573	''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14574	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14575	esac
14576	case "$getpwent_r_proto" in
14577	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14578	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14579	esac
14580	case "$getpwent_r_proto" in
14581	''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14582	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14583	esac
14584	case "$getpwent_r_proto" in
14585	''|0) try='int getpwent_r(struct passwd*, char*, int);'
14586	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14587	esac
14588	case "$getpwent_r_proto" in
14589	''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14590	./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14591	esac
14592	case "$getpwent_r_proto" in
14593	''|0)	d_getpwent_r=undef
14594 	        getpwent_r_proto=0
14595		echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14596	* )	case "$getpwent_r_proto" in
14597		REENTRANT_PROTO*) ;;
14598		*) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14599		esac
14600		echo "Prototype: $try" ;;
14601	esac
14602	;;
14603	*)	case "$usethreads" in
14604		define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14605		esac
14606		d_getpwent_r=undef
14607		getpwent_r_proto=0
14608		;;
14609	esac
14610	;;
14611*)	getpwent_r_proto=0
14612	;;
14613esac
14614
14615: see if getpwnam_r exists
14616set getpwnam_r d_getpwnam_r
14617eval $inlibc
14618case "$d_getpwnam_r" in
14619"$define")
14620	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14621	case "$d_getpwnam_r_proto:$usethreads" in
14622	":define")	d_getpwnam_r_proto=define
14623		set d_getpwnam_r_proto getpwnam_r $hdrs
14624		eval $hasproto ;;
14625	*)	;;
14626	esac
14627	case "$d_getpwnam_r_proto" in
14628	define)
14629	case "$getpwnam_r_proto" in
14630	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14631	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14632	esac
14633	case "$getpwnam_r_proto" in
14634	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14635	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14636	esac
14637	case "$getpwnam_r_proto" in
14638	''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14639	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14640	esac
14641	case "$getpwnam_r_proto" in
14642	''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14643	./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14644	esac
14645	case "$getpwnam_r_proto" in
14646	''|0)	d_getpwnam_r=undef
14647 	        getpwnam_r_proto=0
14648		echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14649	* )	case "$getpwnam_r_proto" in
14650		REENTRANT_PROTO*) ;;
14651		*) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14652		esac
14653		echo "Prototype: $try" ;;
14654	esac
14655	;;
14656	*)	case "$usethreads" in
14657		define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14658		esac
14659		d_getpwnam_r=undef
14660		getpwnam_r_proto=0
14661		;;
14662	esac
14663	;;
14664*)	getpwnam_r_proto=0
14665	;;
14666esac
14667
14668: see if getpwuid_r exists
14669set getpwuid_r d_getpwuid_r
14670eval $inlibc
14671case "$d_getpwuid_r" in
14672"$define")
14673	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14674	case "$d_getpwuid_r_proto:$usethreads" in
14675	":define")	d_getpwuid_r_proto=define
14676		set d_getpwuid_r_proto getpwuid_r $hdrs
14677		eval $hasproto ;;
14678	*)	;;
14679	esac
14680	case "$d_getpwuid_r_proto" in
14681	define)
14682	case "$getpwuid_r_proto" in
14683	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14684	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14685	esac
14686	case "$getpwuid_r_proto" in
14687	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14688	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14689	esac
14690	case "$getpwuid_r_proto" in
14691	''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14692	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14693	esac
14694	case "$getpwuid_r_proto" in
14695	''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14696	./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14697	esac
14698	case "$getpwuid_r_proto" in
14699	''|0)	d_getpwuid_r=undef
14700 	        getpwuid_r_proto=0
14701		echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14702	* )	case "$getpwuid_r_proto" in
14703		REENTRANT_PROTO*) ;;
14704		*) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14705		esac
14706		echo "Prototype: $try" ;;
14707	esac
14708	;;
14709	*)	case "$usethreads" in
14710		define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14711		esac
14712		d_getpwuid_r=undef
14713		getpwuid_r_proto=0
14714		;;
14715	esac
14716	;;
14717*)	getpwuid_r_proto=0
14718	;;
14719esac
14720
14721: Optional checks for getsbyname and getsbyport
14722
14723: see if getservbyname exists
14724set getservbyname d_getsbyname
14725eval $inlibc
14726
14727: see if getservbyport exists
14728set getservbyport d_getsbyport
14729eval $inlibc
14730
14731: see if getservent exists
14732set getservent d_getsent
14733eval $inlibc
14734
14735: see if getservbyname_r exists
14736set getservbyname_r d_getservbyname_r
14737eval $inlibc
14738case "$d_getservbyname_r" in
14739"$define")
14740	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14741	case "$d_getservbyname_r_proto:$usethreads" in
14742	":define")	d_getservbyname_r_proto=define
14743		set d_getservbyname_r_proto getservbyname_r $hdrs
14744		eval $hasproto ;;
14745	*)	;;
14746	esac
14747	case "$d_getservbyname_r_proto" in
14748	define)
14749	case "$getservbyname_r_proto" in
14750	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14751	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14752	esac
14753	case "$getservbyname_r_proto" in
14754	''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14755	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14756	esac
14757	case "$getservbyname_r_proto" in
14758	''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14759	./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14760	esac
14761	case "$getservbyname_r_proto" in
14762	''|0)	d_getservbyname_r=undef
14763 	        getservbyname_r_proto=0
14764		echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14765	* )	case "$getservbyname_r_proto" in
14766		REENTRANT_PROTO*) ;;
14767		*) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14768		esac
14769		echo "Prototype: $try" ;;
14770	esac
14771	;;
14772	*)	case "$usethreads" in
14773		define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14774		esac
14775		d_getservbyname_r=undef
14776		getservbyname_r_proto=0
14777		;;
14778	esac
14779	;;
14780*)	getservbyname_r_proto=0
14781	;;
14782esac
14783
14784: see if getservbyport_r exists
14785set getservbyport_r d_getservbyport_r
14786eval $inlibc
14787case "$d_getservbyport_r" in
14788"$define")
14789	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14790	case "$d_getservbyport_r_proto:$usethreads" in
14791	":define")	d_getservbyport_r_proto=define
14792		set d_getservbyport_r_proto getservbyport_r $hdrs
14793		eval $hasproto ;;
14794	*)	;;
14795	esac
14796	case "$d_getservbyport_r_proto" in
14797	define)
14798	case "$getservbyport_r_proto" in
14799	''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14800	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14801	esac
14802	case "$getservbyport_r_proto" in
14803	''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14804	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14805	esac
14806	case "$getservbyport_r_proto" in
14807	''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14808	./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14809	esac
14810	case "$getservbyport_r_proto" in
14811	''|0)	d_getservbyport_r=undef
14812 	        getservbyport_r_proto=0
14813		echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14814	* )	case "$getservbyport_r_proto" in
14815		REENTRANT_PROTO*) ;;
14816		*) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14817		esac
14818		echo "Prototype: $try" ;;
14819	esac
14820	;;
14821	*)	case "$usethreads" in
14822		define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14823		esac
14824		d_getservbyport_r=undef
14825		getservbyport_r_proto=0
14826		;;
14827	esac
14828	;;
14829*)	getservbyport_r_proto=0
14830	;;
14831esac
14832
14833: see if getservent_r exists
14834set getservent_r d_getservent_r
14835eval $inlibc
14836case "$d_getservent_r" in
14837"$define")
14838	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14839	case "$d_getservent_r_proto:$usethreads" in
14840	":define")	d_getservent_r_proto=define
14841		set d_getservent_r_proto getservent_r $hdrs
14842		eval $hasproto ;;
14843	*)	;;
14844	esac
14845	case "$d_getservent_r_proto" in
14846	define)
14847	case "$getservent_r_proto" in
14848	''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14849	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14850	esac
14851	case "$getservent_r_proto" in
14852	''|0) try='int getservent_r(struct servent*, char*, int);'
14853	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14854	esac
14855	case "$getservent_r_proto" in
14856	''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14857	./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14858	esac
14859	case "$getservent_r_proto" in
14860	''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14861	./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14862	esac
14863	case "$getservent_r_proto" in
14864	''|0)	d_getservent_r=undef
14865 	        getservent_r_proto=0
14866		echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14867	* )	case "$getservent_r_proto" in
14868		REENTRANT_PROTO*) ;;
14869		*) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14870		esac
14871		echo "Prototype: $try" ;;
14872	esac
14873	;;
14874	*)	case "$usethreads" in
14875		define) echo "getservent_r has no prototype, not using it." >&4 ;;
14876		esac
14877		d_getservent_r=undef
14878		getservent_r_proto=0
14879		;;
14880	esac
14881	;;
14882*)	getservent_r_proto=0
14883	;;
14884esac
14885
14886: see if prototypes for various getservxxx netdb.h functions are available
14887echo " "
14888set d_getservprotos getservent $i_netdb netdb.h
14889eval $hasproto
14890
14891: see if getspnam exists
14892set getspnam d_getspnam
14893eval $inlibc
14894
14895: see if this is a shadow.h system
14896set shadow.h i_shadow
14897eval $inhdr
14898
14899: see if getspnam_r exists
14900set getspnam_r d_getspnam_r
14901eval $inlibc
14902case "$d_getspnam_r" in
14903"$define")
14904	hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14905	case "$d_getspnam_r_proto:$usethreads" in
14906	":define")	d_getspnam_r_proto=define
14907		set d_getspnam_r_proto getspnam_r $hdrs
14908		eval $hasproto ;;
14909	*)	;;
14910	esac
14911	case "$d_getspnam_r_proto" in
14912	define)
14913	case "$getspnam_r_proto" in
14914	''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14915	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14916	esac
14917	case "$getspnam_r_proto" in
14918	''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14919	./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14920	esac
14921	case "$getspnam_r_proto" in
14922	''|0)	d_getspnam_r=undef
14923 	        getspnam_r_proto=0
14924		echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14925	* )	case "$getspnam_r_proto" in
14926		REENTRANT_PROTO*) ;;
14927		*) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14928		esac
14929		echo "Prototype: $try" ;;
14930	esac
14931	;;
14932	*)	case "$usethreads" in
14933		define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14934		esac
14935		d_getspnam_r=undef
14936		getspnam_r_proto=0
14937		;;
14938	esac
14939	;;
14940*)	getspnam_r_proto=0
14941	;;
14942esac
14943
14944: see if gettimeofday or ftime exists
14945set gettimeofday d_gettimeod
14946eval $inlibc
14947case "$d_gettimeod" in
14948"$undef")
14949	set ftime d_ftime
14950	eval $inlibc
14951	;;
14952*)
14953	val="$undef"; set d_ftime; eval $setvar
14954	;;
14955esac
14956case "$d_gettimeod$d_ftime" in
14957"$undef$undef")
14958	echo " "
14959	echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14960	;;
14961esac
14962
14963: see if gmtime_r exists
14964set gmtime_r d_gmtime_r
14965eval $inlibc
14966case "$d_gmtime_r" in
14967"$define")
14968	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14969	case "$d_gmtime_r_proto:$usethreads" in
14970	":define")	d_gmtime_r_proto=define
14971		set d_gmtime_r_proto gmtime_r $hdrs
14972		eval $hasproto ;;
14973	*)	;;
14974	esac
14975	case "$d_gmtime_r_proto" in
14976	define)
14977	case "$gmtime_r_proto" in
14978	''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14979	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14980	esac
14981	case "$gmtime_r_proto" in
14982	''|0) try='int gmtime_r(const time_t*, struct tm*);'
14983	./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14984	esac
14985	case "$gmtime_r_proto" in
14986	''|0)	d_gmtime_r=undef
14987 	        gmtime_r_proto=0
14988		echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14989	* )	case "$gmtime_r_proto" in
14990		REENTRANT_PROTO*) ;;
14991		*) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14992		esac
14993		echo "Prototype: $try" ;;
14994	esac
14995	;;
14996	*)	case "$usethreads" in
14997		define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14998		esac
14999		d_gmtime_r=undef
15000		gmtime_r_proto=0
15001		;;
15002	esac
15003	;;
15004*)	gmtime_r_proto=0
15005	;;
15006esac
15007
15008: see if hasmntopt exists
15009set hasmntopt d_hasmntopt
15010eval $inlibc
15011
15012: see if this is a netinet/in.h or sys/in.h system
15013set netinet/in.h i_niin sys/in.h i_sysin
15014eval $inhdr
15015
15016: see if arpa/inet.h has to be included
15017set arpa/inet.h i_arpainet
15018eval $inhdr
15019
15020: see if htonl --and friends-- exists
15021val=''
15022set htonl val
15023eval $inlibc
15024
15025: Maybe they are macros.
15026case "$val" in
15027$undef)
15028	$cat >htonl.c <<EOM
15029#include <stdio.h>
15030#include <sys/types.h>
15031#$i_niin I_NETINET_IN
15032#$i_sysin I_SYS_IN
15033#$i_arpainet I_ARPA_INET
15034#ifdef I_NETINET_IN
15035#include <netinet/in.h>
15036#endif
15037#ifdef I_SYS_IN
15038#include <sys/in.h>
15039#endif
15040#ifdef I_ARPA_INET
15041#include <arpa/inet.h>
15042#endif
15043#ifdef htonl
15044printf("Defined as a macro.");
15045#endif
15046EOM
15047	$cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15048	if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15049		val="$define"
15050		echo "But it seems to be defined as a macro." >&4
15051	fi
15052	$rm -f htonl.?
15053	;;
15054esac
15055set d_htonl
15056eval $setvar
15057
15058: see if ilogbl exists
15059set ilogbl d_ilogbl
15060eval $inlibc
15061
15062: index or strchr
15063echo " "
15064if set index val -f; eval $csym; $val; then
15065	if set strchr val -f d_strchr; eval $csym; $val; then
15066		if $contains strchr "$strings" >/dev/null 2>&1 ; then
15067			val="$define"
15068			vali="$undef"
15069			echo "strchr() found." >&4
15070		else
15071			val="$undef"
15072			vali="$define"
15073			echo "index() found." >&4
15074		fi
15075	else
15076		val="$undef"
15077		vali="$define"
15078		echo "index() found." >&4
15079	fi
15080else
15081	if set strchr val -f d_strchr; eval $csym; $val; then
15082		val="$define"
15083		vali="$undef"
15084		echo "strchr() found." >&4
15085	else
15086		echo "No index() or strchr() found!" >&4
15087		val="$undef"
15088		vali="$undef"
15089	fi
15090fi
15091set d_strchr; eval $setvar
15092val="$vali"
15093set d_index; eval $setvar
15094
15095: check whether inet_aton exists
15096set inet_aton d_inetaton
15097eval $inlibc
15098
15099: see if inet_ntop exists
15100set inet_ntop d_inetntop
15101eval $inlibc
15102
15103: see if inet_pton exists
15104set inet_pton d_inetpton
15105eval $inlibc
15106
15107: Look for isascii
15108echo " "
15109$cat >isascii.c <<EOCP
15110#include <stdio.h>
15111#include <ctype.h>
15112#$i_stdlib I_STDLIB
15113#ifdef I_STDLIB
15114#include <stdlib.h>
15115#endif
15116int main() {
15117	int c = 'A';
15118	if (isascii(c))
15119		exit(0);
15120	else
15121		exit(1);
15122}
15123EOCP
15124set isascii
15125if eval $compile; then
15126	echo "isascii() found." >&4
15127	val="$define"
15128else
15129	echo "isascii() NOT found." >&4
15130	val="$undef"
15131fi
15132set d_isascii
15133eval $setvar
15134$rm -f isascii*
15135
15136: Look for isblank
15137echo " "
15138$cat >isblank.c <<'EOCP'
15139#include <stdio.h>
15140#include <ctype.h>
15141int main() {
15142	int c = ' ';
15143	if (isblank(c))
15144		return 0 ;
15145	else
15146		return 1 ;
15147}
15148EOCP
15149if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15150	echo "isblank() found." >&4
15151	val="$define"
15152else
15153	echo "isblank() NOT found." >&4
15154	val="$undef"
15155fi
15156set d_isblank
15157eval $setvar
15158$rm -f isblank*
15159
15160: see if isfinite exists
15161set isfinite d_isfinite
15162eval $inlibc
15163
15164: see if isinf exists
15165set isinf d_isinf
15166eval $inlibc
15167
15168: see if isnan exists
15169set isnan d_isnan
15170eval $inlibc
15171
15172: see if isnanl exists
15173set isnanl d_isnanl
15174eval $inlibc
15175
15176: see if killpg exists
15177set killpg d_killpg
15178eval $inlibc
15179
15180: see if lchown exists
15181echo " "
15182$cat > try.c <<'EOCP'
15183/* System header to define __stub macros and hopefully few prototypes,
15184    which can conflict with char lchown(); below.  */
15185#include <assert.h>
15186/* Override any gcc2 internal prototype to avoid an error.  */
15187/* We use char because int might match the return type of a gcc2
15188   builtin and then its argument prototype would still apply.  */
15189char lchown();
15190int main() {
15191    /*  The GNU C library defines this for functions which it implements
15192        to always fail with ENOSYS.  Some functions are actually named
15193	something starting with __ and the normal name is an alias.  */
15194#if defined (__stub_lchown) || defined (__stub___lchown)
15195choke me
15196#else
15197lchown();
15198#endif
15199; return 0; }
15200EOCP
15201set try
15202if eval $compile; then
15203    $echo "lchown() found." >&4
15204    val="$define"
15205else
15206    $echo "lchown() NOT found." >&4
15207    val="$undef"
15208fi
15209set d_lchown
15210eval $setvar
15211
15212: See if number of significant digits in a double precision number is known
15213echo " "
15214$cat >ldbl_dig.c <<EOM
15215#$i_limits I_LIMITS
15216#$i_float I_FLOAT
15217#ifdef I_LIMITS
15218#include <limits.h>
15219#endif
15220#ifdef I_FLOAT
15221#include <float.h>
15222#endif
15223#ifdef LDBL_DIG
15224printf("Contains LDBL_DIG");
15225#endif
15226EOM
15227$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15228if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15229	echo "LDBL_DIG found." >&4
15230	val="$define"
15231else
15232	echo "LDBL_DIG NOT found." >&4
15233	val="$undef"
15234fi
15235$rm -f ldbl_dig.?
15236set d_ldbl_dig
15237eval $setvar
15238
15239: see if this is a math.h system
15240set math.h i_math
15241eval $inhdr
15242
15243: check to see if math.h defines _LIB_VERSION
15244d_libm_lib_version="$undef"
15245case $i_math in
15246    $define)
15247	echo " "
15248	echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15249	$cat >try.c <<EOCP
15250#include <unistd.h>
15251#include <math.h>
15252int main (int argc, char *argv[])
15253{
15254    printf ("%d\n", _LIB_VERSION);
15255    return (0);
15256    } /* main */
15257EOCP
15258	set try
15259	if eval $compile; then
15260	    foo=`$run ./try`
15261	    echo "Yes, it does ($foo)" >&4
15262	    d_libm_lib_version="$define"
15263	else
15264	    echo "No, it does not (probably harmless)" >&4
15265	    fi
15266	$rm_try
15267	;;
15268
15269    esac
15270
15271: see if link exists
15272set link d_link
15273eval $inlibc
15274
15275: see if localtime_r exists
15276set localtime_r d_localtime_r
15277eval $inlibc
15278case "$d_localtime_r" in
15279"$define")
15280	hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15281	case "$d_localtime_r_proto:$usethreads" in
15282	":define")	d_localtime_r_proto=define
15283		set d_localtime_r_proto localtime_r $hdrs
15284		eval $hasproto ;;
15285	*)	;;
15286	esac
15287	case "$d_localtime_r_proto" in
15288	define)
15289	case "$localtime_r_proto" in
15290	''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15291	./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15292	esac
15293	case "$localtime_r_proto" in
15294	''|0) try='int localtime_r(const time_t*, struct tm*);'
15295	./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15296	esac
15297	case "$localtime_r_proto" in
15298	''|0)	d_localtime_r=undef
15299 	        localtime_r_proto=0
15300		echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15301	* )	case "$localtime_r_proto" in
15302		REENTRANT_PROTO*) ;;
15303		*) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15304		esac
15305		echo "Prototype: $try" ;;
15306	esac
15307	;;
15308	*)	case "$usethreads" in
15309		define) echo "localtime_r has no prototype, not using it." >&4 ;;
15310		esac
15311		d_localtime_r=undef
15312		localtime_r_proto=0
15313		;;
15314	esac
15315	;;
15316*)	localtime_r_proto=0
15317	;;
15318esac
15319
15320: see if localtime_r calls tzset
15321case "$localtime_r_proto" in
15322REENTRANT_PROTO*)
15323	$cat >try.c <<EOCP
15324/*  Does our libc's localtime_r call tzset ?
15325 *  return 0 if so, 1 otherwise.
15326 */
15327#$i_systypes	I_SYS_TYPES
15328#$i_unistd	I_UNISTD
15329#$i_time	I_TIME
15330#$i_stdlib	I_STDLIB
15331#$i_string	I_STRING
15332#$i_malloc	I_MALLOC
15333#ifdef I_SYS_TYPES
15334#  include <sys/types.h>
15335#endif
15336#ifdef I_UNISTD
15337#  include <unistd.h>
15338#endif
15339#ifdef I_TIME
15340#  include <time.h>
15341#endif
15342#ifdef I_STDLIB
15343#include <stdlib.h>
15344#endif
15345#ifdef I_STRING
15346#  include <string.h>
15347#else
15348#  include <strings.h>
15349#endif
15350#ifdef I_MALLOC
15351#  include <malloc.h>
15352#endif
15353int main()
15354{
15355    time_t t = time(0L);
15356    char w_tz[]="TZ" "=GMT+5",
15357	 e_tz[]="TZ" "=GMT-5",
15358	*tz_e = (char*)malloc(16),
15359	*tz_w = (char*)malloc(16);
15360    struct tm tm_e, tm_w;
15361    memset(&tm_e,'\0',sizeof(struct tm));
15362    memset(&tm_w,'\0',sizeof(struct tm));
15363    strcpy(tz_e,e_tz);
15364    strcpy(tz_w,w_tz);
15365
15366    putenv(tz_e);
15367    localtime_r(&t, &tm_e);
15368
15369    putenv(tz_w);
15370    localtime_r(&t, &tm_w);
15371
15372    if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15373	return 1;
15374    return 0;
15375}
15376EOCP
15377	set try
15378	if eval $compile; then
15379	    if $run ./try; then
15380		d_localtime_r_needs_tzset=undef;
15381	    else
15382		d_localtime_r_needs_tzset=define;
15383	    fi;
15384	else
15385	    d_localtime_r_needs_tzset=undef;
15386	fi;
15387     ;;
15388  *)
15389     d_localtime_r_needs_tzset=undef;
15390     ;;
15391esac
15392$rm_try
15393
15394: see if localeconv exists
15395set localeconv d_locconv
15396eval $inlibc
15397
15398: see if lockf exists
15399set lockf d_lockf
15400eval $inlibc
15401
15402: see if prototype for lseek is available
15403echo " "
15404set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15405eval $hasproto
15406
15407: see if lstat exists
15408set lstat d_lstat
15409eval $inlibc
15410
15411: see if madvise exists
15412set madvise d_madvise
15413eval $inlibc
15414
15415: see if malloc_size exists
15416set malloc_size d_malloc_size
15417eval $inlibc
15418
15419: see if malloc_size_good exists
15420set malloc_good_size d_malloc_good_size
15421eval $inlibc
15422
15423: see if mblen exists
15424set mblen d_mblen
15425eval $inlibc
15426
15427: see if mbstowcs exists
15428set mbstowcs d_mbstowcs
15429eval $inlibc
15430
15431: see if mbtowc exists
15432set mbtowc d_mbtowc
15433eval $inlibc
15434
15435: see if memchr exists
15436set memchr d_memchr
15437eval $inlibc
15438
15439: see if memcmp exists
15440set memcmp d_memcmp
15441eval $inlibc
15442
15443: see if memcpy exists
15444set memcpy d_memcpy
15445eval $inlibc
15446
15447: see if memmove exists
15448set memmove d_memmove
15449eval $inlibc
15450
15451: see if memset exists
15452set memset d_memset
15453eval $inlibc
15454
15455: see if mkdir exists
15456set mkdir d_mkdir
15457eval $inlibc
15458
15459: see if mkdtemp exists
15460set mkdtemp d_mkdtemp
15461eval $inlibc
15462
15463: see if mkfifo exists
15464set mkfifo d_mkfifo
15465eval $inlibc
15466
15467: see if mkstemp exists
15468set mkstemp d_mkstemp
15469eval $inlibc
15470
15471: see if mkstemps exists
15472set mkstemps d_mkstemps
15473eval $inlibc
15474
15475: see if mktime exists
15476set mktime d_mktime
15477eval $inlibc
15478
15479: see if this is a sys/mman.h system
15480set sys/mman.h i_sysmman
15481eval $inhdr
15482
15483: see if mmap exists
15484set mmap d_mmap
15485eval $inlibc
15486: see what shmat returns
15487: default to something harmless
15488mmaptype='void *'
15489case "$i_sysmman$d_mmap" in
15490"$define$define")
15491	$cat >mmap.c <<'END'
15492#include <sys/mman.h>
15493void *mmap();
15494END
15495	if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15496		mmaptype='void *'
15497	else
15498		mmaptype='caddr_t'
15499	fi
15500	echo "and it returns ($mmaptype)." >&4
15501	;;
15502esac
15503
15504
15505
15506: see if sqrtl exists
15507set sqrtl d_sqrtl
15508eval $inlibc
15509
15510: see if scalbnl exists
15511set scalbnl d_scalbnl
15512eval $inlibc
15513
15514: see if modfl exists
15515set modfl d_modfl
15516eval $inlibc
15517
15518: see if prototype for modfl is available
15519echo " "
15520set d_modflproto modfl $i_math math.h
15521eval $hasproto
15522
15523d_modfl_pow32_bug="$undef"
15524
15525case "$d_longdbl$d_modfl" in
15526$define$define)
15527	$cat <<EOM
15528Checking to see whether your modfl() is okay for large values...
15529EOM
15530$cat >try.c <<EOCP
15531#include <math.h>
15532#include <stdio.h>
15533EOCP
15534if $test "X$d_modflproto" != "X$define"; then
15535	$cat >>try.c <<EOCP
15536/* Sigh. many current glibcs provide the function, but do not prototype it. */
15537long double modfl (long double, long double *);
15538EOCP
15539fi
15540$cat >>try.c <<EOCP
15541int main() {
15542    long double nv = 4294967303.15;
15543    long double v, w;
15544    v = modfl(nv, &w);
15545#ifdef __GLIBC__
15546    printf("glibc");
15547#endif
15548    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15549    return 0;
15550}
15551EOCP
15552	case "$osname:$gccversion" in
15553	aix:)	saveccflags="$ccflags"
15554		ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15555	esac
15556	set try
15557	if eval $compile; then
15558		foo=`$run ./try`
15559		case "$foo" in
15560		*" 4294967303.150000 1.150000 4294967302.000000")
15561			echo >&4 "Your modfl() is broken for large values."
15562			d_modfl_pow32_bug="$define"
15563			case "$foo" in
15564			glibc)	echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15565			;;
15566			esac
15567			;;
15568		*" 4294967303.150000 0.150000 4294967303.000000")
15569			echo >&4 "Your modfl() seems okay for large values."
15570			;;
15571		*)	echo >&4 "I don't understand your modfl() at all."
15572			d_modfl="$undef"
15573			;;
15574		esac
15575		$rm_try
15576	else
15577		echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15578		d_modfl="$undef"
15579	fi
15580	case "$osname:$gccversion" in
15581	aix:)	ccflags="$saveccflags" ;; # restore
15582	esac
15583	;;
15584esac
15585
15586if $test "$uselongdouble" = "$define"; then
15587    message=""
15588    if $test "$d_sqrtl" != "$define"; then
15589	message="$message sqrtl"
15590    fi
15591    if $test "$d_modfl" != "$define"; then
15592	if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15593	    echo "You have both aintl and copysignl, so I can emulate modfl."
15594	else
15595	    message="$message modfl"
15596	fi
15597    fi
15598    if $test "$d_frexpl" != "$define"; then
15599	if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15600	    echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15601	else
15602	    message="$message frexpl"
15603	fi
15604    fi
15605
15606    if $test "$message" != ""; then
15607	$cat <<EOM >&4
15608
15609*** You requested the use of long doubles but you do not seem to have
15610*** the following mathematical functions needed for long double support:
15611***    $message
15612*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15613*** Cannot continue, aborting.
15614
15615EOM
15616
15617	exit 1
15618    fi
15619fi
15620
15621: see if mprotect exists
15622set mprotect d_mprotect
15623eval $inlibc
15624
15625: see if msgctl exists
15626set msgctl d_msgctl
15627eval $inlibc
15628
15629: see if msgget exists
15630set msgget d_msgget
15631eval $inlibc
15632
15633: see if msgsnd exists
15634set msgsnd d_msgsnd
15635eval $inlibc
15636
15637: see if msgrcv exists
15638set msgrcv d_msgrcv
15639eval $inlibc
15640
15641: see how much of the 'msg*(2)' library is present.
15642h_msg=true
15643echo " "
15644case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15645*"$undef"*) h_msg=false;;
15646esac
15647case "$osname" in
15648freebsd)
15649    case "`ipcs 2>&1`" in
15650    "SVID messages"*"not configured"*)
15651	echo "Your $osname does not have the msg*(2) configured." >&4
15652        h_msg=false
15653	val="$undef"
15654	set msgctl d_msgctl
15655	eval $setvar
15656	set msgget d_msgget
15657	eval $setvar
15658	set msgsnd d_msgsnd
15659	eval $setvar
15660	set msgrcv d_msgrcv
15661	eval $setvar
15662	;;
15663    esac
15664    ;;
15665esac
15666: we could also check for sys/ipc.h ...
15667if $h_msg && $test `./findhdr sys/msg.h`; then
15668	echo "You have the full msg*(2) library." >&4
15669	val="$define"
15670else
15671	echo "You don't have the full msg*(2) library." >&4
15672	val="$undef"
15673fi
15674set d_msg
15675eval $setvar
15676
15677: Check for msghdr_s
15678echo " "
15679echo "Checking to see if your system supports struct msghdr..." >&4
15680set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15681eval $hasstruct
15682case "$d_msghdr_s" in
15683"$define")      echo "Yes, it does."   ;;
15684*)              echo "No, it doesn't." ;;
15685esac
15686
15687
15688: see if msync exists
15689set msync d_msync
15690eval $inlibc
15691
15692: see if munmap exists
15693set munmap d_munmap
15694eval $inlibc
15695
15696: see if nice exists
15697set nice d_nice
15698eval $inlibc
15699
15700: see if this is a langinfo.h system
15701set langinfo.h i_langinfo
15702eval $inhdr
15703
15704: see if nl_langinfo exists
15705set nl_langinfo d_nl_langinfo
15706eval $inlibc
15707
15708: check for volatile keyword
15709echo " "
15710echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15711$cat >try.c <<'EOCP'
15712int main()
15713{
15714	typedef struct _goo_struct goo_struct;
15715	goo_struct * volatile goo = ((goo_struct *)0);
15716	struct _goo_struct {
15717		long long_int;
15718		int reg_int;
15719		char char_var;
15720	};
15721	typedef unsigned short foo_t;
15722	char *volatile foo;
15723	volatile int bar;
15724	volatile foo_t blech;
15725	foo = foo;
15726}
15727EOCP
15728if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15729	val="$define"
15730	echo "Yup, it does."
15731else
15732	val="$undef"
15733	echo "Nope, it doesn't."
15734fi
15735set d_volatile
15736eval $setvar
15737$rm_try
15738
15739: Check basic sizes
15740echo " "
15741$echo "Choosing the C types to be used for Perl's internal types..." >&4
15742
15743case "$use64bitint:$d_quad:$quadtype" in
15744define:define:?*)
15745	ivtype="$quadtype"
15746	uvtype="$uquadtype"
15747	ivsize=8
15748	uvsize=8
15749	;;
15750*)	ivtype="long"
15751	uvtype="unsigned long"
15752	ivsize=$longsize
15753	uvsize=$longsize
15754	;;
15755esac
15756
15757case "$uselongdouble:$d_longdbl" in
15758define:define)
15759	nvtype="long double"
15760	nvsize=$longdblsize
15761	;;
15762*)	nvtype=double
15763	nvsize=$doublesize
15764	;;
15765esac
15766
15767$echo "(IV will be "$ivtype", $ivsize bytes)"
15768$echo "(UV will be "$uvtype", $uvsize bytes)"
15769$echo "(NV will be "$nvtype", $nvsize bytes)"
15770
15771$cat >try.c <<EOCP
15772#$i_inttypes I_INTTYPES
15773#ifdef I_INTTYPES
15774#include <inttypes.h>
15775#endif
15776#include <stdio.h>
15777int main() {
15778#ifdef INT8
15779   int8_t i =  INT8_MAX;
15780  uint8_t u = UINT8_MAX;
15781  printf("int8_t\n");
15782#endif
15783#ifdef INT16
15784   int16_t i =  INT16_MAX;
15785  uint16_t i = UINT16_MAX;
15786  printf("int16_t\n");
15787#endif
15788#ifdef INT32
15789   int32_t i =  INT32_MAX;
15790  uint32_t u = UINT32_MAX;
15791  printf("int32_t\n");
15792#endif
15793}
15794EOCP
15795
15796i8type="signed char"
15797u8type="unsigned char"
15798i8size=1
15799u8size=1
15800
15801case "$i16type" in
15802'')	case "$shortsize" in
15803	2)	i16type=short
15804		u16type="unsigned short"
15805		i16size=$shortsize
15806		u16size=$shortsize
15807		;;
15808	esac
15809	;;
15810esac
15811case "$i16type" in
15812'')	set try -DINT16
15813	if eval $compile; then
15814		case "`$run ./try`" in
15815		int16_t)
15816			i16type=int16_t
15817			u16type=uint16_t
15818			i16size=2
15819			u16size=2
15820			;;
15821		esac
15822	fi
15823	;;
15824esac
15825case "$i16type" in
15826'')	if $test $shortsize -ge 2; then
15827		i16type=short
15828		u16type="unsigned short"
15829		i16size=$shortsize
15830		u16size=$shortsize
15831	fi
15832	;;
15833esac
15834
15835case "$i32type" in
15836'')	case "$longsize" in
15837	4)	i32type=long
15838		u32type="unsigned long"
15839		i32size=$longsize
15840		u32size=$longsize
15841		;;
15842	*)	case "$intsize" in
15843		4)	i32type=int
15844			u32type="unsigned int"
15845			i32size=$intsize
15846			u32size=$intsize
15847			;;
15848		esac
15849		;;
15850	esac
15851	;;
15852esac
15853case "$i32type" in
15854'')	set try -DINT32
15855	if eval $compile; then
15856		case "`$run ./try`" in
15857		int32_t)
15858			i32type=int32_t
15859			u32type=uint32_t
15860			i32size=4
15861			u32size=4
15862			;;
15863		esac
15864	fi
15865	;;
15866esac
15867case "$i32type" in
15868'')	if $test $intsize -ge 4; then
15869		i32type=int
15870		u32type="unsigned int"
15871		i32size=$intsize
15872		u32size=$intsize
15873	fi
15874	;;
15875esac
15876
15877case "$i64type" in
15878'')	case "$d_quad:$quadtype" in
15879	define:?*)
15880		i64type="$quadtype"
15881		u64type="$uquadtype"
15882		i64size=8
15883		u64size=8
15884		;;
15885	esac
15886	;;
15887esac
15888
15889$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15890: volatile so that the compiler has to store it out to memory.
15891if test X"$d_volatile" = X"$define"; then
15892	volatile=volatile
15893fi
15894$cat <<EOP >try.c
15895#include <stdio.h>
15896#$i_stdlib I_STDLIB
15897#ifdef I_STDLIB
15898#include <stdlib.h>
15899#endif
15900#include <sys/types.h>
15901#include <signal.h>
15902#ifdef SIGFPE
15903$volatile int bletched = 0;
15904$signal_t blech(int s) { bletched = 1; }
15905#endif
15906int main() {
15907    $uvtype u = 0;
15908    $nvtype d;
15909    int     n = 8 * $uvsize;
15910    int     i;
15911#ifdef SIGFPE
15912    signal(SIGFPE, blech);
15913#endif
15914
15915    for (i = 0; i < n; i++) {
15916      u = u << 1 | ($uvtype)1;
15917      d = ($nvtype)u;
15918      if (($uvtype)d != u)
15919        break;
15920      if (d <= 0)
15921	break;
15922      d = ($nvtype)(u - 1);
15923      if (($uvtype)d != (u - 1))
15924        break;
15925#ifdef SIGFPE
15926      if (bletched)
15927	break;
15928#endif
15929    }
15930    printf("%d\n", ((i == n) ? -n : i));
15931    exit(0);
15932}
15933EOP
15934set try
15935
15936d_nv_preserves_uv="$undef"
15937if eval $compile; then
15938	nv_preserves_uv_bits="`$run ./try`"
15939fi
15940case "$nv_preserves_uv_bits" in
15941\-[1-9]*)
15942	nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15943	$echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15944	d_nv_preserves_uv="$define"
15945	;;
15946[1-9]*)	$echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15947	d_nv_preserves_uv="$undef" ;;
15948*)	$echo "Can't figure out how many bits your NVs preserve." 2>&1
15949	nv_preserves_uv_bits="0" ;;
15950esac
15951$rm_try
15952
15953$echo "Checking to find the largest integer value your NVs can hold..." >&4
15954: volatile so that the compiler has to store it out to memory.
15955if test X"$d_volatile" = X"$define"; then
15956	volatile=volatile
15957fi
15958$cat <<EOP >try.c
15959#include <stdio.h>
15960
15961typedef $nvtype NV;
15962
15963int
15964main() {
15965  NV value = 2;
15966  int count = 1;
15967
15968  while(count < 256) {
15969    $volatile NV up = value + 1.0;
15970    $volatile NV negated = -value;
15971    $volatile NV down = negated - 1.0;
15972    $volatile NV got_up = up - value;
15973    int up_good = got_up == 1.0;
15974    int got_down = down - negated;
15975    int down_good = got_down == -1.0;
15976
15977    if (down_good != up_good) {
15978      fprintf(stderr,
15979	      "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15980	      up_good, (double) got_up, down_good, (double) got_down,
15981	      count, (double) value);
15982      return 1;
15983    }
15984    if (!up_good) {
15985      while (1) {
15986	if (count > 8) {
15987	  count -= 8;
15988	  fputs("256.0", stdout);
15989	} else {
15990	  count--;
15991	  fputs("2.0", stdout);
15992	}
15993	if (!count) {
15994	  puts("");
15995	  return 0;
15996	}
15997	fputs("*", stdout);
15998      }
15999    }
16000    value *= 2;
16001    ++count;
16002  }
16003  fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16004	  count, (double) value);
16005  return 1;
16006}
16007EOP
16008set try
16009
16010nv_overflows_integers_at='0'
16011if eval $compile; then
16012    xxx="`$run ./try`"
16013    case "$?" in
16014	0)
16015	    case "$xxx" in
16016		2*)  cat >&4 <<EOM
16017The largest integer your NVs can preserve is equal to $xxx
16018EOM
16019		    nv_overflows_integers_at="$xxx"
16020		    ;;
16021		*)  cat >&4 <<EOM
16022Cannot determine the largest integer value your NVs can hold, unexpected output
16023'$xxx'
16024EOM
16025		    ;;
16026	    esac
16027	    ;;
16028	*)  cat >&4 <<EOM
16029Cannot determine the largest integer value your NVs can hold
16030EOM
16031	    ;;
16032    esac
16033fi
16034$rm_try
16035
16036$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16037: volatile so that the compiler has to store it out to memory.
16038if test X"$d_volatile" = X"$define"; then
16039	volatile=volatile
16040fi
16041$cat <<EOP >try.c
16042#include <stdio.h>
16043#$i_stdlib I_STDLIB
16044#ifdef I_STDLIB
16045#include <stdlib.h>
16046#endif
16047#$i_string I_STRING
16048#ifdef I_STRING
16049#  include <string.h>
16050#else
16051#  include <strings.h>
16052#endif
16053#include <sys/types.h>
16054#include <signal.h>
16055#ifdef SIGFPE
16056$volatile int bletched = 0;
16057$signal_t blech(int s) { bletched = 1; }
16058#endif
16059
16060int checkit($nvtype d, char *where) {
16061    unsigned char *p = (char *)&d;
16062    unsigned char *end = p + sizeof(d);
16063    int fail = 0;
16064
16065    while (p < end)
16066	fail += *p++;
16067
16068    if (!fail)
16069	return 0;
16070
16071    p = (char *)&d;
16072    printf("No - %s: 0x", where);
16073    while (p < end)
16074	printf ("%02X", *p++);
16075    printf("\n");
16076    return 1;
16077}
16078
16079int main(int argc, char **argv) {
16080    $nvtype d = 0.0;
16081    int fail = 0;
16082    fail += checkit(d, "0.0");
16083
16084    /* The compiler shouldn't be assuming that bletched is 0  */
16085    d = bletched;
16086
16087    fail += checkit(d, "bleched");
16088
16089#ifdef SIGFPE
16090    signal(SIGFPE, blech);
16091#endif
16092
16093    /* Paranoia - the compiler should have no way of knowing that ANSI says
16094       that argv[argc] will always be NULL.  Actually, if it did assume this it
16095       would be buggy, as this is C and main() can be called from elsewhere in
16096       the program.  */
16097    d = argv[argc] ? 1 : 0;
16098
16099    if (d) {
16100	printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16101    }
16102
16103    fail += checkit(d, "ternary");
16104
16105    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16106
16107    if (d != 0.0) {
16108	printf("No - memset doesn't give 0.0\n");
16109	/* This might just blow up:  */
16110	printf("(gives %g)\n", d);
16111	return 1;
16112    }
16113
16114#ifdef SIGFPE
16115    if (bletched) {
16116	printf("No - something bleched\n");
16117	return 1;
16118    }
16119#endif
16120    if (fail) {
16121      printf("No - %d fail(s)\n", fail);
16122      return 1;
16123    }
16124    printf("Yes\n");
16125    return 0;
16126}
16127EOP
16128set try
16129
16130d_nv_zero_is_allbits_zero="$undef"
16131if eval $compile; then
16132    xxx="`$run ./try`"
16133    case "$?" in
16134	0)
16135	    case "$xxx" in
16136		Yes)  cat >&4 <<EOM
161370.0 is represented as all bits zero in memory
16138EOM
16139		    d_nv_zero_is_allbits_zero="$define"
16140		    ;;
16141		*)  cat >&4 <<EOM
161420.0 is not represented as all bits zero in memory
16143EOM
16144		    d_nv_zero_is_allbits_zero="$undef"
16145		    ;;
16146	    esac
16147	    ;;
16148	*)  cat >&4 <<EOM
161490.0 is not represented as all bits zero in memory
16150EOM
16151	    d_nv_zero_is_allbits_zero="$undef"
16152	    ;;
16153    esac
16154fi
16155$rm_try
16156
16157: check for off64_t
16158echo " "
16159echo "Checking to see if you have off64_t..." >&4
16160$cat >try.c <<EOCP
16161#include <sys/types.h>
16162#include <unistd.h>
16163int main() { off64_t x = 7; }
16164EOCP
16165set try
16166if eval $compile; then
16167	val="$define"
16168	echo "You have off64_t."
16169else
16170	val="$undef"
16171	echo "You do not have off64_t."
16172	case "$lseeksize" in
16173	8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16174	esac
16175fi
16176$rm_try
16177set d_off64_t
16178eval $setvar
16179
16180: how to create joinable pthreads
16181if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16182	echo " "
16183	echo "Checking what constant to use for creating joinable pthreads..." >&4
16184	$cat >try.c <<'EOCP'
16185#include <pthread.h>
16186int main() {
16187    int detachstate = JOINABLE;
16188}
16189EOCP
16190	set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16191	if eval $compile; then
16192		echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16193		val="$undef" # Yes, undef.
16194		set d_old_pthread_create_joinable
16195		eval $setvar
16196		val=""
16197		set old_pthread_create_joinable
16198		eval $setvar
16199	else
16200		set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16201		if eval $compile; then
16202			echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16203			val="$define"
16204			set d_old_pthread_create_joinable
16205			eval $setvar
16206			val=PTHREAD_CREATE_UNDETACHED
16207			set old_pthread_create_joinable
16208			eval $setvar
16209		else
16210			set try -DJOINABLE=__UNDETACHED
16211			if eval $compile; then
16212				echo "You seem to use __UNDETACHED." >&4
16213				val="$define"
16214				set d_old_pthread_create_joinable
16215				eval $setvar
16216				val=__UNDETACHED
16217				set old_pthread_create_joinable
16218				eval $setvar
16219			else
16220				echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16221				val="$define"
16222				set d_old_pthread_create_joinable
16223				eval $setvar
16224				val=0
16225				set old_pthread_create_joinable
16226				eval $setvar
16227			fi
16228		fi
16229	fi
16230	$rm_try
16231else
16232    d_old_pthread_create_joinable="$undef"
16233    old_pthread_create_joinable=""
16234fi
16235
16236: see if pause exists
16237set pause d_pause
16238eval $inlibc
16239
16240: see if poll exists
16241set poll d_poll
16242eval $inlibc
16243
16244: see if prctl exists
16245set prctl d_prctl
16246eval $inlibc
16247
16248: see if prctl supports PR_SET_NAME
16249d_prctl_set_name=$undef
16250case $d_prctl in
16251    $define)
16252	$cat >try.c <<EOM
16253#include <sys/prctl.h>
16254
16255int main (int argc, char *argv[])
16256{
16257    return (prctl (PR_SET_NAME, "Test"));
16258    } /* main */
16259EOM
16260	set try
16261	if eval $compile_ok && $run ./try; then
16262	    echo "Your prctl (PR_SET_NAME, ...) works"
16263	    d_prctl_set_name=$define
16264	    fi
16265	$rm_try
16266	;;
16267    esac
16268
16269: see if readlink exists
16270set readlink d_readlink
16271eval $inlibc
16272
16273: Check if exe is symlink to abs path of executing program
16274echo " "
16275procselfexe=''
16276val="$undef"
16277case "$d_readlink" in
16278    "$define")
16279	: NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16280	: more tidy to avoid an extra level of symlink
16281	set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16282	while test $# -gt 0; do
16283	    type=$1; try=$2
16284	    shift; shift
16285	    if $issymlink $try; then
16286		$ls -l $try > reflect
16287		if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16288		    echo "You have $type-like $try."
16289		    procselfexe='"'$try'"'
16290		    val="$define"
16291		    : This will break out of the loop
16292		    set X; shift
16293		fi
16294	    fi
16295	done
16296	;;
16297esac
16298$rm -f reflect
16299set d_procselfexe
16300eval $setvar
16301
16302: backward compatibility for d_hvfork
16303if test X$d_hvfork != X; then
16304	d_vfork="$d_hvfork"
16305	d_hvfork=''
16306fi
16307: see if there is a vfork
16308val=''
16309set vfork val
16310eval $inlibc
16311
16312d_pseudofork=$undef
16313
16314: Ok, but do we want to use it. vfork is reportedly unreliable in
16315: perl on Solaris 2.x, and probably elsewhere.
16316case "$val" in
16317$define)
16318	echo " "
16319	case "$usevfork" in
16320	false) dflt='n';;
16321	*) dflt='y';;
16322	esac
16323	cat <<'EOM'
16324
16325Perl can only use a vfork() that doesn't suffer from strict
16326restrictions on calling functions or modifying global data in
16327the child.  For example, glibc-2.1 contains such a vfork()
16328that is unsuitable.  If your system provides a proper fork()
16329call, chances are that you do NOT want perl to use vfork().
16330
16331EOM
16332	rp="Do you still want to use vfork()?"
16333	. ./myread
16334	case "$ans" in
16335	y|Y) ;;
16336	*)
16337		echo "Ok, we won't use vfork()."
16338		val="$undef"
16339		;;
16340	esac
16341	;;
16342esac
16343set d_vfork
16344eval $setvar
16345case "$d_vfork" in
16346$define) usevfork='true';;
16347*) usevfork='false';;
16348esac
16349
16350: see whether the pthread_atfork exists
16351$cat >try.c <<EOP
16352#include <pthread.h>
16353#include <stdio.h>
16354int main() {
16355#ifdef  PTHREAD_ATFORK
16356        pthread_atfork(NULL,NULL,NULL);
16357#endif
16358}
16359EOP
16360
16361: see if pthread_atfork exists
16362set try -DPTHREAD_ATFORK
16363if eval $compile; then
16364    val="$define"
16365else
16366    val="$undef"
16367fi
16368case "$usethreads" in
16369$define)
16370        case "$val" in
16371        $define) echo 'pthread_atfork found.' >&4        ;;
16372        *)       echo 'pthread_atfork NOT found.' >&4    ;;
16373        esac
16374esac
16375set d_pthread_atfork
16376eval $setvar
16377
16378: see if pthread_attr_setscope exists
16379set pthread_attr_setscope d_pthread_attr_setscope
16380eval $inlibc
16381
16382: see whether the various POSIXish _yields exist
16383$cat >try.c <<EOP
16384#include <pthread.h>
16385#include <stdio.h>
16386int main() {
16387#ifdef SCHED_YIELD
16388	sched_yield();
16389#else
16390#ifdef PTHREAD_YIELD
16391	pthread_yield();
16392#else
16393#ifdef PTHREAD_YIELD_NULL
16394	pthread_yield(NULL);
16395#endif
16396#endif
16397#endif
16398}
16399EOP
16400: see if sched_yield exists
16401set try -DSCHED_YIELD
16402if eval $compile; then
16403    val="$define"
16404    sched_yield='sched_yield()'
16405else
16406    val="$undef"
16407fi
16408case "$usethreads" in
16409$define)
16410	case "$val" in
16411	$define) echo 'sched_yield() found.' >&4	;;
16412	*)	 echo 'sched_yield() NOT found.' >&4	;;
16413	esac
16414esac
16415set d_sched_yield
16416eval $setvar
16417
16418: see if pthread_yield exists
16419set try -DPTHREAD_YIELD
16420if eval $compile; then
16421    val="$define"
16422    case "$sched_yield" in
16423    '') sched_yield='pthread_yield()' ;;
16424    esac
16425else
16426    set try -DPTHREAD_YIELD_NULL
16427    if eval $compile; then
16428	val="$define"
16429	case "$sched_yield" in
16430	'') sched_yield='pthread_yield(NULL)' ;;
16431	esac
16432    else
16433	val="$undef"
16434    fi
16435fi
16436case "$usethreads" in
16437$define)
16438	case "$val" in
16439	$define) echo 'pthread_yield() found.' >&4	;;
16440	*)	 echo 'pthread_yield() NOT found.' >&4	;;
16441	esac
16442	;;
16443esac
16444set d_pthread_yield
16445eval $setvar
16446case "$sched_yield" in
16447'') sched_yield=undef ;;
16448esac
16449$rm_try
16450
16451: see if random_r exists
16452set random_r d_random_r
16453eval $inlibc
16454case "$d_random_r" in
16455"$define")
16456	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16457	case "$d_random_r_proto:$usethreads" in
16458	":define")	d_random_r_proto=define
16459		set d_random_r_proto random_r $hdrs
16460		eval $hasproto ;;
16461	*)	;;
16462	esac
16463	case "$d_random_r_proto" in
16464	define)
16465	case "$random_r_proto" in
16466	''|0) try='int random_r(int*, struct random_data*);'
16467	./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16468	esac
16469	case "$random_r_proto" in
16470	''|0) try='int random_r(long*, struct random_data*);'
16471	./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16472	esac
16473	case "$random_r_proto" in
16474	''|0) try='int random_r(struct random_data*, int32_t*);'
16475	./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16476	esac
16477	case "$random_r_proto" in
16478	''|0)	d_random_r=undef
16479 	        random_r_proto=0
16480		echo "Disabling random_r, cannot determine prototype." >&4 ;;
16481	* )	case "$random_r_proto" in
16482		REENTRANT_PROTO*) ;;
16483		*) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16484		esac
16485		echo "Prototype: $try" ;;
16486	esac
16487	;;
16488	*)	case "$usethreads" in
16489		define) echo "random_r has no prototype, not using it." >&4 ;;
16490		esac
16491		d_random_r=undef
16492		random_r_proto=0
16493		;;
16494	esac
16495	;;
16496*)	random_r_proto=0
16497	;;
16498esac
16499
16500: see if readdir and friends exist
16501set readdir d_readdir
16502eval $inlibc
16503set seekdir d_seekdir
16504eval $inlibc
16505set telldir d_telldir
16506eval $inlibc
16507set rewinddir d_rewinddir
16508eval $inlibc
16509
16510: see if readdir64_r exists
16511set readdir64_r d_readdir64_r
16512eval $inlibc
16513case "$d_readdir64_r" in
16514"$define")
16515	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16516	case "$d_readdir64_r_proto:$usethreads" in
16517	":define")	d_readdir64_r_proto=define
16518		set d_readdir64_r_proto readdir64_r $hdrs
16519		eval $hasproto ;;
16520	*)	;;
16521	esac
16522	case "$d_readdir64_r_proto" in
16523	define)
16524	case "$readdir64_r_proto" in
16525	''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16526	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16527	esac
16528	case "$readdir64_r_proto" in
16529	''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16530	./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16531	esac
16532	case "$readdir64_r_proto" in
16533	''|0)	d_readdir64_r=undef
16534 	        readdir64_r_proto=0
16535		echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16536	* )	case "$readdir64_r_proto" in
16537		REENTRANT_PROTO*) ;;
16538		*) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16539		esac
16540		echo "Prototype: $try" ;;
16541	esac
16542	;;
16543	*)	case "$usethreads" in
16544		define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16545		esac
16546		d_readdir64_r=undef
16547		readdir64_r_proto=0
16548		;;
16549	esac
16550	;;
16551*)	readdir64_r_proto=0
16552	;;
16553esac
16554
16555: see if readdir_r exists
16556set readdir_r d_readdir_r
16557eval $inlibc
16558case "$d_readdir_r" in
16559"$define")
16560	hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16561	case "$d_readdir_r_proto:$usethreads" in
16562	":define")	d_readdir_r_proto=define
16563		set d_readdir_r_proto readdir_r $hdrs
16564		eval $hasproto ;;
16565	*)	;;
16566	esac
16567	case "$d_readdir_r_proto" in
16568	define)
16569	case "$readdir_r_proto" in
16570	''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16571	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16572	esac
16573	case "$readdir_r_proto" in
16574	''|0) try='int readdir_r(DIR*, struct dirent*);'
16575	./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16576	esac
16577	case "$readdir_r_proto" in
16578	''|0)	d_readdir_r=undef
16579 	        readdir_r_proto=0
16580		echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16581	* )	case "$readdir_r_proto" in
16582		REENTRANT_PROTO*) ;;
16583		*) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16584		esac
16585		echo "Prototype: $try" ;;
16586	esac
16587	;;
16588	*)	case "$usethreads" in
16589		define) echo "readdir_r has no prototype, not using it." >&4 ;;
16590		esac
16591		d_readdir_r=undef
16592		readdir_r_proto=0
16593		;;
16594	esac
16595	;;
16596*)	readdir_r_proto=0
16597	;;
16598esac
16599
16600: see if readv exists
16601set readv d_readv
16602eval $inlibc
16603
16604: see if recvmsg exists
16605set recvmsg d_recvmsg
16606eval $inlibc
16607
16608: see if rename exists
16609set rename d_rename
16610eval $inlibc
16611
16612: see if rmdir exists
16613set rmdir d_rmdir
16614eval $inlibc
16615
16616: see if memory.h is available.
16617val=''
16618set memory.h val
16619eval $inhdr
16620
16621: See if it conflicts with string.h
16622case "$val" in
16623$define)
16624	case "$strings" in
16625	'') ;;
16626	*)
16627		$cppstdin $cppflags $cppminus < $strings > mem.h
16628		if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16629			echo " "
16630			echo "We won't be including <memory.h>."
16631			val="$undef"
16632		fi
16633		$rm -f mem.h
16634		;;
16635	esac
16636esac
16637set i_memory
16638eval $setvar
16639
16640: can bcopy handle overlapping blocks?
16641echo " "
16642val="$undef"
16643case "$d_memmove" in
16644"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16645*)	case "$d_bcopy" in
16646	"$define")
16647		echo "Checking to see if bcopy() can do overlapping copies..." >&4
16648		$cat >try.c <<EOCP
16649#$i_memory I_MEMORY
16650#$i_stdlib I_STDLIB
16651#$i_string I_STRING
16652#$i_unistd I_UNISTD
16653EOCP
16654	$cat >>try.c <<'EOCP'
16655#include <stdio.h>
16656#ifdef I_MEMORY
16657#  include <memory.h>
16658#endif
16659#ifdef I_STDLIB
16660#  include <stdlib.h>
16661#endif
16662#ifdef I_STRING
16663#  include <string.h>
16664#else
16665#  include <strings.h>
16666#endif
16667#ifdef I_UNISTD
16668#  include <unistd.h>  /* Needed for NetBSD */
16669#endif
16670int main()
16671{
16672char buf[128], abc[128];
16673char *b;
16674int len;
16675int off;
16676int align;
16677
16678/* Copy "abcde..." string to char abc[] so that gcc doesn't
16679   try to store the string in read-only memory. */
16680bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16681
16682for (align = 7; align >= 0; align--) {
16683	for (len = 36; len; len--) {
16684		b = buf+align;
16685		bcopy(abc, b, len);
16686		for (off = 1; off <= len; off++) {
16687			bcopy(b, b+off, len);
16688			bcopy(b+off, b, len);
16689			if (bcmp(b, abc, len))
16690				exit(1);
16691		}
16692	}
16693}
16694exit(0);
16695}
16696EOCP
16697		set try
16698		if eval $compile_ok; then
16699			if $run ./try 2>/dev/null; then
16700				echo "Yes, it can."
16701				val="$define"
16702			else
16703				echo "It can't, sorry."
16704			fi
16705		else
16706			echo "(I can't compile the test program, so we'll assume not...)"
16707		fi
16708		;;
16709	esac
16710	$rm_try
16711	;;
16712esac
16713set d_safebcpy
16714eval $setvar
16715
16716: can memcpy handle overlapping blocks?
16717echo " "
16718val="$undef"
16719case "$d_memmove" in
16720"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16721*)	case "$d_memcpy" in
16722	"$define")
16723		echo "Checking to see if memcpy() can do overlapping copies..." >&4
16724		$cat >try.c <<EOCP
16725#$i_memory I_MEMORY
16726#$i_stdlib I_STDLIB
16727#$i_string I_STRING
16728#$i_unistd I_UNISTD
16729EOCP
16730	$cat >>try.c <<'EOCP'
16731#include <stdio.h>
16732#ifdef I_MEMORY
16733#  include <memory.h>
16734#endif
16735#ifdef I_STDLIB
16736#  include <stdlib.h>
16737#endif
16738#ifdef I_STRING
16739#  include <string.h>
16740#else
16741#  include <strings.h>
16742#endif
16743#ifdef I_UNISTD
16744#  include <unistd.h>  /* Needed for NetBSD */
16745#endif
16746int main()
16747{
16748char buf[128], abc[128];
16749char *b;
16750int len;
16751int off;
16752int align;
16753
16754/* Copy "abcde..." string to char abc[] so that gcc doesn't
16755   try to store the string in read-only memory. */
16756memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16757
16758for (align = 7; align >= 0; align--) {
16759	for (len = 36; len; len--) {
16760		b = buf+align;
16761		memcpy(b, abc, len);
16762		for (off = 1; off <= len; off++) {
16763			memcpy(b+off, b, len);
16764			memcpy(b, b+off, len);
16765			if (memcmp(b, abc, len))
16766				exit(1);
16767		}
16768	}
16769}
16770exit(0);
16771}
16772EOCP
16773		set try
16774		if eval $compile_ok; then
16775			if $run ./try 2>/dev/null; then
16776				echo "Yes, it can."
16777				val="$define"
16778			else
16779				echo "It can't, sorry."
16780			fi
16781		else
16782			echo "(I can't compile the test program, so we'll assume not...)"
16783		fi
16784		;;
16785	esac
16786	$rm_try
16787	;;
16788esac
16789set d_safemcpy
16790eval $setvar
16791
16792: can memcmp be trusted to compare relative magnitude?
16793val="$undef"
16794case "$d_memcmp" in
16795"$define")
16796	echo " "
16797	echo "Checking if your memcmp() can compare relative magnitude..." >&4
16798	$cat >try.c <<EOCP
16799#$i_memory I_MEMORY
16800#$i_stdlib I_STDLIB
16801#$i_string I_STRING
16802#$i_unistd I_UNISTD
16803EOCP
16804	$cat >>try.c <<'EOCP'
16805#include <stdio.h>
16806#ifdef I_MEMORY
16807#  include <memory.h>
16808#endif
16809#ifdef I_STDLIB
16810#  include <stdlib.h>
16811#endif
16812#ifdef I_STRING
16813#  include <string.h>
16814#else
16815#  include <strings.h>
16816#endif
16817#ifdef I_UNISTD
16818#  include <unistd.h>  /* Needed for NetBSD */
16819#endif
16820int main()
16821{
16822char a = -1;
16823char b = 0;
16824if ((a < b) && memcmp(&a, &b, 1) < 0)
16825	exit(1);
16826exit(0);
16827}
16828EOCP
16829	set try
16830	if eval $compile_ok; then
16831		if $run ./try 2>/dev/null; then
16832			echo "Yes, it can."
16833			val="$define"
16834		else
16835			echo "No, it can't (it uses signed chars)."
16836		fi
16837	else
16838		echo "(I can't compile the test program, so we'll assume not...)"
16839	fi
16840	;;
16841esac
16842$rm_try
16843set d_sanemcmp
16844eval $setvar
16845
16846: see if prototype for sbrk is available
16847echo " "
16848set d_sbrkproto sbrk $i_unistd unistd.h
16849eval $hasproto
16850
16851: see if select exists
16852set select d_select
16853eval $inlibc
16854
16855: see if semctl exists
16856set semctl d_semctl
16857eval $inlibc
16858
16859: see if semget exists
16860set semget d_semget
16861eval $inlibc
16862
16863: see if semop exists
16864set semop d_semop
16865eval $inlibc
16866
16867: see how much of the 'sem*(2)' library is present.
16868h_sem=true
16869echo " "
16870case "$d_semctl$d_semget$d_semop" in
16871*"$undef"*) h_sem=false;;
16872esac
16873case "$osname" in
16874freebsd)
16875    case "`ipcs 2>&1`" in
16876    "SVID messages"*"not configured"*)
16877	echo "Your $osname does not have the sem*(2) configured." >&4
16878        h_sem=false
16879	val="$undef"
16880	set semctl d_semctl
16881	eval $setvar
16882	set semget d_semget
16883	eval $setvar
16884	set semop d_semop
16885	eval $setvar
16886	;;
16887    esac
16888    ;;
16889esac
16890: we could also check for sys/ipc.h ...
16891if $h_sem && $test `./findhdr sys/sem.h`; then
16892	echo "You have the full sem*(2) library." >&4
16893	val="$define"
16894else
16895	echo "You don't have the full sem*(2) library." >&4
16896	val="$undef"
16897fi
16898set d_sem
16899eval $setvar
16900
16901: see whether sys/sem.h defines union semun
16902echo " "
16903$cat > try.c <<'END'
16904#include <sys/types.h>
16905#include <sys/ipc.h>
16906#include <sys/sem.h>
16907int main () { union semun semun; semun.buf = 0; }
16908END
16909set try
16910if eval $compile; then
16911    echo "You have union semun in <sys/sem.h>." >&4
16912    val="$define"
16913else
16914    echo "You do not have union semun in <sys/sem.h>." >&4
16915    val="$undef"
16916fi
16917$rm_try
16918set d_union_semun
16919eval $setvar
16920
16921: see how to do semctl IPC_STAT
16922case "$d_sem" in
16923$define)
16924    echo " "
16925    $cat > tryh.h <<END
16926#ifndef S_IRUSR
16927#   ifdef S_IREAD
16928#	define S_IRUSR S_IREAD
16929#	define S_IWUSR S_IWRITE
16930#	define S_IXUSR S_IEXEC
16931#   else
16932#	define S_IRUSR 0400
16933#	define S_IWUSR 0200
16934#	define S_IXUSR 0100
16935#   endif
16936#   define S_IRGRP (S_IRUSR>>3)
16937#   define S_IWGRP (S_IWUSR>>3)
16938#   define S_IXGRP (S_IXUSR>>3)
16939#   define S_IROTH (S_IRUSR>>6)
16940#   define S_IWOTH (S_IWUSR>>6)
16941#   define S_IXOTH (S_IXUSR>>6)
16942#endif
16943#ifndef S_IRWXU
16944#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16945#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16946#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16947#endif
16948END
16949    : see whether semctl IPC_STAT can use union semun
16950    case "$d_semctl_semun" in
16951    '')
16952      val="$undef"
16953      $cat > try.c <<END
16954#include <sys/types.h>
16955#include <sys/ipc.h>
16956#include <sys/sem.h>
16957#include <sys/stat.h>
16958#include <stdio.h>
16959#include <errno.h>
16960#include "tryh.h"
16961#ifndef errno
16962extern int errno;
16963#endif
16964#$d_union_semun HAS_UNION_SEMUN
16965int main() {
16966    union semun
16967#ifndef HAS_UNION_SEMUN
16968    {
16969	int val;
16970	struct semid_ds *buf;
16971	unsigned short *array;
16972    }
16973#endif
16974    arg;
16975    int sem, st;
16976
16977#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16978    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16979    if (sem > -1) {
16980	struct semid_ds argbuf;
16981	arg.buf = &argbuf;
16982#	ifdef IPC_STAT
16983	st = semctl(sem, 0, IPC_STAT, arg);
16984	if (st == 0)
16985	    printf("semun\n");
16986	else
16987#	endif /* IPC_STAT */
16988	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
16989#	ifdef IPC_RMID
16990	if (semctl(sem, 0, IPC_RMID, arg) != 0)
16991#	endif /* IPC_RMID */
16992	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
16993    } else
16994#endif /* IPC_PRIVATE && ... */
16995	printf("semget failed: errno = %d\n", errno);
16996  return 0;
16997}
16998END
16999      set try
17000      if eval $compile; then
17001	  xxx=`$run ./try`
17002          case "$xxx" in
17003          semun) val="$define" ;;
17004          esac
17005      fi
17006      $rm_try
17007      set d_semctl_semun
17008      eval $setvar
17009      ;;
17010    esac
17011    case "$d_semctl_semun" in
17012    $define)
17013        echo "You can use union semun for semctl IPC_STAT." >&4
17014	also='also'
17015        ;;
17016    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17017	also=''
17018        ;;
17019    esac
17020
17021    : see whether semctl IPC_STAT can use struct semid_ds pointer
17022    case "$d_semctl_semid_ds" in
17023    '')
17024      val="$undef"
17025      $cat > try.c <<'END'
17026#include <sys/types.h>
17027#include <sys/ipc.h>
17028#include <sys/sem.h>
17029#include <sys/stat.h>
17030#include "tryh.h"
17031#include <stdio.h>
17032#include <errno.h>
17033#ifndef errno
17034extern int errno;
17035#endif
17036int main() {
17037    struct semid_ds arg;
17038    int sem, st;
17039
17040#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17041    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17042    if (sem > -1) {
17043#	ifdef IPC_STAT
17044	st = semctl(sem, 0, IPC_STAT, &arg);
17045	if (st == 0)
17046	    printf("semid_ds\n");
17047	else
17048#	endif /* IPC_STAT */
17049	    printf("semctl IPC_STAT failed: errno = %d\n", errno);
17050#	ifdef IPC_RMID
17051	if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17052#	endif /* IPC_RMID */
17053	    printf("semctl IPC_RMID failed: errno = %d\n", errno);
17054    } else
17055#endif /* IPC_PRIVATE && ... */
17056	printf("semget failed: errno = %d\n", errno);
17057
17058    return 0;
17059}
17060END
17061      set try
17062      if eval $compile; then
17063          xxx=`$run ./try`
17064          case "$xxx" in
17065          semid_ds) val="$define" ;;
17066          esac
17067      fi
17068      $rm_try
17069      set d_semctl_semid_ds
17070      eval $setvar
17071      ;;
17072    esac
17073    case "$d_semctl_semid_ds" in
17074    $define)
17075        echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17076        ;;
17077    *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17078        ;;
17079    esac
17080    ;;
17081*)  val="$undef"
17082
17083    # We do not have the full sem*(2) library, so assume we can not
17084    # use either.
17085
17086    set d_semctl_semun
17087    eval $setvar
17088
17089    set d_semctl_semid_ds
17090    eval $setvar
17091    ;;
17092esac
17093$rm_try tryh.h
17094
17095: see if sendmsg exists
17096set sendmsg d_sendmsg
17097eval $inlibc
17098
17099: see if setegid exists
17100set setegid d_setegid
17101eval $inlibc
17102
17103: see if seteuid exists
17104set seteuid d_seteuid
17105eval $inlibc
17106
17107: see if setgrent exists
17108set setgrent d_setgrent
17109eval $inlibc
17110
17111: see if setgrent_r exists
17112set setgrent_r d_setgrent_r
17113eval $inlibc
17114case "$d_setgrent_r" in
17115"$define")
17116	hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17117	case "$d_setgrent_r_proto:$usethreads" in
17118	":define")	d_setgrent_r_proto=define
17119		set d_setgrent_r_proto setgrent_r $hdrs
17120		eval $hasproto ;;
17121	*)	;;
17122	esac
17123	case "$d_setgrent_r_proto" in
17124	define)
17125	case "$setgrent_r_proto" in
17126	''|0) try='int setgrent_r(FILE**);'
17127	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17128	esac
17129	case "$setgrent_r_proto" in
17130	''|0) try='void setgrent_r(FILE**);'
17131	./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17132	esac
17133	case "$setgrent_r_proto" in
17134	''|0)	d_setgrent_r=undef
17135 	        setgrent_r_proto=0
17136		echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17137	* )	case "$setgrent_r_proto" in
17138		REENTRANT_PROTO*) ;;
17139		*) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17140		esac
17141		echo "Prototype: $try" ;;
17142	esac
17143	;;
17144	*)	case "$usethreads" in
17145		define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17146		esac
17147		d_setgrent_r=undef
17148		setgrent_r_proto=0
17149		;;
17150	esac
17151	;;
17152*)	setgrent_r_proto=0
17153	;;
17154esac
17155
17156: see if sethostent exists
17157set sethostent d_sethent
17158eval $inlibc
17159
17160: see if sethostent_r exists
17161set sethostent_r d_sethostent_r
17162eval $inlibc
17163case "$d_sethostent_r" in
17164"$define")
17165	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17166	case "$d_sethostent_r_proto:$usethreads" in
17167	":define")	d_sethostent_r_proto=define
17168		set d_sethostent_r_proto sethostent_r $hdrs
17169		eval $hasproto ;;
17170	*)	;;
17171	esac
17172	case "$d_sethostent_r_proto" in
17173	define)
17174	case "$sethostent_r_proto" in
17175	''|0) try='int sethostent_r(int, struct hostent_data*);'
17176	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17177	esac
17178	case "$sethostent_r_proto" in
17179	''|0) try='void sethostent_r(int, struct hostent_data*);'
17180	./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17181	esac
17182	case "$sethostent_r_proto" in
17183	''|0)	d_sethostent_r=undef
17184 	        sethostent_r_proto=0
17185		echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17186	* )	case "$sethostent_r_proto" in
17187		REENTRANT_PROTO*) ;;
17188		*) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17189		esac
17190		echo "Prototype: $try" ;;
17191	esac
17192	;;
17193	*)	case "$usethreads" in
17194		define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17195		esac
17196		d_sethostent_r=undef
17197		sethostent_r_proto=0
17198		;;
17199	esac
17200	;;
17201*)	sethostent_r_proto=0
17202	;;
17203esac
17204
17205: see if setitimer exists
17206set setitimer d_setitimer
17207eval $inlibc
17208
17209: see if setlinebuf exists
17210set setlinebuf d_setlinebuf
17211eval $inlibc
17212
17213: see if setlocale exists
17214set setlocale d_setlocale
17215eval $inlibc
17216
17217: see if locale.h is available
17218set locale.h i_locale
17219eval $inhdr
17220
17221: see if setlocale_r exists
17222set setlocale_r d_setlocale_r
17223eval $inlibc
17224case "$d_setlocale_r" in
17225"$define")
17226	hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17227	case "$d_setlocale_r_proto:$usethreads" in
17228	":define")	d_setlocale_r_proto=define
17229		set d_setlocale_r_proto setlocale_r $hdrs
17230		eval $hasproto ;;
17231	*)	;;
17232	esac
17233	case "$d_setlocale_r_proto" in
17234	define)
17235	case "$setlocale_r_proto" in
17236	''|0) try='int setlocale_r(int, const char*, char*, int);'
17237	./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17238	esac
17239	case "$setlocale_r_proto" in
17240	''|0)	d_setlocale_r=undef
17241 	        setlocale_r_proto=0
17242		echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17243	* )	case "$setlocale_r_proto" in
17244		REENTRANT_PROTO*) ;;
17245		*) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17246		esac
17247		echo "Prototype: $try" ;;
17248	esac
17249	;;
17250	*)	case "$usethreads" in
17251		define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17252		esac
17253		d_setlocale_r=undef
17254		setlocale_r_proto=0
17255		;;
17256	esac
17257	;;
17258*)	setlocale_r_proto=0
17259	;;
17260esac
17261
17262: see if setnetent exists
17263set setnetent d_setnent
17264eval $inlibc
17265
17266: see if setnetent_r exists
17267set setnetent_r d_setnetent_r
17268eval $inlibc
17269case "$d_setnetent_r" in
17270"$define")
17271	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17272	case "$d_setnetent_r_proto:$usethreads" in
17273	":define")	d_setnetent_r_proto=define
17274		set d_setnetent_r_proto setnetent_r $hdrs
17275		eval $hasproto ;;
17276	*)	;;
17277	esac
17278	case "$d_setnetent_r_proto" in
17279	define)
17280	case "$setnetent_r_proto" in
17281	''|0) try='int setnetent_r(int, struct netent_data*);'
17282	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17283	esac
17284	case "$setnetent_r_proto" in
17285	''|0) try='void setnetent_r(int, struct netent_data*);'
17286	./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17287	esac
17288	case "$setnetent_r_proto" in
17289	''|0)	d_setnetent_r=undef
17290 	        setnetent_r_proto=0
17291		echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17292	* )	case "$setnetent_r_proto" in
17293		REENTRANT_PROTO*) ;;
17294		*) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17295		esac
17296		echo "Prototype: $try" ;;
17297	esac
17298	;;
17299	*)	case "$usethreads" in
17300		define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17301		esac
17302		d_setnetent_r=undef
17303		setnetent_r_proto=0
17304		;;
17305	esac
17306	;;
17307*)	setnetent_r_proto=0
17308	;;
17309esac
17310
17311: see if setprotoent exists
17312set setprotoent d_setpent
17313eval $inlibc
17314
17315: see if setpgid exists
17316set setpgid d_setpgid
17317eval $inlibc
17318
17319: see if setpgrp2 exists
17320set setpgrp2 d_setpgrp2
17321eval $inlibc
17322
17323: see if setpriority exists
17324set setpriority d_setprior
17325eval $inlibc
17326
17327: see if setproctitle exists
17328set setproctitle d_setproctitle
17329eval $inlibc
17330
17331: see if setprotoent_r exists
17332set setprotoent_r d_setprotoent_r
17333eval $inlibc
17334case "$d_setprotoent_r" in
17335"$define")
17336	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17337	case "$d_setprotoent_r_proto:$usethreads" in
17338	":define")	d_setprotoent_r_proto=define
17339		set d_setprotoent_r_proto setprotoent_r $hdrs
17340		eval $hasproto ;;
17341	*)	;;
17342	esac
17343	case "$d_setprotoent_r_proto" in
17344	define)
17345	case "$setprotoent_r_proto" in
17346	''|0) try='int setprotoent_r(int, struct protoent_data*);'
17347	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17348	esac
17349	case "$setprotoent_r_proto" in
17350	''|0) try='void setprotoent_r(int, struct protoent_data*);'
17351	./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17352	esac
17353	case "$setprotoent_r_proto" in
17354	''|0)	d_setprotoent_r=undef
17355 	        setprotoent_r_proto=0
17356		echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17357	* )	case "$setprotoent_r_proto" in
17358		REENTRANT_PROTO*) ;;
17359		*) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17360		esac
17361		echo "Prototype: $try" ;;
17362	esac
17363	;;
17364	*)	case "$usethreads" in
17365		define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17366		esac
17367		d_setprotoent_r=undef
17368		setprotoent_r_proto=0
17369		;;
17370	esac
17371	;;
17372*)	setprotoent_r_proto=0
17373	;;
17374esac
17375
17376: see if setpwent exists
17377set setpwent d_setpwent
17378eval $inlibc
17379
17380: see if setpwent_r exists
17381set setpwent_r d_setpwent_r
17382eval $inlibc
17383case "$d_setpwent_r" in
17384"$define")
17385	hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17386	case "$d_setpwent_r_proto:$usethreads" in
17387	":define")	d_setpwent_r_proto=define
17388		set d_setpwent_r_proto setpwent_r $hdrs
17389		eval $hasproto ;;
17390	*)	;;
17391	esac
17392	case "$d_setpwent_r_proto" in
17393	define)
17394	case "$setpwent_r_proto" in
17395	''|0) try='int setpwent_r(FILE**);'
17396	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17397	esac
17398	case "$setpwent_r_proto" in
17399	''|0) try='void setpwent_r(FILE**);'
17400	./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17401	esac
17402	case "$setpwent_r_proto" in
17403	''|0)	d_setpwent_r=undef
17404 	        setpwent_r_proto=0
17405		echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17406	* )	case "$setpwent_r_proto" in
17407		REENTRANT_PROTO*) ;;
17408		*) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17409		esac
17410		echo "Prototype: $try" ;;
17411	esac
17412	;;
17413	*)	case "$usethreads" in
17414		define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17415		esac
17416		d_setpwent_r=undef
17417		setpwent_r_proto=0
17418		;;
17419	esac
17420	;;
17421*)	setpwent_r_proto=0
17422	;;
17423esac
17424
17425: see if setregid exists
17426set setregid d_setregid
17427eval $inlibc
17428set setresgid d_setresgid
17429eval $inlibc
17430
17431: see if setreuid exists
17432set setreuid d_setreuid
17433eval $inlibc
17434set setresuid d_setresuid
17435eval $inlibc
17436
17437: see if setrgid exists
17438set setrgid d_setrgid
17439eval $inlibc
17440
17441: see if setruid exists
17442set setruid d_setruid
17443eval $inlibc
17444
17445: see if setservent exists
17446set setservent d_setsent
17447eval $inlibc
17448
17449: see if setservent_r exists
17450set setservent_r d_setservent_r
17451eval $inlibc
17452case "$d_setservent_r" in
17453"$define")
17454	hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17455	case "$d_setservent_r_proto:$usethreads" in
17456	":define")	d_setservent_r_proto=define
17457		set d_setservent_r_proto setservent_r $hdrs
17458		eval $hasproto ;;
17459	*)	;;
17460	esac
17461	case "$d_setservent_r_proto" in
17462	define)
17463	case "$setservent_r_proto" in
17464	''|0) try='int setservent_r(int, struct servent_data*);'
17465	./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17466	esac
17467	case "$setservent_r_proto" in
17468	''|0) try='void setservent_r(int, struct servent_data*);'
17469	./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17470	esac
17471	case "$setservent_r_proto" in
17472	''|0)	d_setservent_r=undef
17473 	        setservent_r_proto=0
17474		echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17475	* )	case "$setservent_r_proto" in
17476		REENTRANT_PROTO*) ;;
17477		*) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17478		esac
17479		echo "Prototype: $try" ;;
17480	esac
17481	;;
17482	*)	case "$usethreads" in
17483		define) echo "setservent_r has no prototype, not using it." >&4 ;;
17484		esac
17485		d_setservent_r=undef
17486		setservent_r_proto=0
17487		;;
17488	esac
17489	;;
17490*)	setservent_r_proto=0
17491	;;
17492esac
17493
17494: see if setsid exists
17495set setsid d_setsid
17496eval $inlibc
17497
17498: see if setvbuf exists
17499set setvbuf d_setvbuf
17500eval $inlibc
17501
17502: see if sfio.h is available
17503set sfio.h i_sfio
17504eval $inhdr
17505
17506: see if sfio library is available
17507case "$i_sfio" in
17508$define)
17509	val=''
17510	set sfreserve val
17511	eval $inlibc
17512	;;
17513*)
17514	val="$undef"
17515	;;
17516esac
17517: Ok, but do we want to use it.
17518case "$val" in
17519$define)
17520	case "$usesfio" in
17521	true|$define|[yY]*) dflt='y';;
17522	*) dflt='n';;
17523	esac
17524	echo "$package can use the sfio library, but it is experimental."
17525	rp="You seem to have sfio available, do you want to try using it?"
17526	. ./myread
17527	case "$ans" in
17528	y|Y)	echo "Ok, turning on sfio then."
17529		val="$define"
17530		;;
17531	*)	echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17532		val="$undef"
17533		;;
17534	esac
17535	;;
17536*)	case "$usesfio" in
17537	true|$define|[yY]*)
17538		echo "Sorry, cannot find sfio on this machine." >&4
17539		echo "Ignoring your setting of usesfio=$usesfio." >&4
17540		val="$undef"
17541		;;
17542	esac
17543	;;
17544esac
17545set d_sfio
17546eval $setvar
17547case "$d_sfio" in
17548$define) usesfio='true';;
17549*) usesfio='false';;
17550esac
17551case "$d_sfio" in
17552$define) ;;
17553*)	: Remove sfio from list of libraries to use
17554	case "$libs" in
17555	*-lsfio*)
17556		echo "Removing unneeded -lsfio from library list" >&4
17557		set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17558		shift
17559		libs="$*"
17560		echo "libs = $libs" >&4
17561		;;
17562	esac
17563;;
17564esac
17565
17566
17567: see if shmctl exists
17568set shmctl d_shmctl
17569eval $inlibc
17570
17571: see if shmget exists
17572set shmget d_shmget
17573eval $inlibc
17574
17575: see if shmat exists
17576set shmat d_shmat
17577eval $inlibc
17578: see what shmat returns
17579case "$d_shmat" in
17580"$define")
17581	$cat >shmat.c <<'END'
17582#include <sys/shm.h>
17583void *shmat();
17584END
17585	if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17586		shmattype='void *'
17587	else
17588		shmattype='char *'
17589	fi
17590	echo "and it returns ($shmattype)." >&4
17591	: see if a prototype for shmat is available
17592	xxx=`./findhdr sys/shm.h`
17593	$cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17594	if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17595		val="$define"
17596	else
17597		val="$undef"
17598	fi
17599	$rm -f shmat.[co]
17600	;;
17601*)
17602	val="$undef"
17603	;;
17604esac
17605set d_shmatprototype
17606eval $setvar
17607
17608: see if shmdt exists
17609set shmdt d_shmdt
17610eval $inlibc
17611
17612: see how much of the 'shm*(2)' library is present.
17613h_shm=true
17614echo " "
17615case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17616*"$undef"*) h_shm=false;;
17617esac
17618case "$osname" in
17619freebsd)
17620    case "`ipcs 2>&1`" in
17621    "SVID shared memory"*"not configured"*)
17622	echo "Your $osname does not have the shm*(2) configured." >&4
17623        h_shm=false
17624	val="$undef"
17625	set shmctl d_shmctl
17626	evat $setvar
17627	set shmget d_shmget
17628	evat $setvar
17629	set shmat d_shmat
17630	evat $setvar
17631	set shmdt d_shmdt
17632	evat $setvar
17633	;;
17634    esac
17635    ;;
17636esac
17637: we could also check for sys/ipc.h ...
17638if $h_shm && $test `./findhdr sys/shm.h`; then
17639	echo "You have the full shm*(2) library." >&4
17640	val="$define"
17641else
17642	echo "You don't have the full shm*(2) library." >&4
17643	val="$undef"
17644fi
17645set d_shm
17646eval $setvar
17647
17648: see if we have sigaction
17649echo " "
17650if set sigaction val -f d_sigaction; eval $csym; $val; then
17651	echo 'sigaction() found.' >&4
17652	$cat > try.c <<EOP
17653#include <stdio.h>
17654#include <sys/types.h>
17655#include <signal.h>
17656#$i_stdlib I_STDLIB
17657#ifdef I_STDLIB
17658#include <stdlib.h>
17659#endif
17660int main()
17661{
17662    struct sigaction act, oact;
17663    act.sa_flags = 0;
17664    oact.sa_handler = 0;
17665    /* so that act and oact are used */
17666    exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17667}
17668EOP
17669	set try
17670	if eval $compile_ok; then
17671		val="$define"
17672	else
17673		echo "But you don't seem to have a usable struct sigaction." >&4
17674		val="$undef"
17675	fi
17676else
17677	echo 'sigaction NOT found.' >&4
17678	val="$undef"
17679fi
17680set d_sigaction; eval $setvar
17681$rm_try
17682
17683: see if this is a sunmath.h system
17684set sunmath.h i_sunmath
17685eval $inhdr
17686
17687: see if signbit exists
17688$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17689$cat >try.c <<EOCP
17690#$i_math I_MATH
17691#$i_sunmath I_SUNMATH
17692#ifdef I_MATH
17693#  include <math.h>
17694#endif
17695#ifdef I_SUNMATH  /* Solaris special math library */
17696#  include <sunmath.h>
17697#endif
17698#define NV $nvtype
17699int main(int argc, char **argv)
17700{
17701    NV x = 0.0;
17702    NV y = -0.0;
17703    if ((signbit(x) == 0) && (signbit(y) != 0))
17704	return 0;
17705    else
17706	return 1;
17707}
17708EOCP
17709val="$undef"
17710set try
17711if eval $compile; then
17712    if $run ./try; then
17713        $echo "Yes." >&4
17714	val="$define"
17715    else
17716        $echo "Signbit seems to be available, but doesn't work as I expected."
17717        $echo "I won't use it." >&4
17718	val="$undef"
17719    fi
17720else
17721    $echo "Nope." >&4
17722    dflt="$undef"
17723fi
17724set d_signbit
17725eval $setvar
17726$rm_try
17727
17728: see if sigprocmask exists
17729set sigprocmask d_sigprocmask
17730eval $inlibc
17731
17732: see if sigsetjmp exists
17733echo " "
17734case "$d_sigsetjmp" in
17735'')
17736	$cat >try.c <<EOP
17737#include <setjmp.h>
17738#$i_stdlib I_STDLIB
17739#ifdef I_STDLIB
17740#include <stdlib.h>
17741#endif
17742sigjmp_buf env;
17743int set = 1;
17744int main()
17745{
17746	if (sigsetjmp(env,1))
17747		exit(set);
17748	set = 0;
17749	siglongjmp(env, 1);
17750	exit(1);
17751}
17752EOP
17753	set try
17754	if eval $compile; then
17755		if $run ./try >/dev/null 2>&1; then
17756			echo "POSIX sigsetjmp found." >&4
17757			val="$define"
17758		else
17759			$cat >&4 <<EOM
17760Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17761I'll ignore them.
17762EOM
17763			val="$undef"
17764		fi
17765	else
17766		echo "sigsetjmp not found." >&4
17767		val="$undef"
17768	fi
17769	;;
17770*) val="$d_sigsetjmp"
17771	case "$d_sigsetjmp" in
17772	$define) echo "POSIX sigsetjmp found." >&4;;
17773	$undef) echo "sigsetjmp not found." >&4;;
17774	esac
17775	;;
17776esac
17777set d_sigsetjmp
17778eval $setvar
17779$rm_try
17780
17781: see if snprintf exists
17782set snprintf d_snprintf
17783eval $inlibc
17784
17785: see if vsnprintf exists
17786set vsnprintf d_vsnprintf
17787eval $inlibc
17788
17789case "$d_snprintf-$d_vsnprintf" in
17790"$define-$define")
17791    $cat <<EOM
17792Checking whether your snprintf() and vsnprintf() work okay...
17793EOM
17794    $cat >try.c <<'EOCP'
17795/* v?snprintf testing logic courtesy of Russ Allbery.
17796 * According to C99:
17797 * - if the buffer is too short it still must be \0-terminated
17798 * - if the buffer is too short the potentially required length
17799 *   must be returned and not -1
17800 * - if the buffer is NULL the potentially required length
17801 *   must be returned and not -1 or core dump
17802 */
17803#include <stdio.h>
17804#include <stdarg.h>
17805
17806char buf[2];
17807
17808int test (char *format, ...)
17809{
17810    va_list args;
17811    int count;
17812
17813    va_start (args, format);
17814    count = vsnprintf (buf, sizeof buf, format, args);
17815    va_end (args);
17816    return count;
17817}
17818
17819int main ()
17820{
17821    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17822             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17823}
17824EOCP
17825    set try
17826    if eval $compile; then
17827	`$run ./try`
17828	case "$?" in
17829	0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17830	*) cat <<EOM >&4
17831Your snprintf() and snprintf() don't seem to be working okay.
17832EOM
17833	   d_snprintf="$undef"
17834	   d_vsnprintf="$undef"
17835	   ;;
17836	esac
17837    else
17838	echo "(I can't seem to compile the test program--assuming they don't)"
17839	d_snprintf="$undef"
17840	d_vsnprintf="$undef"
17841    fi
17842    $rm_try
17843    ;;
17844esac
17845
17846: see if sockatmark exists
17847set sockatmark d_sockatmark
17848eval $inlibc
17849
17850: see if prototype for sockatmark is available
17851echo " "
17852set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17853eval $hasproto
17854
17855: see if socks5_init exists
17856set socks5_init d_socks5_init
17857eval $inlibc
17858
17859: see if sprintf returns the length of the string in the buffer as per ANSI
17860$echo "Checking whether sprintf returns the length of the string..." >&4
17861$cat <<EOP >try.c
17862#include <stdio.h>
17863#$i_stdlib I_STDLIB
17864#ifdef I_STDLIB
17865#include <stdlib.h>
17866#endif
17867#$i_string I_STRING
17868#ifdef I_STRING
17869#  include <string.h>
17870#else
17871#  include <strings.h>
17872#endif
17873#$i_math I_MATH
17874#ifdef I_MATH
17875#include <math.h>
17876#endif
17877
17878char buffer[256];
17879
17880int check (size_t expect, int test) {
17881  size_t got = strlen(buffer);
17882  if (expect == got)
17883    return 0;
17884
17885  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17886       test, buffer);
17887  exit (test);
17888}
17889
17890int main(int argc, char **argv) {
17891  int test = 0;
17892
17893  check(sprintf(buffer, ""), ++test);
17894  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17895  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17896
17897  return 0;
17898}
17899EOP
17900set try
17901
17902if eval $compile; then
17903    xxx="`$run ./try`"
17904    case "$?" in
17905	0) cat >&4 <<EOM
17906sprintf returns the length of the string (as ANSI says it should)
17907EOM
17908	d_sprintf_returns_strlen="$define"
17909	;;
17910	*) cat >&4 <<EOM
17911sprintf does not return the length of the string (how old is this system?)
17912EOM
17913	d_sprintf_returns_strlen="$undef"
17914        ;;
17915    esac
17916else
17917    echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17918    d_sprintf_returns_strlen="$undef"
17919fi
17920$rm_try
17921
17922: see if srand48_r exists
17923set srand48_r d_srand48_r
17924eval $inlibc
17925case "$d_srand48_r" in
17926"$define")
17927	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17928	case "$d_srand48_r_proto:$usethreads" in
17929	":define")	d_srand48_r_proto=define
17930		set d_srand48_r_proto srand48_r $hdrs
17931		eval $hasproto ;;
17932	*)	;;
17933	esac
17934	case "$d_srand48_r_proto" in
17935	define)
17936	case "$srand48_r_proto" in
17937	''|0) try='int srand48_r(long, struct drand48_data*);'
17938	./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17939	esac
17940	case "$srand48_r_proto" in
17941	''|0)	d_srand48_r=undef
17942 	        srand48_r_proto=0
17943		echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17944	* )	case "$srand48_r_proto" in
17945		REENTRANT_PROTO*) ;;
17946		*) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17947		esac
17948		echo "Prototype: $try" ;;
17949	esac
17950	;;
17951	*)	case "$usethreads" in
17952		define) echo "srand48_r has no prototype, not using it." >&4 ;;
17953		esac
17954		d_srand48_r=undef
17955		srand48_r_proto=0
17956		;;
17957	esac
17958	;;
17959*)	srand48_r_proto=0
17960	;;
17961esac
17962
17963: see if srandom_r exists
17964set srandom_r d_srandom_r
17965eval $inlibc
17966case "$d_srandom_r" in
17967"$define")
17968	hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17969	case "$d_srandom_r_proto:$usethreads" in
17970	":define")	d_srandom_r_proto=define
17971		set d_srandom_r_proto srandom_r $hdrs
17972		eval $hasproto ;;
17973	*)	;;
17974	esac
17975	case "$d_srandom_r_proto" in
17976	define)
17977	case "$srandom_r_proto" in
17978	''|0) try='int srandom_r(unsigned int, struct random_data*);'
17979	./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17980	esac
17981	case "$srandom_r_proto" in
17982	''|0)	d_srandom_r=undef
17983 	        srandom_r_proto=0
17984		echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17985	* )	case "$srandom_r_proto" in
17986		REENTRANT_PROTO*) ;;
17987		*) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17988		esac
17989		echo "Prototype: $try" ;;
17990	esac
17991	;;
17992	*)	case "$usethreads" in
17993		define) echo "srandom_r has no prototype, not using it." >&4 ;;
17994		esac
17995		d_srandom_r=undef
17996		srandom_r_proto=0
17997		;;
17998	esac
17999	;;
18000*)	srandom_r_proto=0
18001	;;
18002esac
18003
18004: see if prototype for setresgid is available
18005echo " "
18006set d_sresgproto setresgid $i_unistd unistd.h
18007eval $hasproto
18008
18009: see if prototype for setresuid is available
18010echo " "
18011set d_sresuproto setresuid $i_unistd unistd.h
18012eval $hasproto
18013
18014: see if sys/stat.h is available
18015set sys/stat.h i_sysstat
18016eval $inhdr
18017
18018: see if stat knows about block sizes
18019echo " "
18020echo "Checking to see if your struct stat has st_blocks field..." >&4
18021set d_statblks stat st_blocks $i_sysstat sys/stat.h
18022eval $hasfield
18023
18024: see if this is a sys/vfs.h system
18025set sys/vfs.h i_sysvfs
18026eval $inhdr
18027
18028: see if this is a sys/statfs.h system
18029set sys/statfs.h i_sysstatfs
18030eval $inhdr
18031
18032: Check for statfs_s
18033echo " "
18034echo "Checking to see if your system supports struct statfs..." >&4
18035set 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
18036eval $hasstruct
18037case "$d_statfs_s" in
18038"$define")      echo "Yes, it does."   ;;
18039*)              echo "No, it doesn't." ;;
18040esac
18041
18042
18043: see if struct statfs knows about f_flags
18044case "$d_statfs_s" in
18045define)
18046	echo " "
18047	echo "Checking to see if your struct statfs has f_flags field..." >&4
18048	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
18049	eval $hasfield
18050	;;
18051*)	val="$undef"
18052	set d_statfs_f_flags
18053	eval $setvar
18054	;;
18055esac
18056case "$d_statfs_f_flags" in
18057"$define")      echo "Yes, it does."   ;;
18058*)              echo "No, it doesn't." ;;
18059esac
18060
18061: see what flavor, if any, of static inline is supported
18062echo " "
18063echo "Checking to see if your system supports static inline..."
18064$cat > try.c <<'EOCP'
18065#include <stdlib.h>
18066extern int f_via_a(int x);
18067extern int f_via_b(int x);
18068int main(int argc, char **argv)
18069{
18070    int y;
18071
18072    y = f_via_a(0);
18073#ifdef USE_B
18074    y = f_via_b(0);
18075#endif
18076    if (y == 42) {
18077        return EXIT_SUCCESS;
18078    }
18079    else {
18080        return EXIT_FAILURE;
18081    }
18082}
18083EOCP
18084$cat > a.c <<'EOCP'
18085static INLINE int f(int x) {
18086    int y;
18087    y = x + 42;
18088    return y;
18089}
18090
18091int f_via_a(int x)
18092{
18093    return f(x);
18094}
18095EOCP
18096$cat > b.c <<'EOCP'
18097extern int f(int x);
18098
18099int f_via_b(int x)
18100{
18101    return f(x);
18102}
18103EOCP
18104
18105# Respect a hint (or previous) value for perl_static_inline, if there is one.
18106case "$perl_static_inline" in
18107'')	# Check the various possibilities, and break out on success.
18108	# For gcc, prefer __inline__, which will still permit
18109	# cflags.SH to add in -ansi.
18110	case "$gccversion" in
18111		'') xxx="inline __inline__ __inline _inline";;
18112		*)  xxx="__inline__ inline __inline _inline";;
18113	esac
18114	for inline in $xxx; do
18115		set try -DINLINE=$inline a.c
18116		if eval $compile && $run ./try; then
18117			# Now make sure there is no external linkage of static
18118			# functions
18119			set try -DINLINE=$inline -DUSE_B a.c b.c
18120			if eval $compile && $run ./try; then
18121				$echo "Your compiler supports static $inline, " >&4
18122				$echo "but it also creates an external definition," >&4
18123				$echo "so I won't use it." >&4
18124				val=$undef
18125			else
18126				$echo "Your compiler supports static $inline." >&4
18127				val=$define
18128				perl_static_inline="static $inline";
18129				break;
18130			fi
18131		else
18132			$echo "Your compiler does NOT support static $inline." >&4
18133			val="$undef"
18134		fi
18135	done
18136	;;
18137*inline*) # Some variant of inline exists.
18138	echo "Keeping your $hint value of $perl_static_inline."
18139	val=$define
18140	;;
18141static)  # No inline capabilities
18142	echo "Keeping your $hint value of $perl_static_inline."
18143	val=$undef
18144	;;
18145*)  # Unrecognized previous value -- blindly trust the supplied
18146	# value and hope it makes sense.  Use old value for
18147	# d_static_inline, if there is one.
18148	echo "Keeping your $hint value of $perl_static_inline."
18149	case "$d_static_inline" in
18150		'') val=$define ;;
18151		*)  val=$d_static_inline ;;
18152	esac
18153	;;
18154esac
18155# Fallback to plain 'static' if nothing worked.
18156case "$perl_static_inline" in
18157'')
18158	perl_static_inline="static"
18159	val=$undef
18160	;;
18161esac
18162set d_static_inline
18163eval $setvar
18164$rm -f a.[co] b.[co]
18165$rm_try
18166
18167: Check stream access
18168$cat >&4 <<EOM
18169Checking how to access stdio streams by file descriptor number...
18170EOM
18171case "$stdio_stream_array" in
18172'') 	$cat >try.c <<EOCP
18173#include <stdio.h>
18174int main() {
18175  if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18176    printf("yes\n");
18177}
18178EOCP
18179	for s in _iob __iob __sF
18180	do
18181	        set try -DSTDIO_STREAM_ARRAY=$s
18182		if eval $compile; then
18183		    	case "`$run ./try`" in
18184			yes)	stdio_stream_array=$s; break ;;
18185			esac
18186		fi
18187	done
18188	$rm_try
18189esac
18190case "$stdio_stream_array" in
18191'')	$cat >&4 <<EOM
18192I can't figure out how to access stdio streams by file descriptor number.
18193EOM
18194	d_stdio_stream_array="$undef"
18195	;;
18196*)	$cat >&4 <<EOM
18197You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18198EOM
18199	d_stdio_stream_array="$define"
18200	;;
18201esac
18202
18203: see if strcoll exists
18204set strcoll d_strcoll
18205eval $inlibc
18206
18207: check for structure copying
18208echo " "
18209echo "Checking to see if your C compiler can copy structs..." >&4
18210$cat >try.c <<'EOCP'
18211int main()
18212{
18213	struct blurfl {
18214		int dyick;
18215	} foo, bar;
18216
18217	foo = bar;
18218}
18219EOCP
18220if $cc -c try.c >/dev/null 2>&1 ; then
18221	val="$define"
18222	echo "Yup, it can."
18223else
18224	val="$undef"
18225	echo "Nope, it can't."
18226fi
18227set d_strctcpy
18228eval $setvar
18229$rm_try
18230
18231: see if strerror and/or sys_errlist[] exist
18232echo " "
18233if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18234    if set strerror val -f d_strerror; eval $csym; $val; then
18235		echo 'strerror() found.' >&4
18236		d_strerror="$define"
18237		d_strerrm='strerror(e)'
18238		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18239			echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18240			d_syserrlst="$define"
18241		else
18242			echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18243			d_syserrlst="$undef"
18244		fi
18245    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18246			$contains '#[ 	]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18247		echo 'strerror() found in string header.' >&4
18248		d_strerror="$define"
18249		d_strerrm='strerror(e)'
18250		if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18251			echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18252				d_syserrlst="$define"
18253		else
18254			echo "(You don't appear to have any sys_errlist[], how can this be?)"
18255			d_syserrlst="$undef"
18256		fi
18257    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18258		echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18259		d_strerror="$undef"
18260		d_syserrlst="$define"
18261		d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18262    else
18263		echo 'strerror() and sys_errlist[] NOT found.' >&4
18264		d_strerror="$undef"
18265		d_syserrlst="$undef"
18266		d_strerrm='"unknown"'
18267    fi
18268fi
18269
18270: see if strerror_r exists
18271set strerror_r d_strerror_r
18272eval $inlibc
18273case "$d_strerror_r" in
18274"$define")
18275	hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18276	case "$d_strerror_r_proto:$usethreads" in
18277	":define")	d_strerror_r_proto=define
18278		set d_strerror_r_proto strerror_r $hdrs
18279		eval $hasproto ;;
18280	*)	;;
18281	esac
18282	case "$d_strerror_r_proto" in
18283	define)
18284	case "$strerror_r_proto" in
18285	''|0) try='int strerror_r(int, char*, size_t);'
18286	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18287	esac
18288	case "$strerror_r_proto" in
18289	''|0) try='int strerror_r(int, char*, int);'
18290	./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18291	esac
18292	case "$strerror_r_proto" in
18293	''|0) try='char* strerror_r(int, char*, size_t);'
18294	./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18295	esac
18296	case "$strerror_r_proto" in
18297	''|0)	d_strerror_r=undef
18298 	        strerror_r_proto=0
18299		echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18300	* )	case "$strerror_r_proto" in
18301		REENTRANT_PROTO*) ;;
18302		*) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18303		esac
18304		echo "Prototype: $try" ;;
18305	esac
18306	;;
18307	*)	case "$usethreads" in
18308		define) echo "strerror_r has no prototype, not using it." >&4 ;;
18309		esac
18310		d_strerror_r=undef
18311		strerror_r_proto=0
18312		;;
18313	esac
18314	;;
18315*)	strerror_r_proto=0
18316	;;
18317esac
18318
18319: see if strftime exists
18320set strftime d_strftime
18321eval $inlibc
18322
18323: see if strlcat exists
18324set strlcat d_strlcat
18325eval $inlibc
18326
18327: see if strlcpy exists
18328set strlcpy d_strlcpy
18329eval $inlibc
18330
18331: see if strtod exists
18332set strtod d_strtod
18333eval $inlibc
18334
18335: see if strtol exists
18336set strtol d_strtol
18337eval $inlibc
18338
18339: see if strtold exists
18340set strtold d_strtold
18341eval $inlibc
18342
18343: see if strtoll exists
18344set strtoll d_strtoll
18345eval $inlibc
18346
18347case "$d_longlong-$d_strtoll" in
18348"$define-$define")
18349	$cat <<EOM
18350Checking whether your strtoll() works okay...
18351EOM
18352	$cat >try.c <<'EOCP'
18353#include <errno.h>
18354#ifdef __hpux
18355#define strtoll __strtoll
18356#endif
18357#ifdef __EMX__
18358#define strtoll _strtoll
18359#endif
18360#include <stdio.h>
18361extern long long int strtoll(char *s, char **, int);
18362static int bad = 0;
18363int check(char *s, long long ell, int een) {
18364	long long gll;
18365	errno = 0;
18366	gll = strtoll(s, 0, 10);
18367	if (!((gll == ell) && (errno == een)))
18368		bad++;
18369}
18370int main() {
18371	check(" 1",                                      1LL, 0);
18372	check(" 0",                                      0LL, 0);
18373	check("-1",                                     -1LL, 0);
18374	check("-9223372036854775808", -9223372036854775808LL, 0);
18375	check("-9223372036854775808", -9223372036854775808LL, 0);
18376	check(" 9223372036854775807",  9223372036854775807LL, 0);
18377	check("-9223372036854775808", -9223372036854775808LL, 0);
18378	check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18379	check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18380	if (!bad)
18381		printf("ok\n");
18382}
18383EOCP
18384	set try
18385	if eval $compile; then
18386		yyy=`$run ./try`
18387		case "$yyy" in
18388		ok) echo "Your strtoll() seems to be working okay." ;;
18389		*) cat <<EOM >&4
18390Your strtoll() doesn't seem to be working okay.
18391EOM
18392		   d_strtoll="$undef"
18393		   ;;
18394		esac
18395	else
18396		echo "(I can't seem to compile the test program--assuming it doesn't)"
18397		d_strtoll="$undef"
18398	fi
18399	;;
18400esac
18401
18402: see if strtoq exists
18403set strtoq d_strtoq
18404eval $inlibc
18405
18406: see if strtoul exists
18407set strtoul d_strtoul
18408eval $inlibc
18409
18410case "$d_strtoul" in
18411"$define")
18412	$cat <<EOM
18413Checking whether your strtoul() works okay...
18414EOM
18415	$cat >try.c <<'EOCP'
18416#include <errno.h>
18417#include <stdio.h>
18418extern unsigned long int strtoul(char *s, char **, int);
18419static int bad = 0;
18420void check(char *s, unsigned long eul, int een) {
18421	unsigned long gul;
18422	errno = 0;
18423	gul = strtoul(s, 0, 10);
18424	if (!((gul == eul) && (errno == een)))
18425		bad++;
18426}
18427int main() {
18428	check(" 1", 1L, 0);
18429	check(" 0", 0L, 0);
18430EOCP
18431	case "$longsize" in
18432	8)
18433	    $cat >>try.c <<'EOCP'
18434	check("18446744073709551615", 18446744073709551615UL, 0);
18435	check("18446744073709551616", 18446744073709551615UL, ERANGE);
18436#if 0 /* strtoul() for /^-/ strings is undefined. */
18437	check("-1", 18446744073709551615UL, 0);
18438	check("-18446744073709551614", 2, 0);
18439	check("-18446744073709551615", 1, 0);
18440       	check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18441	check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18442#endif
18443EOCP
18444		;;
18445	4)
18446		    $cat >>try.c <<'EOCP'
18447	check("4294967295", 4294967295UL, 0);
18448	check("4294967296", 4294967295UL, ERANGE);
18449#if 0 /* strtoul() for /^-/ strings is undefined. */
18450	check("-1", 4294967295UL, 0);
18451	check("-4294967294", 2, 0);
18452	check("-4294967295", 1, 0);
18453       	check("-4294967296", 4294967295UL, ERANGE);
18454	check("-4294967297", 4294967295UL, ERANGE);
18455#endif
18456EOCP
18457		;;
18458	*)
18459: Should we write these tests to be more portable by sprintf-ing
18460: ~0 and then manipulating that char string as input for strtol?
18461		;;
18462	esac
18463	$cat >>try.c <<'EOCP'
18464	if (!bad)
18465		printf("ok\n");
18466	return 0;
18467}
18468EOCP
18469	set try
18470	if eval $compile; then
18471		case "`$run ./try`" in
18472		ok) echo "Your strtoul() seems to be working okay." ;;
18473		*) cat <<EOM >&4
18474Your strtoul() doesn't seem to be working okay.
18475EOM
18476		   d_strtoul="$undef"
18477		   ;;
18478		esac
18479	else
18480		echo "(I can't seem to compile the test program--assuming it doesn't)"
18481		d_strtoul="$undef"
18482	fi
18483	;;
18484esac
18485
18486: see if strtoull exists
18487set strtoull d_strtoull
18488eval $inlibc
18489
18490case "$d_longlong-$d_strtoull" in
18491"$define-$define")
18492	$cat <<EOM
18493Checking whether your strtoull() works okay...
18494EOM
18495	$cat >try.c <<'EOCP'
18496#include <errno.h>
18497#ifdef __hpux
18498#define strtoull __strtoull
18499#endif
18500#include <stdio.h>
18501extern unsigned long long int strtoull(char *s, char **, int);
18502static int bad = 0;
18503int check(char *s, long long eull, int een) {
18504	long long gull;
18505	errno = 0;
18506	gull = strtoull(s, 0, 10);
18507	if (!((gull == eull) && (errno == een)))
18508		bad++;
18509}
18510int main() {
18511	check(" 1",                                        1LL, 0);
18512	check(" 0",                                        0LL, 0);
18513	check("18446744073709551615",  18446744073709551615ULL, 0);
18514	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18515#if 0 /* strtoull() for /^-/ strings is undefined. */
18516	check("-1",                    18446744073709551615ULL, 0);
18517	check("-18446744073709551614",                     2LL, 0);
18518	check("-18446744073709551615",                     1LL, 0);
18519       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18520	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18521#endif
18522	if (!bad)
18523		printf("ok\n");
18524}
18525EOCP
18526	set try
18527	if eval $compile; then
18528		case "`$run ./try`" in
18529		ok) echo "Your strtoull() seems to be working okay." ;;
18530		*) cat <<EOM >&4
18531Your strtoull() doesn't seem to be working okay.
18532EOM
18533		   d_strtoull="$undef"
18534		   ;;
18535		esac
18536	else
18537		echo "(I can't seem to compile the test program--assuming it doesn't)"
18538		d_strtoull="$undef"
18539	fi
18540	;;
18541esac
18542
18543: see if strtouq exists
18544set strtouq d_strtouq
18545eval $inlibc
18546
18547case "$d_strtouq" in
18548"$define")
18549	$cat <<EOM
18550Checking whether your strtouq() works okay...
18551EOM
18552	$cat >try.c <<'EOCP'
18553#include <errno.h>
18554#include <stdio.h>
18555extern unsigned long long int strtouq(char *s, char **, int);
18556static int bad = 0;
18557void check(char *s, unsigned long long eull, int een) {
18558	unsigned long long gull;
18559	errno = 0;
18560	gull = strtouq(s, 0, 10);
18561	if (!((gull == eull) && (errno == een)))
18562		bad++;
18563}
18564int main() {
18565	check(" 1",                                        1LL, 0);
18566	check(" 0",                                        0LL, 0);
18567	check("18446744073709551615",  18446744073709551615ULL, 0);
18568	check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18569#if 0 /* strtouq() for /^-/ strings is undefined. */
18570	check("-1",                    18446744073709551615ULL, 0);
18571	check("-18446744073709551614",                     2LL, 0);
18572	check("-18446744073709551615",                     1LL, 0);
18573       	check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18574	check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18575#endif
18576	if (!bad)
18577		printf("ok\n");
18578	return 0;
18579}
18580EOCP
18581	set try
18582	if eval $compile; then
18583		case "`$run ./try`" in
18584		ok) echo "Your strtouq() seems to be working okay." ;;
18585		*) cat <<EOM >&4
18586Your strtouq() doesn't seem to be working okay.
18587EOM
18588		   d_strtouq="$undef"
18589		   ;;
18590		esac
18591	else
18592		echo "(I can't seem to compile the test program--assuming it doesn't)"
18593		d_strtouq="$undef"
18594	fi
18595	;;
18596esac
18597
18598: see if strxfrm exists
18599set strxfrm d_strxfrm
18600eval $inlibc
18601
18602: see if symlink exists
18603set symlink d_symlink
18604eval $inlibc
18605
18606: see if syscall exists
18607set syscall d_syscall
18608eval $inlibc
18609
18610: see if prototype for syscall is available
18611echo " "
18612set d_syscallproto syscall $i_unistd unistd.h
18613eval $hasproto
18614
18615: see if sysconf exists
18616set sysconf d_sysconf
18617eval $inlibc
18618
18619: see if system exists
18620set system d_system
18621eval $inlibc
18622
18623: see if tcgetpgrp exists
18624set tcgetpgrp d_tcgetpgrp
18625eval $inlibc
18626
18627: see if tcsetpgrp exists
18628set tcsetpgrp d_tcsetpgrp
18629eval $inlibc
18630
18631: see if prototype for telldir is available
18632echo " "
18633set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18634eval $hasproto
18635
18636: see if time exists
18637echo " "
18638if test "X$d_time" = X -o X"$timetype" = X; then
18639    if set time val -f d_time; eval $csym; $val; then
18640		echo 'time() found.' >&4
18641		val="$define"
18642		rp="What is the type returned by time() on this system?"
18643		set time_t timetype long stdio.h sys/types.h
18644		eval $typedef_ask
18645    else
18646		echo 'time() not found, hope that will do.' >&4
18647		val="$undef"
18648		timetype='int';
18649    fi
18650    set d_time
18651    eval $setvar
18652fi
18653
18654: see if timegm exists
18655set timegm d_timegm
18656eval $inlibc
18657
18658: see if this is a sys/times.h system
18659set sys/times.h i_systimes
18660eval $inhdr
18661
18662: see if times exists
18663echo " "
18664if set times val -f d_times; eval $csym; $val; then
18665	echo 'times() found.' >&4
18666	d_times="$define"
18667	inc=''
18668	case "$i_systimes" in
18669	"$define") inc='sys/times.h';;
18670	esac
18671	rp="What is the type returned by times() on this system?"
18672	set clock_t clocktype long stdio.h sys/types.h $inc
18673	eval $typedef_ask
18674else
18675	echo 'times() NOT found, hope that will do.' >&4
18676	d_times="$undef"
18677	clocktype='int'
18678fi
18679
18680: see if tmpnam_r exists
18681set tmpnam_r d_tmpnam_r
18682eval $inlibc
18683case "$d_tmpnam_r" in
18684"$define")
18685	hdrs="$i_systypes sys/types.h define stdio.h "
18686	case "$d_tmpnam_r_proto:$usethreads" in
18687	":define")	d_tmpnam_r_proto=define
18688		set d_tmpnam_r_proto tmpnam_r $hdrs
18689		eval $hasproto ;;
18690	*)	;;
18691	esac
18692	case "$d_tmpnam_r_proto" in
18693	define)
18694	case "$tmpnam_r_proto" in
18695	''|0) try='char* tmpnam_r(char*);'
18696	./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18697	esac
18698	case "$tmpnam_r_proto" in
18699	''|0)	d_tmpnam_r=undef
18700 	        tmpnam_r_proto=0
18701		echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18702	* )	case "$tmpnam_r_proto" in
18703		REENTRANT_PROTO*) ;;
18704		*) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18705		esac
18706		echo "Prototype: $try" ;;
18707	esac
18708	;;
18709	*)	case "$usethreads" in
18710		define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18711		esac
18712		d_tmpnam_r=undef
18713		tmpnam_r_proto=0
18714		;;
18715	esac
18716	;;
18717*)	tmpnam_r_proto=0
18718	;;
18719esac
18720
18721: see if truncate exists
18722set truncate d_truncate
18723eval $inlibc
18724
18725: see if ttyname_r exists
18726set ttyname_r d_ttyname_r
18727eval $inlibc
18728case "$d_ttyname_r" in
18729"$define")
18730	hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18731	case "$d_ttyname_r_proto:$usethreads" in
18732	":define")	d_ttyname_r_proto=define
18733		set d_ttyname_r_proto ttyname_r $hdrs
18734		eval $hasproto ;;
18735	*)	;;
18736	esac
18737	case "$d_ttyname_r_proto" in
18738	define)
18739	case "$ttyname_r_proto" in
18740	''|0) try='int ttyname_r(int, char*, size_t);'
18741	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18742	esac
18743	case "$ttyname_r_proto" in
18744	''|0) try='int ttyname_r(int, char*, int);'
18745	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18746	esac
18747	case "$ttyname_r_proto" in
18748	''|0) try='char* ttyname_r(int, char*, int);'
18749	./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18750	esac
18751	case "$ttyname_r_proto" in
18752	''|0)	d_ttyname_r=undef
18753 	        ttyname_r_proto=0
18754		echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18755	* )	case "$ttyname_r_proto" in
18756		REENTRANT_PROTO*) ;;
18757		*) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18758		esac
18759		echo "Prototype: $try" ;;
18760	esac
18761	;;
18762	*)	case "$usethreads" in
18763		define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18764		esac
18765		d_ttyname_r=undef
18766		ttyname_r_proto=0
18767		;;
18768	esac
18769	;;
18770*)	ttyname_r_proto=0
18771	;;
18772esac
18773
18774: see if tzname[] exists
18775echo " "
18776if set tzname val -a d_tzname; eval $csym; $val; then
18777	val="$define"
18778	echo 'tzname[] found.' >&4
18779else
18780	val="$undef"
18781	echo 'tzname[] NOT found.' >&4
18782fi
18783set d_tzname
18784eval $setvar
18785
18786: Check if is a multiplatform env
18787case "$osname" in
18788next|darwin) multiarch="$define" ;;
18789esac
18790case "$multiarch" in
18791''|[nN]*) multiarch="$undef" ;;
18792esac
18793
18794: check for ordering of bytes in a UV
18795echo " "
18796case "$usecrosscompile$multiarch" in
18797*$define*)
18798	$cat <<EOM
18799You seem to be either cross-compiling or doing a multiarchitecture build,
18800skipping the byteorder check.
18801
18802EOM
18803	byteorder='ffff'
18804	;;
18805*)
18806	case "$byteorder" in
18807	'')
18808		$cat <<'EOM'
18809In the following, larger digits indicate more significance.  A big-endian
18810machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18811little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18812machines may have weird orders like 3412.  A Cray will report 87654321,
18813an Alpha will report 12345678. If the test program works the default is
18814probably right.
18815I'm now running the test program...
18816EOM
18817		$cat >try.c <<EOCP
18818#include <stdio.h>
18819#$i_stdlib I_STDLIB
18820#ifdef I_STDLIB
18821#include <stdlib.h>
18822#endif
18823#include <sys/types.h>
18824typedef $uvtype UV;
18825int main()
18826{
18827	int i;
18828	union {
18829		UV l;
18830		char c[$uvsize];
18831	} u;
18832
18833	if ($uvsize > 4)
18834		u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18835	else
18836		u.l = (UV)0x04030201;
18837	for (i = 0; i < $uvsize; i++)
18838		printf("%c", u.c[i]+'0');
18839	printf("\n");
18840	exit(0);
18841}
18842EOCP
18843		xxx_prompt=y
18844		set try
18845		if eval $compile && $run ./try > /dev/null; then
18846			dflt=`$run ./try`
18847			case "$dflt" in
18848			[1-4][1-4][1-4][1-4]|12345678|87654321)
18849				echo "(The test program ran ok.)"
18850				echo "byteorder=$dflt"
18851				xxx_prompt=n
18852			;;
18853			????|????????) echo "(The test program ran ok.)" ;;
18854			*) echo "(The test program didn't run right for some reason.)" ;;
18855			esac
18856		else
18857			dflt='4321'
18858			cat <<'EOM'
18859(I can't seem to compile the test program.  Guessing big-endian...)
18860EOM
18861		fi
18862		case "$xxx_prompt" in
18863		y)
18864			rp="What is the order of bytes in $uvtype?"
18865			. ./myread
18866			byteorder="$ans"
18867			;;
18868		*)	byteorder=$dflt
18869			;;
18870		esac
18871		;;
18872	esac
18873	$rm_try
18874	;;
18875esac
18876
18877: Checking 32bit alignedness
18878$cat <<EOM
18879
18880Checking to see whether you can access character data unalignedly...
18881EOM
18882case "$d_u32align" in
18883'')   $cat >try.c <<EOCP
18884#include <stdio.h>
18885#$i_stdlib I_STDLIB
18886#ifdef I_STDLIB
18887#include <stdlib.h>
18888#endif
18889#define U32 $u32type
18890#define BYTEORDER 0x$byteorder
18891#define U8 $u8type
18892#include <signal.h>
18893#ifdef SIGBUS
18894$signal_t bletch(int s) { exit(4); }
18895#endif
18896int main() {
18897#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18898    volatile U8 buf[8];
18899    volatile U32 *up;
18900    int i;
18901
18902    if (sizeof(U32) != 4) {
18903	printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18904	exit(1);
18905    }
18906
18907    fflush(stdout);
18908
18909#ifdef SIGBUS
18910    signal(SIGBUS, bletch);
18911#endif
18912
18913    buf[0] = 0;
18914    buf[1] = 0;
18915    buf[2] = 0;
18916    buf[3] = 1;
18917    buf[4] = 0;
18918    buf[5] = 0;
18919    buf[6] = 0;
18920    buf[7] = 1;
18921
18922    for (i = 0; i < 4; i++) {
18923	up = (U32*)(buf + i);
18924	if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18925	       (*up == 1 << (8*(3-i)))  /* little-endian */
18926	      )
18927	   )
18928	{
18929	    printf("read failed (%x)\n", *up);
18930	    exit(2);
18931	}
18932    }
18933
18934    /* write test */
18935    for (i = 0; i < 4; i++) {
18936	up = (U32*)(buf + i);
18937	*up = 0xBeef;
18938	if (*up != 0xBeef) {
18939	    printf("write failed (%x)\n", *up);
18940	    exit(3);
18941	}
18942    }
18943
18944    exit(0);
18945#else
18946    printf("1\n");
18947    exit(1);
18948#endif
18949    return 0;
18950}
18951EOCP
18952set try
18953if eval $compile_ok; then
18954	echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18955	$run ./try 2>&1 >/dev/null
18956	case "$?" in
18957	0)	cat >&4 <<EOM
18958You can access character data pretty unalignedly.
18959EOM
18960		d_u32align="$undef"
18961		;;
18962	*)	cat >&4 <<EOM
18963It seems that you must access character data in an aligned manner.
18964EOM
18965		d_u32align="$define"
18966		;;
18967	esac
18968else
18969	rp='Can you access character data at unaligned addresses?'
18970	dflt='n'
18971	. ./myread
18972	case "$ans" in
18973	[yY]*)	d_u32align="$undef"  ;;
18974	*)	d_u32align="$define" ;;
18975	esac
18976fi
18977$rm_try
18978;;
18979esac
18980
18981: see if ualarm exists
18982set ualarm d_ualarm
18983eval $inlibc
18984
18985: see if umask exists
18986set umask d_umask
18987eval $inlibc
18988
18989: see if unordered exists
18990set unordered d_unordered
18991eval $inlibc
18992
18993: see if unsetenv exists
18994set unsetenv d_unsetenv
18995eval $inlibc
18996
18997: see if usleep exists
18998set usleep d_usleep
18999eval $inlibc
19000
19001: see if prototype for usleep is available
19002echo " "
19003set d_usleepproto usleep $i_unistd unistd.h
19004eval $hasproto
19005
19006: see if ustat exists
19007set ustat d_ustat
19008eval $inlibc
19009
19010: see if closedir exists
19011set closedir d_closedir
19012eval $inlibc
19013
19014case "$d_closedir" in
19015"$define")
19016	echo " "
19017	echo "Checking whether closedir() returns a status..." >&4
19018	cat > try.c <<EOM
19019#$i_dirent I_DIRENT		/**/
19020#$i_sysdir I_SYS_DIR		/**/
19021#$i_sysndir I_SYS_NDIR		/**/
19022#$i_systypes I_SYS_TYPES	/**/
19023
19024#if defined(I_SYS_TYPES)
19025#include <sys/types.h>
19026#endif
19027#if defined(I_DIRENT)
19028#include <dirent.h>
19029#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19030#include <sys/dir.h>
19031#endif
19032#else
19033#ifdef I_SYS_NDIR
19034#include <sys/ndir.h>
19035#else
19036#ifdef I_SYS_DIR
19037#ifdef hp9000s500
19038#include <ndir.h>	/* may be wrong in the future */
19039#else
19040#include <sys/dir.h>
19041#endif
19042#endif
19043#endif
19044#endif
19045int main() { return closedir(opendir(".")); }
19046EOM
19047	set try
19048	if eval $compile_ok; then
19049		if $run ./try > /dev/null 2>&1 ; then
19050			echo "Yes, it does."
19051			val="$undef"
19052		else
19053			echo "No, it doesn't."
19054			val="$define"
19055		fi
19056	else
19057		echo "(I can't seem to compile the test program--assuming it doesn't)"
19058		val="$define"
19059	fi
19060	;;
19061*)
19062	val="$undef";
19063	;;
19064esac
19065set d_void_closedir
19066eval $setvar
19067$rm_try
19068
19069: see if there is a wait4
19070set wait4 d_wait4
19071eval $inlibc
19072
19073: see if waitpid exists
19074set waitpid d_waitpid
19075eval $inlibc
19076
19077: see if wcstombs exists
19078set wcstombs d_wcstombs
19079eval $inlibc
19080
19081: see if wctomb exists
19082set wctomb d_wctomb
19083eval $inlibc
19084
19085: see if writev exists
19086set writev d_writev
19087eval $inlibc
19088
19089: preserve RCS keywords in files with variable substitution, grrr
19090Date='$Date'
19091Id='$Id'
19092Log='$Log'
19093RCSfile='$RCSfile'
19094Revision='$Revision'
19095
19096: check for alignment requirements
19097echo " "
19098case "$usecrosscompile" in
19099*$define*)
19100	$cat <<EOM
19101You seem to be cross-compiling.  Skipping the memory alignment check.
19102
19103EOM
19104	case "$alignbytes" in
19105	'') alignbytes=8 ;;
19106	esac
19107	;;
19108*)
19109	case "$alignbytes" in
19110	'') echo "Checking alignment constraints..." >&4
19111		if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19112			$cat >try.c <<'EOCP'
19113typedef long double NV;
19114EOCP
19115		else
19116			$cat >try.c <<'EOCP'
19117typedef double NV;
19118EOCP
19119		fi
19120		$cat >>try.c <<'EOCP'
19121#include <stdio.h>
19122struct foobar {
19123	char foo;
19124	NV bar;
19125} try_algn;
19126int main()
19127{
19128    printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19129    return(0);
19130}
19131EOCP
19132		set try
19133		if eval $compile_ok; then
19134			dflt=`$run ./try`
19135		else
19136			dflt='8'
19137			echo "(I can't seem to compile the test program...)"
19138		fi
19139		case "$multiarch" in
19140		*$define*)
19141			: The usual safe value is 8, but Darwin with -Duselongdouble
19142			: needs 16.  Hence, we will take 8 as a minimum, but allow
19143			: Configure to pick a larger value if needed.
19144			if $test "$dflt" -lt 8; then
19145			    dflt='8'
19146				echo "Setting alignment to 8 for multiarch support.">&4
19147			fi
19148			;;
19149		esac
19150		;;
19151	*) dflt="$alignbytes"
19152		;;
19153	esac
19154	rp="Doubles must be aligned on a how-many-byte boundary?"
19155	. ./myread
19156	alignbytes="$ans"
19157	$rm_try
19158	;;
19159esac
19160
19161
19162: set the base revision
19163baserev=5.0
19164
19165: Determine if this is an EBCDIC system
19166echo " "
19167echo "Determining whether or not we are on an EBCDIC system..." >&4
19168$cat >try.c <<'EOM'
19169int main()
19170{
19171  if ('M'==0xd4) return 0;
19172  return 1;
19173}
19174EOM
19175
19176case "$BOOTSTRAP_CHARSET" in
19177    Y|y|define) bootstrap_charset=$define	;;
19178    *)		bootstrap_charset=$undef	;;
19179esac
19180
19181val=$undef
19182set try
19183if eval $compile_ok; then
19184	if $run ./try; then
19185		echo "You seem to speak EBCDIC." >&4
19186		val="$define"
19187	else
19188		echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19189	fi
19190else
19191	echo "I'm unable to compile the test program." >&4
19192	echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19193fi
19194$rm_try
19195set ebcdic
19196eval $setvar
19197
19198: length of character in bytes. Is always 1, otherwise it is not C
19199: This used to be a test using sizeof
19200charsize=1
19201
19202: Check for the number of bits in a character
19203case "$charbits" in
19204'')	echo "Checking how long a character is (in bits)..." >&4
19205	$cat >try.c <<EOCP
19206#include <stdio.h>
19207int main ()
19208{
19209    int n;
19210    unsigned char c;
19211    for (c = 1, n = 0; c; c <<= 1, n++) ;
19212    printf ("%d\n", n);
19213    return (0);
19214    }
19215EOCP
19216	set try
19217	if eval $compile_ok; then
19218		dflt=`$run ./try`
19219	else
19220		dflt='8'
19221		echo "(I can't seem to compile the test program.  Guessing...)"
19222	fi
19223	;;
19224*)
19225	dflt="$charbits"
19226	;;
19227esac
19228rp="What is the length of a character (in bits)?"
19229. ./myread
19230charbits="$ans"
19231$rm_try
19232case "$charbits" in
192338)	;;
19234*)	cat >&4 << EOM
19235Your system has an unsigned character size of $charbits bits, which
19236is rather unusual (normally it is 8 bits).  Perl likely will not work
19237correctly on your system, with subtle bugs in various places.
19238EOM
19239	rp='Do you really want to continue?'
19240	dflt='n'
19241	. ./myread
19242	case "$ans" in
19243		[yY])	echo >&4 "Okay, continuing."	;;
19244		*)	exit 1				;;
19245	esac
19246esac
19247
19248: how do we concatenate cpp tokens here?
19249echo " "
19250echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19251$cat >cpp_stuff.c <<'EOCP'
19252#define RCAT(a,b)a/**/b
19253#define ACAT(a,b)a ## b
19254RCAT(Rei,ser)
19255ACAT(Cir,cus)
19256EOCP
19257$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19258if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19259	echo "Oh!  Smells like ANSI's been here." >&4
19260	echo "We can catify or stringify, separately or together!"
19261	cpp_stuff=42
19262elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19263	echo "Ah, yes!  The good old days!" >&4
19264	echo "However, in the good old days we don't know how to stringify and"
19265	echo "catify at the same time."
19266	cpp_stuff=1
19267else
19268	$cat >&4 <<EOM
19269Hmm, I don't seem to be able to concatenate tokens with your cpp.
19270You're going to have to edit the values of CAT[2-5] in config.h...
19271EOM
19272	cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19273fi
19274$rm -f cpp_stuff.*
19275
19276: see if this is a db.h system
19277set db.h i_db
19278eval $inhdr
19279
19280case "$i_db" in
19281$define)
19282	: Check db version.
19283	echo " "
19284	echo "Checking Berkeley DB version ..." >&4
19285	$cat >try.c <<EOCP
19286#$d_const HASCONST
19287#ifndef HASCONST
19288#define const
19289#endif
19290#include <sys/types.h>
19291#include <stdio.h>
19292#$i_stdlib I_STDLIB
19293#ifdef I_STDLIB
19294#include <stdlib.h>
19295#endif
19296#include <db.h>
19297int main(int argc, char *argv[])
19298{
19299#ifdef DB_VERSION_MAJOR	/* DB version >= 2 */
19300    int Major, Minor, Patch ;
19301    unsigned long Version ;
19302    (void)db_version(&Major, &Minor, &Patch) ;
19303    if (argc == 2) {
19304        printf("%d %d %d %d %d %d\n",
19305               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19306               Major, Minor, Patch);
19307        exit(0);
19308    }
19309    printf("You have Berkeley DB Version 2 or greater.\n");
19310
19311    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19312		DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19313    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19314		Major, Minor, Patch) ;
19315
19316    /* check that db.h & libdb are compatible */
19317    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19318	printf("db.h and libdb are incompatible.\n") ;
19319        exit(3);
19320    }
19321
19322    printf("db.h and libdb are compatible.\n") ;
19323
19324    Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19325		+ DB_VERSION_PATCH ;
19326
19327    /* needs to be >= 2.3.4 */
19328    if (Version < 2003004) {
19329    /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19330	printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19331        exit(2);
19332    }
19333
19334    exit(0);
19335#else
19336#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19337    if (argc == 2) {
19338        printf("1 0 0\n");
19339        exit(0);
19340    }
19341    printf("You have Berkeley DB Version 1.\n");
19342    exit(0);	/* DB version < 2: the coast is clear. */
19343#else
19344    exit(1);	/* <db.h> not Berkeley DB? */
19345#endif
19346#endif
19347}
19348EOCP
19349	set try
19350	if eval $compile_ok && $run ./try; then
19351		echo 'Looks OK.' >&4
19352		set `$run ./try 1`
19353		db_version_major=$1
19354		db_version_minor=$2
19355		db_version_patch=$3
19356	else
19357		echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19358		i_db=$undef
19359		case " $libs " in
19360		*"-ldb "*)
19361			: Remove db from list of libraries to use
19362			echo "Removing unusable -ldb from library list" >&4
19363			set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19364			shift
19365			libs="$*"
19366			echo "libs = $libs" >&4
19367			;;
19368		esac
19369	fi
19370	$rm_try
19371	;;
19372esac
19373
19374case "$i_db" in
19375define)
19376	: Check the return type needed for hash
19377	echo " "
19378	echo "Checking return type needed for hash for Berkeley DB ..." >&4
19379	$cat >try.c <<EOCP
19380#$d_const HASCONST
19381#ifndef HASCONST
19382#define const
19383#endif
19384#include <sys/types.h>
19385#include <db.h>
19386
19387#ifndef DB_VERSION_MAJOR
19388u_int32_t hash_cb (ptr, size)
19389const void *ptr;
19390size_t size;
19391{
19392}
19393HASHINFO info;
19394int main()
19395{
19396	info.hash = hash_cb;
19397}
19398#endif
19399EOCP
19400	if $cc $ccflags -c try.c >try.out 2>&1 ; then
19401		if $contains warning try.out >>/dev/null 2>&1 ; then
19402			db_hashtype='int'
19403		else
19404			db_hashtype='u_int32_t'
19405		fi
19406	else
19407		: XXX Maybe we should just give up here.
19408		db_hashtype=u_int32_t
19409		$cat try.out >&4
19410		echo "Help:  I can't seem to compile the db test program." >&4
19411		echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19412	fi
19413	$rm_try
19414	echo "Your version of Berkeley DB uses $db_hashtype for hash."
19415	;;
19416*)	db_hashtype=u_int32_t
19417	;;
19418esac
19419case "$i_db" in
19420define)
19421	: Check the return type needed for prefix
19422	echo " "
19423	echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19424	cat >try.c <<EOCP
19425#$d_const HASCONST
19426#ifndef HASCONST
19427#define const
19428#endif
19429#include <sys/types.h>
19430#include <db.h>
19431
19432#ifndef DB_VERSION_MAJOR
19433size_t prefix_cb (key1, key2)
19434const DBT *key1;
19435const DBT *key2;
19436{
19437}
19438BTREEINFO info;
19439int main()
19440{
19441	info.prefix = prefix_cb;
19442}
19443#endif
19444EOCP
19445	if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19446		if $contains warning try.out >>/dev/null 2>&1 ; then
19447			db_prefixtype='int'
19448		else
19449			db_prefixtype='size_t'
19450		fi
19451	else
19452		db_prefixtype='size_t'
19453		: XXX Maybe we should just give up here.
19454		$cat try.out >&4
19455		echo "Help:  I can't seem to compile the db test program." >&4
19456		echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19457	fi
19458	$rm_try
19459	echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19460	;;
19461*)	db_prefixtype='size_t'
19462	;;
19463esac
19464
19465: How can we generate normalized random numbers ?
19466echo " "
19467echo "Looking for a random number function..." >&4
19468case "$randfunc" in
19469'')
19470	if set drand48 val -f; eval $csym; $val; then
19471		dflt="drand48"
19472		echo "Good, found drand48()." >&4
19473	elif set random val -f; eval $csym; $val; then
19474		dflt="random"
19475		echo "OK, found random()." >&4
19476	else
19477		dflt="rand"
19478		echo "Yuck, looks like I have to use rand()." >&4
19479	fi
19480	echo " "
19481	;;
19482*)
19483	dflt="$randfunc"
19484	;;
19485esac
19486cont=true
19487
19488case "$ccflags" in
19489*-Dmy_rand=*|*-Dmy_srand=*)
19490	echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19491	ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19492	ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19493	ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19494	;;
19495esac
19496
19497while $test "$cont"; do
19498	rp="Use which function to generate random numbers?"
19499	. ./myread
19500	if $test "$ans" = "$dflt"; then
19501		: null
19502	else
19503		randbits=''
19504	fi
19505	randfunc="$ans"
19506	if set $ans val -f; eval $csym; $val; then
19507		cont=''
19508	else
19509		dflt=y
19510		rp="I cannot find function $ans. Use that name anyway?"
19511		. ./myread
19512		dflt=rand
19513		case "$ans" in
19514			[yY]*) cont='';;
19515		esac
19516	fi
19517	case "$cont" in
19518	'')
19519		case "$randfunc" in
19520		drand48)
19521			drand01="drand48()"
19522			seedfunc="srand48"
19523			randbits=48
19524			randseedtype=long
19525			;;
19526		rand|random)
19527			case "$randbits" in
19528			'')
19529echo "Checking to see how many bits your $randfunc() function produces..." >&4
19530				$cat >try.c <<EOCP
19531#$i_unistd I_UNISTD
19532#$i_stdlib I_STDLIB
19533#include <stdio.h>
19534#ifdef I_UNISTD
19535#  include <unistd.h>
19536#endif
19537#ifdef I_STDLIB
19538#  include <stdlib.h>
19539#endif
19540int main()
19541{
19542	int i;
19543	unsigned long tmp;
19544	unsigned long max = 0L;
19545
19546	for (i = 1000; i; i--) {
19547		tmp = (unsigned long) $randfunc();
19548		if (tmp > max) max = tmp;
19549	}
19550	for (i = 0; max; i++)
19551		max /= 2;
19552	printf("%d\n",i);
19553}
19554EOCP
19555				set try
19556				if eval $compile_ok; then
19557					dflt=`try`
19558				else
19559					dflt='?'
19560					echo "(I can't seem to compile the test program...)"
19561				fi
19562				;;
19563			*)
19564				dflt="$randbits"
19565				;;
19566			esac
19567			rp="How many bits does your $randfunc() function produce?"
19568			. ./myread
19569			randbits="$ans"
19570			$rm_try
19571			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19572			seedfunc="s$randfunc"
19573			randseedtype=unsigned
19574			;;
19575		*)
19576			dflt="31"
19577			rp="How many bits does your $randfunc() function produce?"
19578			. ./myread
19579			randbits="$ans"
19580			seedfunc="s$randfunc"
19581			drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19582			if set $seedfunc val -f; eval $csym; $val; then
19583				echo "(Using $seedfunc() to seed random generator)"
19584			else
19585				echo "(Warning: no $seedfunc() to seed random generator)"
19586				seedfunc=rand
19587			fi
19588			randseedtype=unsigned
19589			;;
19590		esac
19591		;;
19592	esac
19593done
19594
19595: Check how to flush
19596echo " "
19597$cat >&4 <<EOM
19598Checking how to flush all pending stdio output...
19599EOM
19600# I only know how to find the first 32 possibly open files on SunOS.
19601# See also hints/sunos_4_1.sh and util.c  --AD
19602case "$osname" in
19603sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19604esac
19605$cat >>try.c <<EOCP
19606#include <stdio.h>
19607#$i_stdlib I_STDLIB
19608#ifdef I_STDLIB
19609#include <stdlib.h>
19610#endif
19611#$i_unistd I_UNISTD
19612#ifdef I_UNISTD
19613# include <unistd.h>
19614#endif
19615#$d_sysconf HAS_SYSCONF
19616#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19617#ifdef HAS_STDIO_STREAM_ARRAY
19618# define STDIO_STREAM_ARRAY $stdio_stream_array
19619#endif
19620int main() {
19621  FILE* p;
19622  unlink("try.out");
19623  p = fopen("try.out", "w");
19624#ifdef TRY_FPUTC
19625  fputc('x', p);
19626#else
19627# ifdef TRY_FPRINTF
19628  fprintf(p, "x");
19629# endif
19630#endif
19631#ifdef TRY_FFLUSH_NULL
19632  fflush(NULL);
19633#endif
19634#ifdef TRY_FFLUSH_ALL
19635  {
19636    long open_max = -1;
19637# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19638    open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19639# else
19640#  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19641    open_max = sysconf(_SC_OPEN_MAX);
19642#  else
19643#   ifdef FOPEN_MAX
19644    open_max = FOPEN_MAX;
19645#   else
19646#    ifdef OPEN_MAX
19647    open_max = OPEN_MAX;
19648#    else
19649#     ifdef _NFILE
19650    open_max = _NFILE;
19651#     endif
19652#    endif
19653#   endif
19654#  endif
19655# endif
19656# ifdef HAS_STDIO_STREAM_ARRAY
19657    if (open_max > 0) {
19658      long i;
19659      for (i = 0; i < open_max; i++)
19660	    if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19661		STDIO_STREAM_ARRAY[i]._file < open_max &&
19662		STDIO_STREAM_ARRAY[i]._flag)
19663		fflush(&STDIO_STREAM_ARRAY[i]);
19664    }
19665  }
19666# endif
19667#endif
19668  _exit(42);
19669}
19670EOCP
19671: first we have to find out how _not_ to flush
19672$to try.c
19673if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19674    output=''
19675    set try -DTRY_FPUTC
19676    if eval $compile; then
19677 	    $run ./try 2>/dev/null
19678	    code="$?"
19679	    $from try.out
19680	    if $test ! -s try.out -a "X$code" = X42; then
19681		output=-DTRY_FPUTC
19682	    fi
19683    fi
19684    case "$output" in
19685    '')
19686	    set try -DTRY_FPRINTF
19687	    if eval $compile; then
19688 		    $run ./try 2>/dev/null
19689		    code="$?"
19690		    $from try.out
19691		    if $test ! -s try.out -a "X$code" = X42; then
19692			output=-DTRY_FPRINTF
19693		    fi
19694	    fi
19695	;;
19696    esac
19697fi
19698: check for fflush NULL behavior
19699case "$fflushNULL" in
19700'') 	set try -DTRY_FFLUSH_NULL $output
19701	if eval $compile; then
19702	    	$run ./try 2>/dev/null
19703		code="$?"
19704		$from try.out
19705		if $test -s try.out -a "X$code" = X42; then
19706			fflushNULL="`$cat try.out`"
19707		else
19708			if $test "X$code" != X42; then
19709				$cat >&4 <<EOM
19710(If this test failed, don't worry, we'll try another method shortly.)
19711EOM
19712			fi
19713		fi
19714	fi
19715	$rm -f core try.core core.try.*
19716	case "$fflushNULL" in
19717	x)	$cat >&4 <<EOM
19718Your fflush(NULL) works okay for output streams.
19719Let's see if it clobbers input pipes...
19720EOM
19721# As of mid-March 2000 all versions of Solaris appear to have a stdio
19722# bug that improperly flushes the input end of pipes.  So we avoid the
19723# autoflush on fork/system/exec support for now. :-(
19724$cat >tryp.c <<EOCP
19725#include <stdio.h>
19726int
19727main(int argc, char **argv)
19728{
19729    char buf[1024];
19730    int i;
19731    char *bp = buf;
19732    while (1) {
19733        while ((i = getc(stdin)) != -1
19734               && (*bp++ = i) != '\n'
19735               && bp < &buf[1024])
19736    	/* DO NOTHING */ ;
19737        *bp = '\0';
19738        fprintf(stdout, "%s", buf);
19739        fflush(NULL);
19740        if (i == -1)
19741	    return 0;
19742        bp = buf;
19743    }
19744}
19745EOCP
19746                fflushNULL="$define"
19747                set tryp
19748                if eval $compile; then
19749                    $rm -f tryp.out
19750                    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19751                    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19752                       $cat >&4 <<EOM
19753fflush(NULL) seems to behave okay with input streams.
19754EOM
19755			fflushNULL="$define"
19756                    else
19757			$cat >&4 <<EOM
19758Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19759EOM
19760                        fflushNULL="$undef"
19761                    fi
19762                fi
19763	        $rm -f core tryp.c tryp.core core.tryp.*
19764		;;
19765	'')	$cat >&4 <<EOM
19766Your fflush(NULL) isn't working (contrary to ANSI C).
19767EOM
19768		fflushNULL="$undef"
19769		;;
19770	*)	$cat >&4 <<EOM
19771Cannot figure out whether your fflush(NULL) works or not.
19772I'm assuming it doesn't (contrary to ANSI C).
19773EOM
19774		fflushNULL="$undef"
19775		;;
19776	esac
19777	;;
19778$define|true|[yY]*)
19779	fflushNULL="$define"
19780	;;
19781*)
19782	fflushNULL="$undef"
19783	;;
19784esac
19785: check explicit looping only if NULL did not work, and if the pipe
19786: bug does not show up on an explicit flush too
19787case "$fflushNULL" in
19788"$undef")
19789	$cat >tryp.c <<EOCP
19790#include <stdio.h>
19791int
19792main(int argc, char **argv)
19793{
19794    char buf[1024];
19795    int i;
19796    char *bp = buf;
19797    while (1) {
19798	while ((i = getc(stdin)) != -1
19799	       && (*bp++ = i) != '\n'
19800	       && bp < &buf[1024])
19801	/* DO NOTHING */ ;
19802	*bp = '\0';
19803	fprintf(stdout, "%s", buf);
19804	fflush(stdin);
19805	if (i == -1)
19806	    return 0;
19807	bp = buf;
19808    }
19809}
19810EOCP
19811	set tryp
19812	if eval $compile; then
19813	    $rm -f tryp.out
19814	    $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19815	    if cmp tryp.c tryp.out >/dev/null 2>&1; then
19816	       $cat >&4 <<EOM
19817Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19818EOM
19819		: now check for fflushall behaviour
19820		case "$fflushall" in
19821		'') 	set try -DTRY_FFLUSH_ALL $output
19822			if eval $compile; then
19823				$cat >&4 <<EOM
19824(Now testing the other method--but note that this also may fail.)
19825EOM
19826				$run ./try 2>/dev/null
19827				code=$?
19828				$from try.out
19829				if $test -s try.out -a "X$code" = X42; then
19830					fflushall="`$cat try.out`"
19831				fi
19832			fi
19833			$rm_try
19834			case "$fflushall" in
19835			x)	$cat >&4 <<EOM
19836Whew. Flushing explicitly all the stdio streams works.
19837EOM
19838				fflushall="$define"
19839				;;
19840			'')	$cat >&4 <<EOM
19841Sigh. Flushing explicitly all the stdio streams doesn't work.
19842EOM
19843				fflushall="$undef"
19844				;;
19845			*)	$cat >&4 <<EOM
19846Cannot figure out whether flushing stdio streams explicitly works or not.
19847I'm assuming it doesn't.
19848EOM
19849				fflushall="$undef"
19850				;;
19851			esac
19852			;;
19853		"$define"|true|[yY]*)
19854			fflushall="$define"
19855			;;
19856		*)
19857			fflushall="$undef"
19858			;;
19859		esac
19860	    else
19861		$cat >&4 <<EOM
19862All is futile.  Even fflush(stdin) clobbers input pipes!
19863EOM
19864		fflushall="$undef"
19865	    fi
19866	else
19867	    fflushall="$undef"
19868	fi
19869	$rm -f core tryp.c tryp.core core.tryp.*
19870	;;
19871*)	fflushall="$undef"
19872	;;
19873esac
19874
19875case "$fflushNULL$fflushall" in
19876undefundef)
19877	$cat <<EOM
19878OK, I give up.  I cannot figure out how to flush pending stdio output.
19879We won't be flushing handles at all before fork/exec/popen.
19880EOM
19881	;;
19882esac
19883$rm_try tryp
19884
19885: Store the full pathname to the ar program for use in the C program
19886: Respect a hint or command line value for full_ar.
19887case "$full_ar" in
19888'') full_ar=$ar ;;
19889esac
19890
19891: Store the full pathname to the sed program for use in the C program
19892full_sed=$sed
19893
19894: see what type gids are declared as in the kernel
19895echo " "
19896echo "Looking for the type for group ids returned by getgid()."
19897set gid_t gidtype xxx stdio.h sys/types.h
19898eval $typedef
19899case "$gidtype" in
19900xxx)
19901	xxx=`./findhdr sys/user.h`
19902	set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19903	case $1 in
19904	unsigned) dflt="$1 $2" ;;
19905	*) dflt="$1" ;;
19906	esac
19907	;;
19908*) dflt="$gidtype";;
19909esac
19910case "$gidtype" in
19911gid_t) echo "gid_t found." ;;
19912*)	rp="What is the type for group ids returned by getgid()?"
19913	. ./myread
19914	gidtype="$ans"
19915	;;
19916esac
19917
19918: Check the size of GID
19919echo " "
19920case "$gidtype" in
19921*_t) zzz="$gidtype"	;;
19922*)   zzz="gid"		;;
19923esac
19924echo "Checking the size of $zzz..." >&4
19925cat > try.c <<EOCP
19926#include <sys/types.h>
19927#include <stdio.h>
19928#$i_stdlib I_STDLIB
19929#ifdef I_STDLIB
19930#include <stdlib.h>
19931#endif
19932int main() {
19933    printf("%d\n", (int)sizeof($gidtype));
19934    exit(0);
19935}
19936EOCP
19937set try
19938if eval $compile_ok; then
19939	yyy=`$run ./try`
19940	case "$yyy" in
19941	'')	gidsize=4
19942		echo "(I can't execute the test program--guessing $gidsize.)" >&4
19943		;;
19944	*)	gidsize=$yyy
19945		echo "Your $zzz is $gidsize bytes long."
19946		;;
19947	esac
19948else
19949	gidsize=4
19950	echo "(I can't compile the test program--guessing $gidsize.)" >&4
19951fi
19952
19953
19954: Check if GID is signed
19955echo " "
19956case "$gidtype" in
19957*_t) zzz="$gidtype"	;;
19958*)   zzz="gid"		;;
19959esac
19960echo "Checking the sign of $zzz..." >&4
19961cat > try.c <<EOCP
19962#include <sys/types.h>
19963#include <stdio.h>
19964int main() {
19965	$gidtype foo = -1;
19966	if (foo < 0)
19967		printf("-1\n");
19968	else
19969		printf("1\n");
19970}
19971EOCP
19972set try
19973if eval $compile; then
19974	yyy=`$run ./try`
19975	case "$yyy" in
19976	'')	gidsign=1
19977		echo "(I can't execute the test program--guessing unsigned.)" >&4
19978		;;
19979	*)	gidsign=$yyy
19980		case "$gidsign" in
19981		 1) echo "Your $zzz is unsigned." ;;
19982		-1) echo "Your $zzz is signed."   ;;
19983		esac
19984		;;
19985	esac
19986else
19987	gidsign=1
19988	echo "(I can't compile the test program--guessing unsigned.)" >&4
19989fi
19990
19991
19992: Check 64bit sizes
19993echo " "
19994
19995if $test X"$quadtype" != X; then
19996
19997echo "Checking how to print 64-bit integers..." >&4
19998
19999if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20000	$cat >try.c <<'EOCP'
20001#include <sys/types.h>
20002#include <stdio.h>
20003int main() {
20004  int q = 12345678901;
20005  printf("%ld\n", q);
20006}
20007EOCP
20008	set try
20009	if eval $compile; then
20010		yyy=`$run ./try`
20011		case "$yyy" in
20012		12345678901)
20013			sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20014                	sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20015			echo "We will use %d."
20016			;;
20017		esac
20018	fi
20019fi
20020
20021if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20022	$cat >try.c <<'EOCP'
20023#include <sys/types.h>
20024#include <stdio.h>
20025int main() {
20026  long q = 12345678901;
20027  printf("%ld\n", q);
20028}
20029EOCP
20030	set try
20031	if eval $compile; then
20032		yyy=`$run ./try`
20033		case "$yyy" in
20034		12345678901)
20035			sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20036                	sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20037			echo "We will use %ld."
20038			;;
20039		esac
20040	fi
20041fi
20042
20043if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20044	$cat >try.c <<'EOCP'
20045#include <sys/types.h>
20046#include <inttypes.h>
20047#include <stdio.h>
20048int main() {
20049  int64_t q = 12345678901;
20050  printf("%" PRId64 "\n", q);
20051}
20052EOCP
20053	set try
20054	if eval $compile; then
20055		yyy=`$run ./try`
20056		case "$yyy" in
20057		12345678901)
20058			sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20059                	sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20060			echo "We will use the C9X style."
20061			;;
20062		esac
20063	fi
20064fi
20065
20066if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20067	$cat >try.c <<EOCP
20068#include <sys/types.h>
20069#include <stdio.h>
20070int main() {
20071  $quadtype q = 12345678901;
20072  printf("%Ld\n", q);
20073}
20074EOCP
20075	set try
20076	if eval $compile; then
20077		yyy=`$run ./try`
20078		case "$yyy" in
20079		12345678901)
20080			sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20081                	sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20082			echo "We will use %Ld."
20083			;;
20084		esac
20085	fi
20086fi
20087
20088if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20089	$cat >try.c <<'EOCP'
20090#include <sys/types.h>
20091#include <stdio.h>
20092int main() {
20093  long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20094  printf("%lld\n", q);
20095}
20096EOCP
20097	set try
20098	if eval $compile; then
20099		yyy=`$run ./try`
20100		case "$yyy" in
20101		12345678901)
20102			sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20103                	sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20104			echo "We will use the %lld style."
20105			;;
20106		esac
20107	fi
20108fi
20109
20110if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20111	$cat >try.c <<EOCP
20112#include <sys/types.h>
20113#include <stdio.h>
20114int main() {
20115  $quadtype q = 12345678901;
20116  printf("%qd\n", q);
20117}
20118EOCP
20119	set try
20120	if eval $compile; then
20121		yyy=`$run ./try`
20122		case "$yyy" in
20123		12345678901)
20124			sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20125                	sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20126			echo "We will use %qd."
20127			;;
20128		esac
20129	fi
20130fi
20131
20132if $test X"$sPRId64" = X; then
20133	echo "Cannot figure out how to print 64-bit integers." >&4
20134fi
20135$rm_try
20136
20137fi
20138
20139case "$sPRId64" in
20140'')	d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20141	d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20142	;;
20143*)	d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20144	d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20145	;;
20146esac
20147
20148: Check format strings for internal types
20149echo " "
20150$echo "Checking the format strings to be used for Perl's internal types..." >&4
20151
20152if $test X"$ivsize" = X8; then
20153	ivdformat="$sPRId64"
20154	uvuformat="$sPRIu64"
20155	uvoformat="$sPRIo64"
20156	uvxformat="$sPRIx64"
20157	uvXUformat="$sPRIXU64"
20158else
20159	if $test X"$ivsize" = X"$longsize"; then
20160		ivdformat='"ld"'
20161		uvuformat='"lu"'
20162		uvoformat='"lo"'
20163		uvxformat='"lx"'
20164		uvXUformat='"lX"'
20165	else
20166		if $test X"$ivsize" = X"$intsize"; then
20167			ivdformat='"d"'
20168			uvuformat='"u"'
20169			uvoformat='"o"'
20170			uvxformat='"x"'
20171			uvXUformat='"X"'
20172		else
20173			: far out
20174			if $test X"$ivsize" = X"$shortsize"; then
20175				ivdformat='"hd"'
20176				uvuformat='"hu"'
20177				uvoformat='"ho"'
20178				uvxformat='"hx"'
20179				uvXUformat='"hX"'
20180			fi
20181		fi
20182	fi
20183fi
20184
20185if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20186	nveformat="$sPRIeldbl"
20187	nvfformat="$sPRIfldbl"
20188	nvgformat="$sPRIgldbl"
20189	nvEUformat="$sPRIEUldbl"
20190	nvFUformat="$sPRIFUldbl"
20191	nvGUformat="$sPRIGUldbl"
20192else
20193	nveformat='"e"'
20194	nvfformat='"f"'
20195	nvgformat='"g"'
20196	nvEUformat='"E"'
20197	nvFUformat='"F"'
20198	nvGUformat='"G"'
20199fi
20200
20201case "$ivdformat" in
20202'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20203    exit 1
20204    ;;
20205esac
20206
20207: Check format string for GID
20208
20209echo " "
20210$echo "Checking the format string to be used for gids..." >&4
20211
20212case "$gidsign" in
20213-1)	if $test X"$gidsize" = X"$ivsize"; then
20214		gidformat="$ivdformat"
20215	else
20216		if $test X"$gidsize" = X"$longsize"; then
20217			gidformat='"ld"'
20218		else
20219			if $test X"$gidsize" = X"$intsize"; then
20220				gidformat='"d"'
20221			else
20222				if $test X"$gidsize" = X"$shortsize"; then
20223					gidformat='"hd"'
20224				fi
20225			fi
20226		fi
20227	fi
20228	;;
20229*)	if $test X"$gidsize" = X"$uvsize"; then
20230		gidformat="$uvuformat"
20231	else
20232		if $test X"$gidsize" = X"$longsize"; then
20233			gidformat='"lu"'
20234		else
20235			if $test X"$gidsize" = X"$intsize"; then
20236				gidformat='"u"'
20237			else
20238				if $test X"$gidsize" = X"$shortsize"; then
20239					gidformat='"hu"'
20240				fi
20241			fi
20242		fi
20243	fi
20244	;;
20245esac
20246
20247: see if getgroups exists
20248set getgroups d_getgrps
20249eval $inlibc
20250
20251: see if setgroups exists
20252set setgroups d_setgrps
20253eval $inlibc
20254
20255: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20256echo " "
20257case "$d_getgrps$d_setgrps" in
20258*define*)
20259	case "$groupstype" in
20260	'') dflt="$gidtype" ;;
20261	*)  dflt="$groupstype" ;;
20262	esac
20263	$cat <<EOM
20264What type of pointer is the second argument to getgroups() and setgroups()?
20265Usually this is the same as group ids, $gidtype, but not always.
20266
20267EOM
20268	rp='What type pointer is the second argument to getgroups() and setgroups()?'
20269	. ./myread
20270	groupstype="$ans"
20271	;;
20272*)  groupstype="$gidtype";;
20273esac
20274
20275: MAD = Misc Attribute Definition
20276
20277if $test $patchlevel -lt 9; then
20278: MAD is not available in 5.8.x or earlier.
20279    ans=n;
20280else
20281    case "$mad" in
20282    $define|true|[yY]*)	dflt='y' ;;
20283    *)			dflt='n' ;;
20284    esac
20285    cat <<EOM
20286
20287Would you like to build with Misc Attribute Decoration? This is development
20288work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20289overhead on the interpreter.
20290
20291If this doesn't make any sense to you, just accept the default '$dflt'.
20292EOM
20293    rp='Build Perl with MAD?'
20294    . ./myread
20295fi
20296case "$ans" in
20297y|Y)	val="$define"
20298	madlyh='madly.h madly.act madly.tab'
20299	madlysrc='madly.c'
20300	madlyobj="madly$_o" ;;
20301*)	val="$undef"
20302	madlyh=''
20303	madlysrc=''
20304	madlyobj='' ;;
20305esac
20306set mad
20307eval $setvar
20308
20309: check whether make sets MAKE
20310echo " "
20311echo "Checking if your $make program sets \$(MAKE)..." >&4
20312case "$make_set_make" in
20313'')
20314	$sed 's/^X //' > testmake.mak << 'EOF'
20315Xall:
20316X 	@echo 'maketemp="$(MAKE)"'
20317EOF
20318	case "`$make -f testmake.mak 2>/dev/null`" in
20319	*maketemp=*) make_set_make='#' ;;
20320	*)	make_set_make="MAKE=$make" ;;
20321	esac
20322	$rm -f testmake.mak
20323	;;
20324esac
20325case "$make_set_make" in
20326'#') echo "Yup, it does.";;
20327*) echo "Nope, it doesn't.";;
20328esac
20329
20330: see what type is used for mode_t
20331rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20332set mode_t modetype int stdio.h sys/types.h
20333eval $typedef_ask
20334
20335: see if we need va_copy
20336echo " "
20337case "$i_stdarg" in
20338"$define")
20339	$cat >try.c <<EOCP
20340#include <stdarg.h>
20341#include <stdio.h>
20342#$i_stdlib I_STDLIB
20343#ifdef I_STDLIB
20344#include <stdlib.h>
20345#endif
20346#include <signal.h>
20347
20348int
20349ivfprintf(FILE *f, const char *fmt, va_list *valp)
20350{
20351  return vfprintf(f, fmt, *valp);
20352}
20353
20354int
20355myvfprintf(FILE *f, const  char *fmt, va_list val)
20356{
20357  return ivfprintf(f, fmt, &val);
20358}
20359
20360int
20361myprintf(char *fmt, ...)
20362{
20363  va_list val;
20364  va_start(val, fmt);
20365  return myvfprintf(stdout, fmt, val);
20366}
20367
20368int
20369main(int ac, char **av)
20370{
20371  signal(SIGSEGV, exit);
20372
20373  myprintf("%s%cs all right, then\n", "that", '\'');
20374  exit(0);
20375}
20376EOCP
20377	set try
20378	if eval $compile && $run ./try 2>&1 >/dev/null; then
20379		case "`$run ./try`" in
20380		"that's all right, then")
20381			okay=yes
20382			;;
20383		esac
20384	fi
20385	case "$okay" in
20386	yes)	echo "It seems that you don't need va_copy()." >&4
20387		need_va_copy="$undef"
20388		;;
20389	*)	echo "It seems that va_copy() or similar will be needed." >&4
20390		need_va_copy="$define"
20391		;;
20392	esac
20393	$rm_try
20394	;;
20395*)	echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20396	need_va_copy="$undef"
20397	;;
20398esac
20399
20400: see what type is used for size_t
20401rp="What is the type used for the length parameter for string functions?"
20402set size_t sizetype 'unsigned int' stdio.h sys/types.h
20403eval $typedef_ask
20404
20405: check for type of arguments to gethostbyaddr.
20406if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20407	case "$d_gethbyaddr" in
20408	$define)
20409		$cat <<EOM
20410
20411Checking to see what type of arguments are accepted by gethostbyaddr().
20412EOM
20413		hdrs="$define sys/types.h
20414			$d_socket sys/socket.h
20415			$i_niin netinet/in.h
20416			$i_netdb netdb.h
20417			$i_unistd unistd.h"
20418		: The first arg can 'char *' or 'void *'
20419		: The second arg is some of integral type
20420		for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20421			for yyy in size_t long int; do
20422				case "$netdb_host_type" in
20423				'')	try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20424					if ./protochk "$try" $hdrs; then
20425						echo "Your system accepts $xxx for the first arg."
20426						echo "...and $yyy for the second arg."
20427						netdb_host_type="$xxx"
20428						netdb_hlen_type="$yyy"
20429					fi
20430					;;
20431				esac
20432			done
20433		done
20434		: In case none of those worked, prompt the user.
20435		case "$netdb_host_type" in
20436		'')	rp='What is the type for the 1st argument to gethostbyaddr?'
20437			dflt='char *'
20438			. ./myread
20439			netdb_host_type=$ans
20440			rp='What is the type for the 2nd argument to gethostbyaddr?'
20441			dflt="$sizetype"
20442			. ./myread
20443			netdb_hlen_type=$ans
20444			;;
20445		esac
20446		;;
20447	*)	: no gethostbyaddr, so pick harmless defaults
20448		netdb_host_type='char *'
20449		netdb_hlen_type="$sizetype"
20450		;;
20451	esac
20452	# Remove the "const" if needed. -- but then we'll have a
20453	# prototype clash!
20454	# netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20455fi
20456
20457: check for type of argument to gethostbyname.
20458if test "X$netdb_name_type" = X ; then
20459	case "$d_gethbyname" in
20460	$define)
20461		$cat <<EOM
20462
20463Checking to see what type of argument is accepted by gethostbyname().
20464EOM
20465		hdrs="$define sys/types.h
20466			$d_socket sys/socket.h
20467			$i_niin netinet/in.h
20468			$i_netdb netdb.h
20469			$i_unistd unistd.h"
20470		for xxx in "const char *" "char *"; do
20471			case "$netdb_name_type" in
20472			'')	try="$extern_C struct hostent *gethostbyname($xxx);"
20473				if ./protochk "$try" $hdrs; then
20474					echo "Your system accepts $xxx."
20475					netdb_name_type="$xxx"
20476				fi
20477				;;
20478			esac
20479		done
20480		: In case none of those worked, prompt the user.
20481		case "$netdb_name_type" in
20482		'')	rp='What is the type for the 1st argument to gethostbyname?'
20483			dflt='char *'
20484			. ./myread
20485			netdb_name_type=$ans
20486			;;
20487		esac
20488		;;
20489	*)	: no gethostbyname, so pick harmless default
20490		netdb_name_type='char *'
20491		;;
20492	esac
20493fi
20494
20495: check for type of 1st argument to getnetbyaddr.
20496if test "X$netdb_net_type" = X ; then
20497	case "$d_getnbyaddr" in
20498	$define)
20499		$cat <<EOM
20500
20501Checking to see what type of 1st argument is accepted by getnetbyaddr().
20502EOM
20503		hdrs="$define sys/types.h
20504			$d_socket sys/socket.h
20505			$i_niin netinet/in.h
20506			$i_netdb netdb.h
20507			$i_unistd unistd.h"
20508		for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20509			case "$netdb_net_type" in
20510			'')	try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20511				if ./protochk "$try" $hdrs; then
20512					echo "Your system accepts $xxx."
20513					netdb_net_type="$xxx"
20514				fi
20515				;;
20516			esac
20517		done
20518		: In case none of those worked, prompt the user.
20519		case "$netdb_net_type" in
20520		'')	rp='What is the type for the 1st argument to getnetbyaddr?'
20521			dflt='long'
20522			. ./myread
20523			netdb_net_type=$ans
20524			;;
20525		esac
20526		;;
20527	*)	: no getnetbyaddr, so pick harmless default
20528		netdb_net_type='long'
20529		;;
20530	esac
20531fi
20532: locate the preferred pager for this system
20533fn=f/
20534case "$pager" in
20535'')
20536	dflt=''
20537	case "$pg" in
20538	/*) dflt=$pg;;
20539	[a-zA-Z]:/*) dflt=$pg;;
20540	esac
20541	case "$more" in
20542	/*) dflt=$more;;
20543	[a-zA-Z]:/*) dflt=$more;;
20544	esac
20545	case "$less" in
20546	/*) dflt=$less;;
20547	[a-zA-Z]:/*) dflt=$less;;
20548	esac
20549	case "$dflt" in
20550	'') dflt=/usr/ucb/more;;
20551	esac
20552	;;
20553*)	dflt="$pager"
20554	;;
20555esac
20556fn="f/($dflt)"
20557echo " "
20558rp='What pager is used on your system?'
20559. ./getfile
20560pager="$ans"
20561
20562: see what type pids are declared as in the kernel
20563rp="What is the type of process ids on this system?"
20564set pid_t pidtype int stdio.h sys/types.h
20565eval $typedef_ask
20566
20567: see if ar generates random libraries by itself
20568echo " "
20569echo "Checking how to generate random libraries on your machine..." >&4
20570echo 'int bar1() { return bar2(); }' > bar1.c
20571echo 'int bar2() { return 2; }' > bar2.c
20572$cat > foo.c <<EOP
20573#$i_stdlib I_STDLIB
20574#ifdef I_STDLIB
20575#include <stdlib.h>
20576#endif
20577int main() { printf("%d\n", bar1()); exit(0); }
20578EOP
20579$cc $ccflags -c bar1.c >/dev/null 2>&1
20580$cc $ccflags -c bar2.c >/dev/null 2>&1
20581$cc $ccflags -c foo.c >/dev/null 2>&1
20582$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20583if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20584	$run ./foobar >/dev/null 2>&1; then
20585	echo "$ar appears to generate random libraries itself."
20586	orderlib=false
20587	if [ "X$ranlib" = "X" ]; then
20588	    ranlib=":"
20589	fi
20590elif $ar s bar$_a >/dev/null 2>&1 &&
20591	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20592	$run ./foobar >/dev/null 2>&1; then
20593		echo "a table of contents needs to be added with '$ar s'."
20594		orderlib=false
20595		ranlib="$ar s"
20596elif $ar ts bar$_a >/dev/null 2>&1 &&
20597	$cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20598	$run ./foobar >/dev/null 2>&1; then
20599		echo "a table of contents needs to be added with '$ar ts'."
20600		orderlib=false
20601		ranlib="$ar ts"
20602else
20603	case "$ranlib" in
20604	:) ranlib='';;
20605	'')
20606		ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20607		$test -f $ranlib || ranlib=''
20608		;;
20609	esac
20610	if $test -n "$ranlib"; then
20611		echo "your system has '$ranlib'; we'll use that."
20612		orderlib=false
20613	else
20614		echo "your system doesn't seem to support random libraries"
20615		echo "so we'll use lorder and tsort to order the libraries."
20616		orderlib=true
20617		ranlib=":"
20618	fi
20619fi
20620$rm -f foo* bar*
20621
20622: see if this is a values.h system
20623set values.h i_values
20624eval $inhdr
20625
20626: Check the max offset that gmtime and localtime accept
20627echo "Checking max offsets that gmtime () accepts"
20628
20629case $i_values in
20630    define) yyy="#include <values.h>" ;;
20631    *)      yyy="" ;;
20632    esac
20633
20634case "$sGMTIME_min/$sGMTIME_max" in
20635    0/0|/)
20636	$cat >try.c <<EOCP
20637#include <sys/types.h>
20638#include <stdio.h>
20639#include <time.h>
20640$yyy
20641
20642int i;
20643struct tm *tmp;
20644time_t pt;
20645
20646void gm_check (time_t t, int min_year, int max_year)
20647{
20648    tmp = gmtime (&t);
20649    if ( tmp == NULL ||
20650	/* Check tm_year overflow */
20651	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20652	tmp = NULL;
20653    else
20654	pt = t;
20655    } /* gm_check */
20656
20657int check_max ()
20658{
20659    tmp = NULL;
20660    pt  = 0;
20661#ifdef MAXLONG
20662    gm_check (MAXLONG, 69, 0x7fffffff);
20663#endif
20664    if (tmp == NULL || tmp->tm_year < 0) {
20665	for (i = 63; i >= 0; i--) {
20666	    time_t x = pt | ((time_t)1 << i);
20667	    if (x < 0 || x < pt) continue;
20668	    gm_check (x, 69, 0x7fffffff);
20669	    }
20670	}
20671    printf ("sGMTIME_max=%ld\n", pt);
20672    return (0);
20673    } /* check_max */
20674
20675int check_min ()
20676{
20677    tmp = NULL;
20678    pt  = 0;
20679#ifdef MINLONG
20680    gm_check (MINLONG, -1900, 70);
20681#endif
20682    if (tmp == NULL) {
20683	for (i = 36; i >= 0; i--) {
20684	    time_t x = pt - ((time_t)1 << i);
20685	    if (x > 0) continue;
20686	    gm_check (x, -1900, 70);
20687	    }
20688	}
20689    printf ("sGMTIME_min=%ld\n", pt);
20690    return (0);
20691    } /* check_min */
20692
20693int main (int argc, char *argv[])
20694{
20695    fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20696    check_max ();
20697    check_min ();
20698    return (0);
20699    } /* main */
20700EOCP
20701	set try
20702	if eval $compile; then
20703	    eval `$run ./try`
20704	else
20705	    echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20706	    fi
20707	$rm_try
20708	;;
20709    esac
20710
20711echo "Checking max offsets that localtime () accepts"
20712
20713case "$sLOCALTIME_min/$sLOCALTIME_max" in
20714    0/0|/)
20715	$cat >try.c <<EOCP
20716#include <sys/types.h>
20717#include <stdio.h>
20718#include <time.h>
20719$yyy
20720
20721int i;
20722struct tm *tmp;
20723time_t pt;
20724
20725void local_check (time_t t, int min_year, int max_year)
20726{
20727    if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20728	tmp = NULL;
20729    else
20730	tmp = localtime (&t);
20731    if ( tmp == NULL ||
20732	/* Check tm_year overflow */
20733	 tmp->tm_year < min_year || tmp->tm_year > max_year)
20734	tmp = NULL;
20735    else
20736	pt = t;
20737    } /* local_check */
20738
20739int check_max ()
20740{
20741    tmp = NULL;
20742    pt  = 0;
20743#ifdef MAXLONG
20744    local_check (MAXLONG, 69, 0x7fffffff);
20745#endif
20746    if (tmp == NULL || tmp->tm_year < 0) {
20747	for (i = 63; i >= 0; i--) {
20748	    time_t x = pt | ((time_t)1 << i);
20749	    if (x < 0 || x < pt) continue;
20750	    local_check (x, 69, 0x7fffffff);
20751	    }
20752	}
20753    printf ("sLOCALTIME_max=%ld\n", pt);
20754    return (0);
20755   } /* check_max */
20756
20757int check_min ()
20758{
20759    tmp = NULL;
20760    pt  = 0;
20761#ifdef MINLONG
20762    local_check (MINLONG, -1900, 70);
20763#endif
20764    if (tmp == NULL) {
20765	for (i = 36; i >= 0; i--) {
20766	    time_t x = pt - ((time_t)1 << i);
20767	    if (x > 0) continue;
20768	    local_check (x, -1900, 70);
20769	    }
20770	}
20771    printf ("sLOCALTIME_min=%ld\n", pt);
20772    return (0);
20773    } /* check_min */
20774
20775int main (int argc, char *argv[])
20776{
20777    check_max ();
20778    check_min ();
20779    return (0);
20780    } /* main */
20781EOCP
20782	set try
20783	if eval $compile; then
20784	    eval `$run ./try`
20785	else
20786	    echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20787	    fi
20788	$rm_try
20789	;;
20790    esac
20791
20792: check for type of arguments to select.
20793case "$selecttype" in
20794'') case "$d_select" in
20795	$define)
20796		echo " "
20797		$cat <<EOM
20798Checking to see what type of arguments are accepted by select().
20799EOM
20800		hdrs="$define sys/types.h
20801			$i_systime sys/time.h
20802			$i_sysselct sys/select.h
20803			$d_socket sys/socket.h"
20804		: The first arg can be int, unsigned, or size_t
20805		: The last arg may or may not be 'const'
20806		val=''
20807		: void pointer has been seen but using that
20808		: breaks the selectminbits test
20809		for xxx in 'fd_set *' 'int *'; do
20810			for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20811				for tmo in 'struct timeval *' 'const struct timeval *'; do
20812					case "$val" in
20813					'')	try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20814						if ./protochk "$try" $hdrs; then
20815							echo "Your system accepts $xxx."
20816							val="$xxx"
20817						fi
20818						;;
20819					esac
20820				done
20821			done
20822		done
20823		case "$val" in
20824		'')	rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20825			case "$d_fd_set" in
20826				$define) dflt="fd_set *" ;;
20827				*)		dflt="int *" ;;
20828			esac
20829			. ./myread
20830			val=$ans
20831			;;
20832		esac
20833		selecttype="$val"
20834		;;
20835	*)	: no select, so pick a harmless default
20836		selecttype='int *'
20837		;;
20838	esac
20839	;;
20840esac
20841
20842: check for the select 'width'
20843case "$selectminbits" in
20844'') safebits=`expr $ptrsize \* 8`
20845    case "$d_select" in
20846	$define)
20847		$cat <<EOM
20848
20849Checking to see on how many bits at a time your select() operates...
20850EOM
20851		$cat >try.c <<EOCP
20852#include <sys/types.h>
20853#$i_time I_TIME
20854#$i_systime I_SYS_TIME
20855#$i_systimek I_SYS_TIME_KERNEL
20856#ifdef I_TIME
20857#   include <time.h>
20858#endif
20859#ifdef I_SYS_TIME
20860#   ifdef I_SYS_TIME_KERNEL
20861#	define KERNEL
20862#   endif
20863#   include <sys/time.h>
20864#   ifdef I_SYS_TIME_KERNEL
20865#	undef KERNEL
20866#   endif
20867#endif
20868#$i_sysselct I_SYS_SELECT
20869#ifdef I_SYS_SELECT
20870#include <sys/select.h>
20871#endif
20872#$d_socket HAS_SOCKET
20873#ifdef HAS_SOCKET
20874#   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20875#endif
20876#include <stdio.h>
20877#$i_stdlib I_STDLIB
20878#ifdef I_STDLIB
20879#include <stdlib.h>
20880#endif
20881$selecttype b;
20882#define S sizeof(*(b))
20883#define MINBITS	64
20884#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20885#define NBITS  (NBYTES * 8)
20886int main() {
20887    char *s = (char *)malloc(NBYTES);
20888    struct timeval t;
20889    int i;
20890    FILE* fp;
20891    int fd;
20892
20893    if (!s)
20894	exit(1);
20895    fclose(stdin);
20896    fp = fopen("try.c", "r");
20897    if (fp == 0)
20898      exit(2);
20899    fd = fileno(fp);
20900    if (fd < 0)
20901      exit(3);
20902    b = ($selecttype)s;
20903    for (i = 0; i < NBITS; i++)
20904	FD_SET(i, b);
20905    t.tv_sec  = 0;
20906    t.tv_usec = 0;
20907    select(fd + 1, b, 0, 0, &t);
20908    for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20909    free(s);
20910    printf("%d\n", i + 1);
20911    return 0;
20912}
20913EOCP
20914		set try
20915		if eval $compile_ok; then
20916			selectminbits=`$run ./try`
20917			case "$selectminbits" in
20918			'')	cat >&4 <<EOM
20919Cannot figure out on how many bits at a time your select() operates.
20920I'll play safe and guess it is $safebits bits.
20921EOM
20922				selectminbits=$safebits
20923				bits="$safebits bits"
20924				;;
20925			1)	bits="1 bit" ;;
20926			*)	bits="$selectminbits bits" ;;
20927			esac
20928			echo "Your select() operates on $bits at a time." >&4
20929		else
20930			rp='What is the minimum number of bits your select() operates on?'
20931			case "$byteorder" in
20932			12345678)	dflt=64 ;;
20933			1234)		dflt=32 ;;
20934			*)		dflt=1	;;
20935			esac
20936			. ./myread
20937			val=$ans
20938			selectminbits="$val"
20939		fi
20940		$rm_try
20941		;;
20942	*)	: no select, so pick a harmless default
20943		selectminbits=$safebits
20944		;;
20945	esac
20946	;;
20947esac
20948
20949: Trace out the files included by signal.h, then look for SIGxxx names.
20950if [ "X$fieldn" = X ]; then
20951	: Just make some guesses.  We check them later.
20952	xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20953else
20954	xxx=`echo '#include <signal.h>' |
20955	$cppstdin $cppminus $cppflags 2>/dev/null |
20956	$grep '^[ 	]*#.*include' |
20957	$awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20958		$sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20959fi
20960xxxfiles=''
20961for xx in $xxx /dev/null ; do
20962	$test -f "$xx" && xxxfiles="$xxxfiles $xx"
20963done
20964case "$xxxfiles" in
20965'')	xxxfiles=`./findhdr signal.h` ;;
20966esac
20967xxx=`awk '
20968$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20969	print substr($2, 4, 20)
20970}
20971$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20972	print substr($3, 4, 20)
20973}' $xxxfiles`
20974: Append some common names just in case the awk scan failed.
20975xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20976xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20977xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20978xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20979xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20980
20981: generate a few handy files for later
20982$cat > signal.c <<EOCP
20983#include <sys/types.h>
20984#include <signal.h>
20985#$i_stdlib I_STDLIB
20986#ifdef I_STDLIB
20987#include <stdlib.h>
20988#endif
20989#include <stdio.h>
20990int main() {
20991
20992/* Strange style to avoid deeply-nested #if/#else/#endif */
20993#ifndef NSIG
20994#  ifdef _NSIG
20995#    define NSIG (_NSIG)
20996#  endif
20997#endif
20998
20999#ifndef NSIG
21000#  ifdef SIGMAX
21001#    define NSIG (SIGMAX+1)
21002#  endif
21003#endif
21004
21005#ifndef NSIG
21006#  ifdef SIG_MAX
21007#    define NSIG (SIG_MAX+1)
21008#  endif
21009#endif
21010
21011#ifndef NSIG
21012#  ifdef _SIG_MAX
21013#    define NSIG (_SIG_MAX+1)
21014#  endif
21015#endif
21016
21017#ifndef NSIG
21018#  ifdef MAXSIG
21019#    define NSIG (MAXSIG+1)
21020#  endif
21021#endif
21022
21023#ifndef NSIG
21024#  ifdef MAX_SIG
21025#    define NSIG (MAX_SIG+1)
21026#  endif
21027#endif
21028
21029#ifndef NSIG
21030#  ifdef SIGARRAYSIZE
21031#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21032#  endif
21033#endif
21034
21035#ifndef NSIG
21036#  ifdef _sys_nsig
21037#    define NSIG (_sys_nsig) /* Solaris 2.5 */
21038#  endif
21039#endif
21040
21041/* Default to some arbitrary number that's big enough to get most
21042   of the common signals.
21043*/
21044#ifndef NSIG
21045#    define NSIG 50
21046#endif
21047
21048printf("NSIG %d\n", NSIG);
21049
21050#ifndef JUST_NSIG
21051
21052EOCP
21053
21054echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21055{
21056	printf "#ifdef SIG"; printf $1; printf "\n"
21057	printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21058	printf $1; printf ");\n"
21059	printf "#endif\n"
21060}
21061END {
21062	printf "#endif /* JUST_NSIG */\n";
21063	printf "exit(0);\n}\n";
21064}
21065' >>signal.c
21066$cat >signal.awk <<'EOP'
21067BEGIN { ndups = 0 }
21068$1 ~ /^NSIG$/ { nsig = $2 }
21069($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21070    if ($2 > maxsig) { maxsig = $2 }
21071    if (sig_name[$2]) {
21072	dup_name[ndups] = $1
21073	dup_num[ndups] = $2
21074	ndups++
21075    }
21076    else {
21077	sig_name[$2] = $1
21078	sig_num[$2] = $2
21079    }
21080}
21081END {
21082    if (nsig == 0) {
21083    	nsig = maxsig + 1
21084    }
21085    printf("NSIG %d\n", nsig);
21086    for (n = 1; n < nsig; n++) {
21087 	if (sig_name[n]) {
21088 	    printf("%s %d\n", sig_name[n], sig_num[n])
21089	}
21090 	else {
21091 	    printf("NUM%d %d\n", n, n)
21092 	}
21093    }
21094    for (n = 0; n < ndups; n++) {
21095 	printf("%s %d\n", dup_name[n], dup_num[n])
21096    }
21097}
21098EOP
21099$cat >signal_cmd <<EOS
21100$startsh
21101if $test -s signal.lst; then
21102    echo "Using your existing signal.lst file"
21103	exit 0
21104fi
21105xxx="$xxx"
21106EOS
21107$cat >>signal_cmd <<'EOS'
21108
21109set signal
21110if eval $compile_ok; then
21111	$run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21112		$uniq | $awk -f signal.awk >signal.lst
21113else
21114	echo "(I can't seem be able to compile the whole test program)" >&4
21115	echo "(I'll try it in little pieces.)" >&4
21116	set signal -DJUST_NSIG
21117	if eval $compile_ok; then
21118		$run ./signal$_exe > signal.nsg
21119		$cat signal.nsg
21120	else
21121		echo "I can't seem to figure out how many signals you have." >&4
21122		echo "Guessing 50." >&4
21123		echo 'NSIG 50' > signal.nsg
21124	fi
21125	: Now look at all the signal names, one at a time.
21126	for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21127		$cat > signal.c <<EOCP
21128#include <sys/types.h>
21129#include <signal.h>
21130#include <stdio.h>
21131int main() {
21132printf("$xx %d\n", SIG${xx});
21133return 0;
21134}
21135EOCP
21136		set signal
21137		if eval $compile; then
21138			echo "SIG${xx} found."
21139			$run ./signal$_exe  >> signal.ls1
21140		else
21141			echo "SIG${xx} NOT found."
21142		fi
21143	done
21144	if $test -s signal.ls1; then
21145		$cat signal.nsg signal.ls1 |
21146			$sort -n | $uniq | $awk -f signal.awk >signal.lst
21147	fi
21148
21149fi
21150if $test -s signal.lst; then
21151	:
21152else
21153	echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21154	echo 'kill -l' >signal
21155	set X `csh -f <signal`
21156	$rm -f signal
21157	shift
21158	case $# in
21159	0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21160	esac
21161	echo $@ | $tr ' ' $trnl | \
21162 	    $awk '{ printf "%s %d\n", $1, ++s; }
21163 		  END { printf "NSIG %d\n", ++s }' >signal.lst
21164fi
21165$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21166EOS
21167chmod a+x signal_cmd
21168$eunicefix signal_cmd
21169
21170: generate list of signal names
21171echo " "
21172case "$sig_name_init" in
21173'') doinit=yes ;;
21174*)  case "$sig_num_init" in
21175    ''|*,*) doinit=yes ;;
21176    esac ;;
21177esac
21178case "$doinit" in
21179yes)
21180	echo "Generating a list of signal names and numbers..." >&4
21181	. ./signal_cmd
21182 	sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21183 	sig_name=`$awk 'BEGIN { printf "ZERO " }
21184 			!/^NSIG/ { printf "%s ", $1 }' signal.lst`
21185 	sig_num=`$awk  'BEGIN { printf "0 " }
21186 			!/^NSIG/ { printf "%d ", $2 }' signal.lst`
21187 	sig_name_init=`$awk 'BEGIN	{ printf "\"ZERO\", " }
21188 			     !/^NSIG/	{ printf "\"%s\", ", $1 }
21189 			     END	{ printf "0\n" }' signal.lst`
21190 	sig_num_init=`$awk  'BEGIN	{ printf "0, " }
21191 			     !/^NSIG/	{ printf "%d, ", $2}
21192 			     END	{ printf "0\n"}' signal.lst`
21193	;;
21194esac
21195echo "The following $sig_count signals are available:"
21196echo " "
21197echo $sig_name | $awk \
21198'BEGIN { linelen = 0 }
21199{
21200	for (i = 1; i <= NF; i++) {
21201		name = "SIG" $i " "
21202		linelen = linelen + length(name)
21203		if (linelen > 70) {
21204			printf "\n"
21205			linelen = length(name)
21206		}
21207		printf "%s", name
21208	}
21209	printf "\n"
21210}'
21211sig_size=`echo $sig_name | awk '{print NF}'`
21212$rm -f signal signal.c signal.awk signal.lst signal_cmd
21213
21214: Check size of size
21215echo " "
21216case "$sizetype" in
21217*_t) zzz="$sizetype"	;;
21218*)   zzz="filesize"	;;
21219esac
21220echo "Checking the size of $zzz..." >&4
21221cat > try.c <<EOCP
21222#include <sys/types.h>
21223#include <stdio.h>
21224#$i_stdlib I_STDLIB
21225#ifdef I_STDLIB
21226#include <stdlib.h>
21227#endif
21228int main() {
21229    printf("%d\n", (int)sizeof($sizetype));
21230    exit(0);
21231}
21232EOCP
21233set try
21234if eval $compile_ok; then
21235	yyy=`$run ./try`
21236	case "$yyy" in
21237	'')	sizesize=4
21238		echo "(I can't execute the test program--guessing $sizesize.)" >&4
21239		;;
21240	*)	sizesize=$yyy
21241		echo "Your $zzz size is $sizesize bytes."
21242		;;
21243	esac
21244else
21245	sizesize=4
21246	echo "(I can't compile the test program--guessing $sizesize.)" >&4
21247fi
21248
21249
21250: check for socklen_t
21251echo " "
21252echo "Checking to see if you have socklen_t..." >&4
21253$cat >try.c <<EOCP
21254#include <sys/types.h>
21255#$d_socket HAS_SOCKET
21256#ifdef HAS_SOCKET
21257#include <sys/socket.h>
21258#endif
21259int main() { socklen_t x = 16; }
21260EOCP
21261set try
21262if eval $compile; then
21263	val="$define"
21264	echo "You have socklen_t."
21265else
21266	val="$undef"
21267	echo "You do not have socklen_t."
21268	case "$sizetype" in
21269	size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21270	esac
21271fi
21272$rm_try
21273set d_socklen_t
21274eval $setvar
21275
21276: see if this is a socks.h system
21277set socks.h i_socks
21278eval $inhdr
21279
21280: check for type of the size argument to socket calls
21281case "$d_socket" in
21282"$define")
21283	$cat <<EOM
21284
21285Checking to see what type is the last argument of accept().
21286EOM
21287	yyy=''
21288	case "$d_socklen_t" in
21289	"$define") yyy="$yyy socklen_t"
21290	esac
21291	yyy="$yyy $sizetype int long unsigned"
21292	for xxx in $yyy; do
21293		case "$socksizetype" in
21294		'')	try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21295			case "$usesocks" in
21296			"$define")
21297				if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21298					echo "Your system accepts '$xxx *' for the last argument of accept()."
21299					socksizetype="$xxx"
21300				fi
21301				;;
21302			*)	if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21303					echo "Your system accepts '$xxx *' for the last argument of accept()."
21304					socksizetype="$xxx"
21305				fi
21306				;;
21307			esac
21308			;;
21309		esac
21310	done
21311: In case none of those worked, prompt the user.
21312	case "$socksizetype" in
21313	'')	rp='What is the type for socket address structure sizes?'
21314		dflt='int'
21315		. ./myread
21316		socksizetype=$ans
21317		;;
21318	esac
21319	;;
21320*)	: no sockets, so pick relatively harmless default
21321	socksizetype='int'
21322	;;
21323esac
21324
21325: see what type is used for signed size_t
21326set ssize_t ssizetype int stdio.h sys/types.h
21327eval $typedef
21328dflt="$ssizetype"
21329$cat > try.c <<EOM
21330#include <stdio.h>
21331#$i_stdlib I_STDLIB
21332#ifdef I_STDLIB
21333#include <stdlib.h>
21334#endif
21335#include <sys/types.h>
21336#define Size_t $sizetype
21337#define SSize_t $dflt
21338int main()
21339{
21340	if (sizeof(Size_t) == sizeof(SSize_t))
21341		printf("$dflt\n");
21342	else if (sizeof(Size_t) == sizeof(int))
21343		printf("int\n");
21344	else
21345		printf("long\n");
21346	exit(0);
21347}
21348EOM
21349echo " "
21350set try
21351if eval $compile_ok && $run ./try > /dev/null; then
21352	ssizetype=`$run ./try`
21353	echo "I'll be using $ssizetype for functions returning a byte count." >&4
21354else
21355	$cat >&4 <<EOM
21356Help! I can't compile and run the ssize_t test program: please enlighten me!
21357(This is probably a misconfiguration in your system or libraries, and
21358you really ought to fix it.  Still, I'll try anyway.)
21359
21360I need a type that is the same size as $sizetype, but is guaranteed to
21361be signed.  Common values are ssize_t, int and long.
21362
21363EOM
21364	rp="What signed type is the same size as $sizetype?"
21365	. ./myread
21366	ssizetype="$ans"
21367fi
21368$rm_try
21369
21370: Check the size of st_ino
21371$echo " "
21372$echo "Checking the size of st_ino..." >&4
21373$cat > try.c <<EOCP
21374#include <sys/stat.h>
21375#include <stdio.h>
21376#$i_stdlib I_STDLIB
21377#ifdef I_STDLIB
21378#include <stdlib.h>
21379#endif
21380int main() {
21381    struct stat st;
21382    printf("%d\n", (int)sizeof(st.st_ino));
21383    exit(0);
21384}
21385EOCP
21386set try
21387if eval $compile_ok; then
21388	val=`$run ./try`
21389	case "$val" in
21390	'')	st_ino_size=4
21391		$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21392		;;
21393	*)	st_ino_size=$val
21394		$echo "Your st_ino is $st_ino_size bytes long."
21395		;;
21396	esac
21397else
21398	st_ino_size=4
21399	$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21400fi
21401$rm_try
21402
21403: Check if st_ino is signed
21404$echo " "
21405$echo "Checking the sign of st_ino..." >&4
21406$cat > try.c <<EOCP
21407#include <sys/stat.h>
21408#include <stdio.h>
21409int main() {
21410	struct stat foo;
21411        foo.st_ino = -1;
21412	if (foo.st_ino < 0)
21413		printf("-1\n");
21414	else
21415		printf("1\n");
21416}
21417EOCP
21418set try
21419if eval $compile; then
21420	val=`$run ./try`
21421	case "$val" in
21422	'')	st_ino_sign=1
21423		$echo "(I can't execute the test program--guessing unsigned.)" >&4
21424		;;
21425	*)	st_ino_sign=$val
21426		case "$st_ino_sign" in
21427		 1) $echo "Your st_ino is unsigned." ;;
21428		-1) $echo "Your st_ino is signed."   ;;
21429		esac
21430		;;
21431	esac
21432else
21433	st_ino_sign=1
21434	$echo "(I can't compile the test program--guessing unsigned.)" >&4
21435fi
21436$rm_try
21437
21438: see what type of char stdio uses.
21439echo " "
21440echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21441if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21442	echo "Your stdio uses unsigned chars." >&4
21443	stdchar="unsigned char"
21444else
21445	echo "Your stdio uses signed chars." >&4
21446	stdchar="char"
21447fi
21448$rm -f stdioh
21449
21450: see what type uids are declared as in the kernel
21451echo " "
21452echo "Looking for the type for user ids returned by getuid()."
21453set uid_t uidtype xxx stdio.h sys/types.h
21454eval $typedef
21455case "$uidtype" in
21456xxx)
21457	xxx=`./findhdr sys/user.h`
21458	set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21459	case $1 in
21460	unsigned) dflt="$1 $2" ;;
21461	*) dflt="$1" ;;
21462	esac
21463	;;
21464*) dflt="$uidtype";;
21465esac
21466case "$uidtype" in
21467uid_t)	echo "uid_t found." ;;
21468*)	rp="What is the type for user ids returned by getuid()?"
21469	. ./myread
21470	uidtype="$ans"
21471	;;
21472esac
21473
21474: Check size of UID
21475echo " "
21476case "$uidtype" in
21477*_t) zzz="$uidtype"	;;
21478*)   zzz="uid"		;;
21479esac
21480echo "Checking the size of $zzz..." >&4
21481cat > try.c <<EOCP
21482#include <sys/types.h>
21483#include <stdio.h>
21484#$i_stdlib I_STDLIB
21485#ifdef I_STDLIB
21486#include <stdlib.h>
21487#endif
21488int main() {
21489    printf("%d\n", (int)sizeof($uidtype));
21490    exit(0);
21491}
21492EOCP
21493set try
21494if eval $compile_ok; then
21495	yyy=`$run ./try`
21496	case "$yyy" in
21497	'')	uidsize=4
21498		echo "(I can't execute the test program--guessing $uidsize.)" >&4
21499		;;
21500	*)	uidsize=$yyy
21501		echo "Your $zzz is $uidsize bytes long."
21502		;;
21503	esac
21504else
21505	uidsize=4
21506	echo "(I can't compile the test program--guessing $uidsize.)" >&4
21507fi
21508
21509: Check if UID is signed
21510echo " "
21511case "$uidtype" in
21512*_t) zzz="$uidtype"	;;
21513*)   zzz="uid"		;;
21514esac
21515echo "Checking the sign of $zzz..." >&4
21516cat > try.c <<EOCP
21517#include <sys/types.h>
21518#include <stdio.h>
21519int main() {
21520	$uidtype foo = -1;
21521	if (foo < 0)
21522		printf("-1\n");
21523	else
21524		printf("1\n");
21525}
21526EOCP
21527set try
21528if eval $compile; then
21529	yyy=`$run ./try`
21530	case "$yyy" in
21531	'')	uidsign=1
21532		echo "(I can't execute the test program--guessing unsigned.)" >&4
21533		;;
21534	*)	uidsign=$yyy
21535		case "$uidsign" in
21536		 1) echo "Your $zzz is unsigned." ;;
21537		-1) echo "Your $zzz is signed."   ;;
21538		esac
21539		;;
21540	esac
21541else
21542	uidsign=1
21543	echo "(I can't compile the test program--guessing unsigned.)" >&4
21544fi
21545
21546
21547: Check format string for UID
21548echo " "
21549$echo "Checking the format string to be used for uids..." >&4
21550
21551case "$uidsign" in
21552-1)	if $test X"$uidsize" = X"$ivsize"; then
21553		uidformat="$ivdformat"
21554	else
21555		if $test X"$uidsize" = X"$longsize"; then
21556			uidformat='"ld"'
21557		else
21558			if $test X"$uidsize" = X"$intsize"; then
21559				uidformat='"d"'
21560			else
21561				if $test X"$uidsize" = X"$shortsize"; then
21562					uidformat='"hd"'
21563				fi
21564			fi
21565		fi
21566	fi
21567	;;
21568*)	if $test X"$uidsize" = X"$uvsize"; then
21569		uidformat="$uvuformat"
21570	else
21571		if $test X"$uidsize" = X"$longsize"; then
21572			uidformat='"lu"'
21573		else
21574			if $test X"$uidsize" = X"$intsize"; then
21575				uidformat='"u"'
21576			else
21577				if $test X"$uidsize" = X"$shortsize"; then
21578					uidformat='"hu"'
21579				fi
21580			fi
21581		fi
21582	fi
21583	;;
21584esac
21585
21586: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21587echo " "
21588echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21589$cat >try.c <<'EOM'
21590/* Intentionally a long probe as I'd like to sanity check that the exact
21591   approach is going to work, as thinking it will work, but only having it
21592   part working at runtime is worse than not having it.  */
21593
21594#include <sys/types.h>
21595#include <sys/sysctl.h>
21596#include <sys/param.h>
21597#include <stdio.h>
21598#include <string.h>
21599#include <stdlib.h>
21600#include <unistd.h>
21601
21602int
21603main(int argc, char **argv) {
21604    char *buffer;
21605    char *argv_leaf = strrchr(argv[0], '/');
21606    char *buffer_leaf;
21607    size_t size = 0;
21608    int mib[4];
21609
21610    mib[0] = CTL_KERN;
21611    mib[1] = KERN_PROC;
21612    mib[2] = KERN_PROC_PATHNAME;
21613    mib[3] = -1;
21614
21615    if (!argv_leaf) {
21616	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21617	return 1;
21618    }
21619
21620    if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21621	perror("sysctl");
21622	return 2;
21623    }
21624
21625    if (size < strlen(argv_leaf) + 1) {
21626	fprintf(stderr, "size %lu is too short for a path\n",
21627		(unsigned long) size);
21628	return 3;
21629    }
21630
21631    if (size > MAXPATHLEN * MAXPATHLEN) {
21632	fprintf(stderr, "size %lu is too long for a path\n",
21633		(unsigned long) size);
21634	return 4;
21635    }
21636
21637    buffer = malloc(size);
21638    if (!buffer) {
21639	perror("malloc");
21640	return 5;
21641    }
21642
21643    if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21644	perror("sysctl");
21645	return 6;
21646    }
21647
21648    if (strlen(buffer) + 1 != size) {
21649	fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21650		(unsigned long)size, (unsigned long)strlen(buffer) + 1);
21651        return 7;
21652    }
21653
21654
21655    if (*buffer != '/') {
21656	fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21657	return 8;
21658    }
21659
21660    if (strstr(buffer, "/./")) {
21661	fprintf(stderr, "Contains /./: '%s'\n", buffer);
21662	return 9;
21663    }
21664
21665    if (strstr(buffer, "/../")) {
21666	fprintf(stderr, "Contains /../: '%s'\n", buffer);
21667	return 10;
21668    }
21669
21670    buffer_leaf = strrchr(buffer, '/');
21671    if (strcmp(buffer_leaf, argv_leaf) != 0) {
21672	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21673	return 11;
21674    }
21675
21676    free(buffer);
21677
21678    return 0;
21679}
21680EOM
21681
21682val=$undef
21683set try
21684if eval $compile; then
21685	if $run ./try; then
21686		echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21687		val="$define"
21688	else
21689		echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21690		val="$undef"
21691	fi
21692else
21693	echo "I'm unable to compile the test program." >&4
21694	echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21695	val="$undef"
21696fi
21697$rm_try
21698set usekernprocpathname
21699eval $setvar
21700
21701: Determine if we can use _NSGetExecutablePath to find executing program
21702echo " "
21703echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21704$cat >try.c <<'EOM'
21705/* Intentionally a long probe as I'd like to sanity check that the exact
21706   approach is going to work, as thinking it will work, but only having it
21707   part working at runtime is worse than not having it.  */
21708#include <mach-o/dyld.h>
21709#include <stdio.h>
21710#include <stdlib.h>
21711#include <sys/param.h>
21712#include <string.h>
21713
21714int
21715main(int argc, char **argv) {
21716    char buf[1];
21717    uint32_t size = sizeof(buf);
21718    int result;
21719    char *buffer;
21720    char *tidied;
21721    char *argv_leaf = strrchr(argv[0], '/');
21722    char *tidied_leaf;
21723
21724    if (!argv_leaf) {
21725	fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21726	return 1;
21727    }
21728
21729    _NSGetExecutablePath(buf, &size);
21730    if (size > MAXPATHLEN * MAXPATHLEN) {
21731	fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21732		(unsigned int) size);
21733	return 2;
21734    }
21735
21736    buffer = malloc(size);
21737    if (!buffer) {
21738	perror("malloc");
21739	return 3;
21740    }
21741
21742    result = _NSGetExecutablePath(buffer, &size);
21743    if (result != 0) {
21744	fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21745		result, (unsigned int) size);
21746	return 4;
21747    }
21748
21749    tidied = realpath(buffer, NULL);
21750    if (!tidied) {
21751	perror("realpath");
21752	return 5;
21753    }
21754
21755    free(buffer);
21756
21757    if (*tidied != '/') {
21758	fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21759	return 6;
21760    }
21761
21762    if (strstr(tidied, "/./")) {
21763	fprintf(stderr, "Contains /./: '%s'\n", tidied);
21764	return 7;
21765    }
21766
21767    if (strstr(tidied, "/../")) {
21768	fprintf(stderr, "Contains /../: '%s'\n", tidied);
21769	return 8;
21770    }
21771
21772    tidied_leaf = strrchr(tidied, '/');
21773    if (strcmp(tidied_leaf, argv_leaf) != 0) {
21774	fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21775	return 9;
21776    }
21777
21778    free(tidied);
21779
21780    return 0;
21781}
21782EOM
21783
21784val=$undef
21785set try
21786if eval $compile; then
21787	if $run ./try; then
21788		echo "You can use _NSGetExecutablePath to find the executing program." >&4
21789		val="$define"
21790	else
21791		echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21792	fi
21793else
21794	echo "I'm unable to compile the test program." >&4
21795	echo "I'll assume no _NSGetExecutablePath here." >&4
21796fi
21797$rm_try
21798set usensgetexecutablepath
21799eval $setvar
21800
21801: Check if site customization support was requested
21802case "$usesitecustomize" in
21803    $define|true|[Yy]*)
21804	usesitecustomize="$define"
21805	;;
21806    *)
21807	usesitecustomize="$undef"
21808	;;
21809    esac
21810
21811: see if prototypes support variable argument declarations
21812echo " "
21813case "$prototype$i_stdarg" in
21814$define$define)
21815	echo "It appears we'll be able to prototype varargs functions." >&4
21816	val="$define"
21817	;;
21818*)
21819	echo "Too bad... We won't be using prototyped varargs functions..." >&4
21820	val="$undef"
21821	;;
21822esac
21823set vaproto
21824eval $setvar
21825
21826: determine compiler compiler
21827case "$yacc" in
21828'')
21829	dflt=yacc;;
21830*)
21831	dflt="$yacc";;
21832esac
21833echo " "
21834comp='yacc'
21835if $test -f "$byacc$_exe"; then
21836	dflt="$byacc"
21837	comp="byacc or $comp"
21838fi
21839if $test -f "$bison$_exe"; then
21840	comp="$comp or bison -y"
21841fi
21842rp="Which compiler compiler ($comp) shall I use?"
21843. ./myread
21844yacc="$ans"
21845case "$yacc" in
21846*bis*)
21847	case "$yacc" in
21848	*-y*) ;;
21849	*)
21850		yacc="$yacc -y"
21851		echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21852		;;
21853	esac
21854	;;
21855esac
21856
21857: see if this is a assert.h system
21858set assert.h i_assert
21859eval $inhdr
21860
21861: see if this is a fp.h system
21862set fp.h i_fp
21863eval $inhdr
21864
21865: see if this is a fp_class.h system
21866set fp_class.h i_fp_class
21867eval $inhdr
21868
21869: see if gdbm.h is available
21870set gdbm.h t_gdbm
21871eval $inhdr
21872case "$t_gdbm" in
21873$define)
21874	: see if gdbm_open exists
21875	set gdbm_open d_gdbm_open
21876	eval $inlibc
21877	case "$d_gdbm_open" in
21878	$undef)
21879		t_gdbm="$undef"
21880		echo "We won't be including <gdbm.h>"
21881		;;
21882	esac
21883	;;
21884esac
21885val="$t_gdbm"
21886set i_gdbm
21887eval $setvar
21888
21889: see if this is a ieeefp.h system
21890case "$i_ieeefp" in
21891'' ) set ieeefp.h i_ieeefp
21892     eval $inhdr
21893     ;;
21894esac
21895
21896: see if this is a libutil.h system
21897set libutil.h i_libutil
21898eval $inhdr
21899
21900: see if mach cthreads are available
21901if test "X$usethreads" = "X$define"; then
21902	set mach/cthreads.h i_machcthr
21903	eval $inhdr
21904else
21905	i_machcthr="$undef"
21906fi
21907
21908: see if this is a mntent.h system
21909set mntent.h i_mntent
21910eval $inhdr
21911
21912: see if net/errno.h is available
21913val=''
21914set net/errno.h val
21915eval $inhdr
21916
21917: Unfortunately, it causes problems on some systems.  Arrgh.
21918case "$val" in
21919$define)
21920	cat > try.c <<'EOM'
21921#include <stdio.h>
21922#include <errno.h>
21923#include <net/errno.h>
21924int func()
21925{
21926	return ENOTSOCK;
21927}
21928EOM
21929	if $cc $ccflags -c try.c >/dev/null 2>&1; then
21930		echo "We'll be including <net/errno.h>." >&4
21931	else
21932		echo "We won't be including <net/errno.h>." >&4
21933		val="$undef"
21934	fi
21935	$rm_try
21936	;;
21937esac
21938set i_neterrno
21939eval $setvar
21940
21941: see if netinet/tcp.h is available
21942set netinet/tcp.h i_netinettcp
21943eval $inhdr
21944
21945: see if this is a poll.h system
21946set poll.h i_poll
21947eval $inhdr
21948
21949: see if this is a prot.h system
21950set prot.h i_prot
21951eval $inhdr
21952
21953: Preprocessor symbols
21954echo " "
21955$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21956$cat <<'EOSH' > Cppsym.know
21957a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21958AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21959alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21960ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21961BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21962BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21963bull c cadmus clipper CMU COFF COMPILER_VERSION
21964concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21965CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21966Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21967FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21968GLIBC GLIBC_MINOR
21969GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21970H3050R H3050RX hbullx20 hcx host_mips
21971hp200 hp300 hp700 HP700 hp800 hp9000
21972hp9000s200 hp9000s300 hp9000s400 hp9000s500
21973hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21974i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21975IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21976INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21977LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21978LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21979LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21980LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21981M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21982M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21983M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21984MATH_HAS_NO_SIDE_EFFECTS
21985mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21986mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21987mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21988MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21989mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21990NetBSD news1500 news1700 news1800 news1900 news3700
21991news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21992ns32016 ns32332 ns32k nsc32000
21993OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21994pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21995pc532 pdp11 PGC PIC plexus PORTAR posix
21996POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21997POSIX_C_SOURCE POSIX_SOURCE POWER
21998PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21999riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
22000SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22001sony sony_news sonyrisc sparc sparclite spectrum
22002stardent stdc STDC_EXT stratos sun sun3 sun386
22003Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22004SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22005SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22006sysV68 sysV88 Tek4132 Tek4300 titan
22007TM3200 TM5400 TM5600
22008tower tower32 tower32_200 tower32_600 tower32_700
22009tower32_800 tower32_850 tss
22010u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22011ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22012unix UNIX95 UNIX99 unixpc unos
22013USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22014USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22015USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22016USGr4 USGr4_2
22017Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22018XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22019XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22020z8000
22021EOSH
22022# Maybe put other stuff here too.
22023cat <<EOSH >>Cppsym.know
22024$osname
22025EOSH
22026./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22027./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22028$cat Cppsym.know > Cppsym.c
22029$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22030$rm -f Cppsym.a Cppsym.b Cppsym.c
22031cat <<EOSH > Cppsym
22032$startsh
22033if $test \$# -gt 0; then
22034    echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22035    if $test -s Cppsym.got; then
22036        $rm -f Cppsym.got
22037        exit 0
22038    fi
22039    $rm -f Cppsym.got
22040    exit 1
22041else
22042    $tr " " "$trnl" | ./Cppsym.try
22043    exit 0
22044fi
22045EOSH
22046chmod +x Cppsym
22047$eunicefix Cppsym
22048cat <<EOSH > Cppsym.try
22049$startsh
22050cat <<'EOCP' > try.c
22051#include <stdio.h>
22052#if cpp_stuff == 1
22053#define STRINGIFY(a)    "a"
22054#endif
22055#if cpp_stuff == 42
22056#define StGiFy(a)  #a
22057#define STRINGIFY(a)    StGiFy(a)
22058#endif
22059#if $cpp_stuff != 1 && $cpp_stuff != 42
22060#   include "Bletch: How does this C preprocessor stringify macros?"
22061#endif
22062int main() {
22063EOCP
22064$awk \\
22065EOSH
22066cat <<'EOSH' >> Cppsym.try
22067'length($1) > 0 {
22068    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22069    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22070    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22071    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22072}'	 >> try.c
22073echo 'return 0;}' >> try.c
22074EOSH
22075cat <<EOSH >> Cppsym.try
22076ccflags="$ccflags"
22077case "$osname-$gccversion" in
22078irix-) ccflags="\$ccflags -woff 1178" ;;
22079os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22080esac
22081$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22082EOSH
22083chmod +x Cppsym.try
22084$eunicefix Cppsym.try
22085./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22086: Add in any Linux cpp "predefined macros":
22087case "$osname::$gccversion" in
22088  *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22089    tHdrH=_tmpHdr
22090    rm -f $tHdrH'.h' $tHdrH
22091    touch $tHdrH'.h'
22092    # Filter out macro arguments, such as Linux's __INT8_C(c)
22093    if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22094       sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22095       if [ -s $tHdrH'_cppsym.real' ]; then
22096	  cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22097       fi
22098    fi
22099    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22100  ;;
22101esac
22102: now check the C compiler for additional symbols
22103postprocess_cc_v=''
22104case "$osname" in
22105aix) postprocess_cc_v="|$tr , ' '" ;;
22106esac
22107$cat >ccsym <<EOS
22108$startsh
22109$cat >tmp.c <<EOF
22110extern int foo;
22111EOF
22112for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22113do
22114	case "\$i" in
22115	-D*) echo "\$i" | $sed 's/^-D//';;
22116	-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22117	esac
22118done
22119$rm_try
22120EOS
22121postprocess_cc_v=''
22122chmod +x ccsym
22123$eunicefix ccsym
22124./ccsym > ccsym1.raw
22125if $test -s ccsym1.raw; then
22126       $sort ccsym1.raw | $uniq >ccsym.raw
22127else
22128       mv ccsym1.raw ccsym.raw
22129fi
22130
22131$awk '/\=/ { print $0; next }
22132	{ print $0"=1" }' ccsym.raw >ccsym.list
22133$comm -13 Cppsym.true ccsym.list >ccsym.own
22134$comm -12 Cppsym.true ccsym.list >ccsym.com
22135$comm -23 Cppsym.true ccsym.list >ccsym.cpp
22136also=''
22137if $test -z ccsym.raw; then
22138	echo "Your C compiler doesn't seem to define any symbols!" >&4
22139	echo " "
22140	echo "However, your C preprocessor defines the following symbols:"
22141	$cat Cppsym.true
22142    	ccsymbols=''
22143	cppsymbols=`$cat Cppsym.true`
22144        cppsymbols=`echo $cppsymbols`
22145	cppccsymbols="$cppsymbols"
22146else
22147	if $test -s ccsym.com; then
22148		echo "Your C compiler and pre-processor define these symbols:"
22149		$sed -e 's/\(..*\)=.*/\1/' ccsym.com
22150		also='also '
22151		symbols='ones'
22152		cppccsymbols=`$cat ccsym.com`
22153		cppccsymbols=`echo $cppccsymbols`
22154		$test "$silent" || sleep 1
22155	fi
22156	if $test -s ccsym.cpp; then
22157		$test "$also" && echo " "
22158		echo "Your C pre-processor ${also}defines the following symbols:"
22159		$sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22160		also='further '
22161		cppsymbols=`$cat ccsym.cpp`
22162		cppsymbols=`echo $cppsymbols`
22163		$test "$silent" || sleep 1
22164	fi
22165	if $test -s ccsym.own; then
22166		$test "$also" && echo " "
22167		echo "Your C compiler ${also}defines the following cpp symbols:"
22168		$sed -e 's/\(..*\)=1/\1/' ccsym.own
22169		$sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22170	        ccsymbols=`$cat ccsym.own`
22171	        ccsymbols=`echo $ccsymbols`
22172		$test "$silent" || sleep 1
22173	fi
22174fi
22175
22176: see if this is a termio system
22177val="$undef"
22178val2="$undef"
22179val3="$undef"
22180if $test `./findhdr termios.h`; then
22181	set tcsetattr i_termios
22182	eval $inlibc
22183	val3="$i_termios"
22184fi
22185echo " "
22186case "$val3" in
22187"$define") echo "You have POSIX termios.h... good!" >&4;;
22188*) if ./Cppsym pyr; then
22189		case "`/bin/universe`" in
22190		ucb) if $test `./findhdr sgtty.h`; then
22191				val2="$define"
22192				echo "<sgtty.h> found." >&4
22193			else
22194				echo "System is pyramid with BSD universe."
22195				./warn "<sgtty.h> not found--you could have problems."
22196			fi;;
22197		*) if $test `./findhdr termio.h`; then
22198				val="$define"
22199				echo "<termio.h> found." >&4
22200			else
22201				echo "System is pyramid with USG universe."
22202				./warn "<termio.h> not found--you could have problems."
22203			fi;;
22204		esac
22205	elif ./usg; then
22206		if $test `./findhdr termio.h`; then
22207			echo "<termio.h> found." >&4
22208			val="$define"
22209		elif $test `./findhdr sgtty.h`; then
22210			echo "<sgtty.h> found." >&4
22211			val2="$define"
22212		else
22213			./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22214		fi
22215	else
22216		if $test `./findhdr sgtty.h`; then
22217			echo "<sgtty.h> found." >&4
22218			val2="$define"
22219		elif $test `./findhdr termio.h`; then
22220			echo "<termio.h> found." >&4
22221			val="$define"
22222		else
22223			./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22224		fi
22225	fi;;
22226esac
22227set i_termio; eval $setvar
22228val=$val2; set i_sgtty; eval $setvar
22229val=$val3; set i_termios; eval $setvar
22230
22231: see if stdbool is available
22232: we want a real compile instead of Inhdr because some Solaris systems
22233: have stdbool.h, but it can only be used if the compiler indicates it
22234: is sufficiently c99-compliant.
22235echo " "
22236$cat >try.c <<EOCP
22237#include <stdio.h>
22238#include <stdbool.h>
22239int func(bool x)
22240{
22241    return x ? 1 : 0;
22242}
22243int main(int argc, char **argv)
22244{
22245    return func(0);
22246}
22247EOCP
22248set try
22249if eval $compile; then
22250	echo "<stdbool.h> found." >&4
22251	val="$define"
22252else
22253	echo "<stdbool.h> NOT found." >&4
22254	val="$undef"
22255fi
22256$rm_try
22257set i_stdbool
22258eval $setvar
22259
22260: see if stddef is available
22261set stddef.h i_stddef
22262eval $inhdr
22263
22264: see if sys/access.h is available
22265set sys/access.h i_sysaccess
22266eval $inhdr
22267
22268: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22269set sys/filio.h i_sysfilio
22270eval $inhdr
22271echo " "
22272if $test `./findhdr sys/ioctl.h`; then
22273	val="$define"
22274	echo '<sys/ioctl.h> found.' >&4
22275else
22276	val="$undef"
22277	if $test $i_sysfilio = "$define"; then
22278	    echo '<sys/ioctl.h> NOT found.' >&4
22279	else
22280		$test $i_sgtty = "$define" && xxx="sgtty.h"
22281		$test $i_termio = "$define" && xxx="termio.h"
22282		$test $i_termios = "$define" && xxx="termios.h"
22283echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22284	fi
22285fi
22286set i_sysioctl
22287eval $setvar
22288
22289: see if socket ioctl defs are in sys/sockio.h
22290echo " "
22291xxx=`./findhdr sys/sockio.h`
22292if $test "$xxx"; then
22293	if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22294		val="$define"
22295		echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22296	else
22297		val="$undef"
22298		echo "No socket ioctls found in <sys/sockio.h>." >&4
22299	fi
22300else
22301	val="$undef"
22302	$cat <<EOM
22303<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22304EOM
22305fi
22306set i_syssockio
22307eval $setvar
22308
22309: see if this is a syslog.h system
22310set syslog.h i_syslog
22311eval $inhdr
22312
22313: see if this is a sys/mode.h system
22314set sys/mode.h i_sysmode
22315eval $inhdr
22316
22317: see if there is a sys/poll.h file
22318set sys/poll.h i_syspoll
22319eval $inhdr
22320
22321: see if sys/resource.h has to be included
22322set sys/resource.h i_sysresrc
22323eval $inhdr
22324
22325: see if sys/security.h is available
22326set sys/security.h i_syssecrt
22327eval $inhdr
22328
22329: see if this is a sys/statvfs.h system
22330set sys/statvfs.h i_sysstatvfs
22331eval $inhdr
22332
22333: see if this is a sys/un.h system
22334set sys/un.h i_sysun
22335eval $inhdr
22336
22337: see if this is a sys/utsname.h system
22338set sys/utsname.h i_sysutsname
22339eval $inhdr
22340
22341: see if this is a syswait system
22342set sys/wait.h i_syswait
22343eval $inhdr
22344
22345: see if this is a ustat.h system
22346set ustat.h i_ustat
22347eval $inhdr
22348
22349: see if this is an utime system
22350set utime.h i_utime
22351eval $inhdr
22352
22353: see if this is a vfork system
22354case "$d_vfork" in
22355"$define")
22356	set vfork.h i_vfork
22357	eval $inhdr
22358	;;
22359*)
22360	i_vfork="$undef"
22361	;;
22362esac
22363
22364: Check extensions
22365echo " "
22366echo "Looking for extensions..." >&4
22367: If we are using the old config.sh, known_extensions may contain
22368: old or inaccurate or duplicate values.
22369known_extensions=''
22370nonxs_extensions=''
22371: We do not use find because it might not be available.
22372: We do not just use MANIFEST because the user may have dropped
22373: some additional extensions into the source tree and expect them
22374: to be built.
22375
22376: Function to recursively find available extensions, ignoring DynaLoader
22377: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22378: In 5.10.1 and later, extensions are stored in directories
22379: like File-Glob instead of the older File/Glob/.
22380find_extensions='
22381    for xxx in *; do
22382	case "$xxx" in
22383	    CVS) ;;
22384	    DynaLoader|dynaload) ;;
22385	    *)
22386	    this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22387	    leaf=`echo $xxx | $sed -e s/.*-//`;
22388	    if $test -d File; then
22389		if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22390		    known_extensions="$known_extensions $1$this_ext";
22391		elif $test -f $xxx/Makefile.PL; then
22392		    nonxs_extensions="$nonxs_extensions $1$this_ext";
22393		else
22394		    if $test -d $xxx -a $# -lt 10; then
22395			set $1$xxx/ $*;
22396			cd "$xxx";
22397			eval $find_extensions;
22398			cd ..;
22399			shift;
22400		    fi;
22401		fi;
22402	    else
22403		echo " $known_extensions $nonxs_extensions" > $tdir/$$.tmp;
22404		if $contains " $this_ext " $tdir/$$.tmp; then
22405		    echo >&4;
22406		    echo "Duplicate directories detected for extension $xxx" >&4;
22407		    echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22408		    case "$knowitall" in
22409		    "") dflt=y;;
22410		    *) dflt=n;;
22411		    esac;
22412		    . ../UU/myread;
22413		    case "$ans" in
22414		    n*|N*) ;;
22415		    *) echo >&4;
22416		       echo "Ok.  Stopping Configure." >&4;
22417		       echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22418			exit 1;;
22419		    esac;
22420		    echo "Ok.  You will need to correct config.sh before running make." >&4;
22421		fi;
22422		$ls -1 $xxx > $tdir/$$.tmp;
22423		if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22424		    known_extensions="$known_extensions $this_ext";
22425		elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22426		    known_extensions="$known_extensions $this_ext";
22427		elif $test -d $xxx; then
22428		    nonxs_extensions="$nonxs_extensions $this_ext";
22429		fi;
22430		$rm -f $tdir/$$.tmp;
22431	    fi
22432	    ;;
22433	esac;
22434    done'
22435tdir=`pwd`
22436cd "$rsrc/cpan"
22437set X
22438shift
22439eval $find_extensions
22440cd "$rsrc/dist"
22441set X
22442shift
22443eval $find_extensions
22444cd "$rsrc/ext"
22445set X
22446shift
22447eval $find_extensions
22448if $test -d File-Glob; then
22449    : All ext/ flattened
22450else
22451    # Special case:  Add in modules that nest beyond the first level.
22452    # Currently threads/shared and Hash/Util/FieldHash, since they are
22453    # not picked up by the recursive find above (and adding in general
22454    # recursive finding breaks SDBM_File/sdbm).
22455    # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22456    known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22457fi
22458set X $known_extensions
22459shift
22460known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22461set X $nonxs_extensions
22462shift
22463nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22464cd "$tdir"
22465
22466: Now see which are supported on this system.
22467avail_ext=''
22468for xxx in $known_extensions ; do
22469	case "$xxx" in
22470	DB_File|db_file)
22471		case "$i_db" in
22472		$define) avail_ext="$avail_ext $xxx" ;;
22473		esac
22474		;;
22475	GDBM_File|gdbm_fil)
22476		case "$i_gdbm" in
22477		$define) avail_ext="$avail_ext $xxx" ;;
22478		esac
22479		;;
22480	I18N/Langinfo|i18n_lan)
22481		case "$i_langinfo$d_nl_langinfo" in
22482		$define$define) avail_ext="$avail_ext $xxx" ;;
22483		esac
22484		;;
22485	IPC/SysV|ipc/sysv)
22486		: XXX Do we need a useipcsysv variable here
22487		case "${d_msg}${d_sem}${d_shm}" in
22488		*"${define}"*) avail_ext="$avail_ext $xxx" ;;
22489		esac
22490		;;
22491	NDBM_File|ndbm_fil)
22492		case "$d_ndbm" in
22493		$define)
22494		    case "$osname-$use64bitint" in
22495		    hpux-define)
22496			case "$libs" in
22497			*-lndbm*) avail_ext="$avail_ext $xxx" ;;
22498			esac
22499			;;
22500		    *) avail_ext="$avail_ext $xxx" ;;
22501		    esac
22502		    ;;
22503		esac
22504		;;
22505	ODBM_File|odbm_fil)
22506		case "${i_dbm}${i_rpcsvcdbm}" in
22507		*"${define}"*)
22508		    case "$d_cplusplus" in
22509		    define) ;; # delete as a function name will not work
22510		    *)  case "$osname-$use64bitint" in
22511			hpux-define)
22512			    case "$libs" in
22513			    *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22514			    esac
22515			    ;;
22516			*) avail_ext="$avail_ext $xxx" ;;
22517			esac
22518			;;
22519		    esac
22520		    ;;
22521		esac
22522		;;
22523	Opcode|opcode)
22524		case "$useopcode" in
22525		true|define|y) avail_ext="$avail_ext $xxx" ;;
22526		esac
22527		;;
22528	POSIX|posix)
22529		case "$useposix" in
22530		true|define|y) avail_ext="$avail_ext $xxx" ;;
22531		esac
22532		;;
22533	Socket|socket)
22534		case "$d_socket" in
22535		true|$define|y) avail_ext="$avail_ext $xxx" ;;
22536		esac
22537		;;
22538	Sys/Syslog|sys/syslog)
22539		: XXX syslog requires socket
22540		case "$d_socket" in
22541		true|$define|y) avail_ext="$avail_ext $xxx" ;;
22542		esac
22543		;;
22544	Thread|thread)
22545                case "$usethreads" in
22546                true|$define|y)
22547                        case "$use5005threads" in
22548                        $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22549                        esac
22550		esac
22551		;;
22552	threads|threads/shared)
22553		# threads and threads::shared are special cases.
22554		# To stop people from asking "Perl 5.8.0 was supposed
22555		# to have this new fancy threads implementation but my
22556		# perl doesn't have it" and from people trying to
22557		# (re)install the threads module using CPAN.pm and
22558		# CPAN.pm then offering to reinstall Perl 5.8.0,
22559		# the threads.pm and threads/shared.pm will always be
22560		# there, croaking informatively ("you need to rebuild
22561		# all of Perl with threads, sorry") when threads haven't
22562		# been compiled in.
22563		# --jhi
22564		avail_ext="$avail_ext $xxx"
22565		;;
22566	VMS*)
22567		;;
22568	Win32*)
22569		case "$osname" in
22570		cygwin) avail_ext="$avail_ext $xxx" ;;
22571		esac
22572		;;
22573	XS/APItest|xs/apitest)
22574		# This is just for testing.  Skip it unless we have dynamic loading.
22575
22576		case "$usedl" in
22577		$define) avail_ext="$avail_ext $xxx" ;;
22578		esac
22579		;;
22580	XS/Typemap|xs/typemap)
22581		# This is just for testing.  Skip it unless we have dynamic loading.
22582		case "$usedl" in
22583		$define) avail_ext="$avail_ext $xxx" ;;
22584		esac
22585		;;
22586	*)	avail_ext="$avail_ext $xxx"
22587		;;
22588	esac
22589done
22590
22591set X $avail_ext
22592shift
22593avail_ext="$*"
22594
22595case "$onlyextensions" in
22596'') ;;
22597*)  keepextensions=''
22598    echo "You have requested that only certain extensions be included..." >&4
22599    for i in $onlyextensions; do
22600        case " $avail_ext " in
22601        *" $i "*)
22602            echo "Keeping extension $i."
22603            keepextensions="$keepextensions $i"
22604            ;;
22605        *) echo "Ignoring extension $i." ;;
22606        esac
22607    done
22608    avail_ext="$keepextensions"
22609    ;;
22610esac
22611
22612case "$noextensions" in
22613'') ;;
22614*)  keepextensions=''
22615    echo "You have requested that certain extensions be ignored..." >&4
22616    for i in $avail_ext; do
22617        case " $noextensions " in
22618        *" $i "*) echo "Ignoring extension $i." ;;
22619        *) echo "Keeping extension $i.";
22620           keepextensions="$keepextensions $i"
22621           ;;
22622        esac
22623    done
22624    avail_ext="$keepextensions"
22625    ;;
22626esac
22627
22628: Now see which nonxs extensions are supported on this system.
22629: For now assume all are.
22630nonxs_ext=''
22631for xxx in $nonxs_extensions ; do
22632	case "$xxx" in
22633	CVS|RCS|SCCS|.svn)
22634		;;
22635	*)	nonxs_ext="$nonxs_ext $xxx"
22636		;;
22637	esac
22638done
22639
22640set X $nonxs_ext
22641shift
22642nonxs_ext="$*"
22643
22644case $usedl in
22645$define)
22646	$cat <<EOM
22647A number of extensions are supplied with $package.  You may choose to
22648compile these extensions for dynamic loading (the default), compile
22649them into the $package executable (static loading), or not include
22650them at all.  Answer "none" to include no extensions.
22651Note that DynaLoader is always built and need not be mentioned here.
22652
22653EOM
22654	case "$dynamic_ext" in
22655	'')
22656		: Exclude those listed in static_ext
22657		dflt=''
22658		for xxx in $avail_ext; do
22659			case " $static_ext " in
22660			*" $xxx "*) ;;
22661			*) dflt="$dflt $xxx" ;;
22662			esac
22663		done
22664		set X $dflt
22665		shift
22666		dflt="$*"
22667		;;
22668	*)	dflt="$dynamic_ext"
22669		# Perhaps we are reusing an old out-of-date config.sh.
22670		case "$hint" in
22671		previous)
22672			if test X"$dynamic_ext" != X"$avail_ext"; then
22673				$cat <<EOM
22674NOTICE:  Your previous config.sh list may be incorrect.
22675The extensions now available to you are
22676	${avail_ext}
22677but the default list from your previous config.sh is
22678	${dynamic_ext}
22679
22680EOM
22681			fi
22682			;;
22683		esac
22684		;;
22685	esac
22686	case "$dflt" in
22687	'')	dflt=none;;
22688	esac
22689	rp="What extensions do you wish to load dynamically?"
22690	. ./myread
22691	case "$ans" in
22692	none) dynamic_ext=' ' ;;
22693	*) dynamic_ext="$ans" ;;
22694	esac
22695
22696	case "$static_ext" in
22697	'')
22698		: Exclude those already listed in dynamic linking
22699		dflt=''
22700		for xxx in $avail_ext; do
22701			case " $dynamic_ext " in
22702			*" $xxx "*) ;;
22703			*) dflt="$dflt $xxx" ;;
22704			esac
22705		done
22706		set X $dflt
22707		shift
22708		dflt="$*"
22709		;;
22710	*)  dflt="$static_ext"
22711		;;
22712	esac
22713
22714	case "$dflt" in
22715	'')	dflt=none;;
22716	esac
22717	rp="What extensions do you wish to load statically?"
22718	. ./myread
22719	case "$ans" in
22720	none) static_ext=' ' ;;
22721	*) static_ext="$ans" ;;
22722	esac
22723	;;
22724*)
22725	$cat <<EOM
22726A number of extensions are supplied with $package.  Answer "none"
22727to include no extensions.
22728Note that DynaLoader is always built and need not be mentioned here.
22729
22730EOM
22731	case "$static_ext" in
22732	'') dflt="$avail_ext" ;;
22733	*)	dflt="$static_ext"
22734		# Perhaps we are reusing an old out-of-date config.sh.
22735		case "$hint" in
22736		previous)
22737			if test X"$static_ext" != X"$avail_ext"; then
22738				$cat <<EOM
22739NOTICE:  Your previous config.sh list may be incorrect.
22740The extensions now available to you are
22741	${avail_ext}
22742but the default list from your previous config.sh is
22743	${static_ext}
22744
22745EOM
22746			fi
22747			;;
22748		esac
22749		;;
22750	esac
22751	: Exclude those that are not xs extensions
22752	case "$dflt" in
22753	'')	dflt=none;;
22754	esac
22755	rp="What extensions do you wish to include?"
22756	. ./myread
22757	case "$ans" in
22758	none) static_ext=' ' ;;
22759	*) static_ext="$ans" ;;
22760	esac
22761	;;
22762esac
22763#
22764# Encode is a special case.  If we are building Encode as a static
22765# extension, we need to explicitly list its subextensions as well.
22766# For other nested extensions, this is handled automatically by
22767# the appropriate Makefile.PL.
22768case " $static_ext " in
22769	*" Encode "*) # Add the subextensions of Encode
22770	cd "$rsrc/cpan"
22771	for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22772		static_ext="$static_ext Encode/$xxx"
22773	done
22774	cd "$tdir"
22775	;;
22776esac
22777
22778set X $dynamic_ext $static_ext $nonxs_ext
22779shift
22780extensions="$*"
22781
22782# Sanity check:  We require an extension suitable for use with
22783# AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22784# should show up as failures in the test suite, but it's helpful to
22785# catch them now.) The 'extensions' list is normally sorted
22786# alphabetically, so we need to accept either
22787#    DB_File ... Fcntl ... IO  ....
22788# or something like
22789#    Fcntl ... NDBM_File ... IO  ....
22790case " $extensions"  in
22791*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22792*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22793*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22794*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22795   echo "WARNING: The Perl you are building will be quite crippled." >& 4
22796   ;;
22797esac
22798
22799: Remove libraries needed only for extensions
22800: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22801: The exception is SunOS 4.x, which needs them.
22802case "${osname}X${osvers}" in
22803sunos*X4*)
22804    perllibs="$libs"
22805    ;;
22806*) case "$usedl" in
22807    $define|true|[yY]*)
22808	    set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22809	    shift
22810	    perllibs="$*"
22811	    ;;
22812    *)	perllibs="$libs"
22813	    ;;
22814    esac
22815    ;;
22816esac
22817
22818: Remove build directory name from cppstdin so it can be used from
22819: either the present location or the final installed location.
22820echo " "
22821: Get out of the UU directory to get correct path name.
22822cd ..
22823case "$cppstdin" in
22824`pwd`/cppstdin)
22825	echo "Stripping down cppstdin path name"
22826	cppstdin=cppstdin
22827	;;
22828esac
22829cd UU
22830
22831: end of configuration questions
22832echo " "
22833echo "End of configuration questions."
22834echo " "
22835
22836: back to where it started
22837if test -d ../UU; then
22838	cd ..
22839fi
22840
22841: configuration may be unconditionally patched via a 'config.arch' file
22842if $test -f config.arch; then
22843	echo "I see a config.arch file, loading it." >&4
22844	. ./config.arch
22845fi
22846
22847: configuration may be patched via a 'config.over' file
22848if $test -f config.over; then
22849	echo " "
22850	dflt=y
22851	rp='I see a config.over file.  Do you wish to load it?'
22852	. UU/myread
22853	case "$ans" in
22854	n*) echo "OK, I'll ignore it.";;
22855	*)	. ./config.over
22856		echo "Configuration override changes have been loaded."
22857		;;
22858	esac
22859fi
22860
22861: in case they want portability, strip down executable paths
22862case "$d_portable" in
22863"$define")
22864	echo " "
22865	echo "Stripping down executable paths..." >&4
22866	for file in $loclist $trylist; do
22867		eval temp=\$$file
22868		eval $file=`basename $temp`
22869	done
22870	;;
22871esac
22872
22873: create config.sh file
22874echo " "
22875echo "Creating config.sh..." >&4
22876$spitshell <<EOT >config.sh
22877$startsh
22878#
22879# This file was produced by running the Configure script. It holds all the
22880# definitions figured out by Configure. Should you modify one of these values,
22881# do not forget to propagate your changes by running "Configure -der". You may
22882# instead choose to run each of the .SH files by yourself, or "Configure -S".
22883#
22884
22885# Package name      : $package
22886# Source directory  : $src
22887# Configuration time: $cf_time
22888# Configured by     : $cf_by
22889# Target system     : $myuname
22890
22891EOT
22892: Add in command line options if available
22893$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22894
22895$spitshell <<EOT >>config.sh
22896
22897Author='$Author'
22898Date='$Date'
22899Header='$Header'
22900Id='$Id'
22901Locker='$Locker'
22902Log='$Log'
22903RCSfile='$RCSfile'
22904Revision='$Revision'
22905Source='$Source'
22906State='$State'
22907_a='$_a'
22908_exe='$_exe'
22909_o='$_o'
22910afs='$afs'
22911afsroot='$afsroot'
22912alignbytes='$alignbytes'
22913ansi2knr='$ansi2knr'
22914aphostname='$aphostname'
22915api_revision='$api_revision'
22916api_subversion='$api_subversion'
22917api_version='$api_version'
22918api_versionstring='$api_versionstring'
22919ar='$ar'
22920archlib='$archlib'
22921archlibexp='$archlibexp'
22922archname64='$archname64'
22923archname='$archname'
22924archobjs='$archobjs'
22925asctime_r_proto='$asctime_r_proto'
22926awk='$awk'
22927baserev='$baserev'
22928bash='$bash'
22929bin='$bin'
22930bin_ELF='$bin_ELF'
22931binexp='$binexp'
22932bison='$bison'
22933bootstrap_charset='$bootstrap_charset'
22934byacc='$byacc'
22935byteorder='$byteorder'
22936c='$c'
22937castflags='$castflags'
22938cat='$cat'
22939cc='$cc'
22940cccdlflags='$cccdlflags'
22941ccdlflags='$ccdlflags'
22942ccflags='$ccflags'
22943ccflags_uselargefiles='$ccflags_uselargefiles'
22944ccname='$ccname'
22945ccsymbols='$ccsymbols'
22946ccversion='$ccversion'
22947cf_by='$cf_by'
22948cf_email='$cf_email'
22949cf_time='$cf_time'
22950charbits='$charbits'
22951charsize='$charsize'
22952chgrp='$chgrp'
22953chmod='$chmod'
22954chown='$chown'
22955clocktype='$clocktype'
22956comm='$comm'
22957compress='$compress'
22958contains='$contains'
22959cp='$cp'
22960cpio='$cpio'
22961cpp='$cpp'
22962cpp_stuff='$cpp_stuff'
22963cppccsymbols='$cppccsymbols'
22964cppflags='$cppflags'
22965cpplast='$cpplast'
22966cppminus='$cppminus'
22967cpprun='$cpprun'
22968cppstdin='$cppstdin'
22969cppsymbols='$cppsymbols'
22970crypt_r_proto='$crypt_r_proto'
22971cryptlib='$cryptlib'
22972csh='$csh'
22973ctermid_r_proto='$ctermid_r_proto'
22974ctime_r_proto='$ctime_r_proto'
22975d_Gconvert='$d_Gconvert'
22976d_PRIEUldbl='$d_PRIEUldbl'
22977d_PRIFUldbl='$d_PRIFUldbl'
22978d_PRIGUldbl='$d_PRIGUldbl'
22979d_PRIXU64='$d_PRIXU64'
22980d_PRId64='$d_PRId64'
22981d_PRIeldbl='$d_PRIeldbl'
22982d_PRIfldbl='$d_PRIfldbl'
22983d_PRIgldbl='$d_PRIgldbl'
22984d_PRIi64='$d_PRIi64'
22985d_PRIo64='$d_PRIo64'
22986d_PRIu64='$d_PRIu64'
22987d_PRIx64='$d_PRIx64'
22988d_SCNfldbl='$d_SCNfldbl'
22989d__fwalk='$d__fwalk'
22990d_access='$d_access'
22991d_accessx='$d_accessx'
22992d_aintl='$d_aintl'
22993d_alarm='$d_alarm'
22994d_archlib='$d_archlib'
22995d_asctime64='$d_asctime64'
22996d_asctime_r='$d_asctime_r'
22997d_atolf='$d_atolf'
22998d_atoll='$d_atoll'
22999d_attribute_deprecated='$d_attribute_deprecated'
23000d_attribute_format='$d_attribute_format'
23001d_attribute_malloc='$d_attribute_malloc'
23002d_attribute_nonnull='$d_attribute_nonnull'
23003d_attribute_noreturn='$d_attribute_noreturn'
23004d_attribute_pure='$d_attribute_pure'
23005d_attribute_unused='$d_attribute_unused'
23006d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23007d_bcmp='$d_bcmp'
23008d_bcopy='$d_bcopy'
23009d_bsd='$d_bsd'
23010d_bsdgetpgrp='$d_bsdgetpgrp'
23011d_bsdsetpgrp='$d_bsdsetpgrp'
23012d_builtin_choose_expr='$d_builtin_choose_expr'
23013d_builtin_expect='$d_builtin_expect'
23014d_bzero='$d_bzero'
23015d_c99_variadic_macros='$d_c99_variadic_macros'
23016d_casti32='$d_casti32'
23017d_castneg='$d_castneg'
23018d_charvspr='$d_charvspr'
23019d_chown='$d_chown'
23020d_chroot='$d_chroot'
23021d_chsize='$d_chsize'
23022d_class='$d_class'
23023d_clearenv='$d_clearenv'
23024d_closedir='$d_closedir'
23025d_cmsghdr_s='$d_cmsghdr_s'
23026d_const='$d_const'
23027d_copysignl='$d_copysignl'
23028d_cplusplus='$d_cplusplus'
23029d_crypt='$d_crypt'
23030d_crypt_r='$d_crypt_r'
23031d_csh='$d_csh'
23032d_ctermid='$d_ctermid'
23033d_ctermid_r='$d_ctermid_r'
23034d_ctime64='$d_ctime64'
23035d_ctime_r='$d_ctime_r'
23036d_cuserid='$d_cuserid'
23037d_dbl_dig='$d_dbl_dig'
23038d_dbminitproto='$d_dbminitproto'
23039d_difftime64='$d_difftime64'
23040d_difftime='$d_difftime'
23041d_dir_dd_fd='$d_dir_dd_fd'
23042d_dirfd='$d_dirfd'
23043d_dirnamlen='$d_dirnamlen'
23044d_dlerror='$d_dlerror'
23045d_dlopen='$d_dlopen'
23046d_dlsymun='$d_dlsymun'
23047d_dosuid='$d_dosuid'
23048d_drand48_r='$d_drand48_r'
23049d_drand48proto='$d_drand48proto'
23050d_dup2='$d_dup2'
23051d_eaccess='$d_eaccess'
23052d_endgrent='$d_endgrent'
23053d_endgrent_r='$d_endgrent_r'
23054d_endhent='$d_endhent'
23055d_endhostent_r='$d_endhostent_r'
23056d_endnent='$d_endnent'
23057d_endnetent_r='$d_endnetent_r'
23058d_endpent='$d_endpent'
23059d_endprotoent_r='$d_endprotoent_r'
23060d_endpwent='$d_endpwent'
23061d_endpwent_r='$d_endpwent_r'
23062d_endsent='$d_endsent'
23063d_endservent_r='$d_endservent_r'
23064d_eofnblk='$d_eofnblk'
23065d_eunice='$d_eunice'
23066d_faststdio='$d_faststdio'
23067d_fchdir='$d_fchdir'
23068d_fchmod='$d_fchmod'
23069d_fchown='$d_fchown'
23070d_fcntl='$d_fcntl'
23071d_fcntl_can_lock='$d_fcntl_can_lock'
23072d_fd_macros='$d_fd_macros'
23073d_fd_set='$d_fd_set'
23074d_fds_bits='$d_fds_bits'
23075d_fgetpos='$d_fgetpos'
23076d_finite='$d_finite'
23077d_finitel='$d_finitel'
23078d_flexfnam='$d_flexfnam'
23079d_flock='$d_flock'
23080d_flockproto='$d_flockproto'
23081d_fork='$d_fork'
23082d_fp_class='$d_fp_class'
23083d_fpathconf='$d_fpathconf'
23084d_fpclass='$d_fpclass'
23085d_fpclassify='$d_fpclassify'
23086d_fpclassl='$d_fpclassl'
23087d_fpos64_t='$d_fpos64_t'
23088d_frexpl='$d_frexpl'
23089d_fs_data_s='$d_fs_data_s'
23090d_fseeko='$d_fseeko'
23091d_fsetpos='$d_fsetpos'
23092d_fstatfs='$d_fstatfs'
23093d_fstatvfs='$d_fstatvfs'
23094d_fsync='$d_fsync'
23095d_ftello='$d_ftello'
23096d_ftime='$d_ftime'
23097d_futimes='$d_futimes'
23098d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23099d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23100d_getaddrinfo='$d_getaddrinfo'
23101d_getcwd='$d_getcwd'
23102d_getespwnam='$d_getespwnam'
23103d_getfsstat='$d_getfsstat'
23104d_getgrent='$d_getgrent'
23105d_getgrent_r='$d_getgrent_r'
23106d_getgrgid_r='$d_getgrgid_r'
23107d_getgrnam_r='$d_getgrnam_r'
23108d_getgrps='$d_getgrps'
23109d_gethbyaddr='$d_gethbyaddr'
23110d_gethbyname='$d_gethbyname'
23111d_gethent='$d_gethent'
23112d_gethname='$d_gethname'
23113d_gethostbyaddr_r='$d_gethostbyaddr_r'
23114d_gethostbyname_r='$d_gethostbyname_r'
23115d_gethostent_r='$d_gethostent_r'
23116d_gethostprotos='$d_gethostprotos'
23117d_getitimer='$d_getitimer'
23118d_getlogin='$d_getlogin'
23119d_getlogin_r='$d_getlogin_r'
23120d_getmnt='$d_getmnt'
23121d_getmntent='$d_getmntent'
23122d_getnameinfo='$d_getnameinfo'
23123d_getnbyaddr='$d_getnbyaddr'
23124d_getnbyname='$d_getnbyname'
23125d_getnent='$d_getnent'
23126d_getnetbyaddr_r='$d_getnetbyaddr_r'
23127d_getnetbyname_r='$d_getnetbyname_r'
23128d_getnetent_r='$d_getnetent_r'
23129d_getnetprotos='$d_getnetprotos'
23130d_getpagsz='$d_getpagsz'
23131d_getpbyname='$d_getpbyname'
23132d_getpbynumber='$d_getpbynumber'
23133d_getpent='$d_getpent'
23134d_getpgid='$d_getpgid'
23135d_getpgrp2='$d_getpgrp2'
23136d_getpgrp='$d_getpgrp'
23137d_getppid='$d_getppid'
23138d_getprior='$d_getprior'
23139d_getprotobyname_r='$d_getprotobyname_r'
23140d_getprotobynumber_r='$d_getprotobynumber_r'
23141d_getprotoent_r='$d_getprotoent_r'
23142d_getprotoprotos='$d_getprotoprotos'
23143d_getprpwnam='$d_getprpwnam'
23144d_getpwent='$d_getpwent'
23145d_getpwent_r='$d_getpwent_r'
23146d_getpwnam_r='$d_getpwnam_r'
23147d_getpwuid_r='$d_getpwuid_r'
23148d_getsbyname='$d_getsbyname'
23149d_getsbyport='$d_getsbyport'
23150d_getsent='$d_getsent'
23151d_getservbyname_r='$d_getservbyname_r'
23152d_getservbyport_r='$d_getservbyport_r'
23153d_getservent_r='$d_getservent_r'
23154d_getservprotos='$d_getservprotos'
23155d_getspnam='$d_getspnam'
23156d_getspnam_r='$d_getspnam_r'
23157d_gettimeod='$d_gettimeod'
23158d_gmtime64='$d_gmtime64'
23159d_gmtime_r='$d_gmtime_r'
23160d_gnulibc='$d_gnulibc'
23161d_grpasswd='$d_grpasswd'
23162d_hasmntopt='$d_hasmntopt'
23163d_htonl='$d_htonl'
23164d_ilogbl='$d_ilogbl'
23165d_inc_version_list='$d_inc_version_list'
23166d_index='$d_index'
23167d_inetaton='$d_inetaton'
23168d_inetntop='$d_inetntop'
23169d_inetpton='$d_inetpton'
23170d_int64_t='$d_int64_t'
23171d_ip_mreq='$d_ip_mreq'
23172d_ip_mreq_source='$d_ip_mreq_source'
23173d_ipv6_mreq='$d_ipv6_mreq'
23174d_ipv6_mreq_source='$d_ipv6_mreq_source'
23175d_isascii='$d_isascii'
23176d_isblank='$d_isblank'
23177d_isfinite='$d_isfinite'
23178d_isinf='$d_isinf'
23179d_isnan='$d_isnan'
23180d_isnanl='$d_isnanl'
23181d_killpg='$d_killpg'
23182d_lchown='$d_lchown'
23183d_ldbl_dig='$d_ldbl_dig'
23184d_libm_lib_version='$d_libm_lib_version'
23185d_link='$d_link'
23186d_localtime64='$d_localtime64'
23187d_localtime_r='$d_localtime_r'
23188d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23189d_locconv='$d_locconv'
23190d_lockf='$d_lockf'
23191d_longdbl='$d_longdbl'
23192d_longlong='$d_longlong'
23193d_lseekproto='$d_lseekproto'
23194d_lstat='$d_lstat'
23195d_madvise='$d_madvise'
23196d_malloc_good_size='$d_malloc_good_size'
23197d_malloc_size='$d_malloc_size'
23198d_mblen='$d_mblen'
23199d_mbstowcs='$d_mbstowcs'
23200d_mbtowc='$d_mbtowc'
23201d_memchr='$d_memchr'
23202d_memcmp='$d_memcmp'
23203d_memcpy='$d_memcpy'
23204d_memmove='$d_memmove'
23205d_memset='$d_memset'
23206d_mkdir='$d_mkdir'
23207d_mkdtemp='$d_mkdtemp'
23208d_mkfifo='$d_mkfifo'
23209d_mkstemp='$d_mkstemp'
23210d_mkstemps='$d_mkstemps'
23211d_mktime64='$d_mktime64'
23212d_mktime='$d_mktime'
23213d_mmap='$d_mmap'
23214d_modfl='$d_modfl'
23215d_modfl_pow32_bug='$d_modfl_pow32_bug'
23216d_modflproto='$d_modflproto'
23217d_mprotect='$d_mprotect'
23218d_msg='$d_msg'
23219d_msg_ctrunc='$d_msg_ctrunc'
23220d_msg_dontroute='$d_msg_dontroute'
23221d_msg_oob='$d_msg_oob'
23222d_msg_peek='$d_msg_peek'
23223d_msg_proxy='$d_msg_proxy'
23224d_msgctl='$d_msgctl'
23225d_msgget='$d_msgget'
23226d_msghdr_s='$d_msghdr_s'
23227d_msgrcv='$d_msgrcv'
23228d_msgsnd='$d_msgsnd'
23229d_msync='$d_msync'
23230d_munmap='$d_munmap'
23231d_mymalloc='$d_mymalloc'
23232d_ndbm='$d_ndbm'
23233d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23234d_nice='$d_nice'
23235d_nl_langinfo='$d_nl_langinfo'
23236d_nv_preserves_uv='$d_nv_preserves_uv'
23237d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23238d_off64_t='$d_off64_t'
23239d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23240d_oldpthreads='$d_oldpthreads'
23241d_oldsock='$d_oldsock'
23242d_open3='$d_open3'
23243d_pathconf='$d_pathconf'
23244d_pause='$d_pause'
23245d_perl_otherlibdirs='$d_perl_otherlibdirs'
23246d_phostname='$d_phostname'
23247d_pipe='$d_pipe'
23248d_poll='$d_poll'
23249d_portable='$d_portable'
23250d_prctl='$d_prctl'
23251d_prctl_set_name='$d_prctl_set_name'
23252d_printf_format_null='$d_printf_format_null'
23253d_procselfexe='$d_procselfexe'
23254d_pseudofork='$d_pseudofork'
23255d_pthread_atfork='$d_pthread_atfork'
23256d_pthread_attr_setscope='$d_pthread_attr_setscope'
23257d_pthread_yield='$d_pthread_yield'
23258d_pwage='$d_pwage'
23259d_pwchange='$d_pwchange'
23260d_pwclass='$d_pwclass'
23261d_pwcomment='$d_pwcomment'
23262d_pwexpire='$d_pwexpire'
23263d_pwgecos='$d_pwgecos'
23264d_pwpasswd='$d_pwpasswd'
23265d_pwquota='$d_pwquota'
23266d_qgcvt='$d_qgcvt'
23267d_quad='$d_quad'
23268d_random_r='$d_random_r'
23269d_readdir64_r='$d_readdir64_r'
23270d_readdir='$d_readdir'
23271d_readdir_r='$d_readdir_r'
23272d_readlink='$d_readlink'
23273d_readv='$d_readv'
23274d_recvmsg='$d_recvmsg'
23275d_rename='$d_rename'
23276d_rewinddir='$d_rewinddir'
23277d_rmdir='$d_rmdir'
23278d_safebcpy='$d_safebcpy'
23279d_safemcpy='$d_safemcpy'
23280d_sanemcmp='$d_sanemcmp'
23281d_sbrkproto='$d_sbrkproto'
23282d_scalbnl='$d_scalbnl'
23283d_sched_yield='$d_sched_yield'
23284d_scm_rights='$d_scm_rights'
23285d_seekdir='$d_seekdir'
23286d_select='$d_select'
23287d_sem='$d_sem'
23288d_semctl='$d_semctl'
23289d_semctl_semid_ds='$d_semctl_semid_ds'
23290d_semctl_semun='$d_semctl_semun'
23291d_semget='$d_semget'
23292d_semop='$d_semop'
23293d_sendmsg='$d_sendmsg'
23294d_setegid='$d_setegid'
23295d_seteuid='$d_seteuid'
23296d_setgrent='$d_setgrent'
23297d_setgrent_r='$d_setgrent_r'
23298d_setgrps='$d_setgrps'
23299d_sethent='$d_sethent'
23300d_sethostent_r='$d_sethostent_r'
23301d_setitimer='$d_setitimer'
23302d_setlinebuf='$d_setlinebuf'
23303d_setlocale='$d_setlocale'
23304d_setlocale_r='$d_setlocale_r'
23305d_setnent='$d_setnent'
23306d_setnetent_r='$d_setnetent_r'
23307d_setpent='$d_setpent'
23308d_setpgid='$d_setpgid'
23309d_setpgrp2='$d_setpgrp2'
23310d_setpgrp='$d_setpgrp'
23311d_setprior='$d_setprior'
23312d_setproctitle='$d_setproctitle'
23313d_setprotoent_r='$d_setprotoent_r'
23314d_setpwent='$d_setpwent'
23315d_setpwent_r='$d_setpwent_r'
23316d_setregid='$d_setregid'
23317d_setresgid='$d_setresgid'
23318d_setresuid='$d_setresuid'
23319d_setreuid='$d_setreuid'
23320d_setrgid='$d_setrgid'
23321d_setruid='$d_setruid'
23322d_setsent='$d_setsent'
23323d_setservent_r='$d_setservent_r'
23324d_setsid='$d_setsid'
23325d_setvbuf='$d_setvbuf'
23326d_sfio='$d_sfio'
23327d_shm='$d_shm'
23328d_shmat='$d_shmat'
23329d_shmatprototype='$d_shmatprototype'
23330d_shmctl='$d_shmctl'
23331d_shmdt='$d_shmdt'
23332d_shmget='$d_shmget'
23333d_sigaction='$d_sigaction'
23334d_signbit='$d_signbit'
23335d_sigprocmask='$d_sigprocmask'
23336d_sigsetjmp='$d_sigsetjmp'
23337d_sin6_scope_id='$d_sin6_scope_id'
23338d_sitearch='$d_sitearch'
23339d_snprintf='$d_snprintf'
23340d_sockaddr_in6='$d_sockaddr_in6'
23341d_sockaddr_sa_len='$d_sockaddr_sa_len'
23342d_sockatmark='$d_sockatmark'
23343d_sockatmarkproto='$d_sockatmarkproto'
23344d_socket='$d_socket'
23345d_socklen_t='$d_socklen_t'
23346d_sockpair='$d_sockpair'
23347d_socks5_init='$d_socks5_init'
23348d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23349d_sqrtl='$d_sqrtl'
23350d_srand48_r='$d_srand48_r'
23351d_srandom_r='$d_srandom_r'
23352d_sresgproto='$d_sresgproto'
23353d_sresuproto='$d_sresuproto'
23354d_statblks='$d_statblks'
23355d_statfs_f_flags='$d_statfs_f_flags'
23356d_statfs_s='$d_statfs_s'
23357d_static_inline='$d_static_inline'
23358d_statvfs='$d_statvfs'
23359d_stdio_cnt_lval='$d_stdio_cnt_lval'
23360d_stdio_ptr_lval='$d_stdio_ptr_lval'
23361d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23362d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23363d_stdio_stream_array='$d_stdio_stream_array'
23364d_stdiobase='$d_stdiobase'
23365d_stdstdio='$d_stdstdio'
23366d_strchr='$d_strchr'
23367d_strcoll='$d_strcoll'
23368d_strctcpy='$d_strctcpy'
23369d_strerrm='$d_strerrm'
23370d_strerror='$d_strerror'
23371d_strerror_r='$d_strerror_r'
23372d_strftime='$d_strftime'
23373d_strlcat='$d_strlcat'
23374d_strlcpy='$d_strlcpy'
23375d_strtod='$d_strtod'
23376d_strtol='$d_strtol'
23377d_strtold='$d_strtold'
23378d_strtoll='$d_strtoll'
23379d_strtoq='$d_strtoq'
23380d_strtoul='$d_strtoul'
23381d_strtoull='$d_strtoull'
23382d_strtouq='$d_strtouq'
23383d_strxfrm='$d_strxfrm'
23384d_suidsafe='$d_suidsafe'
23385d_symlink='$d_symlink'
23386d_syscall='$d_syscall'
23387d_syscallproto='$d_syscallproto'
23388d_sysconf='$d_sysconf'
23389d_sysernlst='$d_sysernlst'
23390d_syserrlst='$d_syserrlst'
23391d_system='$d_system'
23392d_tcgetpgrp='$d_tcgetpgrp'
23393d_tcsetpgrp='$d_tcsetpgrp'
23394d_telldir='$d_telldir'
23395d_telldirproto='$d_telldirproto'
23396d_time='$d_time'
23397d_timegm='$d_timegm'
23398d_times='$d_times'
23399d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23400d_tm_tm_zone='$d_tm_tm_zone'
23401d_tmpnam_r='$d_tmpnam_r'
23402d_truncate='$d_truncate'
23403d_ttyname_r='$d_ttyname_r'
23404d_tzname='$d_tzname'
23405d_u32align='$d_u32align'
23406d_ualarm='$d_ualarm'
23407d_umask='$d_umask'
23408d_uname='$d_uname'
23409d_union_semun='$d_union_semun'
23410d_unordered='$d_unordered'
23411d_unsetenv='$d_unsetenv'
23412d_usleep='$d_usleep'
23413d_usleepproto='$d_usleepproto'
23414d_ustat='$d_ustat'
23415d_vendorarch='$d_vendorarch'
23416d_vendorbin='$d_vendorbin'
23417d_vendorlib='$d_vendorlib'
23418d_vendorscript='$d_vendorscript'
23419d_vfork='$d_vfork'
23420d_void_closedir='$d_void_closedir'
23421d_voidsig='$d_voidsig'
23422d_voidtty='$d_voidtty'
23423d_volatile='$d_volatile'
23424d_vprintf='$d_vprintf'
23425d_vsnprintf='$d_vsnprintf'
23426d_wait4='$d_wait4'
23427d_waitpid='$d_waitpid'
23428d_wcstombs='$d_wcstombs'
23429d_wctomb='$d_wctomb'
23430d_writev='$d_writev'
23431d_xenix='$d_xenix'
23432date='$date'
23433db_hashtype='$db_hashtype'
23434db_prefixtype='$db_prefixtype'
23435db_version_major='$db_version_major'
23436db_version_minor='$db_version_minor'
23437db_version_patch='$db_version_patch'
23438defvoidused='$defvoidused'
23439direntrytype='$direntrytype'
23440dlext='$dlext'
23441dlsrc='$dlsrc'
23442doublesize='$doublesize'
23443drand01='$drand01'
23444drand48_r_proto='$drand48_r_proto'
23445dtrace='$dtrace'
23446dynamic_ext='$dynamic_ext'
23447eagain='$eagain'
23448ebcdic='$ebcdic'
23449echo='$echo'
23450egrep='$egrep'
23451emacs='$emacs'
23452endgrent_r_proto='$endgrent_r_proto'
23453endhostent_r_proto='$endhostent_r_proto'
23454endnetent_r_proto='$endnetent_r_proto'
23455endprotoent_r_proto='$endprotoent_r_proto'
23456endpwent_r_proto='$endpwent_r_proto'
23457endservent_r_proto='$endservent_r_proto'
23458eunicefix='$eunicefix'
23459exe_ext='$exe_ext'
23460expr='$expr'
23461extensions='$extensions'
23462extern_C='$extern_C'
23463extras='$extras'
23464fflushNULL='$fflushNULL'
23465fflushall='$fflushall'
23466find='$find'
23467firstmakefile='$firstmakefile'
23468flex='$flex'
23469fpossize='$fpossize'
23470fpostype='$fpostype'
23471freetype='$freetype'
23472from='$from'
23473full_ar='$full_ar'
23474full_csh='$full_csh'
23475full_sed='$full_sed'
23476gccansipedantic='$gccansipedantic'
23477gccosandvers='$gccosandvers'
23478gccversion='$gccversion'
23479getgrent_r_proto='$getgrent_r_proto'
23480getgrgid_r_proto='$getgrgid_r_proto'
23481getgrnam_r_proto='$getgrnam_r_proto'
23482gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23483gethostbyname_r_proto='$gethostbyname_r_proto'
23484gethostent_r_proto='$gethostent_r_proto'
23485getlogin_r_proto='$getlogin_r_proto'
23486getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23487getnetbyname_r_proto='$getnetbyname_r_proto'
23488getnetent_r_proto='$getnetent_r_proto'
23489getprotobyname_r_proto='$getprotobyname_r_proto'
23490getprotobynumber_r_proto='$getprotobynumber_r_proto'
23491getprotoent_r_proto='$getprotoent_r_proto'
23492getpwent_r_proto='$getpwent_r_proto'
23493getpwnam_r_proto='$getpwnam_r_proto'
23494getpwuid_r_proto='$getpwuid_r_proto'
23495getservbyname_r_proto='$getservbyname_r_proto'
23496getservbyport_r_proto='$getservbyport_r_proto'
23497getservent_r_proto='$getservent_r_proto'
23498getspnam_r_proto='$getspnam_r_proto'
23499gidformat='$gidformat'
23500gidsign='$gidsign'
23501gidsize='$gidsize'
23502gidtype='$gidtype'
23503glibpth='$glibpth'
23504gmake='$gmake'
23505gmtime_r_proto='$gmtime_r_proto'
23506gnulibc_version='$gnulibc_version'
23507grep='$grep'
23508groupcat='$groupcat'
23509groupstype='$groupstype'
23510gzip='$gzip'
23511h_fcntl='$h_fcntl'
23512h_sysfile='$h_sysfile'
23513hint='$hint'
23514hostcat='$hostcat'
23515html1dir='$html1dir'
23516html1direxp='$html1direxp'
23517html3dir='$html3dir'
23518html3direxp='$html3direxp'
23519i16size='$i16size'
23520i16type='$i16type'
23521i32size='$i32size'
23522i32type='$i32type'
23523i64size='$i64size'
23524i64type='$i64type'
23525i8size='$i8size'
23526i8type='$i8type'
23527i_arpainet='$i_arpainet'
23528i_assert='$i_assert'
23529i_bsdioctl='$i_bsdioctl'
23530i_crypt='$i_crypt'
23531i_db='$i_db'
23532i_dbm='$i_dbm'
23533i_dirent='$i_dirent'
23534i_dld='$i_dld'
23535i_dlfcn='$i_dlfcn'
23536i_fcntl='$i_fcntl'
23537i_float='$i_float'
23538i_fp='$i_fp'
23539i_fp_class='$i_fp_class'
23540i_gdbm='$i_gdbm'
23541i_gdbm_ndbm='$i_gdbm_ndbm'
23542i_gdbmndbm='$i_gdbmndbm'
23543i_grp='$i_grp'
23544i_ieeefp='$i_ieeefp'
23545i_inttypes='$i_inttypes'
23546i_langinfo='$i_langinfo'
23547i_libutil='$i_libutil'
23548i_limits='$i_limits'
23549i_locale='$i_locale'
23550i_machcthr='$i_machcthr'
23551i_malloc='$i_malloc'
23552i_mallocmalloc='$i_mallocmalloc'
23553i_math='$i_math'
23554i_memory='$i_memory'
23555i_mntent='$i_mntent'
23556i_ndbm='$i_ndbm'
23557i_netdb='$i_netdb'
23558i_neterrno='$i_neterrno'
23559i_netinettcp='$i_netinettcp'
23560i_niin='$i_niin'
23561i_poll='$i_poll'
23562i_prot='$i_prot'
23563i_pthread='$i_pthread'
23564i_pwd='$i_pwd'
23565i_rpcsvcdbm='$i_rpcsvcdbm'
23566i_sfio='$i_sfio'
23567i_sgtty='$i_sgtty'
23568i_shadow='$i_shadow'
23569i_socks='$i_socks'
23570i_stdarg='$i_stdarg'
23571i_stdbool='$i_stdbool'
23572i_stddef='$i_stddef'
23573i_stdlib='$i_stdlib'
23574i_string='$i_string'
23575i_sunmath='$i_sunmath'
23576i_sysaccess='$i_sysaccess'
23577i_sysdir='$i_sysdir'
23578i_sysfile='$i_sysfile'
23579i_sysfilio='$i_sysfilio'
23580i_sysin='$i_sysin'
23581i_sysioctl='$i_sysioctl'
23582i_syslog='$i_syslog'
23583i_sysmman='$i_sysmman'
23584i_sysmode='$i_sysmode'
23585i_sysmount='$i_sysmount'
23586i_sysndir='$i_sysndir'
23587i_sysparam='$i_sysparam'
23588i_syspoll='$i_syspoll'
23589i_sysresrc='$i_sysresrc'
23590i_syssecrt='$i_syssecrt'
23591i_sysselct='$i_sysselct'
23592i_syssockio='$i_syssockio'
23593i_sysstat='$i_sysstat'
23594i_sysstatfs='$i_sysstatfs'
23595i_sysstatvfs='$i_sysstatvfs'
23596i_systime='$i_systime'
23597i_systimek='$i_systimek'
23598i_systimes='$i_systimes'
23599i_systypes='$i_systypes'
23600i_sysuio='$i_sysuio'
23601i_sysun='$i_sysun'
23602i_sysutsname='$i_sysutsname'
23603i_sysvfs='$i_sysvfs'
23604i_syswait='$i_syswait'
23605i_termio='$i_termio'
23606i_termios='$i_termios'
23607i_time='$i_time'
23608i_unistd='$i_unistd'
23609i_ustat='$i_ustat'
23610i_utime='$i_utime'
23611i_values='$i_values'
23612i_varargs='$i_varargs'
23613i_varhdr='$i_varhdr'
23614i_vfork='$i_vfork'
23615ignore_versioned_solibs='$ignore_versioned_solibs'
23616inc_version_list='$inc_version_list'
23617inc_version_list_init='$inc_version_list_init'
23618incpath='$incpath'
23619inews='$inews'
23620initialinstalllocation='$initialinstalllocation'
23621installarchlib='$installarchlib'
23622installbin='$installbin'
23623installhtml1dir='$installhtml1dir'
23624installhtml3dir='$installhtml3dir'
23625installman1dir='$installman1dir'
23626installman3dir='$installman3dir'
23627installprefix='$installprefix'
23628installprefixexp='$installprefixexp'
23629installprivlib='$installprivlib'
23630installscript='$installscript'
23631installsitearch='$installsitearch'
23632installsitebin='$installsitebin'
23633installsitehtml1dir='$installsitehtml1dir'
23634installsitehtml3dir='$installsitehtml3dir'
23635installsitelib='$installsitelib'
23636installsiteman1dir='$installsiteman1dir'
23637installsiteman3dir='$installsiteman3dir'
23638installsitescript='$installsitescript'
23639installstyle='$installstyle'
23640installusrbinperl='$installusrbinperl'
23641installvendorarch='$installvendorarch'
23642installvendorbin='$installvendorbin'
23643installvendorhtml1dir='$installvendorhtml1dir'
23644installvendorhtml3dir='$installvendorhtml3dir'
23645installvendorlib='$installvendorlib'
23646installvendorman1dir='$installvendorman1dir'
23647installvendorman3dir='$installvendorman3dir'
23648installvendorscript='$installvendorscript'
23649intsize='$intsize'
23650issymlink='$issymlink'
23651ivdformat='$ivdformat'
23652ivsize='$ivsize'
23653ivtype='$ivtype'
23654known_extensions='$known_extensions'
23655ksh='$ksh'
23656ld='$ld'
23657ld_can_script='$ld_can_script'
23658lddlflags='$lddlflags'
23659ldflags='$ldflags'
23660ldflags_uselargefiles='$ldflags_uselargefiles'
23661ldlibpthname='$ldlibpthname'
23662less='$less'
23663lib_ext='$lib_ext'
23664libc='$libc'
23665libperl='$libperl'
23666libpth='$libpth'
23667libs='$libs'
23668libsdirs='$libsdirs'
23669libsfiles='$libsfiles'
23670libsfound='$libsfound'
23671libspath='$libspath'
23672libswanted='$libswanted'
23673libswanted_uselargefiles='$libswanted_uselargefiles'
23674line='$line'
23675lint='$lint'
23676lkflags='$lkflags'
23677ln='$ln'
23678lns='$lns'
23679localtime_r_proto='$localtime_r_proto'
23680locincpth='$locincpth'
23681loclibpth='$loclibpth'
23682longdblsize='$longdblsize'
23683longlongsize='$longlongsize'
23684longsize='$longsize'
23685lp='$lp'
23686lpr='$lpr'
23687ls='$ls'
23688lseeksize='$lseeksize'
23689lseektype='$lseektype'
23690mad='$mad'
23691madlyh='$madlyh'
23692madlyobj='$madlyobj'
23693madlysrc='$madlysrc'
23694mail='$mail'
23695mailx='$mailx'
23696make='$make'
23697make_set_make='$make_set_make'
23698mallocobj='$mallocobj'
23699mallocsrc='$mallocsrc'
23700malloctype='$malloctype'
23701man1dir='$man1dir'
23702man1direxp='$man1direxp'
23703man1ext='$man1ext'
23704man3dir='$man3dir'
23705man3direxp='$man3direxp'
23706man3ext='$man3ext'
23707mips_type='$mips_type'
23708mistrustnm='$mistrustnm'
23709mkdir='$mkdir'
23710mmaptype='$mmaptype'
23711modetype='$modetype'
23712more='$more'
23713multiarch='$multiarch'
23714mv='$mv'
23715myarchname='$myarchname'
23716mydomain='$mydomain'
23717myhostname='$myhostname'
23718myuname='$myuname'
23719n='$n'
23720need_va_copy='$need_va_copy'
23721netdb_hlen_type='$netdb_hlen_type'
23722netdb_host_type='$netdb_host_type'
23723netdb_name_type='$netdb_name_type'
23724netdb_net_type='$netdb_net_type'
23725nm='$nm'
23726nm_opt='$nm_opt'
23727nm_so_opt='$nm_so_opt'
23728nonxs_ext='$nonxs_ext'
23729nroff='$nroff'
23730nvEUformat='$nvEUformat'
23731nvFUformat='$nvFUformat'
23732nvGUformat='$nvGUformat'
23733nv_overflows_integers_at='$nv_overflows_integers_at'
23734nv_preserves_uv_bits='$nv_preserves_uv_bits'
23735nveformat='$nveformat'
23736nvfformat='$nvfformat'
23737nvgformat='$nvgformat'
23738nvsize='$nvsize'
23739nvtype='$nvtype'
23740o_nonblock='$o_nonblock'
23741obj_ext='$obj_ext'
23742old_pthread_create_joinable='$old_pthread_create_joinable'
23743optimize='$optimize'
23744orderlib='$orderlib'
23745osname='$osname'
23746osvers='$osvers'
23747otherlibdirs='$otherlibdirs'
23748package='$package'
23749pager='$pager'
23750passcat='$passcat'
23751patchlevel='$patchlevel'
23752path_sep='$path_sep'
23753perl5='$perl5'
23754perl='$perl'
23755perl_patchlevel='$perl_patchlevel'
23756perl_static_inline='$perl_static_inline'
23757perladmin='$perladmin'
23758perllibs='$perllibs'
23759perlpath='$perlpath'
23760pg='$pg'
23761phostname='$phostname'
23762pidtype='$pidtype'
23763plibpth='$plibpth'
23764pmake='$pmake'
23765pr='$pr'
23766prefix='$prefix'
23767prefixexp='$prefixexp'
23768privlib='$privlib'
23769privlibexp='$privlibexp'
23770procselfexe='$procselfexe'
23771prototype='$prototype'
23772ptrsize='$ptrsize'
23773quadkind='$quadkind'
23774quadtype='$quadtype'
23775randbits='$randbits'
23776randfunc='$randfunc'
23777random_r_proto='$random_r_proto'
23778randseedtype='$randseedtype'
23779ranlib='$ranlib'
23780rd_nodata='$rd_nodata'
23781readdir64_r_proto='$readdir64_r_proto'
23782readdir_r_proto='$readdir_r_proto'
23783revision='$revision'
23784rm='$rm'
23785rm_try='$rm_try'
23786rmail='$rmail'
23787run='$run'
23788runnm='$runnm'
23789sGMTIME_max='$sGMTIME_max'
23790sGMTIME_min='$sGMTIME_min'
23791sLOCALTIME_max='$sLOCALTIME_max'
23792sLOCALTIME_min='$sLOCALTIME_min'
23793sPRIEUldbl='$sPRIEUldbl'
23794sPRIFUldbl='$sPRIFUldbl'
23795sPRIGUldbl='$sPRIGUldbl'
23796sPRIXU64='$sPRIXU64'
23797sPRId64='$sPRId64'
23798sPRIeldbl='$sPRIeldbl'
23799sPRIfldbl='$sPRIfldbl'
23800sPRIgldbl='$sPRIgldbl'
23801sPRIi64='$sPRIi64'
23802sPRIo64='$sPRIo64'
23803sPRIu64='$sPRIu64'
23804sPRIx64='$sPRIx64'
23805sSCNfldbl='$sSCNfldbl'
23806sched_yield='$sched_yield'
23807scriptdir='$scriptdir'
23808scriptdirexp='$scriptdirexp'
23809sed='$sed'
23810seedfunc='$seedfunc'
23811selectminbits='$selectminbits'
23812selecttype='$selecttype'
23813sendmail='$sendmail'
23814setgrent_r_proto='$setgrent_r_proto'
23815sethostent_r_proto='$sethostent_r_proto'
23816setlocale_r_proto='$setlocale_r_proto'
23817setnetent_r_proto='$setnetent_r_proto'
23818setprotoent_r_proto='$setprotoent_r_proto'
23819setpwent_r_proto='$setpwent_r_proto'
23820setservent_r_proto='$setservent_r_proto'
23821sh='$sh'
23822shar='$shar'
23823sharpbang='$sharpbang'
23824shmattype='$shmattype'
23825shortsize='$shortsize'
23826shrpenv='$shrpenv'
23827shsharp='$shsharp'
23828sig_count='$sig_count'
23829sig_name='$sig_name'
23830sig_name_init='$sig_name_init'
23831sig_num='$sig_num'
23832sig_num_init='$sig_num_init'
23833sig_size='$sig_size'
23834signal_t='$signal_t'
23835sitearch='$sitearch'
23836sitearchexp='$sitearchexp'
23837sitebin='$sitebin'
23838sitebinexp='$sitebinexp'
23839sitehtml1dir='$sitehtml1dir'
23840sitehtml1direxp='$sitehtml1direxp'
23841sitehtml3dir='$sitehtml3dir'
23842sitehtml3direxp='$sitehtml3direxp'
23843sitelib='$sitelib'
23844sitelib_stem='$sitelib_stem'
23845sitelibexp='$sitelibexp'
23846siteman1dir='$siteman1dir'
23847siteman1direxp='$siteman1direxp'
23848siteman3dir='$siteman3dir'
23849siteman3direxp='$siteman3direxp'
23850siteprefix='$siteprefix'
23851siteprefixexp='$siteprefixexp'
23852sitescript='$sitescript'
23853sitescriptexp='$sitescriptexp'
23854sizesize='$sizesize'
23855sizetype='$sizetype'
23856sleep='$sleep'
23857smail='$smail'
23858so='$so'
23859sockethdr='$sockethdr'
23860socketlib='$socketlib'
23861socksizetype='$socksizetype'
23862sort='$sort'
23863spackage='$spackage'
23864spitshell='$spitshell'
23865srand48_r_proto='$srand48_r_proto'
23866srandom_r_proto='$srandom_r_proto'
23867src='$src'
23868ssizetype='$ssizetype'
23869st_ino_sign='$st_ino_sign'
23870st_ino_size='$st_ino_size'
23871startperl='$startperl'
23872startsh='$startsh'
23873static_ext='$static_ext'
23874stdchar='$stdchar'
23875stdio_base='$stdio_base'
23876stdio_bufsiz='$stdio_bufsiz'
23877stdio_cnt='$stdio_cnt'
23878stdio_filbuf='$stdio_filbuf'
23879stdio_ptr='$stdio_ptr'
23880stdio_stream_array='$stdio_stream_array'
23881strerror_r_proto='$strerror_r_proto'
23882strings='$strings'
23883submit='$submit'
23884subversion='$subversion'
23885sysman='$sysman'
23886tail='$tail'
23887tar='$tar'
23888targetarch='$targetarch'
23889tbl='$tbl'
23890tee='$tee'
23891test='$test'
23892timeincl='$timeincl'
23893timetype='$timetype'
23894tmpnam_r_proto='$tmpnam_r_proto'
23895to='$to'
23896touch='$touch'
23897tr='$tr'
23898trnl='$trnl'
23899troff='$troff'
23900ttyname_r_proto='$ttyname_r_proto'
23901u16size='$u16size'
23902u16type='$u16type'
23903u32size='$u32size'
23904u32type='$u32type'
23905u64size='$u64size'
23906u64type='$u64type'
23907u8size='$u8size'
23908u8type='$u8type'
23909uidformat='$uidformat'
23910uidsign='$uidsign'
23911uidsize='$uidsize'
23912uidtype='$uidtype'
23913uname='$uname'
23914uniq='$uniq'
23915uquadtype='$uquadtype'
23916use5005threads='$use5005threads'
23917use64bitall='$use64bitall'
23918use64bitint='$use64bitint'
23919usecrosscompile='$usecrosscompile'
23920usedevel='$usedevel'
23921usedl='$usedl'
23922usedtrace='$usedtrace'
23923usefaststdio='$usefaststdio'
23924useithreads='$useithreads'
23925usekernprocpathname='$usekernprocpathname'
23926uselargefiles='$uselargefiles'
23927uselongdouble='$uselongdouble'
23928usemallocwrap='$usemallocwrap'
23929usemorebits='$usemorebits'
23930usemultiplicity='$usemultiplicity'
23931usemymalloc='$usemymalloc'
23932usenm='$usenm'
23933usensgetexecutablepath='$usensgetexecutablepath'
23934useopcode='$useopcode'
23935useperlio='$useperlio'
23936useposix='$useposix'
23937usereentrant='$usereentrant'
23938userelocatableinc='$userelocatableinc'
23939usesfio='$usesfio'
23940useshrplib='$useshrplib'
23941usesitecustomize='$usesitecustomize'
23942usesocks='$usesocks'
23943usethreads='$usethreads'
23944usevendorprefix='$usevendorprefix'
23945useversionedarchname='$useversionedarchname'
23946usevfork='$usevfork'
23947usrinc='$usrinc'
23948uuname='$uuname'
23949uvXUformat='$uvXUformat'
23950uvoformat='$uvoformat'
23951uvsize='$uvsize'
23952uvtype='$uvtype'
23953uvuformat='$uvuformat'
23954uvxformat='$uvxformat'
23955vaproto='$vaproto'
23956vendorarch='$vendorarch'
23957vendorarchexp='$vendorarchexp'
23958vendorbin='$vendorbin'
23959vendorbinexp='$vendorbinexp'
23960vendorhtml1dir='$vendorhtml1dir'
23961vendorhtml1direxp='$vendorhtml1direxp'
23962vendorhtml3dir='$vendorhtml3dir'
23963vendorhtml3direxp='$vendorhtml3direxp'
23964vendorlib='$vendorlib'
23965vendorlib_stem='$vendorlib_stem'
23966vendorlibexp='$vendorlibexp'
23967vendorman1dir='$vendorman1dir'
23968vendorman1direxp='$vendorman1direxp'
23969vendorman3dir='$vendorman3dir'
23970vendorman3direxp='$vendorman3direxp'
23971vendorprefix='$vendorprefix'
23972vendorprefixexp='$vendorprefixexp'
23973vendorscript='$vendorscript'
23974vendorscriptexp='$vendorscriptexp'
23975version='$version'
23976version_patchlevel_string='$version_patchlevel_string'
23977versiononly='$versiononly'
23978vi='$vi'
23979voidflags='$voidflags'
23980xlibpth='$xlibpth'
23981yacc='$yacc'
23982yaccflags='$yaccflags'
23983zcat='$zcat'
23984zip='$zip'
23985EOT
23986
23987: add special variables
23988$test -f $src/patchlevel.h && \
23989awk '/^#define[ 	]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23990echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23991echo "PERL_CONFIG_SH=true" >>config.sh
23992
23993: propagate old symbols
23994if $test -f UU/config.sh; then
23995	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
23996	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23997		config.sh config.sh UU/oldconfig.sh |\
23998		$sort | $uniq -u >UU/oldsyms
23999	set X `$cat UU/oldsyms`
24000	shift
24001	case $# in
24002	0) ;;
24003	*)
24004		$cat <<EOM
24005Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24006EOM
24007		echo ": Variables propagated from previous config.sh file." >>config.sh
24008		for sym in `$cat UU/oldsyms`; do
24009			echo "    Propagating $hint variable "'$'"$sym..."
24010			eval 'tmp="$'"${sym}"'"'
24011			echo "$tmp" | \
24012				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24013		done
24014		;;
24015	esac
24016fi
24017
24018: Finish up by extracting the .SH files
24019case "$alldone" in
24020exit)
24021	$rm -rf UU
24022	echo "Extraction done."
24023	exit 0
24024	;;
24025cont)
24026	;;
24027'')
24028	dflt=''
24029	nostick=true
24030	$cat <<EOM
24031
24032If you'd like to make any changes to the config.sh file before I begin
24033to configure things, do it as a shell escape now (e.g. !vi config.sh).
24034
24035EOM
24036	rp="Press return or use a shell escape to edit config.sh:"
24037	. UU/myread
24038	nostick=''
24039	case "$ans" in
24040	'') ;;
24041	*) : in case they cannot read
24042		sh 1>&4 -c "$ans";;
24043	esac
24044	;;
24045esac
24046
24047: if this fails, just run all the .SH files by hand
24048. ./config.sh
24049
24050echo " "
24051exec 1>&4
24052pwd=`pwd`
24053. ./UU/extract
24054cd "$pwd"
24055
24056if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24057	dflt=y
24058	case "$silent" in
24059	true) ;;
24060	*)
24061		$cat <<EOM
24062
24063Now you need to generate make dependencies by running "$make depend".
24064You might prefer to run it in background: "$make depend > makedepend.out &"
24065It can take a while, so you might not want to run it right now.
24066
24067EOM
24068		;;
24069	esac
24070	rp="Run $make depend now?"
24071	. UU/myread
24072	case "$ans" in
24073	y*)
24074		$make depend && echo "Now you must run '$make'."
24075		;;
24076	*)
24077		echo "You must run '$make depend' then '$make'."
24078		;;
24079	esac
24080elif test -f [Mm]akefile; then
24081	echo " "
24082	echo "Now you must run a $make."
24083else
24084	echo "Configure done."
24085fi
24086
24087if $test -f Policy.sh; then
24088    $cat <<EOM
24089
24090If you compile $package on a different machine or from a different object
24091directory, copy the Policy.sh file from this object directory to the
24092new one before you run Configure -- this will help you with most of
24093the policy defaults.
24094
24095EOM
24096fi
24097if $test -f config.msg; then
24098    echo "Hmm.  I also noted the following information while running:"
24099    echo " "
24100    $cat config.msg >&4
24101    $rm -f config.msg
24102fi
24103$rm -f kit*isdone ark*isdone
24104$rm -rf UU
24105
24106: End of Configure
24107
24108